Open main menu

Difference between revisions of "SCUMM/V5 opcodes"

782 bytes added ,  04:13, 30 March 2009
m
Undo revision 10913 by Jestar jokin (Talk)
m (Undo revision 10914 by Jestar jokin (Talk))
m (Undo revision 10913 by Jestar jokin (Talk))
Line 7: Line 7:
|-
|-
|opcode||The instruction's opcode, with the appropriate bits set according to the parameters.
|opcode||The instruction's opcode, with the appropriate bits set according to the parameters.
|-
|aux||An aux opcode that stores parameter bits and no other information.
|-
|-
|result||A result pointer. (A standard word pointer, always a LE word.)
|result||A result pointer. (A standard word pointer, always a LE word.)
|-
|sub-opcode||An aux opcode that indicates a specific function to perform (e.g. the "wait" instruction has sub-opcodes to "wait for message", "wait for actor" etc), as well as storing parameter bits if necessary
|-
|-
|var||A var pointer. Same as above, but is not written to. Because this is always a var, the opcode is not affected like with normal parameter/pointers.
|var||A var pointer. Same as above, but is not written to. Because this is always a var, the opcode is not affected like with normal parameter/pointers.
Line 24: Line 20:
|value[p16]||A 16-bit parameter. This is always encoded as a word LE, and may be a pointer or constant.
|value[p16]||A 16-bit parameter. This is always encoded as a word LE, and may be a pointer or constant.
|-
|-
|value[v16]||A variable number of word LE parameters. These are encoded as a sequence of aux[8] param[p16]; param; aux contains the parameter bit to describe param. A byte of $FF terminates the sequence. (actually always shown as "value[v16]...")
|value[v16]||A variable number of word LE parameters. These are encoded as a sequence of aux[8] param[p16]; param; aux contains the parameter bit to describe param. A byte of $FF terminates the sequence.
|-
|-
|value[o]||The offset word for parameter value. This is only encoded if needed, but always at the position indicated. If not specified, the offset word occurs immediately after the parameter.
|value[o]||The offset word for parameter value. This is only encoded if needed, but always at the position indicated. If not specified, the offset word occurs immediately after the parameter.
|-
|-
|value[c]||An ASCII character. Because some instructions use null-terminated strings and some use $FF, the exact format of a string is described in the instruction. Almost always appears as "value[c]..."
|value[c]||An ASCII character. (Because some instructions use null-terminated strings and some use $FF, the exact format of a string is described in the instruction)
|-
|(term)||An optional term.
|-
|-
|term...||One or more terms.
|term...||One or more terms.
Line 60: Line 58:
  opcode actor[p8] sub-opcode... $FF
  opcode actor[p8] sub-opcode... $FF


sub-opcodes:
sub-opcode can be any of the following:
$00 arg1[p8]
  $01 costume[p8]
  $01 costume[p8]
  $02 xspeed[p8] yspeed[p8]
  $02 xspeed[p8] yspeed[p8]
Line 181: Line 178:
===Operation===
===Operation===
Starts the given animation for the given actor.
Starts the given animation for the given actor.
==arrayOp ($27)==
parameters depend on auxiliary opcode
===Encoding===
opcode $01 array[p8]
opcode $02 dest[p8] src[p8]
opcode $03 array[p8] index[p8] data[p8]
opcode $04 result array[p8] index[p8]
opcode $05 array[p8] size[p8]
===Operation===
Miscellaneous actions on Arrays (referred to by resource number).
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||load array||Ensures that the Array is loaded into memory. [I don't know what this does.]
|-
|$02||copy array||Creates a duplicate of src at resource number dest. The old Array at dest is lost.
|-
|$03||write entry||Writes the byte data at offset index of Array array. Out of bounds accesses cause undefined behaviour.
|-
|$04||read entry||Sets result to the byte of data at offset index of Array array. Out of bounds accesses cause undefined behaviour.
|-
|$05||create entry||Allocates or frees an Array. The Array array is initialised to size size; if size is zero, the Array is freed.
|}




Line 200: Line 226:


===Operation===
===Operation===
Replaces the currently running script with another one. The current script is terminated immediately and the new script (determined by the given script ID), is executed in the same thread. The new script has its local variables initialised to the list args. Uninitialised variables have undefined values.
Replaces the currently running script with another one. The current script is terminated immediately and the new script, resource number script, is executed in the same thread. The new script has its local variables initialised to the list args. Uninitialised variables have undefined values.




