This commit is contained in:
2022-07-28 12:35:19 +01:00
parent 160560af5f
commit 8aeabf3f6c
16 changed files with 123 additions and 365 deletions
+2 -65
View File
@@ -1,6 +1,4 @@
module Dodge.Item.Draw (
pictureWeaponOnAim,
pictureWeaponAim,
twoFlatHRot,
itemSPic,
itemEquipPict,
@@ -12,72 +10,11 @@ import Dodge.Data.Creature
import Dodge.Item.Draw.SPic
import Dodge.Item.Equipment.Shape
import Dodge.Item.HeldOffset
import qualified IntMapHelp as IM
import ShapePicture
itemEquipPict :: Creature -> Item -> SPic
itemEquipPict cr it = case it ^?! itUse of
HeldUse{} -> pictureWeaponOnAim cr it
itemEquipPict cr it = case it ^. itUse of
HeldUse{} | _itIsHeld it -> overPosSP (heldItemOffset it cr) (itemSPic it)
ituse -> case ituse ^? equipEffect of
Just _ -> pictureOnEquip (itemSPic it) cr it
Nothing -> mempty
pictureWeaponOnAim ::
Creature ->
Item ->
SPic
pictureWeaponOnAim = pictureWeaponAim itemSPic
pictureWeaponAim ::
(Item -> SPic) ->
Creature ->
Item ->
SPic
pictureWeaponAim f cr itm = case _itLocation itm of
InInv _ i -> pictureWeaponOnAimItem (f itm) cr i
_ -> mempty
-- | Places an item picture onto a creature when the item is selected.
pictureWeaponOnAimItem ::
SPic ->
Creature ->
-- | Position of item in inventory
Int ->
SPic
pictureWeaponOnAimItem p' cr posInInv
| _itIsHeld theIt = overPosSP (heldItemOffset theIt cr) p'
| otherwise = mempty
where
-- | isSelected && _posture (_crStance cr) == Aiming =
-- shoulderD $ translateSPf (aimingWeaponZeroPos cr theIt) 0 p'
-- | isSelected && isTwoHandFlat
-- = handD holsteredTwoFlat
-- | isSelected && isOneHand
-- = handD holsteredOneHandWep
-- | isSelected
-- = handD holsteredWep
-- | otherwise = mempty
-- shoulderD = translateSPz 18
-- handD = translateSPz 15
-- isSelected = crSel cr == posInInv
-- twistWep = translateSPf (-5) 0 p
-- holsteredWep = translateSPf (_crRad cr) 0
-- (rotateSP (strideRot cr + 1.2) (translateSPf (-5) 0 twistWep))
-- holsteredTwoFlat = translateSPf (_crRad cr) 0 (rotateSP (twoFlatHRot cr) p)
-- holsteredOneHandWep = translateSPf (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7)
-- (translateSPf (-2) 0 p)
-- handPos = case cr^? crStance . carriage of
-- Just (Walking x LeftForward) -> f x * 50
-- _ -> 0
theIt = _crInv cr IM.! posInInv
-- p = fromMaybe p' $ do
-- x <- theIt ^? itUse . useAim . aimHandlePos
-- return $translateSPf (-x) 0 p'
-- isOneHand = theIt ^? itUseAimStance == Just OneHand
-- || isNothing (theIt ^? itUseAimStance)
-- isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
-- itUseAimStance = itUse . useAim . aimStance
-- f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
-- sLen = _strideLength $ _crStance cr
+1
View File
@@ -142,6 +142,7 @@ shootTeslaArc it cr w =
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
dir = _crDir cr
shootLaser :: Item -> Creature -> World -> World
shootLaser it cr = cWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
where