MapInfo (File Format)

From HIVE
Jump to: navigation, search

The MapInfo file (Component List type 'mapi') contains initial information about the map, such the map dimensions, camera bounds, loading screen, and some flags.

Format

The MapInfo file doesn't seem to follow a static structure; instead, information seems to be sequentially dumped into the file. The Version field indicates changes in certain values. The '0x15', '0x17', '0x18' columns indicate if that field is present in that version.

Fields of type "Int" are four-byte values. "Words" are two-byte values. "Strings" are null-terminated arrays of bytes. An empty string is one null byte. "[]" indicates that a field is a non-string array.

Type Name 0x15 0x17 0x18 Description
Int Magic Number Y Y Y 0x4D617049, or "IpaM"
Int Version Y Y Y Indicates which MapInfo format to use.
Int Unknown N N Y Unknown?
Int Unknown N N Y Unknown?
Int Width Y Y Y Total width of the map.
Int Height Y Y Y Total height of the map.
Int Unknown Y N N Presumably this is the same as Preview Image in 0x17? If it is, the next value will be a string if this is 2. (And if it is, combine them here)
Int Small Preview Image N Y Y Indicates the small preview image. 0 indicates that no preview is used; 1 uses a minimap image; and 2 uses a custom image.
String Custom Image N Y Y This value only exists if Small Preview Image is 2.
Int Large Preview Image N Y Y Indicates the large preview image. 0 indicates that no preview is used; 1 uses a minimap image; and 2 uses a custom image.
String Custom Image N Y Y This value only exists if Large Preview Image is 2.
Int Unknown Y Y Y Unknown. (In 0x15 there is a chance that this would be the second preview image, but I don't have any evidence to support this.)
String Fog of War ID Y Y Y Indicates the ID of the Fog of War the map uses.
String Texture Set ID Y Y Y Indicates the ID of the Texture Set the map uses.
Int Camera Bound Left Y Y Y This value is 7 less than the value shown in the editor. (A value of 0 would be interpreted as 7)
Int Camera Bound Bottom Y Y Y This value is 4 less than the value shown in the editor. (A value of 0 would be interpreted as 4)
Int Camera Bound Right Y Y Y This value is 7 more than the value shown in the editor. (A value of 0 would be interpreted as -7)
Int Camera Bound Top Y Y Y This value is 4 more than the value shown in the editor. (A value of 0 would be interpreted as -4)
Int Base Height Y Y Y This value is 4096*Base Height in the editor (giving a decimal value).
Int Loading Screen Type Y Y Y Use 0 for the Melee (Default) loading screen. Use 1 for a custom loading screen.
String Loading Screen Image Y Y Y MPQ path to the image.
Word? Unknown N Y Y Seems to be 0?
Int Image Scaling Y Y Y Indicates how the loading screen is scaled. 0 uses normal scaling, 1 uses aspect scaling, and 2 stretches the image.
Int Text Position Y Y Y
-1 = (Default)
0 = Top Left
1 = Top
2 = Top Right
3 = Left
4 = Center
5 = Right
6 = Bottom Left
7 = Bottom
8 = Bottom Right
Int Text Position Offset X Y Y Y
Int Text Position Offset Y Y Y Y
Int Text Position Size X Y Y Y
Int Text Position Size Y Y Y Y
Int Flags Y Y Y Can be any combination of the following values:
0x00000001 = Disable Replay Recording
0x00000002 = Wait for Key (Loading Screen)
0x00000004 = Disable Trigger Preloading
0x00000008 = Enable Story Mode Preloading
0x00000010 = Use Horizontal Field of View
Int Unknown Y Y Y Unknown
Int Player Count Y Y Y How many players have been set. Specifically, how many times the next entry exists.
See Below[] Player Info Y Y Y One data structure for each player in Player Count.
Int Basic Team Start Locations Y Y Y How many start locations are used in Basic Team Settings. Specifically, how many of the next field exists.
Int[] Point Indexes Y Y Y One point index for each start location used. The editor limits these to only Start Locations and not regular points.
Int Start Location Count Y Y Y Additionally indicates how many start locations are used?
Int Number of Bits Y Y Y Indicates how many bits the next field contains. (Number of Bits = (Start Location Count * (Start Location Count + 1)) / 2)
Variable Alliance Flags Y Y Y The size of this field is ceil(Number of Bits / 8).

A set bit (1) indicates that the pair of Start Locations are to be allied.

 bit = 1; // Set up a bitmask
 // i will be the first Start Location in the Point Indexes array
 // j will the the Start Location after i
 for(i=0;i< Start Location Count;i++){
    for(j=i+1;j < Start Location Count;j++){ // set j, and then iterate through the rest
       bit <<= 1; // Shift left to move the mask to the next bit.
       if((Team Enemy Flags & bit) != 0) { // These start locations are allies
          // Add more to compensate for byte boundaries. This array can get big.
       }
    }
 }
Int Advanced Team Start Locations Y Y Y How many start locations are used in Advanced Team Settings. Specifically, how many of the next field exists.
Int[] Point Indexes Y Y Y One point index for each start location used.
Int Team Count Y Y Y How many teams are used in Advanced Team Settings. Specifically, how many of the next field exists.
Int[] Team Members Y Y Y One set for each team. Each bit corresponds with the Point Indexes array index (i.e., bit 0 is PointIndexes[0], bit1 is PointIndex[1], etc.). If the bit is set, that start location is a part of that team.
Int Team Count 2 Y Y Y Additionally indicates how many teams exist?
Int Number of Bits Y Y Y Indicates how many bits the next field contains. (Number of Bits = (Team Count * (Team Count + 1)) / 2)
Variable Team Enemy Flags Y Y Y The size of this field is ceil(Number of Bits / 8).

A set bit (1) indicates that the pair of teams are to be enemies.

 bit = 1; // Set up a bitmask
 // i will be the first Team in the Team Members array.
 // j will be the Team that comes after i
 for(i=0;i< Team Count;i++){
    for(j=i+1;j < Team Count;j++){ // set j, and then iterate through the rest
       bit <<= 1; // Shift left to move the mask to the next bit.
       if((Team Enemy Flags & bit) != 0) { // These teams are enemies
          // Add more code to compensate for byte boundaries.
       }
    }
 }

Player information data structure

This data structure contains all of the information about the players. Multiple copies of these exist in the MapInfo file (one for each player).

Type Name Description
Byte Player Number identifying the player.
Int Control Indicates the type of player.
0 = Default?
1 = User
2 = Computer
3 = Neutral
4 = Hostile
More?
Int Color Indicates the color of the player.
-1 = (Any)
0 = White
1 = Red
2 = Blue
3 = Teal
4 = Purple
5 = Yellow
6 = Orange
7 = Green
8 = Pink
9 = Violet
10 = Light Grey
11 = Dark Green
12 = Brown
13 = Light Green
14 = Dark Grey
15 = Lavender
String Race Indicates the race ID.
Int Unknown Unknown?
Int Start Location Indicates which point index is the Start Location (Any point is valid, even if it is not of a Start Loation type). 0 means random.
Int AI Indicates which AI to use.
0 = (Default)
0x436F6D70, or "Comp" = Computer AI
Int Decal Path to the decal to use.