12#if LEGACY_SPRITE_ENGINE
14#ifndef _SPRITE_ENG_LEGACY_H_
15#define _SPRITE_ENG_LEGACY_H_
27#define COLLISION_TYPE_NONE 0
32#define COLLISION_TYPE_BOX 1
37#define COLLISION_TYPE_CIRCLE 2
44#define SPR_FLAG_INSERT_HEAD 0x4000
51#define SPR_FLAG_DISABLE_ANIMATION_LOOP 0x2000
58#define SPR_FLAG_DISABLE_DELAYED_FRAME_UPDATE 0x0080
63#define SPR_FLAG_AUTO_VRAM_ALLOC 0x1000
68#define SPR_FLAG_AUTO_SPRITE_ALLOC 0x0800
73#define SPR_FLAG_AUTO_TILE_UPLOAD 0x0400
78#define SPR_FLAG_AUTO_VISIBILITY 0x0200
85#define SPR_FLAG_FAST_AUTO_VISIBILITY 0x0100
91#define SPR_FLAG_MASK (SPR_FLAG_INSERT_HEAD | SPR_FLAG_DISABLE_DELAYED_FRAME_UPDATE | SPR_FLAG_AUTO_VRAM_ALLOC | SPR_FLAG_AUTO_SPRITE_ALLOC | SPR_FLAG_AUTO_TILE_UPLOAD | SPR_FLAG_AUTO_VISIBILITY | SPR_FLAG_FAST_AUTO_VISIBILITY)
97#define SPR_MIN_DEPTH (-0x8000)
102#define SPR_MAX_DEPTH 0x7FFF
182 CircleCollision circle;
187 CircleCollision circle;
346 const SpriteDefinition* definition;
347 void (*onFrameChange)(
struct Sprite* sprite);
348 Animation* animation;
349 AnimationFrame* frame;
358 VDPSprite* lastVDPSprite;
382extern Pool* spritesPool;
386extern Sprite* firstSprite;
394extern u16 spriteVramSize;
725#define SPR_setPriorityAttribut(sprite, value) _Pragma("GCC error \"This method is deprecated, use SPR_setPriority(..) instead.\"")
880bool SPR_setSpriteTableIndex(
Sprite* sprite,
s16 value);
987#define SPR_setAlwaysVisible(sprite, value) _Pragma("GCC error \"This method is deprecated, use SPR_setVisibility(..) instead.\"")
991#define SPR_setNeverVisible(sprite, value) _Pragma("GCC error \"This method is deprecated, use SPR_setVisibility(..) instead.\"")
995#define SPR_computeVisibility(sprite) _Pragma("GCC error \"This method is deprecated, use SPR_isVisible(sprite, TRUE) instead.\"")
Palette support (herited from vdp_pal.h unit)
Pool object management unit.
void SPR_setPriority(Sprite *sprite, bool value)
Set sprite Priority attribut.
Definition sprite_eng.c:924
void SPR_setHFlip(Sprite *sprite, bool value)
Set sprite Horizontal Flip attribut.
Definition sprite_eng.c:830
void SPR_setVFlip(Sprite *sprite, bool value)
Set sprite Vertical Flip attribut.
Definition sprite_eng.c:877
void SPR_releaseSprite(Sprite *sprite)
Release the specified sprite (no more visible and release its resources).
Definition sprite_eng.c:480
bool SPR_setVRAMTileIndex(Sprite *sprite, s16 value)
Set the VRAM tile position reserved for this sprite.
Definition sprite_eng.c:1220
void SPR_init(void)
Initialize the Sprite engine with default parameters.
Definition sprite_eng.c:155
void SPR_defragVRAM(void)
Defragment allocated VRAM for sprites, that can help when sprite allocation fail (SPR_addSprite(....
Definition sprite_eng.c:542
void SPR_setAutoTileUpload(Sprite *sprite, bool value)
Enable/disable the automatic upload of sprite tiles data into VRAM.
Definition sprite_eng.c:1303
void SPR_setAnimationLoop(Sprite *sprite, bool value)
Enable/disable animation loop (default is on). When disable the sprite will stay on the last animati...
Definition sprite_eng.c:1196
bool SPR_isAnimationDone(Sprite *sprite)
Returns TRUE if the sprite reached the end of the current animation. When auto animation is enabled ...
Definition sprite_eng.c:1209
Sprite * SPR_addSpriteEx(const SpriteDefinition *spriteDef, s16 x, s16 y, u16 attribut, u16 flag)
Adds a new sprite with specified parameters and returns it.
Definition sprite_eng.c:329
void SPR_setAnim(Sprite *sprite, s16 anim)
Set current sprite animation.
Definition sprite_eng.c:1065
s16 SPR_getPositionX(Sprite *sprite)
Get sprite position X.
Definition sprite_eng.c:793
void SPR_logSprites(void)
Log the sprites informations (when enabled) in the KMod message window.
Definition sprite_eng.c:1716
void SPR_initEx(u16 vramSize)
Init the Sprite engine with specified advanced parameters (VRAM allocation size and decompression buf...
Definition sprite_eng.c:120
void SPR_setAutoAnimation(Sprite *sprite, bool value)
Enable/disable auto animation for the current animation (default is on).
Definition sprite_eng.c:1166
void SPR_setVisibility(Sprite *sprite, SpriteVisibility value)
Set the visibility state for this sprite.
Definition sprite_eng.c:1366
void SPR_setFrame(Sprite *sprite, s16 frame)
Set current sprite frame.
Definition sprite_eng.c:1101
s16 SPR_getPositionY(Sprite *sprite)
Get sprite position Y.
Definition sprite_eng.c:798
void SPR_setFrameChangeCallback(Sprite *sprite, FrameChangeCallback *callback)
Set the frame change event callback for this sprite.
Definition sprite_eng.c:1321
void SPR_update(void)
Update and display the active list of sprite.
Definition sprite_eng.c:1451
void SPR_setAnimAndFrame(Sprite *sprite, s16 anim, s16 frame)
Set current sprite animation and frame.
Definition sprite_eng.c:1020
void FrameChangeCallback(Sprite *sprite)
Sprite frame change event callback.
Definition sprite_eng.h:359
Sprite * SPR_addSpriteSafe(const SpriteDefinition *spriteDef, s16 x, s16 y, u16 attribut)
Adds a new sprite with auto resource allocation enabled and returns it.
Definition sprite_eng.c:464
void SPR_logProfil(void)
Log the profil informations (when enabled) in the KMod message window.
Definition sprite_eng.c:1696
void SPR_setAlwaysOnTop(Sprite *sprite)
Set sprite depth so it remains above others sprite - same as SPR_setDepth(SPR_MIN_DEPTH)
Definition sprite_eng.c:1010
SpriteVisibility
Sprite visibility enumeration.
Definition sprite_eng.h:104
@ HIDDEN
Definition sprite_eng.h:106
@ AUTO_FAST
Definition sprite_eng.h:107
@ AUTO_SLOW
Definition sprite_eng.h:108
@ VISIBLE
Definition sprite_eng.h:105
u16 SPR_getNumActiveSprite(void)
Returns the number of active sprite (number of sprite added with SPR_addSprite(..) or SPR_addSpriteEx...
Definition sprite_eng.c:511
void SPR_clear(void)
Clear all displayed sprites.
Definition sprite_eng.c:1434
bool SPR_isInitialized(void)
FALSE if sprite cache engine is not initialized, TRUE otherwise.
Definition sprite_eng.c:190
Sprite * SPR_addSprite(const SpriteDefinition *spriteDef, s16 x, s16 y, u16 attribut)
Adds a new sprite with auto resource allocation enabled and returns it.
Definition sprite_eng.c:443
void SPR_nextFrame(Sprite *sprite)
Pass to the next sprite frame.
Definition sprite_eng.c:1134
u16 ** SPR_loadAllFrames(const SpriteDefinition *sprDef, u16 index, u16 *totalNumTile)
Load all frames of SpriteDefinition (using DMA) at specified VRAM tile index and return the indexes t...
Definition sprite_eng.c:610
void SPR_setZ(Sprite *sprite, s16 value)
Same as SPR_setDepth(..)
Definition sprite_eng.c:1005
void SPR_setPalette(Sprite *sprite, u16 value)
Set sprite Palette index to use.
Definition sprite_eng.c:961
struct Sprite Sprite
Sprite structure used by the Sprite Engine to store state for a sprite. WARNING: always use the SPR_...
void SPR_setDelayedFrameUpdate(Sprite *sprite, bool value)
Enable/disable the delayed frame update.
Definition sprite_eng.c:1312
bool SPR_setDefinition(Sprite *sprite, const SpriteDefinition *spriteDef)
Set the Sprite Definition.
Definition sprite_eng.c:702
Sprite * SPR_addSpriteExSafe(const SpriteDefinition *spriteDef, s16 x, s16 y, u16 attribut, u16 flag)
Adds a new sprite with specified parameters and returns it.
Definition sprite_eng.c:448
void SPR_setAlwaysAtBottom(Sprite *sprite)
Set sprite depth so it remains behind others sprite - same as SPR_setDepth(SPR_MAX_DEPTH)
Definition sprite_eng.c:1015
void SPR_setDepth(Sprite *sprite, s16 value)
Set sprite depth (for sprite display ordering)
Definition sprite_eng.c:983
void SPR_setPosition(Sprite *sprite, s16 x, s16 y)
Set sprite position.
Definition sprite_eng.c:803
SpriteVisibility SPR_getVisibility(Sprite *sprite)
Return the visibility state for this sprite. WARNING: this is different from SPR_isVisible(....
Definition sprite_eng.c:1329
void SPR_reset(void)
Reset the Sprite engine.
Definition sprite_eng.c:195
bool SPR_isVisible(Sprite *sprite, bool recompute)
Return the visible state for this sprite (meaningful only if AUTO visibility is enabled,...
Definition sprite_eng.c:1343
bool SPR_getAutoAnimation(Sprite *sprite)
Return TRUE if auto animation is enabled, FALSE otherwise.
Definition sprite_eng.c:1188
void SPR_end(void)
End the Sprite engine.
Definition sprite_eng.c:160
Definition sprite_eng.h:171
Sprite animation frame structure.
Definition sprite_eng.h:230
Sprite animation structure.
Definition sprite_eng.h:250
Simple Box structure for collision.
Definition sprite_eng.h:125
Simple Circle structure (can be used for collision detection)
Definition sprite_eng.h:144
Collision definition union.
Single VDP sprite info structure for sprite animation frame.
Definition sprite_eng.h:204
Palette structure contains color data.
Definition pal.h:73
Object pool allocator structure.
Definition pool.h:57
Sprite definition structure.
Definition sprite_eng.h:278
Sprite structure used by the Sprite Engine to store state for a sprite. WARNING: always use the SPR_...
Definition sprite_eng.h:329
Tile set structure which contains tiles definition. Use the unpackTileSet() method to unpack if comp...
Definition vdp_tile.h:114
unsigned long u32
Definition types.h:105
short s16
Definition types.h:84
char s8
Definition types.h:79
unsigned short u16
Definition types.h:100
unsigned char u8
Definition types.h:95
VDP General Tile / Tilemap operations.