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

From ScummVM :: Wiki
Jump to navigation Jump to search
(Add info on SCUMM v4 object code blocks)
Line 1: Line 1:
=== V6 Objects ===
 
=== SCUMM V4 ===
 
In v4 objects are split in 2 chunks: OI and OC. OC does not have any sub-blocks like v5 or v6 objects; it contains all header information and the SCUMM script.
 
===== OC =====
 
<pre>
  obj id            : 16le
  unknown          : 8
  x                : 8
  y, parent state  : 8 (parent state is AND 0x80, y is AND 0x7F)
  width            : 8
  parent            : 8
  walk_x            : 16le signed(?)
  walk_y            : 16le signed(?)
  height, actor dir : 8 (height is AND 0xF8, actor dir is AND 0x07)
  name offset      : 8 (point to location of object name, from start of OC block)
  verb table        : variable
  object name      : variable, null-terminated string
  SCUMM script      : variable
</pre>
 
The verb table is made up of multiple entries, each looks like this:
 
<pre>
  verb ID          : 8
  offset            : 16le (from start of script?)
</pre>
 
The number of entries will vary depending on the interactions defined for the object.
 
=== SCUMM V5 ===
 
V5 objects are a lot like V6 Objects, with minor differences.
 
===== IMHD =====
 
<pre>
  obj id      : 16le
  num imnn    : 16le
  num zpnn    : 16le (per IMnn block)
  flags        : 8
  unknown      : 8
  x            : 16le
  y            : 16le
  width        : 16le
  height      : 16le
</pre>
 
IMHD omits the hotspots.
 
===== CDHD =====
 
<pre>
  obj id    : 16le
  x        : 8
  y        : 8
  width    : 8
  height    : 8
  flags    : 8
  parent    : 8
  walk_x    : 16le signed
  walk_y    : 16le signed
  actor dir : 8 (direction the actor will look at when standing in front
                of the object)
</pre>
 
x, y, width, and height are bytes. Their values should be multiplied by 8 (the size of an image strip).
 
=== SCUMM V6 ===


In v6 objects are split in 2 chunks: OBIM and OBCD. OBIM store the images, zplanes, etc, while OBCD mostly store the scripts.
In v6 objects are split in 2 chunks: OBIM and OBCD. OBIM store the images, zplanes, etc, while OBCD mostly store the scripts.
Line 74: Line 144:


The OBNA chunk simply contain a null terminated string.
The OBNA chunk simply contain a null terminated string.
=== V5 Objects ===
V5 objects are a lot like V6 Objects, with minor differences.
===== IMHD =====
<pre>
  obj id      : 16le
  num imnn    : 16le
  num zpnn    : 16le (per IMnn block)
  flags        : 8
  unknown      : 8
  x            : 16le
  y            : 16le
  width        : 16le
  height      : 16le
</pre>
IMHD omits the hotspots.
===== CDHD =====
<pre>
  obj id    : 16le
  x        : 8
  y        : 8
  width    : 8
  height    : 8
  flags    : 8
  parent    : 8
  walk_x    : 16le signed
  walk_y    : 16le signed
  actor dir : 8 (direction the actor will look at when standing in front
                of the object)
</pre>
x, y, width, and height are bytes. Their values should be multiplied by 8 (the size of an image strip).
=== V4 Objects ===
In v4 objects are split in 2 chunks: OI and OC. OC does not have any sub-blocks like v5 or v6 objects; it contains all header information and the SCUMM script.
===== OC =====
<pre>
  obj id            : 16le
  unknown          : 8
  x                : 8
  y, parent state  : 8 (parent state is AND 0x80, y is AND 0x7F)
  width            : 8
  parent            : 8
  walk_x            : 16le signed(?)
  walk_y            : 16le signed(?)
  height, actor dir : 8 (height is AND 0xF8, actor dir is AND 0x07)
  name offset      : 8 (point to location of object name, from start of OC block)
  verb table        : variable
  object name      : variable, null-terminated string
  SCUMM script      : variable
</pre>
The verb table is made up of multiple entries, each looks like this:
<pre>
  verb ID          : 8
  offset            : 16le (from start of script?)
</pre>
The number of entries will vary depending on the interactions defined for the object.

Revision as of 11:32, 16 November 2021

SCUMM V4

In v4 objects are split in 2 chunks: OI and OC. OC does not have any sub-blocks like v5 or v6 objects; it contains all header information and the SCUMM script.

OC
  obj id            : 16le
  unknown           : 8
  x                 : 8
  y, parent state   : 8 (parent state is AND 0x80, y is AND 0x7F)
  width             : 8
  parent            : 8
  walk_x            : 16le signed(?)
  walk_y            : 16le signed(?)
  height, actor dir : 8 (height is AND 0xF8, actor dir is AND 0x07)
  name offset       : 8 (point to location of object name, from start of OC block)
  verb table        : variable
  object name       : variable, null-terminated string
  SCUMM script      : variable

The verb table is made up of multiple entries, each looks like this:

  verb ID           : 8
  offset            : 16le (from start of script?)

The number of entries will vary depending on the interactions defined for the object.

SCUMM V5

V5 objects are a lot like V6 Objects, with minor differences.

IMHD
  obj id       : 16le
  num imnn     : 16le
  num zpnn     : 16le (per IMnn block)
  flags        : 8
  unknown      : 8
  x            : 16le
  y            : 16le
  width        : 16le
  height       : 16le

IMHD omits the hotspots.

CDHD
  obj id    : 16le
  x         : 8
  y         : 8
  width     : 8
  height    : 8
  flags     : 8
  parent    : 8
  walk_x    : 16le signed
  walk_y    : 16le signed
  actor dir : 8 (direction the actor will look at when standing in front
                 of the object)

x, y, width, and height are bytes. Their values should be multiplied by 8 (the size of an image strip).

SCUMM V6

In v6 objects are split in 2 chunks: OBIM and OBCD. OBIM store the images, zplanes, etc, while OBCD mostly store the scripts.

OBIM

  • OBIM
    • IMHD : header
    • IMnn : images
      • SMAP (or BMOP)
      • ZPnn

Note: In IMnn and ZPnn nn represent an hexadecimal number.

IMHD
  obj id       : 16le
  num imnn     : 16le
  num zpnn     : 16le (per IMnn block)
  flags        : 8
  unknown      : 8
  x            : 16le
  y            : 16le
  width        : 16le
  height       : 16le
  num hotspots : 16le (usually one for each IMnn, but their is one even
                       if no IMnn is present)
  hotspots
    x          : 16le signed
    y          : 16le signed

The hotspots indicate where the actors should stand when they walk to the object.

Each IMnn contain an image for a state. As state 0 display nothing they start at 01. IMnn chunks contain a SMAP or BMOP chunk enventually followed by some ZPnn blocks. See Image resources for more details on these.

OBCD

  • OBCD
    • CDHD : header
    • VERB : script
    • OBNA : name
CDHD
  obj id    : 16le
  x         : 16le
  y         : 16le
  width     : 16le
  height    : 16le
  flags     : 8
  parent    : 8
  walk_x    : 16le signed
  walk_y    : 16le signed
  actor dir : 8 (direction the actor will look at when standing in front
                 of the object)

Note that the size and position must match those in the IMHD.

VERB

The VERB chunk hold the scripts. It start with a table giving the offset of the entry point for each verb handled by the object code, followed by the code.

  offset table : vlc
    verb       : 8 (0xFF is default)
    offset     : 16le
  table end    : 8 (must be 0)
  code

The OBNA chunk simply contain a null terminated string.