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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sat May 3 22:08:46 CEST 2008


Revision: 31846
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31846&view=rev
Author:   drmccoy
Date:     2008-05-03 13:08:46 -0700 (Sat, 03 May 2008)

Log Message:
-----------
Correct o2_initScreen() for Woodruff (screen positioning, clipping and cursor limiting)

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw_v2.cpp
    scummvm/trunk/engines/gob/global.cpp
    scummvm/trunk/engines/gob/global.h
    scummvm/trunk/engines/gob/gob.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/video.cpp
    scummvm/trunk/engines/gob/video.h

Modified: scummvm/trunk/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v2.cpp	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/draw_v2.cpp	2008-05-03 20:08:46 UTC (rev 31846)
@@ -246,11 +246,11 @@
 	}
 
 	if (_renderFlags & RENDERFLAG_FROMSPLIT) {
-		destY = _vm->_video->_splitHeight1;
+		destY = _vm->_video->_splitStart;
 		spriteBottom = READ_LE_UINT16(ptr + 6) - READ_LE_UINT16(ptr + 2);
 		if (_renderFlags & RENDERFLAG_DOUBLECOORDS)
 			spriteBottom *= 3;
-		spriteBottom += _vm->_video->_splitHeight1;
+		spriteBottom += _vm->_video->_splitStart;
 		if (_renderFlags & RENDERFLAG_DOUBLECOORDS) {
 			spriteBottom += _backDeltaX;
 			destY += _backDeltaX;

Modified: scummvm/trunk/engines/gob/global.cpp
===================================================================
--- scummvm/trunk/engines/gob/global.cpp	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/global.cpp	2008-05-03 20:08:46 UTC (rev 31846)
@@ -53,9 +53,12 @@
 	_mousePresent = UNDEF;
 	_mouseXShift = 3;
 	_mouseYShift = 3;
-	_mouseMaxCol = 320;
-	_mouseMaxRow = 200;
 
+	_mouseMinX = 0;
+	_mouseMinY = 0;
+	_mouseMaxX = 320;
+	_mouseMaxY = 200;
+
 	_useJoystick = 1;
 
 	_primaryWidth = 0;

Modified: scummvm/trunk/engines/gob/global.h
===================================================================
--- scummvm/trunk/engines/gob/global.h	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/global.h	2008-05-03 20:08:46 UTC (rev 31846)
@@ -90,9 +90,12 @@
 	int16 _mousePresent;
 	int16 _mouseXShift;
 	int16 _mouseYShift;
-	int16 _mouseMaxCol;
-	int16 _mouseMaxRow;
 
+	int16 _mouseMinX;
+	int16 _mouseMinY;
+	int16 _mouseMaxX;
+	int16 _mouseMaxY;
+
 	char _useJoystick;
 
 	int16 _primaryWidth;

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/gob.cpp	2008-05-03 20:08:46 UTC (rev 31846)
@@ -146,10 +146,7 @@
 		return -1;
 	}
 
-	_system->beginGFXTransaction();
-		_system->initSize(_width, _height);
-		initCommonGFX(is640());
-	_system->endGFXTransaction();
+	_video->setSize(is640());
 
 	// On some systems it's not safe to run CD audio games from the CD.
 	if (isCD())
@@ -346,15 +343,15 @@
 	if (is640()) {
 		_video->_surfWidth = _width = 640;
 		_video->_surfHeight = _video->_splitHeight1 = _height = 480;
-		_global->_mouseMaxCol = 640;
-		_global->_mouseMaxRow = 480;
+		_global->_mouseMaxX = 640;
+		_global->_mouseMaxY = 480;
 		_mode = 0x18;
 		_global->_primarySurfDesc = new SurfaceDesc(0x18, 640, 480);
 	} else {
 		_video->_surfWidth = _width = 320;
 		_video->_surfHeight = _video->_splitHeight1 = _height = 200;
-		_global->_mouseMaxCol = 320;
-		_global->_mouseMaxRow = 200;
+		_global->_mouseMaxX = 320;
+		_global->_mouseMaxY = 200;
 		_mode = 0x14;
 		_global->_primarySurfDesc = new SurfaceDesc(0x14, 320, 200);
 	}

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2008-05-03 20:08:46 UTC (rev 31846)
@@ -1388,17 +1388,21 @@
 	width = _vm->_parse->parseValExpr();
 	height = _vm->_parse->parseValExpr();
 
+	_vm->_video->clearScreen();
+
 	// Lost in Time switches to 640x400x16 when showing the title screen
 	if (_vm->getGameType() == kGameTypeLostInTime) {
+
 		if (videoMode == 0x10) {
+
 			width = _vm->_width = 640;
 			height = _vm->_height = 400;
 			_vm->_global->_colorCount = 16;
-			_vm->_system->beginGFXTransaction();
-				_vm->_system->initSize(_vm->_width, _vm->_height);
-				_vm->initCommonGFX(true);
-			_vm->_system->endGFXTransaction();
+
+			_vm->_video->setSize(true);
+
 		} else if (_vm->_global->_videoMode == 0x10) {
+
 			if (width == -1)
 				width = 320;
 			if (height == -1)
@@ -1407,10 +1411,9 @@
 			_vm->_width = 320;
 			_vm->_height = 200;
 			_vm->_global->_colorCount = 256;
-			_vm->_system->beginGFXTransaction();
-				_vm->_system->initSize(_vm->_width, _vm->_height);
-				_vm->initCommonGFX(false);
-			_vm->_system->endGFXTransaction();
+
+			_vm->_video->setSize(false);
+
 		}
 	}
 
@@ -1428,11 +1431,47 @@
 	if (height > 0)
 		_vm->_video->_surfHeight = height;
 
-	_vm->_video->_splitHeight1 =
-		MIN<int16>(_vm->_height, _vm->_video->_surfHeight - offY);
-	_vm->_video->_splitHeight2 = offY;
-	_vm->_video->_splitStart = _vm->_video->_surfHeight - offY;
+	if (videoMode == 0x18) {
 
+		if (_vm->_video->_surfWidth < _vm->_width)
+			_vm->_video->_screenDeltaX = (_vm->_width - _vm->_video->_surfWidth) / 2;
+		else
+			_vm->_video->_screenDeltaX = 0;
+
+		_vm->_global->_mouseMinX = _vm->_video->_screenDeltaX;
+		_vm->_global->_mouseMaxX = _vm->_video->_screenDeltaX + _vm->_video->_surfWidth - 1;
+
+
+		int16 screenHeight = _vm->_video->_surfHeight;
+
+		_vm->_video->_surfHeight += offY;
+
+		_vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, screenHeight - offY);
+		_vm->_video->_splitHeight2 = offY;
+		_vm->_video->_splitStart = screenHeight;
+
+		if ((_vm->_video->_surfHeight + offY) < _vm->_height)
+			_vm->_video->_screenDeltaY = (_vm->_height - (screenHeight + offY)) / 2;
+		else
+			_vm->_video->_screenDeltaY = 0;
+
+		_vm->_global->_mouseMaxY = (screenHeight + _vm->_video->_screenDeltaY) - offY - 1;
+		_vm->_global->_mouseMinY = _vm->_video->_screenDeltaY;
+
+	} else {
+		_vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, _vm->_video->_surfHeight - offY);
+		_vm->_video->_splitHeight2 = offY;
+		_vm->_video->_splitStart = _vm->_video->_surfHeight - offY;
+
+		_vm->_video->_screenDeltaX = 0;
+		_vm->_video->_screenDeltaY = 0;
+
+		_vm->_global->_mouseMinX = 0;
+		_vm->_global->_mouseMinY = 0;
+		_vm->_global->_mouseMaxX = _vm->_width;
+		_vm->_global->_mouseMaxY = _vm->_height - _vm->_video->_splitHeight2 - 1;
+	}
+
 	_vm->_draw->closeScreen();
 	_vm->_util->clearPalette();
 	memset(_vm->_global->_redPalette, 0, 256);

