Work on chase crit shape

This commit is contained in:
2026-04-01 13:46:27 +01:00
parent 5f886106e2
commit 6d1cdcc9f3
11 changed files with 154 additions and 128 deletions
+7 -7
View File
@@ -21,7 +21,7 @@ itemEquipPict cr itmtree
, Just attachpos <- equipAttachPos <$> itm ^? itType . ibtEquip =
equipPosition esite cr attachpos (itemSPic itm)
| itm ^? itLocation . ilInvID == cr ^? crManipulation . manObject . imRootSelectedItem =
overPosSP (Q.prePos $ handHandleOrient loc cr) (itemTreeSPic itmtree)
overPosSP (Q.apply $ handHandleOrient loc cr) (itemTreeSPic itmtree)
| otherwise = mempty
where
itm = itmtree ^. dtValue . _1
@@ -29,13 +29,13 @@ itemEquipPict cr itmtree
equipAttachPos :: EquipItemType -> Point3Q
equipAttachPos = \case
BATTERYPACK -> (V3 (-8) 0 10, Q.qID)
FUELPACK -> (V3 (-9) 0 10, Q.qID)
BULLETBELTPACK -> (V3 (-9) 0 10, Q.qID)
BULLETBELTBRACER -> (V3 (-9) 0 10, Q.qID)
_ -> (0, Q.qID)
BATTERYPACK -> (V3 (-8) 0 10, Q.qid)
FUELPACK -> (V3 (-9) 0 10, Q.qid)
BULLETBELTPACK -> (V3 (-9) 0 10, Q.qid)
BULLETBELTBRACER -> (V3 (-9) 0 10, Q.qid)
_ -> (0, Q.qid)
equipPosition :: EquipSite -> Creature -> Point3Q -> SPic -> SPic
equipPosition es cr q =
overPosSP
(\x -> fst $ equipSitePQ es cr `Q.comp` q `Q.comp` (x, Q.qID))
(\x -> fst $ equipSitePQ es cr `Q.comp` q `Q.comp` (x, Q.qid))
+6 -6
View File
@@ -31,18 +31,18 @@ transToHandle itm = (-.-.- (0 & _xy .~ handlePos itm))
handleOrient :: LocationDT CItem -> Point3Q
handleOrient loc = case loc ^. locDT . dtValue . _1 . itType of
HELD FLAMETHROWER -> (V3 (-1) 0 0, Q.qID)
_ -> (V3 (-3) 0 0, Q.qID)
HELD FLAMETHROWER -> (V3 (-1) 0 0, Q.qid)
_ -> (V3 (-3) 0 0, Q.qid)
---- note this is relative to the creature
---- the aimstance here should match any aimstance in Aiming
--handOrient :: Creature -> AimStance -> Point3Q
--handOrient cr = case cr ^. crStance . posture of
-- Aiming {} -> \case
-- TwoHandUnder -> (V3 (-3) 0 shoulderHeight, Q.qID)
-- TwoHandOver -> (V3 0 0 shoulderHeight, Q.qID)
-- OneHand -> (V3 13 (-2) shoulderHeight, Q.qID)
-- TwoHandFlat -> (V3 13 0 shoulderHeight, Q.qID)
-- TwoHandUnder -> (V3 (-3) 0 shoulderHeight, Q.qid)
-- TwoHandOver -> (V3 0 0 shoulderHeight, Q.qid)
-- OneHand -> (V3 13 (-2) shoulderHeight, Q.qid)
-- TwoHandFlat -> (V3 13 0 shoulderHeight, Q.qid)
-- AtEase -> \case
-- OneHand -> rightHandPQ cr
-- TwoHandFlat -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) $ twoFlatHRot cr)
+19 -19
View File
@@ -18,31 +18,31 @@ import qualified Quaternion as Q
orientChild :: Item -> Point3Q
orientChild itm = case _itType itm of
--HELD LED -> (V3 0 5 0, Q.qID)
HELD LED -> (V3 (-x) 0 0, Q.qID)
AMMOMAG BATTERY -> (V3 0 0 1, Q.qID)
AMMOMAG {} -> (V3 0 (2-itemShapeMax _y itm) 0, Q.qID)
--HELD LASER -> (V3 15 (-5) 0, Q.qID)
LASER -> (V3 15 (-5) 0, Q.qID)
--HELD LED -> (V3 0 5 0, Q.qid)
HELD LED -> (V3 (-x) 0 0, Q.qid)
AMMOMAG BATTERY -> (V3 0 0 1, Q.qid)
AMMOMAG {} -> (V3 0 (2-itemShapeMax _y itm) 0, Q.qid)
--HELD LASER -> (V3 15 (-5) 0, Q.qid)
LASER -> (V3 15 (-5) 0, Q.qid)
ATTACH UNDERBARRELSLOT -> (V3 10 (-8) 0, r)
_ -> (0, Q.qID)
_ -> (0, Q.qid)
where
--r = Q.axisAngle (V3 0 0 1) (-pi/4)
r = Q.qID
r = Q.qid
-- y = itemShapeMin _y itm
x = itemShapeMaxX itm
orientByParentChSF :: Item -> ItemSF -> Point3Q
orientByParentChSF itm lt = case (_itType itm, lt) of
(HELD FLAMETHROWER, AmmoMagSF{}) -> (V3 4 (-6) 0, Q.qID)
(HELD FLAMETHROWER, AmmoMagSF{}) -> (V3 4 (-6) 0, Q.qid)
(HELD (VOLLEYGUN n), AmmoMagSF i _)
-> (V3 2 (2.5 + fromIntegral i * 5 - (0.5 * 5 * fromIntegral n)) 3, Q.qz (pi/2))
(HELD ALTERIFLE, AmmoMagSF i _) -> alteRifleAmmoOrient itm i
(HELD _, AmmoMagSF{_amsfType = ElectricalAmmo}) -> (V3 0 0 z, Q.qID)
(HELD _, AmmoMagSF{}) -> (V3 7 (itemShapeMin _y itm) 0, Q.qID)
(HELD _, WeaponScopeSF) -> (V3 5 0 5, Q.qID)
(HELD _, TorchSF) -> (V3 x y 0, Q.qID)
_ -> (0, Q.qID)
(HELD _, AmmoMagSF{_amsfType = ElectricalAmmo}) -> (V3 0 0 z, Q.qid)
(HELD _, AmmoMagSF{}) -> (V3 7 (itemShapeMin _y itm) 0, Q.qid)
(HELD _, WeaponScopeSF) -> (V3 5 0 5, Q.qid)
(HELD _, TorchSF) -> (V3 x y 0, Q.qid)
_ -> (0, Q.qid)
where
x = itemShapeMaxX itm
y = itemShapeMaxY itm
@@ -50,7 +50,7 @@ orientByParentChSF itm lt = case (_itType itm, lt) of
alteRifleAmmoOrient :: Item -> Int -> Point3Q
alteRifleAmmoOrient itm = \case
1 -> (V3 18 (itemShapeMin _y itm + s + 1) 0, Q.qID)
1 -> (V3 18 (itemShapeMin _y itm + s + 1) 0, Q.qid)
_ -> (V3 18 (itemShapeMax _y itm + s - 1) 0, Q.qz pi)
where
s | itm ^? itParams . alteRifleSwitch == Just 0 = 1
@@ -79,9 +79,9 @@ itemShapeMin g = f . (^. _1) . itemSPic
orientAttachment :: Item -> CItem -> Point3Q
orientAttachment par (ch,chsf) = case (_itType par, chsf) of
(ATTACH UNDERBARRELSLOT, _) -> (V3 (-5) (-8) 0, Q.qID)
(_,LaserWeaponXSF {}) -> (V3 2 8 0, Q.qID)
-- (_,TorchSF) -> (V3 2 8 0, Q.qID)
(ATTACH UNDERBARRELSLOT, _) -> (V3 (-5) (-8) 0, Q.qid)
(_,LaserWeaponXSF {}) -> (V3 2 8 0, Q.qid)
-- (_,TorchSF) -> (V3 2 8 0, Q.qid)
-- (HELD BURSTRIFLE, _, HELD TORCH) -> (V3 20 0 0, Q.axisAngle (V3 0 0 1) (pi/2))
-- (HELD LAUNCHER, _, HELD TORCH) -> (V3 0 20 0, Q.axisAngle (V3 0 0 1) (pi/4))
_ -> (t1 + Q.rotate q1 t2, q1 * q2)
@@ -92,5 +92,5 @@ orientAttachment par (ch,chsf) = case (_itType par, chsf) of
propagateOrientation :: DTree CItem -> DTree OItem
propagateOrientation = dtStartPropagate g f
where
g (x,y) = (x,y,(V3 0 0 0,Q.qID))
g (x,y) = (x,y,(V3 0 0 0,Q.qid))
f (x,_,pq) (y,y1) = (y,y1,Q.comp pq $ orientAttachment x (y,y1))