GBDK 2020 Docs  4.1.1
API Documentation for GBDK 2020
metasprites.h
Go to the documentation of this file.
1 
34 #ifndef _METASPRITES_H_INCLUDE
35 #define _METASPRITES_H_INCLUDE
36 
37 #include <msx/hardware.h>
38 #include <types.h>
39 #include <stdint.h>
40 
54 typedef struct metasprite_t {
55  int8_t dy, dx;
56  uint8_t dtile;
57  uint8_t props;
59 
60 #define metasprite_end -128
61 #define METASPR_ITEM(dy,dx,dt,a) {(dy),(dx),(dt),(a)}
62 #define METASPR_TERM {metasprite_end}
63 
64 extern const void * __current_metasprite;
67 
68 
69 static uint8_t __move_metasprite(uint8_t id, uint8_t x, uint8_t y) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
70 static void __hide_metasprite(uint8_t id) Z88DK_FASTCALL PRESERVES_REGS(iyh, iyl);
71 
78 
99 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) {
100  base_prop;
101  __current_metasprite = metasprite;
102  __current_base_tile = base_tile;
103  return __move_metasprite(base_sprite, x, y);
104 }
105 
108 inline uint8_t move_metasprite(const metasprite_t * metasprite, uint8_t base_tile, uint8_t base_sprite, uint8_t x, uint8_t y) {
109  __current_metasprite = metasprite;
110  __current_base_tile = base_tile;
111  return __move_metasprite(base_sprite, x, y);
112 }
113 
114 
124 inline void hide_metasprite(const metasprite_t * metasprite, uint8_t base_sprite) {
125  __current_metasprite = metasprite;
126  __hide_metasprite(base_sprite);
127 }
128 
129 #endif
unsigned char UINT8
Definition: types.h:49
#define PRESERVES_REGS(...)
Definition: types.h:31
#define Z88DK_CALLEE
Definition: types.h:45
#define Z88DK_FASTCALL
Definition: types.h:46
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:144
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:153
const void * __current_metasprite
struct metasprite_t metasprite_t
void hide_sprites_range(UINT8 from, UINT8 to)
void hide_metasprite(const metasprite_t *metasprite, uint8_t base_sprite)
Definition: metasprites.h:290
static uint8_t iyl
Definition: metasprites.h:69
void iyh
Definition: msx.h:86
unsigned char uint8_t
Definition: stdint.h:51
signed char int8_t
Definition: stdint.h:43
Definition: metasprites.h:87
int8_t dy
Definition: metasprites.h:88
int8_t dx
Definition: metasprites.h:88
uint8_t props
Definition: metasprites.h:90
uint8_t dtile
Definition: metasprites.h:89