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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Tue Oct 24 09:44:44 CEST 2006


Revision: 24486
          http://svn.sourceforge.net/scummvm/?rev=24486&view=rev
Author:   kirben
Date:     2006-10-24 00:44:37 -0700 (Tue, 24 Oct 2006)

Log Message:
-----------
Add more menu code for Elvira 1

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/input.cpp
    scummvm/trunk/engines/agos/items.cpp
    scummvm/trunk/engines/agos/menus.cpp
    scummvm/trunk/engines/agos/midiparser_s1d.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-24 00:56:10 UTC (rev 24485)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-24 07:44:37 UTC (rev 24486)
@@ -561,6 +561,7 @@
 	void loadVoice(uint speechId);
 
 	int getUserFlag(Item *item, int a);
+	int getUserFlag1(Item *item, int a);
 	int getUserItem(Item *item, int n);
 	void setUserFlag(Item *item, int a, int b);
 	void setUserItem(Item *item, int n, int m);
@@ -696,11 +697,15 @@
 	int weightOf(Item *x);
 	void xPlace(Item *x, Item *y);
 
-	uint menuFor_e2(Item *item, uint id);
+	void drawMenuStrip(uint windowNum, uint menuNum);
+	void lightMenuStrip(int a);
+	void unlightMenuStrip();
+	void lightMenuBox(uint hitarea);
+
+	uint menuFor_e2(Item *item);
 	uint menuFor_ww(Item *item, uint id);
 	void clearMenuStrip();
 	void doMenuStrip(uint menuNum);
-	void drawMenuStrip(uint windowNum, uint menuNum);
 
 	void checkLinkBox();
  	void hyperLinkOn(uint16 x);

Modified: scummvm/trunk/engines/agos/input.cpp
===================================================================
--- scummvm/trunk/engines/agos/input.cpp	2006-10-24 00:56:10 UTC (rev 24485)
+++ scummvm/trunk/engines/agos/input.cpp	2006-10-24 07:44:37 UTC (rev 24486)
@@ -170,7 +170,7 @@
 
 	_leftButtonDown = 0;
 	_lastHitArea = 0;
-	_lastClickRem = 0;
+	//_lastClickRem = 0;
 	_verbHitArea = 0;
 	_hitAreaSubjectItem = NULL;
 	_hitAreaObjectItem = NULL;
@@ -263,10 +263,12 @@
 					break;
 				}
 
-				if (getGameType() == GType_ELVIRA2)
-					doMenuStrip(menuFor_e2(ha->item_ptr, id));
-				else if (getGameType() == GType_WW)
+				if (getGameType() == GType_WW)
 					doMenuStrip(menuFor_ww(ha->item_ptr, id));
