From 3d61f9067b57959bed08721f1ada64e3732f2b81 Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 21 Jan 2024 18:32:18 -0800 Subject: [PATCH] Translate NDM hardest room on-the-fly Otherwise, cycling languages through CTRL+F8 would result in mismatched languages. --- desktop_version/src/Game.cpp | 9 ++++++++- desktop_version/src/Game.h | 3 +++ desktop_version/src/Render.cpp | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 3c79332b..b46e7b7f 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -221,6 +221,10 @@ void Game::init(void) nocutscenes = false; ndmresultcrewrescued = 0; ndmresulttrinkets = 0; + ndmresulthardestroom.clear(); + ndmresulthardestroom_x = hardestroom_x; + ndmresulthardestroom_y = hardestroom_y; + ndmresulthardestroom_specialname = false; customcol=0; @@ -7798,7 +7802,10 @@ void Game::copyndmresults(void) { ndmresultcrewrescued = crewrescued(); ndmresulttrinkets = trinkets(); - ndmresulthardestroom = loc::gettext_roomname(false, hardestroom_x, hardestroom_y, hardestroom.c_str(), hardestroom_specialname); + ndmresulthardestroom = hardestroom; + ndmresulthardestroom_x = hardestroom_x; + ndmresulthardestroom_y = hardestroom_y; + ndmresulthardestroom_specialname = hardestroom_specialname; SDL_memcpy(ndmresultcrewstats, crewstats, sizeof(ndmresultcrewstats)); } diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index bf9c1ced..362a956c 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -428,6 +428,9 @@ public: int ndmresultcrewrescued; int ndmresulttrinkets; std::string ndmresulthardestroom; + int ndmresulthardestroom_x; + int ndmresulthardestroom_y; + bool ndmresulthardestroom_specialname; void copyndmresults(void); //Time Trials diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 2c578c5e..20b6436b 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1382,7 +1382,15 @@ static void menurender(void) font::print_wrap(PR_CEN | PR_CJK_LOW, -1, 110, buffer, tr, tg, tb); font::print(PR_CEN, -1, 145, loc::gettext("You managed to reach:"), tr, tg, tb); - font::print(PR_CEN | PR_CJK_LOW, -1, 155, game.ndmresulthardestroom, tr, tg, tb); + font::print( + PR_CEN | PR_CJK_LOW, -1, 155, + loc::gettext_roomname( + false, + game.ndmresulthardestroom_x, game.ndmresulthardestroom_y, + game.ndmresulthardestroom.c_str(), game.ndmresulthardestroom_specialname + ), + tr, tg, tb + ); const char* encouragement; switch (game.ndmresultcrewrescued)