Star Fox/Object Data

From Data Crystal
Jump to navigation Jump to search

This is a sub-page of Star Fox.

Object Data
Game Star Fox
Start Address 0x002c15
End Address 0x006900
# of Entries 556 (not all entries are used)
Entry Length 28 (0x1c)
Total Length 15,595 bytes (0x3CEB)
Back to the ROM map

Format

Offset  Size    Description
------- ----    -----------
 0x00   2       Vertex Data Offset
 0x02   1       Vertex Data Page
 0x03   2       Face Data Offset
 0x05   2       Z-Position
 0x07   1       Scale
 0x08   2       Collision Information
 0x0a   2       Size X
 0x0c   2       Size Y
 0x0e   2       Size Z
 0x10   2       Alignment
 0x12   2       Materials
 0x14   2       ID 1
 0x16   2       ID 2
 0x18   2       ID 3
 0x1a   2       ID 4

Vertex Data

The vertex data for an object can be found using this formula:

Address = ((Vertex Data Page - 1) * 0x8000) + Vertex Data Offset
Offset  Size    Description
------- ----    -----------
 0x00   1       Vertex List Type (0x04)
 0x01   1       Vertex Count
 0x02   3*Count Vertices
        
Offset  Size    Description
------- ----    -----------
 0x00   1       Vertex List Type (0x38)
 0x01   1       Vertex Count (not including mirrored vertices)
 0x02   3*Count Vertices (not including mirrored vertices)

Each vertex listed represents two vertices in the model. The first vertex is normal, and the second vertex is a mirror image of the model about the x-axis. Each virtual "mirrored" vertex immediately follows the real vertex read from the ROM.

Offset  Size    Description
------- ----    -----------
 0x00   1       Vertex List Type (0x34)
 0x01   1       Vertex Count
 0x02   6*Count Vertices

Identical to Vertex List Type 0x04, but each vertex is 2 bytes.

Offset  Size    Description
------- ----    -----------
 0x00   1       Vertex List Type (0x1C)
 0x01   1       Frame Count
 0x02   6*Count Frame Offsets

Animated models use Vertex List Type 0x1C. It contains a count of frames in the animation, and a list of "jump" offsets for each frame. The offsets are not measured from the start of the record, but are measured from the offset entry itself. This simplifies the animation logic by allowing the code to read the type and frame count, then jump ahead by the current frame number * 2, read the offset (2 bytes), then perform another jump from that point (immediately after the jump offset) to the next vertex list entry to read.

Offset  Size    Description
------- ----    -----------
 0x00   1       Vertex List Type (0x20)
 0x01   2       Offset

The Jump Vertex List Type 0x20 is used to skip over one or more list entries. They are used to ignore animated frames that are not currently active.

The vertex list ends when a Vertex List Type value of 0x0C is read.

Triangle Data

The triangle data follows the vertex data, and contains a list of triangles that make up the model.

Offset  Size    Description
------- ----    -----------
 0x00   1       Face List Type (0x30)
 0x01   1       Triangle Count
 0x02   3*Count Triangles

The Triangle List contains one or more triangles. Each triangle is made up of 3 bytes, one for each index in the vertex list above.

Face Data

Face data starts with a Face List Type of 0x14.

Each face has the following structure:

Offset  Size    Description
------- ----    -----------
 0x00   1       Vertex Count
 0x01   1       Face Number
 0x02   1       Color/Texture Number
 0x03   1       Normal X
 0x04   1       Normal Y
 0x05   1       Normal Z
 0x06   Count   Vertex Indices

Face ends when a Vertex Count of 0xFE or 0xFF is read.

BSP Tree

BSP Tree data starts when a Face List Type of 0x3C is read.

Offset  Size    Description
------- ----    -----------
 0x00   1       BSP Tree Node (0x28)
 0x01   2       Face Data Offset
 0x03   1       Branch Offset
Offset  Size    Description
------- ----    -----------
 0x00   1       BSP Tree Leaf (0x44)
 0x01   2       Face Data Offset


Model data ends when a face list type of (0x00) is read.