From 81e242532bd3d24a5f818954f9e012456c6a2ec6 Mon Sep 17 00:00:00 2001 From: Sara Date: Sun, 18 Jun 2023 14:08:55 +0200 Subject: [PATCH] added argument to interpolate_move, removed return value from interpolate_move --- src/corelib/world.c | 8 ++++---- src/corelib/world.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/corelib/world.c b/src/corelib/world.c index 85fbed4..8a063e9 100644 --- a/src/corelib/world.c +++ b/src/corelib/world.c @@ -166,7 +166,7 @@ void update_collision() { } } -object_t* interpolate_move(object_t* object, float target_x, float target_y, float max_step_size) { +void interpolate_move(object_t* object, float target_x, float target_y, float max_step_size, int slide) { // calculate step delta float dx = target_x - object->sprite.x, dy = target_y - object->sprite.y; // calculate direction x,y @@ -179,7 +179,7 @@ object_t* interpolate_move(object_t* object, float target_x, float target_y, flo if(!_can_collide(object)) { object->sprite.x = target_x; object->sprite.y = target_y; - return NULL; + return; } /* @@ -208,11 +208,11 @@ object_t* interpolate_move(object_t* object, float target_x, float target_y, flo object_broadcast_collision(object, other); object->sprite.x = old_x; object->sprite.y = old_y; - return other; + return; } } } // no collision, return nothing - return NULL; + return; } diff --git a/src/corelib/world.h b/src/corelib/world.h index 2c57f31..27de091 100644 --- a/src/corelib/world.h +++ b/src/corelib/world.h @@ -62,6 +62,6 @@ void draw_objects(); void update_collision(); -object_t* interpolate_move(object_t* object, float target_x, float target_y, float max_step_size); +void interpolate_move(object_t* object, float target_x, float target_y, float max_step_size, int slide); #endif /* _world_h */