Debug bezier quad, doesn't draw straighter lines well

This commit is contained in:
jgk
2021-03-12 22:17:48 +01:00
parent 95c9610b74
commit 9aa6fec418
6 changed files with 25 additions and 13 deletions
+1
View File
@@ -367,6 +367,7 @@ startCr = basicCreature
,frontArmour
,miniGun
,medkit 50
,bezierGun
]
++ repeat NoItem))
-- startInv
+1
View File
@@ -32,6 +32,7 @@ lev1 = do
(
[return $ return $ Right deadEndRoom
]
++ [slowDoorRoom]
++ [return $ connectRoom corridor
,return $ connectRoom door]
++ firstWeapon
+11 -3
View File
@@ -1415,16 +1415,24 @@ bezierTarget cid w = setTarget w
p = mouseWorldPos w
bezierControl :: Point2 -> Int -> World -> World
bezierControl targetp cid w = shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
bezierControl targetp cid w = resetGun $ shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
where
j = _crInvSel $ _creatures w IM.! cid
controlp = mouseWorldPos w
cr = _creatures w IM.! cid
dir = _crDir cr
startp = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
resetGun = set (creatures . ix cid . crInv . ix j . wpFire) $ bezierTarget
mkBezierBul :: Point2 -> Point2 -> Point2 -> Int -> World -> World
mkBezierBul startp controlp targetp cid w = w
mkBezierBul startp controlp targetp cid w = over particles' (bbul 30 :) w
where
bbul i = Particle'
{_ptPict' = onLayerL [levLayer PtLayer ] $ bezierQuad white white 5 5 startp controlp targetp
,_ptUpdate' = \w p -> case i of 0 -> (w, Nothing)
n -> (w, Just $ bbul (i-1))
}
fireRemoteLauncher :: Int -> World -> World
fireRemoteLauncher cid w = setLocation $ resetFire $ resetName
$ soundOnce (fromIntegral launcherSound)
+2 -2
View File
@@ -121,8 +121,8 @@ worldPictures w
where tst x y sc t = translate x y $ scale sc sc $ color white $ text t
testPic :: World -> [Picture]
testPic w = [blank]
-- [setLayer 1 $ onLayerL [99] $ bezierQuad white red 5 50 (-200,200) (-200,-200) (00,00) ]
testPic w = --[blank]
[setLayer 1 $ onLayerL [99] $ bezierQuad white red 20 50 (-200,0) (0,0) (200,50) ]
-- $ uncurry translate (mouseWorldPos w)