Make laser fire above corpses
This commit is contained in:
@@ -5,6 +5,7 @@ module Dodge.Item.Weapon.LaserPath (
|
|||||||
reflectPulseLaserAlong,
|
reflectPulseLaserAlong,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import ListHelp
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.Tuple
|
import Data.Tuple
|
||||||
import Dodge.Base.Wall
|
import Dodge.Base.Wall
|
||||||
@@ -19,7 +20,7 @@ import Linear
|
|||||||
reflectLaserAlong ::
|
reflectLaserAlong ::
|
||||||
Float -> Point2 -> Point2 -> World -> (Maybe (Point2, Either Creature Wall), [Point2])
|
Float -> Point2 -> Point2 -> World -> (Maybe (Point2, Either Creature Wall), [Point2])
|
||||||
{-# INLINE reflectLaserAlong #-}
|
{-# INLINE reflectLaserAlong #-}
|
||||||
reflectLaserAlong phasev sp ep w = case thingHitFilt (const True) _wlUnshadowed sp ep w of
|
reflectLaserAlong phasev sp ep w = case safeHead $ filter g $ thingsHitZ 20 sp ep w of
|
||||||
Just (p, Right wl)
|
Just (p, Right wl)
|
||||||
| Metal <- wl ^. wlMaterial ->
|
| Metal <- wl ^. wlMaterial ->
|
||||||
f
|
f
|
||||||
@@ -32,6 +33,8 @@ reflectLaserAlong phasev sp ep w = case thingHitFilt (const True) _wlUnshadowed
|
|||||||
Nothing -> (Nothing, [ep])
|
Nothing -> (Nothing, [ep])
|
||||||
where
|
where
|
||||||
f p a b = reflectLaserAlong phasev a b w & _2 .:~ p
|
f p a b = reflectLaserAlong phasev a b w & _2 .:~ p
|
||||||
|
g (_,Right wl) = wl ^. wlUnshadowed
|
||||||
|
g _ = True
|
||||||
|
|
||||||
refract :: Float -> Point2 -> Point2 -> Wall -> Point2 -> Point2
|
refract :: Float -> Point2 -> Point2 -> Wall -> Point2 -> Point2
|
||||||
{-# INLINE refract #-}
|
{-# INLINE refract #-}
|
||||||
|
|||||||
@@ -359,7 +359,6 @@ doDrawing' win pdata u = do
|
|||||||
glDrawArrays GL_TRIANGLES 0 6
|
glDrawArrays GL_TRIANGLES 0 6
|
||||||
rs' -> do
|
rs' -> do
|
||||||
let rs = take 15 rs'
|
let rs = take 15 rs'
|
||||||
--glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fbo2 . _1 . unFBO)
|
|
||||||
glBindFramebuffer GL_FRAMEBUFFER 0
|
glBindFramebuffer GL_FRAMEBUFFER 0
|
||||||
withArray (concatMap rdToVec2s rs) $
|
withArray (concatMap rdToVec2s rs) $
|
||||||
glNamedBufferSubData (pdata ^. barrelShader . _2 . vboName) 0
|
glNamedBufferSubData (pdata ^. barrelShader . _2 . vboName) 0
|
||||||
@@ -368,20 +367,14 @@ doDrawing' win pdata u = do
|
|||||||
glUseProgram (pdata ^. barrelShader . _1)
|
glUseProgram (pdata ^. barrelShader . _1)
|
||||||
glUniform1i 0 (fromIntegral (length rs))
|
glUniform1i 0 (fromIntegral (length rs))
|
||||||
glDrawArrays GL_TRIANGLES 0 6
|
glDrawArrays GL_TRIANGLES 0 6
|
||||||
-- glBindTextureUnit 0 $ pdata ^. fbo2 . _2 . unTO
|
|
||||||
-- glBindFramebuffer GL_FRAMEBUFFER 0
|
|
||||||
-- glUseProgram (pdata ^. fullscreenShader)
|
|
||||||
-- glDrawArrays GL_TRIANGLES 0 6
|
|
||||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
-- draw the overlay
|
-- draw the overlay
|
||||||
--glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboOverlay ._1 . unFBO)
|
|
||||||
glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
glDepthMask GL_FALSE
|
glDepthMask GL_FALSE
|
||||||
glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
--glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
--glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
glBlendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA -- assume premultiplied alpha
|
glBlendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA -- assume premultiplied alpha
|
||||||
renderLayer DebugLayer shadV pokeCounts
|
renderLayer DebugLayer shadV pokeCounts
|
||||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. matUBO)
|
|
||||||
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig)) $
|
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig)) $
|
||||||
glNamedBufferSubData (pdata ^. matUBO) 0 64
|
glNamedBufferSubData (pdata ^. matUBO) 0 64
|
||||||
glDepthFunc GL_GEQUAL
|
glDepthFunc GL_GEQUAL
|
||||||
|
|||||||
@@ -412,8 +412,8 @@ tutorialMessage1 i =
|
|||||||
, makeTermLine " [D] TO MOVE"
|
, makeTermLine " [D] TO MOVE"
|
||||||
, makeTermLine "--------------------------------------------"
|
, makeTermLine "--------------------------------------------"
|
||||||
]
|
]
|
||||||
<> tlSetStatus (TerminalPressTo "CONTINUE")
|
-- <> tlSetStatus (TerminalPressTo "CONTINUE")
|
||||||
<> [ makeTermLine "AFTER EXITING THIS TERMINAL YOUR INVENTORY"
|
-- <> [ makeTermLine "AFTER EXITING THIS TERMINAL YOUR INVENTORY"
|
||||||
, makeTermLine " AND NEARBY OBJECTS WILL BE DISPLAYED"
|
-- , makeTermLine " AND NEARBY OBJECTS WILL BE DISPLAYED"
|
||||||
, makeTermLine "--------------------------------------------"
|
-- , makeTermLine "--------------------------------------------"
|
||||||
]
|
-- ]
|
||||||
|
|||||||
Reference in New Issue
Block a user