From fc216aeeb86f5e84db06f51ad1e3172d6c343b3b Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 2 Sep 2008 18:45:15 +0000 Subject: (svn r14229) -Feature: allow overriding the palette of the base GRFs. This way you can play with NewGRFs made for the Windows palette with the DOS palettes base GRFs (and vice versa). Note that for this to work correctly ALL NewGRFs must use the same palette; mix and match is not yet supported. --- src/spriteloader/grf.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/spriteloader/grf.cpp') diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp index 17510027e..1ded90b07 100644 --- a/src/spriteloader/grf.cpp +++ b/src/spriteloader/grf.cpp @@ -83,7 +83,7 @@ bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, data = &sprite->data[y * sprite->width + skip]; for (int x = 0; x < length; x++) { - data->m = *dest; + data->m = ((sprite_type == ST_NORMAL && _palette_remap_grf[file_slot]) ? _palette_remap[*dest] : *dest); dest++; data++; } @@ -91,8 +91,10 @@ bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, } } else { dest = dest_orig; - for (int i = 0; i < sprite->width * sprite->height; i++) - sprite->data[i].m = dest[i]; + + for (int i = 0; i < sprite->width * sprite->height; i++) { + sprite->data[i].m = ((sprite_type == ST_NORMAL && _palette_remap_grf[file_slot]) ? _palette_remap[dest[i]] : dest[i]); + } } /* Make sure to mark all transparent pixels transparent on the alpha channel too */ -- cgit v1.2.3-54-g00ecf