Sunday 9 March 2014

TRLE File Formats: *.trwad

Program: Wadmerger
Description: Custom import/export format for moveables
Document version: 0.2


Wad category Field sint => signed integer, 8, 16 or 32 bits Comment
Wadmerger version? sint32 always 170 => Version 1.70 perhaps
Number of moveables? sint32 always 1
Moveable Object ID sint32 as per WAD
Number of Meshes sint16 as per WAD
First Mesh index sint16 as per WAD
Meshtree index sint32 as per WAD
Frame index sint32 as per WAD
Anim index sint16 as per WAD
Meshtree Number of links sint32 Error here. Calculated as (NumMeshes * 4) -1. Should be (Num Meshes * 4) - 4
Link array sint32[Number of links] last three actually belong to next moveable due error above
Meshes Number of Meshes (J) sint32
Mesh0 Sphere x sint16 collision sphere centre x co-ord
Mesh0 Sphere y sint16 collision sphere centre y co-ord
Mesh0 Sphere z sint16 collision sphere centre z co-ord
Mesh0 Sphere radius sint32 collision sphere radius
Mesh0 Num vertices sint16 number of vertices
Mesh0 Vertex array sint16[Mesh0 Num vertices*3] array of vertex x,y,z co-ords [x0,y0,z0,x1,y1,z1,x2,y2,z2...]
Mesh0 Num Normals sint16 if positive, next data is array of normals, else array vertex of lights
Mesh0 Normals/Lights sint16[Num normals*3]/sint16[abs(Num normals)] array of x,y,z co-ords or array of sint16
Mesh0 Num polygons sint16 number of faces
Mesh0 Polygon0 type sint16 8=> triangle (3 verts), 9=>rectangle (4 verts)
Mesh0 Polygon0 v0 sint16 vertex index
Mesh0 Polygon0 v1 sint16 vertex index
Mesh0 Polygon0 v2 sint16 vertex index
Mesh0 Polygon0 v3 sint16 only if quad, vertex index
Mesh0 Polygon0 Texture1 sint16 Not as per wad. Some processing has been done
Mesh0 Polygon0 Texture2 sint16 As per wad
... continue thru all polygons of Mesh0
Mesh0 PolygonK type sint16 8=> triangle (3 verts), 9=>rectangle (4 verts)
Mesh0 PolygonK v0 sint16 vertex index
Mesh0 PolygonK v1 sint16 vertex index
Mesh0 PolygonK v2 sint16 vertex index
Mesh0 PolygonK v3 sint16 only if quad, x,y,z co-ords
Mesh0 PolygonK Texture1 sint16 Not as per wad. Some processing has been done
Mesh0 PolygonK Texture2 sint16 As per wad
Mesh1 Sphere x sint16 collision sphere centre x co-ord
Mesh1 Sphere y sint16 collision sphere centre y co-ord
Mesh1 Sphere z sint16 collision sphere centre z co-ord
Mesh1 Sphere radius sint32 collision sphere radius
Mesh1 Num vertices sint16 number of vertices
Mesh1 Vertex array sint16[Mesh0 Num vertices*3] array of vertex x,y,z co-ords [x0,y0,z0,x1,y1,z1,x2,y2,z2...]
Mesh1 Num Normals sint16 if positive, next data is array of normals, else array vertex of lights
Mesh1 Normals/Lights sint16[Num normals*3]/sint16[abs(Num normals)] array of x,y,z co-ords or array of sint16
Mesh1 Num polygons sint16 number of faces
Mesh1 Polygon0 type sint16 8=> triangle (3 verts), 9=>rectangle (4 verts)
Mesh1 Polygon0 v0 sint16 vertex index
Mesh1 Polygon0 v1 sint16 vertex index
Mesh1 Polygon0 v2 sint16 vertex index
Mesh1 Polygon0 v3 sint16 only if quad, vertex index
Mesh1 Polygon0 Texture1 sint16 Not as per wad. Some processing has been done
Mesh1 Polygon0 Texture2 sint16 As per wad
... continue thru all polygons of Mesh1
Mesh1 PolygonK type sint16 8=> triangle (3 verts), 9=>rectangle (4 verts)
Mesh1 PolygonK v0 sint16 vertex index
Mesh1 PolygonK v1 sint16 vertex index
Mesh1 PolygonK v2 sint16 vertex index
Mesh1 PolygonK v3 sint16 only if quad, vertex index
Mesh1 PolygonK Texture1 sint16 Not as per wad. Some processing has been done
Mesh1 PolygonK Texture2 sint16 As per wad
... continue thru all meshes
MeshJ Sphere x sint16 collision sphere centre x co-ord
MeshJ Sphere y sint16 collision sphere centre y co-ord
MeshJ Sphere z sint16 collision sphere centre z co-ord
MeshJ Sphere radius sint32 collision sphere radius
MeshJ Num vertices sint16 number of vertices
MeshJ Vertex array sint16[Mesh0 Num vertices*3] array of vertex x,y,z co-ords [x0,y0,z0,x1,y1,z1,x2,y2,z2...]
MeshJ Num Normals sint16 if positive, next data is array of normals, else array vertex of lights
MeshJ Normals/Lights sint16[Num normals*3]/sint16[abs(Num normals)] array of x,y,z co-ords or array of sint16
MeshJ Num polygons sint16 number of faces
MeshJ Polygon0 type sint16 8=> triangle (3 verts), 9=>rectangle (4 verts)
MeshJ Polygon0 v0 sint16 vertex index
MeshJ Polygon0 v1 sint16 vertex index
MeshJ Polygon0 v2 sint16 vertex index
MeshJ Polygon0 v3 sint16 only if quad, vertex index
MeshJ Polygon0 Texture1 sint16 Not as per wad. Some processing has been done
MeshJ Polygon0 Texture2 sint16 As per wad
... continue thru all polygons of MeshJ
MeshJ PolygonK type sint16 8=> triangle (3 verts), 9=>rectangle (4 verts)
MeshJ PolygonK v0 sint16 vertex index
MeshJ PolygonK v1 sint16 vertex index
MeshJ PolygonK v2 sint16 vertex index
MeshJ PolygonK v3 sint16 only if quad, vertex index
MeshJ PolygonK Texture1 sint16 Not as per wad. Some processing has been done
MeshJ PolygonK Texture2 sint16 As per wad
Padding? Number of meshes * sint32 every sint32 is 0
Textures Number of Textures sint32
TexInfo0 sint8, sint8, sint16, sint8, sint8, sint8, sint8 x,y,tile,flipx,width,flipy,height; TODO: check if fewer than in wad and why?
Tex0 BGR pixel data (TexInfo0.width+1)*(TexInfoK.height+1)* 3 sint8 texture image in bgr top to bottom format
... continue thru all textures
TexInfoK sint8, sint8, sint16, sint8, sint8, sint8, sint8 x,y,tile,flipx,width,flipy,height
TexK BGR pixel data (TexInfoK.width+1)*(TexInfoK.height+1)* 3 sint8 texture image in bgr top to bottom format
Animation Number of Animations sint32
FrameOffset sint32 as per Wad
FrameRate sint8 as per Wad
FrameSize sint8 as per Wad
StateID sint16 as per Wad
Unknown1 sint8[8] as per Wad
Unknown2 sint8[8] as per Wad
FrameStart sint16 as per Wad
FrameEnd sint16 as per Wad
Next Animation sint16 as per Wad
Next Frame sint16 as per Wad
Num State Changes sint16 as per Wad
State change Index sint16 as per Wad
Num Anim Commands sint16 as per Wad
Anim Commands Index sint16 as per Wad
Commands Num Anim Commands sint16
Anim Commands Package Num anim commands * (4 * sint16) as per wad, command, op1, op2, op3; op3 may be unused
Frames KeyFrame Size sint32 number of sint16s in whole package
KeyFrame Package KeyFrame Size * 2 Keyframes as per wad, bb1x,bb2x,bb1y,bb2y,bb1z,bb2z,offx,offy,offz, data for each mesh + padding
States State Change0 3 * sint16 as per wad, id, num dispatch, dispatch index
Change0 Dispatches Change0 Num dispatches * (4 * sint16) as per wad, lo frame, hi frame, next anim, next frame
State Change1 3 * sint16 as per wad, id, num dispatch, dispatch index
Change1 Dispatches Change1 Num dispatches * (4 * sint16) as per wad, lo frame, hi frame, next anim, next frame
... continue thru all State Changes
State ChangeK 3 * sint16 as per wad, id, num dispatch, dispatch index
ChangeK Dispatches ChangeK Num dispatches * (4 * sint16) as per wad, lo frame, hi frame, next anim, next frame
Sounds Number of sounds sint32 number of sounds attached to object
Data beyond this only if sounds attached to object?
?? 22 bytes - sound properties??
?? sample names stored as ansistring i.e. length+chars
?? 80 bytes - mini sfx??
Data beyond this only if Wadmerger found .wavs

TRWADFormat.xlsx

No comments:

Post a Comment