Star Fox/Object Data

From Data Crystal
< Star Fox
Revision as of 21:55, 16 May 2019 by SpyderTL (talk | contribs) (Added BSP Tree, Triangle and Face data)
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       Palette
 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. All of the (virtual) mirror vertices are located after the normal vertices when they are being referenced by the face data below.


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.

Animated models use Vertex List Type 0x1C, but this format is currently unavailable.

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


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