- Timestamp:
- May 12, 2011, 12:31:23 AM (13 years ago)
- Location:
- code/branches/tutoriallevel3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tutoriallevel3
- Property svn:mergeinfo changed
/code/branches/tutoriallevel (added) merged: 7828-7831,7894,8370 /code/branches/tutoriallevel2 (added) merged: 8371,8374,8376-8378,8444-8451
- Property svn:mergeinfo changed
-
code/branches/tutoriallevel3/src/orxonox/gametypes/Gametype.cc
r8327 r8453 59 59 this->defaultControllableEntity_ = Class(Spectator); 60 60 61 this->bFirstTick_ = true; 62 61 63 this->bAutoStart_ = false; 62 64 this->bForceSpawn_ = false; … … 112 114 SUPER(Gametype, tick, dt); 113 115 116 // Activate the GametypeInfo. 117 if(this->bFirstTick_) 118 { 119 this->gtinfo_->setActive(true); 120 this->bFirstTick_ = false; 121 } 122 114 123 //count timer 115 124 if (timerIsActive_) … … 121 130 } 122 131 123 if (this->gtinfo_-> bStartCountdownRunning_ && !this->gtinfo_->bStarted_)124 this->gtinfo_-> startCountdown_ -= dt;125 126 if (!this->gtinfo_-> bStarted_)132 if (this->gtinfo_->isStartCountdownRunning() && !this->gtinfo_->hasStarted()) 133 this->gtinfo_->countdownStartCountdown(dt); 134 135 if (!this->gtinfo_->hasStarted()) 127 136 this->checkStart(); 128 else if (!this->gtinfo_-> bEnded_)137 else if (!this->gtinfo_->hasEnded()) 129 138 this->spawnDeadPlayersIfRequested(); 130 139 … … 136 145 this->addBots(this->numberOfBots_); 137 146 138 this->gtinfo_-> bStarted_ = true;147 this->gtinfo_->start(); 139 148 140 149 this->spawnPlayersIfRequested(); … … 143 152 void Gametype::end() 144 153 { 145 this->gtinfo_-> bEnded_ = true;154 this->gtinfo_->end(); 146 155 147 156 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) … … 270 279 } 271 280 281 if(victim->getPlayer()->isHumanPlayer()) 282 this->gtinfo_->pawnKilled(victim->getPlayer()); 283 272 284 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator()); 273 285 if (victim->getCamera()) … … 346 358 it->second.state_ = PlayerState::Dead; 347 359 348 if (!it->first->isReadyToSpawn() || !this->gtinfo_-> bStarted_)360 if (!it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted()) 349 361 { 350 362 this->spawnPlayerAsDefaultPawn(it->first); … … 357 369 void Gametype::checkStart() 358 370 { 359 if (!this->gtinfo_-> bStarted_)360 { 361 if (this->gtinfo_-> bStartCountdownRunning_)362 { 363 if (this->gtinfo_-> startCountdown_ <= 0)364 { 365 this->gtinfo_-> bStartCountdownRunning_ = false;366 this->gtinfo_->s tartCountdown_ = 0;371 if (!this->gtinfo_->hasStarted()) 372 { 373 if (this->gtinfo_->isStartCountdownRunning()) 374 { 375 if (this->gtinfo_->getStartCountdown() <= 0.0f) 376 { 377 this->gtinfo_->stopStartCountdown(); 378 this->gtinfo_->setStartCountdown(0.0f);; 367 379 this->start(); 368 380 } … … 384 396 if (it->first->isHumanPlayer()) 385 397 hashumanplayers = true; 398 399 // Inform the GametypeInfo that the player is ready to spawn. 400 // TODO: Can it happen, that that changes? 401 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn()) 402 this->gtinfo_->playerReadyToSpawn(it->first); 386 403 } 387 404 if (allplayersready && hashumanplayers) … … 389 406 // If in developer's mode, there is no start countdown. 390 407 if(Core::getInstance().inDevMode()) 391 this-> gtinfo_->startCountdown_ = 0;408 this->start(); 392 409 else 393 this->gtinfo_->s tartCountdown_ = this->initialStartCountdown_;394 this->gtinfo_-> bStartCountdownRunning_ = true;410 this->gtinfo_->setStartCountdown(this->initialStartCountdown_); 411 this->gtinfo_->startStartCountdown(); 395 412 } 396 413 } … … 402 419 { 403 420 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 421 { 404 422 if (it->first->isReadyToSpawn() || this->bForceSpawn_) 405 423 this->spawnPlayer(it->first); 424 } 406 425 } 407 426 … … 422 441 player->startControl(spawnpoint->spawn()); 423 442 this->players_[player].state_ = PlayerState::Alive; 443 444 if(player->isHumanPlayer()) 445 this->gtinfo_->playerSpawned(player); 446 424 447 this->playerPostSpawn(player); 425 448 }
Note: See TracChangeset
for help on using the changeset viewer.