Replace buggy circle seg intersection with a simpler test

This commit is contained in:
2024-12-26 21:53:18 +00:00
parent 91ba6ee148
commit 0ef28c132e
29 changed files with 528 additions and 332 deletions
+34 -1
View File
@@ -299,7 +299,8 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
MuzzleLaser -> shootLaser itmtree cr mz w
MuzzleTesla -> shootTeslaArc itm cr mz w
MuzzleTractor -> shootTractorBeam cr w
MuzzleLauncher -> createProjectile magtree mz itmtree cr w
MuzzleRLauncher -> createProjectile magtree mz itmtree cr w
MuzzleGLauncher -> createGProjectile magtree mz itmtree cr w
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
MuzzleShatter -> shootShatter itm cr w
MuzzleDetector -> itemDetectorEffect itm cr w
@@ -632,6 +633,38 @@ createProjectile magtree muz itmtree cr = fromMaybe failsound $ do
Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
_ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
createGProjectile ::
LabelDoubleTree ComposeLinkType Item ->
Muzzle ->
LabelDoubleTree ComposeLinkType Item ->
Creature ->
World ->
World
createGProjectile magtree muz itmtree cr = fromMaybe failsound $ do
magid <- magtree ^? ldtValue . itLocation . ilInvID
ammoitem <- cr ^? crInv . ix magid
let homing = determineProjectileTracking magtree itmtree
rdetonate = fmap (^. ldtValue . itID) $
lookup RemoteDetonatorLink (magtree ^. ldtLeft)
rscreen = fmap (^. ldtValue . itID) $
lookup RemoteScreenLink (magtree ^. ldtLeft)
aparams <- ((magtree ^? ldtLeft) >>= lookup AmmoPayloadLink >>= (^? ldtValue . itType . ibtAttach . shellPayload))
<|> ammoitem ^? itConsumables . magParams . ampPayload
return $
createGShell homing rdetonate rscreen aparams muz cr
. startthesound
where
-- the sound should be moved to the projectile firing
startthesound =
soundMultiFrom
[CrWeaponSound (_crID cr) j | j <- [0 .. 3]]
(_crPos cr)
tap4S
Nothing
failsound w' = case w' ^? input . mouseButtons . ix SDL.ButtonLeft of
Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
_ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
---- need to add these to muzzle flare?
--makeMuzzleSmoke :: Muzzle -> Item -> Creature -> World -> World
--makeMuzzleSmoke mz itm cr w = case mz ^. mzFlareType of