aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/detection.cpp21
-rw-r--r--engines/scumm/he/animation_he.cpp128
-rw-r--r--engines/scumm/he/animation_he.h35
-rw-r--r--engines/scumm/he/script_v100he.cpp2
-rw-r--r--engines/scumm/he/script_v60he.cpp12
-rw-r--r--engines/scumm/he/script_v90he.cpp2
-rw-r--r--engines/scumm/vars.cpp6
7 files changed, 140 insertions, 66 deletions
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);
}
}
diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp
index 74183c24d3..40e99c26a8 100644
--- a/engines/scumm/he/animation_he.cpp
+++ b/engines/scumm/he/animation_he.cpp
@@ -26,27 +26,42 @@
#include "scumm/he/intern_he.h"
#include "audio/audiostream.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)
- : SmackerDecoder(mixer), _vm(vm), _mixer(mixer) {
+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;
_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 +69,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,34 +77,59 @@ 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 = _video->decodeNextFrame();
+
+ if (!surface)
+ return;
- const Graphics::Surface *surface = 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;
- 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 {
@@ -101,7 +141,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 +155,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_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
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();
diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp
index 56f8de2ad1..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)) {
- // Disable 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