Skip to content

Romlist

Rena Kunisaki edited this page Apr 13, 2022 · 10 revisions

Each map has a [mapname].romlist.zlb file in the root of the disc. This file is a ZLB-compressed list of objects on the map.

Entries in this list are variable length, following this format:

Offset Type Name Description
000000 s16 type Object type (ObjDef)
000002 u8 size Entry length in (4-byte) words
000003 u8 acts0 Bitmask of map acts to load in
000004 u8 loadFlags Loading flags
000005 u8 acts1 Bitmask of map acts to load in
000006 u8 bound Load if distance to player is less than (bound * 8)
000007 u8 cullDist Cull object when distance to player is less than (cullDist * 8)
000008 vec3f position Object position
000014 u32 id Unique ID
000018 varies - Parameters depending on object type

(XXX is it cullDist * 80 or was that a typo?)

The object type is translated:

  • If it's positive, the corresponding entry in OBJINDEX.bin (which is simply an array of s16) is used.
  • Otherwise, the absolute value is used.

The resulting ID is an index into OBJECTS.tab, which gives the offset in OBJECTS.bin of the ObjectFileStruct.

(Why are these in the disc root, instead of the map directory? No idea.)

The unique ID is used to persist the object in the save file. The coordinates of up to 63 objects can be saved using this ID. This ID is also used to look up the object in scripting. Every object in the romlist files has a unique ID. (Exception: Multiple objects in unused maps have the ID 0xC5D.) Dynamically created objects have ID 0xFFFFFFFF.

Each bit of acts0 and acts1 corresponds to an act number:

Bit Act1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
acts0 01 02 04 08 10 20 40 80
acts1 80 40 20 10 08 04 02
  • If the given bit is not set, the object will load in this act.
  • The lowest bit of acts1 appears to be unused.
  • Act 0 loads all objects.
  • Act -1 loads no objects, but since the act number ranges from 0 to 15, this is impossible.
  • Some object types might beusing these fields for some other purpose, since they seem to have arbitrary, strange values here, and LoadFlags allow bypassing this system.

LoadFlags:

Flag Name Description
0x01 isLevelObject Load if act bits allow
0x02 isManualLoad Always load - used for dynamically created objects
0x04 OnlyLoadIfNearPlayer Use bound
0x08 ? ?
0x10 loadForOtherMap Load for a different map ID
0x20 isBlockObject Load regardless of position
0x40 ? ?
0x80 ? ?

(names are inferred from debug messages)

Refer to dlls.xml for object-specific parameters. (Warning: very large file)

OBJINDEX.bin

An array of one s16 per object ID. This maps the IDs given in romlist files to indices into OBJECTS.bin. Unused entries map to -1.

A romlist can use negative object IDs to bypass this mapping. (This is not a bug; the game explicitly checks for this case. This applies to most such index mapping, not only objects.)

It's not clear why this mapping is done. It makes sense for other assets such as models, where each map has its own copy (the mapping tells which asset ID is at which entry in the map's file); perhaps at one time, each map had a copy of OBJECTS.bin as well?

Clone this wiki locally