Cleanup
This commit is contained in:
@@ -70,7 +70,6 @@ targetRBPress = defaultTargeting
|
||||
targetRBCreature :: Targeting
|
||||
targetRBCreature = defaultTargeting
|
||||
& tgUpdate .~ targetRBCreatureUp
|
||||
-- undefined
|
||||
& tgDraw .~ targetRBCreatureDraw
|
||||
targetCursor :: Targeting
|
||||
targetCursor = defaultTargeting
|
||||
@@ -79,10 +78,10 @@ targetCursor = defaultTargeting
|
||||
targetSimpleDraw :: Int -> Item -> Creature -> Configuration -> World -> Picture
|
||||
targetSimpleDraw _ it _ cfig w = fromMaybe mempty $ do
|
||||
p <- it ^? itTargeting . tgPos . _Just
|
||||
return $ winScale cfig $ setLayer FixedCoordLayer $ color white
|
||||
$ uncurryV translate (worldPosToScreen w p)
|
||||
-- $ rotate (_cameraRot w)
|
||||
$ activeTargetCursorPic
|
||||
return $ winScale cfig
|
||||
$ setLayer FixedCoordLayer
|
||||
$ color white
|
||||
$ uncurryV translate (worldPosToScreen w p) activeTargetCursorPic
|
||||
targetRBCreatureUp :: Item -> Creature -> World -> Targeting -> (World, Targeting)
|
||||
targetRBCreatureUp it cr w t
|
||||
| not $ _itIsHeld it = (w, t
|
||||
@@ -115,10 +114,11 @@ targetRBCreatureUp it cr w t
|
||||
targetRBCreatureDraw :: Int -> Item -> Creature -> Configuration -> World -> Picture
|
||||
targetRBCreatureDraw _ it _ cfig w = fromMaybe mempty $ do
|
||||
p <- it ^? itTargeting . tgPos . _Just
|
||||
return $ winScale cfig $ setLayer FixedCoordLayer $ color white
|
||||
return $ winScale cfig
|
||||
$ setLayer FixedCoordLayer
|
||||
$ color white
|
||||
$ uncurryV translate (worldPosToScreen w p)
|
||||
-- $ rotate (_cameraRot w)
|
||||
$ thepic
|
||||
thepic
|
||||
where
|
||||
thepic | _tgActive $ _itTargeting it = activeTargetCursorPic
|
||||
| otherwise = targetCursorPic
|
||||
@@ -141,7 +141,9 @@ targCorner = pictures
|
||||
|
||||
targetUpdateWith :: (World -> Targeting -> Targeting)
|
||||
-> Item -> Creature -> World -> Targeting -> (World,Targeting)
|
||||
targetUpdateWith f _ _ w t = (w, f w t)
|
||||
targetUpdateWith f it _ w t
|
||||
| _itIsHeld it = (w, f w t)
|
||||
| otherwise = (w,t)
|
||||
|
||||
targetCursorUpdate :: World -> Targeting -> Targeting
|
||||
targetCursorUpdate w t
|
||||
@@ -159,20 +161,6 @@ targetRBPressUpdate w t
|
||||
| otherwise = t & tgPos %~ const Nothing
|
||||
& tgActive .~ False
|
||||
|
||||
targetRBCreatureUpdate :: World -> Targeting -> Targeting
|
||||
targetRBCreatureUpdate w t
|
||||
| SDL.ButtonRight `S.member` _mouseButtons w && isJust (t ^? tgID . _Just)
|
||||
= t & updatePos
|
||||
& tgActive .~ True
|
||||
| otherwise = t & tgID .~ fmap _crID (creatureNearPointI 3 mwp w)
|
||||
& updatePos
|
||||
& tgActive .~ False
|
||||
where
|
||||
mwp = mouseWorldPos w
|
||||
updatePos t' = t' & tgPos .~ posFromMaybeID (_tgID t')
|
||||
posFromMaybeID Nothing = Nothing
|
||||
posFromMaybeID (Just i) = w ^? creatures . ix i . crPos
|
||||
|
||||
targetLaserUpdate :: Item -> Creature -> World -> Targeting -> (World,Targeting)
|
||||
targetLaserUpdate it cr w t
|
||||
| crIsAiming cr = (addLaserPic w,t
|
||||
|
||||
Reference in New Issue
Block a user