agsprite: add option to convert all 32 to 16 bpp
commiteba94f58f02cdcabbabc12ecb036357dbbbbbf28
authorrofl0r <rofl0r@users.noreply.github.com>
Thu, 21 Nov 2019 00:28:10 +0000 (21 00:28 +0000)
committerrofl0r <rofl0r@users.noreply.github.com>
Thu, 21 Nov 2019 00:28:14 +0000 (21 00:28 +0000)
tree26aa7d3c9bf4fac494a10798b60a445275ac2e38
parentd279f6e350aa30940e2d29bd708083cfdc5e7f8e
agsprite: add option to convert all 32 to 16 bpp

in case of Quest for Infamy, this reduces acsprset.spr size from
~325 MB to 155. since 16 bit images lack alphachannel, if the
sprite had the alphachannel flag set in the editor, it will become
invisible - but there's a fix, we can simply clear the alpha flag
in the game data file (ac2game.dta/game28.dta).

a tool to achieve this will be added in the follow-up commit.

in case of QFI, this worked really well, there are only some
small artifact in the big portrait pictures, where apparently
alpha settings other than 0 and 0xff were used to merge the portrait
outlines into the background. there's one sprite after the execution
scene (guard in tower) which uses a black background; apparently
this sprite didn't use magenta as its transparent color but relied
solely on alphachannel.

this can be easily fixed: simply extract the created .spr file again,
the scroll through the images with a fast image viewer like sxiv,
and edit the ones that don't have magenta background with gimp, then
create a new .spr file. one could even replace the few affected
pictures with the 32bit version from the original extraction, in
which case selective clearing of the alpha flag has to be done.
in case there are thousands of sprite, a small change in ags source
that prints sprite number when loading could help, so one can correlate
visual glitch while playing with the right sprite number.
the right place for such a patch seems to be SpriteCache::LoadSprite()
in Common/ac/spritecache.cpp.

apart from the described minor glitches, the 16 bit versions of the
pics look just as good as the 32bit versions.
agsprite.c