2018-06-24 07:09:41 -07:00
|
|
|
_LoadMapPart::
|
2018-03-19 08:36:14 -07:00
|
|
|
ld hl, wSurroundingTiles
|
2022-09-12 06:15:44 -07:00
|
|
|
ld a, [wPlayerMetatileY]
|
2017-12-24 16:35:35 -08:00
|
|
|
and a
|
|
|
|
jr z, .top_row
|
2018-03-19 08:36:14 -07:00
|
|
|
ld bc, SURROUNDING_WIDTH * 2
|
2017-12-24 16:35:35 -08:00
|
|
|
add hl, bc
|
|
|
|
|
|
|
|
.top_row
|
2022-09-12 06:15:44 -07:00
|
|
|
ld a, [wPlayerMetatileX]
|
2017-12-24 16:35:35 -08:00
|
|
|
and a
|
|
|
|
jr z, .left_column
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
.left_column
|
|
|
|
decoord 0, 0
|
|
|
|
ld b, SCREEN_HEIGHT
|
|
|
|
.loop
|
|
|
|
ld c, SCREEN_WIDTH
|
|
|
|
.loop2
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop2
|
|
|
|
ld a, l
|
2018-03-19 08:36:14 -07:00
|
|
|
add METATILE_WIDTH
|
2017-12-24 16:35:35 -08:00
|
|
|
ld l, a
|
|
|
|
jr nc, .carry
|
|
|
|
inc h
|
|
|
|
|
|
|
|
.carry
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|