draw doors like walls
This commit is contained in:
parent
d9735e72e9
commit
77b9a0a46e
2 changed files with 13 additions and 9 deletions
|
@ -23,7 +23,7 @@ import qualified Data.Text as T
|
||||||
import Data.Matrix as M
|
import Data.Matrix as M
|
||||||
import Data.Ecstasy as E
|
import Data.Ecstasy as E
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.List as L (sortOn, partition, find)
|
import Data.List as L
|
||||||
|
|
||||||
import System.Random (randomRIO)
|
import System.Random (randomRIO)
|
||||||
|
|
||||||
|
@ -688,13 +688,14 @@ drawTile ud ctx posanims pr pc row col img =
|
||||||
do
|
do
|
||||||
let (bef, beh) = L.partition delimiter sorted
|
let (bef, beh) = L.partition delimiter sorted
|
||||||
save ctx
|
save ctx
|
||||||
mapM_ drawAnim beh
|
mapM_ (flip drawAnim fact) beh
|
||||||
maybe (return ()) (draw ud x (y - 42) 64 74 fact)
|
maybe (return ()) (draw ud x (y - 42) 64 74
|
||||||
|
(if fromMaybe False (isWall <$> img) then fact else 1))
|
||||||
((assetImages ud Map.!) <$> case img of
|
((assetImages ud Map.!) <$> case img of
|
||||||
Just ImgEmpty -> Nothing
|
Just ImgEmpty -> Nothing
|
||||||
_ -> img
|
_ -> img
|
||||||
)
|
)
|
||||||
mapM_ drawAnim bef
|
mapM_ (flip drawAnim fact) bef
|
||||||
restore ctx
|
restore ctx
|
||||||
-- when (floor pr == row && floor pc == col) $ do
|
-- when (floor pr == row && floor pc == col) $ do
|
||||||
-- A.logIO A.Debug ("sorted: " ++ show sorted)
|
-- 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))
|
dist = distance (V2 (fromIntegral row) (fromIntegral col))
|
||||||
(V2 (realToFrac pr - 1) (realToFrac pc)) / 4
|
(V2 (realToFrac pr - 1) (realToFrac pc)) / 4
|
||||||
fact =
|
fact =
|
||||||
if isWall (fromJust img) &&
|
if pr <= fromIntegral row + (if L.null maxrs then 0.5 else minimum maxrs) &&
|
||||||
(pr <= fromIntegral row + minimum maxrs &&
|
pc >= fromIntegral col + (if L.null mincs then 0.5 else maximum mincs)
|
||||||
pc >= fromIntegral col + maximum mincs)
|
|
||||||
then min 1 dist
|
then min 1 dist
|
||||||
else 1
|
else 1
|
||||||
mb = maybe [] collisionObstacle img
|
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
|
let ax = realToFrac $ 640 + ((nc - pc) + (nr - pr)) * 32 - 32
|
||||||
ay = realToFrac $ 360 + ((nr - pr) - (nc - pc)) * 16 - 58
|
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 :: Double -> Affection UserData ()
|
||||||
updateMap dt = do
|
updateMap dt = do
|
||||||
|
|
|
@ -48,3 +48,7 @@ data AnimationName
|
||||||
| AnimJDoeM
|
| AnimJDoeM
|
||||||
| AnimDoor0
|
| AnimDoor0
|
||||||
deriving (Show, Eq, Ord, Enum)
|
deriving (Show, Eq, Ord, Enum)
|
||||||
|
|
||||||
|
isWallLike :: AnimationName -> Bool
|
||||||
|
isWallLike AnimDoor0 = True
|
||||||
|
isWallLike _ = False
|
||||||
|
|
Loading…
Reference in a new issue