Move toward not shifting rooms during generation

This commit is contained in:
2021-11-15 00:56:25 +00:00
parent 2a28967cd3
commit 8356496a7f
4 changed files with 27 additions and 9 deletions
+17 -2
View File
@@ -5,7 +5,9 @@ The last link in the list is considered the incoming link, the other links are
the outgoing links. -}
module Dodge.Room.Link
( shiftRoomToLink
, shiftRoomShiftToLink
, shiftRoomBy
, doRoomShift
, randomiseAllLinks
, filterLinks
, changeLinkTo
@@ -73,11 +75,12 @@ shiftRoomToLink l r
= shiftRoomBy l
. shiftRoomBy (V2 0 0 , pi-a)
$ shiftRoomBy (V2 0 0 -.- p , 0)
-- . shiftRoomBy (V2 0 0 -.- rotateV (pi-a) p , 0)
-- $ shiftRoomBy (V2 0 0 ,pi-a)
r
where
(p,a) = last $ _rmLinks r
doRoomShift :: Room -> Room
doRoomShift rm = shiftRoomBy (_rmShift rm) rm & rmShift .~ _rmShift rm
-- NOTE placements, when placed, will be shifted by the value _rmShift
shiftRoomBy :: (Point2,Float) -> Room -> Room
shiftRoomBy shift r = r
@@ -92,6 +95,18 @@ shiftRoomBy shift r = r
. (tileX %~ shiftPointBy shift )
)
& rmViewpoints %~ map (shiftPointBy shift)
shiftRoomShiftToLink :: (Point2,Float) -> Room -> Room
shiftRoomShiftToLink l r
= shiftRoomShiftBy l
. shiftRoomShiftBy (V2 0 0 , pi-a)
$ shiftRoomShiftBy (V2 0 0 -.- p , 0)
r
where
(p,a) = last $ _rmLinks r
-- NOTE placements, when placed, will be shifted by the value _rmShift
shiftRoomShiftBy :: (Point2,Float) -> Room -> Room
shiftRoomShiftBy shift r = r
& rmShift %~ shiftLinkBy shift
shiftLinkBy :: (Point2,Float) -> (Point2,Float) -> (Point2,Float)
shiftLinkBy (pos,rot) (p,r) = (shiftPointBy (pos,rot) p, r + rot)