Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7901


Ignore:
Timestamp:
Feb 15, 2011, 3:38:54 PM (14 years ago)
Author:
jo
Message:

Finally working as intended.

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
    17<?lua
    28  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/>
    16<?lua
    27  include("stats.oxo")
  • code/branches/lastmanstanding2/data/overlays/lastTeamStandingHUD.oxo

    r7899 r7901  
    22  <OverlayGroup name="lastTeamStandingHUD" scale = "1, 1">
    33
    4 <GametypeFadingMessag
     4<GametypeFadingMessage
    55     name     = "fadingmessage"
    66     position = "0.5, 0.01"
  • code/branches/lastmanstanding2/src/modules/overlays/hud/GametypeStatus.cc

    r7284 r7901  
    3636#include "worldentities/ControllableEntity.h"
    3737#include "worldentities/pawns/Spectator.h"
     38//#include "gametypes/Gametype.h"
    3839
    3940namespace orxonox
     
    5051        RegisterObject(GametypeStatus);
    5152
     53        //this->game_ = 0;
    5254        this->owner_ = 0;
    5355        this->bNoCaption_ = false;
     56        //this->bForcedSpawn_ = false;
    5457
    5558        ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(this);
     
    6770        if (this->owner_ && this->owner_->getGametypeInfo() && this->owner_->getControllableEntity())
    6871        {
     72            //if (this->game_)
     73            //    this->bForcedSpawn_ = this->game_->getForceSpawn();
     74            //else
     75            //    this->bForcedSpawn_ = false;
     76
    6977            const GametypeInfo* gtinfo = this->owner_->getGametypeInfo();
    7078            ControllableEntity* ce = this->owner_->getControllableEntity();
     
    8795                if (gtinfo->isStartCountdownRunning())
    8896                    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_)*/)
    9098                    this->setCaption("Press [Fire] to respawn");
    9199                else
     
    101109    {
    102110        SUPER(GametypeStatus, changedOwner);
    103 
     111        //this->game_ = orxonox_cast<Gametype*>(this->getOwner());
    104112        this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
    105113    }
  • code/branches/lastmanstanding2/src/modules/overlays/hud/GametypeStatus.h

    r7284 r7901  
    4949
    5050        private:
     51            //Gametype* game_;
    5152            PlayerInfo* owner_;
    5253            bool bNoCaption_;
     54            //bool bForcedSpawn_;
    5355
    5456    };
  • code/branches/lastmanstanding2/src/orxonox/gametypes/Gametype.h

    r7284 r7901  
    150150              { this->timeLimit_ = t; }
    151151
     152            //inline bool getForceSpawn()
     153            //  { return this->bForceSpawn_; }       
     154
    152155            virtual void resetTimer();
    153156            virtual void resetTimer(float t);
  • code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.cc

    r7899 r7901  
    5858    LastTeamStanding::~LastTeamStanding()
    5959    {
    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();
    6565    }   
    6666
     
    7575            playerLives_[player]=getMinLives();//new players only get minimum of lives */
    7676       
    77         if(this->eachTeamsPlayers[getTeam(player)]==0) //if a player is the first in his group, a new team is alive
    78             this->teamsAlive++;
    79         this->eachTeamsPlayers[getTeam(player)]++; //the number of player in this team is increased
    80 
    8177        if (teamsAlive>1) // Now the game is allowed to end, since there are at least two teams.
    8278            bMinTeamsReached = true; // since there are at least two teams, the game is allowed to end
     
    8480        this->playerDelayTime_[player] = respawnDelay;
    8581        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
    8688    }
    8789
     
    9193        if (valid_player)
    9294        {
    93             this->eachTeamsPlayers[getTeam(player)]--;       // a player left the team
    94             if(this->eachTeamsPlayers[getTeam(player)] == 0) // if it was the last player a team died
    95                  this->teamsAlive--;
    9695            this->playerLives_.erase(player);
    9796            this->timeToAct_.erase(player);
    9897            this->playerDelayTime_.erase(player);
    9998            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--;
    100105        }
    101106
     
    114119        if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives
    115120        {
    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
    118126                this->teamsAlive--;
    119127            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
     
    121129            Host::Broadcast(message);
    122130        }
    123 
    124131        return allow;
    125132    }
Note: See TracChangeset for help on using the changeset viewer.