From 83103ddfeae96ab57a0ff67f26c8c1c52ab08fac Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 6 Oct 2022 09:39:39 +0200 Subject: [PATCH] Arreglados los cambios de lenguaje --- data/config/config.bin | Bin 24 -> 24 bytes data/lang/ba_BA.txt | 79 +++++++++++++++++++++++++++++++++++++++++ data/lang/en_UK.txt | 79 +++++++++++++++++++++++++++++++++++++++++ data/lang/es_ES.txt | 79 +++++++++++++++++++++++++++++++++++++++++ data/menu/pause.men | 4 +-- source/director.cpp | 3 -- source/game.cpp | 4 +++ source/lang.cpp | 20 +++++------ source/title.cpp | 21 +++++++---- 9 files changed, 268 insertions(+), 21 deletions(-) diff --git a/data/config/config.bin b/data/config/config.bin index 0f82916333746e88a84f06ffde6f193df3f6775c..c5aefb39e3027ae55404a78fd1882def817727f2 100644 GIT binary patch literal 24 WcmZQzU|?WoU<5)S08get("gameover.men")); + gameOverMenu->setItemCaption(0, lang->getText(48)); + gameOverMenu->setItemCaption(1, lang->getText(49)); pauseMenu = new Menu(renderer, asset, input, asset->get("pause.men")); + pauseMenu->setItemCaption(0, lang->getText(46)); + pauseMenu->setItemCaption(1, lang->getText(47)); // Sonidos balloonSound = JA_LoadSound(asset->get("balloon.wav").c_str()); diff --git a/source/lang.cpp b/source/lang.cpp index 2a97501..e553e52 100644 --- a/source/lang.cpp +++ b/source/lang.cpp @@ -46,20 +46,20 @@ bool Lang::setLang(Uint8 lang) if (rfile.is_open() && rfile.good()) { success = true; - std::string buffer; + std::string line; // lee el resto de datos del fichero int index = 0; - int line_read = 0; - while (std::getline(rfile, buffer)) + while (std::getline(rfile, line)) { - // Almacena solo las lineas impares - if (line_read % 2 == 1) - mTextStrings[index++] = buffer; - - // Limpia el buffer - buffer.clear(); - line_read++; + // Almacena solo las lineas que no empiezan por # o no esten vacias + const bool test1 = line.substr(0,1) != "#"; + const bool test2 = !line.empty(); + if (test1 && test2) + { + mTextStrings[index] = line; + index++; + } }; } diff --git a/source/title.cpp b/source/title.cpp index 1f28179..0f439ff 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -144,7 +144,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, } // Actualiza los textos de los menus - // updateMenuLabels(); + updateMenuLabels(); } // Destructor @@ -252,14 +252,10 @@ void Title::update() JA_PlayMusic(titleMusic); } - // Actualiza el contador de ticks - ticks = SDL_GetTicks(); - dustBitmapR->update(); dustBitmapL->update(); // Actualiza la lógica del titulo - menu.active->update(); fade->update(); if (fade->hasEnded()) @@ -306,7 +302,7 @@ void Title::update() // Comprueba las entradas para el menu if (menuVisible == true) { - menu.active->checkInput(); + menu.active->update(); } // Comprueba si se ha seleccionado algún item del menú @@ -318,14 +314,17 @@ void Title::update() postFade = 0; fade->activateFade(); break; + case 1: // 2 PLAYERS postFade = 1; fade->activateFade(); break; + case 2: // OPTIONS menu.active = menu.options; optionsPrevious = *options; break; + case 3: // QUIT postFade = 2; fade->activateFade(); @@ -350,20 +349,24 @@ void Title::update() options->difficulty = DIFFICULTY_EASY; updateMenuLabels(); break; + case 1: // PLAYER 1 CONTROLS updatePlayerInputs(0); updateMenuLabels(); break; + case 3: // PLAYER 2 CONTROLS updatePlayerInputs(1); updateMenuLabels(); break; + case 5: // Language options->language++; if (options->language == 3) options->language = 0; updateMenuLabels(); break; + case 6: // Display mode switchFullScreenModeVar(); if (options->fullScreenMode != 0) @@ -378,12 +381,14 @@ void Title::update() } updateMenuLabels(); break; + case 8: // Windows size options->windowSize++; if (options->windowSize == 5) options->windowSize = 1; updateMenuLabels(); break; + case 9: // FILTER if (options->filter == FILTER_LINEAL) options->filter = FILTER_NEAREST; @@ -391,6 +396,7 @@ void Title::update() options->filter = FILTER_LINEAL; updateMenuLabels(); break; + case 10: // VSYNC if (options->vSync) options->vSync = false; @@ -398,14 +404,17 @@ void Title::update() options->vSync = true; updateMenuLabels(); break; + case 11: // HOW TO PLAY runInstructions(INSTRUCTIONS_MODE_MANUAL); break; + case 12: // ACCEPT applyOptions(); menu.active->reset(); menu.active = menu.title; break; + case 13: // CANCEL options = &optionsPrevious; updateMenuLabels();