Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 12:36:08 AM (15 years ago)
Author:
dafrick
Message:

Merging of the current QuestSystem branch.

Location:
code/branches/questsystem5
Files:
22 added
106 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

  • code/branches/questsystem5/src/orxonox/objects/CMakeLists.txt

    r2710 r2907  
    88  RadarListener.cc
    99  RadarViewable.cc
     10  Teamcolourable.cc
    1011  Tickable.cc
    1112  Test.cc
  • code/branches/questsystem5/src/orxonox/objects/EventTarget.cc

    r2662 r2907  
    6666    void EventTarget::addAsEvent(BaseObject* object)
    6767    {
    68         if (object != (BaseObject*)this)
     68        if (object != static_cast<BaseObject*>(this))
    6969            object->addEvent(this, "");
    7070    }
  • code/branches/questsystem5/src/orxonox/objects/Level.cc

    r2710 r2907  
    105105    {
    106106        Identifier* identifier = ClassByString(gametype);
    107         if (identifier && identifier->isA(Class(Gametype)))
     107
     108        if (!identifier || !identifier->isA(Class(Gametype)))
    108109        {
     110            COUT(0) << "Error: \"" << gametype << "\" is not a valid gametype." << std::endl;
     111            identifier = Class(Gametype);
     112            this->gametype_ = "Gametype";
     113        }
     114        else
    109115            this->gametype_ = gametype;
    110116
    111             Gametype* rootgametype = dynamic_cast<Gametype*>(identifier->fabricate(this));
    112             this->setGametype(rootgametype);
     117std::cout << "Load Gametype: " << this->gametype_ << std::endl;
    113118
    114             for (std::list<BaseObject*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
    115                 (*it)->setGametype(rootgametype);
     119        Gametype* rootgametype = dynamic_cast<Gametype*>(identifier->fabricate(this));
     120        this->setGametype(rootgametype);
    116121
    117             if (LevelManager::getInstancePtr())
    118                 LevelManager::getInstance().requestActivity(this);
    119         }
     122std::cout << "root gametype: " << rootgametype->getIdentifier()->getName() << std::endl;
     123
     124        for (std::list<BaseObject*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     125            (*it)->setGametype(rootgametype);
     126
     127        if (LevelManager::getInstancePtr())
     128            LevelManager::getInstance().requestActivity(this);
    120129    }
    121130
  • code/branches/questsystem5/src/orxonox/objects/Level.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/Radar.cc

    r2662 r2907  
    144144            for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)
    145145            {
    146                 if (*it == (RadarViewable*)this->owner_)
     146                if (*it == static_cast<RadarViewable*>(this)->owner_)
    147147                    continue;
    148148
  • code/branches/questsystem5/src/orxonox/objects/Scene.cc

    r2662 r2907  
    4141
    4242#include "core/CoreIncludes.h"
    43 #include "core/Core.h"
     43#include "core/GameMode.h"
    4444#include "core/XMLPort.h"
    4545#include "tools/BulletConversions.h"
     
    5757        this->bShadows_ = true;
    5858
    59         if (Core::showsGraphics())
     59        if (GameMode::showsGraphics())
    6060        {
    6161            if (Ogre::Root::getSingletonPtr())
     
    9999                Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_);
    100100            }
    101             else if (!Core::showsGraphics())
     101            else if (!GameMode::showsGraphics())
    102102            {
    103103                delete this->sceneManager_;
     
    227227    void Scene::tick(float dt)
    228228    {
    229         if (!Core::showsGraphics())
     229        if (!GameMode::showsGraphics())
    230230        {
    231231            // We need to update the scene nodes if we don't render
     
    256256    void Scene::setSkybox(const std::string& skybox)
    257257    {
    258         if (Core::showsGraphics() && this->sceneManager_)
     258        if (GameMode::showsGraphics() && this->sceneManager_)
    259259            this->sceneManager_->setSkyBox(true, skybox);
    260260
     
    264264    void Scene::setAmbientLight(const ColourValue& colour)
    265265    {
    266         if (Core::showsGraphics() && this->sceneManager_)
     266        if (GameMode::showsGraphics() && this->sceneManager_)
    267267            this->sceneManager_->setAmbientLight(colour);
    268268
     
    272272    void Scene::setShadow(bool bShadow)
    273273    {
    274         if (Core::showsGraphics() && this->sceneManager_)
     274        if (GameMode::showsGraphics() && this->sceneManager_)
    275275        {
    276276            if (bShadow)
  • code/branches/questsystem5/src/orxonox/objects/collisionshapes

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/controllers/AIController.cc

    r2662 r2907  
    3030#include "AIController.h"
    3131
    32 #include "core/Core.h"
     32#include "core/GameMode.h"
    3333#include "core/CoreIncludes.h"
    3434#include "core/Executor.h"
     
    4545        RegisterObject(AIController);
    4646
    47         if (Core::isMaster())
     47        if (GameMode::isMaster())
    4848            this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action)));
    4949    }
  • code/branches/questsystem5/src/orxonox/objects/controllers/CMakeLists.txt

    r2710 r2907  
    55  AIController.cc
    66  ScriptController.cc
     7  PongAI.cc
    78)
  • code/branches/questsystem5/src/orxonox/objects/controllers/Controller.cc

    r2662 r2907  
    4343        this->player_ = 0;
    4444        this->controllableEntity_ = 0;
    45         this->hud_ = 0;
    46         this->bUpdateHUD_ = false;
    4745    }
    4846
    4947    Controller::~Controller()
    5048    {
    51         if (this->isInitialized() && this->hud_)
    52             delete this->hud_;
    53     }
    54 
    55     void Controller::changedControllableEntity()
    56     {
    57         if (this->bUpdateHUD_)
    58         {
    59             this->updateHUD();
    60             this->bUpdateHUD_ = false;
    61         }
    62 
    63         if (this->hud_)
    64             this->hud_->setOwner(this->getControllableEntity());
    65     }
    66 
    67     void Controller::updateHUD()
    68     {
    69         if (this->hud_)
    70         {
    71             delete this->hud_;
    72             this->hud_ = 0;
    73         }
    74 
    75         if (this->hudtemplate_ != "")
    76         {
    77             this->hud_ = new OverlayGroup(this);
    78             this->hud_->addTemplate(this->hudtemplate_);
    79             this->hud_->setOwner(this->getControllableEntity());
    80         }
    8149    }
    8250}
  • code/branches/questsystem5/src/orxonox/objects/controllers/Controller.h

    r2662 r2907  
    5757            inline ControllableEntity* getControllableEntity() const
    5858                { return this->controllableEntity_; }
    59             virtual void changedControllableEntity();
    60 
    61             inline void setHUDTemplate(const std::string& name)
    62             {
    63                 if (name != this->hudtemplate_)
    64                 {
    65                     this->hudtemplate_ = name;
    66                     if (this->controllableEntity_)
    67                         this->updateHUD();
    68                     else
    69                         this->bUpdateHUD_ = true;
    70                 }
    71             }
    72             inline const std::string& getHUDTemplate() const
    73                 { return this->hudtemplate_; }
    74 
    75             inline OverlayGroup* getHUD() const
    76                 { return this->hud_; }
     59            virtual void changedControllableEntity() {}
    7760
    7861        protected:
    79             void updateHUD();
    80 
    8162            PlayerInfo* player_;
    8263            ControllableEntity* controllableEntity_;
    83             std::string hudtemplate_;
    84             OverlayGroup* hud_;
    85             bool bUpdateHUD_;
    8664    };
    8765}
  • code/branches/questsystem5/src/orxonox/objects/controllers/HumanController.cc

    r2662 r2907  
    3535#include "objects/worldentities/pawns/Pawn.h"
    3636#include "objects/gametypes/Gametype.h"
     37#include "objects/infos/PlayerInfo.h"
    3738
    3839namespace orxonox
     
    157158            if (pawn)
    158159                pawn->kill();
     160            else if (HumanController::localController_s->player_)
     161                HumanController::localController_s->player_->stopControl(HumanController::localController_s->controllableEntity_);
    159162        }
    160163    }
  • code/branches/questsystem5/src/orxonox/objects/gametypes/CMakeLists.txt

    r2710 r2907  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  Gametype.cc
     3  Deathmatch.cc
     4  TeamDeathmatch.cc
     5  Pong.cc
    36)
  • code/branches/questsystem5/src/orxonox/objects/gametypes/Gametype.cc

    r2710 r2907  
    3636#include "core/ConfigValueIncludes.h"
    3737#include "core/Template.h"
    38 #include "core/Core.h"
     38#include "core/GameMode.h"
    3939#include "overlays/OverlayGroup.h"
    4040#include "objects/infos/PlayerInfo.h"
     
    4444#include "objects/worldentities/Camera.h"
    4545
    46 #include "network/Host.h"
    47 
    4846namespace orxonox
    4947{
     
    6664        this->setConfigValues();
    6765
    68         this->addBots(this->numberOfBots_);
    69 
    7066        // load the corresponding score board
    71         if (Core::showsGraphics() && this->scoreboardTemplate_ != "")
     67        if (GameMode::showsGraphics() && this->scoreboardTemplate_ != "")
    7268        {
    7369            this->scoreboard_ = new OverlayGroup(this);
     
    105101    void Gametype::start()
    106102    {
    107         COUT(0) << "game started" << std::endl;
     103        this->addBots(this->numberOfBots_);
     104
    108105        this->gtinfo_.bStarted_ = true;
    109106
     
    113110    void Gametype::end()
    114111    {
    115         COUT(0) << "game ended" << std::endl;
    116112        this->gtinfo_.bEnded_ = true;
    117113    }
     
    120116    {
    121117        this->players_[player].state_ = PlayerState::Joined;
    122 
    123         std::string message = player->getName() + " entered the game";
    124         COUT(0) << message << std::endl;
    125         Host::Broadcast(message);
    126     }
    127 
    128     void Gametype::playerLeft(PlayerInfo* player)
     118    }
     119
     120    bool Gametype::playerLeft(PlayerInfo* player)
    129121    {
    130122        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
     
    132124        {
    133125            this->players_.erase(it);
    134 
    135             std::string message = player->getName() + " left the game";
    136             COUT(0) << message << std::endl;
    137             Host::Broadcast(message);
    138         }
     126            return true;
     127        }
     128        return false;
    139129    }
    140130
     
    147137    }
    148138
    149     void Gametype::playerChangedName(PlayerInfo* player)
     139    bool Gametype::playerChangedName(PlayerInfo* player)
    150140    {
    151141        if (this->players_.find(player) != this->players_.end())
     
    153143            if (player->getName() != player->getOldName())
    154144            {
    155                 std::string message = player->getOldName() + " changed name to " + player->getName();
    156                 COUT(0) << message << std::endl;
    157                 Host::Broadcast(message);
    158             }
    159         }
     145                return true;
     146            }
     147        }
     148        return false;
    160149    }
    161150
     
    168157    }
    169158
     159    void Gametype::playerPreSpawn(PlayerInfo* player)
     160    {
     161    }
     162
     163    void Gametype::playerPostSpawn(PlayerInfo* player)
     164    {
     165    }
     166
     167    void Gametype::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
     168    {
     169    }
     170
     171    void Gametype::playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn)
     172    {
     173    }
     174
     175    bool Gametype::allowPawnHit(Pawn* victim, Pawn* originator)
     176    {
     177        return true;
     178    }
     179
     180    bool Gametype::allowPawnDamage(Pawn* victim, Pawn* originator)
     181    {
     182        return true;
     183    }
     184
     185    bool Gametype::allowPawnDeath(Pawn* victim, Pawn* originator)
     186    {
     187        return true;
     188    }
     189
    170190    void Gametype::pawnKilled(Pawn* victim, Pawn* killer)
    171191    {
    172         if (victim && victim->getPlayer())
    173         {
    174             std::string message;
    175             if (killer)
    176             {
    177                 if (killer->getPlayer())
    178                     message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
    179                 else
    180                     message = victim->getPlayer()->getName() + " was killed";
    181             }
    182             else
    183                 message = victim->getPlayer()->getName() + " died";
    184 
    185             COUT(0) << message << std::endl;
    186             Host::Broadcast(message);
    187         }
    188 
    189192        if (victim && victim->getPlayer())
    190193        {
     
    198201                if (killer)
    199202                {
    200                     std::map<PlayerInfo*, Player>::iterator itKiller = this->players_.find(killer->getPlayer());
    201                     if (itKiller != this->players_.end())
    202                     {
    203                         this->playerScored(itKiller->second);
    204                     }
    205                     else
    206                         COUT(2) << "Warning: Killing Pawn was not in the playerlist" << std::endl;
     203                    std::map<PlayerInfo*, Player>::iterator it = this->players_.find(killer->getPlayer());
     204                    if (it != this->players_.end())
     205                        it->second.frags_++;
    207206                }
    208207
     
    225224    }
    226225
    227     void Gametype::playerScored(Player& player)
    228     {
    229         player.frags_++;
     226    void Gametype::playerScored(PlayerInfo* player)
     227    {
     228        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
     229        if (it != this->players_.end())
     230            it->second.frags_++;
     231    }
     232
     233    int Gametype::getScore(PlayerInfo* player) const
     234    {
     235        std::map<PlayerInfo*, Player>::const_iterator it = this->players_.find(player);
     236        if (it != this->players_.end())
     237            return it->second.frags_;
     238        else
     239            return 0;
    230240    }
    231241
     
    336346        if (spawnpoint)
    337347        {
     348            this->playerPreSpawn(player);
    338349            player->startControl(spawnpoint->spawn());
    339350            this->players_[player].state_ = PlayerState::Alive;
     351            this->playerPostSpawn(player);
    340352        }
    341353        else
     
    349361    {
    350362        for (unsigned int i = 0; i < amount; ++i)
    351             new Bot(this);
     363            this->botclass_.fabricate(this);
    352364    }
    353365
  • code/branches/questsystem5/src/orxonox/objects/gametypes/Gametype.h

    r2662 r2907  
    8484            virtual void end();
    8585            virtual void playerEntered(PlayerInfo* player);
    86             virtual void playerLeft(PlayerInfo* player);
     86            virtual bool playerLeft(PlayerInfo* player);
    8787            virtual void playerSwitched(PlayerInfo* player, Gametype* newgametype);
    8888            virtual void playerSwitchedBack(PlayerInfo* player, Gametype* oldgametype);
    89             virtual void playerChangedName(PlayerInfo* player);
     89            virtual bool playerChangedName(PlayerInfo* player);
    9090
    91             virtual void playerScored(Player& player);
     91            virtual void playerScored(PlayerInfo* player);
     92
     93            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
     94            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
     95            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
    9296
    9397            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
    9498            virtual void pawnPreSpawn(Pawn* pawn);
    9599            virtual void pawnPostSpawn(Pawn* pawn);
     100            virtual void playerPreSpawn(PlayerInfo* player);
     101            virtual void playerPostSpawn(PlayerInfo* player);
     102
     103            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
     104            virtual void playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn);
    96105
    97106            inline const std::map<PlayerInfo*, Player>& getPlayers() const
    98107                { return this->players_; }
     108
     109            int getScore(PlayerInfo* player) const;
    99110
    100111            inline void registerSpawnPoint(SpawnPoint* spawnpoint)
     
    106117                { return this->gtinfo_.startCountdown_; }
    107118
     119            inline void setHUDTemplate(const std::string& name)
     120                { this->gtinfo_.hudtemplate_ = name; }
     121            inline const std::string& getHUDTemplate() const
     122                { return this->gtinfo_.hudtemplate_; }
     123
    108124            void addBots(unsigned int amount);
    109125            void killBots(unsigned int amount = 0);
     
    112128                { return this->players_.size(); }
    113129
    114         private:
     130        protected:
    115131            virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
    116132
    117             void addPlayer(PlayerInfo* player);
    118             void removePlayer(PlayerInfo* player);
    119 
    120             void assignDefaultPawnsIfNeeded();
    121             void checkStart();
    122             void spawnPlayer(PlayerInfo* player);
    123             void spawnPlayersIfRequested();
    124             void spawnDeadPlayersIfRequested();
     133            virtual void assignDefaultPawnsIfNeeded();
     134            virtual void checkStart();
     135            virtual void spawnPlayer(PlayerInfo* player);
     136            virtual void spawnPlayersIfRequested();
     137            virtual void spawnDeadPlayersIfRequested();
    125138
    126139            GametypeInfo gtinfo_;
     
    131144            float initialStartCountdown_;
    132145            unsigned int numberOfBots_;
     146            SubclassIdentifier<Bot> botclass_;
    133147
    134148            std::map<PlayerInfo*, Player> players_;
  • code/branches/questsystem5/src/orxonox/objects/infos/Bot.cc

    r2662 r2907  
    3030#include "Bot.h"
    3131
    32 #include "core/Core.h"
     32#include "core/GameMode.h"
    3333#include "core/CoreIncludes.h"
    3434#include "core/ConfigValueIncludes.h"
     
    4646
    4747        this->bHumanPlayer_ = false;
    48         this->bLocalPlayer_ = Core::isMaster();
     48        this->bLocalPlayer_ = GameMode::isMaster();
    4949        this->bSetUnreadyAfterSpawn_ = false;
    5050        this->setReadyToSpawn(true);
  • code/branches/questsystem5/src/orxonox/objects/infos/CMakeLists.txt

    r2710 r2907  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  Bot.cc
     3  PongBot.cc
    34  Info.cc
    45  PlayerInfo.cc
  • code/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.cc

    r2662 r2907  
    5858        registerVariable(this->startCountdown_,         variableDirection::toclient);
    5959        registerVariable(this->bStartCountdownRunning_, variableDirection::toclient);
     60        registerVariable(this->hudtemplate_,            variableDirection::toclient);
    6061    }
    6162}
  • code/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.h

    r2662 r2907  
    5656                { return this->startCountdown_; }
    5757
     58            inline const std::string& getHUDTemplate() const
     59                { return this->hudtemplate_; }
     60
    5861        private:
    5962            bool bStarted_;
     
    6164            bool bStartCountdownRunning_;
    6265            float startCountdown_;
     66            std::string hudtemplate_;
    6367    };
    6468}
  • code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.cc

    r2662 r2907  
    3030#include "HumanPlayer.h"
    3131
    32 #include "core/Core.h"
     32#include "core/GameMode.h"
    3333#include "core/CoreIncludes.h"
    3434#include "core/ConfigValueIncludes.h"
     
    4747        RegisterObject(HumanPlayer);
    4848
    49         this->server_initialized_ = Core::isMaster();
     49        this->server_initialized_ = GameMode::isMaster();
    5050        this->client_initialized_ = false;
    5151
     
    5353        this->defaultController_ = Class(HumanController);
    5454
     55        this->humanHud_ = 0;
     56        this->gametypeHud_ = 0;
     57
    5558        this->setConfigValues();
    5659        this->registerVariables();
     
    5962    HumanPlayer::~HumanPlayer()
    6063    {
     64        if (this->BaseObject::isInitialized())
     65        {
     66            if (this->humanHud_)
     67                delete this->humanHud_;
     68
     69            if (this->gametypeHud_)
     70                delete this->gametypeHud_;
     71        }
    6172    }
    6273
     
    8293            this->synchronize_nick_ = this->nick_;
    8394
    84             if (Core::isMaster())
     95            if (GameMode::isMaster())
    8596                this->setName(this->nick_);
    8697        }
     
    89100    void HumanPlayer::configvaluecallback_changedHUDTemplate()
    90101    {
    91         this->changedController();
     102        this->setHumanHUDTemplate(this->hudtemplate_);
    92103    }
    93104
     
    105116            this->client_initialized_ = true;
    106117
    107             if (!Core::isMaster())
     118            if (!GameMode::isMaster())
    108119                this->setObjectMode(objectDirection::bidirectional);
    109120            else
     
    111122
    112123            this->createController();
     124            this->updateHumanHUD();
    113125        }
    114126    }
     
    146158    }
    147159
    148     void HumanPlayer::changedController()
    149     {
    150         if (this->getController())
    151         {
    152             this->getController()->setHUDTemplate(this->hudtemplate_);
    153 
    154             if (this->getController() && this->getController()->getHUD())
    155                 this->getController()->getHUD()->setOwner(this->getControllableEntity());
     160    void HumanPlayer::changedGametype()
     161    {
     162        PlayerInfo::changedGametype();
     163
     164        if (this->isInitialized() && this->isLocalPlayer())
     165            if (this->getGametype()->getHUDTemplate() != "")
     166                this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate());
     167    }
     168
     169    void HumanPlayer::changedControllableEntity()
     170    {
     171        PlayerInfo::changedControllableEntity();
     172
     173        if (this->humanHud_)
     174            this->humanHud_->setOwner(this->getControllableEntity());
     175    }
     176
     177    void HumanPlayer::updateHumanHUD()
     178    {
     179        if (this->humanHud_)
     180        {
     181            delete this->humanHud_;
     182            this->humanHud_ = 0;
     183        }
     184
     185        if (this->isLocalPlayer() && this->humanHudTemplate_ != "")
     186        {
     187            this->humanHud_ = new OverlayGroup(this);
     188            this->humanHud_->addTemplate(this->humanHudTemplate_);
     189            this->humanHud_->setOwner(this->getControllableEntity());
     190        }
     191    }
     192
     193    void HumanPlayer::updateGametypeHUD()
     194    {
     195        if (this->gametypeHud_)
     196        {
     197            delete this->gametypeHud_;
     198            this->gametypeHud_ = 0;
     199        }
     200
     201        if (this->isLocalPlayer() && this->gametypeHudTemplate_ != "")
     202        {
     203            this->gametypeHud_ = new OverlayGroup(this);
     204            this->gametypeHud_->addTemplate(this->gametypeHudTemplate_);
     205            this->gametypeHud_->setOwner(this->getGametype());
    156206        }
    157207    }
  • code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.h

    r2662 r2907  
    5151            void setClientID(unsigned int clientID);
    5252
    53             virtual void changedController();
     53            virtual void changedGametype();
     54            virtual void changedControllableEntity();
     55
     56            inline void setHumanHUDTemplate(const std::string& name)
     57            {
     58                if (name != this->humanHudTemplate_)
     59                {
     60                    this->humanHudTemplate_ = name;
     61                    this->updateHumanHUD();
     62                }
     63            }
     64            inline const std::string& getHumanHUDTemplate() const
     65                { return this->humanHudTemplate_; }
     66            inline OverlayGroup* getHumanHUD() const
     67                { return this->humanHud_; }
     68
     69            inline void setGametypeHUDTemplate(const std::string& name)
     70            {
     71                if (name != this->gametypeHudTemplate_)
     72                {
     73                    this->gametypeHudTemplate_ = name;
     74                    this->updateGametypeHUD();
     75                }
     76            }
     77            inline const std::string& getGametypeHUDTemplate() const
     78                { return this->gametypeHudTemplate_; }
     79            inline OverlayGroup* getGametypeHUD() const
     80                { return this->gametypeHud_; }
    5481
    5582        protected:
     
    6188            void networkcallback_client_initialized();
    6289
     90            void updateHumanHUD();
     91            void updateGametypeHUD();
     92
    6393            std::string nick_;
    6494            std::string synchronize_nick_;
     
    6696            bool server_initialized_;
    6797            bool client_initialized_;
     98
     99            std::string humanHudTemplate_;
     100            OverlayGroup* humanHud_;
     101            std::string gametypeHudTemplate_;
     102            OverlayGroup* gametypeHud_;
    68103    };
    69104}
  • code/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.cc

    r2662 r2907  
    110110    void PlayerInfo::createController()
    111111    {
     112        if (this->controller_)
     113        {
     114            delete this->controller_;
     115            this->controller_ = 0;
     116        }
    112117        this->controller_ = this->defaultController_.fabricate(this);
    113118        assert(this->controller_);
     
    141146        if (this->controller_)
    142147            this->controller_->setControllableEntity(entity);
     148
     149        this->changedControllableEntity();
    143150    }
    144151
     
    155162            if (callback)
    156163                entity->removePlayer();
     164
     165            this->changedControllableEntity();
    157166        }
    158167    }
  • code/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.h

    r2662 r2907  
    4949            virtual void changedGametype();
    5050
     51            virtual void changedController() {}
     52            virtual void changedControllableEntity() {}
     53
    5154            inline bool isHumanPlayer() const
    5255                { return this->bHumanPlayer_; }
     
    7376            inline Controller* getController() const
    7477                { return this->controller_; }
    75             virtual void changedController() {}
    7678
    7779        protected:
  • code/branches/questsystem5/src/orxonox/objects/items/MultiStateEngine.cc

    r2662 r2907  
    3030#include "MultiStateEngine.h"
    3131
    32 #include "core/Core.h"
     32#include "core/GameMode.h"
    3333#include "core/CoreIncludes.h"
    3434#include "core/XMLPort.h"
     
    123123            }
    124124
    125             if (Core::isMaster())
     125            if (GameMode::isMaster())
    126126            {
    127127                for (std::list<WorldEntity*>::const_iterator it = this->activeEffects_.begin(); it != this->activeEffects_.end(); ++it)
  • code/branches/questsystem5/src/orxonox/objects/pickup/PickupSpawner.cc

    r2662 r2907  
    8989                ExecutorMember<BaseObject>* executor = createExecutor(createFunctor(&BaseObject::setActive));
    9090                executor->setDefaultValues(true);
    91                 RespawnTimer_.setTimer(this->respawntimer_, false, (BaseObject*)this, executor);
     91                RespawnTimer_.setTimer(this->respawntimer_, false, this, executor);
    9292                COUT(0) << "TIMER SET" << std::endl;
    9393        }
  • code/branches/questsystem5/src/orxonox/objects/pickup/Usable.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/AddQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
    r2785 r2907  
    4242#include "orxonox/objects/infos/PlayerInfo.h"
    4343#include "QuestManager.h"
    44 #include "QuestDescription.h";
     44#include "QuestDescription.h"
    4545#include "Quest.h"
    4646
  • code/branches/questsystem5/src/orxonox/objects/quest/AddQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/AddQuestHint.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/AddQuestHint.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/AddReward.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/AddReward.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/ChangeQuestStatus.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/ChangeQuestStatus.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/CompleteQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/CompleteQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/FailQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/FailQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/GlobalQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/GlobalQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/LocalQuest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/LocalQuest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/Quest.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/Quest.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestDescription.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestDescription.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestEffect.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestEffect.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestHint.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestHint.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestItem.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestItem.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestManager.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestManager.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/Rewardable.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/quest/Rewardable.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/Munition.cc

    r2662 r2907  
    105105    void Munition::fillBullets()
    106106    {
    107 //COUT(0) << "Munition::fillBullets maxBullets_=" << this->maxBullets_ << std::endl;
    108107        this->bullets_ = this->maxBullets_;
    109108    }
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/Weapon.cc

    r2662 r2907  
    4242    {
    4343        RegisterObject(Weapon);
     44
    4445        this->bulletReadyToShoot_ = true;
    4546        this->magazineReadyToShoot_ = true;
    4647        this->parentWeaponSystem_ = 0;
    4748        this->attachedToWeaponSlot_ = 0;
    48         this->munition_ = 0;
    4949        this->bulletLoadingTime_ = 0;
    5050        this->magazineLoadingTime_ = 0;
    5151        this->bReloading_ = false;
    52 
     52        this->bulletAmount_= 0;
     53        this->magazineAmount_ = 0;
     54        this->munition_ = 0;
     55        this->unlimitedMunition_ = false;
    5356        this->setObjectMode(0x0);
    5457    }
     
    6568        XMLPortParam(Weapon, "bulletLoadingTime", setBulletLoadingTime, getBulletLoadingTime, xmlelement, mode);
    6669        XMLPortParam(Weapon, "magazineLoadingTime", setMagazineLoadingTime, getMagazineLoadingTime, xmlelement, mode);
     70        XMLPortParam(Weapon, "bullets", setBulletAmount, getBulletAmount, xmlelement, mode);
     71        XMLPortParam(Weapon, "magazines", setMagazineAmount, getMagazineAmount, xmlelement, mode);
     72        XMLPortParam(Weapon, "unlimitedMunition", setUnlimitedMunition, getUnlimitedMunition, xmlelement, mode);
    6773    }
    6874
     
    7379    }
    7480
     81    void Weapon::setMunition()
     82    {
     83        this->munition_->setMaxBullets(this->bulletAmount_);
     84        this->munition_->setMaxMagazines(this->magazineAmount_);
     85    }
    7586
    7687    void Weapon::fire()
    7788    {
    78 //COUT(0) << "LaserGun::fire, this=" << this << std::endl;
    7989        if ( this->bulletReadyToShoot_ && this->magazineReadyToShoot_ && !this->bReloading_)
    8090        {
    81 //COUT(0) << "LaserGun::fire - ready to shoot" << std::endl;
    82 //COUT(0) << "LaserGun::fire - bullets" << this->munition_->bullets() << std::endl;
    8391            this->bulletReadyToShoot_ = false;
    84             if ( this->munition_->bullets() > 0)
     92            if ( this->unlimitedMunition_== true )
    8593            {
    8694                //shoot
    87                 this->takeBullets();
     95                this->reloadBullet();
    8896                this->createProjectile();
    8997            }
    90             //if there are no bullets, but magazines
    91             else if ( this->munition_->magazines() > 0 && this->munition_->bullets() == 0 )
    92             {
    93 //COUT(0) << "LaserGun::fire - no bullets" << std::endl;
    94                 this->takeMagazines();
    95             }
    9698            else
    9799            {
    98 //COUT(0) << "LaserGun::fire - no magazines" << std::endl;
    99                 //actions
     100                if ( this->munition_->bullets() > 0)
     101                {
     102                    //shoot and reload
     103                    this->takeBullets();
     104                    this->reloadBullet();
     105                    this->createProjectile();
     106                }
     107                //if there are no bullets, but magazines
     108                else if ( this->munition_->magazines() > 0 && this->munition_->bullets() == 0 )
     109                {
     110                    //reload magazine
     111                    this->takeMagazines();
     112                    this->reloadMagazine();
     113                }
     114                else
     115                {
     116                    //no magazines
     117                }
    100118            }
    101119        }
    102120        else
    103121        {
    104 //COUT(0) << "LaserGun::fire - weapon not reloaded - bullets remaining:" << this->munition_->bullets() << std::endl;
    105             //actions
     122            //weapon not reloaded
    106123        }
    107124
     
    109126
    110127
     128    //weapon reloading
    111129    void Weapon::bulletTimer(float bulletLoadingTime)
    112130    {
    113 //COUT(0) << "Weapon::bulletTimer started" << std::endl;
    114131        this->bReloading_ = true;
    115132        this->bulletReloadTimer_.setTimer( bulletLoadingTime , false , this , createExecutor(createFunctor(&Weapon::bulletReloaded)));
     
    117134    void Weapon::magazineTimer(float magazineLoadingTime)
    118135    {
    119 //COUT(0) << "Weapon::magazineTimer started" << std::endl;
    120136        this->bReloading_ = true;
    121137        this->magazineReloadTimer_.setTimer( magazineLoadingTime , false , this , createExecutor(createFunctor(&Weapon::magazineReloaded)));
     
    132148        this->bReloading_ = false;
    133149        this->munition_->fillBullets();
    134         this->magazineReadyToShoot_ = true;
    135         this->bulletReadyToShoot_ = true;
    136     }
     150    }
     151
    137152
    138153
    139154    void Weapon::attachNeededMunition(std::string munitionName)
    140155    {
    141 //COUT(0) << "Weapon::attachNeededMunition, parentWeaponSystem=" << this->parentWeaponSystem_ << std::endl;
    142         //if munition type already exists attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
     156        /*  if munition type already exists attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
     157        */
    143158        if (this->parentWeaponSystem_)
    144159        {
    145 //COUT(0) << "Weapon::attachNeededMunition " << munitionName << std::endl;
     160            //getMunitionType returns 0 if there is no such munitionType
    146161            Munition* munition = this->parentWeaponSystem_->getMunitionType(munitionName);
    147162            if ( munition )
     163            {
    148164                this->munition_ = munition;
     165                this->setMunition();
     166            }
    149167            else
    150168            {
    151                 //create new munition with identifier
    152 //COUT(0) << "Weapon::attachNeededMunition, create new Munition of Type " << munitionName << std::endl;
     169                //create new munition with identifier because there is no such munitionType
    153170                this->munitionIdentifier_ = ClassByString(munitionName);
    154171                this->munition_ = this->munitionIdentifier_.fabricate(this);
    155172                this->parentWeaponSystem_->setNewMunition(munitionName, this->munition_);
     173                this->setMunition();
    156174            }
    157175        }
     
    159177
    160178
    161      /*get and set functions
    162      *
    163      */
    164 
    165     void Weapon::setMunitionType(std::string munitionType)
    166     {   this->munitionType_ = munitionType; }
    167 
    168     const std::string Weapon::getMunitionType()
    169     {   return this->munitionType_;  }
    170 
    171     void Weapon::setBulletLoadingTime(float loadingTime)
    172     {   this->bulletLoadingTime_ = loadingTime; }
    173 
    174     const float Weapon::getBulletLoadingTime()
    175     {   return this->bulletLoadingTime_;  }
    176 
    177     void Weapon::setMagazineLoadingTime(float loadingTime)
    178     {   this->magazineLoadingTime_ = loadingTime; }
    179 
    180     const float Weapon::getMagazineLoadingTime()
    181     {   return this->magazineLoadingTime_;  }
    182 
    183 
    184179    Munition * Weapon::getAttachedMunition(std::string munitionType)
    185180    {
    186 //COUT(0) << "Weapon::getAttachedMunition, parentWeaponSystem_="<< this->parentWeaponSystem_ << std::endl;
    187181        this->munition_ = this->parentWeaponSystem_->getMunitionType(munitionType);
    188 //COUT(0) << "Weapon::getAttachedMunition, munition_="<< this->munition_ << std::endl;
    189182        return this->munition_;
    190183    }
    191184
     185
     186    //these function are defined in the weapon classes
    192187    void Weapon::takeBullets() { };
    193188    void Weapon::createProjectile() { };
    194189    void Weapon::takeMagazines() { };
     190    void Weapon::reloadBullet() { };
     191    void Weapon::reloadMagazine() { };
     192
     193
     194    //get and set functions for XMLPort
     195    void Weapon::setMunitionType(std::string munitionType)
     196    {   this->munitionType_ = munitionType; }
     197
     198    const std::string Weapon::getMunitionType()
     199    {   return this->munitionType_;  }
     200
     201    void Weapon::setBulletLoadingTime(float loadingTime)
     202    {   this->bulletLoadingTime_ = loadingTime; }
     203
     204    const float Weapon::getBulletLoadingTime()
     205    {   return this->bulletLoadingTime_;  }
     206
     207    void Weapon::setMagazineLoadingTime(float loadingTime)
     208    {   this->magazineLoadingTime_ = loadingTime; }
     209
     210    const float Weapon::getMagazineLoadingTime()
     211    {   return this->magazineLoadingTime_;  }
     212
     213    void Weapon::setBulletAmount(unsigned int amount)
     214    {   this->bulletAmount_ = amount; }
     215
     216    const unsigned int Weapon::getBulletAmount()
     217    {   return this->bulletAmount_;  }
     218
     219    void Weapon::setMagazineAmount(unsigned int amount)
     220    {   this->magazineAmount_ = amount; }
     221
     222    const unsigned int Weapon::getMagazineAmount()
     223    {   return this->magazineAmount_;   }
     224
     225    void Weapon::setUnlimitedMunition(bool unlimitedMunition)
     226    {   this->unlimitedMunition_ = unlimitedMunition;   }
     227
     228    const bool Weapon::getUnlimitedMunition()
     229    {   return this->unlimitedMunition_;    }
    195230
    196231}
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/Weapon.h

    r2662 r2907  
    6262            void magazineReloaded();
    6363
     64            //XMLPort functions
    6465            virtual void setMunitionType(std::string munitionType);
    6566            virtual const std::string getMunitionType();
     
    6869            virtual void setMagazineLoadingTime(float loadingTime);
    6970            virtual const float getMagazineLoadingTime();
     71            virtual void setBulletAmount(unsigned int amount);
     72            virtual const unsigned int getBulletAmount();
     73            virtual void setMagazineAmount(unsigned int amount);
     74            virtual const unsigned int getMagazineAmount();
     75            virtual void setUnlimitedMunition(bool unlimitedMunition);
     76            virtual const bool getUnlimitedMunition();
    7077
     78            //weapon actions
    7179            virtual void takeBullets();
    7280            virtual void takeMagazines();
    7381            virtual void createProjectile();
     82            virtual void reloadBullet();
     83            virtual void reloadMagazine();
    7484
     85            //manually set or reset
     86            virtual void setWeapon();
     87            virtual void setMunition();
     88           
    7589            inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    7690                { this->parentWeaponSystem_=parentWeaponSystem; };
     
    8397                { return this->attachedToWeaponSlot_; }
    8498
    85             virtual void setWeapon();
    8699
    87100        private:
     
    91104            bool bulletReadyToShoot_;
    92105            bool magazineReadyToShoot_;
     106            bool unlimitedMunition_;
    93107            float bulletLoadingTime_;
    94108            float magazineLoadingTime_;
     109            unsigned int bulletAmount_;
     110            unsigned int magazineAmount_;
    95111            std::string munitionType_;
    96112
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponPack.cc

    r2710 r2907  
    6363        for (int i=0; i < (int) this->weapons_.size(); i++)
    6464        {
    65 //COUT(0) << "WeaponPack::fire (attached from WeaponSet)  from Weapon: "<< i << std::endl;
    6665            this->weapons_[i]->getAttachedToWeaponSlot()->fire();
    6766        }
     
    8382    void WeaponPack::setFireMode(unsigned int firemode)
    8483    {
    85 //COUT(0) << "WeaponPack::setFireMode " << std::endl;
    8684        this->firemode_ = firemode;
    8785    }
     
    9492    void WeaponPack::addWeapon(Weapon * weapon)
    9593    {
    96 //COUT(0) << "WeaponPack::addWeapon:" << weapon << "   munition " << weapon->getMunitionType() << std::endl;
    9794        this->weapons_.push_back(weapon);
    9895    }
     
    117114        {
    118115            this->weapons_[i]->attachNeededMunition(weapons_[i]->getMunitionType());
    119             //hack!
    120116            this->weapons_[i]->setWeapon();
    121117        }
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponPack.h

    r2710 r2907  
    5959            const Weapon * getWeapon(unsigned int index);
    6060
     61            //functions with effect to all weapons of the weaponPack
    6162            //functions needed for creating Pointer to the right objects (-->Pawn.cc)
    6263            void setParentWeaponSystemToAllWeapons(WeaponSystem * weaponSystem);
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponSet.cc

    r2662 r2907  
    5656    void WeaponSet::attachWeaponPack(WeaponPack *wPack)
    5757    {
    58 //COUT(0) << "WeaponSet::attachWeaponPack" << std::endl;
    59 //COUT(0) << "........ parentWeaponSystem_=" << this->parentWeaponSystem_ << std::endl;
    60 //COUT(0) << "........ this->parentWeaponSystem_->getWeaponSlotSize()" << this->parentWeaponSystem_->getWeaponSlotSize() << std::endl;
    61 //COUT(0) << "........ wPack->getSize()" << wPack->getSize() << std::endl;
    6258        if ( this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) )
    6359        {
    64 //COUT(0) << "WeaponSet::attachWeaponPack after if" << std::endl;
    6560            this->attachedWeaponPack_ = wPack;
    6661            int wPackWeapon = 0;    //WeaponCounter for Attaching
     62           
    6763            //should be possible to choose which slot to use
     64            //attach every weapon of the weaponPack to a weaponSlot
    6865            for (  int i=0; i < wPack->getSize() ; i++  )
    6966            {
    7067                //at the moment this function only works for one weaponPack in the entire WeaponSystem...
     68                //it also takes the first free weaponSlot...
    7169                if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 && this->parentWeaponSystem_->getWeaponSlotPointer(i) != 0) //if slot not full
    7270                {
    73 //COUT(0) << "WeaponSet::attachWeaponPack attaching Weapon" << std::endl;
    7471                    this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) );
    7572                    this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
     
    8380                        if ( this->parentWeaponSystem_->getWeaponSlotPointer(k)->getAttachedWeapon() == 0 )
    8481                        {
    85 //COUT(0) << "WeaponSet::attachWeaponPack mode 2 k="<< k << std::endl;
    8682                            this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(k) );
    8783                            this->parentWeaponSystem_->getWeaponSlotPointer(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
     
    9995    {
    10096        //fires all WeaponSlots available for this weaponSet attached from the WeaponPack
    101 //COUT(0) << "WeaponSet::fire from Pack: " << this->attachedWeaponPack_ << std::endl;
    10297        if (this->attachedWeaponPack_)
    10398            this->attachedWeaponPack_->fire();
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponSystem.cc

    r2710 r2907  
    3838
    3939
    40 /* WEAPONSYSTEM
    41  * creates the WeaponSystem and the ability to use weapons and munition
    42  * loads the weapon the whole weaponSystem setting from an xml file
     40/* WeaponSystem
    4341 *
     42 *  www.orxonox.net/wiki/WeaponSystem
    4443 */
    4544
     
    5251        RegisterObject(WeaponSystem);
    5352
    54         this->activeWeaponSet_ = 0;
    5553        this->parentPawn_ = 0;
    5654    }
     
    8482    }
    8583
    86     //returns the Pointer to the munitionType
     84
     85    //returns the Pointer to the munitionType, if this munitionType doesn't exist returns 0, see Weapon::attachNeededMunition
    8786    Munition * WeaponSystem::getMunitionType(std::string munitionType)
    8887    {
    89 //COUT(0) << "WeaponSystem::getMunitionType " << munitionType << std::endl;
    9088        std::map<std::string, Munition *>::const_iterator it = this->munitionSet_.find(munitionType);
    9189        if (it != this->munitionSet_.end())
     
    9694
    9795
    98 /*
    99     //the first weaponSet is at n=0
    100     void WeaponSystem::setActiveWeaponSet(unsigned int n)
    101     {
    102         if (n < this->weaponSets_.size())
    103             this->activeWeaponSet_ = this->weaponSets_[n];
    104         else
    105             this->activeWeaponSet_ = this->weaponSets_[0];
    106     }
    107 */
    108 
    109 
    11096    //n is the n'th weaponSet, starting with zero
    111     //SpaceShip.cc only needs to have the keybinding to a specific Set-number n
     97    //SpaceShip.cc only needs to have the keybinding to a specific Set-number n (=firemode)
     98    //in future this could be well defined and not only for 3 different WeaponModes
    11299    void WeaponSystem::fire(WeaponMode::Enum n)
    113100    {
     
    125112                break;
    126113        }
    127 //COUT(0) << "WeaponSystem::fire" << std::endl;
    128114        if (set < (int)this->weaponSets_.size())
    129 //COUT(0) << "WeaponSystem::fire - after if" << std::endl;
    130115            this->weaponSets_[set]->fire();
    131116    }
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponSystem.h

    r2710 r2907  
    5353            //void fire();
    5454            void fire(WeaponMode::Enum fireMode);
    55             //void setActiveWeaponSet(unsigned int n);
    5655            void attachWeaponPack(WeaponPack * wPack, unsigned int firemode);
    5756            WeaponSet * getWeaponSetPointer(unsigned int n);
     
    5958            WeaponPack * getWeaponPackPointer(unsigned int n);
    6059            void setNewMunition(std::string munitionType, Munition * munitionToAdd);
     60            void setNewSharedMunition(std::string munitionType, Munition * munitionToAdd);
    6161            Munition * getMunitionType(std::string munitionType);
    6262
     
    7474            std::vector<WeaponPack *> weaponPacks_;
    7575            std::map<std::string, Munition *> munitionSet_;
    76             WeaponSet *activeWeaponSet_;
    7776            Pawn *parentPawn_;
    7877    };
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/munitions/CMakeLists.txt

    r2710 r2907  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  LaserGunMunition.cc
     3  FusionMunition.cc
    34)
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc

    r2662 r2907  
    4343        RegisterObject(LaserGunMunition);
    4444
     45        //default if not defined in XML
    4546        this->maxBullets_ = 40;
    4647        this->maxMagazines_ = 100;
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc

    r2662 r2907  
    3232#include <OgreBillboardSet.h>
    3333
    34 #include "core/Core.h"
     34#include "core/GameMode.h"
    3535#include "core/CoreIncludes.h"
    3636#include "objects/Scene.h"
     
    4444        RegisterObject(BillboardProjectile);
    4545
    46         if (Core::showsGraphics())
     46        if (GameMode::showsGraphics())
    4747        {
    4848            assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
     
    5656    BillboardProjectile::~BillboardProjectile()
    5757    {
    58         if (this->isInitialized() && Core::showsGraphics() && this->billboard_.getBillboardSet())
     58        if (this->isInitialized() && GameMode::showsGraphics() && this->billboard_.getBillboardSet())
    5959            this->detachOgreObject(this->billboard_.getBillboardSet());
    6060    }
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc

    r2662 r2907  
    3333#include <OgreParticleEmitter.h>
    3434
    35 #include "core/Core.h"
     35#include "core/GameMode.h"
    3636#include "core/CoreIncludes.h"
    3737#include "core/ConfigValueIncludes.h"
     
    4646        RegisterObject(ParticleProjectile);
    4747
    48         if (Core::showsGraphics())
     48        if (GameMode::showsGraphics())
    4949        {
    5050            this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal);
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc

    r2662 r2907  
    4141#include "objects/worldentities/ParticleSpawner.h"
    4242#include "objects/collisionshapes/SphereCollisionShape.h"
    43 #include "core/Core.h"
     43#include "core/GameMode.h"
    4444
    4545namespace orxonox
     
    5555        // Get notification about collisions
    5656
    57         if (Core::isMaster())
     57        if (GameMode::isMaster())
    5858        {
    5959            this->enableCollisionCallback();
     
    9393    void Projectile::destroyObject()
    9494    {
    95         if (Core::isMaster())
     95        if (GameMode::isMaster())
    9696            delete this;
    9797    }
     
    9999    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    100100    {
    101         if (!this->bDestroy_ && Core::isMaster())
     101        if (!this->bDestroy_ && GameMode::isMaster())
    102102        {
    103103            this->bDestroy_ = true;
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc

    r2662 r2907  
    5353    }
    5454
     55    void LaserGun::reloadBullet()
     56    {
     57        this->bulletTimer(this->bulletLoadingTime_);
     58    }
     59
     60    void LaserGun::reloadMagazine()
     61    {
     62        this->magazineTimer(this->magazineLoadingTime_);
     63    }
     64
    5565    void LaserGun::takeBullets()
    5666    {
    57 //COUT(0) << "LaserGun::takeBullets" << std::endl;
    5867        this->munition_->removeBullets(1);
    59         this->bulletTimer(this->bulletLoadingTime_);
    6068    }
    6169
     
    6371    {
    6472        this->munition_->removeMagazines(1);
    65         this->magazineTimer(this->magazineLoadingTime_);
    6673    }
    6774
    6875    void LaserGun::createProjectile()
    6976    {
    70 //COUT(0) << "LaserGun::createProjectile" << std::endl;
    7177        BillboardProjectile* projectile = new ParticleProjectile(this);
    7278        projectile->setOrientation(this->getWorldOrientation());
  • code/branches/questsystem5/src/orxonox/objects/weaponSystem/weapons/LaserGun.h

    r2662 r2907  
    5151            virtual void takeMagazines();
    5252            virtual void createProjectile();
     53            virtual void reloadBullet();
     54            virtual void reloadMagazine();
    5355
    5456        private:
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Backlight.cc

    r2710 r2907  
    3333#include <OgreSceneManager.h>
    3434
    35 #include "core/Core.h"
     35#include "core/GameMode.h"
    3636#include "core/CoreIncludes.h"
    3737#include "core/Executor.h"
     
    5858        this->tickcount_ = 0;
    5959
    60         if (Core::showsGraphics())
     60        if (GameMode::showsGraphics())
    6161        {
    6262            if (!this->getScene())
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Backlight.h

    r2710 r2907  
    3232#include "OrxonoxPrereqs.h"
    3333#include "FadingBillboard.h"
    34 #include "gamestates/GSRoot.h"
     34#include "tools/TimeFactorListener.h"
    3535
    3636namespace orxonox
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Billboard.cc

    r2662 r2907  
    3434#include "core/CoreIncludes.h"
    3535#include "core/XMLPort.h"
    36 #include "core/Core.h"
     36#include "core/GameMode.h"
    3737#include "objects/Scene.h"
    3838
     
    8181        if (!this->billboard_.getBillboardSet())
    8282        {
    83             if (this->getScene() && Core::showsGraphics())
     83            if (this->getScene() && GameMode::showsGraphics())
    8484            {
    8585                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
     
    9898        {
    9999/*
    100             if (this->getScene() && Core::showsGraphics() && (this->material_ != ""))
     100            if (this->getScene() && GameMode::showsGraphics() && (this->material_ != ""))
    101101            {
    102102                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Billboard.h

    r2662 r2907  
    3434#include "util/Math.h"
    3535#include "tools/BillboardSet.h"
     36#include "objects/Teamcolourable.h"
    3637
    3738namespace orxonox
    3839{
    39     class _OrxonoxExport Billboard : public StaticEntity
     40    class _OrxonoxExport Billboard : public StaticEntity, public Teamcolourable
    4041    {
    4142        public:
     
    6162                { return this->colour_; }
    6263
     64            virtual void setTeamColour(const ColourValue& colour)
     65                { this->setColour(colour); }
     66
    6367        protected:
    6468            inline BillboardSet& getBillboardSet()
  • code/branches/questsystem5/src/orxonox/objects/worldentities/BlinkingBillboard.cc

    r2662 r2907  
    3030#include "BlinkingBillboard.h"
    3131
    32 #include "core/Core.h"
     32#include "core/GameMode.h"
    3333#include "core/CoreIncludes.h"
    3434#include "core/XMLPort.h"
     
    7777        SUPER(BlinkingBillboard, tick, dt);
    7878
    79         if (Core::isMaster() && this->isActive())
     79        if (GameMode::isMaster() && this->isActive())
    8080        {
    8181            this->time_ += dt;
  • code/branches/questsystem5/src/orxonox/objects/worldentities/CMakeLists.txt

    r2710 r2907  
    1919  Planet.cc
    2020  SpawnPoint.cc
     21  TeamSpawnPoint.cc
     22  PongCenterpoint.cc
     23  PongBall.cc
     24  PongBat.cc
    2125)
    2226
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Camera.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Camera.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/CameraPosition.cc

    r2662 r2907  
    4444        this->bDrag_ = false;
    4545        this->bAllowMouseLook_ = false;
     46        this->bAbsolute_ = false;
    4647
    4748        this->setObjectMode(0x0);
     
    5859        XMLPortParam(CameraPosition, "drag", setDrag, getDrag, xmlelement, mode).defaultValues(false);
    5960        XMLPortParam(CameraPosition, "mouselook", setAllowMouseLook, getAllowMouseLook, xmlelement, mode).defaultValues(false);
     61        XMLPortParam(CameraPosition, "absolute", setIsAbsolute, getIsAbsolute, xmlelement, mode).defaultValues(false);
    6062    }
    6163
  • code/branches/questsystem5/src/orxonox/objects/worldentities/CameraPosition.h

    r2662 r2907  
    5454                { return this->bAllowMouseLook_; }
    5555
     56            inline void setIsAbsolute(bool bAbsolute)
     57                { this->bAbsolute_ = bAbsolute; }
     58            inline bool getIsAbsolute() const
     59                { return this->bAbsolute_; }
     60
    5661            void attachCamera(Camera* camera);
    5762
     
    5964            bool bDrag_;
    6065            bool bAllowMouseLook_;
     66            bool bAbsolute_;
    6167    };
    6268}
  • code/branches/questsystem5/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2662 r2907  
    3434#include "core/CoreIncludes.h"
    3535#include "core/ConfigValueIncludes.h"
    36 #include "core/Core.h"
     36#include "core/GameMode.h"
    3737#include "core/XMLPort.h"
    3838#include "core/Template.h"
     
    144144    void ControllableEntity::addCameraPosition(CameraPosition* position)
    145145    {
    146         if (position->getAllowMouseLook())
    147             position->attachToNode(this->cameraPositionRootNode_);
     146        if (!position->getIsAbsolute())
     147        {
     148            if (position->getAllowMouseLook())
     149                position->attachToNode(this->cameraPositionRootNode_);
     150            else
     151                this->attach(position);
     152        }
    148153        else
    149             this->attach(position);
     154        {
     155            WorldEntity* parent = this->getParent();
     156            if (parent)
     157                parent->attach(position);
     158        }
    150159        this->cameraPositions_.push_back(position);
    151160    }
     
    236245            this->startLocalHumanControl();
    237246
    238             if (!Core::isMaster())
     247            if (!GameMode::isMaster())
    239248            {
    240249                this->client_overwrite_ = this->server_overwrite_;
     
    242251            }
    243252        }
     253
     254        this->changedPlayer();
    244255    }
    245256
     
    254265        this->bHasHumanController_ = false;
    255266        this->setObjectMode(objectDirection::toclient);
     267
     268        this->changedPlayer();
    256269
    257270        if (this->bDestroyWhenPlayerLeft_)
     
    322335    }
    323336
     337    void ControllableEntity::parentChanged()
     338    {
     339        WorldEntity::parentChanged();
     340
     341        WorldEntity* parent = this->getParent();
     342        if (parent)
     343        {
     344            for (std::list<CameraPosition*>::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     345                if ((*it)->getIsAbsolute())
     346                    parent->attach((*it));
     347        }
     348    }
     349
    324350    void ControllableEntity::tick(float dt)
    325351    {
     
    331357            if (!this->isDynamic())
    332358            {
    333                 if (Core::isMaster())
     359                if (GameMode::isMaster())
    334360                {
    335361                    this->server_position_ = this->getPosition();
     
    446472    void ControllableEntity::setPosition(const Vector3& position)
    447473    {
    448         if (Core::isMaster())
     474        if (GameMode::isMaster())
    449475        {
    450476            MobileEntity::setPosition(position);
     
    461487    void ControllableEntity::setOrientation(const Quaternion& orientation)
    462488    {
    463         if (Core::isMaster())
     489        if (GameMode::isMaster())
    464490        {
    465491            MobileEntity::setOrientation(orientation);
     
    476502    void ControllableEntity::setVelocity(const Vector3& velocity)
    477503    {
    478         if (Core::isMaster())
     504        if (GameMode::isMaster())
    479505        {
    480506            MobileEntity::setVelocity(velocity);
     
    491517    void ControllableEntity::setAngularVelocity(const Vector3& velocity)
    492518    {
    493         if (Core::isMaster())
     519        if (GameMode::isMaster())
    494520        {
    495521            MobileEntity::setAngularVelocity(velocity);
     
    507533    {
    508534        MobileEntity::setWorldTransform(worldTrans);
    509         if (Core::isMaster())
     535        if (GameMode::isMaster())
    510536        {
    511537            this->server_position_ = this->getPosition();
  • code/branches/questsystem5/src/orxonox/objects/worldentities/ControllableEntity.h

    r2662 r2907  
    4949
    5050            virtual void changedGametype();
     51            virtual void changedPlayer() {}
    5152
    5253            virtual void setPlayer(PlayerInfo* player);
     
    136137            virtual void startLocalHumanControl();
    137138            virtual void stopLocalHumanControl();
     139            virtual void parentChanged();
    138140
    139141            inline void setHudTemplate(const std::string& name)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/ExplosionChunk.cc

    r2759 r2907  
    3232#include <OgreParticleSystem.h>
    3333
    34 #include "core/Core.h"
     34#include "core/GameMode.h"
    3535#include "core/CoreIncludes.h"
    3636#include "core/Executor.h"
     
    4747        RegisterObject(ExplosionChunk);
    4848
    49         if ( Core::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
     49        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
    5050            ThrowException(AbortLoading, "Can't create ExplosionChunk, no scene or no scene manager given.");
    5151
     
    5353        this->LOD_ = LODParticle::normal;
    5454
    55         if ( Core::showsGraphics() )
     55        if ( GameMode::showsGraphics() )
    5656        {
    5757            try
     
    7575        }
    7676
    77         if (Core::isMaster())
     77        if (GameMode::isMaster())
    7878        {
    7979            Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1));
     
    132132            this->smoke_->setEnabled(false);
    133133
    134         if (Core::isMaster())
     134        if (GameMode::isMaster())
    135135        {
    136136            this->bStop_ = true;
     
    148148        static const unsigned int CHANGES_PER_SECOND = 5;
    149149
    150         if (Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND)
     150        if (GameMode::isMaster() && rnd() < dt*CHANGES_PER_SECOND)
    151151        {
    152152            float length = this->getVelocity().length();
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Light.cc

    r2662 r2907  
    3737#include "util/String.h"
    3838#include "util/Exception.h"
    39 #include "core/Core.h"
     39#include "core/GameMode.h"
    4040#include "core/CoreIncludes.h"
    4141#include "core/XMLPort.h"
     
    5757        this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
    5858
    59         if (Core::showsGraphics())
     59        if (GameMode::showsGraphics())
    6060        {
    6161            if (!this->getScene())
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Light.h

    r2662 r2907  
    3737
    3838#include "util/Math.h"
     39#include "objects/Teamcolourable.h"
    3940
    4041namespace orxonox
    4142{
    42     class _OrxonoxExport Light : public StaticEntity
     43    class _OrxonoxExport Light : public StaticEntity, public Teamcolourable
    4344    {
    4445        public:
     
    6869            inline const ColourValue& getSpecularColour() const
    6970                { return this->specular_; }
     71
     72            virtual void setTeamColour(const ColourValue& colour)
     73                { this->setDiffuseColour(colour); this->setSpecularColour(colour); }
    7074
    7175            /**
  • code/branches/questsystem5/src/orxonox/objects/worldentities/MobileEntity.cc

    r2710 r2907  
    182182        // We use a dynamic body. So we translate our node accordingly.
    183183        this->node_->setPosition(Vector3(worldTrans.getOrigin().x(), worldTrans.getOrigin().y(), worldTrans.getOrigin().z()));
    184         this->node_->setOrientation(Quaternion(worldTrans.getRotation().w(), worldTrans.getRotation().x(), worldTrans.getRotation().y(), worldTrans.getRotation().z()));
     184        btQuaternion temp(worldTrans.getRotation());
     185        this->node_->setOrientation(Quaternion(temp.w(), temp.x(), temp.y(), temp.z()));
    185186        this->linearVelocity_.x = this->physicalBody_->getLinearVelocity().x();
    186187        this->linearVelocity_.y = this->physicalBody_->getLinearVelocity().y();
  • code/branches/questsystem5/src/orxonox/objects/worldentities/MobileEntity.h

  • code/branches/questsystem5/src/orxonox/objects/worldentities/Model.cc

    r2662 r2907  
    3131#include <OgreEntity.h>
    3232#include "Model.h"
     33#include "core/GameMode.h"
    3334#include "core/CoreIncludes.h"
    3435#include "core/XMLPort.h"
     
    7071    void Model::changedMesh()
    7172    {
    72         if (Core::showsGraphics())
     73        if (GameMode::showsGraphics())
    7374        {
    7475            if (this->mesh_.getEntity())
  • code/branches/questsystem5/src/orxonox/objects/worldentities/MovableEntity.cc

    r2662 r2907  
    3434#include "core/XMLPort.h"
    3535#include "core/Executor.h"
    36 #include "core/Core.h"
     36#include "core/GameMode.h"
    3737
    3838namespace orxonox
     
    8989    void MovableEntity::resynchronize()
    9090    {
    91         if (Core::isMaster() && !this->continuousResynchroTimer_)
     91        if (GameMode::isMaster() && !this->continuousResynchroTimer_)
    9292        {
    9393            // Resynchronise every few seconds because we only work with velocities (no positions)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/ParticleEmitter.cc

    r2662 r2907  
    3939#include "tools/ParticleInterface.h"
    4040#include "util/Exception.h"
     41#include "core/GameMode.h"
    4142#include "core/CoreIncludes.h"
    4243#include "core/XMLPort.h"
     
    5152        RegisterObject(ParticleEmitter);
    5253
    53         if (Core::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))
     54        if (GameMode::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))
    5455            ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given.");
    5556
     
    107108        }
    108109
    109         if (Core::showsGraphics() && this->getScene() && this->getScene()->getSceneManager())
     110        if (GameMode::showsGraphics() && this->getScene() && this->getScene()->getSceneManager())
    110111        {
    111112            try
  • code/branches/questsystem5/src/orxonox/objects/worldentities/ParticleSpawner.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/ParticleSpawner.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/Planet.cc

    r2710 r2907  
    4242#include "CameraManager.h"
    4343#include "Camera.h"
    44 #include "GraphicsEngine.h"
     44#include "GraphicsManager.h"
    4545
    4646namespace orxonox
  • code/branches/questsystem5/src/orxonox/objects/worldentities/StaticEntity.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/StaticEntity.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/WorldEntity.cc

    r2662 r2907  
    181181
    182182        // Attach to parent if necessary
    183         registerVariable(this->parentID_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::parentChanged));
     183        registerVariable(this->parentID_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged));
    184184    }
    185185
     
    188188        Network function that object this instance to its correct parent.
    189189    */
    190     void WorldEntity::parentChanged()
     190    void WorldEntity::networkcallback_parentChanged()
    191191    {
    192192        if (this->parentID_ != OBJECTID_UNKNOWN)
     
    362362        this->parentID_ = newParent->getObjectID();
    363363
     364        this->parentChanged();
     365
    364366        // apply transform to collision shape
    365367        this->collisionShape_->setPosition(this->getPosition());
    366368        this->collisionShape_->setOrientation(this->getOrientation());
    367369        // TODO: Scale
    368        
     370
    369371        return true;
    370372    }
     
    406408        this->parent_ = 0;
    407409        this->parentID_ = OBJECTID_UNKNOWN;
     410
     411        this->parentChanged();
    408412
    409413        // reset orientation of the collisionShape (cannot be set within a WE usually)
     
    488492
    489493    // Note: These functions are placed in WorldEntity.h as inline functions for the release build.
    490 #ifndef _NDEBUG
     494#ifndef NDEBUG
    491495    const Vector3& WorldEntity::getPosition() const
    492496    {
     
    656660        case TransformSpace::World:
    657661            ogreRelativeTo = Ogre::Node::TS_WORLD; break;
     662        default: OrxAssert(false, "Faulty TransformSpace::Enum assigned.");
    658663        }
    659664        this->node_->setDirection(direction, ogreRelativeTo, localDirectionVector);
     
    755760        {
    756761        case Dynamic:
    757             this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !(btCollisionObject::CF_STATIC_OBJECT | btCollisionObject::CF_KINEMATIC_OBJECT));
     762            this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT & !btCollisionObject::CF_KINEMATIC_OBJECT);
    758763            break;
    759764        case Kinematic:
  • code/branches/questsystem5/src/orxonox/objects/worldentities/WorldEntity.h

    r2662 r2907  
    3333#include "OrxonoxPrereqs.h"
    3434
    35 #ifdef _NDEBUG
     35#ifdef NDEBUG
    3636#include <OgreSceneNode.h>
    3737#else
     
    176176
    177177        protected:
     178            virtual void parentChanged() {}
     179
    178180            Ogre::SceneNode* node_;
    179181
     
    191193
    192194            // network callbacks
    193             void parentChanged();
     195            void networkcallback_parentChanged();
    194196            inline void scaleChanged()
    195197                { this->setScale3D(this->getScale3D()); }
     
    269271            @brief
    270272                Sets how much reaction is applied in a collision.
    271                
     273
    272274                Consider two equal spheres colliding with equal velocities:
    273275                Restitution 1 means that both spheres simply reverse their velocity (no loss of energy)
     
    419421
    420422    // Inline heavily used functions for release builds. In debug, we better avoid including OgreSceneNode here.
    421 #ifdef _NDEBUG
     423#ifdef NDEBUG
    422424    inline const Vector3& WorldEntity::getPosition() const
    423425        { return this->node_->getPosition(); }
    424426    inline const Quaternion& WorldEntity::getOrientation() const
    425         { return this->node_->getrOrientation(); }
     427        { return this->node_->getOrientation(); }
    426428    inline const Vector3& WorldEntity::getScale3D(void) const
    427429        { return this->node_->getScale(); }
  • code/branches/questsystem5/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2662 r2907  
    3030#include "Pawn.h"
    3131
    32 #include "core/Core.h"
     32#include "core/GameMode.h"
    3333#include "core/CoreIncludes.h"
    3434#include "core/XMLPort.h"
     
    6363        this->getPickUp().setPlayer(this);
    6464
    65         if (Core::isMaster())
     65        if (GameMode::isMaster())
    6666        {
    6767            this->weaponSystem_ = new WeaponSystem(this);
     
    133133    }
    134134
     135    void Pawn::setPlayer(PlayerInfo* player)
     136    {
     137        ControllableEntity::setPlayer(player);
     138
     139        if (this->getGametype())
     140            this->getGametype()->playerStartsControllingPawn(player, this);
     141    }
     142
     143    void Pawn::removePlayer()
     144    {
     145        if (this->getGametype())
     146            this->getGametype()->playerStopsControllingPawn(this->getPlayer(), this);
     147
     148        ControllableEntity::removePlayer();
     149    }
     150
    135151    void Pawn::setHealth(float health)
    136152    {
     
    140156    void Pawn::damage(float damage, Pawn* originator)
    141157    {
    142         this->setHealth(this->health_ - damage);
    143         this->lastHitOriginator_ = originator;
    144 
    145         // play damage effect
     158        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
     159        {
     160            this->setHealth(this->health_ - damage);
     161            this->lastHitOriginator_ = originator;
     162
     163            // play damage effect
     164        }
    146165    }
    147166
    148167    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    149168    {
    150         this->damage(damage, originator);
    151         this->setVelocity(this->getVelocity() + force);
    152 
    153         // play hit effect
     169        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))
     170        {
     171            this->damage(damage, originator);
     172            this->setVelocity(this->getVelocity() + force);
     173
     174            // play hit effect
     175        }
    154176    }
    155177
     
    176198    void Pawn::death()
    177199    {
    178         // Set bAlive_ to false and wait for PawnManager to do the destruction
    179         this->bAlive_ = false;
    180 
    181         this->setDestroyWhenPlayerLeft(false);
    182 
    183         if (this->getGametype())
    184             this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
    185 
    186         if (this->getPlayer())
    187             this->getPlayer()->stopControl(this);
    188 
    189         if (Core::isMaster())
    190             this->deatheffect();
     200        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
     201        {
     202            // Set bAlive_ to false and wait for PawnManager to do the destruction
     203            this->bAlive_ = false;
     204
     205            this->setDestroyWhenPlayerLeft(false);
     206
     207            if (this->getGametype())
     208                this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
     209
     210            if (this->getPlayer())
     211                this->getPlayer()->stopControl(this);
     212
     213            if (GameMode::isMaster())
     214                this->deatheffect();
     215        }
     216        else
     217            this->setHealth(1);
    191218    }
    192219
     
    222249            ExplosionChunk* chunk = new ExplosionChunk(this->getCreator());
    223250            chunk->setPosition(this->getPosition());
    224 
    225251        }
    226252    }
     
    234260    {
    235261        this->setHealth(this->initialHealth_);
    236         if (Core::isMaster())
     262        if (GameMode::isMaster())
    237263            this->spawneffect();
    238264    }
     
    243269    }
    244270
     271
     272    /* WeaponSystem:
     273    *   functions load Slot, Set, Pack from XML and make sure all parent-pointers are set.
     274    *   with setWeaponPack you can not just load a Pack from XML but if a Pack already exists anywhere, you can attach it.
     275    *       --> e.g. Pickup-Items
     276    */
    245277    void Pawn::setWeaponSlot(WeaponSlot * wSlot)
    246278    {
  • code/branches/questsystem5/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2662 r2907  
    4747            virtual void tick(float dt);
    4848            void registerVariables();
     49
     50            virtual void setPlayer(PlayerInfo* player);
     51            virtual void removePlayer();
    4952
    5053            inline bool isAlive() const
  • code/branches/questsystem5/src/orxonox/objects/worldentities/pawns/Spectator.cc

    r2662 r2907  
    3434#include "core/CoreIncludes.h"
    3535#include "core/ConfigValueIncludes.h"
    36 #include "core/Core.h"
     36#include "core/GameMode.h"
    3737#include "objects/worldentities/Model.h"
    3838#include "objects/Scene.h"
     
    6363        this->setDestroyWhenPlayerLeft(true);
    6464
    65         if (Core::showsGraphics())
     65        if (GameMode::showsGraphics())
    6666        {
    6767            this->greetingFlare_ = new BillboardSet();
     
    206206        this->bGreeting_ = !this->bGreeting_;
    207207
    208         if (Core::isMaster())
     208        if (GameMode::isMaster())
    209209        {
    210210            this->bGreetingFlareVisible_ = this->bGreeting_;
  • code/branches/questsystem5/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/questsystem5/src/orxonox/objects/worldentities/triggers/Trigger.cc

    r2710 r2907  
    3636#include "core/ConsoleCommand.h"
    3737#include "core/XMLPort.h"
    38 #include "core/Core.h"
     38#include "core/GameMode.h"
    3939#include "objects/Scene.h"
    4040
     
    6767//    this->bUpdating_ = false;
    6868
    69     if (this->getScene() && Core::showsGraphics())
     69    if (this->getScene() && GameMode::showsGraphics())
    7070    {
    7171      this->debugBillboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
  • code/branches/questsystem5/src/orxonox/objects/worldentities/triggers/Trigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.