From a3d7ba4dd7c9486fec1d970924556d4081fada32 Mon Sep 17 00:00:00 2001 From: nek0 Date: Wed, 13 Feb 2019 12:09:41 +0100 Subject: [PATCH] make tolerance dependant on frame rate --- src/NPC.hs | 2 +- src/Util.hs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NPC.hs b/src/NPC.hs index b695804..e48caa5 100644 --- a/src/NPC.hs +++ b/src/NPC.hs @@ -103,7 +103,7 @@ updateNPCs imgmat ws rrp dt = do if not (null path) then do let itarget = fmap (+ 0.5) (fromIntegral <$> head path) :: V2 Double - if distance pos' itarget < 0.1 + if distance pos' itarget < 1.5 * dt then return (Nothing, unchanged { npcMoveState = Set $ NPCWalking (tail path) diff --git a/src/Util.hs b/src/Util.hs index 79c5fb8..baf177b 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -330,6 +330,7 @@ emitJoyActionMessage (MsgJoystickButton time _ but SDL.JoyButtonPressed) = do case tmap Map.!? (ButtonAction but SDL.JoyButtonPressed) of Just act -> partEmit t (ActionMessage act time) _ -> return () + _ -> return () emitJoyActionMessage _ = return () emitKbdActionMessage :: KeyboardMessage -> Affection UserData () @@ -346,6 +347,7 @@ emitKbdActionMessage (MsgKeyboardEvent time _ press False sym) = do Just (ActRight _) -> partEmit t (ActionMessage (ActRight val) time) Just act -> when (press == SDL.Pressed) (partEmit t (ActionMessage act time)) _ -> return () + _ -> return () emitKbdActionMessage _ = return () fullClean :: Affection UserData ()