Use constants for VBlank handlers

This commit is contained in:
Rangi42
2024-05-22 11:45:53 -04:00
committed by Sylvie
parent 4432df05cb
commit b81e339f33
11 changed files with 54 additions and 36 deletions

View File

@@ -22,7 +22,7 @@ DoBattleTransition:
ld a, [hl]
push af
vc_hook Reduce_battle_transition_flashing
ld [hl], $1
ld [hl], VBLANK_CUTSCENE
.loop
ld a, [wJumptableIndex]

View File

@@ -24,11 +24,11 @@ _PlayBattleAnim:
call BattleAnimRequestPals
call BattleAnimDelayFrame
ld c, 1
ld c, VBLANK_CUTSCENE
ldh a, [rKEY1]
bit 7, a ; check CGB double speed mode
jr nz, .got_speed
ld c, 3
ld c, VBLANK_CUTSCENE_CGB
.got_speed
ld hl, hVBlank

View File

@@ -38,7 +38,7 @@ MagnetTrain:
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 1
ld [hl], VBLANK_CUTSCENE
.loop
ld a, [wJumptableIndex]
and a

View File

@@ -537,6 +537,7 @@ LinkTimeout:
xor a
ld [hld], a
ld [hl], a
assert VBLANK_NORMAL == 0
ldh [hVBlank], a
push de
hlcoord 0, 12
@@ -2380,7 +2381,7 @@ CheckLinkTimeout_Receptionist:
xor a
ld [hl], a
call WaitBGMap
ld a, $2
ld a, VBLANK_SOUND_ONLY
ldh [hVBlank], a
call DelayFrame
call DelayFrame
@@ -2402,7 +2403,7 @@ CheckLinkTimeout_Gen2:
xor a
ld [hl], a
call WaitBGMap
ld a, $2
ld a, VBLANK_SOUND_ONLY
ldh [hVBlank], a
call DelayFrame
call DelayFrame
@@ -2630,7 +2631,7 @@ Link_EnsureSync:
add $d0
ld [wLinkPlayerSyncBuffer], a
ld [wLinkPlayerSyncBuffer + 1], a
ld a, $2
ld a, VBLANK_SOUND_ONLY
ldh [hVBlank], a
call DelayFrame
call DelayFrame

View File

@@ -76,7 +76,7 @@ Credits::
; BUG: Credits sequence changes move selection menu behavior (see docs/bugs_and_glitches.md)
ldh a, [hVBlank]
push af
ld a, $5
ld a, VBLANK_CREDITS
ldh [hVBlank], a
ld a, TRUE
ldh [hInMenu], a

View File

@@ -45,9 +45,10 @@ CrystalIntro:
ret
.InitRAMAddrs:
assert VBLANK_NORMAL == 0
xor a
ldh [hVBlank], a
ld a, $1
ld a, TRUE
ldh [hInMenu], a
xor a
ldh [hMapAnims], a

View File

@@ -71,7 +71,7 @@ PrintDexEntry:
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld [hl], VBLANK_SERIAL
ld a, 8 ; 16 rows
ld [wPrinterQueueLength], a
@@ -146,7 +146,7 @@ PrintPCBox:
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld [hl], VBLANK_SERIAL
xor a
ldh [hBGMapMode], a
@@ -227,7 +227,7 @@ PrintUnownStamp:
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld [hl], VBLANK_SERIAL
xor a
ldh [hBGMapMode], a
@@ -302,7 +302,7 @@ PrintMail:
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld [hl], VBLANK_SERIAL
ld a, 18 / 2
ld [wPrinterQueueLength], a
@@ -345,7 +345,7 @@ PrintPartymon:
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld [hl], VBLANK_SERIAL
ld a, 16 / 2
ld [wPrinterQueueLength], a
@@ -403,7 +403,7 @@ _PrintDiploma:
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4 ; vblank mode that calls AskSerial
ld [hl], VBLANK_SERIAL
ln a, 1, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTilemapForPrint