diff options
author | Paul Gilbert | 2015-02-02 18:20:27 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-02-02 18:20:27 -0500 |
commit | 2b8303c0d8b54ee5251296c86a320735422b62e2 (patch) | |
tree | d9c7a37f2500619779090f8b45eb09c906376701 | |
parent | 7febe773008db7cee0ed1b3f5f1f2fb114d22334 (diff) | |
download | scummvm-rg350-2b8303c0d8b54ee5251296c86a320735422b62e2.tar.gz scummvm-rg350-2b8303c0d8b54ee5251296c86a320735422b62e2.tar.bz2 scummvm-rg350-2b8303c0d8b54ee5251296c86a320735422b62e2.zip |
XEEN: Implemented assembleItemName method
-rw-r--r-- | engines/xeen/items.h | 4 | ||||
-rw-r--r-- | engines/xeen/party.cpp | 64 | ||||
-rw-r--r-- | engines/xeen/party.h | 2 | ||||
-rw-r--r-- | engines/xeen/resources.cpp | 32 | ||||
-rw-r--r-- | engines/xeen/resources.h | 8 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 8 |
6 files changed, 113 insertions, 5 deletions
diff --git a/engines/xeen/items.h b/engines/xeen/items.h index 154fd21888..943b1876c2 100644 --- a/engines/xeen/items.h +++ b/engines/xeen/items.h @@ -30,7 +30,9 @@ namespace Xeen { #define TOTAL_ITEMS 10 -enum BonusFlags { FLAG_CURSED = 0x40 }; +enum BonusFlags { + ITEMFLAG_BONUS_MASK = 0xBF, ITEMFLAG_CURSED = 0x40, ITEMFLAG_BROKEN = 0x80 +}; class XeenItem { public: diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 03535066e1..210852686a 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -855,6 +855,70 @@ int Character::getNumAwards() const { return total; } +/** + * Assembles a full lines description for a specified item for use in + * the Items dialog + */ +Common::String Character::assembleItemName(int itemIndex, int displayNum, int typeNum) { + Spells &spells = *Party::_vm->_spells; + + switch (typeNum) { + case 0: { + // Weapons + XeenItem &i = _weapons[itemIndex]; + return Common::String::format("\f%02u%s%s%s\f%02u%s%s%s", displayNum, + !i._bonusFlags ? spells._maeNames[i._material] : "", + (i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "", + (i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "", + WEAPON_NAMES[i._id], + !i._bonusFlags ? "" : BONUS_NAMES[i._bonusFlags & ITEMFLAG_BONUS_MASK], + (i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) || + !i._bonusFlags ? "\b " : "" + ); + } + + case 1: { + // Armor + XeenItem &i = _armor[itemIndex]; + return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum, + !i._bonusFlags ? "" : spells._maeNames[i._material], + (i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "", + (i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "", + ARMOR_NAMES[i._id], + (i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) || + !i._bonusFlags ? "\b " : "" + ); + } + + case 2: { + // Accessories + XeenItem &i = _accessories[itemIndex]; + return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum, + !i._bonusFlags ? "" : spells._maeNames[i._material], + (i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "", + (i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "", + ARMOR_NAMES[i._id], + (i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) || + !i._bonusFlags ? "\b " : "" + ); + } + + case 3: { + // Misc + XeenItem &i = _misc[itemIndex]; + return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum, + !i._bonusFlags ? "" : spells._maeNames[i._material], + (i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "", + (i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "", + ARMOR_NAMES[i._id], + (i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) || + !i._id ? "\b " : "" + ); + } + default: + return ""; + } +} /*------------------------------------------------------------------------*/ diff --git a/engines/xeen/party.h b/engines/xeen/party.h index 8285ddfecf..d719320766 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -182,6 +182,8 @@ public: int getNumSkills() const; int getNumAwards() const; + + Common::String assembleItemName(int itemIndex, int displayNum, int typeNum); }; class Roster: public Common::Array<Character> { diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index d89d2e6e25..89f6c8a5e5 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -1008,5 +1008,37 @@ const char *const BTN_ENCHANT = "E\fdnchant"; const char *const BTN_RECHARGE = "R\fdechrg"; const char *const BTN_GOLD = "G\fdold"; +const char *const ITEM_BROKEN = "\f32broken "; +const char *const ITEM_CURSED = "\f09cursed "; +const char *const BONUS_NAMES[7] = { + "", "Dragon Slayer", "Undead Eater", "Golem Smasher", + "Bug Zapper", "Monster Masher", "Beast Bopper" +}; +const char *const WEAPON_NAMES[35] = { + nullptr, "long sword ", "short sword ", "broad sword ", "scimitar ", + "cutlass ", "sabre ", "club ", "hand axe ", "katana ", "nunchakas ", + "wakazashi ", "dagger ", "mace ", "flail ", "cudgel ", "maul ", "spear ", + "bardiche ", "glaive ", "halberd ", "pike ", "flamberge ", "trident ", + "staff ", "hammer ", "naginata ", "battle axe ", "grand axe ", "great axe ", + "short bow ", "long bow ", "crossbow ", "sling ", "Xeen Slayer Sword" +}; + +const char *const ARMOR_NAMES[14] = { + nullptr, "Robes ", "Scale rmor ", "ring mail ", "chain mail ", + "splint mail ", "plate mail ", "plate armor ", "shield ", + "helm ", "boots ", "cloak ", "cape ", "gauntlets " +}; + +const char *const ACCESSORY_NAMES[11] = { + nullptr, "ring ", "belt ", "broach ", "medal ", "charm ", "cameo ", + "scarab ", "pendant ", "necklace ", "amulet " +}; + +const char *const MISC_NAMES[22] = { + nullptr, "rod ", "jewel ", "gem ", "box ", "orb ", "horn ", "coin ", + "wand ", "whistle ", "potion ", "scroll ", "RogueVM", + "bogus", "bogus", "bogus", "bogus", "bogus", + "bogus", "bogus", "bogus", "bogus" +}; } // End of namespace Xeen diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h index 5437d40641..4b08615520 100644 --- a/engines/xeen/resources.h +++ b/engines/xeen/resources.h @@ -346,6 +346,14 @@ extern const char *const BTN_ENCHANT; extern const char *const BTN_RECHARGE; extern const char *const BTN_GOLD; +extern const char *const ITEM_BROKEN; +extern const char *const ITEM_CURSED; +extern const char *const BONUS_NAMES[7]; +extern const char *const WEAPON_NAMES[35]; +extern const char *const ARMOR_NAMES[14]; +extern const char *const ACCESSORY_NAMES[11]; +extern const char *const MISC_NAMES[22]; + } // End of namespace Xeen #endif /* XEEN_RESOURCES_H */ diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index c5cf0b6a10..3df26859d4 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -863,10 +863,10 @@ Character *Town::doTempleOptions(Character *c) { case Common::KEYCODE_u: if (_uncurseCost && party.subtract(0, _uncurseCost, 0, WT_2)) { for (int idx = 0; idx < 9; ++idx) { - c->_weapons[idx]._bonusFlags &= ~FLAG_CURSED; - c->_armor[idx]._bonusFlags &= ~FLAG_CURSED; - c->_accessories[idx]._bonusFlags &= ~FLAG_CURSED; - c->_misc[idx]._bonusFlags &= ~FLAG_CURSED; + c->_weapons[idx]._bonusFlags &= ~ITEMFLAG_CURSED; + c->_armor[idx]._bonusFlags &= ~ITEMFLAG_CURSED; + c->_accessories[idx]._bonusFlags &= ~ITEMFLAG_CURSED; + c->_misc[idx]._bonusFlags &= ~ITEMFLAG_CURSED; } _v1 = 1440; |