[Scummvm-cvs-logs] SF.net SVN: scummvm:[49912] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Jun 17 01:30:22 CEST 2010


Revision: 49912
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49912&view=rev
Author:   thebluegr
Date:     2010-06-16 23:30:22 +0000 (Wed, 16 Jun 2010)

Log Message:
-----------
Hooked the VMD player in kPlayVMD. The VMD videos in the demo of Phantasmagoria 1 are shown now (e.g. the intro and the chapter beginning)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/kernel32.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-16 23:28:20 UTC (rev 49911)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-16 23:30:22 UTC (rev 49912)
@@ -386,6 +386,7 @@
 	{ "Save", kSave, ".*" },
 	{ "List", kList, ".*" },
 	{ "Robot", kRobot, ".*" },
+	{ "PlayVMD", kPlayVMD, ".*" },
 	{ "IsOnMe", kIsOnMe, "iio.*" },
 	{ "MulDiv", kMulDiv, "iii" },
 

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2010-06-16 23:28:20 UTC (rev 49911)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2010-06-16 23:30:22 UTC (rev 49912)
@@ -438,6 +438,7 @@
 reg_t kSave(EngineState *s, int argc, reg_t *argv);
 reg_t kList(EngineState *s, int argc, reg_t *argv);
 reg_t kRobot(EngineState *s, int argc, reg_t *argv);
+reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv);
 reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv);
 
 #endif

Modified: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-06-16 23:28:20 UTC (rev 49911)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-06-16 23:30:22 UTC (rev 49912)
@@ -30,8 +30,10 @@
 #include "sci/engine/segment.h"
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
+#include "sci/graphics/cursor.h"
 #include "sci/graphics/frameout.h"
 #include "sci/graphics/screen.h"
+#include "sci/video/vmd_decoder.h"
 
 #include "common/system.h"
 
@@ -893,6 +895,74 @@
 	return make_reg(0, multiplicant * multiplier / denominator);
 }
 
+reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
+	uint16 operation = argv[0].toUint16();
+	Graphics::VideoDecoder *videoDecoder = 0;
+	Common::String fileName;
+
+	Common::String warningMsg;
+
+	switch (operation) {
+	case 0:	// play
+		fileName = s->_segMan->derefString(argv[1]);
+		// TODO: argv[2] (usually 0)
+		videoDecoder = new VMDDecoder(g_system->getMixer());
+
+		g_sci->_gfxCursor->kernelHide();
+
+		if (videoDecoder && videoDecoder->loadFile(fileName)) {
+			uint16 x = (g_system->getWidth() - videoDecoder->getWidth()) / 2;
+			uint16 y = (g_system->getHeight() - videoDecoder->getHeight()) / 2;
+			bool skipVideo = false;
+
+			while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
+				if (videoDecoder->needsUpdate()) {
+					Graphics::Surface *frame = videoDecoder->decodeNextFrame();
+					if (frame) {
+						g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+
+						if (videoDecoder->hasDirtyPalette())
+							videoDecoder->setSystemPalette();
+
+						g_system->updateScreen();
+					}
+				}
+
+				Common::Event event;
+				while (g_system->getEventManager()->pollEvent(event)) {
+					if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP)
+						skipVideo = true;
+				}
+
+				g_system->delayMillis(10);
+			}
+		
+			// Copy video contents to screen buffer
+			g_sci->_gfxScreen->kernelSyncWithFramebuffer();
+
+			delete videoDecoder;
+		} else
+			warning("Could not play video %s\n", fileName.c_str());
+
+		g_sci->_gfxCursor->kernelShow();
+
+		break;
+	default:
+		warningMsg = "PlayVMD - unsupported subop. Params: " +
+									Common::String::printf("%d", argc) + " (";
+
+		for (int i = 0; i < argc; i++) {
+			warningMsg +=  Common::String::printf("%04x:%04x", PRINT_REG(argv[i]));
+			warningMsg += (i == argc - 1 ? ")" : ", ");
+		}
+
+		warning("%s", warningMsg.c_str());
+		break;
+	}
+
+	return s->r_acc;
+}
+
 } // End of namespace Sci
 
 #endif	// ENABLE_SCI32

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-06-16 23:28:20 UTC (rev 49911)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-06-16 23:30:22 UTC (rev 49912)
@@ -118,11 +118,12 @@
 
 	SearchMan.addSubDirectoryMatching(gameDataDir, "actors");	// KQ6 hi-res portraits
 	SearchMan.addSubDirectoryMatching(gameDataDir, "aud");	// resource.aud and audio files
+	SearchMan.addSubDirectoryMatching(gameDataDir, "wav");	// speech files in WAV format
+	SearchMan.addSubDirectoryMatching(gameDataDir, "sfx");	// music/sound files in WAV format
 	SearchMan.addSubDirectoryMatching(gameDataDir, "avi");	// AVI movie files for Windows versions
 	SearchMan.addSubDirectoryMatching(gameDataDir, "seq");	// SEQ movie files for DOS versions
-	SearchMan.addSubDirectoryMatching(gameDataDir, "wav");	// speech files in WAV format
-	SearchMan.addSubDirectoryMatching(gameDataDir, "sfx");	// music/sound files in WAV format
-	SearchMan.addSubDirectoryMatching(gameDataDir, "robot");	// robot files
+	SearchMan.addSubDirectoryMatching(gameDataDir, "robot");	// robot movie files
+	SearchMan.addSubDirectoryMatching(gameDataDir, "vmd");	// vmd movie files
 
 	// Add the patches directory, except for KQ6CD; The patches folder in some versions of KQ6CD
 	// is for the demo of Phantasmagoria, included in the disk


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