ScummVM API documentation
items.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MM1_DATA_ITEMS_H
23 #define MM1_DATA_ITEMS_H
24 
25 #include "common/array.h"
26 #include "common/stream.h"
27 #include "mm/mm1/data/text_parser.h"
28 
29 namespace MM {
30 namespace MM1 {
31 
32 enum ItemId {
33  GARLIC_ID = 175,
34  WOLFSBANE_ID = 176,
35  BELLADONNA_ID = 177,
36  VELLUM_SCROLL_ID = 231,
37  RUBY_WHISTLE_ID = 232,
38  KINGS_PASS_ID = 233,
39  MERCHANTS_PASS_ID = 234,
40  CRYSTAL_KEY_ID = 235,
41  CORAL_KEY_ID = 236,
42  BRONZE_KEY_ID = 237,
43  SILVER_KEY_ID = 238,
44  GOLD_KEY_ID = 239,
45  DIAMOND_KEY_ID = 240,
46  CACTUS_NECTAR_ID = 241,
47  MAP_OF_DESERT_ID = 242,
48  LASER_BLASTER_ID = 243,
49  DRAGONS_TOOTH_ID = 244,
50  WYVERN_EYE_ID = 245,
51  MEDUSA_HEAD_ID = 246,
52  RING_OF_OKRIM_ID = 247,
53  B_QUEEN_IDOL_ID = 248,
54  W_QUEEN_IDOL_ID = 249,
55  PIRATES_MAP_A_ID = 250,
56  PIRATES_MAP_B_ID = 251,
57  THUNDRANIUM_ID = 252,
58  KEY_CARD_ID = 253,
59  EYE_OF_GOROS_ID = 254,
60  USELESS_ITEM_ID = 255
61 };
62 
63 enum EnablementBit {
64  KNIGHT_BIT = 0x20, PALADIN_BIT = 0x10, ARCHER_BIT = 8,
65  CLERIC_BIT = 4, SORCERER_BIT = 2, ROBBER_BIT = 1,
66  GOOD_BIT = 0x80, EVIL_BIT = 0x40,
67  NEUTRAL_BIT = GOOD_BIT | EVIL_BIT
68 };
69 
70 enum ItemCategory {
71  ITEMCAT_NONE, ITEMCAT_WEAPON, ITEMCAT_MISSILE,
72  ITEMCAT_TWO_HANDED, ITEMCAT_ARMOR, ITEMCAT_SHIELD
73 };
74 
75 enum EquipMode {
76  NO_EQUIP_BONUS = 0, IS_EQUIPPABLE = 1,
77  EQUIP_CURSED = 0xff
78 };
79 
80 enum TransferKind {
81  TK_GEMS = 1, TK_GOLD = 2, TK_FOOD = 3, TK_ITEM = 4
82 };
83 
84 
85 struct ItemData {
86  byte _disablements = 0;
87  byte _constBonus_id = 0; // id equals to character characteristic id, except special "EquipMode" values
88  byte _constBonus_value = 0; // value to be added to character characteristic
89  byte _tempBonus_id = 0; // id equals to character characteristic id, except 0xff
90  byte _tempBonus_value = 0; // value to be added to character characteristic
91  byte _spellId = 0;
92  byte _maxCharges = 0; // for spells and tempBonus
93  uint16 _cost = 0;
94  byte _damage = 0;
95  byte _AC_Dmg = 0; //it is AC for armor and additional damage for weapon
96 };
97 
98 struct Item : public ItemData {
99  Common::String _name;
100 
104  uint getSellCost() const;
105 };
106 
107 struct ItemsArray : public Common::Array<Item>, public TextParser {
108  ItemsArray() {}
109 
113  bool load();
114 
118  Item *getItem(byte index) const;
119 };
120 
121 inline bool isWeapon(byte id) {
122  return id >= 1 && id <= 60;
123 }
124 inline bool isMissile(byte id) {
125  return id >= 61 && id <= 85;
126 }
127 inline bool isTwoHanded(byte id) {
128  return id >= 86 && id <= 120;
129 }
130 inline bool isArmor(byte id) {
131  return id >= 121 && id <= 155;
132 }
133 inline bool isShield(byte id) {
134  return id >= 156 && id <= 170;
135 }
136 
137 extern ItemCategory getItemCategory(byte itemId);
138 
139 } // namespace MM1
140 } // namespace MM
141 
142 #endif
Definition: str.h:59
Definition: array.h:52
Definition: text_parser.h:33
Definition: items.h:85
Definition: items.h:107
Definition: detection.h:27
Definition: items.h:98