Tweak pillar room

This commit is contained in:
2021-10-03 17:52:35 +01:00
parent 0c6fa80ce0
commit 2c5cdbdc73
8 changed files with 44 additions and 35 deletions
+13 -14
View File
@@ -199,7 +199,7 @@ defaultIt = Consumable
, _itMaxStack = 3
, _itAmount = 2
, _cnEffect = const return
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ square 3
, _itEquipPict = \_ _ -> (,) emptySH blank
, _itID = Nothing
, _itInvDisplay = _itName
@@ -209,15 +209,15 @@ defaultIt = Consumable
, _itAimStance = LeaveHolstered
}
defaultDrawButton :: Color -> Button -> SPic
defaultDrawButton col bt
| _btState bt == BtOff =
( translateSHz 15 . colorSH col $ upperPrismPoly 5 $ rectNSEW 5 (-5) 10 (-10)
, mempty
)
| otherwise =
( translateSHz 15 . colorSH red $ upperPrismPoly 5 $ rectNSEW (-3) (-5) 10 (-10)
, mempty
)
defaultDrawButton col bt =
( translateSHz 15 . colorSH col $ upperPrismPoly 5 buttonGeometry
, mempty
)
where
buttonGeometry
| _btState bt == BtOff = rectWH width 5
| otherwise = rectNSEW (-3) (-5) width (-width)
width = 8
defaultButton :: Button
defaultButton = Button
{ _btPict = defaultDrawButton (dark red)
@@ -240,7 +240,7 @@ defaultPT = Projectile
}
defaultPP :: PressPlate
defaultPP = PressPlate
{ _ppPict = onLayer PressPlateLayer $ color (dim $ dim $ bright blue) $ circleSolid 5
{ _ppPict = onLayer PressPlateLayer . color (dim . dim $ bright blue) $ circleSolid 5
, _ppPos = V2 0 0
, _ppRot = 0
, _ppEvent = const id
@@ -257,6 +257,5 @@ defaultTLS = TLS
}
where
f _ t
| _tlsTime t <= 0
= Nothing
| otherwise = Just $ t & tlsTime -~ 1
| _tlsTime t <= 0 = Nothing
| otherwise = Just $ t & tlsTime -~ 1
+8 -8
View File
@@ -530,10 +530,10 @@ multGun = defaultGun
}
multGunSPic :: Item -> SPic
multGunSPic it =
( (colorSH red $
upperPrismPoly 2 (rectNESW 4 8 (-4) (-12)) ++
( colorSH red (
upperPrismPoly 2 (rectNESW 4 8 (-4) (-12)) <>
translateSHf 8 0 (concatMap barrel [12,7,2,-3,-8] <>
(upperPrismPoly 2 $ map toV2 [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)])
upperPrismPoly 2 (map toV2 [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)])
)
) <> bulletClip am
, mempty
@@ -566,21 +566,21 @@ longGun = defaultGun
, withMuzFlareI
]
, _wpRange = 200
, _itFloorPict = \_ -> longGunSPic
, _itFloorPict = longGunSPic
, _itAimingSpeed = 0.2
, _itAimingRange = 1
, _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
, _itEquipPict = pictureWeaponOnAim $ \_ -> longGunSPic
, _itEquipPict = pictureWeaponOnAim longGunSPic
, _itScroll = zoomLongGun
, _itAttachment = ItScope (V2 0 0) 0 1 False
, _itEffect = itemLaserScopeEffect
, _wpAmmo = hvBullet
, _itAimStance = TwoHandTwist
}
longGunSPic :: SPic
longGunSPic =
( colorSH orange $ upperPrismPoly 5 $ rectNESW 2 12 (-2) (-12)
longGunSPic :: Item -> SPic
longGunSPic _ =
( colorSH orange $ upperPrismPoly 5 $ rectWH 12 2
, mempty
)
+2 -1
View File
@@ -29,7 +29,8 @@ bezierGun = defaultGun
{ _itName = "B-GUN"
, _itUse = \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point
, _itUseModifiers =
[ useTimeCheckI
[ ammoCheckI
, useTimeCheckI
, withSoundStart tap2S
, useAmmo 1
, withMuzFlareI
+3
View File
@@ -60,6 +60,9 @@ jsps0J pst plm = Just $ Placement (PS (V2 0 0) 0 pst) $ \_ -> Just plm
ps0 :: PSType -> (Int -> Maybe Placement) -> Placement
ps0 pst = Placement (PS (V2 0 0) 0 pst)
jps0 :: PSType -> (Int -> Maybe Placement) -> Maybe Placement
jps0 pst = Just . Placement (PS (V2 0 0) 0 pst)
ps0j :: PSType -> Placement -> Placement
ps0j pst plmnt = Placement (PS (V2 0 0) 0 pst) (const $ Just plmnt)
+3 -2
View File
@@ -21,8 +21,9 @@ makeButton col eff = Button
{ _btPict = defaultDrawButton col
, _btPos = V2 0 0
, _btRot = 0
, _btEvent = \b w -> eff . over buttons (IM.adjust turnOn (_btID b))
. soundFromGeneral (LeverSound 0) (btpos b) click1S Nothing $ w
, _btEvent = \b w -> eff
. over buttons (IM.adjust turnOn (_btID b))
. soundFromGeneral (LeverSound 0) (btpos b) click1S Nothing $ w
, _btID = 0
, _btText = "Button"
, _btState = BtOff
+7 -5
View File
@@ -10,6 +10,7 @@ import Dodge.Item.Weapon
import Dodge.Item.Weapon.AutoGun
import Dodge.Item.Weapon.Launcher
import Dodge.Creature
import Dodge.Room.Foreground
--import Dodge.Creature.Inanimate
--import Dodge.LevelGen
import Dodge.LevelGen.Data
@@ -21,6 +22,7 @@ import Dodge.Default.Wall
--import Dodge.Layout
import Dodge.Layout.Tree.Polymorphic
import Dodge.Layout.Tree.Either
import Dodge.LightSources.Fitting
--import Dodge.LightSources
--import Dodge.SoundLogic
import Dodge.Room.Data
@@ -78,9 +80,11 @@ roomPadCut ps p = defaultRoom
roomPillars :: Room
roomPillars = over rmLinks init $ set rmPS plmnts $ roomRect 240 240 2 2
where
plmnts = sPS (V2 120 120) 0 putLamp
: sPS (V2 12 12) 0 putLamp
: sPS (V2 228 228) 0 putLamp
plmnts = mountedLightI 70 (V2 120 24) (V2 120 216)
: mountedLightV (V2 12 12) (V3 25 25 70)
: mountedLightV (V2 228 228) (V3 215 215 70)
: sps0 (PutForeground $ thinHighBar 75 (V2 26 25) (V2 120 25))
: sps0 (PutForeground $ thinHighBar 75 (V2 214 215) (V2 120 215))
: g 180 150 90 60
f a x b y = putBlockRect a x b y
g a b c d = f a b a b ++ f a b c d ++ f c d a b ++ f c d c d
@@ -321,11 +325,9 @@ weaponBetweenPillars = do
,sPS crPos2 (d crPos2) randC1
]
theRoom = roomPillars & rmPS %~ (++ plmnts)
-- & rmPolys %~ (rectNSWE 300 0 0 300 :)
(fmap connectRoom . randomiseOutLinks) =<< filterLinks f theRoom
where
f (_,a) = a == 0
--f (_,_) = True -- this is probably preferable...
weaponLongCorridor :: RandomGen g => State g (Tree (Either Room Room))
weaponLongCorridor = do
+3 -3
View File
@@ -39,10 +39,10 @@ twinSlowDoorRoom w h x = defaultRoom
]
, _rmPath = []
, _rmPS =
[ Placement (PS (V2 0 (h-5)) pi $ PutButton $ makeSwitch col red id id)
[ Placement (PS (V2 0 (h-5)) pi $ PutButton $ makeButton col id)
$ \btid -> jsps0J (PutSingleDoor col (cond' btid) (V2 x 1) (V2 x h) wlSpeed)
$ ps0 (PutSingleDoor col (cond' btid) (V2 (-x) 1) (V2 (-x) h) wlSpeed)
$ \did -> Just $ ps0 (PutLS (colorLightAt (V3 0.75 0 0) (V3 0 (h-1) lampHeight) 0))
$ \did -> jps0 (PutLS (colorLightAt (V3 0.75 0 0) (V3 0 (h-1) lampHeight) 0))
$ \lsid -> jsps0 $ PutProp $ addColorChange lsid did $ lampCoverWhen (drmoving did) (V2 0 (h-1)) lampHeight
]
, _rmBound = ps
@@ -62,7 +62,7 @@ twinSlowDoorRoom w h x = defaultRoom
[rectNSWE h 0 (-w) w
,rectNSWE 20 (-h) (negate x) x
]
cond' btid w' = _btState (_buttons w' IM.! btid) == BtOn
cond' btid w' = _btState (_buttons w' IM.! btid) /= BtOff
col = dim $ dim $ bright red
twinSlowDoorChasers
+5 -2
View File
@@ -63,8 +63,11 @@ rectNSEW !n !s !e !w = rectNESW n e s w
rectNSWE :: Float -> Float -> Float -> Float -> [Point2]
rectNSWE !n !s !w !e = [V2 w n, V2 w s, V2 e s, V2 e n]
-- | Draw a rectangle around the origin with given height and width
rectWdthHght :: Float -> Float -> [Point2]
rectWdthHght w h = rectNSWE h (-h) (-w) w
rectWH :: Float -> Float -> [Point2]
rectWH w h = rectNSWE h (-h) (-w) w
square :: Float -> [Point2]
square n = rectWH n n
mirrorXAxis :: [Point2] -> [Point2]
mirrorXAxis ps = orderPolygon $ ps ++ mapMaybe f ps