[Scummvm-cvs-logs] SF.net SVN: scummvm: [28664] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Aug 19 19:26:06 CEST 2007


Revision: 28664
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28664&view=rev
Author:   drmccoy
Date:     2007-08-19 10:26:06 -0700 (Sun, 19 Aug 2007)

Log Message:
-----------
Checking in patch #1777241 by Uwe Ryssel (GOB: Some optimizations for slow computers)

Modified Paths:
--------------
    scummvm/trunk/engines/gob/driver_vga.cpp
    scummvm/trunk/engines/gob/game_v1.cpp
    scummvm/trunk/engines/gob/video.cpp
    scummvm/trunk/engines/gob/video.h

Modified: scummvm/trunk/engines/gob/driver_vga.cpp
===================================================================
--- scummvm/trunk/engines/gob/driver_vga.cpp	2007-08-19 11:50:13 UTC (rev 28663)
+++ scummvm/trunk/engines/gob/driver_vga.cpp	2007-08-19 17:26:06 UTC (rev 28664)
@@ -113,19 +113,27 @@
 	byte *srcPos = source->getVidMem() + (top * source->getWidth()) + left;
 	byte *destPos = dest->getVidMem() + (y * dest->getWidth()) + x;
 
-	while (height--) {
-		if (transp) {
+	if (transp)
+	{
+		while (height--) {  		
 			for (int16 i = 0; i < width; ++i) {
 				if (srcPos[i])
 					destPos[i] = srcPos[i];
-			}
-		} else
-			for (int16 i = 0; i < width; ++i)
-				destPos[i] = srcPos[i];
+			} 	
 
-		srcPos += source->getWidth();
-		destPos += dest->getWidth();
+			srcPos += source->getWidth();
+			destPos += dest->getWidth();
+		}
 	}
+	else
+	{
+		while (height--) {
+			memcpy(destPos, srcPos, width);
+
+			srcPos += source->getWidth();
+			destPos += dest->getWidth();
+		}  
+	}
 }
 
 void VGAVideoDriver::drawPackedSprite(byte *sprBuf, int16 width, int16 height,

Modified: scummvm/trunk/engines/gob/game_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v1.cpp	2007-08-19 11:50:13 UTC (rev 28663)
+++ scummvm/trunk/engines/gob/game_v1.cpp	2007-08-19 17:26:06 UTC (rev 28664)
@@ -345,6 +345,7 @@
 	int16 oldIndex;
 	int16 oldId;
 	uint32 timeKey;
+	bool firstIteration = true;
 
 	if (deltaTime >= -1) {
 		_lastCollKey = 0;
@@ -357,6 +358,8 @@
 
 	resIndex = 0;
 
+	timeKey = _vm->_util->getTimeKey();
+
 	if ((_vm->_draw->_cursorIndex == -1) && (handleMouse != 0) &&
 			(_lastCollKey == 0)) {
 		_lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex);
@@ -374,7 +377,6 @@
 	if (handleMouse != 0)
 		_vm->_draw->animateCursor(-1);
 
-	timeKey = _vm->_util->getTimeKey();
 	while (1) {
 		if (_vm->_inter->_terminate) {
 			if (handleMouse)
@@ -395,7 +397,7 @@
 		// Additionally, I added a 'deltaTime == -1' check there, since
 		// when this function is called with deltaTime == -1 in inputArea,
 		// and the return value is then discarded.
-		if (deltaTime < 0) {
+		if (deltaTime < 0 && !firstIteration) {
 			uint32 curtime = _vm->_util->getTimeKey();
 			if ((deltaTime == -1) || ((curtime + deltaTime) > timeKey)) {
 				if (pResId != 0)
@@ -538,7 +540,10 @@
 		if (handleMouse != 0)
 			_vm->_draw->animateCursor(-1);
 
-		_vm->_util->delay(10);
+		if (deltaTime < -10)
+      _vm->_util->delay(10);
+
+		firstIteration = false;
 	}
 }
 
@@ -617,7 +622,7 @@
 	int16 var_26;
 	int16 collStackPos;
 	Collision *collPtr;
-	int16 timeKey;
+	uint32 timeKey;
 	byte *savedIP;
 
 	if (_shouldPushColls)
@@ -910,9 +915,9 @@
 
 								_shouldPushColls = 0;
 								_vm->_global->_inter_execPtr = savedIP;
+
 								deltaTime = timeVal -
-									((_vm->_util->getTimeKey() - timeKey)
-									 - _vm->_video->_lastRetraceLength);
+									(_vm->_util->getTimeKey() - timeKey);
 
 								if (deltaTime < 2)
 									deltaTime = 2;

Modified: scummvm/trunk/engines/gob/video.cpp
===================================================================
--- scummvm/trunk/engines/gob/video.cpp	2007-08-19 11:50:13 UTC (rev 28663)
+++ scummvm/trunk/engines/gob/video.cpp	2007-08-19 17:26:06 UTC (rev 28664)
@@ -94,7 +94,6 @@
 	_splitHeight1 = 200;
 	_splitHeight2 = 0;
 	_splitStart = 0;
-	_lastRetraceLength = 0;
 
 	_curSparse = 0;
 	_lastSparse = 0xFFFFFFFF;
@@ -162,8 +161,6 @@
 }
 
 void Video::retrace(bool mouse) {
-	uint32 time = _vm->_util->getTimeKey();
-
 	if (mouse)
 		CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
 	if (_vm->_global->_primarySurfDesc) {
@@ -176,13 +173,12 @@
 					_vm->_height - _splitHeight2, _vm->_width, _splitHeight2);
 		g_system->updateScreen();
 	}
-
-	_lastRetraceLength = _vm->_util->getTimeKey() - time;
 }
 
 void Video::waitRetrace(bool mouse) {
+	uint32 time = _vm->_util->getTimeKey();
 	retrace(mouse);
-	_vm->_util->delay(MAX(1, 10 - (int) _lastRetraceLength));
+	_vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time)));
 }
 
 void Video::sparseRetrace(int max) {

Modified: scummvm/trunk/engines/gob/video.h
===================================================================
--- scummvm/trunk/engines/gob/video.h	2007-08-19 11:50:13 UTC (rev 28663)
+++ scummvm/trunk/engines/gob/video.h	2007-08-19 17:26:06 UTC (rev 28664)
@@ -104,7 +104,6 @@
 	int16 _splitHeight1;
 	int16 _splitHeight2;
 	int16 _splitStart;
-	uint32 _lastRetraceLength;
 
 	void freeDriver();
 	void initPrimary(int16 mode);


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