Skip to content

Map file

ProgSys edited this page Aug 6, 2023 · 44 revisions

This page is currently just has some unsorted thoughts.

Original findings:

Texture for each face of tile

struct mpdfileTexdata textures[12]; 

The faces of a tile can have a up to two sets of UV Maps, one for a Base Color and one for a Decal Layer. Usage is indicated if textureIndex is zero or not. The top face of the tile can additionally have a shadow map, which functions the same as a decal. (The shadow map seams to be drawn by hand)

Base color:[N, W, S, E, Top], Decal:[N, W, S, E, Top], Shadowmap:[Top], [Unknown (is always zero?) ]

Each entry consists of:

typedef struct  { //8 bytes total
  unsigned char u, 
  unsigned char stretch; //?
  unsigned char v, 
  unsigned char width;
  unsigned char size_stretch; //?      
  unsigned char height;   
  unsigned char textureIndex; 
  unsigned char transform; //rotation(0b11) - mirrorX(0b100) - mirrorZ(0b1000) - decalMode(0b110000)   
} __attribute__((packed, aligned(1))) mpdfileTexdata;

Tile

Each tile consists of:

typedef struct  { 
  mpdfileTexdata textures[12];  // Base color: N, E, S, W, Top; Decal layer: N, E, S, W, Top; Shadowmap; Unknown (is always zero?) 
	/*
	*  NW2-----NE3
	*  |       |
	*  |       |
	*  SW0-----SE1
	*/
  std::array<char, 4>  cornersTop;   // Height in each corner of the tile, negative = up; (SW, SE, NW, NE) 
  std::array<char, 2> sideN; //North bottom points, are usualy 0 if side face is hidden or starts from ground
  std::array<char, 2> sideE; //East bottom points, are usualy 0 if side face is hidden or starts from ground
  std::array<char, 2> sideS; //South bottom points, are usualy 0 if side face is hidden or starts from ground
  std::array<char, 2> sideW; //West bottom points, are usualy 0 if side face is hidden or starts from ground
  unsigned char  unk2[4];      // TBD 
  unsigned char  visible;
  char  x, z; //position of tile
  unsigned char  unk4, unk5, unk6, unk7;
  unsigned char  mobility;     // 0 = Unlimited, 1 = Fly only, 2 = Impassable
  unsigned char  geo_color;
  unsigned char  geo_mark;     // 0 = No geopanel, 100 = Has geopanel
  unsigned char  pad2[6];
} __attribute__((packed, aligned(1))) mpdfileTile;

Clone this wiki locally