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
+1 -2
View File
@@ -535,7 +535,6 @@ data ItemConsumption
data Item = Item data Item = Item
{ _itConsumption :: ItemConsumption { _itConsumption :: ItemConsumption
, _itUse :: ItemUse , _itUse :: ItemUse
-- , _itEquipPict :: Creature -> Item -> SPic
, _itType :: ItemType , _itType :: ItemType
, _itAttachment :: ItAttachment , _itAttachment :: ItAttachment
, _itID :: Maybe Int , _itID :: Maybe Int
@@ -570,7 +569,7 @@ data ItemDimension = ItemDimension
{ _dimRad :: Float { _dimRad :: Float
, _dimCenter :: Point3 , _dimCenter :: Point3
-- , _dimPortage :: ItemPortage -- , _dimPortage :: ItemPortage
, _dimSPic :: Item -> SPic -- , _dimSPic :: Item -> SPic
} }
data ItemPortage data ItemPortage
= HeldItem = HeldItem
-2
View File
@@ -160,7 +160,6 @@ defaultState = CrSt
defaultEquipment :: Item defaultEquipment :: Item
defaultEquipment = defaultItem defaultEquipment = defaultItem
{ _itInvColor = yellow { _itInvColor = yellow
, _itDimension = defItDimCol yellow
, _itUse = EquipUse defaultEquip , _itUse = EquipUse defaultEquip
, _itAttachment = NoItAttachment , _itAttachment = NoItAttachment
} }
@@ -170,7 +169,6 @@ defaultConsumable :: Item
defaultConsumable = defaultItem defaultConsumable = defaultItem
{ _itConsumption = ItemItselfConsumable {_icAmount = 1} { _itConsumption = ItemItselfConsumable {_icAmount = 1}
, _itInvColor = blue , _itInvColor = blue
, _itDimension = defItDimCol blue
} }
defaultFlIt :: FloorItem defaultFlIt :: FloorItem
+1 -1
View File
@@ -16,7 +16,7 @@ defaultItem = Item
, _itInvColor = yellow , _itInvColor = yellow
, _itInvSize = 1 , _itInvSize = 1
, _itPos = VoidItm , _itPos = VoidItm
, _itDimension = ItemDimension 0 0 (const mempty) , _itDimension = ItemDimension 2 0
, _itConsumption = NoConsumption , _itConsumption = NoConsumption
, _itUse = NoUse , _itUse = NoUse
, _itAttachment = NoItAttachment , _itAttachment = NoItAttachment
-19
View File
@@ -8,11 +8,6 @@ import Dodge.Default.Item
import Dodge.Default.AimParams import Dodge.Default.AimParams
--import Dodge.Item.Draw --import Dodge.Item.Draw
import Picture import Picture
import ShapePicture
import Shape
--import Geometry.Vector3D
import Geometry
--import Dodge.TweakBullet
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Control.Lens import Control.Lens
@@ -103,7 +98,6 @@ defaultWeapon :: Item
defaultWeapon = defaultItem defaultWeapon = defaultItem
& itConsumption .~ defaultLoadable & itConsumption .~ defaultLoadable
& itUse .~ defaultrUse & itUse .~ defaultrUse
& itDimension .~ defItDimCol white
& itInvColor .~ white & itInvColor .~ white
& itType . iyModules .~ M.fromList & itType . iyModules .~ M.fromList
[(ModBullet, EMPTYMODULE) [(ModBullet, EMPTYMODULE)
@@ -122,19 +116,6 @@ defaultItemValue = ItemValue 10 MundaneItem
defaultCraftable :: Item defaultCraftable :: Item
defaultCraftable = defaultItem defaultCraftable = defaultItem
{ _itInvColor = green { _itInvColor = green
, _itDimension = defItDimCol green
}
defItDim :: ItemDimension
defItDim = ItemDimension
{ _dimRad = 2
, _dimCenter = V3 0 0 0
, _dimSPic = const $ noPic $ colorSH green $ upperPrismPoly 3 $ square 4
}
defItDimCol :: Color -> ItemDimension
defItDimCol col = ItemDimension
{ _dimRad = 2
, _dimCenter = V3 0 0 0
, _dimSPic = const $ noPic $ colorSH col $ upperPrismPoly 3 $ square 4
} }
defBulletShooter :: ItemParams defBulletShooter :: ItemParams
defBulletShooter = BulletShooter defBulletShooter = BulletShooter
+4 -10
View File
@@ -2,37 +2,31 @@ module Dodge.Item.Draw
( pictureWeaponOnAim ( pictureWeaponOnAim
, pictureWeaponAim , pictureWeaponAim
, twoFlatHRot , twoFlatHRot
, itSPic , itemSPic
, itemEquipPict , itemEquipPict
) where ) where
import Dodge.Data import Dodge.Data
--import Dodge.Picture.Layer
--import Picture
--import Shape
import ShapePicture import ShapePicture
import Dodge.Creature.HandPos import Dodge.Creature.HandPos
import Dodge.Item.Equipment.Shape import Dodge.Item.Equipment.Shape
import Dodge.Item.Draw.SPic
import qualified Data.IntMap.Strict as IM import qualified Data.IntMap.Strict as IM
import Control.Lens import Control.Lens
import Data.Maybe import Data.Maybe
itemEquipPict :: Creature -> Item -> SPic itemEquipPict :: Creature -> Item -> SPic
itemEquipPict cr it = case it ^?! itUse of itemEquipPict cr it = case it ^?! itUse of
RightUse {} -> pictureWeaponOnAim cr it RightUse {} -> pictureWeaponOnAim cr it
ituse -> case ituse ^? eqEq of ituse -> case ituse ^? eqEq of
Just _ -> pictureOnEquip (itSPic it) cr it Just _ -> pictureOnEquip (itemSPic it) cr it
Nothing -> mempty Nothing -> mempty
pictureWeaponOnAim pictureWeaponOnAim
:: Creature :: Creature
-> Item -> Item
-> SPic -> SPic
pictureWeaponOnAim = pictureWeaponAim itSPic pictureWeaponOnAim = pictureWeaponAim itemSPic
itSPic :: Item -> SPic
itSPic it = _dimSPic (_itDimension it) it
pictureWeaponAim pictureWeaponAim
:: (Item -> SPic) :: (Item -> SPic)
+294 -84
View File
@@ -1,98 +1,117 @@
module Dodge.Item.Draw.SPic where module Dodge.Item.Draw.SPic where
import Dodge.Data
import Dodge.Item.Weapon.AmmoParams
import ShapePicture
import Shape
import LensHelp
import Color
import Picture
import Geometry
import Data.Maybe
itemSPic :: Item -> SPic itemSPic :: Item -> SPic
itemSPic it = modulesSPic it <> case it ^. itType . iyBase of itemSPic it = modulesSPic it <> case it ^. itType . iyBase of
HELD ht -> heldItemSPic ht it HELD ht -> heldItemSPic ht it
_ -> mempty NOTDEFINED -> defSPic
-- NOTDEFINED -> EFFGUN _ -> defSPic
-- EFFGUN _ -> AUTOEFFGUN _ -> defSPic
-- AUTOEFFGUN _ ->
--
--
-- BOOSTER
-- REWINDER
-- BLINKER
-- BLINKERUNSAFE
-- FORCEFIELDGUN
-- SHRINKER
-- SPAWNER
--
-- CLICKDETECTOR Detector
-- AUTODETECTOR Detector
-- MAGSHIELD
-- FLAMESHIELD
-- FRONTARMOUR
-- WRISTARMOUR
-- INVISIBILITYEQUIPMENT EquipSite
-- BRAINHAT
-- HEADLAMP
-- HEADLAMP1
-- POWERLEGS
-- SPEEDLEGS
-- JUMPLEGS
-- FLATSHIELD
-- JETPACK
--
-- KEYCARD Int
--
-- MEDKIT Int
-- CRAFT CraftType
BOOSTER -> defSPic
REWINDER -> defSPic
BLINKER -> defSPic
BLINKERUNSAFE -> defSPic
SHRINKER -> defSPic
SPAWNER -> defSPic
--
CLICKDETECTOR dt -> (noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
AUTODETECTOR dt -> (noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
MAGSHIELD -> defSPic
FLAMESHIELD -> defSPic
FRONTARMOUR -> (emptySH , setDepth 20 $ pictures
[color yellow $ thickArc 0 (pi/2) 10 5
,color yellow $ thickArc (3*pi/2) (2*pi) 10 5
])
WRISTARMOUR -> defSPic
INVISIBILITYEQUIPMENT _ -> (noPic (colorSH chartreuse $ upperPrismPoly 3 $ rectWH 2 2))
BRAINHAT -> noPic (colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
HEADLAMP -> noPic headLampShape
HEADLAMP1 -> noPic headLampShape
POWERLEGS -> legsSPic yellow
SPEEDLEGS -> legsSPic green
JUMPLEGS -> legsSPic red
FLATSHIELD -> flatShieldEquipSPic
JETPACK -> ((,) emptySH $ setDepth 20
$ pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3) ]
)
--
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic)
--
MEDKIT _ -> defSPic
CRAFT _ -> defSPic
heldItemSPic :: HeldItemType -> Item -> SPic
heldItemSPic ht it = case ht of heldItemSPic ht it = case ht of
BANGSTICK i -> noPic & baseStickShapeX i <> stickClip it FORCEFIELDGUN -> defSPic
-- PISTOL -> BANGSTICK i -> noPic $ baseStickShapeX it i <> stickClip it
-- REVOLVER -> PISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
-- REVOLVERX i -> REVOLVER -> noPic $ baseStickShape <> revolverClip it
-- MACHINEPISTOL -> REVOLVERX _ -> noPic $ baseStickShape <> revolverClip it
-- AUTOPISTOL -> MACHINEPISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
-- SMG -> AUTOPISTOL -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it
-- BANGCONE -> SMG -> noPic (baseSMGShape <> makeTinClipAt 0 (V3 7 (-2) 0) it)
-- BLUNDERBUSS -> BANGCONE -> noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 5 2)
-- GRAPECANNON i -> <> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 5 15)
-- MINIGUNX i -> BLUNDERBUSS -> noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2)
-- VOLLEYGUN i -> <> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 20 30)
-- RIFLE -> GRAPECANNON _ -> noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2)
-- REPEATER -> <> upperPrismPoly 6 (reverse $ rectNSWE 4 (-4) 20 30)
-- AUTORIFLE -> MINIGUNX i -> miniGunXPictItem i it
-- BURSTRIFLE -> VOLLEYGUN i -> volleyGunSPic i it
-- BANGROD -> RIFLE -> noPic $ baseRifleShape <> makeSingleClipAt (V3 5 0 3) it
-- ELEPHANTGUN -> REPEATER -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
-- AMR -> AUTORIFLE -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
-- AUTOAMR -> BURSTRIFLE -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
-- SNIPERRIFLE -> BANGROD -> noPic $ baseRodShape <> makeSingleClipAt (V3 5 0 3) it
-- MACHINEGUN -> ELEPHANTGUN -> noPic $ baseAMRShape <> makeSingleClipAt (V3 5 0 3) it
-- FLAMESPITTER -> AMR -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
-- FLAMETHROWER -> AUTOAMR -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
-- FLAMETORRENT -> SNIPERRIFLE -> noPic $ baseAMRShape <> makeSingleClipAt (V3 5 0 3) it
-- FLAMEWALL -> MACHINEGUN -> noPic $ baseAMRShape <> makeTinClipAt 0 (V3 10 (-2) 0) it
-- BLOWTORCH -> FLAMESPITTER -> flamerPic it
-- AUTOGUN -> FLAMETHROWER -> flamerPic it
-- SPARKGUN -> FLAMETORRENT -> flamerPic it
-- TESLAGUN -> FLAMEWALL -> flamerPic it
-- LASGUN -> BLOWTORCH -> flamerPic it
-- LASCIRCLE -> AUTOGUN -> defSPic
-- DUALBEAM -> SPARKGUN -> teslaGunPic
-- LASWIDE i -> TESLAGUN -> teslaGunPic
-- SONICGUN -> LASGUN -> lasGunPic it
-- TRACTORGUN -> LASCIRCLE -> lasGunPic it
-- LAUNCHER -> DUALBEAM -> dualBeamPic it
-- LAUNCHERX i -> LASWIDE _ -> lasGunPic it
-- REMOTELAUNCHER -> SONICGUN -> noPic baseSonicShape
-- POISONSPRAYER -> TRACTORGUN -> tractorGunPic it
-- DRONELAUNCHER -> LAUNCHER -> launcherPic it
-- SHATTERGUN -> LAUNCHERX _ -> launcherPic it
REMOTELAUNCHER -> launcherPic it
POISONSPRAYER -> flamerPic it
DRONELAUNCHER -> defSPic
SHATTERGUN -> shatterGunSPic
modulesSPic :: Item -> SPic modulesSPic :: Item -> SPic
modulesSPic it = mempty modulesSPic _ = mempty
baseStickShapeX :: Int -> Shape baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX i = foldMap f [0..i-1] baseStickShapeX it i = foldMap f [0..i-1]
where where
f j = rotateSH ang baseStickShape f j = rotateSH ang baseStickShape
where where
ang = fromIntegral j * baseStickSpread - (fromIntegral i - 1) * baseStickSpread * 0.5 ang = fromIntegral j * barrelspread - (fromIntegral i - 1) * barrelspread * 0.5
baseStickSpread :: Float barrelspread = it ^?! itParams . gunBarrels . brlSpread . spreadAngle
baseStickSpread = 0.2
baseStickShape :: Shape
baseStickShape = colorSH green $ upperPrismPoly 3 $ rectXH 10 2
stickClip :: Item -> Shape stickClip :: Item -> Shape
stickClip it = case it ^? itConsumption . laLoaded of stickClip it = case it ^? itConsumption . laLoaded of
@@ -101,5 +120,196 @@ stickClip it = case it ^? itConsumption . laLoaded of
where where
f i = rotateSH ang $ translateSH (V3 5 0 3) $ upperPrismPoly 2 $ square 1.5 f i = rotateSH ang $ translateSH (V3 5 0 3) $ upperPrismPoly 2 $ square 1.5
where where
ang = baseStickSpread * fromIntegral i ang = barrelspread * fromIntegral i
- 0.5 * baseStickSpread * fromIntegral (_brlNum (_gunBarrels (_itParams it))-1) - 0.5 * barrelspread * fromIntegral (_brlNum (_gunBarrels (_itParams it))-1)
barrelspread = it ^?! itParams . gunBarrels . brlSpread . spreadAngle
defSPic :: SPic
defSPic = noPic $ colorSH green $ upperPrismPoly 3 $ square 4
shatterGunSPic :: SPic
shatterGunSPic = noPic $ colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0)
where
xa = 1
xb = 9
defCane :: Item -> SPic
defCane it = noPic $ baseCaneShape <> makeSingleClipAt (V3 5 0 3) it
baseCaneShape :: Shape
baseCaneShape = colorSH red $ upperPrismPoly 3 $ rectXH 15 1.5
baseRifleShape :: Shape
baseRifleShape = colorSH red $ upperPrismPoly 3 $ rectXH 25 2
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
volleyGunSPic :: Int -> Item -> SPic
volleyGunSPic i 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
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
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))
baseSonicShape :: Shape
baseSonicShape = colorSH rose $ upperPrismPoly 3 $ rectXH 25 2
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
baseSMGShape :: Shape
baseSMGShape = colorSH green $ upperPrismPoly 3 $ rectXH 20 2
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
launcherPic :: Item -> SPic
launcherPic _ =
( colorSH cyan $ prismPoly
(map (+.+.+ V3 20 0 5) $ polyCircx 4 5)
(map (+.+.+ V3 0 0 5) $ polyCircx 4 5)
, mempty
)
baseRodShape :: Shape
baseRodShape = colorSH orange $ upperPrismPoly 3 $ rectXH 20 2
baseAMRShape :: Shape
baseAMRShape = colorSH orange $ upperPrismPoly 3 $ rectXH 30 2
teslaGunPic :: SPic
teslaGunPic = noPic $ colorSH blue $
upperPrismPoly 5 (rectNESW xb 8 xa 0)
<> upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0)
where
xa = 1
xb = 9
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
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
flatShieldEquipSPic :: SPic
flatShieldEquipSPic =
( colorSH yellow $ upperPrismPoly 10 (rectWH 2 10)
, mempty
)
headLampShape :: Shape
headLampShape = colorSH yellow $
translateSH (V3 5 2 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 2 0) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 0) (upperPrismPoly 4 $ rectWH 4 1)
detectorColor :: Detector -> Color
detectorColor dt = case dt of
ITEMDETECTOR -> blue
CREATUREDETECTOR -> green
WALLDETECTOR -> red
keyPic :: Picture
keyPic = color green $
pictures [translate (-4) 0 $ thickCircle 4 2
,thickLine 2 $ map toV2 [(0,0),(8,0),(8,-4)]
,thickLine 2 $ map toV2 [(4,0),(4,-4)]
]
latchkeyPic :: Picture
latchkeyPic = color yellow $
pictures [translate (-4) 0 $ thickCircle 4 2
,thickLine 2 $ map toV2 [(0,0),(8,0),(8,-4)]
,thickLine 2 $ map toV2 [(4,0),(4,-4)]
]
legsSPic :: Color -> SPic
legsSPic col = (noPic $ translateSH (V3 0 4 0) $ colorSH col $ upperPrismPoly 3 $ rectWH 2 2)
-34
View File
@@ -27,8 +27,6 @@ import Dodge.Wall.ForceField
import Dodge.Magnet import Dodge.Magnet
import Picture import Picture
import Geometry import Geometry
import ShapePicture
import Shape
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import LensHelp import LensHelp
--import ShortShow --import ShortShow
@@ -67,12 +65,6 @@ frontArmour = defaultEquipment
} }
& itUse . eqEq . eqSite .~ GoesOnChest & itUse . eqEq . eqSite .~ GoesOnChest
& itType . iyBase .~ FRONTARMOUR & itType . iyBase .~ FRONTARMOUR
& itDimension . dimSPic .~ const (emptySH , setDepth 20 $ pictures
[color thecol $ thickArc 0 (pi/2) 10 5
,color thecol $ thickArc (3*pi/2) (2*pi) 10 5
])
where
thecol = yellow -- (greyN 0.1)
wristArmour :: Item wristArmour :: Item
wristArmour = defaultEquipment wristArmour = defaultEquipment
@@ -83,7 +75,6 @@ wristArmour = defaultEquipment
& itUse . eqEq . eqUse .~ setWristShieldPos & itUse . eqEq . eqUse .~ setWristShieldPos
& itUse . eqEq . eqOnRemove .~ onRemoveWristShield & itUse . eqEq . eqOnRemove .~ onRemoveWristShield
& itType . iyBase .~ WRISTARMOUR & itType . iyBase .~ WRISTARMOUR
& itDimension . dimSPic .~ const mempty
onEquipWristShield :: Item -> Creature -> World -> World onEquipWristShield :: Item -> Creature -> World -> World
onEquipWristShield itm cr w = w onEquipWristShield itm cr w = w
@@ -138,12 +129,6 @@ flatShield = defaultEquipment
, _itInvSize = 3 , _itInvSize = 3
} }
& itType . iyBase .~ FLATSHIELD & itType . iyBase .~ FLATSHIELD
& itDimension . dimSPic .~ flatShieldEquipSPic
flatShieldEquipSPic :: Item -> SPic
flatShieldEquipSPic _ =
( colorSH yellow $ upperPrismPoly 10 (rectWH 2 10)
, mempty
)
shieldWall :: Int -> Wall shieldWall :: Int -> Wall
shieldWall crid = defaultWall shieldWall crid = defaultWall
@@ -212,9 +197,6 @@ jetPack = defaultEquipment
, _itID = Nothing , _itID = Nothing
} & itUse . eqEq . eqSite .~ GoesOnBack } & itUse . eqEq . eqSite .~ GoesOnBack
& itType . iyBase .~ JETPACK & itType . iyBase .~ JETPACK
& itDimension . dimSPic .~ ( \_ -> (,) emptySH $ setDepth 20
$ pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3) ]
)
brainHat :: Item brainHat :: Item
brainHat = defaultEquipment brainHat = defaultEquipment
@@ -223,8 +205,6 @@ brainHat = defaultEquipment
} }
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ BRAINHAT & itType . iyBase .~ BRAINHAT
& itDimension . dimSPic .~
const (noPic $ colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
headLamp1 :: Item headLamp1 :: Item
headLamp1 = defaultEquipment headLamp1 = defaultEquipment
@@ -234,10 +214,6 @@ headLamp1 = defaultEquipment
& itUse . eqEq . eqUse .~ createHeadLamp & itUse . eqEq . eqUse .~ createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ HEADLAMP1 & itType . iyBase .~ HEADLAMP1
& itDimension . dimSPic .~
const (noPic $ colorSH yellow $
translateSHf 5 2 (upperPrismPoly 8 $ rectWH 4 1)
<> translateSHf 5 (-2) (upperPrismPoly 8 $ rectWH 4 1))
headLamp :: Item headLamp :: Item
headLamp = defaultEquipment headLamp = defaultEquipment
{ _itEffect = NoItEffect { _itEffect = NoItEffect
@@ -246,14 +222,7 @@ headLamp = defaultEquipment
& itUse . eqEq . eqUse .~ createHeadLamp & itUse . eqEq . eqUse .~ createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ HEADLAMP & itType . iyBase .~ HEADLAMP
& itDimension . dimSPic .~ const (noPic headLampShape)
headLampShape :: Shape
headLampShape = colorSH yellow $
translateSH (V3 5 2 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 2 0) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 4) (upperPrismPoly 4 $ rectWH 4 1)
<> translateSH (V3 5 (-2) 0) (upperPrismPoly 4 $ rectWH 4 1)
createHeadLamp :: Item -> Creature -> World -> World createHeadLamp :: Item -> Creature -> World -> World
createHeadLamp _ cr = tempLightSources .:~ tlsTimeRadColPos 1 200 0.7 createHeadLamp _ cr = tempLightSources .:~ tlsTimeRadColPos 1 200 0.7
@@ -266,8 +235,6 @@ powerLegs = defaultEquipment
} }
& itUse . eqEq . eqSite .~ GoesOnLegs & itUse . eqEq . eqSite .~ GoesOnLegs
& itType . iyBase .~ POWERLEGS & itType . iyBase .~ POWERLEGS
& itDimension . dimSPic .~ const
(noPic $ translateSH (V3 0 4 0) $ colorSH yellow $ upperPrismPoly 3 $ rectWH 2 2)
speedLegs :: Item speedLegs :: Item
speedLegs = powerLegs speedLegs = powerLegs
& itType . iyBase .~ SPEEDLEGS & itType . iyBase .~ SPEEDLEGS
@@ -283,7 +250,6 @@ wristInvisibility = defaultEquipment
& itUse . eqEq . eqOnEquip .~ overCID (crCamouflage .~ Invisible) & itUse . eqEq . eqOnEquip .~ overCID (crCamouflage .~ Invisible)
& itUse . eqEq . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible) & itUse . eqEq . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible)
& itType . iyBase .~ INVISIBILITYEQUIPMENT GoesOnWrist & itType . iyBase .~ INVISIBILITYEQUIPMENT GoesOnWrist
& itDimension . dimSPic .~ const (noPic (colorSH chartreuse $ upperPrismPoly 3 $ rectWH 2 2))
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = creatures . ix (_crID cr) %~ f overCID f _ cr = creatures . ix (_crID cr) %~ f
-20
View File
@@ -2,10 +2,7 @@ module Dodge.Item.PassKey where
import Dodge.Data import Dodge.Data
import Dodge.Default import Dodge.Default
import Picture import Picture
import Geometry.Data
import LensHelp import LensHelp
import ShapePicture
import Shape
keyCard :: Int -> Item keyCard :: Int -> Item
keyCard n = defaultEquipment keyCard n = defaultEquipment
{ _itEffect = NoItEffect { _itEffect = NoItEffect
@@ -14,15 +11,6 @@ keyCard n = defaultEquipment
, _itInvColor = aquamarine , _itInvColor = aquamarine
} }
& itType . iyBase .~ KEYCARD n & itType . iyBase .~ KEYCARD n
& itDimension . dimSPic .~ (const . noShape)
(setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic)
keyPic :: Picture
keyPic = color green $
pictures [translate (-4) 0 $ thickCircle 4 2
,thickLine 2 $ map toV2 [(0,0),(8,0),(8,-4)]
,thickLine 2 $ map toV2 [(4,0),(4,-4)]
]
latchkey :: Int -> Item latchkey :: Int -> Item
latchkey _ = defaultEquipment latchkey _ = defaultEquipment
@@ -31,11 +19,3 @@ latchkey _ = defaultEquipment
-- , _itZoom = defaultItZoom -- , _itZoom = defaultItZoom
, _itInvColor = yellow , _itInvColor = yellow
} }
& itDimension . dimSPic .~ ( \_ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) latchkeyPic
)
latchkeyPic :: Picture
latchkeyPic = color yellow $
pictures [translate (-4) 0 $ thickCircle 4 2
,thickLine 2 $ map toV2 [(0,0),(8,0),(8,-4)]
,thickLine 2 $ map toV2 [(4,0),(4,-4)]
]
-51
View File
@@ -32,15 +32,11 @@ import Dodge.WorldEvent.Flash
--import Dodge.Default --import Dodge.Default
--import Dodge.Item.Weapon.InventoryDisplay --import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.AmmoParams
import Dodge.Default.Weapon import Dodge.Default.Weapon
--import Dodge.Item.Attachment
--import Dodge.WorldEvent.HelperParticle
import Dodge.Base import Dodge.Base
--import Dodge.Zone --import Dodge.Zone
import Geometry import Geometry
import Picture import Picture
import Shape
import ShapePicture import ShapePicture
import LensHelp import LensHelp
--import Dodge.RandomHelp --import Dodge.RandomHelp
@@ -80,7 +76,6 @@ teslaGun = defaultBatteryGun
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 9 { _dimRad = 9
, _dimCenter = V3 4 0 0 , _dimCenter = V3 4 0 0
, _dimSPic = teslaGunPic
} }
, _itParams = teslaParams , _itParams = teslaParams
} }
@@ -97,13 +92,6 @@ teslaGun = defaultBatteryGun
& itUse . useAim . aimHandlePos .~ 4 & itUse . useAim . aimHandlePos .~ 4
& itUse . useAim . aimMuzPos .~ 4 & itUse . useAim . aimMuzPos .~ 4
& itType . iyBase .~ HELD TESLAGUN & 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 :: Item
--lasPulse = lasGun --lasPulse = lasGun
-- & itType . iyBase .~ LASPULSE -- & itType . iyBase .~ LASPULSE
@@ -240,7 +228,6 @@ dualBeam :: Item
dualBeam = lasGun dualBeam = lasGun
& itType . iyBase .~ HELD DUALBEAM & itType . iyBase .~ HELD DUALBEAM
& itUse . useAim . aimMuzPos .~ 0 & itUse . useAim . aimMuzPos .~ 0
& itDimension .dimSPic .~ dualBeamPic
& itParams .~ DualBeam & itParams .~ DualBeam
{ _phaseV = 1 { _phaseV = 1
, _lasColor = red , _lasColor = red
@@ -304,7 +291,6 @@ lasGun = defaultAutoBatteryGun
& itDimension .~ ItemDimension & itDimension .~ ItemDimension
{ _dimRad = 10 { _dimRad = 10
, _dimCenter = V3 15 0 0 , _dimCenter = V3 15 0 0
, _dimSPic = lasGunPic
} }
& itUse . rUse .~ shootLaser & itUse . rUse .~ shootLaser
& itUse . useDelay .~ NoDelay & itUse . useDelay .~ NoDelay
@@ -323,31 +309,6 @@ lasGun = defaultAutoBatteryGun
& itUse . useAim . aimMuzPos .~ 30 & itUse . useAim . aimMuzPos .~ 30
& itType . iyBase .~ HELD LASGUN & 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
lasGunTweak = TweakParam lasGunTweak = TweakParam
{ _doTweak = thetweak { _doTweak = thetweak
@@ -374,7 +335,6 @@ tractorGun = lasGun
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 10 { _dimRad = 10
, _dimCenter = V3 15 0 0 , _dimCenter = V3 15 0 0
, _dimSPic = tractorGunPic
} }
, _itParams = Attracting {_attractionPower = 1} , _itParams = Attracting {_attractionPower = 1}
, _itTweaks = Tweakable , _itTweaks = Tweakable
@@ -414,17 +374,6 @@ tractorGunTweak = TweakParam
showPower 3 = "0" -- object should stay in the center of the beam showPower 3 = "0" -- object should stay in the center of the beam
showPower i = "THIS SHOULD NOT BE POSSIBLE" ++ show i 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 -- | assumes that the item is held
shootTeslaArc :: Item -> Creature -> World -> World shootTeslaArc :: Item -> Creature -> World -> World
shootTeslaArc it cr w = w' shootTeslaArc it cr w = w'
-50
View File
@@ -10,8 +10,6 @@ module Dodge.Item.Weapon.BulletGun.Cane
) where ) where
--import Dodge.Particle.Bullet.HitEffect --import Dodge.Particle.Bullet.HitEffect
import Dodge.Reloading.Action import Dodge.Reloading.Action
--import Dodge.WorldEvent.HitEffect
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data import Dodge.Data
--import Dodge.ChainEffect --import Dodge.ChainEffect
import Dodge.Default.Weapon import Dodge.Default.Weapon
@@ -25,8 +23,6 @@ import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound import Dodge.SoundLogic.LoadSound
import Picture import Picture
import Geometry import Geometry
import ShapePicture
import Shape
import Sound.Data import Sound.Data
import LensHelp import LensHelp
@@ -46,8 +42,6 @@ defaultBangCane = defaultBulletWeapon
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 8 { _dimRad = 8
, _dimCenter = V3 5 0 0 , _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseCaneShape
<> makeSingleClipAt (V3 5 0 3) it
} }
} }
& itUse . useDelay . rateMax .~ 6 & itUse . useDelay . rateMax .~ 6
@@ -85,11 +79,6 @@ volleyGun i = defaultBulletWeapon
& itDimension .~ ItemDimension & itDimension .~ ItemDimension
{ _dimRad = 8 { _dimRad = 8
, _dimCenter = V3 5 0 0 , _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 . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1 & itUse . useAim . aimRange .~ 1
@@ -120,20 +109,11 @@ caneStickSoundChoice :: Item -> SoundID
caneStickSoundChoice it caneStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S | _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS | 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 :: Item
rifle = defaultBangCane rifle = defaultBangCane
{ _itDimension = ItemDimension { _itDimension = ItemDimension
{ _dimRad = 8 { _dimRad = 8
, _dimCenter = V3 5 0 0 , _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseRifleShape
<> makeSingleClipAt (V3 5 0 3) it
} }
} }
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
@@ -150,15 +130,7 @@ repeater = rifle
& itType . iyBase .~ HELD REPEATER & itType . iyBase .~ HELD REPEATER
& itConsumption . laCycle .~ [loadEject 50, loadInsert 40 ,loadPrime 20] & itConsumption . laCycle .~ [loadEject 50, loadInsert 40 ,loadPrime 20]
& itConsumption . laMax .~ 15 & 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 :: Item
autoRifle = repeater autoRifle = repeater
@@ -279,29 +251,7 @@ miniGunX i = defaultAutoGun
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 20 { _dimRad = 20
, _dimCenter = V3 5 0 0 , _dimCenter = V3 5 0 0
, _dimSPic = miniGunXPictItem i
} }
} }
& itType . iyBase .~ HELD (MINIGUNX i) & itType . iyBase .~ HELD (MINIGUNX i)
& itUse . useAim . aimMuzPos .~ 40 & 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 ) where
import Dodge.Data import Dodge.Data
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Particle.HitEffect import Dodge.Particle.HitEffect
import Dodge.Particle.Damage import Dodge.Particle.Damage
--import Dodge.ChainEffect --import Dodge.ChainEffect
@@ -22,11 +21,7 @@ import Dodge.Item.Weapon.ZoomScope
import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound import Dodge.SoundLogic.LoadSound
import Picture
import Geometry import Geometry
import ShapePicture
import Shape
--import Sound.Data
import LensHelp import LensHelp
--import qualified Data.Sequence as Seq --import qualified Data.Sequence as Seq
@@ -60,8 +55,6 @@ bangRod = defaultBulletWeapon
& itDimension .~ ItemDimension & itDimension .~ ItemDimension
{ _dimRad = 12 { _dimRad = 12
, _dimCenter = V3 5 0 0 , _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseRodShape
<> makeSingleClipAt (V3 5 0 3) it
} }
& itConsumption . laMax .~ 1 & itConsumption . laMax .~ 1
& itConsumption . laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 5] & itConsumption . laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 5]
@@ -73,18 +66,11 @@ bangRod = defaultBulletWeapon
& itUse . useAim . aimHandlePos .~ 5 & itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 30 & itUse . useAim . aimMuzPos .~ 30
& itConsumption . laAmmoType . amBulEff .~ expireAndDamage heavyBulDams & 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 :: Item
elephantGun = bangRod elephantGun = bangRod
& itType . iyBase .~ HELD ELEPHANTGUN & itType . iyBase .~ HELD ELEPHANTGUN
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
& itParams . gunBarrels .~ SingleBarrel 0.05 & itParams . gunBarrels .~ SingleBarrel 0.05
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
<> makeSingleClipAt (V3 5 0 3) it
)
& itUse . useMods .~ & itUse . useMods .~
[ ammoHammerCheck [ ammoHammerCheck
, useTimeCheck , useTimeCheck
@@ -102,9 +88,6 @@ amr :: Item
amr = elephantGun amr = elephantGun
& itType . iyBase .~ HELD AMR & itType . iyBase .~ HELD AMR
& itConsumption . laMax .~ 15 & itConsumption . laMax .~ 15
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
<> makeTinClipAt 0 (V3 10 (-2) 0) it
)
autoAmr :: Item autoAmr :: Item
autoAmr = amr autoAmr = amr
+1 -38
View File
@@ -7,7 +7,6 @@ module Dodge.Item.Weapon.BulletGun.Stick
, revolver , revolver
, revolverX , revolverX
) where ) where
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.Data import Dodge.Data
import Dodge.ChainEffect import Dodge.ChainEffect
@@ -21,10 +20,7 @@ import Dodge.Item.Weapon.AmmoParams
--import Dodge.Item.Draw --import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound import Dodge.SoundLogic.LoadSound
import Picture
import Geometry import Geometry
import ShapePicture
import Shape
import Sound.Data import Sound.Data
import LensHelp import LensHelp
@@ -71,8 +67,6 @@ bangStick i = defaultBulletWeapon
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 5 { _dimRad = 5
, _dimCenter = V3 5 0 0 , _dimCenter = V3 5 0 0
, _dimSPic = \it -> noPic $ baseStickShapeX i
<> stickClip it
} }
} }
& itType . iyBase .~ HELD (BANGSTICK i) & itType . iyBase .~ HELD (BANGSTICK i)
@@ -80,46 +74,18 @@ bangStick i = defaultBulletWeapon
& itUse . useAim . aimMuzPos .~ 10 & itUse . useAim . aimMuzPos .~ 10
& itConsumption . laMax .~ i & itConsumption . laMax .~ i
& itConsumption . laCycle .~ [loadPartialInsert 10 1] & 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 :: Float
baseStickSpread = 0.2 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 :: Item
revolver = pistol revolver = pistol
& itConsumption .~ & itConsumption .~
(defaultBulletLoadable (defaultBulletLoadable
& laMax .~ 6 & laMax .~ 6
& laCycle .~ [loadPartialInsert 10 1] ) & laCycle .~ [loadPartialInsert 10 1] )
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> revolverClip it)
& itType . iyBase .~ HELD REVOLVER & 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 :: [ChainEffect]
pistolAfterHamMods = pistolAfterHamMods =
[ useTimeCheck [ useTimeCheck
@@ -161,7 +127,6 @@ pistol = bangStick 1
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] ) & laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse . useDelay . rateMax .~ 6 & itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ (ammoHammerCheck : pistolAfterHamMods) & itUse . useMods .~ (ammoHammerCheck : pistolAfterHamMods)
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
& itParams %~ & itParams %~
( ( muzVel .~ 0.8 ) ( ( muzVel .~ 0.8 )
. ( rifling .~ 0.8 ) . ( rifling .~ 0.8 )
@@ -190,8 +155,6 @@ smg = autoPistol -- & some parameter affecting stability
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 2 & itUse . useAim . aimHandlePos .~ 2
& itParams . torqueAfter .~ 0.05 & itParams . torqueAfter .~ 0.05
& itDimension . dimSPic .~ \it -> noPic (baseSMGShape
<> makeTinClipAt 0 (V3 7 (-2) 0) it)
revolverX :: Int -> Item revolverX :: Int -> Item
revolverX i = revolver revolverX i = revolver
& itUse . useDelay . rateMax .~ 8 & itUse . useDelay . rateMax .~ 8
-4
View File
@@ -103,8 +103,6 @@ bangCone = defaultBulletWeapon
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 8 { _dimRad = 8
, _dimCenter = V3 5 0 0 , _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 & itUse . useDelay . rateMax .~ 20
@@ -146,8 +144,6 @@ blunderbuss = bangCone
{_itDimension = ItemDimension {_itDimension = ItemDimension
{ _dimRad = 8 { _dimRad = 8
, _dimCenter = V3 5 0 0 , _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 & itConsumption . laMax .~ 25
-9
View File
@@ -60,7 +60,6 @@ launcher = defaultWeapon
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 9 { _dimRad = 9
, _dimCenter = V3 10 0 0 , _dimCenter = V3 10 0 0
, _dimSPic = launcherPic
} }
} }
& itUse . useDelay . rateMax .~ 20 & itUse . useDelay . rateMax .~ 20
@@ -104,14 +103,6 @@ usePjCreationX i it cr = foldr f
where where
f n = (. _amPjCreation (_laAmmoType (_itConsumption it)) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i))) 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.IntMap TweakParam
basicAmPjMoves = IM.fromList . zip [0..] $ basicAmPjMoves = IM.fromList . zip [0..] $
[spinDrag [spinDrag
-13
View File
@@ -8,11 +8,6 @@ import Dodge.Item.Weapon.UseEffect
--import Dodge.Item.Weapon.Remote --import Dodge.Item.Weapon.Remote
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.SoundLogic import Dodge.SoundLogic
--import Dodge.Item.Weapon.Grenade
import Geometry
import Picture
import Shape
import ShapePicture
import Control.Lens import Control.Lens
@@ -36,16 +31,8 @@ autoDetector dt = defaultEquipment
& itUse . eqEq . eqParams .~ EquipCounter 0 & itUse . eqEq . eqParams .~ EquipCounter 0
& itUse . eqEq . eqViewDist ?~ 350 & itUse . eqEq . eqViewDist ?~ 350
& itType . iyBase .~ AUTODETECTOR dt & itType . iyBase .~ AUTODETECTOR dt
& itDimension . dimSPic .~ const
(noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
-- , _itEffect = autoRadarEffect -- , _itEffect = autoRadarEffect
detectorColor :: Detector -> Color
detectorColor dt = case dt of
ITEMDETECTOR -> blue
CREATUREDETECTOR -> green
WALLDETECTOR -> red
detectorEffect :: Detector -> Item -> Creature -> World -> World detectorEffect :: Detector -> Item -> Creature -> World -> World
detectorEffect dt = case dt of detectorEffect dt = case dt of
ITEMDETECTOR -> const anItemFindPulse ITEMDETECTOR -> const anItemFindPulse
+1 -12
View File
@@ -17,11 +17,7 @@ import Dodge.Default.Weapon
--import Dodge.Item.Draw --import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
--import Dodge.SoundLogic.LoadSound --import Dodge.SoundLogic.LoadSound
import Picture
import Geometry import Geometry
import ShapePicture
import Shape
--import Sound.Data
import LensHelp import LensHelp
--import qualified Data.IntMap.Strict as IM --import qualified Data.IntMap.Strict as IM
@@ -38,15 +34,7 @@ shatterGun = defaultWeapon
, useAmmoAmount 1 , useAmmoAmount 1
] ]
& itUse . useAim . aimStance .~ TwoHandFlat & 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 :: Item -> Creature -> World -> World
shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ sequence shootShatter it cr w = maybe w (uncurry $ shatterWall w sp ep) $ sequence
$ collidePointWallsFilterStream canshatter sp ep w $ 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) & makeDebrisDirected 1 2 (pi/2) (argV $ vNormal $ uncurry (-.-) $ _wlLine wl) (_wlMaterial wl)
(_wlColor wl) p (_wlColor wl) p
& damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl & damageWall (Damage SHATTERING 1000 sp p ep NoDamageEffect) wl
-6
View File
@@ -17,9 +17,6 @@ import Dodge.Default.Weapon
--import Dodge.Zone --import Dodge.Zone
import Geometry import Geometry
import Picture import Picture
import Shape
import ShapePicture
--import Dodge.Picture
import LensHelp import LensHelp
--import Data.Maybe --import Data.Maybe
@@ -39,7 +36,6 @@ sonicGun = defaultAutoGun
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 10 { _dimRad = 10
, _dimCenter = V3 15 0 0 , _dimCenter = V3 15 0 0
, _dimSPic = const $ noPic baseSonicShape
} }
} }
& itUse . useDelay . rateMax .~ 8 & itUse . useDelay . rateMax .~ 8
@@ -54,8 +50,6 @@ sonicGun = defaultAutoGun
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimMuzPos .~ 25 & itUse . useAim . aimMuzPos .~ 25
& itType . iyBase .~ HELD SONICGUN & itType . iyBase .~ HELD SONICGUN
baseSonicShape :: Shape
baseSonicShape = colorSH rose $ upperPrismPoly 3 $ rectXH 25 2
aSonicWave :: Item -> Creature -> World -> World aSonicWave :: Item -> Creature -> World -> World
aSonicWave it cr = instantParticles .:~ sonicWave pos dir cpos 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.BulletGuns
--import Dodge.Item.Weapon.InventoryDisplay --import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType 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.Default.Weapon
--import Dodge.Item.Attachment --import Dodge.Item.Attachment
import Geometry import Geometry
--import Geometry.Vector3D
import Picture
import Shape
import ShapePicture
import LensHelp import LensHelp
import Data.Traversable import Data.Traversable
@@ -52,19 +45,6 @@ poisonSprayer = flameThrower
-- , spreadNumI -- , 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 :: Item
flameSpitter = flameThrower flameSpitter = flameThrower
& itType . iyBase .~ HELD FLAMESPITTER & itType . iyBase .~ HELD FLAMESPITTER
@@ -139,7 +119,6 @@ flameThrower = defaultAutoGun
, _itDimension = ItemDimension , _itDimension = ItemDimension
{ _dimRad = 7 { _dimRad = 7
, _dimCenter = V3 9 0 0 , _dimCenter = V3 9 0 0
, _dimSPic = flamerPic
} }
-- , _itFloorPict = flamerPic -- , _itFloorPict = flamerPic
} }
+1 -1
View File
@@ -270,7 +270,7 @@ ppDraw c = uncurryV translate (_ppPos c) $ rotate (_ppRot c) (_ppPict c)
floorItemSPic :: FloorItem -> SPic floorItemSPic :: FloorItem -> SPic
floorItemSPic flit = uncurryV translateSPf (_flItPos flit) floorItemSPic flit = uncurryV translateSPf (_flItPos flit)
$ rotateSP (_flItRot flit) (itSPic (_flIt flit)) $ rotateSP (_flItRot flit) (itemSPic (_flIt flit))
btSPic :: Button -> SPic btSPic :: Button -> SPic
btSPic bt = uncurryV translateSPf (_btPos bt) btSPic bt = uncurryV translateSPf (_btPos bt)