Commit to check password
This commit is contained in:
+26
-29
@@ -643,16 +643,13 @@ retireRemoteBomb itid t pjid w = setScope w
|
|||||||
|
|
||||||
moveRemoteBomb :: Int -> Int -> Int -> World -> World
|
moveRemoteBomb :: Int -> Int -> Int -> World -> World
|
||||||
moveRemoteBomb itid time pID w
|
moveRemoteBomb itid time pID w
|
||||||
| time < -4 = setScope
|
| time < -4 = updatePicture
|
||||||
$ updatePicture
|
|
||||||
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID)
|
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID)
|
||||||
w
|
w
|
||||||
| time < 2
|
| time < 2 = case hitWl of
|
||||||
= case hitWl of
|
|
||||||
Just _ -> soundOnce (fromIntegral tapQuiet) $ halfV updatedWorld
|
Just _ -> soundOnce (fromIntegral tapQuiet) $ halfV updatedWorld
|
||||||
_ -> halfV updatedWorld
|
_ -> halfV updatedWorld
|
||||||
| otherwise
|
| otherwise = case hitWl of
|
||||||
= case hitWl of
|
|
||||||
Just _ -> soundOnce (fromIntegral tapQuiet) updatedWorld
|
Just _ -> soundOnce (fromIntegral tapQuiet) updatedWorld
|
||||||
_ -> updatedWorld
|
_ -> updatedWorld
|
||||||
where
|
where
|
||||||
@@ -660,15 +657,7 @@ moveRemoteBomb itid time pID w
|
|||||||
= updateV $ set (projectiles . ix pID . pjPos) finalPos
|
= updateV $ set (projectiles . ix pID . pjPos) finalPos
|
||||||
$ updatePicture
|
$ updatePicture
|
||||||
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (time-1) pID)
|
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (time-1) pID)
|
||||||
$ setScope
|
|
||||||
w
|
w
|
||||||
setScope w' = case _itemPositions w' IM.! itid of
|
|
||||||
InInv cid invid
|
|
||||||
-> w' & creatures . ix cid . crInv . ix invid . itAttachment
|
|
||||||
. _Just . scopePos .~ (newPos -.- _crPos (_creatures w' IM.! cid))
|
|
||||||
& creatures . ix cid . crInv . ix invid . itZoom
|
|
||||||
.~ (defaultItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5})
|
|
||||||
_ -> w'
|
|
||||||
pj = _projectiles w IM.! pID
|
pj = _projectiles w IM.! pID
|
||||||
oldPos = _pjPos pj
|
oldPos = _pjPos pj
|
||||||
newPos = _pjVel pj +.+ oldPos
|
newPos = _pjVel pj +.+ oldPos
|
||||||
@@ -691,6 +680,22 @@ moveRemoteBomb itid time pID w
|
|||||||
(50 *.* unitVectorAtAngle (negate $ degToRad (10 * fromIntegral time)))
|
(50 *.* unitVectorAtAngle (negate $ degToRad (10 * fromIntegral time)))
|
||||||
[-0.2,-0.15,-0.1,-0.05,0,0.05,0.1,0.15,0.2]
|
[-0.2,-0.15,-0.1,-0.05,0,0.05,0.1,0.15,0.2]
|
||||||
|
|
||||||
|
setRemoteScope :: Int -> Projectile -> World -> World
|
||||||
|
setRemoteScope itid pj w' = case w' ^? itemPositions . ix itid of
|
||||||
|
Just (InInv cid' invid )
|
||||||
|
-> w' & creatures . ix cid' . crInv . ix invid . itAttachment
|
||||||
|
. _Just . scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid'))
|
||||||
|
_ -> w'
|
||||||
|
|
||||||
|
setRemoteBombScope :: Int -> Projectile -> World -> World
|
||||||
|
setRemoteBombScope itid pj w' = case _itemPositions w' IM.! itid of
|
||||||
|
InInv cid invid
|
||||||
|
-> w' & creatures . ix cid . crInv . ix invid . itAttachment
|
||||||
|
. _Just . scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid))
|
||||||
|
& creatures . ix cid . crInv . ix invid . itZoom
|
||||||
|
.~ (defaultItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5})
|
||||||
|
_ -> w'
|
||||||
|
|
||||||
grenade :: Item
|
grenade :: Item
|
||||||
grenade = Throwable
|
grenade = Throwable
|
||||||
{ _itName = "GRENADE " ++ show fuseTime
|
{ _itName = "GRENADE " ++ show fuseTime
|
||||||
@@ -771,7 +776,7 @@ fireRemoteLauncher cr w = setLocation
|
|||||||
, _pjVel = rotateV dir (1,0)
|
, _pjVel = rotateV dir (1,0)
|
||||||
, _pjDraw = remoteShellPic'
|
, _pjDraw = remoteShellPic'
|
||||||
, _pjID = i
|
, _pjID = i
|
||||||
, _pjUpdate = \pj -> decTimMvVel pj . moveRemoteShell cid itid pj
|
, _pjUpdate = \pj -> decTimMvVel pj . setRemoteScope itid pj . moveRemoteShell cid itid pj
|
||||||
, _pjAcc = (0,0)
|
, _pjAcc = (0,0)
|
||||||
, _pjDir = dir
|
, _pjDir = dir
|
||||||
, _pjSpin = 0
|
, _pjSpin = 0
|
||||||
@@ -795,10 +800,10 @@ moveRemoteShell :: Int -> Int -> Projectile -> World -> World
|
|||||||
moveRemoteShell cid itid pj w
|
moveRemoteShell cid itid pj w
|
||||||
| time > 40 = if circOnSomeWall oldPos 4 w
|
| time > 40 = if circOnSomeWall oldPos 4 w
|
||||||
then doExplosion w
|
then doExplosion w
|
||||||
else w & setScope
|
else w
|
||||||
| time >= 20 = case thingHit of
|
| time >= 20 = case thingHit of
|
||||||
Just _ -> doExplosion w
|
Just _ -> doExplosion w
|
||||||
Nothing -> setScope w & projectiles . ix i . pjDir .~ newdir
|
Nothing -> w & projectiles . ix i . pjDir .~ newdir
|
||||||
| time > -99 = case thingHit of
|
| time > -99 = case thingHit of
|
||||||
Just _ -> doExplosion $ stopSoundFrom (ShellSound i) w
|
Just _ -> doExplosion $ stopSoundFrom (ShellSound i) w
|
||||||
Nothing -> w & set randGen g
|
Nothing -> w & set randGen g
|
||||||
@@ -809,10 +814,9 @@ moveRemoteShell cid itid pj w
|
|||||||
& soundFromPos (ShellSound i) newPos (fromIntegral smokeTrailSound) 1 250
|
& soundFromPos (ShellSound i) newPos (fromIntegral smokeTrailSound) 1 250
|
||||||
& smokeGen
|
& smokeGen
|
||||||
& makeFlameletTimed oldPos (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10
|
& makeFlameletTimed oldPos (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10
|
||||||
& setScope
|
|
||||||
| time > -200 = case thingHit of
|
| time > -200 = case thingHit of
|
||||||
Just _ -> doExplosion $ stopSoundFrom (ShellSound i) w
|
Just _ -> doExplosion $ stopSoundFrom (ShellSound i) w
|
||||||
Nothing -> setScope w
|
Nothing -> w
|
||||||
| otherwise = doExplosion $ stopSoundFrom (ShellSound i) w
|
| otherwise = doExplosion $ stopSoundFrom (ShellSound i) w
|
||||||
where
|
where
|
||||||
time = _pjTimer pj
|
time = _pjTimer pj
|
||||||
@@ -821,26 +825,19 @@ moveRemoteShell cid itid pj w
|
|||||||
vel = _pjVel pj
|
vel = _pjVel pj
|
||||||
newPos = oldPos +.+ vel
|
newPos = oldPos +.+ vel
|
||||||
newdir
|
newdir
|
||||||
| SDL.ButtonRight `S.member` _mouseButtons w
|
| SDL.ButtonRight `S.member` _mouseButtons w
|
||||||
&& w ^? creatures . ix cid . crInvSel == w ^? itemPositions . ix itid . itInvId
|
&& w ^? creatures . ix cid . crInvSel == w ^? itemPositions . ix itid . itInvId
|
||||||
= _cameraRot w + argV (_mousePos w)
|
= _cameraRot w + argV (_mousePos w)
|
||||||
| otherwise = dir
|
| otherwise = _pjDir pj
|
||||||
accel = rotateV newdir (2,0)
|
accel = rotateV newdir (2,0)
|
||||||
(frict,g) = randomR (0.6,0.9) $ _randGen w
|
(frict,g) = randomR (0.6,0.9) $ _randGen w
|
||||||
(sparkD,_) = randomR (-0.5,0.5) $ _randGen w
|
(sparkD,_) = randomR (-0.5,0.5) $ _randGen w
|
||||||
dir = argV vel
|
|
||||||
hitCr = fst <$> collideCircCrsPoint oldPos newPos 4 w
|
hitCr = fst <$> collideCircCrsPoint oldPos newPos 4 w
|
||||||
hitWl = fst <$> collideCircWalls' oldPos newPos 2 (wallsNearPoint newPos w)
|
hitWl = fst <$> collideCircWalls' oldPos newPos 2 (wallsNearPoint newPos w)
|
||||||
thingHit = hitCr <|> hitWl
|
thingHit = hitCr <|> hitWl
|
||||||
|
|
||||||
r1 = _randGen w & evalState (randInCirc 10)
|
r1 = _randGen w & evalState (randInCirc 10)
|
||||||
smokeGen = makeSmokeCloudAt $ oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)
|
smokeGen = makeSmokeCloudAt $ oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)
|
||||||
doExplosion = explodeRemoteRocket itid i
|
doExplosion = explodeRemoteRocket itid i
|
||||||
setScope w' = case _itemPositions w' IM.! itid of
|
|
||||||
InInv cid' invid
|
|
||||||
-> w' & creatures . ix cid' . crInv . ix invid . itAttachment
|
|
||||||
. _Just . scopePos .~ (newPos -.- _crPos (_creatures w' IM.! cid'))
|
|
||||||
_ -> w'
|
|
||||||
|
|
||||||
explodeRemoteRocket
|
explodeRemoteRocket
|
||||||
:: Int -- ^ Item id
|
:: Int -- ^ Item id
|
||||||
|
|||||||
Reference in New Issue
Block a user