Fix debug drawing not working unless you collided with something

main
Cameron Murphy Reikes 2 years ago
parent 21a8c3aa3b
commit c9ef9a69be

@ -150,5 +150,5 @@
} }
@level level0: @level level0:
{ {
filepath: "new_level.json", filepath: "testsmalllevel.json",
} }

@ -1596,7 +1596,7 @@ bool profiling;
#endif #endif
#endif #endif
Color debug_color = { 1.0f, 0.0f, 0.0f, 0.0f }; Color debug_color = {1,0,0,1};
#define dbgcol(col) DeferLoop(debug_color = col, debug_color = RED) #define dbgcol(col) DeferLoop(debug_color = col, debug_color = RED)
@ -1934,11 +1934,14 @@ Vec2 move_and_slide(MoveSlideParams p)
{ {
Vec2 collision_aabb_size = entity_aabb_size(p.from); Vec2 collision_aabb_size = entity_aabb_size(p.from);
Vec2 new_pos = AddV2(p.position, p.movement_this_frame); Vec2 new_pos = AddV2(p.position, p.movement_this_frame);
assert(collision_aabb_size.x > 0.0f); assert(collision_aabb_size.x > 0.0f);
assert(collision_aabb_size.y > 0.0f); assert(collision_aabb_size.y > 0.0f);
AABB at_new = centered_aabb(new_pos, collision_aabb_size); AABB at_new = centered_aabb(new_pos, collision_aabb_size);
BUFF(AABB, 256) to_check = { 0 }; BUFF(AABB, 256) to_check = { 0 };
// add tilemap boxes // add tilemap boxes
{ {
Vec2 at_new_size_vector = SubV2(at_new.lower_right, at_new.upper_left); Vec2 at_new_size_vector = SubV2(at_new.lower_right, at_new.upper_left);
@ -1961,6 +1964,7 @@ Vec2 move_and_slide(MoveSlideParams p)
} }
} }
// add entity boxes // add entity boxes
if (!p.dont_collide_with_entities && !(p.from->is_character && p.from->is_rolling)) if (!p.dont_collide_with_entities && !(p.from->is_character && p.from->is_rolling))
{ {
@ -2028,6 +2032,7 @@ Vec2 move_and_slide(MoveSlideParams p)
} }
} }
//overlapping_smallest_first = actually_overlapping; //overlapping_smallest_first = actually_overlapping;
BUFF_ITER(AABB, &actually_overlapping) BUFF_ITER(AABB, &actually_overlapping)

Loading…
Cancel
Save