diff --git a/zzre.core/imgui/WindowContainer.cs b/zzre.core/imgui/WindowContainer.cs index bc170c40..b3bbadf0 100644 --- a/zzre.core/imgui/WindowContainer.cs +++ b/zzre.core/imgui/WindowContainer.cs @@ -115,7 +115,9 @@ public void BeginEventUpdate(GameTime time) private bool HandleEvent(SdlWindow window, Event ev) { - if ((EventType)ev.Type is EventType.Keydown or EventType.Keyup && (KeyCode)ev.Key.Keysym.Sym is not KeyCode.KPrintscreen) + if ((EventType)ev.Type is EventType.Keydown or EventType.Keyup && + (KeyCode)ev.Key.Keysym.Sym is not KeyCode.KPrintscreen && + ev.Key.Repeat == 0) { FocusedWindow?.HandleKeyEvent((KeyCode)ev.Key.Keysym.Sym, (EventType)ev.Type is EventType.Keydown); return FocusedWindow != null; diff --git a/zzre/game/systems/player/FairyPhysics.cs b/zzre/game/systems/player/FairyPhysics.cs index a0a2dbd6..80d9526f 100644 --- a/zzre/game/systems/player/FairyPhysics.cs +++ b/zzre/game/systems/player/FairyPhysics.cs @@ -310,7 +310,6 @@ private void ApplyJumps( velocityComp.Value.Y < MaxJumpVelocity) { velocityComp.Value += Vector3.UnitY * JumpVelocity; - controls.Jumps = false; // TODO: CHECK THIS, this is not original } } diff --git a/zzre/game/systems/player/PlayerControls.cs b/zzre/game/systems/player/PlayerControls.cs index 9ca34eb3..56f3aa57 100644 --- a/zzre/game/systems/player/PlayerControls.cs +++ b/zzre/game/systems/player/PlayerControls.cs @@ -76,7 +76,6 @@ protected override void Update(float elapsedTime, ref components.PlayerControls component.GoesBackward = nextControls.GoesBackward; component.GoesRight = nextControls.GoesRight; component.GoesLeft = nextControls.GoesLeft; - component.SwitchesSpells = nextControls.SwitchesSpells; if (nextControls.Shoots) component.FrameCountShooting++; @@ -85,10 +84,22 @@ protected override void Update(float elapsedTime, ref components.PlayerControls // Jump is weird, it is set by the physics system (both true and false) // so we should override it with care - if (jumpChanged) + if (jumpLockDuration > 0f) { + if (jumpChanged) + { + component.Jumps = nextControls.Jumps; + jumpChanged = false; + } + } + else + { + // however only in Overworld. In Duels the jumps and spell switches + // are only active for a single frame component.Jumps = nextControls.Jumps; - jumpChanged = false; + component.SwitchesSpells = nextControls.SwitchesSpells; + nextControls.Jumps = false; + nextControls.SwitchesSpells = false; } }