Changeset 9961 in orxonox.OLD for branches/playability/src
- Timestamp:
- Nov 26, 2006, 10:15:51 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/playable.h
r9869 r9961 117 117 void unregisterEvent(int eventType); 118 118 119 protected: 120 WeaponManager weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping 121 bool bFire; //!< If the Ship is firing. 122 short supportedPlaymodes; //!< What Playmodes are Supported in this Playable. 123 Playable::Playmode playmode; //!< The current playmode. 124 119 125 private: 120 WeaponManager weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping121 126 std::vector<int> events; //!< A list of Events, that are captured for this playable 122 127 123 128 Player* currentPlayer; //!< The Player currently connected to this Playable (the one that has controll) otherwise NULL 124 129 125 bool bFire; //!< If the Ship is firing.126 130 int oldFlags; //!< Used for synchronisation 127 131 … … 131 135 132 136 bool bDead; 133 short supportedPlaymodes; //!< What Playmodes are Supported in this Playable.134 Playable::Playmode playmode; //!< The current playmode.135 137 136 138 float enterRadius; //!< How far one can be away from the Playable to enter it. -
branches/playability/src/world_entities/space_ships/space_ship.cc
r9959 r9961 84 84 */ 85 85 SpaceShip::SpaceShip(const std::string& fileName) 86 : primWeaponMan(this), 87 secWeaponMan(this), 88 supportedPlaymodes(Playable::Full3D || Playable::Horizontal || Playable::Vertical), 89 playmode(Playable::Full3D) 86 90 { 87 91 this->init(); … … 104 108 */ 105 109 SpaceShip::SpaceShip(const TiXmlElement* root) 110 : primWeaponMan(this), 111 secWeaponMan(this), 112 supportedPlaymodes(Playable::Full3D || Playable::Horizontal || Playable::Vertical), 113 playmode(Playable::Full3D) 106 114 { 107 115 this->init(); … … 127 135 Weapon* wpLeft = new TestGun(1); 128 136 wpLeft->setName("testGun Left"); 129 //Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON)); 130 131 //cannon->setName("BFG"); 132 137 138 Weapon* cannon = new Cannon(); 139 cannon->setName("BFG"); 140 141 142 this->primWeaponMan.addWeapon( wpLeft, 1, 0); 143 this->primWeaponMan.addWeapon( wpRight, 1, 1); 144 this->secWeaponMan.addWeapon( cannon, 0, 6); 145 146 this->primWeaponMan.changeWeaponConfig(1); 147 148 wpRight->requestAction(WA_ACTIVATE); 149 wpLeft->requestAction(WA_ACTIVATE); 150 cannon->requestAction(WA_ACTIVATE); 151 /* 133 152 this->addWeapon(wpLeft, 1, 0); 134 153 this->addWeapon(wpRight,1 ,1); … … 136 155 137 156 this->getWeaponManager().changeWeaponConfig(1); 138 139 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false; 157 */ 158 159 this->loadModel("models/ships/hoverglider_mainbody.obj"); 160 161 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bPrimFire = bSecFire = false; 140 162 141 163 xMouse = yMouse = 0; … … 183 205 registerEvent(EV_MOUSE_MOTION); 184 206 185 this-> getWeaponManager().setSlotCount(7);186 187 this-> getWeaponManager().setSlotPosition(0, Vector(-2.6, .1, -3.0));188 this-> getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);189 190 this-> getWeaponManager().setSlotPosition(1, Vector(-2.6, .1, 3.0));191 this-> getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);192 193 this-> getWeaponManager().setSlotPosition(2, Vector(-1.5, .5, -.5));194 this-> getWeaponManager().setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));195 196 this-> getWeaponManager().setSlotPosition(3, Vector(-1.5, .5, .5));197 this-> getWeaponManager().setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));198 199 this-> getWeaponManager().setSlotPosition(4, Vector(-1.5, -.5, .5));200 this-> getWeaponManager().setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));201 202 this-> getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5));203 this-> getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));207 this->primWeaponMan.setSlotCount(6); 208 209 this->primWeaponMan.setSlotPosition(0, Vector(-2.6, .1, -3.0)); 210 this->primWeaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 211 212 this->primWeaponMan.setSlotPosition(1, Vector(-2.6, .1, 3.0)); 213 this->primWeaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 214 215 this->primWeaponMan.setSlotPosition(2, Vector(-1.5, .5, -.5)); 216 this->primWeaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); 217 218 this->primWeaponMan.setSlotPosition(3, Vector(-1.5, .5, .5)); 219 this->primWeaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); 220 221 this->primWeaponMan.setSlotPosition(4, Vector(-1.5, -.5, .5)); 222 this->primWeaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0))); 223 224 this->primWeaponMan.setSlotPosition(5, Vector(-1.5, -.5, -.5)); 225 this->primWeaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 204 226 // 205 this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0)); 206 this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 227 this->primWeaponMan.setSlotPosition(6, Vector(-1, 0.0, 0)); 228 this->primWeaponMan.setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 229 230 this->secWeaponMan.setSlotCount(6); 231 232 this->secWeaponMan.setSlotPosition(0, Vector(2.6, -0.5, 0)); 233 this->secWeaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 234 235 this->secWeaponMan.setSlotPosition(1, Vector(2.6, .1, 3.0)); 236 this->secWeaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 237 238 this->secWeaponMan.setSlotPosition(2, Vector(1.5, .5, -.5)); 239 this->secWeaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); 240 241 this->secWeaponMan.setSlotPosition(3, Vector(1.5, .5, .5)); 242 this->secWeaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); 243 244 this->secWeaponMan.setSlotPosition(4, Vector(1.5, -.5, .5)); 245 this->secWeaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0))); 246 247 this->secWeaponMan.setSlotPosition(5, Vector(1.5, -.5, -.5)); 248 this->secWeaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 249 // 250 this->secWeaponMan.setSlotPosition(6, Vector(1, 0.0, 0)); 251 this->secWeaponMan.setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 207 252 // 208 253 // this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0)); … … 212 257 // this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 213 258 214 this->getWeaponManager().getFixedTarget()->setParent(this); 215 this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0); 216 217 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 259 this->primWeaponMan.getFixedTarget()->setParent(this); 260 this->primWeaponMan.getFixedTarget()->setRelCoor(100000,0,0); 261 262 this->secWeaponMan.getFixedTarget()->setParent(this); 263 this->secWeaponMan.getFixedTarget()->setRelCoor(100000,0,0); 264 265 dynamic_cast<Element2D*>(this->primWeaponMan.getFixedTarget())->setVisibility( false); 218 266 219 267 this->burstEmitter = new DotEmitter(200, 0.0, .01); … … 330 378 void SpaceShip::tick (float time) 331 379 { 332 Playable::tick(time); 380 // Playable::tick(time);$ 381 382 // Own Tick Setup, as a different fire routine is used on the weapon manager 383 this->primWeaponMan.tick(time); 384 this->secWeaponMan.tick(time); 385 386 if( this->bPrimFire) 387 { 388 this->primWeaponMan.fire(); 389 } 390 if( this->bSecFire) 391 { 392 this->secWeaponMan.fire(); 393 } 333 394 334 395 if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() ) … … 489 550 //rot.normalize(); 490 551 //this->setRelDirSoft(Quaternion(rotVal, rot), 5); 552 491 553 } 492 554 … … 496 558 void SpaceShip::process(const Event &event) 497 559 { 498 Playable::process(event);560 //Playable::process(event); 499 561 500 562 if( event.type == KeyMapper::PEV_LEFT) … … 506 568 else if( event.type == KeyMapper::PEV_BACKWARD) 507 569 this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0); 570 else if( event.type == KeyMapper::PEV_FIRE2) 571 this->bSecFire = event.bPressed; 508 572 else if( event.type == KeyMapper::PEV_FIRE1) 509 firedWeapon = curWeaponPrimary; 510 else if( event.type == KeyMapper::PEV_FIRE2) 511 firedWeapon = curWeaponSecondary; 573 this->bPrimFire = event.bPressed; 512 574 else if( event.type == EV_MOUSE_MOTION) 513 575 { 576 514 577 this->xMouse += event.xRel; 515 578 this->yMouse += event.yRel; -
branches/playability/src/world_entities/space_ships/space_ship.h
r9958 r9961 58 58 inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value 59 59 60 inline int getFiredWeapon() { return this->firedWeapon; }; //!< returns index of the fired weapon61 62 60 //damage handler 63 61 virtual void damage(float pDamage, float eDamage); //!< pDamage physical damage, eDamage electronic damage … … 69 67 70 68 void regen(float time); //!< handler for shield and electronic regeneration 69 70 WeaponManager primWeaponMan; //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping 71 WeaponManager secWeaponMan; //!< the secondary weapon manager: managing a list of special weapons to weapon-slot mapping 72 short supportedPlaymodes; //!< What Playmodes are Supported in this Playable. 73 Playable::Playmode playmode; //!< The current playmode. 74 bool bPrimFire; 75 bool bSecFire; 71 76 72 77 //ship atributes … … 99 104 100 105 101 int curWeaponPrimary; //!< current primary weapon 102 int curWeaponSecondary; //!< current secondary weapon 103 int firedWeapon; //!< index of the fired weapon for the weapon manager 106 int curWeaponPrimary; //!< current primary weapon config 107 int curWeaponSecondary; //!< current secondary weapon config 104 108 105 109 bool bUp; //!< up button pressed. -
branches/playability/src/world_entities/weapons/weapon_manager.cc
r9869 r9961 413 413 for(int i = 0; i < this->slotCount; i++) 414 414 { 415 416 415 firingWeapon = this->currentSlotConfig[i].currentWeapon; 416 if( firingWeapon != NULL) firingWeapon->requestAction(WA_SHOOT); 417 417 } 418 418 this->crosshair->setRotationSpeed(500);
Note: See TracChangeset
for help on using the changeset viewer.