From a4d36abec6161e739879fa62b09bc86bfbfc4d66 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 27 Aug 2024 19:57:11 -0500 Subject: [PATCH] record and replay the last 2 debug actions --- src/game/boe.actions.cpp | 50 +++++++++++++++++++++++++--------------- src/game/boe.actions.hpp | 2 ++ src/game/boe.main.cpp | 4 ++++ 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index 6976459b..03642514 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -2014,6 +2014,36 @@ static void revive_all_dead(bool full_restore) { } } +void debug_heal() { + if(recording){ + record_action("debug_heal", ""); + } + univ.party.gold += 100; + univ.party.food += 100; + revive_all_dead(false); + add_string_to_buf("Debug: Heal party."); + print_buf(); + put_pc_screen(); +} + +void debug_heal_plus_extra() { + if(recording){ + record_action("debug_heal_plus_extra", ""); + } + univ.party.gold += 100; + univ.party.food += 100; + revive_all_dead(true); + award_party_xp(25); + for(cPlayer& who : univ.party) { + who.priest_spells.set(); + who.mage_spells.set(); + } + univ.refresh_store_items(); + add_string_to_buf("Debug: Add stuff and heal."); + print_buf(); + put_pc_screen(); +} + bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ bool are_done = false; location pass_point; // TODO: This isn't needed @@ -2189,18 +2219,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ case '=': if(!univ.debug_mode) break; - univ.party.gold += 100; - univ.party.food += 100; - revive_all_dead(true); - award_party_xp(25); - for(cPlayer& who : univ.party) { - who.priest_spells.set(); - who.mage_spells.set(); - } - univ.refresh_store_items(); - add_string_to_buf("Debug: Add stuff and heal."); - print_buf(); - put_pc_screen(); + debug_heal_plus_extra(); break; case 'B': @@ -2230,12 +2249,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ case 'H': if(!univ.debug_mode) break; - univ.party.gold += 100; - univ.party.food += 100; - revive_all_dead(false); - add_string_to_buf("Debug: Heal party."); - print_buf(); - put_pc_screen(); + debug_heal(); break; case 'K': diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp index 337c829f..ba0d1a64 100644 --- a/src/game/boe.actions.hpp +++ b/src/game/boe.actions.hpp @@ -87,5 +87,7 @@ void debug_return_to_start(); void handle_victory(bool record = false); void debug_increase_age(); void debug_towns_forget(); +void debug_heal_plus_extra(); +void debug_heal(); #endif diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 1e84d2a4..6cd8069f 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -517,6 +517,10 @@ static void replay_next_action() { debug_towns_forget(); }else if(t == "edit_stuff_done"){ edit_stuff_done(); + }else if(t == "debug_heal"){ + debug_heal(); + }else if(t == "debug_heal_plus_extra"){ + debug_heal_plus_extra(); } // TODO some of these actions shouldn't call advance_time(). They should return