spritecache.h

Go to the documentation of this file.
00001 /* $Id: spritecache.h 19723 2010-04-25 16:27:30Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
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 void *GetRawSprite(SpriteID sprite, SpriteType type);
00029 bool SpriteExists(SpriteID sprite);
00030 
00031 SpriteType GetSpriteType(SpriteID sprite);
00032 uint GetOriginFileSlot(SpriteID sprite);
00033 uint GetMaxSpriteID();
00034 
00035 
00036 static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type)
00037 {
00038   assert(type != ST_RECOLOUR);
00039   return (Sprite*)GetRawSprite(sprite, type);
00040 }
00041 
00042 static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type)
00043 {
00044   assert(type == ST_RECOLOUR);
00045   return (byte*)GetRawSprite(sprite, type);
00046 }
00047 
00048 void GfxInitSpriteMem();
00049 void IncreaseSpriteLRU();
00050 
00051 bool LoadNextSprite(int load_index, byte file_index, uint file_sprite_id);
00052 bool SkipSpriteData(byte type, uint16 num);
00053 void DupSprite(SpriteID old_spr, SpriteID new_spr);
00054 
00055 #endif /* SPRITECACHE_H */

Generated on Fri Dec 31 17:15:38 2010 for OpenTTD by  doxygen 1.6.1