[Scummvm-cvs-logs] SF.net SVN: scummvm: [24361] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed Oct 18 13:53:05 CEST 2006


Revision: 24361
          http://svn.sourceforge.net/scummvm/?rev=24361&view=rev
Author:   kirben
Date:     2006-10-18 04:52:55 -0700 (Wed, 18 Oct 2006)

Log Message:
-----------
Add mouse cursors for WW

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/cursor.cpp
    scummvm/trunk/engines/agos/res_ami.cpp
    scummvm/trunk/engines/agos/verb.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-17 11:02:42 UTC (rev 24360)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-18 11:52:55 UTC (rev 24361)
@@ -204,6 +204,7 @@
 
 	_currentBoxNumber = 0;
 	_iOverflow = 0;
+	_nameLocked = 0;
 	_hitAreaObjectItem = 0;
 	_lastHitArea = 0;
 	_lastNameOn = 0;
@@ -1228,6 +1229,7 @@
 
 	_lastHitArea = 0;
 	_hitAreaObjectItem = NULL;
+	_nameLocked = 0;
 
 	last = _lastNameOn;
 	clearName();
@@ -1332,11 +1334,15 @@
 	_verbHitArea = 0;
 	_hitAreaSubjectItem = NULL;
 	_hitAreaObjectItem = NULL;
+	_nameLocked = 0;
 
-	if (getGameType() == GType_WW)
+	if (getGameType() == GType_WW) {
+		_mouseCursor = 0;
+		_needHitAreaRecalc++;
 		clearMenuStrip();
-	else
+	} else {
 		resetVerbs();
+	}
 
 startOver:
 	for (;;) {
@@ -1376,6 +1382,9 @@
 			_defaultVerb = 0;
 		} else {
 			if (getGameType() == GType_WW) {
+				if (_mouseCursor == 3)
+					_verbHitArea = 236;
+
 				if (ha->id == 98) {
 					loadSprite(2, 0, 110, 0, 0, 0);
 					waitForSync(34);
@@ -1421,7 +1430,10 @@
 					_variableArray[10] = id;
 				else
 					_variableArray[60] = id;
+
+				_nameLocked = 2;
 				displayName(ha);
+				_nameLocked = 1;
 
 				if (_verbHitArea != 0) {
 					break;
@@ -1437,6 +1449,11 @@
 					if (ha->item_ptr)
 						goto if_1;
 				} else {
+					if (getGameType() == GType_WW && _mouseCursor != 0 && _mouseCursor < 4) {
+						_hitAreaSubjectItem = ha->item_ptr;
+						break;
+					}
+
 					_verbHitArea = ha->verb & 0xBFFF;
 					if (ha->verb & 0x4000) {
 						_hitAreaSubjectItem = ha->item_ptr;
@@ -1444,6 +1461,16 @@
 					}
 					if (_hitAreaSubjectItem != NULL)
 						break;
+
+					if (getGameType() == GType_WW) {
+						if (ha->id == 109) {
+							_mouseCursor = 2;
+							_needHitAreaRecalc++;
+						} else if (ha->id == 117) {
+							_mouseCursor = 3;
+							_needHitAreaRecalc++;
+						}
+					}
 				}
 			}
 		}
@@ -1452,6 +1479,7 @@
 	if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
 		clearMenuStrip();
 
+	_nameLocked = 0;
 	_needHitAreaRecalc++;
 }
 

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-17 11:02:42 UTC (rev 24360)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-18 11:52:55 UTC (rev 24361)
@@ -340,6 +340,7 @@
 	uint16 _defaultVerb;
 	uint _currentBoxNumber;
 	uint _iOverflow;
+	uint _nameLocked;
 
 	uint16 _windowNum;
 

