Difference between revisions of "MPD format"

From Netherworld Research
Jump to: navigation, search
m (+cat)
(Actor data: Document some more Actor fields)
Line 80: Line 80:
 
<pre>
 
<pre>
 
struct map_actor {
 
struct map_actor {
   u16 id;           // Class ID
+
   u16 id;         // Class ID
   u16 unk1;
+
   u16 level;
 
   u8  unk2;
 
   u8  unk2;
 
   u8  y, x;
 
   u8  y, x;
   i8  unk3;
+
   i8  unk3, unk4;
   u8  unk4, unk5, unk6;
+
   u8  ai;          // ? verify
 +
  u8  unk5, unk6;
 +
  u16 items[4];
 +
  u8  appearance;  // (0:Appear Normal, 1:Absent 2nd, 2:Appear 2nd)
  
   i8  unk[53];     // TBD, various fields
+
   i8  unk[43]; // TBD
  /*
+
    unk[9]: (0:Appear Normal, 1:Absent 2nd, 2:Appear 2nd)
+
  */
+
 
};
 
};
 
</pre>
 
</pre>
  
 
[[Category:File formats]]
 
[[Category:File formats]]

Revision as of 03:32, 7 September 2016

The MPD format is used to describe map data.

Header

struct header {
  u16 n_chunks;     // #chunks in map file
  u16 n_actors;     // #actors in map file
  u16 unknown;
  u8  padding[10];
};

Chunk

The header is followed by n_chunks chunks. Each "chunk" is fixed-size, and contains map tiles, objects and event tiles. All map tile data is stored outside the chunks section, whereas objects and event tiles are stored within it (and thus there's a limit to the number of objects/events in a chunk).

struct chunk {
  struct chunk_header            header;
  struct chunk_object_entry      objects[32];
  struct chunk_event_tile_entry  event_tiles[16];
  struct map_tile                weird_special_tile;
};

Header

struct chunk_header {
  u8  unk1[24];
  u16 n_tiles;      // #tiles within chunk
  u8  unk2, unk3;
  u16 index;        // index of chunk (starts at 0)
  u8  unk4[14];
};

Object table

Each chunk fits up to 32 objects (padded with null bytes if there's fewer).

struct chunk_object_entry {
  i16 unk1, unk2, unk3, unk4, unk5;
  i16 unk6, unk7, unk8, unk9, unk10;
  u8  unk11, unk12, unk13, unk14, unk15, unk16;
  u8  pad[10];
};

Event tile table

Each chunk fits up to 16 event tiles (padded with null bytes if there's fewer).

struct chunk_event_tile_entry {
  u8  y, x;
  u8  index;
  u8  pad1;
};

Tile data

The number of tiles in the tile data section is the sum of n_tiles for all chunks. Presumably the tiles are assigned to chunks in the order they appear, so the first chunk[0].header.n_tiles chunks belong to chunk 0, etc.

struct map_tile {
  u8  unk1[0x60];   // TBD
  i8  corners[4];   // Height in each corner of the tile, negative = up; (NW, NE, SW, SE)
  u8  unk2[0x0C];   // TBD
  u8  unk3;
  u8  y, x;
  u8  unk4, unk5, unk6, unk7;
  u8  mobility;     // 0 = Unlimited, 1 = Fly only, 2 = Impassable
  u8  geo_color;
  u8  geo_mark;     // 0 = No geopanel, 100 = Has geopanel
  u8  pad2[6];
};

Actor data

The number of actors is given by n_actors in the file header.

struct map_actor {
  u16 id;          // Class ID
  u16 level;
  u8  unk2;
  u8  y, x;
  i8  unk3, unk4;
  u8  ai;          // ? verify
  u8  unk5, unk6;
  u16 items[4];
  u8  appearance;  // (0:Appear Normal, 1:Absent 2nd, 2:Appear 2nd)

  i8  unk[43]; // TBD
};