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
|
/* 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 "sherlock/scalpel/scalpel.h"
#include "sherlock/sherlock.h"
namespace Sherlock {
namespace Scalpel {
#define NUM_PLACES 100
const int MAP_X[NUM_PLACES] = {
0, 368, 0, 219, 0, 282, 0, 43, 0, 0, 396, 408, 0, 0, 0, 568, 37, 325,
28, 0, 263, 36, 148, 469, 342, 143, 443, 229, 298, 0, 157, 260, 432,
174, 0, 351, 0, 528, 0, 136, 0, 0, 0, 555, 165, 0, 506, 0, 0, 344, 0, 0
};
const int MAP_Y[NUM_PLACES] = {
0, 147, 0, 166, 0, 109, 0, 61, 0, 0, 264, 70, 0, 0, 0, 266, 341, 30, 275,
0, 294, 146, 311, 230, 184, 268, 133, 94, 207, 0, 142, 142, 330, 255, 0,
37, 0, 70, 0, 116, 0, 0, 0, 50, 21, 0, 303, 0, 0, 229, 0, 0
};
ScalpelEngine::ScalpelEngine(OSystem *syst, const SherlockGameDescription *gameDesc) :
SherlockEngine(syst, gameDesc) {
_chess = nullptr;
_darts = nullptr;
_tempFadeStyle = 0;
_chessResult = 0;
}
ScalpelEngine::~ScalpelEngine() {
delete _chess;
delete _darts;
}
/**
* Game initialization
*/
void ScalpelEngine::initialize() {
SherlockEngine::initialize();
_chess = new Chess(this);
_darts = new Darts(this);
_flags.resize(100 * 8);
_flags[3] = true; // Turn on Alley
_flags[39] = true; // Turn on Baker Street
// Load the map co-ordinates for each scene
for (int idx = 0; idx < NUM_PLACES; ++idx)
_map.push_back(Common::Point(MAP_X[idx], MAP_Y[idx]));
// Starting scene
_scene->_goToRoom = 4;
}
/**
* Show the opening sequence
*/
void ScalpelEngine::showOpening() {
if (!showCityCutscene())
return;
if (!showAlleyCutscene())
return;
if (!showStreetCutscene())
return;
if (!showOfficeCutscene())
return;
_events->clearEvents();
_sound->stopMusic();
}
bool ScalpelEngine::showCityCutscene() {
byte palette[PALETTE_SIZE];
_sound->playMusic("prolog1.mus");
_titleOverride = "title.lib";
_soundOverride = "title.snd";
bool finished = _animation->playPrologue("26open1", 1, 255, true, 2);
if (finished) {
ImageFile titleImages("title2.vgs", true);
_screen->_backBuffer.blitFrom(*_screen);
_screen->_backBuffer2.blitFrom(*_screen);
// London, England
_screen->_backBuffer.transBlitFrom(titleImages[0], Common::Point(10, 11));
_screen->randomTransition();
finished = _events->delay(1000, true);
// November, 1888
if (finished) {
_screen->_backBuffer.transBlitFrom(titleImages[1], Common::Point(101, 102));
_screen->randomTransition();
finished = _events->delay(5000, true);
}
// Transition out the title
_screen->_backBuffer.blitFrom(_screen->_backBuffer2);
_screen->randomTransition();
}
if (finished)
finished = _animation->playPrologue("26open2", 1, 0, false, 2);
if (finished) {
ImageFile titleImages("title.vgs", true);
_screen->_backBuffer.blitFrom(*_screen);
_screen->_backBuffer2.blitFrom(*_screen);
// The Lost Files of
_screen->_backBuffer.transBlitFrom(titleImages[0], Common::Point(75, 6));
// Sherlock Holmes
_screen->_backBuffer.transBlitFrom(titleImages[1], Common::Point(34, 21));
// copyright
_screen->_backBuffer.transBlitFrom(titleImages[2], Common::Point(4, 190));
_screen->verticalTransition();
finished = _events->delay(4000, true);
if (finished) {
_screen->_backBuffer.blitFrom(_screen->_backBuffer2);
_screen->randomTransition();
finished = _events->delay(2000);
}
if (finished) {
_screen->getPalette(palette);
_screen->fadeToBlack(2);
}
if (finished) {
// In the alley...
_screen->transBlitFrom(titleImages[3], Common::Point(72, 51));
_screen->fadeIn(palette, 3);
finished = _events->delay(3000, true);
}
}
_titleOverride = "";
_soundOverride = "";
return finished;
}
bool ScalpelEngine::showAlleyCutscene() {
// TODO
return true;
}
bool ScalpelEngine::showStreetCutscene() {
// TODO
return true;
}
bool ScalpelEngine::showOfficeCutscene() {
// TODO
return true;
}
/**
* Starting a scene within the game
*/
void ScalpelEngine::startScene() {
if (_scene->_goToRoom == 100 || _scene->_goToRoom == 98) {
// Chessboard selection
if (_sound->_musicOn) {
if (_sound->loadSong(100)) {
if (_sound->_music)
_sound->startSong();
}
}
_scene->_goToRoom = _chess->doChessBoard();
_sound->freeSong();
_scene->_hsavedPos = Common::Point(-1, -1);
_scene->_hsavedFs = -1;
}
// Some rooms are prologue cutscenes, rather than normal game scenes. These are:
// 2: Blackwood's capture
// 52: Rescuing Anna
// 53: Moorehead's death / subway train
// 55: Fade out and exit
// 70: Brumwell suicide
switch (_scene->_goToRoom) {
case 2:
case 52:
case 53:
case 70:
if (_sound->_musicOn && _sound->loadSong(_scene->_goToRoom)) {
if (_sound->_music)
_sound->startSong();
}
switch (_scene->_goToRoom) {
case 2:
// Blackwood's capture
_res->addToCache("final2.vda", "epilogue.lib");
_res->addToCache("final2.vdx", "epilogue.lib");
_animation->playPrologue("final1", 1, 3, true, 4);
_animation->playPrologue("final22", 1, 0, false, 4);
break;
case 52:
// Rescuing Anna
_res->addToCache("finalr2.vda", "epilogue.lib");
_res->addToCache("finalr2.vdx", "epilogue.lib");
_res->addToCache("finale1.vda", "epilogue.lib");
_res->addToCache("finale1.vdx", "epilogue.lib");
_res->addToCache("finale2.vda", "epilogue.lib");
_res->addToCache("finale2.vdx", "epilogue.lib");
_res->addToCache("finale3.vda", "epilogue.lib");
_res->addToCache("finale3.vdx", "epilogue.lib");
_res->addToCache("finale4.vda", "EPILOG2.lib");
_res->addToCache("finale4.vdx", "EPILOG2.lib");
_animation->playPrologue("finalr1", 1, 3, true, 4);
_animation->playPrologue("finalr2", 1, 0, false, 4);
if (!_res->isInCache("finale2.vda")) {
// Finale file isn't cached
_res->addToCache("finale2.vda", "epilogue.lib");
_res->addToCache("finale2.vdx", "epilogue.lib");
_res->addToCache("finale3.vda", "epilogue.lib");
_res->addToCache("finale3.vdx", "epilogue.lib");
_res->addToCache("finale4.vda", "EPILOG2.lib");
_res->addToCache("finale4.vdx", "EPILOG2.lib");
}
_animation->playPrologue("finale1", 1, 0, false, 4);
_animation->playPrologue("finale2", 1, 0, false, 4);
_animation->playPrologue("finale3", 1, 0, false, 4);
_useEpilogue2 = true;
_animation->playPrologue("finale4", 1, 0, false, 4);
_useEpilogue2 = false;
break;
case 53:
// Moorehead's death / subway train
_res->addToCache("SUBWAY2.vda", "epilogue.lib");
_res->addToCache("SUBWAY2.vdx", "epilogue.lib");
_res->addToCache("SUBWAY3.vda", "epilogue.lib");
_res->addToCache("SUBWAY3.vdx", "epilogue.lib");
_animation->playPrologue("SUBWAY1", 1, 3, true, 4);
_animation->playPrologue("SUBWAY2", 1, 0, false, 4);
_animation->playPrologue("SUBWAY3", 1, 0, false, 4);
// Set fading to direct fade temporary so the transition goes quickly.
_tempFadeStyle = _screen->_fadeStyle ? 257 : 256;
_screen->_fadeStyle = false;
break;
case 70:
// Brumwell suicide
_animation->playPrologue("suicid", 1, 3, true, 4);
break;
default:
break;
}
// Except for the Moorehead Murder scene, fade to black first
if (_scene->_goToRoom != 53) {
_events->wait(40);
_screen->fadeToBlack(3);
}
switch (_scene->_goToRoom) {
case 52:
_scene->_goToRoom = 27; // Go to the Lawyer's Office
_scene->_bigPos = Common::Point(0, 0); // Overland scroll position
_scene->_overPos = Common::Point(22900 - 600, 9400 + 900); // Overland position
_scene->_oldCharPoint = 27;
break;
case 53:
_scene->_goToRoom = 17; // Go to St. Pancras Station
_scene->_bigPos = Common::Point(0, 0); // Overland scroll position
_scene->_overPos = Common::Point(32500 - 600, 3000 + 900); // Overland position
_scene->_oldCharPoint = 17;
break;
default:
_scene->_goToRoom = 4; // Back to Baker st.
_scene->_bigPos = Common::Point(0, 0); // Overland scroll position
_scene->_overPos = Common::Point(14500 - 600, 8400 + 900); // Overland position
_scene->_oldCharPoint = 4;
break;
}
// Free any song from the previous scene
_sound->freeSong();
break;
case 55:
// Exit game
_screen->fadeToBlack(3);
quitGame();
return;
default:
break;
}
_events->loadCursors("rmouse.vgs");
_events->setCursor(ARROW);
if (_scene->_goToRoom == 99) {
// Chess Board
_darts->playDarts();
_chessResult = _scene->_goToRoom = 19; // Go back to the bar
}
_chessResult = _scene->_goToRoom;
}
/**
* Takes care of clearing the mirror in scene 12, in case anything drew over it
*/
void ScalpelEngine::eraseMirror12() {
// TODO
}
/**
* Takes care of drawing Holme's reflection onto the mirror in scene 12
*/
void ScalpelEngine::doMirror12() {
// TODO
}
/**
* This clears the mirror in scene 12 in case anything messed draw over it
*/
void ScalpelEngine::flushMirror12() {
// TODO
}
} // End of namespace Scalpel
} // End of namespace Scalpel
|