diff options
-rw-r--r-- | engines/sky/control.cpp | 23 | ||||
-rw-r--r-- | engines/sky/intro.cpp | 7 | ||||
-rw-r--r-- | engines/sky/intro.h | 1 | ||||
-rw-r--r-- | engines/sky/logic.cpp | 2 | ||||
-rw-r--r-- | engines/sky/mouse.cpp | 1 | ||||
-rw-r--r-- | engines/sky/sky.cpp | 40 | ||||
-rw-r--r-- | engines/sky/sky.h | 1 |
7 files changed, 36 insertions, 39 deletions
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index 9d6b58704d..8699c893e4 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -238,13 +238,17 @@ void Control::removePanel(void) { free(_sprites.slide2); free(_sprites.slode); free(_sprites.slode2); free(_sprites.musicBodge); delete _controlPanel; delete _exitButton; - delete _slide; delete _slide2; - delete _slode; delete _restorePanButton; + delete _slide; delete _slide2; + delete _slode; delete _restorePanButton; + delete _savePanel; delete _saveButton; + delete _downFastButton; delete _downSlowButton; + delete _upFastButton; delete _upSlowButton; + delete _quitButton; delete _autoSaveButton; delete _savePanButton; delete _dosPanButton; delete _restartPanButton; delete _fxPanButton; delete _musicPanButton; delete _bodge; - delete _yesNo; delete _text; - delete _statusBar; delete _restoreButton; + delete _yesNo; delete _text; + delete _statusBar; delete _restoreButton; if (_textSprite) { free(_textSprite); @@ -492,7 +496,7 @@ void Control::doControlPanel(void) { _curButtonText = 0; uint16 clickRes = 0; - while (!quitPanel && !SkyEngine::_systemVars.quitGame) { + while (!quitPanel && !g_engine->quit()) { _text->drawToScreen(WITH_MASK); _system->updateScreen(); _mouseClicked = false; @@ -524,7 +528,7 @@ void Control::doControlPanel(void) { } memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); _system->copyRectToScreen(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); - if (!SkyEngine::_systemVars.quitGame) + if (!g_engine->quit()) _system->updateScreen(); _skyScreen->forceRefresh(); _skyScreen->setPaletteEndian((uint8 *)_skyCompact->fetchCpt(SkyEngine::_systemVars.currentPalette)); @@ -603,7 +607,7 @@ uint16 Control::handleClick(ConResource *pButton) { case QUIT_TO_DOS: animClick(pButton); if (getYesNo(quitDos)) - SkyEngine::_systemVars.quitGame = true; + g_engine->quitGame(); return 0; default: error("Control::handleClick: unknown routine: %X",pButton->_onClick); @@ -875,7 +879,7 @@ uint16 Control::saveRestorePanel(bool allowSave) { bool refreshNames = true; bool refreshAll = true; uint16 clickRes = 0; - while (!quitPanel && !SkyEngine::_systemVars.quitGame) { + while (!quitPanel && !g_engine->quit()) { clickRes = 0; if (refreshNames || refreshAll) { if (refreshAll) { @@ -1546,9 +1550,6 @@ void Control::delay(unsigned int amount) { case Common::EVENT_WHEELDOWN: _mouseWheel = 1; break; - case Common::EVENT_QUIT: - SkyEngine::_systemVars.quitGame = true; - break; default: break; } diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp index 024360561c..86e26309c9 100644 --- a/engines/sky/intro.cpp +++ b/engines/sky/intro.cpp @@ -636,14 +636,10 @@ Intro::Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *t _textBuf = (uint8*)malloc(10000); _saveBuf = (uint8*)malloc(10000); _bgBuf = NULL; - _quitProg = false; _relDelay = 0; } Intro::~Intro(void) { - - _mixer->stopAll(); - _skyScreen->stopSequence(); if (_textBuf) free(_textBuf); if (_saveBuf) @@ -912,8 +908,7 @@ bool Intro::escDelay(uint32 msecs) { if (event.type == Common::EVENT_KEYDOWN) { if (event.kbd.keycode == Common::KEYCODE_ESCAPE) return false; - } else if (event.type == Common::EVENT_QUIT) { - _quitProg = true; + } else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL) { return false; } } diff --git a/engines/sky/intro.h b/engines/sky/intro.h index 4a54fb8dd3..796bcf7e36 100644 --- a/engines/sky/intro.h +++ b/engines/sky/intro.h @@ -43,7 +43,6 @@ public: Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *text, Audio::Mixer *mixer, OSystem *system); ~Intro(void); bool doIntro(bool floppyIntro); - bool _quitProg; private: static uint16 _mainIntroSeq[]; static uint16 _floppyIntroSeq[]; diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp index c6c6c34c4d..9f13bf9bee 100644 --- a/engines/sky/logic.cpp +++ b/engines/sky/logic.cpp @@ -2490,7 +2490,7 @@ bool Logic::fnFadeUp(uint32 a, uint32 b, uint32 c) { } bool Logic::fnQuitToDos(uint32 a, uint32 b, uint32 c) { - SkyEngine::_systemVars.quitGame = true; + g_engine->quitGame(); return false; } diff --git a/engines/sky/mouse.cpp b/engines/sky/mouse.cpp index b3be8b4f36..1fc9e47539 100644 --- a/engines/sky/mouse.cpp +++ b/engines/sky/mouse.cpp @@ -180,7 +180,6 @@ void Mouse::waitMouseNotPressed(int minDelay) { while (mousePressed || _system->getMillis() < now + minDelay) { if (eventMan->shouldQuit()) { - SkyEngine::_systemVars.quitGame = true; minDelay = 0; mousePressed = false; } diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index d87ed06fef..4f803cb393 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -110,9 +110,10 @@ public: virtual const char *getName() const; virtual const char *getCopyright() const; + virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; - virtual GameList detectGames(const FSList &fslist) const; + virtual GameList detectGames(const FSList &fslist) const; virtual PluginError createInstance(OSystem *syst, Engine **engine) const; @@ -127,6 +128,13 @@ const char *SkyMetaEngine::getCopyright() const { return "Beneath a Steel Sky (C) Revolution"; } +bool SkyMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsListSaves) || + (f == kSupportsDirectLoad); +} + GameList SkyMetaEngine::getSupportedGames() const { GameList games; games.push_back(skySetting); @@ -257,7 +265,7 @@ namespace Sky { void *SkyEngine::_itemList[300]; -SystemVars SkyEngine::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false, false }; +SystemVars SkyEngine::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false }; SkyEngine::SkyEngine(OSystem *syst) : Engine(syst), _fastMode(0), _debugger(0) { @@ -277,6 +285,8 @@ SkyEngine::~SkyEngine() { delete _skyDisk; delete _skyControl; delete _skyCompact; + if (_skyIntro) + delete _skyIntro; for (int i = 0; i < 300; i++) if (_itemList[i]) @@ -288,8 +298,6 @@ GUI::Debugger *SkyEngine::getDebugger() { } void SkyEngine::initVirgin() { - - _skyScreen->setPalette(60111); _skyScreen->showScreen(60110); } @@ -340,25 +348,23 @@ void SkyEngine::handleKey(void) { int SkyEngine::go() { - _systemVars.quitGame = false; - _keyPressed.reset(); uint16 result = 0; - if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) - result = _skyControl->quickXRestore(ConfMan.getInt("save_slot")); + if (ConfMan.hasKey("save_slot")) { + int saveSlot = ConfMan.getInt("save_slot"); + if (saveSlot >= 0 && saveSlot <= 999) + result = _skyControl->quickXRestore(ConfMan.getInt("save_slot")); + } if (result != GAME_RESTORED) { bool introSkipped = false; if (_systemVars.gameVersion > 267) { // don't do intro for floppydemos _skyIntro = new Intro(_skyDisk, _skyScreen, _skyMusic, _skySound, _skyText, _mixer, _system); introSkipped = !_skyIntro->doIntro(_floppyIntro); - _systemVars.quitGame = _skyIntro->_quitProg; - - delete _skyIntro; } - if (!_systemVars.quitGame) { + if (!quit()) { _skyLogic->initScreen0(); if (introSkipped) _skyControl->restartGame(); @@ -368,7 +374,7 @@ int SkyEngine::go() { _lastSaveTime = _system->getMillis(); uint32 delayCount = _system->getMillis(); - while (!_systemVars.quitGame) { + while (!quit()) { if (_debugger->isAttached()) _debugger->onFrame(); @@ -419,7 +425,7 @@ int SkyEngine::go() { _skyMusic->stopMusic(); ConfMan.flushToDisk(); delay(1500); - return 0; + return _eventMan->shouldRTL(); } int SkyEngine::init() { @@ -440,7 +446,7 @@ int SkyEngine::init() { _floppyIntro = ConfMan.getBool("alt_intro"); _skyDisk = new Disk(); - _skySound = new Sound(_mixer, _skyDisk, ConfMan.getInt("sfx_volume")); + _skySound = new Sound(_mixer, _skyDisk, Audio::Mixer::kMaxChannelVolume); _systemVars.gameVersion = _skyDisk->determineGameVersion(); @@ -475,6 +481,7 @@ int SkyEngine::init() { _systemVars.systemFlags |= SF_PLAY_VOCS; _systemVars.gameSpeed = 50; + _skyIntro = 0; _skyCompact = new SkyCompact(); _skyText = new Text(_skyDisk, _skyCompact); _skyMouse = new Mouse(_system, _skyDisk, _skyCompact); @@ -615,9 +622,6 @@ void SkyEngine::delay(int32 amount) { _skyMouse->mouseMoved(event.mouse.x, event.mouse.y); _skyMouse->buttonPressed(1); break; - case Common::EVENT_QUIT: - _systemVars.quitGame = true; - break; default: break; } diff --git a/engines/sky/sky.h b/engines/sky/sky.h index b5d1701930..47aebaba77 100644 --- a/engines/sky/sky.h +++ b/engines/sky/sky.h @@ -41,7 +41,6 @@ struct SystemVars { uint16 gameSpeed; uint16 currentMusic; bool pastIntro; - bool quitGame; bool paused; }; |