mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +02:00
- fixed broken again palette in some battle backgrounds
This commit is contained in:
parent
4724ccbb45
commit
3fbcf86dec
@ -153,7 +153,19 @@ SDL_Surface * BitmapHandler::loadBitmapFromDir(std::string path, std::string fna
|
||||
logGlobal->errorStream()<<"Failed to open "<<fname<<" via SDL_Image";
|
||||
}
|
||||
}
|
||||
SDL_SetColorKey(ret, SDL_SRCCOLORKEY, SDL_MapRGB(ret->format, 0, 255, 255));
|
||||
|
||||
// When modifyin anything here please check two use cases:
|
||||
// 1) Vampire mansion in Necropolis (not 1st color is transparent)
|
||||
// 2) Battle background when fighting on grass/dirt, topmost sky part (NO transparent color)
|
||||
if (ret->format->palette)
|
||||
{
|
||||
auto colorID = SDL_MapRGB(ret->format, 0, 255, 255);
|
||||
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);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user