diff options
author | Max Horn | 2002-12-09 01:27:40 +0000 |
---|---|---|
committer | Max Horn | 2002-12-09 01:27:40 +0000 |
commit | 0720fa80c8f745310f7fd9753ff5242245bf9646 (patch) | |
tree | 178a18792d54bf2849792d8c7ff78bbddb8a5d9f | |
parent | 2345aa0307b079e5d2261e610432b9d94492b447 (diff) | |
download | scummvm-rg350-0720fa80c8f745310f7fd9753ff5242245bf9646.tar.gz scummvm-rg350-0720fa80c8f745310f7fd9753ff5242245bf9646.tar.bz2 scummvm-rg350-0720fa80c8f745310f7fd9753ff5242245bf9646.zip |
cleanup
svn-id: r5893
-rw-r--r-- | scumm/debug.cpp | 10 | ||||
-rw-r--r-- | scumm/gfx.cpp | 30 | ||||
-rw-r--r-- | scumm/saveload.cpp | 4 | ||||
-rw-r--r-- | scumm/script.cpp | 40 | ||||
-rw-r--r-- | scumm/script_v1.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 2 | ||||
-rw-r--r-- | scumm/scumm.h | 9 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 2 |
8 files changed, 51 insertions, 52 deletions
diff --git a/scumm/debug.cpp b/scumm/debug.cpp index 6cd8d23ad6..669a2c7abb 100644 --- a/scumm/debug.cpp +++ b/scumm/debug.cpp @@ -308,15 +308,15 @@ void ScummDebugger::printScripts() int i; ScriptSlot *ss; - printf("+---------------------------------+\n"); - printf("|# |num|sta|typ|un1|un2|fc|cut|un5|\n"); - printf("+--+---+---+---+---+---+--+---+---+\n"); + printf("+------------------------------\n"); + printf("|# |num|sta|typ|un1|un2|fc|cut|\n"); + printf("+--+---+---+---+---+---+--+---+\n"); for (i = 0; i < 25; i++) { ss = &_s->vm.slot[i]; if (ss->number) { - printf("|%2d|%3d|%3d|%3d|%3d|%3d|%2d|%3d|%3d|\n", + printf("|%2d|%3d|%3d|%3d|%3d|%3d|%2d|%3d|\n", i, ss->number, ss->status, ss->where, ss->unk1, ss->unk2, - ss->freezeCount, ss->cutsceneOverride, ss->unk5); + ss->freezeCount, ss->cutsceneOverride); } } printf("+-------------------------------------+\n"); diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index bd760fa38d..101b71a21e 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -278,6 +278,16 @@ void Scumm::setCursor(int cursor) warning("setCursor(%d)", cursor); } +void Scumm::setCameraAtEx(int at) +{ + if (!(_features & GF_AFTER_V7)) { + camera._mode = CM_NORMAL; + camera._cur.x = at; + setCameraAt(at, 0); + camera._movingToActor = false; + } +} + void Scumm::setCameraAt(int pos_x, int pos_y) { if (_features & GF_AFTER_V7) { @@ -2393,7 +2403,7 @@ void Scumm::moveCamera() if (t < 5) camera._dest.x = actorx - 80; } else - camera._movingToActor = 1; + camera._movingToActor = true; } } @@ -2419,7 +2429,7 @@ void Scumm::moveCamera() /* a is set a bit above */ if (camera._movingToActor && camera._cur.x >> 3 == a->x >> 3) { - camera._movingToActor = 0; + camera._movingToActor = false; } cameraMoved(); @@ -2464,7 +2474,7 @@ void Scumm::panCameraTo(int x, int y) camera._dest.x = x; camera._mode = CM_PANNING; - camera._movingToActor = 0; + camera._movingToActor = false; } } @@ -2477,7 +2487,7 @@ void Scumm::actorFollowCamera(int act) if (act == 0) { camera._mode = CM_NORMAL; camera._follows = 0; - camera._movingToActor = 0; + camera._movingToActor = false; return; } @@ -2486,17 +2496,7 @@ void Scumm::actorFollowCamera(int act) if (camera._follows != old) runHook(0); - camera._movingToActor = 0; - } -} - -void Scumm::setCameraAtEx(int at) -{ - if (!(_features & GF_AFTER_V7)) { - camera._mode = CM_NORMAL; - camera._cur.x = at; - setCameraAt(at, 0); - camera._movingToActor = 0; + camera._movingToActor = false; } } diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index e55188fde7..c8648b8de8 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -471,7 +471,7 @@ void Scumm::saveOrLoad(Serializer *s) MKLINE(ScriptSlot, freezeCount, sleByte, VER_V8), MKLINE(ScriptSlot, didexec, sleByte, VER_V8), MKLINE(ScriptSlot, cutsceneOverride, sleByte, VER_V8), - MKLINE(ScriptSlot, unk5, sleByte, VER_V8), + MK_OBSOLETE(ScriptSlot, unk5, sleByte, VER_V8, VER_V10), MKEND() }; @@ -487,7 +487,7 @@ void Scumm::saveOrLoad(Serializer *s) MKLINE(SentenceTab, unk2, sleUint8, VER_V8), MKLINE(SentenceTab, unk4, sleUint16, VER_V8), MKLINE(SentenceTab, unk3, sleUint16, VER_V8), - MKLINE(SentenceTab, unk, sleUint8, VER_V8), + MKLINE(SentenceTab, freezeCount, sleUint8, VER_V8), MKEND() }; diff --git a/scumm/script.cpp b/scumm/script.cpp index 84022b46e0..4ef4175921 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -66,7 +66,7 @@ void Scumm::runScript(int script, int a, int b, int16 *lvarptr) s = &vm.slot[slot]; s->number = script; s->offs = scriptOffs; - s->status = 2; + s->status = ssRunning; s->where = scriptType; s->unk1 = a; s->unk2 = b; @@ -92,7 +92,7 @@ void Scumm::stopScriptNr(int script) ss = &vm.slot[1]; for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) { - if (script != ss->number || ss->where != WIO_GLOBAL && ss->where != WIO_LOCAL || ss->status == 0) + if (script != ss->number || ss->where != WIO_GLOBAL && ss->where != WIO_LOCAL || ss->status == ssDead) continue; if (ss->cutsceneOverride) @@ -133,7 +133,7 @@ void Scumm::stopObjectScript(int script) for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) { if (script == ss->number && (ss->where == WIO_ROOM || ss->where == WIO_INVENTORY || ss->where == WIO_FLOBJECT) - && ss->status != 0) { + && ss->status != ssDead) { if (ss->cutsceneOverride) error("Object %d stopped with active cutscene/override", script); ss->number = 0; @@ -167,7 +167,7 @@ int Scumm::getScriptSlot() ss = &vm.slot[1]; for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) { - if (ss->status == 0) + if (ss->status == ssDead) return i; } error("Too many scripts running, %d max", NUM_SCRIPT_SLOT); @@ -210,7 +210,7 @@ void Scumm::runScriptNested(int script) if (nest->number != 0xFF) { slot = &vm.slot[nest->slot]; if (slot->number == nest->number && slot->where == nest->where && - slot->status != 0 && slot->freezeCount == 0) { + slot->status != ssDead && slot->freezeCount == 0) { _currentScript = nest->slot; getScriptBaseAddress(); getScriptEntryPoint(); @@ -544,7 +544,7 @@ void Scumm::stopObjectCode() } } ss->number = 0; - ss->status = 0; + ss->status = ssDead; _currentScript = 0xFF; } @@ -583,7 +583,7 @@ void Scumm::freezeScripts(int flag) } for (i = 0; i < 6; i++) - _sentence[i].unk++; + _sentence[i].freezeCount++; if (vm.cutSceneScriptIndex != 0xFF) { vm.slot[vm.cutSceneScriptIndex].status &= 0x7F; @@ -603,8 +603,8 @@ void Scumm::unfreezeScripts() } for (i = 0; i < 6; i++) { - if (_sentence[i].unk > 0) - _sentence[i].unk--; + if (_sentence[i].freezeCount > 0) + _sentence[i].freezeCount--; } } @@ -694,11 +694,11 @@ void Scumm::killScriptsAndResources() if (ss->where == WIO_ROOM || ss->where == WIO_FLOBJECT) { if (ss->cutsceneOverride) error("Object %d stopped with active cutscene/override in exit", ss->number); - ss->status = 0; + ss->status = ssDead; } else if (ss->where == WIO_LOCAL) { if (ss->cutsceneOverride) error("Script %d stopped with active cutscene/override in exit", ss->number); - ss->status = 0; + ss->status = ssDead; } } @@ -721,7 +721,7 @@ void Scumm::killScriptsAndResources() } } -void Scumm::checkAndRunVar33() +void Scumm::checkAndRunSentenceScript() { int i; ScriptSlot *ss; @@ -730,11 +730,11 @@ void Scumm::checkAndRunVar33() if (isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) { ss = vm.slot; for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) - if (ss->number == _vars[VAR_SENTENCE_SCRIPT] && ss->status != 0 && ss->freezeCount == 0) + if (ss->number == _vars[VAR_SENTENCE_SCRIPT] && ss->status != ssDead && ss->freezeCount == 0) return; } - if (!_sentenceNum || _sentence[_sentenceNum - 1].unk) + if (!_sentenceNum || _sentence[_sentenceNum - 1].freezeCount) return; _sentenceNum--; @@ -767,10 +767,10 @@ void Scumm::decreaseScriptDelay(int amount) ScriptSlot *ss = &vm.slot[0]; int i; for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) { - if (ss->status == 1) { + if (ss->status == ssPaused) { ss->delay -= amount; if (ss->delay < 0) { - ss->status = 2; + ss->status = ssRunning; ss->delay = 0; } } @@ -945,7 +945,7 @@ bool Scumm::isScriptRunning(int script) int i; ScriptSlot *ss = vm.slot; for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) - if (ss->number == script && (ss->where == WIO_GLOBAL || ss->where == WIO_LOCAL) && ss->status) + if (ss->number == script && (ss->where == WIO_GLOBAL || ss->where == WIO_LOCAL) && ss->status != ssDead) return true; return false; } @@ -955,7 +955,7 @@ bool Scumm::isRoomScriptRunning(int script) int i; ScriptSlot *ss = vm.slot; for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) - if (ss->number == script && ss->where == WIO_ROOM && ss->status) + if (ss->number == script && ss->where == WIO_ROOM && ss->status != ssDead) return true; return false; @@ -1101,7 +1101,7 @@ void Scumm::exitCutscene() if (offs) { ScriptSlot *ss = &vm.slot[vm.cutSceneScript[vm.cutSceneStackPointer]]; ss->offs = offs; - ss->status = 2; + ss->status = ssRunning; ss->freezeCount = 0; if (ss->cutsceneOverride > 0) @@ -1147,5 +1147,5 @@ void Scumm::doSentence(int c, int b, int a) st->unk5 = c; st->unk4 = b; st->unk3 = a; - st->unk = 0; + st->freezeCount = 0; } diff --git a/scumm/script_v1.cpp b/scumm/script_v1.cpp index d1f2741131..11be00fb82 100644 --- a/scumm/script_v1.cpp +++ b/scumm/script_v1.cpp @@ -726,7 +726,7 @@ void Scumm::o5_doSentence() } else { st->unk2 = 1; } - st->unk = 0; + st->freezeCount = 0; } void Scumm::o5_drawBox() @@ -2018,7 +2018,7 @@ void Scumm::o5_soundKludge() if (_features & GF_SMALL_HEADER) { // Is WaitForSentence in SCUMM V3 if (_sentenceNum) { - if (_sentence[_sentenceNum - 1].unk && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) + if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) return; } else if (!isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) return; @@ -2344,7 +2344,7 @@ void Scumm::o5_wait() return; case 4: /* wait for sentence */ if (_sentenceNum) { - if (_sentence[_sentenceNum - 1].unk && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) + if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) return; break; } diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index c2d65b8cf4..62e7711004 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -2067,7 +2067,7 @@ void Scumm::o6_wait() case 171: printf("wait for sentence"); if (_sentenceNum) { - if (_sentence[_sentenceNum - 1].unk && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) + if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) return; break; } diff --git a/scumm/scumm.h b/scumm/scumm.h index 0a1ca45f14..a87a7af212 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -99,9 +99,9 @@ struct ScriptSlot { uint16 delayFrameCount; byte status; byte where; - byte unk1, unk2, freezeCount, didexec; + byte unk1, unk2, freezeCount; + bool didexec; byte cutsceneOverride; - byte unk5; }; struct NestedScript { @@ -237,8 +237,7 @@ struct SentenceTab { byte unk2; uint16 unk4; uint16 unk3; - int8 unk; - byte pad; + uint8 freezeCount; }; // TODO / FIXME: next time save game format changes, Fingolfin would like to @@ -495,7 +494,7 @@ public: void beginOverride(); void endOverride(); void killScriptsAndResources(); - void checkAndRunVar33(); + void checkAndRunSentenceScript(); void decreaseScriptDelay(int amount); bool isScriptRunning(int script); bool isRoomScriptRunning(int script); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 359828168a..02a1d69e7c 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -499,7 +499,7 @@ int Scumm::scummLoop(int delta) runAllScripts(); checkExecVerbs(); - checkAndRunVar33(); + checkAndRunSentenceScript(); if (_currentRoom == 0) { gdi._cursorActive = 0; |