Define shape datatype

This commit is contained in:
2021-09-14 01:17:07 +01:00
parent 29f048cfdd
commit 294e01479a
18 changed files with 226 additions and 111 deletions
+1 -2
View File
@@ -5,8 +5,7 @@ module Dodge.Creature.State.Data
--import Geometry
import Geometry.Data
import Dodge.Data.DamageType
--import Dodge.Creature.Stance.Data
import Picture.Data
import Color
import Control.Lens
import qualified Data.IntSet as IS
+1
View File
@@ -30,6 +30,7 @@ import Polyhedra.Data
import Sound.Data
import qualified DoubleStack as DS
import Dodge.GameRoom
import Color
import GHC.Generics
import Control.Lens
+1 -1
View File
@@ -59,7 +59,7 @@ shootBezier targetp cr w = w & particles %~ (theBullet :)
startp
(controlp +.+ randPos)
(targetp +.+ randPos')
(destroyOnImpact bulHitCr bulHitWall' bulHitFF')
(destroyOnImpact bulHitCr bulHitWall bulHitFF')
5
controlp = mouseWorldPos w
cid = _crID cr
+2 -2
View File
@@ -8,14 +8,14 @@ import Geometry.Data
basicBullet :: Ammo
basicBullet = BulletAmmo
{ _amString = "BULLET"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall' bulHitFF'
, _amBulEff = destroyOnImpact bulHitCr bulHitWall bulHitFF'
, _amBulWth = 2
, _amBulVel = V2 50 0
}
ltBullet :: Ammo
ltBullet = BulletAmmo
{ _amString = "LTBULLET"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall' bulHitFF'
, _amBulEff = destroyOnImpact bulHitCr bulHitWall bulHitFF'
, _amBulWth = 2
, _amBulVel = V2 40 0
}
+1 -1
View File
@@ -11,8 +11,8 @@ import Dodge.WorldEvent.Sound
import Dodge.LevelGen.Pathing
import Dodge.RandomHelp
import Geometry
import Picture.Data
import qualified IntMapHelp as IM
import Color
import Control.Lens
import Control.Monad.State
+3 -8
View File
@@ -137,10 +137,10 @@ bulConCr' bt p cr w
ep = sp +.+ _btVel' bt
mkwave = over worldEvents $ (.) (makeShockwaveAt [] p 15 4 1 white)
{- | Hitting wall effects: create a spark, damage blocks. -}
bulHitWall' :: Particle -> Point2 -> Wall -> World -> World
bulHitWall' bt p wl w = damageBlocksBy 5 wl
bulHitWall :: Particle -> Point2 -> Wall -> World -> World
bulHitWall bt p wl w = damageBlocksBy 5 wl
. smokeCloudAt dustcol 20 200 1 (addZ 20 pOut)
$ createSparkCol 8 theCol pOut (reflectDir wl)
. createSparkCol 8 theCol pOut (reflectDir wl)
$ set randGen g
w
where
@@ -212,8 +212,3 @@ hvBulHitWall' bt p x w = damageBlocksBy 5 x $ set randGen g $ foldr ($) w (spar
bulHitFF' :: Particle -> Point2 -> ForceField -> World -> World
bulHitFF' _ _ _ = id
{- | Typical effect: destroy on impact, damage creatures and blocks, create spark on walls. -}
basicBulletEffect :: HitEffect
basicBulletEffect = destroyOnImpact bulHitCr bulHitWall' bulHitFF'
+8 -1
View File
@@ -10,6 +10,7 @@ import Dodge.Base.Window
import Dodge.Render.Picture
--import Dodge.Creature.ShadowBox
import Dodge.Creature.Silhouette
import Dodge.Render.Shape
import Geometry
import Render
import Data.Preload.Render
@@ -20,7 +21,7 @@ import Shader.Data
import MatrixHelper
--import Polyhedra.Data
import Polyhedra
--import Tuple
import Shape.Data
import Foreign
--import Control.Applicative
@@ -88,6 +89,12 @@ doDrawing pdata w = do
layerCounts <- UMV.replicate (6*6) 0
pokeBindFoldableLayer shadV layerCounts $ worldPictures w
renderLayer 0 shadV layerCounts
numShapeVs <- pokeShapeVs (_vboPtr $ _vaoVBO $ _shadVAO $ _shapeShader pdata)
$ _shVertices $ worldShape w
bindShaderBuffers [_shapeShader pdata] [numShapeVs]
drawShader (_shapeShader pdata) numShapeVs
--draw floor onto base buffer
nTextArrayVs <- pokePoint33s (shadVBOptr $ _textureArrayShader pdata) (_floorTiles w)
bindShaderBuffers [_textureArrayShader pdata] [nTextArrayVs]
+9
View File
@@ -0,0 +1,9 @@
module Dodge.Render.Shape
where
import Dodge.Data
import Shape
import Geometry
import Color
worldShape :: World -> Shape
worldShape _ = colorSh green . translateSh (V3 (-20) 200 50) . flatPoly $ rectNSWE 20 0 0 20