WDT
WDT files specify exactly which map tiles are present in a world, if any, and can also reference a "global" WMO. They have a chunked file structure.
MPHD chunk
Contains 8 32-bit integers.
uint32 flags; uint32 something; uint32 unused[6];
These are the only flags checked:
Flag Description 0b0001 No Terrain/no terraincollision 0b0010 Is checked pretty often and has some effect on rendering. Maybe search for an WDT having this value. 0b0100 Decides whether to use _env terrain shaders or not: funky 0b1000 Disables something. No idea what. Another rendering thing. Someone may check all them in wild life..
if ( WDT_MPHD & 8 ) return result;
The second integer is not ignored but stores something too:
for( int i = 0; i < WDT_MPHD.something/8; i++ ) { WDT_MAIN[i].flags = 0; WDT_MAIN[i].somedata = 0; }
The other bytes seem to be unused from what I can tell.
MAIN chunk
- Map tile table.
Contains 64x64 = 4096 records of 8 bytes each.
int32 flags; void * somedata;
Flags&1 tells us, if a tile is holding an ADT. Flags&2 gets set ingame when an ADT is loaded at that position. The pointer to some data is set if the tile is loaded asynchronous.
if ( !(MAIN.flags & 2) ) LoadADTByPosition( x, y ); if ( *(Main.somedata) ) AsyncFileReadWait( *(Main.somedata) );
Blizzard was just too lazy to compress the files here. A simple bool array and adding the fields when parsing would the alternative. We just need to know the &1 flag.
MWMO, MODF chunks
For worlds with terrain, parsing ends here. If it has none, there is one MWMO and one MODF chunk here. The MODF chunk is limited to one entry. See the ADT format description for details.
MWMO chunk
- Filename for WMO (world map objects) that appear in this map. A zero-terminated string.
MODF chunk
- Placement information for the WMO. 64 bytes.
Offset Type Description 0x00 uint32 ID (index in the MWMO list) 0x04 uint32 unique identifier for this instance 0x08 3*floats Position (X,Y,Z) 0x14 3*floats Orientation (A,B,C) 0x20 6*floats Extents 0x38 uint32 Flags 0x3A uint16 Doodad set index 0x3C uint16 Name set
struct SMMapObjDef // 03-29-2005 By ObscuR { /*000h*/ UINT32 nameId; /*004h*/ UINT32 uniqueId; /*008h*/ float pos[3]; /*00Ch*/ /*010h*/ /*014h*/ float rot[3]; /*018h*/ /*01Ch*/ /*020h*/ float extents[6]; /*024h*/ /*028h*/ /*02Ch*/ /*030h*/ /*034h*/ /*038h*/ UINT32 flags; /*03Ch*/ UINT16 doodadSet; /*03Eh*/ UINT16 nameSet; /*040h*/ };