aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/item.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/xeen/item.h')
-rw-r--r--engines/xeen/item.h270
1 files changed, 270 insertions, 0 deletions
diff --git a/engines/xeen/item.h b/engines/xeen/item.h
new file mode 100644
index 0000000000..2b6058c2fd
--- /dev/null
+++ b/engines/xeen/item.h
@@ -0,0 +1,270 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XEEN_ITEM_H
+#define XEEN_ITEM_H
+
+#include "common/scummsys.h"
+#include "common/array.h"
+#include "common/rect.h"
+#include "common/serializer.h"
+#include "xeen/combat.h"
+#include "xeen/sprites.h"
+
+namespace Xeen {
+
+#define INV_ITEMS_TOTAL 9
+
+class XeenEngine;
+
+enum ItemCategory {
+ CATEGORY_WEAPON = 0, CATEGORY_ARMOR = 1, CATEGORY_ACCESSORY = 2, CATEGORY_MISC = 3,
+ NUM_ITEM_CATEGORIES = 4
+};
+
+enum AttributeCategory {
+ ATTR_MIGHT = 0, ATTR_INTELLECT = 1, ATTR_PERSONALITY = 2, ATTR_SPEED = 3,
+ ATTR_ACCURACY = 4, ATTR_LUCK = 5, ATTR_HIT_POINTS = 6, ATTR_SPELL_POINTS = 7,
+ ATTR_ARMOR_CLASS = 8, ATTR_THIEVERY = 9
+};
+
+class XeenItem {
+public:
+ int _material;
+ uint _id;
+ int _bonusFlags;
+ int _frame;
+public:
+ /**
+ * Return the name of the item
+ */
+ static const char *getItemName(ItemCategory category, uint id);
+public:
+ XeenItem();
+
+ /**
+ * Clear the data for the item
+ */
+ void clear();
+
+ /**
+ * Returns true if no item is set
+ */
+ bool empty() const { return _id != 0; }
+
+ /**
+ * Synchronizes the data for the item
+ */
+ void synchronize(Common::Serializer &s);
+
+ /**
+ * Gets the elemental category for the item
+ */
+ ElementalCategory getElementalCategory() const;
+
+ /**
+ * Gets the attribute category for the item
+ */
+ AttributeCategory getAttributeCategory() const;
+};
+
+class InventoryItems : public Common::Array<XeenItem> {
+protected:
+ Character *_character;
+ ItemCategory _category;
+ const char **_names;
+
+ XeenEngine *getVm();
+ void equipError(int itemIndex1, ItemCategory category1, int itemIndex2,
+ ItemCategory category2);
+
+ /**
+ ** Returns a text string listing all the stats/attributes of a given item
+ */
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes) = 0;
+public:
+ InventoryItems(Character *character, ItemCategory category);
+ virtual ~InventoryItems() {}
+
+ /**
+ * Clears the set of items
+ */
+ void clear();
+
+ /**
+ * Return whether a given item passes class-based usage restrictions
+ */
+ bool passRestrictions(int itemId, bool showError) const;
+
+ /**
+ * Return the bare name of a given inventory item
+ */
+ Common::String getName(int itemIndex);
+
+ virtual Common::String getFullDescription(int itemIndex, int displayNum = 15) = 0;
+
+ /**
+ * Returns the identified details for an item
+ */
+ Common::String getIdentifiedDetails(int itemIndex);
+
+ /**
+ * Discard an item from the inventory
+ */
+ bool discardItem(int itemIndex);
+
+ /**
+ * Equips an item
+ */
+ virtual void equipItem(int itemIndex) {}
+
+ /**
+ * Un-equips the given item
+ */
+ void removeItem(int itemIndex);
+
+ /**
+ * Sorts the items list, removing any empty item slots to the end of the array
+ */
+ void sort();
+
+ /**
+ * Enchants an item
+ */
+ virtual void enchantItem(int itemIndex, int amount);
+
+ /**
+ * Return if the given inventory items list is full
+ */
+ bool isFull() const;
+};
+
+class WeaponItems: public InventoryItems {
+protected:
+ /**
+ ** Returns a text string listing all the stats/attributes of a given item
+ */
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
+public:
+ WeaponItems(Character *character) : InventoryItems(character, CATEGORY_WEAPON) {}
+ virtual ~WeaponItems() {}
+
+ /**
+ * Equip a given weapon
+ */
+ virtual void equipItem(int itemIndex);
+
+ /**
+ * Assembles a full lines description for a specified item for use in
+ * the Items dialog
+ */
+ virtual Common::String getFullDescription(int itemIndex, int displayNum);
+
+ /**
+ * Enchants a weapon
+ */
+ virtual void enchantItem(int itemIndex, int amount);
+};
+
+class ArmorItems : public InventoryItems {
+protected:
+ /**
+ ** Returns a text string listing all the stats/attributes of a given item
+ */
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
+public:
+ ArmorItems(Character *character) : InventoryItems(character, CATEGORY_ARMOR) {}
+ virtual ~ArmorItems() {}
+
+ /**
+ * Equip a given piece of armor
+ */
+ virtual void equipItem(int itemIndex);
+
+ /**
+ * Assembles a full lines description for a specified item for use in
+ * the Items dialog
+ */
+ virtual Common::String getFullDescription(int itemIndex, int displayNum);
+
+ /**
+ * Enchants an armor
+ */
+ virtual void enchantItem(int itemIndex, int amount);
+};
+
+class AccessoryItems : public InventoryItems {
+protected:
+ /**
+ ** Returns a text string listing all the stats/attributes of a given item
+ */
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
+public:
+ AccessoryItems(Character *character) : InventoryItems(character, CATEGORY_ACCESSORY) {}
+
+ /**
+ * Equip a given accessory
+ */
+ virtual void equipItem(int itemIndex);
+
+ /**
+ * Assembles a full lines description for a specified item for use in
+ * the Items dialog
+ */
+ virtual Common::String getFullDescription(int itemIndex, int displayNum);
+};
+
+class MiscItems : public InventoryItems {
+protected:
+ /**
+ ** Returns a text string listing all the stats/attributes of a given item
+ */
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
+public:
+ MiscItems(Character *character) : InventoryItems(character, CATEGORY_MISC) {}
+ virtual ~MiscItems() {}
+
+ /**
+ * Assembles a full lines description for a specified item for use in
+ * the Items dialog
+ */
+ virtual Common::String getFullDescription(int itemIndex, int displayNum);
+};
+
+class InventoryItemsGroup {
+private:
+ InventoryItems *_itemSets[4];
+public:
+ InventoryItemsGroup(InventoryItems &weapons, InventoryItems &armor,
+ InventoryItems &accessories, InventoryItems &misc);
+
+ InventoryItems &operator[](ItemCategory category);
+
+ /**
+ * Breaks all the items in a given character's inventory
+ */
+ void breakAllItems();
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_CHARACTER_H */