Continue major door/wall refactor

This commit is contained in:
2021-09-28 12:32:44 +01:00
parent 1990558985
commit 751000636e
3 changed files with 57 additions and 41 deletions
-30
View File
@@ -9,7 +9,6 @@ import Dodge.Data
import Dodge.Base
import Dodge.Creature.Property
--import Dodge.LevelGen.MoveDoor
import Dodge.LevelGen.DoorPane
import Dodge.LevelGen.TriggerDoor
--import Geometry
import Picture
@@ -17,10 +16,6 @@ import Geometry.Data
--import qualified DoubleStack as DS
import qualified IntMapHelp as IM
--import Data.List
--import Data.Maybe
import Control.Lens
--import Control.DeepSeq (deepseq)
addAutoDoor
:: Point2 -- ^ Left point
@@ -30,28 +25,3 @@ addAutoDoor
addAutoDoor a b = putDoubleDoor True (dim yellow) cond a b 3
where
cond = any (crNearSeg 40 a b) . IM.filter isAnimate . _creatures
addAutoDoor'
:: Point2 -- ^ Left point
-> Point2 -- ^ Right point (though the two points should be symmetric)
-> World
-> World
addAutoDoor' a b = over walls (autoDoorAt a b)
autoDoorAt
:: Point2 -- ^ Left point
-> Point2 -- ^ Right point (though the two points should be symmetric)
-> IM.IntMap Wall
-> IM.IntMap Wall
autoDoorAt a b wls = IM.union wls $ IM.fromList $ zip is $ mkAutoDoor a b is
where
is = [IM.newKey wls..]
mkAutoDoor
:: Point2 -- ^ Left point
-> Point2 -- ^ Right point (though the two points should be symmetric)
-> [Int] -- ^ Wall ids
-> [Wall]
mkAutoDoor pl pr = mkDoubleDoor (dim yellow) True cond pl pr 3
where
cond = any (crNearSeg 40 pl pr) . IM.filter isAnimate . _creatures