Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 21, 2013, 11:16:54 PM (10 years ago)
Author:
jo
Message:

presentationHS13 branch merged into trunk

Location:
code/trunk
Files:
19 edited
23 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/CMakeLists.txt

    r9348 r9939  
    3939ADD_SUBDIRECTORY(docking)
    4040ADD_SUBDIRECTORY(towerdefense)
     41ADD_SUBDIRECTORY(invader)
  • code/trunk/src/modules/docking/Dock.cc

    r9667 r9939  
    6969        XMLPortObject(Dock, DockingAnimation, "animations", addAnimation, getAnimation, xmlelement, mode);
    7070        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
     71        XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode);
     72
    7173    }
    7274
     
    7678
    7779        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
    78     }
     80
     81        XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode);
     82    }
     83
     84
     85    bool Dock::undocking(bool bTriggered, BaseObject* trigger)
     86    {
     87
     88        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
     89        PlayerInfo* player = NULL;
     90
     91        // Check whether it is a player trigger and extract pawn from it
     92        if(pTrigger != NULL)
     93        {
     94              if(!pTrigger->isForPlayer()) {  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     95              orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl;
     96              return false;
     97              }
     98              player = pTrigger->getTriggeringPlayer();
     99        }
     100        else
     101        {
     102              orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl;
     103              return false;
     104        }
     105        if(player == NULL)
     106        {
     107              orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl;
     108              return false;
     109        }
     110
     111            if(bTriggered)
     112        {
     113              // Add player to this Docks candidates
     114              candidates_.insert(player);
     115
     116              // Show docking dialog
     117              this->showUndockingDialogHelper(player);
     118        }
     119        else
     120        {
     121              // Remove player from candidates list
     122              candidates_.erase(player);
     123        }
     124
     125        return true;
     126    }
     127
     128
    79129
    80130    bool Dock::execute(bool bTriggered, BaseObject* trigger)
     
    119169        return true;
    120170    }
     171
     172
     173    void Dock::showUndockingDialogHelper(PlayerInfo* player)
     174        {
     175            assert(player);
     176
     177            if(!player->isHumanPlayer())
     178                return;
     179
     180            if(GameMode::isMaster())
     181            {
     182                if(GameMode::showsGraphics())
     183                    GUIManager::showGUI("UndockingDialog");
     184            }
     185            else
     186                callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
     187
     188        }
    121189
    122190    void Dock::showDockingDialogHelper(PlayerInfo* player)
     
    177245        if (animations_.empty())
    178246            return dockingAnimationFinished(player);
     247
    179248        else
    180249            DockingAnimation::invokeAnimation(true, player, animations_);
  • code/trunk/src/modules/docking/Dock.h

    r9667 r9939  
    6262            // Trigger interface
    6363            bool execute(bool bTriggered, BaseObject* trigger);
     64            bool undocking(bool bTriggered, BaseObject* trigger);
    6465
    6566            // XML interface
     
    8586            void dock()
    8687                { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); }
     88            void undock()
     89                { this->undock(HumanController::getLocalControllerSingleton()->getPlayer()); }
    8790            static unsigned int getNumberOfActiveDocks();
    8891            static Dock* getActiveDockAtIndex(unsigned int index);
     
    9598            // Network functions
    9699            void showDockingDialogHelper(PlayerInfo* player);
     100            void showUndockingDialogHelper(PlayerInfo* player);
    97101            static void showDockingDialog();
    98102
  • code/trunk/src/modules/docking/MoveToDockingTarget.cc

    r9667 r9939  
    6666    {
    6767        //TODO: Investigate strange things...
    68         this->parent_->detach((WorldEntity*)player->getControllableEntity());
     68        //this->parent_->detach((WorldEntity*)player->getControllableEntity());
    6969
     70        //TODO: Check the issue with this detach call.
     71        //I have removed the line because the detach call only caused a warning and terminated. And because I didn't find a attach call either.
     72        //Didn't find the need for the line.
    7073        this->parent_->undockingAnimationFinished(player);
    7174        return true;
  • code/trunk/src/modules/objects/ForceField.cc

    r9667 r9939  
    4545    /*static*/ const std::string ForceField::modeSphere_s = "sphere";
    4646    /*static*/ const std::string ForceField::modeInvertedSphere_s = "invertedSphere";
     47
     48    /*static*/ const std::string ForceField::modeHomogen_s = "homogen";
     49
    4750    /*static*/ const std::string ForceField::modeNewtonianGravity_s = "newtonianGravity";
    4851    /*static*/ const float ForceField::gravConstant_ = 6.673e-11;
    4952    /*static*/ const float ForceField::attenFactor_ = 1;
     53
    5054
    5155    /**
     
    8993        XMLPortParam(ForceField, "length", setLength  , getLength  , xmlelement, mode).defaultValues(2000);
    9094        XMLPortParam(ForceField, "mode", setMode, getMode, xmlelement, mode);
     95        XMLPortParam(ForceField, "forcedirection", setForceDirection, getForceDirection, xmlelement, mode).defaultValues(Vector3(0,-400,0));
    9196    }
    9297   
     
    196201            }
    197202        }
     203        else if(this->mode_ == forceFieldMode::homogen)
     204        {
     205                // Iterate over all objects that could possibly be affected by the ForceField.
     206                for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
     207                {
     208                        Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     209                    float distance = distanceVector.length();
     210                    if (distance < this->radius_ && distance > this->massRadius_)
     211                    {
     212                        // Add a Acceleration in forceDirection_.
     213                        // Vector3(0,0,0) is the direction, where the force should work.
     214                        it->addAcceleration(forceDirection_ , Vector3(0,0,0));
     215                    }
     216                }
     217        }
    198218    }
    199219
     
    214234        else if(mode == ForceField::modeNewtonianGravity_s)
    215235            this->mode_ = forceFieldMode::newtonianGravity;
     236
     237        else if(mode == ForceField::modeHomogen_s)
     238            this->mode_ = forceFieldMode::homogen;
     239
    216240        else
    217241        {
     
    239263            case forceFieldMode::newtonianGravity:
    240264                return ForceField::modeNewtonianGravity_s;
     265
     266            case forceFieldMode::homogen:
     267                return ForceField::modeHomogen_s;
     268
    241269            default:
    242270                return ForceField::modeTube_s;
  • code/trunk/src/modules/objects/ForceField.h

    r9667 r9939  
     1
    12/*
    23 *   ORXONOX - the hottest 3D action shooter ever to exist
     
    5758            sphere, //!< The ForceField has a spherical shape.
    5859            invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior.
    59             newtonianGravity //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
     60            newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
     61            homogen //!< Local homogenous Force field with changeable direction for the Space Station
    6062        };
    6163    }
     
    6668
    6769        The following parameters can be set to specify the behavior of the ForceField.
     70        - @b forcedirection The direction and the strength of the homogenous force field. Default is 0,-400,0.
    6871        - @b velocity The amount of force the ForceField excerts. Default is 100.
    6972        - @b diameter The diameter of the ForceField. Default is 500.
     
    147150                { return this->halfLength_*2; }
    148151
     152            inline void setForceDirection(Vector3 forcedir)
     153                { this->forceDirection_ = forcedir; }
     154
     155            inline Vector3 getForceDirection()
     156                { return this->forceDirection_; }
     157
     158
    149159            void setMode(const std::string& mode); //!< Set the mode of the ForceField.
    150160            const std::string& getMode(void); //!< Get the mode of the ForceField.
     
    156166            static const std::string modeInvertedSphere_s;
    157167            static const std::string modeNewtonianGravity_s;
     168
     169            static const std::string modeHomogen_s;
    158170
    159171            float velocity_; //!< The velocity of the ForceField.
     
    167179            //! Attenuation factor for Newtonian ForceFields
    168180            static const float attenFactor_;
     181            Vector3 forceDirection_;
    169182  };
    170183}
  • code/trunk/src/modules/overlays/OverlaysPrereqs.h

    r9526 r9939  
    8080    class BarColour;
    8181    class ChatOverlay;
     82    class CountDown;
    8283    class DeathMessage;
    8384    class GametypeFadingMessage;
  • code/trunk/src/modules/overlays/debugging/CMakeLists.txt

    r5781 r9939  
    22  DebugFPSText.cc
    33  DebugRTRText.cc
     4  DebugPositionText.cc
    45)
  • code/trunk/src/modules/overlays/hud/CMakeLists.txt

    r9348 r9939  
    1818  PauseNotice.cc
    1919  LastTeamStandingInfos.cc
     20  CountDown.cc
    2021)
  • code/trunk/src/modules/overlays/hud/HUDNavigation.cc

    r9667 r9939  
    7474        OrxonoxOverlay(context)
    7575    {
    76         RegisterObject(HUDNavigation)
    77 ;        this->setConfigValues();
     76        RegisterObject(HUDNavigation);
     77        this->setConfigValues();
    7878
    7979        // Set default values
  • code/trunk/src/modules/overlays/hud/HUDRadar.cc

    r9667 r9939  
    2525 *   Co-authors:
    2626 *      Reto Grieder
     27 *      Wolfgang Roenninger
    2728 *
    2829 */
     
    4142#include "Scene.h"
    4243#include "Radar.h"
     44#include "core/config/ConfigValueIncludes.h"
    4345
    4446namespace orxonox
     
    5052    {
    5153        RegisterObject(HUDRadar);
     54        this->setConfigValues();
    5255
    5356        this->marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
     
    6063        this->setHalfDotSizeDistance(3000.0f);
    6164        this->setMaximumDotSize(0.1f);
     65        this->setMaximumDotSize3D(0.07f);
    6266
    6367        this->shapeMaterials_[RadarViewable::Dot]      = "RadarDot.png";
    6468        this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png";
    6569        this->shapeMaterials_[RadarViewable::Square]   = "RadarSquare.png";
    66         this->setDetectionLimit( 10000.0f );
    6770        this->owner_ = 0;
     71
     72        this->map3DFront_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
     73                .createOverlayElement("Panel", "HUDRadar_mapDreiDFront_" + getUniqueNumberString()));
     74        this->map3DFront_->setMaterialName("Orxonox/Radar3DFront");
     75        this->overlay_->add2D(this->map3DFront_);
     76        this->map3DFront_->hide();
     77
     78        this->map3DBack_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
     79                .createOverlayElement("Panel", "HUDRadar_mapDreiDBack_" + getUniqueNumberString()));
     80        this->map3DBack_->setMaterialName("Orxonox/Radar3DBack");
     81        this->overlay_->add2D(this->map3DBack_);
     82        this->map3DBack_->hide();
     83
    6884    }
    6985
     
    7389        {
    7490            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->marker_);
     91            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DFront_);
     92            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_);
     93
    7594            for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin();
    7695                it != this->radarObjects_.end(); ++it)
     
    8099        }
    81100    }
     101
     102
     103
     104    void HUDRadar::setConfigValues()
     105       {
     106           SetConfigValue(RadarMode_, true);
     107       }
    82108
    83109    void HUDRadar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    88114        XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);
    89115        XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlelement, mode);
     116        XMLPortParam(HUDRadar, "maximumDotSize3D", setMaximumDotSize3D, getMaximumDotSize3D, xmlelement, mode);
     117        XMLPortParam(HUDRadar, "material2D", set2DMaterial, get2DMaterial, xmlelement, mode);
     118        XMLPortParam(HUDRadar, "material3DMiddle", set3DMaterial, get3DMaterial, xmlelement, mode);
     119        XMLPortParam(HUDRadar, "material3DFront", set3DMaterialFront, get3DMaterialFront, xmlelement, mode);
     120        XMLPortParam(HUDRadar, "material3DBack", set3DMaterialBack, get3DMaterialBack, xmlelement, mode);
     121        XMLPortParam(HUDRadar, "mapAngle3D", setMapAngle, getMapAngle, xmlelement, mode);
     122        XMLPortParam(HUDRadar, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
    90123    }
    91124
     
    152185        // update the distances for all objects
    153186        std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;
     187
     188
     189        if(RadarMode_)
     190        {
     191                this->setBackgroundMaterial(material3D_);
     192                this->map3DFront_->_notifyZOrder(this->overlay_->getZOrder() * 100 + 250); // it seems that the ZOrder of overlayelements is 100 times the ZOrder of the overlay
     193                this->map3DBack_->_notifyZOrder(this->overlay_->getZOrder() * 100 - 250); // 250 a little bit buffer so that the two shels are displayed all in the front / in the back
     194                this->map3DFront_->show();
     195                this->map3DBack_->show();
     196        }
     197        else
     198        {
     199                this->setBackgroundMaterial(material2D_);
     200                this->map3DFront_->hide();
     201                this->map3DBack_->hide();
     202        }
     203
    154204        for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it )
    155205        {
     
    165215            float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length();
    166216            // calculate the size with 1/distance dependency for simplicity (instead of exp(-distance * lambda)
    167             float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
     217
     218            float size;
     219            if(RadarMode_)
     220                size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
     221            else
     222                size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
    168223            it->second->setDimensions(size, size);
    169224
    170225            // calc position on radar...
    171             Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
     226            Vector2 coord;
     227
     228            if(RadarMode_)
     229            {
     230                coord = get3DProjection(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), 0.6435011, detectionLimit_);
     231
     232                // set zOrder on screen
     233                bool overXZPlain = isObjectHigherThanShipOnMap(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), this->mapAngle_);
     234
     235                int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_);
     236                if(overXZPlain == false /*&& (it->second->getZOrder() >  100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay
     237                        it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);
     238                if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/)
     239                        it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);
     240            }
     241            else
     242                coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
     243
    172244            coord *= math::pi / 3.5f; // small adjustment to make it fit the texture
    173245            it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
     246
    174247            if( distance < detectionLimit_ || detectionLimit_ < 0 )
    175248                it->second->show();
     
    182255                this->marker_->setDimensions(size * 1.5f, size * 1.5f);
    183256                this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f);
     257                if(RadarMode_)
     258                        this->marker_->_notifyZOrder(it->second->getZOrder() -1);
    184259                this->marker_->show();
    185260            }
  • code/trunk/src/modules/overlays/hud/HUDRadar.h

    r9667 r9939  
    3535#include <map>
    3636#include <vector>
     37#include <string>
    3738
    3839#include "util/OgreForwardRefs.h"
     
    5152        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5253        virtual void changedOwner();
     54        void setConfigValues();
    5355
    5456    private:
     
    5759        void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; }
    5860
    59         void setDetectionLimit( float limit )
    60         { this->detectionLimit_ = limit; }
    61         float getDetectionLimit() const
    62         { return this->detectionLimit_; }
     61        void setDetectionLimit( float limit ) { this->detectionLimit_ = limit; }
     62        float getDetectionLimit() const { return this->detectionLimit_; }
    6363
    6464        float getMaximumDotSize() const { return this->maximumDotSize_; }
    6565        void setMaximumDotSize(float size) { this->maximumDotSize_ = size; }
    6666
     67        float getMaximumDotSize3D() const { return this->maximumDotSize3D_; }
     68        void setMaximumDotSize3D(float size) { this->maximumDotSize3D_ = size;}
     69
     70        std::string get2DMaterial() const {return this->material2D_; }
     71        void set2DMaterial(std::string material2D) { this->material2D_ = material2D; }
     72
     73        std::string get3DMaterial() const {return this->material3D_; }
     74        void set3DMaterial(std::string material3D) { this->material3D_ = material3D; }
     75
     76        std::string get3DMaterialFront() const {return this->material3DFront_; }
     77        void set3DMaterialFront(std::string material3DFront) { this->material3DFront_ = material3DFront; }
     78
     79        std::string get3DMaterialBack() const {return this->material3DBack_; }
     80        void set3DMaterialBack(std::string material3DBack) { this->material3DBack_ = material3DBack; }
     81
    6782        float getRadarSensitivity() const { return this->sensitivity_; }
    6883        // used also by RadarListener interface!
    6984        void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; }
     85
     86        // Determines angle between line of sight and x/z-plain on the 3D minimap
     87        float getMapAngle() const { return this->mapAngle_; }
     88        void setMapAngle(float mapAngle) { this->mapAngle_ = mapAngle; }
    7089
    7190        // RadarListener interface
     
    85104        Ogre::PanelOverlayElement* marker_;
    86105
     106        bool RadarMode_; // Determines, if Radar runs in 3D or 2D Mode
     107
    87108        float halfDotSizeDistance_;
    88109        float maximumDotSize_;
     110        float maximumDotSize3D_;
     111        float mapAngle_;
     112
     113        std::string material2D_;                //Material name for 2D map
     114        std::string material3D_;                //Material names For the 3D minimap
     115        std::string material3DFront_;
     116        std::string material3DBack_;
     117
     118        Ogre::PanelOverlayElement* map3DFront_; //Overlayelements for the 3D minimap to be able to draw the points in a semi 3D matter
     119        Ogre::PanelOverlayElement* map3DBack_;
    89120
    90121        float sensitivity_;
  • code/trunk/src/modules/pong/Pong.cc

    r9667 r9939  
    4747#include "PongBot.h"
    4848#include "PongAI.h"
     49
    4950namespace orxonox
    5051{
     
    117118            }
    118119        }
     120
    119121    }
    120122
  • code/trunk/src/modules/pong/PongBall.cc

    r9667 r9939  
    4040
    4141#include "PongBat.h"
     42
     43#include "sound/WorldSound.h"
     44#include "core/XMLPort.h"
    4245
    4346namespace orxonox
     
    6669
    6770        this->registerVariables();
     71
     72        //initialize sound
     73        if (GameMode::isMaster())
     74             {
     75                 this->defScoreSound_ = new WorldSound(this->getContext());
     76                 this->defScoreSound_->setVolume(1.0f);
     77                 this->defBatSound_ = new WorldSound(this->getContext());
     78                 this->defBatSound_->setVolume(0.4f);
     79                 this->defBoundarySound_ = new WorldSound(this->getContext());
     80                 this->defBoundarySound_->setVolume(0.5f);
     81             }
     82             else
     83             {
     84                 this->defScoreSound_ = 0;
     85                 this->defBatSound_ = 0;
     86                 this->defBoundarySound_ = 0;
     87             }
    6888    }
    6989
     
    81101            delete[] this->batID_;
    82102        }
     103    }
     104
     105    //xml port for loading sounds
     106    void PongBall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     107    {
     108        SUPER(PongBall, XMLPort, xmlelement, mode);
     109        XMLPortParam(PongBall, "defScoreSound",  setDefScoreSound,  getDefScoreSound,  xmlelement, mode);
     110        XMLPortParam(PongBall, "defBatSound",  setDefBatSound,  getDefBatSound,  xmlelement, mode);
     111        XMLPortParam(PongBall, "defBoundarySound",  setDefBoundarySound,  getDefBoundarySound,  xmlelement, mode);
    83112    }
    84113
     
    117146        if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
    118147        {
    119             // 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).
    120150            velocity.z = -velocity.z;
    121151            // And its position is set as to not overstep the boundary it has just crossed.
     
    142172                    if (fabs(distance) <= 1) // If the bat is there to parry.
    143173                    {
    144                         // 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.
    145176                        position.x = this->fieldWidth_ / 2;
    146177                        // Invert its velocity in x-direction (i.e. it bounces off).
     
    155186                    else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
    156187                    {
     188                        defScoreSound_->play();//play score sound
    157189                        if (this->getGametype() && this->bat_[0])
    158190                        {
     
    169201                    if (fabs(distance) <= 1) // If the bat is there to parry.
    170202                    {
    171                         // 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.
    172205                        position.x = -this->fieldWidth_ / 2;
    173206                        // Invert its velocity in x-direction (i.e. it bounces off).
     
    182215                    else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
    183216                    {
     217                        defScoreSound_->play();//play score sound
    184218                        if (this->getGametype() && this->bat_[1])
    185219                        {
     
    262296            this->bat_[1] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1]));
    263297    }
     298
     299    void PongBall::setDefScoreSound(const std::string &pongSound)
     300    {
     301        if( defScoreSound_ )
     302            defScoreSound_->setSource(pongSound);
     303        else
     304            assert(0); // This should never happen, because soundpointer is only available on master
     305    }
     306
     307    const std::string& PongBall::getDefScoreSound()
     308    {
     309        if( defScoreSound_ )
     310            return defScoreSound_->getSource();
     311        else
     312            assert(0);
     313        return BLANKSTRING;
     314    }
     315
     316    void PongBall::setDefBatSound(const std::string &pongSound)
     317    {
     318        if( defBatSound_ )
     319            defBatSound_->setSource(pongSound);
     320        else
     321            assert(0); // This should never happen, because soundpointer is only available on master
     322    }
     323
     324    const std::string& PongBall::getDefBatSound()
     325    {
     326        if( defBatSound_ )
     327            return defBatSound_->getSource();
     328        else
     329            assert(0);
     330        return BLANKSTRING;
     331    }
     332
     333    void PongBall::setDefBoundarySound(const std::string &pongSound)
     334    {
     335        if( defBoundarySound_ )
     336            defBoundarySound_->setSource(pongSound);
     337        else
     338            assert(0); // This should never happen, because soundpointer is only available on master
     339    }
     340
     341    const std::string& PongBall::getDefBoundarySound()
     342    {
     343        if( defBoundarySound_ )
     344            return defBoundarySound_->getSource();
     345        else
     346            assert(0);
     347        return BLANKSTRING;
     348    }
    264349}
  • code/trunk/src/modules/pong/PongBall.h

    r9667 r9939  
    4242#include "worldentities/MovableEntity.h"
    4343
     44
    4445namespace orxonox
    4546{
     
    6364
    6465            virtual void tick(float dt);
     66
     67            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6568
    6669            /**
     
    123126            static const float MAX_REL_Z_VELOCITY;
    124127
     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();
     134
    125135        private:
    126136            void registerVariables();
     
    135145            unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network.
    136146            float relMercyOffset_; //!< Offset, that makes the player not loose, when, in all fairness, he would have.
     147            WorldSound* defScoreSound_;
     148            WorldSound* defBatSound_;
     149            WorldSound* defBoundarySound_;
    137150    };
    138151}
  • code/trunk/src/modules/pong/PongScore.cc

    r9667 r9939  
    4141
    4242#include "Pong.h"
     43#include "sound/WorldSound.h" /////////////////////////////
    4344
    4445namespace orxonox
  • code/trunk/src/modules/pong/PongScore.h

    r9667 r9939  
    124124            WeakPtr<PlayerInfo> player1_; //!< Store information about left player permanently.
    125125            WeakPtr<PlayerInfo> player2_; //!< Same for the right player. To end the game properly.
     126            WorldSound* scoreSound_;
     127
    126128    };
    127129}
  • code/trunk/src/modules/weapons/weaponmodes/HsW01.h

    r9667 r9939  
    5959            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6060
    61         private:
     61        protected:
    6262            /**
    6363            @brief Set the mesh.
     
    109109                { return this->delay_; }
    110110
    111             void shot();
     111            virtual void shot();
    112112            void muzzleflash();
    113113
Note: See TracChangeset for help on using the changeset viewer.