From 7a8d66c29deafb50a063016973cb3f5d5f4d5a69 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 25 Sep 2025 17:52:49 +0200 Subject: [PATCH] =?UTF-8?q?nou:=20quan=20arribes=20a=20la=20maxima=20puntu?= =?UTF-8?q?aci=C3=B3,=20posa=20un=20lletreret?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/lang/ba_BA.json | 1 + data/lang/en_UK.json | 1 + data/lang/es_ES.json | 1 + source/director.cpp | 2 +- source/manage_hiscore_table.cpp | 13 +++++++++++++ source/resource.cpp | 1 + source/sections/game.cpp | 29 +++++++++++++++++++++-------- 7 files changed, 39 insertions(+), 9 deletions(-) diff --git a/data/lang/ba_BA.json b/data/lang/ba_BA.json index cb09597..9b89f53 100644 --- a/data/lang/ba_BA.json +++ b/data/lang/ba_BA.json @@ -27,6 +27,7 @@ "[GAME_TEXT] 7": "Endavant!", "[GAME_TEXT] 8": "1.000.000 de punts!", "[GAME_TEXT] THANK_YOU": "Gracies!", + "[GAME_TEXT] NEW_RECORD": "Nou record!", "[HIGHSCORE_TABLE] CAPTION": "Millors puntuacions", diff --git a/data/lang/en_UK.json b/data/lang/en_UK.json index af6a5d2..3d308b2 100644 --- a/data/lang/en_UK.json +++ b/data/lang/en_UK.json @@ -26,6 +26,7 @@ "[GAME_TEXT] 7": "Get Ready!", "[GAME_TEXT] 8": "1,000,000 points!", "[GAME_TEXT] THANK_YOU": "Thank you!", + "[GAME_TEXT] NEW_RECORD": "New record!", "[HIGHSCORE_TABLE] CAPTION": "Best scores", diff --git a/data/lang/es_ES.json b/data/lang/es_ES.json index 43c700e..219f919 100644 --- a/data/lang/es_ES.json +++ b/data/lang/es_ES.json @@ -26,6 +26,7 @@ "[GAME_TEXT] 7": "Adelante!", "[GAME_TEXT] 8": "1.000.000 de puntos!", "[GAME_TEXT] THANK_YOU": "Gracias!", + "[GAME_TEXT] NEW_RECORD": "Nuevo record!", "[HIGHSCORE_TABLE] CAPTION": "Mejores puntuaciones", diff --git a/source/director.cpp b/source/director.cpp index 525f3cf..31055e2 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -42,7 +42,7 @@ Director::Director(int argc, std::span argv) { Section::name = Section::Name::GAME; Section::options = Section::Options::GAME_PLAY_1P; #elif _DEBUG - Section::name = Section::Name::TITLE; + Section::name = Section::Name::GAME; Section::options = Section::Options::GAME_PLAY_1P; #else // NORMAL GAME Section::name = Section::Name::LOGO; diff --git a/source/manage_hiscore_table.cpp b/source/manage_hiscore_table.cpp index 4f81440..c569f0b 100644 --- a/source/manage_hiscore_table.cpp +++ b/source/manage_hiscore_table.cpp @@ -13,6 +13,7 @@ void ManageHiScoreTable::clear() { table_.clear(); // Añade 10 entradas predefinidas + /* table_.emplace_back("BRY", 1000000); table_.emplace_back("USUFO", 500000); table_.emplace_back("GLUCA", 100000); @@ -23,6 +24,18 @@ void ManageHiScoreTable::clear() { table_.emplace_back("SAM", 500); table_.emplace_back("PACMQ", 200); table_.emplace_back("PELEC", 100); + */ + + table_.emplace_back("BRY", 1000); + table_.emplace_back("USUFO", 500); + table_.emplace_back("GLUCA", 100); + table_.emplace_back("PARRA", 50); + table_.emplace_back("CAGAM", 10); + table_.emplace_back("PEPE", 5); + table_.emplace_back("ROSIT", 4); + table_.emplace_back("SAM", 3); + table_.emplace_back("PACMQ", 2); + table_.emplace_back("PELEC", 1); sort(); } diff --git a/source/resource.cpp b/source/resource.cpp index 6248e0f..b84ac43 100644 --- a/source/resource.cpp +++ b/source/resource.cpp @@ -678,6 +678,7 @@ void Resource::createTextTextures() { {"game_text_get_ready", Lang::getText("[GAME_TEXT] 7")}, {"game_text_last_stage", Lang::getText("[GAME_TEXT] 3")}, {"game_text_congratulations", Lang::getText("[GAME_TEXT] 1")}, + {"game_text_new_record", Lang::getText("[GAME_TEXT] NEW_RECORD")}, {"game_text_game_over", "Game Over"}}; auto text2 = getText("04b_25_2x_enhanced"); diff --git a/source/sections/game.cpp b/source/sections/game.cpp index 852e581..9cb2744 100644 --- a/source/sections/game.cpp +++ b/source/sections/game.cpp @@ -201,10 +201,11 @@ void Game::updateHiScore() { hi_score_.score = player->getScore(); hi_score_.name.clear(); - // Si se supera la máxima puntuación emite sonido + // Si se supera la máxima puntuación if (!hi_score_achieved_) { hi_score_achieved_ = true; - playSound("hi_score_achieved.wav"); + playSound("hi_score_achieved.wav"); // Emite un sonido + createMessage({paths_.at(8), paths_.at(9)}, Resource::get()->getTexture("game_text_new_record")); // CRea un mensaje } } } @@ -1036,7 +1037,7 @@ void Game::initPaths() { const int X1 = param.game.play_area.center_x - (W / 2); const int X2 = param.game.play_area.rect.w; const int Y = param.game.play_area.center_y; - paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 0.33f); // 20 frames → segundos + paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 0.5f); paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0); } @@ -1048,11 +1049,11 @@ void Game::initPaths() { const int Y1 = param.game.play_area.center_y - (H / 2); const int Y2 = -H; const int X = param.game.play_area.center_x; - paths_.emplace_back(createPath(Y0, Y1, PathType::VERTICAL, X, 80, easeOutQuint), 0.33f); // 20 frames → segundos + paths_.emplace_back(createPath(Y0, Y1, PathType::VERTICAL, X, 80, easeOutQuint), 0.5f); paths_.emplace_back(createPath(Y1, Y2, PathType::VERTICAL, X, 80, easeInQuint), 0); } - // Recorrido para el texto de "Congratulations!!" (3,4) + // Recorrido para el texto de "Congratulations!!" (4,5) { const auto &texture = Resource::get()->getTexture("game_text_congratulations"); const auto W = texture->getWidth(); @@ -1061,11 +1062,11 @@ void Game::initPaths() { const int X1 = param.game.play_area.center_x - (W / 2); const int X2 = param.game.play_area.rect.w; const int Y = param.game.play_area.center_y - (H / 2) - 20; - paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 6.67f); // 400 frames → segundos + paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 7.0F); paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0); } - // Recorrido para el texto de "1.000.000 points!" (5,6) + // Recorrido para el texto de "1.000.000 points!" (6,7) { const auto &texture = Resource::get()->getTexture("game_text_1000000_points"); const auto W = texture->getWidth(); @@ -1074,7 +1075,19 @@ void Game::initPaths() { const int X1 = param.game.play_area.center_x - (W / 2); const int X2 = -W; const int Y = param.game.play_area.center_y + (H / 2) - 20; - paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 6.67f); // 400 frames → segundos + paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 7.0F); + paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0); + } + + // Recorrido para el texto de "New Record!" (8,9) + { + const auto &texture = Resource::get()->getTexture("game_text_new_record"); + const auto W = texture->getWidth(); + const int X0 = -W; + const int X1 = param.game.play_area.center_x - (W / 2); + const int X2 = param.game.play_area.rect.w; + const int Y = param.game.play_area.first_quarter_y; + paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 1.0f); paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0); } }