[Scummvm-cvs-logs] SF.net SVN: scummvm: [22405] scummvm/trunk/engines/sword2/mouse.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Wed May 10 13:52:08 CEST 2006


Revision: 22405
Author:   eriktorbjorn
Date:     2006-05-10 13:50:59 -0700 (Wed, 10 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22405&view=rev

Log Message:
-----------
Removed hack that was used to limit the mouse cursor to (at most) 80x80 pixels.
That limit has been lifted from the SDL backend.

NOTE: This may cause problems in other backends!

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/mouse.cpp
Modified: scummvm/trunk/engines/sword2/mouse.cpp
===================================================================
--- scummvm/trunk/engines/sword2/mouse.cpp	2006-05-10 20:45:42 UTC (rev 22404)
+++ scummvm/trunk/engines/sword2/mouse.cpp	2006-05-10 20:50:59 UTC (rev 22405)
@@ -1439,10 +1439,6 @@
 		setLuggage(_realLuggageItem);
 }
 
-// This is the maximum mouse cursor size in the SDL backend
-#define MAX_MOUSE_W     80
-#define MAX_MOUSE_H     80
-
 #define MOUSEFLASHFRAME 6
 
 void Mouse::decompressMouse(byte *decomp, byte *comp, uint8 frame, int width, int height, int pitch, int xOff, int yOff) {
@@ -1473,8 +1469,6 @@
 }
 
 void Mouse::drawMouse() {
-	byte mouseData[MAX_MOUSE_W * MAX_MOUSE_H];
-
 	if (!_mouseAnim.data && !_luggageAnim.data)
 		return;
 
@@ -1517,24 +1511,11 @@
 	assert(deltaX >= 0);
 	assert(deltaY >= 0);
 
-	// HACK for maximum cursor size. (The SDL backend imposes this
-	// restriction)
-
-	if (mouse_width + deltaX > MAX_MOUSE_W)
-		deltaX = 80 - mouse_width;
-	if (mouse_height + deltaY > MAX_MOUSE_H)
-		deltaY = 80 - mouse_height;
-
 	mouse_width += deltaX;
 	mouse_height += deltaY;
 
-	if ((uint32)(mouse_width * mouse_height) > sizeof(mouseData)) {
-		warning("Mouse cursor too large");
-		return;
-	}
+	byte *mouseData = (byte *)calloc(mouse_height, mouse_width);
 
-	memset(mouseData, 0, mouse_width * mouse_height);
-
 	if (_luggageAnim.data)
 		decompressMouse(mouseData, _luggageAnim.data, 0,
 			_luggageAnim.mousew, _luggageAnim.mouseh,
@@ -1545,6 +1526,8 @@
 			_mouseAnim.mousew, _mouseAnim.mouseh, mouse_width);
 
 	_vm->_system->setMouseCursor(mouseData, mouse_width, mouse_height, hotspot_x, hotspot_y, 0);
+
+	free(mouseData);
 }
 
 /**


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