From d096b78acaa510e02cb9be9a2e2dc17e53f80e3e Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 13 Feb 2011 16:11:22 -0500 Subject: MOHAWK: Add support for Mac LB v2 games --- engines/mohawk/detection_tables.h | 5 +---- engines/mohawk/graphics.cpp | 6 +++--- engines/mohawk/livingbooks.cpp | 15 ++++++++++----- engines/mohawk/livingbooks.h | 1 + engines/mohawk/sound.cpp | 6 ++++++ 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index 8f294f065f..26c278f9cb 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -690,9 +690,6 @@ static const MohawkGameDescription gameDescriptions[] = { 0 }, - // FIXME: Mac version of Dr. Seuss's ABC uses V1 archive format, but has - // V2 script format. Currently the engine aborts after the "A--B--C" intro with: - // failed to read script entry correctly (8 bytes left): type 0x0067, event 0x0004, opcode 0x0006, param 0x0001! { { "seussabc", @@ -703,7 +700,7 @@ static const MohawkGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, Common::GUIO_NONE }, - GType_LIVINGBOOKSV1, + GType_LIVINGBOOKSV2, 0, 0 }, diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp index fe015b4527..be2fe01c4d 100644 --- a/engines/mohawk/graphics.cpp +++ b/engines/mohawk/graphics.cpp @@ -956,7 +956,7 @@ void RivenGraphics::drawExtrasImage(uint16 id, Common::Rect dstRect) { } LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm, uint16 width, uint16 height) : GraphicsManager(), _vm(vm) { - _bmpDecoder = (_vm->getGameType() == GType_LIVINGBOOKSV1) ? new OldMohawkBitmap() : new MohawkBitmap(); + _bmpDecoder = _vm->isPreMohawk() ? new OldMohawkBitmap() : new MohawkBitmap(); initGraphics(width, height, true); } @@ -966,7 +966,7 @@ LBGraphics::~LBGraphics() { } MohawkSurface *LBGraphics::decodeImage(uint16 id) { - if (_vm->getGameType() == GType_LIVINGBOOKSV1) + if (_vm->isPreMohawk()) return _bmpDecoder->decodeImage(_vm->wrapStreamEndian(ID_BMAP, id)); return _bmpDecoder->decodeImage(_vm->getResource(ID_TBMP, id)); @@ -1002,7 +1002,7 @@ bool LBGraphics::imageIsTransparentAt(uint16 image, bool useOffsets, int x, int void LBGraphics::setPalette(uint16 id) { // Old Living Books games use the old CTBL-style palette format while newer // games use the better tPAL format which can store partial palettes. - if (_vm->getGameType() == GType_LIVINGBOOKSV1) { + if (_vm->isPreMohawk()) { Common::SeekableSubReadStreamEndian *ctblStream = _vm->wrapStreamEndian(ID_CTBL, id); uint16 colorCount = ctblStream->readUint16(); byte *palette = new byte[colorCount * 4]; diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index 4c2cc78ee7..45c430e7e8 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -55,7 +55,7 @@ Common::Rect MohawkEngine_LivingBooks::readRect(Common::SeekableSubReadStreamEnd Common::Rect rect; // the V1 mac games have their rects in QuickDraw order - if (getGameType() == GType_LIVINGBOOKSV1 && getPlatform() == Common::kPlatformMacintosh) { + if (isPreMohawk() && getPlatform() == Common::kPlatformMacintosh) { rect.top = stream->readSint16(); rect.left = stream->readSint16(); rect.bottom = stream->readSint16(); @@ -685,7 +685,12 @@ Common::String MohawkEngine_LivingBooks::convertWinFileName(const Common::String } MohawkArchive *MohawkEngine_LivingBooks::createMohawkArchive() const { - return (getGameType() == GType_LIVINGBOOKSV1) ? new LivingBooksArchive_v1() : new MohawkArchive(); + return isPreMohawk() ? new LivingBooksArchive_v1() : new MohawkArchive(); +} + +bool MohawkEngine_LivingBooks::isPreMohawk() const { + return getGameType() == GType_LIVINGBOOKSV1 + || (getGameType() == GType_LIVINGBOOKSV2 && getPlatform() == Common::kPlatformMacintosh); } void MohawkEngine_LivingBooks::addNotifyEvent(NotifyEvent event) { @@ -1195,7 +1200,7 @@ void LBAnimationNode::draw(const Common::Rect &_bounds) { uint16 resourceId = _parent->getResource(_currentCel - 1); - if (_vm->getGameType() != GType_LIVINGBOOKSV1) { + if (!_vm->isPreMohawk()) { Common::Point offset = _parent->getOffset(_currentCel - 1); xOffset -= offset.x; yOffset -= offset.y; @@ -1391,7 +1396,7 @@ bool LBAnimationNode::transparentAt(int x, int y) { uint16 resourceId = _parent->getResource(_currentCel - 1); - if (_vm->getGameType() != GType_LIVINGBOOKSV1) { + if (!_vm->isPreMohawk()) { Common::Point offset = _parent->getOffset(_currentCel - 1); x += offset.x; y += offset.y; @@ -1492,7 +1497,7 @@ void LBAnimation::loadShape(uint16 resourceId) { Common::SeekableSubReadStreamEndian *shapeStream = _vm->wrapStreamEndian(ID_SHP, resourceId); - if (_vm->getGameType() == GType_LIVINGBOOKSV1) { + if (_vm->isPreMohawk()) { if (shapeStream->size() < 6) error("V1 SHP Record size too short (%d)", shapeStream->size()); diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 68b9ac6461..186502d532 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -589,6 +589,7 @@ public: void queueDelayedEvent(DelayedEvent event); bool isBigEndian() const { return getGameType() != GType_LIVINGBOOKSV1 || getPlatform() == Common::kPlatformMacintosh; } + bool isPreMohawk() const; LBMode getCurMode() { return _curMode; } diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index e5528e64f4..ca642f1376 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -92,6 +92,12 @@ Audio::AudioStream *Sound::makeAudioStream(uint16 id, CueList *cueList) { case GType_LIVINGBOOKSV1: audStream = makeOldMohawkWaveStream(_vm->getResource(ID_WAV, id)); break; + case GType_LIVINGBOOKSV2: + if (_vm->getPlatform() == Common::kPlatformMacintosh) { + audStream = makeOldMohawkWaveStream(_vm->getResource(ID_WAV, id)); + break; + } + // fall through default: audStream = makeMohawkWaveStream(_vm->getResource(ID_TWAV, id), cueList); } -- cgit v1.2.3