Fix lab cutscene control, landing steering, clipping and objective timeout

This commit is contained in:
UnixNight committed 2026-10-25 01:18:08 -04:00
1 parent 976e677019
commit ca08c468ba
33 files changed
+871 -64

No files matched your search

+13 -6
View File
@@ -11,6 +11,17 @@ namespace GamePort.Application;
public static class LabRouteSmoke
{
public static void Run(GamLevel level, SceneDirector director, SceneInteractions interactions, Action? dismissPractice = null)
{
StartCarl(level, director, interactions, dismissPractice);
director.Skip();
if (!director.Controlled || interactions.Score != 150 || interactions.Inventory.State(0, 3) != 1
|| interactions.CurrentObjective != 3)
throw new InvalidOperationException("Original lab contact route did not reach the recovered exit state");
interactions.Update(level.Entities.Single(e => e.Tag == "LABTONEIGH").Position);
Console.WriteLine("Lab direct-contact integration: explanation, shrinkray, Carl callback and exit; score150, gadget3, objective3. Navigation was not exercised.");
}
public static void StartCarl(GamLevel level, SceneDirector director, SceneInteractions interactions, Action? dismissPractice = null)
{
if (level.Code != "LV1B") throw new ArgumentException("Lab route check requires original LV1B");
director.Skip();
@@ -22,11 +33,7 @@ public static class LabRouteSmoke
var carl = director.FindActor("C3DCARL")!;
director.SyncActor(player, carl.Position, Vector3.Zero);
interactions.Update(carl.Position);
director.Skip();
if (!director.Controlled || interactions.Score != 150 || interactions.Inventory.State(0, 3) != 1
|| interactions.CurrentObjective != 3)
throw new InvalidOperationException("Original lab contact route did not reach the recovered exit state");
interactions.Update(level.Entities.Single(e => e.Tag == "LABTONEIGH").Position);
Console.WriteLine("Lab direct-contact integration: explanation, shrinkray, Carl callback and exit; score150, gadget3, objective3. Navigation was not exercised.");
if (!director.Playing || director.Controlled || director.CurrentTag != "neutron1a")
throw new InvalidOperationException("Carl dialogue did not start with original control lock");
}
}
+3 -2
View File
@@ -72,7 +72,7 @@ public sealed class SceneHud
/// <summary>Writes the final merged buffer, including when later visual composers copied these vertices.</summary>
public void Update(Mesh destination, int currentObjective, bool objectivesVisible, bool practiceVisible,
float objectiveYOffset = -69)
float objectiveYOffset = -69, bool objectiveContentVisible = true)
{
if (!float.IsFinite(objectiveYOffset) || objectiveYOffset < -480 || objectiveYOffset > 480)
throw new ArgumentOutOfRangeException(nameof(objectiveYOffset));
@@ -83,7 +83,8 @@ public sealed class SceneHud
var draw = destination.Draws.FirstOrDefault(d => d.FirstIndex == quad.FirstIndex && d.ScreenSpace
&& d.IndexCount == 6) ?? throw new ArgumentException("Destination omits HUD draws", nameof(destination));
draw.Visible = quad.Canvas == 169 ? practiceVisible : objectivesVisible && currentObjective is >= 1 and <= 3
&& (quad.Canvas == 156 || quad.Canvas == 119 + currentObjective || quad.Canvas == 82 + currentObjective);
&& (quad.Canvas == 156 || objectiveContentVisible
&& (quad.Canvas == 119 + currentObjective || quad.Canvas == 82 + currentObjective));
var digit = quad.Canvas is >= 83 and <= 85;
var x = quad.Canvas == 169 ? 210f : digit ? 393f : 384f;
var y = quad.Canvas == 169 ? 210f : (quad.Canvas == 156 ? 380f : digit ? 450f : 448f) + objectiveYOffset;
@@ -0,0 +1,42 @@
using System.Numerics;
namespace GamePort.Application;
/// <summary>Original geometry-layer clipping overrides from level initializers.
/// The port currently combines both geometry layers, so it uses their larger far
/// limit. Layer masks and LV4B's task-driven fog/clip transition remain separate.
/// </summary>
public static class SceneProjection
{
public const float NearPlane = 20;
public const float FieldOfView = 0xAAA / 16384f * MathF.Tau;
public static float FarPlane(string? levelCode) => levelCode?.ToUpperInvariant() switch
{
"LV1A" => 5000,
"LV1B" or "LV1C" or "LV4A" or "LV4D" or "LEV7" => 10000,
"LV1D" or "LV1E" => 120000,
"LV1F" => 15000,
"LEV1" => 28000,
"LV2A" => 3500,
"LV2B" or "LEV2" => 50000,
"LV3A" => 80000,
"LV3B" or "LV3C" or "LV3D" or "LV3E" or "LEV3" => 40000,
"LV4B" => 7200,
"LV4C" or "LEV4" => 30000,
"LV5A" or "LV5B" => 16000,
"LEV5" => 12000,
"LV6A" or "LEV6" => 4000,
"VR01" or "VR02" or "VR03" or "VR04" or "VR05" or "VR06" or "VR07" or "VR08" => 50000,
_ => 3200 // Original OMediaLayer constructor default, not a universal level setting.
};
/// <summary>Original positive-Z,0..1 depth perspective. Caller applies the
/// existing Vulkan viewport Y flip, just as for the inspection projection.
/// </summary>
public static Matrix4x4 CreateGameplay(string? levelCode, float aspect)
{
if (!float.IsFinite(aspect) || aspect <= 0) throw new ArgumentOutOfRangeException(nameof(aspect));
return Matrix4x4.CreatePerspectiveFieldOfViewLeftHanded(FieldOfView, aspect, NearPlane, FarPlane(levelCode));
}
}