Skip to content

ScummC data formats

Alban Bedel edited this page Apr 5, 2015 · 1 revision

1. Room object (roobj)

ScummC uses its own format to store the precompiled rooms before linking. The format is very similar to the format used by SCUMM itself, with some additions to carry the extra information needed to link the rooms together.

As a general rule, blocks that don't need any modification during the link are written as-is. Blocks that need patching will generally bear the same name but in lower case.

1.1. Structure

  • room a file can store several rooms
    • RMHD room header
    • STAB symbol table
      • GSYM global symbols
      • RSYM room symbols
    • CYCL cycle data
    • TRNS transparent color
    • PALS palettes
    • RMIM room image
    • obim object images
      • imhd image header
      • IM?? image data
    • obcd object code
      • cdhd object header
      • verb verb script
        • SFIX optional fix block
        • scob script
      • OBNA object name
    • excd orEXCD exit code
      • SFIX optional fix block
      • scob script
    • encd orENCD entry code
      • SFIX optional fix block
      • scob script
    • NLSC number of local script
    • lscr local scripts
      • SFIX optional fix block
      • scob script
    • BOXD box data
    • BOXM box matrix
    • SCAL scale slots
    • scrp global scripts
      • SFIX optional fix block
      • scob script
    • voic voice sample
    • soun music
    • cost costume
    • char charset

1.2. Blocks

1.2.1. Symbol tables: GSYM and RSYM

The GSYM block contains the symbols from the global namespace: rooms, integer variables, etc.

  symbol     : symbol list
    status   : 8
    name len : 8
    name     : 8\*len
    type     : 8
    subtype  : 8
    rid      : 16le
    addr     : 16le

The RSYM blocks contain the symbols from a room: scripts, objects, etc.

  room rid     : room rid from the GSYM block
  room symbols : list of the symbols in the room
    symbol     : just like symbols in the GSYM block

1.2.2. Object image header: imhd

It's just like an IMHD block, but the object ID is used to store the RID instead.

  object rid  : 16le
  num image   : 16le
  num zplane  : 16le
  unknown     : 16
  x           : 16le
  y           : 16le
  w           : 16le
  h           : 16le
  num hotspot : 16le
  hotspots
    x         : 16le
    y         : 16le

1.2.3. Object header: cdhd

This one must store a bit more data, so it differs a bit more from the original:

  object rid    : 16le
  initial state : 8
  initial owner : 16le rid of actor owning it, 0 otherwise.
  classes       : 16le\*32 rid of the object classes
  x             : 16le
  y             : 16le
  w             : 16le
  h             : 16le
  flags         : 8
  parent        : 8
  unknown       : 32
  direction     : 8

1.2.4. Scripts: verb, excd, encd, lscr and scrp

All the script blocks have the same structure:

  rid   : 16le rid of the script or verb
  SFIX  : fix data block
  scob  : script data block

The SFIX block contain a list of addresses that need to be patched in the code:

  fix list
    type    : 8 type of the patched resouce
    subtype : 8
    rid     : 16le rid of the patched resouces
    offset  : 32le offset in the code where the patching must be done

1.2.5. Resources: voic, soun, cost, char

All the resouces use the same simple scheme:

  rid  : 16le rid of the resource.
  data : the resouces data as-is.

2. Box files

The files created with boxedit are basically a BOXD, a BOXM and a SCAL block together. However the BOXD block has been extended to store the box names. As for the other extensions the block carries a lower case name: boxd

  num boxes  : 16le
  boxes
    name len : 8
    name     : 8\*len
    ulx      : 16le
    uly      : 16le
    urx      : 16le
    ury      : 16le
    lrx      : 16le
    lry      : 16le
    llx      : 16le
    lly      : 16le
    mask     : 8
    flags    : 8
    scale    : 16le