ScummVM API documentation
item.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 ULTIMA4_GAME_ITEM_H
23 #define ULTIMA4_GAME_ITEM_H
24 
25 #include "ultima/ultima4/core/types.h"
26 #include "common/str.h"
27 
28 namespace Ultima {
29 namespace Ultima4 {
30 
31 class Coords;
32 class Map;
33 struct Portal;
34 
35 enum SearchCondition {
36  SC_NONE = 0x00,
37  SC_NEWMOONS = 0x01,
38  SC_FULLAVATAR = 0x02,
39  SC_REAGENTDELAY = 0x04
40 };
41 
42 class Items;
43 typedef bool (Items::*IsInInventoryProc)(int item);
44 typedef void (Items::*InventoryActionProc)(int item);
45 
46 struct ItemLocation {
47  const char *_name;
48  const char *_shortName;
49  const char *_locationLabel;
50  IsInInventoryProc _isItemInInventory;
51  InventoryActionProc _putItemInInventory;
52  InventoryActionProc _useItem;
53  int _data;
54  byte _conditions;
55 };
56 
57 typedef void (*DestroyAllCreaturesCallback)();
58 #define N_ITEMS 34
59 
60 class Items {
61 private:
62 
63  static const ItemLocation ITEMS[N_ITEMS];
64  DestroyAllCreaturesCallback destroyAllCreaturesCallback;
65  int needStoneNames;
66  byte stoneMask;
67 private:
68  bool isRuneInInventory(int virt);
69  void putRuneInInventory(int virt);
70  bool isStoneInInventory(int virt);
71  void putStoneInInventory(int virt);
72  bool isItemInInventory(int item);
73  bool isSkullInInventory(int item);
74  void putItemInInventory(int item);
75 
79  void useBBC(int item);
80 
84  void useHorn(int item);
85 
89  void useWheel(int item);
90 
94  void useSkull(int item);
95 
99  void useStone(int item);
100  void useKey(int item);
101  bool isMysticInInventory(int mystic);
102  void putMysticInInventory(int mystic);
103  bool isWeaponInInventory(int weapon);
104  void putWeaponInInventory(int weapon);
105  void useTelescope(int notused);
106  bool isReagentInInventory(int reag);
107  void putReagentInInventory(int reag);
108 
112  void itemHandleStones(const Common::String &color);
113 
117  bool itemConditionsMet(byte conditions);
118 public:
119  Items();
120  ~Items();
121 
122  void setDestroyAllCreaturesCallback(DestroyAllCreaturesCallback callback);
123 
128  const ItemLocation *itemAtLocation(const Map *map, const Coords &coords);
129 
133  void itemUse(const Common::String &shortName);
134 
138  static bool isAbyssOpened(const Portal *p);
139 };
140 
141 extern Items *g_items;
142 
143 } // End of namespace Ultima4
144 } // End of namespace Ultima
145 
146 #endif
Definition: portal.h:53
Definition: str.h:59
Definition: map.h:134
Definition: coords.h:31
Definition: detection.h:27
Definition: item.h:60
Definition: item.h:46