Line 211: Line 237:
sub-opcode can be any of the following:
sub-opcode can be any of the following:
  $01
  $01
  ... $01 through $08 take the same arguments ...
  $02
$03
$04
$05
$06
$07
  $08
  $08
  $0A cursornum[p8] charletter[p8]
  $0A cursornum[p8] charletter[p8]
Line 230: Line 261:
|$02||SO_CURSOR_OFF||Turns the cursor off.
|$02||SO_CURSOR_OFF||Turns the cursor off.
|-
|-
|$03||SO_USERPUT_ON||Enables user input.
|$03||SO_USERPUT_ON||??? Becomes 1
|-
|-
|$04||SO_USERPUT_OFF||Disables user input.
|$04||SO_USERPUT_OFF||??? Becomes 0
|-
|-
|$05||SO_CURSOR_SOFT_ON||Increments the cursor's state?
|$05||SO_CURSOR_SOFT_ON||Increments the cursor's state?
Line 238: Line 269:
|$06||SO_CURSOR_SOFT_OFF||Decrements the cursor's state?
|$06||SO_CURSOR_SOFT_OFF||Decrements the cursor's state?
|-
|-
|$07||SO_USERPUT_SOFT_ON||Increments "user input" counter (when greater than 0, user input is enabled).
|$07||SO_USERPUT_SOFT_ON||??? Incremented
|-
|-
|$08||SO_USERPUT_SOFT_OFF||Decrements "user input" counter (when 0 or less, user input is disabled).
|$08||SO_USERPUT_SOFT_OFF||??? Decremented
|-
|-
|$0A||SO_CURSOR_IMAGE||Changes the cursor image to a new one, based on image in a character set. Only used in Loom.
|$0A||SO_CURSOR_IMAGE||Changes the cursor image to a new one, based on image in a character set. Only used in Loom.
Line 409: Line 440:
  $01 value[p16]
  $01 value[p16]
  $02
  $02
  ... $02 through $05 take the same arguments ...
  $03
$04
  $05
  $05
  $06 nested-opcode
  $06 nested-opcode
Line 449: Line 481:


===Operation===
===Operation===
  object := owner.inventory[index]
  object := owner.inventory[index] ???
Searches for all objects owned by owner (an actor or object), and returns the one at the given index (offset).




