diff options
author | Matthew Hoops | 2011-05-18 18:23:37 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-18 18:23:37 -0400 |
commit | d4c92983920cfe3b25a22d91e12c750e591b917e (patch) | |
tree | c0b63318b9ba0e67528337cfaa21515def1c3962 /engines/mohawk | |
parent | 7e2edf16b3e2bf1d2b31999979a60802514df6cb (diff) | |
parent | cf107e24be28c7e6db65b5c7ffed120af4a7994b (diff) | |
download | scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.tar.gz scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.tar.bz2 scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/mohawk')
81 files changed, 608 insertions, 440 deletions
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index 02548d58fc..d54e2dac6b 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/bitmap.h" diff --git a/engines/mohawk/bitmap.h b/engines/mohawk/bitmap.h index ea8a130dfc..74218882e8 100644 --- a/engines/mohawk/bitmap.h +++ b/engines/mohawk/bitmap.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_BITMAP_H diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 93cbe87e55..4e5b7186ff 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/console.h" diff --git a/engines/mohawk/console.h b/engines/mohawk/console.h index cb0e8501cd..cdb4e1bedf 100644 --- a/engines/mohawk/console.h +++ b/engines/mohawk/console.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_CONSOLE_H diff --git a/engines/mohawk/cstime.cpp b/engines/mohawk/cstime.cpp index 46faae08f5..59bc5ad661 100644 --- a/engines/mohawk/cstime.cpp +++ b/engines/mohawk/cstime.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cstime.h" @@ -35,15 +32,14 @@ #include "common/config-manager.h" #include "common/error.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/fs.h" #include "common/textconsole.h" +#include "common/system.h" namespace Mohawk { MohawkEngine_CSTime::MohawkEngine_CSTime(OSystem *syst, const MohawkGameDescription *gamedesc) : MohawkEngine(syst, gamedesc) { - _rnd = new Common::RandomSource(); - g_eventRec.registerRandomSource(*_rnd, "cstime"); + _rnd = new Common::RandomSource("cstime"); // If the user just copied the CD contents, the fonts are in a subdirectory. const Common::FSNode gameDataDir(ConfMan.get("path")); diff --git a/engines/mohawk/cstime.h b/engines/mohawk/cstime.h index 40293916db..3a1de6a137 100644 --- a/engines/mohawk/cstime.h +++ b/engines/mohawk/cstime.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_CSTIME_H diff --git a/engines/mohawk/cstime_cases.cpp b/engines/mohawk/cstime_cases.cpp index c4801f822c..c0a8dfc0e3 100644 --- a/engines/mohawk/cstime_cases.cpp +++ b/engines/mohawk/cstime_cases.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cstime_cases.h" diff --git a/engines/mohawk/cstime_cases.h b/engines/mohawk/cstime_cases.h index 6f7630648e..1ac9abf87e 100644 --- a/engines/mohawk/cstime_cases.h +++ b/engines/mohawk/cstime_cases.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_CSTIME_CASES_H diff --git a/engines/mohawk/cstime_game.cpp b/engines/mohawk/cstime_game.cpp index 66dce1da92..2e21111025 100644 --- a/engines/mohawk/cstime_game.cpp +++ b/engines/mohawk/cstime_game.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cstime_game.h" diff --git a/engines/mohawk/cstime_game.h b/engines/mohawk/cstime_game.h index 661fdbaa41..88e813c999 100644 --- a/engines/mohawk/cstime_game.h +++ b/engines/mohawk/cstime_game.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_CSTIME_GAME_H diff --git a/engines/mohawk/cstime_ui.cpp b/engines/mohawk/cstime_ui.cpp index 106f7ea319..ee08384590 100644 --- a/engines/mohawk/cstime_ui.cpp +++ b/engines/mohawk/cstime_ui.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cstime_game.h" diff --git a/engines/mohawk/cstime_ui.h b/engines/mohawk/cstime_ui.h index 3ec38492d7..27df7cac3e 100644 --- a/engines/mohawk/cstime_ui.h +++ b/engines/mohawk/cstime_ui.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_CSTIME_UI_H diff --git a/engines/mohawk/cstime_view.cpp b/engines/mohawk/cstime_view.cpp index 12d641a9ff..37c418f416 100644 --- a/engines/mohawk/cstime_view.cpp +++ b/engines/mohawk/cstime_view.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cstime_game.h" // debugging.. diff --git a/engines/mohawk/cstime_view.h b/engines/mohawk/cstime_view.h index 8db8794ce5..ae3283771d 100644 --- a/engines/mohawk/cstime_view.h +++ b/engines/mohawk/cstime_view.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_CSTIME_VIEW_H diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index 66669e35c9..f95084de8e 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" @@ -29,9 +26,11 @@ #include "common/macresman.h" #include "common/system.h" +#include "common/textconsole.h" #include "common/winexe_ne.h" #include "common/winexe_pe.h" #include "graphics/cursorman.h" +#include "graphics/maccursor.h" #include "graphics/wincursor.h" #ifdef ENABLE_MYST @@ -41,11 +40,6 @@ namespace Mohawk { -static const byte s_bwPalette[] = { - 0x00, 0x00, 0x00, // Black - 0xFF, 0xFF, 0xFF // White -}; - void CursorManager::showCursor() { CursorMan.showMouse(true); } @@ -78,8 +72,13 @@ void CursorManager::setDefaultCursor() { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }; + static const byte bwPalette[] = { + 0x00, 0x00, 0x00, // Black + 0xFF, 0xFF, 0xFF // White + }; + CursorMan.replaceCursor(defaultCursor, 12, 20, 0, 0, 0); - CursorMan.replaceCursorPalette(s_bwPalette, 1, 2); + CursorMan.replaceCursorPalette(bwPalette, 1, 2); } void CursorManager::setCursor(uint16 id) { @@ -87,35 +86,24 @@ void CursorManager::setCursor(uint16 id) { setDefaultCursor(); } -void CursorManager::setMacXorCursor(Common::SeekableReadStream *stream) { +void CursorManager::setMacCursor(Common::SeekableReadStream *stream) { assert(stream); - byte cursorBitmap[16 * 16]; + Graphics::MacCursor *macCursor = new Graphics::MacCursor(); - // Get black and white data - for (int i = 0; i < 32; i++) { - byte imageByte = stream->readByte(); - for (int b = 0; b < 8; b++) - cursorBitmap[i * 8 + b] = (imageByte & (0x80 >> b)) ? 1 : 2; - } + if (!macCursor->readFromStream(*stream)) + error("Could not parse Mac cursor"); - // Apply mask data - for (int i = 0; i < 32; i++) { - byte imageByte = stream->readByte(); - for (int b = 0; b < 8; b++) - if ((imageByte & (0x80 >> b)) == 0) - cursorBitmap[i * 8 + b] = 0; - } - - uint16 hotspotY = stream->readUint16BE(); - uint16 hotspotX = stream->readUint16BE(); + CursorMan.replaceCursor(macCursor->getSurface(), macCursor->getWidth(), macCursor->getHeight(), + macCursor->getHotspotX(), macCursor->getHotspotY(), macCursor->getKeyColor()); + CursorMan.replaceCursorPalette(macCursor->getPalette(), 0, 256); - CursorMan.replaceCursor(cursorBitmap, 16, 16, hotspotX, hotspotY, 0); - CursorMan.replaceCursorPalette(s_bwPalette, 1, 2); + delete macCursor; + delete stream; } void DefaultCursorManager::setCursor(uint16 id) { - setMacXorCursor(_vm->getResource(_tag, id)); + setMacCursor(_vm->getResource(_tag, id)); } #ifdef ENABLE_MYST @@ -139,6 +127,13 @@ void MystCursorManager::hideCursor() { } void MystCursorManager::setCursor(uint16 id) { + // Zero means empty cursor + if (id == 0) { + static const byte emptyCursor = 0; + CursorMan.replaceCursor(&emptyCursor, 1, 1, 0, 0, 0); + return; + } + // Both Myst and Myst ME use the "MystBitmap" format for cursor images. MohawkSurface *mhkSurface = _bmpDecoder->decodeImage(_vm->getResource(ID_WDIB, id)); Graphics::Surface *surface = mhkSurface->getSurface(); @@ -223,26 +218,12 @@ void MacCursorManager::setCursor(uint16 id) { // Try a color cursor first Common::SeekableReadStream *stream = _resFork->getResource(MKTAG('c','r','s','r'), id); - if (stream) { - byte *cursor, *palette; - int width, height, hotspotX, hotspotY, keyColor, palSize; - - _resFork->convertCrsrCursor(stream, &cursor, width, height, hotspotX, hotspotY, keyColor, true, &palette, palSize); - - CursorMan.replaceCursor(cursor, width, height, hotspotX, hotspotY, keyColor); - CursorMan.replaceCursorPalette(palette, 0, palSize); - - delete[] cursor; - delete[] palette; - delete stream; - return; - } - - // Fall back to b&w cursors - stream = _resFork->getResource(MKTAG('C','U','R','S'), id); + // Fall back to monochrome cursors + if (!stream) + stream = _resFork->getResource(MKTAG('C','U','R','S'), id); if (stream) { - setMacXorCursor(stream); + setMacCursor(stream); delete stream; } else { setDefaultCursor(); @@ -265,7 +246,7 @@ LivingBooksCursorManager_v2::~LivingBooksCursorManager_v2() { void LivingBooksCursorManager_v2::setCursor(uint16 id) { if (_sysArchive && _sysArchive->hasResource(ID_TCUR, id)) { - setMacXorCursor(_sysArchive->getResource(ID_TCUR, id)); + setMacCursor(_sysArchive->getResource(ID_TCUR, id)); } else { // TODO: Handle generated cursors } diff --git a/engines/mohawk/cursors.h b/engines/mohawk/cursors.h index 1fb8b35714..d92b6b4285 100644 --- a/engines/mohawk/cursors.h +++ b/engines/mohawk/cursors.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_CURSORS_H @@ -63,8 +60,8 @@ public: virtual bool hasSource() const { return false; } protected: - // Set a Mac XOR/AND map cursor to the screen - void setMacXorCursor(Common::SeekableReadStream *stream); + // Set a Mac CURS/crsr cursor to the screen + void setMacCursor(Common::SeekableReadStream *stream); }; // The default Mohawk cursor manager diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index c14d3327d0..6a73b28246 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -18,9 +18,6 @@ * 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 "base/plugins.h" @@ -191,7 +188,7 @@ public: MohawkMetaEngine() : AdvancedMetaEngine(detectionParams) {} virtual const char *getName() const { - return "Mohawk Engine"; + return "Mohawk"; } virtual const char *getOriginalCopyright() const { diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index 36dbcbde7b..5510643d04 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -18,9 +18,6 @@ * 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$ - * */ namespace Mohawk { diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp index 4c7e52f02f..6cb455917e 100644 --- a/engines/mohawk/dialogs.cpp +++ b/engines/mohawk/dialogs.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/mohawk.h" @@ -82,7 +79,9 @@ void PauseDialog::handleKeyDown(Common::KeyState state) { enum { kZipCmd = 'ZIPM', kTransCmd = 'TRAN', - kWaterCmd = 'WATR' + kWaterCmd = 'WATR', + kDropCmd = 'DROP', + kMapCmd = 'SMAP' }; #ifdef ENABLE_MYST @@ -90,6 +89,13 @@ enum { MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) { _zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 300, 15, _("~Z~ip Mode Activated"), 0, kZipCmd); _transitionsCheckbox = new GUI::CheckboxWidget(this, 15, 30, 300, 15, _("~T~ransitions Enabled"), 0, kTransCmd); + _dropPageButton = new GUI::ButtonWidget(this, 15, 60, 100, 25, _("~D~rop Page"), 0, kDropCmd); + + // Myst ME only has maps + if (_vm->getFeatures() & GF_ME) + _showMapButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("~S~how Map"), 0, kMapCmd); + else + _showMapButton = 0; new GUI::ButtonWidget(this, 95, 160, 120, 25, _("~O~K"), 0, GUI::kOKCmd); new GUI::ButtonWidget(this, 225, 160, 120, 25, _("~C~ancel"), 0, GUI::kCloseCmd); @@ -101,6 +107,12 @@ MystOptionsDialog::~MystOptionsDialog() { void MystOptionsDialog::open() { Dialog::open(); + _dropPageButton->setEnabled(_vm->_gameState->_globals.heldPage != 0); + + if (_showMapButton) + _showMapButton->setEnabled(_vm->_scriptParser && + _vm->_scriptParser->getMap()); + _zipModeCheckbox->setState(_vm->_gameState->_globals.zipMode); _transitionsCheckbox->setState(_vm->_gameState->_globals.transitions); } @@ -113,6 +125,14 @@ void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui case kTransCmd: _vm->_gameState->_globals.transitions = _transitionsCheckbox->getState(); break; + case kDropCmd: + _vm->_needsPageDrop = true; + close(); + break; + case kMapCmd: + _vm->_needsShowMap = true; + close(); + break; case GUI::kCloseCmd: close(); break; diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h index 106a1566fc..853ff30813 100644 --- a/engines/mohawk/dialogs.h +++ b/engines/mohawk/dialogs.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_DIALOGS_H @@ -84,6 +81,8 @@ private: MohawkEngine_Myst *_vm; GUI::CheckboxWidget *_zipModeCheckbox; GUI::CheckboxWidget *_transitionsCheckbox; + GUI::ButtonWidget *_dropPageButton; + GUI::ButtonWidget *_showMapButton; }; #endif diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp index a1bcb55f7b..b3653b1fdf 100644 --- a/engines/mohawk/graphics.cpp +++ b/engines/mohawk/graphics.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/resource.h" @@ -296,6 +293,9 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) { // Initialize our buffer _backBuffer = new Graphics::Surface(); _backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat); + + _nextAllowedDrawTime = _vm->_system->getMillis(); + _enableDrawingTimeSimulation = 0; } MystGraphics::~MystGraphics() { @@ -447,6 +447,8 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm debug(3, "\twidth: %d", width); debug(3, "\theight: %d", height); + simulatePreviousDrawDelay(dest); + _vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height); } @@ -502,10 +504,18 @@ void MystGraphics::copyImageToBackBuffer(uint16 image, Common::Rect dest) { void MystGraphics::copyBackBufferToScreen(Common::Rect r) { r.clip(_viewport); + + simulatePreviousDrawDelay(r); + _vm->_system->copyRectToScreen((byte *)_backBuffer->getBasePtr(r.left, r.top), _backBuffer->pitch, r.left, r.top, r.width(), r.height()); } void MystGraphics::runTransition(uint16 type, Common::Rect rect, uint16 steps, uint16 delay) { + + // Do not artificially delay during transitions + int oldEnableDrawingTimeSimulation = _enableDrawingTimeSimulation; + _enableDrawingTimeSimulation = 0; + switch (type) { case 0: { debugC(kDebugScript, "Left to Right"); @@ -607,6 +617,8 @@ void MystGraphics::runTransition(uint16 type, Common::Rect rect, uint16 steps, u _vm->_system->updateScreen(); break; } + + _enableDrawingTimeSimulation = oldEnableDrawingTimeSimulation; } void MystGraphics::drawRect(Common::Rect rect, RectState state) { @@ -632,6 +644,34 @@ void MystGraphics::drawLine(const Common::Point &p1, const Common::Point &p2, ui _backBuffer->drawLine(p1.x, p1.y, p2.x, p2.y, color); } +void MystGraphics::enableDrawingTimeSimulation(bool enable) { + if (enable) + _enableDrawingTimeSimulation++; + else + _enableDrawingTimeSimulation--; + + if (_enableDrawingTimeSimulation < 0) + _enableDrawingTimeSimulation = 0; +} + +void MystGraphics::simulatePreviousDrawDelay(const Common::Rect &dest) { + uint32 time = 0; + + if (_enableDrawingTimeSimulation) { + time = _vm->_system->getMillis(); + + // Do not draw anything new too quickly after the previous draw call + // so that images stay at least a little while on screen + // This is enabled only for scripted draw calls + if (time < _nextAllowedDrawTime) + _vm->_system->delayMillis(_nextAllowedDrawTime - time); + } + + // Next draw call allowed at DELAY + AERA * COEFF milliseconds from now + time = _vm->_system->getMillis(); + _nextAllowedDrawTime = time + _constantDrawDelay + dest.height() * dest.width() / _proportionalDrawDelay; +} + #endif // ENABLE_MYST #ifdef ENABLE_RIVEN diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h index c7e9b98d49..d7057f48cf 100644 --- a/engines/mohawk/graphics.h +++ b/engines/mohawk/graphics.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_GRAPHICS_H @@ -131,10 +128,12 @@ public: void runTransition(uint16 type, Common::Rect rect, uint16 steps, uint16 delay); void drawRect(Common::Rect rect, RectState state); void drawLine(const Common::Point &p1, const Common::Point &p2, uint32 color); + void enableDrawingTimeSimulation(bool enable); protected: MohawkSurface *decodeImage(uint16 id); MohawkEngine *getVM() { return (MohawkEngine *)_vm; } + void simulatePreviousDrawDelay(const Common::Rect &dest); private: MohawkEngine_Myst *_vm; @@ -159,6 +158,11 @@ private: Graphics::Surface *_backBuffer; Graphics::PixelFormat _pixelFormat; Common::Rect _viewport; + + int _enableDrawingTimeSimulation; + uint32 _nextAllowedDrawTime; + static const uint _constantDrawDelay = 10; // ms + static const uint _proportionalDrawDelay = 500; // pixels per ms }; #endif // ENABLE_MYST diff --git a/engines/mohawk/installer_archive.cpp b/engines/mohawk/installer_archive.cpp index 5079375896..83796158a6 100644 --- a/engines/mohawk/installer_archive.cpp +++ b/engines/mohawk/installer_archive.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/installer_archive.h" diff --git a/engines/mohawk/installer_archive.h b/engines/mohawk/installer_archive.h index d33fbe5bcd..27877d69f9 100644 --- a/engines/mohawk/installer_archive.h +++ b/engines/mohawk/installer_archive.h @@ -18,9 +18,6 @@ * 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 "common/archive.h" diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index 2475965812..a4e7f0349c 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/livingbooks.h" @@ -31,10 +28,10 @@ #include "common/config-manager.h" #include "common/error.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/fs.h" #include "common/archive.h" #include "common/textconsole.h" +#include "common/system.h" #include "graphics/palette.h" @@ -128,8 +125,7 @@ MohawkEngine_LivingBooks::MohawkEngine_LivingBooks(OSystem *syst, const MohawkGa _alreadyShowedIntro = false; - _rnd = new Common::RandomSource(); - g_eventRec.registerRandomSource(*_rnd, "livingbooks"); + _rnd = new Common::RandomSource("livingbooks"); _page = NULL; @@ -293,6 +289,15 @@ void MohawkEngine_LivingBooks::loadBookInfo(const Common::String &filename) { // - fUse254ColorPalette (always true?) // - nKBRequired (4096, RAM requirement?) // - fDebugWindow (always 0?) + + if (_bookInfoFile.hasSection("Globals")) { + const Common::ConfigFile::SectionKeyList globals = _bookInfoFile.getKeys("Globals"); + for (Common::ConfigFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { + Common::String command = Common::String::format("%s = %s", i->key.c_str(), i->value.c_str()); + debug("global: %s", command.c_str()); + // TODO: run command + } + } } Common::String MohawkEngine_LivingBooks::stringForMode(LBMode mode) { @@ -746,6 +751,9 @@ void LBPage::loadBITL(uint16 resourceId) { case kLBMiniGameItem: res = new LBMiniGameItem(_vm, this, rect); break; + case kLBProxyItem: + res = new LBProxyItem(_vm, this, rect); + break; default: warning("Unknown item type %04x", type); case 3: // often used for buttons @@ -2700,10 +2708,20 @@ int LBItem::runScriptEntry(LBScriptEntry *entry) { break; case kLBOpLoad: + // FIXME + warning("ignoring kLBOpLoad (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + case kLBOpPreload: + // FIXME + warning("ignoring kLBOpPreload (event 0x%04x, param 0x%04x, target '%s')", + entry->event, entry->param, target->_desc.c_str()); + break; + case kLBOpUnload: // FIXME - warning("ignoring kLBOpLoad/Preload/Unload (event 0x%04x, param 0x%04x, target '%s')", + warning("ignoring kLBOpUnload (event 0x%04x, param 0x%04x, target '%s')", entry->event, entry->param, target->_desc.c_str()); break; @@ -3748,4 +3766,35 @@ bool LBMiniGameItem::togglePlaying(bool playing, bool restart) { return false; } +LBProxyItem::LBProxyItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) { + debug(3, "new LBProxyItem"); + + _page = NULL; +} + +LBProxyItem::~LBProxyItem() { + delete _page; +} + +void LBProxyItem::init() { + Common::String leftover; + Common::String filename = _vm->getFileNameFromConfig("Proxies", _desc.c_str(), leftover); + if (!leftover.empty()) + error("LBProxyItem tried loading proxy '%s' but got leftover '%s'", _desc.c_str(), leftover.c_str()); + uint16 baseId; + for (uint i = 0; i < filename.size(); i++) { + if (filename[i] == ';') { + baseId = atoi(filename.c_str() + i + 1); + filename = Common::String(filename.c_str(), i); + } + } + + debug(1, "LBProxyItem loading archive '%s' with id %d", filename.c_str(), baseId); + MohawkArchive *pageArchive = _vm->createMohawkArchive(); + if (!pageArchive->open(filename)) + error("failed to open archive '%s' (for proxy '%s')", filename.c_str(), _desc.c_str()); + _page = new LBPage(_vm); + _page->open(pageArchive, baseId); +} + } // End of namespace Mohawk diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index cd3b206d57..de84b0f13f 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_LIVINGBOOKS_H @@ -574,6 +571,17 @@ public: bool togglePlaying(bool playing, bool restart); }; +class LBProxyItem : public LBItem { +public: + LBProxyItem(MohawkEngine_LivingBooks *_vm, LBPage *page, Common::Rect rect); + ~LBProxyItem(); + + void init(); + +protected: + class LBPage *_page; +}; + struct NotifyEvent { NotifyEvent(uint t, uint p) : type(t), param(p), newUnknown(0), newMode(0), newPage(0), newSubpage(0) { } uint type; diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp index 4237c712d9..165ca4a328 100644 --- a/engines/mohawk/livingbooks_code.cpp +++ b/engines/mohawk/livingbooks_code.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/livingbooks.h" @@ -609,7 +606,7 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = { { "move", 0 }, { 0, 0 }, { 0, 0 }, - { "setDragParams", 0 }, + { "setDragParams", &LBCode::cmdSetDragParams }, { "resetDragParams", 0 }, { "enableRollover", &LBCode::cmdUnimplemented /* FIXME */ }, { "setCursor", 0 }, @@ -804,6 +801,10 @@ void LBCode::cmdRight(const Common::Array<LBValue> ¶ms) { _stack.push(rect.right); } +void LBCode::cmdSetDragParams(const Common::Array<LBValue> ¶ms) { + warning("ignoring setDragParams"); +} + void LBCode::cmdSetPlayParams(const Common::Array<LBValue> ¶ms) { if (params.size() > 8) error("too many parameters (%d) to setPlayParams", params.size()); @@ -878,7 +879,7 @@ CodeCommandInfo itemCommandInfo[NUM_ITEM_COMMANDS] = { { "isLoaded", 0 }, { "isDragging", 0 }, { "load", 0 }, - { "moveTo", 0 }, + { "moveTo", &LBCode::itemMoveTo }, { "mute", 0 }, { "play", 0 }, { "seek", 0 }, @@ -913,6 +914,10 @@ void LBCode::itemIsPlaying(const Common::Array<LBValue> ¶ms) { _stack.push(0); } +void LBCode::itemMoveTo(const Common::Array<LBValue> ¶ms) { + warning("ignoring moveTo"); +} + void LBCode::itemSetParent(const Common::Array<LBValue> ¶ms) { if (params.size() > 2) error("incorrect number of parameters (%d) to setParent", params.size()); diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h index cd9ac1004a..9602e2d22d 100644 --- a/engines/mohawk/livingbooks_code.h +++ b/engines/mohawk/livingbooks_code.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_LIVINGBOOKS_CODE_H @@ -225,12 +222,14 @@ public: void cmdLeft(const Common::Array<LBValue> ¶ms); void cmdBottom(const Common::Array<LBValue> ¶ms); void cmdRight(const Common::Array<LBValue> ¶ms); + void cmdSetDragParams(const Common::Array<LBValue> ¶ms); void cmdSetPlayParams(const Common::Array<LBValue> ¶ms); void cmdSetKeyEvent(const Common::Array<LBValue> ¶ms); void cmdSetHitTest(const Common::Array<LBValue> ¶ms); void cmdKey(const Common::Array<LBValue> ¶ms); void itemSetParent(const Common::Array<LBValue> ¶ms); + void itemMoveTo(const Common::Array<LBValue> ¶ms); void itemIsPlaying(const Common::Array<LBValue> ¶ms); }; diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp index f63645f1ac..faf52595b7 100644 --- a/engines/mohawk/mohawk.cpp +++ b/engines/mohawk/mohawk.cpp @@ -18,9 +18,6 @@ * 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 "common/scummsys.h" diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h index 8a853d151e..b189f82040 100644 --- a/engines/mohawk/mohawk.h +++ b/engines/mohawk/mohawk.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_H diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 655a38b578..4f9c3a893e 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -18,9 +18,6 @@ * 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 "common/config-manager.h" @@ -74,7 +71,8 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription // original, including bugs, missing bits etc. :) _tweaksEnabled = true; - _currentCursor = _mainCursor = kDefaultMystCursor; + _currentCursor = 0; + _mainCursor = kDefaultMystCursor; _showResourceRects = false; _curCard = 0; _needsUpdate = false; @@ -258,7 +256,10 @@ Common::Error MohawkEngine_Myst::run() { _loadDialog->setSaveMode(false); _optionsDialog = new MystOptionsDialog(this); _cursor = new MystCursorManager(this); - _rnd = new Common::RandomSource(); + _rnd = new Common::RandomSource("myst"); + + // Cursor is visible by default + _cursor->showCursor(); // Load game from launcher/command line if requested if (ConfMan.hasKey("save_slot") && canLoadGameStateCurrently()) { @@ -288,9 +289,6 @@ Common::Error MohawkEngine_Myst::run() { // Test Load Function... loadHelp(10000); - // Set the cursor - _cursor->setCursor(_currentCursor); - Common::Event event; while (!shouldQuit()) { // Update any background videos @@ -343,7 +341,20 @@ Common::Error MohawkEngine_Myst::run() { drawResourceRects(); break; case Common::KEYCODE_F5: + _needsPageDrop = false; + _needsShowMap = false; + runDialog(*_optionsDialog); + + if (_needsPageDrop) { + dropPage(); + _needsPageDrop = false; + } + + if (_needsShowMap) { + _scriptParser->showMap(); + _needsShowMap = false; + } break; default: break; @@ -405,6 +416,11 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS _curStack = stack; + // Fill screen with black and empty cursor + _cursor->setCursor(0); + _system->fillScreen(_system->getScreenFormat().RGBToColor(0, 0, 0)); + _system->updateScreen(); + _sound->stopSound(); _sound->stopBackgroundMyst(); if (linkSrcSound) @@ -553,7 +569,7 @@ uint16 MohawkEngine_Myst::getCardBackgroundId() { } void MohawkEngine_Myst::drawCardBackground() { - _gfx->copyImageToBackBuffer(getCardBackgroundId(), Common::Rect(0, 0, 544, 333)); + _gfx->copyImageToBackBuffer(getCardBackgroundId(), Common::Rect(0, 0, 544, 332)); } void MohawkEngine_Myst::changeToCard(uint16 card, bool updateScreen) { @@ -631,18 +647,18 @@ void MohawkEngine_Myst::changeToCard(uint16 card, bool updateScreen) { // TODO: Handle Script Resources - // Make sure we have the right cursor showing - _dragResource = 0; - _hoverResource = 0; - _curResource = -1; - checkCurrentResource(); - // Make sure the screen is updated if (updateScreen) { _gfx->copyBackBufferToScreen(Common::Rect(544, 333)); _system->updateScreen(); } + // Make sure we have the right cursor showing + _dragResource = 0; + _hoverResource = 0; + _curResource = -1; + checkCurrentResource(); + // Debug: Show resource rects if (_showResourceRects) drawResourceRects(); @@ -1181,4 +1197,42 @@ bool MohawkEngine_Myst::canSaveGameStateCurrently() { return false; } +void MohawkEngine_Myst::dropPage() { + uint16 page = _gameState->_globals.heldPage; + bool whitePage = page == 13; + bool bluePage = page - 1 < 6; + bool redPage = page - 7 < 6; + + // Play drop page sound + _sound->replaceSoundMyst(800); + + // Drop page + _gameState->_globals.heldPage = 0; + + // Redraw page area + if (whitePage && _gameState->_globals.currentAge == 2) { + redrawArea(41); + } else if (bluePage) { + if (page == 6) { + if (_gameState->_globals.currentAge == 2) + redrawArea(24); + } else { + redrawArea(103); + } + } else if (redPage) { + if (page == 12) { + if (_gameState->_globals.currentAge == 2) + redrawArea(25); + } else if (page == 10) { + if (_gameState->_globals.currentAge == 1) + redrawArea(35); + } else { + redrawArea(102); + } + } + + setMainCursor(kDefaultMystCursor); + checkCursorHints(); +} + } // End of namespace Mohawk diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 47e8a6562c..5edf774ed0 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_MYST_H @@ -168,6 +165,8 @@ public: bool _tweaksEnabled; bool _needsUpdate; + bool _needsPageDrop; + bool _needsShowMap; MystView _view; MystGraphics *_gfx; @@ -210,6 +209,8 @@ private: bool _runExitScript; + void dropPage(); + void loadCard(); void unloadCard(); void runInitScript(); diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp index dc00bff923..294fcea2f1 100644 --- a/engines/mohawk/myst_areas.cpp +++ b/engines/mohawk/myst_areas.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/graphics.h" diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h index aa06d1a5b4..136356ea4f 100644 --- a/engines/mohawk/myst_areas.h +++ b/engines/mohawk/myst_areas.h @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index 71c408ed37..be5b7e1c76 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" @@ -148,6 +145,7 @@ void MystScriptParser::setupCommonOpcodes() { OPCODE(44, o_restoreMainCursor); // Opcode 45 Not Present OPCODE(46, o_soundWaitStop); + OPCODE(51, o_exitMap); // Opcodes 47 to 99 Not Present OPCODE(0xFFFF, NOP); @@ -157,6 +155,11 @@ void MystScriptParser::setupCommonOpcodes() { void MystScriptParser::runScript(MystScript script, MystResource *invokingResource) { debugC(kDebugScript, "Script Size: %d", script->size()); + + // Scripted drawing takes more time to simulate older hardware + // This way opcodes can't overwrite what the previous ones drew too quickly + _vm->_gfx->enableDrawingTimeSimulation(true); + for (uint16 i = 0; i < script->size(); i++) { MystScriptEntry &entry = script->operator[](i); debugC(kDebugScript, "\tOpcode %d: %d", i, entry.opcode); @@ -168,6 +171,8 @@ void MystScriptParser::runScript(MystScript script, MystResource *invokingResour runOpcode(entry.opcode, entry.var, entry.argc, entry.argv); } + + _vm->_gfx->enableDrawingTimeSimulation(false); } void MystScriptParser::runOpcode(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -918,4 +923,15 @@ void MystScriptParser::o_quit(uint16 op, uint16 var, uint16 argc, uint16 *argv) _vm->quitGame(); } +void MystScriptParser::showMap() { + if (_vm->getCurCard() != getMap()) { + _savedMapCardId = _vm->getCurCard(); + _vm->changeToCard(getMap(), true); + } +} + +void MystScriptParser::o_exitMap(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + _vm->changeToCard(_savedMapCardId, true); +} + } // End of namespace Mohawk diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h index e4f4cc3cfe..18f5b27a6d 100644 --- a/engines/mohawk/myst_scripts.h +++ b/engines/mohawk/myst_scripts.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_H @@ -79,6 +76,9 @@ public: virtual void toggleVar(uint16 var); virtual bool setVarValue(uint16 var, uint16 value); + virtual uint16 getMap() { return 0; } + void showMap(); + void animatedUpdate(uint16 argc, uint16 *argv, uint16 delay); DECLARE_OPCODE(unknown); @@ -122,6 +122,7 @@ public: DECLARE_OPCODE(o_saveMainCursor); DECLARE_OPCODE(o_restoreMainCursor); DECLARE_OPCODE(o_soundWaitStop); + DECLARE_OPCODE(o_exitMap); // Used in multiple stacks DECLARE_OPCODE(o_quit); @@ -147,6 +148,7 @@ protected: MystResource *_invokingResource; uint16 _savedCardId; + uint16 _savedMapCardId; uint16 _savedCursorId; int16 _tempVar; // Generic temp var used by the scripts uint32 _startTime; // Generic start time used by the scripts diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp index cba2583a50..0dd69a673a 100644 --- a/engines/mohawk/myst_stacks/channelwood.cpp +++ b/engines/mohawk/myst_stacks/channelwood.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" @@ -333,7 +330,7 @@ void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, uint16 a _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); _vm->_system->updateScreen(); - _vm->_system->delayMillis(10); + _vm->changeToCard(cardId, true); if (argc == 3) { @@ -351,7 +348,6 @@ void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, uint16 argc, uint1 for (uint16 imageId = 3601; imageId >= 3595; imageId--) { _vm->_gfx->copyImageToScreen(imageId, rect); _vm->_system->updateScreen(); - _vm->_system->delayMillis(5); } pipeChangeValve(true, 0x80); @@ -666,7 +662,6 @@ void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, uint16 argc, uint for (uint16 imageId = 3595; imageId <= 3601; imageId++) { _vm->_gfx->copyImageToScreen(imageId, rect); _vm->_system->updateScreen(); - _vm->_system->delayMillis(5); } pipeChangeValve(false, 0x80); diff --git a/engines/mohawk/myst_stacks/channelwood.h b/engines/mohawk/myst_stacks/channelwood.h index 5eeaa63e23..a3ea406003 100644 --- a/engines/mohawk/myst_stacks/channelwood.h +++ b/engines/mohawk/myst_stacks/channelwood.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_CHANNELWOOD_H @@ -52,6 +49,8 @@ private: void toggleVar(uint16 var); bool setVarValue(uint16 var, uint16 value); + virtual uint16 getMap() { return 9932; } + DECLARE_OPCODE(o_bridgeToggle); DECLARE_OPCODE(o_pipeExtend); DECLARE_OPCODE(o_drawImageChangeCardAndVolume); diff --git a/engines/mohawk/myst_stacks/credits.cpp b/engines/mohawk/myst_stacks/credits.cpp index bb8397fd09..ad593e3542 100644 --- a/engines/mohawk/myst_stacks/credits.cpp +++ b/engines/mohawk/myst_stacks/credits.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_stacks/credits.h b/engines/mohawk/myst_stacks/credits.h index 4f9eaa2944..a1f8b0a7d8 100644 --- a/engines/mohawk/myst_stacks/credits.h +++ b/engines/mohawk/myst_stacks/credits.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_CREDITS_H diff --git a/engines/mohawk/myst_stacks/demo.cpp b/engines/mohawk/myst_stacks/demo.cpp index a2dd148b22..53d946dd66 100644 --- a/engines/mohawk/myst_stacks/demo.cpp +++ b/engines/mohawk/myst_stacks/demo.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_stacks/demo.h b/engines/mohawk/myst_stacks/demo.h index 054dc7befe..4f8d68759b 100644 --- a/engines/mohawk/myst_stacks/demo.h +++ b/engines/mohawk/myst_stacks/demo.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_DEMO_H diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp index e2a11eb94f..cf28945c71 100644 --- a/engines/mohawk/myst_stacks/dni.cpp +++ b/engines/mohawk/myst_stacks/dni.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_stacks/dni.h b/engines/mohawk/myst_stacks/dni.h index b50f018d3e..7f04287082 100644 --- a/engines/mohawk/myst_stacks/dni.h +++ b/engines/mohawk/myst_stacks/dni.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_DNI_H diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp index 0d8f67a85b..7d3179fa24 100644 --- a/engines/mohawk/myst_stacks/intro.cpp +++ b/engines/mohawk/myst_stacks/intro.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_stacks/intro.h b/engines/mohawk/myst_stacks/intro.h index 0ecd9e6883..9fe3920e53 100644 --- a/engines/mohawk/myst_stacks/intro.h +++ b/engines/mohawk/myst_stacks/intro.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_INTRO_H diff --git a/engines/mohawk/myst_stacks/makingof.cpp b/engines/mohawk/myst_stacks/makingof.cpp index e639092ed4..b5ad647381 100644 --- a/engines/mohawk/myst_stacks/makingof.cpp +++ b/engines/mohawk/myst_stacks/makingof.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_stacks/makingof.h b/engines/mohawk/myst_stacks/makingof.h index 3033bb851e..d4bc0fd9f2 100644 --- a/engines/mohawk/myst_stacks/makingof.h +++ b/engines/mohawk/myst_stacks/makingof.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_MAKINGOF_H diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp index c5c11026f5..d6dd1b5407 100644 --- a/engines/mohawk/myst_stacks/mechanical.cpp +++ b/engines/mohawk/myst_stacks/mechanical.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" @@ -54,11 +51,26 @@ Mechanical::~Mechanical() { void Mechanical::setupOpcodes() { // "Stack-Specific" Opcodes OPCODE(100, o_throneEnablePassage); + OPCODE(101, o_birdCrankStart); + OPCODE(102, NOP); + OPCODE(103, o_birdCrankStop); OPCODE(104, o_snakeBoxTrigger); OPCODE(105, o_fortressStaircaseMovie); OPCODE(106, o_elevatorRotationStart); OPCODE(107, o_elevatorRotationMove); OPCODE(108, o_elevatorRotationStop); + OPCODE(109, o_fortressRotationSpeedStart); + OPCODE(110, o_fortressRotationSpeedMove); + OPCODE(111, o_fortressRotationSpeedStop); + OPCODE(112, o_fortressRotationBrakeStart); + OPCODE(113, o_fortressRotationBrakeMove); + OPCODE(114, o_fortressRotationBrakeStop); + OPCODE(115, o_fortressSimulationSpeedStart); + OPCODE(116, o_fortressSimulationSpeedMove); + OPCODE(117, o_fortressSimulationSpeedStop); + OPCODE(118, o_fortressSimulationBrakeStart); + OPCODE(119, o_fortressSimulationBrakeMove); + OPCODE(120, o_fortressSimulationBrakeStop); OPCODE(121, o_elevatorWindowMovie); OPCODE(122, o_elevatorGoMiddle); OPCODE(123, o_elevatorTopMovie); @@ -75,12 +87,12 @@ void Mechanical::setupOpcodes() { // "Init" Opcodes OPCODE(200, o_throne_init); OPCODE(201, o_fortressStaircase_init); - OPCODE(202, opcode_202); + OPCODE(202, o_bird_init); OPCODE(203, o_snakeBox_init); OPCODE(204, o_elevatorRotation_init); - OPCODE(205, opcode_205); - OPCODE(206, opcode_206); - OPCODE(209, opcode_209); + OPCODE(205, o_fortressRotation_init); + OPCODE(206, o_fortressSimulation_init); + OPCODE(209, o_fortressSimulationStartup_init); // "Exit" Opcodes OPCODE(300, NOP); @@ -89,15 +101,15 @@ void Mechanical::setupOpcodes() { #undef OPCODE void Mechanical::disablePersistentScripts() { - opcode_202_disable(); - opcode_205_disable(); - opcode_206_disable(); - opcode_209_disable(); + _fortressSimulationRunning = false; _elevatorGoingMiddle = false; + _birdSinging = false; + _fortressRotationRunning = false; } void Mechanical::runPersistentScripts() { - opcode_202_run(); + if (_birdSinging) + birdSing_run(); if (_elevatorRotationLeverMoving) elevatorRotation_run(); @@ -105,9 +117,11 @@ void Mechanical::runPersistentScripts() { if (_elevatorGoingMiddle) elevatorGoMiddle_run(); - opcode_205_run(); - opcode_206_run(); - opcode_209_run(); + if (_fortressRotationRunning) + fortressRotation_run(); + + if (_fortressSimulationRunning) + fortressSimulation_run(); } uint16 Mechanical::getVar(uint16 var) { @@ -245,6 +259,38 @@ void Mechanical::o_throneEnablePassage(uint16 op, uint16 var, uint16 argc, uint1 _vm->_resources[argv[0]]->setEnabled(getVar(var)); } +void Mechanical::o_birdCrankStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Mechanical bird crank start", op); + + MystResourceType11 *crank = static_cast<MystResourceType11 *>(_invokingResource); + + uint16 crankSoundId = crank->getList2(0); + _vm->_sound->replaceSoundMyst(crankSoundId, Audio::Mixer::kMaxChannelVolume, true); + + _birdSingEndTime = 0; + _birdCrankStartTime = _vm->_system->getMillis(); + + MystResourceType6 *crankMovie = static_cast<MystResourceType6 *>(crank->getSubResource(0)); + crankMovie->playMovie(); +} + +void Mechanical::o_birdCrankStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Mechanical bird crank stop", op); + + MystResourceType11 *crank = static_cast<MystResourceType11 *>(_invokingResource); + + MystResourceType6 *crankMovie = static_cast<MystResourceType6 *>(crank->getSubResource(0)); + crankMovie->pauseMovie(true); + + uint16 crankSoundId = crank->getList2(1); + _vm->_sound->replaceSoundMyst(crankSoundId); + + _birdSingEndTime = 2 * _vm->_system->getMillis() - _birdCrankStartTime; + _birdSinging = true; + + _bird->playMovie(); +} + void Mechanical::o_snakeBoxTrigger(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op); @@ -346,6 +392,164 @@ void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, uint16 argc, uint _vm->checkCursorHints(); } +void Mechanical::o_fortressRotationSpeedStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation speed lever start", op); + + _vm->_cursor->setCursor(700); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + lever->drawFrame(0); +} + +void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation speed lever move", op); + + const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + + // Make the handle follow the mouse + int16 maxStep = lever->getNumFrames() - 1; + Common::Rect rect = lever->getRect(); + int16 step = ((rect.top + 65 - mouse.y) * lever->getNumFrames()) / 65; + step = CLIP<int16>(step, 0, maxStep); + + _fortressRotationSpeed = step; + + // Draw current frame + lever->drawFrame(step); +} + +void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation speed lever stop", op); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + + // Release lever + for (int i = _fortressRotationSpeed; i >= 0; i--) { + lever->drawFrame(i); + _vm->_system->delayMillis(10); + } + + _fortressRotationSpeed = 0; + + _vm->checkCursorHints(); +} + +void Mechanical::o_fortressRotationBrakeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation brake lever start", op); + + _vm->_cursor->setCursor(700); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + lever->drawFrame(_fortressRotationBrake); +} + +void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation brake lever move", op); + + const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + + // Make the handle follow the mouse + int16 maxStep = lever->getNumFrames() - 1; + Common::Rect rect = lever->getRect(); + int16 step = ((rect.top + 65 - mouse.y) * lever->getNumFrames()) / 65; + step = CLIP<int16>(step, 0, maxStep); + + _fortressRotationBrake = step; + + // Draw current frame + lever->drawFrame(step); +} + +void Mechanical::o_fortressRotationBrakeStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation brake lever stop", op); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + lever->drawFrame(_fortressRotationBrake); + + _vm->checkCursorHints(); +} + +void Mechanical::o_fortressSimulationSpeedStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever start", op); + + _vm->_cursor->setCursor(700); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + lever->drawFrame(0); +} + +void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever move", op); + + const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + + // Make the handle follow the mouse + int16 maxStep = lever->getNumFrames() - 1; + Common::Rect rect = lever->getRect(); + int16 step = ((rect.bottom - mouse.y) * lever->getNumFrames()) / rect.height(); + step = CLIP<int16>(step, 0, maxStep); + + _fortressSimulationSpeed = step; + + // Draw current frame + lever->drawFrame(step); +} + +void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever stop", op); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + + // Release lever + for (int i = _fortressSimulationSpeed; i >= 0; i--) { + lever->drawFrame(i); + _vm->_system->delayMillis(10); + } + + _fortressSimulationSpeed = 0; + + _vm->checkCursorHints(); +} + +void Mechanical::o_fortressSimulationBrakeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever start", op); + + _vm->_cursor->setCursor(700); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + lever->drawFrame(_fortressSimulationBrake); +} + +void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever move", op); + + const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + + // Make the handle follow the mouse + int16 maxStep = lever->getNumFrames() - 1; + Common::Rect rect = lever->getRect(); + int16 step = ((rect.bottom - mouse.y) * lever->getNumFrames()) / rect.height(); + step = CLIP<int16>(step, 0, maxStep); + + _fortressSimulationBrake = step; + + // Draw current frame + lever->drawFrame(step); +} + +void Mechanical::o_fortressSimulationBrakeStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever stop", op); + + MystResourceType12 *lever = static_cast<MystResourceType12 *>(_invokingResource); + lever->drawFrame(_fortressSimulationBrake); + + _vm->checkCursorHints(); +} + void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { uint16 startTime = argv[0]; uint16 endTime = argv[1]; @@ -515,25 +719,21 @@ void Mechanical::o_fortressStaircase_init(uint16 op, uint16 var, uint16 argc, ui _vm->_resources[argv[2]]->setEnabled(_state.staircaseState); } -static struct { - bool enabled; -} g_opcode202Parameters; - -void Mechanical::opcode_202_run() { +void Mechanical::birdSing_run() { // Used for Card 6220 (Sirrus' Mechanical Bird) - // TODO: Fill in Function + uint32 time = _vm->_system->getMillis(); + if (_birdSingEndTime < time) { + _bird->pauseMovie(true); + _birdSinging = false; + } } -void Mechanical::opcode_202_disable() { - g_opcode202Parameters.enabled = false; -} +void Mechanical::o_bird_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Mechanical bird init", op); -void Mechanical::opcode_202(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - // Used for Card 6220 (Sirrus' Mechanical Bird) - if (argc == 0) - g_opcode202Parameters.enabled = true; - else - unknown(op, var, argc, argv); + _birdSinging = false; + _birdSingEndTime = 0; + _bird = static_cast<MystResourceType6 *>(_invokingResource); } void Mechanical::o_snakeBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { @@ -567,101 +767,53 @@ void Mechanical::o_elevatorRotation_init(uint16 op, uint16 var, uint16 argc, uin _elevatorRotationLeverMoving = false; } -static struct { - uint16 soundIdPosition[4]; - - bool enabled; -} g_opcode205Parameters; - -void Mechanical::opcode_205_run() { +void Mechanical::fortressRotation_run() { // Used for Card 6156 (Fortress Rotation Controls) // TODO: Fill in function... - // g_opcode205Parameters.soundIdPosition[4] -} - -void Mechanical::opcode_205_disable() { - g_opcode205Parameters.enabled = false; -} - -void Mechanical::opcode_205(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - varUnusedCheck(op, var); - - // Used for Card 6156 (Fortress Rotation Controls) - - if (argc == 4) { - g_opcode205Parameters.soundIdPosition[0] = argv[0]; - g_opcode205Parameters.soundIdPosition[1] = argv[1]; - g_opcode205Parameters.soundIdPosition[2] = argv[2]; - g_opcode205Parameters.soundIdPosition[3] = argv[3]; - - g_opcode205Parameters.enabled = true; - } else - unknown(op, var, argc, argv); } -static struct { - uint16 soundIdStart[2]; - uint16 soundIdPosition[4]; +void Mechanical::o_fortressRotation_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Fortress rotation init", op); - bool enabled; -} g_opcode206Parameters; + _fortressRotationGears = static_cast<MystResourceType6 *>(_invokingResource); -void Mechanical::opcode_206_run() { - if (g_opcode206Parameters.enabled) { - // Used for Card 6044 (Fortress Rotation Simulator) + _fortressRotationSounds[0] = argv[0]; + _fortressRotationSounds[1] = argv[1]; + _fortressRotationSounds[2] = argv[2]; + _fortressRotationSounds[3] = argv[3]; - // g_opcode206Parameters.soundIdStart[2] - // g_opcode206Parameters.soundIdPosition[4] + _fortressRotationBrake = 0; - // TODO: Fill in function... - } + _fortressRotationRunning = true; } -void Mechanical::opcode_206_disable() { - g_opcode206Parameters.enabled = false; -} - -void Mechanical::opcode_206(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - varUnusedCheck(op, var); - +void Mechanical::fortressSimulation_run() { // Used for Card 6044 (Fortress Rotation Simulator) - if (argc == 6) { - g_opcode206Parameters.soundIdStart[0] = argv[0]; - g_opcode206Parameters.soundIdStart[1] = argv[1]; - g_opcode206Parameters.soundIdPosition[0] = argv[2]; - g_opcode206Parameters.soundIdPosition[1] = argv[3]; - g_opcode206Parameters.soundIdPosition[2] = argv[4]; - g_opcode206Parameters.soundIdPosition[3] = argv[5]; - - g_opcode206Parameters.enabled = true; - } else - unknown(op, var, argc, argv); + // TODO: Fill in function... } +void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Fortress rotation simulator init", op); -static struct { - bool enabled; -} g_opcode209Parameters; + _fortressSimulationHolo = static_cast<MystResourceType6 *>(_invokingResource); -void Mechanical::opcode_209_run() { - // Used for Card 6044 (Fortress Rotation Simulator) + _fortressSimulationStartSound1 = argv[0]; + _fortressSimulationStartSound2 = argv[1]; - // TODO: Implement Function For Secret Panel State as - // per Opcode 200 function (Mechanical) -} + _fortressRotationSounds[0] = argv[2]; + _fortressRotationSounds[1] = argv[3]; + _fortressRotationSounds[2] = argv[4]; + _fortressRotationSounds[3] = argv[5]; + + _fortressSimulationBrake = 0; -void Mechanical::opcode_209_disable() { - g_opcode209Parameters.enabled = false; + _fortressSimulationRunning = true; } -void Mechanical::opcode_209(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - varUnusedCheck(op, var); +void Mechanical::o_fortressSimulationStartup_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { + debugC(kDebugScript, "Opcode %d: Fortress rotation simulator startup init", op); - // Used for Card 6044 (Fortress Rotation Simulator) - if (argc == 0) - g_opcode209Parameters.enabled = true; - else - unknown(op, var, argc, argv); + _fortressSimulationStartup = static_cast<MystResourceType6 *>(_invokingResource); } } // End of namespace MystStacks diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h index 6a0aa30f5c..3bd7f2d71b 100644 --- a/engines/mohawk/myst_stacks/mechanical.h +++ b/engines/mohawk/myst_stacks/mechanical.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_MECHANICAL_H @@ -52,23 +49,34 @@ private: void toggleVar(uint16 var); bool setVarValue(uint16 var, uint16 value); - void opcode_202_run(); - void opcode_202_disable(); + virtual uint16 getMap() { return 9931; } + + void birdSing_run(); void elevatorRotation_run(); void elevatorGoMiddle_run(); - void opcode_205_run(); - void opcode_205_disable(); - void opcode_206_run(); - void opcode_206_disable(); - void opcode_209_run(); - void opcode_209_disable(); + void fortressRotation_run(); + void fortressSimulation_run(); DECLARE_OPCODE(o_throneEnablePassage); + DECLARE_OPCODE(o_birdCrankStart); + DECLARE_OPCODE(o_birdCrankStop); DECLARE_OPCODE(o_snakeBoxTrigger); DECLARE_OPCODE(o_fortressStaircaseMovie); DECLARE_OPCODE(o_elevatorRotationStart); DECLARE_OPCODE(o_elevatorRotationMove); DECLARE_OPCODE(o_elevatorRotationStop); + DECLARE_OPCODE(o_fortressRotationSpeedStart); + DECLARE_OPCODE(o_fortressRotationSpeedMove); + DECLARE_OPCODE(o_fortressRotationSpeedStop); + DECLARE_OPCODE(o_fortressRotationBrakeStart); + DECLARE_OPCODE(o_fortressRotationBrakeMove); + DECLARE_OPCODE(o_fortressRotationBrakeStop); + DECLARE_OPCODE(o_fortressSimulationSpeedStart); + DECLARE_OPCODE(o_fortressSimulationSpeedMove); + DECLARE_OPCODE(o_fortressSimulationSpeedStop); + DECLARE_OPCODE(o_fortressSimulationBrakeStart); + DECLARE_OPCODE(o_fortressSimulationBrakeMove); + DECLARE_OPCODE(o_fortressSimulationBrakeStop); DECLARE_OPCODE(o_elevatorWindowMovie); DECLARE_OPCODE(o_elevatorGoMiddle); DECLARE_OPCODE(o_elevatorTopMovie); @@ -84,18 +92,31 @@ private: DECLARE_OPCODE(o_throne_init); DECLARE_OPCODE(o_fortressStaircase_init); - DECLARE_OPCODE(opcode_202); + DECLARE_OPCODE(o_bird_init); DECLARE_OPCODE(o_snakeBox_init); DECLARE_OPCODE(o_elevatorRotation_init); - DECLARE_OPCODE(opcode_205); - DECLARE_OPCODE(opcode_206); - DECLARE_OPCODE(opcode_209); + DECLARE_OPCODE(o_fortressRotation_init); + DECLARE_OPCODE(o_fortressSimulation_init); + DECLARE_OPCODE(o_fortressSimulationStartup_init); MystGameState::Mechanical &_state; bool _mystStaircaseState; // 76 + bool _fortressRotationRunning; + uint16 _fortressRotationSpeed; // 78 + uint16 _fortressRotationBrake; // 80 uint16 _fortressPosition; // 82 + uint16 _fortressRotationSounds[4]; // 86 to 92 + MystResourceType6 *_fortressRotationGears; // 172 + + bool _fortressSimulationRunning; + uint16 _fortressSimulationSpeed; // 96 + uint16 _fortressSimulationBrake; // 98 + uint16 _fortressSimulationStartSound1; // 102 + uint16 _fortressSimulationStartSound2; // 100 + MystResourceType6 *_fortressSimulationHolo; // 160 + MystResourceType6 *_fortressSimulationStartup; // 164 uint16 _elevatorGoingDown; // 112 @@ -113,6 +134,12 @@ private: uint16 _crystalLit; // 130 + bool _birdSinging; // 144 + uint32 _birdCrankStartTime; // 136 + uint32 _birdSingEndTime; // 140 + MystResourceType6 *_bird; // 152 + + MystResourceType6 *_snakeBox; // 156 }; diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp index 2b8ef94442..f77ae753d9 100644 --- a/engines/mohawk/myst_stacks/myst.cpp +++ b/engines/mohawk/myst_stacks/myst.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" @@ -862,7 +859,6 @@ void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, uint16 argc, uint16 *a for (uint i = 4795; i >= 4779; i--) { _vm->_gfx->copyImageToScreen(i, _invokingResource->getRect()); _vm->_system->updateScreen(); - _vm->_system->delayMillis(1); } _fireplaceLines[var - 17] &= ~bitmask; } else { @@ -870,7 +866,6 @@ void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, uint16 argc, uint16 *a for (uint i = 4779; i <= 4795; i++) { _vm->_gfx->copyImageToScreen(i, _invokingResource->getRect()); _vm->_system->updateScreen(); - _vm->_system->delayMillis(1); } _fireplaceLines[var - 17] |= bitmask; } diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h index 51dffd0abe..9510d371d7 100644 --- a/engines/mohawk/myst_stacks/myst.h +++ b/engines/mohawk/myst_stacks/myst.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_MYST_H @@ -52,6 +49,8 @@ private: void toggleVar(uint16 var); bool setVarValue(uint16 var, uint16 value); + virtual uint16 getMap() { return 9934; } + void towerRotationMap_run(); void libraryBookcaseTransform_run(); void generatorControlRoom_run(); diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp index fddf6290fb..37b749f100 100644 --- a/engines/mohawk/myst_stacks/preview.cpp +++ b/engines/mohawk/myst_stacks/preview.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_stacks/preview.h b/engines/mohawk/myst_stacks/preview.h index 870e4b9272..7e4e418eef 100644 --- a/engines/mohawk/myst_stacks/preview.h +++ b/engines/mohawk/myst_stacks/preview.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_PREVIEW_H diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp index c670cb6a48..1473742259 100644 --- a/engines/mohawk/myst_stacks/selenitic.cpp +++ b/engines/mohawk/myst_stacks/selenitic.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" diff --git a/engines/mohawk/myst_stacks/selenitic.h b/engines/mohawk/myst_stacks/selenitic.h index 4ec92b9869..d314c4d810 100644 --- a/engines/mohawk/myst_stacks/selenitic.h +++ b/engines/mohawk/myst_stacks/selenitic.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_SELENITIC_H @@ -53,6 +50,8 @@ private: void toggleVar(uint16 var); bool setVarValue(uint16 var, uint16 value); + virtual uint16 getMap() { return 9930; } + DECLARE_OPCODE(o_mazeRunnerMove); DECLARE_OPCODE(o_mazeRunnerSoundRepeat); DECLARE_OPCODE(o_soundReceiverSigma); diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp index 4057edd9c9..72b299ee6d 100644 --- a/engines/mohawk/myst_stacks/slides.cpp +++ b/engines/mohawk/myst_stacks/slides.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/myst.h" diff --git a/engines/mohawk/myst_stacks/slides.h b/engines/mohawk/myst_stacks/slides.h index 1e0504a665..8bc61d0e24 100644 --- a/engines/mohawk/myst_stacks/slides.h +++ b/engines/mohawk/myst_stacks/slides.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_SLIDES_H diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp index 07701c273e..e0c374a926 100644 --- a/engines/mohawk/myst_stacks/stoneship.cpp +++ b/engines/mohawk/myst_stacks/stoneship.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" diff --git a/engines/mohawk/myst_stacks/stoneship.h b/engines/mohawk/myst_stacks/stoneship.h index 091fdcd169..4125412b4d 100644 --- a/engines/mohawk/myst_stacks/stoneship.h +++ b/engines/mohawk/myst_stacks/stoneship.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SCRIPTS_STONESHIP_H @@ -52,6 +49,8 @@ private: void toggleVar(uint16 var); bool setVarValue(uint16 var, uint16 value); + virtual uint16 getMap() { return 9933; } + DECLARE_OPCODE(o_pumpTurnOff); DECLARE_OPCODE(o_brotherDoorOpen); DECLARE_OPCODE(o_cabinBookMovie); diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp index de71dcf382..bab4b8dd51 100644 --- a/engines/mohawk/myst_state.cpp +++ b/engines/mohawk/myst_state.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" @@ -103,6 +100,9 @@ bool MystGameState::load(const Common::String &filename) { syncGameState(s, size == 664); delete loadFile; + // Switch us back to the intro stack, to the linking book + _vm->changeToStack(kIntroStack, 5, 0, 0); + // Set our default cursor if (_globals.heldPage == 0 || _globals.heldPage > 13) _vm->setMainCursor(kDefaultMystCursor); @@ -113,9 +113,6 @@ bool MystGameState::load(const Common::String &filename) { else // if (globals.heldPage == 13) _vm->setMainCursor(kWhitePageCursor); - // Switch us back to the intro stack, to the linking book - _vm->changeToStack(kIntroStack, 5, 0, 0); - return true; } diff --git a/engines/mohawk/myst_state.h b/engines/mohawk/myst_state.h index 074c3e5f10..c7a6c0b4ac 100644 --- a/engines/mohawk/myst_state.h +++ b/engines/mohawk/myst_state.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MYST_SAVELOAD_H diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp index 62250b75f2..3a95b83199 100644 --- a/engines/mohawk/resource.cpp +++ b/engines/mohawk/resource.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/resource.h" diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h index 07c727951c..cabce04e38 100644 --- a/engines/mohawk/resource.h +++ b/engines/mohawk/resource.h @@ -18,9 +18,6 @@ * 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 "common/scummsys.h" diff --git a/engines/mohawk/resource_cache.cpp b/engines/mohawk/resource_cache.cpp index 75f608f5fd..e73d8c43d3 100644 --- a/engines/mohawk/resource_cache.cpp +++ b/engines/mohawk/resource_cache.cpp @@ -18,9 +18,6 @@ * 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 "common/debug.h" diff --git a/engines/mohawk/resource_cache.h b/engines/mohawk/resource_cache.h index 32e345cf4b..b7eac9ebd7 100644 --- a/engines/mohawk/resource_cache.h +++ b/engines/mohawk/resource_cache.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef RESOURCE_CACHE_H diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 3d496d0f38..f407e650f6 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -18,16 +18,13 @@ * 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 "common/config-manager.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/keyboard.h" #include "common/translation.h" +#include "common/system.h" #include "mohawk/cursors.h" #include "mohawk/graphics.h" @@ -121,8 +118,7 @@ Common::Error MohawkEngine_Riven::run() { _optionsDialog = new RivenOptionsDialog(this); _scriptMan = new RivenScriptManager(this); - _rnd = new Common::RandomSource(); - g_eventRec.registerRandomSource(*_rnd, "riven"); + _rnd = new Common::RandomSource("riven"); // Create the cursor manager if (Common::File::exists("rivendmo.exe")) diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index 3aba5643db..e01e03895c 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_RIVEN_H diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index dc0d66f19b..8ad05ded13 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" diff --git a/engines/mohawk/riven_external.h b/engines/mohawk/riven_external.h index 034cd662f6..5f5d0cb0b2 100644 --- a/engines/mohawk/riven_external.h +++ b/engines/mohawk/riven_external.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef RIVEN_EXTERNAL_H diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index 35ce7aad84..35d82d4aa0 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/resource.h" diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h index fbd9f7cb36..c1b3fc639e 100644 --- a/engines/mohawk/riven_saveload.h +++ b/engines/mohawk/riven_saveload.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_SAVELOAD_H diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index b8f86f993a..b3d5369a84 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/cursors.h" diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index 2ac805c366..75d4592e55 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef RIVEN_SCRIPTS_H diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp index 7f06a67a1d..946e2e0496 100644 --- a/engines/mohawk/riven_vars.cpp +++ b/engines/mohawk/riven_vars.cpp @@ -18,9 +18,6 @@ * 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 "common/str.h" diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index fba87808d2..6144c89e21 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/sound.h" @@ -619,9 +616,16 @@ Audio::SoundHandle *Sound::replaceBackgroundMyst(uint16 id, uint16 volume) { Common::String name = _vm->getResourceName(ID_MSND, convertMystID(id)); + // Only the first eight characters need to be the same to have a match + Common::String prefix; + if (name.size() >= 8) + prefix = Common::String(name.c_str(), name.c_str() + 8); + else + prefix = name; + // Check if sound is already playing if (_mystBackgroundSound.type == kUsedHandle && _vm->_mixer->isSoundHandleActive(_mystBackgroundSound.handle) - && name.equals(_vm->getResourceName(ID_MSND, convertMystID(_mystBackgroundSound.id)))) + && _vm->getResourceName(ID_MSND, convertMystID(_mystBackgroundSound.id)).hasPrefix(prefix)) return &_mystBackgroundSound.handle; // Stop old background sound diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h index 702c6f61f3..593f2fcd0b 100644 --- a/engines/mohawk/sound.h +++ b/engines/mohawk/sound.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_SOUND_H diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index 8f57d61cc4..0a74d058c9 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/mohawk.h" diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h index e65629a1ec..efa81edfbd 100644 --- a/engines/mohawk/video.h +++ b/engines/mohawk/video.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_VIDEO_H diff --git a/engines/mohawk/view.cpp b/engines/mohawk/view.cpp index e5a44122ea..36e8f8466e 100644 --- a/engines/mohawk/view.cpp +++ b/engines/mohawk/view.cpp @@ -18,9 +18,6 @@ * 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 "mohawk/view.h" diff --git a/engines/mohawk/view.h b/engines/mohawk/view.h index 14a47eebe4..06ffe605a3 100644 --- a/engines/mohawk/view.h +++ b/engines/mohawk/view.h @@ -18,9 +18,6 @@ * 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$ - * */ #ifndef MOHAWK_VIEW_H |