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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed Oct 4 09:10:30 CEST 2006


Revision: 24106
          http://svn.sourceforge.net/scummvm/?rev=24106&view=rev
Author:   kirben
Date:     2006-10-04 00:10:22 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
Fix initial resource loading in Elvira 2

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/intern.h
    scummvm/trunk/engines/agos/items.cpp
    scummvm/trunk/engines/agos/res.cpp
    scummvm/trunk/engines/agos/subroutine.cpp
    scummvm/trunk/engines/agos/vga.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-04 05:16:44 UTC (rev 24105)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-04 07:10:22 UTC (rev 24106)
@@ -611,6 +611,18 @@
 		_tableMemSize = 150000;
 		_vgaBaseDelay = 1;
 		_numVars = 255;
+	} else if (getGameType() == GType_ELVIRA2) {
+		gss = PTR(simon1_settings);
+		_numTextBoxes = 20;
+		_numVideoOpcodes = 56;
+#ifndef PALMOS_68K
+		_vgaMemSize = 1000000;
+#else
+		_vgaMemSize = gVars->memory[kMemSimon1Games];
+#endif
+		_tableMemSize = 50000;
+		_vgaBaseDelay = 1;
+		_numVars = 512;
 	} else if (getGameType() == GType_ELVIRA) {
 		gss = PTR(simon1_settings);
 		_numTextBoxes = 20;

Modified: scummvm/trunk/engines/agos/intern.h
===================================================================
--- scummvm/trunk/engines/agos/intern.h	2006-10-04 05:16:44 UTC (rev 24105)
+++ scummvm/trunk/engines/agos/intern.h	2006-10-04 07:10:22 UTC (rev 24106)
@@ -40,6 +40,14 @@
 	uint16 flags;
 };
 
