From db56185be2e55837ac57feba9632777ec35c09c0 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 8 Nov 2022 19:32:28 +0100 Subject: [PATCH] Corregido bug en el calculo del color del marcador --- data/room/45.room | 4 ++-- data/room/45.tmx | 4 ++-- source/game.cpp | 12 +++++------- source/scoreboard.cpp | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/data/room/45.room b/data/room/45.room index 181fd12..1caac82 100644 --- a/data/room/45.room +++ b/data/room/45.room @@ -8,7 +8,7 @@ roomDown=0 roomLeft=14.room roomRight=46.room itemColor1=yellow -itemColor2=cyan +itemColor2=green [enemy] tileSetFile=chip.png @@ -62,7 +62,7 @@ color=magenta tileSetFile=items.png tile=54 x=17 -y=1 +y=2 [/item] [item] diff --git a/data/room/45.tmx b/data/room/45.tmx index be8c80c..e858bc4 100644 --- a/data/room/45.tmx +++ b/data/room/45.tmx @@ -6,12 +6,12 @@ 30,30,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 30,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 30,0,0,0,0,0,0,0,0,0,0,323,323,0,0,0,0,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 30,0,0,0,0,0,0,0,323,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 30,0,0,0,0,323,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -30,0,323,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,323,323,0,323,323,323,323,323,0,323,323,323,323,323,0,323,323,323,323,0,395,0,0,0,395,395,395,395,395,395, +0,0,0,0,0,323,323,323,323,323,0,323,323,323,323,323,0,323,323,323,323,0,395,0,0,0,395,395,395,395,395,395, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,395,0,0,0,0,0,0,0,0,0, 30,30,30,0,0,0,395,395,395,0,0,0,395,395,0,0,0,0,395,395,395,0,0,0,0,0,0,0,0,0,0,0, diff --git a/source/game.cpp b/source/game.cpp index 17780cc..79fd2d4 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -500,15 +500,13 @@ void Game::renderBlackScreen() void Game::setScoreBoardColor() { // Obtiene el color del borde - const color_t c = room->getBorderColor(); + const color_t colorBorder = room->getBorderColor(); - // Si el color es negro lo cambia a blanco - const color_t cBlack = stringToColor(options->palette, "black"); - board.color = colorAreEqual(c, cBlack) ? stringToColor(options->palette, "white") : c; + const bool isBlack = colorAreEqual(colorBorder, stringToColor(options->palette, "black")); + const bool isBrightBlack = colorAreEqual(colorBorder, stringToColor(options->palette, "bright_black")); - // Si el color es negro brillante lo cambia a blanco - const color_t cBrightBlack = stringToColor(options->palette, "bright_black"); - board.color = colorAreEqual(c, cBrightBlack) ? stringToColor(options->palette, "white") : c; + // Si el color del borde es negro o negro brillante cambia el texto del marcador a blanco + board.color = isBlack || isBrightBlack? stringToColor(options->palette, "white") : colorBorder; } // Comprueba si ha finalizado el juego diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index 397af3e..18f4b81 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -77,7 +77,7 @@ void ScoreBoard::render() } // Escribe los textos - const std::string timeTxt = std::to_string((clock.minutes % 60) / 10) + std::to_string(clock.minutes % 10) + clock.separator + std::to_string((clock.seconds % 60) / 10) + std::to_string(clock.seconds % 10); + const std::string timeTxt = std::to_string((clock.minutes % 100) / 10) + std::to_string(clock.minutes % 10) + clock.separator + std::to_string((clock.seconds % 60) / 10) + std::to_string(clock.seconds % 10); const std::string itemsTxt = std::to_string(board->items / 100) + std::to_string((board->items % 100) / 10) + std::to_string(board->items % 10); this->text->writeColored(BLOCK, line1, "Items collected ", board->color); this->text->writeColored(17 * BLOCK, line1, itemsTxt, itemsColor);