Add bounds to door rooms, tweak mounted lights

This commit is contained in:
2022-03-20 08:23:18 +00:00
parent 02adb0a915
commit e811e67ff9
8 changed files with 44 additions and 65 deletions
+10
View File
@@ -29,6 +29,16 @@ padWithAno ano (Node x xs) = Node ano [Node x (map (padWithAno ano) xs)]
padSucWithCorridors :: Tree [Annotation g] -> Tree [Annotation g] padSucWithCorridors :: Tree [Annotation g] -> Tree [Annotation g]
padSucWithCorridors (Node x xs) = Node x (map padWithCorridors xs) padSucWithCorridors (Node x xs) = Node x (map padWithCorridors xs)
padSucWithDoors :: RandomGen g => Tree [Annotation g] -> Tree [Annotation g]
padSucWithDoors (Node x xs) = Node x (map (padWithAno [SpecificRoom thetree]) xs)
where
thetree = do
thecor <- shuffleLinks corridor
takeOne
[ return (UseAll door)
, treeFromPost [PassDown door, PassDown thecor] (UseAll door)
]
{- Add one to three corridors between each parent-child link of a tree of annotations. -} {- Add one to three corridors between each parent-child link of a tree of annotations. -}
randomPadCorridors :: RandomGen g => Tree [Annotation g] -> State g (Tree [Annotation g]) randomPadCorridors :: RandomGen g => Tree [Annotation g] -> State g (Tree [Annotation g])
randomPadCorridors (Node x xs) = do randomPadCorridors (Node x xs) = do
+1 -1
View File
@@ -53,7 +53,7 @@ spreadGunCrit = defaultCreature
, _crStrategy = StrategyActions WatchAndWait [StartSentinelPost] , _crStrategy = StrategyActions WatchAndWait [StartSentinelPost]
, _crGoal = [] , _crGoal = []
} }
, _crInv = IM.fromList [(0,spreadGun),(1,medkit 100)] , _crInv = IM.fromList [(0,bangStick 6),(1,medkit 100)]
, _crInvSel = 0 , _crInvSel = 0
, _crRad = 10 , _crRad = 10
, _crHP = 500 , _crHP = 500
+15 -14
View File
@@ -1,5 +1,6 @@
module Dodge.Debug.Terminal module Dodge.Debug.Terminal
where ( applyTerminalString
) where
import Dodge.Data import Dodge.Data
import Dodge.Creature import Dodge.Creature
import Dodge.Creature.YourControl import Dodge.Creature.YourControl
@@ -8,17 +9,17 @@ import Dodge.Creature.State
import Control.Lens import Control.Lens
applyTerminalString :: String -> Universe -> Universe applyTerminalString :: String -> Universe -> Universe
applyTerminalString "NOCLIP" = config . debug_noclip %~ not applyTerminalString str = case str of
applyTerminalString "LOADME" = (uvWorld . creatures . ix 0 . crInv .~ stackedInventory) "NOCLIP" -> config . debug_noclip %~ not
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50) "LOADME" -> (uvWorld . creatures . ix 0 . crInv .~ stackedInventory)
applyTerminalString "GODON" = . (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
uvWorld . creatures . ix 0 . crUpdate .~ stateUpdateDamage clearDamage yourControl "GODON" -> uvWorld . creatures . ix 0 . crUpdate .~ stateUpdateDamage clearDamage yourControl
applyTerminalString "GODOFF" = uvWorld . creatures . ix 0 . crUpdate .~ stateUpdate yourControl "GODOFF" -> uvWorld . creatures . ix 0 . crUpdate .~ stateUpdate yourControl
applyTerminalString "LOADTEST" = (uvWorld . creatures . ix 0 . crInv .~ testInventory) "LOADTEST" -> (uvWorld . creatures . ix 0 . crInv .~ testInventory)
. (uvWorld . creatures . ix 0 . crInvCapacity .~ 50) . (uvWorld . creatures . ix 0 . crInvCapacity .~ 50)
applyTerminalString "LM" = applyTerminalString "LOADME" "LM" -> applyTerminalString "LOADME"
applyTerminalString "LT" = applyTerminalString "LOADTEST" "LT" -> applyTerminalString "LOADTEST"
applyTerminalString _ = id _ -> loadme
loadme :: a loadme :: a -> a
loadme = undefined loadme = id
+1 -1
View File
@@ -34,7 +34,7 @@ import System.Random
--import qualified Data.IntMap.Strict as IM --import qualified Data.IntMap.Strict as IM
initialAnoTree :: RandomGen g => Tree [Annotation g] initialAnoTree :: RandomGen g => Tree [Annotation g]
initialAnoTree = padSucWithCorridors $ treeFromTrunk initialAnoTree = padSucWithDoors $ treeFromTrunk
[[AnoApplyInt 0 startRoom] [[AnoApplyInt 0 startRoom]
, [SpecificRoom $ fmap (return . UseAll) $ tanksRoom [] []] , [SpecificRoom $ fmap (return . UseAll) $ tanksRoom [] []]
, [PassthroughLockKeyLists 2 lockRoomKeyItems itemRooms] , [PassthroughLockKeyLists 2 lockRoomKeyItems itemRooms]
-34
View File
@@ -5,7 +5,6 @@ module Dodge.Item.Weapon.BulletGuns
, biggerBlunderbuss , biggerBlunderbuss
, biggestBlunderbuss , biggestBlunderbuss
, grenadeLauncher , grenadeLauncher
, spreadGun
, ltAutoGun , ltAutoGun
, hvAutoGun , hvAutoGun
, autogunSpread , autogunSpread
@@ -276,39 +275,6 @@ ltAutoGun = defaultAutoGun
} }
, _itTweaks = defaultBulletSelTweak , _itTweaks = defaultBulletSelTweak
} }
spreadGun :: Item
spreadGun = defaultGun
{ _itName = "SPREAD"
, _itType = SPREADGUN
, _itConsumption = defaultAmmo
{ _aoType = basicBullet
, _ammoBaseMax = 5
, _ammoLoaded = 5
, _reloadTime = 80
}
, _itUse = ruseAmmoParamsRate 20 upHammer
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart shotgunS
, useAmmoAmount 1
, withRecoil
, withMuzFlareI
, spreadNumI
]
, _itParams = defBulletShooter
{ _muzVel = 0.7
, _rifling = 0.8
, _bore = 2
, _gunBarrels = MultiBarrel
{_brlNum = 5
,_brlSpread = SpreadBarrels 0.5
,_brlInaccuracy = 0
}
}
-- , _itFloorPict = spreadGunPic
, _itTweaks = defaultBulletSelTweak
}
multGun :: Item multGun :: Item
multGun = defaultGun multGun = defaultGun
{ _itName = "MULTGUN" { _itName = "MULTGUN"
+3 -3
View File
@@ -128,7 +128,7 @@ mntLSCond :: (Point2 -> Point3 -> Shape)
-> PlacementSpot -> PlacementSpot
-> Placement -> Placement
mntLSCond shp ps = -- updatePSToLevel 1 (const $ PSLnk shift (const id) Nothing) $ mntLSCond shp ps = -- updatePSToLevel 1 (const $ PSLnk shift (const id) Nothing) $
mntLS shp 0 (V3 0 (-40) 90) mntLS shp 0 (V3 0 (-20) 96)
& plSpot .~ ps & plSpot .~ ps
-- note that this perhaps pushes the vshape light out too far -- note that this perhaps pushes the vshape light out too far
@@ -139,8 +139,8 @@ mntLight a b = RandomPlacement $ do
mntLightLnkCond :: PlacementSpot -> Placement mntLightLnkCond :: PlacementSpot -> Placement
mntLightLnkCond ps = RandomPlacement $ do mntLightLnkCond ps = RandomPlacement $ do
shp <- takeOne [vShape,iShape,lShape,jShape,liShape] shp <- takeOne [vShape,lShape,jShape,liShape]
return $ mntLSCond shp ps return $ mntLSCond (fmap (fmap $ colorSH black) shp) ps
spanLSLightI :: LightSource -> Float -> Point2 -> Point2 -> Placement spanLSLightI :: LightSource -> Float -> Point2 -> Point2 -> Placement
spanLSLightI ls h a b = ps0j (PutLS $ ls & lsParam . lsPos .~ V3 x y h) spanLSLightI ls h a b = ps0j (PutLS $ ls & lsParam . lsPos .~ V3 x y h)
+1 -1
View File
@@ -21,7 +21,7 @@ door = defaultRoom
-- door extends into side walls (for shadows as rendered 12/03) -- door extends into side walls (for shadows as rendered 12/03)
, _rmPmnts = [putAutoDoor (V2 0 20) (V2 40 20)] , _rmPmnts = [putAutoDoor (V2 0 20) (V2 40 20)]
, _rmName = "autoDoor" , _rmName = "autoDoor"
-- note no bounds , _rmBound = [rectNSWE 21 19 0 40]
} }
where where
lnks = [uncurry outLink (V2 20 35,0) lnks = [uncurry outLink (V2 20 35,0)
+12 -10
View File
@@ -136,16 +136,15 @@ roomMiniIntro = do
return $ chainUses [return $ UseAll corridor,return $ UseAll corridor,return $ UseAll corridor,return $ UseAll door, midroom,return $ UseAll corridor] return $ chainUses [return $ UseAll corridor,return $ UseAll corridor,return $ UseAll corridor,return $ UseAll door, midroom,return $ UseAll corridor]
roomCenterPillar :: RandomGen g => State g Room roomCenterPillar :: RandomGen g => State g Room
roomCenterPillar = randomiseAllLinks . restrictInLinks ((\p -> dist p (V2 120 0) < 10) . fst) roomCenterPillar = shuffleLinks . restrictInLinks ((\p -> dist p (V2 120 0) < 10) . fst)
$ set rmPmnts plmnts $ roomRect 240 240 2 2 $ set rmPmnts plmnts $ roomRect 240 240 2 2
where where
plmnts = plmnts =
[ blockLine (V2 115 115) (V2 115 125) [ blockLine (V2 115 115) (V2 115 125)
, blockLine (V2 125 115) (V2 125 125) , blockLine (V2 125 115) (V2 125 125)
--, sPS (V2 40 120) 0 putLamp
--, sPS (V2 200 120) 0 putLamp
, mntLightLnkCond useUnusedLnk , mntLightLnkCond useUnusedLnk
, mntLightLnkCond useUnusedLnk , mntLightLnkCond useUnusedLnk
, mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isInLnk rp)
] ]
roomOctogon :: Room roomOctogon :: Room
@@ -179,7 +178,7 @@ randFirstWeapon = do
takeOne $ map PutFlIt $ takeOne $ map PutFlIt $
replicate 10 pistol replicate 10 pistol
++ replicate 5 ltAutoGun ++ replicate 5 ltAutoGun
++ replicate 5 spreadGun ++ replicate 5 (bangStick 3)
++ replicate 5 multGun ++ replicate 5 multGun
++ replicate 2 autoGun ++ replicate 2 autoGun
++ [launcher] ++ [launcher]
@@ -200,14 +199,14 @@ weaponEmptyRoom = do
$ restrictRMInLinksPD f (roomRect w h 2 2 & rmPmnts .~ plmnts) $ restrictRMInLinksPD f (roomRect w h 2 2 & rmPmnts .~ plmnts)
return $ treeFromTrunk [PassDown corridor] (singleUseAll rm ) return $ treeFromTrunk [PassDown corridor] (singleUseAll rm )
weaponUnderCrits :: RandomGen g => State g (SubCompTree Room) weaponUnderCrits :: RandomGen g => Int -> State g (SubCompTree Room)
weaponUnderCrits = do weaponUnderCrits i = do
let plmnts = let plmnts =
[--sPS (V2 20 0) 0 $ RandPS randFirstWeapon [--sPS (V2 20 0) 0 $ RandPS randFirstWeapon
sPS (V2 20 0) (negate $ pi/2) randC1 sPS (V2 20 0) (negate $ pi/2) randC1
,sPS (V2 20 20) (negate $ pi/2) randC1 ,sPS (V2 20 20) (negate $ pi/2) randC1
] ]
addwpat p = rmPmnts %~ ((PickOnePlacement 0 $ sPS p 0 $ RandPS randFirstWeapon) :) addwpat p = rmPmnts .:~ PickOnePlacement i (sPS p 0 $ RandPS randFirstWeapon)
let continuationRoom = treeFromTrunk let continuationRoom = treeFromTrunk
[PassDown $ addwpat (V2 20 0) corridorN,PassDown $ addwpat (V2 20 0) corridorN] [PassDown $ addwpat (V2 20 0) corridorN,PassDown $ addwpat (V2 20 0) corridorN]
(singleUseAll (set rmPmnts plmnts corridorN)) (singleUseAll (set rmPmnts plmnts corridorN))
@@ -217,7 +216,10 @@ weaponUnderCrits = do
[ addwpat (V2 120 20) rmpils [ addwpat (V2 120 20) rmpils
, addwpat (V2 120 20) rcp] , addwpat (V2 120 20) rcp]
junctionRoom <- takeOne [PassDown tEast,PassDown tWest] junctionRoom <- takeOne [PassDown tEast,PassDown tWest]
return $ treeFromTrunk [PassDown corridorN,PassDown corridorN] return $ treeFromTrunk
--[PassDown $ corridorN & rmPmnts .:~ mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isInLnk rp)
[PassDown corridorN
,PassDown corridorN]
$ Node junctionRoom $ Node junctionRoom
[continuationRoom [continuationRoom
,singleUseNone deadEndRoom' ,singleUseNone deadEndRoom'
@@ -294,9 +296,9 @@ deadEndRoom = defaultRoom
weaponRoom :: RandomGen g => State g (SubCompTree Room) weaponRoom :: RandomGen g => State g (SubCompTree Room)
weaponRoom = join $ takeOne weaponRoom = join $ takeOne
-- [ weaponEmptyRoom -- [ weaponEmptyRoom
-- , weaponUnderCrits [ weaponUnderCrits 0
-- , weaponBehindPillar -- , weaponBehindPillar
[ weaponBetweenPillars -- , weaponBetweenPillars
-- , weaponLongCorridor -- , weaponLongCorridor
] ]