From ac0079077dcf8678b49df2c40f800db18970a243 Mon Sep 17 00:00:00 2001 From: NyakoFox Date: Thu, 11 Apr 2024 10:25:52 -0300 Subject: [PATCH] Summary changes --- desktop_version/src/Game.cpp | 6 +++ desktop_version/src/Render.cpp | 89 +++++++++++++++++++++------------- 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 95fe08af..32b16f3c 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -7434,6 +7434,12 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) option(loc::gettext("continue from quicksave")); option(loc::gettext("return")); menuyoff = 20; + auto_buttons = false; + + + touch::create_menu_button(17, 65 - 20 - 32, 286, 90, "", 0); + touch::create_menu_button(17, 65 - 20 + 64, 286, 90, "", 1); + touch::create_menu_button(17, 65 - 20 + 160, 286, 26, loc::gettext("return"), 2); break; case Menu::startnodeathmode: option(loc::gettext("disable cutscenes")); diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index f8e6e72f..1a5787ea 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -33,6 +33,8 @@ static int tr; static int tg; static int tb; +static bool dont_render_buttons; + struct MapRenderData { int zoom; @@ -198,6 +200,38 @@ static inline void draw_skip_message() ); } +static void draw_summary(Game::Summary* summary, int offset) +{ + font::print( + PR_CEN, -1, 80 - 20 + offset, + loc::gettext_roomname_special(map.currentarea(summary->saverx, summary->savery)), + 25, 255 - (help.glow / 2), 255 - (help.glow / 2) + ); + for (int i = 0; i < 6; i++) + { + graphics.drawcrewman(169 - (3 * 42) + (i * 42), 95 - 20 + offset, i, summary->crewstats[i], true); + } + font::print( + 0, 59, 132 - 20 + offset, + game.giventimestring( + summary->hours, + summary->minutes, + summary->seconds + ), + 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2) + ); + char buffer[SCREEN_WIDTH_CHARS + 1]; + vformat_buf(buffer, sizeof(buffer), + loc::gettext("{savebox_n_trinkets|wordy}"), + "savebox_n_trinkets:int", + summary->trinkets + ); + font::print(PR_RIGHT, 262, 132 - 20 + offset, buffer, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + + graphics.draw_sprite(34, 126 - 20 + offset, 50, graphics.col_clock); + graphics.draw_sprite(270, 126 - 20 + offset, 22, graphics.col_trinket); +} + static void menurender(void) { @@ -1401,52 +1435,37 @@ static void menurender(void) { const char* title = NULL; struct Game::Summary* summary = NULL; + struct Game::Summary* telesummary = &game.last_telesave; + struct Game::Summary* quicksummary = &game.last_quicksave; switch (game.currentmenuoption) { case 0: title = loc::gettext("Tele Save"); - summary = &game.last_telesave; + summary = telesummary; break; case 1: title = loc::gettext("Quick Save"); - summary = &game.last_quicksave; + summary = quicksummary; break; } - if (summary != NULL) + if (key.using_touch) { - graphics.drawpixeltextbox(17, 65-20, 286, 90, 65, 185, 207); + dont_render_buttons = true; + touch::render_buttons(tr, tg, tb, true); + draw_summary(telesummary, -32 + 6); + draw_summary(quicksummary, 64 + 6); + + font::print(PR_CEN | PR_BOR, -1, 32 - 16 + 2, loc::gettext("Tele Save"), 196, 196, 255 - help.glow); + font::print(PR_CEN | PR_BOR, -1, 128 - 16 + 2, loc::gettext("Quick Save"), 196, 196, 255 - help.glow); + } + else if (summary != NULL) + { + graphics.drawpixeltextbox(17, 65 - 20, 286, 90, 65, 185, 207); font::print(PR_2X | PR_CEN, -1, 20, title, tr, tg, tb); - font::print( - PR_CEN, -1, 80-20, - loc::gettext_roomname_special(map.currentarea(summary->saverx, summary->savery)), - 25, 255 - (help.glow / 2), 255 - (help.glow / 2) - ); - for (int i = 0; i < 6; i++) - { - graphics.drawcrewman(169-(3*42)+(i*42), 95-20, i, summary->crewstats[i], true); - } - font::print( - 0, 59, 132-20, - game.giventimestring( - summary->hours, - summary->minutes, - summary->seconds - ), - 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2) - ); - char buffer[SCREEN_WIDTH_CHARS + 1]; - vformat_buf(buffer, sizeof(buffer), - loc::gettext("{savebox_n_trinkets|wordy}"), - "savebox_n_trinkets:int", - summary->trinkets - ); - font::print(PR_RIGHT, 262, 132-20, buffer, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - - graphics.draw_sprite(34, 126-20, 50, graphics.col_clock); - graphics.draw_sprite(270, 126-20, 22, graphics.col_trinket); + draw_summary(summary, 0); } break; } @@ -1938,6 +1957,7 @@ static void menurender(void) void titlerender(void) { + dont_render_buttons = false; graphics.clear(); if (!game.menustart) { @@ -1991,7 +2011,10 @@ void titlerender(void) if (key.using_touch) { - touch::render_buttons(tr, tg, tb); + if (!dont_render_buttons) + { + touch::render_buttons(tr, tg, tb); + } } else {