mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
More ColorKey cleanup
This commit is contained in:
parent
638dac90af
commit
3e4e810888
@ -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
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ void CMessage::init()
|
||||
delete bluePieces;
|
||||
}
|
||||
background = BitmapHandler::loadBitmap("DIBOXBCK.BMP");
|
||||
SDL_SetColorKey(background,SDL_SRCCOLORKEY,SDL_MapRGB(background->format,0,255,255));
|
||||
CSDL_Ext::setDefaultColorKey(background);
|
||||
}
|
||||
ok = CDefHandler::giveDef("IOKAY.DEF");
|
||||
cancel = CDefHandler::giveDef("ICANCEL.DEF");
|
||||
|
@ -1799,7 +1799,7 @@ void CMinorResDataBar::showAll(SDL_Surface * to)
|
||||
CMinorResDataBar::CMinorResDataBar()
|
||||
{
|
||||
bg = BitmapHandler::loadBitmap("KRESBAR.bmp");
|
||||
SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
|
||||
CSDL_Ext::setDefaultColorKey(bg);
|
||||
graphics->blueToPlayersAdv(bg,LOCPLINT->playerID);
|
||||
pos.x = 7;
|
||||
pos.y = 575;
|
||||
|
@ -265,13 +265,7 @@ void Graphics::loadHeroFlagsDetail(std::pair<std::vector<CDefEssential *> Graphi
|
||||
}
|
||||
for(auto & curImg : curImgs)
|
||||
{
|
||||
#ifdef VCMI_SDL1
|
||||
uint32_t key = SDL_MapRGB(curImg.bitmap->format, 0, 255, 255);
|
||||
#else
|
||||
uint32_t key = SDL_MapRGBA(curImg.bitmap->format, 0, 255, 255, 0);
|
||||
#endif
|
||||
|
||||
SDL_SetColorKey(curImg.bitmap, SDL_SRCCOLORKEY, key);
|
||||
CSDL_Ext::setDefaultColorKey(curImg.bitmap);
|
||||
#ifndef VCMI_SDL1
|
||||
SDL_SetSurfaceBlendMode(curImg.bitmap,SDL_BLENDMODE_NONE);
|
||||
#endif
|
||||
|
@ -129,7 +129,7 @@ void CPicture::convertToScreenBPP()
|
||||
{
|
||||
SDL_Surface *hlp = bg;
|
||||
bg = SDL_ConvertSurface(hlp,screen->format,0);
|
||||
SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
|
||||
CSDL_Ext::setDefaultColorKey(bg);
|
||||
SDL_FreeSurface(hlp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user