2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file spritecache.h Functions to cache sprites in memory. */
|
2007-04-04 01:35:16 +00:00
|
|
|
|
2005-02-10 05:43:30 +00:00
|
|
|
#ifndef SPRITECACHE_H
|
|
|
|
#define SPRITECACHE_H
|
|
|
|
|
2007-12-23 10:56:02 +00:00
|
|
|
#include "gfx_type.h"
|
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
struct Sprite {
|
2005-02-10 12:14:38 +00:00
|
|
|
byte height;
|
2005-02-11 15:18:09 +00:00
|
|
|
uint16 width;
|
|
|
|
int16 x_offs;
|
|
|
|
int16 y_offs;
|
2009-06-01 11:49:46 +00:00
|
|
|
byte data[];
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2005-02-10 12:14:38 +00:00
|
|
|
|
2007-06-05 10:40:29 +00:00
|
|
|
extern uint _sprite_cache_size;
|
|
|
|
|
2009-05-24 20:29:04 +00:00
|
|
|
void *GetRawSprite(SpriteID sprite, SpriteType type);
|
2006-04-16 11:26:23 +00:00
|
|
|
bool SpriteExists(SpriteID sprite);
|
2005-02-13 08:12:03 +00:00
|
|
|
|
2008-09-02 15:20:38 +00:00
|
|
|
static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type)
|
2005-02-13 08:12:03 +00:00
|
|
|
{
|
2008-09-02 15:20:38 +00:00
|
|
|
assert(type != ST_RECOLOUR);
|
|
|
|
return (Sprite*)GetRawSprite(sprite, type);
|
2005-02-13 08:12:03 +00:00
|
|
|
}
|
|
|
|
|
2008-09-02 15:20:38 +00:00
|
|
|
static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
|
2005-02-13 08:12:03 +00:00
|
|
|
{
|
2008-09-02 15:20:38 +00:00
|
|
|
assert(type == ST_RECOLOUR);
|
|
|
|
return (byte*)GetRawSprite(sprite, type);
|
2005-02-13 08:12:03 +00:00
|
|
|
}
|
2005-02-10 05:43:30 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void GfxInitSpriteMem();
|
|
|
|
void IncreaseSpriteLRU();
|
2005-02-10 05:43:30 +00:00
|
|
|
|
2007-06-14 14:31:48 +00:00
|
|
|
bool LoadNextSprite(int load_index, byte file_index, uint file_sprite_id);
|
2007-01-10 18:56:51 +00:00
|
|
|
void DupSprite(SpriteID old_spr, SpriteID new_spr);
|
2005-08-14 18:10:18 +00:00
|
|
|
|
2005-09-18 20:56:44 +00:00
|
|
|
#endif /* SPRITECACHE_H */
|