aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/party.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-02 18:20:27 -0500
committerPaul Gilbert2015-02-02 18:20:27 -0500
commit2b8303c0d8b54ee5251296c86a320735422b62e2 (patch)
treed9c7a37f2500619779090f8b45eb09c906376701 /engines/xeen/party.cpp
parent7febe773008db7cee0ed1b3f5f1f2fb114d22334 (diff)
downloadscummvm-rg350-2b8303c0d8b54ee5251296c86a320735422b62e2.tar.gz
scummvm-rg350-2b8303c0d8b54ee5251296c86a320735422b62e2.tar.bz2
scummvm-rg350-2b8303c0d8b54ee5251296c86a320735422b62e2.zip
XEEN: Implemented assembleItemName method
Diffstat (limited to 'engines/xeen/party.cpp')
-rw-r--r--engines/xeen/party.cpp64
1 files changed, 64 insertions, 0 deletions
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 "";
+ }
+}
/*------------------------------------------------------------------------*/