Changeset 2768 for code/branches/miniprojects/src/orxonox
- Timestamp:
- Mar 9, 2009, 3:21:12 AM (16 years ago)
- Location:
- code/branches/miniprojects/src/orxonox
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/miniprojects/src/orxonox/gamestates/GSLevel.cc
r2710 r2768 49 49 namespace orxonox 50 50 { 51 SetCommandLineArgument(level, "presentation .oxw").shortcut("l");51 SetCommandLineArgument(level, "presentation_dm.oxw").shortcut("l"); 52 52 53 53 GSLevel::GSLevel() -
code/branches/miniprojects/src/orxonox/objects/CMakeLists.txt
r2710 r2768 8 8 RadarListener.cc 9 9 RadarViewable.cc 10 Teamcolourable.cc 10 11 Tickable.cc 11 12 Test.cc -
code/branches/miniprojects/src/orxonox/objects/Level.cc
r2710 r2768 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 -
code/branches/miniprojects/src/orxonox/objects/gametypes/CMakeLists.txt
r2710 r2768 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 Gametype.cc 3 TeamGametype.cc 3 4 ) -
code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.cc
r2710 r2768 66 66 this->setConfigValues(); 67 67 68 this->addBots(this->numberOfBots_);69 70 68 // load the corresponding score board 71 69 if (Core::showsGraphics() && this->scoreboardTemplate_ != "") … … 105 103 void Gametype::start() 106 104 { 105 this->addBots(this->numberOfBots_); 106 107 107 COUT(0) << "game started" << std::endl; 108 108 this->gtinfo_.bStarted_ = true; … … 166 166 void Gametype::pawnPostSpawn(Pawn* pawn) 167 167 { 168 } 169 170 void Gametype::playerPreSpawn(PlayerInfo* player) 171 { 172 } 173 174 void Gametype::playerPostSpawn(PlayerInfo* player) 175 { 176 } 177 178 bool Gametype::allowPawnHit(Pawn* victim, Pawn* originator) 179 { 180 return true; 181 } 182 183 bool Gametype::allowPawnDamage(Pawn* victim, Pawn* originator) 184 { 185 return true; 186 } 187 188 bool Gametype::allowPawnDeath(Pawn* victim, Pawn* originator) 189 { 190 return true; 168 191 } 169 192 … … 336 359 if (spawnpoint) 337 360 { 361 this->playerPreSpawn(player); 338 362 player->startControl(spawnpoint->spawn()); 339 363 this->players_[player].state_ = PlayerState::Alive; 364 this->playerPostSpawn(player); 340 365 } 341 366 else -
code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.h
r2662 r2768 91 91 virtual void playerScored(Player& player); 92 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); 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); 96 102 97 103 inline const std::map<PlayerInfo*, Player>& getPlayers() const … … 112 118 { return this->players_.size(); } 113 119 114 pr ivate:120 protected: 115 121 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const; 116 122 -
code/branches/miniprojects/src/orxonox/objects/worldentities/Billboard.h
r2662 r2768 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/miniprojects/src/orxonox/objects/worldentities/CMakeLists.txt
r2710 r2768 19 19 Planet.cc 20 20 SpawnPoint.cc 21 TeamSpawnPoint.cc 21 22 ) 22 23 -
code/branches/miniprojects/src/orxonox/objects/worldentities/Light.h
r2662 r2768 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/miniprojects/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2662 r2768 140 140 void Pawn::damage(float damage, Pawn* originator) 141 141 { 142 this->setHealth(this->health_ - damage); 143 this->lastHitOriginator_ = originator; 144 145 // play damage effect 142 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator)) 143 { 144 this->setHealth(this->health_ - damage); 145 this->lastHitOriginator_ = originator; 146 147 // play damage effect 148 } 146 149 } 147 150 148 151 void Pawn::hit(Pawn* originator, const Vector3& force, float damage) 149 152 { 150 this->damage(damage, originator); 151 this->setVelocity(this->getVelocity() + force); 152 153 // play hit effect 153 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator)) 154 { 155 this->damage(damage, originator); 156 this->setVelocity(this->getVelocity() + force); 157 158 // play hit effect 159 } 154 160 } 155 161 … … 176 182 void Pawn::death() 177 183 { 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(); 184 if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_)) 185 { 186 // Set bAlive_ to false and wait for PawnManager to do the destruction 187 this->bAlive_ = false; 188 189 this->setDestroyWhenPlayerLeft(false); 190 191 if (this->getGametype()) 192 this->getGametype()->pawnKilled(this, this->lastHitOriginator_); 193 194 if (this->getPlayer()) 195 this->getPlayer()->stopControl(this); 196 197 if (Core::isMaster()) 198 this->deatheffect(); 199 } 200 else 201 this->setHealth(1); 191 202 } 192 203
Note: See TracChangeset
for help on using the changeset viewer.