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)
51 #define OBJ_SPRITE32 1
52 #define OBJ_SPRITE16 2
131 #define REG_OBSEL (*(vuint8 *)0x2101)
151 #define REG_OAMADDL (*(vuint8 *)0x2102)
152 #define REG_OAMADDH (*(vuint8 *)0x2103)
158 #define REG_OAMDATA (*(vuint8 *)0x2104)
159 #define REG_RDOAM (*(vuint8 *)0x2138)
183 void oamSetAttr(u16
id, u16 xspr, u16 yspr, u16 gfxoffset, u8 attr);
192 #define OAM_ATTR(priority, hflip, vflip, gfxoffset, paletteoffset) ((vflip << 7) | (hflip << 6) | (priority << 4) | (paletteoffset << 1) | ((gfxoffset >> 8) & 1))
204 void oamSet(u16
id, u16 xspr, u16 yspr, u8 priority, u8 hflip, u8 vflip, u16 gfxoffset, u8 paletteoffset);
216 #define oamGetX(id) (oamMemory[id + 0])
221 #define oamGetY(id) (oamMemory[id + 1])
259 void oamInitGfxSet(u8 *tileSource, u16 tileSize, u8 *tilePalette, u16 paletteSize, u8 tilePaletteNumber, u16 address, u8 oamsize);
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 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 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 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 oamInitDynamicSpriteEndFrame(void)
Must be call at the end of the frame, initialize the dynamic sprite engine for the next frame.
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 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:59
u16 oamframeid
4 frame index in graphic file of the sprite
Definition: sprite.h:62
s16 oamx
0 x position on the screen
Definition: sprite.h:60
u8 * oamgraphics
8..11 pointer to graphic file
Definition: sprite.h:65
s16 oamy
2 y position on the screen
Definition: sprite.h:61
u8 oamattribute
6 sprite attribute value (vhoopppc v : vertical flip h: horizontal flip o: priority bits p: palette n...
Definition: sprite.h:63
u8 oamrefresh
7 =1 if we need to load graphics from graphic file
Definition: sprite.h:64
u16 dummy1
12..15 to be 16 aligned
Definition: sprite.h:66