0

I am currently working on an old classic PC game. The programming face a lot of issues as I go along, mostly because I am not educated as a programmer nor designer. Although my passion for this particular game makes it wort it.

I am currently trying to open the images for the game. The images are made using Paint Deluxe 2. From what I have found out they are all PCX-format when you open them to add changes. Then they are saved into the game in a external achieve beside the executable file as .bmp-files (from what I can understand). The palette used is actually a bit weird with 6-bits channels (not 8-bits as you would expect).

I face a issue with the developers way of doing it. Before adding the images to the file, the header was stripped off, and the palette stored in an external file. As Paint Deluxe 2 save the length of the pixels for a 190x107 to 20544 bytes (189x107-190x107-191x107 and 192x107 are all stored as 20544 bytes of pixels excluding the header and palette). While is should actually be 20330 bytes. This brings some headache for me. As well as it seems like the images used for the game is somehow the other way around. Looks like the images is stored going in the opposite direction somehow.

To clear things up: FILE34 which is 20330 byte is the ORGINAL file loaded by the game onto the screen. FILE34 which is 20544 byte is what I end up with when I stripp the file after changing it back to pcx-format and then to bmp-format. The pcx-file is also included and can be opened with GIMP for example. BIN_PALETTE.PAL is the palette used for the images.

Are anyone familiar with this issue, and can give me some advice? enter link description here

Community
  • 1
  • 1
Thomas
  • 1
  • 4
  • 1
    curious which game it is – Mulan May 19 '16 at 05:06
  • it is a big one: Actua Soccer 1 – Thomas May 19 '16 at 11:07
  • 6-bit palette is very normal VGA format, btw. Not the standard PCX used, but in general, there's nothing abnormal about that. Most 90s games use 6-bit VGA; it's related to how the hardware handled it. – Nyerguds Aug 05 '19 at 10:54
  • Overall though, there's not enough information in this. I've dug into lots of old game formats, but you never even specify how you get to the data of your FILE34. What is the archive it is stored in? What is the archive's format? How can you "open them to add changes"? Are you using old DOS modding tools, or does the game itself allow exporting it for editing? And, uh... how is any of this related to PCX? – Nyerguds Aug 05 '19 at 11:12

1 Answers1

0

BMP files are usually stored bottom-up (the last scanline is stored first, all the up, until the first scanline). More recent BMP files can also be stored top-down like other formats, but this is less common. If the game's files are stored top-down, they will appear as upside down, compared to a normal BMP file.

Also, the BMP format pads each scanline to a 32 bit (long word) boundary, which is why the file size is the same for widths 189-192 (they all need 192 bytes per scanline). If game's files are stored without this padding, this is the reason for the difference.

For more info, see BMP file format on Wikipedia.

It is quite easy to rewrite your headerless BMPs to the format used in the game (given those are the two only differences). I'll outline the process/use pseudo code, as there's no language tag in your question:

  • Read the entire BMP array into memory (192 x 107).
  • Create a new array that can hold the output (190 x 107)
  • Loop over the rows in the original
    • For each row, copy the first 190 bytes (skip the 2 padding bytes)
    • Store these bytes into the new array, but fill from the end
  • Write the resulting bytes to disk

(I can write the above in Java if it helps you).

Harald K
  • 26,314
  • 7
  • 65
  • 111
  • Thanks for the answer. Is there any easy way to removed the padding from the files expect from manual removing them? – Thomas May 19 '16 at 11:05
  • Hi Harald. It would be great if you could help me out. In that case they would also be sized down to fit the game too. I have little experience with images, and for me this is really painful stuff. I get some working as PCX-images actually, but does not work. So I am really confused why same size images with the same header can result in some correct ones while some are incorrect. – Thomas May 19 '16 at 19:15
  • Hi Harald. I added two files to the dropbox map. Please check the 4x4.bmp-files. Is the black and white fields around the yellow image color the padding? – Thomas May 20 '16 at 19:58
  • @Thomas Sorry, don't have much time right now, but I'll try to look at it some time next week. – Harald K May 21 '16 at 11:57
  • Hi Harald. No problem. I did try to add padding using FF FF every 190 bytes, and it worked. Although the picture is upside down. So as we both suspected they files are read by the line byte wise from the TOP and down. Now it starts from the left in the bottom of the picture. I have tried to add the header to a PCX-format, and that worked successfully (without padding added - 20 330 bytes). ALTHOUGH that was in some mysterious way only the case for some of the files. I added 3 files to the dropbox. 2 are working (Flag for Spain and Russia), 1 is not at all (Flag of the USA). – Thomas May 21 '16 at 12:31
  • Any news? I have tried to find out about the images myself, but the images must have been scanned top-bottom, which is unusual with BMPs. The header should then have a twos complement to the height to scan the files correct. Although it does not work for me. It is difficult, but still so close to success... – Thomas May 30 '16 at 19:25
  • @Thomas Sorry, worked out these days. Don't wait for me. ;-) But I will have a look at it, if I find the time! – Harald K Jun 01 '16 at 08:00