Changeset 2824
- Timestamp:
- Mar 23, 2009, 11:26:46 AM (16 years ago)
- Location:
- code/branches/miniprojects/src/orxonox
- Files:
-
- 8 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/miniprojects/src/orxonox/OrxonoxPrereqs.h
r2710 r2824 104 104 class RadarListener; 105 105 106 class Teamcolourable; 107 106 108 class CameraManager; 107 109 class LevelManager; … … 149 151 class ParticleSpawner; 150 152 153 class PongCenterpoint; 154 class PongBall; 155 class PongBat; 156 151 157 class Camera; 152 158 class CameraPosition; 153 159 class SpawnPoint; 160 class TeamSpawnPoint; 154 161 155 162 class Spectator; … … 193 200 194 201 class Gametype; 202 class Deathmatch; 203 class TeamDeathmatch; 204 class Pong; 195 205 196 206 class Scores; -
code/branches/miniprojects/src/orxonox/objects/gametypes/CMakeLists.txt
r2821 r2824 3 3 Deathmatch.cc 4 4 TeamDeathmatch.cc 5 Pong.cc 5 6 ) -
code/branches/miniprojects/src/orxonox/objects/gametypes/Deathmatch.cc
r2820 r2824 49 49 Gametype::start(); 50 50 51 COUT(0) << "game started" << std::endl; 51 std::string message = "The match has started!"; 52 COUT(0) << message << std::endl; 53 Host::Broadcast(message); 52 54 } 53 55 … … 56 58 Gametype::end(); 57 59 58 COUT(0) << "game ended" << std::endl; 60 std::string message = "The match has ended."; 61 COUT(0) << message << std::endl; 62 Host::Broadcast(message); 59 63 } 60 64 … … 117 121 Gametype::pawnKilled(victim, killer); 118 122 } 123 124 void Deathmatch::playerScored(PlayerInfo* player) 125 { 126 Gametype::playerScored(player); 127 128 if (player) 129 { 130 std::string message = player->getName() + " scores!"; 131 COUT(0) << message << std::endl; 132 Host::Broadcast(message); 133 } 134 } 119 135 } -
code/branches/miniprojects/src/orxonox/objects/gametypes/Deathmatch.h
r2820 r2824 49 49 50 50 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 51 virtual void playerScored(PlayerInfo* player); 51 52 }; 52 53 } -
code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.cc
r2820 r2824 200 200 // Reward killer 201 201 if (killer) 202 { 203 std::map<PlayerInfo*, Player>::iterator itKiller = this->players_.find(killer->getPlayer()); 204 if (itKiller != this->players_.end()) 205 { 206 this->playerScored(itKiller->second); 207 } 208 else 209 COUT(2) << "Warning: Killing Pawn was not in the playerlist" << std::endl; 210 } 202 this->playerScored(killer->getPlayer()); 211 203 212 204 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator()); … … 228 220 } 229 221 230 void Gametype::playerScored(Player& player) 231 { 232 player.frags_++; 222 void Gametype::playerScored(PlayerInfo* player) 223 { 224 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); 225 if (it != this->players_.end()) 226 it->second.frags_++; 233 227 } 234 228 -
code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.h
r2820 r2824 89 89 virtual bool playerChangedName(PlayerInfo* player); 90 90 91 virtual void playerScored(Player &player);91 virtual void playerScored(PlayerInfo* player); 92 92 93 93 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0); … … 129 129 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const; 130 130 131 void addPlayer(PlayerInfo* player); 132 void removePlayer(PlayerInfo* player); 133 134 void assignDefaultPawnsIfNeeded(); 135 void checkStart(); 136 void spawnPlayer(PlayerInfo* player); 137 void spawnPlayersIfRequested(); 138 void spawnDeadPlayersIfRequested(); 131 virtual void assignDefaultPawnsIfNeeded(); 132 virtual void checkStart(); 133 virtual void spawnPlayer(PlayerInfo* player); 134 virtual void spawnPlayersIfRequested(); 135 virtual void spawnDeadPlayersIfRequested(); 139 136 140 137 GametypeInfo gtinfo_; -
code/branches/miniprojects/src/orxonox/objects/worldentities/CMakeLists.txt
r2768 r2824 20 20 SpawnPoint.cc 21 21 TeamSpawnPoint.cc 22 PongCenterpoint.cc 23 PongBall.cc 24 PongBat.cc 22 25 ) 23 26 -
code/branches/miniprojects/src/orxonox/objects/worldentities/CameraPosition.cc
r2662 r2824 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/miniprojects/src/orxonox/objects/worldentities/CameraPosition.h
r2662 r2824 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/miniprojects/src/orxonox/objects/worldentities/ControllableEntity.cc
r2662 r2824 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 }
Note: See TracChangeset
for help on using the changeset viewer.