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
|
/* ScummVM - Scumm Interpreter
* Copyright (C) 2006 The ScummVM project
*
* 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.
*
* $URL$
* $Id$
*
*/
#include "kyra/kyra.h"
#include "kyra/kyra_v2.h"
#include "kyra/screen.h"
#include "kyra/resource.h"
#include "kyra/wsamovie.h"
#include "kyra/sound.h"
#include "common/system.h"
namespace Kyra {
KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngine(system, flags) {
memset(_gameShapes, 0, sizeof(_gameShapes));
_mouseSHPBuf = 0;
}
KyraEngine_v2::~KyraEngine_v2() {
delete [] _mouseSHPBuf;
}
int KyraEngine_v2::init() {
KyraEngine::init();
if (_res->getFileSize("6.FNT"))
_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
if (_res->getFileSize("8FAT.FNT"))
_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
_screen->loadFont(Screen::FID_GOLDFONT_FNT, "GOLDFONT.FNT");
_screen->setAnimBlockPtr(3500);
_screen->setScreenDim(0);
assert(_introStringsSize == 21);
for (int i = 0; i < 21; i++)
_introStringsDuration[i] = strlen(_introStrings[i]) * 8;
// No mouse display in demo
if (_flags.isDemo)
return 0;
_mouseSHPBuf = _res->fileData("PWGMOUSE.SHP", 0);
assert(_mouseSHPBuf);
for (int i = 0; i < 2; i++) {
_gameShapes[i] = _screen->getPtrToShape(_mouseSHPBuf, i);
assert(_gameShapes[i]);
}
_screen->setMouseCursor(0, 0, _gameShapes[0]);
return 0;
}
int KyraEngine_v2::go() {
if (_flags.isDemo) {
static const char *soundFileList[] = {
"K2_DEMO",
"LOLSYSEX"
};
_sound->setSoundFileList(soundFileList, 2);
} else {
// TODO: move this to proper place
static const char *soundFileList[] = {
"K2INTRO"
};
_sound->setSoundFileList(soundFileList, 1);
}
_sound->loadSoundFile(0);
// Temporary measure to work around the fact that there's
// several WSA files with identical names in different PAK files.
_res->unloadPakFile("OUTFARM.PAK");
_res->unloadPakFile("FLYTRAP.PAK");
seq_playSequences(kSequenceVirgin, kSequenceWestwood);
mainMenu();
return 0;
}
void KyraEngine_v2::mainMenu() {
bool running = true;
while (running && !_quitFlag) {
seq_playSequences(kSequenceTitle);
_screen->showMouse();
switch (gui_handleMainMenu()) {
case 0:
break;
case 1:
seq_playSequences(kSequenceOverview, kSequenceLibrary);
break;
case 2:
break;
case 3:
running = false;
break;
default:
break;
}
_screen->hideMouse();
}
}
} // end of namespace Kyra
|