diff options
author | tron <tron@openttd.org> | 2005-02-11 13:46:25 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-02-11 13:46:25 +0000 |
commit | 5c946cdbd8efede26dc41515a0b105dda244093d (patch) | |
tree | e4a73529ba96127e4d818ecd674650007cb75114 | |
parent | 1b617b28fcfe377b9aa4eab88a4b8997b0477f7d (diff) | |
download | openttd-5c946cdbd8efede26dc41515a0b105dda244093d.tar.xz |
(svn r1858) Let ReadSprite() handle the subtleties of loading a sprite, not its caller
-rw-r--r-- | spritecache.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spritecache.c b/spritecache.c index fa308ba7f..a651e28a8 100644 --- a/spritecache.c +++ b/spritecache.c @@ -149,13 +149,16 @@ static void ReadSpriteHeaderSkipData(int num, int load_index) } } -static void ReadSprite(int num, byte *dest) +static void ReadSprite(SpriteID id, byte *dest) { + uint num = _sprite_size[id]; byte type; byte *rel; int8 i; int dist; + FioSeekToFile(_sprite_file_pos[id]); + type = FioReadByte(); /* We've decoded special sprites when reading headers. */ if (type != 0xFF) { @@ -163,6 +166,7 @@ static void ReadSprite(int num, byte *dest) Sprite* sprite = dest; sprite->info = type; sprite->height = FioReadByte(); + if (id == 142) sprite->height = 10; // Compensate for a TTD bug sprite->width = FioReadWord(); sprite->x_offs = FioReadWord(); sprite->y_offs = FioReadWord(); @@ -625,11 +629,7 @@ static byte *LoadSpriteToMem(int sprite) _sprite_ptr[sprite] = s->data; - FioSeekToFile(_sprite_file_pos[sprite]); - ReadSprite(_sprite_size[sprite], s->data); - - // Patch the height to compensate for a TTD bug? - if (sprite == 142) s->data[1] = 10; + ReadSprite(sprite, s->data); // Return sprite ptr return s->data; |