[Scummvm-cvs-logs] SF.net SVN: scummvm: [21407] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed Mar 22 15:39:02 CET 2006


Revision: 21407
Author:   kirben
Date:     2006-03-22 15:38:16 -0800 (Wed, 22 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21407&view=rev

Log Message:
-----------
Code for inverted rect when scaling images of FF no longer required. Minor cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/vga.cpp
Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-03-22 13:54:26 UTC (rev 21406)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-03-22 23:38:16 UTC (rev 21407)
@@ -1640,12 +1640,12 @@
 	_system->showMouse(true);
 	pollMouseXY();
 
-	if (_mouseX >= 32768)
+	if (_mouseX <= 0)
 		_mouseX = 0;
 	if (_mouseX >= _screenWidth - 1)
 		_mouseX = _screenWidth - 1;
 
-	if (_mouseY >= 32768)
+	if (_mouseY <= 0)
 		_mouseY = 0;
 	if (_mouseY >= _screenHeight - 1)
 		_mouseY = _screenHeight - 1;
@@ -3266,7 +3266,7 @@
 
 void SimonEngine::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d) {
 	byte *src, color;
-	uint w, h, i;
+	int w, h, i;
 
 	_lockWord |= 0x8000;
 	src = getFrontBuf() + ha->y * _dxSurfacePitch + ha->x;

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-03-22 13:54:26 UTC (rev 21406)
+++ scummvm/trunk/engines/simon/simon.h	2006-03-22 23:38:16 UTC (rev 21407)
@@ -295,8 +295,8 @@
 
 	uint _base_time;
 
-	uint _mouseX, _mouseY;
-	uint _mouseXOld, _mouseYOld;
+	int _mouseX, _mouseY;
+	int _mouseXOld, _mouseYOld;
 
 	Item *_dummyItem1;
 	Item *_dummyItem2;
@@ -309,7 +309,7 @@
 	uint16 _videoVar7;
 	volatile uint16 _paletteColorCount;
 
-	uint _screenWidth, _screenHeight;
+	int _screenWidth, _screenHeight;
 
 	byte _videoVar4;
 	bool _videoVar5;

Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp	2006-03-22 13:54:26 UTC (rev 21406)
+++ scummvm/trunk/engines/simon/vga.cpp	2006-03-22 23:38:16 UTC (rev 21407)
@@ -872,8 +872,7 @@
 				dst_org++;
 			} while (++w != state->draw_width);
 
-			_vgaCurSpritePriority /= 10;
-			if (_vgaCurSpritePriority != 900) {
+			if (_vgaCurSpritePriority % 10 != 9) {
 				_scaleX = state->x;
 				_scaleY = state->y;
 				_scaleWidth = state->width;
@@ -911,8 +910,7 @@
 				dst_org++;
 			} while (++w != state->draw_width);
 
-			_vgaCurSpritePriority /= 10;
-			if (_vgaCurSpritePriority == 900) {
+			if (_vgaCurSpritePriority % 10 == 9) {
 				scaleClip(_scaleHeight, _scaleWidth, _scaleY, _scaleX, _scaleY + _scrollY);
 			}
 		} else {
@@ -1033,10 +1031,10 @@
 	xscale = ((w * factor) / 2);
 
 	dstRect.left   = (int16)(x - xscale);
-	if (dstRect.left > 639)
+	if (dstRect.left > _screenWidth - 1)
 		return;
 	dstRect.top    = (int16)(y - (h * factor));
-	if (dstRect.top > 479)
+	if (dstRect.top > _screenHeight - 1)
 		return;
 
 	dstRect.right  = (int16)(x + xscale);
@@ -1049,49 +1047,28 @@
 	_variableArray[22] = _feebleRect.bottom;
 	_variableArray[23] = _feebleRect.right;
 
-	// Oddly enough, _feebleRect is sometimes (always?) "inverted". I do
-	// not know what effect, in any, this has in DirectDraw. For now,
-	// simply un-invert it. It does make the preliminary clipping above
-	// look rather strange, so it could be a bug in our code.
+	debug(0, "Left %d Right %d Top %d Bottom %d", dstRect.left, dstRect.right, dstRect.top, dstRect.bottom);
 
-	int top, bottom, left, right;
-
-	if (_feebleRect.top < _feebleRect.bottom) {
-		top = _feebleRect.top;
-		bottom = _feebleRect.bottom;
-	} else {
-		top = _feebleRect.bottom;
-		bottom = _feebleRect.top;
-	}
-
-	if (_feebleRect.left < _feebleRect.right) {
-		left = _feebleRect.left;
-		right = _feebleRect.right;
-	} else {
-		left = _feebleRect.right;
-		right = _feebleRect.left;
-	}
-
 	// Unlike normal rectangles in ScummVM, it seems that in the case of
 	// the destination rectangle the bottom and right coordinates are
 	// considered to be inside the rectangle. For the source rectangle,
 	// I believe that they are not.
 
-	int scaledW = right - left + 1;
-	int scaledH = bottom - top + 1;
+	int scaledW = dstRect.width() + 1;
+	int scaledH = dstRect.height() + 1;
 
 	byte *src = getScaleBuf();
 	byte *dst = getBackBuf();
 
-	dst = dst + _dxSurfacePitch * top + left;
+	dst += _dxSurfacePitch * dstRect.top + dstRect.left;
 
 	for (int dstY = 0; dstY < h; dstY++) {
-		if (top + dstY >= 0 && top + dstY < 480) {
+		if (dstRect.top + dstY >= 0 && dstRect.top + dstY < _screenHeight) {
 			int srcY = (dstY * h) / scaledH;
 			byte *srcPtr = src + _dxSurfacePitch * srcY;
 			byte *dstPtr = dst + _dxSurfacePitch * dstY;
 			for (int dstX = 0; dstX < w; dstX++) {
-				if (left + dstX >= 0 && left + dstX < 640) {
+				if (dstRect.left + dstX >= 0 && dstRect.left + dstX < _screenWidth) {
 					int srcX = (dstX * w) / scaledW;
 					if (srcPtr[srcX])
 						dstPtr[dstX] = srcPtr[srcX];


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