Wire up the tutorial (which is empty)

This commit is contained in:
2025-03-22 10:05:27 -05:00
parent 4bcdae4b49
commit ca3974982c
6 changed files with 39 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- NOTE: This file should be updated to use relative positioning the next time it changes. -->
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog defbtn='play'>
<pict type='scen' size='large' num='0' top='9' left='9'/>
<text name='prompt' top='5' left='80' width='250' height='32'>You've completed the tutorial! We recommend playing the first official scenario, The Valley of Dying Things, next.</text>
<button name='cancel' type='regular' top='46' left='178'>Cancel</button>
<button name='play' type='regular' def-key='esc' top='46' left='248'>Play</button>
</dialog>

View File

@@ -36,7 +36,7 @@
<out-width>1</out-width> <out-width>1</out-width>
<out-height>1</out-height> <out-height>1</out-height>
<start-town>0</start-town> <start-town>0</start-town>
<town-start x="24" y="24" /> <town-start x="32" y="32" />
<outdoor-start x="0" y="0" /> <outdoor-start x="0" y="0" />
<sector-start x="24" y="24" /> <sector-start x="24" y="24" />
<shop> <shop>

View File

@@ -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

View File

@@ -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); std::transform(scen_name.begin(), scen_name.end(), scen_name.begin(), tolower);
size_t dot = scen_name.find_first_of('.'); size_t dot = scen_name.find_first_of('.');
std::string base_name = scen_name.substr(0,dot); 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; return progDir/"Blades of Exile Scenarios"/scen_name;
fs::path scenPath; fs::path scenPath;

View File

@@ -1411,10 +1411,17 @@ void handle_victory(bool force, bool record) {
overall_mode = MODE_STARTUP; overall_mode = MODE_STARTUP;
draw_startup(0); draw_startup(0);
menu_activate(); menu_activate();
bool tutorial_finished = (univ.party.scen_name == "tutorial.boes");
univ.party.scen_name = ""; // should be harmless... univ.party.scen_name = ""; // should be harmless...
if(!force && cChoiceDlog("congrats-save",{"cancel","save"}).show() == "save"){ if(!force && cChoiceDlog("congrats-save",{"cancel","save"}).show() == "save"){
do_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() { static void handle_party_death() {
@@ -3654,7 +3661,7 @@ void new_party() {
} }
if(party_in_memory) { if(party_in_memory) {
cChoiceDlog confirm("restart-game",{"okay","cancel"}); 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(); std::string choice = confirm.show();
if(choice == "cancel") if(choice == "cancel")
return; return;
@@ -3764,7 +3771,17 @@ void start_new_game(bool force) {
void start_tutorial() { void start_tutorial() {
std::string version_flag = get_feature_version("tutorial"); std::string version_flag = get_feature_version("tutorial");
if(!version_flag.empty()){ 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{ }else{
showWarning("Tutorial coming soon!"); showWarning("Tutorial coming soon!");
} }

View File

@@ -131,6 +131,8 @@ std::map<std::string,std::vector<std::string>> feature_flags = {
// Game balance // Game balance
{"magic-resistance", {"fixed"}}, // Resist Magic used to not help with magic damage! {"magic-resistance", {"fixed"}}, // Resist Magic used to not help with magic damage!
{"door-town-difficulty", {"fixed"}}, {"door-town-difficulty", {"fixed"}},
// Tutorial
{"tutorial", {"V1"}}
}; };
struct cParseEntrance { struct cParseEntrance {