[Scummvm-cvs-logs] CVS: scummvm/gob goblin.cpp,1.20,1.21

Eugene Sandulenko sev at users.sourceforge.net
Wed Oct 12 15:15:11 CEST 2005


Update of /cvsroot/scummvm/scummvm/gob
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27571

Modified Files:
	goblin.cpp 
Log Message:
Patch from wjp #1325224 "Fix for Gobliiins 1 EGA crash on game-over"
which fixes bug #1324814 "GOB1 ega: lock up when game is over"


Index: goblin.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/goblin.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- goblin.cpp	12 Oct 2005 00:02:47 -0000	1.20
+++ goblin.cpp	12 Oct 2005 22:13:41 -0000	1.21
@@ -2387,6 +2387,7 @@
 	int16 layer;
 	int16 state;
 	int32 *retVarPtr;
+	bool objDescSet = false;
 
 	retVarPtr = (int32 *)VAR_ADDRESS(59);
 
@@ -2395,12 +2396,14 @@
 	if (cmd > 0 && cmd < 17) {
 		extraData = inter_load16();
 		objDesc = gob_objects[extraData];
+		objDescSet = true;
 		extraData = inter_load16();
 	}
 
 	if (cmd > 90 && cmd < 107) {
 		extraData = inter_load16();
 		objDesc = gob_goblins[extraData];
+		objDescSet = true;
 		extraData = inter_load16();
 		cmd -= 90;
 	}
@@ -2408,13 +2411,25 @@
 	if (cmd > 110 && cmd < 128) {
 		extraData = inter_load16();
 		objDesc = gob_goblins[extraData];
+		objDescSet = true;
 		cmd -= 90;
 	} else if (cmd > 20 && cmd < 38) {
 		extraData = inter_load16();
 		objDesc = gob_objects[extraData];
+		objDescSet = true;
 	}
 
-	if (cmd < 40 && objDesc == 0)
+/*
+	NB: The original gobliiins engine did not initialize the objDesc
+	variable, so we manually check if objDesc is properly set before
+	checking if it is zero. If it was not set, we do not return. This
+	fixes a crash in the EGA version if the life bar is depleted, because
+	gob_interFunc is called multiple times with cmd == 39.
+	Bug #1324814
+*/
+
+
+	if (cmd < 40 && objDescSet && objDesc == 0)
 		return;
 
 	debug(5, "cmd = %d", cmd);





More information about the Scummvm-git-logs mailing list