GBDK 2020 Docs  4.3.0
API Documentation for GBDK 2020
metasprites.h
Go to the documentation of this file.
1 
14 #ifndef _METASPRITES_H_INCLUDE
15 #define _METASPRITES_H_INCLUDE
16 
17 #include <msx/hardware.h>
18 #include <types.h>
19 #include <stdint.h>
20 
34 typedef struct metasprite_t {
35  int8_t dy, dx;
36  uint8_t dtile;
37  uint8_t props;
39 
40 #define metasprite_end -128
41 #define METASPR_ITEM(dy,dx,dt,a) {(dy),(dx),(dt),(a)}
42 #define METASPR_TERM {metasprite_end}
43 
44 extern const void * __current_metasprite;
47 
48 
49 static uint8_t __move_metasprite(uint8_t id, uint8_t x, uint8_t y) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
50 static void __hide_metasprite(uint8_t id) Z88DK_FASTCALL PRESERVES_REGS(iyh, iyl);
51 
58 
79 inline uint8_t move_metasprite_ex(const metasprite_t * metasprite, uint8_t base_tile, uint8_t base_prop, uint8_t base_sprite, uint8_t x, uint8_t y) {
80  base_prop;
81  __current_metasprite = metasprite;
82  __current_base_tile = base_tile;
83  return __move_metasprite(base_sprite, x, y);
84 }
85 
88 inline uint8_t move_metasprite(const metasprite_t * metasprite, uint8_t base_tile, uint8_t base_sprite, uint8_t x, uint8_t y) {
89  __current_metasprite = metasprite;
90  __current_base_tile = base_tile;
91  return __move_metasprite(base_sprite, x, y);
92 }
93 
94 
104 inline void hide_metasprite(const metasprite_t * metasprite, uint8_t base_sprite) {
105  __current_metasprite = metasprite;
106  __hide_metasprite(base_sprite);
107 }
108 
109 #endif
#define PRESERVES_REGS(...)
Definition: types.h:32
#define Z88DK_CALLEE
Definition: types.h:46
#define Z88DK_FASTCALL
Definition: types.h:47
uint8_t __current_base_tile
uint8_t __render_shadow_OAM
uint8_t move_metasprite_ex(const metasprite_t *metasprite, uint8_t base_tile, uint8_t base_prop, uint8_t base_sprite, uint8_t x, uint8_t y)
Definition: metasprites.h:159
uint8_t move_metasprite(const metasprite_t *metasprite, uint8_t base_tile, uint8_t base_sprite, uint8_t x, uint8_t y)
Definition: metasprites.h:168
void hide_sprites_range(uint8_t from, uint8_t to)
const void * __current_metasprite
struct metasprite_t metasprite_t
void hide_metasprite(const metasprite_t *metasprite, uint8_t base_sprite)
Definition: metasprites.h:305
static uint8_t iyl
Definition: metasprites.h:49
void iyh
Definition: msx.h:102
unsigned char uint8_t
Definition: stdint.h:51
signed char int8_t
Definition: stdint.h:43
Definition: metasprites.h:102
int8_t dy
Definition: metasprites.h:103
int8_t dx
Definition: metasprites.h:103
uint8_t props
Definition: metasprites.h:105
uint8_t dtile
Definition: metasprites.h:104