Implement Baseball aiming, pooled projectiles and VR07 targets

This commit is contained in:
UnixNight committed 2026-11-02 22:54:19 -05:00
1 parent 50fcb87d90
commit d6ca417e9e
50 files changed
+3149 -32

No files matched your search

+11 -2
View File
@@ -41,6 +41,7 @@ public sealed class LabSimulation
public string LevelCode { get; set; } = "LV1B";
public InvisibleGadget Invisible { get; } = new();
public BubbleEffect Bubble { get; } = new();
public BaseballGadget Baseball { get; } = new();
public PlayerAppearance Appearance { get; } = new();
public Vr01FloorState FloorState { get; } = new();
public Vector3 BubbleRoot { get; private set; }
@@ -58,6 +59,7 @@ public sealed class LabSimulation
var previousPose=Pose;
if (gadgetMode == 0) ReleaseBubble();
if (gadgetMode == 2) Invisible.Release();
if (gadgetMode == 6) Baseball.Release();
gadgetMode = -1;
if (value == 0)
{
@@ -70,6 +72,7 @@ public sealed class LabSimulation
return;
}
if (value == 2 && !Invisible.Equip(Energy, IgnoresGadgetEnergy)) return;
if (value == 6) Baseball.Equip();
gadgetMode = value;
}
}
@@ -124,7 +127,7 @@ public sealed class LabSimulation
public Func<Vector3, Vector3, float, Vector3>? DynamicRootResolver { get; set; }
public Vector3 ActorRoot => Position + Vector3.UnitY * rootHeight;
public Vector3 CameraEye { get; private set; }
public Vector3 CameraTarget => ActorRoot + new Vector3(0, 99, 0);
public Vector3 CameraTarget => ActorRoot + new Vector3(0, 80 + 1.9f * Baseball.CameraPitch, 0);
public Matrix4x4 Model => Matrix4x4.CreateRotationZ(-(TracksBubbleOrientation?Roll:0) * MathF.PI / 180)
* Matrix4x4.CreateRotationX(-(TracksBubbleOrientation?Pitch:0) * MathF.PI / 180) * Matrix4x4.CreateRotationY(-Yaw * MathF.PI / 180)
* Matrix4x4.CreateTranslation(Position - new Vector3(0, modelMinimumY, 0));
@@ -141,6 +144,7 @@ public sealed class LabSimulation
this.energy = energy ?? new PlayerEnergy();
Invisible.AlphaRequested += Appearance.SetAlpha;
Invisible.BlendRequested += Appearance.SetBlend;
Baseball.Thrown += () => GadgetSound?.Invoke(10,false);
sourceStart = start;
startYaw = yaw;
var bounds = standingPose.Bounds();
@@ -161,6 +165,8 @@ public sealed class LabSimulation
if (gadgetMode == 0) { GadgetMode=-1; DefaultGadgetRequested?.Invoke(); }
if (gadgetMode == 2) gadgetMode = -1;
Invisible.Reset();
Baseball.Reset();
if (gadgetMode == 6) gadgetMode = -1;
Bubble.Reset(); FloorState.Reset(); Appearance.Reset(); retainedSupportMaterial=null;
Pitch=Roll=targetPitch=targetRoll=0; BubbleBounces=0;
TracksBubbleOrientation=false;
@@ -404,6 +410,7 @@ public sealed class LabSimulation
//438011..43802B adds the independent turn rate directly to yaw.
targetYaw = Yaw;
}
Baseball.StepCameraInput(input);
StepCamera(); //438BC0/439900 input path owns follow; still provisional geometry/state.
if (movementMode==2)
{
@@ -415,6 +422,8 @@ public sealed class LabSimulation
BubbleRoot=ActorRoot+Vector3.UnitY*50-direction*80;
}
InputActions?.Invoke(input);
Baseball.StepInput(input,ActorRoot,new(Pitch,Yaw,Roll),Grounded,Energy,IgnoresGadgetEnergy,
StopForPrimaryFire,SetShooting,AdjustEnergy);
}
private void StepPlayer(PlayerInput input)
@@ -541,7 +550,7 @@ public sealed class LabSimulation
private (Vector3 Eye, float Gain) DesiredEye()
{
var (sin, cos) = Trig(Yaw);
var eye = ActorRoot + new Vector3(sin * 350, 180, -cos * 350);
var eye = ActorRoot + new Vector3(sin * 350, Baseball.CameraHeight - 2 * Baseball.CameraPitch, -cos * 350);
if (Noclip) return (eye, 1); // Debug exploration also bypasses camera obstruction.
if (cameraRay == null) return (collision.ClipCamera(CameraTarget, eye), 1);
//43B820: query from the computed look target; first accepted static hit