Modified: scummvm/trunk/engines/agos/cursor.cpp
===================================================================
--- scummvm/trunk/engines/agos/cursor.cpp	2006-10-17 11:02:42 UTC (rev 24360)
+++ scummvm/trunk/engines/agos/cursor.cpp	2006-10-18 11:52:55 UTC (rev 24361)
@@ -31,6 +31,52 @@
 
 namespace AGOS {
 
+static const uint16 _common_cursors[7][32] = {
+// Mouse Info
+{	0xC000, 0x8000, 0xE000, 0xC000, 0xF000, 0xE000, 0xF800, 0xF000,
+	0xFC00, 0xF800, 0xFE00, 0xFC00, 0xFC00, 0xF000, 0x9800, 0x9000,
+ 	0x0C00, 0x0800, 0x0C00, 0x0800, 0x0600, 0x0400, 0x0000, 0x0000,
+	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+
+// Hand Info
+{	0x01C0, 0x01C0, 0x07F0, 0x0770, 0x07F0, 0x0550, 0x07FC, 0x055C,
+	0x07FC, 0x0554, 0x3FFC, 0x3D54, 0x3FFC, 0x2554, 0x3FFE, 0x2402,
+	0x1FFC, 0x1204, 0x1FFC, 0x1004, 0x0FF8, 0x0808, 0x07F8, 0x0408,
+	0x03F8, 0x03F8, 0x03F8, 0x0208, 0x03F8, 0x03F8, 0x0000, 0x0000 },
+
+// Sword Info
+{
+	0x0000, 0x0000, 0xC000, 0x4000, 0xF000, 0x7000, 0x7800, 0x3800,
+	0x3C00, 0x1C00, 0x1E00, 0x0E00, 0x0F00, 0x0700, 0x0780, 0x0380,
+	0x3C6,  0x01C0, 0x01FF, 0x00E6, 0x00FE, 0x007C, 0x007C, 0x0038,
+	0x0FC,  0x0078, 0x01FE, 0x00CC, 0x01CF, 0x0086, 0x0086, 0x0000 },
+
+// Move Forward
+{	0x0180, 0x0100, 0x03C0, 0x0380, 0x07E0, 0x07C0, 0x0FF0, 0x0FE0,
+	0x1FF8, 0x1FF0, 0x03C0, 0x0380, 0x03C0, 0x0380, 0x03C0, 0x0380,
+	0x3C0,  0x0380, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+
+// Mouse Right
+{	0x00C0, 0x0080, 0x00E0, 0x00C0, 0x00F0, 0x00E0, 0x1FF8, 0x1FF0,
+	0x3FFC, 0x3FF8, 0x3FF8, 0x3FF0, 0x3CF0, 0x38E0, 0x3CE0, 0x38C0,
+	0x3CC0, 0x3880, 0x3C00, 0x3800, 0x3C00, 0x3800, 0x0000, 0x0000,
+	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+
+// Mouse Back
+{	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+	0x03C0, 0x0380, 0x03C0, 0x0380, 0x03C0, 0x0380, 0x03C0, 0x0380,
+	0x1FF8, 0x1FF0, 0x0FF0, 0x0FE0, 0x07E0, 0x07C0, 0x03C0, 0x0380,
+	0x0180, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+
+// Move Left
+{	0x0C00, 0x0800, 0x1C00, 0x1800, 0x3C00, 0x3800, 0x7FE0, 0x7FC0,
+	0xFFF0, 0xFFE0, 0x7FF0, 0x7FE0, 0x3CF0, 0x38E0, 0x1CF0, 0x18E0,
+	0x0CF0, 0x08E0, 0x00F0, 0x00E0, 0x00F0, 0x00E0, 0x0000, 0x0000,
+	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+
+};
+
 #ifdef PALMOS_68K
 static const byte *_simon1_cursor;
 #else
@@ -402,6 +448,10 @@
 		_maxCursorWidth = 40;
 		_maxCursorHeight = 40;
 		_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+	} else if (getGameType() != GType_SIMON1 && getGameType() != GType_SIMON2) {
+		_maxCursorWidth = 16;
+		_maxCursorHeight = 16;
+		_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
 	}
 }
 
@@ -418,8 +468,31 @@
 		CursorMan.replaceCursor(_mouseData, _maxCursorWidth, _maxCursorHeight, 37, 48, 0);
 	} else if (getGameType() == GType_SIMON2) {
 		CursorMan.replaceCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7);
+	} else if (getGameType() == GType_SIMON1) {
+		CursorMan.replaceCursor(_simon1_cursor, 16, 16, 0, 0);
 	} else {
-		CursorMan.replaceCursor(_simon1_cursor, 16, 16, 0, 0);
+		const uint16 *src;
+		int i, j;
+
+		memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
+
+		uint cursor = (_mouseCursor == 0) ? _mouseCursor : _mouseCursor - 1;
+		src = _common_cursors[cursor];
+
+		for (i = 0; i < 16; i++) {
+			for (j = 0; j < 16; j++) {
+				if (src[0] & (1 << (15 - (j % 16)))) {
+					if (src[1] & (1 << (15 - (j % 16)))) {
+						_mouseData[16 * i + j] = 65;
+					} else {
+						_mouseData[16 * i + j] = 0;
+					}
+				}
+			}
+			src += 2;
+		}
+
+		CursorMan.replaceCursor(_mouseData, 16, 16, 0, 0, 0xFF);
 	}
 }
 

Modified: scummvm/trunk/engines/agos/res_ami.cpp
===================================================================
--- scummvm/trunk/engines/agos/res_ami.cpp	2006-10-17 11:02:42 UTC (rev 24360)
+++ scummvm/trunk/engines/agos/res_ami.cpp	2006-10-18 11:52:55 UTC (rev 24361)
@@ -253,7 +253,7 @@
 				word2 <<= 1;
 				word3 <<= 1;
 				word4 <<= 1;
-				*clipoutptr++ = outbyte * 16 + outbyte1; bufoutend++;
+				*clipoutptr++ = (outbyte * 16 + outbyte1); bufoutend++;
 			}
 		}
 	}

