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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Dec 14 04:08:02 CET 2008


Revision: 35351
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35351&view=rev
Author:   drmccoy
Date:     2008-12-14 03:08:02 +0000 (Sun, 14 Dec 2008)

Log Message:
-----------
Music/Video handling fixes/stubs

Modified Paths:
--------------
    scummvm/trunk/engines/gob/game_v6.cpp
    scummvm/trunk/engines/gob/inter.h
    scummvm/trunk/engines/gob/inter_v6.cpp
    scummvm/trunk/engines/gob/sound/sound.cpp
    scummvm/trunk/engines/gob/sound/sound.h
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/engines/gob/videoplayer.h

Modified: scummvm/trunk/engines/gob/game_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v6.cpp	2008-12-14 02:09:03 UTC (rev 35350)
+++ scummvm/trunk/engines/gob/game_v6.cpp	2008-12-14 03:08:02 UTC (rev 35351)
@@ -93,6 +93,9 @@
 			size++;
 	}
 
+	if (_collStackSize >= 5)
+		error("Game_v6::pushCollisions: _collStackSize == %d", _collStackSize);
+
 	destPtr = new Collision[size];
 	_collStack[_collStackSize] = destPtr;
 

Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h	2008-12-14 02:09:03 UTC (rev 35350)
+++ scummvm/trunk/engines/gob/inter.h	2008-12-14 03:08:02 UTC (rev 35351)
@@ -624,6 +624,8 @@
 	virtual const char *getOpcodeFuncDesc(byte i, byte j);
 	virtual const char *getOpcodeGoblinDesc(int i);
 
+	void o6_playVmdOrMusic();
+
 	bool o6_loadCursor(OpFuncParams &params);
 	bool o6_evaluateStore(OpFuncParams &params);
 	bool o6_palLoad(OpFuncParams &params);

Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp	2008-12-14 02:09:03 UTC (rev 35350)
+++ scummvm/trunk/engines/gob/inter_v6.cpp	2008-12-14 03:08:02 UTC (rev 35351)
@@ -32,6 +32,8 @@
 #include "gob/game.h"
 #include "gob/parse.h"
 #include "gob/draw.h"
+#include "gob/sound/sound.h"
+#include "gob/videoplayer.h"
 #include "gob/indeo3.h"
 
 namespace Gob {
@@ -214,7 +216,7 @@
 		OPCODE(o5_initScreen),
 		OPCODE(o2_scroll),
 		OPCODE(o2_setScrollOffset),
-		OPCODE(o4_playVmdOrMusic),
+		OPCODE(o6_playVmdOrMusic),
 		/* 84 */
 		OPCODE(o2_getImdInfo),
 		OPCODE(o2_openItk),
@@ -651,6 +653,75 @@
 	return "";
 }
 
+void Inter_v6::o6_playVmdOrMusic() {
+	char fileName[128];
+	int16 x, y;
+	int16 startFrame;
+	int16 lastFrame;
+	int16 breakKey;
+	int16 flags;
+	int16 palStart;
+	int16 palEnd;
+	uint16 palCmd;
+	bool close;
+
+	evalExpr(0);
+	strncpy0(fileName, _vm->_global->_inter_resStr, 127);
+
+	x = _vm->_parse->parseValExpr();
+	y = _vm->_parse->parseValExpr();
+	startFrame = _vm->_parse->parseValExpr();
+	lastFrame = _vm->_parse->parseValExpr();
+	breakKey = _vm->_parse->parseValExpr();
+	flags = _vm->_parse->parseValExpr();
+	palStart = _vm->_parse->parseValExpr();
+	palEnd = _vm->_parse->parseValExpr();
+	palCmd = 1 << (flags & 0x3F);
+
+	debugC(1, kDebugVideo, "Playing video \"%s\" @ %d+%d, frames %d - %d, "
+			"paletteCmd %d (%d - %d), flags %X", fileName, x, y, startFrame, lastFrame,
+			palCmd, palStart, palEnd, flags);
+
+	close = false;
+	if (lastFrame == -1) {
+		close = true;
+	} else if (lastFrame == -5) {
+		warning("Urban Stub: Stopping background music \"%s\"", fileName);
+		return;
+	} else if (lastFrame == -9) {
+		warning("Urban Stub: Starting background music \"%s\"", fileName);
+		return;
+	} else if (lastFrame == -10) {
+		_vm->_vidPlayer->primaryClose();
+		warning("Urban Stub: Video/Music command -10 (close video?)");
+		return;
+	} else if (lastFrame < 0) {
+		warning("Unknown Video/Music command: %d, %s", lastFrame, fileName);
+		return;
+	}
+
+	if (startFrame == -2) {
+		startFrame = 0;
+		lastFrame = -1;
+		close = false;
+	}
+
+	if ((fileName[0] != 0) && !_vm->_vidPlayer->primaryOpen(fileName, x, y, flags)) {
+		WRITE_VAR(11, (uint32) -1);
+		return;
+	}
+
+	if (startFrame >= 0) {
+		_vm->_game->_preventScroll = true;
+		_vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey,
+				palCmd, palStart, palEnd, 0, -1, false, -1, true);
+		_vm->_game->_preventScroll = false;
+	}
+
+	if (close)
+		_vm->_vidPlayer->primaryClose();
+}
+
 bool Inter_v6::o6_loadCursor(OpFuncParams &params) {
 	int16 width, height;
 	byte *dataBuf;

Modified: scummvm/trunk/engines/gob/sound/sound.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/sound.cpp	2008-12-14 02:09:03 UTC (rev 35350)
+++ scummvm/trunk/engines/gob/sound/sound.cpp	2008-12-14 03:08:02 UTC (rev 35351)
@@ -520,6 +520,25 @@
 	_cdrom->testCD(trySubst, label);
 }
 
