- Timestamp:
- May 28, 2011, 5:10:01 PM (13 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
- Property svn:mergeinfo changed
/code/branches/tutoriallevel (added) merged: 7828-7831,7894,8370 /code/branches/tutoriallevel2 (added) merged: 8371,8374,8376-8378,8444-8451 /code/branches/tutoriallevel3 (added) merged: 8453,8634,8636
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/gametypes/Gametype.cc
r8631 r8637 58 58 59 59 this->defaultControllableEntity_ = Class(Spectator); 60 60 61 61 this->bAutoStart_ = false; 62 62 this->bForceSpawn_ = false; … … 121 121 } 122 122 123 if (this->gtinfo_->bStartCountdownRunning_ && !this->gtinfo_->bStarted_) 124 this->gtinfo_->startCountdown_ -= dt; 125 126 if (!this->gtinfo_->bStarted_) 123 if (this->gtinfo_->isStartCountdownRunning() && !this->gtinfo_->hasStarted()) 124 this->gtinfo_->countdownStartCountdown(dt); 125 126 if (!this->gtinfo_->hasStarted()) 127 { 128 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 129 { 130 // Inform the GametypeInfo that the player is ready to spawn. 131 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn()) 132 this->gtinfo_->playerReadyToSpawn(it->first); 133 } 134 127 135 this->checkStart(); 128 else if (!this->gtinfo_->bEnded_) 136 } 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) … … 173 182 { 174 183 this->players_[player].state_ = PlayerState::Joined; 184 this->gtinfo_->playerEntered(player); 175 185 } 176 186 … … 269 279 } 270 280 } 281 282 if(victim->getPlayer()->isHumanPlayer()) 283 this->gtinfo_->pawnKilled(victim->getPlayer()); 271 284 272 285 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator()); … … 345 358 it->second.state_ = PlayerState::Dead; 346 359 347 if (!it->first->isReadyToSpawn() || !this->gtinfo_-> bStarted_)360 if (!it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted()) 348 361 { 349 362 this->spawnPlayerAsDefaultPawn(it->first); … … 356 369 void Gametype::checkStart() 357 370 { 358 if (!this->gtinfo_-> bStarted_)359 { 360 if (this->gtinfo_-> bStartCountdownRunning_)361 { 362 if (this->gtinfo_-> startCountdown_ <= 0)363 { 364 this->gtinfo_-> bStartCountdownRunning_ = false;365 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);; 366 379 this->start(); 367 380 } … … 388 401 // If in developer's mode, there is no start countdown. 389 402 if(Core::getInstance().inDevMode()) 390 this-> gtinfo_->startCountdown_ = 0;403 this->start(); 391 404 else 392 this->gtinfo_->s tartCountdown_ = this->initialStartCountdown_;393 this->gtinfo_-> bStartCountdownRunning_ = true;405 this->gtinfo_->setStartCountdown(this->initialStartCountdown_); 406 this->gtinfo_->startStartCountdown(); 394 407 } 395 408 } … … 401 414 { 402 415 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 416 { 403 417 if (it->first->isReadyToSpawn() || this->bForceSpawn_) 404 418 this->spawnPlayer(it->first); 419 } 405 420 } 406 421 … … 421 436 player->startControl(spawnpoint->spawn()); 422 437 this->players_[player].state_ = PlayerState::Alive; 438 439 if(player->isHumanPlayer()) 440 this->gtinfo_->playerSpawned(player); 441 423 442 this->playerPostSpawn(player); 424 443 }
Note: See TracChangeset
for help on using the changeset viewer.