18
18
* along with this program; if not, write to the Free Software
19
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-2-1/engines/gob/init.cpp $
22
* $Id: init.cpp 51869 2010-08-08 00:43:45Z drmccoy $
55
55
void Init::cleanup() {
56
_vm->_video->freeDriver();
57
56
_vm->_global->_primarySurfDesc.reset();
59
58
_vm->_sound->speakerOff();
60
59
_vm->_sound->blasterStop(0);
61
_vm->_dataIO->closeDataFile();
60
_vm->_dataIO->closeArchive(true);
64
63
void Init::doDemo() {
65
64
if (_vm->isSCNDemo()) {
66
65
// This is a non-interactive demo with a SCN script and VMD videos
68
_vm->_video->setPrePalette();
70
67
SCNPlayer scnPlayer(_vm);
72
69
if (_vm->_demoIndex > 0)
86
83
void Init::initGame() {
95
87
if (!_vm->isDemo()) {
96
if (_vm->_dataIO->existData(_vm->_startStk.c_str()))
97
_vm->_dataIO->openDataFile(_vm->_startStk.c_str());
88
if (_vm->_dataIO->hasFile(_vm->_startStk))
89
_vm->_dataIO->openArchive(_vm->_startStk, true);
100
92
_vm->_util->initInput();
132
if (!_vm->_dataIO->existData("intro.inf")) {
124
Common::SeekableReadStream *infFile = _vm->_dataIO->getFile("intro.inf");
134
127
for (int i = 0; i < 4; i++)
135
128
_vm->_draw->loadFont(i, _fontNames[i]);
138
infBuf = _vm->_dataIO->getData("intro.inf");
139
infPtr = (char *)infBuf;
141
infEnd = (char *)(infBuf + _vm->_dataIO->getDataSize("intro.inf"));
143
for (int i = 0; i < 8; i++, infPtr++) {
146
for (j = 0; infPtr < infEnd && *infPtr >= ' '; j++, infPtr++)
150
strcat(buffer, ".let");
152
_vm->_draw->loadFont(i, buffer);
154
if ((infPtr + 1) >= infEnd)
132
for (int i = 0; i < 8; i++) {
136
Common::String font = infFile->readLine();
137
if (infFile->eos() && font.empty())
142
_vm->_draw->loadFont(i, font.c_str());
162
if (_vm->_dataIO->existData(_vm->_startTot.c_str())) {
148
if (_vm->_dataIO->hasFile(_vm->_startTot)) {
163
149
_vm->_inter->allocateVars(Script::getVariablesCount(_vm->_startTot.c_str(), _vm));
165
strcpy(_vm->_game->_curTotFile, _vm->_startTot.c_str());
151
_vm->_game->_curTotFile = _vm->_startTot;
167
153
_vm->_sound->cdTest(1, "GOB");
168
154
_vm->_sound->cdLoadLIC("gob.lic");
170
156
// Search for a Coktel logo animation or image to display
171
if (_vm->_dataIO->existData("coktel.imd")) {
157
if (_vm->_dataIO->hasFile("coktel.imd")) {
172
158
_vm->_draw->initScreen();
173
159
_vm->_draw->_cursorIndex = -1;
184
170
_vm->_draw->closeScreen();
185
} else if (_vm->_dataIO->existData("coktel.clt")) {
186
_vm->_draw->initScreen();
187
_vm->_util->clearPalette();
189
DataStream *stream = _vm->_dataIO->getDataStream("coktel.clt");
190
stream->read((byte *)_vm->_draw->_vgaPalette, 768);
193
if (_vm->_dataIO->existData("coktel.ims")) {
196
sprBuf = _vm->_dataIO->getData("coktel.ims");
197
_vm->_video->drawPackedSprite(sprBuf, 320, 200, 0, 0, 0,
198
*_vm->_draw->_frontSurface);
199
_vm->_palAnim->fade(_palDesc, 0, 0);
200
_vm->_util->delay(500);
171
} else if (_vm->_dataIO->hasFile("coktel.clt")) {
172
Common::SeekableReadStream *stream = _vm->_dataIO->getFile("coktel.clt");
174
_vm->_draw->initScreen();
175
_vm->_util->clearPalette();
177
stream->read((byte *)_vm->_draw->_vgaPalette, 768);
181
byte *sprite = _vm->_dataIO->getFile("coktel.ims", size);
183
_vm->_video->drawPackedSprite(sprite, 320, 200, 0, 0, 0,
184
*_vm->_draw->_frontSurface);
185
_vm->_palAnim->fade(_palDesc, 0, 0);
186
_vm->_util->delay(500);
191
_vm->_draw->closeScreen();
204
_vm->_draw->closeScreen();
207
195
_vm->_game->start();