Line 469: Line 500:
===Operation===
===Operation===
Freezes all scripts (by setting the high bit on each script's status). If flag is >= $80, all freeze resistent scripts will also be frozen. If flag is 0, all scripts are unfrozen. Freezing effects are cumulative - i.e. if script A is frozen twice, and unfrozen once, it will still be frozen until it is unfrozen a second time. A script's frozen status is indicated by the high bit.
Freezes all scripts (by setting the high bit on each script's status). If flag is >= $80, all freeze resistent scripts will also be frozen. If flag is 0, all scripts are unfrozen. Freezing effects are cumulative - i.e. if script A is frozen twice, and unfrozen once, it will still be frozen until it is unfrozen a second time. A script's frozen status is indicated by the high bit.


==getActorCostume ($71)==
==getActorCostume ($71)==
Line 604: Line 634:


===Encoding===
===Encoding===
  opcode result object[p16]
  opcode result actor[p16]


===Operation===
===Operation===
Line 611: Line 641:


==getObjectState ($0F)==
==getObjectState ($0F)==
This opcode behaves differently in small header V5 games.


===Encoding===
===Encoding===
Line 658: Line 689:


===Operation===
===Operation===
Returns the entry point for the response code/script for when the given verb is applied to the given object? i.e. gets the start of the script to run for the specific user interaction.
Returns the entry point for the response code/script for when the given verb is applied to the given object?




Line 878: Line 909:


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.
==oldRoomEffect ($5C)==
===Encoding===
opcode sub-opcode
sub-opcodes:
$03 effect[p16]
===Operation===
Performs like sub-opcode SO_ROOM_FADE of the roomOps instruction (fade in if effect != 0, otherwise fade out).
===Variants===
FM-Towns SCUMM V3 performs a different effect, not fully implemented in ScummVM. At the moment ScummVM just forces a redraw of the screen background.




Line 941: Line 957:
===Variants===
===Variants===
In SCUMM V3 and V4, this opcode is used for drawObject.
In SCUMM V3 and V4, this opcode is used for drawObject.
==pickupObjectOld ($50)==
===Encoding===
opcode object[p16]
===Operation===
Adds the given object (located in the given room) to the Ego actor's inventory. If object < 1, an error is raised. If the object is not found or the object is already in the inventory, this function ends gracefully.




Line 1,051: Line 1,058:


==resourceRoutines ($0C)==
==resourceRoutines ($0C)==
===Encoding===
opcode sub-opcode
sub-opcodes:
$01 resID[p8]
... $01 through $13 take the same arguments ...
$13 resID[p8]
$14 room[p8] object[p16]
===Operation===
resID is unique only within the resource type (e.g. script 11 will not conflict with sound 11).
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||SO_LOAD_SCRIPT||Loads the given script into memory.
|-
|$02||SO_LOAD_SOUND||Loads the given sound into memory.
|-
|$03||SO_LOAD_COSTUME||Loads the given costume into memory.
|-
|$04||SO_LOAD_ROOM||Loads the given room into memory.
|-
|$05||SO_NUKE_SCRIPT||Obliterates the given script from memory.
|-
|$06||SO_NUKE_SOUND||Obliterates the given sound from memory.
|-
|$07||SO_NUKE_COSTUME||Obliterates the given costume from memory.
|-
|$08||SO_NUKE_ROOM||Obliterates the given room from memory.
|-
|$09||SO_LOCK_SCRIPT||Locks the given script.
|-
|$0A||SO_LOCK_SOUND||Locks the given sound.
|-
|$0B||SO_LOCK_COSTUME||Locks the given costume.
|-
|$0C||SO_LOCK_ROOM||Locks the given room.
|-
|$0D||SO_UNLOCK_SCRIPT||Unlocks the given script.
|-
|$0E||SO_UNLOCK_SOUND||Unlocks the given sound.
|-
|$0F||SO_UNLOCK_COSTUME||Unlocks the given costume.
|-
|$10||SO_UNLOCK_ROOM||Unlocks the given room.
|-
|$11||SO_CLEAR_HEAP||Clears the heap.
|-
|$12||SO_LOAD_CHARSET||Loads the given character set into memory.
|-
|$13||SO_NUKE_CHARSET||Obliterates the given character set from memory.
|-
|$14||SO_LOAD_OBJECT||Loads the given object from the given room resource.
|}
===Variants===
FM-Towns games add the following sub-opcodes (these are not confirmed nor implemented in ScummVM):
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$20||Unknown||Does nothing, not used in-game.
|-
|$21||Unknown||Does nothing, not used in-game.
|-
|$23||CD Volume||Possibly changes the volume of CD tracks (Loom CD). Takes 1 byte.
|-
|$24||Sound Volume||Sets the loudness of a sound resource. Used in Indy3 and Zak. Takes 2 bytes (left/right volumes?).
|-
|$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.)
|}




