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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Jun 17 09:26:07 CEST 2010


Revision: 49920
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49920&view=rev
Author:   thebluegr
Date:     2010-06-17 07:26:06 +0000 (Thu, 17 Jun 2010)

Log Message:
-----------
Moved kMulDiv together with the rest of the math functions, and kPlayVMD together with the rest of the video playing functions

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel32.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/kmath.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-06-17 05:40:48 UTC (rev 49919)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-06-17 07:26:06 UTC (rev 49920)
@@ -30,10 +30,8 @@
 #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"
 
@@ -881,88 +879,6 @@
 	return NULL_REG;
 }
 
-reg_t kMulDiv(EngineState *s, int argc, reg_t *argv) {
-	int16 multiplicant = argv[0].toSint16();
-	int16 multiplier = argv[1].toSint16();
-	int16 denominator = argv[2].toSint16();
-
-	// Sanity check...
-	if (!denominator) {
-		warning("kMulDiv: attempt to divide by zero (%d * %d / %d", multiplicant, multiplier, denominator);
-		return NULL_REG;
-	}
-
-	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;
-	bool reshowCursor = g_sci->_gfxCursor->isVisible();
-	Common::String fileName, warningMsg;
-
-	switch (operation) {
-	case 0:	// play
-		fileName = s->_segMan->derefString(argv[1]);
-		// TODO: argv[2] (usually 0)
-		videoDecoder = new VMDDecoder(g_system->getMixer());
-
-		if (reshowCursor)
-			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());
-
-		if (reshowCursor)
-			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/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-06-17 05:40:48 UTC (rev 49919)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-06-17 07:26:06 UTC (rev 49920)
@@ -48,6 +48,9 @@
 #include "sci/graphics/screen.h"
 #include "sci/graphics/text16.h"
 #include "sci/graphics/view.h"
+#ifdef ENABLE_SCI32
+#include "sci/video/vmd_decoder.h"
+#endif
 
 namespace Sci {
 
@@ -1230,6 +1233,78 @@
 
 	return s->r_acc;
 }
+
+reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
+	uint16 operation = argv[0].toUint16();
+	Graphics::VideoDecoder *videoDecoder = 0;
+	bool reshowCursor = g_sci->_gfxCursor->isVisible();
+	Common::String fileName, warningMsg;
+
+	switch (operation) {
+	case 0:	// play
+		fileName = s->_segMan->derefString(argv[1]);
+		// TODO: argv[2] (usually 0)
+		if (argv[2] != NULL_REG)
+			warning("kPlayVMD: third parameter isn't 0 (it's %04x:%04x)", PRINT_REG(argv[2]));
+
+		videoDecoder = new VMDDecoder(g_system->getMixer());
+
+		if (reshowCursor)
+			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());
+
+		if (reshowCursor)
+			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;
+}
+
 #endif
 
 reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv) {

Modified: scummvm/trunk/engines/sci/engine/kmath.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmath.cpp	2010-06-17 05:40:48 UTC (rev 49919)
+++ scummvm/trunk/engines/sci/engine/kmath.cpp	2010-06-17 07:26:06 UTC (rev 49920)
@@ -153,4 +153,22 @@
 		return make_reg(0, (int16)(tan(param * PI / 180.0) * scale));
 }
 
+#ifdef ENABLE_SCI32
+
+reg_t kMulDiv(EngineState *s, int argc, reg_t *argv) {
+	int16 multiplicant = argv[0].toSint16();
+	int16 multiplier = argv[1].toSint16();
+	int16 denominator = argv[2].toSint16();
+
+	// Sanity check...
+	if (!denominator) {
+		warning("kMulDiv: attempt to divide by zero (%d * %d / %d", multiplicant, multiplier, denominator);
+		return NULL_REG;
+	}
+
+	return make_reg(0, multiplicant * multiplier / denominator);
+}
+
+#endif
+
 } // End of namespace Sci


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