SCUMM/Technical Reference/Box resources

From ScummVM :: Wiki
< SCUMM‎ | Technical Reference
Revision as of 13:33, 16 November 2021 by Edo999 (talk | contribs) (→‎SCUMM V1/V2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

TODO: Describe what boxes are and how they are used; describe what a box matrix is, etc.

box matrix is stored as rtMatrix resource #1

box data is stored as rtMatrix resource #2


SCUMM V0 (C64)

TODO

 left_x   : (1 byte)
right_x   : (1 byte)
upper_y   : (1 byte)
lower_y   : (1 byte)
    mask  : (1 byte)


SCUMM V1 and V2

The boxes are stored as part of the room resource.

     uy   : (1 byte)
     ly   : (1 byte)
    ulx   : (1 byte)
    urx   : (1 byte)
    llx   : (1 byte)
    lrx   : (1 byte)
    mask  : (1 byte)
    flags : (1 byte)

SCUMM V3

TODO

SCUMM V4

BX

The BX resource contains a single byte indicating the number of boxes in the room. Then for each box a record of the following format follows (all data little endian):

    ulx   : (2 bytes)
    uly   : (2 bytes)
    urx   : (2 bytes)
    ury   : (2 bytes)
    lrx   : (2 bytes)
    lry   : (2 bytes)
    llx   : (2 bytes)
    lly   : (2 bytes)
    mask  : (1 byte)
    flags : (1 byte)
    scale : (2 bytes)

Note that "ulx" means "upper left x", "lry" means "lower right y", and so on.

The mask indicates which Z plane should mask this box. The flags are used for certain parameters:

  • 0x08 : X flip
  • 0x10 : Y flip
  • 0x20 : Ignore scale / Player only
  • 0x40 : Locked
  • 0x80 : Invisible

"scale" indicates the scaling to be used for actors in the box. If the highest bit is set, it defines a scale slot instead.

After the box data blocks the box matrix data follows, in the same format as used by V3 games.

SCUMM V5-V7

BOXD

The BOXD resource contains the box data. First come two bytes (little endian) indicating the number of boxes. Then follow box data records, using the same format as the V4 format described above.

BOXM

The box matrix data is separated in its own resource starting with V5, but the format is once more the same:

  line      : the matrix has one line for each box, terminated by 0xFF.
    box     : list of the directly connected boxes
      start : 8
      end   : 8
      box   : 8
    0xFF    : 8


SCUMM V8

BOXD

The BOXD resource starts with 4 bytes indicating the number of boxes in the room. Then for each box a record of the following format follows (all data little endian):

    ulx   : (4 bytes)
    uly   : (4 bytes)
    urx   : (4 bytes)
    ury   : (4 bytes)
    lrx   : (4 bytes)
    lry   : (4 bytes)
    llx   : (4 bytes)
    lly   : (4 bytes)
    mask  : (4 byte)
    flags : (4 byte)
scaleSlot : (4 bytes)
    scale : (4 bytes)
  unknown : (4 bytes)
  unknown : (4 bytes)