aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-25 20:04:53 -0400
committerPaul Gilbert2018-03-25 20:04:53 -0400
commitbd10b7d7c6f0ea3029f4bc5588b53585597f55b4 (patch)
tree78234f60548155efed420d8c9ee5314dc2938f10
parent04a9b3348be3bb51fd600e3aa6394e8e8f066a82 (diff)
downloadscummvm-rg350-bd10b7d7c6f0ea3029f4bc5588b53585597f55b4.tar.gz
scummvm-rg350-bd10b7d7c6f0ea3029f4bc5588b53585597f55b4.tar.bz2
scummvm-rg350-bd10b7d7c6f0ea3029f4bc5588b53585597f55b4.zip
XEEN: Fix capitalization of item descriptions in the inventory
-rw-r--r--engines/xeen/item.cpp23
-rw-r--r--engines/xeen/item.h5
2 files changed, 24 insertions, 4 deletions
diff --git a/engines/xeen/item.cpp b/engines/xeen/item.cpp
index 66607039a3..6c321ccd67 100644
--- a/engines/xeen/item.cpp
+++ b/engines/xeen/item.cpp
@@ -246,6 +246,13 @@ bool InventoryItems::isFull() const {
return operator[](size() - 1)._id != 0;
}
+void InventoryItems::capitalizeItem(Common::String &name) {
+ if (name[3] == '\f')
+ name.setChar(toupper(name[6]), 6);
+ else
+ name.setChar(toupper(name[3]), 3);
+}
+
/*------------------------------------------------------------------------*/
void WeaponItems::equipItem(int itemIndex) {
@@ -302,7 +309,7 @@ Common::String WeaponItems::getFullDescription(int itemIndex, int displayNum) {
XeenItem &i = operator[](itemIndex);
Resources &res = *getVm()->_resources;
- return Common::String::format("\f%02u%s%s%s\f%02u%s%s%s", displayNum,
+ Common::String desc = Common::String::format("\f%02u%s%s%s\f%02u%s%s%s", displayNum,
!i._bonusFlags ? res._maeNames[i._material].c_str() : "",
(i._bonusFlags & ITEMFLAG_BROKEN) ? Res.ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? Res.ITEM_CURSED : "",
@@ -312,6 +319,8 @@ Common::String WeaponItems::getFullDescription(int itemIndex, int displayNum) {
(i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) ||
!i._bonusFlags ? "\b " : ""
);
+ capitalizeItem(desc);
+ return desc;
}
void WeaponItems::enchantItem(int itemIndex, int amount) {
@@ -459,7 +468,7 @@ Common::String ArmorItems::getFullDescription(int itemIndex, int displayNum) {
XeenItem &i = operator[](itemIndex);
Resources &res = *getVm()->_resources;
- return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
+ Common::String desc = Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
!i._bonusFlags ? "" : res._maeNames[i._material].c_str(),
(i._bonusFlags & ITEMFLAG_BROKEN) ? Res.ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? Res.ITEM_CURSED : "",
@@ -468,6 +477,8 @@ Common::String ArmorItems::getFullDescription(int itemIndex, int displayNum) {
(i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) ||
!i._bonusFlags ? "\b " : ""
);
+ capitalizeItem(desc);
+ return desc;
}
void ArmorItems::enchantItem(int itemIndex, int amount) {
@@ -571,7 +582,7 @@ Common::String AccessoryItems::getFullDescription(int itemIndex, int displayNum)
XeenItem &i = operator[](itemIndex);
Resources &res = *getVm()->_resources;
- return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
+ Common::String desc = Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
!i._bonusFlags ? "" : res._maeNames[i._material].c_str(),
(i._bonusFlags & ITEMFLAG_BROKEN) ? Res.ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? Res.ITEM_CURSED : "",
@@ -580,6 +591,8 @@ Common::String AccessoryItems::getFullDescription(int itemIndex, int displayNum)
(i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) ||
!i._bonusFlags ? "\b " : ""
);
+ capitalizeItem(desc);
+ return desc;
}
/*
@@ -617,7 +630,7 @@ Common::String MiscItems::getFullDescription(int itemIndex, int displayNum) {
XeenItem &i = operator[](itemIndex);
Resources &res = *getVm()->_resources;
- return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
+ Common::String desc = Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
!i._bonusFlags ? "" : res._maeNames[i._material].c_str(),
(i._bonusFlags & ITEMFLAG_BROKEN) ? Res.ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? Res.ITEM_CURSED : "",
@@ -626,6 +639,8 @@ Common::String MiscItems::getFullDescription(int itemIndex, int displayNum) {
(i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) ||
!i._id ? "\b " : ""
);
+ capitalizeItem(desc);
+ return desc;
}
Common::String MiscItems::getAttributes(XeenItem &item, const Common::String &classes) {
diff --git a/engines/xeen/item.h b/engines/xeen/item.h
index b9c29af13d..a37e6597b0 100644
--- a/engines/xeen/item.h
+++ b/engines/xeen/item.h
@@ -111,6 +111,11 @@ protected:
* Returns a text string listing all the stats/attributes of a given item
*/
virtual Common::String getAttributes(XeenItem &item, const Common::String &classes) = 0;
+
+ /**
+ * Capitalizes a passed description string that includes embedded formatting for the Items dialog
+ */
+ void capitalizeItem(Common::String &name);
public:
InventoryItems(Character *character, ItemCategory category);
virtual ~InventoryItems() {}