draw doors like walls

This commit is contained in:
nek0 2019-03-09 20:36:21 +01:00
parent d9735e72e9
commit 77b9a0a46e
2 changed files with 13 additions and 9 deletions

View file

@ -23,7 +23,7 @@ import qualified Data.Text as T
import Data.Matrix as M
import Data.Ecstasy as E
import Data.Maybe
import Data.List as L (sortOn, partition, find)
import Data.List as L
import System.Random (randomRIO)
@ -688,13 +688,14 @@ drawTile ud ctx posanims pr pc row col img =
do
let (bef, beh) = L.partition delimiter sorted
save ctx
mapM_ drawAnim beh
maybe (return ()) (draw ud x (y - 42) 64 74 fact)
mapM_ (flip drawAnim fact) beh
maybe (return ()) (draw ud x (y - 42) 64 74
(if fromMaybe False (isWall <$> img) then fact else 1))
((assetImages ud Map.!) <$> case img of
Just ImgEmpty -> Nothing
_ -> img
)
mapM_ drawAnim bef
mapM_ (flip drawAnim fact) bef
restore ctx
-- when (floor pr == row && floor pc == col) $ do
-- A.logIO A.Debug ("sorted: " ++ show sorted)
@ -744,16 +745,15 @@ drawTile ud ctx posanims pr pc row col img =
dist = distance (V2 (fromIntegral row) (fromIntegral col))
(V2 (realToFrac pr - 1) (realToFrac pc)) / 4
fact =
if isWall (fromJust img) &&
(pr <= fromIntegral row + minimum maxrs &&
pc >= fromIntegral col + maximum mincs)
if pr <= fromIntegral row + (if L.null maxrs then 0.5 else minimum maxrs) &&
pc >= fromIntegral col + (if L.null mincs then 0.5 else maximum mincs)
then min 1 dist
else 1
mb = maybe [] collisionObstacle img
drawAnim (V2 nr nc, as, _) = do
drawAnim (V2 nr nc, as, _) factor = do
let ax = realToFrac $ 640 + ((nc - pc) + (nr - pr)) * 32 - 32
ay = realToFrac $ 360 + ((nr - pr) - (nc - pc)) * 16 - 58
draw ud ax ay 64 74 1 as
draw ud ax ay 64 74 (if isWallLike (aiVariation $ asId as) then factor else 1) as
updateMap :: Double -> Affection UserData ()
updateMap dt = do

View file

@ -48,3 +48,7 @@ data AnimationName
| AnimJDoeM
| AnimDoor0
deriving (Show, Eq, Ord, Enum)
isWallLike :: AnimationName -> Bool
isWallLike AnimDoor0 = True
isWallLike _ = False