I think i understand some of this - it was a bit confusing at first because the source on the webpage you gave above is not the same as the source of your program, and in fact the website one looks like it is missing a few lines.
Anyway, at the moment I see it as something like this...
Code:
+---------------+
| Worms 2 *.spr |
+---------------+
4 - Header (SPR + (byte)26)
4 - File Size
X - Filename (null)
4 - Unknown Constant (5292040)
// for (81)
1 - Red
1 - Green
1 - Blue
1 - Unknown (174)
2 - Number Of Flags (1/2)
8 - null
// for each flag
4 - Flag
4 - null
4 - Unknown Constant (7428)
2 - null
2 - X Position ? (0)
1 - null
2 - Y Position ? (1)
2 - Image Width
2 - Image Height
2 - Number Of Frames
1 - null
// for each frame
2 - Size Of Control Characters?
1 - Unknown
2 - Unknown
2 - Unknown
2 - Unknown
2 - Unknown
1 - Size Of Changed Data?
2 - Extra Size To Make The Complete File
// for each Changed Block
X - Data For The Change
1 - null
It is a bit of a mix of things, so let me hopefully explain some of it here. And I know its alittle rough and whatever - I havn't really been strict in documenting it correctly at this point in time.
I see several possibilities. ..
1. There are several frames, and the lower part of the file it like a script that tells the pixels that are to be changed with each frame. Each "script" block is terminated with a null byte, so if there are 36 nulls (as in the file I was looking at - arrowdnb.spr), there are 36 frames.
2. The sprite is just a single image, because the lower part of the file has the same number of bytes as (width-X * height-Y) - but this could be just coincidental
3 - If you add up the values in the loop labled "Size Of Control Characters" and "Size Of Changed Data" for each of the "frames", you get the size of the data following the "frames" directory, so maybe these 2 fields both somehow reflect things that I used for the description names
4. The other 2-byte field in the "frames" directory are probably just as before - X,Y,W,H
I see the whole thing being a little like a GIF animation image - you would start off with 1 single frame, and then for each frame following you only store the changed pixels rather than each frame in its completeness.
Hopefully some of this helps - you might be able to make some suggestions or something based on whatever you know about the format or the game.
Like I said - hope it helps!
WATTO
watto@watto.org
http://www.watto.org