Add extra debug options for viewing room clipping
This commit is contained in:
@@ -22,7 +22,7 @@ data Configuration = Configuration
|
|||||||
, _debug_noclip :: Bool
|
, _debug_noclip :: Bool
|
||||||
, _debug_cr_status :: Bool
|
, _debug_cr_status :: Bool
|
||||||
, _debug_view_boundaries :: Bool
|
, _debug_view_boundaries :: Bool
|
||||||
, _debug_view_clip_bounds :: Bool
|
, _debug_view_clip_bounds :: RoomClipping
|
||||||
, _debug_pathing :: Bool
|
, _debug_pathing :: Bool
|
||||||
}
|
}
|
||||||
deriving (Generic, Show)
|
deriving (Generic, Show)
|
||||||
@@ -31,6 +31,11 @@ data ResFactor = FullRes | HalfRes | QuarterRes
|
|||||||
instance ToJSON ResFactor where
|
instance ToJSON ResFactor where
|
||||||
toEncoding = genericToEncoding defaultOptions
|
toEncoding = genericToEncoding defaultOptions
|
||||||
instance FromJSON ResFactor
|
instance FromJSON ResFactor
|
||||||
|
data RoomClipping = NoRoomClipBoundaries | AllRoomClipBoundaries | IntersectingRoomClipBoundaries
|
||||||
|
deriving (Generic, Show, Eq, Ord, Enum, Bounded)
|
||||||
|
instance ToJSON RoomClipping where
|
||||||
|
toEncoding = genericToEncoding defaultOptions
|
||||||
|
instance FromJSON RoomClipping
|
||||||
resFactorNum :: ResFactor -> Int
|
resFactorNum :: ResFactor -> Int
|
||||||
resFactorNum rf = case rf of
|
resFactorNum rf = case rf of
|
||||||
FullRes -> 1
|
FullRes -> 1
|
||||||
@@ -62,6 +67,6 @@ defaultConfig = Configuration
|
|||||||
, _debug_noclip = False
|
, _debug_noclip = False
|
||||||
, _debug_cr_status = False
|
, _debug_cr_status = False
|
||||||
, _debug_view_boundaries = False
|
, _debug_view_boundaries = False
|
||||||
, _debug_view_clip_bounds = False
|
, _debug_view_clip_bounds = NoRoomClipBoundaries
|
||||||
, _debug_pathing = False
|
, _debug_pathing = False
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import Dodge.Creature
|
|||||||
import Dodge.WorldEvent.Cloud
|
import Dodge.WorldEvent.Cloud
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import Geometry.ConvexPoly
|
|
||||||
|
|
||||||
import System.Random
|
import System.Random
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
@@ -43,7 +42,8 @@ initialWorld = defaultWorld
|
|||||||
|
|
||||||
testStringInit :: World -> [String]
|
testStringInit :: World -> [String]
|
||||||
--testStringInit = map (concatMap $ \(_,ct,_,_) -> show ct) . invertListInvMult . yourInv
|
--testStringInit = map (concatMap $ \(_,ct,_,_) -> show ct) . invertListInvMult . yourInv
|
||||||
testStringInit w = [show $ f $ _roomClipping w]
|
testStringInit = const []
|
||||||
where
|
-- w = [show $ f $ _roomClipping w]
|
||||||
f (x:xs) = any (convexPolysOverlap x) xs || f xs
|
-- where
|
||||||
f [] = False
|
-- f (x:xs) = any (convexPolysOverlap x) xs || f xs
|
||||||
|
-- f [] = False
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@ debugMenuOptions =
|
|||||||
, doption ScancodeC debug_noclip "NOCLIP" _debug_noclip
|
, doption ScancodeC debug_noclip "NOCLIP" _debug_noclip
|
||||||
, doption ScancodeS debug_cr_status "SHOW CREATURE STATUS" _debug_cr_status
|
, doption ScancodeS debug_cr_status "SHOW CREATURE STATUS" _debug_cr_status
|
||||||
, doption ScancodeV debug_view_boundaries "SHOW VIEW BOUNDARIES" _debug_view_boundaries
|
, doption ScancodeV debug_view_boundaries "SHOW VIEW BOUNDARIES" _debug_view_boundaries
|
||||||
, doption ScancodeB debug_view_clip_bounds "SHOW ROOM CLIP BOUNDARIES" _debug_view_clip_bounds
|
, makeEnumOption ScancodeB debug_view_clip_bounds "SHOW ROOM CLIP" return
|
||||||
, doption ScancodeP debug_pathing "SHOW PATHING" _debug_pathing
|
, doption ScancodeP debug_pathing "SHOW PATHING" _debug_pathing
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -113,8 +113,9 @@ viewBoundaries cfig w
|
|||||||
|
|
||||||
viewClipBounds :: Configuration -> World -> Picture
|
viewClipBounds :: Configuration -> World -> Picture
|
||||||
viewClipBounds cfig w
|
viewClipBounds cfig w
|
||||||
| _debug_view_clip_bounds cfig
|
| _debug_view_clip_bounds cfig == AllRoomClipBoundaries
|
||||||
-- = setLayer 5 $ color green $ concatMap (polygonWire . _cpPoints) (_roomClipping w)
|
= setLayer 5 $ color green $ concatMap (polygonWire . _cpPoints) (_roomClipping w)
|
||||||
|
| _debug_view_clip_bounds cfig == IntersectingRoomClipBoundaries
|
||||||
= setLayer 5 $ f (_roomClipping w)
|
= setLayer 5 $ f (_roomClipping w)
|
||||||
| otherwise = []
|
| otherwise = []
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -170,8 +170,6 @@ quarterRoomTri w = do
|
|||||||
]
|
]
|
||||||
, _rmBound = [[V2 0 0,V2 w w,V2 (-w) w]]
|
, _rmBound = [[V2 0 0,V2 w w,V2 (-w) w]]
|
||||||
}
|
}
|
||||||
-- where
|
|
||||||
-- w' = w -10
|
|
||||||
|
|
||||||
quarterRoomSquare :: RandomGen g => Float -> State g Room
|
quarterRoomSquare :: RandomGen g => Float -> State g Room
|
||||||
quarterRoomSquare w = do
|
quarterRoomSquare w = do
|
||||||
@@ -211,8 +209,6 @@ quarterRoomSquare w = do
|
|||||||
--, _rmBound = [map toV2 [(w,w),(0,2*w),(-w,w)]]
|
--, _rmBound = [map toV2 [(w,w),(0,2*w),(-w,w)]]
|
||||||
, _rmBound = [ map toV2 [(0,0),(w,w),(0,2*w),(-w,w)] ]
|
, _rmBound = [ map toV2 [(0,0),(w,w),(0,2*w),(-w,w)] ]
|
||||||
}
|
}
|
||||||
-- where
|
|
||||||
-- w' = w - 10
|
|
||||||
{- | Randomise the ordering of placements in a room.
|
{- | Randomise the ordering of placements in a room.
|
||||||
Useful for randomising the position of generic placements such as 'PutNothing'. -}
|
Useful for randomising the position of generic placements such as 'PutNothing'. -}
|
||||||
shufflePlacements :: RandomGen g => Room -> State g Room
|
shufflePlacements :: RandomGen g => Room -> State g Room
|
||||||
|
|||||||
Reference in New Issue
Block a user