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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Oct 16 13:20:30 CEST 2006


Revision: 24349
          http://svn.sourceforge.net/scummvm/?rev=24349&view=rev
Author:   kirben
Date:     2006-10-16 04:20:20 -0700 (Mon, 16 Oct 2006)

Log Message:
-----------
Enable menus in Elvira 2

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/game.cpp
    scummvm/trunk/engines/agos/menus.cpp
    scummvm/trunk/engines/agos/verb.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-16 09:44:47 UTC (rev 24348)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-16 11:20:20 UTC (rev 24349)
@@ -712,6 +712,7 @@
 
 	_stringIdLocalMin = 1;
 
+	_agosMenu = 1;
 	_superRoomNumber = 1;
 
 	for (int i = 0; i < 20; i++) {
@@ -1173,6 +1174,9 @@
 
 	_noRightClick = 1;
 
+	if (getGameType() == GType_WW)
+		clearMenuStrip();
+
 	if (getGameType() == GType_FF) {
 		int cursor = 5;
 		int animMax = 16;
@@ -1423,8 +1427,10 @@
 					break;
 				}
 
-				if (getGameType() == GType_WW)
-					doMenuStrip(menuFor(ha->item_ptr, id));
+				if (getGameType() == GType_ELVIRA2)
+					doMenuStrip(menuFor_e2(ha->item_ptr, id));
+				else if (getGameType() == GType_WW)
+					doMenuStrip(menuFor_ww(ha->item_ptr, id));
 			} else {
 				// else 1
 				if (ha->verb == 0) {
@@ -1443,6 +1449,9 @@
 		}
 	}
 
+	if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
+		clearMenuStrip();
+
 	_needHitAreaRecalc++;
 }
 

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-16 09:44:47 UTC (rev 24348)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-16 11:20:20 UTC (rev 24349)
@@ -655,11 +655,11 @@
 	TextLocation *getTextLocation(uint a);
 	void setup_cond_c_helper();
 
-	void drawMenuStrip(uint windowNum, uint menuNum);
-
-	uint menuFor(Item *item, uint id);
+	uint menuFor_e2(Item *item, uint id);
+	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/game.cpp
===================================================================
--- scummvm/trunk/engines/agos/game.cpp	2006-10-16 09:44:47 UTC (rev 24348)
+++ scummvm/trunk/engines/agos/game.cpp	2006-10-16 11:20:20 UTC (rev 24349)
@@ -198,6 +198,7 @@
 static const ADGameFileDescription ELVIRA2AMIGA_GameFiles[] = {
 	{ "gameamiga",		GAME_BASEFILE,	"4aa163967f5d2bd319f8350d6af03186"},
 	{ "icon.dat",		GAME_ICONFILE,	"a88b1c02e13ab04dd790ec30502c323d"},
+	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
 	{ "stripped.txt",	GAME_STRFILE,	"41c975a9c1106cb5298a0bc3df0a266e"},
 	{ "tbllist",		GAME_TBLFILE,	"177f5f2640e80ef92d1421d32de06a5e"},
 };
@@ -213,6 +214,7 @@
 static const ADGameFileDescription ELVIRA2DOS_GameFiles[] = {
 	{ "gamepc",		GAME_BASEFILE,	"3313254722031b22d833a2cf45a91fd7"},
 	{ "icon.dat",		GAME_ICONFILE,	"83a7278bff55c82fbb3aef92981866c9"},
+	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
 	{ "stripped.txt",	GAME_STRFILE,	"c2533277b7ff11f5495967d55355ea17"},
 	{ "tbllist",		GAME_TBLFILE,	"8252660df0edbdbc3e6377e155bbd0c5"},
 };
@@ -220,6 +222,7 @@
 static const ADGameFileDescription ELVIRA2DOS_FR_GameFiles[] = {
 	{ "gamepc",		GAME_BASEFILE,	"4bf28ab00f5324fd938e632595742382"},
 	{ "icon.dat",		GAME_ICONFILE,	"83a7278bff55c82fbb3aef92981866c9"},
+	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
 	{ "stripped.txt",	GAME_STRFILE,	"c3a8f644551a27c8a2fec0f8070b46b7"},
 	{ "tbllist",		GAME_TBLFILE,	"8252660df0edbdbc3e6377e155bbd0c5"},
 };

