MAPA (File Format): Difference between revisions
imported>Antidote No edit summary |
(added list of mappable object types for echoes) |
||
(23 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
The '''.MAPA file format''' defines the minimap models used in the Metroid Prime series. MAPA or '''MAP A'''rea consists of several sections: The header, | The '''.MAPA file format''' defines the minimap models used in the Metroid Prime series. MAPA or '''MAP A'''rea consists of several sections: The header, Mappable Object entries, Vertices, Primitive Headers, and the primitives. | ||
{{research|2|A few things are unknown in the header and | {{research|2|A few things are unknown in the header and Mappable Object Entries}} | ||
__TOC__ | __TOC__ | ||
== Format == | |||
The header is very | === Header === | ||
The header is very straightforward, and has some minor differences depending on version. | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 28: | Line 27: | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
| | |u32 | ||
|''' | |'''Type'''; unknown function in MP1/3, specifies whether the area appears on the Light (0) or Dark (1) map in MP2 | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
Line 35: | Line 34: | ||
|- | |- | ||
|u32 | |u32 | ||
| | |'''Visibility Mode'''; <ol start=0><li>Always Visible (Map Universe Area)</li><li>Visible on Visit or Map Station (most MP1 areas)</li><li>Visible on Visit only (latter areas of Ruins and Phendrana)</li><li>Never Visible</li></ol> | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
|{{AABox}} | |||
|{{ | |'''Bounding Box''' | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
|{{Vector3f}} | |||
|{{ | |'''Map Adjustment''' | ||
|{{nocheck}} | |{{nocheck}} | ||
|{{check}} | |{{check}} | ||
Line 55: | Line 54: | ||
|{{unknown|Unknown}} | |{{unknown|Unknown}} | ||
|{{nocheck}} | |{{nocheck}} | ||
|{{ | |{{nocheck}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
|u32 | |u32 | ||
| | |'''Mappable Object Count''' | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
|u32 | |u32 | ||
|''' | |'''Vertex Count''' | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
Line 77: | Line 70: | ||
|- | |- | ||
|u32 | |u32 | ||
|''' | |'''Primitive Count''' | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
Line 83: | Line 76: | ||
|- | |- | ||
|u32 | |u32 | ||
|''' | |'''Environment Variable Section Size''' | ||
|{{ | |{{nocheck}} | ||
|{{nocheck}} | |||
|{{check}} | |{{check}} | ||
|- | |||
|u32 | |||
|'''Environment Variable Count''' | |||
|{{nocheck}} | |||
|{{nocheck}} | |||
|{{check}} | |{{check}} | ||
|- | |||
| colspan=5 {{unknown|End of Header}} | |||
|} | |} | ||
=== Version === | ==== Version ==== | ||
The version value listed above can have the following values: | The version value listed above can have the following values: | ||
{|class="wikitable" | {|class="wikitable" | ||
Line 105: | Line 106: | ||
|} | |} | ||
== | === Environment Variables === | ||
A | Only exists in Corruption; used for some areas with Landing Sites. | ||
{|class="wikitable" | |||
!Type | |||
!Count | |||
!Description | |||
|- | |||
|string | |||
|Environment Variable Count | |||
|'''Environment Variable''' | |||
|- | |||
| colspan=3 {{unknown|Pad to 4 bytes}} | |||
|- | |||
| colspan=3 {{unknown|End of Environment Variables}} | |||
|} | |||
=== Mappable Objects === | |||
A Mappable Object in the Metroid Prime series can include: Elevators, Doors, and Save/Missile Stations. Each Mappable Object entry consists of the following struct: | |||
{|class="wikitable" | {|class="wikitable" | ||
!Type | !Type | ||
Line 114: | Line 131: | ||
|- | |- | ||
|u32 | |u32 | ||
| | |'''Type'''; See tables below for MP1/MP2 types | ||
|{{ | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
|u32 | |u32 | ||
|''' | |'''Visibility Mode'''; <ol start=0><li>Always Visible</li><li>Visible on Map Station or Area Visit</li><li>Visible on Door Visit</li><li>Never Visible</li><li>Visible on Map Station or Area Visit</li></ol> | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
|u32 | |u32 | ||
| | |'''Editor ID'''; Same ID format as SCLY, indicates associated world object | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
| | |[[GUID]] | ||
| | |'''Saved State ID''' | ||
|{{nocheck}} | |{{nocheck}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
| | |u32 | ||
|{{unknown|Unknown}} | |{{unknown|Unknown}} | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
| | |{{Transform4f}} | ||
|''' | |'''Transform Matrix''' The Mappable Object's position in '''world''' space. | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |- | ||
|u32 * 4 | |u32 * 4 | ||
| | |{{unknown|Unknown}} | ||
|{{check}} | |{{check}} | ||
|{{check}} | |{{check}} | ||
|- | |||
| colspan=4 {{unknown|End of Mappable Object}} | |||
|} | |} | ||
==Vertices== | ==== MP1 Types ==== | ||
{|class="wikitable" | |||
!Type | |||
!Description | |||
|- | |||
|0 | |||
|Normal Door | |||
|- | |||
|1 | |||
|Shield Door | |||
|- | |||
|2 | |||
|Ice Door | |||
|- | |||
|3 | |||
|Wave Door | |||
|- | |||
|4 | |||
|Plasma Door | |||
|- | |||
|5 | |||
|Big Door | |||
|- | |||
|6 | |||
|Big Door 2 | |||
|- | |||
|7 | |||
|Ice Door Ceiling | |||
|- | |||
|8 | |||
|Ice Door Floor | |||
|- | |||
|9 | |||
|Wave Door Ceiling | |||
|- | |||
|10 | |||
|Wave Door Floor | |||
|- | |||
|11 | |||
|Plasma Door Ceiling | |||
|- | |||
|12 | |||
|Plasma Door Floor | |||
|- | |||
|13 | |||
|Ice Door Floor 2 | |||
|- | |||
|14 | |||
|Wave Door Floor 2 | |||
|- | |||
|15 | |||
|Plasma Door Floor 2 | |||
|- | |||
|27 | |||
|Down Arrow Yellow (Maintenance Tunnel) | |||
|- | |||
|28 | |||
|Up Arrow Yellow (Phazon Processing Center) | |||
|- | |||
|29 | |||
|Down Arrow Green (Elevator A) | |||
|- | |||
|30 | |||
|Up Arrow Green (Elite Control Access) | |||
|- | |||
|31 | |||
|Down Arrow Red (Elevator B) | |||
|- | |||
|32 | |||
|Up Arrow Red (Fungal Hall Access) | |||
|- | |||
|33 | |||
|Elevator | |||
|- | |||
|34 | |||
|Save Station | |||
|- | |||
|37 | |||
|Missile Station | |||
|} | |||
==== MP2 Types ==== | |||
{| class="wikitable" | |||
!Type | |||
!Description | |||
|- | |||
|0 | |||
|Normal Door | |||
|- | |||
|1 | |||
|Missile Door | |||
|- | |||
|2 | |||
|Dark Door | |||
|- | |||
|3 | |||
|Annihilator Door | |||
|- | |||
|4 | |||
|Light Door | |||
|- | |||
|5 | |||
|Super Missile Door | |||
|- | |||
|6 | |||
|Seeker Missile Door | |||
|- | |||
|7 | |||
|Power Bomb Door | |||
|- | |||
|16 | |||
|Elevator | |||
|- | |||
|17 | |||
|Save Station | |||
|- | |||
|20 | |||
|Ammo Station | |||
|- | |||
|21 | |||
|Portal | |||
|- | |||
|22 | |||
|Light Teleporter | |||
|- | |||
|23 | |||
|Translator Gate | |||
|- | |||
|24 | |||
|Up Arrow | |||
|- | |||
|25 | |||
|Down Arrow | |||
|} | |||
=== 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. | 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== | === 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. | 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. | ||
Line 171: | Line 315: | ||
!Description | !Description | ||
|- | |- | ||
| | |{{Vector3f}} | ||
|''' | |'''Normal''' | ||
|- | |||
|{{Vector3f}} | |||
|'''Center of Mass''' | |||
|- | |- | ||
|u32 | |u32 | ||
|'''Primitive Table Start'''; relative to the end of | |'''Primitive Table Start'''; relative to the end of the header | ||
|- | |- | ||
|u32 | |u32 | ||
|''' | |'''Border Table Start'''; relative to the end of the header | ||
|} | |} | ||
==Primitive Table== | === Primitive Table === | ||
The Primitive is also fairly simple, each one consists of two parts: The GX Primitive list, and the Border list. | The Primitive is also fairly simple, each one consists of two parts: The GX Primitive list, and the Border list. | ||
Line 201: | Line 348: | ||
|} | |} | ||
== Primitive == | === 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. | 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 == | === 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. | 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. | ||
[[Category:File Formats]] | |||
[[Category:Metroid Prime]] | [[Category:Metroid Prime]] | ||
[[Category:Metroid Prime 2: Echoes]] | [[Category:Metroid Prime 2: Echoes]] | ||
[[Category:Metroid Prime 3: Corruption]] | [[Category:Metroid Prime 3: Corruption]] |
Latest revision as of 03:00, 2 May 2023
The .MAPA file format defines the minimap models used in the Metroid Prime series. MAPA or MAP Area consists of several sections: The header, Mappable Object entries, Vertices, Primitive Headers, and the primitives.
This file format needs more research A few things are unknown in the header and Mappable Object Entries |
Format
Header
The header is very straightforward, and has some minor differences depending on version.
Type | Description | MP1 | MP2 | MP3 |
---|---|---|---|---|
u32 | Magic; Always 0xDEADD00D | ✔ | ✔ | ✔ |
u32 | Version; See below | ✔ | ✔ | ✔ |
u32 | Type; unknown function in MP1/3, specifies whether the area appears on the Light (0) or Dark (1) map in MP2 | ✔ | ✔ | ✔ |
u32 | Visibility Mode;
|
✔ | ✔ | ✔ |
AABox | Bounding Box | ✔ | ✔ | ✔ |
Vector3f | Map Adjustment | ✖ | ✔ | ✔ |
u32 | Unknown | ✖ | ✖ | ✔ |
u32 | Mappable Object Count | ✔ | ✔ | ✔ |
u32 | Vertex Count | ✔ | ✔ | ✔ |
u32 | Primitive Count | ✔ | ✔ | ✔ |
u32 | Environment Variable Section Size | ✖ | ✖ | ✔ |
u32 | Environment Variable Count | ✖ | ✖ | ✔ |
End of Header |
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 |
Environment Variables
Only exists in Corruption; used for some areas with Landing Sites.
Type | Count | Description |
---|---|---|
string | Environment Variable Count | Environment Variable |
Pad to 4 bytes | ||
End of Environment Variables |
Mappable Objects
A Mappable Object in the Metroid Prime series can include: Elevators, Doors, and Save/Missile Stations. Each Mappable Object entry consists of the following struct:
Type | Description | MP1 & MP2 | MP3 |
---|---|---|---|
u32 | Type; See tables below for MP1/MP2 types | ✔ | ✔ |
u32 | Visibility Mode;
|
✔ | ✔ |
u32 | Editor ID; Same ID format as SCLY, indicates associated world object | ✔ | ✔ |
GUID | Saved State ID | ✖ | ✔ |
u32 | Unknown | ✔ | ✔ |
Template:Transform4f | Transform Matrix The Mappable Object's position in world space. | ✔ | ✔ |
u32 * 4 | Unknown | ✔ | ✔ |
End of Mappable Object |
MP1 Types
Type | Description |
---|---|
0 | Normal Door |
1 | Shield Door |
2 | Ice Door |
3 | Wave Door |
4 | Plasma Door |
5 | Big Door |
6 | Big Door 2 |
7 | Ice Door Ceiling |
8 | Ice Door Floor |
9 | Wave Door Ceiling |
10 | Wave Door Floor |
11 | Plasma Door Ceiling |
12 | Plasma Door Floor |
13 | Ice Door Floor 2 |
14 | Wave Door Floor 2 |
15 | Plasma Door Floor 2 |
27 | Down Arrow Yellow (Maintenance Tunnel) |
28 | Up Arrow Yellow (Phazon Processing Center) |
29 | Down Arrow Green (Elevator A) |
30 | Up Arrow Green (Elite Control Access) |
31 | Down Arrow Red (Elevator B) |
32 | Up Arrow Red (Fungal Hall Access) |
33 | Elevator |
34 | Save Station |
37 | Missile Station |
MP2 Types
Type | Description |
---|---|
0 | Normal Door |
1 | Missile Door |
2 | Dark Door |
3 | Annihilator Door |
4 | Light Door |
5 | Super Missile Door |
6 | Seeker Missile Door |
7 | Power Bomb Door |
16 | Elevator |
17 | Save Station |
20 | Ammo Station |
21 | Portal |
22 | Light Teleporter |
23 | Translator Gate |
24 | Up Arrow |
25 | Down Arrow |
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.
Type | Description |
---|---|
Vector3f | Normal |
Vector3f | Center of Mass |
u32 | Primitive Table Start; relative to the end of the header |
u32 | Border Table Start; relative to the end of the 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 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.