Cleanup your aim posture

This commit is contained in:
2026-04-03 15:11:53 +01:00
parent de7f430c2a
commit 921f860e83
2 changed files with 51 additions and 53 deletions
+16 -16
View File
@@ -28,7 +28,11 @@ yourControl _ w
| inTextInputFocus w = w
| NoSubInventory <- w ^. hud . subInventory =
w
& cWorld . lWorld . creatures . ix 0 %~ wasdWithAiming w
& cWorld
. lWorld
. creatures
. ix 0
%~ wasdWithAiming w
& tryClickUse (w ^. input . mouseButtons)
& handleHotkeys
| otherwise = w & cWorld . lWorld . creatures . ix 0 %~ wasdWithAiming w
@@ -113,32 +117,28 @@ wasdWithAiming w cr = wasdAim inp w $ wasdMovement (w ^. cWorld . lWorld) inp ca
wasdAim :: Input -> World -> Creature -> Creature
wasdAim inp w cr
| SDL.ButtonRight `M.member` _mouseButtons inp
, AtEase <- cr ^. crStance . posture =
setAimPosture cr
, AtEase <- cr ^. crStance . posture = setposture Aiming (-twoHandTwistAmount)
-- cr
-- & crStance . posture .~ Aiming
-- & doAimTwist (cr ^? crManipulation . manObject . imAimStance) (-twoHandTwistAmount)
| SDL.ButtonRight `M.member` _mouseButtons inp =
aimTurn (w ^. cWorld . lWorld) mousedir cr
| Aiming{} <- cr ^. crStance . posture = removeAimPosture cr
| Aiming{} <- cr ^. crStance . posture = setposture AtEase twoHandTwistAmount
-- cr
-- & crStance . posture .~ AtEase
-- & doAimTwist (cr ^? crManipulation . manObject . imAimStance) twoHandTwistAmount
| otherwise = creatureTurnTowardDir (_crMvAim cr) 0.2 cr
where
setposture x r = cr
& crStance . posture .~ x
& doAimTwist (cr ^? crManipulation . manObject . imAimStance) r
mousedir = argV $ w ^. cWorld . lWorld . lAimPos - (cr ^. crPos . _xy)
setAimPosture :: Creature -> Creature
setAimPosture cr =
cr
& crStance . posture .~ Aiming
& doAimTwist (cr ^? crManipulation . manObject . imAimStance) (-twoHandTwistAmount)
doAimTwist :: Maybe AimStance -> Float -> Creature -> Creature
doAimTwist as x
| as == Just TwoHandTwist = crDir +~ x
| otherwise = id
removeAimPosture :: Creature -> Creature
removeAimPosture cr =
cr
& crStance . posture .~ AtEase
& doAimTwist (cr ^? crManipulation . manObject . imAimStance) twoHandTwistAmount
twoHandTwistAmount :: Float
twoHandTwistAmount = 1.6 * pi
+35 -37
View File
@@ -2573,7 +2573,7 @@ advanceScrollAmount src/Dodge/Update.hs 479;" f
advanceSmoothScroll src/Dodge/SmoothScroll.hs 33;" f
aimDelaySweep src/Dodge/Render/Picture.hs 285;" f
aimStanceInfo src/Dodge/Item/Info.hs 243;" f
aimTurn src/Dodge/Creature/YourControl.hs 157;" f
aimTurn src/Dodge/Creature/YourControl.hs 150;" f
airlock src/Dodge/Room/Airlock.hs 28;" f
airlock0 src/Dodge/Room/Airlock.hs 78;" f
airlock90 src/Dodge/Room/Airlock.hs 201;" f
@@ -2639,7 +2639,7 @@ argV src/Geometry/Vector.hs 83;" f
armourChaseCrit src/Dodge/Creature/ArmourChase.hs 34;" f
armouredChasers src/Dodge/Room/Boss.hs 58;" f
armouredCorridor src/Dodge/Room/RoadBlock.hs 20;" f
arms src/Dodge/Creature/Picture.hs 133;" f
arms src/Dodge/Creature/Picture.hs 134;" f
arrow src/Picture/Composite.hs 19;" f
arrowPath src/Picture/Composite.hs 8;" f
assignHotkey src/Dodge/AssignHotkey.hs 9;" f
@@ -2664,7 +2664,7 @@ autoCrit src/Dodge/Creature/AutoCrit.hs 10;" f
autoGunS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 554;" f
autoPistol src/Dodge/Item/Held/Stick.hs 21;" f
autoRifle src/Dodge/Item/Held/Cane.hs 27;" f
awakeLevelPerception src/Dodge/Creature/Perception.hs 172;" f
awakeLevelPerception src/Dodge/Creature/Perception.hs 174;" f
axisInt src/Geometry/Intersect.hs 246;" f
azure src/Color.hs 49;" f
bQuadToF src/Geometry/Bezier.hs 37;" f
@@ -2691,11 +2691,11 @@ baseItemTriggerType src/Dodge/BaseTriggerType.hs 21;" f
baseRifleShape src/Dodge/Item/Draw/SPic.hs 324;" f
baseRodShape src/Dodge/Item/Draw/SPic.hs 407;" f
baseSMGShape src/Dodge/Item/Draw/SPic.hs 395;" f
baseShoulder src/Dodge/Creature/Picture.hs 171;" f
baseShoulder src/Dodge/Creature/Picture.hs 172;" f
baseStickShape src/Dodge/Item/Draw/SPic.hs 301;" f
baseStickShapeX src/Dodge/Item/Draw/SPic.hs 293;" f
baseStickSpread src/Dodge/HeldUse.hs 346;" f
basicAttentionUpdate src/Dodge/Creature/Perception.hs 138;" f
basicAttentionUpdate src/Dodge/Creature/Perception.hs 140;" f
basicAwarenessUpdate src/Dodge/Creature/Perception.hs 35;" f
basicCrPict src/Dodge/Creature/Picture.hs 37;" f
basicCrShape src/Dodge/Creature/Picture.hs 43;" f
@@ -2884,8 +2884,8 @@ clsNearCirc src/Dodge/Zoning/Cloud.hs 21;" f
clsNearPoint src/Dodge/Zoning/Cloud.hs 9;" f
clsNearRect src/Dodge/Zoning/Cloud.hs 18;" f
clsNearSeg src/Dodge/Zoning/Cloud.hs 15;" f
cogRaised src/Dodge/Creature/Perception.hs 112;" f
cognizantVoc src/Dodge/Creature/Perception.hs 69;" f
cogRaised src/Dodge/Creature/Perception.hs 114;" f
cognizantVoc src/Dodge/Creature/Perception.hs 71;" f
colCrWall src/Dodge/WallCreatureCollisions.hs 27;" f
colCrsWalls src/Dodge/WallCreatureCollisions.hs 19;" f
collectDamageTypes src/Dodge/Damage.hs 54;" f
@@ -2907,7 +2907,7 @@ colorLamp src/Dodge/Creature/Lamp.hs 10;" f
colorSH src/Shape.hs 234;" f
combinationsOf src/Multiset.hs 46;" f
combinationsTrie src/Dodge/Combine.hs 44;" f
combineAwareness src/Dodge/Creature/Perception.hs 120;" f
combineAwareness src/Dodge/Creature/Perception.hs 122;" f
combineFloors src/Dodge/Room/Procedural.hs 154;" f
combineInventoryExtra src/Dodge/Render/HUD.hs 340;" f
combineItemListYouX src/Dodge/Combine.hs 36;" f
@@ -2968,7 +2968,7 @@ crHeight src/Dodge/Base/Collide.hs 175;" f
crHit src/Dodge/WorldEvent/ThingsHit.hs 137;" f
crIXsNearCirc src/Dodge/Zoning/Creature.hs 33;" f
crIXsNearPoint src/Dodge/Zoning/Creature.hs 15;" f
crImpulsesOnCognizant src/Dodge/Creature/Perception.hs 60;" f
crImpulsesOnCognizant src/Dodge/Creature/Perception.hs 62;" f
crInAimStance src/Dodge/Creature/Test.hs 91;" f
crIntelligence src/Dodge/Creature/Statistics.hs 39;" f
crIsAiming src/Dodge/Creature/Test.hs 58;" f
@@ -3099,10 +3099,10 @@ deZoneIX src/Dodge/Zoning/Base.hs 91;" f
deZoneWall src/Dodge/Zoning/Wall.hs 69;" f
deadEndPSType src/Dodge/Room/Room.hs 264;" f
deadEndRoom src/Dodge/Room/Room.hs 267;" f
deadFeet src/Dodge/Creature/Picture.hs 129;" f
deadRot src/Dodge/Creature/Picture.hs 147;" f
deadScalp src/Dodge/Creature/Picture.hs 142;" f
deadUpperBody src/Dodge/Creature/Picture.hs 168;" f
deadFeet src/Dodge/Creature/Picture.hs 130;" f
deadRot src/Dodge/Creature/Picture.hs 148;" f
deadScalp src/Dodge/Creature/Picture.hs 143;" f
deadUpperBody src/Dodge/Creature/Picture.hs 169;" f
debrisS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 730;" f
debrisSPic src/Dodge/Prop/Draw.hs 17;" f
debrisSize src/Dodge/Block/Debris.hs 131;" f
@@ -3126,7 +3126,7 @@ decomposeTree src/Dodge/Tree/Compose.hs 59;" f
decontamRoom src/Dodge/Room/Airlock.hs 37;" f
decoratedBlock src/Dodge/Placement/Instance/Block.hs 14;" f
decorationToShape src/Dodge/Placement/TopDecoration.hs 16;" f
decreaseAwareness src/Dodge/Creature/Perception.hs 129;" f
decreaseAwareness src/Dodge/Creature/Perception.hs 131;" f
decrementTimer src/Sound.hs 104;" f
dedaS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 560;" f
dededaS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 682;" f
@@ -3232,7 +3232,7 @@ divideLine src/Geometry.hs 248;" f
divideLineExact src/Geometry.hs 276;" f
divideLineOddNumPoints src/Geometry.hs 261;" f
dmType src/Dodge/Damage.hs 38;" f
doAimTwist src/Dodge/Creature/YourControl.hs 131;" f
doAimTwist src/Dodge/Creature/YourControl.hs 130;" f
doAnyEquipmentEffect src/Dodge/Creature/State.hs 146;" f
doBackspace src/Dodge/Update/Input/Text.hs 31;" f
doBarrelSpin src/Dodge/Projectile/Update.hs 168;" f
@@ -3354,7 +3354,7 @@ drawDragSelecting src/Dodge/Render/HUD.hs 162;" f
drawDumbSwitch src/Dodge/Button/Draw.hs 31;" f
drawEmptySet src/Dodge/Render/Picture.hs 151;" f
drawEnergyBall src/Dodge/EnergyBall/Draw.hs 7;" f
drawEquipment src/Dodge/Creature/Picture.hs 180;" f
drawEquipment src/Dodge/Creature/Picture.hs 181;" f
drawExamineInventory src/Dodge/Render/HUD.hs 199;" f
drawExplosiveBall src/Dodge/EnergyBall/Draw.hs 15;" f
drawFarWallDetect src/Dodge/Debug/Picture.hs 271;" f
@@ -3534,7 +3534,7 @@ faceEdges src/Polyhedra.hs 62;" f
facesToVF src/Polyhedra/Geodesic.hs 70;" f
farWallDistDirection src/Dodge/Update/Camera.hs 245;" f
fdiv src/ShortShow.hs 41;" f
feet src/Dodge/Creature/Picture.hs 115;" f
feet src/Dodge/Creature/Picture.hs 116;" f
filter3 src/FoldableHelp.hs 76;" f
filterSectionsPair src/Dodge/DisplayInventory.hs 160;" f
findBlips src/Dodge/RadarSweep.hs 63;" f
@@ -3759,7 +3759,7 @@ heldEffectMuzzles src/Dodge/HeldUse.hs 135;" f
heldHandlePos src/Dodge/Item/HeldOffset.hs 98;" f
heldInfo src/Dodge/Item/Info.hs 92;" f
heldItemAmmoSlots src/Dodge/Item/AmmoSlots.hs 20;" f
heldItemBulkiness src/Dodge/Creature/YourControl.hs 170;" f
heldItemBulkiness src/Dodge/Creature/YourControl.hs 163;" f
heldItemInvLock src/Dodge/HeldUse.hs 469;" f
heldItemMuzVel src/Dodge/HeldUse.hs 1022;" f
heldItemMuzzles src/Dodge/HeldUse.hs 198;" f
@@ -3881,7 +3881,7 @@ invisibleChaseCrit src/Dodge/Creature/ChaseCrit.hs 22;" f
invisibleWall src/Dodge/Placement/Instance/Wall.hs 27;" f
isAmmoIntLink src/Dodge/HeldUse.hs 738;" f
isAnimate src/Dodge/Creature/Test.hs 132;" f
isCognizant src/Dodge/Creature/Perception.hs 116;" f
isCognizant src/Dodge/Creature/Perception.hs 118;" f
isConnected src/Dodge/Inventory/Swap.hs 77;" f
isCornerLink src/Dodge/RoomLink.hs 66;" f
isFlyable src/Dodge/WorldEvent/ThingsHit.hs 192;" f
@@ -3921,7 +3921,7 @@ itemBaseName src/Dodge/Item/Display.hs 60;" f
itemBaseStance src/Dodge/Item/AimStance.hs 22;" f
itemBelowAttachables src/Dodge/Item/Grammar.hs 53;" f
itemBlips src/Dodge/RadarSweep.hs 94;" f
itemBulkiness src/Dodge/Creature/YourControl.hs 164;" f
itemBulkiness src/Dodge/Creature/YourControl.hs 157;" f
itemCombinations src/Dodge/Combine/Combinations.hs 56;" f
itemDetectorEffect src/Dodge/HeldUse.hs 811;" f
itemDisplay src/Dodge/Inventory/SelectionList.hs 53;" f
@@ -4317,9 +4317,9 @@ nearRect src/Dodge/Zoning/Common.hs 16;" f
nearSeg src/Dodge/Zoning/Common.hs 12;" f
nearZeroAngle src/Geometry/Vector.hs 140;" f
nearestAngleRep src/Geometry.hs 148;" f
newExtraAwareness src/Dodge/Creature/Perception.hs 148;" f
newExtraAwareness src/Dodge/Creature/Perception.hs 150;" f
newKey src/IntMapHelp.hs 61;" f
newSounds src/Dodge/Creature/Perception.hs 180;" f
newSounds src/Dodge/Creature/Perception.hs 182;" f
newSoundsToPlay src/Dodge/SoundSelection.hs 8;" f
newTextureFramebuffer src/Framebuffer/Setup.hs 16;" f
nextArc src/Dodge/Tesla.hs 60;" f
@@ -4357,7 +4357,7 @@ oldMachineBootS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 638;" f
onEquipWristShield src/Dodge/Euse.hs 89;" f
onRemoveWristShield src/Dodge/Euse.hs 79;" f
oneH src/Dodge/Creature/Test.hs 95;" f
oneSmooth src/Dodge/Creature/Picture.hs 112;" f
oneSmooth src/Dodge/Creature/Picture.hs 113;" f
openConsole src/Dodge/Update.hs 138;" f
optionMenu src/Dodge/Menu.hs 110;" f
optionScreenDefaultEffect src/Dodge/Update/Input/ScreenLayer.hs 62;" f
@@ -4697,10 +4697,9 @@ reload1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 706;" f
reloadFailS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 804;" f
reloadLevelStart src/Dodge/Save.hs 71;" f
reloadS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 534;" f
rememberSounds src/Dodge/Creature/Perception.hs 187;" f
rememberSounds src/Dodge/Creature/Perception.hs 189;" f
remoteDetonator src/Dodge/Item/Scope.hs 152;" f
remoteScreen src/Dodge/Item/Scope.hs 146;" f
removeAimPosture src/Dodge/Creature/YourControl.hs 136;" f
removeAmmoFromMag src/Dodge/HeldUse.hs 933;" f
removeDot src/ShortShow.hs 44;" f
removeInverseWalls src/Dodge/LevelGen/StaticWalls.hs 25;" f
@@ -4842,7 +4841,7 @@ scale3 src/Picture/Base.hs 137;" f
scaleMat src/MatrixHelper.hs 71;" f
scaleMatrix src/MatrixHelper.hs 68;" f
scaleSH src/Shape.hs 266;" f
scalp src/Dodge/Creature/Picture.hs 156;" f
scalp src/Dodge/Creature/Picture.hs 157;" f
scancodeToHotkey src/Dodge/Creature/YourControl.hs 82;" f
scodeToChar src/Dodge/ScodeToChar.hs 6;" f
scorchSPic src/Dodge/Creature/Update.hs 137;" f
@@ -4895,7 +4894,6 @@ sensorTypeDamages src/Dodge/Wall/Damage.hs 92;" f
sentinelAI src/Dodge/Creature/SentinelAI.hs 20;" f
sentinelExtraWatchUpdate src/Dodge/Creature/SentinelAI.hs 82;" f
sentinelFireType src/Dodge/Creature/SentinelAI.hs 49;" f
setAimPosture src/Dodge/Creature/YourControl.hs 125;" f
setChannelPos src/Sound.hs 152;" f
setClickWorldPos src/Dodge/Update.hs 108;" f
setClip src/Dodge/Debug.hs 239;" f
@@ -5002,10 +5000,10 @@ showEquipItem src/Dodge/Item/Display.hs 108;" f
showInt src/Dodge/Item/Info.hs 75;" f
showIntsString src/Dodge/Tree/Compose.hs 130;" f
showInventoryPathing src/Dodge/Item/Display.hs 86;" f
showManObj src/Dodge/TestString.hs 90;" f
showManObj src/Dodge/TestString.hs 91;" f
showMuzzlePositions src/Dodge/Debug.hs 292;" f
showTerminalError src/Dodge/Debug/Terminal.hs 80;" f
showTimeFlow src/Dodge/TestString.hs 100;" f
showTimeFlow src/Dodge/TestString.hs 101;" f
shrinkPolyOnEdges src/Geometry/Polygon.hs 198;" f
shrinkVert src/Geometry/Polygon.hs 202;" f
shuffle src/RandomHelp.hs 68;" f
@@ -5066,7 +5064,7 @@ someCrits src/Dodge/LockAndKey.hs 122;" f
soundAngle src/Dodge/SoundLogic.hs 163;" f
soundContinue src/Dodge/SoundLogic.hs 131;" f
soundContinueVol src/Dodge/SoundLogic.hs 145;" f
soundIsClose src/Dodge/Creature/Perception.hs 193;" f
soundIsClose src/Dodge/Creature/Perception.hs 195;" f
soundMenu src/Dodge/Menu.hs 158;" f
soundMenuOptions src/Dodge/Menu.hs 161;" f
soundMultiFrom src/Dodge/SoundLogic.hs 187;" f
@@ -5311,11 +5309,11 @@ tone440sawtoothquietS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 668;" f
topInvW src/Dodge/ListDisplayParams.hs 54;" f
topPrismEdgeIndices src/Shader/Poke.hs 335;" f
topPrismIndices src/Shader/Poke.hs 410;" f
topTestPart src/Dodge/TestString.hs 86;" f
topTestPart src/Dodge/TestString.hs 87;" f
torchShape src/Dodge/Item/Draw/SPic.hs 277;" f
torqueAmount src/Dodge/HeldUse.hs 606;" f
torqueCr src/Dodge/WorldEffect.hs 85;" f
torso src/Dodge/Creature/Picture.hs 161;" f
torso src/Dodge/Creature/Picture.hs 162;" f
tractCr src/Dodge/TractorBeam/Update.hs 28;" f
tractFlIt src/Dodge/TractorBeam/Update.hs 23;" f
tractorBeamAt src/Dodge/HeldUse.hs 850;" f
@@ -5364,7 +5362,7 @@ truncFaces src/Polyhedra/Geodesic.hs 54;" f
truncate src/Polyhedra/Geodesic.hs 39;" f
trunkDepth src/TreeHelp.hs 164;" f
tryAttachItems src/Dodge/Item/Grammar.hs 34;" f
tryClickUse src/Dodge/Creature/YourControl.hs 212;" f
tryClickUse src/Dodge/Creature/YourControl.hs 205;" f
tryCombine src/Dodge/Update/Input/InGame.hs 521;" f
tryDrawToCapacitor src/Dodge/Creature/State.hs 156;" f
tryDropSelected src/Dodge/Update/Input/InGame.hs 140;" f
@@ -5396,7 +5394,7 @@ twists src/Dodge/Creature/Test.hs 101;" f
twoFlat src/Dodge/Creature/Test.hs 98;" f
twoFlatHRot src/Dodge/Item/HeldOffset.hs 89;" f
twoHandOffY src/Dodge/Creature/HandPos.hs 130;" f
twoHandTwistAmount src/Dodge/Creature/YourControl.hs 142;" f
twoHandTwistAmount src/Dodge/Creature/YourControl.hs 135;" f
twoRoomPoss src/Dodge/PlacementSpot.hs 148;" f
twoStep1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 522;" f
twoStepS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 570;" f
@@ -5547,7 +5545,7 @@ updateWheelEvent src/Dodge/Update/Scroll.hs 21;" f
updateWheelEvents src/Dodge/Update.hs 474;" f
updateWorldEventFlag src/Dodge/Update.hs 127;" f
updateWorldEventFlags src/Dodge/Update.hs 115;" f
upperBody src/Dodge/Creature/Picture.hs 176;" f
upperBody src/Dodge/Creature/Picture.hs 177;" f
upperBox src/Shape.hs 153;" f
upperBoxHalf src/Shape.hs 219;" f
upperBoxMT src/Shape.hs 144;" f
@@ -5610,7 +5608,7 @@ viewRoomBoundaries src/Dodge/Debug/Picture.hs 341;" f
viewTarget src/Dodge/Creature/ReaderUpdate.hs 171;" f
violet src/Color.hs 48;" f
visibleWalls src/Dodge/Base/Collide.hs 218;" f
visionCheck src/Dodge/Creature/Perception.hs 163;" f
visionCheck src/Dodge/Creature/Perception.hs 165;" f
volleyGun src/Dodge/Item/Held/Cane.hs 15;" f
volleyGunShape src/Dodge/Item/Draw/SPic.hs 355;" f
walkNozzle src/Dodge/HeldUse.hs 826;" f
@@ -5628,7 +5626,7 @@ warp1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 850;" f
wasdAim src/Dodge/Creature/YourControl.hs 113;" f
wasdDir src/Dodge/WASD.hs 17;" f
wasdM src/Dodge/WASD.hs 9;" f
wasdMovement src/Dodge/Creature/YourControl.hs 145;" f
wasdMovement src/Dodge/Creature/YourControl.hs 138;" f
wasdWithAiming src/Dodge/Creature/YourControl.hs 106;" f
watchCombinations src/Dodge/Combine/Combinations.hs 16;" f
watchUpdateStrat src/Dodge/Creature/ReaderUpdate.hs 201;" f