From 16bae6f314f36e5d61a7148e5f754e99698f3e82 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 Feb 2018 20:12:24 -0500 Subject: XEEN: Fix getting items from combat and displaying them in Items dialog --- engines/xeen/combat.cpp | 1 + engines/xeen/dialogs_items.cpp | 13 ++++--------- engines/xeen/party.cpp | 3 ++- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index ddda2402da..2f512f6fd8 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -1511,6 +1511,7 @@ void Combat::attack2(int damage, RangeType rangeType) { party._treasure._gems = monsterData._gems; if (!isDarkCc && monster._spriteId == 89) { + // Xeen's Scepter of Temporal Distortion party._treasure._weapons[0]._id = 90; party._treasure._weapons[0]._bonusFlags = 0; party._treasure._weapons[0]._material = 0; diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp index bf0e40ed91..865ec23a14 100644 --- a/engines/xeen/dialogs_items.cpp +++ b/engines/xeen/dialogs_items.cpp @@ -136,6 +136,8 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) { for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) { DrawStruct &ds = _itemsDrawList[idx]; + XeenItem &i = c->_items[category][idx]; + ds._sprites = nullptr; ds._x = 8; ds._y = 18 + idx * 9; @@ -143,10 +145,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) { switch (category) { case CATEGORY_WEAPON: case CATEGORY_ARMOR: - case CATEGORY_ACCESSORY: { - XeenItem &i = (category == CATEGORY_WEAPON) ? c->_weapons[idx] : - ((category == CATEGORY_ARMOR) ? c->_armor[idx] : c->_accessories[idx]); - + case CATEGORY_ACCESSORY: if (i._id) { if (mode == ITEMMODE_CHAR_INFO || mode == ITEMMODE_8 || mode == ITEMMODE_ENCHANT || mode == ITEMMODE_RECHARGE) { @@ -172,11 +171,8 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) { lines.push_back(Res.NO_ITEMS_AVAILABLE); } break; - } - - case CATEGORY_MISC: { - XeenItem &i = c->_misc[idx]; + case CATEGORY_MISC: if (i._material == 0) { // No item if (idx == 0) { @@ -200,7 +196,6 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) { )); } break; - } default: break; diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index d45c7fa257..b24030d380 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -720,9 +720,10 @@ void Party::giveTreasureToCharacter(Character &c, ItemCategory category, int ite w.update(); events.ipause(5); - const char *itemName = XeenItem::getItemName(category, treasureItem._id); + const char *itemName = XeenItem::getItemName(category, treasureItem._id); w.writeString(Common::String::format(Res.X_FOUND_Y, c._name.c_str(), itemName)); w.update(); + c._items[category].sort(); events.ipause(5); } -- cgit v1.2.3