From e838714ef9f8b68a980e5dd77d27a1045d7d4b41 Mon Sep 17 00:00:00 2001 From: rexim Date: Sun, 26 Jan 2020 03:08:56 +0700 Subject: [PATCH] Remove dead code from platforms --- src/game/level/platforms.c | 36 ------------------------------------ src/game/level/platforms.h | 5 ----- 2 files changed, 41 deletions(-) diff --git a/src/game/level/platforms.c b/src/game/level/platforms.c index 08acf507..67b552ff 100644 --- a/src/game/level/platforms.c +++ b/src/game/level/platforms.c @@ -17,7 +17,6 @@ struct Platforms { Rect *rects; Color *colors; - int *hiding; size_t rects_size; }; @@ -51,12 +50,6 @@ Platforms *create_platforms_from_rect_layer(const RectLayer *layer) } memcpy(platforms->colors, rect_layer_colors(layer), sizeof(Color) * platforms->rects_size); - platforms->hiding = PUSH_LT(lt, nth_calloc(1, sizeof(int) * platforms->rects_size), free); - if (platforms->hiding == NULL) { - RETURN_LT(lt, NULL); - } - memset(platforms->hiding, 0, sizeof(int) * platforms->rects_size); - return platforms; } @@ -148,32 +141,3 @@ Vec2f platforms_snap_rect(const Platforms *platforms, return result; } - -#define HIDING_SPEED 2.0f - -void platforms_update(Platforms *platforms, float dt) -{ - trace_assert(platforms); - for (size_t i = 0; i < platforms->rects_size; ++i) { - if (platforms->hiding[i]) { - if (platforms->colors[i].a > 0.0f) { - platforms->colors[i].a = - fmaxf(0.0f, platforms->colors[i].a - HIDING_SPEED * dt); - } else { - platforms->hiding[i] = 0; - } - } - } -} - -void platforms_hide_platform_at(const Platforms *platforms, - Vec2f position) -{ - trace_assert(platforms); - - for (size_t i = 0; i < platforms->rects_size; ++i) { - if (rect_contains_point(platforms->rects[i], position)) { - platforms->hiding[i] = 1; - } - } -} diff --git a/src/game/level/platforms.h b/src/game/level/platforms.h index 35e84fea..a3c8cb57 100644 --- a/src/game/level/platforms.h +++ b/src/game/level/platforms.h @@ -15,15 +15,10 @@ void destroy_platforms(Platforms *platforms); int platforms_render(const Platforms *platforms, const Camera *camera); -void platforms_update(Platforms *platforms, float dt); - void platforms_touches_rect_sides(const Platforms *platforms, Rect object, int sides[RECT_SIDE_N]); Vec2f platforms_snap_rect(const Platforms *platforms, Rect *object); -void platforms_hide_platform_at(const Platforms *platforms, - Vec2f position); - #endif // PLATFORMS_H_ -- 2.44.0