diff options
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/coktelvideo.cpp | 38 | ||||
-rw-r--r-- | engines/gob/coktelvideo.h | 9 | ||||
-rw-r--r-- | engines/gob/init.cpp | 2 | ||||
-rw-r--r-- | engines/gob/scnplayer.cpp | 14 | ||||
-rw-r--r-- | engines/gob/scnplayer.h | 2 | ||||
-rw-r--r-- | engines/gob/video.h | 4 | ||||
-rw-r--r-- | engines/gob/video_v6.cpp | 21 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 7 | ||||
-rw-r--r-- | engines/gob/videoplayer.h | 2 |
9 files changed, 96 insertions, 3 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index 0ab3266111..1c19e4b513 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -949,6 +949,8 @@ bool Vmd::load(Common::SeekableReadStream &stream) { _frameDataSize = _stream->readUint32LE(); _vidBufferSize = _stream->readUint32LE(); + _doubleMode = false; + if ((_version & 2) && !(_version & 8)) { _externalCodec = true; _frameDataSize = _vidBufferSize = 0; @@ -1163,6 +1165,34 @@ void Vmd::setXY(int16 x, int16 y) { _y = y; } +void Vmd::setDoubleMode(bool doubleMode) { + if (_doubleMode == doubleMode) + return; + + if (_vidBuffer) { + delete[] _vidBuffer; + + if (doubleMode) + _vidBufferSize *= 4; + else + _vidBufferSize /= 4; + + _vidBuffer = new byte[_vidBufferSize]; + assert(_vidBuffer); + memset(_vidBuffer, 0, _vidBufferSize); + + } + + if (_codecIndeo3) { + delete _codecIndeo3; + + _codecIndeo3 = new Indeo3(_width * (doubleMode ? 2 : 1), + _height * (doubleMode ? 2 : 1), _palLUT); + } + + _doubleMode = doubleMode; +} + void Vmd::seekFrame(int32 frame, int16 whence, bool restart) { if (!_stream) // Nothing to do @@ -1222,6 +1252,7 @@ void Vmd::clear(bool del) { _soundStereo = 0; _externalCodec = false; + _doubleMode = false; _blitMode = 0; _bytesPerPixel = 1; _preScaleX = 1; @@ -1404,13 +1435,14 @@ uint32 Vmd::renderFrame(int16 &left, int16 &top, int16 &right, int16 &bottom) { if (!_codecIndeo3) return 0; - if (!_codecIndeo3->decompressFrame(dataPtr, dataLen, _vidBuffer, width, height)) + if (!_codecIndeo3->decompressFrame(dataPtr, dataLen, _vidBuffer, + width * (_doubleMode ? 2 : 1), height * (_doubleMode ? 2 : 1))) return 0; type = 2; srcPtr = _vidBuffer; - width = _width; - height = _height; + width = _width * (_doubleMode ? 2 : 1); + height = _height * (_doubleMode ? 2 : 1); right = left + width - 1; bottom = top + height - 1; diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h index a4da56b860..54a72f0623 100644 --- a/engines/gob/coktelvideo.h +++ b/engines/gob/coktelvideo.h @@ -145,6 +145,9 @@ public: /** Use an own memory block as video memory. */ virtual void setVideoMemory() = 0; + /** Double the video's resolution. */ + virtual void setDoubleMode(bool doubleMode) = 0; + /** Play sound (if the video has sound). */ virtual void enableSound(Audio::Mixer &mixer) = 0; /** Don't play sound or stop currently playing sound. */ @@ -226,6 +229,8 @@ public: void setVideoMemory(byte *vidMem, uint16 width, uint16 height); void setVideoMemory(); + void setDoubleMode(bool doubleMode) { } + void enableSound(Audio::Mixer &mixer); void disableSound(); @@ -319,6 +324,8 @@ public: void setXY(int16 x, int16 y); + void setDoubleMode(bool doubleMode); + void seekFrame(int32 frame, int16 whence = SEEK_SET, bool restart = false); State nextFrame(); @@ -376,6 +383,8 @@ protected: byte _scaleExternalX; byte *_vidMemBuffer; + bool _doubleMode; + Graphics::PaletteLUT *_palLUT; Indeo3 *_codecIndeo3; diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index d1a1ba2a24..93b141b1ce 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -97,6 +97,8 @@ void Init::initGame() { if (_vm->isSCNDemo()) { // This is a non-interactive demo with a SCN script and VMD videos + _vm->_video->setPrePalette(); + SCNPlayer scnPlayer(_vm); bool ret = scnPlayer.play(_vm->_startTot); diff --git a/engines/gob/scnplayer.cpp b/engines/gob/scnplayer.cpp index d889759a5d..b37f8f6fe5 100644 --- a/engines/gob/scnplayer.cpp +++ b/engines/gob/scnplayer.cpp @@ -27,6 +27,7 @@ #include "gob/gob.h" #include "gob/scnplayer.h" +#include "gob/global.h" #include "gob/util.h" #include "gob/draw.h" #include "gob/inter.h" @@ -35,6 +36,7 @@ namespace Gob { SCNPlayer::SCNPlayer(GobEngine *vm) : _vm(vm) { + _doubleMode = false; } SCNPlayer::~SCNPlayer() { @@ -77,6 +79,8 @@ bool SCNPlayer::play(Common::File &scn) { // Interpret if (line == "CLEAR") { clearScreen(); + } else if (lineStartsWith(line, "VIDEO:")) { + evaluateVideoMode(line.c_str() + 6); } else if (lineStartsWith(line, "IMD_PRELOAD ")) { playVideo(line.c_str() + 12); } else if (lineStartsWith(line, "IMD ")) { @@ -146,9 +150,19 @@ void SCNPlayer::playVideo(const char *fileName) { // Playing the video if (_vm->_vidPlayer->primaryOpen(fileName)) { + _vm->_vidPlayer->slotSetDoubleMode(-1, _doubleMode); _vm->_vidPlayer->primaryPlay(); _vm->_vidPlayer->primaryClose(); } } +void SCNPlayer::evaluateVideoMode(const char *mode) { + debugC(2, kDebugSCN, "Video mode \"%s\"", mode); + + if (!scumm_strnicmp(mode, "VESA", 4)) + _doubleMode = false; + else if (!scumm_strnicmp(mode, "VGA", 3) && _vm->is640()) + _doubleMode = true; +} + } // End of namespace Gob diff --git a/engines/gob/scnplayer.h b/engines/gob/scnplayer.h index b96b966fa4..4a7ac99447 100644 --- a/engines/gob/scnplayer.h +++ b/engines/gob/scnplayer.h @@ -45,6 +45,7 @@ private: typedef Common::HashMap<Common::String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> LabelMap; GobEngine *_vm; + bool _doubleMode; bool play(Common::File &scn); bool readLabels(Common::File &scn, LabelMap &labels); @@ -52,6 +53,7 @@ private: inline bool lineStartsWith(const Common::String &line, const char *start); void gotoLabel(Common::File &scn, const LabelMap &labels, const char *label); + void evaluateVideoMode(const char *mode); void clearScreen(); void playVideo(const char *fileName); }; diff --git a/engines/gob/video.h b/engines/gob/video.h index 4a729b127c..2d5cff8cd8 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -182,6 +182,8 @@ public: virtual void init(const char *target = "") { } + virtual void setPrePalette() { } + Video(class GobEngine *vm); virtual ~Video(); @@ -230,6 +232,8 @@ public: virtual void init(const char *target = ""); + virtual void setPrePalette(); + Video_v6(GobEngine *vm); virtual ~Video_v6() {} diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index 6cfe7be819..3ce445c79e 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -31,12 +31,33 @@ #include "gob/video.h" #include "gob/util.h" #include "gob/indeo3.h" +#include "gob/draw.h" +#include "gob/global.h" namespace Gob { Video_v6::Video_v6(GobEngine *vm) : Video_v2(vm) { } +void Video_v6::setPrePalette() { + byte *tpal = (byte *) _vm->_draw->_vgaPalette;; + const byte *fpal = (const byte *) _ditherPalette; + + for (int i = 0; i < 256; i++) { + byte r, g, b; + + Graphics::PaletteLUT::YUV2RGB(fpal[i * 3 + 0], fpal[i * 3 + 1], fpal[i * 3 + 2], + r, g, b); + + tpal[i * 3 + 0] = r >> 2; + tpal[i * 3 + 1] = g >> 2; + tpal[i * 3 + 2] = b >> 2; + } + _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); + +} + void Video_v6::init(const char *target) { initOSD(); diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 9f07b550be..ba34e675ec 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -466,6 +466,13 @@ bool VideoPlayer::slotIsOpen(int slot) const { return false; } +void VideoPlayer::slotSetDoubleMode(int slot, bool doubleMode) { + Video *video = getVideoBySlot(slot); + + if (video) + video->getVideo()->setDoubleMode(doubleMode); +} + const VideoPlayer::Video *VideoPlayer::getVideoBySlot(int slot) const { if (slot < 0) { if (_primaryVideo->isOpen()) diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index d7b55fa98f..61f264975a 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -72,6 +72,8 @@ public: void slotCopyPalette(int slot, int16 palStart = -1, int16 palEnd = -1); void slotWaitEndFrame(int slot, bool onlySound = false); + void slotSetDoubleMode(int slot, bool doubleMode); + bool slotIsOpen(int slot) const; uint16 getFlags(int slot = -1) const; |