Move toward not shifting rooms during generation
This commit is contained in:
+17
-2
@@ -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)
|
||||
|
||||
@@ -38,8 +38,8 @@ startRoom = do
|
||||
]
|
||||
treeFromPost [Left rezBox, Left door] . Right
|
||||
<$> randomiseOutLinks
|
||||
(shiftRoomBy (V2 (-20) (-20),0)
|
||||
((shiftRoomBy (V2 (-20) (-20),0)
|
||||
$ roomRectAutoLinks w h & rmPmnts %~ (plmnts ++)
|
||||
& rmStartWires .~ IM.fromList [(0,RoomWire (V2 0 0) 0)]
|
||||
& rmEndWires .~ IM.fromList [(0,RoomWire (V2 500 500) 0)]
|
||||
)
|
||||
) & rmShift .~ (0,0) )
|
||||
|
||||
Reference in New Issue
Block a user