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 #include "access/amazon/amazon_resources.h"
24 #include "access/access.h"
25 
26 namespace Access {
27 
28 namespace Amazon {
29 
~AmazonResources()30 AmazonResources::~AmazonResources() {
31 	delete _font3x5;
32 	delete _font6x6;
33 }
34 
load(Common::SeekableReadStream & s)35 void AmazonResources::load(Common::SeekableReadStream &s) {
36 	Resources::load(s);
37 	uint count;
38 
39 	// Load the version specific data
40 	NO_HELP_MESSAGE = readString(s);
41 	NO_HINTS_MESSAGE = readString(s);
42 	RIVER_HIT1 = readString(s);
43 	RIVER_HIT2 = readString(s);
44 	BAR_MESSAGE = readString(s);
45 
46 	for (int idx = 0; idx < 3; ++idx)
47 		HELPLVLTXT[idx] = readString(s);
48 	for (int idx = 0; idx < 9; ++idx)
49 		IQLABELS[idx] = readString(s);
50 
51 	CANT_GET_THERE = readString(s);
52 
53 	// Get the offset of the general shared data for the game
54 	uint entryOffset = findEntry(_vm->getGameID(), 2, 0, (Common::Language)0);
55 	s.seek(entryOffset);
56 
57 	// Read in the cursor list
58 	count = s.readUint16LE();
59 	CURSORS.resize(count);
60 	for (uint idx = 0; idx < count; ++idx) {
61 		uint count2 = s.readUint16LE();
62 		CURSORS[idx].resize(count2);
63 		s.read(&CURSORS[idx][0], count2);
64 	}
65 
66 	// Load font data
67 	count = s.readUint16LE();
68 	Common::Array<int> index;
69 	Common::Array<byte> data;
70 
71 	index.resize(count);
72 	for (uint idx = 0; idx < count; ++idx)
73 		index[idx] = s.readSint16LE();
74 
75 	count = s.readUint16LE();
76 	data.resize(count);
77 	for (uint idx = 0; idx < count; ++idx)
78 		data[idx] = s.readByte();
79 	_font3x5 = new AmazonFont(&index[0], &data[0]);
80 
81 	count = s.readUint16LE();
82 	index.resize(count);
83 	for (uint idx = 0; idx < count; ++idx)
84 		index[idx] = s.readSint16LE();
85 
86 	count = s.readUint16LE();
87 	data.resize(count);
88 	for (uint idx = 0; idx < count; ++idx)
89 		data[idx] = s.readByte();
90 	_font6x6 = new AmazonFont(&index[0], &data[0]);
91 }
92 
93 /*------------------------------------------------------------------------*/
94 
95 const int SIDEOFFR[] = { 5, 5, 5, 5, 5, 5, 5, 5, 0 };
96 const int SIDEOFFL[] = { 5, 5, 5, 5, 5, 5, 5, 5, 0 };
97 const int SIDEOFFU[] = { 2, 2, 2, 2, 2, 2, 2, 2, 0 };
98 const int SIDEOFFD[] = { 2, 2, 2, 2, 2, 2, 2, 2, 0 };
99 const int DIAGOFFURX[] = { 4, 5, 2, 2, 3, 4, 2, 2, 0 };
100 const int DIAGOFFURY[] = { 2, 3, 2, 2, 2, 3, 1, 1, 0 };
101 const int DIAGOFFDRX[] = { 4, 5, 4, 3, 5, 4, 5, 1, 0 };
102 const int DIAGOFFDRY[] = { 3, 2, 1, 2, 2, 1, 2, 1, 0 };
103 const int DIAGOFFULX[] = { 4, 5, 4, 3, 3, 2, 2, 2, 0 };
104 const int DIAGOFFULY[] = { 3, 3, 1, 2, 2, 1, 1, 1, 0 };
105 const int DIAGOFFDLX[] = { 4, 5, 3, 3, 5, 4, 6, 1, 0 };
106 const int DIAGOFFDLY[] = { 2, 2, 1, 2, 3, 1, 2, 1, 0 };
107 
108 const int OVEROFFR[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
109 const int OVEROFFL[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
110 const int OVEROFFU[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
111 const int OVEROFFD[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
112 const int OVEROFFURX[] = { 3, 1, 1, 2, 2, 1, 0, 0, 0 };
113 const int OVEROFFURY[] = { 1, 0, 0, 1, 1, 0, 0, 0, 0 };
114 const int OVEROFFDRX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
115 const int OVEROFFDRY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
116 const int OVEROFFULX[] = { 2, 1, 1, 1, 2, 1, 0, 0, 0 };
117 const int OVEROFFULY[] = { 1, 0, 0, 2, 1, 0, 0, 0, 0 };
118 const int OVEROFFDLX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
119 const int OVEROFFDLY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
120 
121 const int DEATH_CELLS[13][3] = {
122 	{ 0, 94, 2 },
123 	{ 0, 94, 3 },
124 	{ 0, 94, 4 },
125 	{ 0, 94, 5 },
126 	{ 0, 94, 6 },
127 	{ 0, 94, 7 },
128 	{ 0, 94, 8 },
129 	{ 0, 94, 9 },
130 	{ 0, 94, 10 },
131 	{ 0, 94, 11 },
132 	{ 0, 94, 12 },
133 	{ 0, 94, 13 },
134 	{ 0, 94, 14 }
135 };
136 
137 const int CHAPTER_CELLS[17][3] = {
138 	{ 1, 96, 18 },
139 	{ 2, 96, 19 },
140 	{ 3, 96, 20 },
141 	{ 4, 96, 21 },
142 	{ 5, 96, 22 },
143 	{ 6, 96, 23 },
144 	{ 7, 96, 24 },
145 	{ 8, 96, 25 },
146 	{ 9, 96, 26 },
147 	{ 10, 96, 27 },
148 	{ 11, 96, 28 },
149 	{ 12, 96, 29 },
150 	{ 13, 96, 30 },
151 	{ 14, 96, 31 }
152 };
153 
154 const int CHAPTER_TABLE[14][5] = {
155 	{ 18, 136, 27, 76, 49 },
156 	{ 16, 134, 27, 53, 74 },
157 	{ 16, 136, 27, 52, 56 },
158 	{ 16, 135, 26, 46, 75 },
159 	{ 16, 135, 27, 54, 66 },
160 	{ 16, 137, 27, 67, 79 },
161 	{ 14, 136, 27, 82, 52 },
162 	{ 15, 136, 26, 65, 73 },
163 	{ 15, 137, 26, 48, 75 },
164 	{ 17, 135, 27, 52, 66 },
165 	{ 15, 135, 27, 62, 65 },
166 	{ 16, 135, 28, 45, 66 },
167 	{ 16, 135, 28, 36, 67 },
168 	{ 15, 135, 27, 34, 63 }
169 };
170 
171 const int CHAPTER_JUMP[14] = {
172 	0, 12, 10, 15, 19, 25, 31, 36, 45, 46, 29, 55, 61, 0
173 };
174 
175 const int ANTWALK[24] = {
176 	 0,  3,  0,
177 	 1,  5,  0,
178 	 2,  4,  0,
179 	 3,  2,  0,
180 	 4,  4,  0,
181 	 5,  3,  0,
182 	 6,  4,  0,
183 	-1, -1, -1
184 };
185 
186 const int ANTEAT[33] = {
187 	 7,  0,  -1,
188 	 8,  0,  -5,
189 	 9,  0, -11,
190 	10,  0,   7,
191 	11,  0,  -3,
192 	12,  0,   3,
193 	13,  0,  -1,
194 	 9,  0,  -6,
195 	 8,  0,  11,
196 	 7,  0,   6,
197 	-1, -1,  -1
198 };
199 
200 const int ANTDIE[21] = {
201 	14,  4,  8,
202 	15,  7,  6,
203 	16,  6,  7,
204 	17,  8,  2,
205 	18,  0,  0,
206 	19,  0,  0,
207 	-1, -1, -1
208 };
209 
210 const int PITWALK[27] = {
211 	18,  0, -1,
212 	19, -2,  1,
213 	20, -2,  1,
214 	21, -2,  1,
215 	22, -2,  0,
216 	23, -3,  0,
217 	24, -3, -1,
218 	25, -2, -1,
219 	-1, -1, -1
220 };
221 
222 const int PITSTAB[21] = {
223 	14, -2,   0,
224 	15, -4,   0,
225 	16,  3, -13,
226 	16,  0,   0,
227 	15, -3,  13,
228 	14,  4,   0,
229 	-1, -1,  -1
230 };
231 
232 const int TORCH[12] = {
233 	26, -11, -7,
234 	27, -12, -2,
235 	28, -15, -4,
236 	-1,  -1, -1
237 };
238 
239 const int SPEAR[3] = {30, -13, 1};
240 
241 const int OPENING_OBJS[10][4] = {
242 	{8, -80, 120, 30},
243 	{13, 229, 0, 50},
244 	{12, 78, 0, 50},
245 	{11, 10, 0, 50},
246 	{10, 178, 97, 50},
247 	{9, 92, 192, 50},
248 	{14, 38, 0, 100},
249 	{15, 132, 76, 100},
250 	{16, 142, 0, 100},
251 	{4, -280, 40, 120},
252 };
253 
254 const byte MAP0[26] = {
255 	0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 4, 0,
256 	0, 0, 1, 0, 2, 0, 0, 1, 1, 3, 0, 0,
257 	0, 0xFF
258 };
259 
260 const byte MAP1[27] = {
261 	0, 0, 1, 0, 3, 0, 0, 1, 1, 2, 0, 0,
262 	0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 4, 0,
263 	0, 0, 0xFF
264 };
265 
266 const byte MAP2[32] = {
267 	0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 1, 0,
268 	3, 0, 0, 1, 0, 4, 0, 0, 1, 1, 2, 0,
269 	0, 1, 0, 1, 0, 0, 0, 0xFF
270 };
271 
272 const byte *const MAPTBL[3] = {MAP0, MAP1, MAP2};
273 
274 const int DOWNRIVEROBJ[14][4] = {
275 	{ 3, 77, 0, 40 },
276 	{ 2, 30, 0, 30 },
277 	{ 2, 290, 0, 50 },
278 	{ 1, 210, 0, 70 },
279 	{ 2, 350, 0, 30 },
280 	{ 1, 370, 0, 20 },
281 	{ 2, 480, 0, 60 },
282 	{ 3, 395, 0, 10 },
283 	{ 1, 550, 0, 30 },
284 	{ 2, 620, 0, 50 },
285 	{ 1, 690, 0, 10 },
286 	{ 2, 715, 0, 40 },
287 	{ 1, 770, 0, 30 },
288 	{ 3, 700, 0, 20 }
289 };
290 
291 RiverStruct RIVER0OBJECTS[46] = {
292 	{16,  31, 6400, 0, 4, 12},
293 	{16,  31, 6200, 0, 2, 12},
294 	{17,  30, 6100, 0, 3, 15},
295 	{16,  31, 5970, 0, 7, 12},
296 	{17,  30, 5910, 0, 5, 15},
297 	{17,  30, 5730, 0, 3, 15},
298 	{16,  31, 5700, 0, 7, 12},
299 	{-1, 314, 5392, 0, 4,  0},
300 	{17,  30, 5155, 0, 1, 15},
301 	{16,  31, 5150, 0, 5, 12},
302 	{16,  31, 5056, 0, 7, 12},
303 	{17,  30, 4900, 0, 2, 15},
304 	{17,  30, 4785, 0, 7, 15},
305 	{16,  31, 4690, 0, 4, 12},
306 	{16,  31, 4660, 0, 1, 12},
307 	{17,  30, 4560, 0, 5, 15},
308 	{16,  31, 4465, 0, 2, 12},
309 	{-1, 314, 4112, 0, 4,  0},
310 	{17,  30, 4005, 0, 3, 15},
311 	{16,  31, 3865, 0, 6, 12},
312 	{17,  30, 3605, 0, 4, 15},
313 	{16,  31, 3360, 0, 1, 12},
314 	{17,  30, 3105, 0, 0, 15},
315 	{16,  31, 3080, 0, 7, 12},
316 	{17,  30, 3014, 0, 4, 15},
317 	{16,  31, 2992, 0, 3, 12},
318 	{16,  31, 2976, 0, 2, 12},
319 	{17,  30, 2880, 0, 7, 15},
320 	{17,  30, 2860, 0, 0, 15},
321 	{-1, 314, 2512, 0, 4,  0},
322 	{17,  30, 2270, 0, 4, 15},
323 	{16,  31, 2195, 0, 6, 12},
324 	{17,  30, 1824, 0, 1, 15},
325 	{16,  31, 1776, 0, 4, 12},
326 	{17,  30, 1650, 0, 3, 15},
327 	{16,  31, 1616, 0, 7, 12},
328 	{17,  30, 1585, 0, 2, 15},
329 	{-1, 314, 1232, 0, 4,  0},
330 	{17,  30, 1190, 0, 2, 15},
331 	{16,  31, 1120, 0, 4, 12},
332 	{17,  30,  970, 0, 7, 15},
333 	{16,  31,  910, 0, 5, 12},
334 	{17,  30,  705, 0, 0, 15},
335 	{16,  31,  550, 0, 4, 12},
336 	{17,  30,  305, 0, 2, 15},
337 	{16,  31,  260, 0, 7, 12}
338 };
339 
340 RiverStruct RIVER1OBJECTS[50] = {
341 	{16,  31, 6920, 0, 1, 12},
342 	{16,  31, 6740, 0, 4, 12},
343 	{17,  30, 6699, 0, 1, 15},
344 	{16,  31, 6610, 0, 2, 12},
345 	{17,  30, 6495, 0, 6, 15},
346 	{17,  30, 6385, 0, 4, 15},
347 	{16,  31, 6350, 0, 1, 12},
348 	{17,  30, 6180, 0, 0, 15},
349 	{-1, 314, 6032, 0, 4,  0},
350 	{16,  31, 5800, 0, 3, 12},
351 	{17,  30, 5790, 0, 6, 15},
352 	{16,  31, 5530, 0, 4, 12},
353 	{16,  31, 5500, 0, 7, 12},
354 	{17,  30, 5495, 0, 1, 15},
355 	{17,  30, 5376, 0, 0, 15},
356 	{16,  31, 5328, 0, 7, 12},
357 	{17,  30, 5248, 0, 2, 15},
358 	{16,  31, 5248, 0, 6, 12},
359 	{-1, 314, 4752, 0, 4,  0},
360 	{17,  30, 4432, 0, 2, 15},
361 	{16,  31, 4432, 0, 7, 12},
362 	{16,  31, 4384, 0, 2, 12},
363 	{17,  30, 4368, 0, 5, 15},
364 	{16,  31, 4336, 0, 4, 12},
365 	{17,  30, 4185, 0, 1, 15},
366 	{16,  31, 4125, 0, 3, 12},
367 	{17,  30, 3817, 0, 7, 15},
368 	{16,  31, 3612, 0, 4, 12},
369 	{16,  31, 3360, 0, 5, 12},
370 	{16,  31, 3265, 0, 7, 12},
371 	{17,  30, 3200, 0, 1, 15},
372 	{17,  30, 3056, 0, 6, 15},
373 	{-1, 314, 2832, 0, 4,  0},
374 	{16,  31, 2740, 0, 3, 12},
375 	{17,  30, 2694, 0, 6, 15},
376 	{16,  31, 2455, 0, 0, 12},
377 	{17,  30, 2285, 0, 5, 15},
378 	{16,  31, 2260, 0, 2, 12},
379 	{16,  31, 1904, 0, 5, 12},
380 	{17,  30, 1808, 0, 1, 15},
381 	{16,  31, 1744, 0, 7, 12},
382 	{17,  30, 1696, 0, 4, 15},
383 	{16,  31, 1568, 0, 2, 12},
384 	{-1, 314, 1232, 0, 4,  0},
385 	{17,  30,  970, 0, 4, 15},
386 	{16,  31,  910, 0, 7, 12},
387 	{17,  30,  705, 0, 0, 15},
388 	{16,  31,  550, 0, 6, 12},
389 	{17,  30,  305, 0, 3, 15},
390 	{ 16, 31, 260, 0, 1, 12 }
391 };
392 
393 RiverStruct RIVER2OBJECTS[54] = {
394 	{16,  31, 8230, 0, 6, 12},
395 	{16,  31, 8115, 0, 7, 12},
396 	{17,  30, 7955, 0, 4, 15},
397 	{16,  31, 7890, 0, 0, 12},
398 	{16,  31, 7616, 0, 2, 12},
399 	{17,  30, 7472, 0, 5, 15},
400 	{16,  31, 7425, 0, 4, 12},
401 	{17,  30, 7360, 0, 1, 15},
402 	{16,  31, 7328, 0, 6, 12},
403 	{-1, 314, 6992, 0, 4,  0},
404 	{16,  31, 6720, 0, 3, 12},
405 	{17,  30, 6700, 0, 6, 15},
406 	{16,  31, 6518, 0, 2, 12},
407 	{17,  30, 6225, 0, 5, 15},
408 	{16,  31, 6200, 0, 2, 12},
409 	{17,  30, 5990, 0, 1, 15},
410 	{16,  31, 5960, 0, 7, 12},
411 	{16,  31, 5700, 0, 2, 12},
412 	{17,  30, 5650, 0, 4, 15},
413 	{16,  31, 5568, 0, 5, 12},
414 	{17,  30, 5488, 0, 6, 15},
415 	{-1, 314, 5072, 0, 4,  0},
416 	{17,  30, 4825, 0, 4, 15},
417 	{16,  31, 4782, 0, 2, 12},
418 	{17,  30, 4660, 0, 5, 15},
419 	{16,  31, 4510, 0, 7, 12},
420 	{16,  31, 4495, 0, 1, 12},
421 	{17,  30, 4250, 0, 2, 15},
422 	{16,  31, 4195, 0, 4, 12},
423 	{-1, 314, 3792, 0, 4,  0},
424 	{17,  30, 3600, 0, 3, 15},
425 	{16,  31, 3470, 0, 5, 12},
426 	{16,  31, 3422, 0, 2, 12},
427 	{17,  30, 3170, 0, 6, 15},
428 	{16,  31, 2960, 0, 4, 12},
429 	{17,  30, 2955, 0, 7, 15},
430 	{-1, 314, 2512, 0, 4,  0},
431 	{17,  30, 2415, 0, 1, 15},
432 	{16,  31, 2318, 0, 0, 12},
433 	{17,  30, 2275, 0, 2, 15},
434 	{16,  31, 2270, 0, 6, 12},
435 	{17,  30, 2026, 0, 3, 15},
436 	{16,  31, 2000, 0, 0, 12},
437 	{16,  31, 1840, 0, 3, 12},
438 	{17,  30, 1795, 0, 7, 15},
439 	{16,  31, 1634, 0, 5, 12},
440 	{17,  30, 1630, 0, 1, 15},
441 	{-1, 314, 1232, 0, 4,  0},
442 	{17,  30,  970, 0, 2, 15},
443 	{16,  31,  910, 0, 5, 12},
444 	{17,  30,  705, 0, 0, 15},
445 	{16,  31,  550, 0, 4, 12},
446 	{17,  30,  305, 0, 3, 15},
447 	{16,  31,  260, 0, 6, 12}
448 };
449 
450 RiverStruct *RIVER_OBJECTS[3][2] = {
451 	{ RIVER0OBJECTS, RIVER0OBJECTS + 46 - 1},
452 	{ RIVER1OBJECTS, RIVER1OBJECTS + 50 - 1 },
453 	{ RIVER2OBJECTS, RIVER2OBJECTS + 54 - 1 }
454 };
455 
456 const int HELP1COORDS[2][4] = {
457 	{  76, 129, 168, 183 }, { 187, 240, 168, 183 }
458 };
459 
460 const int RIVER1OBJ[23][4] = {
461 	{ 18, -77, 0, 30 },
462 	{ 18, -325, 0, 20 },
463 	{ 18, -450, 0, 15 },
464 	{ 18, -1250, 0, 25 },
465 	{ 19, -130, 0, 20 },
466 	{ 19, -410, 0, 15 },
467 	{ 19, -710, 0, 25 },
468 	{ 19, -1510, 0, 20 },
469 	{ 20, -350, 0, 30 },
470 	{ 20, -695, 0, 25 },
471 	{ 20, -990, 0, 20 },
472 	{ 20, -1300, 0, 25 },
473 	{ 20, -1600, 0, 30 },
474 	{ 21, -370, 0, 20 },
475 	{ 21, -650, 0, 30 },
476 	{ 21, -1215, 0, 40 },
477 	{ 21, -1815, 0, 35 },
478 	{ 22, -380, 0, 25 },
479 	{ 22, -720, 0, 35 },
480 	{ 22, -1020, 0, 30 },
481 	{ 22, -1170, 0, 25 },
482 	{ 22, -1770, 0, 35 },
483 	{ 23, -500, 63, 20 }
484 };
485 
486 const int CAST_END_OBJ[26][4] = {
487 	{ 0, 118, 210, 10 },
488 	{ 1, 38, 250, 10 },
489 	{ 2, 38, 280, 10 },
490 	{ 3, 38, 310, 10 },
491 	{ 4, 38, 340, 10 },
492 	{ 5, 38, 370, 10 },
493 	{ 6, 38, 400, 10 },
494 	{ 7, 38, 430, 10 },
495 	{ 8, 38, 460, 10 },
496 	{ 9, 38, 490, 10 },
497 	{ 10, 38, 520, 10 },
498 	{ 11, 38, 550, 10 },
499 	{ 12, 38, 580, 10 },
500 	{ 13, 38, 610, 10 },
501 	{ 14, 38, 640, 10 },
502 	{ 15, 38, 670, 10 },
503 	{ 16, 38, 700, 10 },
504 	{ 17, 38, 730, 10 },
505 	{ 18, 38, 760, 10 },
506 	{ 19, 38, 790, 10 },
507 	{ 20, 95, 820, 10 },
508 	{ 21, 94, 850, 10 },
509 	{ 22, 96, 880, 10 },
510 	{ 23, 114, 910, 10 },
511 	{ 24, 114, 940, 10 },
512 	{ 25, 110, 970, 10 }
513 };
514 
515 const int CAST_END_OBJ1[4][4] = {
516 	{ 0, 40, 1100, 10 },
517 	{ 2, 11, 1180, 10 },
518 	{ 1, 154, 1180, 10 },
519 	{ 3, 103, 1300, 10 }
520 };
521 
522 const int RMOUSE[10][2] = {
523 	{ 0, 35 }, { 0, 0 }, { 36, 70 }, { 71, 106 }, { 107, 141 },
524 	{ 142, 177 }, { 178, 212 }, { 213, 248 }, { 249, 283 }, { 284, 318 }
525 };
526 
527 
528 } // End of namespace Amazon
529 } // End of namespace Access
530