diff --git a/client/gui/CAnimation.cpp b/client/gui/CAnimation.cpp index f2adac62c..e30aae92a 100644 --- a/client/gui/CAnimation.cpp +++ b/client/gui/CAnimation.cpp @@ -269,7 +269,7 @@ void CDefFile::loadFrame(size_t frame, size_t group, ImageLoader &loader) const if (code==7)//Raw data { - loader.Load(length, FDef[currentOffset]); + loader.Load(length, FDef + currentOffset); currentOffset += length; } else//RLE @@ -631,7 +631,7 @@ SDLImage::SDLImage(std::string filename, bool compressed): } } -void SDLImage::draw(SDL_Surface *where, int posX, int posY, Rect *src, ui8 rotation) const +void SDLImage::draw(SDL_Surface *where, int posX, int posY, Rect *src, ui8 alpha) const { if (!surf) return; @@ -645,7 +645,19 @@ void SDLImage::draw(SDL_Surface *where, int posX, int posY, Rect *src, ui8 rotat Rect destRect(posX, posY, surf->w, surf->h); destRect += sourceRect.topLeft(); sourceRect -= margins; - CSDL_Ext::blitSurface(surf, &sourceRect, where, &destRect); + + if(surf->format->palette) + { + CSDL_Ext::blit8bppAlphaTo24bpp(surf, &sourceRect, where, &destRect); + } + if(surf->format->Amask == 0) + SDL_BlitSurface(surf, &sourceRect, where, &destRect); + else + { + SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_BLEND); + SDL_BlitSurface(surf, &sourceRect, where, &destRect); + SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE); + } } void SDLImage::playerColored(PlayerColor player) diff --git a/client/gui/CAnimation.h b/client/gui/CAnimation.h index fc04f5876..995863240 100644 --- a/client/gui/CAnimation.h +++ b/client/gui/CAnimation.h @@ -99,6 +99,7 @@ public: ~SDLImage(); void draw(SDL_Surface *where, int posX=0, int posY=0, Rect *src=nullptr, ui8 alpha=255) const override; + void playerColored(PlayerColor player) override; int width() const override; int height() const override;