Start simplifying Prop

This commit is contained in:
2025-10-25 13:05:14 +01:00
parent 0da3816664
commit 5fce0772f8
6 changed files with 52 additions and 76 deletions
+1 -5
View File
@@ -39,14 +39,10 @@ data Debris = DebrisChunk
--data PropType = FallingBlock Material
data PropDraw
= PropDrawSPic SPic
| -- | PropDrawMovingShapeCol Shape
-- | PropDrawMovingShape PropDraw
PropDrawFlatTranslate PropDraw
= PropDrawFlatTranslate SPic
| PropDoubleLampCover Float
| PropVerticalLampCover Float
| PropLampCover Float
| PropDrawToggle PropDraw
-- | PropDrawGib Float
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
+1 -1
View File
@@ -7,7 +7,7 @@ defaultProp :: Prop
defaultProp =
ShapeProp
{ _prPos = V2 0 0
, _prDraw = PropDrawSPic mempty
, _prDraw = PropDrawFlatTranslate mempty
, _prID = 0
, _prUpdate = PropUpdateId
, _prToggle = True
+1 -2
View File
@@ -49,7 +49,6 @@ moveLSThen ::
Placement
moveLSThen posf off sh = propLSThen (PropUpdatePosition posf) (PrWdLsSetPosition posf off) thels theprop
where
--lsupdate _ w = lsParam . lsPos .~ addZ 0 (fst (posf w)) +.+.+ rotate3z (snd (posf w)) off
thels = LS 0 $ LSParam 0 200 0.6
theprop =
ShapeProp
@@ -58,7 +57,7 @@ moveLSThen posf off sh = propLSThen (PropUpdatePosition posf) (PrWdLsSetPosition
, _prRot = 0
, _prUpdate = PropUpdateId
, --, _prDraw = PropDrawSPic $ noPic $ uncurryV translateSHf (_prPos pr) $ rotateSH (_pjRot pr) sh
_prDraw = PropDrawFlatTranslate $ PropDrawSPic $ noPic sh
_prDraw = PropDrawFlatTranslate $ noPic sh
, _prToggle = True
}
+1 -11
View File
@@ -25,16 +25,11 @@ debrisSPic db = translateSP (_dbPos db) . overPosSP (Q.rotate (_dbRot db)) $
drawProp :: PropDraw -> Prop -> SPic
drawProp = \case
PropDrawSPic spic -> const spic
-- PropDrawMovingShape pd' -> \pr -> drawMovingShape pr (drawProp pd' pr)
-- PropDrawMovingShapeCol sh -> (`drawMovingShapeCol` sh)
PropDoubleLampCover h -> drawDoubleLampCover h
PropVerticalLampCover h -> drawVerticalLampCover h
PropLampCover h -> drawLampCover h
PropDrawToggle pd' -> propDrawToggle pd'
-- PropDrawGib x -> noPic . drawGib x
PropDrawFlatTranslate x -> \pr ->
uncurryV translateSPxy (_prPos pr) $ rotateSP (_prRot pr) $ drawProp x pr
uncurryV translateSPxy (_prPos pr) $ rotateSP (_prRot pr) x
drawGib :: Float -> Color -> Shape
drawGib x col = flesh <> skin
@@ -47,11 +42,6 @@ drawGib x col = flesh <> skin
translateSH (V3 1 1 (1 - x)) baseCube
baseCube = upperPrismPoly Small Typical (2 * x) $ square x
propDrawToggle :: PropDraw -> Prop -> SPic
propDrawToggle pd pr
| not (_prToggle pr) = mempty
| otherwise = drawProp pd pr
drawLampCover :: Float -> Prop -> SPic
drawLampCover h pr =
noPic
+7 -14
View File
@@ -2,6 +2,7 @@
-- | Rooms containing long doors, probably with a big reveal behind them.
module Dodge.Room.LongDoor where
import Linear
import Dodge.Door.PutSlideDoor
import Dodge.Default.Wall
import Control.Monad
@@ -77,7 +78,6 @@ twinSlowDoorRoom w h x =
thedoor btid =
defaultDoor
& drUpdate . drLerpSpeed .~ wlSpeed
-- & drTrigger .~ WdBlBtNotOff btid
& drTrigger .~ WdBlBtOn btid
col = dim $ dim $ bright red
@@ -101,23 +101,19 @@ addSouthPillars x h r = do
addButtonSlowDoor :: RandomGen g => Float -> Float -> Room -> State g Room
addButtonSlowDoor x h rm = do
shuffleLinks $
setOutLinksPD aboveH $
setInLinksPD belowH $
setOutLinksPD (f (> h + 40)) $
setInLinksPD (f (< h - 40)) $
rm
& rmPmnts .++~ [butDoor, theterminal]
& rmBound .:~ openDoorBound
where
f g y = g $ y ^. _1 . _y
theterminal =
putMessageTerminal terminalColor (simpleTermMessage themessage)
& plSpot .~ rprBoolShift (isUnusedLnkType InLink)
(shiftByV2 (V2 0 (-10)) <&> (,S.singleton UsedPosLow))
themessage =
[ "WARNING:"
, "LARGE BIOMASS DETECTED"
]
themessage = [ "WARNING:" , "LARGE BIOMASS DETECTED" ]
openDoorBound = reverse $ rectNSWE (h + 5) (h - 5) (3 * x / 2) (- x / 2)
belowH y = (sndV2 . fst) y < h - 40
aboveH y = (sndV2 . fst) y > h + 40
amountedlight dr xoff mpl = Just
. moveLSThen
(WdP2fDoorPosition (fromJust $ _plMID dr))
@@ -130,10 +126,8 @@ addButtonSlowDoor x h rm = do
setmount pldr plls plpr =
cWorld . lWorld . doors . ix (fromJust $ _plMID pldr) . drMounts
.++~ [MountedLS (fromJust $ _plMID plls), MountedProp (fromJust $ _plMID plpr)]
-- TODO make the height of this light source and of other mounted lights
-- be taken from a single consistent source
butDoor = putLitButOnPos
col
(dim $ light red)
(rprBool (isUnusedLnkType InLink))
$ \btplmnt -> Just $
putDoubleDoorThen
@@ -151,7 +145,6 @@ addButtonSlowDoor x h rm = do
dr2
(-50)
Nothing
col = dim $ light red
slowDoorRoom :: RandomGen g => State g Room
slowDoorRoom = do
@@ -168,7 +161,7 @@ slowDoorRoom = do
let crits = zipWith (\p r -> sPS p r randC1) ps rs
barrels = zipWith (\x' y' -> sPS (V2 x' y') 0 $ PutCrit explosiveBarrel) xs' ys'
proom <- southPillarsRoom x y h
addButtonSlowDoor x h (proom & rmPmnts %~ (++ (crits ++ barrels)))
addButtonSlowDoor x h (proom & rmPmnts <>~ (crits <> barrels))
slowDoorRoomRunPast :: RandomGen g => State g (MetaTree Room String)
slowDoorRoomRunPast = do
+41 -43
View File
@@ -984,10 +984,10 @@ Polyhedron src/Polyhedra/Data.hs 13;" C
PosInf src/Dodge/Data/CardinalPoint.hs 36;" C
PosRooms src/Dodge/Tree/Shift.hs 28;" t
Posture src/Dodge/Data/Creature/Stance.hs 33;" t
PrWdLsId src/Dodge/Data/Prop.hs 68;" C
PrWdLsLs src/Dodge/Data/Prop.hs 67;" t
PrWdLsSetColor src/Dodge/Data/Prop.hs 70;" C
PrWdLsSetPosition src/Dodge/Data/Prop.hs 69;" C
PrWdLsId src/Dodge/Data/Prop.hs 65;" C
PrWdLsLs src/Dodge/Data/Prop.hs 64;" t
PrWdLsSetColor src/Dodge/Data/Prop.hs 67;" C
PrWdLsSetPosition src/Dodge/Data/Prop.hs 66;" C
PreloadData src/Data/Preload.hs 10;" t
PrimitiveMode src/Shader/Data.hs 99;" t
PrintMaterial src/Dodge/Data/AmmoType.hs 12;" C
@@ -997,23 +997,22 @@ ProjectileParams src/Dodge/Data/Item/Use.hs 51;" C
ProjectileStabiliserSF src/Dodge/Data/ComposedItem.hs 36;" C
ProjectileType src/Dodge/Data/Projectile.hs 30;" t
Prop src/Dodge/Data/Prop.hs 15;" t
PropDoubleLampCover src/Dodge/Data/Prop.hs 46;" C
PropDoubleLampCover src/Dodge/Data/Prop.hs 44;" C
PropDraw src/Dodge/Data/Prop.hs 41;" t
PropDrawFlatTranslate src/Dodge/Data/Prop.hs 45;" C
PropDrawFlatTranslate src/Dodge/Data/Prop.hs 43;" C
PropDrawSPic src/Dodge/Data/Prop.hs 42;" C
PropDrawToggle src/Dodge/Data/Prop.hs 49;" C
PropLampCover src/Dodge/Data/Prop.hs 48;" C
PropRotate src/Dodge/Data/Prop.hs 57;" C
PropSetToggleAnd src/Dodge/Data/Prop.hs 58;" C
PropUpdate src/Dodge/Data/Prop.hs 54;" t
PropUpdateAnd src/Dodge/Data/Prop.hs 56;" C
PropUpdateId src/Dodge/Data/Prop.hs 55;" C
PropUpdateIf src/Dodge/Data/Prop.hs 63;" C
PropUpdateLS src/Dodge/Data/Prop.hs 60;" C
PropUpdatePosition src/Dodge/Data/Prop.hs 61;" C
PropUpdateWhen src/Dodge/Data/Prop.hs 62;" C
PropUpdates src/Dodge/Data/Prop.hs 59;" C
PropVerticalLampCover src/Dodge/Data/Prop.hs 47;" C
PropLampCover src/Dodge/Data/Prop.hs 46;" C
PropRotate src/Dodge/Data/Prop.hs 54;" C
PropSetToggleAnd src/Dodge/Data/Prop.hs 55;" C
PropUpdate src/Dodge/Data/Prop.hs 51;" t
PropUpdateAnd src/Dodge/Data/Prop.hs 53;" C
PropUpdateId src/Dodge/Data/Prop.hs 52;" C
PropUpdateIf src/Dodge/Data/Prop.hs 60;" C
PropUpdateLS src/Dodge/Data/Prop.hs 57;" C
PropUpdatePosition src/Dodge/Data/Prop.hs 58;" C
PropUpdateWhen src/Dodge/Data/Prop.hs 59;" C
PropUpdates src/Dodge/Data/Prop.hs 56;" C
PropVerticalLampCover src/Dodge/Data/Prop.hs 45;" C
ProxSensor src/Dodge/Data/Machine/Sensor.hs 25;" C
ProximityRequirement src/Dodge/Data/Machine/Sensor.hs 34;" t
ProximitySensor src/Dodge/Data/Machine/Sensor.hs 25;" t
@@ -2465,7 +2464,7 @@ _xNum src/Dodge/Data/Item/Combine.hs 170;" f
aFlame src/Dodge/Gas.hs 20;" f
aGasCloud src/Dodge/Gas.hs 15;" f
aRadarPulse src/Dodge/RadarSweep.hs 20;" f
aShape src/Dodge/Placement/Instance/LightSource.hs 120;" f
aShape src/Dodge/Placement/Instance/LightSource.hs 119;" f
aSound src/Dodge/SoundLogic.hs 74;" f
aTreeStrut src/Dodge/Tree/GenerateStructure.hs 42;" f
accessTerminal src/Dodge/WorldEffect.hs 54;" f
@@ -3255,7 +3254,7 @@ drawCursorByTerminalStatus src/Dodge/Render/Picture.hs 139;" f
drawDDATest src/Dodge/Debug/Picture.hs 309;" f
drawDamSensor src/Dodge/Machine/Draw.hs 27;" f
drawDebug src/Dodge/Debug.hs 173;" f
drawDoubleLampCover src/Dodge/Prop/Draw.hs 95;" f
drawDoubleLampCover src/Dodge/Prop/Draw.hs 88;" f
drawDrag src/Dodge/Render/Picture.hs 200;" f
drawDragDrop src/Dodge/Render/Picture.hs 229;" f
drawDragPickup src/Dodge/Render/Picture.hs 238;" f
@@ -3272,7 +3271,7 @@ drawFlame src/Dodge/Flame/Draw.hs 8;" f
drawFlamelet src/Dodge/EnergyBall/Draw.hs 37;" f
drawForceField src/Dodge/Wall/Draw.hs 13;" f
drawGapPlus src/Dodge/Render/Picture.hs 280;" f
drawGib src/Dodge/Prop/Draw.hs 39;" f
drawGib src/Dodge/Prop/Draw.hs 37;" f
drawHUD src/Dodge/Render/HUD.hs 51;" f
drawInputMenu src/Dodge/Render/MenuScreen.hs 19;" f
drawInspectWall src/Dodge/Debug/Picture.hs 253;" f
@@ -3283,7 +3282,7 @@ drawItemConnections src/Dodge/Render/HUD.hs 319;" f
drawJumpDown src/Dodge/Render/Picture.hs 192;" f
drawLabCrossCol src/Dodge/Render/Label.hs 8;" f
drawLabelledList src/Dodge/Render/List.hs 212;" f
drawLampCover src/Dodge/Prop/Draw.hs 55;" f
drawLampCover src/Dodge/Prop/Draw.hs 48;" f
drawLaser src/Dodge/Laser/Update.hs 29;" f
drawLightSource src/Dodge/LightSource/Draw.hs 7;" f
drawLinearShockwave src/Dodge/LinearShockwave/Draw.hs 10;" f
@@ -3342,7 +3341,7 @@ drawTitleBackground src/Dodge/Render/List.hs 45;" f
drawTractorBeam src/Dodge/TractorBeam/Draw.hs 7;" f
drawTurret src/Dodge/Machine/Draw.hs 76;" f
drawVerticalDoubleArrow src/Dodge/Render/Picture.hs 212;" f
drawVerticalLampCover src/Dodge/Prop/Draw.hs 71;" f
drawVerticalLampCover src/Dodge/Prop/Draw.hs 64;" f
drawWall src/Dodge/Wall/Draw.hs 9;" f
drawWallFace src/Dodge/Debug/Picture.hs 73;" f
drawWallSearchRays src/Dodge/Debug/Picture.hs 318;" f
@@ -3693,7 +3692,7 @@ horPipe src/Dodge/Placement/Instance/Pipe.hs 9;" f
hotkeyToChar src/Dodge/Inventory/SelectionList.hs 188;" f
hotkeyToScancode src/Dodge/Creature/YourControl.hs 82;" f
hotkeyToString src/Dodge/Inventory/SelectionList.hs 185;" f
iShape src/Dodge/Placement/Instance/LightSource.hs 86;" f
iShape src/Dodge/Placement/Instance/LightSource.hs 85;" f
icosahedronPoints src/Polyhedra/Geodesic.hs 12;" f
icosohedronFaces src/Polyhedra/Geodesic.hs 19;" f
ildtPropagate src/Dodge/DoubleTree.hs 111;" f
@@ -3869,7 +3868,7 @@ itmBaseInfo src/Dodge/Item/Info.hs 30;" f
itmEquipSiteInfo src/Dodge/Item/Info.hs 250;" f
itmSpaceInfo src/Dodge/Item/Info.hs 25;" f
itmUsageInfo src/Dodge/Item/Info.hs 230;" f
jShape src/Dodge/Placement/Instance/LightSource.hs 98;" f
jShape src/Dodge/Placement/Instance/LightSource.hs 97;" f
joinItemsInList src/Dodge/Item/Grammar.hs 206;" f
joystick src/Dodge/Item/Scope.hs 149;" f
jps0' src/Dodge/LevelGen/PlacementHelper.hs 60;" f
@@ -3892,7 +3891,7 @@ knifeS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 638;" f
lChasm src/Dodge/Room/Tutorial.hs 151;" f
lConnect src/Dodge/Render/Connectors.hs 42;" f
lConnectMulti src/Dodge/Render/Connectors.hs 46;" f
lShape src/Dodge/Placement/Instance/LightSource.hs 89;" f
lShape src/Dodge/Placement/Instance/LightSource.hs 88;" f
lamp src/Dodge/Creature/Lamp.hs 21;" f
lampCover src/Dodge/Placement/Instance/LightSource/Cover.hs 8;" f
lampCoverWhen src/Dodge/Placement/Instance/LightSource/Cover.hs 19;" f
@@ -3932,7 +3931,7 @@ leftRightCombine src/Dodge/Item/Grammar.hs 197;" f
leftWristPQ src/Dodge/Creature/HandPos.hs 81;" f
legsSPic src/Dodge/Item/Draw/SPic.hs 468;" f
lerpP2A src/Dodge/ShiftPoint.hs 14;" f
liShape src/Dodge/Placement/Instance/LightSource.hs 111;" f
liShape src/Dodge/Placement/Instance/LightSource.hs 110;" f
light src/Color.hs 104;" f
lightSensByDoor src/Dodge/Room/LasTurret.hs 51;" f
lightSensInsideDoor src/Dodge/Room/LasTurret.hs 39;" f
@@ -4166,11 +4165,11 @@ mkCustomLenses src/ThirdPartyLens.hs 7;" f
mkGraphFromEdges src/GraphHelp.hs 4;" f
mkNode src/Dodge/Graph.hs 29;" f
mkRectangle src/Dodge/LevelGen/DoorPane.hs 7;" f
mntLS src/Dodge/Placement/Instance/LightSource.hs 136;" f
mntLSCond src/Dodge/Placement/Instance/LightSource.hs 159;" f
mntLSOn src/Dodge/Placement/Instance/LightSource.hs 66;" f
mntLightLnkCond src/Dodge/Placement/Instance/LightSource.hs 176;" f
mntLightLnkCond' src/Dodge/Placement/Instance/LightSource.hs 181;" f
mntLS src/Dodge/Placement/Instance/LightSource.hs 135;" f
mntLSCond src/Dodge/Placement/Instance/LightSource.hs 158;" f
mntLSOn src/Dodge/Placement/Instance/LightSource.hs 65;" f
mntLightLnkCond src/Dodge/Placement/Instance/LightSource.hs 175;" f
mntLightLnkCond' src/Dodge/Placement/Instance/LightSource.hs 180;" f
modTo src/Geometry/Zone.hs 10;" f
mouseClickOptionsList src/Dodge/Update/Input/ScreenLayer.hs 60;" f
mouseCursorType src/Dodge/Render/Picture.hs 92;" f
@@ -4482,7 +4481,6 @@ prismBox src/Shape.hs 73;" f
prismPoly src/Shape.hs 59;" f
projV src/Geometry/Vector.hs 177;" f
projV3 src/Geometry/Vector3D.hs 127;" f
propDrawToggle src/Dodge/Prop/Draw.hs 50;" f
propLSThen src/Dodge/Placement/Instance/LightSource.hs 29;" f
propSPic src/Dodge/Prop/Draw.hs 17;" f
propSetToggleAnd src/Dodge/Prop/Update.hs 39;" f
@@ -4520,7 +4518,7 @@ putDoor src/Dodge/Room/Airlock.hs 113;" f
putDoubleDoor src/Dodge/Placement/Instance/Door.hs 17;" f
putDoubleDoorThen src/Dodge/Placement/Instance/Door.hs 27;" f
putImmediateMessageTerminal src/Dodge/Placement/Instance/Terminal.hs 65;" f
putLamp src/Dodge/Placement/Instance/LightSource.hs 222;" f
putLamp src/Dodge/Placement/Instance/LightSource.hs 221;" f
putLasTurret src/Dodge/Placement/Instance/Turret.hs 23;" f
putLitButOnPos src/Dodge/Placement/Instance/Button.hs 65;" f
putLitButOnPosExtTrig src/Dodge/Placement/Instance/Button.hs 103;" f
@@ -4945,8 +4943,8 @@ slap1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 670;" f
slapS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 604;" f
slideDoorS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 688;" f
slideWindow src/ListHelp.hs 80;" f
slowDoorRoom src/Dodge/Room/LongDoor.hs 156;" f
slowDoorRoomRunPast src/Dodge/Room/LongDoor.hs 173;" f
slowDoorRoom src/Dodge/Room/LongDoor.hs 149;" f
slowDoorRoomRunPast src/Dodge/Room/LongDoor.hs 166;" f
smallBattery src/Dodge/Item/Ammo.hs 60;" f
smallBranch src/Dodge/Tree/GenerateStructure.hs 32;" f
smallChaseCrit src/Dodge/Creature/ChaseCrit.hs 14;" f
@@ -4983,10 +4981,10 @@ soundWithStatus src/Dodge/SoundLogic.hs 104;" f
soundWithStatusVolume src/Dodge/SoundLogic.hs 54;" f
southPillarsRoom src/Dodge/Room/LongDoor.hs 90;" f
spaceAction src/Dodge/Update/Input/InGame.hs 528;" f
spanColLightBlackI src/Dodge/Placement/Instance/LightSource.hs 206;" f
spanColLightI src/Dodge/Placement/Instance/LightSource.hs 199;" f
spanLS src/Dodge/Placement/Instance/LightSource.hs 191;" f
spanLightI src/Dodge/Placement/Instance/LightSource.hs 213;" f
spanColLightBlackI src/Dodge/Placement/Instance/LightSource.hs 205;" f
spanColLightI src/Dodge/Placement/Instance/LightSource.hs 198;" f
spanLS src/Dodge/Placement/Instance/LightSource.hs 190;" f
spanLightI src/Dodge/Placement/Instance/LightSource.hs 212;" f
sparkDam src/Dodge/Spark.hs 36;" f
sparkGun src/Dodge/Item/Held/BatteryGuns.hs 13;" f
sparkRandDir src/Dodge/Spark.hs 116;" f
@@ -5275,7 +5273,7 @@ tutRoomTree src/Dodge/Floor.hs 21;" f
tutorialMessage1 src/Dodge/Room/Tutorial.hs 402;" f
tweenAngles src/Geometry/Vector.hs 190;" f
twinSlowDoorChasers src/Dodge/Room/LongDoor.hs 84;" f
twinSlowDoorRoom src/Dodge/Room/LongDoor.hs 31;" f
twinSlowDoorRoom src/Dodge/Room/LongDoor.hs 32;" f
twists src/Dodge/Creature/Test.hs 102;" f
twoFlat src/Dodge/Creature/Test.hs 99;" f
twoFlatHRot src/Dodge/Item/HeldOffset.hs 80;" f
@@ -5466,7 +5464,7 @@ vCen3 src/Geometry/Vector3D.hs 115;" f
vInverse src/Geometry/Vector.hs 154;" f
vNormal src/Geometry/Vector.hs 149;" f
vNormaly src/Geometry/Vector3D.hs 72;" f
vShape src/Dodge/Placement/Instance/LightSource.hs 126;" f
vShape src/Dodge/Placement/Instance/LightSource.hs 125;" f
vToL src/MatrixHelper.hs 46;" f
vToQuat src/Quaternion.hs 42;" f
validTerminalCommands src/Dodge/Debug/Terminal.hs 137;" f