Continue record refactor
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -27,7 +27,6 @@ import Dodge.Data.Item.Targeting
|
|||||||
import Dodge.Data.Item.Use.Consumption
|
import Dodge.Data.Item.Use.Consumption
|
||||||
import Dodge.Data.Item.Use.Equipment
|
import Dodge.Data.Item.Use.Equipment
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
--import Sound.Data
|
|
||||||
|
|
||||||
data ItemUse
|
data ItemUse
|
||||||
= UseHeld
|
= UseHeld
|
||||||
@@ -85,15 +84,9 @@ data HeldParams
|
|||||||
}
|
}
|
||||||
| BeamShooterParams
|
| BeamShooterParams
|
||||||
| BulletShooterParams
|
| BulletShooterParams
|
||||||
{ _muzVel :: GenFloat
|
{ _torqueAfter :: Float
|
||||||
, _rifling :: GenFloat
|
|
||||||
-- , _recoil :: Float
|
|
||||||
, _torqueAfter :: Float
|
|
||||||
, _randomOffset :: Float
|
, _randomOffset :: Float
|
||||||
, _sidePush :: Float
|
, _sidePush :: Float
|
||||||
-- , _bulGunSound :: Maybe (SoundID, Int) -- if the int is 0, play sound on new channel
|
|
||||||
-- if >0, continue playing sound for
|
|
||||||
-- given time
|
|
||||||
, _weaponInvLock :: Int
|
, _weaponInvLock :: Int
|
||||||
, _weaponRepeat :: [Int]
|
, _weaponRepeat :: [Int]
|
||||||
}
|
}
|
||||||
@@ -106,9 +99,6 @@ data AmmoParams
|
|||||||
| NoAmmoParams
|
| NoAmmoParams
|
||||||
deriving (Eq, Show, Read) --Generic, Flat)
|
deriving (Eq, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
--data AimParams = AimParams { _aimMuzzles :: [Muzzle] }
|
|
||||||
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
||||||
|
|
||||||
data FlareType
|
data FlareType
|
||||||
= NoFlare
|
= NoFlare
|
||||||
| BasicFlare
|
| BasicFlare
|
||||||
|
|||||||
@@ -29,10 +29,7 @@ defaultHeldUse = UseHeld
|
|||||||
-- , _heldHammer = HammerUp
|
-- , _heldHammer = HammerUp
|
||||||
, _heldMuzzles = defaultMuzzles
|
, _heldMuzzles = defaultMuzzles
|
||||||
, _heldParams = BulletShooterParams
|
, _heldParams = BulletShooterParams
|
||||||
{ _muzVel = ConstFloat 0.8
|
{ _torqueAfter = 0.2
|
||||||
, _rifling = ConstFloat 0.8
|
|
||||||
-- , _recoil = 10
|
|
||||||
, _torqueAfter = 0.2
|
|
||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
, _sidePush = 0
|
, _sidePush = 0
|
||||||
-- , _bulGunSound = Just (tap3S, 0)
|
-- , _bulGunSound = Just (tap3S, 0)
|
||||||
|
|||||||
+92
-2
@@ -1,5 +1,6 @@
|
|||||||
{-# OPTIONS -Wno-incomplete-uni-patterns #-}
|
{-# OPTIONS -Wno-incomplete-uni-patterns #-}
|
||||||
--{-# LANGUAGE TupleSections #-}
|
--{-# LANGUAGE TupleSections #-}
|
||||||
|
{-# LANGUAGE LambdaCase #-}
|
||||||
|
|
||||||
module Dodge.HeldUse (
|
module Dodge.HeldUse (
|
||||||
heldEffect,
|
heldEffect,
|
||||||
@@ -670,13 +671,102 @@ makeBullet thebullet itm bulpos dir w =
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
g = _randGen w
|
g = _randGen w
|
||||||
(drag, g') = case _rifling (_heldParams $ _itUse itm) of
|
(drag, g') = case heldItemRifling (_ibtHeld $ _itType itm) of --unsafe
|
||||||
ConstFloat x -> (x, g)
|
ConstFloat x -> (x, g)
|
||||||
UniRandFloat x y -> randomR (x, y) g
|
UniRandFloat x y -> randomR (x, y) g
|
||||||
(muzvel, g'') = case _muzVel $ _heldParams $ _itUse itm of
|
(muzvel, g'') = case heldItemMuzVel $ _ibtHeld $ _itType itm of
|
||||||
ConstFloat x -> (x, g')
|
ConstFloat x -> (x, g')
|
||||||
UniRandFloat x y -> randomR (x, y) g'
|
UniRandFloat x y -> randomR (x, y) g'
|
||||||
|
|
||||||
|
heldItemMuzVel :: HeldItemType -> GenFloat
|
||||||
|
heldItemMuzVel = \case
|
||||||
|
BANGSTICK{} -> ConstFloat 0.8
|
||||||
|
REWINDER -> ConstFloat 0.8
|
||||||
|
TIMESTOPPER -> ConstFloat 0.8
|
||||||
|
TIMESCROLLER -> ConstFloat 0.8
|
||||||
|
PISTOL -> ConstFloat 0.8
|
||||||
|
MACHINEPISTOL -> ConstFloat 0.8
|
||||||
|
AUTOPISTOL -> ConstFloat 0.8
|
||||||
|
SMG -> ConstFloat 0.8
|
||||||
|
BANGCONE -> UniRandFloat 0.5 0.8
|
||||||
|
BLUNDERBUSS -> UniRandFloat 0.5 0.8
|
||||||
|
GRAPECANNON{} -> UniRandFloat 0.5 0.8
|
||||||
|
MINIGUNX{} -> ConstFloat 0.8
|
||||||
|
VOLLEYGUN{} -> ConstFloat 0.8
|
||||||
|
RIFLE -> ConstFloat 0.8
|
||||||
|
ALTERIFLE -> ConstFloat 0.8
|
||||||
|
AUTORIFLE -> ConstFloat 0.8
|
||||||
|
BURSTRIFLE -> ConstFloat 0.8
|
||||||
|
BANGROD -> ConstFloat 0.8
|
||||||
|
ELEPHANTGUN -> ConstFloat 0.8
|
||||||
|
AMR -> ConstFloat 0.8
|
||||||
|
AUTOAMR -> ConstFloat 0.8
|
||||||
|
SNIPERRIFLE -> ConstFloat 0.8
|
||||||
|
FLAMESPITTER -> ConstFloat 0.8
|
||||||
|
FLAMETHROWER -> ConstFloat 0.8
|
||||||
|
FLAMETORRENT -> ConstFloat 0.8
|
||||||
|
FLAMEWALL -> ConstFloat 0.8
|
||||||
|
BLOWTORCH -> ConstFloat 0.8
|
||||||
|
SPARKGUN -> ConstFloat 0.8
|
||||||
|
TESLAGUN -> ConstFloat 0.8
|
||||||
|
LASER -> ConstFloat 0.8
|
||||||
|
TRACTORGUN -> ConstFloat 0.8
|
||||||
|
RLAUNCHER -> ConstFloat 0
|
||||||
|
RLAUNCHERX{} -> ConstFloat 0
|
||||||
|
GLAUNCHER -> ConstFloat 0
|
||||||
|
POISONSPRAYER -> ConstFloat 0.8
|
||||||
|
SHATTERGUN -> ConstFloat 0.8
|
||||||
|
TORCH -> ConstFloat 0.8
|
||||||
|
FLATSHIELD -> ConstFloat 0
|
||||||
|
KEYCARD{} -> ConstFloat 0.8
|
||||||
|
BLINKER -> ConstFloat 0.8
|
||||||
|
BLINKERUNSAFE -> ConstFloat 0.8
|
||||||
|
|
||||||
|
heldItemRifling :: HeldItemType -> GenFloat
|
||||||
|
heldItemRifling = \case
|
||||||
|
BANGSTICK{} -> ConstFloat 0.8
|
||||||
|
REWINDER -> ConstFloat 0.8
|
||||||
|
TIMESTOPPER -> ConstFloat 0.8
|
||||||
|
TIMESCROLLER -> ConstFloat 0.8
|
||||||
|
PISTOL -> ConstFloat 0.8
|
||||||
|
MACHINEPISTOL -> ConstFloat 0.8
|
||||||
|
AUTOPISTOL -> ConstFloat 0.8
|
||||||
|
SMG -> ConstFloat 0.8
|
||||||
|
BANGCONE -> UniRandFloat 0.3 0.8
|
||||||
|
BLUNDERBUSS -> UniRandFloat 0.3 0.8
|
||||||
|
GRAPECANNON{} -> UniRandFloat 0.3 0.8
|
||||||
|
MINIGUNX{} -> UniRandFloat 0.8 0.9
|
||||||
|
VOLLEYGUN{} -> ConstFloat 0.9
|
||||||
|
RIFLE -> ConstFloat 0.9
|
||||||
|
ALTERIFLE -> ConstFloat 0.9
|
||||||
|
AUTORIFLE -> ConstFloat 0.9
|
||||||
|
BURSTRIFLE -> ConstFloat 0.9
|
||||||
|
BANGROD -> ConstFloat 1
|
||||||
|
ELEPHANTGUN -> ConstFloat 1
|
||||||
|
AMR -> ConstFloat 1
|
||||||
|
AUTOAMR -> ConstFloat 1
|
||||||
|
SNIPERRIFLE -> ConstFloat 1
|
||||||
|
FLAMESPITTER -> ConstFloat 0.8
|
||||||
|
FLAMETHROWER -> ConstFloat 0.8
|
||||||
|
FLAMETORRENT -> ConstFloat 0.8
|
||||||
|
FLAMEWALL -> ConstFloat 0.8
|
||||||
|
BLOWTORCH -> ConstFloat 0.8
|
||||||
|
SPARKGUN -> ConstFloat 0.8
|
||||||
|
TESLAGUN -> ConstFloat 0.8
|
||||||
|
LASER -> ConstFloat 0.8
|
||||||
|
TRACTORGUN -> ConstFloat 0.8
|
||||||
|
RLAUNCHER -> ConstFloat 0
|
||||||
|
RLAUNCHERX{} -> ConstFloat 0
|
||||||
|
GLAUNCHER -> ConstFloat 0
|
||||||
|
POISONSPRAYER -> ConstFloat 0.8
|
||||||
|
SHATTERGUN -> ConstFloat 0.8
|
||||||
|
TORCH -> ConstFloat 0.8
|
||||||
|
FLATSHIELD -> ConstFloat 0.8
|
||||||
|
KEYCARD{} -> ConstFloat 0.8
|
||||||
|
BLINKER -> ConstFloat 0.8
|
||||||
|
BLINKERUNSAFE -> ConstFloat 0.8
|
||||||
|
|
||||||
|
|
||||||
mcUseHeld :: HeldItemType -> Item -> Machine -> World -> World
|
mcUseHeld :: HeldItemType -> Item -> Machine -> World -> World
|
||||||
mcUseHeld hit = case hit of
|
mcUseHeld hit = case hit of
|
||||||
LASER -> mcShootLaser
|
LASER -> mcShootLaser
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import Control.Applicative
|
|||||||
defaultBangCane :: Item
|
defaultBangCane :: Item
|
||||||
defaultBangCane =
|
defaultBangCane =
|
||||||
defaultBulletWeapon
|
defaultBulletWeapon
|
||||||
& itUse . heldParams . rifling .~ ConstFloat 0.9
|
|
||||||
-- & itUse . heldParams . recoil .~ 50
|
-- & itUse . heldParams . recoil .~ 50
|
||||||
& itUse . heldParams . torqueAfter .~ 0.1
|
& itUse . heldParams . torqueAfter .~ 0.1
|
||||||
& itUse . heldDelay . rateMax .~ 6
|
& itUse . heldDelay . rateMax .~ 6
|
||||||
@@ -98,7 +97,6 @@ miniGunX i =
|
|||||||
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
|
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
|
||||||
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
||||||
& itUse . heldParams . randomOffset .~ 10
|
& itUse . heldParams . randomOffset .~ 10
|
||||||
& itUse . heldParams . rifling .~ UniRandFloat 0.8 0.9
|
|
||||||
& itType .~ HELD (MINIGUNX i)
|
& itType .~ HELD (MINIGUNX i)
|
||||||
& itEffect . ieInv .~ ItemReduceWarmTime
|
& itEffect . ieInv .~ ItemReduceWarmTime
|
||||||
& itEffect . ieOnDrop .~ ItemSetWarmTime 0
|
& itEffect . ieOnDrop .~ ItemSetWarmTime 0
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ bangCone =
|
|||||||
15
|
15
|
||||||
(Muzzle (V2 15 0) 0 0.5 0 NoFlare MuzzleShootBullet (UseExactly 1) 0)
|
(Muzzle (V2 15 0) 0 0.5 0 NoFlare MuzzleShootBullet (UseExactly 1) 0)
|
||||||
& itUse . heldMuzzles . ix 0 . mzFlareType .~ BasicFlare
|
& itUse . heldMuzzles . ix 0 . mzFlareType .~ BasicFlare
|
||||||
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
|
|
||||||
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
|
|
||||||
& itUse . heldParams . torqueAfter .~ 0.1
|
& itUse . heldParams . torqueAfter .~ 0.1
|
||||||
& itUse . heldParams . randomOffset .~ 12
|
& itUse . heldParams . randomOffset .~ 12
|
||||||
& itType .~ HELD BANGCONE
|
& itType .~ HELD BANGCONE
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ rLauncher =
|
|||||||
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
|
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
|
||||||
& itAmmoSlots .~ singleAmmo LauncherAmmo
|
& itAmmoSlots .~ singleAmmo LauncherAmmo
|
||||||
& itType .~ HELD RLAUNCHER
|
& itType .~ HELD RLAUNCHER
|
||||||
& itUse . heldParams . muzVel .~ ConstFloat 0
|
|
||||||
& itUse . heldParams . rifling .~ ConstFloat 0
|
|
||||||
-- & itUse . heldParams . recoil .~ 0
|
|
||||||
& itUse . heldParams . torqueAfter .~ 0
|
& itUse . heldParams . torqueAfter .~ 0
|
||||||
|
|
||||||
-- & itUse . heldParams . bulGunSound ?~ (tap4S, 0)
|
-- & itUse . heldParams . bulGunSound ?~ (tap4S, 0)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import LensHelp
|
|||||||
bangRod :: Item
|
bangRod :: Item
|
||||||
bangRod =
|
bangRod =
|
||||||
defaultBulletWeapon
|
defaultBulletWeapon
|
||||||
& itUse . heldParams . rifling .~ ConstFloat 1
|
|
||||||
-- & itUse . heldParams . recoil .~ 50
|
-- & itUse . heldParams . recoil .~ 50
|
||||||
& itUse . heldParams . torqueAfter .~ 0.3
|
& itUse . heldParams . torqueAfter .~ 0.3
|
||||||
-- & itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
|
-- & itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
|
||||||
|
|||||||
@@ -47,10 +47,7 @@ pistol =
|
|||||||
& itUse . heldMuzzles . ix 0 . mzInaccuracy %~ const 0.05
|
& itUse . heldMuzzles . ix 0 . mzInaccuracy %~ const 0.05
|
||||||
& itUse . heldMuzzles . ix 0 . mzFlareType %~ const BasicFlare
|
& itUse . heldMuzzles . ix 0 . mzFlareType %~ const BasicFlare
|
||||||
& itUse . heldParams
|
& itUse . heldParams
|
||||||
%~ ( (muzVel .~ ConstFloat 0.8)
|
%~ ( (torqueAfter .~ 0.2)
|
||||||
. (rifling .~ ConstFloat 0.8)
|
|
||||||
-- . (recoil .~ 10)
|
|
||||||
. (torqueAfter .~ 0.2)
|
|
||||||
. (sidePush .~ 50)
|
. (sidePush .~ 50)
|
||||||
)
|
)
|
||||||
& itType .~ HELD PISTOL
|
& itType .~ HELD PISTOL
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ import LensHelp
|
|||||||
import MaybeHelp
|
import MaybeHelp
|
||||||
import Padding
|
import Padding
|
||||||
import Preload.Update
|
import Preload.Update
|
||||||
import qualified SDL as SDL
|
import qualified SDL
|
||||||
import System.Clipboard
|
import System.Clipboard
|
||||||
import Text.Read
|
import Text.Read
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user