[Scummvm-cvs-logs] SF.net SVN: scummvm:[45151] scummvm/trunk

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Oct 16 09:42:23 CEST 2009


Revision: 45151
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45151&view=rev
Author:   thebluegr
Date:     2009-10-16 07:42:23 +0000 (Fri, 16 Oct 2009)

Log Message:
-----------
Added a new convenience method to the video player, which adds the event of skipping videos with the escape key by default, thereby simplifying the video playing code in all places where it's used

Modified Paths:
--------------
    scummvm/trunk/engines/saga/introproc_saga2.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sword1/animation.cpp
    scummvm/trunk/engines/sword2/animation.cpp
    scummvm/trunk/graphics/video/video_player.cpp
    scummvm/trunk/graphics/video/video_player.h

Modified: scummvm/trunk/engines/saga/introproc_saga2.cpp
===================================================================
--- scummvm/trunk/engines/saga/introproc_saga2.cpp	2009-10-16 07:37:12 UTC (rev 45150)
+++ scummvm/trunk/engines/saga/introproc_saga2.cpp	2009-10-16 07:42:23 UTC (rev 45151)
@@ -35,27 +35,15 @@
 #include "graphics/surface.h"
 #include "graphics/video/smk_decoder.h"
 
-#include "common/events.h"
-#include "common/system.h"
-#include "common/list.h"
-
 namespace Saga {
 
-Common::List<Common::Event> stopEvents;
-
 int Scene::DinoStartProc() {
 	_vm->_gfx->showCursor(false);
 
-	Common::Event stopEvent;
-	stopEvents.clear();
-	stopEvent.type = Common::EVENT_KEYDOWN;
-	stopEvent.kbd = Common::KEYCODE_ESCAPE;
-	stopEvents.push_back(stopEvent);
-
 	Graphics::SmackerDecoder *smkDecoder = new Graphics::SmackerDecoder(_vm->_mixer);
 	Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder);
 	if (smkDecoder->loadFile("testvid.smk"))
-		player->playVideo(stopEvents);        // Play introduction
+		player->playVideo();        // Play introduction
 	smkDecoder->closeFile();
 	delete player;
 	delete smkDecoder;
@@ -69,19 +57,13 @@
 int Scene::FTA2StartProc() {
 	_vm->_gfx->showCursor(false);
 
-	Common::Event stopEvent;
-	stopEvents.clear();
-	stopEvent.type = Common::EVENT_KEYDOWN;
-	stopEvent.kbd = Common::KEYCODE_ESCAPE;
-	stopEvents.push_back(stopEvent);
-
 	Graphics::SmackerDecoder *smkDecoder = new Graphics::SmackerDecoder(_vm->_mixer);
 	Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder);
 	if (smkDecoder->loadFile("trimark.smk"))
-		player->playVideo(stopEvents);      // Show Ignite logo
+		player->playVideo();      // Show Ignite logo
 	smkDecoder->closeFile();
 	if (smkDecoder->loadFile("intro.smk"))
-		player->playVideo(stopEvents);        // Play introduction
+		player->playVideo();        // Play introduction
 	smkDecoder->closeFile();
 	delete player;
 	delete smkDecoder;
@@ -117,18 +99,11 @@
 
 	_vm->_gfx->showCursor(false);
 
-
-	Common::Event stopEvent;
-	stopEvents.clear();
-	stopEvent.type = Common::EVENT_KEYDOWN;
-	stopEvent.kbd = Common::KEYCODE_ESCAPE;
-	stopEvents.push_back(stopEvent);
-
 	// Play ending
 	Graphics::SmackerDecoder *smkDecoder = new Graphics::SmackerDecoder(_vm->_mixer);
 	Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder);
 	if (smkDecoder->loadFile(videoName)) {
-		player->playVideo(stopEvents);
+		player->playVideo();
 		smkDecoder->closeFile();
 	}
 	delete player;

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-16 07:37:12 UTC (rev 45150)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-16 07:42:23 UTC (rev 45151)
@@ -23,8 +23,6 @@
  *
  */
 
-#include "common/system.h"
-#include "common/events.h"
 #include "graphics/cursorman.h"
 #include "graphics/video/avi_player.h"
 #include "graphics/surface.h"
@@ -1060,17 +1058,10 @@
 	Common::String filename = s->_segMan->getString(argv[0]);
 	int delay = argv[1].toUint16(); // Time between frames in ticks
 
