[Orxonox-commit 1171] r5892 - in code/branches/core5/src: modules/pong orxonox orxonox/gamestates orxonox/items orxonox/sound

rgrieder at orxonox.net rgrieder at orxonox.net
Tue Oct 6 09:18:41 CEST 2009


Author: rgrieder
Date: 2009-10-06 09:18:40 +0200 (Tue, 06 Oct 2009)
New Revision: 5892

Removed:
   code/branches/core5/src/orxonox/sound/SoundMainMenu.cc
   code/branches/core5/src/orxonox/sound/SoundMainMenu.h
Modified:
   code/branches/core5/src/modules/pong/PongBall.cc
   code/branches/core5/src/modules/pong/PongBall.h
   code/branches/core5/src/orxonox/Level.cc
   code/branches/core5/src/orxonox/Level.h
   code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc
   code/branches/core5/src/orxonox/gamestates/GSMainMenu.h
   code/branches/core5/src/orxonox/items/Engine.cc
   code/branches/core5/src/orxonox/items/Engine.h
   code/branches/core5/src/orxonox/sound/CMakeLists.txt
Log:
Removed hard coded sound in Level, Engine and PongBall and replaced SoundMainMenu with a simple SoundBase.

Modified: code/branches/core5/src/modules/pong/PongBall.cc
===================================================================
--- code/branches/core5/src/modules/pong/PongBall.cc	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/modules/pong/PongBall.cc	2009-10-06 07:18:40 UTC (rev 5892)
@@ -32,7 +32,6 @@
 #include "core/GameMode.h"
 #include "gametypes/Gametype.h"
 #include "PongBat.h"
-#include "sound/SoundBase.h"
 
 namespace orxonox
 {
@@ -42,9 +41,6 @@
 
     PongBall::PongBall(BaseObject* creator)
         : MovableEntity(creator)
-        , sidesound_(NULL)
-        , batsound_(NULL)
-        , scoresound_(NULL)
     {
         RegisterObject(PongBall);
 
@@ -56,28 +52,10 @@
         this->relMercyOffset_ = 0.05f;
 
         this->registerVariables();
-
-        if (GameMode::playsSound())
-        {
-            this->sidesound_ = new SoundBase(this);
-            this->sidesound_->loadFile("sounds/pong_side.wav");
-
-            this->batsound_ = new SoundBase(this);
-            this->batsound_->loadFile("sounds/pong_bat.wav");
-
-            this->scoresound_ = new SoundBase(this);
-            this->scoresound_->loadFile("sounds/pong_score.wav");
-        }
     }
 
     PongBall::~PongBall()
     {
-        if (this->sidesound_)
-            delete this->sidesound_;
-        if (this->batsound_)
-            delete this->batsound_;
-        if (this->scoresound_)
-            delete this->scoresound_;
     }
 
     void PongBall::registerVariables()
@@ -107,8 +85,6 @@
                 position.z = -this->fieldHeight_ / 2;
 
             this->fireEvent();
-            if (GameMode::playsSound())
-                this->sidesound_->play();
         }
 
         if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
@@ -127,16 +103,12 @@
                         velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
                         
                         this->fireEvent();
-                        if (GameMode::playsSound())
-                            this->batsound_->play();
                     }
                     else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
                     {
                         if (this->getGametype() && this->bat_[0])
                         {
                             this->getGametype()->playerScored(this->bat_[0]->getPlayer());
-                            if (GameMode::playsSound())
-                                this->scoresound_->play();
                             return;
                         }
                     }
@@ -151,15 +123,11 @@
                         velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
 
                         this->fireEvent();
-                        if (GameMode::playsSound())
-                            this->batsound_->play();
                     }
                     else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
                     {
                         if (this->getGametype() && this->bat_[1])
                         {
-                            if (GameMode::playsSound())
-                                this->scoresound_->play();
                             this->getGametype()->playerScored(this->bat_[1]->getPlayer());
                             return;
                         }

Modified: code/branches/core5/src/modules/pong/PongBall.h
===================================================================
--- code/branches/core5/src/modules/pong/PongBall.h	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/modules/pong/PongBall.h	2009-10-06 07:18:40 UTC (rev 5892)
@@ -75,10 +75,6 @@
             PongBat** bat_;
             unsigned int* batID_;
             float relMercyOffset_;
-
-            SoundBase* sidesound_;
-            SoundBase* batsound_;
-            SoundBase* scoresound_;
     };
 }
 

