Cleanup
This commit is contained in:
@@ -15,18 +15,16 @@ import Geometry
|
||||
import Linear
|
||||
|
||||
putDoubleDoor ::
|
||||
Bool ->
|
||||
Wall ->
|
||||
WdBl ->
|
||||
Point2 ->
|
||||
Point2 ->
|
||||
Float ->
|
||||
Placement
|
||||
putDoubleDoor isauto wl cond a b speed =
|
||||
putDoubleDoorThen isauto wl cond 1 a b speed (const $ const Nothing)
|
||||
putDoubleDoor wl cond a b speed =
|
||||
putDoubleDoorThen wl cond 1 a b speed (const $ const Nothing)
|
||||
|
||||
putDoubleDoorThen ::
|
||||
Bool ->
|
||||
Wall ->
|
||||
WdBl ->
|
||||
Float ->
|
||||
@@ -35,16 +33,15 @@ putDoubleDoorThen ::
|
||||
Float ->
|
||||
(Placement -> Placement -> Maybe Placement) ->
|
||||
Placement
|
||||
putDoubleDoorThen isauto wl cond soff a b speed cont =
|
||||
doorBetween isauto wl cond soff a half speed $
|
||||
putDoubleDoorThen wl cond soff a b speed cont =
|
||||
doorBetween wl cond soff a half speed $
|
||||
\pl1 -> Just $
|
||||
doorBetween isauto wl cond soff b half speed $
|
||||
doorBetween wl cond soff b half speed $
|
||||
\pl2 -> cont pl1 pl2
|
||||
where
|
||||
half = 0.5 *.* (a +.+ b)
|
||||
|
||||
doorBetween ::
|
||||
Bool ->
|
||||
Wall ->
|
||||
WdBl ->
|
||||
Float ->
|
||||
@@ -53,9 +50,9 @@ doorBetween ::
|
||||
Float ->
|
||||
(Placement -> Maybe Placement) ->
|
||||
Placement
|
||||
doorBetween isauto wl cond soff pa pb speed g = case divideLine 40 pa pb of
|
||||
doorBetween wl cond soff pa pb speed g = case divideLine 40 pa pb of
|
||||
[x, y] -> ptCont (putSlideDr adoor wl soff x y) g
|
||||
(x : y : zs) -> divideDoorPane isauto Nothing wl cond (soff - dist y pb) speed (zip (x : y : zs) (y : zs)) g
|
||||
(x : y : zs) -> divideDoorPane Nothing wl cond (soff - dist y pb) speed (zip (x : y : zs) (y : zs)) g
|
||||
_ -> error "tried to create doorBetween with too few points"
|
||||
where
|
||||
adoor =
|
||||
@@ -65,7 +62,6 @@ doorBetween isauto wl cond soff pa pb speed g = case divideLine 40 pa pb of
|
||||
|
||||
|
||||
divideDoorPane ::
|
||||
Bool ->
|
||||
Maybe Int ->
|
||||
Wall ->
|
||||
WdBl ->
|
||||
@@ -74,9 +70,9 @@ divideDoorPane ::
|
||||
[(Point2, Point2)] ->
|
||||
(Placement -> Maybe Placement) ->
|
||||
Placement
|
||||
divideDoorPane isauto mid wl cond soff speed ppairs g = case ppairs of
|
||||
divideDoorPane mid wl cond soff speed ppairs g = case ppairs of
|
||||
[p] -> ptCont (adoor p) g
|
||||
(p : ps) -> ptCont (adoor p) $ \pl -> Just $ divideDoorPane isauto (_plMID pl) wl cond soff speed ps g
|
||||
(p : ps) -> ptCont (adoor p) $ \pl -> Just $ divideDoorPane (_plMID pl) wl cond soff speed ps g
|
||||
_ -> undefined
|
||||
where
|
||||
adoor (x, y) = putSlideDr thedoor wl soff x y
|
||||
@@ -92,7 +88,6 @@ putAutoDoor a b = Placement (PS 0 0) (PutCoord a) Nothing Nothing $ \_ apl ->
|
||||
y = w ^?! gwWorld . coordinates . ix (bpl ^?! plMID . _Just)
|
||||
in Just $
|
||||
putDoubleDoor
|
||||
True
|
||||
defaultAutoWall
|
||||
(WdBlCrFilterNearPoint 40 (0.5 *^ (x + y)) CrIsAnimate)
|
||||
a
|
||||
|
||||
@@ -134,9 +134,7 @@ placeSpotID rid ps pt w = case pt of
|
||||
PutMachine pps mc mitm -> plMachine (map doShift pps) mc mitm p rot w
|
||||
PutLS ls -> plNewUpID (gwWorld . cWorld . lWorld . lightSources) lsID (mvLS p' rot ls) w
|
||||
RandPS _ -> error "RandPS should not be reachable here" --evaluateRandPS rid rgn ps w
|
||||
-- PutDoor f l p1 p2 -> plDoor f l (pashift p1) (pashift p2) w
|
||||
PutDoor' dr wl -> plDoor' (dr & drZeroPos %~ pashift & drOnePos %~ pashift) wl w
|
||||
-- PutSlideDr wl dr off a b -> plSlideDoor wl dr off (doShift a) (doShift b) w
|
||||
PutDoor dr wl -> plDoor' (dr & drZeroPos %~ pashift & drOnePos %~ pashift) wl w
|
||||
PutCoord cp -> plNewID (gwWorld . coordinates) (doShift cp) w
|
||||
PutBlock bl wl ps' ->
|
||||
plBlock
|
||||
|
||||
@@ -42,9 +42,8 @@ insertStructureWalls ::
|
||||
Int ->
|
||||
World ->
|
||||
World
|
||||
insertStructureWalls f wl ps sid wid = insertWalls wls
|
||||
where
|
||||
wls =
|
||||
insertStructureWalls f wl ps sid wid =
|
||||
insertWalls $
|
||||
zipWith
|
||||
(\i xy -> wl & wlLine .~ xy & wlID .~ i & wlStructure .~ f sid)
|
||||
[wid ..]
|
||||
|
||||
Reference in New Issue
Block a user