Remove item picture field, handled by outside function

This commit is contained in:
2022-07-11 12:34:39 +01:00
parent 33d94bd05a
commit 53548fb1ff
20 changed files with 303 additions and 412 deletions
-51
View File
@@ -32,15 +32,11 @@ import Dodge.WorldEvent.Flash
--import Dodge.Default
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.AmmoParams
import Dodge.Default.Weapon
--import Dodge.Item.Attachment
--import Dodge.WorldEvent.HelperParticle
import Dodge.Base
--import Dodge.Zone
import Geometry
import Picture
import Shape
import ShapePicture
import LensHelp
--import Dodge.RandomHelp
@@ -80,7 +76,6 @@ teslaGun = defaultBatteryGun
, _itDimension = ItemDimension
{ _dimRad = 9
, _dimCenter = V3 4 0 0
, _dimSPic = teslaGunPic
}
, _itParams = teslaParams
}
@@ -97,13 +92,6 @@ teslaGun = defaultBatteryGun
& itUse . useAim . aimHandlePos .~ 4
& itUse . useAim . aimMuzPos .~ 4
& itType . iyBase .~ HELD TESLAGUN
teslaGunPic :: Item -> SPic
teslaGunPic _ = noPic $ colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0)
where
xa = 1
xb = 9
--lasPulse :: Item
--lasPulse = lasGun
-- & itType . iyBase .~ LASPULSE
@@ -240,7 +228,6 @@ dualBeam :: Item
dualBeam = lasGun
& itType . iyBase .~ HELD DUALBEAM
& itUse . useAim . aimMuzPos .~ 0
& itDimension .dimSPic .~ dualBeamPic
& itParams .~ DualBeam
{ _phaseV = 1
, _lasColor = red
@@ -304,7 +291,6 @@ lasGun = defaultAutoBatteryGun
& itDimension .~ ItemDimension
{ _dimRad = 10
, _dimCenter = V3 15 0 0
, _dimSPic = lasGunPic
}
& itUse . rUse .~ shootLaser
& itUse . useDelay .~ NoDelay
@@ -323,31 +309,6 @@ lasGun = defaultAutoBatteryGun
& itUse . useAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD LASGUN
lasGunPic :: Item -> SPic
lasGunPic it =
( colorSH blue $
upperPrismPoly 4 (rectNESW 3 30 1 0)
<> upperPrismPoly 4 (rectNESW (-1) 30 (-3) 0)
<> upperPrismPoly 1 (rectNESW 3 30 (-3) 0)
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0
)
where
amFrac = fractionLoadedAmmo it
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
dualBeamPic :: Item -> SPic
dualBeamPic it =
( colorSH blue $
upperPrismPoly 4 (rectNESW gap 3 (-gap) 1)
<> upperPrismPoly 4 (rectNESW gap (-1) (-gap) (-3))
<> upperPrismPoly 1 (rectNESW gap 3 (-gap) (-3))
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (-gap) (-1)
)
where
amFrac = fractionLoadedAmmo it
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
gap = _dbGap (_itParams it) - 3
lasGunTweak :: TweakParam
lasGunTweak = TweakParam
{ _doTweak = thetweak
@@ -374,7 +335,6 @@ tractorGun = lasGun
, _itDimension = ItemDimension
{ _dimRad = 10
, _dimCenter = V3 15 0 0
, _dimSPic = tractorGunPic
}
, _itParams = Attracting {_attractionPower = 1}
, _itTweaks = Tweakable
@@ -414,17 +374,6 @@ tractorGunTweak = TweakParam
showPower 3 = "0" -- object should stay in the center of the beam
showPower i = "THIS SHOULD NOT BE POSSIBLE" ++ show i
tractorGunPic :: Item -> SPic
tractorGunPic it =
( colorSH red $
upperPrismPoly 4 (rectNESW 3 30 1 0)
<> upperPrismPoly 4 (rectNESW (-1) 30 (-3) 0)
<> upperPrismPoly 1 (rectNESW 3 30 (-3) 0)
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0
)
where
amFrac = fractionLoadedAmmo it
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
-- | assumes that the item is held
shootTeslaArc :: Item -> Creature -> World -> World
shootTeslaArc it cr w = w'
-50
View File
@@ -10,8 +10,6 @@ module Dodge.Item.Weapon.BulletGun.Cane
) where
--import Dodge.Particle.Bullet.HitEffect
import Dodge.Reloading.Action
--import Dodge.WorldEvent.HitEffect
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data
--import Dodge.ChainEffect
import Dodge.Default.Weapon
@@ -25,8 +23,6 @@ import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry
import ShapePicture
import Shape
import Sound.Data
import LensHelp
@@ -46,8 +42,6 @@ defaultBangCane = defaultBulletWeapon
, _itDimension = ItemDimension
{ _dimRad = 8
, _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseCaneShape
<> makeSingleClipAt (V3 5 0 3) it
}
}
& itUse . useDelay . rateMax .~ 6
@@ -85,11 +79,6 @@ volleyGun i = defaultBulletWeapon
& itDimension .~ ItemDimension
{ _dimRad = 8
, _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $
colorSH red (foldMap
((\y -> upperPrismPoly 3 $ map (+.+ V2 0 y) $ rectXH 15 2)
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5))) [0..i-1]
) <> caneClipX i it
}
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
@@ -120,20 +109,11 @@ caneStickSoundChoice :: Item -> SoundID
caneStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
caneClipX :: Int -> Item -> Shape
caneClipX i it = case it ^? itConsumption . laLoaded of
Just la | la > 0 -> foldMap
( (\y -> translateSH (V3 5 0 3) . upperPrismPoly 1 $ map (+.+ V2 0 y) $ square 1.5)
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5)))
[0..la-1]
_ -> mempty
rifle :: Item
rifle = defaultBangCane
{ _itDimension = ItemDimension
{ _dimRad = 8
, _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseRifleShape
<> makeSingleClipAt (V3 5 0 3) it
}
}
& itUse . useAim . aimStance .~ TwoHandTwist
@@ -150,15 +130,7 @@ repeater = rifle
& itType . iyBase .~ HELD REPEATER
& itConsumption . laCycle .~ [loadEject 50, loadInsert 40 ,loadPrime 20]
& itConsumption . laMax .~ 15
& itDimension . dimSPic .~ (\it -> noPic $ baseRifleShape
<> makeTinClipAt 0 (V3 10 (-2) 0) it
)
baseCaneShape :: Shape
baseCaneShape = colorSH red $ upperPrismPoly 3 $ rectXH 15 1.5
baseRifleShape :: Shape
baseRifleShape = colorSH red $ upperPrismPoly 3 $ rectXH 25 2
autoRifle :: Item
autoRifle = repeater
@@ -279,29 +251,7 @@ miniGunX i = defaultAutoGun
, _itDimension = ItemDimension
{ _dimRad = 20
, _dimCenter = V3 5 0 0
, _dimSPic = miniGunXPictItem i
}
}
& itType . iyBase .~ HELD (MINIGUNX i)
& itUse . useAim . aimMuzPos .~ 40
miniGunXPictItem :: Int -> Item -> SPic
miniGunXPictItem i it = miniGunXPict i spin (_laLoaded $ _itConsumption it)
where
spin = (-10) * _laLoaded (_itConsumption it) + _warmTime (_useDelay $ _itUse it)
miniGunXPict :: Int -> Int -> Int -> SPic
miniGunXPict i spin _ =
( colorSH red (rotateSHx a barrels)
<> baseRifleShape
-- <> clip (-1) 0
-- <> clip (-7) 0
, mempty
)
where
aBarrel = translateSH (V3 15 2 2) baseCaneShape
barrels = foldMap (\an -> aBarrel & rotateSHx (2*pi * fromIntegral an / fromIntegral i)) [1..i]
a = fromIntegral spin / 100
--x = fromIntegral am / 10
-- clip y z = translateSH (V3 0 (-1) z) (rotateSHx (negate $ pi/4)
-- . upperPrismPoly 2
-- $ rectNESW (negate $ 3 + 0.25 * x) y 3 (y-5))
-18
View File
@@ -1,18 +0,0 @@
module Dodge.Item.Weapon.BulletGun.Clip where
import Dodge.Data
import Shape
import Geometry
import Data.Maybe
import Control.Lens
makeSingleClipAt :: Point3 -> Item -> Shape
makeSingleClipAt p it = case it ^? itConsumption . laLoaded of
Just 0 -> mempty
_ -> translateSH p $ upperPrismPoly 1 $ square 1.5
makeTinClipAt :: Float -> Point3 -> Item -> Shape
makeTinClipAt r p it = translateSH p . overPosSH (rotate3z r) $ upperPrismPoly 1 $ reverse
$ rectNSWE 0 (-y) (-2) 2
where
y = fromIntegral y' * 0.3
y' = fromMaybe 0 $ it ^? itConsumption . laLoaded
-17
View File
@@ -8,7 +8,6 @@ module Dodge.Item.Weapon.BulletGun.Rod
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Particle.HitEffect
import Dodge.Particle.Damage
--import Dodge.ChainEffect
@@ -22,11 +21,7 @@ import Dodge.Item.Weapon.ZoomScope
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry
import ShapePicture
import Shape
--import Sound.Data
import LensHelp
--import qualified Data.Sequence as Seq
@@ -60,8 +55,6 @@ bangRod = defaultBulletWeapon
& itDimension .~ ItemDimension
{ _dimRad = 12
, _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseRodShape
<> makeSingleClipAt (V3 5 0 3) it
}
& itConsumption . laMax .~ 1
& itConsumption . laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 5]
@@ -73,18 +66,11 @@ bangRod = defaultBulletWeapon
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 30
& itConsumption . laAmmoType . amBulEff .~ expireAndDamage heavyBulDams
baseRodShape :: Shape
baseRodShape = colorSH orange $ upperPrismPoly 3 $ rectXH 20 2
baseAMRShape :: Shape
baseAMRShape = colorSH orange $ upperPrismPoly 3 $ rectXH 30 2
elephantGun :: Item
elephantGun = bangRod
& itType . iyBase .~ HELD ELEPHANTGUN
& itUse . useAim . aimStance .~ TwoHandTwist
& itParams . gunBarrels .~ SingleBarrel 0.05
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
<> makeSingleClipAt (V3 5 0 3) it
)
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
@@ -102,9 +88,6 @@ amr :: Item
amr = elephantGun
& itType . iyBase .~ HELD AMR
& itConsumption . laMax .~ 15
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
<> makeTinClipAt 0 (V3 10 (-2) 0) it
)
autoAmr :: Item
autoAmr = amr
+1 -38
View File
@@ -7,7 +7,6 @@ module Dodge.Item.Weapon.BulletGun.Stick
, revolver
, revolverX
) where
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Reloading.Action
import Dodge.Data
import Dodge.ChainEffect
@@ -21,10 +20,7 @@ import Dodge.Item.Weapon.AmmoParams
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry
import ShapePicture
import Shape
import Sound.Data
import LensHelp
@@ -71,8 +67,6 @@ bangStick i = defaultBulletWeapon
, _itDimension = ItemDimension
{ _dimRad = 5
, _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseStickShapeX i
<> stickClip it
}
}
& itType . iyBase .~ HELD (BANGSTICK i)
@@ -80,46 +74,18 @@ bangStick i = defaultBulletWeapon
& itUse . useAim . aimMuzPos .~ 10
& itConsumption . laMax .~ i
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
baseStickShapeX :: Int -> Shape
baseStickShapeX i = foldMap f [0..i-1]
where
f j = rotateSH ang baseStickShape
where
ang = fromIntegral j * baseStickSpread - (fromIntegral i - 1) * baseStickSpread * 0.5
baseStickSpread :: Float
baseStickSpread = 0.2
baseSMGShape :: Shape
baseSMGShape = colorSH green $ upperPrismPoly 3 $ rectXH 20 2
baseStickShape :: Shape
baseStickShape = colorSH green $ upperPrismPoly 3 $ rectXH 10 2
stickClip :: Item -> Shape
stickClip it = case it ^? itConsumption . laLoaded of
Just x | x > 0 -> foldMap f [0..x-1]
_ -> mempty
where
f i = rotateSH ang $ translateSH (V3 5 0 3) $ upperPrismPoly 2 $ square 1.5
where
ang = baseStickSpread * fromIntegral i
- 0.5 * baseStickSpread * fromIntegral (_brlNum (_gunBarrels (_itParams it))-1)
revolver :: Item
revolver = pistol
& itConsumption .~
(defaultBulletLoadable
& laMax .~ 6
& laCycle .~ [loadPartialInsert 10 1] )
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> revolverClip it)
& itType . iyBase .~ HELD REVOLVER
revolverClip :: Item -> Shape
revolverClip it = case it ^? itConsumption . laLoaded of
Just al | al > 0 -> translateSH (V3 5 0 1) $ foldMap f [1..al]
_ -> mempty
where
f i = rotateSHx (fromIntegral i * pi / 3 + pi/6) . translateSH (V3 0 0 2) $ upperPrismPoly 1 $ square 1
pistolAfterHamMods :: [ChainEffect]
pistolAfterHamMods =
[ useTimeCheck
@@ -161,7 +127,6 @@ pistol = bangStick 1
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ (ammoHammerCheck : pistolAfterHamMods)
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
& itParams %~
( ( muzVel .~ 0.8 )
. ( rifling .~ 0.8 )
@@ -190,8 +155,6 @@ smg = autoPistol -- & some parameter affecting stability
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 2
& itParams . torqueAfter .~ 0.05
& itDimension . dimSPic .~ \it -> noPic (baseSMGShape
<> makeTinClipAt 0 (V3 7 (-2) 0) it)
revolverX :: Int -> Item
revolverX i = revolver
& itUse . useDelay . rateMax .~ 8
-4
View File
@@ -103,8 +103,6 @@ bangCone = defaultBulletWeapon
, _itDimension = ItemDimension
{ _dimRad = 8
, _dimCenter = V3 5 0 0
, _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 5 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 5 15)
}
}
& itUse . useDelay . rateMax .~ 20
@@ -146,8 +144,6 @@ blunderbuss = bangCone
{_itDimension = ItemDimension
{ _dimRad = 8
, _dimCenter = V3 5 0 0
, _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2)
<> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 20 30)
}
}
& itConsumption . laMax .~ 25
-9
View File
@@ -60,7 +60,6 @@ launcher = defaultWeapon
, _itDimension = ItemDimension
{ _dimRad = 9
, _dimCenter = V3 10 0 0
, _dimSPic = launcherPic
}
}
& itUse . useDelay . rateMax .~ 20
@@ -104,14 +103,6 @@ usePjCreationX i it cr = foldr f
where
f n = (. _amPjCreation (_laAmmoType (_itConsumption it)) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
launcherPic :: Item -> SPic
launcherPic _ =
( colorSH cyan $ prismPoly
(map (+.+.+ V3 20 0 5) $ polyCircx 4 5)
(map (+.+.+ V3 0 0 5) $ polyCircx 4 5)
, mempty
)
basicAmPjMoves :: IM.IntMap TweakParam
basicAmPjMoves = IM.fromList . zip [0..] $
[spinDrag
-13
View File
@@ -8,11 +8,6 @@ import Dodge.Item.Weapon.UseEffect
--import Dodge.Item.Weapon.Remote
import Dodge.Default.Weapon
import Dodge.SoundLogic
--import Dodge.Item.Weapon.Grenade
import Geometry
import Picture
import Shape
import ShapePicture
import Control.Lens
@@ -36,16 +31,8 @@ autoDetector dt = defaultEquipment
& itUse . eqEq . eqParams .~ EquipCounter 0
& itUse . eqEq . eqViewDist ?~ 350
& itType . iyBase .~ AUTODETECTOR dt
& itDimension . dimSPic .~ const
(noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
-- , _itEffect = autoRadarEffect
detectorColor :: Detector -> Color
detectorColor dt = case dt of
ITEMDETECTOR -> blue
CREATUREDETECTOR -> green
WALLDETECTOR -> red
detectorEffect :: Detector -> Item -> Creature -> World -> World
detectorEffect dt = case dt of
ITEMDETECTOR -> const anItemFindPulse
+1 -12
View File
@@ -17,11 +17,7 @@ import Dodge.Default.Weapon
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
--import Dodge.SoundLogic.LoadSound
import Picture
import Geometry
import ShapePicture
import Shape
--import Sound.Data
import LensHelp
--import qualified Data.IntMap.Strict as IM
@@ -38,15 +34,7 @@ shatterGun = defaultWeapon
, useAmmoAmount 1
]
& itUse . useAim . aimStance .~ TwoHandFlat
& itDimension . dimSPic .~ shatterGunSPic
shatterGunSPic :: Item -> SPic
shatterGunSPic _ = noPic $ colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0)
where
xa = 1
xb = 9
shootShatter :: Item -> Creature -> World -> World
shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ sequence
$ collidePointWallsFilterStream canshatter sp ep w
@@ -65,3 +53,4 @@ shatterWall w sp ep p wl = w
& makeDebrisDirected 1 2 (pi/2) (argV $ vNormal $ uncurry (-.-) $ _wlLine wl) (_wlMaterial wl)
(_wlColor wl) p
& damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl
-6
View File
@@ -17,9 +17,6 @@ import Dodge.Default.Weapon
--import Dodge.Zone
import Geometry
import Picture
import Shape
import ShapePicture
--import Dodge.Picture
import LensHelp
--import Data.Maybe
@@ -39,7 +36,6 @@ sonicGun = defaultAutoGun
, _itDimension = ItemDimension
{ _dimRad = 10
, _dimCenter = V3 15 0 0
, _dimSPic = const $ noPic baseSonicShape
}
}
& itUse . useDelay . rateMax .~ 8
@@ -54,8 +50,6 @@ sonicGun = defaultAutoGun
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimMuzPos .~ 25
& itType . iyBase .~ HELD SONICGUN
baseSonicShape :: Shape
baseSonicShape = colorSH rose $ upperPrismPoly 3 $ rectXH 25 2
aSonicWave :: Item -> Creature -> World -> World
aSonicWave it cr = instantParticles .:~ sonicWave pos dir cpos
-21
View File
@@ -21,16 +21,9 @@ import Dodge.Default
--import Dodge.Item.Weapon.BulletGuns
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType
--import Dodge.Item.Weapon.ExtraEffect
--import Dodge.Item.Weapon.UseEffect
import Dodge.Item.Weapon.AmmoParams
import Dodge.Default.Weapon
--import Dodge.Item.Attachment
import Geometry
--import Geometry.Vector3D
import Picture
import Shape
import ShapePicture
import LensHelp
import Data.Traversable
@@ -52,19 +45,6 @@ poisonSprayer = flameThrower
-- , spreadNumI
]
flamerPic :: Item -> SPic
flamerPic it =
( colorSH yellow $
translateSHf tx ty (upperPrismPoly tz $ polyCirc 3 r)
<> upperPrismPoly 5 (rectNESW 2 18 (-2) 0)
, color black $ translate3 (V3 tx ty (tz+0.01)) $ circleSolid (r * am)
)
where
tx = 4
ty = - 6
tz = 3
r = 5
am = fractionLoadedAmmo2 it
flameSpitter :: Item
flameSpitter = flameThrower
& itType . iyBase .~ HELD FLAMESPITTER
@@ -139,7 +119,6 @@ flameThrower = defaultAutoGun
, _itDimension = ItemDimension
{ _dimRad = 7
, _dimCenter = V3 9 0 0
, _dimSPic = flamerPic
}
-- , _itFloorPict = flamerPic
}