From 2903f4d6e15d53850b4cf668255fe26f66d5a00d Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 22 Mar 2025 10:05:27 -0500 Subject: [PATCH] Wire up the tutorial (which is empty) --- rsrc/dialogs/start-valleydy.xml | 9 +++++++++ rsrc/scenarios/tutorial/scenario.xml | 2 +- rsrc/scenarios/tutorial/towns/town0.spec | 7 +++++++ src/fileio/fileio_scen.cpp | 2 +- src/game/boe.actions.cpp | 21 +++++++++++++++++++-- src/game/boe.main.cpp | 2 ++ 6 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 rsrc/dialogs/start-valleydy.xml diff --git a/rsrc/dialogs/start-valleydy.xml b/rsrc/dialogs/start-valleydy.xml new file mode 100644 index 00000000..1efeb6ed --- /dev/null +++ b/rsrc/dialogs/start-valleydy.xml @@ -0,0 +1,9 @@ + + + + + + You've completed the tutorial! We recommend playing the first official scenario, The Valley of Dying Things, next. + + + diff --git a/rsrc/scenarios/tutorial/scenario.xml b/rsrc/scenarios/tutorial/scenario.xml index 4bd79a6b..0fca0e30 100644 --- a/rsrc/scenarios/tutorial/scenario.xml +++ b/rsrc/scenarios/tutorial/scenario.xml @@ -36,7 +36,7 @@ 1 1 0 - + diff --git a/rsrc/scenarios/tutorial/towns/town0.spec b/rsrc/scenarios/tutorial/towns/town0.spec index e69de29b..b335e75d 100644 --- a/rsrc/scenarios/tutorial/towns/town0.spec +++ b/rsrc/scenarios/tutorial/towns/town0.spec @@ -0,0 +1,7 @@ +@end-scen = 0 + sdf -1, -1 + msg -1, -1, -1 + pic 0, 4 + ex1 -1, -1, -1 + ex2 -1, -1, -1 + goto -1 diff --git a/src/fileio/fileio_scen.cpp b/src/fileio/fileio_scen.cpp index 06078ff0..7c3f6f03 100644 --- a/src/fileio/fileio_scen.cpp +++ b/src/fileio/fileio_scen.cpp @@ -127,7 +127,7 @@ fs::path locate_scenario(std::string scen_name, bool allow_unpacked) { std::transform(scen_name.begin(), scen_name.end(), scen_name.begin(), tolower); size_t dot = scen_name.find_first_of('.'); std::string base_name = scen_name.substr(0,dot); - if(base_name == "valleydy" || base_name == "stealth" || base_name == "zakhazi"/* || base_name == "busywork" */) + if(base_name == "valleydy" || base_name == "stealth" || base_name == "zakhazi" || base_name == "tutorial" /* || base_name == "busywork" */) return progDir/"Blades of Exile Scenarios"/scen_name; fs::path scenPath; diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index e1705cb0..2b6702b3 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -1412,10 +1412,17 @@ void handle_victory(bool force, bool record) { overall_mode = MODE_STARTUP; draw_startup(0); menu_activate(); + bool tutorial_finished = (univ.party.scen_name == "tutorial.boes"); univ.party.scen_name = ""; // should be harmless... if(!force && cChoiceDlog("congrats-save",{"cancel","save"}).show() == "save"){ do_save(); } + + if(!force && tutorial_finished){ + if(cChoiceDlog("start-valleydy",{"play","cancel"}).show() == "play"){ + put_party_in_scen("valleydy.boes"); + } + } } static void handle_party_death() { @@ -3655,7 +3662,7 @@ void new_party() { } if(party_in_memory) { cChoiceDlog confirm("restart-game",{"okay","cancel"}); - (confirm.operator->())->getControl("warning").replaceText("{{action}}", "Starting over"); + confirm->getControl("warning").replaceText("{{action}}", "Starting over"); std::string choice = confirm.show(); if(choice == "cancel") return; @@ -3765,7 +3772,17 @@ void start_new_game(bool force) { void start_tutorial() { std::string version_flag = get_feature_version("tutorial"); if(!version_flag.empty()){ - // TODO implement the tutorial. If the behavior for launching the tutorial ever changes, update feature flags. + if(party_in_memory){ + cChoiceDlog confirm("restart-game",{"okay","cancel"}); + confirm->getControl("warning").replaceText("{{action}}", "Starting the tutorial"); + std::string choice = confirm.show(); + if(choice == "cancel") + return; + } + // Start by using the default party + start_new_game(true); + + put_party_in_scen("tutorial.boes"); }else{ showWarning("Tutorial coming soon!"); } diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index c69dcb8b..80e14c10 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -132,6 +132,8 @@ std::map> feature_flags = { // Game balance {"magic-resistance", {"fixed"}}, // Resist Magic used to not help with magic damage! {"door-town-difficulty", {"fixed"}}, + // Tutorial + {"tutorial", {"V1"}} }; struct cParseEntrance {