1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "mohawk/cursors.h"
#include "mohawk/myst.h"
#include "mohawk/myst_areas.h"
#include "mohawk/myst_graphics.h"
#include "mohawk/myst_state.h"
#include "mohawk/myst_sound.h"
#include "mohawk/video.h"
#include "mohawk/myst_stacks/channelwood.h"
#include "common/events.h"
#include "common/system.h"
#include "common/textconsole.h"
namespace Mohawk {
namespace MystStacks {
Channelwood::Channelwood(MohawkEngine_Myst *vm) :
MystScriptParser(vm), _state(vm->_gameState->_channelwood) {
setupOpcodes();
}
Channelwood::~Channelwood() {
}
void Channelwood::setupOpcodes() {
// "Stack-Specific" Opcodes
REGISTER_OPCODE(100, Channelwood, o_bridgeToggle);
REGISTER_OPCODE(101, Channelwood, o_pipeExtend);
REGISTER_OPCODE(102, Channelwood, o_drawImageChangeCardAndVolume);
REGISTER_OPCODE(104, Channelwood, o_waterTankValveOpen);
REGISTER_OPCODE(105, Channelwood, o_leverStartMove);
REGISTER_OPCODE(106, Channelwood, o_leverEndMove);
REGISTER_OPCODE(107, Channelwood, o_leverMoveFail);
REGISTER_OPCODE(108, Channelwood, o_leverMove);
REGISTER_OPCODE(109, Channelwood, o_stairsDoorToggle);
REGISTER_OPCODE(110, Channelwood, o_valveHandleMove1);
REGISTER_OPCODE(111, Channelwood, o_valveHandleMoveStart1);
REGISTER_OPCODE(112, Channelwood, o_valveHandleMoveStop);
REGISTER_OPCODE(113, Channelwood, o_valveHandleMove2);
REGISTER_OPCODE(114, Channelwood, o_valveHandleMoveStart2);
REGISTER_OPCODE(115, Channelwood, o_valveHandleMove3);
REGISTER_OPCODE(116, Channelwood, o_valveHandleMoveStart3);
REGISTER_OPCODE(117, Channelwood, o_hologramMonitor);
REGISTER_OPCODE(118, Channelwood, o_drawerOpen);
REGISTER_OPCODE(119, Channelwood, o_hologramTemple);
REGISTER_OPCODE(120, Channelwood, o_leverElev3StartMove);
REGISTER_OPCODE(121, Channelwood, o_leverElev3EndMove);
REGISTER_OPCODE(122, Channelwood, o_waterTankValveClose);
REGISTER_OPCODE(123, Channelwood, o_executeMouseUp);
REGISTER_OPCODE(124, Channelwood, o_leverEndMoveWithSound);
REGISTER_OPCODE(125, Channelwood, o_pumpLeverMove);
REGISTER_OPCODE(126, Channelwood, o_pumpLeverEndMove);
REGISTER_OPCODE(127, Channelwood, o_elevatorMovies);
REGISTER_OPCODE(128, Channelwood, o_leverEndMoveResumeBackground);
REGISTER_OPCODE(129, Channelwood, o_soundReplace);
// "Init" Opcodes
REGISTER_OPCODE(201, Channelwood, o_lever_init);
REGISTER_OPCODE(202, Channelwood, o_pipeValve_init);
REGISTER_OPCODE(203, Channelwood, o_drawer_init);
// "Exit" Opcodes
REGISTER_OPCODE(300, Channelwood, NOP);
}
void Channelwood::disablePersistentScripts() {
}
void Channelwood::runPersistentScripts() {
}
uint16 Channelwood::getVar(uint16 var) {
switch(var) {
case 1: // Water Pump Bridge Raised
return _state.waterPumpBridgeState;
case 2: // Lower Walkway to Upper Walkway Elevator Raised
return _state.elevatorState;
case 3: // Water Flowing To Lower Walkway To Upper Walkway Elevator
return (_state.waterValveStates & 0xc0) == 0xc0;
case 4: // Water Flowing To Book Room Elevator
return ((_state.waterValveStates & 0xf8) == 0xb0 && _state.pipeState) ? 1 : 0;
case 5: // Lower Walkway to Upper Walkway Spiral Stair Lower Door State
return _state.stairsLowerDoorState;
case 6: // Pipe Bridge Extended
return _state.pipeState;
case 7: // Water Flowing To Water Pump For Bridge
return ((_state.waterValveStates & 0xe2) == 0x82 || (_state.waterValveStates & 0xf4) == 0xa0) ? 1 : 0;
case 8: // Water Tank Valve
return (_state.waterValveStates & 0x80) ? 1 : 0;
case 9: // State of First Water Valve
return (_state.waterValveStates & 0x40) ? 1 : 0;
case 10: // State of Second Water Valve
return (_state.waterValveStates & 0x20) ? 1 : 0;
case 11: // State of Right Third Water Valve
return (_state.waterValveStates & 0x10) ? 1 : 0;
case 12: // State of Right-Right Fourth Water Valve
return (_state.waterValveStates & 0x08) ? 1 : 0;
case 13: // State of Right-Left Fourth Water Valve
return (_state.waterValveStates & 0x04) ? 1 : 0;
case 14: // State of Left Third Water Valve
return (_state.waterValveStates & 0x02) ? 1 : 0;
case 15: // Water Flowing To Lower Walkway To Upper Walkway Elevator
return ((_state.waterValveStates & 0xf8) == 0xb8) ? 1 : 0;
case 16: // Channelwood Lower Walkway to Upper Walkway Spiral Stair Upper Door State
return _state.stairsUpperDoorState;
case 17: // Achenar's Holoprojector Selection
return _state.holoprojectorSelection;
case 18: // Sirrus's Room Bed Drawer Open
return _siriusDrawerState;
case 19: // Sound - Water Tank Valve
return (_state.waterValveStates & 0x80) ? 1 : 0;
case 20: // Sound - First Water Valve Water Flowing To Left
return ((_state.waterValveStates & 0xc0) == 0x80) ? 1 : 0;
case 21: // Sound - Second Water Valve Water Flowing To Right
return ((_state.waterValveStates & 0xe0) == 0xa0) ? 1 : 0;
case 22: // Sound - Right Third Water Valve Water Flowing To Right
return ((_state.waterValveStates & 0xf0) == 0xb0) ? 1 : 0;
case 23: // Sound - Right Third Water Valve Water Flowing To Left
return ((_state.waterValveStates & 0xf0) == 0xa0) ? 1 : 0;
case 24: // Sound - Second Water Valve Water Flowing To Left
return ((_state.waterValveStates & 0xe0) == 0x80) ? 1 : 0;
case 25: // Sound - Right-Right Fourth Valve Water Flowing To Left (To Pipe Bridge)
return ((_state.waterValveStates & 0xf8) == 0xb0) ? 1 : 0;
case 26: // Sound - Right-Left Fourth Valve Water Flowing To Right (To Pipe Down Tree)
return ((_state.waterValveStates & 0xf4) == 0xa4) ? 1 : 0;
case 27: // Sound - Right-Left Fourth Valve Water Flowing To Left (To Pipe Fork)
return ((_state.waterValveStates & 0xf4) == 0xa0) ? 1 : 0;
case 28: // Sound - Left Third Water Valve Flowing To Right (To Pipe Fork)
return ((_state.waterValveStates & 0xe2) == 0x82) ? 1 : 0;
case 29: // Sound - Left Third Water Valve Flowing To Left (To Pipe In Water)
return ((_state.waterValveStates & 0xe2) == 0x80) ? 1 : 0;
case 30: // Door State
return _doorOpened;
case 31: // Water flowing in pipe fork ?
// 0 -> keep sound.
// 1 -> not flowing.
// 2 --> flowing.
if ((_state.waterValveStates & 0xe2) == 0x82) // From left.
return 2;
if ((_state.waterValveStates & 0xf4) == 0xa0) // From right.
return 1;
return 0;
case 32: // Sound - Water Flowing in Pipe to Book Room Elevator
if ((_state.waterValveStates & 0xf8) == 0xb0)
return _state.pipeState ? 2 : 1;
return 0;
case 33: // Channelwood Lower Walkway to Upper Walkway Spiral Stair Upper Door State
if (_state.stairsUpperDoorState) {
if (_tempVar == 1)
return 2;
else
return 1;
} else {
return 0;
}
case 102: // Sirrus's Desk Drawer / Red Page State
if (_siriusDrawerState) {
if(!(_globals.redPagesInBook & 16) && (_globals.heldPage != 11))
return 2; // Drawer Open, Red Page Present
else
return 1; // Drawer Open, Red Page Taken
} else {
return 0; // Drawer Closed
}
case 103: // Blue Page Present
return !(_globals.bluePagesInBook & 16) && (_globals.heldPage != 5);
default:
return MystScriptParser::getVar(var);
}
}
void Channelwood::toggleVar(uint16 var) {
switch(var) {
case 1: // Water Pump Bridge Raised
_state.waterPumpBridgeState ^= 1;
break;
case 6: // Pipe Bridge Extended
_state.pipeState ^= 1;
break;
case 16: // Channelwood Lower Walkway to Upper Walkway Spiral Stair Upper Door State
_state.stairsUpperDoorState ^= 1;
break;
case 102: // Red page
if (!(_globals.redPagesInBook & 16)) {
if (_globals.heldPage == 11)
_globals.heldPage = 0;
else
_globals.heldPage = 11;
}
break;
case 103: // Blue page
if (!(_globals.bluePagesInBook & 16)) {
if (_globals.heldPage == 5)
_globals.heldPage = 0;
else
_globals.heldPage = 5;
}
break;
default:
MystScriptParser::toggleVar(var);
break;
}
}
bool Channelwood::setVarValue(uint16 var, uint16 value) {
bool refresh = false;
switch (var) {
case 2: // Lower Walkway to Upper Walkway Elevator Raised
if (_state.elevatorState != value) {
_state.elevatorState = value;
refresh = true;
}
break;
case 5: // Lower Walkway to Upper Walkway Spiral Stair Lower Door State
if (_state.stairsLowerDoorState != value) {
_state.stairsLowerDoorState = value;
refresh = true;
}
break;
case 9:
refresh = pipeChangeValve(value, 0x40);
break;
case 10:
refresh = pipeChangeValve(value, 0x20);
break;
case 11:
refresh = pipeChangeValve(value, 0x10);
break;
case 12:
refresh = pipeChangeValve(value, 0x08);
break;
case 13:
refresh = pipeChangeValve(value, 0x04);
break;
case 14:
refresh = pipeChangeValve(value, 0x02);
break;
case 18: // Sirrus's Room Bed Drawer Open
if (_siriusDrawerState != value) {
_siriusDrawerState = value;
refresh = true;
}
break;
case 30: // Door opened
_doorOpened = value;
break;
default:
refresh = MystScriptParser::setVarValue(var, value);
break;
}
return refresh;
}
bool Channelwood::pipeChangeValve(bool open, uint16 mask) {
if (open) {
if (!(_state.waterValveStates & mask)) {
_state.waterValveStates |= mask;
return true;
}
} else {
if (_state.waterValveStates & mask) {
_state.waterValveStates &= ~mask;
return true;
}
}
return false;
}
void Channelwood::o_bridgeToggle(uint16 var, const ArgumentsArray &args) {
VideoEntryPtr bridge = _vm->playMovie("bridge", kChannelwoodStack);
bridge->moveTo(292, 203);
// Toggle bridge state
if (_state.waterPumpBridgeState)
bridge->setBounds(Audio::Timestamp(0, 3050, 600), Audio::Timestamp(0, 6100, 600));
else
bridge->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 3050, 600));
_vm->waitUntilMovieEnds(bridge);
}
void Channelwood::o_pipeExtend(uint16 var, const ArgumentsArray &args) {
uint16 soundId = args[0];
debugC(kDebugScript, "\tsoundId: %d", soundId);
_vm->_sound->playEffect(soundId);
VideoEntryPtr pipe = _vm->playMovie("pipebrid", kChannelwoodStack);
pipe->moveTo(267, 170);
// Toggle pipe state
if (_state.pipeState)
pipe->setBounds(Audio::Timestamp(0, 3040, 600), Audio::Timestamp(0, 6080, 600));
else
pipe->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 3040, 600));
_vm->waitUntilMovieEnds(pipe);
_vm->_sound->resumeBackground();
}
void Channelwood::o_drawImageChangeCardAndVolume(uint16 var, const ArgumentsArray &args) {
uint16 imageId = args[0];
uint16 cardId = args[1];
debugC(kDebugScript, "\timageId: %d", imageId);
debugC(kDebugScript, "\tcardId: %d", cardId);
_vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333));
_vm->wait(200);
_vm->changeToCard(cardId, kTransitionPartToLeft);
if (args.size() == 3) {
uint16 volume = args[2];
_vm->_sound->changeBackgroundVolume(volume);
}
}
void Channelwood::o_waterTankValveOpen(uint16 var, const ArgumentsArray &args) {
Common::Rect rect = getInvokingResource<MystArea>()->getRect();
for (uint i = 0; i < 2; i++)
for (uint16 imageId = 3601; imageId >= 3595; imageId--) {
_vm->_gfx->copyImageToScreen(imageId, rect);
_vm->doFrame();
}
pipeChangeValve(true, 0x80);
}
void Channelwood::o_leverStartMove(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(0);
_vm->_cursor->setCursor(700);
_leverPulled = false;
}
void Channelwood::o_leverMove(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
if (lever->pullLeverV()) {
if (!_leverPulled) {
_leverPulled = true;
_leverAction->handleMouseUp();
}
} else {
_leverPulled = false;
}
}
void Channelwood::o_leverMoveFail(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
if (lever->pullLeverV()) {
if (!_leverPulled) {
_leverPulled = true;
uint16 soundId = lever->getList2(0);
if (soundId)
_vm->_sound->playEffect(soundId);
}
} else {
_leverPulled = false;
}
}
void Channelwood::o_leverEndMove(uint16 var, const ArgumentsArray &args) {
// Get current lever frame
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
// Release lever
lever->releaseLeverV();
uint16 soundId = lever->getList3(0);
if (soundId)
_vm->_sound->playEffect(soundId);
_vm->checkCursorHints();
}
void Channelwood::o_leverEndMoveResumeBackground(uint16 var, const ArgumentsArray &args) {
_vm->_sound->resumeBackground();
o_leverEndMove(var, args);
}
void Channelwood::o_leverEndMoveWithSound(uint16 var, const ArgumentsArray &args) {
o_leverEndMove(var, args);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
uint16 soundId = lever->getList3(0);
if (soundId)
_vm->_sound->playEffect(soundId);
}
void Channelwood::o_leverElev3StartMove(uint16 var, const ArgumentsArray &args) {
_vm->_gfx->copyImageToScreen(3970, Common::Rect(544, 333));
_vm->doFrame();
o_leverStartMove(var, args);
}
void Channelwood::o_leverElev3EndMove(uint16 var, const ArgumentsArray &args) {
o_leverEndMove(var, args);
_vm->_gfx->copyImageToScreen(3265, Common::Rect(544, 333));
_vm->doFrame();
_vm->_sound->playEffect(5265);
}
void Channelwood::o_pumpLeverMove(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
if (lever->pullLeverV()) {
uint16 soundId = lever->getList2(0);
_vm->_sound->playBackground(soundId, 38400);
} else {
uint16 soundId = lever->getList2(1);
_vm->_sound->playBackground(soundId, 36864);
}
}
void Channelwood::o_pumpLeverEndMove(uint16 var, const ArgumentsArray &args) {
o_leverEndMove(var, args);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
uint16 soundId = lever->getList3(0);
if (soundId)
_vm->_sound->playBackground(soundId, 36864);
}
void Channelwood::o_stairsDoorToggle(uint16 var, const ArgumentsArray &args) {
MystAreaVideo *movie = getInvokingResource<MystAreaVideo>();
if (_state.stairsUpperDoorState) {
// Close door, play the open movie backwards
movie->setDirection(-1);
movie->playMovie();
} else {
// Open door
movie->setDirection(1);
movie->playMovie();
}
}
void Channelwood::o_valveHandleMove1(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
if (handle->getRect().contains(mouse)) {
// Compute frame to draw
_tempVar = (mouse.x - 250) / 4;
_tempVar = CLIP<int16>(_tempVar, 1, handle->getStepsH() - 2);
// Draw frame
handle->drawFrame(_tempVar);
}
}
void Channelwood::o_valveHandleMoveStart1(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0);
if (soundId)
_vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700);
o_valveHandleMove1(var, args);
}
void Channelwood::o_valveHandleMoveStop(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
// Update state with valve position
if (_tempVar <= 5)
setVarValue(_valveVar, 1);
else
setVarValue(_valveVar, 0);
// Play release sound
uint16 soundId = handle->getList3(0);
if (soundId)
_vm->_sound->playEffect(soundId);
// Redraw valve
_vm->redrawArea(_valveVar);
// Restore cursor
_vm->checkCursorHints();
}
void Channelwood::o_valveHandleMove2(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
if (handle->getRect().contains(mouse)) {
// Compute frame to draw
_tempVar = handle->getStepsH() - (mouse.x - 234) / 4;
_tempVar = CLIP<int16>(_tempVar, 1, handle->getStepsH() - 2);
// Draw frame
handle->drawFrame(_tempVar);
}
}
void Channelwood::o_valveHandleMoveStart2(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0);
if (soundId)
_vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700);
o_valveHandleMove2(var, args);
}
void Channelwood::o_valveHandleMove3(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
if (handle->getRect().contains(mouse)) {
// Compute frame to draw
_tempVar = handle->getStepsH() - (mouse.x - 250) / 4;
_tempVar = CLIP<int16>(_tempVar, 1, handle->getStepsH() - 2);
// Draw frame
handle->drawFrame(_tempVar);
}
}
void Channelwood::o_valveHandleMoveStart3(uint16 var, const ArgumentsArray &args) {
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0);
if (soundId)
_vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700);
o_valveHandleMove3(var, args);
}
void Channelwood::o_hologramMonitor(uint16 var, const ArgumentsArray &args) {
// Used on Card 3012 (Temple Hologram Monitor)
uint16 button = args[0]; // 0 to 3
if (_state.holoprojectorSelection != button || !_vm->_video->isVideoPlaying()) {
_state.holoprojectorSelection = button;
_vm->redrawArea(17);
_vm->_video->stopVideos();
VideoEntryPtr video;
switch (button) {
case 0:
video = _vm->playMovie("monalgh", kChannelwoodStack);
video->moveTo(227, 70);
break;
case 1:
video = _vm->playMovie("monamth", kChannelwoodStack);
video->moveTo(227, 70);
break;
case 2:
video = _vm->playMovie("monasirs", kChannelwoodStack);
video->moveTo(227, 70);
break;
case 3:
video = _vm->playMovie("monsmsg", kChannelwoodStack);
video->moveTo(226, 68);
break;
default:
warning("Opcode o_hologramMonitor Control Variable Out of Range");
break;
}
}
}
void Channelwood::o_drawerOpen(uint16 var, const ArgumentsArray &args) {
_siriusDrawerState = 1;
_vm->redrawArea(18, false);
_vm->redrawArea(102, false);
}
void Channelwood::o_hologramTemple(uint16 var, const ArgumentsArray &args) {
_vm->_sound->pauseBackground();
// Used on Card 3333 (Temple Hologram)
switch (_state.holoprojectorSelection) {
case 0:
_vm->playMovieBlocking("holoalgh", kChannelwoodStack, 139, 64);
break;
case 1:
_vm->playMovieBlocking("holoamth", kChannelwoodStack, 127, 73);
break;
case 2:
_vm->playMovieBlocking("holoasir", kChannelwoodStack, 139, 64);
break;
case 3:
_vm->playMovieBlocking("holosmsg", kChannelwoodStack, 127, 45);
break;
default:
warning("Opcode o_hologramTemple Control Variable Out of Range");
break;
}
_vm->_sound->resumeBackground();
}
void Channelwood::o_executeMouseUp(uint16 var, const ArgumentsArray &args) {
MystArea *resource = _vm->getViewResource<MystArea>(args[0]);
resource->handleMouseUp();
}
void Channelwood::o_waterTankValveClose(uint16 var, const ArgumentsArray &args) {
Common::Rect rect = getInvokingResource<MystArea>()->getRect();
for (uint i = 0; i < 2; i++)
for (uint16 imageId = 3595; imageId <= 3601; imageId++) {
_vm->_gfx->copyImageToScreen(imageId, rect);
_vm->doFrame();
}
pipeChangeValve(false, 0x80);
}
void Channelwood::o_elevatorMovies(uint16 var, const ArgumentsArray &args) {
// Used by Card 3262 (Elevator)
uint16 elevator = args[0];
uint16 direction = args[1];
Common::String movie;
uint16 x;
uint16 y;
switch (elevator) {
case 1:
x = 214;
y = 106;
if (direction == 1)
movie = "welev1up";
else
movie = "welev1dn";
break;
case 2:
x = 215;
y = 117;
if (direction == 1)
movie = "welev2up";
else
movie = "welev2dn";
break;
case 3:
x = 213;
y = 98;
if (direction == 1)
movie = "welev3up";
else
movie = "welev3dn";
break;
default:
error("Unknown elevator state %d in o_elevatorMovies", elevator);
}
_vm->_sound->pauseBackground();
_vm->playMovieBlocking(movie, kChannelwoodStack, x, y);
_vm->_sound->resumeBackground();
}
void Channelwood::o_soundReplace(uint16 var, const ArgumentsArray &args) {
uint16 soundId = args[0];
if (!_vm->_sound->isEffectPlaying()) {
_vm->_sound->playEffect(soundId);
}
}
void Channelwood::o_lever_init(uint16 var, const ArgumentsArray &args) {
_leverAction = getInvokingResource<MystArea>();
}
void Channelwood::o_pipeValve_init(uint16 var, const ArgumentsArray &args) {
_valveVar = var;
}
void Channelwood::o_drawer_init(uint16 var, const ArgumentsArray &args) {
_siriusDrawerState = 0;
}
} // End of namespace MystStacks
} // End of namespace Mohawk
|