==roomOp ($33)==
==roomOp ($33)==
===Encoding===
opcode sub-opcode
sub-opcodes:
$01 minX[p16] maxX[p16]
$03 b[p16] h[p16]
$04 red[p16] green[p16] blue[p16] aux index[p8]
$05
$06
$07 scale1[p8] y1[p8] scale2[p8] y2[p8] slot[p8]
$08 scale[p8] startcolour[p8] endcolour[p8]
$09 loadflag[p8] loadslot[p8]
$0A effect[p16]
$0B redscale[p16] bluescale[p16] greenscale[p16] aux startcolour[p8] endcolour[p8]
$0C redscale[p16] bluescale[p16] greenscale[p16] aux startcolour[p8] endcolour[p8]
$0D resID[p8] filename[c]... $00
$0E resID[p8] filename[c]... $00
$0F resID[p8] aux start[p8] end[p8] aux time[p8]
$10 colindex[p8] delay[p8]
===Operation===
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||SO_ROOM_SCROLL||Clamps the given arguments so scrolling does not extend past the width of the room or screen.
|-
|$03||SO_ROOM_SCREEN||Initialises a screen.
|-
|$04||SO_ROOM_PALETTE||Adjusts the room's palette.
|-
|$05||SO_ROOM_SHAKE_ON||Starts the room shaking.
|-
|$06||SO_ROOM_SHAKE_OFF||Ends the room shaking.
|-
|$07||SO_ROOM_SCALE||Sets the room's y scales? (slot is 1 greater than actual slot?)
|-
|$08||SO_ROOM_INTENSITY||Lightens/darkens the room's palette.
|-
|$09||SO_ROOM_SAVEGAME||Saves temporary state of the room/game?
|-
|$0A||SO_ROOM_FADE||If effect is 0, fades in the room. Otherwise, fades out with the given effect (taken from the high byte of effect).<br>1 = iris effect<br>2 = box wipe (ul to br)<br>3 = box wipe (ur to bl)<br>4 = inverse box wipe).
|-
|$0B||SO_RGB_ROOM_INTENSITY||Lightens/darkens the room's palette, with different scales for red, green and blue.
|-
|$0C||SO_ROOM_SHADOW||Lightens/darkens the shadow palette, with different scales for red, green, and blue.
|-
|$0D||SO_SAVE_STRING||Saves a string resource to the given file?
|-
|$0E||SO_LOAD_STRING||Loads a string resource from a given file?
|-
|$0F||SO_ROOM_TRANSFORM||Manipulates palettes, strings?
|-
|$10||SO_CYCLE_SPEED||Starts colour cycling with delay? colIndex is between 0 and 16
|}
===Variants===
SCUMM V3 (non-PC Engine) encodes the arguments before the sub-opcode:
opcode arg1[p16] arg2[p16] sub-opcode
Small header games include an extra sub-opcode, $02 (SO_ROOM_COLOR), which adjusts the room's palette:
opcode $02 colour[p16] index[p16]
... or for V3 games ...
opcode colour[p16] index[p16] $02
In small header games, sub-opcode $04 (SO_ROOM_PALETTE) affects the shadow palette, and only accepts two arguments, a "room colour slot" (palette entry? between 0 and 256) and an index:
opcode $04 colour[p16] index[p16]
... or for V3 games ...
opcode colour[p16] index[p16] $04
In FM-Towns games, sub-opcode $0A performs a different function and has its own sub-opcodes (some unknown and all not yet implemented in ScummVM):
opcode $0A sub-opcode
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$08||||compose kMainVirtScreen over a screen buffer
|-
|$09||||call 0x110:0x20 _ax=0x601 _edx=2
|-
|$0A||||call 0x110:0x20 _ax=0x601 _edx=3
|-
|$0B||||clear screen 0x1C:0x45000 sizeof(640 * 320)
|-
|$0C||||call 0x110:0x20 _ax=0x601 _edx=0
|-
|$0D||||call 0x110:0x20 _ax=0x601 _edx=1
|-
|$10||||enable clearing of a screen buffer in drawBitmap()
|-
|$11||||disable clearing of a screen buffer in drawBitmap()
|-
|$12||||clear a screen buffer
|-
|$13||||enable palette operations (palManipulate(), cyclePalette() etc.)
|-
|$14||||disable palette operations
|-
|$15||||disable clearing of screen 0x1C:0x5000 sizeof(640 * 320) in initScreens()
|-
|$16|||enable clearing of screen 0x1C:0x5000 sizeof(640 * 320) in initScreens()
|-
|$1E||||Unknown
|}




==saveRestoreVerbs ($AB)==
==saveRestoreVerbs ($AB)==
===Encoding===
opcode aux start[p8] end[p8] mode[p8] sub-opcode
sub-opcodes:
$01
$02
$03
===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)==
==setCameraAt ($32)==
===Encoding===
opcode x[p16]
===Operation===
Sets the camera's x position.




==setObjectName ($54)==
==setObjectName ($54)==
===Encoding===
opcode object[p16]
===Operation===
Sets the given object's name, as determined in some fashion from the resources (clears existing resource and reloads it?).




==setOwnerOf ($29)==
==setOwnerOf ($29)==
===Encoding===
opcode object[p16] owner[p8]
===Operation===
Sets the owner of the object.




==setState ($07)==
==setState ($07)==


====Encoding===
opcode object[p16] state[p8]
====Operation===
Sets the state of the object.


==setVarRange ($26)==


==setVarRange ($26)==
non-standard encoding
non-standard encoding


Line 1,310: Line 1,094:
This sets a number of variables to the given parameters. The starting variable is given as "result", and the number of variables to modify is given as "number". This is followed by the same number of values, which will be put into the variable locations. The values are constants, and can be either 16-bit, if the highest bit of the opcode is set, i.e. $A6; or 8-bit, if the highest bit of the opcode is not set, i.e. $26. Note that all values are affected by the opcode's high bit; you can't mix 8 and 16-bit values.
This sets a number of variables to the given parameters. The starting variable is given as "result", and the number of variables to modify is given as "number". This is followed by the same number of values, which will be put into the variable locations. The values are constants, and can be either 16-bit, if the highest bit of the opcode is set, i.e. $A6; or 8-bit, if the highest bit of the opcode is not set, i.e. $26. Note that all values are affected by the opcode's high bit; you can't mix 8 and 16-bit values.


