diff options
author | Travis Howell | 2004-09-23 05:02:15 +0000 |
---|---|---|
committer | Travis Howell | 2004-09-23 05:02:15 +0000 |
commit | be1ab48a57d45315941c5b8396357aa65bf2dd0b (patch) | |
tree | c587e76d2ed12c4a47d524ca92297753e45a58bb /scumm | |
parent | ffd6944b12d1497e85351b560143ccb684eaeca4 (diff) | |
download | scummvm-rg350-be1ab48a57d45315941c5b8396357aa65bf2dd0b.tar.gz scummvm-rg350-be1ab48a57d45315941c5b8396357aa65bf2dd0b.tar.bz2 scummvm-rg350-be1ab48a57d45315941c5b8396357aa65bf2dd0b.zip |
Fix array pointer overflows in HE80+ games.
Some arrays are nuked in startScene.
svn-id: r15239
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/script.cpp | 8 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 2 | ||||
-rw-r--r-- | scumm/scumm.cpp | 4 | ||||
-rw-r--r-- | scumm/scumm.h | 2 |
5 files changed, 10 insertions, 8 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 3f54b7545f..b8ecf0aefa 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -572,7 +572,7 @@ protected: virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); - void localizeArray(int slot, int script); + void localizeArray(int slot, byte script); void redimArray(int arrayId, int newX, int newY, int d); int readFileToArray(int slot, int32 size); void writeFileFromArray(int slot, int resID); diff --git a/scumm/script.cpp b/scumm/script.cpp index 040ccf9591..1c0b39dd87 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -348,14 +348,14 @@ void ScummEngine::updateScriptPtr() { } /* Nuke arrays based on script */ -void ScummEngine::nukeArrays(int script) { +void ScummEngine::nukeArrays(byte script) { int i; - if (_heversion < 60 || !script) + if (_heversion < 60 || script == 0) return; - //FIXME Nukes wrong arrays in other - if (_gameId != GID_PUTTMOON) + //FIXME Nukes wrong arrays + if (_gameId == GID_FBEAR) return; for (i = 1; i < _numArray; i++) { diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 3b34e8dce8..63c8a45f4a 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -1154,7 +1154,7 @@ void ScummEngine_v60he::o60_soundOps() { } } -void ScummEngine_v60he::localizeArray(int slot, int script) { +void ScummEngine_v60he::localizeArray(int slot, byte script) { if (slot >= _numArray) error("o60_localizeArray(%d): array slot out of range", slot); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 8c6041148a..3b423472b1 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1769,12 +1769,14 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { stopCycle(0); _sound->processSoundQues(); - if (_heversion >= 70 && _wizPolygons) { + if (_heversion >= 71 && _wizPolygons) { memset(_wizPolygons, 0, _wizNumPolygons * sizeof(WizPolygon)); } + // For HE80+ games for (i = 0; i < _numRoomVariables; i++) _roomVars[i] = 0; + nukeArrays(0xFFFFFFFF); for (i = 1; i < _numActors; i++) { _actors[i].hideActor(); diff --git a/scumm/scumm.h b/scumm/scumm.h index a5f69b285a..b0ca63b037 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -592,7 +592,7 @@ protected: public: void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr); void stopScript(int script); - void nukeArrays(int script); + void nukeArrays(byte script); protected: void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars, int slot = -1); |