aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-02 22:38:16 -0500
committerPaul Gilbert2015-02-02 22:38:16 -0500
commitf34c5ad9b65f626884736faf802d627dc2fe68c0 (patch)
tree4348519802a06ddb93204ae05dd50c6ad438dca0
parent38df23ace070902d5808e77a7260f5d62ef88108 (diff)
downloadscummvm-rg350-f34c5ad9b65f626884736faf802d627dc2fe68c0.tar.gz
scummvm-rg350-f34c5ad9b65f626884736faf802d627dc2fe68c0.tar.bz2
scummvm-rg350-f34c5ad9b65f626884736faf802d627dc2fe68c0.zip
XEEN: Finished Items dailog loading block for weapons
-rw-r--r--engines/xeen/dialogs_items.cpp34
-rw-r--r--engines/xeen/items.cpp4
-rw-r--r--engines/xeen/items.h2
-rw-r--r--engines/xeen/party.cpp6
-rw-r--r--engines/xeen/resources.cpp3
-rw-r--r--engines/xeen/resources.h2
6 files changed, 32 insertions, 19 deletions
diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp
index 511c27db5b..1043be8d9e 100644
--- a/engines/xeen/dialogs_items.cpp
+++ b/engines/xeen/dialogs_items.cpp
@@ -147,9 +147,14 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
));
}
- // TODO
+ DrawStruct &ds = _itemsDrawList[idx];
+ ds._sprites = &_equipSprites;
+ if (passRestrictions(c->_class, c->_weapons[idx]._id, true, CATEGORY_WEAPON))
+ ds._frame = c->_weapons[idx]._frame;
+ else
+ ds._frame = 14;
} else if (_itemsDrawList[idx]._sprites == nullptr) {
- // TODO
+ lines.push_back(NO_ITEMS_AVAILABLE);
}
break;
// TODO
@@ -260,26 +265,26 @@ void ItemsDialog::setEquipmentIcons() {
case 0: {
XeenItem &i = _itemsCharacter._weapons[idx];
if (i._id <= 17)
- i._equipped = 1;
+ i._frame = 1;
else if (i._id <= 29 || i._id > 33)
- i._equipped = 13;
+ i._frame = 13;
else
- i._equipped = 4;
+ i._frame = 4;
break;
}
case 1: {
XeenItem &i = _itemsCharacter._armor[idx];
if (i._id <= 7)
- i._equipped = 3;
+ i._frame = 3;
else if (i._id == 9)
- i._equipped = 5;
+ i._frame = 5;
else if (i._id == 10)
- i._equipped = 9;
+ i._frame = 9;
else if (i._id <= 12)
- i._equipped = 10;
+ i._frame = 10;
else
- i._equipped = 6;
+ i._frame = 6;
break;
}
@@ -288,11 +293,11 @@ void ItemsDialog::setEquipmentIcons() {
if (i._id == 1)
i._id = 8;
else if (i._id == 2)
- i._equipped = 12;
+ i._frame = 12;
else if (i._id <= 7)
- i._equipped = 7;
+ i._frame = 7;
else
- i._equipped = 11;
+ i._frame = 11;
break;
}
@@ -410,6 +415,9 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, int mode,
return (mode == ITEMMODE_CHAR_INFO) ? 0 : result;
}
+/**
+ * Return whether a given item passes class-based usage restrictions
+ */
bool ItemsDialog::passRestrictions(CharacterClass charClass, int itemId,
bool showError, ItemCategory category) const {
switch (charClass) {
diff --git a/engines/xeen/items.cpp b/engines/xeen/items.cpp
index fd06af1024..5881fb378b 100644
--- a/engines/xeen/items.cpp
+++ b/engines/xeen/items.cpp
@@ -27,14 +27,14 @@ namespace Xeen {
XeenItem::XeenItem() {
_material = _id = _bonusFlags = 0;
- _equipped = 0;
+ _frame = 0;
}
void XeenItem::synchronize(Common::Serializer &s) {
s.syncAsByte(_material);
s.syncAsByte(_id);
s.syncAsByte(_bonusFlags);
- s.syncAsByte(_equipped);
+ s.syncAsByte(_frame);
}
int XeenItem::getElementalCategory() const {
diff --git a/engines/xeen/items.h b/engines/xeen/items.h
index bfc76084c7..5a8c4d71a1 100644
--- a/engines/xeen/items.h
+++ b/engines/xeen/items.h
@@ -43,7 +43,7 @@ public:
int _material;
uint _id;
int _bonusFlags;
- int _equipped;
+ int _frame;
public:
XeenItem();
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 2590abcf13..0a276b29cd 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -452,7 +452,7 @@ int Character::itemScan(int itemId) const {
for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) {
const XeenItem &item = _weapons[idx];
- if (item._equipped && !(item._bonusFlags & 0xC0) && itemId < 11
+ if (item._frame && !(item._bonusFlags & 0xC0) && itemId < 11
&& itemId != 3 && item._material >= 59 && item._material <= 130) {
int mIndex = item.getAttributeCategory();
if (mIndex > 2)
@@ -468,7 +468,7 @@ int Character::itemScan(int itemId) const {
for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) {
const XeenItem &item = _armor[idx];
- if (item._equipped && !(item._bonusFlags & 0xC0)) {
+ if (item._frame && !(item._bonusFlags & 0xC0)) {
if (itemId < 11 && itemId != 3 && item._material >= 59 && item._material <= 130) {
int mIndex = item.getAttributeCategory();
if (mIndex > 2)
@@ -500,7 +500,7 @@ int Character::itemScan(int itemId) const {
for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) {
const XeenItem &item = _accessories[idx];
- if (item._equipped && !(item._bonusFlags & 0xC0) && itemId < 11 && itemId != 3) {
+ if (item._frame && !(item._bonusFlags & 0xC0) && itemId < 11 && itemId != 3) {
if (item._material >= 59 && item._material <= 130) {
int mIndex = item.getAttributeCategory();
if (mIndex > 2)
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 3935104e1d..8a23216e90 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -1085,4 +1085,7 @@ const int ITEM_RESTRICTIONS[86] = {
const char *const NOT_PROFICIENT =
"\t000\v007\x3""c%ss are not proficient with a %s!";
+const char *const NO_ITEMS_AVAILABLE = "\x3""c\n"
+ "\t000No items available.";
+
} // End of namespace Xeen
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index bcd4daeabf..c851db75a4 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -369,6 +369,8 @@ extern const int ITEM_RESTRICTIONS[86];
extern const char *const NOT_PROFICIENT;
+extern const char *const NO_ITEMS_AVAILABLE;
+
} // End of namespace Xeen
#endif /* XEEN_RESOURCES_H */