mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Fix that CheckObjectCoveredByTextbox doesn't account for the background scroll (SCX/SCY) (#8)
This commit is contained in:
parent
dadbc72764
commit
85f9c258b5
@ -2406,18 +2406,14 @@ CheckObjectCoveredByTextbox:
|
|||||||
ldh a, [hCurSpriteYCoord]
|
ldh a, [hCurSpriteYCoord]
|
||||||
add e
|
add e
|
||||||
dec a
|
dec a
|
||||||
cp SCREEN_HEIGHT
|
|
||||||
jr nc, .ok9
|
|
||||||
ld b, a
|
ld b, a
|
||||||
.next
|
.next
|
||||||
ldh a, [hCurSpriteXCoord]
|
ldh a, [hCurSpriteXCoord]
|
||||||
add d
|
add d
|
||||||
dec a
|
dec a
|
||||||
cp SCREEN_WIDTH
|
|
||||||
jr nc, .ok8
|
|
||||||
ld c, a
|
ld c, a
|
||||||
push bc
|
push bc
|
||||||
call Coord2Tile
|
call ScrollAwareCoord2Tile
|
||||||
pop bc
|
pop bc
|
||||||
; NPCs disappear if standing on tiles FIRST_REGULAR_TEXT_CHAR or above,
|
; NPCs disappear if standing on tiles FIRST_REGULAR_TEXT_CHAR or above,
|
||||||
; since those IDs are for text characters and textbox frames.
|
; since those IDs are for text characters and textbox frames.
|
||||||
|
@ -257,6 +257,34 @@ ClearWholeMenuBox::
|
|||||||
call ClearBox
|
call ClearBox
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
ScrollAwareCoord2Tile::
|
||||||
|
; Return the address of wTilemap(c, b) in hl relative to the background scroll in hSCX and hSCY.
|
||||||
|
; c = c - [hSCX] / 8
|
||||||
|
ld a, [hSCX]
|
||||||
|
srl a
|
||||||
|
srl a
|
||||||
|
srl a
|
||||||
|
ld l, a
|
||||||
|
ld a, c
|
||||||
|
sub l
|
||||||
|
jr nc, .ok1
|
||||||
|
add BG_MAP_WIDTH
|
||||||
|
.ok1
|
||||||
|
ld c, a
|
||||||
|
; b = b - [hSCY] / 8
|
||||||
|
ld a, [hSCY]
|
||||||
|
srl a
|
||||||
|
srl a
|
||||||
|
srl a
|
||||||
|
ld l, a
|
||||||
|
ld a, b
|
||||||
|
sub l
|
||||||
|
jr nc, .ok2
|
||||||
|
add BG_MAP_HEIGHT
|
||||||
|
.ok2
|
||||||
|
ld b, a
|
||||||
|
jr Coord2Tile
|
||||||
|
|
||||||
MenuBoxCoord2Tile::
|
MenuBoxCoord2Tile::
|
||||||
ld a, [wMenuBorderLeftCoord]
|
ld a, [wMenuBorderLeftCoord]
|
||||||
ld c, a
|
ld c, a
|
||||||
|
Loading…
Reference in New Issue
Block a user