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 "common/scummsys.h"
24 #include "mads/mads.h"
25 #include "mads/scene.h"
26 #include "mads/nebular/nebular_scenes.h"
27 #include "mads/nebular/nebular_scenes7.h"
28
29 namespace MADS {
30
31 namespace Nebular {
32
setAAName()33 void Scene7xx::setAAName() {
34 _game._aaName = Resources::formatAAName(5);
35 }
36
setPlayerSpritesPrefix()37 void Scene7xx::setPlayerSpritesPrefix() {
38 _vm->_sound->command(5);
39
40 Common::String oldName = _game._player._spritesPrefix;
41
42 if ((_scene->_nextSceneId == 703) || (_scene->_nextSceneId == 704) || (_scene->_nextSceneId == 705)
43 || (_scene->_nextSceneId == 707) || (_scene->_nextSceneId == 710) || (_scene->_nextSceneId == 711))
44 _game._player._spritesPrefix = "";
45 else if (_globals[kSexOfRex] == REX_MALE)
46 _game._player._spritesPrefix = "RXM";
47 else
48 _game._player._spritesPrefix = "ROX";
49
50 _game._player._scalingVelocity = true;
51
52 if (oldName != _game._player._spritesPrefix)
53 _game._player._spritesChanged = true;
54
55 _vm->_palette->setEntry(16, 10, 63, 63);
56 _vm->_palette->setEntry(17, 10, 45, 45);
57 }
58
sceneEntrySound()59 void Scene7xx::sceneEntrySound() {
60 if (!_vm->_musicFlag) {
61 _vm->_sound->command(2);
62 return;
63 }
64
65 switch (_scene->_nextSceneId) {
66 case 701:
67 case 702:
68 case 704:
69 case 705:
70 case 751:
71 _vm->_sound->command(38);
72 break;
73 case 703:
74 if (_globals[kMonsterAlive] == 0)
75 _vm->_sound->command(24);
76 else
77 _vm->_sound->command(27);
78 break;
79 case 706:
80 case 707:
81 case 710:
82 case 711:
83 _vm->_sound->command(25);
84 break;
85 default:
86 break;
87 }
88 }
89
90 /*------------------------------------------------------------------------*/
91
Scene701(MADSEngine * vm)92 Scene701::Scene701(MADSEngine *vm) : Scene7xx(vm) {
93 _fishingLineId = -1;
94 }
95
synchronize(Common::Serializer & s)96 void Scene701::synchronize(Common::Serializer &s) {
97 Scene7xx::synchronize(s);
98
99 s.syncAsSint16LE(_fishingLineId);
100 }
101
setup()102 void Scene701::setup() {
103 setPlayerSpritesPrefix();
104 setAAName();
105
106 _scene->addActiveVocab(NOUN_BOAT);
107 _scene->addActiveVocab(VERB_CLIMB_INTO);
108 _scene->addActiveVocab(NOUN_FISHING_LINE);
109 _scene->addActiveVocab(VERB_WALKTO);
110 }
111
enter()112 void Scene701::enter() {
113 _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0));
114 _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5));
115 _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', 0));
116 _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1));
117 _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RM202A1");
118 _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 8));
119
120 if (_scene->_roomChanged) {
121 _game._objects.addToInventory(OBJ_BINOCULARS);
122 _game._objects.addToInventory(OBJ_TWINKIFRUIT);
123 _game._objects.addToInventory(OBJ_BOMB);
124 _game._objects.addToInventory(OBJ_CHICKEN);
125 _game._objects.addToInventory(OBJ_BONES);
126
127 _globals[kCityFlooded] = true;
128 _globals[kLineStatus] = LINE_TIED;
129 _globals[kBoatRaised] = false;
130 }
131
132 if (_globals[kBoatStatus] == BOAT_UNFLOODED) {
133 if (_globals[kBoatRaised])
134 _globals[kBoatStatus] = BOAT_GONE;
135 else if (_globals[kLineStatus] == LINE_TIED)
136 _globals[kBoatStatus] = BOAT_TIED_FLOATING;
137 else if (_game._difficulty == DIFFICULTY_HARD)
138 _globals[kBoatStatus] = BOAT_ADRIFT;
139 else
140 _globals[kBoatStatus] = BOAT_TIED;
141 }
142
143 _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1);
144 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
145 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
146
147 int boatStatus = (_scene->_priorSceneId == 703) ? BOAT_GONE : _globals[kBoatStatus];
148
149 switch (boatStatus) {
150 case BOAT_TIED_FLOATING:
151 _globals._sequenceIndexes[4] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[4], false, 20, 0, 0, 0);
152 _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 10);
153 break;
154 case BOAT_ADRIFT:
155 _globals._sequenceIndexes[6] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[6], false, 20, 0, 0, 0);
156 _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 10);
157 break;
158 case BOAT_TIED: {
159 _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1);
160 _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9);
161 int idx = _scene->_dynamicHotspots.add(837, 759, _globals._sequenceIndexes[2], Common::Rect());
162 _scene->_dynamicHotspots.setPosition(idx, Common::Point(231, 127), FACING_NORTH);
163 break;
164 }
165 case BOAT_GONE:
166 _scene->_hotspots.activate(NOUN_BOAT, false);
167 break;
168 default:
169 break;
170 }
171
172 if (_globals[kLineStatus] == LINE_DROPPED || _globals[kLineStatus] == LINE_TIED) {
173 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1);
174 _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8);
175 int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0));
176 _fishingLineId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTHEAST);
177 }
178
179 if (_scene->_priorSceneId == 702) {
180 _game._player._playerPos = Common::Point(309, 138);
181 _game._player._facing = FACING_WEST;
182 } else if (_scene->_priorSceneId == 710) {
183 _game._player._playerPos = Common::Point(154, 129);
184 _game._player._facing = FACING_NORTH;
185 _game._player._visible = false;
186 _game._player._stepEnabled = false;
187 _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1);
188 _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129));
189 _scene->_sequences.addTimer(15, 60);
190 } else if (_scene->_priorSceneId == 703) {
191 _game._player._playerPos = Common::Point(231, 127);
192 _game._player._facing = FACING_SOUTH;
193 _game._player._visible = false;
194 _game._player._stepEnabled = false;
195 _scene->loadAnimation(formAnimName('B', 1), 80);
196 _vm->_sound->command(28);
197 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG && _scene->_priorSceneId != 620) {
198 _game._player._playerPos = Common::Point(22, 131);
199 _game._player._facing = FACING_EAST;
200 _game._player._stepEnabled = false;
201 _scene->_sequences.addTimer(60, 70);
202 }
203
204 _game.loadQuoteSet(0x310, 0x30F, 0);
205 sceneEntrySound();
206 }
207
step()208 void Scene701::step() {
209 switch(_game._trigger) {
210 case 60:
211 _scene->_sequences.remove(_globals._sequenceIndexes[5]);
212 _globals._sequenceIndexes[5] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0);
213 _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129));
214 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
215 break;
216
217 case 61:
218 _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]);
219 _game._player._visible = true;
220 _game._player._stepEnabled = true;
221 break;
222
223 case 70:
224 _vm->_sound->command(16);
225 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
226 _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
227 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
228 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
229 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
230 break;
231
232 case 71:
233 _game._player.walk(Common::Point(61, 131), FACING_EAST);
234 _scene->_sequences.addTimer(120, 72);
235 break;
236
237 case 72:
238 _vm->_sound->command(17);
239 _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
240 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
241 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
242 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 73);
243 break;
244
245 case 73:
246 _game._player._stepEnabled = true;
247 _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1);
248 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
249 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
250 _scene->_kernelMessages.reset();
251 break;
252
253 case 80: {
254 _game._player._visible = true;
255 _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount;
256 _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1);
257 _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9);
258 int idx = _scene->_dynamicHotspots.add(NOUN_BOAT, VERB_CLIMB_INTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0));
259 _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTH);
260 _globals[kBoatStatus] = BOAT_TIED;
261 _game._player._stepEnabled = true;
262 }
263 break;
264
265 default:
266 break;
267 }
268 }
269
preActions()270 void Scene701::preActions() {
271 if (_action.isAction(VERB_WALKTO, NOUN_EAST_END_OF_PLATFORM))
272 _game._player._walkOffScreenSceneId = 702;
273
274 if (_action.isAction(VERB_LOOK, NOUN_BUILDING))
275 _game._player.walk(Common::Point(154, 129), FACING_NORTHEAST);
276
277 if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING))
278 _game._player.walk(Common::Point(154, 129), FACING_NORTH);
279 }
280
actions()281 void Scene701::actions() {
282 if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) {
283 } else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING) && _game._objects[OBJ_VASE]._roomNumber == 706) {
284 switch (_game._trigger) {
285 case 0:
286 _game._player._stepEnabled = false;
287 _game._player._visible = false;
288 _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0);
289 _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129));
290 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
291 break;
292
293 case 1: {
294 int temp = _globals._sequenceIndexes[5];
295 _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2);
296 _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129));
297 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], temp);
298 _scene->_sequences.addTimer(15, 2);
299 }
300 break;
301
302 case 2:
303 _scene->_nextSceneId = 710;
304 break;
305
306 default:
307 break;
308 }
309 } else if (_action.isAction(VERB_STEP_INTO, NOUN_ELEVATOR)) {
310 switch (_game._trigger) {
311 case 0:
312 _game._player._stepEnabled = false;
313 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
314 _vm->_sound->command(16);
315 _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
316 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
317 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
318 _scene->_kernelMessages.reset();
319 _scene->_kernelMessages.add(Common::Point(0, 0), 0x310, 34, 0, 120, _game.getQuote(0x30D));
320 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
321 break;
322
323 case 1:
324 _game._player.walk(Common::Point(22, 131), FACING_EAST);
325 _scene->_sequences.addTimer(120, 3);
326 break;
327
328 case 3:
329 _vm->_sound->command(17);
330 _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
331 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
332 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
333 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
334 break;
335
336 case 4:
337 _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1);
338 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
339 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
340 _globals[kResurrectRoom] = 701;
341 _scene->_nextSceneId = 605;
342 break;
343
344 default:
345 break;
346 }
347 } else if ((_action.isAction(VERB_PULL, NOUN_BOAT) || _action.isAction(VERB_TAKE, NOUN_BOAT) ||
348 _action.isAction(VERB_PULL, NOUN_FISHING_LINE) || _action.isAction(VERB_TAKE, NOUN_FISHING_LINE)) &&
349 !_game._objects.isInInventory(OBJ_FISHING_LINE)) {
350 if (_globals[kBoatStatus] == BOAT_TIED_FLOATING) {
351 switch (_game._trigger) {
352 case 0:
353 _game._player._stepEnabled = false;
354 _scene->_sequences.remove(_globals._sequenceIndexes[4]);
355 _scene->_sequences.remove(_globals._sequenceIndexes[3]);
356 _scene->_dynamicHotspots.remove(_fishingLineId);
357 _scene->_hotspots.activate(NOUN_BOAT, false);
358 _game._player._visible = false;
359 _scene->loadAnimation(formAnimName('E', -1), 1);
360 break;
361
362 case 1: {
363 _game._player._visible = true;
364 _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount;
365 _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1);
366 _scene->_sequences.setDepth (_globals._sequenceIndexes[2], 9);
367 int idx = _scene->_dynamicHotspots.add(NOUN_BOAT, VERB_CLIMB_INTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0));
368 _scene->_dynamicHotspots.setPosition(idx, Common::Point(231, 127), FACING_NORTH);
369 _scene->_sequences.addTimer(15, 2);
370 }
371 break;
372
373 case 2:
374 _globals[kBoatStatus] = BOAT_TIED;
375 _globals[kLineStatus] = LINE_NOW_UNTIED;
376 _game._player._stepEnabled = true;
377 break;
378
379 default:
380 break;
381 }
382 } else if (_globals[kBoatStatus] == BOAT_TIED) {
383 _vm->_dialogs->show(70125);
384 } else if (_globals[kLineStatus] == LINE_DROPPED) {
385 _globals[kLineStatus] = LINE_NOW_UNTIED;
386 _game._objects.addToInventory(OBJ_FISHING_LINE);
387 _vm->_sound->command(15);
388 _scene->_sequences.remove(_globals._sequenceIndexes[3]);
389 _vm->_dialogs->showItem(OBJ_FISHING_LINE, 70126);
390 } else {
391 _vm->_dialogs->show(70127);
392 }
393 } else if (_action.isAction(VERB_CLIMB_INTO, NOUN_BOAT) && _globals[kBoatStatus] == BOAT_TIED) {
394 switch (_game._trigger) {
395 case 0:
396 _game._player._stepEnabled = false;
397 _scene->_sequences.remove(_globals._sequenceIndexes[2]);
398 _game._player._visible = false;
399 _scene->loadAnimation(formAnimName('B', 0), 1);
400 break;
401
402 case 1:
403 _scene->_nextSceneId = 703;
404 break;
405
406 default:
407 break;
408 }
409 } else if (_action._lookFlag) {
410 if (_globals[kBoatStatus] != BOAT_GONE) {
411 if (_globals[kBoatStatus] == BOAT_TIED)
412 _vm->_dialogs->show(70128);
413 else
414 _vm->_dialogs->show(70110);
415 } else
416 _vm->_dialogs->show(70111);
417 } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY))
418 _vm->_dialogs->show(70112);
419 else if (_action.isAction(VERB_LOOK, NOUN_ELEVATOR))
420 _vm->_dialogs->show(70113);
421 else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM))
422 _vm->_dialogs->show(70114);
423 else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_PYLON))
424 _vm->_dialogs->show(70115);
425 else if (_action.isAction(VERB_LOOK, NOUN_HOOK)) {
426 if (_globals[kLineStatus] == LINE_NOT_DROPPED || _globals[kLineStatus] == LINE_NOW_UNTIED)
427 _vm->_dialogs->show(70116);
428 else
429 _vm->_dialogs->show(70117);
430 } else if (_action.isAction(VERB_LOOK, NOUN_ROCK))
431 _vm->_dialogs->show(70118);
432 else if (_action.isAction(VERB_TAKE, NOUN_ROCK))
433 _vm->_dialogs->show(70119);
434 else if (_action.isAction(VERB_LOOK, NOUN_EAST_END_OF_PLATFORM))
435 _vm->_dialogs->show(70120);
436 else if (_action.isAction(VERB_LOOK, NOUN_BUILDING))
437 _vm->_dialogs->show(70121);
438 else if (_action.isAction(VERB_LOOK, NOUN_BOAT)) {
439 if (_globals[kBoatStatus] == BOAT_ADRIFT || _globals[kBoatStatus] == BOAT_TIED_FLOATING)
440 _vm->_dialogs->show(70122);
441 else
442 _vm->_dialogs->show(70123);
443 } else if (_action.isAction(VERB_CAST, NOUN_FISHING_ROD, NOUN_BOAT) && _game._objects.isInInventory(OBJ_FISHING_LINE))
444 _vm->_dialogs->show(70124);
445 else
446 return;
447
448 _action._inProgress = false;
449 }
450
451 /*------------------------------------------------------------------------*/
452
setup()453 void Scene702::setup() {
454 setPlayerSpritesPrefix();
455 setAAName();
456 }
457
enter()458 void Scene702::enter() {
459 _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_8");
460
461 if (_scene->_priorSceneId == 701) {
462 _game._player._playerPos = Common::Point(13, 145);
463 _game._player._facing = FACING_EAST;
464 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG && _scene->_priorSceneId != 620) {
465 _game._player._playerPos = Common::Point(289, 138);
466 _game._player.walk(Common::Point(262, 148), FACING_WEST);
467 _game._player._facing = FACING_WEST;
468 _game._player._visible = true;
469 }
470
471 if (_game._globals[kTeleporterCommand]) {
472 switch(_game._globals[kTeleporterCommand]) {
473 case TELEPORTER_BEAM_OUT:
474 case TELEPORTER_WRONG:
475 case TELEPORTER_STEP_OUT:
476 _game._player._visible = true;
477 _game._player._stepEnabled = true;
478 break;
479 default:
480 break;
481 }
482
483 _game._globals[kTeleporterCommand] = TELEPORTER_NONE;
484 }
485
486 sceneEntrySound();
487 }
488
preActions()489 void Scene702::preActions() {
490 if (_action.isAction(VERB_WALKTO, NOUN_WEST_END_OF_PLATFORM))
491 _game._player._walkOffScreenSceneId = 701;
492 }
493
actions()494 void Scene702::actions() {
495 if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM))
496 ; // Only set the action as finished
497 else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) {
498 _game._player._stepEnabled = false;
499 _game._player._visible = false;
500 _scene->_nextSceneId = 711;
501 } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) {
502 switch (_game._trigger) {
503 case 0:
504 _game._player._stepEnabled = false;
505 _game._player._visible = false;
506 _globals._sequenceIndexes[12] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0);
507 _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]);
508 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1);
509 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
510 break;
511 case 1:
512 _vm->_sound->command(0xF);
513 if (_game._objects.isInInventory(OBJ_BONE))
514 _game._objects.setRoom(OBJ_BONE, 1);
515 _game._objects.addToInventory(OBJ_BONES);
516 _vm->_dialogs->show(OBJ_BONES, 70218);
517 break;
518 case 2:
519 _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]);
520 _game._player._visible = true;
521 _game._player._stepEnabled = true;
522 break;
523 default:
524 break;
525 }
526 } else if (_action._lookFlag)
527 _vm->_dialogs->show(70210);
528 else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM))
529 _vm->_dialogs->show(70211);
530 else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK))
531 _vm->_dialogs->show(70212);
532 else if (_action.isAction(VERB_LOOK, NOUN_ROCK))
533 _vm->_dialogs->show(70213);
534 else if (_action.isAction(VERB_TAKE, NOUN_ROCK))
535 _vm->_dialogs->show(70214);
536 else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM))
537 _vm->_dialogs->show(70215);
538 else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER))
539 _vm->_dialogs->show(70216);
540 else if (_action.isAction(VERB_LOOK, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT))
541 _vm->_dialogs->show(70217);
542 else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT)) {
543 if (_game._objects.isInInventory(OBJ_BONES))
544 _vm->_dialogs->show(70219);
545 } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY))
546 _vm->_dialogs->show(70220);
547 else
548 return;
549
550 _action._inProgress = false;
551 }
552
553 /*------------------------------------------------------------------------*/
554
Scene703(MADSEngine * vm)555 Scene703::Scene703(MADSEngine *vm) : Scene7xx(vm) {
556 _monsterMode = -1;
557 _boatFrame = -1;
558 _curSequence = -1;
559 _boatDir = -1;
560
561 _useBomb = false;
562 _startMonsterTimer = false;
563 _rexDeathFl = false;
564 _restartTrigger70Fl = false;
565
566 _lastFrameTime = 0;
567 _monsterTime = 0;
568 }
569
synchronize(Common::Serializer & s)570 void Scene703::synchronize(Common::Serializer &s) {
571 Scene7xx::synchronize(s);
572
573 s.syncAsSint16LE(_monsterMode);
574 s.syncAsSint16LE(_boatFrame);
575 s.syncAsSint16LE(_curSequence);
576 s.syncAsSint16LE(_boatDir);
577
578 s.syncAsByte(_useBomb);
579 s.syncAsByte(_startMonsterTimer);
580 s.syncAsByte(_rexDeathFl);
581 s.syncAsByte(_restartTrigger70Fl);
582
583 s.syncAsUint32LE(_lastFrameTime);
584 s.syncAsUint32LE(_monsterTime);
585 }
586
setup()587 void Scene703::setup() {
588 _game._player._spritesPrefix = "";
589 setAAName();
590 }
591
handleBottleInterface()592 void Scene703::handleBottleInterface() {
593 switch (_globals[kBottleStatus]) {
594 case 0:
595 _dialog1.write(0x311, true);
596 _dialog1.write(0x312, true);
597 _dialog1.write(0x313, true);
598 _dialog1.write(0x314, true);
599 _dialog1.write(0x315, true);
600 break;
601
602 case 1:
603 _dialog1.write(0x311, false);
604 _dialog1.write(0x312, true);
605 _dialog1.write(0x313, true);
606 _dialog1.write(0x314, true);
607 _dialog1.write(0x315, true);
608 break;
609
610 case 2:
611 _dialog1.write(0x311, false);
612 _dialog1.write(0x312, false);
613 _dialog1.write(0x313, true);
614 _dialog1.write(0x314, true);
615 _dialog1.write(0x315, true);
616 break;
617
618 case 3:
619 _dialog1.write(0x311, false);
620 _dialog1.write(0x312, false);
621 _dialog1.write(0x313, false);
622 _dialog1.write(0x314, true);
623 _dialog1.write(0x315, true);
624 break;
625
626 default:
627 break;
628 }
629 }
630
setBottleSequence()631 void Scene703::setBottleSequence() {
632 _scene->_userInterface.setup(kInputBuildingSentences);
633 _game._player._stepEnabled = false;
634 if (_boatDir == 2)
635 _curSequence = 6;
636 else
637 _curSequence = 7;
638 }
639
handleFillBottle(int quote)640 void Scene703::handleFillBottle(int quote) {
641 switch (quote) {
642 case 0x311:
643 _globals[kBottleStatus] = 1;
644 setBottleSequence();
645 break;
646
647 case 0x312:
648 _globals[kBottleStatus] = 2;
649 setBottleSequence();
650 break;
651
652 case 0x313:
653 _globals[kBottleStatus] = 3;
654 setBottleSequence();
655 break;
656
657 case 0x314:
658 _globals[kBottleStatus] = 4;
659 setBottleSequence();
660 break;
661
662 case 0x315:
663 _scene->_userInterface.setup(kInputBuildingSentences);
664 break;
665
666 default:
667 break;
668 }
669 }
670
enter()671 void Scene703::enter() {
672 _game._player._visible = false;
673
674 if (!_game._visitedScenes._sceneRevisited) {
675 if (_scene->_priorSceneId == 704)
676 _globals[kMonsterAlive] = false;
677 else
678 _globals[kMonsterAlive] = true;
679 }
680
681 _startMonsterTimer = true;
682 _rexDeathFl = true;
683 _monsterTime = 0;
684 _restartTrigger70Fl = true;
685 _useBomb = false;
686 _boatFrame = -1;
687
688 if (!_globals[kMonsterAlive])
689 _scene->_hotspots.activate(NOUN_SEA_MONSTER, false);
690
691 if (_scene->_priorSceneId == 704) {
692 _game._player._stepEnabled = false;
693 _curSequence = 2;
694 _boatDir = 2;
695 _monsterMode = 0;
696 _scene->loadAnimation(formAnimName('A', -1));
697 _scene->_animation[0]->setCurrentFrame(34);
698 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
699 _game._player._stepEnabled = false;
700 _boatDir = 1;
701 if (_globals[kMonsterAlive]) {
702 _monsterMode = 1;
703 _curSequence = 0;
704 _scene->loadAnimation(formAnimName('B', -1));
705 } else {
706 _curSequence = 0;
707 _monsterMode = 0;
708 _scene->loadAnimation(formAnimName('A', -1));
709 }
710 } else if (_globals[kMonsterAlive]) {
711 _curSequence = 0;
712 _boatDir = 1;
713 _monsterMode = 1;
714 _scene->loadAnimation(formAnimName('B', -1));
715 _scene->_animation[0]->setCurrentFrame(39);
716 } else if (_boatDir == 1) {
717 _curSequence = 0;
718 _monsterMode = 0;
719 _scene->loadAnimation(formAnimName('A', -1));
720 _scene->_animation[0]->setCurrentFrame(9);
721 } else if (_boatDir == 2) {
722 _curSequence = 0;
723 _monsterMode = 0;
724 _scene->loadAnimation(formAnimName('A', -1));
725 _scene->_animation[0]->setCurrentFrame(56);
726 }
727
728 if (_scene->_roomChanged) {
729 _game._objects.addToInventory(OBJ_TWINKIFRUIT);
730 _game._objects.addToInventory(OBJ_BOMB);
731 _game._objects.addToInventory(OBJ_CHICKEN);
732 _game._objects.addToInventory(OBJ_BONES);
733 }
734
735 _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0);
736 _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0);
737 sceneEntrySound();
738 _vm->_sound->command(28);
739 }
740
step()741 void Scene703::step() {
742 if (_startMonsterTimer) {
743 long diff = _scene->_frameStartTime - _lastFrameTime;
744 if ((diff >= 0) && (diff <= 12))
745 _monsterTime += diff;
746 else
747 _monsterTime++;
748
749 _lastFrameTime = _scene->_frameStartTime;
750 }
751
752 if ((_monsterTime >= 2400) && !_rexDeathFl && !_useBomb) {
753 _startMonsterTimer = false;
754 _rexDeathFl = true;
755 _game._player._stepEnabled = false;
756 _scene->freeAnimation();
757 _monsterMode = 3;
758 _scene->loadAnimation(formAnimName('D', -1));
759 _rexDeathFl = false;
760 _monsterTime = 0;
761 }
762
763
764 if (_game._trigger == 70)
765 _scene->_reloadSceneFlag = true;
766
767 if ((_monsterMode == 3) && (_scene->_animation[0] != nullptr)) {
768 if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
769 _boatFrame = _scene->_animation[0]->getCurrentFrame();
770 int nextBoatFrame = -1;
771
772 if (_boatFrame == 62) {
773 nextBoatFrame = 61;
774 if (_restartTrigger70Fl) {
775 _restartTrigger70Fl = false;
776 _scene->_sequences.addTimer(15, 70);
777 }
778 }
779
780 if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
781 _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
782 _boatFrame = nextBoatFrame;
783 }
784 }
785 }
786
787 if (_game._trigger == 70)
788 _scene->_reloadSceneFlag = true;
789
790 if ((_monsterMode == 0) && (_scene->_animation[0] != nullptr)) {
791 if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
792 _boatFrame = _scene->_animation[0]->getCurrentFrame();
793 int nextBoatFrame = -1;
794
795 switch (_boatFrame) {
796 case 11:
797 if (_curSequence == 7) {
798 _curSequence = 0;
799 nextBoatFrame = 100;
800 } else if (_curSequence == 5)
801 nextBoatFrame = 82;
802 else if (_curSequence == 1)
803 nextBoatFrame = 11;
804 else {
805 nextBoatFrame = 9;
806 if (!_game._player._stepEnabled)
807 _game._player._stepEnabled = true;
808 }
809 break;
810
811 case 34:
812 if (_curSequence != 2)
813 _scene->_nextSceneId = 704;
814 break;
815
816 case 57:
817 if (_curSequence == 6) {
818 _curSequence = 0;
819 nextBoatFrame = 91;
820 } else if (_curSequence == 4)
821 nextBoatFrame = 73;
822 else if (_curSequence == 3)
823 nextBoatFrame = 57;
824 else {
825 nextBoatFrame = 56;
826 if (!_game._player._stepEnabled)
827 _game._player._stepEnabled = true;
828 }
829 break;
830
831 case 73:
832 _scene->_nextSceneId = 701;
833 break;
834
835 case 82:
836 nextBoatFrame = 11;
837 break;
838
839 case 91:
840 nextBoatFrame = 57;
841 break;
842
843 case 100:
844 nextBoatFrame = 56;
845 if (!_game._player._stepEnabled) {
846 _scene->_sequences.addTimer(30, 80);
847 _game._player._stepEnabled = true;
848 }
849 break;
850
851 case 110:
852 nextBoatFrame = 9;
853 if (!_game._player._stepEnabled) {
854 _scene->_sequences.addTimer(30, 80);
855 _game._player._stepEnabled = true;
856 }
857 break;
858
859 default:
860 break;
861 }
862
863 if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
864 _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
865 _boatFrame = nextBoatFrame;
866 }
867 }
868 }
869
870 if (_game._trigger == 80) {
871 switch (_globals[kBottleStatus]) {
872 case 0:
873 _vm->_dialogs->show(432);
874 break;
875
876 case 1:
877 _vm->_dialogs->show(70324);
878 break;
879
880 case 2:
881 _vm->_dialogs->show(70325);
882 break;
883
884 case 3:
885 _vm->_dialogs->show(70326);
886 break;
887
888 case 4:
889 _vm->_dialogs->show(70327);
890 break;
891
892 default:
893 break;
894 }
895 }
896
897
898 if ((_monsterMode == 1) && (_scene->_animation[0] != nullptr)) {
899 if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
900 _boatFrame = _scene->_animation[0]->getCurrentFrame();
901 int nextBoatFrame = -1;
902
903 switch (_boatFrame) {
904 case 39:
905 _game._player._stepEnabled = true;
906 _startMonsterTimer = true;
907 _rexDeathFl = false;
908 break;
909
910 case 40:
911 case 49:
912 case 54:
913 case 67:
914 case 78:
915 case 87:
916 case 96:
917 case 105:
918 case 114:
919 case 123:
920 if (_curSequence == 8)
921 nextBoatFrame = 129;
922
923 break;
924
925 case 129:
926 nextBoatFrame = 39;
927 break;
928
929 case 151:
930 _scene->_nextSceneId = 701;
931 break;
932
933 default:
934 break;
935 }
936
937 if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
938 _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
939 _boatFrame = nextBoatFrame;
940 }
941 }
942 }
943
944 if ((_monsterMode == 2) && (_scene->_animation[0] != nullptr)) {
945 if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) {
946 _boatFrame = _scene->_animation[0]->getCurrentFrame();
947 int nextBoatFrame = -1;
948
949 switch (_boatFrame) {
950 case 14:
951 if (!_useBomb) {
952 if (_game._difficulty == DIFFICULTY_HARD)
953 _game._objects.setRoom(OBJ_CHICKEN, 1);
954 else
955 _vm->_dialogs->show(70319);
956 }
957 nextBoatFrame = 80;
958 break;
959
960 case 33:
961 if (_game._objects.isInInventory(OBJ_BONES)) {
962 _game._objects.setRoom(OBJ_BONES, 1);
963 _game._objects.addToInventory(OBJ_BONE);
964 } else
965 _game._objects.setRoom(OBJ_BONE, 1);
966
967 nextBoatFrame = 80;
968 break;
969
970 case 53:
971 _game._objects.setRoom(OBJ_TWINKIFRUIT, 1);
972 nextBoatFrame = 80;
973 _curSequence = 9;
974 break;
975
976 case 80:
977 if (_game._difficulty == DIFFICULTY_HARD) {
978 _game._objects.setRoom(OBJ_BOMB, 1);
979 _vm->_dialogs->show(70318);
980 } else
981 _vm->_dialogs->show(70317);
982
983 _scene->freeAnimation();
984 _monsterMode = 1;
985 _scene->loadAnimation(formAnimName('B', -1));
986 _scene->_animation[0]->setCurrentFrame(39);
987 _game._player._stepEnabled = true;
988 break;
989
990 case 91:
991 if (!_useBomb) {
992 _scene->freeAnimation();
993 _monsterMode = 1;
994 _scene->loadAnimation(formAnimName('B', -1));
995 _scene->_animation[0]->setCurrentFrame(39);
996 _game._player._stepEnabled = true;
997 } else
998 _game._objects.setRoom(OBJ_CHICKEN_BOMB, 1);
999
1000 break;
1001
1002 case 126:
1003 _scene->_hotspots.activate(NOUN_SEA_MONSTER, false);
1004 _globals[kMonsterAlive] = false;
1005 _scene->freeAnimation();
1006 _monsterMode = 0;
1007 _scene->loadAnimation(formAnimName('A', -1));
1008 _scene->_animation[0]->setCurrentFrame(9);
1009 _game._player._stepEnabled = true;
1010 if (_game._storyMode == STORYMODE_NAUGHTY)
1011 _vm->_dialogs->show(70321);
1012 else
1013 _vm->_dialogs->show(70322);
1014
1015 break;
1016
1017 default:
1018 break;
1019 }
1020
1021 if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) {
1022 _scene->_animation[0]->setCurrentFrame(nextBoatFrame);
1023 _boatFrame = nextBoatFrame;
1024 }
1025 }
1026 }
1027 }
1028
actions()1029 void Scene703::actions() {
1030 if (_game._screenObjects._inputMode == kInputConversation)
1031 handleFillBottle(_action._activeAction._verbId);
1032 else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_DOCK_TO_SOUTH)) {
1033 _game._player._stepEnabled = false;
1034 if (_globals[kMonsterAlive])
1035 _curSequence = 8;
1036 else if (_boatDir == 1)
1037 _curSequence = 5;
1038 else
1039 _curSequence = 3;
1040 } else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_BUILDING_TO_NORTH)) {
1041 _game._player._stepEnabled = false;
1042 if (_globals[kMonsterAlive]) {
1043 _startMonsterTimer = false;
1044 _rexDeathFl = true;
1045 _monsterTime = 0;
1046 _scene->freeAnimation();
1047 _monsterMode = 3;
1048 _scene->loadAnimation(formAnimName('D', -1));
1049 } else if (_boatDir == 2)
1050 _curSequence = 4;
1051 else
1052 _curSequence = 1;
1053 } else if (_action.isAction(VERB_THROW, NOUN_BONE, NOUN_SEA_MONSTER) || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_SEA_MONSTER)) {
1054 _game._player._stepEnabled = false;
1055 _scene->freeAnimation();
1056 _monsterMode = 2;
1057 _scene->loadAnimation(formAnimName('C', -1));
1058 _scene->_animation[0]->setCurrentFrame(19);
1059 } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN, NOUN_SEA_MONSTER)) {
1060 _game._player._stepEnabled = false;
1061 _scene->freeAnimation();
1062 _monsterMode = 2;
1063 _scene->loadAnimation(formAnimName('C', -1));
1064 } else if (_action.isAction(VERB_THROW, NOUN_TWINKIFRUIT, NOUN_SEA_MONSTER)) {
1065 _game._player._stepEnabled = false;
1066 _scene->freeAnimation();
1067 _monsterMode = 2;
1068 _scene->loadAnimation(formAnimName('C', -1));
1069 _scene->_animation[0]->setCurrentFrame(39);
1070 } else if (_action.isAction(VERB_THROW, NOUN_BOMB, NOUN_SEA_MONSTER)) {
1071 _game._player._stepEnabled = false;
1072 _scene->freeAnimation();
1073 _monsterMode = 2;
1074 _scene->loadAnimation(formAnimName('C', -1));
1075 _scene->_animation[0]->setCurrentFrame(59);
1076 } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB, NOUN_SEA_MONSTER)) {
1077 _useBomb = true;
1078 _game._player._stepEnabled = false;
1079 _scene->freeAnimation();
1080 _monsterMode = 2;
1081 _scene->loadAnimation(formAnimName('C', -1));
1082 } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_WATER) || _action.isAction(VERB_FILL, NOUN_BOTTLE, NOUN_WATER)) {
1083 if (_globals[kBottleStatus] != 4) {
1084 handleBottleInterface();
1085 _dialog1.start();
1086 } else
1087 _vm->_dialogs->show(70323);
1088 } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_SEA_MONSTER)) {
1089 if (_globals[kMonsterAlive])
1090 _vm->_dialogs->show(70310);
1091 } else if (_action.isAction(VERB_LOOK, NOUN_WATER)) {
1092 if (!_globals[kMonsterAlive])
1093 _vm->_dialogs->show(70311);
1094 else
1095 _vm->_dialogs->show(70312);
1096 } else if (_action.isAction(VERB_LOOK, NOUN_BUILDING_TO_NORTH)) {
1097 if (_globals[kMonsterAlive])
1098 _vm->_dialogs->show(70313);
1099 else if (_game._visitedScenes.exists(710))
1100 _vm->_dialogs->show(70314);
1101 else
1102 _vm->_dialogs->show(70315);
1103 } else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM))
1104 _vm->_dialogs->show(70316);
1105 else
1106 return;
1107
1108 _action._inProgress = false;
1109 }
1110
1111 /*------------------------------------------------------------------------*/
1112
Scene704(MADSEngine * vm)1113 Scene704::Scene704(MADSEngine *vm) : Scene7xx(vm) {
1114 _bottleHotspotId = -1;
1115 _boatCurrentFrame = -1;
1116 _animationMode = -1;
1117 _boatDirection = -1;
1118
1119 _takeBottleFl = false;
1120 }
1121
synchronize(Common::Serializer & s)1122 void Scene704::synchronize(Common::Serializer &s) {
1123 Scene7xx::synchronize(s);
1124
1125 s.syncAsSint16LE(_bottleHotspotId);
1126 s.syncAsSint16LE(_boatCurrentFrame);
1127 s.syncAsSint16LE(_animationMode);
1128 s.syncAsSint16LE(_boatDirection);
1129
1130 s.syncAsByte(_takeBottleFl);
1131 }
1132
setup()1133 void Scene704::setup() {
1134 _game._player._spritesPrefix = "";
1135 setAAName();
1136 _scene->addActiveVocab(NOUN_BOTTLE);
1137 _scene->addActiveVocab(VERB_LOOK_AT);
1138 }
1139
handleBottleInterface()1140 void Scene704::handleBottleInterface() {
1141 switch (_globals[kBottleStatus]) {
1142 case 0:
1143 _dialog1.write(0x311, true);
1144 _dialog1.write(0x312, true);
1145 _dialog1.write(0x313, true);
1146 _dialog1.write(0x314, true);
1147 _dialog1.write(0x315, true);
1148 break;
1149
1150 case 1:
1151 _dialog1.write(0x311, false);
1152 _dialog1.write(0x312, true);
1153 _dialog1.write(0x313, true);
1154 _dialog1.write(0x314, true);
1155 _dialog1.write(0x315, true);
1156 break;
1157
1158 case 2:
1159 _dialog1.write(0x311, false);
1160 _dialog1.write(0x312, false);
1161 _dialog1.write(0x313, true);
1162 _dialog1.write(0x314, true);
1163 _dialog1.write(0x315, true);
1164 break;
1165
1166 case 3:
1167 _dialog1.write(0x311, false);
1168 _dialog1.write(0x312, false);
1169 _dialog1.write(0x313, false);
1170 _dialog1.write(0x314, true);
1171 _dialog1.write(0x315, true);
1172 break;
1173
1174 default:
1175 break;
1176 }
1177 }
1178
setBottleSequence()1179 void Scene704::setBottleSequence() {
1180 _scene->_userInterface.setup(kInputBuildingSentences);
1181 _game._player._stepEnabled = false;
1182 if (_boatDirection == 2)
1183 _animationMode = 6;
1184 else
1185 _animationMode = 7;
1186 }
1187
handleFillBottle(int quote)1188 void Scene704::handleFillBottle(int quote) {
1189 switch (quote) {
1190 case 0x311:
1191 _globals[kBottleStatus] = 1;
1192 setBottleSequence();
1193 break;
1194
1195 case 0x312:
1196 _globals[kBottleStatus] = 2;
1197 setBottleSequence();
1198 break;
1199
1200 case 0x313:
1201 _globals[kBottleStatus] = 3;
1202 setBottleSequence();
1203 break;
1204
1205 case 0x314:
1206 _globals[kBottleStatus] = 4;
1207 setBottleSequence();
1208 break;
1209
1210 case 0x315:
1211 _scene->_userInterface.setup(kInputBuildingSentences);
1212 break;
1213
1214 default:
1215 break;
1216 }
1217 }
1218
enter()1219 void Scene704::enter() {
1220 if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) {
1221 _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0));
1222 _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0);
1223 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
1224 if (_scene->_priorSceneId == 705) {
1225 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(123, 125));
1226 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
1227 } else {
1228 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(190, 122));
1229 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2);
1230 }
1231 int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_LOOK_AT, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0));
1232 _bottleHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE);
1233 }
1234
1235 _game._player._visible = false;
1236 _takeBottleFl = false;
1237 _boatCurrentFrame = -1;
1238
1239 if (_scene->_priorSceneId == 705) {
1240 _game._player._stepEnabled = false;
1241 _animationMode = 2;
1242 _boatDirection = 2;
1243 _scene->loadAnimation(formAnimName('A', -1));
1244 _scene->_animation[0]->setCurrentFrame(36);
1245 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
1246 _game._player._stepEnabled = false;
1247 _boatDirection = 1;
1248 _scene->loadAnimation(formAnimName('A', -1));
1249 } else if (_boatDirection == 1) {
1250 _scene->loadAnimation(formAnimName('A', -1));
1251 _scene->_animation[0]->setCurrentFrame(8);
1252 } else if (_boatDirection == 2) {
1253 if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) {
1254 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(123, 125));
1255 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
1256 }
1257 _scene->loadAnimation(formAnimName('A', -1));
1258 _scene->_animation[0]->setCurrentFrame(57);
1259 }
1260
1261 if (_scene->_roomChanged)
1262 _globals[kMonsterAlive] = false;
1263
1264 _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0);
1265 _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0);
1266
1267 sceneEntrySound();
1268 _vm->_sound->command(28);
1269 }
1270
step()1271 void Scene704::step() {
1272 if (_scene->_animation[0] != nullptr) {
1273 if (_scene->_animation[0]->getCurrentFrame() != _boatCurrentFrame) {
1274 _boatCurrentFrame = _scene->_animation[0]->getCurrentFrame();
1275 int nextFrame = -1;
1276
1277 switch (_boatCurrentFrame) {
1278 case 10:
1279 switch (_animationMode) {
1280 case 1:
1281 nextFrame = 10;
1282 break;
1283 case 5:
1284 nextFrame = 74;
1285 break;
1286 case 7:
1287 _animationMode = 0;
1288 nextFrame = 92;
1289 break;
1290 default:
1291 if (!_game._player._stepEnabled)
1292 _game._player._stepEnabled = true;
1293
1294 nextFrame = 8;
1295 break;
1296 }
1297 break;
1298
1299 case 36:
1300 if (_animationMode != 2)
1301 _scene->_nextSceneId = 705;
1302 break;
1303
1304 case 59:
1305 switch (_animationMode) {
1306 case 3:
1307 nextFrame = 59;
1308 break;
1309
1310 case 4:
1311 nextFrame = 65;
1312 break;
1313
1314 case 6:
1315 _animationMode = 0;
1316 nextFrame = 83;
1317 break;
1318
1319 default:
1320 if (!_game._player._stepEnabled) {
1321 _game._player._stepEnabled = true;
1322 }
1323 nextFrame = 57;
1324 break;
1325 }
1326 break;
1327
1328 case 65:
1329 _scene->_nextSceneId = 703;
1330 break;
1331
1332 case 74:
1333 nextFrame = 10;
1334 break;
1335
1336 case 83:
1337 nextFrame = 59;
1338 break;
1339
1340 case 90:
1341 if (_takeBottleFl) {
1342 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
1343 _scene->_dynamicHotspots.remove(_bottleHotspotId);
1344 _game._objects.addToInventory(OBJ_BOTTLE);
1345 _vm->_sound->command(15);
1346 _vm->_dialogs->showItem(OBJ_BOTTLE, 70415);
1347 }
1348 break;
1349
1350 case 92:
1351 nextFrame = 57;
1352 if (!_game._player._stepEnabled && !_takeBottleFl) {
1353 _scene->_sequences.addTimer(30, 70);
1354 _game._player._stepEnabled = true;
1355 }
1356 break;
1357
1358 case 98:
1359 if (_takeBottleFl) {
1360 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
1361 _scene->_dynamicHotspots.remove(_bottleHotspotId);
1362 _game._objects.addToInventory(OBJ_BOTTLE);
1363 _vm->_sound->command(15);
1364 _vm->_dialogs->showItem(OBJ_BOTTLE, 70415);
1365 }
1366 break;
1367
1368 case 101:
1369 nextFrame = 8;
1370 if (!_game._player._stepEnabled && !_takeBottleFl) {
1371 _scene->_sequences.addTimer(30, 70);
1372 _game._player._stepEnabled = true;
1373 }
1374 break;
1375
1376 default:
1377 break;
1378 }
1379
1380 if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) {
1381 _scene->_animation[0]->setCurrentFrame(nextFrame);
1382 _boatCurrentFrame = nextFrame;
1383 }
1384 }
1385 }
1386
1387 if (_game._trigger == 70) {
1388 switch (_globals[kBottleStatus]) {
1389 case 0:
1390 _vm->_dialogs->show(432);
1391 break;
1392
1393 case 1:
1394 _vm->_dialogs->show(70324);
1395 break;
1396
1397 case 2:
1398 _vm->_dialogs->show(70325);
1399 break;
1400
1401 case 3:
1402 _vm->_dialogs->show(70326);
1403 break;
1404
1405 case 4:
1406 _vm->_dialogs->show(70327);
1407 break;
1408
1409 default:
1410 break;
1411 }
1412 }
1413 }
1414
actions()1415 void Scene704::actions() {
1416 if (_game._screenObjects._inputMode == kInputConversation)
1417 handleFillBottle(_action._activeAction._verbId);
1418 else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_OPEN_WATER_TO_SOUTH)) {
1419 _game._player._stepEnabled = false;
1420 if (_boatDirection == 1)
1421 _animationMode = 5;
1422 else
1423 _animationMode = 3;
1424 } else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_BUILDING_TO_NORTH)) {
1425 _game._player._stepEnabled = false;
1426 if (_boatDirection == 2)
1427 _animationMode = 4;
1428 else
1429 _animationMode = 1;
1430 } else if (_action.isAction(VERB_TAKE, NOUN_BOTTLE)) {
1431 if (!_game._objects.isInInventory(OBJ_BOTTLE)) {
1432 _game._player._stepEnabled = false;
1433 _takeBottleFl = true;
1434 if (_boatDirection == 2) {
1435 _animationMode = 6;
1436 } else {
1437 _animationMode = 7;
1438 }
1439 }
1440 } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_WATER) || _action.isAction(VERB_FILL, NOUN_BOTTLE, NOUN_WATER)) {
1441 if (_game._objects.isInInventory(OBJ_BOTTLE)) {
1442 if (_globals[kBottleStatus] != 4) {
1443 _takeBottleFl = false;
1444 handleBottleInterface();
1445 _dialog1.start();
1446 } else
1447 _vm->_dialogs->show(70323);
1448 }
1449 } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_WATER))
1450 _vm->_dialogs->show(70410);
1451 else if (_action.isAction(VERB_LOOK, NOUN_BUILDING_TO_NORTH)) {
1452 if (_game._visitedScenes.exists(710))
1453 _vm->_dialogs->show(70411);
1454 else
1455 _vm->_dialogs->show(70412);
1456 } else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM))
1457 _vm->_dialogs->show(70413);
1458 else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == CAT_HOTSPOT))
1459 _vm->_dialogs->show(70414);
1460 else if (_action.isAction(VERB_LOOK, NOUN_OPEN_WATER_TO_SOUTH))
1461 _vm->_dialogs->show(70416);
1462 else if (_action.isAction(VERB_LOOK, NOUN_SKY))
1463 _vm->_dialogs->show(70417);
1464 else
1465 return;
1466
1467 _action._inProgress = false;
1468 }
1469
1470 /*------------------------------------------------------------------------*/
1471
setup()1472 void Scene705::setup() {
1473 _game._player._spritesPrefix = "";
1474 setAAName();
1475 }
1476
synchronize(Common::Serializer & s)1477 void Scene705::synchronize(Common::Serializer &s) {
1478 Scene7xx::synchronize(s);
1479 }
1480
handleBottleInterface()1481 void Scene705::handleBottleInterface() {
1482 switch (_globals[kBottleStatus]) {
1483 case 0:
1484 _dialog1.write(0x311, true);
1485 _dialog1.write(0x312, true);
1486 _dialog1.write(0x313, true);
1487 _dialog1.write(0x314, true);
1488 _dialog1.write(0x315, true);
1489 break;
1490
1491 case 1:
1492 _dialog1.write(0x311, false);
1493 _dialog1.write(0x312, true);
1494 _dialog1.write(0x313, true);
1495 _dialog1.write(0x314, true);
1496 _dialog1.write(0x315, true);
1497 break;
1498
1499 case 2:
1500 _dialog1.write(0x311, false);
1501 _dialog1.write(0x312, false);
1502 _dialog1.write(0x313, true);
1503 _dialog1.write(0x314, true);
1504 _dialog1.write(0x315, true);
1505 break;
1506
1507 case 3:
1508 _dialog1.write(0x311, false);
1509 _dialog1.write(0x312, false);
1510 _dialog1.write(0x313, false);
1511 _dialog1.write(0x314, true);
1512 _dialog1.write(0x315, true);
1513 break;
1514
1515 default:
1516 break;
1517 }
1518 }
1519
setBottleSequence()1520 void Scene705::setBottleSequence() {
1521 _scene->_userInterface.setup(kInputBuildingSentences);
1522 _game._player._stepEnabled = false;
1523 _scene->_sequences.remove(_globals._sequenceIndexes[3]);
1524 _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON;
1525 _scene->loadAnimation(formAnimName('F', -1), 90);
1526 }
1527
handleFillBottle(int quote)1528 void Scene705::handleFillBottle(int quote) {
1529 switch (quote) {
1530 case 0x311:
1531 _globals[kBottleStatus] = 1;
1532 setBottleSequence();
1533 break;
1534
1535 case 0x312:
1536 _globals[kBottleStatus] = 2;
1537 setBottleSequence();
1538 break;
1539
1540 case 0x313:
1541 _globals[kBottleStatus] = 3;
1542 setBottleSequence();
1543 break;
1544
1545 case 0x314:
1546 _globals[kBottleStatus] = 4;
1547 setBottleSequence();
1548 break;
1549
1550 case 0x315:
1551 _scene->_userInterface.setup(kInputBuildingSentences);
1552 break;
1553
1554 default:
1555 break;
1556 }
1557 }
1558
enter()1559 void Scene705::enter() {
1560 _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0));
1561 _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1));
1562 _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0));
1563
1564 _game._player._visible = false;
1565
1566 if (_scene->_priorSceneId == 706) {
1567 _game._player._stepEnabled = false;
1568 _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0);
1569 _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
1570 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
1571 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
1572 _game._player._stepEnabled = false;
1573 _scene->_sequences.addTimer(1, 80);
1574 _vm->_sound->command(28);
1575 } else
1576 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1);
1577
1578 if (_scene->_roomChanged)
1579 _game._objects.addToInventory(OBJ_BOTTLE);
1580
1581 _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0);
1582 _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0);
1583 sceneEntrySound();
1584 }
1585
step()1586 void Scene705::step() {
1587 switch (_game._trigger) {
1588 case 70:
1589 _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0);
1590 _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4);
1591 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
1592 break;
1593
1594 case 71: {
1595 int syncIdx = _globals._sequenceIndexes[3];
1596 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1);
1597 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx);
1598 _game._player._stepEnabled = true;
1599 }
1600 break;
1601
1602 default:
1603 break;
1604 }
1605
1606 switch (_game._trigger) {
1607 case 80:
1608 _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 1, 0, 0);
1609 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2);
1610 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 81);
1611 break;
1612
1613 case 81: {
1614 _vm->_sound->command(19);
1615 int syncIdx = _globals._sequenceIndexes[1];
1616 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1);
1617 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx);
1618 _game._player._stepEnabled = true;
1619 }
1620 break;
1621
1622 default:
1623 break;
1624 }
1625
1626 switch (_game._trigger) {
1627 case 90:
1628 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1);
1629 _scene->_sequences.addTimer(30, 91);
1630 break;
1631
1632 case 91:
1633 switch (_globals[kBottleStatus]) {
1634 case 0:
1635 _vm->_dialogs->show(432);
1636 break;
1637
1638 case 1:
1639 _vm->_dialogs->show(70324);
1640 break;
1641
1642 case 2:
1643 _vm->_dialogs->show(70325);
1644 break;
1645
1646 case 3:
1647 _vm->_dialogs->show(70326);
1648 break;
1649
1650 case 4:
1651 _vm->_dialogs->show(70327);
1652 break;
1653
1654 default:
1655 break;
1656 }
1657 _game._player._stepEnabled = true;
1658 break;
1659
1660 default:
1661 break;
1662 }
1663 }
1664
actions()1665 void Scene705::actions() {
1666 if (_game._screenObjects._inputMode == kInputConversation)
1667 handleFillBottle(_action._activeAction._verbId);
1668 else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_OPEN_WATER_TO_SOUTH)) {
1669 switch (_game._trigger) {
1670 case 0:
1671 _game._player._stepEnabled = false;
1672 _scene->_sequences.remove(_globals._sequenceIndexes[3]);
1673 _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0);
1674 _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2);
1675 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
1676 _vm->_sound->command(18);
1677 break;
1678
1679 case 1: {
1680 int syncIdx = _globals._sequenceIndexes[2];
1681 _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2);
1682 _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2);
1683 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx);
1684 _scene->_nextSceneId = 704;
1685 _game._player._stepEnabled = true;
1686 }
1687 break;
1688
1689 default:
1690 break;
1691 }
1692 } else if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_WINDOW)) {
1693 switch (_game._trigger) {
1694 case 0:
1695 _game._player._stepEnabled = false;
1696 _scene->_sequences.remove(_globals._sequenceIndexes[3]);
1697 _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0);
1698 _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 16);
1699 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
1700 break;
1701
1702 case 1: {
1703 int syncIdx = _globals._sequenceIndexes[3];
1704 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 16);
1705 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx);
1706 _scene->_nextSceneId = 706;
1707 _game._player._stepEnabled = true;
1708 }
1709 break;
1710
1711 default:
1712 break;
1713 }
1714 } else if (_action.isAction(VERB_FILL, NOUN_BOTTLE, NOUN_WATER) || _action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_WATER)) {
1715 if (_globals[kBottleStatus] != 4) {
1716 handleBottleInterface();
1717 _dialog1.start();
1718 } else
1719 _vm->_dialogs->show(70323);
1720 } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_WATER))
1721 _vm->_dialogs->show(70511);
1722 else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM))
1723 _vm->_dialogs->show(70512);
1724 else if (_action.isAction(VERB_LOOK, NOUN_OPEN_WATER_TO_SOUTH))
1725 _vm->_dialogs->show(70513);
1726 else if (_action.isAction(VERB_LOOK, NOUN_SKY))
1727 _vm->_dialogs->show(70514);
1728 else if (_action.isAction(VERB_LOOK, NOUN_BUILDING))
1729 _vm->_dialogs->show(70515);
1730 else if (_action.isAction(VERB_LOOK, NOUN_WINDOW))
1731 _vm->_dialogs->show(70516);
1732 else
1733 return;
1734
1735 _action._inProgress = false;
1736 }
1737
1738 /*------------------------------------------------------------------------*/
1739
Scene706(MADSEngine * vm)1740 Scene706::Scene706(MADSEngine *vm) : Scene7xx(vm) {
1741 _vaseHotspotId = -1;
1742 _vaseMode = -1;
1743 _animationMode = -1;
1744 _animationFrame = -1;
1745
1746 _emptyPedestral = false;
1747 }
1748
synchronize(Common::Serializer & s)1749 void Scene706::synchronize(Common::Serializer &s) {
1750 Scene7xx::synchronize(s);
1751
1752 s.syncAsSint16LE(_vaseHotspotId);
1753 s.syncAsSint16LE(_vaseMode);
1754 s.syncAsSint16LE(_animationMode);
1755 s.syncAsSint16LE(_animationFrame);
1756
1757 s.syncAsByte(_emptyPedestral);
1758 }
1759
setup()1760 void Scene706::setup() {
1761 setPlayerSpritesPrefix();
1762 setAAName();
1763 _scene->addActiveVocab(NOUN_BOTTLE);
1764 _scene->addActiveVocab(NOUN_VASE);
1765 _scene->addActiveVocab(VERB_WALKTO);
1766 }
1767
handleRexDeath()1768 void Scene706::handleRexDeath() {
1769 switch (_game._trigger) {
1770 case 0:
1771 _game._player._stepEnabled = false;
1772 _game._player._visible = false;
1773 _scene->loadAnimation(formAnimName('a', -1), 2);
1774 break;
1775
1776 case 2:
1777 if (_animationMode == 1)
1778 _vm->_dialogs->show(70625);
1779 else if (_globals[kBottleStatus] < 2)
1780 _vm->_dialogs->show(70628);
1781 else
1782 _vm->_dialogs->show(70629);
1783
1784 _game._objects.setRoom(OBJ_VASE, _scene->_currentSceneId);
1785 if (_animationMode == 2)
1786 _game._objects.setRoom(OBJ_BOTTLE, 2);
1787
1788 _animationMode = 0;
1789 _scene->_reloadSceneFlag = true;
1790 break;
1791
1792 default:
1793 break;
1794 }
1795 }
1796
handleTakeVase()1797 void Scene706::handleTakeVase() {
1798 switch (_game._trigger) {
1799 case 0:
1800 _game._player._stepEnabled = false;
1801 _game._player._visible = false;
1802 _globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 4, 2, 0, 0);
1803 _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]);
1804 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 7, 1);
1805 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
1806 break;
1807
1808 case 1:
1809 _vm->_sound->command(9);
1810 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
1811 _scene->_dynamicHotspots.remove(_vaseHotspotId);
1812 _game._objects.addToInventory(OBJ_VASE);
1813 if (_vaseMode == 1) {
1814 _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1);
1815 _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4);
1816 _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(195, 99));
1817 int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0));
1818 _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST);
1819 _game._objects.setRoom(OBJ_BOTTLE, _scene->_currentSceneId);
1820 }
1821 break;
1822
1823 case 2:
1824 _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]);
1825 _game._player._visible = true;
1826 _vm->_dialogs->showItem(OBJ_VASE, 70630);
1827 _game._player._stepEnabled = true;
1828 break;
1829 }
1830 }
1831
enter()1832 void Scene706::enter() {
1833 _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXMRC_3");
1834 _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', -1));
1835
1836 if (!_game._visitedScenes._sceneRevisited)
1837 _emptyPedestral = false;
1838
1839 if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId) {
1840 _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('v', -1));
1841 _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1);
1842 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4);
1843 int idx = _scene->_dynamicHotspots.add(NOUN_VASE, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0));
1844 _vaseHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST);
1845 } else if (_game._objects.isInRoom(OBJ_BOTTLE)) {
1846 _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1);
1847 _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4);
1848 _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(195, 99));
1849 int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0));
1850 _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST);
1851 }
1852
1853 _game._player._visible = true;
1854
1855 if (_scene->_priorSceneId == 707) {
1856 _game._player._playerPos = Common::Point(277, 103);
1857 _game._player._facing = FACING_SOUTHWEST;
1858 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
1859 _game._player._playerPos = Common::Point(167, 152);
1860 _game._player._facing = FACING_NORTH;
1861 }
1862
1863 if (_globals[kTeleporterCommand]) {
1864 _game._player._visible = false;
1865 _game._player._stepEnabled = false;
1866
1867 switch (_globals[kTeleporterCommand]) {
1868 case 1:
1869 _scene->loadAnimation(formAnimName('E', 1), 75);
1870 break;
1871
1872 case 2:
1873 _scene->loadAnimation(formAnimName('E', -1), 80);
1874 break;
1875
1876 default:
1877 _game._player.walk(Common::Point(264, 116), FACING_SOUTHWEST);
1878 _game._player._visible = true;
1879 _game._player._stepEnabled = true;
1880 break;
1881 }
1882 _globals[kTeleporterCommand] = 0;
1883 }
1884
1885 _animationMode = 0;
1886
1887 if (_scene->_roomChanged) {
1888 _game._objects.addToInventory(OBJ_BOTTLE);
1889 _globals[kBottleStatus] = 2;
1890 }
1891
1892 sceneEntrySound();
1893 }
1894
step()1895 void Scene706::step() {
1896 if (_game._trigger == 75) {
1897 _game._player._stepEnabled = true;
1898 _game._player._visible = true;
1899 _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount;
1900 _game._player.walk(Common::Point(264, 116), FACING_SOUTHWEST);
1901 }
1902
1903 if (_game._trigger == 80) {
1904 _globals[kTeleporterCommand] = 1;
1905 _scene->_nextSceneId = _globals[kTeleporterDestination];
1906 _scene->_reloadSceneFlag = true;
1907 }
1908
1909 if (_scene->_animation[0] != nullptr) {
1910 if ((_animationMode != 0) && (_scene->_animation[0]->getCurrentFrame() != _animationFrame)) {
1911 _animationFrame = _scene->_animation[0]->getCurrentFrame();
1912
1913 if (_animationFrame == 6) {
1914 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
1915 _game._objects.setRoom(OBJ_VASE, 2);
1916
1917 if (_animationMode == 2) {
1918 _game._objects.setRoom(OBJ_BOTTLE, 1);
1919
1920 _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1);
1921 _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4);
1922 _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(195, 99));
1923 int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0));
1924 _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST);
1925 }
1926 }
1927 }
1928 }
1929 }
1930
preActions()1931 void Scene706::preActions() {
1932 if (_action.isAction(VERB_LOOK, NOUN_PORTRAIT))
1933 _game._player._needToWalk = true;
1934 }
1935
actions()1936 void Scene706::actions() {
1937 if (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER)) {
1938 _game._player._stepEnabled = false;
1939 _game._player._visible = false;
1940 _scene->_nextSceneId = 707;
1941 _action._inProgress = false;
1942 return;
1943 }
1944
1945 if (_action.isAction(VERB_EXIT, NOUN_ROOM)) {
1946 _scene->_nextSceneId = 705;
1947 _action._inProgress = false;
1948 return;
1949 }
1950
1951 if (_action.isAction(VERB_TAKE, NOUN_VASE)) {
1952 if (_game._difficulty != DIFFICULTY_EASY) {
1953 _animationMode = 1;
1954 handleRexDeath();
1955 } else if (_game._trigger || !_game._objects.isInInventory(OBJ_VASE)) {
1956 handleTakeVase();
1957 _emptyPedestral = true;
1958 }
1959 _action._inProgress = false;
1960 return;
1961 }
1962
1963 if (_action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_PEDESTAL)) {
1964 if ((_globals[kBottleStatus] == 2 && _game._difficulty == DIFFICULTY_HARD) ||
1965 (_globals[kBottleStatus] != 0 && _game._difficulty != DIFFICULTY_HARD)) {
1966 if (!_game._objects.isInInventory(OBJ_VASE) || _game._trigger) {
1967 _vaseMode = 1;
1968 handleTakeVase();
1969 _action._inProgress = false;
1970 return;
1971 }
1972 } else if (_game._objects.isInRoom(OBJ_VASE) || _game._trigger) {
1973 _animationMode = 2;
1974 handleRexDeath();
1975 _action._inProgress = false;
1976 return;
1977 }
1978 }
1979
1980 if (_action.isAction(VERB_PUT, NOUN_PEDESTAL) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) {
1981 int objectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId);
1982 if (_game._objects[objectId].hasQuality(10))
1983 _vm->_dialogs->show(70626);
1984 else
1985 _vm->_dialogs->show(70627);
1986 } else if (_action.isAction(VERB_TAKE, NOUN_BOTTLE) && _game._objects.isInInventory(OBJ_VASE))
1987 _vm->_dialogs->show(70631);
1988 else if (_action._lookFlag) {
1989 if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId)
1990 _vm->_dialogs->show(70610);
1991 else
1992 _vm->_dialogs->show(70611);
1993 } else if (_action.isAction(VERB_LOOK, NOUN_FLOOR))
1994 _vm->_dialogs->show(70612);
1995 else if (_action.isAction(VERB_LOOK, NOUN_PILLAR))
1996 _vm->_dialogs->show(70613);
1997 else if (_action.isAction(VERB_LOOK, NOUN_OLD_TEA_CUP))
1998 _vm->_dialogs->show(70614);
1999 else if (_action.isAction(VERB_TAKE, NOUN_OLD_TEA_CUP))
2000 _vm->_dialogs->show(70615);
2001 else if (_action.isAction(VERB_LOOK, NOUN_OLD_VASE))
2002 _vm->_dialogs->show(70616);
2003 else if (_action.isAction(VERB_LOOK, NOUN_PORTRAIT))
2004 _vm->_dialogs->show(70617);
2005 else if (_action.isAction(VERB_LOOK, NOUN_NAME_PLATE))
2006 _vm->_dialogs->show(70618);
2007 else if (_action.isAction(VERB_LOOK, NOUN_WALL))
2008 _vm->_dialogs->show(70619);
2009 else if (_action.isAction(VERB_LOOK, NOUN_PEDESTAL)) {
2010 if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId)
2011 _vm->_dialogs->show(70620);
2012 else if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId)
2013 _vm->_dialogs->show(70622);
2014 else
2015 _vm->_dialogs->show(70621);
2016 } else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER))
2017 _vm->_dialogs->show(70623);
2018 else if (_action.isAction(VERB_LOOK, NOUN_VASE) && (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId))
2019 _vm->_dialogs->show(70624);
2020 else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == CAT_HOTSPOT))
2021 _vm->_dialogs->show(70632);
2022 else
2023 return;
2024
2025 _action._inProgress = false;
2026 }
2027
2028 /*------------------------------------------------------------------------*/
2029
setup()2030 void Scene707::setup() {
2031 _game._player._spritesPrefix = "";
2032 // The original calls Scene7xx::setAAName()
2033 _game._aaName = Resources::formatAAName(5);
2034 }
2035
enter()2036 void Scene707::enter() {
2037 _handSpriteId = _scene->_sprites.addSprites("*REXHAND");
2038 teleporterEnter();
2039
2040 // The original uses Scene7xx_sceneEntrySound
2041 if (!_vm->_musicFlag)
2042 _vm->_sound->command(2);
2043 else
2044 _vm->_sound->command(25);
2045 }
2046
step()2047 void Scene707::step() {
2048 teleporterStep();
2049 }
2050
actions()2051 void Scene707::actions() {
2052 if (teleporterActions()) {
2053 _action._inProgress = false;
2054 return;
2055 }
2056
2057 if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT) || _action.isAction(VERB_PEER_THROUGH, NOUN_VIEWPORT))
2058 _vm->_dialogs->show(70710);
2059 else if (_action.isAction(VERB_LOOK, NOUN_KEYPAD))
2060 _vm->_dialogs->show(70711);
2061 else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY))
2062 _vm->_dialogs->show(70712);
2063 else if (_action.isAction(VERB_LOOK, NOUN_0_KEY) || _action.isAction(VERB_LOOK, NOUN_1_KEY)
2064 || _action.isAction(VERB_LOOK, NOUN_2_KEY) || _action.isAction(VERB_LOOK, NOUN_3_KEY)
2065 || _action.isAction(VERB_LOOK, NOUN_4_KEY) || _action.isAction(VERB_LOOK, NOUN_5_KEY)
2066 || _action.isAction(VERB_LOOK, NOUN_6_KEY) || _action.isAction(VERB_LOOK, NOUN_7_KEY)
2067 || _action.isAction(VERB_LOOK, NOUN_8_KEY) || _action.isAction(VERB_LOOK, NOUN_9_KEY)
2068 || _action.isAction(VERB_LOOK, NOUN_SMILE_KEY) || _action.isAction(VERB_LOOK, NOUN_ENTER_KEY)
2069 || _action.isAction(VERB_LOOK, NOUN_FROWN_KEY))
2070 _vm->_dialogs->show(70713);
2071 else if (_action.isAction(VERB_LOOK, NOUN_DEVICE) || _action._lookFlag)
2072 _vm->_dialogs->show(70714);
2073 else
2074 return;
2075
2076 _action._inProgress = false;
2077 }
2078
2079 /*------------------------------------------------------------------------*/
2080
setup()2081 void Scene710::setup() {
2082 _game._player._spritesPrefix = "";
2083 setAAName();
2084 }
2085
enter()2086 void Scene710::enter() {
2087 _scene->_userInterface.setup(kInputLimitedSentences);
2088
2089 if (_game._objects[OBJ_VASE]._roomNumber == 706) {
2090 _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1));
2091 _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0);
2092 }
2093
2094 _game._player._visible = false;
2095 _scene->_sequences.addTimer(600, 70);
2096
2097 sceneEntrySound();
2098 }
2099
step()2100 void Scene710::step() {
2101 if (_game._trigger == 70) {
2102 if (_game._globals[kCityFlooded])
2103 _scene->_nextSceneId = 701;
2104 else
2105 _scene->_nextSceneId = 751;
2106 }
2107 }
2108
actions()2109 void Scene710::actions() {
2110 if (_action.isAction(VERB_PUT_DOWN, NOUN_BINOCULARS)) {
2111 _game._player._stepEnabled = false;
2112
2113 if (_game._globals[kCityFlooded])
2114 _scene->_nextSceneId = 701;
2115 else
2116 _scene->_nextSceneId = 751;
2117
2118 _action._inProgress = false;
2119 }
2120 }
2121
2122 /*------------------------------------------------------------------------*/
2123
setup()2124 void Scene711::setup() {
2125 // The original was calling Scene7xx::setPlayerSpreitesPrefix()
2126 _vm->_sound->command(5);
2127 Common::String oldName = _game._player._spritesPrefix;
2128 _game._player._spritesPrefix = "";
2129 _game._player._scalingVelocity = true;
2130
2131 if (oldName != _game._player._spritesPrefix)
2132 _game._player._spritesChanged = true;
2133
2134 _vm->_palette->setEntry(16, 10, 63, 63);
2135 _vm->_palette->setEntry(17, 10, 45, 45);
2136
2137 // The original was calling Scene7xx::setAAName()
2138 _game._aaName = Resources::formatAAName(5);
2139
2140 _game._player._spritesPrefix = "";
2141 }
2142
enter()2143 void Scene711::enter() {
2144 if (_globals[kSexOfRex] == REX_FEMALE)
2145 _handSpriteId = _scene->_sprites.addSprites("*ROXHAND");
2146 else
2147 _handSpriteId = _scene->_sprites.addSprites("*REXHAND");
2148
2149 teleporterEnter();
2150
2151 // The original was using Scene7xx_SceneEntrySound()
2152 if (!_vm->_musicFlag)
2153 _vm->_sound->command(2);
2154 else
2155 _vm->_sound->command(25);
2156 }
2157
step()2158 void Scene711::step() {
2159 teleporterStep();
2160 }
2161
actions()2162 void Scene711::actions() {
2163 if (teleporterActions())
2164 _action._inProgress = false;
2165 }
2166
2167 /*------------------------------------------------------------------------*/
2168
Scene751(MADSEngine * vm)2169 Scene751::Scene751(MADSEngine *vm) : Scene7xx(vm) {
2170 _rexHandingLine = false;
2171 }
2172
synchronize(Common::Serializer & s)2173 void Scene751::synchronize(Common::Serializer &s) {
2174 Scene7xx::synchronize(s);
2175
2176 s.syncAsByte(_rexHandingLine);
2177 }
2178
setup()2179 void Scene751::setup() {
2180 setPlayerSpritesPrefix();
2181 setAAName();
2182 _scene->addActiveVocab(NOUN_FISHING_LINE);
2183 _scene->addActiveVocab(VERB_WALKTO);
2184 }
2185
enter()2186 void Scene751::enter() {
2187 _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RM701X0");
2188 _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0));
2189 _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 0));
2190 _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RM202A1");
2191
2192 if (!_game._visitedScenes._sceneRevisited)
2193 _rexHandingLine = false;
2194
2195 if (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3) {
2196 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1);
2197 _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7);
2198 int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0));
2199 _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST);
2200 }
2201
2202 _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1);
2203 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
2204 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
2205
2206 if (_scene->_priorSceneId == 752) {
2207 _game._player._playerPos = Common::Point(309, 138);
2208 _game._player._facing = FACING_WEST;
2209 } else if (_scene->_priorSceneId == 710) {
2210 _game._player._playerPos = Common::Point(154, 129);
2211 _game._player._facing = FACING_NORTH;
2212 _game._player._visible = false;
2213 _game._player._stepEnabled = false;
2214 _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2);
2215 _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129));
2216 _scene->_sequences.addTimer(15, 70);
2217 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
2218 _game._player._playerPos = Common::Point(22, 131);
2219 _game._player._facing = FACING_EAST;
2220 _game._player._stepEnabled = false;
2221 _scene->_sequences.addTimer(60, 60);
2222 } else if (_rexHandingLine) {
2223 _game._player._visible = false;
2224 _game._player._playerPos = Common::Point(268, 140);
2225 _game._player._facing = FACING_NORTHWEST;
2226 _game._player._visible = false;
2227 _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7);
2228 _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]);
2229 } else if (_globals[kLineStatus] == 2) {
2230 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1);
2231 _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7);
2232 int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0));
2233 _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST);
2234 }
2235
2236 if (_scene->_roomChanged) {
2237 _game._objects.addToInventory(OBJ_FISHING_LINE);
2238 _game._objects.addToInventory(OBJ_BINOCULARS);
2239 }
2240
2241 sceneEntrySound();
2242 _game.loadQuoteSet(0x30A, 0x30B, 0x30C, 0x30D, 0x30E, 0);
2243
2244 if (_globals[kTimebombTimer] > 0)
2245 _globals[kTimebombTimer] = 10200;
2246 }
2247
step()2248 void Scene751::step() {
2249 switch (_game._trigger) {
2250 case 70:
2251 _scene->_sequences.remove(_globals._sequenceIndexes[4]);
2252 _globals._sequenceIndexes[4] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0);
2253 _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129));
2254 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
2255 break;
2256
2257 case 71:
2258 _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]);
2259 _game._player._visible = true;
2260 _game._player._stepEnabled = true;
2261 break;
2262
2263 default:
2264 break;
2265 }
2266
2267 if ((_globals[kTimebombTimer] >= 10800) && (_globals[kTimebombStatus] == 1)) {
2268 _globals[kTimebombStatus] = 3;
2269 _globals[kTimebombTimer] = 0;
2270 _globals[kCheckDaemonTimebomb] = false;
2271 _scene->_nextSceneId = 620;
2272 }
2273
2274 switch (_game._trigger) {
2275 case 60:
2276 _vm->_sound->command(16);
2277 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
2278 _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
2279 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
2280 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
2281 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 61);
2282 break;
2283
2284 case 61:
2285 _game._player.walk(Common::Point(61, 131), FACING_EAST);
2286 _scene->_sequences.addTimer(120, 62);
2287 break;
2288
2289 case 62:
2290 _vm->_sound->command(17);
2291 _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
2292 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
2293 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
2294 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 63);
2295 break;
2296
2297 case 63:
2298 _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1);
2299 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
2300 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
2301 _game._player._stepEnabled = true;
2302 _scene->_kernelMessages.reset();
2303 break;
2304
2305 default:
2306 break;
2307 }
2308 }
2309
preActions()2310 void Scene751::preActions() {
2311 if (_action.isAction(VERB_LOOK, NOUN_TALL_BUILDING))
2312 _game._player.walk(Common::Point(154, 129), FACING_NORTHEAST);
2313
2314 if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_TALL_BUILDING))
2315 _game._player.walk(Common::Point(154, 129), FACING_NORTH);
2316
2317 if (_action.isAction(VERB_WALKTO, NOUN_EAST_END_OF_PLATFORM))
2318 _game._player._walkOffScreenSceneId = 752;
2319
2320 if (!_rexHandingLine)
2321 return;
2322
2323 if (_action.isAction(VERB_LOOK) || _action.isObject(NOUN_FISHING_LINE) || _action.isAction(VERB_TALKTO))
2324 _game._player._needToWalk = false;
2325
2326 if ((!_action.isAction(VERB_PUT, NOUN_FISHING_LINE, NOUN_HOOK) || !_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_HOOK) || !_action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_HOOK))
2327 && (_game._player._needToWalk)) {
2328 switch (_game._trigger) {
2329 case 0:
2330 _game._player._readyToWalk = false;
2331 _game._player._stepEnabled = false;
2332 _scene->_sequences.remove(_globals._sequenceIndexes[2]);
2333 _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 11, 1, 0, 0);
2334 _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, 7);
2335 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
2336 break;
2337
2338 case 1:
2339 _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]);
2340 _game._player._visible = true;
2341 _rexHandingLine = false;
2342 _game._player._stepEnabled = true;
2343 _game._player._readyToWalk = true;
2344 break;
2345
2346 default:
2347 break;
2348 }
2349 }
2350 }
2351
actions()2352 void Scene751::actions() {
2353 if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM))
2354 ; // Nothing
2355 else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_TALL_BUILDING)) {
2356 switch (_game._trigger) {
2357 case 0:
2358 _game._player._stepEnabled = false;
2359 _game._player._visible = false;
2360 _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0);
2361 _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129));
2362 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
2363 break;
2364
2365 case 1: {
2366 int syncIdx = _globals._sequenceIndexes[4];
2367 _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2);
2368 _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129));
2369 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx);
2370 _scene->_sequences.addTimer(15, 2);
2371 }
2372 break;
2373
2374 case 2:
2375 _scene->_nextSceneId = 710;
2376 break;
2377
2378 default:
2379 break;
2380 }
2381 } else if (_action.isAction(VERB_STEP_INTO, NOUN_ELEVATOR)) {
2382 switch (_game._trigger) {
2383 case 0:
2384 _game._player._stepEnabled = false;
2385 _scene->_sequences.remove(_globals._sequenceIndexes[1]);
2386 _vm->_sound->command(16);
2387 _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
2388 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
2389 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
2390 _scene->_kernelMessages.reset();
2391 _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x30D));
2392 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
2393 break;
2394
2395 case 1:
2396 _game._player.walk(Common::Point(22, 131), FACING_EAST);
2397 _scene->_sequences.addTimer(120, 3);
2398 break;
2399
2400 case 3:
2401 _vm->_sound->command(17);
2402 _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0);
2403 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
2404 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
2405 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4);
2406 break;
2407
2408 case 4:
2409 _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1);
2410 _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136));
2411 _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10);
2412 _scene->_sequences.addTimer(60, 5);
2413 break;
2414
2415 case 5:
2416 _game._player._stepEnabled = true;
2417 _scene->_nextSceneId = 513;
2418 break;
2419
2420 default:
2421 break;
2422 }
2423 } else if (_action.isAction(VERB_PUT, NOUN_FISHING_LINE, NOUN_HOOK) || _action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_HOOK) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_HOOK)) {
2424 if (_globals[kLineStatus] == 1) {
2425 switch (_game._trigger) {
2426 case 0:
2427 _game._player._visible = false;
2428 _game._player._stepEnabled = false;
2429 _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0);
2430 _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, 6);
2431 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], -1);
2432 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1);
2433 break;
2434
2435 case 1: {
2436 int syncIdx = _globals._sequenceIndexes[2];
2437 _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7);
2438 _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx);
2439 _scene->_sequences.addTimer(30, 2);
2440 }
2441 break;
2442
2443 case 2:
2444 _rexHandingLine = true;
2445 _scene->_sequences.remove(_globals._sequenceIndexes[2]);
2446 _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0);
2447 _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 8, -2);
2448 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3);
2449 break;
2450
2451 case 3: {
2452 _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]);
2453 _game._player._visible = true;
2454 _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1);
2455 _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7);
2456 int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0));
2457 _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST);
2458 _scene->_kernelMessages.reset();
2459 _game._objects.setRoom(OBJ_FISHING_LINE, _scene->_currentSceneId);
2460 _rexHandingLine = false;
2461 _globals[kLineStatus] = 2;
2462 _game._player._stepEnabled = true;
2463 _vm->_dialogs->show(75120);
2464 }
2465 break;
2466
2467 default:
2468 break;
2469 }
2470 }
2471 } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_CITY))
2472 _vm->_dialogs->show(75110);
2473 else if (_action.isAction(VERB_LOOK, NOUN_ELEVATOR))
2474 _vm->_dialogs->show(75112);
2475 else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM))
2476 _vm->_dialogs->show(75113);
2477 else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_PYLON))
2478 _vm->_dialogs->show(75114);
2479 else if ((_action.isAction(VERB_LOOK, NOUN_HOOK) || _action.isAction(VERB_LOOK, NOUN_FISHING_LINE))
2480 && (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3))
2481 _vm->_dialogs->show(75116);
2482 else if (_action.isAction(VERB_LOOK, NOUN_HOOK))
2483 _vm->_dialogs->show(75115);
2484 else if (_action.isAction(VERB_LOOK, NOUN_ROCK))
2485 _vm->_dialogs->show(75117);
2486 else if (_action.isAction(VERB_TAKE, NOUN_ROCK))
2487 _vm->_dialogs->show(75118);
2488 else if (_action.isAction(VERB_LOOK, NOUN_EAST_END_OF_PLATFORM))
2489 _vm->_dialogs->show(75119);
2490 else if (_action.isAction(VERB_TAKE, NOUN_FISHING_LINE) && (_globals[kLineStatus] == 3 || _globals[kLineStatus] == 2))
2491 _vm->_dialogs->show(75121);
2492 else if (_action.isAction(VERB_LOOK, NOUN_TALL_BUILDING))
2493 _vm->_dialogs->show(75122);
2494 else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_CEMENT_PYLON) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_CEMENT_PYLON))
2495 _vm->_dialogs->show(75123);
2496 else
2497 return;
2498
2499 _action._inProgress = false;
2500 }
2501
2502 /*------------------------------------------------------------------------*/
2503
Scene752(MADSEngine * vm)2504 Scene752::Scene752(MADSEngine *vm) : Scene7xx(vm) {
2505 _cardId = -1;
2506 }
2507
synchronize(Common::Serializer & s)2508 void Scene752::synchronize(Common::Serializer &s) {
2509 Scene7xx::synchronize(s);
2510
2511 s.syncAsSint16LE(_cardId);
2512 }
2513
setup()2514 void Scene752::setup() {
2515 setPlayerSpritesPrefix();
2516 setAAName();
2517
2518 _scene->addActiveVocab(NOUN_ID_CARD);
2519 _scene->addActiveVocab(VERB_WALKTO);
2520 _scene->addActiveVocab(VERB_LOOK_AT);
2521 _scene->addActiveVocab(NOUN_LASER_BEAM);
2522 }
2523
enter()2524 void Scene752::enter() {
2525 _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('l', -1));
2526 _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_8");
2527
2528 if (_scene->_priorSceneId == 751) {
2529 _game._player._playerPos = Common::Point(13, 145);
2530 _game._player._facing = FACING_EAST;
2531 } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
2532 _game._player._playerPos = Common::Point(289, 138);
2533 _game._player.walk(Common::Point(262, 148), FACING_WEST);
2534 _game._player._facing = FACING_WEST;
2535 _game._player._visible = true;
2536 }
2537
2538 if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) {
2539 _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('i', -1));
2540 _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 1);
2541 _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8);
2542 int idx = _scene->_dynamicHotspots.add(NOUN_ID_CARD, VERB_WALKTO, _globals._sequenceIndexes[13], Common::Rect(0, 0, 0, 0));
2543 _cardId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 135), FACING_NORTH);
2544 }
2545
2546 if (_game._globals[kLaserHoleIsThere]) {
2547 _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1);
2548 _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 13);
2549 int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_LOOK_AT, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0));
2550 _scene->_dynamicHotspots.setPosition(idx, Common::Point(215, 130), FACING_NORTHWEST);
2551 }
2552
2553 if (_game._globals[kTeleporterCommand]) {
2554 switch(_game._globals[kTeleporterCommand]) {
2555 case TELEPORTER_BEAM_OUT:
2556 case TELEPORTER_WRONG:
2557 case TELEPORTER_STEP_OUT:
2558 _game._player._visible = true;
2559 _game._player._stepEnabled = true;
2560 break;
2561 default:
2562 break;
2563 }
2564
2565 _game._globals[kTeleporterCommand] = TELEPORTER_NONE;
2566 }
2567
2568 if (_globals._timebombTimer > 0)
2569 _globals._timebombTimer = 10800 - 600;
2570
2571 sceneEntrySound();
2572 }
2573
step()2574 void Scene752::step() {
2575 if (_globals._timebombTimer >= 10800 && _game._globals[kTimebombStatus] == TIMEBOMB_ACTIVATED) {
2576 _globals[kTimebombStatus] = TIMEBOMB_DEAD;
2577 _globals._timebombTimer = 0;
2578 _globals[kCheckDaemonTimebomb] = false;
2579 _scene->_nextSceneId = 620;
2580 }
2581 }
2582
preActions()2583 void Scene752::preActions() {
2584 if (_action.isAction(VERB_WALKTO, NOUN_WEST_END_OF_PLATFORM)) {
2585 _game._player._walkOffScreenSceneId = 751;
2586 }
2587 }
2588
actions()2589 void Scene752::actions() {
2590 if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM))
2591 ;
2592 else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) {
2593 _game._player._stepEnabled = false;
2594 _game._player._visible = false;
2595 _scene->_nextSceneId = 711;
2596 } else if (_action.isAction(VERB_TAKE, NOUN_ID_CARD) && (!_game._objects.isInInventory(OBJ_ID_CARD) || _game._trigger)) {
2597 switch (_game._trigger) {
2598 case 0:
2599 _game._player._stepEnabled = false;
2600 _game._player._visible = false;
2601 _globals._sequenceIndexes[12] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0);
2602 _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]);
2603 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1);
2604 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
2605 break;
2606 case 1:
2607 _vm->_sound->command(15);
2608 _scene->_sequences.remove(_globals._sequenceIndexes[13]);
2609 _game._objects.addToInventory(OBJ_ID_CARD);
2610 _scene->_dynamicHotspots.remove(_cardId);
2611 _vm->_dialogs->showItem(OBJ_ID_CARD, 830);
2612 break;
2613 case 2:
2614 _game._player._visible = true;
2615 _game._player._stepEnabled = true;
2616 break;
2617 default:
2618 break;
2619 }
2620 } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._savedFields._mainObjectSource == CAT_HOTSPOT) &&
2621 (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) {
2622 switch (_game._trigger) {
2623 case 0:
2624 _game._player._stepEnabled = false;
2625 _game._player._visible = false;
2626 _globals._sequenceIndexes[12] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0);
2627 _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]);
2628 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1);
2629 _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2);
2630 break;
2631 case 1:
2632 _vm->_sound->command(15);
2633 if (_game._objects.isInInventory(OBJ_BONE))
2634 _game._objects.setRoom(OBJ_BONE, NOWHERE);
2635 _game._objects.addToInventory(OBJ_BONES);
2636 _vm->_dialogs->showItem(OBJ_BONES, 75221);
2637 break;
2638 case 2:
2639 _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]);
2640 _game._player._visible = true;
2641 _game._player._stepEnabled = true;
2642 break;
2643 default:
2644 break;
2645 }
2646 } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_CITY)) {
2647 if (_globals[kLaserHoleIsThere])
2648 _vm->_dialogs->show(75212);
2649 else
2650 _vm->_dialogs->show(75210);
2651 } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM))
2652 _vm->_dialogs->show(75213);
2653 else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK))
2654 _vm->_dialogs->show(75214);
2655 else if (_action.isAction(VERB_LOOK, NOUN_ROCK))
2656 _vm->_dialogs->show(75215);
2657 else if (_action.isAction(VERB_TAKE, NOUN_ROCK))
2658 _vm->_dialogs->show(75216);
2659 else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM))
2660 _vm->_dialogs->show(75217);
2661 else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER))
2662 _vm->_dialogs->show(75218);
2663 else if ((_action.isAction(VERB_LOOK, NOUN_BONES) || _action.isAction(VERB_LOOK, NOUN_ID_CARD)) && (_action._mainObjectSource == CAT_HOTSPOT)) {
2664 if (_game._objects[OBJ_ID_CARD]._roomNumber == 752)
2665 _vm->_dialogs->show(75219);
2666 else
2667 _vm->_dialogs->show(75220);
2668 } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._savedFields._mainObjectSource == CAT_HOTSPOT)) {
2669 if (_game._objects.isInInventory(OBJ_BONES))
2670 _vm->_dialogs->show(75222);
2671 } else
2672 return;
2673
2674 _action._inProgress = false;
2675 }
2676
2677 /*------------------------------------------------------------------------*/
2678
2679 } // End of namespace Nebular
2680 } // End of namespace MADS
2681