Use SDF picker in Townperson Advanced and Outdoor Encounter dialogs

This commit is contained in:
2025-03-07 13:15:30 -05:00
committed by Celtic Minstrel
parent c032307280
commit 3c811ef43d
3 changed files with 44 additions and 29 deletions

View File

@@ -3,11 +3,11 @@
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog defbtn='okay'>
<!-- OK button -->
<field name='onmeet' top='216' left='361' width='46' height='16'/>
<field name='onwin' top='259' left='361' width='46' height='16'/>
<field name='onflee' top='302' left='361' width='46' height='16'/>
<field name='endx' top='336' left='460' width='39' height='16'/>
<field name='endy' top='336' left='508' width='39' height='16'/>
<field name='onmeet' top='189' left='361' width='46' height='16'/>
<field name='onwin' top='231' left='361' width='46' height='16'/>
<field name='onflee' top='275' left='361' width='46' height='16'/>
<field name='endy' top='309' left='460' width='39' height='16'/>
<field name='endx' top='309' left='508' width='39' height='16'/>
<text name='foe1' framed='true' top='135' left='129' width='145' height='14'/>
<text name='foe2' framed='true' top='159' left='129' width='145' height='14'/>
<text name='foe3' framed='true' top='183' left='129' width='145' height='14'/>
@@ -32,9 +32,10 @@
<button name='choose-ally1' type='regular' top='298' left='280'>Choose</button>
<button name='choose-ally2' type='regular' top='322' left='280'>Choose</button>
<button name='choose-ally3' type='regular' top='346' left='280'>Choose</button>
<button name='edit-meet' type='large' top='213' left='412'>Create/Edit</button>
<button name='edit-win' type='large' top='256' left='412'>Create/Edit</button>
<button name='edit-flee' type='large' top='298' left='412'>Create/Edit</button>
<button name='edit-meet' type='large' top='186' left='412'>Create/Edit</button>
<button name='edit-win' type='large' top='229' left='412'>Create/Edit</button>
<button name='edit-flee' type='large' top='271' left='412'>Create/Edit</button>
<button name='edit-end' type='regular' top='330' left='458'>Choose</button>
<text top='135' left='11' width='113' height='14'>Hostile (15-30)</text>
<text top='159' left='11' width='113' height='14'>Hostile (7-10)</text>
<text top='183' left='11' width='113' height='14'>Hostile (4-6)</text>
@@ -64,9 +65,8 @@
<text top='132' left='368' width='170' height='27'>(Party fights it right away)</text>
<text size='large' top='114' left='11' width='191' height='17'>Monsters in encounter:</text>
<text size='large' top='152' left='350' width='191' height='17'>Advanced encounter traits:</text>
<text top='197' left='352' width='194' height='14'>Special called when enc. starts</text>
<text top='240' left='352' width='194' height='14'>Special called when party wins</text>
<text top='283' left='352' width='194' height='14'>Special called if party flees</text>
<text top='326' left='352' width='103' height='33'>Stuff done flag to eliminate encounter</text>
<text top='168' left='364' width='170' height='27'>Note: Ignore these if you aren't sure what they do.</text>
<text top='170' left='352' width='194' height='14'>Special called when enc. starts</text>
<text top='213' left='352' width='194' height='14'>Special called when party wins</text>
<text top='256' left='352' width='194' height='14'>Special called if party flees</text>
<text top='299' left='352' width='103' height='33'>Stuff done flag to eliminate encounter</text>
</dialog>

View File

@@ -8,8 +8,8 @@
<field name='extra1' top='126' 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='sdfx' top='362' left='262' width='39' height='16'/>
<field name='sdfy' top='362' left='310' width='39' height='16'/>
<field name='sdfy' top='362' left='262' width='39' height='16'/>
<field name='sdfx' top='362' left='310' width='39' height='16'/>
<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 name='type' top='28' left='162' width='195' height='15'/>
@@ -33,9 +33,10 @@
1 - dead),
if either is -1, this is ignored.
</text>
<button name='editsdf' type='regular' top='358' left='360'>Choose</button>
<text size='large' top='182' left='9' width='205' height='17'>Creature and special encs.</text>
<button name='okay' type='regular' top='364' left='492'>OK</button>
<button name='cancel' type='regular' def-key='esc' top='364' left='411'>Cancel</button>
<button name='okay' type='regular' top='358' left='512'>OK</button>
<button name='cancel' type='regular' def-key='esc' top='358' left='438'>Cancel</button>
<pict type='dlog' num='16' top='8' left='8'/>
<text top='7' left='317' width='126' height='15'>Creature number:</text>
<text name='num' top='7' left='454' width='50' height='15'/>

View File

