aboutsummaryrefslogtreecommitdiff
path: root/gob
diff options
context:
space:
mode:
authorEugene Sandulenko2005-10-12 22:13:41 +0000
committerEugene Sandulenko2005-10-12 22:13:41 +0000
commit412693ac70e237591335de18fc93b6113b96b42a (patch)
tree38616b2902cbd96a274484334375a495d67723eb /gob
parent1b96ad1a91ff0117892a0bd5d6f37b576b4038cf (diff)
downloadscummvm-rg350-412693ac70e237591335de18fc93b6113b96b42a.tar.gz
scummvm-rg350-412693ac70e237591335de18fc93b6113b96b42a.tar.bz2
scummvm-rg350-412693ac70e237591335de18fc93b6113b96b42a.zip
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" svn-id: r19056
Diffstat (limited to 'gob')
-rw-r--r--gob/goblin.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/gob/goblin.cpp b/gob/goblin.cpp
index 7a4168e631..be1b20a921 100644
--- a/gob/goblin.cpp
+++ b/gob/goblin.cpp
@@ -2387,6 +2387,7 @@ void gob_interFunc(void) {
int16 layer;
int16 state;
int32 *retVarPtr;
+ bool objDescSet = false;
retVarPtr = (int32 *)VAR_ADDRESS(59);
@@ -2395,12 +2396,14 @@ void gob_interFunc(void) {
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 @@ void gob_interFunc(void) {
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);