summaryrefslogtreecommitdiff
path: root/src/spriteloader
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-09-02 18:45:15 +0000
committerrubidium <rubidium@openttd.org>2008-09-02 18:45:15 +0000
commitfc216aeeb86f5e84db06f51ad1e3172d6c343b3b (patch)
treec6bcdba91fc3571e2f542bbd9644b62991808118 /src/spriteloader
parentc0cdfea97d298bf64f507e48e711888ef6681db6 (diff)
downloadopenttd-fc216aeeb86f5e84db06f51ad1e3172d6c343b3b.tar.xz
(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.
Diffstat (limited to 'src/spriteloader')
-rw-r--r--src/spriteloader/grf.cpp8
1 files changed, 5 insertions, 3 deletions
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 */