[Scummvm-cvs-logs] CVS: scummvm/gob draw.cpp,1.12,1.13 game.cpp,1.25,1.26 global.cpp,1.7,1.8 global.h,1.6,1.7 gob.cpp,1.23,1.24 inter.cpp,1.22,1.23 palanim.cpp,1.9,1.10 scenery.cpp,1.18,1.19 util.cpp,1.15,1.16 video.cpp,1.14,1.15

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Aug 10 08:53:34 CEST 2005


Update of /cvsroot/scummvm/scummvm/gob
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8073

Modified Files:
	draw.cpp game.cpp global.cpp global.h gob.cpp inter.cpp 
	palanim.cpp scenery.cpp util.cpp video.cpp 
Log Message:
Made Gobliiins less of a CPU hog by adding some strategic delays and
turning on the screen auto-dirtying - some as Simon uses. It's not perfect
by any means, but it may be good enough for 0.8.0 at least.


Index: draw.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/draw.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- draw.cpp	30 Jul 2005 21:10:59 -0000	1.12
+++ draw.cpp	10 Aug 2005 15:48:50 -0000	1.13
@@ -653,8 +653,6 @@
 			draw_cursorIndex = cursorIndex;
 		} else {
 			vid_waitRetrace(videoMode);
-			if (minY < 50)
-				util_delay(5);
 		}
 
 		vid_drawSprite(draw_backSurface, draw_frontSurface,

Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/game.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- game.cpp	8 Aug 2005 20:19:57 -0000	1.25
+++ game.cpp	10 Aug 2005 15:48:50 -0000	1.26
@@ -684,6 +684,8 @@
 		if (handleMouse != 0)
 			draw_animateCursor(-1);
 
+		util_delay(10);
+
 		snd_loopSounds();
 	}
 }
@@ -1247,6 +1249,7 @@
 
 		case 20:
 			collResId = curCmd;
+			// Fall through to case 2
 
 		case 2:
 			key = inter_load16();

Index: global.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/global.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- global.cpp	8 Aug 2005 20:19:58 -0000	1.7
+++ global.cpp	10 Aug 2005 15:48:50 -0000	1.8
@@ -61,7 +61,6 @@
 
 /* Timer variables */
 int32 startTime = 0;
-char timer_enabled = 1;
 int16 timer_delta = 1000;
 
 int16 frameWaitTime = 0;

Index: global.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/global.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- global.h	8 Aug 2005 20:19:59 -0000	1.6
+++ global.h	10 Aug 2005 15:48:50 -0000	1.7
@@ -77,7 +77,6 @@
 
 /* Timer variables */
 extern int32 startTime;
-extern char timer_enabled;
 extern int16 timer_delta;
 
 extern int16 frameWaitTime;

Index: gob.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/gob.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- gob.cpp	8 Aug 2005 20:19:59 -0000	1.23
+++ gob.cpp	10 Aug 2005 15:48:50 -0000	1.24
@@ -274,6 +274,12 @@
 		break;
 	}
 
+	// FIXME: This is the ugly way of reducing redraw overhead. It works
+	//        well for 320x200 but it's unclear how well it will work for
+	//        640x480.
+
+	g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
+
 	return 0;
 }
 

Index: inter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/inter.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- inter.cpp	30 Jul 2005 21:11:00 -0000	1.22
+++ inter.cpp	10 Aug 2005 15:48:50 -0000	1.23
@@ -426,6 +426,13 @@
 	case 33:
 		if (_vm->_features & GF_GOB1) {
 			// Used in gob1 CD
+
+			// Some scripts busy-wait while calling this opcode.
+			// This is a very nasty thing to do, so let's add a
+			// short delay here. It's probably a safe thing to do.
+
+			util_longDelay(1);
+
 			int pos = cd_getTrackPos();
 			if (pos == -1)
 				pos = 32767;

Index: palanim.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/palanim.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- palanim.cpp	30 Jul 2005 21:11:00 -0000	1.9
+++ palanim.cpp	10 Aug 2005 15:48:50 -0000	1.10
@@ -188,7 +188,6 @@
 	}
 
 	if (allColors == 0) {
-
 		do {
 			if (tmpPalBuffer == 0)
 				vid_waitRetrace(videoMode);
@@ -206,7 +205,6 @@
 	}
 
 	if (allColors == 1) {
-
 		do {
 			vid_waitRetrace(videoMode);
 			stop = pal_fadeStep(1);

Index: scenery.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/scenery.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- scenery.cpp	30 Jul 2005 21:11:00 -0000	1.18
+++ scenery.cpp	10 Aug 2005 15:48:50 -0000	1.19
@@ -389,7 +389,8 @@
 	int16 sprIndex;
 
 	if (cd_globFlag) {
-		while (cd_getTrackPos() != -1);
+		while (cd_getTrackPos() != -1)
+		    util_longDelay(50);
 
 		cd_globFlag = false;
 	}

Index: util.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/util.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- util.cpp	30 Jul 2005 21:11:00 -0000	1.15
+++ util.cpp	10 Aug 2005 15:48:50 -0000	1.16
@@ -244,23 +244,15 @@
 void util_waitEndFrame() {
 	int32 time;
 
-	if (pPrimarySurfDesc) {
-		g_system->copyRectToScreen(pPrimarySurfDesc->vidPtr, 320, 0, 0, 320, 200);
-		g_system->updateScreen();
-	}
+	vid_waitRetrace(videoMode);
 
 	time = util_getTimeKey() - startFrameTime;
 	if (time > 1000 || time < 0) {
 		startFrameTime = util_getTimeKey();
 		return;
 	}
-	if (timer_enabled) {
-		do {
-			time = util_getTimeKey();
-		} while (time - startFrameTime < frameWaitTime);
-	} else {
-		if (frameWaitTime - time > 0)
-			util_delay(frameWaitTime - time);
+	if (frameWaitTime - time > 0) {
+		util_delay(frameWaitTime - time);
 	}
 	startFrameTime = util_getTimeKey();
 }
@@ -502,6 +494,7 @@
 		game_checkKeys(&mouseX, &mouseY, &buttons, drawMouse);
 		if (drawMouse != 0)
 			draw_animateCursor(2);
+		util_delay(10);
 	} while (buttons != 0);
 }
 

Index: video.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/video.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- video.cpp	8 Aug 2005 20:20:00 -0000	1.14
+++ video.cpp	10 Aug 2005 15:48:50 -0000	1.15
@@ -286,7 +286,7 @@
 }
 
 void vid_drawLetter(unsigned char item, int16 x, int16 y, FontDesc *fontDesc, int16 color1,
-	    int16 color2, int16 transp, SurfaceDesc * dest) {
+	    int16 color2, int16 transp, SurfaceDesc *dest) {
 
 	_videoDriver->drawLetter(item, x, y, fontDesc, color1, color2, transp, dest);
 }





More information about the Scummvm-git-logs mailing list