Add UI for scenario init special and hail townsperson special

This commit is contained in:
2015-09-24 10:13:36 -04:00
parent d126beaf1f
commit 249e0e0027
4 changed files with 49 additions and 16 deletions

View File

@@ -7,7 +7,7 @@
<field name='who1' top='104' left='181' width='243' height='47'/> <field name='who1' top='104' left='181' width='243' height='47'/>
<field name='who2' top='159' left='181' width='243' height='47'/> <field name='who2' top='159' left='181' width='243' height='47'/>
<field name='contact' top='214' left='181' width='243' height='65'/> <field name='contact' top='214' left='181' width='243' height='65'/>
<button name='okay' type='regular' top='500' left='395'>OK</button> <button name='okay' type='regular' top='528' left='395'>OK</button>
<pict type='dlog' num='16' top='8' left='8'/> <pict type='dlog' num='16' top='8' left='8'/>
<text top='23' left='50' width='372' height='53'> <text top='23' left='50' width='372' height='53'>
This is where you can define the various pieces of information the user will see when deciding whether or not to play your scenario. This is where you can define the various pieces of information the user will see when deciding whether or not to play your scenario.
@@ -36,18 +36,21 @@
<led name='lvl4' state='off' top='339' left='281' width='94'>Very High Level (30+)</led> <led name='lvl4' state='off' top='339' left='281' width='94'>Very High Level (30+)</led>
</group> </group>
<led name='adjust' top='356' left='50' size='small' width='350'>Adjust difficulty if played by a party stronger than recommended</led> <led name='adjust' top='356' left='50' size='small' width='350'>Adjust difficulty if played by a party stronger than recommended</led>
<text top='379' left='50' width='120' height='14'>Campaign ID:</text> <text top='379' left='50' width='120' height='14'>Special on Start:</text>
<field name='cpnid' top='378' left='181' width='100' height='16'/> <field name='oninit' top='378' left='181' width='100' height='16'/>
<text top='402' left='50' width='400' height='44'> <button name='pickinit' type='large' top='374' left='290'>Create/Edit</button>
<text top='407' left='50' width='120' height='14'>Campaign ID:</text>
<field name='cpnid' top='406' left='181' width='100' height='16'/>
<text top='430' left='50' width='400' height='44'>
If your scenario is part of a campaign of several scenarios, If your scenario is part of a campaign of several scenarios,
the ID specified here makes it easy to carry information from one scenario to the next. the ID specified here makes it easy to carry information from one scenario to the next.
It should be the same in each scenario in the series. It should be the same in each scenario in the series.
</text> </text>
<text top='456' left='50' width='120' height='60'>Default backgrounds:<br/> <text top='484' left='50' width='120' height='60'>Default backgrounds:<br/>
Set the default patterns to be shown behind the game screen. Set the default patterns to be shown behind the game screen.
</text> </text>
<button name='bg-out' type='tiny' top='456' left='180' width='100'>Outdoors:</button> <button name='bg-out' type='tiny' top='484' left='180' width='100'>Outdoors:</button>
<button name='bg-town' type='tiny' top='473' left='180' width='100'>In towns:</button> <button name='bg-town' type='tiny' top='501' left='180' width='100'>In towns:</button>
<button name='bg-dungeon' type='tiny' top='490' left='180' width='100'>In dungeons:</button> <button name='bg-dungeon' type='tiny' top='518' left='180' width='100'>In dungeons:</button>
<button name='bg-fight' type='tiny' top='507' left='180' width='100'>In combat:</button> <button name='bg-fight' type='tiny' top='535' left='180' width='100'>In combat:</button>
</dialog> </dialog>

View File

