neunato / homm3-unpacker

Parse HOMM3 game files
https://neunato.github.io/homm3-unpacker/
MIT License
33 stars 5 forks source link

Implemented optional palette overwrites for DEF unpacking #1

Closed ChristopherRotter closed 4 years ago

ChristopherRotter commented 4 years ago

Some DEFs are intended to be colored in player colors. This works by replacing the last 32 colors in the palette with the corresponding colors from players.pal file.

From what I've seen, there is currently no way to do that with this unpacker. This simple implementation lets the user replace an arbitrary range of colors within the DEF's palette.

neunato commented 4 years ago

Thanks for your contribution!

I'll gladly accept this feature, but have to give some thought to the API and add a test or two.

Are you aware of any other situation in which a DEF's colour palette is altered?

ChristopherRotter commented 4 years ago

Hi!

Injecting player palettes is the only instance of this use case that I have come across, but modders could do all sort of things with this feature, I guess.

It is also done for some PCX files, but the palettes in the data returned by unpackPCX can already be altered without any API changes.

ChristopherRotter commented 4 years ago

I've applied your recommendations. This is indeed easier to deal with 👍