Modified: scummvm/trunk/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v2.cpp	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/mult_v2.cpp	2008-05-03 20:08:46 UTC (rev 31846)
@@ -533,7 +533,7 @@
 		_animArrayData = new Mult_AnimData[_objCount];
 
 		memset(_objects, 0, _objCount * sizeof(Mult_Object));
-		memset(_orderArray, 0, _objCount * sizeof(int8));
+		memset(_orderArray, 0, _objCount * sizeof(uint8));
 		memset(_renderObjs, 0, _objCount * sizeof(Mult_Object *));
 		memset(_animArrayX, 0, _objCount * sizeof(int32));
 		memset(_animArrayY, 0, _objCount * sizeof(int32));

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/util.cpp	2008-05-03 20:08:46 UTC (rev 31846)
@@ -128,11 +128,11 @@
 	}
 
 	_vm->_global->_speedFactor = MIN(_fastMode + 1, 3);
-	if (scroll && hasMove) {
-		if (y >= (_vm->_height - _vm->_video->_splitHeight2)) {
-			y = _vm->_height - _vm->_video->_splitHeight2 - 1;
-			_vm->_util->setMousePos(x, y);
-		}
+	if (hasMove && scroll) {
+		x = CLIP(x, _vm->_global->_mouseMinX, _vm->_global->_mouseMaxX);
+		y = CLIP(y, _vm->_global->_mouseMinY, _vm->_global->_mouseMaxY);
+
+		_vm->_util->setMousePos(x - _vm->_video->_screenDeltaX, y - _vm->_video->_screenDeltaY);
 		_vm->_game->evaluateScroll(x, y);
 	}
 }
