1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-14 01:59:09 +00:00

(svn r2845) Remove sprite size caching, it was unused

This makes GetSpriteDimension() superflous, because now it's just a thin wrapper around GetSprite() returning only part of the information, therefore remove it too
This commit is contained in:
tron
2005-08-08 21:35:27 +00:00
parent b67af2df3e
commit e42b560049
4 changed files with 16 additions and 72 deletions

View File

@@ -15,8 +15,6 @@
#define SPRITE_CACHE_SIZE 1024*1024
//#define WANT_SPRITESIZES
#define WANT_NEW_LRU
@@ -44,13 +42,6 @@ static uint16 _sprite_lru[MAX_SPRITES];
static uint16 _sprite_lru_cur[MAX_SPRITES];
#endif
#ifdef WANT_SPRITESIZES
static int8 _sprite_xoffs[MAX_SPRITES];
static int8 _sprite_yoffs[MAX_SPRITES];
static uint16 _sprite_xsize[MAX_SPRITES];
static uint8 _sprite_ysize[MAX_SPRITES];
#endif
typedef struct MemBlock {
uint32 size;
byte data[VARARRAY_SIZE];
@@ -116,14 +107,7 @@ static void ReadSpriteHeaderSkipData(int num, int load_index)
return;
}
#ifdef WANT_SPRITESIZES
_cur_sprite.height = FioReadByte();
_cur_sprite.width = FioReadWord();
_cur_sprite.x_offs = FioReadWord();
_cur_sprite.y_offs = FioReadWord();
#else
FioSkipBytes(7);
#endif
num -= 8;
if (num == 0)
return;
@@ -253,14 +237,6 @@ static bool LoadNextSprite(int load_index, byte file_index)
_sprite_size[load_index] = size;
_sprite_file_pos[load_index] = file_pos;
#ifdef WANT_SPRITESIZES
_sprite_xsize[load_index] = _cur_sprite.width;
_sprite_ysize[load_index] = _cur_sprite.height;
_sprite_xoffs[load_index] = _cur_sprite.x_offs;
_sprite_yoffs[load_index] = _cur_sprite.y_offs;
#endif
_sprite_ptr[load_index] = NULL;
#if defined(WANT_NEW_LRU)
@@ -853,27 +829,3 @@ void GfxLoadSprites(void)
GfxInitPalettes();
}
}
const SpriteDimension *GetSpriteDimension(SpriteID sprite)
{
static SpriteDimension sd;
#ifdef WANT_SPRITESIZES
sd.xoffs = _sprite_xoffs[sprite];
sd.yoffs = _sprite_yoffs[sprite];
sd.xsize = _sprite_xsize[sprite];
sd.ysize = _sprite_ysize[sprite];
#else
const Sprite* p = GetSprite(sprite);
/* decode sprite header */
sd.xoffs = p->x_offs;
sd.yoffs = p->y_offs;
sd.xsize = p->width;
sd.ysize = p->height;
#endif
return &sd;
}