diff --git a/TSOClient/tso.simantics/VMContext.cs b/TSOClient/tso.simantics/VMContext.cs index 8544a0b63..0462ead50 100644 --- a/TSOClient/tso.simantics/VMContext.cs +++ b/TSOClient/tso.simantics/VMContext.cs @@ -538,6 +538,7 @@ public void InitSpecialTuning() DisableAvatarCollision = (VM.Tuning.GetTuning("special", 0, 1) ?? 0f) > 0; var minLight = VM.Tuning.GetTuning("special", 0, 2); _3DFloorGeometry.af2019 = VM.Tuning.GetTuning("aprilfools", 0, 2019) == 1; + SM64Component.Allowed = VM.Tuning.GetTuning("platformer", 0, 0) == 1; if (DisableAvatarCollision) { diff --git a/TSOClient/tso.world/Components/SM64Component.cs b/TSOClient/tso.world/Components/SM64Component.cs index 15c907412..ccdef21ee 100644 --- a/TSOClient/tso.world/Components/SM64Component.cs +++ b/TSOClient/tso.world/Components/SM64Component.cs @@ -195,6 +195,8 @@ public class SM64Component : IDisposable private static AnimSource AnimData; + public static bool Allowed; + private Blueprint Bp; internal WorldState State; private Collision Collision = new Collision(); @@ -370,7 +372,7 @@ public sbyte DetermineLevel(Vector3 pos, bool forLight) sbyte level = (sbyte)(Math.Max(0, Math.Min(Bp.Stories - 1, Math.Floor((height + 0.5f) / 2.95f))) + 1); - return forLight || TileIndoors((int)pos.X, (int)pos.Y, level) ? level : (sbyte)(Bp.Stories - 1); + return forLight || TileIndoors((int)pos.X, (int)pos.Y, level) ? level : Bp.Stories; } public void RemoveMario(AvatarComponent avatar) @@ -564,12 +566,15 @@ public void Update(GraphicsDevice device, WorldState world, bool visible) if (!MarioActiveForMe) { - var gamepad = GamePad.GetState(0); - - if (gamepad.IsConnected && visible) + if (Allowed) { - MarioActiveForMe = true; - InitCollision(world); + var gamepad = GamePad.GetState(0); + + if (gamepad.IsConnected && visible) + { + MarioActiveForMe = true; + InitCollision(world); + } } return; @@ -619,6 +624,12 @@ public void Update(GraphicsDevice device, WorldState world, bool visible) // TODO: displacement? (on top of interpolated movement objects? we only really have cars and ducks lol) Mario.MarioUpdate(); + if (Mario.State.HurtCounter == 0 && Mario.State.Health < 2176 && Mario.State.Health > 0) + { + // Slowly heal over time (about 35 seconds for a full heal) + Mario.State.Health += 2; + } + if (Mario.Floor == null) return; // TODO: update_mario_platform (also displacement related) diff --git a/TSOClient/tso.world/World.cs b/TSOClient/tso.world/World.cs index 11326db93..88f8f40f6 100644 --- a/TSOClient/tso.world/World.cs +++ b/TSOClient/tso.world/World.cs @@ -491,7 +491,7 @@ public void CenterTo(EntityComponent comp) { if (comp.Room == 0 || comp.Room == 65531) return; //don't center if the target is out of bounds - bool isFirstPerson = State.CameraMode == CameraRenderMode._3D && State.Cameras.ActiveType == CameraControllerType.FirstPerson; + bool isFirstPerson = State.Cameras.ActiveType == CameraControllerType.Direct; sbyte level = comp.Level; Vector3 pelvisCenter;