Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2013, 4:06:38 PM (11 years ago)
Author:
thiweber
Message:

A few changes..

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

Legend:

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

    r9720 r9889  
    4141#include "PongBat.h"
    4242
    43 #include "sound/WorldSound.h" //Thilo
     43#include "sound/WorldSound.h"
    4444#include "core/XMLPort.h"
    4545
     
    7070        this->registerVariables();
    7171
    72         //Thilo
     72        //initialize sound
    7373        if (GameMode::isMaster())
    7474             {
    7575                 this->defScoreSound_ = new WorldSound(this->getContext());
    76                  this->defScoreSound_->setLooping(false);
     76                 this->defScoreSound_->setVolume(1.0f);
    7777                 this->defBatSound_ = new WorldSound(this->getContext());
    78                  this->defBatSound_->setLooping(false);
     78                 this->defBatSound_->setVolume(0.4f);
    7979                 this->defBoundarySound_ = new WorldSound(this->getContext());
    80                  this->defBoundarySound_->setLooping(false);
     80                 this->defBoundarySound_->setVolume(0.5f);
    8181             }
    8282             else
    8383             {
    8484                 this->defScoreSound_ = 0;
     85                 this->defBatSound_ = 0;
     86                 this->defBoundarySound_ = 0;
    8587             }
    8688    }
     
    101103    }
    102104
    103     //Thilo
     105    //xml port for loading sounds
    104106    void PongBall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    105107    {
     
    144146        if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
    145147        {
    146             // Its velocity in z-direction is inverted (i.e. it bounces off).
     148            defBoundarySound_->play(); //play boundary sound
     149                // Its velocity in z-direction is inverted (i.e. it bounces off).
    147150            velocity.z = -velocity.z;
    148151            // And its position is set as to not overstep the boundary it has just crossed.
     
    169172                    if (fabs(distance) <= 1) // If the bat is there to parry.
    170173                    {
    171                         // Set the ball to be exactly at the boundary.
     174                        defBatSound_->play(); //play bat sound
     175                        // Set the ball to be exactly at the boundary.
    172176                        position.x = this->fieldWidth_ / 2;
    173177                        // Invert its velocity in x-direction (i.e. it bounces off).
     
    182186                    else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
    183187                    {
    184                         defScoreSound_->play();//Thilo
     188                        defScoreSound_->play();//play score sound
    185189                        if (this->getGametype() && this->bat_[0])
    186190                        {
     
    197201                    if (fabs(distance) <= 1) // If the bat is there to parry.
    198202                    {
    199                         // Set the ball to be exactly at the boundary.
     203                        defBatSound_->play(); //play bat sound
     204                        // Set the ball to be exactly at the boundary.
    200205                        position.x = -this->fieldWidth_ / 2;
    201206                        // Invert its velocity in x-direction (i.e. it bounces off).
     
    210215                    else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
    211216                    {
    212                         defScoreSound_->play();//Thilo
     217                        defScoreSound_->play();//play score sound
    213218                        if (this->getGametype() && this->bat_[1])
    214219                        {
  • code/branches/sfxThilo/src/modules/pong/PongBall.h

    r9720 r9889  
    126126            static const float MAX_REL_Z_VELOCITY;
    127127
    128             void setDefScoreSound(const std::string& engineSound); //Thilo
    129             const std::string& getDefScoreSound(); //Thilo
     128            void setDefScoreSound(const std::string& engineSound);
     129            const std::string& getDefScoreSound();
     130            void setDefBatSound(const std::string& engineSound);
     131            const std::string& getDefBatSound();
     132            void setDefBoundarySound(const std::string& engineSound);
     133            const std::string& getDefBoundarySound();
    130134
    131135        private:
     
    141145            unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network.
    142146            float relMercyOffset_; //!< Offset, that makes the player not loose, when, in all fairness, he would have.
    143             WorldSound* defScoreSound_;//Thilo
     147            WorldSound* defScoreSound_;
     148            WorldSound* defBatSound_;
     149            WorldSound* defBoundarySound_;
    144150    };
    145151}
Note: See TracChangeset for help on using the changeset viewer.