1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

More ColorKey cleanup

This commit is contained in:
AlexVinS
2014-07-02 22:41:11 +04:00
parent 638dac90af
commit 3e4e810888
5 changed files with 5 additions and 17 deletions

View File

@@ -157,15 +157,9 @@ SDL_Surface * BitmapHandler::loadBitmapFromDir(std::string path, std::string fna
// 1) Vampire mansion in Necropolis (not 1st color is transparent)
// 2) Battle background when fighting on grass/dirt, topmost sky part (NO transparent color)
// 3) New objects that may use 24-bit images for icons (e.g. witchking arts)
auto colorID = SDL_MapRGB(ret->format, 0, 255, 255);
if (ret->format->palette)
{
auto & color = ret->format->palette->colors[colorID];
// set color key only if exactly such color was found
if (color.r == 0 && color.g == 255 && color.b == 255)
SDL_SetColorKey(ret, SDL_SRCCOLORKEY, colorID);
CSDL_Ext::setDefaultColorKeyPresize(ret);
}
else // always set
{