[Scummvm-cvs-logs] SF.net SVN: scummvm: [29990] scummvm/trunk/engines/cruise

yazoo at users.sourceforge.net yazoo at users.sourceforge.net
Tue Dec 25 22:03:22 CET 2007


Revision: 29990
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29990&view=rev
Author:   yazoo
Date:     2007-12-25 13:03:20 -0800 (Tue, 25 Dec 2007)

Log Message:
-----------
Fix input
Fix timming

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/cruise_main.cpp
    scummvm/trunk/engines/cruise/function.cpp
    scummvm/trunk/engines/cruise/gfxModule.cpp
    scummvm/trunk/engines/cruise/mainDraw.cpp

Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp	2007-12-25 20:16:59 UTC (rev 29989)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp	2007-12-25 21:03:20 UTC (rev 29990)
@@ -1593,12 +1593,6 @@
 int currentMouseY = 0;
 int currentMouseButton = 0;
 
-void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) {
-	*pMouseX = currentMouseX;
-	*pMouseY = currentMouseY;
-	*pMouseButton = currentMouseButton;
-}
-
 bool bFastMode = false;
 
 void manageEvents() {
@@ -1730,11 +1724,13 @@
 	 * mouseRight = 0;
 	 * }
 	 */
-	g_system->updateScreen();
+}
 
-	if (!bFastMode) {
-		g_system->delayMillis(40);
-	}
+void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) {
+	manageEvents();
+	*pMouseX = currentMouseX;
+	*pMouseY = currentMouseY;
+	*pMouseButton = currentMouseButton;
 }
 
 void mainLoop(void) {
@@ -1849,8 +1845,15 @@
 				}
 
 				if (userWait) {
-					int16 button = 0;
-					while (!button) {
+					int16 mouseX;
+					int16 mouseY;
+					int16 mouseButton;
+
+					do {
+						getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
+					}while(mouseButton);
+
+					while (!mouseButton) {
 						manageScripts(&relHead);
 						manageScripts(&procHead);
 
@@ -1865,7 +1868,9 @@
 						int16 mouseVar;
 						int16 mouseX;
 						int16 mouseY;
-						getMouseStatus(&mouseVar, &mouseX, &button, &mouseY);
+						getMouseStatus(&mouseVar, &mouseX, &mouseButton, &mouseY);
+
+						flip();
 					}
 
 					changeScriptParamInList(-1, -1, &procHead, 9999, 0);

Modified: scummvm/trunk/engines/cruise/function.cpp
===================================================================
--- scummvm/trunk/engines/cruise/function.cpp	2007-12-25 20:16:59 UTC (rev 29989)
+++ scummvm/trunk/engines/cruise/function.cpp	2007-12-25 21:03:20 UTC (rev 29990)
@@ -619,7 +619,7 @@
 
 	getMouseStatus(&dummy, &mouseX, &mouseButton, &mouseY);
 
-	if (mouseButton & 4)
+	if (mouseButton)
 		return 1;
 	return 0;
 }

Modified: scummvm/trunk/engines/cruise/gfxModule.cpp
===================================================================
--- scummvm/trunk/engines/cruise/gfxModule.cpp	2007-12-25 20:16:59 UTC (rev 29989)
+++ scummvm/trunk/engines/cruise/gfxModule.cpp	2007-12-25 21:03:20 UTC (rev 29990)
@@ -221,6 +221,10 @@
 	flip();
 }
 
+extern bool bFastMode;
+
+static uint32 lastTick;
+
 void flip() {
 	int i;
 	byte paletteRGBA[256 * 4];
@@ -242,6 +246,16 @@
 	g_system->copyRectToScreen(globalScreen, 320, 0, 0, 320, 200);
 	g_system->updateScreen();
 
+	uint32 currentTick = g_system->getMillis();
+
+	if (!bFastMode) {
+		uint32 speed = 50;
+		if(lastTick + speed > currentTick) {
+			g_system->delayMillis(lastTick + speed - currentTick);
+		}
+	}
+
+	lastTick = g_system->getMillis();
 }
 
 } // End of namespace Cruise

Modified: scummvm/trunk/engines/cruise/mainDraw.cpp
===================================================================
--- scummvm/trunk/engines/cruise/mainDraw.cpp	2007-12-25 20:16:59 UTC (rev 29989)
+++ scummvm/trunk/engines/cruise/mainDraw.cpp	2007-12-25 21:03:20 UTC (rev 29990)
@@ -1145,7 +1145,7 @@
 	buildPolyModel(newX, newY, newScale, (char*)polygonMask, destBuffer, newFrame);
 }
 
-void drawMessage(gfxEntryStruct *pGfxPtr, int globalX, int globalY, int idx, int newColor, uint8 *ouputPtr) {
+void drawMessage(gfxEntryStruct *pGfxPtr, int globalX, int globalY, int width, int newColor, uint8 *ouputPtr) {
 	// this is used for font only
 
 	if (pGfxPtr) {
@@ -1157,11 +1157,15 @@
 		int y;
 		uint8 *ptr = pGfxPtr->imagePtr;
 		int height = pGfxPtr->height;
-		int width = pGfxPtr->width;
 
-		if (globalY < 0) {
+		if (width>310)
+			width = 310;
+		if(width+globalX>319)
+			globalX = 319 - width;
+		if(globalY < 0)
 			globalY = 0;
-		}
+		if(globalX < 0)
+			globalX = 0;
 
 		if (globalY + pGfxPtr->height >= 198) {
 			globalY = 198 - pGfxPtr->height;
@@ -1175,12 +1179,11 @@
 		for (i = 0; i < height; i++) {
 			output = initialOuput + 320 * i;
 
-			for (j = 0; j < width; j++) {
+			for (j = 0; j < pGfxPtr->width; j++) {
 				uint8 color = *(ptr++);
 
 				if (color) {
-					if ((x >= 0) && (x < 320) && (y >= 0)
-					    && (y < 200)) {
+					if ((x >= 0) && (x < 320) && (y >= 0) && (y < 200)) {
 						if (color == 1) {
 							*output = (uint8) 0;
 						} else {


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