32#ifndef SNES_SPRITES_INCLUDE
33#define SNES_SPRITES_INCLUDE
37#define ATTR2_DISABLED (0xe8)
39#define OBJ_SIZE8_L16 (0 << 5)
40#define OBJ_SIZE8_L32 (1 << 5)
41#define OBJ_SIZE8_L64 (2 << 5)
42#define OBJ_SIZE16_L32 (3 << 5)
43#define OBJ_SIZE16_L64 (4 << 5)
44#define OBJ_SIZE32_L64 (5 << 5)
55#define OBJ_PAL(palofs) (palofs << 1)
56#define OBJ_FLIPX (0x40)
57#define OBJ_FLIPY (0x80)
58#define OBJ_PRIO(prio) (prio << 4)
110#define metasprite_end -128
111#define METASPR_ITEM(dx,dy,dt,a) {(dx),(dy),(dt),(a)}
112#define METASPR_TERM {metasprite_end}
165#define REG_OBSEL (*(vuint8 *)0x2101)
185#define REG_OAMADDL (*(vuint8 *)0x2102)
186#define REG_OAMADDH (*(vuint8 *)0x2103)
192#define REG_OAMDATA (*(vuint8 *)0x2104)
193#define REG_RDOAM (*(vuint8 *)0x2138)
217void oamSetAttr(u16
id, u16 xspr, u16 yspr, u16 gfxoffset, u8 attr);
226#define OAM_ATTR(priority, hflip, vflip, gfxoffset, paletteoffset) ((vflip << 7) | (hflip << 6) | (priority << 4) | (paletteoffset << 1) | ((gfxoffset >> 8) & 1))
238void oamSet(u16
id, u16 xspr, u16 yspr, u8 priority, u8 hflip, u8 vflip, u16 gfxoffset, u8 paletteoffset);
250#define oamGetX(id) (oamMemory[id + 0])
255#define oamGetY(id) (oamMemory[id + 1])
293void oamInitGfxSet(u8 *tileSource, u16 tileSize, u8 *tilePalette, u16 paletteSize, u8 tilePaletteNumber, u16 address, u8 oamsize);
427void oamMetaDraw16(u16
id, s16 x,s16 y, u8 *sprmeta,u16 sprsize, u16 ofsgfx);
Custom types used by libsnes.
void oamFix32Draw(u16 id)
Add a 32x32 sprite on screen. oambuffer[id] needs to be populate before. !
void oamClear(u16 first, u8 numEntries)
Hides the sprites in the supplied range: if count is zero all 128 sprites will be hidden.
t_sprites oambuffer[128]
Sprite Table (from no$sns help file) Contains data for 128 OBJs. OAM Size is 512+32 Bytes....
void oamInit(void)
Initializes the 2D sprite engine.
void oamMetaDrawDyn16(u16 id, s16 x, s16 y, u8 *sprmeta, u8 *gfxptr, u16 sprsize)
Add a Meta sprite on screen (can be composed only of 16x16 sprites). oambuffer[id] needs to be popula...
void oamSetVisible(u16 id, u8 hide)
Hide or show a sprite.
void oamSetEx(u16 id, u8 size, u8 hide)
Put the correct size and hide or show a sprite.
void oamInitGfxSet(u8 *tileSource, u16 tileSize, u8 *tilePalette, u16 paletteSize, u8 tilePaletteNumber, u16 address, u8 oamsize)
Initializes a sprites Gfx and Loads the GFX into VRAM.
void oamSetXY(u16 id, u16 xspr, u16 yspr)
sets an oam coordinate to the supplied values
void oamVramQueueUpdate(void)
Update VRAM graphics for sprites 32x32, 16x16 and 8x8 (can but call in Vblank if needed).
void oamDynamic8Draw(u16 id)
Add a 8x8 sprite on screen. oambuffer[id] needs to be populate before.
void oamInitDynamicSpriteScreen(void)
Init Dynamic sprite engine on a screen (can be useful if you do not want to refresh sprite each frame...
void oamMetaDrawDyn8(u16 id, s16 x, s16 y, u8 *sprmeta, u8 *gfxptr)
Add a Meta sprite on screen (can be composed only of 16x16 sprites). oambuffer[id] needs to be popula...
void oamDynamicMetaDraw(u16 id, s16 x, s16 y, u8 *sprmeta)
Add a Meta sprite on screen (can be composed of 8x8,16x16 or 32x32 sprites). oambuffer[id] needs to b...
u8 oamMemory[128 *4+8 *4]
to address oam table low and high
void oamUpdate(void)
Write all OBJ descriptors to OAM.
void oamSetAttr(u16 id, u16 xspr, u16 yspr, u16 gfxoffset, u8 attr)
sets an oam entry to the supplied values
void oamMetaDraw16(u16 id, s16 x, s16 y, u8 *sprmeta, u16 sprsize, u16 ofsgfx)
Add a Meta sprite on screen (can be composed only of 16x16 sprites). oambuffer[id] needs to be popula...
void oamSetGfxOffset(u16 id, u16 gfxoffset)
sets an oam graphic offset to the supplied values
void oamSet(u16 id, u16 xspr, u16 yspr, u8 priority, u8 hflip, u8 vflip, u16 gfxoffset, u8 paletteoffset)
sets an oam entry to the supplied values
void oamFix16Draw(u16 id)
Add a 16x16 sprite on screen. oambuffer[id] needs to be populate before. !
void oamMetaDraw32(u16 id, s16 x, s16 y, u8 *sprmeta, u16 ofsgfx)
Add a Meta sprite on screen (can be composed only of 16x16 sprites). oambuffer[id] needs to be popula...
void oamInitDynamicSpriteEndFrame(void)
Must be call at the end of the frame, initialize the dynamic sprite engine for the next frame.
void oamMetaDraw8(u16 id, s16 x, s16 y, u8 *sprmeta, u16 ofsgfx)
Add a Meta sprite on screen (can be composed only of 16x16 sprites). oambuffer[id] needs to be popula...
void oamInitGfxAttr(u16 address, u8 oamsize)
Initializes the default sprite size and address in VRAM.
void oamInitDynamicSprite(u16 gfxsp0adr, u16 gfxsp1adr, u16 oamsp0init, u16 oamsp1init, u8 oamsize)
initialize the dynamic sprite engine with each sprite size entries
void oamFix8Draw(u16 id)
Add a 8x8 sprite on screen. oambuffer[id] needs to be populate before. !
void oamDynamic16Draw(u16 id)
Add a 16x16 sprite on screen. oambuffer[id] needs to be populate before.
void oamMetaDrawDyn32(u16 id, s16 x, s16 y, u8 *sprmeta, u8 *gfxptr)
Add a Meta sprite on screen (can be composed only of 16x16 sprites). oambuffer[id] needs to be popula...
void oamFlip(u16 id, u8 xf, u8 yf)
sets an oam entry to the supplied values
void oamDynamic32Draw(u16 id)
Add a 32x32 sprite on screen. oambuffer[id] needs to be populate before.
Dynamic sprite definition (16 bytes)
Definition sprite.h:64
u16 oamframeid
4 frame index in graphic file of the sprite
Definition sprite.h:67
s16 oamx
0 x position on the screen
Definition sprite.h:65
u8 * oamgraphics
8..11 pointer to graphic file
Definition sprite.h:70
s16 oamy
2 y position on the screen
Definition sprite.h:66
u8 oamattribute
6 sprite attribute value (vhoopppc v : vertical flip h: horizontal flip o: priority bits p: palette n...
Definition sprite.h:68
u8 oamrefresh
7 =1 if we need to load graphics from graphic file
Definition sprite.h:69
u16 dummy1
12..15 to be 16 aligned
Definition sprite.h:71