#include "stdafx.h"
#include "gfx_type.h"
#include "fileio_func.h"
#include "spriteloader/grf.hpp"
#include "core/alloc_func.hpp"
#include "gfx_func.h"
#include "blitter/factory.hpp"
#include "core/math_func.hpp"
#include "table/sprites.h"
Go to the source code of this file.
Data Structures | |
| struct | SpriteCache |
| struct | MemBlock |
Defines | |
| #define | S_FREE_MASK 1 |
Typedefs | |
|
typedef SimpleTinyEnumT < SpriteType, byte > | SpriteTypeByte |
Functions | |
| static SpriteCache * | GetSpriteCache (uint index) |
| static bool | IsMapgenSpriteID (SpriteID sprite) |
| static SpriteCache * | AllocateSpriteCache (uint index) |
| static void | CompactSpriteCache () |
| Called when holes in the sprite cache should be removed. | |
| bool | SkipSpriteData (byte type, uint16 num) |
| Skip the given amount of sprite graphics data. | |
| static SpriteType | ReadSpriteHeaderSkipData () |
| Read the sprite header data and then skip the real payload. | |
| bool | SpriteExists (SpriteID id) |
| void * | AllocSprite (size_t) |
| static void * | ReadSprite (SpriteCache *sc, SpriteID id, SpriteType sprite_type) |
| bool | LoadNextSprite (int load_index, byte file_slot, uint file_sprite_id) |
| void | DupSprite (SpriteID old_spr, SpriteID new_spr) |
| static MemBlock * | NextBlock (MemBlock *block) |
| static size_t | GetSpriteCacheUsage () |
| void | IncreaseSpriteLRU () |
| static void | DeleteEntryFromSpriteCache () |
| static const void * | HandleInvalidSpriteRequest (SpriteID sprite, SpriteType requested, SpriteCache *sc) |
| Handles the case when a sprite of different type is requested than is present in the SpriteCache. | |
| const void * | GetRawSprite (SpriteID sprite, SpriteType type) |
| void | GfxInitSpriteMem () |
Variables | |
| uint | _sprite_cache_size = 4 |
| static uint | _spritecache_items = 0 |
| static SpriteCache * | _spritecache = NULL |
| static uint | _sprite_lru_counter |
| static MemBlock * | _spritecache_ptr |
| static int | _compact_cache_counter |
Definition in file spritecache.cpp.
| static void CompactSpriteCache | ( | ) | [static] |
Called when holes in the sprite cache should be removed.
That is accomplished by moving the cached data.
Definition at line 360 of file spritecache.cpp.
| static const void* HandleInvalidSpriteRequest | ( | SpriteID | sprite, | |
| SpriteType | requested, | |||
| SpriteCache * | sc | |||
| ) | [static] |
Handles the case when a sprite of different type is requested than is present in the SpriteCache.
For ST_FONT sprites, it is normal. In other cases, default sprite is loaded instead.
| sprite | ID of loaded sprite | |
| requested | requested sprite type | |
| available | available sprite type |
Definition at line 482 of file spritecache.cpp.
References ST_FONT, ST_MAPGEN, ST_NORMAL, ST_RECOLOUR, and usererror().
| static SpriteType ReadSpriteHeaderSkipData | ( | ) | [static] |
Read the sprite header data and then skip the real payload.
Definition at line 111 of file spritecache.cpp.
References SkipSpriteData(), ST_INVALID, ST_NORMAL, and ST_RECOLOUR.
| bool SkipSpriteData | ( | byte | type, | |
| uint16 | num | |||
| ) |
Skip the given amount of sprite graphics data.
| type | the type of sprite (compressed etc) | |
| num | the amount of sprites to skip |
Definition at line 85 of file spritecache.cpp.
Referenced by ReadSpriteHeaderSkipData().
1.5.6