Format all CopyTilemapAtOnce variations the same way

This commit is contained in:
Rangi
2020-05-16 22:25:52 -04:00
parent abf3858fc4
commit 395ebd8386
3 changed files with 37 additions and 23 deletions

View File

@@ -3,33 +3,37 @@ SaveMenu_CopyTilemapAtOnce:
and a
jp z, WaitBGMap
; The following is a modified version of CopyTilemapAtOnce.
; The following is a modified version of _CopyTilemapAtOnce
; that waits for [rLY] to be $60 instead of $80 - 1.
ldh a, [hBGMapMode]
push af
xor a
ldh [hBGMapMode], a
ldh a, [hMapAnims]
push af
xor a
ldh [hMapAnims], a
.WaitLY:
.wait
ldh a, [rLY]
cp $60
jr c, .WaitLY
jr c, .wait
di
ld a, BANK(vBGMap2)
ldh [rVBK], a
hlcoord 0, 0, wAttrmap
call .CopyTilemapAtOnce
call .CopyBGMapViaStack
ld a, BANK(vBGMap0)
ldh [rVBK], a
hlcoord 0, 0
call .CopyTilemapAtOnce
.WaitLY2:
call .CopyBGMapViaStack
.wait2
ldh a, [rLY]
cp $60
jr c, .WaitLY2
jr c, .wait2
ei
pop af
@@ -38,7 +42,8 @@ SaveMenu_CopyTilemapAtOnce:
ldh [hBGMapMode], a
ret
.CopyTilemapAtOnce:
.CopyBGMapViaStack:
; Copy all tiles to vBGMap
ld [hSPBuffer], sp
ld sp, hl
ldh a, [hBGMapAddress + 1]
@@ -46,16 +51,18 @@ SaveMenu_CopyTilemapAtOnce:
ld l, 0
ld a, SCREEN_HEIGHT
ldh [hTilesPerCycle], a
ld b, 1 << 1
ld b, 1 << 1 ; not in v/hblank
ld c, LOW(rSTAT)
.loop
rept SCREEN_WIDTH / 2
pop de
; if in v/hblank, wait until not in v/hblank
.loop\@
ldh a, [c]
and b
jr nz, .loop\@
; load vBGMap
ld [hl], e
inc l
ld [hl], d