R3.5 v1 only gated the stencil branch on `cameraReallyInside`; the
depth-clear-if-inside at line ~7129 stayed on `cameraInsideCell`. During
grace frames after exit:
cameraInsideCell = true (grace, holds previous cell for 3 frames)
cameraReallyInside = false (PointInCell on camera pos returns false)
So depth-clear FIRED (writing depth = 1.0 globally) but the OUTDOOR branch
ran (single Draw(All) on every entity). With depth cleared, terrain's
depth = 1.0 — every entity below terrain (cellar geometry, basement
GfxObjs, anything at world Z < terrain Z) won the depth test and rendered
THROUGH the ground. User reported: "stand outside or pass outside → flicker
where objects are visible through ground and walls of other buildings are
missing."
v2 fix: unify depth-related gates on `cameraReallyInside`. During grace
frames depth-clear is now ALSO skipped; terrain depth survives; the
outdoor pass renders normally with proper terrain occlusion. Sky /
lighting / particles continue to use `cameraInsideCell` for smooth
grace-aware transitions.
The two-flag split is now explicit:
cameraInsideCell → sky, lighting (smooth, grace-aware)
cameraReallyInside → depth-clear, stencil branch (strict, no grace)
Closes the persistent transition flicker observed in R4 visual
verification after v1.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>