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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef BLADERUNNER_ITEM_H
24 #define BLADERUNNER_ITEM_H
25 
26 #include "bladerunner/boundingbox.h"
27 #include "bladerunner/vector.h"
28 
29 #include "common/rect.h"
30 
31 namespace BladeRunner {
32 
33 class BladeRunnerEngine;
34 class Items;
35 class SaveFileReadStream;
36 class SaveFileWriteStream;
37 
38 class Item {
39 	friend class Items;
40 
41 	BladeRunnerEngine *_vm;
42 
43 	int          _itemId;
44 	int          _setId;
45 
46 	BoundingBox  _boundingBox;
47 	Common::Rect _screenRectangle;
48 	int          _animationId;
49 	Vector3      _position;
50 	int          _facing;
51 	float        _angle;
52 	int          _width;
53 	int          _height;
54 	int          _screenX;
55 	int          _screenY;
56 	float        _depth;
57 	bool         _isTarget;
58 	bool         _isSpinning;
59 	int          _facingChange;
60 	bool         _isVisible;
61 	bool         _isPoliceMazeEnemy;
62 
63 public:
64 	Item(BladeRunnerEngine *vm);
65 
66 	void getXYZ(float *x, float *y, float *z) const;
67 	void setXYZ(Vector3 position);
68 	void getWidthHeight(int *width, int *height) const;
69 	void getAnimationId(int *animationId) const;
70 
getBoundingBox()71 	const BoundingBox &getBoundingBox() { return _boundingBox; }
getScreenRectangle()72 	const Common::Rect &getScreenRectangle() { return _screenRectangle; }
73 
getFacing()74 	int getFacing() const { return _facing; }
75 	void setFacing(int facing);
76 
isTarget()77 	bool isTarget() const { return _isTarget; }
setIsTarget(bool val)78 	void setIsTarget(bool val) { _isTarget = val; }
79 
isSpinning()80 	bool isSpinning() const { return _isSpinning; }
81 	void spinInWorld();
82 
isVisible()83 	bool isVisible() const { return _isVisible; }
setVisible(bool val)84 	void setVisible(bool val) { _isVisible = val; }
85 
isPoliceMazeEnemy()86 	bool isPoliceMazeEnemy() const { return _isPoliceMazeEnemy; }
setPoliceMazeEnemy(bool val)87 	void setPoliceMazeEnemy(bool val) { _isPoliceMazeEnemy = val; }
88 
89 	bool tick(Common::Rect *screenRect, bool special);
90 
91 	void setup(int itemId, int setId, int animationId, Vector3 position, int facing, int height, int width, bool isTargetFlag, bool isVisibleFlag, bool isPoliceMazeEnemyFlag);
92 
93 	bool isUnderMouse(int mouseX, int mouseY) const;
94 
95 	void save(SaveFileWriteStream &f);
96 	void load(SaveFileReadStream &f);
97 };
98 
99 }
100 
101 #endif
102