From 05e3fddb8fe5c0c1bbf4ad6551a19e97634a6af7 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 26 Sep 2024 22:13:20 +0200 Subject: [PATCH] Mil millons de miniarreglos Afegides traduccions faltants --- data/lang/ba_BA.txt | 38 +++++++++++++++++++++++++++++++++++++- data/lang/en_UK.txt | 38 +++++++++++++++++++++++++++++++++++++- data/lang/es_ES.txt | 38 +++++++++++++++++++++++++++++++++++++- source/common/screen.cpp | 4 +++- source/define_buttons.cpp | 12 ++++++------ source/define_buttons.h | 1 + source/director.cpp | 30 +++++++++++++++++++++++++++--- source/director.h | 3 +++ source/game.cpp | 2 +- source/hiscore_table.cpp | 2 +- source/instructions.cpp | 2 +- source/intro.cpp | 2 +- source/lang.cpp | 2 ++ source/lang.h | 8 ++++++-- source/logo.cpp | 2 +- source/logo.h | 1 + source/scoreboard.cpp | 14 +++++++------- source/title.cpp | 2 +- 18 files changed, 173 insertions(+), 28 deletions(-) diff --git a/data/lang/ba_BA.txt b/data/lang/ba_BA.txt index 8051a73..4ee321e 100644 --- a/data/lang/ba_BA.txt +++ b/data/lang/ba_BA.txt @@ -278,4 +278,40 @@ DEIXA BUIT PER A MODE FORA DE LINEA ## 93 - MENU OPCIONES -TAULER DE PUNTS \ No newline at end of file +TAULER DE PUNTS + +## 94 - NOTIFICACIONES +Torna a polsar per eixir ... + +## 95 - DEFINE BUTTONS +Disparar cap a l'esquerra + +## 96 - DEFINE BUTTONS +Disparar cap amunt + +## 97 - DEFINE BUTTONS +Disparar cap a la dreta + +## 98 - DEFINE BUTTONS +Start + +## 99 - DEFINE BUTTONS +Servei + +## 100 - DEFINE BUTTONS +Jugador + +## 101 - MARCADOR +Mode demostracio + +## 102 - MARCADOR +Game Over + +## 103 - MARCADOR +Pulsa START + +## 104 - MARCADOR +per jugar + +## 105 - MARCADOR +Continuar? \ No newline at end of file diff --git a/data/lang/en_UK.txt b/data/lang/en_UK.txt index 92961ec..d88810e 100644 --- a/data/lang/en_UK.txt +++ b/data/lang/en_UK.txt @@ -278,4 +278,40 @@ LEAVE BLANK FOR OFFLINE MODE ## 93 - MENU OPCIONES -HISCORE TABLE \ No newline at end of file +HISCORE TABLE + +## 94 - NOTIFICACIONES +Press again to quit + +## 95 - DEFINE BUTTONS +Fire left + +## 96 - DEFINE BUTTONS +Fire up + +## 97 - DEFINE BUTTONS +Fire right + +## 98 - DEFINE BUTTONS +Start + +## 99 - DEFINE BUTTONS +Service + +## 100 - DEFINE BUTTONS +Player + +## 101 - MARCADOR +Demo mode + +## 102 - MARCADOR +Game Over + +## 103 - MARCADOR +Press START + +## 104 - MARCADOR +to play + +## 105 - MARCADOR +Continue? \ No newline at end of file diff --git a/data/lang/es_ES.txt b/data/lang/es_ES.txt index c7fe021..e217dbb 100644 --- a/data/lang/es_ES.txt +++ b/data/lang/es_ES.txt @@ -278,4 +278,40 @@ DEJA EN BLANCO PARA MODO SIN CONEXION ## 93 - MENU OPCIONES -TABLA DE PUNTUACIONES \ No newline at end of file +TABLA DE PUNTUACIONES + +## 94 - NOTIFICACIONES +Pulsa otra vez para salir + +## 95 - DEFINE BUTTONS +Disparar a la izquierda + +## 96 - DEFINE BUTTONS +Disparar hacia arriba + +## 97 - DEFINE BUTTONS +Disparar hacia la derecha + +## 98 - DEFINE BUTTONS +Start + +## 99 - DEFINE BUTTONS +Servicio + +## 100 - DEFINE BUTTONS +Jugador + +## 101 - MARCADOR +Mode demostracion + +## 102 - MARCADOR +Game Over + +## 103 - MARCADOR +Pulsa START + +## 104 - MARCADOR +para jugar + +## 105 - MARCADOR +Continuar? \ No newline at end of file diff --git a/source/common/screen.cpp b/source/common/screen.cpp index 0a65d5a..612747b 100644 --- a/source/common/screen.cpp +++ b/source/common/screen.cpp @@ -39,7 +39,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input * fpsCounter = 0; fps = 0; #ifdef DEBUG - showInfo = true; + showInfo = false; #else showInfo = false; #endif @@ -354,12 +354,14 @@ void Screen::checkInput() return; } +#ifdef DEBUG // Comprueba el teclado para mostrar la información de debug if (input->checkInput(input_showinfo, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD)) { showInfo = !showInfo; return; } +#endif for (int i = 0; i < input->getNumControllers(); ++i) { diff --git a/source/define_buttons.cpp b/source/define_buttons.cpp index 9d4da86..893f188 100644 --- a/source/define_buttons.cpp +++ b/source/define_buttons.cpp @@ -20,27 +20,27 @@ DefineButtons::DefineButtons(Input *input, Text *text, param_t *param, options_t buttons.clear(); db_button_t button; - button.label = "DISPARAR CAP A L'ESQUERRA"; + button.label = lang::getText(95); button.input = input_fire_left; button.button = SDL_CONTROLLER_BUTTON_X; buttons.push_back(button); - button.label = "DISPARAR CAP AMUNT"; + button.label = lang::getText(96); button.input = input_fire_center; button.button = SDL_CONTROLLER_BUTTON_Y; buttons.push_back(button); - button.label = "DISPARAR CAP A LA DRETA"; + button.label = lang::getText(97); button.input = input_fire_right; button.button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER; buttons.push_back(button); - button.label = "START"; + button.label = lang::getText(98); button.input = input_start; button.button = SDL_CONTROLLER_BUTTON_START; buttons.push_back(button); - button.label = "SERVEI"; + button.label = lang::getText(99); button.input = input_exit; button.button = SDL_CONTROLLER_BUTTON_BACK; buttons.push_back(button); @@ -69,7 +69,7 @@ void DefineButtons::render() { if (enabled) { - text->writeCentered(x, y - 10, "JUGADOR " + std::to_string(options->controller[indexController].playerId)); + text->writeCentered(x, y - 10, lang::getText(100) + std::to_string(options->controller[indexController].playerId)); text->writeCentered(x, y, controllerNames[indexController]); text->writeCentered(x, y + 10, buttons[indexButton].label); } diff --git a/source/define_buttons.h b/source/define_buttons.h index 9022045..b1853ee 100644 --- a/source/define_buttons.h +++ b/source/define_buttons.h @@ -4,6 +4,7 @@ #include "common/input.h" #include "common/text.h" #include "const.h" +#include "lang.h" struct db_button_t { diff --git a/source/director.cpp b/source/director.cpp index 4c3a594..f2ba32a 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -73,7 +73,7 @@ Director::Director(int argc, char *argv[]) dbg_init(renderer); // Crea los objetos - lang::loadFromFile(asset->get("ba_BA.txt")); + lang::loadFromFile(getLangFile((lang::lang_e)options->game.language)); input = new Input(asset->get("gamecontrollerdb.txt")); initInput(); @@ -521,7 +521,7 @@ void Director::initOptions() // Opciones de juego options->game.difficulty = DIFFICULTY_NORMAL; - options->game.language = 1; + options->game.language = lang::ba_BA; options->game.autofire = true; // Opciones de control @@ -695,7 +695,7 @@ bool Director::loadConfigFile() if (options->game.language < 0 || options->game.language > 2) { - options->game.language = 2; + options->game.language = lang::en_UK; } return success; @@ -1176,4 +1176,28 @@ bool Director::setOptions(options_t *options, std::string var, std::string value } return success; +} + +// Obtiene una fichero a partir de un lang_e +std::string Director::getLangFile(lang::lang_e lang) +{ + switch (lang) + { + case lang::ba_BA: + return asset->get("ba_BA.txt"); + break; + + case lang::es_ES: + return asset->get("es_ES.txt"); + break; + + case lang::en_UK: + return asset->get("en_UK.txt"); + break; + + default: + break; + } + + return asset->get("en_UK.txt"); } \ No newline at end of file diff --git a/source/director.h b/source/director.h index e45def6..08d09a4 100644 --- a/source/director.h +++ b/source/director.h @@ -115,6 +115,9 @@ private: // Ejecuta el juego en modo demo void runDemoGame(); + // Obtiene una fichero a partir de un lang_e + std::string getLangFile(lang::lang_e lang); + public: // Constructor Director(int argc, char *argv[]); diff --git a/source/game.cpp b/source/game.cpp index 2ed787d..ab4e262 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -2826,6 +2826,6 @@ void Game::quit(int code) } else { - screen->showNotification("Torna a polsar per eixir"); + screen->showNotification(lang::getText(94)); } } \ No newline at end of file diff --git a/source/hiscore_table.cpp b/source/hiscore_table.cpp index f1295a2..143ef9b 100644 --- a/source/hiscore_table.cpp +++ b/source/hiscore_table.cpp @@ -346,6 +346,6 @@ void HiScoreTable::quit(int code) } else { - screen->showNotification("Torna a polsar per eixir"); + screen->showNotification(lang::getText(94)); } } \ No newline at end of file diff --git a/source/instructions.cpp b/source/instructions.cpp index 4a4c187..3524d6e 100644 --- a/source/instructions.cpp +++ b/source/instructions.cpp @@ -393,6 +393,6 @@ void Instructions::quit(int code) } else { - screen->showNotification("Torna a polsar per eixir"); + screen->showNotification(lang::getText(94)); } } \ No newline at end of file diff --git a/source/intro.cpp b/source/intro.cpp index c5ff63d..2edbd45 100644 --- a/source/intro.cpp +++ b/source/intro.cpp @@ -471,6 +471,6 @@ void Intro::quit(int code) } else { - screen->showNotification("Torna a polsar per eixir"); + screen->showNotification(lang::getText(94)); } } \ No newline at end of file diff --git a/source/lang.cpp b/source/lang.cpp index 91acf73..28c03aa 100644 --- a/source/lang.cpp +++ b/source/lang.cpp @@ -4,6 +4,8 @@ namespace lang { + std::vector texts; // Vector con los textos + // Inicializa los textos del juego en el idioma seleccionado bool loadFromFile(std::string filePath) { diff --git a/source/lang.h b/source/lang.h index 13fe290..c1376d1 100644 --- a/source/lang.h +++ b/source/lang.h @@ -6,8 +6,12 @@ namespace lang { - // Variables - std::vector texts; // Vector con los textos + enum lang_e + { + es_ES = 0, + ba_BA = 1, + en_UK = 2, + }; // Inicializa los textos del juego en el idioma seleccionado bool loadFromFile(std::string filePath); diff --git a/source/logo.cpp b/source/logo.cpp index 702722e..a713d0b 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -345,6 +345,6 @@ void Logo::quit(int code) } else { - screen->showNotification("Torna a polsar per eixir"); + screen->showNotification(lang::getText(94)); } } \ No newline at end of file diff --git a/source/logo.h b/source/logo.h index 9910f73..4773194 100644 --- a/source/logo.h +++ b/source/logo.h @@ -8,6 +8,7 @@ #include "common/sprite.h" #include "common/utils.h" #include "const.h" +#include "lang.h" #include /* diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index 01b5966..4f63555 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -238,20 +238,20 @@ void Scoreboard::fillPanelTextures() break; case SCOREBOARD_MODE_DEMO: - textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, "Mode demostracio"); + textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(101)); if (counter % 10 < 8) { - textScoreBoard->writeCentered(slot4_3.x, slot4_3.y - 2, "Pulsa START"); - textScoreBoard->writeCentered(slot4_4.x, slot4_4.y - 2, "per jugar"); + textScoreBoard->writeCentered(slot4_3.x, slot4_3.y - 2, lang::getText(103)); + textScoreBoard->writeCentered(slot4_4.x, slot4_4.y - 2, lang::getText(104)); } break; case SCOREBOARD_MODE_GAME_OVER: - textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, "Game Over"); + textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102)); if (counter % 10 < 8) { - textScoreBoard->writeCentered(slot4_3.x, slot4_3.y - 2, "Pulsa START"); - textScoreBoard->writeCentered(slot4_4.x, slot4_4.y - 2, "per jugar"); + textScoreBoard->writeCentered(slot4_3.x, slot4_3.y - 2, lang::getText(103)); + textScoreBoard->writeCentered(slot4_4.x, slot4_4.y - 2, lang::getText(104)); } break; @@ -276,7 +276,7 @@ void Scoreboard::fillPanelTextures() textScoreBoard->writeCentered(slot4_2.x, slot4_2.y, updateScoreText(score[i])); // CONTINUE - textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, "Continuar?"); + textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, lang::getText(105)); textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, std::to_string(continueCounter[i])); break; diff --git a/source/title.cpp b/source/title.cpp index 8798e14..544ef00 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -407,6 +407,6 @@ void Title::quit(int code) } else { - screen->showNotification("Torna a polsar per eixir"); + screen->showNotification(lang::getText(94)); } } \ No newline at end of file