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.

69 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 mob_anim_idx;
  21. actor_anim_state_t anim;
  22. uint8_t frame_idx;
  23. uint8_t frame_counter;
  24. uint8_t x;
  25. uint8_t y;
  26. } actor_t;
  27. typedef struct {
  28. uint8_t *anims[ANIM_HURT + 1];
  29. } sprite16_mob;
  30. typedef struct {
  31. uint8_t *anims[ANIM_CLIMB + 1];
  32. } sprite16_player;
  33. void actor_init(void);
  34. /**
  35. * @brief Clear all actor data.
  36. */
  37. void actor_reset(void);
  38. /**
  39. * @brief Register an actor for a mob.
  40. * @param id The ID of the mob to create
  41. * @return A pointer to the new actor or NULL if one could not be created
  42. */
  43. actor_t *actor_create_mob(mob_id_t id);
  44. /**
  45. * @brief Remove an actor from the screen.
  46. * @param a The actor to remove
  47. */
  48. void actor_remove(actor_t *a);
  49. /**
  50. * @brief Update the internal state of each actor.
  51. */
  52. void actor_update(void);
  53. extern actor_t *PLAYER_ACTOR;
  54. extern sprite16_player player_anim_data;
  55. #endif