[Scummvm-cvs-logs] SF.net SVN: scummvm: [22631] scummvm/trunk/backends/sdl

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Thu May 25 12:44:03 CEST 2006


Revision: 22631
Author:   wjpalenstijn
Date:     2006-05-25 12:43:33 -0700 (Thu, 25 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22631&view=rev

Log Message:
-----------
fix hotspot handling when overlay visible

Modified Paths:
--------------
    scummvm/trunk/backends/sdl/graphics.cpp
    scummvm/trunk/backends/sdl/sdl-common.h
    scummvm/trunk/backends/sdl/sdl.cpp
Modified: scummvm/trunk/backends/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/sdl/graphics.cpp	2006-05-25 19:38:35 UTC (rev 22630)
+++ scummvm/trunk/backends/sdl/graphics.cpp	2006-05-25 19:43:33 UTC (rev 22631)
@@ -1271,8 +1271,8 @@
 	if (w == 0 || h == 0)
 		return;
 
-	_mouseHotspotX = hotspot_x;
-	_mouseHotspotY = hotspot_y;
+	_mouseCurState.hotX = hotspot_x;
+	_mouseCurState.hotY = hotspot_y;
 
 	_mouseKeyColor = keycolor;
 
@@ -1353,18 +1353,26 @@
 		dstPtr += _mouseOrigSurface->pitch - w * 2;
   	}
 
-	int hW, hH, hH1;
+	int hW, hH;
 
 	if (_cursorTargetScale >= _scaleFactor) {
 		hW = w;
-		hH = hH1 = h;
+		hH = h;
+		_mouseCurState.hHotX = _mouseCurState.hotX;
+		_mouseCurState.hHotY = _mouseCurState.hotY;
 	} else {
 		hW = w * _scaleFactor / _cursorTargetScale;
-		hH = hH1 = h * _scaleFactor / _cursorTargetScale;
+		hH = h * _scaleFactor / _cursorTargetScale;
+		_mouseCurState.hHotX = _mouseCurState.hotX * _scaleFactor /
+			_cursorTargetScale;
+		_mouseCurState.hHotY = _mouseCurState.hotY * _scaleFactor /
+			_cursorTargetScale;
   	}
 
+	int hH1 = hH; // store original to pass to aspect-correction function later
 	if (_adjustAspectRatio && _cursorTargetScale == 1) {
 		hH = real2Aspect(hH - 1) + 1;
+		_mouseCurState.hHotY = real2Aspect(_mouseCurState.hHotY);
 	}
 
 	if (_mouseCurState.hW != hW || _mouseCurState.hH != hH) {
@@ -1473,22 +1481,16 @@
 		scale = _scaleFactor;
 		width = _screenWidth;
 		height = _screenHeight;
+		dst.x = _mouseCurState.x - _mouseCurState.hotX;
+		dst.y = _mouseCurState.y - _mouseCurState.hotY;
 	} else {
 		scale = 1;
 		width = _overlayWidth;
 		height = _overlayHeight;
+		dst.x = _mouseCurState.x - _mouseCurState.hHotX;
+		dst.y = _mouseCurState.y - _mouseCurState.hHotY;
 	}
 
-	useCursorScaling = (scale >= _cursorTargetScale);
-
-	if (useCursorScaling) {
-		dst.x = _mouseCurState.x - _mouseHotspotX / _cursorTargetScale;
-		dst.y = _mouseCurState.y - _mouseHotspotY / _cursorTargetScale;
-	} else {
-		dst.x = _mouseCurState.x - _mouseHotspotX;
-		dst.y = _mouseCurState.y - _mouseHotspotY;
-	}
-
 	if (_overlayVisible) {
 		dst.w = _mouseCurState.hW;
 		dst.h = _mouseCurState.hH;

Modified: scummvm/trunk/backends/sdl/sdl-common.h
===================================================================
--- scummvm/trunk/backends/sdl/sdl-common.h	2006-05-25 19:38:35 UTC (rev 22630)
+++ scummvm/trunk/backends/sdl/sdl-common.h	2006-05-25 19:43:33 UTC (rev 22631)
@@ -293,8 +293,10 @@
 	};
 
 	struct MousePos {
-		int16 x, y, w, h, hW, hH;
-		MousePos() : x(0), y(0), w(0), h(0), hW(0), hH(0) {}
+		int16 x, y, w, h, hotX, hotY, hW, hH, hHotX, hHotY;
+		MousePos() : x(0), y(0), w(0), h(0), hotX(0), hotY(0),
+		             hW(0), hH(0), hHotX(0), hHotY(0)
+			{ }
 	};
 
 	// mouse
@@ -304,8 +306,6 @@
 	byte *_mouseData;
 	SDL_Rect _mouseBackup;
 	MousePos _mouseCurState;
-	int16 _mouseHotspotX;
-	int16 _mouseHotspotY;
 	byte _mouseKeyColor;
 	int _cursorTargetScale;
 	bool _cursorPaletteDisabled;

Modified: scummvm/trunk/backends/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/sdl/sdl.cpp	2006-05-25 19:38:35 UTC (rev 22630)
+++ scummvm/trunk/backends/sdl/sdl.cpp	2006-05-25 19:43:33 UTC (rev 22631)
@@ -180,8 +180,7 @@
 	_samplesPerSec(0),
 	_cdrom(0), _scalerProc(0), _modeChanged(false), _dirtyChecksums(0),
 	_mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0),
-	_mouseOrigSurface(0), _mouseHotspotX(0), _mouseHotspotY(0), _cursorTargetScale(1),
-	_cursorPaletteDisabled(true),
+	_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
 	_joystick(0),
 	_currentShakePos(0), _newShakePos(0),
 	_paletteDirtyStart(0), _paletteDirtyEnd(0),


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