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
|
/* 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 "common/events.h"
#include "common/textconsole.h"
#include "video/qt_decoder.h"
#include "pegasus/pegasus.h"
namespace Pegasus {
enum {
kCreditsCore = 0,
kCreditsSupport,
kCreditsOriginal,
kCreditsTalent,
kCreditsOther,
kCreditsMainMenu
};
static const int s_startCreditsSegment[] = { 0, 16, 25, 37, 39 };
static int findButtonForFrame(int frame) {
int button = kCreditsCore;
for (int i = kCreditsCore; i < kCreditsMainMenu; i++)
if (frame >= s_startCreditsSegment[i])
button = i;
return button;
}
void PegasusEngine::runCredits() {
Video::QuickTimeDecoder *creditsVideo = new Video::QuickTimeDecoder();
if (!creditsVideo->loadFile("Images/Credits/Credits.movie"))
error("Could not open credits movie");
// We're not playing, just retrieving frames
creditsVideo->pauseVideo(true);
int curButton = kCreditsCore;
int frame = 0;
drawCredits(curButton, false, frame, creditsVideo);
_system->updateScreen();
bool continueLooping = true;
while (!shouldQuit() && continueLooping) {
Common::Event event;
while (_eventMan->pollEvent(event)) {
bool needsUpdate = false;
switch (event.type) {
case Common::EVENT_KEYDOWN:
switch (event.kbd.keycode) {
case Common::KEYCODE_UP:
if (curButton != kCreditsCore)
curButton--;
frame = s_startCreditsSegment[curButton];
needsUpdate = true;
break;
case Common::KEYCODE_DOWN:
if (curButton != kCreditsMainMenu) {
curButton++;
if (curButton == kCreditsMainMenu)
frame = 43;
else
frame = s_startCreditsSegment[curButton];
needsUpdate = true;
}
break;
case Common::KEYCODE_LEFT:
if (frame > 0) {
frame--;
curButton = findButtonForFrame(frame);
needsUpdate = true;
}
break;
case Common::KEYCODE_RIGHT:
if (frame < 43) {
frame++;
curButton = findButtonForFrame(frame);
needsUpdate = true;
}
break;
case Common::KEYCODE_RETURN:
if (curButton == kCreditsMainMenu) {
drawCredits(curButton, true, frame, creditsVideo);
_system->updateScreen();
continueLooping = false;
}
break;
default:
break;
}
break;
default:
break;
}
if (needsUpdate) {
drawCredits(curButton, false, frame, creditsVideo);
_system->updateScreen();
}
}
_system->delayMillis(10);
}
delete creditsVideo;
}
void PegasusEngine::drawCredits(int button, bool highlight, int frame, Video::QuickTimeDecoder *video) {
static const int s_creditsButtonY[] = { 224, 260, 296, 332, 366, 407 };
_gfx->drawPict("Images/Credits/CredScrn.pict", 0, 0, false);
if (highlight)
_gfx->drawPict("Images/Credits/MainMenu.pict", 32, 412, false);
if (button == kCreditsMainMenu)
_gfx->drawPictTransparent("Images/Credits/SelectL.pict", 30, s_creditsButtonY[button], _gfx->getColor(0xf8, 0xf8, 0xf8));
else
_gfx->drawPictTransparent("Images/Credits/SelectS.pict", 40, s_creditsButtonY[button], _gfx->getColor(0xf8, 0xf8, 0xf8));
video->seekToTime(frame * 200);
_video->copyFrameToScreen(video->decodeNextFrame(), video->getWidth(), video->getHeight(), 288, 0);
}
void PegasusEngine::runDemoCredits() {
_gfx->drawPict("Images/Demo/DemoCredits.pict", 0, 0, true);
bool continueLooping = true;
while (!shouldQuit() && continueLooping) {
Common::Event event;
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_MOUSEMOVE:
_system->updateScreen();
break;
case Common::EVENT_KEYDOWN:
// Break on any keypress, but ignore the meta keys
// Except for num lock! num lock on OS9 is 'clear' and we need that for the inventory panel (along with the tilde)
continueLooping = (event.kbd.keycode == Common::KEYCODE_INVALID || (event.kbd.keycode >= Common::KEYCODE_CAPSLOCK && event.kbd.keycode <= Common::KEYCODE_COMPOSE));
break;
case Common::EVENT_LBUTTONDOWN:
continueLooping = false;
break;
default:
break;
}
}
_system->delayMillis(10);
}
}
} // End of namespace Pegasus
|