From 3ce3a5be5bbfd6f438584e5c09e08d26eadb9396 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 22 Dec 2002 19:14:53 +0000 Subject: [PATCH] minor cleanup svn-id: r6059 --- scumm/script.cpp | 22 ---------------------- scumm/script_v5.cpp | 17 ++++++++++++++--- scumm/script_v6.cpp | 20 ++++++++++++++++---- scumm/scumm.h | 33 +++++++++++++++------------------ 4 files changed, 45 insertions(+), 47 deletions(-) diff --git a/scumm/script.cpp b/scumm/script.cpp index c34f9385a38..ff957955c0e 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -287,28 +287,6 @@ void Scumm::executeScript() CHECK_HEAP; } -void Scumm_v5::executeOpcode(int i) -{ - OpcodeProcV5 op = _opcodesV5[i].proc; - (this->*op) (); -} - -const char *Scumm_v5::getOpcodeDesc(int i) -{ - return _opcodesV5[i].desc; -} - -void Scumm_v6::executeOpcode(int i) -{ - OpcodeProcV6 op = _opcodesV6[i].proc; - (this->*op) (); -} - -const char *Scumm_v6::getOpcodeDesc(int i) -{ - return _opcodesV6[i].desc; -} - byte Scumm::fetchScriptByte() { if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) { diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 7c5e1111ff7..9d9bfa07767 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -162,7 +162,7 @@ void Scumm_v5::setupOpcodes() OPCODE(o5_getClosestObjActor), OPCODE(o5_dummy), /* 68 */ - OPCODE(o5_getScriptRunning), + OPCODE(o5_isScriptRunning), OPCODE(o5_setOwnerOf), OPCODE(o5_startScript), OPCODE(o5_debug), @@ -322,7 +322,7 @@ void Scumm_v5::setupOpcodes() OPCODE(o5_getClosestObjActor), OPCODE(o5_dummy), /* E8 */ - OPCODE(o5_getScriptRunning), + OPCODE(o5_isScriptRunning), OPCODE(o5_setOwnerOf), OPCODE(o5_startScript), OPCODE(o5_debug), @@ -356,6 +356,17 @@ void Scumm_v5::setupOpcodes() _opcodesV5 = opcodes; } +void Scumm_v5::executeOpcode(int i) +{ + OpcodeProcV5 op = _opcodesV5[i].proc; + (this->*op) (); +} + +const char *Scumm_v5::getOpcodeDesc(int i) +{ + return _opcodesV5[i].desc; +} + void Scumm_v5::o5_actorFollowCamera() { actorFollowCamera(getVarOrDirectByte(0x80)); @@ -1137,7 +1148,7 @@ void Scumm_v5::o5_getRandomNr() setResult(_rnd.getRandomNumber(getVarOrDirectByte(0x80))); } -void Scumm_v5::o5_getScriptRunning() +void Scumm_v5::o5_isScriptRunning() { getResultPos(); setResult(isScriptRunning(getVarOrDirectByte(0x80))); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 3ffbdb7864c..d6708374a8a 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -57,7 +57,7 @@ void Scumm_v6::setupOpcodes() OPCODE(o6_wordArrayIndexedRead), /* 0C */ OPCODE(o6_dup), - OPCODE(o6_zero), + OPCODE(o6_not), OPCODE(o6_eq), OPCODE(o6_neq), /* 10 */ @@ -214,7 +214,7 @@ void Scumm_v6::setupOpcodes() OPCODE(o6_getRandomNumberRange), OPCODE(o6_invalid), OPCODE(o6_getActorMoving), - OPCODE(o6_getScriptRunning), + OPCODE(o6_isScriptRunning), /* 8C */ OPCODE(o6_getActorRoom), OPCODE(o6_getObjectX), @@ -364,6 +364,18 @@ void Scumm_v6::setupOpcodes() _opcodesV6 = opcodes; } + +void Scumm_v6::executeOpcode(int i) +{ + OpcodeProcV6 op = _opcodesV6[i].proc; + (this->*op) (); +} + +const char *Scumm_v6::getOpcodeDesc(int i) +{ + return _opcodesV6[i].desc; +} + void Scumm_v6::o6_setBlastObjectWindow() { // Set BOMP processing window int a, b, c, d; @@ -508,7 +520,7 @@ void Scumm_v6::o6_dup() push(a); } -void Scumm_v6::o6_zero() +void Scumm_v6::o6_not() { push(pop() == 0); } @@ -1228,7 +1240,7 @@ void Scumm_v6::o6_getActorMoving() push(derefActorSafe(pop(), "o6_getActorMoving")->moving); } -void Scumm_v6::o6_getScriptRunning() +void Scumm_v6::o6_isScriptRunning() { push(isScriptRunning(pop())); } diff --git a/scumm/scumm.h b/scumm/scumm.h index 66ef16f6766..fa2a1a1036a 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -34,8 +34,6 @@ class NewGui; class Dialog; class ConsoleDialog; class Scumm; -class Scumm_v5; -class Scumm_v6; class IMuse; class IMuseDigital; class Actor; @@ -45,19 +43,6 @@ class ScummDebugger; class Serializer; struct FindObjectInRoom; -typedef void (Scumm_v5::*OpcodeProcV5)(); -typedef void (Scumm_v6::*OpcodeProcV6)(); - -struct OpcodeEntryV5 { - OpcodeProcV5 proc; - const char *desc; -}; - -struct OpcodeEntryV6 { - OpcodeProcV6 proc; - const char *desc; -}; - // Use g_scumm from error() ONLY extern Scumm *g_scumm; @@ -1081,6 +1066,12 @@ public: class Scumm_v5 : public Scumm { protected: + typedef void (Scumm_v5::*OpcodeProcV5)(); + struct OpcodeEntryV5 { + OpcodeProcV5 proc; + const char *desc; + }; + const OpcodeEntryV5 *_opcodesV5; public: @@ -1141,7 +1132,7 @@ protected: void o5_getObjectOwner(); void o5_getObjectState(); void o5_getRandomNr(); - void o5_getScriptRunning(); + void o5_isScriptRunning(); void o5_getVerbEntrypoint(); void o5_ifClassOfIs(); void o5_increment(); @@ -1236,6 +1227,12 @@ public: class Scumm_v6 : public Scumm { protected: + typedef void (Scumm_v6::*OpcodeProcV6)(); + struct OpcodeEntryV6 { + OpcodeProcV6 proc; + const char *desc; + }; + const OpcodeEntryV6 *_opcodesV6; public: @@ -1264,7 +1261,7 @@ protected: void o6_byteArrayIndexedRead(); void o6_wordArrayIndexedRead(); void o6_dup(); - void o6_zero(); + void o6_not(); void o6_eq(); void o6_neq(); void o6_gt(); @@ -1334,7 +1331,7 @@ protected: void o6_getRandomNumber(); void o6_getRandomNumberRange(); void o6_getActorMoving(); - void o6_getScriptRunning(); + void o6_isScriptRunning(); void o6_getActorRoom(); void o6_getObjectX(); void o6_getObjectY();