Cleanup old muzzle position code

This commit is contained in:
2024-11-28 21:26:55 +00:00
parent 3763ff2c8a
commit 7db700042a
4 changed files with 36 additions and 39 deletions
+17 -11
View File
@@ -164,8 +164,9 @@ makeMuzzleFlare mz itmtree cr = case mz ^. mzFlareType of
-- .:~ tlsTimeRadColPos 1 100 (V3 0 0 1) (pos `v2z` 10)
where
itm = itmtree ^. ldtValue
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
dir = _crDir cr + _mzRot mz
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
pos = _crPos cr + rotateV (_crDir cr) moff
dir = _crDir cr + mrot
--{-# OPTIONS -Wno-incomplete-uni-patterns #-}
muzFlareAt :: Color -> Point3 -> Float -> World -> World
@@ -295,10 +296,11 @@ shootLaser itmtree cr mz w =
}
where
itm = itmtree ^. ldtValue
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
pos = _crPos cr + rotateV (_crDir cr) moff
dir = _crDir cr + mrot + a
(a, g) = randomR (- inacc, inacc) $ _randGen w
inacc = _mzInaccuracy mz
dir = _crDir cr + _mzRot mz + a
lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> LaserStart
lasRayAt col dam phasev pos dir =
@@ -363,7 +365,10 @@ getBulletTrajectory mz itm bt tp cr w = case bt of
BezierTrajectoryType -> BezierTrajectory bulpos tp (mouseWorldPos (w ^. input) (w ^. wCam))
MagnetTrajectoryType -> MagnetTrajectory tp
where
bulpos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm + V2 0 offset)
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz + V2 0 offset) (_mzRot mz)
bulpos = _crPos cr + rotateV (_crDir cr) moff
-- dir = _crDir cr + mrot + a
-- bulpos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm + V2 0 offset)
offset = case itm ^? itUse . heldParams . randomOffset of
Just x | x /= 0 -> fst . randomR (- x, x) $ _randGen w
_ -> 0
@@ -392,8 +397,6 @@ makeBullet thebullet itm cr mz w =
& buDrag *~ drag
)
where
-- bulpos = _crPos cr
-- + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm + V2 0 offset)
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz + V2 0 offset) (_mzRot mz)
bulpos = _crPos cr + rotateV (_crDir cr) moff
(a, g'') = randomR (- inacc, inacc) $ _randGen w
@@ -438,10 +441,12 @@ useGasParams mmagid mz itm cr w =
fueltype <- cr ^? crInv . ix magid . itUse . amagParams . ampCreateGas
gc <- itm ^? itUse . heldParams . gasCreation
return $ gasCreate fueltype gc
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
--pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
pos = _crPos cr + rotateV (_crDir cr) moff
(a, g') = randomR (- inacc, inacc) g
inacc = _mzInaccuracy mz
dir = _crDir cr + _mzRot mz + a + _nzCurrentWalkAngle (_mzEffect mz)
dir = _crDir cr + mrot + a + _nzCurrentWalkAngle (_mzEffect mz)
gasCreate :: GasFuel -> GasCreate -> GasCreate
gasCreate = const id
@@ -487,8 +492,9 @@ shootTeslaArc itm cr mz w =
-- use items item location instead
itRef = cr ^?! crManipulation . manObject . imRootSelectedItem -- unsafe!! TODO change
(w', ip) = makeTeslaArc (_itParams itm) pos dir w
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
dir = _crDir cr + _mzRot mz
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
pos = _crPos cr + rotateV (_crDir cr) moff
dir = _crDir cr + mrot
determineProjectileTracking ::
LabelDoubleTree ComposeLinkType Item ->