Reestructurant la classe Options

This commit is contained in:
2025-02-23 18:12:02 +01:00
parent 3ba4293e8a
commit 2ee0c70319
48 changed files with 898 additions and 984 deletions

View File

@@ -32,8 +32,8 @@ GameOver::GameOver()
// Inicializa variables
preCounter = 0;
counter = 0;
options.section.name = SECTION_GAME_OVER;
options.section.subsection = 0;
options.section.section = Section::GAME_OVER;
options.section.subsection = Subsection::NONE;
ticks = 0;
ticksSpeed = 15;
endSection = 400;
@@ -48,7 +48,7 @@ GameOver::GameOver()
const std::vector<std::string> colorList = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"};
for (auto cl : colorList)
{
colors.push_back(stringToColor(options.palette, cl));
colors.push_back(stringToColor(options.video.palette, cl));
}
color = colors.back();
}
@@ -116,7 +116,7 @@ void GameOver::render()
// Escribe el texto con "Tu peor pesadilla"
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y + 110, "YOUR WORST NIGHTMARE IS", 1, color);
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y + 120, options.stats.worstNightmare, 1, color);
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y + 120, options.stats.worst_nightmare, 1, color);
// Vuelca el contenido del renderizador en pantalla
screen->render();
@@ -141,7 +141,7 @@ void GameOver::checkInput()
// Bucle principal
void GameOver::run()
{
while (options.section.name == SECTION_GAME_OVER)
while (options.section.section == Section::GAME_OVER)
{
update();
checkEvents();
@@ -200,13 +200,7 @@ void GameOver::updateCounters()
// Comprueba si ha terminado la sección
else if (counter == endSection)
{
options.section.name = SECTION_LOGO;
options.section.subsection = SUBSECTION_LOGO_TO_TITLE;
options.section.section = Section::LOGO;
options.section.subsection = Subsection::LOGO_TO_TITLE;
}
}
// Cambia la paleta
void GameOver::switchPalette()
{
options.palette = (options.palette == p_zxspectrum) ? p_zxarne : p_zxspectrum;
}