-	Common::Event stopEvent;
-	Common::List<Common::Event> stopEvents;
-	stopEvents.clear();
-	stopEvent.type = Common::EVENT_KEYDOWN;
-	stopEvent.kbd = Common::KEYCODE_ESCAPE;
-	stopEvents.push_back(stopEvent);
-
 	Graphics::SeqDecoder *seqDecoder = new Graphics::SeqDecoder();
 	Graphics::VideoPlayer *player = new Graphics::VideoPlayer(seqDecoder);
 	if (seqDecoder->loadFile(filename.c_str(), delay))
-		player->playVideo(stopEvents);
+		player->playVideo();
 	else
 		warning("Failed to open movie file %s", filename.c_str());
 	seqDecoder->closeFile();

Modified: scummvm/trunk/engines/sword1/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword1/animation.cpp	2009-10-16 07:37:12 UTC (rev 45150)
+++ scummvm/trunk/engines/sword1/animation.cpp	2009-10-16 07:42:23 UTC (rev 45151)
@@ -33,9 +33,7 @@
 #include "common/config-manager.h"
 #include "common/endian.h"
 #include "common/str.h"
-#include "common/events.h"
 #include "common/system.h"
-#include "common/list.h"
 #include "graphics/surface.h"
 
 #include "gui/message.h"
@@ -153,17 +151,10 @@
 	}
 	bool terminated = false;
 
-	Common::List<Common::Event> stopEvents;
-	Common::Event stopEvent;
-	stopEvents.clear();
-	stopEvent.type = Common::EVENT_KEYDOWN;
-	stopEvent.kbd = Common::KEYCODE_ESCAPE;
-	stopEvents.push_back(stopEvent);
-
 	_textX = 0;
 	_textY = 0;
 
-	terminated = !playVideo(stopEvents);
+	terminated = !playVideo();
 
 	if (terminated)
 		_snd->stopHandle(*_bgSoundHandle);

Modified: scummvm/trunk/engines/sword2/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword2/animation.cpp	2009-10-16 07:37:12 UTC (rev 45150)
+++ scummvm/trunk/engines/sword2/animation.cpp	2009-10-16 07:42:23 UTC (rev 45151)
@@ -107,15 +107,8 @@
 
 	bool terminated = false;
 
-	Common::List<Common::Event> stopEvents;
-	Common::Event stopEvent;
-	stopEvents.clear();
-	stopEvent.type = Common::EVENT_KEYDOWN;
-	stopEvent.kbd = Common::KEYCODE_ESCAPE;
-	stopEvents.push_back(stopEvent);
+	terminated = !playVideo();
 
-	terminated = !playVideo(stopEvents);
-
 	closeTextObject(_currentMovieText, NULL);
 
 	if (terminated) {

Modified: scummvm/trunk/graphics/video/video_player.cpp
===================================================================
--- scummvm/trunk/graphics/video/video_player.cpp	2009-10-16 07:37:12 UTC (rev 45150)
+++ scummvm/trunk/graphics/video/video_player.cpp	2009-10-16 07:42:23 UTC (rev 45151)
@@ -225,6 +225,17 @@
 	return !_skipVideo;
 }
 
+bool VideoPlayer::playVideo() {
+	Common::Event stopEvent;
+	Common::List<Common::Event> stopEvents;
+	stopEvents.clear();
+	stopEvent.type = Common::EVENT_KEYDOWN;
+	stopEvent.kbd = Common::KEYCODE_ESCAPE;
+	stopEvents.push_back(stopEvent);
+
+	return playVideo(stopEvents);
+}
+
 void VideoPlayer::performPostProcessing(byte *screen) {
 }
 

Modified: scummvm/trunk/graphics/video/video_player.h
===================================================================
--- scummvm/trunk/graphics/video/video_player.h	2009-10-16 07:37:12 UTC (rev 45150)
+++ scummvm/trunk/graphics/video/video_player.h	2009-10-16 07:42:23 UTC (rev 45151)
@@ -192,6 +192,12 @@
 	 */
 	bool playVideo(Common::List<Common::Event> &stopEvents);
 
+	/**
+	 * Provides the same functionality as the video player, and it adds the
+	 * event of skipping the video with the escape key by default
+	 */
+	bool playVideo();
+
 protected:
 	/**
 	 * Perform postprocessing once the frame data is copied to the screen,


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