Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8552


Ignore:
Timestamp:
May 23, 2011, 6:35:35 PM (13 years ago)
Author:
msalomon
Message:
 
Location:
code/branches/spacerace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spacerace/data/levels/spaceRace.oxw

    r8548 r8552  
    5151   
    5252    <!-- ------------------CheckPoints----------------- -->
    53     <RaceCheckPoint name=checkpoint1 position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale=1 distance=40 checkpointindex=0 islast=false>
     53    <RaceCheckPoint name="checkpoint1" position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
    5454    <attached>
    5555      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    6363    </RaceCheckPoint>
    6464
    65     <RaceCheckPoint name=checkpoint2 position="0,-900,2300" collisionType="static" scale=1 distance=40 checkpointindex=1 islast=false>
     65    <RaceCheckPoint name="checkpoint2" position="0,-900,2300" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false">
    6666    <attached>
    6767      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    8484    </RaceCheckPoint>
    8585
    86     <RaceCheckPoint name=checkpoint3 position="0,700,2700" direction="0,0,1" collisionType="static" scale=1 distance=40 checkpointindex=2 islast=false>
     86    <RaceCheckPoint name="checkpoint3" position="0,700,2700" direction="0,0,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false">
    8787    <attached>
    8888      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    105105    </RaceCheckPoint>
    106106
    107     <RaceCheckPoint name=checkpoint4 position="0,2100,2300" direction="0,1,1" collisionType="static" scale=1 distance=40 checkpointindex=3 islast=false>
     107    <RaceCheckPoint name="checkpoint4" position="0,2100,2300" direction="0,1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="false">
    108108   <attached>
    109109      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    126126    </RaceCheckPoint>
    127127
    128     <RaceCheckPoint name=checkpoint5 position="0,2200,500" direction="0,1,0" collisionType="static" scale=1 distance=40 checkpointindex=4 islast=false>
     128    <RaceCheckPoint name="checkpoint5" position="0,2200,500" direction="0,1,0" collisionType="static" scale="1" distance="40" checkpointindex="4" islast="false">
    129129    <attached>
    130130      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    147147    </RaceCheckPoint>
    148148
    149     <RaceCheckPoint name=checkpoint6 position="0,1500,-800" direction="0,1,-1" collisionType="static" scale=1 distance=40 checkpointindex=5 islast=false>
     149    <RaceCheckPoint name="checkpoint6" position="0,1500,-800" direction="0,1,-1" collisionType="static" scale="1" distance="40" checkpointindex="5" islast="false">
    150150    <attached>
    151151      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    168168    </RaceCheckPoint>
    169169
    170     <RaceCheckPoint name=checkpoint7 position="0,200,-1900" collisionType="static" scale=1 distance=40 checkpointindex=6 islast=false>
     170    <RaceCheckPoint name="checkpoint7" position="0,200,-1900" collisionType="static" scale="1" distance="40" checkpointindex="6" islast="false">
    171171    <attached>
    172172      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    189189    </RaceCheckPoint>
    190190
    191     <RaceCheckPoint name=checkpoint8 position="0,-700,-1400" direction="0,-1,-1" collisionType="static" scale=1 distance=40 checkpointindex=7 islast=false>
     191    <RaceCheckPoint name="checkpoint8" position="0,-700,-1400" direction="0,-1,-1" collisionType="static" scale="1" distance="40" checkpointindex="7" islast="false">
    192192    <attached>
    193193      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    210210    </RaceCheckPoint>
    211211
    212     <RaceCheckPoint name=checkpoint9 position="0,-1300,-800" collisionType="static" scale=1 distance=40 checkpointindex=8 islast=false>
     212    <RaceCheckPoint name="checkpoint9" position="0,-1300,-800" collisionType="static" scale="1" distance="40" checkpointindex="8" islast="false">
    213213    <attached>
    214214      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
     
    230230    </RaceCheckPoint>
    231231
    232     <RaceCheckPoint name=checkpoint10 position="0,-2100,0" collisionType="static" scale=1 distance=40 checkpointindex=9 islast=true>
     232    <RaceCheckPoint name="checkpoint10" position="0,-2100,0" collisionType="static" scale="1" distance="40" checkpointindex="9" islast="true" timelimit="150">
    233233    <attached>
    234234      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
  • code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc

    r8548 r8552  
    4545        this->bCheckpointIndex_ = 0;
    4646        this->bIsLast_ = false;
    47         this->bTimeLimit_=0;
     47        this->bTimeLimit_ = 0;
    4848       
    4949        this->setRadarObjectColour(ColourValue::Red);
     
    6363        if (this->getCheckpointIndex() == gametype->getCheckpointsReached()) this->setRadarVisibility(true);
    6464        else  this->setRadarVisibility(false);
     65       
     66        if (this->bTimeLimit_ != 0 && gametype->getTimerIsActive()) {
     67          float time = gametype->getTime() - this->bTimeLimit_;
     68          if (time > 0) {
     69            gametype->timeIsUp();
     70            gametype->end();
     71          }
     72        }
    6573    }
    6674
  • code/branches/spacerace/src/modules/gametypes/SpaceRace.cc

    r8428 r8552  
    4343        RegisterObject(SpaceRace);
    4444        this->checkpointsReached_ = 0;
     45        this->bTimeIsUp_ = false;
    4546        this->numberOfBots_ = 0;
    4647    }
     
    5354    void SpaceRace::end()
    5455    {
    55         Gametype::end();
    56         this->clock_->capture();
    57         int s = this->clock_->getSeconds();
    58         int ms = this->clock_->getMilliseconds()-1000*s;
    59         const std::string& message = "You have reached the last check point after "+ multi_cast<std::string>(s) +
    60                                       "." + multi_cast<std::string>(ms) + " seconds.";
    61         COUT(0) << message << std::endl;
    62         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    63         Host::Broadcast(message);
    64         float time = this->clock_->getSecondsPrecise();
    65         this->scores_.insert(time);
    66         std::set<float>::iterator it;
    67         for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
     56        Gametype::end();
     57        this->stopTimer();
     58        if (this->bTimeIsUp_) {
     59            COUT(0) << "Time is up" << std::endl;
     60            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage("Time is up");
     61        }
     62        else {
     63            this->clock_->capture();
     64            int s = this->clock_->getSeconds();
     65            int ms = this->clock_->getMilliseconds()-1000*s;
     66            const std::string& message = "You have reached the last check point after "+ multi_cast<std::string>(s) +
     67                                          "." + multi_cast<std::string>(ms) + " seconds.";
     68            COUT(0) << message << std::endl;
     69            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     70            Host::Broadcast(message);
     71            float time = this->clock_->getSecondsPrecise();
     72            this->scores_.insert(time);
     73            std::set<float>::iterator it;
     74            for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
    6875            COUT(0) <<  multi_cast<std::string>(*it) << std::endl;
     76        }
    6977    }
    7078
     
    7381        Gametype::start();
    7482       
     83        this->startTimer();
    7584        clock_= new Clock();
    7685        std::string message("The match has started! Reach the check points as quick as possible!");
  • code/branches/spacerace/src/modules/gametypes/SpaceRace.h

    r8428 r8552  
    7777            inline int getCheckpointsReached()
    7878                { return this->checkpointsReached_; }
     79            inline void timeIsUp()
     80                { this->bTimeIsUp_ = true;}
    7981           
    8082        protected:
     
    8284        private:
    8385            int checkpointsReached_;
     86            std::set<float> scores_;
    8487            Clock *clock_;
    85             std::set<float> scores_;
    86            
     88            bool bTimeIsUp_;
    8789    };
    8890}
Note: See TracChangeset for help on using the changeset viewer.