Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9939 for code/trunk/src


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

presentationHS13 branch merged into trunk

Location:
code/trunk
Files:
42 edited
23 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/util/Math.cc

    r8400 r9939  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Wolfgang Roenninger
    2626 *
    2727 */
     
    147147
    148148    /**
    149         @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
     149        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0� = 0, 180� = 1).
    150150        @param myposition My position
    151151        @param mydirection My viewing direction
     
    189189        else
    190190            return orxonox::Vector2( -sin_value * radius, cos_value * radius);
     191    }
     192
     193
     194    /**
     195            @brief Gets the 2D project vector for the 3D Radar .
     196            @param myposition My position
     197            @param mydirection My viewing direction
     198            @param myorthonormal My orthonormalvector (pointing upwards through my head)
     199            @param otherposition The position of the other object
     200            @param mapangle The angle between line of sight on screen and the 3Dmap-x/z-plain in radian
     201            @param detectionlimit The limit in which objects are shown on the map
     202            @return The viewing direction
     203    */
     204    orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit)
     205    {
     206        // Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right
     207        orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object
     208
     209        // new coordinate system:       x_axsis:        mydirection             (points front)
     210        //                                                      y_axsis:        myorthonormal   (points up)
     211        //                                                      z_axsis:        myside                  (points right)
     212
     213        orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get 3. base vector
     214
     215        distance = 4*distance / detectionlimit; // shrink vector on map
     216        if(distance.length() > 1.0f) // if object would wander outside of the map
     217                {
     218                distance = distance / distance.length();
     219                        }
     220
     221        // perform a coordinate transformation to get distance in relation of the position of the ship
     222        orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
     223
     224        // calculate 2D vector on the map (with angle between x/z - plain and line of sight)
     225        float xcoordinate = distanceShip.z; // z; cause x direction on screen is to the right side
     226        float ycoordinate = distanceShip.x*sin(mapangle)+distanceShip.y*cos(mapangle);
     227        return orxonox::Vector2(xcoordinate , ycoordinate);
     228    }
     229
     230    /**
     231               @brief Gets if a object is over the x/z - plain on map
     232               @param myposition My position
     233               @param mydirection My viewing direction
     234               @param myorthonormal My orthonormalvector (pointing upwards through my head)
     235               @param otherposition The position of the other object
     236               @param mapangle The angle you look on the 3Dmap in radian
     237               @return If distancevector to the other object has a positive y-coordinate
     238
     239               Examples:
     240                Returns true if object is over x/z - plain
     241                Returns false if object is below x/z -plain
     242    */
     243    bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle)
     244    {
     245        // Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right
     246        orxonox::Vector3 distance = otherposition - myposition;
     247
     248        // new coordinate system:       x_axsis:        mydirection             (points front)
     249        //                                                      y_axsis:        myorthonormal   (points up)
     250        //                                                      z_axsis:        myside                  (points right)
     251
     252        orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector from Ship to object
     253
     254
     255        // perform a coordinate transformation to get distance in relation of the position of the ship
     256        orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
     257
     258        if(distanceShip.y >= 0)
     259                return true;
     260        else
     261                return false;
     262    }
     263
     264    /**
     265                   @brief A value between 0 and 10, in order how other object is in front or in back
     266                   @param myposition My position
     267                   @param mydirection My viewing direction
     268                   @param myorthonormal My orthonormalvector (pointing upwards through my head)
     269                   @param otherposition The position of the other object
     270                   @param detectionlimit The limit in which objects are shown on the map
     271                   @return value between 0 and 100
     272    */
     273    int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit)
     274    {
     275        orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object
     276        orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal);      // get vector to the side
     277
     278        distance = 4*distance / detectionlimit; // shrink vector on map
     279        if(distance.length() > 1.0f) // if object would wander outside of the map
     280        {
     281                distance = distance / distance.length();
     282        }
     283
     284        // perform a coordinate transformation to get distance in relation of the position of the ship
     285        orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
     286
     287        return (int) 50 - 100*distanceShip.x;
     288    }
     289
     290
     291    /**
     292                @brief Gets the new vector after a coordinate transformation
     293                @param distance Vector which will be transformed
     294                @param mydirection New x basevector
     295                @param myorthonormal New y basevector
     296                @param otherposition New z basevector
     297                @return direction in the new coordinates
     298
     299                x is vector in old coordinates
     300                y is vector in old coordinates
     301                T is transform matrix with:
     302                        T = (t1 , t2 , t3)
     303                        t1 = mydirection
     304                        t2 = myorthonormal
     305                        t3 = myside
     306
     307                y = T^(-1)*x
     308            */
     309    orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside)
     310    {
     311        // inverse of the transform matrix
     312        float determinant = +mydirection.x * (myorthonormal.y*myside.z - myside.y*myorthonormal.z)
     313                                                -mydirection.y * (myorthonormal.x*myside.z - myorthonormal.z*myside.x)
     314                                                +mydirection.z * (myorthonormal.x*myside.y - myorthonormal.y*myside.x);
     315        float invdet = 1/determinant;
     316
     317        // transform matrix
     318        orxonox::Vector3 xinvtransform;
     319        orxonox::Vector3 yinvtransform;
     320        orxonox::Vector3 zinvtransform;
     321
     322        xinvtransform.x = (myorthonormal.y * myside.z        - myside.y        * myorthonormal.z)*invdet;
     323        xinvtransform.y = (mydirection.z   * myside.y        - mydirection.y   * myside.z       )*invdet;
     324        xinvtransform.z = (mydirection.y   * myorthonormal.z - mydirection.z   * myorthonormal.y)*invdet;
     325        yinvtransform.x = (myorthonormal.z * myside.x        - myorthonormal.x * myside.z       )*invdet;
     326        yinvtransform.y = (mydirection.x   * myside.z        - mydirection.z   * myside.x       )*invdet;
     327        yinvtransform.z = (myorthonormal.x * mydirection.z   - mydirection.x   * myorthonormal.z)*invdet;
     328        zinvtransform.x = (myorthonormal.x * myside.y        - myside.x        * myorthonormal.y)*invdet;
     329        zinvtransform.y = (myside.x        * mydirection.y   - mydirection.x   * myside.y       )*invdet;
     330        zinvtransform.z = (mydirection.x   * myorthonormal.y - myorthonormal.x * mydirection.y  )*invdet;
     331
     332        // coordinate transformation
     333        orxonox::Vector3 distanceShip;
     334        distanceShip.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z;
     335        distanceShip.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z;
     336        distanceShip.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z;
     337
     338        return distanceShip;
    191339    }
    192340
  • code/trunk/src/libraries/util/Math.h

    r9550 r9939  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Wolfgang Roenninger
    2626 *
    2727 */
     
    9292    _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
    9393    _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
     94    _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit);
     95    _UtilExport bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle);
     96    _UtilExport int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit);
     97    _UtilExport orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside);
    9498    _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
    9599
  • 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
  • code/trunk/src/orxonox/MoodManager.h

    r9667 r9939  
    5151
    5252        private:
    53             virtual void moodChanged(const std::string& mood) = 0;
     53            virtual bool moodChanged(const std::string& mood) = 0;
    5454
    5555            static void changedMood(const std::string& mood);
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r9667 r9939  
    443443
    444444        if (pawn)
    445             pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 1200 );
     445            pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 3000 );
    446446
    447447        if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != 0 )
  • code/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r9667 r9939  
    8585    {
    8686        if (GameMode::playsSound())
    87             this->ambient_->destroy();
     87            this->ambient_->destroy(); //CHECK Thilo destroy ?preDestroy()? !!!!!!!
    8888
    8989        InputManager::getInstance().destroyState("MainMenuHackery");
  • code/trunk/src/orxonox/gametypes/Gametype.cc

    r9667 r9939  
    171171                    entity->setOrientation(oldentity->getWorldOrientation());
    172172                }
    173 
    174173                it->first->startControl(entity);
    175174            }
  • code/trunk/src/orxonox/graphics/ParticleEmitter.cc

    r9667 r9939  
    4545    RegisterClass(ParticleEmitter);
    4646
    47     ParticleEmitter::ParticleEmitter(Context* context) : StaticEntity(context)
     47    ParticleEmitter::ParticleEmitter(Context* context) : MovableEntity(context)
    4848    {
    4949        RegisterObject(ParticleEmitter);
  • code/trunk/src/orxonox/graphics/ParticleEmitter.h

    r9667 r9939  
    3333
    3434#include <string>
    35 #include "worldentities/StaticEntity.h"
     35#include "worldentities/MovableEntity.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport ParticleEmitter : public StaticEntity
     39    class _OrxonoxExport ParticleEmitter : public MovableEntity
    4040    {
    4141        public:
  • code/trunk/src/orxonox/infos/PlayerInfo.cc

    r9667 r9939  
    229229            return;
    230230
    231         this->controllableEntity_->getController()->setActive(false);
     231        Controller* tmp =this->controllableEntity_->getController();
     232        if (tmp == NULL)
     233        {
     234                orxout(verbose) <<  "PlayerInfo: pauseControl, Controller is NULL " << endl;
     235                return;
     236        }
     237        tmp->setActive(false);
    232238        //this->controllableEntity_->getController()->setControllableEntity(NULL);
    233239        this->controllableEntity_->setController(0);
  • code/trunk/src/orxonox/interfaces/RadarViewable.h

    r9667 r9939  
    6363        virtual void setRadarName(const std::string& name)
    6464            {
     65            // The following if-clause hides objects with radarname "HIDDEN"
     66                if (name == "HIDDEN")
     67                {
     68                    this->bVisibility_ = 0;
     69                    this->settingsChanged();
     70                }
    6571                if (this->radarName_ != name)
    6672                {
  • code/trunk/src/orxonox/items/MultiStateEngine.cc

    r9667 r9939  
    6161            this->defEngineSndNormal_->setLooping(true);
    6262            this->defEngineSndBoost_->setLooping(true);
     63            this->defEngineSndNormal_->setVolume(0.8f);
     64            this->defEngineSndBoost_->setVolume(0.5f);
    6365            this->lua_ = new LuaState();
    6466        }
  • code/trunk/src/orxonox/sound/AmbientSound.cc

    r8861 r9939  
    7979    }
    8080
    81     void AmbientSound::setAmbientSource(const std::string& source)
     81    bool AmbientSound::setAmbientSource(const std::string& source)
    8282    {
    8383        this->ambientSource_ = source;
    84         this->moodChanged(MoodManager::getInstance().getMood());
     84        return(this->moodChanged(MoodManager::getInstance().getMood()));
    8585    }
    8686
    87     void AmbientSound::moodChanged(const std::string& mood)
     87    bool AmbientSound::moodChanged(const std::string& mood)
    8888    {
    8989        if (GameMode::playsSound())
     
    9595                orxout(user_info) << "Loading ambient sound " << path << "..." << endl; // TODO: make this output internal if we implement sound streaming
    9696                this->setSource(path);
     97
     98                // all went fine
     99                return true;
    97100            }
    98101            else
    99102            {
    100103                orxout(internal_warning, context::sound) << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << endl;
     104
     105                // everything went southways
     106                return false;
    101107            }
    102108        }
     109        return false;
    103110    }
    104111
  • code/trunk/src/orxonox/sound/AmbientSound.h

    r7856 r9939  
    5454        void pause();
    5555
    56         void setAmbientSource(const std::string& source);
     56        bool setAmbientSource(const std::string& source);
    5757        inline const std::string& getAmbientSource() const
    5858            { return this->ambientSource_; }
     
    6868        void preDestroy();
    6969        float getRealVolume();
    70         void moodChanged(const std::string& mood);
     70        bool moodChanged(const std::string& mood);
    7171        inline void ambientSourceChanged()
    7272            { this->setAmbientSource(this->ambientSource_); }
  • code/trunk/src/orxonox/sound/BaseSound.cc

    r9667 r9939  
    4747    BaseSound::BaseSound()
    4848        : bPooling_(false)
    49         , volume_(1.0)
     49        , volume_(0.7)
    5050        , bLooping_(false)
    5151        , state_(Stopped)
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r9667 r9939  
    218218            .description("Defines the overall volume.")
    219219            .callback(this, &SoundManager::checkSoundVolumeValidity);
    220         SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 1.0f)
     220        SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 0.7f)
    221221            .description("Defines the ambient volume.")
    222222            .callback(this, &SoundManager::checkAmbientVolumeValidity);
  • code/trunk/src/orxonox/sound/WorldAmbientSound.cc

    r9667 r9939  
    3333#include "core/XMLPort.h"
    3434#include "AmbientSound.h"
     35#include "core/command/ConsoleCommand.h"
     36#include <exception>
     37
    3538
    3639namespace orxonox
    3740{
     41        SetConsoleCommand("WorldAmbientSound", "nextsong",      &WorldAmbientSound::nextSong);
     42
    3843    RegisterClass(WorldAmbientSound);
    3944
     
    4449        this->ambientSound_ = new AmbientSound();
    4550        this->registerVariables();
     51        soundList_.push_back("Earth.ogg");
     52        soundList_.push_back("Jupiter.ogg");
     53        soundList_.push_back("Mars.ogg");
     54        soundList_.push_back("allgorythm-lift_up.ogg");
     55        soundList_.push_back("allgorythm-resonance_blaster.ogg");
     56        soundList_.push_back("AlphaCentauri.ogg");
     57        soundList_.push_back("Asteroid_rocks.ogg");
     58        soundList_.push_back("Ganymede.ogg");
     59        soundList_.push_back("luke_grey_-_hypermode.ogg");
     60
    4661    }
    47 
    4862    WorldAmbientSound::~WorldAmbientSound()
    4963    {
     
    5165        {
    5266            this->ambientSound_->destroy();
     67            WorldAmbientSound::soundList_.clear();
    5368        }
    5469    }
     
    94109            this->ambientSound_->stop();
    95110    }
     111
     112    void WorldAmbientSound::nextSong()
     113    {
     114
     115        //HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used.
     116        for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin();
     117             it != ObjectList<WorldAmbientSound>::end(); ++it)
     118        {
     119                while(it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
     120                        WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
     121                }
     122                WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
     123        }
     124    }
    96125}
  • code/trunk/src/orxonox/sound/WorldAmbientSound.h

    r9667 r9939  
    3434#include "core/BaseObject.h"
    3535#include "network/synchronisable/Synchronisable.h"
     36#include <string>
     37#include <vector>
     38
    3639
    3740namespace orxonox
     
    5457            void play();
    5558
     59            //This function changes the current ambient song.
     60            //You can call nextSong() active in the level
     61            //by pressing the key 'M'.
     62            static void nextSong();
     63
    5664        private:
    5765            void registerVariables();
    5866
     67            //Vector with the diffrent available level sounds.
     68            //The sound names are pushed in the WorldAmbientSound-constructor.
     69            static std::vector<std::string> soundList_;
     70
     71            // This value will be initialized below, don't make this into
     72            // a const, since we want to change it in nextSong().
     73            static int soundNumber_;
     74
     75
    5976            AmbientSound* ambientSound_;
    6077    };
     78
     79    // This is an initialization for the soundnumber variable. Since it is
     80    // static, we have to initialize it this way.
     81    int WorldAmbientSound::soundNumber_ = 0;
     82    std::vector<std::string> WorldAmbientSound::soundList_;
     83
    6184}
    6285
  • code/trunk/src/orxonox/sound/WorldSound.cc

    r9667 r9939  
    8181            alSourcef(this->audioSource_, AL_REFERENCE_DISTANCE, refDist);
    8282            // TODO: 500 is very magical here. Derive something better
    83             alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 500);
     83            alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 20);
    8484        }
    8585        this->tick(0); // update position, orientation and velocity
  • code/trunk/src/orxonox/weaponsystem/WeaponMode.cc

    r9667 r9939  
    7979            this->defSndWpnFire_ = new WorldSound(this->getContext());
    8080            this->defSndWpnFire_->setLooping(false);
     81            this->defSndWpnFire_->setVolume(0.8f);
    8182            this->bSoundAttached_ = false;
    8283        }
  • code/trunk/src/orxonox/worldentities/BigExplosion.cc

    r9667 r9939  
    4343    RegisterClass(BigExplosion);
    4444
    45     BigExplosion::BigExplosion(Context* context) : StaticEntity(context)
     45    BigExplosion::BigExplosion(Context* context) : MobileEntity(context)
    4646    {
    4747        RegisterObject(BigExplosion);
     48
     49        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
     50            ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");
     51
     52        this->bStop_ = false;
     53        this->LOD_ = LODParticle::Normal;
     54
     55        if ( GameMode::showsGraphics() )
     56        {
     57            try
     58            {
     59                this->init();
     60            }
     61            catch (const std::exception& ex)
     62            {
     63                orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl;
     64                this->initZero();
     65            }
     66        }
     67        else
     68        {
     69            this->initZero();
     70        }
     71
     72        if (GameMode::isMaster())
     73        {
     74            this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this)));
     75        }
     76
     77        this->registerVariables();
     78    }
     79
     80    BigExplosion::BigExplosion(Context* context, Vector3 initVelocity) : MobileEntity(context)
     81    {
     82        RegisterObject(BigExplosion);
     83        this->setVelocity(initVelocity);
    4884
    4985        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
     
    100136        this->debris4_->setSyncMode(0);
    101137
    102         this->explosion_ = new StaticEntity(this->getContext());
     138        this->explosion_ = new MobileEntity(this->getContext());
    103139        this->explosion_->setSyncMode(0);
    104140
     
    148184        this->debrisEntity4_->attach(debris4_);
    149185
     186        // ///////////////////////
     187        // TODO: particleSpawner is a static entity. It should probably be dynamic, for better explosions.
     188        //
    150189        ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     190        orxout() << "vel " << this->getVelocity() << endl;
     191        // effect->setVelocity(this->getVelocity());
    151192        effect->setDestroyAfterLife(true);
    152193        effect->setSource("Orxonox/explosion2b");
     
    155196
    156197        ParticleSpawner* effect2 = new ParticleSpawner(this->getContext());
     198        // effect2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 200));
    157199        effect2->setDestroyAfterLife(true);
    158200        effect2->setSource("Orxonox/smoke6");
  • code/trunk/src/orxonox/worldentities/BigExplosion.h

    r9667 r9939  
    2222 *   Author:
    2323 *      Benjamin de Capitani
    24  *   Co-authors:
     24 *   Co-authors:§
    2525 *      ...
    2626 *
     
    3333
    3434#include "tools/Timer.h"
    35 #include "StaticEntity.h"
     35#include "MobileEntity.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport BigExplosion : public StaticEntity
     39    class _OrxonoxExport BigExplosion : public MobileEntity
    4040    {
    4141        public:
    4242            BigExplosion(Context* context);
     43            BigExplosion(Context* context, Vector3 initVelocity);
    4344            virtual ~BigExplosion();
    4445
     
    6061            bool                  bStop_;
    6162
    62             StaticEntity*         explosion_;
     63            MobileEntity*         explosion_;
    6364
    6465            MovableEntity*        debrisEntity1_;
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r9667 r9939  
    4646#include "weaponsystem/WeaponPack.h"
    4747#include "weaponsystem/WeaponSet.h"
     48#include "sound/WorldSound.h"
    4849
    4950#include "controllers/FormationController.h"
     
    100101
    101102        this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition
     103
     104        if (GameMode::isMaster())
     105        {
     106            this->explosionSound_ = new WorldSound(this->getContext());
     107            this->explosionSound_->setVolume(1.0f);
     108        }
     109        else
     110        {
     111            this->explosionSound_ = 0;
     112        }
    102113    }
    103114
     
    109120                this->weaponSystem_->destroy();
    110121        }
     122
    111123    }
    112124
     
    135147        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
    136148
     149        XMLPortParam(Pawn, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
     150
    137151        XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
    138152    }
     153
    139154
    140155    void Pawn::registerVariables()
     
    290305    void Pawn::kill()
    291306    {
    292         this->damage(this->health_);
     307        this->damage(this->health_);
    293308        this->death();
    294309    }
     
    314329        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
    315330        {
    316             // Set bAlive_ to false and wait for PawnManager to do the destruction
     331            explosionSound_->play();
     332                // Set bAlive_ to false and wait for PawnManager to do the destruction
    317333            this->bAlive_ = false;
    318334
     
    365381        this->setDestroyWhenPlayerLeft(false);
    366382
    367         BigExplosion* chunk = new BigExplosion(this->getContext());
     383        orxout() << "big explosion: " << this->getVelocity() << endl;
     384        BigExplosion* chunk = new BigExplosion(this->getContext(), this->getVelocity());
    368385        chunk->setPosition(this->getPosition());
     386        // chunk->setVelocity(this->getVelocity());
    369387
    370388    }
     
    376394            effect->setPosition(this->getPosition());
    377395            effect->setOrientation(this->getOrientation());
     396            effect->setVelocity(this->getVelocity());
    378397            effect->setDestroyAfterLife(true);
    379398            effect->setSource("Orxonox/explosion2b");
     
    384403            effect->setPosition(this->getPosition());
    385404            effect->setOrientation(this->getOrientation());
     405            effect->setVelocity(this->getVelocity());
    386406            effect->setDestroyAfterLife(true);
    387407            effect->setSource("Orxonox/smoke6");
     
    392412            effect->setPosition(this->getPosition());
    393413            effect->setOrientation(this->getOrientation());
     414            effect->setVelocity(this->getVelocity());
    394415            effect->setDestroyAfterLife(true);
    395416            effect->setSource("Orxonox/sparks");
     
    527548
    528549
     550    void Pawn::setExplosionSound(const std::string &explosionSound)
     551    {
     552        if(explosionSound_ )
     553            explosionSound_->setSource(explosionSound);
     554        else
     555            assert(0); // This should never happen, because soundpointer is only available on master
     556    }
     557
     558    const std::string& Pawn::getExplosionSound()
     559    {
     560        if( explosionSound_ )
     561            return explosionSound_->getSource();
     562        else
     563            assert(0);
     564        return BLANKSTRING;
     565    }
     566
    529567
    530568}
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r9667 r9939  
    3636#include "interfaces/RadarViewable.h"
    3737#include "worldentities/ControllableEntity.h"
     38
    3839
    3940namespace orxonox // tolua_export
     
    178179            virtual void changedVisibility();
    179180
     181            void setExplosionSound(const std::string& engineSound);
     182            const std::string& getExplosionSound();
     183
    180184        protected:
    181185            virtual void preDestroy();
     
    231235
    232236            Vector3 aimPosition_;
     237
     238            WorldSound* explosionSound_;
     239
    233240    }; // tolua_export
    234241} // tolua_export
Note: See TracChangeset for help on using the changeset viewer.