Changeset 8552 for code/branches/spacerace
- Timestamp:
- May 23, 2011, 6:35:35 PM (14 years ago)
- Location:
- code/branches/spacerace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spacerace/data/levels/spaceRace.oxw
r8548 r8552 51 51 52 52 <!-- ------------------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"> 54 54 <attached> 55 55 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 63 63 </RaceCheckPoint> 64 64 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"> 66 66 <attached> 67 67 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 84 84 </RaceCheckPoint> 85 85 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"> 87 87 <attached> 88 88 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 105 105 </RaceCheckPoint> 106 106 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"> 108 108 <attached> 109 109 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 126 126 </RaceCheckPoint> 127 127 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"> 129 129 <attached> 130 130 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 147 147 </RaceCheckPoint> 148 148 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"> 150 150 <attached> 151 151 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 168 168 </RaceCheckPoint> 169 169 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"> 171 171 <attached> 172 172 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 189 189 </RaceCheckPoint> 190 190 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"> 192 192 <attached> 193 193 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 210 210 </RaceCheckPoint> 211 211 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"> 213 213 <attached> 214 214 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> … … 230 230 </RaceCheckPoint> 231 231 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"> 233 233 <attached> 234 234 <Model mass="50" scale="50" mesh="checkPoint.mesh" /> -
code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc
r8548 r8552 45 45 this->bCheckpointIndex_ = 0; 46 46 this->bIsLast_ = false; 47 this->bTimeLimit_ =0;47 this->bTimeLimit_ = 0; 48 48 49 49 this->setRadarObjectColour(ColourValue::Red); … … 63 63 if (this->getCheckpointIndex() == gametype->getCheckpointsReached()) this->setRadarVisibility(true); 64 64 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 } 65 73 } 66 74 -
code/branches/spacerace/src/modules/gametypes/SpaceRace.cc
r8428 r8552 43 43 RegisterObject(SpaceRace); 44 44 this->checkpointsReached_ = 0; 45 this->bTimeIsUp_ = false; 45 46 this->numberOfBots_ = 0; 46 47 } … … 53 54 void SpaceRace::end() 54 55 { 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++) 68 75 COUT(0) << multi_cast<std::string>(*it) << std::endl; 76 } 69 77 } 70 78 … … 73 81 Gametype::start(); 74 82 83 this->startTimer(); 75 84 clock_= new Clock(); 76 85 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 77 77 inline int getCheckpointsReached() 78 78 { return this->checkpointsReached_; } 79 inline void timeIsUp() 80 { this->bTimeIsUp_ = true;} 79 81 80 82 protected: … … 82 84 private: 83 85 int checkpointsReached_; 86 std::set<float> scores_; 84 87 Clock *clock_; 85 std::set<float> scores_; 86 88 bool bTimeIsUp_; 87 89 }; 88 90 }
Note: See TracChangeset
for help on using the changeset viewer.