1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
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 HOTSPOT_H_
24 #define HOTSPOT_H_
25 
26 #include "common/rect.h"
27 #include "common/array.h"
28 
29 namespace Myst3 {
30 
31 class GameState;
32 
33 struct Opcode {
34 	uint8 op;
35 	Common::Array<int16> args;
36 };
37 
38 struct CondScript {
39 	uint16 condition;
40 	Common::Array<Opcode> script;
41 };
42 
43 struct PolarRect {
44 	int16 centerPitch;
45 	int16 centerHeading;
46 	int16 height;
47 	int16 width;
48 };
49 
50 class HotSpot {
51 public:
52 	HotSpot();
53 
54 	int16 condition;
55 	Common::Array<PolarRect> rects;
56 	int16 cursor;
57 	Common::Array<Opcode> script;
58 
59 	int32 isPointInRectsCube(float pitch, float heading);
60 	int32 isPointInRectsFrame(GameState *state, const Common::Point &p);
61 	bool isEnabled(GameState *state, uint16 var = 0);
62 
63 private:
isZip()64 	bool isZip() { return cursor == 7; }
65 	int32 isZipDestinationAvailable(GameState *state);
66 };
67 
68 
69 } // End of namespace Myst3
70 
71 #endif // HOTSPOT_H_
72