src/spritecache.h
author translators
Sat, 13 Dec 2008 18:45:37 +0000
changeset 10420 553508015907
parent 10056 48659f7d4fa5
permissions -rw-r--r--
(svn r14673) -Update: WebTranslator2 update to 2008-12-13 18:45:31
arabic_egypt - 230 fixed by khaloofah (230)
indonesian - 2 fixed by Gonrong (2)
italian - 1 changed by lorenzodv (1)
portuguese - 12 fixed by SnowFlake (7), rmrebelo (5)
thai - 32 fixed by vetbook (32)
/* $Id$ */

/** @file spritecache.h Functions to cache sprites in memory. */

#ifndef SPRITECACHE_H
#define SPRITECACHE_H

#include "gfx_type.h"

struct Sprite {
	byte height;
	uint16 width;
	int16 x_offs;
	int16 y_offs;
	byte data[VARARRAY_SIZE];
};

extern uint _sprite_cache_size;

const void *GetRawSprite(SpriteID sprite, SpriteType type);
bool SpriteExists(SpriteID sprite);

static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type)
{
	assert(type != ST_RECOLOUR);
	return (Sprite*)GetRawSprite(sprite, type);
}

static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
{
	assert(type == ST_RECOLOUR);
	return (byte*)GetRawSprite(sprite, type);
}

void GfxInitSpriteMem();
void IncreaseSpriteLRU();

bool LoadNextSprite(int load_index, byte file_index, uint file_sprite_id);
void DupSprite(SpriteID old_spr, SpriteID new_spr);

#endif /* SPRITECACHE_H */