- Timestamp:
- Dec 27, 2006, 12:03:36 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/space_ships/space_ship.cc
r10139 r10152 161 161 //wpLeft2->setParent( this); 162 162 163 Weapon* wpRight3 = new HeavyBlaster ( );163 Weapon* wpRight3 = new HeavyBlaster (1); 164 164 wpRight3->setName( "HeavyBlaster"); 165 165 //wpRight3->setParent( this); 166 Weapon* wpLeft3 = new HeavyBlaster ( );166 Weapon* wpLeft3 = new HeavyBlaster (0); 167 167 wpLeft3->setName( "HeavyBlaster"); 168 168 //wpLeft3->setParent( this); … … 182 182 this->weaponMan.addWeapon( wpRight3, 2, 5); 183 183 184 this->weaponMan.addWeapon( wpLeft1, 3, 0); 185 this->weaponMan.addWeapon( wpRight1, 3, 1); 186 187 this->weaponMan.addWeapon( wpLeft2, 3, 2); 188 this->weaponMan.addWeapon( wpRight2, 3, 3); 189 190 this->weaponMan.addWeapon( wpLeft3, 3, 4); 191 this->weaponMan.addWeapon( wpRight3, 3, 5); 192 184 193 this->secWeaponMan.addWeapon( cannon, 0, 0); 185 194 186 195 187 this->weaponMan.changeWeaponConfig( 2);196 this->weaponMan.changeWeaponConfig(3); 188 197 this->secWeaponMan.changeWeaponConfig(0); 189 198 … … 274 283 this->weaponMan.setSlotCount(6); 275 284 276 this->weaponMan.setSlotPosition(0, Vector( -2.6, 0, -3.0));285 this->weaponMan.setSlotPosition(0, Vector(0.0, 0, -3.0)); 277 286 this->weaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 278 287 279 this->weaponMan.setSlotPosition(1, Vector( -2.6, 0, 3.0));288 this->weaponMan.setSlotPosition(1, Vector(0.0, 0, 3.0)); 280 289 this->weaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 281 290 -
branches/playability/src/world_entities/weapons/heavy_blaster.cc
r10140 r10152 15 15 * Standard constructor 16 16 */ 17 HeavyBlaster::HeavyBlaster ( )17 HeavyBlaster::HeavyBlaster (int leftRight) 18 18 : Weapon() 19 19 { 20 this->init( );20 this->init(leftRight); 21 21 } 22 22 … … 24 24 : Weapon() 25 25 { 26 this->init(); 26 // TODO add leftRight to params 27 this->init(0); 27 28 if (root != NULL) 28 29 this->loadParams(root); … … 34 35 HeavyBlaster::~HeavyBlaster() 35 36 { 36 // model will be deleted from WorldEntity-destructor 37 this->deconstr(); 38 // model will be deleted from WorldEntity-destructor 37 39 } 38 40 … … 42 44 } 43 45 44 void HeavyBlaster::init() 45 { 46 void HeavyBlaster::init(int leftRight) 47 { 48 49 this->leftRight = leftRight; 46 50 //this->registerObject(this, HeavyBlaster::_objectList); 47 51 … … 70 74 this->setBarrels(3); 71 75 this->setSegs(2); 72 73 this->objComp1 = new PNode; 74 this->objComp2 = new PNode; 75 this->objComp3 = new PNode; 76 this->objComp4 = new PNode; 77 this->objComp5 = new PNode; 78 this->objComp6 = new PNode; 79 80 Animation3D* animB0Shoot = this->getAnimation(WS_SHOOTING0, this->objComp1); 76 this->activeBarrel = 0; 77 // this->init2(); 78 79 80 81 this->objComp = new PNode**[this->getBarrels()]; 82 this->emissionPoint = new PNode*[this->getBarrels()]; 83 this->shootAnim = new Animation3D**[this->getBarrels()]; 84 for (int i = 0; i < this->getBarrels(); i++) 85 { 86 this->objComp[i] = new PNode* [this->getSegs()]; 87 this->emissionPoint[i] = new PNode; 88 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles 89 this->emissionPoint[i]->setName("EmissionPoint"); 90 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 91 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 92 for(int j = 0; j < this->getSegs(); j++) 93 { 94 this->objComp[i][j] = new PNode; 95 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 96 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 97 } 98 } 99 100 this->emissionPoint[0]->setRelCoor(Vector(1.1, 0.14, 0.06)); 101 this->emissionPoint[1]->setRelCoor(Vector(1.1, -.06, 0.14)); 102 this->emissionPoint[2]->setRelCoor(Vector(1.1, 0.06, -.14)); 103 104 105 // Animation3D* animB0Shoot = this->getAnimation(WS_SHOOTING0, this->objComp[0][0]); 81 106 // Animation3D* animB1Shoot = this->getAnimation(WS_SHOOTING1, this->objComp2); 82 107 // Animation3D* animB2Shoot = this->getAnimation(WS_SHOOTING2, this->objComp3); 83 // Animation3D* animT0Shoot = this->getAnimation(WS_SHOOTING3, this->objComp 4);108 // Animation3D* animT0Shoot = this->getAnimation(WS_SHOOTING3, this->objComp[0][1]); 84 109 // Animation3D* animT1Shoot = this->getAnimation(WS_SHOOTING4, this->objComp5); 85 110 // Animation3D* animT2Shoot = this->getAnimation(WS_SHOOTING5, this->objComp6); 86 111 87 animB0Shoot->setInfinity(ANIM_INF_CONSTANT); 112 113 // this->shootAnim[0][0]->setInfinity(ANIM_INF_CONSTANT); 88 114 // animB1Shoot->setInfinity(ANIM_INF_CONSTANT); 89 115 // animB2Shoot->setInfinity(ANIM_INF_CONSTANT); … … 92 118 // animT2Shoot->setInfinity(ANIM_INF_CONSTANT); 93 119 94 animB0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 95 animB0Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 96 animB0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 97 /* 98 animT0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 99 animT0Shoot->addKeyFrame(Vector(-0.04, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 100 animT0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);*/ 101 /* 102 animB1Shoot->addKeyFrame(Vector(0.1, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 103 animB1Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 104 animB1Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL); 105 106 animT1Shoot->addKeyFrame(Vector(0.04, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 107 animT1Shoot->addKeyFrame(Vector(-0.04, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 108 animT1Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL); 109 110 animB2Shoot->addKeyFrame(Vector(0.1, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 111 animB2Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 112 animB2Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL); 113 114 animT2Shoot->addKeyFrame(Vector(0.04, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 115 animT2Shoot->addKeyFrame(Vector(-0.04, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 116 animT2Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);*/ 120 for (int i = 0; i < this->getBarrels(); i++){ 121 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 122 this->shootAnim[i][0]->addKeyFrame(Vector(-0.3, 0.0, 0.0), Quaternion(), 1.0, ANIM_LINEAR, ANIM_NULL); 123 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.4, ANIM_LINEAR, ANIM_NULL); 124 125 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 126 this->shootAnim[i][1]->addKeyFrame(Vector(-0.4, 0.0, 0.0), Quaternion(), 1.0, ANIM_LINEAR, ANIM_NULL); 127 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.4, ANIM_LINEAR, ANIM_NULL); 128 } 117 129 118 130 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); … … 122 134 animation3->setInfinity(ANIM_INF_CONSTANT); 123 135 124 this->setEmissionPoint(3.8, 1.2, 0, 0);136 // this->setEmissionPoint(3.8, 1.2, 0, 0); 125 137 126 138 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); … … 140 152 // set the owner 141 153 pj->setOwner(this->getOwner()); 142 143 154 pj->setParent(PNode::getNullParent()); 144 155 … … 147 158 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*130 + VECTOR_RAND(1)); 148 159 149 pj->setAbsCoor(this->getEmissionPoint(0)); 160 pj->setAbsCoor(this->emissionPoint[this->activeBarrel]->getAbsCoor()); 161 // pj->setAbsCoor(this->getEmissionPoint(0)); 150 162 pj->setAbsDir(this->getAbsDir()); 151 pj->toList(OM_GROUP_01_PROJ);163 // pj->toList(OM_GROUP_01_PROJ); 152 164 pj->activate(); 165 166 // initiate animation 167 for (int i = 0; i < this->getSegs(); i++) 168 this->shootAnim[this->activeBarrel][i]->replay(); 169 170 // switch barrel 171 this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels(); 153 172 } 154 173 … … 167 186 } 168 187 188 169 189 void HeavyBlaster::draw() const 170 190 { … … 175 195 this->getAbsCoor ().z); 176 196 197 if (this->leftRight == W_LEFT) 198 glScalef(1.0, 1.0, -1.0); 199 177 200 static_cast<StaticModel*>(this->getModel())->draw(6); 178 201 179 202 glPushMatrix(); 180 glTranslatef (this->objComp 1->getAbsCoor().x, this->objComp1->getAbsCoor().y, this->objComp1->getAbsCoor().z);203 glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z); 181 204 static_cast<StaticModel*>(this->getModel())->draw(1); 182 static_cast<StaticModel*>(this->getModel())->draw(2); 183 static_cast<StaticModel*>(this->getModel())->draw(0); 184 185 glPushMatrix(); 186 glTranslatef (this->objComp4->getAbsCoor().x, this->objComp4->getAbsCoor().y, this->objComp4->getAbsCoor().z); 187 static_cast<StaticModel*>(this->getModel())->draw(4); 188 static_cast<StaticModel*>(this->getModel())->draw(5); 189 static_cast<StaticModel*>(this->getModel())->draw(3); 190 glPopMatrix(); 191 glPopMatrix(); 192 /* 193 glPushMatrix(); 194 glTranslatef (this->objComp2->getAbsCoor().x, this->objComp2->getAbsCoor().y, this->objComp2->getAbsCoor().z); 205 glPopMatrix(); 206 207 glPushMatrix(); 208 glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z); 195 209 static_cast<StaticModel*>(this->getModel())->draw(2); 196 210 glPopMatrix(); 197 211 198 212 glPushMatrix(); 199 glTranslatef (this->objComp 3->getAbsCoor().x, this->objComp3->getAbsCoor().y, this->objComp3->getAbsCoor().z);213 glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z); 200 214 static_cast<StaticModel*>(this->getModel())->draw(0); 201 glPopMatrix();*/ 202 203 // glPushMatrix(); 204 // glTranslatef (this->objComp4->getAbsCoor().x, this->objComp4->getAbsCoor().y, this->objComp4->getAbsCoor().z); 205 // static_cast<StaticModel*>(this->getModel())->draw(4); 206 // static_cast<StaticModel*>(this->getModel())->draw(5); 207 // static_cast<StaticModel*>(this->getModel())->draw(3); 208 // glPopMatrix(); 209 /* 210 glPushMatrix(); 211 glTranslatef (this->objComp5->getAbsCoor().x, this->objComp5->getAbsCoor().y, this->objComp5->getAbsCoor().z); 215 glPopMatrix(); 216 217 glPushMatrix(); 218 glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z); 219 static_cast<StaticModel*>(this->getModel())->draw(4); 220 glPopMatrix(); 221 222 glPushMatrix(); 223 glTranslatef (this->objComp[1][1]->getAbsCoor().x, this->objComp[1][1]->getAbsCoor().y, this->objComp[1][1]->getAbsCoor().z); 212 224 static_cast<StaticModel*>(this->getModel())->draw(5); 213 225 glPopMatrix(); 214 226 215 227 glPushMatrix(); 216 glTranslatef (this->objComp 6->getAbsCoor().x, this->objComp6->getAbsCoor().y, this->objComp6->getAbsCoor().z);228 glTranslatef (this->objComp[2][1]->getAbsCoor().x, this->objComp[2][1]->getAbsCoor().y, this->objComp[2][1]->getAbsCoor().z); 217 229 static_cast<StaticModel*>(this->getModel())->draw(3); 218 glPopMatrix(); */219 220 glPopMatrix(); 221 } 230 glPopMatrix(); 231 232 glPopMatrix(); 233 } -
branches/playability/src/world_entities/weapons/heavy_blaster.h
r10133 r10152 4 4 5 5 #include "weapon.h" 6 7 #define W_LEFT 0 8 #define W_RIGHT 1 6 9 7 10 /** … … 14 17 //ObjectListDeclaration(HeavyBlaster); 15 18 public: 16 HeavyBlaster( );19 HeavyBlaster(int leftRight); 17 20 HeavyBlaster (const TiXmlElement* root); 18 21 virtual ~HeavyBlaster(); 19 22 20 void init( );23 void init(int leftRight); 21 24 virtual void loadParams(const TiXmlElement* root); 22 25 … … 29 32 30 33 private: 31 PNode* objComp1; 32 PNode* objComp2; 33 PNode* objComp3; 34 PNode* objComp4; 35 PNode* objComp5; 36 PNode* objComp6; 34 PNode*** objComp; 35 Animation3D*** shootAnim; 36 PNode** emissionPoint; 37 38 int activeBarrel; 39 40 int leftRight; 37 41 }; 38 42 -
branches/playability/src/world_entities/weapons/light_blaster.cc
r10109 r10152 45 45 { 46 46 47 this->loadModel("models/guns/ plasmadriver_#.obj", 1.0);47 this->loadModel("models/guns/gattling.obj", 0.333); 48 48 49 49 … … 66 66 this->prepareProjectiles(100); 67 67 68 this->setBarrels(3); 69 this->setSegs(1); 70 this->activeBarrel = 0; 71 72 this->objComp = new PNode**[this->getBarrels()]; 73 this->emissionPoint = new PNode*[this->getBarrels()]; 74 this->shootAnim = new Animation3D**[this->getBarrels()]; 75 for (int i = 0; i < this->getBarrels(); i++) 76 { 77 this->objComp[i] = new PNode* [this->getSegs()]; 78 this->emissionPoint[i] = new PNode; 79 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles 80 this->emissionPoint[i]->setName("EmissionPoint"); 81 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 82 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 83 for(int j = 0; j < this->getSegs(); j++) 84 { 85 this->objComp[i][j] = new PNode; 86 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 87 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 88 } 89 } 90 91 for (int i = 0; i < this->getBarrels(); i++ ) 92 this->emissionPoint[i]->setRelCoor(Vector(1.19, 0.0, 0.1)); 93 94 // Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this); 68 95 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); 69 96 Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this); 70 97 98 // animation1->setInfinity(ANIM_INF_CONSTANT); 71 99 animation2->setInfinity(ANIM_INF_CONSTANT); 72 100 animation3->setInfinity(ANIM_INF_CONSTANT); 73 101 74 this->setEmissionPoint(3.8, 1.2, 0); 102 // this->setEmissionPoint(3.8, 1.2, 0); 103 104 for (int i = 0; i < this->getBarrels(); i++){ 105 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(0, 0, 0), 0.05, ANIM_NULL, ANIM_LINEAR); 106 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(120, 0, 0), 0.0, ANIM_NULL, ANIM_LINEAR); 107 } 108 75 109 76 110 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); … … 96 130 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*180); 97 131 98 pj->setAbsCoor(this-> getEmissionPoint());132 pj->setAbsCoor(this->emissionPoint[this->activeBarrel]->getAbsCoor()); 99 133 pj->setAbsDir(this->getAbsDir()); 100 pj->toList(OM_GROUP_01_PROJ);134 // pj->toList(OM_GROUP_01_PROJ); 101 135 pj->activate(); 136 137 for (int i = 0; i < this->getSegs(); i++) 138 this->shootAnim[this->activeBarrel][i]->replay(); 139 140 // switch barrel 141 this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels(); 102 142 } 103 143 … … 118 158 void LightBlaster::draw() const 119 159 { 160 glMatrixMode(GL_MODELVIEW); 161 glPushMatrix(); 162 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 163 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 164 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 165 static_cast<StaticModel*>(this->getModel())->draw(); 166 glPopMatrix(); 120 167 } -
branches/playability/src/world_entities/weapons/light_blaster.h
r9975 r10152 28 28 virtual void draw() const; 29 29 30 private: 31 PNode*** objComp; 32 Animation3D*** shootAnim; 33 34 PNode** emissionPoint; 35 36 int activeBarrel; 30 37 }; 31 38 -
branches/playability/src/world_entities/weapons/weapon.cc
r10140 r10152 124 124 this->segs = 1; 125 125 126 this->shootAnim = new Animation3D**[this->getBarrels()]; 127 for (int i = 0; i < this->getBarrels(); i++) 128 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 129 126 130 this->emissionPoint = new PNode*[this->barrels]; 127 131 for(int i = 0; i < this->barrels; i++){ … … 150 154 // set this object to be synchronized over network 151 155 //this->setSynchronized(true); 156 } 157 158 /** 159 * needed, if there are more than one barrel or segments 160 */ 161 void Weapon::init2() 162 { 163 if (this->barrels == 1 && this->segs == 1) 164 return; 165 166 delete this->emissionPoint[0]; 167 delete this->emissionPoint; 168 delete this->shootAnim[0]; 169 delete this->shootAnim; 170 171 this->shootAnim = new Animation3D**[this->barrels]; 172 this->emissionPoint = new PNode*[this->barrels]; 173 for(int i = 0; i < this->barrels; i++){ 174 this->emissionPoint[i] = new PNode; 175 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles 176 this->emissionPoint[i]->setName("EmissionPoint"); 177 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 178 this->shootAnim[i] = new Animation3D* [this->segs]; 179 } 180 } 181 182 /** 183 * deconstructor for init2 184 */ 185 void Weapon::deconstr() 186 { 187 for(int i = 0; i < this->barrels; i++) { 188 delete this->emissionPoint[i]; 189 for (int j = 0; j < this->segs; j++) 190 delete this->shootAnim[i][j]; 191 delete this->shootAnim[i]; 192 } 193 194 delete this->emissionPoint; 195 delete this->shootAnim; 152 196 } 153 197 … … 327 371 } 328 372 329 Animation3D* Weapon::getAnimation( ShootingStates state, PNode* node)330 { 331 if ( state >= WS_SS_MAX) // if the state is not known373 Animation3D* Weapon::getAnimation(int barrel, int seg, PNode* node) 374 { 375 if (barrel >= this->getBarrels() || seg >= this->getSegs()) // if the state is not known 332 376 return NULL; 333 377 334 if (unlikely(this-> animation[state] == NULL)) // if the animation does not exist yet create it.378 if (unlikely(this->shootAnim[barrel][seg] == NULL)) // if the animation does not exist yet create it. 335 379 { 336 380 if (likely(node != NULL)) 337 return this-> animation[state] = new Animation3D(node);381 return this->shootAnim[barrel][seg] = new Animation3D(node); 338 382 else 339 383 { … … 343 387 } 344 388 else 345 return this-> animation[state];389 return this->shootAnim[barrel][seg]; 346 390 } 347 391 -
branches/playability/src/world_entities/weapons/weapon.h
r10140 r10152 55 55 WS_STATE_COUNT = 8 //!< This must match the count of enumerations-members. 56 56 } WeaponState; 57 58 typedef enum59 {60 WS_SHOOTING0 = 0x00000001, //!< Fireing 1st Barrel61 WS_SHOOTING1 = 0x00000002, //!< Fireing 2nd Barrel62 WS_SHOOTING2 = 0x00000004, //!< Fireing 3rd Barrel63 WS_SHOOTING3 = 0x00000008, //!< Fireing 4st Barrel64 WS_SHOOTING4 = 0x00000010, //!< Fireing 5st Barrel65 WS_SHOOTING5 = 0x00000020, //!< Fireing 6st Barrel66 WS_SHOOTING6 = 0x00000040, //!< Fireing 7st Barrel67 WS_SHOOTING7 = 0x00000080, //!< Fireing 8st Barrel68 69 WS_SS_MAX = 0x000000ff70 }ShootingStates;71 57 72 58 //! an enumerator defining capabilities of a WeaponSlot … … 177 163 178 164 Animation3D* getAnimation(WeaponState state, PNode* node = NULL); 179 Animation3D* getAnimation( ShootingStates state, PNode* node = NULL);165 Animation3D* getAnimation(int barrel, int seg, PNode* node); 180 166 Animation3D* copyAnimation(WeaponState from, WeaponState to); 181 167 … … 190 176 void debug() const; 191 177 192 178 inline int getBarrels() {return this->barrels; }; 179 inline int getSegs() { return this->segs; }; 180 inline void setBarrels(int barrels) { this->barrels = barrels; }; 181 inline void setSegs(int segs) { this->segs = segs; }; 182 183 inline Animation3D* getShootAnim(int barrel, int seg) { return this->shootAnim[barrel][seg]; }; 184 inline void setShootAnim(int barrel, int seg, PNode* component) { this->shootAnim[barrel][seg] = this->getAnimation(barrel, seg, component); }; 185 186 void init2(); 187 void deconstr(); 193 188 194 189 protected: … … 208 203 209 204 210 inline int getBarrels() {return this->barrels; };211 inline int getSeg() {return this->segs; };212 inline void setBarrels(int barrels) { this->barrels = barrels; };213 inline void setSegs(int segs) { this->segs = segs; };214 205 215 206 private: … … 268 259 int barrels; //!< # of barrels 269 260 int segs; //!< # of segments, one barrel has 261 Animation3D*** shootAnim; 262 270 263 }; 271 264
Note: See TracChangeset
for help on using the changeset viewer.