- Timestamp:
- Jan 8, 2006, 5:44:04 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/hud.cc
r6442 r6443 118 118 } 119 119 120 void Hud::updateWeaponManager() 121 { 122 // hide all the Widgets 123 std::list<GLGuiWidget*>::iterator weaponWidget; 124 for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++) 125 { 126 (*weaponWidget)->hide(); 127 } 128 this->weaponsWidgets.clear(); 129 130 // add all that we need again. 131 if (this->weaponManager != NULL) 132 for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) 133 { 134 Weapon* weapon = this->weaponManager->getWeapon(i); 135 if (weapon != NULL) 136 { 137 weapon->getEnergyWidget()->show(); 138 this->weaponsWidgets.push_back(weapon->getEnergyWidget()); 139 } 140 } 141 this->updateResolution(); 142 } 120 143 121 144 void Hud::addWeaponWidget(GLGuiWidget* widget) -
trunk/src/util/hud.h
r6442 r6443 34 34 void removeWeaponWidget(GLGuiWidget* widget); 35 35 36 void updateWeaponManager(); 37 36 38 void tick(float dt); 37 39 void draw() const; -
trunk/src/world_entities/playable.cc
r6442 r6443 44 44 45 45 } 46 } 47 48 49 void Playable::addWeapon(Weapon* weapon, int configID, int slotID) 50 { 51 this->weaponMan->addWeapon(weapon, configID, slotID); 52 53 if (this->currentPlayer != NULL) 54 this->currentPlayer->weaponConfigChanged(); 55 } 56 57 void Playable::removeWeapon(Weapon* weapon) 58 { 59 this->weaponMan->removeWeapon(weapon); 60 61 if (this->currentPlayer != NULL) 62 this->currentPlayer->weaponConfigChanged(); 46 63 } 47 64 -
trunk/src/world_entities/playable.h
r6442 r6443 29 29 virtual void leave()=0; 30 30 31 virtual void addWeapon(Weapon* weapon ) {}//= 0; 32 virtual void removeWeapon(Weapon* weapon) {}//= 0; 31 void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); 32 void removeWeapon(Weapon* weapon); 33 33 34 inline WeaponManager* getWeaponManager() const { return this->weaponMan; }; 34 35 -
trunk/src/world_entities/player.cc
r6442 r6443 81 81 } 82 82 83 void Player::weaponConfigChanged() 84 { 85 this->hud.updateWeaponManager(); 86 } 87 83 88 void Player::process(const Event &event) 84 89 { -
trunk/src/world_entities/player.h
r6441 r6443 31 31 inline Playable* getControllable() { return this->controllable; }; 32 32 33 void weaponConfigChanged(); 33 34 bool disconnectControllable(); 34 35 -
trunk/src/world_entities/space_ships/helicopter.cc
r6426 r6443 89 89 cannon->setName("BFG"); 90 90 91 this-> getWeaponManager()->addWeapon(wpLeft, 1, 0);92 this-> getWeaponManager()->addWeapon(wpRight,1 ,1);93 this-> getWeaponManager()->addWeapon(cannon, 0, 6);94 95 //this-> getWeaponManager()->addWeapon(turret, 3, 0);91 this->addWeapon(wpLeft, 1, 0); 92 this->addWeapon(wpRight,1 ,1); 93 this->addWeapon(cannon, 0, 6); 94 95 //this->addWeapon(turret, 3, 0); 96 96 97 97 this->getWeaponManager()->changeWeaponConfig(1); … … 176 176 // this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0)); 177 177 // this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 178 178 179 179 this->getWeaponManager()->getFixedTarget()->setParent(this); 180 180 this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0); … … 211 211 } 212 212 213 214 /**215 * adds a weapon to the weapon list of the spaceship216 * @param weapon to add217 */218 void Helicopter::addWeapon(Weapon* weapon)219 {220 this->getWeaponManager()->addWeapon(weapon);221 }222 223 224 /**225 * removes a weapon from the spaceship226 * @param weapon to remove227 */228 void Helicopter::removeWeapon(Weapon* weapon)229 {230 this->getWeaponManager()->removeWeapon(weapon);231 }232 213 233 214 /** … … 267 248 */ 268 249 void Helicopter::tick (float time) 269 { 250 { 270 251 tailrotorspeed += xMouse/20; 271 252 if (tailrotorspeed >= 0.07) tailrotorspeed = 0.07; 272 253 else if (tailrotorspeed <= -0.07) tailrotorspeed = -0.07; 273 254 274 255 if (tailrotorspeed > 0.0008) tailrotorspeed -= 0.001; 275 256 else if (tailrotorspeed < -0.0008) tailrotorspeed += 0.001; 276 257 if (tailrotorspeed <= 0.001 && tailrotorspeed >= -0.001) tailrotorspeed = 0; 277 258 278 259 // spaceship controlled movement 279 260 this->calculateVelocity(time); … … 286 267 //physics: Gravity 287 268 this->shiftCoor(Vector(0,-1,0)); 288 269 289 270 this->shiftCoor(getAbsDirY()*rotorspeed); 290 271 … … 400 381 if(rotorspeed >= 1.05) rotorspeed -= 0.05; 401 382 } 402 383 403 384 if (this->bDescend ) 404 385 { … … 470 451 this->xMouse = event.xRel*mouseSensitivity; 471 452 this->yMouse = event.yRel*mouseSensitivity; 472 453 473 454 //this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))); 474 455 } … … 486 467 { 487 468 turret = new Turret(); 488 this-> getWeaponManager()->addWeapon(turret, 2);469 this->addWeapon(turret, 2); 489 470 this->getWeaponManager()->changeWeaponConfig(2); 490 471 } … … 495 476 { 496 477 turret = new AimingTurret(); 497 this-> getWeaponManager()->addWeapon(turret, 3);478 this->addWeapon(turret, 3); 498 479 499 480 this->getWeaponManager()->changeWeaponConfig(3); -
trunk/src/world_entities/space_ships/helicopter.h
r6426 r6443 26 26 virtual void enter(); 27 27 virtual void leave(); 28 29 void addWeapon(Weapon* weapon );30 void removeWeapon(Weapon* weapon);31 28 32 29 virtual void postSpawn(); -
trunk/src/world_entities/space_ships/space_ship.cc
r6440 r6443 103 103 cannon->setName("BFG"); 104 104 105 this-> getWeaponManager()->addWeapon(wpLeft, 1, 0);106 this-> getWeaponManager()->addWeapon(wpRight,1 ,1);107 this-> getWeaponManager()->addWeapon(cannon, 0, 6);108 109 //this-> getWeaponManager()->addWeapon(turret, 3, 0);105 this->addWeapon(wpLeft, 1, 0); 106 this->addWeapon(wpRight,1 ,1); 107 this->addWeapon(cannon, 0, 6); 108 109 //this->addWeapon(turret, 3, 0); 110 110 111 111 this->getWeaponManager()->changeWeaponConfig(1); … … 221 221 } 222 222 223 /**224 * adds a weapon to the weapon list of the spaceship225 * @param weapon to add226 */227 void SpaceShip::addWeapon(Weapon* weapon)228 {229 this->getWeaponManager()->addWeapon(weapon);230 }231 232 233 /**234 * removes a weapon from the spaceship235 * @param weapon to remove236 */237 void SpaceShip::removeWeapon(Weapon* weapon)238 {239 this->getWeaponManager()->removeWeapon(weapon);240 }241 223 242 224 /** … … 451 433 this->bFire = event.bPressed; 452 434 else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed) 435 { 453 436 this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange; 437 } 454 438 else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed) 455 439 this->getWeaponManager()->previousWeaponConfig(); … … 503 487 { 504 488 turret = new Turret(); 505 this-> getWeaponManager()->addWeapon(turret, 2);489 this->addWeapon(turret, 2); 506 490 this->getWeaponManager()->changeWeaponConfig(2); 507 491 } … … 513 497 turret = dynamic_cast<Weapon*>(Factory::fabricate(CL_TARGETING_TURRET)); 514 498 if (turret != NULL) 515 this-> getWeaponManager()->addWeapon(turret, 3);499 this->addWeapon(turret, 3); 516 500 517 501 this->getWeaponManager()->changeWeaponConfig(3); -
trunk/src/world_entities/space_ships/space_ship.h
r6426 r6443 30 30 virtual void enter(); 31 31 virtual void leave(); 32 33 void addWeapon(Weapon* weapon );34 void removeWeapon(Weapon* weapon);35 32 36 33 virtual void postSpawn();
Note: See TracChangeset
for help on using the changeset viewer.