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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sun Apr 30 05:57:03 CEST 2006


Revision: 22243
Author:   kirben
Date:     2006-04-30 05:56:13 -0700 (Sun, 30 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22243&view=rev

Log Message:
-----------
Revert last change to mouse cursors in FF, causes odd glitches

Modified Paths:
--------------
    scummvm/trunk/engines/simon/cursor.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/cursor.cpp
===================================================================
--- scummvm/trunk/engines/simon/cursor.cpp	2006-04-30 08:50:19 UTC (rev 22242)
+++ scummvm/trunk/engines/simon/cursor.cpp	2006-04-30 12:56:13 UTC (rev 22243)
@@ -393,14 +393,15 @@
 	0,0,10,7,10,6,10,5,10,4,10,3,10,4,10,5,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
+// TODO: Convert to our mouse code in system
 void SimonEngine::drawMousePointer_FF() {
 	byte *dst;
 	uint curCursor;
-	int image, offs, pitch;
-	int hotSpotX, hotSpotY;
+	int image, offs;
+	int pitch;
 
-	dst = (byte *)calloc(80 * 80, 1);
-	pitch = 80;
+	dst = getBackBuf();
+	pitch = _screenWidth;
 
 	if (_animatePointer != 0) {
 		if (getBitFlag(99)) {
@@ -414,6 +415,31 @@
 			_mouseAnim = 1;
 	}
 
+	_mouseCountY = 40;
+	_mouseCountX = 40;
+
+	if (_mouseY < 19)
+		_mouseCountY -= 19 - _mouseY;
+	else
+		dst += (((_mouseY - 19) * (pitch / 16)) & 0xffff) * 16;
+
+	if (_mouseX < 38)
+		_mouseCountX -= 38 - _mouseX;
+	else
+		dst += _mouseX - 38;
+
+	if (_mouseCountY == 40) {
+		_mouseCountY = 499 - _mouseY;
+		if (_mouseCountY > 40)
+			_mouseCountY = 40;
+	}
+
+	if (_mouseCountX == 40) {
+		_mouseCountX = 659 - _mouseX;
+		if (_mouseCountX > 40)
+			_mouseCountX = 40;
+	}
+
 	curCursor = _mouseCursor;
 	if (_animatePointer == 0 && getBitFlag(99)) {
 		_mouseAnim = 1;
@@ -424,21 +450,18 @@
 
 	image = curCursor * 16 + 1;
 	offs = curCursor * 32;
-	drawMousePart(dst, pitch, image, offs, hotSpotX, hotSpotY);
+	drawMousePart(dst, pitch, image, offs);
 
 	image = curCursor * 16 + 1 + _mouseAnim;
 	offs = curCursor * 32 + _mouseAnim * 2;
-	drawMousePart(dst, pitch, image, offs, hotSpotX, hotSpotY);
-
-	_system->setMouseCursor(dst, 80, 80, hotSpotX, hotSpotY, 0);
-	free(dst);
+	drawMousePart(dst, pitch, image, offs);
 }
 
-void SimonEngine::drawMousePart(byte *dst, int pitch, int image, int offs, int &hotSpotX, int &hotSpotY) {
+void SimonEngine::drawMousePart(byte *dst, int pitch, int image, int offs) {
 	VgaPointersEntry *vpe = &_vgaBufferPointers[7];
 	byte *src;
-	int x, y, w, h;
-	int width, height;
+	int x, y, width, height;
+	int tmp, srcw;
 
 	x = _mouseOffs[offs];
 	y = _mouseOffs[offs + 1];
@@ -446,23 +469,76 @@
 	dst += y * pitch + x;
 
 	src = vpe->vgaFile2 + image * 8;
-	width = READ_LE_UINT16(src + 6);
+	srcw = width = READ_LE_UINT16(src + 6);
 	height = READ_LE_UINT16(src + 4);
 
 	src = vpe->vgaFile2 + readUint32Wrapper(src);
 
+	if (_mouseCountX != 40) {
+		if (_mouseX >= 600) {
+			tmp = _mouseOffs[offs] + width - _mouseCountX;
+			if (tmp >= 0) {
+				width -= tmp;
+				if (width <= 0)
+					return;
+			}
+		} else {
+			if (_mouseOffs[offs] + _mouseCountX >= 40) {
+				dst -= 40 - _mouseCountX;
+			} else {
+				dst -= _mouseOffs[offs];
+				tmp = -(_mouseOffs[offs] + _mouseCountX - 40);
+				width -= tmp;
+				if (width <= 0)
+					return;
+				src += tmp;
+			}
+		}
+	}
+
+	if (_mouseCountY != 40) {
+		if (_mouseY >= 200) {
+			tmp = _mouseOffs[offs + 1] + height - _mouseCountY;
+			if (tmp >= 0) {
+				height  -= tmp;
+				if (height <= 0)
+					return;
+			}
+		} else {
+			tmp = _mouseOffs[offs + 1] + _mouseCountY;
+			if (tmp >= 40) {
+				tmp = 40 - _mouseCountY;
+				while (tmp--)
+					dst -= pitch;
+			} else {
+				tmp = _mouseOffs[offs + 1];
+				while (tmp--)
+					dst -= pitch;
+				tmp = -(_mouseOffs[offs + 1] + _mouseCountY - 40);
+				height -= tmp;
+				if (height <= 0)
+					return;
+				while (tmp--)
+					src += srcw;
+			}
+		}
+	}
+
+	drawMouse(dst, pitch, src, srcw, width, height);
+}
+
+void SimonEngine::drawMouse(byte *dst, int pitch, byte *src, int srcw, int width, int height) {
+	int h, w;
+
 	for (h = 0; h < height; h++) {
 		for (w = 0; w < width; w++) {
 			if (src[w] != 0)
 				dst[w] = src[w];
 
 		}
-		src += width;
+		src += srcw;
 		dst += pitch;
 	}
-
-	hotSpotX = (x + width) / 2;
-	hotSpotY = (y + height) / 2;
 }
 
 } // End of namespace Simon

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-30 08:50:19 UTC (rev 22242)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-30 12:56:13 UTC (rev 22243)
@@ -31,6 +31,7 @@
 #include "gui/about.h"
 
 #include "simon/debugger.h"
+#include "simon/intern.h"
 #include "simon/simon.h"
 #include "simon/vga.h"
 
@@ -163,7 +164,6 @@
 	_mouseAnimMax = 0;
 	_oldMouseCursor = 0;
 	_oldMouseAnimMax = 0;
-	_mouseToggle = false;
 
 	_vgaVar9 = 0;
 	_chanceModifier = 0;

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-30 08:50:19 UTC (rev 22242)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-30 12:56:13 UTC (rev 22243)
@@ -325,6 +325,7 @@
 	byte _mouseCursor, _mouseAnim, _mouseAnimMax;
 	byte _oldMouseCursor, _oldMouseAnimMax;
 	uint _mouseHideCount;
+	int _mouseCountX, _mouseCountY;
 	bool _mouseToggle;
 
 	byte _leftButtonDown;
@@ -674,8 +675,10 @@
 	void pollMouseXY();
 	void drawMousePointer();
 	void drawMousePointer_FF();
-	void drawMousePart(byte *dst, int pitch, int image, int offs, int &hotSpotX, int &hotSpotY);
+	void drawMouse(byte *dst, int pitch, byte *src, int srcw, int width, int height);
+	void drawMousePart(byte *dst, int pitch, int image, int offs);
 
+
 	void defineArrowBoxes(WindowBlock *window);
 	void removeArrows(WindowBlock *window, uint num);
 


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