Cleanup creature picture
This commit is contained in:
+11
-14
@@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Render.Picture
|
||||
where
|
||||
import Dodge.Data
|
||||
@@ -8,29 +8,21 @@ import Dodge.Base.Zone
|
||||
import Dodge.Picture
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Render.HUD
|
||||
--import Dodge.Render.List
|
||||
import Dodge.Render.MenuScreen
|
||||
--import Dodge.GameRoom
|
||||
--import Dodge.Debug
|
||||
import Geometry
|
||||
--import Geometry.Zone
|
||||
--import Geometry.Data
|
||||
import Picture
|
||||
import Polyhedra.Data
|
||||
|
||||
--import Dodge.Creature.YourControl
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Data.List (partition)
|
||||
import qualified Data.IntMap.Lazy as IM
|
||||
--import qualified Data.Vector.Fusion.Stream.Monadic as VS
|
||||
|
||||
worldPictures :: World -> Picture
|
||||
worldPictures w = pictures
|
||||
[pictures (_decorations w)
|
||||
,concatMapPic (dbArg _pjDraw) $ _projectiles w
|
||||
,concatMapPic (crDraw w) $ _creatures w
|
||||
,concatMapPic (crDraw w) . IM.filter crIsClose $ _creatures w
|
||||
,concatMapPic (dbArg _ptDraw) $ _particles w
|
||||
,testPic w
|
||||
,concatMapPic drawItem $ _floorItems w
|
||||
@@ -40,6 +32,10 @@ worldPictures w = pictures
|
||||
,concatMapPic btDraw $ _buttons w
|
||||
,concatMapPic drawWallFloor $ wallFloorsToDraw w
|
||||
]
|
||||
where
|
||||
crIsClose cr = dist (_crPos cr) camCen < winSize
|
||||
winSize = 30 + max (getWindowX w) (getWindowY w)
|
||||
camCen = _cameraCenter w
|
||||
|
||||
foregroundPics :: World -> [Polyhedra]
|
||||
foregroundPics = _foregroundDecorations
|
||||
@@ -50,7 +46,7 @@ fixedCoordPictures w = case _menuLayers w of
|
||||
[ hudDrawings w
|
||||
, customMouseCursor w
|
||||
]
|
||||
lays -> scaler . onLayer MenuDepth $ menuScreen w lays
|
||||
(lay:_) -> scaler . onLayer MenuDepth $ menuScreen w lay
|
||||
where
|
||||
scaler = setDepth (-1) . scale (2 / getWindowX w) (2 / getWindowY w)
|
||||
|
||||
@@ -121,9 +117,10 @@ outsideScreenPolygon w = [tr,tl,bl,br]
|
||||
bl = scTran $ scRot $ scZoom $ V2 (- (3*halfWidth w)) (- (3* halfHeight w))
|
||||
|
||||
wallShadowsToDraw :: World -> [Wall]
|
||||
wallShadowsToDraw w = filter (fromMaybe True . (^? blVisible))
|
||||
. IM.elems
|
||||
$ wallsNearZones (zoneOfSight w) w
|
||||
wallShadowsToDraw w
|
||||
= filter (fromMaybe True . (^? blVisible))
|
||||
. IM.elems
|
||||
$ wallsNearZones (zoneOfSight w) w
|
||||
|
||||
-- cannot only test if walls are on screen, but also if they are on the cone
|
||||
-- towards the center of sight
|
||||
|
||||
Reference in New Issue
Block a user