fix(physics): port retail stair edge backprobe

This commit is contained in:
Erik 2026-07-31 09:26:28 +02:00
parent 5a0f9868a6
commit 2dcb4f1d94
6 changed files with 218 additions and 6 deletions

View file

@ -2192,9 +2192,18 @@ public sealed class Transition
return CliffSlide(cliffPlane);
}
if (!sp.HasWalkablePolygon)
sp.RestoreLastWalkable();
// Retail tests only SPHEREPATH::walkable here. When the failed
// step-down has no current walkable polygon it MUST continue into the
// back-probe below, which rediscovers the polygon under CurPos before
// testing the failed candidate against its edge
// (CTransition::edge_slide 0x0050B3D0, 0x0050B44A-0x0050B50F).
//
// #271 (2026-07-31): acdream previously promoted its separately
// retained LastWalkable polygon into the current slot at this point.
// At a staircase side wall that polygon could be the preceding tread.
// PrecipiceSlide then projected the forward candidate along the stale
// tread edge, reversing its uphill tangent and dropping the player
// rapidly down the stairs. Do not restore stale history here.
if (sp.HasWalkablePolygon)
{
// L.4-walkable-steep (2026-04-30): the stored Walkable polygon
@ -2293,9 +2302,8 @@ public sealed class Transition
ci.ContactPlaneIsWater = false;
sp.RestoreCheckPos();
if (!sp.HasWalkablePolygon)
sp.RestoreLastWalkable();
// Retail returns Collided when the back-probe found no walkable.
// In particular, it does not substitute a retained earlier polygon.
if (sp.HasWalkablePolygon)
return sp.PrecipiceSlide(this);