aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/debugger.cpp10
-rw-r--r--scumm/saveload.cpp4
-rw-r--r--scumm/script.cpp49
-rw-r--r--scumm/script_v5.cpp2
-rw-r--r--scumm/scumm.h9
5 files changed, 38 insertions, 36 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index dfb0df2f8c..d70e096c41 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -521,13 +521,13 @@ bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) {
bool ScummDebugger::Cmd_PrintScript(int argc, const char **argv) {
int i;
ScriptSlot *ss = &_s->vm.slot[1];
- Debug_Printf("+-----------------------------+\n");
- Debug_Printf("|# |num|sta|typ|un1|un2|fc|cut|\n");
- Debug_Printf("+--+---+---+---+---+--+---+---+\n");
+ Debug_Printf("+----------------------------+\n");
+ Debug_Printf("|# |num|sta|typ|fr|rec|fc|cut|\n");
+ Debug_Printf("+--+---+---+---+--+--+---+---+\n");
for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) {
if (ss->number) {
- Debug_Printf("|%2d|%3d|%3d|%3d|%3d|%3d|%2d|%3d|\n",
- i, ss->number, ss->status, ss->where, ss->unk1, ss->unk2,
+ Debug_Printf("|%2d|%3d|%3d|%3d|%2d|%3d|%2d|%3d|\n",
+ i, ss->number, ss->status, ss->where, ss->freezeResistant, ss->recursive,
ss->freezeCount, ss->cutsceneOverride);
}
}
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 65d04baeb9..8cfc8da525 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -513,8 +513,8 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion) {
MKLINE(ScriptSlot, delayFrameCount, sleUint16, VER_V8),
MKLINE(ScriptSlot, status, sleByte, VER_V8),
MKLINE(ScriptSlot, where, sleByte, VER_V8),
- MKLINE(ScriptSlot, unk1, sleByte, VER_V8),
- MKLINE(ScriptSlot, unk2, sleByte, VER_V8),
+ MKLINE(ScriptSlot, freezeResistant, sleByte, VER_V8),
+ MKLINE(ScriptSlot, recursive, sleByte, VER_V8),
MKLINE(ScriptSlot, freezeCount, sleByte, VER_V8),
MKLINE(ScriptSlot, didexec, sleByte, VER_V8),
MKLINE(ScriptSlot, cutsceneOverride, sleByte, VER_V8),
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 233307a5a6..e8c3af7b74 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -34,19 +34,18 @@ enum {
};
-/* Start executing script 'script' with parameters 'a' and 'b' */
-void Scumm::runScript(int script, int a, int b, int *lvarptr) {
+/* Start executing script 'script' with the given parameters */
+void Scumm::runScript(int script, bool freezeResistant, bool recursive, int *lvarptr) {
+ ScriptSlot *s;
byte *scriptPtr;
uint32 scriptOffs;
byte scriptType;
int slot;
- ScriptSlot *s;
-
- if (script == 0)
+ if (!script)
return;
- if (b == 0)
+ if (!recursive)
stopScriptNr(script);
if (script < _numGlobalScripts) {
@@ -67,10 +66,9 @@ void Scumm::runScript(int script, int a, int b, int *lvarptr) {
s->offs = scriptOffs;
s->status = ssRunning;
s->where = scriptType;
- s->unk1 = a;
- s->unk2 = b;
+ s->freezeResistant = freezeResistant;
+ s->recursive = recursive;
s->freezeCount = 0;
-
s->delayFrameCount = 0;
initializeLocals(slot, lvarptr);
@@ -550,7 +548,7 @@ void Scumm::freezeScripts(int flag) {
int i;
for (i = 0; i < NUM_SCRIPT_SLOT; i++) {
- if (_currentScript != i && vm.slot[i].status != ssDead && (vm.slot[i].unk1 == 0 || flag >= 0x80)) {
+ if (_currentScript != i && vm.slot[i].status != ssDead && (!vm.slot[i].freezeResistant || flag >= 0x80)) {
vm.slot[i].status |= 0x80;
vm.slot[i].freezeCount++;
}
@@ -611,8 +609,8 @@ void Scumm::runExitScript() {
vm.slot[slot].number = 10001;
vm.slot[slot].where = WIO_ROOM;
vm.slot[slot].offs = _EXCD_offs;
- vm.slot[slot].unk1 = 0;
- vm.slot[slot].unk2 = 0;
+ vm.slot[slot].freezeResistant = false;
+ vm.slot[slot].recursive = false;
vm.slot[slot].freezeCount = 0;
vm.slot[slot].delayFrameCount = 0;
@@ -647,8 +645,8 @@ void Scumm::runEntryScript() {
vm.slot[slot].number = 10002;
vm.slot[slot].where = WIO_ROOM;
vm.slot[slot].offs = _ENCD_offs;
- vm.slot[slot].unk1 = 0;
- vm.slot[slot].unk2 = 0;
+ vm.slot[slot].freezeResistant = false;
+ vm.slot[slot].recursive = false;
vm.slot[slot].freezeCount = 0;
vm.slot[slot].delayFrameCount = 0;
runScriptNested(slot);
@@ -805,13 +803,15 @@ void Scumm::decreaseScriptDelay(int amount) {
}
}
-void Scumm::runVerbCode(int object, int entry, int a, int b, int *vars) {
+void Scumm::runVerbCode(int object, int entry, bool freezeResistant, bool recursive, int *vars) {
+ ScriptSlot *s;
uint32 obcd;
int slot, where, offs;
if (!object)
return;
- if (!b)
+
+ if (!recursive)
stopObjectScript(object);
where = whereIsObject(object);
@@ -828,14 +828,15 @@ void Scumm::runVerbCode(int object, int entry, int a, int b, int *vars) {
if (offs == 0)
return;
- vm.slot[slot].number = object;
- vm.slot[slot].offs = obcd + offs;
- vm.slot[slot].status = ssRunning;
- vm.slot[slot].where = where;
- vm.slot[slot].unk1 = a;
- vm.slot[slot].unk2 = b;
- vm.slot[slot].freezeCount = 0;
- vm.slot[slot].delayFrameCount = 0;
+ s = &vm.slot[slot];
+ s->number = object;
+ s->offs = obcd + offs;
+ s->status = ssRunning;
+ s->where = where;
+ s->freezeResistant = freezeResistant;
+ s->recursive = recursive;
+ s->freezeCount = 0;
+ s->delayFrameCount = 0;
initializeLocals(slot, vars);
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index b62661f7cc..37690e9d2d 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -595,7 +595,7 @@ void Scumm_v5::o5_chainScript() {
vm.slot[cur].status = 0;
_currentScript = 0xFF;
- runScript(data, vm.slot[cur].unk1, vm.slot[cur].unk2, vars);
+ runScript(data, vm.slot[cur].freezeResistant, vm.slot[cur].recursive, vars);
}
void Scumm_v5::o5_cursorCommand() {
diff --git a/scumm/scumm.h b/scumm/scumm.h
index b91e67be64..0239590482 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -91,10 +91,11 @@ struct ScriptSlot {
int32 delay;
uint16 number;
uint16 delayFrameCount;
+ bool freezeResistant, recursive;
+ bool didexec;
byte status;
byte where;
- byte unk1, unk2, freezeCount;
- bool didexec;
+ byte freezeCount;
byte cutsceneOverride;
};
@@ -495,7 +496,7 @@ protected:
void startManiac();
public:
- void runScript(int script, int a, int b, int *lvarptr);
+ void runScript(int script, bool freezeResistant, bool recursive, int *lvarptr);
void stopScriptNr(int script);
protected:
@@ -698,7 +699,7 @@ protected:
int getVerbEntrypoint(int obj, int entry);
int getVerbSlot(int id, int mode);
void killVerb(int slot);
- void runVerbCode(int script, int entry, int a, int b, int *vars);
+ void runVerbCode(int script, int entry, bool freezeResistant, bool recursive, int *vars);
void setVerbObject(uint room, uint object, uint verb);
public: