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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Apr 24 23:30:40 CEST 2009


Revision: 40128
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40128&view=rev
Author:   drmccoy
Date:     2009-04-24 21:30:40 +0000 (Fri, 24 Apr 2009)

Log Message:
-----------
The video now works correctly in the non-interactive Urban Runner demo

Modified Paths:
--------------
    scummvm/trunk/engines/gob/coktelvideo.cpp
    scummvm/trunk/engines/gob/coktelvideo.h
    scummvm/trunk/engines/gob/init.cpp
    scummvm/trunk/engines/gob/scnplayer.cpp
    scummvm/trunk/engines/gob/scnplayer.h
    scummvm/trunk/engines/gob/video.h
    scummvm/trunk/engines/gob/video_v6.cpp
    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	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/coktelvideo.cpp	2009-04-24 21:30:40 UTC (rev 40128)
@@ -949,6 +949,8 @@
 	_frameDataSize = _stream->readUint32LE();
 	_vidBufferSize = _stream->readUint32LE();
 
+	_doubleMode = false;
+
 	if ((_version & 2) && !(_version & 8)) {
 		_externalCodec = true;
 		_frameDataSize = _vidBufferSize = 0;
@@ -1163,6 +1165,34 @@
 		_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 @@
 	_soundStereo = 0;
 
 	_externalCodec = false;
+	_doubleMode = false;
 	_blitMode = 0;
 	_bytesPerPixel = 1;
 	_preScaleX = 1;
@@ -1404,13 +1435,14 @@
 		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;
 

Modified: scummvm/trunk/engines/gob/coktelvideo.h
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.h	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/coktelvideo.h	2009-04-24 21:30:40 UTC (rev 40128)
@@ -145,6 +145,9 @@
 	/** 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 @@
 	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 @@
 
 	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 @@
 	byte _scaleExternalX;
 	byte *_vidMemBuffer;
 
+	bool _doubleMode;
+
 	Graphics::PaletteLUT *_palLUT;
 	Indeo3 *_codecIndeo3;
 

Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/init.cpp	2009-04-24 21:30:40 UTC (rev 40128)
@@ -97,6 +97,8 @@
 	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);

Modified: scummvm/trunk/engines/gob/scnplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/scnplayer.cpp	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/scnplayer.cpp	2009-04-24 21:30:40 UTC (rev 40128)
@@ -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 @@
 		// 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 @@
 
 	// 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

Modified: scummvm/trunk/engines/gob/scnplayer.h
===================================================================
--- scummvm/trunk/engines/gob/scnplayer.h	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/scnplayer.h	2009-04-24 21:30:40 UTC (rev 40128)
@@ -45,6 +45,7 @@
 	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 @@
 	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);
 };

Modified: scummvm/trunk/engines/gob/video.h
===================================================================
--- scummvm/trunk/engines/gob/video.h	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/video.h	2009-04-24 21:30:40 UTC (rev 40128)
@@ -182,6 +182,8 @@
 
 	virtual void init(const char *target = "") { }
 
+	virtual void setPrePalette() { }
+
 	Video(class GobEngine *vm);
 	virtual ~Video();
 
@@ -230,6 +232,8 @@
 
 	virtual void init(const char *target = "");
 
+	virtual void setPrePalette();
+
 	Video_v6(GobEngine *vm);
 	virtual ~Video_v6() {}
 

Modified: scummvm/trunk/engines/gob/video_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/video_v6.cpp	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/video_v6.cpp	2009-04-24 21:30:40 UTC (rev 40128)
@@ -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();
 

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2009-04-24 21:30:40 UTC (rev 40128)
@@ -466,6 +466,13 @@
 	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())

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2009-04-24 20:09:52 UTC (rev 40127)
+++ scummvm/trunk/engines/gob/videoplayer.h	2009-04-24 21:30:40 UTC (rev 40128)
@@ -72,6 +72,8 @@
 	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;


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