From 7182e86e087cc37c4c2fe8886d9e3b4312942a96 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 27 Aug 2024 15:54:32 -0500 Subject: [PATCH] record and replay debug leaving town --- src/game/boe.actions.cpp | 31 +++++++++++++++++++------------ src/game/boe.actions.hpp | 1 + src/game/boe.main.cpp | 2 ++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index 06522867..c5bab051 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -1825,6 +1825,24 @@ void debug_step_through() { print_buf(); } +void debug_leave_town() { + if(recording){ + record_action("debug_leave_town", ""); + } + if(overall_mode == MODE_OUTDOORS){ + add_string_to_buf("Debug - Leave Town: You're not in town!"); + print_buf(); + return; + } + univ.party.end_split(0); + overall_mode = MODE_OUTDOORS; + position_party(univ.party.outdoor_corner.x,univ.party.outdoor_corner.y,univ.party.out_loc.x,univ.party.out_loc.y); + clear_map(); + add_string_to_buf("Debug: Reunite party and leave town."); + print_buf(); + redraw_screen(REFRESH_ALL); +} + bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ bool are_done = false; location pass_point; // TODO: This isn't needed @@ -2020,18 +2038,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ case 'B': if(!univ.debug_mode) break; - if(overall_mode == MODE_OUTDOORS){ - add_string_to_buf("Debug - Leave Town: You're not in town!"); - print_buf(); - break; - } - univ.party.end_split(0); - overall_mode = MODE_OUTDOORS; - position_party(univ.party.outdoor_corner.x,univ.party.outdoor_corner.y,univ.party.out_loc.x,univ.party.out_loc.y); - clear_map(); - add_string_to_buf("Debug: Reunite party and leave town."); - print_buf(); - redraw_screen(REFRESH_ALL); + debug_leave_town(); break; case 'C': diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp index d057d2d8..7b04daea 100644 --- a/src/game/boe.actions.hpp +++ b/src/game/boe.actions.hpp @@ -74,5 +74,6 @@ void toggle_debug_mode(); void debug_give_item(); void debug_print_location(); void debug_step_through(); +void debug_leave_town(); #endif diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 856e5000..8a65a60c 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -487,6 +487,8 @@ static void replay_next_action() { debug_print_location(); }else if(t == "debug_step_through"){ debug_step_through(); + }else if(t == "debug_leave_town"){ + debug_leave_town(); } // TODO some of these actions shouldn't call advance_time(). They should return