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
24 #include "common/config-manager.h"
25 #include "scumm/scumm.h"
26 #include "scumm/scumm_v0.h"
27 #include "scumm/scumm_v8.h"
28 #include "scumm/sound.h"
29 #include "scumm/he/intern_he.h"
30 #include "scumm/he/logic_he.h"
31
32 #include "audio/mididrv.h"
33
34 namespace Scumm {
35
setupScummVars()36 void ScummEngine::setupScummVars() {
37 VAR_KEYPRESS = 0;
38 VAR_EGO = 1;
39 VAR_CAMERA_POS_X = 2;
40 VAR_HAVE_MSG = 3;
41 VAR_ROOM = 4;
42 VAR_OVERRIDE = 5;
43 VAR_MACHINE_SPEED = 6;
44 VAR_ME = 7;
45 VAR_NUM_ACTOR = 8;
46 VAR_CURRENTDRIVE = 10;
47 VAR_TMR_1 = 11;
48 VAR_TMR_2 = 12;
49 VAR_TMR_3 = 13;
50 VAR_MUSIC_TIMER = 14;
51 VAR_ACTOR_RANGE_MIN = 15;
52 VAR_ACTOR_RANGE_MAX = 16;
53 VAR_CAMERA_MIN_X = 17;
54 VAR_CAMERA_MAX_X = 18;
55 VAR_TIMER_NEXT = 19;
56 VAR_VIRT_MOUSE_X = 20;
57 VAR_VIRT_MOUSE_Y = 21;
58 VAR_ROOM_RESOURCE = 22;
59 VAR_LAST_SOUND = 23;
60 VAR_CUTSCENEEXIT_KEY = 24;
61 VAR_TALK_ACTOR = 25;
62 VAR_CAMERA_FAST_X = 26;
63 VAR_ENTRY_SCRIPT = 28;
64 VAR_ENTRY_SCRIPT2 = 29;
65 VAR_EXIT_SCRIPT = 30;
66 VAR_EXIT_SCRIPT2 = 31;
67 VAR_VERB_SCRIPT = 32;
68 VAR_SENTENCE_SCRIPT = 33;
69 VAR_INVENTORY_SCRIPT = 34;
70 VAR_CUTSCENE_START_SCRIPT = 35;
71 VAR_CUTSCENE_END_SCRIPT = 36;
72 VAR_CHARINC = 37;
73 VAR_WALKTO_OBJ = 38;
74 VAR_HEAPSPACE = 40;
75 VAR_RESTART_KEY = 42;
76 VAR_PAUSE_KEY = 43;
77 VAR_MOUSE_X = 44;
78 VAR_MOUSE_Y = 45;
79 VAR_TIMER = 46;
80 VAR_TIMER_TOTAL = 47;
81 VAR_SOUNDCARD = 48;
82 VAR_VIDEOMODE = 49;
83
84 if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine) {
85 VAR_MAINMENU_KEY = 50;
86 }
87
88 if (_game.version >= 4) {
89 VAR_SCROLL_SCRIPT = 27;
90 VAR_DEBUGMODE = 39;
91 VAR_MAINMENU_KEY = 50;
92 VAR_FIXEDDISK = 51;
93 VAR_CURSORSTATE = 52;
94 VAR_USERPUT = 53;
95 }
96
97 if (_game.version >= 5) {
98 VAR_SOUNDRESULT = 56;
99 VAR_TALKSTOP_KEY = 57;
100 VAR_FADE_DELAY = 59;
101 VAR_SOUNDPARAM = 64;
102 VAR_SOUNDPARAM2 = 65;
103 VAR_SOUNDPARAM3 = 66;
104 VAR_INPUTMODE = 67; // 1 is keyboard, 2 is joystick, 3 is mouse
105 VAR_MEMORY_PERFORMANCE = 68;
106 VAR_VIDEO_PERFORMANCE = 69;
107 VAR_ROOM_FLAG = 70;
108 VAR_GAME_LOADED = 71;
109 VAR_NEW_ROOM = 72;
110 }
111 }
112
setupScummVars()113 void ScummEngine_v0::setupScummVars() {
114 VAR_EGO = 0;
115 VAR_CAMERA_POS_X = 2;
116 VAR_HAVE_MSG = 3;
117 VAR_ROOM = 4;
118 VAR_ACTIVE_OBJECT2 = 5;
119 VAR_OVERRIDE = 6;
120 VAR_IS_SOUND_RUNNING = 8;
121 VAR_ACTIVE_VERB = 9;
122 VAR_CHARCOUNT = 10;
123 }
124
setupScummVars()125 void ScummEngine_v2::setupScummVars() {
126 VAR_EGO = 0;
127 VAR_CAMERA_POS_X = 2;
128 VAR_HAVE_MSG = 3;
129 VAR_ROOM = 4;
130 VAR_OVERRIDE = 5;
131 VAR_MACHINE_SPEED = 6;
132 VAR_CHARCOUNT = 7;
133 VAR_ACTIVE_VERB = 8;
134 VAR_ACTIVE_OBJECT1 = 9;
135 VAR_ACTIVE_OBJECT2 = 10;
136 VAR_NUM_ACTOR = 11;
137 VAR_CURRENT_LIGHTS = 12;
138 VAR_CURRENTDRIVE = 13;
139 VAR_MUSIC_TIMER = 17;
140 VAR_VERB_ALLOWED = 18;
141 VAR_ACTOR_RANGE_MIN = 19;
142 VAR_ACTOR_RANGE_MAX = 20;
143 VAR_CURSORSTATE = 21;
144 VAR_CAMERA_MIN_X = 23;
145 VAR_CAMERA_MAX_X = 24;
146 VAR_TIMER_NEXT = 25;
147 VAR_SENTENCE_VERB = 26;
148 VAR_SENTENCE_OBJECT1 = 27;
149 VAR_SENTENCE_OBJECT2 = 28;
150 VAR_SENTENCE_PREPOSITION = 29;
151 VAR_VIRT_MOUSE_X = 30;
152 VAR_VIRT_MOUSE_Y = 31;
153 VAR_CLICK_AREA = 32;
154 VAR_CLICK_VERB = 33;
155 VAR_CLICK_OBJECT = 35;
156 VAR_ROOM_RESOURCE = 36;
157 VAR_LAST_SOUND = 37;
158 VAR_BACKUP_VERB = 38;
159 VAR_KEYPRESS = 39;
160 VAR_CUTSCENEEXIT_KEY = 40;
161 VAR_TALK_ACTOR = 41;
162 }
163
setupScummVars()164 void ScummEngine_v5::setupScummVars() {
165 // Many vars are the same as in V5 & V6 games, so just call the inherited method first
166 ScummEngine::setupScummVars();
167
168 VAR_CURRENT_LIGHTS = 9;
169
170 if (_game.version >= 4) {
171 VAR_V5_TALK_STRING_Y = 54;
172 }
173 if ((_game.id == GID_LOOM && _game.version == 4) || _game.version >= 5) {
174 VAR_NOSUBTITLES = 60;
175 }
176 }
177
setupScummVars()178 void ScummEngine_v6::setupScummVars() {
179 // Many vars are the same as in V5 & V6 games, so just call the inherited method first
180 ScummEngine::setupScummVars();
181
182 VAR_ROOM_WIDTH = 41;
183 VAR_ROOM_HEIGHT = 54;
184
185 if (_game.heversion >= 60) {
186 VAR_NOSUBTITLES = 60;
187 } else {
188 VAR_VOICE_MODE = 60; // 0 is voice, 1 is voice+text, 2 is text only
189 VAR_SAVELOAD_SCRIPT = 61;
190 VAR_SAVELOAD_SCRIPT2 = 62;
191 }
192
193 VAR_LEFTBTN_HOLD = 74;
194 VAR_RIGHTBTN_HOLD = 75;
195
196 VAR_V6_EMSSPACE = 76;
197 VAR_RANDOM_NR = 118;
198
199 VAR_TIMEDATE_YEAR = 119;
200 VAR_TIMEDATE_MONTH = 129;
201 VAR_TIMEDATE_DAY = 128;
202 VAR_TIMEDATE_HOUR = 125;
203 VAR_TIMEDATE_MINUTE = 126;
204
205 // Sam & Max specific
206 if (_game.id == GID_SAMNMAX) {
207 VAR_V6_SOUNDMODE = 9;
208 VAR_CHARSET_MASK = 123;
209 }
210 }
211
setupScummVars()212 void ScummEngine_v70he::setupScummVars() {
213 ScummEngine_v6::setupScummVars();
214
215 VAR_CURRENTDRIVE = 0xFF;
216 VAR_MUSIC_TIMER = 0xFF;
217
218 VAR_NUM_SOUND_CHANNELS = 9;
219 VAR_TALK_CHANNEL = 10;
220 VAR_SOUND_CHANNEL = 14;
221 }
222
223 #ifdef ENABLE_HE
setupScummVars()224 void ScummEngine_v72he::setupScummVars() {
225 VAR_KEYPRESS = 0;
226 VAR_DEBUGMODE = 1;
227 VAR_TIMER_NEXT = 2;
228 VAR_OVERRIDE = 3;
229 VAR_WALKTO_OBJ = 4;
230 VAR_RANDOM_NR = 5;
231
232 VAR_GAME_LOADED = 8;
233 VAR_EGO = 9;
234 VAR_NUM_ACTOR = 10;
235
236 VAR_VIRT_MOUSE_X = 13;
237 VAR_VIRT_MOUSE_Y = 14;
238 VAR_MOUSE_X = 15;
239 VAR_MOUSE_Y = 16;
240 VAR_LEFTBTN_HOLD = 17;
241 VAR_RIGHTBTN_HOLD = 18;
242
243 VAR_CURSORSTATE = 19;
244 VAR_USERPUT = 20;
245 VAR_ROOM = 21;
246 VAR_ROOM_WIDTH = 22;
247 VAR_ROOM_HEIGHT = 23;
248 VAR_CAMERA_POS_X = 24;
249 VAR_CAMERA_MIN_X = 25;
250 VAR_CAMERA_MAX_X = 26;
251 VAR_ROOM_RESOURCE = 27;
252 VAR_SCROLL_SCRIPT = 28;
253 VAR_ENTRY_SCRIPT = 29;
254 VAR_ENTRY_SCRIPT2 = 30;
255 VAR_EXIT_SCRIPT = 31;
256 VAR_EXIT_SCRIPT2 = 32;
257 VAR_VERB_SCRIPT = 33;
258 VAR_SENTENCE_SCRIPT = 34;
259 VAR_INVENTORY_SCRIPT = 35;
260 VAR_CUTSCENE_START_SCRIPT = 36;
261 VAR_CUTSCENE_END_SCRIPT = 37;
262
263 VAR_RESTART_KEY = 42;
264 VAR_PAUSE_KEY = 43;
265 VAR_CUTSCENEEXIT_KEY = 44;
266 VAR_TALKSTOP_KEY = 45;
267 VAR_HAVE_MSG = 46;
268 VAR_SUBTITLES = 47;
269 VAR_CHARINC = 48;
270 VAR_TALK_ACTOR = 49;
271 VAR_LAST_SOUND = 50;
272 VAR_TALK_CHANNEL = 51;
273 VAR_SOUND_CHANNEL = 52;
274
275 VAR_MEMORY_PERFORMANCE = 57;
276 VAR_VIDEO_PERFORMANCE = 58;
277 VAR_NEW_ROOM = 59;
278 VAR_TMR_1 = 60;
279 VAR_TMR_2 = 61;
280 VAR_TMR_3 = 62;
281 VAR_TIMEDATE_HOUR = 63;
282 VAR_TIMEDATE_MINUTE = 64;
283 VAR_TIMEDATE_DAY = 65;
284 VAR_TIMEDATE_MONTH = 66;
285 VAR_TIMEDATE_YEAR = 67;
286
287 VAR_NUM_ROOMS = 68;
288 VAR_NUM_SCRIPTS = 69;
289 VAR_NUM_SOUNDS = 70;
290 VAR_NUM_COSTUMES = 71;
291 VAR_NUM_IMAGES = 72;
292 VAR_NUM_CHARSETS = 73;
293 VAR_NUM_GLOBAL_OBJS = 74;
294 VAR_MOUSE_STATE = 75;
295 VAR_POLYGONS_ONLY = 76;
296
297 if (_game.heversion <= 74) {
298 VAR_SOUND_ENABLED = 54;
299 VAR_NUM_SOUND_CHANNELS = 56;
300 }
301
302 if (_game.heversion >= 74) {
303 VAR_PLATFORM = 78;
304 }
305 }
306
setupScummVars()307 void ScummEngine_v80he::setupScummVars() {
308 ScummEngine_v72he::setupScummVars();
309
310 VAR_PLATFORM_VERSION = 79;
311 VAR_CURRENT_CHARSET = 80;
312 VAR_SOUNDCODE_TMR = 84;
313 VAR_KEY_STATE = 86;
314 VAR_NUM_SOUND_CHANNELS = 88;
315 VAR_COLOR_DEPTH = 89;
316 VAR_REDRAW_ALL_ACTORS = 95;
317 }
318
setupScummVars()319 void ScummEngine_v90he::setupScummVars() {
320 ScummEngine_v80he::setupScummVars();
321
322 VAR_TIMER = 97;
323 VAR_QUIT_SCRIPT = 102;
324 VAR_SCRIPT_CYCLE = 103;
325 VAR_NUM_SCRIPT_CYCLES = 104;
326
327 if (_game.heversion >= 95) {
328 VAR_NUM_SPRITE_GROUPS = 105;
329 VAR_NUM_SPRITES = 106;
330 VAR_U32_VERSION = 107;
331 VAR_U32_ARRAY_UNK = 116;
332 VAR_WIZ_TCOLOR = 117;
333 VAR_RESERVED_SOUND_CHANNELS = 120;
334 }
335 if (_game.heversion >= 98) {
336 VAR_SKIP_RESET_TALK_ACTOR = 125;
337 }
338 if (_game.heversion >= 99) {
339 VAR_MAIN_SCRIPT = 127;
340 VAR_NUM_PALETTES = 130;
341 VAR_NUM_UNK = 131;
342 }
343 }
344
setupScummVars()345 void ScummEngine_v100he::setupScummVars() {
346 ScummEngine_v90he::setupScummVars();
347
348 if (_game.id == GID_MOONBASE) {
349 VAR_U32_USER_VAR_A = 108;
350 VAR_U32_USER_VAR_B = 109;
351 VAR_U32_USER_VAR_C = 110;
352 VAR_U32_USER_VAR_D = 111;
353 VAR_U32_USER_VAR_E = 112;
354 VAR_U32_USER_VAR_F = 113;
355 }
356 }
357 #endif
358
359 #ifdef ENABLE_SCUMM_7_8
setupScummVars()360 void ScummEngine_v7::setupScummVars() {
361 VAR_MOUSE_X = 1;
362 VAR_MOUSE_Y = 2;
363 VAR_VIRT_MOUSE_X = 3;
364 VAR_VIRT_MOUSE_Y = 4;
365 VAR_ROOM_WIDTH = 5;
366 VAR_ROOM_HEIGHT = 6;
367 VAR_CAMERA_POS_X = 7;
368 VAR_CAMERA_POS_Y = 8;
369 VAR_OVERRIDE = 9;
370 VAR_ROOM = 10;
371 VAR_ROOM_RESOURCE = 11;
372 VAR_TALK_ACTOR = 12;
373 VAR_HAVE_MSG = 13;
374 VAR_TIMER = 14;
375 VAR_TIMER_TOTAL = 15;
376
377 VAR_TIMEDATE_YEAR = 16;
378 VAR_TIMEDATE_MONTH = 17;
379 VAR_TIMEDATE_DAY = 18;
380 VAR_TIMEDATE_HOUR = 19;
381 VAR_TIMEDATE_MINUTE = 20;
382 VAR_TIMEDATE_SECOND = 21;
383
384 VAR_LEFTBTN_DOWN = 22;
385 VAR_RIGHTBTN_DOWN = 23;
386 VAR_LEFTBTN_HOLD = 24;
387 VAR_RIGHTBTN_HOLD = 25;
388
389 VAR_MEMORY_PERFORMANCE = 26;
390 VAR_VIDEO_PERFORMANCE = 27;
391 VAR_GAME_LOADED = 29;
392 VAR_V6_EMSSPACE = 32;
393 VAR_VOICE_MODE = 33; // 0 is voice, 1 is voice+text, 2 is text only
394 VAR_RANDOM_NR = 34;
395 VAR_NEW_ROOM = 35;
396 VAR_WALKTO_OBJ = 36;
397
398 VAR_NUM_GLOBAL_OBJS = 37;
399
400 VAR_CAMERA_DEST_X = 38;
401 VAR_CAMERA_DEST_Y = 39;
402 VAR_CAMERA_FOLLOWED_ACTOR = 40;
403
404 VAR_SCROLL_SCRIPT = 50;
405 VAR_ENTRY_SCRIPT = 51;
406 VAR_ENTRY_SCRIPT2 = 52;
407 VAR_EXIT_SCRIPT = 53;
408 VAR_EXIT_SCRIPT2 = 54;
409 VAR_VERB_SCRIPT = 55;
410 VAR_SENTENCE_SCRIPT = 56;
411 VAR_INVENTORY_SCRIPT = 57;
412 VAR_CUTSCENE_START_SCRIPT = 58;
413 VAR_CUTSCENE_END_SCRIPT = 59;
414 VAR_SAVELOAD_SCRIPT = 60;
415 VAR_SAVELOAD_SCRIPT2 = 61;
416
417 VAR_CUTSCENEEXIT_KEY = 62;
418 VAR_RESTART_KEY = 63;
419 VAR_PAUSE_KEY = 64;
420 VAR_MAINMENU_KEY = 65;
421 VAR_VERSION_KEY = 66;
422 VAR_TALKSTOP_KEY = 67;
423 VAR_KEYPRESS = 118;
424
425 VAR_TIMER_NEXT = 97;
426 VAR_TMR_1 = 98;
427 VAR_TMR_2 = 99;
428 VAR_TMR_3 = 100;
429
430 VAR_CAMERA_MIN_X = 101;
431 VAR_CAMERA_MAX_X = 102;
432 VAR_CAMERA_MIN_Y = 103;
433 VAR_CAMERA_MAX_Y = 104;
434 VAR_CAMERA_THRESHOLD_X = 105;
435 VAR_CAMERA_THRESHOLD_Y = 106;
436 VAR_CAMERA_SPEED_X = 107;
437 VAR_CAMERA_SPEED_Y = 108;
438 VAR_CAMERA_ACCEL_X = 109;
439 VAR_CAMERA_ACCEL_Y = 110;
440
441 VAR_EGO = 111;
442
443 VAR_CURSORSTATE = 112;
444 VAR_USERPUT = 113;
445 VAR_DEFAULT_TALK_DELAY = 114;
446 VAR_CHARINC = 115;
447 VAR_DEBUGMODE = 116;
448 VAR_FADE_DELAY = 117;
449
450 // Full Throttle specific
451 if (_game.id == GID_FT) {
452 VAR_CHARSET_MASK = 119;
453 }
454
455 VAR_VIDEONAME = 123;
456
457 VAR_STRING2DRAW = 130;
458 VAR_CUSTOMSCALETABLE = 131;
459
460 VAR_BLAST_ABOVE_TEXT = 133;
461
462 VAR_MUSIC_BUNDLE_LOADED = 135;
463 VAR_VOICE_BUNDLE_LOADED = 136;
464
465 }
466
setupScummVars()467 void ScummEngine_v8::setupScummVars() {
468 VAR_ROOM_WIDTH = 1;
469 VAR_ROOM_HEIGHT = 2;
470
471 VAR_MOUSE_X = 3;
472 VAR_MOUSE_Y = 4;
473 VAR_VIRT_MOUSE_X = 5;
474 VAR_VIRT_MOUSE_Y = 6;
475
476 VAR_CURSORSTATE = 7;
477 VAR_USERPUT = 8;
478
479 VAR_CAMERA_POS_X = 9;
480 VAR_CAMERA_POS_Y = 10;
481 VAR_CAMERA_DEST_X = 11;
482 VAR_CAMERA_DEST_Y = 12;
483 VAR_CAMERA_FOLLOWED_ACTOR = 13;
484
485 VAR_TALK_ACTOR = 14;
486 VAR_HAVE_MSG = 15;
487
488 VAR_LEFTBTN_DOWN = 16;
489 VAR_RIGHTBTN_DOWN = 17;
490 VAR_LEFTBTN_HOLD = 18;
491 VAR_RIGHTBTN_HOLD = 19;
492
493 VAR_TIMEDATE_YEAR = 24;
494 VAR_TIMEDATE_MONTH = 25;
495 VAR_TIMEDATE_DAY = 26;
496 VAR_TIMEDATE_HOUR = 27;
497 VAR_TIMEDATE_MINUTE = 28;
498 VAR_TIMEDATE_SECOND = 29;
499
500 VAR_OVERRIDE = 30;
501 VAR_ROOM = 31;
502 VAR_NEW_ROOM = 32;
503 VAR_WALKTO_OBJ = 33;
504 VAR_TIMER = 34;
505
506 VAR_VOICE_MODE = 39; // 0 is voice, 1 is voice+text, 2 is text only
507 VAR_GAME_LOADED = 40;
508 VAR_LANGUAGE = 41;
509
510 VAR_CURRENTDISK = 42;
511 VAR_MUSIC_BUNDLE_LOADED = 45;
512 VAR_VOICE_BUNDLE_LOADED = 46;
513
514 VAR_SCROLL_SCRIPT = 50;
515 VAR_ENTRY_SCRIPT = 51;
516 VAR_ENTRY_SCRIPT2 = 52;
517 VAR_EXIT_SCRIPT = 53;
518 VAR_EXIT_SCRIPT2 = 54;
519 VAR_VERB_SCRIPT = 55;
520 VAR_SENTENCE_SCRIPT = 56;
521 VAR_INVENTORY_SCRIPT = 57;
522 VAR_CUTSCENE_START_SCRIPT = 58;
523 VAR_CUTSCENE_END_SCRIPT = 59;
524
525 VAR_CUTSCENEEXIT_KEY = 62;
526
527 VAR_PAUSE_KEY = 64;
528 VAR_MAINMENU_KEY = 65;
529 VAR_VERSION_KEY = 66;
530 VAR_TALKSTOP_KEY = 67;
531
532 VAR_CUSTOMSCALETABLE = 111;
533
534 VAR_TIMER_NEXT = 112;
535 VAR_TMR_1 = 113;
536 VAR_TMR_2 = 114;
537 VAR_TMR_3 = 115;
538
539 VAR_CAMERA_MIN_X = 116;
540 VAR_CAMERA_MAX_X = 117;
541 VAR_CAMERA_MIN_Y = 118;
542 VAR_CAMERA_MAX_Y = 119;
543 VAR_CAMERA_SPEED_X = 120;
544 VAR_CAMERA_SPEED_Y = 121;
545 VAR_CAMERA_ACCEL_X = 122;
546 VAR_CAMERA_ACCEL_Y = 123;
547 VAR_CAMERA_THRESHOLD_X = 124;
548 VAR_CAMERA_THRESHOLD_Y = 125;
549
550 VAR_EGO = 126;
551
552 VAR_DEFAULT_TALK_DELAY = 128;
553 VAR_CHARINC = 129;
554
555 VAR_DEBUGMODE = 130;
556 VAR_KEYPRESS = 132;
557 VAR_BLAST_ABOVE_TEXT = 133;
558 VAR_SYNC = 134;
559 }
560 #endif
561
resetScummVars()562 void ScummEngine_v0::resetScummVars() {
563 resetSentence();
564
565 VAR(VAR_EGO) = 3;
566
567 // Setup light
568 _currentLights = LIGHTMODE_actor_use_base_palette | LIGHTMODE_actor_use_colors | LIGHTMODE_room_lights_on;
569 }
570
resetScummVars()571 void ScummEngine_v2::resetScummVars() {
572 // This needs to be at least greater than 40 to get the more
573 // elaborate version of the EGA Zak into. I don't know where
574 // else it makes any difference.
575 if (_game.id == GID_ZAK)
576 VAR(VAR_MACHINE_SPEED) = 0x7FFF;
577 }
578
resetScummVars()579 void ScummEngine_v5::resetScummVars() {
580 ScummEngine::resetScummVars();
581
582 if (_game.version >= 4 && _game.version <= 5)
583 VAR(VAR_V5_TALK_STRING_Y) = -0x50;
584
585 // Setup light
586 VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_use_base_palette | LIGHTMODE_actor_use_colors | LIGHTMODE_room_lights_on;
587
588 if (_game.id == GID_MONKEY)
589 _scummVars[74] = 1225;
590 }
591
592 #ifdef ENABLE_SCUMM_7_8
resetScummVars()593 void ScummEngine_v7::resetScummVars() {
594 ScummEngine::resetScummVars();
595
596 if (_game.version != 8) {
597 VAR(VAR_V6_EMSSPACE) = 10000;
598 VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1;
599 }
600
601 VAR(VAR_DEFAULT_TALK_DELAY) = 60;
602 }
603
resetScummVars()604 void ScummEngine_v8::resetScummVars() {
605 ScummEngine_v7::resetScummVars();
606
607 // FIXME: How do we deal with non-cd installs?
608 VAR(VAR_CURRENTDISK) = 1;
609
610 switch (_language) {
611 case Common::EN_ANY:
612 case Common::EN_USA:
613 case Common::EN_GRB:
614 VAR(VAR_LANGUAGE) = 0;
615 break;
616 case Common::DE_DEU:
617 VAR(VAR_LANGUAGE) = 1;
618 break;
619 case Common::FR_FRA:
620 VAR(VAR_LANGUAGE) = 2;
621 break;
622 case Common::IT_ITA:
623 VAR(VAR_LANGUAGE) = 3;
624 break;
625 case Common::PT_BRA:
626 VAR(VAR_LANGUAGE) = 4;
627 break;
628 case Common::ES_ESP:
629 VAR(VAR_LANGUAGE) = 5;
630 break;
631 case Common::JA_JPN:
632 VAR(VAR_LANGUAGE) = 6;
633 break;
634 case Common::ZH_TWN:
635 VAR(VAR_LANGUAGE) = 7;
636 break;
637 case Common::KO_KOR:
638 VAR(VAR_LANGUAGE) = 8;
639 break;
640 default:
641 VAR(VAR_LANGUAGE) = 0; // Default to english
642 }
643 }
644 #endif
645
resetScummVars()646 void ScummEngine_v70he::resetScummVars() {
647 ScummEngine::resetScummVars();
648
649 if (VAR_MACHINE_SPEED != 0xFF)
650 VAR(VAR_MACHINE_SPEED) = 13;
651
652 VAR(VAR_NUM_SOUND_CHANNELS) = 8;
653 VAR(VAR_SOUND_CHANNEL) = 1;
654 VAR(VAR_TALK_CHANNEL) = 2;
655 }
656
657 #ifdef ENABLE_HE
resetScummVars()658 void ScummEngine_v72he::resetScummVars() {
659 ScummEngine_v70he::resetScummVars();
660
661 VAR(VAR_VIDEO_PERFORMANCE) = 26;
662
663 VAR(VAR_NUM_ROOMS) = _numRooms - 1;
664 VAR(VAR_NUM_SCRIPTS) = _numScripts - 1;
665 VAR(VAR_NUM_SOUNDS) = _numSounds - 1;
666 VAR(VAR_NUM_COSTUMES) = _numCostumes - 1;
667 VAR(VAR_NUM_IMAGES) = _numImages - 1;
668 VAR(VAR_NUM_CHARSETS) = _numCharsets - 1;
669 VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1;
670
671 if (_game.heversion <= 74) {
672 // Songs are disabled, if sound is disabled.
673 VAR(VAR_SOUND_ENABLED) = 1;
674 }
675
676 if (_game.heversion == 74) {
677 // Uses different values, compared to later HE80+ games.
678 if (_game.platform == Common::kPlatformMacintosh) {
679 VAR(VAR_PLATFORM) = 3;
680 } else {
681 VAR(VAR_PLATFORM) = 2;
682 }
683 }
684 }
685
resetScummVars()686 void ScummEngine_v80he::resetScummVars() {
687 ScummEngine_v72he::resetScummVars();
688
689 if (_game.platform == Common::kPlatformMacintosh) {
690 VAR(VAR_PLATFORM) = 2;
691 VAR(VAR_PLATFORM_VERSION) = 70;
692 } else {
693 VAR(VAR_PLATFORM) = 1;
694 VAR(VAR_PLATFORM_VERSION) = 40; // 31 is Windows 3.1, 40 is Windows 95+
695 }
696 VAR(VAR_COLOR_DEPTH) = 256;
697 }
698
resetScummVars()699 void ScummEngine_v90he::resetScummVars() {
700 ScummEngine_v80he::resetScummVars();
701
702 VAR(VAR_SCRIPT_CYCLE) = 1;
703 VAR(VAR_NUM_SCRIPT_CYCLES) = 1;
704
705 if (_game.heversion >= 95) {
706 VAR(VAR_NUM_SPRITE_GROUPS) = MAX(64, _numSprites / 4) - 1;
707 VAR(VAR_NUM_SPRITES) = _numSprites - 1;
708 VAR(VAR_WIZ_TCOLOR) = 5;
709 VAR(VAR_RESERVED_SOUND_CHANNELS) = 9;
710 }
711 if (_game.heversion >= 98) {
712 VAR(VAR_U32_VERSION) = _logicHE->versionID();
713 VAR(VAR_U32_ARRAY_UNK) = 0;
714 }
715 }
716
resetScummVars()717 void ScummEngine_v99he::resetScummVars() {
718 ScummEngine_v90he::resetScummVars();
719
720 VAR(VAR_NUM_PALETTES) = _numPalettes;
721 VAR(VAR_NUM_UNK) = _numUnk;
722
723 if (_game.heversion >= 100 && (_game.features & GF_16BIT_COLOR)) {
724 // Enable Bink video in 16bit color games
725 #ifdef USE_BINK
726 VAR(140) = 1;
727 #else
728 VAR(140) = 0;
729 #endif
730 }
731
732 if (_game.id == GID_PUTTZOO && _game.heversion == 100 && _game.platform == Common::kPlatformWindows) {
733 // Specific to Nimbus Games version.
734 VAR(156) = 1;
735 VAR(157) = 0;
736 }
737 }
738 #endif
739
resetScummVars()740 void ScummEngine::resetScummVars() {
741 if (_game.heversion < 70 && _game.version <= 6) {
742 // VAR_SOUNDCARD modes
743 // 0 PC Speaker
744 // 1 Tandy
745 // 2 CMS
746 // 3 AdLib
747 // 4 Roland
748 switch (_sound->_musicType) {
749 case MDT_NONE:
750 case MDT_PCSPK:
751 VAR(VAR_SOUNDCARD) = 0;
752 break;
753 case MDT_PCJR:
754 VAR(VAR_SOUNDCARD) = 1;
755 break;
756 case MDT_CMS:
757 VAR(VAR_SOUNDCARD) = 2;
758 break;
759 case MDT_ADLIB:
760 VAR(VAR_SOUNDCARD) = 3;
761 break;
762 default:
763 if ((_game.id == GID_MONKEY_EGA || _game.id == GID_MONKEY_VGA || (_game.id == GID_LOOM && _game.version == 3))
764 && (_game.platform == Common::kPlatformDOS)) {
765 VAR(VAR_SOUNDCARD) = 4;
766 } else {
767 VAR(VAR_SOUNDCARD) = 3;
768 }
769 break;
770 }
771
772 if (_game.platform == Common::kPlatformFMTowns)
773 VAR(VAR_VIDEOMODE) = 42;
774 // Value only used by the Macintosh version of Indiana Jones and the Last Crusade
775 else if (_game.platform == Common::kPlatformMacintosh && _game.version == 3)
776 VAR(VAR_VIDEOMODE) = 50;
777 // Value only used by the Amiga version of Monkey Island 2
778 else if (_game.platform == Common::kPlatformAmiga)
779 VAR(VAR_VIDEOMODE) = 82;
780 else if (_renderMode == Common::kRenderCGA)
781 VAR(VAR_VIDEOMODE) = 4;
782 else if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG)
783 VAR(VAR_VIDEOMODE) = 30;
784 else if (_renderMode == Common::kRenderEGA)
785 VAR(VAR_VIDEOMODE) = 13;
786 else
787 VAR(VAR_VIDEOMODE) = 19;
788
789 if (_game.platform == Common::kPlatformMacintosh && (_game.features & GF_OLD_BUNDLE)) {
790 // Set screen size for the Macintosh version of Indy3/Loom
791 VAR(39) = 320;
792 }
793 if (_game.platform == Common::kPlatformDOS && _game.id == GID_LOOM && _game.version == 3) {
794 // Set number of sound resources
795 VAR(39) = 80;
796 }
797
798 if (_game.id == GID_LOOM || _game.version >= 4)
799 VAR(VAR_HEAPSPACE) = 1400;
800 if (_game.version >= 4)
801 VAR(VAR_FIXEDDISK) = 1;
802 if (_game.version >= 5)
803 VAR(VAR_INPUTMODE) = 3;
804 if (_game.version == 6)
805 VAR(VAR_V6_EMSSPACE) = 10000;
806
807 if (_game.heversion >= 60) {
808 // Set fast speed, to enable all animations
809 VAR(VAR_MACHINE_SPEED) = 2;
810
811 VAR(VAR_SOUNDPARAM) = 1; // Soundblaster for music
812 VAR(VAR_SOUNDPARAM2) = 1; // Soundblaster for sound effects
813 }
814 }
815
816 if (VAR_ROOM_WIDTH != 0xFF && VAR_ROOM_HEIGHT != 0xFF) {
817 VAR(VAR_ROOM_WIDTH) = _screenWidth;
818 VAR(VAR_ROOM_HEIGHT) = _screenHeight;
819 }
820
821 if (VAR_DEBUGMODE != 0xFF) {
822 VAR(VAR_DEBUGMODE) = (_debugMode ? 1 : 0);
823 if (_game.heversion >= 80 && _debugMode)
824 VAR(85) = 1;
825 }
826
827 if (VAR_FADE_DELAY != 0xFF)
828 VAR(VAR_FADE_DELAY) = 3;
829
830 VAR(VAR_CHARINC) = 4;
831 setTalkingActor(0);
832 }
833
834 } // End of namespace Scumm
835