Skip to content

Commit

Permalink
Sprite scroll-in definitive fix
Browse files Browse the repository at this point in the history
Sometimes when you sleep on an issue, you wake up with a better idea, it happen.
  • Loading branch information
Engezerstorung committed Sep 5, 2024
1 parent c05e7fe commit 60cb94c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions engine/overworld/movement.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 60cb94c

Please sign in to comment.