diff options
author | peter1138 <peter1138@openttd.org> | 2014-04-13 19:22:23 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2014-04-13 19:22:23 +0000 |
commit | 209d3e2e9e95a0d096fd2c18b0d95597edab78f2 (patch) | |
tree | 4f4738577099ef79d94e703764277961efd7db6c /src/blitter/32bpp_anim.cpp | |
parent | 5fe053988f5b6060a68244096e385dcbe01fc9db (diff) | |
download | openttd-209d3e2e9e95a0d096fd2c18b0d95597edab78f2.tar.xz |
(svn r26463) -Fix (r10190ish): Add special handling for PALETTE_CRASH to work for non-8bpp-mapped sprites.
Diffstat (limited to 'src/blitter/32bpp_anim.cpp')
-rw-r--r-- | src/blitter/32bpp_anim.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index 7681d25ed..80ec54da4 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -133,6 +133,46 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel } break; + case BM_CRASH_REMAP: + if (src_px->a == 255) { + do { + uint m = *src_n; + if (m == 0) { + uint8 g = MakeDark(src_px->r, src_px->g, src_px->b); + *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst); + *anim = 0; + } else { + uint r = remap[GB(m, 0, 8)]; + *anim = r | (m & 0xFF00); + if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)); + } + anim++; + dst++; + src_px++; + src_n++; + } while (--n != 0); + } else { + do { + uint m = *src_n; + if (m == 0) { + if (src_px->a != 0) { + uint8 g = MakeDark(src_px->r, src_px->g, src_px->b); + *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst); + *anim = 0; + } + } else { + uint r = remap[GB(m, 0, 8)]; + *anim = 0; + if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst); + } + anim++; + dst++; + src_px++; + src_n++; + } while (--n != 0); + } + break; + case BM_TRANSPARENT: /* TODO -- We make an assumption here that the remap in fact is transparency, not some colour. * This is never a problem with the code we produce, but newgrfs can make it fail... or at least: @@ -208,6 +248,7 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return; case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return; case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return; + case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return; } } |