From 60cb94c0ecca322189b1a27c0376d85b267a88a0 Mon Sep 17 00:00:00 2001 From: Engezerstorung <154867622+Engezerstorung@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:46:47 +0200 Subject: [PATCH] Sprite scroll-in definitive fix Sometimes when you sleep on an issue, you wake up with a better idea, it happen. --- engine/overworld/movement.asm | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index e72eb6ea..2ed6d2e8 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -504,42 +504,36 @@ CheckSpriteAvailability: add SPRITESTATEDATA2_MAPY ld l, a ld b, [hl] ; x#SPRITESTATEDATA2_MAPY + ld c, [hl] ld a, [wCurMap] cp OAKS_LAB ld a, [wYCoord] - ld c, a jr z, .oakLabY - add 2 - ld c, a - sub 2 inc b + dec c .oakLabY cp b jr z, .skipYVisibilityTest jr nc, .spriteInvisible ; above screen region - ld a, c add SCREEN_HEIGHT / 2 - 1 - cp b + cp c jr c, .spriteInvisible ; below screen region .skipYVisibilityTest inc l ld b, [hl] ; x#SPRITESTATEDATA2_MAPX + ld c, [hl] ld a, [wCurMap] cp OAKS_LAB ld a, [wXCoord] - ld c, a jr z, .oakLabX - add 2 - ld c, a - sub 2 inc b + dec c .oakLabX cp b jr z, .skipXVisibilityTest jr nc, .spriteInvisible ; left of screen region - ld a, c add SCREEN_WIDTH / 2 - 1 - cp b + cp c jr c, .spriteInvisible ; right of screen region .skipXVisibilityTest ; make the sprite invisible if a text box is in front of it