ScummVM API documentation
px_walkarea_integer.h
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 * Additional copyright for this file:
8 * Copyright (C) 1999-2000 Revolution Software Ltd.
9 * This code is based on source code created by Revolution Software,
10 * used with permission.
11 *
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25 */
26
27#ifndef WALKAREA_H
28#define WALKAREA_H
29
30#include "engines/icb/common/px_rcutypes.h"
31
32namespace ICB {
33
34#define INTEGER_WALKAREA_API_SCHEMA 1
35
36struct __point { // 3D integer coordinate representation
37 __point(void) : x(0), y(0), z(0) { ; }
38 __point(int32 X, int32 Y, int32 Z) : x(X), y(Y), z(Z) { ; }
39
40 int32 x;
41 int32 y;
42 int32 z;
43};
44
46 char name[32]; // Name of the walkarea
47 char cameraCluster[8]; // Hashed cameraName value
48
49 // Bounding box dimensions
50 int32 x; // Top-left corner x coordinate (Revolution space)
51 int32 y; // Top-left corner y coordinate (Revolution space)
52 int32 z; // Top-left corner z coordinate (Revolution space)
53 int32 w; // Width
54 int32 h; // Height
55
56 // THE AREA DEFINITION (All in Revolution space)
57 uint32 noPoints; // Number of verteces\knots in 2D spline
58 __point points[1]; // The points themselves (spline is always closed)
59
60 char cameraName[1]; // Name of associated camera (DWORD aligned)
61};
62
64public:
65 uint32 schema; // The format version
66 char ID[4]; // ID "WGA"
67
68 // Class methods
69
72
73 uint32 GetSchema(void) const { return schema; }
74 uint32 GetNoAreas(void) const { return noAreas; }
75
76 // Get pointer to a specific WalkArea
77 inline const __aWalkArea *GetWalkArea(uint32 number) const;
78 inline uint32 GetNoPoints(uint32 number) const;
79 inline int32 GetBox_X(uint32 number) const;
80 inline int32 GetBox_Y(uint32 number) const;
81 inline int32 GetBox_Z(uint32 number) const;
82 inline int32 GetBox_W(uint32 number) const;
83 inline int32 GetBox_H(uint32 number) const;
84
85 bool8 GetAreaName(uint32 number, const char *&name) const;
86 bool8 GetCluster(uint32 number, const char *&cluster) const;
87 bool8 GetPoint(uint32 area, uint32 number, __point &point) const;
88 bool8 GetCameraName(uint32 number, const char *&name) const;
89
90private:
91 uint32 noAreas;
92 uint32 offsetTable[1];
93};
94
95inline const __aWalkArea *INTEGER_WalkAreaFile::GetWalkArea(uint32 number) const { return ((const __aWalkArea *)(((const char *)this) + offsetTable[number])); }
96
97inline uint32 INTEGER_WalkAreaFile::GetNoPoints(uint32 number) const { return (GetWalkArea(number)->noPoints); }
98
99inline int32 INTEGER_WalkAreaFile::GetBox_X(uint32 number) const { return (GetWalkArea(number)->x); }
100
101inline int32 INTEGER_WalkAreaFile::GetBox_Y(uint32 number) const { return (GetWalkArea(number)->y); }
102
103inline int32 INTEGER_WalkAreaFile::GetBox_Z(uint32 number) const { return (GetWalkArea(number)->z); }
104
105inline int32 INTEGER_WalkAreaFile::GetBox_W(uint32 number) const { return (GetWalkArea(number)->w); }
106
107inline int32 INTEGER_WalkAreaFile::GetBox_H(uint32 number) const { return (GetWalkArea(number)->h); }
108
109inline bool8 INTEGER_WalkAreaFile::GetAreaName(uint32 number, const char *&name) const {
110 if (number >= noAreas)
111 return FALSE8;
112
113 name = GetWalkArea(number)->name;
114
115 return TRUE8;
116}
117
118inline bool8 INTEGER_WalkAreaFile::GetCluster(uint32 number, const char *&cluster) const {
119 if (number >= noAreas)
120 return FALSE8;
121
122 cluster = GetWalkArea(number)->cameraCluster;
123
124 return TRUE8;
125}
126
127inline bool8 INTEGER_WalkAreaFile::GetPoint(uint32 area, uint32 number, __point &point) const {
128 if (area >= noAreas)
129 return FALSE8;
130
131 point.x = GetWalkArea(area)->points[number].x;
132 point.y = GetWalkArea(area)->points[number].y;
133 point.z = GetWalkArea(area)->points[number].z;
134
135 return TRUE8;
136}
137
138inline bool8 INTEGER_WalkAreaFile::GetCameraName(uint32 number, const char *&name) const {
139 if (number >= noAreas)
140 return FALSE8;
141
142 // Get the address of the start of the cameraName (by asking for a point that isn't there
143 name = (const char *)&GetWalkArea(number)->points[GetNoPoints(number)];
144
145 return TRUE8;
146}
147
148} // End of namespace ICB
149
150#endif
Definition: px_walkarea_integer.h:63
Definition: px_walkarea_integer.h:45
Definition: px_walkarea_integer.h:36