Now you can hold Alt while starting a scenario to skip party creation

(Only if party not loaded)
This commit is contained in:
2015-06-30 12:49:01 -04:00
parent cea602ce6d
commit 5a3637c370
4 changed files with 40 additions and 11 deletions

View File

@@ -7,5 +7,6 @@
<text top='6' left='49' width='273' height='43'>
You can't start a scenario until you have a party loaded.
Click the Load Game or Make New Party button to get a group of adventurers.
Or, hold the Alt key to use a preset party.
</text>
</dialog>

View File

@@ -2670,12 +2670,13 @@ void handle_death() {
}
void start_new_game() {
void start_new_game(bool force) {
short i;
std::string choice;
using kb = sf::Keyboard;
choice = cChoiceDlog("new-party",{"okay","cancel"}).show();
if(!force)
choice = cChoiceDlog("new-party",{"okay","cancel"}).show();
if(choice == "cancel")
return;
@@ -2711,7 +2712,8 @@ void start_new_game() {
// It was probably a relic of Exile III.
// (It also refreshed stores... with uninitialized items.)
edit_party();
if(!force)
edit_party();
// if no PCs left, forget it
for(i = 0 ; i < 6; i++)
@@ -2727,9 +2729,10 @@ void start_new_game() {
univ.party[i].finish_create();
}
}
party_in_memory = true;
if(force) return;
fs::path file = nav_put_party();
if(!file.empty()) save_party(file, univ);
party_in_memory = true;
}
location get_cur_direction(location the_point) {

View File

@@ -23,7 +23,7 @@ void handle_hunting();
void switch_pc(short which);
void drop_pc(short which);
void handle_death();
void start_new_game();
void start_new_game(bool force = false);
location get_cur_direction(location the_point);
bool outd_move_party(location destination,bool forced);
bool town_move_party(location destination,short forced);

View File

@@ -34,8 +34,10 @@ rectangle startup_button[6];
// TODO: Always returns false, so make it void
bool handle_startup_press(location the_point) {
using kb = sf::Keyboard;
std::string scen_name;
short i,scen;
bool force_party = false;
the_point.x -= ul.x;
the_point.y -= ul.y;
@@ -68,12 +70,20 @@ bool handle_startup_press(location the_point) {
case STARTBTN_JOIN: // regular scen
if(!party_in_memory) {
cChoiceDlog("need-party").show();
break;
if(kb::isKeyPressed(kb::LAlt) || kb::isKeyPressed(kb::RAlt)) {
force_party = true;
start_new_game(true);
} else {
cChoiceDlog("need-party").show();
break;
}
}
scen = pick_prefab_scen();
if(scen < 0)
if(scen < 0) {
if(force_party)
party_in_memory = false;
break;
}
switch(scen) {
case 0: scen_name = "valleydy.exs"; break;
@@ -83,22 +93,37 @@ bool handle_startup_press(location the_point) {
//case 3: sprintf(univ.party.scen_name,"busywork.exs"); break;
}
put_party_in_scen(scen_name);
if(force_party && scen_name != univ.party.scen_name)
party_in_memory = false;
break;
case STARTBTN_CUSTOM: // custom
if(!party_in_memory) {
cChoiceDlog("need-party").show();
break;
if(kb::isKeyPressed(kb::LAlt) || kb::isKeyPressed(kb::RAlt)) {
force_party = true;
start_new_game(true);
} else {
cChoiceDlog("need-party").show();
break;
}
}
scen = pick_a_scen();
if(scen < 0) break;
if(scen < 0) {
if(force_party)
party_in_memory = false;
break;
}
if(scen_headers[scen].prog_make_ver[0] > 2 || scen_headers[scen].prog_make_ver[1] > 0) {
if(force_party)
party_in_memory = false;
cChoiceDlog("scen-version-mismatch").show();
break;
}
scen_name = scen_headers[scen].file;
put_party_in_scen(scen_name);
if(force_party && scen_name != univ.party.scen_name)
party_in_memory = false;
break;
}
}