@@ -7,8 +7,8 @@
<field name='extra1' top='126' left='221' width='67' height='16'/> <field name='extra1' top='126' left='221' width='67' height='16'/>
<field name='extra2' top='153' left='221' width='67' height='16'/> <field name='extra2' top='153' left='221' width='67' height='16'/>
<field name='death' top='298' left='285' width='67' height='16'/> <field name='death' top='298' left='285' width='67' height='16'/>
<field name='sdfx' top='334' left='262' width='39' height='16'/> <field name='sdfx' top='362' left='262' width='39' height='16'/>
<field name='sdfy' top='334' left='310' width='39' height='16'/> <field name='sdfy' top='362' left='310' width='39' height='16'/>
<text size='large' top='6' left='50' width='256' height='17'>Townsperson/monster advanced</text> <text size='large' top='6' left='50' width='256' height='17'>Townsperson/monster advanced</text>
<text top='28' left='62' width='97' height='15'>Creature type:</text> <text top='28' left='62' width='97' height='15'>Creature type:</text>
<text name='type' top='28' left='162' width='195' height='15'/> <text name='type' top='28' left='162' width='195' height='15'/>
@@ -20,15 +20,21 @@
(-1 for none) (-1 for none)
</text> </text>
<button name='editdeath' type='large' top='294' left='360'>Create/Edit</button> <button name='editdeath' type='large' top='294' left='360'>Create/Edit</button>
<text top='322' left='25' width='230' height='40'> <text top='321' left='25' width='247' height='27'>
Number of town special node to call before talking to creature:
(-1 for none)
</text>
<field name='hail' top='326' left='285' width='67' height='16'/>
<button name='edithail' type='large' top='322' left='360'>Create/Edit</button>
<text top='350' left='25' width='230' height='40'>
Stuff done flag creature's life is linked to: Stuff done flag creature's life is linked to:
(0 - alive, (0 - alive,
1 - dead), 1 - dead),
if either is -1, this is ignored. if either is -1, this is ignored.
</text> </text>
<text size='large' top='182' left='9' width='205' height='17'>Creature and special encs.</text> <text size='large' top='182' left='9' width='205' height='17'>Creature and special encs.</text>
<button name='okay' type='regular' top='336' left='492'>OK</button> <button name='okay' type='regular' top='364' left='492'>OK</button>
<button name='cancel' type='regular' def-key='esc' top='336' left='411'>Cancel</button> <button name='cancel' type='regular' def-key='esc' top='364' left='411'>Cancel</button>
<pict type='dlog' num='16' top='8' left='8'/> <pict type='dlog' num='16' top='8' left='8'/>
<text top='7' left='317' width='126' height='15'>Creature number:</text> <text top='7' left='317' width='126' height='15'>Creature number:</text>
<text name='num' top='7' left='454' width='50' height='15'/> <text name='num' top='7' left='454' width='50' height='15'/>

View File

