void CGEEngine::sceneUp() { debugC(1, kCGEDebugEngine, "CGEEngine::sceneUp()"); const int BakRef = 1000 * _now; if (_music) _midiPlayer->loadMidi(_now); showBak(BakRef); loadMapping(); Sprite *spr = _vga->_spareQ->first(); while (spr) { Sprite *n = spr->_next; if (spr->_scene == _now || spr->_scene == 0) if (spr->_ref != BakRef) { if (spr->_flags._back) spr->backShow(); else expandSprite(spr); } spr = n; } _sound->stop(); _fx->clear(); _fx->preload(0); _fx->preload(BakRef); if (_hero) { _hero->gotoxy(_heroXY[_now - 1].x, _heroXY[_now - 1].y); // following 2 lines trims Hero's Z position! _hero->tick(); _hero->_time = 1; _hero->_flags._hide = false; } if (!_dark) _vga->sunset(); _vga->copyPage(0, 1); selectPocket(-1); if (_hero) _vga->_showQ->insert(_vga->_showQ->remove(_hero)); if (_shadow) { _vga->_showQ->remove(_shadow); _shadow->makeXlat(_vga->glass(_vga->_sysPal, 204, 204, 204)); _vga->_showQ->insert(_shadow, _hero); _shadow->_z = _hero->_z; } feedSnail(_vga->_showQ->locate(BakRef + 999), kTake); _vga->show(); _vga->copyPage(1, 0); _vga->show(); _vga->sunrise(_vga->_sysPal); _dark = false; if (!_startupMode) _mouse->on(); }
void CGEEngine::runGame() { if (_quitFlag) return; loadHeroXY(); _sceneLight->_flags._tran = true; _vga->_showQ->append(_sceneLight); _sceneLight->_flags._hide = false; const Seq pocSeq[] = { { 0, 0, 0, 0, 20 }, { 1, 2, 0, 0, 4 }, { 2, 3, 0, 0, 4 }, { 3, 4, 0, 0, 16 }, { 2, 5, 0, 0, 4 }, { 1, 6, 0, 0, 4 }, { 0, 1, 0, 0, 16 }, }; Seq *seq = (Seq *)malloc(7 * sizeof(Seq)); Common::copy(pocSeq, pocSeq + 7, seq); _pocLight->setSeq(seq); _pocLight->_flags._tran = true; _pocLight->_time = 1; _pocLight->_z = 120; _vga->_showQ->append(_pocLight); selectPocket(-1); _vga->_showQ->append(_mouse); loadUser(); if ((_sprite = _vga->_spareQ->locate(121)) != NULL) _commandHandlerTurbo->addCommand(kCmdSeq, -1, _vga->_mono, _sprite); if ((_sprite = _vga->_spareQ->locate(122)) != NULL) _sprite->step(_music); _commandHandlerTurbo->addCommand(kCmdSeq, -1, _music, _sprite); if (!_music) _midiPlayer->killMidi(); if (_resman->exist("MINI.SPR")) { _miniShp = new BitmapPtr[2]; _miniShp[0] = _miniShp[1] = NULL; loadSprite("MINI", -1, 0, kMiniX, kMiniY); expandSprite(_miniScene = _sprite); // NULL is ok if (_miniScene) { _miniScene->_flags._kill = false; _miniScene->_flags._hide = true; _miniShp[0] = new Bitmap(this, *_miniScene->shp()); _miniShpList = _miniScene->setShapeList(_miniShp); postMiniStep(-1); } } if (_hero) { expandSprite(_hero); _hero->gotoxy(_heroXY[_now - 1].x, _heroXY[_now - 1].y); if (_resman->exist("00SHADOW.SPR")) { loadSprite("00SHADOW", -1, 0, _hero->_x + 14, _hero->_y + 51); delete _shadow; if ((_shadow = _sprite) != NULL) { _shadow->_ref = 2; _shadow->_flags._tran = true; _shadow->_flags._kill = false; _hero->_flags._shad = true; _vga->_showQ->insert(_vga->_spareQ->remove(_shadow), _hero); } } } _infoLine->gotoxy(kInfoX, kInfoY); _infoLine->_flags._tran = true; _infoLine->update(NULL); _vga->_showQ->insert(_infoLine); _debugLine->_z = 126; _vga->_showQ->insert(_debugLine); if (_horzLine) { _horzLine->_y = kMapTop - (kMapTop > 0); _horzLine->_z = 126; _vga->_showQ->insert(_horzLine); } _mouse->_busy = _vga->_spareQ->locate(kBusyRef); if (_mouse->_busy) expandSprite(_mouse->_busy); _startupMode = 0; _commandHandler->addCommand(kCmdLevel, -1, _oldLev, &_sceneLight); _sceneLight->gotoxy(kSceneX + ((_now - 1) % kSceneNx) * kSceneDx + kSceneSX, kSceneY + ((_now - 1) / kSceneNx) * kSceneDy + kSceneSY); sceneUp(); _keyboard->setClient(_sys); // main loop while (!_endGame && !_quitFlag) { if (_flag[3]) // Flag FINIS _commandHandler->addCallback(kCmdExec, -1, 0, kQGame); mainLoop(); } // If finishing game due to closing ScummVM window, explicitly save the game if (!_endGame && canSaveGameStateCurrently()) qGame(); _keyboard->setClient(NULL); _commandHandler->addCommand(kCmdClear, -1, 0, NULL); _commandHandlerTurbo->addCommand(kCmdClear, -1, 0, NULL); _mouse->off(); _vga->_showQ->clear(); _vga->_spareQ->clear(); _hero = NULL; _shadow = NULL; }
bool CGEEngine::showTitle(const char *name) { if (_quitFlag) return false; _bitmapPalette = _vga->_sysPal; BitmapPtr *LB = new BitmapPtr[2]; LB[0] = new Bitmap(this, name); LB[1] = NULL; _bitmapPalette = NULL; Sprite D(this, LB); D._flags._kill = true; D._flags._bDel = true; D.center(); D.show(2); if (_mode == 2) { inf(kSavegame0Name); _talk->show(2); } _vga->sunset(); _vga->copyPage(1, 2); _vga->copyPage(0, 1); selectPocket(-1); _vga->sunrise(_vga->_sysPal); if (_mode < 2 && !_soundOk) { _vga->copyPage(1, 2); _vga->copyPage(0, 1); _vga->_showQ->append(_mouse); _mouse->on(); for (; !_commandHandler->idle() || Vmenu::_addr;) { mainLoop(); if (_quitFlag) return false; } _mouse->off(); _vga->_showQ->clear(); _vga->copyPage(0, 2); _soundOk = 2; if (_music) _midiPlayer->loadMidi(0); } if (_mode < 2) { // At this point the game originally set the protection variables // used by the copy protection check movie(kPaylistExt); // paylist _vga->copyPage(1, 2); _vga->copyPage(0, 1); _vga->_showQ->append(_mouse); // In the original game, the user had to enter his name // As it was only used to name savegames, it has been removed _vga->_showQ->clear(); _vga->copyPage(0, 2); // The original was automatically loading the savegame when available if (_mode == 0) _mode++; } if (_mode < 2) movie(kWinkExt); _vga->copyPage(0, 2); return true; }
bool CGEEngine::showTitle(const char *name) { if (_eventManager->_quitFlag) return false; _bitmapPalette = _vga->_sysPal; BitmapPtr *LB = new BitmapPtr[2]; LB[0] = new Bitmap(this, name); LB[1] = NULL; _bitmapPalette = NULL; Sprite D(this, LB); D._flags._kill = true; D._flags._bDel = true; D.center(); D.show(2); if (_mode == 2) { inf(kSavegame0Name); _talk->show(2); } _vga->sunset(); _vga->copyPage(1, 2); _vga->copyPage(0, 1); selectPocket(-1); _vga->sunrise(_vga->_sysPal); if (_mode < 2 && !_soundOk) { _vga->copyPage(1, 2); _vga->copyPage(0, 1); _vga->_showQ->append(_mouse); _mouse->on(); for (; !_commandHandler->idle() || Vmenu::_addr;) { mainLoop(); if (_eventManager->_quitFlag) return false; } _mouse->off(); _vga->_showQ->clear(); _vga->copyPage(0, 2); _soundOk = 2; if (_music) _midiPlayer->loadMidi(0); } if (_mode < 2) { // At this point the game originally set the protection variables // used by the copy protection check movie(kPaylistExt); // paylist _vga->copyPage(1, 2); _vga->copyPage(0, 1); _vga->_showQ->append(_mouse); // In the original game, the user had to enter his name // As it was only used to name savegames, it has been removed _vga->_showQ->clear(); _vga->copyPage(0, 2); if (_mode == 0) { // The auto-load of savegame #0 is currently disabled #if 0 if (savegameExists(0)) { // Load the savegame loadGame(0, NULL, true); // only system vars _vga->setColors(_vga->_sysPal, 64); _vga->update(); if (_flag[3]) { //flag FINIS _mode++; _flag[3] = false; } } else #endif _mode++; } } if (_mode < 2) movie(kWinkExt); _vga->copyPage(0, 2); return true; }