diff options
author | chaos-lord <dd4791.mariokarter@hotmail.co.uk> | 2017-07-11 11:29:26 +0100 |
---|---|---|
committer | chaos-lord <dd4791.mariokarter@hotmail.co.uk> | 2017-07-11 11:29:26 +0100 |
commit | 8ab77c0d8e08664717914a390010e202877c3147 (patch) | |
tree | 3de90453a1e7fe48773fd8ecddf8f2e66ae5c0f7 | |
parent | 467f8980840250aaed160868f72a5ba3d5e2ce55 (diff) | |
parent | 3cd4aee0155496d3b093c31fb0758c08607ee892 (diff) |
Merge remote-tracking branch 'origin/master' into chaos_requests-tppfork
48 files changed, 779 insertions, 737 deletions
diff --git a/engine/copyright_screen.asm b/engine/copyright_screen.asm index c749043..f3d6a44 100644 --- a/engine/copyright_screen.asm +++ b/engine/copyright_screen.asm @@ -20,7 +20,7 @@ FadeInCopyrightScreen: ; 0x8228 ld hl, CopyrightTextGfxPointers
call LoadVideoData
call ClearOAMBuffer
- call Func_b66
+ call SetAllPalettesWhite
call EnableLCD
call SGBNormal
ld bc, $0050
diff --git a/engine/erase_all_data_menu.asm b/engine/erase_all_data_menu.asm index 6ef174f..e81a768 100644 --- a/engine/erase_all_data_menu.asm +++ b/engine/erase_all_data_menu.asm @@ -28,7 +28,7 @@ CheckForResetButtonCombo: ; 0x8167 ld hl, EraseAllDataGfxPointers
call LoadVideoData
call ClearOAMBuffer
- call Func_b66
+ call SetAllPalettesWhite
call EnableLCD
call SGBNormal
call FadeIn
diff --git a/engine/field_select_screen.asm b/engine/field_select_screen.asm index 26dfc47..f785989 100644 --- a/engine/field_select_screen.asm +++ b/engine/field_select_screen.asm @@ -23,7 +23,7 @@ LoadFieldSelectScreen: ; 0xd6dd call ClearOAMBuffer
ld a, $8
ld [wFieldSelectBlinkingBorderFrame], a
- call Func_b66
+ call SetAllPalettesWhite
ld a, $12
call SetSongBank
ld de, $0003
diff --git a/engine/high_scores_screen.asm b/engine/high_scores_screen.asm index 09b16d6..1aa3bb2 100644 --- a/engine/high_scores_screen.asm +++ b/engine/high_scores_screen.asm @@ -145,7 +145,7 @@ Func_cb14: ; 0xcb14 ld hl, hLCDC
set 3, [hl]
.asm_cb7f
- call Func_b66
+ call SetAllPalettesWhite
ld a, [wda7f]
and a
jr z, .asm_cbbd
diff --git a/engine/options_screen.asm b/engine/options_screen.asm index 64f0f43..a5e4958 100644 --- a/engine/options_screen.asm +++ b/engine/options_screen.asm @@ -31,7 +31,7 @@ Func_c35a: ; 0xc35a ld [wd91f], a
call Func_c43a
call Func_c948
- call Func_b66
+ call SetAllPalettesWhite
ld a, $12
call SetSongBank
ld de, $0002
diff --git a/engine/pinball_game.asm b/engine/pinball_game.asm index 3adce56..81fdde7 100644 --- a/engine/pinball_game.asm +++ b/engine/pinball_game.asm @@ -14,7 +14,7 @@ GameScreenFunction_LoadGFX: ; 0xd861 callba InitializeCurrentStage
call FillBottomMessageBufferWithBlackTile
ld a, $1
- ld [wd85d], a
+ ld [wAudioEngineEnabled], a
ld [wDrawBottomMessageBox], a
ld hl, wScreenState
inc [hl]
@@ -49,17 +49,17 @@ GameScreenFunction_StartBall: ; 0xd87f callba InitBallForStage
callba LoadStageCollisionAttributes
callba LoadStageData
- callba Func_ed5e
+ callba ScrollScreenToShowPinball
call ClearOAMBuffer
callba DrawSpritesForStage
- ld a, [wd849]
+ ld a, [wUpdateAudioEngineUsingTimerInterrupt]
and a
- call nz, Func_e5d
+ call nz, ToggleAudioEngineUpdateMethod
ld a, $1
ld [wDrawBottomMessageBox], a
xor a
ld [wd7c1], a
- call Func_b66
+ call SetAllPalettesWhite
call EnableLCD
call FadeIn
ld hl, wScreenState
@@ -145,25 +145,25 @@ GameScreenFunction_HandleBallPhysics: ; 0xd909 call MoveBallPosition
callba CheckStageTransition
callba DrawSpritesForStage
- call Func_33e3
- ld a, [wd5cb]
+ call UpdateBottomText
+ ld a, [wDisableDrawScoreboardInfo]
and a
- jr nz, .asm_d9e9
+ jr nz, .skipDrawingScoreboard
callba Func_85c7
callba HideScoreIfBallLow
callba Func_8645
call Func_dba9
call DrawNumPartyMonsIcon
call DrawPikachuSaverLightningBoltIcon
-.asm_d9e9
+.skipDrawingScoreboard
ld a, [wTimerActive]
and a
callba nz, Func_86a4
- ld a, [wd4ae]
+ ld a, [wMoveToNextScreenState]
and a
ret z
xor a
- ld [wd4ae], a
+ ld [wMoveToNextScreenState], a
ld hl, wScreenState
inc [hl]
ret
@@ -186,9 +186,9 @@ GameScreenFunction_HandleBallLoss: ; 0xda36 bit 0, a
callba nz, HandleFlippers
callba DrawSpritesForStage
- call Func_33e3
+ call UpdateBottomText
callba Func_85c7
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
ld a, [wd4c9]
@@ -231,9 +231,9 @@ GameScreenFunction_EndBall: ; 0xdab2 and a
jr nz, .asm_db28
call FadeOut
- ld a, [wd849]
+ ld a, [wUpdateAudioEngineUsingTimerInterrupt]
and a
- call z, Func_e5d
+ call z, ToggleAudioEngineUpdateMethod
call DisableLCD
ld hl, hSTAT
res 6, [hl]
@@ -249,9 +249,9 @@ GameScreenFunction_EndBall: ; 0xdab2 ld bc, $0004
call AdvanceFrames
call FadeOut
- ld a, [wd849]
+ ld a, [wUpdateAudioEngineUsingTimerInterrupt]
and a
- call nz, Func_e5d
+ call nz, ToggleAudioEngineUpdateMethod
call DisableLCD
ld hl, hSTAT
res 6, [hl]
@@ -276,9 +276,9 @@ GameScreenFunction_EndBall: ; 0xdab2 ld bc, $0004
call AdvanceFrames
call FadeOut
- ld a, [wd849]
+ ld a, [wUpdateAudioEngineUsingTimerInterrupt]
and a
- call nz, Func_e5d
+ call nz, ToggleAudioEngineUpdateMethod
call DisableLCD
ld hl, hSTAT
res 6, [hl]
diff --git a/engine/pinball_game/ball_init/ball_init_meowth_bonus.asm b/engine/pinball_game/ball_init/ball_init_meowth_bonus.asm index e452ecb..48f8077 100644 --- a/engine/pinball_game/ball_init/ball_init_meowth_bonus.asm +++ b/engine/pinball_game/ball_init/ball_init_meowth_bonus.asm @@ -26,7 +26,7 @@ InitBallMeowthBonusStage: ; 0x24059 dec b
jr nz, .asm_24081
ld a, $1
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, $40
ld [wMeowthXPosition], a
ld a, $20
diff --git a/engine/pinball_game/ball_loss/ball_loss_diglett_bonus.asm b/engine/pinball_game/ball_loss/ball_loss_diglett_bonus.asm index 2dd8117..6827c19 100644 --- a/engine/pinball_game/ball_loss/ball_loss_diglett_bonus.asm +++ b/engine/pinball_game/ball_loss/ball_loss_diglett_bonus.asm @@ -12,7 +12,7 @@ HandleBallLossDiglettBonus: ; 0xe056 ld a, $2
ld [wd4c8], a
xor a
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, [wCompletedBonusStage]
and a
ret nz
diff --git a/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm b/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm index 59a40da..4c37222 100644 --- a/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm +++ b/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm @@ -10,7 +10,7 @@ HandleBallLossGengarBonus: ; 0xdf1a cp $5
jr c, .asm_df50
xor a
- ld [wd4ae], a
+ ld [wMoveToNextScreenState], a
ld a, [wd6a7]
and a
ret nz
@@ -38,7 +38,7 @@ HandleBallLossGengarBonus: ; 0xdf1a ld a, $2
ld [wd4c8], a
xor a
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, [wCompletedBonusStage]
and a
ret nz
diff --git a/engine/pinball_game/ball_loss/ball_loss_meowth_bonus.asm b/engine/pinball_game/ball_loss/ball_loss_meowth_bonus.asm index f80e758..cf84910 100644 --- a/engine/pinball_game/ball_loss/ball_loss_meowth_bonus.asm +++ b/engine/pinball_game/ball_loss/ball_loss_meowth_bonus.asm @@ -44,7 +44,7 @@ HandleBallLossMeowthBonus: ; 0xdfe2 ld a, $2
ld [wd4c8], a
xor a
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld [wd712], a
ld a, [wCompletedBonusStage]
and a
diff --git a/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm b/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm index 2cd165e..07a51f0 100644 --- a/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm +++ b/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm @@ -10,7 +10,7 @@ HandleBallLossMewtwoBonus: ; 0xdf7e cp $8
jr c, .asm_dfb4
xor a
- ld [wd4ae], a
+ ld [wMoveToNextScreenState], a
ld a, [wd6b2]
and a
ret nz
@@ -38,7 +38,7 @@ HandleBallLossMewtwoBonus: ; 0xdf7e ld a, $2
ld [wd4c8], a
xor a
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, [wCompletedBonusStage]
and a
ret nz
diff --git a/engine/pinball_game/ball_loss/ball_loss_seel_bonus.asm b/engine/pinball_game/ball_loss/ball_loss_seel_bonus.asm index 0c86084..59d4bd7 100644 --- a/engine/pinball_game/ball_loss/ball_loss_seel_bonus.asm +++ b/engine/pinball_game/ball_loss/ball_loss_seel_bonus.asm @@ -43,7 +43,7 @@ HandleBallLossSeelBonus: ; 0xe08b ld a, $2
ld [wd4c8], a
xor a
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld [wd794], a
ld a, [wCompletedBonusStage]
and a
diff --git a/engine/pinball_game/billboard_tiledata.asm b/engine/pinball_game/billboard_tiledata.asm index 8af3568..5cc0960 100644 --- a/engine/pinball_game/billboard_tiledata.asm +++ b/engine/pinball_game/billboard_tiledata.asm @@ -14,7 +14,7 @@ LoadBillboardTileData: ; 0x30256 ld h, [hl]
ld l, a
ld a, Bank(BillboardTileDataPointers)
- call Func_10aa
+ call QueueGraphicsToLoad
pop bc
ld a, [hGameBoyColorFlag]
and a
@@ -25,7 +25,7 @@ LoadBillboardTileData: ; 0x30256 ld h, [hl]
ld l, a
ld a, Bank(BillboardPaletteDataPointers)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
BillboardTileDataPointers: ; 0x3027a
diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm index 559bf31..f556c2d 100644 --- a/engine/pinball_game/catchem_mode.asm +++ b/engine/pinball_game/catchem_mode.asm @@ -291,7 +291,7 @@ Func_101d9: ; 0x101d9 push de
xor a
ld de, Func_11d2
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
pop de
pop hl
pop bc
@@ -342,7 +342,7 @@ Func_10230: ; 0x10230 push de
xor a
ld de, LoadTileListsBank1
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
pop de
pop hl
pop bc
@@ -420,7 +420,7 @@ Func_102bc: ; 0x102bc xor a
ld bc, wc1b8
ld de, LoadPalettes
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
Func_10301: ; 0x10301
@@ -487,7 +487,7 @@ Func_10301: ; 0x10301 xor a
ld bc, wc1b8
ld de, LoadPalettes
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
Func_10362: ; 0x10362
@@ -560,7 +560,7 @@ Func_1038e: ; 0x1038e push de
xor a
ld de, Func_11d2
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
pop de
pop bc
ret
@@ -585,7 +585,7 @@ Func_10414: ; 0x10414 ld a, BANK(Data_10420)
ld bc, Data_10420
ld de, Func_11b5
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
Data_10420:
@@ -608,7 +608,7 @@ Func_10432: ; 0x10432 ld a, BANK(Data_1043e)
ld bc, Data_1043e
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
Data_1043e:
@@ -852,7 +852,7 @@ Func_10611: ; 0x10611 ld b, a
ld a, BANK(Data_1062a)
ld de, Func_11d2
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
Data_1062a:
@@ -1266,12 +1266,12 @@ Func_108f5: ; 0x108f5 call LoadVRAMData
ld hl, BlankSaverSpaceTileDataRedField
ld a, BANK(BlankSaverSpaceTileDataRedField)
- call Func_10aa
+ call QueueGraphicsToLoad
ld a, [wPreviousNumPokeballs]
callba LoadPokeballsGraphics_RedField
ld hl, CaughtPokeballTileDataPointers
ld a, BANK(CaughtPokeballTileDataPointers)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
BlankSaverSpaceTileDataRedField:
@@ -1396,12 +1396,12 @@ Func_109fc: ; 0x109fc call LoadVRAMData
ld hl, BlankSaverSpaceTileDataBlueField
ld a, BANK(BlankSaverSpaceTileDataBlueField)
- call Func_10aa
+ call QueueGraphicsToLoad
ld a, [wPreviousNumPokeballs]
callba LoadPokeballsGraphics_RedField
ld hl, Data_10a88
ld a, BANK(Data_10a88)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
BlankSaverSpaceTileDataBlueField:
diff --git a/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm index 8bdd4c3..897bafe 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm @@ -200,7 +200,7 @@ CapturePokemonBlueStage: ; 0x20483 ret
Func_2048f: ; 0x2048f
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
call FillBottomMessageBufferWithBlackTile
diff --git a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm index e6cd614..ee2c5ef 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm @@ -198,7 +198,7 @@ CapturePokemonRedStage: ; 0x201c2 ret
Func_201ce: ; 0x201ce
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
call FillBottomMessageBufferWithBlackTile
diff --git a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm index ee25c7c..cc57f8d 100644 --- a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm +++ b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm @@ -149,7 +149,7 @@ Func_17665: ; 0x17665 ld h, [hl]
ld l, a
ld a, Bank(TimerDigitsTileData)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/timer_digits_tiledata.asm"
diff --git a/engine/pinball_game/evolution_mode.asm b/engine/pinball_game/evolution_mode.asm index 541c5a4..a6c594b 100755 --- a/engine/pinball_game/evolution_mode.asm +++ b/engine/pinball_game/evolution_mode.asm @@ -25,7 +25,7 @@ StartEvolutionMode_CallTable: ; 0x10abc ConcludeEvolutionMode: ; 0x10ac8
xor a
- ld [wd5ca], a
+ ld [wBottomTextEnabled], a
call FillBottomMessageBufferWithBlackTile
xor a
ld [wInSpecialMode], a
@@ -719,12 +719,12 @@ ConcludeEvolutionMode_RedField: ; 0x10fe3 .asm_11036
ld hl, BlankSaverSpaceTileDataRedField
ld a, BANK(BlankSaverSpaceTileDataRedField)
- call Func_10aa
+ call QueueGraphicsToLoad
ld a, [wPreviousNumPokeballs]
callba LoadPokeballsGraphics_RedField
ld hl, CaughtPokeballTileDataPointers
ld a, BANK(CaughtPokeballTileDataPointers)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
StartEvolutionMode_UnusedField: ; 0x11054
@@ -856,12 +856,12 @@ ConcludeEvolutionMode_BlueField: ; 0x11195 .asm_111f0
ld hl, BlankSaverSpaceTileDataBlueField
ld a, BANK(BlankSaverSpaceTileDataBlueField)
- call Func_10aa
+ call QueueGraphicsToLoad
ld a, [wPreviousNumPokeballs]
callba LoadPokeballsGraphics_RedField
ld hl, Data_10a88
ld a, BANK(Data_10a88)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
LoadBlueFieldTopGraphics: ; 0x1120e
diff --git a/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm b/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm index c1e31c1..bb5042f 100644 --- a/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm +++ b/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm @@ -196,7 +196,7 @@ Func_20d30: ; 0x20d30 ret
Func_20d7c: ; 0x20d7c
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
call FillBottomMessageBufferWithBlackTile
diff --git a/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm b/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm index ba3e372..e21d09f 100644 --- a/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm +++ b/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm @@ -199,7 +199,7 @@ Func_2070b: ; 0x2070b ret
Func_20757: ; 0x20757
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
call FillBottomMessageBufferWithBlackTile
diff --git a/engine/pinball_game/extra_ball.asm b/engine/pinball_game/extra_ball.asm index f753f5f..e0c99ae 100644 --- a/engine/pinball_game/extra_ball.asm +++ b/engine/pinball_game/extra_ball.asm @@ -1,6 +1,6 @@ ShowExtraBallMessage: ; 0x30188
; Displays the extra ball scrolling message, if an extra ball has been granted.
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
ld a, [wShowExtraBallText]
diff --git a/engine/pinball_game/map_move.asm b/engine/pinball_game/map_move.asm index 5382259..ebd26e1 100755 --- a/engine/pinball_game/map_move.asm +++ b/engine/pinball_game/map_move.asm @@ -40,7 +40,7 @@ CallTable_3021f: ; 0x3021f Func_3022b: ; 0x3022b
xor a
- ld [wd5ca], a ;turn text off
+ ld [wBottomTextEnabled], a ;turn text off
call FillBottomMessageBufferWithBlackTile ;clear text
xor a
ld [wInSpecialMode], a
@@ -471,7 +471,7 @@ Func_314f3: ; 0x314f3 ret
Func_31505: ; 0x31505
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
call FillBottomMessageBufferWithBlackTile
@@ -564,9 +564,9 @@ Func_315d5: ; 0x315d5 ld bc, ArrivedAtMapText
callba LoadScrollingMapNameText
.asm_31603
- callba Func_33e3
+ callba UpdateBottomText
rst AdvanceFrame
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
jr nz, .asm_31603
ld a, $2
@@ -596,7 +596,7 @@ Func_3161b: ; 0x3161b ret
.asm_31643
- call Func_3168c
+ call UpdateMapMove_BlueField
ld a, [wd54d]
call CallInFollowingTable
PointerTable_3164c: ; 0x3164c
@@ -621,7 +621,7 @@ Func_31660: ; 0x31660 ret
Func_31672: ; 0x31672
- ld a, [wd5ca] ;if text is off
+ ld a, [wBottomTextEnabled] ;if text is off
and a
ret nz
call FillBottomMessageBufferWithBlackTile
@@ -631,14 +631,14 @@ Func_31672: ; 0x31672 scf
ret
-Func_3168c: ; 0x3168c
+UpdateMapMove_BlueField: ; 0x3168c
ld a, $50
- ld [wLeftMapMoveDiglettAnimationCounter], a
- ld [wRightMapMoveDiglettFrame], a
+ ld [wLeftMapMovePoliwagAnimationCounter], a
+ ld [wRightMapMovePsyduckFrame], a
ld a, $3
- ld [wd645], a
+ ld [wPsyduckState], a
ld a, $1
- ld [wd646], a
+ ld [wPoliwagState], a
callba PlayLowTimeSfx
ld a, [wd57e]
and a
@@ -718,9 +718,9 @@ Func_3174c: ; 0x3174c ld bc, ArrivedAtMapText
callba LoadScrollingMapNameText
.asm_3177a
- callba Func_33e3
+ callba UpdateBottomText
rst AdvanceFrame
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
jr nz, .asm_3177a
ld a, $2
diff --git a/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm b/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm index 8cc2636..fd5992c 100644 --- a/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm +++ b/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm @@ -521,7 +521,7 @@ UpdateSpinnerChargeGraphics_BlueField: ; 0x1cb43 ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_1cb60)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/blue_field/spinner.asm"
@@ -577,7 +577,7 @@ LoadBumperGraphics_BlueField: ; 0x1ce7a ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_1ceca)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
ApplyBumperCollision_BlueField: ; 0x1ce94
@@ -810,13 +810,13 @@ UpdatePikachuSaverAnimation_BlueField: ; 0x1d133 cp $1
jr nz, .asm_1d18c
xor a
- ld [wd85d], a
+ ld [wAudioEngineEnabled], a
call Func_310a
rst AdvanceFrame
ld a, $1
callba PlayPikachuSoundClip
ld a, $1
- ld [wd85d], a
+ ld [wAudioEngineEnabled], a
ld a, $ff
ld [wRumblePattern], a
ld a, $60
@@ -1334,7 +1334,7 @@ UpdateBonusMultiplierRailing_BlueField: ; 0x1d51b ret
ShowBonusMultiplierMessage_BlueField: ; 0x1d5bf
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
ld a, [wd613]
@@ -1395,7 +1395,7 @@ LoadBonusMultiplierRailingGraphics_BlueField_Gameboy: ; 0x1d602 ld h, [hl]
ld l, a
ld a, Bank(BonusMultiplierRailingTileDataPointers_1d6be)
- call Func_10aa
+ call QueueGraphicsToLoad
.asm_1d626
pop af
ld bc, $0000
@@ -1414,7 +1414,7 @@ LoadBonusMultiplierRailingGraphics_BlueField_Gameboy: ; 0x1d602 ld h, [hl]
ld l, a
ld a, Bank(BonusMultiplierRailingTileDataPointers_1d946)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
LoadBonusMultiplierRailingGraphics_BlueField_GameboyColor: ; 0x1d645
@@ -1432,7 +1432,7 @@ LoadBonusMultiplierRailingGraphics_BlueField_GameboyColor: ; 0x1d645 ld h, [hl]
ld l, a
ld a, Bank(BonusMultiplierRailingTileDataPointers_1d97a)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
GetBCDForNextBonusMultiplier_BlueField: ; 0x1d65f
@@ -1541,7 +1541,7 @@ ResolvePsyduckPoliwagCollision: ; 0x1dbd2 ld a, $7
callba Func_10000
ld a, $2
- ld [wd646], a
+ ld [wPoliwagState], a
ld a, $78
ld [wLeftMapMovePoliwagAnimationCounter], a
ld a, $14
@@ -1582,7 +1582,7 @@ ResolvePsyduckPoliwagCollision: ; 0x1dbd2 ccf
call z, HitPsyduck3Times
ld a, $2
- ld [wd645], a
+ ld [wPsyduckState], a
ld a, $28
ld [wRightMapMovePsyduckAnimationCounter], a
ld a, $78
@@ -1597,7 +1597,7 @@ UpdatePsyduckAndPoliwag: ; 0x1dc8e ret
UpdatePoliwag: ; 0x1dc95
- ld a, [wd646]
+ ld a, [wPoliwagState]
cp $0
ret z
ld a, [wLeftMapMovePoliwagAnimationCounter]
@@ -1618,7 +1618,7 @@ UpdatePoliwag: ; 0x1dc95 ret
.asm_1dcb9
- ld a, [wd646]
+ ld a, [wPoliwagState]
cp $2
ret nz
call Func_1130
@@ -1646,11 +1646,11 @@ UpdatePoliwag: ; 0x1dc95 ccf
call z, HitPoliwag3Times
ld a, $1
- ld [wd646], a
+ ld [wPoliwagState], a
ret
.asm_1dceb
- ld a, [wd646]
+ ld a, [wPoliwagState]
cp $1
ret nz
ld a, [wLeftMapMovePoliwagAnimationCounter]
@@ -1667,7 +1667,7 @@ UpdatePoliwag: ; 0x1dc95 ld [wStageCollisionMap + $103], a
.asm_1dd0c
ld a, $0
- ld [wd646], a
+ ld [wPoliwagState], a
ld a, [wLeftMapMoveCounter]
sub $3
ret nz
@@ -1678,14 +1678,14 @@ UpdatePoliwag: ; 0x1dc95 ld a, $0
call LoadPsyduckOrPoliwagGraphics
ld a, $0
- ld [wd646], a
+ ld [wPoliwagState], a
ret
; XXX
ret
UpdatePsyduck: ; 0x1dd2e
- ld a, [wd645]
+ ld a, [wPsyduckState]
cp $0
ret z
cp $1
@@ -1703,7 +1703,7 @@ UpdatePsyduck: ; 0x1dd2e ld a, $2
call LoadPsyduckOrPoliwagGraphics
ld a, $1
- ld [wd645], a
+ ld [wPsyduckState], a
ret
.asm_1dd53
@@ -1714,7 +1714,7 @@ UpdatePsyduck: ; 0x1dd2e add $3
call LoadPsyduckOrPoliwagGraphics
ld a, $3
- ld [wd645], a
+ ld [wPsyduckState], a
ret
.asm_1dd69
@@ -1754,7 +1754,7 @@ UpdatePsyduck: ; 0x1dd2e ld a, $25
ld [wStageCollisionMap + $110], a
ld a, $0
- ld [wd645], a
+ ld [wPsyduckState], a
.asm_1dda9
ld a, [wRightMapMoveCounter]
sub $3
@@ -1767,7 +1767,7 @@ UpdatePsyduck: ; 0x1dd2e ld a, $2
call LoadPsyduckOrPoliwagGraphics
ld a, $0
- ld [wd645], a
+ ld [wPsyduckState], a
ret
HitPoliwag3Times: ; 0x1ddc7
@@ -1840,7 +1840,7 @@ LoadPsyduckOrPoliwagGraphics: ; 0x1de4b or h
ret z
ld a, Bank(TileDataPointers_1df66)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
LoadPsyduckOrPoliwagNumberGraphics: ; 0x1de6f
@@ -1866,7 +1866,7 @@ LoadPsyduckOrPoliwagNumberGraphics: ; 0x1de6f or h
ret z
ld a, Bank(TileDataPointers_1e0a4)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
UpdateMapMoveCounters_BlueFieldBottom: ; 0x1de93
@@ -2175,9 +2175,9 @@ LoadPinballUpgradeTriggerGraphics_BlueField: ; 0x1e484 ld c, [hl]
inc hl
ld b, [hl]
- ld a, $7
+ ld a, Bank(TileDataPointers_1e520)
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
pop bc
ret
@@ -2402,9 +2402,9 @@ LoadCAVELightGraphics_BlueField: ; 0x1e636 ld c, [hl]
inc hl
ld b, [hl]
- ld a, $7
+ ld a, Bank(TileDataPointers_1e6d7)
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
pop bc
ret
@@ -2621,7 +2621,7 @@ DoSlotLogic_BlueField: ; 0x1e830 ld [wBonusStageSlotRewardActive], a
ld a, $1
ld [wd495], a
- ld [wd4ae], a
+ ld [wMoveToNextScreenState], a
ld a, [wd498]
ld c, a
ld b, $0
@@ -2708,7 +2708,7 @@ LoadSlotCaveCoverGraphics_BlueField: ; 0x1e8f6 or h
ret z
ld a, Bank(TileDataPointers_1e91e)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/blue_field/slot_cave.asm"
@@ -2986,7 +2986,7 @@ LoadArrowIndicatorGraphics_BlueStage: ; 0x1eb41 ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_1eb61)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/blue_field/arrow_indicators.asm"
@@ -3454,7 +3454,7 @@ UpdateForceFieldGraphics: ; 0x1f18a or h
ret z
ld a, Bank(TileDataPointers_1f1b5)
- call Func_10aa
+ call QueueGraphicsToLoad
ld a, $0
ld [wBlueStageForceFieldGfxNeedsLoading], a
.done
@@ -3479,9 +3479,9 @@ LoadPokeballsGraphics_BlueField: ; 0x1f265 ld c, a
ld a, [hli]
ld b, a
- ld a, $7
+ ld a, Bank(TileDataPointers_1f2b9)
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
UpdateBlinkingPokeballs_BlueField: ; 0x1f27b
diff --git a/engine/pinball_game/object_collision/diglett_bonus_resolve_collision.asm b/engine/pinball_game/object_collision/diglett_bonus_resolve_collision.asm index 4bfbba4..738010d 100644 --- a/engine/pinball_game/object_collision/diglett_bonus_resolve_collision.asm +++ b/engine/pinball_game/object_collision/diglett_bonus_resolve_collision.asm @@ -41,7 +41,7 @@ Func_19bbd: ; 0x19bbd ld h, [hl]
ld l, a
ld a, Bank(Data_19bda)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
Data_19bda:
@@ -355,7 +355,7 @@ Func_19da8: ; 0x19da8 ld h, [hl]
ld l, a
ld a, Bank(DiglettTileDataPointers)
- call Func_10aa
+ call QueueGraphicsToLoad
pop bc
ret
diff --git a/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm b/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm index c1c9f78..a343bf4 100644 --- a/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm +++ b/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm @@ -52,7 +52,7 @@ Func_183db: ; 0x183db ld h, [hl]
ld l, a
ld a, BANK(TileDataPointers_183f8)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
TileDataPointers_183f8:
@@ -885,9 +885,9 @@ Func_1894c: ; 0x1894c inc a
ld [wBallYPos + 1], a
.asm_18973
- ld a, [wd7a0]
+ ld a, [wUpperTiltPixelsOffset]
dec a
- ld [wd7a0], a
+ ld [wUpperTiltPixelsOffset], a
ld a, $1
ld [wUpperTiltPushing], a
ret
@@ -907,9 +907,9 @@ Func_1894c: ; 0x1894c jr z, .asm_189a5
dec a
ld [wd6a5], a
- ld a, [wd7a0]
+ ld a, [wUpperTiltPixelsOffset]
inc a
- ld [wd7a0], a
+ ld [wUpperTiltPixelsOffset], a
ret
.asm_189a5
@@ -1462,7 +1462,7 @@ Func_18d72: ; 0x18d72 or h
ret z
ld a, Bank(TileDataPointers_18ddb)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
Func_18d91: ; 0x18d91
diff --git a/engine/pinball_game/object_collision/meowth_bonus_resolve_collision.asm b/engine/pinball_game/object_collision/meowth_bonus_resolve_collision.asm index 730eeaf..8f0766d 100644 --- a/engine/pinball_game/object_collision/meowth_bonus_resolve_collision.asm +++ b/engine/pinball_game/object_collision/meowth_bonus_resolve_collision.asm @@ -274,7 +274,7 @@ Func_24516: ; 0x24516 ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_24533)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
TileDataPointers_24533: ; 0x24533
@@ -1894,7 +1894,7 @@ Func_24fa3: ; 0x24fa3 ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_25007)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
TileDataPointers_25007:
diff --git a/engine/pinball_game/object_collision/mewtwo_bonus_resolve_collision.asm b/engine/pinball_game/object_collision/mewtwo_bonus_resolve_collision.asm index 2b6229e..0a2192b 100644 --- a/engine/pinball_game/object_collision/mewtwo_bonus_resolve_collision.asm +++ b/engine/pinball_game/object_collision/mewtwo_bonus_resolve_collision.asm @@ -49,7 +49,7 @@ Func_194ac: ; 0x194ac ld h, [hl]
ld l, a
ld a, Bank(Data_194c9)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
Data_194c9:
diff --git a/engine/pinball_game/object_collision/red_stage_resolve_collision.asm b/engine/pinball_game/object_collision/red_stage_resolve_collision.asm index 3e534b4..6679037 100644 --- a/engine/pinball_game/object_collision/red_stage_resolve_collision.asm +++ b/engine/pinball_game/object_collision/red_stage_resolve_collision.asm @@ -160,7 +160,7 @@ LoadAgainTextGraphics: ; 0x14746 ld h, [hl]
ld l, a
ld a, BANK(AgainTextTileData)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
AgainTextTileData:
@@ -528,7 +528,7 @@ LoadDiglettGraphics: ; 0x149d9 or h
ret z
ld a, BANK(TileListDataPointers_14a11)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
LoadDiglettNumberGraphics: ; 0x149f5
@@ -548,7 +548,7 @@ LoadDiglettNumberGraphics: ; 0x149f5 or h
ret z
ld a, BANK(Data_14af5)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/red_field/diglett.asm"
@@ -736,7 +736,7 @@ UpdateSpinnerChargeGraphics_RedField: ; 0x14ece ld h, [hl]
ld l, a
ld a, BANK(TileDataPointers_14eeb)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/red_field/spinner.asm"
@@ -834,9 +834,9 @@ LoadCAVELightGraphics_RedField: ; 0x1523c ld c, [hl]
inc hl
ld b, [hl]
- ld a, $5
+ ld a, Bank(TileDataPointers_152dd)
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
pop bc
ret
@@ -1070,9 +1070,9 @@ LoadPinballUpgradeTriggerGraphics_RedField: ; 0x15465 ld c, [hl]
inc hl
ld b, [hl]
- ld a, $5
+ ld a, Bank(TileDataPointers_15511)
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
pop bc
ret
@@ -1224,7 +1224,7 @@ TransitionPinballUpgrade: ; 0x155a7 ld h, [hl]
ld l, a
ld a, Bank(PinballUpgradeTransition_TileDataPointers)
- call Func_10aa
+ call QueueGraphicsToLoad
; fall through
TransitionPinballUpgradePalette: ; 0x155bb
@@ -1243,7 +1243,7 @@ TransitionPinballUpgradePalette: ; 0x155bb ld b, [hl]
ld a, BANK(PinballUpgradeTransitionPalettes)
ld de, LoadPalettes
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
INCLUDE "data/queued_tiledata/ball_upgrade.asm"
@@ -1512,7 +1512,7 @@ LoadFieldStructureGraphics_RedField: ; 0x159f4 or h
ret z
ld a, Bank(TileDataPointers_15a3f)
- call Func_10aa
+ call QueueGraphicsToLoad
ld a, [wStageCollisionState]
ld [wd7f2], a
ret
@@ -1678,7 +1678,7 @@ LoadBumperGraphics_RedField: ; 0x15fc0 ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_16010)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
ApplyBumperCollision_RedField: ; 0x15fda
@@ -2067,7 +2067,7 @@ DoSlotLogic_RedField: ; 0x16352 ld [wBonusStageSlotRewardActive], a
ld a, $1
ld [wd495], a
- ld [wd4ae], a
+ ld [wMoveToNextScreenState], a
ld a, [wd498]
ld c, a
ld b, $0
@@ -2160,7 +2160,7 @@ LoadSlotCaveCoverGraphics_RedField: ; 0x16425 or h
ret z
ld a, Bank(TileDataPointers_1644d)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/red_field/slot_cave.asm"
@@ -2392,13 +2392,13 @@ UpdatePikachuSaverAnimation_RedField: ; 0x1669e cp $1
jr nz, .asm_166f7
xor a
- ld [wd85d], a
+ ld [wAudioEngineEnabled], a
call Func_310a
rst AdvanceFrame
ld a, $1
callba PlayPikachuSoundClip
ld a, $1
- ld [wd85d], a
+ ld [wAudioEngineEnabled], a
ld a, $ff
ld [wRumblePattern], a
ld a, $60
@@ -2602,7 +2602,7 @@ LoadStaryuGraphics_Top: ; 0x16859 or h
ret z
ld a, Bank(TileDataPointers_16899)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
LoadStaryuGraphics_Bottom: ; 0x16878
@@ -2624,7 +2624,7 @@ LoadStaryuGraphics_Bottom: ; 0x16878 or h
ret z
ld a, Bank(TileDataPointers_1695a)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/red_field/staryu_bumper.asm"
@@ -2678,7 +2678,7 @@ LoadArrowIndicatorGraphics_RedField: ; 0x169cd ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_169ed)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
INCLUDE "data/queued_tiledata/red_field/arrow_indicators.asm"
@@ -2839,7 +2839,7 @@ UpdateBonusMultiplierRailing_RedField: ; 0x16e51 ret
ShowBonusMultiplierMessage_RedField: ; 0x16ef5
- ld a, [wd5ca]
+ ld a, [wBottomTextEnabled]
and a
ret nz
ld a, [wd613]
@@ -2900,7 +2900,7 @@ LoadBonusMultiplierRailingGraphics_RedField_Gameboy: ; 0x16f38 ld h, [hl]
ld l, a
ld a, Bank(BonusMultiplierRailingTileDataPointers_16fc8)
- call Func_10aa
+ call QueueGraphicsToLoad
.asm_16f5c
pop af
ld bc, $0000
@@ -2919,7 +2919,7 @@ LoadBonusMultiplierRailingGraphics_RedField_Gameboy: ; 0x16f38 ld h, [hl]
ld l, a
ld a, Bank(BonusMultiplierRailingTileData_171e4)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
LoadBonusMultiplierRailingGraphics_RedField_GameboyColor: ; 0x16f7b
@@ -2937,7 +2937,7 @@ LoadBonusMultiplierRailingGraphics_RedField_GameboyColor: ; 0x16f7b ld h, [hl]
ld l, a
ld a, Bank(BonusMultiplierRailingTileDataPointers_17228)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
GetBCDForNextBonusMultiplier_RedField: ; 0x16f95
@@ -3002,9 +3002,9 @@ LoadPokeballsGraphics_RedField: ; 0x174d4 ld c, a
ld a, [hli]
ld b, a
- ld a, $5
+ ld a, Bank(TileDataPointers_17528)
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
UpdateBlinkingPokeballs_RedField: ; 0x174ea
diff --git a/engine/pinball_game/object_collision/seel_bonus_resolve_collision.asm b/engine/pinball_game/object_collision/seel_bonus_resolve_collision.asm index e169524..83d48db 100644 --- a/engine/pinball_game/object_collision/seel_bonus_resolve_collision.asm +++ b/engine/pinball_game/object_collision/seel_bonus_resolve_collision.asm @@ -87,7 +87,7 @@ Func_25d0e: ; 0x25d0e ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_25d2b)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
TileDataPointers_25d2b:
@@ -1161,7 +1161,7 @@ Func_262f4: ; 0x262f4 ld h, [hl]
ld l, a
ld a, Bank(TileDataPointers_2634a)
- call Func_10aa
+ call QueueGraphicsToLoad
ret
TileDataPointers_2634a:
diff --git a/engine/pinball_game/save_game.asm b/engine/pinball_game/save_game.asm index 624a1a9..c1d65a8 100644 --- a/engine/pinball_game/save_game.asm +++ b/engine/pinball_game/save_game.asm @@ -4,9 +4,9 @@ SaveGame: ; 0xda05 ld bc, $0004
call AdvanceFrames
call FadeOut
- ld a, [wd849]
+ ld a, [wUpdateAudioEngineUsingTimerInterrupt]
and a
- call nz, Func_e5d
+ call nz, ToggleAudioEngineUpdateMethod
call DisableLCD
ld hl, hSTAT
res 6, [hl]
diff --git a/engine/pinball_game/slot.asm b/engine/pinball_game/slot.asm index 3331fae..a81fc14 100644 --- a/engine/pinball_game/slot.asm +++ b/engine/pinball_game/slot.asm @@ -25,7 +25,7 @@ Func_ed8e: ; 0xed8e ld hl, HandleFlippers
call nz, BankSwitch
callba DrawSpritesForStage
- call Func_33e3
+ call UpdateBottomText
call CleanOAMBuffer
rst AdvanceFrame
ld a, [wd7af]
@@ -254,13 +254,13 @@ SlotRewardPikachuSaver: ; 0xef83 ld a, MAX_PIKACHU_SAVER_CHARGE
ld [wPikachuSaverCharge], a
xor a
- ld [wd85d], a
+ ld [wAudioEngineEnabled], a
call Func_310a
rst AdvanceFrame
ld a, $0
callba PlayPikachuSoundClip
ld a, $1
- ld [wd85d], a
+ ld [wAudioEngineEnabled], a
ret
SlotRewardBonusMultiplier: ; 0xefa7
diff --git a/engine/pinball_game/stage_init/init_blue_field.asm b/engine/pinball_game/stage_init/init_blue_field.asm index 747d1af..0200f2d 100644 --- a/engine/pinball_game/stage_init/init_blue_field.asm +++ b/engine/pinball_game/stage_init/init_blue_field.asm @@ -19,7 +19,7 @@ InitBlueField: ; 0x1c000 ld [hli], a
ld [hli], a ; wNumPokeballs
ld [hli], a ; wPokeballBlinkingCounter
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld [wd7be], a
ld [wCurrentMap], a ; PALLET_TOWN
ld a, $1
@@ -44,8 +44,8 @@ InitBlueField: ; 0x1c000 ld [wd64a], a
ld [wd643], a
ld [wd644], a
- ld [wd645], a
- ld [wd646], a
+ ld [wPsyduckState], a
+ ld [wPoliwagState], a
callba Start20SecondSaverTimer
callba GetBCDForNextBonusMultiplier_BlueField
ld a, $10
diff --git a/engine/pinball_game/stage_init/init_diglett_bonus.asm b/engine/pinball_game/stage_init/init_diglett_bonus.asm index a04b201..26af2ca 100644 --- a/engine/pinball_game/stage_init/init_diglett_bonus.asm +++ b/engine/pinball_game/stage_init/init_diglett_bonus.asm @@ -5,7 +5,7 @@ InitDiglettBonusStage: ; 0x199f2 xor a
ld [wStageCollisionState], a
ld a, $1
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, [wBallType]
ld [wBallTypeBackup], a
xor a
diff --git a/engine/pinball_game/stage_init/init_gengar_bonus.asm b/engine/pinball_game/stage_init/init_gengar_bonus.asm index 357de1c..65e313c 100644 --- a/engine/pinball_game/stage_init/init_gengar_bonus.asm +++ b/engine/pinball_game/stage_init/init_gengar_bonus.asm @@ -10,7 +10,7 @@ InitGengarBonusStage: ; 0x18099 ret
.asm_180ac
ld a, $1
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, [wBallType]
ld [wBallTypeBackup], a
xor a
diff --git a/engine/pinball_game/stage_init/init_meowth_bonus.asm b/engine/pinball_game/stage_init/init_meowth_bonus.asm index 178c90c..3e07fa6 100644 --- a/engine/pinball_game/stage_init/init_meowth_bonus.asm +++ b/engine/pinball_game/stage_init/init_meowth_bonus.asm @@ -12,7 +12,7 @@ InitMeowthBonusStage: ; 0x24000 ld [wBallType], a
ld [wCompletedBonusStage], a
ld a, $1
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, $40
ld [wMeowthXPosition], a
ld a, $20
diff --git a/engine/pinball_game/stage_init/init_mewtwo_bonus.asm b/engine/pinball_game/stage_init/init_mewtwo_bonus.asm index 26410e3..1c26004 100644 --- a/engine/pinball_game/stage_init/init_mewtwo_bonus.asm +++ b/engine/pinball_game/stage_init/init_mewtwo_bonus.asm @@ -5,7 +5,7 @@ InitMewtwoBonusStage: ; 0x1924f xor a
ld [wStageCollisionState], a
ld a, $1
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, [wBallType]
ld [wBallTypeBackup], a
xor a
diff --git a/engine/pinball_game/stage_init/init_red_field.asm b/engine/pinball_game/stage_init/init_red_field.asm index ba8d1f8..a40ace1 100644 --- a/engine/pinball_game/stage_init/init_red_field.asm +++ b/engine/pinball_game/stage_init/init_red_field.asm @@ -19,7 +19,7 @@ InitRedField: ; 0x30000 ld [hli], a
ld [hli], a ; wNumPokeballs
ld [hli], a ; wPokeballBlinkingCounter
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld [wd7be], a
ld [wCurrentMap], a ; PALLET_TOWN
ld a, $1
diff --git a/engine/pinball_game/stage_init/init_seel_bonus.asm b/engine/pinball_game/stage_init/init_seel_bonus.asm index ee51417..2af90c9 100644 --- a/engine/pinball_game/stage_init/init_seel_bonus.asm +++ b/engine/pinball_game/stage_init/init_seel_bonus.asm @@ -6,7 +6,7 @@ InitSeelBonusStage: ; 0x25a7c ld [wd4c8], a
ld [wStageCollisionState], a
ld a, $1
- ld [wd7ac], a
+ ld [wDisableHorizontalScrollForBallStart], a
ld a, [wBallType]
ld [wBallTypeBackup], a
xor a
diff --git a/engine/pinball_game/vertical_screen_transition.asm b/engine/pinball_game/vertical_screen_transition.asm index 57ae6bb..d534a21 100644 --- a/engine/pinball_game/vertical_screen_transition.asm +++ b/engine/pinball_game/vertical_screen_transition.asm @@ -16,13 +16,13 @@ FieldVerticalTransition: ; 0xe674 ld [hOBP0], a
ld [hOBP1], a
rst AdvanceFrame
- call Func_e5d
+ call ToggleAudioEngineUpdateMethod
call DisableLCD
call ClearOAMBuffer
call Func_1129
call LoadStageCollisionAttributes
call LoadStageData
- call Func_e5d
+ call ToggleAudioEngineUpdateMethod
call EnableLCD
ld a, $e4
ld [hBGP], a
@@ -37,13 +37,13 @@ LoadStageData: ; 0xe6c2 ld a, [wCurrentStage]
bit 0, a
ld a, $86
- jr z, .asm_e6d5
- ld a, [wd5ca]
+ jr z, .gotWindowYPos
+ ld a, [wBottomTextEnabled]
and a
ld a, $86
- jr nz, .asm_e6d5
+ jr nz, .gotWindowYPos
ld a, $90
-.asm_e6d5
+.gotWindowYPos
ld [hWY], a
ld hl, StageGfxPointers_GameBoy
ld a, [hGameBoyColorFlag]
@@ -61,7 +61,7 @@ LoadStageData: ; 0xe6c2 INCLUDE "data/stage_base_gfx.asm"
CheckStageTransition: ; 0xece9
- call Func_ed5e
+ call ScrollScreenToShowPinball
ld a, [wBallYPos + 1]
add $10
cp $18
@@ -99,7 +99,7 @@ CheckStageTransition: ; 0xece9 .youLose
ld a, $1
- ld [wd4ae], a
+ ld [wMoveToNextScreenState], a
callba HandleBallLoss
ret
@@ -143,9 +143,11 @@ BallMovingDownStageTransitions: ; 0xed4e db $FF ; STAGE_SEEL_BONUS
db $FF ; STAGE_SEEL_BONUS
-Func_ed5e: ; 0xed5e
+ScrollScreenToShowPinball: ; 0xed5e
+; When the ball is launched on the Blue and Red Fields, the screen starts off scrolled to the right.
+; However, when the balls rolls in on Bonus Stages, the screen does NOT scroll.
ld hl, wSCX
- ld a, [wd7ac]
+ ld a, [wDisableHorizontalScrollForBallStart]
and a
jr nz, .modify_scx_and_scy
ld a, [wBallXPos + 1]
@@ -154,7 +156,7 @@ Func_ed5e: ; 0xed5e jr nc, .okay1
ld a, -2
.okay1
- ld [wd7aa], a
+ ld [wUnused_d7aa], a ; This is not used
add [hl]
cp $22
jr z, .modify_scx_and_scy
@@ -163,11 +165,11 @@ Func_ed5e: ; 0xed5e ld [hl], a
.modify_scx_and_scy
ld a, [hl]
- ld hl, wd79f
+ ld hl, wLeftAndRightTiltPixelsOffset
sub [hl]
ld [hSCX], a
xor a
- ld hl, wd7a0
+ ld hl, wUpperTiltPixelsOffset
sub [hl]
ld [hSCY], a
ret
diff --git a/engine/pokedex.asm b/engine/pokedex.asm index e903bb8..be3c15f 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -59,7 +59,7 @@ LoadPokedexScreen: ; 0x2800e call Func_28ad1
call Func_28add
call CountNumSeenOwnedMons
- call Func_b66
+ call SetAllPalettesWhite
ld a, $f
call SetSongBank
ld de, $0004
diff --git a/engine/select_gameboy_target_menu.asm b/engine/select_gameboy_target_menu.asm index 339bc55..17fecaa 100644 --- a/engine/select_gameboy_target_menu.asm +++ b/engine/select_gameboy_target_menu.asm @@ -39,7 +39,7 @@ InitSelectGameboyTargetMenu: ; 0x800a ld [hSCY], a
call LoadGameboyTargetMenuGfx
call ClearOAMBuffer
- call Func_b66
+ call SetAllPalettesWhite
call EnableLCD
call FadeIn
ld hl, wScreenState
@@ -73,7 +73,7 @@ LoadGameboyTargetMenuGfx: ; 0x8049 ld a, Bank(SelectGameboyTarget_TileData)
ld bc, SelectGameboyTarget_TileData
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
SelectGameboyTargetGfxPointers: ; 0x8089
@@ -202,14 +202,14 @@ SelectCGBOrDMG: ; 0x8104 ld a, Bank(DMGSelected_TileData)
ld bc, DMGSelected_TileData
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
.cgb
ld a, Bank(CGBSelected_TileData)
ld bc, CGBSelected_TileData
ld de, LoadTileLists
- call Func_10c5
+ call QueueGraphicsToLoadWithFunc
ret
DMGSelected_TileData: ; 0x813a
diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 641b0cd..01a1aac 100644 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -29,7 +29,7 @@ FadeInTitlescreen: ; 0xc00e ld a, $2
ld [wTitleScreenPokeballAnimationCounter], a
call HandleTitlescreenAnimations
- call Func_b66
+ call SetAllPalettesWhite
ld a, $11
call SetSongBank
ld de, $0004
@@ -124,8 +124,8 @@ Start: ; 0x150 ld a, $a6 ld [hli], a ld a, $0 - ld [wd849], a - ld [wd84a], a + ld [wUpdateAudioEngineUsingTimerInterrupt], a + ld [wToggleAudioEngineUpdateMethod], a ld a, Bank(PlaySong_BankF) call SetSongBank call Func_23b @@ -222,8 +222,8 @@ SoftReset: ld a, $a6 ld [hli], a ld a, $0 - ld [wd849], a - ld [wd84a], a + ld [wUpdateAudioEngineUsingTimerInterrupt], a + ld [wToggleAudioEngineUpdateMethod], a ld a, BANK(Func_3c000) call SetSongBank ld a, [hSGBFlag] @@ -329,29 +329,30 @@ VBlank: ; 0x2f2 ld a, [wd8e1] and a call nz, Func_167b - ld a, [wd849] + ld a, [wUpdateAudioEngineUsingTimerInterrupt] and a - jr nz, .asm_37d - ld a, [wd85d] + jr nz, .skipAudioEngineUpdate + ld a, [wAudioEngineEnabled] and a call nz, UpdateSFX -.asm_37d - ld a, [wd84a] +.skipAudioEngineUpdate + ld a, [wToggleAudioEngineUpdateMethod] and a - jr z, .asm_39d + jr z, .skipTimerToggle + ; Enable timer interrupts for audio engine updating. xor a - ld [wd84a], a + ld [wToggleAudioEngineUpdateMethod], a ld a, $1 - ld [wd849], a - ld a, $bc + ld [wUpdateAudioEngineUsingTimerInterrupt], a + ld a, -68 ld [rTMA], a ld a, $0 ld [rTAC], a ld hl, rIE set 2, [hl] ld a, $4 - ld [rTAC], a -.asm_39d + ld [rTAC], a ; Timer interrupt will fire ~60 times per second +.skipTimerToggle ld hl, MBC5SRamBank ld a, [wd917] and a @@ -439,24 +440,25 @@ Timer: ; 0x418 push bc push de push hl - ld a, [wd849] + ld a, [wUpdateAudioEngineUsingTimerInterrupt] and a jr z, .asm_42a - ld a, [wd85d] + ld a, [wAudioEngineEnabled] and a call nz, UpdateSFX .asm_42a - ld a, [wd84a] + ld a, [wToggleAudioEngineUpdateMethod] and a - jr z, .asm_440 + jr z, .skipTimer xor a - ld [wd84a], a - ld [wd849], a + ld [wToggleAudioEngineUpdateMethod], a + ld [wUpdateAudioEngineUsingTimerInterrupt], a + ; disable timer ld a, $0 ld [rTAC], a ld hl, rIE res 2, [hl] -.asm_440 +.skipTimer pop hl pop de pop bc @@ -718,32 +720,6 @@ WaitForLCD: ; 0x60f jr nz, .delay40Cycles ret -Func_61b: ; 0x61b - ld a, [rLY] ; LY register (LCDC Y-Coordinate) - cp $40 - jr c, .asm_625 - cp $80 - jr c, .asm_63d -.asm_625 - ld a, [rLY] ; LY register (LCDC Y-Coordinate) - cp $40 - jr c, .asm_625 - cp $80 - jr nc, .asm_625 -.asm_62f - ld a, [rSTAT] - and $3 - jr nz, .asm_62f ; wait for lcd controller to finish transferring data - ld a, $15 -.wait - dec a - jr nz, .wait - nop - nop - nop -.asm_63d - ret - INCLUDE "home/copy.asm" ClearOAMBuffer: ; 0x916 @@ -807,472 +783,7 @@ SGBWait1750: ; 0x948 INCLUDE "home/random.asm" INCLUDE "home/joypad.asm" - -Func_b66: ; 0xb66 - ld a, [hGameBoyColorFlag] - and a - jr nz, .asm_b73 - xor a - ld [hBGP], a - ld [hOBP0], a - ld [hOBP1], a - ret - -.asm_b73 - ld de, rBGPI - ld hl, wPaletteData - ld b, $0 - ld c, $20 -.asm_b7d - ld a, b - ld [rBGPI], a - inc b - ld a, [rBGPD] - ld [hli], a - ld a, b - ld [rBGPI], a - inc b - ld a, [rBGPD] - ld [hli], a - dec c - jr nz, .asm_b7d - ld b, $0 - ld c, $20 -.asm_b92 - ld a, b - ld [rOBPI], a - inc b - ld a, [rOBPD] - ld [hli], a - ld a, b - ld [rOBPI], a - inc b - ld a, [rOBPD] - ld [hli], a - dec c - jr nz, .asm_b92 - ld de, rBGPI - ld b, $2 -.asm_ba8 - ld a, $80 - ld [de], a - inc de - ld c, $20 -.asm_bae - ld a, $ff - ld [de], a - ld [hli], a - ld a, $7f - ld [de], a - ld [hli], a - dec c - jr nz, .asm_bae - inc de - dec b - jr nz, .asm_ba8 - ret - -FadeIn: ; 0xbbe -; Fades palettes in from white screen. - ld a, [hGameBoyColorFlag] - and a - jp nz, FadeIn_GameboyColor - ; Regular Gameboy - ld hl, hBGP - ld de, wBGP - ld b, $3 -.loop - ld a, [de] - and $55 - ld c, a - ld a, [de] - and $aa - srl a - and c - ld [hli], a - inc de - dec b - jr nz, .loop - ld bc, $0002 - call AdvanceFrames - ld hl, hBGP - ld de, wBGP - ld b, $3 -.loop2 - ld a, [de] - and $aa - srl a - add [hl] - ld [hli], a - inc de - dec b - jr nz, .loop2 - ld bc, $0002 - call AdvanceFrames - ld hl, hBGP - ld de, wBGP - ld b, $3 -.loop3 - ld a, [de] - and $55 - ld c, a - ld a, [de] - and $aa - srl a - or c - add [hl] - ld [hli], a - inc de - dec b - jr nz, .loop3 - ld bc, $0002 - call AdvanceFrames - ret - -FadeIn_GameboyColor: ; 0xc19 -; Fades in to the target palette data in wPaletteData from wFadeBGPaletteData and wFadeOBJPaletteData -; Fade is completed after 16 frames of incrementally updating the palettes. - ld b, 16 ; fade takes 16 frames to complete -.loop - push bc - ld de, wPaletteData - ld hl, wFadeBGPaletteData - call FadeInStep - call SetFadedPalettes - pop bc - dec b - jr nz, .loop - ret - -FadeInStep: ; 0xc2d -; de = base palette data -; hl = faded palette data - ld a, b - cp $1 - jr z, .lastStep - ld c, $40 ; total number of colors in BG and OBJ palettes -.loop - push bc - ld a, [hli] - sub $42 - ld c, a - ld a, [hld] - sbc $8 - ld b, a ; subtracted 2 from each RGB value of the color - call GetNextFadedPalette - ld a, c - ld [hli], a - ld a, b - ld [hli], a - pop bc - dec c - jr nz, .loop - ret - -.lastStep - ld c, $40 ; total number of colors in BG and OBJ palettes -.loop2 - push bc - ld a, [hli] - sub $21 - ld c, a - ld a, [hld] - sbc $4 - ld b, a - call GetNextFadedPalette - ld a, c - ld [hli], a - ld a, b - ld [hli], a - pop bc - dec c - jr nz, .loop2 - ret - -GetNextFadedPalette: ; 0xc60 -; de = source palette data -; bc = target palette RGB - 2 -; Places the resulting palette RGB into bc - push hl - ld a, [de] - and %00011111 ; Target RGB Blue value - ld l, a - ld a, c - and %00011111 ; Current faded RBG Blue value - 2 - cp l - jr nc, .brighter - ; set the current faded Blue value to the target blue value. - ld a, c - and %11100000 - or l - ld c, a -.brighter - ld a, [de] - and %11100000 - ld l, a - inc de - ld a, [de] - srl a - rr l - srl a - rr l - ld a, c - and %11100000 - ld h, a - ld a, b - srl a - rr h - srl a - rr h - ld a, h - cp l - jr nc, .asm_ca3 - ld h, $0 - sla l - rl h - sla l - rl h - ld a, c - and $1f - or l - ld c, a - ld a, b - and $7c - or h - ld b, a -.asm_ca3 - ld a, [de] - and $7c - ld l, a - ld a, b - and $7c - cp l - jr nc, .asm_cb2 - ld a, b - and $3 - or l - ld b, a -.asm_cb2 - inc de - pop hl - ret - -FadeOut: ; 0xcb5 -; Fades palettes out to a white screen. - ld a, [hGameBoyColorFlag] - and a - jp nz, FadeOut_GameboyColor - ; Regular Gameboy - ld hl, hBGP - ld b, $3 -.loop - push bc - push hl - ld b, $3 -.loop2 - ld a, [hl] - and $55 - ld c, a - ld a, [hl] - and $aa - srl a - or c - cpl - inc a - add [hl] - ld [hli], a - dec b - jr nz, .loop2 - ld bc, $0002 - call AdvanceFrames - pop hl - pop bc - dec b - jr nz, .loop - xor a - ld hl, hBGP - ld [hli], a - ld [hli], a - ld [hl], a - ld bc, $0002 - call AdvanceFrames - ret - -FadeOut_GameboyColor: ; 0xcee -; Fades out to white RGB colors from the currently-loaded palettes. -; Fade is completed after 16 frames of incrementally updating the palettes. - ld hl, wFadeBGPaletteData - ld de, rBGPI - call LoadCurrentPalettesIntoFadePalettes - ld hl, wFadeOBJPaletteData - ld de, rOBPI - call LoadCurrentPalettesIntoFadePalettes - ld b, 16 ; fade takes 16 frames to complete -.loop - push bc - ld hl, wFadeBGPaletteData - call FadeOutStep - call SetFadedPalettes - pop bc - dec b - jr nz, .loop - ret - -FadeOutStep: ; 0xd11 -; hl = faded palette data - ld b, $40 -.asm_d13 - ld a, [hl] - and $1f - add $2 - ld e, a - cp $1f - jr c, .asm_d1f - ld e, $1f -.asm_d1f - ld a, [hl] - and $e0 - or e - ld [hl], a - ld a, [hli] - and $e0 - ld e, [hl] - dec hl - srl e - rr a - srl e - rr a - add $10 - ld e, a - jr nc, .asm_d38 - ld e, $f8 -.asm_d38 - ld d, $0 - sla e - rl d - sla e - rl d - ld a, [hl] - and $1f - or e - ld [hli], a - ld a, [hl] - and $7c - or d - ld [hl], a - ld a, [hl] - and $7c - add $8 - ld e, a - cp $7c - jr c, .asm_d58 - ld e, $7c -.asm_d58 - ld a, [hl] - and $3 - or e - ld [hli], a - dec b - jr nz, .asm_d13 - ret - -SetFadedPalettes: ; 0d61 -; Sets the current palette data to the faded palettes. - ld a, [rIE] - res 0, a - ld [rIE], a - ld hl, wFadeBGPaletteData - ld de, rBGPI - ld a, $80 - ld [de], a - inc de -.waitForVBlank - ld a, [rLY] - cp $90 - jr c, .waitForVBlank - ld b, $10 -.loadBGColorsLoop - ld a, [hli] - ld [de], a - ld a, [hli] - ld [de], a - ld a, [hli] - ld [de], a - ld a, [hli] - ld [de], a - dec b - jr nz, .loadBGColorsLoop - inc de - ld a, $80 - ld [de], a - inc de - ld b, $10 -.loadOBJColorsLoop - ld a, [hli] - ld [de], a - ld a, [hli] - ld [de], a - ld a, [hli] - ld [de], a - ld a, [hli] - ld [de], a - dec b - jr nz, .loadOBJColorsLoop - ld a, [rIE] - set 0, a - ld [rIE], a - ret - -LoadCurrentPalettesIntoFadePalettes: ; 0xd9d -; hl = destination for palette data -; de = source of palettes (rBGPI or rOBPI) - ld b, $0 - ld c, e - inc c - call WaitForLCD -.asm_da4 - call Func_61b -.asm_da7 - ld a, [rSTAT] - and $3 - jr nz, .asm_da7 ; wait for lcd controller to finish transferring data - ld a, b - ld [de], a - ld a, [$ff00+c] - ld [hli], a - inc b - ld a, b - ld [de], a - ld a, [$ff00+c] - ld [hli], a - inc b - ld a, b - ld [de], a - ld a, [$ff00+c] - ld [hli], a - inc b - ld a, b - ld [de], a - ld a, [$ff00+c] - ld [hli], a - inc b - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - ld a, b - cp $40 - jr nz, .asm_da4 - ret +INCLUDE "home/palettes.asm" Func_dd4: ; 0xdd4 ; Return a * l to hl @@ -1391,13 +902,18 @@ Modulo_C: ; 0xe55 and a ret -Func_e5d: ; 0xe5d +ToggleAudioEngineUpdateMethod: ; 0xe5d +; The audio engine is normally updated once every V-Blank interrupt. However, during pinball gameplay, +; the LCD is disabled (no V-Blanks) when the pinball is transitioning between the Top- and Bottom-halfs of +; the Red and Blue Fields. Therefore, the audio engine wouldn't get updated for a fraction of a second, which +; would has a noticeable pause in the music. To solve this, the Timer interrupt is enabled while the V-Blank is +; disabled, and the audio engine gets updated during the Timer interrupt. ld a, $1 - ld [wd84a], a -.asm_e62 - ld a, [wd84a] + ld [wToggleAudioEngineUpdateMethod], a +.wait + ld a, [wToggleAudioEngineUpdateMethod] and a - jr nz, .asm_e62 + jr nz, .wait ret DrawBottomMessageBox: ; 0xe69 @@ -1657,10 +1173,16 @@ Func_10a4: ; 0x10a4 Func_10a7: ; 0x10a7 jp Func_3ff -Func_10aa: ; 0x10aa +QueueGraphicsToLoad: ; 0x10aa +; Queues graphics data to be loaded into VRAM at the next available time. +; See the data/queued_tiledata/ directory to view the data that is loaded by this function. +; Input: hl = pointer to async tile data header +; byte 1 = number of chunks to load +; 2*(byte 1) = list of pointers to chunks +; a = bank of async tile data ld c, a ld a, [hli] - ld b, a ;bc = [hl]a + ld b, a .loop push bc ld a, c @@ -1677,14 +1199,19 @@ Func_10aa: ; 0x10aa inc bc pop af push hl - call Func_10c5 + call QueueGraphicsToLoadWithFunc pop hl pop bc dec b jr nz, .loop ret -Func_10c5: ; 0x10c5 +QueueGraphicsToLoadWithFunc: ; 0x10c5 +; Queues graphics data to be loaded into VRAM with the given function at the next available time. +; See the data/queued_tiledata/ directory to view the data that is loaded by this function. +; Input: de: function that is responsible for loading the chunk of VRAM data +; hl: pointer to data +; a: bank of data push af ld a, [rLCDC] bit 7, a @@ -2552,7 +2079,7 @@ Func_1ffc: ; 0x1ffc ld [wd807], a callba Func_3c000 ld a, $1 - ld [wd85d], a + ld [wAudioEngineEnabled], a ld a, $37 ; space character for player high scores name ld [wPlayerName], a ld [wPlayerName + 1], a @@ -3865,9 +3392,9 @@ HandleLeftTilt: ; 0x358c dec a ; move ball's position to the left by 1 pixel ld [wBallXPos + 1], a .skipBallMovement - ld a, [wd79f] + ld a, [wLeftAndRightTiltPixelsOffset] inc a - ld [wd79f], a + ld [wLeftAndRightTiltPixelsOffset], a ld a, $1 ld [wLeftTiltPushing], a ret @@ -3883,9 +3410,9 @@ HandleLeftTilt: ; 0x358c jr z, .done dec a ld [wLeftTiltCounter], a - ld a, [wd79f] + ld a, [wLeftAndRightTiltPixelsOffset] dec a - ld [wd79f], a + ld [wLeftAndRightTiltPixelsOffset], a ret .done @@ -3921,9 +3448,9 @@ HandleRightTilt: ; 0x35f3 inc a ; move ball's position to the right by 1 pixel ld [wBallXPos + 1], a .skipBallMovement - ld a, [wd79f] + ld a, [wLeftAndRightTiltPixelsOffset] dec a - ld [wd79f], a + ld [wLeftAndRightTiltPixelsOffset], a ld a, $1 ld [wRightTiltPushing], a ret @@ -3939,9 +3466,9 @@ HandleRightTilt: ; 0x35f3 jr z, .done dec a ld [wRightTiltCounter], a - ld a, [wd79f] + ld a, [wLeftAndRightTiltPixelsOffset] inc a - ld [wd79f], a + ld [wLeftAndRightTiltPixelsOffset], a ret .done @@ -3977,9 +3504,9 @@ HandleUpperTilt: ; 0x365a inc a ; move ball's position down by 1 pixel ld [wBallYPos + 1], a .skipBallMovement - ld a, [wd7a0] + ld a, [wUpperTiltPixelsOffset] dec a - ld [wd7a0], a + ld [wUpperTiltPixelsOffset], a ld a, $1 ld [wUpperTiltPushing], a ret @@ -3995,9 +3522,9 @@ HandleUpperTilt: ; 0x365a jr z, .done dec a ld [wUpperTiltCounter], a - ld a, [wd7a0] + ld a, [wUpperTiltPixelsOffset] inc a - ld [wd7a0], a + ld [wUpperTiltPixelsOffset], a ret .done diff --git a/home/copy.asm b/home/copy.asm index d8f2a74..79d156b 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -1,3 +1,29 @@ +Func_61b: ; 0x61b + ld a, [rLY] ; LY register (LCDC Y-Coordinate) + cp $40 + jr c, .asm_625 + cp $80 + jr c, .asm_63d +.asm_625 + ld a, [rLY] ; LY register (LCDC Y-Coordinate) + cp $40 + jr c, .asm_625 + cp $80 + jr nc, .asm_625 +.asm_62f + ld a, [rSTAT] + and $3 + jr nz, .asm_62f ; wait for lcd controller to finish transferring data + ld a, $15 +.wait + dec a + jr nz, .wait + nop + nop + nop +.asm_63d + ret + __memset_8: ; 0xc3e dec bc .asm_63f diff --git a/home/palettes.asm b/home/palettes.asm new file mode 100755 index 0000000..a038527 --- /dev/null +++ b/home/palettes.asm @@ -0,0 +1,466 @@ +SetAllPalettesWhite: ; 0xb66
+; Sets all BG and OBJ palettes to white.
+ ld a, [hGameBoyColorFlag]
+ and a
+ jr nz, .gameboyColor
+ xor a
+ ld [hBGP], a
+ ld [hOBP0], a
+ ld [hOBP1], a
+ ret
+
+.gameboyColor
+ ld de, rBGPI
+ ld hl, wPaletteData
+ ld b, $0
+ ld c, $20
+.asm_b7d
+ ld a, b
+ ld [rBGPI], a
+ inc b
+ ld a, [rBGPD]
+ ld [hli], a
+ ld a, b
+ ld [rBGPI], a
+ inc b
+ ld a, [rBGPD]
+ ld [hli], a
+ dec c
+ jr nz, .asm_b7d
+ ld b, $0
+ ld c, $20
+.asm_b92
+ ld a, b
+ ld [rOBPI], a
+ inc b
+ ld a, [rOBPD]
+ ld [hli], a
+ ld a, b
+ ld [rOBPI], a
+ inc b
+ ld a, [rOBPD]
+ ld [hli], a
+ dec c
+ jr nz, .asm_b92
+ ld de, rBGPI
+ ld b, $2
+.asm_ba8
+ ld a, $80
+ ld [de], a
+ inc de
+ ld c, $20
+.asm_bae
+ ld a, $ff
+ ld [de], a
+ ld [hli], a
+ ld a, $7f
+ ld [de], a
+ ld [hli], a
+ dec c
+ jr nz, .asm_bae
+ inc de
+ dec b
+ jr nz, .asm_ba8
+ ret
+
+FadeIn: ; 0xbbe
+; Fades palettes in from white screen.
+ ld a, [hGameBoyColorFlag]
+ and a
+ jp nz, FadeIn_GameboyColor
+ ; Regular Gameboy
+ ld hl, hBGP
+ ld de, wBGP
+ ld b, $3
+.loop
+ ld a, [de]
+ and $55
+ ld c, a
+ ld a, [de]
+ and $aa
+ srl a
+ and c
+ ld [hli], a
+ inc de
+ dec b
+ jr nz, .loop
+ ld bc, $0002
+ call AdvanceFrames
+ ld hl, hBGP
+ ld de, wBGP
+ ld b, $3
+.loop2
+ ld a, [de]
+ and $aa
+ srl a
+ add [hl]
+ ld [hli], a
+ inc de
+ dec b
+ jr nz, .loop2
+ ld bc, $0002
+ call AdvanceFrames
+ ld hl, hBGP
+ ld de, wBGP
+ ld b, $3
+.loop3
+ ld a, [de]
+ and $55
+ ld c, a
+ ld a, [de]
+ and $aa
+ srl a
+ or c
+ add [hl]
+ ld [hli], a
+ inc de
+ dec b
+ jr nz, .loop3
+ ld bc, $0002
+ call AdvanceFrames
+ ret
+
+FadeIn_GameboyColor: ; 0xc19
+; Fades in to the target palette data in wPaletteData from wFadeBGPaletteData and wFadeOBJPaletteData
+; Fade is completed after 16 frames of incrementally updating the palettes.
+ ld b, 16 ; fade takes 16 frames to complete
+.loop
+ push bc
+ ld de, wPaletteData
+ ld hl, wFadeBGPaletteData
+ call FadeInStep
+ call SetFadedPalettes
+ pop bc
+ dec b
+ jr nz, .loop
+ ret
+
+FadeInStep: ; 0xc2d
+; de = base palette data
+; hl = faded palette data
+ ld a, b
+ cp $1
+ jr z, .lastStep
+ ld c, $40 ; total number of colors in BG and OBJ palettes
+.loop
+ push bc
+ ld a, [hli]
+ sub $42
+ ld c, a
+ ld a, [hld]
+ sbc $8
+ ld b, a ; subtracted 2 from each RGB value of the color
+ call GetNextFadedPalette
+ ld a, c
+ ld [hli], a
+ ld a, b
+ ld [hli], a
+ pop bc
+ dec c
+ jr nz, .loop
+ ret
+
+.lastStep
+ ld c, $40 ; total number of colors in BG and OBJ palettes
+.loop2
+ push bc
+ ld a, [hli]
+ sub $21
+ ld c, a
+ ld a, [hld]
+ sbc $4
+ ld b, a
+ call GetNextFadedPalette
+ ld a, c
+ ld [hli], a
+ ld a, b
+ ld [hli], a
+ pop bc
+ dec c
+ jr nz, .loop2
+ ret
+
+GetNextFadedPalette: ; 0xc60
+; de = source palette data
+; bc = target palette RGB - 2
+; Places the resulting palette RGB into bc
+ push hl
+ ld a, [de]
+ and %00011111 ; Target RGB Blue value
+ ld l, a
+ ld a, c
+ and %00011111 ; Current faded RBG Blue value - 2
+ cp l
+ jr nc, .brighter
+ ; set the current faded Blue value to the target blue value.
+ ld a, c
+ and %11100000
+ or l
+ ld c, a
+.brighter
+ ld a, [de]
+ and %11100000
+ ld l, a
+ inc de
+ ld a, [de]
+ srl a
+ rr l
+ srl a
+ rr l
+ ld a, c
+ and %11100000
+ ld h, a
+ ld a, b
+ srl a
+ rr h
+ srl a
+ rr h
+ ld a, h
+ cp l
+ jr nc, .asm_ca3
+ ld h, $0
+ sla l
+ rl h
+ sla l
+ rl h
+ ld a, c
+ and $1f
+ or l
+ ld c, a
+ ld a, b
+ and $7c
+ or h
+ ld b, a
+.asm_ca3
+ ld a, [de]
+ and $7c
+ ld l, a
+ ld a, b
+ and $7c
+ cp l
+ jr nc, .asm_cb2
+ ld a, b
+ and $3
+ or l
+ ld b, a
+.asm_cb2
+ inc de
+ pop hl
+ ret
+
+FadeOut: ; 0xcb5
+; Fades palettes out to a white screen.
+ ld a, [hGameBoyColorFlag]
+ and a
+ jp nz, FadeOut_GameboyColor
+ ; Regular Gameboy
+ ld hl, hBGP
+ ld b, $3
+.loop
+ push bc
+ push hl
+ ld b, $3
+.loop2
+ ld a, [hl]
+ and $55
+ ld c, a
+ ld a, [hl]
+ and $aa
+ srl a
+ or c
+ cpl
+ inc a
+ add [hl]
+ ld [hli], a
+ dec b
+ jr nz, .loop2
+ ld bc, $0002
+ call AdvanceFrames
+ pop hl
+ pop bc
+ dec b
+ jr nz, .loop
+ xor a
+ ld hl, hBGP
+ ld [hli], a
+ ld [hli], a
+ ld [hl], a
+ ld bc, $0002
+ call AdvanceFrames
+ ret
+
+FadeOut_GameboyColor: ; 0xcee
+; Fades out to white RGB colors from the currently-loaded palettes.
+; Fade is completed after 16 frames of incrementally updating the palettes.
+ ld hl, wFadeBGPaletteData
+ ld de, rBGPI
+ call LoadCurrentPalettesIntoFadePalettes
+ ld hl, wFadeOBJPaletteData
+ ld de, rOBPI
+ call LoadCurrentPalettesIntoFadePalettes
+ ld b, 16 ; fade takes 16 frames to complete
+.loop
+ push bc
+ ld hl, wFadeBGPaletteData
+ call FadeOutStep
+ call SetFadedPalettes
+ pop bc
+ dec b
+ jr nz, .loop
+ ret
+
+FadeOutStep: ; 0xd11
+; hl = faded palette data
+ ld b, $40
+.asm_d13
+ ld a, [hl]
+ and $1f
+ add $2
+ ld e, a
+ cp $1f
+ jr c, .asm_d1f
+ ld e, $1f
+.asm_d1f
+ ld a, [hl]
+ and $e0
+ or e
+ ld [hl], a
+ ld a, [hli]
+ and $e0
+ ld e, [hl]
+ dec hl
+ srl e
+ rr a
+ srl e
+ rr a
+ add $10
+ ld e, a
+ jr nc, .asm_d38
+ ld e, $f8
+.asm_d38
+ ld d, $0
+ sla e
+ rl d
+ sla e
+ rl d
+ ld a, [hl]
+ and $1f
+ or e
+ ld [hli], a
+ ld a, [hl]
+ and $7c
+ or d
+ ld [hl], a
+ ld a, [hl]
+ and $7c
+ add $8
+ ld e, a
+ cp $7c
+ jr c, .asm_d58
+ ld e, $7c
+.asm_d58
+ ld a, [hl]
+ and $3
+ or e
+ ld [hli], a
+ dec b
+ jr nz, .asm_d13
+ ret
+
+SetFadedPalettes: ; 0d61
+; Sets the current palette data to the faded palettes.
+ ld a, [rIE]
+ res 0, a
+ ld [rIE], a
+ ld hl, wFadeBGPaletteData
+ ld de, rBGPI
+ ld a, $80
+ ld [de], a
+ inc de
+.waitForVBlank
+ ld a, [rLY]
+ cp $90
+ jr c, .waitForVBlank
+ ld b, $10
+.loadBGColorsLoop
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ dec b
+ jr nz, .loadBGColorsLoop
+ inc de
+ ld a, $80
+ ld [de], a
+ inc de
+ ld b, $10
+.loadOBJColorsLoop
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ dec b
+ jr nz, .loadOBJColorsLoop
+ ld a, [rIE]
+ set 0, a
+ ld [rIE], a
+ ret
+
+LoadCurrentPalettesIntoFadePalettes: ; 0xd9d
+; hl = destination for palette data
+; de = source of palettes (rBGPI or rOBPI)
+ ld b, $0
+ ld c, e
+ inc c
+ call WaitForLCD
+.asm_da4
+ call Func_61b
+.asm_da7
+ ld a, [rSTAT]
+ and $3
+ jr nz, .asm_da7 ; wait for lcd controller to finish transferring data
+ ld a, b
+ ld [de], a
+ ld a, [$ff00+c]
+ ld [hli], a
+ inc b
+ ld a, b
+ ld [de], a
+ ld a, [$ff00+c]
+ ld [hli], a
+ inc b
+ ld a, b
+ ld [de], a
+ ld a, [$ff00+c]
+ ld [hli], a
+ inc b
+ ld a, b
+ ld [de], a
+ ld a, [$ff00+c]
+ ld [hli], a
+ inc b
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ ld a, b
+ cp $40
+ jr nz, .asm_da4
+ ret
diff --git a/home/text.asm b/home/text.asm index b9bcea2..238af3a 100644 --- a/home/text.asm +++ b/home/text.asm @@ -4,8 +4,8 @@ Func_30db: ; 0x30db ld a, $86 ld [hWY], a ;force text bar up ld a, $1 - ld [wd5ca], a ;place 1 in ??? - ld [wd5cb], a + ld [wBottomTextEnabled], a + ld [wDisableDrawScoreboardInfo], a ret FillBottomMessageBufferWithBlackTile: ; 0x30e8 wipes the message buffer and disables all text @@ -445,7 +445,8 @@ Func_3309: ; 0x3309 inc de ret -HandleScrolling: ; 0x3325 activates while text is scrolling +HandleScrollingText: ; 0x3325 activates while text is scrolling +; Input: hl = pointer to scrolling_text struct ld a, [hli] ;if scrolling set to off, ret. and a ret z @@ -612,21 +613,22 @@ HandleStationaryText: ; 0x33c3 Handles stationary text ld [hl], $0 ret -Func_33e3: ; 0x33e3 - ld a, [wd5ca] +UpdateBottomText: ; 0x33e3 +; Updates the scrolling and/or stationary text messages in the bottom black bar. + ld a, [wBottomTextEnabled] and a - jr nz, .asm_33ed ;if ??? = z, load 0 into ???, else jump - ld [wd5cb], a + jr nz, .textEnabled + ld [wDisableDrawScoreboardInfo], a ret -.asm_33ed +.textEnabled ld c, $0 ld a, [wScrollingText1Enabled] and a jr z, .Scrolling1Off ;if scrolling text is enabled, scroll text and inc c. repeat for each struct push bc ld hl, wScrollingText1 - call HandleScrolling + call HandleScrollingText pop bc inc c .Scrolling1Off @@ -635,7 +637,7 @@ Func_33e3: ; 0x33e3 jr z, .Scrolling2Off push bc ld hl, wScrollingText2 - call HandleScrolling + call HandleScrollingText pop bc inc c .Scrolling2Off @@ -644,7 +646,7 @@ Func_33e3: ; 0x33e3 jr z, .Scrolling3Off push bc ld hl, wScrollingText3 - call HandleScrolling + call HandleScrollingText pop bc inc c .Scrolling3Off @@ -678,7 +680,7 @@ Func_33e3: ; 0x33e3 ld a, c and a ret nz ;if text has displayed, we are done, else - ld [wd5ca], a ;place 0 in ??? + ld [wBottomTextEnabled], a ; disable bottom text call FillBottomMessageBufferWithBlackTile ;fill with default data? ld a, [hGameBoyColorFlag] and a @@ -708,12 +710,12 @@ Func_3475: ; 0x3475 bit 0, a ;handle flippers if the stage has any callba nz, HandleFlippers callba DrawSpritesForStage - call Func_33e3 + call UpdateBottomText call CleanOAMBuffer rst AdvanceFrame - ld a, [wd5ca] + ld a, [wBottomTextEnabled] and a - jr nz, Func_3475 ;loops until wd5ca is zero + jr nz, Func_3475 ;loops until wBottomTextEnabled is zero ret FivePoints: ; 34a6 diff --git a/pokemon-reverse-engineering-tools b/pokemon-reverse-engineering-tools -Subproject 27b200e0e13cf3264c1b124bad73f3f998e21ed +Subproject 979c98a7c0f67ad6b9685b2d532c66a1f76ffb2 @@ -237,7 +237,8 @@ wCurrentStage:: ; 0xd4ac see constants/stage_constants.asm for list. bit 0 is 1 wd4ad:: ; 0xd4ad ds $1 -wd4ae:: ; 0xd4ae +wMoveToNextScreenState:: ; 0xd4ae +; This is set when the the screen state should advance, in the pinball game's core logic state. ds $1 wStageCollisionState:: ; 0xd4af @@ -741,10 +742,15 @@ wWildMonCollision:: ; 0xd5c7 ds $1 -wd5ca:: ; 0xd5ca set to 1 by a commonly called text function that is called at the start of catch and raises the score bar. set off by text handler if no text is ready to run. Possibly toggles if text is running? +wBottomTextEnabled:: ; 0xd5ca +; 1 = text messages in the bottom black bar are enabled +; 0 = disabled--the text won't appear even if LoadScrollingText is called ds $1 -wd5cb:: ; 0xd5cb set to 0 if the above is 0 during Func_33e3 +wDisableDrawScoreboardInfo:: ; 0xd5cb +; This is set when text messages are shown in the bottom black bar. +; 1 = Skip drawing the scoreboard icons in the bottom black bar. (num pokemon caught, number of balls left, score) +; 0 = Draw them. ds $1 scrolling_text: MACRO @@ -1030,10 +1036,10 @@ wd643:: ; 0xd643 wd644:: ; 0xd644 ds $1 -wd645:: ; 0xd645 +wPsyduckState:: ; 0xd645 ds $1 -wd646:: ; 0xd646 +wPoliwagState:: ; 0xd646 ds $1 wBonusMultiplierRailingEndLightDuration:: ; 0xd647 @@ -1660,10 +1666,12 @@ wd79c:: ; 0xd79c wd79e:: ; 0xd79e ds $1 -wd79f:: ; 0xd79f +wLeftAndRightTiltPixelsOffset:: ; 0xd79f +; Horizontal offset in pixels that the left and right tilt are currently moving the screen. ds $1 -wd7a0:: ; 0xd7a0 +wUpperTiltPixelsOffset:: ; 0xd7a0 +; Vertical offset in pixels that the upper tilt is currently moving the screen. ds $1 wLeftTiltCounter:: ; 0xd7a1 @@ -1693,13 +1701,19 @@ wRightTiltPushing:: ; 0xd7a8 wUpperTiltPushing:: ; 0xd7a9 ds $1 -wd7aa:: ; 0xd7aa +wUnused_d7aa:: ; 0xd7aa +; not actually used ds $1 wSCX:: ; 0xd7ab ds $1 -wd7ac:: ; 0xd7ac +wDisableHorizontalScrollForBallStart:: ; 0xd7ac +; Controls whether or not the screen will scroll to accomodate the pinball when its off-screen. +; When the ball is launched on the Blue and Red Fields, the screen starts off scrolled to the right. +; However, when the balls rolls in on Bonus Stages, the screen does NOT scroll. +; 1 = Disable the scrolling +; 0 = Enable the scrolling ds $1 wd7ad:: ; 0xd7ad @@ -1906,10 +1920,13 @@ wd812:: ; 0xd812 wd848:: ; 0xd848 ds $1 -wd849:: ; 0xd849 +wUpdateAudioEngineUsingTimerInterrupt:: ; 0xd849 +; See ToggleAudioEngineUpdateMethod function for more in-depth explanation. ds $1 -wd84a:: ; 0xd84a +wToggleAudioEngineUpdateMethod:: ; 0xd84a +; When this byte is set to 1, it toggles between the audio engine being updated by V-Blank vs. Timer Interrupt. +; See ToggleAudioEngineUpdateMethod function for more in-depth explanation. ds $1 wd84b:: ; 0xd84b @@ -1921,7 +1938,9 @@ wd84f:: ; 0xd84f wCurrentSongBank:: ; 0xd85b ds $2 -wd85d:: ; 0xd85d +wAudioEngineEnabled:: ; 0xd85d +; 1 = normal audio (music/sfx) engine is enabled +; 0 = disabled ds $1 wd85e:: ; 0xd85e |