From 1f4764ad1c6a4ef2d4c2a2697572f692957bbc02 Mon Sep 17 00:00:00 2001 From: Benjamin Haisch Date: Mon, 15 Dec 2008 08:04:06 +0000 Subject: TOLTECS: - Implemented RTL - Fixed return values in savegame/loadgame - Some minor cleanup --- engines/toltecs/detection.cpp | 2 +- engines/toltecs/movie.cpp | 7 +++++-- engines/toltecs/saveload.cpp | 2 ++ engines/toltecs/screen.cpp | 3 +-- engines/toltecs/script.cpp | 6 +++--- engines/toltecs/toltecs.cpp | 6 +++--- engines/toltecs/toltecs.h | 1 - 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp index 9128ce53a8..9db6155a6e 100644 --- a/engines/toltecs/detection.cpp +++ b/engines/toltecs/detection.cpp @@ -134,7 +134,7 @@ bool ToltecsMetaEngine::hasFeature(MetaEngineFeature f) const { bool Toltecs::ToltecsEngine::hasFeature(EngineFeature f) const { return -// (f == kSupportsRTL) || + (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); } diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp index 9cbcbb2ed6..28402c9812 100644 --- a/engines/toltecs/movie.cpp +++ b/engines/toltecs/movie.cpp @@ -254,15 +254,18 @@ bool MoviePlayer::handleInput() { if (event.kbd.keycode == Common::KEYCODE_ESCAPE) return false; break; + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + return false; case Common::EVENT_QUIT: - g_system->quit(); + _vm->quitGame(); return false; break; default: break; } } - return true; + return !_vm->shouldQuit(); } } // End of namespace Toltecs diff --git a/engines/toltecs/saveload.cpp b/engines/toltecs/saveload.cpp index da62da40f4..d758fa712d 100644 --- a/engines/toltecs/saveload.cpp +++ b/engines/toltecs/saveload.cpp @@ -193,11 +193,13 @@ void ToltecsEngine::loadgame(const char *filename) { Common::Error ToltecsEngine::loadGameState(int slot) { const char *fileName = getSavegameFilename(slot); loadgame(fileName); + return Common::kNoError; } Common::Error ToltecsEngine::saveGameState(int slot, const char *description) { const char *fileName = getSavegameFilename(slot); savegame(fileName, description); + return Common::kNoError; } const char *ToltecsEngine::getSavegameFilename(int num) { diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index d70cda3351..363a6f20d4 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -125,7 +125,6 @@ void Screen::loadMouseCursor(uint resIndex) { *mouseCursorP++ = pixel; } } - //CursorMan.replaceCursor((const byte*)mouseCursor, 16, 16, 0, 0, 0); // FIXME: Where's the cursor hotspot? Using 8, 8 seems good enough for now. CursorMan.replaceCursor((const byte*)mouseCursor, 16, 16, 8, 8, 0); } @@ -540,7 +539,7 @@ void Screen::drawGuiTextMulti(byte *textData) { wrapState.sourceString += 4; } else if (*wrapState.sourceString == 0x0B) { // Inc text position - y += wrapState.sourceString[1]; // CHECKME: Maybe these are signed? + y += wrapState.sourceString[1]; x += wrapState.sourceString[2]; wrapState.sourceString += 3; } else { diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 18942ec863..a278ad53a7 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -96,7 +96,7 @@ void ScriptInterpreter::runScript(uint slotIndex) { _code = getSlotData(_regs.reg4); - while (1) { + while (!_vm->shouldQuit()) { if (_vm->_movieSceneFlag) _vm->_mouseButton = 0; @@ -124,7 +124,7 @@ void ScriptInterpreter::runScript(uint slotIndex) { // Call updateScreen roughly every 10ms else the mouse cursor will be jerky if (_vm->_system->getMillis() % 10 == 0) _vm->_system->updateScreen(); - + } } @@ -451,7 +451,7 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) { _vm->_screen->updateShakeScreen(); - if (_vm->_quitGame) + if (_vm->shouldQuit()) return; if (!_vm->_movieSceneFlag) diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index b9031078f9..c7ec3cac63 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -102,7 +102,6 @@ Common::Error ToltecsEngine::go() { _isSaveAllowed = true; - _quitGame = false; _counter01 = 0; _counter02 = 0; _movieSceneFlag = false; @@ -248,6 +247,7 @@ void ToltecsEngine::updateScreen() { _system->updateScreen(); updateCamera(); + } void ToltecsEngine::updateInput() { @@ -272,8 +272,7 @@ void ToltecsEngine::updateInput() { break; case Common::EVENT_QUIT: - // FIXME: Find a nicer way to quit - _system->quit(); + quitGame(); break; case Common::EVENT_MOUSEMOVE: _mouseX = event.mouse.x; @@ -338,6 +337,7 @@ void ToltecsEngine::setGuiHeight(int16 guiHeight) { if (guiHeight != _guiHeight) { _guiHeight = guiHeight; _cameraHeight = 400 - _guiHeight; + _screen->_guiRefresh = true; debug(0, "ToltecsEngine::setGuiHeight() _guiHeight = %d; _cameraHeight = %d", _guiHeight, _cameraHeight); // TODO: clearScreen(); } diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h index 0794a26b9d..1992d9d914 100644 --- a/engines/toltecs/toltecs.h +++ b/engines/toltecs/toltecs.h @@ -115,7 +115,6 @@ public: uint _sceneResIndex; int16 _sceneWidth, _sceneHeight; - bool _quitGame; int _counter01, _counter02; bool _movieSceneFlag; byte _flag01; -- cgit v1.2.3