Jump to content

WED file struct


bigmoshi

Recommended Posts

Hi, was trying to refer to your iesdp format for wedfiles and would like to find out something about wallgroup-polygon relations & door-tile relations. Not sure if I'm interpreting the notes right.

 

For wallgroup-polygons, do for each wallgroup { find the set of polyindexes (word[]). The polyindexes then map 1-1 to the polygons. }

 

Since wallgroup count is not available, we need to deduce the no. of loops based on the total bytesize for the polyindexes. I tried a number of wed files and sumPolyIdx always == totalPolyIdx when exiting. However, the problem is sometimes a polyidx seems to map to a wallpoly that is greater than "Number of polygons used to represent walls". Is this interpretation right?

 

int sumPolyIdx = 0;

int totalPolyIdx = (wedSecHead.verticeOffset - wedSecHead.wallPolyIdxOffset) / 2;

 

while (sumPolyIdx < totalPolyIdx)

{

....sumPolyIdx += wallgroup[i++].polyIdxCount;

 

....foreach (wallgroup.polyIdxCount)

....{

........map each polyidx -> wallpoly

....}

}

 

WED V1.3 Secondary header
Offset	Size (data type)	Description
0x0000	4 (dword)	Number of polygons used to represent walls
0x0004	4 (dword)	Offset to "wall" polygons
0x0008	4 (dword)	Offset to Vertices
0x000c	4 (dword)	Offset to Wall groups
0x0010	4 (dword)	Offset to Polygon indices lookup table

WED V1.3 Wall groups
Offset	Size (datatype)	Description
0x0000	2 (word)	Start polygon index
0x0002	2 (word)	Polygon index count

WED V1.3 Polygon index lookup table
Offset	Size (datatype)	Description
0x0000	2 (word)	index

 

For door-tile, not sure if its like: For each door, {get the set of doorTileCells (word[]). The doorTileCells then map 1-1 to the TileMaps, which subsequently map to the TileIndex lookup table.}

 

Since there is no doorTileMapOffset & doorTileIndexOffset in the headers, we should use overlay[0].tileMapOffset & overlay[0].doorTileIndexOffset instead? Also, for the doortiles, should they be using the TIS file referenced by overlay[0] as well?

 

WED V1.3 Header
Offset	Size (data type)	Description
0x0000	4 (char array)	Signature ('WED ')
0x0004	4 (char array)	Version ('V1.3')
0x0008	4 (dword)	Number of overlays (including the base layer)
0x000c	4 (dword)	Number of doors
0x0010	4 (dword)	Offset (from start of file) to overlays
0x0014	4 (dword)	Offset (from start of file) to secondary header
0x0018	4 (dword)	Offset (from start of file) to doors
0x001c	4 (dword)	Offset (from start of file) to door tile cell indices

WED V1.3 Doors
Offset	Size (data type)	Description
0x0000	8 (char array)	Name of door (matched on in AREA file?)
0x0008	2 (word)	Unknown... Open/closed? (1==closed)
0x000a	2 (word)	First door tile cell index
0x000c	2 (word)	Count of door tile cells for this door
0x000e	2 (word)	Count of polygons for  "door open" state
0x0010	2 (word)	Count of polygons for "door closed" state
0x0012	4 (dword)	Offset from start of file to polygons for "door open" state
0x0016	4 (dword)	Offset from start of file to polygons for "door closed" state

WED V1.3 Door tile cells
Offset	Size (datatype)	Description
0x0000	2 (word)	index

WED V1.3 Overlays
Offset	Size (data type)	Description
0x0000	2 (word)	Width (in tiles)
0x0002	2 (word)	Height (in tiles)
0x0004	8 (resref)	Name of Tileset (resource type 0x3eb)
0x000c	4 (unknown)	Unknown
0x0010	4 (dword)	Offset to tilemap for this overlay
0x0014	4 (dword)	Offset to tile index lookup for this overlay

 

Thanks in advance for your help :band:

Link to comment

The wallgroups sometimes duplicate references to a wallgroup polygon.

This is because the wallgroups list all polygons overlapping a section of the screen, if a polygon reaches over a boundary, it will be listed in two or more wallgroups.

 

The wallgroup table size is determined by the area size (which is the size of overlay[0]).

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...