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
+20 -20
View File
@@ -27,7 +27,7 @@ import qualified Quaternion as Q
import ShapePicture
translateToES :: Creature -> EquipSite -> Point3 -> Point3
translateToES cr es p = fst (equipSitePQ es cr `Q.comp` (p, Q.qID))
translateToES cr es p = fst (equipSitePQ es cr `Q.comp` (p, Q.qid))
equipSitePQ :: EquipSite -> Creature -> Point3Q
equipSitePQ = \case
@@ -40,7 +40,7 @@ equipSitePQ = \case
OnRightLeg -> legPQ RightForward
translatePointToRightHand :: Creature -> Point3 -> Point3
translatePointToRightHand cr p = fst (rightHandPQ cr `Q.comp` (p, Q.qID))
translatePointToRightHand cr p = fst (rightHandPQ cr `Q.comp` (p, Q.qid))
handWalkingPos :: FootForward -> Float -> Creature -> Point3
handWalkingPos b off cr = case cr ^. crStance . carriage of
@@ -65,15 +65,15 @@ zeroOneSmooth x = (1 - cos (pi * x)) / 2
rightHandPQ :: Creature -> Point3Q
rightHandPQ cr
| oneH cr = (V3 11 (-3) 20, Q.qID)
| oneH cr = (V3 11 (-3) 20, Q.qid)
| twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 4 (-10) 0, Q.qz 1)
| twoFlat cr = (V3 8 (-8) 12, Q.qID)
| twoFlat cr = (V3 8 (-8) 12, Q.qid)
| Just TwoHandTwist <- cr ^? crManipulation . manObject . imAimStance
= (V3 6 (-6) 10, Q.qID)
= (V3 6 (-6) 10, Q.qid)
| Just TwoHandFlat <- cr ^? crManipulation . manObject . imAimStance
= (V3 (8 - twoHandOffY cr) (-8) 12, Q.qID)
| Just p <- crRightHandWall cr = (20 & _xy .~ p, Q.qID)
| otherwise = (handWalkingPos LeftForward (-8) cr, Q.qID)
= (V3 (8 - twoHandOffY cr) (-8) 12, Q.qid)
| Just p <- crRightHandWall cr = (20 & _xy .~ p, Q.qid)
| otherwise = (handWalkingPos LeftForward (-8) cr, Q.qid)
crRightHandWall :: Creature -> Maybe Point2
crRightHandWall cr = do
@@ -115,19 +115,19 @@ translateToRightHand :: Creature -> SPic -> SPic
translateToRightHand = overPosSP . translatePointToRightHand
rightWristPQ :: Creature -> Point3Q
rightWristPQ cr = rightHandPQ cr `Q.comp` (V3 0 (-4) (-4), Q.qID)
rightWristPQ cr = rightHandPQ cr `Q.comp` (V3 0 (-4) (-4), Q.qid)
leftHandPQ :: Creature -> Point3Q
leftHandPQ cr
| twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 12 4 0, Q.qz 0.4)
| twoFlat cr = (V3 8 8 12, Q.qID)
| twoFlat cr = (V3 8 8 12, Q.qid)
| Just TwoHandTwist <- cr ^? crManipulation . manObject . imAimStance
= (V3 (10 + twoHandOffY cr) 6 20, Q.qID)
= (V3 (10 + twoHandOffY cr) 6 20, Q.qid)
| Just TwoHandFlat <- cr ^? crManipulation . manObject . imAimStance
= (V3 (8 + twoHandOffY cr) 6 12, Q.qID)
| Just p <- crLeftHandWall cr = (20 & _xy .~ p, Q.qID)
= (V3 (8 + twoHandOffY cr) 6 12, Q.qid)
| Just p <- crLeftHandWall cr = (20 & _xy .~ p, Q.qid)
| oneH cr = (V3 0 8 10, Q.qz 0.4)
| otherwise = (handWalkingPos RightForward 8 cr, Q.qID)
| otherwise = (handWalkingPos RightForward 8 cr, Q.qid)
twoHandOffY :: Creature -> Float
twoHandOffY cr = zeroOneSmooth $ case cr ^. crStance . carriage of
@@ -146,16 +146,16 @@ twoHandOffY cr = zeroOneSmooth $ case cr ^. crStance . carriage of
_ -> 0
translatePointToLeftHand :: Creature -> Point3 -> Point3
translatePointToLeftHand cr p = fst (leftHandPQ cr `Q.comp` (p, Q.qID))
translatePointToLeftHand cr p = fst (leftHandPQ cr `Q.comp` (p, Q.qid))
translateToLeftHand :: Creature -> SPic -> SPic
translateToLeftHand = overPosSP . translatePointToLeftHand
leftWristPQ :: Creature -> Point3Q
leftWristPQ cr = leftHandPQ cr `Q.comp` (V3 0 4 (-4), Q.qID)
leftWristPQ cr = leftHandPQ cr `Q.comp` (V3 0 4 (-4), Q.qid)
translateToLeftLeg :: Creature -> SPic -> SPic
translateToLeftLeg cr = overPosSP (\p -> fst (legPQ LeftForward cr `Q.comp` (p, Q.qID)))
translateToLeftLeg cr = overPosSP (\p -> fst (legPQ LeftForward cr `Q.comp` (p, Q.qid)))
legPQ :: FootForward -> Creature -> Point3Q
legPQ ff = case ff of
@@ -166,7 +166,7 @@ legPQ' :: (Float -> Float) -> Creature -> Point3Q
legPQ' g cr =
Q.comp
(0, Q.qz (_crMvDir cr - _crDir cr))
(V3 x (g off) 0, Q.qID)
(V3 x (g off) 0, Q.qid)
where
x = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> -f sa
@@ -179,13 +179,13 @@ legPQ' g cr =
f i = g 8 * (sLen - i) / sLen
translateToRightLeg :: Creature -> SPic -> SPic
translateToRightLeg cr = overPosSP (\p -> fst (legPQ RightForward cr `Q.comp` (p, Q.qID)))
translateToRightLeg cr = overPosSP (\p -> fst (legPQ RightForward cr `Q.comp` (p, Q.qid)))
headPQ :: Creature -> Point3Q
headPQ cr
| twists cr = (V3 0 2 20, Q.qz (-1)) `Q.comp` (V3 (negate 2.5) 0.25 0, Q.qz 1)
| oneH cr = (V3 0 0 20, Q.qz 0.5) `Q.comp` (V3 2.5 0 0, Q.qz (-0.5))
| otherwise = (V3 2.5 0 20, Q.qID)
| otherwise = (V3 2.5 0 20, Q.qid)
chestPQ :: Creature -> Point3Q
chestPQ cr = backPQ cr `Q.comp` (0, Q.qz pi)
+1 -1
View File
@@ -26,6 +26,6 @@ defaultChaseMvType =
CrMvType
{ _mvSpeed = 2
, _mvTurnRad = FloatAbsCheckGreaterLess (pi / 4) 0.2 0.05
, _mvTurnJit = 0.2
, _mvTurnJit = 0.05
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi / 8) 0.2 0.01
}
+23 -1
View File
@@ -10,6 +10,7 @@ module Dodge.Creature.Picture (
drawChaseCrit,
) where
import Linear
import Dodge.Data.Equipment.Misc
import Dodge.Creature.HandPos
import qualified Data.IntMap.Strict as IM
@@ -50,12 +51,33 @@ basicCrShape cr
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
drawChaseCrit :: Creature -> Shape
drawChaseCrit cr = rotmdir $ colorSH (_skinLower cskin) $ feet cr
drawChaseCrit cr = mconcat
[ chaseUpperBody cr
, rotmdir $ colorSH (_skinLower cskin) $ feet cr
]
where
cskin = crShape $ _crType cr
crsize = 0.1 * crRad (cr ^. crType)
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
chaseUpperBody :: Creature -> Shape
chaseUpperBody cr = colorSH (_skinUpper cskin)
(overPosSH (Q.apply torsoq) (upperPrismPolyHalfMI tz $ polyCirc 3 12
& each %~ vNormal
& each . _y *~ 0.6)
<> overPosSH (Q.apply neckq) (upperPrismPolyHalfMI 3 $ (+ V2 8 0) . vNormal <$> trapTBH 2 5 8)
)
<> colorSH (_skinHead cskin)
(overPosSH (Q.apply headq) (upperBox Medium Important 2 [V2 0 (-4), V2 9 0, V2 0 4]))
where
tz = 4
cskin = crShape $ _crType cr
torsoq = (V3 0 0 (10 + tz),Q.qid)
mcool = 1 - min 10 (fromIntegral . _meleeCooldown $ _crType cr) / 10
neckq = torsoq `Q.comp` (V3 6 0 0,Q.axisAngle (V3 0 1 0) (-1.8*mcool))
headq = neckq `Q.comp` (V3 16 0 0, Q.axisAngle (V3 0 1 0) (2*mcool))
oneSmooth :: Float -> Float
oneSmooth x = sin (pi * x * 0.5)
+1 -1
View File
@@ -224,7 +224,7 @@ shineTargetLaser cr loc w = fromMaybe (w & pointittarg . itTgPos .~ Nothing) $ d
where
o = locOrient loc cr
itmtree = loc ^. locDT
(p, q) = o `Q.comp` (V3 5 0 0, Q.qID)
(p, q) = o `Q.comp` (V3 5 0 0, Q.qid)
x = 1
isammolink AmmoMagSF{} = True
isammolink _ = False