Integrate source airborne tilt and logical-root rendering
This commit is contained in:
1 parent
a61f1b0284
commit
27be8ed630
36 files changed
+1953
-62
No files matched your search
@@ -18,10 +18,11 @@ public static class BubbleMotion
|
||||
public const float HeldBounceSpeed = 900;
|
||||
|
||||
public static BubbleSteering StepInput(float speed, float turn, PlayerInput input,
|
||||
bool supported, float seconds, float maximumSpeed = MaximumSpeed)
|
||||
bool supported, float seconds, float maximumSpeed = MaximumSpeed,
|
||||
float forwardPitch=-10,float backwardPitch=10)
|
||||
{
|
||||
Validate(speed, turn, seconds);
|
||||
if (!float.IsFinite(maximumSpeed) || maximumSpeed <= 0)
|
||||
if (!float.IsFinite(maximumSpeed) || maximumSpeed <= 0||!float.IsFinite(forwardPitch)||!float.IsFinite(backwardPitch))
|
||||
throw new ArgumentOutOfRangeException(nameof(maximumSpeed));
|
||||
|
||||
var turnStep = AirSteering.TurnAcceleration * seconds;
|
||||
@@ -48,7 +49,7 @@ public static class BubbleMotion
|
||||
}
|
||||
|
||||
turn = Math.Clamp(turn, -TurnLimit, TurnLimit);
|
||||
return new(speed, turn, forward ? -10 : input.Backward ? 10 : 0, -.25f * turn);
|
||||
return new(speed, turn, forward ? forwardPitch : input.Backward ? backwardPitch : 0, -.25f * turn);
|
||||
}
|
||||
|
||||
public static BubbleApply StepApply(float speed, float turn, float yaw, float pitch,
|
||||
|
||||
@@ -9,6 +9,19 @@ public readonly record struct JimmyAirApply(Vector3 Velocity,Vector3 Rotation,fl
|
||||
/// caller phases. Source constraints and observations: jimmy-air-motion.md.</summary>
|
||||
public static class JimmyAirMotion
|
||||
{
|
||||
public const float ForwardPitch = -40;
|
||||
public const float BackwardPitch = 10;
|
||||
|
||||
/// <summary>439DB7..439E33 target write. Pitch seeds belong to the preceding
|
||||
/// apply/constructor phase, not the currently dispatched input mode.</summary>
|
||||
public static Vector3 Destination(PlayerInput input,float yaw,float turn,
|
||||
float forwardPitch=ForwardPitch,float backwardPitch=BackwardPitch)
|
||||
{
|
||||
if(!float.IsFinite(yaw)||!float.IsFinite(turn)||!float.IsFinite(forwardPitch)||!float.IsFinite(backwardPitch))
|
||||
throw new ArgumentOutOfRangeException(nameof(yaw));
|
||||
return new(input.Forward?forwardPitch:input.Backward?backwardPitch:0,yaw,-turn);
|
||||
}
|
||||
|
||||
public static JimmyAirInputState Input(JimmyAirInputState state,PlayerInput input,bool supported,
|
||||
float seconds,float maximumSpeed=600)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace GamePort.Game;
|
||||
|
||||
/// <summary>473540 degree-to-OMT cache and1003FA60 unit-scale local transform.
|
||||
/// Source root is unrotated. OMT1003FC00 subsequently decomposes/re-quantizes its
|
||||
/// render matrix; this helper uses its directly recovered hierarchical basis.
|
||||
/// See docs/gameplay/jimmy-render-transform.md for native evidence/limits.</summary>
|
||||
public static class JimmyRenderTransform
|
||||
{
|
||||
public static int AngleUnits(float degrees)
|
||||
{
|
||||
if (!float.IsFinite(degrees)) throw new ArgumentOutOfRangeException(nameof(degrees));
|
||||
return (int)Math.Truncate(((double)degrees % 360) * 45.51111111111111) & 16383;
|
||||
}
|
||||
|
||||
public static Matrix4x4 Source(Vector3 root, Vector3 euler)
|
||||
{
|
||||
Finite(root);
|
||||
var (sx,cx) = RocketOrientation.Units(AngleUnits(euler.X));
|
||||
var (sy,cy) = RocketOrientation.Units(AngleUnits(euler.Y));
|
||||
var (sz,cz) = RocketOrientation.Units(AngleUnits(euler.Z));
|
||||
//Row-vector convention: Rz(-roll), then Rx(-pitch), then Ry(-yaw).
|
||||
//The translation is the unchanged actor root, independent of all axes.
|
||||
return new(
|
||||
(float)((double)cz*cy-(double)sz*sx*sy), -sz*cx, (float)((double)cz*sy+(double)sz*sx*cy), 0,
|
||||
(float)((double)sz*cy+(double)cz*sx*sy), cz*cx, (float)((double)sz*sy-(double)cz*sx*cy), 0,
|
||||
-cx*sy, sx, cx*cy, 0,
|
||||
root.X, root.Y, root.Z, 1);
|
||||
}
|
||||
|
||||
/// <summary>Modern compatibility adapter, not an original recovered offset.
|
||||
/// A fixed sole-derived correction is local to the model, so full-axis tilt
|
||||
/// remains around the source logical root and upright placement is preserved.</summary>
|
||||
public static Matrix4x4 Aligned(Vector3 root, Vector3 euler, float localYCorrection)
|
||||
{
|
||||
if (!float.IsFinite(localYCorrection)) throw new ArgumentOutOfRangeException(nameof(localYCorrection));
|
||||
return Matrix4x4.CreateTranslation(0,localYCorrection,0) * Source(root,euler);
|
||||
}
|
||||
|
||||
private static void Finite(Vector3 value)
|
||||
{
|
||||
if (!float.IsFinite(value.X) || !float.IsFinite(value.Y) || !float.IsFinite(value.Z))
|
||||
throw new ArgumentOutOfRangeException(nameof(value));
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,12 @@ public sealed class LabSimulation
|
||||
private readonly Func<Vector3, Vector3, SupportHit?>? ceilingRay;
|
||||
private readonly OriginalBodyPhysics? originalBody;
|
||||
private readonly PlayerEnergy energy;
|
||||
private readonly Vector3 sourceStart;
|
||||
private readonly float startYaw, modelMinimumY, rootHeight, startFloor;
|
||||
private readonly Vector3 sourceStart, sourceRotation;
|
||||
private readonly float modelMinimumY, rootHeight, startFloor;
|
||||
private float targetYaw, extraAirAcceleration, shadowDistance, lateralContribution;
|
||||
private float targetPitch, targetRoll;
|
||||
private float forwardAirPitch, backwardAirPitch;
|
||||
private bool facingDirty;
|
||||
private int? retainedSupportMaterial;
|
||||
private bool bubbleLoop;
|
||||
private PlayerPose bubblePose;
|
||||
@@ -53,7 +55,11 @@ public sealed class LabSimulation
|
||||
public float MaximumSpeed { get; private set; } = RecoveredMotion.MaximumSpeed;
|
||||
public float Pitch { get; private set; }
|
||||
public float Roll { get; private set; }
|
||||
public bool TracksBubbleOrientation { get; private set; }
|
||||
public Vector3 Rotation => new(Pitch,Yaw,Roll);
|
||||
public Vector3 FacingTarget => new(targetPitch,targetYaw,targetRoll);
|
||||
public bool FacingDirty => facingDirty;
|
||||
public float ForwardAirPitch => forwardAirPitch;
|
||||
public float BackwardAirPitch => backwardAirPitch;
|
||||
public int BubbleBounces { get; private set; }
|
||||
public int GadgetMode
|
||||
{
|
||||
@@ -71,7 +77,6 @@ public sealed class LabSimulation
|
||||
if (Energy <= 0 && !IgnoresGadgetEnergy || Bubble.Active || Bubble.Expanding || Bubble.Collapsing) return;
|
||||
InteractionRadius=160; BodyFactor=.415f; movementMode=2; MaximumSpeed=1350;
|
||||
bubblePose=previousPose;
|
||||
TracksBubbleOrientation=true;
|
||||
gadgetMode=0; Bubble.Start();
|
||||
if (!bubbleLoop) { GadgetSound?.Invoke(2,true); bubbleLoop=true; }
|
||||
return;
|
||||
@@ -139,15 +144,23 @@ public sealed class LabSimulation
|
||||
public Vector3 ActorRoot => Position + Vector3.UnitY * rootHeight;
|
||||
public Vector3 CameraEye { get; private set; }
|
||||
public Vector3 CameraTarget => grapplerCameraTarget??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));
|
||||
//Preserve upright sole placement as a modern local correction, while the
|
||||
//recovered full-axis rotation and unrotated translation use the actor root.
|
||||
public Matrix4x4 Model => JimmyRenderTransform.Aligned(ActorRoot,Rotation,-modelMinimumY-rootHeight);
|
||||
|
||||
public LabSimulation(SceneCollision collision, Mesh standingPose, Vector3 start, float yaw,
|
||||
Func<Vector3, Vector3, SupportHit?>? cameraRay = null,
|
||||
Func<Vector3, Vector3, SupportHit?>? ceilingRay = null,
|
||||
OriginalStaticCollision? originalCollision = null, PlayerEnergy? energy = null)
|
||||
: this(collision,standingPose,start,new Vector3(0,yaw,0),cameraRay,ceilingRay,originalCollision,energy) { }
|
||||
|
||||
public LabSimulation(SceneCollision collision, Mesh standingPose, Vector3 start, Vector3 rotation,
|
||||
Func<Vector3, Vector3, SupportHit?>? cameraRay = null,
|
||||
Func<Vector3, Vector3, SupportHit?>? ceilingRay = null,
|
||||
OriginalStaticCollision? originalCollision = null, PlayerEnergy? energy = null)
|
||||
{
|
||||
if(!float.IsFinite(rotation.X)||!float.IsFinite(rotation.Y)||!float.IsFinite(rotation.Z))
|
||||
throw new ArgumentOutOfRangeException(nameof(rotation));
|
||||
this.collision = collision;
|
||||
this.cameraRay = cameraRay;
|
||||
this.ceilingRay = ceilingRay;
|
||||
@@ -157,7 +170,7 @@ public sealed class LabSimulation
|
||||
Invisible.BlendRequested += Appearance.SetBlend;
|
||||
Baseball.Thrown += () => GadgetSound?.Invoke(10,false);
|
||||
sourceStart = start;
|
||||
startYaw = yaw;
|
||||
sourceRotation = rotation;
|
||||
var bounds = standingPose.Bounds();
|
||||
modelMinimumY = bounds.Min.Y;
|
||||
BodyHeight = bounds.Max.Y - bounds.Min.Y;
|
||||
@@ -181,13 +194,14 @@ public sealed class LabSimulation
|
||||
Baseball.Reset();
|
||||
if (gadgetMode == 6) gadgetMode = -1;
|
||||
Bubble.Reset(); FloorState.Reset(); Appearance.Reset(); retainedSupportMaterial=null;
|
||||
Pitch=Roll=targetPitch=targetRoll=0; BubbleBounces=0;
|
||||
TracksBubbleOrientation=false;
|
||||
Pitch=sourceRotation.X;Roll=sourceRotation.Z;
|
||||
targetPitch=targetYaw=targetRoll=0;facingDirty=false;BubbleBounces=0;
|
||||
forwardAirPitch=JimmyAirMotion.ForwardPitch;backwardAirPitch=JimmyAirMotion.BackwardPitch;
|
||||
MaximumSpeed=RecoveredMotion.MaximumSpeed; BodyFactor=OriginalBodySupport.JimmyFactor;
|
||||
var floor = collision.GroundHeight(sourceStart, 2500)!.Value;
|
||||
Position = new(sourceStart.X, floor + (UsesOriginalBody ? 0 : SceneCollision.Skin), sourceStart.Z);
|
||||
Velocity = Vector3.Zero;
|
||||
Yaw = targetYaw = startYaw;
|
||||
Yaw = sourceRotation.Y;
|
||||
Speed = PublishedSpeed = TurnRate = extraAirAcceleration = shadowDistance = 0;
|
||||
lateralContribution = 0; pendingImpulse = Vector3.Zero; movementMode = 0;
|
||||
keyboardTurn=false;hasSupportPolygon=false;
|
||||
@@ -214,7 +228,8 @@ public sealed class LabSimulation
|
||||
}
|
||||
|
||||
public PlayerLevelState? CaptureLevelState(int selectedGadget) => Noclip ? null
|
||||
: new(LevelCode, selectedGadget, movementMode, jumpState.HoldSeconds, jumpState.EffectRemaining);
|
||||
: new(LevelCode, selectedGadget, movementMode, jumpState.HoldSeconds, jumpState.EffectRemaining,
|
||||
forwardAirPitch,backwardAirPitch);
|
||||
|
||||
/// <summary>Apply after destination construction. Init re-applies authored
|
||||
/// body vectors and clears speed/turn; PostLoad resets jump, not these scalars.
|
||||
@@ -224,10 +239,12 @@ public sealed class LabSimulation
|
||||
ArgumentNullException.ThrowIfNull(state);
|
||||
if (!state.SupportsDestination(LevelCode)) return false;
|
||||
if (state.MovementMode is < 0 or > 1 || !float.IsFinite(state.HoldSeconds)
|
||||
|| state.HoldSeconds < 0 || !float.IsFinite(state.EffectRemaining))
|
||||
|| state.HoldSeconds < 0 || !float.IsFinite(state.EffectRemaining)
|
||||
|| !float.IsFinite(state.ForwardPitch)||!float.IsFinite(state.BackwardPitch))
|
||||
throw new ArgumentOutOfRangeException(nameof(state));
|
||||
movementMode = state.MovementMode;
|
||||
jumpState = new(0, state.HoldSeconds, state.EffectRemaining);
|
||||
forwardAirPitch=state.ForwardPitch;backwardAirPitch=state.BackwardPitch;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -295,10 +312,9 @@ public sealed class LabSimulation
|
||||
public void EnterScooter()
|
||||
{
|
||||
CancelPoweredFlight(); //425120 only cancels mode1 jump/effect.
|
||||
TracksBubbleOrientation=true;
|
||||
}
|
||||
public void ApplyScooterTransform(Vector3 root,Vector3 rotation)
|
||||
{ApplyAuthoredTransform(root,rotation.Y);Pitch=rotation.X;Roll=rotation.Z;targetPitch=Pitch;targetRoll=Roll;targetYaw=Yaw;}
|
||||
{ApplyAuthoredTransform(root,rotation);SetFacingDestination(rotation);}
|
||||
public void LeaveScooter(Vector3 root,Vector3 rotation,Vector3 eye)
|
||||
{
|
||||
ApplyScooterTransform(root+Vector3.UnitY*40,rotation);
|
||||
@@ -342,11 +358,6 @@ public sealed class LabSimulation
|
||||
}
|
||||
|
||||
public void FlattenOrientation() { Pitch=Roll=0; }
|
||||
public void SeedBubbleTilt(Vector3 euler)
|
||||
{
|
||||
if (TracksBubbleOrientation) return;
|
||||
Pitch=targetPitch=euler.X; Roll=targetRoll=euler.Z;
|
||||
}
|
||||
|
||||
private void StepFloorPolicy()
|
||||
{
|
||||
@@ -384,6 +395,13 @@ public sealed class LabSimulation
|
||||
Position = root - Vector3.UnitY * rootHeight; Yaw = yaw;
|
||||
}
|
||||
|
||||
public void ApplyAuthoredTransform(Vector3 root,Vector3 rotation)
|
||||
{
|
||||
if(!float.IsFinite(rotation.X)||!float.IsFinite(rotation.Y)||!float.IsFinite(rotation.Z))
|
||||
throw new ArgumentOutOfRangeException(nameof(rotation));
|
||||
ApplyAuthoredTransform(root,rotation.Y);Pitch=rotation.X;Roll=rotation.Z;
|
||||
}
|
||||
|
||||
/// <summary>Modern debug movement; never serialized into original save state.</summary>
|
||||
public bool SetNoclip(bool enabled)
|
||||
{
|
||||
@@ -410,7 +428,9 @@ public sealed class LabSimulation
|
||||
Velocity = pendingImpulse = Vector3.Zero;
|
||||
Speed = PublishedSpeed = TurnRate = extraAirAcceleration = lateralContribution = 0;
|
||||
jumpState = default; movementMode = 0; forceFall = JetpackEffectVisible = false;
|
||||
targetYaw = Yaw;
|
||||
//Modern debug stop freezes the retained facing request as well as body
|
||||
//motion. Otherwise entering noclip can leave a queued airborne lean.
|
||||
targetPitch=Pitch;targetYaw=Yaw;targetRoll=Roll;facingDirty=false;
|
||||
}
|
||||
|
||||
public bool ReturnToNoclipEntry()
|
||||
@@ -451,26 +471,25 @@ public sealed class LabSimulation
|
||||
//does not invent a hold timer or admit its seeded auto-turn branch.
|
||||
var ground=JimmyGroundMotion.Input(new(Speed,targetYaw),Yaw,input,MaximumSpeed,
|
||||
blockBackward:(GadgetMode is -1 or 3)&&input.Fire);
|
||||
Speed=ground.State.Speed;targetYaw=ground.State.TargetYaw;lateralContribution=ground.Lateral;
|
||||
Speed=ground.State.Speed;lateralContribution=ground.Lateral;
|
||||
if(input.Left||input.Right)keyboardTurn=true;
|
||||
if(ground.HeadingUpdated)targetPitch=targetRoll=0;
|
||||
if(ground.HeadingUpdated)SetFacingDestination(new(0,ground.State.TargetYaw,0));
|
||||
}
|
||||
else if (movementMode==2)
|
||||
{
|
||||
var steering=BubbleMotion.StepInput(Speed,TurnRate,input,Grounded,dt,MaximumSpeed);
|
||||
var steering=BubbleMotion.StepInput(Speed,TurnRate,input,Grounded,dt,MaximumSpeed,forwardAirPitch,backwardAirPitch);
|
||||
Speed=steering.Speed; TurnRate=steering.TurnRate;
|
||||
if(input.Left||input.Right)keyboardTurn=true;
|
||||
targetPitch=steering.TargetPitch; targetRoll=steering.TargetRoll; targetYaw=Yaw;
|
||||
SetFacingDestination(new(steering.TargetPitch,Yaw,steering.TargetRoll));
|
||||
}
|
||||
else
|
||||
{
|
||||
var steering = JimmyAirMotion.Input(new(Speed,TurnRate,keyboardTurn),input,Grounded,dt,MaximumSpeed);
|
||||
Speed = steering.Speed; TurnRate = steering.TurnRate;
|
||||
keyboardTurn=steering.KeyboardTurn;
|
||||
if (TracksBubbleOrientation) { targetPitch=0; targetRoll=-TurnRate; }
|
||||
//439E2B preserves current yaw as the destination; air apply then
|
||||
//438011..43802B adds the independent turn rate directly to yaw.
|
||||
targetYaw = Yaw;
|
||||
SetFacingDestination(JimmyAirMotion.Destination(input,Yaw,TurnRate,forwardAirPitch,backwardAirPitch));
|
||||
}
|
||||
Baseball.StepCameraInput(input);
|
||||
StepCamera(); //438BC0/439900 input path owns follow; still provisional geometry/state.
|
||||
@@ -497,16 +516,22 @@ public sealed class LabSimulation
|
||||
|
||||
private void StepFacing()
|
||||
{
|
||||
var rotation=JimmyOrientation.Step(new(Pitch,Yaw,Roll),new(targetPitch,targetYaw,targetRoll),FixedStepClock.Step);
|
||||
var before=Rotation;
|
||||
var rotation=JimmyOrientation.Step(before,FacingTarget,FixedStepClock.Step,dirty:facingDirty);
|
||||
if(facingDirty)facingDirty=before!=FacingTarget;
|
||||
Pitch=rotation.X;Yaw=rotation.Y;Roll=rotation.Z;
|
||||
}
|
||||
|
||||
private void SetFacingDestination(Vector3 target)
|
||||
{targetPitch=target.X;targetYaw=target.Y;targetRoll=target.Z;facingDirty=true;}
|
||||
|
||||
private void StepPlayer(PlayerInput input)
|
||||
{
|
||||
ControllerSteps++;
|
||||
const float dt = FixedStepClock.Step;
|
||||
if (movementMode==2)
|
||||
{
|
||||
forwardAirPitch=-10;backwardAirPitch=10; //43880A/438814, after input when fresh.
|
||||
var bubble=BubbleMotion.StepApply(Speed,TurnRate,Yaw,Pitch,Velocity,Grounded,input.Jump,dt);
|
||||
Velocity=bubble.Velocity; Yaw=bubble.Yaw; Speed=bubble.Speed; PublishedSpeed=Speed;
|
||||
if (Grounded) { BubbleBounces++; if (bubble.Boing) GadgetSound?.Invoke(106,false); }
|
||||
@@ -528,6 +553,7 @@ public sealed class LabSimulation
|
||||
}
|
||||
else
|
||||
{
|
||||
forwardAirPitch=JimmyAirMotion.ForwardPitch;backwardAirPitch=JimmyAirMotion.BackwardPitch;
|
||||
var airMotion=JimmyAirMotion.Apply(Speed,TurnRate,new(Pitch,Yaw,Roll),Velocity,dt);
|
||||
velocity=airMotion.Velocity;Pitch=airMotion.Rotation.X;Yaw=airMotion.Rotation.Y;Roll=airMotion.Rotation.Z;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ namespace GamePort.Game;
|
||||
/// Other gadget cleanup branches/levels need their own lifecycle proof.
|
||||
/// </summary>
|
||||
public sealed record PlayerLevelState(string SourceLevel, int SelectedGadget,
|
||||
int MovementMode, float HoldSeconds, float EffectRemaining)
|
||||
int MovementMode, float HoldSeconds, float EffectRemaining,
|
||||
float ForwardPitch=JimmyAirMotion.ForwardPitch,float BackwardPitch=JimmyAirMotion.BackwardPitch)
|
||||
{
|
||||
public bool SupportsDestination(string level) => IsRoute(SourceLevel) && IsRoute(level)
|
||||
&& SelectedGadget is -1 or 3;
|
||||
|
||||
@@ -65,14 +65,12 @@ public sealed class PlayerSceneBinding : IDisposable
|
||||
if(Rocketship is{Mounted:true} rocket)
|
||||
{
|
||||
//43DF70 copies passenger transforms and reasserts ship ownership.
|
||||
player.ApplyAuthoredTransform(rocket.Root,rocket.Rotation.Y);
|
||||
player.ApplyAuthoredTransform(rocket.Root,rocket.Rotation);
|
||||
director.TransferControl(rocket.Actor);
|
||||
if(player.InputAfterPlayerUpdate&&VehicleControl())rocket.StepInput(input,FixedStepClock.Step);
|
||||
}
|
||||
if (player.GadgetMode==0 && player.Grounded && director.FindActor(tag) is{} actor) actor.Animation="STOP";
|
||||
var rotation=director.FindActor(tag)?.Rotation ?? Vector3.Zero;
|
||||
director.SyncActor(tag,player.ActorRoot,Rocketship is{Mounted:true} vehicle?vehicle.Rotation:player.TracksBubbleOrientation
|
||||
? new(player.Pitch,player.Yaw,player.Roll) : rotation with{Y=player.Yaw});
|
||||
director.SyncActor(tag,player.ActorRoot,player.Rotation);
|
||||
return acceptsInput;
|
||||
}
|
||||
|
||||
@@ -115,7 +113,6 @@ public sealed class PlayerSceneBinding : IDisposable
|
||||
player.LeaveRocketship(Rocketship.CameraEye);
|
||||
if(director.FindActor(tag) is{} rider){rider.Animation="FALL";director.TransferControl(rider);}
|
||||
}
|
||||
if (item==0 && director.FindActor(tag) is{} actor) player.SeedBubbleTilt(actor.Rotation);
|
||||
//The display tile remains available for Practice outside the bounded
|
||||
//live scene; unsupported selection must not invent a Jimmy flight mode.
|
||||
player.GadgetMode=item==1&&Rocketship==null||item==4&&Scooter==null?-1:GadgetScreen.EquippedMode(item);
|
||||
@@ -164,7 +161,7 @@ public sealed class PlayerSceneBinding : IDisposable
|
||||
private void Transform(DirectorActor actor)
|
||||
{
|
||||
if (string.Equals(actor.Tag, tag, StringComparison.OrdinalIgnoreCase))
|
||||
player.ApplyAuthoredTransform(actor.Position, actor.Rotation.Y);
|
||||
player.ApplyAuthoredTransform(actor.Position, actor.Rotation);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
+13
-6
@@ -358,7 +358,7 @@ internal static class Program
|
||||
var cameraRay = level!.Code is "LV1B" or "VR01" or "VR02" or "VR04" or "VR05" or "VR07" or "VR08" or "LEV1"
|
||||
? OriginalCameraRay.FromRouteScene(world, level.Code) : null;
|
||||
debugCameraRay = cameraRay;
|
||||
simulation = new LabSimulation(new SceneCollision(world), standingPose, originalStart.Position, originalStart.Rotation.Y,
|
||||
simulation = new LabSimulation(new SceneCollision(world), standingPose, originalStart.Position, originalStart.Rotation,
|
||||
cameraRay == null ? null : (look, eye) => cameraRay.Trace(look, eye),
|
||||
cameraRay == null ? null : (start, end) => cameraRay.TraceGeometry(start, end),
|
||||
level.Code is "VR01" or "VR02" or "VR04" or "VR07" or "VR08" ? OriginalStaticCollision.FromRouteScene(world,level.Code) : null, energy)
|
||||
@@ -664,7 +664,7 @@ internal static class Program
|
||||
baseballs?.Reset();
|
||||
interactions!.Reset();
|
||||
mechanisms!.Reset();
|
||||
director.SyncActor(level!.Player!.Tag!, simulation!.ActorRoot, new Vector3(0, simulation.Yaw, 0));
|
||||
director.SyncActor(level!.Player!.Tag!, simulation!.ActorRoot, simulation.Rotation);
|
||||
if (returning && director.FindActor("C3DGODDARD") is { } companion)
|
||||
director.SyncActor(companion.Tag, returnRoot, companion.Rotation); //423AE3..423B1E, no offset.
|
||||
if (practiceReturnSmoke && returning)
|
||||
@@ -684,7 +684,7 @@ internal static class Program
|
||||
interactions.Inventory.SetState(0, 3, 1); interactions.Inventory.SelectGadget(3);
|
||||
simulation.ApplyRetainedLevelState(new("LV1B", 3, 1, .625f, 6.125f));
|
||||
simulation.RestoreReturnRoot(simulation.ActorRoot + Vector3.UnitY * 200);
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, new(0, simulation.Yaw, 0));
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, simulation.Rotation);
|
||||
director.Trigger("neutron1a");
|
||||
}
|
||||
if (practiceReturnSmoke && level.Code == "VR04")
|
||||
@@ -726,7 +726,7 @@ internal static class Program
|
||||
// Move the real player away from STRT so an accidental
|
||||
// restart at the authored spawn cannot pass this check.
|
||||
for (var tick = 0; tick < 45; tick++) simulation.Step(new(true, false, false, false, false));
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, new(0, simulation.Yaw, 0));
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, simulation.Rotation);
|
||||
}
|
||||
director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
|
||||
director.Skip();
|
||||
@@ -862,7 +862,7 @@ internal static class Program
|
||||
director!.EnsureCompanion(ray.TraceGeometry(simulation.ActorRoot,behind)==null?behind:originalStart!.Position,Vector3.Zero);
|
||||
}
|
||||
interactions?.Reset(); mechanisms?.Reset(); gadgets?.Reset(); baseballs?.Reset(); mouseFire = false;
|
||||
director?.SyncActor(level!.Player!.Tag!, simulation.ActorRoot, new Vector3(0, simulation.Yaw, 0));
|
||||
director?.SyncActor(level!.Player!.Tag!, simulation.ActorRoot, simulation.Rotation);
|
||||
}
|
||||
void ToggleCamera()
|
||||
{
|
||||
@@ -1026,7 +1026,7 @@ internal static class Program
|
||||
if (simulation == null) return;
|
||||
characterModel = simulation.Model;
|
||||
if (level?.Player?.Tag is { } tag)
|
||||
director?.SyncActor(tag, simulation.ActorRoot, new Vector3(0, simulation.Yaw, 0));
|
||||
director?.SyncActor(tag, simulation.ActorRoot, simulation.Rotation);
|
||||
}
|
||||
Vector2 Pointer()
|
||||
{
|
||||
@@ -1436,6 +1436,13 @@ internal static class Program
|
||||
}
|
||||
renderer.UpdateVertices(mesh.Vertices);
|
||||
renderer.Render(view * projection);
|
||||
if(simulation!=null&&((jetpackSmoke&&count is 74 or 109)||(walkSmoke&&count==89)))
|
||||
{
|
||||
var stage=jetpackSmoke?(count==74?"air-forward":"air-brake"):"air";
|
||||
Console.WriteLine($"Movement {stage}: step={simulation.Steps}, Euler={simulation.Rotation}, target={simulation.FacingTarget}, speed={simulation.Speed:F3}, velocity={simulation.Velocity}.");
|
||||
if(Option(args,"--screenshot") is{} capture)
|
||||
renderer.SavePpm(Path.ChangeExtension(capture,$".{stage}.ppm"));
|
||||
}
|
||||
if(scooterFixture!=null)
|
||||
{
|
||||
scooterFixture.AfterFrame(count);
|
||||
|
||||
Reference in new issue
Block a user