Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoP2: incorrect palette handling #1

Open
bt2901 opened this issue May 6, 2018 · 5 comments
Open

PoP2: incorrect palette handling #1

bt2901 opened this issue May 6, 2018 · 5 comments

Comments

@bt2901
Copy link

bt2901 commented May 6, 2018

This is a known issue. The details are here: http://forum.princed.org/viewtopic.php?f=70&t=4062

I wanted to export backgrounds from caverns and final, and the images came with garbled palette. I managed to fix this manually, so now I'm sharing my findings.
(I used PR-1.3.1-prerelease2)

My MO was as follows:

  1. find a palette file responsible for garbling (I think you just have to look for files which are too large compared to the average, or maybe this is always pals03500.pal file)
  2. Split this file into several smaller files, according to my best judgement. The files contain smaller set of colors.
  3. Reload the incorrect pictures, trying different palette files until the colors are correct. (I used GIMP for this: import new palette, then set colormap).

Information about palette files:

CAVERNS/pals03500.pal
Consists of 320 colors (larger than 256)
The first 160 colors are related to the shap03501-shap04059 (they export correctly).
The last 160 colors are about the bridge scenery: shap04225 - shap04235.

FINAL/pals03500.pal
Consists of 576 colors (larger than 256)
First 192 colors = shap03501-shap04027 (tower)
Next 96 = shap04050-shap04105 (chessboard and spider)
Next 96 - unused (and empty)
Next 192 - shap04125-shap04189 (crystal room and Escher rooms)

Observations:

  • Palette resources for these images contain multiple concatenated palettes. The end of palette is padded with "124 124 124" (the gray #7c7c7c), sometimes the palettes begin or end with "0 0 0" (not always; but two "0 0 0" lines in a row seem to be a strong indicator of a concatenation point).
  • How to find out which images are related to this palette part? Look for gaps in numeration and transitions between screens. The relative order is preserved: if shap04059 comes before shap04225, then the palette for shap04059 will come before shap04225 in the palette file.
@NagyD
Copy link
Owner

NagyD commented May 12, 2018

I wanted to export backgrounds from caverns and final, and the images came with garbled palette.
(I used PR-1.3.1-prerelease2)

But this bug is already fixed in the version on GitHub.
I guess I should make a new release...

@NagyD
Copy link
Owner

NagyD commented May 12, 2018

Hi @bt2901,
I compiled the current source, you can find it here: http://forum.princed.org/viewtopic.php?p=23746#p23746
Please try it.

@bt2901
Copy link
Author

bt2901 commented Jun 3, 2018

It doesn't seem to be working, unfortunately.

  1. The previous version extracted files into ./resources/ folder by default. Now it extracts them into ./unknown/ folder and creates an unknown.xml file.

  2. It extracts no .pal files (except the single palette-pop2-320cols001.pal from CAVERNS.DAT)

  3. The palette of every image is wrong (either grayscale or mismatched). The only exception is several files from CAVERNS.DAT

image-full124
image-full158

I used the following command: C:\Games\pop2_resources\PR-1.3.1\src\bin>pr.exe -e CAVERNS.DAT

@bt2901
Copy link
Author

bt2901 commented Jun 3, 2018

OK, that was the error on my side. I forgot about -s argument. For posterity, the command is supposed to be: C:\Games\pop2_resources\PR-1.3.1\src\bin>pr.exe -spop2.xml -e FINAL.DAT

Now it's working, thanks!

The only issue I've seen so far is about extracting FINAL.DAT. I get 14 copies of the following error message: can't load necessary palette, index=palt, value=0, error=-23

All extracted pictures are OK except the range of shap24902.bmp - shap24915.bmp (there are 14 of them as well, doesn't appear to be a coincidence)

@NagyD
Copy link
Owner

NagyD commented Jun 9, 2018

The only issue I've seen so far is about extracting FINAL.DAT. I get 14 copies of the following error message: can't load necessary palette, index=palt, value=0, error=-23
All extracted pictures are OK except the range of shap24902.bmp - shap24915.bmp (there are 14 of them as well, doesn't appear to be a coincidence)

These are the images of the thrown flame-ball.
As the comment in pop2.xml says, these would use a palette from PRINCE.DAT.
PR currently can't use a palette from a DAT with an image from another DAT.
Therefore I specified an invalid palette to force PR to use a default palette. That causes the errors.

There are some further images that would use a palette from a different DAT.
See the end of this post: http://forum.princed.org/viewtopic.php?p=21533#p21533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants