summaryrefslogtreecommitdiff
path: root/spritecache.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-08 22:22:42 +0000
committertron <tron@openttd.org>2005-02-08 22:22:42 +0000
commit092e72d60db91b631099d1844eba1b909e279756 (patch)
tree73dd253044f97e09dbf5a1fb4d5e7cbd51f0eb5d /spritecache.c
parent297223cc218895c2e8c2455b6ea35d00f78ee47c (diff)
downloadopenttd-092e72d60db91b631099d1844eba1b909e279756.tar.xz
(svn r1852) Start cleaning up sprite handling:
- Complement the sprite header struct with a variable sized array for the sprite data and rename it to Sprite. - Use the correct type Sprite* instead of casting all the time (this causes some "assignment from incompatible pointer type" warnings, nothing serious, will be resolved soon)
Diffstat (limited to 'spritecache.c')
-rw-r--r--spritecache.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/spritecache.c b/spritecache.c
index e15af9ada..75ded63a4 100644
--- a/spritecache.c
+++ b/spritecache.c
@@ -26,7 +26,7 @@ static const char *_cur_grffile;
static int _loading_stage;
static int _skip_specials;
uint16 _custom_sprites_base;
-static SpriteHdr _cur_sprite;
+static Sprite _cur_sprite;
static byte *_sprite_ptr[NUM_SPRITES];
@@ -982,7 +982,7 @@ const SpriteDimension *GetSpriteDimension(uint sprite)
SpriteDimension *sd;
#ifndef WANT_SPRITESIZES
- byte *p;
+ const Sprite* p;
p = _sprite_ptr[sprite];
if (p == NULL)
@@ -990,10 +990,10 @@ const SpriteDimension *GetSpriteDimension(uint sprite)
/* decode sprite header */
sd = &sd_static;
- sd->xoffs = (int16)READ_LE_UINT16(&((SpriteHdr*)p)->x_offs);
- sd->yoffs = (int16)READ_LE_UINT16(&((SpriteHdr*)p)->y_offs);
- sd->xsize = READ_LE_UINT16(&((SpriteHdr*)p)->width);
- sd->ysize = ((SpriteHdr*)p)->height;
+ sd->xoffs = (int16)TO_LE16(p->x_offs);
+ sd->yoffs = (int16)TO_LE16(p->y_offs);
+ sd->xsize = TO_LE16(p->width);
+ sd->ysize = p->height;
#else
sd = &sd_static;
sd->xoffs = _sprite_xoffs[sprite];