[Scummvm-cvs-logs] SF.net SVN: scummvm: [31014] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Feb 29 23:24:53 CET 2008


Revision: 31014
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31014&view=rev
Author:   drmccoy
Date:     2008-02-29 14:24:52 -0800 (Fri, 29 Feb 2008)

Log Message:
-----------
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

Modified Paths:
--------------
    scummvm/trunk/engines/gob/coktelvideo.cpp
    scummvm/trunk/engines/gob/coktelvideo.h
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/util.h
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/engines/gob/videoplayer.h

Modified: scummvm/trunk/engines/gob/coktelvideo.cpp
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.cpp	2008-02-29 22:16:09 UTC (rev 31013)
+++ scummvm/trunk/engines/gob/coktelvideo.cpp	2008-02-29 22:24:52 UTC (rev 31014)
@@ -131,7 +131,7 @@
 
 		_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 @@
 	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 @@
 
 	_audioStream = 0;
 
+	_frameRate = 12;
 	_frameLength = 0;
 	_lastFrameTime = 0;
 }
@@ -927,7 +936,7 @@
 		_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();
 

Modified: scummvm/trunk/engines/gob/coktelvideo.h
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.h	2008-02-29 22:16:09 UTC (rev 31013)
+++ scummvm/trunk/engines/gob/coktelvideo.h	2008-02-29 22:24:52 UTC (rev 31014)
@@ -118,6 +118,9 @@
 	/** 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 @@
 	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 @@
 	Audio::AppendableAudioStream *_audioStream;
 	Audio::SoundHandle _audioHandle;
 
+	int16 _frameRate;
 	uint32 _frameLength;
 	uint32 _lastFrameTime;
 

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2008-02-29 22:16:09 UTC (rev 31013)
+++ scummvm/trunk/engines/gob/util.cpp	2008-02-29 22:24:52 UTC (rev 31014)
@@ -42,6 +42,7 @@
 	_keyBufferHead = 0;
 	_keyBufferTail = 0;
 	_fastMode = 0;
+	_frameRate = 12;
 }
 
 uint32 Util::getTimeKey(void) {
@@ -297,10 +298,15 @@
 		_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();
 }

Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h	2008-02-29 22:16:09 UTC (rev 31013)
+++ scummvm/trunk/engines/gob/util.h	2008-02-29 22:24:52 UTC (rev 31014)
@@ -71,6 +71,7 @@
 	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 @@
 
 	uint8 _fastMode;
 
+	int16 _frameRate;
+
 	GobEngine *_vm;
 
 	bool keyBufferEmpty();

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2008-02-29 22:16:09 UTC (rev 31013)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2008-02-29 22:24:52 UTC (rev 31014)
@@ -42,6 +42,8 @@
 	_stream = 0;
 	_video = 0;
 	_backSurf = false;
+	_needBlit = false;
+	_noCursorSwitch = false;
 }
 
 VideoPlayer::~VideoPlayer() {
@@ -138,6 +140,19 @@
 			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 @@
 		} 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 @@
 			_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,10 +265,16 @@
 		_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)
 			_vm->_draw->forceBlit();

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2008-02-29 22:16:09 UTC (rev 31013)
+++ scummvm/trunk/engines/gob/videoplayer.h	2008-02-29 22:24:52 UTC (rev 31014)
@@ -37,6 +37,7 @@
 public:
 	enum Flags {
 		kFlagNone = 0,
+		kFlagUseBackSurfaceContent = 0x40,
 		kFlagFrontSurface = 0x80,
 		kFlagNoVideo = 0x100
 	};
@@ -74,6 +75,8 @@
 	DataStream *_stream;
 	CoktelVideo *_video;
 	bool _backSurf;
+	bool _needBlit;
+	bool _noCursorSwitch;
 
 	void copyPalette(int16 palStart = -1, int16 palEnd = -1);
 	bool doPlay(int16 frame, int16 breakKey,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list