Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7207 in orxonox.OLD for branches/std/src/world_entities


Ignore:
Timestamp:
Mar 9, 2006, 11:35:50 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: evil was within

Location:
branches/std/src/world_entities
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/world_entities/power_ups/power_up.cc

    r7193 r7207  
    3333  this->respawnStart = 10;
    3434  this->model = NULL;
    35 /*  if(!PowerUp::sphereModel) {*/
     35  /*  if(!PowerUp::sphereModel) {*/
    3636
    3737  Model* sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5);
     
    7575
    7676
    77 void PowerUp::loadPickupSound(const char* pickupSound)
     77void PowerUp::loadPickupSound(const std::string& pickupSound)
    7878{
    7979  if (this->pickupBuffer != NULL)
    8080    ResourceManager::getInstance()->unload(this->pickupBuffer);
    8181
    82   else if (pickupSound != NULL)
    83 {
    84   this->pickupBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV);
    85   if (this->pickupBuffer != NULL)
    86   {
    87     PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound, this->getName());
    88   }
    89   else
    90   {
    91     PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound, this->getName());
    92   }
    93 }
     82  else if (!pickupSound.empty())
     83  {
     84    this->pickupBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV);
     85    if (this->pickupBuffer != NULL)
     86    {
     87      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound.c_str(), this->getName());
     88    }
     89    else
     90    {
     91      PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound.c_str(), this->getName());
     92    }
     93  }
    9494  else
    9595    this->pickupBuffer = NULL;
    9696}
    9797
    98 void PowerUp::loadRespawnSound(const char* respawnSound)
     98void PowerUp::loadRespawnSound(const std::string& respawnSound)
    9999{
    100100  if (this->respawnBuffer != NULL)
    101101    ResourceManager::getInstance()->unload(this->respawnBuffer);
    102102
    103   else if (respawnSound != NULL)
     103  else if (!respawnSound.empty())
    104104  {
    105105    this->respawnBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(respawnSound, WAV);
    106106    if (this->respawnBuffer != NULL)
    107107    {
    108       PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound, this->getName());
     108      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound.c_str(), this->getName());
    109109    }
    110110    else
    111111    {
    112       PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound, this->getName());
     112      PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound.c_str(), this->getName());
    113113    }
    114114  }
     
    128128        this->soundSource.play(this->pickupBuffer);
    129129
    130       switch(respawnType) {
    131         case RESPAWN_NONE:
    132           this->toList(OM_DEAD);
    133           break;
    134         case RESPAWN_TIME:
    135           this->toList(OM_DEAD_TICK);
    136           this->respawnTime = this->respawnStart;
    137           break;
     130      switch(respawnType)
     131      {
     132      case RESPAWN_NONE:
     133        this->toList(OM_DEAD);
     134        break;
     135      case RESPAWN_TIME:
     136        this->toList(OM_DEAD_TICK);
     137        this->respawnTime = this->respawnStart;
     138        break;
    138139      }
    139140    }
     
    141142}
    142143
    143 void PowerUp::tick(float dt) {
    144   if(this->getOMListNumber() != OM_COMMON) {
     144void PowerUp::tick(float dt)
     145{
     146  if(this->getOMListNumber() != OM_COMMON)
     147  {
    145148    this->respawnTime -= dt;
    146149    if(this->respawnTime <= 0)
     
    157160void PowerUp::draw() const
    158161{
    159   if(this->model != NULL) {
     162  if(this->model != NULL)
     163  {
    160164    glMatrixMode(GL_MODELVIEW);
    161165    glPushMatrix();
     
    172176}
    173177
    174 const char* PowerUp::respawnTypes[] = {
    175   "none",
    176   "time"
    177 };
     178const char* PowerUp::respawnTypes[] =
     179  {
     180    "none",
     181    "time"
     182  };
    178183
    179184void PowerUp::setRespawnType(const char* type)
    180185{
    181   for(int i = 0; i < RESPAWN_size; ++i) {
    182     if(!strcmp(type, respawnTypes[i])) {
     186  for(int i = 0; i < RESPAWN_size; ++i)
     187  {
     188    if(!strcmp(type, respawnTypes[i]))
     189    {
    183190      this->respawnType = (PowerUpRespawn)i;
    184191      break;
  • branches/std/src/world_entities/power_ups/power_up.h

    r7102 r7207  
    2626  void collidesWith (WorldEntity* entity, const Vector& location);
    2727
    28   void loadPickupSound(const char* pickupSound);
    29   void loadRespawnSound(const char* pickupSound);
     28  void loadPickupSound(const std::string& pickupSound);
     29  void loadRespawnSound(const std::string& respawnSound);
    3030
    3131  virtual void draw () const;
  • branches/std/src/world_entities/projectiles/projectile.cc

    r7193 r7207  
    6161
    6262
    63 void Projectile::loadExplosionSound(const char* explosionSound)
     63void Projectile::loadExplosionSound(const std::string& explosionSound)
    6464{
    6565  if (this->explosionBuffer != NULL)
    6666    ResourceManager::getInstance()->unload(this->explosionBuffer);
    6767
    68   else if (explosionSound != NULL)
     68  else if (!explosionSound.empty())
    6969  {
    7070    this->explosionBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV);
    7171    if (this->explosionBuffer != NULL)
    7272    {
    73       PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound, this->getName());
     73      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound.c_str(), this->getName());
    7474    }
    7575    else
    7676    {
    77       PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound, this->getName());
     77      PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound.c_str(), this->getName());
    7878    }
    7979  }
     
    8383
    8484
    85 void Projectile::loadEngineSound(const char* engineSound)
     85void Projectile::loadEngineSound(const std::string& engineSound)
    8686{
    8787  if (this->engineBuffer != NULL)
    8888    ResourceManager::getInstance()->unload(this->engineBuffer);
    8989
    90   else if (engineSound != NULL)
     90  else if (!engineSound.empty())
    9191  {
    9292    this->engineBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV);
    9393    if (this->engineBuffer != NULL)
    9494    {
    95       PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound, this->getName());
     95      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound.c_str(), this->getName());
    9696    }
    9797    else
    9898    {
    99       PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound, this->getName());
     99      PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound.c_str(), this->getName());
    100100    }
    101101  }
  • branches/std/src/world_entities/projectiles/projectile.h

    r7193 r7207  
    2626    void setLifeSpan(float lifeSpan);
    2727
    28     void loadExplosionSound(const char* explosionSound);
    29     void loadEngineSound(const char* engineSound);
     28    void loadExplosionSound(const std::string& explosionSound);
     29    void loadEngineSound(const std::string& engineSound);
    3030    void setMinEnergy(float energyMin);
    3131    /** @returns the minimal charched energy */
  • branches/std/src/world_entities/space_ships/helicopter.cc

    r7193 r7207  
    110110  this->loadModel("models/ships/helicopter_#.obj", 1.0);
    111111
    112   EventHandler::getInstance()->grabEvents(true);
     112  //EventHandler::getInstance()->grabEvents(true);
    113113
    114114  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
  • branches/std/src/world_entities/terrain.cc

    r7203 r7207  
    175175
    176176
    177 void Terrain::loadVegetation(const char* vegetationFile)
    178 {
    179   PRINTF(0)("loadVegetation: %s\n", vegetationFile);
     177void Terrain::loadVegetation(const std::string& vegetationFile)
     178{
     179  PRINTF(0)("loadVegetation: %s\n", vegetationFile.c_str());
    180180  if (this->vegetation)
    181181    ResourceManager::getInstance()->unload(this->vegetation, RP_LEVEL);
    182   if (vegetationFile != NULL)
     182  if (!vegetationFile.empty())
    183183  {
    184     PRINTF(4)("fetching %s\n", vegetationFile);
     184    PRINTF(4)("fetching %s\n", vegetationFile.c_str());
    185185    this->vegetation = dynamic_cast<Model*>(ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN));
    186186  }
  • branches/std/src/world_entities/terrain.h

    r7046 r7207  
    4141  virtual void loadParams(const TiXmlElement* root);
    4242
    43   void loadVegetation(const char* vegetationFile);
     43  void loadVegetation(const std::string& vegetationFile);
    4444
    4545  void loadHeightMap(const char* heightMapFile, const char* colorMap = NULL);
  • branches/std/src/world_entities/weapons/weapon.cc

    r7193 r7207  
    232232 * @param soundFile the soundFile's relative position to the data-directory (will be looked for by the ResourceManager)
    233233 */
    234 void Weapon::setActionSound(WeaponAction action, const char* soundFile)
     234void Weapon::setActionSound(WeaponAction action, const std::string& soundFile)
    235235{
    236236  if (action >= WA_ACTION_COUNT)
     
    239239    ResourceManager::getInstance()->unload(this->soundBuffers[action]);
    240240
    241   else if (soundFile != NULL)
     241  else if (!soundFile.empty())
    242242  {
    243243    this->soundBuffers[action] = (SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
    244244    if (this->soundBuffers[action] != NULL)
    245245    {
    246       PRINTF(4)("Loaded sound %s to action %s.\n", soundFile, actionToChar(action));
     246      PRINTF(4)("Loaded sound %s to action %s.\n", soundFile.c_str(), actionToChar(action));
    247247    }
    248248    else
    249249    {
    250       PRINTF(2)("Failed to load sound %s to %s.\n.", soundFile, actionToChar(action));
     250      PRINTF(2)("Failed to load sound %s to %s.\n.", soundFile.c_str(), actionToChar(action));
    251251    }
    252252  }
  • branches/std/src/world_entities/weapons/weapon.h

    r7102 r7207  
    148148    inline void setAmmoContainer(const CountPointer<AmmoContainer>& ammoContainer) { this->ammoContainer = ammoContainer;}
    149149
    150     void setActionSound(WeaponAction action, const char* soundFile);
     150    void setActionSound(WeaponAction action, const std::string& soundFile);
    151151    /** @see void setActionSound(WeaponAction action, const char* soundFile); */
    152152    void setActionSound(const char* action, const char* soundFile) { this->setActionSound(charToAction(action), soundFile); };
Note: See TracChangeset for help on using the changeset viewer.