aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2008-02-29 22:24:52 +0000
committerSven Hesse2008-02-29 22:24:52 +0000
commit5878f701c103cf792db6b5454688dca0c3379477 (patch)
tree23e518f81aeebe6ba2c34ba7aaffd8e7bed38cf8 /engines
parenta47e5aa5f57055bb399382f7a30811f0a8629f92 (diff)
downloadscummvm-rg350-5878f701c103cf792db6b5454688dca0c3379477.tar.gz
scummvm-rg350-5878f701c103cf792db6b5454688dca0c3379477.tar.bz2
scummvm-rg350-5878f701c103cf792db6b5454688dca0c3379477.zip
Fixed some Lost in Time bugs:
- CD cutscenes are drawn correctly know - CD cutscenes are (more) correctly synced now - The cursor doesn't flicker anymore when a video is played in the background svn-id: r31014
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/coktelvideo.cpp13
-rw-r--r--engines/gob/coktelvideo.h8
-rw-r--r--engines/gob/util.cpp6
-rw-r--r--engines/gob/util.h3
-rw-r--r--engines/gob/videoplayer.cpp27
-rw-r--r--engines/gob/videoplayer.h3
6 files changed, 55 insertions, 5 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp
index 6e8c8d9efd..1668a123be 100644
--- a/engines/gob/coktelvideo.cpp
+++ b/engines/gob/coktelvideo.cpp
@@ -131,7 +131,7 @@ bool Imd::load(Common::SeekableReadStream &stream) {
_audioStream = Audio::makeAppendableAudioStream(_soundFreq, 0);
} else
- _frameLength = 1000 / 12; // 12 FPS for a video without sound
+ _frameLength = 1000 / _frameRate;
// Sizes of the frame data and extra video buffer
if (_features & kFeaturesDataSize) {
@@ -185,6 +185,14 @@ void Imd::unload() {
clear();
}
+void Imd::setFrameRate(int16 frameRate) {
+ if (frameRate == 0)
+ frameRate = 1;
+
+ _frameRate = frameRate;
+ _frameLength = 1000 / _frameRate;
+}
+
void Imd::setXY(int16 x, int16 y) {
// Adjusting the standard coordinates
if (_stdX != -1) {
@@ -426,6 +434,7 @@ void Imd::clear(bool del) {
_audioStream = 0;
+ _frameRate = 12;
_frameLength = 0;
_lastFrameTime = 0;
}
@@ -927,7 +936,7 @@ bool Vmd::load(Common::SeekableReadStream &stream) {
_audioStream = Audio::makeAppendableAudioStream(_soundFreq,
(_soundBytesPerSample == 2) ? Audio::Mixer::FLAG_16BITS : 0);
} else
- _frameLength = 1000 / 12; // 12 FPS for a video without sound
+ _frameLength = 1000 / _frameRate;
uint32 frameInfoOffset = _stream->readUint32LE();
diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h
index 2b67f649f6..29a5c8896a 100644
--- a/engines/gob/coktelvideo.h
+++ b/engines/gob/coktelvideo.h
@@ -118,6 +118,9 @@ public:
/** Unload the currently loaded video. */
virtual void unload() = 0;
+ /** Set the frame rate. */
+ virtual void setFrameRate(int16 frameRate) = 0;
+
/** Set the coordinations where to draw the video. */
virtual void setXY(int16 x, int16 y) = 0;
/** Use a specific memory block as video memory. */
@@ -168,10 +171,12 @@ public:
int16 getHeight() const { return _height; }
uint16 getFramesCount() const { return _framesCount; }
uint16 getCurrentFrame() const { return _curFrame; }
- int16 getFrameRate() const { if (_hasSound) return 1000 / _soundSliceLength; return 12; }
+ int16 getFrameRate() const { if (_hasSound) return 1000 / _soundSliceLength; return _frameRate; }
uint32 getSyncLag() const { return _skipFrames; }
const byte *getPalette() const { return _palette; }
+ void setFrameRate(int16 frameRate);
+
bool load(Common::SeekableReadStream &stream);
void unload();
@@ -232,6 +237,7 @@ protected:
Audio::AppendableAudioStream *_audioStream;
Audio::SoundHandle _audioHandle;
+ int16 _frameRate;
uint32 _frameLength;
uint32 _lastFrameTime;
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 93ec42c7ac..6ca694c11a 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -42,6 +42,7 @@ Util::Util(GobEngine *vm) : _vm(vm) {
_keyBufferHead = 0;
_keyBufferTail = 0;
_fastMode = 0;
+ _frameRate = 12;
}
uint32 Util::getTimeKey(void) {
@@ -297,10 +298,15 @@ void Util::clearPalette(void) {
_vm->_video->setPalElem(i, 0, 0, 0, 0, _vm->_global->_videoMode);
}
+int16 Util::getFrameRate() {
+ return _frameRate;
+}
+
void Util::setFrameRate(int16 rate) {
if (rate == 0)
rate = 1;
+ _frameRate = rate;
_vm->_global->_frameWaitTime = 1000 / rate;
_vm->_global->_startFrameTime = getTimeKey();
}
diff --git a/engines/gob/util.h b/engines/gob/util.h
index 5961798e8f..39ef16ceca 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -71,6 +71,7 @@ public:
void forceMouseUp(bool onlyWhenSynced = false);
void clearPalette(void);
+ int16 getFrameRate();
void setFrameRate(int16 rate);
void waitEndFrame();
void setScrollOffset(int16 x = -1, int16 y = -1);
@@ -98,6 +99,8 @@ protected:
uint8 _fastMode;
+ int16 _frameRate;
+
GobEngine *_vm;
bool keyBufferEmpty();
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index dda6e24017..24ef145581 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -42,6 +42,8 @@ VideoPlayer::VideoPlayer(GobEngine *vm) : _vm(vm) {
_stream = 0;
_video = 0;
_backSurf = false;
+ _needBlit = false;
+ _noCursorSwitch = false;
}
VideoPlayer::~VideoPlayer() {
@@ -138,6 +140,19 @@ bool VideoPlayer::openVideo(const char *video, int16 x, int16 y, int16 flags, Ty
return false;
}
+ // WORKAROUND: In some rare cases, the cursor should still be
+ // displayed while a video is playing.
+ _noCursorSwitch = false;
+ if (_vm->getGameType() == kGameTypeLostInTime) {
+ if (!scumm_stricmp(fileName, "PORTA03.IMD") ||
+ !scumm_stricmp(fileName, "PORTA03A.IMD") ||
+ !scumm_stricmp(fileName, "CALE1.IMD") ||
+ !scumm_stricmp(fileName, "AMIL2.IMD") ||
+ !scumm_stricmp(fileName, "AMIL3B.IMD") ||
+ !scumm_stricmp(fileName, "DELB.IMD"))
+ _noCursorSwitch = true;
+ }
+
strcpy(_curFile, fileName);
if (!(flags & kFlagNoVideo)) {
@@ -147,12 +162,15 @@ bool VideoPlayer::openVideo(const char *video, int16 x, int16 y, int16 flags, Ty
} else
_video->setVideoMemory();
+ _needBlit = (flags & kFlagUseBackSurfaceContent) != 0;
+
_video->enableSound(*_vm->_mixer);
}
if (!_video)
return false;
+ _video->setFrameRate(_vm->_util->getFrameRate());
_video->setXY(x, y);
WRITE_VAR(7, _video->getFramesCount());
@@ -184,8 +202,7 @@ void VideoPlayer::play(int16 startFrame, int16 lastFrame, int16 breakKey,
_video->seekFrame(startFrame);
}
- _vm->_draw->_showCursor = 0;
- _vm->_util->setFrameRate(12);
+ _vm->_draw->_showCursor = _noCursorSwitch ? 3 : 0;
if (fade)
_vm->_palAnim->fade(0, -2, 0);
@@ -248,9 +265,15 @@ bool VideoPlayer::doPlay(int16 frame, int16 breakKey,
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+ if (_needBlit)
+ _vm->_draw->forceBlit();
+
CoktelVideo::State state = _video->nextFrame();
WRITE_VAR(11, frame);
+ if (_needBlit)
+ _vm->_draw->forceBlit(true);
+
if (modifiedPal && (palCmd == 16)) {
if (_backSurf)
diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h
index 9a61fe6fd8..7b9a3ca687 100644
--- a/engines/gob/videoplayer.h
+++ b/engines/gob/videoplayer.h
@@ -37,6 +37,7 @@ class VideoPlayer {
public:
enum Flags {
kFlagNone = 0,
+ kFlagUseBackSurfaceContent = 0x40,
kFlagFrontSurface = 0x80,
kFlagNoVideo = 0x100
};
@@ -74,6 +75,8 @@ private:
DataStream *_stream;
CoktelVideo *_video;
bool _backSurf;
+ bool _needBlit;
+ bool _noCursorSwitch;
void copyPalette(int16 palStart = -1, int16 palEnd = -1);
bool doPlay(int16 frame, int16 breakKey,