Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 6, 2009, 9:18:40 AM (15 years ago)
Author:
rgrieder
Message:

Removed hard coded sound in Level, Engine and PongBall and replaced SoundMainMenu with a simple SoundBase.

Location:
code/branches/core5/src/modules/pong
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/modules/pong/PongBall.cc

    r5889 r5892  
    3333#include "gametypes/Gametype.h"
    3434#include "PongBat.h"
    35 #include "sound/SoundBase.h"
    3635
    3736namespace orxonox
     
    4342    PongBall::PongBall(BaseObject* creator)
    4443        : MovableEntity(creator)
    45         , sidesound_(NULL)
    46         , batsound_(NULL)
    47         , scoresound_(NULL)
    4844    {
    4945        RegisterObject(PongBall);
     
    5753
    5854        this->registerVariables();
    59 
    60         if (GameMode::playsSound())
    61         {
    62             this->sidesound_ = new SoundBase(this);
    63             this->sidesound_->loadFile("sounds/pong_side.wav");
    64 
    65             this->batsound_ = new SoundBase(this);
    66             this->batsound_->loadFile("sounds/pong_bat.wav");
    67 
    68             this->scoresound_ = new SoundBase(this);
    69             this->scoresound_->loadFile("sounds/pong_score.wav");
    70         }
    7155    }
    7256
    7357    PongBall::~PongBall()
    7458    {
    75         if (this->sidesound_)
    76             delete this->sidesound_;
    77         if (this->batsound_)
    78             delete this->batsound_;
    79         if (this->scoresound_)
    80             delete this->scoresound_;
    8159    }
    8260
     
    10886
    10987            this->fireEvent();
    110             if (GameMode::playsSound())
    111                 this->sidesound_->play();
    11288        }
    11389
     
    128104                       
    129105                        this->fireEvent();
    130                         if (GameMode::playsSound())
    131                             this->batsound_->play();
    132106                    }
    133107                    else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
     
    136110                        {
    137111                            this->getGametype()->playerScored(this->bat_[0]->getPlayer());
    138                             if (GameMode::playsSound())
    139                                 this->scoresound_->play();
    140112                            return;
    141113                        }
     
    152124
    153125                        this->fireEvent();
    154                         if (GameMode::playsSound())
    155                             this->batsound_->play();
    156126                    }
    157127                    else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
     
    159129                        if (this->getGametype() && this->bat_[1])
    160130                        {
    161                             if (GameMode::playsSound())
    162                                 this->scoresound_->play();
    163131                            this->getGametype()->playerScored(this->bat_[1]->getPlayer());
    164132                            return;
  • code/branches/core5/src/modules/pong/PongBall.h

    r5881 r5892  
    7676            unsigned int* batID_;
    7777            float relMercyOffset_;
    78 
    79             SoundBase* sidesound_;
    80             SoundBase* batsound_;
    81             SoundBase* scoresound_;
    8278    };
    8379}
Note: See TracChangeset for help on using the changeset viewer.