+				else if (getGameType() == GType_ELVIRA2)
+					doMenuStrip(menuFor_e2(ha->item_ptr));
+				else if (getGameType() == GType_ELVIRA1)
+					lightMenuStrip(getUserFlag1(ha->item_ptr, 6));
 			} else {
 				// else 1
 				if (ha->verb == 0) {
@@ -303,6 +305,8 @@
 out_of_here:
 	if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
 		clearMenuStrip();
+	else if (getGameType() == GType_ELVIRA1)
+		unlightMenuStrip();
 
 	_nameLocked = 0;
 	_needHitAreaRecalc++;

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2006-10-24 00:56:10 UTC (rev 24485)
+++ scummvm/trunk/engines/agos/items.cpp	2006-10-24 07:44:37 UTC (rev 24486)
@@ -130,6 +130,22 @@
 	return	subUserFlag->userFlags[a];
 }
 
+int AGOSEngine::getUserFlag1(Item *item, int a) {
+	SubUserFlag *subUserFlag;
+
+	if (item == NULL || item == _dummyItem2 || item == _dummyItem3)
+		return -1;
+
+	subUserFlag = (SubUserFlag *) findChildOfType(item, 9);
+	if (subUserFlag == NULL)
+		return 0;
+
+	if (a < 0 || a > 7)
+		return 0;
+
+	return	subUserFlag->userFlags[a];
+}
+
 void AGOSEngine::setUserFlag(Item *item, int a, int b) {
 	SubUserFlag *subUserFlag;
 

Modified: scummvm/trunk/engines/agos/menus.cpp
===================================================================
--- scummvm/trunk/engines/agos/menus.cpp	2006-10-24 00:56:10 UTC (rev 24485)
+++ scummvm/trunk/engines/agos/menus.cpp	2006-10-24 07:44:37 UTC (rev 24486)
@@ -123,9 +123,72 @@
 	mouseOn();
 }
 
+void AGOSEngine::lightMenuStrip(int a) {
+	mouseOff();
+	unlightMenuStrip();
+
+	for (int i = 120; i != 130; i++) {
+		if (a == 0)
+			break;
+
+		if (a & (1 << i - 120)) {
+			enableBox(i);
+			lightMenuBox(i);
+		}
+	}
+
+	mouseOn();	
+}
+
+void AGOSEngine::unlightMenuStrip() {
+	byte *src;
+	int w, h, i;
+
+	mouseOff();
+
+	src = getFrontBuf() + 2832;
+	w = 48;
+	h = 82;
+
+	do {
+		for (i = 0; i != w; ++i) {
+			if (src[i] != 0)
+				src[i] = 14;
+		}
+		src += _dxSurfacePitch;
+	} while (--h);
+
+	for (i = 120; i != 130; i++)
+		disableBox(i);
+
+	mouseOn();
+}
+
+void AGOSEngine::lightMenuBox(uint hitarea) {
+	HitArea *ha = findBox(hitarea);
+	byte *src;
+	int w, h, i;
+
+	mouseOff();
+
+	src = getFrontBuf() + ha->y * _dxSurfacePitch + ha->x;
+	w = ha->width;
+	h = ha->height;
+
+	do {
+		for (i = 0; i != w; ++i) {
+			if (src[i] == 14)
+				src[i] = 15;
+		}
+		src += _dxSurfacePitch;
+	} while (--h);
+
+	mouseOn();
+}
+
 // Elvira 2 specific
-uint AGOSEngine::menuFor_e2(Item *item, uint id) {
-	if (id == 0 || id == 2462 || id == 2480)
+uint AGOSEngine::menuFor_e2(Item *item) {
+	if (item == NULL || item == _dummyItem2 || item == _dummyItem3)
 		return 0xFFFF;
  
 	SubObject *subObject = (SubObject *)findChildOfType(item, 2);
@@ -142,7 +205,7 @@
 	if (id != 0xFFFF && id < 10 && _textMenu[id] != 0)
 		return _textMenu[id];
 
-	if (item == NULL || itemPtrToID(item) == 542 || itemPtrToID(item) == 558)
+	if (item == NULL || item == _dummyItem2 || item == _dummyItem3)
 		return _agosMenu;
 
 	SubObject *subObject = (SubObject *)findChildOfType(item, 2);

Modified: scummvm/trunk/engines/agos/midiparser_s1d.cpp
===================================================================
--- scummvm/trunk/engines/agos/midiparser_s1d.cpp	2006-10-24 00:56:10 UTC (rev 24485)
+++ scummvm/trunk/engines/agos/midiparser_s1d.cpp	2006-10-24 07:44:37 UTC (rev 24486)
@@ -144,12 +144,12 @@
 			_position._play_pos += info.length;
 			break;
 		default:
-			debug(0, "MidiParser_S1D: Unexpected type 0x%02X found", (int) info.event);
+			debug(10, "MidiParser_S1D: Unexpected type 0x%02X found", (int) info.event);
 			break;
 		}
 		break;
 	default:
-		debug(0, "MidiParser_S1D: Unexpected event 0x%02X found", (int) info.command());
+		debug(10, "MidiParser_S1D: Unexpected event 0x%02X found", (int) info.command());
 		break;
 	}
 }


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