From 9d31dd35898dc8e4d74b165a1e1fec41f3df0bcf Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Fri, 23 Aug 2024 20:47:56 -0500 Subject: [PATCH] record arrow button clicks (cosmetic) --- src/game/boe.graphics.cpp | 10 ++++++++++ src/game/boe.main.cpp | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/game/boe.graphics.cpp b/src/game/boe.graphics.cpp index 3c395d42..36429023 100644 --- a/src/game/boe.graphics.cpp +++ b/src/game/boe.graphics.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "boe.global.hpp" @@ -38,6 +39,8 @@ #include "boe.menus.hpp" #include "tools/winutil.hpp" #include "tools/prefs.hpp" +#include "replay.hpp" + #ifndef MSBUILD_GITREV #include "tools/gitrev.hpp" #endif @@ -438,6 +441,13 @@ void draw_start_button(eStartButton which_position,short which_button) { } void arrow_button_click(rectangle button_rect) { + if(recording){ + // This action is purely cosmetic, for playing the animation and sound accompanying a click on a button whose real action + // is recorded afterward + std::ostringstream sstr; + sstr << button_rect; + record_action("arrow_button_click", sstr.str()); + } mainPtr.setActive(); clip_rect(mainPtr, button_rect); // TODO: Mini-event loop so that the click doesn't happen until releasing the mouse button diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 3ff312f2..bb8427d8 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -329,6 +329,11 @@ static void replay_next_action() { handle_give_item(item_hit, did_something, need_redraw); }else if(t == "close_window"){ handle_quit_event(); + }else if(t == "arrow_button_click"){ + rectangle button_rect; + std::istringstream sstr(next_action.GetText()); + sstr >> button_rect; + arrow_button_click(button_rect); } advance_time(did_something, need_redraw, need_reprint);