Post by snv on Aug 15, 2011 17:52:01 GMT -6
To whom it may concern, here is the structure of IMP files and decoding alghorithm (variation of ILBM RLE). Have a nice day. --- SNV
IMP_File {
u2 Type; // 8=uncompressed, 9=RLE
u2 Unknown1;
u2 Width; // virtual Width
u2 Height; // virtual Height
u4 PaletteOffset;
u4 Unknown2; // checksum or id?
u4 Unknown3;
u4 Unknown4;
u2 Unknown5;
u2 NumSequences;
u4 SequencesOffset;
//Sequence Sequences[NumSequences];
// Sequence represents specific animation (like movement or spellcasting),
// together with facings
//Facing Facings[]; // directions, sprite can face (some are mirrored)
//Facing Frames[]; // frame headers
//u1 Palette[256*4]; // RGBA palette:
// index 0 used for transparency,
// index 1 is shadow
// index 0xff is RLE special value
//Data[] // all frames compressed or uncompressed data
// hotspot (selection) at the end of the file
//u1 HotSpot[];
}
Sequence {
u4 Unknown1;
u4 Unknown2;
u1 Unknown3;
u2 Unknown4;
u1 Size; // length of sequence
u4 Offset; // offset of facing groups (directions)
}
// Facings go clockwise
Facing {
u2 Unknown1;
u2 Size;
u4 Offset;
}
Frame {
u1 Type; // 0=normal, 8=duplicate-back-reference
u1 Unknown1; // delay?
u2 Width;
u2 Height;
u2 Size; // compressed size, or uncompressed, if Type=8 or IMP_File->Type==9
// should be aligned to 4-bytes
u4 Unknown2; // checksum?
u4 Offset; // offset or number of duplicating frame
// Note: duplicates used for animation delay. Don't simply strip them.
}
for (L = 0; L < H->Width*H->Height; ) {
int C = (char)*I++;
if (C<0) {
C = -C;
while(C--) O[L++] = *I++;
} else {
C = C + 3;
while(C--) O[L++] = *I;
P++;
}
}