diff options
-rw-r--r-- | scumm/intern.h | 164 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 12 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 1358 |
3 files changed, 548 insertions, 986 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 3845efa993..27c0fa78f7 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -224,6 +224,7 @@ protected: void o6_byteArrayIndexedRead(); void o6_wordArrayIndexedRead(); void o6_dup(); + void o6_pop(); void o6_not(); void o6_eq(); void o6_neq(); @@ -237,7 +238,6 @@ protected: void o6_div(); void o6_land(); void o6_lor(); - void o6_kill(); void o6_writeByteVar(); void o6_writeWordVar(); void o6_byteArrayWrite(); @@ -345,8 +345,8 @@ protected: void o6_talkEgo(); void o6_dim(); void o6_dummy(); - void o6_runVerbCodeQuick(); - void o6_runScriptQuick(); + void o6_startObjectQuick(); + void o6_startScriptQuick(); void o6_dim2(); void o6_abs(); void o6_distObjectObject(); @@ -396,162 +396,22 @@ protected: virtual void executeOpcode(int i); virtual const char *getOpcodeDesc(int i); - virtual uint32 fetchScriptUint32(); - virtual int fetchScriptInt32(); + virtual uint fetchScriptWord(); + virtual int fetchScriptWordSigned(); /* Version 8 script opcodes */ void o8_unknown(); void o8_invalid(); - void o8_pushNumber(); - void o8_pushVariable(); - void o8_pushArrayValue(); - void o8_pushArrayValueIndexed(); - void o8_dup(); - void o8_pop(); - void o8_not(); - void o8_eq(); - void o8_neq(); - void o8_gt(); - void o8_lt(); - void o8_leq(); - void o8_geq(); - void o8_add(); - void o8_sub(); - void o8_mul(); - void o8_div(); - void o8_land(); - void o8_lor(); - void o8_band(); - void o8_bor(); void o8_mod(); - void o8_if(); - void o8_ifNot(); - void o8_jump(); - void o8_breakHere(); - void o8_breakHereVar(); - void o8_waitForStuff(); - void o8_sleepJiffies(); - void o8_sleepSeconds(); - void o8_sleepMinutes(); - void o8_storeVariable(); - void o8_incVariable(); - void o8_decVariable(); - void o8_arrayDim(); - void o8_storeArray(); - void o8_incArray(); - void o8_decArray(); - void o8_arrayDim2(); - void o8_storeArrayIndexed(); - void o8_assignArray(); - void o8_arrayShuffle(); - void o8_arrayLocalize(); - void o8_startScript(); - void o8_startScriptQuick(); - void o8_endScript(); - void o8_stopScript(); - void o8_chainScript(); - void o8_return(); - void o8_startObject(); - void o8_stopObject(); - void o8_cutscene(); - void o8_endCutscene(); - void o8_freezeScripts(); - void o8_beginOverride(); - void o8_endOverride(); - void o8_stopSentence(); - void o8_debug(); - void o8_debugWin(); - void o8_cameraPanTo(); - void o8_cameraFollow(); - void o8_cameraAt(); - void o8_sayLine(); - void o8_sayLineDefault(); - void o8_sayLineSimple(); - void o8_sayLineSimpleDefault(); - void o8_printLine(); - void o8_printCursor(); - void o8_printDebug(); - void o8_printSystem(); - void o8_blastText(); - void o8_drawObject(); - void o8_blastObject(); - void o8_userFace(); - void o8_currentRoom(); - void o8_comeOutDoor(); - void o8_walkActorToObject(); - void o8_walkActorToXY(); - void o8_putActorAtXY(); - void o8_putActorAtObject(); - void o8_faceTowards(); - void o8_doAnimation(); - void o8_doSentence(); - void o8_pickUpObject(); - void o8_setBox(); - void o8_setBoxPath(); - void o8_setBoxSet(); - void o8_heapStuff(); - void o8_roomStuff(); - void o8_actorStuff(); + void o8_wait(); + void o8_cursorCommand(); + void o8_resourceRoutines(); + void o8_roomOps(); + void o8_actorSet(); void o8_cameraStuff(); - void o8_verbStuff(); - void o8_startSfx(); - void o8_startMusic(); - void o8_stopSound(); - void o8_soundKludge(); - void o8_system(); - void o8_verbSets(); - void o8_newNameOf(); - void o8_getTimeDate(); - void o8_drawBox(); - void o8_actObjStamp(); - void o8_startVideo(); - void o8_kludge(); - void o8_pick(); - void o8_pickDefault(); - void o8_pickRandom(); - void o8_inSet(); - void o8_getRandomNumber(); - void o8_getRandomNumberRange(); - void o8_classOf(); - void o8_stateOf(); - void o8_ownerOf(); - void o8_scriptRunning(); - void o8_objectRunning(); - void o8_soundRunning(); - void o8_abs(); - void o8_pixel(); - void o8_inBox(); - void o8_validVerb(); - void o8_findActor(); - void o8_findObject(); - void o8_findVerb(); - void o8_findAllObjects(); - void o8_actorInvertory(); - void o8_actorInvertoryCount(); - void o8_actorVariable(); - void o8_actorRoom(); - void o8_actorBox(); - void o8_actorMoving(); - void o8_actorCostume(); - void o8_actorScale(); - void o8_actorDepth(); - void o8_actorElevation(); - void o8_actorWidth(); - void o8_actObjFacing(); - void o8_actObjX(); - void o8_actObjY(); - void o8_actorChore(); - void o8_proximity2ActObjs(); - void o8_proximity2Points(); - void o8_objectImageX(); - void o8_objectImageY(); - void o8_objectImageWidth(); - void o8_objectImageHeight(); - void o8_verbX(); - void o8_verbY(); - void o8_stringWidth(); - void o8_actorZPlane(); + void o8_verbOps(); }; + #endif diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index af7b9fc77b..20aa5b8a8c 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -74,7 +74,7 @@ void Scumm_v6::setupOpcodes() /* 18 */ OPCODE(o6_land), OPCODE(o6_lor), - OPCODE(o6_kill), + OPCODE(o6_pop), OPCODE(o6_invalid), /* 1C */ OPCODE(o6_invalid), @@ -279,8 +279,8 @@ void Scumm_v6::setupOpcodes() /* BC */ OPCODE(o6_dim), OPCODE(o6_dummy), - OPCODE(o6_runVerbCodeQuick), - OPCODE(o6_runScriptQuick), + OPCODE(o6_startObjectQuick), + OPCODE(o6_startScriptQuick), /* C0 */ OPCODE(o6_dim2), OPCODE(o6_invalid), @@ -616,7 +616,7 @@ void Scumm_v6::o6_band() // Bitwise And push(pop() | a); } -void Scumm_v6::o6_kill() +void Scumm_v6::o6_pop() { pop(); } @@ -2349,7 +2349,7 @@ void Scumm_v6::o6_dummy() /* nothing */ } -void Scumm_v6::o6_runVerbCodeQuick() +void Scumm_v6::o6_startObjectQuick() { int16 args[16]; int script, entryp; @@ -2359,7 +2359,7 @@ void Scumm_v6::o6_runVerbCodeQuick() runVerbCode(script, entryp, 0, 1, args); } -void Scumm_v6::o6_runScriptQuick() +void Scumm_v6::o6_startScriptQuick() { int16 args[16]; int script; diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index d88a11cbe4..b6fb5dfaf8 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -33,327 +33,328 @@ void Scumm_v8::setupOpcodes() { + // TODO: any of the o6_ entries are potentially wrong and pure guesses :-) static const OpcodeEntryV8 opcodes[256] = { /* 00 */ - OPCODE(o8_invalid), - OPCODE(o8_pushNumber), - OPCODE(o8_pushVariable), - OPCODE(o8_pushArrayValue), + OPCODE(o8_unknown), + OPCODE(o6_pushWord), + OPCODE(o6_pushWordVar), + OPCODE(o6_wordArrayRead), /* 04 */ - OPCODE(o8_pushArrayValueIndexed), - OPCODE(o8_dup), - OPCODE(o8_pop), + OPCODE(o6_wordArrayIndexedRead), + OPCODE(o6_dup), + OPCODE(o6_pop), OPCODE(o6_not), /* 08 */ - OPCODE(o8_eq), - OPCODE(o8_neq), - OPCODE(o8_gt), - OPCODE(o8_lt), + OPCODE(o6_eq), + OPCODE(o6_neq), + OPCODE(o6_gt), + OPCODE(o6_lt), /* 0C */ - OPCODE(o8_leq), - OPCODE(o8_geq), - OPCODE(o8_add), - OPCODE(o8_sub), + OPCODE(o6_le), + OPCODE(o6_ge), + OPCODE(o6_add), + OPCODE(o6_sub), /* 10 */ - OPCODE(o8_mul), - OPCODE(o8_div), - OPCODE(o8_land), - OPCODE(o8_lor), + OPCODE(o6_mul), + OPCODE(o6_div), + OPCODE(o6_land), + OPCODE(o6_lor), /* 14 */ - OPCODE(o8_band), - OPCODE(o8_bor), + OPCODE(o6_band), + OPCODE(o6_bor), OPCODE(o8_mod), - OPCODE(o8_invalid), + OPCODE(o8_unknown), /* 18 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 1C */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 20 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 24 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 28 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 2C */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 30 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 34 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 38 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 3C */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 40 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 44 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 48 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 4C */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 50 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 54 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 58 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 5C */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 60 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 64 */ - OPCODE(o8_if), - OPCODE(o8_ifNot), - OPCODE(o8_jump), - OPCODE(o8_breakHere), + OPCODE(o6_jumpFalse), // Not sure about which of these two is which (false==if or true==if ?!?)... + OPCODE(o6_jumpTrue), // ... since "if" could mean 'jump "if"' or 'execute following code "if", otherwise jump'. + OPCODE(o6_jump), + OPCODE(o6_breakHere), /* 68 */ - OPCODE(o8_breakHereVar), - OPCODE(o8_waitForStuff), - OPCODE(o8_sleepJiffies), - OPCODE(o8_sleepSeconds), + OPCODE(o8_unknown), + OPCODE(o8_wait), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 6C */ - OPCODE(o8_sleepMinutes), - OPCODE(o8_storeVariable), - OPCODE(o8_incVariable), - OPCODE(o8_decVariable), + OPCODE(o8_unknown), + OPCODE(o6_writeWordVar), + OPCODE(o6_wordVarInc), + OPCODE(o6_wordVarDec), /* 70 */ - OPCODE(o8_arrayDim), - OPCODE(o8_storeArray), - OPCODE(o8_incArray), - OPCODE(o8_decArray), + OPCODE(o6_dim), + OPCODE(o6_wordArrayWrite), + OPCODE(o6_wordArrayInc), + OPCODE(o6_wordArrayDec), /* 74 */ - OPCODE(o8_arrayDim2), - OPCODE(o8_storeArrayIndexed), - OPCODE(o8_assignArray), - OPCODE(o8_arrayShuffle), + OPCODE(o6_dim2), + OPCODE(o6_wordArrayIndexedWrite), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 78 */ - OPCODE(o8_arrayLocalize), - OPCODE(o8_startScript), - OPCODE(o8_startScriptQuick), - OPCODE(o8_endScript), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 7C */ - OPCODE(o8_stopScript), - OPCODE(o8_chainScript), - OPCODE(o8_return), - OPCODE(o8_startObject), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 80 */ - OPCODE(o8_stopObject), - OPCODE(o8_cutscene), - OPCODE(o8_endCutscene), - OPCODE(o8_freezeScripts), + OPCODE(o8_unknown), + OPCODE(o6_cutscene), + OPCODE(o6_endCutscene), + OPCODE(o8_unknown), /* 84 */ - OPCODE(o8_beginOverride), - OPCODE(o8_endOverride), - OPCODE(o8_stopSentence), - OPCODE(o8_debug), + OPCODE(o6_beginOverride), + OPCODE(o6_endOverride), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 88 */ - OPCODE(o8_debugWin), - OPCODE(o8_classOf), - OPCODE(o8_stateOf), - OPCODE(o8_ownerOf), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 8C */ - OPCODE(o8_cameraPanTo), - OPCODE(o8_cameraFollow), - OPCODE(o8_cameraAt), - OPCODE(o8_sayLine), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 90 */ - OPCODE(o8_sayLineDefault), - OPCODE(o8_sayLineSimple), - OPCODE(o8_sayLineSimpleDefault), - OPCODE(o8_printLine), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 94 */ - OPCODE(o8_printCursor), - OPCODE(o8_printDebug), - OPCODE(o8_printSystem), - OPCODE(o8_blastText), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 98 */ - OPCODE(o8_drawObject), - OPCODE(o8_invalid), - OPCODE(o8_blastObject), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* 9C */ - OPCODE(o8_userFace), - OPCODE(o8_currentRoom), - OPCODE(o8_comeOutDoor), - OPCODE(o8_walkActorToObject), + OPCODE(o8_cursorCommand), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* A0 */ - OPCODE(o8_walkActorToXY), - OPCODE(o8_putActorAtXY), - OPCODE(o8_putActorAtObject), - OPCODE(o8_faceTowards), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* A4 */ - OPCODE(o8_doAnimation), - OPCODE(o8_doSentence), - OPCODE(o8_pickUpObject), - OPCODE(o8_setBox), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* A8 */ - OPCODE(o8_setBoxPath), - OPCODE(o8_setBoxSet), - OPCODE(o8_heapStuff), - OPCODE(o8_roomStuff), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_resourceRoutines), + OPCODE(o8_roomOps), /* AC */ - OPCODE(o8_actorStuff), + OPCODE(o8_actorSet), OPCODE(o8_cameraStuff), - OPCODE(o8_verbStuff), - OPCODE(o8_startSfx), + OPCODE(o8_verbOps), + OPCODE(o8_unknown), /* B0 */ - OPCODE(o8_startMusic), - OPCODE(o8_stopSound), - OPCODE(o8_soundKludge), - OPCODE(o8_system), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* B4 */ - OPCODE(o8_verbSets), - OPCODE(o8_newNameOf), - OPCODE(o8_getTimeDate), - OPCODE(o8_drawBox), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* B8 */ - OPCODE(o8_actObjStamp), - OPCODE(o8_startVideo), - OPCODE(o8_kludge), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* BC */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* C0 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* C4 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* C8 */ OPCODE(o6_startScript), OPCODE(o6_startObject), - OPCODE(o8_pick), - OPCODE(o8_pickDefault), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* CC */ - OPCODE(o8_pickRandom), - OPCODE(o8_inSet), - OPCODE(o8_getRandomNumber), - OPCODE(o8_getRandomNumberRange), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o6_getRandomNumber), + OPCODE(o6_getRandomNumberRange), /* D0 */ - OPCODE(o8_classOf), - OPCODE(o8_stateOf), - OPCODE(o8_ownerOf), - OPCODE(o8_scriptRunning), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* D4 */ - OPCODE(o8_objectRunning), - OPCODE(o8_soundRunning), - OPCODE(o8_abs), - OPCODE(o8_pixel), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* D8 */ - OPCODE(o8_kludge), - OPCODE(o8_inBox), - OPCODE(o8_validVerb), - OPCODE(o8_findActor), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* DC */ - OPCODE(o8_findObject), - OPCODE(o8_findVerb), - OPCODE(o8_findAllObjects), - OPCODE(o8_actorInvertory), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* E0 */ - OPCODE(o8_actorInvertoryCount), - OPCODE(o8_actorVariable), - OPCODE(o8_actorRoom), - OPCODE(o8_actorBox), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* E4 */ - OPCODE(o8_actorMoving), - OPCODE(o8_actorCostume), - OPCODE(o8_actorScale), - OPCODE(o8_actorDepth), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* E8 */ - OPCODE(o8_actorElevation), - OPCODE(o8_actorWidth), - OPCODE(o8_actObjFacing), - OPCODE(o8_actObjX), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* EC */ - OPCODE(o8_actObjY), - OPCODE(o8_actorChore), - OPCODE(o8_proximity2ActObjs), - OPCODE(o8_proximity2Points), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* F0 */ - OPCODE(o8_objectImageX), - OPCODE(o8_objectImageY), - OPCODE(o8_objectImageWidth), - OPCODE(o8_objectImageHeight), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* F4 */ - OPCODE(o8_verbX), - OPCODE(o8_verbY), - OPCODE(o8_stringWidth), - OPCODE(o8_actorZPlane), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* F8 */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), /* FC */ - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), - OPCODE(o8_invalid), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), + OPCODE(o8_unknown), }; _opcodesV8 = opcodes; @@ -370,7 +371,8 @@ const char *Scumm_v8::getOpcodeDesc(int i) return _opcodesV8[i].desc; } -uint32 Scumm_v8::fetchScriptUint32() +// In V8, the word size is 4 byte, not 2 bytes as in V6/V7 games +uint Scumm_v8::fetchScriptWord() { int a; if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) { @@ -383,125 +385,28 @@ uint32 Scumm_v8::fetchScriptUint32() return a; } -int Scumm_v8::fetchScriptInt32() +int Scumm_v8::fetchScriptWordSigned() { - return (int32)fetchScriptUint32(); + return (int32)fetchScriptWord(); } -void Scumm_v8::o8_invalid() -{ - error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer); -} - -void Scumm_v8::o8_pushNumber() -{ -} - -void Scumm_v8::o8_pushVariable() -{ -} - -void Scumm_v8::o8_pushArrayValue() -{ -} - -void Scumm_v8::o8_pushArrayValueIndexed() -{ -} - -void Scumm_v8::o8_dup() -{ -} - -void Scumm_v8::o8_pop() -{ -} - -void Scumm_v8::o8_not() -{ -} - -void Scumm_v8::o8_eq() -{ -} - -void Scumm_v8::o8_neq() -{ -} - -void Scumm_v8::o8_gt() -{ -} - -void Scumm_v8::o8_lt() -{ -} - -void Scumm_v8::o8_leq() -{ -} - -void Scumm_v8::o8_geq() +void Scumm_v8::o8_unknown() { + warning("Unknown opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer); } -void Scumm_v8::o8_add() -{ -} - -void Scumm_v8::o8_sub() -{ -} - -void Scumm_v8::o8_mul() -{ -} - -void Scumm_v8::o8_div() -{ -} - -void Scumm_v8::o8_land() -{ -} - -void Scumm_v8::o8_lor() -{ -} - -void Scumm_v8::o8_band() +void Scumm_v8::o8_invalid() { + error("Invalid opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer); } void Scumm_v8::o8_mod() { + int a = pop(); + push(pop() % a); } -void Scumm_v8::o8_bor() -{ -} - -void Scumm_v8::o8_if() -{ -} - -void Scumm_v8::o8_ifNot() -{ -} - -void Scumm_v8::o8_jump() -{ -} - -void Scumm_v8::o8_breakHere() -{ -} - -void Scumm_v8::o8_breakHereVar() -{ -} - -void Scumm_v8::o8_waitForStuff() +void Scumm_v8::o8_wait() { // TODO byte subOp = fetchScriptByte(); @@ -517,187 +422,7 @@ void Scumm_v8::o8_waitForStuff() } } -void Scumm_v8::o8_sleepJiffies() -{ -} - -void Scumm_v8::o8_sleepSeconds() -{ -} - -void Scumm_v8::o8_sleepMinutes() -{ -} - -void Scumm_v8::o8_storeVariable() -{ -} - -void Scumm_v8::o8_incVariable() -{ -} - -void Scumm_v8::o8_decVariable() -{ -} - -void Scumm_v8::o8_arrayDim() -{ -} - -void Scumm_v8::o8_storeArray() -{ -} - -void Scumm_v8::o8_incArray() -{ -} - -void Scumm_v8::o8_decArray() -{ -} - -void Scumm_v8::o8_arrayDim2() -{ -} - -void Scumm_v8::o8_storeArrayIndexed() -{ -} - -void Scumm_v8::o8_assignArray() -{ -} - -void Scumm_v8::o8_arrayShuffle() -{ -} - -void Scumm_v8::o8_arrayLocalize() -{ -} - -void Scumm_v8::o8_startScript() -{ -} - -void Scumm_v8::o8_startScriptQuick() -{ -} - -void Scumm_v8::o8_endScript() -{ -} - -void Scumm_v8::o8_stopScript() -{ -} - -void Scumm_v8::o8_chainScript() -{ -} - -void Scumm_v8::o8_return() -{ -} - -void Scumm_v8::o8_startObject() -{ -} - -void Scumm_v8::o8_stopObject() -{ -} - -void Scumm_v8::o8_cutscene() -{ -} - -void Scumm_v8::o8_endCutscene() -{ -} - -void Scumm_v8::o8_freezeScripts() -{ -} - -void Scumm_v8::o8_beginOverride() -{ -} - -void Scumm_v8::o8_endOverride() -{ -} - -void Scumm_v8::o8_stopSentence() -{ -} - -void Scumm_v8::o8_debug() -{ -} - -void Scumm_v8::o8_debugWin() -{ -} - -void Scumm_v8::o8_cameraPanTo() -{ -} - -void Scumm_v8::o8_cameraFollow() -{ -} - -void Scumm_v8::o8_cameraAt() -{ -} - -void Scumm_v8::o8_sayLine() -{ -} - -void Scumm_v8::o8_sayLineDefault() -{ -} - -void Scumm_v8::o8_sayLineSimple() -{ -} - -void Scumm_v8::o8_sayLineSimpleDefault() -{ -} - -void Scumm_v8::o8_printLine() -{ -} - -void Scumm_v8::o8_printCursor() -{ -} - -void Scumm_v8::o8_printDebug() -{ -} - -void Scumm_v8::o8_printSystem() -{ -} - -void Scumm_v8::o8_blastText() -{ -} - -void Scumm_v8::o8_drawObject() -{ -} - -void Scumm_v8::o8_blastObject() -{ -} - -void Scumm_v8::o8_userFace() +void Scumm_v8::o8_cursorCommand() { // TODO byte subOp = fetchScriptByte(); @@ -721,59 +446,7 @@ void Scumm_v8::o8_userFace() } } -void Scumm_v8::o8_currentRoom() -{ -} - -void Scumm_v8::o8_comeOutDoor() -{ -} - -void Scumm_v8::o8_walkActorToObject() -{ -} - -void Scumm_v8::o8_walkActorToXY() -{ -} - -void Scumm_v8::o8_putActorAtXY() -{ -} - -void Scumm_v8::o8_putActorAtObject() -{ -} - -void Scumm_v8::o8_faceTowards() -{ -} - -void Scumm_v8::o8_doAnimation() -{ -} - -void Scumm_v8::o8_doSentence() -{ -} - -void Scumm_v8::o8_pickUpObject() -{ -} - -void Scumm_v8::o8_setBox() -{ -} - -void Scumm_v8::o8_setBoxPath() -{ -} - -void Scumm_v8::o8_setBoxSet() -{ -} - -void Scumm_v8::o8_heapStuff() +void Scumm_v8::o8_resourceRoutines() { // TODO byte subOp = fetchScriptByte(); @@ -797,11 +470,11 @@ void Scumm_v8::o8_heapStuff() case 0x4C: // SO_HEAP_NUKE_SCRIPT Remove script from heap case 0x4D: // SO_HEAP_NUKE_SOUND Remove sound from heap default: - error("o8_heapStuff: default case %d", subOp); + error("o8_resourceRoutines: default case %d", subOp); } } -void Scumm_v8::o8_roomStuff() +void Scumm_v8::o8_roomOps() { // TODO byte subOp = fetchScriptByte(); @@ -821,17 +494,17 @@ void Scumm_v8::o8_roomStuff() case 0x5E: // SO_ROOM_LOAD_GAME Load game case 0x5F: // SO_ROOM_SATURATION Set saturation of room colors default: - error("o8_roomStuff: default case %d", subOp); + error("o8_roomOps: default case %d", subOp); } } -void Scumm_v8::o8_actorStuff() +void Scumm_v8::o8_actorSet() { // TODO byte subOp = fetchScriptByte(); Actor *a; - a = derefActorSafe(_curActor, "o8_actorStuff"); + a = derefActorSafe(_curActor, "o8_actorSet"); if (!a) return; @@ -875,7 +548,7 @@ void Scumm_v8::o8_actorStuff() case 0x88: // SO_ACTOR_FREQUENCY Set frequency of actor speech case 0x89: // SO_ACTOR_PAN default: - error("o8_actorStuff: default case %d", subOp); + error("o8_actorset: default case %d", subOp); } } @@ -891,7 +564,7 @@ void Scumm_v8::o8_cameraStuff() } } -void Scumm_v8::o8_verbStuff() +void Scumm_v8::o8_verbOps() { // TODO byte subOp = fetchScriptByte(); @@ -915,242 +588,271 @@ void Scumm_v8::o8_verbStuff() case 0xA6: // SO_VERB_CHARSET Choose charset for verb case 0xA7: // SO_VERB_LINE_SPACING Choose linespacing for verb default: - error("o8_verbStuff: default case %d", subOp); + error("o8_verbops: default case %d", subOp); } } -void Scumm_v8::o8_startSfx() -{ -} - -void Scumm_v8::o8_startMusic() -{ -} - -void Scumm_v8::o8_stopSound() -{ -} - -void Scumm_v8::o8_soundKludge() -{ -} - -void Scumm_v8::o8_system() -{ -} - -void Scumm_v8::o8_verbSets() -{ -} - -void Scumm_v8::o8_newNameOf() -{ -} - -void Scumm_v8::o8_getTimeDate() -{ -} - -void Scumm_v8::o8_drawBox() -{ -} - -void Scumm_v8::o8_actObjStamp() -{ -} - -void Scumm_v8::o8_startVideo() -{ -} - -void Scumm_v8::o8_pick() -{ -} - -void Scumm_v8::o8_pickDefault() -{ -} - -void Scumm_v8::o8_pickRandom() -{ -} - -void Scumm_v8::o8_inSet() -{ -} - -void Scumm_v8::o8_getRandomNumber() -{ -} - -void Scumm_v8::o8_getRandomNumberRange() -{ -} - -void Scumm_v8::o8_classOf() -{ -} - -void Scumm_v8::o8_stateOf() -{ -} - -void Scumm_v8::o8_ownerOf() -{ -} - -void Scumm_v8::o8_scriptRunning() -{ -} - -void Scumm_v8::o8_objectRunning() -{ -} - -void Scumm_v8::o8_soundRunning() -{ -} - -void Scumm_v8::o8_abs() -{ -} - -void Scumm_v8::o8_pixel() -{ -} - -void Scumm_v8::o8_kludge() -{ -} - -void Scumm_v8::o8_inBox() -{ -} - -void Scumm_v8::o8_validVerb() -{ -} - -void Scumm_v8::o8_findActor() -{ -} - -void Scumm_v8::o8_findObject() -{ -} - -void Scumm_v8::o8_findVerb() -{ -} - -void Scumm_v8::o8_findAllObjects() -{ -} - -void Scumm_v8::o8_actorInvertory() -{ -} - -void Scumm_v8::o8_actorInvertoryCount() -{ -} - -void Scumm_v8::o8_actorVariable() -{ -} - -void Scumm_v8::o8_actorRoom() -{ -} - -void Scumm_v8::o8_actorBox() -{ -} - -void Scumm_v8::o8_actorMoving() -{ -} - -void Scumm_v8::o8_actorCostume() -{ -} - -void Scumm_v8::o8_actorScale() -{ -} - -void Scumm_v8::o8_actorDepth() -{ -} - -void Scumm_v8::o8_actorElevation() -{ -} - -void Scumm_v8::o8_actorWidth() -{ -} - -void Scumm_v8::o8_actObjFacing() -{ -} - -void Scumm_v8::o8_actObjX() -{ -} - -void Scumm_v8::o8_actObjY() -{ -} - -void Scumm_v8::o8_actorChore() -{ -} - -void Scumm_v8::o8_proximity2ActObjs() -{ -} - -void Scumm_v8::o8_proximity2Points() -{ -} - -void Scumm_v8::o8_objectImageX() -{ -} - -void Scumm_v8::o8_objectImageY() -{ -} - -void Scumm_v8::o8_objectImageWidth() -{ -} - -void Scumm_v8::o8_objectImageHeight() -{ -} - -void Scumm_v8::o8_verbX() -{ -} - -void Scumm_v8::o8_verbY() -{ -} - -void Scumm_v8::o8_stringWidth() -{ -} - -void Scumm_v8::o8_actorZPlane() -{ -} - /* From http://scummrev.mixnmojo.com/specs/CMIOpcodes.shtml +000 O_0 +001 O_PUSH_NUMBER Push number onto stack. +002 O_PUSH_VARIABLE Push variable value onto stack. +003 O_PUSH_ARRAY_VALUE Push array value onto stack. +004 O_PUSH_ARRAY2_VALUE ? +005 O_DUP Duplicate stack value +006 O_POP Pop value from stack. +007 O_NOT NOT (!) +008 O_EQ Equals (==) +009 O_NEQ Does not equal (!=) +00A O_GT Greater than (>) +00B O_LT Less than (<) +00C O_LEQ Less than or equal (<=) +00D O_GEQ Greater than or equal (>=) +00E O_ADD Add (+) +00F O_SUB Subtract (-) +010 O_MUL Multiply (*) +011 O_DIV Divide (/) +012 O_LAND Logical AND +013 O_LOR Logical OR +014 O_BAND Binary AND +015 O_BOR Binary OR +016 O_MOD Modulus (%) +017 O_23 +018 O_24 +019 O_25 +01A O_26 +01B O_27 +01C O_28 +01D O_29 +01E O_30 +01F O_31 +020 O_32 +021 O_33 +022 O_34 +023 O_35 +024 O_36 +025 O_37 +026 O_38 +027 O_39 +028 O_40 +029 O_41 +02A O_42 +02B O_43 +02C O_44 +02D O_45 +02E O_46 +02F O_47 +030 O_48 +031 O_49 +032 O_50 +033 O_51 +034 O_52 +035 O_53 +036 O_54 +037 O_55 +038 O_56 +039 O_57 +03A O_58 +03B O_59 +03C O_60 +03D O_61 +03E O_62 +03F O_63 +040 O_64 +041 O_65 +042 O_66 +043 O_67 +044 O_68 +045 O_69 +046 O_70 +047 O_71 +048 O_72 +049 O_73 +04A O_74 +04B O_75 +04C O_76 +04D O_77 +04E O_78 +04F O_79 +050 O_80 +051 O_81 +052 O_82 +053 O_83 +054 O_84 +055 O_85 +056 O_86 +057 O_87 +058 O_88 +059 O_89 +05A O_90 +05B O_91 +05C O_92 +05D O_93 +05E O_94 +05F O_95 +060 O_96 +061 O_97 +062 O_98 +063 O_99 +064 O_IF if () +065 O_IF_NOT if not () +066 O_JUMP jump/goto +067 O_BREAK_HERE Break out of script +068 O_BREAK_HERE_VAR +069 O_WAIT_FOR_STUFF Wait Sub opcodes +06A O_SLEEP_JIFFIES Sleep for jiffies (10ths of a second) +06B O_SLEEP_SECONDS Sleep for seconds +06C O_SLEEP_MINUTES Sleep for minutes +06D O_STORE_VARIABLE Assign value to variable +06E O_INC_VARIABLE Increase variable value (++) +06F O_DEC_VARIABLE Decrease variable value (--) +070 O_ARRAY_DIM Set dimension of array +071 O_STORE_ARRAY Assign value to array +072 O_INC_ARRAY Increase array value +073 O_DEC_ARRAY Decrease array value +074 O_ARRAY_DIM2 Set dimensions of 2 dimensional array +075 O_STORE_ARRAY2 Assign value to 2 dimensional array +076 O_ASSIGN_ARRAY ? +077 O_ARRAY_SHUFFLE Shuffle array +078 O_ARRAY_LOCALIZE ? +079 O_START_SCRIPT Start script +07A O_START_SCRIPT_QUICK ? +07B O_END_SCRIPT End script +07C O_STOP_SCRIPT Stop script from running +07D O_CHAIN_SCRIPT ? +07E O_RETURN Return +07F O_START_OBJECT ? +080 O_STOP_OBJECT ? +081 O_CUT_SCENE Start of cutscene (interface off) +082 O_END_CUT_SCENE End of cutscene (interface on) +083 O_FREEZE_SCRIPTS ? +084 O_OVERRIDE ? +085 O_OVERRIDE_OFF ? +086 O_STOP_SENTENCE ? +087 O_DEBUG Set debug mode +088 O_DEBUG_WINDEX Set debug mode with output to external window +089 O_CLASS_OF Set class of script +08A O_STATE_OF ? +08B O_OWNER_OF Set owner of object +08C O_CAMERA_PAN_TO Pan camera to (X,Y) +08D O_CAMERA_FOLLOW Make camera follow character/object +08E O_CAMERA_AT Place camera at specific (X,Y) +08F O_SAY_LINE Talk +090 O_SAY_LINE_DEFAULT Talk using default actor +091 O_SAY_LINE_SIMPLE Talk with less arguments +092 O_SAY_LINE_SIMPLE_DEFAULT Talk with less arguments using default actor +093 O_PRINT_LINE Print a line on screen +094 O_PRINT_CURSOR +095 O_PRINT_DEBUG +096 O_PRINT_SYSTEM +097 O_BLAST_TEXT Text to output to screen +098 O_DRAW_OBJECT Draw object +099 O_153 +09A O_BLAST_OBJECT +09B O_155 +09C O_USERFACE ? +09D O_CURRENT_ROOM Set current room +09E O_COME_OUT_DOOR +09F O_WALK_ACTOR_TO_OBJECT Walk to object +0A0 O_WALK_ACTOR_TO_XY Walk to coordinate +0A1 O_PUT_ACTOR_AT_XY Put at coordinate +0A2 O_PUT_ACTOR_AT_OBJECT Put at object +0A3 O_FACE_TOWARDS Change facing +0A4 O_DO_ANIMATION Animate +0A5 O_DO_SENTENCE +0A6 O_PICK_UP_OBJECT Pick up object +0A7 O_SET_BOX +0A8 O_SET_BOX_PATH +0A9 O_SET_BOX_SET +0AA O_HEAP_STUFF Heap sub opcodes +0AB O_ROOM_STUFF Room sub opcodes +0AC O_ACTOR_STUFF Actor sub opcodes +0AD O_CAMERA_STUFF Camera sub opcodes +0AE O_VERB_STUFF Verb sub opcodes +0AF O_START_SFX Start sound effect +0B0 O_START_MUSIC Start music +0B1 O_STOP_SOUND Stop sound (effect or music) +0B2 O_SOUND_KLUDGE ? +0B3 O_SYSTEM System sub opcodes +0B4 O_VERB_SETS +0B5 O_NEW_NAME_OF Set new name of object +0B6 O_GET_TIME_DATE Get time and/or date +0B7 O_DRAW_BOX +0B8 O_ACTOBJ_STAMP +0B9 O_START_VIDEO Start cutscene video +0BA O_KLUDGE +0BB O_187 +0BC O_188 +0BD O_189 +0BE O_190 +0BF O_191 +0C0 O_192 +0C1 O_193 +0C2 O_194 +0C3 O_195 +0C4 O_196 +0C5 O_197 +0C6 O_198 +0C7 O_199 +0C8 F_START_SCRIPT Start script +0C9 F_START_OBJECT Start object script +0CA F_PICK +0CB F_PICK_DEFAULT +0CC F_PICK_RANDOM +0CD F_IN_SET +0CE F_RANDOM Get random number +0CF F_RANDOM_BETWEEN Get random number between two values +0D0 F_CLASS_OF Get class of script +0D1 F_STATE_OF +0D2 F_OWNER_OF Get owner of object +0D3 F_SCRIPT_RUNNING Test if script is running +0D4 F_OBJECT_RUNNING Test if object is running +0D5 F_SOUND_RUNNING Test if sound is running +0D6 F_ABS Get absolute value +0D7 F_PIXEL +0D8 F_KLUDGE +0D9 F_IN_BOX Test if object is in box +0DA F_VALID_VERB +0DB F_FIND_ACTOR +0DC F_FIND_OBJECT +0DD F_FIND_VERB +0DE F_FIND_ALL_OBJECTS +0DF F_ACTOR_INVENTORY +0E0 F_ACTOR_INVENTORY_COUNT Get number of items in inventory +0E1 F_ACTOR_VARIABLE Get actor variable (property) +0E2 F_ACTOR_ROOM Get current room for actor +0E3 F_ACTOR_BOX Get current box for actor +0E4 F_ACTOR_MOVING Test if actor is moving +0E5 F_ACTOR_COSTUME Get current costume for actor +0E6 F_ACTOR_SCALE Get current scale of actor +0E7 F_ACTOR_DEPTH Get current Z position of actor +0E8 F_ACTOR_ELEVATION Get current actor elevation +0E9 F_ACTOR_WIDTH Get current actor width +0EA F_ACTOBJ_FACING Get current actor/object facing +0EB F_ACTOBJ_X Get X position of actor/object +0EC F_ACTOBJ_Y Get Y position of actor/object +0ED F_ACTOR_CHORE +0EE F_PROXIMITY_2ACTOBJS Get distance between 2 actors/objects +0EF F_PROXIMITY_2POINTS Get distance between 2 points +0F0 F_OBJECT_IMAGE_X Get X position of object image +0F1 F_OBJECT_IMAGE_Y Get Y position of object image +0F2 F_OBJECT_IMAGE_WIDTH Get width of object image +0F3 F_OBJECT_IMAGE_HEIGHT Get height of object image +0F4 F_VERB_X Get X position of verb +0F5 F_VERB_Y Get Y position of verb +0F6 F_STRING_WIDTH +0F7 F_ACTOR_ZPLANE +0F8 O_248 +0F9 O_249 +0FA O_250 +0FB O_251 +0FC O_252 +0FD O_253 +0FE O_254 +0FF O_255 + The following are subopcodes - just strip the leading 1 100 SO_256 |