@@ -149,8 +149,8 @@ static void put_placed_monst_adv_in_dlog(cDialog& me, cTownperson& monst, const
me["group"].setTextToNum(monst.spec_enc_code);
me["death"].setTextToNum(monst.special_on_kill);
me["hail"].setTextToNum(monst.special_on_talk);
me["sdfx"].setTextToNum(monst.spec1);
me["sdfy"].setTextToNum(monst.spec2);
me["sdfy"].setTextToNum(monst.spec1);
me["sdfx"].setTextToNum(monst.spec2);
if(need_event) {
me["choose-event"].show();
} else {
@@ -178,10 +178,10 @@ static bool get_placed_monst_adv_in_dlog(cDialog& me, cTownperson& monst) {
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();
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();
if(cre(monst.spec2,-1,9,"Second part of special flag must be -1 (if this is to be ignored) or from 0 to 9.","",&me)) return false;
monst.spec1 = me["sdfy"].getTextAsNum();
if(cre(monst.spec1,-1,SDF_ROWS - 1,"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["sdfx"].getTextAsNum();
if(cre(monst.spec2,-1,SDF_ROWS - 1,"Second part of special flag must be -1 (if this is to be ignored) or from 0 to 9.","",&me)) return false;
monst.spec_enc_code = me["group"].getTextAsNum();
return true;
@@ -246,6 +246,13 @@ cTownperson edit_placed_monst_adv(cTownperson initial, short which, cDialog& par
me["extra2"].setTextToNum(value);
return true;
});
edit["editsdf"].attachClickHandler([](cDialog& me, std::string, eKeyMod) {
location sdf(me["sdfx"].getTextAsNum(), me["sdfy"].getTextAsNum());
sdf = cStuffDonePicker(sdf).run();
me["sdfx"].setTextToNum(sdf.x);
me["sdfy"].setTextToNum(sdf.y);
return true;
});
put_placed_monst_adv_in_dlog(edit,initial,which);
@@ -553,16 +560,16 @@ static void put_out_wand_in_dlog(cDialog& me, short which, const cOutdoors::cWan
me["onmeet"].setTextToNum(wand.spec_on_meet);
me["onwin"].setTextToNum(wand.spec_on_win);
me["onflee"].setTextToNum(wand.spec_on_flee);
me["endx"].setTextToNum(wand.end_spec1);
me["endy"].setTextToNum(wand.end_spec2);
me["endy"].setTextToNum(wand.end_spec1);
me["endx"].setTextToNum(wand.end_spec2);
}
static void save_out_wand(cDialog& me, short which, cOutdoors::cWandering& wand, short mode) {
wand.spec_on_meet = me["onmeet"].getTextAsNum();
wand.spec_on_win = me["onwin"].getTextAsNum();
wand.spec_on_flee = me["onflee"].getTextAsNum();
wand.end_spec1 = me["endx"].getTextAsNum();
wand.end_spec2 = me["endy"].getTextAsNum();
wand.end_spec1 = me["endy"].getTextAsNum();
wand.end_spec2 = me["endx"].getTextAsNum();
wand.forced = dynamic_cast<cLed&>(me["forced"]).getState() != led_off;
wand.cant_flee = dynamic_cast<cLed&>(me["no-flee"]).getState() != led_off;
@@ -637,12 +644,19 @@ void edit_out_wand(short mode) {
cDialog wand_dlg(*ResMgr::dialogs.get("edit-outdoor-encounter"));
wand_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &wand_dlg, false));
wand_dlg["endx"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 299, "First part of Stuff Done flag", "-1 if not used"));
wand_dlg["endy"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 9, "Second part of Stuff Done flag", "-1 if not used"));
wand_dlg["endx"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, SDF_COLUMNS - 1, "First part of Stuff Done flag", "-1 if not used"));
wand_dlg["endy"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, SDF_ROWS - 1, "Second part of Stuff Done flag", "-1 if not used"));
wand_dlg.attachClickHandlers(std::bind(edit_out_wand_event_filter, _1, _2, std::ref(which), std::ref(wand), mode), {"okay", "left", "right"});
wand_dlg.attachClickHandlers(std::bind(edit_out_wand_spec, _1, _2, which, std::ref(wand)), {"edit-meet", "edit-win", "edit-flee"});
wand_dlg.attachClickHandlers(std::bind(edit_out_wand_monst, _1, _2, which, std::ref(wand)), {"choose-foe1", "choose-foe2", "choose-foe3", "choose-foe4", "choose-foe5", "choose-foe6", "choose-foe7", "choose-ally1", "choose-ally2", "choose-ally3"});
wand_dlg.attachFocusHandlers(std::bind(check_range_msg, _1, _2, _3, -1, 59, "Outdoor Special Node", "-1 if not used"), {"onmeet", "onwin", "onflee"});
wand_dlg["edit-end"].attachClickHandler([](cDialog& me, std::string, eKeyMod) {
location sdf(me["endx"].getTextAsNum(), me["endy"].getTextAsNum());
sdf = cStuffDonePicker(sdf).run();
me["endx"].setTextToNum(sdf.x);
me["endy"].setTextToNum(sdf.y);
return true;
});
if(mode == 1)
wand_dlg["title"].setText("Outdoor Special Encounter:");