//--- // enemies: List of enemies and their properties //--- #pragma once #include "comp/entity.h" #include "comp/mechanical.h" #include "comp/fighter.h" #include "game.h" #include "geometry.h" #include "anim.h" /* enemy_t: Static enemy information */ typedef struct { /* Enemy name (shown in wave information) */ char const *name; /* Map hitbox (represents ground size, collides with walls) */ rect hitbox; /* Idle animation, death animation, damage animation */ anim_t *anim_idle, *anim_walking, *anim_attack, *anim_hit, *anim_death; /* Movement parameters */ mechanical_limits_t limits; /* Statistics model */ fighter_stats_t stats_base, stats_growth; /* Level */ uint8_t level; /* Shadow size */ uint8_t shadow_size; /* XP points attributed on death */ uint16_t xp; /* Rendering elevation */ fixed_t z; /* Size of the monster-specific data structure for IA */ size_t ai_data_size; } enemy_t; /* List of enemies */ enum { /* ID 0 is used for the player! */ ENEMY_SLIME_1 = 1, ENEMY_BAT_2 = 2, ENEMY_FIRE_SLIME_4 = 3, ENEMY_ALBINOS_BAT_6 = 4, ENEMY_GUNSLINGER_8 = 5, }; /* Dynamic enemy information. */ typedef struct enemy_data { enemy_t const *id; /* Current pathfinding direction */ vec2 pathfind_dir; /* Number of frames left until next pathfinding cycle */ uint8_t pathfind_cycles; /* Pointer to AI-specific data */ void *ai_data; } enemy_data_t; /* Get enemy data by ID. */ enemy_t const *enemy_data(int enemy_id); /* Create a new enemy of the given type. */ entity_t *enemy_make(int enemy_id); /* Run enemy AI for an entity */ void enemy_ai(game_t *g, entity_t *e, fixed_t dt);