Modified: code/branches/core5/src/orxonox/Level.cc
===================================================================
--- code/branches/core5/src/orxonox/Level.cc	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/Level.cc	2009-10-06 07:18:40 UTC (rev 5892)
@@ -38,7 +38,6 @@
 #include "infos/PlayerInfo.h"
 #include "gametypes/Gametype.h"
 #include "overlays/OverlayGroup.h"
-#include "sound/SoundBase.h"
 #include "LevelManager.h"
 
 namespace orxonox
@@ -52,7 +51,6 @@
         this->registerVariables();
         this->xmlfilename_ = this->getFilename();
         this->xmlfile_ = 0;
-        this->ambientsound_ = 0;
     }
 
     Level::~Level()
@@ -64,9 +62,6 @@
 
             if (this->xmlfile_)
                 Loader::unload(this->xmlfile_);
-
-            if (this->ambientsound_ != NULL)
-                delete this->ambientsound_;
         }
     }
 
@@ -77,8 +72,6 @@
         XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode);
         XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
 
-        XMLPortParamLoadOnly(Level, "ambientsound", loadAmbientSound, xmlelement, mode);
-
         XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
     }
 
@@ -149,21 +142,6 @@
         return 0;
     }
 
-    void Level::loadAmbientSound(const std::string& filename)
-    {
-        if(filename == "") return;
-        else
-        {
-            if(this->ambientsound_ == NULL)
-            {
-                this->ambientsound_ = new SoundBase();
-            }
-
-            this->ambientsound_->loadFile(filename);
-            this->ambientsound_->play(true);
-        }
-    }
-
     void Level::playerEntered(PlayerInfo* player)
     {
         COUT(3) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ")" << std::endl;

Modified: code/branches/core5/src/orxonox/Level.h
===================================================================
--- code/branches/core5/src/orxonox/Level.h	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/Level.h	2009-10-06 07:18:40 UTC (rev 5892)
@@ -52,8 +52,6 @@
             inline const std::string& getDescription() const
                 { return this->description_; }
 
-            void loadAmbientSound(const std::string& filename);
-
             void playerEntered(PlayerInfo* player);
             void playerLeft(PlayerInfo* player);
 
@@ -72,8 +70,6 @@
             std::string            xmlfilename_;
             XMLFile*               xmlfile_;
             std::list<BaseObject*> objects_;
-
-            SoundBase*             ambientsound_;
     };
 }
 

Modified: code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc	2009-10-06 07:18:40 UTC (rev 5892)
@@ -38,7 +38,7 @@
 #include "core/GraphicsManager.h"
 #include "core/GUIManager.h"
 #include "Scene.h"
-#include "sound/SoundMainMenu.h"
+#include "sound/SoundBase.h"
 
 namespace orxonox
 {
@@ -61,16 +61,15 @@
         if (GameMode::playsSound())
         {
             // Load sound
-            this->ambient_ = new SoundMainMenu();
+            this->ambient_ = new SoundBase(0);
+            this->ambient_->loadFile("ambient/mainmenu.wav");
         }
     }
 
     GSMainMenu::~GSMainMenu()
     {
         if (GameMode::playsSound())
-        {
-            this->ambient_->destroy();
-        }
+            delete this->ambient_;
 
         InputManager::getInstance().destroyState("mainMenu");
 

Modified: code/branches/core5/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- code/branches/core5/src/orxonox/gamestates/GSMainMenu.h	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/gamestates/GSMainMenu.h	2009-10-06 07:18:40 UTC (rev 5892)
@@ -58,7 +58,7 @@
         Ogre::Camera*     camera_;
 
         // ambient sound for the main menu
-        SoundMainMenu* ambient_;
+        SoundBase*        ambient_;
     };
 }
 

Modified: code/branches/core5/src/orxonox/items/Engine.cc
===================================================================
--- code/branches/core5/src/orxonox/items/Engine.cc	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/items/Engine.cc	2009-10-06 07:18:40 UTC (rev 5892)
@@ -36,7 +36,6 @@
 #include "worldentities/pawns/SpaceShip.h"
 #include "pickup/ModifierType.h"
 #include "tools/Shader.h"
