Update the in-game item info dialog and restore support for long item descriptions
This commit is contained in:
@@ -90,4 +90,5 @@
|
||||
Click Edit Abilities to edit item abilities.
|
||||
</text>
|
||||
<button name="abils" type='large' top='357' left='155'>Abilities</button>
|
||||
<button name="desc" type='large' top='357' left='263'>Description</button>
|
||||
</dialog>
|
||||
|
@@ -7,6 +7,6 @@
|
||||
<text name='num' top='8' left='315' width='40' height='14'/>
|
||||
<pict type='dlog' num='16' top='8' left='8'/>
|
||||
<text size='large' top='6' left='50' width='138' height='17'>Editing text:</text>
|
||||
<text top='8' left='197' width='111' height='14'>Text number:</text>
|
||||
<text name='num-lbl' top='8' left='197' width='111' height='14'>Text number:</text>
|
||||
<button name='okay' type='regular' top='141' left='279'>OK</button>
|
||||
</dialog>
|
@@ -1,32 +1,35 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
||||
<!--<!DOCTYPE dialog SYSTEM "dialog.dtd">-->
|
||||
<dialog skin='dark' defbtn='done'>
|
||||
<pict name='pic' type='item' num='0' top='9' left='8'/>
|
||||
<text size='large' top='6' left='45' width='102'>Item Info:</text>
|
||||
<text top='33' left='47' width='52' height='16'>Name:</text>
|
||||
<text name='name' framed='true' top='33' left='101' width='141' height='16'/>
|
||||
<text top='61' left='4' width='52' height='16'>Type:</text>
|
||||
<text name='type' framed='true' top='61' left='58' width='141' height='16'/>
|
||||
<text top='61' left='203' width='40' height='16'>Value:</text>
|
||||
<text name='val' framed='true' top='61' left='245' width='47' height='16'/>
|
||||
<text top='89' left='4' width='52' height='16'>Damage:</text>
|
||||
<text name='dmg' framed='true' top='89' left='58' width='25' height='15'/>
|
||||
<text top='89' left='96' width='48' height='16'>Bonus:</text>
|
||||
<text name='bonus' framed='true' top='89' left='146' width='25' height='15'/>
|
||||
<text top='89' left='179' width='50' height='16'>Defend:</text>
|
||||
<text name='def' framed='true' top='89' left='231' width='25' height='15'/>
|
||||
<text top='117' left='5' width='58' height='16'>Encumb.:</text>
|
||||
<text name='enc' framed='true' top='117' left='65' width='25' height='16'/>
|
||||
<text top='118' left='98' width='38' height='16'>Uses:</text>
|
||||
<text name='use' framed='true' top='118' left='138' width='26' height='16'/>
|
||||
<text top='118' left='179' width='74' height='16'>Item Level:</text>
|
||||
<text name='lvl' framed='true' top='118' left='255' width='25' height='16'/>
|
||||
<text top='168' left='7' width='52' height='16'>Ability:</text>
|
||||
<text name='abil' framed='true' top='168' left='61' width='230' height='16'/>
|
||||
<button name='done' type='done' top='191' left='228'/>
|
||||
<button name='left' type='left' def-key='left' top='191' left='84'/>
|
||||
<button name='right' type='right' def-key='right' top='191' left='153'/>
|
||||
<led name='id' state='off' top='8' left='213'/>
|
||||
<led name='magic' state='off' top='8' left='280'/>
|
||||
<!--
|
||||
TODO: This originally had width=11 height=6; if it looks wrong in-game, try reverting to that
|
||||
TODO: Reinstate item descriptions
|
||||
-->
|
||||
<text size='large' top='192' left='8' width='0' height='0'>Description:</text>
|
||||
<text name='desc' framed='true' top='210' left='8' width='12' height='6'/>
|
||||
<button name='done' type='done' top='307' left='228'/>
|
||||
<button name='left' type='left' def-key='left' top='307' left='84'/>
|
||||
<button name='right' type='right' def-key='right' top='307' left='153'/>
|
||||
<led name='id' font='bold' top='8' left='167' width='60'>Magic?</led>
|
||||
<led name='magic' font='bold' top='8' left='252' width='42'>ID?</led>
|
||||
<text size='large' top='192' left='8' width='100' height='15'>Description:</text>
|
||||
<text name='desc' framed='true' top='210' left='8' width='283' height='90'/>
|
||||
<text top='142' left='4' width='54' height='16'>Weight</text>
|
||||
<text name='weight' framed='true' top='142' left='60' width='44' height='15'/>
|
||||
<!--
|
||||
TODO: Add the labels to the XML definition
|
||||
-->
|
||||
</dialog>
|
@@ -190,14 +190,14 @@ static void put_item_info(cDialog& me,const cItem& s_i) {
|
||||
|
||||
// id? magic?
|
||||
cLed& id = dynamic_cast<cLed&>(me["id"]);
|
||||
if(s_i.magic && s_i.ident)
|
||||
if(s_i.ident)
|
||||
id.setState(led_red);
|
||||
else id.setState(led_off);
|
||||
cLed& magic = dynamic_cast<cLed&>(me["magic"]);
|
||||
if(s_i.ident)
|
||||
if(s_i.magic && s_i.ident)
|
||||
magic.setState(led_red);
|
||||
else magic.setState(led_off);
|
||||
me["type"].setText(get_str("item-types-display", (int)s_i.variety));
|
||||
me["type"].setText(get_str("item-types-display", int(s_i.variety)));
|
||||
|
||||
// Clear fields
|
||||
me["val"].setText("");
|
||||
@@ -210,12 +210,13 @@ static void put_item_info(cDialog& me,const cItem& s_i) {
|
||||
me["abil"].setText("");
|
||||
|
||||
if(!s_i.ident) {
|
||||
me["name"].setText(s_i.name.c_str());
|
||||
me["name"].setText(s_i.name);
|
||||
return;
|
||||
}
|
||||
|
||||
me["name"].setText(s_i.full_name.c_str());
|
||||
me["name"].setText(s_i.full_name);
|
||||
me["weight"].setTextToNum(s_i.item_weight());
|
||||
me["desc"].setText(s_i.desc);
|
||||
|
||||
// TODO: This calculation (value for an item with charges) should be in a member function of cItem
|
||||
me["val"].setTextToNum((s_i.charges > 0) ? s_i.value * s_i.charges : s_i.value);
|
||||
@@ -224,9 +225,7 @@ static void put_item_info(cDialog& me,const cItem& s_i) {
|
||||
if(s_i.concealed) {
|
||||
me["abil"].setText("???");
|
||||
} else {
|
||||
// TODO: More descriptive ability descriptions, taking into account potential variation
|
||||
desc_str = get_str("item-abilities",int(s_i.ability) + 1);
|
||||
me["abil"].setText(desc_str.c_str());
|
||||
me["abil"].setText(s_i.getAbilName());
|
||||
}
|
||||
}
|
||||
if(s_i.charges > 0)
|
||||
@@ -238,29 +237,14 @@ static void put_item_info(cDialog& me,const cItem& s_i) {
|
||||
switch(s_i.variety) {
|
||||
case eItemType::ONE_HANDED:
|
||||
case eItemType::TWO_HANDED:
|
||||
switch(s_i.weap_type) {
|
||||
case eSkill::EDGED_WEAPONS:
|
||||
store_text = "Edged weapon";
|
||||
break;
|
||||
case eSkill::BASHING_WEAPONS:
|
||||
store_text = "Bashing weapon";
|
||||
break;
|
||||
case eSkill::POLE_WEAPONS:
|
||||
store_text = "Pole weapon";
|
||||
break;
|
||||
case eSkill::INVALID:
|
||||
default:
|
||||
store_text = "Error weapon"; // should never be reached
|
||||
}
|
||||
// TODO: I wonder if this would fit better in the Item Type box?
|
||||
if(s_i.ability == eItemAbil::NONE)
|
||||
me["abil"].setText(store_text);
|
||||
case eItemType::BOW:
|
||||
case eItemType::CROSSBOW:
|
||||
case eItemType::ARROW:
|
||||
case eItemType::THROWN_MISSILE:
|
||||
case eItemType::BOLTS:
|
||||
case eItemType::MISSILE_NO_AMMO:
|
||||
if(s_i.ability == eItemAbil::NONE)
|
||||
me["abil"].setText("Key skill: " + get_str("skills", int(s_i.weap_type) * 2 + 1));
|
||||
case eItemType::ARROW:
|
||||
case eItemType::BOLTS:
|
||||
me["dmg"].setTextToNum(s_i.item_level);
|
||||
me["bonus"].setTextToNum(s_i.bonus);
|
||||
break;
|
||||
@@ -329,21 +313,6 @@ void display_pc_item(short pc_num,short item,cItem si,cDialog* parent) {
|
||||
itemInfo["left"].hide();
|
||||
itemInfo["right"].hide();
|
||||
}
|
||||
itemInfo.addLabelFor("name", "Name:", LABEL_LEFT, 26, true);
|
||||
itemInfo.addLabelFor("type", "Type:", LABEL_LEFT, 26, true);
|
||||
itemInfo.addLabelFor("val", "Value:", LABEL_LEFT, 20, true);
|
||||
itemInfo.addLabelFor("dmg", "Damage:", LABEL_LEFT, 26, true);
|
||||
itemInfo.addLabelFor("bonus", "Bonus:", LABEL_LEFT, 24, true);
|
||||
itemInfo.addLabelFor("def", "Defend:", LABEL_LEFT, 25, true);
|
||||
itemInfo.addLabelFor("enc", "Encumb.:", LABEL_LEFT, 29, true);
|
||||
itemInfo.addLabelFor("use", "Uses:", LABEL_LEFT, 19, true);
|
||||
itemInfo.addLabelFor("lvl", "Item Level:", LABEL_LEFT, 37, true);
|
||||
itemInfo.addLabelFor("abil", "Ability", LABEL_LEFT, 26, true);
|
||||
itemInfo.addLabelFor("id", "ID?", LABEL_LEFT, 13, true);
|
||||
itemInfo.addLabelFor("magic", "Magic?", LABEL_LEFT, 22, true);
|
||||
itemInfo.addLabelFor("weight", "Weight", LABEL_LEFT, 27, true);
|
||||
|
||||
itemInfo["desc"].hide();
|
||||
|
||||
put_item_info(itemInfo,si);
|
||||
|
||||
|
@@ -134,7 +134,7 @@ cItem::cItem(long preset){
|
||||
bonus = 0;
|
||||
protection = 0;
|
||||
charges = 0;
|
||||
weap_type = eSkill::INVALID;
|
||||
weap_type = eSkill::ARCHERY;
|
||||
magic_use_type = 0;
|
||||
graphic_num = 10;
|
||||
value = 15;
|
||||
@@ -199,7 +199,7 @@ cItem::cItem(long preset){
|
||||
bonus = 1;
|
||||
protection = 0;
|
||||
charges = 8;
|
||||
weap_type = eSkill::INVALID;
|
||||
weap_type = eSkill::THROWN_MISSILES;
|
||||
magic_use_type = 0;
|
||||
graphic_num = 59;
|
||||
missile = 7;
|
||||
@@ -932,7 +932,7 @@ void cItem::append(legacy::item_record_type& old){
|
||||
}
|
||||
}
|
||||
|
||||
std::string cItem::getAbilName() {
|
||||
std::string cItem::getAbilName() const {
|
||||
bool harmful = magic_use_type % 2;
|
||||
bool party = magic_use_type >= 2;
|
||||
std::ostringstream sout;
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
unsigned char rec_treas_class() const;
|
||||
short item_weight() const;
|
||||
|
||||
std::string getAbilName();
|
||||
std::string getAbilName() const;
|
||||
|
||||
cItem();
|
||||
explicit cItem(long preset);
|
||||
|
@@ -1368,6 +1368,15 @@ static bool edit_item_type_event_filter(cDialog& me, std::string item_hit, cItem
|
||||
i = pick_picture(PIC_MISSILE, me, "missile", "missile-pic");
|
||||
if(i < 0) return true;
|
||||
store_item.missile = i;
|
||||
} else if(item_hit == "desc") {
|
||||
cDialog desc_dlg("edit-text", &me);
|
||||
desc_dlg["left"].hide();
|
||||
desc_dlg["right"].hide();
|
||||
desc_dlg["okay"].attachClickHandler(std::bind(&cDialog::toast, &desc_dlg, true));
|
||||
desc_dlg["text"].setText(store_item.desc);
|
||||
desc_dlg["num-lbl"].setText(store_item.full_name);
|
||||
desc_dlg.run();
|
||||
store_item.desc = desc_dlg["text"].getText();
|
||||
} else if(item_hit == "abils") {
|
||||
save_item_info(me, store_item, store_which_item);
|
||||
if(store_item.variety == eItemType::NO_ITEM) {
|
||||
@@ -1432,7 +1441,7 @@ short edit_item_type(short which_item) {
|
||||
item_dlg["weight"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 250, "Weight"));
|
||||
item_dlg["class"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 100, "Special Class"));
|
||||
item_dlg["variety"].attachFocusHandler(std::bind(change_item_variety, _1, _2, std::ref(store_item)));
|
||||
item_dlg.attachClickHandlers(std::bind(edit_item_type_event_filter, _1, _2, std::ref(store_item), std::ref(which_item)), {"okay", "cancel", "prev", "next", "abils", "choosepic", "choosetp", "choosemiss"});
|
||||
item_dlg.attachClickHandlers(std::bind(edit_item_type_event_filter, _1, _2, std::ref(store_item), std::ref(which_item)), {"okay", "cancel", "prev", "next", "abils", "choosepic", "choosetp", "choosemiss", "desc"});
|
||||
|
||||
put_item_info_in_dlog(item_dlg, store_item, which_item);
|
||||
|
||||
|
Reference in New Issue
Block a user