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
32namespace Access {
33
34enum ItemState {
35 ITEM_NOT_FOUND = 0, ITEM_IN_INVENTORY = 1, ITEM_USED = 2
36};
37
39public:
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) const;
51};
52
53class 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 };
74private:
76 ASurface _savedBuffer1;
77 ASurface _savedScreen;
78 SavedFields _fields;
79 bool _iconDisplayFlag;
80 Common::Array<int> _tempLPtr;
81 Common::StringArray _tempLOff;
82 int _boxNum;
83
84 int coordIndexOf() const;
85
86 void outlineIcon(int itemIndex);
87
88 void combineItems();
89
90 void zoomIcon(int zoomItem, int backItem, int zoomBox, bool shrink);
91
92 void putInvIcon(int itemIndex, int itemId);
93
94protected:
95 void initFields();
96 void getList();
97 void saveScreens();
98 void savedFields();
99 void showAllItems();
100 void restoreFields();
101 void chooseItem();
102 void freeInvCells();
103 void restoreScreens();
104
105 Common::Array<int> _items;
106
107public:
109 int _startInvItem;
110 int _startInvBox;
111 bool _invChangeFlag;
112 bool _invRefreshFlag;
113 bool _invModeFlag;
114
115public:
117
118 virtual ~InventoryManager() {};
119
120 int &operator[](int idx);
121
122 int useItem() const;
123 void setUseItem(int itemId);
124
125 void refreshInventory();
126
127 virtual int displayInv() = 0;
128
133};
134
135} // End of namespace Access
136
137#endif /* ACCESS_INVENTORY_H */
Definition: asurface.h:129
Definition: access.h:141
Definition: inventory.h:38
Definition: inventory.h:53
void synchronize(Common::Serializer &s)
Definition: data.h:37
Definition: serializer.h:80
Definition: str.h:59
Definition: access.h:62
Definition: rect.h:144