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
|
/* 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_graphics.h"
#include "mohawk/myst_stacks/demo.h"
#include "common/system.h"
namespace Mohawk {
namespace MystStacks {
Demo::Demo(MohawkEngine_Myst *vm) :
Intro(vm, kDemoStack),
_returnToMenuRunning(false),
_returnToMenuStep(0),
_returnToMenuNextTime(0) {
setupOpcodes();
}
Demo::~Demo() {
}
void Demo::setupOpcodes() {
// "Stack-Specific" Opcodes
OVERRIDE_OPCODE(100, Demo, o_stopIntro);
REGISTER_OPCODE(101, Demo, o_fadeFromBlack);
REGISTER_OPCODE(102, Demo, o_fadeToBlack);
// "Init" Opcodes
OVERRIDE_OPCODE(201, Demo, o_returnToMenu_init);
}
void Demo::disablePersistentScripts() {
Intro::disablePersistentScripts();
_returnToMenuRunning = false;
}
void Demo::runPersistentScripts() {
Intro::runPersistentScripts();
if (_returnToMenuRunning) {
returnToMenu_run();
}
}
void Demo::o_stopIntro(uint16 var, const ArgumentsArray &args) {
// The original also seems to stop the movies. Not needed with this engine.
_vm->_gfx->fadeToBlack();
}
void Demo::o_fadeFromBlack(uint16 var, const ArgumentsArray &args) {
// FIXME: This glitches when enabled. The backbuffer is drawn to screen,
// and then the fading occurs, causing the background to appear for one frame.
// _vm->_gfx->fadeFromBlack();
}
void Demo::o_fadeToBlack(uint16 var, const ArgumentsArray &args) {
_vm->_gfx->fadeToBlack();
}
void Demo::returnToMenu_run() {
uint32 time = _vm->getTotalPlayTime();
if (time < _returnToMenuNextTime)
return;
switch (_returnToMenuStep) {
case 0:
_vm->_gfx->fadeToBlack();
_vm->changeToCard(2003, kNoTransition);
_vm->_gfx->fadeFromBlack();
_returnToMenuStep++;
break;
case 1:
_vm->_gfx->fadeToBlack();
_vm->changeToCard(2001, kNoTransition);
_vm->_gfx->fadeFromBlack();
_vm->_cursor->showCursor();
_returnToMenuStep++;
break;
default:
break;
}
}
void Demo::o_returnToMenu_init(uint16 var, const ArgumentsArray &args) {
// Used on Card 2001, 2002 and 2003
_returnToMenuNextTime = _vm->getTotalPlayTime() + 5000;
_returnToMenuRunning = true;
}
} // End of namespace MystStacks
} // End of namespace Mohawk
|