Els panels del marcador ara canvien de mode a petició i no a cada frame

This commit is contained in:
2024-10-06 20:19:43 +02:00
parent 6ea6f85e3e
commit a95e5077e3
5 changed files with 90 additions and 19 deletions

View File

@@ -128,14 +128,14 @@ void Game::init(int playerID)
players.clear();
// Crea los dos jugadores
Player *player1 = new Player(1, (param.game.playArea.firstQuarterX * ((0 * 2) + 1)) - 11, param.game.playArea.rect.h - 30, &param.game.playArea.rect, playerTextures[0], playerAnimations);
Player *player1 = new Player(1, (param.game.playArea.firstQuarterX * ((0 * 2) + 1)) - 11, param.game.playArea.rect.h - 30, demo.enabled, &param.game.playArea.rect, playerTextures[0], playerAnimations);
player1->setScoreBoardPanel(SCOREBOARD_LEFT_PANEL);
player1->setName(lang::getText(53));
const int controller1 = getController(player1->getId());
player1->setController(controller1);
players.push_back(player1);
Player *player2 = new Player(2, (param.game.playArea.firstQuarterX * ((1 * 2) + 1)) - 11, param.game.playArea.rect.h - 30, &param.game.playArea.rect, playerTextures[1], playerAnimations);
Player *player2 = new Player(2, (param.game.playArea.firstQuarterX * ((1 * 2) + 1)) - 11, param.game.playArea.rect.h - 30, demo.enabled, &param.game.playArea.rect, playerTextures[1], playerAnimations);
player2->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL);
player2->setName(lang::getText(54));
const int controller2 = getController(player2->getId());
@@ -1895,7 +1895,7 @@ void Game::update()
updatePlayers();
// Actualiza el marcador
checkPlayersStatusPlaying();
// checkPlayersStatusPlaying();
updateScoreboard();
// Actualiza el fondo
@@ -2691,14 +2691,14 @@ void Game::checkEvents()
// Ralentiza mucho la lógica
case SDLK_4:
{
ticksSpeed *= 10;
ticksSpeed *= 10;
break;
}
// Acelera mucho la lógica
case SDLK_5:
{
ticksSpeed /= 10;
ticksSpeed /= 10;
break;
}
@@ -2828,7 +2828,7 @@ void Game::addScoreToScoreBoard(std::string name, int score)
}
// Comprueba el estado de los jugadores
void Game::checkPlayersStatusPlaying()
/*void Game::checkPlayersStatusPlaying()
{
if (demo.enabled)
{
@@ -2840,23 +2840,31 @@ void Game::checkPlayersStatusPlaying()
switch (player->getStatusPlaying())
{
case playerStatus::PLAYING:
{
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::SCORE);
break;
}
case playerStatus::CONTINUE:
{
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::CONTINUE);
scoreboard->setContinue(player->getScoreBoardPanel(), player->getContinueCounter());
break;
}
case playerStatus::WAITING:
{
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;
@@ -2869,20 +2877,16 @@ void Game::checkPlayersStatusPlaying()
}
case playerStatus::GAME_OVER:
{
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::GAME_OVER);
break;
}
default:
break;
}
}
}
// Comprueba si la puntuación entra en la tabla de mejores puntuaciones
bool Game::IsEligibleForHighScore(int score)
{
return score > options.game.hiScoreTable.back().score;
}
}*/
// Obtiene un jugador a partir de su "id"
Player *Game::getPlayer(int id)