From 92f698cc57d4eda2b056b741be56ff71dbe83400 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Fri, 28 Feb 2025 09:01:16 -0600 Subject: [PATCH] Debug actions to quick-launch core scenarios --- src/game/boe.actions.cpp | 26 +++++++++++++++++++++++++- src/game/boe.actions.hpp | 1 + src/game/boe.main.cpp | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index af4a178c..87e2a67f 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -2438,8 +2438,26 @@ void show_debug_help() { debug_panel.run(); } +void debug_launch_scen(std::string scen_name) { + if(recording){ + record_action("debug_launch_scen", scen_name); + } + // Start by using the default party + if(!party_in_memory){ + // TODO: Could add a debug party preference like the scenario editor has + start_new_game(true); + } + // Take party out of scenario they're in + if(univ.party.is_in_scenario()){ + // TODO: Confirm + handle_victory(true); + } + // Force party into the scenario, skipping the intro: + put_party_in_scen(scen_name, true); +} + // Non-comprehensive list of unused keys: -// chjklnoqvy @#$-_+[]{},.'"`\|;: +// chjklnoqvy -_+[]{},.'"`\|;: // We want to keep lower-case for normal gameplay. void init_debug_actions() { // optional `true` argument means you can use this action in the startup menu. @@ -2479,6 +2497,12 @@ void init_debug_actions() { add_debug_action({'<'}, "Make one day pass", debug_increase_age); add_debug_action({'>'}, "Reset towns (excludes the one you're in, if any)", debug_towns_forget); add_debug_action({'!'}, "Toggle Special Node Step-through Mode", debug_step_through); + + // Enter core scenarios, skipping intro: + add_debug_action({'@'}, "Quick-launch The Valley of Dying Things", []() -> void {debug_launch_scen("valleydy.boes");}, true); + add_debug_action({'#'}, "Quick-launch A Small Rebellion", []() -> void {debug_launch_scen("stealth.boes");}, true); + add_debug_action({'$'}, "Quick-launch The Za-Khazi Run", []() -> void {debug_launch_scen("zakhazi.boes");}, true); + // std::bind won't work here for reasons add_debug_action({'%'}, "Fight wandering encounter from this section", []() -> void {debug_fight_encounter(true);}); add_debug_action({'^'}, "Fight special encounter from this section", []() -> void {debug_fight_encounter(false);}); diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp index af42a88f..215b5ba8 100644 --- a/src/game/boe.actions.hpp +++ b/src/game/boe.actions.hpp @@ -105,6 +105,7 @@ void debug_increase_age(); void debug_towns_forget(); void debug_heal_plus_extra(); void debug_heal(); +void debug_launch_scen(std::string scen_name); void handle_print_pc_hp(int which_pc, bool& need_reprint); void handle_print_pc_sp(int which_pc, bool& need_reprint); void handle_trade_places(int which_pc, bool& need_reprint); diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index 6ecd0717..2aec00ff 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -790,6 +790,9 @@ static void replay_action(Element& action) { }else if(t == "toggle_debug_mode"){ toggle_debug_mode(); return; + }else if(t == "debug_launch_scen"){ + debug_launch_scen(action.GetText()); + return; }else if(t == "debug_give_item"){ debug_give_item(); return;