descumm example:
===descumm example===
  setVarRange(Var[178],9,[0,0,0,0,0,0,0,0,0]);
  setVarRange(Var[178],9,[0,0,0,0,0,0,0,0,0]);


Line 1,317: Line 1,101:


==soundKludge ($4C)==
==soundKludge ($4C)==
===Encoding===
opcode items[v16]...
===Operation===
If the first item is -1, the existing sound queue is processed. Otherwise, the list of items is added to the queue.
===Variants===
In SCUMM V3 (small header) games, this opcode is used for the WaitForSentence instruction.




==startMusic ($01)==
==startMusic ($01)==
===Encoding===
opcode music[p8]
===Operation===
Adds the music in to the queue to be played.
===Variants===
In FM-Towns (SCUMM V3) games, this instruction performs different functions (some kind of Audio CD status query function; some partially implemented in ScummVM):
opcode result sub-opcode
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
$00||Is Playing||Returns true if a CD audio track is currently playing.
|-
|$FC||Unpause CD||Unpauses the CD audio track.
|-
|$FD||Pause CD||Pauses the CD audio track.
|-
|$FE||Get CD Sound||Returns the current CD sound.
|-
|$FF||CD Volume||Might return the the current CD volume in FM-Towns Loom.
|-
|other||Track Length||Returns the track length in seconds.
|}




==startObject ($37)==
==startObject ($37)==


===Encoding===
opcode object[p16] script[p8] args[v16]...
===Operation===
Starts the object's script (OBCD blocks), passing the given arguments.


==startScript ($0A)==


==startScript ($0A)==
one parameter plus varargs, extra encoding in opcode
one parameter plus varargs, extra encoding in opcode


Line 1,382: Line 1,125:
|7||6||5||4  0
|7||6||5||4  0
|-
|-
|P1||R||F||$0A
|P1||Q||F||$0A
|}
|}
P1 = standard parameter bit<br>
R = indicates that the script is recursive<br>
F = indicates that the script is freeze resistant (a call to freezeScripts will skip this script, unless the "force freeze" bit of the freezeScripts opcode is set).




==startSound ($1C)==
==startSound ($1C)==
===Encoding===
opcode sound[p8]
===Operation===
Adds the given sound to the sound queue to be played.




==stopMusic ($20)==
==stopMusic ($20)==
===Encoding===
opcode
===Operation===
Stops all sounds.




==stopObjectCode ($00)==
==stopObjectCode ($00)==
===Encoding===
opcode
===Operation===
Marks the calling script as dead, to be later pruned from the thread pool. Cleans up residual arrays.




==stopObjectScript ($6E)==
==stopObjectScript ($6E)==
===Encoding===
opcode script[p16]
===Operation===
Marks the given object script as dead, to be later pruned from the thread pool. Cleans up residual arrays.




==stopScript ($62)==
==stopScript ($62)==
===Encoding===
opcode script[p8]
===Operation===
Marks the given script as dead, to be later pruned from the thread pool. Cleans up residual arrays.




==stopSound ($3C)==
==stopSound ($3C)==
===Encoding===
opcode sound[p8]
===Operation===
Stops the given sound.
==stringOps ($27)==
parameters depend on sub-opcode
===Encoding===
opcode sub-opcode
sub-opcodes:
$01 stringID[p8] string[c]... $00
$02 destID[p8] srcID[p8]
$03 stringID[p8] index[p8] char[c]
$04 result stringID[p8] index[p8]
$05 stringID[p8] size[p8]
===Operation===
Miscellaneous actions on strings (Arrays, referred to by resource number).
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||Load String||Loads the inline null-terminated string into the resource slot given by stringID.
|-
|$02||Copy String||Creates a duplicate of the string at resource slot srcID into destID. The old string at destID is lost.
|-
|$03||Write Character||Writes char at the given index (offset) of the string resource located at slot stringID. Out of bounds accesses cause undefined behaviour.
|-
|$04||Read Character||Reads a byte (character) at the given index (offset) of the string resource located at slot stringID, and writes it to result. Out of bounds accesses cause undefined behaviour.
|-
|$05||New String||Allocates or frees a string (Array), located at resource slot stringID. The string is initialised to size; if size is zero, the string is freed.
|}




