Els panels dels marcadors ja passen a game over sense pasar per waiting un frame gracies a una parafernalia que he montat
This commit is contained in:
@@ -942,16 +942,6 @@ void Game::updateStage()
|
||||
// Actualiza el estado de fin de la partida
|
||||
void Game::updateGameOver()
|
||||
{
|
||||
// Comprueba si todos los jugadores estan esperando
|
||||
if (allPlayersAreWaiting())
|
||||
{
|
||||
// Entonces los pone en estado de Game Over
|
||||
for (auto player : players)
|
||||
{
|
||||
player->setStatusPlaying(playerStatus::GAME_OVER);
|
||||
}
|
||||
}
|
||||
|
||||
// Si todos estan en estado de Game Over
|
||||
if (allPlayersAreGameOver())
|
||||
{
|
||||
@@ -1895,7 +1885,7 @@ void Game::update()
|
||||
updatePlayers();
|
||||
|
||||
// Actualiza el marcador
|
||||
// checkPlayersStatusPlaying();
|
||||
checkPlayersStatusPlaying();
|
||||
updateScoreboard();
|
||||
|
||||
// Actualiza el fondo
|
||||
@@ -2579,12 +2569,12 @@ void Game::updateHelper()
|
||||
}
|
||||
|
||||
// Comprueba si todos los jugadores han terminado de jugar
|
||||
bool Game::allPlayersAreWaiting()
|
||||
bool Game::allPlayersAreWaitingOrGameOver()
|
||||
{
|
||||
bool success = true;
|
||||
for (auto player : players)
|
||||
{
|
||||
success &= player->isWaiting();
|
||||
success &= player->isWaiting() || player->isGameOver();
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -2828,65 +2818,39 @@ void Game::addScoreToScoreBoard(std::string name, int score)
|
||||
}
|
||||
|
||||
// Comprueba el estado de los jugadores
|
||||
/*void Game::checkPlayersStatusPlaying()
|
||||
void Game::checkPlayersStatusPlaying()
|
||||
{
|
||||
if (demo.enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si todos los jugadores estan esperando
|
||||
if (allPlayersAreWaitingOrGameOver())
|
||||
{
|
||||
// Entonces los pone en estado de Game Over
|
||||
for (auto player : players)
|
||||
{
|
||||
switch (player->getStatusPlaying())
|
||||
{
|
||||
case playerStatus::PLAYING:
|
||||
{
|
||||
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::SCORE);
|
||||
break;
|
||||
player->setStatusPlaying(playerStatus::GAME_OVER);
|
||||
}
|
||||
}
|
||||
|
||||
case playerStatus::CONTINUE:
|
||||
// Saca del estado de GAME OVER al primer jugador si el segundo está activo
|
||||
const bool a1 = players[0]->isGameOver();
|
||||
const bool b1 = !players[1]->isGameOver() && !players[1]->isWaiting();
|
||||
if (a1 && b1)
|
||||
{
|
||||
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::CONTINUE);
|
||||
scoreboard->setContinue(player->getScoreBoardPanel(), player->getContinueCounter());
|
||||
break;
|
||||
players[0]->setStatusPlaying(playerStatus::WAITING);
|
||||
}
|
||||
|
||||
case playerStatus::WAITING:
|
||||
// Saca del estado de GAME OVER al segundo jugador si el primero está activo
|
||||
const bool a2 = players[1]->isGameOver();
|
||||
const bool b2 = !players[0]->isGameOver() && !players[0]->isWaiting();
|
||||
if (a2 && b2)
|
||||
{
|
||||
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::WAITING);
|
||||
break;
|
||||
}
|
||||
|
||||
case playerStatus::ENTERING_NAME:
|
||||
{
|
||||
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::ENTER_NAME);
|
||||
scoreboard->setRecordName(player->getScoreBoardPanel(), player->getRecordName());
|
||||
scoreboard->setSelectorPos(player->getScoreBoardPanel(), player->getRecordNamePos());
|
||||
break;
|
||||
}
|
||||
|
||||
case playerStatus::DYING:
|
||||
break;
|
||||
|
||||
case playerStatus::DIED:
|
||||
{
|
||||
const playerStatus nextPlayerStatus = IsEligibleForHighScore(player->getScore()) ? playerStatus::ENTERING_NAME : playerStatus::CONTINUE;
|
||||
demo.enabled ? player->setStatusPlaying(playerStatus::WAITING) : player->setStatusPlaying(nextPlayerStatus);
|
||||
break;
|
||||
}
|
||||
|
||||
case playerStatus::GAME_OVER:
|
||||
{
|
||||
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::GAME_OVER);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
players[1]->setStatusPlaying(playerStatus::WAITING);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Obtiene un jugador a partir de su "id"
|
||||
Player *Game::getPlayer(int id)
|
||||
|
||||
@@ -412,7 +412,7 @@ private:
|
||||
void updateHelper();
|
||||
|
||||
// Comprueba si todos los jugadores han terminado de jugar
|
||||
bool allPlayersAreWaiting();
|
||||
bool allPlayersAreWaitingOrGameOver();
|
||||
|
||||
// Comprueba si todos los jugadores han terminado de jugar
|
||||
bool allPlayersAreGameOver();
|
||||
@@ -445,7 +445,7 @@ private:
|
||||
void addScoreToScoreBoard(std::string name, int score);
|
||||
|
||||
// Comprueba el estado de juego de los jugadores
|
||||
//void checkPlayersStatusPlaying();
|
||||
void checkPlayersStatusPlaying();
|
||||
|
||||
// Obtiene un jugador a partir de su "id"
|
||||
Player *getPlayer(int id);
|
||||
|
||||
@@ -724,7 +724,7 @@ void Player::decContinueCounter()
|
||||
continueCounter--;
|
||||
if (continueCounter < 0)
|
||||
{
|
||||
setStatusPlaying(playerStatus::WAITING);
|
||||
setStatusPlaying(playerStatus::GAME_OVER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,13 @@ void Scoreboard::fillPanelTextures()
|
||||
{
|
||||
// GAME OVER
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102));
|
||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y + 4, lang::getText(114));
|
||||
|
||||
// PLEASE WAIT
|
||||
if (counter % 10 < 8)
|
||||
{
|
||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y - 2, lang::getText(114));
|
||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y - 2, lang::getText(115));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user