TFX Animations

Eggheads talking about bytes and stuff.
Post Reply
mikew
Data Genius
Posts: 559
Joined: 2022-Jan-09, 20:21

TFX Animations

Post by mikew »

Here's part of the first post of a thread I started over at Combatsim. The rest of that thread is largely irrelevant now, so I'll start again here:

In the extracted set of TFX2 files, there's a strange beast called 'anim\spir.256' which, as far as I know, we haven't looked at before.
For Inferno, these types of files are used are lot. That indicates that they are also used for TFX, as the 'anim' folder and '.256' extensions are present in TFX's 'did.dat'...but I haven't identified any file names. This is probably how the TFX 'Angry Guy' is described.

For Inferno, I've got filenames for a couple of dozen of these and extracted them from Inferno's 'did.dat.
I got these filenames after running Inferno for a couple of minutes, where these files appear in a folder called 'BUFFER'.
While these files have the same names as those from 'did.dat', they are larger.

So far, so good, but understanding the file content isn't so straightforward. The first two bytes are always 00 01, ie 256 in Intel format, so that's just a marker for the file. The next two bytes vary, but is always 2 for the files extracted from 'did.dat' but a larger value in the files obtained by running the game. My conjecture is that this is the number of animation frames.
Then comes the palette I think. There are 768 bytes with maximum value of 0x3F.
For the rest of the file there are a number of blocks, the amount of which seems to correspond to the number of frames from the second word.
These blocks come in 2 types, either the byte sequence '05 00 00 00 E0 4D 00 00 00' or a chunk of data which varies in size.
Each chunk of data is made up of a single 2 byte word, then a 4 byte pointer to the next block, then some 'payload'.

To be continued...
mikew
Data Genius
Posts: 559
Joined: 2022-Jan-09, 20:21

Re: TFX Animations

Post by mikew »

There is still plenty to understand about this process, but there are 2 types of file with a flag in the .256 showing how it should be handled. 'Type 1' files look like they have one base frames, then subsequent frames provide some delta.
noname3382_0.png
noname3382_0.png (13.11 KiB) Viewed 1263 times
This an example where most of the animation is his mouth moving.
mikew
Data Genius
Posts: 559
Joined: 2022-Jan-09, 20:21

Re: TFX Animations

Post by mikew »

'Type 0' have more complete frames...
_inft.gif
_inft.gif (179.91 KiB) Viewed 1262 times
'inft' describes 40 frames which I've just stuck together with Imagemagick.

The way these animations are directed is yet to be found, but there are some parser files with extension .par which may hold the key.
mikew
Data Genius
Posts: 559
Joined: 2022-Jan-09, 20:21

Re: TFX Animations

Post by mikew »

This line:
"Each chunk of data is made up of a single 2 byte word, then a 4 byte pointer to the next block, then some 'payload'."
...is not quite correct.

After the palette comes 2 bytes, giving the 'type' mentioned earlier, then for each frame, there's a 4 byte number giving the size of data, then the frame 'payload'.
I used the Windows version of SEF2000 V2.0 running in IDA to find this stuff out.
For that version of the the game, the payload is first handled by sub503e88, then if the result if 'type 0' is further handled by sub517d34 or sub_4d06a4 if 'type 1'

I really have no idea what exactly is happening in these subs. I just replicated the x86 assembler commands in Python for now.
mikew
Data Genius
Posts: 559
Joined: 2022-Jan-09, 20:21

Re: TFX Animations

Post by mikew »

By the way, I think EF2000 uses this system exclusively for the 'Intel inside' thing described in spir.256.
That's lucky, as I'd have to use the Dosbox debugger to do the same for TFX.
My interpretation of spir.256 is not quite how it looks at the start of EF2000 though...
_spir.gif
_spir.gif (1.18 MiB) Viewed 1259 times
Not exactly a priority getting that one right. :)
Post Reply