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 ACCESS_INVENTORY_H
23 #define ACCESS_INVENTORY_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "common/str-array.h"
29 #include "access/data.h"
30 #include "access/asurface.h"
31 
32 namespace Access {
33 
34 enum ItemState {
35  ITEM_NOT_FOUND = 0, ITEM_IN_INVENTORY = 1, ITEM_USED = 2
36 };
37 
39 public:
40  Common::String _name;
41  int _value;
42 
43  int _otherItem1;
44  int _newItem1;
45  int _otherItem2;
46  int _newItem2;
47 
48  void load(const Common::String &name, const int *data);
49 
50  int checkItem(int itemId);
51 };
52 
53 class InventoryManager : public Manager {
54  struct SavedFields {
55  int _vWindowHeight;
56  int _vWindowLinesTall;
57  int _vWindowWidth;
58  int _vWindowBytesWide;
59  int _playFieldHeight;
60  int _playFieldWidth;
61  int _windowXAdd;
62  int _windowYAdd;
63  int _screenYOff;
64  int _scrollX;
65  int _scrollY;
66  int _clipWidth;
67  int _clipHeight;
68  Common::Point _bufferStart;
69  int _scrollCol;
70  int _scrollRow;
71 
72  SavedFields();
73  };
74 private:
75  Common::Array<int> _items;
76  Common::Array<Common::Rect> _invCoords;
77  ASurface _savedBuffer1;
78  ASurface _savedScreen;
79  SavedFields _fields;
80  bool _iconDisplayFlag;
81  Common::Array<int> _tempLPtr;
82  Common::StringArray _tempLOff;
83  int _boxNum;
84 
85  void savedFields();
86 
87  void restoreFields();
88 
89  void initFields();
90 
91  void getList();
92 
93  void showAllItems();
94 
95  void putInvIcon(int itemIndex, int itemId);
96 
97  void chooseItem();
98 
99  void freeInvCells();
100 
101  int coordIndexOf();
102 
103  void saveScreens();
104 
105  void restoreScreens();
106 
107  void outlineIcon(int itemIndex);
108 
109  void combineItems();
110 
111  void zoomIcon(int zoomItem, int backItem, int zoomBox, bool shrink);
112 public:
114  int _startInvItem;
115  int _startInvBox;
116  bool _invChangeFlag;
117  bool _invRefreshFlag;
118  bool _invModeFlag;
119  int _startAboutItem;
120  int _startTravelItem;
121 public:
123 
124  int &operator[](int idx);
125 
126  int useItem();
127  void setUseItem(int itemId);
128 
129  void refreshInventory();
130 
131  int newDisplayInv();
132  int displayInv();
133 
137  void synchronize(Common::Serializer &s);
138 };
139 
140 } // End of namespace Access
141 
142 #endif /* ACCESS_INVENTORY_H */
Definition: str.h:59
Definition: inventory.h:53
Definition: data.h:37
Definition: access.h:84
Definition: inventory.h:38
Definition: serializer.h:79
Definition: rect.h:45
Definition: asurface.h:121
Definition: access.h:62