Changeset 6804 in orxonox.OLD for trunk/src/world_entities/creatures
- Timestamp:
- Jan 28, 2006, 11:29:03 AM (19 years ago)
- Location:
- trunk/src/world_entities/creatures
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/creatures/md2_creature.cc
r6561 r6804 39 39 40 40 CREATE_FACTORY(MD2Creature, CL_MD2_CREATURE); 41 42 /**43 * creates the controlable MD2Creature44 */45 MD2Creature::MD2Creature()46 {47 this->init();48 }49 41 50 42 /** … … 231 223 void MD2Creature::collidesWith(WorldEntity* entity, const Vector& location) 232 224 { 233 if (entity->isA(CL_TURRET_POWER_UP) ) 234 { 235 this->ADDWEAPON(); 236 } 237 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 225 238 226 } 239 227 … … 254 242 void MD2Creature::tick (float time) 255 243 { 244 Playable::tick(time); 256 245 if( likely(this->getModel(0) != NULL)) 257 246 ((MD2Model*)this->getModel(0))->tick(time); … … 284 273 this->setAbsDir(mouseDirX); 285 274 this->cameraConnNode.setRelDir(mouseDirY); 286 287 this->getWeaponManager()->tick(time);288 // weapon system manipulation289 this->weaponAction();290 275 } 291 276 … … 348 333 349 334 350 /**351 * weapon manipulation by the player352 */353 void MD2Creature::weaponAction()354 {355 if( this->bFire)356 {357 this->getWeaponManager()->fire();358 }359 }360 335 361 336 /** … … 364 339 void MD2Creature::process(const Event &event) 365 340 { 341 Playable::process(event); 366 342 if( event.type == SDLK_a) 367 343 this->bStrafeL = event.bPressed; 368 344 else if( event.type == SDLK_d) 369 345 this->bStrafeR = event.bPressed; 370 else if( event.type == KeyMapper::PEV_FIRE1)371 this->bFire = event.bPressed;372 else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)373 this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;374 else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)375 this->getWeaponManager()->previousWeaponConfig();376 346 else if( event.type == SDLK_w) 377 347 this->bUp = event.bPressed; //this->shiftCoor(0,.1,0); … … 390 360 } 391 361 } 392 393 #include "weapons/aiming_turret.h"394 // FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG395 void MD2Creature::ADDWEAPON()396 {397 Weapon* turret = NULL;398 399 if ((float)rand()/RAND_MAX < .1)400 {401 //if (this->getWeaponManager()->hasFreeSlot(2, WTYPE_TURRET))402 {403 turret = new Turret();404 this->getWeaponManager()->addWeapon(turret, 2);405 this->getWeaponManager()->changeWeaponConfig(2);406 }407 }408 else409 {410 //if (this->getWeaponManager()->hasFreeSlot(3))411 {412 turret = new AimingTurret();413 this->getWeaponManager()->addWeapon(turret, 3);414 415 this->getWeaponManager()->changeWeaponConfig(3);416 }417 }418 419 if(turret != NULL)420 {421 turret->setName("Turret");422 turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);423 }424 } -
trunk/src/world_entities/creatures/md2_creature.h
r6561 r6804 19 19 public: 20 20 21 MD2Creature();22 21 MD2Creature(const char* fileName); 23 MD2Creature(const TiXmlElement* root );22 MD2Creature(const TiXmlElement* root = NULL); 24 23 virtual ~MD2Creature(); 25 24 26 void init();27 25 virtual void loadParams(const TiXmlElement* root); 28 26 … … 42 40 43 41 private: 42 void init(); 44 43 45 44 void calculateVelocity(float time); 46 void weaponAction();47 48 // !! temporary !!49 void ADDWEAPON();50 45 51 46 bool bUp; //!< up button pressed.
Note: See TracChangeset
for help on using the changeset viewer.