Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6443 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 8, 2006, 5:44:04 PM (19 years ago)
Author:
bensch
Message:

huge pipeline

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/hud.cc

    r6442 r6443  
    118118}
    119119
     120void 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}
    120143
    121144void Hud::addWeaponWidget(GLGuiWidget* widget)
  • trunk/src/util/hud.h

    r6442 r6443  
    3434  void removeWeaponWidget(GLGuiWidget* widget);
    3535
     36  void updateWeaponManager();
     37
    3638  void tick(float dt);
    3739  void draw() const;
  • trunk/src/world_entities/playable.cc

    r6442 r6443  
    4444
    4545  }
     46}
     47
     48
     49void 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
     57void Playable::removeWeapon(Weapon* weapon)
     58{
     59  this->weaponMan->removeWeapon(weapon);
     60
     61  if (this->currentPlayer != NULL)
     62    this->currentPlayer->weaponConfigChanged();
    4663}
    4764
  • trunk/src/world_entities/playable.h

    r6442 r6443  
    2929    virtual void leave()=0;
    3030
    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
    3334    inline WeaponManager* getWeaponManager() const { return this->weaponMan; };
    3435
  • trunk/src/world_entities/player.cc

    r6442 r6443  
    8181 }
    8282
     83 void Player::weaponConfigChanged()
     84 {
     85   this->hud.updateWeaponManager();
     86 }
     87
    8388 void Player::process(const Event &event)
    8489 {
  • trunk/src/world_entities/player.h

    r6441 r6443  
    3131    inline Playable*  getControllable() { return this->controllable; };
    3232
     33    void              weaponConfigChanged();
    3334    bool              disconnectControllable();
    3435
  • trunk/src/world_entities/space_ships/helicopter.cc

    r6426 r6443  
    8989  cannon->setName("BFG");
    9090
    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);
    9696
    9797  this->getWeaponManager()->changeWeaponConfig(1);
     
    176176//   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
    177177//   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
    178      
     178
    179179  this->getWeaponManager()->getFixedTarget()->setParent(this);
    180180  this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
     
    211211}
    212212
    213 
    214 /**
    215  * adds a weapon to the weapon list of the spaceship
    216  * @param weapon to add
    217 */
    218 void Helicopter::addWeapon(Weapon* weapon)
    219 {
    220   this->getWeaponManager()->addWeapon(weapon);
    221 }
    222 
    223 
    224 /**
    225  *  removes a weapon from the spaceship
    226  * @param weapon to remove
    227 */
    228 void Helicopter::removeWeapon(Weapon* weapon)
    229 {
    230   this->getWeaponManager()->removeWeapon(weapon);
    231 }
    232213
    233214/**
     
    267248*/
    268249void Helicopter::tick (float time)
    269 { 
     250{
    270251  tailrotorspeed += xMouse/20;
    271252  if (tailrotorspeed >= 0.07) tailrotorspeed = 0.07;
    272253  else if (tailrotorspeed <= -0.07) tailrotorspeed = -0.07;
    273  
     254
    274255  if (tailrotorspeed > 0.0008) tailrotorspeed -= 0.001;
    275256  else if (tailrotorspeed < -0.0008) tailrotorspeed += 0.001;
    276257  if (tailrotorspeed <= 0.001 && tailrotorspeed >= -0.001) tailrotorspeed = 0;
    277  
     258
    278259  // spaceship controlled movement
    279260  this->calculateVelocity(time);
     
    286267  //physics: Gravity
    287268  this->shiftCoor(Vector(0,-1,0));
    288  
     269
    289270  this->shiftCoor(getAbsDirY()*rotorspeed);
    290271
     
    400381    if(rotorspeed >= 1.05) rotorspeed -= 0.05;
    401382  }
    402  
     383
    403384  if (this->bDescend )
    404385  {
     
    470451    this->xMouse = event.xRel*mouseSensitivity;
    471452    this->yMouse = event.yRel*mouseSensitivity;
    472    
     453
    473454    //this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
    474455  }
     
    486467    {
    487468      turret = new Turret();
    488       this->getWeaponManager()->addWeapon(turret, 2);
     469      this->addWeapon(turret, 2);
    489470      this->getWeaponManager()->changeWeaponConfig(2);
    490471    }
     
    495476    {
    496477      turret = new AimingTurret();
    497       this->getWeaponManager()->addWeapon(turret, 3);
     478      this->addWeapon(turret, 3);
    498479
    499480      this->getWeaponManager()->changeWeaponConfig(3);
  • trunk/src/world_entities/space_ships/helicopter.h

    r6426 r6443  
    2626    virtual void enter();
    2727    virtual void leave();
    28 
    29     void addWeapon(Weapon* weapon );
    30     void removeWeapon(Weapon* weapon);
    3128
    3229    virtual void postSpawn();
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6440 r6443  
    103103  cannon->setName("BFG");
    104104
    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);
    110110
    111111  this->getWeaponManager()->changeWeaponConfig(1);
     
    221221}
    222222
    223 /**
    224  * adds a weapon to the weapon list of the spaceship
    225  * @param weapon to add
    226 */
    227 void SpaceShip::addWeapon(Weapon* weapon)
    228 {
    229   this->getWeaponManager()->addWeapon(weapon);
    230 }
    231 
    232 
    233 /**
    234  *  removes a weapon from the spaceship
    235  * @param weapon to remove
    236 */
    237 void SpaceShip::removeWeapon(Weapon* weapon)
    238 {
    239   this->getWeaponManager()->removeWeapon(weapon);
    240 }
    241223
    242224/**
     
    451433      this->bFire = event.bPressed;
    452434  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
     435  {
    453436    this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
     437  }
    454438  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    455439    this->getWeaponManager()->previousWeaponConfig();
     
    503487    {
    504488      turret = new Turret();
    505       this->getWeaponManager()->addWeapon(turret, 2);
     489      this->addWeapon(turret, 2);
    506490      this->getWeaponManager()->changeWeaponConfig(2);
    507491    }
     
    513497      turret = dynamic_cast<Weapon*>(Factory::fabricate(CL_TARGETING_TURRET));
    514498      if (turret != NULL)
    515       this->getWeaponManager()->addWeapon(turret, 3);
     499      this->addWeapon(turret, 3);
    516500
    517501      this->getWeaponManager()->changeWeaponConfig(3);
  • trunk/src/world_entities/space_ships/space_ship.h

    r6426 r6443  
    3030    virtual void enter();
    3131    virtual void leave();
    32 
    33     void addWeapon(Weapon* weapon );
    34     void removeWeapon(Weapon* weapon);
    3532
    3633    virtual void postSpawn();
Note: See TracChangeset for help on using the changeset viewer.