Modified: scummvm/trunk/engines/agos/menus.cpp
===================================================================
--- scummvm/trunk/engines/agos/menus.cpp	2006-10-16 09:44:47 UTC (rev 24348)
+++ scummvm/trunk/engines/agos/menus.cpp	2006-10-16 11:20:20 UTC (rev 24349)
@@ -123,15 +123,35 @@
 	mouseOn();
 }
 
-// Waxworks specific?
-uint AGOSEngine::menuFor(Item *item, uint id) {
-	if (id != 0xFFFF && id < 10 && _textMenu[id] != 0) {
+// Elvira 2 specific
+uint AGOSEngine::menuFor_e2(Item *item, uint id) {
+	if (id = 0 || id == 2462 || id == 2480)
+		return 0xFFFF;
+ 
+	SubObject *subObject = (SubObject *)findChildOfType(item, 2);
+	if (subObject != NULL && subObject->objectFlags & kOFMenu) {
+		uint offs = getOffsetOfChild2Param(subObject, kOFMenu);
+		return subObject->objectFlagValue[offs];
+	}
+
+	return _agosMenu;
+}
+
+// Waxworks specific
+uint AGOSEngine::menuFor_ww(Item *item, uint id) {
+	if (id != 0xFFFF && id < 10 && _textMenu[id] != 0)
 		return _textMenu[id];
-	} else {
-		// TODO
+
+	if (item == NULL || itemPtrToID(item) == 542 || itemPtrToID(item) == 558)
+		return _agosMenu;
+
+	SubObject *subObject = (SubObject *)findChildOfType(item, 2);
+	if (subObject != NULL && subObject->objectFlags & kOFMenu) {
+		uint offs = getOffsetOfChild2Param(subObject, kOFMenu);
+		return subObject->objectFlagValue[offs];
 	}
 
-	return 0;
+	return _agosMenu;
 }
 
 void AGOSEngine::clearMenuStrip() {
@@ -143,13 +163,15 @@
 	set_video_mode_internal(2, 101);
 }
 
+// Elvira 2 and Waxworks specific
 void AGOSEngine::doMenuStrip(uint menuNum) {
-	int i;
+	uint i;
+	const uint var = (getGameType() == GType_WW) ? 11 : 1;
 
 	for (i = 111; i != 115; i++)
 		disableBox(i);
 
-	for (i = 11; i != 16; i++)
+	for (i = var; i != (var + 5); i++)
 		_variableArray[i] = 0;
 
 	byte *srcPtr = _menuBase;
@@ -160,11 +182,11 @@
 	}
 
 	uint id = 111;
-	uint var = 11;
+	uint v = var;
 
 	while (READ_BE_UINT16(srcPtr) != 0) {
 		uint verb = READ_BE_UINT16(srcPtr);
-		_variableArray[var] = verb;
+		_variableArray[v] = verb;
 
 		HitArea *ha = findBox(id);
 		if (ha != NULL) {
@@ -174,11 +196,15 @@
 
 		id++;
 		srcPtr += 2;
-		var++;
+		v++;
 	}
 
-	_variableArray[15] = id - 111;
-	set_video_mode_internal(2, 102);
+	_variableArray[var + 4] = id - 111;
+	if (getGameType() == GType_WW) {
+		set_video_mode_internal(2, 102);
+	} else {
+		set_video_mode_internal(2, 103);
+	}
 }
 
 } // End of namespace AGOS

Modified: scummvm/trunk/engines/agos/verb.cpp
===================================================================
--- scummvm/trunk/engines/agos/verb.cpp	2006-10-16 09:44:47 UTC (rev 24348)
+++ scummvm/trunk/engines/agos/verb.cpp	2006-10-16 11:20:20 UTC (rev 24349)
@@ -462,6 +462,9 @@
 }
 
 void AGOSEngine::resetVerbs() {
+	if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
+		return;
+
 	if (getGameType() == GType_PP) {
 		_verbHitArea = 300;
 	} else if (getGameType() == GType_FF) {


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