Debian Codegraph @

terps/scott/saga/apple2detect.c

raw symbols SCIP
1 //
2 // apple2detect.c
3 // Part of ScottFree, an interpreter for adventures in Scott Adams format
4 //
5 // Created by Petter Sjölund on 2022-08-03.
6 //
7
8 #include <ctype.h>
9 #include <stdlib.h>
10 #include <string.h>
11
12 #include "apple2draw.h"
13 #include "ciderpress.h"
14 #include "hulk.h"
15 #include "saga.h"
16 #include "sagagraphics.h"
17 #include "scott.h"
18 #include "scottdefines.h"
19 #include "woz2nib.h"
20
21 #include "apple2detect.h"
22
23 static const pairrec a2companionlist[][2] = {
24 { { 0x23000, 0xa989, "Scott Adams Graphic Adventure 1 - Adventureland v2.0-416 (4am crack) side A.dsk", 79 }, { 0x23000, 0x5750, "Scott Adams Graphic Adventure 1 - Adventureland v2.0-416 (4am crack) side B - boot.dsk", 86 } },
25
26 { { 0x39557, 0x3ff3, "SAGA #1 - Adventureland v2.0-416 (1982)(Adventure International)(II+)(US)(Side A)[48K].woz", 90 }, { 0x39557, 0x374e, "SAGA #1 - Adventureland v2.0-416 (1982)(Adventure International)(II+)(US)(Side B)(Boot)[48K].woz", 96 } },
27
28 { { 0x39567, 0x8aa4, "SAGA #2 - Pirate Adventure v2.1-408 (1982)(Adventure International)(II+)(US)(Side A)[48K].woz", 93 }, { 0x39567, 0xcf60, "SAGA #2 - Pirate Adventure v2.1-408 (1982)(Adventure International)(II+)(US)(Side B)(Boot)[48K].woz", 99 } },
29
30 { { 0x39554, 0xbbd3, "SAGA #3 - Mission Impossible v2.1-306 (1982)(Adventure International)(II+)(US)(Side A)[48K].woz", 95 }, { 0x39554, 0x361a, "SAGA #3 - Mission Impossible v2.1-306 (1982)(Adventure International)(II+)(US)(Side B)(Boot)[48K].woz", 101 } },
31
32 { { 0x39558, 0x958f, "SAGA #4 - Voodoo Castle v2.1-119 (1982)(Adventure International)(II+)(US)(Side A)[48K].woz", 90 }, { 0x39558, 0xff6a, "SAGA #4 - Voodoo Castle v2.1-119 (1982)(Adventure International)(II+)(US)(Side B)(Boot)[48K].woz", 96 } },
33
34 { { 0x23000, 0xedf, "Scott Adams Graphic Adventure 5 - The Count v2.1-115 (4am crack) side A.dsk", 75 }, { 0x23000, 0x09f4, "Scott Adams Graphic Adventure 5 - The Count v2.1-115 (4am crack) side B - boot.dsk", 82 } },
35
36 { { 0x39589, 0x7010, "SAGA #5 - The Count v2.1-115 (1982)(Adventure International)(II+)(US)(Side A)[48K].woz", 86 }, { 0x39589, 0xbf0e, "SAGA #5 - The Count v2.1-115 (1982)(Adventure International)(II+)(US)(Side B)(Boot)[48K].woz", 92 } },
37
38 { { 0x39589, 0xee5d, "SAGA #6 - Strange Odyssey v2.1-119 (1982)(Adventure International)(II+)(US)(Side A)[48K].woz", 92 }, { 0x39589, 0x4c17, "SAGA #6 - Strange Odyssey v2.1-119 (1982)(Adventure International)(II+)(US)(Side B)(Boot)[48K].woz", 98 } },
39
40 { { 0x23000, 0xd8ca, "Scott Adams Graphic Adventure 6 - Strange Odyssey v2.1-119 (4am crack) side A.dsk", 81 }, { 0x23000, 0xd700, "Scott Adams Graphic Adventure 6 - Strange Odyssey v2.1-119 (4am crack) side B - boot.dsk", 88 } },
41
42 { { 0, 0, NULL }, { 0, 0, NULL } }
43 };
44
45 typedef struct imglist {
46 USImageType usage;
47 int index;
48 size_t offset;
49 size_t size;
50 } imglist;
51
52 static const imglist a2listHulk[] = {
53 { IMG_ROOM, 0, 0x1000, 0x4ad }, // Too dark
54 { IMG_ROOM, 1, 0x1500, 0x69a }, // Tied to chair
55 { IMG_ROOM, 2, 0x1c00, 0x6d1 }, // dome
56 { IMG_ROOM, 3, 0x2400, 0x501 }, // tunnel
57 { IMG_ROOM, 4, 0x2a00, 0x6b4 }, // field
58 { IMG_ROOM, 5, 0x3100, 0x501 }, // tunnel 2
59 { IMG_ROOM, 6, 0x3700, 0x501 }, // tunnel 3
60 { IMG_ROOM, 7, 0x3d00, 0x6b4 }, // field 2
61 { IMG_ROOM, 8, 0x4400, 0x6b4 }, // field 3
62 { IMG_ROOM, 9, 0x4b00, 0x9f7 }, // hole
63 { IMG_ROOM, 10, 0x5600, 0x9f7 }, // hole 2
64 { IMG_ROOM, 11, 0x6100, 0x9f7 }, // hole 3
65 { IMG_ROOM, 12, 0x6c00, 0x134d }, // cavern
66 { IMG_ROOM, 13, 0x8000, 0x66e }, // dome 2
67 { IMG_ROOM, 14, 0x8700, 0x66e }, // dome 3
68 { IMG_ROOM, 15, 0x8e00, 0x956 }, // small underground room
69 { IMG_ROOM, 16, 0x9800, 0xcad }, // fuzzy area
70
71 { IMG_ROOM, 19, 0xa700, 0x798 }, // room with the Chief Examiner
72 { IMG_ROOM, 20, 0xaf00, 0x1130 }, // limbo
73 { IMG_ROOM, 81, 0xc100, 0xb4a }, // hulk in mirror
74 { IMG_ROOM, 82, 0xcd00, 0x9b0 }, // banner in mirror
75 { IMG_ROOM, 83, 0xd700, 0x967 }, // rope breaks
76 { IMG_ROOM, 84, 0xe100, 0x11f9 }, // I'm Hulk
77 { IMG_ROOM, 85, 0xf400, 0xce6 }, // Lifts dome
78 { IMG_ROOM, 86, 0x10200, 0x1054 }, // Gas
79 { IMG_ROOM, 87, 0x11300, 0x7b6 }, // Victory
80 { IMG_ROOM, 88, 0x11b00, 0xe3f }, // Nightmares
81 { IMG_ROOM, 89, 0x12a00, 0x12b1 }, // Digging
82 { IMG_ROOM, 90, 0x13e00, 0xb7e }, // Dome with mesh
83
84 { IMG_ROOM, 91, 0x14a00, 0xb39 }, // Bio gem
85 { IMG_ROOM, 92, 0x15600, 0x992 }, // Natter egg
86
87 { IMG_ROOM, 93, 0x16000, 0xaea }, // ant
88 { IMG_ROOM, 94, 0x16b00, 0xfeb }, // bees
89 { IMG_ROOM, 95, 0x17b00, 0x730 }, // ring in floor
90 { IMG_ROOM, 96, 0x18300, 0x1082 }, // ant-man
91 { IMG_ROOM, 97, 0x19400, 0x63c }, // outlet
92 { IMG_ROOM, 99, 0x19b00, 0xe1b }, // title
93
94 { IMG_INV_OBJ, 01, 0x1aa00, 0x523 }, // rage (Hulk with bag)
95 { IMG_INV_OBJ, 02, 0x1b000, 0x83 }, // mirror
96 { IMG_INV_OBJ, 03, 0x1b100, 0x102 }, // broken chair
97 { IMG_INV_OBJ, 04, 0x1b300, 0x3e }, // gem 1
98 { IMG_INV_OBJ, 12, 0x1b400, 0x3e }, // gem 2
99
100 { IMG_ROOM_OBJ, 13, 0x1b500, 0xc2 }, // pit
101 { IMG_ROOM_OBJ, 14, 0x1b600, 0xc2 }, // pit
102 { IMG_ROOM_OBJ, 15, 0x1b700, 0xc2 }, // pit
103
104 { IMG_INV_OBJ, 16, 0x1b800, 0x3e }, // gem 3
105
106 { IMG_ROOM_OBJ, 17, 0x1b900, 0x1b6 }, // egg in room
107 { IMG_INV_OBJ, 18, 0x1bb00, 0xed }, // bio-gem in inventory
108
109 { IMG_INV_OBJ, 19, 0x1bc00, 0x3e }, // gem 4
110
111 { IMG_ROOM_OBJ, 20, 0x1bd00, 0x75b }, // ANTS (broken)
112
113 { IMG_INV_OBJ, 21, 0x1c500, 0x45 }, // wax
114
115 { IMG_ROOM_OBJ, 22, 0x1c600, 0x308 }, // anthills (tiny holes)
116
117 { IMG_INV_OBJ, 23, 0x1ca00, 0xa9 }, // fan
118
119 { IMG_ROOM_OBJ, 24, 0x1cb00, 0xa0 }, // bees
120 { IMG_ROOM_OBJ, 25, 0x1cc00, 0x13e }, // beeholes
121 { IMG_ROOM_OBJ, 26, 0x1ce00, 0xda2 }, // dr strange (broken)
122
123 { IMG_INV_OBJ, 29, 0x1dc00, 0x3e }, // gem 5
124 { IMG_INV_OBJ, 30, 0x1dd00, 0x3e }, // gem 6
125 { IMG_INV_OBJ, 31, 0x1de00, 0x3e }, // gem 7
126 { IMG_INV_OBJ, 32, 0x1df00, 0x3e }, // gem 8
127
128 { IMG_ROOM_OBJ, 33, 0x1e000, 0xad }, // Ring in floor
129 { IMG_ROOM_OBJ, 34, 0x1e100, 0x240 }, // Hole in floor
130
131 { IMG_INV_OBJ, 35, 0x1e400, 0x3e }, // gem 9
132
133 { IMG_ROOM_OBJ, 36, 0x1e500, 0x76 }, // button
134
135 { IMG_INV_OBJ, 37, 0x1e600, 0x3d }, // gem 10
136
137 { IMG_ROOM_OBJ, 39, 0x1e700, 0x201 }, // Hole in ceiling
138 { IMG_ROOM_OBJ, 40, 0x1ea00, 0xf6 }, // Crack in floor
139
140 { IMG_INV_OBJ, 42, 0x1eb00, 0x3d }, // gem 11
141 { IMG_INV_OBJ, 44, 0x1ec00, 0x3d }, // gem 12
142
143 { IMG_ROOM_OBJ, 45, 0x1ed00, 0xf05 }, // ultron
144
145 { IMG_INV_OBJ, 48, 0x1fd00, 0x3c }, // gem 13
146 { IMG_INV_OBJ, 49, 0x1fe00, 0x3c }, // gem 14
147 { IMG_INV_OBJ, 50, 0x1ff00, 0x3c }, // gem 15
148
149 { IMG_ROOM_OBJ, 70, 0x20100, 0x2e1 }, // Bio-Gem in room
150 { IMG_ROOM_OBJ, 72, 0x20700, 0x3f }, // Wax in room
151
152 { IMG_INV_OBJ, 51, 0x21200, 0x3c }, // gem 16
153
154 { 0, 0, 0, 0 }
155 };
156
157 static const imglist a2listHulk126[] = {
158 { IMG_ROOM, 0, 0x1000, 0x4ad }, // Too dark
159 { IMG_ROOM, 1, 0x1500, 0x6cc }, // Tied to chair
160 { IMG_ROOM, 2, 0x1c00, 0x6c0 }, // dome
161 { IMG_ROOM, 3, 0x2300, 0x500 }, // tunnel
162 { IMG_ROOM, 4, 0x2900, 0x6b4 }, // field
163 { IMG_ROOM, 5, 0x3000, 0x501 }, // tunnel 2
164 { IMG_ROOM, 6, 0x3600, 0x501 }, // tunnel 3
165 { IMG_ROOM, 7, 0x3c00, 0x6b4 }, // field 2
166 { IMG_ROOM, 8, 0x4300, 0x6b4 }, // field 3
167 { IMG_ROOM, 9, 0x4a00, 0x9f7 }, // hole
168 { IMG_ROOM, 10, 0x5300, 0x9f7 }, // hole 2
169 { IMG_ROOM, 11, 0x5c00, 0x9f7 }, // hole 3
170 { IMG_ROOM, 12, 0x6500, 0x11ec }, // cavern
171 { IMG_ROOM, 13, 0x7800, 0x6bf }, // dome 2
172 { IMG_ROOM, 14, 0x7f00, 0x6bf }, // dome 3
173 { IMG_ROOM, 15, 0x8600, 0x956 }, // small underground room
174 { IMG_ROOM, 16, 0x9000, 0xcad }, // fuzzy area
175 { IMG_ROOM, 19, 0x9f00, 0x798 }, // room with Chief Examiner
176 { IMG_ROOM, 20, 0xa700, 0xba2 }, // limbo
177
178 { IMG_ROOM, 81, 0xb400, 0xb4a }, // hulk in mirror
179 { IMG_ROOM, 82, 0xc000, 0x9bc }, // banner in mirror
180 { IMG_ROOM, 83, 0xca00, 0x994 }, // rope breaks
181 { IMG_ROOM, 84, 0xd400, 0x11f9 }, // I'm Hulk
182 { IMG_ROOM, 85, 0xe500, 0xe10 }, // Lifts dome
183 { IMG_ROOM, 86, 0xf400, 0x105a }, // Gas
184 { IMG_ROOM, 87, 0x10500, 0x7b7 }, // Victory
185 { IMG_ROOM, 88, 0x10d00, 0xe3f }, // Nightmares
186 { IMG_ROOM, 89, 0x11c00, 0x12b1 }, // Digging
187 { IMG_ROOM, 90, 0x13000, 0xb7e }, // Dome with mesh
188 { IMG_ROOM, 91, 0x13c00, 0xe1e }, // Bio gem
189 { IMG_ROOM, 92, 0x14b00, 0x992 }, // Natter egg
190 { IMG_ROOM, 93, 0x15500, 0xaea }, // ant
191 { IMG_ROOM, 94, 0x16000, 0xfeb }, // bees
192 { IMG_ROOM, 95, 0x17000, 0x730 }, // ring in floor
193 { IMG_ROOM, 96, 0x17800, 0x1082 }, // ant-man
194 { IMG_ROOM, 97, 0x18900, 0x63c }, // outlet
195
196 { IMG_ROOM, 98, 0x19000, 0x393 }, // inventory
197
198 { IMG_ROOM, 99, 0x19400, 0x540 }, // title (placeholder)
199
200 { IMG_INV_OBJ, 1, 0x19a00, 0x523 }, // rage (Hulk with bag)
201 { IMG_INV_OBJ, 2, 0x1a000, 0x83 }, // mirror
202 { IMG_INV_OBJ, 3, 0x1a100, 0x102 }, // broken chair
203 { IMG_INV_OBJ, 4, 0x1a300, 0x3e }, // gem 1
204 { IMG_INV_OBJ, 12, 0x1a400, 0x3e }, // gem 2
205
206 { IMG_ROOM_OBJ, 13, 0x1a500, 0xc2 }, // pit
207 { IMG_ROOM_OBJ, 14, 0x1a600, 0xc2 }, // pit
208 { IMG_ROOM_OBJ, 15, 0x1a700, 0xc2 }, // pit
209
210 { IMG_INV_OBJ, 16, 0x1a800, 0x3e }, // gem 3
211
212 { IMG_ROOM_OBJ, 17, 0x1a900, 0x1b6 }, // egg in room
213
214 { IMG_INV_OBJ, 18, 0x1ab00, 0xed }, // bio-gem in inventory
215 { IMG_INV_OBJ, 19, 0x1ac00, 0x3e }, // gem 4
216
217 { IMG_ROOM_OBJ, 20, 0x1ad00, 0x75b }, // ants
218
219 { IMG_INV_OBJ, 21, 0x1b500, 0x45 }, // wax
220
221 { IMG_ROOM_OBJ, 22, 0x1b600, 0x308 }, // anthills (tiny holes)
222
223 { IMG_INV_OBJ, 23, 0x1ba00, 0xa9 }, // fan
224
225 { IMG_ROOM_OBJ, 24, 0x1bb00, 0xa0 }, // bees
226 { IMG_ROOM_OBJ, 25, 0x1bc00, 0x13e }, // beeholes
227 { IMG_ROOM_OBJ, 26, 0x1be00, 0xe75 }, // dr strange
228
229 { IMG_INV_OBJ, 29, 0x1cd00, 0x3e }, // gem 5
230 { IMG_INV_OBJ, 30, 0x1ce00, 0x3e }, // gem 6
231 { IMG_INV_OBJ, 31, 0x1cf00, 0x3e }, // gem 7
232 { IMG_INV_OBJ, 32, 0x1d000, 0x3e }, // gem 8
233
234 { IMG_ROOM_OBJ, 33, 0x1d100, 0xad }, // Ring in floor
235 { IMG_ROOM_OBJ, 34, 0x1d200, 0x240 }, // Hole in floor
236
237 { IMG_INV_OBJ, 35, 0x1d500, 0x3e }, // gem 9
238
239 { IMG_ROOM_OBJ, 36, 0x1d600, 0x76 }, // button
240
241 { IMG_INV_OBJ, 37, 0x1d700, 0x3d }, // gem 10
242
243 { IMG_ROOM_OBJ, 39, 0x1d800, 0x2a0 }, // Hole in ceiling
244 { IMG_ROOM_OBJ, 40, 0x1db00, 0xf6 }, // Crack in floor
245
246 { IMG_INV_OBJ, 42, 0x1dc00, 0x3d }, // gem 11
247 { IMG_INV_OBJ, 44, 0x1dd00, 0x3d }, // gem 12
248
249 { IMG_ROOM_OBJ, 45, 0x1de00, 0xf05 }, // ultron
250
251 { IMG_INV_OBJ, 48, 0x1ea00, 0x3c }, // gem 13
252
253 { IMG_ROOM_OBJ, 47, 0x1eb00, 0x105 }, // Ant-man in cage
254
255 { IMG_INV_OBJ, 49, 0x1ed00, 0x3c }, // gem 14
256 { IMG_INV_OBJ, 50, 0x1ee00, 0x3c }, // gem 15
257 { IMG_INV_OBJ, 51, 0x1ef00, 0x3c }, // gem 16
258
259 { IMG_ROOM_OBJ, 53, 0x1f000, 0x6c }, // sign (in dome 1)
260
261 { IMG_ROOM_OBJ, 70, 0x1f100, 0x2e1 }, // Bio-Gem in room
262 { IMG_ROOM_OBJ, 17, 0x1f500, 0x18e }, // Egg in room
263
264 { IMG_ROOM_OBJ, 72, 0x1f700, 0x3f }, // Wax in room
265
266 { 0, 0, 0, 0 }
267 };
268
269 static const imglist a2listClaymorgue[] = {
270 { IMG_ROOM, 0, 0x1000, 0x01ac }, // Too dark
271 { IMG_ROOM, 1, 0x01200, 0x0c4a }, // field
272 { IMG_ROOM, 2, 0x01f00, 0x06da }, // on drawbridge
273 { IMG_ROOM, 3, 0x02600, 0x119a }, // courtyard
274 { IMG_ROOM, 4, 0x03800, 0x0b4e }, // magic fountain
275 { IMG_ROOM, 5, 0x04400, 0x0bf2 }, // stream of lava
276 { IMG_ROOM, 6, 0x05000, 0x0ddc }, // top of the fountain
277 { IMG_ROOM, 7, 0x05e00, 0x07b2 }, // ball room
278 { IMG_ROOM, 8, 0x06600, 0x0aa4 }, // on chandelier
279 { IMG_ROOM, 9, 0x07100, 0x04e4 }, // forest of enchantment
280 { IMG_ROOM, 10, 0x07600, 0x08bc }, // plain room
281 { IMG_ROOM, 11, 0x07f00, 0x0b6e }, // storeroom
282 { IMG_ROOM, 12, 0x08b00, 0x0a00 }, // dungeon cell
283 { IMG_ROOM, 13, 0x09800, 0x0914 }, // anteroom
284 { IMG_ROOM, 14, 0x0a200, 0x0858 }, // staircase
285 { IMG_ROOM, 15, 0x0ab00, 0x08d8 }, // loft above ballroom
286 { IMG_ROOM, 16, 0x0b400, 0x111a }, // in the moat
287 { IMG_ROOM, 17, 0x0c600, 0x00a0 }, // underwater
288 { IMG_ROOM, 18, 0x0c700, 0x1358 }, // *I'm under the stairs
289 { IMG_ROOM, 19, 0x0db00, 0x14d0 }, // hollow tree
290 { IMG_ROOM, 20, 0x0f000, 0x090e }, // pool of dirty water
291 { IMG_ROOM, 21, 0x0fa00, 0x0916 }, // kitchen
292 { IMG_ROOM, 22, 0x10400, 0x07a0 }, // *I'm on a box
293 { IMG_ROOM, 23, 0x10c00, 0x09e2 }, // box
294 { IMG_ROOM, 24, 0x11600, 0x111a }, // dusty room
295 { IMG_ROOM, 25, 0x12800, 0x0558 }, // stone staircase
296 { IMG_ROOM, 26, 0x12e00, 0x1550 }, // damp cavern
297 { IMG_ROOM, 27, 0x14400, 0x0c28 }, // stone grotto
298 { IMG_ROOM, 28, 0x15100, 0x11f6 }, // *I'm in an entryway
299 { IMG_ROOM, 29, 0x16300, 0x139c }, // dragon's lair
300 { IMG_ROOM, 30, 0x17700, 0x10ca }, // wizard's workshop
301 { IMG_ROOM, 31, 0x18800, 0x085e }, // vacant room
302 { IMG_ROOM, 32, 0x19100, 0x0be4 }, // real mess!
303
304 { IMG_ROOM, 99, 0x19d00, 0x0bd8 }, // Title
305
306 { IMG_INV_OBJ, 0, 0x1a900, 0x16 }, // star 0
307
308 { IMG_ROOM_OBJ, 4, 0x1aa00, 0xe0 }, // Lowered drawbridge
309
310 { IMG_INV_OBJ, 5, 0x1ab00, 0x20 }, // star 1
311 { IMG_INV_OBJ, 6, 0x1ac00, 0x16 }, // star 2
312 { IMG_INV_OBJ, 7, 0x1ad00, 0x12 }, // star 3
313 { IMG_INV_OBJ, 8, 0x1ae00, 0x16 }, // star 4
314 { IMG_INV_OBJ, 9, 0x1af00, 0x8c }, // I'm glowing
315 { IMG_INV_OBJ, 10, 0x1b000, 0x16 }, // star 5
316 { IMG_INV_OBJ, 11, 0x1b100, 0x16 }, // star 6
317 { IMG_INV_OBJ, 12, 0x1b200, 0x20 }, // star 7
318 { IMG_INV_OBJ, 13, 0x1b300, 0x16 }, // star 8
319 { IMG_INV_OBJ, 14, 0x1b400, 0x16 }, // star 9
320 { IMG_INV_OBJ, 15, 0x1b500, 0x16 }, // star 10
321 { IMG_INV_OBJ, 16, 0x1b600, 0x16 }, // star 11
322 { IMG_INV_OBJ, 20, 0x1b700, 0x3e }, // Magic mirror
323 { IMG_INV_OBJ, 24, 0x1b800, 0x74 }, // Fire spell
324
325 { IMG_ROOM_OBJ, 26, 0x1b900, 0x370 }, // Fallen Chandelier
326
327 { IMG_INV_OBJ, 28, 0x1bd00, 0x44 }, // Broken glass
328
329 { IMG_ROOM_OBJ, 30, 0x1be00, 0x1a4 }, // Open door
330 { IMG_ROOM_OBJ, 32, 0x1c000, 0x192 }, // Open door 2
331
332 { IMG_INV_OBJ, 33, 0x1c200, 0x76 }, // Spell of Methuselah
333 { IMG_INV_OBJ, 34, 0x1c300, 0x74 }, // Seed spell
334 { IMG_INV_OBJ, 35, 0x1c400, 0x58 }, // Potion
335 { IMG_INV_OBJ, 36, 0x1c500, 0x6c }, // Light squared spell
336
337 { IMG_ROOM_OBJ, 38, 0x1c600, 0xd16 }, // loft
338 { IMG_ROOM_OBJ, 39, 0x1d400, 0x69c }, // moat bottom
339
340 { IMG_INV_OBJ, 40, 0x1db00, 0x6a }, // Permeability spell
341 { IMG_INV_OBJ, 41, 0x1dc00, 0x74 }, // Spell of bliss
342 { IMG_INV_OBJ, 42, 0x1dd00, 0x5c }, // Piece of wood
343 { IMG_INV_OBJ, 45, 0x1de00, 0x70 }, // Yoho spell
344
345 { IMG_ROOM_OBJ, 47, 0x1df00, 0xca }, // hole (in crate top, from below)
346
347 { IMG_INV_OBJ, 48, 0x1e000, 0x4a }, // crate
348
349 { IMG_ROOM_OBJ, 49, 0x1e100, 0x2fe }, // hole (in crate top, from above)
350
351 { IMG_INV_OBJ, 50, 0x1e500, 0x58 }, // fire bricks
352 { IMG_INV_OBJ, 51, 0x1e600, 0x140 }, // water droplets
353 { IMG_INV_OBJ, 52, 0x1e800, 0x218 }, // wrinkles
354
355 { IMG_ROOM_OBJ, 54, 0x1eb00, 0x2fa }, // open door 3
356 { IMG_ROOM_OBJ, 55, 0x1ee00, 0x592 }, // raised drawbridge
357
358 { IMG_INV_OBJ, 57, 0x1f400, 0x74 }, // firefly spell
359 { IMG_INV_OBJ, 59, 0x1f500, 0x24 }, // dust
360
361 { IMG_ROOM_OBJ, 60, 0x1f600, 0x6b8 }, // hole behind dragon
362
363 { IMG_INV_OBJ, 61, 0x1fd00, 0x7a }, // wicked queen's spell
364 { IMG_INV_OBJ, 62, 0x1fe00, 0x78 }, // soggy towel
365 { IMG_INV_OBJ, 63, 0x1ff00, 0x3a }, // ashes
366 { IMG_INV_OBJ, 64, 0x20000, 0x74 }, // unravel spell
367 { IMG_INV_OBJ, 65, 0x20100, 0x4a }, // damp towel
368 { IMG_INV_OBJ, 66, 0x20200, 0x40 }, // dry towel
369 { IMG_INV_OBJ, 68, 0x20300, 0x2a }, // tin can
370 { IMG_INV_OBJ, 69, 0x20400, 0x4a }, // open can
371 { IMG_INV_OBJ, 70, 0x20500, 0x74 }, // dizzy dean spell
372 { IMG_INV_OBJ, 71, 0x20600, 0x36 }, // piece of metal
373 { IMG_INV_OBJ, 73, 0x20700, 0x68 }, // lycanthrope spell
374
375 { IMG_ROOM_OBJ, 75, 0x20800, 0x3b4 }, // rabid rats
376
377 { 0, 0, 0, 0 }
378 };
379
380 // Images for alternative version, pre-release?
381 static const imglist a2listClaymorgue126[] = {
382 { IMG_ROOM, 0, 0x1000, 0x1bf }, // Too dark
383 { IMG_ROOM, 1, 0x1200, 0xc02 }, // field
384 { IMG_ROOM, 2, 0x1f00, 0x67a }, // *I'm on a Drawbridge
385 { IMG_ROOM, 3, 0x2600, 0x116a }, // courtyard
386 { IMG_ROOM, 4, 0x3800, 0xb41 }, // magic fountain
387 // { IMG_ROOM, 5, 0x4400, 0xdbc }, // stream of lava
388 { IMG_ROOM, 6, 0x5000, 0xdbc }, // on top of the fountain
389 { IMG_ROOM, 7, 0x5e00, 0x78b }, // ball room
390 { IMG_ROOM, 8, 0x6600, 0xa75 }, // on a large chandelier
391 { IMG_ROOM, 9, 0x7100, 0x4aa }, // forest of enchantment
392 { IMG_ROOM, 10, 0x7600, 0x9f8 }, // plain room
393 { IMG_ROOM, 11, 0x7f00, 0xb4a }, // storeroom
394 { IMG_ROOM, 12, 0x8b00, 0xb8f }, // dungeon cell
395 { IMG_ROOM, 13, 0x9700, 0x134e }, // anteroom
396 { IMG_ROOM, 14, 0xa000, 0x85c }, // staircase
397 { IMG_ROOM, 15, 0xa900, 0x85e }, // loft above ballroom
398 { IMG_ROOM, 16, 0xb200, 0x1100 }, // I'm in the water of a moat
399 { IMG_ROOM, 17, 0xc400, 0x7d }, // I'm underwater in thick murky fluid
400 { IMG_ROOM, 18, 0xc500, 0x4b7 }, // I'm under the stairs
401 // { IMG_ROOM, 19, 0xd200, 0x1131 }, // hollow tree sign says drop stars here
402 { IMG_ROOM, 20, 0xee00, 0x8fb }, // pool of dirty water
403 { IMG_ROOM, 21, 0xf800, 0x8e1 }, // kitchen
404 { IMG_ROOM, 22, 0x10200, 0x1130 }, // I'm on a box
405 { IMG_ROOM, 23, 0x10a00, 0x9c6 }, // inside box
406 { IMG_ROOM, 24, 0x11400, 0x10c9 }, // dusty room
407 { IMG_ROOM, 25, 0x12500, 0x11f9 }, // stone staircase
408 { IMG_ROOM, 26, 0x12b00, 0xce6 }, // damp cavern
409 { IMG_ROOM, 27, 0x14100, 0x11f9 }, // stone grotto
410 { IMG_ROOM, 28, 0x14d00, 0x2000 }, // I'm in an entryway
411 { IMG_ROOM, 29, 0x15f00, 0x1342 }, // dragon's lair
412 { IMG_ROOM, 30, 0x17300, 0x1093 }, // Wizard's workshop
413 { IMG_ROOM, 31, 0x18400, 0x855 }, // vacant room
414 { IMG_ROOM, 32, 0x18d00, 0x11f9 }, // dead
415
416 { IMG_ROOM, 99, 0x19900, 0xbba }, // Title
417
418 { IMG_INV_OBJ, 0, 0x1a500, 0x21 }, // star 0
419 { IMG_ROOM_OBJ, 4, 0x1a600, 0xcc }, // Lowered drawbridge
420 { IMG_INV_OBJ, 5, 0x1a700, 0x23 }, // star 1
421 { IMG_INV_OBJ, 6, 0x1a800, 0x21 }, // star 2
422 { IMG_INV_OBJ, 7, 0x1a900, 0x19 }, // star 3
423
424 { IMG_INV_OBJ, 8, 0x1aa00, 0x22 }, // star 4
425 { IMG_INV_OBJ, 9, 0x1ab00, 0x8c }, // I'm glowing
426 { IMG_INV_OBJ, 10, 0x1ac00, 0x22 }, // star 5
427 { IMG_INV_OBJ, 11, 0x1ad00, 0x1c }, // star 6
428 { IMG_INV_OBJ, 12, 0x1ae00, 0x24 }, // star 7
429 { IMG_INV_OBJ, 13, 0x1af00, 0x23 }, // star 8
430 { IMG_INV_OBJ, 14, 0x1b000, 0x22 }, // star 9
431 { IMG_INV_OBJ, 15, 0x1b100, 0x1a }, // star 10
432 { IMG_INV_OBJ, 16, 0x1b200, 0x22 }, // star 11
433 { IMG_INV_OBJ, 17, 0x1b300, 0x1c }, // star 12
434 { IMG_INV_OBJ, 20, 0x1b400, 0x41 }, // Magic mirror
435 { IMG_INV_OBJ, 24, 0x1b500, 0x4e }, // Fire spell
436
437 { IMG_ROOM_OBJ, 26, 0x1b600, 0x11f9 }, // Fallen Chandelier
438
439 { IMG_INV_OBJ, 28, 0x1ba00, 0x45 }, // Broken glass
440
441 { IMG_ROOM_OBJ, 30, 0x1bb00, 0x196 }, // Open door
442 { IMG_ROOM_OBJ, 32, 0x1bd00, 0x14d }, // Open door 2
443
444 { IMG_INV_OBJ, 33, 0x1bf00, 0x52 }, // Spell of Methuselah
445 { IMG_INV_OBJ, 34, 0x1c000, 0x4b }, // Seed spell
446 { IMG_INV_OBJ, 35, 0x1c100, 0x55 }, // Potion
447 { IMG_INV_OBJ, 36, 0x1c200, 0x4c }, // Light squared spell
448 { IMG_INV_OBJ, 36, 0x1c200, 0x4c }, // Light squared spell
449
450 { IMG_ROOM_OBJ, 38, 0x1c300, 0xcdd }, // loft
451 { IMG_ROOM_OBJ, 39, 0x1d000, 0x68b }, // moat bottom
452
453 { IMG_INV_OBJ, 40, 0x1d700, 0x4c }, // Permeability spell
454 { IMG_INV_OBJ, 41, 0x1d800, 0x4d }, // Spell of bliss
455 { IMG_INV_OBJ, 42, 0x1d900, 0x5f }, // Piece of wood
456 { IMG_INV_OBJ, 45, 0x1da00, 0x53 }, // Yoho spell
457
458 { IMG_ROOM_OBJ, 47, 0x1db00, 0xcb }, // hole (in crate top, from below)
459
460 { IMG_INV_OBJ, 48, 0x1dc00, 0x5d }, // crate
461
462 { IMG_ROOM_OBJ, 49, 0x1dd00, 0x2ed }, // hole (in crate top, from above)
463
464 { IMG_INV_OBJ, 50, 0x1e000, 0x5e }, // fire bricks
465 { IMG_INV_OBJ, 51, 0x1e100, 0x75 }, // water droplets
466 { IMG_INV_OBJ, 52, 0x1e200, 0x1e4 }, // wrinkles
467
468 { IMG_ROOM_OBJ, 54, 0x1e500, 0x2f3 }, // open door 3
469 { IMG_ROOM_OBJ, 55, 0x1e800, 0x30f }, // raised drawbridge
470
471 { IMG_INV_OBJ, 57, 0x1ec00, 0x52 }, // firefly spell
472 { IMG_INV_OBJ, 59, 0x1ed00, 0x22 }, // dust
473
474 { IMG_ROOM_OBJ, 60, 0x1ee00, 0x6ae }, // hole behind dragon
475
476 { IMG_INV_OBJ, 61, 0x1f500, 0x4f }, // wicked queen's spell
477 { IMG_INV_OBJ, 62, 0x1f600, 0x7c }, // soggy towel
478 { IMG_INV_OBJ, 63, 0x1f700, 0x40 }, // ashes
479 { IMG_INV_OBJ, 64, 0x1f800, 0x4d }, // unravel spell
480 { IMG_INV_OBJ, 65, 0x1f900, 0x5c }, // damp towel
481 { IMG_INV_OBJ, 66, 0x1fa00, 0x44 }, // dry towel
482 { IMG_INV_OBJ, 68, 0x1fb00, 0x38 }, // tin can
483 { IMG_INV_OBJ, 69, 0x1fc00, 0x57 }, // open can
484 { IMG_INV_OBJ, 70, 0x1fd00, 0x4d }, // dizzy dean spell
485 { IMG_INV_OBJ, 71, 0x1fe00, 0x43 }, // piece of metal
486 { IMG_INV_OBJ, 72, 0x1ff00, 0x52 }, // lycanthrope spell
487
488 { IMG_ROOM_OBJ, 74, 0x20000, 0x34 }, // old lever in wall
489 { IMG_ROOM_OBJ, 75, 0x20100, 0x3b2 }, // rabid rats
490
491 { 0, 0, 0, 0 }
492 };
493
494 static const imglist a2listCount[] = {
495 { IMG_ROOM, 0, 0x01000, 0xa0c }, // Too dark to see
496 { IMG_ROOM, 1, 0x01b00, 0x8ba }, // *I'm lying in a large brass bed
497 { IMG_ROOM, 2, 0x02400, 0x992 }, // bedroom
498 { IMG_ROOM, 3, 0x02e00, 0xdb8 }, // *I'm on A ledge outside An open window
499 { IMG_ROOM, 4, 0x03c00, 0xa58 }, // *I'm hanging on the end of a sheet, I made a fold in the sheet
500 { IMG_ROOM, 5, 0x04700, 0xa94 }, // flower box outside An open window
501 { IMG_ROOM, 6, 0x05200, 0x104c }, // CRYPT
502 { IMG_ROOM, 7, 0x06300, 0xaa6 }, // closet
503 { IMG_ROOM, 8, 0x06e00, 0x8d2 }, // Bathroom
504 { IMG_ROOM, 9, 0x07700, 0xc22 }, // *I'm outside the castle
505 { IMG_ROOM, 10, 0x08400, 0xa46 }, // DOORLESS room
506 { IMG_ROOM, 11, 0x08f00, 0x9c8 }, // hall inside the castle
507 { IMG_ROOM, 12, 0x09900, 0xaa8 }, // kitchen
508 { IMG_ROOM, 13, 0x0a400, 0x1002 }, // large COFFIN
509 { IMG_ROOM, 14, 0x0b500, 0xa3c }, // pAntry
510 { IMG_ROOM, 15, 0x0c000, 0xe00 }, // giant SOLAR OVEN
511 { IMG_ROOM, 16, 0x0cf00, 0xbe6 }, // Dungeon
512 { IMG_ROOM, 17, 0x0db00, 0xf06 }, // Meandering path
513 { IMG_ROOM, 18, 0x0eb00, 0x1264 }, // Pit
514 { IMG_ROOM, 19, 0x0fe00, 0xfa6 }, // Dark passage
515 { IMG_ROOM, 20, 0x10e00, 0x724 }, // dumb-waiter by a room
516 { IMG_ROOM, 21, 0x11600, 0x948 }, // workroom
517 { IMG_ROOM, 22, 0x12000, 0xd48 }, // LOT OF TROUBLE! (And so Are you!)
518
519 { IMG_ROOM, 90, 0x12e00, 0x93e }, // 38, Closeup package
520 { IMG_ROOM, 91, 0x13800, 0x9bc }, // 46, Closeup angry mob
521 { IMG_ROOM, 99, 0x14200, 0xf26 }, // Title
522
523 { IMG_INV_OBJ, 0, 0x15200, 0x68 }, // sheets
524
525 { IMG_ROOM_OBJ, 1, 0x15300, 0x24 }, // open window
526
527 { IMG_INV_OBJ, 3, 0x15400, 0x72 }, // pillow
528 { IMG_INV_OBJ, 4, 0x15500, 0x4c }, // Coat-of-Arms
529 { IMG_ROOM_OBJ, 6, 0x15600, 0x16e }, // Sheet going into window
530 { IMG_ROOM_OBJ, 7, 0x15800, 0x15a }, // End of sheet tied to flAgpole
531 { IMG_INV_OBJ, 8, 0x15a00, 0x3e }, // 1 nodoz tablet
532 { IMG_INV_OBJ, 9, 0x15b00, 0x74 }, // LIT torch
533 { IMG_ROOM_OBJ, 13, 0x15c00, 0x160 }, // Open door
534 { IMG_INV_OBJ, 15, 0x15e00, 0x54 }, // Paper clip
535 { IMG_INV_OBJ, 16, 0x15f00, 0x4c }, // Tent STAKE
536 { IMG_INV_OBJ, 17, 0x16000, 0x3e }, // Mirror
537 { IMG_INV_OBJ, 18, 0x16100, 0x3c }, // Bottle of type V blood
538 { IMG_INV_OBJ, 19, 0x16200, 0x3a }, // Empty bottle
539 { IMG_INV_OBJ, 20, 0x16300, 0x40 }, // Unlit torch
540 { IMG_INV_OBJ, 21, 0x16400, 0x72 }, // Sulfur mAtches
541 { IMG_INV_OBJ, 22, 0x16500, 0x50 }, // 2 small holes in my neck
542 { IMG_INV_OBJ, 23, 0x16600, 0x86 }, // 3 no-doz tablets
543 { IMG_INV_OBJ, 24, 0x16700, 0x70 }, // 2 nodoz tablets
544 { IMG_INV_OBJ, 26, 0x16800, 0x4e }, // Pack of Transylvanian cigarettes
545 { IMG_INV_OBJ, 27, 0x16900, 0x5c }, // LIT cigArette
546 { IMG_ROOM_OBJ, 29, 0x16a00, 0x2b6 }, // Coffin is open
547 { IMG_ROOM_OBJ, 30, 0x16d00, 0x1ea }, // Coffin is closed
548 { IMG_INV_OBJ, 31, 0x16f00, 0x2e }, // Dusty clove of garlic
549 { IMG_INV_OBJ, 33, 0x17000, 0x1e }, // Cigarette
550 { IMG_INV_OBJ, 35, 0x17100, 0xec }, // The other end of the sheet
551 { IMG_ROOM_OBJ, 36, 0x17200, 0x124 }, // Sheet tied to bed
552 { IMG_INV_OBJ, 37, 0x17400, 0x58 }, // Pocket watch
553 { IMG_ROOM_OBJ, 40, 0x17500, 0x20 }, // Broken slide lock
554 { IMG_INV_OBJ, 41, 0x17600, 0x68 }, // Large tempered nail file
555 { IMG_INV_OBJ, 42, 0x17700, 0x18 }, // Small Vial
556 { IMG_INV_OBJ, 45, 0x17800, 0x54 }, // Package
557 { IMG_INV_OBJ, 46, 0x17900, 0x4a }, // Empty box
558 { IMG_INV_OBJ, 47, 0x17a00, 0x78 }, // Postcard
559 { IMG_INV_OBJ, 51, 0x17b00, 0x60 }, // Note
560 { IMG_ROOM_OBJ, 52, 0x17c00, 0x40a }, // DRACULA
561 { IMG_INV_OBJ, 53, 0x18100, 0x68 }, // Rubber mallet
562 { IMG_ROOM_OBJ, 55, 0x18200, 0x136 }, // Sheet tied to ring going into pit
563 { IMG_ROOM_OBJ, 56, 0x18400, 0x28c }, // DARK foreboding passage
564 { IMG_INV_OBJ, 58, 0x18700, 0x78 }, // Full size portrait of DRACULA
565 { IMG_INV_OBJ, 61, 0x18800, 0x84 }, // Daisies
566 { IMG_ROOM_OBJ, 63, 0x18900, 0xf4 }, // Dumb-waiter
567 { IMG_INV_OBJ, 65, 0x18a00, 0x6e }, // Letter
568 { IMG_ROOM_OBJ, 67, 0x18b00, 0x54e }, // Mouldy old skeleton with a stake in the rib cage
569 { IMG_INV_OBJ, 70, 0x19100, 0x68 }, // Century worth of dust
570 { IMG_ROOM_OBJ, 80, 0x19200, 0x1a8 }, // Mirror in room
571 { IMG_ROOM_OBJ, 81, 0x19500, 0x150 }, // other end of sheet
572 { IMG_ROOM_OBJ, 82, 0x19700, 0x206 }, // Coat-of-Arms (4) on wall
573
574 { 0, 0, 0, 0 }
575 };
576
577 static const imglist a2listVoodoo[] = {
578 { IMG_ROOM, 0, 0x01000, 0x0836 }, // .
579 { IMG_ROOM, 1, 0x01900, 0x0a58 }, // chapel
580 { IMG_ROOM, 2, 0x02400, 0x0566 }, // Dingy Looking Stairwell
581 { IMG_ROOM, 3, 0x02a00, 0x0b08 }, // room in the castle
582 { IMG_ROOM, 4, 0x03600, 0x0e14 }, // Tunnel
583 { IMG_ROOM, 5, 0x04500, 0x07b4 }, // room in the castle
584 { IMG_ROOM, 6, 0x04d00, 0x06bc }, // *I'm in Medium Maegen's Mad Room
585 { IMG_ROOM, 7, 0x05400, 0x09e0 }, // room in the castle
586 { IMG_ROOM, 8, 0x05e00, 0x0456 }, // room in the castle
587 { IMG_ROOM, 9, 0x06300, 0x098e }, // room in the castle
588 { IMG_ROOM, 10, 0x06d00, 0x0784 }, // Ballroom
589 { IMG_ROOM, 11, 0x07500, 0x06ca }, // dungeon
590 { IMG_ROOM, 12, 0x07c00, 0x0dea }, // *I'm in the Armory
591 { IMG_ROOM, 13, 0x08a00, 0x085c }, // torture chamber
592 { IMG_ROOM, 14, 0x09300, 0x0e24 }, // Chimney
593 { IMG_ROOM, 15, 0x0a200, 0x0e52 }, // large fireplace
594 { IMG_ROOM, 16, 0x0b100, 0x0bb4 }, // room in the castle
595 { IMG_ROOM, 17, 0x0bd00, 0x0bc4 }, // Lab
596 { IMG_ROOM, 18, 0x0c900, 0x0afe }, // narrow part of the chimney
597 { IMG_ROOM, 19, 0x0d400, 0x0fcc }, // Graveyard
598 { IMG_ROOM, 20, 0x0e400, 0x0720 }, // parlor
599 { IMG_ROOM, 21, 0x0ec00, 0x0cf8 }, // Jail Cell
600 { IMG_ROOM, 22, 0x0f900, 0x060c }, // *I'm on a ledge
601 { IMG_ROOM, 23, 0x10000, 0x0eac }, // hidden VOODOO room
602 { IMG_ROOM, 24, 0x10f00, 0x061c }, // room in the castle
603 { IMG_ROOM, 25, 0x11600, 0x0b66 }, // lot of TROUBLE!
604
605 { IMG_ROOM, 90, 0x15400, 0x57c }, // Closeup broken sword
606 { IMG_ROOM, 91, 0x12200, 0x4dc }, // Closeup voodoo doll
607 { IMG_ROOM, 92, 0x12700, 0x788 }, // Closeup voodoo book
608 { IMG_ROOM, 93, 0x12f00, 0x528 }, // Closeup ring
609 { IMG_ROOM, 94, 0x13500, 0x5f2 }, // Closeup ju-ju statue
610 { IMG_ROOM, 95, 0x13b00, 0xbbc }, // Closeup glowing idol
611 { IMG_ROOM, 96, 0x14700, 0x7c2 }, // Closeup chemicals
612 { IMG_ROOM, 97, 0x14f00, 0x498 }, // Closeup bloody knife
613 { IMG_ROOM, 101, 0x15a00, 0xd8e }, // Closeup Count Cristo
614
615 { IMG_ROOM, 99, 0x16800, 0xdfe }, // Title
616
617 { IMG_INV_OBJ, 0, 0x17600, 0x46 }, // Bloody Knife
618 { IMG_INV_OBJ, 2, 0x17700, 0x48 }, // Plaque
619 { IMG_INV_OBJ, 3, 0x17800, 0xa2 }, // Animal heads
620 { IMG_INV_OBJ, 4, 0x17900, 0x4a }, // Broken glass
621 { IMG_ROOM_OBJ, 6, 0x17a00, 0x192 }, // Dark hole
622 { IMG_INV_OBJ, 7, 0x17c00, 0xec }, // Shield
623 { IMG_INV_OBJ, 9, 0x17d00, 0x8a }, // Brightly glowing idol
624 { IMG_ROOM_OBJ, 10, 0x17e00, 0x2c2 }, // Open Window
625 { IMG_ROOM_OBJ, 13, 0x18100, 0x19c }, // Open Flue
626 { IMG_INV_OBJ, 14, 0x18300, 0x84 }, // Four leaf clover
627 { IMG_INV_OBJ, 16, 0x18400, 0x6e }, // Cast iron pot
628 { IMG_ROOM_OBJ, 17, 0x18500, 0x122 }, // Closed Coffin
629 { IMG_INV_OBJ, 21, 0x18700, 0x38 }, // Soot
630 { IMG_ROOM_OBJ, 23, 0x18800, 0x2d4 }, // Spirit Medium
631 { IMG_INV_OBJ, 25, 0x18b00, 0x68 }, // Sapphire ring
632 { IMG_INV_OBJ, 26, 0x18c00, 0xb0 }, // Ju-Ju bag
633 { IMG_ROOM_OBJ, 28, 0x18d00, 0x5cc }, // Slick chute leading downward
634 { IMG_ROOM_OBJ, 31, 0x19300, 0xf8 }, // Wide crack in the wall
635 { IMG_INV_OBJ, 32, 0x19400, 0x82 }, // Rabbit's foot
636 { IMG_INV_OBJ, 33, 0x19500, 0x64 }, // Dull & broken sword
637 { IMG_ROOM_OBJ, 34, 0x19600, 0x12a }, // Open SAfe
638 { IMG_ROOM_OBJ, 35, 0x19800, 0x810 }, // Stuck Chimney Sweep
639 { IMG_INV_OBJ, 36, 0x1a100, 0x44 }, // Chem tubes
640 { IMG_ROOM_OBJ, 37, 0x1a200, 0x168 }, // Closed SAfe
641 { IMG_INV_OBJ, 38, 0x1a400, 0x7a }, // Labeled chemicals
642 { IMG_INV_OBJ, 39, 0x1a500, 0x3c }, // Pocket Shovel
643 { IMG_INV_OBJ, 40, 0x1a600, 0x8a }, // Mixed Chemicals
644 { IMG_ROOM_OBJ, 41, 0x1a700, 0xbc }, // Wide open door
645 { IMG_INV_OBJ, 42, 0x1a800, 0x52 }, // Nails
646 { IMG_INV_OBJ, 43, 0x1a900, 0x80 }, // Dusty Idol
647 { IMG_INV_OBJ, 44, 0x1aa00, 0x8a }, // Doll
648 { IMG_INV_OBJ, 45, 0x1ab00, 0x8c }, // Wooden boards
649 { IMG_INV_OBJ, 47, 0x1ac00, 0x36 }, // Antique hammer
650 { IMG_ROOM_OBJ, 48, 0x1ad00, 0xfe }, // GrAting
651 { IMG_INV_OBJ, 49, 0x1ae00, 0x4a }, // Rusting SAW
652 { IMG_ROOM_OBJ, 50, 0x1af00, 0x1e2 }, // Button in the wall
653 { IMG_INV_OBJ, 51, 0x1b100, 0x54 }, // Paper
654 { IMG_INV_OBJ, 52, 0x1b200, 0x52 }, // Voodoo book
655 { IMG_INV_OBJ, 53, 0x1b300, 0xb0 }, // Ju-Ju man statue
656 { IMG_INV_OBJ, 54, 0x1b400, 0x5c }, // Stick
657 { IMG_INV_OBJ, 59, 0x1b500, 0x3a }, // Broken grating
658 { IMG_INV_OBJ, 60, 0x1b600, 0x38 }, // Advertising leaflet
659 { IMG_INV_OBJ, 63, 0x1b700, 0x62 }, // Pieces of rock
660 { IMG_INV_OBJ, 64, 0x1b800, 0x48 }, // Page torn from a book
661 { IMG_ROOM_OBJ, 65, 0x1b900, 0x36c }, // Smiling Count Cristo
662
663 { 0, 0, 0, 0 }
664 };
665
666 #define kDiskImageSize 143360
667
668 static uint8_t *GetApple2CompanionFile(size_t *size, int *isnib);
669 static int ExtractImagesFromApple2CompanionFile(uint8_t *data, size_t datasize, int isnib);
670
671 GameIDType DetectApple2(uint8_t **sf, size_t *extent)
672 {
673 if (*extent > MAX_LENGTH || *extent < kDiskImageSize)
674 return UNKNOWN_GAME;
675
676 if ((*sf)[0] == 'W' && (*sf)[1] == 'O' && (*sf)[2] == 'Z') {
677 uint8_t *result = woz2nib(*sf, extent);
678 if (result) {
679 free(*sf);
680 *sf = result;
681 InitNibImage(*sf, *extent);
682 }
683 } else {
684 InitDskImage(*sf, *extent);
685 }
686
687 uint8_t *invimg = NULL, *m2 = NULL;
688 size_t invimgsiz;
689 int isnib;
690
691 size_t companionsize;
692 uint8_t *companionfile = GetApple2CompanionFile(&companionsize, &isnib);
693
694 uint8_t *datafile = ReadApple2DOSFile(*sf, extent, &invimg, &invimgsiz, &m2);
695
696 if (!datafile && companionfile != NULL) {
697 FreeDiskImage();
698 if (isnib)
699 InitNibImage(companionfile, companionsize);
700 else
701 InitDskImage(companionfile, companionsize);
702 datafile = ReadApple2DOSFile(companionfile, &companionsize, &invimg, &invimgsiz, &m2);
703 if (datafile) {
704 uint8_t *temp = companionfile;
705 size_t tempsize = companionsize;
706 companionfile = *sf;
707 companionsize = *extent;
708 *sf = temp;
709 *extent = tempsize;
710 }
711 }
712
713 FreeDiskImage();
714
715 if (invimg) {
716 if (!USImages)
717 USImages = new_image();
718 USImages->index = 98;
719 USImages->systype = SYS_APPLE2;
720 USImages->datasize = invimgsiz;
721 USImages->imagedata = invimg;
722 USImages->usage = IMG_ROOM;
723 }
724
725 if (m2) {
726 descrambletable = m2;
727 }
728
729 uint8_t *database = NULL;
730 size_t newlength = 0;
731
732 if (datafile) {
733 size_t data_start = 0x135;
734
735 // Header actually starts at offset 0x016d (0x135 + 0x38).
736 // We add 50 bytes before the head to match the C64 files.
737
738 if (*extent > MAX_LENGTH || *extent < data_start)
739 return 0;
740
741 newlength = *extent - data_start;
742 database = MemAlloc(newlength);
743 memcpy(database, datafile + data_start, newlength);
744 } else {
745 debug_print("Failed loading database\n");
746 return UNKNOWN_GAME;
747 }
748
749 if (database) {
750 GameIDType result = LoadBinaryDatabase(database, newlength, *Game, 0);
751 if (result == UNKNOWN_GAME && newlength > 0x3d00) {
752 result = LoadBinaryDatabase(database + 0x3d00, newlength - 0x3d00, *Game, 0);
753 }
754
755 if (result == UNKNOWN_GAME && newlength > 0x3803) {
756 result = LoadBinaryDatabase(database + 0x3803, newlength - 0x3803, *Game, 0);
757 }
758
759 if (result != UNKNOWN_GAME) {
760 CurrentSys = SYS_APPLE2;
761
762 ImageWidth = 280;
763 ImageHeight = 160;
764
765 if (CurrentGame == CLAYMORGUE_US_126) {
766 if (!USImages)
767 USImages = new_image();
768 USImages->index = 98;
769 USImages->systype = SYS_APPLE2;
770 USImages->datasize = 0x4f8;
771 USImages->imagedata = MemAlloc(USImages->datasize);
772 memcpy(USImages->imagedata, datafile + 0x7e84, USImages->datasize);
773 USImages->usage = IMG_ROOM;
774 }
775 if (companionfile != NULL) {
776 ExtractImagesFromApple2CompanionFile(companionfile, companionsize, isnib);
777 free(companionfile);
778 } else if (USImages != NULL) {
779 free(USImages->imagedata);
780 free(USImages);
781 USImages = NULL;
782 }
783 } else
784 debug_print("Failed loading database\n");
785 free(datafile);
786 free(database);
787 return result;
788 } else {
789 free(datafile);
790 debug_print("Failed loading database\n");
791 return UNKNOWN_GAME;
792 }
793 }
794
795 static int StripParens(char sideA[], size_t length)
796 {
797 int left_paren = 0;
798 int right_paren = 0;
799 size_t ppos = length - 1;
800 while (sideA[ppos] != '.' && ppos > 0)
801 ppos--;
802 size_t extlen = length - ppos;
803 if (length > 4) {
804 for (int i = (int)ppos; i > 0; i--) {
805 char c = sideA[i];
806 if (c == ')') {
807 if (right_paren == 0) {
808 right_paren = i;
809 } else {
810 return 0;
811 }
812 } else if (c == '(') {
813 if (right_paren > 0) {
814 if (i > 0 && sideA[i - 1] == ' ')
815 i--;
816 left_paren = i;
817 break;
818 } else {
819 return 0;
820 }
821 }
822 }
823 if (right_paren && left_paren && length > right_paren + extlen) {
824 right_paren++;
825 for (int i = 0; i < extlen; i++) {
826 sideA[left_paren++] = sideA[right_paren++];
827 }
828 sideA[left_paren] = '\0';
829 return 1;
830 }
831 }
832 return 0;
833 }
834
835 uint8_t *ReadA2DiskImageFile(const char *filename, size_t *filesize, int *isnib)
836 {
837 uint8_t *result = ReadFileIfExists(filename, filesize);
838 if (result && *filesize > 4 && result[0] == 'W' && result[1] == 'O' && result[2] == 'Z') {
839 uint8_t *result2 = woz2nib(result, filesize);
840 if (result2) {
841 free(result);
842 result = result2;
843 *isnib = 1;
844 }
845 }
846 return result;
847 }
848
849 uint8_t *LookForA2CompanionFilename(int index, CompanionNameType type, size_t stringlen, size_t *filesize, int *isnib)
850 {
851
852 char *sideB = MemAlloc(stringlen + 9);
853 uint8_t *result = NULL;
854
855 *isnib = 0;
856 memcpy(sideB, game_file, stringlen + 1);
857 switch (type) {
858 case TYPE_A:
859 sideB[index] = 'A';
860 break;
861 case TYPE_B:
862 sideB[index] = 'B';
863 break;
864 case TYPE_1:
865 sideB[index] = '1';
866 break;
867 case TYPE_2:
868 sideB[index] = '2';
869 break;
870 case TYPE_ONE:
871 sideB[index] = 'o';
872 sideB[index + 1] = 'n';
873 sideB[index + 2] = 'e';
874 break;
875 case TYPE_TWO:
876 sideB[index] = 't';
877 sideB[index + 1] = 'w';
878 sideB[index + 2] = 'o';
879 break;
880 case TYPE_NONE:
881 break;
882 }
883
884 debug_print("looking for companion file \"%s\"\n", sideB);
885 result = ReadA2DiskImageFile(sideB, filesize, isnib);
886 if (!result) {
887 if (type == TYPE_A) {
888 if (StripParens(sideB, stringlen)) {
889 debug_print("looking for companion file \"%s\"\n", sideB);
890 result = ReadA2DiskImageFile(sideB, filesize, isnib);
891 }
892 } else if (type == TYPE_B) {
893
894 // First we look for the period before the file extension
895 size_t ppos = stringlen - 1;
896 while (sideB[ppos] != '.' && ppos > 0)
897 ppos--;
898 if (ppos < 1) {
899 free(sideB);
900 return NULL;
901 }
902 // Then we copy the extension to the new end position
903 for (size_t i = ppos; i <= stringlen; i++) {
904 sideB[i + 7] = sideB[i];
905 }
906 sideB[ppos++] = ' ';
907 sideB[ppos++] = '(';
908 sideB[ppos++] = 'b';
909 sideB[ppos++] = 'o';
910 sideB[ppos++] = 'o';
911 sideB[ppos++] = 't';
912 sideB[ppos] = ')';
913 debug_print("looking for companion file \"%s\".\n", sideB);
914 result = ReadA2DiskImageFile(sideB, filesize, isnib);
915 }
916 }
917 free(sideB);
918 return result;
919 }
920
921 uint8_t *GetApple2CompanionFile(size_t *size, int *isnib)
922 {
923
924 *size = 0;
925 *isnib = 0;
926
927 size_t gamefilelen = strlen(game_file);
928 uint8_t *result = NULL;
929
930 char *foundname = LookInDatabase(a2companionlist, gamefilelen);
931 if (foundname) {
932 size_t filesize;
933 result = ReadA2DiskImageFile(foundname, &filesize, isnib);
934 free((void *)foundname);
935 if (result)
936 return result;
937 }
938
939 char c;
940 for (int i = (int)gamefilelen - 1; i >= 0 && game_file[i] != '/' && game_file[i] != '\\'; i--) {
941 c = tolower(game_file[i]);
942 if (i > 3 && ((c == 'e' && game_file[i - 1] == 'd' && game_file[i - 2] == 'i' && tolower(game_file[i - 3]) == 's') || (c == 'k' && game_file[i - 1] == 's' && game_file[i - 2] == 'i' && tolower(game_file[i - 3]) == 'd'))) {
943 if (gamefilelen > i + 2) {
944 c = game_file[i + 1];
945 if (c == ' ' || c == '_') {
946 c = tolower(game_file[i + 2]);
947 CompanionNameType type = TYPE_NONE;
948 switch (c) {
949 case 'a':
950 type = TYPE_B;
951 break;
952 case 'b':
953 type = TYPE_A;
954 break;
955 case 't':
956 if (gamefilelen > i + 4 && game_file[i + 3] == 'w' && game_file[i + 4] == 'o') {
957 type = TYPE_ONE;
958 }
959 break;
960 case 'o':
961 if (gamefilelen > i + 4 && game_file[i + 3] == 'n' && game_file[i + 4] == 'e') {
962 type = TYPE_TWO;
963 }
964 break;
965 case '2':
966 type = TYPE_1;
967 break;
968 case '1':
969 type = TYPE_2;
970 break;
971 }
972 if (type != TYPE_NONE)
973 result = LookForA2CompanionFilename(i + 2, type, gamefilelen, size, isnib);
974 if (result)
975 return result;
976 }
977 }
978 }
979 }
980 return NULL;
981 }
982
983 static int ExtractImagesFromApple2CompanionFile(uint8_t *data, size_t datasize, int isnib)
984 {
985 int outpic;
986
987 const struct imglist *list;
988
989 switch (CurrentGame) {
990 case CLAYMORGUE_US:
991 list = a2listClaymorgue;
992 break;
993 case CLAYMORGUE_US_126:
994 list = a2listClaymorgue126;
995 break;
996 case HULK_US:
997 list = a2listHulk;
998 break;
999 case HULK_US_PREL:
1000 list = a2listHulk126;
1001 break;
1002 case COUNT_US:
1003 list = a2listCount;
1004 break;
1005 case VOODOO_CASTLE_US:
1006 list = a2listVoodoo;
1007 break;
1008 default:
1009 return 0;
1010 }
1011
1012 struct USImage *image = new_image();
1013 if (!USImages) {
1014 USImages = image;
1015 } else {
1016 USImages->next = image;
1017 }
1018
1019 if (isnib) {
1020 InitNibImage(data, datasize);
1021 }
1022 // Now loop round for each image
1023 for (outpic = 0; list[outpic].offset != 0; outpic++) {
1024 size_t size = list[outpic].size + 4;
1025
1026 image->usage = list[outpic].usage;
1027 image->index = list[outpic].index;
1028
1029 // debug_print("Reading image %d with size %zu and index %d\n", outpic, size, image->index);
1030
1031 image->datasize = size;
1032 image->systype = SYS_APPLE2;
1033
1034 if (isnib) {
1035 image->imagedata = ReadImageFromNib(list[outpic].offset, size, data, datasize);
1036 } else {
1037 image->imagedata = MemAlloc(size);
1038 memcpy(image->imagedata, data + list[outpic].offset, size);
1039 }
1040
1041 image->next = new_image();
1042 image->next->previous = image;
1043 image = image->next;
1044 }
1045
1046 FreeDiskImage();
1047
1048 if (USImages->next == NULL && USImages->imagedata == NULL) {
1049 free(USImages);
1050 USImages = NULL;
1051 }
1052
1053 if (CurrentGame == HULK_US_PREL)
1054 CurrentGame = HULK_US;
1055 else if (CurrentGame == CLAYMORGUE_US_126)
1056 CurrentGame = CLAYMORGUE_US;
1057 return 1;
1058 }