Objects
See also the Majora's Mask wiki: Objects |
Object Files or Objects are files which primarily contain the graphical assets (display lists, textures) for actors, as well as animation data and collision surfaces for some actors.
Contents
Object Table
The Object Table assigns an identifier to object files.
Format
The table appears to start with the following variables:
/*0x00*/ short AdultLinkObjectNumber; //Object number for Adult Link's model
/*0x02*/ short ChildLinkObjectNumber; //Object number for Child Link's model
/*0x04*/ int NumberOfObjects = 0x192; //402 records in the table
Following that is the table itself:
FileAddress ObjectAddresses[NumberOfObjects];
struct FileAddress
{
/*0x00*/ uint ObjectStart; //VRom Address
/*0x04*/ uint ObjectEnd; //VRom Address
}
Anatomy of an Object File
Object files have no "format" per se, but contain different types of "static" data:
- Display Lists, in the form of F3DZEX2 GBI (graphical binary interface).
- Textures and palette data, typically referenced by said display lists
- Animation Data
- Collision Surfaces for actors with complex collision (eg. odd shaped platforms, destructible walls)
Loading/Managing Object Files
"Object Space"
The vast majority of object files are allocated to a space referred to as "Object Space", located immediately before the start address of the current scene file. The following table lists the size given to "Object Space":
Size | Condition |
---|---|
0xFA000 | Scene Index = 0x51 (Hyrule Field) |
0x11F800 | Scene Index = 0x4F (Ganon Boss Fight), and Scene Setup is *not* 4 (Tower Collapsing Cutscene) |
0x106800 | Scene Index = 0x17 (Spirit Temple Boss Room) |
Scene Index = 0x44 (Chamber of Sages) | |
Scene Index = 0x18 (Ganondorf Boss) | |
0xFA000 | Default |
The process for filling this space is as follows. Note that all object files are inserted into the lowest start address available, with no "gaps" between each object file:
- gameplay_keep (0001, Shared assets for actors (always loaded)) is always allocated first. Segment address 04 is set to it's start address.
- Optionally, gameplay_field_keep (0002, Shared assets for actors (Overworld)) or gameplay_dangeon_keep (0003, Shared assets for actors (Dungeons)) is allocated, depending on the 0x07 scene header command. Segment address 05 is set to it's start address, if loaded.
- object_link_boy (0014, Adult Link) or object_link_child (0015, Child Link) is allocated, depending on whether Link should spawn as an adult or a child.
After that, object files are allocated based on the order they appear in the 0x0B room header command of the room Link initially spawns in. Whenever Link travels between two rooms, the game will compare the objects that were loaded by the first room to the objects requested by the second, starting with the first object number in each list. When the game encounters a number that does not match, all object files after the last match will be de-allocated, and any missing object file requests pending for the second room will be allocated.
An important thing to note about "Object Space" is that whenever the game is paused, this space is re-purposed in order to store the pause screen's graphical files and object dependencies.
GI Objects
Whenever Link holds an item over his head, or pulls out an item to show it to an NPC, a GI_Object file (an object file containing a "high res" 3D model of an item) will be loaded into a much smaller space allocated after Link's instance before the item is shown.