Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4592 in orxonox.OLD for orxonox/trunk/src/world_entities/test_gun.cc


Ignore:
Timestamp:
Jun 10, 2005, 7:17:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: derivations work.
now the only thing to do is specify all the classes, and DO it CLEAN.

@patrick: is it ok, how i treated your ObjectManager??

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/test_gun.cc

    r4504 r4592  
    11
    22
    3 /* 
     3/*
    44   orxonox - the future of 3D-vertical-scrollers
    55
     
    1313   ### File Specific
    1414   main-programmer: Patrick Boenzli
    15    co-programmer: 
     15   co-programmer:
    1616
    1717
     
    4343   creates a new weapon
    4444*/
    45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 
    46   :  Weapon (parent, coordinate, direction) 
     45TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight)
     46  :  Weapon (parent, coordinate, direction)
    4747{
    4848  this->setClassID(CL_TEST_GUN, "TestGun");
     
    6565      this->projectileOffset = Vector(1.0, 0.0, -0.35);
    6666
    67       this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 
     67      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    6868      this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    6969      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    7070
    71       this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 
     71      this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    7272      this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    7373
    7474      this->animation3->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    75       this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 
     75      this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    7676    }
    7777  else if( this->leftRight == W_RIGHT)
     
    8080
    8181      this->objectComponent1->setRelCoor(Vector(0,0,0.35));
    82       this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 
     82      this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    8383      this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    8484      this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    8585
    86       this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 
     86      this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    8787      this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    8888
    8989      this->animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    90       this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 
     90      this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    9191    }
    92  
     92
    9393  this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV);
    9494  this->weaponSource = new SoundSource(this->fireSound, this);
     
    103103   \brief standard deconstructor
    104104*/
    105 TestGun::~TestGun () 
     105TestGun::~TestGun ()
    106106{
    107107  // model will be deleted from WorldEntity-destructor
     
    112112   \brief this activates the weapon
    113113
    114    This is needed, since there can be more than one weapon on a ship. the 
    115    activation can be connected with an animation. for example the weapon is 
    116    been armed out. 
     114   This is needed, since there can be more than one weapon on a ship. the
     115   activation can be connected with an animation. for example the weapon is
     116   been armed out.
    117117*/
    118118void TestGun::activate()
     
    125125   \brief this deactivates the weapon
    126126
    127    This is needed, since there can be more than one weapon on a ship. the 
    128    activation can be connected with an animation. for example the weapon is 
     127   This is needed, since there can be more than one weapon on a ship. the
     128   activation can be connected with an animation. for example the weapon is
    129129   been armed out.
    130130*/
     
    137137/**
    138138   \brief fires the weapon
    139    
     139
    140140   this is called from the player.cc, when fire-button is been pushed
    141141   \todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
     
    149149    }
    150150
    151   Projectile* pj = dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET));
     151  Projectile* pj = dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS));
    152152  weaponSource->play();
    153153
     
    157157  this->worldEntities->add(pj);
    158158  this->localTime = 0;
    159  
     159
    160160  this->animation1->replay();
    161161}
     
    170170   can destroy the weapons of enemies or vice versa.
    171171*/
    172 void TestGun::hit (WorldEntity* entity, Vector* position) 
     172void TestGun::hit (WorldEntity* entity, Vector* position)
    173173{}
    174174
     
    180180   hit, it can also be destoryed.
    181181*/
    182 void TestGun::destroy () 
     182void TestGun::destroy ()
    183183{}
    184184
     
    187187   \brief tick signal for time dependent/driven stuff
    188188*/
    189 void TestGun::tick (float time) 
     189void TestGun::tick (float time)
    190190{
    191191  this->localTime += time;
     
    203203   \brief this will draw the weapon
    204204*/
    205 void TestGun::draw () 
     205void TestGun::draw ()
    206206{
    207207  /* draw gun body */
     
    209209  glPushMatrix();
    210210  float matrix[4][4];
    211   glTranslatef (this->getAbsCoor ().x, 
    212                 this->getAbsCoor ().y,
    213                 this->getAbsCoor ().z); 
     211  glTranslatef (this->getAbsCoor ().x,
     212                this->getAbsCoor ().y,
     213                this->getAbsCoor ().z);
    214214  this->getAbsDir ().matrix (matrix);
    215215  glMultMatrixf((float*)matrix);
     
    222222  glMatrixMode(GL_MODELVIEW);
    223223  glPushMatrix();
    224   glTranslatef (this->objectComponent1->getAbsCoor ().x, 
    225                 this->objectComponent1->getAbsCoor ().y,
    226                 this->objectComponent1->getAbsCoor ().z);
     224  glTranslatef (this->objectComponent1->getAbsCoor ().x,
     225                this->objectComponent1->getAbsCoor ().y,
     226                this->objectComponent1->getAbsCoor ().z);
    227227  this->objectComponent1->getAbsDir ().matrix (matrix);
    228228  glMultMatrixf((float*)matrix);
Note: See TracChangeset for help on using the changeset viewer.