Move configuration from world to universe

This commit is contained in:
2021-11-28 22:30:47 +00:00
parent 45ba120796
commit 8c5777a1af
29 changed files with 343 additions and 300 deletions
+12 -11
View File
@@ -27,11 +27,12 @@ import qualified Data.Vector as V
basicCrPict
:: Color -- ^ Creature color
-> Creature
-> Configuration
-> World
-> SPic
basicCrPict col cr w = (,) (basicCrShape col cr) $ pictures $
basicCrPict col cr cfig w = (,) (basicCrShape col cr) $ pictures $
targetingPic ++
[ creatureDisplayText w cr
[ creatureDisplayText cfig w cr
, tr . rotdir $ _spPicture $ drawEquipment cr
]
where
@@ -40,8 +41,8 @@ basicCrPict col cr w = (,) (basicCrShape col cr) $ pictures $
tr = uncurryV translate (_crPos cr)
rotdir = rotate (_crDir cr)
shapeAtCrPos :: Shape -> Creature -> World -> SPic
shapeAtCrPos sh cr _ =
shapeAtCrPos :: Shape -> Creature -> Configuration -> World -> SPic
shapeAtCrPos sh cr _ _ =
( uncurryV translateSHf (_crPos cr) $ rotateSH (_crDir cr) sh
, mempty
)
@@ -64,9 +65,9 @@ basicCrShape col cr = tr . scaleSH (V3 crsize crsize crsize) $ mconcat
rotmdir = rotateSH (_crMvDir cr)
. colorSH (greyN 0.3)
creatureDisplayText :: World -> Creature -> Picture
creatureDisplayText w cr
| not (_debug_cr_status $ _config w) = []
creatureDisplayText :: Configuration -> World -> Creature -> Picture
creatureDisplayText cfig w cr
| not (_debug_cr_status cfig) = []
| otherwise
= setLayer 4
. setDepth 50
@@ -256,10 +257,10 @@ drawEquipment cr = mconcat $ map f $ IM.toList (_crInv cr)
circLine :: Float -> Picture
circLine x = line [V2 0 0,V2 x 0]
picAtCrPos :: Picture -> Creature -> World -> SPic
picAtCrPos :: Picture -> Creature -> Configuration -> World -> SPic
--{-# INLINE picAtCrPos #-}
picAtCrPos thePic cr _ = (,) emptySH $ tranRot (_crPos cr) (_crDir cr) thePic
picAtCrPos thePic cr _ _ = (,) emptySH $ tranRot (_crPos cr) (_crDir cr) thePic
picAtCrPosNoRot :: Picture -> Creature -> World -> SPic
picAtCrPosNoRot :: Picture -> Creature -> Configuration -> World -> SPic
--{-# INLINE picAtCrPos #-}
picAtCrPosNoRot thePic cr _ = (,) emptySH $ uncurryV translate (_crPos cr) thePic
picAtCrPosNoRot thePic cr _ _ = (,) emptySH $ uncurryV translate (_crPos cr) thePic