MAPA (File Format)

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.

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.

Version
The version value listed above can have the following values:

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:

Vertices
Vertices are a simple array of CVector3f. Geometry in MAPAs is, 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.

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

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

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