Changeset 5750 in orxonox.OLD for trunk/src/world_entities/player.cc
- Timestamp:
- Nov 24, 2005, 12:13:22 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/player.cc
r5636 r5750 28 28 #include "weapons/test_gun.h" 29 29 #include "weapons/turret.h" 30 #include "weapons/cannon.h" 30 31 31 32 #include "list.h" … … 37 38 using namespace std; 38 39 39 CREATE_FACTORY(Player );40 CREATE_FACTORY(Player, CL_PLAYER); 40 41 41 42 /** … … 46 47 { 47 48 this->init(); 48 49 //weapons:50 Weapon* wpRight = new TestGun(this->weaponMan, 0);51 Weapon* wpLeft = new TestGun(this->weaponMan, 1);52 53 this->weaponMan->addWeapon(wpRight);54 // this->weaponMan->addWeapon(wpLeft, WM_CONFIG1, WM_SLOT1);55 // this->weaponMan->addWeapon(wpRight, WM_CONFIG2);56 // this->weaponMan->addWeapon(wpLeft, WM_CONFIG2);57 49 } 58 50 … … 88 80 89 81 //weapons: 90 Weapon* wpRight = new TestGun( this->weaponMan,0);82 Weapon* wpRight = new TestGun(0); 91 83 wpRight->setName("testGun Right"); 92 Weapon* wpLeft = new TestGun( this->weaponMan,1);84 Weapon* wpLeft = new TestGun(1); 93 85 wpLeft->setName("testGun Left"); 86 Weapon* cannon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(CL_CANNON)); 87 88 cannon->setName("BFG"); 94 89 95 90 this->weaponMan->addWeapon(wpLeft, 1, 0); 96 91 this->weaponMan->addWeapon(wpRight,1 ,1); 92 this->weaponMan->addWeapon(cannon, 0, 6); 93 97 94 //this->weaponMan->addWeapon(turret, 3, 0); 98 95 … … 134 131 135 132 this->weaponMan = new WeaponManager(this); 136 this->weaponMan->setSlotCount( 10);133 this->weaponMan->setSlotCount(7); 137 134 138 135 this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0)); … … 153 150 this->weaponMan->setSlotPosition(5, Vector(-1.5, -.5, -.5)); 154 151 this->weaponMan->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 155 156 this->weaponMan->setSlotPosition(6, Vector(-2.0, 0.1, -2.0)); 157 this->weaponMan->setSlotPosition(7, Vector(-2.0, 0.1, 2.0)); 158 159 this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0)); 160 this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0))); 161 162 this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0)); 163 this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0))); 152 // 153 this->weaponMan->setSlotPosition(6, Vector(-1, 0.0, 0)); 154 this->weaponMan->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 155 // 156 // this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0)); 157 // this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0))); 158 // 159 // this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0)); 160 // this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 161 164 162 } 165 163 … … 337 335 } 338 336 337 #include "weapons/aiming_turret.h" 339 338 // FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG 340 339 void Player::ADDWEAPON() 341 340 { 342 Weapon* turret1 = new Turret(this->weaponMan); 343 turret1->setName("Turret"); 344 turret1->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1); 345 346 this->weaponMan->addWeapon(turret1, 2); 347 348 this->weaponMan->changeWeaponConfig(2); 349 } 341 Weapon* turret = NULL; 342 343 if ((float)rand()/RAND_MAX < .1) 344 { 345 //if (this->weaponMan->hasFreeSlot(2, WTYPE_TURRET)) 346 { 347 turret = new Turret(); 348 this->weaponMan->addWeapon(turret, 2); 349 this->weaponMan->changeWeaponConfig(2); 350 } 351 } 352 else 353 { 354 //if (this->weaponMan->hasFreeSlot(3)) 355 { 356 turret = new AimingTurret(); 357 this->weaponMan->addWeapon(turret, 3); 358 359 this->weaponMan->changeWeaponConfig(3); 360 } 361 } 362 363 if(turret != NULL) 364 { 365 turret->setName("Turret"); 366 turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1); 367 } 368 }
Note: See TracChangeset
for help on using the changeset viewer.