lol its in c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. #ifndef IS_ACTOR_H_
  2. #define IS_ACTOR_H_
  3. #include <stdint.h>
  4. #include "mob.h"
  5. typedef enum {
  6. DIR_LEFT,
  7. DIR_RIGHT,
  8. } actor_dir_t;
  9. typedef enum {
  10. ANIM_STAND,
  11. // TODO: Put JUMP at end later
  12. ANIM_JUMP,
  13. ANIM_WALK,
  14. ANIM_ATTACK,
  15. ANIM_HURT,
  16. ANIM_CLIMB,
  17. } actor_anim_state_t;
  18. typedef struct {
  19. uint8_t active;
  20. uint8_t flip;
  21. uint8_t mob_anim_idx;
  22. actor_anim_state_t anim;
  23. uint8_t frame_idx;
  24. uint8_t frame_counter;
  25. uint8_t x;
  26. uint8_t y;
  27. } actor_t;
  28. typedef struct {
  29. uint8_t *anims[ANIM_HURT + 1];
  30. } sprite16_mob;
  31. typedef struct {
  32. uint8_t *anims[ANIM_CLIMB + 1];
  33. } sprite16_player;
  34. void actor_init(void);
  35. /**
  36. * @brief Clear all actor data.
  37. */
  38. void actor_reset(void);
  39. /**
  40. * @brief Register an actor for a mob.
  41. * @param id The ID of the mob to create
  42. * @return A pointer to the new actor or NULL if one could not be created
  43. */
  44. actor_t *actor_create_mob(mob_id_t id);
  45. /**
  46. * @brief Remove an actor from the screen.
  47. * @param a The actor to remove
  48. */
  49. void actor_remove(actor_t *a);
  50. /**
  51. * @brief Update the internal state of each actor.
  52. */
  53. void actor_update(void);
  54. extern actor_t *PLAYER_ACTOR;
  55. extern sprite16_player player_anim_data;
  56. #endif