Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4952 in orxonox.OLD


Ignore:
Timestamp:
Jul 24, 2005, 11:36:12 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: changing back and forth works

Location:
orxonox/trunk/src/world_entities
Files:
3 edited

Legend:

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

    r4951 r4952  
    282282  else if( event.type == KeyMapper::PEV_FIRE1)
    283283      this->bFire = event.bPressed;
    284   else if( event.type == KeyMapper::PEV_NEXT_WEAPON)
    285       if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    286 
    287 }
     284  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
     285    this->weaponMan->nextWeaponConf();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
     286  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
     287    this->weaponMan->previousWeaponConfig();
     288}
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.cc

    r4951 r4952  
    195195void WeaponManager::nextWeaponConf()
    196196{
    197   PRINTF(4)("Changing weapon configuration: from %i to next\n", this->currentConfigID);
    198 
    199197  ++this->currentConfigID;
    200198  if (this->currentConfigID >= WM_MAX_CONFIGS)
    201199    this->currentConfigID = 0;
    202 
     200  this->changeWeaponConfig(this->currentConfigID);
     201  this->debug();
     202}
     203
     204void WeaponManager::previousWeaponConfig()
     205{
     206  --this->currentConfigID;
     207  if (this->currentConfigID < 0)
     208    this->currentConfigID = WM_MAX_CONFIGS -1;
     209  this->changeWeaponConfig(this->currentConfigID);
     210  this->debug();
     211
     212
     213}
     214
     215void WeaponManager::changeWeaponConfig(int weaponConfig)
     216{
     217  this->currentConfigID = weaponConfig;
     218  PRINTF(4)("Changing weapon configuration: to %i\n", this->currentConfigID);
    203219  for (int i = 0; i < WM_MAX_SLOTS; i++)
    204220  {
    205221    this->currentSlotConfig[i].nextWeapon = this->configs[currentConfigID][i];
    206     if (this->currentSlotConfig[i].currentWeapon != this->currentSlotConfig[i].nextWeapon && this->currentSlotConfig[i].currentWeapon != NULL)
     222    if (this->currentSlotConfig[i].currentWeapon != NULL && this->currentSlotConfig[i].currentWeapon != this->currentSlotConfig[i].nextWeapon)
    207223      (this->currentSlotConfig[i].currentWeapon->requestAction(WA_DEACTIVATE));
    208224  }
    209 
    210   this->debug();
    211225}
    212226
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.h

    r4951 r4952  
    8686
    8787    void nextWeaponConf();
     88    void previousWeaponConfig();
     89    void changeWeaponConfig(int weaponConfig);
    8890
    8991    void fire();
Note: See TracChangeset for help on using the changeset viewer.