src/spritecache.h
author KUDr
Sat, 21 Apr 2007 08:23:57 +0000
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
child 9912 1ac8aac92385
permissions -rw-r--r--
(svn r9708) [cpp_gui] -Sync with trunk (r9633:9707)
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2123
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2123
diff changeset
     2
6307
f40e88cff863 (svn r9639) [cpp_gui] -Sync with trunk (r9476:9633)
KUDr
parents: 6298
diff changeset
     3
/** @file spritecache.h */
f40e88cff863 (svn r9639) [cpp_gui] -Sync with trunk (r9476:9633)
KUDr
parents: 6298
diff changeset
     4
1349
07514c2cc6d1 (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
#ifndef SPRITECACHE_H
07514c2cc6d1 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
     6
#define SPRITECACHE_H
07514c2cc6d1 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
     7
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 5838
diff changeset
     8
struct Sprite {
1350
067b22970f19 (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
     9
	byte info;
067b22970f19 (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
    10
	byte height;
1356
291c2802243f (svn r1860) The sprite header endianness issue was solved in r1855
tron
parents: 1352
diff changeset
    11
	uint16 width;
291c2802243f (svn r1860) The sprite header endianness issue was solved in r1855
tron
parents: 1352
diff changeset
    12
	int16 x_offs;
291c2802243f (svn r1860) The sprite header endianness issue was solved in r1855
tron
parents: 1352
diff changeset
    13
	int16 y_offs;
1350
067b22970f19 (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
	byte data[VARARRAY_SIZE];
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 5838
diff changeset
    15
};
1350
067b22970f19 (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
    16
1361
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    17
const void *GetRawSprite(SpriteID sprite);
3565
03d870cc3dcd (svn r4446) - Add function to determine if a Sprite ID exists.
peter1138
parents: 2436
diff changeset
    18
bool SpriteExists(SpriteID sprite);
1361
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    19
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    20
static inline const Sprite *GetSprite(SpriteID sprite)
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    21
{
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    22
	return (Sprite*)GetRawSprite(sprite);
1361
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    23
}
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    24
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    25
static inline const byte *GetNonSprite(SpriteID sprite)
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    26
{
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    27
	return (byte*)GetRawSprite(sprite);
1361
10d9b95e7a81 (svn r1865) Fix some warnings
tron
parents: 1357
diff changeset
    28
}
1349
07514c2cc6d1 (svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
diff changeset
    29
6298
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 5838
diff changeset
    30
void GfxInitSpriteMem();
c30fe89622df (svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents: 5838
diff changeset
    31
void IncreaseSpriteLRU();
1349
07514c2cc6d1 (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
2340
0a9f3eeccb96 (svn r2866) Move all functions and tables which aren't directly involved in managing the sprite heap to a new file gfxinit.c.
tron
parents: 2319
diff changeset
    33
bool LoadNextSprite(int load_index, byte file_index);
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    34
void DupSprite(SpriteID old_spr, SpriteID new_spr);
2340
0a9f3eeccb96 (svn r2866) Move all functions and tables which aren't directly involved in managing the sprite heap to a new file gfxinit.c.
tron
parents: 2319
diff changeset
    35
void SkipSprites(uint count);
0a9f3eeccb96 (svn r2866) Move all functions and tables which aren't directly involved in managing the sprite heap to a new file gfxinit.c.
tron
parents: 2319
diff changeset
    36
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2407
diff changeset
    37
#endif /* SPRITECACHE_H */