Line 1,509: Line 1,180:
|}
|}


==wait ($AE)==
==walkActorTo ($1E)==
==walkActorToActor ($0D)==
==walkActorToObject ($36)==
=Table of Parameters=


==verbOps ($7A)==
This is a work in progress and is missing opcodes.


===Encoding===
This table shows a summary of the opcodes and their parameters in a concise fashion. The information has been gleaned from the descumm source code, so some instruction names might not match those listed above.
opcode verbID[p8] sub-opcode... $FF


sub-opcodes:
Currently it is missing:
  $01 object[p16]
  comparisons (lessThan, greaterThanEqual, equalZero etc)
  $02 name[c]... $00
drawObject
  $03 colour[p8]
do_resource
  $04 hicolour[p8]
  do_if_state_code (comparisons)
  $05 left[p16] top[p16]
  do_print_ego
  $06
  do_varset_code
  $07
  do_unconditional_jump
  $08
  loadRoomWithEgo
  $09
  do_cursor_command
  $10 colour[p8]
  doSentence
  $11
  do_expr_code
  $12 key[p8]
  do_load_code_to_string (sub-opcode of 0x27)
  $13
  do_actorops
  $14 stringID[p16]
  do_pseudoRoom(buf)
  $16 object[p16] room[p8]
  do_room_ops(buf)
  $17 colour[p8]
  do_verbops(buf, opcode)
  setVarRange
  do_matrix_ops(buf, opcode)
Some instructions listed here are actually sub-opcodes, i.e. "WaitForCamera" is actually the "Wait" opcode with a sub-opcode representing "For Camera".


