| 1 |
If you want to add/modify graphical datas in my PT clone, you need to |
| 2 |
run the BMPs through a packer (my packer is supplied - bmp2pth.c/bmp2pth.exe). |
| 3 |
|
| 4 |
Every bitmap (the packed ones) has four colors. |
| 5 |
|
| 6 |
Translation scheme (32-bit RGB to 2-bit palette look-up): |
| 7 |
0x00000000 (palette[0]) -> 0 |
| 8 |
0x00BBBBBB (palette[1]) -> 1 |
| 9 |
0x00888888 (palette[2]) -> 2 |
| 10 |
0x00555555 (palette[3]) -> 3 |
| 11 |
(other RGB values = invalid, modify palette[] in pt_palette.c for other colors) |
| 12 |
|
| 13 |
Then each pixel is bit-packed like this (8-bit binary value): |
| 14 |
xx000000 = pixel 1 |
| 15 |
00xx0000 = pixel 2 |
| 16 |
0000xx00 = pixel 3 |
| 17 |
000000xx = pixel 4 |
| 18 |
(f.ex. 01001011) |
| 19 |
|
| 20 |
The data is then RLE encoded using the compactor found in ptcompacter.s |
| 21 |
in the PT1.3 source code, except that the "Lowest" (compactor code) |
| 22 |
variable should contain 204 (0xCC) instead of 181 (0xB5). |
| 23 |
|
| 24 |
WARNING: |
| 25 |
Due to the nature of the RLE packer, one 8-bit value is used as an ID to tell |
| 26 |
the RLE unpack routine that RLE data follows. This value is 0xCC (11001100b). |
| 27 |
When translated to 32-bit RGB, this is: |
| 28 |
0x00555555, 0x00000000, 0x00555555, 0x00000000 |
| 29 |
(palette[3], palette[0], palette[3], palette[0]) |
| 30 |
|
| 31 |
This means that if these four values are repeated anywhere in the BMP files, |
| 32 |
you will mess up the RLE scheme. |
| 33 |
|
| 34 |
EOF |