aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-07-02 16:37:41 -0400
committerMatthew Hoops2011-07-02 16:37:41 -0400
commit9374215789fcfa3ee34f256d819eaa91aa08b04f (patch)
tree71e35ec7e807dfb9a08b60b31100d545167ef48c
parentfffe7a9cc06cd03b8a7efbe6e75e3fc1a14c38ba (diff)
downloadscummvm-rg350-9374215789fcfa3ee34f256d819eaa91aa08b04f.tar.gz
scummvm-rg350-9374215789fcfa3ee34f256d819eaa91aa08b04f.tar.bz2
scummvm-rg350-9374215789fcfa3ee34f256d819eaa91aa08b04f.zip
SCUMM: Add support for Bink video
-rw-r--r--engines/scumm/he/animation_he.cpp66
-rw-r--r--engines/scumm/vars.cpp4
2 files changed, 50 insertions, 20 deletions
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