@@ -228,15 +228,15 @@
 
 void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) {
 	Common::Point mouse = g_system->getEventManager()->getMousePos();
-	*pX = mouse.x + _vm->_video->_scrollOffsetX;
-	*pY = mouse.y + _vm->_video->_scrollOffsetY;
+	*pX = mouse.x + _vm->_video->_scrollOffsetX - _vm->_video->_screenDeltaX;
+	*pY = mouse.y + _vm->_video->_scrollOffsetY - _vm->_video->_screenDeltaY;
 
 	if (pButtons != 0)
 		*pButtons = _mouseButtons;
 }
 
 void Util::setMousePos(int16 x, int16 y) {
-	g_system->warpMouse(x, y);
+	g_system->warpMouse(x + _vm->_video->_screenDeltaX, y + _vm->_video->_screenDeltaY);
 }
 
 void Util::waitMouseUp(void) {

Modified: scummvm/trunk/engines/gob/video.cpp
===================================================================
--- scummvm/trunk/engines/gob/video.cpp	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/video.cpp	2008-05-03 20:08:46 UTC (rev 31846)
@@ -95,6 +95,9 @@
 	_splitHeight2 = 0;
 	_splitStart = 0;
 
+	_screenDeltaX = 0;
+	_screenDeltaY = 0;
+
 	_curSparse = 0;
 	_lastSparse = 0xFFFFFFFF;
 }
@@ -142,9 +145,7 @@
 
 	if (flags & PRIMARY_SURFACE) {
 		_vm->_global->_primaryWidth = width;
-		_vm->_global->_mouseMaxCol = width;
 		_vm->_global->_primaryHeight = height;
-		_vm->_global->_mouseMaxRow = height;
 
 		descPtr = _vm->_global->_primarySurfDesc;
 		descPtr->resize(width, height);
@@ -160,17 +161,41 @@
 	return descPtr;
 }
 
+void Video::clearScreen() {
+	g_system->clearScreen();
+}
+
+void Video::setSize(bool defaultTo1XScaler) {
+	_vm->_system->beginGFXTransaction();
+		_vm->_system->initSize(_vm->_width, _vm->_height);
+		_vm->initCommonGFX(defaultTo1XScaler);
+	_vm->_system->endGFXTransaction();
+}
+
 void Video::retrace(bool mouse) {
 	if (mouse)
 		CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
 	if (_vm->_global->_primarySurfDesc) {
-		g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() +
-				_scrollOffsetY * _surfWidth + _scrollOffsetX, _surfWidth,
-				0, 0, _vm->_width, _splitHeight1);
-		if (_splitHeight2 > 0)
-			g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() +
-					_splitStart * _surfWidth, _surfWidth, 0,
-					_vm->_height - _splitHeight2, _vm->_width, _splitHeight2);
+		int screenOffset = _scrollOffsetY * _surfWidth + _scrollOffsetX;
+		int screenX = _screenDeltaX;
+		int screenY = _screenDeltaY;
+		int screenWidth = _vm->_width;
+		int screenHeight = _splitHeight1;
+
+		g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + screenOffset,
+				_surfWidth, screenX, screenY, screenWidth, screenHeight);
+
+		if (_splitHeight2 > 0) {
+			screenOffset = _splitStart * _surfWidth;
+			screenX = 0;
+			screenY = _vm->_height - _splitHeight2;
+			screenWidth = _vm->_width;
+			screenHeight = _splitHeight2;
+
+			g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + screenOffset,
+					_surfWidth, screenX, screenY, screenWidth, screenHeight);
+		}
+
 		g_system->updateScreen();
 	}
 }

Modified: scummvm/trunk/engines/gob/video.h
===================================================================
--- scummvm/trunk/engines/gob/video.h	2008-05-03 20:02:51 UTC (rev 31845)
+++ scummvm/trunk/engines/gob/video.h	2008-05-03 20:08:46 UTC (rev 31846)
@@ -104,11 +104,17 @@
 	int16 _splitHeight1;
 	int16 _splitHeight2;
 	int16 _splitStart;
+	int16 _screenDeltaX;
+	int16 _screenDeltaY;
 
 	void freeDriver();
 	void initPrimary(int16 mode);
 	SurfaceDesc *initSurfDesc(int16 vidMode, int16 width,
 			int16 height, int16 flags);
+
+	void setSize(bool defaultTo1XScaler);
+
+	void clearScreen();
 	void retrace(bool mouse = true);
 	void waitRetrace(bool mouse = true);
 	void sparseRetrace(int max);


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