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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Feb 1 11:42:28 CET 2007


Revision: 25319
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25319&view=rev
Author:   drmccoy
Date:     2007-02-01 02:42:27 -0800 (Thu, 01 Feb 2007)

Log Message:
-----------
- Fixed the palette animations
- Changed waitRetrace() to take some time, because the scrolling speed is tuned to the retrace delays

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/mult_v2.cpp
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/util.h
    scummvm/trunk/engines/gob/video.h
    scummvm/trunk/engines/gob/video_v1.cpp
    scummvm/trunk/engines/gob/video_v2.cpp

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2007-02-01 10:42:27 UTC (rev 25319)
@@ -1345,7 +1345,7 @@
 	now = _vm->_util->getTimeKey();
 	if (!_noBusyWait)
 		if ((now - lastCalled) <= 20)
-			_vm->_util->longDelay(20);
+			_vm->_util->longDelay(1);
 	lastCalled = now;
 	_noBusyWait = false;
 
@@ -1413,6 +1413,7 @@
 		storeKey(key);
 		return false;
 	} else {
+		_vm->_util->longDelay(1);
 		key = _vm->_game->checkCollisions(0, 0, 0, 0);
 		storeKey(key);
 

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2007-02-01 10:42:27 UTC (rev 25319)
@@ -1633,7 +1633,7 @@
 		break;
 
 	case 50:
-		if (_vm->_global->_videoMode != 0x0D) { // || (word_2D479 == 256) {
+		if ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256)) {
 			_vm->_global->_inter_execPtr += 16;
 			return false;
 		}
@@ -1647,7 +1647,7 @@
 		break;
 
 	case 52:
-		if (_vm->_global->_videoMode != 0x0D) { // || (word_2D479 == 256) {
+		if ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256)) {
 			_vm->_global->_inter_execPtr += 48;
 			return false;
 		}
@@ -2204,8 +2204,7 @@
 		_vm->_draw->_word_2FC9E = offset;
 		_vm->_draw->_word_2FC9C = _vm->_parse->parseValExpr();
 	}
-	_vm->_video->_scrollOffset = _vm->_draw->_word_2FC9E;
-	_vm->_video->waitRetrace(_vm->_global->_videoMode);
+	_vm->_util->setScrollOffset(_vm->_draw->_word_2FC9E);
 	_noBusyWait = true;
 
 /*
@@ -2238,12 +2237,11 @@
 
 	curX = startX;
 	curY = startY;
-	while ((curX != endX) || (curY != endY)) {
+	while (!_vm->_quitRequested && ((curX != endX) || (curY != endY))) {
 		curX = stepX > 0 ? MIN(curX + stepX, (int) endX) : MAX(curX + stepX, (int) endX);
 		curY = stepY > 0 ? MIN(curY + stepY, (int) endY) : MAX(curY + stepY, (int) endY);
 		_vm->_draw->_word_2FC9E = curX;
-		_vm->_video->_scrollOffset = _vm->_draw->_word_2FC9E;
-		_vm->_video->waitRetrace(_vm->_global->_videoMode);
+		_vm->_util->setScrollOffset(_vm->_draw->_word_2FC9E);
 	}
 }
 
@@ -2389,13 +2387,13 @@
 			col = _vm->_global->_pPaletteDesc->vgaPal[_animPalLowIndex[j]];
 
 			for (i = _animPalLowIndex[j]; i < _animPalHighIndex[j]; i++)
-				_vm->_draw->_vgaPalette[i] = _vm->_global->_pPaletteDesc->vgaPal[i];
+				_vm->_draw->_vgaPalette[i] = _vm->_global->_pPaletteDesc->vgaPal[i + 1];
 
 			_vm->_global->_pPaletteDesc->vgaPal[_animPalHighIndex[j]] = col;
 		} else {
 			col = _vm->_global->_pPaletteDesc->vgaPal[_animPalHighIndex[j]];
 			for (i = _animPalHighIndex[j]; i > _animPalLowIndex[j]; i--)
-				_vm->_draw->_vgaPalette[i] = _vm->_global->_pPaletteDesc->vgaPal[i];
+				_vm->_draw->_vgaPalette[i] = _vm->_draw->_vgaPalette[i - 1];
 
 			_vm->_global->_pPaletteDesc->vgaPal[_animPalLowIndex[j]] = col;
 		}

Modified: scummvm/trunk/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v2.cpp	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/mult_v2.cpp	2007-02-01 10:42:27 UTC (rev 25319)
@@ -564,8 +564,8 @@
 			_animDataAllocated = 0;
 		}
 
-/*		if (_vm->_snd->_playingSound != 0)
-			_vm->_snd->stopSound(10);*/
+		if (_vm->_snd->_playingSound != 0)
+			_vm->_snd->stopSound(10);
 
 		WRITE_VAR(57, (uint32)-1);
 	} else

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/util.cpp	2007-02-01 10:42:27 UTC (rev 25319)
@@ -188,8 +188,8 @@
 	do {
 		_vm->_video->waitRetrace(_vm->_global->_videoMode);
 		processInput();
-		delay(25);
-	} while (g_system->getMillis() < time);
+		delay(15);
+	} while (!_vm->_quitRequested && (g_system->getMillis() < time));
 }
 
 void Util::delay(uint16 msecs) {
@@ -494,4 +494,10 @@
 	_mouseButtons = 0;
 }
 
