mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix fade-in animation - per-surface alpha was not set correctly
This commit is contained in:
parent
9f3663b7d4
commit
c40eea6e10
@ -111,7 +111,7 @@ void SDLImageConst::draw(SDL_Surface * where, SDL_Palette * palette, const Point
|
||||
|
||||
SDL_SetSurfaceAlphaMod(surf, alpha);
|
||||
|
||||
if (mode != EImageBlitMode::OPAQUE && surf->format->Amask != 0)
|
||||
if (alpha != SDL_ALPHA_OPAQUE || (mode != EImageBlitMode::OPAQUE && surf->format->Amask != 0))
|
||||
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_BLEND);
|
||||
else
|
||||
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
|
||||
@ -119,7 +119,7 @@ void SDLImageConst::draw(SDL_Surface * where, SDL_Palette * palette, const Point
|
||||
if (palette && surf->format->palette)
|
||||
SDL_SetSurfacePalette(surf, palette);
|
||||
|
||||
if(surf->format->BitsPerPixel == 8 && alpha == SDL_ALPHA_OPAQUE && mode == EImageBlitMode::ALPHA)
|
||||
if(surf->format->palette && alpha == SDL_ALPHA_OPAQUE && mode == EImageBlitMode::ALPHA)
|
||||
{
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(surf, sourceRect, where, destShift);
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ bool CAnimImage::isPlayerColored() const
|
||||
}
|
||||
|
||||
CShowableAnim::CShowableAnim(int x, int y, const AnimationPath & name, ui8 Flags, ui32 frameTime, size_t Group, uint8_t alpha):
|
||||
anim(GH.renderHandler().loadAnimation(name, EImageBlitMode::ALPHA)),
|
||||
anim(GH.renderHandler().loadAnimation(name, (Flags & PALETTE_ALPHA) ? EImageBlitMode::ALPHA : EImageBlitMode::COLORKEY)),
|
||||
group(Group),
|
||||
frame(0),
|
||||
first(0),
|
||||
@ -451,7 +451,7 @@ void CShowableAnim::setDuration(int durationMs)
|
||||
}
|
||||
|
||||
CCreatureAnim::CCreatureAnim(int x, int y, const AnimationPath & name, ui8 flags, ECreatureAnimType type):
|
||||
CShowableAnim(x, y, name, flags, 100, size_t(type)) // H3 uses 100 ms per frame, irregardless of battle speed settings
|
||||
CShowableAnim(x, y, name, flags | PALETTE_ALPHA, 100, size_t(type)) // H3 uses 100 ms per frame, irregardless of battle speed settings
|
||||
{
|
||||
xOffset = 0;
|
||||
yOffset = 0;
|
||||
|
@ -146,6 +146,7 @@ public:
|
||||
BASE=1, //base frame will be blitted before current one
|
||||
HORIZONTAL_FLIP=2, //TODO: will be displayed rotated
|
||||
VERTICAL_FLIP=4, //TODO: will be displayed rotated
|
||||
PALETTE_ALPHA=8, // use alpha channel for images with palette. Required for creatures in battle and map objects
|
||||
PLAY_ONCE=32 //play animation only once and stop at last frame
|
||||
};
|
||||
protected:
|
||||
|
@ -95,7 +95,7 @@ CBuildingRect::CBuildingRect(CCastleBuildings * Par, const CGTownInstance * Town
|
||||
}
|
||||
|
||||
if(!str->borderName.empty())
|
||||
border = GH.renderHandler().loadImage(str->borderName, EImageBlitMode::ALPHA);
|
||||
border = GH.renderHandler().loadImage(str->borderName, EImageBlitMode::COLORKEY);
|
||||
|
||||
if(!str->areaName.empty())
|
||||
area = GH.renderHandler().loadImage(str->areaName, EImageBlitMode::ALPHA);
|
||||
|
Loading…
Reference in New Issue
Block a user