Refactor item drawing

This commit is contained in:
2021-10-01 23:01:36 +01:00
parent 5f17841811
commit 8c1496e140
28 changed files with 248 additions and 185 deletions
+5
View File
@@ -46,3 +46,8 @@ withDelayedVelWthHiteff vfact vel width hiteff cr = over particles (newbul : )
newbul = aDelayedBulAt vfact (Just cid) pos (rotateV dir vel) hiteff width
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
loadedAmmo :: Item -> Int
loadedAmmo it
| _wpReloadState it == 0 = fromIntegral $ _wpLoadedAmmo it
| otherwise = 0
+7 -3
View File
@@ -63,13 +63,17 @@ autoGun = defaultAutoGun
, _itInvDisplay = basicWeaponDisplay
, _wpAmmo = basicBullet
}
autoGunPic :: SPic
autoGunPic =
( colorSH red $ prismPoly
autoGunPic :: Item -> SPic
autoGunPic it =
( (colorSH red $ prismPoly
(map (addZ 5) $ rectNESW 2 12 (-2) (-8))
(map (addZ 0) $ rectNESW 4 12 (-4) (-12))
)
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
, mempty
)
where
x = fromIntegral $ loadedAmmo it
autogunSpread :: Float
autogunSpread = 0.07
+2 -2
View File
@@ -35,8 +35,8 @@ bezierGun = defaultGun
. withRecoilI 40
. torqueBefore 0.05
]
, _itFloorPict = bezierGunSPic
, _itEquipPict = pictureWeaponOnAim bezierGunSPic
, _itFloorPict = \it -> bezierGunSPic
, _itEquipPict = pictureWeaponOnAim $ \it -> bezierGunSPic
, _itAttachment = NoItAttachment
, _itScroll = \_ _ -> removeItTarget
, _itHammer = HammerUp
+1 -1
View File
@@ -97,5 +97,5 @@ throwArmReset x = ItInvEffect {_itInvEffect = f ,_itEffectCounter = x }
counterDown it
| _itEffectCounter (_itEffect it) == 0 = it
& itHammer .~ HammerUp
& itEquipPict .~ pictureWeaponOnAim (grenadePic 50)
& itEquipPict .~ pictureWeaponOnAim (\itp -> grenadePic 50)
| otherwise = it & itEffect . itEffectCounter -~ 1
+2 -2
View File
@@ -49,10 +49,10 @@ launcher = defaultGun
]
, _wpSpread = 0.02
, _wpRange = 20
, _itFloorPict = launcherPic
, _itFloorPict = \it -> launcherPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0.5
, _itEquipPict = pictureWeaponOnAim launcherPic
, _itEquipPict = pictureWeaponOnAim $ \it -> launcherPic
, _itHammer = NoHammer
, _itEffect = NoItEffect
, _wpAmmo = defaultShellAmmo