summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchaos-lord <dd4791.mariokarter@hotmail.co.uk>2017-07-10 10:36:48 +0100
committerchaos-lord <dd4791.mariokarter@hotmail.co.uk>2017-07-10 10:36:48 +0100
commit430076ea81f618dfabd2a5dea79556f33b9680a6 (patch)
treecb2d1ab7bdf225c54bbbd0d0e96973bfc92f759a
parentb335e79de42104b4e1998df42bf19af9f7ad11ed (diff)
parent43cf288a358c84cee0b119eaedfec6d839a5a8d1 (diff)
Merge remote-tracking branch 'origin/master' into chaos_requests-tppfork
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/ball_upgrade.asm0
-rwxr-xr-xdata/queued_tiledata/blue_field/arrow_indicators.asm949
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/blue_field/ball_upgrade_triggers.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/blue_field/bonus_multiplier_railings.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/blue_field/bumpers.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/blue_field/cave_lights.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/blue_field/force_field.asm0
-rwxr-xr-xdata/queued_tiledata/blue_field/pokeballs.asm41
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/blue_field/poliwag_psyduck.asm0
-rwxr-xr-xdata/queued_tiledata/blue_field/slot_cave.asm160
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/blue_field/spinner.asm0
-rwxr-xr-xdata/queued_tiledata/red_field/arrow_indicators.asm863
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/red_field/ball_upgrade_triggers.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/red_field/bonus_multiplier_railings.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/red_field/bumpers.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/red_field/cave_lights.asm0
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/red_field/diglett.asm0
-rwxr-xr-xdata/queued_tiledata/red_field/pokeballs.asm37
-rwxr-xr-xdata/queued_tiledata/red_field/slot_cave.asm142
-rw-r--r--[-rwxr-xr-x]data/queued_tiledata/red_field/spinner.asm0
-rwxr-xr-xdata/queued_tiledata/red_field/staryu_bumper.asm247
-rwxr-xr-xdata/queued_tiledata/red_field/structures.asm804
-rwxr-xr-xdata/sgb.asm160
-rw-r--r--engine/copyright_screen.asm4
-rw-r--r--engine/erase_all_data_menu.asm4
-rw-r--r--engine/field_select_screen.asm4
-rw-r--r--engine/high_scores_screen.asm6
-rw-r--r--engine/options_screen.asm16
-rw-r--r--engine/pinball_game.asm18
-rw-r--r--engine/pinball_game/ball_gfx.asm5
-rw-r--r--engine/pinball_game/ball_loss/ball_loss.asm10
-rw-r--r--engine/pinball_game/ball_loss/ball_loss_blue_field.asm22
-rw-r--r--engine/pinball_game/ball_loss/ball_loss_red_field.asm16
-rw-r--r--engine/pinball_game/bonus_multiplier.asm4
-rw-r--r--engine/pinball_game/catchem_mode.asm20
-rwxr-xr-xengine/pinball_game/draw_num_party_mons_icon.asm36
-rwxr-xr-xengine/pinball_game/draw_pikachu_saver_icon.asm11
-rw-r--r--engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm15
-rw-r--r--engine/pinball_game/draw_sprites/draw_red_field_sprites.asm15
-rw-r--r--engine/pinball_game/draw_sprites/draw_sprites.asm28
-rwxr-xr-xengine/pinball_game/evolution_mode.asm916
-rw-r--r--engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm8
-rw-r--r--engine/pinball_game/evolution_mode/evolution_mode_red_field.asm8
-rw-r--r--engine/pinball_game/extra_ball.asm8
-rw-r--r--engine/pinball_game/load_stage_data/load_blue_field.asm30
-rw-r--r--engine/pinball_game/load_stage_data/load_gengar_bonus.asm2
-rw-r--r--engine/pinball_game/load_stage_data/load_meowth_bonus.asm2
-rw-r--r--engine/pinball_game/load_stage_data/load_mewtwo_bonus.asm2
-rw-r--r--engine/pinball_game/load_stage_data/load_red_field.asm44
-rw-r--r--engine/pinball_game/load_stage_data/load_seel_bonus.asm2
-rwxr-xr-xengine/pinball_game/map_move.asm729
-rw-r--r--engine/pinball_game/menu.asm4
-rw-r--r--engine/pinball_game/object_collision/blue_stage_resolve_collision.asm1540
-rw-r--r--engine/pinball_game/object_collision/diglett_bonus_resolve_collision.asm4
-rw-r--r--engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm26
-rw-r--r--engine/pinball_game/object_collision/meowth_bonus_resolve_collision.asm8
-rw-r--r--engine/pinball_game/object_collision/mewtwo_bonus_object_collision.asm6
-rw-r--r--engine/pinball_game/object_collision/red_stage_resolve_collision.asm2459
-rw-r--r--engine/pinball_game/object_collision/seel_bonus_resolve_collision.asm4
-rw-r--r--engine/pinball_game/save_game.asm2
-rw-r--r--engine/pinball_game/slot.asm4
-rw-r--r--engine/pinball_game/stage_init/init_stages.asm4
-rw-r--r--engine/pinball_game/timer.asm2
-rw-r--r--engine/pinball_game/vertical_screen_transition.asm6
-rw-r--r--engine/pokedex.asm4
-rw-r--r--engine/select_gameboy_target_menu.asm4
-rw-r--r--engine/titlescreen.asm8
-rw-r--r--home.asm1463
-rw-r--r--home/audio.asm101
-rw-r--r--home/copy.asm591
-rw-r--r--home/ir.asm457
-rw-r--r--home/joypad.asm131
-rw-r--r--home/random.asm129
-rw-r--r--macros.asm1
-rw-r--r--main.asm1897
m---------pokemon-reverse-engineering-tools0
-rw-r--r--sram.asm12
-rw-r--r--wram.asm77
78 files changed, 7218 insertions, 7114 deletions
diff --git a/data/queued_tiledata/ball_upgrade.asm b/data/queued_tiledata/ball_upgrade.asm
index 89ba1fc..89ba1fc 100755..100644
--- a/data/queued_tiledata/ball_upgrade.asm
+++ b/data/queued_tiledata/ball_upgrade.asm
diff --git a/data/queued_tiledata/blue_field/arrow_indicators.asm b/data/queued_tiledata/blue_field/arrow_indicators.asm
new file mode 100755
index 0000000..90485f2
--- /dev/null
+++ b/data/queued_tiledata/blue_field/arrow_indicators.asm
@@ -0,0 +1,949 @@
+TileDataPointers_1eb61:
+ dw TileDataPointers_1eb6b
+ dw TileDataPointers_1eb75
+ dw TileDataPointers_1eb7f
+ dw TileDataPointers_1eb87
+ dw TileDataPointers_1eb8f
+
+TileDataPointers_1eb6b: ; 0x1eb6b
+ dw TileData_1eb97
+ dw TileData_1eb9a
+ dw TileData_1eb9d
+ dw TileData_1eba0
+ dw TileData_1eba3
+
+TileDataPointers_1eb75: ; 0x1eb75
+ dw TileData_1eba6
+ dw TileData_1eba9
+ dw TileData_1ebac
+ dw TileData_1ebaf
+ dw TileData_1ebb2
+
+TileDataPointers_1eb7f: ; 0x1eb7f
+ dw TileData_1ebb5
+ dw TileData_1ebb8
+ dw TileData_1ebbb
+ dw TileData_1ebbe
+
+TileDataPointers_1eb87: ; 0x1eb87
+ dw TileData_1ebc1
+ dw TileData_1ebc6
+ dw TileData_1ebcb
+ dw TileData_1ebd0
+
+TileDataPointers_1eb8f: ; 0x1eb8f
+ dw TileData_1ebd5
+ dw TileData_1ebda
+ dw TileData_1ebdf
+ dw TileData_1ebe4
+
+TileData_1eb97: ; 0x1eb97
+ db $01
+ dw TileData_1ebe9
+
+TileData_1eb9a: ; 0x1eb9a
+ db $01
+ dw TileData_1ebf9
+
+TileData_1eb9d: ; 0x1eb9d
+ db $01
+ dw TileData_1ec09
+
+TileData_1eba0: ; 0x1eba0
+ db $01
+ dw TileData_1ec19
+
+TileData_1eba3: ; 0x1eba3
+ db $01
+ dw TileData_1ec29
+
+TileData_1eba6: ; 0x1eba6
+ db $01
+ dw TileData_1ec39
+
+TileData_1eba9: ; 0x1eba9
+ db $01
+ dw TileData_1ec49
+
+TileData_1ebac: ; 0x1ebac
+ db $01
+ dw TileData_1ec59
+
+TileData_1ebaf: ; 0x1ebaf
+ db $01
+ dw TileData_1ec69
+
+TileData_1ebb2: ; 0x1ebb2
+ db $01
+ dw TileData_1ec79
+
+TileData_1ebb5: ; 0x1ebb5
+ db $01
+ dw TileData_1ec89
+
+TileData_1ebb8: ; 0x1ebb8
+ db $01
+ dw TileData_1ec93
+
+TileData_1ebbb: ; 0x1ebbb
+ db $01
+ dw TileData_1ec9d
+
+TileData_1ebbe: ; 0x1ebbe
+ db $01
+ dw TileData_1eca7
+
+TileData_1ebc1: ; 0x1ebc1
+ db $02
+ dw TileData_1ecb1
+ dw TileData_1ecbb
+
+TileData_1ebc6: ; 0x1ebc6
+ db $02
+ dw TileData_1ecc5
+ dw TileData_1eccf
+
+TileData_1ebcb: ; 0x1ebcb
+ db $02
+ dw TileData_1ecd9
+ dw TileData_1ece3
+
+TileData_1ebd0: ; 0x1ebd0
+ db $02
+ dw TileData_1eced
+ dw TileData_1ecf7
+
+TileData_1ebd5: ; 0x1ebd5
+ db $02
+ dw TileData_1ed01
+ dw TileData_1ed0b
+
+TileData_1ebda: ; 0x1ebda
+ db $02
+ dw TileData_1ed15
+ dw TileData_1ed1f
+
+TileData_1ebdf: ; 0x1ebdf
+ db $02
+ dw TileData_1ed01
+ dw TileData_1ed0b
+
+TileData_1ebe4: ; 0x1ebe4
+ db $02
+ dw TileData_1ed15
+ dw TileData_1ed1f
+
+TileData_1ebe9: ; 0x1ebe9
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $3D
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $17
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $3D
+
+ db $00 ; terminator
+
+TileData_1ebf9: ; 0x1ebf9
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $3E
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $17
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $3D
+
+ db $00 ; terminator
+
+TileData_1ec09: ; 0x1ec09
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $3E
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $18
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $3D
+
+ db $00 ; terminator
+
+TileData_1ec19: ; 0x1ec19
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $3E
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $18
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $3E
+
+ db $00 ; terminator
+
+TileData_1ec29: ; 0x1ec29
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $3D
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $18
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $3D
+
+ db $00 ; terminator
+
+TileData_1ec39: ; 0x1ec39
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $3F
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $1D
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $3F
+
+ db $00 ; terminator
+
+TileData_1ec49: ; 0x1ec49
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $40
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $1D
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $3F
+
+ db $00 ; terminator
+
+TileData_1ec59: ; 0x1ec59
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $40
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $1E
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $3F
+
+ db $00 ; terminator
+
+TileData_1ec69: ; 0x1ec69
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $40
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $1E
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $40
+
+ db $00 ; terminator
+
+TileData_1ec79: ; 0x1ec79
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $40
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $1D
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $40
+
+ db $00 ; terminator
+
+TileData_1ec89: ; 0x1ec89
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $15
+ dw StageBlueFieldBottomBaseGameBoyGfx + $950
+ db Bank(StageBlueFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1ec93: ; 0x1ec93
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $15
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1F40
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ec9d: ; 0x1ec9d
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $15
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1F60
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1eca7: ; 0x1eca7
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $15
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1F80
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ecb1: ; 0x1ecb1
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $19
+ dw StageBlueFieldBottomBaseGameBoyGfx + $990
+ db Bank(StageBlueFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1ecbb: ; 0x1ecbb
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1B
+ dw StageBlueFieldBottomBaseGameBoyGfx + $9B0
+ db Bank(StageBlueFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1ecc5: ; 0x1ecc5
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $19
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2270
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1eccf: ; 0x1eccf
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1B
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2290
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ecd9: ; 0x1ecd9
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $19
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $22B0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ece3: ; 0x1ece3
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1B
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $22D0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1eced: ; 0x1eced
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $19
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $22F0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ecf7: ; 0x1ecf7
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1B
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2310
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ed01: ; 0x1ed01
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $23
+ dw StageBlueFieldBottomBaseGameBoyGfx + $A30
+ db Bank(StageBlueFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1ed0b: ; 0x1ed0b
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $25
+ dw StageBlueFieldBottomBaseGameBoyGfx + $A50
+ db Bank(StageBlueFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1ed15: ; 0x1ed15
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $23
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C00
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ed1f: ; 0x1ed1f
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $25
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C20
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ed29: ; 0x1ed29
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $23
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C40
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ed33: ; 0x1ed33
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $25
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C60
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1e3d: ; 0x1e3d
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $23
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C80
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1ed47: ; 0x1ed47
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $25
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1CA0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileDataPointers_1ed51: ; 0x1ed51
+ dw TileDataPointers_1ed5b
+ dw TileDataPointers_1ed65
+ dw TileDataPointers_1ed6f
+ dw TileDataPointers_1ed77
+ dw TileDataPointers_1ed7f
+
+TileDataPointers_1ed5b: ; 0x1ed5b
+ dw TileData_1ed87
+ dw TileData_1ed8a
+ dw TileData_1ed8d
+ dw TileData_1ed90
+ dw TileData_1ed93
+
+TileDataPointers_1ed65: ; 0x1ed65
+ dw TileData_1ed96
+ dw TileData_1ed99
+ dw TileData_1ed9c
+ dw TileData_1ed9f
+ dw TileData_1eda2
+
+TileDataPointers_1ed6f: ; 0x1ed6f
+ dw TileData_1eda5
+ dw TileData_1eda8
+ dw TileData_1edab
+ dw TileData_1edae
+
+TileDataPointers_1ed77: ; 0x1ed77
+ dw TileData_1edb1
+ dw TileData_1edb4
+ dw TileData_1edb7
+ dw TileData_1edba
+
+TileDataPointers_1ed7f: ; 0x1ed7f
+ dw TileData_1edbd
+ dw TileData_1edc0
+ dw TileData_1edc3
+ dw TileData_1edc6
+
+TileData_1ed87: ; 0x1ed87
+ db $01
+ dw TileData_1edc9
+
+TileData_1ed8a: ; 0x1ed8a
+ db $01
+ dw TileData_1edd9
+
+TileData_1ed8d: ; 0x1ed8d
+ db $01
+ dw TileData_1ede9
+
+TileData_1ed90: ; 0x1ed90
+ db $01
+ dw TileData_1edf9
+
+TileData_1ed93: ; 0x1ed93
+ db $01
+ dw TileData_1ee09
+
+TileData_1ed96: ; 0x1ed96
+ db $01
+ dw TileData_1ee19
+
+TileData_1ed99: ; 0x1ed99
+ db $01
+ dw TileData_1ee29
+
+TileData_1ed9c: ; 0x1ed9c
+ db $01
+ dw TileData_1ee39
+
+TileData_1ed9f: ; 0x1ed9f
+ db $01
+ dw TileData_1ee49
+
+TileData_1eda2: ; 0x1eda2
+ db $01
+ dw TileData_1ee59
+
+TileData_1eda5: ; 0x1eda5
+ db $01
+ dw TileData_1ee69
+
+TileData_1eda8: ; 0x1eda8
+ db $01
+ dw TileData_1ee75
+
+TileData_1edab: ; 0x1edab
+ db $01
+ dw TileData_1ee81
+
+TileData_1edae: ; 0x1edae
+ db $01
+ dw TileData_1ee8d
+
+TileData_1edb1: ; 0x1edb1
+ db $01
+ dw TileData_1ee99
+
+TileData_1edb4: ; 0x1edb4
+ db $01
+ dw TileData_1eea7
+
+TileData_1edb7: ; 0x1edb7
+ db $01
+ dw TileData_1eeb5
+
+TileData_1edba: ; 0x1edba
+ db $01
+ dw TileData_1eec3
+
+TileData_1edbd: ; 0x1edbd
+ db $01
+ dw TileData_1eed1
+
+TileData_1edc0: ; 0x1edc0
+ db $01
+ dw TileData_1eedf
+
+TileData_1edc3: ; 0x1edc3
+ db $01
+ dw TileData_1eeed
+
+TileData_1edc6: ; 0x1edc6
+ db $01
+ dw TileData_1eefb
+
+TileData_1edc9: ; 0x1edc9
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $31
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $0D
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $7C
+
+ db $00 ; terminator
+
+TileData_1edd9: ; 0x1edd9
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $32
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $0D
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $7C
+
+ db $00 ; terminator
+
+TileData_1ede9: ; 0x1ede9
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $32
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $0E
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $7C
+
+ db $00 ; terminator
+
+TileData_1edf9: ; 0x1edf9
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $32
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $0E
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $7D
+
+ db $00 ; terminator
+
+TileData_1ee09: ; 0x1ee09
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $64
+ db $31
+
+ db $01 ; number of tiles
+ dw vBGMap + $84
+ db $0E
+
+ db $01 ; number of tiles
+ dw vBGMap + $A5
+ db $7C
+
+ db $00 ; terminator
+
+TileData_1ee19: ; 0x1ee19
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $33
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $0F
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $7E
+
+ db $00 ; terminator
+
+TileData_1ee29: ; 0x1ee29
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $34
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $0F
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $7E
+
+ db $00 ; terminator
+
+TileData_1ee39: ; 0x1ee39
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $34
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $10
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $7E
+
+ db $00 ; terminator
+
+TileData_1ee49: ; 0x1ee49
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $34
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $10
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $7F
+
+ db $00 ; terminator
+
+TileData_1ee59: ; 0x1ee59
+ dw LoadTileLists
+ db $03 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $6F
+ db $33
+
+ db $01 ; number of tiles
+ dw vBGMap + $8F
+ db $10
+
+ db $01 ; number of tiles
+ dw vBGMap + $AE
+ db $7E
+
+ db $00 ; terminator
+
+TileData_1ee69: ; 0x1ee69
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $48
+ db $05
+
+ db $01 ; number of tiles
+ dw vBGMap + $68
+ db $06
+
+ db $00 ; terminator
+
+TileData_1ee75: ; 0x1ee75
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $48
+ db $07
+
+ db $01 ; number of tiles
+ dw vBGMap + $68
+ db $08
+
+ db $00 ; terminator
+
+TileData_1ee81: ; 0x1ee81
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $48
+ db $09
+
+ db $01 ; number of tiles
+ dw vBGMap + $68
+ db $0A
+
+ db $00 ; terminator
+
+TileData_1ee8d: ; 0x1ee8d
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $48
+ db $0B
+
+ db $01 ; number of tiles
+ dw vBGMap + $68
+ db $0C
+
+ db $00 ; terminator
+
+TileData_1ee99: ; 0x1ee99
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $4B
+ db $26, $27
+
+ db $02 ; number of tiles
+ dw vBGMap + $6B
+ db $28, $29
+
+ db $00 ; terminator
+
+TileData_1eea7: ; 0x1eea7
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $4B
+ db $2A, $2B
+
+ db $02 ; number of tiles
+ dw vBGMap + $6B
+ db $2C, $2D
+
+ db $00 ; terminator
+
+TileData_1eeb5: ; 0x1eeb5
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $4B
+ db $2E, $2F
+
+ db $02 ; number of tiles
+ dw vBGMap + $6B
+ db $30, $31
+
+ db $00 ; terminator
+
+TileData_1eec3: ; 0x1eec3
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $4B
+ db $32, $33
+
+ db $02 ; number of tiles
+ dw vBGMap + $6B
+ db $34, $35
+
+ db $00 ; terminator
+
+TileData_1eed1: ; 0x1eed1
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $49
+ db $16, $17
+
+ db $02 ; number of tiles
+ dw vBGMap + $69
+ db $18, $19
+
+ db $00 ; terminator
+
+TileData_1eedf: ; 0x1eedf
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $49
+ db $1A, $1B
+
+ db $02 ; number of tiles
+ dw vBGMap + $69
+ db $1C, $1D
+
+ db $00 ; terminator
+
+TileData_1eeed: ; 0x1eeed
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $49
+ db $1E, $1F
+
+ db $02 ; number of tiles
+ dw vBGMap + $69
+ db $20, $21
+
+ db $00 ; terminator
+
+TileData_1eefb: ; 0x1eefb
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $49
+ db $22, $23
+
+ db $02 ; number of tiles
+ dw vBGMap + $69
+ db $24, $25
+
+ db $00 ; terminator
diff --git a/data/queued_tiledata/blue_field/ball_upgrade_triggers.asm b/data/queued_tiledata/blue_field/ball_upgrade_triggers.asm
index 8a94024..8a94024 100755..100644
--- a/data/queued_tiledata/blue_field/ball_upgrade_triggers.asm
+++ b/data/queued_tiledata/blue_field/ball_upgrade_triggers.asm
diff --git a/data/queued_tiledata/blue_field/bonus_multiplier_railings.asm b/data/queued_tiledata/blue_field/bonus_multiplier_railings.asm
index 8c18c69..8c18c69 100755..100644
--- a/data/queued_tiledata/blue_field/bonus_multiplier_railings.asm
+++ b/data/queued_tiledata/blue_field/bonus_multiplier_railings.asm
diff --git a/data/queued_tiledata/blue_field/bumpers.asm b/data/queued_tiledata/blue_field/bumpers.asm
index d5f9bd2..d5f9bd2 100755..100644
--- a/data/queued_tiledata/blue_field/bumpers.asm
+++ b/data/queued_tiledata/blue_field/bumpers.asm
diff --git a/data/queued_tiledata/blue_field/cave_lights.asm b/data/queued_tiledata/blue_field/cave_lights.asm
index 183c42c..183c42c 100755..100644
--- a/data/queued_tiledata/blue_field/cave_lights.asm
+++ b/data/queued_tiledata/blue_field/cave_lights.asm
diff --git a/data/queued_tiledata/blue_field/force_field.asm b/data/queued_tiledata/blue_field/force_field.asm
index 522bed0..522bed0 100755..100644
--- a/data/queued_tiledata/blue_field/force_field.asm
+++ b/data/queued_tiledata/blue_field/force_field.asm
diff --git a/data/queued_tiledata/blue_field/pokeballs.asm b/data/queued_tiledata/blue_field/pokeballs.asm
new file mode 100755
index 0000000..781f0ab
--- /dev/null
+++ b/data/queued_tiledata/blue_field/pokeballs.asm
@@ -0,0 +1,41 @@
+TileDataPointers_1f2b9:
+ dw TileData_1f2c1
+ dw TileData_1f2cc
+ dw TileData_1f2d7
+ dw TileData_1f2e2
+
+TileData_1f2c1: ; 0x1f2c1
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw vBGMap + $107
+ db $B0, $B1, $B0, $B1, $B0, $B1
+
+ db $00 ; terminator
+
+TileData_1f2cc: ; 0x1f2cc
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw vBGMap + $107
+ db $AE, $AF, $B0, $B1, $B0, $B1
+
+ db $00 ; terminator
+
+TileData_1f2d7: ; 0x1f2d7
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw vBGMap + $107
+ db $AE, $AF, $AE, $AF, $B0, $B1
+
+ db $00 ; terminator
+
+TileData_1f2e2: ; 0x1f2e2
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw vBGMap + $107
+ db $AE, $AF, $AE, $AF, $AE, $AF
+
+ db $00 ; terminator
diff --git a/data/queued_tiledata/blue_field/poliwag_psyduck.asm b/data/queued_tiledata/blue_field/poliwag_psyduck.asm
index 7140e25..7140e25 100755..100644
--- a/data/queued_tiledata/blue_field/poliwag_psyduck.asm
+++ b/data/queued_tiledata/blue_field/poliwag_psyduck.asm
diff --git a/data/queued_tiledata/blue_field/slot_cave.asm b/data/queued_tiledata/blue_field/slot_cave.asm
new file mode 100755
index 0000000..c1af7f6
--- /dev/null
+++ b/data/queued_tiledata/blue_field/slot_cave.asm
@@ -0,0 +1,160 @@
+TileDataPointers_1e91e:
+ dw TileData_1e926
+ dw TileData_1e929
+ dw TileData_1e92c
+ dw TileData_1e931
+
+TileData_1e926: ; 0x1e926
+ db $01
+ dw TileData_1e936
+
+TileData_1e929: ; 0x1e929
+ db $01
+ dw TileData_1e93f
+
+TileData_1e92c: ; 0x1e92c
+ db $02
+ dw TileData_1e948
+ dw TileData_1e952
+
+TileData_1e931: ; 0x1e931
+ db $02
+ dw TileData_1e95c
+ dw TileData_1e966
+
+TileData_1e936: ; 0x1e936
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $229
+ db $EE, $EF
+
+ db $00 ; terminator
+
+TileData_1e93f: ; 0x1e93f
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $229
+ db $F0, $F1
+
+ db $00 ; terminator
+
+TileData_1e948: ; 0x1e948
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1F
+ dw StageBlueFieldBottomBaseGameBoyGfx + $9F0
+ db Bank(StageBlueFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1e952: ; 0x1e952
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $21
+ dw StageBlueFieldBottomBaseGameBoyGfx + $A10
+ db Bank(StageBlueFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1e95c: ; 0x1e95c
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1F
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1BC0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_1e966: ; 0x1e966
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $21
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1BE0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileDataPointers_1e970:
+ dw TileData_1e978
+ dw TileData_1e97d
+ dw TileData_1e980
+ dw TileData_1e983
+
+TileData_1e978: ; 0x1e978
+ db $02
+ dw TileData_1e986
+ dw TileData_1e98F
+
+TileData_1e97d: ; 0x1e97d
+ db $01
+ dw TileData_1e99b
+
+TileData_1e980: ; 0x1e980
+ db $01
+ dw TileData_1e9a4
+
+TileData_1e983: ; 0x1e983
+ db $01
+ dw TileData_1e9b2
+
+TileData_1e986: ; 0x1e986
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $229
+ db $F0, $F1
+
+ db $00 ; terminator
+
+TileData_1e98F: ; 0x1e98F
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $01 ; number of tiles
+ dw vBGMap + $224
+ db $D8
+
+ db $01 ; number of tiles
+ dw vBGMap + $22f
+ db $EC
+
+ db $00 ; terminator
+
+TileData_1e99b: ; 0x1e99b
+ dw LoadTileLists
+ db $02 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $229
+ db $F2, $F3
+
+ db $00 ; terminator
+
+TileData_1e9a4: ; 0x1e9a4
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw $9809
+ db $15, $16
+
+ db $02 ; terminator
+ dw vBGMap + $29
+ db $17, $18
+
+ db $00 ; terminator
+
+TileData_1e9b2: ; 0x1e9b2
+ dw LoadTileLists
+ db $04 ; total number of tiles
+
+ db $02 ; number of tiles
+ dw vBGMap + $9
+ db $19, $1A
+
+ db $02 ; terminator
+ dw vBGMap + $29
+ db $1B, $1C
+
+ db $00 ; terminator
diff --git a/data/queued_tiledata/blue_field/spinner.asm b/data/queued_tiledata/blue_field/spinner.asm
index 51ebf55..51ebf55 100755..100644
--- a/data/queued_tiledata/blue_field/spinner.asm
+++ b/data/queued_tiledata/blue_field/spinner.asm
diff --git a/data/queued_tiledata/red_field/arrow_indicators.asm b/data/queued_tiledata/red_field/arrow_indicators.asm
new file mode 100755
index 0000000..c23c29c
--- /dev/null
+++ b/data/queued_tiledata/red_field/arrow_indicators.asm
@@ -0,0 +1,863 @@
+TileDataPointers_169ed:
+ dw TileDataPointers_169f7
+ dw TileDataPointers_16a01
+ dw TileDataPointers_16a0b
+ dw TileDataPointers_16a0f
+ dw TileDataPointers_16a13
+
+TileDataPointers_169f7: ; 0x169f7
+ dw TileData_16a17
+ dw TileData_16a1e
+ dw TileData_16a25
+ dw TileData_16a2c
+ dw TileData_16a33
+
+TileDataPointers_16a01: ; 0x16a01
+ dw TileData_16a3a
+ dw TileData_16a41
+ dw TileData_16a48
+ dw TileData_16a4f
+ dw TileData_16a56
+
+TileDataPointers_16a0b: ; 0x16a0b
+ dw TileData_16a5d
+ dw TileData_16a60
+
+TileDataPointers_16a0f: ; 0x16a0f
+ dw TileData_16a63
+ dw TileData_16a66
+
+TileDataPointers_16a13: ; 0x16a13
+ dw TileData_16a69
+ dw TileData_16a6e
+
+TileData_16a17: ; 0x16a17
+ db $03
+ dw TileData_16a73
+ dw TileData_16a7d
+ dw TileData_16a87
+
+TileData_16a1e: ; 0x16a1e
+ db $03
+ dw TileData_16a91
+ dw TileData_16a9b
+ dw TileData_16aa5
+
+TileData_16a25: ; 0x16a25
+ db $03
+ dw TileData_16aaf
+ dw TileData_16ab9
+ dw TileData_16ac3
+
+TileData_16a2c: ; 0x16a2c
+ db $03
+ dw TileData_16acd
+ dw TileData_16ad7
+ dw TileData_16ae1
+
+TileData_16a33: ; 0x16a33
+ db $03
+ dw TileData_16aeb
+ dw TileData_16af5
+ dw TileData_16aff
+
+TileData_16a3a: ; 0x16a3a
+ db $03
+ dw TileData_16b09
+ dw TileData_16b13
+ dw TileData_16b1d
+
+TileData_16a41: ; 0x16a41
+ db $03
+ dw TileData_16b27
+ dw TileData_16b31
+ dw TileData_16b3b
+
+TileData_16a48: ; 0x16a48
+ db $03
+ dw TileData_16b45
+ dw TileData_16b4f
+ dw TileData_16b59
+
+TileData_16a4f: ; 0x16a4f
+ db $03
+ dw TileData_16b63
+ dw TileData_16b6d
+ dw TileData_16b77
+
+TileData_16a56: ; 0x16a56
+ db $03
+ dw TileData_16b81
+ dw TileData_16b8b
+ dw TileData_16b95
+
+TileData_16a5d: ; 0x16a5d
+ db $01
+ dw TileData_16b9f
+
+TileData_16a60: ; 0x16a60
+ db $01
+ dw TileData_16ba9
+
+TileData_16a63: ; 0x16a63
+ db $01
+ dw TileData_16bb3
+
+TileData_16a66: ; 0x16a66
+ db $01
+ dw TileData_16bbd
+
+TileData_16a69: ; 0x16a69
+ db $02
+ dw TileData_16bc7
+ dw TileData_16bd1
+
+TileData_16a6e: ; 0x16a6e
+ db $02
+ dw TileData_16bdb
+ dw TileData_16be5
+
+TileData_16a73: ; 0x16a73
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3A
+ dw StageRedFieldBottomBaseGameBoyGfx + $ba0
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16a7d: ; 0x16a7d
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3D
+ dw StageRedFieldBottomBaseGameBoyGfx + $bd0
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16a87: ; 0x16a87
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $40
+ dw StageRedFieldBottomBaseGameBoyGfx + $c00
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16a91: ; 0x16a91
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3A
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $380
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16a9b: ; 0x16a9b
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3D
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $3B0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16aa5: ; 0x16aa5
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $40
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $3E0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16aaf: ; 0x16aaf
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3A
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $3F0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16ab9: ; 0x16ab9
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3D
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $420
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16ac3: ; 0x16ac3
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $40
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $450
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16acd: ; 0x16acd
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3A
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $460
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16ad7: ; 0x16ad7
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3D
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $490
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16ae1: ; 0x16ae1
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $40
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $4C0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16aeb: ; 0x16aeb
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3A
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F30
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16af5: ; 0x16af5
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $3D
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F60
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16aff: ; 0x16aff
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $40
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F90
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b09: ; 0x16b09
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $41
+ dw StageRedFieldBottomBaseGameBoyGfx + $c10
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16b13: ; 0x16b13
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $44
+ dw StageRedFieldBottomBaseGameBoyGfx + $c40
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16b1d: ; 0x16b1d
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $47
+ dw StageRedFieldBottomBaseGameBoyGfx + $c70
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16b27: ; 0x16b27
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $41
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $4D0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b31: ; 0x16b31
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $44
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $500
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b3b: ; 0x16b3b
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $47
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $530
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b45: ; 0x16b45
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $41
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $540
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b4f: ; 0x16b4f
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $44
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $570
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b59: ; 0x16b59
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $47
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $5A0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b63: ; 0x16b63
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $41
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $5B0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b6d: ; 0x16b6d
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $44
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $5E0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b77: ; 0x16b77
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $47
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $610
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b81: ; 0x16b81
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $41
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1010
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b8b: ; 0x16b8b
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $44
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1040
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b95: ; 0x16b95
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $47
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1070
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16b9f: ; 0x16b9f
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $20
+ dw StageRedFieldBottomBaseGameBoyGfx + $a00
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16ba9: ; 0x16ba9
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $20
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1080
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16bb3: ; 0x16bb3
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $23
+ dw StageRedFieldBottomBaseGameBoyGfx + $a30
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16bbd: ; 0x16bbd
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $23
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $10B0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16bc7: ; 0x16bc7
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1C
+ dw StageRedFieldBottomBaseGameBoyGfx + $9c0
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16bd1: ; 0x16bd1
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1E
+ dw StageRedFieldBottomBaseGameBoyGfx + $9e0
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16bdb: ; 0x16bdb
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1C
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $6E0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16be5: ; 0x16be5
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $1E
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $700
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileDataPointers_16bef:
+ dw TileDataPointers_16bf9
+ dw TileDataPointers_16c03
+ dw TileDataPointers_16c0d
+ dw TileDataPointers_16c11
+ dw TileDataPointers_16c15
+
+TileDataPointers_16bf9: ; 0x16bf9
+ dw TileData_16c19
+ dw TileData_16c1c
+ dw TileData_16c1f
+ dw TileData_16c22
+ dw TileData_16c25
+
+TileDataPointers_16c03: ; 0x16c03
+ dw TileData_16c28
+ dw TileData_16c2b
+ dw TileData_16c2e
+ dw TileData_16c31
+ dw TileData_16c34
+
+TileDataPointers_16c0d: ; 0x16c0d
+ dw TileData_16c37
+ dw TileData_16c3a
+
+TileDataPointers_16c11: ; 0x16c11
+ dw TileData_16c3d
+ dw TileData_16c40
+
+TileDataPointers_16c15: ; 0x16c15
+ dw TileData_16c43
+ dw TileData_16c46
+
+TileData_16c19: ; 0x16c19
+ db $01
+ dw TileData_16c49
+
+TileData_16c1c: ; 0x16c1c
+ db $01
+ dw TileData_16c63
+
+TileData_16c1f: ; 0x16c1f
+ db $01
+ dw TileData_16c7d
+
+TileData_16c22: ; 0x16c22
+ db $01
+ dw TileData_16c97
+
+TileData_16c25: ; 0x16c25
+ db $01
+ dw TileData_16cb1
+
+TileData_16c28: ; 0x16c28
+ db $01
+ dw TileData_16ccb
+
+TileData_16c2b: ; 0x16c2b
+ db $01
+ dw TileData_16ce5
+
+TileData_16c2e: ; 0x16c2e
+ db $01
+ dw TileData_16cff
+
+TileData_16c31: ; 0x16c31
+ db $01
+ dw TileData_16d19
+
+TileData_16c34: ; 0x16c34
+ db $01
+ dw TileData_16d33
+
+TileData_16c37: ; 0x16c37
+ db $01
+ dw TileData_16d4d
+
+TileData_16c3a: ; 0x16c3a
+ db $01
+ dw TileData_16d5a
+
+TileData_16c3d: ; 0x16c3d
+ db $01
+ dw TileData_16d67
+
+TileData_16c40: ; 0x16c40
+ db $01
+ dw TileData_16d74
+
+TileData_16c43: ; 0x16c43
+ db $01
+ dw TileData_16d81
+
+TileData_16c46: ; 0x16c46
+ db $01
+ dw TileData_16d8f
+
+TileData_16c49: ; 0x16c49
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $23
+ db $5E
+
+ db $02
+ dw vBGMap + $43
+ db $5F, $60
+
+ db $02
+ dw vBGMap + $64
+ db $61, $62
+
+ db $01
+ dw vBGMap + $85
+ db $63
+
+ db $01
+ dw vBGMap + $A5
+ db $64
+
+ db $00
+
+TileData_16c63: ; 0x16c63
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $23
+ db $65
+
+ db $02
+ dw vBGMap + $43
+ db $66, $67
+
+ db $02
+ dw vBGMap + $64
+ db $61, $62
+
+ db $01
+ dw vBGMap + $85
+ db $63
+
+ db $01
+ dw vBGMap + $A5
+ db $64
+
+ db $00
+
+TileData_16c7d: ; 0x16c7d
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $23
+ db $65
+
+ db $02
+ dw vBGMap + $43
+ db $66, $67
+
+ db $02
+ dw vBGMap + $64
+ db $68, $69
+
+ db $01
+ dw vBGMap + $85
+ db $63
+
+ db $01
+ dw vBGMap + $A5
+ db $64
+
+ db $00
+
+TileData_16c97: ; 0x16c97
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $23
+ db $65
+
+ db $02
+ dw vBGMap + $43
+ db $66, $67
+
+ db $02
+ dw vBGMap + $64
+ db $68, $69
+
+ db $01
+ dw vBGMap + $85
+ db $6A
+
+ db $01
+ dw vBGMap + $A5
+ db $6B
+
+ db $00
+
+TileData_16cb1: ; 0x16cb1
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $23
+ db $5E
+
+ db $02
+ dw vBGMap + $43
+ db $5F, $60
+
+ db $02
+ dw vBGMap + $64
+ db $68, $69
+
+ db $01
+ dw vBGMap + $85
+ db $6A
+
+ db $01
+ dw vBGMap + $A5
+ db $6B
+
+ db $00
+
+TileData_16ccb: ; 0x16ccb
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $30
+ db $6C
+
+ db $02
+ dw vBGMap + $4F
+ db $6D, $6E
+
+ db $02
+ dw vBGMap + $6E
+ db $6F, $70
+
+ db $01
+ dw vBGMap + $8E
+ db $71
+
+ db $01
+ dw vBGMap + $AE
+ db $72
+
+ db $00
+
+TileData_16ce5: ; 0x16ce5
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $30
+ db $73
+
+ db $02
+ dw vBGMap + $4F
+ db $74, $75
+
+ db $02
+ dw vBGMap + $6E
+ db $6F, $70
+
+ db $01
+ dw vBGMap + $8E
+ db $71
+
+ db $01
+ dw vBGMap + $AE
+ db $72
+
+ db $00
+
+TileData_16cff: ; 0x16cff
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $30
+ db $73
+
+ db $02
+ dw vBGMap + $4F
+ db $74, $75
+
+ db $02
+ dw vBGMap + $6E
+ db $76, $77
+
+ db $01
+ dw vBGMap + $8E
+ db $71
+
+ db $01
+ dw vBGMap + $AE
+ db $72
+
+ db $00
+
+TileData_16d19: ; 0x16d19
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $30
+ db $73
+
+ db $02
+ dw vBGMap + $4F
+ db $74, $75
+
+ db $02
+ dw vBGMap + $6E
+ db $76, $77
+
+ db $01
+ dw vBGMap + $8E
+ db $78
+
+ db $01
+ dw vBGMap + $AE
+ db $79
+
+ db $00
+
+TileData_16d33: ; 0x16d33
+ dw LoadTileLists
+ db $07
+
+ db $01
+ dw vBGMap + $30
+ db $6C
+
+ db $02
+ dw vBGMap + $4F
+ db $6D, $6E
+
+ db $02
+ dw vBGMap + $6E
+ db $76, $77
+
+ db $01
+ dw vBGMap + $8E
+ db $78
+
+ db $01
+ dw vBGMap + $AE
+ db $79
+
+ db $00
+
+TileData_16d4d: ; 0x16d4d
+ dw LoadTileLists
+ db $03
+
+ db $01
+ dw vBGMap + $6
+ db $48
+
+ db $02
+ dw vBGMap + $26
+ db $49, $4A
+
+ db $00
+
+TileData_16d5a: ; 0x16d5a
+ dw LoadTileLists
+ db $03
+
+ db $01
+ dw vBGMap + $6
+ db $4B
+
+ db $02
+ dw vBGMap + $26
+ db $4C, $4D
+
+ db $00
+
+TileData_16d67: ; 0x16d67
+ dw LoadTileLists
+ db $03
+
+ db $01
+ dw vBGMap + $D
+ db $4E
+
+ db $02
+ dw vBGMap + $2C
+ db $4F, $50
+
+ db $00
+
+TileData_16d74: ; 0x16d74
+ dw LoadTileLists
+ db $03
+
+ db $01
+ dw vBGMap + $D
+ db $51
+
+ db $02
+ dw vBGMap + $2C
+ db $52, $53
+
+ db $00
+
+TileData_16d81: ; 0x16d81
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $49
+ db $40, $41
+
+ db $02
+ dw vBGMap + $69
+ db $42, $43
+
+ db $00
+
+TileData_16d8f: ; 0x16d8f
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $49
+ db $44, $45
+
+ db $02
+ dw vBGMap + $69
+ db $46, $47
+
+ db $00
diff --git a/data/queued_tiledata/red_field/ball_upgrade_triggers.asm b/data/queued_tiledata/red_field/ball_upgrade_triggers.asm
index 8a0076b..8a0076b 100755..100644
--- a/data/queued_tiledata/red_field/ball_upgrade_triggers.asm
+++ b/data/queued_tiledata/red_field/ball_upgrade_triggers.asm
diff --git a/data/queued_tiledata/red_field/bonus_multiplier_railings.asm b/data/queued_tiledata/red_field/bonus_multiplier_railings.asm
index 083ff40..083ff40 100755..100644
--- a/data/queued_tiledata/red_field/bonus_multiplier_railings.asm
+++ b/data/queued_tiledata/red_field/bonus_multiplier_railings.asm
diff --git a/data/queued_tiledata/red_field/bumpers.asm b/data/queued_tiledata/red_field/bumpers.asm
index c0fbc55..c0fbc55 100755..100644
--- a/data/queued_tiledata/red_field/bumpers.asm
+++ b/data/queued_tiledata/red_field/bumpers.asm
diff --git a/data/queued_tiledata/red_field/cave_lights.asm b/data/queued_tiledata/red_field/cave_lights.asm
index 20c09f3..20c09f3 100755..100644
--- a/data/queued_tiledata/red_field/cave_lights.asm
+++ b/data/queued_tiledata/red_field/cave_lights.asm
diff --git a/data/queued_tiledata/red_field/diglett.asm b/data/queued_tiledata/red_field/diglett.asm
index 65801b8..65801b8 100755..100644
--- a/data/queued_tiledata/red_field/diglett.asm
+++ b/data/queued_tiledata/red_field/diglett.asm
diff --git a/data/queued_tiledata/red_field/pokeballs.asm b/data/queued_tiledata/red_field/pokeballs.asm
new file mode 100755
index 0000000..fce8dcd
--- /dev/null
+++ b/data/queued_tiledata/red_field/pokeballs.asm
@@ -0,0 +1,37 @@
+TileDataPointers_17528:
+ dw TileData_17530
+ dw TileData_1753B
+ dw TileData_17546
+ dw TileData_17551
+
+TileData_17530: ; 0x17530
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw $9907
+ db $B0, $B1, $B0, $B1, $B0, $B1
+ db $00
+
+TileData_1753B: ; 0x1753B
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw $9907
+ db $AE, $AF, $B0, $B1, $B0, $B1
+ db $00
+
+TileData_17546: ; 0x17546
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw $9907
+ db $AE, $AF, $AE, $AF, $B0, $B1
+ db $00
+
+TileData_17551: ; 0x17551
+ db $06 ; total number of tiles
+
+ db $06 ; number of tiles
+ dw $9907
+ db $AE, $AF, $AE, $AF, $AE, $AF
+ db $00
diff --git a/data/queued_tiledata/red_field/slot_cave.asm b/data/queued_tiledata/red_field/slot_cave.asm
new file mode 100755
index 0000000..2a660b0
--- /dev/null
+++ b/data/queued_tiledata/red_field/slot_cave.asm
@@ -0,0 +1,142 @@
+TileDataPointers_1644d:
+ dw TileData_16455
+ dw TileData_16458
+ dw TileData_1645b
+ dw TileData_16460
+
+TileData_16455: ; 0x16455
+ db $01
+ dw TileData_16465
+
+TileData_16458: ; 0x16458
+ db $01
+ dw TileData_1646f
+
+TileData_1645b: ; 0x1645b
+ db $02
+ dw TileData_16479
+ dw TileData_16483
+
+TileData_16460: ; 0x16460
+ db $02
+ dw TileData_1648D
+ dw TileData_16497
+
+TileData_16465: ; 0x16465
+ dw Func_11d2
+ db $20, $02
+ dw vTilesSH tile $46
+ dw StageRedFieldTopBaseGameBoyGfx + $1c0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_1646f: ; 0x1646f
+ dw Func_11d2
+ db $20, $02
+ dw vTilesSH tile $46
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $340
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16479: ; 0x16479
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $48
+ dw StageRedFieldBottomBaseGameBoyGfx + $c80
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_16483: ; 0x16483
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $4A
+ dw StageRedFieldBottomBaseGameBoyGfx + $CA0
+ db Bank(StageRedFieldBottomBaseGameBoyGfx)
+ db $00
+
+TileData_1648D: ; 0x1648D
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $48
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $340
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16497: ; 0x16497
+ dw Func_11d2
+ db $20, $02
+ dw vTilesBG tile $4A
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $360
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileDataPointers_164a1:
+ dw TileData_164a9
+ dw TileData_164ac
+ dw TileData_164af
+ dw TileData_164b2
+
+TileData_164a9: ; 0x164a9
+ db $01
+ dw TileData_164b5
+
+TileData_164ac: ; 0x164ac
+ db $01
+ dw TileData_164be
+
+TileData_164af: ; 0x164af
+ db $01
+ dw TileData_164c7
+
+TileData_164b2: ; 0x164b2
+ db $01
+ dw TileData_164d5
+
+TileData_164b5: ; 0x164b5
+ dw LoadTileLists
+ db $02
+
+ db $02
+ dw vBGMap + $229
+ db $d4, $d5
+
+ db $00
+
+TileData_164be: ; 0x164be
+ dw LoadTileLists
+ db $02
+
+ db $02
+
+ dw vBGMap + $229
+ db $d6, $d7
+
+ db $00
+
+TileData_164c7: ; 0x164c7
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $9
+ db $38, $39
+
+ db $02
+ dw vBGMap + $29
+ db $3a, $3b
+
+ db $00
+
+TileData_164d5: ; 0x164d5
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $9
+ db $3c, $3d
+
+ db $02
+ dw vBGMap + $29
+ db $3e, $3f
+
+ db $00
diff --git a/data/queued_tiledata/red_field/spinner.asm b/data/queued_tiledata/red_field/spinner.asm
index 6876e28..6876e28 100755..100644
--- a/data/queued_tiledata/red_field/spinner.asm
+++ b/data/queued_tiledata/red_field/spinner.asm
diff --git a/data/queued_tiledata/red_field/staryu_bumper.asm b/data/queued_tiledata/red_field/staryu_bumper.asm
new file mode 100755
index 0000000..823e0ca
--- /dev/null
+++ b/data/queued_tiledata/red_field/staryu_bumper.asm
@@ -0,0 +1,247 @@
+TileDataPointers_16899:
+ dw TileData_168a1
+ dw TileData_168a8
+ dw TileData_168af
+ dw TileData_168af
+
+TileData_168a1: ; 0x168a1
+ db $03
+ dw TileData_168b6
+ dw TileData_168c0
+ dw TileData_168ca
+
+TileData_168a8: ; 0x168a8
+ db $03
+ dw TileData_168d4
+ dw TileData_168de
+ dw TileData_168e8
+
+TileData_168af: ; 0x168af
+ db $03
+ dw TileData_168f2
+ dw TileData_168fc
+ dw TileData_16906
+
+TileData_168b6: ; 0x168b6
+ dw Func_11d2
+ db $30, $03
+ dw vTilesSH tile $50
+ dw StageRedFieldTopBaseGameBoyGfx + $260
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_168c0: ; 0x168c0
+ dw Func_11d2
+ db $30, $03
+ dw vTilesSH tile $53
+ dw StageRedFieldTopBaseGameBoyGfx + $290
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_168ca: ; 0x168ca
+ dw Func_11d2
+ db $10, $01
+ dw vTilesSH tile $56
+ dw StageRedFieldTopBaseGameBoyGfx + $2c0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_168d4: ; 0x168d4
+ dw Func_11d2
+ db $30, $03
+ dw vTilesSH tile $52
+ dw StageRedFieldTopBaseGameBoyGfx + $280
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_168de: ; 0x168de
+ dw Func_11d2
+ db $20, $02
+ dw vTilesSH tile $55
+ dw StageRedFieldTopBaseGameBoyGfx + $2b0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_168e8: ; 0x168e8
+ dw Func_11d2
+ db $20, $02
+ dw vTilesSH tile $50
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $EA0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_168f2: ; 0x168f2
+ dw Func_11d2
+ db $30, $03
+ dw vTilesSH tile $51
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $10E0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_168fc: ; 0x168fc
+ dw Func_11d2
+ db $30, $03
+ dw vTilesSH tile $54
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1110
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_16906: ; 0x16906
+ dw Func_11d2
+ db $10, $01
+ dw vTilesSH tile $50
+ dw StageRedFieldTopBaseGameBoyGfx + $260
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileDataPointers_16910:
+ dw TileData_16918
+ dw TileData_1691b
+ dw TileData_1691e
+ dw TileData_1691e
+
+TileData_16918: ;0x16918
+ db $01
+ dw TileData_16921
+
+TileData_1691b: ;0x1691b
+ db $01
+ dw TileData_16934
+
+TileData_1691e: ;0x1691e
+ db $01
+ dw TileData_16947
+
+TileData_16921: ; 0x16921
+ dw LoadTileLists
+ db $06
+
+ db $03
+ dw vBGMap + $1C6
+ db $C3, $C4, $C5
+
+ db $02
+ dw vBGMap + $1E7
+ db $C6, $C7
+
+ db $01
+ dw vBGMap + $207
+ db $C8
+
+ db $00
+
+TileData_16934: ; 0x16934
+ dw LoadTileLists
+ db $06
+
+ db $03
+ dw vBGMap + $1C6
+ db $CD, $CE, $C5
+
+ db $02
+ dw vBGMap + $1E7
+ db $C6, $C7
+
+ db $01
+ dw vBGMap + $207
+ db $C8
+
+ db $00
+
+TileData_16947: ; 0x16947
+ dw LoadTileLists
+ db $06
+
+ db $03
+ dw vBGMap + $1C6
+ db $C3, $C4, $C9
+
+ db $02
+ dw vBGMap + $1E7
+ db $CA, $CB
+
+ db $01
+ dw vBGMap + $207
+ db $CC
+
+ db $00
+
+TileDataPointers_1695a:
+ dw TileData_1695e
+ dw TileData_16961
+
+TileData_1695e: ; 0x1695e
+ db $01
+ dw TileData_16964
+
+TileData_16961: ; 0x16961
+ db $01
+ dw TileData_16972
+
+TileData_16964: ; 0x16964
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $40
+ db $BE, $BF
+
+ db $02
+ dw vBGMap + $60
+ db $C0, $C1
+
+ db $00
+
+TileData_16972: ; 0x16972
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $40
+ db $C2, $C3
+
+ db $02
+ dw vBGMap + $60
+ db $C4, $C5
+
+ db $00
+
+TileDataPointers_16980:
+ dw TileData_16984
+ dw TileData_16987
+
+TileData_16984: ; 0x16984
+ db $01
+ dw TileData_1698a
+
+TileData_16987: ; 0x16987
+ db $01
+ dw TileData_16998
+
+TileData_1698a: ; 0x1698a
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $40
+ db $BC, $BD
+
+ db $02
+ dw vBGMap + $60
+ db $BE, $BF
+
+ db $00
+
+TileData_16998: ; 0x16998
+ dw LoadTileLists
+ db $04
+
+ db $02
+ dw vBGMap + $40
+ db $C0, $C1
+
+ db $02
+ dw vBGMap + $60
+ db $C2, $C3
+
+ db $00
diff --git a/data/queued_tiledata/red_field/structures.asm b/data/queued_tiledata/red_field/structures.asm
new file mode 100755
index 0000000..38f2d8d
--- /dev/null
+++ b/data/queued_tiledata/red_field/structures.asm
@@ -0,0 +1,804 @@
+TileDataPointers_15a3f:
+ dw $0000
+ dw TileData_15b71
+ dw TileData_15b16
+ dw TileData_15abf
+ dw TileData_15b23
+ dw TileData_15adc
+ dw TileData_15b2a
+ dw TileData_15af3
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15b16
+ dw $0000
+ dw TileData_15b23
+ dw $0000
+ dw TileData_15b2a
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15b71
+ dw TileData_15b3d
+ dw $0000
+ dw TileData_15b50
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15b82
+ dw $0000
+ dw $0000
+ dw TileData_15b3d
+ dw $0000
+ dw TileData_15b50
+ dw $0000
+ dw $0000
+ dw TileData_15b57
+ dw $0000
+ dw $0000
+ dw TileData_15b71
+ dw TileData_15b2a
+ dw $0000
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15b57
+ dw TileData_15b82
+ dw $0000
+ dw $0000
+ dw TileData_15b2a
+ dw $0000
+ dw $0000
+ dw TileData_15b6a
+ dw $0000
+ dw TileData_15b3d
+ dw $0000
+ dw $0000
+ dw TileData_15b71
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15b6a
+ dw $0000
+ dw TileData_15b3d
+ dw TileData_15b82
+ dw $0000
+
+TileData_15abf: ; 0x15abf
+ db $e
+ dw TileData_15b93
+ dw TileData_15b9d
+ dw TileData_15ba7
+ dw TileData_15bb1
+ dw TileData_15bbb
+ dw TileData_15bc5
+ dw TileData_15c0b
+ dw TileData_15c15
+ dw TileData_15c1f
+ dw TileData_15c29
+ dw TileData_15c33
+ dw TileData_15c3d
+ dw TileData_15c47
+ dw TileData_15c51
+
+TileData_15adc: ; 0x15adc
+ db $0b
+ dw TileData_15c0b
+ dw TileData_15c15
+ dw TileData_15c1f
+ dw TileData_15c29
+ dw TileData_15c33
+ dw TileData_15c3d
+ dw TileData_15c47
+ dw TileData_15c51
+ dw TileData_15ce7
+ dw TileData_15cf1
+ dw TileData_15cfb
+
+TileData_15af3: ; 0x15af3
+ db $11
+ dw TileData_15b93
+ dw TileData_15b9d
+ dw TileData_15ba7
+ dw TileData_15bb1
+ dw TileData_15bbb
+ dw TileData_15bc5
+ dw TileData_15c0b
+ dw TileData_15c15
+ dw TileData_15c1f
+ dw TileData_15c29
+ dw TileData_15c33
+ dw TileData_15c3d
+ dw TileData_15c47
+ dw TileData_15c51
+ dw TileData_15cab
+ dw TileData_15cb5
+ dw TileData_15cbf
+
+TileData_15b16: ; 0x15b16
+ db $06
+ dw TileData_15b93
+ dw TileData_15b9d
+ dw TileData_15ba7
+ dw TileData_15bb1
+ dw TileData_15bbb
+ dw TileData_15bc5
+
+TileData_15b23: ; 0x15b23
+ db $03
+ dw TileData_15ce7
+ dw TileData_15cf1
+ dw TileData_15cfb
+
+TileData_15b2a: ; 0x15b2a
+ db $09
+ dw TileData_15b93
+ dw TileData_15b9d
+ dw TileData_15ba7
+ dw TileData_15bb1
+ dw TileData_15bbb
+ dw TileData_15bc5
+ dw TileData_15cab
+ dw TileData_15cb5
+ dw TileData_15cbf
+
+TileData_15b3d: ; 0x15b3d
+ db $09
+ dw TileData_15bcf
+ dw TileData_15bd9
+ dw TileData_15be3
+ dw TileData_15bed
+ dw TileData_15bf7
+ dw TileData_15c01
+ dw TileData_15ce7
+ dw TileData_15cf1
+ dw TileData_15cfb
+
+TileData_15b50: ; 0x15b50
+ db $03
+ dw TileData_15cab
+ dw TileData_15cb5
+ dw TileData_15cbf
+
+TileData_15b57: ; 0x15b57
+ db $09
+ dw TileData_15b93
+ dw TileData_15b9d
+ dw TileData_15ba7
+ dw TileData_15bb1
+ dw TileData_15bbb
+ dw TileData_15bc5
+ dw TileData_15cc9
+ dw TileData_15cd3
+ dw TileData_15cdd
+
+TileData_15b6a: ; 0x15b6a
+ db $03
+ dw TileData_15cc9
+ dw TileData_15cd3
+ dw TileData_15cdd
+
+TileData_15b71: ; 0x15b71
+ db $08
+ dw TileData_15c0b
+ dw TileData_15c15
+ dw TileData_15c1f
+ dw TileData_15c29
+ dw TileData_15c33
+ dw TileData_15c3d
+ dw TileData_15c47
+ dw TileData_15c51
+
+TileData_15b82: ; 0x15b82
+ db $08
+ dw TileData_15c5b
+ dw TileData_15c65
+ dw TileData_15c6f
+ dw TileData_15c79
+ dw TileData_15c83
+ dw TileData_15c8d
+ dw TileData_15c97
+ dw TileData_15ca1
+
+TileData_15b93: ; 0x15b93
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $44
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15b9d: ; 0x15b9d
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $47
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $30
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15ba7: ; 0x15ba7
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $4A
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $60
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15bb1: ; 0x15bb1
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $4D
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $90
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15bbb: ; 0x15bbb
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $50
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $C0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15bc5: ; 0x15bc5
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $53
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15bcf: ; 0x15bcf
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $44
+ dw StageRedFieldTopBaseGameBoyGfx + $9a0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15bd9: ; 0x15bd9
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $47
+ dw StageRedFieldTopBaseGameBoyGfx + $9d0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15be3: ; 0x15be3
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $4A
+ dw StageRedFieldTopBaseGameBoyGfx + $a00
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15bed: ; 0x15bed
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $4D
+ dw StageRedFieldTopBaseGameBoyGfx + $a30
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15bf7: ; 0x15bf7
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $50
+ dw StageRedFieldTopBaseGameBoyGfx + $a60
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c01: ; 0x15c01
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $53
+ dw StageRedFieldTopBaseGameBoyGfx + $a90
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c0b: ; 0x15c0b
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $56
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $120
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c15: ; 0x15c15
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $59
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $150
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c1f: ; 0x15c1f
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $5C
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $180
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c29: ; 0x15c29
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $5F
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1B0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c33: ; 0x15c33
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $62
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1E0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c3d: ; 0x15c3d
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $65
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $210
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c47: ; 0x15c47
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $66
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $620
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c51: ; 0x15c51
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $69
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $650
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15c5b: ; 0x15c5b
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $56
+ dw StageRedFieldTopBaseGameBoyGfx + $ac0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c65: ; 0x15c65
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $59
+ dw StageRedFieldTopBaseGameBoyGfx + $af0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c6f: ; 0x15c6f
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $5C
+ dw StageRedFieldTopBaseGameBoyGfx + $b20
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c79: ; 0x15c79
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $5F
+ dw StageRedFieldTopBaseGameBoyGfx + $b50
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c83: ; 0x15c83
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $62
+ dw StageRedFieldTopBaseGameBoyGfx + $b80
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c8d: ; 0x15c8d
+ dw Func_11d2
+ db $10, $01
+ dw vTilesBG tile $65
+ dw StageRedFieldTopBaseGameBoyGfx + $bb0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15c97: ; 0x15c97
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $66
+ dw StageRedFieldTopBaseGameBoyGfx + $bc0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15ca1: ; 0x15ca1
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $69
+ dw StageRedFieldTopBaseGameBoyGfx + $bf0
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15cab: ; 0x15cab
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $6C
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2B0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15cb5: ; 0x15cb5
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $6F
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2E0
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15cbf: ; 0x15cbf
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $72
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $310
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15cc9: ; 0x15cc9
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $6C
+ dw StageRedFieldTopBaseGameBoyGfx + $c20
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15cd3: ; 0x15cd3
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $6F
+ dw StageRedFieldTopBaseGameBoyGfx + $c50
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15cdd: ; 0x15cdd
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $72
+ dw StageRedFieldTopBaseGameBoyGfx + $c80
+ db Bank(StageRedFieldTopBaseGameBoyGfx)
+ db $00
+
+TileData_15ce7: ; 0x15ce7
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $6C
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $220
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15cf1: ; 0x15cf1
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $6F
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $250
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileData_15cfb: ; 0x15cfb
+ dw Func_11d2
+ db $30, $03
+ dw vTilesBG tile $72
+ dw StageRedFieldBottomIndicatorsGfx_Gameboy + $280
+ db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
+ db $00
+
+TileDataPointers_15d05:
+ dw $0000
+ dw TileData_15db1
+ dw TileData_15d96
+ dw TileData_15d85
+ dw TileData_15d99
+ dw TileData_15d8a
+ dw TileData_15d9c
+ dw TileData_15d8f
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15d96
+ dw $0000
+ dw TileData_15d99
+ dw $0000
+ dw TileData_15d9c
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15db1
+ dw TileData_15da1
+ dw $0000
+ dw TileData_15da6
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15db4
+ dw $0000
+ dw $0000
+ dw TileData_15da1
+ dw $0000
+ dw TileData_15da6
+ dw $0000
+ dw $0000
+ dw TileData_15da9
+ dw $0000
+ dw $0000
+ dw TileData_15db1
+ dw TileData_15d9c
+ dw $0000
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15da9
+ dw TileData_15db4
+ dw $0000
+ dw $0000
+ dw TileData_15d9c
+ dw $0000
+ dw $0000
+ dw TileData_15dae
+ dw $0000
+ dw TileData_15da1
+ dw $0000
+ dw $0000
+ dw TileData_15db1
+ dw $0000
+ dw $0000
+ dw $0000
+ dw TileData_15dae
+ dw $0000
+ dw TileData_15da1
+ dw TileData_15db4
+ dw $0000
+
+TileData_15d85: ; 0x15d85
+ db $02
+ dw TileData_15db7
+ dw TileData_15df2
+
+TileData_15d8a: ; 0x15d8a
+ db $02
+ dw TileData_15df2
+ dw TileData_15e82
+
+TileData_15d8f: ; 0x15d8f
+ db $03
+ dw TileData_15db7
+ dw TileData_15df2
+ dw TileData_15e50
+
+TileData_15d96: ; 0x15d96
+ db $01
+ dw TileData_15db7
+
+TileData_15d99: ; 0x15d99
+ db $01
+ dw TileData_15e82
+
+TileData_15d9c: ; 0x15d9c
+ db $02
+ dw TileData_15db7
+ dw TileData_15e50
+
+TileData_15da1: ; 0x15da1
+ db $02
+ dw TileData_15dd5
+ dw TileData_15e82
+
+TileData_15da6: ; 0x15da6
+ db $01
+ dw TileData_15e50
+
+TileData_15da9: ; 0x15da9
+ db $02
+ dw TileData_15db7
+ dw TileData_15e69
+
+TileData_15dae: ; 0x15dae
+ db $01
+ dw TileData_15e69
+
+TileData_15db1: ; 0x15dab1
+ db $01
+ dw TileData_15df2
+
+TileData_15db4: ; 0x15db4
+ db $01
+ dw TileData_15e21
+
+TileData_15db7: ; 0x15db7
+ dw Func_1198
+
+ db ($a << 1)
+ db $03
+ dw vBGMap + $4c
+
+ db ($40 << 1)
+ db $09
+ dw vBGMap + $6c
+
+ db (($32 << 1) | 1)
+ db $08
+ dw vBGMap + $8d
+
+ db (4 << 1)
+ dw vBGMap + $ae
+
+ db (2 << 1)
+ dw vBGMap + $d0
+
+ db (2 << 1)
+ dw vBGMap + $f1
+
+ db (2 << 1)
+ dw vBGMap + $111
+
+ db (1 << 1)
+ dw vBGMap + $132
+
+ db $00 ; terminator
+
+TileData_15dd5: ; 0x15dd5
+ dw Func_1198
+
+ db ($a << 1)
+ db $03
+ dw vBGMap + $4c
+
+ db (($28 << 1) | 1)
+ db $08
+ dw vBGMap + $6c
+
+ db ($4 << 1)
+ dw vBGMap + $8d
+
+ db ($04 << 1)
+ dw vBGMap + $ae
+
+ db ($02 << 1)
+ dw vBGMap + $d0
+
+ db ($02 << 1)
+ dw vBGMap + $f1
+
+ db ($02 << 1)
+ dw vBGMap + $111
+
+ db (1 << 1)
+ dw vBGMap + $132
+
+ db $00 ; terminator
+
+TileData_15df2: ; 0x15df2
+ dw LoadTileLists
+ db $19 ; total number of tiles
+
+ db $05 ; number of tiles
+ dw vBGMap + $a9
+ db $1e, $1f, $20, $21, $22
+
+ db $07
+ dw vBGMap + $c7
+ db $23, $24, $39, $3a, $25, $3b, $26
+
+ db $08 ; number of tiles
+ dw vBGMap + $e6
+ db $27, $37, $28, $29, $2a, $2b, $3c, $2c
+
+ db $03 ; number of tiles
+ dw vBGMap + $106
+ db $2d, $38, $2e
+
+ db $01 ; number of tiles
+ dw vBGMap + $10d
+ db $2f
+
+ db $01 ; number of tiles
+ dw vBGMap + $126
+ db $30
+
+ db 00 ; terminator
+
+TileData_15e21: ; 0x15e21
+ dw LoadTileLists
+ db $19 ; total number of tiles
+
+ db $05 ; number of tiles
+ dw vBGMap + $a9
+ db $0b, $0c, $0d, $0e, $0f
+
+ db $07
+ dw vBGMap + $c7
+ db $10, $11, $33, $34, $12, $35, $13
+
+ db $08 ; number of tiles
+ dw vBGMap + $e6
+ db $14, $31, $15, $16, $17, $18, $36, $19
+
+ db $03 ; number of tiles
+ dw vBGMap + $106
+ db $1a, $32, $1b
+
+ db $01 ; number of tiles
+ dw vBGMap + $10d
+ db $1c
+
+ db $01 ; number of tiles
+ dw vBGMap + $126
+ db $1d
+
+ db 00 ; terminator
+
+TileData_15e50: ; 0x15e50
+ dw LoadTileLists
+ db $09 ; total number of tiles
+
+ db $03 ; number of tiles
+ dw vBGMap + $100
+ db $45, $46, $22
+
+ db $02 ; number of tiles
+ dw vBGMap + $120
+ db $45, $46
+
+ db $02 ; number of tiles
+ dw vBGMap + $140
+ db $45, $46
+
+ db $02 ; number of tiles
+ dw vBGMap + $160
+ db $45, $46
+
+ db $00 ; terminator
+
+TileData_15e69: ; 0x15e69
+ dw LoadTileLists
+ db $09 ; total number of tiles
+
+ db $03 ; number of tiles
+ dw vBGMap + $100
+ db $43, $44, $22
+
+ db $02 ; number of tiles
+ dw vBGMap + $120
+ db $45, $46
+
+ db $02 ; number of tiles
+ dw vBGMap + $140
+ db $45, $46
+
+ db $02 ; number of tiles
+ dw vBGMap + $160
+ db $45, $46
+
+ db $00 ; terminator
+
+TileData_15e82: ; 0x15e82
+ dw Func_1198
+
+ db ((4 << 1) | 1)
+ db $07
+ dw vBGMap + $100
+
+ db (($23 << 1) | 1)
+ db $04
+ dw vBGMap + $120
+
+ db (2 << 1)
+ dw vBGMap + $140
+
+ db (2 << 1)
+ dw vBGMap + $160
+
+ db $00 ; terminator
diff --git a/data/sgb.asm b/data/sgb.asm
new file mode 100755
index 0000000..16c65ca
--- /dev/null
+++ b/data/sgb.asm
@@ -0,0 +1,160 @@
+Data_38000:
+ db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+Data_38010:
+ db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+Data_38020:
+ db $51, $10, $00, $10, $00, $10, $00, $10, $00, $80, $00, $00, $00, $00, $00, $00
+
+Data_38030:
+ db $a9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+Data_3809a:
+ db $00, $00, $00
+ db $40, $40, $40
+ db $90, $90, $90
+ db $e4, $e4, $e4
+
+Data_380a6:
+ db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 30, 31, 29
+ RGB 28, 28, 25
+ RGB 27, 26, 24
+ RGB 24, 24, 24
+
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+ RGB 23, 23, 23
+
+ RGB 30, 31, 27
+ RGB 25, 26, 20
+ RGB 23, 21, 18
+ RGB 17, 17, 17
+
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+ RGB 15, 15, 15
+
+ RGB 29, 31, 25
+ RGB 22, 24, 15
+ RGB 19, 16, 12
+ RGB 10, 10, 10
+
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+ RGB 7, 7, 7
+
+ RGB 29, 31, 23
+ RGB 20, 22, 10
+ RGB 15, 12, 6
+ RGB 3, 3, 4
+
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+
+Data_38156:
+ db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ INCBIN "gfx/sgb_border.interleave.2bpp"
+
+Data_39166:
+ db $99, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ INCBIN "gfx/sgb_border_blank.2bpp"
+
+Data_3a176:
+ db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+ INCBIN "gfx/tilemaps/sgb_border.map"
+
+Data_3a9e6:
+ db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
+Data_3a9f6:
+ db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
+Data_3aa06:
+ db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
+Data_3aa16:
+ db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
+Data_3aa26:
+ db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
+Data_3aa36:
+ db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
+Data_3aa46:
+ db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
+Data_3aa56:
+ db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea
+Data_3aa66:
+ db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+Data_3aa76:
+ db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
diff --git a/engine/copyright_screen.asm b/engine/copyright_screen.asm
index 35a5329..c749043 100644
--- a/engine/copyright_screen.asm
+++ b/engine/copyright_screen.asm
@@ -21,7 +21,7 @@ FadeInCopyrightScreen: ; 0x8228
call LoadVideoData
call ClearOAMBuffer
call Func_b66
- call Func_588
+ call EnableLCD
call SGBNormal
ld bc, $0050
call AdvanceFrames
@@ -68,7 +68,7 @@ DisplayCopyrightScreen: ; 0x8290
FadeOutCopyrightScreenAndLoadData: ; 0x82a8
call FadeOut
- call Func_576
+ call DisableLCD
ld hl, sHighScores
ld de, wRedHighScore1Points
ld bc, $0082
diff --git a/engine/erase_all_data_menu.asm b/engine/erase_all_data_menu.asm
index 7504cf5..6ef174f 100644
--- a/engine/erase_all_data_menu.asm
+++ b/engine/erase_all_data_menu.asm
@@ -29,7 +29,7 @@ CheckForResetButtonCombo: ; 0x8167
call LoadVideoData
call ClearOAMBuffer
call Func_b66
- call Func_588
+ call EnableLCD
call SGBNormal
call FadeIn
ld hl, wScreenState
@@ -107,7 +107,7 @@ HandleEraseAllDataInput: ; 0x81d4
ExitEraseAllDataMenu: ; 0x820f
call FadeOut
- call Func_576
+ call DisableLCD
ld hl, wCurrentScreen
inc [hl]
xor a
diff --git a/engine/field_select_screen.asm b/engine/field_select_screen.asm
index 0033488..26dfc47 100644
--- a/engine/field_select_screen.asm
+++ b/engine/field_select_screen.asm
@@ -28,7 +28,7 @@ LoadFieldSelectScreen: ; 0xd6dd
call SetSongBank
ld de, $0003
call PlaySong
- call Func_588
+ call EnableLCD
call FadeIn
ld hl, wScreenState
inc [hl]
@@ -82,7 +82,7 @@ ExitFieldSelectScreen: ; 0xd774
ld a, [hJoypadState]
push af
call FadeOut
- call Func_576
+ call DisableLCD
ld a, [wd8f6]
bit BIT_A_BUTTON, a
jr z, .pressedB
diff --git a/engine/high_scores_screen.asm b/engine/high_scores_screen.asm
index 9823d67..09b16d6 100644
--- a/engine/high_scores_screen.asm
+++ b/engine/high_scores_screen.asm
@@ -164,7 +164,7 @@ Func_cb14: ; 0xcb14
ld de, $0002
call PlaySong
.asm_cba6
- call Func_588
+ call EnableLCD
ld bc, $0009
call Func_d68a
ld bc, $03c9
@@ -179,7 +179,7 @@ Func_cb14: ; 0xcb14
call SetSongBank
ld de, $0004
call PlaySong
- call Func_588
+ call EnableLCD
ld bc, $0009
call Func_d68a
ld bc, $03c9
@@ -944,7 +944,7 @@ Func_d159: ; 0xd159
ExitHighScoresScreen: ; 0xd171
call FadeOut
- call Func_576
+ call DisableLCD
ld hl, hSTAT
res 6, [hl]
ld hl, rIE
diff --git a/engine/options_screen.asm b/engine/options_screen.asm
index e29c96f..64f0f43 100644
--- a/engine/options_screen.asm
+++ b/engine/options_screen.asm
@@ -36,7 +36,7 @@ Func_c35a: ; 0xc35a
call SetSongBank
ld de, $0002
call PlaySong
- call Func_588
+ call EnableLCD
ld a, [wSoundTestCurrentBackgroundMusic]
hlCoord 7, 11, vBGMap
call RedrawSoundTestID
@@ -146,7 +146,7 @@ Func_c447: ; 0xc447
Func_c483: ; 0xc483
call FadeOut
- call Func_576
+ call DisableLCD
ld a, SCREEN_TITLESCREEN
ld [wCurrentScreen], a
xor a
@@ -163,8 +163,8 @@ Func_c493: ; 0xc493
lb de, $00, $01
call PlaySoundEffect
xor a
- ld [wd803], a
- ld [wd804], a
+ ld [wRumblePattern], a
+ ld [wRumbleDuration], a
ld a, $1
ld [wScreenState], a
ret
@@ -192,8 +192,8 @@ Func_c4b4: ; 0xc4b4
inc a
ld [wd917], a
xor a
- ld [wd803], a
- ld [wd804], a
+ ld [wRumblePattern], a
+ ld [wRumbleDuration], a
lb de, $00, $03
call PlaySoundEffect
ret
@@ -742,9 +742,9 @@ Func_c869: ; 0xc869
cp $1
ret nz
ld a, $55
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $40
- ld [wd804], a
+ ld [wRumbleDuration], a
ret
Func_c88a: ; 0xc88a
diff --git a/engine/pinball_game.asm b/engine/pinball_game.asm
index c0da4a9..3adce56 100644
--- a/engine/pinball_game.asm
+++ b/engine/pinball_game.asm
@@ -60,7 +60,7 @@ GameScreenFunction_StartBall: ; 0xd87f
xor a
ld [wd7c1], a
call Func_b66
- call Func_588
+ call EnableLCD
call FadeIn
ld hl, wScreenState
inc [hl]
@@ -153,8 +153,8 @@ GameScreenFunction_HandleBallPhysics: ; 0xd909
callba HideScoreIfBallLow
callba Func_8645
call Func_dba9
- call Func_dc7c
- call Func_dcb4
+ call DrawNumPartyMonsIcon
+ call DrawPikachuSaverLightningBoltIcon
.asm_d9e9
ld a, [wTimerActive]
and a
@@ -220,7 +220,7 @@ GameScreenFunction_HandleBallLoss: ; 0xda36
GameScreenFunction_EndBall: ; 0xdab2
xor a
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, [wGameOver]
and a
jp nz, TransitionToHighScoresScreen
@@ -234,7 +234,7 @@ GameScreenFunction_EndBall: ; 0xdab2
ld a, [wd849]
and a
call z, Func_e5d
- call Func_576
+ call DisableLCD
ld hl, hSTAT
res 6, [hl]
ld hl, rIE
@@ -252,7 +252,7 @@ GameScreenFunction_EndBall: ; 0xdab2
ld a, [wd849]
and a
call nz, Func_e5d
- call Func_576
+ call DisableLCD
ld hl, hSTAT
res 6, [hl]
ld hl, rIE
@@ -261,7 +261,7 @@ GameScreenFunction_EndBall: ; 0xdab2
ld [wd4ad], a
ld a, [wStageCollisionState]
ld [wd4b0], a
- ld a, [wd497]
+ ld a, [wNextStage]
ld [wCurrentStage], a
xor a
ld [wd496], a
@@ -279,7 +279,7 @@ GameScreenFunction_EndBall: ; 0xdab2
ld a, [wd849]
and a
call nz, Func_e5d
- call Func_576
+ call DisableLCD
ld hl, hSTAT
res 6, [hl]
ld hl, rIE
@@ -300,7 +300,7 @@ TransitionToHighScoresScreen: ; 0xdb5d
ld bc, $0004
call AdvanceFrames
call FadeOut
- call Func_576
+ call DisableLCD
ld hl, hSTAT
res 6, [hl]
ld hl, rIE
diff --git a/engine/pinball_game/ball_gfx.asm b/engine/pinball_game/ball_gfx.asm
index 2aff0d3..19e7cc1 100644
--- a/engine/pinball_game/ball_gfx.asm
+++ b/engine/pinball_game/ball_gfx.asm
@@ -80,11 +80,12 @@ LoadMiniBallGfx: ; 0xdd12
call LoadOrCopyVRAMData
ret
-Func_dd62: ; 0xdd62
+LoadSuperMiniPinballGfx: ; 0xdd62
+; Loads the mini pinball graphics, which are used when entering the Slot or Ditto caves.
ld a, $2
ld [wd4c8], a
ld a, $2a
- ld hl, PinballBallMiniGfx
+ ld hl, PinballBallSuperMiniGfx
ld de, vTilesOB tile $40
ld bc, $0200
call LoadOrCopyVRAMData
diff --git a/engine/pinball_game/ball_loss/ball_loss.asm b/engine/pinball_game/ball_loss/ball_loss.asm
index 06b0cda..0a3d8d9 100644
--- a/engine/pinball_game/ball_loss/ball_loss.asm
+++ b/engine/pinball_game/ball_loss/ball_loss.asm
@@ -32,3 +32,13 @@ CallTable_dc4d: ; 0xdc4d
dw HandleBallLossSeelBonus
; STAGE_SEEL_BONUS
dw HandleBallLossSeelBonus
+
+ShowBallLossText: ; 0xdc6d
+; Input: de = pointer to scrolling text header
+ push de
+ call FillBottomMessageBufferWithBlackTile
+ call Func_30db
+ ld hl, wScrollingText3
+ pop de
+ call LoadScrollingText
+ ret
diff --git a/engine/pinball_game/ball_loss/ball_loss_blue_field.asm b/engine/pinball_game/ball_loss/ball_loss_blue_field.asm
index bdde203..a6aee69 100644
--- a/engine/pinball_game/ball_loss/ball_loss_blue_field.asm
+++ b/engine/pinball_game/ball_loss/ball_loss_blue_field.asm
@@ -10,7 +10,7 @@ HandleBallLossBlueField: ; 0xde4f
ld [wNumTimesBallSavedTextWillDisplay], a
push af
ld de, BallSavedText
- call Func_dc6d
+ call ShowBallLossText
pop af
jr nz, .skip_save_text
ld a, $1
@@ -37,16 +37,16 @@ HandleBallLossBlueField: ; 0xde4f
call Func_ded6
ld a, [wCurBonusMultiplierFromFieldEvents]
and a
- jr z, .asm_deb6
+ jr z, .noExtraBall
dec a
ld [wCurBonusMultiplierFromFieldEvents], a
ld a, $1
- ld [wd49c], a
+ ld [wd49c], a ; Extra Ball
ld de, EndOfBallBonusText
- call Func_dc6d
+ call ShowBallLossText
ret
-.asm_deb6
+.noExtraBall
ld a, [wd49d]
ld hl, wd49e
cp [hl]
@@ -54,12 +54,12 @@ HandleBallLossBlueField: ; 0xde4f
inc a
ld [wd49d], a
ld de, EndOfBallBonusText
- call Func_dc6d
+ call ShowBallLossText
ret
.gameOver
ld de, EndOfBallBonusText
- call Func_dc6d
+ call ShowBallLossText
ld a, $1
ld [wGameOver], a
ret
@@ -78,16 +78,16 @@ Func_ded6: ; 0xded6
cp SPECIAL_MODE_CATCHEM
jr nz, .asm_df05
ld a, $0
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $1e
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
callba ConcludeEvolutionMode
ret
.asm_df05
ld a, $0
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $1e
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
callba Func_3022b
ret
diff --git a/engine/pinball_game/ball_loss/ball_loss_red_field.asm b/engine/pinball_game/ball_loss/ball_loss_red_field.asm
index 31f6b4c..03b2252 100644
--- a/engine/pinball_game/ball_loss/ball_loss_red_field.asm
+++ b/engine/pinball_game/ball_loss/ball_loss_red_field.asm
@@ -10,7 +10,7 @@ HandleBallLossRedField: ; 0xdd76
ld [wNumTimesBallSavedTextWillDisplay], a
push af
ld de, BallSavedText
- call Func_dc6d
+ call ShowBallLossText
pop af
jr nz, .skip_save_text
ld a, $1
@@ -43,7 +43,7 @@ HandleBallLossRedField: ; 0xdd76
ld a, $1
ld [wd49c], a
ld de, EndOfBallBonusText
- call Func_dc6d
+ call ShowBallLossText
ret
.asm_dddd
@@ -54,12 +54,12 @@ HandleBallLossRedField: ; 0xdd76
inc a
ld [wd49d], a
ld de, EndOfBallBonusText
- call Func_dc6d
+ call ShowBallLossText
ret
.gameOver
ld de, EndOfBallBonusText
- call Func_dc6d
+ call ShowBallLossText
ld a, $1
ld [wGameOver], a
ret
@@ -78,17 +78,17 @@ Func_ddfd: ; 0xddfd
cp SPECIAL_MODE_CATCHEM
jr nz, .asm_de2d
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $1e
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
callba ConcludeEvolutionMode
jr .asm_de40
.asm_de2d
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $1e
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
callba Func_3022b
.asm_de40
ld a, [wd7ad]
diff --git a/engine/pinball_game/bonus_multiplier.asm b/engine/pinball_game/bonus_multiplier.asm
index d286be3..f5f595d 100644
--- a/engine/pinball_game/bonus_multiplier.asm
+++ b/engine/pinball_game/bonus_multiplier.asm
@@ -9,12 +9,12 @@ IncrementBonusMultiplierFromFieldEvent: ; 0x30164
jr z, .maxed
ld [wCurBonusMultiplierFromFieldEvents], a
ld a, $1
- ld [wd4ca], a
+ ld [wShowExtraBallText], a
ret
.maxed
ld bc, TenMillionPoints
callba AddBigBCD6FromQueue
ld a, $2
- ld [wd4ca], a
+ ld [wShowExtraBallText], a
ret
diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm
index 0268589..d03bac1 100644
--- a/engine/pinball_game/catchem_mode.asm
+++ b/engine/pinball_game/catchem_mode.asm
@@ -1090,17 +1090,17 @@ ResetIndicatorStates: ; 0x107a5
Func_107b0: ; 0x107b0
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld [wIndicatorStates + 4], a
- callba Func_16425
+ callba LoadSlotCaveCoverGraphics_RedField
ret
Func_107c2: ; 0x107c2
ld a, $1e
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
ret
-Func_107c8: ; 0x107c8
+SetLeftAndRightAlleyArrowIndicatorStates_RedField: ; 0x107c8
ld a, [wRightAlleyCount]
cp $3
jr z, .asm_107d1
@@ -1232,7 +1232,7 @@ Func_10871: ; 0x10871
bit 0, a
jr nz, .asm_108d3
callba LoadStageCollisionAttributes
- callba Func_159f4
+ callba LoadFieldStructureGraphics_RedField
ret
.asm_108d3
@@ -1246,7 +1246,7 @@ Func_10871: ; 0x10871
Func_108f5: ; 0x108f5
call ResetIndicatorStates
call Func_107c2
- call Func_107c8
+ call SetLeftAndRightAlleyArrowIndicatorStates_RedField
call Func_107e9
ld a, [wCurrentStage]
bit 0, a
@@ -1268,7 +1268,7 @@ Func_108f5: ; 0x108f5
ld a, BANK(BlankSaverSpaceTileDataRedField)
call Func_10aa
ld a, [wPreviousNumPokeballs]
- callba Func_174d4
+ callba LoadPokeballsGraphics_RedField
ld hl, CaughtPokeballTileDataPointers
ld a, BANK(CaughtPokeballTileDataPointers)
call Func_10aa
@@ -1358,7 +1358,7 @@ Func_1098c: ; 0x1098c
jr nz, .loop
xor a
ld [wRightAlleyCount], a
- callba Func_1f2ed
+ callba CloseSlotCave
ld de, $0002
call PlaySong
ld a, [wCurrentStage]
@@ -1377,7 +1377,7 @@ Func_1098c: ; 0x1098c
Func_109fc: ; 0x109fc
call ResetIndicatorStates
call Func_107c2
- callba Func_1f2ff
+ callba SetLeftAndRightAlleyArrowIndicatorStates_BlueField
ld a, [wCurrentStage]
bit 0, a
ret z
@@ -1398,7 +1398,7 @@ Func_109fc: ; 0x109fc
ld a, BANK(BlankSaverSpaceTileDataBlueField)
call Func_10aa
ld a, [wPreviousNumPokeballs]
- callba Func_174d4
+ callba LoadPokeballsGraphics_RedField
ld hl, Data_10a88
ld a, BANK(Data_10a88)
call Func_10aa
diff --git a/engine/pinball_game/draw_num_party_mons_icon.asm b/engine/pinball_game/draw_num_party_mons_icon.asm
new file mode 100755
index 0000000..66ad891
--- /dev/null
+++ b/engine/pinball_game/draw_num_party_mons_icon.asm
@@ -0,0 +1,36 @@
+DrawNumPartyMonsIcon: ; 0xdc7c
+; Draws the number of party Pokemon on the left side of the score bar on the bottom of the screen.
+ ld hl, wBottomMessageBuffer + $40
+ ld a, $83
+ ld [hli], a
+ ld a, $81
+ ld [hli], a
+ ld a, $81
+ ld [hl], a
+ ld a, [wNumPartyMons]
+ call ConvertHexByteToDecWord
+ ld hl, wBottomMessageBuffer + $41
+ ld c, $1
+ ld a, d
+ call .drawDigit
+ ld a, e
+ swap a
+ call .drawDigit
+ ld a, e
+ ld c, $0
+.drawDigit
+ and $f
+ jr nz, .asm_dca7
+ ld a, c
+ and a
+ ret nz
+.asm_dca7
+ ld c, $0
+ add $86
+ ld [hli], a
+ ret
+
+UnusedData_dcad:
+; BCD powers of 2
+; unused
+ db $01, $02, $04, $08, $16, $32, $64
diff --git a/engine/pinball_game/draw_pikachu_saver_icon.asm b/engine/pinball_game/draw_pikachu_saver_icon.asm
new file mode 100755
index 0000000..2b915c4
--- /dev/null
+++ b/engine/pinball_game/draw_pikachu_saver_icon.asm
@@ -0,0 +1,11 @@
+DrawPikachuSaverLightningBoltIcon: ; 0xdcb4
+; Draws the lightning bolt icon when Pikachu saver has been fully charged.
+; The ligntning bolt is drawn in the score bar at the bottom of the screen.
+ ld a, [wPikachuSaverCharge]
+ cp MAX_PIKACHU_SAVER_CHARGE
+ ld a, $81
+ jr nz, .drawIcon
+ ld a, $84
+.drawIcon
+ ld [wBottomMessageBuffer + $46], a
+ ret
diff --git a/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm b/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm
index 5354a51..f9d1b86 100644
--- a/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm
+++ b/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm
@@ -20,7 +20,7 @@ DrawSpritesBlueFieldBottom: ; 0x1f35a
callba DrawPinball
call Func_1f4a3
call Func_1f509
- call Func_1f55e
+ call DrawSlotGlow_BlueField
ret
DrawShellderSprites: ; 0x1f395
@@ -149,7 +149,7 @@ DrawPikachuSavers_BlueStage: ; 0x1f448
ld e, a
ld a, [wPikachuSaverSlotRewardActive]
and a
- ld a, [wd518]
+ ld a, [wWhichPikachuSaverSide]
jr z, .asm_1f473
ld a, [wd51c]
and a
@@ -351,13 +351,14 @@ OAMOffsetsTable_1f552: ; 0x1f552
db $25, $2C
db $73, $2C
-Func_1f55e: ; 0x1f55e
- ld a, [wd604]
+DrawSlotGlow_BlueField: ; 0x1f55e
+; Draws the glowing animation surround the slot cave entrance.
+ ld a, [wSlotIsOpen]
and a
ret z
- ld a, [wd606]
+ ld a, [wSlotGlowingAnimationCounter]
inc a
- ld [wd606], a
+ ld [wSlotGlowingAnimationCounter], a
ld a, $40
ld hl, hSCX
sub [hl]
@@ -366,7 +367,7 @@ Func_1f55e: ; 0x1f55e
ld hl, hSCY
sub [hl]
ld c, a
- ld a, [wd606]
+ ld a, [wSlotGlowingAnimationCounter]
srl a
srl a
srl a
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 2e34743..ee25c7c 100644
--- a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm
+++ b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm
@@ -22,7 +22,7 @@ DrawSpritesRedFieldBottom: ; 0x1757e
call DrawPinball
call Func_17f0f
call Func_17f75
- call Func_17fca
+ call DrawSlotGlow_RedField
ret
DrawTimer: ; 0x175a4
@@ -433,7 +433,7 @@ DrawPikachuSavers_RedStage: ; 0x17e08
ld e, a
ld a, [wPikachuSaverSlotRewardActive]
and a
- ld a, [wd518]
+ ld a, [wWhichPikachuSaverSide]
jr z, .asm_17e33
ld a, [wd51c]
and a
@@ -733,13 +733,14 @@ OAMOffsets_17fbe:
db $2E, $2C
db $6A, $2C
-Func_17fca: ; 0x17fca
- ld a, [wd604]
+DrawSlotGlow_RedField: ; 0x17fca
+; Draws the glowing animation surround the slot cave entrance.
+ ld a, [wSlotIsOpen]
and a
ret z
- ld a, [wd606]
+ ld a, [wSlotGlowingAnimationCounter]
inc a
- ld [wd606], a
+ ld [wSlotGlowingAnimationCounter], a
ld a, $40
ld hl, hSCX
sub [hl]
@@ -748,7 +749,7 @@ Func_17fca: ; 0x17fca
ld hl, hSCY
sub [hl]
ld c, a
- ld a, [wd606]
+ ld a, [wSlotGlowingAnimationCounter]
srl a
srl a
srl a
diff --git a/engine/pinball_game/draw_sprites/draw_sprites.asm b/engine/pinball_game/draw_sprites/draw_sprites.asm
index e9dc693..f526080 100644
--- a/engine/pinball_game/draw_sprites/draw_sprites.asm
+++ b/engine/pinball_game/draw_sprites/draw_sprites.asm
@@ -19,3 +19,31 @@ CallTable_84bd: ; 0x84bd
padded_dab DrawSpritesDiglettBonus ; STAGE_DIGLETT_BONUS
padded_dab DrawSpritesSeelBonus ; STAGE_SEEL_BONUS
padded_dab DrawSpritesSeelBonus ; STAGE_SEEL_BONUS
+
+UnusedFunc_84fd:
+; unused
+ ld a, [hGameBoyColorFlag]
+ and a
+ jr z, .not_cgb
+ ld a, $1
+ ld [rVBK], a
+ xor a
+ call .FillAttrsOrBGMap
+ xor a
+ ld [rVBK], a
+.not_cgb
+ ld a, $81
+ call .FillAttrsOrBGMap
+ ld de, wBottomMessageBuffer + $47
+ call Func_8524
+ ret
+
+.FillAttrsOrBGMap: ; 8519 (2:4519)
+ hlCoord 0, 0, vBGWin
+ ld b, $20
+.loop
+ ld [hli], a
+ ld [hli], a
+ dec b
+ jr nz, .loop
+ ret
diff --git a/engine/pinball_game/evolution_mode.asm b/engine/pinball_game/evolution_mode.asm
new file mode 100755
index 0000000..8cc2523
--- /dev/null
+++ b/engine/pinball_game/evolution_mode.asm
@@ -0,0 +1,916 @@
+Func_10a95: ; 0x19a95
+ ld a, [wCurrentStage]
+ call CallInFollowingTable
+PointerTable_10a9b: ; 0x10a9b
+ padded_dab Func_20581 ; STAGE_RED_FIELD_TOP
+ padded_dab Func_20581 ; STAGE_RED_FIELD_BOTTOM
+ padded_dab Func_20581
+ padded_dab Func_20581
+ padded_dab Func_20bae ; STAGE_BLUE_FIELD_TOP
+ padded_dab Func_20bae ; STAGE_BLUE_FIELD_BOTTOM
+
+StartEvolutionMode: ; 0x10ab3
+ ld a, [wInSpecialMode]
+ and a
+ ret nz
+ ld a, [wCurrentStage]
+ rst JumpTable ; calls JumpToFuncInTable
+StartEvolutionMode_CallTable: ; 0x10abc
+ dw StartEvolutionMode_RedField ; STAGE_RED_FIELD_TOP
+ dw StartEvolutionMode_RedField ; STAGE_RED_FIELD_BOTTOM
+ dw StartEvolutionMode_UnusedField
+ dw StartEvolutionMode_UnusedField
+ dw StartEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
+ dw StartEvolutionMode_BlueField ; STAGE_BLUE_FIELD_BOTTOM
+
+ConcludeEvolutionMode: ; 0x10ac8
+ xor a
+ ld [wd5ca], a
+ call FillBottomMessageBufferWithBlackTile
+ xor a
+ ld [wInSpecialMode], a
+ ld [wWildMonIsHittable], a
+ ld [wd5b6], a
+ ld [wNumMonHits], a
+ ld [wd551], a
+ ld [wd554], a
+ call ClearWildMonCollisionMask
+ callba StopTimer
+ ld a, [wCurrentStage]
+ rst JumpTable ; calls JumpToFuncInTable
+ConcludeEvolutionMode_CallTable: ; 0x10af3
+ dw ConcludeEvolutionMode_RedField ; STAGE_RED_FIELD_TOP
+ dw ConcludeEvolutionMode_RedField ; STAGE_RED_FIELD_BOTTOM
+ dw DoNothing_11060
+ dw DoNothing_11060
+ dw ConcludeEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
+ dw ConcludeEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
+
+LoadRedFieldTopGraphics: ; 0x10aff
+ ld a, [wCurrentStage]
+ res 0, a
+ ld c, a
+ ld b, $0
+ srl c
+ sla a
+ sla a
+ sla a
+ sub c
+ ld c, a
+ ld hl, VideoData_10b2a
+ add hl, bc
+ ld a, [hli]
+ ld c, a
+ ld a, [hli]
+ ld b, a
+ ld a, [hli]
+ push af
+ push bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ ld a, [hli]
+ ld c, a
+ ld a, [hli]
+ ld b, a
+ pop hl
+ pop af
+ call LoadVRAMData
+ ret
+
+VideoData_10b2a: ; 0x10b2a
+ dab StageRedFieldTopGfx3
+ dw $8900
+ dw $E0
+ dab StageRedFieldTopGfx3
+ dw $8900
+ dw $E0
+ dab StageRedFieldTopGfx3
+ dw $8900
+ dw $E0
+
+Func_10b3f: ; 0x10b3f
+ call FillBottomMessageBufferWithBlackTile
+ call Func_30db
+ ld hl, wScrollingText1
+ ld a, [wCurrentEvolutionType]
+ cp EVO_EXPERIENCE
+ ld de, StartTrainingText
+ jr z, .asm_10b55
+ ld de, FindItemsText
+.asm_10b55
+ call LoadScrollingText
+ ret
+
+InitEvolutionSelectionMenu: ; 0x10b59
+; Initializes the list menu, which the player uses to select which pokemon to evolve.
+ xor a
+ ld [wDrawBottomMessageBox], a
+ ld hl, wBottomMessageText
+ ld a, $81
+ ld b, $30
+.clearLoop
+ ld [hli], a ; load spaces into bottom text. repeat 192 times
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
+ dec b
+ jr nz, .clearLoop
+ ld hl, wPartyMons
+ call LoadMonNamesIntoEvolutionSelectionList
+ ld a, BANK(InGameMenuSymbolsGfx)
+ ld hl, InGameMenuSymbolsGfx + $50
+ ld de, vTilesSH tile $08
+ ld bc, $0030
+ call LoadVRAMData
+ ld a, $0
+ ld hl, wBottomMessageText
+ deCoord 0, 0, vBGWin
+ ld bc, $00c0
+ call LoadVRAMData
+ ret
+
+LoadMonNamesIntoEvolutionSelectionList: ; 0x10b8e
+; Loads 6 pokemon names into the list that allows the player to select which pokemon to evolve.
+; Input: hl = pointer to a list of pokemon ids. (an offset of wPartyMons)
+ ld a, [wNumPartyMons]
+ ld c, $0
+ ld b, a
+.loop
+ ld a, [hli]
+ call LoadMonNameIntoEvolutionSelectionList
+ inc c
+ ld a, c
+ cp $6
+ jr z, .done
+ dec b
+ jr nz, .loop
+.done
+ ret
+
+LoadMonNameIntoEvolutionSelectionList: ; 0x10ba2
+; Loads a single pokemon name into the list of pokemon to evolve.
+; Input: c = index of the list
+; a = pokemon id
+ push bc
+ push hl
+ swap c ;c* 32, does wird things if c starts >15
+ sla c
+ ld b, $0
+ ld hl, wBottomMessageText
+ add hl, bc ;goes down text as many times as new c
+ ld d, h
+ ld e, l
+ ld c, a ;c now equals paerty mon, HL stored in de
+ ld b, $0
+ sla c
+ rl b
+ sla c
+ rl b
+ sla c
+ rl b
+ sla c
+ rl b ;multiplies party mon by 16, then jumps to correct name in the table
+ ld hl, PokemonNames ;names are 16 chars long
+ add hl, bc
+ ld a, $81
+ ld [de], a
+ inc de
+ ld a, $81
+ ld [de], a
+ inc de
+ ld a, $81
+ ld [de], a
+ inc de
+ ld a, $81
+ ld [de], a ; loaded 4 spaces into de
+ inc de
+ call LoadMonNameIntoBottomMessageBufferList
+.loadBlankCharacterLoop
+ ld a, e
+ and $1f
+ cp $14
+ jr nc, .done
+ ld a, $81
+ ld [de], a
+ inc de
+ jr .loadBlankCharacterLoop
+
+.done
+ pop hl
+ pop bc
+ ret
+
+SelectPokemonToEvolveMenu: ; 0x10bea
+; Drivers the menu that allows the player to select a pokemon to evolve.
+ xor a
+ ld [wCurSelectedPartyMon], a
+ ld [wCurSelectedPartyMonScrollOffset], a
+ ld [wPartySelectionCursorCounter], a
+.loop
+ call MoveEvolutionSelectionCursor
+ call ClearPersistentJoypadStates
+ call UpdateEvolutionSelectionList
+ rst AdvanceFrame
+ ld a, [wNewlyPressedButtonsPersistent]
+ bit BIT_A_BUTTON, a
+ jr z, .loop
+ lb de, $00, $01
+ call PlaySoundEffect
+ ret
+
+MoveEvolutionSelectionCursor: ; 0x10c0c
+ ld a, [wPressedButtonsPersistent]
+ ld b, a
+ ld a, [wNumPartyMons]
+ ld c, a
+ ld a, [wCurSelectedPartyMon]
+ bit BIT_D_UP, b
+ jr z, .didntPressUp
+ and a
+ ret z
+ ; move the cursor up
+ dec a
+ ld [wCurSelectedPartyMon], a
+ lb de, $00, $03
+ call PlaySoundEffect
+ ret
+
+.didntPressUp
+ bit BIT_D_DOWN, b
+ ret z
+ inc a
+ cp c
+ ret z
+ ; move the cursor down
+ ld [wCurSelectedPartyMon], a
+ lb de, $00, $03
+ call PlaySoundEffect
+ ret
+
+UpdateEvolutionSelectionList: ; 0x10c38
+ ld a, [wCurSelectedPartyMon]
+ ld hl, wCurSelectedPartyMonScrollOffset
+ sub [hl]
+ jr nc, .asm_10c45
+ dec [hl]
+ xor a
+ jr .asm_10c4c
+
+.asm_10c45
+ cp $6
+ jr c, .asm_10c4c
+ inc [hl]
+ ld a, $5
+.asm_10c4c
+ ld c, a
+ push bc
+ ld a, [hl]
+ ld c, a
+ ld b, $0
+ ld hl, wPartyMons
+ add hl, bc
+ call LoadMonNamesIntoEvolutionSelectionList
+ ld a, [hJoypadState]
+ and a
+ ld a, [wPartySelectionCursorCounter]
+ jr z, .asm_10c62
+ xor a
+.asm_10c62
+ inc a
+ ld [wPartySelectionCursorCounter], a
+ bit 3, a
+ pop bc
+ jr nz, .asm_10c78
+ swap c
+ sla c
+ ld b, $0
+ ld hl, wBottomMessageText + $03
+ add hl, bc
+ ld a, $88
+ ld [hl], a
+.asm_10c78
+ ld a, [wCurSelectedPartyMonScrollOffset]
+ and a
+ jr z, .asm_10c83
+ ld a, $8a
+ ld [wBottomMessageText + $11], a
+.asm_10c83
+ ld a, [wCurSelectedPartyMonScrollOffset]
+ add $7
+ jr z, .asm_10c96
+ ld c, a
+ ld a, [wNumPartyMons]
+ cp c
+ jr c, .asm_10c96
+ ld a, $89
+ ld [wBottomMessageText + $b1], a
+.asm_10c96
+ ld a, $0
+ ld hl, wBottomMessageText
+ deCoord 0, 0, vBGWin
+ ld bc, $00c0
+ call LoadVRAMData
+ ret
+
+PlaceEvolutionInParty: ; 0x10ca5
+ ld a, [wCurSelectedPartyMon]
+ ld c, a
+ ld b, $0
+ ld hl, wPartyMons
+ add hl, bc
+ ld a, [wCurrentEvolutionMon]
+ cp $ff
+ ret z
+ ld [hl], a
+ ret
+
+SelectPokemonToEvolve: ; 0x10cb7
+ call FillBottomMessageBufferWithBlackTile
+ call InitEvolutionSelectionMenu
+ ld a, $60
+ ld [hWY], a
+ dec a
+ ld [hLYC], a
+ ld a, $fd
+ ld [hLCDCMask], a
+ call SelectPokemonToEvolveMenu
+ ld a, $86
+ ld [hWY], a
+ ld a, $83
+ ld [hLYC], a
+ ld [hLastLYC], a
+ ld a, $ff
+ ld [hLCDCMask], a
+ ld a, [hGameBoyColorFlag]
+ and a
+ jr nz, .gameboyColor
+ ld a, BANK(StageRedFieldTopStatusBarSymbolsGfx_GameBoy)
+ ld hl, StageRedFieldTopStatusBarSymbolsGfx_GameBoy + $80
+ ld de, vTilesSH tile $08
+ ld bc, $0030
+ call LoadVRAMData
+ jr .asm_10cfc
+
+.gameboyColor
+ ld a, BANK(StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor)
+ ld hl, StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor + $80
+ ld de, vTilesSH tile $08
+ ld bc, $0030
+ call LoadVRAMData
+.asm_10cfc
+ call FillBottomMessageBufferWithBlackTile
+ ld a, SPECIAL_MODE_CATCHEM
+ ld [wDrawBottomMessageBox], a
+ ld [wInSpecialMode], a
+ ld [wSpecialMode], a
+ xor a
+ ld [wd54d], a
+ ld a, [wCurSelectedPartyMon]
+ ld c, a
+ ld b, $0
+ ld hl, wPartyMons
+ add hl, bc
+ ld a, [hl]
+ ld [wCurrentCatchEmMon], a
+ ret
+
+InitEvolutionModeForMon: ; 0x10d1d
+ ld hl, wd586
+ ld b, $18
+.asm_10d22
+ ld a, $1
+ ld [hli], a
+ xor a
+ ld [hli], a
+ dec b
+ jr nz, .asm_10d22
+ ld a, [wCurrentCatchEmMon]
+ ld c, a
+ ld b, $0
+ ld hl, Data_1298b
+ add hl, bc
+ ld a, [hl]
+ add $2
+ ld [wd555], a
+ xor a
+ ld hl, wd566
+ ld b, $13
+.asm_10d40
+ ld [hli], a
+ dec b
+ jr nz, .asm_10d40
+ ld a, [wCurrentCatchEmMon]
+ ld c, a
+ ld b, $0
+ sla c
+ rl b
+ ld hl, CatchEmTimerData
+ add hl, bc
+ ld a, [hli]
+ ld c, a
+ ld a, [hl]
+ ld b, a
+ callba StartTimer
+ ld a, [wCurrentCatchEmMon]
+ ld c, a
+ ld b, $0
+ sla c ; multiply mon id by 6
+ rl b
+ add c
+ ld c, a
+ jr nc, .noCarry
+ inc b
+.noCarry
+ sla c
+ rl b
+ ld hl, MonEvolutions
+ add hl, bc
+ push hl
+ ld bc, $03ff
+.countMonEvolutionsLoop
+ ld a, [hli]
+ and a
+ jr z, .noEvolution
+ inc c
+.noEvolution
+ inc hl
+ dec b
+ jr nz, .countMonEvolutionsLoop
+ ld a, c
+ cp $ff
+ jr nz, .asm_10d8a
+ xor a
+.asm_10d8a
+ call Func_a21
+ sla a
+ ld c, a
+ pop hl
+ add hl, bc ; hl points to one of three entries in mon's evolution data
+ ld a, [hli] ; a = mon id of evolution
+ dec a
+ ld [wCurrentEvolutionMon], a
+ ld a, [hl] ; a = evoluion type id
+ ld [wCurrentEvolutionType], a
+ xor a
+ ld [wd554], a
+ ld [wd556], a
+ ld [wd557], a
+ ld hl, wd55c
+ ld a, $1
+ ld b, $3
+.asm_10dac
+ ld [hli], a
+ dec b
+ jr nz, .asm_10dac
+ xor a
+ ld b, $7
+.asm_10db3
+ ld [hli], a
+ dec b
+ jr nz, .asm_10db3
+ ld de, wd55c
+ ld a, [wd555]
+ ld c, a
+ inc a
+ ld b, a
+.asm_10dc0
+ push bc
+ ld a, c
+ call Func_a21
+ ld c, a
+ ld b, $0
+ ld hl, wd55c
+ add hl, bc
+ ld c, [hl]
+ ld a, [de]
+ ld [hl], a
+ ld a, c
+ ld [de], a
+ pop bc
+ inc de
+ dec b
+ jr nz, .asm_10dc0
+ callba InitBallSaverForCatchEmMode
+ call Func_10b3f
+ call Func_3579
+ ld a, [wCurrentStage]
+ bit 0, a
+ jr z, .asm_10e09
+ ld a, BANK(StageRedFieldBottomBaseGameBoyColorGfx)
+ ld hl, StageRedFieldBottomBaseGameBoyColorGfx + $300
+ ld de, vTilesSH tile $2e
+ ld bc, $0020
+ call LoadOrCopyVRAMData
+ ld a, $0
+ ld hl, CatchBarTiles
+ deCoord 6, 8, vBGMap
+ ld bc, (CatchBarTilesEnd - CatchBarTiles)
+ call LoadOrCopyVRAMData
+.asm_10e09
+ ret
+
+Func_10e0a: ; 0x10e0a
+ ld a, [wCurrentEvolutionMon]
+ cp $ff
+ jp z, Func_10e8b
+ ld c, a
+ ld b, $0
+ sla c
+ rl b
+ sla c
+ rl b
+ sla c
+ rl b
+ sla c
+ rl b
+ ld hl, PokemonNames + 1
+ add hl, bc
+ ld de, ItEvolvedIntoAnText ; "It evolved into an"
+ ld bc, Data_2b34
+ ld a, [hl]
+ ; check if mon's name starts with a vowel, so it can print "an", instead of "a"
+ cp "A"
+ jr z, .nameStartsWithVowel
+ cp "I"
+ jr z, .nameStartsWithVowel
+ cp "U"
+ jr z, .nameStartsWithVowel
+ cp "E"
+ jr z, .nameStartsWithVowel
+ cp "O"
+ jr z, .nameStartsWithVowel
+ ld de, ItEvolvedIntoAText ; "It evolved into a"
+ ld bc, Data_2b1c
+.nameStartsWithVowel
+ push hl
+ push bc
+ push de
+ call FillBottomMessageBufferWithBlackTile
+ call Func_30db
+ ld hl, wScrollingText1
+ pop de
+ call LoadScrollingText
+ ld hl, wScrollingText2
+ pop de
+ call LoadScrollingText
+ pop hl
+ ld de, wBottomMessageText + $20
+ ld b, $0
+.asm_10e67
+ ld a, [hli]
+ and a
+ jr z, .asm_10e70
+ ld [de], a
+ inc de
+ inc b
+ jr .asm_10e67
+
+.asm_10e70
+ ld a, $20
+ ld [de], a
+ inc de
+ xor a
+ ld [de], a
+ ld a, [wScrollingText2ScrollStepsRemaining]
+ add b
+ ld [wScrollingText2ScrollStepsRemaining], a
+ ld a, $14
+ sub b
+ srl a
+ ld b, a
+ ld a, [wScrollingText2StopOffset]
+ add b
+ ld [wScrollingText2StopOffset], a
+ ret
+
+Func_10e8b: ; 0x10e8b
+ ld bc, OneMillionPoints
+ callba AddBigBCD6FromQueue
+ ld bc, $0100
+ ld de, $0000
+ push bc
+ push de
+ call FillBottomMessageBufferWithBlackTile
+ call Func_30db
+ ld hl, wScrollingText2
+ ld de, Data_2b6b
+ call Func_32cc
+ pop de
+ pop bc
+ ld hl, wScrollingText1
+ ld de, EvolutionSpecialBonusText
+ call LoadScrollingText
+ ret
+
+StartEvolutionMode_RedField: ; 0x10ebb
+ ld a, [wNumPartyMons]
+ and a
+ ret z
+ call SelectPokemonToEvolve
+ call InitEvolutionModeForMon
+ ld a, [wd555]
+ sub $2
+ ld c, a
+ sla c
+ ld hl, IndicatorStatesPointerTable_10f3b
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, wIndicatorStates
+ ld b, $13
+.loop
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .loop
+ xor a
+ ld [wLeftAlleyCount], a
+ call Func_107b0
+ ld a, $2
+ ld [wd7ad], a
+ ld de, $0002
+ call PlaySong
+ call SetPokemonSeenFlag
+ ld a, [wCurrentStage]
+ bit 0, a
+ jr nz, .asm_10f0b
+ ld a, BANK(EvolutionTrinketsGfx)
+ ld hl, EvolutionTrinketsGfx
+ ld de, vTilesSH tile $10
+ ld bc, $00e0
+ call LoadOrCopyVRAMData
+ ret
+
+.asm_10f0b
+ ld a, BANK(EvolutionTrinketsGfx)
+ ld hl, EvolutionTrinketsGfx
+ ld de, vTilesOB tile $20
+ ld bc, $00e0
+ call LoadOrCopyVRAMData
+ callba Func_14135
+ callba Func_10184
+ ld a, [hGameBoyColorFlag]
+ and a
+ callba nz, Func_102bc
+ ret
+
+IndicatorStatesPointerTable_10f3b: ; 0x10f3b
+ dw IndicatorStates_10f4b
+ dw IndicatorStates_10f5e
+ dw IndicatorStates_10f71
+ dw IndicatorStates_10f84
+ dw IndicatorStates_10f97
+ dw IndicatorStates_10faa
+ dw IndicatorStates_10fbd
+ dw IndicatorStates_10fd0
+
+IndicatorStates_10f4b: ; 0x10f4b
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $00, $00, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_10f5e: ; 0x10f5e
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $00, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_10f71: ; 0x10f71
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_10f84: ; 0x10f84
+ db $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_10f97: ; 0x10f97
+ db $00, $00, $00, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_10faa: ; 0x10faa
+ db $00, $00, $80, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_10fbd: ; 0x10fbd
+ db $00, $00, $80, $80, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_10fd0: ; 0x10fd0
+ db $00, $00, $80, $80, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+ConcludeEvolutionMode_RedField: ; 0x10fe3
+ call ResetIndicatorStates
+ call Func_107c2
+ call SetLeftAndRightAlleyArrowIndicatorStates_RedField
+ call Func_107e9
+ ld a, [wCurrentStage]
+ bit 0, a
+ jp z, LoadRedFieldTopGraphics
+ callba Func_14135
+ callba LoadSlotCaveCoverGraphics_RedField
+ callba LoadMapBillboardTileData
+ ld a, BANK(StageSharedBonusSlotGlowGfx)
+ ld hl, StageSharedBonusSlotGlowGfx + $60
+ ld de, vTilesOB tile $20
+ ld bc, $00e0
+ call LoadVRAMData
+ ld a, [hGameBoyColorFlag]
+ and a
+ jr z, .asm_11036
+ ld a, BANK(StageRedFieldBottomOBJPalette7)
+ ld hl, StageRedFieldBottomOBJPalette7
+ ld de, $0078
+ ld bc, $0008
+ call Func_7dc
+.asm_11036
+ ld hl, BlankSaverSpaceTileDataRedField
+ ld a, BANK(BlankSaverSpaceTileDataRedField)
+ call Func_10aa
+ ld a, [wPreviousNumPokeballs]
+ callba LoadPokeballsGraphics_RedField
+ ld hl, CaughtPokeballTileDataPointers
+ ld a, BANK(CaughtPokeballTileDataPointers)
+ call Func_10aa
+ ret
+
+StartEvolutionMode_UnusedField: ; 0x11054
+ ld a, [wNumPartyMons]
+ and a
+ ret z
+ call SelectPokemonToEvolve
+ call InitEvolutionModeForMon
+ ret
+
+DoNothing_11060: ; 0x11060
+ ret
+
+StartEvolutionMode_BlueField: ; 0x11061
+ ld a, [wNumPartyMons]
+ and a
+ ret z
+ call SelectPokemonToEvolve
+ call InitEvolutionModeForMon
+ ld a, $1
+ ld [wd643], a
+ ld a, [wd555]
+ sub $2
+ ld c, a
+ sla c
+ ld hl, IndicatorStatesPointerTable_110ed
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, wIndicatorStates
+ ld b, $13
+.asm_11085
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .asm_11085
+ xor a
+ ld [wLeftAlleyCount], a
+ callba CloseSlotCave
+ ld a, $2
+ ld [wd7ad], a
+ ld de, $0002
+ call PlaySong
+ call SetPokemonSeenFlag
+ ld a, [wCurrentStage]
+ bit 0, a
+ jr nz, .asm_110bd
+ ld a, BANK(EvolutionTrinketsGfx)
+ ld hl, EvolutionTrinketsGfx
+ ld de, vTilesOB tile $60
+ ld bc, $00e0
+ call LoadOrCopyVRAMData
+ ret
+
+.asm_110bd
+ ld a, BANK(EvolutionTrinketsGfx)
+ ld hl, EvolutionTrinketsGfx
+ ld de, vTilesOB tile $20
+ ld bc, $00e0
+ call LoadOrCopyVRAMData
+ callba Func_1c2cb
+ callba Func_10184
+ ld a, [hGameBoyColorFlag]
+ and a
+ callba nz, Func_102bc
+ ret
+
+IndicatorStatesPointerTable_110ed: ; 0x110ed
+ dw IndicatorStates_110fd
+ dw IndicatorStates_11110
+ dw IndicatorStates_11123
+ dw IndicatorStates_11136
+ dw IndicatorStates_11149
+ dw IndicatorStates_1115c
+ dw IndicatorStates_1116f
+ dw IndicatorStates_11182
+
+IndicatorStates_110fd: ; 0x110fd
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $00, $00, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_11110: ; 0x11110
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $00, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_11123: ; 0x11123
+ db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_11136: ; 0x11136
+ db $00, $00, $80, $00, $00, $00, $00, $00, $01, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_11149: ; 0x11149
+ db $00, $00, $80, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_1115c: ; 0x1115c
+ db $00, $00, $80, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_1116f: ; 0x1116f
+ db $80, $00, $80, $80, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+IndicatorStates_11182: ; 0x11182
+ db $80, $00, $80, $80, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
+
+ConcludeEvolutionMode_BlueField: ; 0x11195
+ xor a
+ ld [wd643], a
+ call ResetIndicatorStates
+ call Func_107c2
+ callba SetLeftAndRightAlleyArrowIndicatorStates_BlueField
+ ld a, [wCurrentStage]
+ bit 0, a
+ jp z, LoadBlueFieldTopGraphics
+ callba Func_1c2cb
+ callba LoadSlotCaveCoverGraphics_BlueField
+ callba LoadMapBillboardTileData
+ ld a, Bank(StageSharedBonusSlotGlowGfx)
+ ld hl, StageSharedBonusSlotGlowGfx + $60
+ ld de, vTilesOB tile $20
+ ld bc, $00e0
+ call LoadVRAMData
+ ld a, [hGameBoyColorFlag]
+ and a
+ jr z, .asm_111f0
+ ld a, BANK(StageBlueFieldBottomOBJPalette7)
+ ld hl, StageBlueFieldBottomOBJPalette7
+ ld de, $0078
+ ld bc, $0008
+ call Func_7dc
+.asm_111f0
+ ld hl, BlankSaverSpaceTileDataBlueField
+ ld a, BANK(BlankSaverSpaceTileDataBlueField)
+ call Func_10aa
+ ld a, [wPreviousNumPokeballs]
+ callba LoadPokeballsGraphics_RedField
+ ld hl, Data_10a88
+ ld a, BANK(Data_10a88)
+ call Func_10aa
+ ret
+
+LoadBlueFieldTopGraphics: ; 0x1120e
+ ld a, [wCurrentStage]
+ sub $4
+ res 0, a
+ ld c, a
+ ld b, $0
+ srl c
+ sla a
+ sla a
+ sla a
+ sub c
+ ld c, a
+ ld hl, VRAMData_1123b
+ add hl, bc
+ ld a, [hli]
+ ld c, a
+ ld a, [hli]
+ ld b, a
+ ld a, [hli]
+ push af
+ push bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ ld a, [hli]
+ ld c, a
+ ld a, [hli]
+ ld b, a
+ pop hl
+ pop af
+ call LoadVRAMData
+ ret
+
+VRAMData_1123b: ; 0x1123b
+; This doesn't seem very useful...
+ dab StageBlueFieldTopGfx3
+ dw $8600, $E0
+ dab StageBlueFieldTopGfx3
+ dw $8600, $E0
+ dab StageBlueFieldTopGfx3
+ dw $8600, $E0
+ dab StageBlueFieldTopGfx3
+ dw $8600, $E0
+ dab StageBlueFieldTopGfx3
+ dw $8600, $E0
+ dab StageBlueFieldTopGfx3
+ dw $8600, $E0
+ dab StageBlueFieldTopGfx3
+ dw $8600, $E0
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 efdbe83..7068b5b 100644
--- a/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm
+++ b/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm
@@ -135,7 +135,7 @@ Func_20c76: ; 0x20c76
lb de, $07, $45
call PlaySoundEffect
ld a, $1
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $80
ld [wIndicatorStates + 4], a
xor a
@@ -169,7 +169,7 @@ Func_20c76: ; 0x20c76
ld bc, $0008
call Func_7dc
.asm_20d25
- callba Func_1e8f6
+ callba LoadSlotCaveCoverGraphics_BlueField
ret
Func_20d30: ; 0x20d30
@@ -231,7 +231,7 @@ Func_20da0: ; 0x20da0
ld a, $2
ld [wd54d], a
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld hl, wIndicatorStates
ld [wIndicatorStates + 4], a
ld [wIndicatorStates + 9], a
@@ -252,7 +252,7 @@ Func_20da0: ; 0x20da0
bit 0, a
jr z, .asm_20e1a
callba Func_1c2cb
- callba Func_1e8f6
+ callba LoadSlotCaveCoverGraphics_BlueField
.asm_20e1a
callba StopTimer
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 384e958..b132e46 100644
--- a/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm
+++ b/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm
@@ -138,7 +138,7 @@ Func_20651: ; 0x20651
lb de, $07, $45
call PlaySoundEffect
ld a, $1
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $80
ld [wIndicatorStates + 4], a
xor a
@@ -172,7 +172,7 @@ Func_20651: ; 0x20651
ld bc, $0008
call Func_7dc
.asm_20700
- callba Func_16425
+ callba LoadSlotCaveCoverGraphics_RedField
ret
Func_2070b: ; 0x2070b
@@ -234,7 +234,7 @@ Func_2077b: ; 0x2077b
ld a, $2
ld [wd54d], a
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld hl, wIndicatorStates
ld [wIndicatorStates + 4], a
ld [wIndicatorStates + 9], a
@@ -255,7 +255,7 @@ Func_2077b: ; 0x2077b
bit 0, a
jr z, .asm_207f5
callba Func_14135
- callba Func_16425
+ callba LoadSlotCaveCoverGraphics_RedField
.asm_207f5
callba StopTimer
call FillBottomMessageBufferWithBlackTile
diff --git a/engine/pinball_game/extra_ball.asm b/engine/pinball_game/extra_ball.asm
index 2436763..f753f5f 100644
--- a/engine/pinball_game/extra_ball.asm
+++ b/engine/pinball_game/extra_ball.asm
@@ -1,9 +1,9 @@
-HandleExtraBall: ; 0x30188
-; Grants the player an extra Ball, if they qualify for it.
+ShowExtraBallMessage: ; 0x30188
+; Displays the extra ball scrolling message, if an extra ball has been granted.
ld a, [wd5ca]
and a
ret nz
- ld a, [wd4ca]
+ ld a, [wShowExtraBallText]
and a
ret z
cp $1
@@ -32,5 +32,5 @@ HandleExtraBall: ; 0x30188
call LoadScrollingText
.asm_301c9
xor a
- ld [wd4ca], a
+ ld [wShowExtraBallText], a
ret
diff --git a/engine/pinball_game/load_stage_data/load_blue_field.asm b/engine/pinball_game/load_stage_data/load_blue_field.asm
index 67dd0f2..de5c455 100644
--- a/engine/pinball_game/load_stage_data/load_blue_field.asm
+++ b/engine/pinball_game/load_stage_data/load_blue_field.asm
@@ -2,12 +2,12 @@ _LoadStageDataBlueFieldTop: ; 0x1c165
call LoadPinballUpgradeTriggersGraphics_BlueField
call UpdateSpinnerChargeGraphics_BlueField
call Func_1c3ee
- call Func_1e8f6
+ call LoadSlotCaveCoverGraphics_BlueField
callba Func_142fc
ld a, $1
ld [wBlueStageForceFieldGfxNeedsLoading], a
- call Func_1f18a
- callba Func_1404a
+ call UpdateForceFieldGraphics
+ callba LoadTimerGraphics
call Func_1c203
ret
@@ -19,13 +19,13 @@ _LoadStageDataBlueFieldBottom: ; 0x1c191
call Func_1c43c
call Func_1c305
call Func_1c3ee
- callba Func_14746
+ callba LoadAgainTextGraphics
callba DrawBallSaverIcon
call Func_1c235
call Func_1c21e
- call Func_1e8f6
+ call LoadSlotCaveCoverGraphics_BlueField
callba Func_142fc
- callba Func_1404a
+ callba LoadTimerGraphics
call Func_1c203
ret
@@ -117,7 +117,7 @@ Func_1c235: ; 0x1c235
ld a, [wd644]
and a
jr z, .asm_1c28a
- ld a, [wd55a]
+ ld a, [wMapMoveDirection]
and a
jr nz, .asm_1c2bd
jr .asm_1c291
@@ -177,7 +177,7 @@ Func_1c2cb: ; 0x1c2cb
add hl, bc
ld a, [hl]
res 7, a
- call Func_1eb41
+ call LoadArrowIndicatorGraphics_BlueStage
pop bc
inc c
ld a, c
@@ -198,7 +198,7 @@ Func_1c2cb: ; 0x1c2cb
ld d, a
pop af
add d
- call Func_1eb41
+ call LoadArrowIndicatorGraphics_BlueStage
pop bc
inc c
ld a, c
@@ -350,7 +350,7 @@ Func_1c3ee: ; 0x1c3ee
ld hl, PaletteData_dd188
ld de, $0070
ld bc, $0010
- call Func_6fd
+ call FarCopyCGBPals
ret
Func_1c43c: ; 0x1c43c
@@ -373,7 +373,7 @@ Func_1c43c: ; 0x1c43c
.asm_1c458
ld a, [wPreviousNumPokeballs]
- call Func_1f265
+ call LoadPokeballsGraphics_BlueField
ld a, BANK(CaughtPokeballGfx)
ld hl, CaughtPokeballGfx
ld de, vTilesSH tile $2e
@@ -432,7 +432,7 @@ Func_1c4b6: ; 0x1c4b6
ld a, [wInSpecialMode]
and a
jr nz, .asm_1c4f0
- ld a, [wd609]
+ ld a, [wOpenedSlotByGetting3Pokeballs]
and a
jr z, .asm_1c4d2
ld a, [wd498]
@@ -441,7 +441,7 @@ Func_1c4b6: ; 0x1c4b6
ret
.asm_1c4d2
- ld a, [wd608]
+ ld a, [wOpenedSlotByGetting4CAVELights]
and a
jr z, .asm_1c4e5
ld a, $1a
@@ -463,11 +463,11 @@ Func_1c4b6: ; 0x1c4b6
ret
.asm_1c508
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
and a
ld a, $14
jr nz, .asm_1c515
- ld a, [wd55a]
+ ld a, [wMapMoveDirection]
add $12
.asm_1c515
callba LoadBillboardTileData
diff --git a/engine/pinball_game/load_stage_data/load_gengar_bonus.asm b/engine/pinball_game/load_stage_data/load_gengar_bonus.asm
index 767d37d..b6d30fd 100644
--- a/engine/pinball_game/load_stage_data/load_gengar_bonus.asm
+++ b/engine/pinball_game/load_stage_data/load_gengar_bonus.asm
@@ -3,7 +3,7 @@ _LoadStageDataGengarBonus: ; 0x1818b
call Func_2862
call Func_18d72
ld a, [wd7c1]
- callba Func_1404a
+ callba LoadTimerGraphics
and a
ret z
call Func_183db
diff --git a/engine/pinball_game/load_stage_data/load_meowth_bonus.asm b/engine/pinball_game/load_stage_data/load_meowth_bonus.asm
index 01a49ba..e51c8af 100644
--- a/engine/pinball_game/load_stage_data/load_meowth_bonus.asm
+++ b/engine/pinball_game/load_stage_data/load_meowth_bonus.asm
@@ -3,5 +3,5 @@ _LoadStageDataMeowthBonus: ; 0x24128
call Func_2862
callba Func_24fa3
call Func_24516
- callba Func_1404a
+ callba LoadTimerGraphics
ret
diff --git a/engine/pinball_game/load_stage_data/load_mewtwo_bonus.asm b/engine/pinball_game/load_stage_data/load_mewtwo_bonus.asm
index 47bbfc4..567576a 100644
--- a/engine/pinball_game/load_stage_data/load_mewtwo_bonus.asm
+++ b/engine/pinball_game/load_stage_data/load_mewtwo_bonus.asm
@@ -1,7 +1,7 @@
_LoadStageDataMewtwoBonus: ; 0x19310
callba Func_142fc
call Func_2862
- callba Func_1404a
+ callba LoadTimerGraphics
ld a, [wd7c1]
and a
ret z
diff --git a/engine/pinball_game/load_stage_data/load_red_field.asm b/engine/pinball_game/load_stage_data/load_red_field.asm
index c194aa6..026cea3 100644
--- a/engine/pinball_game/load_stage_data/load_red_field.asm
+++ b/engine/pinball_game/load_stage_data/load_red_field.asm
@@ -1,13 +1,13 @@
_LoadStageDataRedFieldTop: ; 0x14000
call Func_14091
- call Func_159f4
+ call LoadFieldStructureGraphics_RedField
call LoadPinballUpgradeTriggersGraphics_RedField
- call Func_16859
+ call LoadStaryuGraphics_Top
call UpdateSpinnerChargeGraphics_RedField
call Func_14234
- call Func_16425
+ call LoadSlotCaveCoverGraphics_RedField
call Func_142fc
- call Func_1404a
+ call LoadTimerGraphics
ret
_LoadStageDataRedFieldBottom: ; 0x1401c
@@ -18,17 +18,17 @@ _LoadStageDataRedFieldBottom: ; 0x1401c
call Func_14282
call Func_1414b
call Func_14234
- call Func_14746
+ call LoadAgainTextGraphics
call DrawBallSaverIcon
call Func_140f9
- call Func_16878
+ call LoadStaryuGraphics_Bottom
call Func_140e2
- call Func_16425
+ call LoadSlotCaveCoverGraphics_RedField
call Func_142fc
- call Func_1404a
+ call LoadTimerGraphics
ret
-Func_1404a: ; 0x1404a
+LoadTimerGraphics: ; 0x1404a
ld a, [wTimerActive]
and a
ret z
@@ -95,7 +95,7 @@ Func_14091: ; 0x14091
bit 0, a
ret nz
callba LoadStageCollisionAttributes
- call Func_159f4
+ call LoadFieldStructureGraphics_RedField
ret
Func_140e2: ; 0x140e2
@@ -147,7 +147,7 @@ Func_14135: ; 0x14135
add hl, bc
ld a, [hl]
res 7, a
- call Func_169cd
+ call LoadArrowIndicatorGraphics_RedField
pop bc
inc c
ld a, c
@@ -299,7 +299,7 @@ Func_14234: ; 0x14234
ld hl, PaletteData_dd188
ld de, $0070
ld bc, $0010
- call Func_6fd
+ call FarCopyCGBPals
ret
Func_14282: ; 0x14282
@@ -322,7 +322,7 @@ Func_14282: ; 0x14282
.asm_1429e
ld a, [wPreviousNumPokeballs]
- call Func_174d4
+ call LoadPokeballsGraphics_RedField
ld a, BANK(CaughtPokeballGfx)
ld hl, CaughtPokeballGfx
ld de, vTilesSH tile $2e
@@ -391,7 +391,7 @@ Func_142fc: ; 0x142fc
jr .asm_14328
.asm_1431e
- callba Func_dd62
+ callba LoadSuperMiniPinballGfx
.asm_14328
ld a, [hGameBoyColorFlag]
and a
@@ -403,7 +403,7 @@ Func_142fc: ; 0x142fc
ld hl, PokeBallObjPalette
ld de, $0040
ld bc, $0008
- call Func_6fd
+ call FarCopyCGBPals
ret
.notPokeball
@@ -413,7 +413,7 @@ Func_142fc: ; 0x142fc
ld hl, GreatBallObjPalette
ld de, $0040
ld bc, $0008
- call Func_6fd
+ call FarCopyCGBPals
ret
.notGreatball
@@ -423,7 +423,7 @@ Func_142fc: ; 0x142fc
ld hl, UltraBallObjPalette
ld de, $0040
ld bc, $0008
- call Func_6fd
+ call FarCopyCGBPals
ret
.notUltraball
@@ -431,14 +431,14 @@ Func_142fc: ; 0x142fc
ld hl, MasterBallObjPalette
ld de, $0040
ld bc, $0008
- call Func_6fd
+ call FarCopyCGBPals
ret
Func_14377: ; 0x14377
ld a, [wInSpecialMode]
and a
jr nz, .asm_143b1
- ld a, [wd609]
+ ld a, [wOpenedSlotByGetting3Pokeballs]
and a
jr z, .asm_14393
ld a, [wd498]
@@ -447,7 +447,7 @@ Func_14377: ; 0x14377
ret
.asm_14393
- ld a, [wd608]
+ ld a, [wOpenedSlotByGetting4CAVELights]
and a
jr z, .asm_143a6
ld a, $1a
@@ -469,11 +469,11 @@ Func_14377: ; 0x14377
ret
.asm_143c9
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
and a
ld a, $14
jr nz, .asm_143d6
- ld a, [wd55a]
+ ld a, [wMapMoveDirection]
add $12
.asm_143d6
callba LoadBillboardTileData
diff --git a/engine/pinball_game/load_stage_data/load_seel_bonus.asm b/engine/pinball_game/load_stage_data/load_seel_bonus.asm
index e72b9a7..45dcf75 100644
--- a/engine/pinball_game/load_stage_data/load_seel_bonus.asm
+++ b/engine/pinball_game/load_stage_data/load_seel_bonus.asm
@@ -3,5 +3,5 @@ _LoadStageDataSeelBonus: ; 0x25b97
call Func_2862
callba Func_262f4
call Func_25d0e
- callba Func_1404a
+ callba LoadTimerGraphics
ret
diff --git a/engine/pinball_game/map_move.asm b/engine/pinball_game/map_move.asm
new file mode 100755
index 0000000..68d2f50
--- /dev/null
+++ b/engine/pinball_game/map_move.asm
@@ -0,0 +1,729 @@
+Func_301ce: ; 0x301ce
+ ld a, [wCurrentStage]
+ call CallInFollowingTable
+PointerTable_301d4: ; 0x301d4
+ padded_dab Func_314ae ; STAGE_RED_FIELD_TOP
+ padded_dab Func_314ae ; STAGE_RED_FIELD_BOTTOM
+ padded_dab Func_314ae
+ padded_dab Func_314ae
+ padded_dab Func_3161b ; STAGE_BLUE_FIELD_TOP
+ padded_dab Func_3161b ; STAGE_BLUE_FIELD_BOTTOM
+
+StartMapMoveMode: ; 0x301ec
+ ld a, [wInSpecialMode]
+ and a
+ ret nz
+ ld a, $1
+ ld [wInSpecialMode], a
+ ld a, SPECIAL_MODE_MAP_MOVE
+ ld [wSpecialMode], a
+ xor a
+ ld [wd54d], a
+ ld bc, $0030 ; 30 seconds
+ callba StartTimer
+ ld a, [wCurrentStage]
+ bit 0, a
+ jr z, .asm_3021b
+ ld a, [wMapMoveDirection]
+ add $12
+ call LoadBillboardTileData
+.asm_3021b
+ ld a, [wCurrentStage]
+ rst JumpTable ; calls JumpToFuncInTable
+CallTable_3021f: ; 0x3021f
+ dw Func_311b4 ; STAGE_RED_FIELD_TOP
+ dw Func_311b4 ; STAGE_RED_FIELD_BOTTOM
+ dw DoNothing_31324
+ dw DoNothing_31324
+ dw Func_31326 ; STAGE_BLUE_FIELD_TOP
+ dw Func_31326 ; STAGE_BLUE_FIELD_BOTTOM
+
+Func_3022b: ; 0x3022b
+ xor a
+ ld [wd5ca], a ;turn text off
+ call FillBottomMessageBufferWithBlackTile ;clear text
+ xor a
+ ld [wInSpecialMode], a
+ ld [wSpecialMode], a ;no longer in special modes
+ callba StopTimer
+ ld a, [wCurrentStage]
+ rst JumpTable ; calls JumpToFuncInTable
+CallTable_30247: ; 0x30247
+ dw Func_31234 ; STAGE_RED_FIELD_TOP
+ dw Func_31234 ; STAGE_RED_FIELD_BOTTOM
+ dw DoNothing_31325
+ dw DoNothing_31325
+ dw Func_313c3 ; STAGE_BLUE_FIELD_TOP
+ dw Func_313c3 ; STAGE_BLUE_FIELD_TOP
+
+INCLUDE "engine/pinball_game/billboard_tiledata.asm"
+
+LoadScrollingMapNameText: ; 0x3118f
+; Loads the scrolling message that displays the current map's name.
+; Input: bc = pointer to prefix scrolling text
+ push bc
+ call FillBottomMessageBufferWithBlackTile
+ call Func_30db
+ ld a, [wCurrentMap]
+ sla a
+ ld c, a
+ ld b, $0
+ ld hl, MapNames
+ add hl, bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ ld hl, wScrollingText2
+ call LoadScrollingText
+ pop de
+ ld hl, wScrollingText1
+ call LoadScrollingText
+ ret
+
+Func_311b4: ; 0x311b4
+ ld a, [wMapMoveDirection]
+ and a
+ jr nz, .asm_311ce
+ ld a, $80
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 2], a
+ xor a
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 3], a
+ ld [wIndicatorStates + 4], a
+ jr .asm_311e2
+
+.asm_311ce
+ ld a, $80
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 3], a
+ xor a
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 2], a
+ ld [wIndicatorStates + 4], a
+ jr .asm_311e2
+
+.asm_311e2
+ ld a, $2
+ callba LoadDiglettGraphics
+ ld a, $5
+ callba LoadDiglettGraphics
+ ld a, $6a
+ ld [wStageCollisionMap + $f0], a
+ ld a, $6b
+ ld [wStageCollisionMap + $110], a
+ ld a, $66
+ ld [wStageCollisionMap + $e3], a
+ ld a, $67
+ ld [wStageCollisionMap + $103], a
+ callba Func_107b0
+ ld a, $4
+ ld [wd7ad], a
+ ld de, $0003
+ call PlaySong
+ ld a, [wCurrentStage]
+ bit 0, a
+ ret z
+ callba Func_14135
+ ret
+
+Func_31234: ; 0x31234
+ callba ResetIndicatorStates
+ callba Func_107c2
+ callba SetLeftAndRightAlleyArrowIndicatorStates_RedField
+ callba Func_107e9
+ ld a, [wCurrentStage]
+ bit 0, a
+ ret z
+ callba Func_14135
+ callba LoadSlotCaveCoverGraphics_RedField
+ callba LoadMapBillboardTileData
+ ret
+
+ChooseNextMap_RedField: ; 0x31282
+; Picks the next map to perform a map move.
+; Also records which maps have been visited.
+ ld a, [wNumMapMoves]
+ inc a
+ cp $6
+ jr c, .dontReset
+ ld a, $ff
+ ld [wVisitedMaps], a
+ ld [wVisitedMaps + 1], a
+ ld [wVisitedMaps + 2], a
+ ld [wVisitedMaps + 3], a
+ ld [wVisitedMaps + 4], a
+ ld [wVisitedMaps + 5], a
+ xor a
+.dontReset
+ ld [wNumMapMoves], a
+ cp $3
+ jr c, .chooseMapFromArea1
+ cp $5
+ jr c, .chooseMapFromArea2
+ ld a, INDIGO_PLATEAU
+ ld [wCurrentMap], a
+ ld [wVisitedMaps + 5], a
+ ret
+
+.chooseMapFromArea1
+ call GenRandom
+ and $7
+ cp $7
+ jr nc, .chooseMapFromArea1
+ ld c, a
+ ld b, $0
+ ld hl, FirstMapMoveSet_RedField
+ add hl, bc
+ ld c, [hl]
+ ld hl, wVisitedMaps
+ ld a, [wNumMapMoves]
+ and a
+ jr z, .asm_312d4
+ ld b, a
+.asm_312cd
+ ld a, [hli]
+ cp c
+ jr z, .chooseMapFromArea1
+ dec b
+ jr nz, .asm_312cd
+.asm_312d4
+ ld a, c
+ ld [wCurrentMap], a
+ ld a, [wNumMapMoves]
+ ld c, a
+ ld b, $0
+ ld hl, wVisitedMaps
+ add hl, bc
+ ld a, [wCurrentMap]
+ ld [hl], a
+ ret
+
+.chooseMapFromArea2
+ call GenRandom
+ and $3
+ ld c, a
+ ld b, $0
+ ld hl, SecondMapMoveSet_RedField
+ add hl, bc
+ ld c, [hl]
+ ld hl, wVisitedMaps + 3
+ ld a, [wNumMapMoves]
+ sub $3
+ jr z, .asm_31306
+ ld b, a
+.asm_312ff
+ ld a, [hli]
+ cp c
+ jr z, .chooseMapFromArea2
+ dec b
+ jr nz, .asm_312ff
+.asm_31306
+ ld a, c
+ ld [wCurrentMap], a
+ ld a, [wNumMapMoves]
+ ld c, a
+ ld b, $0
+ ld hl, wVisitedMaps
+ add hl, bc
+ ld a, [wCurrentMap]
+ ld [hl], a
+ ret
+
+FirstMapMoveSet_RedField:
+ db PALLET_TOWN
+ db VIRIDIAN_FOREST
+ db PEWTER_CITY
+ db CERULEAN_CITY
+ db VERMILION_SEASIDE
+ db ROCK_MOUNTAIN
+ db LAVENDER_TOWN
+
+SecondMapMoveSet_RedField:
+ db CYCLING_ROAD
+ db SAFARI_ZONE
+ db SEAFOAM_ISLANDS
+ db CINNABAR_ISLAND
+
+DoNothing_31324: ; 0x31324
+ ret
+
+DoNothing_31325: ; 0x31325
+ ret
+
+Func_31326: ; 0x31326
+ ld a, [wMapMoveDirection]
+ and a
+ jr nz, .asm_3134c
+ ld a, $80
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 2], a
+ xor a
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 3], a
+ ld [wIndicatorStates + 4], a
+ ld a, $3
+ callba LoadPsyduckOrPoliwagGraphics
+ jr .asm_31382
+
+.asm_3134c
+ ld a, $80
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 3], a
+ xor a
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 2], a
+ ld [wIndicatorStates + 4], a
+ ld a, $1
+ callba LoadPsyduckOrPoliwagGraphics
+ ld a, $6
+ callba LoadPsyduckOrPoliwagGraphics
+ ld a, $7
+ callba LoadPsyduckOrPoliwagNumberGraphics
+.asm_31382
+ ld a, [wCurrentStage]
+ bit 0, a
+ jr z, .asm_3139d
+ ld a, $54
+ ld [wStageCollisionMap + $e3], a
+ ld a, $55
+ ld [wStageCollisionMap + $103], a
+ ld a, $52
+ ld [wStageCollisionMap + $f0], a
+ ld a, $53
+ ld [wStageCollisionMap + $110], a
+.asm_3139d
+ ld a, $1
+ ld [wd644], a
+ callba CloseSlotCave
+ ld de, $0003
+ call PlaySong
+ ld a, [wCurrentStage]
+ bit 0, a
+ ret z
+ callba Func_1c2cb
+ ret
+
+Func_313c3: ; 0x313c3
+ callba ResetIndicatorStates
+ callba Func_107c2
+ callba SetLeftAndRightAlleyArrowIndicatorStates_BlueField
+ ld a, $0
+ ld [wd644], a
+ ld a, [wCurrentStage]
+ bit 0, a
+ ret z
+ callba Func_1c2cb
+ callba LoadSlotCaveCoverGraphics_BlueField
+ callba LoadMapBillboardTileData
+ ret
+
+ChooseNextMap_BlueField: ; 0x3140b
+; Picks the next map to perform a map move.
+; Also records which maps have been visited.
+ ld a, [wNumMapMoves]
+ inc a
+ cp $6
+ jr c, .dontReset
+ ld a, $ff
+ ld [wVisitedMaps], a
+ ld [wVisitedMaps + 1], a
+ ld [wVisitedMaps + 2], a
+ ld [wVisitedMaps + 3], a
+ ld [wVisitedMaps + 4], a
+ ld [wVisitedMaps + 5], a
+ xor a
+.dontReset
+ ld [wNumMapMoves], a
+ cp $3
+ jr c, .chooseMapFromArea1
+ cp $5
+ jr c, .chooseMapFromArea2
+ ld a, INDIGO_PLATEAU
+ ld [wCurrentMap], a
+ ld [wVisitedMaps + 5], a
+ ret
+
+.chooseMapFromArea1
+ call GenRandom
+ and $7
+ cp $7
+ jr nc, .chooseMapFromArea1
+ ld c, a
+ ld b, $0
+ ld hl, FirstMapMoveSet_BlueField
+ add hl, bc
+ ld c, [hl]
+ ld hl, wVisitedMaps
+ ld a, [wNumMapMoves]
+ and a
+ jr z, .asm_3145e
+ ld b, a
+.asm_31457
+ ld a, [hli]
+ cp c
+ jr z, .chooseMapFromArea1
+ dec b
+ jr nz, .asm_31457
+.asm_3145e
+ ld a, c
+ ld [wCurrentMap], a
+ ld a, [wNumMapMoves]
+ ld c, a
+ ld b, $0
+ ld hl, wVisitedMaps
+ add hl, bc
+ ld a, [wCurrentMap]
+ ld [hl], a
+ ret
+
+.chooseMapFromArea2
+ call GenRandom
+ and $3
+ ld c, a
+ ld b, $0
+ ld hl, SecondMapMoveSet_BlueField
+ add hl, bc
+ ld c, [hl]
+ ld hl, wVisitedMaps + 3
+ ld a, [wNumMapMoves]
+ sub $3
+ jr z, .asm_31490
+ ld b, a
+.asm_31489
+ ld a, [hli]
+ cp c
+ jr z, .chooseMapFromArea2
+ dec b
+ jr nz, .asm_31489
+.asm_31490
+ ld a, c
+ ld [wCurrentMap], a
+ ld a, [wNumMapMoves]
+ ld c, a
+ ld b, $0
+ ld hl, wVisitedMaps
+ add hl, bc
+ ld a, [wCurrentMap]
+ ld [hl], a
+ ret
+
+FirstMapMoveSet_BlueField:
+ db VIRIDIAN_CITY
+ db VIRIDIAN_FOREST
+ db MT_MOON
+ db CERULEAN_CITY
+ db VERMILION_STREETS
+ db ROCK_MOUNTAIN
+ db CELADON_CITY
+
+SecondMapMoveSet_BlueField:
+ db FUCHSIA_CITY
+ db SAFARI_ZONE
+ db SAFFRON_CITY
+ db CINNABAR_ISLAND
+
+Func_314ae: ; 0x314ae
+ ld a, [wTimerActive]
+ and a
+ ld a, [wd54c]
+ jr z, .asm_314d0
+ cp $1
+ jp z, Func_31591
+ cp $3
+ jp z, Func_31591
+ cp $2
+ jp z, Func_315b3
+ cp $5
+ jp z, Func_315b3
+ cp $d
+ jp z, Func_315d5
+.asm_314d0
+ cp $0
+ jr z, .asm_314d6
+ scf
+ ret
+
+.asm_314d6
+ call Func_3151f
+ ld a, [wd54d]
+ call CallInFollowingTable
+PointerTable_314df: ; 0xd13df
+ padded_dab Func_314ef
+ padded_dab Func_314f1
+ padded_dab Func_314f3
+ padded_dab Func_31505
+
+Func_314ef: ; 0x314ef
+ scf
+ ret
+
+Func_314f1: ; 0x314f1
+ scf
+ ret
+
+Func_314f3: ; 0x314f3
+ callba Func_3022b
+ ld de, $0001
+ call PlaySong
+ scf
+ ret
+
+Func_31505: ; 0x31505
+ ld a, [wd5ca]
+ and a
+ ret nz
+ call FillBottomMessageBufferWithBlackTile
+ callba Func_3022b
+ ld de, $0001
+ call PlaySong
+ scf
+ ret
+
+Func_3151f: ; 0x3151f
+ ld a, $50
+ ld [wd4ef], a
+ ld [wd4f1], a
+ callba Func_107f8
+ ld a, [wd57e]
+ and a
+ ret z
+ xor a
+ ld [wd57e], a
+ ld a, $3
+ ld [wd54d], a
+ xor a
+ ld [wSlotIsOpen], a
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 2], a
+ ld [wIndicatorStates + 3], a
+ ld [wIndicatorStates + 4], a
+ ld a, [wCurrentStage]
+ bit 0, a
+ jr z, .asm_31577
+ callba Func_14135
+ callba LoadSlotCaveCoverGraphics_RedField
+ callba LoadMapBillboardTileData
+.asm_31577
+ callba StopTimer
+ call FillBottomMessageBufferWithBlackTile
+ call Func_30db
+ ld hl, wScrollingText1
+ ld de, MapMoveFailedText
+ call LoadScrollingText
+ ret
+
+Func_31591: ; 0x31591
+ ld a, [wMapMoveDirection]
+ and a
+ jr nz, .asm_315b1
+ ld a, [wIndicatorStates]
+ and a
+ jr z, .asm_315b1
+ xor a
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 2], a
+ ld a, $80
+ ld [wIndicatorStates + 4], a
+ ld a, $1
+ ld [wSlotIsOpen], a
+ ld [wd54d], a
+.asm_315b1
+ scf
+ ret
+
+Func_315b3: ; 0x315b3
+ ld a, [wMapMoveDirection]
+ and a
+ jr z, .asm_315d3
+ ld a, [wIndicatorStates + 1]
+ and a
+ jr z, .asm_315d3
+ xor a
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 3], a
+ ld a, $80
+ ld [wIndicatorStates + 4], a
+ ld a, $1
+ ld [wSlotIsOpen], a
+ ld [wd54d], a
+.asm_315d3
+ scf
+ ret
+
+Func_315d5: ; 0x315d5
+ ld de, $0000
+ call PlaySong
+ rst AdvanceFrame
+ callba ChooseNextMap_RedField
+ callba LoadMapBillboardTileData
+ lb de, $25, $25
+ call PlaySoundEffect
+ ld bc, ArrivedAtMapText
+ callba LoadScrollingMapNameText
+.asm_31603
+ callba Func_33e3
+ rst AdvanceFrame
+ ld a, [wd5ca]
+ and a
+ jr nz, .asm_31603
+ ld a, $2
+ ld [wd54d], a
+ scf
+ ret
+
+Func_3161b: ; 0x3161b
+ ld a, [wTimerActive]
+ and a
+ ld a, [wd54c]
+ jr z, .asm_3163d
+ cp $1
+ jp z, Func_31708
+ cp $f
+ jp z, Func_31708
+ cp $2
+ jp z, Func_3172a
+ cp $e
+ jp z, Func_3172a
+ cp $d
+ jp z, Func_3174c
+.asm_3163d
+ cp $0
+ jr z, .asm_31643
+ scf
+ ret
+
+.asm_31643
+ call Func_3168c
+ ld a, [wd54d]
+ call CallInFollowingTable
+PointerTable_3164c: ; 0x3164c
+ padded_dab Func_3165c
+ padded_dab Func_3165e
+ padded_dab Func_31660
+ padded_dab Func_31672
+
+Func_3165c: ; 0x3165c
+ scf
+ ret
+
+Func_3165e: ; 0x3165e
+ scf
+ ret
+
+Func_31660: ; 0x31660
+ callba Func_3022b
+ ld de, $0001
+ call PlaySong
+ scf
+ ret
+
+Func_31672: ; 0x31672
+ ld a, [wd5ca] ;if text is off
+ and a
+ ret nz
+ call FillBottomMessageBufferWithBlackTile
+ callba Func_3022b
+ ld de, $0001
+ call PlaySong
+ scf
+ ret
+
+Func_3168c: ; 0x3168c
+ ld a, $50
+ ld [wLeftMapMoveDiglettAnimationCounter], a
+ ld [wRightMapMoveDiglettFrame], a
+ ld a, $3
+ ld [wd645], a
+ ld a, $1
+ ld [wd646], a
+ callba Func_107f8
+ ld a, [wd57e]
+ and a
+ ret z
+ xor a
+ ld [wd57e], a
+ ld a, $3
+ ld [wd54d], a
+ xor a
+ ld [wSlotIsOpen], a
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 2], a
+ ld [wIndicatorStates + 3], a
+ ld [wIndicatorStates + 4], a
+ ld a, [wCurrentStage]
+ bit 0, a
+ jr z, .asm_316ee
+ callba Func_1c2cb
+ callba LoadSlotCaveCoverGraphics_BlueField
+ callba LoadMapBillboardTileData
+.asm_316ee
+ callba StopTimer
+ call FillBottomMessageBufferWithBlackTile
+ call Func_30db
+ ld hl, wScrollingText1
+ ld de, MapMoveFailedText
+ call LoadScrollingText
+ ret
+
+Func_31708: ; 0x31708
+ ld a, [wMapMoveDirection]
+ and a
+ jr nz, .asm_31728
+ ld a, [wIndicatorStates]
+ and a
+ jr z, .asm_31728
+ xor a
+ ld [wIndicatorStates], a
+ ld [wIndicatorStates + 2], a
+ ld a, $80
+ ld [wIndicatorStates + 4], a
+ ld a, $1
+ ld [wSlotIsOpen], a
+ ld [wd54d], a
+.asm_31728
+ scf
+ ret
+
+Func_3172a: ; 0x3172a
+ ld a, [wMapMoveDirection]
+ and a
+ jr z, .asm_3174a
+ ld a, [wIndicatorStates + 1]
+ and a
+ jr z, .asm_3174a
+ xor a
+ ld [wIndicatorStates + 1], a
+ ld [wIndicatorStates + 3], a
+ ld a, $80
+ ld [wIndicatorStates + 4], a
+ ld a, $1
+ ld [wSlotIsOpen], a
+ ld [wd54d], a
+.asm_3174a
+ scf
+ ret
+
+Func_3174c: ; 0x3174c
+ ld de, $0000
+ call PlaySong
+ rst AdvanceFrame
+ callba ChooseNextMap_BlueField
+ callba LoadMapBillboardTileData
+ lb de, $25, $25
+ call PlaySoundEffect
+ ld bc, ArrivedAtMapText
+ callba LoadScrollingMapNameText
+.asm_3177a
+ callba Func_33e3
+ rst AdvanceFrame
+ ld a, [wd5ca]
+ and a
+ jr nz, .asm_3177a
+ ld a, $2
+ ld [wd54d], a
+ scf
+ ret
diff --git a/engine/pinball_game/menu.asm b/engine/pinball_game/menu.asm
index a31ff1f..dcca98c 100644
--- a/engine/pinball_game/menu.asm
+++ b/engine/pinball_game/menu.asm
@@ -50,8 +50,8 @@ HandleInGameMenu: ; 0x86d7
ld bc, $04c3
call SaveData
xor a
- ld [wd803], a
- ld [wd804], a
+ ld [wRumblePattern], a
+ ld [wRumbleDuration], a
.pickedCancel
ld bc, $003c
call AdvanceFrames
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 fe31309..8cc2636 100644
--- a/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm
@@ -8,23 +8,23 @@ ResolveBlueFieldTopGameObjectCollisions: ; 0x1c715
call ResolveBlueStagePikachuCollision
call ResolveSlowpokeCollision
call ResolveCloysterCollision
- call Func_1ea3b
+ call ApplySlotForceField_BlueFieldTop
call ResolvePsyduckPoliwagCollision
- call ResolveBlueStageForceFieldCollision
- call Func_1e9c0
+ call ResolveForceFieldCollision
+ call OpenSlotCave_BlueField
call UpdateForceFieldDirection
- call Func_1f18a
+ call UpdateForceFieldGraphics
callba UpdateBallSaverState
- call Func_1f27b
+ call UpdateBlinkingPokeballs_BlueField
call UpdateMapMoveCounters_BlueFieldTop
- callba HandleExtraBall
+ callba ShowExtraBallMessage
ld a, $0
callba Func_10000
ret
ResolveBlueFieldBottomGameObjectCollisions: ; 0x1c769
call ResolveWildMonCollision_BlueField
- call ResolveBlueStageBumperCollision
+ call ResolveBumpersCollision_BlueField
call ResolvePsyduckPoliwagCollision
call UpdateBlueStageSpinner
call UpdatePinballUpgradeBlinkingAnimation_BlueField
@@ -32,17 +32,17 @@ ResolveBlueFieldBottomGameObjectCollisions: ; 0x1c769
call ResolveCAVELightCollision_BlueField
call ResolveBlueStagePinballLaunchCollision
call ResolveBlueStagePikachuCollision
- call Func_1ead4
- call ResolveBlueStageBonusMultiplierCollision
- call Func_1e757
- call Func_1e9c0
- call Func_1ea0a
+ call UpdateArrowIndicators_BlueField
+ call ResolveBonusMultiplierCollision_BlueField
+ call ResolveSlotCollision_BlueField
+ call OpenSlotCave_BlueField
+ call ApplySlotForceField_BlueFieldBottom
call UpdateForceFieldDirection
- callba Func_14733
+ callba UpdateAgainText
callba UpdateBallSaver
- call Func_1f261
+ call UpdatePokeballs_BlueField
call UpdateMapMoveCounters_BlueFieldBottom
- callba HandleExtraBall
+ callba ShowExtraBallMessage
ld a, $0
callba Func_10000
ret
@@ -219,7 +219,7 @@ UpdateForceFieldDirection: ; 0x1c8b6
ld a, [wd644]
cp $0
jr z, .asm_1c925
- ld a, [wd55a]
+ ld a, [wMapMoveDirection]
cp $0
jr nz, .asm_1c933
jr .asm_1c947
@@ -245,7 +245,7 @@ UpdateForceFieldDirection: ; 0x1c8b6
ld a, [wd644]
cp $0
jr z, .asm_1c955
- ld a, [wd55a]
+ ld a, [wMapMoveDirection]
cp $0
jr z, .asm_1c969
.asm_1c955
@@ -357,9 +357,9 @@ ResolveShellderCollision: ; 0x1c9c1
ApplyShellderCollision: ; 0x1ca29
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $3
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0200
ld a, l
ld [wFlipperYForce], a
@@ -526,40 +526,43 @@ UpdateSpinnerChargeGraphics_BlueField: ; 0x1cb43
INCLUDE "data/queued_tiledata/blue_field/spinner.asm"
-ResolveBlueStageBumperCollision: ; 1ce40
+ResolveBumpersCollision_BlueField: ; 1ce40
ld a, [wWhichBumper]
and a
- jr z, .asm_1ce53
- call LoadBumperCollisionGraphics_BlueField
- call Func_1ce60
+ jr z, .noNewCollision
+ call LoadBumpersGraphics_BlueField
+ call LightUpBumper_BlueField
xor a
ld [wWhichBumper], a
call ApplyBumperCollision_BlueField
-.asm_1ce53
- ld a, [wd4da]
+.noNewCollision
+ ld a, [wBumperLightUpDuration]
and a
ret z
dec a
- ld [wd4da], a
- call z, LoadBumperCollisionGraphics_BlueField
+ ld [wBumperLightUpDuration], a
+ call z, LoadBumpersGraphics_BlueField
ret
-Func_1ce60: ; 0x1ce60
- ld a, $10
- ld [wd4da], a
+LightUpBumper_BlueField: ; 0x1ce60
+; Makes the hit bumper light briefly
+ ld a, 16
+ ld [wBumperLightUpDuration], a
ld a, [wWhichBumperId]
sub $1
ld [wd4db], a
sla a
inc a
- jr asm_1ce7a
+ jr LoadBumperGraphics_BlueField
-LoadBumperCollisionGraphics_BlueField: ; 1ce72
+LoadBumpersGraphics_BlueField: ; 1ce72
ld a, [wd4db]
cp $ff
ret z
sla a
-asm_1ce7a: ; 0x1ce7a
+ ; fall through
+
+LoadBumperGraphics_BlueField: ; 0x1ce7a
sla a
ld c, a
ld b, $0
@@ -579,9 +582,9 @@ asm_1ce7a: ; 0x1ce7a
ApplyBumperCollision_BlueField: ; 0x1ce94
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $3
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0200
ld a, l
ld [wFlipperYForce], a
@@ -623,7 +626,7 @@ ResolveBlueStageBoardTriggerCollision: ; 0x1cfaa
callba LoadStageCollisionAttributes
ld a, $1
ld [wd580], a
- callba Func_1404a
+ callba LoadTimerGraphics
.asm_1cfe5
ld a, [wWhichBoardTriggerId]
sub $7
@@ -739,14 +742,14 @@ ResolveBlueStagePikachuCollision: ; 0x1d0a1
jr nz, .asm_1d0c9
ld a, [wWhichPikachuId]
sub $d
- ld hl, wd518
+ ld hl, wWhichPikachuSaverSide
cp [hl]
jr nz, .asm_1d110
ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
jr nz, .asm_1d0fc
.asm_1d0c9
- ld hl, PikachuSaverAnimationDataRedStage
+ ld hl, PikachuSaverAnimationData_BlueField
ld de, wPikachuSaverAnimation
call InitAnimation
ld a, [wPikachuSaverSlotRewardActive]
@@ -769,7 +772,7 @@ ResolveBlueStagePikachuCollision: ; 0x1d0a1
jr .asm_1d110
.asm_1d0fc
- ld hl, PikachuSaverAnimation2DataRedStage
+ ld hl, PikachuSaverAnimation2Data_BlueField
ld de, wPikachuSaverAnimation
call InitAnimation
ld a, $2
@@ -779,8 +782,8 @@ ResolveBlueStagePikachuCollision: ; 0x1d0a1
.asm_1d110
ld a, [wd51c]
and a
- call z, Func_1d1fb
- call Func_1d133
+ call z, SetPikachuSaverSide_BlueField
+ call UpdatePikachuSaverAnimation_BlueField
ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
ret nz
@@ -795,11 +798,11 @@ ResolveBlueStagePikachuCollision: ; 0x1d0a1
call PlaySoundEffect
ret
-Func_1d133: ; 0x1d133
+UpdatePikachuSaverAnimation_BlueField: ; 0x1d133
ld a, [wd51c]
cp $1
jr nz, .asm_1d1ae
- ld hl, PikachuSaverAnimationDataRedStage
+ ld hl, PikachuSaverAnimationData_BlueField
ld de, wPikachuSaverAnimation
call UpdateAnimation
ret nc
@@ -815,9 +818,9 @@ Func_1d133: ; 0x1d133
ld a, $1
ld [wd85d], a
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $60
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, wNumPikachuSaves
call Increment_Max100
jr nc, .asm_1d185
@@ -846,7 +849,7 @@ Func_1d133: ; 0x1d133
.asm_1d1ae
cp $2
jr nz, .asm_1d1c7
- ld hl, PikachuSaverAnimation2DataRedStage
+ ld hl, PikachuSaverAnimation2Data_BlueField
ld de, wPikachuSaverAnimation
call UpdateAnimation
ret nc
@@ -864,7 +867,7 @@ Func_1d133: ; 0x1d133
ld [wPikachuSaverAnimationFrame], a
ret
-PikachuSaverAnimationDataRedStage: ; 0x1d1d1
+PikachuSaverAnimationData_BlueField: ; 0x1d1d1
; Each entry is [duration][OAM id]
db $0C, $02
db $05, $03
@@ -886,17 +889,18 @@ PikachuSaverAnimationDataRedStage: ; 0x1d1d1
db $01, $00
db $00
-PikachuSaverAnimation2DataRedStage: ; 0x1d1f6
+PikachuSaverAnimation2Data_BlueField: ; 0x1d1f6
; Each entry is [duration][OAM id]
db $0C, $02
db $01, $00
db $00
-Func_1d1fb: ; 0x1d1fb
+SetPikachuSaverSide_BlueField: ; 0x1d1fb
+; Sets which side Pikachu is on, depending on which flipper was pressed last.
ld hl, wKeyConfigLeftFlipper
call IsKeyPressed2
jr z, .asm_1d209
- ld hl, wd518
+ ld hl, wWhichPikachuSaverSide
ld [hl], $0
ret
@@ -904,7 +908,7 @@ Func_1d1fb: ; 0x1d1fb
ld hl, wKeyConfigRightFlipper
call IsKeyPressed2
ret z
- ld hl, wd518
+ ld hl, wWhichPikachuSaverSide
ld [hl], $1
ret
@@ -1147,8 +1151,8 @@ CloysterCollisionAnimationData: ; 0x1d41d
db $28, $01
db 00 ; terminator
-ResolveBlueStageBonusMultiplierCollision: ; 0x1d438
- call Func_1d692
+ResolveBonusMultiplierCollision_BlueField: ; 0x1d438
+ call UpdateBonusMultiplierRailingLight
ld a, [wWhichBonusMultiplierRailing]
and a
jp z, UpdateBonusMultiplierRailing_BlueField
@@ -1170,7 +1174,7 @@ ResolveBlueStageBonusMultiplierCollision: ; 0x1d438
.asm_1d45e
call LoadBonusMultiplierRailingGraphics_BlueField
ld a, $3c
- ld [wd647], a
+ ld [wBonusMultiplierRailingEndLightDuration], a
ld a, $9
callba Func_10000
ld a, [wd610]
@@ -1197,7 +1201,7 @@ ResolveBlueStageBonusMultiplierCollision: ; 0x1d438
.asm_1d499
call LoadBonusMultiplierRailingGraphics_BlueField
ld a, $1e
- ld [wd647], a
+ ld [wBonusMultiplierRailingEndLightDuration], a
ld a, $a
callba Func_10000
ld a, [wd611]
@@ -1238,8 +1242,8 @@ asm_1d4fa: ; 0x1d4fa
ld a, [wBonusMultiplierOnesDigit]
add $14
call LoadBonusMultiplierRailingGraphics_BlueField
- ld a, $3c
- ld [wd647], a
+ ld a, 60
+ ld [wBonusMultiplierRailingEndLightDuration], a
ret
UpdateBonusMultiplierRailing_BlueField: ; 0x1d51b
@@ -1443,7 +1447,7 @@ GetBCDForNextBonusMultiplier_BlueField: ; 0x1d65f
.max99
ld b, a
xor a
- ld hl, Data_1d68b
+ ld hl, PowersOfTwo_1d68b
ld c, $7
.loop
bit 0, b
@@ -1464,31 +1468,33 @@ GetBCDForNextBonusMultiplier_BlueField: ; 0x1d65f
ld [wBonusMultiplierOnesDigit], a
ret
-Data_1d68b:
+PowersOfTwo_1d68b:
; BCD powers of 2
db $01, $02, $04, $08, $16, $32, $64
-Func_1d692: ; 0x1d692
- ld a, [wd647]
+UpdateBonusMultiplierRailingLight: ; 0x1d692
+; When one of the two bonus multiplier buttons are hit, they stay lit up for a second.
+; This function turns of the light effect after the duration runs out.
+ ld a, [wBonusMultiplierRailingEndLightDuration]
cp $1
- jr z, .asm_1d69e
+ jr z, .turnOffLight
dec a
- ld [wd647], a
+ ld [wBonusMultiplierRailingEndLightDuration], a
ret
-.asm_1d69e
+.turnOffLight
ld a, $0
- ld [wd647], a
+ ld [wBonusMultiplierRailingEndLightDuration], a
ld a, [hGameBoyColorFlag]
and a
- jr nz, .asm_1d6b3
+ jr nz, .gameboy
ld a, $1e
call LoadBonusMultiplierRailingGraphics_BlueField
ld a, $20
call LoadBonusMultiplierRailingGraphics_BlueField
ret
-.asm_1d6b3
+.gameboy
ld a, $2a
call LoadBonusMultiplierRailingGraphics_BlueField
ld a, $28
@@ -1775,7 +1781,7 @@ HitPoliwag3Times: ; 0x1ddc7
callba z, IncrementBonusMultiplierFromFieldEvent
.asm_1dde4
xor a
- ld [wd55a], a
+ ld [wMapMoveDirection], a
callba StartMapMoveMode
scf
ret
@@ -1791,7 +1797,7 @@ HitPsyduck3Times: ; 0x1ddf4
callba z, IncrementBonusMultiplierFromFieldEvent
.asm_1de11
ld a, $1
- ld [wd55a], a
+ ld [wMapMoveDirection], a
callba StartMapMoveMode
scf
ret
@@ -1801,9 +1807,9 @@ AddScorePsyduckOrPoliwag: ; 0x1de22
bit 0, a
ret z
ld a, $55
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $4
- ld [wd804], a
+ ld [wRumbleDuration], a
ld a, $2
ld [wd7eb], a
ld bc, FiveHundredPoints
@@ -2024,7 +2030,7 @@ ResolveBallUpgradeTriggersCollision_BlueField: ; 0x1e356
callba LoadStageCollisionAttributes
ld a, $1
ld [wd580], a
- callba Func_1404a
+ callba LoadTimerGraphics
.asm_1e386
ld a, [wStageCollisionState]
bit 0, a
@@ -2412,9 +2418,9 @@ UpdateCAVELightsBlinking_BlueField: ; 0x1e66a
jr nz, .asm_1e687
ld [wCAVELightsBlinking], a
ld a, $1
- ld [wd608], a
+ ld [wOpenedSlotByGetting4CAVELights], a
ld a, $3
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
xor a
.asm_1e687
and $7
@@ -2481,18 +2487,18 @@ UpdateCAVELightsBlinking_BlueField: ; 0x1e66a
INCLUDE "data/queued_tiledata/blue_field/cave_lights.asm"
-Func_1e757: ; 0x1e757
+ResolveSlotCollision_BlueField: ; 0x1e757
ld a, [wSlotCollision]
and a
- jr z, .asm_1e78c
+ jr z, .noCollision
xor a
ld [wSlotCollision], a
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
and a
ret z
- ld a, [wd603]
+ ld a, [wSlotEnterOrExitCounter]
and a
- jr nz, .asm_1e78c
+ jr nz, .noCollision
xor a
ld hl, wBallXVelocity
ld [hli], a
@@ -2507,16 +2513,16 @@ Func_1e757: ; 0x1e757
ld a, $16
ld [wBallYPos + 1], a
ld a, $13
- ld [wd603], a
-.asm_1e78c
- ld a, [wd603]
+ ld [wSlotEnterOrExitCounter], a
+.noCollision
+ ld a, [wSlotEnterOrExitCounter]
and a
ret z
dec a
- ld [wd603], a
+ ld [wSlotEnterOrExitCounter], a
ld a, $18
- ld [wd606], a
- ld a, [wd603]
+ ld [wSlotGlowingAnimationCounter], a
+ ld a, [wSlotEnterOrExitCounter]
cp $12
jr nz, .asm_1e7b2
lb de, $00, $21
@@ -2527,7 +2533,7 @@ Func_1e757: ; 0x1e757
.asm_1e7b2
cp $f
jr nz, .asm_1e7c1
- callba Func_dd62
+ callba LoadSuperMiniPinballGfx
ret
.asm_1e7c1
@@ -2542,18 +2548,18 @@ Func_1e757: ; 0x1e757
.asm_1e7d0
cp $9
jr nz, .asm_1e7d8
- call Func_1e830
+ call DoSlotLogic_BlueField
ret
.asm_1e7d8
cp $6
jr nz, .asm_1e7f5
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
callba LoadMiniBallGfx
ret
@@ -2570,7 +2576,7 @@ Func_1e757: ; 0x1e757
.asm_1e80e
and a
ret nz
- call Func_1e8f6
+ call LoadSlotCaveCoverGraphics_BlueField
ld a, [wCatchEmOrEvolutionSlotRewardActive]
cp CATCHEM_MODE_SLOT_REWARD
ret nz
@@ -2582,7 +2588,9 @@ Func_1e757: ; 0x1e757
ld [wCatchEmOrEvolutionSlotRewardActive], a
ret
-Func_1e830: ; 0x1e830
+DoSlotLogic_BlueField: ; 0x1e830
+; Performs the slot logic when pinball entered the slot cave.
+; This could be the slot roulette, or evolving a pokemon, for example.
xor a
ld [wIndicatorStates + 4], a
ld a, $d
@@ -2597,7 +2605,7 @@ Func_1e830: ; 0x1e830
ld a, [wPreviousNumPokeballs]
cp $3
jr nz, .asm_1e891
- ld a, [wd607]
+ ld a, [wFramesUntilSlotCaveOpens]
and a
jr nz, .asm_1e891
.asm_1e858
@@ -2617,22 +2625,22 @@ Func_1e830: ; 0x1e830
ld a, [wd498]
ld c, a
ld b, $0
- ld hl, GoToBonusStageTextIds_BlueField
+ ld hl, BonusStages_BlueField
add hl, bc
ld a, [hl]
- ld [wd497], a
- call Func_1e8c3
+ ld [wNextStage], a
+ call ShowScrollingGoToBonusText_BlueField
xor a
- ld [wd609], a
+ ld [wOpenedSlotByGetting3Pokeballs], a
ld [wCatchEmOrEvolutionSlotRewardActive], a
ld a, $1e
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
ret
.asm_1e891
callba Func_ed8e
xor a
- ld [wd608], a
+ ld [wOpenedSlotByGetting4CAVELights], a
ld a, [wd61d]
cp $d
jr nc, .asm_1e858
@@ -2647,11 +2655,11 @@ Func_1e830: ; 0x1e830
ld [wCatchEmOrEvolutionSlotRewardActive], a
ret
-Func_1e8c3: ; 0x1e8c3
+ShowScrollingGoToBonusText_BlueField: ; 0x1e8c3
call FillBottomMessageBufferWithBlackTile
call Func_30db
ld hl, wScrollingText3
- ld a, [wd497]
+ ld a, [wNextStage]
ld de, GoToMeowthStageText
cp STAGE_MEOWTH_BONUS
jr z, .loadText
@@ -2668,19 +2676,21 @@ Func_1e8c3: ; 0x1e8c3
call PlaySoundEffect
ret
-GoToBonusStageTextIds_BlueField:
+BonusStages_BlueField:
db STAGE_GENGAR_BONUS
db STAGE_MEWTWO_BONUS
db STAGE_MEOWTH_BONUS
db STAGE_DIGLETT_BONUS
db STAGE_SEEL_BONUS
-Func_1e8f6: ; 0x1e8f6
+LoadSlotCaveCoverGraphics_BlueField: ; 0x1e8f6
+; Loads the graphics for the circular slot cave area.
+; It looks like a cover that opens and closes.
ld a, [wCurrentStage]
and $1
sla a
ld c, a
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
add c
sla a
ld c, a
@@ -2701,178 +2711,19 @@ Func_1e8f6: ; 0x1e8f6
call Func_10aa
ret
-TileDataPointers_1e91e:
- dw TileData_1e926
- dw TileData_1e929
- dw TileData_1e92c
- dw TileData_1e931
-
-TileData_1e926: ; 0x1e926
- db $01
- dw TileData_1e936
-
-TileData_1e929: ; 0x1e929
- db $01
- dw TileData_1e93f
-
-TileData_1e92c: ; 0x1e92c
- db $02
- dw TileData_1e948
- dw TileData_1e952
-
-TileData_1e931: ; 0x1e931
- db $02
- dw TileData_1e95c
- dw TileData_1e966
-
-TileData_1e936: ; 0x1e936
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $229
- db $EE, $EF
-
- db $00 ; terminator
-
-TileData_1e93f: ; 0x1e93f
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $229
- db $F0, $F1
-
- db $00 ; terminator
-
-TileData_1e948: ; 0x1e948
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1F
- dw StageBlueFieldBottomBaseGameBoyGfx + $9F0
- db Bank(StageBlueFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1e952: ; 0x1e952
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $21
- dw StageBlueFieldBottomBaseGameBoyGfx + $A10
- db Bank(StageBlueFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1e95c: ; 0x1e95c
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1F
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1BC0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1e966: ; 0x1e966
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $21
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1BE0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileDataPointers_1e970:
- dw TileData_1e978
- dw TileData_1e97d
- dw TileData_1e980
- dw TileData_1e983
-
-TileData_1e978: ; 0x1e978
- db $02
- dw TileData_1e986
- dw TileData_1e98F
-
-TileData_1e97d: ; 0x1e97d
- db $01
- dw TileData_1e99b
-
-TileData_1e980: ; 0x1e980
- db $01
- dw TileData_1e9a4
-
-TileData_1e983: ; 0x1e983
- db $01
- dw TileData_1e9b2
-
-TileData_1e986: ; 0x1e986
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $229
- db $F0, $F1
-
- db $00 ; terminator
+INCLUDE "data/queued_tiledata/blue_field/slot_cave.asm"
-TileData_1e98F: ; 0x1e98F
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $224
- db $D8
-
- db $01 ; number of tiles
- dw vBGMap + $22f
- db $EC
-
- db $00 ; terminator
-
-TileData_1e99b: ; 0x1e99b
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $229
- db $F2, $F3
-
- db $00 ; terminator
-
-TileData_1e9a4: ; 0x1e9a4
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw $9809
- db $15, $16
-
- db $02 ; terminator
- dw vBGMap + $29
- db $17, $18
-
- db $00 ; terminator
-
-TileData_1e9b2: ; 0x1e9b2
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $9
- db $19, $1A
-
- db $02 ; terminator
- dw vBGMap + $29
- db $1B, $1C
-
- db $00 ; terminator
-
-Func_1e9c0: ; 0x1e9c0
- ld a, [wd607]
+OpenSlotCave_BlueField: ; 0x1e9c0
+ ld a, [wFramesUntilSlotCaveOpens]
and a
ret z
dec a
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
ret nz
ld a, [wInSpecialMode]
and a
ret nz
- ld a, [wd609]
+ ld a, [wOpenedSlotByGetting3Pokeballs]
and a
jr z, .asm_1e9dc
ld a, [wd498]
@@ -2880,28 +2731,29 @@ Func_1e9c0: ; 0x1e9c0
jr .asm_1e9e3
.asm_1e9dc
- ld a, [wd608]
+ ld a, [wOpenedSlotByGetting4CAVELights]
and a
ret z
- ld a, $1a
+ ld a, $1a ; "Slot On" billboard picture id
.asm_1e9e3
ld hl, wCurrentStage
bit 0, [hl]
callba nz, LoadBillboardTileData
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
and a
ret nz
ld a, $1
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $80
ld [wIndicatorStates + 4], a
ld a, [wCurrentStage]
bit 0, a
- call nz, Func_1e8f6
+ call nz, LoadSlotCaveCoverGraphics_BlueField
ret
-Func_1ea0a: ; 0x1ea0a
- ld a, [wd604]
+ApplySlotForceField_BlueFieldBottom: ; 0x1ea0a
+; Applies the force field to the pinball when near the slot cave opening.
+ ld a, [wSlotIsOpen]
and a
ret z
ld a, [wBallYPos + 1]
@@ -2928,10 +2780,13 @@ Func_1ea0a: ; 0x1ea0a
sla c
sla c
add hl, bc
- jr asm_1ea6a
+ jr _ApplySlotForceField_BlueField
-Func_1ea3b: ; 0x1ea3b
- ld a, [wd604]
+ApplySlotForceField_BlueFieldTop: ; 0x1ea3b
+; Applies the force field to the pinball when near the slot cave opening.
+; Even though the Slot cave is on the bottom half of the board, the force field
+; still affects the pinball when it's really close to the bottom of the top-half of the board.
+ ld a, [wSlotIsOpen]
and a
ret z
ld a, [wBallYPos + 1]
@@ -2960,7 +2815,8 @@ Func_1ea3b: ; 0x1ea3b
add hl, bc
; fall through
-asm_1ea6a: ; 0x1ea6a
+_ApplySlotForceField_BlueField: ; 0x1ea6a
+; Applies the force field to the pinball when near the slot cave opening.
ld bc, BallPhysicsData_f0000
add hl, bc
ld de, wBallXVelocity
@@ -3024,18 +2880,19 @@ asm_1ea6a: ; 0x1ea6a
ld a, h
cp $2
ret c
- ld a, [wd804]
+ ld a, [wRumbleDuration]
and a
ret nz
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
lb de, $00, $04
call PlaySoundEffect
ret
-Func_1ead4: ; 0x1ead4
+UpdateArrowIndicators_BlueField: ; 0x1ead4
+; Updates the 5 blinking arrow indicators in the blue field bottom.
ld a, [hNumFramesDropped]
and $f
ret nz
@@ -3056,7 +2913,7 @@ Func_1ead4: ; 0x1ead4
jr z, .asm_1eaf5
inc a
.asm_1eaf5
- call Func_1eb41
+ call LoadArrowIndicatorGraphics_BlueStage
.asm_1eaf8
pop bc
inc c
@@ -3070,7 +2927,7 @@ Func_1ead4: ; 0x1ead4
bit 0, a
ret z
ld bc, $0002
-.asm_1eb0d
+.loop
push bc
ld hl, wIndicatorStates
add hl, bc
@@ -3100,23 +2957,23 @@ Func_1ead4: ; 0x1ead4
ld d, a
pop af
add d
- call Func_1eb41
+ call LoadArrowIndicatorGraphics_BlueStage
pop bc
inc c
ld a, c
cp $5
- jr nz, .asm_1eb0d
+ jr nz, .loop
ret
-Func_1eb41: ; 0x1eb41
+LoadArrowIndicatorGraphics_BlueStage: ; 0x1eb41
push af
sla c
ld hl, TileDataPointers_1eb61
ld a, [hGameBoyColorFlag]
and a
- jr z, .asm_1eb4f
+ jr z, .gameboy
ld hl, TileDataPointers_1ed51
-.asm_1eb4f
+.gameboy
add hl, bc
ld a, [hli]
ld h, [hl]
@@ -3132,970 +2989,23 @@ Func_1eb41: ; 0x1eb41
call Func_10aa
ret
-TileDataPointers_1eb61:
- dw TileDataPointers_1eb6b
- dw TileDataPointers_1eb75
- dw TileDataPointers_1eb7f
- dw TileDataPointers_1eb87
- dw TileDataPointers_1eb8f
-
-TileDataPointers_1eb6b: ; 0x1eb6b
- dw TileData_1eb97
- dw TileData_1eb9a
- dw TileData_1eb9d
- dw TileData_1eba0
- dw TileData_1eba3
-
-TileDataPointers_1eb75: ; 0x1eb75
- dw TileData_1eba6
- dw TileData_1eba9
- dw TileData_1ebac
- dw TileData_1ebaf
- dw TileData_1ebb2
-
-TileDataPointers_1eb7f: ; 0x1eb7f
- dw TileData_1ebb5
- dw TileData_1ebb8
- dw TileData_1ebbb
- dw TileData_1ebbe
-
-TileDataPointers_1eb87: ; 0x1eb87
- dw TileData_1ebc1
- dw TileData_1ebc6
- dw TileData_1ebcb
- dw TileData_1ebd0
-
-TileDataPointers_1eb8f: ; 0x1eb8f
- dw TileData_1ebd5
- dw TileData_1ebda
- dw TileData_1ebdf
- dw TileData_1ebe4
-
-TileData_1eb97: ; 0x1eb97
- db $01
- dw TileData_1ebe9
-
-TileData_1eb9a: ; 0x1eb9a
- db $01
- dw TileData_1ebf9
-
-TileData_1eb9d: ; 0x1eb9d
- db $01
- dw TileData_1ec09
-
-TileData_1eba0: ; 0x1eba0
- db $01
- dw TileData_1ec19
-
-TileData_1eba3: ; 0x1eba3
- db $01
- dw TileData_1ec29
-
-TileData_1eba6: ; 0x1eba6
- db $01
- dw TileData_1ec39
-
-TileData_1eba9: ; 0x1eba9
- db $01
- dw TileData_1ec49
-
-TileData_1ebac: ; 0x1ebac
- db $01
- dw TileData_1ec59
-
-TileData_1ebaf: ; 0x1ebaf
- db $01
- dw TileData_1ec69
-
-TileData_1ebb2: ; 0x1ebb2
- db $01
- dw TileData_1ec79
-
-TileData_1ebb5: ; 0x1ebb5
- db $01
- dw TileData_1ec89
-
-TileData_1ebb8: ; 0x1ebb8
- db $01
- dw TileData_1ec93
-
-TileData_1ebbb: ; 0x1ebbb
- db $01
- dw TileData_1ec9d
-
-TileData_1ebbe: ; 0x1ebbe
- db $01
- dw TileData_1eca7
-
-TileData_1ebc1: ; 0x1ebc1
- db $02
- dw TileData_1ecb1
- dw TileData_1ecbb
-
-TileData_1ebc6: ; 0x1ebc6
- db $02
- dw TileData_1ecc5
- dw TileData_1eccf
-
-TileData_1ebcb: ; 0x1ebcb
- db $02
- dw TileData_1ecd9
- dw TileData_1ece3
-
-TileData_1ebd0: ; 0x1ebd0
- db $02
- dw TileData_1eced
- dw TileData_1ecf7
-
-TileData_1ebd5: ; 0x1ebd5
- db $02
- dw TileData_1ed01
- dw TileData_1ed0b
-
-TileData_1ebda: ; 0x1ebda
- db $02
- dw TileData_1ed15
- dw TileData_1ed1f
-
-TileData_1ebdf: ; 0x1ebdf
- db $02
- dw TileData_1ed01
- dw TileData_1ed0b
-
-TileData_1ebe4: ; 0x1ebe4
- db $02
- dw TileData_1ed15
- dw TileData_1ed1f
-
-TileData_1ebe9: ; 0x1ebe9
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $3D
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $17
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $3D
-
- db $00 ; terminator
-
-TileData_1ebf9: ; 0x1ebf9
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $3E
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $17
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $3D
-
- db $00 ; terminator
-
-TileData_1ec09: ; 0x1ec09
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $3E
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $18
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $3D
-
- db $00 ; terminator
-
-TileData_1ec19: ; 0x1ec19
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $3E
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $18
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $3E
-
- db $00 ; terminator
-
-TileData_1ec29: ; 0x1ec29
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $3D
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $18
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $3D
-
- db $00 ; terminator
-
-TileData_1ec39: ; 0x1ec39
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $3F
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $1D
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $3F
-
- db $00 ; terminator
-
-TileData_1ec49: ; 0x1ec49
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $40
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $1D
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $3F
-
- db $00 ; terminator
-
-TileData_1ec59: ; 0x1ec59
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $40
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $1E
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $3F
-
- db $00 ; terminator
-
-TileData_1ec69: ; 0x1ec69
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $40
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $1E
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $40
-
- db $00 ; terminator
-
-TileData_1ec79: ; 0x1ec79
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $40
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $1D
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $40
-
- db $00 ; terminator
-
-TileData_1ec89: ; 0x1ec89
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $15
- dw StageBlueFieldBottomBaseGameBoyGfx + $950
- db Bank(StageBlueFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1ec93: ; 0x1ec93
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $15
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1F40
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ec9d: ; 0x1ec9d
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $15
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1F60
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1eca7: ; 0x1eca7
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $15
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1F80
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ecb1: ; 0x1ecb1
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $19
- dw StageBlueFieldBottomBaseGameBoyGfx + $990
- db Bank(StageBlueFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1ecbb: ; 0x1ecbb
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1B
- dw StageBlueFieldBottomBaseGameBoyGfx + $9B0
- db Bank(StageBlueFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1ecc5: ; 0x1ecc5
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $19
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2270
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1eccf: ; 0x1eccf
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1B
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2290
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ecd9: ; 0x1ecd9
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $19
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $22B0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ece3: ; 0x1ece3
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1B
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $22D0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1eced: ; 0x1eced
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $19
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $22F0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ecf7: ; 0x1ecf7
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1B
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2310
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ed01: ; 0x1ed01
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $23
- dw StageBlueFieldBottomBaseGameBoyGfx + $A30
- db Bank(StageBlueFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1ed0b: ; 0x1ed0b
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $25
- dw StageBlueFieldBottomBaseGameBoyGfx + $A50
- db Bank(StageBlueFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1ed15: ; 0x1ed15
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $23
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C00
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ed1f: ; 0x1ed1f
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $25
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C20
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ed29: ; 0x1ed29
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $23
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C40
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ed33: ; 0x1ed33
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $25
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C60
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1e3d: ; 0x1e3d
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $23
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1C80
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_1ed47: ; 0x1ed47
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $25
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1CA0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileDataPointers_1ed51: ; 0x1ed51
- dw TileDataPointers_1ed5b
- dw TileDataPointers_1ed65
- dw TileDataPointers_1ed6f
- dw TileDataPointers_1ed77
- dw TileDataPointers_1ed7f
-
-TileDataPointers_1ed5b: ; 0x1ed5b
- dw TileData_1ed87
- dw TileData_1ed8a
- dw TileData_1ed8d
- dw TileData_1ed90
- dw TileData_1ed93
-
-TileDataPointers_1ed65: ; 0x1ed65
- dw TileData_1ed96
- dw TileData_1ed99
- dw TileData_1ed9c
- dw TileData_1ed9f
- dw TileData_1eda2
-
-TileDataPointers_1ed6f: ; 0x1ed6f
- dw TileData_1eda5
- dw TileData_1eda8
- dw TileData_1edab
- dw TileData_1edae
-
-TileDataPointers_1ed77: ; 0x1ed77
- dw TileData_1edb1
- dw TileData_1edb4
- dw TileData_1edb7
- dw TileData_1edba
-
-TileDataPointers_1ed7f: ; 0x1ed7f
- dw TileData_1edbd
- dw TileData_1edc0
- dw TileData_1edc3
- dw TileData_1edc6
-
-TileData_1ed87: ; 0x1ed87
- db $01
- dw TileData_1edc9
-
-TileData_1ed8a: ; 0x1ed8a
- db $01
- dw TileData_1edd9
-
-TileData_1ed8d: ; 0x1ed8d
- db $01
- dw TileData_1ede9
-
-TileData_1ed90: ; 0x1ed90
- db $01
- dw TileData_1edf9
-
-TileData_1ed93: ; 0x1ed93
- db $01
- dw TileData_1ee09
-
-TileData_1ed96: ; 0x1ed96
- db $01
- dw TileData_1ee19
-
-TileData_1ed99: ; 0x1ed99
- db $01
- dw TileData_1ee29
-
-TileData_1ed9c: ; 0x1ed9c
- db $01
- dw TileData_1ee39
-
-TileData_1ed9f: ; 0x1ed9f
- db $01
- dw TileData_1ee49
-
-TileData_1eda2: ; 0x1eda2
- db $01
- dw TileData_1ee59
-
-TileData_1eda5: ; 0x1eda5
- db $01
- dw TileData_1ee69
-
-TileData_1eda8: ; 0x1eda8
- db $01
- dw TileData_1ee75
-
-TileData_1edab: ; 0x1edab
- db $01
- dw TileData_1ee81
-
-TileData_1edae: ; 0x1edae
- db $01
- dw TileData_1ee8d
-
-TileData_1edb1: ; 0x1edb1
- db $01
- dw TileData_1ee99
-
-TileData_1edb4: ; 0x1edb4
- db $01
- dw TileData_1eea7
-
-TileData_1edb7: ; 0x1edb7
- db $01
- dw TileData_1eeb5
-
-TileData_1edba: ; 0x1edba
- db $01
- dw TileData_1eec3
-
-TileData_1edbd: ; 0x1edbd
- db $01
- dw TileData_1eed1
-
-TileData_1edc0: ; 0x1edc0
- db $01
- dw TileData_1eedf
-
-TileData_1edc3: ; 0x1edc3
- db $01
- dw TileData_1eeed
-
-TileData_1edc6: ; 0x1edc6
- db $01
- dw TileData_1eefb
-
-TileData_1edc9: ; 0x1edc9
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $31
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $0D
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $7C
-
- db $00 ; terminator
-
-TileData_1edd9: ; 0x1edd9
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $32
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $0D
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $7C
-
- db $00 ; terminator
-
-TileData_1ede9: ; 0x1ede9
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $32
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $0E
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $7C
-
- db $00 ; terminator
-
-TileData_1edf9: ; 0x1edf9
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $32
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $0E
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $7D
-
- db $00 ; terminator
-
-TileData_1ee09: ; 0x1ee09
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $64
- db $31
-
- db $01 ; number of tiles
- dw vBGMap + $84
- db $0E
-
- db $01 ; number of tiles
- dw vBGMap + $A5
- db $7C
-
- db $00 ; terminator
-
-TileData_1ee19: ; 0x1ee19
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $33
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $0F
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $7E
-
- db $00 ; terminator
-
-TileData_1ee29: ; 0x1ee29
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $34
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $0F
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $7E
-
- db $00 ; terminator
-
-TileData_1ee39: ; 0x1ee39
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $34
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $10
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $7E
-
- db $00 ; terminator
-
-TileData_1ee49: ; 0x1ee49
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $34
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $10
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $7F
-
- db $00 ; terminator
-
-TileData_1ee59: ; 0x1ee59
- dw LoadTileLists
- db $03 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $6F
- db $33
-
- db $01 ; number of tiles
- dw vBGMap + $8F
- db $10
-
- db $01 ; number of tiles
- dw vBGMap + $AE
- db $7E
-
- db $00 ; terminator
+INCLUDE "data/queued_tiledata/blue_field/arrow_indicators.asm"
-TileData_1ee69: ; 0x1ee69
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $48
- db $05
-
- db $01 ; number of tiles
- dw vBGMap + $68
- db $06
-
- db $00 ; terminator
-
-TileData_1ee75: ; 0x1ee75
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $48
- db $07
-
- db $01 ; number of tiles
- dw vBGMap + $68
- db $08
-
- db $00 ; terminator
-
-TileData_1ee81: ; 0x1ee81
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $48
- db $09
-
- db $01 ; number of tiles
- dw vBGMap + $68
- db $0A
-
- db $00 ; terminator
-
-TileData_1ee8d: ; 0x1ee8d
- dw LoadTileLists
- db $02 ; total number of tiles
-
- db $01 ; number of tiles
- dw vBGMap + $48
- db $0B
-
- db $01 ; number of tiles
- dw vBGMap + $68
- db $0C
-
- db $00 ; terminator
-
-TileData_1ee99: ; 0x1ee99
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $4B
- db $26, $27
-
- db $02 ; number of tiles
- dw vBGMap + $6B
- db $28, $29
-
- db $00 ; terminator
-
-TileData_1eea7: ; 0x1eea7
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $4B
- db $2A, $2B
-
- db $02 ; number of tiles
- dw vBGMap + $6B
- db $2C, $2D
-
- db $00 ; terminator
-
-TileData_1eeb5: ; 0x1eeb5
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $4B
- db $2E, $2F
-
- db $02 ; number of tiles
- dw vBGMap + $6B
- db $30, $31
-
- db $00 ; terminator
-
-TileData_1eec3: ; 0x1eec3
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $4B
- db $32, $33
-
- db $02 ; number of tiles
- dw vBGMap + $6B
- db $34, $35
-
- db $00 ; terminator
-
-TileData_1eed1: ; 0x1eed1
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $49
- db $16, $17
-
- db $02 ; number of tiles
- dw vBGMap + $69
- db $18, $19
-
- db $00 ; terminator
-
-TileData_1eedf: ; 0x1eedf
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $49
- db $1A, $1B
-
- db $02 ; number of tiles
- dw vBGMap + $69
- db $1C, $1D
-
- db $00 ; terminator
-
-TileData_1eeed: ; 0x1eeed
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $49
- db $1E, $1F
-
- db $02 ; number of tiles
- dw vBGMap + $69
- db $20, $21
-
- db $00 ; terminator
-
-TileData_1eefb: ; 0x1eefb
- dw LoadTileLists
- db $04 ; total number of tiles
-
- db $02 ; number of tiles
- dw vBGMap + $49
- db $22, $23
-
- db $02 ; number of tiles
- dw vBGMap + $69
- db $24, $25
-
- db $00 ; terminator
-
-ResolveBlueStageForceFieldCollision: ; 0x1ef09
+ResolveForceFieldCollision: ; 0x1ef09
+; Handles the collision with the directional force field in between Slowpoke and Cloyster.
ld a, [wBlueStageForceFieldDirection]
cp $0 ; up direction
- jp z, Func_1ef20
+ jp z, ResolveForceFieldCollision_Up
cp $1 ; right direction
- jp z, Func_1ef4d
+ jp z, ResolveForceFieldCollision_Right
cp $2 ; down direction
- jp z, Func_1ef7e
+ jp z, ResolveForceFieldCollision_Down
cp $3 ; left direction
- jp z, Func_1efae
+ jp z, ResolveForceFieldCollision_Left
; fall through
; default to upward forcefield
-Func_1ef20: ; 0x1ef20
+ResolveForceFieldCollision_Up: ; 0x1ef20
ld a, [wBallYPos + 1]
sub $60
cp $30
@@ -4120,9 +3030,9 @@ Func_1ef20: ; 0x1ef20
sla c
sla c
add hl, bc
- jp Func_1efdc
+ jp ApplyForceFieldForce
-Func_1ef4d: ; 0x1ef4d
+ResolveForceFieldCollision_Right: ; 0x1ef4d
ld a, [wBallXPos + 1]
sub $38
cp $30
@@ -4150,9 +3060,9 @@ Func_1ef4d: ; 0x1ef4d
sla c
sla c
add hl, bc
- jp Func_1efdc
+ jp ApplyForceFieldForce
-Func_1ef7e: ; 0x1ef7e
+ResolveForceFieldCollision_Down: ; 0x1ef7e
ld a, [wBallYPos + 1]
sub $60
cp $30
@@ -4180,9 +3090,9 @@ Func_1ef7e: ; 0x1ef7e
sla c
sla c
add hl, bc
- jr Func_1efdc
+ jr ApplyForceFieldForce
-Func_1efae: ; 0x1efae
+ResolveForceFieldCollision_Left: ; 0x1efae
ld a, [wBallXPos + 1]
sub $38
cp $30
@@ -4211,20 +3121,21 @@ Func_1efae: ; 0x1efae
sla c
add hl, bc
; fall through
-Func_1efdc: ; 0x1efdc
+
+ApplyForceFieldForce: ; 0x1efdc
ld a, [wBlueStageForceFieldDirection]
cp $0 ; up direction
- jp z, Func_1eff3
+ jp z, ApplyForceFieldForce_Up
cp $1 ; right direction
- jp z, Func_1f0be
+ jp z, ApplyForceFieldForce_Right
cp $2 ; down direction
- jp z, Func_1f057
+ jp z, ApplyForceFieldForce_Down
cp $3 ; left direction
- jp z, Func_1f124
+ jp z, ApplyForceFieldForce_Left
; fall through
; default to upward forcefield
-Func_1eff3: ; 0x1eff3
+ApplyForceFieldForce_Up: ; 0x1eff3
ld bc, BallPhysicsData_ec000
add hl, bc
ld de, wBallXVelocity
@@ -4288,16 +3199,16 @@ Func_1eff3: ; 0x1eff3
ld a, h
cp $2
ret c
- ld a, [wd804]
+ ld a, [wRumbleDuration]
and a
ret nz
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ret
-Func_1f057: ; 0x1f057
+ApplyForceFieldForce_Down: ; 0x1f057
ld bc, BallPhysicsData_ec000
add hl, bc
ld de, wBallXVelocity
@@ -4363,16 +3274,16 @@ Func_1f057: ; 0x1f057
ld a, h
cp $2
ret c
- ld a, [wd804]
+ ld a, [wRumbleDuration]
and a
ret nz
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ret
-Func_1f0be: ; 0x1f0be
+ApplyForceFieldForce_Right: ; 0x1f0be
ld bc, BallPhysicsData_ec000
add hl, bc
ld de, wBallYVelocity
@@ -4438,16 +3349,16 @@ Func_1f0be: ; 0x1f0be
ld a, h
cp $2
ret c
- ld a, [wd804]
+ ld a, [wRumbleDuration]
and a
ret nz
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ret
-Func_1f124: ; 0x1f124
+ApplyForceFieldForce_Left: ; 0x1f124
ld bc, BallPhysicsData_ec000
add hl, bc
ld de, wBallYVelocity
@@ -4513,19 +3424,19 @@ Func_1f124: ; 0x1f124
ld a, h
cp $2
ret c
- ld a, [wd804]
+ ld a, [wRumbleDuration]
and a
ret nz
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ret
-Func_1f18a: ; 0x1f18a
+UpdateForceFieldGraphics: ; 0x1f18a
ld a, [wBlueStageForceFieldGfxNeedsLoading]
cp $0
- jr z, .asm_1f1b4
+ jr z, .done
ld a, [wBlueStageForceFieldDirection]
sla a
ld c, a
@@ -4533,9 +3444,9 @@ Func_1f18a: ; 0x1f18a
ld hl, TileDataPointers_1f1b5
ld a, [hGameBoyColorFlag]
and a
- jr z, .asm_1f1a4
+ jr z, .gameboy
ld hl, TileDataPointers_1f201
-.asm_1f1a4
+.gameboy
add hl, bc
ld a, [hli]
ld h, [hl]
@@ -4546,17 +3457,19 @@ Func_1f18a: ; 0x1f18a
call Func_10aa
ld a, $0
ld [wBlueStageForceFieldGfxNeedsLoading], a
-.asm_1f1b4
+.done
ret
INCLUDE "data/queued_tiledata/blue_field/force_field.asm"
-Func_1f261: ; 0x1f261
- call Func_1f27b
+UpdatePokeballs_BlueField: ; 0x1f261
+; Update the pokeballs underneath the billboard, which blink for awhile after catch'em mode and evolution mode.
+ call UpdateBlinkingPokeballs_BlueField
ret nc
; fall through
-Func_1f265: ; 0x1f265
+LoadPokeballsGraphics_BlueField: ; 0x1f265
+; Loads the graphics for the list of pokeballs underneath the billboard picture.
sla a
ld c, a
ld b, $0
@@ -4571,7 +3484,7 @@ Func_1f265: ; 0x1f265
call Func_10c5
ret
-Func_1f27b: ; 0x1f27b
+UpdateBlinkingPokeballs_BlueField: ; 0x1f27b
ld a, [wPreviousNumPokeballs]
ld hl, wNumPokeballs
cp [hl]
@@ -4579,21 +3492,21 @@ Func_1f27b: ; 0x1f27b
ld a, [wPokeballBlinkingCounter]
dec a
ld [wPokeballBlinkingCounter], a
- jr nz, .asm_1f2a5
+ jr nz, .stillBlinking
ld a, [wNumPokeballs]
ld [wPreviousNumPokeballs], a
cp $3
- jr c, .asm_1f2a0
+ jr c, .dontOpenSlot
ld a, $1
- ld [wd609], a
+ ld [wOpenedSlotByGetting3Pokeballs], a
ld a, $3
- ld [wd607], a
-.asm_1f2a0
+ ld [wFramesUntilSlotCaveOpens], a
+.dontOpenSlot
ld a, [wPreviousNumPokeballs]
scf
ret
-.asm_1f2a5
+.stillBlinking
and $7
ret nz
ld a, [wPokeballBlinkingCounter]
@@ -4608,59 +3521,20 @@ Func_1f27b: ; 0x1f27b
scf
ret
-TileDataPointers_1f2b9:
- dw TileData_1f2c1
- dw TileData_1f2cc
- dw TileData_1f2d7
- dw TileData_1f2e2
-
-TileData_1f2c1: ; 0x1f2c1
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw vBGMap + $107
- db $B0, $B1, $B0, $B1, $B0, $B1
-
- db $00 ; terminator
-
-TileData_1f2cc: ; 0x1f2cc
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw vBGMap + $107
- db $AE, $AF, $B0, $B1, $B0, $B1
-
- db $00 ; terminator
-
-TileData_1f2d7: ; 0x1f2d7
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw vBGMap + $107
- db $AE, $AF, $AE, $AF, $B0, $B1
-
- db $00 ; terminator
-
-TileData_1f2e2: ; 0x1f2e2
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw vBGMap + $107
- db $AE, $AF, $AE, $AF, $AE, $AF
-
- db $00 ; terminator
+INCLUDE "data/queued_tiledata/blue_field/pokeballs.asm"
-Func_1f2ed: ; 0x1f2ed
+CloseSlotCave: ; 0x1f2ed
+; Closes the Slot cave, so it can't be entered.
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld [wIndicatorStates + 4], a
ld [hFarCallTempA], a
- ld a, Bank(Func_1e8f6) ; this is in the same bank...
- ld hl, Func_1e8f6
+ ld a, Bank(LoadSlotCaveCoverGraphics_BlueField) ; this is in the same bank...
+ ld hl, LoadSlotCaveCoverGraphics_BlueField
call BankSwitch
ret
-Func_1f2ff: ; 0x1f2ff
+SetLeftAndRightAlleyArrowIndicatorStates_BlueField: ; 0x1f2ff
ld a, [wLeftAlleyCount]
cp $3
jr c, .asm_1f30b
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 05cb568..4bfbba4 100644
--- a/engine/pinball_game/object_collision/diglett_bonus_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/diglett_bonus_resolve_collision.asm
@@ -547,9 +547,9 @@ Func_1aad4: ; 0x1aad4
lb de, $00, $36
call PlaySoundEffect
ld a, $33
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0200
ld a, l
ld [wFlipperYForce], a
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 dca326b..b991e1f 100644
--- a/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm
@@ -210,9 +210,9 @@ Func_18464: ; 0x18464
ld bc, OneHundredThousandPoints
callba AddBigBCD6FromQueue
ld a, $33
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0100
ld a, l
ld [wFlipperYForce], a
@@ -458,9 +458,9 @@ Func_1860b: ; 0x1860b
ld bc, FiveHundredThousandPoints
callba AddBigBCD6FromQueue
ld a, $33
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0100
ld a, l
ld [wFlipperYForce], a
@@ -727,9 +727,9 @@ Func_187b1: ; 0x187b1
ld bc, FiveMillionPoints
callba AddBigBCD6FromQueue
ld a, $33
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0200
ld a, l
ld [wFlipperYForce], a
@@ -773,9 +773,9 @@ Func_18876: ; 0x18876
ld a, $1
ld [wd6a4], a
ld a, $11
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
.asm_1889b
ld a, [wGengarAnimationState]
ld hl, wd6a3
@@ -824,9 +824,9 @@ Func_188e1: ; 0x188e1
jr nz, .asm_18901
.asm_188f7
ld a, $1
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
.asm_18901
ld a, [wGengarAnimationState]
cp $6
@@ -1429,9 +1429,9 @@ Func_18d34: ; 0x18d34
ld bc, OneHundredPoints
callba AddBigBCD6FromQueue
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $3
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0100
ld a, l
ld [wFlipperYForce], a
@@ -1440,7 +1440,7 @@ Func_18d34: ; 0x18d34
ld a, $80
ld [wFlipperCollision], a
ld de, $002f
- call Func_4d8
+ call PlaySFXIfNoneActive
.asm_18d71
ret
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 78b01a0..c61a567 100644
--- a/engine/pinball_game/object_collision/meowth_bonus_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/meowth_bonus_resolve_collision.asm
@@ -415,9 +415,9 @@ Func_245ab: ; 0x245ab
ld [wd6e7], a
ld [wd6f3], a
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $3
- ld [wd804], a
+ ld [wRumbleDuration], a
lb de, $00, $33
call PlaySoundEffect
ld bc, OneThousandPoints
@@ -1661,9 +1661,9 @@ Func_24e7f: ; 0x24e7f
ld [hl], a
.asm_24e92
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $3
- ld [wd804], a
+ ld [wRumbleDuration], a
lb de, $00, $32
call PlaySoundEffect
ld a, [wMeowthStageBonusCounter]
diff --git a/engine/pinball_game/object_collision/mewtwo_bonus_object_collision.asm b/engine/pinball_game/object_collision/mewtwo_bonus_object_collision.asm
index e6bbae5..7b15498 100644
--- a/engine/pinball_game/object_collision/mewtwo_bonus_object_collision.asm
+++ b/engine/pinball_game/object_collision/mewtwo_bonus_object_collision.asm
@@ -137,13 +137,13 @@ Func_1936f: ; 0x1936f
ld a, h
cp $2
jr c, .asm_19410
- ld a, [wd804]
+ ld a, [wRumbleDuration]
and a
jr nz, .asm_19410
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
.asm_19410
scf
ret
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 f8c7a6f..cf70cf1 100644
--- a/engine/pinball_game/object_collision/red_stage_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/red_stage_resolve_collision.asm
@@ -8,22 +8,22 @@ ResolveRedFieldTopGameObjectCollisions: ; 0x1460e
call UpdateCAVELightsBlinking_RedField
call ResolveRedStageBoardTriggerCollision
call ResolveRedStagePikachuCollision
- call ResolveStaryuCollision
+ call ResolveStaryuCollision_Top
call ResolveBellsproutCollision
call ResolveDittoSlotCollision
- call Func_161e0
- call Func_164e3
+ call ApplySlotForceField_RedFieldTop
+ call OpenSlotCave_RedField
call UpdateBallSaverState
- call Func_174ea
+ call UpdateBlinkingPokeballs_RedField
call UpdateMapMoveCounters_RedFieldTop
- callba HandleExtraBall
+ callba ShowExtraBallMessage
ld a, $0
callba Func_10000
ret
ResolveRedFieldBottomGameObjectCollisions: ; 0x14652
call ResolveWildMonCollision_RedField
- call ResolveRedStageBumperCollision
+ call ResolveBumpersCollision_RedField
call ResolveDiglettCollision
call UpdateMapMoveCounters_RedFieldBottom
call UpdateRedStageSpinner
@@ -32,16 +32,16 @@ ResolveRedFieldBottomGameObjectCollisions: ; 0x14652
call ResolveCAVELightCollision_RedField
call ResolveRedStagePinballLaunchCollision
call ResolveRedStagePikachuCollision
- call Func_167ff
- call Func_169a6
+ call ResolveStaryuCollision_Bottom
+ call UpdateArrowIndicators_RedField
call ResolveRedStageBonusMultiplierCollision
- call Func_16279
- call Func_161af
- call Func_164e3
- call Func_14733
+ call ResolveSlotCollision_RedField
+ call ApplySlotForceField_RedFieldBottom
+ call OpenSlotCave_RedField
+ call UpdateAgainText
call UpdateBallSaver
- call Func_174d0
- callba HandleExtraBall
+ call UpdatePokeballs_RedField
+ callba ShowExtraBallMessage
ld a, $0
callba Func_10000
ret
@@ -130,21 +130,23 @@ BgTileData_1172b: ;BallSaverIconOffSprite
BgTileData_1472f: ;BallSaverIconOnSprite
db $B4, $B5, $B6, $B7
-Func_14733: ; 0x14733
+UpdateAgainText: ; 0x14733
+; Determine which "Again" text to load. (Faded or solid, if extra ball).
ld c, $0
ld a, [wCurBonusMultiplierFromFieldEvents]
and a
jr z, .asm_1473d
ld c, $1
.asm_1473d
- ld a, [wd4a9]
+ ld a, [wExtraBall]
cp c
ld a, c
- ld [wd4a9], a
+ ld [wExtraBall], a
ret z
; fall through
-Func_14746: ; 0x14746
+LoadAgainTextGraphics: ; 0x14746
+; Loads the graphics that show whether or not the player has an Extra Ball.
ld c, $0
ld a, [wCurBonusMultiplierFromFieldEvents]
and a
@@ -152,30 +154,30 @@ Func_14746: ; 0x14746
ld c, $2
.asm_14750
ld b, $0
- ld hl, AgainTextTileDataRedField
+ ld hl, AgainTextTileData
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, BANK(AgainTextTileDataRedField)
+ ld a, BANK(AgainTextTileData)
call Func_10aa
ret
-AgainTextTileDataRedField:
- dw AgainTextOffTileDataRedField
- dw AgainTextOnTileDataRedField
+AgainTextTileData:
+ dw AgainTextOffTileData
+ dw AgainTextOnTileData
-AgainTextOffTileDataRedField:
+AgainTextOffTileData:
db 2
- dw AgainTextOffTileDataRedField1
- dw AgainTextOffTileDataRedField2
+ dw AgainTextOffTileData1
+ dw AgainTextOffTileData2
-AgainTextOnTileDataRedField:
+AgainTextOnTileData:
db 2
- dw AgainTextOnTileDataRedField1
- dw AgainTextOnTileDataRedField2
+ dw AgainTextOnTileData1
+ dw AgainTextOnTileData2
-AgainTextOffTileDataRedField1:
+AgainTextOffTileData1:
dw Func_11d2
db $20, $02
dw vTilesSH tile $38
@@ -183,7 +185,7 @@ AgainTextOffTileDataRedField1:
db Bank(AgainTextOffGfx)
db $00
-AgainTextOffTileDataRedField2:
+AgainTextOffTileData2:
dw Func_11d2
db $20, $02
dw vTilesSH tile $3a
@@ -191,7 +193,7 @@ AgainTextOffTileDataRedField2:
db Bank(AgainTextOffGfx)
db $00
-AgainTextOnTileDataRedField1:
+AgainTextOnTileData1:
dw Func_11d2
db $20, $02
dw vTilesSH tile $38
@@ -199,7 +201,7 @@ AgainTextOnTileDataRedField1:
db Bank(StageRedFieldBottomBaseGameBoyGfx)
db $00
-AgainTextOnTileDataRedField2:
+AgainTextOnTileData2:
dw Func_11d2
db $20, $02
dw vTilesSH tile $3a
@@ -317,7 +319,7 @@ ResolveDiglettCollision: ; 0x147aa
ld a, $69
ld [wStageCollisionMap + $110], a
.asm_1487c
- call Func_14990
+ call UpdateDiglettAnimations
ret
UpdateMapMoveCounters_RedFieldBottom: ; 0x14880
@@ -438,7 +440,7 @@ HitRightDiglett3Times: ; 0x14920
callba z, IncrementBonusMultiplierFromFieldEvent
.asm_14937
ld a, $1
- ld [wd55a], a
+ ld [wMapMoveDirection], a
callba StartMapMoveMode
ret
@@ -451,15 +453,15 @@ HitLeftDiglett3Times: ; 0x14947
callba z, IncrementBonusMultiplierFromFieldEvent
.asm_1495e
xor a
- ld [wd55a], a
+ ld [wMapMoveDirection], a
callba StartMapMoveMode
ret
AddScoreForHittingDiglett: ; 0x1496d
ld a, $55
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $4
- ld [wd804], a
+ ld [wRumbleDuration], a
ld a, $2
ld [wd7eb], a
ld bc, FiveHundredPoints
@@ -468,7 +470,7 @@ AddScoreForHittingDiglett: ; 0x1496d
call PlaySoundEffect
ret
-Func_14990: ; 0x14990
+UpdateDiglettAnimations: ; 0x14990
ld a, [wd4ef]
and a
jr nz, .asm_149b6
@@ -557,7 +559,7 @@ ResolveVoltorbCollision: ; 0x14d85
jr z, .noVoltorbCollision
xor a
ld [wWhichVoltorb], a
- call Func_14dc9
+ call ApplyVoltorbCollision
ld a, $10
ld [wVoltorbHitAnimationDuration], a
ld a, [wWhichVoltorbId]
@@ -580,11 +582,11 @@ ResolveVoltorbCollision: ; 0x14d85
ld [wWhichAnimatedVoltorb], a
ret
-Func_14dc9: ; 0x14dc9
+ApplyVoltorbCollision: ; 0x14dc9
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $3
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0200
ld a, l
ld [wFlipperYForce], a
@@ -848,9 +850,9 @@ UpdateCAVELightsBlinking_RedField: ; 0x15270
jr nz, .asm_1528d
ld [wCAVELightsBlinking], a
ld a, $1
- ld [wd608], a
+ ld [wOpenedSlotByGetting4CAVELights], a
ld a, $3
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
xor a
.asm_1528d
and $7
@@ -933,7 +935,7 @@ ResolveBallUpgradeTriggersCollision_RedField: ; 0x1535d
ld [wRightAlleyTrigger], a
ld [wLeftAlleyTrigger], a
ld [wSecondaryLeftAlleyTrigger], a
- call Func_159c9
+ call UpdateFieldStructures_RedField
ld a, $b
callba Func_10000
ld a, [wWhichPinballUpgradeTriggerId]
@@ -1285,7 +1287,7 @@ ResolveRedStageBoardTriggerCollision: ; 0x1581f
call nz, HandleRightAlleyTrigger_RedField
ld a, [wCollidedAlleyTriggers + 7]
and a
- call nz, Func_15990
+ call nz, HandleThirdRightAlleyTrigger_RedField
ret
HandleSecondaryLeftAlleyTrigger_RedField: ; 0x1587c
@@ -1315,7 +1317,7 @@ HandleSecondaryLeftAlleyTrigger_RedField: ; 0x1587c
or $6
ld [wStageCollisionState], a
callba LoadStageCollisionAttributes
- call Func_159f4
+ call LoadFieldStructureGraphics_RedField
ret
HandleThirdLeftAlleyTrigger_RedField: ; 0x158c0
@@ -1345,7 +1347,7 @@ HandleThirdLeftAlleyTrigger_RedField: ; 0x158c0
or $6
ld [wStageCollisionState], a
callba LoadStageCollisionAttributes
- call Func_159f4
+ call LoadFieldStructureGraphics_RedField
ret
HandleSecondaryStaryuAlleyTrigger_RedField: ; 0x15904
@@ -1369,7 +1371,7 @@ HandleLeftAlleyTrigger_RedField: ; 0x1591e
ld [wSecondaryLeftAlleyTrigger], a
ld a, $1
ld [wLeftAlleyTrigger], a
- call Func_159c9
+ call UpdateFieldStructures_RedField
ret
HandleStaryuAlleyTrigger_RedField: ; 0x15931
@@ -1380,7 +1382,7 @@ HandleStaryuAlleyTrigger_RedField: ; 0x15931
ld [wLeftAlleyTrigger], a
ld a, $1
ld [wSecondaryLeftAlleyTrigger], a
- call Func_159c9
+ call UpdateFieldStructures_RedField
ret
HandleSecondaryRightAlleyTrigger_RedField: ; 0x15944
@@ -1420,10 +1422,10 @@ HandleRightAlleyTrigger_RedField: ; 0x1597d
ld [wSecondaryLeftAlleyTrigger], a
ld a, $1
ld [wRightAlleyTrigger], a
- call Func_159c9
+ call UpdateFieldStructures_RedField
ret
-Func_15990: ; 0x15990
+HandleThirdRightAlleyTrigger_RedField: ; 0x15990
xor a
ld [wCollidedAlleyTriggers + 7], a
ld a, [wRightAlleyTrigger]
@@ -1451,7 +1453,8 @@ Func_15990: ; 0x15990
ld [wIndicatorStates + 3], a
ret
-Func_159c9: ; 0x159c9
+UpdateFieldStructures_RedField: ; 0x159c9
+; The Red field's top half has some dynamic strucutres, such as Ditto, the lightning bolt guard rail, and the roof over the 3 Voltorbs.
ld a, [wd7ad]
bit 7, a
ret nz
@@ -1463,13 +1466,15 @@ Func_159c9: ; 0x159c9
ld a, $ff
ld [wd7ad], a
callba LoadStageCollisionAttributes
- call Func_159f4
+ call LoadFieldStructureGraphics_RedField
ld a, $1
ld [wd580], a
- call Func_1404a
+ call LoadTimerGraphics
ret
-Func_159f4: ; 0x159f4
+LoadFieldStructureGraphics_RedField: ; 0x159f4
+; Based on the current stage collision state, load the proper graphics.
+; Things that change on the Red field are Ditto, the lightning bolt guard rail, and the roof over the 3 Voltorbs.
ld a, [hLCDC]
bit 7, a
jr z, .asm_15a13
@@ -1512,810 +1517,7 @@ Func_159f4: ; 0x159f4
ld [wd7f2], a
ret
-TileDataPointers_15a3f:
- dw $0000
- dw TileData_15b71
- dw TileData_15b16
- dw TileData_15abf
- dw TileData_15b23
- dw TileData_15adc
- dw TileData_15b2a
- dw TileData_15af3
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15b16
- dw $0000
- dw TileData_15b23
- dw $0000
- dw TileData_15b2a
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15b71
- dw TileData_15b3d
- dw $0000
- dw TileData_15b50
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15b82
- dw $0000
- dw $0000
- dw TileData_15b3d
- dw $0000
- dw TileData_15b50
- dw $0000
- dw $0000
- dw TileData_15b57
- dw $0000
- dw $0000
- dw TileData_15b71
- dw TileData_15b2a
- dw $0000
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15b57
- dw TileData_15b82
- dw $0000
- dw $0000
- dw TileData_15b2a
- dw $0000
- dw $0000
- dw TileData_15b6a
- dw $0000
- dw TileData_15b3d
- dw $0000
- dw $0000
- dw TileData_15b71
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15b6a
- dw $0000
- dw TileData_15b3d
- dw TileData_15b82
- dw $0000
-
-TileData_15abf: ; 0x15abf
- db $e
- dw TileData_15b93
- dw TileData_15b9d
- dw TileData_15ba7
- dw TileData_15bb1
- dw TileData_15bbb
- dw TileData_15bc5
- dw TileData_15c0b
- dw TileData_15c15
- dw TileData_15c1f
- dw TileData_15c29
- dw TileData_15c33
- dw TileData_15c3d
- dw TileData_15c47
- dw TileData_15c51
-
-TileData_15adc: ; 0x15adc
- db $0b
- dw TileData_15c0b
- dw TileData_15c15
- dw TileData_15c1f
- dw TileData_15c29
- dw TileData_15c33
- dw TileData_15c3d
- dw TileData_15c47
- dw TileData_15c51
- dw TileData_15ce7
- dw TileData_15cf1
- dw TileData_15cfb
-
-TileData_15af3: ; 0x15af3
- db $11
- dw TileData_15b93
- dw TileData_15b9d
- dw TileData_15ba7
- dw TileData_15bb1
- dw TileData_15bbb
- dw TileData_15bc5
- dw TileData_15c0b
- dw TileData_15c15
- dw TileData_15c1f
- dw TileData_15c29
- dw TileData_15c33
- dw TileData_15c3d
- dw TileData_15c47
- dw TileData_15c51
- dw TileData_15cab
- dw TileData_15cb5
- dw TileData_15cbf
-
-TileData_15b16: ; 0x15b16
- db $06
- dw TileData_15b93
- dw TileData_15b9d
- dw TileData_15ba7
- dw TileData_15bb1
- dw TileData_15bbb
- dw TileData_15bc5
-
-TileData_15b23: ; 0x15b23
- db $03
- dw TileData_15ce7
- dw TileData_15cf1
- dw TileData_15cfb
-
-TileData_15b2a: ; 0x15b2a
- db $09
- dw TileData_15b93
- dw TileData_15b9d
- dw TileData_15ba7
- dw TileData_15bb1
- dw TileData_15bbb
- dw TileData_15bc5
- dw TileData_15cab
- dw TileData_15cb5
- dw TileData_15cbf
-
-TileData_15b3d: ; 0x15b3d
- db $09
- dw TileData_15bcf
- dw TileData_15bd9
- dw TileData_15be3
- dw TileData_15bed
- dw TileData_15bf7
- dw TileData_15c01
- dw TileData_15ce7
- dw TileData_15cf1
- dw TileData_15cfb
-
-TileData_15b50: ; 0x15b50
- db $03
- dw TileData_15cab
- dw TileData_15cb5
- dw TileData_15cbf
-
-TileData_15b57: ; 0x15b57
- db $09
- dw TileData_15b93
- dw TileData_15b9d
- dw TileData_15ba7
- dw TileData_15bb1
- dw TileData_15bbb
- dw TileData_15bc5
- dw TileData_15cc9
- dw TileData_15cd3
- dw TileData_15cdd
-
-TileData_15b6a: ; 0x15b6a
- db $03
- dw TileData_15cc9
- dw TileData_15cd3
- dw TileData_15cdd
-
-TileData_15b71: ; 0x15b71
- db $08
- dw TileData_15c0b
- dw TileData_15c15
- dw TileData_15c1f
- dw TileData_15c29
- dw TileData_15c33
- dw TileData_15c3d
- dw TileData_15c47
- dw TileData_15c51
-
-TileData_15b82: ; 0x15b82
- db $08
- dw TileData_15c5b
- dw TileData_15c65
- dw TileData_15c6f
- dw TileData_15c79
- dw TileData_15c83
- dw TileData_15c8d
- dw TileData_15c97
- dw TileData_15ca1
-
-TileData_15b93: ; 0x15b93
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $44
- dw StageRedFieldBottomIndicatorsGfx_Gameboy
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15b9d: ; 0x15b9d
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $47
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $30
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15ba7: ; 0x15ba7
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $4A
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $60
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15bb1: ; 0x15bb1
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $4D
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $90
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15bbb: ; 0x15bbb
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $50
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $C0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15bc5: ; 0x15bc5
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $53
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15bcf: ; 0x15bcf
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $44
- dw StageRedFieldTopBaseGameBoyGfx + $9a0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15bd9: ; 0x15bd9
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $47
- dw StageRedFieldTopBaseGameBoyGfx + $9d0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15be3: ; 0x15be3
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $4A
- dw StageRedFieldTopBaseGameBoyGfx + $a00
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15bed: ; 0x15bed
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $4D
- dw StageRedFieldTopBaseGameBoyGfx + $a30
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15bf7: ; 0x15bf7
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $50
- dw StageRedFieldTopBaseGameBoyGfx + $a60
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c01: ; 0x15c01
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $53
- dw StageRedFieldTopBaseGameBoyGfx + $a90
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c0b: ; 0x15c0b
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $56
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $120
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c15: ; 0x15c15
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $59
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $150
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c1f: ; 0x15c1f
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $5C
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $180
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c29: ; 0x15c29
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $5F
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1B0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c33: ; 0x15c33
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $62
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1E0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c3d: ; 0x15c3d
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $65
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $210
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c47: ; 0x15c47
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $66
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $620
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c51: ; 0x15c51
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $69
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $650
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15c5b: ; 0x15c5b
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $56
- dw StageRedFieldTopBaseGameBoyGfx + $ac0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c65: ; 0x15c65
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $59
- dw StageRedFieldTopBaseGameBoyGfx + $af0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c6f: ; 0x15c6f
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $5C
- dw StageRedFieldTopBaseGameBoyGfx + $b20
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c79: ; 0x15c79
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $5F
- dw StageRedFieldTopBaseGameBoyGfx + $b50
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c83: ; 0x15c83
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $62
- dw StageRedFieldTopBaseGameBoyGfx + $b80
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c8d: ; 0x15c8d
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $65
- dw StageRedFieldTopBaseGameBoyGfx + $bb0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15c97: ; 0x15c97
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $66
- dw StageRedFieldTopBaseGameBoyGfx + $bc0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15ca1: ; 0x15ca1
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $69
- dw StageRedFieldTopBaseGameBoyGfx + $bf0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15cab: ; 0x15cab
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $6C
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2B0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15cb5: ; 0x15cb5
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $6F
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $2E0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15cbf: ; 0x15cbf
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $72
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $310
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15cc9: ; 0x15cc9
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $6C
- dw StageRedFieldTopBaseGameBoyGfx + $c20
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15cd3: ; 0x15cd3
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $6F
- dw StageRedFieldTopBaseGameBoyGfx + $c50
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15cdd: ; 0x15cdd
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $72
- dw StageRedFieldTopBaseGameBoyGfx + $c80
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_15ce7: ; 0x15ce7
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $6C
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $220
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15cf1: ; 0x15cf1
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $6F
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $250
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_15cfb: ; 0x15cfb
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $72
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $280
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileDataPointers_15d05:
- dw $0000
- dw TileData_15db1
- dw TileData_15d96
- dw TileData_15d85
- dw TileData_15d99
- dw TileData_15d8a
- dw TileData_15d9c
- dw TileData_15d8f
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15d96
- dw $0000
- dw TileData_15d99
- dw $0000
- dw TileData_15d9c
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15db1
- dw TileData_15da1
- dw $0000
- dw TileData_15da6
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15db4
- dw $0000
- dw $0000
- dw TileData_15da1
- dw $0000
- dw TileData_15da6
- dw $0000
- dw $0000
- dw TileData_15da9
- dw $0000
- dw $0000
- dw TileData_15db1
- dw TileData_15d9c
- dw $0000
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15da9
- dw TileData_15db4
- dw $0000
- dw $0000
- dw TileData_15d9c
- dw $0000
- dw $0000
- dw TileData_15dae
- dw $0000
- dw TileData_15da1
- dw $0000
- dw $0000
- dw TileData_15db1
- dw $0000
- dw $0000
- dw $0000
- dw TileData_15dae
- dw $0000
- dw TileData_15da1
- dw TileData_15db4
- dw $0000
-
-TileData_15d85: ; 0x15d85
- db $02
- dw TileData_15db7
- dw TileData_15df2
-
-TileData_15d8a: ; 0x15d8a
- db $02
- dw TileData_15df2
- dw TileData_15e82
-
-TileData_15d8f: ; 0x15d8f
- db $03
- dw TileData_15db7
- dw TileData_15df2
- dw TileData_15e50
-
-TileData_15d96: ; 0x15d96
- db $01
- dw TileData_15db7
-
-TileData_15d99: ; 0x15d99
- db $01
- dw TileData_15e82
-
-TileData_15d9c: ; 0x15d9c
- db $02
- dw TileData_15db7
- dw TileData_15e50
-
-TileData_15da1: ; 0x15da1
- db $02
- dw TileData_15dd5
- dw TileData_15e82
-
-TileData_15da6: ; 0x15da6
- db $01
- dw TileData_15e50
-
-TileData_15da9: ; 0x15da9
- db $02
- dw TileData_15db7
- dw TileData_15e69
-
-TileData_15dae: ; 0x15dae
- db $01
- dw TileData_15e69
-
-TileData_15db1: ; 0x15dab1
- db $01
- dw TileData_15df2
-
-TileData_15db4: ; 0x15db4
- db $01
- dw TileData_15e21
-
-TileData_15db7: ; 0x15db7
- dw Func_1198
-
- db ($a << 1)
- db $03
- dw vBGMap + $4c
-
- db ($40 << 1)
- db $09
- dw vBGMap + $6c
-
- db (($32 << 1) | 1)
- db $08
- dw vBGMap + $8d
-
- db (4 << 1)
- dw vBGMap + $ae
-
- db (2 << 1)
- dw vBGMap + $d0
-
- db (2 << 1)
- dw vBGMap + $f1
-
- db (2 << 1)
- dw vBGMap + $111
-
- db (1 << 1)
- dw vBGMap + $132
-
- db $00 ; terminator
-
-TileData_15dd5: ; 0x15dd5
- dw Func_1198
-
- db ($a << 1)
- db $03
- dw vBGMap + $4c
-
- db (($28 << 1) | 1)
- db $08
- dw vBGMap + $6c
-
- db ($4 << 1)
- dw vBGMap + $8d
-
- db ($04 << 1)
- dw vBGMap + $ae
-
- db ($02 << 1)
- dw vBGMap + $d0
-
- db ($02 << 1)
- dw vBGMap + $f1
-
- db ($02 << 1)
- dw vBGMap + $111
-
- db (1 << 1)
- dw vBGMap + $132
-
- db $00 ; terminator
-
-TileData_15df2: ; 0x15df2
- dw LoadTileLists
- db $19 ; total number of tiles
-
- db $05 ; number of tiles
- dw vBGMap + $a9
- db $1e, $1f, $20, $21, $22
-
- db $07
- dw vBGMap + $c7
- db $23, $24, $39, $3a, $25, $3b, $26
-
- db $08 ; number of tiles
- dw vBGMap + $e6
- db $27, $37, $28, $29, $2a, $2b, $3c, $2c
-
- db $03 ; number of tiles
- dw vBGMap + $106
- db $2d, $38, $2e
-
- db $01 ; number of tiles
- dw vBGMap + $10d
- db $2f
-
- db $01 ; number of tiles
- dw vBGMap + $126
- db $30
-
- db 00 ; terminator
-
-TileData_15e21: ; 0x15e21
- dw LoadTileLists
- db $19 ; total number of tiles
-
- db $05 ; number of tiles
- dw vBGMap + $a9
- db $0b, $0c, $0d, $0e, $0f
-
- db $07
- dw vBGMap + $c7
- db $10, $11, $33, $34, $12, $35, $13
-
- db $08 ; number of tiles
- dw vBGMap + $e6
- db $14, $31, $15, $16, $17, $18, $36, $19
-
- db $03 ; number of tiles
- dw vBGMap + $106
- db $1a, $32, $1b
-
- db $01 ; number of tiles
- dw vBGMap + $10d
- db $1c
-
- db $01 ; number of tiles
- dw vBGMap + $126
- db $1d
-
- db 00 ; terminator
-
-TileData_15e50: ; 0x15e50
- dw LoadTileLists
- db $09 ; total number of tiles
-
- db $03 ; number of tiles
- dw vBGMap + $100
- db $45, $46, $22
-
- db $02 ; number of tiles
- dw vBGMap + $120
- db $45, $46
-
- db $02 ; number of tiles
- dw vBGMap + $140
- db $45, $46
-
- db $02 ; number of tiles
- dw vBGMap + $160
- db $45, $46
-
- db $00 ; terminator
-
-TileData_15e69: ; 0x15e69
- dw LoadTileLists
- db $09 ; total number of tiles
-
- db $03 ; number of tiles
- dw vBGMap + $100
- db $43, $44, $22
-
- db $02 ; number of tiles
- dw vBGMap + $120
- db $45, $46
-
- db $02 ; number of tiles
- dw vBGMap + $140
- db $45, $46
-
- db $02 ; number of tiles
- dw vBGMap + $160
- db $45, $46
-
- db $00 ; terminator
-
-TileData_15e82: ; 0x15e82
- dw Func_1198
-
- db ((4 << 1) | 1)
- db $07
- dw vBGMap + $100
-
- db (($23 << 1) | 1)
- db $04
- dw vBGMap + $120
-
- db (2 << 1)
- dw vBGMap + $140
-
- db (2 << 1)
- dw vBGMap + $160
-
- db $00 ; terminator
+INCLUDE "data/queued_tiledata/red_field/structures.asm"
ResolveBellsproutCollision: ; 0x15e93
ld a, [wBellsproutCollision]
@@ -2425,40 +1627,43 @@ BellsproutAnimationData: ; 0x15f69
db $28, $01
db $00 ; terminator
-ResolveRedStageBumperCollision: ; 0x15f86
+ResolveBumpersCollision_RedField: ; 0x15f86
ld a, [wWhichBumper]
and a
- jr z, .asm_15f99
- call LoadBumperCollisionGraphics_RedField
- call Func_15fa6
+ jr z, .noNewCollision
+ call LoadBumpersGraphics_RedField
+ call LightUpBumper_RedField
xor a
ld [wWhichBumper], a
call ApplyBumperCollision_RedField
-.asm_15f99
- ld a, [wd4da]
+.noNewCollision
+ ld a, [wBumperLightUpDuration]
and a
ret z
dec a
- ld [wd4da], a
- call z, LoadBumperCollisionGraphics_RedField
+ ld [wBumperLightUpDuration], a
+ call z, LoadBumpersGraphics_RedField
ret
-Func_15fa6: ; 0x15fa6
+LightUpBumper_RedField: ; 0x15fa6
+; Makes the hit bumper light up briefly
ld a, $10
- ld [wd4da], a
+ ld [wBumperLightUpDuration], a
ld a, [wWhichBumperId]
sub $6
ld [wd4db], a
sla a
inc a
- jr asm_15fc0
+ jr LoadBumperGraphics_RedField
-LoadBumperCollisionGraphics_RedField: ; 0x5fb8
+LoadBumpersGraphics_RedField: ; 0x15fb8
ld a, [wd4db]
cp $ff
ret z
sla a
-asm_15fc0
+ ; fall through
+
+LoadBumperGraphics_RedField: ; 0x15fc0
sla a
ld c, a
ld b, $0
@@ -2478,9 +1683,9 @@ asm_15fc0
ApplyBumperCollision_RedField: ; 0x15fda
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $3
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, $0200
ld a, l
ld [wFlipperYForce], a
@@ -2530,17 +1735,17 @@ ResolveDittoSlotCollision: ; 0x160f0
ld a, $23
ld [wBallYPos + 1], a
ld a, $10
- ld [wd600], a
+ ld [wDittoEnterOrExitCounter], a
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
.asm_16137
- ld a, [wd600]
+ ld a, [wDittoEnterOrExitCounter]
and a
ret z
dec a
- ld [wd600], a
+ ld [wDittoEnterOrExitCounter], a
cp $f
jr nz, .asm_1614f
callba LoadMiniBallGfx
@@ -2549,7 +1754,7 @@ ResolveDittoSlotCollision: ; 0x160f0
.asm_1614f
cp $c
jr nz, .asm_1615e
- callba Func_dd62
+ callba LoadSuperMiniPinballGfx
ret
.asm_1615e
@@ -2569,9 +1774,9 @@ ResolveDittoSlotCollision: ; 0x160f0
ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
ret
.asm_1618e
@@ -2588,8 +1793,9 @@ ResolveDittoSlotCollision: ; 0x160f0
ld [wBallYVelocity + 1], a
ret
-Func_161af: ; 0x161af
- ld a, [wd604]
+ApplySlotForceField_RedFieldBottom: ; 0x161af
+; Applies the force field to the pinball when near the slot cave opening.
+ ld a, [wSlotIsOpen]
and a
ret z
ld a, [wBallYPos + 1]
@@ -2616,10 +1822,13 @@ Func_161af: ; 0x161af
sla c
sla c
add hl, bc
- jr asm_1620f
+ jr _ApplySlotForceField_RedField
-Func_161e0: ; 0x161e0
- ld a, [wd604]
+ApplySlotForceField_RedFieldTop: ; 0x161e0
+; Applies the force field to the pinball when near the slot cave opening.
+; Even though the Slot cave is on the bottom half of the board, the force field
+; still affects the pinball when it's really close to the bottom of the top-half of the board.
+ ld a, [wSlotIsOpen]
and a
ret z
ld a, [wBallYPos + 1]
@@ -2646,7 +1855,10 @@ Func_161e0: ; 0x161e0
sla c
sla c
add hl, bc
-asm_1620f: ; 0x1620f
+ ; fall through
+
+_ApplySlotForceField_RedField: ; 0x1620f
+; Applies the force field to the pinball when near the slot cave opening.
ld bc, BallPhysicsData_f0000
add hl, bc
ld de, wBallXVelocity
@@ -2710,29 +1922,29 @@ asm_1620f: ; 0x1620f
ld a, h
cp $2
ret c
- ld a, [wd804]
+ ld a, [wRumbleDuration]
and a
ret nz
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
lb de, $00, $04
call PlaySoundEffect
ret
-Func_16279: ; 0x16279
+ResolveSlotCollision_RedField: ; 0x16279
ld a, [wSlotCollision]
and a
- jr z, .asm_162ae
+ jr z, .noCollision
xor a
ld [wSlotCollision], a
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
and a
ret z
- ld a, [wd603]
+ ld a, [wSlotEnterOrExitCounter]
and a
- jr nz, .asm_162ae
+ jr nz, .noCollision
xor a
ld hl, wBallXVelocity
ld [hli], a
@@ -2747,16 +1959,16 @@ Func_16279: ; 0x16279
ld a, $16
ld [wBallYPos + 1], a
ld a, $13
- ld [wd603], a
-.asm_162ae
- ld a, [wd603]
+ ld [wSlotEnterOrExitCounter], a
+.noCollision
+ ld a, [wSlotEnterOrExitCounter]
and a
ret z
dec a
- ld [wd603], a
+ ld [wSlotEnterOrExitCounter], a
ld a, $18
- ld [wd606], a
- ld a, [wd603]
+ ld [wSlotGlowingAnimationCounter], a
+ ld a, [wSlotEnterOrExitCounter]
cp $12
jr nz, .asm_162d4
lb de, $00, $21
@@ -2767,7 +1979,7 @@ Func_16279: ; 0x16279
.asm_162d4
cp $f
jr nz, .asm_162e3
- callba Func_dd62
+ callba LoadSuperMiniPinballGfx
ret
.asm_162e3
@@ -2782,18 +1994,18 @@ Func_16279: ; 0x16279
.asm_162f2
cp $9
jr nz, .asm_162fa
- call Func_16352
+ call DoSlotLogic_RedField
ret
.asm_162fa
cp $6
jr nz, .asm_16317
xor a
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $5
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
callba LoadMiniBallGfx
ret
@@ -2810,7 +2022,7 @@ Func_16279: ; 0x16279
.asm_16330
and a
ret nz
- call Func_16425
+ call LoadSlotCaveCoverGraphics_RedField
ld a, [wCatchEmOrEvolutionSlotRewardActive]
cp CATCHEM_MODE_SLOT_REWARD
ret nz
@@ -2822,7 +2034,9 @@ Func_16279: ; 0x16279
ld [wCatchEmOrEvolutionSlotRewardActive], a
ret
-Func_16352: ; 0x16352
+DoSlotLogic_RedField: ; 0x16352
+; Performs the slot logic when pinball entered the slot cave.
+; This could be the slot roulette, or evolving a pokemon, for example.
xor a
ld [wIndicatorStates + 4], a
ld a, $d
@@ -2837,7 +2051,7 @@ Func_16352: ; 0x16352
ld a, [wPreviousNumPokeballs]
cp $3
jr nz, .asm_163b3
- ld a, [wd607]
+ ld a, [wFramesUntilSlotCaveOpens]
and a
jr nz, .asm_163b3
.asm_1637a
@@ -2857,22 +2071,22 @@ Func_16352: ; 0x16352
ld a, [wd498]
ld c, a
ld b, $0
- ld hl, GoToBonusStageTextIds_RedField
+ ld hl, BonusStages_RedField
add hl, bc
ld a, [hl]
- ld [wd497], a
- call Func_163f2
+ ld [wNextStage], a
+ call ShowScrollingGoToBonusText_RedField
xor a
- ld [wd609], a
+ ld [wOpenedSlotByGetting3Pokeballs], a
ld [wCatchEmOrEvolutionSlotRewardActive], a
ld a, $1e
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
ret
.asm_163b3
callba Func_ed8e
xor a
- ld [wd608], a
+ ld [wOpenedSlotByGetting4CAVELights], a
ld a, [wd61d]
cp $d
jr nc, .asm_1637a
@@ -2893,11 +2107,11 @@ Func_16352: ; 0x16352
ld [wCatchEmOrEvolutionSlotRewardActive], a
ret
-Func_163f2: ; 0x163f2
+ShowScrollingGoToBonusText_RedField: ; 0x163f2
call FillBottomMessageBufferWithBlackTile
call Func_30db
ld hl, wScrollingText3
- ld a, [wd497]
+ ld a, [wNextStage]
ld de, GoToDiglettStageText
cp STAGE_DIGLETT_BONUS
jr z, .asm_1640f
@@ -2914,19 +2128,21 @@ Func_163f2: ; 0x163f2
call PlaySoundEffect
ret
-GoToBonusStageTextIds_RedField:
+BonusStages_RedField:
db STAGE_GENGAR_BONUS
db STAGE_MEWTWO_BONUS
db STAGE_MEOWTH_BONUS
db STAGE_DIGLETT_BONUS
db STAGE_SEEL_BONUS
-Func_16425: ; 0x16425
+LoadSlotCaveCoverGraphics_RedField: ; 0x16425
+; Loads the graphics for the circular slot cave area.
+; It looks like a cover that opens and closes.
ld a, [wCurrentStage]
and $1
sla a
ld c, a
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
add c
sla a
ld c, a
@@ -2947,160 +2163,19 @@ Func_16425: ; 0x16425
call Func_10aa
ret
-TileDataPointers_1644d:
- dw TileData_16455
- dw TileData_16458
- dw TileData_1645b
- dw TileData_16460
-
-TileData_16455: ; 0x16455
- db $01
- dw TileData_16465
-
-TileData_16458: ; 0x16458
- db $01
- dw TileData_1646f
-
-TileData_1645b: ; 0x1645b
- db $02
- dw TileData_16479
- dw TileData_16483
-
-TileData_16460: ; 0x16460
- db $02
- dw TileData_1648D
- dw TileData_16497
-
-TileData_16465: ; 0x16465
- dw Func_11d2
- db $20, $02
- dw vTilesSH tile $46
- dw StageRedFieldTopBaseGameBoyGfx + $1c0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_1646f: ; 0x1646f
- dw Func_11d2
- db $20, $02
- dw vTilesSH tile $46
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $340
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16479: ; 0x16479
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $48
- dw StageRedFieldBottomBaseGameBoyGfx + $c80
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16483: ; 0x16483
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $4A
- dw StageRedFieldBottomBaseGameBoyGfx + $CA0
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_1648D: ; 0x1648D
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $48
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $340
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16497: ; 0x16497
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $4A
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $360
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileDataPointers_164a1:
- dw TileData_164a9
- dw TileData_164ac
- dw TileData_164af
- dw TileData_164b2
-
-TileData_164a9: ; 0x164a9
- db $01
- dw TileData_164b5
-
-TileData_164ac: ; 0x164ac
- db $01
- dw TileData_164be
-
-TileData_164af: ; 0x164af
- db $01
- dw TileData_164c7
-
-TileData_164b2: ; 0x164b2
- db $01
- dw TileData_164d5
-
-TileData_164b5: ; 0x164b5
- dw LoadTileLists
- db $02
-
- db $02
- dw vBGMap + $229
- db $d4, $d5
-
- db $00
-
-TileData_164be: ; 0x164be
- dw LoadTileLists
- db $02
-
- db $02
-
- dw vBGMap + $229
- db $d6, $d7
-
- db $00
-
-TileData_164c7: ; 0x164c7
- dw LoadTileLists
- db $04
-
- db $02
- dw vBGMap + $9
- db $38, $39
-
- db $02
- dw vBGMap + $29
- db $3a, $3b
-
- db $00
-
-TileData_164d5: ; 0x164d5
- dw LoadTileLists
- db $04
+INCLUDE "data/queued_tiledata/red_field/slot_cave.asm"
- db $02
- dw vBGMap + $9
- db $3c, $3d
-
- db $02
- dw vBGMap + $29
- db $3e, $3f
-
- db $00
-
-Func_164e3: ; 0x164e3
- ld a, [wd607]
+OpenSlotCave_RedField: ; 0x164e3
+ ld a, [wFramesUntilSlotCaveOpens]
and a
ret z
dec a
- ld [wd607], a
+ ld [wFramesUntilSlotCaveOpens], a
ret nz
ld a, [wInSpecialMode]
and a
ret nz
- ld a, [wd609]
+ ld a, [wOpenedSlotByGetting3Pokeballs]
and a
jr z, .asm_164ff
ld a, [wd498]
@@ -3108,7 +2183,7 @@ Func_164e3: ; 0x164e3
jr .asm_16506
.asm_164ff
- ld a, [wd608]
+ ld a, [wOpenedSlotByGetting4CAVELights]
and a
ret z
ld a, $1a
@@ -3116,16 +2191,16 @@ Func_164e3: ; 0x164e3
ld hl, wCurrentStage
bit 0, [hl]
callba nz, LoadBillboardTileData
- ld a, [wd604]
+ ld a, [wSlotIsOpen]
and a
ret nz
ld a, $1
- ld [wd604], a
+ ld [wSlotIsOpen], a
ld a, $80
ld [wIndicatorStates + 4], a
ld a, [wCurrentStage]
bit 0, a
- call nz, Func_16425
+ call nz, LoadSlotCaveCoverGraphics_RedField
ret
ResolveRedStagePinballLaunchCollision: ; 0x1652d
@@ -3249,14 +2324,14 @@ ResolveRedStagePikachuCollision: ; 0x1660c
jr nz, .asm_16634
ld a, [wWhichPikachuId]
sub $1c
- ld hl, wd518
+ ld hl, wWhichPikachuSaverSide
cp [hl]
jr nz, .asm_1667b
ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
jr nz, .asm_16667
.asm_16634
- ld hl, PikachuSaverAnimationDataBlueStage
+ ld hl, PikachuSaverAnimationData_RedField
ld de, wPikachuSaverAnimation
call InitAnimation
ld a, [wPikachuSaverSlotRewardActive]
@@ -3279,7 +2354,7 @@ ResolveRedStagePikachuCollision: ; 0x1660c
jr .asm_1667b
.asm_16667
- ld hl, PikachuSaverAnimation2DataBlueStage
+ ld hl, PikachuSaverAnimation2Data_RedField
ld de, wPikachuSaverAnimation
call InitAnimation
ld a, $2
@@ -3289,8 +2364,8 @@ ResolveRedStagePikachuCollision: ; 0x1660c
.asm_1667b
ld a, [wd51c]
and a
- call z, Func_16766
- call Func_1669e
+ call z, SetPikachuSaverSide_RedField
+ call UpdatePikachuSaverAnimation_RedField
ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
ret nz
@@ -3305,11 +2380,11 @@ ResolveRedStagePikachuCollision: ; 0x1660c
call PlaySoundEffect
ret
-Func_1669e: ; 0x1669e
+UpdatePikachuSaverAnimation_RedField: ; 0x1669e
ld a, [wd51c]
cp $1
jr nz, .asm_16719
- ld hl, PikachuSaverAnimationDataBlueStage
+ ld hl, PikachuSaverAnimationData_RedField
ld de, wPikachuSaverAnimation
call UpdateAnimation
ret nc
@@ -3325,9 +2400,9 @@ Func_1669e: ; 0x1669e
ld a, $1
ld [wd85d], a
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $60
- ld [wd804], a
+ ld [wRumbleDuration], a
ld hl, wNumPikachuSaves
call Increment_Max100
jr nc, .asm_166f0
@@ -3356,7 +2431,7 @@ Func_1669e: ; 0x1669e
.asm_16719
cp $2
jr nz, .asm_16732
- ld hl, PikachuSaverAnimation2DataBlueStage
+ ld hl, PikachuSaverAnimation2Data_RedField
ld de, wPikachuSaverAnimation
call UpdateAnimation
ret nc
@@ -3374,7 +2449,7 @@ Func_1669e: ; 0x1669e
ld [wPikachuSaverAnimationFrame], a
ret
-PikachuSaverAnimationDataBlueStage: ; 0x1673c
+PikachuSaverAnimationData_RedField: ; 0x1673c
; Each entry is [duration][OAM id]
db $0C, $02
db $05, $03
@@ -3396,29 +2471,30 @@ PikachuSaverAnimationDataBlueStage: ; 0x1673c
db $01, $00
db $00
-PikachuSaverAnimation2DataBlueStage: ; 0x16761
+PikachuSaverAnimation2Data_RedField: ; 0x16761
; Each entry is [duration][OAM id]
db $0C, $02
db $01, $00
db $00
-Func_16766: ; 0x16766
+SetPikachuSaverSide_RedField: ; 0x16766
+; Sets which side Pikachu is on, depending on which flipper was pressed last.
ld hl, wKeyConfigLeftFlipper
call IsKeyPressed2
- jr z, .asm_16774
- ld hl, wd518
+ jr z, .checkRightFlipperKeyPress
+ ld hl, wWhichPikachuSaverSide
ld [hl], $0
ret
-.asm_16774
+.checkRightFlipperKeyPress
ld hl, wKeyConfigRightFlipper
call IsKeyPressed2
ret z
- ld hl, wd518
+ ld hl, wWhichPikachuSaverSide
ld [hl], $1
ret
-ResolveStaryuCollision: ; 0x16781
+ResolveStaryuCollision_Top: ; 0x16781
ld a, [wStaryuCollision]
and a
jr z, .asm_167bd
@@ -3435,7 +2511,7 @@ ResolveStaryuCollision: ; 0x16781
ld [wd502], a
ld a, $14
ld [wd503], a
- call Func_16859
+ call LoadStaryuGraphics_Top
ld a, $6
callba Func_10000
ret
@@ -3451,7 +2527,7 @@ ResolveStaryuCollision: ; 0x16781
ld a, [wd502]
res 1, a
ld [wd502], a
- call Func_16859
+ call LoadStaryuGraphics_Top
ld a, [wd502]
and $1
ld c, a
@@ -3460,7 +2536,7 @@ ResolveStaryuCollision: ; 0x16781
or c
ld [wStageCollisionState], a
callba LoadStageCollisionAttributes
- call Func_159f4
+ call LoadFieldStructureGraphics_RedField
lb de, $00, $07
call PlaySoundEffect
ld a, [wStageCollisionState]
@@ -3468,10 +2544,10 @@ ResolveStaryuCollision: ; 0x16781
jp nz, LoadPinballUpgradeTriggersGraphics_RedField
jp LoadDisabledPinballUpgradeTriggerGraphics_RedField
-Func_167ff: ; 0x167ff
+ResolveStaryuCollision_Bottom: ; 0x167ff
ld a, [wStaryuCollision]
and a
- jr z, .asm_16839
+ jr z, .noCollision
xor a
ld [wStaryuCollision], a
ld a, [wd503]
@@ -3484,12 +2560,12 @@ Func_167ff: ; 0x167ff
ld [wd502], a
ld a, $14
ld [wd503], a
- call Func_16878
+ call LoadStaryuGraphics_Bottom
ld a, $6
callba Func_10000
ret
-.asm_16839
+.noCollision
ld a, [wd503]
and a
ret z
@@ -3508,7 +2584,7 @@ Func_167ff: ; 0x167ff
call PlaySoundEffect
ret
-Func_16859: ; 0x16859
+LoadStaryuGraphics_Top: ; 0x16859
ld a, [wd502]
sla a
ld c, a
@@ -3529,7 +2605,7 @@ Func_16859: ; 0x16859
call Func_10aa
ret
-Func_16878: ; 0x16878
+LoadStaryuGraphics_Bottom: ; 0x16878
ld a, [wd502]
and $1
sla a
@@ -3551,260 +2627,15 @@ Func_16878: ; 0x16878
call Func_10aa
ret
-TileDataPointers_16899:
- dw TileData_168a1
- dw TileData_168a8
- dw TileData_168af
- dw TileData_168af
-
-TileData_168a1: ; 0x168a1
- db $03
- dw TileData_168b6
- dw TileData_168c0
- dw TileData_168ca
-
-TileData_168a8: ; 0x168a8
- db $03
- dw TileData_168d4
- dw TileData_168de
- dw TileData_168e8
-
-TileData_168af: ; 0x168af
- db $03
- dw TileData_168f2
- dw TileData_168fc
- dw TileData_16906
-
-TileData_168b6: ; 0x168b6
- dw Func_11d2
- db $30, $03
- dw vTilesSH tile $50
- dw StageRedFieldTopBaseGameBoyGfx + $260
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_168c0: ; 0x168c0
- dw Func_11d2
- db $30, $03
- dw vTilesSH tile $53
- dw StageRedFieldTopBaseGameBoyGfx + $290
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_168ca: ; 0x168ca
- dw Func_11d2
- db $10, $01
- dw vTilesSH tile $56
- dw StageRedFieldTopBaseGameBoyGfx + $2c0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_168d4: ; 0x168d4
- dw Func_11d2
- db $30, $03
- dw vTilesSH tile $52
- dw StageRedFieldTopBaseGameBoyGfx + $280
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_168de: ; 0x168de
- dw Func_11d2
- db $20, $02
- dw vTilesSH tile $55
- dw StageRedFieldTopBaseGameBoyGfx + $2b0
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileData_168e8: ; 0x168e8
- dw Func_11d2
- db $20, $02
- dw vTilesSH tile $50
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $EA0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_168f2: ; 0x168f2
- dw Func_11d2
- db $30, $03
- dw vTilesSH tile $51
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $10E0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_168fc: ; 0x168fc
- dw Func_11d2
- db $30, $03
- dw vTilesSH tile $54
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1110
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16906: ; 0x16906
- dw Func_11d2
- db $10, $01
- dw vTilesSH tile $50
- dw StageRedFieldTopBaseGameBoyGfx + $260
- db Bank(StageRedFieldTopBaseGameBoyGfx)
- db $00
-
-TileDataPointers_16910:
- dw TileData_16918
- dw TileData_1691b
- dw TileData_1691e
- dw TileData_1691e
-
-TileData_16918: ;0x16918
- db $01
- dw TileData_16921
-
-TileData_1691b: ;0x1691b
- db $01
- dw TileData_16934
-
-TileData_1691e: ;0x1691e
- db $01
- dw TileData_16947
-
-TileData_16921: ; 0x16921
- dw LoadTileLists
- db $06
-
- db $03
- dw vBGMap + $1C6
- db $C3, $C4, $C5
-
- db $02
- dw vBGMap + $1E7
- db $C6, $C7
-
- db $01
- dw vBGMap + $207
- db $C8
-
- db $00
-
-TileData_16934: ; 0x16934
- dw LoadTileLists
- db $06
-
- db $03
- dw vBGMap + $1C6
- db $CD, $CE, $C5
-
- db $02
- dw vBGMap + $1E7
- db $C6, $C7
-
- db $01
- dw vBGMap + $207
- db $C8
-
- db $00
-
-TileData_16947: ; 0x16947
- dw LoadTileLists
- db $06
+INCLUDE "data/queued_tiledata/red_field/staryu_bumper.asm"
- db $03
- dw vBGMap + $1C6
- db $C3, $C4, $C9
-
- db $02
- dw vBGMap + $1E7
- db $CA, $CB
-
- db $01
- dw vBGMap + $207
- db $CC
-
- db $00
-
-TileDataPointers_1695a:
- dw TileData_1695e
- dw TileData_16961
-
-TileData_1695e: ; 0x1695e
- db $01
- dw TileData_16964
-
-TileData_16961: ; 0x16961
- db $01
- dw TileData_16972
-
-TileData_16964: ; 0x16964
- dw LoadTileLists
- db $04
-
- db $02
- dw vBGMap + $40
- db $BE, $BF
-
- db $02
- dw vBGMap + $60
- db $C0, $C1
-
- db $00
-
-TileData_16972: ; 0x16972
- dw LoadTileLists
- db $04
-
- db $02
- dw vBGMap + $40
- db $C2, $C3
-
- db $02
- dw vBGMap + $60
- db $C4, $C5
-
- db $00
-
-TileDataPointers_16980:
- dw TileData_16984
- dw TileData_16987
-
-TileData_16984: ; 0x16984
- db $01
- dw TileData_1698a
-
-TileData_16987: ; 0x16987
- db $01
- dw TileData_16998
-
-TileData_1698a: ; 0x1698a
- dw LoadTileLists
- db $04
-
- db $02
- dw vBGMap + $40
- db $BC, $BD
-
- db $02
- dw vBGMap + $60
- db $BE, $BF
-
- db $00
-
-TileData_16998: ; 0x16998
- dw LoadTileLists
- db $04
-
- db $02
- dw vBGMap + $40
- db $C0, $C1
-
- db $02
- dw vBGMap + $60
- db $C2, $C3
-
- db $00
-
-Func_169a6: ; 0x169a6
+UpdateArrowIndicators_RedField: ; 0x169a6
+; Updates the 5 blinking arrow indicators in the red field bottom.
ld a, [hNumFramesDropped]
and $1f
ret nz
ld bc, $0000
-.asm_169ae
+.loop
push bc
ld hl, wIndicatorStates
add hl, bc
@@ -3817,16 +2648,16 @@ Func_169a6: ; 0x169a6
jr z, .asm_169c2
inc a
.asm_169c2
- call Func_169cd
+ call LoadArrowIndicatorGraphics_RedField
.asm_169c5
pop bc
inc c
ld a, c
cp $5
- jr nz, .asm_169ae
+ jr nz, .loop
ret
-Func_169cd: ; 0x169cd
+LoadArrowIndicatorGraphics_RedField: ; 0x169cd
push af
sla c
ld hl, TileDataPointers_169ed
@@ -3850,869 +2681,7 @@ Func_169cd: ; 0x169cd
call Func_10aa
ret
-TileDataPointers_169ed:
- dw TileDataPointers_169f7
- dw TileDataPointers_16a01
- dw TileDataPointers_16a0b
- dw TileDataPointers_16a0f
- dw TileDataPointers_16a13
-
-TileDataPointers_169f7: ; 0x169f7
- dw TileData_16a17
- dw TileData_16a1e
- dw TileData_16a25
- dw TileData_16a2c
- dw TileData_16a33
-
-TileDataPointers_16a01: ; 0x16a01
- dw TileData_16a3a
- dw TileData_16a41
- dw TileData_16a48
- dw TileData_16a4f
- dw TileData_16a56
-
-TileDataPointers_16a0b: ; 0x16a0b
- dw TileData_16a5d
- dw TileData_16a60
-
-TileDataPointers_16a0f: ; 0x16a0f
- dw TileData_16a63
- dw TileData_16a66
-
-TileDataPointers_16a13: ; 0x16a13
- dw TileData_16a69
- dw TileData_16a6e
-
-TileData_16a17: ; 0x16a17
- db $03
- dw TileData_16a73
- dw TileData_16a7d
- dw TileData_16a87
-
-TileData_16a1e: ; 0x16a1e
- db $03
- dw TileData_16a91
- dw TileData_16a9b
- dw TileData_16aa5
-
-TileData_16a25: ; 0x16a25
- db $03
- dw TileData_16aaf
- dw TileData_16ab9
- dw TileData_16ac3
-
-TileData_16a2c: ; 0x16a2c
- db $03
- dw TileData_16acd
- dw TileData_16ad7
- dw TileData_16ae1
-
-TileData_16a33: ; 0x16a33
- db $03
- dw TileData_16aeb
- dw TileData_16af5
- dw TileData_16aff
-
-TileData_16a3a: ; 0x16a3a
- db $03
- dw TileData_16b09
- dw TileData_16b13
- dw TileData_16b1d
-
-TileData_16a41: ; 0x16a41
- db $03
- dw TileData_16b27
- dw TileData_16b31
- dw TileData_16b3b
-
-TileData_16a48: ; 0x16a48
- db $03
- dw TileData_16b45
- dw TileData_16b4f
- dw TileData_16b59
-
-TileData_16a4f: ; 0x16a4f
- db $03
- dw TileData_16b63
- dw TileData_16b6d
- dw TileData_16b77
-
-TileData_16a56: ; 0x16a56
- db $03
- dw TileData_16b81
- dw TileData_16b8b
- dw TileData_16b95
-
-TileData_16a5d: ; 0x16a5d
- db $01
- dw TileData_16b9f
-
-TileData_16a60: ; 0x16a60
- db $01
- dw TileData_16ba9
-
-TileData_16a63: ; 0x16a63
- db $01
- dw TileData_16bb3
-
-TileData_16a66: ; 0x16a66
- db $01
- dw TileData_16bbd
-
-TileData_16a69: ; 0x16a69
- db $02
- dw TileData_16bc7
- dw TileData_16bd1
-
-TileData_16a6e: ; 0x16a6e
- db $02
- dw TileData_16bdb
- dw TileData_16be5
-
-TileData_16a73: ; 0x16a73
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3A
- dw StageRedFieldBottomBaseGameBoyGfx + $ba0
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16a7d: ; 0x16a7d
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3D
- dw StageRedFieldBottomBaseGameBoyGfx + $bd0
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16a87: ; 0x16a87
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $40
- dw StageRedFieldBottomBaseGameBoyGfx + $c00
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16a91: ; 0x16a91
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3A
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $380
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16a9b: ; 0x16a9b
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3D
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $3B0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16aa5: ; 0x16aa5
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $40
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $3E0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16aaf: ; 0x16aaf
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3A
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $3F0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16ab9: ; 0x16ab9
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3D
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $420
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16ac3: ; 0x16ac3
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $40
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $450
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16acd: ; 0x16acd
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3A
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $460
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16ad7: ; 0x16ad7
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3D
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $490
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16ae1: ; 0x16ae1
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $40
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $4C0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16aeb: ; 0x16aeb
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3A
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F30
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16af5: ; 0x16af5
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $3D
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F60
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16aff: ; 0x16aff
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $40
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $F90
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b09: ; 0x16b09
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $41
- dw StageRedFieldBottomBaseGameBoyGfx + $c10
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16b13: ; 0x16b13
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $44
- dw StageRedFieldBottomBaseGameBoyGfx + $c40
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16b1d: ; 0x16b1d
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $47
- dw StageRedFieldBottomBaseGameBoyGfx + $c70
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16b27: ; 0x16b27
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $41
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $4D0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b31: ; 0x16b31
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $44
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $500
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b3b: ; 0x16b3b
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $47
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $530
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b45: ; 0x16b45
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $41
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $540
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b4f: ; 0x16b4f
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $44
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $570
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b59: ; 0x16b59
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $47
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $5A0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b63: ; 0x16b63
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $41
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $5B0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b6d: ; 0x16b6d
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $44
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $5E0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b77: ; 0x16b77
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $47
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $610
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b81: ; 0x16b81
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $41
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1010
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b8b: ; 0x16b8b
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $44
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1040
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b95: ; 0x16b95
- dw Func_11d2
- db $10, $01
- dw vTilesBG tile $47
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1070
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16b9f: ; 0x16b9f
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $20
- dw StageRedFieldBottomBaseGameBoyGfx + $a00
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16ba9: ; 0x16ba9
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $20
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $1080
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16bb3: ; 0x16bb3
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $23
- dw StageRedFieldBottomBaseGameBoyGfx + $a30
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16bbd: ; 0x16bbd
- dw Func_11d2
- db $30, $03
- dw vTilesBG tile $23
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $10B0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16bc7: ; 0x16bc7
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1C
- dw StageRedFieldBottomBaseGameBoyGfx + $9c0
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16bd1: ; 0x16bd1
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1E
- dw StageRedFieldBottomBaseGameBoyGfx + $9e0
- db Bank(StageRedFieldBottomBaseGameBoyGfx)
- db $00
-
-TileData_16bdb: ; 0x16bdb
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1C
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $6E0
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileData_16be5: ; 0x16be5
- dw Func_11d2
- db $20, $02
- dw vTilesBG tile $1E
- dw StageRedFieldBottomIndicatorsGfx_Gameboy + $700
- db Bank(StageRedFieldBottomIndicatorsGfx_Gameboy)
- db $00
-
-TileDataPointers_16bef:
- dw TileDataPointers_16bf9
- dw TileDataPointers_16c03
- dw TileDataPointers_16c0d
- dw TileDataPointers_16c11
- dw TileDataPointers_16c15
-
-TileDataPointers_16bf9: ; 0x16bf9
- dw TileData_16c19
- dw TileData_16c1c
- dw TileData_16c1f
- dw TileData_16c22
- dw TileData_16c25
-
-TileDataPointers_16c03: ; 0x16c03
- dw TileData_16c28
- dw TileData_16c2b
- dw TileData_16c2e
- dw TileData_16c31
- dw TileData_16c34
-
-TileDataPointers_16c0d: ; 0x16c0d
- dw TileData_16c37
- dw TileData_16c3a
-
-TileDataPointers_16c11: ; 0x16c11
- dw TileData_16c3d
- dw TileData_16c40
-
-TileDataPointers_16c15: ; 0x16c15
- dw TileData_16c43
- dw TileData_16c46
-
-TileData_16c19: ; 0x16c19
- db $01
- dw TileData_16c49
-
-TileData_16c1c: ; 0x16c1c
- db $01
- dw TileData_16c63
-
-TileData_16c1f: ; 0x16c1f
- db $01
- dw TileData_16c7d
-
-TileData_16c22: ; 0x16c22
- db $01
- dw TileData_16c97
-
-TileData_16c25: ; 0x16c25
- db $01
- dw TileData_16cb1
-
-TileData_16c28: ; 0x16c28
- db $01
- dw TileData_16ccb
-
-TileData_16c2b: ; 0x16c2b
- db $01
- dw TileData_16ce5
-
-TileData_16c2e: ; 0x16c2e
- db $01
- dw TileData_16cff
-
-TileData_16c31: ; 0x16c31
- db $01
- dw TileData_16d19
-
-TileData_16c34: ; 0x16c34
- db $01
- dw TileData_16d33
-
-TileData_16c37: ; 0x16c37
- db $01
- dw TileData_16d4d
-
-TileData_16c3a: ; 0x16c3a
- db $01
- dw TileData_16d5a
-
-TileData_16c3d: ; 0x16c3d
- db $01
- dw TileData_16d67
-
-TileData_16c40: ; 0x16c40
- db $01
- dw TileData_16d74
-
-TileData_16c43: ; 0x16c43
- db $01
- dw TileData_16d81
-
-TileData_16c46: ; 0x16c46
- db $01
- dw TileData_16d8f
-
-TileData_16c49: ; 0x16c49
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $23
- db $5E
-
- db $02
- dw vBGMap + $43
- db $5F, $60
-
- db $02
- dw vBGMap + $64
- db $61, $62
-
- db $01
- dw vBGMap + $85
- db $63
-
- db $01
- dw vBGMap + $A5
- db $64
-
- db $00
-
-TileData_16c63: ; 0x16c63
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $23
- db $65
-
- db $02
- dw vBGMap + $43
- db $66, $67
-
- db $02
- dw vBGMap + $64
- db $61, $62
-
- db $01
- dw vBGMap + $85
- db $63
-
- db $01
- dw vBGMap + $A5
- db $64
-
- db $00
-
-TileData_16c7d: ; 0x16c7d
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $23
- db $65
-
- db $02
- dw vBGMap + $43
- db $66, $67
-
- db $02
- dw vBGMap + $64
- db $68, $69
-
- db $01
- dw vBGMap + $85
- db $63
-
- db $01
- dw vBGMap + $A5
- db $64
-
- db $00
-
-TileData_16c97: ; 0x16c97
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $23
- db $65
-
- db $02
- dw vBGMap + $43
- db $66, $67
-
- db $02
- dw vBGMap + $64
- db $68, $69
-
- db $01
- dw vBGMap + $85
- db $6A
-
- db $01
- dw vBGMap + $A5
- db $6B
-
- db $00
-
-TileData_16cb1: ; 0x16cb1
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $23
- db $5E
-
- db $02
- dw vBGMap + $43
- db $5F, $60
-
- db $02
- dw vBGMap + $64
- db $68, $69
-
- db $01
- dw vBGMap + $85
- db $6A
-
- db $01
- dw vBGMap + $A5
- db $6B
-
- db $00
-
-TileData_16ccb: ; 0x16ccb
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $30
- db $6C
-
- db $02
- dw vBGMap + $4F
- db $6D, $6E
-
- db $02
- dw vBGMap + $6E
- db $6F, $70
-
- db $01
- dw vBGMap + $8E
- db $71
-
- db $01
- dw vBGMap + $AE
- db $72
-
- db $00
-
-TileData_16ce5: ; 0x16ce5
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $30
- db $73
-
- db $02
- dw vBGMap + $4F
- db $74, $75
-
- db $02
- dw vBGMap + $6E
- db $6F, $70
-
- db $01
- dw vBGMap + $8E
- db $71
-
- db $01
- dw vBGMap + $AE
- db $72
-
- db $00
-
-TileData_16cff: ; 0x16cff
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $30
- db $73
-
- db $02
- dw vBGMap + $4F
- db $74, $75
-
- db $02
- dw vBGMap + $6E
- db $76, $77
-
- db $01
- dw vBGMap + $8E
- db $71
-
- db $01
- dw vBGMap + $AE
- db $72
-
- db $00
-
-TileData_16d19: ; 0x16d19
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $30
- db $73
-
- db $02
- dw vBGMap + $4F
- db $74, $75
-
- db $02
- dw vBGMap + $6E
- db $76, $77
-
- db $01
- dw vBGMap + $8E
- db $78
-
- db $01
- dw vBGMap + $AE
- db $79
-
- db $00
-
-TileData_16d33: ; 0x16d33
- dw LoadTileLists
- db $07
-
- db $01
- dw vBGMap + $30
- db $6C
-
- db $02
- dw vBGMap + $4F
- db $6D, $6E
-
- db $02
- dw vBGMap + $6E
- db $76, $77
-
- db $01
- dw vBGMap + $8E
- db $78
-
- db $01
- dw vBGMap + $AE
- db $79
-
- db $00
-
-TileData_16d4d: ; 0x16d4d
- dw LoadTileLists
- db $03
-
- db $01
- dw vBGMap + $6
- db $48
-
- db $02
- dw vBGMap + $26
- db $49, $4A
-
- db $00
-
-TileData_16d5a: ; 0x16d5a
- dw LoadTileLists
- db $03
-
- db $01
- dw vBGMap + $6
- db $4B
-
- db $02
- dw vBGMap + $26
- db $4C, $4D
-
- db $00
-
-TileData_16d67: ; 0x16d67
- dw LoadTileLists
- db $03
-
- db $01
- dw vBGMap + $D
- db $4E
-
- db $02
- dw vBGMap + $2C
- db $4F, $50
-
- db $00
-
-TileData_16d74: ; 0x16d74
- dw LoadTileLists
- db $03
-
- db $01
- dw vBGMap + $D
- db $51
-
- db $02
- dw vBGMap + $2C
- db $52, $53
-
- db $00
-
-TileData_16d81: ; 0x16d81
- dw LoadTileLists
- db $04
-
- db $02
- dw vBGMap + $49
- db $40, $41
-
- db $02
- dw vBGMap + $69
- db $42, $43
-
- db $00
-
-TileData_16d8f: ; 0x16d8f
- dw LoadTileLists
- db $04
-
- db $02
- dw vBGMap + $49
- db $44, $45
-
- db $02
- dw vBGMap + $69
- db $46, $47
-
- db $00
+INCLUDE "data/queued_tiledata/red_field/arrow_indicators.asm"
ResolveRedStageBonusMultiplierCollision: ; 016d9d
ld a, [wWhichBonusMultiplierRailing]
@@ -5016,12 +2985,14 @@ Data_16fc1:
INCLUDE "data/queued_tiledata/red_field/bonus_multiplier_railings.asm"
-Func_174d0: ; 0x174d0
- call Func_174ea
+UpdatePokeballs_RedField: ; 0x174d0
+; Update the pokeballs underneath the billboard, which blink for awhile after catch'em mode and evolution mode.
+ call UpdateBlinkingPokeballs_RedField
ret nc
; fall through
-Func_174d4: ; 0x174d4
+LoadPokeballsGraphics_RedField: ; 0x174d4
+; Loads the graphics for the list of pokeballs underneath the billboard picture.
sla a
ld c, a
ld b, $0
@@ -5036,7 +3007,7 @@ Func_174d4: ; 0x174d4
call Func_10c5
ret
-Func_174ea: ; 0x174ea
+UpdateBlinkingPokeballs_RedField: ; 0x174ea
ld a, [wPreviousNumPokeballs]
ld hl, wNumPokeballs
cp [hl]
@@ -5044,21 +3015,21 @@ Func_174ea: ; 0x174ea
ld a, [wPokeballBlinkingCounter]
dec a
ld [wPokeballBlinkingCounter], a
- jr nz, .asm_17514
+ jr nz, .stillBlinking
ld a, [wNumPokeballs]
ld [wPreviousNumPokeballs], a
cp $3
- jr c, .asm_1750f
+ jr c, .dontOpenSlot
ld a, $1
- ld [wd609], a
+ ld [wOpenedSlotByGetting3Pokeballs], a
ld a, $3
- ld [wd607], a
-.asm_1750f
+ ld [wFramesUntilSlotCaveOpens], a
+.dontOpenSlot
ld a, [wPreviousNumPokeballs]
scf
ret
-.asm_17514
+.stillBlinking
and $7
ret nz
ld a, [wPokeballBlinkingCounter]
@@ -5073,40 +3044,4 @@ Func_174ea: ; 0x174ea
scf
ret
-TileDataPointers_17528:
- dw TileData_17530
- dw TileData_1753B
- dw TileData_17546
- dw TileData_17551
-
-TileData_17530: ; 0x17530
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw $9907
- db $B0, $B1, $B0, $B1, $B0, $B1
- db $00
-
-TileData_1753B: ; 0x1753B
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw $9907
- db $AE, $AF, $B0, $B1, $B0, $B1
- db $00
-
-TileData_17546: ; 0x17546
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw $9907
- db $AE, $AF, $AE, $AF, $B0, $B1
- db $00
-
-TileData_17551: ; 0x17551
- db $06 ; total number of tiles
-
- db $06 ; number of tiles
- dw $9907
- db $AE, $AF, $AE, $AF, $AE, $AF
- db $00
+INCLUDE "data/queued_tiledata/red_field/pokeballs.asm"
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 8d68591..c4a947f 100644
--- a/engine/pinball_game/object_collision/seel_bonus_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/seel_bonus_resolve_collision.asm
@@ -258,9 +258,9 @@ Func_25da3: ; 0x25da3
ld [wd79a], a
.asm_25e07
ld a, $33
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $8
- ld [wd804], a
+ ld [wRumbleDuration], a
lb de, $00, $30
call PlaySoundEffect
call Func_25e85
diff --git a/engine/pinball_game/save_game.asm b/engine/pinball_game/save_game.asm
index 1d2f539..624a1a9 100644
--- a/engine/pinball_game/save_game.asm
+++ b/engine/pinball_game/save_game.asm
@@ -7,7 +7,7 @@ SaveGame: ; 0xda05
ld a, [wd849]
and a
call nz, Func_e5d
- call Func_576
+ call DisableLCD
ld hl, hSTAT
res 6, [hl]
ld hl, rIE
diff --git a/engine/pinball_game/slot.asm b/engine/pinball_game/slot.asm
index 268e118..3331fae 100644
--- a/engine/pinball_game/slot.asm
+++ b/engine/pinball_game/slot.asm
@@ -1,7 +1,7 @@
Func_ed8e: ; 0xed8e
xor a
- ld [wd803], a
- ld [wd804], a
+ ld [wRumblePattern], a
+ ld [wRumbleDuration], a
ld [wCatchEmOrEvolutionSlotRewardActive], a
ld a, [wNumPartyMons]
ld [wSlotAnyPokemonCaught], a
diff --git a/engine/pinball_game/stage_init/init_stages.asm b/engine/pinball_game/stage_init/init_stages.asm
index 1d4ba78..5e26639 100644
--- a/engine/pinball_game/stage_init/init_stages.asm
+++ b/engine/pinball_game/stage_init/init_stages.asm
@@ -10,14 +10,14 @@ InitializeCurrentStage: ; 0x8311
ld hl, vBGWin
ld bc, $0400
ld a, $0
- call Func_63e
+ call __memset_8
jr .asm_833c
.asm_8331
ld hl, vBGWin
ld bc, $0400
ld a, $8
- call Func_63e
+ call __memset_8
.asm_833c
xor a
ld [rVBK], a
diff --git a/engine/pinball_game/timer.asm b/engine/pinball_game/timer.asm
index 49afcee..cbfe9ad 100644
--- a/engine/pinball_game/timer.asm
+++ b/engine/pinball_game/timer.asm
@@ -15,7 +15,7 @@ StartTimer: ; 0x867d
ld [wTimerActive], a
ld a, $1
ld [wd580], a
- callba Func_1404a
+ callba LoadTimerGraphics
ret
Func_86a4: ; 0x86a4
diff --git a/engine/pinball_game/vertical_screen_transition.asm b/engine/pinball_game/vertical_screen_transition.asm
index 94290f2..57ae6bb 100644
--- a/engine/pinball_game/vertical_screen_transition.asm
+++ b/engine/pinball_game/vertical_screen_transition.asm
@@ -4,7 +4,7 @@ FieldVerticalTransition: ; 0xe674
push af
xor a
ld [wPinballIsVisible], a
- ld [wd803], a
+ ld [wRumblePattern], a
callba DrawSpritesForStage
call CleanOAMBuffer
pop af
@@ -17,13 +17,13 @@ FieldVerticalTransition: ; 0xe674
ld [hOBP1], a
rst AdvanceFrame
call Func_e5d
- call Func_576
+ call DisableLCD
call ClearOAMBuffer
call Func_1129
call LoadStageCollisionAttributes
call LoadStageData
call Func_e5d
- call Func_588
+ call EnableLCD
ld a, $e4
ld [hBGP], a
ld a, $e1
diff --git a/engine/pokedex.asm b/engine/pokedex.asm
index 8251d03..e903bb8 100644
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -64,7 +64,7 @@ LoadPokedexScreen: ; 0x2800e
call SetSongBank
ld de, $0004
call PlaySong
- call Func_588
+ call EnableLCD
call FadeIn
ld hl, wScreenState
inc [hl]
@@ -711,7 +711,7 @@ Func_284bc: ; 0x284bc
ExitPokedexScreen: ; 0x284f9
call FadeOut
- call Func_576
+ call DisableLCD
ld hl, hSTAT
res 6, [hl]
ld hl, rIE
diff --git a/engine/select_gameboy_target_menu.asm b/engine/select_gameboy_target_menu.asm
index 3f18b60..339bc55 100644
--- a/engine/select_gameboy_target_menu.asm
+++ b/engine/select_gameboy_target_menu.asm
@@ -40,7 +40,7 @@ InitSelectGameboyTargetMenu: ; 0x800a
call LoadGameboyTargetMenuGfx
call ClearOAMBuffer
call Func_b66
- call Func_588
+ call EnableLCD
call FadeIn
ld hl, wScreenState
inc [hl]
@@ -230,7 +230,7 @@ CGBSelected_TileData: ; 0x8144
EndSelectGameboyTargetMenu: ; 0x414e
call FadeOut
- call Func_576
+ call DisableLCD
ld hl, wCurrentScreen
inc [hl] ; set to SCREEN_ERASE_ALL_DATA
xor a
diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm
index 057e937..641b0cd 100644
--- a/engine/titlescreen.asm
+++ b/engine/titlescreen.asm
@@ -34,7 +34,7 @@ FadeInTitlescreen: ; 0xc00e
call SetSongBank
ld de, $0004
call PlaySong
- call Func_588
+ call EnableLCD
call FadeIn
ld hl, wScreenState
inc [hl]
@@ -148,7 +148,7 @@ Func_c10e: ; 0xc10e
and a
jr z, .asm_c177
call FadeOut
- call Func_576
+ call DisableLCD
ld a, [wd7c2]
and a
jr z, .asm_c173
@@ -224,7 +224,7 @@ Func_c1b1: ; 0xc1b1
Func_c1cb: ; 0c1cb
call FadeOut
- call Func_576
+ call DisableLCD
ld a, [wTitleScreenCursorSelection]
ld c, a
ld b, $0
@@ -243,7 +243,7 @@ Data_c1e4: ; 0xc1e4
GoToHighScoresFromTitlescreen: ; 0xc1e7
call FadeOut
- call Func_576
+ call DisableLCD
ld a, SCREEN_HIGH_SCORES
ld [wCurrentScreen], a
ld a, $1
diff --git a/home.asm b/home.asm
index fb199a5..449d4f9 100644
--- a/home.asm
+++ b/home.asm
@@ -9,7 +9,7 @@ SECTION "rst 18", ROM0
jp JumpToFuncInTable
SECTION "rst 20", ROM0
- jp Func_486
+ jp _ReadHalfword
SECTION "VBlankInt", ROM0
jp VBlank
@@ -334,7 +334,7 @@ VBlank: ; 0x2f2
jr nz, .asm_37d
ld a, [wd85d]
and a
- call nz, Func_504
+ call nz, UpdateSFX
.asm_37d
ld a, [wd84a]
and a
@@ -356,9 +356,9 @@ VBlank: ; 0x2f2
ld a, [wd917]
and a
jr nz, .asm_3b5
- ld a, [wd803]
+ ld a, [wRumblePattern]
rrca
- ld [wd803], a
+ ld [wRumblePattern], a
and $1
jr z, .asm_3b5
set 3, [hl]
@@ -382,7 +382,7 @@ Func_3c3:
jr z, .asm_03cf
call FadeOut
; Fades palettes in from white screen.
- call Func_576
+ call DisableLCD
.asm_03cf
ld hl, hSTAT
res 6, [hl]
@@ -444,7 +444,7 @@ Timer: ; 0x418
jr z, .asm_42a
ld a, [wd85d]
and a
- call nz, Func_504
+ call nz, UpdateSFX
.asm_42a
ld a, [wd84a]
and a
@@ -522,7 +522,7 @@ JumpToFuncInTable: ; 0x477
pop de
jp hl
-Func_486: ; 0x486
+_ReadHalfword: ; 0x486
rlca
add l
ld l, a
@@ -534,105 +534,7 @@ Func_486: ; 0x486
ld l, a
ret
-PlaySong: ; 0x490
- ld a, [hLoadedROMBank]
- push af
- ld a, [wCurrentSongBank]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ld a, e
- ld [wStageSong], a
- ld a, [wCurrentSongBank]
- ld [wStageSongBank], a
- call PlaySong_BankF ; this function is replicated in multiple banks.
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-PlaySoundEffect: ; 0x4af
-; input: de = sound effect id? I think d specifies something special and e holds the id
- ld a, [wdead]
- and a
- ret nz
- ld a, [wSFXTimer]
- and a
- jr z, .asm_4bd
- ld a, d
- and a
- ret z
-.asm_4bd
- ld a, d
- ld [wSFXTimer], a
- ld d, $0
- ld a, [hLoadedROMBank]
- push af
- ld a, [wCurrentSongBank]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- call PlaySoundEffect_BankF ; this function is replicated in multiple banks
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-Func_4d8: ; 0x4d8
- push bc
- push de
- push hl
- ld a, [wChannel4 + 2]
- ld hl, wChannel5 + 2
- or [hl]
- ld hl, wChannel6 + 2
- or [hl]
- and $1
- call z, PlaySoundEffect
- pop hl
- pop de
- pop bc
- ret
-
-PlayCry: ; 0x4ef
-; Plays a Pokemon cry.
-; Input: e = mon id
- ld a, [hLoadedROMBank]
- push af
- ld a, [wCurrentSongBank]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- call PlayCry_BankF ; this function is replicated in multiple banks
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-Func_504: ; 0x504
- ld a, [hLoadedROMBank]
- push af
- ld a, [wCurrentSongBank]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- call Func_3c180
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ld a, [wd801]
- inc a
- ld [wd801], a
- and $3
- ret nz
- ld a, [wSFXTimer]
- and a
- ret z
- dec a
- ld [wSFXTimer], a
- ret
-
-SetSongBank: ; 0x52c
- di
- ld [wCurrentSongBank], a
- ei
- ret
+INCLUDE "home/audio.asm"
CallInFollowingTable: ; 0x532
; Calls a function in a table located immediately after a call to this function.
@@ -690,7 +592,7 @@ BankSwitch: ; 0x54f
ld a, [hFarCallTempA]
jp hl
-Func_576: ; 0x576
+DisableLCD: ; 0x576
ld a, [rLCDC]
bit 7, a
ret z
@@ -703,17 +605,17 @@ Func_576: ; 0x576
jr nz, .asm_581
ret
-Func_588: ; 0x588
+EnableLCD: ; 0x588
ld a, [hFFC4]
and a
- call nz, Func_597
+ call nz, .UpdatePals
ld a, [hLCDC]
set 7, a
ld [rLCDC], a
ld [hLCDC], a
ret
-Func_597: ; 0x597
+.UpdatePals
ld de, rBGPI
ld a, $80
ld [de], a
@@ -721,7 +623,7 @@ Func_597: ; 0x597
ld b, $8
.asm_5a0
ld a, [wBGP]
- call Func_5c2
+ call .UpdateDMGPals
dec b
jr nz, .asm_5a0
ld de, rOBPI
@@ -731,14 +633,14 @@ Func_597: ; 0x597
ld b, $4
.asm_5b2
ld a, [wOBP0]
- call Func_5c2
+ call .UpdateDMGPals
ld a, [wOBP1]
- call Func_5c2
+ call .UpdateDMGPals
dec b
jr nz, .asm_5b2
ret
-Func_5c2: ; 0x5c2
+.UpdateDMGPals
push bc
ld b, $4
.asm_5c5
@@ -769,13 +671,13 @@ GreyscalePalette:
RGB 11, 11, 11
RGB 0, 0, 0
-Func_5e9:
+VBlankIntDisable:
ld a, [rIE]
res 0, a
ld [rIE], a
ret
-Func_5f0:
+VBlankIntEnable:
ld a, [rIE]
set 0, a
ld [rIE], a
@@ -811,9 +713,9 @@ WaitForLCD: ; 0x60f
and $3
jr nz, WaitForLCD
ld a, $a
-.delay10Cycles
+.delay40Cycles
dec a
- jr nz, .delay10Cycles
+ jr nz, .delay40Cycles
ret
Func_61b: ; 0x61b
@@ -842,585 +744,7 @@ Func_61b: ; 0x61b
.asm_63d
ret
-Func_63e: ; 0xc3e
- dec bc
-.asm_63f
- ld [hli], a
- dec bc
- bit 7, b
- jr z, .asm_63f
- ret
-
-Func_646:
- srl b
- rr c
-.asm_064a
- ld a, e
- ld [hli], a
- ld a, d
- ld [hli], a
- dec bc
- ld a, b
- or c
- jr nz, .asm_064a
- ret
-
-ClearData: ; 0x654
-; Clears bc bytes starting at hl.
-; bc can be a maximum of $7fff, since it checks bit 7 of b when looping.
- xor a
- dec bc
-.clearLoop
- ld [hli], a
- dec bc
- bit 7, b
- jr z, .clearLoop
- ret
-
-LocalCopyData: ; 0x65d
- ld a, [hli]
- ld [de], a
- inc de
- dec bc
- ld a, c
- or b
- jr nz, LocalCopyData
- ret
-
-FarCopyData: ; 0x666 spooky
-; Copies data from any bank to either working RAM or video RAM
-; Input: hl = address of data to copy
-; a = bank of data to copy
-; de = destination for data
-; bc = number of bytes to copy
- bit 7, h
- jr nz, .copyFromSRAM
- ld [hROMBankBuffer], a
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- scf
- jr .copyData
-
-.copyFromSRAM
- ld [MBC5SRamBank], a
- and a
-.copyData
- push af
-.copyLoop
- ld a, [hli]
- ld [de], a
- inc de
- dec bc
- ld a, c
- or b
- jr nz, .copyLoop
- pop af
- ret nc
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-ReadByteFromBank: ; 0x68f
-; Input: a = bank
-; hl = address of byte to read
-; Output: a = byte at a:hl
- push de
- ld d, a
- ld a, [hLoadedROMBank]
- ld e, a
- ld a, d
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ld d, [hl]
- ld a, e
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ld a, d
- pop de
- ret
-
-LoadVideoData: ; 0x6a4
-; Input:
-; hl = address of pointer table
-; a = index of item to load in pointer table
-; This needs more documentation. It loads things like graphics and palettes.
- sla a
- ld c, a
- ld b, $0
- add hl, bc
- ld a, [hli]
- ld h, [hl]
- ld l, a
-.loadItem
- ld a, [hli]
- ld c, a
- and [hl]
- cp $ff ; two consecutive $ff bytes terminate the array
- ret z
- ld a, [hli]
- ld b, a ; bc contains pointer to data to be loaded
- push hl
- push bc
- ld a, [hli] ; a contains bank of data to be loaded
- ld e, [hl]
- inc hl
- ld d, [hl] ; de contains destination address for data
- inc hl
- ld c, [hl]
- inc hl
- ld b, [hl] ; bc contains last word of data struct
- inc hl ; this is a wasted instruction
- pop hl
- call Func_6cb
- pop hl
- ld bc, $0005
- add hl, bc
- jr .loadItem
-
-Func_6cb: ; 0x6cb
- srl b
- rr c
- jp c, Func_6fd ; if lowest bit of bc is set
- jp Func_6d5 ; This jumps to the next instruction... Strange.
-
-Func_6d5: ; 0x6d5
- ld [hROMBankBuffer], a ; save bank of data to be loaded
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer] ; a contains bank of data to be loaded
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a ; switch bank to the bank of data to be loaded
- srl b
- rr c
- rl a
- and $1 ; checks bit 1 of the last word in the data struct
- ld [rVBK], a ; set VRAM Bank
-.copyByte
- ld a, [hli]
- ld [de], a
- inc de
- dec bc
- ld a, c
- or b ; does bc = 0?
- jr nz, .copyByte
- xor a
- ld [rVBK], a ; set VRAM Bank to Bank 0
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a ; reload the previous ROM Bank
- ret
-
-Func_6fd: ; 0x6fd
- ld [hROMBankBuffer], a ; save bank of data to be loaded
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer] ; a contains bank of data to be loaded
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a ; switch bank to the bank of data to be loaded
- ld a, e
- bit 6, a
- jr nz, .asm_717
- ld de, rBGPI
- call Func_724
- jr z, .asm_71d
- xor a
-.asm_717
- ld de, rOBPI
- call Func_724
-.asm_71d
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-Func_724: ; 0x724
- res 6, a
- ld b, a
- set 7, a
- ld [de], a
- inc de
-.copyByte
- ld a, [hli]
- ld [de], a
- inc b
- dec c
- ret z
- bit 6, b
- jr z, .copyByte
- ret
-
-LoadOrCopyVRAMData: ; 0x735
- push hl
- ld hl, rLCDC
- bit 7, [hl]
- pop hl
- jp z, FarCopyData
- ; fall through
-LoadVRAMData: ; 0x73f
-; This loads some data into VRAM. It waits for the LCD H-Blank to copy the data 4 bytes at a time.
-; input: hl = source of data
-; a = bank of data to load
-; de = destination of data
-; bc = number of bytes to copy
- bit 7, h
- jr nz, .asm_752
- ld [hROMBankBuffer], a
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- scf
- jr .asm_756
-
-.asm_752
- ld [MBC5SRamBank], a
- and a
-.asm_756
- push af
- call WaitForLCD
-.loop
- call Func_61b
-.waitForHBlank
- ld a, [rSTAT]
- and $3
- jr nz, .waitForHBlank
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- dec bc
- dec bc
- dec bc
- dec bc
- nop
- nop
- nop
- nop
- ld a, b
- or c
- jr nz, .loop
- pop af
- ret nc
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-FarCopyPalettes: ; 0x790
- push hl
- ld hl, rLCDC
- bit 7, [hl]
- pop hl
- jp nz, Func_7dc
- bit 7, h
- jr nz, .asm_7ad
- ld [hROMBankBuffer], a
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- scf
- jr .asm_7b1
-
-.asm_7ad
- ld [MBC5SRamBank], a
- and a
-.asm_7b1
- push af
- ld a, e
- bit 6, e
- ld de, rBGPI
- jr z, .asm_7bf
- res 6, a
- ld de, rOBPI
-.asm_7bf
- set 7, a
- ld [de], a
- inc de
-.asm_7c3
- 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 bc
- dec bc
- dec bc
- dec bc
- ld a, b
- or c
- jr nz, .asm_7c3
- pop af
- ret nc
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-Func_7dc: ; 0x7dc
- bit 7, h
- jr nz, .asm_7ef
- ld [hROMBankBuffer], a
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- scf
- jr .asm_7f3
-
-.asm_7ef
- ld [MBC5SRamBank], a
- and a
-.asm_7f3
- push af
- ld a, e
- bit 6, e
- ld de, rBGPI
- jr z, .asm_801
- res 6, a
- ld de, rOBPI
-.asm_801
- push hl
- ld h, d
- ld l, e
- set 7, a
- call PutTileInVRAM
- inc de
- pop hl
- call WaitForLCD
-.asm_80e
- call Func_61b
-.asm_811
- ld a, [rSTAT]
- and $3
- jr nz, .asm_811
- ld a, [hli]
- ld [de], a
- ld a, [hli]
- ld [de], a
- ld a, [hli]
- ld [de], a
- ld a, [hli]
- ld [de], a
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- dec bc
- dec bc
- dec bc
- dec bc
- nop
- nop
- nop
- nop
- ld a, b
- or c
- jr nz, .asm_80e
- pop af
- ret nc
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-PutTileInVRAM: ; 0x848
-; Puts a tile in VRAM.
-; input: a = tile number
-; hl = pointer to VRAM location where tile should be placed
- push af
- call WaitForLCD
- call Func_61b
-.asm_84f
- ld a, [rSTAT]
- and $3
- jr nz, .asm_84f ; wait for lcd controller to finish transferring data
- pop af
- ld [hl], a ; Store tile number in VRAM background map
- ret
-
-Func_858: ; 0x858
- push af
- call WaitForLCD
- call Func_61b
-.asm_85f
- ld a, [rSTAT]
- and $3
- jr nz, .asm_85f
- ld a, $1
- ld [rVBK], a
- pop af
- ld [hl], a
- xor a
- ld [rVBK], a
- ret
-
-LoadBillboardPaletteMap: ; 0x86f
-; Loads the background palette map for a 6x4-tile billboard picture.
- ld [hROMBankBuffer], a
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ld a, [rLCDC]
- bit 7, a
- jr nz, .asm_8ac
- ld a, $1
- ld [rVBK], a
- ld b, $4
-.loop
- push bc
- ld a, [de]
- ld [hli], a
- inc de
- ld a, [de]
- ld [hli], a
- inc de
- ld a, [de]
- ld [hli], a
- inc de
- ld a, [de]
- ld [hli], a
- inc de
- ld a, [de]
- ld [hli], a
- inc de
- ld a, [de]
- ld [hli], a
- inc de
- ld bc, $001a
- add hl, bc
- pop bc
- dec b
- jr nz, .loop
- xor a
- ld [rVBK], a
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-.asm_8ac
- ld b, $4
-.asm_8ae
- push bc
- ld a, [de]
- call Func_858
- inc hl
- inc de
- ld a, [de]
- call Func_858
- inc hl
- inc de
- ld a, [de]
- call Func_858
- inc hl
- inc de
- ld a, [de]
- call Func_858
- inc hl
- inc de
- ld a, [de]
- call Func_858
- inc hl
- inc de
- ld a, [de]
- call Func_858
- inc de
- ld bc, $001b
- add hl, bc
- pop bc
- dec b
- jr nz, .asm_8ae
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-Func_8e1: ; 0x8e1
- ld [hROMBankBuffer], a
- ld a, [hLoadedROMBank]
- push af
- ld a, [hROMBankBuffer]
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ld a, [rLCDC]
- bit 7, a
- jr nz, .asm_902
- ld a, c
- ld [hli], a
-.asm_8f5
- ld a, [de]
- ld [hl], a
- inc de
- dec b
- jr nz, .asm_8f5
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
-
-.asm_902
- ld a, c
- call PutTileInVRAM
- inc hl
-.asm_907
- ld a, [de]
- call PutTileInVRAM
- inc de
- dec b
- jr nz, .asm_907
- pop af
- ld [hLoadedROMBank], a
- ld [MBC5RomBank], a
- ret
+INCLUDE "home/copy.asm"
ClearOAMBuffer: ; 0x916
; Clears the OAM buffer by loading $f0 into all of the entries.
@@ -1481,266 +805,8 @@ SGBWait1750: ; 0x948
jr nz, SGBWait1750
ret
-GenRandom: ; 0x959
- push bc
- push de
- push hl
- ld a, [wd811]
- ld c, a
- ld b, $0
- inc a
- cp $37
- jr nz, .asm_96e
- call Func_9fa
- xor a
- ld bc, $0000
-.asm_96e
- ld [wd811], a
- ld hl, wd812
- add hl, bc
- ld a, [hl]
- pop hl
- pop de
- pop bc
- ret
-
-Func_97a: ; 0x97a
- ld a, [wd810]
- ld d, a
- ld a, $0
- ld a, [$afff]
-.asm_983
- cp d
- jr c, .asm_989
- sub d
- jr .asm_983
-
-.asm_989
- ld [wd80f], a
- ld [wd848], a
- ld e, $1
- ld hl, Data_9c4
- ld a, $36
-.asm_996
- push af
- ld c, [hl]
- inc hl
- ld b, $0
- push hl
- ld hl, wd812
- add hl, bc
- ld [hl], e
- ld a, [wd80f]
- sub e
- jr nc, .asm_9a8
- add d
-.asm_9a8
- ld e, a
- ld a, [hl]
- ld [wd80f], a
- pop hl
- pop af
- dec a
- jr nz, .asm_996
- call Func_9fa
- call Func_9fa
- call Func_9fa
- ld a, $0
- call GenRandom
- ld [$afff], a
- ret
-
-Data_9c4:
- db $14, $29, $07, $1c, $31, $0f, $24, $02, $17
- db $2c, $0a, $1f, $34, $12, $27, $05, $1a, $2f
- db $0d, $22, $00, $15, $2a, $08, $1d, $32, $10
- db $25, $03, $18, $2d, $0b, $20, $35, $13, $28
- db $06, $1b, $30, $0e, $23, $01, $16, $2b, $09
- db $1e, $33, $11, $26, $04, $19, $2e, $0c, $21
-
-Func_9fa: ; 0x9fa
- ld a, [wd810]
- ld d, a
- ld bc, wd812
- ld hl, wd831
- ld e, $18
-.asm_a06
- ld a, [bc]
- sub [hl]
- jr nc, .asm_a0b
- add d
-.asm_a0b
- ld [bc], a
- dec e
- jr nz, .asm_a06
- ld bc, wd82a
- ld hl, wd812
- ld e, $1f
-.asm_a17
- ld a, [bc]
- sub [hl]
- jr nc, .asm_a1c
- add d
-.asm_a1c
- ld [bc], a
- dec e
- jr nz, .asm_a17
- ret
-
-Func_a21: ; 0xa21
- push bc
- push hl
- ld c, a
- ld b, $0
- ld hl, Data_a38
- add hl, bc
- ld l, [hl]
- call GenRandom
- call Func_dd4
- inc h
- srl h
- ld a, h
- pop hl
- pop bc
- ret
-
-Data_a38:
-x = 0
-REPT 128
- db x | ((x >> 7) & 1)
-x = x + 2
-ENDR
-
-ReadJoypad: ; 0xab8
-; Reads the current state of the joypad and saves the state into
-; some registers the game uses during gameplay. It remembers the joypad state
-; from the current frame, previous frame, and two frames ago.
- ld a, $20
- ld [rJOYP], a
- ld a, [rJOYP]
- ld a, [rJOYP]
- and $f
- swap a
- ld b, a
- ld a, $30
- ld [rJOYP], a
- ld a, $10
- ld [rJOYP], a
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
- and $f
- or b
- cpl ; a contains currently-pressed buttons
- ld [hJoypadState], a
- ld a, $30
- ld [rJOYP], a
- ld a, [hJoypadState]
- ld hl, hPreviousJoypadState
- xor [hl] ; a contains buttons that are different from previous frame
- push af
- ld hl, hJoypadState
- and [hl] ; a contains newly-pressed buttons compared to last frame
- ld [hNewlyPressedButtons], a
- ld [hPressedButtons], a
- pop af
- ld hl, hPreviousJoypadState
- and [hl] ; a contains newly-pressed buttons compared to two frames ago
- ld [hPrevPreviousJoypadState], a
- ld a, [hJoypadState]
- and a
- jr z, .asm_b15
- ld hl, hPreviousJoypadState
- cp [hl]
- jr nz, .asm_b15
- ; button(s) is pressed, and they're identical to the buttons pressed last frame.
- ; this code is related to holding down a button for an extended period of time.
- ld hl, hJoyRepeatDelay
- dec [hl]
- jr nz, .asm_b1a
- ld a, [hJoypadState]
- ld [hPressedButtons], a
- ld a, [wd807]
- ld [hJoyRepeatDelay], a
- jr .asm_b1a
-
-.asm_b15
- ld a, [wd806]
- ld [hJoyRepeatDelay], a
-.asm_b1a
- ld a, [hJoypadState]
- ld [hPreviousJoypadState], a
- ld hl, wJoypadStatesPersistent
- ld a, [hJoypadState]
- or [hl]
- ld [hli], a
- ld a, [hNewlyPressedButtons]
- or [hl]
- ld [hli], a
- ld a, [hPressedButtons]
- or [hl]
- ld [hli], a
- ret
-
-ClearPersistentJoypadStates: ; 0xb2e
- ld hl, wJoypadStatesPersistent
- xor a
- ld [hli], a
- ld [hli], a
- ld [hl], a
- ret
-
-IsKeyPressed2: ; 0xb36
- ld a, [hJoypadState]
- and [hl]
- jr z, .asm_b3e
- cp [hl]
- jr z, .asm_b48
-.asm_b3e
- inc hl
- ld a, [hJoypadState]
- and [hl]
- ret z
- cp [hl]
- jr z, .asm_b48
- xor a
- ret
-
-.asm_b48
- ld a, $1
- and a
- ret
-
-IsKeyPressed: ; 0xb4c
-; Checks if a key for the specified key config is pressed.
-; input: hl = pointer to key config byte pair (e.g. wKeyConfigLeftFlipper)
-; output: zero flag is set if a corresponding key is pressed
-; zero flag is reset if no corresponding key is pressed
- ld a, [hJoypadState]
- and [hl]
- jr z, .asm_b58
- cp [hl]
- jr nz, .asm_b58
- ld a, [hNewlyPressedButtons]
- and [hl]
- ret nz
-.asm_b58
- inc hl
- ld a, [hJoypadState]
- and [hl]
- ret z
- cp [hl]
- jr nz, .asm_b64
- ld a, [hNewlyPressedButtons]
- and [hl]
- ret
-
-.asm_b64
- xor a
- ret
+INCLUDE "home/random.asm"
+INCLUDE "home/joypad.asm"
Func_b66: ; 0xb66
ld a, [hGameBoyColorFlag]
@@ -3255,7 +2321,8 @@ Func_1bb2: ; 0x1bb2
ret
Data_1bcf:
- db $02, $01, $04, $03
+ ; $ff, >$7f, >$3f, else
+ db $02, $01, $04, $03
Func_1bd3: ; 0x1bd3
lb de, $00, $01
@@ -3266,463 +2333,7 @@ Func_1bd3: ; 0x1bd3
scf
ret
-Func_1be3: ; 0x1be3
- ld a, $c0
- ld [rRP], a
- ld a, $ff
- ld [wd8ea], a
- xor a
- ld b, a
-.asm_1bee
- inc a
- jr nz, .asm_1bee
- inc b
- jr nz, .asm_1bee
- ld hl, wd8eb
- ld a, [rKEY1]
- bit 7, a
- jr z, .asm_1c0c
- ld [hl], $e
- inc hl
- ld [hl], $12
- inc hl
- ld [hl], $8
- inc hl
- ld [hl], $c
- inc hl
- ld [hl], $c
- ret
-
-.asm_1c0c
- ld [hl], $6
- inc hl
- ld [hl], $8
- inc hl
- ld [hl], $2
- inc hl
- ld [hl], $4
- inc hl
- ld [hl], $5
- ret
-
-Func_1c1b: ; 0x1c1b
- inc d
- ret z
- ld a, [$ff00+c]
- bit 1, a
- jr z, Func_1c1b
- ret
-
-Func_1c23: ; 0x1c23
- inc d
- ret z
- ld a, [$ff00+c]
- bit 1, a
- jr nz, Func_1c23
- ret
-
-Func_1c2b: ; 0x1c2b
- ld a, $c1
- ld [$ff00+c], a
-.asm_1c2e
- dec d
- jr nz, .asm_1c2e
- ret
-
-Func_1c32: ; 0x1c32
- ld a, $c0
- ld [$ff00+c], a
-.asm_1c35
- dec d
- jr nz, .asm_1c35
- ret
-
-Func_1c39:
- xor a
- ld [hNumFramesSinceLastVBlank], a
- ld a, $1
- ld [wd8e9], a
-.asm_1c41
- ld b, $2
- ld c, rRP % $100
- ld a, [$ff00+c]
- and b
- jr z, Func_1c50
- ld a, [hNumFramesSinceLastVBlank]
- and a
- jr nz, Func_1ca1
- jr .asm_1c41
-
-Func_1c50: ; 0x1c50
- ld a, $1
- ld [wd8e9], a
- ld b, $1a
- ld c, rRP % $100
- ld d, $0
- ld e, d
- call Func_1c23
- ld a, d
- and a
- jp z, Func_1dc2
- ld d, e
- call Func_1c1b
- ld a, d
- and a
- jp z, Func_1dc2
- call Func_1c23
- ld a, d
- and a
- jp z, Func_1dc2
- call Func_1c1b
- ld a, d
- and a
- jp z, Func_1dc2
- cp $8
- jp c, Func_1dc2
- cp $2a
- jp nc, Func_1dc2
- ld a, $0
- ld [wd8ea], a
- ld d, b
- call Func_1c32
- ld d, b
- call Func_1c2b
- ld d, b
- call Func_1c32
- ld d, b
- call Func_1c2b
- ld d, b
- call Func_1c32
- ret
-
-Func_1ca1: ; 0x1ca1
- ld a, $2
- ld [wd8e9], a
- ld b, $1a
- ld c, rRP % $100
- ld d, b
- ld e, $0
- call Func_1c32
- ld d, b
- call Func_1c2b
- ld d, b
- call Func_1c32
- ld d, b
- call Func_1c2b
- ld d, b
- call Func_1c32
- ld d, e
- call Func_1c23
- ld a, d
- and a
- jp z, Func_1dc2
- ld d, e
- call Func_1c1b
- ld a, d
- and a
- jp z, Func_1dc2
- ld d, e
- call Func_1c23
- ld a, d
- and a
- jp z, Func_1dc2
- ld d, e
- call Func_1c1b
- ld a, d
- and a
- jp z, Func_1dc2
- ld d, $1a
- call Func_1c32
- ld a, $0
- ld [wd8ea], a
- ret
-
-Func_1cef:
- xor a
- ld [rRP], a
- ld a, $ff
- ld [wd8ea], a
- ret
-
-Func_1cf8: ; 0x1cf8
- xor a
- ld [wd8e4], a
- ld [wd8e5], a
- push hl
- push bc
- ld hl, wd8e6
- ld a, $5a
- ld [hli], a
- ld [hl], b
- dec hl
- ld b, $2
- ld d, $1e
- call Func_1c32
- call Func_1d44
- pop bc
- pop hl
- call Func_1ed3
- call Func_1d44
- ld a, [wd8e4]
- ld [wd8e6], a
- ld a, [wd8e5]
- ld [wd8e7], a
- ld hl, wd8e6
- ld b, $2
- call Func_1d44
- ld hl, wd8ea
- ld b, $1
- call Func_1e3b
- ld a, [wd8e6]
- ld [wd8e4], a
- ld a, [wd8e7]
- ld [wd8e5], a
- ret
-
-Func_1d44: ; 0x1d44
- ld a, [wd8ea]
- cp $0
- ret nz
- ld c, rRP % $100
- ld d, $16
- call Func_1c2b
- ld d, $16
- call Func_1c32
- ld a, b
- cpl
- ld b, a
-.asm_1d59
- inc b
- jr z, .asm_1dae
- ld a, $8
- ld [wd8e3], a
- ld a, [hli]
- ld e, a
- ld a, [wd8e4]
- add e
- ld [wd8e4], a
- jr nc, .asm_1d75
- ld a, [wd8e5]
- inc a
- ld [wd8e5], a
- jr .asm_1d78
-
-.asm_1d75
- call Func_1ed3
-.asm_1d78
- ld a, e
- rlca
- ld e, a
- jr nc, .asm_1d8d
- ld a, [wd8eb]
- ld d, a
- call Func_1c2b
- ld a, [wd8ec]
- ld d, a
- call Func_1c32
- jr .asm_1d9b
-
-.asm_1d8d
- ld a, [wd8ed]
- ld d, a
- call Func_1c2b
- ld a, [wd8ee]
- ld d, a
- call Func_1c32
-.asm_1d9b
- ld a, [wd8e3]
- dec a
- ld [wd8e3], a
- jr z, .asm_1dac
- call Func_1ed4
- call Func_1ed4
- jr .asm_1d78
-
-.asm_1dac
- jr .asm_1d59
-
-.asm_1dae
- call Func_1ed3
- call Func_1ed3
- call Func_1ed4
- ld d, $16
- call Func_1c2b
- ld d, $16
- call Func_1c32
- ret
-
-Func_1dc2: ; 0x1dc2
- ld a, $2
- ld [wd8ea], a
- ret
-
-Func_1dc8:
- ld a, [wd8ea]
- or $1
- ld [wd8ea], a
- ret
-
-Func_1dd1: ; 0x1dd1
- ld a, [wd8ea]
- or $4
- ld [wd8ea], a
- ret
-
-Func_1dda: ; 0x1dda
- xor a
- ld [wd8e4], a
- ld [wd8e5], a
- push hl
- ld hl, wd8e6
- ld b, $2
- call Func_1e3b
- ld a, [wd8e7]
- ld [wd8e8], a
- ld b, a
- pop hl
- ld a, [wd8e6]
- cp $5a
- jp nz, Func_1dd1
- call Func_1e3b
- ld a, [wd8e4]
- ld d, a
- ld a, [wd8e5]
- ld e, a
- push de
- ld hl, wd8e6
- ld b, $2
- call Func_1e3b
- pop de
- ld hl, wd8e6
- ld a, [hli]
- xor d
- ld b, a
- ld a, [hl]
- xor e
- or b
- jr z, .asm_1e22
- ld a, [wd8ea]
- or $1
- ld [wd8ea], a
-.asm_1e22
- push de
- ld hl, wd8ea
- ld b, $1
- call Func_1d44
- pop de
- ld a, d
- ld [wd8e4], a
- ld a, e
- ld [wd8e5], a
- ld a, [wd8e8]
- cp $82
- ret z
- ret
-
-Func_1e3b: ; 0x1e3b
- ld a, [wd8ea]
- cp $0
- ret nz
- ld c, rRP % $100
- ld d, $0
- call Func_1c23
- ld a, d
- or a
- jp z, Func_1dc2
- ld d, $0
- call Func_1c1b
- ld a, d
- or a
- jp z, Func_1dc2
- ld d, $0
- call Func_1c23
- ld a, d
- or a
- jp z, Func_1dc2
- call Func_1ed4
- call Func_1ed4
- push af
- pop af
- ld a, b
- cpl
- ld b, a
-.asm_1e6c
- inc b
- jr z, .asm_1eb9
- ld a, $8
- ld [wd8e3], a
-.asm_1e74
- ld d, $0
- call Func_1c1b
- call Func_1c23
- ld a, [wd8ef]
- cp d
- jr nc, .asm_1e88
- ld a, e
- set 0, a
- ld e, a
- jr .asm_1e8c
-
-.asm_1e88
- ld a, e
- res 0, a
- ld e, a
-.asm_1e8c
- ld a, [wd8e3]
- dec a
- ld [wd8e3], a
- jr z, .asm_1ea0
- ld a, e
- rlca
- ld e, a
- call Func_1ed4
- call Func_1ed4
- jr .asm_1e74
-
-.asm_1ea0
- ld a, e
- ld [hli], a
- ld a, [wd8e4]
- add e
- ld [wd8e4], a
- jr nc, .asm_1eb4
- ld a, [wd8e5]
- inc a
- ld [wd8e5], a
- jr .asm_1eb7
-
-.asm_1eb4
- call Func_1ed3
-.asm_1eb7
- jr .asm_1e6c
-
-.asm_1eb9
- ld d, $0
- call Func_1c1b
- ld a, d
- and a
- jp z, Func_1dc2
- ld d, $11
- call Func_1c32
- ret
-
-Func_1ec9:
- ld b, $00
- jp Func_1cf8
-
-Func_1ece:
- ld b, $00
- jp Func_1dda
-
-Func_1ed3: ; 0x1ed3
- ret
-
-Func_1ed4: ; 0x1ed4
- jr z, .asm_1ed6
-.asm_1ed6
- jr nz, .asm_1ed8
-.asm_1ed8
- ret
+INCLUDE "home/ir.asm"
Func_1ed9:
push bc
@@ -3949,23 +2560,25 @@ Func_1ffc: ; 0x1ffc
ld a, SCREEN_ERASE_ALL_DATA
ld [wCurrentScreen], a
.master_loop
- call Func_2034
+ call TickRumbleDuration
call DoScreenLogic
call CleanOAMBuffer
call ClearPersistentJoypadStates
rst AdvanceFrame
jr .master_loop
-Func_2034: ; 0x2034
- ld a, [wd804]
+TickRumbleDuration: ; 0x2034
+; Decrements the Gameboy rumble duration.
+; Turns off rumble when it gets to 0.
+ ld a, [wRumbleDuration]
and a
- jr z, .asm_203f
+ jr z, .rumbleOff
dec a
- ld [wd804], a
+ ld [wRumbleDuration], a
ret
-.asm_203f
- ld [wd803], a
+.rumbleOff
+ ld [wRumblePattern], a
ret
DoScreenLogic: ; 0x2043
@@ -4372,15 +2985,15 @@ ApplyTorque: ; 0x222b
cp $3
jr c, .asm_2254
ld a, $ff
- ld [wd803], a
+ ld [wRumblePattern], a
ld a, $1
- ld [wd804], a
+ ld [wRumbleDuration], a
ld a, [wFlipperCollision]
and a
jr nz, .asm_2254
push de
ld de, $0008
- call Func_4d8
+ call PlaySFXIfNoneActive
pop de
.asm_2254
srl d
diff --git a/home/audio.asm b/home/audio.asm
new file mode 100644
index 0000000..622e5da
--- /dev/null
+++ b/home/audio.asm
@@ -0,0 +1,101 @@
+
+PlaySong: ; 0x490
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [wCurrentSongBank]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ld a, e
+ ld [wStageSong], a
+ ld a, [wCurrentSongBank]
+ ld [wStageSongBank], a
+ call PlaySong_BankF ; this function is replicated in multiple banks.
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+PlaySoundEffect: ; 0x4af
+; u8 d = duration
+; u8 e = SFX ID
+ ld a, [wdead]
+ and a
+ ret nz
+ ld a, [wSFXTimer]
+ and a
+ jr z, .asm_4bd
+ ld a, d
+ and a
+ ret z
+.asm_4bd
+ ld a, d
+ ld [wSFXTimer], a
+ ld d, $0
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [wCurrentSongBank]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ call PlaySoundEffect_BankF ; this function is replicated in multiple banks
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+PlaySFXIfNoneActive: ; 0x4d8
+ push bc
+ push de
+ push hl
+ ld a, [wChannel4 + 2]
+ ld hl, wChannel5 + 2
+ or [hl]
+ ld hl, wChannel6 + 2
+ or [hl]
+ and $1
+ call z, PlaySoundEffect
+ pop hl
+ pop de
+ pop bc
+ ret
+
+PlayCry: ; 0x4ef
+; Plays a Pokemon cry.
+; Input: e = mon id
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [wCurrentSongBank]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ call PlayCry_BankF ; this function is replicated in multiple banks
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+UpdateSFX: ; 0x504
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [wCurrentSongBank]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ call Func_3c180
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ld a, [wd801]
+ inc a
+ ld [wd801], a
+ and $3
+ ret nz
+ ld a, [wSFXTimer]
+ and a
+ ret z
+ dec a
+ ld [wSFXTimer], a
+ ret
+
+SetSongBank: ; 0x52c
+ di
+ ld [wCurrentSongBank], a
+ ei
+ ret
diff --git a/home/copy.asm b/home/copy.asm
new file mode 100644
index 0000000..d8f2a74
--- /dev/null
+++ b/home/copy.asm
@@ -0,0 +1,591 @@
+__memset_8: ; 0xc3e
+ dec bc
+.asm_63f
+ ld [hli], a
+ dec bc
+ bit 7, b
+ jr z, .asm_63f
+ ret
+
+__memset_16:
+ srl b
+ rr c
+.asm_064a
+ ld a, e
+ ld [hli], a
+ ld a, d
+ ld [hli], a
+ dec bc
+ ld a, b
+ or c
+ jr nz, .asm_064a
+ ret
+
+ClearData: ; 0x654
+; Clears bc bytes starting at hl.
+; bc can be a maximum of $7fff, since it checks bit 7 of b when looping.
+ xor a
+ dec bc
+.clearLoop
+ ld [hli], a
+ dec bc
+ bit 7, b
+ jr z, .clearLoop
+ ret
+
+LocalCopyData: ; 0x65d
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec bc
+ ld a, c
+ or b
+ jr nz, LocalCopyData
+ ret
+
+FarCopyData: ; 0x666 spooky
+; Copies data from any bank to either working RAM or video RAM
+; Input: hl = address of data to copy
+; a = bank of data to copy
+; de = destination for data
+; bc = number of bytes to copy
+ bit 7, h
+ jr nz, .copyFromSRAM
+ ld [hROMBankBuffer], a
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ scf
+ jr .copyData
+
+.copyFromSRAM
+ ld [MBC5SRamBank], a
+ and a
+.copyData
+ push af
+.copyLoop
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec bc
+ ld a, c
+ or b
+ jr nz, .copyLoop
+ pop af
+ ret nc
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+ReadByteFromBank: ; 0x68f
+; Input: a = bank
+; hl = address of byte to read
+; Output: a = byte at a:hl
+ push de
+ ld d, a
+ ld a, [hLoadedROMBank]
+ ld e, a
+ ld a, d
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ld d, [hl]
+ ld a, e
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ld a, d
+ pop de
+ ret
+
+LoadVideoData: ; 0x6a4
+; Input:
+; hl = address of pointer table
+; a = index of item to load in pointer table
+; This needs more documentation. It loads things like graphics and palettes.
+ sla a
+ ld c, a
+ ld b, $0
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+.loadItem
+ ld a, [hli]
+ ld c, a
+ and [hl]
+ cp $ff ; two consecutive $ff bytes terminate the array
+ ret z
+ ld a, [hli]
+ ld b, a ; bc contains pointer to data to be loaded
+ push hl
+ push bc
+ ld a, [hli] ; a contains bank of data to be loaded
+ ld e, [hl]
+ inc hl
+ ld d, [hl] ; de contains destination address or palette offset for data
+ inc hl
+ ld c, [hl]
+ inc hl
+ ld b, [hl] ; bc contains size and flags
+ inc hl ; this is a wasted instruction
+ pop hl
+ call .autoCopyVideoData
+ pop hl
+ ld bc, $0005
+ add hl, bc
+ jr .loadItem
+
+.autoCopyVideoData
+; a: bank
+; hl: source
+; bc: flags and size rolled into one
+; bit 0: CGB palette data if set, tile data else
+; If tile data:
+; bit 1: VBank
+; de = dest
+; Else:
+; de = palette offset
+; remaining bits: size
+ srl b
+ rr c
+ jp c, FarCopyCGBPals ; if lowest bit of bc is set
+ jp @ + 2
+ ld [hROMBankBuffer], a ; save bank of data to be loaded
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer] ; a contains bank of data to be loaded
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a ; switch bank to the bank of data to be loaded
+ srl b
+ rr c
+ rl a
+ and $1 ; checks bit 1 of the last word in the data struct
+ ld [rVBK], a ; set VRAM Bank
+.copyByte
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec bc
+ ld a, c
+ or b ; does bc = 0?
+ jr nz, .copyByte
+ xor a
+ ld [rVBK], a ; set VRAM Bank to Bank 0
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a ; reload the previous ROM Bank
+ ret
+
+FarCopyCGBPals: ; 0x6fd
+; a: bank
+; hl: source
+; e: dest offset
+; bc: size
+ ld [hROMBankBuffer], a ; save bank of data to be loaded
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer] ; a contains bank of data to be loaded
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a ; switch bank to the bank of data to be loaded
+ ld a, e
+ bit 6, a
+ jr nz, .do_obp
+ ld de, rBGPI
+ call .copyPaletteData
+ jr z, .no_obp
+ xor a
+.do_obp
+ ld de, rOBPI
+ call .copyPaletteData
+.no_obp
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+.copyPaletteData
+ res 6, a ; only 64 bytes fit here
+ ld b, a
+ set 7, a ; auto-increment
+ ld [de], a
+ inc de
+.copyByte
+ ld a, [hli]
+ ld [de], a
+ inc b
+ dec c
+ ret z
+ bit 6, b
+ jr z, .copyByte
+ ret
+
+LoadOrCopyVRAMData: ; 0x735
+ push hl
+ ld hl, rLCDC
+ bit 7, [hl]
+ pop hl
+ jp z, FarCopyData
+ ; fall through
+LoadVRAMData: ; 0x73f
+; This loads some data into VRAM. It waits for the LCD H-Blank to copy the data 4 bytes at a time.
+; input: hl = source of data
+; a = bank of data to load
+; de = destination of data
+; bc = number of bytes to copy
+ bit 7, h
+ jr nz, .asm_752
+ ld [hROMBankBuffer], a
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ scf
+ jr .asm_756
+
+.asm_752
+ ld [MBC5SRamBank], a
+ and a
+.asm_756
+ push af
+ call WaitForLCD
+.loop
+ call Func_61b
+.waitForHBlank
+ ld a, [rSTAT]
+ and $3
+ jr nz, .waitForHBlank
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ dec bc
+ dec bc
+ dec bc
+ dec bc
+ nop
+ nop
+ nop
+ nop
+ ld a, b
+ or c
+ jr nz, .loop
+ pop af
+ ret nc
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+FarCopyPalettes: ; 0x790
+ push hl
+ ld hl, rLCDC
+ bit 7, [hl]
+ pop hl
+ jp nz, Func_7dc
+ bit 7, h
+ jr nz, .asm_7ad
+ ld [hROMBankBuffer], a
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ scf
+ jr .asm_7b1
+
+.asm_7ad
+ ld [MBC5SRamBank], a
+ and a
+.asm_7b1
+ push af
+ ld a, e
+ bit 6, e
+ ld de, rBGPI
+ jr z, .asm_7bf
+ res 6, a
+ ld de, rOBPI
+.asm_7bf
+ set 7, a
+ ld [de], a
+ inc de
+.asm_7c3
+ 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 bc
+ dec bc
+ dec bc
+ dec bc
+ ld a, b
+ or c
+ jr nz, .asm_7c3
+ pop af
+ ret nc
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+Func_7dc: ; 0x7dc
+ bit 7, h
+ jr nz, .asm_7ef
+ ld [hROMBankBuffer], a
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ scf
+ jr .asm_7f3
+
+.asm_7ef
+ ld [MBC5SRamBank], a
+ and a
+.asm_7f3
+ push af
+ ld a, e
+ bit 6, e
+ ld de, rBGPI
+ jr z, .asm_801
+ res 6, a
+ ld de, rOBPI
+.asm_801
+ push hl
+ ld h, d
+ ld l, e
+ set 7, a
+ call PutTileInVRAM
+ inc de
+ pop hl
+ call WaitForLCD
+.asm_80e
+ call Func_61b
+.asm_811
+ ld a, [rSTAT]
+ and $3
+ jr nz, .asm_811
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ ld a, [hli]
+ ld [de], a
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ dec bc
+ dec bc
+ dec bc
+ dec bc
+ nop
+ nop
+ nop
+ nop
+ ld a, b
+ or c
+ jr nz, .asm_80e
+ pop af
+ ret nc
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+PutTileInVRAM: ; 0x848
+; Puts a tile in VRAM.
+; input: a = tile number
+; hl = pointer to VRAM location where tile should be placed
+ push af
+ call WaitForLCD
+ call Func_61b
+.asm_84f
+ ld a, [rSTAT]
+ and $3
+ jr nz, .asm_84f ; wait for lcd controller to finish transferring data
+ pop af
+ ld [hl], a ; Store tile number in VRAM background map
+ ret
+
+Func_858: ; 0x858
+ push af
+ call WaitForLCD
+ call Func_61b
+.asm_85f
+ ld a, [rSTAT]
+ and $3
+ jr nz, .asm_85f
+ ld a, $1
+ ld [rVBK], a
+ pop af
+ ld [hl], a
+ xor a
+ ld [rVBK], a
+ ret
+
+LoadBillboardPaletteMap: ; 0x86f
+; Loads the background palette map for a 6x4-tile billboard picture.
+ ld [hROMBankBuffer], a
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ld a, [rLCDC]
+ bit 7, a
+ jr nz, .asm_8ac
+ ld a, $1
+ ld [rVBK], a
+ ld b, $4
+.loop
+ push bc
+ ld a, [de]
+ ld [hli], a
+ inc de
+ ld a, [de]
+ ld [hli], a
+ inc de
+ ld a, [de]
+ ld [hli], a
+ inc de
+ ld a, [de]
+ ld [hli], a
+ inc de
+ ld a, [de]
+ ld [hli], a
+ inc de
+ ld a, [de]
+ ld [hli], a
+ inc de
+ ld bc, $001a
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .loop
+ xor a
+ ld [rVBK], a
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+.asm_8ac
+ ld b, $4
+.asm_8ae
+ push bc
+ ld a, [de]
+ call Func_858
+ inc hl
+ inc de
+ ld a, [de]
+ call Func_858
+ inc hl
+ inc de
+ ld a, [de]
+ call Func_858
+ inc hl
+ inc de
+ ld a, [de]
+ call Func_858
+ inc hl
+ inc de
+ ld a, [de]
+ call Func_858
+ inc hl
+ inc de
+ ld a, [de]
+ call Func_858
+ inc de
+ ld bc, $001b
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .asm_8ae
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+Func_8e1: ; 0x8e1
+ ld [hROMBankBuffer], a
+ ld a, [hLoadedROMBank]
+ push af
+ ld a, [hROMBankBuffer]
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ld a, [rLCDC]
+ bit 7, a
+ jr nz, .asm_902
+ ld a, c
+ ld [hli], a
+.asm_8f5
+ ld a, [de]
+ ld [hl], a
+ inc de
+ dec b
+ jr nz, .asm_8f5
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
+
+.asm_902
+ ld a, c
+ call PutTileInVRAM
+ inc hl
+.asm_907
+ ld a, [de]
+ call PutTileInVRAM
+ inc de
+ dec b
+ jr nz, .asm_907
+ pop af
+ ld [hLoadedROMBank], a
+ ld [MBC5RomBank], a
+ ret
diff --git a/home/ir.asm b/home/ir.asm
new file mode 100644
index 0000000..97572eb
--- /dev/null
+++ b/home/ir.asm
@@ -0,0 +1,457 @@
+Func_1be3: ; 0x1be3
+ ld a, $c0
+ ld [rRP], a
+ ld a, $ff
+ ld [wd8ea], a
+ xor a
+ ld b, a
+.loop
+ inc a
+ jr nz, .loop
+ inc b
+ jr nz, .loop
+ ld hl, wd8eb
+ ld a, [rKEY1]
+ bit 7, a
+ jr z, .normalSpeed
+ ld [hl], $e
+ inc hl
+ ld [hl], $12
+ inc hl
+ ld [hl], $8
+ inc hl
+ ld [hl], $c
+ inc hl
+ ld [hl], $c
+ ret
+
+.normalSpeed
+ ld [hl], $6
+ inc hl
+ ld [hl], $8
+ inc hl
+ ld [hl], $2
+ inc hl
+ ld [hl], $4
+ inc hl
+ ld [hl], $5
+ ret
+
+Func_1c1b: ; 0x1c1b
+ inc d
+ ret z
+ ld a, [$ff00+c]
+ bit 1, a
+ jr z, Func_1c1b
+ ret
+
+Func_1c23: ; 0x1c23
+ inc d
+ ret z
+ ld a, [$ff00+c]
+ bit 1, a
+ jr nz, Func_1c23
+ ret
+
+Func_1c2b: ; 0x1c2b
+ ld a, $c1
+ ld [$ff00+c], a
+.asm_1c2e
+ dec d
+ jr nz, .asm_1c2e
+ ret
+
+Func_1c32: ; 0x1c32
+ ld a, $c0
+ ld [$ff00+c], a
+.asm_1c35
+ dec d
+ jr nz, .asm_1c35
+ ret
+
+Func_1c39:
+ xor a
+ ld [hNumFramesSinceLastVBlank], a
+ ld a, $1
+ ld [wd8e9], a
+.asm_1c41
+ ld b, $2
+ ld c, rRP % $100
+ ld a, [$ff00+c]
+ and b
+ jr z, Func_1c50
+ ld a, [hNumFramesSinceLastVBlank]
+ and a
+ jr nz, Func_1ca1
+ jr .asm_1c41
+
+Func_1c50: ; 0x1c50
+ ld a, $1
+ ld [wd8e9], a
+ ld b, $1a
+ ld c, rRP % $100
+ ld d, $0
+ ld e, d
+ call Func_1c23
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ ld d, e
+ call Func_1c1b
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ call Func_1c23
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ call Func_1c1b
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ cp $8
+ jp c, Func_1dc2
+ cp $2a
+ jp nc, Func_1dc2
+ ld a, $0
+ ld [wd8ea], a
+ ld d, b
+ call Func_1c32
+ ld d, b
+ call Func_1c2b
+ ld d, b
+ call Func_1c32
+ ld d, b
+ call Func_1c2b
+ ld d, b
+ call Func_1c32
+ ret
+
+Func_1ca1: ; 0x1ca1
+ ld a, $2
+ ld [wd8e9], a
+ ld b, $1a
+ ld c, rRP % $100
+ ld d, b
+ ld e, $0
+ call Func_1c32
+ ld d, b
+ call Func_1c2b
+ ld d, b
+ call Func_1c32
+ ld d, b
+ call Func_1c2b
+ ld d, b
+ call Func_1c32
+ ld d, e
+ call Func_1c23
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ ld d, e
+ call Func_1c1b
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ ld d, e
+ call Func_1c23
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ ld d, e
+ call Func_1c1b
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ ld d, $1a
+ call Func_1c32
+ ld a, $0
+ ld [wd8ea], a
+ ret
+
+Func_1cef:
+ xor a
+ ld [rRP], a
+ ld a, $ff
+ ld [wd8ea], a
+ ret
+
+Func_1cf8: ; 0x1cf8
+ xor a
+ ld [wd8e4], a
+ ld [wd8e5], a
+ push hl
+ push bc
+ ld hl, wd8e6
+ ld a, $5a
+ ld [hli], a
+ ld [hl], b
+ dec hl
+ ld b, $2
+ ld d, $1e
+ call Func_1c32
+ call Func_1d44
+ pop bc
+ pop hl
+ call Func_1ed3
+ call Func_1d44
+ ld a, [wd8e4]
+ ld [wd8e6], a
+ ld a, [wd8e5]
+ ld [wd8e7], a
+ ld hl, wd8e6
+ ld b, $2
+ call Func_1d44
+ ld hl, wd8ea
+ ld b, $1
+ call Func_1e3b
+ ld a, [wd8e6]
+ ld [wd8e4], a
+ ld a, [wd8e7]
+ ld [wd8e5], a
+ ret
+
+Func_1d44: ; 0x1d44
+ ld a, [wd8ea]
+ cp $0
+ ret nz
+ ld c, rRP % $100
+ ld d, $16
+ call Func_1c2b
+ ld d, $16
+ call Func_1c32
+ ld a, b
+ cpl
+ ld b, a
+.asm_1d59
+ inc b
+ jr z, .asm_1dae
+ ld a, $8
+ ld [wd8e3], a
+ ld a, [hli]
+ ld e, a
+ ld a, [wd8e4]
+ add e
+ ld [wd8e4], a
+ jr nc, .asm_1d75
+ ld a, [wd8e5]
+ inc a
+ ld [wd8e5], a
+ jr .asm_1d78
+
+.asm_1d75
+ call Func_1ed3
+.asm_1d78
+ ld a, e
+ rlca
+ ld e, a
+ jr nc, .asm_1d8d
+ ld a, [wd8eb]
+ ld d, a
+ call Func_1c2b
+ ld a, [wd8ec]
+ ld d, a
+ call Func_1c32
+ jr .asm_1d9b
+
+.asm_1d8d
+ ld a, [wd8ed]
+ ld d, a
+ call Func_1c2b
+ ld a, [wd8ee]
+ ld d, a
+ call Func_1c32
+.asm_1d9b
+ ld a, [wd8e3]
+ dec a
+ ld [wd8e3], a
+ jr z, .asm_1dac
+ call Func_1ed4
+ call Func_1ed4
+ jr .asm_1d78
+
+.asm_1dac
+ jr .asm_1d59
+
+.asm_1dae
+ call Func_1ed3
+ call Func_1ed3
+ call Func_1ed4
+ ld d, $16
+ call Func_1c2b
+ ld d, $16
+ call Func_1c32
+ ret
+
+Func_1dc2: ; 0x1dc2
+ ld a, $2
+ ld [wd8ea], a
+ ret
+
+Func_1dc8:
+ ld a, [wd8ea]
+ or $1
+ ld [wd8ea], a
+ ret
+
+Func_1dd1: ; 0x1dd1
+ ld a, [wd8ea]
+ or $4
+ ld [wd8ea], a
+ ret
+
+Func_1dda: ; 0x1dda
+ xor a
+ ld [wd8e4], a
+ ld [wd8e5], a
+ push hl
+ ld hl, wd8e6
+ ld b, $2
+ call Func_1e3b
+ ld a, [wd8e7]
+ ld [wd8e8], a
+ ld b, a
+ pop hl
+ ld a, [wd8e6]
+ cp $5a
+ jp nz, Func_1dd1
+ call Func_1e3b
+ ld a, [wd8e4]
+ ld d, a
+ ld a, [wd8e5]
+ ld e, a
+ push de
+ ld hl, wd8e6
+ ld b, $2
+ call Func_1e3b
+ pop de
+ ld hl, wd8e6
+ ld a, [hli]
+ xor d
+ ld b, a
+ ld a, [hl]
+ xor e
+ or b
+ jr z, .asm_1e22
+ ld a, [wd8ea]
+ or $1
+ ld [wd8ea], a
+.asm_1e22
+ push de
+ ld hl, wd8ea
+ ld b, $1
+ call Func_1d44
+ pop de
+ ld a, d
+ ld [wd8e4], a
+ ld a, e
+ ld [wd8e5], a
+ ld a, [wd8e8]
+ cp $82
+ ret z
+ ret
+
+Func_1e3b: ; 0x1e3b
+ ld a, [wd8ea]
+ cp $0
+ ret nz
+ ld c, rRP % $100
+ ld d, $0
+ call Func_1c23
+ ld a, d
+ or a
+ jp z, Func_1dc2
+ ld d, $0
+ call Func_1c1b
+ ld a, d
+ or a
+ jp z, Func_1dc2
+ ld d, $0
+ call Func_1c23
+ ld a, d
+ or a
+ jp z, Func_1dc2
+ call Func_1ed4
+ call Func_1ed4
+ push af
+ pop af
+ ld a, b
+ cpl
+ ld b, a
+.asm_1e6c
+ inc b
+ jr z, .asm_1eb9
+ ld a, $8
+ ld [wd8e3], a
+.asm_1e74
+ ld d, $0
+ call Func_1c1b
+ call Func_1c23
+ ld a, [wd8ef]
+ cp d
+ jr nc, .asm_1e88
+ ld a, e
+ set 0, a
+ ld e, a
+ jr .asm_1e8c
+
+.asm_1e88
+ ld a, e
+ res 0, a
+ ld e, a
+.asm_1e8c
+ ld a, [wd8e3]
+ dec a
+ ld [wd8e3], a
+ jr z, .asm_1ea0
+ ld a, e
+ rlca
+ ld e, a
+ call Func_1ed4
+ call Func_1ed4
+ jr .asm_1e74
+
+.asm_1ea0
+ ld a, e
+ ld [hli], a
+ ld a, [wd8e4]
+ add e
+ ld [wd8e4], a
+ jr nc, .asm_1eb4
+ ld a, [wd8e5]
+ inc a
+ ld [wd8e5], a
+ jr .asm_1eb7
+
+.asm_1eb4
+ call Func_1ed3
+.asm_1eb7
+ jr .asm_1e6c
+
+.asm_1eb9
+ ld d, $0
+ call Func_1c1b
+ ld a, d
+ and a
+ jp z, Func_1dc2
+ ld d, $11
+ call Func_1c32
+ ret
+
+Func_1ec9:
+ ld b, $00
+ jp Func_1cf8
+
+Func_1ece:
+ ld b, $00
+ jp Func_1dda
+
+Func_1ed3: ; 0x1ed3
+ ret
+
+Func_1ed4: ; 0x1ed4
+ jr z, .asm_1ed6
+.asm_1ed6
+ jr nz, .asm_1ed8
+.asm_1ed8
+ ret
diff --git a/home/joypad.asm b/home/joypad.asm
new file mode 100644
index 0000000..ff9e6dc
--- /dev/null
+++ b/home/joypad.asm
@@ -0,0 +1,131 @@
+
+ReadJoypad: ; 0xab8
+; Reads the current state of the joypad and saves the state into
+; some registers the game uses during gameplay. It remembers the joypad state
+; from the current frame, previous frame, and two frames ago.
+ ld a, $20
+ ld [rJOYP], a
+ ld a, [rJOYP]
+ ld a, [rJOYP]
+ and $f
+ swap a
+ ld b, a
+ ld a, $30
+ ld [rJOYP], a
+ ld a, $10
+ ld [rJOYP], a
+ ld a, [rJOYP]
+ ld a, [rJOYP]
+ ld a, [rJOYP]
+ ld a, [rJOYP]
+ ld a, [rJOYP]
+ ld a, [rJOYP]
+ and $f
+ or b
+ cpl ; a contains currently-pressed buttons
+ ld [hJoypadState], a
+ ld a, $30
+ ld [rJOYP], a
+ ld a, [hJoypadState]
+ ld hl, hPreviousJoypadState
+ xor [hl] ; a contains buttons that are different from previous frame
+ push af
+ ld hl, hJoypadState
+ and [hl] ; a contains newly-pressed buttons compared to last frame
+ ld [hNewlyPressedButtons], a
+ ld [hPressedButtons], a
+ pop af
+ ld hl, hPreviousJoypadState
+ and [hl] ; a contains newly-pressed buttons compared to two frames ago
+ ld [hPrevPreviousJoypadState], a
+ ld a, [hJoypadState]
+ and a
+ jr z, .asm_b15
+ ld hl, hPreviousJoypadState
+ cp [hl]
+ jr nz, .asm_b15
+ ; button(s) is pressed, and they're identical to the buttons pressed last frame.
+ ; this code is related to holding down a button for an extended period of time.
+ ld hl, hJoyRepeatDelay
+ dec [hl]
+ jr nz, .asm_b1a
+ ld a, [hJoypadState]
+ ld [hPressedButtons], a
+ ld a, [wd807]
+ ld [hJoyRepeatDelay], a
+ jr .asm_b1a
+
+.asm_b15
+ ld a, [wd806]
+ ld [hJoyRepeatDelay], a
+.asm_b1a
+ ld a, [hJoypadState]
+ ld [hPreviousJoypadState], a
+ ld hl, wJoypadStatesPersistent
+ ld a, [hJoypadState]
+ or [hl]
+ ld [hli], a
+ ld a, [hNewlyPressedButtons]
+ or [hl]
+ ld [hli], a
+ ld a, [hPressedButtons]
+ or [hl]
+ ld [hli], a
+ ret
+
+ClearPersistentJoypadStates: ; 0xb2e
+ ld hl, wJoypadStatesPersistent
+ xor a
+ ld [hli], a
+ ld [hli], a
+ ld [hl], a
+ ret
+
+IsKeyPressed2: ; 0xb36
+ ld a, [hJoypadState]
+ and [hl]
+ jr z, .asm_b3e
+ cp [hl]
+ jr z, .asm_b48
+.asm_b3e
+ inc hl
+ ld a, [hJoypadState]
+ and [hl]
+ ret z
+ cp [hl]
+ jr z, .asm_b48
+ xor a
+ ret
+
+.asm_b48
+ ld a, $1
+ and a
+ ret
+
+IsKeyPressed: ; 0xb4c
+; Checks if a key for the specified key config is pressed.
+; input: hl = pointer to key config byte pair (e.g. wKeyConfigLeftFlipper)
+; output: zero flag is set if a corresponding key is pressed
+; zero flag is reset if no corresponding key is pressed
+ ld a, [hJoypadState]
+ and [hl]
+ jr z, .asm_b58
+ cp [hl]
+ jr nz, .asm_b58
+ ld a, [hNewlyPressedButtons]
+ and [hl]
+ ret nz
+.asm_b58
+ inc hl
+ ld a, [hJoypadState]
+ and [hl]
+ ret z
+ cp [hl]
+ jr nz, .asm_b64
+ ld a, [hNewlyPressedButtons]
+ and [hl]
+ ret
+
+.asm_b64
+ xor a
+ ret
diff --git a/home/random.asm b/home/random.asm
new file mode 100644
index 0000000..84e4571
--- /dev/null
+++ b/home/random.asm
@@ -0,0 +1,129 @@
+GenRandom: ; 0x959
+ push bc
+ push de
+ push hl
+ ld a, [wd811]
+ ld c, a
+ ld b, $0
+ inc a
+ cp 54 + 1
+ jr nz, .asm_96e
+ call Func_9fa
+ xor a
+ ld bc, $0000
+.asm_96e
+ ld [wd811], a
+ ld hl, wd812
+ add hl, bc
+ ld a, [hl]
+ pop hl
+ pop de
+ pop bc
+ ret
+
+Func_97a: ; 0x97a
+ ld a, [wd810]
+ ld d, a
+ ld a, $0
+ ld a, [sRNGMod]
+.asm_983
+ cp d
+ jr c, .asm_989
+ sub d
+ jr .asm_983
+
+.asm_989
+ ld [wd80f], a
+ ld [wd848], a
+ ld e, $1
+ ld hl, Data_9c4
+ ld a, $36
+.asm_996
+ push af
+ ld c, [hl]
+ inc hl
+ ld b, $0
+ push hl
+ ld hl, wd812
+ add hl, bc
+ ld [hl], e
+ ld a, [wd80f]
+ sub e
+ jr nc, .asm_9a8
+ add d
+.asm_9a8
+ ld e, a
+ ld a, [hl]
+ ld [wd80f], a
+ pop hl
+ pop af
+ dec a
+ jr nz, .asm_996
+ call Func_9fa
+ call Func_9fa
+ call Func_9fa
+ ld a, $0
+ call GenRandom
+ ld [sRNGMod], a
+ ret
+
+Data_9c4:
+ db $14, $29, $07, $1c, $31, $0f, $24, $02, $17
+ db $2c, $0a, $1f, $34, $12, $27, $05, $1a, $2f
+ db $0d, $22, $00, $15, $2a, $08, $1d, $32, $10
+ db $25, $03, $18, $2d, $0b, $20, $35, $13, $28
+ db $06, $1b, $30, $0e, $23, $01, $16, $2b, $09
+ db $1e, $33, $11, $26, $04, $19, $2e, $0c, $21
+
+Func_9fa: ; 0x9fa
+ ld a, [wd810]
+ ld d, a
+ ld bc, wd812
+ ld hl, wd812 + $1f
+ ld e, $18
+.asm_a06
+ ld a, [bc]
+ sub [hl]
+ jr nc, .asm_a0b
+ add d
+.asm_a0b
+ ld [bc], a
+ dec e
+ jr nz, .asm_a06
+ ld bc, wd812 + $18
+ ld hl, wd812
+ ld e, $1f
+.asm_a17
+ ld a, [bc]
+ sub [hl]
+ jr nc, .asm_a1c
+ add d
+.asm_a1c
+ ld [bc], a
+ dec e
+ jr nz, .asm_a17
+ ret
+
+Func_a21: ; 0xa21
+ push bc
+ push hl
+ ld c, a
+ ld b, $0
+ ld hl, Data_a38
+ add hl, bc
+ ld l, [hl]
+ call GenRandom
+ call Func_dd4
+ inc h
+ srl h
+ ld a, h
+ pop hl
+ pop bc
+ ret
+
+Data_a38:
+x = 0
+REPT 128
+ db x | ((x >> 7) & 1)
+x = x + 2
+ENDR
diff --git a/macros.asm b/macros.asm
index d737152..ab03801 100644
--- a/macros.asm
+++ b/macros.asm
@@ -2,6 +2,7 @@ INCLUDE "macros/sound.asm"
AdvanceFrame EQUS "$10"
JumpTable EQUS "$18"
+ReadHalfword EQUS "$20"
dex_text EQUS "db " ; Start beginning of pokedex description
dex_line EQUS "db $0d," ; Start new line in pokedex description
diff --git a/main.asm b/main.asm
index 9f32cfe..8bc7f82 100644
--- a/main.asm
+++ b/main.asm
@@ -17,35 +17,6 @@ INCLUDE "engine/pinball_game/stage_init/init_stages.asm"
INCLUDE "engine/pinball_game/ball_init/ball_init.asm"
INCLUDE "engine/pinball_game/load_stage_data/load_stage_data.asm"
INCLUDE "engine/pinball_game/draw_sprites/draw_sprites.asm"
-
-Func_84fd:
-; unused?
- ld a, [hGameBoyColorFlag]
- and a
- jr z, .not_cgb
- ld a, $1
- ld [rVBK], a
- xor a
- call .FillAttrsOrBGMap
- xor a
- ld [rVBK], a
-.not_cgb
- ld a, $81
- call .FillAttrsOrBGMap
- ld de, wBottomMessageBuffer + $47
- call Func_8524
- ret
-
-.FillAttrsOrBGMap: ; 8519 (2:4519)
- hlCoord 0, 0, vBGWin
- ld b, $20
-.loop
- ld [hli], a
- ld [hli], a
- dec b
- jr nz, .loop
- ret
-
INCLUDE "engine/pinball_game/score.asm"
INCLUDE "engine/pinball_game/timer.asm"
INCLUDE "engine/pinball_game/menu.asm"
@@ -113,61 +84,8 @@ INCLUDE "engine/pinball_game.asm"
INCLUDE "engine/pinball_game/ball_saver/ball_saver_20.asm"
INCLUDE "engine/pinball_game/ball_saver/ball_saver_catchem_mode.asm"
INCLUDE "engine/pinball_game/ball_loss/ball_loss.asm"
-
-Func_dc6d: ; 0xdc6d
- push de
- call FillBottomMessageBufferWithBlackTile
- call Func_30db
- ld hl, wScrollingText3
- pop de
- call LoadScrollingText
- ret
-
-Func_dc7c: ; 0xdc7c
- ld hl, wBottomMessageBuffer + $40
- ld a, $83
- ld [hli], a
- ld a, $81
- ld [hli], a
- ld a, $81
- ld [hl], a
- ld a, [wNumPartyMons]
- call ConvertHexByteToDecWord
- ld hl, wBottomMessageBuffer + $41
- ld c, $1
- ld a, d
- call .asm_dca0
- ld a, e
- swap a
- call .asm_dca0
- ld a, e
- ld c, $0
-.asm_dca0
- and $f
- jr nz, .asm_dca7
- ld a, c
- and a
- ret nz
-.asm_dca7
- ld c, $0
- add $86
- ld [hli], a
- ret
-
-Data_dcad:
-; BCD powers of 2
- db $01, $02, $04, $08, $16, $32, $64
-
-Func_dcb4: ; 0xdcb4
- ld a, [wPikachuSaverCharge]
- cp MAX_PIKACHU_SAVER_CHARGE
- ld a, $81
- jr nz, .asm_dcbf
- ld a, $84
-.asm_dcbf
- ld [wBottomMessageBuffer + $46], a
- ret
-
+INCLUDE "engine/pinball_game/draw_num_party_mons_icon.asm"
+INCLUDE "engine/pinball_game/draw_pikachu_saver_icon.asm"
INCLUDE "engine/pinball_game/ball_gfx.asm"
INCLUDE "engine/pinball_game/ball_loss/ball_loss_red_field.asm"
INCLUDE "engine/pinball_game/ball_loss/ball_loss_blue_field.asm"
@@ -211,923 +129,7 @@ CallTable_10027: ; 0x10027
padded_dab Func_202bc ; STAGE_BLUE_FIELD_BOTTOM
INCLUDE "engine/pinball_game/catchem_mode.asm"
-
-Func_10a95: ; 0x19a95
- ld a, [wCurrentStage]
- call CallInFollowingTable
-PointerTable_10a9b: ; 0x10a9b
- padded_dab Func_20581 ; STAGE_RED_FIELD_TOP
- padded_dab Func_20581 ; STAGE_RED_FIELD_BOTTOM
- padded_dab Func_20581
- padded_dab Func_20581
- padded_dab Func_20bae ; STAGE_BLUE_FIELD_TOP
- padded_dab Func_20bae ; STAGE_BLUE_FIELD_BOTTOM
-
-StartEvolutionMode: ; 0x10ab3
- ld a, [wInSpecialMode]
- and a
- ret nz
- ld a, [wCurrentStage]
- rst JumpTable ; calls JumpToFuncInTable
-StartEvolutionMode_CallTable: ; 0x10abc
- dw StartEvolutionMode_RedField ; STAGE_RED_FIELD_TOP
- dw StartEvolutionMode_RedField ; STAGE_RED_FIELD_BOTTOM
- dw StartEvolutionMode_UnusedField
- dw StartEvolutionMode_UnusedField
- dw StartEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
- dw StartEvolutionMode_BlueField ; STAGE_BLUE_FIELD_BOTTOM
-
-ConcludeEvolutionMode: ; 0x10ac8
- xor a
- ld [wd5ca], a
- call FillBottomMessageBufferWithBlackTile
- xor a
- ld [wInSpecialMode], a
- ld [wWildMonIsHittable], a
- ld [wd5b6], a
- ld [wNumMonHits], a
- ld [wd551], a
- ld [wd554], a
- call ClearWildMonCollisionMask
- callba StopTimer
- ld a, [wCurrentStage]
- rst JumpTable ; calls JumpToFuncInTable
-ConcludeEvolutionMode_CallTable: ; 0x10af3
- dw ConcludeEvolutionMode_RedField ; STAGE_RED_FIELD_TOP
- dw ConcludeEvolutionMode_RedField ; STAGE_RED_FIELD_BOTTOM
- dw DoNothing_11060
- dw DoNothing_11060
- dw ConcludeEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
- dw ConcludeEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
-
-Func_10aff: ; 0x10aff
- ld a, [wCurrentStage]
- res 0, a
- ld c, a
- ld b, $0
- srl c
- sla a
- sla a
- sla a
- sub c
- ld c, a
- ld hl, VideoData_10b2a
- add hl, bc
- ld a, [hli]
- ld c, a
- ld a, [hli]
- ld b, a
- ld a, [hli]
- push af
- push bc
- ld a, [hli]
- ld e, a
- ld a, [hli]
- ld d, a
- ld a, [hli]
- ld c, a
- ld a, [hli]
- ld b, a
- pop hl
- pop af
- call LoadVRAMData
- ret
-
-VideoData_10b2a: ; 0x10b2a
- dab StageRedFieldTopGfx3
- dw $8900
- dw $E0
- dab StageRedFieldTopGfx3
- dw $8900
- dw $E0
- dab StageRedFieldTopGfx3
- dw $8900
- dw $E0
-
-Func_10b3f: ; 0x10b3f
- call FillBottomMessageBufferWithBlackTile
- call Func_30db
- ld hl, wScrollingText1
- ld a, [wCurrentEvolutionType]
- cp EVO_EXPERIENCE
- ld de, StartTrainingText
- jr z, .asm_10b55
- ld de, FindItemsText
-.asm_10b55
- call LoadScrollingText
- ret
-
-InitEvolutionSelectionMenu: ; 0x10b59
-; Initializes the list menu, which the player uses to select which pokemon to evolve.
- xor a
- ld [wDrawBottomMessageBox], a
- ld hl, wBottomMessageText
- ld a, $81
- ld b, $30
-.clearLoop
- ld [hli], a ; load spaces into bottom text. repeat 192 times
- ld [hli], a
- ld [hli], a
- ld [hli], a
- dec b
- jr nz, .clearLoop
- ld hl, wPartyMons
- call LoadMonNamesIntoEvolutionSelectionList
- ld a, BANK(InGameMenuSymbolsGfx)
- ld hl, InGameMenuSymbolsGfx + $50
- ld de, vTilesSH tile $08
- ld bc, $0030
- call LoadVRAMData
- ld a, $0
- ld hl, wBottomMessageText
- deCoord 0, 0, vBGWin
- ld bc, $00c0
- call LoadVRAMData
- ret
-
-LoadMonNamesIntoEvolutionSelectionList: ; 0x10b8e
-; Loads 6 pokemon names into the list that allows the player to select which pokemon to evolve.
-; Input: hl = pointer to a list of pokemon ids. (an offset of wPartyMons)
- ld a, [wNumPartyMons]
- ld c, $0
- ld b, a
-.loop
- ld a, [hli]
- call LoadMonNameIntoEvolutionSelectionList
- inc c
- ld a, c
- cp $6
- jr z, .done
- dec b
- jr nz, .loop
-.done
- ret
-
-LoadMonNameIntoEvolutionSelectionList: ; 0x10ba2
-; Loads a single pokemon name into the list of pokemon to evolve.
-; Input: c = index of the list
-; a = pokemon id
- push bc
- push hl
- swap c ;c* 32, does wird things if c starts >15
- sla c
- ld b, $0
- ld hl, wBottomMessageText
- add hl, bc ;goes down text as many times as new c
- ld d, h
- ld e, l
- ld c, a ;c now equals paerty mon, HL stored in de
- ld b, $0
- sla c
- rl b
- sla c
- rl b
- sla c
- rl b
- sla c
- rl b ;multiplies party mon by 16, then jumps to correct name in the table
- ld hl, PokemonNames ;names are 16 chars long
- add hl, bc
- ld a, $81
- ld [de], a
- inc de
- ld a, $81
- ld [de], a
- inc de
- ld a, $81
- ld [de], a
- inc de
- ld a, $81
- ld [de], a ; loaded 4 spaces into de
- inc de
- call LoadMonNameIntoBottomMessageBufferList
-.loadBlankCharacterLoop
- ld a, e
- and $1f
- cp $14
- jr nc, .done
- ld a, $81
- ld [de], a
- inc de
- jr .loadBlankCharacterLoop
-
-.done
- pop hl
- pop bc
- ret
-
-SelectPokemonToEvolveMenu: ; 0x10bea
-; Drivers the menu that allows the player to select a pokemon to evolve.
- xor a
- ld [wCurSelectedPartyMon], a
- ld [wCurSelectedPartyMonScrollOffset], a
- ld [wPartySelectionCursorCounter], a
-.loop
- call MoveEvolutionSelectionCursor
- call ClearPersistentJoypadStates
- call UpdateEvolutionSelectionList
- rst AdvanceFrame
- ld a, [wNewlyPressedButtonsPersistent]
- bit BIT_A_BUTTON, a
- jr z, .loop
- lb de, $00, $01
- call PlaySoundEffect
- ret
-
-MoveEvolutionSelectionCursor: ; 0x10c0c
- ld a, [wPressedButtonsPersistent]
- ld b, a
- ld a, [wNumPartyMons]
- ld c, a
- ld a, [wCurSelectedPartyMon]
- bit BIT_D_UP, b
- jr z, .didntPressUp
- and a
- ret z
- ; move the cursor up
- dec a
- ld [wCurSelectedPartyMon], a
- lb de, $00, $03
- call PlaySoundEffect
- ret
-
-.didntPressUp
- bit BIT_D_DOWN, b
- ret z
- inc a
- cp c
- ret z
- ; move the cursor down
- ld [wCurSelectedPartyMon], a
- lb de, $00, $03
- call PlaySoundEffect
- ret
-
-UpdateEvolutionSelectionList: ; 0x10c38
- ld a, [wCurSelectedPartyMon]
- ld hl, wCurSelectedPartyMonScrollOffset
- sub [hl]
- jr nc, .asm_10c45
- dec [hl]
- xor a
- jr .asm_10c4c
-
-.asm_10c45
- cp $6
- jr c, .asm_10c4c
- inc [hl]
- ld a, $5
-.asm_10c4c
- ld c, a
- push bc
- ld a, [hl]
- ld c, a
- ld b, $0
- ld hl, wPartyMons
- add hl, bc
- call LoadMonNamesIntoEvolutionSelectionList
- ld a, [hJoypadState]
- and a
- ld a, [wPartySelectionCursorCounter]
- jr z, .asm_10c62
- xor a
-.asm_10c62
- inc a
- ld [wPartySelectionCursorCounter], a
- bit 3, a
- pop bc
- jr nz, .asm_10c78
- swap c
- sla c
- ld b, $0
- ld hl, wBottomMessageText + $03
- add hl, bc
- ld a, $88
- ld [hl], a
-.asm_10c78
- ld a, [wCurSelectedPartyMonScrollOffset]
- and a
- jr z, .asm_10c83
- ld a, $8a
- ld [wBottomMessageText + $11], a
-.asm_10c83
- ld a, [wCurSelectedPartyMonScrollOffset]
- add $7
- jr z, .asm_10c96
- ld c, a
- ld a, [wNumPartyMons]
- cp c
- jr c, .asm_10c96
- ld a, $89
- ld [wBottomMessageText + $b1], a
-.asm_10c96
- ld a, $0
- ld hl, wBottomMessageText
- deCoord 0, 0, vBGWin
- ld bc, $00c0
- call LoadVRAMData
- ret
-
-PlaceEvolutionInParty: ; 0x10ca5
- ld a, [wCurSelectedPartyMon]
- ld c, a
- ld b, $0
- ld hl, wPartyMons
- add hl, bc
- ld a, [wCurrentEvolutionMon]
- cp $ff
- ret z
- ld [hl], a
- ret
-
-SelectPokemonToEvolve: ; 0x10cb7
- call FillBottomMessageBufferWithBlackTile
- call InitEvolutionSelectionMenu
- ld a, $60
- ld [hWY], a
- dec a
- ld [hLYC], a
- ld a, $fd
- ld [hLCDCMask], a
- call SelectPokemonToEvolveMenu
- ld a, $86
- ld [hWY], a
- ld a, $83
- ld [hLYC], a
- ld [hLastLYC], a
- ld a, $ff
- ld [hLCDCMask], a
- ld a, [hGameBoyColorFlag]
- and a
- jr nz, .gameboyColor
- ld a, BANK(StageRedFieldTopStatusBarSymbolsGfx_GameBoy)
- ld hl, StageRedFieldTopStatusBarSymbolsGfx_GameBoy + $80
- ld de, vTilesSH tile $08
- ld bc, $0030
- call LoadVRAMData
- jr .asm_10cfc
-
-.gameboyColor
- ld a, BANK(StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor)
- ld hl, StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor + $80
- ld de, vTilesSH tile $08
- ld bc, $0030
- call LoadVRAMData
-.asm_10cfc
- call FillBottomMessageBufferWithBlackTile
- ld a, SPECIAL_MODE_CATCHEM
- ld [wDrawBottomMessageBox], a
- ld [wInSpecialMode], a
- ld [wSpecialMode], a
- xor a
- ld [wd54d], a
- ld a, [wCurSelectedPartyMon]
- ld c, a
- ld b, $0
- ld hl, wPartyMons
- add hl, bc
- ld a, [hl]
- ld [wCurrentCatchEmMon], a
- ret
-
-InitEvolutionModeForMon: ; 0x10d1d
- ld hl, wd586
- ld b, $18
-.asm_10d22
- ld a, $1
- ld [hli], a
- xor a
- ld [hli], a
- dec b
- jr nz, .asm_10d22
- ld a, [wCurrentCatchEmMon]
- ld c, a
- ld b, $0
- ld hl, Data_1298b
- add hl, bc
- ld a, [hl]
- add $2
- ld [wd555], a
- xor a
- ld hl, wd566
- ld b, $13
-.asm_10d40
- ld [hli], a
- dec b
- jr nz, .asm_10d40
- ld a, [wCurrentCatchEmMon]
- ld c, a
- ld b, $0
- sla c
- rl b
- ld hl, CatchEmTimerData
- add hl, bc
- ld a, [hli]
- ld c, a
- ld a, [hl]
- ld b, a
- callba StartTimer
- ld a, [wCurrentCatchEmMon]
- ld c, a
- ld b, $0
- sla c ; multiply mon id by 6
- rl b
- add c
- ld c, a
- jr nc, .noCarry
- inc b
-.noCarry
- sla c
- rl b
- ld hl, MonEvolutions
- add hl, bc
- push hl
- ld bc, $03ff
-.countMonEvolutionsLoop
- ld a, [hli]
- and a
- jr z, .noEvolution
- inc c
-.noEvolution
- inc hl
- dec b
- jr nz, .countMonEvolutionsLoop
- ld a, c
- cp $ff
- jr nz, .asm_10d8a
- xor a
-.asm_10d8a
- call Func_a21
- sla a
- ld c, a
- pop hl
- add hl, bc ; hl points to one of three entries in mon's evolution data
- ld a, [hli] ; a = mon id of evolution
- dec a
- ld [wCurrentEvolutionMon], a
- ld a, [hl] ; a = evoluion type id
- ld [wCurrentEvolutionType], a
- xor a
- ld [wd554], a
- ld [wd556], a
- ld [wd557], a
- ld hl, wd55c
- ld a, $1
- ld b, $3
-.asm_10dac
- ld [hli], a
- dec b
- jr nz, .asm_10dac
- xor a
- ld b, $7
-.asm_10db3
- ld [hli], a
- dec b
- jr nz, .asm_10db3
- ld de, wd55c
- ld a, [wd555]
- ld c, a
- inc a
- ld b, a
-.asm_10dc0
- push bc
- ld a, c
- call Func_a21
- ld c, a
- ld b, $0
- ld hl, wd55c
- add hl, bc
- ld c, [hl]
- ld a, [de]
- ld [hl], a
- ld a, c
- ld [de], a
- pop bc
- inc de
- dec b
- jr nz, .asm_10dc0
- callba InitBallSaverForCatchEmMode
- call Func_10b3f
- call Func_3579
- ld a, [wCurrentStage]
- bit 0, a
- jr z, .asm_10e09
- ld a, BANK(StageRedFieldBottomBaseGameBoyColorGfx)
- ld hl, StageRedFieldBottomBaseGameBoyColorGfx + $300
- ld de, vTilesSH tile $2e
- ld bc, $0020
- call LoadOrCopyVRAMData
- ld a, $0
- ld hl, CatchBarTiles
- deCoord 6, 8, vBGMap
- ld bc, (CatchBarTilesEnd - CatchBarTiles)
- call LoadOrCopyVRAMData
-.asm_10e09
- ret
-
-Func_10e0a: ; 0x10e0a
- ld a, [wCurrentEvolutionMon]
- cp $ff
- jp z, Func_10e8b
- ld c, a
- ld b, $0
- sla c
- rl b
- sla c
- rl b
- sla c
- rl b
- sla c
- rl b
- ld hl, PokemonNames + 1
- add hl, bc
- ld de, ItEvolvedIntoAnText ; "It evolved into an"
- ld bc, Data_2b34
- ld a, [hl]
- ; check if mon's name starts with a vowel, so it can print "an", instead of "a"
- cp "A"
- jr z, .nameStartsWithVowel
- cp "I"
- jr z, .nameStartsWithVowel
- cp "U"
- jr z, .nameStartsWithVowel
- cp "E"
- jr z, .nameStartsWithVowel
- cp "O"
- jr z, .nameStartsWithVowel
- ld de, ItEvolvedIntoAText ; "It evolved into a"
- ld bc, Data_2b1c
-.nameStartsWithVowel
- push hl
- push bc
- push de
- call FillBottomMessageBufferWithBlackTile
- call Func_30db
- ld hl, wScrollingText1
- pop de
- call LoadScrollingText
- ld hl, wScrollingText2
- pop de
- call LoadScrollingText
- pop hl
- ld de, wBottomMessageText + $20
- ld b, $0
-.asm_10e67
- ld a, [hli]
- and a
- jr z, .asm_10e70
- ld [de], a
- inc de
- inc b
- jr .asm_10e67
-
-.asm_10e70
- ld a, $20
- ld [de], a
- inc de
- xor a
- ld [de], a
- ld a, [wScrollingText2ScrollStepsRemaining]
- add b
- ld [wScrollingText2ScrollStepsRemaining], a
- ld a, $14
- sub b
- srl a
- ld b, a
- ld a, [wScrollingText2StopOffset]
- add b
- ld [wScrollingText2StopOffset], a
- ret
-
-Func_10e8b: ; 0x10e8b
- ld bc, OneMillionPoints
- callba AddBigBCD6FromQueue
- ld bc, $0100
- ld de, $0000
- push bc
- push de
- call FillBottomMessageBufferWithBlackTile
- call Func_30db
- ld hl, wScrollingText2
- ld de, Data_2b6b
- call Func_32cc
- pop de
- pop bc
- ld hl, wScrollingText1
- ld de, EvolutionSpecialBonusText
- call LoadScrollingText
- ret
-
-StartEvolutionMode_RedField: ; 0x10ebb
- ld a, [wNumPartyMons]
- and a
- ret z
- call SelectPokemonToEvolve
- call InitEvolutionModeForMon
- ld a, [wd555]
- sub $2
- ld c, a
- sla c
- ld hl, IndicatorStatesPointerTable_10f3b
- add hl, bc
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, wIndicatorStates
- ld b, $13
-.loop
- ld a, [hli]
- ld [de], a
- inc de
- dec b
- jr nz, .loop
- xor a
- ld [wLeftAlleyCount], a
- call Func_107b0
- ld a, $2
- ld [wd7ad], a
- ld de, $0002
- call PlaySong
- call SetPokemonSeenFlag
- ld a, [wCurrentStage]
- bit 0, a
- jr nz, .asm_10f0b
- ld a, BANK(EvolutionTrinketsGfx)
- ld hl, EvolutionTrinketsGfx
- ld de, vTilesSH tile $10
- ld bc, $00e0
- call LoadOrCopyVRAMData
- ret
-
-.asm_10f0b
- ld a, BANK(EvolutionTrinketsGfx)
- ld hl, EvolutionTrinketsGfx
- ld de, vTilesOB tile $20
- ld bc, $00e0
- call LoadOrCopyVRAMData
- callba Func_14135
- callba Func_10184
- ld a, [hGameBoyColorFlag]
- and a
- callba nz, Func_102bc
- ret
-
-IndicatorStatesPointerTable_10f3b: ; 0x10f3b
- dw IndicatorStates_10f4b
- dw IndicatorStates_10f5e
- dw IndicatorStates_10f71
- dw IndicatorStates_10f84
- dw IndicatorStates_10f97
- dw IndicatorStates_10faa
- dw IndicatorStates_10fbd
- dw IndicatorStates_10fd0
-
-IndicatorStates_10f4b: ; 0x10f4b
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $00, $00, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_10f5e: ; 0x10f5e
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $00, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_10f71: ; 0x10f71
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_10f84: ; 0x10f84
- db $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_10f97: ; 0x10f97
- db $00, $00, $00, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_10faa: ; 0x10faa
- db $00, $00, $80, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_10fbd: ; 0x10fbd
- db $00, $00, $80, $80, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_10fd0: ; 0x10fd0
- db $00, $00, $80, $80, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-ConcludeEvolutionMode_RedField: ; 0x10fe3
- call ResetIndicatorStates
- call Func_107c2
- call Func_107c8
- call Func_107e9
- ld a, [wCurrentStage]
- bit 0, a
- jp z, Func_10aff
- callba Func_14135
- callba Func_16425
- callba LoadMapBillboardTileData
- ld a, BANK(StageSharedBonusSlotGlowGfx)
- ld hl, StageSharedBonusSlotGlowGfx + $60
- ld de, vTilesOB tile $20
- ld bc, $00e0
- call LoadVRAMData
- ld a, [hGameBoyColorFlag]
- and a
- jr z, .asm_11036
- ld a, BANK(StageRedFieldBottomOBJPalette7)
- ld hl, StageRedFieldBottomOBJPalette7
- ld de, $0078
- ld bc, $0008
- call Func_7dc
-.asm_11036
- ld hl, BlankSaverSpaceTileDataRedField
- ld a, BANK(BlankSaverSpaceTileDataRedField)
- call Func_10aa
- ld a, [wPreviousNumPokeballs]
- callba Func_174d4
- ld hl, CaughtPokeballTileDataPointers
- ld a, BANK(CaughtPokeballTileDataPointers)
- call Func_10aa
- ret
-
-StartEvolutionMode_UnusedField: ; 0x11054
- ld a, [wNumPartyMons]
- and a
- ret z
- call SelectPokemonToEvolve
- call InitEvolutionModeForMon
- ret
-
-DoNothing_11060: ; 0x11060
- ret
-
-StartEvolutionMode_BlueField: ; 0x11061
- ld a, [wNumPartyMons]
- and a
- ret z
- call SelectPokemonToEvolve
- call InitEvolutionModeForMon
- ld a, $1
- ld [wd643], a
- ld a, [wd555]
- sub $2
- ld c, a
- sla c
- ld hl, IndicatorStatesPointerTable_110ed
- add hl, bc
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, wIndicatorStates
- ld b, $13
-.asm_11085
- ld a, [hli]
- ld [de], a
- inc de
- dec b
- jr nz, .asm_11085
- xor a
- ld [wLeftAlleyCount], a
- callba Func_1f2ed
- ld a, $2
- ld [wd7ad], a
- ld de, $0002
- call PlaySong
- call SetPokemonSeenFlag
- ld a, [wCurrentStage]
- bit 0, a
- jr nz, .asm_110bd
- ld a, BANK(EvolutionTrinketsGfx)
- ld hl, EvolutionTrinketsGfx
- ld de, vTilesOB tile $60
- ld bc, $00e0
- call LoadOrCopyVRAMData
- ret
-
-.asm_110bd
- ld a, BANK(EvolutionTrinketsGfx)
- ld hl, EvolutionTrinketsGfx
- ld de, vTilesOB tile $20
- ld bc, $00e0
- call LoadOrCopyVRAMData
- callba Func_1c2cb
- callba Func_10184
- ld a, [hGameBoyColorFlag]
- and a
- callba nz, Func_102bc
- ret
-
-IndicatorStatesPointerTable_110ed: ; 0x110ed
- dw IndicatorStates_110fd
- dw IndicatorStates_11110
- dw IndicatorStates_11123
- dw IndicatorStates_11136
- dw IndicatorStates_11149
- dw IndicatorStates_1115c
- dw IndicatorStates_1116f
- dw IndicatorStates_11182
-
-IndicatorStates_110fd: ; 0x110fd
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $00, $00, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_11110: ; 0x11110
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $00, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_11123: ; 0x11123
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_11136: ; 0x11136
- db $00, $00, $80, $00, $00, $00, $00, $00, $01, $01, $00, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_11149: ; 0x11149
- db $00, $00, $80, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_1115c: ; 0x1115c
- db $00, $00, $80, $80, $00, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_1116f: ; 0x1116f
- db $80, $00, $80, $80, $00, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-IndicatorStates_11182: ; 0x11182
- db $80, $00, $80, $80, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-
-ConcludeEvolutionMode_BlueField: ; 0x11195
- xor a
- ld [wd643], a
- call ResetIndicatorStates
- call Func_107c2
- callba Func_1f2ff
- ld a, [wCurrentStage]
- bit 0, a
- jp z, Func_1120e
- callba Func_1c2cb
- callba Func_1e8f6
- callba LoadMapBillboardTileData
- ld a, Bank(StageSharedBonusSlotGlowGfx)
- ld hl, StageSharedBonusSlotGlowGfx + $60
- ld de, vTilesOB tile $20
- ld bc, $00e0
- call LoadVRAMData
- ld a, [hGameBoyColorFlag]
- and a
- jr z, .asm_111f0
- ld a, BANK(StageBlueFieldBottomOBJPalette7)
- ld hl, StageBlueFieldBottomOBJPalette7
- ld de, $0078
- ld bc, $0008
- call Func_7dc
-.asm_111f0
- ld hl, BlankSaverSpaceTileDataBlueField
- ld a, BANK(BlankSaverSpaceTileDataBlueField)
- call Func_10aa
- ld a, [wPreviousNumPokeballs]
- callba Func_174d4
- ld hl, Data_10a88
- ld a, BANK(Data_10a88)
- call Func_10aa
- ret
-
-Func_1120e: ; 0x1120e
- ld a, [wCurrentStage]
- sub $4
- res 0, a
- ld c, a
- ld b, $0
- srl c
- sla a
- sla a
- sla a
- sub c
- ld c, a
- ld hl, VRAMData_1123b
- add hl, bc
- ld a, [hli]
- ld c, a
- ld a, [hli]
- ld b, a
- ld a, [hli]
- push af
- push bc
- ld a, [hli]
- ld e, a
- ld a, [hli]
- ld d, a
- ld a, [hli]
- ld c, a
- ld a, [hli]
- ld b, a
- pop hl
- pop af
- call LoadVRAMData
- ret
-
-VRAMData_1123b: ; 0x1123b
- dab StageBlueFieldTopGfx3
- dw $8600, $E0
- dab StageBlueFieldTopGfx3
- dw $8600, $E0
- dab StageBlueFieldTopGfx3
- dw $8600, $E0
- dab StageBlueFieldTopGfx3
- dw $8600, $E0
- dab StageBlueFieldTopGfx3
- dw $8600, $E0
- dab StageBlueFieldTopGfx3
- dw $8600, $E0
- dab StageBlueFieldTopGfx3
- dw $8600, $E0
-
+INCLUDE "engine/pinball_game/evolution_mode.asm"
INCLUDE "data/wild_mons.asm"
INCLUDE "data/evolution_line_starts.asm"
INCLUDE "data/evolution_lines.asm"
@@ -1457,736 +459,7 @@ INCLUDE "engine/pinball_game/stage_init/init_red_field.asm"
INCLUDE "engine/pinball_game/ball_init/ball_init_red_field.asm"
INCLUDE "engine/pinball_game/bonus_multiplier.asm"
INCLUDE "engine/pinball_game/extra_ball.asm"
-
-Func_301ce: ; 0x301ce
- ld a, [wCurrentStage]
- call CallInFollowingTable
-PointerTable_301d4: ; 0x301d4
- padded_dab Func_314ae ; STAGE_RED_FIELD_TOP
- padded_dab Func_314ae ; STAGE_RED_FIELD_BOTTOM
- padded_dab Func_314ae
- padded_dab Func_314ae
- padded_dab Func_3161b ; STAGE_BLUE_FIELD_TOP
- padded_dab Func_3161b ; STAGE_BLUE_FIELD_BOTTOM
-
-StartMapMoveMode: ; 0x301ec
- ld a, [wInSpecialMode]
- and a
- ret nz
- ld a, $1
- ld [wInSpecialMode], a
- ld a, SPECIAL_MODE_MAP_MOVE
- ld [wSpecialMode], a
- xor a
- ld [wd54d], a
- ld bc, $0030 ; 30 seconds
- callba StartTimer
- ld a, [wCurrentStage]
- bit 0, a
- jr z, .asm_3021b
- ld a, [wd55a]
- add $12
- call LoadBillboardTileData
-.asm_3021b
- ld a, [wCurrentStage]
- rst JumpTable ; calls JumpToFuncInTable
-CallTable_3021f: ; 0x3021f
- dw Func_311b4 ; STAGE_RED_FIELD_TOP
- dw Func_311b4 ; STAGE_RED_FIELD_BOTTOM
- dw DoNothing_31324
- dw DoNothing_31324
- dw Func_31326 ; STAGE_BLUE_FIELD_TOP
- dw Func_31326 ; STAGE_BLUE_FIELD_BOTTOM
-
-Func_3022b: ; 0x3022b
- xor a
- ld [wd5ca], a ;turn text off
- call FillBottomMessageBufferWithBlackTile ;clear text
- xor a
- ld [wInSpecialMode], a
- ld [wSpecialMode], a ;no longer in special modes
- callba StopTimer
- ld a, [wCurrentStage]
- rst JumpTable ; calls JumpToFuncInTable
-CallTable_30247: ; 0x30247
- dw Func_31234 ; STAGE_RED_FIELD_TOP
- dw Func_31234 ; STAGE_RED_FIELD_BOTTOM
- dw DoNothing_31325
- dw DoNothing_31325
- dw Func_313c3 ; STAGE_BLUE_FIELD_TOP
- dw Func_313c3 ; STAGE_BLUE_FIELD_TOP
-
-INCLUDE "engine/pinball_game/billboard_tiledata.asm"
-
-LoadScrollingMapNameText: ; 0x3118f
-; Loads the scrolling message that displays the current map's name.
-; Input: bc = pointer to prefix scrolling text
- push bc
- call FillBottomMessageBufferWithBlackTile
- call Func_30db
- ld a, [wCurrentMap]
- sla a
- ld c, a
- ld b, $0
- ld hl, MapNames
- add hl, bc
- ld a, [hli]
- ld e, a
- ld a, [hli]
- ld d, a
- ld hl, wScrollingText2
- call LoadScrollingText
- pop de
- ld hl, wScrollingText1
- call LoadScrollingText
- ret
-
-Func_311b4: ; 0x311b4
- ld a, [wd55a]
- and a
- jr nz, .asm_311ce
- ld a, $80
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 2], a
- xor a
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 3], a
- ld [wIndicatorStates + 4], a
- jr .asm_311e2
-
-.asm_311ce
- ld a, $80
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 3], a
- xor a
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 2], a
- ld [wIndicatorStates + 4], a
- jr .asm_311e2
-
-.asm_311e2
- ld a, $2
- callba LoadDiglettGraphics
- ld a, $5
- callba LoadDiglettGraphics
- ld a, $6a
- ld [wStageCollisionMap + $f0], a
- ld a, $6b
- ld [wStageCollisionMap + $110], a
- ld a, $66
- ld [wStageCollisionMap + $e3], a
- ld a, $67
- ld [wStageCollisionMap + $103], a
- callba Func_107b0
- ld a, $4
- ld [wd7ad], a
- ld de, $0003
- call PlaySong
- ld a, [wCurrentStage]
- bit 0, a
- ret z
- callba Func_14135
- ret
-
-Func_31234: ; 0x31234
- callba ResetIndicatorStates
- callba Func_107c2
- callba Func_107c8
- callba Func_107e9
- ld a, [wCurrentStage]
- bit 0, a
- ret z
- callba Func_14135
- callba Func_16425
- callba LoadMapBillboardTileData
- ret
-
-ChooseNextMap_RedField: ; 0x31282
-; Picks the next map to perform a map move.
-; Also records which maps have been visited.
- ld a, [wNumMapMoves]
- inc a
- cp $6
- jr c, .dontReset
- ld a, $ff
- ld [wVisitedMaps], a
- ld [wVisitedMaps + 1], a
- ld [wVisitedMaps + 2], a
- ld [wVisitedMaps + 3], a
- ld [wVisitedMaps + 4], a
- ld [wVisitedMaps + 5], a
- xor a
-.dontReset
- ld [wNumMapMoves], a
- cp $3
- jr c, .chooseMapFromArea1
- cp $5
- jr c, .chooseMapFromArea2
- ld a, INDIGO_PLATEAU
- ld [wCurrentMap], a
- ld [wVisitedMaps + 5], a
- ret
-
-.chooseMapFromArea1
- call GenRandom
- and $7
- cp $7
- jr nc, .chooseMapFromArea1
- ld c, a
- ld b, $0
- ld hl, FirstMapMoveSet_RedField
- add hl, bc
- ld c, [hl]
- ld hl, wVisitedMaps
- ld a, [wNumMapMoves]
- and a
- jr z, .asm_312d4
- ld b, a
-.asm_312cd
- ld a, [hli]
- cp c
- jr z, .chooseMapFromArea1
- dec b
- jr nz, .asm_312cd
-.asm_312d4
- ld a, c
- ld [wCurrentMap], a
- ld a, [wNumMapMoves]
- ld c, a
- ld b, $0
- ld hl, wVisitedMaps
- add hl, bc
- ld a, [wCurrentMap]
- ld [hl], a
- ret
-
-.chooseMapFromArea2
- call GenRandom
- and $3
- ld c, a
- ld b, $0
- ld hl, SecondMapMoveSet_RedField
- add hl, bc
- ld c, [hl]
- ld hl, wVisitedMaps + 3
- ld a, [wNumMapMoves]
- sub $3
- jr z, .asm_31306
- ld b, a
-.asm_312ff
- ld a, [hli]
- cp c
- jr z, .chooseMapFromArea2
- dec b
- jr nz, .asm_312ff
-.asm_31306
- ld a, c
- ld [wCurrentMap], a
- ld a, [wNumMapMoves]
- ld c, a
- ld b, $0
- ld hl, wVisitedMaps
- add hl, bc
- ld a, [wCurrentMap]
- ld [hl], a
- ret
-
-FirstMapMoveSet_RedField:
- db PALLET_TOWN
- db VIRIDIAN_FOREST
- db PEWTER_CITY
- db CERULEAN_CITY
- db VERMILION_SEASIDE
- db ROCK_MOUNTAIN
- db LAVENDER_TOWN
-
-SecondMapMoveSet_RedField:
- db CYCLING_ROAD
- db SAFARI_ZONE
- db SEAFOAM_ISLANDS
- db CINNABAR_ISLAND
-
-DoNothing_31324: ; 0x31324
- ret
-
-DoNothing_31325: ; 0x31325
- ret
-
-Func_31326: ; 0x31326
- ld a, [wd55a]
- and a
- jr nz, .asm_3134c
- ld a, $80
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 2], a
- xor a
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 3], a
- ld [wIndicatorStates + 4], a
- ld a, $3
- callba LoadPsyduckOrPoliwagGraphics
- jr .asm_31382
-
-.asm_3134c
- ld a, $80
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 3], a
- xor a
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 2], a
- ld [wIndicatorStates + 4], a
- ld a, $1
- callba LoadPsyduckOrPoliwagGraphics
- ld a, $6
- callba LoadPsyduckOrPoliwagGraphics
- ld a, $7
- callba LoadPsyduckOrPoliwagNumberGraphics
-.asm_31382
- ld a, [wCurrentStage]
- bit 0, a
- jr z, .asm_3139d
- ld a, $54
- ld [wStageCollisionMap + $e3], a
- ld a, $55
- ld [wStageCollisionMap + $103], a
- ld a, $52
- ld [wStageCollisionMap + $f0], a
- ld a, $53
- ld [wStageCollisionMap + $110], a
-.asm_3139d
- ld a, $1
- ld [wd644], a
- callba Func_1f2ed
- ld de, $0003
- call PlaySong
- ld a, [wCurrentStage]
- bit 0, a
- ret z
- callba Func_1c2cb
- ret
-
-Func_313c3: ; 0x313c3
- callba ResetIndicatorStates
- callba Func_107c2
- callba Func_1f2ff
- ld a, $0
- ld [wd644], a
- ld a, [wCurrentStage]
- bit 0, a
- ret z
- callba Func_1c2cb
- callba Func_1e8f6
- callba LoadMapBillboardTileData
- ret
-
-ChooseNextMap_BlueField: ; 0x3140b
-; Picks the next map to perform a map move.
-; Also records which maps have been visited.
- ld a, [wNumMapMoves]
- inc a
- cp $6
- jr c, .dontReset
- ld a, $ff
- ld [wVisitedMaps], a
- ld [wVisitedMaps + 1], a
- ld [wVisitedMaps + 2], a
- ld [wVisitedMaps + 3], a
- ld [wVisitedMaps + 4], a
- ld [wVisitedMaps + 5], a
- xor a
-.dontReset
- ld [wNumMapMoves], a
- cp $3
- jr c, .chooseMapFromArea1
- cp $5
- jr c, .chooseMapFromArea2
- ld a, INDIGO_PLATEAU
- ld [wCurrentMap], a
- ld [wVisitedMaps + 5], a
- ret
-
-.chooseMapFromArea1
- call GenRandom
- and $7
- cp $7
- jr nc, .chooseMapFromArea1
- ld c, a
- ld b, $0
- ld hl, FirstMapMoveSet_BlueField
- add hl, bc
- ld c, [hl]
- ld hl, wVisitedMaps
- ld a, [wNumMapMoves]
- and a
- jr z, .asm_3145e
- ld b, a
-.asm_31457
- ld a, [hli]
- cp c
- jr z, .chooseMapFromArea1
- dec b
- jr nz, .asm_31457
-.asm_3145e
- ld a, c
- ld [wCurrentMap], a
- ld a, [wNumMapMoves]
- ld c, a
- ld b, $0
- ld hl, wVisitedMaps
- add hl, bc
- ld a, [wCurrentMap]
- ld [hl], a
- ret
-
-.chooseMapFromArea2
- call GenRandom
- and $3
- ld c, a
- ld b, $0
- ld hl, SecondMapMoveSet_BlueField
- add hl, bc
- ld c, [hl]
- ld hl, wVisitedMaps + 3
- ld a, [wNumMapMoves]
- sub $3
- jr z, .asm_31490
- ld b, a
-.asm_31489
- ld a, [hli]
- cp c
- jr z, .chooseMapFromArea2
- dec b
- jr nz, .asm_31489
-.asm_31490
- ld a, c
- ld [wCurrentMap], a
- ld a, [wNumMapMoves]
- ld c, a
- ld b, $0
- ld hl, wVisitedMaps
- add hl, bc
- ld a, [wCurrentMap]
- ld [hl], a
- ret
-
-FirstMapMoveSet_BlueField:
- db VIRIDIAN_CITY
- db VIRIDIAN_FOREST
- db MT_MOON
- db CERULEAN_CITY
- db VERMILION_STREETS
- db ROCK_MOUNTAIN
- db CELADON_CITY
-
-SecondMapMoveSet_BlueField:
- db FUCHSIA_CITY
- db SAFARI_ZONE
- db SAFFRON_CITY
- db CINNABAR_ISLAND
-
-Func_314ae: ; 0x314ae
- ld a, [wTimerActive]
- and a
- ld a, [wd54c]
- jr z, .asm_314d0
- cp $1
- jp z, Func_31591
- cp $3
- jp z, Func_31591
- cp $2
- jp z, Func_315b3
- cp $5
- jp z, Func_315b3
- cp $d
- jp z, Func_315d5
-.asm_314d0
- cp $0
- jr z, .asm_314d6
- scf
- ret
-
-.asm_314d6
- call Func_3151f
- ld a, [wd54d]
- call CallInFollowingTable
-PointerTable_314df: ; 0xd13df
- padded_dab Func_314ef
- padded_dab Func_314f1
- padded_dab Func_314f3
- padded_dab Func_31505
-
-Func_314ef: ; 0x314ef
- scf
- ret
-
-Func_314f1: ; 0x314f1
- scf
- ret
-
-Func_314f3: ; 0x314f3
- callba Func_3022b
- ld de, $0001
- call PlaySong
- scf
- ret
-
-Func_31505: ; 0x31505
- ld a, [wd5ca]
- and a
- ret nz
- call FillBottomMessageBufferWithBlackTile
- callba Func_3022b
- ld de, $0001
- call PlaySong
- scf
- ret
-
-Func_3151f: ; 0x3151f
- ld a, $50
- ld [wd4ef], a
- ld [wd4f1], a
- callba Func_107f8
- ld a, [wd57e]
- and a
- ret z
- xor a
- ld [wd57e], a
- ld a, $3
- ld [wd54d], a
- xor a
- ld [wd604], a
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 2], a
- ld [wIndicatorStates + 3], a
- ld [wIndicatorStates + 4], a
- ld a, [wCurrentStage]
- bit 0, a
- jr z, .asm_31577
- callba Func_14135
- callba Func_16425
- callba LoadMapBillboardTileData
-.asm_31577
- callba StopTimer
- call FillBottomMessageBufferWithBlackTile
- call Func_30db
- ld hl, wScrollingText1
- ld de, MapMoveFailedText
- call LoadScrollingText
- ret
-
-Func_31591: ; 0x31591
- ld a, [wd55a]
- and a
- jr nz, .asm_315b1
- ld a, [wIndicatorStates]
- and a
- jr z, .asm_315b1
- xor a
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 2], a
- ld a, $80
- ld [wIndicatorStates + 4], a
- ld a, $1
- ld [wd604], a
- ld [wd54d], a
-.asm_315b1
- scf
- ret
-
-Func_315b3: ; 0x315b3
- ld a, [wd55a]
- and a
- jr z, .asm_315d3
- ld a, [wIndicatorStates + 1]
- and a
- jr z, .asm_315d3
- xor a
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 3], a
- ld a, $80
- ld [wIndicatorStates + 4], a
- ld a, $1
- ld [wd604], a
- ld [wd54d], a
-.asm_315d3
- scf
- ret
-
-Func_315d5: ; 0x315d5
- ld de, $0000
- call PlaySong
- rst AdvanceFrame
- callba ChooseNextMap_RedField
- callba LoadMapBillboardTileData
- lb de, $25, $25
- call PlaySoundEffect
- ld bc, ArrivedAtMapText
- callba LoadScrollingMapNameText
-.asm_31603
- callba Func_33e3
- rst AdvanceFrame
- ld a, [wd5ca]
- and a
- jr nz, .asm_31603
- ld a, $2
- ld [wd54d], a
- scf
- ret
-
-Func_3161b: ; 0x3161b
- ld a, [wTimerActive]
- and a
- ld a, [wd54c]
- jr z, .asm_3163d
- cp $1
- jp z, Func_31708
- cp $f
- jp z, Func_31708
- cp $2
- jp z, Func_3172a
- cp $e
- jp z, Func_3172a
- cp $d
- jp z, Func_3174c
-.asm_3163d
- cp $0
- jr z, .asm_31643
- scf
- ret
-
-.asm_31643
- call Func_3168c
- ld a, [wd54d]
- call CallInFollowingTable
-PointerTable_3164c: ; 0x3164c
- padded_dab Func_3165c
- padded_dab Func_3165e
- padded_dab Func_31660
- padded_dab Func_31672
-
-Func_3165c: ; 0x3165c
- scf
- ret
-
-Func_3165e: ; 0x3165e
- scf
- ret
-
-Func_31660: ; 0x31660
- callba Func_3022b
- ld de, $0001
- call PlaySong
- scf
- ret
-
-Func_31672: ; 0x31672
- ld a, [wd5ca] ;if text is off
- and a
- ret nz
- call FillBottomMessageBufferWithBlackTile
- callba Func_3022b
- ld de, $0001
- call PlaySong
- scf
- ret
-
-Func_3168c: ; 0x3168c
- ld a, $50
- ld [wLeftMapMoveDiglettAnimationCounter], a
- ld [wRightMapMoveDiglettFrame], a
- ld a, $3
- ld [wd645], a
- ld a, $1
- ld [wd646], a
- callba Func_107f8
- ld a, [wd57e]
- and a
- ret z
- xor a
- ld [wd57e], a
- ld a, $3
- ld [wd54d], a
- xor a
- ld [wd604], a
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 2], a
- ld [wIndicatorStates + 3], a
- ld [wIndicatorStates + 4], a
- ld a, [wCurrentStage]
- bit 0, a
- jr z, .asm_316ee
- callba Func_1c2cb
- callba Func_1e8f6
- callba LoadMapBillboardTileData
-.asm_316ee
- callba StopTimer
- call FillBottomMessageBufferWithBlackTile
- call Func_30db
- ld hl, wScrollingText1
- ld de, MapMoveFailedText
- call LoadScrollingText
- ret
-
-Func_31708: ; 0x31708
- ld a, [wd55a]
- and a
- jr nz, .asm_31728
- ld a, [wIndicatorStates]
- and a
- jr z, .asm_31728
- xor a
- ld [wIndicatorStates], a
- ld [wIndicatorStates + 2], a
- ld a, $80
- ld [wIndicatorStates + 4], a
- ld a, $1
- ld [wd604], a
- ld [wd54d], a
-.asm_31728
- scf
- ret
-
-Func_3172a: ; 0x3172a
- ld a, [wd55a]
- and a
- jr z, .asm_3174a
- ld a, [wIndicatorStates + 1]
- and a
- jr z, .asm_3174a
- xor a
- ld [wIndicatorStates + 1], a
- ld [wIndicatorStates + 3], a
- ld a, $80
- ld [wIndicatorStates + 4], a
- ld a, $1
- ld [wd604], a
- ld [wd54d], a
-.asm_3174a
- scf
- ret
-
-Func_3174c: ; 0x3174c
- ld de, $0000
- call PlaySong
- rst AdvanceFrame
- callba ChooseNextMap_BlueField
- callba LoadMapBillboardTileData
- lb de, $25, $25
- call PlaySoundEffect
- ld bc, ArrivedAtMapText
- callba LoadScrollingMapNameText
-.asm_3177a
- callba Func_33e3
- rst AdvanceFrame
- ld a, [wd5ca]
- and a
- jr nz, .asm_3177a
- ld a, $2
- ld [wd54d], a
- scf
- ret
+INCLUDE "engine/pinball_game/map_move.asm"
SECTION "bankd", ROMX
@@ -2201,166 +474,8 @@ StageSeelBonusCollisionMasks: ; 0x37f00
INCBIN "data/collision/masks/seel_bonus.masks"
SECTION "banke", ROMX
-Data_38000:
- db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-
-Data_38010:
- db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-
-Data_38020:
- db $51, $10, $00, $10, $00, $10, $00, $10, $00, $80, $00, $00, $00, $00, $00, $00
-
-Data_38030:
- db $a9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-
-Data_3809a:
- db $00, $00, $00
- db $40, $40, $40
- db $90, $90, $90
- db $e4, $e4, $e4
-
-Data_380a6:
- db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 30, 31, 29
- RGB 28, 28, 25
- RGB 27, 26, 24
- RGB 24, 24, 24
-
- RGB 23, 23, 23
- RGB 23, 23, 23
- RGB 23, 23, 23
- RGB 23, 23, 23
-
- RGB 23, 23, 23
- RGB 23, 23, 23
- RGB 23, 23, 23
- RGB 23, 23, 23
-
- RGB 23, 23, 23
- RGB 23, 23, 23
- RGB 23, 23, 23
- RGB 23, 23, 23
-
- RGB 30, 31, 27
- RGB 25, 26, 20
- RGB 23, 21, 18
- RGB 17, 17, 17
-
- RGB 15, 15, 15
- RGB 15, 15, 15
- RGB 15, 15, 15
- RGB 15, 15, 15
-
- RGB 15, 15, 15
- RGB 15, 15, 15
- RGB 15, 15, 15
- RGB 15, 15, 15
-
- RGB 15, 15, 15
- RGB 15, 15, 15
- RGB 15, 15, 15
- RGB 15, 15, 15
-
- RGB 29, 31, 25
- RGB 22, 24, 15
- RGB 19, 16, 12
- RGB 10, 10, 10
-
- RGB 7, 7, 7
- RGB 7, 7, 7
- RGB 7, 7, 7
- RGB 7, 7, 7
-
- RGB 7, 7, 7
- RGB 7, 7, 7
- RGB 7, 7, 7
- RGB 7, 7, 7
-
- RGB 7, 7, 7
- RGB 7, 7, 7
- RGB 7, 7, 7
- RGB 7, 7, 7
-
- RGB 29, 31, 23
- RGB 20, 22, 10
- RGB 15, 12, 6
- RGB 3, 3, 4
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-Data_38156:
- db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- INCBIN "gfx/sgb_border.interleave.2bpp"
-
-Data_39166:
- db $99, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- INCBIN "gfx/sgb_border_blank.2bpp"
-
-Data_3a176:
- db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
- INCBIN "gfx/tilemaps/sgb_border.map"
-
-Data_3a9e6:
- db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
-Data_3a9f6:
- db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
-Data_3aa06:
- db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
-Data_3aa16:
- db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
-Data_3aa26:
- db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
-Data_3aa36:
- db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
-Data_3aa46:
- db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
-Data_3aa56:
- db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea
-Data_3aa66:
- db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-Data_3aa76:
- db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+INCLUDE "data/sgb.asm"
SECTION "bankf", ROMX
@@ -2664,7 +779,7 @@ PinballUltraballMiniGfx: ; 0xa9400
INCBIN "gfx/stage/ball_ultraball_mini.w32.interleave.2bpp"
PinballMasterballMiniGfx: ; 0xa9600
INCBIN "gfx/stage/ball_masterball_mini.w32.interleave.2bpp"
-PinballBallMiniGfx: ; 0xa9800
+PinballBallSuperMiniGfx: ; 0xa9800
INCBIN "gfx/stage/ball_mini.w32.interleave.2bpp"
HighScoresBaseGameBoyGfx: ; 0xa9a00
diff --git a/pokemon-reverse-engineering-tools b/pokemon-reverse-engineering-tools
-Subproject 74c620d01ad59bfb09cf4111ace549b925fcb9a
+Subproject 979c98a7c0f67ad6b9685b2d532c66a1f76ffb2
diff --git a/sram.asm b/sram.asm
index 22bd143..4586a34 100644
--- a/sram.asm
+++ b/sram.asm
@@ -9,7 +9,11 @@ saved_data: MACRO
\1BackupChecksum:: dw
ENDM
- saved_data sHighScores, $82
- saved_data sPokedexFlags, $98
- saved_data sKeyConfigs, $e
- saved_data sSaveGame, $4c3
+ saved_data sHighScores, $82 ; a000
+ saved_data sPokedexFlags, $98 ; a10c
+ saved_data sKeyConfigs, $e ; a244
+ saved_data sSaveGame, $4c3 ; a268
+; abf6
+
+ ds $409
+sRNGMod:: ; afff
diff --git a/wram.asm b/wram.asm
index 14d9146..9e4d75b 100644
--- a/wram.asm
+++ b/wram.asm
@@ -165,7 +165,8 @@ wd495:: ; 0xd495
wd496:: ; 0xd496
ds $1
-wd497:: ; 0xd497
+wNextStage:: ; 0xd497
+; Holds the id of the next stage to go to. Used for transitioning between bonus stage and the main red/blue field.
ds $1
wd498:: ; 0xd498
@@ -218,7 +219,8 @@ wBallSaverTimerSecondsBackup:: ; 0xd4a7
wNumTimesBallSavedTextWillDisplayBackup:: ; 0xd4a8
ds $1
-wd4a9:: ; 0xd4a9
+wExtraBall:: ; 0xd4a9
+; Set to 1 if the player has an extra ball.
ds $1
wDrawBottomMessageBox:: ; 0xd4aa
@@ -283,7 +285,10 @@ wd4c8:: ; 0xd4c8
wd4c9:: ; 0xd4c9
ds $1
-wd4ca:: ; 0xd4ca
+wShowExtraBallText:: ; 0xd4ca
+; Setting this byte to 1 or 2 will cause the "Extra Ball" message to scroll across the bottom of the screen.
+; 1 = "EXTRA BALL"
+; 2 = "EXTRA BALL SPECIAL BONUS"
ds $1
wWhichVoltorb:: ; 0xd4cb
@@ -324,7 +329,9 @@ wWhichBumper:: ; 0xd4d8
wWhichBumperId:: ; 0xd4d9
ds $1
-wd4da:: ; 0xd4da
+wBumperLightUpDuration:: ; 0xd4da
+; Number of frames left in the Bumper light-up animation when the pinball bounces off of it.
+; This is shared by both bumpers, so only one can be lit up at a time.
ds $1
wd4db:: ; 0xd4db
@@ -493,7 +500,9 @@ wPikachuSaverCharge:: ; 0xd517
; in the right alley. The charge's value ranges from 0 - 15.
ds $1
-wd518:: ; 0xd518
+wWhichPikachuSaverSide:: ; 0xd518
+; 0 = Pikachu is on the left side
+; 1 = Pikachu is on the right side
ds $1
wPikachuSaverAnimation:: ; 0xd519
@@ -600,7 +609,9 @@ wd558:: ; 0xd558
wd559:: ; 0xd559
ds $1
-wd55a:: ; 0xd55a
+wMapMoveDirection:: ; 0xd55a
+; 0 = need to hit the ball left to open map move slot cave
+; 1 = need to hit the ball right to open map move slot cave
ds $1
wRareMonsFlag:: ; 0xd55b
@@ -802,29 +813,43 @@ wDittoSlotCollision:: ; 0xd5fe
; Second byte is set by HandleGameObjectCollision, but is unused
ds $2
-wd600:: ; 0xd600
+wDittoEnterOrExitCounter:: ; 0xd600
+; Number of frames remaining in the process when the pinball is entering or exiting the Ditto cave.
+; This functions the same way as wSlotEnterOrExitCounter.
ds $1
wSlotCollision:: ; 0xd601
; Second byte is set by HandleGameObjectCollision, but is unused
ds $2
-wd603:: ; 0xd603
+wSlotEnterOrExitCounter:: ; 0xd603
+; Number of frames remaining in the process when the pinball is entering or exiting the slot cave.
+; This functions the same way as wDittoEnterOrExitCounter.
ds $1
-wd604:: ; 0xd604
- ds $2
+wSlotIsOpen:: ; 0xd604
+; Whether or not the Slot is open for the pinball to enter. 1 = open; 0 = closed
+ ds $1
+
+ ds $1 ; unused
-wd606:: ; 0xd606
+wSlotGlowingAnimationCounter:: ; 0xd606
+; When the slot is open, this counter increments once every frame, which controls the glowing
+; animation around the slot cave.
ds $1
-wd607:: ; 0xd607
+wFramesUntilSlotCaveOpens:: ; 0xd607
+; When set to non-zero value, it decrements once per frame. When it hits 0, the Slot cave will open.
ds $1
-wd608:: ; 0xd608
+wOpenedSlotByGetting4CAVELights:: ; 0xd608
+; Set to 1 when the slot bonus was trigered by lighting up all 4 CAVE lights.
+; See wCAVELightStates
ds $1
-wd609:: ; 0xd609
+wOpenedSlotByGetting3Pokeballs:: ; 0xd609
+; Set to 1 when the slot bonus was triggered by achieving 3 Pokeballs (the pokeballs underneath the billboard).
+; See wNumPokeballs.
ds $1
wWhichBonusMultiplierRailing:: ; 0xd60a
@@ -1011,7 +1036,7 @@ wd645:: ; 0xd645
wd646:: ; 0xd646
ds $1
-wd647:: ; 0xd647
+wBonusMultiplierRailingEndLightDuration:: ; 0xd647
ds $1
wd648:: ; 0xd648
@@ -1827,10 +1852,13 @@ wd801:: ; 0xd801
wOAMBufferSize:: ; 0xd802
ds $1
-wd803:: ; 0xd803
+wRumblePattern:: ; 0xd803
+; Holds the rumble pattern for the upcoming frames.
+; This gets rotated to the right once per frame. If bit 0 is set, then it turns on rumble.
ds $1
-wd804:: ; 0xd804
+wRumbleDuration:: ; 0xd804
+; Number of frames to rumble the Gameboy. See wRumblePattern.
ds $1
wd805:: ; 0xd805 enables unused and odd PlaceString
@@ -1873,19 +1901,7 @@ wd811:: ; 0xd811
ds $1
wd812:: ; 0xd812
- ds $18
-
-wd82a:: ; 0xd82a
- ds $7
-
-wd831:: ; 0xd831
- ds $c
-
-wd83d:: ; 0xd83d
- ds $9
-
-wd846:: ; 0xd846
- ds $2
+ ds $36
wd848:: ; 0xd848
ds $1
@@ -2155,6 +2171,7 @@ wd8e9:: ; 0xd8e9
ds $1
wd8ea:: ; 0xd8ea
+; IR status flags?
ds $1
wd8eb:: ; 0xd8eb