fix draw ordering

This commit is contained in:
nek0 2018-06-16 11:40:51 +02:00
parent bfeb8a6fde
commit 5b911ab3ec

View file

@ -238,16 +238,27 @@ drawTile ud ctx posanims pr pc row col img =
((realToFrac x :: Double) < 1280 &&
(realToFrac (y - (74 - (realToFrac tileHeight :: CFloat))) :: Double) < 720)) $
do
let (lt, ge) = L.partition delimiter sorted
let (bef, beh) = L.partition delimiter posanims
save ctx
mapM_ drawAnim lt
mapM_ drawAnim beh
when (isJust img) drawImage
mapM_ drawAnim ge
mapM_ drawAnim bef
restore ctx
where
delimiter (V2 nr nc, _) =
any (\m -> nr < fromIntegral (floor nr :: Int) + m) maxrs &&
any (\m -> nc > fromIntegral (floor nc :: Int) + m) mincs
all delimit mb
where
delimit b
| nnr > fst (matmin b) && nnr < fst (matmax b) =
nnc < snd (matmin b)
| nnc > snd (matmin b) && nnc < snd (matmax b) =
nnr > fst (matmax b)
| otherwise =
True
nnr = nr - fromIntegral (floor nr)
nnc = nc - fromIntegral (floor nc)
-- any (\m -> nr < fromIntegral (floor nr :: Int) + m) maxrs &&
-- any (\m -> nc > fromIntegral (floor nc :: Int) + m) mincs
ai = assetImages ud
anims = assetAnimations ud
tileWidth = 64 :: Double