diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp index b497fac2aa0..9bb2bb5488d 100644 --- a/engines/ags/lib/allegro/gfx.cpp +++ b/engines/ags/lib/allegro/gfx.cpp @@ -33,11 +33,6 @@ namespace AGS3 { int color_conversion; -// For Allegro, paletted sprites always use index 0 as the transparent color, -// and for higher resolution formats uses bright pink RGB 255, 0, 255 -#define TRANSPARENT_COLOR(BITMAP) ((BITMAP).format.bytesPerPixel == 1 ? 0 : \ - (BITMAP).format.RGBToColor(255, 0, 255)) - /*-------------------------------------------------------------------*/ void set_color_conversion(int mode) { @@ -98,7 +93,13 @@ int bitmap_color_depth(BITMAP *bmp) { } int bitmap_mask_color(BITMAP *bmp) { - return TRANSPARENT_COLOR(*bmp); + // For paletted sprites this is 0. + // For other color depths this is bright pink (RGB 255, 0, 255). + // The alpha chanel should be 0. + //if (bmp-format.bytesPerPixel == 1) + // return 0; + //return bmp->format.AGRBToColor(0, 255, 0, 255); + return bmp->getTransparentColor(); } void blit(const BITMAP *src, BITMAP *dest, int src_x, int src_y, int dst_x, int dst_y, int width, int height) { diff --git a/engines/ags/lib/allegro/surface.h b/engines/ags/lib/allegro/surface.h index 1a4362f9589..a8558576083 100644 --- a/engines/ags/lib/allegro/surface.h +++ b/engines/ags/lib/allegro/surface.h @@ -62,7 +62,12 @@ public: } uint getTransparentColor() const { - return _owner->getTransparentColor(); + // See allegro bitmap_mask_color + // For paletted sprites this is 0. + // For other color depths this is bright pink (RGB 255, 0, 255) with alpha set to 0. + if (format.bytesPerPixel == 1) + return 0; + return format.ARGBToColor(0, 255, 0, 255); } int getpixel(int x, int y) const;