Remove old layer code
This commit is contained in:
@@ -42,7 +42,6 @@ import Dodge.Creature.State
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.ChooseTarget
|
||||
--import Dodge.Item
|
||||
import Dodge.Picture.Layer
|
||||
import Picture
|
||||
import Geometry.Data
|
||||
import qualified IntMapHelp as IM
|
||||
@@ -155,7 +154,7 @@ startCr = defaultCreature
|
||||
, _crHP = 1000
|
||||
, _crMaxHP = 1500
|
||||
, _crInv = startInventory
|
||||
, _crCorpse = onLayer CorpseLayer
|
||||
, _crCorpse = setDepth 5
|
||||
$ color (greyN 0.5) $ pictures [color (greyN 0.8) $ circleSolid 10, circLine 10]
|
||||
, _crFaction = PlayerFaction
|
||||
, _crMvType = MvWalking yourDefaultSpeed
|
||||
|
||||
@@ -10,7 +10,6 @@ import Dodge.Creature.ReaderUpdate
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Creature.Perception
|
||||
import Dodge.Item.Consumable
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.SoundLogic
|
||||
--import Geometry
|
||||
import Picture
|
||||
@@ -27,7 +26,7 @@ smallChaseCrit = chaseCrit
|
||||
, _crRad = 4
|
||||
, _crPict = basicCrPict green
|
||||
, _crInv = IM.fromList [(0,medkit 200)]
|
||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 4
|
||||
, _crCorpse = setDepth 5 $ color (greyN 0.5) $ circleSolid 4
|
||||
}
|
||||
chaseCrit :: Creature
|
||||
chaseCrit = defaultCreature
|
||||
|
||||
@@ -12,7 +12,6 @@ import Dodge.Creature.Lamp
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.Stance.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Particle.Spark
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.State
|
||||
@@ -32,7 +31,7 @@ barrel :: Creature
|
||||
barrel = defaultInanimate
|
||||
{ _crUpdate = updateBarrel
|
||||
, _crHP = 500
|
||||
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
|
||||
, _crPict = picAtCrPos $ setDepth 20 $ pictures
|
||||
[ color orange $ circleSolid 10
|
||||
, setDepth 0.049 . color (greyN 0.5) $ circleSolid 8
|
||||
, color (greyN 0.5) $ circleSolid 8
|
||||
|
||||
@@ -11,7 +11,6 @@ import Dodge.Creature.ReaderUpdate
|
||||
import Dodge.Creature.Perception
|
||||
--import Dodge.Creature.Impulse
|
||||
--import Dodge.Creature.State
|
||||
import Dodge.Picture.Layer
|
||||
import Picture
|
||||
|
||||
import Control.Lens
|
||||
@@ -32,7 +31,7 @@ swarmCrit = defaultCreature
|
||||
, _crRad = 2
|
||||
, _crMass = 2
|
||||
, _crPict = basicCrPict yellow
|
||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 2
|
||||
, _crCorpse = setDepth 5 $ color (greyN 0.5) $ circleSolid 2
|
||||
, _crFaction = ColorFaction yellow
|
||||
, _crMeleeCooldown = 0
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
module Dodge.Debug where
|
||||
import Dodge.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Zone
|
||||
import Dodge.Base
|
||||
import Geometry.Zone
|
||||
@@ -21,7 +20,7 @@ drawCircleAtForCol p t col w = w & props %~
|
||||
{ _pjPos = p
|
||||
, _pjStartPos = p
|
||||
, _pjVel = V2 0 0
|
||||
, _prDraw = \_ -> (,) mempty $ onLayer PtLayer $ uncurryV translate p $ color col $ circleSolid 20
|
||||
, _prDraw = \_ -> (,) mempty $ setDepth 20 $ uncurryV translate p $ color col $ circleSolid 20
|
||||
, _pjID = k
|
||||
, _pjUpdate = \_ -> pjTimerF t k
|
||||
}
|
||||
@@ -34,7 +33,7 @@ drawLineForCol ps t col w = w & props %~
|
||||
{ _pjPos = head ps
|
||||
, _pjStartPos = head ps
|
||||
, _pjVel = V2 0 0
|
||||
, _prDraw = \_ -> (,) mempty $ onLayer PtLayer $ color col $ thickLine 5 ps
|
||||
, _prDraw = \_ -> (,) mempty $ setDepth 20 $ color col $ thickLine 5 ps
|
||||
, _pjID = k
|
||||
, _pjUpdate = \_ -> pjTimerF t k
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import Dodge.Data
|
||||
import Dodge.RoomLink
|
||||
--import Dodge.Base
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Picture
|
||||
import qualified IntMapHelp as IM
|
||||
import Geometry.Data
|
||||
@@ -26,11 +25,11 @@ roomLinkDecorations :: Room -> Picture
|
||||
roomLinkDecorations rm = pictures . map (linkDecoration . lnkPosDir) $ _rmLinks rm
|
||||
|
||||
linkDecoration :: (Point2,Float) -> Picture
|
||||
linkDecoration (p,a) = setLayer 1 . onLayer DebugLayer . color red $ line [p, p +.+ 20 *.* unitVectorAtAngle (a - pi/2)]
|
||||
linkDecoration (p,a) = setLayer 1 . setDepth 50 . color red $ line [p, p +.+ 20 *.* unitVectorAtAngle (a - pi/2)]
|
||||
|
||||
roomPolyDecorations :: Room -> Picture
|
||||
roomPolyDecorations rm = pictures . map polyWireFrame $ _rmPolys rm
|
||||
|
||||
polyWireFrame :: [Point2] -> Picture
|
||||
polyWireFrame (x:xs) = setLayer 1 . onLayer DebugLayer . color green $ line $ (x:xs) ++ [x]
|
||||
polyWireFrame (x:xs) = setLayer 1 . setDepth 50 . color green $ line $ (x:xs) ++ [x]
|
||||
polyWireFrame _ = undefined
|
||||
|
||||
@@ -44,7 +44,7 @@ defaultCreature = Creature
|
||||
, _crInvEquipped = mempty
|
||||
, _crLeftInvSel = Nothing
|
||||
, _crState = defaultState
|
||||
, _crCorpse = setLayer 0 $ onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 10
|
||||
, _crCorpse = setLayer 0 $ setDepth 5 $ color (greyN 0.5) $ circleSolid 10
|
||||
, _crApplyDamage = defaultApplyDamage
|
||||
, _crStance = Stance
|
||||
{_carriage=Walking 0 WasLeftForward
|
||||
@@ -245,7 +245,7 @@ defaultPT = Projectile
|
||||
}
|
||||
defaultPP :: PressPlate
|
||||
defaultPP = PressPlate
|
||||
{ _ppPict = onLayer PressPlateLayer . color (dim . dim $ bright blue) $ circleSolid 5
|
||||
{ _ppPict = setDepth 1 . color (dim . dim $ bright blue) $ circleSolid 5
|
||||
, _ppPos = V2 0 0
|
||||
, _ppRot = 0
|
||||
, _ppEvent = const id
|
||||
|
||||
@@ -43,7 +43,7 @@ flameShield :: Item
|
||||
flameShield = defaultEquipment
|
||||
{ _itType = FLAMESHIELD
|
||||
, _itName = "FLAMESHIELD"
|
||||
, _itEquipPict = \cr _ -> (,) emptySH $ onLayer CrLayer $ pictures [color cyan $ circle (_crRad cr+2)]
|
||||
, _itEquipPict = \cr _ -> (,) emptySH $ setDepth 20 $ pictures [color cyan $ circle (_crRad cr+2)]
|
||||
, _itID = Nothing
|
||||
}
|
||||
{- | Slows you down, blocks forward projectiles. -}
|
||||
@@ -55,7 +55,7 @@ frontArmour = defaultEquipment
|
||||
-- [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
-- ,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
-- ]
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ onLayer CrLayer $ pictures
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ setDepth 20 $ pictures
|
||||
[color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
]
|
||||
@@ -166,7 +166,7 @@ jetPack :: Item
|
||||
jetPack = defaultEquipment
|
||||
{ _itType = JETPACK
|
||||
, _itName = "JETPACK"
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ onLayer CrLayer
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ setDepth 20
|
||||
$ pictures [color yellow $ polygon $ rectNSEW 5 (-5) (-3) (-11) ]
|
||||
, _itEffect = NoItEffect
|
||||
, _itID = Nothing
|
||||
|
||||
@@ -81,7 +81,7 @@ updateLinearShockwave pj w
|
||||
t = _pjTimer pj
|
||||
|
||||
drawBoostShockwave :: Prop -> SPic
|
||||
drawBoostShockwave pj = (,) mempty $ setLayer 1 $ onLayer UPtLayer $ pictures $
|
||||
drawBoostShockwave pj = (,) mempty $ setLayer 1 $ setDepth 20 $ pictures $
|
||||
theArc ++
|
||||
[ lineCol $ zip (reverse lps) $ map (`withAlpha` white) [0,0.05..]
|
||||
, lineCol $ zip (reverse rps) $ map (`withAlpha` white) [0,0.05..]
|
||||
|
||||
@@ -5,7 +5,6 @@ module Dodge.Item.Weapon.Decoration
|
||||
( makeLaserScope
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Geometry.Data
|
||||
import Picture
|
||||
|
||||
@@ -16,7 +15,7 @@ makeLaserScope
|
||||
-> Float -- ^ Fraction of red/green
|
||||
-> Particle
|
||||
makeLaserScope p ep relFrac = Particle
|
||||
{_ptDraw = const $ setLayer 1 $ onLayer PtLayer $ pictures
|
||||
{_ptDraw = const $ setLayer 1 $ setDepth 20 $ pictures
|
||||
[lineAlphaThick 0.5 0.5
|
||||
,lineAlphaThick 0.2 1.5
|
||||
,lineAlphaThick 0.1 2
|
||||
|
||||
@@ -18,7 +18,6 @@ import Dodge.Base
|
||||
import Dodge.Item.Weapon.UseEffect
|
||||
import Dodge.Item.Weapon.LaserPath
|
||||
--import Dodge.Item.Attachment.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.WorldEvent.HelperParticle
|
||||
import Picture
|
||||
@@ -76,7 +75,7 @@ targetCursor = defaultTargeting
|
||||
targetSimpleDraw :: Int -> Item -> Creature -> World -> Picture
|
||||
targetSimpleDraw _ it _ w = fromMaybe mempty $ do
|
||||
mwp <- it ^? itTargeting . tgPos . _Just
|
||||
return $ setLayer 5 $ color red $ onLayer InvLayer $ uncurryV translate mwp
|
||||
return $ setLayer 4 $ color red $ setDepth 50 $ uncurryV translate mwp
|
||||
$ rotate (_cameraRot w)
|
||||
$ pictures
|
||||
[line [V2 x x, V2 (-x) (-x)]
|
||||
@@ -88,7 +87,7 @@ targetSimpleDraw _ it _ w = fromMaybe mempty $ do
|
||||
targetRBCreatureDraw :: Int -> Item -> Creature -> World -> Picture
|
||||
targetRBCreatureDraw _ it _ w = fromMaybe mempty $ do
|
||||
mwp <- it ^? itTargeting . tgPos . _Just
|
||||
return $ setLayer 5 $ color thecolor $ onLayer InvLayer $ uncurryV translate mwp
|
||||
return $ setLayer 5 $ color thecolor $ setDepth 50 $ uncurryV translate mwp
|
||||
$ rotate (_cameraRot w)
|
||||
$ pictures
|
||||
[line [V2 x x, V2 (-x) (-x)]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module Dodge.Item.Weapon.Grenade where
|
||||
import Dodge.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.WorldEvent.Explosion
|
||||
--import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Item.Weapon.Remote
|
||||
@@ -193,7 +192,7 @@ moveRemoteBomb itid time pID w
|
||||
| otherwise = x - 1
|
||||
updatePicture =
|
||||
set (props . ix pID . prDraw)
|
||||
(\_ -> (,) mempty $ onLayer PtLayer $ uncurryV translate newPos $ remoteBombPic time)
|
||||
(\_ -> (,) mempty $ setDepth 20 $ uncurryV translate newPos $ remoteBombPic time)
|
||||
|
||||
|
||||
|
||||
|
||||
+22
-22
@@ -1,35 +1,35 @@
|
||||
{- |
|
||||
Uniform management of layers and depths on which pictures are drawn. -}
|
||||
module Dodge.Picture.Layer
|
||||
( onLayer
|
||||
, onLayerL
|
||||
, levLayer
|
||||
, Layer (..)
|
||||
( --onLayer
|
||||
onLayerL
|
||||
-- , levLayer
|
||||
-- , Layer (..)
|
||||
) where
|
||||
import Dodge.Picture.Layer.Data
|
||||
import Picture
|
||||
{- | Uses a layer to set the depth. -}
|
||||
onLayer :: Layer -> Picture -> Picture
|
||||
onLayer l = setDepth $ (1 - fromIntegral (levLayer l) / 100) / 1000
|
||||
--onLayer :: Layer -> Picture -> Picture
|
||||
--onLayer l = setDepth $ (1 - fromIntegral (levLayer l) / 100) / 1000
|
||||
{- | Set a depth according to a list of numbers.
|
||||
Lists are lexicographically ordered if input values are always less than 100.
|
||||
Higher numbers will get placed on top of lower numbers. -}
|
||||
onLayerL :: [Int] -> Picture -> Picture
|
||||
onLayerL is = setDepth $ (1 - sum (zipWith (/) (map fromIntegral is) $ map (100 **) [1..])) / 1000
|
||||
{- | For depth testing, set layer values. -}
|
||||
levLayer :: Layer -> Int
|
||||
levLayer BgLayer = 20
|
||||
levLayer PressPlateLayer = 45
|
||||
levLayer CorpseLayer = 50
|
||||
levLayer FlItLayer = 55
|
||||
levLayer CrLayer = 60
|
||||
levLayer WlLayer = 74
|
||||
levLayer GloomLayer = 67
|
||||
levLayer UPtLayer = 70
|
||||
levLayer PtLayer = 72
|
||||
levLayer HPtLayer = 73
|
||||
levLayer ShadowLayer = 75
|
||||
levLayer LabelLayer = 80
|
||||
levLayer InvLayer = 85
|
||||
levLayer MenuDepth = 90
|
||||
levLayer DebugLayer = 99
|
||||
--levLayer :: Layer -> Int
|
||||
--levLayer BgLayer = 20
|
||||
--levLayer PressPlateLayer = 45
|
||||
--levLayer CorpseLayer = 50
|
||||
--levLayer FlItLayer = 55
|
||||
--levLayer CrLayer = 60
|
||||
--levLayer WlLayer = 74
|
||||
--levLayer GloomLayer = 67
|
||||
--levLayer UPtLayer = 70
|
||||
--levLayer PtLayer = 72
|
||||
--levLayer HPtLayer = 73
|
||||
--levLayer ShadowLayer = 75
|
||||
--levLayer LabelLayer = 80
|
||||
--levLayer InvLayer = 85
|
||||
--levLayer MenuDepth = 90
|
||||
--levLayer DebugLayer = 99
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module Dodge.Picture.Layer.Data
|
||||
where
|
||||
|
||||
data Layer
|
||||
data Layer''
|
||||
= PtLayer
|
||||
| CrLayer
|
||||
| WlLayer
|
||||
|
||||
@@ -5,7 +5,6 @@ module Dodge.Render.Picture
|
||||
import Dodge.Data
|
||||
--import Dodge.Base.Window
|
||||
import Dodge.Base.WinScale
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Render.HUD
|
||||
import Dodge.Render.MenuScreen
|
||||
import Geometry
|
||||
@@ -17,7 +16,7 @@ fixedCoordPictures u = case _menuLayers u of
|
||||
[ hudDrawings cfig w
|
||||
, customMouseCursor cfig w
|
||||
]
|
||||
(lay:_) -> setDepth (-1) . winScale cfig . onLayer MenuDepth $ menuScreen u lay
|
||||
(lay:_) -> setDepth (-1) . winScale cfig $ menuScreen u lay
|
||||
where
|
||||
w = _uvWorld u
|
||||
cfig = _config u
|
||||
|
||||
@@ -115,7 +115,7 @@ moveInverseShockwave w pt
|
||||
|
||||
drawInverseShockwave :: Particle -> Picture
|
||||
drawInverseShockwave pt
|
||||
= setLayer 1 $ onLayer PtLayer $ uncurryV translate p
|
||||
= setLayer 1 $ setDepth 20 $ uncurryV translate p
|
||||
$ color cyan $ thickCircle rad thickness
|
||||
where
|
||||
p = _ptPos pt
|
||||
|
||||
@@ -14,6 +14,17 @@ data Verx = Verx
|
||||
, _vxShadNum :: !ShadNum
|
||||
}
|
||||
newtype LayNum = LayNum { _unLayNum :: Int }
|
||||
|
||||
data Layer
|
||||
= BottomLayer
|
||||
| MidLayer
|
||||
| BloomLayer
|
||||
| BloomNoZWrite
|
||||
| TopLayer
|
||||
| FixedCoordLayer
|
||||
|
||||
numLayers :: Int
|
||||
numLayers = 6
|
||||
--TODO use synonyms for layer numbers
|
||||
newtype ShadNum = ShadNum { _unShadNum :: Int }
|
||||
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
|
||||
|
||||
Reference in New Issue
Block a user