Work towards using room positions rather than room links in placements

This commit is contained in:
2021-11-14 10:13:56 +00:00
parent 52946f33a7
commit affdde0f21
7 changed files with 28 additions and 16 deletions
+7 -5
View File
@@ -13,7 +13,7 @@ module Dodge.Room.Link
, randomiseOutLinks
, randomiseLinksBy
, invShiftLinkBy
, setLastLinkToUsed
, finalLinksUpdate
) where
import Dodge.LevelGen
import Dodge.LevelGen.Data
@@ -78,7 +78,7 @@ shiftRoomToLink l r
r
where
(p,a) = last $ _rmLinks r
-- NOTE placements are shifted by the room shift
-- NOTE placements, when placed, will be shifted by the value _rmShift
shiftRoomBy :: (Point2,Float) -> Room -> Room
shiftRoomBy shift r = r
& rmPolys %~ fmap (map (shiftPointBy shift))
@@ -105,9 +105,11 @@ shiftPathBy
-> (Point2,Point2)
shiftPathBy s (p1,p2) = (shiftPointBy s p1, shiftPointBy s p2)
setLastLinkToUsed :: Room -> Room
setLastLinkToUsed rm = case _rmLinks rm of
finalLinksUpdate :: Room -> Room
finalLinksUpdate rm = case _rmLinks rm of
(_:_) -> rm
& rmLinks %~ init
& rmPos %~ (uncurry InLink (last (_rmLinks rm)) :)
& rmPos %~ ( (uncurry InLink (last thelnks) :) . (map (uncurry UnusedLink) (init thelnks) ++) )
_ -> rm
where
thelnks = _rmLinks rm