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

From ScummVM :: Wiki
Jump to navigation Jump to search
(Created page with "SCUMM Technical Reference → ''Room resources'' = SCUMM V1 = A room resource is located as the first chunk in a SCUMM/Technical_Reference...")
 
Line 78: Line 78:
<table border="2" cellspacing="0" cellpadding="4">
<table border="2" cellspacing="0" cellpadding="4">
<tr><th>Relative location</th><th>Format</th><th>Data</th></tr>
<tr><th>Relative location</th><th>Format</th><th>Data</th></tr>
<tr><td>0x00</td><td>Int8</td><td>uy</td></tr>
<tr><td>0x00</td><td>UInt8</td><td>uy</td></tr>
<tr><td>0x01</td><td>Int8</td><td>ly</td></tr>
<tr><td>0x01</td><td>UInt8</td><td>ly</td></tr>
<tr><td>0x02</td><td>Int8</td><td>ulx</td></tr>
<tr><td>0x02</td><td>UInt8</td><td>ulx</td></tr>
<tr><td>0x03</td><td>Int8</td><td>urx</td></tr>
<tr><td>0x03</td><td>UInt8</td><td>urx</td></tr>
<tr><td>0x04</td><td>Int8</td><td>llx</td></tr>
<tr><td>0x04</td><td>UInt8</td><td>llx</td></tr>
<tr><td>0x05</td><td>Int8</td><td>llx</td></tr>
<tr><td>0x05</td><td>UInt8</td><td>llx</td></tr>
<tr><td>0x06</td><td>Int8</td><td>mask</td></tr>
<tr><td>0x06</td><td>UInt8</td><td>mask</td></tr>
<tr><td>0x07</td><td>Int8</td><td>flags</td></tr>
<tr><td>0x07</td><td>UInt8</td><td>flags</td></tr>
</table>
</table>
=== Box matrix ===
Immediately following the last box payload is the box matrix.
There are <code>boxNum * boxNum</code> number of them read as UInt8.

Revision as of 12:08, 16 November 2021

SCUMM Technical ReferenceRoom resources

SCUMM V1

A room resource is located as the first chunk in a LFL File.

Header

The room resource starts with a 28 bytes header containing the following information:

LocationFormatData
0x00UInt16LESize of the room resource chunk
0x02???Unknown
0x04UInt16LERoom width in tiles
0x06UInt16LERoom height in tiles
0x08???Unknown (Always 0 in NES)
0x0aUInt16LEOffset to gfx nametable location (NES)
0x0cUInt16LEOffset to gfx attrtable location (NES)
0x0eUInt16LEOffset to mask flag value location
0x10???Unknown (On NES both these values are equal)
0x12???Unknown
0x14UInt8Number of objects in room
0x15UInt8Offset to number of boxes location
0x16UInt8Number of sounds in room (Always 0 in NES)
0x17UInt8Number of scripts in room
0x18UInt16LEOffset to exit script location
0x1aUInt16LEOffset to entry script location

All offsets are relative to the start of the chunk.

Note: Because of the following constraints:

  • Offset to box number location is an UInt8, thus must be in the first 255 bytes of the chunk
  • The header takes 28 bytes
  • The size of object images and object content offsets are 4 bytes per object

The total number of objects per room must be less than 57:

(256 - 28) / 4 = 57

Data

Object images

From byte 0x1c starts the offsets to object images:

LocationFormatData
0x1cUInt16LEOffset to object 1 image location
0x1eUInt16LEOffset to object 2 image location
...UInt16LERepeated as many times as there are objects in room

Object content

From there, there is the list of offsets to each object content:

LocationFormatData
0x1c + objNum * 2UInt16LEOffset to object 1 content location
0x1e + objNum * 2UInt16LEOffset to object 2 content location
...UInt16LERepeated as many times as there are objects in room

Number of boxes

The boxes number in the room is located at the boxes number offset specified in the header.

LocationFormatData
Offset to number of boxesUInt8Number of boxes in room

Note: Some LFL files have unknown data between the last object content offset and the boxes number offset location. For most file however, both data are contiguous.

Boxes

2 bytes after the offset to number of boxes starts the payload for the boxes. Each box takes 8 bytes described as follow:

Relative locationFormatData
0x00UInt8uy
0x01UInt8ly
0x02UInt8ulx
0x03UInt8urx
0x04UInt8llx
0x05UInt8llx
0x06UInt8mask
0x07UInt8flags

Box matrix

Immediately following the last box payload is the box matrix.

There are boxNum * boxNum number of them read as UInt8.