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 "hopkins/objects.h"
24 #include "hopkins/dialogs.h"
25 #include "hopkins/files.h"
26 #include "hopkins/globals.h"
27 #include "hopkins/sound.h"
28 #include "hopkins/hopkins.h"
29 
30 #include "common/system.h"
31 #include "graphics/palette.h"
32 #include "common/file.h"
33 #include "common/rect.h"
34 #include "engines/util.h"
35 
36 namespace Hopkins {
37 
ScriptManager(HopkinsEngine * vm)38 ScriptManager::ScriptManager(HopkinsEngine *vm) {
39 	_vm = vm;
40 	_tempObjectFl = false;
41 }
42 
handleOpcode(const byte * dataP)43 int ScriptManager::handleOpcode(const byte *dataP) {
44 	if (READ_BE_UINT16(dataP) != MKTAG16('F', 'C'))
45 		return 0;
46 
47 	int opcodeType = 0;
48 	int vbobFrameIndex = 0;
49 
50 	uint32 signature24 = READ_BE_UINT24(&dataP[2]);
51 	switch (signature24) {
52 	case MKTAG24('T', 'X', 'T'): {
53 		vbobFrameIndex = dataP[6];
54 		int mesgId = READ_LE_INT16(dataP + 13);
55 		opcodeType = 1;
56 		if (!_tempObjectFl) {
57 			if (_vm->_globals->_saveData->_data[svField356] == 1) {
58 				if (mesgId == 53)
59 					mesgId = 644;
60 				if (mesgId == 624)
61 					mesgId = 639;
62 				if (mesgId == 627)
63 					mesgId = 630;
64 				if (mesgId == 625)
65 					mesgId = 639;
66 				if (mesgId == 8)
67 					mesgId = 637;
68 				if (mesgId == 557)
69 					mesgId = 636;
70 				if (mesgId == 51)
71 					mesgId = 644;
72 				if (mesgId == 287)
73 					mesgId = 636;
74 				if (mesgId == 619)
75 					mesgId = 633;
76 				if (mesgId == 620)
77 					mesgId = 634;
78 				if (mesgId == 622)
79 					mesgId = 644;
80 				if (mesgId == 297)
81 					mesgId = 636;
82 				if (mesgId == 612 || mesgId == 613 || mesgId == 614 || mesgId == 134)
83 					mesgId = 636;
84 				if (mesgId == 615)
85 					mesgId = 635;
86 				if (mesgId == 618)
87 					mesgId = 632;
88 				if (mesgId == 611)
89 					mesgId = 642;
90 				if (mesgId == 610)
91 					mesgId = 641;
92 				if (mesgId == 18)
93 					mesgId = 643;
94 				if (mesgId == 602)
95 					mesgId = 645;
96 				if (mesgId == 603)
97 					mesgId = 646;
98 				if (mesgId == 604)
99 					mesgId = 647;
100 				if (mesgId == 607)
101 					mesgId = 650;
102 				if (mesgId == 605)
103 					mesgId = 648;
104 				if (mesgId == 606)
105 					mesgId = 649;
106 				if (mesgId == 601)
107 					mesgId = 652;
108 				if (mesgId == 37)
109 					mesgId = 636;
110 				if (mesgId == 595)
111 					mesgId = 633;
112 				if (mesgId == 596)
113 					mesgId = 634;
114 				if (mesgId == 532)
115 					mesgId = 636;
116 				if (mesgId == 599)
117 					mesgId = 636;
118 				if (mesgId == 363)
119 					mesgId = 636;
120 			}
121 			if (!_vm->_soundMan->_soundOffFl && _vm->_soundMan->_soundFl) {
122 				do {
123 					if (_vm->shouldQuit())
124 						return -1; // Exiting game
125 					_vm->_events->refreshScreenAndEvents();
126 				} while (_vm->_soundMan->_soundFl);
127 			}
128 			bool displayedTxtFl = false;
129 			if (!_vm->_soundMan->_textOffFl) {
130 				int textPosX = READ_LE_INT16(dataP + 9);
131 				int textPosY = READ_LE_INT16(dataP + 11);
132 				_vm->_fontMan->initTextBuffers(9, mesgId, _vm->_globals->_textFilename, 2 * textPosX, 2 * textPosY + 40, 6, dataP[7], 253);
133 				_vm->_fontMan->showText(9);
134 				displayedTxtFl = true;
135 			}
136 			if (!_vm->_soundMan->_voiceOffFl)
137 				_vm->_soundMan->mixVoice(mesgId, 4, displayedTxtFl);
138 		} else { // if (_tempObjectFl)
139 			if (_vm->_globals->_saveData->_data[svField356]) {
140 				_vm->_fontMan->initTextBuffers(9, 635, _vm->_globals->_textFilename, 55, 20, dataP[8], 35, 253);
141 				bool displayedTxtFl = false;
142 				if (!_vm->_soundMan->_textOffFl) {
143 					_vm->_fontMan->showText(9);
144 					displayedTxtFl = true;
145 				}
146 
147 				if (!_vm->_soundMan->_voiceOffFl)
148 					_vm->_soundMan->mixVoice(635, 4, displayedTxtFl);
149 			} else {
150 				int textPosX = READ_LE_INT16(dataP + 9);
151 				if (!_vm->_soundMan->_textOffFl) {
152 					switch (_vm->_globals->_language) {
153 					case LANG_FR:
154 						_vm->_fontMan->initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
155 						break;
156 					case LANG_EN:
157 						_vm->_fontMan->initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
158 						break;
159 					case LANG_SP:
160 						_vm->_fontMan->initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
161 						break;
162 					}
163 				}
164 
165 				bool displayedTxtFl = false;
166 				if (!_vm->_soundMan->_textOffFl) {
167 					_vm->_fontMan->showText(9);
168 					displayedTxtFl = true;
169 				}
170 
171 				if (!_vm->_soundMan->_voiceOffFl)
172 					_vm->_soundMan->mixVoice(mesgId, 5, displayedTxtFl);
173 			}
174 		}
175 		break;
176 		}
177 	case MKTAG24('B', 'O', 'B'):
178 		if (!_vm->_objectsMan->_disableFl) {
179 			int vbobIdx = dataP[5];
180 			vbobFrameIndex = dataP[6];
181 			int moveChange = dataP[7];
182 			int vbobPosX = READ_LE_INT16(dataP + 8);
183 			int vbobPosY = READ_LE_INT16(dataP + 10);
184 			if (vbobIdx == 52) {
185 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, vbobPosX, READ_LE_INT16(dataP + 10), vbobFrameIndex);
186 			} else if (vbobIdx == 51) {
187 				_vm->_objectsMan->quickDisplayBobSprite(vbobFrameIndex);
188 			} else if (vbobIdx != 50) {
189 				_vm->_objectsMan->initVbob(_vm->_globals->_levelSpriteBuf, vbobIdx, vbobPosX, vbobPosY, vbobFrameIndex);
190 				if (moveChange)
191 					moveChange /= _vm->_globals->_speed;
192 				if (moveChange > 1) {
193 					do {
194 						if (_vm->shouldQuit())
195 							return -1; // Exiting game
196 
197 						--moveChange;
198 						_vm->_events->refreshScreenAndEvents();
199 					} while (moveChange);
200 				}
201 			}
202 		}
203 		opcodeType = 1;
204 		break;
205 	case MKTAG24('S', 'T', 'P'):
206 		if (!_vm->_objectsMan->_disableFl) {
207 			// HACK: This piece of code is a replacement to the missing STE opcode when entering the FBI lab.
208 			if (_vm->_globals->_curRoomNum == 10) {
209 				_vm->_globals->_prevScreenId = _vm->_globals->_screenId;
210 				_vm->_globals->_saveData->_data[svLastPrevScreenId] = _vm->_globals->_screenId;
211 				_vm->_globals->_screenId = _vm->_globals->_saveData->_data[svLastScreenId] = 10;
212 			}
213 			_vm->_objectsMan->_twoCharactersFl = false;
214 			_vm->_objectsMan->_characterPos.x = READ_LE_INT16(dataP + 6);
215 			_vm->_objectsMan->_characterPos.y = READ_LE_INT16(dataP + 8);
216 			_vm->_objectsMan->_startSpriteIndex = dataP[5];
217 			if (_vm->_objectsMan->_changeHeadFl) {
218 				if (_vm->_globals->_saveData->_data[svField354] == 1
219 						&& _vm->_globals->_saveData->_cloneHopkins._pos.x && _vm->_globals->_saveData->_cloneHopkins._pos.y
220 						&& _vm->_globals->_saveData->_cloneHopkins._startSpriteIndex && _vm->_globals->_saveData->_cloneHopkins._location) {
221 
222 					_vm->_objectsMan->_characterPos = _vm->_globals->_saveData->_cloneHopkins._pos;
223 					_vm->_objectsMan->_startSpriteIndex = _vm->_globals->_saveData->_cloneHopkins._startSpriteIndex;
224 				}
225 				if (_vm->_globals->_saveData->_data[svField356] == 1
226 						&& _vm->_globals->_saveData->_samantha._pos.x && _vm->_globals->_saveData->_samantha._pos.y
227 						&& _vm->_globals->_saveData->_samantha._startSpriteIndex && _vm->_globals->_saveData->_samantha._location) {
228 					_vm->_objectsMan->_characterPos = _vm->_globals->_saveData->_samantha._pos;
229 					_vm->_objectsMan->_startSpriteIndex = _vm->_globals->_saveData->_samantha._startSpriteIndex;
230 				}
231 				if (_vm->_globals->_saveData->_data[svField357] == 1
232 						&& _vm->_globals->_saveData->_realHopkins._pos.x && _vm->_globals->_saveData->_realHopkins._pos.y
233 						&& _vm->_globals->_saveData->_realHopkins._startSpriteIndex && _vm->_globals->_saveData->_realHopkins._location) {
234 					_vm->_objectsMan->_characterPos = _vm->_globals->_saveData->_realHopkins._pos;
235 					_vm->_objectsMan->_startSpriteIndex = _vm->_globals->_saveData->_realHopkins._startSpriteIndex;
236 				}
237 			}
238 			if (_vm->_globals->_saveData->_data[svField356] == 1
239 					&& _vm->_globals->_saveData->_realHopkins._location == _vm->_globals->_screenId) {
240 				_vm->_objectsMan->addStaticSprite(
241 				    _vm->_objectsMan->_headSprites,
242 				    _vm->_globals->_saveData->_realHopkins._pos,
243 				    1,
244 				    2,
245 				    _vm->_globals->_saveData->_realHopkins._zoomFactor,
246 				    false,
247 				    34,
248 				    190);
249 				_vm->_objectsMan->animateSprite(1);
250 				_vm->_objectsMan->_twoCharactersFl = true;
251 			}
252 			if (_vm->_globals->_saveData->_data[svField357] == 1
253 			        && _vm->_globals->_saveData->_data[svField355] == 1
254 			        && _vm->_globals->_saveData->_samantha._location == _vm->_globals->_screenId) {
255 				_vm->_objectsMan->addStaticSprite(
256 				    _vm->_objectsMan->_headSprites,
257 				    _vm->_globals->_saveData->_samantha._pos,
258 				    1,
259 				    3,
260 				    _vm->_globals->_saveData->_samantha._zoomFactor,
261 				    false,
262 				    20,
263 				    127);
264 				_vm->_objectsMan->animateSprite(1);
265 				_vm->_objectsMan->_twoCharactersFl = true;
266 			}
267 		}
268 		opcodeType = 1;
269 		_vm->_objectsMan->_changeHeadFl = false;
270 		break;
271 	case MKTAG24('S', 'T', 'E'):
272 		if (!_vm->_objectsMan->_disableFl) {
273 			_vm->_globals->_prevScreenId = _vm->_globals->_screenId;
274 			_vm->_globals->_saveData->_data[svLastPrevScreenId] = _vm->_globals->_screenId;
275 			_vm->_globals->_screenId = _vm->_globals->_saveData->_data[svLastScreenId] = dataP[5];
276 			vbobFrameIndex = dataP[6];
277 		}
278 		opcodeType = 1;
279 		break;
280 	case MKTAG24('B', 'O', 'F'):
281 		if (!_vm->_objectsMan->_disableFl)
282 			_vm->_objectsMan->disableVbob(READ_LE_INT16(dataP + 5));
283 		opcodeType = 1;
284 		break;
285 	case MKTAG24('P', 'E', 'R'): {
286 		int specialOpcode = READ_LE_INT16(dataP + 5);
287 		if (!_vm->_globals->_saveData->_data[svAlternateSpriteFl] && !_vm->_globals->_saveData->_data[svField356]) {
288 			vbobFrameIndex = 0;
289 
290 			switch (specialOpcode) {
291 			case 1:
292 			case 14:
293 				if (_vm->_globals->_actionDirection == DIR_UP)
294 					_vm->_objectsMan->doActionBack(4);
295 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
296 					_vm->_objectsMan->doActionRight(4);
297 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
298 					_vm->_objectsMan->doActionDiagRight(4);
299 				if (_vm->_globals->_actionDirection == DIR_DOWN)
300 					_vm->_objectsMan->doActionFront(4);
301 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
302 					_vm->_objectsMan->doActionDiagLeft(4);
303 				if (_vm->_globals->_actionDirection == DIR_LEFT)
304 					_vm->_objectsMan->doActionLeft(4);
305 				break;
306 			case 2:
307 				if (_vm->_globals->_actionDirection == DIR_UP)
308 					_vm->_objectsMan->doActionBack(7);
309 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
310 					_vm->_objectsMan->doActionRight(7);
311 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
312 					_vm->_objectsMan->doActionDiagRight(7);
313 				if (_vm->_globals->_actionDirection == DIR_DOWN)
314 					_vm->_objectsMan->doActionFront(7);
315 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
316 					_vm->_objectsMan->doActionDiagLeft(7);
317 				if (_vm->_globals->_actionDirection == DIR_LEFT)
318 					_vm->_objectsMan->doActionLeft(7);
319 				if (_vm->_globals->_actionDirection == DIR_UP)
320 					_vm->_objectsMan->doActionBack(8);
321 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
322 					_vm->_objectsMan->doActionRight(8);
323 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
324 					_vm->_objectsMan->doActionDiagRight(8);
325 				if (_vm->_globals->_actionDirection == DIR_DOWN)
326 					_vm->_objectsMan->doActionFront(8);
327 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
328 					_vm->_objectsMan->doActionDiagLeft(8);
329 				if (_vm->_globals->_actionDirection == DIR_LEFT)
330 					_vm->_objectsMan->doActionLeft(8);
331 				break;
332 			case 19:
333 			case 4:
334 				if (_vm->_globals->_actionDirection == DIR_UP)
335 					_vm->_objectsMan->doActionBack(1);
336 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
337 					_vm->_objectsMan->doActionRight(1);
338 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
339 					_vm->_objectsMan->doActionDiagRight(1);
340 				if (_vm->_globals->_actionDirection == DIR_DOWN)
341 					_vm->_objectsMan->doActionFront(1);
342 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
343 					_vm->_objectsMan->doActionDiagLeft(1);
344 				if (_vm->_globals->_actionDirection == DIR_LEFT)
345 					_vm->_objectsMan->doActionLeft(1);
346 				break;
347 			case 5:
348 				if (_vm->_globals->_actionDirection == DIR_UP)
349 					_vm->_objectsMan->doActionBack(5);
350 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
351 					_vm->_objectsMan->doActionRight(5);
352 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
353 					_vm->_objectsMan->doActionDiagRight(5);
354 				if (_vm->_globals->_actionDirection == DIR_DOWN)
355 					_vm->_objectsMan->doActionFront(5);
356 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
357 					_vm->_objectsMan->doActionDiagLeft(5);
358 				if (_vm->_globals->_actionDirection == DIR_LEFT)
359 					_vm->_objectsMan->doActionLeft(5);
360 				if (_vm->_globals->_actionDirection == DIR_UP)
361 					_vm->_objectsMan->doActionBack(6);
362 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
363 					_vm->_objectsMan->doActionRight(6);
364 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
365 					_vm->_objectsMan->doActionDiagRight(6);
366 				if (_vm->_globals->_actionDirection == DIR_DOWN)
367 					_vm->_objectsMan->doActionFront(6);
368 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
369 					_vm->_objectsMan->doActionDiagLeft(6);
370 				if (_vm->_globals->_actionDirection == DIR_LEFT)
371 					_vm->_objectsMan->doActionLeft(6);
372 				break;
373 			case 17:
374 			case 7:
375 				if (_vm->_globals->_actionDirection == DIR_UP)
376 					_vm->_objectsMan->doActionBack(2);
377 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
378 					_vm->_objectsMan->doActionRight(2);
379 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
380 					_vm->_objectsMan->doActionDiagRight(2);
381 				if (_vm->_globals->_actionDirection == DIR_DOWN)
382 					_vm->_objectsMan->doActionFront(2);
383 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
384 					_vm->_objectsMan->doActionDiagLeft(2);
385 				if (_vm->_globals->_actionDirection == DIR_LEFT)
386 					_vm->_objectsMan->doActionLeft(2);
387 				break;
388 			case 18:
389 			case 8:
390 				if (_vm->_globals->_actionDirection == DIR_UP)
391 					_vm->_objectsMan->doActionBack(3);
392 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
393 					_vm->_objectsMan->doActionRight(3);
394 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
395 					_vm->_objectsMan->doActionDiagRight(3);
396 				if (_vm->_globals->_actionDirection == DIR_DOWN)
397 					_vm->_objectsMan->doActionFront(3);
398 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
399 					_vm->_objectsMan->doActionDiagLeft(3);
400 				if (_vm->_globals->_actionDirection == DIR_LEFT)
401 					_vm->_objectsMan->doActionLeft(3);
402 				break;
403 			case 9:
404 				if (_vm->_globals->_actionDirection == DIR_UP)
405 					_vm->_objectsMan->doActionBack(5);
406 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
407 					_vm->_objectsMan->doActionRight(5);
408 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
409 					_vm->_objectsMan->doActionDiagRight(5);
410 				if (_vm->_globals->_actionDirection == DIR_DOWN)
411 					_vm->_objectsMan->doActionFront(5);
412 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
413 					_vm->_objectsMan->doActionDiagLeft(5);
414 				if (_vm->_globals->_actionDirection == DIR_LEFT)
415 					_vm->_objectsMan->doActionLeft(5);
416 				break;
417 			case 10:
418 				if (_vm->_globals->_actionDirection == DIR_UP)
419 					_vm->_objectsMan->doActionBack(6);
420 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
421 					_vm->_objectsMan->doActionRight(6);
422 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
423 					_vm->_objectsMan->doActionDiagRight(6);
424 				if (_vm->_globals->_actionDirection == DIR_DOWN)
425 					_vm->_objectsMan->doActionFront(6);
426 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
427 					_vm->_objectsMan->doActionDiagLeft(6);
428 				if (_vm->_globals->_actionDirection == DIR_LEFT)
429 					_vm->_objectsMan->doActionLeft(6);
430 				break;
431 			case 15:
432 			case 11:
433 				if (_vm->_globals->_actionDirection == DIR_UP)
434 					_vm->_objectsMan->doActionBack(7);
435 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
436 					_vm->_objectsMan->doActionRight(7);
437 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
438 					_vm->_objectsMan->doActionDiagRight(7);
439 				if (_vm->_globals->_actionDirection == DIR_DOWN)
440 					_vm->_objectsMan->doActionFront(7);
441 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
442 					_vm->_objectsMan->doActionDiagLeft(7);
443 				if (_vm->_globals->_actionDirection == DIR_LEFT)
444 					_vm->_objectsMan->doActionLeft(7);
445 				break;
446 			case 16:
447 			case 12:
448 				if (_vm->_globals->_actionDirection == DIR_UP)
449 					_vm->_objectsMan->doActionBack(8);
450 				if (_vm->_globals->_actionDirection == DIR_RIGHT)
451 					_vm->_objectsMan->doActionRight(8);
452 				if (_vm->_globals->_actionDirection == DIR_UP_RIGHT)
453 					_vm->_objectsMan->doActionDiagRight(8);
454 				if (_vm->_globals->_actionDirection == DIR_DOWN)
455 					_vm->_objectsMan->doActionFront(8);
456 				if (_vm->_globals->_actionDirection == DIR_UP_LEFT)
457 					_vm->_objectsMan->doActionDiagLeft(8);
458 				if (_vm->_globals->_actionDirection == DIR_LEFT)
459 					_vm->_objectsMan->doActionLeft(8);
460 				break;
461 			}
462 		}
463 		opcodeType = 1;
464 		break;
465 		}
466 	case MKTAG24('M', 'U', 'S'):
467 		opcodeType = 1;
468 		break;
469 	case MKTAG24('W', 'A', 'I'): {
470 		uint frameNumb = READ_LE_UINT16(dataP + 5) / _vm->_globals->_speed;
471 		if (!frameNumb)
472 			frameNumb = 1;
473 		for (uint i = 0; i < frameNumb + 1; i++) {
474 			if (_vm->shouldQuit())
475 				return -1; // Exiting game
476 
477 			_vm->_events->refreshScreenAndEvents();
478 		}
479 		opcodeType = 1;
480 		break;
481 		}
482 	case MKTAG24('O', 'B', 'P'):
483 		opcodeType = 1;
484 		_vm->_objectsMan->addObject(READ_LE_INT16(dataP + 5));
485 		break;
486 	case MKTAG24('O', 'B', 'M'):
487 		opcodeType = 1;
488 		_vm->_objectsMan->removeObject(READ_LE_INT16(dataP + 5));
489 		break;
490 	case MKTAG24('G', 'O', 'T'):
491 		opcodeType = 2;
492 		break;
493 	case MKTAG24('Z', 'O', 'N'):
494 		_vm->_linesMan->enableZone(READ_LE_INT16(dataP + 5));
495 		opcodeType = 1;
496 		break;
497 	case MKTAG24('Z', 'O', 'F'):
498 		_vm->_linesMan->disableZone(READ_LE_INT16(dataP + 5));
499 		opcodeType = 1;
500 		break;
501 	case MKTAG24('E', 'X', 'I'):
502 		opcodeType = 5;
503 		break;
504 	case MKTAG24('S', 'O', 'R'):
505 		_vm->_globals->_exitId = READ_LE_INT16(dataP + 5);
506 		opcodeType = 5;
507 		break;
508 	case MKTAG24('B', 'C', 'A'):
509 		_vm->_objectsMan->disableHidingItem(READ_LE_INT16(dataP + 5));
510 		opcodeType = 1;
511 		break;
512 	case MKTAG24('A', 'N', 'I'): {
513 		int animId = READ_LE_INT16(dataP + 5);
514 		if (animId <= 100)
515 			_vm->_objectsMan->setBobAnimation(animId);
516 		else
517 			_vm->_objectsMan->stopBobAnimation(animId - 100);
518 		opcodeType = 1;
519 		break;
520 		}
521 	case MKTAG24('S', 'P', 'E'):
522 		switch (READ_LE_INT16(dataP + 5)) {
523 		case 6:
524 			_vm->_objectsMan->removeSprite(0);
525 			_vm->_objectsMan->setAndPlayAnim(20, 0, 14, true);
526 			break;
527 
528 		case 7:
529 			_vm->_talkMan->startAnimatedCharacterDialogue("rueh1.pe2");
530 			break;
531 
532 		case 8:
533 			_vm->_talkMan->startAnimatedCharacterDialogue("ruef1.pe2");
534 			break;
535 
536 		case 10:
537 			_vm->_talkMan->startAnimatedCharacterDialogue("bqeflic1.pe2");
538 			break;
539 
540 		case 11:
541 			_vm->_talkMan->startAnimatedCharacterDialogue("bqeflic2.pe2");
542 			break;
543 
544 		case 12:
545 			// Bank - negotiations between Hopkins and one of the killers
546 			_vm->_fontMan->hideText(9);
547 			_vm->_events->refreshScreenAndEvents();
548 			_vm->_events->refreshScreenAndEvents();
549 			_vm->_talkMan->startAnimatedCharacterDialogue("bqetueur.pe2");
550 			break;
551 
552 		case 13:
553 			// Bank - after negotiations, Hopkins enters the bank
554 			_vm->_events->_mouseButton = _vm->_events->_curMouseButton;
555 			_vm->_globals->_disableInventFl = true;
556 			_vm->_graphicsMan->fadeOutLong();
557 			_vm->_objectsMan->disableHidingBehavior();
558 			_vm->_objectsMan->removeSprite(0);
559 			_vm->_fontMan->hideText(5);
560 			_vm->_fontMan->hideText(9);
561 			_vm->_graphicsMan->endDisplayBob();
562 			_vm->_objectsMan->clearScreen();
563 
564 			if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) {
565 				_vm->_soundMan->playSoundFile("SOUND17.WAV");
566 				_vm->_graphicsMan->_fadingFl = true;
567 				_vm->_animMan->playSequence2("HELICO.SEQ", 10, 4, 10);
568 			}
569 
570 			_vm->_animMan->loadAnim("otage");
571 			_vm->_graphicsMan->loadImage("IM05");
572 			_vm->_graphicsMan->displayAllBob();
573 
574 			for (int i = 0; i <= 4; i++) {
575 				if (_vm->shouldQuit())
576 					return -1; // Exiting game
577 
578 				_vm->_events->refreshScreenAndEvents();
579 			}
580 
581 			_vm->_events->mouseOff();
582 			_vm->_graphicsMan->fadeInDefaultLength(_vm->_graphicsMan->_frontBuffer);
583 			do {
584 				if (_vm->shouldQuit())
585 					return -1; // Exiting game
586 
587 				_vm->_events->refreshScreenAndEvents();
588 			} while (_vm->_objectsMan->getBobAnimDataIdx(3) != 100);
589 			_vm->_graphicsMan->fadeOutDefaultLength(_vm->_graphicsMan->_frontBuffer);
590 			_vm->_graphicsMan->endDisplayBob();
591 
592 			// If uncensored, rip the throat of the hostage
593 			if (!_vm->_globals->_censorshipFl) {
594 				_vm->_soundMan->_specialSoundNum = 16;
595 				_vm->_graphicsMan->_fadingFl = true;
596 				_vm->_animMan->playAnim("EGORGE.ANM", "EGORGE.ANM", 50, 28, 500);
597 				_vm->_soundMan->_specialSoundNum = 0;
598 			}
599 			_vm->_animMan->loadAnim("ASCEN");
600 			_vm->_events->mouseOff();
601 			_vm->_graphicsMan->loadImage("ASCEN");
602 			_vm->_graphicsMan->displayAllBob();
603 
604 			for (int i = 0; i <= 4; i++) {
605 				if (_vm->shouldQuit())
606 					return -1; // Exiting game
607 
608 				_vm->_events->refreshScreenAndEvents();
609 			}
610 
611 			_vm->_events->mouseOff();
612 			_vm->_graphicsMan->fadeInDefaultLength(_vm->_graphicsMan->_frontBuffer);
613 			_vm->_objectsMan->checkEventBobAnim(1, 0, 17, 3);
614 			_vm->_graphicsMan->fadeOutDefaultLength(_vm->_graphicsMan->_frontBuffer);
615 			_vm->_graphicsMan->endDisplayBob();
616 
617 			if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo())
618 				_vm->_soundMan->playSoundFile("SOUND17.WAV");
619 
620 			_vm->_soundMan->_specialSoundNum = 14;
621 			_vm->_graphicsMan->_fadingFl = true;
622 			_vm->_animMan->playSequence2("ASSOM.SEQ", 10, 4, 500);
623 			_vm->_soundMan->_specialSoundNum = 0;
624 			_vm->_globals->_disableInventFl = false;
625 			_vm->_objectsMan->_helicopterFl = true;
626 			break;
627 
628 		case 16:
629 			_vm->_talkMan->startAnimatedCharacterDialogue("ftoubib.pe2");
630 			break;
631 
632 		case 17:
633 			_vm->_talkMan->startAnimatedCharacterDialogue("flic2b.pe2");
634 			break;
635 
636 		case 18:
637 			_vm->_talkMan->startAnimatedCharacterDialogue("fjour.pe2");
638 			break;
639 
640 		case 20:
641 			_vm->_talkMan->startAnimatedCharacterDialogue("PUNK.pe2");
642 			break;
643 
644 		case 21:
645 			_vm->_talkMan->startAnimatedCharacterDialogue("MEDLEG.pe2");
646 			break;
647 
648 		case 22:
649 			_vm->_talkMan->animateObject("CADAVRE1.pe2");
650 			break;
651 
652 		case 23:
653 			_vm->_talkMan->startStaticCharacterDialogue("CHERCHE1.pe2");
654 			break;
655 
656 		case 25:
657 			_vm->_talkMan->startAnimatedCharacterDialogue("AGENT1.pe2");
658 			break;
659 
660 		case 26:
661 			_vm->_talkMan->startAnimatedCharacterDialogue("AGENT2.pe2");
662 			break;
663 
664 		case 27:
665 			if (_vm->_globals->_saveData->_data[svField94] != 1 || _vm->_globals->_saveData->_data[svField95] != 1)
666 				_vm->_talkMan->startAnimatedCharacterDialogue("STANDAR.pe2");
667 			else
668 				_vm->_talkMan->startAnimatedCharacterDialogue("STANDAR1.pe2");
669 			break;
670 
671 		case 29:
672 			_vm->_globals->_disableInventFl = true;
673 			_vm->_talkMan->animateObject("TELEP.pe2");
674 			_vm->_globals->_disableInventFl = false;
675 			break;
676 
677 		case 32:
678 			_vm->_talkMan->startAnimatedCharacterDialogue("SAMAN.pe2");
679 			break;
680 
681 		case 35:
682 			if (!_vm->_soundMan->_soundOffFl) {
683 				do {
684 					if (_vm->shouldQuit())
685 						return -1; // Exiting game
686 
687 					_vm->_events->refreshScreenAndEvents();
688 				} while (_vm->_soundMan->_soundFl);
689 			}
690 			_vm->_talkMan->startAnimatedCharacterDialogue("PTLAB.pe2");
691 			break;
692 
693 		case 36:
694 			if (_vm->_globals->_saveData->_data[svField270] == 2 && _vm->_globals->_saveData->_data[svField94] == 1 && _vm->_globals->_saveData->_data[svField95] == 1)
695 				_vm->_globals->_saveData->_data[svField270] = 3;
696 
697 			switch (_vm->_globals->_saveData->_data[svField270]) {
698 			case 0:
699 				_vm->_talkMan->startStaticCharacterDialogue("PATRON0.pe2");
700 				break;
701 			case 1:
702 				_vm->_talkMan->startStaticCharacterDialogue("PATRON1.pe2");
703 				break;
704 			case 2:
705 				_vm->_talkMan->startStaticCharacterDialogue("PATRON2.pe2");
706 				break;
707 			case 3:
708 				_vm->_talkMan->startStaticCharacterDialogue("PATRON3.pe2");
709 				break;
710 			default:
711 				if (_vm->_globals->_saveData->_data[svField270] > 3) {
712 					_vm->_talkMan->startStaticCharacterDialogue("PATRON4.pe2");
713 					_vm->_globals->_saveData->_data[svField270] = 5;
714 				}
715 				break;
716 			}
717 			break;
718 
719 		case 37:
720 			_vm->_graphicsMan->_fadingFl = true;
721 			_vm->_animMan->playSequence2("corde.SEQ", 32, 32, 100);
722 			_vm->_graphicsMan->_noFadingFl = true;
723 			break;
724 
725 		case 38:
726 			_vm->_soundMan->loadSample(1, "SOUND44.WAV");
727 			_vm->_soundMan->loadSample(2, "SOUND42.WAV");
728 			_vm->_soundMan->loadSample(3, "SOUND41.WAV");
729 			_vm->_soundMan->_specialSoundNum = 17;
730 			_vm->_animMan->playSequence("grenade.SEQ", 1, 32, 100, false, false);
731 			_vm->_soundMan->_specialSoundNum = 0;
732 			_vm->_graphicsMan->_fadingFl = true;
733 			_vm->_animMan->playAnim("CREVE17.ANM", "CREVE17.ANM", 24, 24, 200);
734 			_vm->_soundMan->removeSample(1);
735 			_vm->_soundMan->removeSample(2);
736 			_vm->_soundMan->removeSample(3);
737 			_vm->_graphicsMan->_noFadingFl = true;
738 			break;
739 
740 		case 40:
741 			_vm->_talkMan->startAnimatedCharacterDialogue("MAGE.pe2");
742 			break;
743 
744 		case 41:
745 			_vm->_talkMan->startAnimatedCharacterDialogue("MORT3.pe2");
746 			break;
747 
748 		case 42:
749 			_vm->_talkMan->startAnimatedCharacterDialogue("MORT2.pe2");
750 			break;
751 
752 		case 43:
753 			_vm->_talkMan->startAnimatedCharacterDialogue("MORT1.pe2");
754 			break;
755 
756 		case 44:
757 			_vm->_talkMan->startAnimatedCharacterDialogue("MORT3A.pe2");
758 			break;
759 
760 		case 45:
761 			_vm->_talkMan->startAnimatedCharacterDialogue("FEM3.pe2");
762 			break;
763 
764 		case 46: {
765 			_vm->_globals->_checkDistanceFl = true;
766 			_vm->_linesMan->_route = (RouteItem *)NULL;
767 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 564, 420);
768 			_vm->_objectsMan->_zoneNum = -1;
769 			do {
770 				if (_vm->shouldQuit())
771 					return -1; // Exiting game
772 
773 				_vm->_objectsMan->goHome();
774 				_vm->_events->refreshScreenAndEvents();
775 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
776 			_vm->_objectsMan->removeSprite(0);
777 			_vm->_globals->_checkDistanceFl = true;
778 			_vm->_soundMan->loadSample(1, "SOUND44.WAV");
779 			_vm->_soundMan->loadSample(2, "SOUND45.WAV");
780 			_vm->_objectsMan->setMultiBobAnim(9, 10, 0, 0);
781 			bool playFl = false;
782 			for (;;) {
783 				if (_vm->shouldQuit())
784 					return -1; // Exiting game
785 
786 				switch (_vm->_objectsMan->getBobAnimDataIdx(9)) {
787 				case 4:
788 				case 16:
789 				case 28:
790 					if (!playFl) {
791 						_vm->_soundMan->playSample(1);
792 						playFl = true;
793 					}
794 					break;
795 				case 5:
796 				case 17:
797 				case 29:
798 					playFl = false;
799 					break;
800 				}
801 
802 				switch (_vm->_objectsMan->getBobAnimDataIdx(10)) {
803 				case 10:
804 				case 22:
805 				case 33:
806 					if (!playFl) {
807 						_vm->_soundMan->playSample(2);
808 						playFl = true;
809 					}
810 					break;
811 				case 11:
812 					playFl = false;
813 					break;
814 				case 12:
815 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 249, 1);
816 					break;
817 				case 23:
818 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 249, 2);
819 					playFl = false;
820 					break;
821 				case 34:
822 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 249, 3);
823 					playFl = false;
824 					break;
825 				}
826 				_vm->_events->refreshScreenAndEvents();
827 				if (_vm->_objectsMan->getBobAnimDataIdx(9) == 36)
828 					break;
829 			}
830 			_vm->_objectsMan->animateSprite(0);
831 			_vm->_objectsMan->stopBobAnimation(9);
832 			_vm->_objectsMan->stopBobAnimation(10);
833 			_vm->_soundMan->removeSample(1);
834 			_vm->_soundMan->removeSample(2);
835 			break;
836 			}
837 
838 		case 47:
839 			_vm->_talkMan->startAnimatedCharacterDialogue("BARMAN.pe2");
840 			break;
841 
842 		case 48:
843 			_vm->_talkMan->startAnimatedCharacterDialogue("SAMAN2.pe2");
844 			break;
845 
846 		case 49: {
847 			_vm->_objectsMan->disableHidingBehavior();
848 			_vm->_objectsMan->removeSprite(0);
849 			_vm->_objectsMan->setMultiBobAnim(9, 10, 0, 0);
850 
851 			int endIdx;
852 			if (_vm->_globals->_saveData->_data[svField133] == 1)
853 				endIdx = 41;
854 			else
855 				endIdx = 12;
856 			bool playFl = false;
857 			for (;;) {
858 				if (_vm->shouldQuit())
859 					return -1; // Exiting game
860 
861 				switch (_vm->_objectsMan->getBobAnimDataIdx(9)) {
862 				case 4:
863 				case 18:
864 					if (!playFl) {
865 						_vm->_soundMan->directPlayWav("SOUND44.WAV");
866 						playFl = true;
867 					}
868 					break;
869 				case 5:
870 				case 9:
871 					playFl = false;
872 					break;
873 				}
874 
875 				switch (_vm->_objectsMan->getBobAnimDataIdx(10)) {
876 				case 11:
877 					if (!playFl) {
878 						_vm->_soundMan->directPlayWav("SOUND45.WAV");
879 						playFl = true;
880 					}
881 					break;
882 				case 12:
883 					playFl = false;
884 					break;
885 				}
886 				_vm->_events->refreshScreenAndEvents();
887 				if (_vm->_objectsMan->getBobAnimDataIdx(9) == endIdx)
888 					break;
889 			}
890 
891 			if (endIdx == 12) {
892 				_vm->_objectsMan->animateSprite(0);
893 				_vm->_objectsMan->stopBobAnimation(9);
894 			}
895 			_vm->_objectsMan->enableHidingBehavior();
896 			break;
897 			}
898 
899 		case 50:
900 			_vm->_soundMan->playSoundFile("SOUND46.WAv");
901 			_vm->_objectsMan->setAndPlayAnim(11, 0, 23, false);
902 			break;
903 
904 		case 51: {
905 			_vm->_graphicsMan->fadeOutLong();
906 			_vm->_objectsMan->disableHidingBehavior();
907 			_vm->_objectsMan->removeSprite(0);
908 			_vm->_fontMan->hideText(5);
909 			_vm->_fontMan->hideText(9);
910 			_vm->_graphicsMan->endDisplayBob();
911 			_vm->_graphicsMan->loadImage("IM20f");
912 			_vm->_animMan->loadAnim("ANIM20f");
913 			_vm->_graphicsMan->displayAllBob();
914 			_vm->_events->mouseOff();
915 			_vm->_graphicsMan->fadeInLong();
916 			_vm->_soundMan->loadWav("SOUND46.WAV", 1);
917 			bool playFl = false;
918 			for (;;) {
919 				if (_vm->shouldQuit())
920 					return -1; // Exiting game
921 
922 				if (_vm->_objectsMan->getBobAnimDataIdx(12) == 5 && !playFl) {
923 					_vm->_soundMan->playWav(1);
924 					playFl = true;
925 				}
926 				_vm->_events->refreshScreenAndEvents();
927 				if (_vm->_objectsMan->getBobAnimDataIdx(12) == 34)
928 					break;
929 			}
930 			_vm->_objectsMan->stopBobAnimation(2);
931 			_vm->_graphicsMan->fadeOutLong();
932 			_vm->_graphicsMan->_noFadingFl = true;
933 			_vm->_globals->_exitId = 20;
934 			break;
935 			}
936 
937 		case 52:
938 			_vm->_globals->_introSpeechOffFl = true;
939 			_vm->_talkMan->startAnimatedCharacterDialogue("GARDE.PE2");
940 			_vm->_globals->_introSpeechOffFl = false;
941 			break;
942 
943 		case 53:
944 			_vm->_talkMan->startAnimatedCharacterDialogue("GARDE1.pe2");
945 			break;
946 
947 		case 54:
948 			_vm->_talkMan->startAnimatedCharacterDialogue("GARDE2.pe2");
949 			break;
950 
951 		case 55:
952 			_vm->_objectsMan->stopBobAnimation(1);
953 			_vm->_objectsMan->setAndPlayAnim(15, 0, 12, false);
954 			_vm->_objectsMan->stopBobAnimation(15);
955 			_vm->_objectsMan->loadLinkFile("IM19a", true);
956 			break;
957 
958 		case 56:
959 			_vm->_globals->_characterSpriteBuf = _vm->_fileIO->loadFile("HOPFEM.SPR");
960 			_vm->_globals->_characterType = CHARACTER_HOPKINS_CLONE;
961 			_vm->_globals->_saveData->_data[svAlternateSpriteFl] = 1;
962 			_vm->_globals->loadCharacterData();
963 			_vm->_objectsMan->_sprite[0]._deltaX = 28;
964 			_vm->_objectsMan->_sprite[0]._deltaY = 155;
965 			_vm->_objectsMan->_sprite[0]._spriteData = _vm->_globals->_characterSpriteBuf;
966 			_vm->_objectsMan->computeAndSetSpriteSize();
967 			break;
968 
969 		case 57:
970 			_vm->_globals->_characterSpriteBuf = _vm->_fileIO->loadFile("PERSO.SPR");
971 			_vm->_globals->_characterType = CHARACTER_HOPKINS;
972 			_vm->_globals->_saveData->_data[svAlternateSpriteFl] = 0;
973 			_vm->_globals->loadCharacterData();
974 			_vm->_objectsMan->_sprite[0]._deltaX = 34;
975 			_vm->_objectsMan->_sprite[0]._deltaY = 190;
976 			_vm->_objectsMan->_sprite[0]._spriteData = _vm->_globals->_characterSpriteBuf;
977 			_vm->_objectsMan->computeAndSetSpriteSize();
978 			break;
979 
980 		case 58:
981 			_vm->_globals->_introSpeechOffFl = true;
982 			_vm->_talkMan->startAnimatedCharacterDialogue("Gm1.PE2");
983 			_vm->_globals->_saveData->_data[svField176] = 1;
984 			_vm->_globals->_saveData->_data[svField270] = 2;
985 			_vm->_globals->_introSpeechOffFl = false;
986 			break;
987 
988 		case 59: {
989 			_vm->_globals->_checkDistanceFl = true;
990 			_vm->_objectsMan->_oldCharacterPosX = _vm->_objectsMan->getSpriteX(0);
991 			_vm->_objectsMan->resetOldDirection();
992 			_vm->_objectsMan->resetHomeRateCounter();
993 			_vm->_linesMan->_route = (RouteItem *)NULL;
994 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 445, 332);
995 			_vm->_globals->_checkDistanceFl = true;
996 			do {
997 				if (_vm->shouldQuit())
998 					return -1; // Exiting game
999 
1000 				_vm->_objectsMan->goHome();
1001 				_vm->_events->refreshScreenAndEvents();
1002 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
1003 			_vm->_objectsMan->removeSprite(0);
1004 			_vm->_objectsMan->setBobAnimation(7);
1005 			_vm->_objectsMan->setBobAnimDataIdx(7, 0);
1006 			bool playFl = false;
1007 			_vm->_soundMan->loadSample(1, "SOUND40.WAV");
1008 			for (;;) {
1009 				if (_vm->shouldQuit())
1010 					return -1; // Exiting game
1011 
1012 				switch (_vm->_objectsMan->getBobAnimDataIdx(7)) {
1013 				case 10:
1014 				case 18:
1015 					if (!playFl) {
1016 						_vm->_soundMan->playSample(1);
1017 						playFl = true;
1018 					}
1019 					break;
1020 				case 11:
1021 					playFl = false;
1022 					break;
1023 				case 19:
1024 					_vm->_objectsMan->setBobAnimation(3);
1025 					playFl = false;
1026 					break;
1027 				}
1028 				_vm->_events->refreshScreenAndEvents();
1029 				if (_vm->_objectsMan->getBobAnimDataIdx(3) == 48)
1030 					break;
1031 			}
1032 			_vm->_soundMan->removeSample(1);
1033 			_vm->_objectsMan->setSpriteIndex(0, 62);
1034 			_vm->_objectsMan->animateSprite(0);
1035 			_vm->_objectsMan->setBobAnimation(6);
1036 			_vm->_objectsMan->stopBobAnimation(7);
1037 			_vm->_objectsMan->stopBobAnimation(3);
1038 			break;
1039 			}
1040 
1041 		case 62:
1042 			_vm->_talkMan->animateObject("SBCADA.pe2");
1043 			break;
1044 
1045 		case 65:
1046 			_vm->_talkMan->animateObject("ScCADA.pe2");
1047 			break;
1048 
1049 		case 80: {
1050 			_vm->_objectsMan->removeSprite(0);
1051 			_vm->_objectsMan->setBobAnimation(12);
1052 			_vm->_objectsMan->setBobAnimation(13);
1053 			_vm->_objectsMan->setBobAnimDataIdx(12, 0);
1054 			_vm->_objectsMan->setBobAnimDataIdx(13, 0);
1055 			_vm->_soundMan->loadWav("SOUND44.WAV", 1);
1056 			_vm->_soundMan->loadWav("SOUND71.WAV", 2);
1057 			bool playFl = false;
1058 			for (;;) {
1059 				if (_vm->shouldQuit())
1060 					return -1; // Exiting game
1061 
1062 				switch (_vm->_objectsMan->getBobAnimDataIdx(12)) {
1063 				case 4:
1064 					if (!playFl) {
1065 						_vm->_soundMan->playWav(1);
1066 						playFl = true;
1067 					}
1068 					break;
1069 				case 5:
1070 					playFl = false;
1071 					break;
1072 				}
1073 
1074 				switch (_vm->_objectsMan->getBobAnimDataIdx(4)) {
1075 				case 5:
1076 					if (!playFl) {
1077 						_vm->_soundMan->playWav(2);
1078 						playFl = true;
1079 					}
1080 					break;
1081 				case 6:
1082 					playFl = false;
1083 					break;
1084 				}
1085 
1086 				if (_vm->_objectsMan->getBobAnimDataIdx(13) == 8) {
1087 					_vm->_objectsMan->stopBobAnimation(13);
1088 					_vm->_objectsMan->stopBobAnimation(3);
1089 					_vm->_objectsMan->setBobAnimation(4);
1090 					_vm->_objectsMan->setBobAnimDataIdx(4, 0);
1091 					_vm->_objectsMan->setBobAnimDataIdx(13, 0);
1092 				}
1093 
1094 				_vm->_events->refreshScreenAndEvents();
1095 				if (_vm->_objectsMan->getBobAnimDataIdx(4) == 16)
1096 					break;
1097 			}
1098 			_vm->_objectsMan->stopBobAnimation(12);
1099 			_vm->_objectsMan->stopBobAnimation(4);
1100 			_vm->_objectsMan->animateSprite(0);
1101 			_vm->_objectsMan->loadLinkFile("IM27a", true);
1102 			break;
1103 			}
1104 
1105 		case 81: {
1106 			_vm->_globals->_checkDistanceFl = true;
1107 			_vm->_objectsMan->_oldCharacterPosX = _vm->_objectsMan->getSpriteX(0);
1108 			_vm->_objectsMan->resetOldDirection();
1109 			_vm->_objectsMan->resetHomeRateCounter();
1110 			_vm->_linesMan->_route = (RouteItem *)NULL;
1111 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 119, 268);
1112 			_vm->_globals->_checkDistanceFl = true;
1113 			do {
1114 				if (_vm->shouldQuit())
1115 					return -1; // Exiting game
1116 
1117 				_vm->_objectsMan->goHome();
1118 				_vm->_events->refreshScreenAndEvents();
1119 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
1120 			_vm->_objectsMan->removeSprite(0);
1121 			_vm->_objectsMan->setBobAnimation(11);
1122 			_vm->_objectsMan->setBobAnimation(8);
1123 			_vm->_objectsMan->setBobAnimDataIdx(11, 0);
1124 			_vm->_objectsMan->setBobAnimDataIdx(8, 0);
1125 			_vm->_soundMan->loadWav("SOUND44.WAV", 1);
1126 			_vm->_soundMan->loadWav("SOUND48.WAV", 2);
1127 			_vm->_soundMan->loadWav("SOUND49.WAV", 3);
1128 			bool playFl = false;
1129 			for (;;) {
1130 				if (_vm->shouldQuit())
1131 					return -1; // Exiting game
1132 
1133 				switch (_vm->_objectsMan->getBobAnimDataIdx(11)) {
1134 				case 4:
1135 					if (!playFl) {
1136 						_vm->_soundMan->playWav(1);
1137 						playFl = true;
1138 					}
1139 					break;
1140 				case 5:
1141 					playFl = false;
1142 					break;
1143 				}
1144 
1145 				switch (_vm->_objectsMan->getBobAnimDataIdx(8)) {
1146 				case 11:
1147 					if (!playFl) {
1148 						_vm->_soundMan->playWav(2);
1149 						playFl = true;
1150 					}
1151 					break;
1152 				case 12:
1153 					playFl = false;
1154 					break;
1155 				}
1156 
1157 				_vm->_events->refreshScreenAndEvents();
1158 				if (_vm->_objectsMan->getBobAnimDataIdx(8) == 32)
1159 					break;
1160 			}
1161 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 201, 14, 1);
1162 			_vm->_objectsMan->animateSprite(0);
1163 			_vm->_objectsMan->stopBobAnimation(11);
1164 			_vm->_objectsMan->stopBobAnimation(8);
1165 			_vm->_objectsMan->setBobAnimation(5);
1166 			_vm->_objectsMan->setBobAnimation(6);
1167 			_vm->_objectsMan->setBobAnimDataIdx(5, 0);
1168 			_vm->_objectsMan->setBobAnimDataIdx(6, 0);
1169 			_vm->_soundMan->playWav(3);
1170 			do {
1171 				if (_vm->shouldQuit())
1172 					return -1; // Exiting game
1173 
1174 				_vm->_events->refreshScreenAndEvents();
1175 			} while (_vm->_objectsMan->getBobAnimDataIdx(5) != 74);
1176 			_vm->_objectsMan->stopBobAnimation(5);
1177 			_vm->_objectsMan->stopBobAnimation(6);
1178 			_vm->_objectsMan->setBobAnimation(9);
1179 			_vm->_objectsMan->setBobAnimation(7);
1180 			break;
1181 			}
1182 
1183 		case 83:
1184 			_vm->_talkMan->startAnimatedCharacterDialogue("CVIGIL.pe2");
1185 			break;
1186 
1187 		case 84:
1188 			_vm->_globals->_introSpeechOffFl = true;
1189 			_vm->_talkMan->startAnimatedCharacterDialogue("CVIGIL1.PE2");
1190 			_vm->_globals->_introSpeechOffFl = false;
1191 			break;
1192 
1193 		case 85:
1194 			_vm->_objectsMan->stopBobAnimation(3);
1195 			_vm->_objectsMan->setBobAnimation(5);
1196 			_vm->_objectsMan->setBobAnimDataIdx(5, 0);
1197 			do {
1198 				if (_vm->shouldQuit())
1199 					return -1; // Exiting game
1200 
1201 				_vm->_events->refreshScreenAndEvents();
1202 			} while (_vm->_objectsMan->getBobAnimDataIdx(5) != 6);
1203 			_vm->_objectsMan->stopBobAnimation(5);
1204 			_vm->_objectsMan->setBobAnimation(6);
1205 			_vm->_objectsMan->loadLinkFile("IM24a", true);
1206 			break;
1207 
1208 		case 86:
1209 			if (_vm->_globals->_saveData->_data[svField231] == 1) {
1210 				_vm->_talkMan->startAnimatedCharacterDialogue("chotess1.pe2");
1211 			} else {
1212 				_vm->_globals->_introSpeechOffFl = true;
1213 				_vm->_talkMan->startAnimatedCharacterDialogue("chotesse.pe2");
1214 				_vm->_globals->_introSpeechOffFl = false;
1215 			}
1216 			break;
1217 
1218 		case 87:
1219 			if (_vm->_globals->_saveData->_data[svField188])
1220 				_vm->_talkMan->startAnimatedCharacterDialogue("stand2.pe2");
1221 			else
1222 				_vm->_talkMan->startAnimatedCharacterDialogue("stand1.pe2");
1223 			break;
1224 
1225 		case 88:
1226 			// Shooting target - Shooting at target
1227 			if (_vm->_globals->_saveData->_data[svField183] == 1) {
1228 				_vm->_objectsMan->setBobAnimDataIdx(1, 0);
1229 				_vm->_objectsMan->setBobAnimDataIdx(2, 0);
1230 				_vm->_objectsMan->setBobAnimation(1);
1231 				_vm->_objectsMan->setBobAnimation(2);
1232 				_vm->_soundMan->loadSample(1, "SOUND40.WAV");
1233 				bool playFl = false;
1234 				for (;;) {
1235 					if (_vm->shouldQuit())
1236 						return -1; // Exiting game
1237 
1238 					switch (_vm->_objectsMan->getBobAnimDataIdx(1)) {
1239 					case 1:
1240 					case 3:
1241 					case 5:
1242 					case 7:
1243 						if (!playFl) {
1244 							_vm->_soundMan->playSample(1);
1245 							playFl = true;
1246 						}
1247 						break;
1248 					case 2:
1249 					case 4:
1250 					case 6:
1251 					case 8:
1252 						playFl = false;
1253 						break;
1254 					}
1255 					_vm->_events->refreshScreenAndEvents();
1256 					if (_vm->_objectsMan->getBobAnimDataIdx(1) == 9)
1257 						break;
1258 				}
1259 				_vm->_objectsMan->stopBobAnimation(1);
1260 				_vm->_objectsMan->stopBobAnimation(2);
1261 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 160, 6);
1262 				_vm->_soundMan->removeSample(1);
1263 			}
1264 			if (_vm->_globals->_saveData->_data[svField183] == 2) {
1265 				_vm->_objectsMan->setBobAnimDataIdx(1, 0);
1266 				_vm->_objectsMan->setBobAnimDataIdx(3, 0);
1267 				_vm->_objectsMan->setBobAnimation(1);
1268 				_vm->_objectsMan->setBobAnimation(3);
1269 				_vm->_soundMan->loadSample(1, "SOUND40.WAV");
1270 				bool playFl = false;
1271 				for (;;) {
1272 					if (_vm->shouldQuit())
1273 						return -1; // Exiting game
1274 
1275 					switch (_vm->_objectsMan->getBobAnimDataIdx(1)) {
1276 					case 1:
1277 					case 3:
1278 					case 5:
1279 					case 7:
1280 						if (!playFl) {
1281 							_vm->_soundMan->playSample(1);
1282 							playFl = true;
1283 						}
1284 						break;
1285 					case 2:
1286 					case 4:
1287 					case 6:
1288 					case 8:
1289 						playFl = false;
1290 						break;
1291 					}
1292 					_vm->_events->refreshScreenAndEvents();
1293 					if (_vm->_objectsMan->getBobAnimDataIdx(1) == 9)
1294 						break;
1295 				}
1296 				_vm->_objectsMan->stopBobAnimation(1);
1297 				_vm->_objectsMan->stopBobAnimation(3);
1298 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 161, 8);
1299 				_vm->_soundMan->removeSample(1);
1300 			}
1301 			break;
1302 
1303 		case 90:
1304 			// Shooting target - Using the level
1305 			_vm->_soundMan->playSoundFile("SOUND52.WAV");
1306 			if (!_vm->_globals->_saveData->_data[svField186]) {
1307 				_vm->_animMan->playSequence("CIB5A.SEQ", 1, 12, 1, false, false);
1308 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0);
1309 			} else if (_vm->_globals->_saveData->_data[svField186] == 1) {
1310 				_vm->_animMan->playSequence("CIB5C.SEQ", 1, 12, 1, false, false);
1311 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0);
1312 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 329, 87, 2);
1313 			}
1314 			break;
1315 
1316 		case 91:
1317 			_vm->_soundMan->playSoundFile("SOUND52.WAV");
1318 			if (!_vm->_globals->_saveData->_data[svField186]) {
1319 				_vm->_animMan->playSequence("CIB5B.SEQ", 1, 12, 1, false, false);
1320 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5);
1321 			} else if (_vm->_globals->_saveData->_data[svField186] == 1) {
1322 				_vm->_animMan->playSequence("CIB5D.SEQ", 1, 12, 1, false, false);
1323 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5);
1324 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 160, 6);
1325 			}
1326 			break;
1327 
1328 		case 92:
1329 			_vm->_soundMan->playSoundFile("SOUND52.WAV");
1330 			if (!_vm->_globals->_saveData->_data[svField184]) {
1331 				_vm->_animMan->playSequence("CIB6A.SEQ", 1, 12, 1, false, false);
1332 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0);
1333 			} else if (_vm->_globals->_saveData->_data[svField184] == 1) {
1334 				_vm->_animMan->playSequence("CIB6C.SEQ", 1, 12, 1, false, false);
1335 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 0);
1336 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 293, 139, 3);
1337 			}
1338 			break;
1339 
1340 		case 93:
1341 			_vm->_soundMan->playSoundFile("SOUND52.WAV");
1342 			if (!_vm->_globals->_saveData->_data[svField184]) {
1343 				_vm->_animMan->playSequence("CIB6B.SEQ", 1, 12, 1, false, false);
1344 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5);
1345 			} else if (_vm->_globals->_saveData->_data[svField184] == 1) {
1346 				_vm->_animMan->playSequence("CIB6D.SEQ", 1, 12, 1, false, false);
1347 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 155, 29, 5);
1348 				_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 283, 161, 8);
1349 			}
1350 			break;
1351 
1352 		case 94:
1353 			if (!_vm->_globals->_saveData->_data[svField228])
1354 				_vm->_talkMan->startAnimatedCharacterDialogue("flicn.pe2");
1355 			else if (_vm->_globals->_saveData->_data[svField228] == 1)
1356 				_vm->_talkMan->startAnimatedCharacterDialogue("flicn1.pe2");
1357 			break;
1358 
1359 		case 95:
1360 			_vm->_objectsMan->setBobAnimation(9);
1361 			_vm->_objectsMan->setBobAnimation(10);
1362 			_vm->_objectsMan->setBobAnimation(12);
1363 			_vm->_objectsMan->setBobAnimDataIdx(9, 0);
1364 			_vm->_objectsMan->setBobAnimDataIdx(10, 0);
1365 			_vm->_objectsMan->setBobAnimDataIdx(12, 0);
1366 			_vm->_objectsMan->removeSprite(0);
1367 			do {
1368 				if (_vm->shouldQuit())
1369 					return -1; // Exiting game
1370 
1371 				_vm->_events->refreshScreenAndEvents();
1372 			} while (_vm->_objectsMan->getBobAnimDataIdx(9) != 15);
1373 			_vm->_objectsMan->stopBobAnimation(9);
1374 			_vm->_objectsMan->animateSprite(0);
1375 			_vm->_soundMan->playSoundFile("SOUND50.WAV");
1376 			do {
1377 				if (_vm->shouldQuit())
1378 					return -1; // Exiting game
1379 
1380 				_vm->_events->refreshScreenAndEvents();
1381 			} while (_vm->_objectsMan->getBobAnimDataIdx(12) != 117);
1382 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 830, 122, 0);
1383 			_vm->_objectsMan->stopBobAnimation(12);
1384 			_vm->_objectsMan->stopBobAnimation(10);
1385 			_vm->_objectsMan->setBobAnimation(11);
1386 			break;
1387 
1388 		case 98:
1389 			_vm->_globals->_introSpeechOffFl = true;
1390 			_vm->_talkMan->startAnimatedCharacterDialogue("CVIGIL2.PE2");
1391 			_vm->_globals->_introSpeechOffFl = false;
1392 			break;
1393 
1394 		case 100:
1395 			_vm->_talkMan->startAnimatedCharacterDialogue("tourist.pe2");
1396 			break;
1397 
1398 		case 101:
1399 			_vm->_talkMan->startAnimatedCharacterDialogue("tahi1.pe2");
1400 			break;
1401 
1402 		case 103:
1403 			// Dice game
1404 			_vm->_globals->_introSpeechOffFl = true;
1405 			_vm->_talkMan->startAnimatedCharacterDialogue("tourist1.pe2");
1406 			_vm->_globals->_introSpeechOffFl = false;
1407 				_vm->_animMan->playAnim2("T421A.ANM", "T421.ANM", 100, 14, 500);
1408 			_vm->_events->refreshScreenAndEvents();
1409 			_vm->_events->refreshScreenAndEvents();
1410 			_vm->_events->refreshScreenAndEvents();
1411 			_vm->_globals->_introSpeechOffFl = true;
1412 			_vm->_talkMan->startAnimatedCharacterDialogue("tourist2.pe2");
1413 			_vm->_globals->_introSpeechOffFl = false;
1414 			break;
1415 
1416 		case 104:
1417 			_vm->_globals->_introSpeechOffFl = true;
1418 			_vm->_talkMan->startAnimatedCharacterDialogue("tourist3.pe2");
1419 			_vm->_globals->_introSpeechOffFl = false;
1420 			break;
1421 
1422 		case 105:
1423 			_vm->_globals->_checkDistanceFl = true;
1424 			_vm->_objectsMan->_oldCharacterPosX = _vm->_objectsMan->getSpriteX(0);
1425 			_vm->_objectsMan->resetOldDirection();
1426 			_vm->_objectsMan->resetHomeRateCounter();
1427 			_vm->_linesMan->_route = (RouteItem *)NULL;
1428 			switch (_vm->_globals->_saveData->_data[svField253]) {
1429 			case 1:
1430 				_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 201, 294);
1431 				break;
1432 			case 2:
1433 				_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 158, 338);
1434 				break;
1435 			default:
1436 				if (_vm->_globals->_saveData->_data[svField253] > 2)
1437 					_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 211, 393);
1438 				break;
1439 			}
1440 			_vm->_globals->_checkDistanceFl = true;
1441 			do {
1442 				if (_vm->shouldQuit())
1443 					return -1; // Exiting game
1444 
1445 				_vm->_objectsMan->goHome();
1446 				_vm->_events->refreshScreenAndEvents();
1447 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
1448 			_vm->_objectsMan->removeSprite(0);
1449 			_vm->_objectsMan->setSpriteIndex(0, 60);
1450 			_vm->_soundMan->loadSample(1, "SOUND63.WAV");
1451 			if (_vm->_globals->_saveData->_data[svField253] > 2) {
1452 				_vm->_objectsMan->setBobAnimation(4);
1453 				bool playFl = false;
1454 				for (;;) {
1455 					if (_vm->shouldQuit())
1456 						return -1; // Exiting game
1457 
1458 					switch (_vm->_objectsMan->getBobAnimDataIdx(4)) {
1459 					case 9:
1460 					case 32:
1461 					case 55:
1462 						if (!playFl) {
1463 							_vm->_soundMan->playSample(1);
1464 							playFl = true;
1465 						}
1466 						break;
1467 					case 10:
1468 					case 33:
1469 					case 56:
1470 						playFl = false;
1471 						break;
1472 					}
1473 					_vm->_events->refreshScreenAndEvents();
1474 					if (_vm->_objectsMan->getBobAnimDataIdx(4) == 72)
1475 						break;
1476 				}
1477 				_vm->_objectsMan->stopBobAnimation(4);
1478 			}
1479 			if (_vm->_globals->_saveData->_data[svField253] == 1) {
1480 				_vm->_objectsMan->setBobAnimation(6);
1481 				bool playFl = false;
1482 				for (;;) {
1483 					if (_vm->shouldQuit())
1484 						return -1; // Exiting game
1485 
1486 					switch (_vm->_objectsMan->getBobAnimDataIdx(6)) {
1487 					case 9:
1488 					case 32:
1489 					case 55:
1490 						if (!playFl) {
1491 							_vm->_soundMan->playSample(1);
1492 							playFl = true;
1493 						}
1494 						break;
1495 					case 10:
1496 					case 33:
1497 					case 56:
1498 						playFl = false;
1499 						break;
1500 					}
1501 					_vm->_events->refreshScreenAndEvents();
1502 					if (_vm->_objectsMan->getBobAnimDataIdx(6) == 72)
1503 						break;
1504 				}
1505 				_vm->_objectsMan->stopBobAnimation(6);
1506 			}
1507 			if (_vm->_globals->_saveData->_data[svField253] == 2) {
1508 				_vm->_objectsMan->setBobAnimation(5);
1509 				bool playFl = false;
1510 				for (;;) {
1511 					if (_vm->shouldQuit())
1512 						return -1; // Exiting game
1513 
1514 					switch (_vm->_objectsMan->getBobAnimDataIdx(5)) {
1515 					case 9:
1516 					case 32:
1517 					case 55:
1518 						if (!playFl) {
1519 							_vm->_soundMan->playSample(1);
1520 							playFl = true;
1521 						}
1522 						break;
1523 					case 10:
1524 					case 33:
1525 					case 56:
1526 						playFl = false;
1527 						break;
1528 					}
1529 					_vm->_events->refreshScreenAndEvents();
1530 					if (_vm->_objectsMan->getBobAnimDataIdx(5) == 72)
1531 						break;
1532 				}
1533 				_vm->_objectsMan->stopBobAnimation(5);
1534 			}
1535 			_vm->_objectsMan->animateSprite(0);
1536 			_vm->_objectsMan->doActionBack(1);
1537 			_vm->_soundMan->removeSample(1);
1538 			break;
1539 
1540 		case 106:
1541 			_vm->_objectsMan->removeSprite(0);
1542 			_vm->_objectsMan->setBobAnimation(4);
1543 			_vm->_objectsMan->setBobAnimDataIdx(4, 0);
1544 			_vm->_soundMan->loadWav("SOUND61.WAV", 1);
1545 			_vm->_soundMan->loadWav("SOUND62.WAV", 2);
1546 			_vm->_soundMan->loadWav("SOUND61.WAV", 3);
1547 			do {
1548 				if (_vm->shouldQuit())
1549 					return -1; // Exiting game
1550 
1551 				_vm->_events->refreshScreenAndEvents();
1552 			} while (_vm->_objectsMan->getBobAnimDataIdx(4) != 10);
1553 			_vm->_soundMan->playWav(1);
1554 			do {
1555 				if (_vm->shouldQuit())
1556 					return -1; // Exiting game
1557 
1558 				_vm->_events->refreshScreenAndEvents();
1559 			} while (_vm->_objectsMan->getBobAnimDataIdx(4) != 18);
1560 			_vm->_soundMan->playWav(2);
1561 			do {
1562 				if (_vm->shouldQuit())
1563 					return -1; // Exiting game
1564 
1565 				_vm->_events->refreshScreenAndEvents();
1566 			} while (_vm->_objectsMan->getBobAnimDataIdx(4) != 62);
1567 			_vm->_soundMan->playWav(3);
1568 			do {
1569 				if (_vm->shouldQuit())
1570 					return -1; // Exiting game
1571 
1572 				_vm->_events->refreshScreenAndEvents();
1573 			} while (_vm->_objectsMan->getBobAnimDataIdx(4) != 77);
1574 			_vm->_objectsMan->stopBobAnimation(4);
1575 			_vm->_objectsMan->animateSprite(0);
1576 			break;
1577 
1578 		case 107:
1579 			_vm->_objectsMan->removeSprite(0);
1580 			_vm->_objectsMan->setBobAnimation(5);
1581 			_vm->_objectsMan->setBobAnimDataIdx(5, 0);
1582 			_vm->_soundMan->loadWav("SOUND61.WAV", 1);
1583 			_vm->_soundMan->loadWav("SOUND62.WAV", 2);
1584 			_vm->_soundMan->loadWav("SOUND61.WAV", 3);
1585 			do {
1586 				if (_vm->shouldQuit())
1587 					return -1; // Exiting game
1588 
1589 				_vm->_events->refreshScreenAndEvents();
1590 			} while (_vm->_objectsMan->getBobAnimDataIdx(5) != 10);
1591 			_vm->_soundMan->playWav(1);
1592 			do {
1593 				if (_vm->shouldQuit())
1594 					return -1; // Exiting game
1595 
1596 				_vm->_events->refreshScreenAndEvents();
1597 			} while (_vm->_objectsMan->getBobAnimDataIdx(5) != 18);
1598 			_vm->_soundMan->playWav(2);
1599 			do {
1600 				if (_vm->shouldQuit())
1601 					return -1; // Exiting game
1602 
1603 				_vm->_events->refreshScreenAndEvents();
1604 			} while (_vm->_objectsMan->getBobAnimDataIdx(5) != 38);
1605 			_vm->_soundMan->playWav(3);
1606 			do {
1607 				if (_vm->shouldQuit())
1608 					return -1; // Exiting game
1609 
1610 				_vm->_events->refreshScreenAndEvents();
1611 			} while (_vm->_objectsMan->getBobAnimDataIdx(5) != 53);
1612 			_vm->_objectsMan->stopBobAnimation(5);
1613 			_vm->_objectsMan->animateSprite(0);
1614 			break;
1615 
1616 		case 108:
1617 			_vm->_globals->_introSpeechOffFl = true;
1618 			_vm->_talkMan->startAnimatedCharacterDialogue("peche1.pe2");
1619 			_vm->_globals->_introSpeechOffFl = false;
1620 			break;
1621 
1622 		case 109:
1623 			_vm->_globals->_introSpeechOffFl = true;
1624 			_vm->_talkMan->startAnimatedCharacterDialogue("peche2.pe2");
1625 			_vm->_globals->_introSpeechOffFl = false;
1626 			break;
1627 
1628 		case 110:
1629 			_vm->_globals->_introSpeechOffFl = true;
1630 			_vm->_talkMan->startAnimatedCharacterDialogue("peche3.pe2");
1631 			_vm->_globals->_introSpeechOffFl = false;
1632 			break;
1633 
1634 		case 111:
1635 			_vm->_globals->_introSpeechOffFl = true;
1636 			_vm->_talkMan->startAnimatedCharacterDialogue("peche4.pe2");
1637 			_vm->_globals->_introSpeechOffFl = false;
1638 			break;
1639 
1640 		case 112:
1641 			_vm->_globals->_introSpeechOffFl = true;
1642 			_vm->_talkMan->startAnimatedCharacterDialogue("teint1.pe2");
1643 			_vm->_globals->_introSpeechOffFl = false;
1644 			break;
1645 
1646 		case 113:
1647 			_vm->_talkMan->startAnimatedCharacterDialogue("teint.pe2");
1648 			break;
1649 
1650 		case 114:
1651 			_vm->_talkMan->startAnimatedCharacterDialogue("tahibar.pe2");
1652 			break;
1653 
1654 		case 115:
1655 			_vm->_talkMan->startAnimatedCharacterDialogue("ilebar.pe2");
1656 			break;
1657 
1658 		case 116:
1659 			_vm->_talkMan->startAnimatedCharacterDialogue("Profred.pe2");
1660 			break;
1661 
1662 		case 170:
1663 			_vm->_talkMan->startAnimatedCharacterDialogue("GRED.pe2");
1664 			break;
1665 
1666 		case 171: {
1667 			_vm->_globals->_introSpeechOffFl = true;
1668 			_vm->_talkMan->startAnimatedCharacterDialogue("gred1.pe2");
1669 			_vm->_globals->_introSpeechOffFl = false;
1670 			_vm->_globals->_checkDistanceFl = true;
1671 			_vm->_objectsMan->_oldCharacterPosX = _vm->_objectsMan->getSpriteX(0);
1672 			_vm->_objectsMan->resetOldDirection();
1673 			_vm->_objectsMan->resetHomeRateCounter();
1674 			_vm->_globals->_checkDistanceFl = true;
1675 			_vm->_linesMan->_route = (RouteItem *)NULL;
1676 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 361, 325);
1677 			_vm->_globals->_checkDistanceFl = true;
1678 			_vm->_objectsMan->_zoneNum = -1;
1679 			do {
1680 				if (_vm->shouldQuit())
1681 					return -1; // Exiting game
1682 
1683 				_vm->_objectsMan->goHome();
1684 				_vm->_events->refreshScreenAndEvents();
1685 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
1686 			_vm->_globals->_exitId = 59;
1687 			break;
1688 			}
1689 
1690 		case 172:
1691 			_vm->_talkMan->startAnimatedCharacterDialogue("GBLEU.pe2");
1692 			break;
1693 
1694 		case 173: {
1695 			_vm->_globals->_introSpeechOffFl = true;
1696 			_vm->_talkMan->startAnimatedCharacterDialogue("gbleu1.pe2");
1697 			_vm->_globals->_introSpeechOffFl = false;
1698 			_vm->_globals->_checkDistanceFl = true;
1699 			_vm->_objectsMan->_oldCharacterPosX = _vm->_objectsMan->getSpriteX(0);
1700 			_vm->_objectsMan->resetOldDirection();
1701 			_vm->_objectsMan->resetHomeRateCounter();
1702 			_vm->_globals->_checkDistanceFl = true;
1703 			_vm->_linesMan->_route = (RouteItem *)NULL;
1704 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 361, 325);
1705 			_vm->_globals->_checkDistanceFl = true;
1706 			_vm->_objectsMan->_zoneNum = -1;
1707 			do {
1708 				if (_vm->shouldQuit())
1709 					return -1; // Exiting game
1710 
1711 				_vm->_objectsMan->goHome();
1712 				_vm->_events->refreshScreenAndEvents();
1713 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
1714 			_vm->_globals->_exitId = 59;
1715 			break;
1716 			}
1717 
1718 		case 174:
1719 			_vm->_talkMan->startAnimatedCharacterDialogue("Profbl.pe2");
1720 			break;
1721 
1722 		case 175:
1723 			_vm->_objectsMan->setSpriteIndex(0, 55);
1724 			_vm->_objectsMan->removeSprite(0);
1725 			_vm->_objectsMan->setBobAnimation(9);
1726 			_vm->_objectsMan->setBobAnimation(10);
1727 			_vm->_objectsMan->setBobOffset(10, 300);
1728 			_vm->_soundMan->playSoundFile("SOUND44.WAV");
1729 			do {
1730 				if (_vm->shouldQuit())
1731 					return -1; // Exiting game
1732 
1733 				_vm->_events->refreshScreenAndEvents();
1734 			} while (_vm->_objectsMan->getBobAnimDataIdx(10) != 7);
1735 			_vm->_objectsMan->setBobAnimation(6);
1736 			_vm->_objectsMan->stopBobAnimation(3);
1737 			do {
1738 				if (_vm->shouldQuit())
1739 					return -1; // Exiting game
1740 
1741 				_vm->_events->refreshScreenAndEvents();
1742 			} while (_vm->_objectsMan->getBobAnimDataIdx(6) != 10);
1743 			_vm->_soundMan->playSoundFile("SOUND71.WAV");
1744 			_vm->_objectsMan->setBobAnimation(7);
1745 			_vm->_objectsMan->stopBobAnimation(4);
1746 			do {
1747 				if (_vm->shouldQuit())
1748 					return -1; // Exiting game
1749 
1750 				_vm->_events->refreshScreenAndEvents();
1751 			} while (_vm->_objectsMan->getBobAnimDataIdx(7) != 15);
1752 			_vm->_objectsMan->stopBobAnimation(5);
1753 			_vm->_objectsMan->setBobAnimation(8);
1754 			_vm->_soundMan->playSoundFile("SOUND70.WAV");
1755 			do {
1756 				if (_vm->shouldQuit())
1757 					return -1; // Exiting game
1758 
1759 				_vm->_events->refreshScreenAndEvents();
1760 			} while (_vm->_objectsMan->getBobAnimDataIdx(8) != 76);
1761 			_vm->_objectsMan->stopBobAnimation(6);
1762 			_vm->_objectsMan->stopBobAnimation(7);
1763 			_vm->_objectsMan->stopBobAnimation(8);
1764 			_vm->_objectsMan->stopBobAnimation(9);
1765 			_vm->_objectsMan->stopBobAnimation(10);
1766 			_vm->_objectsMan->animateSprite(0);
1767 			break;
1768 
1769 		case 176:
1770 			_vm->_globals->_introSpeechOffFl = true;
1771 			_vm->_talkMan->startAnimatedCharacterDialogue("gred2.pe2");
1772 			_vm->_globals->_introSpeechOffFl = false;
1773 			break;
1774 
1775 		case 177:
1776 			_vm->_globals->_introSpeechOffFl = true;
1777 			_vm->_talkMan->startAnimatedCharacterDialogue("gbleu2.pe2");
1778 			_vm->_globals->_introSpeechOffFl = false;
1779 			break;
1780 
1781 		case 200:
1782 			_vm->_globals->_introSpeechOffFl = true;
1783 			_vm->_talkMan->startAnimatedCharacterDialogue("Gm2.PE2");
1784 			_vm->_globals->_introSpeechOffFl = false;
1785 			break;
1786 
1787 		case 201:
1788 			_vm->_objectsMan->setBobAnimation(3);
1789 			do {
1790 				if (_vm->shouldQuit())
1791 					return -1; // Exiting game
1792 
1793 				_vm->_events->refreshScreenAndEvents();
1794 			} while (_vm->_objectsMan->getBobAnimDataIdx(3) != 18);
1795 			_vm->_objectsMan->stopBobAnimation(3);
1796 			_vm->_objectsMan->setBobAnimation(4);
1797 			break;
1798 
1799 		case 202:
1800 			_vm->_globals->_introSpeechOffFl = true;
1801 			_vm->_talkMan->startAnimatedCharacterDialogue("SVGARD2.PE2");
1802 			_vm->_globals->_introSpeechOffFl = false;
1803 			break;
1804 
1805 		case 203:
1806 			_vm->_objectsMan->removeSprite(0);
1807 			_vm->_objectsMan->setBobAnimation(4);
1808 			do {
1809 				if (_vm->shouldQuit())
1810 					return -1; // Exiting game
1811 
1812 				_vm->_events->refreshScreenAndEvents();
1813 				if (_vm->_objectsMan->getBobAnimDataIdx(4) == 18)
1814 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 18, 334, 0, false);
1815 			} while (_vm->_objectsMan->getBobAnimDataIdx(4) != 26);
1816 			_vm->_objectsMan->stopBobAnimation(4);
1817 			_vm->_objectsMan->animateSprite(0);
1818 			break;
1819 
1820 		case 204: {
1821 			_vm->_objectsMan->removeSprite(0);
1822 			_vm->_objectsMan->setBobAnimation(3);
1823 			_vm->_soundMan->loadWav("SOUND67.WAV", 1);
1824 			bool playFl = false;
1825 			for (;;) {
1826 				if (_vm->shouldQuit())
1827 					return -1; // Exiting game
1828 
1829 				switch (_vm->_objectsMan->getBobAnimDataIdx(3)) {
1830 				case 10:
1831 					if (!playFl) {
1832 						_vm->_soundMan->playWav(1);
1833 						playFl = true;
1834 					}
1835 					break;
1836 				case 11:
1837 					playFl = false;
1838 					break;
1839 				}
1840 				_vm->_events->refreshScreenAndEvents();
1841 				if (_vm->_objectsMan->getBobAnimDataIdx(3) == 50)
1842 					break;
1843 			}
1844 			_vm->_objectsMan->stopBobAnimation(3);
1845 			_vm->_objectsMan->animateSprite(0);
1846 			break;
1847 			}
1848 
1849 		case 205: {
1850 			_vm->_objectsMan->removeSprite(0);
1851 			_vm->_objectsMan->setBobAnimation(4);
1852 			_vm->_soundMan->loadWav("SOUND69.WAV", 1);
1853 			bool playFl = false;
1854 			for (;;) {
1855 				if (_vm->shouldQuit())
1856 					return -1; // Exiting game
1857 
1858 				switch (_vm->_objectsMan->getBobAnimDataIdx(4)) {
1859 				case 10:
1860 					if (!playFl) {
1861 						_vm->_soundMan->playWav(1);
1862 						playFl = true;
1863 					}
1864 					break;
1865 				case 11:
1866 					playFl = false;
1867 					break;
1868 				}
1869 				_vm->_events->refreshScreenAndEvents();
1870 				if (_vm->_objectsMan->getBobAnimDataIdx(4) == 24)
1871 					break;
1872 			}
1873 			_vm->_objectsMan->stopBobAnimation(4);
1874 			_vm->_objectsMan->animateSprite(0);
1875 			break;
1876 			}
1877 
1878 		case 207:
1879 			_vm->_talkMan->animateObject("PANNEAU.PE2");
1880 			break;
1881 
1882 		case 208: {
1883 			_vm->_globals->_disableInventFl = true;
1884 			if (_vm->_globals->_saveData->_data[svLastPrevScreenId] != _vm->_globals->_saveData->_data[svField401]) {
1885 				_vm->_soundMan->_specialSoundNum = 208;
1886 				_vm->_animMan->playSequence("SORT.SEQ", 10, 4, 10, true, false);
1887 				_vm->_soundMan->_specialSoundNum = 0;
1888 			}
1889 			_vm->_globals->_checkDistanceFl = true;
1890 			_vm->_linesMan->_route = (RouteItem *)NULL;
1891 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 330, 418);
1892 			_vm->_globals->_checkDistanceFl = true;
1893 			_vm->_objectsMan->_zoneNum = 0;
1894 			do {
1895 				if (_vm->shouldQuit())
1896 					return -1; // Exiting game
1897 
1898 				_vm->_objectsMan->goHome();
1899 				_vm->_events->refreshScreenAndEvents();
1900 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
1901 			_vm->_objectsMan->setSpriteIndex(0, 64);
1902 			_vm->_globals->_exitId = _vm->_globals->_saveData->_data[svField401];
1903 			_vm->_globals->_disableInventFl = false;
1904 			break;
1905 			}
1906 
1907 		case 209: {
1908 			_vm->_objectsMan->setBobAnimDataIdx(1, 0);
1909 			_vm->_objectsMan->setBobAnimDataIdx(2, 0);
1910 			_vm->_objectsMan->setSpriteIndex(0, 60);
1911 			_vm->_objectsMan->stopBobAnimation(4);
1912 			_vm->_objectsMan->setBobAnimation(1);
1913 			do {
1914 				if (_vm->shouldQuit())
1915 					return -1; // Exiting game
1916 
1917 				_vm->_events->refreshScreenAndEvents();
1918 			} while (_vm->_objectsMan->getBobAnimDataIdx(1) != 9);
1919 			_vm->_objectsMan->stopBobAnimation(1);
1920 			_vm->_linesMan->_route = (RouteItem *)NULL;
1921 			_vm->_globals->_checkDistanceFl = true;
1922 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 330, 314);
1923 			_vm->_objectsMan->_zoneNum = 0;
1924 			_vm->_globals->_checkDistanceFl = true;
1925 			do {
1926 				if (_vm->shouldQuit())
1927 					return -1; // Exiting game
1928 
1929 				_vm->_objectsMan->goHome();
1930 				_vm->_events->refreshScreenAndEvents();
1931 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
1932 			_vm->_objectsMan->setSpriteIndex(0, 64);
1933 			_vm->_objectsMan->setBobAnimation(2);
1934 			_vm->_soundMan->playSoundFile("SOUND66.WAV");
1935 			do {
1936 				if (_vm->shouldQuit())
1937 					return -1; // Exiting game
1938 
1939 				_vm->_events->refreshScreenAndEvents();
1940 			} while (_vm->_objectsMan->getBobAnimDataIdx(2) != 10);
1941 			_vm->_objectsMan->stopBobAnimation(2);
1942 			_vm->_objectsMan->setBobAnimation(4);
1943 			break;
1944 			}
1945 
1946 		case 210:
1947 			_vm->_soundMan->_specialSoundNum = 210;
1948 			_vm->_animMan->playSequence2("SECRET1.SEQ", 1, 12, 1, true);
1949 			_vm->_soundMan->_specialSoundNum = 0;
1950 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 192, 152, 0);
1951 			_vm->_objectsMan->setBobAnimation(9);
1952 			_vm->_objectsMan->loadLinkFile("IM73a", true);
1953 			_vm->_objectsMan->enableHidingBehavior();
1954 			_vm->_objectsMan->setHidingUseCount(0);
1955 			_vm->_objectsMan->setHidingUseCount(1);
1956 			_vm->_graphicsMan->setColorPercentage2(252, 100, 100, 100);
1957 			_vm->_graphicsMan->setColorPercentage2(253, 100, 100, 100);
1958 			_vm->_graphicsMan->setColorPercentage2(251, 100, 100, 100);
1959 			_vm->_graphicsMan->setColorPercentage2(254, 0, 0, 0);
1960 			break;
1961 
1962 		case 211:
1963 			_vm->_objectsMan->removeSprite(0);
1964 			_vm->_objectsMan->disableHidingBehavior();
1965 			_vm->_soundMan->_specialSoundNum = 211;
1966 			_vm->_animMan->playSequence("SECRET2.SEQ", 1, 12, 100, false, true);
1967 			_vm->_soundMan->_specialSoundNum = 0;
1968 			_vm->_graphicsMan->_noFadingFl = true;
1969 			_vm->_graphicsMan->fadeOutShort();
1970 
1971 			for (int i = 1; i <= 39; i++) {
1972 				if (_vm->shouldQuit())
1973 					return -1; // Exiting game
1974 
1975 				_vm->_events->refreshScreenAndEvents();
1976 			}
1977 
1978 			_vm->_graphicsMan->setColorPercentage2(252, 100, 100, 100);
1979 			_vm->_graphicsMan->setColorPercentage2(253, 100, 100, 100);
1980 			_vm->_graphicsMan->setColorPercentage2(251, 100, 100, 100);
1981 			_vm->_graphicsMan->setColorPercentage2(254, 0, 0, 0);
1982 			break;
1983 
1984 		case 215:
1985 			_vm->_globals->_introSpeechOffFl = true;
1986 			_vm->_talkMan->startAnimatedCharacterDialogue("aviat.pe2");
1987 			_vm->_globals->_introSpeechOffFl = false;
1988 			break;
1989 
1990 		case 216:
1991 			// Discuss with pilot just before Flight cutscene
1992 			_vm->_globals->_introSpeechOffFl = true;
1993 			_vm->_talkMan->startAnimatedCharacterDialogue("aviat1.pe2");
1994 			_vm->_globals->_introSpeechOffFl = false;
1995 			break;
1996 
1997 		case 229:
1998 			_vm->_soundMan->_specialSoundNum = 229;
1999 			_vm->_animMan->playSequence("MUR.SEQ", 1, 12, 1, false, false);
2000 			_vm->_soundMan->_specialSoundNum = 0;
2001 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 340, 157, 2);
2002 			break;
2003 
2004 		case 230: {
2005 			_vm->_objectsMan->loadLinkFile("IM93a", true);
2006 			_vm->_objectsMan->enableHidingBehavior();
2007 			_vm->_globals->_checkDistanceFl = true;
2008 			_vm->_objectsMan->_oldCharacterPosX = _vm->_objectsMan->getSpriteX(0);
2009 			_vm->_objectsMan->resetOldDirection();
2010 			_vm->_objectsMan->resetHomeRateCounter();
2011 			_vm->_globals->_checkDistanceFl = true;
2012 			_vm->_linesMan->_route = (RouteItem *)NULL;
2013 			_vm->_linesMan->_route = _vm->_linesMan->findRoute(_vm->_objectsMan->getSpriteX(0), _vm->_objectsMan->getSpriteY(0), 488, 280);
2014 			_vm->_globals->_checkDistanceFl = true;
2015 			do {
2016 				if (_vm->shouldQuit())
2017 					return -1; // Exiting game
2018 
2019 				_vm->_objectsMan->goHome();
2020 				_vm->_events->refreshScreenAndEvents();
2021 			} while (_vm->_linesMan->_route != (RouteItem *)NULL);
2022 			_vm->_objectsMan->removeSprite(0);
2023 			bool playFl = false;
2024 			_vm->_objectsMan->setBobAnimation(7);
2025 			do {
2026 				if (_vm->shouldQuit())
2027 					return -1; // Exiting game
2028 
2029 				if (_vm->_objectsMan->getBobAnimDataIdx(7) == 9 && !playFl) {
2030 					playFl = true;
2031 					_vm->_soundMan->playSoundFile("SOUND81.WAV");
2032 				}
2033 				_vm->_events->refreshScreenAndEvents();
2034 			} while (_vm->_objectsMan->getBobAnimDataIdx(7) != 15);
2035 			_vm->_objectsMan->stopBobAnimation(7);
2036 			_vm->_objectsMan->setSpriteX(0, 476);
2037 			_vm->_objectsMan->setSpriteY(0, 278);
2038 			_vm->_objectsMan->animateSprite(0);
2039 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 337, 154, 3);
2040 			_vm->_objectsMan->loadLinkFile("IM93c", true);
2041 			_vm->_objectsMan->enableHidingBehavior();
2042 			break;
2043 			}
2044 
2045 		case 231:
2046 			_vm->_objectsMan->disableHidingBehavior();
2047 			_vm->_objectsMan->removeSprite(0);
2048 			_vm->_objectsMan->setBobAnimation(12);
2049 			do {
2050 				if (_vm->shouldQuit())
2051 					return -1; // Exiting game
2052 
2053 				_vm->_events->refreshScreenAndEvents();
2054 			} while (_vm->_objectsMan->getBobAnimDataIdx(12) != 6);
2055 			_vm->_globals->_introSpeechOffFl = true;
2056 			_vm->_talkMan->startAnimatedCharacterDialogue("PRMORT.pe2");
2057 			_vm->_globals->_introSpeechOffFl = false;
2058 			do {
2059 				if (_vm->shouldQuit())
2060 					return -1; // Exiting game
2061 
2062 				_vm->_events->refreshScreenAndEvents();
2063 			} while (_vm->_objectsMan->getBobAnimDataIdx(12) != 12);
2064 			_vm->_objectsMan->animateSprite(0);
2065 			_vm->_objectsMan->stopBobAnimation(12);
2066 			_vm->_objectsMan->enableHidingBehavior();
2067 			break;
2068 
2069 		case 233: {
2070 			_vm->_objectsMan->disableHidingBehavior();
2071 			_vm->_objectsMan->removeSprite(0);
2072 			_vm->_objectsMan->setBobAnimation(11);
2073 			bool playFl = false;
2074 			do {
2075 				if (_vm->shouldQuit())
2076 					return -1; // Exiting game
2077 
2078 				_vm->_events->refreshScreenAndEvents();
2079 				if (_vm->_objectsMan->getBobAnimDataIdx(11) == 10 && !playFl)
2080 					playFl = true;
2081 			} while (_vm->_objectsMan->getBobAnimDataIdx(11) != 13);
2082 			_vm->_objectsMan->stopBobAnimation(11);
2083 			_vm->_objectsMan->enableHidingBehavior();
2084 			_vm->_objectsMan->setBobAnimation(13);
2085 			do {
2086 				if (_vm->shouldQuit())
2087 					return -1; // Exiting game
2088 
2089 				_vm->_events->refreshScreenAndEvents();
2090 			} while (_vm->_objectsMan->getBobAnimDataIdx(13) != 48);
2091 			_vm->_globals->_introSpeechOffFl = true;
2092 			_vm->_talkMan->startAnimatedCharacterDialogue("HRADIO.PE2");
2093 			_vm->_globals->_introSpeechOffFl = false;
2094 			_vm->_graphicsMan->fadeOutLong();
2095 			_vm->_objectsMan->stopBobAnimation(13);
2096 			_vm->_graphicsMan->_noFadingFl = true;
2097 			_vm->_globals->_exitId = 94;
2098 			break;
2099 			}
2100 
2101 		case 236: {
2102 			if (_vm->_globals->_saveData->_data[svField341]) {
2103 				switch (_vm->_globals->_saveData->_data[svField341]) {
2104 				case 1:
2105 					vbobFrameIndex = 6;
2106 					break;
2107 				case 2:
2108 					vbobFrameIndex = 5;
2109 					break;
2110 				case 3:
2111 					vbobFrameIndex = 4;
2112 					break;
2113 				}
2114 				_vm->_soundMan->playSoundFile("SOUND83.WAV");
2115 				_vm->_objectsMan->setAndPlayAnim(vbobFrameIndex, 26, 50, false);
2116 
2117 				switch (_vm->_globals->_saveData->_data[svField341]) {
2118 				case 1:
2119 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 0);
2120 					_vm->_globals->_saveData->_data[svField338] = 0;
2121 					break;
2122 				case 2:
2123 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 2);
2124 					_vm->_globals->_saveData->_data[svField339] = 0;
2125 					break;
2126 				case 3:
2127 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 4);
2128 					_vm->_globals->_saveData->_data[svField340] = 0;
2129 					break;
2130 				}
2131 			}
2132 			_vm->_soundMan->playSoundFile("SOUND83.WAV");
2133 			_vm->_objectsMan->setAndPlayAnim(6, 0, 23, false);
2134 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 1);
2135 			break;
2136 			}
2137 
2138 		case 237: {
2139 			switch (_vm->_globals->_saveData->_data[svField341]) {
2140 			case 1:
2141 				vbobFrameIndex = 6;
2142 				break;
2143 			case 2:
2144 				vbobFrameIndex = 5;
2145 				break;
2146 			case 3:
2147 				vbobFrameIndex = 4;
2148 				break;
2149 			}
2150 
2151 			if (_vm->_globals->_saveData->_data[svField341]) {
2152 				_vm->_soundMan->playSoundFile("SOUND83.WAV");
2153 				_vm->_objectsMan->setAndPlayAnim(vbobFrameIndex, 26, 50, false);
2154 
2155 				switch (_vm->_globals->_saveData->_data[svField341]) {
2156 				case 1:
2157 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 0);
2158 					_vm->_globals->_saveData->_data[svField338] = 0;
2159 					break;
2160 				case 2:
2161 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 2);
2162 					_vm->_globals->_saveData->_data[svField339] = 0;
2163 					break;
2164 				case 3:
2165 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 4);
2166 					_vm->_globals->_saveData->_data[svField340] = 0;
2167 					break;
2168 				}
2169 			}
2170 
2171 			_vm->_soundMan->playSoundFile("SOUND83.WAV");
2172 			_vm->_objectsMan->setAndPlayAnim(5, 0, 23, false);
2173 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 3);
2174 			break;
2175 			}
2176 
2177 		case 238: {
2178 			switch (_vm->_globals->_saveData->_data[svField341]) {
2179 			case 1:
2180 				vbobFrameIndex = 6;
2181 				break;
2182 			case 2:
2183 				vbobFrameIndex = 5;
2184 				break;
2185 			case 3:
2186 				vbobFrameIndex = 4;
2187 				break;
2188 			}
2189 
2190 			if (_vm->_globals->_saveData->_data[svField341]) {
2191 				_vm->_soundMan->playSoundFile("SOUND83.WAV");
2192 				_vm->_objectsMan->setAndPlayAnim(vbobFrameIndex, 26, 50, false);
2193 				switch (_vm->_globals->_saveData->_data[svField341]) {
2194 				case 1:
2195 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 0);
2196 					_vm->_globals->_saveData->_data[svField338] = 0;
2197 					break;
2198 				case 2:
2199 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 2);
2200 					_vm->_globals->_saveData->_data[svField339] = 0;
2201 					break;
2202 				case 3:
2203 					_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 4);
2204 					_vm->_globals->_saveData->_data[svField340] = 0;
2205 					break;
2206 				}
2207 			}
2208 			_vm->_soundMan->playSoundFile("SOUND83.WAV");
2209 			_vm->_objectsMan->setAndPlayAnim(4, 0, 23, false);
2210 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 5);
2211 			break;
2212 			}
2213 
2214 		case 239:
2215 			_vm->_objectsMan->removeSprite(0);
2216 			_vm->_soundMan->playSoundFile("SOUND84.WAV");
2217 			_vm->_objectsMan->setAndPlayAnim(16, 0, 10, false);
2218 			break;
2219 
2220 		case 240: {
2221 			_vm->_objectsMan->setBobAnimation(1);
2222 			bool soundFlag = false;
2223 			do {
2224 				if (_vm->shouldQuit())
2225 					return -1; // Exiting game
2226 
2227 				_vm->_events->refreshScreenAndEvents();
2228 				switch (_vm->_objectsMan->getBobAnimDataIdx(1)) {
2229 				case 12:
2230 					if (!soundFlag) {
2231 						_vm->_soundMan->playSoundFile("SOUND86.WAV");
2232 						soundFlag = true;
2233 					}
2234 					break;
2235 				case 13:
2236 				// The original was starting then stopping sound at 25
2237 				// It looked wrong so the check was set on 26
2238 				case 26:
2239 					soundFlag = false;
2240 					break;
2241 				case 25:
2242 					if (!soundFlag) {
2243 						_vm->_soundMan->playSoundFile("SOUND85.WAV");
2244 						soundFlag = true;
2245 					}
2246 					break;
2247 				}
2248 			} while (_vm->_objectsMan->getBobAnimDataIdx(1) != 32);
2249 			_vm->_objectsMan->stopBobAnimation(1);
2250 			_vm->_objectsMan->setBobAnimation(2);
2251 			_vm->_fontMan->hideText(9);
2252 			bool displayedTxtFl = false;
2253 			if (!_vm->_soundMan->_textOffFl) {
2254 				_vm->_fontMan->initTextBuffers(9, 617, _vm->_globals->_textFilename, 91, 41, 3, 30, 253);
2255 				_vm->_fontMan->showText(9);
2256 				displayedTxtFl = true;
2257 			}
2258 			if (!_vm->_soundMan->_voiceOffFl)
2259 				_vm->_soundMan->mixVoice(617, 4, displayedTxtFl);
2260 			for (int i = 0; i <= 29; i++) {
2261 				if (_vm->shouldQuit())
2262 					return -1; // Exiting game
2263 
2264 				_vm->_events->refreshScreenAndEvents();
2265 			}
2266 			CharacterLocation *realHopkins = &_vm->_globals->_saveData->_realHopkins;
2267 			realHopkins->_pos.x = _vm->_objectsMan->getSpriteX(0);
2268 			realHopkins->_pos.y = _vm->_objectsMan->getSpriteY(0);
2269 			realHopkins->_startSpriteIndex = 57;
2270 			realHopkins->_location = 97;
2271 			_vm->_globals->_saveData->_data[svHopkinsCloneFl] = 1;
2272 			_vm->_globals->_saveData->_data[svField352] = 1;
2273 			_vm->_globals->_saveData->_data[svField353] = 1;
2274 			_vm->_globals->_saveData->_data[svField354] = 1;
2275 			break;
2276 			}
2277 
2278 		case 241:
2279 			_vm->_talkMan->startAnimatedCharacterDialogue("RECEP.PE2");
2280 			break;
2281 
2282 		// Resurrect Samantha's clone
2283 		case 242: {
2284 			_vm->_soundMan->playSoundFile("SOUND87.WAV");
2285 			_vm->_animMan->playSequence("RESUF.SEQ", 1, 24, 1, false, true);
2286 
2287 			CharacterLocation *samantha = &_vm->_globals->_saveData->_samantha;
2288 			samantha->_pos.x = 404;
2289 			samantha->_pos.y = 395;
2290 			samantha->_startSpriteIndex = 64;
2291 			samantha->_location = _vm->_globals->_screenId;
2292 			samantha->_zoomFactor = -(100 * (67 - (100 - abs(_vm->_globals->_spriteSize[790 / 2]))) / 67);
2293 
2294 			_vm->_globals->_saveData->_data[svField357] = 1;
2295 			_vm->_globals->_saveData->_data[svField354] = 0;
2296 			_vm->_globals->_saveData->_data[svField356] = 0;
2297 			_vm->_globals->_saveData->_data[svField355] = 1;
2298 			_vm->_objectsMan->_twoCharactersFl = true;
2299 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 373, 191, 3);
2300 			_vm->_objectsMan->addStaticSprite(_vm->_objectsMan->_headSprites, samantha->_pos, 1, 3, samantha->_zoomFactor, false, 20, 127);
2301 			_vm->_objectsMan->animateSprite(1);
2302 			break;
2303 			}
2304 
2305 		case 243:
2306 			_vm->_soundMan->playSoundFile("SOUND88.WAV");
2307 			if (_vm->_globals->_saveData->_data[svField341] == 2) {
2308 				_vm->_animMan->playSequence("RESU.SEQ", 2, 24, 2, false, true);
2309 			} else {
2310 				_vm->_objectsMan->setAndPlayAnim(7, 0, 14, false);
2311 			}
2312 			break;
2313 
2314 		case 245:
2315 			_vm->_soundMan->playSoundFile("SOUND89.WAV");
2316 			_vm->_objectsMan->setAndPlayAnim(5, 0, 6, false);
2317 			_vm->_linesMan->_zone[4]._destX = 276;
2318 			_vm->_objectsMan->enableVerb(4, 19);
2319 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 285, 379, 0);
2320 			_vm->_globals->_saveData->_data[svField399] = 1;
2321 			break;
2322 
2323 		case 246:
2324 			_vm->_objectsMan->removeSprite(0);
2325 			_vm->_objectsMan->setAndPlayAnim(6, 0, 15, false);
2326 			_vm->_objectsMan->_charactersEnabledFl = true;
2327 			_vm->_graphicsMan->displayScreen(true);
2328 			_vm->_animMan->playSequence2("TUNNEL.SEQ", 1, 18, 20, true);
2329 			_vm->_graphicsMan->_noFadingFl = true;
2330 			_vm->_graphicsMan->fadeOutLong();
2331 			_vm->_objectsMan->_charactersEnabledFl = false;
2332 			_vm->_globals->_exitId = 100;
2333 			break;
2334 
2335 		case 600:
2336 			if (!_vm->getIsDemo()) {
2337 				_vm->_graphicsMan->_fadingFl = true;
2338 				_vm->_graphicsMan->_fadeDefaultSpeed = 1;
2339 				_vm->_animMan->playAnim("BOMBE1A.ANM", "BOMBE1.ANM", 100, 18, 100);
2340 			}
2341 			_vm->_graphicsMan->loadImage("BOMBEB");
2342 			_vm->_graphicsMan->setColorPercentage(252, 100, 100, 100);
2343 			_vm->_graphicsMan->setColorPercentage(253, 100, 100, 100);
2344 			_vm->_graphicsMan->setColorPercentage(251, 100, 100, 100);
2345 			_vm->_graphicsMan->setColorPercentage(254, 0, 0, 0);
2346 			_vm->_graphicsMan->initScreen("BOMBE", 2, true);
2347 			_vm->_graphicsMan->fadeInShort();
2348 			break;
2349 
2350 		case 601:
2351 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
2352 			_vm->_objectsMan->setAndPlayAnim(2, 0, 16, true);
2353 			break;
2354 
2355 		case 602:
2356 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
2357 			_vm->_objectsMan->setAndPlayAnim(4, 0, 16, true);
2358 			break;
2359 
2360 		case 603:
2361 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
2362 			_vm->_objectsMan->setAndPlayAnim(3, 0, 16, true);
2363 			_vm->_soundMan->_specialSoundNum = 199;
2364 			_vm->_graphicsMan->_fadingFl = true;
2365 			_vm->_animMan->playAnim("BOMBE2A.ANM", "BOMBE2.ANM", 50, 14, 500);
2366 			_vm->_soundMan->_specialSoundNum = 0;
2367 			memset(_vm->_graphicsMan->_frontBuffer, 0, 614400);
2368 			_vm->_graphicsMan->_noFadingFl = true;
2369 			_vm->_globals->_exitId = 151;
2370 			break;
2371 
2372 		case 604:
2373 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
2374 			_vm->_objectsMan->setAndPlayAnim(1, 0, 16, true);
2375 			_vm->_soundMan->_specialSoundNum = 199;
2376 			_vm->_animMan->playAnim("BOMBE2A.ANM", "BOMBE2.ANM", 50, 14, 500);
2377 			_vm->_soundMan->_specialSoundNum = 0;
2378 			_vm->_graphicsMan->_noFadingFl = true;
2379 			memset(_vm->_graphicsMan->_frontBuffer, 0, 614400);
2380 			_vm->_globals->_exitId = 151;
2381 			break;
2382 
2383 		case 605:
2384 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
2385 			_vm->_objectsMan->setAndPlayAnim(5, 0, 16, true);
2386 			_vm->_graphicsMan->fadeOutShort();
2387 			_vm->_soundMan->_specialSoundNum = 199;
2388 			_vm->_graphicsMan->_fadingFl = true;
2389 			_vm->_animMan->playAnim("BOMBE2A.ANM", "BOMBE2.ANM", 50, 14, 500);
2390 			_vm->_soundMan->_specialSoundNum = 0;
2391 			_vm->_graphicsMan->_noFadingFl = true;
2392 			memset(_vm->_graphicsMan->_frontBuffer, 0, 614400);
2393 			_vm->_globals->_exitId = 151;
2394 			break;
2395 
2396 		case 606:
2397 			_vm->_graphicsMan->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
2398 			_vm->_objectsMan->setAndPlayAnim(6, 0, 16, true);
2399 			if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) {
2400 				_vm->_animMan->playAnim("BOMBE3A.ANM", "BOMBE3.ANM", 50, 14, 500);
2401 				memset(_vm->_graphicsMan->_frontBuffer, 0, 614400);
2402 			}
2403 			_vm->_globals->_exitId = 6;
2404 			break;
2405 
2406 		case 607:
2407 			// Display bomb plan
2408 			if (!_vm->getIsDemo()) {
2409 				memcpy(_vm->_graphicsMan->_oldPalette, _vm->_graphicsMan->_palette, 769);
2410 				_vm->_animMan->playAnim2("PLAN.ANM", "PLAN.ANM", 50, 10, 800);
2411 			}
2412 			_vm->_graphicsMan->resetDirtyRects();
2413 			break;
2414 
2415 		case 608:
2416 			_vm->_objectsMan->stopBobAnimation(2);
2417 			_vm->_objectsMan->stopBobAnimation(3);
2418 			_vm->_objectsMan->stopBobAnimation(4);
2419 			_vm->_objectsMan->stopBobAnimation(6);
2420 			_vm->_objectsMan->stopBobAnimation(11);
2421 			_vm->_objectsMan->stopBobAnimation(10);
2422 			break;
2423 
2424 		case 609:
2425 			_vm->_objectsMan->setBobAnimation(2);
2426 			_vm->_objectsMan->setBobAnimation(3);
2427 			_vm->_objectsMan->setBobAnimation(4);
2428 			_vm->_objectsMan->setBobAnimation(6);
2429 			_vm->_objectsMan->setBobAnimation(11);
2430 			_vm->_objectsMan->setBobAnimation(10);
2431 			break;
2432 
2433 		case 610:
2434 			_vm->_objectsMan->stopBobAnimation(5);
2435 			_vm->_objectsMan->stopBobAnimation(7);
2436 			_vm->_objectsMan->stopBobAnimation(8);
2437 			_vm->_objectsMan->stopBobAnimation(9);
2438 			_vm->_objectsMan->stopBobAnimation(12);
2439 			_vm->_objectsMan->stopBobAnimation(13);
2440 			break;
2441 
2442 		case 611:
2443 			_vm->_objectsMan->setBobAnimation(5);
2444 			_vm->_objectsMan->setBobAnimation(7);
2445 			_vm->_objectsMan->setBobAnimation(8);
2446 			_vm->_objectsMan->setBobAnimation(9);
2447 			_vm->_objectsMan->setBobAnimation(12);
2448 			_vm->_objectsMan->setBobAnimation(13);
2449 			break;
2450 		}
2451 		opcodeType = 1;
2452 		break;
2453 	case MKTAG24('E', 'I', 'F'):
2454 		opcodeType = 4;
2455 		break;
2456 	case MKTAG24('V', 'A', 'L'): {
2457 		opcodeType = 1;
2458 		int idx = READ_LE_INT16(dataP + 5);
2459 		assert(idx >= 0 && idx < 2050);
2460 		_vm->_globals->_saveData->_data[idx] = dataP[7];
2461 		break;
2462 		}
2463 	case MKTAG24('A', 'D', 'D'):
2464 		opcodeType = 1;
2465 		_vm->_globals->_saveData->_data[READ_LE_INT16(dataP + 5)] += dataP[7];
2466 		break;
2467 	case MKTAG24('B', 'O', 'S'):
2468 		opcodeType = 1;
2469 		_vm->_objectsMan->setBobOffset(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7));
2470 		break;
2471 	case MKTAG24('V', 'O', 'N'):
2472 		_vm->_objectsMan->enableVerb(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7));
2473 		opcodeType = 1;
2474 		break;
2475 	case MKTAG24('Z', 'C', 'H'):
2476 		_vm->_linesMan->_zone[READ_LE_INT16(dataP + 5)]._messageId = READ_LE_INT16(dataP + 7);
2477 		opcodeType = 1;
2478 		break;
2479 	case MKTAG24('J', 'U', 'M'):
2480 		_vm->_objectsMan->_jumpZone = READ_LE_INT16(dataP + 5);
2481 		_vm->_objectsMan->_jumpVerb = READ_LE_INT16(dataP + 7);
2482 		opcodeType = 6;
2483 		break;
2484 	case MKTAG24('S', 'O', 'U'): {
2485 		int soundNum = READ_LE_INT16(dataP + 5);
2486 
2487 		Common::String file = Common::String::format("SOUND%d.WAV", soundNum);
2488 		_vm->_soundMan->playSoundFile(file);
2489 		opcodeType = 1;
2490 		break;
2491 		}
2492 	case MKTAG24('V', 'O', 'F'):
2493 		_vm->_objectsMan->disableVerb(READ_LE_INT16(dataP + 5), READ_LE_INT16(dataP + 7));
2494 		opcodeType = 1;
2495 		break;
2496 	case MKTAG24('I', 'I', 'F'):
2497 		opcodeType = 3;
2498 		break;
2499 	default:
2500 		warning("Unhandled opcode %c%c%c", dataP[2], dataP[3], dataP[4]);
2501 		break;
2502 	}
2503 
2504 	return opcodeType;
2505 }
2506 
2507 
handleGoto(const byte * dataP)2508 int ScriptManager::handleGoto(const byte *dataP) {
2509 	return READ_LE_INT16(dataP + 5);
2510 }
2511 
handleIf(const byte * dataP,int offset)2512 int ScriptManager::handleIf(const byte *dataP, int offset) {
2513 	int newOffset;
2514 	int curOffset = offset;
2515 	bool loopFl;
2516 	do {
2517 		loopFl = false;
2518 		int tmpOffset = curOffset;
2519 		int opcodeType;
2520 		do {
2521 			if (_vm->shouldQuit())
2522 				return 0; // Exiting game
2523 
2524 			++tmpOffset;
2525 			if (tmpOffset > 400)
2526 				error("Control if failed");
2527 			opcodeType = checkOpcode(dataP + 20 * tmpOffset);
2528 		} while (opcodeType != 4); // EIF
2529 		newOffset = tmpOffset;
2530 		tmpOffset = curOffset;
2531 		do {
2532 			if (_vm->shouldQuit())
2533 				return 0; // Exiting game
2534 
2535 			++tmpOffset;
2536 			if (tmpOffset > 400)
2537 				error("Control if failed ");
2538 			if (checkOpcode(dataP + 20 * tmpOffset) == 3) { // IIF
2539 				curOffset = newOffset;
2540 				loopFl = true;
2541 				break;
2542 			}
2543 		} while (newOffset != tmpOffset);
2544 	} while (loopFl);
2545 
2546 	const byte *buf = dataP + 20 * offset;
2547 	byte oper = buf[13];
2548 	byte oper2 = buf[14];
2549 	byte operType = buf[15];
2550 	int saveDataIdx1 = READ_LE_INT16(buf + 5);
2551 	int compVal1 = READ_LE_INT16(buf + 7);
2552 	bool check1Fl = false;
2553 	if ((oper == 1 && _vm->_globals->_saveData->_data[saveDataIdx1] == compVal1) ||
2554 	    (oper == 2 && _vm->_globals->_saveData->_data[saveDataIdx1] != compVal1) ||
2555 	    (oper == 3 && _vm->_globals->_saveData->_data[saveDataIdx1] <= compVal1) ||
2556 	    (oper == 4 && _vm->_globals->_saveData->_data[saveDataIdx1] >= compVal1) ||
2557 	    (oper == 5 && _vm->_globals->_saveData->_data[saveDataIdx1] > compVal1) ||
2558 	    (oper == 6 && _vm->_globals->_saveData->_data[saveDataIdx1] < compVal1))
2559 		check1Fl = true;
2560 
2561 	bool check2Fl = false;
2562 	if (operType != 3) {
2563 		int saveDataIdx2 = READ_LE_INT16(buf + 9);
2564 		int compVal2 = READ_LE_INT16(buf + 11);
2565 		if ((oper2 == 1 && compVal2 == _vm->_globals->_saveData->_data[saveDataIdx2]) ||
2566 		    (oper2 == 2 && compVal2 != _vm->_globals->_saveData->_data[saveDataIdx2]) ||
2567 		    (oper2 == 3 && compVal2 >= _vm->_globals->_saveData->_data[saveDataIdx2]) ||
2568 		    (oper2 == 4 && compVal2 <= _vm->_globals->_saveData->_data[saveDataIdx2]) ||
2569 		    (oper2 == 5 && compVal2 < _vm->_globals->_saveData->_data[saveDataIdx2]) ||
2570 		    (oper2 == 6 && compVal2 > _vm->_globals->_saveData->_data[saveDataIdx2]))
2571 			check2Fl = true;
2572 	}
2573 
2574 	if ((operType == 3) && check1Fl) {
2575 		return (offset + 1);
2576 	} else if ((operType == 1) && check1Fl && check2Fl) {
2577 		return (offset + 1);
2578 	} else if ((operType == 2) && (check1Fl || check2Fl)) {
2579 		return (offset + 1);
2580 	}
2581 
2582 	return (newOffset + 1);
2583 }
2584 
checkOpcode(const byte * dataP)2585 int ScriptManager::checkOpcode(const byte *dataP) {
2586 	int result = 0;
2587 	if (READ_BE_UINT16(dataP) != MKTAG16('F', 'C'))
2588 		return result;
2589 
2590 	uint32 signature24 = READ_BE_UINT24(&dataP[2]);
2591 	switch (signature24) {
2592 	case MKTAG24('A', 'N', 'I'):
2593 	case MKTAG24('B', 'C', 'A'):
2594 	case MKTAG24('B', 'O', 'B'):
2595 	case MKTAG24('B', 'O', 'F'):
2596 	case MKTAG24('B', 'O', 'S'):
2597 	case MKTAG24('M', 'U', 'S'):
2598 	case MKTAG24('O', 'B', 'M'):
2599 	case MKTAG24('O', 'B', 'P'):
2600 	case MKTAG24('P', 'E', 'R'):
2601 	case MKTAG24('S', 'O', 'U'):
2602 	case MKTAG24('S', 'P', 'E'):
2603 	case MKTAG24('T', 'X', 'T'):
2604 	case MKTAG24('V', 'A', 'L'):
2605 	case MKTAG24('V', 'O', 'F'):
2606 	case MKTAG24('V', 'O', 'N'):
2607 	case MKTAG24('Z', 'C', 'H'):
2608 	case MKTAG24('Z', 'O', 'F'):
2609 	case MKTAG24('Z', 'O', 'N'):
2610 		result = 1;
2611 		break;
2612 	case MKTAG24('G', 'O', 'T'):
2613 		result = 2;
2614 		break;
2615 	case MKTAG24('I', 'I', 'F'):
2616 		result = 3;
2617 		break;
2618 	case MKTAG24('E', 'I', 'F'):
2619 		result = 4;
2620 		break;
2621 	case MKTAG24('E', 'X', 'I'):
2622 	case MKTAG24('S', 'O', 'R'):
2623 		result = 5;
2624 		break;
2625 	case MKTAG24('J', 'U', 'M'):
2626 		result = 6;
2627 		break;
2628 //	default:
2629 //		warning("Unhandled opcode %c%c%c", dataP[2], dataP[3], dataP[4]);
2630 	}
2631 	return result;
2632 }
2633 
2634 } // End of namespace Hopkins
2635