2009-09-03 20:59:17 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
|
2009-09-04 20:06:19 +00:00
|
|
|
#ifndef TEENAGENT_INVENTORY_H
|
|
|
|
#define TEENAGENT_INVENTORY_H
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2009-09-04 20:08:33 +00:00
|
|
|
#include "teenagent/surface.h"
|
|
|
|
#include "teenagent/animation.h"
|
2009-09-03 20:59:17 +00:00
|
|
|
#include "common/events.h"
|
2009-09-26 15:04:09 +00:00
|
|
|
#include "common/array.h"
|
2009-09-04 20:08:33 +00:00
|
|
|
#include "teenagent/objects.h"
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
namespace TeenAgent {
|
|
|
|
|
|
|
|
struct InventoryObject;
|
|
|
|
class TeenAgentEngine;
|
|
|
|
|
|
|
|
class Inventory {
|
|
|
|
public:
|
2011-01-31 07:44:40 +00:00
|
|
|
Inventory(TeenAgentEngine *engine);
|
|
|
|
~Inventory();
|
|
|
|
|
2010-01-08 10:35:25 +00:00
|
|
|
void render(Graphics::Surface *surface, int delta);
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
void clear();
|
2010-03-21 07:49:53 +00:00
|
|
|
void reload();
|
2009-09-03 20:59:17 +00:00
|
|
|
void add(byte item);
|
|
|
|
bool has(byte item) const;
|
|
|
|
void remove(byte item);
|
|
|
|
|
|
|
|
void activate(bool a) { _active = a; }
|
|
|
|
bool active() const { return _active; }
|
2009-09-15 08:54:06 +00:00
|
|
|
|
2009-09-03 20:59:17 +00:00
|
|
|
bool processEvent(const Common::Event &event);
|
|
|
|
|
2011-05-21 18:01:06 +00:00
|
|
|
InventoryObject *selectedObject() { return _selectedObj; }
|
|
|
|
void resetSelectedObject() { _selectedObj = NULL; }
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
TeenAgentEngine *_engine;
|
2011-05-21 18:01:06 +00:00
|
|
|
Surface _background;
|
|
|
|
byte *_items;
|
|
|
|
uint _offset[93];
|
|
|
|
|
|
|
|
Common::Array<InventoryObject> _objects;
|
|
|
|
byte *_inventory;
|
2009-09-15 08:54:06 +00:00
|
|
|
|
2009-09-03 20:59:17 +00:00
|
|
|
struct Item {
|
2011-05-21 18:01:06 +00:00
|
|
|
Animation _animation;
|
|
|
|
Surface _surface;
|
|
|
|
Rect _rect;
|
|
|
|
bool _hovered;
|
2009-09-15 08:54:06 +00:00
|
|
|
|
2011-05-21 18:01:06 +00:00
|
|
|
Item() : _hovered(false) {}
|
2009-09-03 20:59:17 +00:00
|
|
|
void free();
|
2010-03-21 07:49:53 +00:00
|
|
|
void load(Inventory *inventory, uint item_id);
|
2010-02-07 18:05:55 +00:00
|
|
|
void backgroundEffect(Graphics::Surface *s);
|
2010-03-21 07:49:53 +00:00
|
|
|
void render(Inventory *inventory, uint item_id, Graphics::Surface *surface, int delta);
|
2011-05-21 18:01:06 +00:00
|
|
|
};
|
2011-06-19 22:59:48 +00:00
|
|
|
|
2011-05-21 18:01:06 +00:00
|
|
|
Item _graphics[24];
|
2009-09-15 08:54:06 +00:00
|
|
|
|
2009-09-03 20:59:17 +00:00
|
|
|
bool _active;
|
2011-05-21 18:01:06 +00:00
|
|
|
Common::Point _mouse;
|
2011-06-19 22:59:48 +00:00
|
|
|
|
2010-02-07 17:15:04 +00:00
|
|
|
bool tryObjectCallback(InventoryObject *obj);
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2011-05-21 18:01:06 +00:00
|
|
|
InventoryObject *_hoveredObj;
|
|
|
|
InventoryObject *_selectedObj;
|
2009-09-03 20:59:17 +00:00
|
|
|
};
|
|
|
|
|
2009-09-04 20:08:33 +00:00
|
|
|
} // End of namespace TeenAgent
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2009-09-04 20:08:33 +00:00
|
|
|
#endif
|