#ifndef IS_ACTOR_H_
|
|
#define IS_ACTOR_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "mob.h"
|
|
|
|
typedef enum {
|
|
ANIM_STAND,
|
|
ANIM_WALK,
|
|
ANIM_JUMP,
|
|
ANIM_ATTACK,
|
|
ANIM_HURT,
|
|
ANIM_CLIMB,
|
|
} actor_anim_state_t;
|
|
|
|
typedef struct {
|
|
uint8_t active;
|
|
uint8_t dirty;
|
|
uint8_t mob_anim_idx;
|
|
actor_anim_state_t anim;
|
|
uint8_t frame_idx;
|
|
uint8_t frame_counter;
|
|
uint8_t x;
|
|
uint8_t y;
|
|
} actor_t;
|
|
|
|
typedef struct {
|
|
uint8_t *tiles;
|
|
uint16_t num_tiles;
|
|
uint8_t *anims[ANIM_HURT + 1];
|
|
} sprite16_mob;
|
|
|
|
typedef struct {
|
|
uint8_t *tiles;
|
|
uint16_t num_tiles;
|
|
uint8_t *anims[ANIM_CLIMB + 1];
|
|
} sprite16_player;
|
|
|
|
/**
|
|
* @brief Clear all actor data.
|
|
*/
|
|
void actor_reset(void);
|
|
|
|
/**
|
|
* @brief Register an actor for a mob.
|
|
* @param id The ID of the mob to create
|
|
* @return A pointer to the new actor or NULL if one could not be created
|
|
*/
|
|
actor_t *actor_create_mob(mob_id_t id);
|
|
|
|
/**
|
|
* @brief Remove an actor from the screen.
|
|
* @param a The actor to remove
|
|
*/
|
|
void actor_remove(actor_t *a);
|
|
|
|
/**
|
|
* @brief Update the internal state of each actor.
|
|
*/
|
|
void actor_update(void);
|
|
|
|
/**
|
|
* @brief Flush actor sprite data to OAM.
|
|
*/
|
|
void actor_flush_oam(void);
|
|
|
|
#endif
|