Modified: scummvm/trunk/engines/agos/verb.cpp
===================================================================
--- scummvm/trunk/engines/agos/verb.cpp	2006-10-17 11:02:42 UTC (rev 24360)
+++ scummvm/trunk/engines/agos/verb.cpp	2006-10-18 11:52:55 UTC (rev 24361)
@@ -177,6 +177,12 @@
 };
 
 void AGOSEngine::clearName() {
+	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
+		return;
+
+	//if (_nameLocked == 1)
+	//	return;
+
 	HitArea *last;
 	HitArea *ha;
 
@@ -738,6 +744,9 @@
 
 	if (best_ha == NULL) {
 		clearName();
+		if (getGameType() == GType_WW && _mouseCursor >= 4)
+			_mouseCursor = 0;
+
 		return;
 	}
 
@@ -761,12 +770,25 @@
 		} 
 	}
 
-	if (best_ha->flags & kBFNoTouchName) {
-		clearName();
-	} else if (best_ha != _lastNameOn) {
-		displayName(best_ha);
+	if ((getGameType() == GType_WW) && (_mouseCursor == 0 || _mouseCursor >= 4)) {
+		uint verb = best_ha->verb & 0x3FFF;
+		if  (verb >= 239 && verb <= 242) {
+			uint cursor = verb - 235;
+			if (_mouseCursor != cursor) {
+				_mouseCursor = cursor;
+				_needHitAreaRecalc++;
+			}
+		}
 	}
 
+	//if (_nameLocked == 0) {
+		if (best_ha->flags & kBFNoTouchName) {
+			clearName();
+		} else if (best_ha != _lastNameOn) {
+			displayName(best_ha);
+		}
+	//}
+
 	if (best_ha->flags & kBFInvertTouch && !(best_ha->flags & kBFBoxSelected)) {
 		hitarea_leave(best_ha, false);
 		best_ha->flags |= kBFBoxSelected;
@@ -776,6 +798,9 @@
 }
 
 void AGOSEngine::displayName(HitArea *ha) {
+	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
+		return;
+
 	bool result;
 	int x = 0, y = 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