Further strictifying
This commit is contained in:
@@ -51,7 +51,7 @@ crMvForward
|
||||
:: Float -- ^ Speed
|
||||
-> Creature
|
||||
-> Creature
|
||||
crMvForward speed = crMvBy (speed,0)
|
||||
crMvForward speed = crMvBy (V2 speed 0)
|
||||
|
||||
advanceStepCounter
|
||||
:: Float -- ^ Speed
|
||||
@@ -70,7 +70,7 @@ creatureTurn a = crDir +~ a
|
||||
|
||||
creatureTurnTo :: Point2 -> Creature -> Creature
|
||||
creatureTurnTo p cr
|
||||
| vToTarg == (0,0) = cr -- this should deal with the angleVV error
|
||||
| vToTarg == (V2 0 0) = cr -- this should deal with the angleVV error
|
||||
| otherwise = cr & crDir .~ dirToTarget
|
||||
where
|
||||
vToTarg = p -.- _crPos cr
|
||||
@@ -82,18 +82,18 @@ creatureTurnTowardDir
|
||||
-> Creature
|
||||
-> Creature
|
||||
creatureTurnTowardDir a turnSpeed cr
|
||||
| vToTarg == (0,0) = cr -- this should deal with the angleVV error
|
||||
| vToTarg == (V2 0 0) = cr -- this should deal with the angleVV error
|
||||
| errorAngleVV 3 vToTarg (unitVectorAtAngle (_crDir cr)) <= turnSpeed
|
||||
= cr & crDir .~ dirToTarget
|
||||
| isLeftOfA (normalizeAngle dirToTarget) (normalizeAngle $ _crDir cr) = cr & crDir +~ turnSpeed
|
||||
| otherwise = cr & crDir -~ turnSpeed
|
||||
where
|
||||
vToTarg = rotateV a (1,0)
|
||||
vToTarg = rotateV a (V2 1 0)
|
||||
dirToTarget = argV vToTarg
|
||||
|
||||
creatureTurnToward :: Point2 -> Float -> Creature -> Creature
|
||||
creatureTurnToward p turnSpeed cr
|
||||
| vToTarg == (0,0) = cr -- this should deal with the angleVV error
|
||||
| vToTarg == (V2 0 0) = cr -- this should deal with the angleVV error
|
||||
| errorAngleVV 3 vToTarg (unitVectorAtAngle (_crDir cr)) <= turnSpeed
|
||||
= cr & crDir .~ dirToTarget
|
||||
| isLeftOfA (normalizeAngle dirToTarget) (normalizeAngle $ _crDir cr) = cr & crDir +~ turnSpeed
|
||||
|
||||
@@ -33,7 +33,7 @@ basicCrPict col cr w
|
||||
targetingPic ++
|
||||
[ tr . setDepth 0 $ color yellow $ circleSolid 10
|
||||
, tr . piercingMod $ bluntScale $ naked col cr
|
||||
, tr $ torso (light4 col) (0,-crad) (0,crad)
|
||||
, tr $ torso (light4 col) (V2 (0) (-crad)) (V2 0 crad)
|
||||
, trFeet $ feet cr
|
||||
, tr $ arms col cr
|
||||
, tr $ drawEquipment cr
|
||||
@@ -42,8 +42,8 @@ basicCrPict col cr w
|
||||
crad = _crRad cr
|
||||
targetingPic = IM.elems $ IM.mapMaybeWithKey f $ _crInv cr
|
||||
f invid it = fmap ((\g -> g invid it cr w) . snd) (it ^? itTargeting . _Just)
|
||||
tr = uncurry translate (_crPos cr) . rotate (_crDir cr)
|
||||
trFeet = uncurry translate (_crPos cr) . rotate (_crMvDir cr)
|
||||
tr = uncurryV translate (_crPos cr) . rotate (_crDir cr)
|
||||
trFeet = uncurryV translate (_crPos cr) . rotate (_crMvDir cr)
|
||||
cdir = _crDir cr
|
||||
bluntDam :: Maybe Point2
|
||||
bluntDam = find isBluntDam (concat pastDams) >>= (\dm -> (-.-) <$> dm ^? dmFrom <*> dm ^? dmTo)
|
||||
@@ -104,7 +104,7 @@ arms col cr
|
||||
|
||||
torso :: Color -> Point2 -> Point2 -> Picture
|
||||
torso col x y = color col $ pictures
|
||||
[ poly3 [addZ 20 x, addZ 12 v, addZ 12 ((0,0) -.- v), addZ 20 y]
|
||||
[ poly3 [addZ 20 x, addZ 12 v, addZ 12 ((V2 0 0) -.- v), addZ 20 y]
|
||||
, setDepth 12 . rotate a . scale 1 1 $ circleSolid $ magV v
|
||||
]
|
||||
where
|
||||
@@ -171,8 +171,8 @@ drawEquipment cr = pictures $ map f $ IM.toList (_crInv cr)
|
||||
_ -> blank
|
||||
|
||||
circLine :: Float -> Picture
|
||||
circLine x = line [(0,0),(x,0)]
|
||||
circLine x = line [(V2 0 0),(V2 x 0)]
|
||||
|
||||
picAtCrPos :: Picture -> Creature -> World -> Picture
|
||||
{-# INLINE picAtCrPos #-}
|
||||
picAtCrPos thePic cr _ = uncurry translate (_crPos cr) $ rotate (_crDir cr) thePic
|
||||
picAtCrPos thePic cr _ = uncurryV translate (_crPos cr) $ rotate (_crDir cr) thePic
|
||||
|
||||
@@ -33,7 +33,7 @@ advanceShoot' tcid = lostest `DoActionWhile`
|
||||
|
||||
shootFirstMiss' :: Action
|
||||
shootFirstMiss' =
|
||||
LeadTarget (30,50) `DoActionThen`
|
||||
LeadTarget (V2 30 50) `DoActionThen`
|
||||
DoImpulses [UseItem] `DoActionThen`
|
||||
(crCanShoot `DoActionWhile` DoActions [LeadTarget (0,0),DoImpulses [UseItem]])
|
||||
(crCanShoot `DoActionWhile` DoActions [LeadTarget (V2 0 0),DoImpulses [UseItem]])
|
||||
`DoActionThen` 20 `WaitThen` holsterWeapon
|
||||
|
||||
Reference in New Issue
Block a user