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 AGOS_INTERN_H
24 #define AGOS_INTERN_H
25 
26 namespace AGOS {
27 
28 enum ChildType {
29 	kRoomType = 1,
30 	kObjectType = 2,
31 	kPlayerType = 3,
32 	kGenExitType = 4,   // Elvira 1 specific
33 	kSuperRoomType = 4, // Elvira 2 specific
34 
35 	kContainerType = 7,
36 	kChainType = 8,
37 	kUserFlagType = 9,
38 
39 	kInheritType = 255
40 };
41 
42 struct Child {
43 	Child *next;
44 	uint16 type;
45 };
46 
47 struct SubRoom : Child {
48 	uint16 subroutine_id;
49 	uint16 roomExitStates;
50 	uint16 roomExit[1];
51 	uint16 roomShort;
52 	uint16 roomLong;
53 	uint16 flags;
54 };
55 
56 struct SubSuperRoom : Child {
57 	uint16 subroutine_id;
58 	uint16 roomX;
59 	uint16 roomY;
60 	uint16 roomZ;
61 	uint16 roomExitStates[1];
62 };
63 
64 struct SubObject : Child {
65 	uint16 objectName;
66 	uint16 objectSize;
67 	uint16 objectWeight;
68 	uint32 objectFlags;
69 	int16 objectFlagValue[1];
70 };
71 
72 struct SubPlayer : Child {
73 	int16 userKey;
74 	int16 size;
75 	int16 weight;
76 	int16 strength;
77 	int16 flags;
78 	int16 level;
79 	int32 score;
80 };
81 
82 struct SubGenExit : Child {
83 	uint16 subroutine_id;
84 	uint16 dest[6];
85 };
86 
87 struct SubContainer : Child {
88 	uint16 subroutine_id;
89 	uint16 volume;
90 	uint16 flags;
91 };
92 
93 struct SubChain : Child {
94 	uint16 subroutine_id;
95 	uint16 chChained;
96 };
97 
98 struct SubUserFlag : Child {
99 	uint16 subroutine_id;
100 	uint16 userFlags[8];
101 	uint16 userItems[1];
102 };
103 
104 struct SubInherit : Child {
105 	uint16 subroutine_id;
106 	uint16 inMaster;
107 };
108 
109 enum {
110 	SubRoom_SIZE = sizeof(SubRoom) - sizeof(uint16),
111 	SubSuperRoom_SIZE = sizeof(SubSuperRoom) - sizeof(uint16),
112 	SubObject_SIZE = sizeof(SubObject) - sizeof(int16)
113 };
114 
115 struct RoomState {
116 	uint16 state;
117 	uint16 classFlags;
118 	uint16 roomExitStates;
119 
RoomStateRoomState120 	RoomState() { memset(this, 0, sizeof(*this)); }
121 };
122 
123 struct Item {
124 	uint16 parent;
125 	uint16 child;
126 	uint16 next;
127 	int16 noun;
128 	int16 adjective;
129 	int16 state;										/* signed int */
130 	uint16 classFlags;
131 	uint16 itemName;
132 	Child *children;
133 
ItemItem134 	Item() { memset(this, 0, sizeof(*this)); }
135 };
136 
137 struct IconEntry {
138 	Item *item;
139 	uint16 boxCode;
140 };
141 
142 struct IconBlock {
143 	int16 line;
144 	Item *itemRef;
145 	IconEntry iconArray[64];
146 	int16 upArrow, downArrow;
147 	uint16 classMask;
148 };
149 
150 struct WindowBlock {
151 	byte mode;
152 	byte flags;
153 	int16 x, y;
154 	int16 width, height;
155 	int16 textColumn, textRow;
156 	int16 scrollY;
157 	uint16 textColumnOffset, textLength, textMaxLength;
158 	uint8 fillColor, textColor;
159 	IconBlock *iconPtr;
WindowBlockWindowBlock160 	WindowBlock() { memset(this, 0, sizeof(*this)); }
~WindowBlockWindowBlock161 	~WindowBlock() { free (iconPtr); }
162 };
163 // note on text offset:
164 // the actual x-coordinate is: textColumn * 8 + textColumnOffset
165 // the actual y-coordinate is: textRow * 8
166 
167 enum {
168 	SUBROUTINE_LINE_SMALL_SIZE = 2,
169 	SUBROUTINE_LINE_BIG_SIZE = 8
170 };
171 
172 #include "common/pack-start.h"
173 
174 struct Subroutine {
175 	uint16 id;								/* subroutine ID */
176 	uint16 first;								/* offset from subroutine start to first subroutine line */
177 	Subroutine *next;							/* next subroutine in linked list */
178 };
179 
180 struct SubroutineLine {
181 	uint16 next;
182 	int16 verb;
183 	int16 noun1;
184 	int16 noun2;
185 };
186 
187 #include "common/pack-end.h"
188 
189 struct TimeEvent {
190 	uint32 time;
191 	uint16 subroutine_id;
192 	TimeEvent *next;
193 };
194 
195 struct GameSpecificSettings {
196 	const char *base_filename;
197 	const char *restore_filename;
198 	const char *tbl_filename;
199 	const char *effects_filename;
200 	const char *speech_filename;
201 };
202 
203 enum BoxFlags {
204 	kBFToggleBox      = 0x1, // Elvira 1/2
205 	kBFTextBox        = 0x1, // Others
206 	kBFBoxSelected    = 0x2,
207 	kBFInvertSelect   = 0x4, // Elvira 1/2
208 	kBFNoTouchName    = 0x4, // Others
209 	kBFInvertTouch    = 0x8,
210 	kBFHyperBox       = 0x10, // Feeble Files
211 	kBFDragBox        = 0x10, // Others
212 	kBFBoxInUse       = 0x20,
213 	kBFBoxDead        = 0x40,
214 	kBFBoxItem        = 0x80
215 };
216 
217 enum OldBoxFlags_PN {
218 	kOBFObject         = 0x1,
219 	kOBFExit           = 0x2,
220 	kOBFDraggable      = 0x4,
221 	kOBFUseEmptyLine   = 0x8,
222 	kOBFBoxDisabled    = 0x10,
223 	kOBFInventoryBox   = 0x20,
224 	kOBFRoomBox        = 0x40,
225 	kOBFMoreBox        = 0x80,
226 	kOBFNoShowName     = 0x100,
227 	kOBFUseMessageList = 0x400,
228 	// ScummVM specific
229 	kOBFBoxSelected    = 0x800,
230 	kOBFInvertTouch    = 0x1000
231 };
232 
233 enum SubObjectFlags {
234 	kOFText           = 0x1,
235 	kOFSize           = 0x2,
236 	kOFWorn           = 0x4, // Elvira 1
237 	kOFWeight         = 0x4, // Others
238 	kOFVolume         = 0x8,
239 	kOFIcon           = 0x10,
240 	kOFKeyColor1      = 0x20,
241 	kOFKeyColor2      = 0x40,
242 	kOFMenu           = 0x80,
243 	kOFNumber         = 0x100,
244 	kOFSoft           = 0x200, // Waxworks
245 	kOFVoice          = 0x200  // Others
246 };
247 
248 enum GameFeatures {
249 	GF_TALKIE           = 1 << 0,
250 	GF_OLD_BUNDLE       = 1 << 1,
251 	GF_CRUNCHED         = 1 << 2,
252 	GF_CRUNCHED_GAMEPC  = 1 << 3,
253 	GF_ZLIBCOMP         = 1 << 4,
254 	GF_32COLOR          = 1 << 5,
255 	GF_EGA              = 1 << 6,
256 	GF_PLANAR           = 1 << 7,
257 	GF_DEMO             = 1 << 8,
258 	GF_PACKED           = 1 << 9,
259 	GF_BROKEN_FF_RATING = 1 << 10,
260 	GF_WAVSFX           = 1 << 11
261 };
262 
263 enum GameFileTypes {
264 	GAME_BASEFILE = 1 << 0,
265 	GAME_ICONFILE = 1 << 1,
266 	GAME_GMEFILE  = 1 << 2,
267 	GAME_MENUFILE = 1 << 3,
268 	GAME_STRFILE  = 1 << 4,
269 	GAME_RMSLFILE = 1 << 5,
270 	GAME_STATFILE = 1 << 6,
271 	GAME_TBLFILE  = 1 << 7,
272 	GAME_XTBLFILE = 1 << 8,
273 	GAME_RESTFILE = 1 << 9,
274 	GAME_TEXTFILE = 1 << 10,
275 	GAME_VGAFILE  = 1 << 11,
276 
277 	GAME_GFXIDXFILE = 1 << 12
278 };
279 
280 enum GameIds {
281 	GID_PN,
282 	GID_ELVIRA1,
283 	GID_ELVIRA2,
284 	GID_WAXWORKS,
285 
286 	GID_SIMON1,
287 	GID_SIMON1DOS,
288 	GID_SIMON1CD32,
289 
290 	GID_SIMON2,
291 
292 	GID_FEEBLEFILES,
293 
294 	GID_DIMP,
295 	GID_JUMBLE,
296 	GID_PUZZLE,
297 	GID_SWAMPY
298 };
299 
300 } // End of namespace AGOS
301 
302 #endif
303