Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 18, 2005, 3:26:03 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: saver implementation of state-variables.
this step makes the execute function very big, and as such is not the best idea, maybe i will split up the checks in the execute-functions so one has a better insight into what is happening in weapon.
For this maybe a wrapper around fire/reload… functions will be written, that calls them within a fireWeapon/reloadWeapon function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc

    r4883 r4884  
    9191  if (action >= WA_ACTION_COUNT)
    9292    return;
    93   else
     93  else if (soundFile != NULL)
    9494  {
    9595    this->soundBuffers[action] = (SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
     
    102102      PRINTF(4)("failed to load sound %s to %s\n", soundFile, actionToChar(action));
    103103    }
    104 
    105   }
     104  }
     105  else
     106    this->soundBuffers[action] = NULL;
    106107}
    107108
     
    136137      //if (likely(this->currentState != WS_INACTIVE))
    137138      {
    138         if (this->minCharge < this->energyLoaded)
     139        if (this->minCharge <= this->energyLoaded)
    139140        {
     141          if (this->soundBuffers[WA_SHOOT] != NULL)
     142            this->soundSource->play(this->soundBuffers[WA_SHOOT]);
    140143          this->fire();
    141144          this->requestedAction = WA_NONE;
     
    151154      if ( this->currentState != WS_INACTIVE && this->energyLoaded >= this->minCharge)
    152155      {
     156        if (this->soundBuffers[WA_CHARGE] != NULL)
     157         this->soundSource->play(this->soundBuffers[WA_CHARGE]);
    153158        this->charge();
    154159        this->requestedAction = WA_NONE;
     
    163168      //if (this->currentState != WS_INACTIVE && this->energy + this->energyLoaded >= this->minCharge)
    164169      {
     170        if (this->soundBuffers[WA_RELOAD] != NULL)
     171          this->soundSource->play(this->soundBuffers[WA_RELOAD]);
     172
    165173        this->reload();
    166174        this->requestedAction = WA_NONE;
     
    170178      if (this->currentState != WS_INACTIVE)
    171179      {
     180        if (this->soundBuffers[WA_DEACTIVATE] != NULL)
     181          this->soundSource->play(this->soundBuffers[WA_DEACTIVATE]);
     182
    172183        this->deactivate();
    173184        this->requestedAction = WA_NONE;
     
    177188      if (this->currentState == WS_INACTIVE)
    178189      {
     190        if (this->soundBuffers[WA_ACTIVATE] != NULL)
     191          this->soundSource->play(this->soundBuffers[WA_ACTIVATE]);
     192
    179193        this->activate();
    180194        this->requestedAction = WA_NONE;
Note: See TracChangeset for help on using the changeset viewer.