diff options
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/cursors.cpp | 31 | ||||
-rw-r--r-- | engines/mohawk/cursors.h | 17 | ||||
-rw-r--r-- | engines/mohawk/detection_tables.h | 14 | ||||
-rw-r--r-- | engines/mohawk/livingbooks.cpp | 4 |
4 files changed, 55 insertions, 11 deletions
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index 3fdc4c46b0..45f3329f13 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -103,11 +103,10 @@ void CursorManager::decodeMacXorCursor(Common::SeekableReadStream *stream, byte } } -void DefaultCursorManager::setCursor(uint16 id) { +void CursorManager::setStandardCursor(Common::SeekableReadStream *stream) { // The Broderbund devs decided to rip off the Mac format, it seems. // However, they reversed the x/y hotspot. That makes it totally different!!!! - - Common::SeekableReadStream *stream = _vm->getResource(_tag, id); + assert(stream); byte cursorBitmap[16 * 16]; decodeMacXorCursor(stream, cursorBitmap); @@ -120,6 +119,10 @@ void DefaultCursorManager::setCursor(uint16 id) { delete stream; } +void DefaultCursorManager::setCursor(uint16 id) { + setStandardCursor(_vm->getResource(_tag, id)); +} + MystCursorManager::MystCursorManager(MohawkEngine_Myst *vm) : _vm(vm) { _bmpDecoder = new MystBitmap(); } @@ -349,4 +352,26 @@ void MacCursorManager::setCursor(uint16 id) { delete stream; } +LivingBooksCursorManager_v2::LivingBooksCursorManager_v2() { + // Try to open the system archive if we have it + _sysArchive = new MohawkArchive(); + + if (!_sysArchive->open("system.mhk")) { + delete _sysArchive; + _sysArchive = 0; + } +} + +LivingBooksCursorManager_v2::~LivingBooksCursorManager_v2() { + delete _sysArchive; +} + +void LivingBooksCursorManager_v2::setCursor(uint16 id) { + if (_sysArchive && _sysArchive->hasResource(ID_TCUR, id)) { + setStandardCursor(_sysArchive->getResource(ID_TCUR, id)); + } else { + // TODO: Handle generated cursors + } +} + } // End of namespace Mohawk diff --git a/engines/mohawk/cursors.h b/engines/mohawk/cursors.h index 067c3bad7f..a542ddb7c3 100644 --- a/engines/mohawk/cursors.h +++ b/engines/mohawk/cursors.h @@ -66,6 +66,7 @@ enum { kRivenHideCursor = 9000 }; +class MohawkArchive; class MohawkEngine; class MohawkEngine_Myst; class MystBitmap; @@ -83,6 +84,9 @@ public: protected: // Handles the Mac version of the xor/and map cursor void decodeMacXorCursor(Common::SeekableReadStream *stream, byte *cursor); + + // Set a tCUR resource as the current cursor + void setStandardCursor(Common::SeekableReadStream *stream); }; // The default Mohawk cursor manager @@ -152,6 +156,19 @@ private: Common::MacResManager *_resFork; }; +// The cursor manager for Living Books v2+ games +// Handles custom generated cursors in addition to tCUR resources +class LivingBooksCursorManager_v2 : public CursorManager { +public: + LivingBooksCursorManager_v2(); + ~LivingBooksCursorManager_v2(); + + void setCursor(uint16 id); + +private: + MohawkArchive *_sysArchive; +}; + } // End of namespace Mohawk #endif diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index bd568c33f2..e21db1a53b 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -610,7 +610,7 @@ static const MohawkGameDescription gameDescriptions[] = { }, GType_LIVINGBOOKSV2, 0, - "GREEN.EXE" + 0 }, // 32-bit version of the previous entry @@ -626,7 +626,7 @@ static const MohawkGameDescription gameDescriptions[] = { }, GType_LIVINGBOOKSV2, 0, - "GREEN32.EXE" + 0 }, { @@ -641,7 +641,7 @@ static const MohawkGameDescription gameDescriptions[] = { }, GType_LIVINGBOOKSV2, 0, - "Green Eggs and Ham" + 0 }, { @@ -656,7 +656,7 @@ static const MohawkGameDescription gameDescriptions[] = { }, GType_LIVINGBOOKSV2, 0, - "ABC.EXE" + 0 }, // 32-bit version of the previous entry @@ -672,7 +672,7 @@ static const MohawkGameDescription gameDescriptions[] = { }, GType_LIVINGBOOKSV2, 0, - "ABC32.EXE" + 0 }, { @@ -1005,7 +1005,7 @@ static const MohawkGameDescription gameDescriptions[] = { }, GType_LIVINGBOOKSV2, 0, - "RACE.EXE" + 0 }, // 32-bit version of the previous entry @@ -1021,7 +1021,7 @@ static const MohawkGameDescription gameDescriptions[] = { }, GType_LIVINGBOOKSV2, 0, - "RACE32.EXE" + 0 }, { diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index b7e8a7b71a..4a336f4b77 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -116,7 +116,9 @@ Common::Error MohawkEngine_LivingBooks::run() { _gfx = new LBGraphics(this, _screenWidth, _screenHeight); - if (getPlatform() == Common::kPlatformMacintosh) + if (getGameType() != GType_LIVINGBOOKSV1) + _cursor = new LivingBooksCursorManager_v2(); + else if (getPlatform() == Common::kPlatformMacintosh) _cursor = new MacCursorManager(getAppName()); else _cursor = new NECursorManager(getAppName()); |