Data-ify item drawing

This commit is contained in:
2022-07-11 00:33:59 +01:00
parent 75cd15c240
commit ad84e69d05
15 changed files with 102 additions and 81 deletions
+1 -2
View File
@@ -20,7 +20,7 @@ import Dodge.Default
--import Dodge.Item.Weapon.ExtraEffect
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.AmmoParams
import Dodge.Item.Draw
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
@@ -283,7 +283,6 @@ miniGunX i = defaultAutoGun
, _torqueAfter = 0
, _randomOffset = 10
}
, _itEquipPict = pictureWeaponAim (miniGunXPictItem i)
, _itInvSize = 4
, _itDimension = ItemDimension
{ _dimRad = 20
+1 -2
View File
@@ -20,7 +20,7 @@ import Dodge.Data
import Dodge.Default.Weapon
import Dodge.Default
import Dodge.Item.Attachment
import Dodge.Item.Draw
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
@@ -44,7 +44,6 @@ autoGun = defaultAutoGun
& laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
-- , _itFloorPict = autoGunPic
-- , _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponOnAim
, _itAttachment = AttachCharMode $ Seq.fromList "MS"
, _itParams = BulletShooter
{ _muzVel = 1
+1 -1
View File
@@ -200,7 +200,7 @@ targetLaserUpdate _ cr w t
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
addLaserPic = instantParticles .:~ PtTargetLaser
{ _ptUpdate = ptSimpleTime 1
, _ptPoints = (sp:ps)
, _ptPoints = sp:ps
, _ptColor = col
}
--wpammo = _itConsumption it
+6 -6
View File
@@ -6,7 +6,7 @@ import Dodge.Item.Weapon.Remote
import Dodge.Base
import Dodge.Zone
import Dodge.SoundLogic
import Dodge.Item.Draw
--import Dodge.Item.Draw
--import Dodge.Item.Weapon.InventoryDisplay
--import Dodge.Item.Attachment
import Picture
@@ -103,7 +103,7 @@ throwGrenade thePayload cr w = setWp $ removePict $ over props addG w
, _pjTimer = fuseTime
}
j = crSel cr
removePict = set (creatures . ix n . crInv . ix j . itEquipPict) $ \ _ _ -> (,) emptySH blank
removePict = id -- set (creatures . ix n . crInv . ix j . itEquipPict) $ \ _ _ -> (,) emptySH blank
i = IM.newKey $ _props w
v' = 1 / (fromIntegral fuseTime * _cameraZoom w) *.* rotateV (_cameraRot w) ( _mousePos w)
v | magV v' > 6 = 6 *.* normalizeV v'
@@ -125,7 +125,7 @@ throwArmReset x = ItInvEffect {_ieInv = f ,_ieCounter = x }
counterDown it
| _ieCounter (_itEffect it) == 0 = it
& itUse . useHammer .~ HammerUp
& itEquipPict .~ pictureWeaponAim (\_ -> grenadePic 50)
-- & itEquipPict .~ pictureWeaponAim (\_ -> grenadePic 50)
| otherwise = it & itEffect . ieCounter -~ 1
--flameGrenade :: Item
@@ -239,7 +239,7 @@ throwRemoteBomb cr w = setLocation
| otherwise = v'
j = crSel cr
-- resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE"
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> mempty
removePict = id -- set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> mempty
resetFire = set (creatures . ix cid . crInv . ix j . itUse . rUse)
$ \_ -> explodeRemoteBomb itid i
p' = _crPos cr +.+ rotateV (_crDir cr) (V2 (_crRad cr) 0)
@@ -267,8 +267,8 @@ explodeRemoteBomb itid pjid cr w
where
cid = _crID cr
-- resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEBOMB"
resetPict = set (creatures . ix cid . crInv . ix j . itEquipPict )
(pictureWeaponAim $ \_ -> (,) emptySH remoteBombUnarmedPic)
resetPict = id --set (creatures . ix cid . crInv . ix j . itEquipPict )
-- (pictureWeaponAim $ \_ -> (,) emptySH remoteBombUnarmedPic)
-- resetScope = creatures . ix cid . crInv . ix j . itScope . _Just . scopePos .~ (0,0)
j = crSel $ _creatures w IM.! cid
remoteBombPic
+8 -6
View File
@@ -2,7 +2,7 @@ module Dodge.Item.Weapon.Radar where
import Dodge.Data
--import Dodge.Picture.Layer
import Dodge.Default
import Dodge.Item.Draw
--import Dodge.Item.Draw
--import Dodge.Item.Equipment
import Dodge.Item.Equipment.Shape
import Dodge.Item.Weapon.TriggerType
@@ -15,7 +15,7 @@ import Dodge.SoundLogic
import Geometry
import Picture
import Shape
--import ShapePicture
import ShapePicture
import Control.Lens
@@ -30,20 +30,22 @@ clickDetector dt = defaultWeapon
]
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
& itEquipPict .~ pictureWeaponAim (\_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5))
& itType . iyBase .~ CLICKDETECTOR dt
autoDetector :: Detector -> Item
autoDetector dt = defaultEquipment
{_itEquipPict = shapeForWrist (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2)
-- , _itEffect = autoRadarEffect
, _itID = Nothing
{ _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqUse .~ autoEffect (detectorEffect dt) 100 click1S
& itUse . eqEq . eqParams .~ EquipCounter 0
& itUse . eqEq . eqViewDist ?~ 350
& itType . iyBase .~ AUTODETECTOR dt
& itDimension . dimPortage
.~ WornItem
& itDimension . dimSPic .~ const
(noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
-- , _itEffect = autoRadarEffect
detectorColor :: Detector -> Color
detectorColor dt = case dt of