Refactor crPos to be a V3

This commit is contained in:
2025-10-10 13:47:31 +01:00
parent 98ece551c7
commit 49fb982877
58 changed files with 375 additions and 307 deletions
+3 -2
View File
@@ -2,6 +2,7 @@
module Dodge.Render.Picture (fixedCoordPictures) where
import Linear (_xy)
import Control.Lens
import Data.Maybe
import Dodge.Base.Coordinate
@@ -116,7 +117,7 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
w = u ^. uvWorld
selsec = u ^? uvWorld . hud . diSelection . _Just . slSec
a = fromMaybe 0 $ do
cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy
return . toClosestMultiple (pi / 32) $
argV (w ^. cWorld . lWorld . lAimPos -.- cpos)
- w ^. wCam . camRot
@@ -293,6 +294,6 @@ drawAimSweep cr w = fold $ do
where
cdir = _crDir cr
rot = campos ^. camRot
p = _crPos cr
p = cr ^. crPos . _xy
campos = w ^. wCam
mwp = w ^. cWorld . lWorld . lAimPos
+2 -2
View File
@@ -26,7 +26,7 @@ worldSPic cfig u =
<> foldup drawPulseBall (filtOn _pbPos _pulseBalls)
<> foldup (shiftDraw _blPos _blDir (drawBlock . _blDraw)) (filtOn _blPos _blocks)
<> foldup (shiftDraw _fsPos _fsDir (const _fsSPic)) (filtOn _fsPos _foreShapes)
<> foldup (drawCreature (lw ^. items)) (filtOn _crPos _creatures)
<> foldup (drawCreature (lw ^. items)) (filtOn (^. crPos . _xy) _creatures)
<> foldup
(Prelude.uncurry floorItemSPic)
( IM.intersectionWith
@@ -65,7 +65,7 @@ drawPulseBall pb =
$ circleSolidCol green white 10
drawCreature :: IM.IntMap Item -> Creature -> SPic
drawCreature m cr = translateSPz (_crZ cr) . uncurryV translateSPxy (_crPos cr) . rotateSP (_crDir cr) $
drawCreature m cr = translateSP (_crPos cr) . rotateSP (_crDir cr) $
case cr ^. crType of
_ | CrIsCorpse sp <- cr ^. crHP -> sp
_ | null (cr ^? crHP . _HP) -> mempty