GBDK 2020 Docs API Documentation for GBDK 2020

metasprites.h
Go to the documentation of this file.
1 #ifndef _METASPRITES_H_INCLUDE
2 #define _METASPRITES_H_INCLUDE
3
7 typedef struct metasprite_t {
8 INT8 dy, dx;
9 UINT8 dtile;
10 UINT8 props;
11 } metasprite_t;
12
13 #define metasprite_end -128
14
15 extern const void * __current_metasprite;
16 extern UBYTE __current_base_tile;
17 extern UBYTE __render_shadow_OAM;
18
19 static UBYTE __move_metasprite(UINT8 id, UINT8 x, UINT8 y);
20 static UBYTE __move_metasprite_vflip(UINT8 id, UINT8 x, UINT8 y);
21 static UBYTE __move_metasprite_hflip(UINT8 id, UINT8 x, UINT8 y);
22 static UBYTE __move_metasprite_hvflip(UINT8 id, UINT8 x, UINT8 y);
23 static void __hide_metasprite(UINT8 id);
24
34 inline UBYTE move_metasprite(const metasprite_t * metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y) {
35 __current_metasprite = metasprite;
36 __current_base_tile = base_tile;
37 return __move_metasprite(base_sprite, x, y);
38 }
39
40 inline UBYTE move_metasprite_vflip(const metasprite_t * metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y) {
41 __current_metasprite = metasprite;
42 __current_base_tile = base_tile;
43 return __move_metasprite_vflip(base_sprite, x - 8, y);
44 }
45
46 inline UBYTE move_metasprite_hflip(const metasprite_t * metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y) {
47 __current_metasprite = metasprite;
48 __current_base_tile = base_tile;
49 return __move_metasprite_hflip(base_sprite, x, y - ((LCDC_REG & 0x04U) ? 16 : 8) );
50 }
51
52 inline UBYTE move_metasprite_hvflip(const metasprite_t * metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y) {
53 __current_metasprite = metasprite;
54 __current_base_tile = base_tile;
55 return __move_metasprite_hvflip(base_sprite, x - 8, y - ((LCDC_REG & 0x04U) ? 16 : 8));
56 }
57
63 inline void hide_metasprite(const metasprite_t * metasprite, UINT8 base_sprite) {
64 __current_metasprite = metasprite;
65 __hide_metasprite(base_sprite);
66 }
67
68 #endif
metasprite_t::dx
INT8 dx
Definition: metasprites.h:8
UINT8
unsigned char UINT8
Definition: types.h:21
move_metasprite_hflip
UBYTE move_metasprite_hflip(const metasprite_t *metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y)
Definition: metasprites.h:46
move_metasprite
UBYTE move_metasprite(const metasprite_t *metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y)
Definition: metasprites.h:34
metasprite_t
Definition: metasprites.h:7
hide_metasprite
void hide_metasprite(const metasprite_t *metasprite, UINT8 base_sprite)
Definition: metasprites.h:63
__current_metasprite
const void * __current_metasprite
move_metasprite_vflip
UBYTE move_metasprite_vflip(const metasprite_t *metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y)
Definition: metasprites.h:40
UBYTE
UINT8 UBYTE
Definition: types.h:45
metasprite_t::dtile
UINT8 dtile
Definition: metasprites.h:9
__render_shadow_OAM
UBYTE __render_shadow_OAM
metasprite_t::dy
INT8 dy
Definition: metasprites.h:8
metasprite_t::props
UINT8 props
Definition: metasprites.h:10
metasprite_t
struct metasprite_t metasprite_t
move_metasprite_hvflip
UBYTE move_metasprite_hvflip(const metasprite_t *metasprite, UINT8 base_tile, UINT8 base_sprite, UINT8 x, UINT8 y)
Definition: metasprites.h:52
__current_base_tile
UBYTE __current_base_tile
INT8
signed char INT8
Definition: types.h:18
LCDC_REG
__REG LCDC_REG
Definition: hardware.h:43