Page 2 of 3

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Wed Nov 03, 2010 11:34 am
by Mr.Mouse
This looks a lot like Heroes of Might and Magic 1 sprites and is probably a common technique, one that I also came up with during my DOS days ;) The "footer" data look a lot like a "mask" datafield. A spritemask. So where to *not* render pixels.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Thu Dec 09, 2010 10:06 pm
by Doctor Loboto
Darkfox wrote:Good news! Thanks to MortoQueiba http://www.youtube.com/user/MortoQueiba the way the game decompiles the compressed sprites has been cracked effectively. I will quote him here, and it has been tested and verified extracting and decompressing all sprites for I.M.Meen's first level.

Here's his documentation, credit him for finding this out.
The format of each image is as follows: Header, Pixel data, Footer.

=====[Header]=====
The first four bytes are the "true" ends of each sprite. Every sprite (I've tested) is 64x64 pixels big, but these bytes determine the true dimensions, using vertical and horizontal lines. The values in these are as follows:

Left, ???, Right, ??? (more experimentation needed, probably Up and Down).

These values are the exact lines that the first pixels of the sprite appears on. Left and Right share scales, and so do Up and Down (probably). That means that to make a 32x32 image on the 64x64 canvas, Left would be 11 (hex), and Right would be 30 (hex). This puts 16 (10 hex) transparent pixels to the left, and 16 (10 hex) transparent pixels to the right of the "true" sprite.

Then after those four bytes, the rest of the Header is composed of several pairs of bytes. These are actually offsets pointing to the footer for further direction in spacing out the pixels in the image. Take these and reverse them, then add "1C000" to them to get these addresses. THESE ARE RELATIVE TO THE IMAGES.IMG FILE, not the RES### file.



=====[Pixel Data]=====
Just the pixel data. Nothing special here.



=====[Footer]=====
The footer is composed of the pixel lines. By which, I mean it tells the game where to put each pixel. Each section is formatted as such.

"AA 00 BB 00 CC 00 XX 00"

AA - The end of the pixel set on that vertical line. The exact spot the transparency starts again.
BB - The start of the pixel line. The exact spot of the first pixel in line.
CC - The offset of the pixels themselves. Read from Pixel Data. Add "1C000" to this byte.
XX - trigger/command. If it is 00, then there are no more pixels on that vertical line, move onto the next one. If it is not 00, treat it as the next command's AA and continue on the same line.

So with this is there any possibility we can get a script to do the work for us rather than having to open up a hex editor each time and doing it manually?

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Thu Dec 30, 2010 10:47 pm
by Darkfox
Yeah, the program I have he made with Game Maker to do it that way. It is buggy but it works, I would love if somebody used that knowledge to make a program that does this automatically. Added CMPs seem to use this as well.

I could provide it and maybe somebody can use information in it to make a command-line tool that uses a palette and IMG, and splits up the IMG into colored 64x64 images in a manageable format.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Sat Jan 01, 2011 1:47 am
by WRS
*removed most of this post, but i said:*

i cant see where the footers are in the files
how i understand the IMG format from the sample:

Code: Select all

ushort HeaderCount
ushort Headers[HeaderCount]  --> in FLOOR/SKY Headers[0] is the exact number of imagedatapointers. with IMAGES.IMG this is NOT the case
uint ImageDataPointers[ see notes above ]

The just seek to each pointer and deal with each image (4096 bytes, unless pixel alignment, which i dont think i have an example of)
i also uploaded a quickbms script which contains the palette and can dump square (no padding) images as BMPs. now attached

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Sun Jan 02, 2011 11:44 am
by Darkfox
The contents of this post was deleted because of possible forum rules violation.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Sun Jan 02, 2011 6:35 pm
by WRS
*edit*

:D

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Mon Jan 03, 2011 5:27 am
by WRS
(another post so i could attach another file)

some graphics do have odd glitches. i have no discovered why they occur yet.
:|

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Mon Jan 03, 2011 10:41 am
by Darkfox
Ah, very good! Yeah, that is the glitch we get with some sprites. In sprites it tends to add bars of stuff as well as clone some things.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Tue Jan 04, 2011 3:54 pm
by WRS
at the sprite data, the header pointers are sometimes only 2 bytes apart. this means that the footer section is actually read like:

Code: Select all

while(true)
{
  ushort AA;
  if(AA == 0) break;
  ushort BB;
  ushort CC;

  // where AA is the right and BB is the left (so when AA == 0 there isn't any left (BB) data to read)
  // and CC is the offset to the palette index (from start of the sprite data)
}
which should fix reading your sprites.

i haven't yet written that up into bms because i dont completely understand the IMG header - my best guess is this:

Code: Select all

ushort HeaderFlag

if(HeaderFlag == 1)
{
  ushort FileCount
}
else
{
  ushort FileCount1
  ushort FileCount2
  ushort PaddedFileCount

  // where FileCount1+FileCount2+PaddedFileCount == number of headers
  // FileCount1+FileCount2 == number of unpadded files
  // and PaddedFileCount is the number of files which are padded

  FSeek(2 + (HeaderFlag * 2));
}
do you have any more info on that?

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Fri Jan 07, 2011 9:14 am
by Darkfox
Really good find there... as to information on that... er, sorry, I never figured that out, all I know is what you two have found. Regarding the IMAGES.IMG, somehow something tells the game how to number the sprites for the actors script but I dunno there either, never figured it out.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Fri Jan 14, 2011 8:53 pm
by WRS
After a gentle reminder, I've now finished that IMG -> BMP converter :)

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Sat Jan 15, 2011 2:28 am
by Darkfox
Wow, I just tested this on level 1's IMAGES.IMG and it captured everything, even the multiple blank tiles, this is beyond dandy, it makes this a whole lot more accurate and easy! Thanks a lot for this. :) Now I can fix a few errors in the sprites I currently have of levels 1-5 (there are 36 so this will make it a whole lot better than the current method) thanks a lot again. So far I get no errors to speak of.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Sat May 14, 2011 10:29 am
by Darkfox
The contents of this post was deleted because of possible forum rules violation.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Sat May 14, 2011 9:44 pm
by Darkfox
There is extra data in the newer IMG format, which are height and width due to now variable ones used in Chill Manor. I have programmed in the new palette but not sure how to compensate for the change in format.

I'm attaching the slightly modified source code (palette change) along with the 2 other IMG files, FLOOR and SKY, these are 64x64. Extra data seems to say dimensions as opposed to just beginning and end.

Edit: Also, I used Lazarus for editing, thats why it is a little different looking than WRS's.

Edit 2: Oh wow... turns out the palette for I.M.Meen was stored in GAME_SCR.PCX of RESINT.LAB. Weird method I must say. I know I've already extracted both formats but found that interesting to say the least.

Re: I.M.Meen/Chill Manor (1995 PC/DOS) Sprites [Compressed]

Posted: Mon Jun 13, 2011 9:00 am
by Darkfox
Bumping this to update, it seems that the extra bytes deal with the variable width (which translates to height once flipped properly) and perhaps the mipmaps for the larger wall textures as little else seems changed besides that. So version 2 Animation Magic IMGs aren't a vast difference. It seems they were picking up some newer gimmicks of the time though.