spritecache.h

Go to the documentation of this file.
00001 /* $Id: spritecache.h 14223 2008-09-02 15:20:38Z rubidium $ */
00002 
00005 #ifndef SPRITECACHE_H
00006 #define SPRITECACHE_H
00007 
00008 #include "gfx_type.h"
00009 
00010 struct Sprite {
00011   byte height;
00012   uint16 width;
00013   int16 x_offs;
00014   int16 y_offs;
00015   byte data[VARARRAY_SIZE];
00016 };
00017 
00018 extern uint _sprite_cache_size;
00019 
00020 const void *GetRawSprite(SpriteID sprite, SpriteType type);
00021 bool SpriteExists(SpriteID sprite);
00022 
00023 static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type)
00024 {
00025   assert(type != ST_RECOLOUR);
00026   return (Sprite*)GetRawSprite(sprite, type);
00027 }
00028 
00029 static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
00030 {
00031   assert(type == ST_RECOLOUR);
00032   return (byte*)GetRawSprite(sprite, type);
00033 }
00034 
00035 void GfxInitSpriteMem();
00036 void IncreaseSpriteLRU();
00037 
00038 bool LoadNextSprite(int load_index, byte file_index, uint file_sprite_id);
00039 void DupSprite(SpriteID old_spr, SpriteID new_spr);
00040 
00041 #endif /* SPRITECACHE_H */

Generated on Mon Mar 23 00:25:22 2009 for OpenTTD by  doxygen 1.5.6