Compare commits
No commits in common. "3f5e1648c1780a9b415d2ca679610438cd5d8ddf" and "85e731392a9edbe9f0bcab631a86f1a225717dbf" have entirely different histories.
3f5e1648c1
...
85e731392a
|
@ -3,7 +3,7 @@
|
||||||
uint8_t find_1D_overlap(Vector2 l1, Vector2 l2, float* overlap)
|
uint8_t find_1D_overlap(Vector2 l1, Vector2 l2, float* overlap)
|
||||||
{
|
{
|
||||||
// No Overlap
|
// No Overlap
|
||||||
if (l1.y <= l2.x || l2.y <= l1.x) return 0;
|
if (l1.y < l2.x || l2.y < l1.x) return 0;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(l1.x >= l2.x && l1.y <= l2.y)
|
(l1.x >= l2.x && l1.y <= l2.y)
|
||||||
|
@ -110,13 +110,13 @@ bool line_in_AABB(Vector2 p1, Vector2 p2, Rectangle box)
|
||||||
l1.y = p2.x;
|
l1.y = p2.x;
|
||||||
l2.x = box.x;
|
l2.x = box.x;
|
||||||
l2.y = box.x + box.width;
|
l2.y = box.x + box.width;
|
||||||
uint8_t x_res = find_1D_overlap(l1, l2, &overlap.x);
|
|
||||||
|
|
||||||
|
find_1D_overlap(l1, l2, &overlap.x);
|
||||||
l1.x = p1.y;
|
l1.x = p1.y;
|
||||||
l1.y = p2.y;
|
l1.y = p2.y;
|
||||||
l2.x = box.y;
|
l2.x = box.y;
|
||||||
l2.y = box.y + box.height;
|
l2.y = box.y + box.height;
|
||||||
uint8_t y_res = find_1D_overlap(l1, l2, &overlap.y);
|
find_1D_overlap(l1, l2, &overlap.y);
|
||||||
|
|
||||||
return (x_res != 0 && y_res != 0);
|
return (overlap.x != 0 && overlap.y != 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1701,7 +1701,6 @@ void boulder_destroy_wooden_tile_system(Scene_t* scene)
|
||||||
|
|
||||||
if (tilemap.tiles[tile_idx].tile_type == ONEWAY_TILE)
|
if (tilemap.tiles[tile_idx].tile_type == ONEWAY_TILE)
|
||||||
{
|
{
|
||||||
play_sfx(scene->engine, WOOD_DESTROY_SFX);
|
|
||||||
destroy_tile(data, tile_idx);
|
destroy_tile(data, tile_idx);
|
||||||
if (tile_x > 0 && tilemap.tiles[tile_idx - 1].tile_type == ONEWAY_TILE)
|
if (tile_x > 0 && tilemap.tiles[tile_idx - 1].tile_type == ONEWAY_TILE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ static void test_AABB_overlap(void **state)
|
||||||
p2.x = 10;
|
p2.x = 10;
|
||||||
p2.y = 10;
|
p2.y = 10;
|
||||||
assert_int_equal(find_AABB_overlap(p1, sz1, p2, sz2, &overlap), 2); // Smaller one is complete overlap
|
assert_int_equal(find_AABB_overlap(p1, sz1, p2, sz2, &overlap), 2); // Smaller one is complete overlap
|
||||||
assert_int_equal(find_AABB_overlap(p2, sz2, p1, sz1, &overlap), 2); // This is also considered complete overlap
|
assert_int_equal(find_AABB_overlap(p2, sz2, p1, sz1, &overlap), 1); // Bigger on is not
|
||||||
|
|
||||||
p2.x = 15;
|
p2.x = 15;
|
||||||
p2.y = 15;
|
p2.y = 15;
|
||||||
|
|
Loading…
Reference in New Issue