Difference between revisions of "MAPA (File Format)"

From Retro Modding Wiki
Jump to: navigation, search
(Primitive Table)
(Border)
Line 207: Line 207:
 
== Border ==
 
== Border ==
  
A border in a MAPA is simple a 4 byte aligned list indices into the vertex list, each index taking up one byte. A border is simply drawn using GX_LINESTRIP.
+
A border in a MAPA is a simple 4 byte aligned list indices into the vertex list, each index taking up one byte. A border is simply drawn using GX_LINESTRIP.

Revision as of 00:10, 8 February 2015

The .MAPA file format defines the minimap models used in the Metroid Prime series. MAPA or MAP Area consists of several sections: The header, Point Of Interest entries, Vertices, Primitive Headers, and the primitives.


Morphball wirerender.png This file format needs more research
A few things are unknown in the header and POI Entries


The header is very straight forward, and has some minor differences depending on version, the unknown values don't seem to do anything, however not much research has been put into them.

Header

Type Description MP1 MP2 MP3
u32 Magic; Always 0xDEADD00D
u32 Version; See below
CVector3f Bounding Box
u32 Unknown
u32 Unknown
u32 Unknown
u32 Unknown
u32 Unknown
u32 Unknown
u32 POI Count
u32 Vertex Count
u32 Primitive Count

Version

The version value listed above can have the following values:

Game Value
Metroid Prime 1 2
Metroid Prime 2: Echoes 3
Metroid Prime 3: Corruption 5

Point of Interest

A Point of Interest in the Metroid Prime series can include: Mission Objectives, Elevators, Doors, Map Stations, and Missile Stations, each Point of Interest entry consists of the following struct:

Type Description MP1 & MP2 MP3
u32 Unknown
u32 Type; All valid values are not currently known
u32 Unknown
u16 Unknown
u16 ID; Which door, elevator etc.
CVector4f Unknown
u32 Padding; always -1
CTransform4f Tranform Matrix The Point of Interest's position in local space.
u32 * 4 Padding; four values of -1

Vertices

Vertices are a simple array of CVector3f, MAPA's are almost always centered around the origin (0, 0, 0) and are simplified full sized versions of the map they replicate. Each vertex is referenced at least twice: once for the primitive, once for the line border.

Primitive Headers

The Primitive headers are extremely simple, they merely have a bounding box followed by the primitive table start and end point, relative to the end of the current primitive header. In other words: read in the header, seek to the start of the table from the current position, then read the primitives tables.

Type Description
CAABox Bounding Box
u32 Primitive Table Start; relative to the end of this header
u32 Primitive Table End; relative to the end of this header

Primitive Table

The Primitive is also fairly simple, each one consists of two parts: The GX Primitive list, and the Border list.

Type Description
u32 Primitive Count (PC)
Primitive * PC Primitives
u32 Border Count (BC)
Border * (BC) Borders

Primitive

A primitive in a MAPA is simply a 4 byte aligned list of indices into the vertex list, starting with the GX Primitive type then an array of indicies, each index taking up one byte.

Border

A border in a MAPA is a simple 4 byte aligned list indices into the vertex list, each index taking up one byte. A border is simply drawn using GX_LINESTRIP.