diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp index 2a129b8b3a..f683c78e99 100644 --- a/src/blitter/32bpp_base.hpp +++ b/src/blitter/32bpp_base.hpp @@ -180,6 +180,7 @@ public: /* CM */ uint8 cm_mdict[64*64*64] = {0}; uint8 CM_GetMForRGB(uint8 r, uint8 g, uint8 b) { + if (r==0 && g==0 && b==0) return 0; r &= 252; g &= 252; b &= 252; auto key = (r << 10) | (g << 4) | (b >> 2); auto m = this->cm_mdict[key]; diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp index 3891f7724e..e6d1960e1e 100644 --- a/src/blitter/32bpp_optimized.cpp +++ b/src/blitter/32bpp_optimized.cpp @@ -365,7 +365,7 @@ template Sprite *Blitter_32bppOptimized::EncodeInternal(const dst_px->r = src->r; dst_px->g = src->g; dst_px->b = src->b; - *dst_n = this->CM_GetMForRGB(src->r, src->g, src->b) | (DEFAULT_BRIGHTNESS << 8); + if (Tpal_to_rgb) *dst_n = this->CM_GetMForRGB(src->r, src->g, src->b) | (DEFAULT_BRIGHTNESS << 8); } dst_px++; dst_n++; diff --git a/src/blitter/40bpp_anim.cpp b/src/blitter/40bpp_anim.cpp index d29b34a179..f5cde00bd1 100644 --- a/src/blitter/40bpp_anim.cpp +++ b/src/blitter/40bpp_anim.cpp @@ -189,7 +189,7 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel /* In case the m-channel is zero, only apply the crash remap by darkening the RGB colour. */ if (m == 0) { *dst = mode == BM_CRASH_REMAP ? this->MakeDark(*src_px) : *src_px; - *anim = 0; + *anim = mode == BM_CRASH_REMAP ? 0 : remap[this->CM_GetMForRGB(src_px->r, src_px->g, src_px->b)]; } else { uint r = remap[m]; if (r != 0) {