diff --git a/rsrc/dialogs/preview-dialogs-confirm.xml b/rsrc/dialogs/preview-dialogs-confirm.xml
new file mode 100644
index 00000000..a1d79f07
--- /dev/null
+++ b/rsrc/dialogs/preview-dialogs-confirm.xml
@@ -0,0 +1,12 @@
+
+
+
diff --git a/src/dialogxml/dialogs/dialog.cpp b/src/dialogxml/dialogs/dialog.cpp
index e8437945..bc213edb 100644
--- a/src/dialogxml/dialogs/dialog.cpp
+++ b/src/dialogxml/dialogs/dialog.cpp
@@ -16,6 +16,7 @@
#include "gfx/tiling.hpp" // for bg
#include "fileio/resmgr/res_dialog.hpp"
#include "sounds.hpp"
+#include "dialogxml/dialogs/choicedlog.hpp"
#include "dialogxml/widgets/pict.hpp"
#include "dialogxml/widgets/button.hpp"
#include "dialogxml/widgets/field.hpp"
@@ -1154,8 +1155,7 @@ void cDialogIterator::increment() {
}
}
-void preview_dialog_xml() {
- fs::path dialog_xml = nav_get_rsrc({"xml"});
+void preview_dialog_xml(fs::path dialog_xml) {
std::unique_ptr defn(load_dialog_defn(dialog_xml));
cDialog dialog(*defn);
// Make every clickable control's click event close the dialog
@@ -1168,4 +1168,4 @@ void preview_dialog_xml() {
}catch(...){}
}
dialog.run();
-}
+}
\ No newline at end of file
diff --git a/src/dialogxml/dialogs/dialog.hpp b/src/dialogxml/dialogs/dialog.hpp
index 2a9f8fd6..1adef3bd 100644
--- a/src/dialogxml/dialogs/dialog.hpp
+++ b/src/dialogxml/dialogs/dialog.hpp
@@ -28,6 +28,7 @@
#include "location.hpp"
#include
#include
+#include
#include "tools/prefs.hpp"
#include "tools/framerate_limiter.hpp"
@@ -380,6 +381,6 @@ public:
//}
// For development/debugging only.
-void preview_dialog_xml();
+void preview_dialog_xml(fs::path dialog_xml);
#endif
diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp
index 12b5ea11..cb59a446 100644
--- a/src/game/boe.actions.cpp
+++ b/src/game/boe.actions.cpp
@@ -1,6 +1,7 @@
#include
#include
+#include
#include "boe.global.hpp"
#include "tools/replay.hpp"
@@ -2396,6 +2397,7 @@ void init_debug_actions() {
// 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({'U'}, "Preview EVERY dialog's layout", preview_every_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);
@@ -3934,3 +3936,33 @@ void handle_rename_pc() {
put_pc_screen();
put_item_screen(stat_window);
}
+
+void preview_dialog_xml() {
+ fs::path dialog_xml = nav_get_rsrc({"xml"});
+ preview_dialog_xml(dialog_xml);
+}
+
+void preview_every_dialog_xml() {
+ if(recording){
+ record_action("preview_every_dialog_xml", "");
+ }
+ std::vector dialog_paths;
+ fs::path dialogs_path = "data/dialogs";
+ for(fs::directory_iterator it{dialogs_path}; it != fs::directory_iterator{}; ++it) {
+ fs::path path = it->path();
+ if(path.extension() != ".xml") continue;
+ dialog_paths.push_back(path);
+ }
+ cChoiceDlog dlog("preview-dialogs-confirm",{"yes","no"});
+ std::string text = dlog->getControl("msg").getText();
+ boost::replace_first(text, "{{num}}", boost::lexical_cast(dialog_paths.size()));
+ dlog->getControl("msg").setText(text);
+ std::string confirm = dlog.show();
+ if(confirm == "yes"){
+ std::for_each(dialog_paths.begin(), dialog_paths.end(), [](fs::path path) -> void {
+ ASB("Previewing dialog: " + path.stem().string());
+ print_buf();
+ preview_dialog_xml(path);
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp
index e1c1e491..e9c236f8 100644
--- a/src/game/boe.actions.hpp
+++ b/src/game/boe.actions.hpp
@@ -115,5 +115,7 @@ void close_map(bool record = false);
void cancel_item_target(bool& did_something, bool& need_redraw, bool& need_reprint);
void update_item_stats_area(bool& need_reprint);
void easter_egg(int idx);
+void preview_dialog_xml();
+void preview_every_dialog_xml();
#endif
diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp
index bf98119f..9456c3b4 100644
--- a/src/game/boe.main.cpp
+++ b/src/game/boe.main.cpp
@@ -904,6 +904,8 @@ static void replay_action(Element& action) {
show_debug_help();
}else if(t == "debug_fight_encounter"){
debug_fight_encounter(str_to_bool(action.GetText()));
+ }else if(t == "preview_every_dialog_xml"){
+ preview_every_dialog_xml();
}else if(t == "advance_time"){
// This is bad regardless of strictness, because visual changes may have occurred which won't get redrawn/reprinted
throw std::string { "Replay system internal error! advance_time() was supposed to be called by the last action, but wasn't: " } + _last_action_type;