src/spritecache.h
author translators
Wed, 03 Dec 2008 18:43:10 +0000
changeset 10401 867b5ace076f
parent 10056 48659f7d4fa5
permissions -rw-r--r--
(svn r14652) -Update: WebTranslator2 update to 2008-12-03 18:43:05
croatian - 28 changed by knovak (28)
indonesian - 64 fixed, 1 changed by fanioz (50), dnaftali (15)
macedonian - 10 fixed by zharko (10)
malay - 267 fixed, 3 changed by tombakemas (270)
serbian - 29 fixed by dejac (29)
/* $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 */