#15580 - poslundc - Sun Jan 25, 2004 6:11 pm
Just something that has occurred to me occassionally in my musings while I'm coding. I imagine it's occurred to others as well, but since no one's documented it to my knowledge I figured I may as well post it here.
If you're using 16-colour sprites you can squeeze an extra palette in by using the zeroth entry of each of the sixteen palettes as the colours of your 17th palette. Then you just need to store sprites using the 17th palette as 256-colour sprites.
The colours of the 17p-sprite will render as transparent on all of your other sprites (because they are the zeroth entry of those palettes) but solid on the 17p-sprite, except for the very first entry which will be transparent.
So to map a normal 16-colour sprite to the 17th palette, you would just have to walk through each of the pixels and multiply its value by 16. Something along the lines:
*(p++) = *(q++) << 4;
... but with some or-ing and shifting modifications to handle multiple pixels.
Can't say I've ever run into a situation where having an extra 16-colour palette would make all that much difference, but there you have it anyway.
Dan.
If you're using 16-colour sprites you can squeeze an extra palette in by using the zeroth entry of each of the sixteen palettes as the colours of your 17th palette. Then you just need to store sprites using the 17th palette as 256-colour sprites.
The colours of the 17p-sprite will render as transparent on all of your other sprites (because they are the zeroth entry of those palettes) but solid on the 17p-sprite, except for the very first entry which will be transparent.
So to map a normal 16-colour sprite to the 17th palette, you would just have to walk through each of the pixels and multiply its value by 16. Something along the lines:
*(p++) = *(q++) << 4;
... but with some or-ing and shifting modifications to handle multiple pixels.
Can't say I've ever run into a situation where having an extra 16-colour palette would make all that much difference, but there you have it anyway.
Dan.