diff --git a/src/dialogxml/dialogs/dialog.cpp b/src/dialogxml/dialogs/dialog.cpp index 1979c327..c981d605 100644 --- a/src/dialogxml/dialogs/dialog.cpp +++ b/src/dialogxml/dialogs/dialog.cpp @@ -1147,3 +1147,17 @@ void cDialogIterator::increment() { parent = nullptr; } } + +void preview_dialog_xml() { + fs::path dialog_xml = nav_get_rsrc({"xml"}); + std::unique_ptr defn(load_dialog_defn(dialog_xml)); + cDialog dialog(*defn); + // Make every control's click event close the dialog + for (auto control : dialog){ + control.second->attachClickHandler([](cDialog& me, std::string item_hit, eKeyMod mod) -> bool { + me.toast(false); + return true; + }); + } + dialog.run(); +} diff --git a/src/dialogxml/dialogs/dialog.hpp b/src/dialogxml/dialogs/dialog.hpp index a93b799f..eac29fd7 100644 --- a/src/dialogxml/dialogs/dialog.hpp +++ b/src/dialogxml/dialogs/dialog.hpp @@ -377,4 +377,7 @@ public: // } //} +// For development/debugging only. +void preview_dialog_xml(); + #endif diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index 7a758b93..71c53c02 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -2356,7 +2356,7 @@ void show_debug_help() { } // Non-comprehensive list of unused keys: -// JUXYZ chijklnoqvy @#$-_+[]{},.'"`~/\|;: +// UXYZ chijklnoqvy @#$-_+[]{},.'"`~/\|;: void init_debug_actions() { add_debug_action({'B'}, "Leave town", debug_leave_town); add_debug_action({'C'}, "Get cleaned up (lose negative status effects)", debug_clean_up); @@ -2367,6 +2367,9 @@ void init_debug_actions() { add_debug_action({'H'}, "Heal", debug_heal); // This one was missing from the old help dialog: add_debug_action({'I'}, "Give item", debug_give_item); + // TODO this is not recorded or replayed because the rsrc you pick might not even be packaged + // in the build + add_debug_action({'J'}, "Preview a dialog's layout", preview_dialog_xml); add_debug_action({'K'}, "Kill everything", debug_kill); add_debug_action({'N'}, "End scenario", []() -> void {handle_victory(true);}); add_debug_action({'O'}, "Print your location", debug_print_location);