Minor tweaking, argument refining

This commit is contained in:
2022-10-29 12:20:19 +01:00
parent af6cdff063
commit afaef480db
17 changed files with 59 additions and 56 deletions
+2 -2
View File
@@ -148,7 +148,7 @@ circleLaser it cr w
| otherwise = w
where
cpos = _crPos cr
mwp = mouseWorldPos w
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)
pos = _crPos cr +.+ rotateV dir (V2 0 (max 70 $ dist cpos mwp))
dir = fromIntegral (_lasCycle (_itParams it)) * pi / 1000
phasev = _phaseV . _itParams $ _crInv cr IM.! crSel cr
@@ -167,7 +167,7 @@ shootDualLaser it cr w =
gap = _dbGap . _itParams $ it
posl = pos +.+ (- gap) *.* vNormal (unitVectorAtAngle dir)
posr = pos +.+ gap *.* vNormal (unitVectorAtAngle dir)
mwp = mouseWorldPos w
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)
mwp'
| dist mwp (_crPos cr) < aimlength + 5 = _crPos cr +.+ (aimlength + 5) *.* unitVectorAtAngle dir
| otherwise = mwp
+4 -4
View File
@@ -83,7 +83,7 @@ targetRBCreatureUp it cr w t
. filter (canseepos . _crPos)
$ crsNearCirc mwp 40 w
canseepos p = hasLOS (_crPos cr) p w
mwp = mouseWorldPos w
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)
updatePos t' = t' & tgPos .~ posFromMaybeID (_tgID t')
posFromMaybeID Nothing = Nothing
posFromMaybeID (Just i) = w ^? cWorld . lWorld . creatures . ix i . crPos
@@ -107,7 +107,7 @@ targetCursorUpdate :: World -> Targeting -> Targeting
targetCursorUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons (_input w) =
t
& tgPos . _Just .~ mouseWorldPos w
& tgPos . _Just .~ mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)
& tgActive .~ True
| otherwise =
t & tgPos %~ const Nothing
@@ -117,7 +117,7 @@ targetRBPressUpdate :: World -> Targeting -> Targeting
targetRBPressUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons (_input w) =
t
& tgPos %~ maybe (Just $ mouseWorldPos w) Just
& tgPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)) Just
& tgActive .~ True
| otherwise =
t & tgPos %~ const Nothing
@@ -139,7 +139,7 @@ targetLaserUpdate _ cr w t
where
(mp, _) = reflectLaserAlong 0.2 sp ep w
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos) -.- sp)
addLaserPic =
cWorld . lWorld . lasers
.:~ LaserStart
+2 -2
View File
@@ -698,12 +698,12 @@ duplicateOffsetsFocus xs eff item cr w = foldr f w poss
& crPos %~ (+.+ pos)
& crDir .~ thedir pos
thedir pos
| dist (mouseWorldPos w) (_crPos cr) < aimingMuzzlePos cr item =
| dist (mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)) (_crPos cr) < aimingMuzzlePos cr item =
argV
( _crPos cr +.+ aimingMuzzlePos cr item *.* unitVectorAtAngle (_crDir cr)
-.- (_crPos cr +.+ pos)
)
| otherwise = argV (mouseWorldPos w -.- (_crPos cr +.+ pos))
| otherwise = argV (mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos) -.- (_crPos cr +.+ pos))
duplicateItem :: (Item -> [Item]) -> ChainEffect
duplicateItem fit eff itm cr w = foldr f w (fit itm)
+1 -1
View File
@@ -84,7 +84,7 @@ unsafeBlinkGun =
useForceFieldGun :: Item -> Creature -> World -> World
useForceFieldGun itm cr w = fromMaybe w $ do
a <- _tgPos $ _itTargeting itm
let mwp = mouseWorldPos w
let mwp = mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)
b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
wlline = (a, b)
return $