Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+3 -1
View File
@@ -1,11 +1,13 @@
module Dodge.LightSource.Draw where
import Dodge.Data.LightSource
import Picture
import Geometry.Data
import Picture
drawLightSource :: LightSourceDraw -> LightSource -> Picture
drawLightSource lsd = case lsd of
DefaultLightSourceDraw -> defLSPic
defLSPic :: LightSource -> Picture
defLSPic ls = setLayer BloomNoZWrite . translate3 (_lsPos $ _lsParam ls) . color col $ circleSolid 4
where
+11 -5
View File
@@ -1,12 +1,18 @@
module Dodge.LightSource.Torch where
import Dodge.Data
import Dodge.Data.World
import Dodge.Item.Draw -- heldItemOffset needs to be moved somewhere more sensible
import Dodge.LightSource -- this needs to be split!
import Geometry
import LensHelp
import Dodge.Item.Draw -- heldItemOffset needs to be moved somewhere more sensible
import Dodge.LightSource -- this needs to be split!
createTorchLightOffset :: Creature -> Item -> Point3 -> World -> World
createTorchLightOffset cr it off = cWorld . tempLightSources .:~ tlsTimeRadColPos 1 250 0.7
(p +.+.+ rotate3 (_crDir cr) (heldItemOffset it cr (off +.+.+ V3 8 0 1.5)))
createTorchLightOffset cr it off =
cWorld . tempLightSources
.:~ tlsTimeRadColPos
1
250
0.7
(p +.+.+ rotate3 (_crDir cr) (heldItemOffset it cr (off +.+.+ V3 8 0 1.5)))
where
p = addZ 0 $ _crPos cr
+5 -4
View File
@@ -1,7 +1,8 @@
module Dodge.LightSource.Update where
import Control.Lens
import Dodge.Data.LightSource
import Geometry
import Control.Lens
updateTempLightSource :: TLSUpdate -> TempLightSource -> Maybe TempLightSource
updateTempLightSource tlsu = case tlsu of
@@ -17,8 +18,8 @@ fadeTLS startcol x tls
| otherwise = Just $ tls & tlsParam . lsCol .~ startcol -- this is wasteful, should be set once at begining
where
t = _tlsTime tls
timerTLS :: TempLightSource -> Maybe TempLightSource
timerTLS t
timerTLS t
| _tlsTime t <= 0 = Nothing
| otherwise = Just $ t & tlsTime -~ 1
| otherwise = Just $ t & tlsTime -~ 1