Fixing some values and error handling.

This commit is contained in:
Ulysse Cura 2026-08-09 14:10:57 +02:00
parent f27eff9731
commit 5bf66ddd7b
3 changed files with 4 additions and 5 deletions

View File

@ -9,7 +9,7 @@ COMPONENT(INTERACT_COMPONENT, interact_component, DRAW)
#else #else
COMPONENT(TRANSFORM_COMPONENT, transform_component, NO_DRAW) COMPONENT(TRANSFORM_COMPONENT, transform_component, NO_DRAW)
COMPONENT(HITBOX_COMPONENT, hitbox_component, NO_DRAW) COMPONENT(HITBOX_COMPONENT, hitbox_component, NO_DRAW)
COMPONENT(INTERACT_COMPONENT, interct_component, NO_DRAW) COMPONENT(INTERACT_COMPONENT, interact_component, NO_DRAW)
#endif // DEBUG >= 2 #endif // DEBUG >= 2
COMPONENT(PHYSICS_SYSTEM, physics_system, NO_DRAW) COMPONENT(PHYSICS_SYSTEM, physics_system, NO_DRAW)

View File

@ -43,7 +43,6 @@ inline int physics_system_init(component_t *component)
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// Only for this file
// Args : physics_system_data_t *system_data, size_t entity_id // Args : physics_system_data_t *system_data, size_t entity_id
static inline int action_detect_solve_entities_collision(elem_t *elem, va_list args) static inline int action_detect_solve_entities_collision(elem_t *elem, va_list args)
{ {
@ -116,7 +115,7 @@ int physics_system_update(component_t *component)
system_data->velocity.y = lerp(system_data->velocity.y, system_data->target_velocity.y, system_data->smoothing_factor); system_data->velocity.y = lerp(system_data->velocity.y, system_data->target_velocity.y, system_data->smoothing_factor);
if(hitbox_component_data->activated) if(hitbox_component_data->activated)
linked_list_for_each(&game.entity_manager.entities, action_detect_solve_entities_collision, system_data, component->entity->id); if(linked_list_for_each(&game.entity_manager.entities, action_detect_solve_entities_collision, system_data, component->entity->id)) return EXIT_FAILURE;
transform_component_data->bounds.x += system_data->velocity.x * system_data->speed * (float)game.delta_time_ms / 1000.0f; transform_component_data->bounds.x += system_data->velocity.x * system_data->speed * (float)game.delta_time_ms / 1000.0f;
transform_component_data->bounds.y += system_data->velocity.y * system_data->speed * (float)game.delta_time_ms / 1000.0f; transform_component_data->bounds.y += system_data->velocity.y * system_data->speed * (float)game.delta_time_ms / 1000.0f;

View File

@ -94,12 +94,12 @@ int game_init(void)
((interact_component_data_t *)component->data)->position = (fvector2d_t) { ((interact_component_data_t *)component->data)->position = (fvector2d_t) {
.x = 0.5f, .x = 0.5f,
.y = 4.0f / 3.0f .y = 2.0f
}; };
((interact_component_data_t *)component->data)->scale = (fvector2d_t) { ((interact_component_data_t *)component->data)->scale = (fvector2d_t) {
.x = 2.0f / 3.0f, .x = 2.0f / 3.0f,
.y = 0.7f .y = 5.0f / 6.0f
}; };
/* ======== Door ======== */ /* ======== Door ======== */