126
edits
Jestar jokin (talk | contribs) m (→resourceRoutines ($0C): clearHeap doesn't take an argument) |
Jestar jokin (talk | contribs) (Added some V3-4 specific info based on recent changes to script_v5.cpp incl. saveLoadVars and saveLoadGame, also general additions.) |
||
Line 14: | Line 14: | ||
|result||A result pointer. (A standard word pointer, always a LE word.) | |result||A result pointer. (A standard word pointer, always a LE word.) | ||
|- | |- | ||
|var||A | |var||A variable pointer. Same as above, but is not written to. Because this is always a variable, the opcode is not affected like it would be with a normal parameter (described below). | ||
|- | |- | ||
|value[8]||An 8-bit constant (a byte). | |value[8]||An 8-bit constant (a byte). | ||
Line 369: | Line 369: | ||
Small header games only support the parameters used with sub-opcode $01, e.g: | Small header games only support the parameters used with sub-opcode $01, e.g: | ||
opcode object[p16] xpos[p16] ypos[p16] | opcode object[p16] xpos[p16] ypos[p16] | ||
Accordingly, they have three parameter bits, and hence more possible opcodes. | |||
Line 687: | Line 688: | ||
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer. | Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer. | ||
==ifNotState ($2F)== | |||
==ifNotState ($2F) (V3-4)== | |||
This opcode is not present in SCUMM V5. | |||
===Encoding=== | ===Encoding=== | ||
Line 696: | Line 699: | ||
==ifState ($4F)== | ==ifState ($4F) (V3-4)== | ||
This opcode is not present in SCUMM V5. | |||
===Encoding=== | ===Encoding=== | ||
Line 910: | Line 914: | ||
==oldRoomEffect ($5C)== | ==oldRoomEffect ($5C) (V4)== | ||
This opcode/instruction is only present in SCUMM V4. | |||
===Encoding=== | ===Encoding=== | ||
Line 975: | Line 980: | ||
==pickupObjectOld ($50)== | ==pickupObjectOld ($50) (V4)== | ||
This opcode is not present in SCUMM V5. | |||
===Encoding=== | ===Encoding=== | ||
Line 1,162: | Line 1,168: | ||
|$25||Sound Pitch||Sets the pitch of a sound resource. Used in Indy3 and Zak. Takes 1 byte (pitch = "foo" - "center" semitones. Center is at $32 in the sound resource.) | |$25||Sound Pitch||Sets the pitch of a sound resource. Used in Indy3 and Zak. Takes 1 byte (pitch = "foo" - "center" semitones. Center is at $32 in the sound resource.) | ||
|} | |} | ||
==roomOps ($33)== | ==roomOps ($33)== | ||
Line 1,271: | Line 1,278: | ||
|} | |} | ||
== | ==saveLoadGame ($22) (V3-4)== | ||
This instruction is not present in SCUMM V5; its opcode is used for "getAnimCounter". | |||
===Encoding=== | |||
opcode result arg1[p8] | |||
===Operation=== | ===Operation=== | ||
The slot is determined by taking the lower 5 bits of arg1. The upper 3 bits determine an aux opcode, that performs an action described in the table below. | |||
{| border="1" cellpadding="2" width=100% | {| border="1" cellpadding="2" width=100% | ||
|- style="background:whitesmoke" | |- style="background:whitesmoke" | ||
|Opcode||Meaning||Description | |Opcode||Meaning||Description | ||
|- | |- | ||
|$ | |$00||Num. Available Slots||Returns the number of save slots available. | ||
|- | |||
|$20||Drive||In V3, returns the type of drive (0 = ???, 1 = A or B [floppy], 2 = hard drive).<br>In V4, sets the current drive (returns 1). | |||
|- | |||
|$40||Load Game||Loads a game from the given slot (returns 3 if successful, 5 otherwise). | |||
|- | |- | ||
|$ | |$80||Save Game||Saves a game to the given slot (returns 0 if successful, 2 otherwise). | ||
|- | |- | ||
|$ | |$C0||Test For Game||Tests if a save exists in the given slot (returns 6 if so, 7 otherwise). | ||
|} | |} | ||
== | |||
==saveLoadVars ($A7) (V3-4)== | |||
This instruction is not present in SCUMM V5; its opcode is used as a dummy. | |||
===Encoding=== | ===Encoding=== | ||
opcode | opcode sub-opcode | ||
sub-opcodes: | |||
$01 sub-sub-opcode... $00 | |||
$02 sub-sub-opcode... $00 | |||
$01 (save) sub-sub-opcodes: | |||
$01 resultA resultB | |||
$02 arg1[p8] arg2[p8] | |||
$03 filename[c]... $00 | |||
$04 | |||
$1F | |||
$02 (load) sub-sub-opcodes: | |||
$01 resultA resultB | |||
$02 arg1[p8] arg2[p8] | |||
$03 filename[c]... $00 | |||
$04 | |||
$1F | |||
===Encoding=== | ===Operation=== | ||
opcode object[p16] name[c]... $00 | {| border="1" cellpadding="2" width=100% | ||
|- style="background:whitesmoke" | |||
===Operation=== | |Opcode||Meaning||Description | ||
Sets the given object's name. | |- | ||
|$01||SO_SAVE_VARS||Saves variables (for saving games?) | |||
|- | |||
==setOwnerOf ($29)== | |$02?||SO_RESTORE_VERBS||Loads variables (for saving games?)<br>(I have not verified that restore vars is $02, as the ScummVM code only compares to $01.) | ||
|} | |||
===Encoding=== | |||
opcode object[p16] owner[p8] | {| border="1" cellpadding="2" width=100% | ||
|- style="background:whitesmoke" | |||
===Operation=== | |Opcode||Meaning||Description | ||
Sets the owner of the object. | |- | ||
|$01||Write Vars||Writes a range of variables. | |||
|- | |||
==setState ($07)== | |$02||Write Strings||Writes a range of string variables. | ||
|- | |||
===Encoding=== | |$03||Open File||Opens a file for writing. | ||
opcode object[p16] state[p8] | |- | ||
|$04||Dummy||Does nothing. | |||
===Operation=== | |- | ||
Sets the state of the object. | |$1F||Close File||Closes the last opened file. | ||
|} | |||
==setVarRange ($26)== | {| border="1" cellpadding="2" width=100% | ||
non-standard encoding | |- style="background:whitesmoke" | ||
|Opcode||Meaning||Description | |||
===Encoding=== | |- | ||
|$01||Read Vars||Reads a range of variables. | |||
|- | |||
|$02||Read Strings||Reads a range of string variables. | |||
|- | |||
|$03||Open File||Opens a file for reading. | |||
|- | |||
|$04||Dummy||Does nothing. | |||
|- | |||
|$1F||Close File||Closes the last opened file. | |||
|} | |||
==saveRestoreVerbs ($AB)== | |||
===Encoding=== | |||
opcode sub-opcode | |||
sub-opcodes: | |||
$01 start[p8] end[p8] mode[p8] | |||
$02 start[p8] end[p8] mode[p8] | |||
$03 start[p8] end[p8] mode[p8] | |||
===Operation=== | |||
{| border="1" cellpadding="2" width=100% | |||
|- style="background:whitesmoke" | |||
|Opcode||Meaning||Description | |||
|- | |||
|$01||SO_SAVE_VERBS||For all verbs between start and end, sets the "saveid" to mode. | |||
|- | |||
|$02||SO_RESTORE_VERBS||For all verbs between start and end and matching mode, kills any existing verb, sets the saveid to 0 and generally inits the verb. | |||
|- | |||
|$03||SO_DELETE_VERBS||For all verbs between start and end and matching mode, kills any existing verb. | |||
|} | |||
==setCameraAt ($32)== | |||
===Encoding=== | |||
opcode x[p16] | |||
===Operation=== | |||
Sets the camera's x position. | |||
==setObjectName ($54)== | |||
===Encoding=== | |||
opcode object[p16] name[c]... $00 | |||
===Operation=== | |||
Sets the given object's name. | |||
==setOwnerOf ($29)== | |||
===Encoding=== | |||
opcode object[p16] owner[p8] | |||
===Operation=== | |||
Sets the owner of the object. | |||
==setState ($07)== | |||
===Encoding=== | |||
opcode object[p16] state[p8] | |||
===Operation=== | |||
Sets the state of the object. | |||
==setVarRange ($26)== | |||
non-standard encoding | |||
===Encoding=== | |||
opcode result number[8] values[8]... | opcode result number[8] values[8]... | ||
or | or | ||
Line 1,448: | Line 1,547: | ||
===Operation=== | ===Operation=== | ||
Marks the calling script as dead, to be later pruned from the thread pool. Cleans up residual arrays. | Marks the calling script as dead, to be later pruned from the thread pool. Cleans up residual arrays. Should always be the last instruction in a script. | ||
$A0 is present in LSCR and SCRP files... when does $00 occur? | |||
==stopObjectScript ($6E)== | ==stopObjectScript ($6E)== | ||
Line 1,738: | Line 1,838: | ||
=Table of Parameters= | =Table of Parameters= | ||
Please see the wiki page [[SCUMM/V5_opcodes/Table]]. | Please see the wiki page [[SCUMM/V5_opcodes/Table]] for a concise rendition of the above information (with a few omissions dues to the complexity of the instructions). |
edits