diff options
author | Max Horn | 2002-12-16 12:12:31 +0000 |
---|---|---|
committer | Max Horn | 2002-12-16 12:12:31 +0000 |
commit | c4b6fa7f70a6a8fdad10460230fb160e78ad5df2 (patch) | |
tree | 861960e88c2864341bb137b88a1dbead514e33a4 /scumm | |
parent | 254d8c81f9b50839247709103edc0dc85934bc42 (diff) | |
download | scummvm-rg350-c4b6fa7f70a6a8fdad10460230fb160e78ad5df2.tar.gz scummvm-rg350-c4b6fa7f70a6a8fdad10460230fb160e78ad5df2.tar.bz2 scummvm-rg350-c4b6fa7f70a6a8fdad10460230fb160e78ad5df2.zip |
refactoring: use inheritance to mode the relations between the various engine versions. E.g. the V6 opcodes are now in Scumm_v6, the V5 opcodes in Scumm_v5 (from which we now derive v2-v4. which is a bit odd - maybe we should move the v5 opcodes to Scumm_v3 ?)
svn-id: r5994
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script.cpp | 63 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 228 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 330 | ||||
-rw-r--r-- | scumm/scumm.h | 406 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 15 | ||||
-rw-r--r-- | scumm/vars.cpp | 5 |
6 files changed, 541 insertions, 506 deletions
diff --git a/scumm/script.cpp b/scumm/script.cpp index 4ef4175921..c34f9385a3 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -277,17 +277,37 @@ void Scumm::getScriptEntryPoint() /* Execute a script - Read opcode, and execute it from the table */ void Scumm::executeScript() { - - OpcodeProc op; while (_currentScript != 0xFF) { _opcode = fetchScriptByte(); _scriptPointerStart = _scriptPointer; vm.slot[_currentScript].didexec = 1; - debug(8, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode, _opcodes[_opcode].desc); - op = getOpcode(_opcode); - (this->*op) (); + debug(8, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode, getOpcodeDesc(_opcode)); + executeOpcode(_opcode); } -CHECK_HEAP} + 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() { @@ -468,6 +488,20 @@ void Scumm::setResult(int value) writeVar(_resultVarNumber, value); } +void Scumm::push(int a) +{ + assert(_scummStackPos >= 0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); + _scummStack[_scummStackPos++] = a; +} + +int Scumm::pop() +{ + if ((_scummStackPos < 1) || ((unsigned int)_scummStackPos > ARRAYSIZE(_scummStack))) { + error("No items on stack to pop() for %s (0x%X) at [%d-%d]\n", getOpcodeDesc(_opcode), _opcode, _roomResource, vm.slot[_currentScript].number); + } + + return _scummStack[--_scummStackPos]; +} void Scumm::drawBox(int x, int y, int x2, int y2, int color) { int top, bottom, count; @@ -865,23 +899,6 @@ int Scumm::getVerbEntrypoint(int obj, int entry) return verboffs + READ_LE_UINT16(verbptr + 1); } - -void Scumm::push(int a) -{ - assert(_scummStackPos >= 0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); - _scummStack[_scummStackPos++] = a; -} - -int Scumm::pop() -{ - if ((_scummStackPos < 1) || ((unsigned int)_scummStackPos > ARRAYSIZE(_scummStack))) { - error("No items on stack to pop() for %s (0x%X) at [%d-%d]\n", _opcodes[_opcode].desc, _opcode, _roomResource, vm.slot[_currentScript].number); - } - - return _scummStack[--_scummStackPos]; -} - - void Scumm::endCutscene() { ScriptSlot *ss = &vm.slot[_currentScript]; diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index d1aa599d54..7c5e1111ff 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -26,11 +26,11 @@ #include "verbs.h" #include "scumm/sound.h" -#define OPCODE(x) { &Scumm::x, #x } +#define OPCODE(x) { &Scumm_v5::x, #x } -void Scumm::setupOpcodes_V5() +void Scumm_v5::setupOpcodes() { - static const OpcodeEntry opcodes[256] = { + static const OpcodeEntryV5 opcodes[256] = { /* 00 */ OPCODE(o5_stopObjectCode), OPCODE(o5_putActor), @@ -353,15 +353,15 @@ void Scumm::setupOpcodes_V5() OPCODE(o5_drawBox) }; - _opcodes = opcodes; + _opcodesV5 = opcodes; } -void Scumm::o5_actorFollowCamera() +void Scumm_v5::o5_actorFollowCamera() { actorFollowCamera(getVarOrDirectByte(0x80)); } -void Scumm::o5_actorFromPos() +void Scumm_v5::o5_actorFromPos() { int x, y; getResultPos(); @@ -370,7 +370,7 @@ void Scumm::o5_actorFromPos() setResult(getActorFromPos(x, y)); } -void Scumm::o5_actorSet() +void Scumm_v5::o5_actorSet() { static const byte convertTable[20] = { 1, 0, 0, 2, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20 }; @@ -508,7 +508,7 @@ void Scumm::o5_actorSet() } } -void Scumm::o5_setClass() +void Scumm_v5::o5_setClass() { int obj = getVarOrDirectWord(0x80); int newClass; @@ -530,7 +530,7 @@ void Scumm::o5_setClass() } } -void Scumm::o5_add() +void Scumm_v5::o5_add() { int a; getResultPos(); @@ -538,7 +538,7 @@ void Scumm::o5_add() setResult(readVar(_resultVarNumber) + a); } -void Scumm::o5_and() +void Scumm_v5::o5_and() { int a; getResultPos(); @@ -546,7 +546,7 @@ void Scumm::o5_and() setResult(readVar(_resultVarNumber) & a); } -void Scumm::o5_animateActor() +void Scumm_v5::o5_animateActor() { int act = getVarOrDirectByte(0x80); int anim = getVarOrDirectByte(0x40); @@ -558,18 +558,18 @@ void Scumm::o5_animateActor() a->animateActor(anim); } -void Scumm::o5_badOpcode() +void Scumm_v5::o5_badOpcode() { error("Scumm opcode %d illegal", _opcode); } -void Scumm::o5_breakHere() +void Scumm_v5::o5_breakHere() { updateScriptPtr(); _currentScript = 0xFF; } -void Scumm::o5_chainScript() +void Scumm_v5::o5_chainScript() { int16 vars[16]; int data; @@ -588,7 +588,7 @@ void Scumm::o5_chainScript() runScript(data, vm.slot[cur].unk1, vm.slot[cur].unk2, vars); } -void Scumm::o5_cursorCommand() +void Scumm_v5::o5_cursorCommand() { int i, j, k; int16 table[16]; @@ -651,30 +651,30 @@ void Scumm::o5_cursorCommand() _vars[VAR_USERPUT] = _userPut; } -void Scumm::o5_cutscene() +void Scumm_v5::o5_cutscene() { int16 args[16]; getWordVararg(args); cutscene(args); } -void Scumm::o5_endCutscene() +void Scumm_v5::o5_endCutscene() { endCutscene(); } -void Scumm::o5_debug() +void Scumm_v5::o5_debug() { getVarOrDirectWord(0x80); } -void Scumm::o5_decrement() +void Scumm_v5::o5_decrement() { getResultPos(); setResult(readVar(_resultVarNumber) - 1); } -void Scumm::o5_delay() +void Scumm_v5::o5_delay() { int delay = fetchScriptByte(); delay |= fetchScriptByte() << 8; @@ -684,14 +684,14 @@ void Scumm::o5_delay() o5_breakHere(); } -void Scumm::o5_delayVariable() +void Scumm_v5::o5_delayVariable() { vm.slot[_currentScript].delay = readVar(fetchScriptWord()); vm.slot[_currentScript].status = 1; o5_breakHere(); } -void Scumm::o5_divide() +void Scumm_v5::o5_divide() { int a; getResultPos(); @@ -703,7 +703,7 @@ void Scumm::o5_divide() setResult(readVar(_resultVarNumber) / a); } -void Scumm::o5_doSentence() +void Scumm_v5::o5_doSentence() { int a, b; SentenceTab *st; @@ -729,7 +729,7 @@ void Scumm::o5_doSentence() st->freezeCount = 0; } -void Scumm::o5_drawBox() +void Scumm_v5::o5_drawBox() { int x, y, x2, y2, color; @@ -744,7 +744,7 @@ void Scumm::o5_drawBox() drawBox(x, y, x2, y2, color); } -void Scumm::o5_drawObject() +void Scumm_v5::o5_drawObject() { int state, obj, idx, i; ObjectData *od; @@ -801,13 +801,13 @@ void Scumm::o5_drawObject() putState(obj, state); } -void Scumm::o5_dummy() +void Scumm_v5::o5_dummy() { /* nothing */ } -void Scumm::o5_expression() +void Scumm_v5::o5_expression() { int dst, i; @@ -840,7 +840,7 @@ void Scumm::o5_expression() break; case 6: /* normal opcode */ _opcode = fetchScriptByte(); - (this->*(getOpcode(_opcode))) (); + executeOpcode(_opcode); push(_vars[0]); break; } @@ -850,7 +850,7 @@ void Scumm::o5_expression() setResult(pop()); } -void Scumm::o5_faceActor() +void Scumm_v5::o5_faceActor() { int act, obj; act = getVarOrDirectByte(0x80); @@ -858,7 +858,7 @@ void Scumm::o5_faceActor() faceActorToObj(act, obj); } -void Scumm::o5_findInventory() +void Scumm_v5::o5_findInventory() { int t; getResultPos(); @@ -866,7 +866,7 @@ void Scumm::o5_findInventory() setResult(findInventory(t, getVarOrDirectByte(0x40))); } -void Scumm::o5_findObject() +void Scumm_v5::o5_findObject() { int t; getResultPos(); @@ -874,7 +874,7 @@ void Scumm::o5_findObject() setResult(findObject(t, getVarOrDirectWord(0x40))); } -void Scumm::o5_freezeScripts() +void Scumm_v5::o5_freezeScripts() { int scr = getVarOrDirectByte(0x80); @@ -884,7 +884,7 @@ void Scumm::o5_freezeScripts() unfreezeScripts(); } -void Scumm::o5_getActorCostume() +void Scumm_v5::o5_getActorCostume() { int act; Actor *a; @@ -900,7 +900,7 @@ void Scumm::o5_getActorCostume() setResult(a->costume); } -void Scumm::o5_getActorElevation() +void Scumm_v5::o5_getActorElevation() { int act; Actor *a; @@ -916,7 +916,7 @@ void Scumm::o5_getActorElevation() setResult(a->elevation); } -void Scumm::o5_getActorFacing() +void Scumm_v5::o5_getActorFacing() { int act; Actor *a; @@ -932,7 +932,7 @@ void Scumm::o5_getActorFacing() setResult(newDirToOldDir (a->facing)); } -void Scumm::o5_getActorMoving() +void Scumm_v5::o5_getActorMoving() { int act; Actor *a; @@ -948,7 +948,7 @@ void Scumm::o5_getActorMoving() setResult(a->moving); } -void Scumm::o5_getActorRoom() +void Scumm_v5::o5_getActorRoom() { int act; Actor *a; @@ -964,7 +964,7 @@ void Scumm::o5_getActorRoom() setResult(a->room); } -void Scumm::o5_getActorScale() +void Scumm_v5::o5_getActorScale() { // INDY3 uses this opcode as a wait_for_actor(); if (_gameId == GID_INDY3_256) { @@ -981,7 +981,7 @@ void Scumm::o5_getActorScale() setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorScale")->scalex); } -void Scumm::o5_getActorWalkBox() +void Scumm_v5::o5_getActorWalkBox() { Actor *a; getResultPos(); @@ -992,13 +992,13 @@ void Scumm::o5_getActorWalkBox() setResult(0); } -void Scumm::o5_getActorWidth() +void Scumm_v5::o5_getActorWidth() { getResultPos(); setResult(derefActorSafe(getVarOrDirectByte(0x80), "o5_getActorWidth")->width); } -void Scumm::o5_getActorX() +void Scumm_v5::o5_getActorX() { int a; getResultPos(); @@ -1011,7 +1011,7 @@ void Scumm::o5_getActorX() setResult(getObjX(a)); } -void Scumm::o5_getActorY() +void Scumm_v5::o5_getActorY() { int a; getResultPos(); @@ -1035,7 +1035,7 @@ void Scumm::o5_getActorY() setResult(getObjY(a)); } -void Scumm::o5_getAnimCounter() +void Scumm_v5::o5_getAnimCounter() { Actor *a; getResultPos(); @@ -1048,7 +1048,7 @@ void Scumm::o5_getAnimCounter() setResult(0); } -void Scumm::o5_getClosestObjActor() +void Scumm_v5::o5_getClosestObjActor() { int obj; int act; @@ -1071,7 +1071,7 @@ void Scumm::o5_getClosestObjActor() setResult(closest_dist); } -void Scumm::o5_getDist() +void Scumm_v5::o5_getDist() { int o1, o2; int r; @@ -1087,19 +1087,19 @@ void Scumm::o5_getDist() setResult(r); } -void Scumm::o5_getInventoryCount() +void Scumm_v5::o5_getInventoryCount() { getResultPos(); setResult(getInventoryCount(getVarOrDirectByte(0x80))); } -void Scumm::o5_getObjectOwner() +void Scumm_v5::o5_getObjectOwner() { getResultPos(); setResult(getOwner(getVarOrDirectWord(0x80))); } -void Scumm::o5_getObjectState() +void Scumm_v5::o5_getObjectState() { if (_features & GF_SMALL_HEADER) { o5_ifState(); @@ -1109,7 +1109,7 @@ void Scumm::o5_getObjectState() } } -void Scumm::o5_ifState() +void Scumm_v5::o5_ifState() { int a = getVarOrDirectWord(0x80); int b = getVarOrDirectByte(0x40); @@ -1120,7 +1120,7 @@ void Scumm::o5_ifState() ignoreScriptWord(); } -void Scumm::o5_ifNotState() +void Scumm_v5::o5_ifNotState() { int a = getVarOrDirectWord(0x80); int b = getVarOrDirectByte(0x40); @@ -1131,19 +1131,19 @@ void Scumm::o5_ifNotState() ignoreScriptWord(); } -void Scumm::o5_getRandomNr() +void Scumm_v5::o5_getRandomNr() { getResultPos(); setResult(_rnd.getRandomNumber(getVarOrDirectByte(0x80))); } -void Scumm::o5_getScriptRunning() +void Scumm_v5::o5_getScriptRunning() { getResultPos(); setResult(isScriptRunning(getVarOrDirectByte(0x80))); } -void Scumm::o5_getVerbEntrypoint() +void Scumm_v5::o5_getVerbEntrypoint() { int a, b; getResultPos(); @@ -1153,7 +1153,7 @@ void Scumm::o5_getVerbEntrypoint() setResult(getVerbEntrypoint(a, b)); } -void Scumm::o5_ifClassOfIs() +void Scumm_v5::o5_ifClassOfIs() { int act, cls, b = 0; bool cond = true; @@ -1177,13 +1177,13 @@ void Scumm::o5_ifClassOfIs() o5_jumpRelative(); } -void Scumm::o5_increment() +void Scumm_v5::o5_increment() { getResultPos(); setResult(readVar(_resultVarNumber) + 1); } -void Scumm::o5_isActorInBox() +void Scumm_v5::o5_isActorInBox() { int box; Actor *a; @@ -1197,7 +1197,7 @@ void Scumm::o5_isActorInBox() ignoreScriptWord(); } -void Scumm::o5_isEqual() +void Scumm_v5::o5_isEqual() { int16 a, b; int var; @@ -1221,7 +1221,7 @@ void Scumm::o5_isEqual() } -void Scumm::o5_isGreater() +void Scumm_v5::o5_isGreater() { int16 a = readVar(fetchScriptWord()); int16 b = getVarOrDirectWord(0x80); @@ -1231,7 +1231,7 @@ void Scumm::o5_isGreater() o5_jumpRelative(); } -void Scumm::o5_isGreaterEqual() +void Scumm_v5::o5_isGreaterEqual() { int16 a = readVar(fetchScriptWord()); int16 b = getVarOrDirectWord(0x80); @@ -1241,7 +1241,7 @@ void Scumm::o5_isGreaterEqual() o5_jumpRelative(); } -void Scumm::o5_isLess() +void Scumm_v5::o5_isLess() { int16 a = readVar(fetchScriptWord()); int16 b = getVarOrDirectWord(0x80); @@ -1252,7 +1252,7 @@ void Scumm::o5_isLess() o5_jumpRelative(); } -void Scumm::o5_lessOrEqual() +void Scumm_v5::o5_lessOrEqual() { int16 a = readVar(fetchScriptWord()); int16 b = getVarOrDirectWord(0x80); @@ -1262,7 +1262,7 @@ void Scumm::o5_lessOrEqual() o5_jumpRelative(); } -void Scumm::o5_isNotEqual() +void Scumm_v5::o5_isNotEqual() { int16 a = readVar(fetchScriptWord()); int16 b = getVarOrDirectWord(0x80); @@ -1272,7 +1272,7 @@ void Scumm::o5_isNotEqual() o5_jumpRelative(); } -void Scumm::o5_notEqualZero() +void Scumm_v5::o5_notEqualZero() { int a = readVar(fetchScriptWord()); if (a != 0) @@ -1281,7 +1281,7 @@ void Scumm::o5_notEqualZero() o5_jumpRelative(); } -void Scumm::o5_equalZero() +void Scumm_v5::o5_equalZero() { int a = readVar(fetchScriptWord()); if (a == 0) @@ -1290,7 +1290,7 @@ void Scumm::o5_equalZero() o5_jumpRelative(); } -void Scumm::o5_isSoundRunning() +void Scumm_v5::o5_isSoundRunning() { int snd; getResultPos(); @@ -1300,12 +1300,12 @@ void Scumm::o5_isSoundRunning() setResult(snd); } -void Scumm::o5_jumpRelative() +void Scumm_v5::o5_jumpRelative() { _scriptPointer += (int16)fetchScriptWord(); } -void Scumm::o5_lights() +void Scumm_v5::o5_lights() { int a, b, c; @@ -1322,7 +1322,7 @@ void Scumm::o5_lights() _fullRedraw = 1; } -void Scumm::o5_loadRoom() +void Scumm_v5::o5_loadRoom() { int room; @@ -1336,7 +1336,7 @@ void Scumm::o5_loadRoom() _fullRedraw = 1; } -void Scumm::o5_loadRoomWithEgo() +void Scumm_v5::o5_loadRoomWithEgo() { Actor *a; int obj, room, x, y; @@ -1367,7 +1367,7 @@ void Scumm::o5_loadRoomWithEgo() } } -void Scumm::o5_matrixOps() +void Scumm_v5::o5_matrixOps() { int a, b; @@ -1401,13 +1401,13 @@ void Scumm::o5_matrixOps() } } -void Scumm::o5_move() +void Scumm_v5::o5_move() { getResultPos(); setResult(getVarOrDirectWord(0x80)); } -void Scumm::o5_multiply() +void Scumm_v5::o5_multiply() { int a; getResultPos(); @@ -1416,7 +1416,7 @@ void Scumm::o5_multiply() } -void Scumm::o5_or() +void Scumm_v5::o5_or() { int a; getResultPos(); @@ -1424,7 +1424,7 @@ void Scumm::o5_or() setResult(readVar(_resultVarNumber) | a); } -void Scumm::o5_overRide() +void Scumm_v5::o5_overRide() { if (fetchScriptByte() != 0) beginOverride(); @@ -1432,12 +1432,12 @@ void Scumm::o5_overRide() endOverride(); } -void Scumm::o5_panCameraTo() +void Scumm_v5::o5_panCameraTo() { panCameraTo(getVarOrDirectWord(0x80), 0); } -void Scumm::o5_pickupObject() +void Scumm_v5::o5_pickupObject() { int obj, room; if (_features & GF_OLD256) { @@ -1458,19 +1458,19 @@ void Scumm::o5_pickupObject() runHook(1); } -void Scumm::o5_print() +void Scumm_v5::o5_print() { _actorToPrintStrFor = getVarOrDirectByte(0x80); decodeParseString(); } -void Scumm::o5_printEgo() +void Scumm_v5::o5_printEgo() { _actorToPrintStrFor = (unsigned char)_vars[VAR_EGO]; decodeParseString(); } -void Scumm::o5_pseudoRoom() +void Scumm_v5::o5_pseudoRoom() { int i = fetchScriptByte(), j; while ((j = fetchScriptByte()) != 0) { @@ -1480,7 +1480,7 @@ void Scumm::o5_pseudoRoom() } } -void Scumm::o5_putActor() +void Scumm_v5::o5_putActor() { int x, y; Actor *a; @@ -1495,7 +1495,7 @@ void Scumm::o5_putActor() } -void Scumm::o5_putActorAtObject() +void Scumm_v5::o5_putActorAtObject() { int obj, x, y; Actor *a; @@ -1511,7 +1511,7 @@ void Scumm::o5_putActorAtObject() a->putActor(x, y, a->room); } -void Scumm::o5_putActorInRoom() +void Scumm_v5::o5_putActorInRoom() { int room; Actor *a; @@ -1528,7 +1528,7 @@ void Scumm::o5_putActorInRoom() a->putActor(0, 0, 0); } -void Scumm::o5_quitPauseRestart() +void Scumm_v5::o5_quitPauseRestart() { switch (fetchScriptByte()) { case 1: @@ -1540,7 +1540,7 @@ void Scumm::o5_quitPauseRestart() } } -void Scumm::o5_resourceRoutines() +void Scumm_v5::o5_resourceRoutines() { const ResTypes resType[4] = { rtScript, rtSound, rtCostume, rtRoom }; int resid = 0; @@ -1662,7 +1662,7 @@ void Scumm::o5_resourceRoutines() } } -void Scumm::o5_roomOps() +void Scumm_v5::o5_roomOps() { int a = 0, b = 0, c, d, e; @@ -1868,7 +1868,7 @@ void Scumm::o5_roomOps() } } -void Scumm::o5_saveRestoreVerbs() +void Scumm_v5::o5_saveRestoreVerbs() { int a, b, c, slot, slot2; @@ -1918,12 +1918,12 @@ void Scumm::o5_saveRestoreVerbs() } } -void Scumm::o5_setCameraAt() +void Scumm_v5::o5_setCameraAt() { setCameraAtEx(getVarOrDirectWord(0x80)); } -void Scumm::o5_setObjectName() +void Scumm_v5::o5_setObjectName() { int obj = getVarOrDirectWord(0x80); int size; @@ -1978,7 +1978,7 @@ void Scumm::o5_setObjectName() runHook(0); } -void Scumm::o5_setOwnerOf() +void Scumm_v5::o5_setOwnerOf() { int obj, owner; @@ -1988,7 +1988,7 @@ void Scumm::o5_setOwnerOf() setOwnerOf(obj, owner); } -void Scumm::o5_setState() +void Scumm_v5::o5_setState() { int obj, state; obj = getVarOrDirectWord(0x80); @@ -1999,7 +1999,7 @@ void Scumm::o5_setState() clearDrawObjectQueue(); } -void Scumm::o5_setVarRange() +void Scumm_v5::o5_setVarRange() { int a, b; @@ -2016,7 +2016,7 @@ void Scumm::o5_setVarRange() } while (--a); } -void Scumm::o5_soundKludge() +void Scumm_v5::o5_soundKludge() { int16 items[15]; int i; @@ -2041,12 +2041,12 @@ void Scumm::o5_soundKludge() _sound->soundKludge(items); } -void Scumm::o5_startMusic() +void Scumm_v5::o5_startMusic() { _sound->addSoundToQueue(getVarOrDirectByte(0x80)); } -void Scumm::o5_startObject() +void Scumm_v5::o5_startObject() { int obj, script; int16 data[16]; @@ -2058,7 +2058,7 @@ void Scumm::o5_startObject() runVerbCode(obj, script, 0, 0, data); } -void Scumm::o5_startScript() +void Scumm_v5::o5_startScript() { int op, script; int16 data[16]; @@ -2078,7 +2078,7 @@ void Scumm::o5_startScript() runScript(script, a, b, data); } -void Scumm::o5_startSound() +void Scumm_v5::o5_startSound() { _vars[VAR_MUSIC_FLAG] = 0; @@ -2086,22 +2086,22 @@ void Scumm::o5_startSound() _sound->addSoundToQueue(getVarOrDirectByte(0x80)); } -void Scumm::o5_stopMusic() +void Scumm_v5::o5_stopMusic() { _sound->stopAllSounds(); } -void Scumm::o5_stopObjectCode() +void Scumm_v5::o5_stopObjectCode() { stopObjectCode(); } -void Scumm::o5_stopObjectScript() +void Scumm_v5::o5_stopObjectScript() { stopObjectScript(getVarOrDirectWord(0x80)); } -void Scumm::o5_stopScript() +void Scumm_v5::o5_stopScript() { int script; @@ -2112,12 +2112,12 @@ void Scumm::o5_stopScript() stopScriptNr(script); } -void Scumm::o5_stopSound() +void Scumm_v5::o5_stopSound() { _sound->stopSound(getVarOrDirectByte(0x80)); } -void Scumm::o5_stringOps() +void Scumm_v5::o5_stringOps() { int a, b, c, i; byte *ptr; @@ -2173,7 +2173,7 @@ void Scumm::o5_stringOps() } } -void Scumm::o5_subtract() +void Scumm_v5::o5_subtract() { int a; getResultPos(); @@ -2181,7 +2181,7 @@ void Scumm::o5_subtract() setResult(readVar(_resultVarNumber) - a); } -void Scumm::o5_verbOps() +void Scumm_v5::o5_verbOps() { int verb, slot; VerbSlot *vs; @@ -2322,7 +2322,7 @@ void Scumm::o5_verbOps() verbMouseOver(0); } -void Scumm::o5_wait() +void Scumm_v5::o5_wait() { byte *oldaddr; @@ -2365,7 +2365,7 @@ void Scumm::o5_wait() o5_breakHere(); } -void Scumm::o5_walkActorTo() +void Scumm_v5::o5_walkActorTo() { int x, y; Actor *a; @@ -2375,7 +2375,7 @@ void Scumm::o5_walkActorTo() a->startWalkActor(x, y, -1); } -void Scumm::o5_walkActorToActor() +void Scumm_v5::o5_walkActorToActor() { int b, x, y; Actor *a, *a2; @@ -2421,7 +2421,7 @@ void Scumm::o5_walkActorToActor() a->startWalkActor(x, y, -1); } -void Scumm::o5_walkActorToObject() +void Scumm_v5::o5_walkActorToObject() { int obj; Actor *a; @@ -2437,7 +2437,7 @@ void Scumm::o5_walkActorToObject() } } -int Scumm::getWordVararg(int16 *ptr) +int Scumm_v5::getWordVararg(int16 *ptr) { int i; @@ -2451,21 +2451,21 @@ int Scumm::getWordVararg(int16 *ptr) return i; } -int Scumm::getVarOrDirectWord(byte mask) +int Scumm_v5::getVarOrDirectWord(byte mask) { if (_opcode & mask) return readVar(fetchScriptWord()); return (int16)fetchScriptWord(); } -int Scumm::getVarOrDirectByte(byte mask) +int Scumm_v5::getVarOrDirectByte(byte mask) { if (_opcode & mask) return readVar(fetchScriptWord()); return fetchScriptByte(); } -void Scumm::decodeParseString() +void Scumm_v5::decodeParseString() { int textSlot; @@ -2572,7 +2572,7 @@ void Scumm::decodeParseString() _string[textSlot].t_charset = _string[textSlot].charset; } -void Scumm::o5_oldRoomEffect() +void Scumm_v5::o5_oldRoomEffect() { int a; @@ -2588,7 +2588,7 @@ void Scumm::o5_oldRoomEffect() } } -void Scumm::o5_pickupObjectOld() +void Scumm_v5::o5_pickupObjectOld() { int obj = getVarOrDirectWord(0x80); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 34171c4857..c70c9faa45 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -35,11 +35,11 @@ #include "dialogs.h" // FIXME: This is just for the FT-INSANE warning. // Remove when INSANE is implemented -#define OPCODE(x) { &Scumm::x, #x } +#define OPCODE(x) { &Scumm_v6::x, #x } -void Scumm::setupOpcodes_V6() +void Scumm_v6::setupOpcodes() { - static const OpcodeEntry opcodes[256] = { + static const OpcodeEntryV6 opcodes[256] = { /* 00 */ OPCODE(o6_pushByte), OPCODE(o6_pushWord), @@ -277,7 +277,7 @@ void Scumm::setupOpcodes_V6() OPCODE(o6_talkEgo), /* BC */ OPCODE(o6_dim), - OPCODE(o5_dummy), + OPCODE(o6_dummy), OPCODE(o6_runVerbCodeQuick), OPCODE(o6_runScriptQuick), /* C0 */ @@ -362,9 +362,9 @@ void Scumm::setupOpcodes_V6() OPCODE(o6_invalid), }; - _opcodes = opcodes; + _opcodesV6 = opcodes; } -void Scumm::o6_setBlastObjectWindow() +void Scumm_v6::o6_setBlastObjectWindow() { // Set BOMP processing window int a, b, c, d; @@ -377,7 +377,7 @@ void Scumm::o6_setBlastObjectWindow() // sub_274EF(a, b, c, d); } -int Scumm::popRoomAndObj(int *room) +int Scumm_v6::popRoomAndObj(int *room) { int obj; @@ -430,7 +430,7 @@ void Scumm::writeArray(int array, int idx, int base, int value) } } -int Scumm::getStackList(int16 *args, uint maxnum) +int Scumm_v6::getStackList(int16 *args, uint maxnum) { uint num, i; @@ -450,122 +450,122 @@ int Scumm::getStackList(int16 *args, uint maxnum) return num; } -void Scumm::o6_pushByte() +void Scumm_v6::o6_pushByte() { push(fetchScriptByte()); } -void Scumm::o6_pushWord() +void Scumm_v6::o6_pushWord() { push((int16)fetchScriptWord()); } -void Scumm::o6_pushByteVar() +void Scumm_v6::o6_pushByteVar() { push(readVar(fetchScriptByte())); } -void Scumm::o6_pushWordVar() +void Scumm_v6::o6_pushWordVar() { push(readVar(fetchScriptWord())); } -void Scumm::o6_invalid() +void Scumm_v6::o6_invalid() { error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer); } -void Scumm::o6_byteArrayRead() +void Scumm_v6::o6_byteArrayRead() { int base = pop(); push(readArray(fetchScriptByte(), 0, base)); } -void Scumm::o6_wordArrayRead() +void Scumm_v6::o6_wordArrayRead() { int base = pop(); push(readArray(fetchScriptWord(), 0, base)); } -void Scumm::o6_byteArrayIndexedRead() +void Scumm_v6::o6_byteArrayIndexedRead() { int base = pop(); int idx = pop(); push(readArray(fetchScriptByte(), idx, base)); } -void Scumm::o6_wordArrayIndexedRead() +void Scumm_v6::o6_wordArrayIndexedRead() { int base = pop(); int idx = pop(); push(readArray(fetchScriptWord(), idx, base)); } -void Scumm::o6_dup() +void Scumm_v6::o6_dup() { int a = pop(); push(a); push(a); } -void Scumm::o6_zero() +void Scumm_v6::o6_zero() { push(pop() == 0); } -void Scumm::o6_eq() +void Scumm_v6::o6_eq() { push(pop() == pop()); } -void Scumm::o6_neq() +void Scumm_v6::o6_neq() { push(pop() != pop()); } -void Scumm::o6_gt() +void Scumm_v6::o6_gt() { int a = pop(); push(pop() > a); } -void Scumm::o6_lt() +void Scumm_v6::o6_lt() { int a = pop(); push(pop() < a); } -void Scumm::o6_le() +void Scumm_v6::o6_le() { int a = pop(); push(pop() <= a); } -void Scumm::o6_ge() +void Scumm_v6::o6_ge() { int a = pop(); push(pop() >= a); } -void Scumm::o6_add() +void Scumm_v6::o6_add() { int a = pop(); push(pop() + a); } -void Scumm::o6_sub() +void Scumm_v6::o6_sub() { int a = pop(); push(pop() - a); } -void Scumm::o6_mul() +void Scumm_v6::o6_mul() { int a = pop(); push(pop() * a); } -void Scumm::o6_div() +void Scumm_v6::o6_div() { int a = pop(); if (a == 0) @@ -573,91 +573,91 @@ void Scumm::o6_div() push(pop() / a); } -void Scumm::o6_land() // Logical And +void Scumm_v6::o6_land() // Logical And { int a = pop(); push(pop() && a); } -void Scumm::o6_lor() // Logical Or +void Scumm_v6::o6_lor() // Logical Or { int a = pop(); push(pop() || a); } -void Scumm::o6_bor() // Bitwise Or +void Scumm_v6::o6_bor() // Bitwise Or { int a = pop(); push(pop() | a); } -void Scumm::o6_band() // Bitwise And +void Scumm_v6::o6_band() // Bitwise And { int a = pop(); push(pop() | a); } -void Scumm::o6_kill() +void Scumm_v6::o6_kill() { pop(); } -void Scumm::o6_writeByteVar() +void Scumm_v6::o6_writeByteVar() { writeVar(fetchScriptByte(), pop()); } -void Scumm::o6_writeWordVar() +void Scumm_v6::o6_writeWordVar() { writeVar(fetchScriptWord(), pop()); } -void Scumm::o6_byteArrayWrite() +void Scumm_v6::o6_byteArrayWrite() { int a = pop(); writeArray(fetchScriptByte(), 0, pop(), a); } -void Scumm::o6_wordArrayWrite() +void Scumm_v6::o6_wordArrayWrite() { int a = pop(); writeArray(fetchScriptWord(), 0, pop(), a); } -void Scumm::o6_byteArrayIndexedWrite() +void Scumm_v6::o6_byteArrayIndexedWrite() { int val = pop(); int base = pop(); writeArray(fetchScriptByte(), pop(), base, val); } -void Scumm::o6_wordArrayIndexedWrite() +void Scumm_v6::o6_wordArrayIndexedWrite() { int val = pop(); int base = pop(); writeArray(fetchScriptWord(), pop(), base, val); } -void Scumm::o6_byteVarInc() +void Scumm_v6::o6_byteVarInc() { int var = fetchScriptByte(); writeVar(var, readVar(var) + 1); } -void Scumm::o6_wordVarInc() +void Scumm_v6::o6_wordVarInc() { int var = fetchScriptWord(); writeVar(var, readVar(var) + 1); } -void Scumm::o6_byteArrayInc() +void Scumm_v6::o6_byteArrayInc() { int var = fetchScriptByte(); int base = pop(); writeArray(var, 0, base, readArray(var, 0, base) + 1); } -void Scumm::o6_wordArrayInc() +void Scumm_v6::o6_wordArrayInc() { int var = fetchScriptWord(); int base = pop(); @@ -665,33 +665,33 @@ void Scumm::o6_wordArrayInc() } -void Scumm::o6_byteVarDec() +void Scumm_v6::o6_byteVarDec() { int var = fetchScriptByte(); writeVar(var, readVar(var) - 1); } -void Scumm::o6_wordVarDec() +void Scumm_v6::o6_wordVarDec() { int var = fetchScriptWord(); writeVar(var, readVar(var) - 1); } -void Scumm::o6_byteArrayDec() +void Scumm_v6::o6_byteArrayDec() { int var = fetchScriptByte(); int base = pop(); writeArray(var, 0, base, readArray(var, 0, base) - 1); } -void Scumm::o6_wordArrayDec() +void Scumm_v6::o6_wordArrayDec() { int var = fetchScriptWord(); int base = pop(); writeArray(var, 0, base, readArray(var, 0, base) - 1); } -void Scumm::o6_jumpTrue() +void Scumm_v6::o6_jumpTrue() { if (pop()) o6_jump(); @@ -699,7 +699,7 @@ void Scumm::o6_jumpTrue() fetchScriptWord(); } -void Scumm::o6_jumpFalse() +void Scumm_v6::o6_jumpFalse() { if (!pop()) o6_jump(); @@ -707,12 +707,12 @@ void Scumm::o6_jumpFalse() fetchScriptWord(); } -void Scumm::o6_jump() +void Scumm_v6::o6_jump() { _scriptPointer += (int16)fetchScriptWord(); } -void Scumm::o6_startScriptEx() +void Scumm_v6::o6_startScriptEx() { int16 args[16]; int script, flags; @@ -723,7 +723,7 @@ void Scumm::o6_startScriptEx() runScript(script, flags & 1, flags & 2, args); } -void Scumm::o6_jumpToScript() +void Scumm_v6::o6_jumpToScript() { int16 args[16]; int script, flags; @@ -735,7 +735,7 @@ void Scumm::o6_jumpToScript() runScript(script, flags & 1, flags & 2, args); } -void Scumm::o6_startScript() +void Scumm_v6::o6_startScript() { int16 args[16]; int script; @@ -744,7 +744,7 @@ void Scumm::o6_startScript() runScript(script, 0, 0, args); } -void Scumm::o6_startObject() +void Scumm_v6::o6_startObject() { int16 args[16]; int script, entryp; @@ -756,7 +756,7 @@ void Scumm::o6_startObject() runVerbCode(script, entryp, flags & 1, flags & 2, args); } -void Scumm::o6_setObjectState() +void Scumm_v6::o6_setObjectState() { int a = pop(); int b = pop(); @@ -767,7 +767,7 @@ void Scumm::o6_setObjectState() setObjectState(b, a, -1, -1); } -void Scumm::o6_setObjectXY() +void Scumm_v6::o6_setObjectXY() { int y = pop(); int x = pop(); @@ -776,29 +776,29 @@ void Scumm::o6_setObjectXY() setObjectState(obj, 1, x, y); } -void Scumm::o6_stopObjectCode() +void Scumm_v6::o6_stopObjectCode() { stopObjectCode(); } -void Scumm::o6_endCutscene() +void Scumm_v6::o6_endCutscene() { endCutscene(); } -void Scumm::o6_cutScene() +void Scumm_v6::o6_cutScene() { int16 args[16]; getStackList(args, sizeof(args) / sizeof(args[0])); cutscene(args); } -void Scumm::o6_stopMusic() +void Scumm_v6::o6_stopMusic() { _sound->stopAllSounds(); } -void Scumm::o6_freezeUnfreeze() +void Scumm_v6::o6_freezeUnfreeze() { int a = pop(); if (a) @@ -807,7 +807,7 @@ void Scumm::o6_freezeUnfreeze() unfreezeScripts(); } -void Scumm::o6_cursorCommand() +void Scumm_v6::o6_cursorCommand() { int a, i; int16 args[16]; @@ -871,13 +871,13 @@ void Scumm::o6_cursorCommand() _vars[VAR_USERPUT] = _userPut; } -void Scumm::o6_breakHere() +void Scumm_v6::o6_breakHere() { updateScriptPtr(); _currentScript = 0xFF; } -void Scumm::o6_ifClassOfIs() +void Scumm_v6::o6_ifClassOfIs() { int16 args[16]; int num, obj, cls; @@ -896,7 +896,7 @@ void Scumm::o6_ifClassOfIs() push(cond); } -void Scumm::o6_setClass() +void Scumm_v6::o6_setClass() { int16 args[16]; int num, obj, cls; @@ -915,12 +915,12 @@ void Scumm::o6_setClass() } } -void Scumm::o6_getState() +void Scumm_v6::o6_getState() { push(getState(pop())); } -void Scumm::o6_setState() +void Scumm_v6::o6_setState() { int state = pop(); int obj = pop(); @@ -933,7 +933,7 @@ void Scumm::o6_setState() clearDrawObjectQueue(); } -void Scumm::o6_setOwner() +void Scumm_v6::o6_setOwner() { int owner = pop(); int obj = pop(); @@ -941,32 +941,32 @@ void Scumm::o6_setOwner() setOwnerOf(obj, owner); } -void Scumm::o6_getOwner() +void Scumm_v6::o6_getOwner() { push(getOwner(pop())); } -void Scumm::o6_startSound() +void Scumm_v6::o6_startSound() { _sound->addSoundToQueue(pop()); } -void Scumm::o6_stopSound() +void Scumm_v6::o6_stopSound() { _sound->stopSound(pop()); } -void Scumm::o6_startMusic() +void Scumm_v6::o6_startMusic() { _sound->addSoundToQueue(pop()); } -void Scumm::o6_stopObjectScript() +void Scumm_v6::o6_stopObjectScript() { stopObjectScript(pop()); } -void Scumm::o6_panCameraTo() +void Scumm_v6::o6_panCameraTo() { if (_features & GF_AFTER_V7) { int y = pop(); @@ -977,7 +977,7 @@ void Scumm::o6_panCameraTo() } } -void Scumm::o6_actorFollowCamera() +void Scumm_v6::o6_actorFollowCamera() { if (_features & GF_AFTER_V7) setCameraFollows(derefActorSafe(pop(), "actorFollowCamera")); @@ -986,7 +986,7 @@ void Scumm::o6_actorFollowCamera() } -void Scumm::o6_setCameraAt() +void Scumm_v6::o6_setCameraAt() { if (_features & GF_AFTER_V7) { int x, y; @@ -1002,7 +1002,7 @@ void Scumm::o6_setCameraAt() } } -void Scumm::o6_loadRoom() +void Scumm_v6::o6_loadRoom() { int room; /* Begin: Autosave @@ -1017,7 +1017,7 @@ void Scumm::o6_loadRoom() _fullRedraw = 1; } -void Scumm::o6_stopScript() +void Scumm_v6::o6_stopScript() { int script = pop(); if (script == 0) @@ -1026,7 +1026,7 @@ void Scumm::o6_stopScript() stopScriptNr(script); } -void Scumm::o6_walkActorToObj() +void Scumm_v6::o6_walkActorToObj() { int obj, dist; Actor *a, *a2; @@ -1063,7 +1063,7 @@ void Scumm::o6_walkActorToObj() } } -void Scumm::o6_walkActorTo() +void Scumm_v6::o6_walkActorTo() { int x, y; y = pop(); @@ -1071,7 +1071,7 @@ void Scumm::o6_walkActorTo() derefActorSafe(pop(), "o6_walkActorTo")->startWalkActor(x, y, -1); } -void Scumm::o6_putActorInRoom() +void Scumm_v6::o6_putActorInRoom() { int room, x, y; Actor *a; @@ -1096,7 +1096,7 @@ void Scumm::o6_putActorInRoom() } -void Scumm::o6_putActorAtObject() +void Scumm_v6::o6_putActorAtObject() { int room, obj, x, y; Actor *a; @@ -1115,7 +1115,7 @@ void Scumm::o6_putActorAtObject() a->putActor(x, y, room); } -void Scumm::o6_faceActor() +void Scumm_v6::o6_faceActor() { int act, obj; obj = pop(); @@ -1123,7 +1123,7 @@ void Scumm::o6_faceActor() faceActorToObj(act, obj); } -void Scumm::o6_animateActor() +void Scumm_v6::o6_animateActor() { int anim = pop(); int act = pop(); @@ -1135,7 +1135,7 @@ void Scumm::o6_animateActor() a->animateActor(anim); } -void Scumm::o6_doSentence() +void Scumm_v6::o6_doSentence() { int a, b, c; @@ -1147,7 +1147,7 @@ void Scumm::o6_doSentence() doSentence(c, b, a); } -void Scumm::o6_pickupObject() +void Scumm_v6::o6_pickupObject() { int obj, room; int i; @@ -1173,7 +1173,7 @@ void Scumm::o6_pickupObject() runHook(obj); /* Difference */ } -void Scumm::o6_loadRoomWithEgo() +void Scumm_v6::o6_loadRoomWithEgo() { Actor *a; int obj, room, x, y; @@ -1206,7 +1206,7 @@ void Scumm::o6_loadRoomWithEgo() } } -void Scumm::o6_getRandomNumber() +void Scumm_v6::o6_getRandomNumber() { int rnd; rnd = _rnd.getRandomNumber(pop()); @@ -1214,7 +1214,7 @@ void Scumm::o6_getRandomNumber() push(rnd); } -void Scumm::o6_getRandomNumberRange() +void Scumm_v6::o6_getRandomNumberRange() { int max = pop(); int min = pop(); @@ -1223,70 +1223,70 @@ void Scumm::o6_getRandomNumberRange() push(rnd); } -void Scumm::o6_getActorMoving() +void Scumm_v6::o6_getActorMoving() { push(derefActorSafe(pop(), "o6_getActorMoving")->moving); } -void Scumm::o6_getScriptRunning() +void Scumm_v6::o6_getScriptRunning() { push(isScriptRunning(pop())); } -void Scumm::o6_isRoomScriptRunning() +void Scumm_v6::o6_isRoomScriptRunning() { push(isRoomScriptRunning(pop())); } -void Scumm::o6_getActorRoom() +void Scumm_v6::o6_getActorRoom() { push(derefActorSafe(pop(), "o6_getActorRoom")->room); } -void Scumm::o6_getObjectX() +void Scumm_v6::o6_getObjectX() { push(getObjX(pop())); } -void Scumm::o6_getObjectY() +void Scumm_v6::o6_getObjectY() { push(getObjY(pop())); } -void Scumm::o6_getObjectOldDir() +void Scumm_v6::o6_getObjectOldDir() { push(getObjOldDir(pop())); } -void Scumm::o6_getObjectNewDir() +void Scumm_v6::o6_getObjectNewDir() { push(getObjNewDir(pop())); } -void Scumm::o6_getActorWalkBox() +void Scumm_v6::o6_getActorWalkBox() { Actor *a = derefActorSafe(pop(), "o6_getActorWalkBox"); push(a->ignoreBoxes ? 0 : a->walkbox); } -void Scumm::o6_getActorCostume() +void Scumm_v6::o6_getActorCostume() { push(derefActorSafe(pop(), "o6_getActorCostume")->costume); } -void Scumm::o6_findInventory() +void Scumm_v6::o6_findInventory() { int idx = pop(); int owner = pop(); push(findInventory(owner, idx)); } -void Scumm::o6_getInventoryCount() +void Scumm_v6::o6_getInventoryCount() { push(getInventoryCount(pop())); } -void Scumm::o6_getVerbFromXY() +void Scumm_v6::o6_getVerbFromXY() { int y = pop(); int x = pop(); @@ -1296,17 +1296,17 @@ void Scumm::o6_getVerbFromXY() push(over); } -void Scumm::o6_beginOverride() +void Scumm_v6::o6_beginOverride() { beginOverride(); } -void Scumm::o6_endOverride() +void Scumm_v6::o6_endOverride() { endOverride(); } -void Scumm::o6_setObjectName() +void Scumm_v6::o6_setObjectName() { int obj = pop(); int i; @@ -1337,7 +1337,7 @@ void Scumm::o6_setObjectName() error("New name of %d overflows name table (max = %d)", obj, 50); } -void Scumm::o6_isSoundRunning() +void Scumm_v6::o6_isSoundRunning() { int snd = pop(); @@ -1347,7 +1347,7 @@ void Scumm::o6_isSoundRunning() push(snd); } -void Scumm::o6_setBoxFlags() +void Scumm_v6::o6_setBoxFlags() { int16 table[65]; int num, value; @@ -1360,12 +1360,12 @@ void Scumm::o6_setBoxFlags() } } -void Scumm::o6_createBoxMatrix() +void Scumm_v6::o6_createBoxMatrix() { createBoxMatrix(); } -void Scumm::o6_resourceRoutines() +void Scumm_v6::o6_resourceRoutines() { int resid; @@ -1471,7 +1471,7 @@ void Scumm::o6_resourceRoutines() } } -void Scumm::o6_roomOps() +void Scumm_v6::o6_roomOps() { int a, b, c, d, e; @@ -1598,7 +1598,7 @@ void Scumm::o6_roomOps() } } -void Scumm::o6_actorSet() +void Scumm_v6::o6_actorSet() { Actor *a; int i, j, k; @@ -1762,7 +1762,7 @@ void Scumm::o6_actorSet() } } -void Scumm::o6_verbOps() +void Scumm_v6::o6_verbOps() { int slot, a, b; VerbSlot *vs; @@ -1883,14 +1883,14 @@ void Scumm::o6_verbOps() } } -void Scumm::o6_getActorFromXY() +void Scumm_v6::o6_getActorFromXY() { int y = pop(); int x = pop(); push(getActorFromPos(x, y)); } -void Scumm::o6_findObject() +void Scumm_v6::o6_findObject() { int y = pop(); int x = pop(); @@ -1898,7 +1898,7 @@ void Scumm::o6_findObject() push(r); } -void Scumm::o6_pseudoRoom() +void Scumm_v6::o6_pseudoRoom() { int16 list[100]; int num, a, value; @@ -1913,19 +1913,19 @@ void Scumm::o6_pseudoRoom() } } -void Scumm::o6_getActorElevation() +void Scumm_v6::o6_getActorElevation() { push(derefActorSafe(pop(), "o6_getActorElevation")->elevation); } -void Scumm::o6_getVerbEntrypoint() +void Scumm_v6::o6_getVerbEntrypoint() { int e = pop(); int v = pop(); push(getVerbEntrypoint(v, e)); } -void Scumm::o6_arrayOps() +void Scumm_v6::o6_arrayOps() { int a, b, c, d, num; int16 list[128]; @@ -1965,7 +1965,7 @@ void Scumm::o6_arrayOps() } } -void Scumm::o6_saveRestoreVerbs() +void Scumm_v6::o6_saveRestoreVerbs() { int a, b, c; int slot, slot2; @@ -2014,7 +2014,7 @@ void Scumm::o6_saveRestoreVerbs() } } -void Scumm::o6_drawBox() +void Scumm_v6::o6_drawBox() { int x, y, x2, y2, color; color = pop(); @@ -2025,12 +2025,12 @@ void Scumm::o6_drawBox() drawBox(x, y, x2, y2, color); } -void Scumm::o6_getActorWidth() +void Scumm_v6::o6_getActorWidth() { push(derefActorSafe(pop(), "o6_getActorWidth")->width); } -void Scumm::o6_wait() +void Scumm_v6::o6_wait() { switch (fetchScriptByte()) { case 168:{ @@ -2104,23 +2104,23 @@ void Scumm::o6_wait() o6_breakHere(); } -void Scumm::o6_getActorScaleX() +void Scumm_v6::o6_getActorScaleX() { push(derefActorSafe(pop(), "o6_getActorScale")->scalex); } -void Scumm::o6_getActorAnimCounter1() +void Scumm_v6::o6_getActorAnimCounter1() { push(derefActorSafe(pop(), "o6_getActorAnimCounter")->cost.animCounter1); } -void Scumm::o6_getAnimateVariable() +void Scumm_v6::o6_getAnimateVariable() { int var = pop(); push(derefActorSafe(pop(), "o6_getAnimateVariable")->getAnimVar(var)); } -void Scumm::o6_soundKludge() +void Scumm_v6::o6_soundKludge() { int16 list[16]; getStackList(list, sizeof(list) / sizeof(list[0])); @@ -2128,7 +2128,7 @@ void Scumm::o6_soundKludge() _sound->soundKludge(list); } -void Scumm::o6_isAnyOf() +void Scumm_v6::o6_isAnyOf() { int16 list[100]; int num; @@ -2147,7 +2147,7 @@ void Scumm::o6_isAnyOf() return; } -void Scumm::o6_quitPauseRestart() +void Scumm_v6::o6_quitPauseRestart() { switch (fetchScriptByte()) { case 158: @@ -2161,14 +2161,14 @@ void Scumm::o6_quitPauseRestart() } } -void Scumm::o6_isActorInBox() +void Scumm_v6::o6_isActorInBox() { int box = pop(); Actor *a = derefActorSafe(pop(), "o6_isActorInBox"); push(checkXYInBoxBounds(box, a->x, a->y)); } -void Scumm::o6_delay() +void Scumm_v6::o6_delay() { uint32 delay = (uint16)pop(); vm.slot[_currentScript].delay = delay; @@ -2176,7 +2176,7 @@ void Scumm::o6_delay() o6_breakHere(); } -void Scumm::o6_delayLonger() +void Scumm_v6::o6_delayLonger() { uint32 delay = (uint16)pop() * 60; vm.slot[_currentScript].delay = delay; @@ -2184,7 +2184,7 @@ void Scumm::o6_delayLonger() o6_breakHere(); } -void Scumm::o6_delayVeryLong() +void Scumm_v6::o6_delayVeryLong() { uint32 delay = (uint16)pop() * 3600; vm.slot[_currentScript].delay = delay; @@ -2192,46 +2192,46 @@ void Scumm::o6_delayVeryLong() o6_breakHere(); } -void Scumm::o6_stopSentence() +void Scumm_v6::o6_stopSentence() { _sentenceNum = 0; stopScriptNr(_vars[VAR_SENTENCE_SCRIPT]); clearClickedStatus(); } -void Scumm::o6_print_0() +void Scumm_v6::o6_print_0() { _actorToPrintStrFor = 0xFF; decodeParseString2(0, 0); } -void Scumm::o6_print_1() +void Scumm_v6::o6_print_1() { decodeParseString2(1, 0); } -void Scumm::o6_print_2() +void Scumm_v6::o6_print_2() { decodeParseString2(2, 0); } -void Scumm::o6_print_3() +void Scumm_v6::o6_print_3() { decodeParseString2(3, 0); } -void Scumm::o6_printActor() +void Scumm_v6::o6_printActor() { decodeParseString2(0, 1); } -void Scumm::o6_printEgo() +void Scumm_v6::o6_printEgo() { push(_vars[VAR_EGO]); decodeParseString2(0, 1); } -void Scumm::o6_talkActor() +void Scumm_v6::o6_talkActor() { _actorToPrintStrFor = pop(); _messagePtr = _scriptPointer; @@ -2263,7 +2263,7 @@ void Scumm::o6_talkActor() } } -void Scumm::o6_talkEgo() +void Scumm_v6::o6_talkEgo() { _actorToPrintStrFor = (unsigned char)_vars[VAR_EGO]; _messagePtr = _scriptPointer; @@ -2295,7 +2295,7 @@ void Scumm::o6_talkEgo() } } -void Scumm::o6_dim() +void Scumm_v6::o6_dim() { int data; @@ -2325,7 +2325,12 @@ void Scumm::o6_dim() defineArray(fetchScriptWord(), data, 0, pop()); } -void Scumm::o6_runVerbCodeQuick() +void Scumm_v6::o6_dummy() +{ + /* nothing */ +} + +void Scumm_v6::o6_runVerbCodeQuick() { int16 args[16]; int script, entryp; @@ -2335,7 +2340,7 @@ void Scumm::o6_runVerbCodeQuick() runVerbCode(script, entryp, 0, 1, args); } -void Scumm::o6_runScriptQuick() +void Scumm_v6::o6_runScriptQuick() { int16 args[16]; int script; @@ -2344,7 +2349,7 @@ void Scumm::o6_runScriptQuick() runScript(script, 0, 1, args); } -void Scumm::o6_dim2() +void Scumm_v6::o6_dim2() { int a, b, data; switch (fetchScriptByte()) { @@ -2372,13 +2377,13 @@ void Scumm::o6_dim2() defineArray(fetchScriptWord(), data, a, b); } -void Scumm::o6_abs() +void Scumm_v6::o6_abs() { push(abs(pop())); } -void Scumm::o6_distObjectObject() +void Scumm_v6::o6_distObjectObject() { int a, b; b = pop(); @@ -2386,7 +2391,7 @@ void Scumm::o6_distObjectObject() push(getDistanceBetween(true, a, 0, true, b, 0)); } -void Scumm::o6_distObjectPt() +void Scumm_v6::o6_distObjectPt() { int a, b, c; c = pop(); @@ -2395,7 +2400,7 @@ void Scumm::o6_distObjectPt() push(getDistanceBetween(true, a, 0, false, b, c)); } -void Scumm::o6_distPtPt() +void Scumm_v6::o6_distPtPt() { int a, b, c, d; d = pop(); @@ -2405,12 +2410,7 @@ void Scumm::o6_distPtPt() push(getDistanceBetween(false, a, b, false, c, d)); } -void Scumm::o6_dummy_stacklist() -{ - error("opcode o6_dummy_stacklist invalid"); -} - -void Scumm::o6_drawBlastObject() +void Scumm_v6::o6_drawBlastObject() { int16 args[16]; int a, b, c, d, e; @@ -2424,7 +2424,7 @@ void Scumm::o6_drawBlastObject() enqueueObject(a, b, c, d, e, 0xFF, 0xFF, 1, 0); } -void Scumm::o6_miscOps() +void Scumm_v6::o6_miscOps() { int16 args[30]; int i; @@ -2620,7 +2620,7 @@ void Scumm::o6_miscOps() startManiac(); break; case 9: - unkMiscOp9(); + warning("stub unkMiscOp9()"); break; case 104: /* samnmax */ @@ -2718,7 +2718,7 @@ void Scumm::o6_miscOps() } } -void Scumm::o6_kernelFunction() +void Scumm_v6::o6_kernelFunction() { int16 args[30]; int i; @@ -2804,7 +2804,7 @@ void Scumm::o6_kernelFunction() } } -void Scumm::o6_delayFrames() +void Scumm_v6::o6_delayFrames() { ScriptSlot *ss = &vm.slot[_currentScript]; if (ss->delayFrameCount== 0) { @@ -2818,7 +2818,7 @@ void Scumm::o6_delayFrames() } } -void Scumm::o6_pickOneOf() +void Scumm_v6::o6_pickOneOf() { int16 args[100]; int i, num; @@ -2830,7 +2830,7 @@ void Scumm::o6_pickOneOf() push(args[i]); } -void Scumm::o6_pickOneOfDefault() +void Scumm_v6::o6_pickOneOfDefault() { int16 args[100]; int i, num, def; @@ -2845,7 +2845,7 @@ void Scumm::o6_pickOneOfDefault() push(i); } -void Scumm::o6_getActorPriority() +void Scumm_v6::o6_getActorPriority() { Actor *a; @@ -2854,7 +2854,7 @@ void Scumm::o6_getActorPriority() push(a->layer); } -void Scumm::o6_unknownCD() { +void Scumm_v6::o6_unknownCD() { // Full Throttle: FIXME // Opcode is used when placing the bunny into the // mine field. Some kind of drawBlastObject() wrapper @@ -2866,7 +2866,7 @@ void Scumm::o6_unknownCD() { warning("o6_unknownCD: stub(%d, %d, %d, %d)", a, b, c, d); } -void Scumm::decodeParseString2(int m, int n) +void Scumm_v6::decodeParseString2(int m, int n) { byte b; diff --git a/scumm/scumm.h b/scumm/scumm.h index c158da78d0..92e0980d5d 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -34,6 +34,8 @@ class NewGui; class Dialog; class ConsoleDialog; class Scumm; +class Scumm_v5; +class Scumm_v6; class IMuse; class IMuseDigital; class Actor; @@ -43,10 +45,16 @@ class ScummDebugger; class Serializer; struct FindObjectInRoom; -typedef void (Scumm::*OpcodeProc)(); +typedef void (Scumm_v5::*OpcodeProcV5)(); +typedef void (Scumm_v6::*OpcodeProcV6)(); -struct OpcodeEntry { - OpcodeProc proc; +struct OpcodeEntryV5 { + OpcodeProcV5 proc; + const char *desc; +}; + +struct OpcodeEntryV6 { + OpcodeProcV6 proc; const char *desc; }; @@ -413,8 +421,7 @@ public: /* Not sure where this stuff goes */ byte isMaskActiveAt(int l, int t, int r, int b, byte *mem); void startScene(int room, Actor *a, int b); - void setupScummVarsOld(); // Both of these will simply be one - void setupScummVarsNew(); // 'setupScummVars' in each Scumm_Vx + virtual void setupScummVars(); byte *_objectOwnerTable, *_objectRoomTable, *_objectStateTable; byte _numObjectsInRoom; int8 _userPut; @@ -454,12 +461,14 @@ public: byte *_scriptPointer, *_scriptOrgPointer, *_scriptPointerStart; byte _opcode, _numNestedScripts, _currentScript; uint16 _curExecScript; - const OpcodeEntry *_opcodes; byte **_lastCodePtr; int _resultVarNumber, _scummStackPos; int16 _localParamList[16], _scummStack[150]; - OpcodeProc getOpcode(int i) { return _opcodes[i].proc; } + virtual void setupOpcodes() = 0; + virtual void executeOpcode(int i) = 0; + virtual const char *getOpcodeDesc(int i) = 0; + void initializeLocals(int slot, int16 *vars); int getScriptSlot(); void runScript(int script, int a, int b, int16 *lvarptr); @@ -473,14 +482,12 @@ public: int fetchScriptWord(); void ignoreScriptWord() { fetchScriptWord(); } void ignoreScriptByte() { fetchScriptByte(); } - int getVarOrDirectWord(byte mask); - int getVarOrDirectByte(byte mask); void getResultPos(); void setResult(int result); - int readVar(uint var); - void writeVar(uint var, int value); void push(int a); int pop(); + int readVar(uint var); + void writeVar(uint var, int value); void runHook(int i); bool isScriptInUse(int script); int getStringLen(byte *ptr); @@ -488,9 +495,6 @@ public: void freezeScripts(int scr); void unfreezeScripts(); void runAllScripts(); - void setupOpcodes_V5(); - void setupOpcodes_V6(); - //void setupOpcodes_V8(); void cutscene(int16 *args); void endCutscene(); void exitCutscene(); @@ -507,10 +511,7 @@ public: void arrayop_1(int a, byte *ptr); void copyString(byte *dst, byte *src, int len); void doSentence(int c, int b, int a); - int popRoomAndObj(int *room); - int getWordVararg(int16 *ptr); - void decodeParseString(); - void decodeParseString2(int a, int b); + void setStringVars(int i); /* Script VM or Object class? */ void stopObjectCode(); @@ -937,6 +938,152 @@ public: uint32 fileReadDword() { return _fileHandle.readUint32BE(); } #endif + /* Scumm Vars */ + byte VAR_EGO; + byte VAR_CAMERA_POS_X; + byte VAR_HAVE_MSG; + byte VAR_ROOM; + byte VAR_OVERRIDE; + byte VAR_MACHINE_SPEED; + byte VAR_ME; + byte VAR_NUM_ACTOR; + byte VAR_CURRENT_LIGHTS; + byte VAR_CURRENTDRIVE; + byte VAR_TMR_1; + byte VAR_TMR_2; + byte VAR_TMR_3; + byte VAR_MUSIC_FLAG; + byte VAR_ACTOR_RANGE_MIN; + byte VAR_ACTOR_RANGE_MAX; + byte VAR_CAMERA_MIN_X; + byte VAR_CAMERA_MAX_X; + byte VAR_TIMER_NEXT; + byte VAR_VIRT_MOUSE_X; + byte VAR_VIRT_MOUSE_Y; + byte VAR_ROOM_RESOURCE; + byte VAR_LAST_SOUND; + byte VAR_CUTSCENEEXIT_KEY; + byte VAR_OPTIONS_KEY; + byte VAR_TALK_ACTOR; + byte VAR_CAMERA_FAST_X; + byte VAR_SCROLL_SCRIPT; + byte VAR_ENTRY_SCRIPT; + byte VAR_ENTRY_SCRIPT2; + byte VAR_EXIT_SCRIPT; + byte VAR_EXIT_SCRIPT2; + byte VAR_VERB_SCRIPT; + byte VAR_SENTENCE_SCRIPT; + byte VAR_HOOK_SCRIPT; + byte VAR_CUTSCENE_START_SCRIPT; + byte VAR_CUTSCENE_END_SCRIPT; + byte VAR_CHARINC; + byte VAR_WALKTO_OBJ; + byte VAR_DEBUGMODE; + byte VAR_HEAPSPACE; + byte VAR_RESTART_KEY; + byte VAR_PAUSE_KEY; + byte VAR_MOUSE_X; + byte VAR_MOUSE_Y; + byte VAR_TIMER; + byte VAR_TMR_4; + byte VAR_SOUNDCARD; + byte VAR_VIDEOMODE; + byte VAR_SAVELOADDIALOG_KEY; + byte VAR_FIXEDDISK; + byte VAR_CURSORSTATE; + byte VAR_USERPUT; + byte VAR_SOUNDRESULT; + byte VAR_TALKSTOP_KEY; + byte VAR_59; + + byte VAR_SOUNDPARAM; + byte VAR_SOUNDPARAM2; + byte VAR_SOUNDPARAM3; + byte VAR_MOUSEPRESENT; + byte VAR_PERFORMANCE_1; + byte VAR_PERFORMANCE_2; + byte VAR_ROOM_FLAG; + byte VAR_GAME_LOADED; + byte VAR_NEW_ROOM; + byte VAR_VERSION; + + byte VAR_V5_DRAWFLAGS; + byte VAR_MI1_TIMER; + byte VAR_V5_OBJECT_LO; + byte VAR_V5_OBJECT_HI; + byte VAR_V5_TALK_STRING_Y; + byte VAR_V5_CHARFLAG; + + byte VAR_V6_SCREEN_WIDTH; + byte VAR_V6_SCREEN_HEIGHT; + byte VAR_V6_EMSSPACE; + byte VAR_V6_RANDOM_NR; + + byte VAR_STRING2DRAW; + byte VAR_CAMERA_POS_Y; + + byte VAR_CAMERA_MIN_Y; + byte VAR_CAMERA_MAX_Y; + byte VAR_CAMERA_THRESHOLD_X; + byte VAR_CAMERA_THRESHOLD_Y; + byte VAR_CAMERA_SPEED_X; + byte VAR_CAMERA_SPEED_Y; + byte VAR_CAMERA_ACCEL_X; + byte VAR_CAMERA_ACCEL_Y; + + byte VAR_CAMERA_DEST_X; + + byte VAR_CAMERA_DEST_Y; + + byte VAR_CAMERA_FOLLOWED_ACTOR; + + byte VAR_LEFTBTN_DOWN; + byte VAR_RIGHTBTN_DOWN; + byte VAR_LEFTBTN_HOLD; + byte VAR_RIGHTBTN_HOLD; + + byte VAR_UNK_SCRIPT; + byte VAR_UNK_SCRIPT_2; + + byte VAR_DEFAULT_TALK_DELAY; + byte VAR_CHARSET_MASK; + + byte VAR_CUSTOMSCALETABLE; + byte VAR_VIDEONAME; + byte VAR_V6_SOUNDMODE; + + void launch(); + + Scumm(GameDetector *detector, OSystem *syst); + virtual ~Scumm(); + + void go(); + + void waitForTimer(int msec_delay); + + void updateCursor(); + void animateCursor(); + void updatePalette(); +}; + +class Scumm_v5 : public Scumm +{ +protected: + const OpcodeEntryV5 *_opcodesV5; + +public: + Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} + +protected: + virtual void setupOpcodes(); + virtual void executeOpcode(int i); + virtual const char *getOpcodeDesc(int i); + + void decodeParseString(); + int getWordVararg(int16 *ptr); + int getVarOrDirectWord(byte mask); + int getVarOrDirectByte(byte mask); + /* Version 5 script opcodes */ void o5_actorFollowCamera(); void o5_actorFromPos(); @@ -1043,12 +1190,57 @@ public: void o5_walkActorToObject(); void o5_oldRoomEffect(); void o5_pickupObjectOld(); +}; - /* Version 6 script opcodes */ +// FIXME - subclassing V2 from Scumm_v5 is a hack: V2 should have its own opcode table +class Scumm_v2 : public Scumm_v5 +{ +public: + Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {} + + virtual void readIndexFile(); +}; + +// FIXME - maybe we should move the opcodes from v5 to v3, and change the inheritance +// accordingly - that would be more logical I guess. However, if you do so, take care +// of preserving the right readIndexFile / loadCharset !!! +class Scumm_v3 : public Scumm_v5 +{ +public: + Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm_v5(detector, syst) {} + + void readIndexFile(); + virtual void loadCharset(int no); +}; + +class Scumm_v4 : public Scumm_v3 +{ +public: + Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {} + + void loadCharset(int no); +}; + +class Scumm_v6 : public Scumm +{ +protected: + const OpcodeEntryV6 *_opcodesV6; + +public: + Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} + +protected: + virtual void setupOpcodes(); + + virtual void executeOpcode(int i); + virtual const char *getOpcodeDesc(int i); + + int popRoomAndObj(int *room); + + void decodeParseString2(int a, int b); int getStackList(int16 *args, uint maxnum); - void setStringVars(int i); - void unkMiscOp9(); + /* Version 6 script opcodes */ void o6_setBlastObjectWindow(); void o6_pushByte(); void o6_pushWord(); @@ -1180,6 +1372,7 @@ public: void o6_talkActor(); void o6_talkEgo(); void o6_dim(); + void o6_dummy(); void o6_runVerbCodeQuick(); void o6_runScriptQuick(); void o6_dim2(); @@ -1187,7 +1380,6 @@ public: void o6_distObjectObject(); void o6_distObjectPt(); void o6_distPtPt(); - void o6_dummy_stacklist(); void o6_miscOps(); void o6_delayFrames(); void o6_pickOneOf(); @@ -1201,177 +1393,15 @@ public: void o6_unknownCD(); void o6_bor(); void o6_band(); - // void o7_userfaceOps(); - - /* Scumm Vars */ - byte VAR_EGO; - byte VAR_CAMERA_POS_X; - byte VAR_HAVE_MSG; - byte VAR_ROOM; - byte VAR_OVERRIDE; - byte VAR_MACHINE_SPEED; - byte VAR_ME; - byte VAR_NUM_ACTOR; - byte VAR_CURRENT_LIGHTS; - byte VAR_CURRENTDRIVE; - byte VAR_TMR_1; - byte VAR_TMR_2; - byte VAR_TMR_3; - byte VAR_MUSIC_FLAG; - byte VAR_ACTOR_RANGE_MIN; - byte VAR_ACTOR_RANGE_MAX; - byte VAR_CAMERA_MIN_X; - byte VAR_CAMERA_MAX_X; - byte VAR_TIMER_NEXT; - byte VAR_VIRT_MOUSE_X; - byte VAR_VIRT_MOUSE_Y; - byte VAR_ROOM_RESOURCE; - byte VAR_LAST_SOUND; - byte VAR_CUTSCENEEXIT_KEY; - byte VAR_OPTIONS_KEY; - byte VAR_TALK_ACTOR; - byte VAR_CAMERA_FAST_X; - byte VAR_SCROLL_SCRIPT; - byte VAR_ENTRY_SCRIPT; - byte VAR_ENTRY_SCRIPT2; - byte VAR_EXIT_SCRIPT; - byte VAR_EXIT_SCRIPT2; - byte VAR_VERB_SCRIPT; - byte VAR_SENTENCE_SCRIPT; - byte VAR_HOOK_SCRIPT; - byte VAR_CUTSCENE_START_SCRIPT; - byte VAR_CUTSCENE_END_SCRIPT; - byte VAR_CHARINC; - byte VAR_WALKTO_OBJ; - byte VAR_DEBUGMODE; - byte VAR_HEAPSPACE; - byte VAR_RESTART_KEY; - byte VAR_PAUSE_KEY; - byte VAR_MOUSE_X; - byte VAR_MOUSE_Y; - byte VAR_TIMER; - byte VAR_TMR_4; - byte VAR_SOUNDCARD; - byte VAR_VIDEOMODE; - byte VAR_SAVELOADDIALOG_KEY; - byte VAR_FIXEDDISK; - byte VAR_CURSORSTATE; - byte VAR_USERPUT; - byte VAR_SOUNDRESULT; - byte VAR_TALKSTOP_KEY; - byte VAR_59; - - byte VAR_SOUNDPARAM; - byte VAR_SOUNDPARAM2; - byte VAR_SOUNDPARAM3; - byte VAR_MOUSEPRESENT; - byte VAR_PERFORMANCE_1; - byte VAR_PERFORMANCE_2; - byte VAR_ROOM_FLAG; - byte VAR_GAME_LOADED; - byte VAR_NEW_ROOM; - byte VAR_VERSION; - - byte VAR_V5_DRAWFLAGS; - byte VAR_MI1_TIMER; - byte VAR_V5_OBJECT_LO; - byte VAR_V5_OBJECT_HI; - byte VAR_V5_TALK_STRING_Y; - byte VAR_V5_CHARFLAG; - - byte VAR_V6_SCREEN_WIDTH; - byte VAR_V6_SCREEN_HEIGHT; - byte VAR_V6_EMSSPACE; - byte VAR_V6_RANDOM_NR; - - byte VAR_STRING2DRAW; - byte VAR_CAMERA_POS_Y; - - byte VAR_CAMERA_MIN_Y; - byte VAR_CAMERA_MAX_Y; - byte VAR_CAMERA_THRESHOLD_X; - byte VAR_CAMERA_THRESHOLD_Y; - byte VAR_CAMERA_SPEED_X; - byte VAR_CAMERA_SPEED_Y; - byte VAR_CAMERA_ACCEL_X; - byte VAR_CAMERA_ACCEL_Y; - - byte VAR_CAMERA_DEST_X; - - byte VAR_CAMERA_DEST_Y; - - byte VAR_CAMERA_FOLLOWED_ACTOR; - - byte VAR_LEFTBTN_DOWN; - byte VAR_RIGHTBTN_DOWN; - byte VAR_LEFTBTN_HOLD; - byte VAR_RIGHTBTN_HOLD; - - byte VAR_UNK_SCRIPT; - byte VAR_UNK_SCRIPT_2; - - byte VAR_DEFAULT_TALK_DELAY; - byte VAR_CHARSET_MASK; - - byte VAR_CUSTOMSCALETABLE; - byte VAR_VIDEONAME; - byte VAR_V6_SOUNDMODE; - - void launch(); - - Scumm(GameDetector *detector, OSystem *syst); - virtual ~Scumm(); - - void go(); - - void waitForTimer(int msec_delay); - - void updateCursor(); - void animateCursor(); - void updatePalette(); -}; - -class Scumm_v2 : public Scumm -{ -public: - Scumm_v2(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} - - virtual void readIndexFile(); -}; - -class Scumm_v3 : public Scumm -{ -public: - Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} - - void readIndexFile(); - virtual void loadCharset(int no); -}; - -class Scumm_v4 : public Scumm_v3 -{ -public: - Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {} - - void loadCharset(int no); -}; - -class Scumm_v5 : public Scumm -{ -public: - Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} }; -class Scumm_v6 : public Scumm +class Scumm_v7 : public Scumm_v6 { public: - Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} -}; + Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm_v6(detector, syst) {} -class Scumm_v7 : public Scumm -{ -public: - Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} +protected: + virtual void setupScummVars(); }; // This is a constant lookup table of reverse bit masks diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 59f68e691c..6bf78fb23a 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1224,11 +1224,6 @@ void Scumm::setStringVars(int slot) st->charset = st->t_charset; } -void Scumm::unkMiscOp9() -{ - warning("stub unkMiscOp9()"); -} - void Scumm::startManiac() { warning("stub startManiac()"); @@ -1535,10 +1530,7 @@ void Scumm::launch() allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0); initVirtScreen(0, 0, 0, _realWidth, _realHeight, false, false); - if (_features & GF_AFTER_V7) - setupScummVarsNew(); - else - setupScummVarsOld(); + setupScummVars(); if ((_features & GF_AFTER_V7) || (_gameId == GID_SAMNMAX)) NUM_ACTORS = 30; @@ -1559,10 +1551,7 @@ void Scumm::launch() readIndexFile(); - if (_features & GF_AFTER_V6) - setupOpcodes_V6(); - else - setupOpcodes_V5(); + setupOpcodes(); scummInit(); diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 6a869db347..4b7d32861e 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -24,9 +24,8 @@ #include "stdafx.h" #include "scumm.h" -void Scumm::setupScummVarsOld() +void Scumm::setupScummVars() { - VAR_EGO = 1; VAR_CAMERA_POS_X = 2; VAR_HAVE_MSG = 3; @@ -112,7 +111,7 @@ void Scumm::setupScummVarsOld() } -void Scumm::setupScummVarsNew() +void Scumm_v7::setupScummVars() { VAR_MOUSE_X = 1; VAR_MOUSE_Y = 2; |