From 58356843ee0f7007059f5b032b010625b69aedde Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 2 Jul 2011 14:54:45 -0400 Subject: SCUMM: Fix Blue's Birthday Macintosh --- engines/scumm/detection.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 18f2f4ddec..d3514645d3 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -142,6 +142,14 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { Common::String result; char id = 0; + Common::String bPattern = _filenamePattern.pattern; + + // Special cases for Blue's games, which share common (b) files + if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO)) + bPattern = "Blue'sBirthday"; + else if (_game.id == GID_TREASUREHUNT) + bPattern = "Blue'sTreasureHunt"; + switch (_filenamePattern.genMethod) { case kGenHEMac: case kGenHEMacNoParens: @@ -154,13 +162,7 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { switch (disk) { case 2: id = 'b'; - // Special cases for Blue's games, which share common (b) files - if (_game.id == GID_BIRTHDAY && !(_game.features & GF_DEMO)) - result = "Blue'sBirthday.(b)"; - else if (_game.id == GID_TREASUREHUNT) - result = "Blue'sTreasureHunt.(b)"; - else - result = Common::String::format("%s.(b)", _filenamePattern.pattern); + result = bPattern + ".(b)"; break; case 1: id = 'a'; @@ -185,10 +187,11 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const { // For mac they're stored in game binary result = _filenamePattern.pattern; } else { + Common::String pattern = id == 'b' ? bPattern : _filenamePattern.pattern; if (_filenamePattern.genMethod == kGenHEMac) - result = Common::String::format("%s (%c)", _filenamePattern.pattern, id); + result = Common::String::format("%s (%c)", pattern.c_str(), id); else - result = Common::String::format("%s %c", _filenamePattern.pattern, id); + result = Common::String::format("%s %c", pattern.c_str(), id); } } -- cgit v1.2.3 From f7efd3fe2a881c13b7b625ebf3c75a7639d0f582 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 2 Jul 2011 14:55:05 -0400 Subject: SCUMM: Remove backslashes from Mac file names too Fixes Smacker videos in Blue's Birthday --- engines/scumm/he/script_v60he.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index cf7d9fbd2f..dbeee567bf 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -94,6 +94,12 @@ int ScummEngine_v60he::convertFilePath(byte *dst, int dstSize) { debug(1, "convertFilePath: original filePath is %s", dst); int len = resStrLen(dst); + + // Switch all \ to / for portablity + for (int i = 0; i < len; i++) + if (dst[i] == '\\') + dst[i] = '/'; + if (_game.platform == Common::kPlatformMacintosh) { // Remove : prefix in HE71 games if (dst[0] == ':') { @@ -107,12 +113,6 @@ int ScummEngine_v60he::convertFilePath(byte *dst, int dstSize) { if (dst[i] == ':') dst[i] = '/'; } - } else { - // Switch all \ to / for portablity - for (int i = 0; i < len; i++) { - if (dst[i] == '\\') - dst[i] = '/'; - } } // Strip path -- cgit v1.2.3 From 666d3815ec39db7116f8140a8e470565238636f3 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 2 Jul 2011 14:55:36 -0400 Subject: SCUMM: Don't have MoviePlayer inherit from SmackerDecoder --- engines/scumm/he/animation_he.cpp | 61 +++++++++++++++++++++++++++----------- engines/scumm/he/animation_he.h | 35 +++++++++++++--------- engines/scumm/he/script_v100he.cpp | 2 +- engines/scumm/he/script_v90he.cpp | 2 +- 4 files changed, 66 insertions(+), 34 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 74183c24d3..95a8a701bb 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -26,27 +26,32 @@ #include "scumm/he/intern_he.h" #include "audio/audiostream.h" +#include "video/smk_decoder.h" namespace Scumm { -MoviePlayer::MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer) - : SmackerDecoder(mixer), _vm(vm), _mixer(mixer) { - +MoviePlayer::MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer) : _vm(vm) { + _video = new Video::SmackerDecoder(mixer); _flags = 0; _wizResNum = 0; } +MoviePlayer::~MoviePlayer() { + delete _video; +} + int MoviePlayer::getImageNum() { - if (!isVideoLoaded()) + if (!_video->isVideoLoaded()) return 0; + return _wizResNum; } int MoviePlayer::load(const char *filename, int flags, int image) { - if (isVideoLoaded()) - close(); + if (_video->isVideoLoaded()) + _video->close(); - if (!loadFile(filename)) { + if (!_video->loadFile(filename)) { warning("Failed to load video file %s", filename); return -1; } @@ -54,7 +59,7 @@ int MoviePlayer::load(const char *filename, int flags, int image) { debug(1, "Playing video %s", filename); if (flags & 2) - _vm->_wiz->createWizEmptyImage(image, 0, 0, getWidth(), getHeight()); + _vm->_wiz->createWizEmptyImage(image, 0, 0, _video->getWidth(), _video->getHeight()); _flags = flags; _wizResNum = image; @@ -62,14 +67,14 @@ int MoviePlayer::load(const char *filename, int flags, int image) { } void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint pitch) { - uint h = getHeight(); - uint w = getWidth(); + uint h = _video->getHeight(); + uint w = _video->getWidth(); - const Graphics::Surface *surface = decodeNextFrame(); + const Graphics::Surface *surface = _video->decodeNextFrame(); byte *src = (byte *)surface->pixels; - if (hasDirtyPalette()) - _vm->setPaletteFromPtr(getPalette(), 256); + if (_video->hasDirtyPalette()) + _vm->setPaletteFromPtr(_video->getPalette(), 256); if (_vm->_game.features & GF_16BIT_COLOR) { dst += y * pitch + x * 2; @@ -101,7 +106,7 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint } void MoviePlayer::handleNextFrame() { - if (!isVideoLoaded()) + if (!_video->isVideoLoaded()) return; VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen]; @@ -115,17 +120,37 @@ void MoviePlayer::handleNextFrame() { } else if (_flags & 1) { copyFrameToBuffer(pvs->getBackPixels(0, 0), kDstScreen, 0, 0, pvs->pitch); - Common::Rect imageRect(getWidth(), getHeight()); + Common::Rect imageRect(_video->getWidth(), _video->getHeight()); _vm->restoreBackgroundHE(imageRect); } else { copyFrameToBuffer(pvs->getPixels(0, 0), kDstScreen, 0, 0, pvs->pitch); - Common::Rect imageRect(getWidth(), getHeight()); + Common::Rect imageRect(_video->getWidth(), _video->getHeight()); _vm->markRectAsDirty(kMainVirtScreen, imageRect); } - if (endOfVideo()) - close(); + if (_video->endOfVideo()) + _video->close(); +} + +void MoviePlayer::close() { + _video->close(); +} + +int MoviePlayer::getWidth() const { + return _video->getWidth(); +} + +int MoviePlayer::getHeight() const { + return _video->getHeight(); +} + +int MoviePlayer::getFrameCount() const { + return _video->getFrameCount(); +} + +int MoviePlayer::getCurFrame() const { + return _video->endOfVideo() ? -1 : _video->getCurFrame() + 1; } } // End of namespace Scumm diff --git a/engines/scumm/he/animation_he.h b/engines/scumm/he/animation_he.h index b3405fead0..7fa31a195d 100644 --- a/engines/scumm/he/animation_he.h +++ b/engines/scumm/he/animation_he.h @@ -23,34 +23,41 @@ #if !defined(SCUMM_HE_ANIMATION_H) && defined(ENABLE_HE) #define SCUMM_HE_ANIMATION_H -#include "video/smk_decoder.h" - #include "audio/mixer.h" +namespace Video { + class VideoDecoder; +} + namespace Scumm { class ScummEngine_v90he; -class MoviePlayer : public Video::SmackerDecoder { - ScummEngine_v90he *_vm; - - Audio::Mixer *_mixer; - - Audio::SoundHandle _bgSound; - Audio::AudioStream *_bgSoundStream; - - char baseName[40]; - uint32 _flags; - uint32 _wizResNum; - +class MoviePlayer { public: MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer); + ~MoviePlayer(); int getImageNum(); int load(const char *filename, int flags, int image = 0); void copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint pitch); void handleNextFrame(); + + void close(); + int getWidth() const; + int getHeight() const; + int getFrameCount() const; + int getCurFrame() const; + +private: + ScummEngine_v90he *_vm; + + Video::VideoDecoder *_video; + + char baseName[40]; + uint32 _flags; + uint32 _wizResNum; }; } // End of namespace Scumm diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index e057ab524a..5a9172ff8a 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -2933,7 +2933,7 @@ void ScummEngine_v100he::o100_getVideoData() { break; case 73: pop(); - push(_moviePlay->endOfVideo() ? -1 : (_moviePlay->getCurFrame() + 1)); + push(_moviePlay->getCurFrame()); break; case 84: pop(); diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index 6b632d8ff2..66a0a34d16 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -1460,7 +1460,7 @@ void ScummEngine_v90he::o90_getVideoData() { break; case 52: // Get current frame pop(); - push(_moviePlay->endOfVideo() ? -1 : (_moviePlay->getCurFrame() + 1)); + push(_moviePlay->getCurFrame()); break; case 63: // Get image number pop(); -- cgit v1.2.3 From 9374215789fcfa3ee34f256d819eaa91aa08b04f Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 2 Jul 2011 16:37:41 -0400 Subject: SCUMM: Add support for Bink video --- engines/scumm/he/animation_he.cpp | 66 ++++++++++++++++++++++++++++----------- engines/scumm/vars.cpp | 4 +-- 2 files changed, 50 insertions(+), 20 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 95a8a701bb..7c1bbfc9a5 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -26,12 +26,17 @@ #include "scumm/he/intern_he.h" #include "audio/audiostream.h" +#include "video/bink_decoder.h" #include "video/smk_decoder.h" namespace Scumm { MoviePlayer::MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer) : _vm(vm) { - _video = new Video::SmackerDecoder(mixer); + if (_vm->_game.heversion >= 100 && (_vm->_game.features & GF_16BIT_COLOR)) + _video = new Video::BinkDecoder(); + else + _video = new Video::SmackerDecoder(mixer); + _flags = 0; _wizResNum = 0; } @@ -71,30 +76,55 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint uint w = _video->getWidth(); const Graphics::Surface *surface = _video->decodeNextFrame(); + + if (!surface) + return; + byte *src = (byte *)surface->pixels; if (_video->hasDirtyPalette()) _vm->setPaletteFromPtr(_video->getPalette(), 256); if (_vm->_game.features & GF_16BIT_COLOR) { - dst += y * pitch + x * 2; - do { - for (uint i = 0; i < w; i++) { - uint16 color = READ_LE_UINT16(_vm->_hePalettes + _vm->_hePaletteSlot + 768 + src[i] * 2); - switch (dstType) { - case kDstScreen: - WRITE_UINT16(dst + i * 2, color); - break; - case kDstResource: - WRITE_LE_UINT16(dst + i * 2, color); - break; - default: - error("copyFrameToBuffer: Unknown dstType %d", dstType); + if (surface->format.bytesPerPixel == 1) { + dst += y * pitch + x * 2; + do { + for (uint i = 0; i < w; i++) { + uint16 color = READ_LE_UINT16(_vm->_hePalettes + _vm->_hePaletteSlot + 768 + src[i] * 2); + switch (dstType) { + case kDstScreen: + WRITE_UINT16(dst + i * 2, color); + break; + case kDstResource: + WRITE_LE_UINT16(dst + i * 2, color); + break; + default: + error("copyFrameToBuffer: Unknown dstType %d", dstType); + } } - } - dst += pitch; - src += w; - } while (--h); + dst += pitch; + src += w; + } while (--h); + } else { + dst += y * pitch + x * 2; + do { + for (uint i = 0; i < w; i++) { + uint16 color = *((uint16 *)src + i); + switch (dstType) { + case kDstScreen: + WRITE_UINT16(dst + i * 2, color); + break; + case kDstResource: + WRITE_LE_UINT16(dst + i * 2, color); + break; + default: + error("copyFrameToBuffer: Unknown dstType %d", dstType); + } + } + dst += pitch; + src += surface->pitch; + } while (--h); + } } else { dst += y * pitch + x; do { diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index 56f8de2ad1..65d34a4f2e 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -704,8 +704,8 @@ void ScummEngine_v99he::resetScummVars() { VAR(VAR_NUM_UNK) = _numUnk; if (_game.heversion >= 100 && (_game.features & GF_16BIT_COLOR)) { - // Disable Bink and Smacker video in 16bit color games - VAR(140) = 0; + // Enable Bink and Smacker video in 16bit color games + VAR(140) = 1; } } #endif -- cgit v1.2.3 From a50abde1b1228aa8364349728ad7f4f328d4a2f4 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 13 Jul 2011 12:08:26 -0400 Subject: BUILD: Allow for disabling Bink support --- engines/scumm/he/animation_he.cpp | 7 ++++++- engines/scumm/vars.cpp | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 7c1bbfc9a5..40e99c26a8 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -26,15 +26,20 @@ #include "scumm/he/intern_he.h" #include "audio/audiostream.h" -#include "video/bink_decoder.h" #include "video/smk_decoder.h" +#ifdef USE_BINK +#include "video/bink_decoder.h" +#endif + namespace Scumm { MoviePlayer::MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer) : _vm(vm) { +#ifdef USE_BINK if (_vm->_game.heversion >= 100 && (_vm->_game.features & GF_16BIT_COLOR)) _video = new Video::BinkDecoder(); else +#endif _video = new Video::SmackerDecoder(mixer); _flags = 0; diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index 65d34a4f2e..4527d7a121 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -704,8 +704,12 @@ void ScummEngine_v99he::resetScummVars() { VAR(VAR_NUM_UNK) = _numUnk; if (_game.heversion >= 100 && (_game.features & GF_16BIT_COLOR)) { - // Enable Bink and Smacker video in 16bit color games + // Enable Bink video in 16bit color games +#ifdef USE_BINK VAR(140) = 1; +#else + VAR(140) = 0; +#endif } } #endif -- cgit v1.2.3