Cleanup, work towards allowing for placements to interact across rooms
This commit is contained in:
@@ -14,6 +14,7 @@ import System.Random
|
|||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
--import Data.Bifunctor
|
--import Data.Bifunctor
|
||||||
|
|
||||||
data PSType = PutCrit {_unPutCrit :: Creature}
|
data PSType = PutCrit {_unPutCrit :: Creature}
|
||||||
| PutMachine Color [Point2] Machine
|
| PutMachine Color [Point2] Machine
|
||||||
| PutLS LightSource
|
| PutLS LightSource
|
||||||
@@ -32,6 +33,7 @@ data PSType = PutCrit {_unPutCrit :: Creature}
|
|||||||
| RandPS (State StdGen PSType)
|
| RandPS (State StdGen PSType)
|
||||||
| PutForeground Shape
|
| PutForeground Shape
|
||||||
| PutWorldUpdate (PlacementSpot -> World -> World)
|
| PutWorldUpdate (PlacementSpot -> World -> World)
|
||||||
|
| AddToPList Int PSType
|
||||||
| PutNothing
|
| PutNothing
|
||||||
| PutID { _putID :: Int}
|
| PutID { _putID :: Int}
|
||||||
-- maybe there is a monadic implementation of this?
|
-- maybe there is a monadic implementation of this?
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
module Dodge.Placement.Instance.Tank where
|
module Dodge.Placement.Instance.Tank where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Placement.PlaceSpot
|
--import Dodge.Placement.PlaceSpot
|
||||||
|
import Dodge.Placement.Shift
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
import Dodge.Room.Foreground
|
import Dodge.Room.Foreground
|
||||||
import Dodge.Default.Wall
|
import Dodge.Default.Wall
|
||||||
|
|||||||
@@ -3,11 +3,10 @@
|
|||||||
-- | deals with placement of objects within the world
|
-- | deals with placement of objects within the world
|
||||||
-- after they have had their coordinates set by the layout
|
-- after they have had their coordinates set by the layout
|
||||||
module Dodge.Placement.PlaceSpot
|
module Dodge.Placement.PlaceSpot
|
||||||
( shiftPlacement
|
( placeSpot
|
||||||
, shiftPointBy
|
|
||||||
, invShiftPointBy
|
|
||||||
, placeSpot
|
|
||||||
) where
|
) where
|
||||||
|
import Dodge.LevelGen.LevelStructure
|
||||||
|
import Dodge.Placement.Shift
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Path
|
import Dodge.Path
|
||||||
import Dodge.Placement.PlaceSpot.Block
|
import Dodge.Placement.PlaceSpot.Block
|
||||||
@@ -73,18 +72,7 @@ placeSpotRoomRand rm i f plmnt w =
|
|||||||
let (ps,g) = runState (_rmRandPSs rm !! i) $_randGen w
|
let (ps,g) = runState (_rmRandPSs rm !! i) $_randGen w
|
||||||
in placeSpot (w & randGen .~ g,rm) (plmnt & plSpot .~ f ps)
|
in placeSpot (w & randGen .~ g,rm) (plmnt & plSpot .~ f ps)
|
||||||
|
|
||||||
shiftPlacement :: (Point2,Float) -> Placement -> Placement
|
|
||||||
shiftPlacement shift plmnt = case plmnt of
|
|
||||||
Placement {} -> plmnt & plSpot %~ shiftPSBy shift
|
|
||||||
& plIDCont %~ fmap (fmap $ shiftPlacement shift)
|
|
||||||
PlacementUsingPos p f -> PlacementUsingPos (shiftPoint3By shift p)
|
|
||||||
(fmap (shiftPlacement shift) f)
|
|
||||||
RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl
|
|
||||||
|
|
||||||
shiftPSBy :: (Point2,Float) -> PlacementSpot -> PlacementSpot
|
|
||||||
shiftPSBy (pos,rot) ps = ps
|
|
||||||
& psPos %~ shiftPointBy (pos,rot)
|
|
||||||
& psRot %~ (+ rot)
|
|
||||||
|
|
||||||
-- the Int here is some id that is assigned when the placement is placed
|
-- the Int here is some id that is assigned when the placement is placed
|
||||||
placeSpotID :: PlacementSpot -> PSType -> World -> (Int, World)
|
placeSpotID :: PlacementSpot -> PSType -> World -> (Int, World)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ module Dodge.Room.Link
|
|||||||
, chooseOneInLink
|
, chooseOneInLink
|
||||||
, restrictRMInLinksPD
|
, restrictRMInLinksPD
|
||||||
) where
|
) where
|
||||||
|
import Dodge.ShiftPoint
|
||||||
import Dodge.Placement.PlaceSpot
|
import Dodge.Placement.PlaceSpot
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ module Dodge.Room.Procedural
|
|||||||
, makeGrid
|
, makeGrid
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.Placement.Shift
|
||||||
import Dodge.Default.Wall
|
import Dodge.Default.Wall
|
||||||
import Dodge.PlacementSpot
|
import Dodge.PlacementSpot
|
||||||
import Dodge.Placement.Instance
|
import Dodge.Placement.Instance
|
||||||
@@ -23,7 +24,6 @@ import Dodge.Item.Equipment
|
|||||||
import Dodge.Room.Foreground
|
import Dodge.Room.Foreground
|
||||||
import Dodge.Item.Weapon
|
import Dodge.Item.Weapon
|
||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
import Dodge.Placement.PlaceSpot
|
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
import Dodge.LevelGen.Switch
|
import Dodge.LevelGen.Switch
|
||||||
import Dodge.Creature
|
import Dodge.Creature
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
module Dodge.Room.RezBox where
|
module Dodge.Room.RezBox where
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
--import Dodge.PlacementSpot
|
--import Dodge.PlacementSpot
|
||||||
import Dodge.Room.RunPast
|
--import Dodge.Room.RunPast
|
||||||
import Dodge.RoomLink
|
import Dodge.RoomLink
|
||||||
import Dodge.Room.LasTurret
|
--import Dodge.Room.LasTurret
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
--import Dodge.RoomLink
|
--import Dodge.RoomLink
|
||||||
@@ -11,21 +11,21 @@ import Dodge.Tree
|
|||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
import Dodge.Room.Door
|
import Dodge.Room.Door
|
||||||
import Dodge.Room.Corridor
|
import Dodge.Room.Corridor
|
||||||
import Dodge.Room.Room
|
--import Dodge.Room.Room
|
||||||
import Dodge.Room.Link
|
import Dodge.Room.Link
|
||||||
import Dodge.Room.Procedural
|
import Dodge.Room.Procedural
|
||||||
import Dodge.Room.Foreground
|
--import Dodge.Room.Foreground
|
||||||
import Dodge.Room.RoadBlock
|
import Dodge.Room.RoadBlock
|
||||||
import Dodge.Placement.Instance
|
import Dodge.Placement.Instance
|
||||||
import Dodge.Item.Random
|
import Dodge.Item.Random
|
||||||
import Dodge.Item.Weapon.BulletGuns
|
--import Dodge.Item.Weapon.BulletGuns
|
||||||
import Dodge.Item.Weapon.Utility
|
--import Dodge.Item.Weapon.Utility
|
||||||
--import Dodge.LevelGen.Data
|
--import Dodge.LevelGen.Data
|
||||||
--import Geometry.Data
|
--import Geometry.Data
|
||||||
import Geometry
|
import Geometry
|
||||||
import Padding
|
import Padding
|
||||||
import Color
|
--import Color
|
||||||
import Shape
|
--import Shape
|
||||||
|
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
--import Data.Maybe
|
--import Data.Maybe
|
||||||
@@ -69,7 +69,7 @@ rezBoxesWpCrit = do
|
|||||||
h <- state $ randomR (40,40)
|
h <- state $ randomR (40,40)
|
||||||
thecol <- rezColor
|
thecol <- rezColor
|
||||||
theweapon <- randBlockBreakWeapon
|
theweapon <- randBlockBreakWeapon
|
||||||
horedge <- takeOne [OnEdge North,OnEdge South]
|
--horedge <- takeOne [OnEdge North,OnEdge South]
|
||||||
let centralRoom = (roomRectAutoLinks w h) {_rmPmnts = []}
|
let centralRoom = (roomRectAutoLinks w h) {_rmPmnts = []}
|
||||||
onwardpassage <- fmap
|
onwardpassage <- fmap
|
||||||
(applyToCompRoot (rmConnectsTo .~ S.singleton (OnEdge West))) $ maybeBlockedPassage
|
(applyToCompRoot (rmConnectsTo .~ S.singleton (OnEdge West))) $ maybeBlockedPassage
|
||||||
@@ -78,7 +78,6 @@ rezBoxesWpCrit = do
|
|||||||
let n = length $ filter bottomEdgeTest $ map lnkPosDir $ _rmLinks centralRoom
|
let n = length $ filter bottomEdgeTest $ map lnkPosDir $ _rmLinks centralRoom
|
||||||
i <- state $ randomR (0,n-3)
|
i <- state $ randomR (0,n-3)
|
||||||
j <- state $ randomR (i,n-2)
|
j <- state $ randomR (i,n-2)
|
||||||
blcor <- blockedCorridorCloseBlocks
|
|
||||||
let rezrooms = map adddoor
|
let rezrooms = map adddoor
|
||||||
$ insertAt i (wpAdd theweapon aroom)
|
$ insertAt i (wpAdd theweapon aroom)
|
||||||
$ insertAt j (crAdd aroom)
|
$ insertAt j (crAdd aroom)
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ module Dodge.Room.Start where
|
|||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
--import Dodge.PlacementSpot
|
--import Dodge.PlacementSpot
|
||||||
import Dodge.Room.RunPast
|
import Dodge.Room.RunPast
|
||||||
import Dodge.RoomLink
|
--import Dodge.RoomLink
|
||||||
import Dodge.Room.LasTurret
|
import Dodge.Room.LasTurret
|
||||||
import Dodge.Data
|
--import Dodge.Data
|
||||||
import Dodge.Default
|
--import Dodge.Default
|
||||||
--import Dodge.RoomLink
|
--import Dodge.RoomLink
|
||||||
import Dodge.Tree
|
import Dodge.Tree
|
||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
@@ -16,20 +16,20 @@ import Dodge.Room.Room
|
|||||||
import Dodge.Room.Link
|
import Dodge.Room.Link
|
||||||
import Dodge.Room.Procedural
|
import Dodge.Room.Procedural
|
||||||
import Dodge.Room.Foreground
|
import Dodge.Room.Foreground
|
||||||
import Dodge.Room.RoadBlock
|
--import Dodge.Room.RoadBlock
|
||||||
import Dodge.Placement.Instance
|
import Dodge.Placement.Instance
|
||||||
import Dodge.Item.Random
|
--import Dodge.Item.Random
|
||||||
import Dodge.Item.Weapon.BulletGuns
|
import Dodge.Item.Weapon.BulletGuns
|
||||||
import Dodge.Item.Weapon.Utility
|
import Dodge.Item.Weapon.Utility
|
||||||
--import Dodge.LevelGen.Data
|
--import Dodge.LevelGen.Data
|
||||||
--import Geometry.Data
|
--import Geometry.Data
|
||||||
import Geometry
|
import Geometry
|
||||||
import Padding
|
--import Padding
|
||||||
import Color
|
import Color
|
||||||
import Shape
|
import Shape
|
||||||
|
|
||||||
--import Data.Maybe
|
--import Data.Maybe
|
||||||
import Data.Tree
|
--import Data.Tree
|
||||||
import Control.Monad.State
|
import Control.Monad.State
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import System.Random
|
import System.Random
|
||||||
@@ -65,7 +65,8 @@ room2 :: RandomGen g => Int -> State g (SubCompTree Room)
|
|||||||
room2 = lasCenSensEdge
|
room2 = lasCenSensEdge
|
||||||
|
|
||||||
startRoom :: RandomGen g => Int -> State g (SubCompTree Room)
|
startRoom :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||||
startRoom i = join $ takeOne
|
--startRoom i = join $ takeOne
|
||||||
|
startRoom _ = join $ takeOne
|
||||||
[-- roomMiniIntro
|
[-- roomMiniIntro
|
||||||
--minigunfakeout
|
--minigunfakeout
|
||||||
-- rezBoxesWp
|
-- rezBoxesWp
|
||||||
|
|||||||
Reference in New Issue
Block a user