[Scummvm-cvs-logs] SF.net SVN: scummvm: [21977] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Apr 17 06:20:07 CEST 2006


Revision: 21977
Author:   kirben
Date:     2006-04-17 06:19:36 -0700 (Mon, 17 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21977&view=rev

Log Message:
-----------
Adjust video playback code, due to false calls in prison of FF

Modified Paths:
--------------
    scummvm/trunk/engines/simon/animation.cpp
    scummvm/trunk/engines/simon/animation.h
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/animation.cpp
===================================================================
--- scummvm/trunk/engines/simon/animation.cpp	2006-04-17 12:46:20 UTC (rev 21976)
+++ scummvm/trunk/engines/simon/animation.cpp	2006-04-17 13:19:36 UTC (rev 21977)
@@ -45,7 +45,7 @@
 MoviePlayer::~MoviePlayer() {
 }
 
-bool MoviePlayer::open(const char *filename) {
+bool MoviePlayer::load(const char *filename) {
 	char filename2[100];
 	uint32 tag;
 
@@ -60,13 +60,6 @@
 	if (_fd.open(filename2) == false)
 		return false;
 
-	_mixer->stopAll();
-
-	_currentFrame = 0;
-
-	_leftButtonDown = false;
-	_rightButtonDown = false;
-
 	tag = _fd.readUint32BE();
 	assert(tag == MKID_BE('DEXA'));
 
@@ -86,6 +79,24 @@
 		error("error allocating frame tables, size %d\n", _frameSize);
 	}
 
+	return true;
+}
+
+void MoviePlayer::play() {
+	uint32 tag;
+
+	if (_fd.isOpen() == false) {
+		debug(0, "MoviePlayer::play: No file loaded");
+		return;
+	}
+
+	_mixer->stopAll();
+
+	_currentFrame = 0;
+
+	_leftButtonDown = false;
+	_rightButtonDown = false;
+
 	tag = _fd.readUint32BE();
 	assert(tag == MKID_BE('WAVE'));
 
@@ -102,7 +113,11 @@
 	if (_width != 640 && _height != 480)
 		g_system->clearScreen();
 
-	play();
+	while (_currentFrame < _framesCount) {
+		handleNextFrame();
+		++_currentFrame;
+	}
+
 	close();
 
 	_vm->o_killAnimate();
@@ -112,8 +127,6 @@
 	} else {
 		g_system->clearScreen();
 	}
-
-	return true;
 }
 
 void MoviePlayer::close() {
@@ -122,13 +135,6 @@
 	free(_frameBuffer2);
 }
 
-void MoviePlayer::play() {
-	while (_currentFrame < _framesCount) {
-		handleNextFrame();
-		++_currentFrame;
-	}
-}
-
 void MoviePlayer::handleNextFrame() {
 	uint32 tag = _fd.readUint32BE();
 	if (tag == MKID_BE('CMAP')) {

Modified: scummvm/trunk/engines/simon/animation.h
===================================================================
--- scummvm/trunk/engines/simon/animation.h	2006-04-17 12:46:20 UTC (rev 21976)
+++ scummvm/trunk/engines/simon/animation.h	2006-04-17 13:19:36 UTC (rev 21977)
@@ -54,9 +54,9 @@
 	MoviePlayer(SimonEngine *vm, Audio::Mixer *mixer);
 	~MoviePlayer();
 
-	bool open(const char *filename);
+	bool load(const char *filename);
+	void play();
 private:
-	void play();
 	void close();
 
 	void delay(uint amount);

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-17 12:46:20 UTC (rev 21976)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-17 13:19:36 UTC (rev 21977)
@@ -332,8 +332,8 @@
 		opcode_table[172] = &SimonEngine::o3_hyperLinkOff;
 		opcode_table[173] = &SimonEngine::o3_checkPaths;
 		opcode_table[181] = &SimonEngine::o3_mouseOff;
-		opcode_table[182] = &SimonEngine::o3_loadSmack;
-		opcode_table[183] = &SimonEngine::o3_playSmack;
+		opcode_table[182] = &SimonEngine::o3_loadVideo;
+		opcode_table[183] = &SimonEngine::o3_playVideo;
 		opcode_table[187] = &SimonEngine::o3_centreScroll;
 		opcode_table[188] = &SimonEngine::o2_isShortText;
 		opcode_table[189] = &SimonEngine::o2_clearMarks;
@@ -1923,16 +1923,19 @@
 	clearName();
 }
 
-void SimonEngine::o3_loadSmack() {
+void SimonEngine::o3_loadVideo() {
 	// 182: load video file
-	_videoName = getStringPtrByID(getNextStringID());
+	const byte *filename = getStringPtrByID(getNextStringID());
+	debug(0, "Load video %s", filename);
+
+	if (_moviePlay->load((const char *)filename) == false)
+		warning("Failed to load video file %s", filename);
 }
 
-void SimonEngine::o3_playSmack() {
+void SimonEngine::o3_playVideo() {
 	// 183: play video
-	debug(0, "Play video %s", _videoName);
-
-	_moviePlay->open((const char *)_videoName);
+	debug(0, "Play video");
+	_moviePlay->play();
 }
 
 void SimonEngine::o3_centreScroll() {

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-17 12:46:20 UTC (rev 21976)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-17 13:19:36 UTC (rev 21977)
@@ -194,7 +194,6 @@
 	_tblList = 0;
 
 	_codePtr = 0;
-	_videoName = 0;
 
 	_localStringtable = 0;
 	_stringIdLocalMin = 1;

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-17 12:46:20 UTC (rev 21976)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-17 13:19:36 UTC (rev 21977)
@@ -208,7 +208,6 @@
 	byte *_tblList;
 
 	const byte *_codePtr;
-	const byte *_videoName;
 
 	byte **_localStringtable;
 	uint _stringIdLocalMin, _stringIdLocalMax;
@@ -980,8 +979,8 @@
 	void o3_hyperLinkOff();
 	void o3_checkPaths();
 	void o3_mouseOff();
-	void o3_loadSmack();
-	void o3_playSmack();
+	void o3_loadVideo();
+	void o3_playVideo();
 	void o3_centreScroll();
 	void o3_resetPVCount();
 	void o3_setPathValues();


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