summaryrefslogtreecommitdiff
path: root/src/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/world.cpp b/src/world.cpp
index 511de12..d2fc2bb 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -160,24 +160,20 @@ void entity_t::link_to_sector(sector_t *sector)
void entity_t::link(world_t *world)
{
- //sf::FloatRect total_bounds;
+ rectf_t total_bounds;
float fx, fy;
sector_index_t base;
float xlip, ylip;
size_t xsecs, ysecs;
- // TODO
- //total.bounds.left = std::min(bounds.left, render_bounds.left);
- //total.bounds.top = std::min(bounds.top, render_bounds.top);
- //total.bounds.width = std::max(bounds.width, render_bounds.width);
- //total.bounds.height = std::max(bounds.height, render_bounds.height);
+ total_bounds = bounds + render_bounds;
- fx = floor(bounds[0][0]);
- fy = floor(bounds[0][1]);
+ fx = floor(total_bounds[0][0]);
+ fy = floor(total_bounds[0][1]);
base = sector_index_at(v2f_t(fx, fy));
- xlip = bounds[1][0] - (base[0] + 1) * SECTOR_SIZE;
- ylip = bounds[1][1] - (base[1] + 1) * SECTOR_SIZE;
+ xlip = total_bounds[1][0] - (base[0] + 1) * SECTOR_SIZE;
+ ylip = total_bounds[1][1] - (base[1] + 1) * SECTOR_SIZE;
if (xlip > 0.0f)
xsecs = ceil(xlip / SECTOR_SIZE) + 1;