Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3878 in orxonox.OLD for orxonox/trunk/src/world_entities/player.cc


Ignore:
Timestamp:
Apr 18, 2005, 6:12:16 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: the weaponconfiguration can now be changed by pressing the 'm' key.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/player.cc

    r3877 r3878  
    3838Player::Player() : WorldEntity()
    3939{
    40   this->weapons = new tList<Weapon>();
    41   this->activeWeapon = NULL;
    4240  /*
    4341    this is the debug player - actualy we would have to make a new
     
    5149  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
    5250  bFire = false;
     51  this->bWeaponChange = false;
    5352  acceleration = 10.0;
    5453  //weapons:
     
    5756  Weapon* wpLeft = new TestGun(this, new Vector(-2.6, 0.1, -3.0), new Quaternion(), 1);
    5857 
    59   this->weaponMan->addWeapon(wpRight);
    60   this->weaponMan->addWeapon(wpLeft);
     58  this->weaponMan->addWeapon(wpRight, W_CONFIG0);
     59  this->weaponMan->addWeapon(wpLeft, W_CONFIG1);
    6160
    6261  //this->weapons->add(wpRight);
     
    7473     this only frees the memory allocated to save the list.
    7574  */
    76   delete this->weapons;
    7775  delete this->weaponMan;
    7876}
     
    8583void Player::addWeapon(Weapon* weapon)
    8684{
    87   this->weapons->add(weapon);
     85  this->weaponMan->addWeapon(weapon);
    8886}
    8987
     
    9593void Player::removeWeapon(Weapon* weapon)
    9694{
    97   this->weapons->remove(weapon);
     95  this->weaponMan->removeWeapon(weapon);
    9896}
    9997
     
    157155  glPopMatrix();
    158156
    159   //this->activeWeapon->draw();
    160   //this->activeWeaponL->draw();
    161157  this->weaponMan->draw();
    162158}
     
    221217  if( this->bWeaponChange)
    222218    {
    223       //this->activeWeapon->deactivate();
    224       //this->weapons->enumerate();  FIX: strang weapon change...
    225       //this->activeWeapon = this->weapons->nextElement(this->activeWeapon);
    226       //this->activeWeapon->activate();
    227219      this->weaponMan->nextWeaponConf();
     220      this->bWeaponChange = false;
    228221    }
    229222}
     
    244237  if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
    245238  if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;
    246   if( !strcmp( cmd->cmd, "mode")) this->bWeaponChange = !cmd->bUp;
    247 }
     239  if( !strcmp( cmd->cmd, "mode")) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
     240}
Note: See TracChangeset for help on using the changeset viewer.