Attempt to incorporate free link positions into placement chain
This commit is contained in:
+6
-1
@@ -56,6 +56,8 @@ generateLevelFromRoomList gr w
|
||||
rs = zipWith addTile zs . evalState gr $ _randGen w
|
||||
zs = map fromIntegral $ randomRs (0,63::Int) $ _randGen w
|
||||
|
||||
-- the idea is to allow use of link coordinates for placements
|
||||
-- though the implementation is clunky
|
||||
assignPlacementSpots :: Room -> [Placement]
|
||||
assignPlacementSpots rm = plmnts ++ plmnts'
|
||||
where
|
||||
@@ -63,9 +65,12 @@ assignPlacementSpots rm = plmnts ++ plmnts'
|
||||
islnk Placement{_placementSpot=PSLnk{}} = True
|
||||
islnk _ = False
|
||||
(_,plmnts') = mapAccumR f (_rmLinks rm) lnkplmnts
|
||||
(la,lb) = head $ _rmUsedLinks rm
|
||||
lnkTo = (la,lb+1.5*pi)
|
||||
f lnks plmnt =
|
||||
let (x:xs,ys) = partition (_psLinkTest $ _placementSpot plmnt) lnks
|
||||
thepair = _psLinkShift (_placementSpot plmnt) x
|
||||
thepair = bimap (invShiftPointBy lnkTo) (\r -> r - snd lnkTo)
|
||||
$ _psLinkShift (_placementSpot plmnt) x
|
||||
in (xs++ys, updatePS (updatePSLnkUsing thepair) plmnt)
|
||||
|
||||
updatePSLnkUsing :: (Point2,Float) -> PlacementSpot -> PlacementSpot
|
||||
|
||||
Reference in New Issue
Block a user