]> git.lizzy.rs Git - nothing.git/blobdiff - src/game/level/player.c
Remove closed TODOs: #118 #119 #110 #109 #151
[nothing.git] / src / game / level / player.c
index 34180fd6caf97ee17e1d982c9bf9b4c8a017fe6e..f23bdd94e505bc458ccfc56ee4057a996e0cfe8b 100644 (file)
@@ -33,7 +33,6 @@ struct player_t {
     int jump_count;
     color_t color;
 
-    /* TODO(#110): introduce checkpoints */
     vec_t checkpoint;
 
     int play_die_cue;
@@ -103,6 +102,16 @@ void destroy_player(player_t * player)
     RETURN_LT0(player->lt);
 }
 
+solid_ref_t player_as_solid(player_t *player)
+{
+    solid_ref_t ref = {
+        .tag = SOLID_PLAYER,
+        .ptr = (void*) player
+    };
+
+    return ref;
+}
+
 int player_render(const player_t * player,
                   const camera_t *camera)
 {
@@ -169,30 +178,6 @@ void player_collide_with_solid(player_t *player, solid_ref_t solid)
     }
 }
 
-void player_collide_with_platforms(player_t * player,
-                                   const platforms_t *platforms)
-{
-    if (player->state == PLAYER_STATE_ALIVE) {
-        rigid_rect_collide_with_platforms(player->alive_body, platforms);
-
-        if (rigid_rect_touches_ground(player->alive_body)) {
-            player->jump_count = 0;
-        }
-    }
-}
-
-void player_collide_with_boxes(player_t * player,
-                               const boxes_t * boxes)
-{
-    if (player->state == PLAYER_STATE_ALIVE) {
-        rigid_rect_collide_with_boxes(player->alive_body, boxes);
-
-        if (rigid_rect_touches_ground(player->alive_body)) {
-            player->jump_count = 0;
-        }
-    }
-}
-
 void player_impact_rigid_rect(player_t * player,
                               rigid_rect_t *rigid_rect)
 {
@@ -305,3 +290,12 @@ rect_t player_hitbox(const player_t *player)
         return rect(0.0f, 0.0f, 0.0f, 0.0f);
     }
 }
+
+void player_rect_object_collide(player_t *player,
+                                rect_t object,
+                                int sides[RECT_SIDE_N])
+{
+    if (player->state == PLAYER_STATE_ALIVE) {
+        rigid_body_object_collide(player->alive_body, object, sides);
+    }
+}