Migrate LDTs to DTs

This commit is contained in:
2025-07-10 22:13:47 +01:00
parent 9543c2c789
commit cd46f34787
9 changed files with 169 additions and 95 deletions
+7 -6
View File
@@ -8,6 +8,7 @@ module Dodge.HeldUse (
heldEffectMuzzles,
) where
import Dodge.DoubleTree
import Color
import Control.Applicative
import Control.Monad
@@ -498,7 +499,7 @@ applyRecoil loc cr =
+~ rotateV (_crDir cr + Q.qToAng q) (V2 ((- recoilAmount itm) / crMass (_crType cr)) 0)
where
itm = loc ^. locLDT . ldtValue . _1
(_, q) = locOrient loc cr
(_, q) = locOrient (locLDTToLocDT loc) cr
recoilAmount :: Item -> Float
recoilAmount itm
@@ -704,7 +705,7 @@ makeMuzzleFlare mz loc cr = case mz ^. mzFlareType of
TeslaGunFlare -> cWorld . lWorld . lights .:~ LSParam (pos `v2z` 10) 100 (V3 0 0 1)
where
(V3 x y _, q) =
locOrient loc cr
locOrient (locLDTToLocDT loc) cr
`Q.comp` (_mzPos mz `v2z` 0, Q.axisAngle (V3 0 0 1) (_mzRot mz))
pos = _crPos cr + rotateV (_crDir cr) (V2 x y)
dir = _crDir cr + Q.qToAng q
@@ -881,7 +882,7 @@ creatureShootLaser loc cr mz w =
itmtree = loc ^. locLDT
istree = fmap (\(i, _, _) -> i) itmtree
(V3 x y _, q) =
locOrient loc cr
locOrient (locLDTToLocDT loc) cr
`Q.comp` ((_mzPos mz + V2 0 offset) `v2z` 0, Q.axisAngle (V3 0 0 1) (_mzRot mz))
pos = _crPos cr + rotateV (_crDir cr) (V2 x y)
dir = _crDir cr + Q.qToAng q + a
@@ -991,7 +992,7 @@ shootBullet :: Bullet -> LocationLDT ItemLink OItem -> Creature -> Muzzle -> Wor
shootBullet bu loc cr mz w = makeBullet bu itm bulpos dir . (randGen .~ g) $ w
where
(V3 x y _, q) =
locOrient loc cr
locOrient (locLDTToLocDT loc) cr
`Q.comp` ((_mzPos mz + V2 0 offset) `v2z` 0, Q.axisAngle (V3 0 0 1) (_mzRot mz))
itm = loc ^. locLDT . ldtValue . _1
bulpos = _crPos cr + rotateV (_crDir cr) (V2 x y)
@@ -1134,7 +1135,7 @@ useGasParams mmagid mz loc cr w =
fueltype <- cr ^? crInv . ix magid >>= magAmmoParams >>= (^? ampCreateGas)
gasType hit fueltype
(V3 x y _, q) =
locOrient loc cr
locOrient (locLDTToLocDT loc) cr
`Q.comp` ((_mzPos mz + V2 0 offset) `v2z` 0, Q.axisAngle (V3 0 0 1) (_mzRot mz))
-- (moff, mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
pos = _crPos cr + rotateV (_crDir cr) (V2 x y)
@@ -1231,7 +1232,7 @@ shootTeslaArc loc cr mz w =
invid = itm ^?! itLocation . ilInvID
(w', ip) = makeTeslaArc (itm ^. itParams) pos dir w
(V3 x y _, q) =
locOrient loc cr
locOrient (locLDTToLocDT loc) cr
`Q.comp` ((_mzPos mz + V2 0 offset) `v2z` 0, Q.axisAngle (V3 0 0 1) (_mzRot mz))
pos = _crPos cr + rotateV (_crDir cr) (V2 x y)
dir = _crDir cr + Q.qToAng q