Eliminat el punter a "section"

This commit is contained in:
2024-09-28 09:28:22 +02:00
parent 0a8d0479a0
commit 8d263931b2
19 changed files with 191 additions and 172 deletions

View File

@@ -5,13 +5,12 @@
#define GAME_OVER_COUNTER 350
// Constructor
Game::Game(int playerID, int currentStage, bool demo, Screen *screen, Asset *asset, Input *input, section_t *section, JA_Music_t *music)
Game::Game(int playerID, int currentStage, bool demo, Screen *screen, Asset *asset, Input *input, JA_Music_t *music)
{
// Copia los punteros
this->screen = screen;
this->asset = asset;
this->input = input;
this->section = section;
this->music = music;
renderer = screen->getRenderer();
@@ -176,8 +175,8 @@ void Game::init(int playerID)
paused = false;
gameCompleted = false;
gameCompletedCounter = 0;
section->name = SECTION_PROG_GAME;
section->options = SECTION_OPTIONS_GAME_PLAY_1P;
section::name = section::NAME_GAME;
section::options = section::OPTIONS_GAME_PLAY_1P;
currentPower = 0;
menaceCurrent = 0;
menaceThreshold = 0;
@@ -948,7 +947,7 @@ void Game::updateGameOver()
if (fade->hasEnded())
{
section->name = SECTION_PROG_HI_SCORE_TABLE;
section::name = section::NAME_HI_SCORE_TABLE;
}
}
}
@@ -1831,7 +1830,7 @@ void Game::update()
// Si ha terminado el fundido, cambia de sección
if (fade->hasEnded())
{
section->name = SECTION_PROG_HI_SCORE_TABLE;
section::name = section::NAME_HI_SCORE_TABLE;
return;
}
}
@@ -1849,7 +1848,7 @@ void Game::update()
// Si se ha llenado el vector con datos, sale del programa
else
{
section->name = SECTION_PROG_QUIT;
section::name = section::NAME_QUIT;
return;
}
#endif
@@ -2037,7 +2036,7 @@ void Game::checkInput()
// Comprueba si se sale con el teclado
if (input->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
quit(SECTION_OPTIONS_QUIT_NORMAL);
quit(section::OPTIONS_QUIT_NORMAL);
return;
}
@@ -2046,14 +2045,14 @@ void Game::checkInput()
// Comprueba si se sale con el mando
if (input->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
quit(SECTION_OPTIONS_QUIT_SHUTDOWN);
quit(section::OPTIONS_QUIT_SHUTDOWN);
return;
}
// Comprueba si se va a resetear el juego
if (input->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
section->name = SECTION_PROG_LOGO;
section::name = section::NAME_LOGO;
screen->showNotification("Reset");
return;
}
@@ -2134,7 +2133,7 @@ void Game::checkInput()
// Si se pulsa cualquier tecla, se sale del modo demo
if (input->checkAnyButtonPressed())
{
section->name = SECTION_PROG_TITLE;
section::name = section::NAME_TITLE;
return;
}
}
@@ -2376,7 +2375,7 @@ void Game::checkMusicStatus()
// Bucle para el juego
void Game::run()
{
while (section->name == SECTION_PROG_GAME)
while (section::name == section::NAME_GAME)
{
#ifndef RECORDING
checkInput();
@@ -2503,9 +2502,9 @@ void Game::updateGameCompleted()
if (gameCompletedCounter == GAME_COMPLETED_END)
{
// section->options = SUBSECTION_GAME_GAMEOVER;
section->name = SECTION_PROG_TITLE;
section->options = SECTION_OPTIONS_TITLE_1;
// section::options = SUBSECTION_GAME_GAMEOVER;
section::name = section::NAME_TITLE;
section::options = section::OPTIONS_TITLE_1;
}
}
@@ -2563,7 +2562,7 @@ void Game::checkEvents()
// Evento de salida de la aplicación
if (eventHandler->type == SDL_QUIT)
{
section->name = SECTION_PROG_QUIT;
section::name = section::NAME_QUIT;
break;
}
@@ -2815,12 +2814,12 @@ int Game::getController(int playerId)
}
// Termina
void Game::quit(int code)
void Game::quit(section::options_e code)
{
if (screen->notificationsAreActive())
{
section->name = SECTION_PROG_QUIT;
section->options = code;
section::name = section::NAME_QUIT;
section::options = code;
}
else
{