diff options
author | celestar <celestar@openttd.org> | 2005-07-24 15:56:31 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-07-24 15:56:31 +0000 |
commit | 238e47cd42c009f2ab1359428788a65a26fafebb (patch) | |
tree | e02fce527cef08bc25354c995fecc8ddb0ab5318 /gfx.c | |
parent | a227065ab75d6cb9f449f2282315adc933450b49 (diff) | |
download | openttd-238e47cd42c009f2ab1359428788a65a26fafebb.tar.xz |
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
by enums. There remains work in gfx.c to move the "transparency" and
"recolor" bits around to make space for more sprites. However, 2800
additional sprites can now be loaded. There also remains cleanup and
Doxygen work on many of the header files.
Diffstat (limited to 'gfx.c')
-rw-r--r-- | gfx.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -9,6 +9,7 @@ #include "string.h" #include "gfx.h" #include "table/palettes.h" +#include "table/sprites.h" #include "hal.h" #include "variables.h" @@ -661,14 +662,14 @@ int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw void DrawSprite(uint32 img, int x, int y) { - if (img & 0x8000) { - _color_remap_ptr = GetNonSprite(img >> 16) + 1; - GfxMainBlitter(GetSprite(img & 0x3FFF), x, y, 1); - } else if (img & 0x4000) { - _color_remap_ptr = GetNonSprite(img >> 16) + 1; - GfxMainBlitter(GetSprite(img & 0x3FFF), x, y, 2); + if (img & PALETTE_MODIFIER_COLOR) { + _color_remap_ptr = GetNonSprite(GB(img, PALETTE_SPRITE_START, PALETTE_SPRITE_WIDTH)) + 1; + GfxMainBlitter(GetSprite(img & SPRITE_MASK), x, y, 1); + } else if (img & PALETTE_MODIFIER_TRANSPARENT) { + _color_remap_ptr = GetNonSprite(GB(img, PALETTE_SPRITE_START, PALETTE_SPRITE_WIDTH)) + 1; + GfxMainBlitter(GetSprite(img & SPRITE_MASK), x, y, 2); } else { - GfxMainBlitter(GetSprite(img & 0x3FFF), x, y, 0); + GfxMainBlitter(GetSprite(img & SPRITE_MASK), x, y, 0); } } @@ -1923,7 +1924,7 @@ static void SetCursorSprite(CursorID cursor) if (cv->sprite == cursor) return; - p = GetSprite(cursor & 0x3FFF); + p = GetSprite(cursor & SPRITE_MASK); cv->sprite = cursor; cv->size.y = p->height; cv->size.x = p->width; |