diff options
author | Paul Gilbert | 2018-03-10 06:44:07 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-03-10 06:44:07 -0500 |
commit | aaf954e5d46e9f9664aec00d4bc6df94a582d1c2 (patch) | |
tree | 2ba2dc257d4e9460b654cad597b0e6692672d5ca /engines/xeen/character.h | |
parent | ed38407aa6118ab1b86b118efe5a91e65ba07a0a (diff) | |
download | scummvm-rg350-aaf954e5d46e9f9664aec00d4bc6df94a582d1c2.tar.gz scummvm-rg350-aaf954e5d46e9f9664aec00d4bc6df94a582d1c2.tar.bz2 scummvm-rg350-aaf954e5d46e9f9664aec00d4bc6df94a582d1c2.zip |
XEEN: Move item classes into their own file
Diffstat (limited to 'engines/xeen/character.h')
-rw-r--r-- | engines/xeen/character.h | 217 |
1 files changed, 1 insertions, 216 deletions
diff --git a/engines/xeen/character.h b/engines/xeen/character.h index 649da7ec12..05a61c3f2e 100644 --- a/engines/xeen/character.h +++ b/engines/xeen/character.h @@ -28,6 +28,7 @@ #include "common/rect.h" #include "common/serializer.h" #include "xeen/combat.h" +#include "xeen/item.h" #include "xeen/sprites.h" namespace Xeen { @@ -47,11 +48,6 @@ enum BonusFlags { ITEMFLAG_BONUS_MASK = 0xBF, ITEMFLAG_CURSED = 0x40, ITEMFLAG_BROKEN = 0x80 }; -enum ItemCategory { - CATEGORY_WEAPON = 0, CATEGORY_ARMOR = 1, CATEGORY_ACCESSORY = 2, CATEGORY_MISC = 3, - NUM_ITEM_CATEGORIES = 4 -}; - enum Sex { MALE = 0, FEMALE = 1, YES_PLEASE = 2 }; enum Race { HUMAN = 0, ELF = 1, DWARF = 2, GNOME = 3, HALF_ORC = 4 }; @@ -83,222 +79,11 @@ enum Condition { NO_CONDITION = 16 }; -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 -}; - enum QuickAction { QUICK_ATTACK = 0, QUICK_SPELL = 1, QUICK_BLOCK = 2, QUICK_RUN = 3 }; class XeenEngine; -class Character; - -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); - - 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: - 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: - 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: - 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: - 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(); -}; - class AttributePair { public: |