spritecache.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef SPRITECACHE_H
00013 #define SPRITECACHE_H
00014
00015 #include "gfx_type.h"
00016
00018 struct Sprite {
00019 byte height;
00020 uint16 width;
00021 int16 x_offs;
00022 int16 y_offs;
00023 byte data[];
00024 };
00025
00026 extern uint _sprite_cache_size;
00027
00028 typedef void *AllocatorProc(size_t size);
00029
00030 void *GetRawSprite(SpriteID sprite, SpriteType type, AllocatorProc *allocator = NULL);
00031 bool SpriteExists(SpriteID sprite);
00032
00033 SpriteType GetSpriteType(SpriteID sprite);
00034 uint GetOriginFileSlot(SpriteID sprite);
00035 uint GetMaxSpriteID();
00036
00037
00038 static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type)
00039 {
00040 assert(type != ST_RECOLOUR);
00041 return (Sprite*)GetRawSprite(sprite, type);
00042 }
00043
00044 static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
00045 {
00046 assert(type == ST_RECOLOUR);
00047 return (byte*)GetRawSprite(sprite, type);
00048 }
00049
00050 void GfxInitSpriteMem();
00051 void IncreaseSpriteLRU();
00052
00053 bool LoadNextSprite(int load_index, byte file_index, uint file_sprite_id);
00054 bool SkipSpriteData(byte type, uint16 num);
00055 void DupSprite(SpriteID old_spr, SpriteID new_spr);
00056
00057 #endif