Changeset 4592 in orxonox.OLD for orxonox/trunk/src/world_entities/test_gun.cc
- Timestamp:
- Jun 10, 2005, 7:17:22 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/test_gun.cc
r4504 r4592 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 13 13 ### File Specific 14 14 main-programmer: Patrick Boenzli 15 co-programmer: 15 co-programmer: 16 16 17 17 … … 43 43 creates a new weapon 44 44 */ 45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 46 : Weapon (parent, coordinate, direction) 45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 46 : Weapon (parent, coordinate, direction) 47 47 { 48 48 this->setClassID(CL_TEST_GUN, "TestGun"); … … 65 65 this->projectileOffset = Vector(1.0, 0.0, -0.35); 66 66 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); 68 68 this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 69 69 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 70 70 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); 72 72 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 73 73 74 74 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); 76 76 } 77 77 else if( this->leftRight == W_RIGHT) … … 80 80 81 81 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); 83 83 this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 84 84 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 85 85 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); 87 87 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 88 88 89 89 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); 91 91 } 92 92 93 93 this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV); 94 94 this->weaponSource = new SoundSource(this->fireSound, this); … … 103 103 \brief standard deconstructor 104 104 */ 105 TestGun::~TestGun () 105 TestGun::~TestGun () 106 106 { 107 107 // model will be deleted from WorldEntity-destructor … … 112 112 \brief this activates the weapon 113 113 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. 117 117 */ 118 118 void TestGun::activate() … … 125 125 \brief this deactivates the weapon 126 126 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 129 129 been armed out. 130 130 */ … … 137 137 /** 138 138 \brief fires the weapon 139 139 140 140 this is called from the player.cc, when fire-button is been pushed 141 141 \todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent … … 149 149 } 150 150 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)); 152 152 weaponSource->play(); 153 153 … … 157 157 this->worldEntities->add(pj); 158 158 this->localTime = 0; 159 159 160 160 this->animation1->replay(); 161 161 } … … 170 170 can destroy the weapons of enemies or vice versa. 171 171 */ 172 void TestGun::hit (WorldEntity* entity, Vector* position) 172 void TestGun::hit (WorldEntity* entity, Vector* position) 173 173 {} 174 174 … … 180 180 hit, it can also be destoryed. 181 181 */ 182 void TestGun::destroy () 182 void TestGun::destroy () 183 183 {} 184 184 … … 187 187 \brief tick signal for time dependent/driven stuff 188 188 */ 189 void TestGun::tick (float time) 189 void TestGun::tick (float time) 190 190 { 191 191 this->localTime += time; … … 203 203 \brief this will draw the weapon 204 204 */ 205 void TestGun::draw () 205 void TestGun::draw () 206 206 { 207 207 /* draw gun body */ … … 209 209 glPushMatrix(); 210 210 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); 214 214 this->getAbsDir ().matrix (matrix); 215 215 glMultMatrixf((float*)matrix); … … 222 222 glMatrixMode(GL_MODELVIEW); 223 223 glPushMatrix(); 224 glTranslatef (this->objectComponent1->getAbsCoor ().x, 225 this->objectComponent1->getAbsCoor ().y, 226 224 glTranslatef (this->objectComponent1->getAbsCoor ().x, 225 this->objectComponent1->getAbsCoor ().y, 226 this->objectComponent1->getAbsCoor ().z); 227 227 this->objectComponent1->getAbsDir ().matrix (matrix); 228 228 glMultMatrixf((float*)matrix);
Note: See TracChangeset
for help on using the changeset viewer.