-#include "sound/SoundBase.h"
 
 namespace orxonox
 {
@@ -67,8 +66,6 @@
 
         this->setConfigValues();
         this->registerVariables();
-
-        this->sound_ = NULL;
     }
 
     Engine::~Engine()
@@ -79,9 +76,6 @@
 
             if (this->boostBlur_)
                 this->boostBlur_->destroy();
-
-            if(this->sound_ != NULL)
-                delete this->sound_;
         }
     }
 
@@ -101,8 +95,6 @@
         XMLPortParam(Engine, "accelerationback",      setAccelerationBack,      setAccelerationBack,      xmlelement, mode);
         XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
         XMLPortParam(Engine, "accelerationupdown",    setAccelerationUpDown,    setAccelerationUpDown,    xmlelement, mode);
-
-        XMLPortParamLoadOnly(Engine, "sound", loadSound, xmlelement, mode);
     }
 
     void Engine::setConfigValues()
@@ -239,9 +231,6 @@
                 this->boostBlur_->destroy();
                 this->boostBlur_ = 0;
             }
-
-            if(this->sound_ != NULL)
-                this->sound_->attachToEntity(ship);
         }
     }
 
@@ -252,19 +241,4 @@
         else
             return Vector3::ZERO;
     }
-
-    void Engine::loadSound(const std::string filename)
-    {
-        if(filename == "") return;
-        else
-        {
-            if(this->sound_ == NULL)
-            {
-                this->sound_ = new SoundBase(this->ship_);
-            }
-
-            this->sound_->loadFile(filename);
-            this->sound_->play(true);
-        }
-    }
 }

Modified: code/branches/core5/src/orxonox/items/Engine.h
===================================================================
--- code/branches/core5/src/orxonox/items/Engine.h	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/items/Engine.h	2009-10-06 07:18:40 UTC (rev 5892)
@@ -129,8 +129,6 @@
 
             Shader* boostBlur_;
             float blurStrength_;
-
-            SoundBase* sound_;
     };
 }
 

Modified: code/branches/core5/src/orxonox/sound/CMakeLists.txt
===================================================================
--- code/branches/core5/src/orxonox/sound/CMakeLists.txt	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/sound/CMakeLists.txt	2009-10-06 07:18:40 UTC (rev 5892)
@@ -1,6 +1,5 @@
 ADD_SOURCE_FILES(ORXONOX_SRC_FILES
     SoundManager.cc
     SoundBase.cc
-    SoundMainMenu.cc
 )
 

Deleted: code/branches/core5/src/orxonox/sound/SoundMainMenu.cc
===================================================================
--- code/branches/core5/src/orxonox/sound/SoundMainMenu.cc	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/sound/SoundMainMenu.cc	2009-10-06 07:18:40 UTC (rev 5892)
@@ -1,47 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *       Erwin 'vaiursch' Herrsche
- *   Co-authors:
- *      ...
- *
- */
-
-#include "SoundMainMenu.h"
-
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-
-namespace orxonox
-{
-    SoundMainMenu::SoundMainMenu()
-    {
-        RegisterObject(SoundMainMenu);
-        setConfigValues();
-        loadFile(this->filename_);
-    }
-
-    void SoundMainMenu::setConfigValues()
-    {
-        SetConfigValue(filename_, "ambient/mainmenu.wav");
-    }
-}

Deleted: code/branches/core5/src/orxonox/sound/SoundMainMenu.h
===================================================================
--- code/branches/core5/src/orxonox/sound/SoundMainMenu.h	2009-10-06 03:38:45 UTC (rev 5891)
+++ code/branches/core5/src/orxonox/sound/SoundMainMenu.h	2009-10-06 07:18:40 UTC (rev 5892)
@@ -1,51 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *       Erwin 'vaiursch' Herrsche
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _SoundMainMenu_H__
-#define _SoundMainMenu_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "core/OrxonoxClass.h"
-#include "SoundBase.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport SoundMainMenu : public SoundBase, public virtual OrxonoxClass
-    {
-        public:
-            SoundMainMenu();
-            void setConfigValues();
-
-        private:
-            std::string filename_;
-    };
-}
-
-#endif /* _SoundMainMenu_H__ */




More information about the Orxonox-commit mailing list