More strictifiiiying
This commit is contained in:
@@ -56,7 +56,7 @@ singleFireMode = hammerCheck $ shootWithSound (fromIntegral autoGunSound) autoGu
|
||||
autoGunNonTwistEff = withRecoil 40
|
||||
. withRandomDir (autogunSpread/2)
|
||||
. withMuzFlare
|
||||
. withVelWthHiteff (50,0) 3
|
||||
. withVelWthHiteff (V2 50 0) 3
|
||||
$ destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
|
||||
autoGunPic :: Picture
|
||||
|
||||
@@ -59,7 +59,7 @@ shootBezier targetp cr w = w & particles %~ (theBullet :)
|
||||
controlp = mouseWorldPos w
|
||||
cid = _crID cr
|
||||
dir = _crDir cr
|
||||
startp = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
|
||||
startp = _crPos cr +.+ rotateV dir (V2 (_crRad cr + 1) (0))
|
||||
(randPos,randPos') = flip evalState (_randGen w) $ do
|
||||
a <- randInCirc 10
|
||||
b <- randInCirc 20
|
||||
|
||||
@@ -3,17 +3,19 @@ module Dodge.Item.Weapon.Bullet
|
||||
import Dodge.Data
|
||||
import Dodge.WorldEvent.HitEffect
|
||||
import Dodge.Particle.Bullet.HitEffect
|
||||
|
||||
import Geometry.Data
|
||||
basicBullet :: Ammo
|
||||
basicBullet = BulletAmmo
|
||||
{ _amString = "BULLET"
|
||||
, _amBulEff = destroyOnImpact bulHitCr bulHitWall' bulHitFF'
|
||||
, _amBulWth = 2
|
||||
, _amBulVel = (30,0)
|
||||
, _amBulVel = (V2 30 0)
|
||||
}
|
||||
hvBullet :: Ammo
|
||||
hvBullet = BulletAmmo
|
||||
{ _amString = "HVBULLET"
|
||||
, _amBulEff = penWalls hvBulHitCr hvBulHitWall' bulHitFF'
|
||||
, _amBulWth = 6
|
||||
, _amBulVel = (80,0)
|
||||
, _amBulVel = (V2 80 0)
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import Dodge.Picture.Layer
|
||||
import Dodge.Creature.Test
|
||||
import Picture
|
||||
import Geometry.Vector
|
||||
import Geometry.Data
|
||||
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
@@ -123,11 +124,11 @@ targetRBMousePos w = (f, \_ _ _ w' -> cursorPic w')
|
||||
where
|
||||
f _ = Just mwp
|
||||
mwp = mouseWorldPos w
|
||||
cursorPic w' = setLayer 1 $ onLayer InvLayer $ uncurry translate mwp
|
||||
cursorPic w' = setLayer 1 $ onLayer InvLayer $ uncurryV translate mwp
|
||||
$ rotate (_cameraRot w')
|
||||
$ pictures
|
||||
[line [( x,x), (-x,-x)]
|
||||
,line [(-x,x), ( x,-x)]
|
||||
[line [( V2 (x) (x)), (V2 (-x) (-x))]
|
||||
,line [(V2 (-x) (x)), (V2 ( x) (-x))]
|
||||
]
|
||||
where
|
||||
x = 5 / _cameraZoom w'
|
||||
|
||||
@@ -134,8 +134,8 @@ aRocketWithItemParams it cr w = over projectiles (IM.insert i theShell) w
|
||||
theShell = defaultShell
|
||||
{ _pjPos = pos
|
||||
, _pjStartPos = pos
|
||||
, _pjVel = rotateV dir (1,0)
|
||||
, _pjAcc = rotateV dir (3,0)
|
||||
, _pjVel = rotateV dir (V2 1 0)
|
||||
, _pjAcc = rotateV dir (V2 3 0)
|
||||
, _pjDraw = _amPjDraw am
|
||||
, _pjID = i
|
||||
, _pjUpdate = \pj -> ammoMvs pj . decTimMvVel pj . moveShell pj
|
||||
@@ -173,9 +173,9 @@ reduceSpinBy :: Float -> Projectile -> World -> World
|
||||
reduceSpinBy x pj = projectiles . ix (_pjID pj) . pjSpin *~ x
|
||||
|
||||
shellPic :: Projectile -> Picture
|
||||
shellPic pj = setDepth 20 . uncurry translate pos $ rotate (argV accel) basePic
|
||||
shellPic pj = setDepth 20 . uncurryV translate pos $ rotate (argV accel) basePic
|
||||
where
|
||||
basePic = color black $ polygon [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
basePic = color black $ polygon $ map toV2 [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
accel = _pjAcc pj
|
||||
pos = _pjPos pj
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ withRecoil
|
||||
withRecoil recoilAmount eff cr = eff cr . over (creatures . ix cid) pushback
|
||||
where
|
||||
cid = _crID cr
|
||||
pushback = over crPos (+.+ rotateV (_crDir cr) ((-recoilAmount) / _crMass cr ,0))
|
||||
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((-recoilAmount) / _crMass cr ) (0)))
|
||||
{- | Pushes a creature sideways by a random amount.
|
||||
Applied before the underlying effect. -}
|
||||
withSidePush
|
||||
@@ -140,8 +140,9 @@ withSidePush
|
||||
withSidePush maxSide eff cr w = eff cr . over (creatures . ix cid) push $ w
|
||||
where
|
||||
cid = _crID cr
|
||||
push = over crPos (+.+ rotateV (_crDir cr) (0,pushAmount / _crMass cr))
|
||||
push = over crPos (+.+ rotateV (_crDir cr) (V2 (0) (pushAmount / _crMass cr)))
|
||||
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
|
||||
-- consider unifying the pushes using a direction vector
|
||||
{- | Pushes a creature sideways by a random amount.
|
||||
Applied after the underlying effect. -}
|
||||
withSidePushAfter
|
||||
@@ -153,7 +154,7 @@ withSidePushAfter
|
||||
withSidePushAfter maxSide eff cr w = over (creatures . ix cid) push . eff cr $ w
|
||||
where
|
||||
cid = _crID cr
|
||||
push = over crPos (+.+ rotateV (_crDir cr) (0,pushAmount / _crMass cr))
|
||||
push = over crPos (+.+ rotateV (_crDir cr) (V2 (0) (pushAmount / _crMass cr)))
|
||||
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
|
||||
{- | Applies a world effect and sound effect after an ammo check. -}
|
||||
shootWithSound
|
||||
@@ -369,7 +370,7 @@ withRandomOffset
|
||||
withRandomOffset offsetAmount f cr w = f (cr & crPos %~ (+.+ offV)) $ set randGen g w
|
||||
where
|
||||
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
|
||||
offV = rotateV (_crDir cr) (0,offsetVal)
|
||||
offV = rotateV (_crDir cr) (V2 0 offsetVal)
|
||||
-- | Rotates a creature with minimum rotation at least 0.1.
|
||||
-- Rotates the player creature before applying the effect, other creatures after.
|
||||
torqueBeforeForced
|
||||
@@ -461,7 +462,7 @@ numVelWthHitEff num vel wth eff cr = over particles (newbuls ++)
|
||||
d = _crDir cr
|
||||
poss = map (+.+ pos) $ take num offsets
|
||||
maxOffset = fromIntegral num * 2.5 - 2.5
|
||||
offsets = map (\y -> rotateV d (0,y)) [-maxOffset,5-maxOffset..]
|
||||
offsets = map (\y -> rotateV d (V2 0 y)) [-maxOffset,5-maxOffset..]
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle d
|
||||
{- | Uses '_wpSpread' as a parameter for the current offset angle. -}
|
||||
randWalkAngle
|
||||
|
||||
@@ -42,7 +42,7 @@ mvBlip p col maxt t w pt =
|
||||
& ptDraw .~ ( const
|
||||
. setDepth (-0.5)
|
||||
. setLayer 1
|
||||
. uncurry translate p
|
||||
. uncurryV translate p
|
||||
. color (withAlpha (fromIntegral t / fromIntegral maxt) col)
|
||||
$ circleSolid 2 )
|
||||
)
|
||||
@@ -64,7 +64,7 @@ mvSonar x p w pt = (w, Just $ pt {_ptDraw = const pic
|
||||
crBlips = mapMaybe crBlip $ IM.elems $ _creatures w
|
||||
crBlip cr | dist cpos p < r + crad && dist cpos p > r - (crad + 100)
|
||||
= Just $ colHelper (0.5 * (1 - (r - dist cpos p) /100))
|
||||
$ uncurry translate cpos $ circleSolid crad
|
||||
$ uncurryV translate cpos $ circleSolid crad
|
||||
| otherwise = Nothing
|
||||
where crad = _crRad cr
|
||||
cpos = _crPos cr
|
||||
|
||||
Reference in New Issue
Block a user