Changeset 7901
- Timestamp:
- Feb 15, 2011, 3:38:54 PM (14 years ago)
- Location:
- code/branches/lastmanstanding2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding2/data/levels/lastManStanding.oxw
r7899 r7901 1 <LevelInfo 2 name = "Last Man Standing" 3 description = "Be the sole survivor." 4 tags = "" 5 /> 6 1 7 <?lua 2 8 include("stats.oxo") -
code/branches/lastmanstanding2/data/levels/lastTeamStanding.oxw
r7697 r7901 1 <LevelInfo 2 name = "Last Team Standing" 3 description = "Survive as a team." 4 tags = "singleplayer" 5 /> 1 6 <?lua 2 7 include("stats.oxo") -
code/branches/lastmanstanding2/data/overlays/lastTeamStandingHUD.oxo
r7899 r7901 2 2 <OverlayGroup name="lastTeamStandingHUD" scale = "1, 1"> 3 3 4 <GametypeFadingMessag 4 <GametypeFadingMessage 5 5 name = "fadingmessage" 6 6 position = "0.5, 0.01" -
code/branches/lastmanstanding2/src/modules/overlays/hud/GametypeStatus.cc
r7284 r7901 36 36 #include "worldentities/ControllableEntity.h" 37 37 #include "worldentities/pawns/Spectator.h" 38 //#include "gametypes/Gametype.h" 38 39 39 40 namespace orxonox … … 50 51 RegisterObject(GametypeStatus); 51 52 53 //this->game_ = 0; 52 54 this->owner_ = 0; 53 55 this->bNoCaption_ = false; 56 //this->bForcedSpawn_ = false; 54 57 55 58 ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(this); … … 67 70 if (this->owner_ && this->owner_->getGametypeInfo() && this->owner_->getControllableEntity()) 68 71 { 72 //if (this->game_) 73 // this->bForcedSpawn_ = this->game_->getForceSpawn(); 74 //else 75 // this->bForcedSpawn_ = false; 76 69 77 const GametypeInfo* gtinfo = this->owner_->getGametypeInfo(); 70 78 ControllableEntity* ce = this->owner_->getControllableEntity(); … … 87 95 if (gtinfo->isStartCountdownRunning()) 88 96 this->setCaption(multi_cast<std::string>(static_cast<int>(ceil(gtinfo->getStartCountdown())))); 89 else if (ce->isA(Class(Spectator)) )97 else if (ce->isA(Class(Spectator))/*&&(!bForcedSpawn_)*/) 90 98 this->setCaption("Press [Fire] to respawn"); 91 99 else … … 101 109 { 102 110 SUPER(GametypeStatus, changedOwner); 103 111 //this->game_ = orxonox_cast<Gametype*>(this->getOwner()); 104 112 this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner()); 105 113 } -
code/branches/lastmanstanding2/src/modules/overlays/hud/GametypeStatus.h
r7284 r7901 49 49 50 50 private: 51 //Gametype* game_; 51 52 PlayerInfo* owner_; 52 53 bool bNoCaption_; 54 //bool bForcedSpawn_; 53 55 54 56 }; -
code/branches/lastmanstanding2/src/orxonox/gametypes/Gametype.h
r7284 r7901 150 150 { this->timeLimit_ = t; } 151 151 152 //inline bool getForceSpawn() 153 // { return this->bForceSpawn_; } 154 152 155 virtual void resetTimer(); 153 156 virtual void resetTimer(float t); -
code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc
r7899 r7901 58 58 LastTeamStanding::~LastTeamStanding() 59 59 { 60 this->playerLives_.clear();61 this->eachTeamsPlayers.clear();62 this->timeToAct_.clear();63 this->inGame_.clear();64 this->playerDelayTime_.clear();60 //this->playerLives_.clear(); 61 //this->eachTeamsPlayers.clear(); 62 //this->timeToAct_.clear(); 63 //this->inGame_.clear(); 64 //this->playerDelayTime_.clear(); 65 65 } 66 66 … … 75 75 playerLives_[player]=getMinLives();//new players only get minimum of lives */ 76 76 77 if(this->eachTeamsPlayers[getTeam(player)]==0) //if a player is the first in his group, a new team is alive78 this->teamsAlive++;79 this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased80 81 77 if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams. 82 78 bMinTeamsReached = true; // since there are at least two teams, the game is allowed to end … … 84 80 this->playerDelayTime_[player] = respawnDelay; 85 81 this->inGame_[player] = true; 82 int team = getTeam(player); 83 if( team < 0|| team > teams_) // make sure getTeam returns a regular value 84 return; 85 if(this->eachTeamsPlayers[team]==0) //if a player is the first in his group, a new team is alive 86 this->teamsAlive++; 87 this->eachTeamsPlayers[team]++; //the number of player in this team is increased 86 88 } 87 89 … … 91 93 if (valid_player) 92 94 { 93 this->eachTeamsPlayers[getTeam(player)]--; // a player left the team94 if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died95 this->teamsAlive--;96 95 this->playerLives_.erase(player); 97 96 this->timeToAct_.erase(player); 98 97 this->playerDelayTime_.erase(player); 99 98 this->inGame_.erase(player); 99 int team = getTeam(player); 100 if( team < 0|| team > teams_) // make sure getTeam returns a regular value 101 return valid_player; 102 this->eachTeamsPlayers[team]--; // a player left the team 103 if(this->eachTeamsPlayers[team] == 0) // if it was the last player a team died 104 this->teamsAlive--; 100 105 } 101 106 … … 114 119 if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives 115 120 { 116 this->eachTeamsPlayers[getTeam(victim->getPlayer())]--; 117 if(eachTeamsPlayers[getTeam(victim->getPlayer())] == 0) //last team member died 121 int team = getTeam(victim->getPlayer()); 122 if(team < 0|| team > teams_) // make sure getTeam returns a regular value 123 return allow; 124 this->eachTeamsPlayers[team]--; 125 if(eachTeamsPlayers[team] == 0) //last team member died 118 126 this->teamsAlive--; 119 127 const std::string& message = victim->getPlayer()->getName() + " has lost all lives"; … … 121 129 Host::Broadcast(message); 122 130 } 123 124 131 return allow; 125 132 }
Note: See TracChangeset
for help on using the changeset viewer.