+void Sound::bgPlay(const char *file) {
+	if (!_bgatmos)
+		return;
+
+	debugC(1, kDebugSound, "BackgroundAtmosphere: Playing \"%s\"", file);
+
+	_bgatmos->stop();
+	_bgatmos->queueClear();
+
+	SoundDesc *sndDesc = new SoundDesc;
+	if (!sampleLoad(sndDesc, file)) {
+		delete sndDesc;
+		return;
+	}
+
+	_bgatmos->queueSample(*sndDesc);
+	_bgatmos->play();
+}
+
 void Sound::bgPlay(const char *base, int count) {
 	if (!_bgatmos)
 		return;
@@ -539,6 +558,8 @@
 		sndDesc = new SoundDesc;
 		if (sampleLoad(sndDesc, fileName))
 			_bgatmos->queueSample(*sndDesc);
+		else
+			delete sndDesc;
 	}
 
 	_bgatmos->play();

Modified: scummvm/trunk/engines/gob/sound/sound.h
===================================================================
--- scummvm/trunk/engines/gob/sound/sound.h	2008-12-14 02:09:03 UTC (rev 35350)
+++ scummvm/trunk/engines/gob/sound/sound.h	2008-12-14 03:08:02 UTC (rev 35351)
@@ -121,6 +121,7 @@
 
 
 	// Background Atmosphere
+	void bgPlay(const char *file);
 	void bgPlay(const char *base, int count);
 	void bgStop();
 

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2008-12-14 02:09:03 UTC (rev 35350)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2008-12-14 03:08:02 UTC (rev 35351)
@@ -271,7 +271,7 @@
 
 void VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey,
 		uint16 palCmd, int16 palStart, int16 palEnd,
-		int16 palFrame, int16 endFrame, bool fade, int16 reverseTo) {
+		int16 palFrame, int16 endFrame, bool fade, int16 reverseTo, bool forceSeek) {
 
 	if (!_primaryVideo->isOpen())
 		return;
@@ -290,7 +290,7 @@
 	palCmd &= 0x3F;
 
 	if (video.getCurrentFrame() != startFrame) {
-		if (video.getFeatures() & CoktelVideo::kFeaturesSound)
+		if (!forceSeek && (video.getFeatures() & CoktelVideo::kFeaturesSound))
 			startFrame = video.getCurrentFrame();
 		else
 			video.seekFrame(startFrame);

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2008-12-14 02:09:03 UTC (rev 35350)
+++ scummvm/trunk/engines/gob/videoplayer.h	2008-12-14 03:08:02 UTC (rev 35351)
@@ -58,7 +58,7 @@
 	void primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, int16 breakKey = 27,
 			uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255,
 			int16 palFrame = -1, int16 endFrame = -1, bool fade = false,
-			int16 reverseTo = -1);
+			int16 reverseTo = -1, bool forceSeek = false);
 	void primaryClose();
 
 	int slotOpen(const char *videoFile, Type which = kVideoTypeTry);


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