Remove some questionable code

Changelog:
- Don't shorten overlap, that is already done on position after
  movement update
- Don't extend tile when updating tile coord
scene_man
En Yi 2023-02-18 15:27:04 +08:00
parent a8567e2666
commit 95c4b98879
2 changed files with 7 additions and 7 deletions

View File

@ -16,11 +16,11 @@ bool find_1D_overlap(const Vector2 l1, const Vector2 l2, float* overlap)
// x is p1, y is p2
*overlap = (l2.y >= l1.y)? l2.x - l1.y : l2.y - l1.x;
}
if (fabs(*overlap) < 0.01) // Use 2 dp precision
{
*overlap = 0;
return false;
}
//if (fabs(*overlap) < 0.01) // Use 2 dp precision
//{
// *overlap = 0;
// return false;
//}
return true;
}

View File

@ -699,8 +699,8 @@ void update_tilemap_system(Scene_t *scene)
// Extend the check by a little to avoid missing
unsigned int tile_x1 = (p_ctransform->position.x) / TILE_SIZE;
unsigned int tile_y1 = (p_ctransform->position.y) / TILE_SIZE;
unsigned int tile_x2 = (p_ctransform->position.x + p_bbox->size.x) / TILE_SIZE;
unsigned int tile_y2 = (p_ctransform->position.y + p_bbox->size.y) / TILE_SIZE;
unsigned int tile_x2 = (p_ctransform->position.x + p_bbox->size.x - 1) / TILE_SIZE;
unsigned int tile_y2 = (p_ctransform->position.y + p_bbox->size.y - 1) / TILE_SIZE;
for (unsigned int tile_y=tile_y1; tile_y <= tile_y2; tile_y++)
{