Add targeting reticule for bezier gun

This commit is contained in:
2021-05-26 00:37:35 +02:00
parent d4a15a2416
commit 7ca7a2f941
3 changed files with 19 additions and 7 deletions
+7 -3
View File
@@ -22,12 +22,16 @@ basicCrPict
-> Creature -> Creature
-> World -> World
-> Picture -> Picture
basicCrPict col cr _ = uncurry translate (_crPos cr) $ rotate (_crDir cr) $ pictures basicCrPict col cr w = pictures $
[ onLayer CrLayer . piercingMod $ bluntScale naked targetingPic ++
[ tr . onLayer CrLayer . piercingMod $ bluntScale naked
-- , drawAwakeLevel cr -- , drawAwakeLevel cr
, drawEquipment cr , tr $ drawEquipment cr
] ]
where where
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)
cdir = _crDir cr cdir = _crDir cr
naked naked
| strikeMelee = color white $ circleSolid $ _crRad cr | strikeMelee = color white $ circleSolid $ _crRad cr
+1 -1
View File
@@ -219,7 +219,7 @@ data Item
, _itEffect :: ItEffect , _itEffect :: ItEffect
, _itInvDisplay :: Item -> String , _itInvDisplay :: Item -> String
, _itInvColor :: Color , _itInvColor :: Color
, _itTargeting :: Maybe (World -> Maybe Point2, Item -> Int -> Creature -> World -> Picture) , _itTargeting :: Maybe (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
, _itWorldTrigger :: Maybe (Int -> World -> Bool) , _itWorldTrigger :: Maybe (Int -> World -> Bool)
} }
| Consumable | Consumable
+11 -3
View File
@@ -11,6 +11,7 @@ import Dodge.Item.Weapon.UseEffect
--import Dodge.Item.Attachment.Data --import Dodge.Item.Attachment.Data
import Dodge.WorldEvent.Flash import Dodge.WorldEvent.Flash
import Dodge.WorldEvent.ThingsHit import Dodge.WorldEvent.ThingsHit
import Dodge.Picture.Layer
import Picture import Picture
import Geometry.Vector import Geometry.Vector
@@ -115,9 +116,16 @@ rbSetTarget = ItInvEffect
targetCurrentMousePos targetCurrentMousePos
:: World :: World
-> (World -> Maybe Point2, Item -> Int -> Creature -> World -> Picture) -> (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
targetCurrentMousePos w = (f, \_ _ _ _ -> cursorPic) targetCurrentMousePos w = (f, \_ _ _ w' -> cursorPic w')
where where
f _ = Just mwp f _ = Just mwp
mwp = mouseWorldPos w mwp = mouseWorldPos w
cursorPic = line [mwp +.+ (5,5), mwp -.- (5,5)] cursorPic w' = setLayer 1 $ onLayer InvLayer $ uncurry translate mwp
$ rotate (_cameraRot w')
$ pictures
[line [( x,x), (-x,-x)]
,line [(-x,x), ( x,-x)]
]
where
x = 5 / _cameraZoom w'