summaryrefslogtreecommitdiff
path: root/viewport.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-07-24 15:56:31 +0000
committercelestar <celestar@openttd.org>2005-07-24 15:56:31 +0000
commit238e47cd42c009f2ab1359428788a65a26fafebb (patch)
treee02fce527cef08bc25354c995fecc8ddb0ab5318 /viewport.c
parenta227065ab75d6cb9f449f2282315adc933450b49 (diff)
downloadopenttd-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 'viewport.c')
-rw-r--r--viewport.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/viewport.c b/viewport.c
index 376296c1a..a7c82edf0 100644
--- a/viewport.c
+++ b/viewport.c
@@ -361,7 +361,7 @@ void DrawGroundSpriteAt(uint32 image, int32 x, int32 y, byte z)
ViewportDrawer *vd = _cur_vd;
TileSpriteToDraw *ts;
- assert((image & 0x3FFF) < NUM_SPRITES);
+ assert((image & SPRITE_MASK) < MAX_SPRITES);
if (vd->spritelist_mem >= vd->eof_spritelist_mem) {
DEBUG(misc, 0) ("Out of sprite mem");
@@ -403,7 +403,7 @@ static void AddCombinedSprite(uint32 image, int x, int y, byte z)
{
const ViewportDrawer *vd = _cur_vd;
Point pt = RemapCoords(x, y, z);
- const SpriteDimension *sd = GetSpriteDimension(image & 0x3FFF);
+ const SpriteDimension *sd = GetSpriteDimension(image & SPRITE_MASK);
if (pt.x + sd->xoffs >= vd->dpi.left + vd->dpi.width ||
pt.x + sd->xoffs + sd->xsize <= vd->dpi.left ||
@@ -422,7 +422,7 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
const SpriteDimension *sd;
Point pt;
- assert((image & 0x3FFF) < NUM_SPRITES);
+ assert((image & SPRITE_MASK) < MAX_SPRITES);
if (vd->combine_sprites == 2) {
AddCombinedSprite(image, x, y, z);
@@ -462,7 +462,7 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
pt = RemapCoords(x, y, z);
- sd = GetSpriteDimension(image & 0x3FFF);
+ sd = GetSpriteDimension(image & SPRITE_MASK);
if ((ps->left = (pt.x += sd->xoffs)) >= vd->dpi.left + vd->dpi.width ||
(ps->right = (pt.x + sd->xsize)) <= vd->dpi.left ||
(ps->top = (pt.y += sd->yoffs)) >= vd->dpi.top + vd->dpi.height ||
@@ -494,7 +494,7 @@ void AddChildSpriteScreen(uint32 image, int x, int y)
ViewportDrawer *vd = _cur_vd;
ChildScreenSpriteToDraw *cs;
- assert((image & 0x3FFF) < NUM_SPRITES);
+ assert((image & SPRITE_MASK) < MAX_SPRITES);
if (vd->spritelist_mem >= vd->eof_spritelist_mem) {
DEBUG(misc, 0) ("Out of sprite mem");