Continue refactor

This commit is contained in:
2022-06-28 03:29:55 +01:00
parent e06527091e
commit 480fc2df5e
7 changed files with 17 additions and 25 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ import Dodge.Creature.HandPos
--import Dodge.Particle.TeslaArc
--import Dodge.SoundLogic.LoadSound
--import Dodge.WorldEvent
import Dodge.WorldEvent.ThingsHit
--import Dodge.WorldEvent.ThingsHit
--import Dodge.Default
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType
-1
View File
@@ -12,7 +12,6 @@ import Picture
import Geometry
import LensHelp
import Data.Maybe
import qualified Data.IntMap.Strict as IM
import qualified Streaming.Prelude as S
{- | Creates an outwardly increasing circle that draws creatures, even those behind walls. -}
+1 -1
View File
@@ -50,7 +50,7 @@ addBlock (p:ps) wl bl w = w
V2 x y = wallZoneOfPoint $ uncurry midPoint (_wlLine wl)
wlid = _wlID wl
ips = map (unv2 . wallZoneOfPoint) $ uncurry (divideLine (2*wallZoneSize)) (_wlLine wl)
unv2 (V2 x y) = (x,y)
unv2 (V2 x' y') = (x',y')
addBlock _ _ _ _ = error "Trying to add a block with incomplete polygon"
placeBlock :: [Point2] -> Block -> Wall -> World -> (Int,World)
+1 -1
View File
@@ -38,7 +38,7 @@ doDrawing pdata u = do
trans = _cameraCenter w
wins@(V2 winx winy) = V2 (_windowX cfig) (_windowY cfig)
resFact = resFactorNum $ cfig ^. graphics_resolution_factor
(wallPointsCol,windowPoints,wallSPics) = wallsToDrawStreams cfig w
(wallPointsCol,windowPoints,wallSPics) = wallsToDraw w
lightPoints = lightsToRender cfig w
viewFroms@(V2 vfx vfy) = _cameraViewFrom w
viewFrom3d = Vector3 vfx vfy 20
+4 -5
View File
@@ -1,5 +1,5 @@
module Dodge.Render.Walls
( wallsToDrawStreams
( wallsToDraw
) where
import Dodge.Data
import Dodge.Zone
@@ -13,11 +13,10 @@ import qualified Control.Foldl as L
import qualified Streaming.Prelude as S
--import Data.List
--import qualified Data.IntMap.Strict as IM
wallsToDrawStreams
:: Configuration
-> World
wallsToDraw
:: World
-> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)], SPic )
wallsToDrawStreams cfig w
wallsToDraw w
= ( wls, wins,spic)
where
f wl = (_wlLine wl, _wlColor wl)
+9 -15
View File
@@ -57,18 +57,12 @@ thingsHitExceptCr (Just cid) sp ep = S.filter crNotCid . thingsHit sp ep
crNotCid (_,Left cr) = _crID cr /= cid
crNotCid _ = True
--wallsHit
-- :: Point2 -- ^ Line start point
-- -> Point2 -- ^ Line end point
-- -> World
-- -> [(Point2, Wall)]
--wallsHit sp ep w
-- | sp == ep = []
-- | otherwise = sortOn (dist sp . fst) wls
-- where
-- wls = IM.elems $ wallsOnLineHit sp ep
-- $ IM.unions [f b $ f a $ _znObjects $ _wallsZone w
-- | a<-[x-1,x,x+1] , b<-[y-1,y,y+1]]
-- -- $ _walls w
-- V2 x y = wallZoneOfPoint (0.5 *.* (sp +.+ ep))
-- f i = fromMaybe IM.empty . IM.lookup i
wallsHit
:: Point2 -- ^ Line start point
-> Point2 -- ^ Line end point
-> World
-> Stream (Of (Point2, Wall)) Identity ()
wallsHit sp ep w
| sp == ep = S.each []
| otherwise = sortStreamOn (dist sp . fst)
. overlapSegWalls sp ep $ wallsAlongLine sp ep w
+1 -1
View File
@@ -7,6 +7,7 @@ module Dodge.Zone
, lookLookups
, zoneOfSeg
, zoneNearPointIP
, zoneNearPoint
, cloudZoneOfPoint
, cloudsNearPoint
, wallsNearZones
@@ -34,7 +35,6 @@ import Data.Maybe
import Data.List
--import Data.IntMap.Merge.Strict
import qualified Data.IntMap.Strict as IM
import qualified Data.IntSet as IS
import Control.Lens
--flattenZones :: Zone (IM.IntMap a) -> IM.IntMap a