Changeset 2907 for code/branches/questsystem5/src/orxonox/objects
- Timestamp:
- Apr 8, 2009, 12:36:08 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 22 added
- 106 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/CMakeLists.txt
r2710 r2907 8 8 RadarListener.cc 9 9 RadarViewable.cc 10 Teamcolourable.cc 10 11 Tickable.cc 11 12 Test.cc -
code/branches/questsystem5/src/orxonox/objects/EventTarget.cc
r2662 r2907 66 66 void EventTarget::addAsEvent(BaseObject* object) 67 67 { 68 if (object != (BaseObject*)this)68 if (object != static_cast<BaseObject*>(this)) 69 69 object->addEvent(this, ""); 70 70 } -
code/branches/questsystem5/src/orxonox/objects/Level.cc
- Property svn:mergeinfo changed
/code/branches/miniprojects/src/orxonox/objects/Level.cc (added) merged: 2768
r2710 r2907 105 105 { 106 106 Identifier* identifier = ClassByString(gametype); 107 if (identifier && identifier->isA(Class(Gametype))) 107 108 if (!identifier || !identifier->isA(Class(Gametype))) 108 109 { 110 COUT(0) << "Error: \"" << gametype << "\" is not a valid gametype." << std::endl; 111 identifier = Class(Gametype); 112 this->gametype_ = "Gametype"; 113 } 114 else 109 115 this->gametype_ = gametype; 110 116 111 Gametype* rootgametype = dynamic_cast<Gametype*>(identifier->fabricate(this)); 112 this->setGametype(rootgametype); 117 std::cout << "Load Gametype: " << this->gametype_ << std::endl; 113 118 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); 116 121 117 if (LevelManager::getInstancePtr()) 118 LevelManager::getInstance().requestActivity(this); 119 } 122 std::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); 120 129 } 121 130 - Property svn:mergeinfo changed
-
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 144 144 for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it) 145 145 { 146 if (*it == (RadarViewable*)this->owner_)146 if (*it == static_cast<RadarViewable*>(this)->owner_) 147 147 continue; 148 148 -
code/branches/questsystem5/src/orxonox/objects/Scene.cc
r2662 r2907 41 41 42 42 #include "core/CoreIncludes.h" 43 #include "core/ Core.h"43 #include "core/GameMode.h" 44 44 #include "core/XMLPort.h" 45 45 #include "tools/BulletConversions.h" … … 57 57 this->bShadows_ = true; 58 58 59 if ( Core::showsGraphics())59 if (GameMode::showsGraphics()) 60 60 { 61 61 if (Ogre::Root::getSingletonPtr()) … … 99 99 Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_); 100 100 } 101 else if (! Core::showsGraphics())101 else if (!GameMode::showsGraphics()) 102 102 { 103 103 delete this->sceneManager_; … … 227 227 void Scene::tick(float dt) 228 228 { 229 if (! Core::showsGraphics())229 if (!GameMode::showsGraphics()) 230 230 { 231 231 // We need to update the scene nodes if we don't render … … 256 256 void Scene::setSkybox(const std::string& skybox) 257 257 { 258 if ( Core::showsGraphics() && this->sceneManager_)258 if (GameMode::showsGraphics() && this->sceneManager_) 259 259 this->sceneManager_->setSkyBox(true, skybox); 260 260 … … 264 264 void Scene::setAmbientLight(const ColourValue& colour) 265 265 { 266 if ( Core::showsGraphics() && this->sceneManager_)266 if (GameMode::showsGraphics() && this->sceneManager_) 267 267 this->sceneManager_->setAmbientLight(colour); 268 268 … … 272 272 void Scene::setShadow(bool bShadow) 273 273 { 274 if ( Core::showsGraphics() && this->sceneManager_)274 if (GameMode::showsGraphics() && this->sceneManager_) 275 275 { 276 276 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 30 30 #include "AIController.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/Executor.h" … … 45 45 RegisterObject(AIController); 46 46 47 if ( Core::isMaster())47 if (GameMode::isMaster()) 48 48 this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action))); 49 49 } -
code/branches/questsystem5/src/orxonox/objects/controllers/CMakeLists.txt
r2710 r2907 5 5 AIController.cc 6 6 ScriptController.cc 7 PongAI.cc 7 8 ) -
code/branches/questsystem5/src/orxonox/objects/controllers/Controller.cc
r2662 r2907 43 43 this->player_ = 0; 44 44 this->controllableEntity_ = 0; 45 this->hud_ = 0;46 this->bUpdateHUD_ = false;47 45 } 48 46 49 47 Controller::~Controller() 50 48 { 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 }81 49 } 82 50 } -
code/branches/questsystem5/src/orxonox/objects/controllers/Controller.h
r2662 r2907 57 57 inline ControllableEntity* getControllableEntity() const 58 58 { 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() {} 77 60 78 61 protected: 79 void updateHUD();80 81 62 PlayerInfo* player_; 82 63 ControllableEntity* controllableEntity_; 83 std::string hudtemplate_;84 OverlayGroup* hud_;85 bool bUpdateHUD_;86 64 }; 87 65 } -
code/branches/questsystem5/src/orxonox/objects/controllers/HumanController.cc
r2662 r2907 35 35 #include "objects/worldentities/pawns/Pawn.h" 36 36 #include "objects/gametypes/Gametype.h" 37 #include "objects/infos/PlayerInfo.h" 37 38 38 39 namespace orxonox … … 157 158 if (pawn) 158 159 pawn->kill(); 160 else if (HumanController::localController_s->player_) 161 HumanController::localController_s->player_->stopControl(HumanController::localController_s->controllableEntity_); 159 162 } 160 163 } -
code/branches/questsystem5/src/orxonox/objects/gametypes/CMakeLists.txt
r2710 r2907 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 Gametype.cc 3 Deathmatch.cc 4 TeamDeathmatch.cc 5 Pong.cc 3 6 ) -
code/branches/questsystem5/src/orxonox/objects/gametypes/Gametype.cc
r2710 r2907 36 36 #include "core/ConfigValueIncludes.h" 37 37 #include "core/Template.h" 38 #include "core/ Core.h"38 #include "core/GameMode.h" 39 39 #include "overlays/OverlayGroup.h" 40 40 #include "objects/infos/PlayerInfo.h" … … 44 44 #include "objects/worldentities/Camera.h" 45 45 46 #include "network/Host.h"47 48 46 namespace orxonox 49 47 { … … 66 64 this->setConfigValues(); 67 65 68 this->addBots(this->numberOfBots_);69 70 66 // load the corresponding score board 71 if ( Core::showsGraphics() && this->scoreboardTemplate_ != "")67 if (GameMode::showsGraphics() && this->scoreboardTemplate_ != "") 72 68 { 73 69 this->scoreboard_ = new OverlayGroup(this); … … 105 101 void Gametype::start() 106 102 { 107 COUT(0) << "game started" << std::endl; 103 this->addBots(this->numberOfBots_); 104 108 105 this->gtinfo_.bStarted_ = true; 109 106 … … 113 110 void Gametype::end() 114 111 { 115 COUT(0) << "game ended" << std::endl;116 112 this->gtinfo_.bEnded_ = true; 117 113 } … … 120 116 { 121 117 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) 129 121 { 130 122 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); … … 132 124 { 133 125 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; 139 129 } 140 130 … … 147 137 } 148 138 149 voidGametype::playerChangedName(PlayerInfo* player)139 bool Gametype::playerChangedName(PlayerInfo* player) 150 140 { 151 141 if (this->players_.find(player) != this->players_.end()) … … 153 143 if (player->getName() != player->getOldName()) 154 144 { 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; 160 149 } 161 150 … … 168 157 } 169 158 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 170 190 void Gametype::pawnKilled(Pawn* victim, Pawn* killer) 171 191 { 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 else180 message = victim->getPlayer()->getName() + " was killed";181 }182 else183 message = victim->getPlayer()->getName() + " died";184 185 COUT(0) << message << std::endl;186 Host::Broadcast(message);187 }188 189 192 if (victim && victim->getPlayer()) 190 193 { … … 198 201 if (killer) 199 202 { 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_++; 207 206 } 208 207 … … 225 224 } 226 225 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; 230 240 } 231 241 … … 336 346 if (spawnpoint) 337 347 { 348 this->playerPreSpawn(player); 338 349 player->startControl(spawnpoint->spawn()); 339 350 this->players_[player].state_ = PlayerState::Alive; 351 this->playerPostSpawn(player); 340 352 } 341 353 else … … 349 361 { 350 362 for (unsigned int i = 0; i < amount; ++i) 351 new Bot(this);363 this->botclass_.fabricate(this); 352 364 } 353 365 -
code/branches/questsystem5/src/orxonox/objects/gametypes/Gametype.h
r2662 r2907 84 84 virtual void end(); 85 85 virtual void playerEntered(PlayerInfo* player); 86 virtual voidplayerLeft(PlayerInfo* player);86 virtual bool playerLeft(PlayerInfo* player); 87 87 virtual void playerSwitched(PlayerInfo* player, Gametype* newgametype); 88 88 virtual void playerSwitchedBack(PlayerInfo* player, Gametype* oldgametype); 89 virtual voidplayerChangedName(PlayerInfo* player);89 virtual bool playerChangedName(PlayerInfo* player); 90 90 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); 92 96 93 97 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 94 98 virtual void pawnPreSpawn(Pawn* pawn); 95 99 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); 96 105 97 106 inline const std::map<PlayerInfo*, Player>& getPlayers() const 98 107 { return this->players_; } 108 109 int getScore(PlayerInfo* player) const; 99 110 100 111 inline void registerSpawnPoint(SpawnPoint* spawnpoint) … … 106 117 { return this->gtinfo_.startCountdown_; } 107 118 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 108 124 void addBots(unsigned int amount); 109 125 void killBots(unsigned int amount = 0); … … 112 128 { return this->players_.size(); } 113 129 114 pr ivate:130 protected: 115 131 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const; 116 132 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(); 125 138 126 139 GametypeInfo gtinfo_; … … 131 144 float initialStartCountdown_; 132 145 unsigned int numberOfBots_; 146 SubclassIdentifier<Bot> botclass_; 133 147 134 148 std::map<PlayerInfo*, Player> players_; -
code/branches/questsystem5/src/orxonox/objects/infos/Bot.cc
r2662 r2907 30 30 #include "Bot.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 46 46 47 47 this->bHumanPlayer_ = false; 48 this->bLocalPlayer_ = Core::isMaster();48 this->bLocalPlayer_ = GameMode::isMaster(); 49 49 this->bSetUnreadyAfterSpawn_ = false; 50 50 this->setReadyToSpawn(true); -
code/branches/questsystem5/src/orxonox/objects/infos/CMakeLists.txt
r2710 r2907 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 Bot.cc 3 PongBot.cc 3 4 Info.cc 4 5 PlayerInfo.cc -
code/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.cc
r2662 r2907 58 58 registerVariable(this->startCountdown_, variableDirection::toclient); 59 59 registerVariable(this->bStartCountdownRunning_, variableDirection::toclient); 60 registerVariable(this->hudtemplate_, variableDirection::toclient); 60 61 } 61 62 } -
code/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.h
r2662 r2907 56 56 { return this->startCountdown_; } 57 57 58 inline const std::string& getHUDTemplate() const 59 { return this->hudtemplate_; } 60 58 61 private: 59 62 bool bStarted_; … … 61 64 bool bStartCountdownRunning_; 62 65 float startCountdown_; 66 std::string hudtemplate_; 63 67 }; 64 68 } -
code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.cc
r2662 r2907 30 30 #include "HumanPlayer.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 47 47 RegisterObject(HumanPlayer); 48 48 49 this->server_initialized_ = Core::isMaster();49 this->server_initialized_ = GameMode::isMaster(); 50 50 this->client_initialized_ = false; 51 51 … … 53 53 this->defaultController_ = Class(HumanController); 54 54 55 this->humanHud_ = 0; 56 this->gametypeHud_ = 0; 57 55 58 this->setConfigValues(); 56 59 this->registerVariables(); … … 59 62 HumanPlayer::~HumanPlayer() 60 63 { 64 if (this->BaseObject::isInitialized()) 65 { 66 if (this->humanHud_) 67 delete this->humanHud_; 68 69 if (this->gametypeHud_) 70 delete this->gametypeHud_; 71 } 61 72 } 62 73 … … 82 93 this->synchronize_nick_ = this->nick_; 83 94 84 if ( Core::isMaster())95 if (GameMode::isMaster()) 85 96 this->setName(this->nick_); 86 97 } … … 89 100 void HumanPlayer::configvaluecallback_changedHUDTemplate() 90 101 { 91 this-> changedController();102 this->setHumanHUDTemplate(this->hudtemplate_); 92 103 } 93 104 … … 105 116 this->client_initialized_ = true; 106 117 107 if (! Core::isMaster())118 if (!GameMode::isMaster()) 108 119 this->setObjectMode(objectDirection::bidirectional); 109 120 else … … 111 122 112 123 this->createController(); 124 this->updateHumanHUD(); 113 125 } 114 126 } … … 146 158 } 147 159 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()); 156 206 } 157 207 } -
code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.h
r2662 r2907 51 51 void setClientID(unsigned int clientID); 52 52 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_; } 54 81 55 82 protected: … … 61 88 void networkcallback_client_initialized(); 62 89 90 void updateHumanHUD(); 91 void updateGametypeHUD(); 92 63 93 std::string nick_; 64 94 std::string synchronize_nick_; … … 66 96 bool server_initialized_; 67 97 bool client_initialized_; 98 99 std::string humanHudTemplate_; 100 OverlayGroup* humanHud_; 101 std::string gametypeHudTemplate_; 102 OverlayGroup* gametypeHud_; 68 103 }; 69 104 } -
code/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.cc
r2662 r2907 110 110 void PlayerInfo::createController() 111 111 { 112 if (this->controller_) 113 { 114 delete this->controller_; 115 this->controller_ = 0; 116 } 112 117 this->controller_ = this->defaultController_.fabricate(this); 113 118 assert(this->controller_); … … 141 146 if (this->controller_) 142 147 this->controller_->setControllableEntity(entity); 148 149 this->changedControllableEntity(); 143 150 } 144 151 … … 155 162 if (callback) 156 163 entity->removePlayer(); 164 165 this->changedControllableEntity(); 157 166 } 158 167 } -
code/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.h
r2662 r2907 49 49 virtual void changedGametype(); 50 50 51 virtual void changedController() {} 52 virtual void changedControllableEntity() {} 53 51 54 inline bool isHumanPlayer() const 52 55 { return this->bHumanPlayer_; } … … 73 76 inline Controller* getController() const 74 77 { return this->controller_; } 75 virtual void changedController() {}76 78 77 79 protected: -
code/branches/questsystem5/src/orxonox/objects/items/MultiStateEngine.cc
r2662 r2907 30 30 #include "MultiStateEngine.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" … … 123 123 } 124 124 125 if ( Core::isMaster())125 if (GameMode::isMaster()) 126 126 { 127 127 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 89 89 ExecutorMember<BaseObject>* executor = createExecutor(createFunctor(&BaseObject::setActive)); 90 90 executor->setDefaultValues(true); 91 RespawnTimer_.setTimer(this->respawntimer_, false, (BaseObject*)this, executor);91 RespawnTimer_.setTimer(this->respawntimer_, false, this, executor); 92 92 COUT(0) << "TIMER SET" << std::endl; 93 93 } -
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 42 42 #include "orxonox/objects/infos/PlayerInfo.h" 43 43 #include "QuestManager.h" 44 #include "QuestDescription.h" ;44 #include "QuestDescription.h" 45 45 #include "Quest.h" 46 46 -
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 105 105 void Munition::fillBullets() 106 106 { 107 //COUT(0) << "Munition::fillBullets maxBullets_=" << this->maxBullets_ << std::endl;108 107 this->bullets_ = this->maxBullets_; 109 108 } -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/Weapon.cc
r2662 r2907 42 42 { 43 43 RegisterObject(Weapon); 44 44 45 this->bulletReadyToShoot_ = true; 45 46 this->magazineReadyToShoot_ = true; 46 47 this->parentWeaponSystem_ = 0; 47 48 this->attachedToWeaponSlot_ = 0; 48 this->munition_ = 0;49 49 this->bulletLoadingTime_ = 0; 50 50 this->magazineLoadingTime_ = 0; 51 51 this->bReloading_ = false; 52 52 this->bulletAmount_= 0; 53 this->magazineAmount_ = 0; 54 this->munition_ = 0; 55 this->unlimitedMunition_ = false; 53 56 this->setObjectMode(0x0); 54 57 } … … 65 68 XMLPortParam(Weapon, "bulletLoadingTime", setBulletLoadingTime, getBulletLoadingTime, xmlelement, mode); 66 69 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); 67 73 } 68 74 … … 73 79 } 74 80 81 void Weapon::setMunition() 82 { 83 this->munition_->setMaxBullets(this->bulletAmount_); 84 this->munition_->setMaxMagazines(this->magazineAmount_); 85 } 75 86 76 87 void Weapon::fire() 77 88 { 78 //COUT(0) << "LaserGun::fire, this=" << this << std::endl;79 89 if ( this->bulletReadyToShoot_ && this->magazineReadyToShoot_ && !this->bReloading_) 80 90 { 81 //COUT(0) << "LaserGun::fire - ready to shoot" << std::endl;82 //COUT(0) << "LaserGun::fire - bullets" << this->munition_->bullets() << std::endl;83 91 this->bulletReadyToShoot_ = false; 84 if ( this-> munition_->bullets() > 0)92 if ( this->unlimitedMunition_== true ) 85 93 { 86 94 //shoot 87 this-> takeBullets();95 this->reloadBullet(); 88 96 this->createProjectile(); 89 97 } 90 //if there are no bullets, but magazines91 else if ( this->munition_->magazines() > 0 && this->munition_->bullets() == 0 )92 {93 //COUT(0) << "LaserGun::fire - no bullets" << std::endl;94 this->takeMagazines();95 }96 98 else 97 99 { 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 } 100 118 } 101 119 } 102 120 else 103 121 { 104 //COUT(0) << "LaserGun::fire - weapon not reloaded - bullets remaining:" << this->munition_->bullets() << std::endl; 105 //actions 122 //weapon not reloaded 106 123 } 107 124 … … 109 126 110 127 128 //weapon reloading 111 129 void Weapon::bulletTimer(float bulletLoadingTime) 112 130 { 113 //COUT(0) << "Weapon::bulletTimer started" << std::endl;114 131 this->bReloading_ = true; 115 132 this->bulletReloadTimer_.setTimer( bulletLoadingTime , false , this , createExecutor(createFunctor(&Weapon::bulletReloaded))); … … 117 134 void Weapon::magazineTimer(float magazineLoadingTime) 118 135 { 119 //COUT(0) << "Weapon::magazineTimer started" << std::endl;120 136 this->bReloading_ = true; 121 137 this->magazineReloadTimer_.setTimer( magazineLoadingTime , false , this , createExecutor(createFunctor(&Weapon::magazineReloaded))); … … 132 148 this->bReloading_ = false; 133 149 this->munition_->fillBullets(); 134 this->magazineReadyToShoot_ = true; 135 this->bulletReadyToShoot_ = true; 136 } 150 } 151 137 152 138 153 139 154 void Weapon::attachNeededMunition(std::string munitionName) 140 155 { 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 WeaponSystem156 /* 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 */ 143 158 if (this->parentWeaponSystem_) 144 159 { 145 //COUT(0) << "Weapon::attachNeededMunition " << munitionName << std::endl; 160 //getMunitionType returns 0 if there is no such munitionType 146 161 Munition* munition = this->parentWeaponSystem_->getMunitionType(munitionName); 147 162 if ( munition ) 163 { 148 164 this->munition_ = munition; 165 this->setMunition(); 166 } 149 167 else 150 168 { 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 153 170 this->munitionIdentifier_ = ClassByString(munitionName); 154 171 this->munition_ = this->munitionIdentifier_.fabricate(this); 155 172 this->parentWeaponSystem_->setNewMunition(munitionName, this->munition_); 173 this->setMunition(); 156 174 } 157 175 } … … 159 177 160 178 161 /*get and set functions162 *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 184 179 Munition * Weapon::getAttachedMunition(std::string munitionType) 185 180 { 186 //COUT(0) << "Weapon::getAttachedMunition, parentWeaponSystem_="<< this->parentWeaponSystem_ << std::endl;187 181 this->munition_ = this->parentWeaponSystem_->getMunitionType(munitionType); 188 //COUT(0) << "Weapon::getAttachedMunition, munition_="<< this->munition_ << std::endl;189 182 return this->munition_; 190 183 } 191 184 185 186 //these function are defined in the weapon classes 192 187 void Weapon::takeBullets() { }; 193 188 void Weapon::createProjectile() { }; 194 189 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_; } 195 230 196 231 } -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/Weapon.h
r2662 r2907 62 62 void magazineReloaded(); 63 63 64 //XMLPort functions 64 65 virtual void setMunitionType(std::string munitionType); 65 66 virtual const std::string getMunitionType(); … … 68 69 virtual void setMagazineLoadingTime(float loadingTime); 69 70 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(); 70 77 78 //weapon actions 71 79 virtual void takeBullets(); 72 80 virtual void takeMagazines(); 73 81 virtual void createProjectile(); 82 virtual void reloadBullet(); 83 virtual void reloadMagazine(); 74 84 85 //manually set or reset 86 virtual void setWeapon(); 87 virtual void setMunition(); 88 75 89 inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem) 76 90 { this->parentWeaponSystem_=parentWeaponSystem; }; … … 83 97 { return this->attachedToWeaponSlot_; } 84 98 85 virtual void setWeapon();86 99 87 100 private: … … 91 104 bool bulletReadyToShoot_; 92 105 bool magazineReadyToShoot_; 106 bool unlimitedMunition_; 93 107 float bulletLoadingTime_; 94 108 float magazineLoadingTime_; 109 unsigned int bulletAmount_; 110 unsigned int magazineAmount_; 95 111 std::string munitionType_; 96 112 -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponPack.cc
r2710 r2907 63 63 for (int i=0; i < (int) this->weapons_.size(); i++) 64 64 { 65 //COUT(0) << "WeaponPack::fire (attached from WeaponSet) from Weapon: "<< i << std::endl;66 65 this->weapons_[i]->getAttachedToWeaponSlot()->fire(); 67 66 } … … 83 82 void WeaponPack::setFireMode(unsigned int firemode) 84 83 { 85 //COUT(0) << "WeaponPack::setFireMode " << std::endl;86 84 this->firemode_ = firemode; 87 85 } … … 94 92 void WeaponPack::addWeapon(Weapon * weapon) 95 93 { 96 //COUT(0) << "WeaponPack::addWeapon:" << weapon << " munition " << weapon->getMunitionType() << std::endl;97 94 this->weapons_.push_back(weapon); 98 95 } … … 117 114 { 118 115 this->weapons_[i]->attachNeededMunition(weapons_[i]->getMunitionType()); 119 //hack!120 116 this->weapons_[i]->setWeapon(); 121 117 } -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponPack.h
r2710 r2907 59 59 const Weapon * getWeapon(unsigned int index); 60 60 61 //functions with effect to all weapons of the weaponPack 61 62 //functions needed for creating Pointer to the right objects (-->Pawn.cc) 62 63 void setParentWeaponSystemToAllWeapons(WeaponSystem * weaponSystem); -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2662 r2907 56 56 void WeaponSet::attachWeaponPack(WeaponPack *wPack) 57 57 { 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;62 58 if ( this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) ) 63 59 { 64 //COUT(0) << "WeaponSet::attachWeaponPack after if" << std::endl;65 60 this->attachedWeaponPack_ = wPack; 66 61 int wPackWeapon = 0; //WeaponCounter for Attaching 62 67 63 //should be possible to choose which slot to use 64 //attach every weapon of the weaponPack to a weaponSlot 68 65 for ( int i=0; i < wPack->getSize() ; i++ ) 69 66 { 70 67 //at the moment this function only works for one weaponPack in the entire WeaponSystem... 68 //it also takes the first free weaponSlot... 71 69 if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 && this->parentWeaponSystem_->getWeaponSlotPointer(i) != 0) //if slot not full 72 70 { 73 //COUT(0) << "WeaponSet::attachWeaponPack attaching Weapon" << std::endl;74 71 this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) ); 75 72 this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) ); … … 83 80 if ( this->parentWeaponSystem_->getWeaponSlotPointer(k)->getAttachedWeapon() == 0 ) 84 81 { 85 //COUT(0) << "WeaponSet::attachWeaponPack mode 2 k="<< k << std::endl;86 82 this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(k) ); 87 83 this->parentWeaponSystem_->getWeaponSlotPointer(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) ); … … 99 95 { 100 96 //fires all WeaponSlots available for this weaponSet attached from the WeaponPack 101 //COUT(0) << "WeaponSet::fire from Pack: " << this->attachedWeaponPack_ << std::endl;102 97 if (this->attachedWeaponPack_) 103 98 this->attachedWeaponPack_->fire(); -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponSystem.cc
- Property svn:mergeinfo changed
/code/branches/weaponsystem/src/orxonox/objects/weaponSystem/WeaponSystem.cc (added) merged: 2778,2804,2852
r2710 r2907 38 38 39 39 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 43 41 * 42 * www.orxonox.net/wiki/WeaponSystem 44 43 */ 45 44 … … 52 51 RegisterObject(WeaponSystem); 53 52 54 this->activeWeaponSet_ = 0;55 53 this->parentPawn_ = 0; 56 54 } … … 84 82 } 85 83 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 87 86 Munition * WeaponSystem::getMunitionType(std::string munitionType) 88 87 { 89 //COUT(0) << "WeaponSystem::getMunitionType " << munitionType << std::endl;90 88 std::map<std::string, Munition *>::const_iterator it = this->munitionSet_.find(munitionType); 91 89 if (it != this->munitionSet_.end()) … … 96 94 97 95 98 /*99 //the first weaponSet is at n=0100 void WeaponSystem::setActiveWeaponSet(unsigned int n)101 {102 if (n < this->weaponSets_.size())103 this->activeWeaponSet_ = this->weaponSets_[n];104 else105 this->activeWeaponSet_ = this->weaponSets_[0];106 }107 */108 109 110 96 //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 112 99 void WeaponSystem::fire(WeaponMode::Enum n) 113 100 { … … 125 112 break; 126 113 } 127 //COUT(0) << "WeaponSystem::fire" << std::endl;128 114 if (set < (int)this->weaponSets_.size()) 129 //COUT(0) << "WeaponSystem::fire - after if" << std::endl;130 115 this->weaponSets_[set]->fire(); 131 116 } - Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/weaponSystem/WeaponSystem.h
- Property svn:mergeinfo changed
/code/branches/weaponsystem/src/orxonox/objects/weaponSystem/WeaponSystem.h (added) merged: 2778,2804,2852
r2710 r2907 53 53 //void fire(); 54 54 void fire(WeaponMode::Enum fireMode); 55 //void setActiveWeaponSet(unsigned int n);56 55 void attachWeaponPack(WeaponPack * wPack, unsigned int firemode); 57 56 WeaponSet * getWeaponSetPointer(unsigned int n); … … 59 58 WeaponPack * getWeaponPackPointer(unsigned int n); 60 59 void setNewMunition(std::string munitionType, Munition * munitionToAdd); 60 void setNewSharedMunition(std::string munitionType, Munition * munitionToAdd); 61 61 Munition * getMunitionType(std::string munitionType); 62 62 … … 74 74 std::vector<WeaponPack *> weaponPacks_; 75 75 std::map<std::string, Munition *> munitionSet_; 76 WeaponSet *activeWeaponSet_;77 76 Pawn *parentPawn_; 78 77 }; - Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/weaponSystem/munitions/CMakeLists.txt
r2710 r2907 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 LaserGunMunition.cc 3 FusionMunition.cc 3 4 ) -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc
r2662 r2907 43 43 RegisterObject(LaserGunMunition); 44 44 45 //default if not defined in XML 45 46 this->maxBullets_ = 40; 46 47 this->maxMagazines_ = 100; -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc
r2662 r2907 32 32 #include <OgreBillboardSet.h> 33 33 34 #include "core/ Core.h"34 #include "core/GameMode.h" 35 35 #include "core/CoreIncludes.h" 36 36 #include "objects/Scene.h" … … 44 44 RegisterObject(BillboardProjectile); 45 45 46 if ( Core::showsGraphics())46 if (GameMode::showsGraphics()) 47 47 { 48 48 assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity … … 56 56 BillboardProjectile::~BillboardProjectile() 57 57 { 58 if (this->isInitialized() && Core::showsGraphics() && this->billboard_.getBillboardSet())58 if (this->isInitialized() && GameMode::showsGraphics() && this->billboard_.getBillboardSet()) 59 59 this->detachOgreObject(this->billboard_.getBillboardSet()); 60 60 } -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc
r2662 r2907 33 33 #include <OgreParticleEmitter.h> 34 34 35 #include "core/ Core.h"35 #include "core/GameMode.h" 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/ConfigValueIncludes.h" … … 46 46 RegisterObject(ParticleProjectile); 47 47 48 if ( Core::showsGraphics())48 if (GameMode::showsGraphics()) 49 49 { 50 50 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal); -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
r2662 r2907 41 41 #include "objects/worldentities/ParticleSpawner.h" 42 42 #include "objects/collisionshapes/SphereCollisionShape.h" 43 #include "core/ Core.h"43 #include "core/GameMode.h" 44 44 45 45 namespace orxonox … … 55 55 // Get notification about collisions 56 56 57 if ( Core::isMaster())57 if (GameMode::isMaster()) 58 58 { 59 59 this->enableCollisionCallback(); … … 93 93 void Projectile::destroyObject() 94 94 { 95 if ( Core::isMaster())95 if (GameMode::isMaster()) 96 96 delete this; 97 97 } … … 99 99 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 100 100 { 101 if (!this->bDestroy_ && Core::isMaster())101 if (!this->bDestroy_ && GameMode::isMaster()) 102 102 { 103 103 this->bDestroy_ = true; -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
r2662 r2907 53 53 } 54 54 55 void LaserGun::reloadBullet() 56 { 57 this->bulletTimer(this->bulletLoadingTime_); 58 } 59 60 void LaserGun::reloadMagazine() 61 { 62 this->magazineTimer(this->magazineLoadingTime_); 63 } 64 55 65 void LaserGun::takeBullets() 56 66 { 57 //COUT(0) << "LaserGun::takeBullets" << std::endl;58 67 this->munition_->removeBullets(1); 59 this->bulletTimer(this->bulletLoadingTime_);60 68 } 61 69 … … 63 71 { 64 72 this->munition_->removeMagazines(1); 65 this->magazineTimer(this->magazineLoadingTime_);66 73 } 67 74 68 75 void LaserGun::createProjectile() 69 76 { 70 //COUT(0) << "LaserGun::createProjectile" << std::endl;71 77 BillboardProjectile* projectile = new ParticleProjectile(this); 72 78 projectile->setOrientation(this->getWorldOrientation()); -
code/branches/questsystem5/src/orxonox/objects/weaponSystem/weapons/LaserGun.h
r2662 r2907 51 51 virtual void takeMagazines(); 52 52 virtual void createProjectile(); 53 virtual void reloadBullet(); 54 virtual void reloadMagazine(); 53 55 54 56 private: -
code/branches/questsystem5/src/orxonox/objects/worldentities/Backlight.cc
- Property svn:mergeinfo changed
/code/branches/gui/src/orxonox/objects/worldentities/Backlight.cc (added) merged: 2848
r2710 r2907 33 33 #include <OgreSceneManager.h> 34 34 35 #include "core/ Core.h"35 #include "core/GameMode.h" 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/Executor.h" … … 58 58 this->tickcount_ = 0; 59 59 60 if ( Core::showsGraphics())60 if (GameMode::showsGraphics()) 61 61 { 62 62 if (!this->getScene()) - Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/worldentities/Backlight.h
- Property svn:mergeinfo changed
/code/branches/gui/src/orxonox/objects/worldentities/Backlight.h (added) merged: 2843
r2710 r2907 32 32 #include "OrxonoxPrereqs.h" 33 33 #include "FadingBillboard.h" 34 #include " gamestates/GSRoot.h"34 #include "tools/TimeFactorListener.h" 35 35 36 36 namespace orxonox - Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/worldentities/Billboard.cc
r2662 r2907 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/XMLPort.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "objects/Scene.h" 38 38 … … 81 81 if (!this->billboard_.getBillboardSet()) 82 82 { 83 if (this->getScene() && Core::showsGraphics())83 if (this->getScene() && GameMode::showsGraphics()) 84 84 { 85 85 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); … … 98 98 { 99 99 /* 100 if (this->getScene() && Core::showsGraphics() && (this->material_ != ""))100 if (this->getScene() && GameMode::showsGraphics() && (this->material_ != "")) 101 101 { 102 102 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); -
code/branches/questsystem5/src/orxonox/objects/worldentities/Billboard.h
r2662 r2907 34 34 #include "util/Math.h" 35 35 #include "tools/BillboardSet.h" 36 #include "objects/Teamcolourable.h" 36 37 37 38 namespace orxonox 38 39 { 39 class _OrxonoxExport Billboard : public StaticEntity 40 class _OrxonoxExport Billboard : public StaticEntity, public Teamcolourable 40 41 { 41 42 public: … … 61 62 { return this->colour_; } 62 63 64 virtual void setTeamColour(const ColourValue& colour) 65 { this->setColour(colour); } 66 63 67 protected: 64 68 inline BillboardSet& getBillboardSet() -
code/branches/questsystem5/src/orxonox/objects/worldentities/BlinkingBillboard.cc
r2662 r2907 30 30 #include "BlinkingBillboard.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" … … 77 77 SUPER(BlinkingBillboard, tick, dt); 78 78 79 if ( Core::isMaster() && this->isActive())79 if (GameMode::isMaster() && this->isActive()) 80 80 { 81 81 this->time_ += dt; -
code/branches/questsystem5/src/orxonox/objects/worldentities/CMakeLists.txt
r2710 r2907 19 19 Planet.cc 20 20 SpawnPoint.cc 21 TeamSpawnPoint.cc 22 PongCenterpoint.cc 23 PongBall.cc 24 PongBat.cc 21 25 ) 22 26 -
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 44 44 this->bDrag_ = false; 45 45 this->bAllowMouseLook_ = false; 46 this->bAbsolute_ = false; 46 47 47 48 this->setObjectMode(0x0); … … 58 59 XMLPortParam(CameraPosition, "drag", setDrag, getDrag, xmlelement, mode).defaultValues(false); 59 60 XMLPortParam(CameraPosition, "mouselook", setAllowMouseLook, getAllowMouseLook, xmlelement, mode).defaultValues(false); 61 XMLPortParam(CameraPosition, "absolute", setIsAbsolute, getIsAbsolute, xmlelement, mode).defaultValues(false); 60 62 } 61 63 -
code/branches/questsystem5/src/orxonox/objects/worldentities/CameraPosition.h
r2662 r2907 54 54 { return this->bAllowMouseLook_; } 55 55 56 inline void setIsAbsolute(bool bAbsolute) 57 { this->bAbsolute_ = bAbsolute; } 58 inline bool getIsAbsolute() const 59 { return this->bAbsolute_; } 60 56 61 void attachCamera(Camera* camera); 57 62 … … 59 64 bool bDrag_; 60 65 bool bAllowMouseLook_; 66 bool bAbsolute_; 61 67 }; 62 68 } -
code/branches/questsystem5/src/orxonox/objects/worldentities/ControllableEntity.cc
r2662 r2907 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/ConfigValueIncludes.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "core/XMLPort.h" 38 38 #include "core/Template.h" … … 144 144 void ControllableEntity::addCameraPosition(CameraPosition* position) 145 145 { 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 } 148 153 else 149 this->attach(position); 154 { 155 WorldEntity* parent = this->getParent(); 156 if (parent) 157 parent->attach(position); 158 } 150 159 this->cameraPositions_.push_back(position); 151 160 } … … 236 245 this->startLocalHumanControl(); 237 246 238 if (! Core::isMaster())247 if (!GameMode::isMaster()) 239 248 { 240 249 this->client_overwrite_ = this->server_overwrite_; … … 242 251 } 243 252 } 253 254 this->changedPlayer(); 244 255 } 245 256 … … 254 265 this->bHasHumanController_ = false; 255 266 this->setObjectMode(objectDirection::toclient); 267 268 this->changedPlayer(); 256 269 257 270 if (this->bDestroyWhenPlayerLeft_) … … 322 335 } 323 336 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 324 350 void ControllableEntity::tick(float dt) 325 351 { … … 331 357 if (!this->isDynamic()) 332 358 { 333 if ( Core::isMaster())359 if (GameMode::isMaster()) 334 360 { 335 361 this->server_position_ = this->getPosition(); … … 446 472 void ControllableEntity::setPosition(const Vector3& position) 447 473 { 448 if ( Core::isMaster())474 if (GameMode::isMaster()) 449 475 { 450 476 MobileEntity::setPosition(position); … … 461 487 void ControllableEntity::setOrientation(const Quaternion& orientation) 462 488 { 463 if ( Core::isMaster())489 if (GameMode::isMaster()) 464 490 { 465 491 MobileEntity::setOrientation(orientation); … … 476 502 void ControllableEntity::setVelocity(const Vector3& velocity) 477 503 { 478 if ( Core::isMaster())504 if (GameMode::isMaster()) 479 505 { 480 506 MobileEntity::setVelocity(velocity); … … 491 517 void ControllableEntity::setAngularVelocity(const Vector3& velocity) 492 518 { 493 if ( Core::isMaster())519 if (GameMode::isMaster()) 494 520 { 495 521 MobileEntity::setAngularVelocity(velocity); … … 507 533 { 508 534 MobileEntity::setWorldTransform(worldTrans); 509 if ( Core::isMaster())535 if (GameMode::isMaster()) 510 536 { 511 537 this->server_position_ = this->getPosition(); -
code/branches/questsystem5/src/orxonox/objects/worldentities/ControllableEntity.h
r2662 r2907 49 49 50 50 virtual void changedGametype(); 51 virtual void changedPlayer() {} 51 52 52 53 virtual void setPlayer(PlayerInfo* player); … … 136 137 virtual void startLocalHumanControl(); 137 138 virtual void stopLocalHumanControl(); 139 virtual void parentChanged(); 138 140 139 141 inline void setHudTemplate(const std::string& name) -
code/branches/questsystem5/src/orxonox/objects/worldentities/ExplosionChunk.cc
r2759 r2907 32 32 #include <OgreParticleSystem.h> 33 33 34 #include "core/ Core.h"34 #include "core/GameMode.h" 35 35 #include "core/CoreIncludes.h" 36 36 #include "core/Executor.h" … … 47 47 RegisterObject(ExplosionChunk); 48 48 49 if ( Core::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )49 if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) ) 50 50 ThrowException(AbortLoading, "Can't create ExplosionChunk, no scene or no scene manager given."); 51 51 … … 53 53 this->LOD_ = LODParticle::normal; 54 54 55 if ( Core::showsGraphics() )55 if ( GameMode::showsGraphics() ) 56 56 { 57 57 try … … 75 75 } 76 76 77 if ( Core::isMaster())77 if (GameMode::isMaster()) 78 78 { 79 79 Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)); … … 132 132 this->smoke_->setEnabled(false); 133 133 134 if ( Core::isMaster())134 if (GameMode::isMaster()) 135 135 { 136 136 this->bStop_ = true; … … 148 148 static const unsigned int CHANGES_PER_SECOND = 5; 149 149 150 if ( Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND)150 if (GameMode::isMaster() && rnd() < dt*CHANGES_PER_SECOND) 151 151 { 152 152 float length = this->getVelocity().length(); -
code/branches/questsystem5/src/orxonox/objects/worldentities/Light.cc
r2662 r2907 37 37 #include "util/String.h" 38 38 #include "util/Exception.h" 39 #include "core/ Core.h"39 #include "core/GameMode.h" 40 40 #include "core/CoreIncludes.h" 41 41 #include "core/XMLPort.h" … … 57 57 this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f); 58 58 59 if ( Core::showsGraphics())59 if (GameMode::showsGraphics()) 60 60 { 61 61 if (!this->getScene()) -
code/branches/questsystem5/src/orxonox/objects/worldentities/Light.h
r2662 r2907 37 37 38 38 #include "util/Math.h" 39 #include "objects/Teamcolourable.h" 39 40 40 41 namespace orxonox 41 42 { 42 class _OrxonoxExport Light : public StaticEntity 43 class _OrxonoxExport Light : public StaticEntity, public Teamcolourable 43 44 { 44 45 public: … … 68 69 inline const ColourValue& getSpecularColour() const 69 70 { return this->specular_; } 71 72 virtual void setTeamColour(const ColourValue& colour) 73 { this->setDiffuseColour(colour); this->setSpecularColour(colour); } 70 74 71 75 /** -
code/branches/questsystem5/src/orxonox/objects/worldentities/MobileEntity.cc
- Property svn:mergeinfo changed
/code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc merged: 2171-2660
r2710 r2907 182 182 // We use a dynamic body. So we translate our node accordingly. 183 183 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())); 185 186 this->linearVelocity_.x = this->physicalBody_->getLinearVelocity().x(); 186 187 this->linearVelocity_.y = this->physicalBody_->getLinearVelocity().y(); - Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/worldentities/MobileEntity.h
- Property svn:mergeinfo changed
/code/trunk/src/orxonox/objects/worldentities/MobileEntity.h merged: 2171-2660
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/worldentities/Model.cc
r2662 r2907 31 31 #include <OgreEntity.h> 32 32 #include "Model.h" 33 #include "core/GameMode.h" 33 34 #include "core/CoreIncludes.h" 34 35 #include "core/XMLPort.h" … … 70 71 void Model::changedMesh() 71 72 { 72 if ( Core::showsGraphics())73 if (GameMode::showsGraphics()) 73 74 { 74 75 if (this->mesh_.getEntity()) -
code/branches/questsystem5/src/orxonox/objects/worldentities/MovableEntity.cc
r2662 r2907 34 34 #include "core/XMLPort.h" 35 35 #include "core/Executor.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 38 38 namespace orxonox … … 89 89 void MovableEntity::resynchronize() 90 90 { 91 if ( Core::isMaster() && !this->continuousResynchroTimer_)91 if (GameMode::isMaster() && !this->continuousResynchroTimer_) 92 92 { 93 93 // Resynchronise every few seconds because we only work with velocities (no positions) -
code/branches/questsystem5/src/orxonox/objects/worldentities/ParticleEmitter.cc
r2662 r2907 39 39 #include "tools/ParticleInterface.h" 40 40 #include "util/Exception.h" 41 #include "core/GameMode.h" 41 42 #include "core/CoreIncludes.h" 42 43 #include "core/XMLPort.h" … … 51 52 RegisterObject(ParticleEmitter); 52 53 53 if ( Core::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))54 if (GameMode::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager())) 54 55 ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given."); 55 56 … … 107 108 } 108 109 109 if ( Core::showsGraphics() && this->getScene() && this->getScene()->getSceneManager())110 if (GameMode::showsGraphics() && this->getScene() && this->getScene()->getSceneManager()) 110 111 { 111 112 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 42 42 #include "CameraManager.h" 43 43 #include "Camera.h" 44 #include "Graphics Engine.h"44 #include "GraphicsManager.h" 45 45 46 46 namespace 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 181 181 182 182 // 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)); 184 184 } 185 185 … … 188 188 Network function that object this instance to its correct parent. 189 189 */ 190 void WorldEntity:: parentChanged()190 void WorldEntity::networkcallback_parentChanged() 191 191 { 192 192 if (this->parentID_ != OBJECTID_UNKNOWN) … … 362 362 this->parentID_ = newParent->getObjectID(); 363 363 364 this->parentChanged(); 365 364 366 // apply transform to collision shape 365 367 this->collisionShape_->setPosition(this->getPosition()); 366 368 this->collisionShape_->setOrientation(this->getOrientation()); 367 369 // TODO: Scale 368 370 369 371 return true; 370 372 } … … 406 408 this->parent_ = 0; 407 409 this->parentID_ = OBJECTID_UNKNOWN; 410 411 this->parentChanged(); 408 412 409 413 // reset orientation of the collisionShape (cannot be set within a WE usually) … … 488 492 489 493 // Note: These functions are placed in WorldEntity.h as inline functions for the release build. 490 #ifndef _NDEBUG494 #ifndef NDEBUG 491 495 const Vector3& WorldEntity::getPosition() const 492 496 { … … 656 660 case TransformSpace::World: 657 661 ogreRelativeTo = Ogre::Node::TS_WORLD; break; 662 default: OrxAssert(false, "Faulty TransformSpace::Enum assigned."); 658 663 } 659 664 this->node_->setDirection(direction, ogreRelativeTo, localDirectionVector); … … 755 760 { 756 761 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); 758 763 break; 759 764 case Kinematic: -
code/branches/questsystem5/src/orxonox/objects/worldentities/WorldEntity.h
r2662 r2907 33 33 #include "OrxonoxPrereqs.h" 34 34 35 #ifdef _NDEBUG35 #ifdef NDEBUG 36 36 #include <OgreSceneNode.h> 37 37 #else … … 176 176 177 177 protected: 178 virtual void parentChanged() {} 179 178 180 Ogre::SceneNode* node_; 179 181 … … 191 193 192 194 // network callbacks 193 void parentChanged();195 void networkcallback_parentChanged(); 194 196 inline void scaleChanged() 195 197 { this->setScale3D(this->getScale3D()); } … … 269 271 @brief 270 272 Sets how much reaction is applied in a collision. 271 273 272 274 Consider two equal spheres colliding with equal velocities: 273 275 Restitution 1 means that both spheres simply reverse their velocity (no loss of energy) … … 419 421 420 422 // Inline heavily used functions for release builds. In debug, we better avoid including OgreSceneNode here. 421 #ifdef _NDEBUG423 #ifdef NDEBUG 422 424 inline const Vector3& WorldEntity::getPosition() const 423 425 { return this->node_->getPosition(); } 424 426 inline const Quaternion& WorldEntity::getOrientation() const 425 { return this->node_->get rOrientation(); }427 { return this->node_->getOrientation(); } 426 428 inline const Vector3& WorldEntity::getScale3D(void) const 427 429 { return this->node_->getScale(); } -
code/branches/questsystem5/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2662 r2907 30 30 #include "Pawn.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" … … 63 63 this->getPickUp().setPlayer(this); 64 64 65 if ( Core::isMaster())65 if (GameMode::isMaster()) 66 66 { 67 67 this->weaponSystem_ = new WeaponSystem(this); … … 133 133 } 134 134 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 135 151 void Pawn::setHealth(float health) 136 152 { … … 140 156 void Pawn::damage(float damage, Pawn* originator) 141 157 { 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 } 146 165 } 147 166 148 167 void Pawn::hit(Pawn* originator, const Vector3& force, float damage) 149 168 { 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 } 154 176 } 155 177 … … 176 198 void Pawn::death() 177 199 { 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); 191 218 } 192 219 … … 222 249 ExplosionChunk* chunk = new ExplosionChunk(this->getCreator()); 223 250 chunk->setPosition(this->getPosition()); 224 225 251 } 226 252 } … … 234 260 { 235 261 this->setHealth(this->initialHealth_); 236 if ( Core::isMaster())262 if (GameMode::isMaster()) 237 263 this->spawneffect(); 238 264 } … … 243 269 } 244 270 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 */ 245 277 void Pawn::setWeaponSlot(WeaponSlot * wSlot) 246 278 { -
code/branches/questsystem5/src/orxonox/objects/worldentities/pawns/Pawn.h
r2662 r2907 47 47 virtual void tick(float dt); 48 48 void registerVariables(); 49 50 virtual void setPlayer(PlayerInfo* player); 51 virtual void removePlayer(); 49 52 50 53 inline bool isAlive() const -
code/branches/questsystem5/src/orxonox/objects/worldentities/pawns/Spectator.cc
r2662 r2907 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/ConfigValueIncludes.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "objects/worldentities/Model.h" 38 38 #include "objects/Scene.h" … … 63 63 this->setDestroyWhenPlayerLeft(true); 64 64 65 if ( Core::showsGraphics())65 if (GameMode::showsGraphics()) 66 66 { 67 67 this->greetingFlare_ = new BillboardSet(); … … 206 206 this->bGreeting_ = !this->bGreeting_; 207 207 208 if ( Core::isMaster())208 if (GameMode::isMaster()) 209 209 { 210 210 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
- Property svn:mergeinfo changed
/code/branches/gui/src/orxonox/objects/worldentities/triggers/Trigger.cc (added) merged: 2848
r2710 r2907 36 36 #include "core/ConsoleCommand.h" 37 37 #include "core/XMLPort.h" 38 #include "core/ Core.h"38 #include "core/GameMode.h" 39 39 #include "objects/Scene.h" 40 40 … … 67 67 // this->bUpdating_ = false; 68 68 69 if (this->getScene() && Core::showsGraphics())69 if (this->getScene() && GameMode::showsGraphics()) 70 70 { 71 71 this->debugBillboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); - Property svn:mergeinfo changed
-
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.