diff options
author | Travis Howell | 2005-04-05 11:06:03 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-05 11:06:03 +0000 |
commit | aeec229615ad2afb36ce7078448f2b1d560ca51f (patch) | |
tree | fcb9de99e56c5814ec2049817af17553ab3dd3cc | |
parent | 23e419969975d0da935498bfbb255448be7b6c2a (diff) | |
download | scummvm-rg350-aeec229615ad2afb36ce7078448f2b1d560ca51f.tar.gz scummvm-rg350-aeec229615ad2afb36ce7078448f2b1d560ca51f.tar.bz2 scummvm-rg350-aeec229615ad2afb36ce7078448f2b1d560ca51f.zip |
getScriptSlot() must start from slot 1, required for nukeArrays() in HE games.
svn-id: r17383
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/script.cpp | 24 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v80he.cpp | 6 | ||||
-rw-r--r-- | scumm/scumm.cpp | 6 | ||||
-rw-r--r-- | scumm/scumm.h | 2 |
6 files changed, 23 insertions, 23 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 672f35c078..ee34483efd 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -630,7 +630,7 @@ protected: virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); - void localizeArray(int slot, byte script); + void localizeArray(int slot, byte scriptSlot); 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 9ab92840b7..fe275027ee 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -224,7 +224,7 @@ void ScummEngine::stopScript(int script) { error("Script %d stopped with active cutscene/override", script); ss->number = 0; ss->status = ssDead; - nukeArrays(script); + nukeArrays(i); if (_currentScript == i) _currentScript = 0xFF; } @@ -236,7 +236,7 @@ void ScummEngine::stopScript(int script) { while (num > 0) { if (nest->number == script && (nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) { - nukeArrays(script); + nukeArrays(nest->slot); nest->number = 0xFF; nest->slot = 0xFF; nest->where = 0xFF; @@ -264,7 +264,7 @@ void ScummEngine::stopObjectScript(int script) { error("Object %d stopped with active cutscene/override", script); ss->number = 0; ss->status = ssDead; - nukeArrays(script); + nukeArrays(i); if (_currentScript == i) _currentScript = 0xFF; } @@ -276,7 +276,7 @@ void ScummEngine::stopObjectScript(int script) { while (num > 0) { if (nest->number == script && (nest->where == WIO_ROOM || nest->where == WIO_INVENTORY || nest->where == WIO_FLOBJECT)) { - nukeArrays(script); + nukeArrays(nest->slot); nest->number = 0xFF; nest->slot = 0xFF; nest->where = 0xFF; @@ -288,12 +288,12 @@ void ScummEngine::stopObjectScript(int script) { /* Return a free script slot */ int ScummEngine::getScriptSlot() { - ScriptSlot *ss; + ScriptSlot *s; int i; - ss = vm.slot; - for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) { - if (ss->status == ssDead) + for (i = 1; i < NUM_SCRIPT_SLOT; i++) { + s = &vm.slot[i]; + if (s->status == ssDead) return i; } error("Too many scripts running, %d max", NUM_SCRIPT_SLOT); @@ -356,14 +356,14 @@ void ScummEngine::updateScriptPtr() { } /* Nuke arrays based on script */ -void ScummEngine::nukeArrays(byte script) { +void ScummEngine::nukeArrays(byte scriptSlot) { int i; - if (_heversion < 60 || script == 0) + if (_heversion < 60 || scriptSlot == 0) return; for (i = 1; i < _numArray; i++) { - if (_arraySlot[i] == script) { + if (_arraySlot[i] == scriptSlot) { res.nukeResource(rtString, i); _arraySlot[i] = 0; } @@ -703,7 +703,7 @@ void ScummEngine::stopObjectCode() { ss->cutsceneOverride = 0; } } - nukeArrays(ss->number); + nukeArrays(_currentScript); ss->number = 0; ss->status = ssDead; _currentScript = 0xFF; diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 3ee0d45dbf..f6b907ca81 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -1179,16 +1179,16 @@ void ScummEngine_v60he::o60_soundOps() { } } -void ScummEngine_v60he::localizeArray(int slot, byte script) { +void ScummEngine_v60he::localizeArray(int slot, byte scriptSlot) { if (slot >= _numArray) error("o60_localizeArrayToScript(%d): array slot out of range", slot); - _arraySlot[slot] = script; + _arraySlot[slot] = scriptSlot; } void ScummEngine_v60he::o60_localizeArrayToScript() { int slot = pop(); - localizeArray(slot, vm.slot[_currentScript].number); + localizeArray(slot, _currentScript); } void ScummEngine_v60he::o60_seekFilePos() { diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp index 75554a0f80..4c1e59a11e 100644 --- a/scumm/script_v80he.cpp +++ b/scumm/script_v80he.cpp @@ -444,7 +444,7 @@ void ScummEngine_v80he::o80_getSoundVar() { void ScummEngine_v80he::o80_localizeArrayToRoom() { int slot = pop(); - localizeArray(slot, (byte)0xFFFFFFFF); + localizeArray(slot, 0xFF); } void ScummEngine_v80he::o80_readConfigFile() { @@ -661,9 +661,9 @@ void ScummEngine_v80he::o80_pickVarRandom() { if (readVar(value) == 0) { defineArray(value, kDwordArray, 0, 0, 0, num); if (value & 0x8000) - localizeArray(readVar(value), (byte)0xFFFFFFFF); + localizeArray(readVar(value), 0xFF); else if (value & 0x4000) - localizeArray(readVar(value), vm.slot[_currentScript].number); + localizeArray(readVar(value), _currentScript); if (num > 0) { int16 counter = 0; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 72fac0efda..4410ceb9d8 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -2136,13 +2136,13 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { if (ss->cutsceneOverride && _version >= 5) error("Object %d stopped with active cutscene/override in exit", ss->number); - nukeArrays(ss->number); + nukeArrays(_currentScript); _currentScript = 0xFF; } else if (ss->where == WIO_LOCAL) { if (ss->cutsceneOverride && _version >= 5) error("Script %d stopped with active cutscene/override in exit", ss->number); - nukeArrays(ss->number); + nukeArrays(_currentScript); _currentScript = 0xFF; } } @@ -2166,7 +2166,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { // For HE80+ games for (i = 0; i < _numRoomVariables; i++) _roomVars[i] = 0; - nukeArrays((byte)0xFFFFFFFF); + nukeArrays(0xFF); for (i = 1; i < _numActors; i++) { _actors[i].hideActor(); diff --git a/scumm/scumm.h b/scumm/scumm.h index f637c2e5e8..c686f9b505 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -615,7 +615,7 @@ protected: public: void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr, int cycle = 0); void stopScript(int script); - void nukeArrays(byte script); + void nukeArrays(byte scriptSlot); protected: void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars, int slot = -1, int cycle = 0); |