2020-02-02 18:17:31 +00:00
|
|
|
#ifndef _SPRITES_H
|
|
|
|
#define _SPRITES_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2022-08-11 20:27:20 +00:00
|
|
|
typedef struct SpriteShadow {
|
2022-07-20 19:32:47 +00:00
|
|
|
struct {
|
|
|
|
byte x; /* X coordinate */
|
|
|
|
byte y; /* Y coordinate */
|
|
|
|
} spr_pos[8];
|
2020-02-02 18:17:31 +00:00
|
|
|
byte spr_hi_x; /* High bits of X coordinate */
|
2022-07-20 19:32:47 +00:00
|
|
|
byte spr_ena; /* Enable sprites */
|
2020-02-02 18:17:31 +00:00
|
|
|
byte spr_exp_y; /* Expand sprites in Y dir */
|
|
|
|
byte spr_bg_prio; /* Priority to background */
|
|
|
|
byte spr_mcolor; /* Sprite multicolor bits */
|
2022-07-20 19:32:47 +00:00
|
|
|
byte spr_exp_x; /* Expand sprites in X dir */
|
2020-02-02 18:17:31 +00:00
|
|
|
byte spr_color[8]; /* Colors for the sprites */
|
|
|
|
byte spr_shapes[8]; /* sprite shapes */
|
|
|
|
} SpriteShadow;
|
|
|
|
|
2022-08-11 20:27:20 +00:00
|
|
|
/* sprite shadow buffer */
|
2020-02-02 18:17:31 +00:00
|
|
|
extern SpriteShadow sprshad;
|
|
|
|
|
2022-08-11 20:27:20 +00:00
|
|
|
/* set one or more sprite patterns from a byte array */
|
|
|
|
void sprite_set_shapes(const void* sprite_data,
|
|
|
|
byte index,
|
|
|
|
byte count);
|
|
|
|
/* clear all sprites from shadow buffer */
|
|
|
|
void sprite_clear();
|
|
|
|
/* draw a sprite into shadow buffer */
|
|
|
|
void sprite_draw(byte index, word x, byte y, byte shape);
|
|
|
|
/* update sprite registers */
|
|
|
|
void sprite_update(byte* screenmem);
|
|
|
|
|
|
|
|
/* get the closest sprite collision
|
|
|
|
given the set of collision flags */
|
|
|
|
byte sprite_get_closest_collision(byte index, byte spr_coll);
|
|
|
|
|
|
|
|
// bit lookup table
|
|
|
|
extern const byte BITS[8];
|
2020-02-02 18:17:31 +00:00
|
|
|
|
|
|
|
#endif
|