Improve simple aiming sweep

This commit is contained in:
2023-01-11 11:12:09 +00:00
parent 9796564075
commit 68338d223b
+12 -20
View File
@@ -7,7 +7,7 @@ import Dodge.Viewpoints
import Dodge.Render.Label
import Dodge.WorldEvent.ThingsHit
import Control.Lens
--import Control.Monad (guard)
import Control.Monad (guard)
import Data.Foldable
import qualified Data.Graph.Inductive as FGL
import qualified Data.Map.Strict as M
@@ -65,35 +65,27 @@ worldSPic cfig w =
aimDelaySweep :: Configuration -> World -> SPic
aimDelaySweep cfig w = fromMaybe mempty $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
-- aimstatus <- cr ^? crStance . posture
-- guard (aimstatus == Aiming)
aimstatus <- cr ^? crStance . posture
guard (aimstatus == Aiming)
return $ noShape $ drawSweep cr cfig w
drawSweep :: Creature -> Configuration -> World -> Picture
drawSweep cr cfig w = fromMaybe mempty $ do
--a <- safeArgV (mwp -.- p)
a <- safeArgV (mwp -.- p)
let a' | a - cdir > pi = cdir + 2* pi
| a - cdir < - pi = cdir - 2* pi
| otherwise = cdir
return $ winScale cfig
$ setLayer FixedCoordLayer
$ uncurryV translate (worldPosToScreen campos p)
-- $ thickArcFull (rot + a) 1 white (rot + _crDir cr) 1 white (dist mwp p * campos ^. camZoom)
-- $ arc (rot + a) (rot + _crDir cr) (dist mwp p * campos ^. camZoom)
$ color white (circle 100)
-- <> arcTest (3*pi/4) 100 green 0 1 red 100
<> arcFull 0 5 green (3*pi/4) 50 red 100 white
-- <> f green 0 (pi/2) 100
-- <> f red 2 3 100
<> f blue 4 4.5 100 white
-- <> f 0 2 120 <> f 0 3 140 <> f 0 4 160 <> f 1 0 180 <> f 2 0 200
-- <> f 3 0 220 <> f 4 0 240
-- <> f (-0.5) 0.5 260 <> f 0.5 (-0.5) 280
$ arcFull (a - rot) 10 white (a' - rot) 1 white (5 + dist mwp p * campos ^. camZoom) white
where
f col a b c = arcFull a 25 col b 1 red c
--f a b c = thickArc a b c 5
--rot = campos ^. camRot
cdir = _crDir cr
rot = campos ^. camRot
p = _crPos cr
campos = w ^. cWorld . camPos
--theinput = w ^. input
--mwp = mouseWorldPos theinput campos
theinput = w ^. input
mwp = mouseWorldPos theinput campos
anyTargeting :: Configuration -> World -> SPic
anyTargeting cfig w = fromMaybe mempty $ do