@@ -69,12 +69,41 @@ struct MemBlock {
static uint _sprite_lru_counter;
static MemBlock *_spritecache_ptr;
static int _compact_cache_counter;
static void CompactSpriteCache();
/**
* Skip the given amount of sprite graphics data.
* @param type the type of sprite (compressed etc)
* @param num the amount of sprites to skip
*/
void SkipSpriteData(byte type, uint16 num)
{
if (type & 2) {
FioSkipBytes(num);
} else {
while (num > 0) {
int8 i = FioReadByte();
if (i >= 0) {
i = (i == 0) ? 0x80 : i;
num -= i;
FioSkipBytes(i);
i = -(i >> 3);
FioReadByte();
}
* Read the sprite header data and then skip the real payload.
* @return true if the sprite is a pseudo sprite.
static bool ReadSpriteHeaderSkipData()
uint16 num = FioReadWord();
byte type;
if (num == 0) return false;
@@ -85,30 +114,13 @@ static bool ReadSpriteHeaderSkipData()
/* Some NewGRF files have "empty" pseudo-sprites which are 1
* byte long. Catch these so the sprites won't be displayed. */
return num != 1;
FioSkipBytes(7);
num -= 8;
if (num == 0) return true;
SkipSpriteData(type, num - 8);
return true;
/* Check if the given Sprite ID exists */
bool SpriteExists(SpriteID id)