ScummVM API documentation
inventory.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 SHERLOCK_INVENTORY_H
23 #define SHERLOCK_INVENTORY_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/str-array.h"
28 #include "sherlock/objects.h"
29 #include "sherlock/resources.h"
30 #include "sherlock/saveload.h"
31 
32 namespace Sherlock {
33 
34 enum InvMode {
35  INVMODE_EXIT = 0,
36  INVMODE_LOOK = 1,
37  INVMODE_USE = 2,
38  INVMODE_GIVE = 3,
39  INVMODE_FIRST = 4,
40  INVMODE_PREVIOUS = 5,
41  INVMODE_NEXT = 6,
42  INVMODE_LAST = 7,
43  INVMODE_INVALID = 8,
44  INVMODE_USE55 = 255
45 };
46 
47 enum InvNewMode {
48  PLAIN_INVENTORY = 0, LOOK_INVENTORY_MODE = 1, USE_INVENTORY_MODE = 2,
49  GIVE_INVENTORY_MODE = 3, INVENTORY_DONT_DISPLAY = 128
50 };
51 
52 enum InvSlamMode { SLAM_DONT_DISPLAY, SLAM_DISPLAY = 1, SLAM_SECONDARY_BUFFER };
53 
54 
55 struct InventoryItem {
56  int _requiredFlag;
57  Common::String _name;
58  Common::String _description;
59  Common::String _examine;
60  int _lookFlag;
61 
62  // Rose Tattoo fields
63  int _requiredFlag1;
64  UseType _verb;
65 
66  InventoryItem() : _requiredFlag(0), _lookFlag(0), _requiredFlag1(0) {}
67  InventoryItem(int requiredFlag, const Common::String &name,
68  const Common::String &description, const Common::String &examine);
69  InventoryItem(int requiredFlag, const Common::String &name,
70  const Common::String &description, const Common::String &examine, const Common::String &verbName);
71 
75  void synchronize(Serializer &s);
76 };
77 
78 class Inventory : public Common::Array<InventoryItem> {
79 protected:
80  SherlockEngine *_vm;
81  Common::StringArray _names;
82 
86  void copyToInventory(Object &obj);
87 public:
88  Common::Array<ImageFile *> _invShapes;
89  bool _invGraphicsLoaded;
90  InvMode _invMode;
91  int _invIndex;
92  int _holdings; // Used to hold number of visible items in active inventory.
93  // Since Inventory array also contains some special hidden items
97  void freeGraphics();
98 public:
99  static Inventory *init(SherlockEngine *vm);
101  virtual ~Inventory();
102 
106  void freeInv();
107 
111  void loadGraphics();
112 
117  int findInv(const Common::String &name);
118 
122  int putNameInInventory(const Common::String &name);
123 
128  int putItemInInventory(Object &obj);
129 
133  int deleteItemFromInventory(const Common::String &name);
134 
138  void synchronize(Serializer &s);
139 
144  virtual void loadInv() = 0;
145 };
146 
147 } // End of namespace Sherlock
148 
149 #endif
Definition: inventory.h:55
Definition: str.h:59
Definition: array.h:52
Definition: inventory.h:78
Definition: animation.h:29
Definition: serializer.h:79
Definition: sherlock.h:76
Definition: objects.h:363
void synchronize(Serializer &s)
Definition: objects.h:168