Monst ability editor show monster pic and name
This commit is contained in:
@@ -2,10 +2,9 @@
|
||||
<!-- 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='okay' escbtn='cancel'>
|
||||
<pict type='dlog' num='16' top='8' left='8'/>
|
||||
<pict name='icon' type='monst' num='0' top='8' left='8'/>
|
||||
<text size='large' top='6' left='50' width='158' height='16'>Edit Monster Abilities</text>
|
||||
<text framed='true' top='6' left='222' width='111' height='14'>Monster number:</text>
|
||||
<text name='num' framed='true' top='8' left='340' width='37' height='14'/>
|
||||
<text name='info' framed='true' top='6' left='222' width='170' height='14'>Monster {{num}}: {{name}}</text>
|
||||
<text top='2' left='408' width='184' height='54'>
|
||||
Enter properties for this monster type. For a detailed
|
||||
description of the fields, see the documentation.
|
||||
|
||||
@@ -619,14 +619,12 @@ bool edit_ter_type(ter_num_t which) {
|
||||
return ter_dlg.accepted() || which != first;
|
||||
}
|
||||
|
||||
static void put_monst_info_in_dlog(cDialog& me, cMonster& monst, mon_num_t which) {
|
||||
std::ostringstream strb;
|
||||
|
||||
if(monst.picture_num < 1000)
|
||||
dynamic_cast<cPict&>(me["icon"]).setPict(monst.picture_num,PIC_MONST);
|
||||
static void put_monst_pic(cPict& pict, pic_num_t num) {
|
||||
if(num < 1000)
|
||||
pict.setPict(num, PIC_MONST);
|
||||
else {
|
||||
ePicType type_g = PIC_CUSTOM_MONST;
|
||||
short size_g = monst.picture_num / 1000;
|
||||
short size_g = num / 1000;
|
||||
switch(size_g){
|
||||
case 2:
|
||||
type_g += PIC_WIDE;
|
||||
@@ -638,8 +636,15 @@ static void put_monst_info_in_dlog(cDialog& me, cMonster& monst, mon_num_t which
|
||||
type_g += PIC_LARGE;
|
||||
break;
|
||||
}
|
||||
dynamic_cast<cPict&>(me["icon"]).setPict(monst.picture_num,type_g);
|
||||
pict.setPict(num,type_g);
|
||||
}
|
||||
}
|
||||
|
||||
static void put_monst_info_in_dlog(cDialog& me, cMonster& monst, mon_num_t which) {
|
||||
std::ostringstream strb;
|
||||
|
||||
put_monst_pic(dynamic_cast<cPict&>(me["icon"]), monst.picture_num);
|
||||
|
||||
dynamic_cast<cPict&>(me["talkpic"]).setPict(monst.default_facial_pic, PIC_TALK);
|
||||
me["num"].setTextToNum(which);
|
||||
me["name"].setText(monst.m_name);
|
||||
@@ -1417,6 +1422,8 @@ cMonster edit_monst_abil(cMonster initial,short which,cDialog& parent) {
|
||||
using namespace std::placeholders;
|
||||
|
||||
cDialog monst_dlg(*ResMgr::dialogs.get("edit-monster-abils"),&parent);
|
||||
|
||||
put_monst_pic(dynamic_cast<cPict&>(monst_dlg["icon"]), initial.picture_num);
|
||||
monst_dlg["loot-item"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 399, "Item To Drop", "-1 for no item"));
|
||||
|
||||
monst_dlg["pick-item"].attachClickHandler([](cDialog& me, std::string, eKeyMod) -> bool {
|
||||
@@ -1433,7 +1440,8 @@ cMonster edit_monst_abil(cMonster initial,short which,cDialog& parent) {
|
||||
monst_dlg.attachClickHandlers(std::bind(edit_monst_abil_detail, _1, _2, std::ref(initial)), {"abil-edit1", "abil-edit2", "abil-edit3", "abil-edit4"});
|
||||
monst_dlg.attachClickHandlers(std::bind(edit_monst_abil_event_filter, _1, _2, std::ref(initial)), {"okay", "cancel", "abil-up", "abil-down", "edit-see", "pick-snd"});
|
||||
|
||||
monst_dlg["num"].setTextToNum(which);
|
||||
monst_dlg["info"].replaceText("{{num}}", std::to_string(which));
|
||||
monst_dlg["info"].replaceText("{{name}}", initial.m_name);
|
||||
put_monst_abils_in_dlog(monst_dlg, initial);
|
||||
|
||||
monst_dlg.run();
|
||||
|
||||
Reference in New Issue
Block a user