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 CRYOMNI3D_WAM_PARSER_H
24 #define CRYOMNI3D_WAM_PARSER_H
25 
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "common/str.h"
29 
30 namespace Common {
31 class ReadStream;
32 }
33 
34 namespace CryOmni3D {
35 
36 class Omni3DManager;
37 
38 struct Zone {
39 	uint zoneId;
40 	uint action;
41 	Common::Rect rct;
42 };
43 
44 struct Transition {
45 	uint dstId;
46 	double srcAlpha;
47 	double srcBeta;
48 	double dstAlpha;
49 	double dstBeta;
50 	Common::Array<Common::String> animations;
getNumAnimationsTransition51 	uint getNumAnimations() const { return animations.size(); }
52 };
53 
54 struct Place {
55 	uint placeId;
56 	Common::Array<Common::String> warps;
57 	Common::Array<Transition> transitions;
58 	Common::Array<Zone> zones;
59 
getNumStatesPlace60 	uint getNumStates() const { return warps.size(); }
getNumTransitionsPlace61 	uint getNumTransitions() const { return transitions.size(); }
62 	void setupWarpConstraints(Omni3DManager &omni3d) const;
63 	uint hitTest(const Common::Point &point) const;
64 	const Transition *findTransition(uint nextPlaceId) const;
65 };
66 
67 class WAMParser {
68 public:
69 	void loadStream(Common::ReadStream &stream);
70 	const Place *findPlaceById(uint placeId) const;
71 
72 private:
73 	// For duplicate finding
74 	// We use a different name because else it gets chosen before the const one and fails because it's private
75 	Place *findPlaceById_(uint placeId);
76 	Common::Array<Place> _places;
77 };
78 
79 } // End of namespace CryOmni3D
80 
81 #endif
82