Difference between revisions of "SCUMM/Technical Reference/Script resources"

Jump to navigation Jump to search
(→‎Object Scripts in V3/4 (OC): Filled out unknowns based on object.cpp/ScummEngine_v4::resetRoomObject)
 
Line 38: Line 38:
  Script code        variable
  Script code        variable


== Room Entry Scripts (EN or ENCD) ==
== SCUMM V1 and V2 Room Entry and Exit Scripts ==
 
In SCUMM V1 and V2, the entry and exit scripts are part of [[SCUMM/Technical_Reference/Room resources#Header|the room resource]].
 
== SCUMM V3+ Room Entry Scripts (EN or ENCD) ==


This block contains special code when a room is entered.  
This block contains special code when a room is entered.  
Line 46: Line 50:
  Script code        variable
  Script code        variable


 
== SCUMM V3+ Room Exit Scripts (EX or EXCD) ==
== Room Exit Scripts (EX or EXCD) ==


This block contains special code when the player leaves a room  
This block contains special code when the player leaves a room  
Line 55: Line 58:
  Script code        variable
  Script code        variable


 
== SCUMM V3 and V4 Object Scripts (OC) ==
== Object Scripts V5+ (OBCD) ==
 
These are scripts that correspond to VERB actions. VERBs are predefined activities at the bottom of the screen, e.g. "Open", "Look", "Give" etc. For each named object in a room, the game designer could define responses to the players actions. A single VERB block contains the code for all possible player actions on the object. Starting with version 5, the whole code can be found in an [[Object resources|Object Resource]].
 
OBCD   
  Block name      4 bytes ("OBCD")
  Block size      4 bytes
 
    CDHD
      Block name    4 bytes ("CDHD")
      Block size    4 bytes (25)
      obj id        2 bytes
      ...          see [[Object resources|Object Resource]]
 
    VERB
      Block name    4 bytes ("VERB")
      Block size    4 bytes
      offset table  variable {
      verb          1 byte (0xFF is default)
      offset        2 bytes
      }
      table end    1 byte (must be 0x00)
      object code  variable
 
    OBNA
      Block name    4 bytes ("OBNA")
      Block size    4 bytes
      object name  null-terminated string
 
== Object Scripts in V3/4 (OC) ==


In Version 3 and 4 the code can be found in the '''OC''' block:
In Version 3 and 4 the code can be found in the '''OC''' block:
Line 117: Line 89:


The offset table is a variable block like that used in the VERB block in later games, which contains the verb identifier (1 byte) and the absolute offset (2 bytes). The table end is marked with 0x00. Next is the object's name, which is a standard null-terminated string. After this follows the actual object code. Note that unlike other script types, because there are multiple entry points (one for each supported verb), there are also multiple exit points (or "stopObjectCode" instructions).
The offset table is a variable block like that used in the VERB block in later games, which contains the verb identifier (1 byte) and the absolute offset (2 bytes). The table end is marked with 0x00. Next is the object's name, which is a standard null-terminated string. After this follows the actual object code. Note that unlike other script types, because there are multiple entry points (one for each supported verb), there are also multiple exit points (or "stopObjectCode" instructions).
== SCUMM V5+ Object Scripts (OBCD) ==
These are scripts that correspond to VERB actions. VERBs are predefined activities at the bottom of the screen, e.g. "Open", "Look", "Give" etc. For each named object in a room, the game designer could define responses to the players actions. A single VERB block contains the code for all possible player actions on the object. Starting with version 5, the whole code can be found in an [[Object resources|Object Resource]].
OBCD   
  Block name      4 bytes ("OBCD")
  Block size      4 bytes
    CDHD
      Block name    4 bytes ("CDHD")
      Block size    4 bytes (25)
      obj id        2 bytes
      ...          see [[Object resources|Object Resource]]
    VERB
      Block name    4 bytes ("VERB")
      Block size    4 bytes
      offset table  variable {
      verb          1 byte (0xFF is default)
      offset        2 bytes
      }
      table end    1 byte (must be 0x00)
      object code  variable
    OBNA
      Block name    4 bytes ("OBNA")
      Block size    4 bytes
      object name  null-terminated string