Saturday, May 23, 2009

More R-Type


Right so I went and did some work on the P6T format. It goes like this.

0x00 - P6T*0002
0x08 - word width
0x0c - word height
0c10 - offset to palette data
0x14 - offset to pixel data

Palette data is 32-bit, looks like ARGB and contains up to 1024 colors. Pixel data is 8-bit and I'm not sure how the pixels are associated with the CLUT. With a little bit of fudging around you can get stuff like the above picture. Presumably a background image and the in-game onscreen display.

I also did a bunch of work on the IMD format(just some notes):

almost the whole thing seems to be qword aligned

0x00 header,
'IMD '
0x05 file version always 0002
0x0c number of offsets
0x30 begin offsets, first offset points to bounding box


~0x40
0x40 bounding box
~0xbf

0xc0 followed by dword number of meshes+1
offsets to data offset tables
~ ends with FFFFFFFF

vertex data is 3 floats followed by 803f or 80bf or 01000000
3f/bf appear to be flags, difference is only one bit
10000000:80
00111111:3F
10111111:BF
there are 6 verts between each BF, there are always a multiple of 3 verts from
01000000 to next when present

different pieces of the model are sperated by a small unidentified data section

there dont appear to be any vert order tables so I'll assume that these are
linear vert data describing primitives

each mesh gets a 68h byte header containing up to 3 verts and other unknown data.

mesh data offset tables appear to reuse data. number of offset tables may not
match number of total mesh offsets used nor will the number of mesh offsets
necessarily match the number of actual meshes. maybe there is both a translation
and a rotation in the mesh offset and some meshes are simply reused in this
fashion.

it appears we must traverse the mesh offset tables until we hit the beginning
offset of the mesh offsets. load the mesh offsets as we go and load them into a
table. check meshes upon request so as to not duplicate.

meshes also appear to contain multiple data. maybe this is how the mesh offset
tables keep track of what mesh(mesh count and mesh offset table count match?
further, do the number of self contained meshes match the number of offsets used
in each mesh offset table? are there opcodes in the mesh offset tables?)