Working use of links as placement spots
This commit is contained in:
@@ -239,8 +239,8 @@ defaultDrawButton col bt =
|
||||
)
|
||||
where
|
||||
buttonGeometry
|
||||
| _btState bt == BtOff = rectWH width 5
|
||||
| otherwise = rectNSEW (-3) (-5) width (-width)
|
||||
| _btState bt == BtOff = rectNSEW 10 (-1) width (-width)
|
||||
| otherwise = rectNSEW 2 (-1) width (-width)
|
||||
width = 8
|
||||
defaultButton :: Button
|
||||
defaultButton = Button
|
||||
|
||||
+6
-6
@@ -7,6 +7,7 @@ import Dodge.LevelGen.Data
|
||||
import Dodge.LevelGen.StaticWalls
|
||||
import Dodge.LevelGen.Pathing
|
||||
import Dodge.Placements.Spot
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.GameRoom
|
||||
@@ -52,21 +53,20 @@ generateLevelFromRoomList gr w
|
||||
where
|
||||
path = pairsToGraph dist pairPath
|
||||
pairPath = concatMap _rmPath rs
|
||||
plmnts = concatMap (\r -> map (_rmShift r ,) (assignPlacementSpots r)) rs
|
||||
plmnts = concat . snd $ mapAccumR assignPlacementSpots (_randGen w) rs
|
||||
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'
|
||||
assignPlacementSpots :: StdGen -> Room -> (StdGen, [((Point2,Float),Placement)])
|
||||
assignPlacementSpots g rm = (g', map (_rmShift rm,) $ plmnts ++ plmnts')
|
||||
where
|
||||
(lnkplmnts, plmnts) = partition islnk (_rmPS rm)
|
||||
islnk Placement{_placementSpot=PSLnk{}} = True
|
||||
islnk _ = False
|
||||
(_,plmnts') = mapAccumR f (map (invShiftLinkBy lnkTo) $ _rmLinks rm) lnkplmnts
|
||||
(la,lb) = _rmShift rm
|
||||
lnkTo = (la,lb)
|
||||
(shuffledLnks,g') = runState (shuffle $ _rmLinks rm) g
|
||||
(_,plmnts') = mapAccumR f (map (invShiftLinkBy $ _rmShift rm) shuffledLnks) lnkplmnts
|
||||
f lnks plmnt =
|
||||
let (x:xs,ys) = partition (_psLinkTest $ _placementSpot plmnt) lnks
|
||||
thepair = _psLinkShift (_placementSpot plmnt) x
|
||||
|
||||
@@ -23,8 +23,8 @@ putLitButtonID col p a subpl = mountLightAID ls p'' (addZ 40 p')
|
||||
ls = defaultLS { _lsRad = 75 , _lsIntensity = V3 0.5 0 0 }
|
||||
|
||||
putLitButtonID' :: Color -> ((Point2,Float) -> Bool) -> (Int -> Maybe Placement) -> Placement
|
||||
putLitButtonID' col f subpl = updatePSToLevel 3 (const thePS) $ mountLightAID ls 0 (V3 0 40 40)
|
||||
$ \lsid -> jps0 (PutButton (makeButton col (changeLight lsid)) {_btPos = 0, _btRot = 0})
|
||||
putLitButtonID' col f subpl = updatePSToLevel 3 (const thePS) $ mountLightAID ls 0 (V3 0 (-40) 40)
|
||||
$ \lsid -> jps0 (PutButton (makeButton col (changeLight lsid)) {_btPos = V2 0 (-1), _btRot = pi})
|
||||
subpl
|
||||
where
|
||||
changeLight lsid = lightSources . ix lsid . lsIntensity .~ V3 0 0.5 0
|
||||
|
||||
Reference in New Issue
Block a user