Cleanup warnings

This commit is contained in:
2021-05-17 22:39:18 +02:00
parent d7fcdbf550
commit 69f915a894
102 changed files with 1243 additions and 1185 deletions
+1 -1
View File
@@ -154,4 +154,4 @@ airlockCrystal n = Room
col = dim $ dim $ bright red
pss :: [(Point2,Point2)]
pss = reverse $ fmap ( (\x -> ((50,x),(50,x+50)) ) . fromIntegral)
[20,22..70]
[20::Int,22..70]
+2 -2
View File
@@ -3,12 +3,12 @@ Collections of rooms that branch into multiple paths.
-}
module Dodge.Room.Branch
where
import Geometry
--import Geometry
import Dodge.Room.Data
import Dodge.Room.Door
import Dodge.Room.Link
import Dodge.Room.Procedural
import Dodge.LevelGen.Data
--import Dodge.LevelGen.Data
import Dodge.Layout.Tree.Polymorphic
import Control.Monad.State
+14 -6
View File
@@ -64,7 +64,7 @@ shiftRoomToLink l r
(p,a) = last $ _rmLinks r
shiftRoomBy :: (Point2,Float) -> Room -> Room
shiftRoomBy shift@(pos,rot) r =
shiftRoomBy shift r =
over rmPolys (fmap (map (shiftPointBy shift)))
$ over rmLinks (fmap (shiftLinkBy shift))
$ over rmPath (map (shiftPathPointBy shift))
@@ -72,14 +72,22 @@ shiftRoomBy shift@(pos,rot) r =
$ over rmBound (fmap (map (shiftPointBy shift)))
r
shiftLinkBy
:: (Point2,Float)
-> (Point2,Float)
-> (Point2,Float)
shiftLinkBy (pos,rot) (p,r) = (shiftPointBy (pos,rot) p, r + rot)
shiftPSBy
:: (Point2,Float)
-> Placement
-> Placement
shiftPSBy (pos,rot) ps = ps
& placementSpot . psPos %~ shiftPointBy (pos,rot)
& placementSpot . psRot %~ (+ rot)
--shiftPSBy (pos,rot) ps = case ps of
-- PS {} -> over psPos (shiftPointBy (pos,rot))
-- $ over psRot (+rot)
-- ps
shiftPathPointBy
:: (Point2,Float)
-> (Point2,Point2)
-> (Point2,Point2)
shiftPathPointBy s (p1,p2) = (shiftPointBy s p1, shiftPointBy s p2)
+6 -5
View File
@@ -57,8 +57,8 @@ twinSlowDoorRoom drID w h x = Room
[0..nDrp]
drR = fmap ((\h' -> ((-x,-h'),(-x,h-h'))) . (* h) . (/ fromIntegral nDrp) . fromIntegral)
[0..nDrp]
nDrp = ceiling h
cond w = or $ M.lookup (DoorNumOpen drID) (_worldState w)
nDrp = ceiling h :: Int
cond w' = or $ M.lookup (DoorNumOpen drID) (_worldState w')
col = dim $ dim $ bright red
twinSlowDoorChasers
@@ -90,7 +90,7 @@ slowDoorRoom = do
ys' <- replicateM 5 $ state $ randomR (h+20,y)
let crits = zipWith (\p r -> sPS p r randC1) ps rs
lsources = [sPS (x/2,30) 0 putLamp, sPS (x/2,y-30) 0 putLamp]
barrels = zipWith (\x y -> sPS (x,y) 0 $ PutCrit explosiveBarrel) xs' ys'
barrels = zipWith (\x' y' -> sPS (x',y') 0 $ PutCrit explosiveBarrel) xs' ys'
pillarsa = []
pillarsb = putBlockRect (x/5-20) (x/5+20) (h/2-20) (h/2+20)
++ putBlockRect (2*x/5-20) (2*x/5+20) (h/2-20) (h/2+20)
@@ -99,8 +99,8 @@ slowDoorRoom = do
pillarsc = putBlockRect (x/3-20) (x/3+20) (h/2-20) (h/2+20)
++ putBlockRect (2*x/3-20) (2*x/3+20) (h/2-20) (h/2+20)
pillars <- takeOne [pillarsa, pillarsb, pillarsc]
let cond x = (snd . fst) x > h + 40
cond2 x = (snd . fst) x < h - 40
let cond x' = (snd . fst) x' > h + 40
cond2 x' = (snd . fst) x' < h - 40
but <- takeOne [PutBtDoor (dim $ light red) butPos butRot (0,h) (x,h)
-- ,PutSwitchDoor (dim $ light red) butPos butRot (0,h) (x,h)
]
@@ -112,4 +112,5 @@ slowDoorRoom = do
)
)
randC1 :: PSType
randC1 = RandPS $ takeOne $ map PutCrit $ armourChaseCrit : replicate 50 chaseCrit
+2 -2
View File
@@ -5,7 +5,7 @@ module Dodge.Room.NoNeedWeapon
import Dodge.Data
import Dodge.Creature
import Dodge.Creature.State.Data
import Dodge.Creature.Inanimate
--import Dodge.Creature.Inanimate
import Dodge.Room.Data
import Dodge.Room.Procedural
import Dodge.Room.Link
@@ -13,7 +13,7 @@ import Dodge.RandomHelp
import Dodge.LevelGen.Data
import Control.Lens
import Control.Monad
--import Control.Monad
import Control.Monad.State
import System.Random
{- |
+32 -3
View File
@@ -12,12 +12,16 @@ import Geometry
import Data.List
import Control.Lens
putLamp :: PSType
putLamp = PutCrit lamp
singleBlock :: Point2 -> [Placement]
singleBlock a = [sPS a 0 $ PutBlock [5,20,20] (greyN 0.5)
$ reverse $ rectNSWE 10 (-10) (-10) 10]
singleBlock a =
[sPS a 0
$ PutBlock [5,20,20] (greyN 0.5)
$ reverse
$ rectNSWE 10 (-10) (-10) 10
]
{-
Places a line of blocks between two points.
Width 9, also extends out from each point by 9.
@@ -128,20 +132,45 @@ subZipWith f g xs ys =
let (zs,ws) = partition f xs
in zipWith g zs ys ++ ws
isPutID :: Int -> Placement -> Bool
isPutID i ps = Just i == ps ^? placementSpot . psType . putID
putBlockRect
:: Float
-> Float
-> Float
-> Float
-> [Placement]
putBlockRect a x b y = [ blockLine (a,b) (a,y)
, blockLine (a,y) (x,y)
, blockLine (x,y) (x,b)
, blockLine (x,b) (a,b)
]
putBlockV
:: Float
-> Float
-> Float
-> Float
-> [Placement]
putBlockV a x b y = [ blockLine (a,b) (a,y)
, blockLine (x,b) (a,b)
]
putBlockC
:: Float
-> Float
-> Float
-> Float
-> [Placement]
putBlockC a x b y = [ blockLine (a,b) (a,y)
, blockLine (x,b) (a,b)
, blockLine (a,y) (x,y)
]
putBlockN
:: Float
-> Float
-> Float
-> Float
-> [Placement]
putBlockN a x b y = [ blockLine (a,b) (a,y)
, blockLine (x,b) (a,b)
, blockLine (x,y) (x,b)
+28 -28
View File
@@ -12,16 +12,17 @@ import Dodge.Room.Data
import Dodge.Room.Placement
import Dodge.Room.Link
import Dodge.Item.Consumable
import Dodge.Item.Equipment
import Dodge.Item.Weapon
import Dodge.RandomHelp
import Dodge.LevelGen
import Dodge.LevelGen.Data
import Dodge.Creature
import Dodge.Default
--import Dodge.Default
import Geometry
import Picture
import Data.List (nub,nubBy,sortBy,minimumBy)
import Data.List
import Data.Function (on)
import qualified Data.Tuple.Extra as Tup
import qualified Data.Map as M
@@ -94,19 +95,19 @@ combineRooms r r' = Room
, _rmPS = _rmPS r ++ _rmPS r'
, _rmBound = _rmBound r ++ _rmBound r'
}
{- The top fourth of a room of a given height. -}
fourth
:: Float -- ^ Distance from center of room to top edge
-> Room
fourth w = Room
{ _rmPolys = [ [(0,0),(w,w),(-w,w)] ]
, _rmLinks = [((0,w), 0)]
, _rmPath = [((0,w),(0,0)),((0,0),(0,w))]
, _rmPS =
[sPS (0,w/2) 0 putLamp
]
, _rmBound = [[(0,0),(w,w),(-w,w)]]
}
--{- The top fourth of a room of a given height. -}
--fourth
-- :: Float -- ^ Distance from center of room to top edge
-- -> Room
--fourth w = Room
-- { _rmPolys = [ [(0,0),(w,w),(-w,w)] ]
-- , _rmLinks = [((0,w), 0)]
-- , _rmPath = [((0,w),(0,0)),((0,0),(0,w))]
-- , _rmPS =
-- [sPS (0,w/2) 0 putLamp
-- ]
-- , _rmBound = [[(0,0),(w,w),(-w,w)]]
-- }
{- Randomly generate a top fourth of a room possibly with a wall.
Add a light and a 'PutNothing' placement. -}
fourthWall :: RandomGen g => Float -> State g Room
@@ -136,18 +137,17 @@ fourthWall w = do
, _rmPS = b
, _rmBound = [[(0,0),(w,w),(-w,w)]]
}
fourthCorner :: Float -> Room
fourthCorner w = Room
{ _rmPolys = [ [(0,0),(w,w),(0,2*w),(-w,w)] ]
, _rmLinks =
[((w/2,3*w/2), negate $ pi/4)
,((negate $ w/2,3*w/2), pi/4)
]
, _rmPath = [((0,w),(0,0)),((0,0),(0,w))]
, _rmPS = [sPS (0,w) 0 putLamp]
, _rmBound = [[(w,w),(0,2*w),(-w,w)]]
}
--fourthCorner :: Float -> Room
--fourthCorner w = Room
-- { _rmPolys = [ [(0,0),(w,w),(0,2*w),(-w,w)] ]
-- , _rmLinks =
-- [((w/2,3*w/2), negate $ pi/4)
-- ,((negate $ w/2,3*w/2), pi/4)
-- ]
-- , _rmPath = [((0,w),(0,0)),((0,0),(0,w))]
-- , _rmPS = [sPS (0,w) 0 putLamp]
-- , _rmBound = [[(w,w),(0,2*w),(-w,w)]]
-- }
fourthCornerWall :: RandomGen g => Float -> State g Room
fourthCornerWall w = do
@@ -261,5 +261,5 @@ centerVaultRoom n w h d = do
(over worldState (M.insert (DoorNumOpen i) True))
(over worldState (M.insert (DoorNumOpen i) False))
]
cond i w = or $ M.lookup (DoorNumOpen i) (_worldState w)
cond i w' = or $ M.lookup (DoorNumOpen i) (_worldState w')
+1 -1
View File
@@ -9,7 +9,7 @@ import Dodge.Room.Link
import Dodge.Room.Placement
import Dodge.Room.Corridor
import Dodge.LevelGen.Data
import Dodge.RandomHelp
--import Dodge.RandomHelp
import Dodge.Creature
import Dodge.Layout.Tree.Polymorphic
+1 -2
View File
@@ -9,7 +9,7 @@ import Dodge.Base
import Dodge.Room.Data
import Dodge.Room.Procedural
import Dodge.Room.Placement
import Dodge.Layout
--import Dodge.Layout
import Dodge.LevelGen.Data
import Geometry
import Picture
@@ -44,5 +44,4 @@ telRoomLev i = do
levelReset pp w
| dist (_crPos $ you w) (_ppPos pp) < 20 = makeExplosionAt (_ppPos pp) $ startNewGame w
| otherwise = w
ppPoly pp = map (+.+ _ppPos pp) ppFootprint
startNewGame w = w & worldTriggers %~ S.insert (ResetLevel i)
+2 -2
View File
@@ -10,9 +10,9 @@ import Dodge.Room.Data
import Dodge.Room.Placement
import Dodge.LevelGen.Data
import Data.List
--import Data.List
import Control.Monad.State
import Control.Lens
--import Control.Lens
import System.Random
{- | A triangular room with loot at the top (with 'PutID' 2),
creatures in the bottom two corners (with 'PutID' 0),