+void Util::setScrollOffset(int16 scrollOffset) {
+	processInput();
+	_vm->_video->_scrollOffset = scrollOffset;
+	_vm->_video->waitRetrace(_vm->_global->_videoMode);
+}
+
 } // End of namespace Gob

Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/util.h	2007-02-01 10:42:27 UTC (rev 25319)
@@ -84,6 +84,7 @@
 	static void prepareStr(char *str);
 	void waitMouseRelease(char drawMouse);
 	void forceMouseUp(void);
+	void setScrollOffset(int16 scrollOffset);
 
 	static const char trStr1[];
 	static const char trStr2[];

Modified: scummvm/trunk/engines/gob/video.h
===================================================================
--- scummvm/trunk/engines/gob/video.h	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/video.h	2007-02-01 10:42:27 UTC (rev 25319)
@@ -120,7 +120,7 @@
 	virtual void drawLetter(int16 item, int16 x, int16 y, FontDesc * fontDesc,
 			int16 color1, int16 color2, int16 transp, SurfaceDesc * dest) = 0;
 	virtual SurfaceDesc *initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags) = 0;
-	virtual void waitRetrace(int16) = 0;
+	virtual void waitRetrace(int16, bool mouse = true) = 0;
 	virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
 			int16 x, int16 y, int16 transp, SurfaceDesc * destDesc) = 0;
 
@@ -136,7 +136,7 @@
 	virtual void drawLetter(int16 item, int16 x, int16 y, FontDesc * fontDesc,
 			int16 color1, int16 color2, int16 transp, SurfaceDesc * dest);
 	virtual SurfaceDesc *initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags);
-	virtual void waitRetrace(int16);
+	virtual void waitRetrace(int16, bool mouse = true);
 	virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
 			int16 x, int16 y, int16 transp, SurfaceDesc * destDesc);
 
@@ -149,7 +149,7 @@
 	virtual void drawLetter(int16 item, int16 x, int16 y, FontDesc * fontDesc,
 			int16 color1, int16 color2, int16 transp, SurfaceDesc * dest);
 	virtual SurfaceDesc *initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags);
-	virtual void waitRetrace(int16);
+	virtual void waitRetrace(int16, bool mouse = true);
 	virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight,
 			int16 x, int16 y, int16 transp, SurfaceDesc * destDesc);
 

Modified: scummvm/trunk/engines/gob/video_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/video_v1.cpp	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/video_v1.cpp	2007-02-01 10:42:27 UTC (rev 25319)
@@ -29,6 +29,7 @@
 #include "gob/global.h"
 #include "gob/video.h"
 #include "gob/draw.h"
+#include "gob/util.h"
 
 namespace Gob {
 
@@ -37,11 +38,16 @@
 
 //XXX: Use this function to update the screen for now.
 //     This should be moved to a better location later on.
-void Video_v1::waitRetrace(int16) {
-	CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
+void Video_v1::waitRetrace(int16, bool mouse) {
+	uint32 time;
+
+	if (mouse)
+		CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
 	if (_vm->_global->_pPrimarySurfDesc) {
+		time = _vm->_util->getTimeKey();
 		g_system->copyRectToScreen(_vm->_global->_pPrimarySurfDesc->vidPtr, 320, 0, 0, 320, 200);
 		g_system->updateScreen();
+		_vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time)));
 	}
 }
 

Modified: scummvm/trunk/engines/gob/video_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/video_v2.cpp	2007-02-01 05:33:59 UTC (rev 25318)
+++ scummvm/trunk/engines/gob/video_v2.cpp	2007-02-01 10:42:27 UTC (rev 25319)
@@ -29,6 +29,7 @@
 #include "gob/global.h"
 #include "gob/video.h"
 #include "gob/draw.h"
+#include "gob/util.h"
 
 namespace Gob {
 
@@ -37,12 +38,17 @@
 
 //XXX: Use this function to update the screen for now.
 //     This should be moved to a better location later on.
-void Video_v2::waitRetrace(int16) {
-	CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
+void Video_v2::waitRetrace(int16, bool mouse) {
+	uint32 time;
+
+	if (mouse)
+		CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
 	if (_vm->_draw->_frontSurface) {
+		time = _vm->_util->getTimeKey();
 		g_system->copyRectToScreen(_vm->_draw->_frontSurface->vidPtr + _scrollOffset,
 				_surfWidth, 0, 0, 320, 200);
 		g_system->updateScreen();
+		_vm->_util->delay(MAX(1, 10 - (int)(_vm->_util->getTimeKey() - time)));
 	}
 }
 


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