diff --git a/entManager_test.c b/entManager_test.c index 7ee95af..0729d64 100644 --- a/entManager_test.c +++ b/entManager_test.c @@ -1,4 +1,5 @@ #include "mempool.h" +#include "ent_impl.h" #include int main(void) diff --git a/scenes/engine/EC/EC.h b/scenes/engine/EC/EC.h index 257410e..48387c5 100644 --- a/scenes/engine/EC/EC.h +++ b/scenes/engine/EC/EC.h @@ -151,17 +151,9 @@ static inline void set_bbox(CBBox_t* p_bbox, unsigned int x, unsigned int y) p_bbox->half_size.y = (unsigned int)(y / 2); } -typedef enum EntityTag { - NO_ENT_TAG, - PLAYER_ENT_TAG, - ENEMY_ENT_TAG, - CRATES_ENT_TAG, - BOULDER_ENT_TAG, -} EntityTag_t; - struct Entity { unsigned long m_id; - EntityTag_t m_tag; + unsigned int m_tag; bool m_alive; unsigned long components[N_COMPONENTS]; EntityManager_t* manager; @@ -181,7 +173,7 @@ void update_entity_manager(EntityManager_t* p_manager); void clear_entity_manager(EntityManager_t* p_manager); void free_entity_manager(EntityManager_t* p_manager); -Entity_t* add_entity(EntityManager_t* p_manager, EntityTag_t tag); +Entity_t* add_entity(EntityManager_t* p_manager, unsigned int tag); void remove_entity(EntityManager_t* p_manager, unsigned long id); Entity_t *get_entity(EntityManager_t* p_manager, unsigned long id); diff --git a/scenes/engine/EC/entManager.c b/scenes/engine/EC/entManager.c index 7afce11..8714b8d 100644 --- a/scenes/engine/EC/entManager.c +++ b/scenes/engine/EC/entManager.c @@ -74,7 +74,7 @@ void free_entity_manager(EntityManager_t* p_manager) sc_queue_term(&p_manager->to_remove); } -Entity_t *add_entity(EntityManager_t* p_manager, EntityTag_t tag) +Entity_t *add_entity(EntityManager_t* p_manager, unsigned int tag) { unsigned long e_idx = 0; Entity_t* p_ent = new_entity_from_mempool(&e_idx); diff --git a/scenes/engine/EC/mempool.c b/scenes/engine/EC/mempool.c index ede8697..a710b74 100644 --- a/scenes/engine/EC/mempool.c +++ b/scenes/engine/EC/mempool.c @@ -157,7 +157,7 @@ Entity_t* new_entity_from_mempool(unsigned long* e_idx_ptr) ent->components[j] = MAX_COMP_POOL_SIZE; } ent->m_alive = true; - ent->m_tag = NO_ENT_TAG; + ent->m_tag = 0; return ent; } diff --git a/scenes/ent_impl.h b/scenes/ent_impl.h index 7a2bee0..19c0978 100644 --- a/scenes/ent_impl.h +++ b/scenes/ent_impl.h @@ -2,6 +2,15 @@ #define __ENT_IMPL_H #include "assets.h" +typedef enum EntityTag { + NO_ENT_TAG = 0, + PLAYER_ENT_TAG, + ENEMY_ENT_TAG, + CRATES_ENT_TAG, + BOULDER_ENT_TAG, +} EntityTag_t; + + bool init_player_creation(const char* info_file, Assets_t* assets); Entity_t* create_player(EntityManager_t* ent_manager, Assets_t* assets); Entity_t* create_crate(EntityManager_t* ent_manager, Assets_t* assets, bool metal); diff --git a/scenes/game_systems.c b/scenes/game_systems.c index ceec982..f5ecdf2 100644 --- a/scenes/game_systems.c +++ b/scenes/game_systems.c @@ -1,4 +1,5 @@ #include "game_systems.h" +#include "ent_impl.h" #include "AABB.h" #include "EC.h" #include "constants.h"