@@ -2774,6 +2774,7 @@ static bool save_scen_details(cDialog& me, std::string, eKeyMod) {
scenario.bg_town = boost::lexical_cast<int>(me["bg-town"].getText().substr(10)); scenario.bg_town = boost::lexical_cast<int>(me["bg-town"].getText().substr(10));
scenario.bg_dungeon = boost::lexical_cast<int>(me["bg-dungeon"].getText().substr(13)); scenario.bg_dungeon = boost::lexical_cast<int>(me["bg-dungeon"].getText().substr(13));
scenario.bg_fight = boost::lexical_cast<int>(me["bg-fight"].getText().substr(11)); scenario.bg_fight = boost::lexical_cast<int>(me["bg-fight"].getText().substr(11));
scenario.init_spec = me["oninit"].getTextAsNum();
return true; return true;
} }
@@ -2791,6 +2792,15 @@ static void put_scen_details_in_dlog(cDialog& me) {
me["bg-town"].setText("In towns: " + std::to_string(scenario.bg_town)); me["bg-town"].setText("In towns: " + std::to_string(scenario.bg_town));
me["bg-dungeon"].setText("In dungeons: " + std::to_string(scenario.bg_dungeon)); me["bg-dungeon"].setText("In dungeons: " + std::to_string(scenario.bg_dungeon));
me["bg-fight"].setText("In combat: " + std::to_string(scenario.bg_fight)); me["bg-fight"].setText("In combat: " + std::to_string(scenario.bg_fight));
me["oninit"].setTextToNum(scenario.init_spec);
}
static bool edit_scen_init_spec(cDialog& me, std::string, eKeyMod) {
int spec = me["oninit"].getTextAsNum();
if(spec < 0) spec = get_fresh_spec(0);
if(edit_spec_enc(spec, 0, &me))
me["oninit"].setTextToNum(spec);
return true;
} }
static bool edit_scen_default_bgs(cDialog& me, std::string which, eKeyMod) { static bool edit_scen_default_bgs(cDialog& me, std::string which, eKeyMod) {
@@ -2821,6 +2831,7 @@ void edit_scen_details() {
cDialog info_dlg("edit-scenario-details"); cDialog info_dlg("edit-scenario-details");
info_dlg["okay"].attachClickHandler(save_scen_details); info_dlg["okay"].attachClickHandler(save_scen_details);
info_dlg.attachClickHandlers(edit_scen_default_bgs, {"bg-out", "bg-town", "bg-dungeon", "bg-fight"}); info_dlg.attachClickHandlers(edit_scen_default_bgs, {"bg-out", "bg-town", "bg-dungeon", "bg-fight"});
info_dlg["pickinit"].attachClickHandler(edit_scen_init_spec);
put_scen_details_in_dlog(info_dlg); put_scen_details_in_dlog(info_dlg);

View File

@@ -131,6 +131,7 @@ static void put_placed_monst_adv_in_dlog(cDialog& me, cTownperson& monst, const
me["extra2"].setTextToNum(monst.time_code); me["extra2"].setTextToNum(monst.time_code);
me["group"].setTextToNum(monst.spec_enc_code); me["group"].setTextToNum(monst.spec_enc_code);
me["death"].setTextToNum(monst.special_on_kill); me["death"].setTextToNum(monst.special_on_kill);
me["hail"].setTextToNum(monst.special_on_talk);
me["sdfx"].setTextToNum(monst.spec1); me["sdfx"].setTextToNum(monst.spec1);
me["sdfy"].setTextToNum(monst.spec2); me["sdfy"].setTextToNum(monst.spec2);
} }
@@ -153,6 +154,8 @@ static bool get_placed_monst_adv_in_dlog(cDialog& me, cTownperson& monst) {
if(cre(monst.time_code,0,10,"Event code must be 0 (for no event) or from 1 to 10.","",&me)) return false; if(cre(monst.time_code,0,10,"Event code must be 0 (for no event) or from 1 to 10.","",&me)) return false;
monst.special_on_kill = me["death"].getTextAsNum(); monst.special_on_kill = me["death"].getTextAsNum();
if(cre(monst.special_on_kill,-1,town->specials.size(),"Town special node number must be from 0 to 99 (or -1 for no special).","",&me)) return false; if(cre(monst.special_on_kill,-1,town->specials.size(),"Town special node number must be from 0 to 99 (or -1 for no special).","",&me)) return false;
monst.special_on_talk = me["hail"].getTextAsNum();
if(cre(monst.special_on_talk,-1,town->specials.size(),"Town special node number must be from 0 to 99 (or -1 for no special).","",&me)) return false;
monst.spec1 = me["sdfx"].getTextAsNum(); monst.spec1 = me["sdfx"].getTextAsNum();
if(cre(monst.spec1,-1,299,"First part of special flag must be -1 (if this is to be ignored) or from 0 to 299.","",&me)) return false; if(cre(monst.spec1,-1,299,"First part of special flag must be -1 (if this is to be ignored) or from 0 to 299.","",&me)) return false;
monst.spec2 = me["sdfy"].getTextAsNum(); monst.spec2 = me["sdfy"].getTextAsNum();
@@ -183,7 +186,7 @@ static bool edit_placed_monst_adv_time_flag(cDialog& me, std::string, bool losin
return true; return true;
} }
static bool edit_placed_monst_adv_death(cDialog& me, cTownperson& monst) { static bool edit_placed_monst_adv_death(cDialog& me) {
short spec = me["death"].getTextAsNum(); short spec = me["death"].getTextAsNum();
if(spec < 0) if(spec < 0)
spec = get_fresh_spec(2); spec = get_fresh_spec(2);
@@ -192,13 +195,23 @@ static bool edit_placed_monst_adv_death(cDialog& me, cTownperson& monst) {
return true; return true;
} }
static bool edit_placed_monst_adv_hail(cDialog& me) {
short spec = me["hail"].getTextAsNum();
if(spec < 0)
spec = get_fresh_spec(2);
if(edit_spec_enc(spec,2,&me))
me["hail"].setTextToNum(spec);
return true;
}
cTownperson edit_placed_monst_adv(cTownperson initial, short which, cDialog& parent) { cTownperson edit_placed_monst_adv(cTownperson initial, short which, cDialog& parent) {
using namespace std::placeholders; using namespace std::placeholders;
cDialog edit("edit-townperson-advanced", &parent); cDialog edit("edit-townperson-advanced", &parent);
edit["okay"].attachClickHandler(std::bind(edit_placed_monst_adv_event_filter, _1, _2, std::ref(initial))); edit["okay"].attachClickHandler(std::bind(edit_placed_monst_adv_event_filter, _1, _2, std::ref(initial)));
edit["cancel"].attachClickHandler(std::bind(edit_placed_monst_adv_event_filter, _1, _2, std::ref(initial))); edit["cancel"].attachClickHandler(std::bind(edit_placed_monst_adv_event_filter, _1, _2, std::ref(initial)));
edit["editdeath"].attachClickHandler(std::bind(edit_placed_monst_adv_death, _1, std::ref(initial))); edit["editdeath"].attachClickHandler(std::bind(edit_placed_monst_adv_death, _1));
edit["edithail"].attachClickHandler(std::bind(edit_placed_monst_adv_hail, _1));
edit["time"].attachFocusHandler(edit_placed_monst_adv_time_flag); edit["time"].attachFocusHandler(edit_placed_monst_adv_time_flag);
put_placed_monst_adv_in_dlog(edit,initial,which); put_placed_monst_adv_in_dlog(edit,initial,which);