aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent/inventory.h
blob: 4a250987bae7b81343c3fdab7ac043410c3fcc2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef TEENAGENT_INVENTORY_H
#define TEENAGENT_INVENTORY_H

#include "teenagent/surface.h"
#include "teenagent/animation.h"
#include "common/events.h"
#include "common/array.h"
#include "teenagent/objects.h"

namespace TeenAgent {

struct InventoryObject;
class TeenAgentEngine;

// Maximum number of items found within game
const uint8 kNumInventoryItems = 92;

// Inventory Item Ids
enum {
	kInvItemNoItem = 0, // No item i.e. empty inventory slot
	kInvItemFeather = 1,
	kInvItemShotgun = 2,
	kInvItemToolboxFull = 3, // Contains Car Jack and Spanner
	kInvItemToolboxHalfEmpty = 4, // Contains Spanner
	kInvItemSpanner = 5,
	kInvItemComb = 6,
	kInvItemFan = 7,
	kInvItemBrokenPaddle = 8,
	kInvItemPaddle = 9, // Repaired - BrokenPaddle combined with Branch (with Glue)
	kInvItemFirstFlower = 10, // Smells nice
	kInvItemSecondFlower = 11, // Really beautiful
	kInvItemFeatherDusterClean = 12,
	kInvItemChainsaw = 13, // Unfueled
	kInvItemDrunkenChainsaw = 14, // Fueled with Whisky (Chainsaw combined with Whiskey)
	kInvItemBranch = 15,
	kInvItemWhisky = 16,
	kInvItemNeedle = 17,
	kInvItemWrapper = 18,
	kInvItemChocCandy = 19,
	kInvItemPotato = 20,
	kInvItemRakeBroken = 21,
	kInvItemHeartShapedCandy = 22,
	kInvItemWrappedCandy = 23, // HeartShapedCandy combined with Wrapper
	kInvItemRibbon = 24,
	kInvItemRakeFixed = 25, // Rake combined with Ribbon
	kInvItemNut = 26,
	kInvItemPlasticApple = 27,
	kInvItemCone = 28,
	kInvItemSuperGlue = 29,
	kInvItemConeAndNeedle = 30, // Cone combined with Needle
	kInvItemConeAndFeather = 31, // Cone combined with Feather
	kInvItemDart = 32, // Needle combined with ConeAndFeather or Feather combined with ConeAndNeedle
	kInvItemFeatherDusterDirty = 33,
	kInvItemPaintedPotato = 34, // Potato combined with Dirty Feather Duster (Soot)
	kInvItemCarJack = 35,
	kInvItemBone = 36,
	kInvItemShovelAct2 = 37,
	kInvItemRopeAct2 = 38,
	kInvItemMask = 39,
	kInvItemFins = 40,
	kInvItemDiveEquipment = 41, // Mask combined with Fins
	kInvItemAnchor = 42,
	kInvItemGrapplingHook = 43,
	kInvItemSickleBlunt = 44,
	kInvItemCheese = 45,
	kInvItemSickleSharp = 46,
	kInvItemHandkerchief = 47,
	kInvItemMouse = 48,
	kInvItemRock = 49,
	kInvItemNugget = 50,
	kInvItemBanknote = 51,
	kInvItemDictaphoneNoBatteries = 52,
	kInvItemPolaroidCamera = 53,
	kInvItemVideoTape = 54,
	kInvItemSheetOfPaper = 55,
	kInvItemCognac = 56,
	kInvItemRemoteControl = 57,
	kInvItemIceTongs = 58,
	kInvItemCork = 59,
	kInvItemWrappedCork = 60, // Cork combined with Sheet Of Paper
	kInvItemPhoto = 61,
	kInvItemChilliWithLabel = 62,
	kInvItemPastryRoller = 63,
	kInvItemFakeChilli = 64,
	kInvItemLabel = 65,
	kInvItemBatteries = 66,
	kInvItemDictaphoneWithBatteries = 67, // Dictaphone combined with Batteries
	kInvItemBurningPaper = 68,
	kInvItemMeat = 69,
	kInvItemPlasticBag = 70,
	kInvItemSocks = 71,
	kInvItemTimePills = 72,
	kInvItemHandle = 73,
	kInvItemChilliNoLabel = 74,
	kInvItemPass = 75,
	kInvItemBulb = 76,
	kInvItemJailKey = 77,
	kInvItemDelicatePlant = 78,
	kInvItemSwissArmyKnife = 79,
	kInvItemSpring = 80,
	kInvItemShovelAct1 = 81,
	kInvItemKaleidoscope = 82,
	kInvItemSoldierNews = 83,
	kInvItemGrenade = 84,
	kInvItemMug = 85, // Empty
	kInvItemMugOfMud = 86, // Full of mud
	kInvItemCrumbs = 87,
	kInvItemRopeAct1 = 88,
	kInvItemRopeAndGrenade = 89, // Rope combined with Grenade
	kInvItemMedicine = 90,
	kInvItemDruggedFood = 91, // Crumbs combined with Medicine
	kInvItemBird = 92
};

// Maximum number of inventory items held by Ego (Mark)
const uint8 kInventorySize = 24;

class Inventory {
public:
	Inventory(TeenAgentEngine *vm);
	~Inventory();

	void render(Graphics::Surface *surface, int delta);

	void clear();
	void reload();
	void add(byte item);
	bool has(byte item) const;
	void remove(byte item);

	void activate(bool a) { _active = a; }
	bool active() const { return _active; }

	bool processEvent(const Common::Event &event);

	InventoryObject *selectedObject() { return _selectedObj; }
	void resetSelectedObject() { _selectedObj = NULL; }

private:
	TeenAgentEngine *_vm;
	Surface _background;
	byte *_items;
	uint _offset[kNumInventoryItems+1];

	Common::Array<InventoryObject> _objects;
	byte *_inventory;

	struct Item {
		Animation _animation;
		Surface _surface;
		Rect _rect;
		bool _hovered;

		Item() : _hovered(false) {}
		void free();
		void load(Inventory *inventory, uint itemId);
		void backgroundEffect(Graphics::Surface *s);
		void render(Inventory *inventory, uint itemId, Graphics::Surface *surface, int delta);
	};

	Item _graphics[kInventorySize];

	bool _active;
	Common::Point _mouse;

	bool tryObjectCallback(InventoryObject *obj);

	InventoryObject *_hoveredObj;
	InventoryObject *_selectedObj;
};

} // End of namespace TeenAgent

#endif