diff options
author | Filippos Karapetis | 2012-06-23 21:00:25 +0300 |
---|---|---|
committer | Filippos Karapetis | 2012-06-23 21:45:18 +0300 |
commit | f06eb05e8c554a3462a98d18c04d5f5695074b26 (patch) | |
tree | 28842c460128d7832a348747c4cfcd820d9572ea /engines | |
parent | a6b65b84b040293e1bc6ed24a3ccdf5fde169bec (diff) | |
download | scummvm-rg350-f06eb05e8c554a3462a98d18c04d5f5695074b26.tar.gz scummvm-rg350-f06eb05e8c554a3462a98d18c04d5f5695074b26.tar.bz2 scummvm-rg350-f06eb05e8c554a3462a98d18c04d5f5695074b26.zip |
SCI: Implement kPlayVMD subop 23 (set palette range)
Fixes the wrong palette during video sequences in GK2 and the demo of RAMA
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kvideo.cpp | 18 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 1 |
3 files changed, 17 insertions, 4 deletions
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index dd2bca1922..2456ba1100 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -32,6 +32,7 @@ #include "common/str.h" #include "common/system.h" #include "common/textconsole.h" +#include "graphics/palette.h" #include "graphics/pixelformat.h" #include "graphics/surface.h" #include "video/video_decoder.h" @@ -86,9 +87,12 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) { } bool skipVideo = false; + EngineState *s = g_sci->getEngineState(); - if (videoDecoder->hasDirtyPalette()) - videoDecoder->setSystemPalette(); + if (videoDecoder->hasDirtyPalette()) { + byte *palette = (byte *)videoDecoder->getPalette() + s->_vmdPalStart * 3; + g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart); + } while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { if (videoDecoder->needsUpdate()) { @@ -103,8 +107,10 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) { g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, width, height); } - if (videoDecoder->hasDirtyPalette()) - videoDecoder->setSystemPalette(); + if (videoDecoder->hasDirtyPalette()) { + byte *palette = (byte *)videoDecoder->getPalette() + s->_vmdPalStart * 3; + g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart); + } g_system->updateScreen(); } @@ -361,6 +367,10 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) { if (reshowCursor) g_sci->_gfxCursor->kernelShow(); break; + case 23: // set video palette range + s->_vmdPalStart = argv[1].toUint16(); + s->_vmdPalEnd = argv[2].toUint16(); + break; case 14: // Takes an additional integer parameter (e.g. 3) case 16: diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 237c6b54a6..94a3fe3ae5 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -122,6 +122,8 @@ void EngineState::reset(bool isRestoring) { _videoState.reset(); _syncedAudioOptions = false; + _vmdPalStart = 0; + _vmdPalEnd = 256; } void EngineState::speedThrottler(uint32 neededSleep) { diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 78a8a5b0a2..9ae6299d83 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -196,6 +196,7 @@ public: byte _memorySegment[kMemorySegmentMax]; VideoState _videoState; + uint16 _vmdPalStart, _vmdPalEnd; bool _syncedAudioOptions; /** |