1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-26 03:17:39 +00:00

render entities only if visible

This commit is contained in:
Zeno Rogue
2025-04-27 01:23:00 +02:00
parent 3846ff83c3
commit 0797e540d6
4 changed files with 25 additions and 2 deletions

View File

@@ -16,6 +16,12 @@ bbox entity::get_pixel_bbox_at(double x, double y) {
return b;
}
bool entity::visible(room *r) {
auto bb = get_intersect(pixel_to_block(get_pixel_bbox()), room_bb);
for(int y = bb.miny; y < bb.maxy; y++) for(int x = bb.minx; x < bb.maxx; x++) if(r->fov[y][x]) return true;
return false;
}
void entity::apply_grav() {
if(non_hyperbolic) return apply_portal_grav();