spritecache.h
author tron
Fri, 29 Jul 2005 18:22:04 +0000
changeset 2230 e461b07aead7
parent 2186 db48cf29b983
child 2309 c48687a02a6c
permissions -rw-r--r--
(svn r2750) -Fix: Tree tiles above the snow line got redrawn disproportionately often
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2123
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2123
diff changeset
     2
1349
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
     3
#ifndef SPRITECACHE_H
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
     4
#define SPRITECACHE_H
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
     5
1350
fd0136012af1 (svn r1854) Split GetSpritePtr() into GetSprite() for regular sprites (returning a Sprite*) and GetNonSprite() for "sprites" of type 0xFF (returning byte*)
tron
parents: 1349
diff changeset
     6
typedef struct Sprite {
fd0136012af1 (svn r1854) Split GetSpritePtr() into GetSprite() for regular sprites (returning a Sprite*) and GetNonSprite() for "sprites" of type 0xFF (returning byte*)
tron
parents: 1349
diff changeset
     7
	byte info;
fd0136012af1 (svn r1854) Split GetSpritePtr() into GetSprite() for regular sprites (returning a Sprite*) and GetNonSprite() for "sprites" of type 0xFF (returning byte*)
tron
parents: 1349
diff changeset
     8
	byte height;
1356
fd5b13fafff3 (svn r1860) The sprite header endianness issue was solved in r1855
tron
parents: 1352
diff changeset
     9
	uint16 width;
fd5b13fafff3 (svn r1860) The sprite header endianness issue was solved in r1855
tron
parents: 1352
diff changeset
    10
	int16 x_offs;
fd5b13fafff3 (svn r1860) The sprite header endianness issue was solved in r1855
tron
parents: 1352
diff changeset
    11
	int16 y_offs;
1350
fd0136012af1 (svn r1854) Split GetSpritePtr() into GetSprite() for regular sprites (returning a Sprite*) and GetNonSprite() for "sprites" of type 0xFF (returning byte*)
tron
parents: 1349
diff changeset
    12
	byte data[VARARRAY_SIZE];
fd0136012af1 (svn r1854) Split GetSpritePtr() into GetSprite() for regular sprites (returning a Sprite*) and GetNonSprite() for "sprites" of type 0xFF (returning byte*)
tron
parents: 1349
diff changeset
    13
} Sprite;
fd0136012af1 (svn r1854) Split GetSpritePtr() into GetSprite() for regular sprites (returning a Sprite*) and GetNonSprite() for "sprites" of type 0xFF (returning byte*)
tron
parents: 1349
diff changeset
    14
1349
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    15
typedef struct {
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    16
	int xoffs, yoffs;
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    17
	int xsize, ysize;
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    18
} SpriteDimension;
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    19
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    20
const SpriteDimension *GetSpriteDimension(SpriteID sprite);
1361
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    21
const void *GetRawSprite(SpriteID sprite);
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    22
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    23
static inline const Sprite *GetSprite(SpriteID sprite)
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    24
{
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    25
	return GetRawSprite(sprite);
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    26
}
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    27
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    28
static inline const byte *GetNonSprite(SpriteID sprite)
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    29
{
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    30
	return GetRawSprite(sprite);
5833194df433 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    31
}
1349
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    32
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    33
void GfxLoadSprites(void);
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    34
void IncreaseSpriteLRU(void);
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    35
2123
146517a6e3aa (svn r2633) Move spritecache related variable from variables.h to spritecache.[ch]
tron
parents: 2014
diff changeset
    36
extern bool _cache_sprites;
146517a6e3aa (svn r2633) Move spritecache related variable from variables.h to spritecache.[ch]
tron
parents: 2014
diff changeset
    37
1349
15979a2e9001 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    38
#endif