+struct SubSuperRoom : Child {
+	uint16 subroutine_id;
+	uint16 roomX;
+	uint16 roomY;
+	uint16 roomZ;
+	uint16 roomExit[1];
+};
+
 struct SubObject : Child {
 	uint16 objectName;
 	uint16 objectSize;
@@ -77,6 +85,7 @@
 
 enum {
 	SubRoom_SIZE = sizeof(SubRoom) - sizeof(uint16),
+	SubSuperRoom_SIZE = sizeof(SubSuperRoom) - sizeof(uint16),
 	SubObject_SIZE = sizeof(SubObject) - sizeof(int16)
 };
 

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2006-10-04 05:16:44 UTC (rev 24105)
+++ scummvm/trunk/engines/agos/items.cpp	2006-10-04 07:10:22 UTC (rev 24106)
@@ -2618,7 +2618,7 @@
 		if (_continousMainScript)
 			dumpOpcode(_codePtr);
 
-		if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+		if (getGameType() == GType_ELVIRA) {
 			opcode = getVarOrWord();
 			if (opcode == 10000)
 				return 0;
@@ -2634,7 +2634,7 @@
 
 		/* Invert condition? */
 		flag = false;
-		if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+		if (getGameType() == GType_ELVIRA) {
 			if (opcode == 203) {
 				flag = true;
 				opcode = getVarOrWord();

Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp	2006-10-04 05:16:44 UTC (rev 24105)
+++ scummvm/trunk/engines/agos/res.cpp	2006-10-04 07:10:22 UTC (rev 24106)
@@ -262,7 +262,7 @@
 void AGOSEngine::readItemFromGamePc(Common::File *in, Item *item) {
 	uint32 type;
 
-	if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+	if (getGameType() == GType_ELVIRA) {
 		item->itemName = (uint16)in->readUint32BE();
 		item->adjective = in->readUint16BE();
 		item->noun = in->readUint16BE();
@@ -276,6 +276,17 @@
 		in->readUint16BE();
 		item->classFlags = in->readUint16BE();
 		item->children = NULL;
+	} else if (getGameType() == GType_ELVIRA2) {
+		item->itemName = (uint16)in->readUint32BE();
+		item->adjective = in->readUint16BE();
+		item->noun = in->readUint16BE();
+		item->state = in->readUint16BE();
+		item->sibling = (uint16)fileReadItemID(in);
+		item->child = (uint16)fileReadItemID(in);
+		item->parent = (uint16)fileReadItemID(in);
+		in->readUint16BE();
+		item->classFlags = in->readUint16BE();
+		item->children = NULL;
 	} else {
 		item->adjective = in->readUint16BE();
 		item->noun = in->readUint16BE();
@@ -299,7 +310,7 @@
 
 void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) {
 	if (type == 1) {
-		if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+		if (getGameType() == GType_ELVIRA) {
 			SubRoom *subRoom = (SubRoom *)allocateChildBlock(item, 1, sizeof(SubRoom));
 			subRoom->roomShort = in->readUint32BE();
 			subRoom->roomLong = in->readUint32BE();
@@ -325,7 +336,7 @@
 					subRoom->roomExit[k++] = (uint16)fileReadItemID(in);
 		}
 	} else if (type == 2) {
-		if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+		if (getGameType() == GType_ELVIRA) {
 			SubObject *subObject = (SubObject *)allocateChildBlock(item, 2, sizeof(SubObject));
 			in->readUint32BE();
 			in->readUint32BE();
@@ -355,22 +366,48 @@
 				if (fr & (1 << i))
 					subObject->objectFlagValue[k++] = in->readUint16BE();
 
-			subObject->objectName = (uint16)in->readUint32BE();
+			if (getGameType() != GType_ELVIRA2)
+				subObject->objectName = (uint16)in->readUint32BE();
 		}
 	} else if (type == 4) {
-		SubGenExit *genExit = (SubGenExit *)allocateChildBlock(item, 4, sizeof(SubGenExit));
-		genExit->dest[0] = (uint16)fileReadItemID(in);
-		genExit->dest[1] = (uint16)fileReadItemID(in);
-		genExit->dest[2] = (uint16)fileReadItemID(in);
-		genExit->dest[3] = (uint16)fileReadItemID(in);
-		genExit->dest[4] = (uint16)fileReadItemID(in);
-		genExit->dest[5] = (uint16)fileReadItemID(in);
-		fileReadItemID(in);
-		fileReadItemID(in);
-		fileReadItemID(in);
-		fileReadItemID(in);
-		fileReadItemID(in);
-		fileReadItemID(in);
+		if (getGameType() == GType_ELVIRA2) {
+			uint i, j, k, size;
+			uint id, x, y, z;
+			SubSuperRoom *subSuperRoom;
+
+			id = in->readUint16BE();
+			x = in->readUint16BE();
+			y = in->readUint16BE();
+			z = in->readUint16BE();
+
+			j = x * y * z;
+			size = SubSuperRoom_SIZE;
+			for (i = 0; i != j; i++)
+				size += sizeof(subSuperRoom->roomExit[0]);
+
+			subSuperRoom = (SubSuperRoom *)allocateChildBlock(item, 4, size);
+			subSuperRoom->subroutine_id = id;
+			subSuperRoom->roomX = x;
+			subSuperRoom->roomY = y;
+			subSuperRoom->roomZ = z;
+
+			for (i = k = 0; i != j; i++)
+					subSuperRoom->roomExit[k++] = in->readUint16BE();
+		} else if (getGameType() == GType_ELVIRA) {
+			SubGenExit *genExit = (SubGenExit *)allocateChildBlock(item, 4, sizeof(SubGenExit));
+			genExit->dest[0] = (uint16)fileReadItemID(in);
+			genExit->dest[1] = (uint16)fileReadItemID(in);
+			genExit->dest[2] = (uint16)fileReadItemID(in);
+			genExit->dest[3] = (uint16)fileReadItemID(in);
+			genExit->dest[4] = (uint16)fileReadItemID(in);
+			genExit->dest[5] = (uint16)fileReadItemID(in);
+			fileReadItemID(in);
+			fileReadItemID(in);
+			fileReadItemID(in);
+			fileReadItemID(in);
+			fileReadItemID(in);
+			fileReadItemID(in);
+		}
 	} else if (type == 7) {
 		SubContainer *container = (SubContainer *)allocateChildBlock(item, 7, sizeof(SubContainer));
 		container->volume = in->readUint16BE();
@@ -383,7 +420,7 @@
 		setUserFlag(item, 1, in->readUint16BE());
 		setUserFlag(item, 2, in->readUint16BE());
 		setUserFlag(item, 3, in->readUint16BE());
-		if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+		if (getGameType() == GType_ELVIRA) {
 			setUserFlag(item, 4, in->readUint16BE());
 			setUserFlag(item, 5, in->readUint16BE());
 			setUserFlag(item, 6, in->readUint16BE());

Modified: scummvm/trunk/engines/agos/subroutine.cpp
===================================================================
--- scummvm/trunk/engines/agos/subroutine.cpp	2006-10-04 05:16:44 UTC (rev 24105)
+++ scummvm/trunk/engines/agos/subroutine.cpp	2006-10-04 07:10:22 UTC (rev 24106)
@@ -32,53 +32,29 @@
 
 // Script opcodes to load into memory
 static const char *const opcode_arg_table_elvira1[300] = {
-	"I ", "I ", "I ", "I ", "I ", "I ", "I ", "I ",	 "II ",	"II ", "II ", "II ", "F ", "F ", "FN ",	 /*  EQ",        */
-	"FN ", "FN ", "FN ", "FF ", "FF ", "FF ", "FF ", "II ", "II ", "a ", "a ", "n ", "n ", "p ",	 /*  PREP",      */
-	"N ", "I ", "I ", "I ",	 "I ",	"IN ",	"IB ", "IB ", "II ", "IB ", "N ", " ", " ", " ", "I ",	 /*  GET",       */
+	"I ", "I ", "I ", "I ", "I ", "I ", "I ", "I ",	 "II ",	"II ", "II ", "II ", "F ", "F ", "FN ",
+	"FN ", "FN ", "FN ", "FF ", "FF ", "FF ", "FF ", "II ", "II ", "a ", "a ", "n ", "n ", "p ",
+	"N ", "I ", "I ", "I ",	 "I ",	"IN ",	"IB ", "IB ", "II ", "IB ", "N ", " ", " ", " ", "I ",
 	"I ","I ","I ", "I ","I ","I ",	"II ","II ","II ","II ","IBF ", "FIB ", "FF ", "N ", "NI ",
-	"IF ", "F ", "F ", "IB ", "IB ", "FN ",	"FN ", "FN ", "FF ", "FF ", "FN ", "FN ", "FF ", "FF ",	 /*  DIVF",      */
-	"FN ", "FF ", "FN ", "F ", "I ", "IN ", "IN ", "IB ", "IB ", "IB ", "IB ", "II ", "I ", "I ",	 /*  DEC",       */
-	"IN ", "T ", "F ", " ", "T ", "T ", "I ", "I ", " ", " ", "T ", " ", " ", " ", " ", " ", "T ",	 /*  PARSE",     */
+	"IF ", "F ", "F ", "IB ", "IB ", "FN ",	"FN ", "FN ", "FF ", "FF ", "FN ", "FN ", "FF ", "FF ",
+	"FN ", "FF ", "FN ", "F ", "I ", "IN ", "IN ", "IB ", "IB ", "IB ", "IB ", "II ", "I ", "I ",
+	"IN ", "T ", "F ", " ", "T ", "T ", "I ", "I ", " ", " ", "T ", " ", " ", " ", " ", " ", "T ",
 	" ", "N ", "INN ", "II ", "II ", "ITN ", "ITIN ", "ITIN ", "I3 ", "IN ", "I ",	 "I ", "Ivnn ",
 	"vnn ", "Ivnn ", "NN ",	"IT ", "INN ", " ", "N ", "N ", "N ", "T ", "v ", " ", " ", " ", " ",
-	"FN ", "I ", "TN ", "IT ", "II ", "I ", " ", "N ", "I ", " ", "I ", "NI ", "I ", "I ", "T ",	 /*  BECOME",    */
+	"FN ", "I ", "TN ", "IT ", "II ", "I ", " ", "N ", "I ", " ", "I ", "NI ", "I ", "I ", "T ",
 	"I ", "I ", "N ", "N ", " ", "N ", "IF ", "IF ", "IF ", "IF ", "IF ", "IF ", "T ", "IB ",
 	"IB ", "IB ", "I ", " ", "vnnN ", "Ivnn ", "T ", "T ", "T ", "IF ", " ", " ", " ", "Ivnn ",
-	"IF ", "INI ", "INN ",  "IN ", "II ", "IFF ", "IIF ", "I ", "II ", "I ", "I ", "IN ", "IN ",	 /*  ROPENEXT",  */
+	"IF ", "INI ", "INN ",  "IN ", "II ", "IFF ", "IIF ", "I ", "II ", "I ", "I ", "IN ", "IN ",
 	"II ", "II ", "II ", "II ", "IIN ", "IIN ",  "IN ", "II ", "IN ", "IN ", "T ", "vanpan ",
 	"vIpI ", "T ", "T ", " ", " ",	"IN ", "IN ", "IN ", "IN ", "N ", "INTTT ",  "ITTT ",
-	"ITTT ", "I ", "I ", "IN ", "I ", " ", "F ", "NN ", "INN ", "INN ", "INNN ", "TF ", "NN ",	 /*  PICTURE",   */
-	"N ", "NNNNN ", "N ", " ", "NNNNNNN ", "N ", " ", "N ",	"NN ", "N ", "NNNNNIN ", "N ", "N ",	 /*  ENABLEBOX", */
-	"N ", "NNN ", "NNNN ", "INNN ", "IN ", "IN ", "TT ", "I ", "I ", "I ", "TTT ", "IN ", "IN ",	 /*  UNSETCLASS",*/
-	"FN ", "FN ", "FN ", "N ", "N ", "N ", "NI ", " ", " ",	 "N ", "I ", "INN ", "NN ", "N ",	 /*  WAITENDTUNE */
-	"N ", "Nan ", "NN ", " ", " ", " ", " ", " ", " ", " ", "IF ", "N ", " ", " ",	 " ", "II ",	 /*  PLACENOICONS*/
+	"ITTT ", "I ", "I ", "IN ", "I ", " ", "F ", "NN ", "INN ", "INN ", "INNN ", "TF ", "NN ",
+	"N ", "NNNNN ", "N ", " ", "NNNNNNN ", "N ", " ", "N ",	"NN ", "N ", "NNNNNIN ", "N ", "N ",
+	"N ", "NNN ", "NNNN ", "INNN ", "IN ", "IN ", "TT ", "I ", "I ", "I ", "TTT ", "IN ", "IN ",
+	"FN ", "FN ", "FN ", "N ", "N ", "N ", "NI ", " ", " ",	 "N ", "I ", "INN ", "NN ", "N ",
+	"N ", "Nan ", "NN ", " ", " ", " ", " ", " ", " ", " ", "IF ", "N ", " ", " ",	 " ", "II ",
 	" ", "NI ","N ",
 };
 
-static const char *const opcode_arg_table_elvira2[400] = {
-	"I ", "I ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "F ", "F ", "F ",
-	"N ", "FN ", "FN ", "FN ", "FF ", "FF ", "FF ", "FF ", "II ", "II ", "a ", "a ", "n ", "n ",
-	"p ", "N ", " ", "I ", "I ", "I ", "I ", "IN ", "IB ", "I ", "B ", "II ", "IB ", "N ", " ", " ",
-	" ", "I ", "I ", " ", "I ", "I ", "I ", "I ", "I ", "II ", "I ", "I ", "II ", "II ", "IBF ",
-	"FIB ", "FF ", "N ", "NI ", "IF ", "F ", "F ", "IB ", "IB ", "FN ", "FN ", " ", "FN ", "FF ",
-	"FF ", "FN ", "FN ", "FF ", "FF ", "FN ", "FF ", "FN ", "F ", "I ", "IN ", "IN ", "IB", " ",
-	"IB ", "IB ", "IB ", "II ", "I ", "I ", "IN ", "T ", "F ", " ", "T ", "T ", "I ", "I ", " ",
-	" ", "T ", " ", " ", " ", " ", " ", "T ", " ", "N ", "INN ", "II ", "II ", "ITN ", "ITIN ",
-	"ITI ", "N ", "I3 ", "IN ", "I ", "I ", "Ivnn ", "vnn ", "Ivnn ", "NN ", "IT ", "INN ", " ",
-	"N ", "N ", "N ", " ", "T ", "v ", " ", " ", " ", " ", "FN ", "I ", "TN ", "IT ", "II ", "I ",
-	 " ", "N ", "I ", " ", "I ", "NI ", "I ", "I ", "T ", "I ", "I ", "N ", "N ", " ", "N ", "IF ",
-	"IF ", "IF ", "I ", "F ", "IF ", "IF ", "T ", "IB ", "IB ", "IB ", "I ", " ", "vnnN ", "Ivnn ",
-	"T ", "T ", "T ", "IF ", " ", " ", " ", "Ivnn ", "IF ", "INI ", "INN ", "IN ", " ", "II ",
-	"IFF ", "IIF ", "I ", "II ", "I ", "I ", "IN ", "IN ", "II ", "II ", "II ", "II ", "IIN "
-	" ", "IIN ", "IN ", "II ", "IN ", "IN ", "T ", "v", "anpan ", "vIpI ", "T ", "T ", " ", 
-	" ", "IN ", "I ", "N ", "IN ", "IN ", "N ", "INTTT ", "ITTT ", "ITTT ", "I ", "I ", "IN ", 
-	"I ", " ", "F ", "NN ", "I ", "NN ", "INN ", "INNN ", "TF ", "NN ", "N ", "NNNN ", "N ", "N ",
-	" ", "NNNNNNN ", "N ", " ", "N ", "NN ", "N ", "NNNNNIN ", "N ", "N ", "N ", "N ", "NN ", 
-	"NNNN ", "INNN ", "IN ", "IN ", "TT ", "I ", "I ", "I ", "TTT ", "IN ", "IN ", "FN ", "FN ",
-	"F ", "N ", "N ", "N ", "N ", "NI ", " ", " ", "N ", "I ", "INN ", "NN ", "N ", "N ", "Nan ",
-	"NN ", " ", " ", " ", " ", " ", " ", " ", "IF ", "N ", " ", " ", " ", "II ", " ", "NI ", "N "
-};
-
 static const char *const opcode_arg_table_waxworks[256] = {
 	" ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ",
 	"BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ",
@@ -500,7 +476,7 @@
 void AGOSEngine::runSubroutine101() {
 	Subroutine *sub;
 
-	if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+	if (getGameType() == GType_ELVIRA) {
 		// HACK
 		sub = getSubroutineByID(1);
 	} else {
@@ -611,13 +587,13 @@
 		sl->verb = in->readUint16BE();
 		sl->noun1 = in->readUint16BE();
 		sl->noun2 = in->readUint16BE();
-	} else if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+	} else if (getGameType() == GType_ELVIRA) {
 		in->readUint16BE();
 		in->readUint16BE();
 		in->readUint16BE();
 	}
 
-	if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+	if (getGameType() == GType_ELVIRA) {
 		int16 tmp = in->readUint16BE();
 		WRITE_BE_UINT16(q, tmp);
 		while (tmp != 10000) {
@@ -666,15 +642,13 @@
 		table = opcode_arg_table_simon1win;
 	else if (getGameType() == GType_SIMON1)
 		table = opcode_arg_table_simon1dos;
-	else if (getGameType() == GType_WW)
+	else if (getGameType() == GType_WW || getGameType() == GType_ELVIRA2)
 		table = opcode_arg_table_waxworks;
-	else if (getGameType() == GType_ELVIRA2)
-		table = opcode_arg_table_elvira2;
 	else
 		table = opcode_arg_table_elvira1;
 
 	i = 0;
-	if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+	if (getGameType() == GType_ELVIRA) {
 		opcode = READ_BE_UINT16(ptr);
 		ptr += 2;
 	} else {
@@ -705,7 +679,7 @@
 			break;
 
 		case 'B':
-			if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+			if (getGameType() == GType_ELVIRA) {
 				val = in->readUint16BE();
 				WRITE_BE_UINT16(ptr, val); ptr += 2;
 			} else {

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-04 05:16:44 UTC (rev 24105)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-04 07:10:22 UTC (rev 24106)
@@ -186,9 +186,9 @@
 
 	switch (getGameType()) {
 	case GType_ELVIRA:
-	case GType_ELVIRA2:
 		setupElvira1VideoOpcodes(vga_opcode_table);
 		break;
+	case GType_ELVIRA2:
 	case GType_WW:
 	case GType_SIMON1:
 		setupCommonVideoOpcodes(vga_opcode_table);
@@ -2346,7 +2346,7 @@
 
 void AGOSEngine::vc58() {
 	if (getGameType() == GType_WW)
-		return;
+		error("Code whell");;
 
 	uint16 sprite = _vgaCurSpriteId;
 	uint16 file = _vgaCurZoneNum;


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