fix(world): restore portal and distant use lifecycles

This commit is contained in:
Erik 2026-07-25 09:59:25 +02:00
parent c730632075
commit 1a14812c44
18 changed files with 401 additions and 196 deletions

View file

@ -39,6 +39,7 @@ internal sealed class WorldRevealCoordinator
private readonly IWorldRevealStreamingScheduler? _streaming;
private readonly IWorldRevealRenderResourceScheduler? _renderResources;
private long _activeGeneration;
private bool _worldSimulationReleased;
private bool _worldViewportReleased;
public WorldRevealCoordinator(
@ -80,6 +81,7 @@ internal sealed class WorldRevealCoordinator
_readiness.Begin();
long generation = _lifecycle.Begin(kind);
_activeGeneration = generation;
_worldSimulationReleased = false;
_worldViewportReleased = false;
_quiescence?.Begin(generation);
_streaming?.BeginDestinationReservation(
@ -107,7 +109,22 @@ internal sealed class WorldRevealCoordinator
return snapshot;
}
public void ObserveMaterialized() => _lifecycle.ObserveMaterialized();
/// <summary>
/// Commits the accepted destination and resumes its hidden world
/// simulation while the private portal viewport remains in front.
/// </summary>
/// <remarks>
/// Retail <c>SmartBox::UseTime @ 0x00455410</c> resumes
/// <c>CObjectMaint</c>/<c>CPhysics</c> before
/// <c>gmSmartBoxUI::EndTeleportAnimation @ 0x004D65A0</c> enters
/// <c>TAS_TUNNEL_CONTINUE</c>. The normal world viewport is not restored
/// until the later <c>TUNNEL_FADE_OUT -&gt; WORLD_FADE_IN</c> edge.
/// </remarks>
public void ObserveMaterialized()
{
_lifecycle.ObserveMaterialized();
ReleaseWorldSimulation();
}
public void ObserveWorldViewportVisible() =>
_lifecycle.ObserveWorldViewportVisible();
@ -116,9 +133,10 @@ internal sealed class WorldRevealCoordinator
_lifecycle.ObserveWait(elapsed);
/// <summary>
/// Reopens the destination world at retail's TunnelFadeOut -&gt;
/// WorldFadeIn viewport swap without completing the one-second
/// WorldFadeIn/LoginComplete tail.
/// Releases the destination streaming/resource reservation at retail's
/// TunnelFadeOut -&gt; WorldFadeIn viewport swap without completing the
/// one-second WorldFadeIn/LoginComplete tail. World simulation already
/// resumed when the accepted destination materialized.
/// </summary>
public void RevealWorldViewport()
{
@ -128,7 +146,6 @@ internal sealed class WorldRevealCoordinator
_streaming?.EndDestinationReservation(generation);
_renderResources?.EndDestinationReveal(generation);
_quiescence?.End(generation);
_worldViewportReleased = true;
}
@ -150,8 +167,20 @@ internal sealed class WorldRevealCoordinator
if (generation == 0)
return;
ReleaseWorldSimulation();
RevealWorldViewport();
_activeGeneration = 0;
_worldSimulationReleased = false;
_worldViewportReleased = false;
}
private void ReleaseWorldSimulation()
{
long generation = _activeGeneration;
if (generation == 0 || _worldSimulationReleased)
return;
_quiescence?.End(generation);
_worldSimulationReleased = true;
}
}