Cleanup, move towards unifying zones

This commit is contained in:
2021-09-11 15:52:43 +01:00
parent 27e4f16dd9
commit aa7413a29f
57 changed files with 157 additions and 331 deletions
+2 -13
View File
@@ -1,9 +1,10 @@
{- | Deals with moving creature wall collisions. -}
module Dodge.WallCreatureCollisions where
import Dodge.Data
import Dodge.Data.DamageType
import Dodge.Creature.State.Data
import Dodge.Debug.Flag.Data
import Dodge.Base.Zone
import Dodge.Zone
import Geometry
import Data.List
@@ -31,14 +32,6 @@ colCrWall w c
wallPoints = nub $ concatMap (\(x,y) -> [x,y]) ls
noclipIsOn = _noClip $ _debugFlags w
-- colCrPushThrough :: World -> Creature -> Creature
-- colCrPushThrough w cr = set crPos (checkPushThroughs rad p1 p2 ls) cr
-- where rad = _crRad cr + wallBuffer
-- p1 = _crOldPos cr
-- p2 = _crPos cr
-- ls = IM.elems $ fmap _wlLine $ wallsNearPoint p2 w
-- -- probably best to push check pushing through walls before creature springs
-- the amount to push creatures out from walls, extra to their radius
wallBuffer :: Float
wallBuffer = 0
@@ -108,8 +101,4 @@ checkPushThrough cp1 cp2 (wp1,wp2)
| isPushedThrough = intersectSegSeg cp1 cp2 wp1 wp2
| otherwise = Nothing
where
--norm = errorNormalizeV 61 $ vNormal (wp1 -.- wp2)
--wp1' = (rad *.* norm) +.+ wp1
--wp2' = (rad *.* norm) +.+ wp2
--newP = errorClosestPointOnLine 5 wp1' wp2' cp2
isPushedThrough = isRHS wp1 wp2 cp2 && isJust (intersectSegSeg cp1 cp2 wp1 wp2)