Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9526 for code/trunk


Ignore:
Timestamp:
Feb 19, 2013, 10:25:42 AM (12 years ago)
Author:
jo
Message:

Merging presentationHS12 back to the trunk.

Location:
code/trunk
Files:
27 edited
16 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/defaultConfig/keybindings.ini

    r9016 r9526  
    5555KeyLeftBracket=
    5656KeyLeftControl=mouseLook
    57 KeyLeftShift=
     57KeyLeftShif
    5858KeyLeftWindows=
    5959KeyLessThan=
     
    141141KeyWebSearch=
    142142KeyWebStop=
    143 KeyX=
     143KeyX="selectClosest"
    144144KeyY=
    145145KeyYen=
    146 KeyZ=
     146KeyZ="selectNext"
    147147
    148148[MouseButtons]
  • code/trunk/data/levels/gallery.oxw

    r9350 r9526  
    6868      <Model position="0,20,-40" yaw="90" pitch="-90" roll="0" scale="2" mesh="LightningGun.mesh" />
    6969      <Model position="0,40,-40" yaw="90" pitch="-90" roll="0" scale="2" mesh="LightningGun-s.mesh" />
    70       <Model position="0,60,-40" yaw="90" pitch="-90" roll="0" scale="1.5" mesh="laserbeam.mesh" />
     70      <Model position="0,60,-40" yaw="90" pitch="-90" roll="0" scale="1.5" mesh="LaserBeam.mesh" />
    7171      <Model position="0,80,-40" yaw="90" pitch="-90" roll="0" scale="2" mesh="rocket.mesh" />
    7272      <Model position="0,-20,-40" yaw="90" pitch="-90" roll="0" scale="5" mesh="hs-w01.mesh" />
  • code/trunk/data/levels/includes/weaponSettingsEscort.oxi

    r9416 r9526  
    1414        </links>
    1515        <Weapon>
    16           <attached>
    17             <!--Model mesh="LightningGun.mesh" pitch="100" roll="90" yaw="90" position="0,0,0" />
    18             <Model mesh="LightningGun-s.mesh" pitch="78" roll="90" yaw="90" position="0.2,-1.3,0" />
    19             <Model mesh="hs-w01_reduced.mesh" roll="90" pitch="-76" yaw="-90" position="-1.5,1,0.3" scale=0.6 /-->
    20           </attached>
    21           <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
    22           <HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
    23           <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20 />
     16          <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="LaserBeam.mesh" />
     17          <!--HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" projectileMesh="LaserBeam.mesh" /-->
    2418        </Weapon>
    2519        <Weapon>
    26           <attached>
    27             <!--Model mesh="LightningGun.mesh" pitch="103" roll="90" yaw="90" position="0,0,0" />
    28             <Model mesh="LightningGun-s.mesh" pitch="103" roll="90" yaw="90" position="0.2,-1.35,0" />
    29             <Model mesh="hs-w01_reduced.mesh" roll="90" pitch="-104" yaw="-90" position="0,1.3,0.3" scale=0.6 /-->
    30           </attached>
    31           <HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" />
    32           <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" />
    33           <LightningGun mode=1 muzzleoffset="0,0,0" damage=23 />
     20          <HsW01 mode=0 munitionpershot=0 delay=0     damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam.mesh" />
     21          <!--HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" projectileMesh="LaserBeam.mesh" /-->
    3422        </Weapon>
    3523      </WeaponPack>
  • code/trunk/data/levels/pong.oxw

    r9348 r9526  
    9393<!-- TODO: Create a Pong Score Sound and include it here.
    9494This WorldSound works, but doesn't make sense, since it is played together with ambient/moodDependedDirectory/Ganymede.ogg -->
    95             <!--WorldSound name="scoreSound" position="0,0,0" source="ambient/default/Earth.ogg" >
     95            <!--WorldSound name="scoreSound" position="0,0,0" source="sounds/PongScore_cut.ogg" >
    9696              <events>
    9797                <play>
  • code/trunk/data/levels/templates/lodInformation.oxt

    r8706 r9526  
    1515      <MeshLodInformation mesh=CuboidLandingZone.mesh enabled=false/>
    1616      <MeshLodInformation mesh=HydroHarvester.mesh enabled=false />
     17      <MeshLodInformation mesh=turretHead.mesh enabled=false />
     18      <MeshLodInformation mesh=LaserBeam.mesh enabled=false/>
    1719
    1820      <!-- disable LOD for some debris meshes which caused a crash (fixed in Ogre 1.7.3) -->
  • code/trunk/data/levels/templates/spaceshipEscort.oxt

    r9416 r9526  
    22  <SpaceShip
    33   hudtemplate            = spaceshiphud
    4    camerapositiontemplate = spaceshipassffcameras
     4   camerapositiontemplate = spaceshipescortcameras
    55   spawnparticlesource    = "Orxonox/fairytwirl"
    66   spawnparticleduration  = 3
     
    3939  >
    4040    <engines>
    41       <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
    42       <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
     41      <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipescortengine />
     42      <MultiStateEngine position="-7.6, 0, 0" template=spaceshipescortengine />
    4343    </engines>
    4444    <attached>
     
    6262</Template>
    6363
    64 <Template name=spaceshipassffcameras defaults=0>
     64<Template name=spaceshipescortcameras defaults=0>
    6565  <SpaceShip>
    6666    <camerapositions>
    67       <CameraPosition position="0,13, 40" drag=true mouselook=true />
    68       <CameraPosition position="0,20, 80" drag=true mouselook=true />
     67      <CameraPosition position="0,15, 60" drag=true mouselook=true />
     68      <CameraPosition position="0,20, 90" drag=true mouselook=true />
    6969      <CameraPosition position="0,30,120" drag=true mouselook=true />
    7070    </camerapositions>
     
    7272</Template>
    7373
    74 <Template name=spaceshipassffengine baseclass=MultiStateEngine>
     74<Template name=spaceshipescortengine baseclass=MultiStateEngine>
    7575  <MultiStateEngine
    7676   boostfactor    = 2.2
  • code/trunk/data/overlays/HUD.oxo

    r7679 r9526  
    5252   value      = 0
    5353  >
    54     <BarColour position = 0.7 colour = "0.2,0.7,0.2" />
     54    <BarColounar position = 0.7 colour = "0.2,0.7,0.2" />
    5555    <BarColour position = 0.4 colour = "0.7,0.5,0.2" />
    5656    <BarColour position = 0.1 colour = "0.7,0.2,0.2" />
     
    6363   textSize      = 0.05
    6464   navMarkerSize = 0.03
    65    aimMarkerSize = 0.04
     65   aimMarkerSize = 0.02
    6666  />
    6767
  • code/trunk/data/overlays/HUDTemplates3.oxo

    r9016 r9526  
    105105     textsize      = 0.05
    106106     navMarkerSize = 0.03
    107      aimMarkerSize = 0.04
     107     aimMarkerSize = 0.02
    108108    />
    109109
  • code/trunk/src/modules/gametypes/CMakeLists.txt

    r9016 r9526  
    55  OldSpaceRace.cc
    66  OldRaceCheckPoint.cc
     7  SpaceRaceBot.cc
     8  SpaceRaceController.cc
    79)
    810
  • code/trunk/src/modules/gametypes/GametypesPrereqs.h

    r9016 r9526  
    6767    class SpaceRace;
    6868    class OldSpaceRace;
     69    class SpaceRaceManager;
     70    class SpaceRaceBot;
     71    class SpaceRaceController;
    6972}
    7073
  • code/trunk/src/modules/gametypes/RaceCheckPoint.cc

    r9348 r9526  
    4343    CreateFactory(RaceCheckPoint);
    4444
    45     RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceMultiTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
     45    RaceCheckPoint::RaceCheckPoint(BaseObject* creator) : DistanceMultiTrigger(creator),
     46            RadarViewable(creator, static_cast<WorldEntity*> (this))
    4647    {
    4748        RegisterObject(RaceCheckPoint);
    48 
    4949        this->setDistance(100);
    5050        this->setBeaconMode("off");
     
    6060        this->bIsLast_ = false;
    6161        this->timeLimit_ = 0;
    62         this->player_ = NULL;
    63     }
    64 
    65 
    66    RaceCheckPoint::~RaceCheckPoint()
    67    {
    68    }
     62        //this->players_ = vector<PlayerInfo*>();
     63
     64        myPosition_= this->getPosition(); //eingefuegt
     65        //orxout(user_status) << "test" << std::endl;
     66    }
     67
     68    RaceCheckPoint::~RaceCheckPoint()
     69    {
     70
     71    }
    6972
    7073    void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    8689            ControllableEntity* entity = orxonox_cast<ControllableEntity*>(originator);
    8790            if (entity)
    88                 this->player_ = entity->getPlayer();
     91                this->players_.push_back(entity->getPlayer());
    8992        }
    9093    }
     
    9598        if (this->timeLimit_ != 0)
    9699        {
    97             std::string message =  "You have " + multi_cast<std::string>(this->timeLimit_)
    98                         + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1);
     100            std::string message = "You have " + multi_cast<std::string>(this->timeLimit_)
     101            + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1);
    99102            this->getGametype()->getGametypeInfo()->sendAnnounceMessage(message);
    100103            ChatManager::message(message);
     
    102105    }
    103106
     107    //Must not be called before setNextCheckpointsAsVector3 at least once has been called
     108    void RaceCheckPoint::setNextVirtualCheckpointsAsVector3(const Vector3& checkpoints){
     109        /*std::set<int> lastcheckpoints=this->nextCheckpoints_;
     110        nextCheckpoints_.clear();
     111        std::set<int>::iterator it = lastcheckpoints.begin();
     112        if(checkpoints.x<-1){
     113            virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.x,(*it)));
     114            it++;
     115        }
     116        if(checkpoints.x!=-1)
     117            this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); // the red number has the type double and for the cast (to int) is added 0.5 so that the cast works correctly
     118
     119        if(checkpoints.y<-1){
     120                    virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.y,(*it)));
     121                    it++;
     122        }
     123        if(checkpoints.y!=-1)
     124            this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
     125
     126        if(checkpoints.z<-1){
     127                    virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.z,(*it)));
     128                    it++;
     129        }
     130        if(checkpoints.z!=-1)
     131            this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));*/
     132        nextCheckpointsVirtual_.clear();
     133        if(checkpoints.x!=-1)
     134            nextCheckpointsVirtual_.insert(checkpoints.x);
     135        if(checkpoints.y!=-1)
     136                nextCheckpointsVirtual_.insert(checkpoints.y);
     137        if(checkpoints.z!=-1)
     138                nextCheckpointsVirtual_.insert(checkpoints.z);
     139    }
     140
    104141    void RaceCheckPoint::setNextCheckpointsAsVector3(const Vector3& checkpoints)
    105142    {
     
    107144
    108145        if (checkpoints.x > -1)
    109             this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5));
     146        this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); // the red number has the type double and for the cast (to int) is added 0.5 so that the cast works correctly
    110147        if (checkpoints.y > -1)
    111             this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
     148        this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
    112149        if (checkpoints.z > -1)
    113             this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));
    114     }
    115 
    116     Vector3 RaceCheckPoint::getNextCheckpointsAsVector3() const
     150        this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));
     151
     152        this->nextCheckpointsVirtual_=nextCheckpoints_;
     153    }
     154
     155    PlayerInfo* RaceCheckPoint::getPlayer(unsigned int clientID) const
     156    {
     157        if (players_.size() > 0)
     158        {
     159            for (int i = 0; i < players_.size(); i++)
     160            {
     161                if (this->players_[i]->getClientID() == clientID)
     162                {
     163                    return players_[i];
     164                }
     165            }
     166        }
     167        return NULL;
     168    }
     169
     170    bool RaceCheckPoint::playerWasHere(PlayerInfo* player) const
     171    {
     172        if (players_.size() > 0)
     173        {
     174            for (int i = 0; i < players_.size(); i++)
     175            {
     176                if (this->players_[i] == player)
     177                {
     178                    return true;
     179                }
     180            }
     181        }
     182        return false;
     183    }
     184
     185    Vector3 RaceCheckPoint::getNextCheckpointsAsVector3()
     186    {
     187        Vector3 checkpoints(-1,-1,-1); int count=0;
     188        for (std::set<int>::iterator it= nextCheckpoints_.begin();it!=nextCheckpoints_.end(); it++ ){
     189            switch (count)
     190                        {
     191                            case 0: checkpoints.x = static_cast<Ogre::Real>(*it); break;
     192                            case 1: checkpoints.y = static_cast<Ogre::Real>(*it); break;
     193                            case 2: checkpoints.z = static_cast<Ogre::Real>(*it); break;
     194                        }
     195                        ++count;
     196        }
     197        return checkpoints;
     198        //= getVirtualNextCheckpointsAsVector3();
     199        int j[3];
     200        j[0]=changeVirtualToRealCheckPoint(checkpoints.x);
     201        j[1]=changeVirtualToRealCheckPoint(checkpoints.y);
     202        j[2]=changeVirtualToRealCheckPoint(checkpoints.z);
     203
     204
     205        return Vector3(j[0],j[1],j[2]);
     206
     207
     208    }
     209
     210    int RaceCheckPoint::changeVirtualToRealCheckPoint(int checkpointID) {
     211        int temp=checkpointID;
     212        while(temp<-1){
     213            temp = this->virtualToRealCheckPoints_[temp];
     214        }
     215        return temp;
     216    }
     217
     218
     219    Vector3 RaceCheckPoint::getVirtualNextCheckpointsAsVector3() const
    117220    {
    118221        Vector3 checkpoints = Vector3(-1, -1, -1);
    119222
    120223        size_t count = 0;
    121         for (std::set<int>::iterator it = this->nextCheckpoints_.begin(); it != this->nextCheckpoints_.end(); ++it)
     224        for (std::set<int>::iterator it = this->nextCheckpointsVirtual_.begin(); it != this->nextCheckpointsVirtual_.end(); ++it)
    122225        {
    123226            switch (count)
  • code/trunk/src/modules/gametypes/RaceCheckPoint.h

    r9263 r9526  
    3737{
    3838    /**
    39     @brief
    40         The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
    41         Don't forget to control the indexes of your check points and to set one last check point
    42     */
    43     class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable
     39     @brief
     40     The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
     41     Don't forget to control the indexes of your check points and to set one last check point
     42     */
     43    class _GametypesExport RaceCheckPoint: public DistanceMultiTrigger,
     44            public RadarViewable
    4445    {
    4546        public:
     
    5051
    5152            inline void setCheckpointIndex(int checkpointIndex)
    52                 { this->checkpointIndex_ = checkpointIndex; }
     53            {
     54                this->checkpointIndex_ = checkpointIndex;
     55            }
    5356            inline int getCheckpointIndex() const
    54                 { return this->checkpointIndex_; }
     57            {
     58                return this->checkpointIndex_;
     59            }
    5560
    5661            void setNextCheckpointsAsVector3(const Vector3& checkpoints);
    57             Vector3 getNextCheckpointsAsVector3() const;
    58             const std::set<int>& getNextCheckpoints() const
    59                 { return this->nextCheckpoints_; }
     62            Vector3 getNextCheckpointsAsVector3();
     63            Vector3 getVirtualNextCheckpointsAsVector3() const;
     64            void setNextVirtualCheckpointsAsVector3(const Vector3& checkpoints);
     65            int changeVirtualToRealCheckPoint(int);
    6066
     67            const std::set<int>& getVirtualNextCheckpoints() const
     68            {
     69                return this->nextCheckpointsVirtual_;
     70            }
     71
     72            const std::set<int>& getNextCheckpoints()
     73            {
     74                return nextCheckpoints_;
     75                std::set<int> temp;
     76                std::set<int> temp2=getVirtualNextCheckpoints();
     77                for (std::set<int>::iterator it = temp2.begin(); it!=temp2.end(); ++it){
     78                    temp.insert(changeVirtualToRealCheckPoint((*it)));
     79                }
     80                return temp;
     81            }
    6182            inline void setLast(bool isLast)
    62                 { this->bIsLast_ = isLast; }
     83            {
     84                this->bIsLast_ = isLast;
     85            }
    6386            inline bool isLast() const
    64                 { return this->bIsLast_; }
     87            {
     88                return this->bIsLast_;
     89            }
    6590
    6691            virtual void setTimelimit(float timeLimit);
    6792            inline float getTimeLimit() const
    68                 { return this->timeLimit_; }
     93            {
     94                return this->timeLimit_;
     95            }
    6996
    70             inline PlayerInfo* getPlayer() const
    71                 { return this->player_; }
     97            PlayerInfo* getPlayer(unsigned int clientID) const;
     98
     99            bool playerWasHere(PlayerInfo* ) const;
     100
    72101            inline void resetPlayer()
    73                 { this->player_ = NULL; }
     102            {
     103                this->players_.clear();
     104            }
    74105
    75106        protected:
     107
    76108            virtual void fire(bool bIsTriggered, BaseObject* originator);
    77109
    78110            inline const WorldEntity* getWorldEntity() const
    79                 { return this; }
     111            {
     112                return this;
     113            }
    80114
    81115        private:
    82             int checkpointIndex_;           ///< The index of this check point. The race starts with the check point with the index 0
     116
     117            int checkpointIndex_; ///< The index of this check point. The race starts with the check point with the index 0
    83118            std::set<int> nextCheckpoints_; ///< the indexes of the next check points
    84             bool bIsLast_;                  ///< True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
    85             float timeLimit_;               ///< The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
    86             PlayerInfo* player_;            ///< The player that reached the checkpoint
     119            bool bIsLast_; ///< True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
     120            float timeLimit_; ///< The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
     121            std::vector<PlayerInfo*> players_; ///< The player that reached the checkpoint
     122            Vector3 myPosition_;
     123            std::set<int>  nextCheckpointsVirtual_;
     124            std::map<int,int> virtualToRealCheckPoints_; // if virtualChepoint was inserted the original can be reconstructed
    87125    };
    88126}
  • code/trunk/src/modules/gametypes/SpaceRace.cc

    r9348 r9526  
    3535#include "util/Convert.h"
    3636#include "util/Math.h"
    37 
     37#include "SpaceRaceBot.h"
    3838#include "items/Engine.h"
    3939
     
    4646        RegisterObject(SpaceRace);
    4747
     48        this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
    4849        this->cantMove_ = false;
    4950        this->bTimeIsUp_ = false;
  • code/trunk/src/modules/gametypes/SpaceRaceManager.cc

    r9348 r9526  
    3838#include "util/Math.h"
    3939
    40 
    41 
    4240namespace orxonox
    4341{
    4442    CreateFactory(SpaceRaceManager);
    4543
    46     SpaceRaceManager::SpaceRaceManager(BaseObject* creator) : BaseObject(creator)
     44    SpaceRaceManager::SpaceRaceManager(BaseObject* creator) :
     45        BaseObject(creator)
    4746    {
    4847        RegisterObject(SpaceRaceManager);
    49 
     48        this->race_ = orxonox_cast<SpaceRace*>(this->getGametype().get());
     49        assert(race_);
     50        //amountOfPlayers=(race_->getPlayers()).size();
    5051        this->firstcheckpointvisible_ = false;
    5152    }
     
    5455    {
    5556        for (size_t i = 0; i < this->checkpoints_.size(); ++i)
    56             this->checkpoints_[i]->destroy();
     57        this->checkpoints_[i]->destroy();
    5758    }
    5859
     
    6162        SUPER(SpaceRaceManager, XMLPort, xmlelement, mode);
    6263
    63         XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint,  xmlelement, mode);
     64        XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint, xmlelement, mode);
    6465    }
    6566
     
    6768    {
    6869        SUPER(SpaceRaceManager,tick,dt);
     70
     71        this->players_ = this->race_->getPlayers();
    6972
    7073        if (this->checkpoints_[0] != NULL && !this->firstcheckpointvisible_)
     
    7477        }
    7578
    76         for (size_t i = 0; i < this->checkpoints_.size(); ++i)
     79        for ( std::map< PlayerInfo*, Player>::iterator it = players_.begin(); it != players_.end(); ++it)
    7780        {
    78             if (this->checkpoints_[i]->getPlayer() != NULL)
    79                 this->checkpointReached(this->checkpoints_[i], this->checkpoints_[i]->getPlayer());
     81
     82            for (size_t i = 0; i < this->checkpoints_.size(); ++i)
     83            {
     84                if (this->checkpoints_[i]->playerWasHere(it->first)){
     85                this->checkpointReached(this->checkpoints_[i], it->first /*this->checkpoints_[i]->getPlayer()*/);
     86                }
     87            }
    8088        }
     89
    8190    }
    8291
     
    8998    {
    9099        if (index < this->checkpoints_.size())
    91             return this->checkpoints_[index];
     100        return this->checkpoints_[index];
    92101        else
    93             return 0;
     102        return 0;
     103    }
     104
     105    std::vector<RaceCheckPoint*> SpaceRaceManager::getAllCheckpoints()
     106    {
     107        return checkpoints_;
    94108    }
    95109
    96110    /**
    97         @brief Returns the checkpoint with the given checkpoint-index (@see RaceCheckPoint::getCheckpointIndex).
    98     */
     111     @brief Returns the checkpoint with the given checkpoint-index (@see RaceCheckPoint::getCheckpointIndex).
     112     */
    99113    RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const
    100114    {
    101115        for (size_t i = 0; i < this->checkpoints_.size(); ++i)
    102             if (this->checkpoints_[i]->getCheckpointIndex() == index)
    103                 return this->checkpoints_[i];
     116        if (this->checkpoints_[i]->getCheckpointIndex() == index)
     117        return this->checkpoints_[i];
    104118        return 0;
    105119    }
     
    107121    bool SpaceRaceManager::reachedValidCheckpoint(RaceCheckPoint* oldCheckpoint, RaceCheckPoint* newCheckpoint, PlayerInfo* player) const
    108122    {
    109         if (oldCheckpoint)
     123        if (oldCheckpoint != NULL)
    110124        {
    111125            // the player already visited an old checkpoint; see which checkpoints are possible now
    112126            const std::set<int>& possibleCheckpoints = oldCheckpoint->getNextCheckpoints();
    113127            for (std::set<int>::const_iterator it = possibleCheckpoints.begin(); it != possibleCheckpoints.end(); ++it)
    114                 if (this->findCheckpoint(*it) == newCheckpoint)
    115                     return true;
     128            if (this->findCheckpoint(*it) == newCheckpoint)
     129            return true;
    116130            return false;
    117131        }
     
    128142        assert(gametype);
    129143        if (!gametype)
    130             return;
     144        return;
    131145
    132         RaceCheckPoint* oldCheckpoint = gametype->getCheckpointReached(player);
     146        RaceCheckPoint* oldCheckpoint = gametype->getCheckpointReached(player); // returns the last from player reached checkpoint
    133147
    134148        if (this->reachedValidCheckpoint(oldCheckpoint, newCheckpoint, player))
     
    152166                // adjust the radarvisibility
    153167                gametype->newCheckpointReached(newCheckpoint, player);
    154                 this->updateRadarVisibility(oldCheckpoint, newCheckpoint);
     168                if(player->isHumanPlayer())
     169                    this->updateRadarVisibility(oldCheckpoint, newCheckpoint);
    155170            }
    156171        }
    157172
    158         newCheckpoint->resetPlayer();
     173        // newCheckpoint->resetPlayer(); loescht playerpointer TODO: check if problems occur
    159174    }
    160175
     
    165180            const std::set<int>& oldVisible = oldCheckpoint->getNextCheckpoints();
    166181            for (std::set<int>::const_iterator it = oldVisible.begin(); it != oldVisible.end(); ++it)
    167                 this->findCheckpoint(*it)->setRadarVisibility(false);
     182            this->findCheckpoint(*it)->setRadarVisibility(false);
    168183        }
    169184
     
    174189            const std::set<int>& newVisible = newCheckpoint->getNextCheckpoints();
    175190            for (std::set<int>::const_iterator it = newVisible.begin(); it != newVisible.end(); ++it)
    176                 this->findCheckpoint(*it)->setRadarVisibility(true);
     191            this->findCheckpoint(*it)->setRadarVisibility(true);
    177192        }
    178193    }
  • code/trunk/src/modules/gametypes/SpaceRaceManager.h

    r9348 r9526  
    6767            void checkpointReached(RaceCheckPoint* newCheckpoint, PlayerInfo* player);
    6868
     69            std::vector<RaceCheckPoint*> getAllCheckpoints();
     70
    6971            void tick(float dt);
    7072
     
    7678            std::vector<RaceCheckPoint*> checkpoints_;
    7779            bool firstcheckpointvisible_; ///< true if the first check point is visible.
     80            SpaceRace* race_; // needed to get the players
     81            //int amountOfPlayers;
     82            std::map<PlayerInfo*, Player> players_;
    7883    };
    7984}
  • code/trunk/src/modules/objects/CMakeLists.txt

    r8706 r9526  
    55  Script.cc
    66  SpaceBoundaries.cc
     7  Turret.cc
    78)
    89
  • code/trunk/src/modules/objects/ObjectsPrereqs.h

    r8706 r9526  
    7373    class Script;
    7474    class SpaceBoundaries;
     75    class Turret;
    7576
    7677    // collisionshapes
  • code/trunk/src/modules/overlays/OverlaysPrereqs.h

    r9348 r9526  
    9191    class HUDBoostBar;
    9292    class HUDTimer;
     93    class HUDAimAssistant;
    9394    class KillMessage;
    9495    class LastManStandingInfos;
  • code/trunk/src/modules/overlays/hud/HUDNavigation.cc

    r9348 r9526  
    3737#include <OgrePanelOverlayElement.h>
    3838
     39#include <typeinfo>
     40
    3941#include "util/Math.h"
    4042#include "util/Convert.h"
     43#include "core/command/ConsoleCommand.h"
    4144#include "core/CoreIncludes.h"
    4245#include "core/XMLPort.h"
     
    5558namespace orxonox
    5659{
    57     bool compareDistance(std::pair<RadarViewable*, unsigned int> a, std::pair<RadarViewable*, unsigned int> b)
     60
     61    SetConsoleCommand("HUDNavigation","selectClosest", &HUDNavigation::selectClosestTarget).addShortcut().keybindMode(KeybindMode::OnPress);
     62    SetConsoleCommand("HUDNavigation","selectNext", &HUDNavigation::selectNextTarget).addShortcut().keybindMode(KeybindMode::OnPress);
     63
     64    static bool compareDistance(std::pair<RadarViewable*, unsigned int> a,
     65            std::pair<RadarViewable*, unsigned int> b)
    5866    {
    5967        return a.second < b.second;
    6068    }
    61 
    6269    CreateFactory ( HUDNavigation );
    6370
    64     HUDNavigation::HUDNavigation(BaseObject* creator) : OrxonoxOverlay(creator)
    65     {
    66         RegisterObject(HUDNavigation);
    67         this->setConfigValues();
     71    HUDNavigation* HUDNavigation::localHUD_s = 0;
     72
     73    HUDNavigation::HUDNavigation(BaseObject* creator) :
     74        OrxonoxOverlay(creator)
     75    {
     76        RegisterObject(HUDNavigation)
     77;        this->setConfigValues();
    6878
    6979        // Set default values
    7080        this->setFont("Monofur");
    7181        this->setTextSize(0.05f);
    72         this->setNavMarkerSize(0.05f);
     82        this->setNavMarkerSize(0.03f);
     83        this->setAimMarkerSize(0.02f);
     84
    7385        this->setDetectionLimit(10000.0f);
     86        this->currentMunitionSpeed_ = 2500.0f;
     87
     88        this->closestTarget_ = true;
     89        this->nextTarget_ = false;
     90        HUDNavigation::localHUD_s = this;
    7491    }
    7592
     
    7996        {
    8097            for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end();)
    81                 removeObject((it++)->first);
     98            removeObject((it++)->first);
    8299        }
    83100        this->sortedObjectList_.clear();
     
    94111        SUPER(HUDNavigation, XMLPort, xmlelement, mode);
    95112
    96         XMLPortParam(HUDNavigation, "font",           setFont,           getFont,          xmlelement, mode);
    97         XMLPortParam(HUDNavigation, "textSize",       setTextSize,       getTextSize,      xmlelement, mode);
    98         XMLPortParam(HUDNavigation, "navMarkerSize",  setNavMarkerSize,  getNavMarkerSize, xmlelement, mode);
     113        XMLPortParam(HUDNavigation, "font", setFont, getFont, xmlelement, mode);
     114        XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode);
     115        XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode);
    99116        XMLPortParam(HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
     117        XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlelement, mode);
    100118    }
    101119
     
    112130        {
    113131            if (it->second.text_ != NULL)
    114                 it->second.text_->setFontName(this->fontName_);
     132            it->second.text_->setFontName(this->fontName_);
    115133        }
    116134    }
     
    132150        {
    133151            if (it->second.text_)
    134                 it->second.text_->setCharHeight(size);
     152            it->second.text_->setCharHeight(size);
    135153        }
    136154    }
     
    144162    {
    145163        if (dist < 600)
    146             dist = 600;
     164        dist = 600;
    147165        return this->getActualSize().x * 900 * this->navMarkerSize_ / dist;
    148166    }
     
    151169    {
    152170        if (dist < 600)
    153             dist = 600;
     171        dist = 600;
    154172        return this->getActualSize().y * 900 * this->navMarkerSize_ / dist;
    155173    }
     
    161179        Camera* cam = CameraManager::getInstance().getActiveCamera();
    162180        if (cam == NULL)
    163             return;
     181        return;
    164182        const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
    165183
    166 
    167184        for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt)
    168             listIt->second = (int)((listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);
     185        listIt->second = (int)((listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);
    169186
    170187        this->sortedObjectList_.sort(compareDistance);
     
    172189        unsigned int markerCount = 0;
    173190        bool closeEnough = false; // only display objects that are close enough to be relevant for the player
     191
     192        // if the selected object doesn't exist any more or is now out of range select the closest object
     193        std::map<RadarViewable*, ObjectInfo>::iterator selectedActiveObject = this->activeObjectList_.find(this->selectedTarget_);
     194        if(selectedActiveObject == this->activeObjectList_.end())
     195        {
     196            this->closestTarget_ = true;
     197        }
     198        else if(this->detectionLimit_ < (this->selectedTarget_->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f)
     199        {
     200            this->closestTarget_ = true;
     201            selectedActiveObject->second.selected_ = false;
     202        }
     203
     204        bool nextHasToBeSelected = false;
    174205
    175206        for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt)
     
    178209            closeEnough = listIt->second < this->detectionLimit_;
    179210            // display radarviewables on HUD if the marker limit and max-distance is not exceeded
    180             if (markerCount < this->markerLimit_ && (closeEnough ||  this->detectionLimit_ < 0))
     211            if (markerCount < this->markerLimit_ && (closeEnough || this->detectionLimit_ < 0))
    181212            {
    182213                // Get Distance to HumanController and save it in the TextAreaOverlayElement.
     
    196227                    textLength = it->first->getRadarName().size() * it->second.text_->getCharHeight() * 0.3f;
    197228                }
     229
     230                // select the object that aim-assistant indicates
     231                if(this->closestTarget_)
     232                // select the closest object
     233                {
     234                    if(listIt == this->sortedObjectList_.begin())
     235                    {
     236                        it->second.selected_ = true;
     237                        this->selectedTarget_ = it->first;
     238                    }
     239                    else if(it->second.selected_)
     240                    {
     241                        it->second.selected_ = false;
     242                    }
     243
     244                }
     245                else if(this->nextTarget_)
     246                // select the next object in sortedObjectList
     247                {
     248                    if(nextHasToBeSelected){
     249                        it->second.selected_ = true;
     250                        this->selectedTarget_ = it->first;
     251                        nextHasToBeSelected = false;
     252                    }
     253                    else if(it->second.selected_)
     254                    {
     255                        nextHasToBeSelected = true;
     256                        it->second.selected_ = false;
     257
     258                        // check if there's a next object
     259                        listIt++;
     260                        if(listIt != this->sortedObjectList_.end())
     261                        {
     262                            // and if the marker limit and max-distance are not exceeded for it
     263                            if (markerCount + 1 >= this->markerLimit_ ||
     264                                    (listIt->second > this->detectionLimit_ && detectionLimit_ >= 0))
     265                            {
     266                                // otherwise select the closest object
     267                                this->activeObjectList_.find(this->sortedObjectList_.begin()->first)->second.selected_ = true;
     268                                this->selectedTarget_ = it->first;
     269                                nextHasToBeSelected = false;
     270                            }
     271                        }
     272                        listIt--;
     273                    }
     274                }
     275
    198276
    199277                // Transform to screen coordinates
     
    222300                        it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("arrows.png", it->first->getRadarObjectColour()));
    223301                        it->second.wasOutOfView_ = true;
     302                        it->second.target_->hide();
    224303                    }
    225304
     
    284363                        it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("tdc.png", it->first->getRadarObjectColour()));
    285364                        it->second.panel_->setDimensions(this->navMarkerSize_ * this->getActualSize().x, this->navMarkerSize_ * this->getActualSize().y);
     365                        it->second.target_->setDimensions(this->aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y);
    286366                        it->second.wasOutOfView_ = false;
    287367                    }
     
    295375                    it->second.text_->setLeft((pos.x + 1.0f + it->second.panel_->getWidth()) * 0.5f);
    296376                    it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);
    297                 }
    298 
    299                 // Make sure the overlays are shown
    300                 it->second.panel_->show();
    301                 it->second.text_->show();
     377
     378                    // Make sure the overlays are shown
     379                    it->second.panel_->show();
     380                    it->second.text_->show();
     381
     382                    // Target marker
     383                    const Pawn* pawn = dynamic_cast<const Pawn*>(it->first->getWorldEntity());
     384                    /* Pawn* humanPawn = HumanController::getLocalControllerEntityAsPawn();*/
     385                    if(!it->second.selected_
     386                            || it->first->getRVVelocity().squaredLength() == 0
     387                            || pawn == NULL
     388                            /* TODO : improve getTeam in such a way that it works
     389                             * || humanPawn == NULL
     390                             * || pawn->getTeam() == humanPawn->getTeam()*/)
     391                    {
     392                        // don't show marker for not selected enemies nor if the selected doesn't move
     393                        it->second.target_->hide();
     394                    }
     395                    else // object is selected and moves
     396                    {
     397                        // get the aim position
     398                        Vector3* targetPos = this->toAimPosition(it->first);
     399                        // Transform to screen coordinates
     400                        Vector3 screenPos = camTransform * (*targetPos);
     401                        // Check if the target marker is in view too
     402                        if(screenPos.z > 1 || screenPos.x < -1.0 || screenPos.x > 1.0
     403                                || screenPos.y < -1.0 || screenPos.y > 1.0)
     404                        {
     405                            it->second.target_->hide();
     406                        }
     407                        else
     408                        {
     409                            it->second.target_->setLeft((screenPos.x + 1.0f - it->second.target_->getWidth()) * 0.5f);
     410                            it->second.target_->setTop((-screenPos.y + 1.0f - it->second.target_->getHeight()) * 0.5f);
     411                            it->second.target_->show();
     412                        }
     413                        delete targetPos;
     414                    }
     415
     416                }
    302417            }
    303418            else // do not display on HUD
     419
    304420            {
    305421                it->second.panel_->hide();
    306422                it->second.text_->hide();
     423                it->second.target_->hide();
    307424            }
    308425        }
     426
     427        this->closestTarget_ = false;
     428        this->nextTarget_ = false;
    309429    }
    310430
    311431    /** Overridden method of OrxonoxOverlay.
    312     @details
    313         Usually the entire overlay scales with scale().
    314         Here we obviously have to adjust this.
    315     */
     432     @details
     433     Usually the entire overlay scales with scale().
     434     Here we obviously have to adjust this.
     435     */
    316436    void HUDNavigation::sizeChanged()
    317437    {
     
    326446            if (it->second.text_ != NULL)
    327447                it->second.text_->setCharHeight(it->second.text_->getCharHeight() * yScale);
     448            if (it->second.target_ != NULL)
     449                it->second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);
    328450        }
    329451    }
     
    332454    {
    333455        if (showObject(object) == false)
    334             return;
     456        return;
    335457
    336458        if (this->activeObjectList_.size() >= this->markerLimit_)
    337             if (object == NULL)
    338                 return;
     459        if (object == NULL)
     460        return;
    339461
    340462        // Object hasn't been added yet (we know that)
     
    349471        // Create arrow/marker
    350472        Ogre::PanelOverlayElement* panel = static_cast<Ogre::PanelOverlayElement*>( Ogre::OverlayManager::getSingleton()
    351                                            .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberString()));
     473                .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberString()));
    352474        //panel->setMaterialName("Orxonox/NavTDC");
    353475        panel->setMaterialName(TextureGenerator::getMaterialName("tdc.png", object->getRadarObjectColour()));
     
    355477        //panel->setColour(object->getRadarObjectColour());
    356478
     479        // Create target marker
     480        Ogre::PanelOverlayElement* target = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
     481                    .createOverlayElement("Panel", "HUDNavigation_targetMarker_" + getUniqueNumberString()));
     482        target->setMaterialName(TextureGenerator::getMaterialName("target.png", object->getRadarObjectColour()));
     483        target->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);
     484
     485        // Create text
    357486        Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
    358                                              .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString()));
     487                .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString()));
    359488        text->setFontName(this->fontName_);
    360489        text->setCharHeight(text->getCharHeight() * yScale);
     
    362491
    363492        panel->hide();
     493        target->hide();
    364494        text->hide();
    365495
    366         ObjectInfo tempStruct = {panel, text, false /*, TODO: initialize wasOutOfView_ */};
     496        ObjectInfo tempStruct =
     497        {   panel, target, text, false, false, false};
    367498        this->activeObjectList_[object] = tempStruct;
    368499
    369500        this->background_->addChild(panel);
     501        this->background_->addChild(target);
    370502        this->background_->addChild(text);
    371503
     
    381513            // Detach overlays
    382514            this->background_->removeChild(it->second.panel_->getName());
     515            this->background_->removeChild(it->second.target_->getName());
    383516            this->background_->removeChild(it->second.text_->getName());
    384517            // Properly destroy the overlay elements (do not use delete!)
    385518            Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.panel_);
     519            Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.target_);
    386520            Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.text_);
    387521            // Remove from the list
     
    409543    {
    410544        if (rv == orxonox_cast<RadarViewable*>(this->getOwner()))
    411             return false;
     545        return false;
    412546        assert(rv->getWorldEntity());
    413547        if (rv->getWorldEntity()->isVisible() == false || rv->getRadarVisibility() == false)
    414             return false;
     548        return false;
    415549        return true;
    416550    }
     
    422556        {
    423557            if (!(*it)->isHumanShip_)
    424                 this->addObject(*it);
     558            this->addObject(*it);
     559        }
     560    }
     561
     562    Vector3* HUDNavigation::toAimPosition(RadarViewable* target) const
     563    {
     564        Vector3 wePosition = HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition();
     565        Vector3 targetPosition = target->getRVWorldPosition();
     566        Vector3 targetSpeed = target->getRVVelocity();
     567        Vector3 relativePosition = targetPosition - wePosition; //Vector from attacker to target
     568
     569        float p_half = relativePosition.dotProduct(targetSpeed)/(targetSpeed.squaredLength() - this->currentMunitionSpeed_ * this->currentMunitionSpeed_);
     570        float time1 = -p_half + sqrt(p_half * p_half - relativePosition.squaredLength()/(targetSpeed.squaredLength() - this->currentMunitionSpeed_ * this->currentMunitionSpeed_));
     571
     572        Vector3* result = new Vector3(targetPosition + targetSpeed * time1);
     573        return result;
     574    }
     575
     576    void HUDNavigation::selectClosestTarget()
     577    {
     578        if(HUDNavigation::localHUD_s)
     579        {
     580            HUDNavigation::localHUD_s->closestTarget_ = true;
     581        }
     582    }
     583
     584    void HUDNavigation::selectNextTarget()
     585    {
     586        if(HUDNavigation::localHUD_s)
     587        {
     588            HUDNavigation::localHUD_s->nextTarget_ = true;
    425589        }
    426590    }
  • code/trunk/src/modules/overlays/hud/HUDNavigation.h

    r9348 r9526  
    7171                { return this->markerLimit_; }
    7272
     73            static void selectClosestTarget();
     74            static void selectNextTarget();
     75
    7376        private:
    7477            struct ObjectInfo
    7578            {
    7679                Ogre::PanelOverlayElement* panel_;
     80                Ogre::PanelOverlayElement* target_;
    7781                Ogre::TextAreaOverlayElement* text_;
    7882                bool outOfView_;
    7983                bool wasOutOfView_;
     84                bool selected_;
    8085            };
    8186
     
    8590            inline void setNavMarkerSize(float size)
    8691            {
    87                 navMarkerSize_ = size;
     92                this->navMarkerSize_ = size;
    8893                this->sizeChanged();
    8994            }
    9095            inline float getNavMarkerSize() const
    9196                { return navMarkerSize_; }
     97            inline void setAimMarkerSize(float size)
     98            {
     99                this->aimMarkerSize_ = size;
     100                this->sizeChanged();
     101            }
     102            inline float getAimMarkerSize() const
     103                { return aimMarkerSize_; }
    92104            inline void setDetectionLimit(float limit)
    93105                { this->detectionLimit_ = limit; }
     
    104116            float getArrowSizeY(int dist) const;
    105117
     118            Vector3* toAimPosition(RadarViewable* target) const;
     119
    106120            std::map<RadarViewable*, ObjectInfo> activeObjectList_;
    107121            std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_;
    108122
    109123            float navMarkerSize_;
     124            float aimMarkerSize_;
    110125            std::string fontName_;
    111126            float textSize_;
    112127            bool showDistance_;
     128
     129            RadarViewable* selectedTarget_;
     130
     131            bool closestTarget_;
     132            bool nextTarget_;
     133
     134            static HUDNavigation* localHUD_s; //!< This is used as a filter. Only the local HUD should be influenced by the static Console Command functions.
     135
     136
     137            float currentMunitionSpeed_;
    113138
    114139            unsigned int markerLimit_;
  • code/trunk/src/modules/portals/PortalEndPoint.cc

    r8767 r9526  
    2828
    2929#include "PortalEndPoint.h"
     30#include "portals/PortalLink.h"
    3031
    3132#include <ctime>
     
    3536
    3637#include "worldentities/MobileEntity.h"
    37 
    3838#include "objects/triggers/MultiTriggerContainer.h"
    3939
    40 #include "portals/PortalLink.h"
     40#include "sound/WorldSound.h"
    4141
    4242namespace orxonox
     
    5959        this->setRadarObjectShape(RadarViewable::Dot);
    6060        this->setRadarVisibility(true);
     61        if( GameMode::isMaster() )
     62        {
     63            this->portalSound_ = new WorldSound(this);
     64            this->portalSound_->setLooping(false);
     65            this->attach(this->portalSound_);
     66            this->portalSound_->setSource("sounds/Weapon_HsW01.ogg"); //TODO: change sound file
     67        }
    6168    }
    6269
     
    158165        entity->rotate(this->getWorldOrientation());
    159166        entity->setVelocity(this->getWorldOrientation() * entity->getVelocity());
     167        //play Sound
     168        if( this->portalSound_ && !(this->portalSound_->isPlaying()))
     169        {
     170            this->portalSound_->play();
     171        }
    160172    }
    161173
  • code/trunk/src/modules/portals/PortalEndPoint.h

    r8767 r9526  
    115115            std::map<MobileEntity *, time_t> jumpOutTimes_;   //!< Stores the time at which a certain MobileEntity @ref jumpOut "jumped out" of this PortalEndPoint
    116116            std::set<MobileEntity *> recentlyJumpedOut_;   //!< Stores the entities witch recently jumped out of this PortalEndPoint and haven't left the activation radius yet. This is needed in order to prevent them from beeing pulled into the PortalEndPoint they have just come out of.
     117
     118            WorldSound* portalSound_;
    117119    };
    118120
  • code/trunk/src/modules/weapons/weaponmodes/HsW01.cc

    r8855 r9526  
    6161        this->delay_ = 0.0f;
    6262        this->setMunitionName("LaserMunition");
     63        this->mesh_ = "laserbeam.mesh";
     64        this->sound_ = "sounds/Weapon_HsW01.ogg";
     65
    6366
    6467        this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&HsW01::shot, this)));
    6568        this->delayTimer_.stopTimer();
    6669
    67         this->setDefaultSound("sounds/Weapon_HsW01.ogg");
     70        this->setDefaultSound(this->sound_);
    6871    }
    6972
     
    7881        XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode);
    7982        XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode);
     83        XMLPortParam(HsW01, "projectileMesh", setMesh, getMesh, xmlelement, mode);
     84        XMLPortParam(HsW01, "sound", setSound, getSound, xmlelement, mode);
    8085    }
    8186
     
    108113        Projectile* projectile = new Projectile(this);
    109114        Model* model = new Model(projectile);
    110         model->setMeshSource("laserbeam.mesh");
     115        model->setMeshSource(mesh_);
    111116        model->setCastShadows(false);
    112117        projectile->attach(model);
  • code/trunk/src/modules/weapons/weaponmodes/HsW01.h

    r8855 r9526  
    6161        private:
    6262            /**
     63            @brief Set the mesh.
     64            @param mesh The mesh name.
     65            */
     66            void setMesh(const std::string& mesh)
     67                { this->mesh_ = mesh; }
     68
     69            /**
     70            @brief Get the mesh.
     71            @return Returns the mesh name.
     72            */
     73            const std::string& getMesh() const
     74                { return this->mesh_; }
     75
     76            /**
     77            @brief Set the sound.
     78            @param mesh The Sound name.
     79            */
     80            void setSound(const std::string& sound)
     81                { this->sound_ = sound; }
     82
     83            /**
     84            @brief Get the sound.
     85            @return Returns the sound name.
     86            */
     87            const std::string& getSound() const
     88                { return this->sound_; }
     89
     90            /**
    6391            @brief Set the material.
    6492            @param material The material name.
     
    85113
    86114            std::string material_; //!< The material.
     115            std::string mesh_; //!< The mesh.
     116            std::string sound_; //!< The sound.
     117
     118
     119
    87120            float speed_; //!< The speed of the fired projectile.
    88121            float delay_; //!< The firing delay.
  • code/trunk/src/orxonox/interfaces/RadarViewable.cc

    r9257 r9526  
    102102    }
    103103
     104    Vector3 RadarViewable::getRVVelocity() const
     105    {
     106        const WorldEntity* object = this->getWorldEntity();
     107        validate(object);
     108        return object->getVelocity();
     109    }
     110
    104111    void RadarViewable::validate(const WorldEntity* object) const
    105112    {
  • code/trunk/src/orxonox/interfaces/RadarViewable.h

    r9348 r9526  
    113113        const Vector3& getRVWorldPosition() const;
    114114        Vector3 getRVOrientedVelocity() const;
     115        Vector3 getRVVelocity() const;
    115116
    116117        inline void setRadarObjectShape(Shape shape)
Note: See TracChangeset for help on using the changeset viewer.