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
00017 struct Sprite {
00018 uint16 height;
00019 uint16 width;
00020 int16 x_offs;
00021 int16 y_offs;
00022 byte data[];
00023 };
00024
00025 extern uint _sprite_cache_size;
00026
00027 typedef void *AllocatorProc(size_t size);
00028
00029 void *GetRawSprite(SpriteID sprite, SpriteType type, AllocatorProc *allocator = NULL);
00030 bool SpriteExists(SpriteID sprite);
00031
00032 SpriteType GetSpriteType(SpriteID sprite);
00033 uint GetOriginFileSlot(SpriteID sprite);
00034 uint GetMaxSpriteID();
00035
00036
00037 static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type)
00038 {
00039 assert(type != ST_RECOLOUR);
00040 return (Sprite*)GetRawSprite(sprite, type);
00041 }
00042
00043 static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
00044 {
00045 assert(type == ST_RECOLOUR);
00046 return (byte*)GetRawSprite(sprite, type);
00047 }
00048
00049 void GfxInitSpriteMem();
00050 void IncreaseSpriteLRU();
00051
00052 bool LoadNextSprite(int load_index, byte file_index, uint file_sprite_id);
00053 bool SkipSpriteData(byte type, uint16 num);
00054 void DupSprite(SpriteID old_spr, SpriteID new_spr);
00055
00056 #endif