===Operation===
Argument types:
{| border="1" cellpadding="2" width=100%
* V = variable
|- style="background:whitesmoke"
* B = byte
|Opcode||Meaning||Description
* W = word
* L = list
* J = jump (used by almost all boolean expressions, comparisons)
* D = delay; 24-bit constant (only used by delay instruction, funnily enough)
* A = ASCII (0-terminated string?); used by "setObjectName"
* V&#124;B or V&#124;W = either a variable or a byte/word
* None, if it does not take that argument.
If an instruction returns a value, the result pointer follows immediately after the opcode and before any arguments.
{| border="1" style="text-align:center" width=100% cellpadding=2
! Instruction
! Returns a Value
! Arg 1
! Arg 2
! Arg 3
|-
|align="left" |actorFollowCamera
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |actorFromPos
|True
|V&#124;W
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |animateCostume
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |beginOverride
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |breakHere
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |chainScript
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|L
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |classOfIs
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|L
|J
|-
|align="left" |CopyString
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |CreateString
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |cutscene
|style="color:silver; background:whitesmoke" |False
|L
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |debug?
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |delay
|style="color:silver; background:whitesmoke" |False
|D
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |delayVariable
|style="color:silver; background:whitesmoke" |False
|V
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |deleteVerbs
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|V&#124;B
|-
|align="left" |dummy
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |endCutscene
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |endOverride
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |faceActor
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |findInventory
|True
|V&#124;B
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |findObject
|True
|V&#124;W
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |freezeScripts
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorCostume
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorElevation
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorFacing
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorMoving
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorRoom
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorScale
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorWalkBox
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorWidth
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorX
|True
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getActorY
|True
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getClosestObjActor
|True
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getDist
|True
|V&#124;W
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getInventoryCount
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getObjectOwner
|True
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getObjectState
|True
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getRandomNr
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |GetStringChar
|True
|V&#124;B
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getStringWidth
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |getVerbEntryPoint
|True
|V&#124;W
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |isActorInBox
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|J
|-
|align="left" |isScriptRunning
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |isSoundRunning
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |lights
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|B
|B
|-
|align="left" |loadRoom
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |oldRoomEffect-fadein
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |oldRoomEffect-set
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |panCameraTo
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |pickupObject
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |putActor
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;W
|V&#124;W
|-
|align="left" |putActorAtObject
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |putActorInRoom
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |restoreVerbs
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|V&#124;B
|-
|align="left" |saveLoadGame
|True
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |saveVerbs
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|V&#124;B
|-
|align="left" |setCameraAt
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |setClass
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|L
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |setObjectName
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|A
|style="color:silver; background:whitesmoke" |None
|-
|align="left" |setOwnerOf
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|-
|$01||SO_VERB_IMAGE||Assigns an object (image) to a verb.
|align="left" |setState
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|-
|-
|$02||SO_VERB_NAME||Assigns the in-line name to the verb slot.
|align="left" |SetStringChar
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|V&#124;B
|-
|-
|$03||SO_VERB_COLOR||Sets the colour of the verb.
|align="left" |soundKludge
|style="color:silver; background:whitesmoke" |False
|L
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$04||SO_VERB_HICOLOR||Sets the high colour of the verb.
|align="left" |startMusic
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$05||SO_VERB_AT||Sets the verb's top-left co-ordinates.
|align="left" |startObject
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|V&#124;B
|L
|-
|-
|$06||SO_VERB_ON||Makes this verb active.
|align="left" |startScript
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|L
|style="color:silver; background:whitesmoke" |None
|-
|-
|$07||SO_VERB_OFF||Makes this verb inactive.
|align="left" |startSound
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$08||SO_VERB_DELETE||Kills this verb.
|align="left" |stopMusic
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$09||SO_VERB_NEW||Creates a verb in the slot for the given verbID. If the slot is 0 (verb doesn't already exist), will add it to the next unusued slot; if this exceeds the global maximum number of verbs an error will be raised.
|align="left" |stopObjectCode
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$10||SO_VERB_DIMCOLOR||Sets the dim colour of the verb.
|align="left" |stopObjectScript
|style="color:silver; background:whitesmoke" |False
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$11||SO_VERB_DIM||Dims this verb.
|align="left" |stopScript
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$12||SO_VERB_KEY||Sets the key code (maybe ASCII char?) associated with this verb.
|align="left" |stopSound
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$13||SO_VERB_CENTER||Centres the verb?
|align="left" |systemOps
|style="color:silver; background:whitesmoke" |False
|B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$14||SO_VERB_NAME_STR||Loads the given string resource into the verb's slot. If either the string resource or verb slot is not found (0), the verb resource is nuked.
|align="left" |WaitForActor
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$16||Assign Object||Assigns an object from the given room to the verb (if the object's image index is not already assigned to the given object).
|align="left" |WaitForCamera
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$17||Set Back Colour||Sets the background colour of the verb?
|align="left" |WaitForMessage
|}
|style="color:silver; background:whitesmoke" |False
 
|style="color:silver; background:whitesmoke" |None
 
|style="color:silver; background:whitesmoke" |None
==wait ($AE)==
|style="color:silver; background:whitesmoke" |None
 
===Encoding===
opcode sub-opcode
 
sub-opcodes:
$01 actor[p8]
$02
$03
$04
 
===Operation===
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|-
|$01||SO_WAIT_FOR_ACTOR||If the given actor is moving, breaks and resumes at this instruction again.
|align="left" |WaitForSentence
|style="color:silver; background:whitesmoke" |False
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|style="color:silver; background:whitesmoke" |None
|-
|-
|$02||SO_WAIT_FOR_MESSAGE||If the global variable VAR_HAVE_MSG (Var[3]) is not zero, breaks and resumes at this instruction again.
|align="left" |walkActorTo
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;W
|V&#124;W
|-
|-
|$03||SO_WAIT_FOR_CAMERA||If the camera has not reached its destination x position, breaks and resumes at this instruction again.
|align="left" |walkActorToActor
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;B
|B
|-
|-
|$04||SO_WAIT_FOR_SENTENCE||If there is a sentence present?, breaks and resumes at this instruction again
|align="left" |walkActorToObject
|style="color:silver; background:whitesmoke" |False
|V&#124;B
|V&#124;W
|style="color:silver; background:whitesmoke" |None
|}
|}
===Variants===
In Indy3 (non-Macintosh), this opcode only acts as SO_WAIT_FOR_MESSAGE and omits the sub-opcode.
opcode
==walkActorTo ($1E)==
===Encoding===
opcode actor[p8] x[p16] y[p16]
===Operation===
Sets the actor to begin walking to the given position.
==walkActorToActor ($0D)==
===Encoding===
opcode walker[p8] walkee[p8] distance[8]
===Operation===
Walks walker towards walkee's position by the given distance. Walker and walkee are both actors.
==walkActorToObject ($36)==
===Encoding===
opcode actor[p8] object[p16]
===Operation===
Sets the actor to begin walking to the given object's position.
125

edits