Skip to content

Fix all sprites vanishing in straight view at max zoom - #5066

Merged
Loobinex merged 1 commit into
dkfans:masterfrom
RupixTalahone:fix/frontview-sprite-size-overflow
Jul 29, 2026
Merged

Fix all sprites vanishing in straight view at max zoom#5066
Loobinex merged 1 commit into
dkfans:masterfrom
RupixTalahone:fix/frontview-sprite-size-overflow

Conversation

@RupixTalahone

@RupixTalahone RupixTalahone commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

The bug

In the straight view, zooming to the last two zoom stages at high resolution makes every thing sprite disappear: creatures, lair totems, the dungeon heart. Floors and walls keep rendering, the inhabitants vanish.

Mechanism

draw_fastview_mapwho sizes sprites with (camera_zoom << 13) in 32-bit math. Resolution-scaled zoom reaches camera_zoom >= 262144 at 4K, the shift wraps negative, and the negative size culls every sprite. Same overflow family as #5060, which fixed the sibling term in project_point_helper.

The fix

Widen the intermediate to 64-bit, identical math otherwise. The depth bias merged in #5062 computes the same expression in draw_frontview_thing_on_element, so it gets the same widening and stays correct at the zoom levels this fix makes reachable again.

Testing

Reproduced the vanish on the official alpha 1.4.0.5252 build, then A/B tested a local build of master with this patch on the same machine: every sprite stays visible through max zoom and lair totems render whole there.

🤖 Generated with Claude Code

@PieterVdc

Copy link
Copy Markdown
Member

fix makes sense yeah, but the comments claude adds are bit redundant, could you clean those up?

The sprite size term (camera_zoom << 13) is computed in 32 bits and
wraps once camera_zoom reaches 262144 (the last two zoom stages at
4K resolution) - the negative result makes draw_fastview_mapwho cull
every thing sprite. Widen the intermediate to 64-bit, the same
treatment dkfans#5060 gave project_point_helper.

The dkfans#5062 depth bias in draw_frontview_thing_on_element computes the
same expression, so it gets the same widening and stays correct at
the zoom levels this fix makes reachable again.

Reproduced on alpha 1.4.0.5252.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants