summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml25
-rw-r--r--audio/cries.asm232
-rw-r--r--audio/engine.asm337
-rw-r--r--audio/music/clair.asm6
-rw-r--r--audio/music/credits.asm16
-rw-r--r--audio/music/evolution.asm8
-rw-r--r--audio/music/goldenrodcity.asm3
-rw-r--r--audio/music/healpokemon.asm10
-rw-r--r--audio/music/johtowildbattle.asm3
-rw-r--r--audio/music/kantotrainerbattle.asm6
-rw-r--r--audio/music/kantowildbattle.asm28
-rw-r--r--audio/music/lookofficer.asm4
-rw-r--r--audio/music/lookrocket.asm6
-rw-r--r--audio/music/postcredits.asm4
-rw-r--r--audio/music/profoak.asm8
-rw-r--r--audio/music/ssaqua.asm4
-rw-r--r--audio/music/surf.asm4
-rw-r--r--audio/music/wildpokemonvictory.asm12
-rw-r--r--audio/sfx.asm38
-rw-r--r--audio/sfx_crystal.asm8
-rw-r--r--battle/ai/items.asm47
-rwxr-xr-xbattle/ai/move.asm7
-rw-r--r--battle/ai/scoring.asm178
-rwxr-xr-xbattle/ai/switch.asm94
-rw-r--r--battle/anim_commands.asm19
-rw-r--r--battle/anims.asm236
-rw-r--r--battle/bg_effects.asm265
-rw-r--r--battle/core.asm191
-rw-r--r--battle/effect_commands.asm50
-rw-r--r--battle/hidden_power.asm6
-rwxr-xr-xbattle/link_result.asm162
-rw-r--r--battle/magikarp_length.asm3
-rw-r--r--battle/misc.asm6
-rwxr-xr-xbattle/objects/data.asm52
-rwxr-xr-xbattle/objects/functions.asm212
-rwxr-xr-xbattle/sliding_intro.asm13
-rwxr-xr-xbattle/trainer_huds.asm10
-rw-r--r--constants.asm1
-rw-r--r--constants/animation_constants.asm938
-rwxr-xr-xconstants/audio_constants.asm13
-rwxr-xr-xconstants/cgb_constants.asm22
-rw-r--r--constants/map_constants.asm66
-rw-r--r--constants/misc_constants.asm24
-rwxr-xr-xconstants/printer_constants.asm9
-rw-r--r--constants/sprite_constants.asm268
-rwxr-xr-xconstants/sram_constants.asm50
-rw-r--r--constants/wram_constants.asm2
-rwxr-xr-xdata/map_objects.asm78
-rw-r--r--data/pokedex/entry_pointers.asm72
-rwxr-xr-xdata/sprite_engine.asm578
-rwxr-xr-xengine/anim_hp_bar.asm80
-rw-r--r--engine/battle_start.asm22
-rwxr-xr-xengine/billspc.asm69
-rwxr-xr-xengine/breeding/egg.asm20
-rwxr-xr-xengine/buy_sell_toss.asm2
-rwxr-xr-xengine/card_flip.asm60
-rwxr-xr-xengine/clock_reset.asm2
-rw-r--r--engine/color.asm271
-rw-r--r--engine/credits.asm16
-rwxr-xr-xengine/crystal_intro.asm72
-rwxr-xr-xengine/debug.asm41
-rwxr-xr-xengine/delete_save_change_clock.asm298
-rw-r--r--engine/diploma.asm42
-rwxr-xr-xengine/dummy_game.asm2
-rw-r--r--engine/events.asm18
-rw-r--r--engine/events_2.asm16
-rwxr-xr-xengine/events_3.asm41
-rwxr-xr-xengine/evolution_animation.asm53
-rwxr-xr-xengine/evolve.asm25
-rw-r--r--engine/facings.asm128
-rw-r--r--engine/fish.asm10
-rw-r--r--engine/fruit_trees.asm6
-rwxr-xr-xengine/healmachineanim.asm7
-rwxr-xr-xengine/intro_menu.asm30
-rw-r--r--engine/landmarks.asm6
-rwxr-xr-xengine/link.asm211
-rwxr-xr-xengine/link_trade.asm8
-rwxr-xr-xengine/main_menu.asm4
-rwxr-xr-xengine/map_object_action.asm118
-rw-r--r--engine/map_objects.asm66
-rw-r--r--engine/map_setup.asm10
-rwxr-xr-xengine/mart.asm25
-rwxr-xr-xengine/menu.asm8
-rwxr-xr-xengine/mon_icons.asm27
-rwxr-xr-xengine/move_mon.asm30
-rwxr-xr-xengine/move_mon_wo_mail.asm133
-rw-r--r--engine/movement.asm10
-rwxr-xr-xengine/mysterygift.asm178
-rwxr-xr-xengine/mysterygift2.asm2
-rwxr-xr-xengine/namingscreen.asm28
-rwxr-xr-xengine/npc_movement.asm4
-rwxr-xr-xengine/npctrade.asm6
-rwxr-xr-xengine/options_menu.asm11
-rwxr-xr-xengine/overworld.asm23
-rw-r--r--engine/pack.asm6
-rw-r--r--engine/party_menu.asm31
-rw-r--r--engine/phone.asm16
-rwxr-xr-xengine/player_movement.asm100
-rwxr-xr-xengine/player_object.asm26
-rwxr-xr-xengine/player_step.asm10
-rw-r--r--engine/pokedex.asm13
-rwxr-xr-xengine/pokegear.asm4
-rw-r--r--engine/predef.asm14
-rwxr-xr-xengine/printer.asm1253
-rwxr-xr-xengine/printer/serial.asm645
-rw-r--r--engine/radio.asm10
-rwxr-xr-xengine/rtc.asm3
-rw-r--r--engine/save.asm87
-rw-r--r--engine/scripting.asm678
-rwxr-xr-xengine/search.asm4
-rwxr-xr-xengine/search2.asm134
-rwxr-xr-xengine/selectmenu.asm6
-rwxr-xr-xengine/slot_machine.asm36
-rw-r--r--engine/specials.asm8
-rwxr-xr-xengine/sprite_anims.asm56
-rwxr-xr-xengine/sprites.asm24
-rwxr-xr-xengine/startmenu.asm64
-rwxr-xr-xengine/stats_screen.asm31
-rw-r--r--engine/std_scripts.asm8
-rwxr-xr-xengine/switch_items.asm3
-rwxr-xr-xengine/time.asm11
-rwxr-xr-xengine/time_capsule/conversion.asm5
-rw-r--r--engine/timeofdaypals.asm18
-rwxr-xr-xengine/timeset.asm18
-rw-r--r--engine/title.asm11
-rwxr-xr-xengine/tmhm2.asm9
-rwxr-xr-xengine/trade/animation.asm668
-rwxr-xr-xengine/trainer_card.asm4
-rwxr-xr-xengine/unown_puzzle.asm8
-rwxr-xr-xengine/unowndex.asm3
-rwxr-xr-xengine/variables.asm4
-rwxr-xr-xengine/warp_connection.asm71
-rwxr-xr-xengine/wildmons.asm30
-rw-r--r--event/battle_tower.asm10
-rw-r--r--event/buena.asm3
-rwxr-xr-xevent/bug_contest_2.asm9
-rwxr-xr-xevent/bug_contest_judging.asm27
-rwxr-xr-xevent/celebi.asm7
-rwxr-xr-xevent/daycare.asm2
-rw-r--r--event/dratini.asm3
-rwxr-xr-xevent/elevator.asm6
-rwxr-xr-xevent/field_moves.asm13
-rwxr-xr-xevent/forced_movement.asm16
-rwxr-xr-xevent/halloffame.asm24
-rwxr-xr-xevent/happiness_egg.asm4
-rw-r--r--event/kurt.asm6
-rw-r--r--event/magikarp.asm5
-rwxr-xr-xevent/magnet_train.asm33
-rw-r--r--event/mom.asm72
-rwxr-xr-xevent/overworld.asm8
-rwxr-xr-xevent/photo.asm16
-rw-r--r--event/poke_seer.asm3
-rwxr-xr-xevent/special.asm4
-rwxr-xr-xevent/squirtbottle.asm34
-rw-r--r--event/unown.asm149
-rwxr-xr-xevent/whiteout.asm4
-rw-r--r--gfx.py266
-rwxr-xr-xgfx/font.asm28
-rwxr-xr-xgfx/mail.asm17
-rw-r--r--gfx/pics/animation.asm366
-rw-r--r--gfx/unknown/011e5d.1bpp (renamed from gfx/unknown/011e5d.2bpp)0
-rw-r--r--gfx/unknown/011e65.1bpp (renamed from gfx/unknown/011e65.2bpp)bin8 -> 8 bytes
-rw-r--r--gfx/unknown/011e6d.1bpp (renamed from gfx/unknown/011e6d.2bpp)bin8 -> 8 bytes
-rw-r--r--gfx/unknown/0f8f34.w64.1bpp (renamed from gfx/unknown/0f8f34.2bpp)bin720 -> 720 bytes
-rwxr-xr-xgfx/unknown/16c903.pal39
-rw-r--r--home.asm74
-rw-r--r--home/audio.asm2
-rw-r--r--home/battle.asm6
-rw-r--r--home/copy.asm23
-rw-r--r--home/decompress.asm2
-rw-r--r--home/fade.asm2
-rw-r--r--home/game_time.asm2
-rw-r--r--home/handshake.asm20
-rw-r--r--home/init.asm25
-rw-r--r--home/joypad.asm8
-rw-r--r--home/lcd.asm6
-rw-r--r--home/map.asm16
-rw-r--r--home/map_objects.asm8
-rw-r--r--home/math.asm10
-rw-r--r--home/menu.asm26
-rw-r--r--home/mobile.asm5
-rw-r--r--home/movement.asm34
-rw-r--r--home/palettes.asm18
-rw-r--r--home/serial.asm107
-rw-r--r--home/sine.asm10
-rw-r--r--home/string.asm3
-rw-r--r--home/text.asm38
-rw-r--r--home/time.asm9
-rw-r--r--home/vblank.asm3
-rw-r--r--home/window.asm34
-rw-r--r--hram.asm13
-rw-r--r--items/item_descriptions.asm3
-rw-r--r--items/item_effects.asm46
-rw-r--r--lib/mobile/main.asm192
-rw-r--r--macros.asm50
-rw-r--r--macros/move_anim.asm18
-rw-r--r--macros/movement.asm354
-rw-r--r--macros/sound.asm25
-rwxr-xr-xmacros/trade_anim.asm12
-rwxr-xr-xmacros/wram.asm137
-rw-r--r--main.asm1051
-rw-r--r--maps/AzaleaTown.asm42
-rw-r--r--maps/BattleTower1F.asm95
-rw-r--r--maps/BattleTowerElevator.asm6
-rw-r--r--maps/BillsHouse.asm8
-rw-r--r--maps/BrunosRoom.asm8
-rw-r--r--maps/BurnedTower1F.asm14
-rw-r--r--maps/BurnedTowerB1F.asm64
-rw-r--r--maps/CeladonGameCorner.asm4
-rw-r--r--maps/CeladonPokeCenter1F.asm18
-rw-r--r--maps/CeruleanGym.asm26
-rw-r--r--maps/CherrygroveCity.asm136
-rw-r--r--maps/CianwoodCity.asm30
-rw-r--r--maps/CianwoodGym.asm6
-rw-r--r--maps/CopycatsHouse2F.asm200
-rw-r--r--maps/DragonShrine.asm62
-rw-r--r--maps/DragonsDenB1F.asm16
-rw-r--r--maps/EarlsPokemonAcademy.asm26
-rw-r--r--maps/EcruteakGym.asm6
-rw-r--r--maps/EcruteakHouse.asm8
-rw-r--r--maps/EcruteakPokeCenter1F.asm32
-rw-r--r--maps/ElmsLab.asm108
-rw-r--r--maps/FastShip1F.asm66
-rw-r--r--maps/FastShipB1F.asm8
-rw-r--r--maps/FastShipCabins_NNW_NNE_NE.asm20
-rw-r--r--maps/FastShipCabins_SE_SSE_CaptainsCabin.asm22
-rw-r--r--maps/FastShipCabins_SW_SSW_NW.asm2
-rw-r--r--maps/FuchsiaGym.asm36
-rw-r--r--maps/FuchsiaPokeCenter1F.asm30
-rw-r--r--maps/GoldenrodCity.asm16
-rw-r--r--maps/GoldenrodGym.asm8
-rw-r--r--maps/GoldenrodMagnetTrainStation.asm46
-rw-r--r--maps/GoldenrodPokeCenter1F.asm40
-rw-r--r--maps/HallOfFame.asm22
-rw-r--r--maps/IlexForest.asm344
-rw-r--r--maps/IndigoPlateauPokeCenter1F.asm34
-rw-r--r--maps/KarensRoom.asm8
-rw-r--r--maps/KogasRoom.asm8
-rw-r--r--maps/KrissHouse1F.asm8
-rw-r--r--maps/KurtsHouse.asm22
-rw-r--r--maps/LancesRoom.asm80
-rw-r--r--maps/MahoganyMart1F.asm34
-rw-r--r--maps/MahoganyTown.asm18
-rw-r--r--maps/MobileBattleRoom.asm2
-rw-r--r--maps/MountMoon.asm20
-rw-r--r--maps/MountMoonSquare.asm83
-rw-r--r--maps/MrPokemonsHouse.asm18
-rw-r--r--maps/NewBarkTown.asm52
-rw-r--r--maps/OlivineCity.asm72
-rw-r--r--maps/OlivineLighthouse6F.asm44
-rw-r--r--maps/OlivinePort.asm62
-rw-r--r--maps/PokeCenter2F.asm156
-rw-r--r--maps/PowerPlant.asm18
-rw-r--r--maps/RadioTower1F.asm8
-rw-r--r--maps/RadioTower2F.asm4
-rw-r--r--maps/RadioTower5F.asm54
-rw-r--r--maps/Route16Gate.asm4
-rw-r--r--maps/Route1718Gate.asm4
-rw-r--r--maps/Route25.asm46
-rw-r--r--maps/Route26HealSpeechHouse.asm2
-rw-r--r--maps/Route27.asm6
-rw-r--r--maps/Route29.asm44
-rw-r--r--maps/Route30.asm8
-rw-r--r--maps/Route32.asm8
-rw-r--r--maps/Route34.asm16
-rw-r--r--maps/Route34IlexForestGate.asm8
-rw-r--r--maps/Route35NationalParkgate.asm12
-rw-r--r--maps/Route36.asm54
-rw-r--r--maps/Route36NationalParkgate.asm6
-rw-r--r--maps/Route40.asm32
-rw-r--r--maps/Route42.asm12
-rw-r--r--maps/Route43Gate.asm78
-rw-r--r--maps/RuinsofAlphOutside.asm22
-rw-r--r--maps/RuinsofAlphResearchCenter.asm12
-rw-r--r--maps/SaffronTrainStation.asm46
-rw-r--r--maps/SlowpokeWellB1F.asm30
-rw-r--r--maps/SproutTower3F.asm14
-rw-r--r--maps/TeamRocketBaseB1F.asm120
-rw-r--r--maps/TeamRocketBaseB2F.asm258
-rw-r--r--maps/TeamRocketBaseB3F.asm130
-rw-r--r--maps/TinTower1F.asm64
-rw-r--r--maps/TrainerHouseB1F.asm56
-rw-r--r--maps/UndergroundPathSwitchRoomEntrances.asm36
-rw-r--r--maps/VermilionPort.asm32
-rw-r--r--maps/VictoryRoad.asm68
-rw-r--r--maps/VictoryRoadGate.asm2
-rw-r--r--maps/VioletCity.asm140
-rw-r--r--maps/VioletPokeCenter1F.asm18
-rw-r--r--maps/WillsRoom.asm8
-rw-r--r--maps/WiseTriosRoom.asm12
-rwxr-xr-xmisc/battle_tower_47.asm8
-rwxr-xr-xmisc/battle_tower_5c.asm28
-rw-r--r--misc/crystal_misc.asm18
-rwxr-xr-xmisc/fixed_words.asm993
-rwxr-xr-xmisc/gfx_41.asm224
-rwxr-xr-xmisc/mobile_12.asm191
-rwxr-xr-xmisc/mobile_12_2.asm7
-rw-r--r--misc/mobile_22.asm373
-rw-r--r--misc/mobile_22_2.asm128
-rw-r--r--misc/mobile_40.asm899
-rwxr-xr-xmisc/mobile_41.asm502
-rw-r--r--misc/mobile_42.asm27
-rw-r--r--misc/mobile_45.asm67
-rwxr-xr-xmisc/mobile_45_sprite_engine.asm3
-rwxr-xr-xmisc/mobile_46.asm162
-rwxr-xr-xmisc/mobile_5b.asm120
-rwxr-xr-xmisc/mobile_5c.asm25
-rw-r--r--misc/mobile_5f.asm220
-rwxr-xr-xmisc/mobile_menu.asm14
-rwxr-xr-xmisc/printer_77.asm56
-rw-r--r--misc/unused_title.asm4
-rw-r--r--predef/cgb.asm50
-rwxr-xr-xpredef/crystal.asm8
-rw-r--r--predef/sgb.asm67
-rw-r--r--rst.asm3
-rw-r--r--sram.asm4
-rwxr-xr-xtext/trainer_class_names.asm2
-rw-r--r--text/types.asm3
-rw-r--r--tilesets/animations.asm30
-rw-r--r--trainers/dvs.asm3
-rwxr-xr-xtrainers/read_party.asm13
-rwxr-xr-xunknown/013a47.asm103
-rw-r--r--wram.asm397
323 files changed, 11429 insertions, 11480 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..897bb9770
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,25 @@
+language: c
+install:
+ - |-
+ path="$(pwd)"; cd;
+ wget https://github.com/rednex/rgbds/archive/v0.2.5.tar.gz -O rgbds.tar.gz &&
+ tar xf rgbds.tar.gz &&
+ cd rgbds-0.2.5 &&
+ sudo make install &&
+ cd - &&
+ rm -rf rgbds &&
+ cd "$path"
+before_script:
+ - |-
+ function check_status() {
+ if ! git diff-index --quiet --ignore-submodules=all HEAD --; then
+ echo 'Uncommitted changes detected:';
+ git diff-index HEAD --;
+ return 1;
+ fi;
+ }
+script:
+ - make crystal crystal11
+ - make compare
+# - check_status
+
diff --git a/audio/cries.asm b/audio/cries.asm
index d6429b78f..66b6d3c98 100644
--- a/audio/cries.asm
+++ b/audio/cries.asm
@@ -174,7 +174,7 @@ Cry_Mantine: ; f2e74
Cry_Entei_Ch5: ; f2e7d
soundinput $ff
- unknownmusic0xde $63
+ sound_duty 3, 0, 2, 1
sound __, 2, $f8, $05f8
sound __, 9, $9f, $04d8
sound __, 7, $f8, $05c4
@@ -184,7 +184,7 @@ Cry_Entei_Ch5: ; f2e7d
; f2e94
Cry_Entei_Ch6: ; f2e94
- unknownmusic0xde $33
+ sound_duty 3, 0, 3, 0
sound __, 2, $c8, $0640
sound __, 7, $ff, $0668
sound __, 8, $a8, $0534
@@ -201,7 +201,7 @@ Cry_Entei_Ch8: ; f2ea7
; f2eb4
Cry_Magcargo_Ch5: ; f2eb4
- unknownmusic0xde $c4
+ sound_duty 0, 1, 0, 3
sound __, 5, $af, $0720
sound __, 3, $f8, $071c
sound __, 3, $f8, $0718
@@ -213,7 +213,7 @@ Cry_Magcargo_Ch5: ; f2eb4
; f2ed3
Cry_Magcargo_Ch6: ; f2ed3
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 2, $b8, $0710
sound __, 4, $d8, $072c
sound __, 5, $d8, $0665
@@ -235,7 +235,7 @@ Cry_Magcargo_branch_f2ef5: ; f2ef5
; f2f03
Cry_Dunsparce_Ch5: ; f2f03
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 2, $f8, $05b0
sound __, 2, $f8, $04b4
sound __, 2, $f8, $05b8
@@ -249,7 +249,7 @@ Cry_Dunsparce_Ch5: ; f2f03
; f2f26
Cry_Dunsparce_Ch6: ; f2f26
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 9, $b8, $04c8
sound C#, 1, $b5, $0410
endchannel
@@ -263,7 +263,7 @@ Cry_Dunsparce_Ch8: ; f2f31
; f2f3b
Cry_Slowking_Ch5: ; f2f3b
- unknownmusic0xde $33
+ sound_duty 3, 0, 3, 0
sound __, 3, $f1, $0550
sound __, 3, $f1, $0530
sound __, 3, $f1, $0510
@@ -275,7 +275,7 @@ Cry_Slowking_Ch5: ; f2f3b
; f2f5a
Cry_Slowking_Ch6: ; f2f5a
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
sound __, 5, $e1, $0620
sound __, 6, $e2, $0500
sound __, 7, $e1, $0620
@@ -312,7 +312,7 @@ Cry_Pichu_Ch5: ; f2f8a
; f2fab
Cry_Pichu_Ch6: ; f2fab
- unknownmusic0xde $10
+ sound_duty 0, 0, 1, 0
sound __, 3, $c8, $076d
sound __, 3, $c8, $0771
sound __, 3, $c8, $078d
@@ -331,7 +331,7 @@ Cry_Pichu_Ch8: ; f2fc2
; f2fd2
Cry_Marill_Ch5: ; f2fd2
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 3, $88, $06d8
sound __, 9, $e2, $06e0
sound __, 3, $61, $06e5
@@ -343,7 +343,7 @@ Cry_Marill_Ch5: ; f2fd2
; f2ff1
Cry_Marill_Ch6: ; f2ff1
- unknownmusic0xde $63
+ sound_duty 3, 0, 2, 1
sound __, 3, $68, $06b1
sound __, 6, $c1, $06b9
sound __, 6, $99, $0760
@@ -367,7 +367,7 @@ Cry_Togepi_Ch5: ; f301f
tone $0002
Cry_Togepi_Ch6: ; f3022
Cry_Togetic_branch_f3022: ; f3022
- unknownmusic0xde $52
+ sound_duty 2, 0, 1, 1
sound __, 5, $f1, $0796
sound __, 5, $f1, $072d
sound __, 8, $0, 0
@@ -396,7 +396,7 @@ Cry_Spinarak_Ch5: ; f3048
; f305b
Cry_Spinarak_Ch6: ; f305b
- unknownmusic0xde $2a
+ sound_duty 2, 2, 2, 0
sound __, 4, $2c, $07c7
sound __, 2, $0, 0
sound __, 6, $59, $07be
@@ -413,7 +413,7 @@ Cry_Spinarak_Ch8: ; f306e
; f307b
Cry_Raikou_Ch5: ; f307b
- unknownmusic0xde $f8
+ sound_duty 0, 2, 3, 3
sound __, 3, $f1, $04b0
sound __, 3, $f7, $0590
sound __, 9, $f8, $0510
@@ -425,7 +425,7 @@ Cry_Raikou_Ch5: ; f307b
; f309a
Cry_Raikou_Ch6: ; f309a
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
sound __, 3, $f1, $0720
sound __, 3, $e1, $0650
sound __, 5, $f1, $0750
@@ -450,7 +450,7 @@ Cry_Raikou_Ch8: ; f30bd
; f30d6
Cry_Hoothoot_Ch5: ; f30d6
- unknownmusic0xde $66
+ sound_duty 2, 1, 2, 1
sound __, 5, $78, $0650
sound __, 5, $f8, $0660
sound __, 5, $f8, $065c
@@ -463,7 +463,7 @@ Cry_Hoothoot_Ch5: ; f30d6
; f30f9
Cry_Hoothoot_Ch6: ; f30f9
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
Cry_Hoothoot_branch_f30fb: ; f30fb
sound __, 3, $a1, $0600
loopchannel 3, Cry_Hoothoot_branch_f30fb
@@ -490,7 +490,7 @@ Cry_Sentret_Ch5: ; f3121
; f3129
Cry_Sentret_Ch6: ; f3129
- unknownmusic0xde $1b
+ sound_duty 3, 2, 1, 0
Cry_Sentret_branch_f312b: ; f312b
sound __, 9, $39, $072d
sound __, 9, $f1, $0720
@@ -510,7 +510,7 @@ Cry_Mareep_Ch5: ; f313b
; f3143
Cry_Mareep_Ch6: ; f3143
- unknownmusic0xde $1
+ sound_duty 1, 0, 0, 0
Cry_Mareep_branch_f3145: ; f3145
Cry_Gligar_branch_f3145: ; f3145
sound __, 5, $3a, $073d
@@ -546,7 +546,7 @@ Cry_Gligar_Ch8: ; f3178
Cry_Chikorita_Ch5: ; f317f
tone $0020
Cry_Chikorita_Ch6: ; f3182
- unknownmusic0xde $21
+ sound_duty 1, 0, 2, 0
sound __, 3, $c8, $0641
sound __, 3, $48, $0641
sound __, 7, $f8, $0790
@@ -562,7 +562,7 @@ Cry_Chikorita_Ch8: ; f3199
; f31a0
Cry_Gligar_Ch5: ; f31a0
- unknownmusic0xde $a2
+ sound_duty 2, 0, 2, 2
jumpchannel Cry_Gligar_branch_f3145
; f31a5
@@ -573,7 +573,7 @@ Cry_Girafarig_Ch5: ; f31a5
; f31ad
Cry_Girafarig_Ch6: ; f31ad
- unknownmusic0xde $41
+ sound_duty 1, 0, 0, 1
Cry_Girafarig_branch_f31af: ; f31af
sound __, 5, $68, $0758
sound __, 3, $e8, $0760
@@ -593,7 +593,7 @@ Cry_Girafarig_Ch8: ; f31c4
; f31d4
Cry_Slugma_Ch5: ; f31d4
- unknownmusic0xde $91
+ sound_duty 1, 0, 1, 2
sound __, 13, $f2, $07a6
sound __, 5, $f8, $07b0
sound __, 5, $e8, $03b0
@@ -617,7 +617,7 @@ Cry_Ledyba_Ch5: ; f31f8
; f3200
Cry_Ledyba_Ch6: ; f3200
- unknownmusic0xde $1
+ sound_duty 1, 0, 0, 0
Cry_Ledyba_branch_f3202: ; f3202
sound __, 4, $f8, $0791
sound __, 4, $d8, $078d
@@ -652,7 +652,7 @@ Cry_Donphan_Ch5: ; f322e
Cry_Wooper_Ch6: ; f3249
Cry_Donphan_Ch6: ; f3249
- unknownmusic0xde $7
+ sound_duty 3, 1, 0, 0
sound __, 3, $b9, $0738
sound __, 5, $cb, $0742
sound __, 9, $cb, $0754
@@ -682,7 +682,7 @@ Cry_Donphan_Ch8: ; f3274
Cry_Typhlosion_Ch5: ; f3284
Cry_Teddiursa_Ch5: ; f3284
- unknownmusic0xde $12
+ sound_duty 2, 0, 1, 0
Cry_Typhlosion_branch_f3286: ; f3286
Cry_Teddiursa_branch_f3286: ; f3286
sound __, 4, $c1, $0791
@@ -711,7 +711,7 @@ Cry_Teddiursa_branch_f32ae: ; f32ae
Cry_Typhlosion_Ch6: ; f32bb
Cry_Teddiursa_Ch6: ; f32bb
- unknownmusic0xde $78
+ sound_duty 0, 2, 3, 1
sound __, 9, $99, $0740
sound __, 9, $79, $0746
sound C_, 1, $f6, $078d
@@ -731,7 +731,7 @@ Cry_Typhlosion_Ch8: ; f32da
; f32e7
Cry_Natu_Ch5: ; f32e7
- unknownmusic0xde $de
+ sound_duty 2, 3, 1, 3
Cry_Mantine_branch_f32e9: ; f32e9
Cry_Sunflora_branch_f32e9: ; f32e9
sound __, 5, $f8, $07b1
@@ -747,7 +747,7 @@ Cry_Mantine_branch_f32f5: ; f32f5
Cry_Mantine_branch_f3302: ; f3302
Cry_Natu_Ch6: ; f3302
Cry_Sunflora_Ch6: ; f3302
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
sound __, 5, $f8, $07b2
sound __, 5, $f8, $07b1
sound __, 5, $28, $07b0
@@ -802,7 +802,7 @@ Cry_Mantine_Ch8: ; f334c
; f3353
Cry_Ampharos_Ch5: ; f3353
- unknownmusic0xde $de
+ sound_duty 2, 3, 1, 3
Cry_Ampharos_branch_f3355: ; f3355
sound __, 2, $c1, $0520
sound __, 2, $a1, $0420
@@ -815,7 +815,7 @@ Cry_Ampharos_branch_f3355: ; f3355
; f3370
Cry_Ampharos_Ch6: ; f3370
- unknownmusic0xde $32
+ sound_duty 2, 0, 3, 0
sound __, 9, $f8, $0700
sound __, 8, $f8, $0720
sound __, 5, $f8, $0790
@@ -835,7 +835,7 @@ Cry_Ampharos_Ch8: ; f3387
; f339a
Cry_Totodile_Ch5: ; f339a
- unknownmusic0xde $32
+ sound_duty 2, 0, 3, 0
sound __, 9, $f8, $0330
sound __, 9, $f8, $0340
sound __, 9, $c8, $07b2
@@ -845,7 +845,7 @@ Cry_Totodile_Ch5: ; f339a
; f33b1
Cry_Totodile_Ch6: ; f33b1
- unknownmusic0xde $12
+ sound_duty 2, 0, 1, 0
sound __, 9, $e8, $0320
sound __, 9, $e8, $0328
sound __, 9, $98, $0780
@@ -863,7 +863,7 @@ Cry_Totodile_Ch8: ; f33c8
; f33d5
Cry_Cleffa_Ch5: ; f33d5
- unknownmusic0xde $39
+ sound_duty 1, 2, 3, 0
soundinput $ff
sound __, 3, $f8, $0720
sound __, 3, $f8, $0727
@@ -879,7 +879,7 @@ Cry_Cleffa_Ch5: ; f33d5
; f33fc
Cry_Cleffa_Ch6: ; f33fc
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 7, $b2, $071e
sound __, 6, $92, $0779
sound __, 5, $82, $073e
@@ -898,7 +898,7 @@ Cry_Cleffa_Ch8: ; f340f
; f3422
Cry_Aipom_Ch5: ; f3422
- unknownmusic0xde $d2
+ sound_duty 2, 0, 1, 3
sound __, 4, $f8, $06b0
sound __, 2, $f8, $06a5
sound __, 2, $f8, $069d
@@ -910,7 +910,7 @@ Cry_Aipom_Ch5: ; f3422
; f3441
Cry_Aipom_Ch6: ; f3441
- unknownmusic0xde $27
+ sound_duty 3, 1, 2, 0
Cry_Aipom_branch_f3443: ; f3443
sound __, 2, $f1, $07b4
loopchannel 8, Cry_Aipom_branch_f3443
@@ -1167,7 +1167,7 @@ Cry_Weepinbell: ; f35ca
; f35d3
Unknown_Cry_Ch5: ; f35d3
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $e0, $0780
sound __, 16, $f0, $0784
sound __, 16, $c3, $05e0
@@ -1178,7 +1178,7 @@ Unknown_Cry_Ch5: ; f35d3
; f35ee
Unknown_Cry_Ch6: ; f35ee
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 16, $a0, $0741
sound __, 16, $b0, $0743
sound __, 16, $93, $05b1
@@ -1200,11 +1200,11 @@ Unknown_Cry_Ch8: ; f3609
; f361f
Cry_Raichu_Ch5: ; f361f
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f7, $07a0
sound __, 7, $e6, $07a3
sound __, 11, $f4, $07a0
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 11, $f6, $07d8
sound __, 5, $e3, $07d7
sound __, 16, $f2, $07d8
@@ -1212,12 +1212,12 @@ Cry_Raichu_Ch5: ; f361f
; f363c
Cry_Raichu_Ch6: ; f363c
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 3, $8, 0
sound __, 16, $a7, $06a1
sound __, 7, $86, $06a2
sound __, 11, $74, $06a1
- unknownmusic0xde $5f
+ sound_duty 3, 3, 1, 1
sound __, 11, $76, $06d6
sound __, 5, $83, $06d9
sound __, 16, $a2, $06d7
@@ -1237,7 +1237,7 @@ Cry_Raichu_Ch8: ; f365d
; f3676
Cry_Vileplume_Ch5: ; f3676
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f7, $07c0
sound __, 7, $e4, $07c1
sound __, 11, $f6, $07c0
@@ -1247,7 +1247,7 @@ Cry_Vileplume_Ch5: ; f3676
; f368d
Cry_Vileplume_Ch6: ; f368d
- unknownmusic0xde $5f
+ sound_duty 3, 3, 1, 1
sound __, 16, $97, $0781
sound __, 7, $84, $0780
sound __, 11, $96, $0781
@@ -1264,7 +1264,7 @@ Cry_Vileplume_Ch8: ; f36a0
; f36ad
Cry_Vulpix_Ch5: ; f36ad
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f7, $0680
sound __, 11, $e6, $0684
sound __, 16, $d7, $0690
@@ -1277,7 +1277,7 @@ Cry_Vulpix_Ch5: ; f36ad
; f36d0
Cry_Vulpix_Ch6: ; f36d0
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 16, $b7, $0641
sound __, 11, $96, $0642
sound __, 16, $a7, $0651
@@ -1299,7 +1299,7 @@ Cry_Vulpix_Ch8: ; f36f3
; f3703
Cry_Rhydon_Ch5: ; f3703
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f7, $07a0
sound __, 9, $e6, $07a4
sound __, 5, $d6, $07a0
@@ -1311,7 +1311,7 @@ Cry_Rhydon_Ch5: ; f3703
; f3722
Cry_Rhydon_Ch6: ; f3722
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 5, $8, 0
sound __, 7, $a7, $0741
sound __, 9, $86, $0743
@@ -1335,7 +1335,7 @@ Cry_Rhydon_Ch8: ; f3745
; f375b
Cry_Weepinbell_Ch5: ; f375b
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 7, $f4, $0740
sound __, 16, $e3, $0730
sound __, 5, $f4, $0740
@@ -1345,7 +1345,7 @@ Cry_Weepinbell_Ch5: ; f375b
; f3772
Cry_Weepinbell_Ch6: ; f3772
- unknownmusic0xde $77
+ sound_duty 3, 1, 3, 1
sound __, 7, $c3, $0712
sound __, 16, $b3, $0704
sound __, 4, $c3, $0712
@@ -1363,7 +1363,7 @@ Cry_Weepinbell_Ch8: ; f3789
; f3796
Cry_Kangaskhan_Ch5: ; f3796
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f7, $0608
sound __, 7, $e6, $0600
sound __, 7, $d7, $05f0
@@ -1375,7 +1375,7 @@ Cry_Kangaskhan_Ch5: ; f3796
; f37b5
Cry_Kangaskhan_Ch6: ; f37b5
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 5, $c7, $0504
sound __, 7, $a6, $0502
sound __, 7, $97, $04f1
@@ -1395,7 +1395,7 @@ Cry_Kangaskhan_Ch8: ; f37d4
; f37e1
Cry_Bulbasaur_Ch5: ; f37e1
- unknownmusic0xde $f1
+ sound_duty 1, 0, 3, 3
sound __, 5, $f7, $07c0
sound __, 13, $e6, $07c2
sound __, 7, $b5, $0680
@@ -1406,7 +1406,7 @@ Cry_Bulbasaur_Ch5: ; f37e1
; f37fc
Cry_Bulbasaur_Ch6: ; f37fc
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 4, $c7, $0781
sound __, 13, $b6, $0780
sound __, 7, $a5, $0641
@@ -1426,7 +1426,7 @@ Cry_Bulbasaur_Ch8: ; f3817
; f3827
Cry_Spearow_Ch5: ; f3827
- unknownmusic0xde $c9
+ sound_duty 1, 2, 0, 3
sound __, 9, $f7, $0680
sound __, 3, $f7, $0660
sound __, 2, $e7, $0640
@@ -1439,7 +1439,7 @@ Cry_Spearow_Ch5: ; f3827
; f384a
Cry_Spearow_Ch6: ; f384a
- unknownmusic0xde $79
+ sound_duty 1, 2, 3, 1
sound __, 11, $e7, $0682
sound __, 3, $e7, $0662
sound __, 2, $d7, $0642
@@ -1459,7 +1459,7 @@ Cry_Spearow_Ch8: ; f386d
; f3877
Cry_Nidoran_M_Ch5: ; f3877
- unknownmusic0xde $f5
+ sound_duty 1, 1, 3, 3
sound __, 5, $f3, $0718
sound __, 16, $e5, $0798
sound __, 9, $91, $0758
@@ -1467,7 +1467,7 @@ Cry_Nidoran_M_Ch5: ; f3877
; f3886
Cry_Nidoran_M_Ch6: ; f3886
- unknownmusic0xde $a0
+ sound_duty 0, 0, 2, 2
sound __, 6, $b3, $0708
sound __, 16, $c5, $0788
sound __, 9, $71, $0748
@@ -1482,7 +1482,7 @@ Cry_Nidoran_M_Ch8: ; f3895
; f389f
Cry_Pidgey_Ch5: ; f389f
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 5, $e1, $0700
sound __, 5, $f2, $0780
sound __, 3, $92, $0740
@@ -1491,7 +1491,7 @@ Cry_Pidgey_Ch5: ; f389f
; f38b2
Cry_Pidgey_Ch6: ; f38b2
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 5, $b1, $06e1
sound __, 4, $c2, $06e1
sound __, 4, $62, $0681
@@ -1507,7 +1507,7 @@ Cry_Pidgey_Ch8: ; f38c5
; f38cf
Cry_Voltorb_Ch5: ; f38cf
- unknownmusic0xde $fa
+ sound_duty 2, 2, 3, 3
sound __, 7, $83, $0247
sound __, 16, $62, $0226
sound __, 5, $52, $0245
@@ -1529,7 +1529,7 @@ Cry_Voltorb_Ch8: ; f38ea
; f38fd
Cry_Muk_Ch5: ; f38fd
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f3, $06e0
sound __, 16, $e4, $0640
sound __, 9, $c1, $0620
@@ -1537,7 +1537,7 @@ Cry_Muk_Ch5: ; f38fd
; f390c
Cry_Muk_Ch6: ; f390c
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 4, $c3, $0683
sound __, 15, $b4, $0602
sound __, 9, $a1, $0601
@@ -1552,7 +1552,7 @@ Cry_Muk_Ch8: ; f391b
; f3925
Cry_Grimer_Ch5: ; f3925
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 7, $e2, $0500
sound __, 7, $e3, $0580
sound __, 7, $d3, $0570
@@ -1561,7 +1561,7 @@ Cry_Grimer_Ch5: ; f3925
; f3938
Cry_Grimer_Ch6: ; f3938
- unknownmusic0xde $f5
+ sound_duty 1, 1, 3, 3
sound __, 7, $e2, $0482
sound __, 7, $d3, $0501
sound __, 7, $b2, $04e2
@@ -1571,7 +1571,7 @@ Cry_Grimer_Ch8: ; f394a
; f394b
Cry_Diglett_Ch5: ; f394b
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 5, $f1, $0700
sound __, 5, $e1, $0780
sound __, 5, $d1, $0740
@@ -1586,7 +1586,7 @@ Cry_Diglett_Ch5: ; f394b
; f3976
Cry_Diglett_Ch6: ; f3976
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 13, $8, 0
sound __, 5, $f1, $0701
sound __, 5, $e1, $0782
@@ -1610,7 +1610,7 @@ Cry_Diglett_Ch8: ; f3995
; f39ae
Cry_Seel_Ch5: ; f39ae
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 9, $f5, $0600
sound __, 3, $d2, $0638
sound __, 3, $c2, $0630
@@ -1624,7 +1624,7 @@ Cry_Seel_Ch5: ; f39ae
; f39d5
Cry_Seel_Ch6: ; f39d5
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 13, $c3, $05c0
sound __, 4, $b1, $05f9
sound __, 3, $a1, $05f1
@@ -1639,7 +1639,7 @@ Cry_Seel_Ch8: ; f39fb
; f39fc
Cry_Slowpoke_Ch5: ; f39fc
- unknownmusic0xde $0
+ sound_duty 0, 0, 0, 0
sound __, 9, $f5, $0480
sound __, 3, $e1, $05e0
sound __, 9, $d1, $05dc
@@ -1647,7 +1647,7 @@ Cry_Slowpoke_Ch5: ; f39fc
; f3a0b
Cry_Slowpoke_Ch6: ; f3a0b
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 8, $95, $0441
sound __, 3, $81, $0521
sound __, 9, $61, $051a
@@ -1657,7 +1657,7 @@ Cry_Slowpoke_Ch8: ; f3a19
Cry_Drowzee_Ch5: ; f3a1a
Cry_Drowzee_branch_f3a1a: ; f3a1a
- unknownmusic0xde $88
+ sound_duty 0, 2, 0, 2
sound __, 6, $f2, $0650
sound __, 10, $d1, $0660
sound __, 6, $e2, $0612
@@ -1669,7 +1669,7 @@ Cry_Drowzee_branch_f3a1a: ; f3a1a
; f3a39
Cry_Drowzee_Ch6: ; f3a39
- unknownmusic0xde $40
+ sound_duty 0, 0, 0, 1
sound __, 5, $8, 0
sound __, 6, $f2, $0651
sound __, 10, $d1, $0661
@@ -1699,7 +1699,7 @@ Cry_Drowzee_Ch8: ; f3a68
; f3a87
Cry_Nidoran_F_Ch5: ; f3a87
- unknownmusic0xde $a0
+ sound_duty 0, 0, 2, 2
sound __, 5, $f3, $0600
sound __, 9, $d5, $0760
sound __, 4, $e2, $0720
@@ -1708,7 +1708,7 @@ Cry_Nidoran_F_Ch5: ; f3a87
; f3a9a
Cry_Nidoran_F_Ch6: ; f3a9a
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 6, $b3, $06f1
sound __, 8, $c5, $0752
sound __, 4, $a2, $0711
@@ -1725,7 +1725,7 @@ Cry_Nidoran_F_Ch8: ; f3aad
; f3aba
Cry_Nidoqueen_Ch5: ; f3aba
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 9, $f7, $06e0
sound __, 7, $e6, $06e5
sound __, 4, $f4, $06e0
@@ -1737,7 +1737,7 @@ Cry_Nidoqueen_Ch5: ; f3aba
; f3ad9
Cry_Nidoqueen_Ch6: ; f3ad9
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 4, $8, 0
sound __, 9, $a7, $06a1
sound __, 7, $86, $06a3
@@ -1762,7 +1762,7 @@ Cry_Nidoqueen_Ch8: ; f3afc
; f3b15
Cry_Oddish_Ch5: ; f3b15
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f6, $0565
sound __, 11, $e4, $057c
sound __, 4, $c2, $055c
@@ -1771,7 +1771,7 @@ Cry_Oddish_Ch5: ; f3b15
; f3b28
Cry_Oddish_Ch6: ; f3b28
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 15, $d6, $0503
sound __, 10, $b4, $051b
sound __, 5, $92, $04fa
@@ -1787,7 +1787,7 @@ Cry_Oddish_Ch8: ; f3b3b
; f3b45
Cry_Charmander_Ch5: ; f3b45
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f7, $06a0
sound __, 9, $e6, $06a4
sound __, 5, $d6, $06a0
@@ -1799,7 +1799,7 @@ Cry_Charmander_Ch5: ; f3b45
; f3b64
Cry_Charmander_Ch6: ; f3b64
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 5, $e7, $0601
sound __, 9, $d6, $0603
sound __, 5, $c6, $0601
@@ -1821,7 +1821,7 @@ Cry_Charmander_Ch8: ; f3b83
; f3b96
Cry_Clefairy_Ch5: ; f3b96
- unknownmusic0xde $1b
+ sound_duty 3, 2, 1, 0
sound __, 8, $d2, $0740
sound __, 16, $e5, $0760
sound C_, 9, $c1, $0730
@@ -1829,7 +1829,7 @@ Cry_Clefairy_Ch5: ; f3b96
; f3ba5
Cry_Clefairy_Ch6: ; f3ba5
- unknownmusic0xde $81
+ sound_duty 1, 0, 0, 2
sound __, 3, $c2, $0701
sound __, 5, $c2, $0708
sound __, 16, $d7, $0741
@@ -1839,7 +1839,7 @@ Cry_Clefairy_Ch8: ; f3bb7
; f3bb8
Cry_Caterpie_Ch5: ; f3bb8
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $d7, $0780
sound __, 5, $e6, $07a0
sound __, 16, $d2, $0740
@@ -1847,7 +1847,7 @@ Cry_Caterpie_Ch5: ; f3bb8
; f3bc7
Cry_Caterpie_Ch6: ; f3bc7
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 16, $c7, $0753
sound __, 6, $b6, $0772
sound __, 16, $c2, $0711
@@ -1862,7 +1862,7 @@ Cry_Caterpie_Ch8: ; f3bd6
; f3be0
Cry_Lapras_Ch5: ; f3be0
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f7, $06c0
sound __, 16, $e7, $0700
sound __, 5, $f4, $06f0
@@ -1872,7 +1872,7 @@ Cry_Lapras_Ch5: ; f3be0
; f3bf7
Cry_Lapras_Ch6: ; f3bf7
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 8, $e6, $0681
sound __, 15, $d5, $06c1
sound __, 5, $c4, $06b1
@@ -1890,7 +1890,7 @@ Cry_Lapras_Ch8: ; f3c0e
; f3c1b
Cry_Golem_Ch5: ; f3c1b
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 13, $f2, $0440
sound __, 16, $e3, $04a0
sound __, 5, $d2, $0490
@@ -1899,7 +1899,7 @@ Cry_Golem_Ch5: ; f3c1b
; f3c2e
Cry_Golem_Ch6: ; f3c2e
- unknownmusic0xde $ee
+ sound_duty 2, 3, 2, 3
sound __, 12, $d2, $0438
sound __, 15, $c6, $0498
sound __, 4, $b2, $0488
@@ -1916,7 +1916,7 @@ Cry_Golem_Ch8: ; f3c41
; f3c4e
Cry_Blastoise_Ch5: ; f3c4e
- unknownmusic0xde $33
+ sound_duty 3, 0, 3, 0
sound __, 16, $f6, $05c0
sound __, 9, $e3, $05bc
sound __, 7, $d2, $05d0
@@ -1927,7 +1927,7 @@ Cry_Blastoise_Ch5: ; f3c4e
; f3c69
Cry_Blastoise_Ch6: ; f3c69
- unknownmusic0xde $99
+ sound_duty 1, 2, 1, 2
sound __, 15, $c6, $04b1
sound __, 8, $c3, $04ad
sound __, 6, $b2, $04c1
@@ -1948,7 +1948,7 @@ Cry_Blastoise_Ch8: ; f3c84
; f3c97
Cry_Pidgeotto_Ch5: ; f3c97
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 9, $e4, $0790
sound __, 16, $f5, $07c0
sound __, 9, $d1, $07d8
@@ -1956,7 +1956,7 @@ Cry_Pidgeotto_Ch5: ; f3c97
; f3ca6
Cry_Pidgeotto_Ch6: ; f3ca6
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 11, $c4, $0771
sound __, 16, $b6, $07a2
sound __, 9, $a1, $07b7
@@ -1971,7 +1971,7 @@ Cry_Pidgeotto_Ch8: ; f3cb5
; f3cbf
Cry_Paras_Ch5: ; f3cbf
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f2, $0600
sound __, 7, $e2, $0640
sound __, 7, $d2, $0680
@@ -1984,7 +1984,7 @@ Cry_Paras_Ch5: ; f3cbf
; f3ce2
Cry_Paras_Ch6: ; f3ce2
- unknownmusic0xde $11
+ sound_duty 1, 0, 1, 0
sound __, 4, $8, $0001
sound __, 7, $c2, $05c1
sound __, 7, $b2, $0602
@@ -2011,7 +2011,7 @@ Cry_Paras_Ch8: ; f3d09
; f3d25
Cry_Weedle_Ch5: ; f3d25
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f3, $0780
sound __, 16, $e7, $0700
sound __, 9, $d3, $0710
@@ -2022,7 +2022,7 @@ Cry_Weedle_Ch5: ; f3d25
; f3d40
Cry_Weedle_Ch6: ; f3d40
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 7, $c3, $0701
sound __, 15, $b7, $0681
sound __, 8, $b3, $0692
@@ -2043,7 +2043,7 @@ Cry_Weedle_Ch8: ; f3d5b
; f3d6e
Cry_Ekans_Ch5: ; f3d6e
- unknownmusic0xde $f
+ sound_duty 3, 3, 0, 0
sound __, 16, $f7, $0500
sound __, 16, $e7, $0508
sound __, 9, $b4, $0480
@@ -2052,7 +2052,7 @@ Cry_Ekans_Ch5: ; f3d6e
; f3d81
Cry_Ekans_Ch6: ; f3d81
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 15, $d7, $0481
sound __, 15, $c7, $0489
sound __, 11, $b4, $0401
@@ -2069,7 +2069,7 @@ Cry_Ekans_Ch8: ; f3d94
; f3da1
Cry_Metapod_Ch5: ; f3da1
- unknownmusic0xde $f5
+ sound_duty 1, 1, 3, 3
sound __, 8, $d6, $07e1
sound __, 7, $c6, $07e2
sound __, 10, $d6, $07e1
@@ -2082,7 +2082,7 @@ Cry_Metapod_Ch5: ; f3da1
; f3dc4
Cry_Metapod_Ch6: ; f3dc4
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 7, $c3, $07c9
sound __, 7, $b3, $07c7
sound __, 11, $c4, $07c3
@@ -2102,7 +2102,7 @@ Cry_Metapod_Ch8: ; f3ddf
; f3def
Cry_Venonat_Ch5: ; f3def
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f7, $0740
sound __, 13, $e6, $0744
sound __, 7, $d5, $0750
@@ -2113,7 +2113,7 @@ Cry_Venonat_Ch5: ; f3def
; f3e0a
Cry_Venonat_Ch6: ; f3e0a
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 7, $c7, $0701
sound __, 12, $b6, $0702
sound __, 7, $a5, $0711
@@ -2134,7 +2134,7 @@ Cry_Venonat_Ch8: ; f3e25
; f3e38
Cry_Squirtle_Ch5: ; f3e38
- unknownmusic0xde $f4
+ sound_duty 0, 1, 3, 3
sound __, 16, $f0, $0705
sound __, 11, $e0, $0700
sound __, 7, $b4, $0710
@@ -2145,7 +2145,7 @@ Cry_Squirtle_Ch5: ; f3e38
; f3e53
Cry_Squirtle_Ch6: ; f3e53
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 16, $b0, $06c3
sound __, 11, $a0, $06c1
sound __, 7, $84, $06d2
@@ -2165,7 +2165,7 @@ Cry_Squirtle_Ch8: ; f3e6e
; f3e7e
Cry_Fearow_Ch5: ; f3e7e
- unknownmusic0xde $50
+ sound_duty 0, 0, 1, 1
sound __, 11, $f5, $0680
sound __, 4, $e2, $06a0
sound __, 4, $f2, $06c0
@@ -2178,7 +2178,7 @@ Cry_Fearow_Ch5: ; f3e7e
; f3ea1
Cry_Fearow_Ch6: ; f3ea1
- unknownmusic0xde $f
+ sound_duty 3, 3, 0, 0
sound __, 10, $d5, $0631
sound __, 4, $d2, $0652
sound __, 4, $e2, $0671
@@ -2201,7 +2201,7 @@ Cry_Fearow_Ch8: ; f3ec4
; f3ed7
Cry_Growlithe_Ch5: ; f3ed7
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 4, $f4, $0641
sound __, 14, $d6, $0721
sound __, 9, $f4, $0719
@@ -2210,7 +2210,7 @@ Cry_Growlithe_Ch5: ; f3ed7
; f3eea
Cry_Growlithe_Ch6: ; f3eea
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 5, $f4, $0580
sound __, 15, $e6, $06e0
sound __, 9, $d5, $06d8
@@ -2227,7 +2227,7 @@ Cry_Growlithe_Ch8: ; f3efd
; f3f0a
Cry_Krabby_Ch5: ; f3f0a
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 14, $f1, $0511
sound __, 14, $e1, $0515
sound __, 14, $e1, $0511
@@ -2236,7 +2236,7 @@ Cry_Krabby_Ch5: ; f3f0a
; f3f1d
Cry_Krabby_Ch6: ; f3f1d
- unknownmusic0xde $15
+ sound_duty 1, 1, 1, 0
sound __, 13, $e1, $050c
sound __, 13, $d1, $0510
sound __, 15, $c1, $050c
@@ -2253,7 +2253,7 @@ Cry_Krabby_Ch8: ; f3f30
; f3f3d
Cry_Psyduck_Ch5: ; f3f3d
- unknownmusic0xde $1b
+ sound_duty 3, 2, 1, 0
sound __, 4, $f3, $0564
sound __, 3, $e2, $0544
sound __, 6, $d1, $0522
@@ -2266,7 +2266,7 @@ Cry_Psyduck_Ch5: ; f3f3d
; f3f60
Cry_Psyduck_Ch6: ; f3f60
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 4, $d3, $0560
sound __, 3, $c2, $0540
sound __, 6, $c1, $0520
@@ -2280,7 +2280,7 @@ Cry_Psyduck_Ch8: ; f3f82
; f3f83
Cry_Rattata_Ch5: ; f3f83
- unknownmusic0xde $11
+ sound_duty 1, 0, 1, 0
sound __, 3, $3d, $0381
sound __, 8, $f5, $0601
sound __, 2, $c2, $0481
@@ -2289,7 +2289,7 @@ Cry_Rattata_Ch5: ; f3f83
; f3f96
Cry_Rattata_Ch6: ; f3f96
- unknownmusic0xde $ee
+ sound_duty 2, 3, 2, 3
sound __, 3, $3e, $05b0
sound __, 8, $d5, $075d
sound __, 2, $b2, $06b0
diff --git a/audio/engine.asm b/audio/engine.asm
index c8e976cc4..2cc921bd0 100644
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -111,7 +111,7 @@ _UpdateSound:: ; e805c
cp $2 ; 1 or 0?
jr c, .noteover
dec [hl]
- jr .asm_e8093
+ jr .continue_sound_update
.noteover
; reset vibrato delay
@@ -124,12 +124,11 @@ _UpdateSound:: ; e805c
; turn vibrato off for now
ld hl, Channel1Flags2 - Channel1
add hl, bc
- res SOUND_UNKN_09, [hl]
+ res SOUND_PITCH_WHEEL, [hl]
; get next note
call ParseMusic
-.asm_e8093
- ;
- call Functione84f9
+.continue_sound_update
+ call ApplyPitchWheel
; duty cycle
ld hl, Channel1DutyCycle - Channel1
add hl, bc
@@ -143,8 +142,8 @@ _UpdateSound:: ; e805c
ld [wCurTrackFrequency], a
ld a, [hl]
ld [wCurTrackFrequency + 1], a
- ;
- call Functione8466 ; handle vibrato and other things
+ ; vibrato, noise
+ call HandleTrackVibrato ; handle vibrato and other things
call HandleNoise
; turn off music when playing sfx?
ld a, [SFXPriority]
@@ -176,19 +175,19 @@ _UpdateSound:: ; e805c
; are we in a sfx channel right now?
ld a, [CurChannel]
cp $4 ; sfx
- jr nc, .asm_e80ee
+ jr nc, .sfx_channel
ld hl, Channel5Flags - Channel1
add hl, bc
bit SOUND_CHANNEL_ON, [hl]
- jr nz, .asm_e80fc
-.asm_e80ee
+ jr nz, .sound_channel_on
+.sfx_channel
call UpdateChannels
ld hl, Channel1Tracks - Channel1
add hl, bc
ld a, [SoundOutput]
or [hl]
ld [SoundOutput], a
-.asm_e80fc
+.sound_channel_on
; clear note flags
ld hl, Channel1NoteFlags - Channel1
add hl, bc
@@ -232,7 +231,6 @@ UpdateChannels: ; e8125
ld l, a
jp [hl]
-
.ChannelFnPtrs:
dw .Channel1
dw .Channel2
@@ -260,21 +258,21 @@ UpdateChannels: ; e8125
.asm_e8159
bit NOTE_REST, [hl] ; rest
jr nz, .ch1rest
- bit NOTE_UNKN_4, [hl]
+ bit NOTE_NOISE_SAMPLING, [hl]
jr nz, .asm_e81a2
- bit NOTE_UNKN_1, [hl]
- jr nz, .asm_e816b
- bit NOTE_UNKN_6, [hl]
+ bit NOTE_FREQ_OVERRIDE, [hl]
+ jr nz, .frequency_override
+ bit NOTE_VIBRATO_OVERRIDE, [hl]
jr nz, .asm_e8184
- jr .asm_e8175
+ jr .check_duty_override
-.asm_e816b
+.frequency_override
ld a, [wCurTrackFrequency]
ld [rNR13], a
ld a, [wCurTrackFrequency + 1]
ld [rNR14], a
-.asm_e8175
- bit NOTE_UNKN_0, [hl]
+.check_duty_override
+ bit NOTE_DUTY_OVERRIDE, [hl]
ret z
ld a, [wCurTrackDuty]
ld d, a
@@ -323,11 +321,11 @@ UpdateChannels: ; e8125
add hl, bc
bit NOTE_REST, [hl] ; rest
jr nz, .ch2rest
- bit NOTE_UNKN_4, [hl]
+ bit NOTE_NOISE_SAMPLING, [hl]
jr nz, .asm_e8204
- bit NOTE_UNKN_6, [hl]
+ bit NOTE_VIBRATO_OVERRIDE, [hl]
jr nz, .asm_e81e6
- bit NOTE_UNKN_0, [hl]
+ bit NOTE_DUTY_OVERRIDE, [hl]
ret z
ld a, [wCurTrackDuty]
ld d, a
@@ -383,9 +381,9 @@ UpdateChannels: ; e8125
add hl, bc
bit NOTE_REST, [hl] ; rest
jr nz, .ch3rest
- bit NOTE_UNKN_4, [hl]
+ bit NOTE_NOISE_SAMPLING, [hl]
jr nz, .asm_e824d
- bit NOTE_UNKN_6, [hl]
+ bit NOTE_VIBRATO_OVERRIDE, [hl]
jr nz, .asm_e823a
ret
@@ -484,7 +482,7 @@ endr
add hl, bc
bit NOTE_REST, [hl] ; rest
jr nz, .ch4rest
- bit NOTE_UNKN_4, [hl]
+ bit NOTE_NOISE_SAMPLING, [hl]
jr nz, .asm_e82d4
ret
@@ -644,7 +642,6 @@ FadeMusic: ; e8358
dec a
jr .updatevolume
-
.novolume
; make sure volume is off
xor a
@@ -719,16 +716,16 @@ FadeMusic: ; e8358
; e83d1
LoadNote: ; e83d1
- ; check mute??
+ ; wait for pitch wheel to finish
ld hl, Channel1Flags2 - Channel1
add hl, bc
- bit SOUND_UNKN_09, [hl]
+ bit SOUND_PITCH_WHEEL, [hl]
ret z
; get note duration
ld hl, Channel1NoteDuration - Channel1
add hl, bc
ld a, [hl]
- ld hl, wc297 ; ????
+ ld hl, wCurNoteDuration
sub [hl]
jr nc, .ok
ld a, 1
@@ -740,8 +737,8 @@ LoadNote: ; e83d1
ld e, [hl]
inc hl
ld d, [hl]
- ; ????
- ld hl, Channel1Field0x21 - Channel1
+ ; get direction of pitch wheel
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, e
sub [hl]
@@ -749,15 +746,13 @@ LoadNote: ; e83d1
ld a, d
sbc a, 0
ld d, a
- ; ????
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
sub [hl]
jr nc, .greater_than
- ; ????
ld hl, Channel1Flags3 - Channel1
add hl, bc
- set SOUND_UNKN_11, [hl]
+ set SOUND_PITCH_WHEEL_DIR, [hl]
; get frequency
ld hl, Channel1Frequency - Channel1
add hl, bc
@@ -765,7 +760,7 @@ LoadNote: ; e83d1
inc hl
ld d, [hl]
; ????
- ld hl, Channel1Field0x21 - Channel1
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, [hl]
sub e
@@ -774,7 +769,7 @@ LoadNote: ; e83d1
sbc a, 0
ld d, a
; ????
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld a, [hl]
sub d
@@ -782,18 +777,17 @@ LoadNote: ; e83d1
jr .resume
.greater_than
- ; ????
ld hl, Channel1Flags3 - Channel1
add hl, bc
- res SOUND_UNKN_11, [hl]
+ res SOUND_PITCH_WHEEL_DIR, [hl]
; get frequency
ld hl, Channel1Frequency - Channel1
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
- ; ????
- ld hl, Channel1Field0x21 - Channel1
+ ; get distance from pitch wheel target
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, e
sub [hl]
@@ -801,15 +795,17 @@ LoadNote: ; e83d1
ld a, d
sbc a, 0
ld d, a
- ; ????
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
sub [hl]
ld d, a
.resume
+ ; de = x * [wCurNoteDuration] + y
+ ; x + 1 -> d
+ ; y -> a
push bc
- ld hl, wc297
- ld b, 0; loop count
+ ld hl, wCurNoteDuration
+ ld b, 0 ; quotient
.loop
inc b
ld a, e
@@ -823,18 +819,16 @@ LoadNote: ; e83d1
jr .loop
.quit
- ld a, e ; result
+ ld a, e ; remainder
add [hl]
- ld d, b ; loop count
- ; ????
+ ld d, b ; quotient
pop bc
- ld hl, Channel1Field0x23 - Channel1
+ ld hl, Channel1PitchWheelAmount - Channel1
add hl, bc
- ld [hl], d
- ld hl, Channel1Field0x24 - Channel1
+ ld [hl], d ; quotient
+ ld hl, Channel1PitchWheelAmountFraction - Channel1
add hl, bc
- ld [hl], a
- ; clear ????
+ ld [hl], a ; remainder
ld hl, Channel1Field0x25 - Channel1
add hl, bc
xor a
@@ -843,14 +837,13 @@ LoadNote: ; e83d1
; e8466
-Functione8466: ; e8466
-; handle vibrato and other things
-; unknowns: wCurTrackDuty, wCurTrackFrequency
+HandleTrackVibrato: ; e8466
+; handle duty, cry pitch, and vibrato
ld hl, Channel1Flags2 - Channel1
add hl, bc
bit SOUND_DUTY, [hl] ; duty
jr z, .next
- ld hl, Channel1Field0x1c - Channel1
+ ld hl, Channel1SFXDutyLoop - Channel1
add hl, bc
ld a, [hl]
rlca
@@ -860,7 +853,7 @@ Functione8466: ; e8466
ld [wCurTrackDuty], a
ld hl, Channel1NoteFlags - Channel1
add hl, bc
- set NOTE_UNKN_0, [hl]
+ set NOTE_DUTY_OVERRIDE, [hl]
.next
ld hl, Channel1Flags2 - Channel1
add hl, bc
@@ -937,9 +930,9 @@ Functione8466: ; e8466
ld d, a
ld a, e
sub d
- jr nc, .asm_e84ef
+ jr nc, .no_carry
ld a, 0
- jr .asm_e84ef
+ jr .no_carry
.down
; vibrato up
@@ -950,24 +943,24 @@ Functione8466: ; e8466
swap a ; move it to lo
;
add e
- jr nc, .asm_e84ef
+ jr nc, .no_carry
ld a, $ff
-.asm_e84ef
+.no_carry
ld [wCurTrackFrequency], a
;
ld hl, Channel1NoteFlags - Channel1
add hl, bc
- set NOTE_UNKN_6, [hl]
+ set NOTE_VIBRATO_OVERRIDE, [hl]
.quit
ret
; e84f9
-Functione84f9: ; e84f9
- ; quit if ????
+ApplyPitchWheel: ; e84f9
+ ; quit if pitch wheel inactive
ld hl, Channel1Flags2 - Channel1
add hl, bc
- bit SOUND_UNKN_09, [hl]
+ bit SOUND_PITCH_WHEEL, [hl]
ret z
; de = Frequency
ld hl, Channel1Frequency - Channel1
@@ -975,24 +968,24 @@ Functione84f9: ; e84f9
ld e, [hl]
inc hl
ld d, [hl]
- ;
+ ; check whether pitch wheel is going up or down
ld hl, Channel1Flags3 - Channel1
add hl, bc
- bit SOUND_UNKN_11, [hl]
- jr z, .next
- ;
- ld hl, Channel1Field0x23 - Channel1
+ bit SOUND_PITCH_WHEEL_DIR, [hl]
+ jr z, .decreasing
+ ; frequency += [Channel*PitchWheelAmount]
+ ld hl, Channel1PitchWheelAmount - Channel1
add hl, bc
ld l, [hl]
ld h, 0
add hl, de
ld d, h
ld e, l
- ; get ????
- ld hl, Channel1Field0x24 - Channel1
+ ; [Channel*Field0x25] += [Channel*PitchWheelAmountFraction]
+ ; if rollover: Frequency += 1
+ ld hl, Channel1PitchWheelAmountFraction - Channel1
add hl, bc
ld a, [hl]
- ; add it to ????
ld hl, Channel1Field0x25 - Channel1
add hl, bc
add [hl]
@@ -1003,23 +996,26 @@ Functione84f9: ; e84f9
ld a, 0
adc d
ld d, a
- ;
- ld hl, Channel1Field0x22 - Channel1
+ ; Compare the dw at [Channel*PitchWheelTarget] to de.
+ ; If frequency is greater, we're finished.
+ ; Otherwise, load the frequency and set two flags.
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld a, [hl]
cp d
- jp c, .quit1
- jr nz, .quit2
- ld hl, Channel1Field0x21 - Channel1
+ jp c, .finished_pitch_wheel
+ jr nz, .continue_pitch_wheel
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, [hl]
cp e
- jp c, .quit1
- jr .quit2
+ jp c, .finished_pitch_wheel
+ jr .continue_pitch_wheel
-.next
+.decreasing
+ ; frequency -= [Channel*PitchWheelAmount]
ld a, e
- ld hl, Channel1Field0x23 - Channel1
+ ld hl, Channel1PitchWheelAmount - Channel1
add hl, bc
ld e, [hl]
sub e
@@ -1027,7 +1023,9 @@ Functione84f9: ; e84f9
ld a, d
sbc a, 0
ld d, a
- ld hl, Channel1Field0x24 - Channel1
+ ; [Channel*Field0x25] *= 2
+ ; if rollover: Frequency -= 1
+ ld hl, Channel1PitchWheelAmountFraction - Channel1
add hl, bc
ld a, [hl]
add a
@@ -1037,28 +1035,31 @@ Functione84f9: ; e84f9
ld e, a
ld a, d
sbc a, 0
- ld d,a
- ld hl, Channel1Field0x22 - Channel1
+ ld d, a
+ ; Compare the dw at [Channel*PitchWheelTarget] to de.
+ ; If frequency is lower, we're finished.
+ ; Otherwise, load the frequency and set two flags.
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld a, d
cp [hl]
- jr c, .quit1
- jr nz, .quit2
- ld hl, Channel1Field0x21 - Channel1
+ jr c, .finished_pitch_wheel
+ jr nz, .continue_pitch_wheel
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, e
cp [hl]
- jr nc, .quit2
-.quit1
+ jr nc, .continue_pitch_wheel
+.finished_pitch_wheel
ld hl, Channel1Flags2 - Channel1
add hl, bc
- res SOUND_UNKN_09, [hl]
+ res SOUND_PITCH_WHEEL, [hl]
ld hl, Channel1Flags3 - Channel1
add hl, bc
- res SOUND_UNKN_11, [hl]
+ res SOUND_PITCH_WHEEL_DIR, [hl]
ret
-.quit2
+.continue_pitch_wheel
ld hl, Channel1Frequency - Channel1
add hl, bc
ld [hl], e
@@ -1066,8 +1067,8 @@ Functione84f9: ; e84f9
ld [hl], d
ld hl, Channel1NoteFlags - Channel1
add hl, bc
- set NOTE_UNKN_1, [hl]
- set NOTE_UNKN_0, [hl]
+ set NOTE_FREQ_OVERRIDE, [hl]
+ set NOTE_DUTY_OVERRIDE, [hl]
ret
; e858c
@@ -1144,7 +1145,7 @@ ReadNoiseSample: ; e85af
ld hl, Channel1NoteFlags - Channel1
add hl, bc
- set NOTE_UNKN_4, [hl]
+ set NOTE_NOISE_SAMPLING, [hl]
ret
.quit
@@ -1170,9 +1171,9 @@ ParseMusic: ; e85e1
ld hl, Channel1Flags - Channel1
add hl, bc
bit SOUND_SFX, [hl]
- jp nz, Functione8698
+ jp nz, ParseSFXOrRest
bit SOUND_REST, [hl] ; rest
- jp nz, Functione8698
+ jp nz, ParseSFXOrRest
bit SOUND_NOISE, [hl] ; noise sample
jp nz, GetNoiseSample
; normal note
@@ -1205,11 +1206,9 @@ ParseMusic: ; e85e1
; ????
ld hl, Channel1NoteFlags - Channel1
add hl, bc
- set NOTE_UNKN_4, [hl]
+ set NOTE_NOISE_SAMPLING, [hl]
jp LoadNote
-
-
.rest
; note = rest
ld hl, Channel1NoteFlags - Channel1
@@ -1217,7 +1216,6 @@ ParseMusic: ; e85e1
set NOTE_REST, [hl] ; Rest
ret
-;
.endchannel
; $ff is reached in music data
ld hl, Channel1Flags - Channel1
@@ -1286,11 +1284,11 @@ RestoreVolume: ; e8679
; e8698
-Functione8698: ; e8698
+ParseSFXOrRest: ; e8698
; turn noise sampling on
ld hl, Channel1NoteFlags - Channel1
add hl, bc
- set NOTE_UNKN_4, [hl] ; noise sample
+ set NOTE_NOISE_SAMPLING, [hl] ; noise sample
; update note duration
ld a, [CurMusicByte]
call SetNoteDuration ; top nybble doesnt matter?
@@ -1348,9 +1346,8 @@ GetNoiseSample: ; e86c5
ld d, 0
; load ptr to noise sample set in hl
ld hl, Drumkits
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1363,9 +1360,8 @@ endr
; use 'pitch' to seek noise sample set
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
; load sample pointer into NoiseSampleAddress
ld a, [hli]
ld [NoiseSampleAddressLo], a
@@ -1387,9 +1383,8 @@ ParseMusicCommand: ; e870f
ld d, 0
; seek command pointer
ld hl, MusicCommands
-rept 2
add hl, de
-endr
+ add hl, de
; jump to the new pointer
ld a, [hli]
ld h, [hl]
@@ -1415,9 +1410,9 @@ MusicCommands: ; e8720
dw Music_DutyCycle ; duty cycle
dw Music_Intensity ; intensity
dw Music_SoundStatus ; update sound status
- dw MusicDE ; ???? + duty cycle
- dw Music_ToggleSFX ;
- dw MusicE0 ;
+ dw Music_SoundDuty ; sfx duty
+ dw Music_ToggleSFX ; sound on/off
+ dw Music_SlidePitchTo ; pitch wheel
dw Music_Vibrato ; vibrato
dw MusicE2 ; unused
dw Music_ToggleNoise ; music noise sampling
@@ -1443,8 +1438,8 @@ MusicCommands: ; e8720
dw MusicF7 ; nothing
dw MusicF8 ; nothing
dw MusicF9 ; unused
- dw Music_SetCondition ;
- dw Music_JumpIf ;
+ dw Music_SetCondition ; setcondition
+ dw Music_JumpIf ; jumpif
dw Music_JumpChannel ; jump
dw Music_LoopChannel ; loop
dw Music_CallChannel ; call
@@ -1639,9 +1634,8 @@ Music_JumpIf: ; e8817
inc hl
ld d, [hl]
; skip pointer
-rept 2
inc de
-endr
+ inc de
; update address
ld [hl], d
dec hl
@@ -1693,9 +1687,8 @@ MusicEE; e883e
inc hl
ld d, [hl]
; skip pointer
-rept 2
inc de
-endr
+ inc de
; update address
ld [hl], d
dec hl
@@ -1801,38 +1794,42 @@ Music_Vibrato: ; e8882
; e88bd
-MusicE0: ; e88bd
-; ????
+Music_SlidePitchTo: ; e88bd
+; set the target for pitch wheel
; params: 2
+; note duration
+; target note
call GetMusicByte
- ld [wc297], a
+ ld [wCurNoteDuration], a
call GetMusicByte
+ ; pitch in e
ld d, a
and $f
ld e, a
+ ; octave in d
ld a, d
swap a
and $f
ld d, a
call GetFrequency
- ld hl, Channel1Field0x21 - Channel1
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld [hl], e
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld [hl], d
ld hl, Channel1Flags2 - Channel1
add hl, bc
- set SOUND_UNKN_09, [hl]
+ set SOUND_PITCH_WHEEL, [hl]
ret
; e88e4
Music_Tone: ; e88e4
; tone
-; params: 2
+; params: 1 (dw)
ld hl, Channel1Flags2 - Channel1
add hl, bc
set SOUND_CRY_PITCH, [hl]
@@ -1860,18 +1857,17 @@ MusicE7: ; e88f7
; e8906
-MusicDE: ; e8906
-; ???? + duty cycle
-; params: 1
- ;
+Music_SoundDuty: ; e8906
+; sequence of 4 duty cycles to be looped
+; params: 1 (4 2-bit duty cycle arguments)
ld hl, Channel1Flags2 - Channel1
add hl, bc
set SOUND_DUTY, [hl] ; duty cycle
- ;
+ ; sound duty sequence
call GetMusicByte
rrca
rrca
- ld hl, Channel1Field0x1c - Channel1
+ ld hl, Channel1SFXDutyLoop - Channel1
add hl, bc
ld [hl], a
; update duty cycle
@@ -2055,7 +2051,7 @@ Music_ForceOctave: ; e89b1
; this forces all notes up by the starting octave
; params: 1
call GetMusicByte
- ld hl, Channel1StartingOctave - Channel1
+ ld hl, Channel1PitchOffset - Channel1
add hl, bc
ld [hl], a
ret
@@ -2247,7 +2243,7 @@ GetFrequency: ; e8a5d
; get octave
; get starting octave
- ld hl, Channel1StartingOctave - Channel1
+ ld hl, Channel1PitchOffset - Channel1
add hl, bc
ld a, [hl]
swap a ; hi nybble
@@ -2256,7 +2252,7 @@ GetFrequency: ; e8a5d
add d
push af ; we'll use this later
; get starting octave
- ld hl, Channel1StartingOctave - Channel1
+ ld hl, Channel1PitchOffset - Channel1
add hl, bc
ld a, [hl]
and $f ; lo nybble
@@ -2494,9 +2490,9 @@ _PlayCryHeader:: ; e8b79
; 3-byte pointers (bank, address)
ld hl, Cries
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hli]
ld [MusicBank], a
@@ -2574,7 +2570,6 @@ endr
dec a
jr nz, .loop
-
; Cries play at max volume, so we save the current volume for later.
ld a, [LastVolume]
and a
@@ -2694,7 +2689,6 @@ _PlaySFX:: ; e8c04
; e8ca6
-
PlayStereoSFX:: ; e8ca6
; play sfx de
@@ -2713,9 +2707,9 @@ PlayStereoSFX:: ; e8ca6
; get sfx ptr
ld hl, SFX
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
; bank
ld a, [hli]
@@ -2798,7 +2792,6 @@ endr
; e8d1b
-
LoadChannel: ; e8d1b
; prep channel for use
; input:
@@ -2811,9 +2804,8 @@ LoadChannel: ; e8d1b
ld c, a
ld b, 0
ld hl, ChannelPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld c, [hl]
inc hl
ld b, [hl] ; bc = channel pointer
@@ -2891,31 +2883,31 @@ LoadMusicByte:: ; e8d76
; e8d80
FrequencyTable: ; e8d80
- dw 0 ; filler
- dw $f82c
- dw $f89d
- dw $f907
- dw $f96b
- dw $f9ca
- dw $fa23
- dw $fa77
- dw $fac7
- dw $fb12
- dw $fb58
- dw $fb9b
- dw $fbda
- dw $fc16
- dw $fc4e
- dw $fc83
- dw $fcb5
- dw $fce5
- dw $fd11
- dw $fd3b
- dw $fd63
- dw $fd89
- dw $fdac
- dw $fdcd
- dw $fded
+ dw 0 ; __
+ dw $f82c ; C_
+ dw $f89d ; C#
+ dw $f907 ; D_
+ dw $f96b ; D#
+ dw $f9ca ; E_
+ dw $fa23 ; F_
+ dw $fa77 ; F#
+ dw $fac7 ; G_
+ dw $fb12 ; G#
+ dw $fb58 ; A_
+ dw $fb9b ; A#
+ dw $fbda ; B_
+ dw $fc16 ; C_
+ dw $fc4e ; C#
+ dw $fc83 ; D_
+ dw $fcb5 ; D#
+ dw $fce5 ; E_
+ dw $fd11 ; F_
+ dw $fd3b ; F#
+ dw $fd63 ; G_
+ dw $fd89 ; G#
+ dw $fdac ; A_
+ dw $fdcd ; A#
+ dw $fded ; B_
; e8db2
WaveSamples: ; e8db2
@@ -3282,9 +3274,8 @@ ClearChannels:: ; e8fe9
; doesn't seem to be used, but functionally identical to MapSetup_Sound_Off
ld hl, rNR50
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld a, $80
ld [hli], a
ld hl, rNR10
diff --git a/audio/music/clair.asm b/audio/music/clair.asm
index d4ea143b3..bedfc4dee 100644
--- a/audio/music/clair.asm
+++ b/audio/music/clair.asm
@@ -207,9 +207,9 @@ Music_Clair_branch_1fb77: ; 1fb77
octave 3
note A#, 16
note __, 4
- forceoctave $c
+ pitchoffset 0, CC
callchannel Music_Clair_branch_1fba6
- forceoctave $0
+ pitchoffset 0, C_
octave 5
note F#, 2
note __, 4
@@ -254,7 +254,7 @@ Music_Clair_branch_1fba6: ; 1fba6
Music_Clair_Ch3: ; 1fbb9
notetype $c, $14
- forceoctave $c
+ pitchoffset 0, CC
octave 3
note C#, 2
note __, 4
diff --git a/audio/music/credits.asm b/audio/music/credits.asm
index 532faef70..708b70ee4 100644
--- a/audio/music/credits.asm
+++ b/audio/music/credits.asm
@@ -142,12 +142,12 @@ Music_Credits_Ch1: ; 1f328
note E_, 7
octave 3
note __, 1
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f483
callchannel Music_Credits_branch_1f4ed
callchannel Music_Credits_branch_1f4f8
callchannel Music_Credits_branch_1f559
- forceoctave $0
+ pitchoffset 0, C_
octave 3
note A_, 12
notetype $8, $a7
@@ -664,11 +664,11 @@ Music_Credits_Ch2: ; 1f58d
note A_, 4
note G_, 4
notetype $6, $c7
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f6cb
callchannel Music_Credits_branch_1f73f
callchannel Music_Credits_branch_1f748
- forceoctave $0
+ pitchoffset 0, C_
octave 5
note C#, 1
note D_, 11
@@ -1139,15 +1139,15 @@ Music_Credits_Ch3: ; 1f772
note F_, 1
note F#, 7
note G_, 8
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f8aa
callchannel Music_Credits_branch_1f8db
- forceoctave $12
+ pitchoffset 1, D_
callchannel Music_Credits_branch_1f8e7
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f934
callchannel Music_Credits_branch_1f94b
- forceoctave $0
+ pitchoffset 0, C_
octave 6
note C#, 2
octave 5
diff --git a/audio/music/evolution.asm b/audio/music/evolution.asm
index ce07a300b..61f7af716 100644
--- a/audio/music/evolution.asm
+++ b/audio/music/evolution.asm
@@ -13,13 +13,13 @@ Music_Evolution_Ch1: ; f06ed
dutycycle $2
notetype $c, $92
octave 3
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note C_, 1
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note G_, 1
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note C_, 1
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note G_, 1
note __, 4
dutycycle $3
diff --git a/audio/music/goldenrodcity.asm b/audio/music/goldenrodcity.asm
index 89ee7d5bb..d7318310e 100644
--- a/audio/music/goldenrodcity.asm
+++ b/audio/music/goldenrodcity.asm
@@ -275,9 +275,8 @@ Music_GoldenrodCity_Ch3: ; eb584
vibrato $8, $23
notetype $c, $25
Music_GoldenrodCity_branch_eb58c: ; eb58c
-rept 2
callchannel Music_GoldenrodCity_branch_eb5aa
-endr
+ callchannel Music_GoldenrodCity_branch_eb5aa
callchannel Music_GoldenrodCity_branch_eb5d2
note __, 3
octave 3
diff --git a/audio/music/healpokemon.asm b/audio/music/healpokemon.asm
index 25f4ff4f7..264d3db78 100644
--- a/audio/music/healpokemon.asm
+++ b/audio/music/healpokemon.asm
@@ -11,16 +11,16 @@ Music_HealPokemon_Ch1: ; f06a0
tone $0001
notetype $c, $81
note __, 2
- unknownmusic0xe0 $0, 4, __
+ slidepitchto 1, 4, __
note B_, 2
- unknownmusic0xe0 $0, 5, E_
+ slidepitchto 1, 5, E_
note B_, 2
- unknownmusic0xe0 $0, 4, E_
+ slidepitchto 1, 4, E_
note E_, 2
note __, 4
- unknownmusic0xe0 $0, 3, __
+ slidepitchto 1, 3, __
note E_, 4
- unknownmusic0xe0 $0, 4, __
+ slidepitchto 1, 4, __
note B_, 4
endchannel
; f06c4
diff --git a/audio/music/johtowildbattle.asm b/audio/music/johtowildbattle.asm
index e775fa648..bcfde1824 100644
--- a/audio/music/johtowildbattle.asm
+++ b/audio/music/johtowildbattle.asm
@@ -492,9 +492,8 @@ Music_JohtoWildBattle_branch_f5fdb: ; f5fdb
note G_, 2
loopchannel 7, Music_JohtoWildBattle_branch_f5fdb
note F#, 4
-rept 2
callchannel Music_JohtoWildBattle_branch_f6055
-endr
+ callchannel Music_JohtoWildBattle_branch_f6055
Music_JohtoWildBattle_branch_f5fe8: ; f5fe8
note D_, 2
note G_, 2
diff --git a/audio/music/kantotrainerbattle.asm b/audio/music/kantotrainerbattle.asm
index fa21746db..10c1e7c0e 100644
--- a/audio/music/kantotrainerbattle.asm
+++ b/audio/music/kantotrainerbattle.asm
@@ -9,7 +9,7 @@ Music_KantoTrainerBattle: ; ec9fa
Music_KantoTrainerBattle_Ch1: ; eca04
tempo 114
volume $77
- forceoctave $1b
+ pitchoffset 1, B_
notetype $c, $b3
vibrato $12, $24
dutycycle $1
@@ -467,7 +467,7 @@ Music_KantoTrainerBattle_branch_eca88: ; eca88
; ecbea
Music_KantoTrainerBattle_Ch2: ; ecbea
- forceoctave $1b
+ pitchoffset 1, B_
vibrato $6, $36
dutycycle $1
notetype $c, $d1
@@ -920,7 +920,7 @@ Music_KantoTrainerBattle_branch_ecc41: ; ecc41
; ecdd2
Music_KantoTrainerBattle_Ch3: ; ecdd2
- forceoctave $1b
+ pitchoffset 1, B_
vibrato $12, $23
notetype $c, $15
octave 2
diff --git a/audio/music/kantowildbattle.asm b/audio/music/kantowildbattle.asm
index f867e1273..7f4f6e174 100644
--- a/audio/music/kantowildbattle.asm
+++ b/audio/music/kantowildbattle.asm
@@ -325,25 +325,21 @@ Music_KantoWildBattle_branch_ed1c8: ; ed1c8
note F_, 1
note F#, 1
notetype $6, $b7
-rept 2
callchannel Music_KantoWildBattle_branch_ed307
-endr
- forceoctave $1
-rept 2
callchannel Music_KantoWildBattle_branch_ed307
-endr
- forceoctave $0
+ pitchoffset 0, C#
+ callchannel Music_KantoWildBattle_branch_ed307
+ callchannel Music_KantoWildBattle_branch_ed307
+ pitchoffset 0, C_
rept 4
callchannel Music_KantoWildBattle_branch_ed307
endr
- forceoctave $1
-rept 2
+ pitchoffset 0, C#
+ callchannel Music_KantoWildBattle_branch_ed307
+ callchannel Music_KantoWildBattle_branch_ed307
+ pitchoffset 0, C_
callchannel Music_KantoWildBattle_branch_ed307
-endr
- forceoctave $0
-rept 2
callchannel Music_KantoWildBattle_branch_ed307
-endr
note __, 16
octave 3
note A#, 16
@@ -388,9 +384,9 @@ endr
note G#, 1
notetype $6, $b7
callchannel Music_KantoWildBattle_branch_ed31b
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_KantoWildBattle_branch_ed31b
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_KantoWildBattle_branch_ed340
octave 2
note C_, 2
@@ -454,9 +450,9 @@ endr
callchannel Music_KantoWildBattle_branch_ed354
callchannel Music_KantoWildBattle_branch_ed340
callchannel Music_KantoWildBattle_branch_ed354
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_KantoWildBattle_branch_ed340
- forceoctave $0
+ pitchoffset 0, C_
note C#, 2
note __, 2
octave 3
diff --git a/audio/music/lookofficer.asm b/audio/music/lookofficer.asm
index f0eb3af1e..a8667afdb 100644
--- a/audio/music/lookofficer.asm
+++ b/audio/music/lookofficer.asm
@@ -73,9 +73,9 @@ Music_LookOfficer_branch_ed882: ; ed882
note E_, 2
note G#, 2
loopchannel 2, Music_LookOfficer_branch_ed882
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_LookOfficer_branch_ed89e
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_LookOfficer_branch_ed89e
loopchannel 0, Music_LookOfficer_branch_ed882
; ed89e
diff --git a/audio/music/lookrocket.asm b/audio/music/lookrocket.asm
index 3ee5f3a5c..518a9b7e0 100644
--- a/audio/music/lookrocket.asm
+++ b/audio/music/lookrocket.asm
@@ -8,7 +8,7 @@ Music_LookRocket: ; f74a2
Music_LookRocket_Ch1: ; f74ae
tempo 123
volume $77
- forceoctave $2
+ pitchoffset 0, D_
stereopanning $f
dutycycle $3
vibrato $5, $64
@@ -94,7 +94,7 @@ Music_RocketTheme_branch_f750c: ; f750c
; f7514
Music_LookRocket_Ch2: ; f7514
- forceoctave $2
+ pitchoffset 0, D_
vibrato $4, $64
dutycycle $3
notetype $c, $b7
@@ -216,7 +216,7 @@ Music_RocketTheme_branch_f758a: ; f758a
; f7597
Music_LookRocket_Ch3: ; f7597
- forceoctave $2
+ pitchoffset 0, D_
vibrato $4, $22
notetype $c, $14
stereopanning $f0
diff --git a/audio/music/postcredits.asm b/audio/music/postcredits.asm
index fe4893da9..d998d6212 100644
--- a/audio/music/postcredits.asm
+++ b/audio/music/postcredits.asm
@@ -8,7 +8,7 @@ Music_PostCredits: ; cfd9e
Music_PostCredits_Ch1: ; cfda5
tempo 271
volume $77
- forceoctave $3
+ pitchoffset 0, D#
dutycycle $2
notetype $c, $93
note __, 8
@@ -133,7 +133,7 @@ Music_PostCredits_branch_cfdb2: ; cfdb2
; cfe48
Music_PostCredits_Ch2: ; cfe48
- forceoctave $3
+ pitchoffset 0, D#
dutycycle $2
notetype $c, $a3
octave 5
diff --git a/audio/music/profoak.asm b/audio/music/profoak.asm
index f0cd32a26..c24592350 100644
--- a/audio/music/profoak.asm
+++ b/audio/music/profoak.asm
@@ -34,10 +34,10 @@ Music_ProfOak_branch_f4e22: ; f4e22
callchannel Music_ProfOak_branch_f4e58
callchannel Music_ProfOak_branch_f4e6c
callchannel Music_ProfOak_branch_f4e6c
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_ProfOak_branch_f4e58
callchannel Music_ProfOak_branch_f4e58
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_ProfOak_branch_f4e6c
callchannel Music_ProfOak_branch_f4e6c
loopchannel 0, Music_ProfOak_branch_f4e22
@@ -241,10 +241,10 @@ Music_ProfOak_branch_f4f1d: ; f4f1d
callchannel Music_ProfOak_branch_f4f5a
callchannel Music_ProfOak_branch_f4f69
callchannel Music_ProfOak_branch_f4f69
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_ProfOak_branch_f4f5a
callchannel Music_ProfOak_branch_f4f5a
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_ProfOak_branch_f4f69
callchannel Music_ProfOak_branch_f4f69
loopchannel 0, Music_ProfOak_branch_f4f1d
diff --git a/audio/music/ssaqua.asm b/audio/music/ssaqua.asm
index e8782efb7..94570eccf 100644
--- a/audio/music/ssaqua.asm
+++ b/audio/music/ssaqua.asm
@@ -276,9 +276,9 @@ Music_SSAqua_branch_eaed5: ; eaed5
octave 4
note C#, 1
note E_, 1
- forceoctave $c
+ pitchoffset 0, CC
callchannel Music_SSAqua_branch_eafe0
- forceoctave $0
+ pitchoffset 0, C_
octave 3
note B_, 1
note __, 1
diff --git a/audio/music/surf.asm b/audio/music/surf.asm
index 18f0cab9f..8a04945d9 100644
--- a/audio/music/surf.asm
+++ b/audio/music/surf.asm
@@ -425,7 +425,7 @@ Music_Surf_branch_f5333: ; f5333
note B_, 16
octave 4
note C#, 8
- forceoctave $c
+ pitchoffset 0, CC
dutycycle $3
callchannel Music_Surf_branch_f53d6
intensity $b8
@@ -436,7 +436,7 @@ Music_Surf_branch_f5333: ; f5333
intensity $b8
dutycycle $1
callchannel Music_Surf_branch_f5404
- forceoctave $0
+ pitchoffset 0, C_
notetype $c, $b8
octave 4
note B_, 12
diff --git a/audio/music/wildpokemonvictory.asm b/audio/music/wildpokemonvictory.asm
index fba1ed40d..fc95e111e 100644
--- a/audio/music/wildpokemonvictory.asm
+++ b/audio/music/wildpokemonvictory.asm
@@ -29,14 +29,14 @@ Music_WildPokemonVictory_branch_f4538: ; f4538
intensity $78
octave 3
note G_, 4
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_WildPokemonVictory_branch_f455c
note F#, 2
note F#, 2
note F#, 4
callchannel Music_WildPokemonVictory_branch_f455c
note G#, 4
- forceoctave $0
+ pitchoffset 0, C_
intensity $78
octave 3
note F#, 4
@@ -97,7 +97,7 @@ Music_WildPokemonVictory_branch_f4587: ; f4587
note E_, 1
note G_, 1
note A#, 1
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_WildPokemonVictory_branch_f45b5
octave 4
note B_, 2
@@ -106,7 +106,7 @@ Music_WildPokemonVictory_branch_f4587: ; f4587
callchannel Music_WildPokemonVictory_branch_f45b5
octave 4
note B_, 4
- forceoctave $0
+ pitchoffset 0, C_
intensity $81
octave 3
note B_, 1
@@ -156,7 +156,7 @@ Music_WildPokemonVictory_branch_f45cf: ; f45cf
note E_, 2
note __, 2
note C_, 4
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_WildPokemonVictory_branch_f45f4
note D#, 2
note C#, 2
@@ -166,7 +166,7 @@ Music_WildPokemonVictory_branch_f45cf: ; f45cf
callchannel Music_WildPokemonVictory_branch_f45f4
note E_, 2
note __, 2
- forceoctave $0
+ pitchoffset 0, C_
octave 2
note B_, 4
loopchannel 0, Music_WildPokemonVictory_branch_f45cf
diff --git a/audio/sfx.asm b/audio/sfx.asm
index 0c65ae5db..0a13717e2 100644
--- a/audio/sfx.asm
+++ b/audio/sfx.asm
@@ -1957,9 +1957,9 @@ Sfx_GetBadge_Ch5: ; f1189
note F_, 3
callchannel Sfx_GetBadge_branch_f11aa
note A#, 3
- forceoctave $2
+ pitchoffset 0, D_
callchannel Sfx_GetBadge_branch_f11aa
- forceoctave $0
+ pitchoffset 0, C_
intensity $a7
note A_, 16
note __, 6
@@ -2322,7 +2322,7 @@ Sfx_Aeroblast: ; f1334
; f133a
Sfx_Aeroblast_Ch5: ; f133a
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
soundinput $f5
sound C_, 13, $f8, $0580
soundinput $8
@@ -4762,7 +4762,7 @@ Sfx_Supersonic_branch_f21ef: ; f21ef
; f21fc
Sfx_Supersonic_Ch6: ; f21fc
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 16, $2f, $07c8
Sfx_Supersonic_branch_f2202: ; f2202
sound __, 16, $cf, $07c7
@@ -4790,7 +4790,7 @@ Sfx_Leer_branch_f221a: ; f221a
Sfx_Leer_Ch6: ; f2229
Sfx_Leer_branch_f2229: ; f2229
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 1, $e1, $07c1
sound __, 1, $e1, $0701
loopchannel 12, Sfx_Leer_branch_f2229
@@ -4807,7 +4807,7 @@ Sfx_Leer_branch_f2238: ; f2238
Sfx_Ember_Ch5: ; f2243
Sfx_Ember_branch_f2243: ; f2243
- unknownmusic0xde $c9
+ sound_duty 1, 2, 0, 3
sound __, 12, $f3, $0120
sound __, 10, $d3, $0150
loopchannel 5, Sfx_Ember_branch_f2243
@@ -4829,7 +4829,7 @@ Sfx_Ember_branch_f225a: ; f225a
Sfx_Bubblebeam_Ch5: ; f226e
Sfx_Bubblebeam_branch_f226e: ; f226e
- unknownmusic0xde $39
+ sound_duty 1, 2, 3, 0
sound __, 5, $f4, $0600
sound __, 4, $c4, $0500
sound __, 6, $b5, $0600
@@ -4841,7 +4841,7 @@ Sfx_Bubblebeam_branch_f226e: ; f226e
Sfx_Bubblebeam_Ch6: ; f2289
Sfx_Bubblebeam_branch_f2289: ; f2289
- unknownmusic0xde $8d
+ sound_duty 1, 3, 0, 2
sound __, 6, $e4, $05e0
sound __, 5, $b4, $04e0
sound __, 7, $a5, $05e8
@@ -4862,7 +4862,7 @@ Sfx_Bubblebeam_branch_f22a0: ; f22a0
Sfx_HydroPump_Ch5: ; f22b1
Sfx_HydroPump_branch_f22b1: ; f22b1
- unknownmusic0xde $d2
+ sound_duty 2, 0, 1, 3
sound __, 4, $81, $0300
sound __, 4, $c1, $0400
sound __, 4, $f1, $0500
@@ -4887,7 +4887,7 @@ Sfx_HydroPump_branch_f22d0: ; f22d0
Sfx_Surf_Ch5: ; f22e7
Sfx_Surf_branch_f22e7: ; f22e7
- unknownmusic0xde $39
+ sound_duty 1, 2, 3, 0
sound __, 16, $f4, $0500
sound __, 16, $c4, $0400
sound __, 16, $e2, $05c0
@@ -4897,7 +4897,7 @@ Sfx_Surf_branch_f22e7: ; f22e7
Sfx_Surf_Ch6: ; f22fa
Sfx_Surf_branch_f22fa: ; f22fa
- unknownmusic0xde $8d
+ sound_duty 1, 3, 0, 2
sound __, 8, $e4, $0430
sound __, 16, $b4, $0330
sound __, 16, $a2, $0438
@@ -4917,7 +4917,7 @@ Sfx_Surf_branch_f230d: ; f230d
Sfx_Psybeam_Ch5: ; f231e
Sfx_Psybeam_branch_f231e: ; f231e
- unknownmusic0xde $a1
+ sound_duty 1, 0, 2, 2
sound __, 11, $f1, $0640
sound __, 11, $f3, $0680
sound __, 11, $f2, $0620
@@ -4928,7 +4928,7 @@ Sfx_Psybeam_branch_f231e: ; f231e
Sfx_Psybeam_Ch6: ; f2335
Sfx_Psybeam_branch_f2335: ; f2335
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 11, $f3, $0571
sound __, 8, $e3, $0531
sound __, 11, $f1, $0551
@@ -4958,7 +4958,7 @@ Sfx_Charge_branch_f2357: ; f2357
Sfx_Charge_Ch6: ; f236e
Sfx_Charge_branch_f236e: ; f236e
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 3, $e1, $0302
sound __, 4, $e1, $07f2
sound __, 5, $e1, $0602
@@ -4979,7 +4979,7 @@ Sfx_Charge_branch_f2385: ; f2385
Sfx_Thundershock_Ch5: ; f2396
Sfx_Thundershock_branch_f2396: ; f2396
- unknownmusic0xde $2b
+ sound_duty 3, 2, 2, 0
sound __, 4, $f1, $07f0
sound __, 5, $f2, $0200
loopchannel 8, Sfx_Thundershock_branch_f2396
@@ -4988,7 +4988,7 @@ Sfx_Thundershock_branch_f2396: ; f2396
Sfx_Thundershock_Ch6: ; f23a5
Sfx_Thundershock_branch_f23a5: ; f23a5
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 5, $e2, $0202
sound __, 5, $e1, $07e2
loopchannel 9, Sfx_Thundershock_branch_f23a5
@@ -5092,7 +5092,7 @@ Sfx_Sharpen_Ch6: ; f2463
; f247a
Sfx_EggBomb_Ch5: ; f247a
- unknownmusic0xde $ed
+ sound_duty 1, 3, 2, 3
sound __, 9, $ff, $03f8
sound __, 16, $ff, $0400
sound __, 16, $f3, $0400
@@ -5100,7 +5100,7 @@ Sfx_EggBomb_Ch5: ; f247a
; f2489
Sfx_EggBomb_Ch6: ; f2489
- unknownmusic0xde $b4
+ sound_duty 0, 1, 3, 2
sound __, 9, $ef, $03c0
sound __, 16, $ef, $03c0
sound __, 16, $e3, $03c0
@@ -5168,7 +5168,7 @@ Sfx_HyperBeam_branch_f24f8: ; f24f8
; f2509
Sfx_HyperBeam_Ch6: ; f2509
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 3, $f1, $0781
sound __, 3, $f1, $0701
sound __, 3, $f1, $0791
diff --git a/audio/sfx_crystal.asm b/audio/sfx_crystal.asm
index 2bcf91edd..178d4b560 100644
--- a/audio/sfx_crystal.asm
+++ b/audio/sfx_crystal.asm
@@ -169,7 +169,7 @@ Sfx_GameFreakPresents_Ch5: ; 179945
dutycycle $2
notetype $2, $b1
soundinput $ff
- forceoctave $1a
+ pitchoffset 1, A#
octave 5
note C_, 2
note E_, 2
@@ -194,7 +194,7 @@ Sfx_Tingle: ; 179961
Sfx_Tingle_Ch5: ; 179964
togglesfx
dutycycle $1
- forceoctave $b
+ pitchoffset 0, B_
notetype $1, $b1
Sfx_Tingle_branch_17996c: ; 17996c
octave 5
@@ -234,7 +234,7 @@ Sfx_4NoteDitty_Ch5: ; 17999b
togglesfx
dutycycle $2
notetype $2, $e8
- forceoctave $2
+ pitchoffset 0, D_
octave 4
note C_, 2
intensity $48
@@ -279,7 +279,7 @@ Sfx_Twinkle: ; 1799cb
Sfx_Twinkle_Ch5: ; 1799ce
togglesfx
dutycycle $0
- forceoctave $2
+ pitchoffset 0, D_
notetype $2, $e1
octave 3
note G_, 2
diff --git a/battle/ai/items.asm b/battle/ai/items.asm
index 16511de79..4405ae756 100644
--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -196,9 +196,9 @@ AI_TryItem: ; 38105
jr z, .has_item
dec de
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.has_item
@@ -216,9 +216,8 @@ endr
pop de
pop hl
-rept 2
inc hl
-endr
+ inc hl
jr c, .loop
.used_item
@@ -572,20 +571,20 @@ EnemyUsedFullHeal: ; 383a3 (e:43a3)
EnemyUsedMaxPotion: ; 383ae (e:43ae)
ld a, MAX_POTION
- ld [wd1f1], a
+ ld [CurEnemyItem], a
jr FullRestoreContinue
EnemyUsedFullRestore: ; 383b5 (e:43b5)
call AI_HealStatus
ld a, FULL_RESTORE
- ld [wd1f1], a
+ ld [CurEnemyItem], a
ld hl, EnemySubStatus3
res SUBSTATUS_CONFUSED, [hl]
xor a
ld [EnemyConfuseCount], a
FullRestoreContinue: ; 383c6
- ld de, wd1ec
+ ld de, wCurHPAnimOldHP
ld hl, EnemyMonHP + 1
ld a, [hld]
ld [de], a
@@ -597,11 +596,11 @@ FullRestoreContinue: ; 383c6
ld a, [hld]
ld [de], a
inc de
- ld [Buffer1], a
+ ld [wCurHPAnimMaxHP], a
ld [EnemyMonHP + 1], a
ld a, [hl]
ld [de], a
- ld [Buffer2], a
+ ld [wCurHPAnimMaxHP + 1], a
ld [EnemyMonHP], a
jr EnemyPotionFinish
; 383e8 (e:43e8)
@@ -621,20 +620,20 @@ EnemyUsedHyperPotion: ; 383f4 (e:43f4)
ld b, 200
EnemyPotionContinue: ; 383f8
- ld [wd1f1], a
+ ld [CurEnemyItem], a
ld hl, EnemyMonHP + 1
ld a, [hl]
- ld [wd1ec], a
+ ld [wCurHPAnimOldHP], a
add b
ld [hld], a
- ld [wd1ee], a
+ ld [wCurHPAnimNewHP], a
ld a, [hl]
- ld [wd1ec + 1], a
- ld [wd1ee + 1], a
+ ld [wCurHPAnimOldHP + 1], a
+ ld [wCurHPAnimNewHP + 1], a
jr nc, .ok
inc a
ld [hl], a
- ld [wd1ee + 1], a
+ ld [wCurHPAnimNewHP + 1], a
.ok
inc hl
ld a, [hld]
@@ -642,22 +641,22 @@ EnemyPotionContinue: ; 383f8
ld de, EnemyMonMaxHP + 1
ld a, [de]
dec de
- ld [Buffer1], a
+ ld [wCurHPAnimMaxHP], a
sub b
ld a, [hli]
ld b, a
ld a, [de]
- ld [Buffer2], a
+ ld [wCurHPAnimMaxHP + 1], a
sbc b
jr nc, EnemyPotionFinish
inc de
ld a, [de]
dec de
ld [hld], a
- ld [wd1ee], a
+ ld [wCurHPAnimNewHP], a
ld a, [de]
ld [hl], a
- ld [wd1ef], a
+ ld [wCurHPAnimNewHP + 1], a
EnemyPotionFinish: ; 38436
call PrintText_UsedItemOn
@@ -726,7 +725,7 @@ AI_Switch: ; 3846c
.skiptext
ld a, 1
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
callab NewEnemyMonStatus
callab ResetEnemyStatLevels
ld hl, PlayerSubStatus1
@@ -734,7 +733,7 @@ AI_Switch: ; 3846c
callba EnemySwitch
callba ResetBattleParticipants
xor a
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
ld a, [wLinkMode]
and a
ret nz
@@ -844,7 +843,7 @@ EnemyUsedXSpecial: ; 38553
; a = ITEM_CONSTANT
; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION)
EnemyUsedXItem:
- ld [wd1f1], a
+ ld [CurEnemyItem], a
push bc
call PrintText_UsedItemOn
pop bc
@@ -856,13 +855,13 @@ EnemyUsedXItem:
; Parameter
; a = ITEM_CONSTANT
PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568
- ld [wd1f1], a
+ ld [CurEnemyItem], a
call PrintText_UsedItemOn
jp AIUpdateHUD
; 38571
PrintText_UsedItemOn: ; 38571
- ld a, [wd1f1]
+ ld a, [CurEnemyItem]
ld [wd265], a
call GetItemName
ld hl, StringBuffer1
diff --git a/battle/ai/move.asm b/battle/ai/move.asm
index 0d1c6c968..6e5aca358 100755
--- a/battle/ai/move.asm
+++ b/battle/ai/move.asm
@@ -19,9 +19,9 @@ AIChooseMove: ; 440ce
; The default score is 20. Unusable moves are given a score of 80.
ld a, 20
ld hl, Buffer1
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
; Don't pick disabled moves.
@@ -107,9 +107,8 @@ endr
ld hl, AIScoringPointers
dec c
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm
index 9b8dd6e42..3091697e5 100644
--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -133,18 +133,16 @@ AI_Setup: ; 385e0
call AI_50_50
jr c, .checkmove
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .checkmove
.discourage
call Random
cp 30
jr c, .checkmove
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .checkmove
; 38635
@@ -264,9 +262,8 @@ AI_Offensive: ; 386a2
and a
jr nz, .checkmove
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .checkmove
; 386be
@@ -420,9 +417,8 @@ AI_Smart_Sleep: ; 387e3
.asm_387f0
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 387f7
@@ -533,9 +529,8 @@ AI_Smart_LockOn: ; 3881d
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38882
@@ -560,9 +555,8 @@ endr
cp 180
jr nc, .asm_3888b
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .asm_3888b
.asm_388a2
@@ -602,9 +596,9 @@ AI_Smart_Explosion: ; 388a6
ret c
.asm_388c6
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
; 388ca
@@ -616,9 +610,9 @@ AI_Smart_DreamEater: ; 388ca
call Random
cp 25
ret c
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 388d4
@@ -645,9 +639,8 @@ AI_Smart_EvasionUp: ; 388d4
jr nc, .asm_38911
.asm_388ef
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_388f2
@@ -676,9 +669,8 @@ endr
jr c, .asm_38911
.asm_3890f
-rept 2
inc [hl]
-endr
+ inc [hl]
; 30% chance to end up here if enemy's HP is full and player is not badly poisoned.
; 77% chance to end up here if enemy's HP is above 50% but not full.
@@ -722,9 +714,8 @@ endr
call Random
cp $50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; Player is seeded.
@@ -756,9 +747,8 @@ AI_Smart_AlwaysHit: ; 38947
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 3895b
@@ -828,9 +818,8 @@ AI_Smart_AccuracyDown: ; 38985
jr nc, .asm_389bf
.asm_3899d
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_389a0
@@ -859,9 +848,8 @@ endr
jr c, .asm_389bf
.asm_389bd
-rept 2
inc [hl]
-endr
+ inc [hl]
; We only end up here if the move has not been already encouraged.
.asm_389bf
@@ -900,9 +888,8 @@ endr
call Random
cp $50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; Player is seeded.
@@ -1010,9 +997,8 @@ AI_Smart_Moonlight: ; 38a3a
call Random
cp $19
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38a4e
@@ -1093,9 +1079,8 @@ AI_Smart_Bind: ; 38a71
ret nc
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38a9c
@@ -1200,9 +1185,8 @@ AI_Smart_SpDefenseUp2: ; 38aed
.asm_38b09
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38b10
@@ -1224,9 +1208,9 @@ AI_Smart_Fly: ; 38b12
call AICompareSpeed
ret nc
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38b20
@@ -1255,9 +1239,8 @@ AI_Smart_Paralyze: ; 38b26
ret nc
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38b3a
@@ -1289,9 +1272,8 @@ AI_Smart_SpeedDownHit: ; 38b40
call Random
cp 30
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38b5c
@@ -1528,15 +1510,14 @@ AI_Smart_Encore: ; 38c3b
call Random
cp $46
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38c81
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
.EncoreMoves:
@@ -1606,15 +1587,15 @@ AI_Smart_SleepTalk: ; 38cba
cp $1
jr z, .asm_38cc7
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
.asm_38cc7
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
; 38ccb
@@ -1626,9 +1607,9 @@ AI_Smart_DefrostOpponent: ; 38ccb
ld a, [EnemyMonStatus]
and $20
ret z
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38cd5
@@ -1685,9 +1666,8 @@ AI_Smart_Spite: ; 38cd5
call Random
cp $64
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38d16
@@ -1728,9 +1708,9 @@ AI_Smart_HealBell: ; 38d1f
jr z, .next
; status
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hl]
or c
ld c, a
@@ -1755,9 +1735,8 @@ endr
ret z
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.no_status
@@ -1795,9 +1774,9 @@ AI_Smart_PriorityHit: ; 38d5a
ld a, [BattleMonHP]
sbc b
ret nc
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38d93
@@ -1921,9 +1900,9 @@ AI_Smart_MeanLook: ; 38dfb
.asm_38e26
call AI_80_20
ret c
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38e2e
@@ -2007,15 +1986,13 @@ AI_Smart_Curse: ; 38e5c
ret nc
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38e90
-rept 2
inc [hl]
-endr
+ inc [hl]
.asm_38e92
inc [hl]
.asm_38e93
@@ -2065,9 +2042,8 @@ endr
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38ed2
@@ -2119,9 +2095,8 @@ AI_Smart_Protect: ; 38ed2
call Random
cp 20
ret c
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
; 38f1d
@@ -2151,9 +2126,8 @@ AI_Smart_Foresight: ; 38f1d
call Random
cp 100
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38f4a
@@ -2259,9 +2233,9 @@ AI_Smart_Endure: ; 38fac
call AI_80_20
ret c
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
.asm_38fcb
@@ -2272,9 +2246,8 @@ endr
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38fd8
@@ -2296,15 +2269,14 @@ AI_Smart_FuryCutter: ; 38fdb
cp 2
jr c, .end
-rept 2
dec [hl]
-endr
+ dec [hl]
cp 3
jr c, .end
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
.end
@@ -2344,9 +2316,8 @@ AI_Smart_Rollout: ; 38fef
call Random
cp 200
ret nc
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_39020
@@ -2406,9 +2377,8 @@ AI_Smart_Earthquake: ; 39044
call AICompareSpeed
ret nc
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.could_dig
@@ -2455,9 +2425,8 @@ AI_Smart_Pursuit: ; 39072
.asm_3907d
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39084
@@ -2482,9 +2451,8 @@ AI_Smart_RapidSpin: ; 39084
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 3909e
@@ -2611,9 +2579,9 @@ AI_Smart_WeatherMove: ; 3910d
; 3911e
AIBadWeatherType: ; 3911e
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
; 39122
@@ -2636,9 +2604,8 @@ AIGoodWeatherType: ; 39122
ret nz
.good
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39134
@@ -2733,9 +2700,8 @@ AI_Smart_PsychUp: ; 39152
ret
.asm_39188
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
; 3918b
@@ -2820,9 +2786,8 @@ AI_Smart_Gust: ; 391d5
call AICompareSpeed
ret nc
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; Try to predict if the player will use Fly this turn.
@@ -2849,9 +2814,8 @@ AI_Smart_FutureSight: ; 391f3
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret z
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39200
@@ -2886,18 +2850,16 @@ AI_Smart_Solarbeam: ; 3920b
cp 25 ; 1/10
ret c
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
.asm_3921e
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39225
@@ -2991,9 +2953,8 @@ AICheckPlayerHalfHP: ; 3926e
ld c, [hl]
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
@@ -3013,9 +2974,8 @@ AICheckEnemyHalfHP: ; 39281
ld c, [hl]
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
@@ -3039,9 +2999,8 @@ AICheckEnemyQuarterHP: ; 39298
rl b
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
@@ -3063,9 +3022,8 @@ AICheckPlayerQuarterHP: ; 392b3
rl b
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
diff --git a/battle/ai/switch.asm b/battle/ai/switch.asm
index 8f5db7a54..cb1fe3660 100755
--- a/battle/ai/switch.asm
+++ b/battle/ai/switch.asm
@@ -136,9 +136,11 @@ CheckPlayerMoveTypeMatchups: ; 3484e
jr c, .loop2
; neutral
-rept 5
inc c
-endr
+ inc c
+ inc c
+ inc c
+ inc c
cp 10
jr z, .loop2
@@ -161,11 +163,6 @@ endr
.doubledown
call .DecreaseScore
-
- ; fallthrough
-; 34931
-
-
.DecreaseScore: ; 34931
ld a, [wEnemyAISwitchScore]
dec a
@@ -173,7 +170,6 @@ endr
ret
; 34939
-
.IncreaseScore: ; 34939
ld a, [wEnemyAISwitchScore]
inc a
@@ -198,16 +194,16 @@ CheckAbleToSwitch: ; 34941
; Perish count is 1
call FindAliveEnemyMons
- call FindEnemyMonsWithEnoughHP
+ call FindEnemyMonsWithAtLeastQuarterMaxHP
call FindEnemyMonsThatResistPlayer
- call Function34a85
+ call FindAliveEnemyMonsWithASuperEffectiveMove
ld a, e
cp 2
jr nz, .not_2
ld a, [wEnemyAISwitchScore]
- add $30
+ add $30 ; maximum chance
ld [wEnemySwitchMonParam], a
ret
@@ -223,12 +219,11 @@ CheckAbleToSwitch: ; 34941
jr nc, .loop1
ld a, b
- add $30
+ add $30 ; maximum chance
ld [wEnemySwitchMonParam], a
ret
.no_perish
-
call CheckPlayerMoveTypeMatchups
ld a, [wEnemyAISwitchScore]
cp 11
@@ -238,13 +233,13 @@ CheckAbleToSwitch: ; 34941
and a
jr z, .no_last_counter_move
- call Function34a2a
+ call FindEnemyMonsImmuneToLastCounterMove
ld a, [wEnemyAISwitchScore]
and a
jr z, .no_last_counter_move
ld c, a
- call Function34aa7
+ call FindEnemyMonsWithASuperEffectiveMove
ld a, [wEnemyAISwitchScore]
cp $ff
ret z
@@ -285,9 +280,9 @@ CheckAbleToSwitch: ; 34941
ret nc
call FindAliveEnemyMons
- call FindEnemyMonsWithEnoughHP
+ call FindEnemyMonsWithAtLeastQuarterMaxHP
call FindEnemyMonsThatResistPlayer
- call Function34a85
+ call FindAliveEnemyMonsWithASuperEffectiveMove
ld a, e
cp $2
@@ -352,7 +347,7 @@ FindAliveEnemyMons: ; 349f4
; 34a2a
-Function34a2a: ; 34a2a
+FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
ld hl, OTPartyMon1
ld a, [OTPartyCount]
ld b, a
@@ -361,44 +356,50 @@ Function34a2a: ; 34a2a
xor a
ld [wEnemyAISwitchScore], a
-.asm_34a39
+.loop
ld a, [CurOTMon]
cp d
push hl
- jr z, .asm_34a77
+ jr z, .next
push hl
push bc
+
+ ; If the Pokemon has at least 1 HP...
ld bc, MON_HP
add hl, bc
pop bc
ld a, [hli]
or [hl]
pop hl
- jr z, .asm_34a77
+ jr z, .next
ld a, [hl]
ld [CurSpecies], a
call GetBaseData
+
+ ; the enemy's last move is damaging...
ld a, [LastEnemyCounterMove]
dec a
ld hl, Moves + MOVE_POWER
call GetMoveAttr
and a
- jr z, .asm_34a77
+ jr z, .next
+ ; and the Pokemon is immune to it...
inc hl
call GetMoveByte
ld hl, BaseType
call CheckTypeMatchup
ld a, [wTypeMatchup]
and a
- jr nz, .asm_34a77
+ jr nz, .next
+ ; ... encourage that Pokemon.
ld a, [wEnemyAISwitchScore]
or c
ld [wEnemyAISwitchScore], a
-.asm_34a77
+.next
pop hl
dec b
ret z
@@ -410,11 +411,11 @@ Function34a2a: ; 34a2a
inc d
srl c
- jr .asm_34a39
+ jr .loop
; 34a85
-Function34a85: ; 34a85
+FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85
push bc
ld a, [OTPartyCount]
ld e, a
@@ -444,13 +445,9 @@ Function34a85: ; 34a85
and c
ld c, a
+FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
- ; fallthrough
-; 34aa7
-
-Function34aa7: ; 34aa7
-
- ld a, $ff
+ ld a, -1
ld [wEnemyAISwitchScore], a
ld hl, OTPartyMon1Moves
ld b, 1 << (PARTY_LENGTH - 1)
@@ -463,32 +460,40 @@ Function34aa7: ; 34aa7
push hl
push bc
+ ; for move on mon:
ld b, NUM_MOVES
ld c, 0
.loop3
+ ; if move is None: break
ld a, [hli]
and a
push hl
jr z, .break3
+ ; if move has no power: continue
dec a
ld hl, Moves + MOVE_POWER
call GetMoveAttr
and a
jr z, .nope
+ ; check type matchups
inc hl
call GetMoveByte
ld hl, BattleMonType1
call CheckTypeMatchup
+
+ ; if immune or not very effective: continue
ld a, [wTypeMatchup]
cp 10
jr c, .nope
+ ; if neutral: load 1 and continue
ld e, 1
cp 10 + 1
jr c, .nope
+ ; if super-effective: load 2 and break
ld e, 2
jr .break3
@@ -505,18 +510,19 @@ Function34aa7: ; 34aa7
ld a, e
pop bc
pop hl
- cp $2
- jr z, .done2
-
- cp $1
- jr nz, .next
+ cp 2
+ jr z, .done2 ; at least one move is super-effective
+ cp 1
+ jr nz, .next ; no move does more than half damage
+ ; encourage this pokemon
ld a, d
or b
ld d, a
- jr .next
+ jr .next ; such a long jump
.next
+ ; next pokemon?
push bc
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
@@ -524,12 +530,14 @@ Function34aa7: ; 34aa7
srl b
jr nc, .loop
+ ; if no pokemon has a super-effective move: return
ld a, d
ld b, a
and a
ret z
.done2
+ ; convert the bit flag to an int and return
push bc
sla b
sla b
@@ -608,7 +616,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20
; 34b77
-FindEnemyMonsWithEnoughHP: ; 34b77
+FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77
push bc
ld de, OTPartySpecies
ld b, 1 << (PARTY_LENGTH - 1)
@@ -626,17 +634,15 @@ FindEnemyMonsWithEnoughHP: ; 34b77
ld b, [hl]
inc hl
ld c, [hl]
-rept 2
inc hl
-endr
+ inc hl
; hl = MaxHP + 1
-; b = (4 * b) % $100 + (c & 3)
-; c = c / 4
+; bc = [CurHP] * 4
srl c
rl b
srl c
rl b
-; a = (MaxHP / $100) - b - (1 if c > (MaxHP % $100) else 0)
+; if bc >= [hl], encourage
ld a, [hld]
cp c
ld a, [hl]
diff --git a/battle/anim_commands.asm b/battle/anim_commands.asm
index 48dc9c433..957b2a066 100644
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -108,7 +108,7 @@ RunBattleAnimScript: ; cc163
call RunBattleAnimCommand
call _ExecuteBGEffects
call BattleAnim_UpdateOAM_All
- call Function3b0c
+ call PushLYOverrides
call BattleAnimRequestPals
; Speed up Rollout's animation.
@@ -265,9 +265,9 @@ BattleAnim_ClearCGB_OAMFlags: ; cc23d
ld a, [hl]
and $f0
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop
ret
@@ -382,7 +382,7 @@ BattleAnimCommands:: ; cc2a4 (33:42a4)
dw BattleAnimCmd_EB ; dummy
dw BattleAnimCmd_EC ; dummy
dw BattleAnimCmd_ED ; dummy
- dw BattleAnimCmd_JumpAnd
+ dw BattleAnimCmd_IfParamAnd
dw BattleAnimCmd_JumpUntil
dw BattleAnimCmd_BGEffect
dw BattleAnimCmd_BGP
@@ -392,10 +392,10 @@ BattleAnimCommands:: ; cc2a4 (33:42a4)
dw BattleAnimCmd_F5
dw BattleAnimCmd_F6
dw BattleAnimCmd_F7
- dw BattleAnimCmd_JumpIf
+ dw BattleAnimCmd_IfParamEqual
dw BattleAnimCmd_SetVar
dw BattleAnimCmd_IncVar
- dw BattleAnimCmd_JumpVar
+ dw BattleAnimCmd_IfVarEqual
dw BattleAnimCmd_Jump
dw BattleAnimCmd_Loop
dw BattleAnimCmd_Call
@@ -535,7 +535,7 @@ BattleAnimCmd_IncVar: ; cc3ad (33:43ad)
inc [hl]
ret
-BattleAnimCmd_JumpVar: ; cc3b2 (33:43b2)
+BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2)
call GetBattleAnimByte
ld hl, BattleAnimVar
cp [hl]
@@ -563,7 +563,7 @@ BattleAnimCmd_JumpVar: ; cc3b2 (33:43b2)
ld [hl], d
ret
-BattleAnimCmd_JumpIf: ; cc3d6 (33:43d6)
+BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6)
call GetBattleAnimByte
ld hl, wBattleAnimParam
cp [hl]
@@ -591,7 +591,7 @@ BattleAnimCmd_JumpIf: ; cc3d6 (33:43d6)
ld [hl], d
ret
-BattleAnimCmd_JumpAnd: ; cc3fa (33:43fa)
+BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa)
call GetBattleAnimByte
ld e, a
ld a, [wBattleAnimParam]
@@ -608,6 +608,7 @@ BattleAnimCmd_JumpAnd: ; cc3fa (33:43fa)
dec hl
ld [hl], e
ret
+
.jump
call GetBattleAnimByte
ld e, a
diff --git a/battle/anims.asm b/battle/anims.asm
index 7a4e8459c..e0b7f0014 100644
--- a/battle/anims.asm
+++ b/battle/anims.asm
@@ -303,10 +303,10 @@ BattleAnim_SweetScent2: ; c929c
; c92c1
BattleAnim_ThrowPokeBall
- anim_jumpif NO_ITEM, .TheTrainerBlockedTheBall
- anim_jumpif MASTER_BALL, .MasterBall
- anim_jumpif ULTRA_BALL, .UltraBall
- anim_jumpif GREAT_BALL, .GreatBall
+ anim_if_param_equal NO_ITEM, .TheTrainerBlockedTheBall
+ anim_if_param_equal MASTER_BALL, .MasterBall
+ anim_if_param_equal ULTRA_BALL, .UltraBall
+ anim_if_param_equal GREAT_BALL, .GreatBall
; any other ball
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_SMOKE
anim_sound 6, 2, SFX_THROW_BALL
@@ -316,7 +316,7 @@ BattleAnim_ThrowPokeBall
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c92f2
@@ -324,7 +324,7 @@ BattleAnim_ThrowPokeBall
.TheTrainerBlockedTheBall:
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_HIT
anim_sound 6, 2, SFX_THROW_BALL
- anim_obj ANIM_OBJ_16, 8, 0, 11, 4, $20
+ anim_obj ANIM_OBJ_POKE_BALL_BLOCKED, 8, 0, 11, 4, $20
anim_wait 20
anim_obj ANIM_OBJ_01, 14, 0, 5, 0, $0
anim_wait 32
@@ -340,7 +340,7 @@ BattleAnim_ThrowPokeBall
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c9326
@@ -354,7 +354,7 @@ BattleAnim_ThrowPokeBall
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c9347
@@ -368,17 +368,17 @@ BattleAnim_ThrowPokeBall
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 24
anim_sound 0, 1, SFX_MASTER_BALL
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $30
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $31
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $32
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $33
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $34
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $35
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $36
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $37
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $30
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $31
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $32
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $33
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $34
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $35
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $36
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $37
anim_wait 64
.Shake:
anim_bgeffect ANIM_BG_RETURN_MON, $0, $0, $0
@@ -397,8 +397,8 @@ BattleAnim_ThrowPokeBall
.Loop:
anim_wait 48
anim_checkpokeball
- anim_jumpvar $1, .Click
- anim_jumpvar $2, .BreakFree
+ anim_if_var_equal $1, .Click
+ anim_if_var_equal $2, .BreakFree
anim_incobj 1
anim_sound 0, 1, SFX_BALL_WIGGLE
anim_jump .Loop
@@ -412,7 +412,7 @@ BattleAnim_ThrowPokeBall
.BreakFree:
anim_setobj $1, $b
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 2
anim_bgeffect ANIM_BG_ENTER_MON, $0, $0, $0
anim_wait 32
@@ -420,9 +420,9 @@ BattleAnim_ThrowPokeBall
; c93d1
BattleAnim_SendOutMon: ; c93d1
- anim_jumpif $0, .Normal
- anim_jumpif $1, .Shiny
- anim_jumpif $2, .Unknown
+ anim_if_param_equal $0, .Normal
+ anim_if_param_equal $1, .Shiny
+ anim_if_param_equal $2, .Unknown
anim_1gfx ANIM_GFX_SMOKE
anim_call BattleAnim_FollowEnemyFeet_0
anim_bgeffect ANIM_BG_2B, $0, $1, $0
@@ -482,7 +482,7 @@ BattleAnim_SendOutMon: ; c93d1
.Normal:
anim_1gfx ANIM_GFX_SMOKE
anim_sound 0, 0, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, 5, 4, 12, 0, $0
+ anim_obj ANIM_OBJ_BALL_POOF, 5, 4, 12, 0, $0
anim_wait 4
anim_bgeffect ANIM_BG_ENTER_MON, $0, $1, $0
anim_wait 32
@@ -543,13 +543,13 @@ BattleAnim_Psn: ; c94c5
BattleAnim_Sap: ; c94da
anim_1gfx ANIM_GFX_CHARGE
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 16
anim_ret
; c94f8
@@ -711,7 +711,7 @@ BattleAnim_KarateChop: ; c95d5
BattleAnim_Doubleslap: ; c9605
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_Doubleslap_branch_c961b
+ anim_if_param_equal $1, BattleAnim_Doubleslap_branch_c961b
anim_sound 0, 1, SFX_DOUBLESLAP
anim_obj ANIM_OBJ_08, -14, 0, 6, 0, $0
anim_wait 6
@@ -731,7 +731,7 @@ BattleAnim_Doubleslap_branch_c961b: ; c961b
BattleAnim_CometPunch: ; c962b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_CometPunch_branch_c9641
+ anim_if_param_equal $1, BattleAnim_CometPunch_branch_c9641
anim_sound 0, 1, SFX_COMET_PUNCH
anim_obj ANIM_OBJ_06, -14, 0, 6, 0, $0
anim_wait 6
@@ -788,7 +788,7 @@ BattleAnim_Stomp: ; c9677
BattleAnim_DoubleKick: ; c96a7
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_DoubleKick_branch_c96bd
+ anim_if_param_equal $1, BattleAnim_DoubleKick_branch_c96bd
anim_sound 0, 1, SFX_DOUBLE_KICK
anim_obj ANIM_OBJ_07, -14, 0, 6, 0, $0
anim_wait 6
@@ -808,7 +808,7 @@ BattleAnim_DoubleKick_branch_c96bd: ; c96bd
BattleAnim_JumpKick: ; c96cd
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_JumpKick_branch_c96f1
+ anim_if_param_equal $1, BattleAnim_JumpKick_branch_c96f1
anim_sound 0, 1, SFX_JUMP_KICK
anim_obj ANIM_OBJ_07, 14, 0, 9, 0, $0
anim_obj ANIM_OBJ_07, 12, 4, 7, 4, $0
@@ -832,7 +832,7 @@ BattleAnim_JumpKick_branch_c96f1: ; c96f1
BattleAnim_HiJumpKick: ; c96fc
anim_1gfx ANIM_GFX_HIT
anim_bgeffect ANIM_BG_1F, $40, $2, $0
- anim_jumpif $1, BattleAnim_HiJumpKick_branch_c971e
+ anim_if_param_equal $1, BattleAnim_HiJumpKick_branch_c971e
anim_wait 32
anim_sound 0, 1, SFX_JUMP_KICK
anim_obj ANIM_OBJ_07, 14, 0, 9, 0, $0
@@ -1041,13 +1041,13 @@ BattleAnim_IceBeam: ; c98bd
anim_1gfx ANIM_GFX_ICE
.loop
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_13, 8, 0, 11, 4, $4
+ anim_obj ANIM_OBJ_ICE_BEAM, 8, 0, 11, 4, $4
anim_wait 4
anim_loop 5, .loop
- anim_obj ANIM_OBJ_29, -15, 0, 9, 2, $10
+ anim_obj ANIM_OBJ_ICE_BUILDUP, -15, 0, 9, 2, $10
.loop2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_13, 8, 0, 11, 4, $4
+ anim_obj ANIM_OBJ_ICE_BEAM, 8, 0, 11, 4, $4
anim_wait 4
anim_loop 15, .loop2
anim_wait 48
@@ -1062,18 +1062,18 @@ BattleAnim_Blizzard: ; c98e8
anim_1gfx ANIM_GFX_ICE
.loop
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 11, 0, $63
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 11, 0, $63
anim_wait 2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 10, 0, $64
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 10, 0, $64
anim_wait 2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 12, 0, $63
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 12, 0, $63
anim_wait 2
anim_loop 3, .loop
anim_bgeffect ANIM_BG_WHITE_HUES, $0, $8, $0
anim_wait 32
- anim_obj ANIM_OBJ_29, -15, 0, 9, 2, $10
+ anim_obj ANIM_OBJ_ICE_BUILDUP, -15, 0, 9, 2, $10
anim_wait 128
anim_sound 0, 1, SFX_SHINE
anim_wait 8
@@ -1085,13 +1085,13 @@ BattleAnim_Blizzard: ; c98e8
BattleAnim_Bubble: ; c991e
anim_1gfx ANIM_GFX_BUBBLE
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $c1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $c1
anim_wait 6
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $e1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $e1
anim_wait 6
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $d1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $d1
anim_wait 128
anim_wait 32
anim_ret
@@ -1101,13 +1101,13 @@ BattleAnim_Bubblebeam: ; c993d
anim_1gfx ANIM_GFX_BUBBLE
.loop
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $92
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $92
anim_wait 6
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $b3
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $b3
anim_wait 6
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $f4
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $f4
anim_wait 8
anim_loop 3, .loop
anim_wait 64
@@ -1213,13 +1213,13 @@ BattleAnim_VineWhip: ; c9a42
BattleAnim_LeechSeed: ; c9a5a
anim_1gfx ANIM_GFX_PLANT
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $20
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $20
anim_wait 8
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $30
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $30
anim_wait 8
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $28
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $28
anim_wait 32
anim_sound 0, 1, SFX_CHARGE
anim_wait 128
@@ -1229,17 +1229,17 @@ BattleAnim_LeechSeed: ; c9a5a
BattleAnim_RazorLeaf: ; c9a7c
anim_1gfx ANIM_GFX_PLANT
anim_sound 0, 0, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $28
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $5c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $10
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $e8
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $9c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $d0
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $28
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $5c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $10
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $e8
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $9c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $d0
anim_wait 6
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $1c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $50
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $dc
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $90
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $1c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $50
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $dc
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $90
anim_wait 80
anim_sound 16, 2, SFX_VINE_WHIP
anim_incobj 3
@@ -1275,7 +1275,8 @@ BattleAnim_RazorLeaf: ; c9a7c
; c9af2
BattleAnim_Solarbeam: ; c9af2
- anim_jumpif $0, BattleAnim_Solarbeam_branch_c9b30
+ anim_if_param_equal $0, .FireSolarBeam
+ ; charge turn
anim_1gfx ANIM_GFX_CHARGE
anim_sound 0, 0, SFX_CHARGE
anim_obj ANIM_OBJ_3D, 6, 0, 10, 4, $0
@@ -1293,7 +1294,7 @@ BattleAnim_Solarbeam: ; c9af2
anim_ret
; c9b30
-BattleAnim_Solarbeam_branch_c9b30: ; c9b30
+.FireSolarBeam
anim_1gfx ANIM_GFX_BEAM
anim_bgeffect ANIM_BG_06, $0, $2, $0
anim_call BattleAnim_Solarbeam_branch_cbb39
@@ -1362,7 +1363,7 @@ BattleAnim_Thunder: ; c9b9a
; c9bbd
BattleAnim_RazorWind: ; c9bbd
- anim_jumpif $1, BattleAnim_RazorWind_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_RazorWind_branch_c9fb5
anim_1gfx ANIM_GFX_WHIP
anim_bgeffect ANIM_BG_06, $0, $1, $0
.loop
@@ -1430,7 +1431,7 @@ BattleAnim_Sonicboom: ; c9c36
BattleAnim_Selfdestruct: ; c9c53
anim_1gfx ANIM_GFX_EXPLOSION
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $24
- anim_jumpif $1, .loop
+ anim_if_param_equal $1, .loop
anim_call BattleAnim_Selfdestruct_branch_cbb8f
anim_wait 16
anim_ret
@@ -1449,7 +1450,7 @@ BattleAnim_Explosion: ; c9c72
anim_1gfx ANIM_GFX_EXPLOSION
anim_bgeffect ANIM_BG_1F, $60, $4, $10
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $24
- anim_jumpif $1, .loop
+ anim_if_param_equal $1, .loop
anim_call BattleAnim_Explosion_branch_cbb8f
anim_wait 16
anim_ret
@@ -1604,7 +1605,7 @@ BattleAnim_Scratch: ; c9da6
BattleAnim_FurySwipes: ; c9dbc
anim_1gfx ANIM_GFX_CUT
- anim_jumpif $1, BattleAnim_FurySwipes_branch_c9dd9
+ anim_if_param_equal $1, BattleAnim_FurySwipes_branch_c9dd9
anim_sound 0, 1, SFX_SCRATCH
anim_obj ANIM_OBJ_37, -14, 0, 6, 0, $0
anim_obj ANIM_OBJ_37, -15, 4, 5, 4, $0
@@ -1685,8 +1686,8 @@ BattleAnim_Teleport: ; c9e4f
; c9e6f
BattleAnim_Fly: ; c9e6f
- anim_jumpif $1, BattleAnim_Fly_branch_c9e89
- anim_jumpif $2, BattleAnim_Fly_branch_c9e82
+ anim_if_param_equal $1, BattleAnim_Fly_branch_c9e89
+ anim_if_param_equal $2, BattleAnim_Fly_branch_c9e82
anim_1gfx ANIM_GFX_HIT
anim_sound 0, 1, SFX_WING_ATTACK
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
@@ -1742,13 +1743,13 @@ BattleAnim_Absorb: ; c9eeb
anim_obj ANIM_OBJ_3D, 5, 4, 11, 0, $0
.loop
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 6
anim_loop 5, .loop
anim_wait 32
@@ -1762,17 +1763,17 @@ BattleAnim_MegaDrain: ; c9f13
anim_setvar $0
.loop
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 6
anim_incvar
- anim_jumpvar $7, .done
- anim_jumpvar $2, .spawn
+ anim_if_var_equal $7, .done
+ anim_if_var_equal $2, .spawn
anim_jump .loop
; c9f46
@@ -1861,7 +1862,7 @@ BattleAnim_SkyAttack_branch_c9fb5: ; c9fb5
; c9ffc
BattleAnim_Bide: ; c9ffc
- anim_jumpif $0, BattleAnim_Bide_branch_c9651
+ anim_if_param_equal $0, BattleAnim_Bide_branch_c9651
anim_1gfx ANIM_GFX_HIT
anim_call BattleAnim_FollowEnemyFeet_0
anim_sound 0, 0, SFX_ESCAPE_ROPE
@@ -1982,7 +1983,7 @@ BattleAnim_Roar: ; ca0d7
anim_wait 16
anim_loop 3, .loop
anim_wait 16
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
anim_bgeffect ANIM_BG_27, $0, $0, $0
anim_wait 64
.done
@@ -2142,8 +2143,8 @@ BattleAnim_Splash: ; ca237
BattleAnim_Dig: ; ca24b
anim_2gfx ANIM_GFX_SAND, ANIM_GFX_HIT
- anim_jumpif $0, .hit
- anim_jumpif $2, .fail
+ anim_if_param_equal $0, .hit
+ anim_if_param_equal $2, .fail
anim_call BattleAnim_FollowPlayerHead_0
anim_bgeffect ANIM_BG_DIG, $0, $1, $1
anim_obj ANIM_OBJ_57, 9, 0, 13, 0, $0
@@ -2312,7 +2313,7 @@ BattleAnim_Whirlwind: ; ca3a8
anim_incobj 9
anim_sound 16, 2, SFX_WHIRLWIND
anim_wait 128
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
anim_bgeffect ANIM_BG_27, $0, $0, $0
anim_wait 64
.done
@@ -2335,8 +2336,8 @@ BattleAnim_Haze: ; ca3ee
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 1, SFX_SURF
.loop
- anim_obj ANIM_OBJ_5B, 6, 0, 7, 0, $0
- anim_obj ANIM_OBJ_5B, -16, 4, 2, 0, $0
+ anim_obj ANIM_OBJ_HAZE, 6, 0, 7, 0, $0
+ anim_obj ANIM_OBJ_HAZE, -16, 4, 2, 0, $0
anim_wait 12
anim_loop 5, .loop
anim_wait 96
@@ -2348,7 +2349,7 @@ BattleAnim_Mist: ; ca404
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 0, SFX_SURF
.loop
- anim_obj ANIM_OBJ_5C, 6, 0, 7, 0, $0
+ anim_obj ANIM_OBJ_MIST, 6, 0, 7, 0, $0
anim_wait 8
anim_loop 10, .loop
anim_wait 96
@@ -2359,7 +2360,7 @@ BattleAnim_Smog: ; ca417
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 1, SFX_BUBBLEBEAM
.loop
- anim_obj ANIM_OBJ_5D, -16, 4, 2, 0, $0
+ anim_obj ANIM_OBJ_SMOG, -16, 4, 2, 0, $0
anim_wait 8
anim_loop 10, .loop
anim_wait 96
@@ -2370,7 +2371,7 @@ BattleAnim_PoisonGas: ; ca428
anim_1gfx ANIM_GFX_HAZE
anim_sound 16, 2, SFX_BUBBLEBEAM
.loop
- anim_obj ANIM_OBJ_5E, 5, 4, 10, 0, $2
+ anim_obj ANIM_OBJ_POISON_GAS, 5, 4, 10, 0, $2
anim_wait 8
anim_loop 10, .loop
anim_wait 128
@@ -2379,7 +2380,7 @@ BattleAnim_PoisonGas: ; ca428
BattleAnim_HornAttack: ; ca439
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $1
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $1
anim_wait 16
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
@@ -2389,17 +2390,17 @@ BattleAnim_HornAttack: ; ca439
BattleAnim_FuryAttack: ; ca44c
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
- anim_obj ANIM_OBJ_5F, 9, 0, 9, 0, $2
+ anim_obj ANIM_OBJ_HORN, 9, 0, 9, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, 16, 0, 5, 0, $0
anim_wait 8
- anim_obj ANIM_OBJ_5F, 10, 0, 11, 0, $2
+ anim_obj ANIM_OBJ_HORN, 10, 0, 11, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, -15, 0, 7, 0, $0
anim_wait 8
- anim_obj ANIM_OBJ_5F, 9, 4, 10, 0, $2
+ anim_obj ANIM_OBJ_HORN, 9, 4, 10, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, -16, 4, 6, 0, $0
@@ -2410,7 +2411,7 @@ BattleAnim_FuryAttack: ; ca44c
BattleAnim_HornDrill: ; ca47d
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $40
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $3
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $3
anim_wait 8
.loop
anim_sound 0, 1, SFX_HORN_ATTACK
@@ -2608,7 +2609,7 @@ BattleAnim_Crabhammer: ; ca624
; ca63f
BattleAnim_SkullBash: ; ca63f
- anim_jumpif $1, BattleAnim_SkullBash_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_SkullBash_branch_c9fb5
anim_1gfx ANIM_GFX_HIT
anim_bgeffect ANIM_BG_1F, $14, $2, $0
anim_wait 32
@@ -2714,14 +2715,14 @@ BattleAnim_Flash: ; ca700
BattleAnim_Substitute: ; ca73c
anim_sound 0, 0, SFX_SURF
- anim_jumpif $3, BattleAnim_Substitute_branch_ca77c
- anim_jumpif $2, BattleAnim_Substitute_branch_ca76e
- anim_jumpif $1, BattleAnim_Substitute_branch_ca760
+ anim_if_param_equal $3, BattleAnim_Substitute_branch_ca77c
+ anim_if_param_equal $2, BattleAnim_Substitute_branch_ca76e
+ anim_if_param_equal $1, BattleAnim_Substitute_branch_ca760
anim_1gfx ANIM_GFX_SMOKE
anim_bgeffect ANIM_BG_27, $0, $1, $0
anim_wait 48
anim_raisesub
- anim_obj ANIM_OBJ_1C, 6, 0, 12, 0, $0
+ anim_obj ANIM_OBJ_BALL_POOF, 6, 0, 12, 0, $0
anim_bgeffect ANIM_BG_ENTER_MON, $0, $1, $0
anim_wait 32
anim_ret
@@ -2769,7 +2770,7 @@ BattleAnim_Minimize: ; ca78a
; ca7a1
BattleAnim_SkyAttack: ; ca7a1
- anim_jumpif $1, BattleAnim_SkyAttack_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_SkyAttack_branch_c9fb5
anim_1gfx ANIM_GFX_SKY_ATTACK
anim_bgeffect ANIM_BG_27, $0, $1, $0
anim_wait 32
@@ -2826,14 +2827,14 @@ BattleAnim_TriAttack: ; ca7f1
BattleAnim_Withdraw: ; ca80c
anim_1gfx ANIM_GFX_REFLECT
anim_call BattleAnim_FollowPlayerHead_0
- anim_bgeffect ANIM_BG_21, $0, $1, $50
+ anim_bgeffect ANIM_BG_WITHDRAW, $0, $1, $50
anim_wait 48
anim_sound 0, 0, SFX_SHINE
- anim_obj ANIM_OBJ_70, 6, 0, 11, 0, $0
+ anim_obj ANIM_OBJ_WITHDRAW, 6, 0, 11, 0, $0
anim_wait 64
anim_incobj 2
anim_wait 1
- anim_incbgeffect ANIM_BG_21
+ anim_incbgeffect ANIM_BG_WITHDRAW
anim_call BattleAnim_ShowMon_0
anim_ret
; ca829
@@ -2965,7 +2966,7 @@ BattleAnim_Smokescreen: ; ca939
anim_wait 24
anim_incobj 1
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, 13, 4, 8, 6, $10
+ anim_obj ANIM_OBJ_BALL_POOF, 13, 4, 8, 6, $10
anim_wait 8
.loop
anim_sound 0, 1, SFX_MENU
@@ -3324,8 +3325,8 @@ BattleAnim_Sketch: ; cac61
BattleAnim_TripleKick: ; cac7b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_TripleKick_branch_cac95
- anim_jumpif $2, BattleAnim_TripleKick_branch_caca5
+ anim_if_param_equal $1, BattleAnim_TripleKick_branch_cac95
+ anim_if_param_equal $2, BattleAnim_TripleKick_branch_caca5
anim_sound 0, 1, SFX_MEGA_KICK
anim_obj ANIM_OBJ_07, -14, 0, 6, 0, $0
anim_wait 6
@@ -3447,7 +3448,7 @@ BattleAnim_Snore: ; cad6b
; cad86
BattleAnim_Curse: ; cad86
- anim_jumpif $1, .NotGhost
+ anim_if_param_equal $1, .NotGhost
anim_2gfx ANIM_GFX_HIT, ANIM_GFX_OBJECTS
anim_obj ANIM_OBJ_A5, 8, 4, 9, 0, $0
anim_sound 0, 0, SFX_CURSE
@@ -3551,7 +3552,7 @@ BattleAnim_CottonSpore: ; cae84
anim_1gfx ANIM_GFX_MISC
anim_sound 0, 1, SFX_POWDER
.loop ; cae8b
- anim_obj ANIM_OBJ_81, -16, 4, 4, 0, $0
+ anim_obj ANIM_OBJ_COTTON_SPORE, -16, 4, 4, 0, $0
anim_wait 8
anim_loop 5, .loop
anim_wait 96
@@ -3750,9 +3751,9 @@ BattleAnim_Octazooka: ; cb06f
anim_sound 6, 2, SFX_SLUDGE_BOMB
anim_obj ANIM_OBJ_8C, 8, 0, 11, 4, $4
anim_wait 16
- anim_obj ANIM_OBJ_1C, -16, 4, 7, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -16, 4, 7, 0, $10
anim_wait 8
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
.loop
anim_obj ANIM_OBJ_74, -16, 4, 7, 4, $20
anim_wait 8
@@ -3810,7 +3811,7 @@ BattleAnim_DestinyBond: ; cb0f0
anim_1gfx ANIM_GFX_ANGELS
anim_bgp $1b
anim_obp0 $0
- anim_jumpif $1, BattleAnim_DestinyBond_branch_cb104
+ anim_if_param_equal $1, BattleAnim_DestinyBond_branch_cb104
anim_sound 6, 2, SFX_WHIRLWIND
anim_obj ANIM_OBJ_9B, 5, 4, 15, 0, $2
anim_wait 128
@@ -4097,7 +4098,7 @@ BattleAnim_FuryCutter: ; cb386
anim_1gfx ANIM_GFX_CUT
.loop
anim_sound 0, 1, SFX_CUT
- anim_jumpand $1, .obj1
+ anim_if_param_and %00000001, .obj1
anim_obj ANIM_OBJ_3A, -13, 0, 5, 0, $0
anim_jump .okay
@@ -4223,7 +4224,7 @@ BattleAnim_Present: ; cb488
anim_obj ANIM_OBJ_53, 13, 0, 6, 0, $0
anim_wait 48
anim_incobj 2
- anim_jumpif $3, .heal
+ anim_if_param_equal $3, .heal
anim_incobj 1
anim_wait 1
anim_1gfx ANIM_GFX_EXPLOSION
@@ -4356,7 +4357,7 @@ BattleAnim_Megahorn: ; cb5c0
anim_bgeffect ANIM_BG_1F, $40, $2, $0
anim_wait 48
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $3
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $1
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $1
anim_sound 0, 1, SFX_HORN_ATTACK
anim_wait 16
anim_obj ANIM_OBJ_00, -15, 0, 7, 0, $0
@@ -4399,7 +4400,7 @@ BattleAnim_Encore: ; cb5fe
BattleAnim_Pursuit: ; cb61b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_Pursuit_branch_cb62b
+ anim_if_param_equal $1, BattleAnim_Pursuit_branch_cb62b
anim_sound 0, 1, SFX_COMET_PUNCH
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
anim_wait 16
@@ -4534,7 +4535,7 @@ BattleAnim_MorningSun: ; cb739
anim_wait 6
anim_loop 5, .loop
anim_wait 32
- anim_jumpif $0, .zero
+ anim_if_param_equal 0, .zero
anim_call BattleAnim_MorningSun_branch_cbc6a
anim_ret
; cb756
@@ -4553,12 +4554,12 @@ BattleAnim_Synthesis: ; cb75a
anim_wait 72
anim_incbgeffect ANIM_BG_18
anim_call BattleAnim_ShowMon_0
- anim_jumpif $1, BattleAnim_Synthesis_branch_cb77a
+ anim_if_param_equal $1, .one
anim_call BattleAnim_Synthesis_branch_cbc6a
anim_ret
; cb77a
-BattleAnim_Synthesis_branch_cb77a: ; cb77a
+.one
anim_call BattleAnim_Synthesis_branch_cbc80
anim_ret
; cb77e
@@ -4592,12 +4593,11 @@ BattleAnim_Moonlight: ; cb7a8
anim_wait 1
anim_sound 0, 0, SFX_MOONLIGHT
anim_wait 63
- anim_jumpif $3, BattleAnim_Moonlight_branch_cb7d7
+ anim_if_param_equal $3, .three
anim_call BattleAnim_Moonlight_branch_cbc6a
anim_ret
-; cb7d7
-BattleAnim_Moonlight_branch_cb7d7: ; cb7d7
+.three
anim_call BattleAnim_Moonlight_branch_cbc80
anim_ret
; cb7db
@@ -4811,7 +4811,7 @@ BattleAnim_ShadowBall: ; cb9c6
anim_sound 6, 2, SFX_SLUDGE_BOMB
anim_obj ANIM_OBJ_B4, 8, 0, 11, 4, $2
anim_wait 32
- anim_obj ANIM_OBJ_1C, -16, 4, 7, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -16, 4, 7, 0, $10
anim_wait 24
anim_ret
; cb9db
@@ -4877,7 +4877,7 @@ BattleAnim_Whirlpool: ; cba6a
; cba84
BattleAnim_BeatUp: ; cba84
- anim_jumpif $0, .current_mon
+ anim_if_param_equal $0, .current_mon
anim_sound 0, 0, SFX_BALL_POOF
anim_bgeffect ANIM_BG_RETURN_MON, $0, $1, $0
anim_wait 16
diff --git a/battle/bg_effects.asm b/battle/bg_effects.asm
index 52917b61f..b7f415770 100644
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -111,7 +111,7 @@ BattleBGEffects: ; c805a (32:405a)
dw BattleBGEffect_1e
dw BattleBGEffect_1f
dw BattleBGEffect_20
- dw BattleBGEffect_21
+ dw BattleBGEffect_Withdraw
dw BattleBGEffect_BounceDown
dw BattleBGEffect_Dig
dw BattleBGEffect_Tackle
@@ -738,9 +738,9 @@ BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed)
ld l, a
ld a, [wBattleAnimTemp2]
ld h, a
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hl]
cp -1
jr z, .end
@@ -805,9 +805,9 @@ endr
ld e, [hl]
ld d, 0
ld hl, .BGSquares
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hli]
ld b, a
and $f
@@ -933,7 +933,7 @@ BattleBGEffect_Surf: ; c8545 (32:4545)
call InitSurfWaves
.one
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
and a
ret z
push bc
@@ -963,7 +963,7 @@ BattleBGEffect_Surf: ; c8545 (32:4545)
ld hl, wSurfWaveBGEffect
ld bc, $0
.loop2
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp e
jr nc, .load_zero
push hl
@@ -997,12 +997,12 @@ BattleBGEffect_Whirlpool: ; c8599 (32:4599)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
- ld [hFFC6], a
+ ld a, rSCY - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
lb de, 2, 2
call Functionc8f2e
ret
@@ -1017,7 +1017,7 @@ BattleBGEffect_Whirlpool: ; c8599 (32:4599)
BattleBGEffect_30: ; c85c2 (32:45c2)
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
call EndBattleBGEffect
ret
@@ -1071,12 +1071,12 @@ BattleBGEffect_Psychic: ; c8607 (32:4607)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5f
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
lb de, 6, 5
call Functionc8f2e
ld hl, BG_EFFECT_STRUCT_03
@@ -1109,7 +1109,7 @@ BattleBGEffect_Teleport: ; c863f (32:463f)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
lb de, 6, 5
call Functionc8f2e
@@ -1134,7 +1134,7 @@ BattleBGEffect_NightShade: ; c8662 (32:4662)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@@ -1165,11 +1165,11 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $0
@@ -1224,9 +1224,9 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689)
inc a
ld d, a
ld h, LYOverridesBackup / $100
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
srl a
push af
@@ -1257,15 +1257,15 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld e, [hl]
ld d, 2
call Functionc8f2e
- ld h, $d2
- ld a, [hFFC8]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideEnd]
ld l, a
ld [hl], $0
dec l
@@ -1273,9 +1273,9 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709)
ret
.one
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
ld l, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
ld e, l
ld d, h
dec de
@@ -1283,11 +1283,11 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709)
ld a, [de]
dec de
ld [hld], a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp l
jr nz, .loop
ld [hl], $90
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
ld l, a
ld a, [hl]
cp $1
@@ -1309,7 +1309,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709)
call BattleAnim_ResetLCDStatCustom
ret
-BattleBGEffect_21: ; c8761 (32:4761)
+BattleBGEffect_Withdraw: ; c8761 (32:4761)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
@@ -1320,11 +1320,11 @@ BattleBGEffect_21: ; c8761 (32:4761)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1341,7 +1341,7 @@ BattleBGEffect_21: ; c8761 (32:4761)
ld a, [hl]
cp d
ret nc
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -1370,11 +1370,11 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $2
@@ -1396,9 +1396,9 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7)
ld [hl], $10
call BattleBGEffects_IncrementJumptable
.two
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
dec a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@@ -1414,7 +1414,7 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7)
dec [hl]
.skip
pop af
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
inc [hl]
@@ -1437,11 +1437,11 @@ BattleBGEffect_Tackle: ; c8805 (32:4805)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1472,11 +1472,11 @@ BattleBGEffect_25: ; c8837 (32:4837)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms2
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1546,19 +1546,19 @@ Functionc88a5: ; c88a5 (32:48a5)
jr z, .rollout
.not_rollout
pop af
- jp Functionc900b
+ jp BGEffect_FillLYOverridesBackup
.rollout
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld d, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub d
ld d, a
ld h, LYOverridesBackup / $100
ld a, [hSCY]
or a
jr nz, .skip1
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
or a
jr z, .skip2
dec a
@@ -1567,14 +1567,14 @@ Functionc88a5: ; c88a5 (32:48a5)
jr .skip2
.skip1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], $0
.skip2
ld a, [hSCY]
ld l, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
sub l
jr nc, .skip3
xor a
@@ -1604,11 +1604,11 @@ BattleBGEffect_2d: ; c88e7 (32:48e7)
BGEffect2d_2f_zero:
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1648,11 +1648,11 @@ BattleBGEffect_26: ; c892a (32:492a)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1664,7 +1664,7 @@ BattleBGEffect_26: ; c892a (32:492a)
ld a, [hl]
ld d, $8
call BattleBGEffects_Sine
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -1687,11 +1687,11 @@ BattleBGEffect_2c: ; c8964 (32:4964)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
xor a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@@ -1714,7 +1714,7 @@ BattleBGEffect_2c: ; c8964 (32:4964)
ld e, a
pop af
add e
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hl]
@@ -1742,7 +1742,7 @@ BattleBGEffect_28: ; c89b5 (32:49b5)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ret
@@ -1785,11 +1785,11 @@ BattleBGEffect_BounceDown: ; c89ee (32:49ee)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms2
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1814,7 +1814,7 @@ BattleBGEffect_BounceDown: ; c89ee (32:49ee)
ld d, a
pop af
add d
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
inc [hl]
@@ -1841,14 +1841,14 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a)
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
- ld a, [hFFC7]
+ ld [hLYOverrideEnd], a
+ ld a, [hLYOverrideStart]
ld l, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
.loop
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp l
jr z, .done
xor a
@@ -1873,9 +1873,9 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a)
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
inc a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
call BattleBGEffects_IncrementJumptable
ret
@@ -1883,7 +1883,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a)
call .GetLYOverride
jr nc, .finish
call .SetLYOverridesBackup
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], e
@@ -1895,9 +1895,9 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a)
.SetLYOverridesBackup:
ld e, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
srl a
ld h, LYOverridesBackup / $100
@@ -1944,7 +1944,7 @@ BattleBGEffect_2b: ; c8acc (32:4acc)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@@ -1986,12 +1986,12 @@ BattleBGEffect_1c: ; c8b00 (32:4b00)
call BattleBGEffects_IncrementJumptable
ld a, $e4
call BattleBGEffects_SetLYOverrides
- ld a, $47
- ld [hFFC6], a
+ ld a, rBGP - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $60
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
.one
@@ -2221,11 +2221,11 @@ BattleBGEffect_VibrateMon: ; c8c61 (32:4c61)
.zero ; c8c68 (32:4c68)
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -2249,7 +2249,7 @@ BattleBGEffect_VibrateMon: ; c8c61 (32:4c61)
xor $ff
inc a
ld [hl], a
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ret
.finish
@@ -2267,12 +2267,12 @@ BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2)
.zero ; c8cab (32:4cab)
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $37
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -2286,7 +2286,7 @@ BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2)
jr nc, .two
ld d, $6
call BattleBGEffects_Sine
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -2435,9 +2435,9 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77)
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -2463,7 +2463,7 @@ BGEffect_RapidCyclePals: ; c8d77 (32:4d77)
ld [hl], a
call BattleBGEffect_GetFirstDMGPal
jr c, .okay_2_dmg
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ret
.okay_2_dmg
@@ -2655,7 +2655,7 @@ BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2)
BattleBGEffects_ClearLYOverrides: ; c8eca (32:4eca)
xor a
BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb)
- ld hl, LYOverrides ; wd100
+ ld hl, LYOverrides ; wListPointer
ld e, $99
.loop1
ld [hli], a
@@ -2670,7 +2670,7 @@ BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb)
ret
BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede)
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@@ -2680,13 +2680,13 @@ BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede)
lb de, $2f, $5e
.okay
ld a, d
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4)
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@@ -2696,30 +2696,30 @@ BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4)
lb de, $2d, $5e
.okay
ld a, d
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a)
xor a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call EndBattleBGEffect
ret
BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19)
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, %11100100
ld [rBGP], a
ld [wBGP], a
ld [wOBP1], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
ret
@@ -2735,10 +2735,10 @@ Functionc8f2e: ; c8f2e (32:4f2e)
ld [wBattleAnimTemp3], a
ld bc, LYOverridesBackup
.loop
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp c
jr nc, .next
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp c
jr c, .next
ld a, [wBattleAnimTemp2]
@@ -2812,14 +2812,14 @@ Functionc8f9a: ; c8f9a (32:4f9a)
call BattleBGEffects_Sine
ld e, a
pop hl
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp c
jr c, .skip1
ld a, e
ld [bc], a
inc bc
.skip1
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp l
jr nc, .skip2
ld [hl], e
@@ -2837,7 +2837,7 @@ Functionc8f9a: ; c8f9a (32:4f9a)
ret
.GetLYOverrideBackupAddrOffset:
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld e, a
ld a, [wBattleAnimTemp0]
add e
@@ -2847,13 +2847,13 @@ Functionc8f9a: ; c8f9a (32:4f9a)
BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
push bc
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
inc a
ld e, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
ld d, h
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
and a
jr z, .done
@@ -2872,44 +2872,45 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
pop bc
ret
-Functionc900b: ; c900b (32:500b)
+BGEffect_FillLYOverridesBackup: ; c900b (32:500b)
push af
- ld h, $d2
- ld a, [hFFC7]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
ld d, a
pop af
-.asm_c9016
+.loop
ld [hli], a
dec d
- jr nz, .asm_c9016
+ jr nz, .loop
ret
-Functionc901b: ; c901b (32:501b)
+BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b)
+ ; e = a; d = [hLYOverrideEnd] - [hLYOverrideStart] - a
push af
ld e, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
sub e
ld d, a
- ld h, $d2
- ld a, [hFFC7]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideStart]
ld l, a
ld a, $90
-.asm_c902c
+.loop
ld [hli], a
dec e
- jr nz, .asm_c902c
+ jr nz, .loop
pop af
xor $ff
-.asm_c9033
+.loop2
ld [hli], a
dec d
- jr nz, .asm_c9033
+ jr nz, .loop2
ret
BGEffect_CheckBattleTurn: ; c9038 (32:5038)
diff --git a/battle/core.asm b/battle/core.asm
index eb73f77a2..dec315ab8 100644
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -7,7 +7,7 @@ DoBattle: ; 3c000
ld [wPlayerAction], a
ld [BattleEnded], a
inc a
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
ld hl, OTPartyMon1HP
ld bc, PARTYMON_STRUCT_LENGTH - 1
ld d, BATTLEACTION_SWITCH1 - 1
@@ -116,8 +116,6 @@ DoBattle: ; 3c000
jp BattleMenu
; 3c0e5
-
-
WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
call Call_LoadTempTileMapToTileMap
ld a, [wBattleResult]
@@ -160,7 +158,6 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
ret
; 3c12f
-
BattleTurn: ; 3c12f
.loop
call MobileFn_3c1bf
@@ -170,7 +167,7 @@ BattleTurn: ; 3c12f
xor a
ld [wPlayerIsSwitching], a
ld [wEnemyIsSwitching], a
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
ld [wPlayerJustGotFrozen], a
ld [wEnemyJustGotFrozen], a
ld [CurDamage], a
@@ -183,7 +180,7 @@ BattleTurn: ; 3c12f
call IsMobileBattle
jr nz, .not_disconnected
callba Function100da5
- callba Function100641
+ callba StartMobileInactivityTimer
callba Function100dd8
jp c, .quit
.not_disconnected
@@ -252,7 +249,6 @@ MobileFn_3c1bf: mobile
ret
; 3c1d6
-
HandleBetweenTurnEffects: ; 3c1d6
ld a, [hLinkPlayerNumber]
cp $1
@@ -769,7 +765,6 @@ HandleEncore: ; 3c4df
jp StdBattleTextBox
; 3c543
-
TryEnemyFlee: ; 3c543
ld a, [wBattleMode]
dec a
@@ -861,7 +856,6 @@ AlwaysFleeMons: ; 3c5b1
db -1
; 3c5b4
-
CompareMovePriority: ; 3c5b4
; Compare the priority of the player and enemy's moves.
; Return carry if the player goes first, or z if they match.
@@ -915,7 +909,6 @@ MoveEffectPriorities: ; 3c5df
db -1
; 3c5ec
-
GetMoveEffect: ; 3c5ec
ld a, b
dec a
@@ -928,7 +921,6 @@ GetMoveEffect: ; 3c5ec
ret
; 3c5fe
-
Battle_EnemyFirst: ; 3c5fe
call LoadTileMapToTempTileMap
call TryEnemyFlee
@@ -1695,7 +1687,6 @@ HandleSafeguard: ; 3cafb
ld hl, BattleText_SafeguardFaded
jp StdBattleTextBox
-
HandleScreens: ; 3cb36
ld a, [hLinkPlayerNumber]
cp 1
@@ -1739,7 +1730,6 @@ HandleScreens: ; 3cb36
db "Enemy@"
; 3cb80
-
.LightScreenTick: ; 3cb80
ld a, [de]
dec a
@@ -1878,7 +1868,6 @@ SubtractHPFromUser: ; 3cc3f
jp UpdateHPBarBattleHuds
; 3cc45
-
SubtractHP: ; 3cc45
ld hl, BattleMonHP
ld a, [hBattleTurn]
@@ -1925,7 +1914,6 @@ GetSixteenthMaxHP: ; 3cc76
ret
; 3cc83
-
GetEighthMaxHP: ; 3cc83
; output: bc
call GetQuarterMaxHP
@@ -1941,7 +1929,6 @@ GetEighthMaxHP: ; 3cc83
ret
; 3cc8e
-
GetQuarterMaxHP: ; 3cc8e
; output: bc
call GetMaxHP
@@ -1962,7 +1949,6 @@ GetQuarterMaxHP: ; 3cc8e
ret
; 3cc9f
-
GetHalfMaxHP: ; 3cc9f
; output: bc
call GetMaxHP
@@ -1980,7 +1966,6 @@ GetHalfMaxHP: ; 3cc9f
ret
; 3ccac
-
GetMaxHP: ; 3ccac
; output: bc, Buffer1-2
@@ -2036,7 +2021,6 @@ CheckUserHasEnoughHP: ; 3ccde
ret
; 3ccef
-
RestoreHP ; 3ccef
ld hl, EnemyMonMaxHP
ld a, [hBattleTurn]
@@ -2349,8 +2333,6 @@ IsAnyMonHoldingExpShare: ; 3ceaa
ret
; 3ceec
-
-
StopDangerSound: ; 3ceec
xor a
ld [Danger], a
@@ -2503,8 +2485,8 @@ WinTrainerBattle: ; 3cfa4
call BattleWinSlideInEnemyTrainerFrontpic
ld c, 40
call DelayFrames
- ld c, $4
- callba Function4ea0a
+ ld c, $4 ; win
+ callba Mobile_PrintOpponentBattleMessage
ret
.battle_tower
@@ -2622,7 +2604,6 @@ WinTrainerBattle: ; 3cfa4
dw SentAllToMomText
; 3d0b1
-
.CheckMaxedOutMomMoney: ; 3d0b1
ld hl, wMomsMoney + 2
ld a, [hld]
@@ -2642,7 +2623,7 @@ AddBattleMoneyToAccount: ; 3d0be
push bc
ld b, h
ld c, l
- callba MobileFn_106008
+ callba TrainerRankings_AddToBattlePayouts
pop bc
pop hl
.loop
@@ -2705,8 +2686,6 @@ PlayVictoryMusic: ; 3d0ea
ret
; 3d123
-
-
; These functions check if the current opponent is a gym leader or one of a
; few other special trainers.
@@ -2760,7 +2739,6 @@ KantoGymLeaders:
db BLUE
db -1
-
HandlePlayerMonFaint: ; 3d14e
call FaintYourPokemon
ld hl, EnemyMonHP
@@ -2961,7 +2939,6 @@ PlayerPartyMonEntrance: ; 3d2b3
jp SpikesDamage
; 3d2e0
-
CheckMobileBattleError: ; 3d2e0
ld a, [wLinkMode]
cp LINK_MOBILE
@@ -3060,7 +3037,6 @@ ForcePickPartyMonInBattle: ; 3d362
jr .pick
; 3d375
-
PickSwitchMonInBattle: ; 3d375
.pick
call PickPartyMonInBattle
@@ -3085,7 +3061,6 @@ ForcePickSwitchMonInBattle: ; 3d380
ret
; 3d38e
-
LostBattle: ; 3d38e
ld a, 1
ld [BattleEnded], a
@@ -3176,13 +3151,12 @@ LostBattle: ; 3d38e
ld c, 40
call DelayFrames
- ld c, $3
- callba Function4ea0a
+ ld c, $3 ; lost
+ callba Mobile_PrintOpponentBattleMessage
scf
ret
; 3d432
-
EnemyMonFaintedAnimation: ; 3d432
hlcoord 12, 5
decoord 12, 6
@@ -3250,7 +3224,6 @@ MonFaintedAnimation: ; 3d444
db " @"
; 3d490
-
SlideBattlePicOut: ; 3d490
ld [hMapObjectIndexBuffer], a
ld c, a
@@ -3297,7 +3270,6 @@ SlideBattlePicOut: ; 3d490
ret
; 3d4c3
-
ForceEnemySwitch: ; 3d4c3
call ResetEnemyBattleVars
ld a, [wEnemySwitchMonIndex]
@@ -3313,7 +3285,6 @@ ForceEnemySwitch: ; 3d4c3
ret
; 3d4e1
-
EnemySwitch: ; 3d4e1
call CheckWhetherToAskSwitch
jr nc, EnemySwitch_SetMode
@@ -3372,14 +3343,14 @@ CheckWhetherSwitchmonIsPredetermined: ; 3d533
.not_linked
ld a, [wEnemySwitchMonIndex]
and a
- jr z, .check_wAISwitch
+ jr z, .check_wBattleHasJustStarted
dec a
ld b, a
jr .return_carry
-.check_wAISwitch
- ld a, [wAISwitch]
+.check_wBattleHasJustStarted
+ ld a, [wBattleHasJustStarted]
and a
ld b, $0
jr nz, .return_carry
@@ -3655,7 +3626,7 @@ LoadEnemyPkmnToSwitchTo: ; 3d6ca
; 3d714
CheckWhetherToAskSwitch: ; 3d714
- ld a, [wAISwitch]
+ ld a, [wBattleHasJustStarted]
dec a
jp z, .return_nc
ld a, [PartyCount]
@@ -3846,7 +3817,6 @@ CheckPlayerPartyForFitPkmn: ; 3d873
ret
; 3d887
-
CheckIfCurPartyMonIsFitToFight: ; 3d887
ld a, [CurPartyMon]
ld hl, PartyMon1HP
@@ -3855,7 +3825,7 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887
or [hl]
ret nz
- ld a, [wAISwitch]
+ ld a, [wBattleHasJustStarted]
and a
jr nz, .finish_fail
ld hl, PartySpecies
@@ -3878,7 +3848,6 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887
ret
; 3d8b3
-
TryToRunAwayFromBattle: ; 3d8b3
; Run away from battle, with or without item
ld a, [BattleType]
@@ -4068,7 +4037,6 @@ TryToRunAwayFromBattle: ; 3d8b3
ret
; 3da0d
-
InitBattleMon: ; 3da0d
ld a, MON_SPECIES
call GetPartyParamLocation
@@ -4080,9 +4048,9 @@ InitBattleMon: ; 3da0d
ld de, BattleMonDVs
ld bc, MON_PKRUS - MON_DVS
call CopyBytes
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld de, BattleMonLevel
ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
call CopyBytes
@@ -4159,7 +4127,6 @@ ResetPlayerStatLevels: ; 3dab1
ret
; 3dabd
-
InitEnemyMon: ; 3dabd
ld a, [CurPartyMon]
ld hl, OTPartyMon1Species
@@ -4172,9 +4139,9 @@ InitEnemyMon: ; 3dabd
ld de, EnemyMonDVs
ld bc, MON_PKRUS - MON_DVS
call CopyBytes
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld de, EnemyMonLevel
ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
call CopyBytes
@@ -4213,7 +4180,6 @@ endr
ret
; 3db32
-
SwitchPlayerMon: ; 3db32
call ClearSprites
ld a, [CurBattleMon]
@@ -4234,7 +4200,6 @@ SwitchPlayerMon: ; 3db32
ret
; 3db5f
-
SendOutPlayerMon: ; 3db5f
ld hl, BattleMonDVs
predef GetUnownLetter
@@ -4302,9 +4267,9 @@ rept 4
endr
ld [hl], a
ld hl, PlayerUsedMoves
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld [PlayerDisableCount], a
ld [PlayerFuryCutterCount], a
@@ -4580,7 +4545,6 @@ UseOpponentItem:
jp StdBattleTextBox
; 3ddc8
-
ItemRecoveryAnim: ; 3ddc8
push hl
push de
@@ -4665,7 +4629,6 @@ UseHeldStatusHealingItem: ; 3dde9
db $ff
; 3de51
-
UseConfusionHealingItem: ; 3de51
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
@@ -4713,21 +4676,21 @@ HandleStatBoostingHeldItems: ; 3de97
ld a, [hLinkPlayerNumber]
cp $1
jr z, .player_1
- call .DoEnemy
- jp .DoPlayer
-
-.player_1
call .DoPlayer
jp .DoEnemy
+
+.player_1
+ call .DoEnemy
+ jp .DoPlayer
; 3dea9
-.DoEnemy: ; 3dea9
+.DoPlayer: ; 3dea9
call GetPartymonItem
ld a, $0
jp .HandleItem
; 3deb1
-.DoPlayer: ; 3deb1
+.DoEnemy: ; 3deb1
call GetOTPartymonItem
ld a, $1
.HandleItem: ; 3deb6
@@ -4790,7 +4753,6 @@ HandleStatBoostingHeldItems: ; 3de97
db $ff
; 3df12
-
GetPartymonItem: ; 3df12
ld hl, PartyMon1Item
ld a, [CurBattleMon]
@@ -4824,8 +4786,6 @@ UpdateBattleHUDs: ; 3df2c
ret
; 3df48
-
-
UpdatePlayerHUD:: ; 3df48
push hl
push de
@@ -4939,7 +4899,7 @@ PrintPlayerHUD: ; 3dfbf
pop hl
dec hl
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
callab GetGender
ld a, " "
@@ -5017,7 +4977,7 @@ DrawEnemyHUD: ; 3e043
ld a, [hl]
ld [de], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
callab GetGender
ld a, " "
@@ -5164,7 +5124,6 @@ BattleMenu: ; 3e139
jr z, .skip_dude_pack_select
callba _DudeAutoInput_DownA
.skip_dude_pack_select
-
call LoadBattleMenu2
ret c
@@ -5383,35 +5342,42 @@ BattleMenuPKMN_Loop:
Battle_StatsScreen: ; 3e308
call DisableLCD
+
ld hl, VTiles2 tile $31
ld de, VTiles0
- ld bc, $0110
+ ld bc, $11 tiles
call CopyBytes
+
ld hl, VTiles2
ld de, VTiles0 tile $11
ld bc, $31 tiles
call CopyBytes
+
call EnableLCD
+
call ClearSprites
call LowVolume
xor a ; PARTYMON
ld [MonType], a
callba BattleStatsScreenInit
call MaxVolume
+
call DisableLCD
+
ld hl, VTiles0
ld de, VTiles2 tile $31
ld bc, $11 tiles
call CopyBytes
+
ld hl, VTiles0 tile $11
ld de, VTiles2
ld bc, $31 tiles
call CopyBytes
+
call EnableLCD
ret
; 3e358
-
TryPlayerSwitch: ; 3e358
ld a, [CurBattleMon]
ld d, a
@@ -5566,7 +5532,6 @@ PassedBattleMonEntrance: ; 3e459
jp SpikesDamage
; 3e489
-
BattleMenu_Run: ; 3e489
call Call_LoadTempTileMapToTileMap
ld a, $3
@@ -5583,7 +5548,6 @@ BattleMenu_Run: ; 3e489
jp BattleMenu
; 3e4a8
-
CheckAmuletCoin: ; 3e4a8
ld a, [BattleMonItem]
ld b, a
@@ -5990,7 +5954,6 @@ MoveInfoBox: ; 3e6c8
db "TYPE/@"
; 3e75f
-
.PrintPP: ; 3e75f
hlcoord 5, 11
ld a, [wLinkMode] ; What's the point of this check?
@@ -6048,7 +6011,7 @@ CheckPlayerHasUsableMoves: ; 3e786
jr .loop
.done
- and a
+ and a ; This is probably a bug, and will result in a move with PP Up confusing the game.
ret nz
.force_struggle
@@ -6060,8 +6023,6 @@ CheckPlayerHasUsableMoves: ; 3e786
ret
; 3e7c1
-
-
ParseEnemyAction: ; 3e7c1
ld a, [wEnemyIsSwitching]
and a
@@ -6242,7 +6203,6 @@ LinkBattleSendReceiveAction: ; 3e8e4
ret
; 3e8eb
-
LoadEnemyMon: ; 3e8eb
; Initialize enemy monster parameters
; To do this we pull the species from TempEnemyMonSpecies
@@ -6275,7 +6235,6 @@ LoadEnemyMon: ; 3e8eb
; Grab the BaseData for this species
call GetBaseData
-
; Let's get the item:
; Is the item predetermined?
@@ -6290,7 +6249,6 @@ LoadEnemyMon: ; 3e8eb
ld a, [hl]
jr .UpdateItem
-
.WildItem:
; In a wild battle, we pull from the item slots in BaseData
@@ -6320,11 +6278,9 @@ LoadEnemyMon: ; 3e8eb
jr nc, .UpdateItem
ld a, [BaseItems+1]
-
.UpdateItem:
ld [EnemyMonItem], a
-
; Initialize DVs
; If we're in a trainer battle, DVs are predetermined
@@ -6346,7 +6302,6 @@ LoadEnemyMon: ; 3e8eb
ld [de], a
jp .Happiness
-
.InitDVs:
; Trainer DVs
@@ -6359,7 +6314,6 @@ LoadEnemyMon: ; 3e8eb
dec a
jr nz, .UpdateDVs
-
; Wild DVs
; Here's where the fun starts
@@ -6402,7 +6356,6 @@ LoadEnemyMon: ; 3e8eb
; We're done with DVs
jr .UpdateDVs
-
.NotRoaming:
; Register a contains BattleType
@@ -6429,16 +6382,13 @@ LoadEnemyMon: ; 3e8eb
ld [hli], a
ld [hl], c
-
; We've still got more to do if we're dealing with a wild monster
ld a, [wBattleMode]
dec a
jr nz, .Happiness
-
; Species-specfic:
-
; Unown
ld a, [TempEnemyMonSpecies]
cp a, UNOWN
@@ -6452,7 +6402,6 @@ LoadEnemyMon: ; 3e8eb
call CheckUnownLetter
jr c, .GenerateDVs ; try again
-
.Magikarp:
; Skimming this part recommended
@@ -6513,7 +6462,6 @@ LoadEnemyMon: ; 3e8eb
cp a, 1024 >> 8
jr c, .GenerateDVs ; try again
-
; Finally done with DVs
.Happiness:
@@ -6526,7 +6474,7 @@ LoadEnemyMon: ; 3e8eb
; Fill stats
ld de, EnemyMonMaxHP
ld b, FALSE
- ld hl, LinkBattleRNs + 7 ; ?
+ ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ?
predef CalcPkmnStats
; If we're in a trainer battle,
@@ -6588,7 +6536,6 @@ LoadEnemyMon: ; 3e8eb
ld [hl], a
jr .Moves
-
.OpponentParty:
; Get HP from the party struct
ld hl, (OTPartyMon1HP + 1)
@@ -6608,7 +6555,6 @@ LoadEnemyMon: ; 3e8eb
ld a, [hl] ; OTPartyMonStatus
ld [EnemyMonStatus], a
-
.Moves:
ld hl, BaseType1
ld de, EnemyMonType1
@@ -6637,9 +6583,9 @@ LoadEnemyMon: ; 3e8eb
xor a
ld h, d
ld l, e
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
; Make sure the predef knows this isn't a partymon
ld [MagikarpLength], a
@@ -6718,7 +6664,6 @@ endr
ret
; 3eb38
-
CheckSleepingTreeMon: ; 3eb38
; Return carry if species is in the list
; for the current time of day
@@ -6779,7 +6724,6 @@ CheckSleepingTreeMon: ; 3eb38
db -1 ; end
; 3eb75
-
CheckUnownLetter: ; 3eb75
; Return carry if the Unown letter hasn't been unlocked yet
@@ -6848,7 +6792,6 @@ CheckUnownLetter: ; 3eb75
; 3ebc7
-
SwapBattlerLevels: ; 3ebc7
; unreferenced
push bc
@@ -6924,7 +6867,6 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8
ret
; 3ec2c
-
ApplyStatusEffectOnPlayerStats: ; 3ec2c
ld a, 1
jr ApplyStatusEffectOnStats
@@ -7143,7 +7085,6 @@ ApplyStatLevelMultiplier: ; 3ecb7
db 4, 1 ; 400%
; 3ed45
-
BadgeStatBoosts: ; 3ed45
; Raise BattleMon stats depending on which badges have been obtained.
@@ -7202,7 +7143,6 @@ BadgeStatBoosts: ; 3ed45
ret
; 3ed7c
-
BoostStat: ; 3ed7c
; Raise stat at hl by 1/8.
@@ -7235,7 +7175,6 @@ BoostStat: ; 3ed7c
ret
; 3ed9f
-
_LoadBattleFontsHPBar: ; 3ed9f
callab LoadBattleFontsHPBar
ret
@@ -7246,7 +7185,6 @@ _LoadHPBar: ; 3eda6
ret
; 3edad
-
LoadHPExpBarGFX: ; unreferenced
ld de, EnemyHPBarBorderGFX
ld hl, VTiles2 tile $6c
@@ -7262,7 +7200,6 @@ LoadHPExpBarGFX: ; unreferenced
jp Get2bpp
; 3edd1
-
EmptyBattleTextBox: ; 3edd1
ld hl, .empty
jp BattleTextBox
@@ -7270,7 +7207,6 @@ EmptyBattleTextBox: ; 3edd1
db "@"
; 3edd8
-
_BattleRandom:: ; 3edd8
; If the normal RNG is used in a link battle it'll desync.
; To circumvent this a shared PRNG is used instead.
@@ -7340,7 +7276,6 @@ _BattleRandom:: ; 3edd8
ret
; 3ee0f
-
Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar
@@ -7373,7 +7308,6 @@ FinishBattleAnim: ; 3ee27
ret
; 3ee3b
-
GiveExperiencePoints: ; 3ee3b
; Give experience.
; Don't give experience if linked or in the Battle Tower.
@@ -7832,7 +7766,6 @@ TextJump_StringBuffer2ExpPoints: ; 3f131
db "@"
; 3f136
-
AnimateExpBar: ; 3f136
push bc
@@ -8019,8 +7952,6 @@ AnimateExpBar: ; 3f136
ld [hBGMapMode], a
ret
-
-
SendOutPkmnText: ; 3f26d
ld a, [wLinkMode]
and a
@@ -8028,7 +7959,7 @@ SendOutPkmnText: ; 3f26d
ld hl, JumpText_GoPkmn ; If we're in a LinkBattle print just "Go <PlayerMon>"
- ld a, [wAISwitch] ; unless this (unidentified) variable is set
+ ld a, [wBattleHasJustStarted] ; unless this (unidentified) variable is set
and a
jr nz, .skip_to_textbox
@@ -8083,7 +8014,6 @@ SendOutPkmnText: ; 3f26d
jp BattleTextBox
; 3f2d1
-
JumpText_GoPkmn: ; 3f2d1
text_jump Text_GoPkmn
start_asm
@@ -8197,7 +8127,6 @@ TextJump_ComeBack: ; 3f35b
db "@"
; 3f360
-
HandleSafariAngerEatingStatus: ; unreferenced
ld hl, wSafariMonEating
ld a, [hl]
@@ -8230,7 +8159,6 @@ HandleSafariAngerEatingStatus: ; unreferenced
jp StdBattleTextBox
; 3f390
-
FillInExpBar: ; 3f390
push hl
call CalcExpBar
@@ -8447,7 +8375,6 @@ GetFrontpic_DoAnim: ; 3f4b4
ret
; 3f4c1
-
StartBattle: ; 3f4c1
; This check prevents you from entering a battle without any Pokemon.
; Those using walk-through-walls to bypass getting a Pokemon experience
@@ -8467,16 +8394,14 @@ StartBattle: ; 3f4c1
ret
; 3f4d9
-
_DoBattle: ; 3f4d9
; unreferenced
call DoBattle
ret
; 3f4dd
-
BattleIntro: ; 3f4dd
- callba MobileFn_106050 ; mobile
+ callba TrainerRankings_Battles ; mobile
call LoadTrainerOrWildMonPic
xor a
ld [TempBattleMonSpecies], a
@@ -8561,7 +8486,7 @@ BackUpVBGMap2: ; 3f568
InitEnemyTrainer: ; 3f594
ld [TrainerClass], a
- callba MobileFn_10606a
+ callba TrainerRankings_TrainerBattles
xor a
ld [TempEnemyMonSpecies], a
callab GetTrainerAttributes
@@ -8617,7 +8542,7 @@ InitEnemyTrainer: ; 3f594
InitEnemyWildmon: ; 3f607
ld a, WILD_BATTLE
ld [wBattleMode], a
- callba MobileFn_10605d
+ callba TrainerRankings_WildBattles
call LoadEnemyMon
ld hl, EnemyMonMoves
ld de, wWildMonMoves
@@ -8702,7 +8627,6 @@ Function3f662: ; 3f662
ret
; 3f69e
-
ExitBattle: ; 3f69e
call .HandleEndOfBattle
call CleanUpBattleRAM
@@ -8801,7 +8725,7 @@ CheckPayDay: ; 3f71d
; 3f759
ShowLinkBattleParticipantsAfterEnd: ; 3f759
- callba MobileFn_1060df
+ callba TrainerRankings_LinkBattles
callba BackupMobileEventIndex
ld a, [CurOTMon]
ld hl, OTPartyMon1Status
@@ -8831,17 +8755,17 @@ DetermineMobileBattleResult: ; 3f77c
cp $1
jr c, .victory
jr z, .loss
- callba MobileFn_SaveBattleResult_Draw
+ callba TrainerRankings_ColosseumDraws
ld de, .Draw
jr .store_result
.victory
- callba MobileFn_SaveBattleResult_Win
+ callba TrainerRankings_ColosseumWins
ld de, .Win
jr .store_result
.loss
- callba MobileFn_SaveBattleResult_Lose
+ callba TrainerRankings_ColosseumLosses
ld de, .Lose
jr .store_result
@@ -8881,7 +8805,6 @@ DetermineMobileBattleResult: ; 3f77c
db " DRAW@"
; 3f80f
-
.Mobile_InvalidBattle: ; 3f80f
hlcoord 6, 8
ld de, .Invalid
@@ -8896,14 +8819,12 @@ DetermineMobileBattleResult: ; 3f77c
db "INVALID BATTLE@"
; 3f830
-
IsMobileBattle2: ; 3f830
ld a, [wLinkMode]
cp LINK_MOBILE
ret
; 3f836
-
DisplayLinkRecord: ; 3f836
ld a, BANK(sLinkBattleStats)
call GetSRAMBank
@@ -8916,7 +8837,7 @@ DisplayLinkRecord: ; 3f836
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
call WaitBGMap2
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ld c, 8
@@ -8925,7 +8846,6 @@ DisplayLinkRecord: ; 3f836
ret
; 3f85f
-
ReadAndPrintLinkBattleRecord: ; 3f85f
call ClearTileMap
call ClearSprites
@@ -9060,7 +8980,6 @@ ReadAndPrintLinkBattleRecord: ; 3f85f
db "TOTAL WIN LOSE DRAW@"
; 3f998
-
BattleEnd_HandleRoamMons: ; 3f998
ld a, [BattleType]
cp BATTLETYPE_ROAMING
@@ -9168,7 +9087,6 @@ GetRoamMonSpecies: ; 3fa31
ret
; 3fa42
-
AddLastMobileBattleToLinkRecord: ; 3fa42
ld hl, OTPlayerID
ld de, StringBuffer1
@@ -9429,7 +9347,7 @@ InitBattleDisplay: ; 3fb6c
ld [rSVBK], a
ld hl, wDecompressScratch
- ld bc, wBackupAttrMap - wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
ld a, " "
call ByteFill
@@ -9449,7 +9367,6 @@ InitBattleDisplay: ; 3fb6c
ret
; 3fbff
-
GetTrainerBackpic: ; 3fbff
; Load the player character's backpic (6x6) into VRAM starting from VTiles2 tile $31.
@@ -9484,7 +9401,6 @@ GetTrainerBackpic: ; 3fbff
ret
; 3fc30
-
CopyBackpic: ; 3fc30
ld a, [rSVBK]
push af
@@ -9543,7 +9459,6 @@ CopyBackpic: ; 3fc30
ret
; 3fc8b
-
BattleStartMessage: ; 3fc8b
ld a, [wBattleMode]
dec a
@@ -9598,7 +9513,7 @@ BattleStartMessage: ; 3fc8b
cp BATTLETYPE_FISH
jr nz, .NotFishing
- callba MobileFn_106086 ; update fishing records?
+ callba TrainerRankings_HookedEncounters
ld hl, HookedPokemonAttackedText
jr .PlaceBattleStartText
@@ -9621,8 +9536,8 @@ BattleStartMessage: ; 3fc8b
call IsMobileBattle2
ret nz
- ld c, $2
- callba Function4ea0a
+ ld c, $2 ; start
+ callba Mobile_PrintOpponentBattleMessage
ret
; 3fd26
diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm
index 5c1214cb7..a74dea632 100644
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -1541,11 +1541,6 @@ BattleCheckTypeMatchup: ; 347c8
and a
jr z, CheckTypeMatchup
ld hl, BattleMonType1
-
- ; fallthrough
-; 347d3
-
-
CheckTypeMatchup: ; 347d3
push hl
push de
@@ -2837,11 +2832,11 @@ PlayerAttackDamage: ; 352e2
call GetDamageStatsCritical
jr c, .thickclub
- ld hl, EnemyStats + 2
+ ld hl, EnemyDefense
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, PlayerStats
+ ld hl, PlayerAttack
jr .thickclub
.special
@@ -2861,11 +2856,11 @@ PlayerAttackDamage: ; 352e2
call GetDamageStatsCritical
jr c, .lightball
- ld hl, EnemyStats + SP_DEFENSE * 2
+ ld hl, EnemySpDef
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, PlayerStats + SP_ATTACK * 2
+ ld hl, PlayerSpAtk
.lightball
; Note: Returns player special attack at hl in hl.
@@ -3103,11 +3098,11 @@ EnemyAttackDamage: ; 353f6
call GetDamageStatsCritical
jr c, .thickclub
- ld hl, PlayerStats + 2
+ ld hl, PlayerDefense
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, EnemyStats
+ ld hl, EnemyAttack
jr .thickclub
.Special:
@@ -3126,11 +3121,11 @@ EnemyAttackDamage: ; 353f6
ld hl, EnemyMonSpclAtk
call GetDamageStatsCritical
jr c, .lightball
- ld hl, PlayerStats + 8
+ ld hl, PlayerSpDef
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, EnemyStats + 6
+ ld hl, EnemySpAtk
.lightball
call LightBallBoost
@@ -3407,9 +3402,9 @@ HitSelfInConfusion: ; 355dd
sla c
rl b
.mimic_screen
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hli]
ld l, [hl]
ld h, a
@@ -3953,9 +3948,9 @@ BattleCommand_Encore: ; 35864
set SUBSTATUS_ENCORED, [hl]
call BattleRandom
and $3
-rept 3
inc a
-endr
+ inc a
+ inc a
ld [de], a
call CheckOpponentWentFirst
jr nz, .finish_move
@@ -4094,12 +4089,12 @@ BattleCommand_PainSplit: ; 35926
ld a, [CurDamage + 1]
rr a
ld [CurDamage + 1], a
-rept 3
inc hl
-endr
-rept 3
+ inc hl
+ inc hl
+ inc de
+ inc de
inc de
-endr
.EnemyShareHP: ; 359ac
ld c, [hl]
@@ -6687,6 +6682,10 @@ BattleCommand_Teleport: ; 36778
srl b
srl b
cp b
+ ; This does the wrong thing. What was
+ ; probably intended was jr c, .failed
+ ; The way this is made makes enemy use
+ ; of Teleport always succeed if able
jr nc, .run_away
.run_away
call UpdateBattleMonInParty
@@ -7447,9 +7446,9 @@ BattleCommand_TrapTarget: ; 36c2d
ret nz
call BattleRandom
and 3
-rept 3
inc a
-endr
+ inc a
+ inc a
ld [hl], a
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
@@ -8074,7 +8073,7 @@ BattleCommand_LeechSeed: ; 36f9d
BattleCommand_Splash: ; 36fe1
call AnimateCurrentMove
- callba MobileFn_1060e5
+ callba TrainerRankings_Splash
jp PrintNothingHappened
; 36fed
@@ -8601,7 +8600,7 @@ CheckSubstituteOpp: ; 37378
BattleCommand_SelfDestruct: ; 37380
- callba MobileFn_10610d
+ callba TrainerRankings_SelfDestruct
ld a, BATTLEANIM_PLAYER_DAMAGE
ld [wNumHits], a
ld c, 3
@@ -9750,6 +9749,7 @@ BattleCommand_ThunderAccuracy: ; 37d94
ret
.rain
+ ; Redundant with CheckHit guranteeing hit
ld [hl], 100 percent
ret
diff --git a/battle/hidden_power.asm b/battle/hidden_power.asm
index 68b0e80f8..184c597d0 100644
--- a/battle/hidden_power.asm
+++ b/battle/hidden_power.asm
@@ -45,9 +45,8 @@ HiddenPowerDamage: ; fbced
; Multiply by 5
ld b, a
-rept 2
add a
-endr
+ add a
add b
; Add Special & 3
@@ -75,9 +74,8 @@ endr
ld a, [hl]
and 3 << 4
swap a
-rept 2
add a
-endr
+ add a
or b
; Skip Normal
diff --git a/battle/link_result.asm b/battle/link_result.asm
new file mode 100755
index 000000000..5739bbdc0
--- /dev/null
+++ b/battle/link_result.asm
@@ -0,0 +1,162 @@
+DetermineLinkBattleResult: ; 2b930
+ callba UpdateEnemyMonInParty
+ ld hl, PartyMon1HP
+ call .CountMonsRemaining
+ push bc
+ ld hl, OTPartyMon1HP
+ call .CountMonsRemaining
+ ld a, c
+ pop bc
+ cp c
+ jr z, .even_number_of_mons_remaining
+ jr c, .defeat
+ jr .victory
+
+.even_number_of_mons_remaining
+ call .BothSides_CheckNumberMonsAtFullHealth
+ jr z, .drawn
+ ld a, e
+ cp $1
+ jr z, .victory
+ cp $2
+ jr z, .defeat
+ ld hl, PartyMon1HP
+ call .CalcPercentHPRemaining
+ push de
+ ld hl, OTPartyMon1HP
+ call .CalcPercentHPRemaining
+ pop hl
+ ld a, d
+ cp h
+ jr c, .victory
+ jr z, .compare_lo
+ jr .defeat
+
+.compare_lo
+ ld a, e
+ cp l
+ jr z, .drawn
+ jr nc, .defeat
+
+.victory
+ ld a, [wBattleResult]
+ and $f0
+ ld [wBattleResult], a
+ ret
+
+.defeat
+ ld a, [wBattleResult]
+ and $f0
+ add $1
+ ld [wBattleResult], a
+ ret
+
+.drawn
+ ld a, [wBattleResult]
+ and $f0
+ add $2
+ ld [wBattleResult], a
+ ret
+
+.CountMonsRemaining: ; 2b995
+ ld c, 0
+ ld b, 3
+ ld de, PARTYMON_STRUCT_LENGTH - 1
+.loop
+ ld a, [hli]
+ or [hl]
+ jr nz, .not_fainted
+ inc c
+
+.not_fainted
+ add hl, de
+ dec b
+ jr nz, .loop
+ ret
+
+.CalcPercentHPRemaining: ; 2b9a6
+ ld de, 0
+ ld c, $3
+.loop2
+ ld a, [hli]
+ or [hl]
+ jr z, .next
+ dec hl
+ xor a
+ ld [hDividend + 0], a
+ ld a, [hli]
+ ld [hDividend + 1], a
+ ld a, [hli]
+ ld [hDividend + 2], a
+ xor a
+ ld [hDividend + 3], a
+ ld a, [hli]
+ ld b, a
+ ld a, [hld]
+ srl b
+ rr a
+ srl b
+ rr a
+ ld [hDivisor], a
+ ld b, $4
+ call Divide
+ ld a, [hQuotient + 2]
+ add e
+ ld e, a
+ ld a, [hQuotient + 1]
+ adc d
+ ld d, a
+ dec hl
+
+.next
+ push de
+ ld de, $2f
+ add hl, de
+ pop de
+ dec c
+ jr nz, .loop2
+ ret
+
+.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
+ ld hl, PartyMon1HP
+ call .CheckFaintedOrFullHealth
+ jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
+ ld hl, OTPartyMon1HP
+ call .CheckFaintedOrFullHealth
+ ld e, $1
+ ret
+
+.finish
+ ld hl, OTPartyMon1HP
+ call .CheckFaintedOrFullHealth
+ ld e, $0
+ ret nz ; we both have pokemon that are neither fainted nor at full health
+ ld e, $2
+ ld a, $1
+ and a
+ ret
+
+.CheckFaintedOrFullHealth: ; 2ba01
+ ld d, 3
+.loop3
+ ld a, [hli]
+ ld b, a
+ ld a, [hli]
+ ld c, a
+ or b
+ jr z, .fainted_or_full_health
+ ld a, [hli]
+ cp b
+ ret nz
+ ld a, [hld]
+ cp c
+ ret nz
+
+.fainted_or_full_health
+ push de
+ ld de, PARTYMON_STRUCT_LENGTH - 2
+ add hl, de
+ pop de
+ dec d
+ jr nz, .loop3
+ ret
diff --git a/battle/magikarp_length.asm b/battle/magikarp_length.asm
index 237450928..160912c53 100644
--- a/battle/magikarp_length.asm
+++ b/battle/magikarp_length.asm
@@ -141,9 +141,8 @@ CalcMagikarpLength: ; fbbfc
; hl = de * 10
ld h, d
ld l, e
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, de
add hl, hl
diff --git a/battle/misc.asm b/battle/misc.asm
index 97a11898e..0fed74e38 100644
--- a/battle/misc.asm
+++ b/battle/misc.asm
@@ -72,9 +72,8 @@ DoWeatherModifiers: ; fbda4
jr z, .ApplyModifier
.NextWeatherType:
-rept 2
inc de
-endr
+ inc de
jr .CheckWeatherType
@@ -99,9 +98,8 @@ endr
jr z, .ApplyModifier
.NextWeatherMove:
-rept 2
inc de
-endr
+ inc de
jr .CheckWeatherMove
.ApplyModifier:
diff --git a/battle/objects/data.asm b/battle/objects/data.asm
index 8a3f42f85..fa5dff269 100755
--- a/battle/objects/data.asm
+++ b/battle/objects/data.asm
@@ -57,22 +57,22 @@ endm
; ANIM_OBJ_BURNED
battleanimobj $01, $90, BATTLEANIMFRAMESET_11, BATTLEANIMFUNC_03, $04, $03
-; ANIM_OBJ_11
+; ANIM_OBJ_BLIZZARD
battleanimobj $01, $90, BATTLEANIMFRAMESET_12, BATTLEANIMFUNC_08, $06, $0a
; ANIM_OBJ_12
battleanimobj $01, $90, BATTLEANIMFRAMESET_13, BATTLEANIMFUNC_00, $06, $0a
-; ANIM_OBJ_13
+; ANIM_OBJ_ICE_BEAM
battleanimobj $01, $90, BATTLEANIMFRAMESET_14, BATTLEANIMFUNC_01, $06, $0a
-; ANIM_OBJ_14
- battleanimobj $21, $78, BATTLEANIMFRAMESET_16, BATTLEANIMFUNC_0B, $05, $06
+; ANIM_OBJ_RAZOR_LEAF
+ battleanimobj $21, $78, BATTLEANIMFRAMESET_16, BATTLEANIMFUNC_RAZOR_LEAF, $05, $06
; ANIM_OBJ_POKE_BALL
battleanimobj $00, $00, BATTLEANIMFRAMESET_09, BATTLEANIMFUNC_12, $04, $0b
-; ANIM_OBJ_16
+; ANIM_OBJ_POKE_BALL_BLOCKED
battleanimobj $00, $00, BATTLEANIMFRAMESET_09, BATTLEANIMFUNC_13, $04, $0b
; ANIM_OBJ_17
@@ -90,7 +90,7 @@ endm
; ANIM_OBJ_1B
battleanimobj $01, $90, BATTLEANIMFRAMESET_08, BATTLEANIMFUNC_00, $02, $07
-; ANIM_OBJ_1C
+; ANIM_OBJ_BALL_POOF
battleanimobj $01, $a0, BATTLEANIMFRAMESET_08, BATTLEANIMFUNC_00, $02, $07
; ANIM_OBJ_1D
@@ -105,7 +105,7 @@ endm
; ANIM_OBJ_20
battleanimobj $01, $b0, BATTLEANIMFRAMESET_84, BATTLEANIMFUNC_36, $06, $21
-; ANIM_OBJ_21
+; ANIM_OBJ_BUBBLE
battleanimobj $01, $90, BATTLEANIMFRAMESET_21, BATTLEANIMFUNC_0C, $06, $0d
; ANIM_OBJ_22
@@ -129,13 +129,13 @@ endm
; ANIM_OBJ_28
battleanimobj $61, $98, BATTLEANIMFRAMESET_2D, BATTLEANIMFUNC_09, $03, $10
-; ANIM_OBJ_29
+; ANIM_OBJ_ICE_BUILDUP
battleanimobj $01, $b8, BATTLEANIMFRAMESET_2E, BATTLEANIMFUNC_00, $06, $0a
; ANIM_OBJ_FROZEN
battleanimobj $01, $b8, BATTLEANIMFRAMESET_2F, BATTLEANIMFUNC_00, $06, $0a
-; ANIM_OBJ_2B
+; ANIM_OBJ_MASTER_BALL_SPARKLE
battleanimobj $01, $b8, BATTLEANIMFRAMESET_30, BATTLEANIMFUNC_14, $07, $11
; ANIM_OBJ_2C
@@ -213,7 +213,7 @@ endm
; ANIM_OBJ_44
battleanimobj $21, $80, BATTLEANIMFRAMESET_4B, BATTLEANIMFUNC_00, $03, $11
-; ANIM_OBJ_45
+; ANIM_OBJ_ABSORB
battleanimobj $01, $88, BATTLEANIMFRAMESET_4C, BATTLEANIMFUNC_1C, $05, $12
; ANIM_OBJ_46
@@ -228,8 +228,8 @@ endm
; ANIM_OBJ_49
battleanimobj $21, $ff, BATTLEANIMFRAMESET_54, BATTLEANIMFUNC_1F, $05, $16
-; ANIM_OBJ_4A
- battleanimobj $21, $68, BATTLEANIMFRAMESET_56, BATTLEANIMFUNC_20, $05, $06
+; ANIM_OBJ_LEECH_SEED
+ battleanimobj $21, $68, BATTLEANIMFRAMESET_56, BATTLEANIMFUNC_LEECH_SEED, $05, $06
; ANIM_OBJ_4B
battleanimobj $21, $90, BATTLEANIMFRAMESET_59, BATTLEANIMFUNC_21, $02, $0e
@@ -279,20 +279,20 @@ endm
; ANIM_OBJ_5A
battleanimobj $21, $90, BATTLEANIMFRAMESET_6A, BATTLEANIMFUNC_27, $02, $1b
-; ANIM_OBJ_5B
- battleanimobj $00, $00, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_HAZE
+ battleanimobj $00, $00, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5C
- battleanimobj $21, $48, BATTLEANIMFRAMESET_70, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_MIST
+ battleanimobj $21, $48, BATTLEANIMFRAMESET_70, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5D
- battleanimobj $21, $48, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_SMOG
+ battleanimobj $21, $48, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5E
- battleanimobj $21, $78, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_2A, $02, $1c
+; ANIM_OBJ_POISON_GAS
+ battleanimobj $21, $78, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_POISON_GAS, $02, $1c
-; ANIM_OBJ_5F
- battleanimobj $61, $90, BATTLEANIMFRAMESET_71, BATTLEANIMFUNC_2B, $02, $1d
+; ANIM_OBJ_HORN
+ battleanimobj $61, $90, BATTLEANIMFRAMESET_71, BATTLEANIMFUNC_HORN, $02, $1d
; ANIM_OBJ_60
battleanimobj $61, $90, BATTLEANIMFRAMESET_72, BATTLEANIMFUNC_2C, $02, $1d
@@ -313,7 +313,7 @@ endm
battleanimobj $01, $80, BATTLEANIMFRAMESET_30, BATTLEANIMFUNC_2F, $02, $11
; ANIM_OBJ_66
- battleanimobj $01, $78, BATTLEANIMFRAMESET_76, BATTLEANIMFUNC_2A, $04, $23
+ battleanimobj $01, $78, BATTLEANIMFRAMESET_76, BATTLEANIMFUNC_POISON_GAS, $04, $23
; ANIM_OBJ_67
battleanimobj $01, $80, BATTLEANIMFRAMESET_77, BATTLEANIMFUNC_30, $02, $1f
@@ -342,7 +342,7 @@ endm
; ANIM_OBJ_LICK
battleanimobj $21, $98, BATTLEANIMFRAMESET_7C, BATTLEANIMFUNC_00, $02, $04
-; ANIM_OBJ_70
+; ANIM_OBJ_WITHDRAW
battleanimobj $21, $80, BATTLEANIMFRAMESET_7D, BATTLEANIMFUNC_00, $02, $18
; ANIM_OBJ_71
@@ -393,8 +393,8 @@ endm
; ANIM_OBJ_80
battleanimobj $01, $a8, BATTLEANIMFRAMESET_0F, BATTLEANIMFUNC_3C, $04, $03
-; ANIM_OBJ_81
- battleanimobj $21, $68, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_29, $02, $1f
+; ANIM_OBJ_COTTON_SPORE
+ battleanimobj $21, $68, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1f
; ANIM_OBJ_82
battleanimobj $21, $b0, BATTLEANIMFRAMESET_8A, BATTLEANIMFUNC_00, $02, $1f
diff --git a/battle/objects/functions.asm b/battle/objects/functions.asm
index fbe48e558..4ed9b67b7 100755
--- a/battle/objects/functions.asm
+++ b/battle/objects/functions.asm
@@ -13,26 +13,26 @@ DoBattleAnimFrame: ; ccfbe
; ccfce
.Jumptable:
- dw BattleAnimFunction_00 ; 00
+ dw BattleAnimFunction_Null ; 00
dw BattleAnimFunction_01 ; 01
dw BattleAnimFunction_02 ; 02
dw BattleAnimFunction_03 ; 03
dw BattleAnimFunction_04 ; 04
- dw BattleAnimFunction_05 ; 05
- dw BattleAnimFunction_06 ; 06
+ dw BattleAnimFunction_ThrowFromPlayerToEnemy ; 05
+ dw BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear ; 06
dw BattleAnimFunction_07 ; 07
dw BattleAnimFunction_08 ; 08
dw BattleAnimFunction_09 ; 09
dw BattleAnimFunction_0A ; 0a
- dw BattleAnimFunction_0B ; 0b
+ dw BattleAnimFunction_RazorLeaf ; 0b
dw BattleAnimFunction_0C ; 0c
dw BattleAnimFunction_0D ; 0d
dw BattleAnimFunction_0E ; 0e
dw BattleAnimFunction_0F ; 0f
dw BattleAnimFunction_10 ; 10
dw BattleAnimFunction_11 ; 11
- dw BattleAnimFunction_12 ; 12
- dw BattleAnimFunction_13 ; 13
+ dw BattleAnimFunction_PokeBall ; 12
+ dw BattleAnimFunction_PokeBallBlocked ; 13
dw BattleAnimFunction_14 ; 14
dw BattleAnimFunction_15 ; 15
dw BattleAnimFunction_16 ; 16
@@ -45,7 +45,7 @@ DoBattleAnimFrame: ; ccfbe
dw BattleAnimFunction_1D ; 1d
dw BattleAnimFunction_1E ; 1e
dw BattleAnimFunction_1F ; 1f
- dw BattleAnimFunction_20 ; 20
+ dw BattleAnimFunction_LeechSeed ; 20
dw BattleAnimFunction_21 ; 21
dw BattleAnimFunction_22 ; 22
dw BattleAnimFunction_23 ; 23
@@ -54,9 +54,9 @@ DoBattleAnimFrame: ; ccfbe
dw BattleAnimFunction_26 ; 26
dw BattleAnimFunction_27 ; 27
dw BattleAnimFunction_28 ; 28
- dw BattleAnimFunction_29 ; 29
- dw BattleAnimFunction_2A ; 2a
- dw BattleAnimFunction_2B ; 2b
+ dw BattleAnimFunction_SpiralDescent ; 29
+ dw BattleAnimFunction_PoisonGas ; 2a
+ dw BattleAnimFunction_Horn ; 2b
dw BattleAnimFunction_2C ; 2c
dw BattleAnimFunction_2D ; 2d
dw BattleAnimFunction_2E ; 2e
@@ -94,7 +94,7 @@ DoBattleAnimFrame: ; ccfbe
dw BattleAnimFunction_4E ; 4e
dw BattleAnimFunction_4F ; 4f
-BattleAnimFunction_00: ; cd06e (33:506e)
+BattleAnimFunction_Null: ; cd06e (33:506e)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -104,34 +104,41 @@ BattleAnimFunction_00: ; cd06e (33:506e)
.zero
ret
-BattleAnimFunction_06: ; cd079 (33:5079)
- call BattleAnimFunction_05
+BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear: ; cd079 (33:5079)
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
call DeinitBattleAnimation
ret
-BattleAnimFunction_05: ; cd081 (33:5081)
+BattleAnimFunction_ThrowFromPlayerToEnemy: ; cd081 (33:5081)
+ ; If x coord at $88 or beyond, abort.
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
ret nc
+ ; Move right 2 pixels
add $2
ld [hl], a
+ ; Move down 1 pixel
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
+ ; Decrease ??? and hold onto its previous value (argument of the sine function)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
+ ; Get ???, which is the amplitude of the sine function
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
call BattleAnim_Sine
+ ; Store the result in the Y offset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
+ ; Carry flag denotes success
scf
ret
@@ -153,9 +160,10 @@ BattleAnimFunction_04: ; cd0a6 (33:50a6)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
-rept 4
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
+ inc [hl]
ld d, $10
push af
push de
@@ -258,7 +266,7 @@ BattleAnimFunction_02: ; cd146 (33:5146)
call DeinitBattleAnimation
ret
-BattleAnimFunction_12: ; cd15c (33:515c)
+BattleAnimFunction_PokeBall: ; cd15c (33:515c)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -273,13 +281,13 @@ BattleAnimFunction_12: ; cd15c (33:515c)
dw .nine
dw .ten
dw .eleven
-.zero
+.zero ; init
call GetBallAnimPal
call BattleAnim_IncAnonJumptableIndex
ret
.one
- call BattleAnimFunction_05
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -288,14 +296,14 @@ BattleAnimFunction_12: ; cd15c (33:515c)
add hl, bc
add [hl]
ld [hl], a
- ld a, $b
+ ld a, BATTLEANIMFRAMESET_0B
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
.three
call BattleAnim_IncAnonJumptableIndex
- ld a, $9
+ ld a, BATTLEANIMFRAMESET_09
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -325,13 +333,13 @@ BattleAnimFunction_12: ; cd15c (33:515c)
sub $4
ld [hl], a
ret nz
- ld a, $c
+ ld a, BATTLEANIMFRAMESET_0C
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
.six
- ld a, $d
+ ld a, BATTLEANIMFRAMESET_0D
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
@@ -343,7 +351,7 @@ BattleAnimFunction_12: ; cd15c (33:515c)
.seven
call GetBallAnimPal
- ld a, $a
+ ld a, BATTLEANIMFRAMESET_0A
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
@@ -375,7 +383,7 @@ BattleAnimFunction_12: ; cd15c (33:515c)
call DeinitBattleAnimation
ret
-BattleAnimFunction_13: ; cd212 (33:5212)
+BattleAnimFunction_PokeBallBlocked: ; cd212 (33:5212)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -392,7 +400,7 @@ BattleAnimFunction_13: ; cd212 (33:5212)
ld a, [hl]
cp $70
jr nc, .next
- call BattleAnimFunction_05
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret
.next
@@ -493,7 +501,7 @@ BattleAnimFunction_10: ; cd284 (33:5284)
.three
call BattleAnim_IncAnonJumptableIndex
- ld a, $f
+ ld a, BATTLEANIMFRAMESET_0F
call ReinitBattleAnimFrameset
.four
ret
@@ -727,7 +735,7 @@ BattleAnimFunction_0A: ; cd3f2 (33:53f2)
ld [hl], a
cp $7
jr z, .seven
- ld a, $11
+ ld a, BATTLEANIMFRAMESET_11
call ReinitBattleAnimFrameset
ret
@@ -746,7 +754,7 @@ BattleAnimFunction_0A: ; cd3f2 (33:53f2)
.set_up_eight
call BattleAnim_IncAnonJumptableIndex
- ld a, $10
+ ld a, BATTLEANIMFRAMESET_10
call ReinitBattleAnimFrameset
.eight
ld hl, BATTLEANIMSTRUCT_0F
@@ -801,7 +809,7 @@ BattleAnimFunction_0A: ; cd3f2 (33:53f2)
.six
ret
-BattleAnimFunction_0B: ; cd478 (33:5478)
+BattleAnimFunction_RazorLeaf: ; cd478 (33:5478)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -830,7 +838,7 @@ BattleAnimFunction_0B: ; cd478 (33:5478)
add hl, bc
ld [hli], a
ld [hl], a
- ld a, $17
+ ld a, BATTLEANIMFRAMESET_17
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -926,7 +934,7 @@ BattleAnimFunction_0B: ; cd478 (33:5478)
ret
.three
- ld a, $16
+ ld a, BATTLEANIMFRAMESET_16
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
@@ -1077,7 +1085,7 @@ BattleAnimFunction_0C: ; cd5e9 (33:55e9)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
- ld a, $22
+ ld a, BATTLEANIMFRAMESET_22
call ReinitBattleAnimFrameset
.two
ld hl, BATTLEANIMSTRUCT_XCOORD
@@ -1142,12 +1150,12 @@ BattleAnimFunction_0D: ; cd66a (33:566a)
dw .four
.zero
call BattleAnim_IncAnonJumptableIndex
- ld a, $42
- ld [hFFC6], a
+ ld a, rSCY - $ff00
+ ld [hLCDCPointer], a
ld a, $58
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
.one
@@ -1161,7 +1169,7 @@ BattleAnimFunction_0D: ; cd66a (33:566a)
jr nc, .asm_cd69b
call BattleAnim_IncAnonJumptableIndex
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ret
.asm_cd69b
@@ -1180,7 +1188,7 @@ BattleAnimFunction_0D: ; cd66a (33:566a)
add [hl]
sub $10
ret c
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
@@ -1201,9 +1209,9 @@ BattleAnimFunction_0D: ; cd66a (33:566a)
cp $70
jr c, asm_cd6da
xor a
- ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLCDCPointer], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
.four
call DeinitBattleAnimation
ret
@@ -1214,7 +1222,7 @@ asm_cd6da: ; cd6da (33:56da)
ld [hl], a
sub $10
ret c
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ret
BattleAnimFunction_0E: ; cd6e3 (33:56e3)
@@ -1226,8 +1234,8 @@ Functioncd6ea: ; cd6ea (33:56ea)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $24
- add [hl]
+ ld a, BATTLEANIMFRAMESET_24
+ add [hl] ; offset
call ReinitBattleAnimFrameset
Functioncd6f7: ; cd6f7 (33:56f7)
ld hl, BATTLEANIMSTRUCT_XCOORD
@@ -1282,7 +1290,7 @@ Functioncd728: ; cd728 (33:5728)
.asm_cd747
call BattleAnim_IncAnonJumptableIndex
- ld a, $28
+ ld a, BATTLEANIMFRAMESET_28
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -1306,7 +1314,7 @@ Functioncd763: ; cd763 (33:5763)
.asm_cd76e
call BattleAnim_IncAnonJumptableIndex
- ld a, $29
+ ld a, BATTLEANIMFRAMESET_29
call ReinitBattleAnimFrameset
Functioncd776: ; cd776 (33:5776)
ret
@@ -1419,7 +1427,7 @@ BattleAnimFunction_15: ; cd80c (33:580c)
dw Functioncd820
Functioncd817: ; cd817 (33:5817)
call BattleAnim_IncAnonJumptableIndex
- ld a, $35
+ ld a, BATTLEANIMFRAMESET_35
call ReinitBattleAnimFrameset
Functioncd81f: ; cd81f (33:581f)
ret
@@ -1477,18 +1485,18 @@ Functioncd860: ; cd860 (33:5860)
add hl, bc
ld [hl], a
bit 7, a
- jr nz, .asm_cd87e
+ jr nz, .load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc a
- jr .asm_cd883
+ jr .reinit
-.asm_cd87e
+.load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
-.asm_cd883
+.reinit
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -1800,50 +1808,50 @@ Functioncda3a: ; cda3a (33:5a3a)
Functioncda4c: ; cda4c (33:5a4c)
ret
-BattleAnimFunction_20: ; cda4d (33:5a4d)
+BattleAnimFunction_LeechSeed: ; cda4d (33:5a4d)
call BattleAnim_AnonJumptable
.anon_dw
- dw Functioncda58
- dw Functioncda62
- dw Functioncda7a
- dw Functioncda8c
-Functioncda58: ; cda58 (33:5a58)
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+.zero: ; cda58 (33:5a58)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $40
ret
-Functioncda62: ; cda62 (33:5a62)
+.one: ; cda62 (33:5a62)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $20
- jr c, .asm_cda6f
+ jr c, .sprout
call Functioncda8d
ret
-.asm_cda6f
+.sprout
ld [hl], $40
- ld a, $57
+ ld a, BATTLEANIMFRAMESET_57
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
-Functioncda7a: ; cda7a (33:5a7a)
+.two: ; cda7a (33:5a7a)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and a
- jr z, .asm_cda84
+ jr z, .flutter
dec [hl]
ret
-.asm_cda84
+.flutter
call BattleAnim_IncAnonJumptableIndex
- ld a, $58
+ ld a, BATTLEANIMFRAMESET_58
call ReinitBattleAnimFrameset
-Functioncda8c: ; cda8c (33:5a8c)
+.three: ; cda8c (33:5a8c)
ret
Functioncda8d: ; cda8d (33:5a8d)
@@ -2124,7 +2132,7 @@ Functioncdc1a: ; cdc1a (33:5c1a)
ret
Functioncdc1e: ; cdc1e (33:5c1e)
- ld a, $4e
+ ld a, BATTLEANIMFRAMESET_4E
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
@@ -2143,7 +2151,7 @@ Functioncdc27: ; cdc27 (33:5c27)
ret
Functioncdc39: ; cdc39 (33:5c39)
- ld a, $50
+ ld a, BATTLEANIMFRAMESET_50
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -2152,7 +2160,7 @@ Functioncdc39: ; cdc39 (33:5c39)
ret
Functioncdc48: ; cdc48 (33:5c48)
- ld a, $4f
+ ld a, BATTLEANIMFRAMESET_4F
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -2258,7 +2266,7 @@ Functioncdcca: ; cdcca (33:5cca)
ld [hl], $8
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $59
+ ld a, BATTLEANIMFRAMESET_59
add [hl]
call ReinitBattleAnimFrameset
ret
@@ -2330,7 +2338,7 @@ Functioncdd31: ; cdd31 (33:5d31)
and $80
rlca
ld [hl], a
- add $5d
+ add BATTLEANIMFRAMESET_5D
call ReinitBattleAnimFrameset
ret
@@ -2456,7 +2464,7 @@ Functioncde02: ; cde02 (33:5e02)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
- add $63
+ add BATTLEANIMFRAMESET_63
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -2540,7 +2548,7 @@ Functioncde72: ; cde72 (33:5e72)
add hl, bc
set 6, [hl]
.asm_cde83
- add $6a
+ add BATTLEANIMFRAMESET_6A
call ReinitBattleAnimFrameset
Functioncde88: ; cde88 (33:5e88)
ret
@@ -2578,7 +2586,7 @@ Functioncde90: ; cde90 (33:5e90)
xor $ff
inc a
ld [hl], a
- ld a, $6e
+ ld a, BATTLEANIMFRAMESET_6E
call ReinitBattleAnimFrameset
ret
@@ -2606,7 +2614,7 @@ Functioncdebf: ; cdebf (33:5ebf)
ld [hl], a
ret
-BattleAnimFunction_29: ; cdedd (33:5edd)
+BattleAnimFunction_SpiralDescent: ; cdedd (33:5edd)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
@@ -2639,11 +2647,11 @@ BattleAnimFunction_29: ; cdedd (33:5edd)
add hl, bc
ld a, [hl]
cp $28
- jr nc, .asm_cdf17
+ jr nc, .delete
inc [hl]
ret
-.asm_cdf17
+.delete
call DeinitBattleAnimation
ret
@@ -2688,17 +2696,17 @@ BattleAnimFunction_2D: ; cdf1b (33:5f1b)
call DeinitBattleAnimation
ret
-BattleAnimFunction_2A: ; cdf59 (33:5f59)
+BattleAnimFunction_PoisonGas: ; cdf59 (33:5f59)
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdf60
- dw BattleAnimFunction_29
+ dw BattleAnimFunction_SpiralDescent
Functioncdf60: ; cdf60 (33:5f60)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
- jr nc, .asm_cdf88
+ jr nc, .next
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -2719,7 +2727,7 @@ Functioncdf60: ; cdf60 (33:5f60)
dec [hl]
ret
-.asm_cdf88
+.next
call BattleAnim_IncAnonJumptableIndex
ret
@@ -2865,14 +2873,14 @@ Functionce05f: ; ce05f (33:605f)
call DeinitBattleAnimation
ret
-BattleAnimFunction_2B: ; ce063 (33:6063)
+BattleAnimFunction_Horn: ; ce063 (33:6063)
call BattleAnim_AnonJumptable
.anon_dw
- dw Functionce06e
- dw Functionce083
- dw Functionce091
+ dw .zero
+ dw .one
+ dw .two
dw Functionce09e
-Functionce06e: ; ce06e (33:606e)
+.zero: ; ce06e (33:606e)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
@@ -2887,7 +2895,7 @@ Functionce06e: ; ce06e (33:606e)
ld [hl], a
ret
-Functionce083: ; ce083 (33:6083)
+.one: ; ce083 (33:6083)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
@@ -2897,7 +2905,7 @@ Functionce083: ; ce083 (33:6083)
call Functionce70a
ret
-Functionce091: ; ce091 (33:6091)
+.two: ; ce091 (33:6091)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
@@ -3395,7 +3403,7 @@ Functionce366: ; ce366 (33:6366)
add hl, bc
ld a, [hl]
and $7f
- add $81
+ add BATTLEANIMFRAMESET_81
call ReinitBattleAnimFrameset
Functionce375: ; ce375 (33:6375)
ld hl, BATTLEANIMSTRUCT_0B
@@ -3437,7 +3445,7 @@ Functionce39c: ; ce39c (33:639c)
.asm_ce3a6
call BattleAnim_IncAnonJumptableIndex
- ld a, $20
+ ld a, BATTLEANIMFRAMESET_20
call ReinitBattleAnimFrameset
Functionce3ae: ; ce3ae (33:63ae)
ld hl, BATTLEANIMSTRUCT_YOFFSET
@@ -3611,7 +3619,7 @@ Functionce4a3: ; ce4a3 (33:64a3)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $24
+ ld a, BATTLEANIMFRAMESET_24
add [hl]
call ReinitBattleAnimFrameset
Functionce4b0: ; ce4b0 (33:64b0)
@@ -3832,13 +3840,14 @@ BattleAnimFunction_48: ; ce5dc (33:65dc)
add hl, bc
ld a, [hl]
cp $d0
- jr z, .asm_ce5ea
-rept 4
+ jr z, .disappear
+ dec [hl]
+ dec [hl]
+ dec [hl]
dec [hl]
-endr
ret
-.asm_ce5ea
+.disappear
call DeinitBattleAnimation
ret
@@ -3865,9 +3874,10 @@ Functionce60a: ; ce60a (33:660a)
ld a, [hl]
cp $4
jr z, Functionce618
-rept 4
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
+ inc [hl]
ret
Functionce618: ; ce618 (33:6618)
@@ -3883,9 +3893,10 @@ Functionce622: ; ce622 (33:6622)
ld a, [hl]
cp $d8
ret z
-rept 4
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
+ dec [hl]
ret
BattleAnimFunction_4A: ; ce62f (33:662f)
@@ -4085,6 +4096,7 @@ BattleAnim_IncAnonJumptableIndex: ; ce72c (33:672c)
BattleAnim_Cosine: ; ce732 (33:6732)
add $10
BattleAnim_Sine: ; ce734 (33:6734)
+; a = d sin a
and $3f
cp $20
jr nc, .negative
diff --git a/battle/sliding_intro.asm b/battle/sliding_intro.asm
index 194a4cd1b..ed78add8e 100755
--- a/battle/sliding_intro.asm
+++ b/battle/sliding_intro.asm
@@ -5,10 +5,10 @@ BattleIntroSlidingPics: ; 4e980
ld [rSVBK], a
call .subfunction1
ld a, rSCX - $ff00
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call .subfunction2
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
pop af
ld [rSVBK], a
ret
@@ -39,12 +39,10 @@ BattleIntroSlidingPics: ; 4e980
ld a, d
ld [hSCX], a
call .subfunction5
-rept 2
inc e
-endr
-rept 2
+ inc e
+ dec d
dec d
-endr
pop af
push af
cp $1
@@ -66,9 +64,8 @@ endr
ld c, $12 ; 18
ld de, $4
.loop3
-rept 2
dec [hl]
-endr
+ dec [hl]
add hl, de
dec c
jr nz, .loop3
diff --git a/battle/trainer_huds.asm b/battle/trainer_huds.asm
index ad32df1cd..03a85b9f4 100755
--- a/battle/trainer_huds.asm
+++ b/battle/trainer_huds.asm
@@ -81,9 +81,9 @@ StageBallTilesData: ; 2c059
jr z, .fainted
.got_hp
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hl]
and a
ld b, $32 ; statused
@@ -92,9 +92,9 @@ endr
jr .load
.fainted
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
.load
ld a, b
@@ -260,7 +260,7 @@ _ShowLinkBattleParticipants: ; 2c1b2
ld [hli], a
ld [hl], $6a ; "S"
callba LinkBattle_TrainerHuds ; no need to callba
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ld a, $e4
diff --git a/constants.asm b/constants.asm
index dc2a66796..a9004b73a 100644
--- a/constants.asm
+++ b/constants.asm
@@ -33,3 +33,4 @@ INCLUDE "constants/cgb_constants.asm"
INCLUDE "constants/battle_tower_constants.asm"
INCLUDE "constants/cry_constants.asm"
INCLUDE "constants/audio_constants.asm"
+INCLUDE "constants/printer_constants.asm"
diff --git a/constants/animation_constants.asm b/constants/animation_constants.asm
index 9ea2f3f34..ea052aabb 100644
--- a/constants/animation_constants.asm
+++ b/constants/animation_constants.asm
@@ -5,484 +5,484 @@
const BATTLEANIMSTRUCT_FRAMESET_ID
const BATTLEANIMSTRUCT_FUNCTION
const BATTLEANIMSTRUCT_PALETTE
- const BATTLEANIMSTRUCT_TILEID
- const BATTLEANIMSTRUCT_XCOORD
- const BATTLEANIMSTRUCT_YCOORD
- const BATTLEANIMSTRUCT_XOFFSET
- const BATTLEANIMSTRUCT_YOFFSET
- const BATTLEANIMSTRUCT_0B
- const BATTLEANIMSTRUCT_DURATION
- const BATTLEANIMSTRUCT_FRAME
- const BATTLEANIMSTRUCT_ANON_JT_INDEX
- const BATTLEANIMSTRUCT_0F
- const BATTLEANIMSTRUCT_10
- const BATTLEANIMSTRUCT_11
- const BATTLEANIMSTRUCT_12
- const BATTLEANIMSTRUCT_13
- const BATTLEANIMSTRUCT_14
- const BATTLEANIMSTRUCT_15
- const BATTLEANIMSTRUCT_16
- const BATTLEANIMSTRUCT_17
+ const BATTLEANIMSTRUCT_TILEID
+ const BATTLEANIMSTRUCT_XCOORD
+ const BATTLEANIMSTRUCT_YCOORD
+ const BATTLEANIMSTRUCT_XOFFSET
+ const BATTLEANIMSTRUCT_YOFFSET
+ const BATTLEANIMSTRUCT_0B
+ const BATTLEANIMSTRUCT_DURATION
+ const BATTLEANIMSTRUCT_FRAME
+ const BATTLEANIMSTRUCT_ANON_JT_INDEX
+ const BATTLEANIMSTRUCT_0F
+ const BATTLEANIMSTRUCT_10
+ const BATTLEANIMSTRUCT_11
+ const BATTLEANIMSTRUCT_12
+ const BATTLEANIMSTRUCT_13
+ const BATTLEANIMSTRUCT_14
+ const BATTLEANIMSTRUCT_15
+ const BATTLEANIMSTRUCT_16
+ const BATTLEANIMSTRUCT_17
BATTLEANIMSTRUCT_LENGTH EQU const_value
const_def
const ANIM_OBJ_00
- const ANIM_OBJ_01
- const ANIM_OBJ_02
- const ANIM_OBJ_03
- const ANIM_OBJ_04
- const ANIM_OBJ_05
- const ANIM_OBJ_06
- const ANIM_OBJ_07
- const ANIM_OBJ_08
- const ANIM_OBJ_09
- const ANIM_OBJ_0A
- const ANIM_OBJ_0B
- const ANIM_OBJ_0C
- const ANIM_OBJ_0D
- const ANIM_OBJ_0E
- const ANIM_OBJ_0F
- const ANIM_OBJ_BURNED
- const ANIM_OBJ_11
- const ANIM_OBJ_12
- const ANIM_OBJ_13
- const ANIM_OBJ_14
- const ANIM_OBJ_POKE_BALL
- const ANIM_OBJ_16
- const ANIM_OBJ_17
- const ANIM_OBJ_18
- const ANIM_OBJ_19
- const ANIM_OBJ_1A
- const ANIM_OBJ_1B
- const ANIM_OBJ_1C
- const ANIM_OBJ_1D
- const ANIM_OBJ_1E
- const ANIM_OBJ_1F
- const ANIM_OBJ_20
- const ANIM_OBJ_21
- const ANIM_OBJ_22
- const ANIM_OBJ_23
- const ANIM_OBJ_24
- const ANIM_OBJ_25
- const ANIM_OBJ_26
- const ANIM_OBJ_27
- const ANIM_OBJ_28
- const ANIM_OBJ_29
- const ANIM_OBJ_FROZEN
- const ANIM_OBJ_2B
- const ANIM_OBJ_2C
- const ANIM_OBJ_2D
- const ANIM_OBJ_2E
- const ANIM_OBJ_2F
- const ANIM_OBJ_30
- const ANIM_OBJ_31
- const ANIM_OBJ_LIGHTNING_BOLT
- const ANIM_OBJ_33
- const ANIM_OBJ_34
- const ANIM_OBJ_35
- const ANIM_OBJ_36
- const ANIM_OBJ_37
- const ANIM_OBJ_38
- const ANIM_OBJ_39
- const ANIM_OBJ_3A
- const ANIM_OBJ_3B
- const ANIM_OBJ_3C
- const ANIM_OBJ_3D
- const ANIM_OBJ_GUST
- const ANIM_OBJ_3F
- const ANIM_OBJ_40
- const ANIM_OBJ_41
- const ANIM_OBJ_42
- const ANIM_OBJ_43
- const ANIM_OBJ_44
- const ANIM_OBJ_45
- const ANIM_OBJ_46
- const ANIM_OBJ_47
- const ANIM_OBJ_48
- const ANIM_OBJ_49
- const ANIM_OBJ_4A
- const ANIM_OBJ_4B
- const ANIM_OBJ_4C
- const ANIM_OBJ_4D
- const ANIM_OBJ_4E
- const ANIM_OBJ_4F
- const ANIM_OBJ_50
- const ANIM_OBJ_51
- const ANIM_OBJ_CHICK
- const ANIM_OBJ_53
- const ANIM_OBJ_54
- const ANIM_OBJ_SKULL
- const ANIM_OBJ_56
- const ANIM_OBJ_57
- const ANIM_OBJ_58
- const ANIM_OBJ_PARALYZED
- const ANIM_OBJ_5A
- const ANIM_OBJ_5B
- const ANIM_OBJ_5C
- const ANIM_OBJ_5D
- const ANIM_OBJ_5E
- const ANIM_OBJ_5F
- const ANIM_OBJ_60
- const ANIM_OBJ_61
- const ANIM_OBJ_62
- const ANIM_OBJ_63
- const ANIM_OBJ_64
- const ANIM_OBJ_65
- const ANIM_OBJ_66
- const ANIM_OBJ_67
- const ANIM_OBJ_68
- const ANIM_OBJ_69
- const ANIM_OBJ_6A
- const ANIM_OBJ_6B
- const ANIM_OBJ_6C
- const ANIM_OBJ_6D
- const ANIM_OBJ_SKY_ATTACK_FEAROW
- const ANIM_OBJ_LICK
- const ANIM_OBJ_70
- const ANIM_OBJ_71
- const ANIM_OBJ_72
- const ANIM_OBJ_73
- const ANIM_OBJ_74
- const ANIM_OBJ_75
- const ANIM_OBJ_76
- const ANIM_OBJ_77
- const ANIM_OBJ_78
- const ANIM_OBJ_79
- const ANIM_OBJ_7A
- const ANIM_OBJ_7B
- const ANIM_OBJ_7C
- const ANIM_OBJ_7D
- const ANIM_OBJ_HEART
- const ANIM_OBJ_7F
- const ANIM_OBJ_80
- const ANIM_OBJ_81
- const ANIM_OBJ_82
- const ANIM_OBJ_83
- const ANIM_OBJ_84
- const ANIM_OBJ_85
- const ANIM_OBJ_86
- const ANIM_OBJ_87
- const ANIM_OBJ_88
- const ANIM_OBJ_89
- const ANIM_OBJ_8A
- const ANIM_OBJ_8B
- const ANIM_OBJ_8C
- const ANIM_OBJ_8D
- const ANIM_OBJ_SPIKES
- const ANIM_OBJ_8F
- const ANIM_OBJ_90
- const ANIM_OBJ_91
- const ANIM_OBJ_92
- const ANIM_OBJ_93
- const ANIM_OBJ_94
- const ANIM_OBJ_95
- const ANIM_OBJ_96
- const ANIM_OBJ_97
- const ANIM_OBJ_98
- const ANIM_OBJ_99
- const ANIM_OBJ_9A
- const ANIM_OBJ_9B
- const ANIM_OBJ_9C
- const ANIM_OBJ_9D
- const ANIM_OBJ_9E
- const ANIM_OBJ_9F
- const ANIM_OBJ_A0
- const ANIM_OBJ_A1
- const ANIM_OBJ_A2
- const ANIM_OBJ_A3
- const ANIM_OBJ_A4
- const ANIM_OBJ_A5
- const ANIM_OBJ_PERISH_SONG
- const ANIM_OBJ_A7
- const ANIM_OBJ_A8
- const ANIM_OBJ_A9
- const ANIM_OBJ_AA
- const ANIM_OBJ_AB
- const ANIM_OBJ_AC
- const ANIM_OBJ_AD
- const ANIM_OBJ_AE
- const ANIM_OBJ_AF
- const ANIM_OBJ_B0
- const ANIM_OBJ_B1
- const ANIM_OBJ_B2
- const ANIM_OBJ_B3
- const ANIM_OBJ_B4
- const ANIM_OBJ_B5
- const ANIM_OBJ_FLOWER
- const ANIM_OBJ_COTTON
- const ANIM_OBJ_PLAYERFEETFOLLOW
- const ANIM_OBJ_ENEMYFEETFOLLOW
- const ANIM_OBJ_BA
- const ANIM_OBJ_BB
+ const ANIM_OBJ_01
+ const ANIM_OBJ_02
+ const ANIM_OBJ_03
+ const ANIM_OBJ_04
+ const ANIM_OBJ_05
+ const ANIM_OBJ_06
+ const ANIM_OBJ_07
+ const ANIM_OBJ_08
+ const ANIM_OBJ_09
+ const ANIM_OBJ_0A
+ const ANIM_OBJ_0B
+ const ANIM_OBJ_0C
+ const ANIM_OBJ_0D
+ const ANIM_OBJ_0E
+ const ANIM_OBJ_0F
+ const ANIM_OBJ_BURNED
+ const ANIM_OBJ_BLIZZARD
+ const ANIM_OBJ_12
+ const ANIM_OBJ_ICE_BEAM
+ const ANIM_OBJ_RAZOR_LEAF
+ const ANIM_OBJ_POKE_BALL
+ const ANIM_OBJ_POKE_BALL_BLOCKED
+ const ANIM_OBJ_17
+ const ANIM_OBJ_18
+ const ANIM_OBJ_19
+ const ANIM_OBJ_1A
+ const ANIM_OBJ_1B
+ const ANIM_OBJ_BALL_POOF
+ const ANIM_OBJ_1D
+ const ANIM_OBJ_1E
+ const ANIM_OBJ_1F
+ const ANIM_OBJ_20
+ const ANIM_OBJ_BUBBLE
+ const ANIM_OBJ_22
+ const ANIM_OBJ_23
+ const ANIM_OBJ_24
+ const ANIM_OBJ_25
+ const ANIM_OBJ_26
+ const ANIM_OBJ_27
+ const ANIM_OBJ_28
+ const ANIM_OBJ_ICE_BUILDUP
+ const ANIM_OBJ_FROZEN
+ const ANIM_OBJ_MASTER_BALL_SPARKLE
+ const ANIM_OBJ_2C
+ const ANIM_OBJ_2D
+ const ANIM_OBJ_2E
+ const ANIM_OBJ_2F
+ const ANIM_OBJ_30
+ const ANIM_OBJ_31
+ const ANIM_OBJ_LIGHTNING_BOLT
+ const ANIM_OBJ_33
+ const ANIM_OBJ_34
+ const ANIM_OBJ_35
+ const ANIM_OBJ_36
+ const ANIM_OBJ_37
+ const ANIM_OBJ_38
+ const ANIM_OBJ_39
+ const ANIM_OBJ_3A
+ const ANIM_OBJ_3B
+ const ANIM_OBJ_3C
+ const ANIM_OBJ_3D
+ const ANIM_OBJ_GUST
+ const ANIM_OBJ_3F
+ const ANIM_OBJ_40
+ const ANIM_OBJ_41
+ const ANIM_OBJ_42
+ const ANIM_OBJ_43
+ const ANIM_OBJ_44
+ const ANIM_OBJ_ABSORB
+ const ANIM_OBJ_46
+ const ANIM_OBJ_47
+ const ANIM_OBJ_48
+ const ANIM_OBJ_49
+ const ANIM_OBJ_LEECH_SEED
+ const ANIM_OBJ_4B
+ const ANIM_OBJ_4C
+ const ANIM_OBJ_4D
+ const ANIM_OBJ_4E
+ const ANIM_OBJ_4F
+ const ANIM_OBJ_50
+ const ANIM_OBJ_51
+ const ANIM_OBJ_CHICK
+ const ANIM_OBJ_53
+ const ANIM_OBJ_54
+ const ANIM_OBJ_SKULL
+ const ANIM_OBJ_56
+ const ANIM_OBJ_57
+ const ANIM_OBJ_58
+ const ANIM_OBJ_PARALYZED
+ const ANIM_OBJ_5A
+ const ANIM_OBJ_HAZE
+ const ANIM_OBJ_MIST
+ const ANIM_OBJ_SMOG
+ const ANIM_OBJ_POISON_GAS
+ const ANIM_OBJ_HORN
+ const ANIM_OBJ_60
+ const ANIM_OBJ_61
+ const ANIM_OBJ_62
+ const ANIM_OBJ_63
+ const ANIM_OBJ_64
+ const ANIM_OBJ_65
+ const ANIM_OBJ_66
+ const ANIM_OBJ_67
+ const ANIM_OBJ_68
+ const ANIM_OBJ_69
+ const ANIM_OBJ_6A
+ const ANIM_OBJ_6B
+ const ANIM_OBJ_6C
+ const ANIM_OBJ_6D
+ const ANIM_OBJ_SKY_ATTACK_FEAROW
+ const ANIM_OBJ_LICK
+ const ANIM_OBJ_WITHDRAW
+ const ANIM_OBJ_71
+ const ANIM_OBJ_72
+ const ANIM_OBJ_73
+ const ANIM_OBJ_74
+ const ANIM_OBJ_75
+ const ANIM_OBJ_76
+ const ANIM_OBJ_77
+ const ANIM_OBJ_78
+ const ANIM_OBJ_79
+ const ANIM_OBJ_7A
+ const ANIM_OBJ_7B
+ const ANIM_OBJ_7C
+ const ANIM_OBJ_7D
+ const ANIM_OBJ_HEART
+ const ANIM_OBJ_7F
+ const ANIM_OBJ_80
+ const ANIM_OBJ_COTTON_SPORE
+ const ANIM_OBJ_82
+ const ANIM_OBJ_83
+ const ANIM_OBJ_84
+ const ANIM_OBJ_85
+ const ANIM_OBJ_86
+ const ANIM_OBJ_87
+ const ANIM_OBJ_88
+ const ANIM_OBJ_89
+ const ANIM_OBJ_8A
+ const ANIM_OBJ_8B
+ const ANIM_OBJ_8C
+ const ANIM_OBJ_8D
+ const ANIM_OBJ_SPIKES
+ const ANIM_OBJ_8F
+ const ANIM_OBJ_90
+ const ANIM_OBJ_91
+ const ANIM_OBJ_92
+ const ANIM_OBJ_93
+ const ANIM_OBJ_94
+ const ANIM_OBJ_95
+ const ANIM_OBJ_96
+ const ANIM_OBJ_97
+ const ANIM_OBJ_98
+ const ANIM_OBJ_99
+ const ANIM_OBJ_9A
+ const ANIM_OBJ_9B
+ const ANIM_OBJ_9C
+ const ANIM_OBJ_9D
+ const ANIM_OBJ_9E
+ const ANIM_OBJ_9F
+ const ANIM_OBJ_A0
+ const ANIM_OBJ_A1
+ const ANIM_OBJ_A2
+ const ANIM_OBJ_A3
+ const ANIM_OBJ_A4
+ const ANIM_OBJ_A5
+ const ANIM_OBJ_PERISH_SONG
+ const ANIM_OBJ_A7
+ const ANIM_OBJ_A8
+ const ANIM_OBJ_A9
+ const ANIM_OBJ_AA
+ const ANIM_OBJ_AB
+ const ANIM_OBJ_AC
+ const ANIM_OBJ_AD
+ const ANIM_OBJ_AE
+ const ANIM_OBJ_AF
+ const ANIM_OBJ_B0
+ const ANIM_OBJ_B1
+ const ANIM_OBJ_B2
+ const ANIM_OBJ_B3
+ const ANIM_OBJ_B4
+ const ANIM_OBJ_B5
+ const ANIM_OBJ_FLOWER
+ const ANIM_OBJ_COTTON
+ const ANIM_OBJ_PLAYERFEETFOLLOW
+ const ANIM_OBJ_ENEMYFEETFOLLOW
+ const ANIM_OBJ_BA
+ const ANIM_OBJ_BB
const_def
const BATTLEANIMFUNC_00
- const BATTLEANIMFUNC_01
- const BATTLEANIMFUNC_02
- const BATTLEANIMFUNC_03
- const BATTLEANIMFUNC_04
- const BATTLEANIMFUNC_05
- const BATTLEANIMFUNC_06
- const BATTLEANIMFUNC_07
- const BATTLEANIMFUNC_08
- const BATTLEANIMFUNC_09
- const BATTLEANIMFUNC_0A
- const BATTLEANIMFUNC_0B
- const BATTLEANIMFUNC_0C
- const BATTLEANIMFUNC_0D
- const BATTLEANIMFUNC_0E
- const BATTLEANIMFUNC_0F
- const BATTLEANIMFUNC_10
- const BATTLEANIMFUNC_11
- const BATTLEANIMFUNC_12
- const BATTLEANIMFUNC_13
- const BATTLEANIMFUNC_14
- const BATTLEANIMFUNC_15
- const BATTLEANIMFUNC_16
- const BATTLEANIMFUNC_17
- const BATTLEANIMFUNC_18
- const BATTLEANIMFUNC_19
- const BATTLEANIMFUNC_1A
- const BATTLEANIMFUNC_1B
- const BATTLEANIMFUNC_1C
- const BATTLEANIMFUNC_1D
- const BATTLEANIMFUNC_1E
- const BATTLEANIMFUNC_1F
- const BATTLEANIMFUNC_20
- const BATTLEANIMFUNC_21
- const BATTLEANIMFUNC_22
- const BATTLEANIMFUNC_23
- const BATTLEANIMFUNC_24
- const BATTLEANIMFUNC_25
- const BATTLEANIMFUNC_26
- const BATTLEANIMFUNC_27
- const BATTLEANIMFUNC_28
- const BATTLEANIMFUNC_29
- const BATTLEANIMFUNC_2A
- const BATTLEANIMFUNC_2B
- const BATTLEANIMFUNC_2C
- const BATTLEANIMFUNC_2D
- const BATTLEANIMFUNC_2E
- const BATTLEANIMFUNC_2F
- const BATTLEANIMFUNC_30
- const BATTLEANIMFUNC_31
- const BATTLEANIMFUNC_32
- const BATTLEANIMFUNC_33
- const BATTLEANIMFUNC_34
- const BATTLEANIMFUNC_35
- const BATTLEANIMFUNC_36
- const BATTLEANIMFUNC_37
- const BATTLEANIMFUNC_38
- const BATTLEANIMFUNC_39
- const BATTLEANIMFUNC_3A
- const BATTLEANIMFUNC_3B
- const BATTLEANIMFUNC_3C
- const BATTLEANIMFUNC_3D
- const BATTLEANIMFUNC_3E
- const BATTLEANIMFUNC_3F
- const BATTLEANIMFUNC_40
- const BATTLEANIMFUNC_41
- const BATTLEANIMFUNC_42
- const BATTLEANIMFUNC_43
- const BATTLEANIMFUNC_44
- const BATTLEANIMFUNC_45
- const BATTLEANIMFUNC_46
- const BATTLEANIMFUNC_47
- const BATTLEANIMFUNC_48
- const BATTLEANIMFUNC_49
- const BATTLEANIMFUNC_4A
- const BATTLEANIMFUNC_4B
- const BATTLEANIMFUNC_4C
- const BATTLEANIMFUNC_4D
- const BATTLEANIMFUNC_4E
- const BATTLEANIMFUNC_4F
+ const BATTLEANIMFUNC_01
+ const BATTLEANIMFUNC_02
+ const BATTLEANIMFUNC_03
+ const BATTLEANIMFUNC_04
+ const BATTLEANIMFUNC_05
+ const BATTLEANIMFUNC_06
+ const BATTLEANIMFUNC_07
+ const BATTLEANIMFUNC_08
+ const BATTLEANIMFUNC_09
+ const BATTLEANIMFUNC_0A
+ const BATTLEANIMFUNC_RAZOR_LEAF
+ const BATTLEANIMFUNC_0C
+ const BATTLEANIMFUNC_0D
+ const BATTLEANIMFUNC_0E
+ const BATTLEANIMFUNC_0F
+ const BATTLEANIMFUNC_10
+ const BATTLEANIMFUNC_11
+ const BATTLEANIMFUNC_12
+ const BATTLEANIMFUNC_13
+ const BATTLEANIMFUNC_14
+ const BATTLEANIMFUNC_15
+ const BATTLEANIMFUNC_16
+ const BATTLEANIMFUNC_17
+ const BATTLEANIMFUNC_18
+ const BATTLEANIMFUNC_19
+ const BATTLEANIMFUNC_1A
+ const BATTLEANIMFUNC_1B
+ const BATTLEANIMFUNC_1C
+ const BATTLEANIMFUNC_1D
+ const BATTLEANIMFUNC_1E
+ const BATTLEANIMFUNC_1F
+ const BATTLEANIMFUNC_LEECH_SEED
+ const BATTLEANIMFUNC_21
+ const BATTLEANIMFUNC_22
+ const BATTLEANIMFUNC_23
+ const BATTLEANIMFUNC_24
+ const BATTLEANIMFUNC_25
+ const BATTLEANIMFUNC_26
+ const BATTLEANIMFUNC_27
+ const BATTLEANIMFUNC_28
+ const BATTLEANIMFUNC_SPRIAL_DESCENT
+ const BATTLEANIMFUNC_POISON_GAS
+ const BATTLEANIMFUNC_HORN
+ const BATTLEANIMFUNC_2C
+ const BATTLEANIMFUNC_2D
+ const BATTLEANIMFUNC_2E
+ const BATTLEANIMFUNC_2F
+ const BATTLEANIMFUNC_30
+ const BATTLEANIMFUNC_31
+ const BATTLEANIMFUNC_32
+ const BATTLEANIMFUNC_33
+ const BATTLEANIMFUNC_34
+ const BATTLEANIMFUNC_35
+ const BATTLEANIMFUNC_36
+ const BATTLEANIMFUNC_37
+ const BATTLEANIMFUNC_38
+ const BATTLEANIMFUNC_39
+ const BATTLEANIMFUNC_3A
+ const BATTLEANIMFUNC_3B
+ const BATTLEANIMFUNC_3C
+ const BATTLEANIMFUNC_3D
+ const BATTLEANIMFUNC_3E
+ const BATTLEANIMFUNC_3F
+ const BATTLEANIMFUNC_40
+ const BATTLEANIMFUNC_41
+ const BATTLEANIMFUNC_42
+ const BATTLEANIMFUNC_43
+ const BATTLEANIMFUNC_44
+ const BATTLEANIMFUNC_45
+ const BATTLEANIMFUNC_46
+ const BATTLEANIMFUNC_47
+ const BATTLEANIMFUNC_48
+ const BATTLEANIMFUNC_49
+ const BATTLEANIMFUNC_4A
+ const BATTLEANIMFUNC_4B
+ const BATTLEANIMFUNC_4C
+ const BATTLEANIMFUNC_4D
+ const BATTLEANIMFUNC_4E
+ const BATTLEANIMFUNC_4F
const_def
const BATTLEANIMFRAMESET_00
- const BATTLEANIMFRAMESET_01
- const BATTLEANIMFRAMESET_02
- const BATTLEANIMFRAMESET_03
- const BATTLEANIMFRAMESET_04
- const BATTLEANIMFRAMESET_05
- const BATTLEANIMFRAMESET_06
- const BATTLEANIMFRAMESET_07
- const BATTLEANIMFRAMESET_08
- const BATTLEANIMFRAMESET_09
- const BATTLEANIMFRAMESET_0A
- const BATTLEANIMFRAMESET_0B
- const BATTLEANIMFRAMESET_0C
- const BATTLEANIMFRAMESET_0D
- const BATTLEANIMFRAMESET_0E
- const BATTLEANIMFRAMESET_0F
- const BATTLEANIMFRAMESET_10
- const BATTLEANIMFRAMESET_11
- const BATTLEANIMFRAMESET_12
- const BATTLEANIMFRAMESET_13
- const BATTLEANIMFRAMESET_14
- const BATTLEANIMFRAMESET_15
- const BATTLEANIMFRAMESET_16
- const BATTLEANIMFRAMESET_17
- const BATTLEANIMFRAMESET_18
- const BATTLEANIMFRAMESET_19
- const BATTLEANIMFRAMESET_1A
- const BATTLEANIMFRAMESET_1B
- const BATTLEANIMFRAMESET_1C
- const BATTLEANIMFRAMESET_1D
- const BATTLEANIMFRAMESET_1E
- const BATTLEANIMFRAMESET_1F
- const BATTLEANIMFRAMESET_20
- const BATTLEANIMFRAMESET_21
- const BATTLEANIMFRAMESET_22
- const BATTLEANIMFRAMESET_23
- const BATTLEANIMFRAMESET_24
- const BATTLEANIMFRAMESET_25
- const BATTLEANIMFRAMESET_26
- const BATTLEANIMFRAMESET_27
- const BATTLEANIMFRAMESET_28
- const BATTLEANIMFRAMESET_29
- const BATTLEANIMFRAMESET_2A
- const BATTLEANIMFRAMESET_2B
- const BATTLEANIMFRAMESET_2C
- const BATTLEANIMFRAMESET_2D
- const BATTLEANIMFRAMESET_2E
- const BATTLEANIMFRAMESET_2F
- const BATTLEANIMFRAMESET_30
- const BATTLEANIMFRAMESET_31
- const BATTLEANIMFRAMESET_32
- const BATTLEANIMFRAMESET_33
- const BATTLEANIMFRAMESET_34
- const BATTLEANIMFRAMESET_35
- const BATTLEANIMFRAMESET_36
- const BATTLEANIMFRAMESET_37
- const BATTLEANIMFRAMESET_38
- const BATTLEANIMFRAMESET_39
- const BATTLEANIMFRAMESET_3A
- const BATTLEANIMFRAMESET_3B
- const BATTLEANIMFRAMESET_3C
- const BATTLEANIMFRAMESET_3D
- const BATTLEANIMFRAMESET_3E
- const BATTLEANIMFRAMESET_3F
- const BATTLEANIMFRAMESET_40
- const BATTLEANIMFRAMESET_41
- const BATTLEANIMFRAMESET_42
- const BATTLEANIMFRAMESET_43
- const BATTLEANIMFRAMESET_44
- const BATTLEANIMFRAMESET_45
- const BATTLEANIMFRAMESET_46
- const BATTLEANIMFRAMESET_47
- const BATTLEANIMFRAMESET_48
- const BATTLEANIMFRAMESET_49
- const BATTLEANIMFRAMESET_4A
- const BATTLEANIMFRAMESET_4B
- const BATTLEANIMFRAMESET_4C
- const BATTLEANIMFRAMESET_4D
- const BATTLEANIMFRAMESET_4E
- const BATTLEANIMFRAMESET_4F
- const BATTLEANIMFRAMESET_50
- const BATTLEANIMFRAMESET_51
- const BATTLEANIMFRAMESET_52
- const BATTLEANIMFRAMESET_53
- const BATTLEANIMFRAMESET_54
- const BATTLEANIMFRAMESET_55
- const BATTLEANIMFRAMESET_56
- const BATTLEANIMFRAMESET_57
- const BATTLEANIMFRAMESET_58
- const BATTLEANIMFRAMESET_59
- const BATTLEANIMFRAMESET_5A
- const BATTLEANIMFRAMESET_5B
- const BATTLEANIMFRAMESET_5C
- const BATTLEANIMFRAMESET_5D
- const BATTLEANIMFRAMESET_5E
- const BATTLEANIMFRAMESET_5F
- const BATTLEANIMFRAMESET_60
- const BATTLEANIMFRAMESET_61
- const BATTLEANIMFRAMESET_62
- const BATTLEANIMFRAMESET_63
- const BATTLEANIMFRAMESET_64
- const BATTLEANIMFRAMESET_65
- const BATTLEANIMFRAMESET_66
- const BATTLEANIMFRAMESET_67
- const BATTLEANIMFRAMESET_68
- const BATTLEANIMFRAMESET_69
- const BATTLEANIMFRAMESET_6A
- const BATTLEANIMFRAMESET_6B
- const BATTLEANIMFRAMESET_6C
- const BATTLEANIMFRAMESET_6D
- const BATTLEANIMFRAMESET_6E
- const BATTLEANIMFRAMESET_6F
- const BATTLEANIMFRAMESET_70
- const BATTLEANIMFRAMESET_71
- const BATTLEANIMFRAMESET_72
- const BATTLEANIMFRAMESET_73
- const BATTLEANIMFRAMESET_74
- const BATTLEANIMFRAMESET_75
- const BATTLEANIMFRAMESET_76
- const BATTLEANIMFRAMESET_77
- const BATTLEANIMFRAMESET_78
- const BATTLEANIMFRAMESET_79
- const BATTLEANIMFRAMESET_7A
- const BATTLEANIMFRAMESET_7B
- const BATTLEANIMFRAMESET_7C
- const BATTLEANIMFRAMESET_7D
- const BATTLEANIMFRAMESET_7E
- const BATTLEANIMFRAMESET_7F
- const BATTLEANIMFRAMESET_80
- const BATTLEANIMFRAMESET_81
- const BATTLEANIMFRAMESET_82
- const BATTLEANIMFRAMESET_83
- const BATTLEANIMFRAMESET_84
- const BATTLEANIMFRAMESET_85
- const BATTLEANIMFRAMESET_86
- const BATTLEANIMFRAMESET_87
- const BATTLEANIMFRAMESET_88
- const BATTLEANIMFRAMESET_89
- const BATTLEANIMFRAMESET_8A
- const BATTLEANIMFRAMESET_8B
- const BATTLEANIMFRAMESET_8C
- const BATTLEANIMFRAMESET_8D
- const BATTLEANIMFRAMESET_8E
- const BATTLEANIMFRAMESET_8F
- const BATTLEANIMFRAMESET_90
- const BATTLEANIMFRAMESET_91
- const BATTLEANIMFRAMESET_92
- const BATTLEANIMFRAMESET_93
- const BATTLEANIMFRAMESET_94
- const BATTLEANIMFRAMESET_95
- const BATTLEANIMFRAMESET_96
- const BATTLEANIMFRAMESET_97
- const BATTLEANIMFRAMESET_98
- const BATTLEANIMFRAMESET_99
- const BATTLEANIMFRAMESET_9A
- const BATTLEANIMFRAMESET_9B
- const BATTLEANIMFRAMESET_9C
- const BATTLEANIMFRAMESET_9D
- const BATTLEANIMFRAMESET_9E
- const BATTLEANIMFRAMESET_9F
- const BATTLEANIMFRAMESET_A0
- const BATTLEANIMFRAMESET_A1
- const BATTLEANIMFRAMESET_A2
- const BATTLEANIMFRAMESET_A3
- const BATTLEANIMFRAMESET_A4
- const BATTLEANIMFRAMESET_A5
- const BATTLEANIMFRAMESET_A6
- const BATTLEANIMFRAMESET_A7
- const BATTLEANIMFRAMESET_A8
- const BATTLEANIMFRAMESET_A9
- const BATTLEANIMFRAMESET_AA
- const BATTLEANIMFRAMESET_AB
- const BATTLEANIMFRAMESET_AC
- const BATTLEANIMFRAMESET_AD
- const BATTLEANIMFRAMESET_AE
- const BATTLEANIMFRAMESET_AF
- const BATTLEANIMFRAMESET_B0
- const BATTLEANIMFRAMESET_B1
- const BATTLEANIMFRAMESET_B2
- const BATTLEANIMFRAMESET_B3
- const BATTLEANIMFRAMESET_B4
- const BATTLEANIMFRAMESET_B5
- const BATTLEANIMFRAMESET_B6
- const BATTLEANIMFRAMESET_B7
- const BATTLEANIMFRAMESET_B8
+ const BATTLEANIMFRAMESET_01
+ const BATTLEANIMFRAMESET_02
+ const BATTLEANIMFRAMESET_03
+ const BATTLEANIMFRAMESET_04
+ const BATTLEANIMFRAMESET_05
+ const BATTLEANIMFRAMESET_06
+ const BATTLEANIMFRAMESET_07
+ const BATTLEANIMFRAMESET_08
+ const BATTLEANIMFRAMESET_09
+ const BATTLEANIMFRAMESET_0A
+ const BATTLEANIMFRAMESET_0B
+ const BATTLEANIMFRAMESET_0C
+ const BATTLEANIMFRAMESET_0D
+ const BATTLEANIMFRAMESET_0E
+ const BATTLEANIMFRAMESET_0F
+ const BATTLEANIMFRAMESET_10
+ const BATTLEANIMFRAMESET_11
+ const BATTLEANIMFRAMESET_12
+ const BATTLEANIMFRAMESET_13
+ const BATTLEANIMFRAMESET_14
+ const BATTLEANIMFRAMESET_15
+ const BATTLEANIMFRAMESET_16
+ const BATTLEANIMFRAMESET_17
+ const BATTLEANIMFRAMESET_18
+ const BATTLEANIMFRAMESET_19
+ const BATTLEANIMFRAMESET_1A
+ const BATTLEANIMFRAMESET_1B
+ const BATTLEANIMFRAMESET_1C
+ const BATTLEANIMFRAMESET_1D
+ const BATTLEANIMFRAMESET_1E
+ const BATTLEANIMFRAMESET_1F
+ const BATTLEANIMFRAMESET_20
+ const BATTLEANIMFRAMESET_21
+ const BATTLEANIMFRAMESET_22
+ const BATTLEANIMFRAMESET_23
+ const BATTLEANIMFRAMESET_24
+ const BATTLEANIMFRAMESET_25
+ const BATTLEANIMFRAMESET_26
+ const BATTLEANIMFRAMESET_27
+ const BATTLEANIMFRAMESET_28
+ const BATTLEANIMFRAMESET_29
+ const BATTLEANIMFRAMESET_2A
+ const BATTLEANIMFRAMESET_2B
+ const BATTLEANIMFRAMESET_2C
+ const BATTLEANIMFRAMESET_2D
+ const BATTLEANIMFRAMESET_2E
+ const BATTLEANIMFRAMESET_2F
+ const BATTLEANIMFRAMESET_30
+ const BATTLEANIMFRAMESET_31
+ const BATTLEANIMFRAMESET_32
+ const BATTLEANIMFRAMESET_33
+ const BATTLEANIMFRAMESET_34
+ const BATTLEANIMFRAMESET_35
+ const BATTLEANIMFRAMESET_36
+ const BATTLEANIMFRAMESET_37
+ const BATTLEANIMFRAMESET_38
+ const BATTLEANIMFRAMESET_39
+ const BATTLEANIMFRAMESET_3A
+ const BATTLEANIMFRAMESET_3B
+ const BATTLEANIMFRAMESET_3C
+ const BATTLEANIMFRAMESET_3D
+ const BATTLEANIMFRAMESET_3E
+ const BATTLEANIMFRAMESET_3F
+ const BATTLEANIMFRAMESET_40
+ const BATTLEANIMFRAMESET_41
+ const BATTLEANIMFRAMESET_42
+ const BATTLEANIMFRAMESET_43
+ const BATTLEANIMFRAMESET_44
+ const BATTLEANIMFRAMESET_45
+ const BATTLEANIMFRAMESET_46
+ const BATTLEANIMFRAMESET_47
+ const BATTLEANIMFRAMESET_48
+ const BATTLEANIMFRAMESET_49
+ const BATTLEANIMFRAMESET_4A
+ const BATTLEANIMFRAMESET_4B
+ const BATTLEANIMFRAMESET_4C
+ const BATTLEANIMFRAMESET_4D
+ const BATTLEANIMFRAMESET_4E
+ const BATTLEANIMFRAMESET_4F
+ const BATTLEANIMFRAMESET_50
+ const BATTLEANIMFRAMESET_51
+ const BATTLEANIMFRAMESET_52
+ const BATTLEANIMFRAMESET_53
+ const BATTLEANIMFRAMESET_54
+ const BATTLEANIMFRAMESET_55
+ const BATTLEANIMFRAMESET_56
+ const BATTLEANIMFRAMESET_57
+ const BATTLEANIMFRAMESET_58
+ const BATTLEANIMFRAMESET_59
+ const BATTLEANIMFRAMESET_5A
+ const BATTLEANIMFRAMESET_5B
+ const BATTLEANIMFRAMESET_5C
+ const BATTLEANIMFRAMESET_5D
+ const BATTLEANIMFRAMESET_5E
+ const BATTLEANIMFRAMESET_5F
+ const BATTLEANIMFRAMESET_60
+ const BATTLEANIMFRAMESET_61
+ const BATTLEANIMFRAMESET_62
+ const BATTLEANIMFRAMESET_63
+ const BATTLEANIMFRAMESET_64
+ const BATTLEANIMFRAMESET_65
+ const BATTLEANIMFRAMESET_66
+ const BATTLEANIMFRAMESET_67
+ const BATTLEANIMFRAMESET_68
+ const BATTLEANIMFRAMESET_69
+ const BATTLEANIMFRAMESET_6A
+ const BATTLEANIMFRAMESET_6B
+ const BATTLEANIMFRAMESET_6C
+ const BATTLEANIMFRAMESET_6D
+ const BATTLEANIMFRAMESET_6E
+ const BATTLEANIMFRAMESET_6F
+ const BATTLEANIMFRAMESET_70
+ const BATTLEANIMFRAMESET_71
+ const BATTLEANIMFRAMESET_72
+ const BATTLEANIMFRAMESET_73
+ const BATTLEANIMFRAMESET_74
+ const BATTLEANIMFRAMESET_75
+ const BATTLEANIMFRAMESET_76
+ const BATTLEANIMFRAMESET_77
+ const BATTLEANIMFRAMESET_78
+ const BATTLEANIMFRAMESET_79
+ const BATTLEANIMFRAMESET_7A
+ const BATTLEANIMFRAMESET_7B
+ const BATTLEANIMFRAMESET_7C
+ const BATTLEANIMFRAMESET_7D
+ const BATTLEANIMFRAMESET_7E
+ const BATTLEANIMFRAMESET_7F
+ const BATTLEANIMFRAMESET_80
+ const BATTLEANIMFRAMESET_81
+ const BATTLEANIMFRAMESET_82
+ const BATTLEANIMFRAMESET_83
+ const BATTLEANIMFRAMESET_84
+ const BATTLEANIMFRAMESET_85
+ const BATTLEANIMFRAMESET_86
+ const BATTLEANIMFRAMESET_87
+ const BATTLEANIMFRAMESET_88
+ const BATTLEANIMFRAMESET_89
+ const BATTLEANIMFRAMESET_8A
+ const BATTLEANIMFRAMESET_8B
+ const BATTLEANIMFRAMESET_8C
+ const BATTLEANIMFRAMESET_8D
+ const BATTLEANIMFRAMESET_8E
+ const BATTLEANIMFRAMESET_8F
+ const BATTLEANIMFRAMESET_90
+ const BATTLEANIMFRAMESET_91
+ const BATTLEANIMFRAMESET_92
+ const BATTLEANIMFRAMESET_93
+ const BATTLEANIMFRAMESET_94
+ const BATTLEANIMFRAMESET_95
+ const BATTLEANIMFRAMESET_96
+ const BATTLEANIMFRAMESET_97
+ const BATTLEANIMFRAMESET_98
+ const BATTLEANIMFRAMESET_99
+ const BATTLEANIMFRAMESET_9A
+ const BATTLEANIMFRAMESET_9B
+ const BATTLEANIMFRAMESET_9C
+ const BATTLEANIMFRAMESET_9D
+ const BATTLEANIMFRAMESET_9E
+ const BATTLEANIMFRAMESET_9F
+ const BATTLEANIMFRAMESET_A0
+ const BATTLEANIMFRAMESET_A1
+ const BATTLEANIMFRAMESET_A2
+ const BATTLEANIMFRAMESET_A3
+ const BATTLEANIMFRAMESET_A4
+ const BATTLEANIMFRAMESET_A5
+ const BATTLEANIMFRAMESET_A6
+ const BATTLEANIMFRAMESET_A7
+ const BATTLEANIMFRAMESET_A8
+ const BATTLEANIMFRAMESET_A9
+ const BATTLEANIMFRAMESET_AA
+ const BATTLEANIMFRAMESET_AB
+ const BATTLEANIMFRAMESET_AC
+ const BATTLEANIMFRAMESET_AD
+ const BATTLEANIMFRAMESET_AE
+ const BATTLEANIMFRAMESET_AF
+ const BATTLEANIMFRAMESET_B0
+ const BATTLEANIMFRAMESET_B1
+ const BATTLEANIMFRAMESET_B2
+ const BATTLEANIMFRAMESET_B3
+ const BATTLEANIMFRAMESET_B4
+ const BATTLEANIMFRAMESET_B5
+ const BATTLEANIMFRAMESET_B6
+ const BATTLEANIMFRAMESET_B7
+ const BATTLEANIMFRAMESET_B8
const_def
const BATTLEANIMOAMSET_00
@@ -735,7 +735,7 @@ const_value SET 1
const ANIM_BG_1E
const ANIM_BG_1F
const ANIM_BG_20
- const ANIM_BG_21
+ const ANIM_BG_WITHDRAW
const ANIM_BG_BOUNCE_DOWN
const ANIM_BG_DIG
const ANIM_BG_TACKLE
diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm
index eff9dab84..bc50e3db2 100755
--- a/constants/audio_constants.asm
+++ b/constants/audio_constants.asm
@@ -15,6 +15,7 @@
const A_
const A#
const B_
+ const CC ; used for pitchoffset
; channel
const_def
@@ -41,7 +42,7 @@ SOUND_REST EQU 5
; Flags2
SOUND_VIBRATO EQU 0
-SOUND_UNKN_09 EQU 1
+SOUND_PITCH_WHEEL EQU 1
SOUND_DUTY EQU 2
SOUND_UNKN_0B EQU 3
SOUND_CRY_PITCH EQU 4
@@ -51,12 +52,12 @@ SOUND_UNKN_0F EQU 7
; Flags3
SOUND_VIBRATO_DIR EQU 0
-SOUND_UNKN_11 EQU 1
+SOUND_PITCH_WHEEL_DIR EQU 1
; NoteFlags
-NOTE_UNKN_0 EQU 0
-NOTE_UNKN_1 EQU 1
+NOTE_DUTY_OVERRIDE EQU 0
+NOTE_FREQ_OVERRIDE EQU 1
NOTE_UNKN_3 EQU 3
-NOTE_UNKN_4 EQU 4
+NOTE_NOISE_SAMPLING EQU 4
NOTE_REST EQU 5
-NOTE_UNKN_6 EQU 6
+NOTE_VIBRATO_OVERRIDE EQU 6
diff --git a/constants/cgb_constants.asm b/constants/cgb_constants.asm
index 9363415a3..36cf369c2 100755
--- a/constants/cgb_constants.asm
+++ b/constants/cgb_constants.asm
@@ -7,13 +7,13 @@
const SCGB_SLOT_MACHINE
const SCGB_06
const SCGB_07
- const SCGB_08
+ const SCGB_DIPLOMA
const SCGB_MAPPALS
- const SCGB_0A
- const SCGB_0B
+ const SCGB_PARTY_MENU
+ const SCGB_EVOLUTION
const SCGB_0C
const SCGB_0D
- const SCGB_0E
+ const SCGB_MOVE_LIST
const SCGB_0F
const SCGB_POKEDEX_SEARCH_OPTION
const SCGB_11
@@ -22,13 +22,13 @@
const SCGB_PACKPALS
const SCGB_TRAINER_CARD
const SCGB_POKEDEX_UNOWN_MODE
- const SCGB_17
- const SCGB_18
- const SCGB_19
- const SCGB_1A
- const SCGB_1B
- const SCGB_FRONTPICPALS
- const SCGB_1D
+ const SCGB_BILLS_PC
+ const SCGB_UNOWN_PUZZLE
+ const SCGB_GAMEFREAK_LOGO
+ const SCGB_PLAYER_OR_MON_FRONTPIC_PALS
+ const SCGB_TRADE_TUBE
+ const SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+ const SCGB_MYSTERY_GIFT
const SCGB_1E
SCGB_PARTY_MENU_HP_PALS EQU -4
diff --git a/constants/map_constants.asm b/constants/map_constants.asm
index 4e1dd718f..1ed12662f 100644
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -518,39 +518,39 @@ const_value SET 1
; object struct
const_def
- const OBJECT_SPRITE
- const OBJECT_MAP_OBJECT_INDEX
- const OBJECT_SPRITE_TILE
- const OBJECT_MOVEMENTTYPE
- const OBJECT_FLAGS1
- const OBJECT_FLAGS2
- const OBJECT_PALETTE
- const OBJECT_DIRECTION_WALKING
- const OBJECT_FACING
- const OBJECT_STEP_TYPE
- const OBJECT_STEP_DURATION
- const OBJECT_ACTION
- const OBJECT_STEP_FRAME
- const OBJECT_FACING_STEP
- const OBJECT_NEXT_TILE
- const OBJECT_STANDING_TILE
- const OBJECT_NEXT_MAP_X
- const OBJECT_NEXT_MAP_Y
- const OBJECT_MAP_X
- const OBJECT_MAP_Y
- const OBJECT_INIT_X
- const OBJECT_INIT_Y
- const OBJECT_RADIUS
- const OBJECT_SPRITE_X
- const OBJECT_SPRITE_Y
- const OBJECT_SPRITE_X_OFFSET
- const OBJECT_SPRITE_Y_OFFSET
- const OBJECT_MOVEMENT_BYTE_INDEX
- const OBJECT_28
- const OBJECT_29
- const OBJECT_30
- const OBJECT_31
- const OBJECT_RANGE
+ const OBJECT_SPRITE ; 00
+ const OBJECT_MAP_OBJECT_INDEX ; 01
+ const OBJECT_SPRITE_TILE ; 02
+ const OBJECT_MOVEMENTTYPE ; 03
+ const OBJECT_FLAGS1 ; 04
+ const OBJECT_FLAGS2 ; 05
+ const OBJECT_PALETTE ; 06
+ const OBJECT_DIRECTION_WALKING ; 07
+ const OBJECT_FACING ; 08
+ const OBJECT_STEP_TYPE ; 09
+ const OBJECT_STEP_DURATION ; 0a
+ const OBJECT_ACTION ; 0b
+ const OBJECT_STEP_FRAME ; 0c
+ const OBJECT_FACING_STEP ; 0d
+ const OBJECT_NEXT_TILE ; 0e
+ const OBJECT_STANDING_TILE ; 0f
+ const OBJECT_NEXT_MAP_X ; 10
+ const OBJECT_NEXT_MAP_Y ; 11
+ const OBJECT_MAP_X ; 12
+ const OBJECT_MAP_Y ; 13
+ const OBJECT_INIT_X ; 14
+ const OBJECT_INIT_Y ; 15
+ const OBJECT_RADIUS ; 16
+ const OBJECT_SPRITE_X ; 17
+ const OBJECT_SPRITE_Y ; 18
+ const OBJECT_SPRITE_X_OFFSET ; 19
+ const OBJECT_SPRITE_Y_OFFSET ; 1a
+ const OBJECT_MOVEMENT_BYTE_INDEX ; 1b
+ const OBJECT_28 ; 1c
+ const OBJECT_29 ; 1d
+ const OBJECT_30 ; 1e
+ const OBJECT_31 ; 1f
+ const OBJECT_RANGE ; 20
; 33-39 are not used
; map object struct
diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm
index 41a6f7da0..6082768ac 100644
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -18,10 +18,12 @@ LV_CHAR EQU $6e
; GetName types
PKMN_NAME EQU 1
MOVE_NAME EQU 2
+; dummied out EQU 3
ITEM_NAME EQU 4
PARTY_OT_NAME EQU 5
ENEMY_OT_NAME EQU 6
TRAINER_NAME EQU 7
+; broken ptr EQU 8
; hp
HP_GREEN EQU 0
@@ -213,6 +215,22 @@ NUM_KANTO_BADGES EQU const_value
NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES
NUM_KANA EQU $2d
+ const_def
+ const EZCHAT_POKEMON
+ const EZCHAT_TYPES
+ const EZCHAT_GREETINGS
+ const EZCHAT_PEOPLE
+ const EZCHAT_BATTLE
+ const EZCHAT_EXCLAMATIONS
+ const EZCHAT_CONVERSATION
+ const EZCHAT_FEELINGS
+ const EZCHAT_CONDITIONS
+ const EZCHAT_LIFE
+ const EZCHAT_HOBBIES
+ const EZCHAT_ACTIONS
+ const EZCHAT_TIME
+ const EZCHAT_FAREWELLS
+ const EZCHAT_THISANDTHAT
SWARM_DUNSPARCE EQU 0
SWARM_YANMA EQU 1
@@ -235,3 +253,9 @@ FISHSWARM_REMORAID EQU 2
const FISHGROUP_QWILFISH
const FISHGROUP_REMORAID
const FISHGROUP_QWILFISH_NO_SWARM
+
+INIT_ENEMYOT_LIST EQU 1
+INIT_BAG_ITEM_LIST EQU 2
+INIT_OTHER_ITEM_LIST EQU 3
+INIT_PLAYEROT_LIST EQU 4
+INIT_MON_LIST EQU 5
diff --git a/constants/printer_constants.asm b/constants/printer_constants.asm
new file mode 100755
index 000000000..5cd8fcd77
--- /dev/null
+++ b/constants/printer_constants.asm
@@ -0,0 +1,9 @@
+const_value SET 1
+
+ const PRINTER_STATUS_CHECKING
+ const PRINTER_STATUS_TRANSMITTING
+ const PRINTER_STATUS_PRINTING
+ const PRINTER_ERROR_1
+ const PRINTER_ERROR_2
+ const PRINTER_ERROR_3
+ const PRINTER_ERROR_4
diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm
index e7524cd58..7ac9d10ee 100644
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -230,8 +230,7 @@ NUM_SPRITEHEADER_FIELDS EQU const_value
const SPRITEMOVEDATA_BOULDERDUST ; 22
const SPRITEMOVEDATA_GRASS ; 23
const SPRITEMOVEDATA_LAPRAS ; 24
- const SPRITEMOVEDATA_25 ; 25
-NUM_SPRITEMOVEDATA EQU const_value +- 1
+NUM_SPRITEMOVEDATA EQU const_value
SPRITEMOVEDATA_FIELDS EQU 6
; sprite movement functions
@@ -303,68 +302,68 @@ MAX_OUTDOOR_SPRITES EQU 23
const PERSON_ACTION_SPIN
const PERSON_ACTION_SPIN_FLICKER
const PERSON_ACTION_FISHING
- const PERSON_ACTION_07
+ const PERSON_ACTION_SHADOW
const PERSON_ACTION_EMOTE
- const PERSON_ACTION_09
- const PERSON_ACTION_0A
- const PERSON_ACTION_0B
- const PERSON_ACTION_0C
- const PERSON_ACTION_0D
- const PERSON_ACTION_0E
- const PERSON_ACTION_0F
- const PERSON_ACTION_10
+ const PERSON_ACTION_BIG_SNORLAX
+ const PERSON_ACTION_BOUNCE
+ const PERSON_ACTION_WEIRD_TREE
+ const PERSON_ACTION_BIG_LAPRAS
+ const PERSON_ACTION_BIG_DOLL
+ const PERSON_ACTION_BOULDER_DUST
+ const PERSON_ACTION_GRASS_SHAKE
+ const PERSON_ACTION_SKYFALL
const_def
- const FACING_00
- const FACING_01
- const FACING_02
- const FACING_03
- const FACING_04
- const FACING_05
- const FACING_06
- const FACING_07
- const FACING_08
- const FACING_09
- const FACING_0A
- const FACING_0B
- const FACING_0C
- const FACING_0D
- const FACING_0E
- const FACING_0F
- const FACING_10
- const FACING_11
- const FACING_12
- const FACING_13
+ const FACING_STEP_DOWN_0
+ const FACING_STEP_DOWN_1
+ const FACING_STEP_DOWN_2
+ const FACING_STEP_DOWN_3
+ const FACING_STEP_UP_0
+ const FACING_STEP_UP_1
+ const FACING_STEP_UP_2
+ const FACING_STEP_UP_3
+ const FACING_STEP_LEFT_0
+ const FACING_STEP_LEFT_1
+ const FACING_STEP_LEFT_2
+ const FACING_STEP_LEFT_3
+ const FACING_STEP_RIGHT_0
+ const FACING_STEP_RIGHT_1
+ const FACING_STEP_RIGHT_2
+ const FACING_STEP_RIGHT_3
+ const FACING_FISH_DOWN
+ const FACING_FISH_UP
+ const FACING_FISH_LEFT
+ const FACING_FISH_RIGHT
const FACING_EMOTE
- const FACING_15
- const FACING_16
- const FACING_17
- const FACING_18
- const FACING_19
- const FACING_1A
- const FACING_1B
- const FACING_1C
- const FACING_1D
- const FACING_1E
- const FACING_1F
+ const FACING_SHADOW
+ const FACING_BIG_DOLL_ASYM
+ const FACING_BIG_DOLL_SYM
+ const FACING_WEIRD_TREE_0
+ const FACING_WEIRD_TREE_1
+ const FACING_WEIRD_TREE_2
+ const FACING_WEIRD_TREE_3
+ const FACING_BOULDER_DUST_1
+ const FACING_BOULDER_DUST_2
+ const FACING_GRASS_1
+ const FACING_GRASS_2
const_def
- const SPRITEANIMSTRUCT_INDEX ; 0
- const SPRITEANIMSTRUCT_FRAMESET_ID ; 1
- const SPRITEANIMSTRUCT_ANIM_SEQ_ID ; 2
- const SPRITEANIMSTRUCT_TILE_ID ; 3
- const SPRITEANIMSTRUCT_XCOORD ; 4
- const SPRITEANIMSTRUCT_YCOORD ; 5
- const SPRITEANIMSTRUCT_XOFFSET ; 6
- const SPRITEANIMSTRUCT_YOFFSET ; 7
- const SPRITEANIMSTRUCT_DURATION ; 8
- const SPRITEANIMSTRUCT_DURATIONOFFSET ; 9
- const SPRITEANIMSTRUCT_FRAME ; a
- const SPRITEANIMSTRUCT_0B ; b
- const SPRITEANIMSTRUCT_0C ; c
- const SPRITEANIMSTRUCT_0D ; d
- const SPRITEANIMSTRUCT_0E ; e
- const SPRITEANIMSTRUCT_0F ; f
+ const SPRITEANIMSTRUCT_INDEX ; 0
+ const SPRITEANIMSTRUCT_FRAMESET_ID ; 1
+ const SPRITEANIMSTRUCT_ANIM_SEQ_ID ; 2
+ const SPRITEANIMSTRUCT_TILE_ID ; 3
+ const SPRITEANIMSTRUCT_XCOORD ; 4
+ const SPRITEANIMSTRUCT_YCOORD ; 5
+ const SPRITEANIMSTRUCT_XOFFSET ; 6
+ const SPRITEANIMSTRUCT_YOFFSET ; 7
+ const SPRITEANIMSTRUCT_DURATION ; 8
+ const SPRITEANIMSTRUCT_DURATIONOFFSET ; 9
+ const SPRITEANIMSTRUCT_FRAME ; a
+ const SPRITEANIMSTRUCT_JUMPTABLE_INDEX ; b
+ const SPRITEANIMSTRUCT_0C ; c
+ const SPRITEANIMSTRUCT_0D ; d
+ const SPRITEANIMSTRUCT_0E ; e
+ const SPRITEANIMSTRUCT_0F ; f
const_def
const SPRITE_ANIM_FRAMESET_00
@@ -390,8 +389,8 @@ MAX_OUTDOOR_SPRITES EQU 23
const SPRITE_ANIM_FRAMESET_14
const SPRITE_ANIM_FRAMESET_15
const SPRITE_ANIM_FRAMESET_16
- const SPRITE_ANIM_FRAMESET_17
- const SPRITE_ANIM_FRAMESET_18
+ const SPRITE_ANIM_FRAMESET_TRADEMON_ICON
+ const SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE
const SPRITE_ANIM_FRAMESET_19
const SPRITE_ANIM_FRAMESET_1A
const SPRITE_ANIM_FRAMESET_1B
@@ -453,7 +452,7 @@ MAX_OUTDOOR_SPRITES EQU 23
const SPRITE_ANIM_SEQ_0F
const SPRITE_ANIM_SEQ_10
const SPRITE_ANIM_SEQ_11
- const SPRITE_ANIM_SEQ_12
+ const SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE
const SPRITE_ANIM_SEQ_13
const SPRITE_ANIM_SEQ_14
const SPRITE_ANIM_SEQ_15
@@ -489,8 +488,8 @@ MAX_OUTDOOR_SPRITES EQU 23
const SPRITE_ANIM_INDEX_0E
const SPRITE_ANIM_INDEX_0F
const SPRITE_ANIM_INDEX_10
- const SPRITE_ANIM_INDEX_11
- const SPRITE_ANIM_INDEX_12
+ const SPRITE_ANIM_INDEX_TRADEMON_ICON
+ const SPRITE_ANIM_INDEX_TRADEMON_BUBBLE
const SPRITE_ANIM_INDEX_13
const SPRITE_ANIM_INDEX_14
const SPRITE_ANIM_INDEX_15
@@ -517,3 +516,146 @@ MAX_OUTDOOR_SPRITES EQU 23
const SPRITE_ANIM_INDEX_2A
const SPRITE_ANIM_INDEX_2B
const SPRITE_ANIM_INDEX_2C
+
+ const_def
+
+ const SPRITE_ANIM_FRAME_IDX_00
+ const SPRITE_ANIM_FRAME_IDX_01
+ const SPRITE_ANIM_FRAME_IDX_02
+ const SPRITE_ANIM_FRAME_IDX_03
+ const SPRITE_ANIM_FRAME_IDX_04
+ const SPRITE_ANIM_FRAME_IDX_05
+ const SPRITE_ANIM_FRAME_IDX_06
+ const SPRITE_ANIM_FRAME_IDX_07
+ const SPRITE_ANIM_FRAME_IDX_08
+ const SPRITE_ANIM_FRAME_IDX_09
+ const SPRITE_ANIM_FRAME_IDX_0A
+ const SPRITE_ANIM_FRAME_IDX_0B
+ const SPRITE_ANIM_FRAME_IDX_0C
+ const SPRITE_ANIM_FRAME_IDX_0D
+ const SPRITE_ANIM_FRAME_IDX_0E
+ const SPRITE_ANIM_FRAME_IDX_0F
+ const SPRITE_ANIM_FRAME_IDX_10
+ const SPRITE_ANIM_FRAME_IDX_11
+ const SPRITE_ANIM_FRAME_IDX_12
+ const SPRITE_ANIM_FRAME_IDX_13
+ const SPRITE_ANIM_FRAME_IDX_14
+ const SPRITE_ANIM_FRAME_IDX_15
+ const SPRITE_ANIM_FRAME_IDX_16
+ const SPRITE_ANIM_FRAME_IDX_17
+ const SPRITE_ANIM_FRAME_IDX_18
+ const SPRITE_ANIM_FRAME_IDX_19
+ const SPRITE_ANIM_FRAME_IDX_1A
+ const SPRITE_ANIM_FRAME_IDX_1B
+ const SPRITE_ANIM_FRAME_IDX_1C
+ const SPRITE_ANIM_FRAME_IDX_1D
+ const SPRITE_ANIM_FRAME_IDX_1E
+ const SPRITE_ANIM_FRAME_IDX_1F
+ const SPRITE_ANIM_FRAME_IDX_20
+ const SPRITE_ANIM_FRAME_IDX_21
+ const SPRITE_ANIM_FRAME_IDX_22
+ const SPRITE_ANIM_FRAME_IDX_23
+ const SPRITE_ANIM_FRAME_IDX_24
+ const SPRITE_ANIM_FRAME_IDX_25
+ const SPRITE_ANIM_FRAME_IDX_26
+ const SPRITE_ANIM_FRAME_IDX_27
+ const SPRITE_ANIM_FRAME_IDX_28
+ const SPRITE_ANIM_FRAME_IDX_29
+ const SPRITE_ANIM_FRAME_IDX_2A
+ const SPRITE_ANIM_FRAME_IDX_2B
+ const SPRITE_ANIM_FRAME_IDX_2C
+ const SPRITE_ANIM_FRAME_IDX_2D
+ const SPRITE_ANIM_FRAME_IDX_2E
+ const SPRITE_ANIM_FRAME_IDX_2F
+ const SPRITE_ANIM_FRAME_IDX_30
+ const SPRITE_ANIM_FRAME_IDX_31
+ const SPRITE_ANIM_FRAME_IDX_32
+ const SPRITE_ANIM_FRAME_IDX_33
+ const SPRITE_ANIM_FRAME_IDX_34
+ const SPRITE_ANIM_FRAME_IDX_35
+ const SPRITE_ANIM_FRAME_IDX_36
+ const SPRITE_ANIM_FRAME_IDX_37
+ const SPRITE_ANIM_FRAME_IDX_38
+ const SPRITE_ANIM_FRAME_IDX_39
+ const SPRITE_ANIM_FRAME_IDX_3A
+ const SPRITE_ANIM_FRAME_IDX_3B
+ const SPRITE_ANIM_FRAME_IDX_3C
+ const SPRITE_ANIM_FRAME_IDX_3D
+ const SPRITE_ANIM_FRAME_IDX_3E
+ const SPRITE_ANIM_FRAME_IDX_3F
+ const SPRITE_ANIM_FRAME_IDX_40
+ const SPRITE_ANIM_FRAME_IDX_41
+ const SPRITE_ANIM_FRAME_IDX_42
+ const SPRITE_ANIM_FRAME_IDX_43
+ const SPRITE_ANIM_FRAME_IDX_44
+ const SPRITE_ANIM_FRAME_IDX_45
+ const SPRITE_ANIM_FRAME_IDX_46
+ const SPRITE_ANIM_FRAME_IDX_47
+ const SPRITE_ANIM_FRAME_IDX_48
+ const SPRITE_ANIM_FRAME_IDX_49
+ const SPRITE_ANIM_FRAME_IDX_4A
+ const SPRITE_ANIM_FRAME_IDX_4B
+ const SPRITE_ANIM_FRAME_IDX_4C
+ const SPRITE_ANIM_FRAME_IDX_4D
+ const SPRITE_ANIM_FRAME_IDX_4E
+ const SPRITE_ANIM_FRAME_IDX_4F
+ const SPRITE_ANIM_FRAME_IDX_50
+ const SPRITE_ANIM_FRAME_IDX_51
+ const SPRITE_ANIM_FRAME_IDX_52
+ const SPRITE_ANIM_FRAME_IDX_53
+ const SPRITE_ANIM_FRAME_IDX_54
+ const SPRITE_ANIM_FRAME_IDX_55
+ const SPRITE_ANIM_FRAME_IDX_56
+ const SPRITE_ANIM_FRAME_IDX_57
+ const SPRITE_ANIM_FRAME_IDX_58
+ const SPRITE_ANIM_FRAME_IDX_59
+ const SPRITE_ANIM_FRAME_IDX_5A
+ const SPRITE_ANIM_FRAME_IDX_5B
+ const SPRITE_ANIM_FRAME_IDX_5C
+ const SPRITE_ANIM_FRAME_IDX_5D
+ const SPRITE_ANIM_FRAME_IDX_5E
+ const SPRITE_ANIM_FRAME_IDX_5F
+ const SPRITE_ANIM_FRAME_IDX_60
+ const SPRITE_ANIM_FRAME_IDX_61
+ const SPRITE_ANIM_FRAME_IDX_62
+ const SPRITE_ANIM_FRAME_IDX_63
+ const SPRITE_ANIM_FRAME_IDX_64
+ const SPRITE_ANIM_FRAME_IDX_65
+ const SPRITE_ANIM_FRAME_IDX_66
+ const SPRITE_ANIM_FRAME_IDX_67
+ const SPRITE_ANIM_FRAME_IDX_68
+ const SPRITE_ANIM_FRAME_IDX_69
+ const SPRITE_ANIM_FRAME_IDX_6A
+ const SPRITE_ANIM_FRAME_IDX_6B
+ const SPRITE_ANIM_FRAME_IDX_6C
+ const SPRITE_ANIM_FRAME_IDX_6D
+ const SPRITE_ANIM_FRAME_IDX_6E
+ const SPRITE_ANIM_FRAME_IDX_6F
+ const SPRITE_ANIM_FRAME_IDX_70
+ const SPRITE_ANIM_FRAME_IDX_71
+ const SPRITE_ANIM_FRAME_IDX_72
+ const SPRITE_ANIM_FRAME_IDX_73
+ const SPRITE_ANIM_FRAME_IDX_74
+ const SPRITE_ANIM_FRAME_IDX_75
+ const SPRITE_ANIM_FRAME_IDX_76
+ const SPRITE_ANIM_FRAME_IDX_77
+ const SPRITE_ANIM_FRAME_IDX_78
+ const SPRITE_ANIM_FRAME_IDX_79
+ const SPRITE_ANIM_FRAME_IDX_7A
+ const SPRITE_ANIM_FRAME_IDX_7B
+ const SPRITE_ANIM_FRAME_IDX_7C
+ const SPRITE_ANIM_FRAME_IDX_7D
+ const SPRITE_ANIM_FRAME_IDX_7E
+ const SPRITE_ANIM_FRAME_IDX_7F
+ const SPRITE_ANIM_FRAME_IDX_80
+ const SPRITE_ANIM_FRAME_IDX_81
+ const SPRITE_ANIM_FRAME_IDX_82
+ const SPRITE_ANIM_FRAME_IDX_83
+ const SPRITE_ANIM_FRAME_IDX_84
+ const SPRITE_ANIM_FRAME_IDX_85
+ const SPRITE_ANIM_FRAME_IDX_86
+ const SPRITE_ANIM_FRAME_IDX_87
+ const SPRITE_ANIM_FRAME_IDX_88
+ const SPRITE_ANIM_FRAME_IDX_89
+ const SPRITE_ANIM_FRAME_IDX_8A
+ const SPRITE_ANIM_FRAME_IDX_8B
diff --git a/constants/sram_constants.asm b/constants/sram_constants.asm
index caac8347b..c2d112b7d 100755
--- a/constants/sram_constants.asm
+++ b/constants/sram_constants.asm
@@ -1,3 +1,53 @@
; Mobile bank 5
+
+; sMobileEventIndex EQU $a000 ; moved to 1:BE3C in English
+sTrainerRankings EQU $a001
+sTrainerRankingGameTimeHOF EQU $a001
+sTrainerRankingStepCountHOF EQU $a005
+sTrainerRankingHealingsHOF EQU $a009
+sTrainerRankingBattlesHOF EQU $a00d
+sTrainerRankingStepCount EQU $a010
+sTrainerRankingBattleTowerWins EQU $a014
+sTrainerRankingTMsHMsTaught EQU $a018
+sTrainerRankingBattles EQU $a01b
+sTrainerRankingWildBattles EQU $a01e
+sTrainerRankingTrainerBattles EQU $a021
+sTrainerRankingUnused1 EQU $a024
+sTrainerRankingHOFEntries EQU $a027
+sTrainerRankingWildMonsCaught EQU $a02a
+sTrainerRankingHookedEncounters EQU $a02d
+sTrainerRankingEggsHatched EQU $a030
+sTrainerRankingMonsEvolved EQU $a033
+sTrainerRankingFruitPicked EQU $a036
+sTrainerRankingHealings EQU $a039
+sTrainerRankingMysteryGift EQU $a03c
+sTrainerRankingTrades EQU $a03f
+sTrainerRankingFly EQU $a042
+sTrainerRankingSurf EQU $a045
+sTrainerRankingWaterfall EQU $a048
+sTrainerRankingWhiteOuts EQU $a04b
+sTrainerRankingLuckyNumberShow EQU $a04e
+sTrainerRankingPhoneCalls EQU $a051
+sTrainerRankingUnused2 EQU $a054
+sTrainerRankingLinkBattles EQU $a057
+sTrainerRankingSplash EQU $a05a
+sTrainerRankingTreeEncounters EQU $a05d
+sTrainerRankingUnused3 EQU $a060
+sTrainerRankingColosseumWins EQU $a063
+sTrainerRankingColosseumLosses EQU $a066
+sTrainerRankingColosseumDraws EQU $a069
+sTrainerRankingSelfDestruct EQU $a06c
+sTrainerRankingCurrentSlotsStreak EQU $a06f
+sTrainerRankingLongestSlotsStreak EQU $a071
+sTrainerRankingTotalSlotsPayouts EQU $a073
+sTrainerRankingTotalBattlePayouts EQU $a077
+sTrainerRankingLongestMagikarp EQU $a07b
+sTrainerRankingShortestMagikarp EQU $a07d
+sTrainerRankingBugContestScore EQU $a07f
+sTrainerRankingsChecksum EQU $a081
+sTrainerRankingsEnd EQU $a083
+; sMobileEventIndexBackup EQU $a083 ; moved to 1:BE44 in English
+sTrainerRankingsBackup EQU $a084
+
sMobileLoginPassword EQU $aa4b
LOGIN_PASSWORD_LENGTH EQU 17
diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm
index f7486fc83..09d457f5e 100644
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -3,7 +3,7 @@
PARTYMON EQU 0
OTPARTYMON EQU 1
BOXMON EQU 2
-BREEDMON EQU 3
+TEMPMON EQU 3
WILDMON EQU 4
; Options: ; cfcc
diff --git a/data/map_objects.asm b/data/map_objects.asm
index 715b1d1b9..ec4a859b3 100755
--- a/data/map_objects.asm
+++ b/data/map_objects.asm
@@ -3,42 +3,42 @@ sprite_movement_data: macro
dn \6, 0
endm
- ; function, facing, action, flags1, flags2, palette flags
- sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 00
- sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 01
- sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 02
- sprite_movement_data SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 03
- sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 04
- sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_X, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 05
- sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 06
- sprite_movement_data SPRITEMOVEFN_STANDING, UP, PERSON_ACTION_STAND, $00, $00, %0000 ; 07
- sprite_movement_data SPRITEMOVEFN_STANDING, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 08
- sprite_movement_data SPRITEMOVEFN_STANDING, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 09
- sprite_movement_data SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0a
- sprite_movement_data SPRITEMOVEFN_OBEY_DPAD, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 0b
- sprite_movement_data SPRITEMOVEFN_08, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0c
- sprite_movement_data SPRITEMOVEFN_09, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0d
- sprite_movement_data SPRITEMOVEFN_0A, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0e
- sprite_movement_data SPRITEMOVEFN_0B, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0f
- sprite_movement_data SPRITEMOVEFN_0C, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 10
- sprite_movement_data SPRITEMOVEFN_0D, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 11
- sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 12
- sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 13
- sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 14
- sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
- sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
- sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 17
- sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $2e, $10, %0000 ; 18
- sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_STAND, $2e, $00, %0100 ; 19
- sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 1a
- sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
- sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_EMOTE, $8e, $02, %0000 ; 1c
- sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
- sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1e
- sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1f
- sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20
- sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21
- sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22
- sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23
- sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0010 ; 24
- sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 25 \ No newline at end of file
+ ; function, facing, action, flags1, flags2, palette flags
+ sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 00
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 01
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 02
+ sprite_movement_data SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 03
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 04
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_X, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 05
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 06
+ sprite_movement_data SPRITEMOVEFN_STANDING, UP, PERSON_ACTION_STAND, $00, $00, %0000 ; 07
+ sprite_movement_data SPRITEMOVEFN_STANDING, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 08
+ sprite_movement_data SPRITEMOVEFN_STANDING, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 09
+ sprite_movement_data SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0a
+ sprite_movement_data SPRITEMOVEFN_OBEY_DPAD, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 0b
+ sprite_movement_data SPRITEMOVEFN_08, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0c
+ sprite_movement_data SPRITEMOVEFN_09, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0d
+ sprite_movement_data SPRITEMOVEFN_0A, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0e
+ sprite_movement_data SPRITEMOVEFN_0B, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0f
+ sprite_movement_data SPRITEMOVEFN_0C, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 10
+ sprite_movement_data SPRITEMOVEFN_0D, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 11
+ sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 12
+ sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 13
+ sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 14
+ sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_BIG_SNORLAX, $2e, $01, %1100 ; 15
+ sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_BOUNCE, $2e, $00, %0000 ; 16
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 17
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $2e, $10, %0000 ; 18
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_STAND, $2e, $00, %0100 ; 19
+ sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 1a
+ sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
+ sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_EMOTE, $8e, $02, %0000 ; 1c
+ sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
+ sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1e
+ sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1f
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_BIG_LAPRAS, $2e, $01, %1100 ; 20
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_BIG_DOLL, $2e, $01, %1100 ; 21
+ sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_BOULDER_DUST, $8e, $01, %0000 ; 22
+ sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_GRASS_SHAKE, $8e, $02, %0000 ; 23
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0010 ; 24
+ sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 25
diff --git a/data/pokedex/entry_pointers.asm b/data/pokedex/entry_pointers.asm
index 4f0f8aff2..5a432e661 100644
--- a/data/pokedex/entry_pointers.asm
+++ b/data/pokedex/entry_pointers.asm
@@ -1,3 +1,75 @@
+GetDexEntryPointer: ; 44333
+; return dex entry pointer b:de
+ push hl
+ ld hl, PokedexDataPointerTable
+ ld a, b
+ dec a
+ ld d, 0
+ ld e, a
+ add hl, de
+ add hl, de
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ push de
+ rlca
+ rlca
+ and $3
+ ld hl, .PokedexEntryBanks
+ ld d, 0
+ ld e, a
+ add hl, de
+ ld b, [hl]
+ pop de
+ pop hl
+ ret
+
+.PokedexEntryBanks: ; 44351
+
+GLOBAL PokedexEntries1
+GLOBAL PokedexEntries2
+GLOBAL PokedexEntries3
+GLOBAL PokedexEntries4
+
+ db BANK(PokedexEntries1)
+ db BANK(PokedexEntries2)
+ db BANK(PokedexEntries3)
+ db BANK(PokedexEntries4)
+
+GetDexEntryPagePointer: ; 44355
+ call GetDexEntryPointer ; b:de
+ push hl
+ ld h, d
+ ld l, e
+; skip species name
+.loop1
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop1
+; skip height and weight
+rept 4
+ inc hl
+endr
+; if c != 1: skip entry
+ dec c
+ jr z, .done
+; skip entry
+.loop2
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop2
+
+.done
+ ld d, h
+ ld e, l
+ pop hl
+ ret
+
+PokedexDataPointerTable: ; 0x44378
; Pointers to all the Pokedex entries.
dw BulbasaurPokedexEntry
diff --git a/data/sprite_engine.asm b/data/sprite_engine.asm
index 85652acb8..7a8a49bbe 100755
--- a/data/sprite_engine.asm
+++ b/data/sprite_engine.asm
@@ -66,417 +66,435 @@ SpriteAnimFrameData: ; 8d6e6
dw .Frameset_40 ; 40 celebi on the left
dw .Frameset_41 ; 41 celebi on the right
; 8d76a
-; OAM idx (see SpriteAnimOAMData), flip flags/duration
+
.Frameset_00:
- db $00, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_00, 32
+ endanim
.Frameset_01:
- db $00, $08
- db $01, $08
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_00, 8
+ frame SPRITE_ANIM_FRAME_IDX_01, 8
+ dorestart
.Frameset_02:
- db $3d, $08
- db $3e, $08
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3D, 8
+ frame SPRITE_ANIM_FRAME_IDX_3E, 8
+ dorestart
.Frameset_03:
- db $3f, $08
- db $40, $08
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3F, 8
+ frame SPRITE_ANIM_FRAME_IDX_40, 8
+ dorestart
.Frameset_04:
- db $00, $04
- db $01, $04
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_00, 4
+ frame SPRITE_ANIM_FRAME_IDX_01, 4
+ dorestart
.Frameset_05:
- db $3d, $04
- db $3e, $04
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3D, 4
+ frame SPRITE_ANIM_FRAME_IDX_3E, 4
+ dorestart
.Frameset_06:
- db $3f, $04
- db $40, $04
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3F, 4
+ frame SPRITE_ANIM_FRAME_IDX_40, 4
+ dorestart
.Frameset_11:
- db $00, $08
- db $01, $08
- db $00, $08
- db $01, $48
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_00, 8
+ frame SPRITE_ANIM_FRAME_IDX_01, 8
+ frame SPRITE_ANIM_FRAME_IDX_00, 8
+ frame SPRITE_ANIM_FRAME_IDX_01, 8, OAM_X_FLIP
+ dorestart
.Frameset_2d:
- db $63, $08
- db $64, $08
- db $63, $08
- db $64, $48
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_63, 8
+ frame SPRITE_ANIM_FRAME_IDX_64, 8
+ frame SPRITE_ANIM_FRAME_IDX_63, 8
+ frame SPRITE_ANIM_FRAME_IDX_64, 8, OAM_X_FLIP
+ dorestart
.Frameset_2e:
- db $65, $08
- db $66, $08
- db $65, $08
- db $66, $48
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_65, 8
+ frame SPRITE_ANIM_FRAME_IDX_66, 8
+ frame SPRITE_ANIM_FRAME_IDX_65, 8
+ frame SPRITE_ANIM_FRAME_IDX_66, 8, OAM_X_FLIP
+ dorestart
.Frameset_07:
- db $1e, $01
- db $1f, $01
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_1E, 1
+ frame SPRITE_ANIM_FRAME_IDX_1F, 1
+ dorestart
.Frameset_08:
- db $20, $01
- db -3, $01
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_20, 1
+ dorepeat 1
+ dorestart
.Frameset_09:
- db $21, $01
- db -3, $01
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_21, 1
+ dorepeat 1
+ dorestart
.Frameset_0a:
- db $81, $0c
- db $82, $01
- db $83, $01
- db $82, $04
- db $81, $0c
- db $82, $0c
- db $83, $04
- db $84, $20
- db $85, $03
- db $86, $03
- db $87, $04
- db $88, $04
- db $89, $04
- db $8a, $0a
- db $8b, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_81, 12
+ frame SPRITE_ANIM_FRAME_IDX_82, 1
+ frame SPRITE_ANIM_FRAME_IDX_83, 1
+ frame SPRITE_ANIM_FRAME_IDX_82, 4
+ frame SPRITE_ANIM_FRAME_IDX_81, 12
+ frame SPRITE_ANIM_FRAME_IDX_82, 12
+ frame SPRITE_ANIM_FRAME_IDX_83, 4
+ frame SPRITE_ANIM_FRAME_IDX_84, 32
+ frame SPRITE_ANIM_FRAME_IDX_85, 3
+ frame SPRITE_ANIM_FRAME_IDX_86, 3
+ frame SPRITE_ANIM_FRAME_IDX_87, 4
+ frame SPRITE_ANIM_FRAME_IDX_88, 4
+ frame SPRITE_ANIM_FRAME_IDX_89, 4
+ frame SPRITE_ANIM_FRAME_IDX_8A, 10
+ frame SPRITE_ANIM_FRAME_IDX_8B, 7
+ endanim
.Frameset_0b:
- db $23, $03
- db $23, $83
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_23, 3
+ frame SPRITE_ANIM_FRAME_IDX_23, 3, OAM_Y_FLIP
+ dorestart
.Frameset_0c:
- db $24, $02
- db $25, $02
- db $26, $02
- db $25, $02
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_24, 2
+ frame SPRITE_ANIM_FRAME_IDX_25, 2
+ frame SPRITE_ANIM_FRAME_IDX_26, 2
+ frame SPRITE_ANIM_FRAME_IDX_25, 2
+ dorestart
.Frameset_0d:
- db $27, $07
- db $28, $07
- db $27, $87
- db $28, $47
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_27, 7
+ frame SPRITE_ANIM_FRAME_IDX_28, 7
+ frame SPRITE_ANIM_FRAME_IDX_27, 7, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_28, 7, OAM_X_FLIP
+ dorestart
.Frameset_0e:
- db $29, $07
- db $2a, $07
- db $29, $07
- db $2b, $07
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ frame SPRITE_ANIM_FRAME_IDX_2A, 7
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ frame SPRITE_ANIM_FRAME_IDX_2B, 7
+ dorestart
.Frameset_0f:
- db $29, $07
- db $2c, $07
- db $2d, $07
- db $2c, $07
- db $29, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ frame SPRITE_ANIM_FRAME_IDX_2C, 7
+ frame SPRITE_ANIM_FRAME_IDX_2D, 7
+ frame SPRITE_ANIM_FRAME_IDX_2C, 7
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ endanim
.Frameset_10:
- db $2e, $14
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_2E, 20
+ endanim
.Frameset_12:
- db $2f, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_2F, 32
+ endanim
.Frameset_13:
- db $30, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_30, 32
+ endanim
.Frameset_14:
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ dorestart
.Frameset_15:
- db $32, $04
- db $33, $04
- db $34, $04
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_32, 4
+ frame SPRITE_ANIM_FRAME_IDX_33, 4
+ frame SPRITE_ANIM_FRAME_IDX_34, 4
+ delanim
.Frameset_16:
- db $35, $03
- db $36, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_35, 3
+ frame SPRITE_ANIM_FRAME_IDX_36, 3
+ dorestart
.Frameset_17:
- db $37, $07
- db $38, $07
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_37, 7
+ frame SPRITE_ANIM_FRAME_IDX_38, 7
+ dorestart
.Frameset_18:
- db $39, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_39, 32
+ endanim
.Frameset_19:
- db $3b, $02
- db $3a, $02
- db $3b, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_3B, 2
+ frame SPRITE_ANIM_FRAME_IDX_3A, 2
+ frame SPRITE_ANIM_FRAME_IDX_3B, 2
+ endanim
.Frameset_1a:
- db $3c, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_3C, 32
+ endanim
.Frameset_1b:
- db $41, $08
- db $42, $08
- db $41, $08
- db $42, $48
- db -2
- db $43, $08
- db $44, $08
- db -2
- db $45, $08
- db $46, $08
- db -2
- db $47, $08
- db $48, $08
- db -2
- db $49, $01
- db $49, $41
- db $49, $c1
- db $49, $81
- db -2
- db $4a, $20
- db -1
- db $4b, $20
- db -1
- db $4c, $20
- db -1
- db $4d, $20
- db -1
- db $4e, $03
- db -3, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_41, 8
+ frame SPRITE_ANIM_FRAME_IDX_42, 8
+ frame SPRITE_ANIM_FRAME_IDX_41, 8
+ frame SPRITE_ANIM_FRAME_IDX_42, 8, OAM_X_FLIP
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_43, 8
+ frame SPRITE_ANIM_FRAME_IDX_44, 8
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_45, 8
+ frame SPRITE_ANIM_FRAME_IDX_46, 8
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_47, 8
+ frame SPRITE_ANIM_FRAME_IDX_48, 8
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_49, 1
+ frame SPRITE_ANIM_FRAME_IDX_49, 1, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_49, 1, OAM_X_FLIP, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_49, 1, OAM_Y_FLIP
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4A, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4B, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4C, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4D, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4E, 3
+ dorepeat 3
+ dorestart
.Frameset_1c:
- db -3, $20
- db -1
+ dorepeat 32
+ endanim
.Frameset_1d:
- db $4f, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_4F, 32
+ endanim
.Frameset_1e:
- db $50, $02
- db $51, $10
- db -3, $01
- db $52, $01
- db -3, $01
- db $53, $01
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_50, 2
+ frame SPRITE_ANIM_FRAME_IDX_51, 16
+ dorepeat 1
+ frame SPRITE_ANIM_FRAME_IDX_52, 1
+ dorepeat 1
+ frame SPRITE_ANIM_FRAME_IDX_53, 1
+ delanim
.Frameset_1f:
- db $54, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_54, 32
+ endanim
.Frameset_20:
- db $55, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32
+ endanim
.Frameset_21:
- db $55, $60
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32, OAM_X_FLIP
+ endanim
.Frameset_22:
- db $55, $a0
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32, OAM_Y_FLIP
+ endanim
.Frameset_23:
- db $55, $e0
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32, OAM_X_FLIP, OAM_Y_FLIP
+ endanim
.Frameset_24:
- db $56, $0a
- db $57, $09
- db $58, $0a
- db $59, $0a
- db $58, $09
- db $5a, $0a
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_56, 10
+ frame SPRITE_ANIM_FRAME_IDX_57, 9
+ frame SPRITE_ANIM_FRAME_IDX_58, 10
+ frame SPRITE_ANIM_FRAME_IDX_59, 10
+ frame SPRITE_ANIM_FRAME_IDX_58, 9
+ frame SPRITE_ANIM_FRAME_IDX_5A, 10
+ dorestart
.Frameset_25:
- db $50, $02
- db $5b, $02
- db $50, $02
- db $5b, $42
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_50, 2
+ frame SPRITE_ANIM_FRAME_IDX_5B, 2
+ frame SPRITE_ANIM_FRAME_IDX_50, 2
+ frame SPRITE_ANIM_FRAME_IDX_5B, 2, OAM_X_FLIP
+ dorestart
.Frameset_26:
- db $5c, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5C, 2
+ endanim
.Frameset_27:
- db $5d, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5D, 2
+ endanim
.Frameset_28:
- db $5e, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5E, 2
+ endanim
.Frameset_29:
- db $5f, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5F, 2
+ endanim
.Frameset_2a:
- db $60, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_60, 2
+ endanim
.Frameset_2b:
- db $61, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_61, 2
+ endanim
.Frameset_2c:
- db $62, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_62, 2
+ endanim
.Frameset_2f:
- db $32, $03
- db $33, $03
- db $34, $03
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_32, 3
+ frame SPRITE_ANIM_FRAME_IDX_33, 3
+ frame SPRITE_ANIM_FRAME_IDX_34, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ endanim
.Frameset_30:
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $32, $03
- db $33, $03
- db $34, $03
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_32, 3
+ frame SPRITE_ANIM_FRAME_IDX_33, 3
+ frame SPRITE_ANIM_FRAME_IDX_34, 3
+ delanim
.Frameset_31:
- db $67, $03
- db $68, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_67, 3
+ frame SPRITE_ANIM_FRAME_IDX_68, 3
+ dorestart
.Frameset_32:
- db $6c, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_6C, 3
+ endanim
.Frameset_33:
- db $6d, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_6D, 3
+ endanim
.Frameset_34:
- db $69, $02
- db $6a, $02
- db $6b, $02
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_69, 2
+ frame SPRITE_ANIM_FRAME_IDX_6A, 2
+ frame SPRITE_ANIM_FRAME_IDX_6B, 2
+ delanim
.Frameset_35:
- db $6e, $03
- db $6f, $03
- db $70, $03
- db $71, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_6E, 3
+ frame SPRITE_ANIM_FRAME_IDX_6F, 3
+ frame SPRITE_ANIM_FRAME_IDX_70, 3
+ frame SPRITE_ANIM_FRAME_IDX_71, 3
+ dorestart
.Frameset_36:
- db $71, $03
- db $6e, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_71, 3
+ frame SPRITE_ANIM_FRAME_IDX_6E, 7
+ endanim
.Frameset_37:
- db $72, $20
- db $73, $07
- db $74, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_72, 32
+ frame SPRITE_ANIM_FRAME_IDX_73, 7
+ frame SPRITE_ANIM_FRAME_IDX_74, 7
+ endanim
.Frameset_38:
- db $75, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_75, 3
+ endanim
.Frameset_39:
- db $76, $03
- db $77, $03
- db $78, $07
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3
+ frame SPRITE_ANIM_FRAME_IDX_77, 3
+ frame SPRITE_ANIM_FRAME_IDX_78, 7
+ delanim
.Frameset_3a:
- db $76, $43
- db $77, $43
- db $78, $47
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_77, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_78, 7, OAM_X_FLIP
+ delanim
.Frameset_3b:
- db $76, $83
- db $77, $83
- db $78, $87
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_77, 3, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_78, 7, OAM_Y_FLIP
+ delanim
.Frameset_3c:
- db $76, $c3
- db $77, $c3
- db $78, $c7
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3, OAM_X_FLIP, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_77, 3, OAM_X_FLIP, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_78, 7, OAM_X_FLIP, OAM_Y_FLIP
+ delanim
.Frameset_3d:
- db $79, $03
- db $7a, $03
- db $7b, $03
- db $7c, $07
- db $7d, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_79, 3
+ frame SPRITE_ANIM_FRAME_IDX_7A, 3
+ frame SPRITE_ANIM_FRAME_IDX_7B, 3
+ frame SPRITE_ANIM_FRAME_IDX_7C, 7
+ frame SPRITE_ANIM_FRAME_IDX_7D, 7
+ endanim
.Frameset_3e:
- db $7e, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_7E, 3
+ endanim
.Frameset_3f:
- db -3, $00
- db -1
+ dorepeat 0
+ endanim
.Frameset_40:
- db $7f, $08
- db $80, $08
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_7F, 8
+ frame SPRITE_ANIM_FRAME_IDX_80, 8
+ endanim
.Frameset_41:
- db $7f, $48
- db $80, $48
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_7F, 8, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_80, 8, OAM_X_FLIP
+ endanim
; 8d94d
SpriteAnimOAMData: ; 8d94d
diff --git a/engine/anim_hp_bar.asm b/engine/anim_hp_bar.asm
index c8a543ba1..6272ff7ea 100755
--- a/engine/anim_hp_bar.asm
+++ b/engine/anim_hp_bar.asm
@@ -41,10 +41,10 @@ _AnimateHPBar: ; d627
; d65f
.IsMaximumMoreThan48Pixels: ; d65f
- ld a, [Buffer2]
+ ld a, [wCurHPAnimMaxHP + 1]
and a
jr nz, .player
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
cp 6 * 8
jr nc, .player
and a
@@ -56,11 +56,8 @@ _AnimateHPBar: ; d627
; d670
.ComputePixels: ; d670
-; Buffer1-2: Max HP
-; Buffer3-4: Old HP
-; Buffer5-6: New HP
push hl
- ld hl, Buffer1
+ ld hl, wCurHPAnimMaxHP
ld a, [hli]
ld e, a
ld a, [hli]
@@ -74,20 +71,20 @@ _AnimateHPBar: ; d627
ld a, e
ld [wCurHPBarPixels], a
- ld a, [Buffer5]
+ ld a, [wCurHPAnimNewHP]
ld c, a
- ld a, [Buffer6]
+ ld a, [wCurHPAnimNewHP + 1]
ld b, a
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
ld e, a
- ld a, [Buffer2]
+ ld a, [wCurHPAnimMaxHP + 1]
ld d, a
call ComputeHPBarPixels
ld a, e
ld [wNewHPBarPixels], a
push hl
- ld hl, Buffer3
+ ld hl, wCurHPAnimOldHP
ld a, [hli]
ld c, a
ld a, [hli]
@@ -104,18 +101,18 @@ _AnimateHPBar: ; d627
sbc b
ld d, a
jr c, .negative
- ld a, [Buffer3]
- ld [wd1f5], a
- ld a, [Buffer5]
- ld [wd1f6], a
+ ld a, [wCurHPAnimOldHP]
+ ld [wCurHPAnimLowHP], a
+ ld a, [wCurHPAnimNewHP]
+ ld [wCurHPAnimHighHP], a
ld bc, 1
jr .got_direction
.negative
- ld a, [Buffer3]
- ld [wd1f6], a
- ld a, [Buffer5]
- ld [wd1f5], a
+ ld a, [wCurHPAnimOldHP]
+ ld [wCurHPAnimHighHP], a
+ ld a, [wCurHPAnimNewHP]
+ ld [wCurHPAnimLowHP], a
ld a, e
xor $ff
inc a
@@ -126,9 +123,9 @@ _AnimateHPBar: ; d627
ld bc, -1
.got_direction
ld a, d
- ld [wd1f3], a
+ ld [wCurHPAnimDeltaHP], a
ld a, e
- ld [wd1f4], a
+ ld [wCurHPAnimDeltaHP + 1], a
ret
; d6e2
@@ -151,7 +148,7 @@ ShortAnim_UpdateVariables: ; d6e2
LongAnim_UpdateVariables: ; d6f5
.loop
- ld hl, Buffer3
+ ld hl, wCurHPAnimOldHP
ld a, [hli]
ld e, a
ld a, [hli]
@@ -171,13 +168,13 @@ LongAnim_UpdateVariables: ; d6f5
ld h, d
add hl, bc
ld a, l
- ld [Buffer3], a
+ ld [wCurHPAnimOldHP], a
ld a, h
- ld [Buffer4], a
+ ld [wCurHPAnimOldHP + 1], a
push hl
push de
push bc
- ld hl, Buffer1
+ ld hl, wCurHPAnimMaxHP
ld a, [hli]
ld e, a
ld a, [hli]
@@ -222,13 +219,13 @@ ShortHPBarAnim_UpdateTiles: ; d730
LongHPBarAnim_UpdateTiles: ; d749
call HPBarAnim_UpdateHPRemaining
- ld a, [Buffer3]
+ ld a, [wCurHPAnimOldHP]
ld c, a
- ld a, [Buffer4]
+ ld a, [wCurHPAnimOldHP + 1]
ld b, a
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
ld e, a
- ld a, [Buffer2]
+ ld a, [wCurHPAnimMaxHP + 1]
ld d, a
call ComputeHPBarPixels
ld c, e
@@ -273,14 +270,13 @@ HPBarAnim_UpdateHPRemaining: ; d784
push hl
add hl, de
ld a, " "
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hld], a
dec hl
- ld a, [Buffer3]
+ ld a, [wCurHPAnimOldHP]
ld [StringBuffer2 + 1], a
- ld a, [Buffer4]
+ ld a, [wCurHPAnimOldHP + 1]
ld [StringBuffer2], a
ld de, StringBuffer2
lb bc, 2, 3
@@ -293,9 +289,9 @@ HPBarAnim_PaletteUpdate: ; d7b4
ld a, [hCGB]
and a
ret z
- ld hl, wd1f0
+ ld hl, wCurHPAnimPal
call SetHPPal
- ld a, [wd1f0]
+ ld a, [wCurHPAnimPal]
ld c, a
callba ApplyHPBarPals
ret
@@ -376,7 +372,7 @@ HPBarAnim_BGMapUpdate: ; d7c9
; d839
ShortHPBar_CalcPixelFrame: ; d839
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
ld c, a
ld b, 0
ld hl, 0
@@ -412,24 +408,24 @@ ShortHPBar_CalcPixelFrame: ; d839
jr c, .no_carry
inc b
.no_carry
- ld a, [wd1f5]
+ ld a, [wCurHPAnimLowHP]
cp b
jr nc, .finish
- ld a, [wd1f6]
+ ld a, [wCurHPAnimHighHP]
cp b
jr c, .finish
ld a, b
.finish
- ld [Buffer3], a
+ ld [wCurHPAnimOldHP], a
ret
.return_zero
xor a
- ld [Buffer3], a
+ ld [wCurHPAnimOldHP], a
ret
.return_max
- ld a, [Buffer1]
- ld [Buffer3], a
+ ld a, [wCurHPAnimMaxHP]
+ ld [wCurHPAnimOldHP], a
ret
; d88c
diff --git a/engine/battle_start.asm b/engine/battle_start.asm
index d2ead2757..627519daa 100644
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -39,9 +39,9 @@ Predef_StartBattle: ; 8c20f
call DmgToCgbBGPals
call DelayFrame
xor a
- ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLCDCPointer], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
ld [hSCY], a
ld a, $1
@@ -56,7 +56,7 @@ Predef_StartBattle: ; 8c20f
ld a, [wLinkMode]
cp LINK_MOBILE
jr z, .mobile
- callba Function6454
+ callba ReanchorBGMap_NoOAMUpdate
call UpdateSprites
call DelayFrame
call .NonMobile_LoadPokeballTiles
@@ -84,7 +84,7 @@ Predef_StartBattle: ; 8c20f
.NonMobile_LoadPokeballTiles: ; 8c2a0
call LoadTrainerBattlePokeballTiles
hlbgcoord 0, 0
- call Function8c2cf
+ call ConvertTrainerBattlePokeballTilesTo2bpp
ret
; 8c2aa
@@ -113,7 +113,7 @@ LoadTrainerBattlePokeballTiles:
ret
; 8c2cf
-Function8c2cf: ; 8c2cf
+ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf
ld a, [rSVBK]
push af
ld a, $6
@@ -132,7 +132,7 @@ Function8c2cf: ; 8c2cf
pop hl
ld de, wDecompressScratch
- ld b, BANK(Function8c2cf) ; BANK(@)
+ ld b, BANK(ConvertTrainerBattlePokeballTilesTo2bpp) ; BANK(@)
ld c, $28
call Request2bpp
pop af
@@ -302,12 +302,12 @@ StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
call StartTrainerBattle_NextScene
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $90
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
xor a
ld [wcf64], a
ld [wcf65], a
diff --git a/engine/billspc.asm b/engine/billspc.asm
index 5e9e7393b..b9b51f850 100755
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -64,7 +64,7 @@ _DepositPKMN: ; e2391 (38:6391)
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
call WaitBGMap
call BillsPC_UpdateSelectionCursor
@@ -120,7 +120,7 @@ _DepositPKMN: ; e2391 (38:6391)
call ClearSprites
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ld de, PCString_WhatsUp
call BillsPC_PlaceString
@@ -142,9 +142,8 @@ _DepositPKMN: ; e2391 (38:6391)
ld e, a
ld d, 0
ld hl, BillsPCDepositJumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -182,7 +181,7 @@ BillsPCDepositFuncStats: ; e24c8 (38:64c8)
call PCMonInfo
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ret
@@ -334,7 +333,7 @@ _WithdrawPKMN: ; e2583 (38:6583)
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
call WaitBGMap
call BillsPC_UpdateSelectionCursor
@@ -389,7 +388,7 @@ _WithdrawPKMN: ; e2583 (38:6583)
call ClearSprites
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ld de, PCString_WhatsUp
call BillsPC_PlaceString
@@ -411,9 +410,8 @@ BillsPC_Withdraw: ; e2675 (38:6675)
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -449,7 +447,7 @@ endr
call PCMonInfo
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ret
@@ -586,7 +584,7 @@ _MovePKMNWithoutMail: ; e2759
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
call WaitBGMap
call BillsPC_UpdateSelectionCursor
@@ -652,7 +650,7 @@ _MovePKMNWithoutMail: ; e2759
call ClearSprites
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ld de, PCString_WhatsUp
call BillsPC_PlaceString
@@ -675,9 +673,8 @@ _MovePKMNWithoutMail: ; e2759
ld e, a
ld d, 0
ld hl, .Jumptable2
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -711,7 +708,7 @@ endr
call PCMonInfo
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ret
; e28bd
@@ -1162,10 +1159,10 @@ BillsPC_LoadMonStats: ; e2b6d (38:6b6d)
add [hl]
ld e, a
ld d, $0
- ld hl, wBillsPCPokemonList + 1
-rept 3
+ ld hl, wBillsPCPokemonList + 1 ; box number
+ add hl, de
+ add hl, de
add hl, de
-endr
ld a, [hl]
and a
jr z, .party
@@ -1277,9 +1274,9 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c)
ld e, a
ld d, 0
ld hl, wBillsPCPokemonList
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld e, l
ld d, h
hlcoord 9, 4
@@ -1293,9 +1290,9 @@ endr
ld de, 2 * SCREEN_WIDTH
add hl, de
pop de
-rept 3
inc de
-endr
+ inc de
+ inc de
pop af
dec a
jr nz, .loop
@@ -1496,9 +1493,9 @@ BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def)
ld e, a
ld d, $0
ld hl, wBillsPCPokemonList
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hl]
ret
@@ -2010,9 +2007,8 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
.moving_to_box
ld hl, .Jumptable
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2024,7 +2020,7 @@ endr
.dw_return ; e322a
pop af
ld e, a
- callba Function14ad5
+ callba MovePkmnWOMail_InsertMon_SaveGame
ret
; e3233
@@ -2059,10 +2055,10 @@ endr
.PartyToBox: ; e3267
call .CopyFromParty
ld a, $1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
callba SaveGameData
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call .CopyToBox
ret
; e327d
@@ -2143,7 +2139,7 @@ endr
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
- callba Function51322
+ callba InsertPokemonIntoBox
ret
; e3316
@@ -2172,7 +2168,7 @@ endr
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
- callba Function5138b
+ callba InsertPokemonIntoParty
ret
; e3357
@@ -2215,9 +2211,9 @@ GetBoxPointer: ; e3396 (38:7396)
ld c, b
ld b, 0
ld hl, .boxes
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld b, a
ld a, [hli]
@@ -2256,9 +2252,8 @@ BillsPC_ApplyPalettes: ; e33d0 (38:73d0)
BillsPC_Jumptable: ; e33df (38:73df)
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2434,9 +2429,9 @@ GetBoxCount: ; e366c (38:766c)
ld c, a
ld b, 0
ld hl, .boxbanks
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld b, a
call GetSRAMBank
diff --git a/engine/breeding/egg.asm b/engine/breeding/egg.asm
index b6f41743e..326faaa6c 100755
--- a/engine/breeding/egg.asm
+++ b/engine/breeding/egg.asm
@@ -8,7 +8,7 @@ CheckBreedmonCompatibility: ; 16e1d
ld [TempMonDVs], a
ld a, [wBreedMon1DVs + 1]
ld [TempMonDVs + 1], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
predef GetGender
jr c, .genderless
@@ -88,7 +88,7 @@ CheckBreedmonCompatibility: ; 16e1d
.CheckDVs: ; 16ebc (5:6ebc)
; If Defense DVs match and the lower 3 bits of the Special DVs match,
-; maximize the chances of spawning an egg regardless of species.
+; avoid breeding
ld a, [wBreedMon1DVs]
and %1111
ld b, a
@@ -232,7 +232,7 @@ HatchEggs: ; 16f70 (5:6f70)
push de
callba SetEggMonCaughtData
- callba MobileFn_10608d
+ callba TrainerRankings_EggsHatched
ld a, [CurPartyMon]
ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, PARTYMON_STRUCT_LENGTH
@@ -442,9 +442,8 @@ GLOBAL EggMoves
ld c, a
ld b, 0
ld hl, EggMovePointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(EggMovePointers)
call GetFarHalfword
.loop
@@ -477,9 +476,8 @@ endr
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
.loop3
@@ -590,7 +588,7 @@ GetHeritableMoves: ; 17197
ld [TempMonDVs], a
ld a, [wBreedMon2DVs + 1]
ld [TempMonDVs + 1], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
predef GetGender
jr c, .inherit_mon2_moves
@@ -606,7 +604,7 @@ GetHeritableMoves: ; 17197
ld [TempMonDVs], a
ld a, [wBreedMon1DVs + 1]
ld [TempMonDVs + 1], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
predef GetGender
jr c, .inherit_mon1_moves
@@ -788,7 +786,7 @@ EggHatch_AnimationSequence: ; 1728f (5:728f)
Hatch_LoadFrontpicPal: ; 17363 (5:7363)
ld [PlayerHPPal], a
- ld b, SCGB_0B
+ ld b, SCGB_EVOLUTION
ld c, $0
jp GetSGBLayout
@@ -849,7 +847,7 @@ Hatch_InitShellFragments: ; 173b3 (5:73b3)
add [hl]
ld [hl], a
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], d
diff --git a/engine/buy_sell_toss.asm b/engine/buy_sell_toss.asm
index 7f2ad2727..bd18cc83a 100755
--- a/engine/buy_sell_toss.asm
+++ b/engine/buy_sell_toss.asm
@@ -48,7 +48,7 @@ Toss_Sell_Loop: ; 24ff9
; 2500e
BuySellToss_InterpretJoypad: ; 2500e
- call Function354b ; get joypad
+ call JoyTextDelay_ForcehJoyDown ; get joypad
bit B_BUTTON_F, c
jr nz, .b
bit A_BUTTON_F, c
diff --git a/engine/card_flip.asm b/engine/card_flip.asm
index 2c334fc25..0479e8248 100755
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -71,9 +71,8 @@ _CardFlip: ; e00ee (38:40ee)
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -276,9 +275,8 @@ endr
ld e, a
ld d, 0
ld hl, wDeck
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wCardFlipWhichCard]
ld e, a
add hl, de
@@ -442,9 +440,8 @@ CardFlip_DisplayCardFaceUp: ; e03ec
ld e, a
ld d, 0
ld hl, .Deck
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
@@ -675,9 +672,8 @@ CardFlip_BlankDiscardedCardSlot: ; e0534
and a
jr nz, .discarded2
hlcoord 13, 3
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -686,9 +682,8 @@ endr
.discarded2
hlcoord 13, 3
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -703,9 +698,8 @@ endr
and a
jr nz, .discarded1
hlcoord 13, 4
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3b
ld bc, SCREEN_WIDTH
add hl, bc
@@ -714,9 +708,8 @@ endr
.discarded1
hlcoord 13, 4
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -731,9 +724,8 @@ endr
and a
jr nz, .discarded4
hlcoord 13, 6
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -742,9 +734,8 @@ endr
.discarded4
hlcoord 13, 6
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -759,9 +750,8 @@ endr
and a
jr nz, .discarded3
hlcoord 13, 7
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@@ -770,9 +760,8 @@ endr
.discarded3
hlcoord 13, 7
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -787,9 +776,8 @@ endr
and a
jr nz, .discarded6
hlcoord 13, 9
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -798,9 +786,8 @@ endr
.discarded6
hlcoord 13, 9
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -815,9 +802,8 @@ endr
and a
jr nz, .discarded5
hlcoord 13, 10
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@@ -826,9 +812,8 @@ endr
.discarded5
hlcoord 13, 10
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -1296,9 +1281,8 @@ ChooseCard_HandleJoypad: ; e089c
ld [hl], a
cp $3
jr c, .left_to_number_gp
-rept 2
dec [hl]
-endr
+ dec [hl]
jp .play_sound
.left_to_number_gp
@@ -1326,9 +1310,8 @@ endr
ld [hl], a
cp $4
ret nc
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .play_sound
.d_up ; e090a
@@ -1357,9 +1340,8 @@ endr
ld [hl], a
cp $3
jr c, .up_to_mon_group
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .play_sound
.up_to_mon_group
@@ -1387,9 +1369,8 @@ endr
ld [hl], a
cp $6
ret nc
-rept 2
inc [hl]
-endr
+ inc [hl]
.play_sound ; e0959
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
@@ -1408,9 +1389,8 @@ CardFlip_UpdateCursorOAM: ; e0960
.skip
call CollapseCursorPosition
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, .OAMData
add hl, de
ld a, [hli]
diff --git a/engine/clock_reset.asm b/engine/clock_reset.asm
index 546cc8c13..4e6f588e9 100755
--- a/engine/clock_reset.asm
+++ b/engine/clock_reset.asm
@@ -121,7 +121,7 @@ RestartClock: ; 20021 (8:4021)
; 0x200ba
.joy_loop
- call Function354b
+ call JoyTextDelay_ForcehJoyDown
ld c, a
push af
call .PrintTime
diff --git a/engine/color.asm b/engine/color.asm
index faf102867..3bc431d22 100644
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -79,6 +79,7 @@ CheckContestMon:
ret
Function8aa4:
+; XXX
push de
push bc
ld hl, PalPacket_9ce6
@@ -96,9 +97,9 @@ Function8aa4:
ld a, d
ld [wSGBPals + 6], a
ld hl, wSGBPals
- call Function9809
+ call PushSGBPals_
ld hl, BlkPacket_9a86
- call Function9809
+ call PushSGBPals_
ret
InitPartyMenuPalettes:
@@ -138,6 +139,7 @@ Function8b07:
; Unreferenced
call CheckCGB
ret z
+; CGB only
ld hl, .BGPal
ld de, UnknBGPals
ld bc, 1 palettes
@@ -175,16 +177,17 @@ Function8b3f:
and a
ret z
ld hl, BlkPacket_9a86
- jp Function9809
+ jp PushSGBPals_
Function8b4d:
+; XXX
call CheckCGB
jr nz, .cgb
ld a, [hSGB]
and a
ret z
ld hl, PalPacket_9c26
- jp Function9809
+ jp PushSGBPals_
.cgb
ld de, UnknOBPals
@@ -193,13 +196,14 @@ Function8b4d:
jp LoadHLPaletteIntoDE
Function8b67:
+; XXX
call CheckCGB
jr nz, .cgb
ld a, [hSGB]
and a
ret z
ld hl, PalPacket_9c36
- jp Function9809
+ jp PushSGBPals_
.cgb
ld de, UnknOBPals
@@ -208,8 +212,9 @@ Function8b67:
jp LoadHLPaletteIntoDE
Function8b81:
+; XXX
call CheckCGB
- jr nz, .asm_8bb2
+ jr nz, .cgb
ld a, [hSGB]
and a
ret z
@@ -230,45 +235,45 @@ Function8b81:
ld a, [hl]
ld [wSGBPals + 6], a
ld hl, wSGBPals
- jp Function9809
+ jp PushSGBPals_
-.asm_8bb2
+.cgb
ld de, UnknOBPals
ld a, c
call GetMonPalettePointer_
call LoadPalette_White_Col1_Col2_Black
ret
-Function8bbd:
+LoadTrainerClassPaletteAsNthBGPal:
ld a, [TrainerClass]
call GetTrainerPalettePointer
ld a, e
- jr asm_8bd7
+ jr got_palette_pointer_8bd7
-Function8bc6:
+LoadMonPaletteAsNthBGPal:
ld a, [CurPartySpecies]
call GetMonPalettePointer
ld a, e
bit 7, a
- jr z, .asm_8bd7
+ jr z, got_palette_pointer_8bd7
and $7f
-rept 4
inc hl
-endr
-.asm_8bd7
+ inc hl
+ inc hl
+ inc hl
-asm_8bd7
+got_palette_pointer_8bd7
push hl
ld hl, UnknBGPals
- ld de, $8
-.asm_8bde
+ ld de, 1 palettes
+.loop
and a
- jr z, .asm_8be5
+ jr z, .got_addr
add hl, de
dec a
- jr .asm_8bde
+ jr .loop
-.asm_8be5
+.got_addr
ld e, l
ld d, h
pop hl
@@ -276,30 +281,31 @@ asm_8bd7
ret
Function8bec:
+; XXX
ld a, [hCGB]
and a
- jr nz, .asm_8bf7
+ jr nz, .cgb
ld hl, PlayerLightScreenCount
- jp Function9809
+ jp PushSGBPals_
-.asm_8bf7
- ld a, [EnemyLightScreenCount]
+.cgb
+ ld a, [EnemyLightScreenCount] ; col
ld c, a
- ld a, [EnemyReflectCount]
+ ld a, [EnemyReflectCount] ; row
hlcoord 0, 0, AttrMap
- ld de, $14
-.asm_8c04
+ ld de, SCREEN_WIDTH
+.loop
and a
- jr z, .asm_8c0b
+ jr z, .done
add hl, de
dec a
- jr .asm_8c04
+ jr .loop
-.asm_8c0b
+.done
ld b, $0
add hl, bc
lb bc, 6, 4
- ld a, [EnemySafeguardCount]
+ ld a, [EnemySafeguardCount] ; value
and $3
call FillBoxCGB
call LoadEDTile
@@ -401,16 +407,16 @@ LoadStatsScreenPals:
ld a, $1
ret
-Function8cb4:
+LoadMailPalettes:
ld l, e
ld h, 0
-rept 3
add hl, hl
-endr
- ld de, Palettes_8d05
+ add hl, hl
+ add hl, hl
+ ld de, .MailPals
add hl, de
call CheckCGB
- jr nz, .asm_8cf0
+ jr nz, .cgb
push hl
ld hl, PalPacket_9ce6
ld de, wSGBPals
@@ -428,12 +434,12 @@ endr
ld a, [hli]
ld [wSGBPals + 6], a
ld hl, wSGBPals
- call Function9809
+ call PushSGBPals_
ld hl, BlkPacket_9a86
- call Function9809
+ call PushSGBPals_
ret
-.asm_8cf0
+.cgb
ld de, UnknBGPals
ld bc, 1 palettes
ld a, $5
@@ -443,7 +449,7 @@ endr
call ApplyAttrMap
ret
-Palettes_8d05:
+.MailPals:
RGB 20, 31, 11
RGB 31, 19, 00
RGB 31, 10, 09
@@ -497,7 +503,8 @@ Palettes_8d05:
INCLUDE "predef/cgb.asm"
Function95f0:
- ld hl, Palette_9608
+; XXX
+ ld hl, .Palette
ld de, UnknBGPals
ld bc, 8
ld a, $5
@@ -507,7 +514,7 @@ Function95f0:
call ApplyAttrMap
ret
-Palette_9608:
+.Palette:
RGB 31, 31, 31
RGB 09, 31, 31
RGB 10, 12, 31
@@ -534,9 +541,9 @@ CopyPalettes:
GetPredefPal:
ld l, a
ld h, $0
-rept 3 ; multiply by 8
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld bc, Palettes_9df6
add hl, bc
ret
@@ -604,30 +611,36 @@ FillBoxCGB:
jr nz, .row
ret
-Function9673:
+ResetBGPals:
push af
push bc
push de
push hl
+
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
+
ld hl, UnknBGPals
ld c, 8
.loop
ld a, $ff
-rept 4
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
xor a
-rept 4
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
dec c
jr nz, .loop
+
pop af
ld [rSVBK], a
+
pop hl
pop de
pop bc
@@ -769,8 +782,8 @@ GetFrontpicPalettePointer:
GetTrainerPalettePointer:
ld l, a
ld h, 0
- add hl,hl
- add hl,hl
+ add hl, hl
+ add hl, hl
ld bc, TrainerPalettes
add hl, bc
ret
@@ -830,19 +843,20 @@ Palettes_979c:
RGB 00, 00, 00
Function97cc:
+; XXX
call CheckCGB
ret z
ld a, $90
ld [rOBPI], a
ld a, $1c
call GetPredefPal
- call Function97e5
+ call .PushPalette
ld a, $21
call GetPredefPal
- call Function97e5
+ call .PushPalette
ret
-Function97e5:
+.PushPalette:
ld c, 1 palettes
.loop
ld a, [hli]
@@ -854,9 +868,9 @@ Function97e5:
GetMonPalettePointer:
ld l, a
ld h, $0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld bc, PokemonPalettes
add hl, bc
ret
@@ -874,7 +888,7 @@ rept 4
endr
ret
-Function9809:
+PushSGBPals_:
ld a, [wcfbe]
push af
set 7, a
@@ -924,9 +938,10 @@ PushSGBPals:
jr nz, .loop
ret
-Function9853:
+InitSGBBorder:
call CheckCGB
ret nz
+; SGB/DMG only
di
ld a, [wcfbe]
push af
@@ -935,29 +950,30 @@ Function9853:
xor a
ld [rJOYP], a
ld [hSGB], a
- call Function994a
- jr nc, .asm_988a
+ call PushSGBBorderPalsAndWait
+ jr nc, .skip
ld a, $1
ld [hSGB], a
- call Function98eb
- call Function99b4
+ call _InitSGBBorderPals
+ call SGBBorder_PushBGPals
call SGBDelayCycles
- call Function993f
- call Function992c
+ call SGB_ClearVRAM
+ call PushSGBBorder
call SGBDelayCycles
- call Function993f
+ call SGB_ClearVRAM
ld hl, PalPacket_9d66
call PushSGBPals
-.asm_988a
+.skip
pop af
ld [wcfbe], a
ei
ret
-Function9890::
+InitCGBPals::
call CheckCGB
ret z
+; CGB only
ld a, $1
ld [rVBK], a
ld hl, VTiles0
@@ -1009,7 +1025,7 @@ Function9890::
jr nz, .loop
ret
-Function98eb:
+_InitSGBBorderPals:
ld hl, .PalPacketPointerTable
ld c, 9
.loop
@@ -1038,25 +1054,26 @@ Function98eb:
dw PalPacket_9de6
Function9911:
+; XXX
di
xor a
ld [rJOYP], a
ld hl, PalPacket_9d56
call PushSGBPals
- call Function992c
+ call PushSGBBorder
call SGBDelayCycles
- call Function993f
+ call SGB_ClearVRAM
ld hl, PalPacket_9d66
call PushSGBPals
ei
ret
-Function992c:
+PushSGBBorder:
call .LoadSGBBorderPointers
push de
- call Function9a24
+ call SGBBorder_YetMorePalPushing
pop hl
- call Function99d8
+ call SGBBorder_MorePalPushing
ret
.LoadSGBBorderPointers:
@@ -1064,21 +1081,21 @@ Function992c:
ld de, SGBBorderMap
ret
-Function993f:
+SGB_ClearVRAM:
ld hl, VTiles0
ld bc, $2000
xor a
call ByteFill
ret
-Function994a:
+PushSGBBorderPalsAndWait:
ld hl, PalPacket_9d26
call PushSGBPals
call SGBDelayCycles
ld a, [rJOYP]
and $3
cp $3
- jr nz, .asm_99a6
+ jr nz, .carry
ld a, $20
ld [rJOYP], a
ld a, [rJOYP]
@@ -1098,32 +1115,32 @@ endr
call SGBDelayCycles
ld a, $30
ld [rJOYP], a
-rept 3
ld a, [rJOYP]
-endr
+ ld a, [rJOYP]
+ ld a, [rJOYP]
call SGBDelayCycles
call SGBDelayCycles
ld a, [rJOYP]
and $3
cp $3
- jr nz, .asm_99a6
- call Function99ab
+ jr nz, .carry
+ call .FinalPush
and a
ret
-.asm_99a6
- call Function99ab
+.carry
+ call .FinalPush
scf
ret
-Function99ab:
+.FinalPush:
ld hl, PalPacket_9d16
call PushSGBPals
jp SGBDelayCycles
-Function99b4:
+SGBBorder_PushBGPals:
call DisableLCD
- ld a, $e4
+ ld a, %11100100
ld [rBGP], a
ld hl, Palettes_9df6
ld de, VTiles1
@@ -1138,7 +1155,7 @@ Function99b4:
ld [rBGP], a
ret
-Function99d8:
+SGBBorder_MorePalPushing:
call DisableLCD
ld a, $e4
ld [rBGP], a
@@ -1146,7 +1163,7 @@ Function99d8:
ld bc, 20 tiles
call CopyData
ld b, 18
-.asm_99ea
+.loop
push bc
ld bc, $c
call CopyData
@@ -1156,7 +1173,7 @@ Function99d8:
call CopyData
pop bc
dec b
- jr nz, .asm_99ea
+ jr nz, .loop
ld bc, $140
call CopyData
ld bc, Start
@@ -1172,13 +1189,13 @@ Function99d8:
ld [rBGP], a
ret
-Function9a24:
+SGBBorder_YetMorePalPushing:
call DisableLCD
ld a, %11100100
ld [rBGP], a
ld de, VTiles1
ld b, $80
-.asm_9a30
+.loop
push bc
ld bc, 1 tiles
call CopyData
@@ -1186,7 +1203,7 @@ Function9a24:
call ClearBytes
pop bc
dec b
- jr nz, .asm_9a30
+ jr nz, .loop
call DrawDefaultTiles
ld a, $e3
ld [rLCDC], a
@@ -1198,25 +1215,27 @@ Function9a24:
CopyData: ; 0x9a52
; copy bc bytes of data from hl to de
+.loop
ld a, [hli]
ld [de], a
inc de
dec bc
ld a, c
or b
- jr nz, CopyData
+ jr nz, .loop
ret
; 0x9a5b
ClearBytes: ; 0x9a5b
; clear bc bytes of data starting from de
+.loop
xor a
ld [de], a
inc de
dec bc
ld a, c
or b
- jr nz, ClearBytes
+ jr nz, .loop
ret
; 0x9a64
@@ -1729,34 +1748,34 @@ Palettes_9df6:
RGB 31, 31, 31
SGBBorderMap:
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
- db $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$54, $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54
- db $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54
- db $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54, $20,$54, $07,$14, $08,$14, $09,$14, $0a,$14, $0b,$14, $0c,$14, $0d,$14, $07,$14, $07,$14, $18,$14, $09,$14, $1a,$14, $1b,$14, $0d,$14, $0c,$14, $1c,$14, $29,$14, $07,$14, $20,$14, $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54
- db $31,$14, $32,$14, $07,$14, $07,$14, $32,$54, $36,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $27,$10, $32,$14, $07,$54, $07,$54, $32,$54, $31,$54
- db $05,$14, $06,$14, $07,$14, $07,$54, $06,$54, $1f,$10, $37,$10, $06,$14, $07,$14, $07,$54, $06,$54, $05,$54
- db $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $1f,$10, $37,$10, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54
- db $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $1f,$10, $37,$10, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54
- db $33,$14, $34,$14, $35,$14, $35,$54, $34,$54, $1f,$10, $37,$10, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
- db $02,$54, $01,$54, $07,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $01,$14, $02,$14
- db $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14
- db $22,$54, $21,$54, $20,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $20,$14, $21,$14, $22,$14
- db $32,$54, $31,$54, $30,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $30,$14, $31,$14, $32,$14
- db $06,$54, $05,$54, $04,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $04,$14, $05,$14, $06,$14
- db $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14
- db $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14
- db $34,$54, $33,$54, $07,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $33,$14, $34,$14
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
- db $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $1f,$10, $37,$10, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54
- db $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $1f,$10, $37,$10, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54
- db $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $1f,$10, $37,$10, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54
- db $31,$14, $32,$14, $07,$14, $07,$14, $32,$54, $1f,$10, $37,$10, $32,$14, $07,$54, $07,$54, $32,$54, $31,$54
- db $05,$14, $06,$14, $07,$14, $07,$54, $06,$54, $2e,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2d,$10, $06,$14, $07,$14, $07,$54, $06,$54, $05,$54
- db $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $39,$14, $0e,$14, $09,$14, $0f,$14, $28,$14, $07,$14, $19,$14, $0c,$14, $1c,$14, $29,$14, $2a,$14, $2b,$14, $2c,$14, $39,$14, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54
- db $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54
- db $33,$14, $34,$14, $35,$14, $35,$54, $34,$54, $24,$54, $07,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $20,$14, $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54, $20,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
+ db $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $54, $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54
+ db $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54
+ db $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54, $20, $54, $07, $14, $08, $14, $09, $14, $0a, $14, $0b, $14, $0c, $14, $0d, $14, $07, $14, $07, $14, $18, $14, $09, $14, $1a, $14, $1b, $14, $0d, $14, $0c, $14, $1c, $14, $29, $14, $07, $14, $20, $14, $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54
+ db $31, $14, $32, $14, $07, $14, $07, $14, $32, $54, $36, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $27, $10, $32, $14, $07, $54, $07, $54, $32, $54, $31, $54
+ db $05, $14, $06, $14, $07, $14, $07, $54, $06, $54, $1f, $10, $37, $10, $06, $14, $07, $14, $07, $54, $06, $54, $05, $54
+ db $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $1f, $10, $37, $10, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54
+ db $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $1f, $10, $37, $10, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54
+ db $33, $14, $34, $14, $35, $14, $35, $54, $34, $54, $1f, $10, $37, $10, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
+ db $02, $54, $01, $54, $07, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $01, $14, $02, $14
+ db $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14
+ db $22, $54, $21, $54, $20, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $20, $14, $21, $14, $22, $14
+ db $32, $54, $31, $54, $30, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $30, $14, $31, $14, $32, $14
+ db $06, $54, $05, $54, $04, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $04, $14, $05, $14, $06, $14
+ db $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14
+ db $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14
+ db $34, $54, $33, $54, $07, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $33, $14, $34, $14
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
+ db $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $1f, $10, $37, $10, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54
+ db $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $1f, $10, $37, $10, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54
+ db $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $1f, $10, $37, $10, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54
+ db $31, $14, $32, $14, $07, $14, $07, $14, $32, $54, $1f, $10, $37, $10, $32, $14, $07, $54, $07, $54, $32, $54, $31, $54
+ db $05, $14, $06, $14, $07, $14, $07, $54, $06, $54, $2e, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2d, $10, $06, $14, $07, $14, $07, $54, $06, $54, $05, $54
+ db $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $39, $14, $0e, $14, $09, $14, $0f, $14, $28, $14, $07, $14, $19, $14, $0c, $14, $1c, $14, $29, $14, $2a, $14, $2b, $14, $2c, $14, $39, $14, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54
+ db $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54
+ db $33, $14, $34, $14, $35, $14, $35, $54, $34, $54, $24, $54, $07, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $20, $14, $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54, $20, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
SGBBorderPalettes:
RGB 24, 06, 06
@@ -1941,9 +1960,9 @@ LoadMapPals:
ld a, [MapGroup]
ld l, a
ld h, 0
-rept 3
- add hl,hl
-endr
+ add hl, hl
+ add hl, hl
+ add hl, hl
ld de, RoofPals
add hl, de
ld a, [TimeOfDayPal]
@@ -2016,7 +2035,7 @@ INCLUDE "tilesets/ob.pal"
RoofPals:
INCLUDE "tilesets/roof.pal"
-Palettes_b641:
+DiplomaPalettes:
RGB 27, 31, 27
RGB 21, 21, 21
RGB 13, 13, 13
diff --git a/engine/credits.asm b/engine/credits.asm
index 9074b9c65..fad8a615e 100644
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -183,7 +183,7 @@ Credits:: ; 109847
call ByteFill
ld a, rSCX - $ff00
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call GetCreditsPalette
call SetPalettes
@@ -211,7 +211,7 @@ Credits:: ; 109847
.exit_credits
call ClearBGPalettes
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld [hBGMapAddress], a
pop af
ld [hVBlank], a
@@ -258,9 +258,8 @@ Credits_Jumptable: ; 109926
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -326,9 +325,8 @@ Credits_LYOverride: ; 109986 (42:5986)
cp $30
jr c, Credits_LYOverride
ld a, [wCreditsLYOverride]
-rept 2
dec a
-endr
+ dec a
ld [wCreditsLYOverride], a
ld hl, LYOverrides + $1f
call .Fill
@@ -398,9 +396,8 @@ ParseCredits: ; 1099aa
ld e, a
ld d, 0
ld hl, CreditsStrings
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@@ -741,9 +738,8 @@ Credits_LoadBorderGFX: ; 109bca (42:5bca)
ld [hl], a
ld a, [wCreditsBorderMon]
and 3
-rept 2
add a
-endr
+ add a
add e
add a
ld e, a
diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm
index 2be7a375e..29bb0934f 100755
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -13,7 +13,7 @@ Copyright_GFPresents: ; e4579
ld a, $90
ld [hWY], a
call WaitBGMap
- ld b, SCGB_19
+ ld b, SCGB_GAMEFREAK_LOGO
call GetSGBLayout
call SetPalettes
ld c, 10
@@ -82,13 +82,13 @@ Copyright_GFPresents: ; e4579
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO
call _InitSpriteAnimStruct
- ld hl, $7
+ ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $a0
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $60
- ld hl, $d
+ ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld [hl], $30
xor a
@@ -101,7 +101,7 @@ Copyright_GFPresents: ; e4579
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
- ld de, $e4e4
+ lb de, %11100100, %11100100
call DmgToCgbObjPals
ret
; e465e
@@ -120,9 +120,8 @@ PlaceGameFreakPresents: ; e4670
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -213,14 +212,13 @@ PlaceGameFreakPresents_3: ; e46dd
GameFreakLogoJumper: ; e46ed (39:46ed)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
ld hl, GameFreakLogoScenes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -234,7 +232,7 @@ GameFreakLogoScenes: ; e46fd (39:46fd)
dw GameFreakLogoScene5
GameFreakLogoScene1: ; e4707 (39:4707)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
@@ -275,7 +273,7 @@ GameFreakLogoScene2: ; e470d (39:470d)
ret
.asm_e4747
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0D
@@ -295,7 +293,7 @@ GameFreakLogoScene3: ; e4759 (39:4759)
ret
.asm_e4764
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0D
@@ -317,9 +315,8 @@ GameFreakLogoScene4: ; e4776 (39:4776)
ld e, a
ld d, $0
ld hl, GameFreakLogoPalettes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [rSVBK]
push af
ld a, $5
@@ -335,7 +332,7 @@ endr
ret
.asm_e47a3
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
call PlaceGameFreakPresents_AdvanceIndex
@@ -436,9 +433,8 @@ IntroSceneJumper: ; e490f
ld e, a
ld d, 0
ld hl, IntroScenes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -625,7 +621,7 @@ IntroScene5: ; e4a7a (39:4a7a)
call ClearTileMap
xor a
ld [hBGMapMode], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap005
@@ -819,7 +815,7 @@ IntroScene8: ; e4bd3 (39:4bd3)
IntroScene9: ; e4c04 (39:4c04)
; Set up the next scene (same bg).
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call ClearSprites
hlcoord 0, 0, AttrMap
; first 12 rows have palette 1
@@ -893,7 +889,7 @@ IntroScene11: ; e4c86 (39:4c86)
call ClearTileMap
xor a
ld [hBGMapMode], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap007
@@ -986,9 +982,8 @@ IntroScene12: ; e4cfa (39:4cfa)
ret z
cp c
jr z, .playsound
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.playsound
ld a, [hli]
@@ -1660,16 +1655,15 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
ret
CrystalIntro_UnownFade: ; e5223 (39:5223)
-rept 3
add a
-endr
+ add a
+ add a
ld e, a
ld d, $0
ld hl, BGPals
add hl, de
-rept 2
inc hl
-endr
+ inc hl
ld a, [wcf65]
and $3f
cp $1f
@@ -1698,9 +1692,8 @@ endr
push hl
ld hl, .BWFade
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@@ -1712,9 +1705,8 @@ endr
push hl
ld hl, .BlackLBlueFade
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@@ -1726,9 +1718,8 @@ endr
push hl
ld hl, .BlackBlueFade
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@@ -1786,9 +1777,9 @@ Intro_Scene20_AppearUnown: ; e5348 (39:5348)
.got_pointer
ld a, [wcf65]
and $7
-rept 3
add a
-endr
+ add a
+ add a
ld c, a
ld a, [rSVBK]
push af
@@ -1844,9 +1835,9 @@ endr
; e539d
Intro_FadeUnownWordPals: ; e539d (39:539d)
-rept 3
add a
-endr
+ add a
+ add a
ld e, a
ld d, $0
ld hl, BGPals
@@ -2102,8 +2093,8 @@ Intro_ResetLYOverrides: ; e5516 (39:5516)
pop af
ld [rSVBK], a
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
ret
Intro_PerspectiveScrollBG: ; e552f (39:552f)
@@ -2127,9 +2118,8 @@ Intro_PerspectiveScrollBG: ; e552f (39:552f)
; grass in the front
ld hl, LYOverrides + $5f
ld a, [hl]
-rept 2
inc a
-endr
+ inc a
ld bc, $31
call ByteFill
ld a, [LYOverrides + 0]
diff --git a/engine/debug.asm b/engine/debug.asm
index a02f536db..78fc52489 100755
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -300,9 +300,8 @@ Function81a74: ; 81a74
ld e, a
ld d, 0
ld hl, Jumptable_81acf
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -482,9 +481,8 @@ Function81bf4: ; 81bf4
inc a
ld l, a
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, OverworldMap
add hl, de
ld de, wc608
@@ -558,9 +556,8 @@ Function81c33: ; 81c33
ld a, [wc608 + 3]
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld hl, wSGBPals
call Function81f0c
@@ -576,9 +573,9 @@ endr
; 81ca7
Function81ca7: ; 81ca7
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, [de]
call Function81cbc
ld a, [de]
@@ -609,9 +606,8 @@ Function81cc2: ; 81cc2
ld e, a
ld d, 0
ld hl, Jumptable_81d02
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -855,9 +851,8 @@ String_81e4d: db "おぼえられない@" ; cannot be taught
Function81e55: ; 81e55
cp $32
jr c, .asm_81e5b
-rept 2
inc a
-endr
+ inc a
.asm_81e5b
add $bf
@@ -938,9 +933,8 @@ Function81eca: ; 81eca
inc a
ld l, a
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, OverworldMap
add hl, de
ld e, l
@@ -970,9 +964,8 @@ Function81ee3: ; 81ee3
inc de
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
dec c
jr nz, .asm_81ee3
ret
@@ -1108,9 +1101,8 @@ Function81f5e: ; 81f5e
ld a, b
ld [hli], a
ld a, [de]
-rept 2
add a
-endr
+ add a
add $18
ld [hli], a
xor a
@@ -1241,9 +1233,9 @@ Function8220f: ; 8220f
ld a, [wcf64]
ld l, a
ld h, $0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld de, UnknBGPals
add hl, de
ld de, wc608
@@ -1356,9 +1348,8 @@ Function822f0: ; 822f0
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1400,9 +1391,8 @@ Function82309: ; 82309
ld e, a
ld d, $0
ld hl, wc608
-rept 2
add hl, de
-endr
+ add hl, de
ld e, l
ld d, h
call Function81ea5
@@ -1500,9 +1490,8 @@ Function82391: ; 82391
ld c, a
ld b, $0
ld hl, wc608
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, e
ld [hli], a
ld [hl], d
diff --git a/engine/delete_save_change_clock.asm b/engine/delete_save_change_clock.asm
new file mode 100755
index 000000000..7a806ad01
--- /dev/null
+++ b/engine/delete_save_change_clock.asm
@@ -0,0 +1,298 @@
+_ResetClock: ; 4d3b1
+ callba BlankScreen
+ ld b, SCGB_DIPLOMA
+ call GetSGBLayout
+ call LoadStandardFont
+ call LoadFontsExtra
+ ld de, MUSIC_MAIN_MENU
+ call PlayMusic
+ ld hl, .text_askreset
+ call PrintText
+ ld hl, .NoYes_MenuDataHeader
+ call CopyMenuDataHeader
+ call VerticalMenu
+ ret c
+ ld a, [wMenuCursorY]
+ cp $1
+ ret z
+ call ClockResetPassword
+ jr c, .wrongpassword
+ ld a, BANK(sRTCStatusFlags)
+ call GetSRAMBank
+ ld a, $80
+ ld [sRTCStatusFlags], a
+ call CloseSRAM
+ ld hl, .text_okay
+ call PrintText
+ ret
+
+.wrongpassword
+ ld hl, .text_wrong
+ call PrintText
+ ret
+
+.text_okay ; 0x4d3fe
+ ; Password OK. Select CONTINUE & reset settings.
+ text_jump UnknownText_0x1c55db
+ db "@"
+
+.text_wrong ; 0x4d403
+ ; Wrong password!
+ text_jump UnknownText_0x1c560b
+ db "@"
+
+.text_askreset ; 0x4d408
+ ; Reset the clock?
+ text_jump UnknownText_0x1c561c
+ db "@"
+
+.NoYes_MenuDataHeader: ; 0x4d40d
+ db $00 ; flags
+ db 07, 14 ; start coords
+ db 11, 19 ; end coords
+ dw .NoYes_MenuData2
+ db 1 ; default option
+
+.NoYes_MenuData2: ; 0x4d415
+ db $c0 ; flags
+ db 2 ; items
+ db "NO@"
+ db "YES@"
+
+ClockResetPassword: ; 4d41e
+ call .CalculatePassword
+ push de
+ ld hl, StringBuffer2
+ ld bc, 5
+ xor a
+ call ByteFill
+ ld a, $4
+ ld [StringBuffer2 + 5], a
+ ld hl, .pleaseenterpasswordtext
+ call PrintText
+.loop
+ call .updateIDdisplay
+.loop2
+ call JoyTextDelay
+ ld a, [hJoyLast]
+ ld b, a
+ and A_BUTTON
+ jr nz, .confirm
+ ld a, b
+ and D_PAD
+ jr z, .loop2
+ call .dpadinput
+ ld c, 3
+ call DelayFrames
+ jr .loop
+
+.confirm
+ call .ConvertDecIDToBytes
+ pop de
+ ld a, e
+ cp l
+ jr nz, .nope
+ ld a, d
+ cp h
+ jr nz, .nope
+ and a
+ ret
+
+.nope
+ scf
+ ret
+
+.pleaseenterpasswordtext ; 0x4d463
+ ; Please enter the password.
+ text_jump UnknownText_0x1c562e
+ db "@"
+
+.updateIDdisplay ; 4d468
+ hlcoord 14, 15
+ ld de, StringBuffer2
+ ld c, 5
+.loop3
+ ld a, [de]
+ add "0"
+ ld [hli], a
+ inc de
+ dec c
+ jr nz, .loop3
+ hlcoord 14, 16
+ ld bc, 5
+ ld a, " "
+ call ByteFill
+ hlcoord 14, 16
+ ld a, [StringBuffer2 + 5]
+ ld e, a
+ ld d, $0
+ add hl, de
+ ld [hl], $61
+ ret
+
+.dpadinput ; 4d490
+ ld a, b
+ and D_LEFT
+ jr nz, .left
+ ld a, b
+ and D_RIGHT
+ jr nz, .right
+ ld a, b
+ and D_UP
+ jr nz, .up
+ ld a, b
+ and D_DOWN
+ jr nz, .down
+ ret
+
+.left
+ ld a, [StringBuffer2 + 5]
+ and a
+ ret z
+ dec a
+ ld [StringBuffer2 + 5], a
+ ret
+
+.right
+ ld a, [StringBuffer2 + 5]
+ cp $4
+ ret z
+ inc a
+ ld [StringBuffer2 + 5], a
+ ret
+
+.up
+ call .getcurrentdigit
+ ld a, [hl]
+ cp 9
+ jr z, .wraparound_up
+ inc a
+ ld [hl], a
+ ret
+
+.wraparound_up
+ ld [hl], $0
+ ret
+
+.down
+ call .getcurrentdigit
+ ld a, [hl]
+ and a
+ jr z, .wraparound_down
+ dec a
+ ld [hl], a
+ ret
+
+.wraparound_down
+ ld [hl], 9
+ ret
+
+.getcurrentdigit ; 4d4d5
+ ld a, [StringBuffer2 + 5]
+ ld e, a
+ ld d, $0
+ ld hl, StringBuffer2
+ add hl, de
+ ret
+
+.ConvertDecIDToBytes: ; 4d4e0
+ ld hl, 0
+ ld de, StringBuffer2 + 4
+ ld bc, 1
+ call .ConvertToBytes
+ ld bc, 10
+ call .ConvertToBytes
+ ld bc, 100
+ call .ConvertToBytes
+ ld bc, 1000
+ call .ConvertToBytes
+ ld bc, 10000
+.ConvertToBytes: ; 4d501
+ ld a, [de]
+ dec de
+ push hl
+ ld hl, 0
+ call AddNTimes
+ ld c, l
+ ld b, h
+ pop hl
+ add hl, bc
+ ret
+
+.CalculatePassword: ; 4d50f
+ ld a, BANK(sPlayerData)
+ call GetSRAMBank
+ ld de, 0
+ ld hl, sPlayerData + (PlayerID - wPlayerData)
+ ld c, $2
+ call .ComponentFromNumber
+ ld hl, sPlayerData + (PlayerName - wPlayerData)
+ ld c, $5 ; PLAYER_NAME_LENGTH_J
+ call .ComponentFromString
+ ld hl, sPlayerData + (Money - wPlayerData)
+ ld c, $3
+ call .ComponentFromNumber
+ call CloseSRAM
+ ret
+
+.ComponentFromNumber: ; 4d533
+ ld a, [hli]
+ add e
+ ld e, a
+ ld a, $0
+ adc d
+ ld d, a
+ dec c
+ jr nz, .ComponentFromNumber
+ ret
+
+.ComponentFromString: ; 4d53e
+ ld a, [hli]
+ cp "@"
+ ret z
+ add e
+ ld e, a
+ ld a, $0
+ adc d
+ ld d, a
+ dec c
+ jr nz, .ComponentFromString
+ ret
+
+_DeleteSaveData: ; 4d54c
+ callba BlankScreen
+ ld b, SCGB_DIPLOMA
+ call GetSGBLayout
+ call LoadStandardFont
+ call LoadFontsExtra
+ ld de, MUSIC_MAIN_MENU
+ call PlayMusic
+ ld hl, .Text_ClearAllSaveData
+ call PrintText
+ ld hl, .NoYesMenuDataHeader
+ call CopyMenuDataHeader
+ call VerticalMenu
+ ret c
+ ld a, [wMenuCursorY]
+ cp $1
+ ret z
+ callba EmptyAllSRAMBanks
+ ret
+
+.Text_ClearAllSaveData: ; 0x4d580
+ ; Clear all save data?
+ text_jump UnknownText_0x1c564a
+ db "@"
+
+.NoYesMenuDataHeader: ; 0x4d585
+ db $00 ; flags
+ db 07, 14 ; start coords
+ db 11, 19 ; end coords
+ dw .MenuData2
+ db 1 ; default option
+
+.MenuData2: ; 0x4d58d
+ db $c0 ; flags
+ db 2 ; items
+ db "NO@"
+ db "YES@"
diff --git a/engine/diploma.asm b/engine/diploma.asm
index 8f8ef9e99..c446ff86b 100644
--- a/engine/diploma.asm
+++ b/engine/diploma.asm
@@ -1,50 +1,50 @@
_Diploma: ; 1dd702
- call Function1dd709
+ call PlaceDiplomaOnScreen
call WaitPressAorB_BlinkCursor
ret
; 1dd709
-Function1dd709: ; 1dd709
+PlaceDiplomaOnScreen: ; 1dd709
call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
- ld hl, LZ_1dd805
+ ld hl, DiplomaGFX
ld de, VTiles2
call Decompress
- ld hl, Tilemap_1ddc4b
+ ld hl, DiplomaPage1Tilemap
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
- ld de, String_1dd760
+ ld de, .Player
hlcoord 2, 5
call PlaceString
- ld de, String_1dd767
+ ld de, .EmptyString
hlcoord 15, 5
call PlaceString
ld de, PlayerName
hlcoord 9, 5
call PlaceString
- ld de, String_1dd768
+ ld de, .Certification
hlcoord 2, 8
call PlaceString
call EnableLCD
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
call DelayFrame
ret
; 1dd760
-String_1dd760:
+.Player:
db "PLAYER@"
-String_1dd767:
+.EmptyString:
db "@"
-String_1dd768:
+.Certification:
db "This certifies"
next "that you have"
next "completed the"
@@ -53,26 +53,26 @@ String_1dd768:
db "@"
; 1dd7ae
-Function1dd7ae: ; 1dd7ae
+PrintDiplomaPage2: ; 1dd7ae
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
- ld hl, Tilemap_1dddb3
+ ld hl, DiplomaPage2Tilemap
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
- ld de, String_1dd7fa
+ ld de, .GameFreak
hlcoord 8, 0
call PlaceString
- ld de, String_1dd7f0
+ ld de, .PlayTime
hlcoord 3, 15
call PlaceString
hlcoord 12, 15
ld de, GameTimeHours
lb bc, 2, 4
call PrintNum
- ld [hl], $67
+ ld [hl], $67 ; colon
inc hl
ld de, GameTimeMinutes
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
@@ -80,15 +80,15 @@ Function1dd7ae: ; 1dd7ae
ret
; 1dd7f0
-String_1dd7f0: db "PLAY TIME@"
-String_1dd7fa: db "GAME FREAK@"
+.PlayTime: db "PLAY TIME@"
+.GameFreak: db "GAME FREAK@"
; 1dd805
-LZ_1dd805: ; 1dd805
+DiplomaGFX: ; 1dd805
INCBIN "gfx/unknown/1dd805.2bpp.lz"
-Tilemap_1ddc4b: ; 1ddc4b
+DiplomaPage1Tilemap: ; 1ddc4b
INCBIN "gfx/unknown/1ddc4b.tilemap"
-Tilemap_1dddb3: ; 1dddb3
+DiplomaPage2Tilemap: ; 1dddb3
INCBIN "gfx/unknown/1dddb3.tilemap"
diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm
index bb5377d8f..e5ef9b4cf 100755
--- a/engine/dummy_game.asm
+++ b/engine/dummy_game.asm
@@ -8,7 +8,7 @@ _DummyGame: ; e1e5b (38:5e5b)
.LoadGFXAndPals:
call DisableLCD
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
callab ClearSpriteAnims
ld hl, LZ_e2221
diff --git a/engine/events.asm b/engine/events.asm
index 3bcac8925..e7598b595 100644
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -167,10 +167,10 @@ HandleMap: ; 96773
cp 2 ; HandleMap
ret nz
- call Function967d1
+ call HandleMapObjects
call NextOverworldFrame
- call Function967e1
- call Function967f4
+ call HandleMapBackground
+ call CheckPlayerState
ret
; 96795
@@ -226,21 +226,21 @@ HandleMapTimeAndJoypad: ; 967c1
ret
; 967d1
-Function967d1: ; 967d1
+HandleMapObjects: ; 967d1
callba HandleNPCStep ; engine/map_objects.asm
callba _HandlePlayerStep
call _CheckObjectEnteringVisibleRange
ret
; 967e1
-Function967e1: ; 967e1
+HandleMapBackground: ; 967e1
callba _UpdateSprites
callba ScrollScreen
callba PlaceMapNameSign
ret
; 967f4
-Function967f4: ; 967f4
+CheckPlayerState: ; 967f4
ld a, [wPlayerStepFlags]
bit 5, a ; in the middle of step
jr z, .events
@@ -547,7 +547,7 @@ OWPlayerInput: ; 96974
.Action:
push af
- callba Function80422
+ callba StopPlayerForEvent
pop af
scf
ret
@@ -1030,9 +1030,9 @@ DoPlayerEvent: ; 96beb
ld c, a
ld b, 0
ld hl, PlayerEventScriptPointers
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld [ScriptBank], a
ld a, [hli]
diff --git a/engine/events_2.asm b/engine/events_2.asm
index 2e7c37c92..42e3ed8e4 100644
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -458,10 +458,10 @@ HandleQueuedCommand: ; 97e79
.okay
ld e, a
ld d, 0
- ld hl, .Jumptable_ba
-rept 3
+ ld hl, .Jumptable
+ add hl, de
+ add hl, de
add hl, de
-endr
ld a, [hli]
push af
ld a, [hli]
@@ -472,7 +472,7 @@ endr
ret
; 97e94
-.Jumptable_ba: ; 97e94
+.Jumptable: ; 97e94
dba CmdQueue_Null
dba CmdQueue_Null2
dba CmdQueue_StoneTable
@@ -531,9 +531,9 @@ CmdQueue_Type4: ; 97ebc
ld a, [hl]
dec a
ld [hl], a
- jr z, .asm_97eee
+ jr z, .finish
and $1
- jr z, .asm_97ee4
+ jr z, .add
ld hl, 2
add hl, bc
ld a, [hSCY]
@@ -541,7 +541,7 @@ CmdQueue_Type4: ; 97ebc
ld [hSCY], a
ret
-.asm_97ee4
+.add
ld hl, 2
add hl, bc
ld a, [hSCY]
@@ -549,7 +549,7 @@ CmdQueue_Type4: ; 97ebc
ld [hSCY], a
ret
-.asm_97eee
+.finish
ld hl, 4
add hl, bc
ld a, [hl]
diff --git a/engine/events_3.asm b/engine/events_3.asm
index b1c142a27..b6aaea3b7 100755
--- a/engine/events_3.asm
+++ b/engine/events_3.asm
@@ -45,7 +45,7 @@ ReturnFromMapSetupScript:: ; b8000
ld [wLandmarkSignTimer], a
call LoadMapNameSignGFX
call InitMapNameFrame
- callba Function104303
+ callba HDMATransfer_OnlyTopFourRows
ret
.dont_do_map_sign
@@ -55,7 +55,7 @@ ReturnFromMapSetupScript:: ; b8000
ld [rWY], a
ld [hWY], a
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ret
; b8064
@@ -65,7 +65,7 @@ ReturnFromMapSetupScript:: ; b8000
ld a, [wPreviousLandmark]
cp c
ret z
- cp $0
+ cp SPECIAL_MAP
ret
; b8070
@@ -113,7 +113,7 @@ PlaceMapNameSign:: ; b8098 (2e:4098)
jr nz, .skip2
call InitMapNameFrame
call PlaceMapNameCenterAlign
- callba Function104303
+ callba HDMATransfer_OnlyTopFourRows
.skip2
ld a, $80
ld a, $70
@@ -126,7 +126,7 @@ PlaceMapNameSign:: ; b8098 (2e:4098)
ld [rWY], a
ld [hWY], a
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ret
@@ -184,12 +184,10 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1)
InitMapSignAttrMap: ; b8115
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
+ inc c
inc c
-endr
ld a, $87
.loop
push bc
@@ -261,15 +259,13 @@ PlaceMapNameFrame: ; b812f
jr .enterloop
.continueloop
-rept 2
ld [hli], a
-endr
+ ld [hli], a
.enterloop
inc a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
dec a
dec c
jr nz, .continueloop
@@ -280,13 +276,13 @@ CheckForHiddenItems: ; b8172
; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry.
call GetMapScriptHeaderBank
ld [Buffer1], a
-; Get the coordinate of the bottom right corner of the screen, and load it in wd1ec/wd1ed.
+; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4.
ld a, [XCoord]
add SCREEN_WIDTH / 4
- ld [wd1ed], a
+ ld [Buffer4], a
ld a, [YCoord]
add SCREEN_HEIGHT / 4
- ld [wd1ec], a
+ ld [Buffer3], a
; Get the pointer for the first signpost header in the map...
ld hl, wCurrentMapSignpostHeaderPointer
ld a, [hli]
@@ -305,7 +301,7 @@ CheckForHiddenItems: ; b8172
call .GetFarByte
ld e, a
; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost.
- ld a, [wd1ec]
+ ld a, [Buffer3]
sub e
jr c, .next
cp SCREEN_HEIGHT / 2
@@ -313,7 +309,7 @@ CheckForHiddenItems: ; b8172
; Is the X coordinate of the signpost on the screen? If not, go to the next signpost.
call .GetFarByte
ld d, a
- ld a, [wd1ed]
+ ld a, [Buffer4]
sub d
jr c, .next
cp SCREEN_WIDTH / 2
@@ -364,7 +360,7 @@ CheckForHiddenItems: ; b8172
TreeMonEncounter: ; b81ea
- callba MobileFn_1060ef
+ callba TrainerRankings_TreeEncounters
xor a
ld [TempWildMonSpecies], a
@@ -522,9 +518,8 @@ GetTreeMons: ; b82d2
ld e, a
ld d, 0
ld hl, TreeMons
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
@@ -709,9 +704,9 @@ SelectTreeMon: ; b841f
.loop
sub [hl]
jr c, .ok
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.ok
diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm
index dc0ddd8f6..2f1c4c522 100755
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -21,7 +21,7 @@ EvolutionAnimation: ; 4e5e1
pop de
pop hl
- ld a, [Buffer4]
+ ld a, [wEvolutionCanceled]
and a
ret z
@@ -30,7 +30,7 @@ EvolutionAnimation: ; 4e5e1
; 4e607
.EvolutionAnimation: ; 4e607
- ld a, $e4
+ ld a, %11100100
ld [rOBP0], a
ld de, MUSIC_NONE
@@ -48,29 +48,29 @@ EvolutionAnimation: ; 4e5e1
call WaitBGMap
xor a
ld [hBGMapMode], a
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [PlayerHPPal], a
ld c, $0
call .GetSGBLayout
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [CurPartySpecies], a
ld [CurSpecies], a
call .PlaceFrontpic
ld de, VTiles2
ld hl, VTiles2 tile $31
- ld bc, $31
+ ld bc, 7 * 7
call Request2bpp
- ld a, $31
- ld [wd1ec], a
+ ld a, 7 * 7
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
- ld a, [Buffer2]
+ ld a, [wEvolutionNewSpecies]
ld [CurPartySpecies], a
ld [CurSpecies], a
call .LoadFrontpic
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [CurPartySpecies], a
ld [CurSpecies], a
@@ -79,7 +79,7 @@ EvolutionAnimation: ; 4e5e1
call .check_statused
jr c, .skip_cry
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
call PlayCry
.skip_cry
@@ -95,13 +95,12 @@ EvolutionAnimation: ; 4e5e1
jr c, .cancel_evo
ld a, -7 * 7
- ld [wd1ec], a
-
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
xor a
- ld [Buffer4], a
+ ld [wEvolutionCanceled], a
- ld a, [Buffer2]
+ ld a, [wEvolutionNewSpecies]
ld [PlayerHPPal], a
ld c, $0
@@ -136,9 +135,9 @@ EvolutionAnimation: ; 4e5e1
.cancel_evo
ld a, $1
- ld [Buffer4], a
+ ld [wEvolutionCanceled], a
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [PlayerHPPal], a
ld c, $0
@@ -154,7 +153,7 @@ EvolutionAnimation: ; 4e5e1
; 4e703
.GetSGBLayout: ; 4e703
- ld b, SCGB_0B
+ ld b, SCGB_EVOLUTION
jp GetSGBLayout
; 4e708
@@ -187,9 +186,8 @@ EvolutionAnimation: ; 4e5e1
call .Flash
pop bc
inc b
-rept 2
dec c
-endr
+ dec c
jr nz, .loop
and a
ret
@@ -201,10 +199,10 @@ endr
.Flash: ; 4e741
ld a, -7 * 7 ; new stage
- ld [wd1ec], a
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
ld a, 7 * 7 ; previous stage
- ld [wd1ec], a
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
dec b
jr nz, .Flash
@@ -221,7 +219,7 @@ endr
.loop1
push bc
.loop2
- ld a, [wd1ec]
+ ld a, [wEvolutionPicOffset]
add [hl]
ld [hli], a
dec c
@@ -270,7 +268,7 @@ endr
; 4e7a6
.PlayEvolvedSFX: ; 4e7a6
- ld a, [Buffer4]
+ ld a, [wEvolutionCanceled]
and a
ret nz
ld de, SFX_EVOLVED
@@ -320,7 +318,7 @@ endr
depixel 9, 11
ld a, SPRITE_ANIM_INDEX_13
call _InitSpriteAnimStruct
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [wJumptableIndex]
and %1110
@@ -344,9 +342,8 @@ endr
ld a, [hVBlankCounter]
and %1110
srl a
-rept 2
inc a
-endr
+ inc a
and $7
ld b, a
ld hl, Sprites + 3 ; attributes
@@ -355,9 +352,9 @@ endr
ld a, [hl]
or b
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop6
pop bc
diff --git a/engine/evolve.asm b/engine/evolve.asm
index db7d7e946..2f7739191 100755
--- a/engine/evolve.asm
+++ b/engine/evolve.asm
@@ -29,7 +29,7 @@ EvolveAfterBattle_MasterLoop
cp $ff
jp z, .ReturnToMap
- ld [Buffer1], a
+ ld [wEvolutionOldSpecies], a
push hl
ld a, [CurPartyMon]
@@ -41,14 +41,13 @@ EvolveAfterBattle_MasterLoop
and a
jp z, EvolveAfterBattle_MasterLoop
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
dec a
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -205,7 +204,7 @@ endr
push hl
ld a, [hl]
- ld [Buffer2], a
+ ld [wEvolutionNewSpecies], a
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
call GetNick
@@ -241,14 +240,14 @@ endr
ld a, [hl]
ld [CurSpecies], a
ld [TempMonSpecies], a
- ld [Buffer2], a
+ ld [wEvolutionNewSpecies], a
ld [wd265], a
call GetPokemonName
push hl
ld hl, Text_EvolvedIntoPKMN
call PrintTextBoxText
- callba MobileFn_106094
+ callba TrainerRankings_MonsEvolved
ld de, MUSIC_NONE
call PlayMusic
@@ -437,9 +436,8 @@ LearnLevelMoves: ; 42487
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -532,7 +530,7 @@ FillMoves: ; 424e1
ld a, [CurPartyLevel]
cp b
jp c, .done
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
and a
jr z, .CheckMove
ld a, [wd002]
@@ -565,7 +563,7 @@ FillMoves: ; 424e1
ld h, d
ld l, e
call ShiftMoves
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
and a
jr z, .ShiftedMove
push de
@@ -582,7 +580,7 @@ FillMoves: ; 424e1
.LearnMove:
ld a, [hl]
ld [de], a
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
and a
jr z, .NextMove
push hl
@@ -638,9 +636,8 @@ GetPreEvolution: ; 42581
.loop ; For each Pokemon...
ld hl, EvosAttacksPointers
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/engine/facings.asm b/engine/facings.asm
index f807e77f8..ee9efec3f 100644
--- a/engine/facings.asm
+++ b/engine/facings.asm
@@ -1,36 +1,36 @@
Facings: ; 4049
- dw Facing00
- dw Facing01
- dw Facing02
- dw Facing03
- dw Facing04
- dw Facing05
- dw Facing06
- dw Facing07
- dw Facing08
- dw Facing09
- dw Facing10
- dw Facing11
- dw Facing12
- dw Facing13
- dw Facing14
- dw Facing15
- dw Facing16
- dw Facing17
- dw Facing18
- dw Facing19
- dw Facing20
- dw Facing21
- dw Facing22
- dw Facing23
- dw Facing24
- dw Facing25
- dw Facing26
- dw Facing27
- dw Facing28
- dw Facing29
- dw Facing30
- dw Facing31
+ dw FacingStepDown0
+ dw FacingStepDown1
+ dw FacingStepDown2
+ dw FacingStepDown3
+ dw FacingStepUp0
+ dw FacingStepUp1
+ dw FacingStepUp2
+ dw FacingStepUp3
+ dw FacingStepLeft0
+ dw FacingStepLeft1
+ dw FacingStepLeft2
+ dw FacingStepLeft3
+ dw FacingStepRight0
+ dw FacingStepRight1
+ dw FacingStepRight2
+ dw FacingStepRight3
+ dw FacingFishDown
+ dw FacingFishUp
+ dw FacingFishLeft
+ dw FacingFishRight
+ dw FacingEmote
+ dw FacingShadow
+ dw FacingBigDollAsymmetric
+ dw FacingBigDollSymmetric
+ dw FacingWeirdTree0
+ dw FacingWeirdTree1
+ dw FacingWeirdTree2
+ dw FacingWeirdTree3
+ dw FacingBoulderDust1
+ dw FacingBoulderDust2
+ dw FacingGrass1
+ dw FacingGrass2
FacingsEnd: dw 0
NUM_FACINGS EQU (FacingsEnd - Facings) / 2
@@ -47,10 +47,10 @@ Y_FLIP EQU 1 << OAM_Y_FLIP
BEHIND_BG EQU 1 << OAM_PRIORITY
-Facing00:
-Facing02:
-Facing24:
-Facing26: ; standing down
+FacingStepDown0:
+FacingStepDown2:
+FacingWeirdTree0:
+FacingWeirdTree2: ; standing down
db 4 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
@@ -58,7 +58,7 @@ Facing26: ; standing down
db 8, 8, 2, $03
; 409c
-Facing01: ; walking down 1
+FacingStepDown1: ; walking down 1
db 4 ; #
db 0, 0, 0, $80
db 0, 8, 0, $81
@@ -66,7 +66,7 @@ Facing01: ; walking down 1
db 8, 8, 2, $83
; 40ad
-Facing03: ; walking down 2
+FacingStepDown3: ; walking down 2
db 4 ; #
db 0, 8, X_FLIP, $80
db 0, 0, X_FLIP, $81
@@ -74,8 +74,8 @@ Facing03: ; walking down 2
db 8, 0, 2 | X_FLIP, $83
; 40be
-Facing04:
-Facing06: ; standing up
+FacingStepUp0:
+FacingStepUp2: ; standing up
db 4 ; #
db 0, 0, 0, $04
db 0, 8, 0, $05
@@ -83,7 +83,7 @@ Facing06: ; standing up
db 8, 8, 2, $07
; 40cf
-Facing05: ; walking up 1
+FacingStepUp1: ; walking up 1
db 4 ; #
db 0, 0, 0, $84
db 0, 8, 0, $85
@@ -91,7 +91,7 @@ Facing05: ; walking up 1
db 8, 8, 2, $87
; 40e0
-Facing07: ; walking up 2
+FacingStepUp3: ; walking up 2
db 4 ; #
db 0, 8, X_FLIP, $84
db 0, 0, X_FLIP, $85
@@ -99,8 +99,8 @@ Facing07: ; walking up 2
db 8, 0, 2 | X_FLIP, $87
; 40f1
-Facing08:
-Facing10: ; standing left
+FacingStepLeft0:
+FacingStepLeft2: ; standing left
db 4 ; #
db 0, 0, 0, $08
db 0, 8, 0, $09
@@ -108,8 +108,8 @@ Facing10: ; standing left
db 8, 8, 2, $0b
; 4102
-Facing12:
-Facing14: ; standing right
+FacingStepRight0:
+FacingStepRight2: ; standing right
db 4 ; #
db 0, 8, X_FLIP, $08
db 0, 0, X_FLIP, $09
@@ -117,8 +117,8 @@ Facing14: ; standing right
db 8, 0, 2 | X_FLIP, $0b
; 4113
-Facing09:
-Facing11: ; walking left
+FacingStepLeft1:
+FacingStepLeft3: ; walking left
db 4 ; #
db 0, 0, 0, $88
db 0, 8, 0, $89
@@ -126,8 +126,8 @@ Facing11: ; walking left
db 8, 8, 2, $8b
; 4124
-Facing13:
-Facing15: ; walking right
+FacingStepRight1:
+FacingStepRight3: ; walking right
db 4 ; #
db 0, 8, X_FLIP, $88
db 0, 0, X_FLIP, $89
@@ -135,7 +135,7 @@ Facing15: ; walking right
db 8, 0, 2 | X_FLIP, $8b
; 4135
-Facing16: ; fishing down
+FacingFishDown: ; fishing down
db 5 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
@@ -144,7 +144,7 @@ Facing16: ; fishing down
db 16, 0, 4, $fc
; 414a
-Facing17: ; fishing up
+FacingFishUp: ; fishing up
db 5 ; #
db 0, 0, 0, $04
db 0, 8, 0, $05
@@ -153,7 +153,7 @@ Facing17: ; fishing up
db -8, 0, 4, $fc
; 415f
-Facing18: ; fishing left
+FacingFishLeft: ; fishing left
db 5 ; #
db 0, 0, 0, $08
db 0, 8, 0, $09
@@ -162,7 +162,7 @@ Facing18: ; fishing left
db 5, -8, 4 | X_FLIP, $fd
; 4174
-Facing19: ; fishing right
+FacingFishRight: ; fishing right
db 5 ; #
db 0, 8, X_FLIP, $08
db 0, 0, X_FLIP, $09
@@ -171,7 +171,7 @@ Facing19: ; fishing right
db 5, 16, 4, $fd
; 4189
-Facing20: ; emote
+FacingEmote: ; emote
db 4 ; #
db 0, 0, 4, $f8
db 0, 8, 4, $f9
@@ -179,13 +179,13 @@ Facing20: ; emote
db 8, 8, 4, $fb
; 419a
-Facing21: ; shadow
+FacingShadow: ; shadow
db 2 ; #
db 0, 0, 4, $fc
db 0, 8, 4 | X_FLIP, $fc
; 41a3
-Facing23: ; big snorlax or lapras doll
+FacingBigDollSymmetric: ; big snorlax or lapras doll
db 16 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
@@ -205,7 +205,7 @@ Facing23: ; big snorlax or lapras doll
db 24, 16, X_FLIP, $07
; 41e4
-Facing25: ; 41e4
+FacingWeirdTree1: ; 41e4
db 4 ; #
db 0, 0, 0, $04
db 0, 8, 0, $05
@@ -213,7 +213,7 @@ Facing25: ; 41e4
db 8, 8, 0, $07
; 41f5
-Facing27: ; 41f5
+FacingWeirdTree3: ; 41f5
db 4 ; #
db 0, 8, X_FLIP, $04
db 0, 0, X_FLIP, $05
@@ -221,7 +221,7 @@ Facing27: ; 41f5
db 8, 0, X_FLIP, $07
; 4206
-Facing22: ; big doll other than snorlax or lapras
+FacingBigDollAsymmetric: ; big doll other than snorlax or lapras
db 14 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
@@ -239,7 +239,7 @@ Facing22: ; big doll other than snorlax or lapras
db 24, 16, 0, $0b
; 423f
-Facing28: ; boulder dust 1
+FacingBoulderDust1: ; boulder dust 1
db 4 ; #
db 0, 0, 4, $fe
db 0, 8, 4, $fe
@@ -247,7 +247,7 @@ Facing28: ; boulder dust 1
db 8, 8, 4, $fe
; 4250
-Facing29: ; boulder dust 2
+FacingBoulderDust2: ; boulder dust 2
db 4 ; #
db 0, 0, 4, $ff
db 0, 8, 4, $ff
@@ -255,13 +255,13 @@ Facing29: ; boulder dust 2
db 8, 8, 4, $ff
; 4261
-Facing30: ; 4261
+FacingGrass1: ; 4261
db 2 ; #
db 8, 0, 4, $fe
db 8, 8, 4 | X_FLIP, $fe
; 426a
-Facing31: ; 426a
+FacingGrass2: ; 426a
db 2 ; #
db 9, -1, 4, $fe
db 9, 9, 4 | X_FLIP, $fe
diff --git a/engine/fish.asm b/engine/fish.asm
index 6aeec10a6..44fe57b25 100644
--- a/engine/fish.asm
+++ b/engine/fish.asm
@@ -38,9 +38,8 @@ endr
inc hl
ld e, b
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -51,9 +50,9 @@ endr
cp [hl]
jr z, .ok
jr c, .ok
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.ok
inc hl
@@ -84,9 +83,8 @@ endr
and 3
cp NITE
jr c, .time_species
-rept 2
inc hl
-endr
+ inc hl
.time_species
ld d, [hl]
diff --git a/engine/fruit_trees.asm b/engine/fruit_trees.asm
index cbbe5faaf..6a40fb05c 100644
--- a/engine/fruit_trees.asm
+++ b/engine/fruit_trees.asm
@@ -58,7 +58,7 @@ CheckFruitTree: ; 44055
; 4405f
PickedFruitTree: ; 4405f
- callba MobileFn_10609b ; empty function
+ callba TrainerRankings_FruitPicked
ld b, 1
jp GetFruitTreeFlag
; 4406a
@@ -66,9 +66,9 @@ PickedFruitTree: ; 4405f
ResetFruitTrees: ; 4406a
xor a
ld hl, FruitTreeFlags
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld hl, DailyFlags
set 4, [hl]
diff --git a/engine/healmachineanim.asm b/engine/healmachineanim.asm
index 01ed6d652..5162b3830 100755
--- a/engine/healmachineanim.asm
+++ b/engine/healmachineanim.asm
@@ -25,9 +25,8 @@ HealMachineAnim: ; 12324
ld e, a
ld d, 0
ld hl, .Pointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -219,9 +218,9 @@ INCBIN "gfx/unknown/0123fc.2bpp"
ld [hld], a
ld a, e
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .palette_loop_2
pop de
diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm
index ea5c9296a..3e4257ab7 100755
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -140,7 +140,7 @@ _ResetWRAM: ; 5bae
ld [wSecretID + 1], a
ld hl, PartyCount
- call InitList
+ call .InitList
xor a
ld [wCurBox], a
@@ -151,20 +151,20 @@ _ResetWRAM: ; 5bae
ld a, BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
- call InitList
+ call .InitList
call CloseSRAM
ld hl, NumItems
- call InitList
+ call .InitList
ld hl, NumKeyItems
- call InitList
+ call .InitList
ld hl, NumBalls
- call InitList
+ call .InitList
ld hl, PCItems
- call InitList
+ call .InitList
xor a
ld [wRoamMon1Species], a
@@ -232,7 +232,7 @@ ENDC
ret
; 5ca1
-InitList: ; 5ca1
+.InitList: ; 5ca1
; Loads 0 in the count and -1 in the first item or mon slot.
xor a
ld [hli], a
@@ -688,7 +688,7 @@ OakSpeech: ; 0x5f99
ld [TrainerClass], a
call Intro_PrepTrainerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_RotatePalettesLeftFrontpic
@@ -709,7 +709,7 @@ OakSpeech: ; 0x5f99
ld [TempMonDVs], a
ld [TempMonDVs + 1], a
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_WipeInFrontpic
@@ -726,7 +726,7 @@ OakSpeech: ; 0x5f99
ld [TrainerClass], a
call Intro_PrepTrainerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_RotatePalettesLeftFrontpic
@@ -739,7 +739,7 @@ OakSpeech: ; 0x5f99
ld [CurPartySpecies], a
callba DrawIntroPlayerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_RotatePalettesLeftFrontpic
@@ -809,7 +809,7 @@ NamePlayer: ; 0x6074
ld [CurPartySpecies], a
callba DrawIntroPlayerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call RotateThreePalettesLeft
@@ -1041,14 +1041,14 @@ StartTitleScreen: ; 6219
call ClearScreen
call WaitBGMap2
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call UpdateTimePals
ld a, [wcf64]
@@ -1172,7 +1172,7 @@ TitleScreenEntrance: ; 62bc
ld hl, wJumptableIndex
inc [hl]
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
; Play the title screen music.
ld de, MUSIC_TITLE
diff --git a/engine/landmarks.asm b/engine/landmarks.asm
index 8fb7035f2..a0b4336aa 100644
--- a/engine/landmarks.asm
+++ b/engine/landmarks.asm
@@ -3,9 +3,8 @@ GetLandmarkCoords: ; 0x1ca896
push hl
ld l, e
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Landmarks
add hl, de
ld a, [hli]
@@ -24,9 +23,8 @@ GetLandmarkName:: ; 0x1ca8a5
ld l, e
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Landmarks + 2
add hl, de
ld a, [hli]
diff --git a/engine/link.asm b/engine/link.asm
index 14c9c2f4d..f5bc24da9 100755
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -25,7 +25,7 @@ LinkCommunications: ; 28000
hlcoord 4, 10
ld de, String_PleaseWait
call PlaceString
- call Function28eff
+ call SetTradeRoomBGPals
call WaitBGMap2
ld hl, wcf5d
xor a
@@ -41,7 +41,7 @@ TimeCapsule: ; 2805d
call FixDataForLinkTransfer
xor a
ld [wPlayerLinkAction], a
- call Function87d
+ call WaitLinkTransfer
ld a, [hLinkPlayerNumber]
cp $2
jr nz, .player_1
@@ -163,9 +163,9 @@ TimeCapsule: ; 2805d
ld hl, wTimeCapsulePartyMon1Species
call Function2868a
ld a, OTPartyMonOT % $100
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, OTPartyMonOT / $100
- ld [wd103], a
+ ld [wUnusedD102 + 1], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [hLinkPlayerNumber]
@@ -404,9 +404,9 @@ Gen2ToGen2LinkComms: ; 28177
ld bc, OTPartyDataEnd - OTPartyMons
call CopyBytes
ld a, OTPartyMonOT % $100
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, OTPartyMonOT / $100
- ld [wd103], a
+ ld [wUnusedD102 + 1], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [hLinkPlayerNumber]
@@ -431,10 +431,12 @@ Gen2ToGen2LinkComms: ; 28177
ld bc, NAME_LENGTH
call CopyBytes
call ReturnToMapFromSubmenu
- ld a, [wc2d7]
+
+ ; LET'S DO THIS
+ ld a, [wDisableTextAcceleration]
push af
- ld a, $1
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
ld a, [rIE]
push af
ld a, [rIF]
@@ -446,7 +448,9 @@ Gen2ToGen2LinkComms: ; 28177
ld [rIE], a
pop af
ld [rIF], a
+
predef StartBattle
+
ld a, [rIF]
ld h, a
xor a
@@ -456,7 +460,7 @@ Gen2ToGen2LinkComms: ; 28177
ld a, h
ld [rIF], a
pop af
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
pop af
ld [Options], a
callba LoadPokemonData
@@ -491,10 +495,10 @@ LinkTimeout: ; 283b2
pop de
pop hl
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call RotateThreePalettesRight
call ClearScreen
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call WaitBGMap2
ret
@@ -575,9 +579,9 @@ FixDataForLinkTransfer: ; 28434
jr nz, .loop2
ld hl, wMisc
ld a, $fd
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld b, $c8
xor a
.loop3
@@ -1094,14 +1098,12 @@ Function2868a: ; 2868a
ld a, $46
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
pop hl
-rept 2
inc de
-endr
+ inc de
ret
; 28771
@@ -1211,9 +1213,9 @@ InitTradeMenuDisplay: ; 287e3
callba InitTradeSpeciesList
xor a
ld hl, wOtherPlayerLinkMode
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld a, 1
ld [wMenuCursorY], a
@@ -1252,8 +1254,8 @@ LinkTradeOTPartymonMenuLoop: ; 28835
bit A_BUTTON_F, a
jr z, .not_a_button
ld a, $1
- ld [wd263], a
- callab Function50db9
+ ld [wInitListType], a
+ callab InitList
ld hl, OTPartyMon1Species
callba LinkMonStatsScreen
jp LinkTradePartiesMenuMasterLoop
@@ -1445,8 +1447,8 @@ Function28926: ; 28926
pop af
ld [wMenuCursorY], a
ld a, $4
- ld [wd263], a
- callab Function50db9
+ ld [wInitListType], a
+ callab InitList
callba LinkMonStatsScreen
call Call_LoadTempTileMapToTileMap
hlcoord 6, 1
@@ -1488,7 +1490,7 @@ Function28926: ; 28926
callba Link_WaitBGMap
ld hl, .Text_CantTradeLastMon
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
jr .cancel_trade
.abnormal
@@ -1510,7 +1512,7 @@ Function28926: ; 28926
callba Link_WaitBGMap
ld hl, .Text_Abnormal
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
.cancel_trade
hlcoord 0, 12
@@ -1595,7 +1597,7 @@ Function28ade: ; 28ade
Function28b22: ; 28b22
call RotateThreePalettesRight
call ClearScreen
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call WaitBGMap2
xor a
@@ -1686,7 +1688,7 @@ LinkTrade: ; 28b87
call GetPokemonName
ld hl, UnknownText_0x28eb8
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call LoadStandardMenuDataHeader
hlcoord 10, 7
ld b, 3
@@ -1900,7 +1902,7 @@ LinkTrade: ; 28b87
call DelayFrames
call ClearTileMap
call LoadFontsBattleExtra
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
ld a, [hLinkPlayerNumber]
cp $1
@@ -1934,26 +1936,26 @@ LinkTrade: ; 28b87
callab EvolvePokemon
call ClearScreen
call LoadTradeScreenBorder
- call Function28eff
+ call SetTradeRoomBGPals
callba Link_WaitBGMap
ld b, $1
pop af
ld c, a
cp MEW
- jr z, .asm_28e49
+ jr z, .loop
ld a, [CurPartySpecies]
cp MEW
- jr z, .asm_28e49
+ jr z, .loop
ld b, $2
ld a, c
cp CELEBI
- jr z, .asm_28e49
+ jr z, .loop
ld a, [CurPartySpecies]
cp CELEBI
- jr z, .asm_28e49
+ jr z, .loop
ld b, $0
-.asm_28e49
+.loop
ld a, b
ld [wPlayerLinkAction], a
push bc
@@ -1961,17 +1963,17 @@ LinkTrade: ; 28b87
pop bc
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
- jr z, .asm_28e63
+ jr z, .save
ld a, b
and a
- jr z, .asm_28e63
+ jr z, .save
ld a, [wOtherPlayerLinkAction]
cp b
- jr nz, .asm_28e49
+ jr nz, .loop
-.asm_28e63
- callba Function14a58
- callba MobileFn_1060af
+.save
+ callba SaveAfterLinkTrade
+ callba TrainerRankings_Trades
callba BackupMobileEventIndex
ld c, 40
call DelayFrames
@@ -2027,8 +2029,8 @@ LoadTradeScreenBorder: ; 28ef8
ret
; 28eff
-Function28eff: ; 28eff
- callba Function16d6a7
+SetTradeRoomBGPals: ; 28eff
+ callba LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful
call SetPalettes
ret
; 28f09
@@ -2148,7 +2150,7 @@ Special_EnterTimeCapsule: ; 29c7b
ld c, 10
call DelayFrames
ld a, $4
- call Function29f17
+ call Link_EnsureSync
ld c, 40
call DelayFrames
xor a
@@ -2197,7 +2199,7 @@ WaitForOtherPlayerToExit: ; 29c92
ld [rIE], a
pop af
ld [rIF], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
xor a
ld [hli], a
ld [hl], a
@@ -2238,7 +2240,7 @@ Special_SetBitsForTimeCapsuleRequest: ; 29cfa
Special_WaitForLinkedFriend: ; 29d11
ld a, [wPlayerLinkAction]
and a
- jr z, .asm_29d2f
+ jr z, .no_link_action
ld a, $2
ld [rSB], a
xor a
@@ -2251,17 +2253,17 @@ Special_WaitForLinkedFriend: ; 29d11
call DelayFrame
call DelayFrame
-.asm_29d2f
+.no_link_action
ld a, $2
- ld [wcf5c], a
+ ld [wLinkTimeoutFrames + 1], a
ld a, $ff
- ld [wcf5b], a
-.asm_29d39
+ ld [wLinkTimeoutFrames], a
+.loop
ld a, [hLinkPlayerNumber]
cp $2
- jr z, .asm_29d79
+ jr z, .connected
cp $1
- jr z, .asm_29d79
+ jr z, .connected
ld a, -1
ld [hLinkPlayerNumber], a
ld a, $2
@@ -2272,16 +2274,16 @@ Special_WaitForLinkedFriend: ; 29d11
ld [rSC], a
ld a, $80
ld [rSC], a
- ld a, [wcf5b]
+ ld a, [wLinkTimeoutFrames]
dec a
- ld [wcf5b], a
- jr nz, .asm_29d68
- ld a, [wcf5c]
+ ld [wLinkTimeoutFrames], a
+ jr nz, .not_done
+ ld a, [wLinkTimeoutFrames + 1]
dec a
- ld [wcf5c], a
- jr z, .asm_29d8d
+ ld [wLinkTimeoutFrames + 1], a
+ jr z, .done
-.asm_29d68
+.not_done
ld a, $1
ld [rSB], a
ld a, $1
@@ -2289,19 +2291,19 @@ Special_WaitForLinkedFriend: ; 29d11
ld a, $81
ld [rSC], a
call DelayFrame
- jr .asm_29d39
+ jr .loop
-.asm_29d79
+.connected
call LinkDataReceived
call DelayFrame
call LinkDataReceived
- ld c, $32
+ ld c, 50
call DelayFrames
ld a, $1
ld [ScriptVar], a
ret
-.asm_29d8d
+.done
xor a
ld [ScriptVar], a
ret
@@ -2310,7 +2312,7 @@ Special_WaitForLinkedFriend: ; 29d11
Special_CheckLinkTimeout: ; 29d92
ld a, $1
ld [wPlayerLinkAction], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, $3
ld [hli], a
xor a
@@ -2320,19 +2322,19 @@ Special_CheckLinkTimeout: ; 29d92
ld [hVBlank], a
call DelayFrame
call DelayFrame
- call Function29e0c
+ call Link_CheckCommunicationError
xor a
ld [hVBlank], a
ld a, [ScriptVar]
and a
ret nz
- jp Function29f04
+ jp Link_ResetSerialRegistersAfterLinkClosure
; 29dba
Function29dba: ; 29dba
ld a, $5
ld [wPlayerLinkAction], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, $3
ld [hli], a
xor a
@@ -2342,7 +2344,7 @@ Function29dba: ; 29dba
ld [hVBlank], a
call DelayFrame
call DelayFrame
- call Function29e0c
+ call Link_CheckCommunicationError
ld a, [ScriptVar]
and a
jr z, .vblank
@@ -2357,11 +2359,11 @@ Function29dba: ; 29dba
jr nz, .script_var
ld a, $6
ld [wPlayerLinkAction], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, $1
ld [hli], a
ld [hl], $32
- call Function29e0c
+ call Link_CheckCommunicationError
ld a, [wOtherPlayerLinkMode]
cp $6
jr z, .vblank
@@ -2377,40 +2379,40 @@ Function29dba: ; 29dba
ret
; 29e0c
-Function29e0c: ; 29e0c
+Link_CheckCommunicationError: ; 29e0c
xor a
ld [hFFCA], a
- ld a, [wcf5b]
+ ld a, [wLinkTimeoutFrames]
ld h, a
- ld a, [wcf5c]
+ ld a, [wLinkTimeoutFrames + 1]
ld l, a
push hl
- call Function29e3b
+ call .CheckConnected
pop hl
- jr nz, .asm_29e2f
- call Function29e47
- call Function29e53
- call Function29e3b
- jr nz, .asm_29e2f
- call Function29e47
+ jr nz, .load_true
+ call .AcknowledgeSerial
+ call .ConvertDW
+ call .CheckConnected
+ jr nz, .load_true
+ call .AcknowledgeSerial
xor a
- jr .asm_29e31
+ jr .load_scriptvar
-.asm_29e2f
+.load_true
ld a, $1
-.asm_29e31
+.load_scriptvar
ld [ScriptVar], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
xor a
ld [hli], a
ld [hl], a
ret
; 29e3b
-Function29e3b: ; 29e3b
- call Function87d
- ld hl, wcf5b
+.CheckConnected: ; 29e3b
+ call WaitLinkTransfer
+ ld hl, wLinkTimeoutFrames
ld a, [hli]
inc a
ret nz
@@ -2419,17 +2421,19 @@ Function29e3b: ; 29e3b
ret
; 29e47
-Function29e47: ; 29e47
- ld b, $a
-.asm_29e49
+.AcknowledgeSerial: ; 29e47
+ ld b, 10
+.loop
call DelayFrame
call LinkDataReceived
dec b
- jr nz, .asm_29e49
+ jr nz, .loop
ret
; 29e53
-Function29e53: ; 29e53
+.ConvertDW: ; 29e53
+ ; [wLinkTimeoutFrames] = ((hl - $100) / 4) + $100
+ ; = (hl / 4) + $c0
dec h
srl h
rr l
@@ -2437,9 +2441,9 @@ Function29e53: ; 29e53
rr l
inc h
ld a, h
- ld [wcf5b], a
+ ld [wLinkTimeoutFrames], a
ld a, l
- ld [wcf5c], a
+ ld [wLinkTimeoutFrames + 1], a
ret
; 29e66
@@ -2448,12 +2452,11 @@ Special_TryQuickSave: ; 29e66
push af
callba Link_SaveGame
ld a, $1
- jr nc, .asm_29e75
+ jr nc, .return_result
xor a
-
-.asm_29e75
+.return_result
ld [ScriptVar], a
- ld c, $1e
+ ld c, 30
call DelayFrames
pop af
ld [wd265], a
@@ -2462,7 +2465,7 @@ Special_TryQuickSave: ; 29e66
Special_CheckBothSelectedSameRoom: ; 29e82
ld a, [wd265]
- call Function29f17
+ call Link_EnsureSync
push af
call LinkDataReceived
call DelayFrame
@@ -2523,19 +2526,19 @@ Special_Colosseum: ; 29ed9
Special_CloseLink: ; 29eee
xor a
ld [wLinkMode], a
- ld c, $3
+ ld c, 3
call DelayFrames
- jp Function29f04
+ jp Link_ResetSerialRegistersAfterLinkClosure
; 29efa
Special_FailedLinkToPast: ; 29efa
ld c, 40
call DelayFrames
ld a, $e
- jp Function29f17
+ jp Link_EnsureSync
; 29f04
-Function29f04: ; 29f04
+Link_ResetSerialRegistersAfterLinkClosure: ; 29f04
ld c, 3
call DelayFrames
ld a, -1
@@ -2548,7 +2551,7 @@ Function29f04: ; 29f04
ret
; 29f17
-Function29f17: ; 29f17
+Link_EnsureSync: ; 29f17
add $d0
ld [wPlayerLinkAction], a
ld [wcf57], a
diff --git a/engine/link_trade.asm b/engine/link_trade.asm
index 4f0198549..96401f188 100755
--- a/engine/link_trade.asm
+++ b/engine/link_trade.asm
@@ -25,7 +25,7 @@ Function16d43b: ; 16d43b
call ClearSprites
callba __LoadTradeScreenBorder ; useless to farcall
callba Function16d42e ; useless to farcall
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
call WaitBGMap
@@ -145,8 +145,8 @@ LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a
ret
; 16d6a7
-Function16d6a7: ; 16d6a7
- callba Function49811
+LoadTradeRoomBGPals_: ; 16d6a7
+ callba LoadTradeRoomBGPals
ret
; 16d6ae
@@ -171,7 +171,7 @@ LinkTextbox: ; 16d6ca
Function16d6ce: ; 16d6ce
call LoadStandardMenuDataHeader
call Function16d6e1
- callba Function87d
+ callba WaitLinkTransfer
call Call_ExitMenu
call WaitBGMap2
ret
diff --git a/engine/main_menu.asm b/engine/main_menu.asm
index bad1682c7..c3b30d2d0 100755
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -4,9 +4,9 @@ INCBIN "gfx/unknown/049c0c.2bpp"
MainMenu: ; 49cdc
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
call Function49ed0
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ld hl, GameTimerPause
diff --git a/engine/map_object_action.asm b/engine/map_object_action.asm
index 63748ce6a..a7ab87200 100755
--- a/engine/map_object_action.asm
+++ b/engine/map_object_action.asm
@@ -14,23 +14,23 @@
; 445f
Pointers445f: ; 445f
- dw SetFacingStanding, SetFacingStanding ; 00
- dw Function44b5, SetFacingCurrent ; 01 standing?
- dw Function44c1, SetFacingCurrent ; 02 walking?
- dw Function4508, SetFacingCurrent ; 03 bumping?
- dw Function4529, SetFacingCurrent ; 04
- dw Function4539, SetFacingStanding ; 05
- dw Function456e, Function456e ; 06
- dw Function457b, SetFacingStanding ; 07
- dw Function4582, Function4582 ; 08
- dw Function4589, Function4589 ; 09
- dw Function4590, Function45a4 ; 0a
- dw Function45ab, SetFacingCurrent ; 0c
- dw Function45be, Function45be ; 0b
- dw Function45c5, Function45c5 ; 0d
- dw Function45da, SetFacingStanding ; 0e
- dw Function45ed, SetFacingStanding ; 0f
- dw Function44e4, SetFacingCurrent ; 10
+ dw SetFacingStanding, SetFacingStanding ; 00
+ dw SetFacingStandAction, SetFacingCurrent ; 01 standing?
+ dw SetFacingStepAction, SetFacingCurrent ; 02 walking?
+ dw SetFacingBumpAction, SetFacingCurrent ; 03 bumping?
+ dw SetFacingCounterclockwiseSpin, SetFacingCurrent ; 04
+ dw SetFacingCounterclockwiseSpin2, SetFacingStanding ; 05
+ dw SetFacingFish, SetFacingFish ; 06
+ dw SetFacingShadow, SetFacingStanding ; 07
+ dw SetFacingEmote, SetFacingEmote ; 08
+ dw SetFacingBigDollSym, SetFacingBigDollSym ; 09
+ dw SetFacingBounce, SetFacingFreezeBounce ; 0a
+ dw SetFacingWeirdTree, SetFacingCurrent ; 0b
+ dw SetFacingBigDollAsym, SetFacingBigDollAsym ; 0c
+ dw SetFacingBigDoll, SetFacingBigDoll ; 0d
+ dw SetFacingBoulderDust, SetFacingStanding ; 0e
+ dw SetFacingGrassShake, SetFacingStanding ; 0f
+ dw SetFacingSkyfall, SetFacingCurrent ; 10
; 44a3
SetFacingStanding: ; 44a3
@@ -42,23 +42,23 @@ SetFacingStanding: ; 44a3
SetFacingCurrent: ; 44aa
call GetSpriteDirection
- or 0 ; useless
+ or FACING_STEP_DOWN_0 ; useless
ld hl, OBJECT_FACING_STEP
add hl, bc
ld [hl], a
ret
; 44b5
-Function44b5: ; 44b5
+SetFacingStandAction: ; 44b5
ld hl, OBJECT_FACING_STEP
add hl, bc
ld a, [hl]
and 1
- jr nz, Function44c1
+ jr nz, SetFacingStepAction
jp SetFacingCurrent
; 44c1
-Function44c1: ; 44c1
+SetFacingStepAction: ; 44c1
ld hl, OBJECT_FLAGS1
add hl, bc
bit SLIDING, [hl]
@@ -77,7 +77,7 @@ Function44c1: ; 44c1
ld d, a
call GetSpriteDirection
- or 0 ; useless
+ or FACING_STEP_DOWN_0 ; useless
or d
ld hl, OBJECT_FACING_STEP
add hl, bc
@@ -85,7 +85,7 @@ Function44c1: ; 44c1
ret
; 44e4
-Function44e4: ; 44e4
+SetFacingSkyfall: ; 44e4
ld hl, OBJECT_FLAGS1
add hl, bc
bit SLIDING, [hl]
@@ -104,7 +104,7 @@ Function44e4: ; 44e4
ld d, a
call GetSpriteDirection
- or 0 ; useless
+ or FACING_STEP_DOWN_0 ; useless
or d
ld hl, OBJECT_FACING_STEP
add hl, bc
@@ -112,7 +112,7 @@ Function44e4: ; 44e4
ret
; 4508
-Function4508: ; 4508
+SetFacingBumpAction: ; 4508
ld hl, OBJECT_FLAGS1
add hl, bc
bit SLIDING, [hl]
@@ -130,7 +130,7 @@ Function4508: ; 4508
ld d, a
call GetSpriteDirection
- or 0 ; useless
+ or FACING_STEP_DOWN_0 ; useless
or d
ld hl, OBJECT_FACING_STEP
add hl, bc
@@ -138,24 +138,28 @@ Function4508: ; 4508
ret
; 4529
-Function4529: ; 4529
- call Function453f
+SetFacingCounterclockwiseSpin: ; 4529
+ call CounterclockwiseSpinAction
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
- or 0 ; useless
+ or FACING_STEP_DOWN_0 ; useless
ld hl, OBJECT_FACING_STEP
add hl, bc
ld [hl], a
ret
; 4539
-Function4539: ; 4539
- call Function453f
+SetFacingCounterclockwiseSpin2: ; 4539
+ call CounterclockwiseSpinAction
jp SetFacingStanding
; 453f
-Function453f: ; 453f
+CounterclockwiseSpinAction: ; 453f
+; Here, OBJECT_STEP_FRAME consists of two 2-bit components,
+; using only bits 0,1 and 4,5.
+; bits 0,1 is a timer (4 overworld frames)
+; bits 4,5 determines the facing - the direction is counterclockwise.
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld a, [hl]
@@ -195,39 +199,39 @@ Function453f: ; 453f
db OW_DOWN, OW_RIGHT, OW_UP, OW_LEFT
; 456e
-Function456e: ; 456e
+SetFacingFish: ; 456e
call GetSpriteDirection
rrca
rrca
- add $10
+ add FACING_FISH_DOWN
ld hl, OBJECT_FACING_STEP
add hl, bc
ld [hl], a
ret
; 457b
-Function457b: ; 457b
+SetFacingShadow: ; 457b
ld hl, OBJECT_FACING_STEP
add hl, bc
- ld [hl], FACING_15
+ ld [hl], FACING_SHADOW
ret
; 4582
-Function4582: ; 4582 emote
+SetFacingEmote: ; 4582 emote
ld hl, OBJECT_FACING_STEP
add hl, bc
ld [hl], FACING_EMOTE
ret
; 4589
-Function4589: ; 4589
+SetFacingBigDollSym: ; 4589
ld hl, OBJECT_FACING_STEP
add hl, bc
- ld [hl], FACING_17
+ ld [hl], FACING_BIG_DOLL_SYM
ret
; 4590
-Function4590: ; 4590
+SetFacingBounce: ; 4590
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld a, [hl]
@@ -235,21 +239,21 @@ Function4590: ; 4590
and %00001111
ld [hl], a
and %00001000
- jr z, Function45a4
+ jr z, SetFacingFreezeBounce
ld hl, OBJECT_FACING_STEP
add hl, bc
- ld [hl], FACING_04
+ ld [hl], FACING_STEP_UP_0
ret
; 45a4
-Function45a4: ; 45a4
+SetFacingFreezeBounce: ; 45a4
ld hl, OBJECT_FACING_STEP
add hl, bc
- ld [hl], 0
+ ld [hl], FACING_STEP_DOWN_0
ret
; 45ab
-Function45ab: ; 45ab
+SetFacingWeirdTree: ; 45ab
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld a, [hl]
@@ -258,28 +262,28 @@ Function45ab: ; 45ab
and %00001100
rrca
rrca
- add $18
+ add FACING_WEIRD_TREE_0
ld hl, OBJECT_FACING_STEP
add hl, bc
ld [hl], a
ret
; 45be
-Function45be: ; 45be
+SetFacingBigDollAsym: ; 45be
ld hl, OBJECT_FACING_STEP
add hl, bc
- ld [hl], FACING_16
+ ld [hl], FACING_BIG_DOLL_ASYM
ret
; 45c5
-Function45c5: ; 45c5
+SetFacingBigDoll: ; 45c5
ld a, [VariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS]
- ld d, FACING_17
+ ld d, FACING_BIG_DOLL_SYM ; symmetric
cp SPRITE_BIG_SNORLAX
jr z, .ok
cp SPRITE_BIG_LAPRAS
jr z, .ok
- ld d, FACING_16
+ ld d, FACING_BIG_DOLL_ASYM ; asymmetric
.ok
ld hl, OBJECT_FACING_STEP
@@ -288,7 +292,7 @@ Function45c5: ; 45c5
ret
; 45da
-Function45da: ; 45da
+SetFacingBoulderDust: ; 45da
ld hl, OBJECT_STEP_FRAME
add hl, bc
inc [hl]
@@ -297,15 +301,15 @@ Function45da: ; 45da
ld hl, OBJECT_FACING_STEP
add hl, bc
and 2
- ld a, FACING_1C
+ ld a, FACING_BOULDER_DUST_1
jr z, .ok
- inc a ; FACING_1D
+ inc a ; FACING_BOULDER_DUST_2
.ok
ld [hl], a
ret
; 45ed
-Function45ed: ; 45ed
+SetFacingGrassShake: ; 45ed
ld hl, OBJECT_STEP_FRAME
add hl, bc
inc [hl]
@@ -313,9 +317,9 @@ Function45ed: ; 45ed
ld hl, OBJECT_FACING_STEP
add hl, bc
and 4
- ld a, FACING_1E
+ ld a, FACING_GRASS_1
jr z, .ok
- inc a ; FACING_1F
+ inc a ; FACING_GRASS_2
.ok
ld [hl], a
diff --git a/engine/map_objects.asm b/engine/map_objects.asm
index 7a38f3ffe..3f63030ec 100644
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -137,7 +137,7 @@ Function437b: ; 437b
cp STEP_TYPE_SLEEP
ret z
.ok3
- ld hl, Pointers4b45
+ ld hl, StepTypesJumptable
rst JumpTable
ret
@@ -268,9 +268,9 @@ EndSpriteMovement: ; 467b
ld [hl], a
ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a ; OBJECT_30
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -776,7 +776,7 @@ MapObjectMovementPattern: ; 47dd
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_09
+ ld [hl], PERSON_ACTION_BIG_SNORLAX
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_04
@@ -789,7 +789,7 @@ MapObjectMovementPattern: ; 47dd
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_0A
+ ld [hl], PERSON_ACTION_BOUNCE
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_04
@@ -864,7 +864,7 @@ MapObjectMovementPattern: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_07
+ ld [hl], PERSON_ACTION_SHADOW
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -921,7 +921,7 @@ MapObjectMovementPattern: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_0E
+ ld [hl], PERSON_ACTION_BOULDER_DUST
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -965,7 +965,7 @@ MapObjectMovementPattern: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_0F
+ ld [hl], PERSON_ACTION_GRASS_SHAKE
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -1084,7 +1084,7 @@ SetRandomStepDuration: ; 4b2d
ret
; 4b45
-Pointers4b45: ; 4b45
+StepTypesJumptable: ; 4b45
; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm
dw ObjectMovementReset ; 00
dw MapObjectMovementPattern ; unused
@@ -1804,7 +1804,7 @@ SkyfallTop: ; 4f83
.Init:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_10
+ ld [hl], PERSON_ACTION_SKYFALL
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
@@ -1876,8 +1876,8 @@ Function5000: ; unscripted?
ld a, [wPlayerNextMovement]
ld hl, wPlayerMovement
ld [hl], a
-; load [wPlayerNextMovement] with movement_step_sleep_1
- ld a, movement_step_sleep_1
+; load [wPlayerNextMovement] with movement_step_sleep
+ ld a, movement_step_sleep
ld [wPlayerNextMovement], a
; recover the previous value of [wPlayerNextMovement]
ld a, [hl]
@@ -1987,7 +1987,7 @@ ApplyMovementToFollower: ; 54b8
cp d
ret nz
ld a, e
- cp movement_step_sleep_1
+ cp movement_step_sleep
ret z
cp movement_step_end
ret z
@@ -1995,7 +1995,7 @@ ApplyMovementToFollower: ; 54b8
ret z
cp movement_step_bump
ret z
- cp movement_turn_step_right + 1
+ cp movement_slow_step
ret c
push af
ld hl, wFollowerMovementQueueLength
@@ -2034,7 +2034,7 @@ GetFollowerNextMovementByte: ; 54e6
.done
call .CancelFollowIfLeaderMissing
ret c
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
ret
.CancelFollowIfLeaderMissing:
@@ -2209,7 +2209,7 @@ Function55e0:: ; 55e0
xor a
.loop
ld [hMapObjectIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .ok
call Function565c
.ok
@@ -2260,7 +2260,7 @@ Function5629: ; 5629
cp NUM_OBJECT_STRUCTS
ret nc
call GetObjectStruct
- call GetObjectSprite
+ call DoesObjectHaveASprite
ret z
call Function5673
ret
@@ -2363,7 +2363,7 @@ Function56a3: ; 56a3
; 56cd
Function56cd: ; 56cd
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
ld d, a
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
@@ -2392,7 +2392,7 @@ Function56cd: ; 56cd
sub $20
.ok3
ld [hUsedSpriteIndex], a
- ld a, [wFollowNotExactPersonY]
+ ld a, [wPlayerBGMapOffsetY]
ld e, a
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
@@ -2489,7 +2489,7 @@ HandleNPCStep:: ; 576a
xor a
.loop
ld [hMapObjectIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
call Function437b
.next
@@ -2505,11 +2505,11 @@ HandleNPCStep:: ; 576a
; 579d
RefreshPlayerSprite: ; 579d
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
ld [wPlayerNextMovement], a
ld [wPlayerMovement], a
xor a
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ld [PlayerObjectStepFrame], a
call .TryResetPlayerAction
callba CheckWarpFacingDown
@@ -2662,7 +2662,7 @@ Function587a: ; 587a
xor a
.loop
push af
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -2707,7 +2707,7 @@ Function58b9:: ; 58b9
xor a
.loop
push af
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -2817,19 +2817,19 @@ _UpdateSprites:: ; 5920
ret
; 5958
-Function5958: ; 5958
+ApplyBGMapAnchorToObjects: ; 5958
push hl
push de
push bc
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
ld d, a
- ld a, [wFollowNotExactPersonY]
+ ld a, [wPlayerBGMapOffsetY]
ld e, a
ld bc, ObjectStructs
ld a, NUM_OBJECT_STRUCTS
.loop
push af
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .skip
ld hl, OBJECT_SPRITE_X
add hl, bc
@@ -2850,8 +2850,8 @@ Function5958: ; 5958
dec a
jr nz, .loop
xor a
- ld [wFollowNotExactPersonX], a
- ld [wFollowNotExactPersonY], a
+ ld [wPlayerBGMapOffsetX], a
+ ld [wPlayerBGMapOffsetY], a
pop bc
pop de
pop hl
@@ -2881,7 +2881,7 @@ PRIORITY_HIGH EQU $30
ld hl, wMovementPointer
.loop
push hl
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .skip
ld hl, OBJECT_FACING_STEP
add hl, bc
@@ -2986,7 +2986,7 @@ PRIORITY_HIGH EQU $30
add [hl]
add 8
ld e, a
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
add e
ld [hFFBF], a
ld hl, OBJECT_SPRITE_Y
@@ -2997,7 +2997,7 @@ PRIORITY_HIGH EQU $30
add [hl]
add 12
ld e, a
- ld a, [wFollowNotExactPersonY]
+ ld a, [wPlayerBGMapOffsetY]
add e
ld [hFFC0], a
ld hl, OBJECT_FACING_STEP
diff --git a/engine/map_setup.asm b/engine/map_setup.asm
index 952c12ac1..dc013ffdd 100644
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -204,9 +204,9 @@ ReadMapSetupScript: ; 1541d
ld c, a
ld b, 0
ld hl, MapSetupCommands
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
; bank
ld b, [hl]
@@ -258,8 +258,8 @@ MapSetupCommands: ; 15440
dba LoadMapPalettes ; 11
dba LoadWildMonData ; 12
dba RefreshMapSprites ; 13
- dba RunCallback_05_03 ; 14
- dba RunCallback_03 ; 15
+ dba HandleNewMap ; 14
+ dba InitCommandQueue ; 15
dba LoadObjectsRunCallback_02 ; 16
dba LoadSpawnPoint ; 17
dba EnterMapConnection ; 18
@@ -289,7 +289,7 @@ MapSetupCommands: ; 15440
DontScrollText: ; 154ca
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
ret
; 154cf
diff --git a/engine/mart.asm b/engine/mart.asm
index f756d3bc2..7002902cc 100755
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -145,9 +145,8 @@ GetMart: ; 15b31
.IsAMart:
ld hl, Marts
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -393,9 +392,8 @@ LoadBuyMenuText: ; 15c7d
pop af
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -405,9 +403,8 @@ endr
MartAskPurchaseQuantity: ; 15c91
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
-rept 2
inc hl
-endr
+ inc hl
ld a, [hl]
and a
jp z, StandardMartAskPurchaseQuantity
@@ -421,9 +418,9 @@ GetMartDialogGroup: ; 15ca3
ld e, a
ld d, 0
ld hl, .MartTextFunctionPointers
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ret
; 15cb0
@@ -579,9 +576,9 @@ BargainShopAskPurchaseQuantity:
ld h, [hl]
ld l, a
inc hl
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
inc hl
ld a, [hli]
ld [hMoneyTemp + 2], a
@@ -620,9 +617,9 @@ RooftopSaleAskPurchaseQuantity:
ld h, [hl]
ld l, a
inc hl
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
inc hl
ld e, [hl]
inc hl
@@ -666,9 +663,9 @@ MenuDataHeader_Buy: ; 0x15e18
ld c, a
ld b, 0
ld hl, wMartItem1BCD
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
push de
ld d, h
ld e, l
diff --git a/engine/menu.asm b/engine/menu.asm
index 870ca89bf..e84d8d597 100755
--- a/engine/menu.asm
+++ b/engine/menu.asm
@@ -296,7 +296,7 @@ Function241d5: ; 241d5
call Place2DMenuCursor
.loop
call Move2DMenuCursor
- call Function10402d ; BUG: This function is in another bank.
+ call HDMATransferTileMapToWRAMBank3 ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
call .loop2
jr nc, .done
@@ -319,7 +319,7 @@ Function241d5: ; 241d5
ret c
ld c, 1
ld b, 3
- call Function10062d ; BUG: This function is in another bank.
+ call AdvanceMobileInactivityTimerAndCheckExpired ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
ret c
callba Function100337
@@ -836,8 +836,8 @@ _InitVerticalMenuCursor:: ; 2446d
ld [hli], a
; wCursorOffCharacter, wCursorCurrentTile
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ret
; 244c3
diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm
index 4b7f03bfb..7e8136235 100755
--- a/engine/mon_icons.asm
+++ b/engine/mon_icons.asm
@@ -38,11 +38,11 @@ LoadMenuMonIcon: ; 8e83f
.Jumptable: ; 8e854 (23:6854)
- dw Function8e8d5 ; party menu
- dw Function8e961 ; naming screen
- dw Function8e97d ; moves (?)
+ dw PartyMenu_InitAnimatedMonIcon ; party menu
+ dw NamingScreen_InitAnimatedMonIcon ; naming screen
+ dw MoveList_InitAnimatedMonIcon ; moves (?)
dw Trade_LoadMonIconGFX ; trade
- dw Function8e898 ; mobile
+ dw Mobile_InitAnimatedMonIcon ; mobile
dw Mobile_InitPartyMenuBGPal71 ; mobile
dw .GetPartyMenuMonIcon ; unused
@@ -84,8 +84,8 @@ LoadMenuMonIcon: ; 8e83f
ld [hl], a
ret
-Function8e898: ; 8e898 (23:6898)
- call Function8e8d5
+Mobile_InitAnimatedMonIcon: ; 8e898 (23:6898)
+ call PartyMenu_InitAnimatedMonIcon
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld a, SPRITE_ANIM_SEQ_NULL
@@ -121,7 +121,7 @@ Mobile_InitPartyMenuBGPal71: ; 8e8b1 (23:68b1)
ld [wc608 + 1], a
ret
-Function8e8d5: ; 8e8d5 (23:68d5)
+PartyMenu_InitAnimatedMonIcon: ; 8e8d5 (23:68d5)
call InitPartyMenuIcon
call .SpawnItemIcon
call SetPartyMonIconAnimSpeed
@@ -144,11 +144,11 @@ Function8e8d5: ; 8e8d5 (23:68d5)
pop bc
pop hl
jr c, .mail
- ld a, $3
+ ld a, SPRITE_ANIM_FRAMESET_03
jr .okay
.mail
- ld a, $2
+ ld a, SPRITE_ANIM_FRAMESET_02
.okay
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
@@ -169,9 +169,10 @@ InitPartyMenuIcon: ; 8e908 (23:6908)
call GetMemIconGFX
ld a, [hObjectStructIndexBuffer]
; y coord
-rept 4
add a
-endr
+ add a
+ add a
+ add a
add $1c
ld d, a
; x coord
@@ -217,7 +218,7 @@ SetPartyMonIconAnimSpeed: ; 8e936 (23:6936)
db $00, $40, $80
; 8e961
-Function8e961: ; 8e961 (23:6961)
+NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961)
ld a, [wd265]
call ReadMonMenuIcon
ld [CurIcon], a
@@ -231,7 +232,7 @@ Function8e961: ; 8e961 (23:6961)
ld [hl], SPRITE_ANIM_SEQ_NULL
ret
-Function8e97d: ; 8e97d (23:697d)
+MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d)
ld a, [wd265]
call ReadMonMenuIcon
ld [CurIcon], a
diff --git a/engine/move_mon.asm b/engine/move_mon.asm
index 310eab8c2..e07237d68 100755
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -266,15 +266,15 @@ endr
ld [de], a
inc de
ld hl, EnemyMonStatus
- ; Copy EnemyMonStatus
+ ; Copy EnemyMonStatus
ld a, [hli]
ld [de], a
inc de
- ; Copy EnemyMonUnused
+ ; Copy EnemyMonUnused
ld a, [hli]
ld [de], a
inc de
- ; Copy EnemyMonHP
+ ; Copy EnemyMonHP
ld a, [hli]
ld [de], a
inc de
@@ -452,8 +452,8 @@ SentGetPkmnIntoFromBox: ; db3f
ld hl, wBreedMon1Species
jr z, .breedmon
- ; we want to sent a Pkmn into the Box
- ; so check if there's enough space
+ ; we want to sent a Pkmn into the Box
+ ; so check if there's enough space
ld hl, sBoxCount
ld a, [hl]
cp MONS_PER_BOX
@@ -654,7 +654,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld a, [sBoxCount]
dec a
ld b, a
- call Functiondcb6
+ call RestorePPofDepositedPokemon
.CloseSRAM_And_ClearCarryFlag:
call CloseSRAM
and a
@@ -667,7 +667,7 @@ CloseSRAM_And_SetCarryFlag: ; dcb1
ret
; dcb6
-Functiondcb6: ; dcb6
+RestorePPofDepositedPokemon: ; dcb6
ld a, b
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
@@ -696,10 +696,10 @@ Functiondcb6: ; dcb6
ld a, [MonType]
push af
ld b, 0
-.asm_dcec
+.loop
ld a, [hli]
and a
- jr z, .asm_dd18
+ jr z, .done
ld [TempMonMoves], a
ld a, BOXMON
ld [MonType], a
@@ -722,9 +722,9 @@ Functiondcb6: ; dcb6
inc b
ld a, b
cp NUM_MOVES
- jr c, .asm_dcec
+ jr c, .loop
-.asm_dd18
+.done
pop af
ld [MonType], a
pop af
@@ -973,7 +973,7 @@ SentPkmnIntoBox: ; de6e
ld [de], a
inc de
- ; Set all 5 Experience Values to 0
+ ; Set all 5 Experience Values to 0
xor a
ld b, 2 * 5
.loop2
@@ -1025,7 +1025,7 @@ SentPkmnIntoBox: ; de6e
call CopyBytes
ld b, 0
- call Functiondcb6
+ call RestorePPofDepositedPokemon
call CloseSRAM
scf
@@ -1459,9 +1459,9 @@ CalcPkmnStatC: ; e17b
ld a, [hl]
swap a
and $1
-rept 3
add a
-endr
+ add a
+ add a
ld b, a
ld a, [hli]
and $1
diff --git a/engine/move_mon_wo_mail.asm b/engine/move_mon_wo_mail.asm
new file mode 100755
index 000000000..d3b4e78a5
--- /dev/null
+++ b/engine/move_mon_wo_mail.asm
@@ -0,0 +1,133 @@
+InsertPokemonIntoBox: ; 51322
+ ld a, BANK(sBoxCount)
+ call GetSRAMBank
+ ld hl, sBoxCount
+ call InsertSpeciesIntoBoxOrParty
+ ld a, [sBoxCount]
+ dec a
+ ld [wd265], a
+ ld hl, sBoxMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ ld de, wBufferMonNick
+ call InsertDataIntoBoxOrParty
+ ld a, [sBoxCount]
+ dec a
+ ld [wd265], a
+ ld hl, sBoxMonOT
+ ld bc, NAME_LENGTH
+ ld de, wBufferMonOT
+ call InsertDataIntoBoxOrParty
+ ld a, [sBoxCount]
+ dec a
+ ld [wd265], a
+ ld hl, sBoxMons
+ ld bc, BOXMON_STRUCT_LENGTH
+ ld de, wBufferMon
+ call InsertDataIntoBoxOrParty
+ ld hl, wBufferMonMoves
+ ld de, TempMonMoves
+ ld bc, NUM_MOVES
+ call CopyBytes
+ ld hl, wBufferMonPP
+ ld de, TempMonPP
+ ld bc, NUM_MOVES
+ call CopyBytes
+ ld a, [CurPartyMon]
+ ld b, a
+ callba RestorePPofDepositedPokemon
+ jp CloseSRAM
+
+InsertPokemonIntoParty: ; 5138b
+ ld hl, PartyCount
+ call InsertSpeciesIntoBoxOrParty
+ ld a, [PartyCount]
+ dec a
+ ld [wd265], a
+ ld hl, PartyMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ ld de, wBufferMonNick
+ call InsertDataIntoBoxOrParty
+ ld a, [PartyCount]
+ dec a
+ ld [wd265], a
+ ld hl, PartyMonOT
+ ld bc, NAME_LENGTH
+ ld de, wBufferMonOT
+ call InsertDataIntoBoxOrParty
+ ld a, [PartyCount]
+ dec a
+ ld [wd265], a
+ ld hl, PartyMons
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld de, wBufferMon
+ call InsertDataIntoBoxOrParty
+ ret
+
+InsertSpeciesIntoBoxOrParty: ; 513cb
+ inc [hl]
+ inc hl
+ ld a, [CurPartyMon]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ ld a, [CurPartySpecies]
+ ld c, a
+.loop
+ ld a, [hl]
+ ld [hl], c
+ inc hl
+ inc c
+ ld c, a
+ jr nz, .loop
+ ret
+
+InsertDataIntoBoxOrParty: ; 513e0
+ push de
+ push hl
+ push bc
+ ld a, [wd265]
+ dec a
+ call AddNTimes
+ push hl
+ add hl, bc
+ ld d, h
+ ld e, l
+ pop hl
+.loop
+ push bc
+ ld a, [wd265]
+ ld b, a
+ ld a, [CurPartyMon]
+ cp b
+ pop bc
+ jr z, .insert
+ push hl
+ push de
+ push bc
+ call CopyBytes
+ pop bc
+ pop de
+ pop hl
+ push hl
+ ld a, l
+ sub c
+ ld l, a
+ ld a, h
+ sbc b
+ ld h, a
+ pop de
+ ld a, [wd265]
+ dec a
+ ld [wd265], a
+ jr .loop
+
+.insert
+ pop bc
+ pop hl
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld d, h
+ ld e, l
+ pop hl
+ call CopyBytes
+ ret
diff --git a/engine/movement.asm b/engine/movement.asm
index 5a05aab49..7b58e4023 100644
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -55,8 +55,8 @@ MovementPointers: ; 5075
dw Movement_fast_jump_step_up ; 35
dw Movement_fast_jump_step_left ; 36
dw Movement_fast_jump_step_right ; 37
- dw Movement_remove_sliding ; 38
- dw Movement_set_sliding ; 39
+ dw Movement_remove_sliding ; 38
+ dw Movement_set_sliding ; 39
dw Movement_remove_fixed_facing ; 3a
dw Movement_fix_facing ; 3b
dw Movement_show_person ; 3c
@@ -85,10 +85,10 @@ MovementPointers: ; 5075
dw Movement_hide_emote ; 53
dw Movement_show_emote ; 54
dw Movement_step_shake ; 55
- dw Movement_tree_shake ; 56
+ dw Movement_tree_shake ; 56
dw Movement_rock_smash ; 57
dw Movement_return_dig ; 58
- dw Movement_skyfall_top ; 59
+ dw Movement_skyfall_top ; 59
; 5129
@@ -365,7 +365,7 @@ Movement_tree_shake: ; 5279
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_0B
+ ld [hl], PERSON_ACTION_WEIRD_TREE
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
diff --git a/engine/mysterygift.asm b/engine/mysterygift.asm
index 5e6d317ba..f2d29b08a 100755
--- a/engine/mysterygift.asm
+++ b/engine/mysterygift.asm
@@ -2,13 +2,13 @@ DoMysteryGift: ; 1048ba (41:48ba)
call ClearTileMap
call ClearSprites
call WaitBGMap
- call Function105153
+ call InitMysteryGiftLayout
hlcoord 3, 8
ld de, .String_PressAToLink_BToCancel
call PlaceString
call WaitBGMap
- callba Function2c642
- call Function1050fb
+ callba PrepMysteryGiftDataToSend
+ call MysteryGift_ClearTrainerData
ld a, $2
ld [wca01], a
ld a, $14
@@ -27,7 +27,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
call ClearTileMap
call EnableLCD
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
pop de
@@ -63,7 +63,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
jr z, .skip_append_save
call .SaveMysteryGiftTrainerName
callba RestoreMobileEventIndex
- callba MobileFn_1060a9
+ callba TrainerRankings_MysteryGift
callba BackupMobileEventIndex
.skip_append_save
ld a, [wMysteryGiftPartnerSentDeco]
@@ -239,14 +239,16 @@ Function104a95: ; 104a95 (41:4a95)
di
callba ClearChannels
call Function104d5e
+
.loop2
call Function104d96
call Function104ddd
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $10
jp z, Function104bd0
cp $6c
jr nz, .loop2
+
ld a, [hPrintNum9]
cp $2
jr z, Function104b22
@@ -256,7 +258,8 @@ Function104a95: ; 104a95 (41:4a95)
jr nz, .ly_loop
call Function104b49
jp nz, Function104bd0
- jr asm_104b0a
+ jr Function104b0a
+ ; Delay frame
.ly_loop
ld a, [rLY]
cp $90
@@ -264,12 +267,15 @@ Function104a95: ; 104a95 (41:4a95)
ld c, rRP % $100
ld a, $c0
ld [$ff00+c], a
- ld b, $f0
+ ld b, 240 ; This might have been intended as a 4-second timeout buffer.
+ ; However, it is reset with each frame.
.loop3
push bc
- call Function105038
+ call MysteryGift_ReadJoypad
+
ld b, $2
ld c, rRP % $100
+ ; Delay frame
.ly_loop2
ld a, [$ff00+c]
and b
@@ -284,24 +290,25 @@ Function104a95: ; 104a95 (41:4a95)
ld a, [rLY]
cp $90
jr c, .ly_loop3
+
ld a, b
pop bc
dec b
- jr z, .loop2
+ jr z, .loop2 ; we never jump here
or a
jr nz, .loop2
- ld a, [hMoneyTemp + 1]
- bit 1, a
+ ; Check if we've pressed the B button
+ ld a, [hMGJoypadReleased]
+ bit B_BUTTON_F, a
jr z, .loop3
ld a, $10
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
jp Function104bd0
Function104b04: ; 104b04 (41:4b04)
call Function104b40
jp nz, Function104bd0
-
-asm_104b0a: ; 104b0a (41:4b0a)
+Function104b0a: ; 104b0a (41:4b0a)
call Function104d38
jp nz, Function104bd0
call Function104b88
@@ -331,7 +338,7 @@ Function104b40: ; 104b40 (41:4b40)
Function104b49: ; 104b49 (41:4b49)
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -346,7 +353,7 @@ Function104b49: ; 104b49 (41:4b49)
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -357,7 +364,7 @@ Function104b49: ; 104b49 (41:4b49)
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
@@ -369,7 +376,7 @@ Function104b88: ; 104b88 (41:4b88)
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -379,7 +386,7 @@ Function104b88: ; 104b88 (41:4b88)
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -393,29 +400,29 @@ Function104b88: ; 104b88 (41:4b88)
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104bd0: ; 104bd0 (41:4bd0)
nop
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $10
- jr z, .asm_104c18
+ jr z, .quit
cp $6c
- jr nz, .asm_104c18
+ jr nz, .quit
ld hl, wca01
dec [hl]
- jr z, .asm_104c18
+ jr z, .quit
ld hl, wMysteryGiftTrainerData
ld de, wMysteryGiftPartnerData
ld bc, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData
call CopyBytes
ld a, [wMysteryGiftTrainerData]
cp $3
- jr nc, .asm_104c18
+ jr nc, .quit
callba StagePartyDataForMysteryGift
- call Function1050fb
+ call MysteryGift_ClearTrainerData
ld a, $26
ld [wca02], a
ld a, [hPrintNum9]
@@ -424,12 +431,14 @@ Function104bd0: ; 104bd0 (41:4bd0)
call Function104d43
jr nz, Function104bd0
jp Function104b04
+
.asm_104c10
call Function104d38
jr nz, Function104bd0
jp Function104b22
-.asm_104c18
- ld a, [hPrintNum10]
+
+.quit
+ ld a, [hMGStatusFlags]
push af
call Function104da0
xor a
@@ -449,7 +458,7 @@ Function104c2d: ; 104c2d (41:4c2d)
.asm_104c37
call Function104d96
call Function104ddd
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $10
jp z, Function104d1c
cp $6c
@@ -485,7 +494,7 @@ Function104c8a: ; 104c8a (41:4c8a)
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -500,7 +509,7 @@ Function104c8a: ; 104c8a (41:4c8a)
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -511,7 +520,7 @@ Function104c8a: ; 104c8a (41:4c8a)
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
@@ -523,7 +532,7 @@ Function104cd2: ; 104cd2 (41:4cd2)
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -533,7 +542,7 @@ Function104cd2: ; 104cd2 (41:4cd2)
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -548,13 +557,13 @@ Function104cd2: ; 104cd2 (41:4cd2)
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104d1c: ; 104d1c (41:4d1c)
nop
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
push af
call Function104da0
xor a
@@ -569,33 +578,33 @@ Function104d1c: ; 104d1c (41:4d1c)
Function104d32: ; 104d32 (41:4d32)
ld a, $80
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
and a
ret
Function104d38: ; 104d38 (41:4d38)
call Function104d96
call Function104e46
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104d43: ; 104d43 (41:4d43)
call Function104d96
call Function104dfe
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104d4e: ; 104d4e (41:4d4e)
call Function104e93
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104d56: ; 104d56 (41:4d56)
call Function104f57
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
@@ -704,19 +713,19 @@ Function104ddd: ; 104ddd (41:4ddd)
ld a, $1
ld [hPrintNum9], a
.loop
- call Function105038
+ call MysteryGift_ReadJoypad
ld b, $2
ld c, rRP % $100
- ld a, [hMoneyTemp + 1]
- bit 1, a
+ ld a, [hMGJoypadReleased]
+ bit B_BUTTON_F, a
jr z, .next
ld a, $10
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
.next
bit 0, a
- jr nz, asm_104e3a
+ jr nz, Function104e3a
ld a, [$ff00+c]
and b
jr nz, .loop
@@ -735,7 +744,7 @@ Function104dfe: ; 104dfe (41:4dfe)
call Function104da9
jp z, Function104f42
ld a, $6c
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ld d, $3d
call Function104dd1
ld d, $5
@@ -748,17 +757,17 @@ Function104dfe: ; 104dfe (41:4dfe)
call Function104dd1
ret
-asm_104e3a: ; 104e3a (41:4e3a)
+Function104e3a: ; 104e3a (41:4e3a)
+ ; Wait a random amount of time
call Random
ld e, a
and $f
ld d, a
-.asm_104e41
+.loop
dec de
ld a, d
or e
- jr nz, .asm_104e41
-
+ jr nz, .loop
Function104e46: ; 104e46 (41:4e46)
ld a, $2
ld [hPrintNum9], a
@@ -788,13 +797,13 @@ Function104e46: ; 104e46 (41:4e46)
ld d, $3d
call Function104dd1
ld a, $6c
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104e8c: ; 104e8c (41:4e8c)
ld [rRP], a
ld a, $ff
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104e93: ; 104e93 (41:4e93)
@@ -824,7 +833,7 @@ Function104e93: ; 104e93 (41:4e93)
ld hl, hPrintNum2 ; $ffb4 (aliases: hMultiplicand)
ld b, $2
call Function104ed6
- ld hl, hPrintNum10
+ ld hl, hMGStatusFlags
ld b, $1
call Function104faf
ld a, [hPrintNum2]
@@ -902,21 +911,21 @@ Function104ed6: ; 104ed6 (41:4ed6)
ret
Function104f42: ; 104f42 (41:4f42)
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
or $2
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104f49: ; 104f49 (41:4f49)
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
or $1
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104f50: ; 104f50 (41:4f50)
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
or $80
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104f57: ; 104f57 (41:4f57)
@@ -960,7 +969,7 @@ Function104f57: ; 104f57 (41:4f57)
push de
ld d, $3d
call Function104dd1
- ld hl, hPrintNum10
+ ld hl, hMGStatusFlags
ld b, $1
call Function104ed6
pop de
@@ -986,7 +995,7 @@ Function104faf: ; 104faf (41:4faf)
cpl
ld b, a
xor a
- ld [hMoneyTemp + 2], a
+ ld [hMGJoypadPressed + 2], a
call Function104d86
.asm_104fd2
inc b
@@ -1009,10 +1018,10 @@ Function104faf: ; 104faf (41:4faf)
bit 1, a
jr nz, .asm_104fe5
.asm_104fed
- ld a, [hMoneyTemp + 2]
+ ld a, [hMGJoypadPressed + 2]
ld d, a
ld a, [rTIMA]
- ld [hMoneyTemp + 2], a
+ ld [hMGJoypadPressed + 2], a
sub d
cp $12
jr c, .asm_104ffd
@@ -1058,31 +1067,48 @@ Function105033: ; 105033 (41:5033)
ld b, $0
jp Function104f57
-Function105038: ; 105038 (41:5038)
- ld a, $20
+MysteryGift_ReadJoypad: ; 105038 (41:5038)
+; We can only get four inputs at a time.
+; We take d-pad first for no particular reason.
+ ld a, R_DPAD
ld [rJOYP], a
+; Read twice to give the request time to take.
ld a, [rJOYP]
ld a, [rJOYP]
+
+; The Joypad register output is in the lo nybble (inversed).
+; We make the hi nybble of our new container d-pad input.
cpl
and $f
swap a
+
+; We'll keep this in b for now.
ld b, a
- ld a, $10
+
+; Buttons make 8 total inputs (A, B, Select, Start).
+; We can fit this into one byte.
+ ld a, R_BUTTONS
ld [rJOYP], a
+; Wait for input to stabilize.
rept 6
ld a, [rJOYP]
endr
+; Buttons take the lo nybble.
cpl
and $f
or b
ld c, a
- ld a, [hMoneyTemp]
+; To get the delta we xor the last frame's input with the new one.
+ ld a, [hMGJoypadPressed]
xor c
+; Released this frame:
and c
- ld [hMoneyTemp + 1], a
+ ld [hMGJoypadReleased], a
+; Pressed this frame:
ld a, c
- ld [hMoneyTemp], a
+ ld [hMGJoypadPressed], a
ld a, $30
+; Reset the joypad register since we're done with it.
ld [rJOYP], a
ret
@@ -1179,7 +1205,7 @@ RestoreMysteryGift: ; 1050ea (41:50ea)
ld [de], a
jp CloseSRAM
-Function1050fb: ; 1050fb (41:50fb)
+MysteryGift_ClearTrainerData: ; 1050fb (41:50fb)
ld hl, wMysteryGiftTrainerData
xor a
ld b, wMysteryGiftTrainerDataEnd - wMysteryGiftTrainerData
@@ -1247,7 +1273,7 @@ StagePartyDataForMysteryGift: ; 10510b (41:510b)
ld [wca00], a
jp CloseSRAM
-Function105153: ; 105153 (41:5153)
+InitMysteryGiftLayout: ; 105153 (41:5153)
call ClearBGPalettes
call DisableLCD
ld hl, MysteryGiftGFX
@@ -1333,7 +1359,7 @@ Function105153: ; 105153 (41:5153)
ld [hl], $41
call EnableLCD
call WaitBGMap
- ld b, SCGB_1D
+ ld b, SCGB_MYSTERY_GIFT
call GetSGBLayout
call SetPalettes
ret
@@ -1398,7 +1424,7 @@ Function105688: ; 105688 (41:5688)
call PlaceString
call WaitBGMap
call Function10578c
- call Function1050fb
+ call MysteryGift_ClearTrainerData
ld a, $24
ld [wca02], a
ld a, [rIE]
@@ -1511,7 +1537,7 @@ Function105777: ; 105777 (41:5777)
call ClearTileMap
call EnableLCD
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ret
diff --git a/engine/mysterygift2.asm b/engine/mysterygift2.asm
index 4fad773e1..4048ea533 100755
--- a/engine/mysterygift2.asm
+++ b/engine/mysterygift2.asm
@@ -1,4 +1,4 @@
-Function2c642: ; 2c642 (b:4642)
+PrepMysteryGiftDataToSend: ; 2c642 (b:4642)
ld de, wMysteryGiftStaging
ld a, $1
ld [de], a
diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm
index d9fe253fb..d80b4717b 100755
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -43,7 +43,7 @@ NamingScreen: ; 116c1
.SetUpNamingScreen: ; 116f8
call ClearBGPalettes
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call DisableLCD
call LoadNamingScreenGFX
@@ -65,9 +65,8 @@ NamingScreen: ; 116c1
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -401,9 +400,8 @@ NamingScreenJoypadLoop: ; 11915
ld e, a
ld d, $0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -662,9 +660,8 @@ NamingScreen_AnimateCursor: ; 11a3b (4:5a3b)
jr nz, .asm_11ade
ld a, $4
.asm_11ade
-rept 2
dec a
-endr
+ dec a
ld e, a
add a
add e
@@ -989,15 +986,15 @@ BoxNameInputUpper:
; 11e5d
GFX_11e5d: ; ????
-INCBIN "gfx/unknown/011e5d.2bpp"
+INCBIN "gfx/unknown/011e5d.1bpp"
; 11e6d
NamingScreenGFX_MiddleLine:
-INCBIN "gfx/unknown/011e65.2bpp"
+INCBIN "gfx/unknown/011e65.1bpp"
; 11e6d
NamingScreenGFX_UnderLine: ; 11e6d
-INCBIN "gfx/unknown/011e6d.2bpp"
+INCBIN "gfx/unknown/011e6d.1bpp"
; 11e75
_ComposeMailMessage: ; 11e75 (mail?)
@@ -1052,7 +1049,7 @@ _ComposeMailMessage: ; 11e75 (mail?)
ld a, $e3
ld [rLCDC], a
call .initwNamingScreenMaxNameLength
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call WaitBGMap
call WaitTop
@@ -1164,9 +1161,8 @@ INCBIN "gfx/icon/mail2.2bpp"
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1391,9 +1387,8 @@ ComposeMail_AnimateCursor: ; 120c1 (4:60c1)
jr nz, .wrap_around_command_left
ld a, $4
.wrap_around_command_left
-rept 2
dec a
-endr
+ dec a
ld e, a
add a
add e
@@ -1476,9 +1471,8 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac)
jr nz, .asm_121c3
push hl
ld hl, wNamingScreenCurrNameLength
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .asm_121c8
.asm_121c3
diff --git a/engine/npc_movement.asm b/engine/npc_movement.asm
index 097c62017..f9ce7b04e 100755
--- a/engine/npc_movement.asm
+++ b/engine/npc_movement.asm
@@ -320,7 +320,7 @@ IsNPCAtCoord: ; 7041
xor a
.loop
ld [hObjectStructIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS1
@@ -490,7 +490,7 @@ Function7113: ; unreferenced
xor a
.loop
ld [hObjectStructIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
diff --git a/engine/npctrade.asm b/engine/npctrade.asm
index a8d3b71aa..f28734ea9 100755
--- a/engine/npctrade.asm
+++ b/engine/npctrade.asm
@@ -311,9 +311,8 @@ GetTradeAttribute: ; 0xfcdc2
ld e, a
ld d, 0
ld hl, NPCTrades
-rept 2
add hl, de
-endr
+ add hl, de
pop de
add hl, de
ret
@@ -458,9 +457,8 @@ PrintTradeText: ; fcf38
call AddNTimes
ld a, [wcf64]
ld c, a
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/engine/options_menu.asm b/engine/options_menu.asm
index 00799395a..68c1883ee 100755
--- a/engine/options_menu.asm
+++ b/engine/options_menu.asm
@@ -32,7 +32,7 @@ _OptionsMenu: ; e41d0
inc a
ld [hBGMapMode], a
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
@@ -85,9 +85,8 @@ GetOptionPointer: ; e42d6
ld e, a ; copy it to de
ld d, 0
ld hl, .Pointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -143,9 +142,8 @@ Options_TextSpeed: ; e42f5
.NonePressed:
ld b, 0
ld hl, .Strings
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
@@ -363,9 +361,8 @@ Options_Print: ; e4424
.NonePressed:
ld b, $0
ld hl, .Strings
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
diff --git a/engine/overworld.asm b/engine/overworld.asm
index 5e12b09a2..4d22e55b6 100755
--- a/engine/overworld.asm
+++ b/engine/overworld.asm
@@ -23,7 +23,7 @@ Function14146: ; mobile
push af
res 7, [hl]
set 6, [hl]
- call RunCallback_04
+ call MapCallbackSprites_LoadUsedSpritesGFX
pop af
ld [wSpriteFlags], a
ret
@@ -35,7 +35,7 @@ Function14157: ; mobile
push af
set 7, [hl]
res 6, [hl]
- call RunCallback_04
+ call MapCallbackSprites_LoadUsedSpritesGFX
pop af
ld [wSpriteFlags], a
ret
@@ -43,7 +43,7 @@ Function14157: ; mobile
RefreshSprites:: ; 14168
call .Refresh
- call RunCallback_04
+ call MapCallbackSprites_LoadUsedSpritesGFX
ret
; 1416f
@@ -147,9 +147,8 @@ AddOutdoorSprites: ; 141ee
ld c, a
ld b, 0
ld hl, OutdoorSprites
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -165,7 +164,7 @@ endr
; 14209
-RunCallback_04: ; 14209
+MapCallbackSprites_LoadUsedSpritesGFX: ; 14209
ld a, MAPCALLBACK_SPRITES
call RunMapCallback
call GetUsedSprites
@@ -364,9 +363,8 @@ AddSpriteGFX: ; 142e5
jr z, .exists
and a
jr z, .new
-rept 2
inc hl
-endr
+ inc hl
dec c
jr nz, .loop
@@ -428,9 +426,8 @@ SortUsedSprites: ; 1431e
ld a, [de]
and a
jr nz, .FoundLastSprite
-rept 2
dec de
-endr
+ dec de
dec c
jr nz, .FindLastSprite
.FoundLastSprite:
@@ -472,16 +469,14 @@ endr
; Keep doing this until everything's in order.
.loop
-rept 2
dec de
-endr
+ dec de
dec c
jr nz, .CheckFollowing
pop hl
-rept 2
inc hl
-endr
+ inc hl
pop de
pop bc
dec c
diff --git a/engine/pack.asm b/engine/pack.asm
index ff80dce23..19b7fccbf 100644
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -1252,9 +1252,8 @@ Pack_JumptableNext: ; 10866 (4:4866)
Pack_GetJumptablePointer: ; 1086b
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1300,9 +1299,8 @@ DrawPackGFX: ; 1089d
jr nz, .female
.male_dude
ld hl, PackGFXPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
diff --git a/engine/party_menu.asm b/engine/party_menu.asm
index 934e1458a..266451c37 100644
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -20,7 +20,7 @@ SelectTradeOrDaycareMon: ; 5001d
call ClearBGPalettes
call InitPartyMenuLayout
call WaitBGMap
- ld b, SCGB_0A
+ ld b, SCGB_PARTY_MENU
call GetSGBLayout
call SetPalettes
call DelayFrame
@@ -110,9 +110,8 @@ PlacePartyNicknames: ; 5009b
jr nz, .loop
.end
-rept 2
dec hl
-endr
+ dec hl
ld de, .CANCEL
call PlaceString
ret
@@ -161,7 +160,7 @@ PlacePartyHPBar: ; 500cf
inc b
dec c
jr nz, .loop
- ld b, SCGB_0A
+ ld b, SCGB_PARTY_MENU
call GetSGBLayout
ret
; 50117
@@ -219,9 +218,8 @@ PlacePartyMenuHPDigits: ; 50138
pop de
ld a, "/"
ld [hli], a
-rept 2
inc de
-endr
+ inc de
lb bc, 2, 3
call PrintNum
@@ -390,9 +388,8 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f
ld e, a
ld d, 0
ld hl, EvosAttacksPointers
-rept 2
add hl, de
-endr
+ add hl, de
call .DetermineCompatibility
pop hl
call PlaceString
@@ -426,19 +423,16 @@ endr
ld a, [hli]
and a
jr z, .nope
-rept 2
inc hl
-endr
+ inc hl
cp EVOLVE_ITEM
jr nz, .loop2
-rept 2
dec hl
-endr
+ dec hl
ld a, [CurItem]
cp [hl]
-rept 2
inc hl
-endr
+ inc hl
jr nz, .loop2
ld de, .string_able
ret
@@ -613,9 +607,8 @@ GetPartyMenuTilemapPointers: ; 50396
ld e, a
ld d, 0
ld hl, .Pointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -794,9 +787,8 @@ PrintPartyMenuText: ; 5049a
ld hl, PartyMenuStrings
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@@ -932,9 +924,8 @@ PrintPartyMenuActionText: ; 50566
.PrintText: ; 505c1
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/engine/phone.asm b/engine/phone.asm
index 7f96dd2c3..f5f39218d 100644
--- a/engine/phone.asm
+++ b/engine/phone.asm
@@ -266,9 +266,8 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136)
jr nc, .NoPhoneCall
call .DoSpecialPhoneCall
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld e, a
push hl
@@ -472,7 +471,7 @@ UnknownScript_0x90261: ; 0x90261
RingTwice_StartCall: ; 9026f
call .Ring
call .Ring
- callba MobileFn_1060d3
+ callba TrainerRankings_PhoneCalls
ret
; 9027c
@@ -501,7 +500,7 @@ PhoneCall:: ; 9029a
ld [PhoneCallerHi], a
call Phone_FirstOfTwoRings
call Phone_FirstOfTwoRings
- callba MobileFn_1060d3
+ callba TrainerRankings_PhoneCalls
ret
; 902b3
@@ -520,9 +519,8 @@ Phone_CallerTextboxWithName2: ; 902c9
call Phone_CallerTextbox
hlcoord 1, 2
ld [hl], $62
-rept 2
inc hl
-endr
+ inc hl
ld a, [PhoneScriptBank]
ld b, a
ld a, [PhoneCallerLo]
@@ -621,9 +619,8 @@ Function90363: ; 90363 (24:4363)
call Phone_CallerTextbox
hlcoord 1, 1
ld [hl], $62
-rept 2
inc hl
-endr
+ inc hl
ld d, h
ld e, l
pop bc
@@ -699,9 +696,8 @@ GetCallerName: ; 903a9 (24:43a9)
ld c, b
ld b, 0
ld hl, NonTrainerCallerNames
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
diff --git a/engine/player_movement.asm b/engine/player_movement.asm
index d02d1e5b2..2f6660135 100755
--- a/engine/player_movement.asm
+++ b/engine/player_movement.asm
@@ -1,7 +1,7 @@
DoPlayerMovement:: ; 80000
call .GetDPad
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
ld [MovementAnimation], a
xor a
ld [wd041], a
@@ -233,12 +233,12 @@ DoPlayerMovement:: ; 80000
; If the player is turning, change direction first. This also lets
; the player change facing without moving by tapping a direction.
- ld a, [wd04e]
+ ld a, [wPlayerTurningDirection]
cp 0
- jr nz, .asm_80169
+ jr nz, .not_turning
ld a, [WalkingDirection]
cp STANDING
- jr z, .asm_80169
+ jr z, .not_turning
ld e, a
ld a, [PlayerDirection]
@@ -246,7 +246,7 @@ DoPlayerMovement:: ; 80000
rrca
and 3
cp e
- jr z, .asm_80169
+ jr z, .not_turning
ld a, STEP_TURN
call .DoStep
@@ -254,7 +254,7 @@ DoPlayerMovement:: ; 80000
scf
ret
-.asm_80169
+.not_turning
xor a
ret
; 8016b
@@ -465,10 +465,10 @@ DoPlayerMovement:: ; 80000
ld a, [hl]
ld [MovementAnimation], a
- ld hl, .InPlace
+ ld hl, .FinishFacing
add hl, de
ld a, [hl]
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ld a, 4
ret
@@ -481,54 +481,54 @@ DoPlayerMovement:: ; 80000
dw .SlideStep
dw .TurningStep
dw .BackJumpStep
- dw .InPlace
+ dw .FinishFacing
.SlowStep:
- slow_step_down
- slow_step_up
- slow_step_left
- slow_step_right
+ slow_step DOWN
+ slow_step UP
+ slow_step LEFT
+ slow_step RIGHT
.NormalStep:
- step_down
- step_up
- step_left
- step_right
+ step DOWN
+ step UP
+ step LEFT
+ step RIGHT
.FastStep:
- big_step_down
- big_step_up
- big_step_left
- big_step_right
+ big_step DOWN
+ big_step UP
+ big_step LEFT
+ big_step RIGHT
.JumpStep:
- jump_step_down
- jump_step_up
- jump_step_left
- jump_step_right
+ jump_step DOWN
+ jump_step UP
+ jump_step LEFT
+ jump_step RIGHT
.SlideStep:
- fast_slide_step_down
- fast_slide_step_up
- fast_slide_step_left
- fast_slide_step_right
+ fast_slide_step DOWN
+ fast_slide_step UP
+ fast_slide_step LEFT
+ fast_slide_step RIGHT
.BackJumpStep:
- jump_step_up
- jump_step_down
- jump_step_right
- jump_step_left
+ jump_step UP
+ jump_step DOWN
+ jump_step RIGHT
+ jump_step LEFT
.TurningStep:
- turn_step_down
- turn_step_up
- turn_step_left
- turn_step_right
-.InPlace:
- db $80 + movement_turn_head_down
- db $80 + movement_turn_head_up
- db $80 + movement_turn_head_left
- db $80 + movement_turn_head_right
+ turn_step DOWN
+ turn_step UP
+ turn_step LEFT
+ turn_step RIGHT
+.FinishFacing:
+ db $80 + DOWN
+ db $80 + UP
+ db $80 + LEFT
+ db $80 + RIGHT
; 802b3
.StandInPlace: ; 802b3
ld a, 0
- ld [wd04e], a
- ld a, movement_step_sleep_1
+ ld [wPlayerTurningDirection], a
+ ld a, movement_step_sleep
ld [MovementAnimation], a
xor a
ret
@@ -536,7 +536,7 @@ DoPlayerMovement:: ; 80000
._WalkInPlace: ; 802bf
ld a, 0
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ld a, movement_step_bump
ld [MovementAnimation], a
xor a
@@ -549,7 +549,7 @@ DoPlayerMovement:: ; 80000
call CheckStandingOnIce
ret nc
- ld a, [wd04e]
+ ld a, [wPlayerTurningDirection]
cp 0
ret z
@@ -812,7 +812,7 @@ DoPlayerMovement:: ; 80000
; 80404
CheckStandingOnIce:: ; 80404
- ld a, [wd04e]
+ ld a, [wPlayerTurningDirection]
cp 0
jr z, .not_ice
cp $f0
@@ -833,14 +833,14 @@ CheckStandingOnIce:: ; 80404
ret
; 80422
-Function80422:: ; 80422
+StopPlayerForEvent:: ; 80422
ld hl, wPlayerNextMovement
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
cp [hl]
ret z
ld [hl], a
ld a, 0
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ret
; 80430
diff --git a/engine/player_object.asm b/engine/player_object.asm
index 930d71b3e..6b38a6328 100755
--- a/engine/player_object.asm
+++ b/engine/player_object.asm
@@ -474,7 +474,7 @@ CopyTempObjectToObjectStruct: ; 8286
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonY
+ ld hl, wPlayerBGMapOffsetY
sub [hl]
ld hl, OBJECT_SPRITE_Y
add hl, de
@@ -492,7 +492,7 @@ CopyTempObjectToObjectStruct: ; 8286
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonX
+ ld hl, wPlayerBGMapOffsetX
sub [hl]
ld hl, OBJECT_SPRITE_X
add hl, de
@@ -516,7 +516,7 @@ CopyTempObjectToObjectStruct: ; 8286
TrainerWalkToPlayer: ; 831e
ld a, [hLastTalked]
call InitMovementBuffer
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
call AppendToMovementBuffer
ld a, [wd03f]
dec a
@@ -598,10 +598,10 @@ Special_SurfStartStep: ; 8379
ret
.movement_data
- slow_step_down
- slow_step_up
- slow_step_left
- slow_step_right
+ slow_step DOWN
+ slow_step UP
+ slow_step LEFT
+ slow_step RIGHT
FollowNotExact:: ; 839e
push bc
@@ -660,7 +660,7 @@ FollowNotExact:: ; 839e
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonX
+ ld hl, wPlayerBGMapOffsetX
sub [hl]
ld hl, OBJECT_SPRITE_X
add hl, de
@@ -673,7 +673,7 @@ FollowNotExact:: ; 839e
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonY
+ ld hl, wPlayerBGMapOffsetY
sub [hl]
ld hl, OBJECT_SPRITE_Y
add hl, de
@@ -827,12 +827,12 @@ QueueFollowerFirstStep: ; 848a
jr z, .check_y
jr c, .left
and a
- ld a, movement_step_right
+ ld a, movement_step + RIGHT
ret
.left
and a
- ld a, movement_step_left
+ ld a, movement_step + LEFT
ret
.check_y
@@ -843,12 +843,12 @@ QueueFollowerFirstStep: ; 848a
jr z, .same_xy
jr c, .up
and a
- ld a, movement_step_down
+ ld a, movement_step + DOWN
ret
.up
and a
- ld a, movement_step_up
+ ld a, movement_step + UP
ret
.same_xy
diff --git a/engine/player_step.asm b/engine/player_step.asm
index 48abcecbc..83158c1b7 100755
--- a/engine/player_step.asm
+++ b/engine/player_step.asm
@@ -26,12 +26,12 @@ _HandlePlayerStep:: ; d497 (3:5497)
ld d, a
ld a, [wPlayerStepVectorY]
ld e, a
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
sub d
- ld [wFollowNotExactPersonX], a
- ld a, [wFollowNotExactPersonY]
+ ld [wPlayerBGMapOffsetX], a
+ ld a, [wPlayerBGMapOffsetY]
sub e
- ld [wFollowNotExactPersonY], a
+ ld [wPlayerBGMapOffsetY], a
ret
ScrollScreen:: ; d4d2 (3:54d2)
@@ -77,7 +77,7 @@ HandlePlayerStep: ; d4e5 (3:54e5)
ret
.mobile ; d509 (3:5509)
- callba MobileFn_10602e
+ callba TrainerRankings_StepCount
ret
.fail2 ; d510 (3:5510)
diff --git a/engine/pokedex.asm b/engine/pokedex.asm
index 761b38874..e61a24964 100644
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -694,9 +694,9 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471)
.show_search_results
ld [wDexListingEnd], a
ld a, [wDexListingScrollOffset]
- ld [wc7e0], a
+ ld [wDexListingScrollOffsetBackup], a
ld a, [wDexListingCursor]
- ld [wc7e1], a
+ ld [wDexListingCursorBackup], a
ld a, [wLastDexEntry]
ld [wcf65], a
xor a
@@ -777,9 +777,9 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562)
ret
.return_to_search_screen
- ld a, [wc7e0]
+ ld a, [wDexListingScrollOffsetBackup]
ld [wDexListingScrollOffset], a
- ld a, [wc7e1]
+ ld a, [wDexListingCursorBackup]
ld [wDexListingCursor], a
ld a, [wcf65]
ld [wLastDexEntry], a
@@ -823,7 +823,7 @@ Pokedex_UpdateUnownMode: ; 405df (10:45df)
call DelayFrame
call Pokedex_CheckSGB
jr nz, .decompress
- callba Function1ddf26
+ callba LoadSGBPokedexGFX2
jr .done
.decompress
@@ -2385,9 +2385,8 @@ Pokedex_ApplyUsualPals: ; 41427
Pokedex_LoadPointer: ; 41432
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/engine/pokegear.asm b/engine/pokegear.asm
index c2e73180a..d180ee875 100755
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -516,7 +516,7 @@ Pokegear_UpdateClock: ; 90f86 (24:4f86)
callba PrintHoursMins
ld hl, .DayText
bccoord 6, 6
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90fa8 (24:4fa8)
@@ -711,7 +711,7 @@ PokegearMap_UpdateLandmarkName: ; 910b4
push de
callba GetLandmarkName
pop de
- callba Function1de2c5
+ callba TownMap_ConvertLineBreakCharacters
hlcoord 8, 0
ld [hl], $34
ret
diff --git a/engine/predef.asm b/engine/predef.asm
index f52127311..73bc937a3 100644
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -12,9 +12,9 @@ GetPredefPointer:: ; 854b
ld e, a
ld d, 0
ld hl, PredefPointers
-rept 3
- add hl,de
-endr
+ add hl, de
+ add hl, de
+ add hl, de
pop de
ld a, [hli]
@@ -64,7 +64,7 @@ PredefPointers:: ; 856b
add_predef CopyPkmnToTempMon
add_predef ListMoves ; $20
add_predef PlaceNonFaintStatus
- add_predef Function50cdb
+ add_predef Predef22
add_predef ListMovePP
add_predef GetGender
add_predef StatsScreenInit
@@ -78,7 +78,7 @@ PredefPointers:: ; 856b
add_predef GetUnownLetter
add_predef LoadPoisonBGPals
add_predef Predef2F
- add_predef Function9853 ; $30
+ add_predef InitSGBBorder ; $30
add_predef Predef_LoadSGBLayout
add_predef _Area
add_predef CheckContestMon
@@ -102,7 +102,7 @@ PredefPointers:: ; 856b
add_predef PlaceStatusString
add_predef LoadMonAnimation
add_predef AnimateFrontpic
- add_predef Functiond0669 ; $48
+ add_predef Predef48 ; $48
add_predef HOF_AnimateFrontpic
- dbw $ff, Function2d43 ; ????
+ dbw $ff, InexplicablyEmptyFunction ; ???
; 864c
diff --git a/engine/printer.asm b/engine/printer.asm
index 876e59efc..7dd2d4f4a 100755
--- a/engine/printer.asm
+++ b/engine/printer.asm
@@ -1,814 +1,227 @@
-Function84000: ; 84000
- ld hl, OverworldMap
- lb bc, 4, 12
- xor a
- call Function842ab
- xor a
- ld [rSB], a
- ld [rSC], a
- ld [wc2d5], a
- ld hl, wc2d4
- set 0, [hl]
- ld a, [GBPrinter]
- ld [wcbfb], a
- xor a
- ld [wJumptableIndex], a
- ret
-; 84022
-
-Function84022: ; 84022
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 84031
-
-
-.Jumptable: ; 84031 (21:4031)
-
- dw Function84077
- dw Function84143
- dw Function84120
- dw Function84099
- dw Function84180
- dw Function8412e
- dw Function840c5
- dw Function84180
- dw Function84120
- dw Function840de
- dw Function84180
- dw Function84120
- dw Function841a1
- dw Function84063
- dw Function8406d
- dw Function84120
- dw Function84103
- dw Function84071
- dw Function841b0
- dw Function841b3
-
-
-Function84059: ; 84059 (21:4059)
- ld hl, wJumptableIndex
- inc [hl]
- ret
-
-Function8405e: ; 8405e (21:405e)
- ld hl, wJumptableIndex
- dec [hl]
- ret
-
-Function84063: ; 84063 (21:4063)
- xor a
- ld [wca89], a
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-Function8406d: ; 8406d (21:406d)
- call Function84059
- ret
-
-Function84071: ; 84071 (21:4071)
- ld a, $1
- ld [wJumptableIndex], a
- ret
-
-Function84077: ; 84077 (21:4077)
- call Function841fb
- ld hl, Unknown_842b7
- call Function841e2
- xor a
- ld [wca8e], a
- ld [wca8f], a
- ld a, [wcf65]
- ld [wca81], a
- call Function84059
- call Function841c3
- ld a, $1
- ld [wcbf8], a
- ret
-
-Function84099: ; 84099 (21:4099)
- call Function841fb
- ld hl, wca81
- ld a, [hl]
- and a
- jr z, Function840c5
- ld hl, Unknown_842c3
- call Function841e2
- call Function84260
- ld a, $80
- ld [wca8e], a
- ld a, $2
- ld [wca8f], a
- call Function84219
- call Function84059
- call Function841c3
- ld a, $2
- ld [wcbf8], a
- ret
-
-Function840c5: ; 840c5 (21:40c5)
- ld a, $6
- ld [wJumptableIndex], a
- ld hl, Unknown_842c9
- call Function841e2
- xor a
- ld [wca8e], a
- ld [wca8f], a
- call Function84059
- call Function841c3
- ret
-
-Function840de: ; 840de (21:40de)
- call Function841fb
- ld hl, Unknown_842bd
- call Function841e2
- call Function84249
- ld a, $4
- ld [wca8e], a
- ld a, $0
- ld [wca8f], a
- call Function84219
- call Function84059
- call Function841c3
- ld a, $3
- ld [wcbf8], a
- ret
-
-Function84103: ; 84103 (21:4103)
- call Function841fb
- ld hl, Unknown_842b7
- call Function841e2
- xor a
- ld [wca8e], a
- ld [wca8f], a
- ld a, [wcf65]
- ld [wca81], a
- call Function84059
- call Function841c3
- ret
-
-Function84120: ; 84120 (21:4120)
- ld hl, wca8b
- inc [hl]
- ld a, [hl]
- cp $6
- ret c
- xor a
- ld [hl], a
- call Function84059
- ret
-
-Function8412e: ; 8412e (21:412e)
- ld hl, wca8b
- inc [hl]
- ld a, [hl]
- cp $6
- ret c
- xor a
- ld [hl], a
- ld hl, wca81
- dec [hl]
- call Function8405e
- call Function8405e
- ret
-
-Function84143: ; 84143 (21:4143)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca88]
- cp $ff
- jr nz, .printer_connected
- ld a, [wca89]
- cp $ff
- jr z, .printer_error
-
-.printer_connected
- ld a, [wca88]
- cp $81
- jr nz, .printer_error
- ld a, [wca89]
- cp $0
- jr nz, .printer_error
- ld hl, wc2d4
- set 1, [hl]
- ld a, $5
- ld [wca8a], a
- call Function84059
- ret
-
-.printer_error
- ld a, $ff
- ld [wca88], a
- ld [wca89], a
- ld a, $e
- ld [wJumptableIndex], a
- ret
-
-Function84180: ; 84180 (21:4180)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca89]
- and $f0
- jr nz, .asm_8419b
- ld a, [wca89]
- and $1
- jr nz, .asm_84197
- call Function84059
- ret
-.asm_84197
- call Function8405e
- ret
-.asm_8419b
- ld a, $12
- ld [wJumptableIndex], a
- ret
-
-Function841a1: ; 841a1 (21:41a1)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca89]
- and $f3
- ret nz
- call Function84059
- ret
-
-Function841b0: ; 841b0 (21:41b0)
- call Function84059
-
-Function841b3: ; 841b3 (21:41b3)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca89]
- and $f0
- ret nz
- xor a
- ld [wJumptableIndex], a
- ret
-
-Function841c3: ; 841c3 (21:41c3)
- ld a, [wc2d5]
- and a
- jr nz, Function841c3
- xor a
- ld [wca8c], a
- ld [wca8d], a
- ld a, $1
- ld [wc2d5], a
- ld a, $88
- ld [rSB], a
- ld a, $1
- ld [rSC], a
- ld a, $81
- ld [rSC], a
- ret
-
-Function841e2: ; 841e2 (21:41e2)
- ld a, [hli]
- ld [wca82], a
- ld a, [hli]
- ld [wca83], a
- ld a, [hli]
- ld [wca84], a
- ld a, [hli]
- ld [wca85], a
- ld a, [hli]
- ld [wca86], a
- ld a, [hl]
- ld [wca87], a
- ret
-
-Function841fb: ; 841fb (21:41fb)
- xor a
- ld hl, wca82
-rept 3
- ld [hli], a
-endr
- ld [hl], a
- ld hl, wca86
- ld [hli], a
- ld [hl], a
- xor a
- ld [wca8e], a
- ld [wca8f], a
- ld hl, OverworldMap
- ld bc, $280
- call Function842ab
- ret
-
-Function84219: ; 84219 (21:4219)
- ld hl, 0
- ld bc, $4
- ld de, wca82
- call Function8423c
- ld a, [wca8e]
- ld c, a
- ld a, [wca8f]
- ld b, a
- ld de, OverworldMap
- call Function8423c
- ld a, l
- ld [wca86], a
- ld a, h
- ld [wca87], a
- ret
-
-Function8423c: ; 8423c (21:423c)
- ld a, [de]
- inc de
- add l
- jr nc, .asm_84242
- inc h
-.asm_84242
- ld l, a
- dec bc
- ld a, c
- or b
- jr nz, Function8423c
- ret
-
-Function84249: ; 84249 (21:4249)
- ld a, $1
- ld [OverworldMap], a
- ld a, [wcbfa]
- ld [wc801], a
- ld a, $e4
- ld [wc802], a
- ld a, [wcbfb]
- ld [wc803], a
- ret
-
-Function84260: ; 84260 (21:4260)
- ld a, [wca81]
- xor $ff
- ld d, a
- ld a, [wcf65]
- inc a
- add d
- ld hl, wca90
- ld de, $28
-.asm_84271
- and a
- jr z, .asm_84278
- add hl, de
- dec a
- jr .asm_84271
-.asm_84278
- ld e, l
- ld d, h
- ld hl, OverworldMap
- ld c, $28
-.asm_8427f
- ld a, [de]
- inc de
- push bc
- push de
- push hl
- swap a
- ld d, a
- and $f0
- ld e, a
- ld a, d
- and $f
- ld d, a
- and $8
- ld a, d
- jr nz, .asm_84297
- or $90
- jr .asm_84299
-.asm_84297
- or $80
-.asm_84299
- ld d, a
- lb bc, $21, 1
- call Request2bpp
- pop hl
- ld de, $10
- add hl, de
- pop de
- pop bc
- dec c
- jr nz, .asm_8427f
- ret
-
-Function842ab: ; 842ab
- push de
- ld e, a
-.asm_842ad
- ld [hl], e
- inc hl
- dec bc
- ld a, c
- or b
- jr nz, .asm_842ad
- ld a, e
- pop de
- ret
-; 842b7
-
-Unknown_842b7: db 1, 0, $00, 0, 1, 0
-Unknown_842bd: db 2, 0, $04, 0, 0, 0
-Unknown_842c3: db 4, 0, $80, 2, 0, 0
-Unknown_842c9: db 4, 0, $00, 0, 4, 0
-Unknown_842cf: db 8, 0, $00, 0, 8, 0 ; unused
-Unknown_842d5: db 15, 0, $00, 0, 15, 0 ; unused
-; 842db
-
-
-_PrinterReceive:: ; 842db
- ld a, [wc2d5]
- add a
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 842ea
-
-
-.Jumptable: ; 842ea (21:42ea)
-
- dw Function8432f
- dw Function84330
- dw Function84339
- dw Function84343
- dw Function8434d
- dw Function84357
- dw Function84361
- dw Function8438b
- dw Function84395
- dw Function8439f
- dw Function843a8
- dw Function843b6
- dw Function84330
- dw Function843c0
- dw Function843c9
- dw Function843c9
- dw Function843c9
- dw Function843c0
- dw Function843c9
- dw Function8439f
- dw Function843a8
- dw Function843e6
- dw Function84330
- dw Function843d2
- dw Function843c9
- dw Function843c9
- dw Function843c9
- dw Function843d2
- dw Function843c9
- dw Function8439f
- dw Function843a8
- dw Function843b6
-
-
-Function8432a: ; 8432a (21:432a)
- ld hl, wc2d5
- inc [hl]
- ret
-
-Function8432f: ; 8432f (21:432f)
- ret
-
-Function84330: ; 84330 (21:4330)
- ld a, $33
- call Function843db
- call Function8432a
- ret
-
-Function84339: ; 84339 (21:4339)
- ld a, [wca82]
- call Function843db
- call Function8432a
- ret
-
-Function84343: ; 84343 (21:4343)
- ld a, [wca83]
- call Function843db
- call Function8432a
- ret
-
-Function8434d: ; 8434d (21:434d)
- ld a, [wca84]
- call Function843db
- call Function8432a
- ret
-
-Function84357: ; 84357 (21:4357)
- ld a, [wca85]
- call Function843db
- call Function8432a
- ret
-
-Function84361: ; 84361 (21:4361)
- ld hl, wca8e
- ld a, [hli]
- ld d, [hl]
- ld e, a
- or d
- jr z, .asm_84388
- dec de
- ld [hl], d
- dec hl
- ld [hl], e
- ld a, [wca8c]
- ld e, a
- ld a, [wca8d]
- ld d, a
- ld hl, OverworldMap
- add hl, de
- inc de
- ld a, e
- ld [wca8c], a
- ld a, d
- ld [wca8d], a
- ld a, [hl]
- call Function843db
- ret
-.asm_84388
- call Function8432a
-
-Function8438b: ; 8438b (21:438b)
- ld a, [wca86]
- call Function843db
- call Function8432a
- ret
-
-Function84395: ; 84395 (21:4395)
- ld a, [wca87]
- call Function843db
- call Function8432a
- ret
-
-Function8439f: ; 8439f (21:439f)
- ld a, $0
- call Function843db
- call Function8432a
- ret
-
-Function843a8: ; 843a8 (21:43a8)
- ld a, [rSB]
- ld [wca88], a
- ld a, $0
- call Function843db
- call Function8432a
- ret
-
-Function843b6: ; 843b6 (21:43b6)
- ld a, [rSB]
- ld [wca89], a
- xor a
- ld [wc2d5], a
- ret
-
-Function843c0: ; 843c0 (21:43c0)
- ld a, $f
- call Function843db
- call Function8432a
- ret
+INCLUDE "engine/printer/serial.asm"
-Function843c9: ; 843c9 (21:43c9)
- ld a, $0
- call Function843db
- call Function8432a
- ret
-
-Function843d2: ; 843d2 (21:43d2)
- ld a, $8
- call Function843db
- call Function8432a
- ret
-
-Function843db: ; 843db (21:43db)
- ld [rSB], a
- ld a, $1
- ld [rSC], a
- ld a, $81
- ld [rSC], a
- ret
-
-Function843e6: ; 843e6 (21:43e6)
- ld a, [rSB]
- ld [wca89], a
- xor a
- ld [wc2d5], a
- ret
-
-Function843f0: ; 843f0
-.asm_843f0
+SendScreenToPrinter: ; 843f0
+.loop
call JoyTextDelay
- call Function846f6
- jr c, .asm_8440f
+ call CheckCancelPrint
+ jr c, .cancel
ld a, [wJumptableIndex]
bit 7, a
- jr nz, .asm_8440d
- call Function84022
- call Function84757
- call Function84785
+ jr nz, .finished
+ call PrinterJumptableIteration
+ call CheckPrinterStatus
+ call PlacePrinterStatusString
call DelayFrame
- jr .asm_843f0
+ jr .loop
-.asm_8440d
+.finished
and a
ret
-.asm_8440f
+.cancel
scf
ret
; 84411
-Function84411: ; 84411
+Printer_CleanUpAfterSend: ; 84411
xor a
- ld [wc2d4], a
- ld [wc2d5], a
+ ld [wPrinterConnectionOpen], a
+ ld [wPrinterOpcode], a
ret
; 84419
-Function84419: ; 84419
+Printer_PrepareTileMapForPrint: ; 84419
push af
- call Function84000
+ call Printer_StartTransmission
pop af
ld [wcbfa], a
- call Function84728
+ call Printer_CopyTileMapToBuffer
ret
; 84425
-Function84425: ; 84425
+Printer_ExitPrinter: ; 84425
call ReturnToMapFromSubmenu
- call Function84753
+ call Printer_RestartMapMusic
ret
; 8442c
PrintDexEntry: ; 8442c
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
+
ld hl, VTiles1
ld de, FontInversed
lb bc, BANK(FontInversed), $80
call Request1bpp
+
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
- call Function84000
+
+ call Printer_StartTransmission
ld a, $10
ld [wcbfa], a
callba PrintPage1
call ClearTileMap
- ld a, $e4
+ ld a, %11100100
call DmgToCgbBGPals
call DelayFrame
+
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $4
- ld a, $8
- ld [wcf65], a
- call Function84742
- call Function843f0
- jr c, .asm_8449d
- call Function84411
+
+ ld a, 8 ; 16 rows
+ ld [wPrinterQueueLength], a
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
+ jr c, .skip_second_page ; canceled or got an error
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ld [hBGMapMode], a
- call Function84000
+
+ call Printer_StartTransmission
ld a, $3
ld [wcbfa], a
callba PrintPage2
- call Function84742
- ld a, $4
- ld [wcf65], a
- call Function843f0
+ call Printer_ResetJoypadRegisters
+ ld a, 4
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
-.asm_8449d
+.skip_second_page
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
+
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
- ld c, $8
-.asm_844ae
+
+ call Printer_ExitPrinter
+ ld c, 8
+.low_volume_delay_frames
call LowVolume
call DelayFrame
dec c
- jr nz, .asm_844ae
+ jr nz, .low_volume_delay_frames
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 844bc
PrintPCBox: ; 844bc (21:44bc)
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
- ld a, $9
- ld [wcf65], a
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+
ld a, e
- ld [wd004], a
+ ld [wAddrOfBoxToPrint], a
ld a, d
- ld [wd005], a
+ ld [wAddrOfBoxToPrint + 1], a
ld a, b
- ld [wd006], a
+ ld [wBankOfBoxToPrint], a
ld a, c
- ld [wd007], a
+ ld [wWhichBoxToPrint], a
+
xor a
ld [hPrinter], a
- ld [wd003], a
- call Function8474c
+ ld [wFinishedPrintingBox], a
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
+ ld [hl], %0100
+
xor a
ld [hBGMapMode], a
- call Function84817
- ld a, $10
- call Function84419
- call Function84559
- jr c, .asm_84545
- call Function84411
+ call PrintPCBox_Page1
+ ld a, $10 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ld [hBGMapMode], a
- call Function8486f
- ld a, $0
- call Function84419
- call Function84559
- jr c, .asm_84545
- call Function84411
+ call PrintPCBox_Page2
+ ld a, $0 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
xor a
ld [hBGMapMode], a
- call Function84893
- ld a, $0
- call Function84419
- call Function84559
- jr c, .asm_84545
- call Function84411
+ call PrintPCBox_Page3
+ ld a, $0 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
xor a
ld [hBGMapMode], a
- call Function848b7
- ld a, $3
- call Function84419
- call Function84559
-.asm_84545
+ call PrintPCBox_Page4
+ ld a, $3 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+.cancel
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
+
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
+ call Printer_ExitPrinter
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
-Function84559: ; 84559 (21:4559)
- call Function84742
- call Function843f0
+Printer_ResetRegistersAndStartDataSend: ; 84559 (21:4559)
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
ret
PrintUnownStamp: ; 84560
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
ld a, [rIE]
push af
xor a
@@ -822,248 +235,274 @@ PrintUnownStamp: ; 84560
xor a
ld [hBGMapMode], a
call LoadTileMapToTempTileMap
- callba Function16dac
- ld a, $0
- call Function84419
+ callba PlaceUnownPrinterFrontpic
+ ld a, $0 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
call Call_LoadTempTileMapToTileMap
- call Function84742
- ld a, $9
- ld [wcf65], a
-.asm_84597
+ call Printer_ResetJoypadRegisters
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+.loop
call JoyTextDelay
- call Function846f6
- jr c, .asm_845c0
+ call CheckCancelPrint
+ jr c, .done
ld a, [wJumptableIndex]
bit 7, a
- jr nz, .asm_845c0
- call Function84022
+ jr nz, .done
+ call PrinterJumptableIteration
ld a, [wJumptableIndex]
cp $2
- jr nc, .asm_845b5
- ld a, $3
- ld [wca81], a
+ jr nc, .check_status
+ ld a, 6 / 2
+ ld [wPrinterRowIndex], a
-.asm_845b5
- call Function84757
- call Function84785
+.check_status
+ call CheckPrinterStatus
+ call PlacePrinterStatusString
call DelayFrame
- jr .asm_84597
+ jr .loop
-.asm_845c0
+.done
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
call Call_LoadTempTileMapToTileMap
xor a
ld [rIF], a
pop af
ld [rIE], a
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 845d4
PrintMail: ; 845d4
- call Function845db
- call Function84425
+ call PrintMail_
+ call Printer_ExitPrinter
ret
; 845db
-Function845db: ; 845db
- ld a, [wcf65]
+PrintMail_: ; 845db
+ ld a, [wPrinterQueueLength]
push af
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
xor a
ld [hBGMapMode], a
- ld a, $13
- call Function84419
+
+ ld a, $13 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
- ld a, $9
- ld [wcf65], a
- call Function843f0
+ ld [hl], %0100
+
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
+
pop af
ld [hVBlank], a
- call Function84411
- call Function84735
+ call Printer_CleanUpAfterSend
+ call Printer_CopyBufferToTileMap
+
xor a
ld [rIF], a
pop af
ld [rIE], a
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 8461a
PrintPartymon: ; 8461a
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
xor a
ld [hBGMapMode], a
- callba Function1dc381
- ld a, $10
- call Function84419
+ callba PrintPartyMonPage1
+ ld a, $10 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
- ld a, $8
- ld [wcf65], a
- call Function84742
- call Function843f0
- jr c, .asm_84671
- call Function84411
+ ld [hl], %0100
+
+ ld a, 16 / 2
+ ld [wPrinterQueueLength], a
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
xor a
ld [hBGMapMode], a
- callba Function1dc47b
- ld a, $3
- call Function84419
- ld a, $9
- ld [wcf65], a
- call Function84742
- call Function843f0
-
-.asm_84671
+ callba PrintPartyMonPage2
+ ld a, $3 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
+.cancel
pop af
ld [hVBlank], a
- call Function84411
- call Function84735
+ call Printer_CleanUpAfterSend
+
+ call Printer_CopyBufferToTileMap
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
+ call Printer_ExitPrinter
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 84688
_PrintDiploma: ; 84688
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
- callba Function1dd709
+
+ callba PlaceDiplomaOnScreen
+
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
- ld a, $10
- call Function84419
- call Function84742
- ld a, $9
- ld [wcf65], a
- call Function843f0
- jr c, .asm_846e2
- call Function84411
+ ld [hl], %0100
+
+ ld a, $10 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetJoypadRegisters
+
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
+ jr c, .cancel
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
call LoadTileMapToTempTileMap
xor a
ld [hBGMapMode], a
- callba Function1dd7ae
- ld a, $3
- call Function84419
+
+ callba PrintDiplomaPage2
+
+ ld a, $3 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
call Call_LoadTempTileMapToTileMap
- call Function84742
- ld a, $9
- ld [wcf65], a
- call Function843f0
+ call Printer_ResetJoypadRegisters
-.asm_846e2
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
+.cancel
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
+
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
+ call Printer_ExitPrinter
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 846f6
-Function846f6: ; 846f6
+CheckCancelPrint: ; 846f6
ld a, [hJoyDown]
and B_BUTTON
- jr nz, .asm_846fe
+ jr nz, .pressed_b
and a
ret
-.asm_846fe
+.pressed_b
ld a, [wca80]
cp $c
- jr nz, .asm_84722
-.asm_84705
- ld a, [wc2d5]
+ jr nz, .cancel
+.loop
+ ld a, [wPrinterOpcode]
and a
- jr nz, .asm_84705
- ld a, $16
- ld [wc2d5], a
+ jr nz, .loop
+ ld a, $16 ; cancel
+ ld [wPrinterOpcode], a
ld a, $88
ld [rSB], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
-.asm_8471c
- ld a, [wc2d5]
+.loop2
+ ld a, [wPrinterOpcode]
and a
- jr nz, .asm_8471c
+ jr nz, .loop2
-.asm_84722
+.cancel
ld a, $1
ld [hPrinter], a
scf
ret
; 84728
-Function84728: ; 84728
+Printer_CopyTileMapToBuffer: ; 84728
hlcoord 0, 0
- ld de, wca90
+ ld de, wPrinterTileMapBuffer
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 84735
-Function84735: ; 84735
- ld hl, wca90
+Printer_CopyBufferToTileMap: ; 84735
+ ld hl, wPrinterTileMapBuffer
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 84742
-Function84742: ; 84742
+Printer_ResetJoypadRegisters: ; 84742
xor a
ld [hJoyReleased], a
ld [hJoyPressed], a
@@ -1072,27 +511,29 @@ Function84742: ; 84742
ret
; 8474c
-Function8474c: ; 8474c
+Printer_PlayMusic: ; 8474c
ld de, MUSIC_PRINTER
call PlayMusic2
ret
; 84753
-Function84753: ; 84753
+Printer_RestartMapMusic: ; 84753
call RestartMapMusic
ret
; 84757
-Function84757: ; 84757
- ld a, [wca88]
+CheckPrinterStatus: ; 84757
+; Check for printer errors
+; If [ca88] == -1, we're disconnected
+ ld a, [wPrinterHandshake]
cp -1
jr nz, .printer_connected
- ld a, [wca89]
+ ld a, [wPrinterStatusFlags]
cp -1
jr z, .error_2
-
.printer_connected
- ld a, [wca89]
+; ca89 contains printer status flags
+ ld a, [wPrinterStatusFlags]
and %11100000
ret z ; no error
@@ -1100,27 +541,31 @@ Function84757: ; 84757
jr nz, .error_1
bit 6, a
jr nz, .error_4
- ld a, 6 ; error 3
+ ; paper error
+ ld a, PRINTER_ERROR_3
jr .load_text_index
.error_4
- ld a, 7 ; error 4
+ ; temperature error
+ ld a, PRINTER_ERROR_4
jr .load_text_index
.error_1
- ld a, 4 ; error 1
+ ; printer battery low
+ ld a, PRINTER_ERROR_1
jr .load_text_index
.error_2
- ld a, 5 ; error 2
-
+ ; connection error
+ ld a, PRINTER_ERROR_2
.load_text_index
- ld [wcbf8], a
+ ld [wPrinterStatus], a
ret
; 84785
-Function84785: ; 84785
- ld a, [wcbf8]
+PlacePrinterStatusString: ; 84785
+; Print nonzero printer status
+ ld a, [wPrinterStatus]
and a
ret z
push af
@@ -1133,9 +578,8 @@ Function84785: ; 84785
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -1148,12 +592,13 @@ endr
ld a, $1
ld [hBGMapMode], a
xor a
- ld [wcbf8], a
+ ld [wPrinterStatus], a
ret
; 847bd
Function847bd: ; 847bd
- ld a, [wcbf8]
+; XXX
+ ld a, [wPrinterStatus]
and a
ret z
push af
@@ -1166,9 +611,8 @@ Function847bd: ; 847bd
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -1181,7 +625,7 @@ endr
ld a, $1
ld [hBGMapMode], a
xor a
- ld [wcbf8], a
+ ld [wPrinterStatus], a
ret
; 847f5
@@ -1190,34 +634,38 @@ String_PressBToCancel:
; 84807
PrinterStatusStringPointers: ; 84807
- dw String_1dc275 ; @
- dw String_1dc276 ; CHECKING LINK
- dw String_1dc289 ; TRANSMITTING
- dw String_1dc29c ; PRINTING
- dw String_1dc2ad ; error 1
- dw String_1dc2e2 ; error 2
- dw String_1dc317 ; error 3
- dw String_1dc34c ; error 4
+ dw GBPrinterString_Null ; @
+ dw GBPrinterString_CheckingLink ; CHECKING LINK
+ dw GBPrinterString_Transmitting ; TRANSMITTING
+ dw GBPrinterString_Printing ; PRINTING
+ dw GBPrinterString_PrinterError1 ; error 1
+ dw GBPrinterString_PrinterError2 ; error 2
+ dw GBPrinterString_PrinterError3 ; error 3
+ dw GBPrinterString_PrinterError4 ; error 4
; 84817
-Function84817: ; 84817 (21:4817)
+PrintPCBox_Page1: ; 84817 (21:4817)
xor a
- ld [wd002], a
+ ld [wWhichBoxMonToPrint], a
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
+
hlcoord 0, 0
ld bc, 9 * SCREEN_WIDTH
ld a, " "
call ByteFill
+
call Printer_PlaceSideBorders
call Printer_PlaceTopBorder
+
hlcoord 4, 3
ld de, .String_PokemonList
call PlaceString
- ld a, [wd007]
+
+ ld a, [wWhichBoxToPrint]
ld bc, BOX_NAME_LENGTH
ld hl, wBoxNames
call AddNTimes
@@ -1225,11 +673,11 @@ Function84817: ; 84817 (21:4817)
ld e, l
hlcoord 6, 5
call PlaceString
- ld a, $1
- call Function849c6
+ ld a, 1
+ call Printer_GetBoxMonSpecies
hlcoord 2, 9
- ld c, $3
- call Function848e7
+ ld c, 3
+ call Printer_PrintBoxListSegment
ret
; 84865 (21:4865)
@@ -1237,41 +685,41 @@ Function84817: ; 84817 (21:4817)
db "#MON LIST@"
; 8486f
-Function8486f: ; 8486f (21:486f)
+PrintPCBox_Page2: ; 8486f (21:486f)
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
- ld a, [wd003]
+ ld a, [wFinishedPrintingBox]
and a
ret nz
- ld a, $4
- call Function849c6
+ ld a, 4
+ call Printer_GetBoxMonSpecies
hlcoord 2, 0
- ld c, $6
- call Function848e7
+ ld c, 6
+ call Printer_PrintBoxListSegment
ret
-Function84893: ; 84893 (21:4893)
+PrintPCBox_Page3: ; 84893 (21:4893)
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
- ld a, [wd003]
+ ld a, [wFinishedPrintingBox]
and a
ret nz
- ld a, $a
- call Function849c6
+ ld a, 10
+ call Printer_GetBoxMonSpecies
hlcoord 2, 0
- ld c, $6
- call Function848e7
+ ld c, 6
+ call Printer_PrintBoxListSegment
ret
-Function848b7: ; 848b7 (21:48b7)
+PrintPCBox_Page4: ; 848b7 (21:48b7)
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
@@ -1282,119 +730,126 @@ Function848b7: ; 848b7 (21:48b7)
call ClearBox
call Printer_PlaceSideBorders
call Printer_PlaceBottomBorders
- ld a, [wd003]
+ ld a, [wFinishedPrintingBox]
and a
ret nz
- ld a, $10
- call Function849c6
+ ld a, 16
+ call Printer_GetBoxMonSpecies
hlcoord 2, 0
- ld c, $5
- call Function848e7
+ ld c, 5
+ call Printer_PrintBoxListSegment
ret
-Function848e7: ; 848e7 (21:48e7)
- ld a, [wd006]
+Printer_PrintBoxListSegment: ; 848e7 (21:48e7)
+ ld a, [wBankOfBoxToPrint]
call GetSRAMBank
-
-Function848ed: ; 848ed (21:48ed)
+.loop
ld a, c
and a
- jp z, Function84986
+ jp z, .max_length
dec c
ld a, [de]
cp $ff
- jp z, Function84981
+ jp z, .finish
ld [wd265], a
ld [CurPartySpecies], a
+
push bc
push hl
push de
+
push hl
- ld bc, $10
+ ld bc, 16
ld a, " "
call ByteFill
pop hl
+
push hl
call GetBasePokemonName
pop hl
+
push hl
call PlaceString
ld a, [CurPartySpecies]
cp EGG
pop hl
jr z, .ok2
- ld bc, $b
+
+ ld bc, PKMN_NAME_LENGTH
add hl, bc
- call Function8498a
- ld bc, $9
+ call Printer_GetMonGender
+ ld bc, SCREEN_WIDTH - PKMN_NAME_LENGTH
add hl, bc
ld a, "/"
ld [hli], a
+
push hl
- ld bc, $e
+ ld bc, 14
ld a, " "
call ByteFill
pop hl
+
push hl
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
- ld bc, $372
+ ld bc, sBoxMonNicknames - sBox
add hl, bc
- ld bc, $b
- ld a, [wd002]
+ ld bc, PKMN_NAME_LENGTH
+ ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld e, l
ld d, h
pop hl
+
push hl
call PlaceString
pop hl
- ld bc, $b
+
+ ld bc, PKMN_NAME_LENGTH
add hl, bc
push hl
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
- ld bc, $35
+ ld bc, 2 + MONS_PER_BOX + MON_LEVEL
add hl, bc
- ld bc, $20
- ld a, [wd002]
+ ld bc, BOXMON_STRUCT_LENGTH
+ ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld a, [hl]
pop hl
- call Function383d
+ call PrintLevel_Force3Digits
.ok2
- ld hl, wd002
+ ld hl, wWhichBoxMonToPrint
inc [hl]
pop de
pop hl
- ld bc, $3c
+ ld bc, 3 * SCREEN_WIDTH
add hl, bc
pop bc
inc de
- jp Function848ed
+ jp .loop
-Function84981: ; 84981 (21:4981)
+.finish
ld a, $1
- ld [wd003], a
-
-Function84986: ; 84986 (21:4986)
+ ld [wFinishedPrintingBox], a
+.max_length
call CloseSRAM
ret
-Function8498a: ; 8498a (21:498a)
+Printer_GetMonGender: ; 8498a (21:498a)
push hl
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, $2b
add hl, bc
- ld bc, $20
- ld a, [wd002]
+ ld bc, BOXMON_STRUCT_LENGTH
+ ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld de, TempMonDVs
ld a, [hli]
@@ -1402,28 +857,28 @@ Function8498a: ; 8498a (21:498a)
inc de
ld a, [hli]
ld [de], a
- ld a, [wd002]
+ ld a, [wWhichBoxMonToPrint]
ld [CurPartyMon], a
- ld a, $3
+ ld a, TEMPMON
ld [MonType], a
callba GetGender
- ld a, $7f
- jr c, .asm_849c3
- ld a, $ef
- jr nz, .asm_849c3
- ld a, $f5
-.asm_849c3
+ ld a, " "
+ jr c, .got_gender
+ ld a, "♂"
+ jr nz, .got_gender
+ ld a, "♀"
+.got_gender
pop hl
ld [hli], a
ret
-Function849c6: ; 849c6 (21:49c6)
+Printer_GetBoxMonSpecies: ; 849c6 (21:49c6)
push hl
ld e, a
ld d, $0
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
add hl, de
ld e, l
diff --git a/engine/printer/serial.asm b/engine/printer/serial.asm
new file mode 100755
index 000000000..da1c334ed
--- /dev/null
+++ b/engine/printer/serial.asm
@@ -0,0 +1,645 @@
+Printer_StartTransmission: ; 84000
+ ld hl, wGameboyPrinterRAM
+ ld bc, wGameboyPrinterRAMEnd - wGameboyPrinterRAM
+ xor a
+ call Printer_ByteFill
+ xor a
+ ld [rSB], a
+ ld [rSC], a
+ ld [wPrinterOpcode], a
+ ld hl, wPrinterConnectionOpen
+ set 0, [hl]
+ ld a, [GBPrinter]
+ ld [wGBPrinterSettings], a
+ xor a
+ ld [wJumptableIndex], a
+ ret
+; 84022
+
+PrinterJumptableIteration: ; 84022
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, .Jumptable
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 84031
+
+
+.Jumptable: ; 84031 (21:4031)
+
+ dw Print_InitPrinterHandshake ; 00
+ dw Printer_CheckConnectionStatus ; 01
+ dw Printer_WaitSerial ; 02
+ dw Printer_StartTransmittingTilemap ; 03
+ dw Printer_TransmissionLoop ; 04
+ dw Printer_WaitSerialAndLoopBack2 ; 05
+
+ dw Printer_EndTilemapTransmission ; 06
+ dw Printer_TransmissionLoop ; 07
+ dw Printer_WaitSerial ; 08
+ dw Printer_SignalSendHeader ; 09
+ dw Printer_TransmissionLoop ; 0a
+ dw Printer_WaitSerial ; 0b
+ dw Printer_WaitUntilFinished ; 0c
+ dw Printer_Quit ; 0d
+
+ dw Printer_NextSection_ ; 0e
+ dw Printer_WaitSerial ; 0f
+ dw Printer_SignalLoopBack ; 10
+ dw Printer_SectionOne ; 11
+ dw Printer_WaitLoopBack ; 12
+ dw Printer_WaitLoopBack_ ; 13
+
+
+Printer_NextSection: ; 84059 (21:4059)
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+
+Printer_PrevSection: ; 8405e (21:405e)
+ ld hl, wJumptableIndex
+ dec [hl]
+ ret
+
+Printer_Quit: ; 84063 (21:4063)
+ xor a
+ ld [wPrinterStatusFlags], a
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+Printer_NextSection_: ; 8406d (21:406d)
+ call Printer_NextSection
+ ret
+
+Printer_SectionOne: ; 84071 (21:4071)
+ ld a, $1
+ ld [wJumptableIndex], a
+ ret
+
+Print_InitPrinterHandshake: ; 84077 (21:4077)
+ call Printer_ResetData
+ ld hl, PrinterDataPacket1
+ call Printer_CopyPacket
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ ld a, [wPrinterQueueLength]
+ ld [wPrinterRowIndex], a
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ld a, PRINTER_STATUS_CHECKING
+ ld [wPrinterStatus], a
+ ret
+
+Printer_StartTransmittingTilemap: ; 84099 (21:4099)
+ call Printer_ResetData
+ ; check ???
+ ld hl, wPrinterRowIndex
+ ld a, [hl]
+ and a
+ jr z, Printer_EndTilemapTransmission
+ ; send packet 3
+ ld hl, PrinterDataPacket3 ; signal start of transmission
+ call Printer_CopyPacket
+ ; prepare to send 40 tiles
+ call Printer_Convert2RowsTo2bpp
+ ld a, (40 tiles) % $100
+ ld [wPrinterSendByteCounter], a
+ ld a, (40 tiles) / $100
+ ld [wPrinterSendByteCounter + 1], a
+ ; compute the checksum
+ call Printer_ComputeChecksum
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ld a, PRINTER_STATUS_TRANSMITTING
+ ld [wPrinterStatus], a
+ ret
+
+Printer_EndTilemapTransmission: ; 840c5 (21:40c5)
+ ; ensure that we go from here to routine 7
+ ld a, $6
+ ld [wJumptableIndex], a
+ ; send packet 4
+ ld hl, PrinterDataPacket4 ; signal no transmission
+ call Printer_CopyPacket
+ ; send no tile data
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ret
+
+Printer_SignalSendHeader: ; 840de (21:40de)
+ call Printer_ResetData
+ ld hl, PrinterDataPacket2 ; signal request print
+ call Printer_CopyPacket
+ ; prepare to send 1 tile
+ call Printer_StageHeaderForSend
+ ld a, 4 % $100
+ ld [wPrinterSendByteCounter], a
+ ld a, 4 / $100
+ ld [wPrinterSendByteCounter + 1], a
+ ; compute the checksum
+ call Printer_ComputeChecksum
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ld a, PRINTER_STATUS_PRINTING
+ ld [wPrinterStatus], a
+ ret
+
+Printer_SignalLoopBack: ; 84103 (21:4103)
+ call Printer_ResetData
+ ; send packet 1
+ ld hl, PrinterDataPacket1 ; signal no transmission
+ call Printer_CopyPacket
+ ; send no tile data
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ ld a, [wPrinterQueueLength]
+ ld [wPrinterRowIndex], a
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ret
+
+Printer_WaitSerial: ; 84120 (21:4120)
+ ld hl, wPrinterSerialFrameDelay
+ inc [hl]
+ ld a, [hl]
+ cp $6
+ ret c
+ xor a
+ ld [hl], a
+ call Printer_NextSection
+ ret
+
+Printer_WaitSerialAndLoopBack2: ; 8412e (21:412e)
+ ld hl, wPrinterSerialFrameDelay
+ inc [hl]
+ ld a, [hl]
+ cp $6
+ ret c
+ xor a
+ ld [hl], a
+ ld hl, wPrinterRowIndex
+ dec [hl]
+ call Printer_PrevSection
+ call Printer_PrevSection
+ ret
+
+Printer_CheckConnectionStatus: ; 84143 (21:4143)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterHandshake]
+ cp $ff
+ jr nz, .printer_connected
+ ld a, [wPrinterStatusFlags]
+ cp $ff
+ jr z, .printer_error
+
+.printer_connected
+ ld a, [wPrinterHandshake]
+ cp $81
+ jr nz, .printer_error
+ ld a, [wPrinterStatusFlags]
+ cp $0
+ jr nz, .printer_error
+ ld hl, wPrinterConnectionOpen
+ set 1, [hl]
+ ld a, $5
+ ld [wHandshakeFrameDelay], a
+ call Printer_NextSection
+ ret
+
+.printer_error
+ ld a, $ff
+ ld [wPrinterHandshake], a
+ ld [wPrinterStatusFlags], a
+ ld a, $e
+ ld [wJumptableIndex], a
+ ret
+
+Printer_TransmissionLoop: ; 84180 (21:4180)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterStatusFlags]
+ and $f0
+ jr nz, .enter_wait_loop
+ ld a, [wPrinterStatusFlags]
+ and $1
+ jr nz, .cycle_back
+ call Printer_NextSection
+ ret
+
+.cycle_back
+ call Printer_PrevSection
+ ret
+
+.enter_wait_loop
+ ld a, $12 ; Printer_WaitLoopBack
+ ld [wJumptableIndex], a
+ ret
+
+Printer_WaitUntilFinished: ; 841a1 (21:41a1)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterStatusFlags]
+ and $f3
+ ret nz
+ call Printer_NextSection
+ ret
+
+Printer_WaitLoopBack: ; 841b0 (21:41b0)
+ call Printer_NextSection
+Printer_WaitLoopBack_: ; 841b3 (21:41b3)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterStatusFlags]
+ and $f0
+ ret nz
+ xor a
+ ld [wJumptableIndex], a
+ ret
+
+Printer_WaitHandshake: ; 841c3 (21:41c3)
+.loop
+ ld a, [wPrinterOpcode]
+ and a
+ jr nz, .loop
+ xor a
+ ld [wPrinterSendByteOffset], a
+ ld [wPrinterSendByteOffset + 1], a
+ ld a, $1
+ ld [wPrinterOpcode], a
+ ld a, $88
+ ld [rSB], a
+ ld a, $1
+ ld [rSC], a
+ ld a, $81
+ ld [rSC], a
+ ret
+
+Printer_CopyPacket: ; 841e2 (21:41e2)
+ ld a, [hli]
+ ld [wca82], a
+ ld a, [hli]
+ ld [wca83], a
+ ld a, [hli]
+ ld [wca84], a
+ ld a, [hli]
+ ld [wca85], a
+ ld a, [hli]
+ ld [wPrinterChecksum], a
+ ld a, [hl]
+ ld [wPrinterChecksum + 1], a
+ ret
+
+Printer_ResetData: ; 841fb (21:41fb)
+ xor a
+ ld hl, wca82
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
+ ld [hl], a
+ ld hl, wPrinterChecksum
+ ld [hli], a
+ ld [hl], a
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ ld hl, wGameboyPrinterRAM
+ ld bc, wGameboyPrinter2bppSourceEnd - wGameboyPrinter2bppSource
+ call Printer_ByteFill
+ ret
+
+Printer_ComputeChecksum: ; 84219 (21:4219)
+ ld hl, 0
+ ld bc, 4
+ ld de, wca82
+ call .ComputeChecksum
+ ld a, [wPrinterSendByteCounter]
+ ld c, a
+ ld a, [wPrinterSendByteCounter + 1]
+ ld b, a
+ ld de, wGameboyPrinterRAM
+ call .ComputeChecksum
+ ld a, l
+ ld [wPrinterChecksum], a
+ ld a, h
+ ld [wPrinterChecksum + 1], a
+ ret
+
+.ComputeChecksum: ; 8423c (21:423c)
+.loop
+ ld a, [de]
+ inc de
+ add l
+ jr nc, .no_overflow
+ inc h
+.no_overflow
+ ld l, a
+ dec bc
+ ld a, c
+ or b
+ jr nz, .loop
+ ret
+
+Printer_StageHeaderForSend: ; 84249 (21:4249)
+ ld a, $1
+ ld [wGameboyPrinter2bppSource + 0], a
+ ld a, [wcbfa]
+ ld [wGameboyPrinter2bppSource + 1], a
+ ld a, %11100100
+ ld [wGameboyPrinter2bppSource + 2], a
+ ld a, [wGBPrinterSettings]
+ ld [wGameboyPrinter2bppSource + 3], a
+ ret
+
+Printer_Convert2RowsTo2bpp: ; 84260 (21:4260)
+ ; de = wPrinterTileMapBuffer + 2 * SCREEN_WIDTH * ([wPrinterQueueLength] - [wPrinterRowIndex])
+ ld a, [wPrinterRowIndex]
+ xor $ff
+ ld d, a
+ ld a, [wPrinterQueueLength]
+ inc a
+ add d
+ ld hl, wPrinterTileMapBuffer
+ ld de, 2 * SCREEN_WIDTH
+.loop1
+ and a
+ jr z, .okay1
+ add hl, de
+ dec a
+ jr .loop1
+.okay1
+ ld e, l
+ ld d, h
+ ld hl, wGameboyPrinter2bppSource
+ ld c, 2 * SCREEN_WIDTH
+.loop2
+ ld a, [de]
+ inc de
+ push bc
+ push de
+ push hl
+ ; convert tile index to vram address
+ swap a
+ ld d, a
+ and $f0
+ ld e, a
+ ld a, d
+ and $f
+ ld d, a
+ and $8
+ ld a, d
+ jr nz, .vtiles_8xxx
+ or $90
+ jr .got_vtile_addr
+
+.vtiles_8xxx
+ or $80
+.got_vtile_addr
+ ld d, a
+ ; copy 1 vtile to hl
+ lb bc, BANK(Printer_Convert2RowsTo2bpp), 1
+ call Request2bpp
+ pop hl
+ ld de, 1 tiles
+ add hl, de
+ pop de
+ pop bc
+ dec c
+ jr nz, .loop2
+ ret
+
+Printer_ByteFill: ; 842ab
+ push de
+ ld e, a
+.loop
+ ld [hl], e
+ inc hl
+ dec bc
+ ld a, c
+ or b
+ jr nz, .loop
+ ld a, e
+ pop de
+ ret
+; 842b7
+
+PrinterDataPacket1:
+ db 1, 0, $00, 0
+ dw 1
+PrinterDataPacket2:
+ db 2, 0, $04, 0
+ dw 0
+PrinterDataPacket3:
+ db 4, 0, $80, 2
+ dw 0
+PrinterDataPacket4:
+ db 4, 0, $00, 0
+ dw 4
+PrinterDataPacket5: ; unused
+ db 8, 0, $00, 0
+ dw 8
+PrinterDataPacket6: ; unused
+ db 15, 0, $00, 0
+ dw 15
+; 842db
+
+_PrinterReceive:: ; 842db
+ ld a, [wPrinterOpcode]
+ add a
+ ld e, a
+ ld d, 0
+ ld hl, .Jumptable
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 842ea
+
+
+.Jumptable: ; 842ea (21:42ea)
+ dw Printer_DoNothing ; 00
+
+ dw Printer_Send0x33 ; 01
+ dw Printer_Sendwca82 ; 02
+ dw Printer_Sendwca83 ; 03
+ dw Printer_Sendwca84 ; 04
+ dw Printer_Sendwca85 ; 05
+ dw Printer_SendNextByte ; 06
+ dw Printer_SendwPrinterChecksumLo ; 07
+ dw Printer_SendwPrinterChecksumHi ; 08
+ dw Printer_Send0x00 ; 09
+ dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 0a
+ dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 0b
+
+ dw Printer_Send0x33 ; 0c triggered by AskSerial
+ dw Printer_Send0x0f ; 0d
+ dw Printer_Send0x00_ ; 0e
+ dw Printer_Send0x00_ ; 0f
+ dw Printer_Send0x00_ ; 10
+ dw Printer_Send0x0f ; 11
+ dw Printer_Send0x00_ ; 12
+ dw Printer_Send0x00 ; 13
+ dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 14
+ dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_ ; 15
+
+ dw Printer_Send0x33 ; 16 triggered by pressing B
+ dw Printer_Send0x08 ; 17
+ dw Printer_Send0x00_ ; 18
+ dw Printer_Send0x00_ ; 19
+ dw Printer_Send0x00_ ; 1a
+ dw Printer_Send0x08 ; 1b
+ dw Printer_Send0x00_ ; 1c
+ dw Printer_Send0x00 ; 1d
+ dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 1e
+ dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 1f
+
+
+Printer_NextInstruction: ; 8432a (21:432a)
+ ld hl, wPrinterOpcode
+ inc [hl]
+ ret
+
+Printer_DoNothing: ; 8432f (21:432f)
+ ret
+
+Printer_Send0x33: ; 84330 (21:4330)
+ ld a, $33
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca82: ; 84339 (21:4339)
+ ld a, [wca82]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca83: ; 84343 (21:4343)
+ ld a, [wca83]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca84: ; 8434d (21:434d)
+ ld a, [wca84]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca85: ; 84357 (21:4357)
+ ld a, [wca85]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_SendNextByte: ; 84361 (21:4361)
+ ; decrement 16-bit counter
+ ld hl, wPrinterSendByteCounter
+ ld a, [hli]
+ ld d, [hl]
+ ld e, a
+ or d
+ jr z, .done
+ dec de
+ ld [hl], d
+ dec hl
+ ld [hl], e
+
+ ld a, [wPrinterSendByteOffset]
+ ld e, a
+ ld a, [wPrinterSendByteOffset + 1]
+ ld d, a
+ ld hl, wGameboyPrinterRAM
+ add hl, de
+ inc de
+ ld a, e
+ ld [wPrinterSendByteOffset], a
+ ld a, d
+ ld [wPrinterSendByteOffset + 1], a
+ ld a, [hl]
+ call Printer_SerialSend
+ ret
+
+.done
+ call Printer_NextInstruction
+Printer_SendwPrinterChecksumLo: ; 8438b (21:438b)
+ ld a, [wPrinterChecksum]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_SendwPrinterChecksumHi: ; 84395 (21:4395)
+ ld a, [wPrinterChecksum + 1]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Send0x00: ; 8439f (21:439f)
+ ld a, $0
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_ReceiveTowPrinterHandshakeAndSend0x00: ; 843a8 (21:43a8)
+ ld a, [rSB]
+ ld [wPrinterHandshake], a
+ ld a, $0
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop: ; 843b6 (21:43b6)
+ ld a, [rSB]
+ ld [wPrinterStatusFlags], a
+ xor a
+ ld [wPrinterOpcode], a
+ ret
+
+Printer_Send0x0f: ; 843c0 (21:43c0)
+ ld a, $f
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Send0x00_: ; 843c9 (21:43c9)
+ ld a, $0
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Send0x08: ; 843d2 (21:43d2)
+ ld a, $8
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_SerialSend: ; 843db (21:43db)
+ ld [rSB], a
+ ld a, $1 ; switch to internal clock
+ ld [rSC], a
+ ld a, $81 ; start transfer
+ ld [rSC], a
+ ret
+
+Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_: ; 843e6 (21:43e6)
+ ld a, [rSB]
+ ld [wPrinterStatusFlags], a
+ xor a
+ ld [wPrinterOpcode], a
+ ret
diff --git a/engine/radio.asm b/engine/radio.asm
index 678fc05d5..ce3bc7942 100644
--- a/engine/radio.asm
+++ b/engine/radio.asm
@@ -139,7 +139,7 @@ PrintRadioLine:
cp 2
jr nz, .print
bccoord 1, 16
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
jr .skip
.print
call PrintTextBoxText
@@ -201,10 +201,11 @@ OaksPkmnTalk3:
OaksPkmnTalk4:
; Choose a random route, and a random Pokemon from that route.
+.sample
call Random
and $1f
- cp $f
- jr nc, OaksPkmnTalk4
+ cp $f ; so wasteful
+ jr nc, .sample
; We now have a number between 0 and 14.
ld hl, .routes
ld c, a
@@ -1576,7 +1577,8 @@ BuenasPassword4:
; There are only 11 groups to choose from.
.greater_than_11
call Random
- and $f
+ maskbits NUM_PASSWORD_CATEGORIES
+ and x
cp NUM_PASSWORD_CATEGORIES
jr nc, .greater_than_11
; Store it in the high nybble of e.
diff --git a/engine/rtc.asm b/engine/rtc.asm
index 1f5e1e27c..3018b5301 100755
--- a/engine/rtc.asm
+++ b/engine/rtc.asm
@@ -35,9 +35,8 @@ GetTimeOfDay:: ; 14032
cp [hl]
jr c, .match
; else, get the next entry
-rept 2
inc hl
-endr
+ inc hl
; try again
jr .check
diff --git a/engine/save.asm b/engine/save.asm
index f2f3a79bd..de2d3bc65 100644
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -4,14 +4,14 @@ SaveMenu: ; 14a1a
call SpeechTextBox
call UpdateSprites
callba SaveMenu_LoadEDTile
- ld hl, UnknownText_0x15283
+ ld hl, Text_WouldYouLikeToSaveTheGame
call SaveTheGame_yesorno
jr nz, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
call ExitMenu
and a
ret
@@ -23,8 +23,8 @@ SaveMenu: ; 14a1a
scf
ret
-Function14a58: ; 14a58
- call SetWRAMStateForSave
+SaveAfterLinkTrade: ; 14a58
+ call PauseGameLogic
callba StageRTCTimeForSave
callba BackupMysteryGift
call SavePokemonData
@@ -33,21 +33,21 @@ Function14a58: ; 14a58
call SaveBackupChecksum
callba BackupPartyMonMail
callba SaveRTC
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ret
; 14a83
ChangeBoxSaveGame: ; 14a83 (5:4a83)
push de
- ld hl, UnknownText_0x152a1
+ ld hl, Text_SaveOnBoxSwitch
call MenuTextBox
call YesNoBox
call ExitMenu
jr c, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call SavingDontTurnOffThePower
call SaveBox
pop de
@@ -55,7 +55,7 @@ ChangeBoxSaveGame: ; 14a83 (5:4a83)
ld [wCurBox], a
call LoadBox
call SavedTheGame
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
ret
.refused
@@ -65,9 +65,9 @@ ChangeBoxSaveGame: ; 14a83 (5:4a83)
Link_SaveGame: ; 14ab2
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
.refused
@@ -75,19 +75,19 @@ Link_SaveGame: ; 14ab2
; 14ac2
MovePkmnWOMail_SaveGame: ; 14ac2
- call SetWRAMStateForSave
+ call PauseGameLogic
push de
call SaveBox
pop de
ld a, e
ld [wCurBox], a
call LoadBox
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ret
; 14ad5
-Function14ad5: ; 14ad5
- call SetWRAMStateForSave
+MovePkmnWOMail_InsertMon_SaveGame: ; 14ad5
+ call PauseGameLogic
push de
call SaveBox
pop de
@@ -111,7 +111,7 @@ Function14ad5: ; 14ad5
callba BackupMobileEventIndex
callba SaveRTC
call LoadBox
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ld de, SFX_SAVE
call PlaySFX
ld c, 24
@@ -120,16 +120,16 @@ Function14ad5: ; 14ad5
; 14b34
StartMovePkmnWOMail_SaveGame: ; 14b34
- ld hl, UnknownText_0x152a6
+ ld hl, Text_SaveOnMovePkmnWOMail
call MenuTextBox
call YesNoBox
call ExitMenu
jr c, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
ret
@@ -138,15 +138,15 @@ StartMovePkmnWOMail_SaveGame: ; 14b34
ret
; 14b54
-SetWRAMStateForSave: ; 14b54
+PauseGameLogic: ; 14b54
ld a, $1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
ret
; 14b5a
-ClearWRAMStateAfterSave: ; 14b5a
+ResumeGameLogic: ; 14b5a
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
ret
; 14b5f
@@ -184,13 +184,13 @@ AskOverwriteSaveFile: ; 14b89
jr z, .erase
call CompareLoadedAndSavedPlayerID
jr z, .yoursavefile
- ld hl, UnknownText_0x15297
+ ld hl, Text_AnotherSaveFile
call SaveTheGame_yesorno
jr nz, .refused
jr .erase
.yoursavefile
- ld hl, UnknownText_0x15292
+ ld hl, Text_AlreadyASaveFile
call SaveTheGame_yesorno
jr nz, .refused
jr .ok
@@ -208,7 +208,7 @@ AskOverwriteSaveFile: ; 14b89
; 14baf
SaveTheGame_yesorno: ; 14baf
- ld b, BANK(UnknownText_0x15283)
+ ld b, BANK(Text_WouldYouLikeToSaveTheGame)
call MapTextbox
call LoadMenuTextBox
lb bc, 0, 7
@@ -253,7 +253,7 @@ SavedTheGame: ; 14be6
ld a, 3
ld [Options], a
; <PLAYER> saved the game!
- ld hl, UnknownText_0x1528d
+ ld hl, Text_PlayerSavedTheGame
call PrintText
; restore the original text speed setting
pop af
@@ -355,7 +355,7 @@ SavingDontTurnOffThePower: ; 14c99
ld a, $3
ld [Options], a
; SAVING... DON'T TURN OFF THE POWER.
- ld hl, UnknownText_0x15288
+ ld hl, Text_SavingDontTurnOffThePower
call PrintText
; Restore the text speed setting
pop af
@@ -416,17 +416,18 @@ EraseHallOfFame: ; 14d06
; 14d18
Function14d18: ; 14d18
-; copy Unknown_14d2c to SRA4:a007
+; XXX
+; copy .Data to SRA4:a007
ld a, $4
call GetSRAMBank
- ld hl, Unknown_14d2c
+ ld hl, .Data
ld de, $a007
- ld bc, 48
+ ld bc, .DataEnd - .Data
call CopyBytes
jp CloseSRAM
; 14d2c
-Unknown_14d2c: ; 14d2c
+.Data: ; 14d2c
db $0d, $02, $00, $05, $00, $00
db $22, $02, $01, $05, $00, $00
db $03, $04, $05, $08, $03, $05
@@ -436,6 +437,7 @@ Unknown_14d2c: ; 14d2c
db $0f, $05, $14, $07, $05, $05
db $11, $0c, $0c, $06, $06, $04
; 14d5c
+.DataEnd
EraseBattleTowerStatus: ; 14d5c
ld a, BANK(sBattleTowerChallengeState)
@@ -451,6 +453,7 @@ SaveData: ; 14d68
; 14d6c
Function14d6c: ; 14d6c
+; XXX
ld a, $4
call GetSRAMBank
ld a, [$a60b]
@@ -467,6 +470,7 @@ Function14d6c: ; 14d6c
; 14d83
Function14d83: ; 14d83
+; XXX
ld a, $4
call GetSRAMBank
xor a
@@ -477,6 +481,7 @@ Function14d83: ; 14d83
; 14d93
Function14d93: ; 14d93
+; XXX
ld a, $7
call GetSRAMBank
xor a
@@ -664,7 +669,7 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
push af
set NO_TEXT_SCROLL, a
ld [Options], a
- ld hl, UnknownText_0x1529c
+ ld hl, Text_SaveFileCorrupted
call PrintText
pop af
ld [Options], a
@@ -1156,49 +1161,49 @@ Checksum: ; 15273
; 15283
-UnknownText_0x15283: ; 0x15283
+Text_WouldYouLikeToSaveTheGame: ; 0x15283
; Would you like to save the game?
text_jump UnknownText_0x1c454b
db "@"
; 0x15288
-UnknownText_0x15288: ; 0x15288
+Text_SavingDontTurnOffThePower: ; 0x15288
; SAVING… DON'T TURN OFF THE POWER.
text_jump UnknownText_0x1c456d
db "@"
; 0x1528d
-UnknownText_0x1528d: ; 0x1528d
+Text_PlayerSavedTheGame: ; 0x1528d
; saved the game.
text_jump UnknownText_0x1c4590
db "@"
; 0x15292
-UnknownText_0x15292: ; 0x15292
+Text_AlreadyASaveFile: ; 0x15292
; There is already a save file. Is it OK to overwrite?
text_jump UnknownText_0x1c45a3
db "@"
; 0x15297
-UnknownText_0x15297: ; 0x15297
+Text_AnotherSaveFile: ; 0x15297
; There is another save file. Is it OK to overwrite?
text_jump UnknownText_0x1c45d9
db "@"
; 0x1529c
-UnknownText_0x1529c: ; 0x1529c
+Text_SaveFileCorrupted: ; 0x1529c
; The save file is corrupted!
text_jump UnknownText_0x1c460d
db "@"
; 0x152a1
-UnknownText_0x152a1: ; 0x152a1
+Text_SaveOnBoxSwitch: ; 0x152a1
; When you change a #MON BOX, data will be saved. OK?
text_jump UnknownText_0x1c462a
db "@"
; 0x152a6
-UnknownText_0x152a6: ; 0x152a6
+Text_SaveOnMovePkmnWOMail: ; 0x152a6
; Each time you move a #MON, data will be saved. OK?
text_jump UnknownText_0x1c465f
db "@"
diff --git a/engine/scripting.asm b/engine/scripting.asm
index 078ce8931..e9899ef0f 100644
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1,15 +1,14 @@
; Event scripting commands.
-EnableScriptMode:: ; 96c56
+EnableScriptMode::
push af
ld a, SCRIPT_READ
ld [ScriptMode], a
pop af
ret
-; 96c5e
-ScriptEvents:: ; 96c5e
+ScriptEvents::
call StartScript
.loop
ld a, [ScriptMode]
@@ -18,20 +17,18 @@ ScriptEvents:: ; 96c5e
call CheckScript
jr nz, .loop
ret
-; 96c6e
-.modes ; 96c6e
+.modes
dw EndScript
dw RunScriptCommand
dw WaitScriptMovement
dw WaitScript
-EndScript: ; 96c76
+EndScript:
call StopScript
ret
-; 96c7a
-WaitScript: ; 96c7a
+WaitScript:
call StopScript
ld hl, ScriptDelay
@@ -44,9 +41,8 @@ WaitScript: ; 96c7a
ld [ScriptMode], a
call StartScript
ret
-; 96c91
-WaitScriptMovement: ; 96c91
+WaitScriptMovement:
call StopScript
ld hl, VramState
@@ -59,17 +55,15 @@ WaitScriptMovement: ; 96c91
ld [ScriptMode], a
call StartScript
ret
-; 96ca9
-RunScriptCommand: ; 96ca9
+RunScriptCommand:
call GetScriptByte
ld hl, ScriptCommandTable
rst JumpTable
ret
-; 96cb1
-ScriptCommandTable: ; 96cb1
+ScriptCommandTable:
dw Script_scall ; 00
dw Script_farscall ; 01
dw Script_ptcall ; 02
@@ -242,27 +236,23 @@ ENDC
dw Script_name ; a7
dw Script_wait ; a8
dw Script_check_save ; a9
-; 96e05
-StartScript: ; 96e05
+StartScript:
ld hl, ScriptFlags
set SCRIPT_RUNNING, [hl]
ret
-; 96e0b
-CheckScript: ; 96e0b
+CheckScript:
ld hl, ScriptFlags
bit SCRIPT_RUNNING, [hl]
ret
-; 96e11
-StopScript: ; 96e11
+StopScript:
ld hl, ScriptFlags
res SCRIPT_RUNNING, [hl]
ret
-; 96e17
-Script_callasm: ; 96e17
+Script_callasm:
; script command 0xe
; parameters:
; asm (AsmPointerParam)
@@ -276,9 +266,8 @@ Script_callasm: ; 96e17
ld a, b
rst FarCall
ret
-; 96e26
-Script_special: ; 96e26
+Script_special:
; script command 0xf
; parameters:
; predefined_script (MultiByteParam)
@@ -289,9 +278,8 @@ Script_special: ; 96e26
ld d, a
callba Special
ret
-; 96e35
-Script_ptcallasm: ; 96e35
+Script_ptcallasm:
; script command 0x10
; parameters:
; asm (PointerToAsmPointerParam)
@@ -308,9 +296,8 @@ Script_ptcallasm: ; 96e35
ld a, b
rst FarCall
ret
-; 96e45
-Script_jumptextfaceplayer: ; 96e45
+Script_jumptextfaceplayer:
; script command 0x51
; parameters:
; text_pointer (RawTextPointerLabelParam)
@@ -324,9 +311,8 @@ Script_jumptextfaceplayer: ; 96e45
ld b, BANK(JumpTextFacePlayerScript)
ld hl, JumpTextFacePlayerScript
jp ScriptJump
-; 96e5f
-Script_jumptext: ; 96e5f
+Script_jumptext:
; script command 0x53
; parameters:
; text_pointer (RawTextPointerLabelParam)
@@ -340,22 +326,20 @@ Script_jumptext: ; 96e5f
ld b, BANK(JumpTextScript)
ld hl, JumpTextScript
jp ScriptJump
-; 96e79
-JumpTextFacePlayerScript: ; 96e79
+JumpTextFacePlayerScript:
faceplayer
-JumpTextScript: ; 96e7a
+JumpTextScript:
opentext
repeattext -1, -1
waitbutton
closetext
end
-; 96e81
IF _CRYSTAL
-Script_farjumptext: ; 96e81
+Script_farjumptext:
; script command 0x52
; parameters:
; text_pointer (PointerLabelBeforeBank)
@@ -369,12 +353,11 @@ Script_farjumptext: ; 96e81
ld b, BANK(JumpTextScript)
ld hl, JumpTextScript
jp ScriptJump
-; 96e9b
ENDC
-Script_writetext: ; 96e9b
+Script_writetext:
; script command 0x4c
; parameters:
; text_pointer (RawTextPointerLabelParam)
@@ -387,9 +370,8 @@ Script_writetext: ; 96e9b
ld b, a
call MapTextbox
ret
-; 96eab
-Script_farwritetext: ; 96eab
+Script_farwritetext:
; script command 0x4b
; parameters:
; text_pointer (PointerLabelBeforeBank)
@@ -402,9 +384,8 @@ Script_farwritetext: ; 96eab
ld h, a
call MapTextbox
ret
-; 96ebb
-Script_repeattext: ; 96ebb
+Script_repeattext:
; script command 0x4d
; parameters:
; byte (SingleByteParam)
@@ -430,15 +411,13 @@ Script_repeattext: ; 96ebb
.done
ret
-; 96ed9
-Script_waitbutton: ; 96ed9
+Script_waitbutton:
; script command 0x54
jp WaitButton
-; 96edc
-Script_buttonsound: ; 96edc
+Script_buttonsound:
; script command 0x55
ld a, [hOAMUpdate]
@@ -450,9 +429,8 @@ Script_buttonsound: ; 96edc
pop af
ld [hOAMUpdate], a
ret
-; 96eed
-Script_yesorno: ; 96eed
+Script_yesorno:
; script command 0x4e
call YesNoBox
@@ -462,9 +440,8 @@ Script_yesorno: ; 96eed
.no
ld [ScriptVar], a
ret
-; 96efa
-Script_loadmenudata: ; 96efa
+Script_loadmenudata:
; script command 0x4f
; parameters:
; data (MenuDataPointerParam)
@@ -478,17 +455,15 @@ Script_loadmenudata: ; 96efa
call Call_a_de
call UpdateSprites
ret
-; 96f0f
-Script_closewindow: ; 96f0f
+Script_closewindow:
; script command 0x50
call CloseWindow
call UpdateSprites
ret
-; 96f16
-Script_pokepic: ; 96f16
+Script_pokepic:
; script command 0x56
; parameters:
; pokemon (PokemonParam)
@@ -501,16 +476,14 @@ Script_pokepic: ; 96f16
ld [CurPartySpecies], a
callba Pokepic
ret
-; 96f29
-Script_closepokepic: ; 96f29
+Script_closepokepic:
; script command 0x57
callba ClosePokepic
ret
-; 96f30
-Script_verticalmenu: ; 96f30
+Script_verticalmenu:
; script command 0x59
ld a, [ScriptBank]
@@ -522,9 +495,8 @@ Script_verticalmenu: ; 96f30
.ok
ld [ScriptVar], a
ret
-; 96f41
-Script__2dmenu: ; 96f41
+Script__2dmenu:
; script command 0x58
ld a, [ScriptBank]
@@ -536,9 +508,8 @@ Script__2dmenu: ; 96f41
.ok
ld [ScriptVar], a
ret
-; 96f52
-Script_battletowertext: ; 96f52
+Script_battletowertext:
; script command 0xa4
; parameters:
; pointer (PointerLabelBeforeBank)
@@ -549,9 +520,8 @@ Script_battletowertext: ; 96f52
ld c, a
callba BattleTowerText
ret
-; 96f60
-Script_verbosegiveitem: ; 96f60
+Script_verbosegiveitem:
; script command 0x9e
; parameters:
; item (ItemLabelByte)
@@ -565,14 +535,12 @@ Script_verbosegiveitem: ; 96f60
ld b, BANK(GiveItemScript)
ld de, GiveItemScript
jp ScriptCall
-; 96f76
-ret_96f76: ; 96f76
+ret_96f76:
ret
-; 96f77
-GiveItemScript: ; 96f77
+GiveItemScript:
callasm ret_96f76
writetext ReceivedItemText
iffalse .Full
@@ -586,15 +554,13 @@ GiveItemScript: ; 96f77
buttonsound
pocketisfull
end
-; 96f89
-ReceivedItemText: ; 96f89
+ReceivedItemText:
text_jump UnknownText_0x1c4719
db "@"
-; 96f8e
-Script_verbosegiveitem2: ; 96f8e
+Script_verbosegiveitem2:
; script command 0x9f
; parameters:
; item (ItemLabelByte)
@@ -624,9 +590,8 @@ Script_verbosegiveitem2: ; 96f8e
ld b, BANK(GiveItemScript)
ld de, GiveItemScript
jp ScriptCall
-; 96fc6
-Script_itemnotify: ; 96fc6
+Script_itemnotify:
; script command 0x45
call GetPocketName
@@ -635,9 +600,8 @@ Script_itemnotify: ; 96fc6
ld hl, PutItemInPocketText
call MapTextbox
ret
-; 96fd5
-Script_pocketisfull: ; 96fd5
+Script_pocketisfull:
; script command 0x46
call GetPocketName
@@ -646,9 +610,8 @@ Script_pocketisfull: ; 96fd5
ld hl, PocketIsFullText
call MapTextbox
ret
-; 96fe4
-Script_specialsound: ; 96fe4
+Script_specialsound:
; script command 0x88
callba CheckItemPocket
@@ -661,10 +624,9 @@ Script_specialsound: ; 96fe4
call PlaySFX
call WaitSFX
ret
-; 96ffe
-GetPocketName: ; 96ffe
+GetPocketName:
callba CheckItemPocket
ld a, [wItemAttributeParamBuffer]
dec a
@@ -695,28 +657,24 @@ GetPocketName: ; 96ffe
db "BALL POCKET@"
.TM:
db "TM POCKET@"
-; 97051
-CurItemName: ; 97051
+CurItemName:
ld a, [CurItem]
ld [wd265], a
call GetItemName
ret
-; 9705b
-PutItemInPocketText: ; 9705b
+PutItemInPocketText:
text_jump UnknownText_0x1c472c
db "@"
-; 97060
-PocketIsFullText: ; 97060
+PocketIsFullText:
text_jump UnknownText_0x1c474b
db "@"
-; 97065
-Script_pokemart: ; 97065
+Script_pokemart:
; script command 0x94
; parameters:
; dialog_id (SingleByteParam)
@@ -732,9 +690,8 @@ Script_pokemart: ; 97065
ld b, a
callba OpenMartDialog
ret
-; 9707c
-Script_elevator: ; 9707c
+Script_elevator:
; script command 0x95
; parameters:
; floor_list_pointer (PointerLabelParam)
@@ -752,9 +709,8 @@ Script_elevator: ; 9707c
ld a, TRUE
ld [ScriptVar], a
ret
-; 97099
-Script_trade: ; 97099
+Script_trade:
; script command 0x96
; parameters:
; trade_id (SingleByteParam)
@@ -763,9 +719,8 @@ Script_trade: ; 97099
ld e, a
callba NPCTrade
ret
-; 970a4
-Script_phonecall: ; 970a4
+Script_phonecall:
; script command 0x98
; parameters:
; caller_name (RawTextPointerLabelParam)
@@ -778,16 +733,14 @@ Script_phonecall: ; 970a4
ld b, a
callba PhoneCall
ret
-; 970b7
-Script_hangup: ; 970b7
+Script_hangup:
; script command 0x99
callba HangUp
ret
-; 970be
-Script_askforphonenumber: ; 970be
+Script_askforphonenumber:
; script command 0x97
; parameters:
; number (SingleByteParam)
@@ -809,9 +762,8 @@ Script_askforphonenumber: ; 970be
.done
ld [ScriptVar], a
ret
-; 970df
-Script_describedecoration: ; 970df
+Script_describedecoration:
; script command 0x9a
; parameters:
; byte (SingleByteParam)
@@ -822,9 +774,8 @@ Script_describedecoration: ; 970df
ld h, d
ld l, e
jp ScriptJump
-; 970ee
-Script_fruittree: ; 970ee
+Script_fruittree:
; script command 0x9b
; parameters:
; tree_id (SingleByteParam)
@@ -834,9 +785,8 @@ Script_fruittree: ; 970ee
ld b, BANK(FruitTreeScript)
ld hl, FruitTreeScript
jp ScriptJump
-; 970fc
-Script_swarm: ; 970fc
+Script_swarm:
; script command 0xa0
; parameters:
; flag (SingleByteParam)
@@ -851,9 +801,8 @@ Script_swarm: ; 970fc
ld e, a
callba StoreSwarmMapIndices
ret
-; 9710f
-Script_trainertext: ; 9710f
+Script_trainertext:
; script command 0x62
; parameters:
; which_text (SingleByteParam)
@@ -871,9 +820,8 @@ Script_trainertext: ; 9710f
ld b, a
call MapTextbox
ret
-; 97125
-Script_scripttalkafter: ; 97125
+Script_scripttalkafter:
; script command 0x65
ld hl, wScriptAfterPointer
@@ -883,9 +831,8 @@ Script_scripttalkafter: ; 97125
ld a, [EngineBuffer1]
ld b, a
jp ScriptJump
-; 97132
-Script_trainerflagaction: ; 97132
+Script_trainerflagaction:
; script command 0x63
; parameters:
; action (SingleByteParam)
@@ -905,37 +852,34 @@ Script_trainerflagaction: ; 97132
ld a, TRUE
ld [ScriptVar], a
ret
-; 9714c
-Script_winlosstext: ; 9714c
+Script_winlosstext:
; script command 0x64
; parameters:
; win_text_pointer (TextPointerLabelParam)
; loss_text_pointer (TextPointerLabelParam)
- ld hl, wWinTextPointer ; d047
+ ld hl, wWinTextPointer
call GetScriptByte
ld [hli], a
call GetScriptByte
ld [hli], a
- ld hl, wLossTextPointer ; d049; this is unnecessary
+ ld hl, wLossTextPointer
call GetScriptByte
ld [hli], a
call GetScriptByte
ld [hli], a
ret
-; 97163
-Script_end_if_just_battled: ; 97163
+Script_end_if_just_battled:
; script command 0x66
ld a, [wRunningTrainerBattleScript]
and a
ret z
jp Script_end
-; 9716b
-Script_check_just_battled: ; 9716b
+Script_check_just_battled:
; script command 0x67
ld a, TRUE
@@ -946,25 +890,22 @@ Script_check_just_battled: ; 9716b
xor a
ld [ScriptVar], a
ret
-; 9717a
-Script_encountermusic: ; 9717a
+Script_encountermusic:
; script command 0x80
ld a, [OtherTrainerClass]
ld e, a
callba PlayTrainerEncounterMusic
ret
-; 97185
-Script_playmapmusic: ; 97185
+Script_playmapmusic:
; script command 0x82
call PlayMapMusic
ret
-; 97189
-Script_playmusic: ; 97189
+Script_playmusic:
; script command 0x7f
; parameters:
; music_pointer (MultiByteParam)
@@ -980,9 +921,8 @@ Script_playmusic: ; 97189
ld d, a
call PlayMusic
ret
-; 971a2
-Script_musicfadeout: ; 971a2
+Script_musicfadeout:
; script command 0x81
; parameters:
; music (MultiByteParam)
@@ -996,9 +936,8 @@ Script_musicfadeout: ; 971a2
and $7f
ld [MusicFade], a
ret
-; 971b7
-Script_playsound: ; 971b7
+Script_playsound:
; script command 0x85
; parameters:
; sound_pointer (MultiByteParam)
@@ -1009,24 +948,21 @@ Script_playsound: ; 971b7
ld d, a
call PlaySFX
ret
-; 971c3
-Script_waitsfx: ; 971c3
+Script_waitsfx:
; script command 0x86
call WaitSFX
ret
-; 971c7
-Script_warpsound: ; 971c7
+Script_warpsound:
; script command 0x87
callba Function14a07
call PlaySFX
ret
-; 971d1
-Script_cry: ; 971d1
+Script_cry:
; script command 0x84
; parameters:
; cry_id (MultiByteParam)
@@ -1041,18 +977,16 @@ Script_cry: ; 971d1
.ok
call PlayCry
ret
-; 971e3
-GetScriptPerson: ; 971e3
+GetScriptPerson:
and a
ret z
cp LAST_TALKED
ret z
dec a
ret
-; 971ea
-Script_setlasttalked: ; 971ea
+Script_setlasttalked:
; script command 0x68
; parameters:
; person (SingleByteParam)
@@ -1061,9 +995,8 @@ Script_setlasttalked: ; 971ea
call GetScriptPerson
ld [hLastTalked], a
ret
-; 971f3
-Script_applymovement: ; 971f3
+Script_applymovement:
; script command 0x69
; parameters:
; person (SingleByteParam)
@@ -1072,9 +1005,8 @@ Script_applymovement: ; 971f3
call GetScriptByte
call GetScriptPerson
ld c, a
-; 971fa
-ApplyMovement: ; 971fa
+ApplyMovement:
push bc
ld a, c
callba SetFlagsForMovement_1
@@ -1097,14 +1029,12 @@ ApplyMovement: ; 971fa
ld [ScriptMode], a
call StopScript
ret
-; 97221
-SetFlagsForMovement_2: ; 97221
+SetFlagsForMovement_2:
callba _SetFlagsForMovement_2
ret
-; 97228
-Script_applymovement2: ; 97228
+Script_applymovement2:
; apply movement to last talked
; script command 0x6a
; parameters:
@@ -1113,9 +1043,8 @@ Script_applymovement2: ; 97228
ld a, [hLastTalked]
ld c, a
jp ApplyMovement
-; 9722e
-Script_faceplayer: ; 9722e
+Script_faceplayer:
; script command 0x6b
ld a, [hLastTalked]
@@ -1133,9 +1062,8 @@ Script_faceplayer: ; 9722e
ld d, a
call ApplyPersonFacing
ret
-; 97248
-Script_faceperson: ; 97248
+Script_faceperson:
; script command 0x6c
; parameters:
; person1 (SingleByteParam)
@@ -1166,9 +1094,8 @@ Script_faceperson: ; 97248
ld d, c
call ApplyPersonFacing
ret
-; 97274
-Script_spriteface: ; 97274
+Script_spriteface:
; script command 0x76
; parameters:
; person (SingleByteParam)
@@ -1187,9 +1114,8 @@ Script_spriteface: ; 97274
ld e, a
call ApplyPersonFacing
ret
-; 9728b
-ApplyPersonFacing: ; 9728b
+ApplyPersonFacing:
ld a, d
push de
call CheckObjectVisibility
@@ -1220,9 +1146,8 @@ ApplyPersonFacing: ; 9728b
pop de
scf
ret
-; 972bc
-.DisableTextTiles: ; 972bc
+.DisableTextTiles:
call LoadMapPart
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
@@ -1234,9 +1159,8 @@ ApplyPersonFacing: ; 9728b
or c
jr nz, .loop
ret
-; 972ce
-Script_variablesprite: ; 972ce
+Script_variablesprite:
; script command 0x6d
; parameters:
; byte (SingleByteParam)
@@ -1250,9 +1174,8 @@ Script_variablesprite: ; 972ce
call GetScriptByte
ld [hl], a
ret
-; 972dd
-Script_appear: ; 972dd
+Script_appear:
; script command 0x6f
; parameters:
; person (SingleByteParam)
@@ -1264,9 +1187,8 @@ Script_appear: ; 972dd
ld b, 0 ; clear
call ApplyEventActionAppearDisappear
ret
-; 972ee
-Script_disappear: ; 972ee
+Script_disappear:
; script command 0x6e
; parameters:
; person (SingleByteParam)
@@ -1283,9 +1205,8 @@ Script_disappear: ; 972ee
call ApplyEventActionAppearDisappear
callba _UpdateSprites
ret
-; 9730b
-ApplyEventActionAppearDisappear: ; 9730b
+ApplyEventActionAppearDisappear:
push bc
call GetMapObject
ld hl, MAPOBJECT_EVENT_FLAG
@@ -1304,9 +1225,8 @@ ApplyEventActionAppearDisappear: ; 9730b
.okay
call EventFlagAction
ret
-; 97325
-Script_follow: ; 97325
+Script_follow:
; script command 0x70
; parameters:
; person2 (SingleByteParam)
@@ -1320,16 +1240,14 @@ Script_follow: ; 97325
ld c, a
callba StartFollow
ret
-; 9733a
-Script_stopfollow: ; 9733a
+Script_stopfollow:
; script command 0x71
callba StopFollow
ret
-; 97341
-Script_moveperson: ; 97341
+Script_moveperson:
; script command 0x72
; parameters:
; person (SingleByteParam)
@@ -1347,9 +1265,8 @@ Script_moveperson: ; 97341
ld e, a
callba CopyDECoordsToMapObject
ret
-; 9735b
-Script_writepersonxy: ; 9735b
+Script_writepersonxy:
; script command 0x73
; parameters:
; person (SingleByteParam)
@@ -1363,9 +1280,8 @@ Script_writepersonxy: ; 9735b
ld b, a
callba WritePersonXY
ret
-; 9736f
-Script_follownotexact: ; 9736f
+Script_follownotexact:
; script command 0x77
; parameters:
; person2 (SingleByteParam)
@@ -1379,9 +1295,8 @@ Script_follownotexact: ; 9736f
ld c, a
callba FollowNotExact
ret
-; 97384
-Script_loademote: ; 97384
+Script_loademote:
; script command 0x74
; parameters:
; bubble (SingleByteParam)
@@ -1394,9 +1309,8 @@ Script_loademote: ; 97384
ld c, a
callba LoadEmote
ret
-; 97396
-Script_showemote: ; 97396
+Script_showemote:
; script command 0x75
; parameters:
; bubble (SingleByteParam)
@@ -1416,9 +1330,8 @@ Script_showemote: ; 97396
ld b, BANK(ShowEmoteScript)
ld de, ShowEmoteScript
jp ScriptCall
-; 973b6
-ShowEmoteScript: ; 973b6
+ShowEmoteScript:
loademote EMOTE_MEM
applymovement2 .Show
pause 0
@@ -1427,17 +1340,16 @@ ShowEmoteScript: ; 973b6
.Show:
show_emote
- step_sleep_1
+ step_sleep 1
step_end
.Hide:
hide_emote
- step_sleep_1
+ step_sleep 1
step_end
-; 973c7
-Script_earthquake: ; 973c7
+Script_earthquake:
; script command 0x78
; parameters:
; param (DecimalParam)
@@ -1453,22 +1365,19 @@ Script_earthquake: ; 973c7
ld b, BANK(.script)
ld de, .script
jp ScriptCall
-; 973e6
-.script ; 973e6
+.script
applymovement PLAYER, wd002
end
-; 973eb
-EarthquakeMovement: ; 973eb
+EarthquakeMovement:
step_shake 16 ; the 16 gets overwritten with the script byte
step_sleep 16 ; the 16 gets overwritten with the lower 6 bits of the script byte
step_end
EarthquakeMovementEnd
-; 973f0
-Script_loadpikachudata: ; 973f0
+Script_loadpikachudata:
; script command 0x5a
ld a, PIKACHU
@@ -1476,17 +1385,15 @@ Script_loadpikachudata: ; 973f0
ld a, 5
ld [CurPartyLevel], a
ret
-; 973fb
-Script_randomwildmon: ; 973fb
+Script_randomwildmon:
; script command 0x5b
xor a
ld [wBattleScriptFlags], a
ret
-; 97400
-Script_loadmemtrainer: ; 97400
+Script_loadmemtrainer:
; script command 0x5c
ld a, (1 << 7) | 1
@@ -1496,9 +1403,8 @@ Script_loadmemtrainer: ; 97400
ld a, [wTempTrainerID]
ld [OtherTrainerID], a
ret
-; 97412
-Script_loadwildmon: ; 97412
+Script_loadwildmon:
; script command 0x5d
; parameters:
; pokemon (PokemonParam)
@@ -1511,9 +1417,8 @@ Script_loadwildmon: ; 97412
call GetScriptByte
ld [CurPartyLevel], a
ret
-; 97424
-Script_loadtrainer: ; 97424
+Script_loadtrainer:
; script command 0x5e
; parameters:
; trainer_group (TrainerGroupParam)
@@ -1526,9 +1431,8 @@ Script_loadtrainer: ; 97424
call GetScriptByte
ld [OtherTrainerID], a
ret
-; 97436
-Script_startbattle: ; 97436
+Script_startbattle:
; script command 0x5f
call BufferScreen
@@ -1537,9 +1441,8 @@ Script_startbattle: ; 97436
and $3f
ld [ScriptVar], a
ret
-; 97447
-Script_catchtutorial: ; 97447
+Script_catchtutorial:
; script command 0x61
; parameters:
; byte (SingleByteParam)
@@ -1549,9 +1452,8 @@ Script_catchtutorial: ; 97447
call BufferScreen
callba CatchTutorial
jp Script_reloadmap
-; 97459
-Script_reloadmapafterbattle: ; 97459
+Script_reloadmapafterbattle:
; script command 0x60
ld hl, wBattleScriptFlags
@@ -1580,9 +1482,8 @@ Script_reloadmapafterbattle: ; 97459
callba LoadScriptBDE
.done
jp Script_reloadmap
-; 97491
-Script_reloadmap: ; 97491
+Script_reloadmap:
; script command 0x7b
xor a
@@ -1593,9 +1494,8 @@ Script_reloadmap: ; 97491
call LoadMapStatus
call StopScript
ret
-; 974a2
-Script_scall: ; 974a2
+Script_scall:
; script command 0x0
; parameters:
; pointer (ScriptPointerLabelParam)
@@ -1607,9 +1507,8 @@ Script_scall: ; 974a2
call GetScriptByte
ld d, a
jr ScriptCall
-; 974b0
-Script_farscall: ; 974b0
+Script_farscall:
; script command 0x1
; parameters:
; pointer (ScriptPointerLabelBeforeBank)
@@ -1621,9 +1520,8 @@ Script_farscall: ; 974b0
call GetScriptByte
ld d, a
jr ScriptCall
-; 974be
-Script_ptcall: ; 974be
+Script_ptcall:
; script command 0x2
; parameters:
; pointer (PointerLabelToScriptPointer)
@@ -1639,7 +1537,7 @@ Script_ptcall: ; 974be
ld d, [hl]
; fallthrough
-ScriptCall: ; 974cb
+ScriptCall:
; Bug: The script stack has a capacity of 5 scripts, yet there is
; nothing to stop you from pushing a sixth script. The high part
; of the script address can then be overwritten by modifications
@@ -1652,9 +1550,9 @@ ScriptCall: ; 974cb
inc [hl]
ld d, $0
ld hl, wScriptStack
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
pop de
ld a, [ScriptBank]
ld [hli], a
@@ -1669,16 +1567,14 @@ endr
ld a, d
ld [ScriptPos + 1], a
ret
-; 974f3
-CallCallback:: ; 974f3
+CallCallback::
ld a, [ScriptBank]
or $80
ld [ScriptBank], a
jp ScriptCall
-; 974fe
-Script_jump: ; 974fe
+Script_jump:
; script command 0x3
; parameters:
; pointer (ScriptPointerLabelParam)
@@ -1690,9 +1586,8 @@ Script_jump: ; 974fe
ld a, [ScriptBank]
ld b, a
jp ScriptJump
-; 9750d
-Script_farjump: ; 9750d
+Script_farjump:
; script command 0x4
; parameters:
; pointer (ScriptPointerLabelBeforeBank)
@@ -1704,9 +1599,8 @@ Script_farjump: ; 9750d
call GetScriptByte
ld h, a
jp ScriptJump
-; 9751c
-Script_ptjump: ; 9751c
+Script_ptjump:
; script command 0x5
; parameters:
; pointer (PointerLabelToScriptPointer)
@@ -1721,9 +1615,8 @@ Script_ptjump: ; 9751c
ld h, [hl]
ld l, a
jp ScriptJump
-; 9752c
-Script_iffalse: ; 9752c
+Script_iffalse:
; script command 0x8
; parameters:
; pointer (ScriptPointerLabelParam)
@@ -1732,9 +1625,8 @@ Script_iffalse: ; 9752c
and a
jp nz, SkipTwoScriptBytes
jp Script_jump
-; 97536
-Script_iftrue: ; 97536
+Script_iftrue:
; script command 0x9
; parameters:
; pointer (ScriptPointerLabelParam)
@@ -1743,9 +1635,8 @@ Script_iftrue: ; 97536
and a
jp nz, Script_jump
jp SkipTwoScriptBytes
-; 97540
-Script_if_equal: ; 97540
+Script_if_equal:
; script command 0x6
; parameters:
; byte (SingleByteParam)
@@ -1756,9 +1647,8 @@ Script_if_equal: ; 97540
cp [hl]
jr z, Script_jump
jr SkipTwoScriptBytes
-; 9754b
-Script_if_not_equal: ; 9754b
+Script_if_not_equal:
; script command 0x7
; parameters:
; byte (SingleByteParam)
@@ -1769,9 +1659,8 @@ Script_if_not_equal: ; 9754b
cp [hl]
jr nz, Script_jump
jr SkipTwoScriptBytes
-; 97556
-Script_if_greater_than: ; 97556
+Script_if_greater_than:
; script command 0xa
; parameters:
; byte (SingleByteParam)
@@ -1783,9 +1672,8 @@ Script_if_greater_than: ; 97556
cp b
jr c, Script_jump
jr SkipTwoScriptBytes
-; 97562
-Script_if_less_than: ; 97562
+Script_if_less_than:
; script command 0xb
; parameters:
; byte (SingleByteParam)
@@ -1797,18 +1685,16 @@ Script_if_less_than: ; 97562
cp b
jr c, Script_jump
jr SkipTwoScriptBytes
-; 9756e
-Script_jumpstd: ; 9756e
+Script_jumpstd:
; script command 0xc
; parameters:
; predefined_script (MultiByteParam)
call StdScript
jr ScriptJump
-; 97573
-Script_callstd: ; 97573
+Script_callstd:
; script command 0xd
; parameters:
; predefined_script (MultiByteParam)
@@ -1817,17 +1703,16 @@ Script_callstd: ; 97573
ld d, h
ld e, l
jp ScriptCall
-; 9757b
-StdScript: ; 9757b
+StdScript:
call GetScriptByte
ld e, a
call GetScriptByte
ld d, a
ld hl, StdScripts
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, BANK(StdScripts)
call GetFarByte
ld b, a
@@ -1835,15 +1720,13 @@ endr
ld a, BANK(StdScripts)
call GetFarHalfword
ret
-; 97596
-SkipTwoScriptBytes: ; 97596
+SkipTwoScriptBytes:
call GetScriptByte
call GetScriptByte
ret
-; 9759d
-ScriptJump: ; 9759d
+ScriptJump:
ld a, b
ld [ScriptBank], a
ld a, l
@@ -1851,9 +1734,8 @@ ScriptJump: ; 9759d
ld a, h
ld [ScriptPos + 1], a
ret
-; 975aa
-Script_priorityjump: ; 975aa
+Script_priorityjump:
; script command 0x8d
; parameters:
; pointer (ScriptPointerLabelParam)
@@ -1867,9 +1749,8 @@ Script_priorityjump: ; 975aa
ld hl, ScriptFlags
set 3, [hl]
ret
-; 975c2
-Script_checktriggers: ; 975c2
+Script_checktriggers:
; script command 0x13
call CheckTriggers
@@ -1881,9 +1762,8 @@ Script_checktriggers: ; 975c2
ld a, $ff
ld [ScriptVar], a
ret
-; 975d1
-Script_checkmaptriggers: ; 975d1
+Script_checkmaptriggers:
; script command 0x11
; parameters:
; map_group (SingleByteParam)
@@ -1905,9 +1785,8 @@ Script_checkmaptriggers: ; 975d1
ld a, $ff
ld [ScriptVar], a
ret
-; 975eb
-Script_dotrigger: ; 975eb
+Script_dotrigger:
; script command 0x14
; parameters:
; trigger_id (SingleByteParam)
@@ -1917,9 +1796,8 @@ Script_dotrigger: ; 975eb
ld a, [MapNumber]
ld c, a
jr DoTrigger
-; 975f5
-Script_domaptrigger: ; 975f5
+Script_domaptrigger:
; script command 0x12
; parameters:
; map_group (MapGroupParam)
@@ -1930,7 +1808,7 @@ Script_domaptrigger: ; 975f5
ld b, a
call GetScriptByte
ld c, a
-DoTrigger: ; 975fd
+DoTrigger:
call GetMapTrigger
ld a, d
or e
@@ -1939,9 +1817,8 @@ DoTrigger: ; 975fd
ld [de], a
.no_trigger
ret
-; 97609
-Script_copybytetovar: ; 97609
+Script_copybytetovar:
; script command 0x19
; parameters:
; address (RAMAddressParam)
@@ -1953,9 +1830,8 @@ Script_copybytetovar: ; 97609
ld a, [hl]
ld [ScriptVar], a
ret
-; 97616
-Script_copyvartobyte: ; 97616
+Script_copyvartobyte:
; script command 0x1a
; parameters:
; address (RAMAddressParam)
@@ -1967,9 +1843,8 @@ Script_copyvartobyte: ; 97616
ld a, [ScriptVar]
ld [hl], a
ret
-; 97623
-Script_loadvar: ; 97623
+Script_loadvar:
; script command 0x1b
; parameters:
; address (RAMAddressParam)
@@ -1982,9 +1857,8 @@ Script_loadvar: ; 97623
call GetScriptByte
ld [hl], a
ret
-; 97630
-Script_writebyte: ; 97630
+Script_writebyte:
; script command 0x15
; parameters:
; value (SingleByteParam)
@@ -1992,9 +1866,8 @@ Script_writebyte: ; 97630
call GetScriptByte
ld [ScriptVar], a
ret
-; 97637
-Script_addvar: ; 97637
+Script_addvar:
; script command 0x16
; parameters:
; value (SingleByteParam)
@@ -2004,9 +1877,8 @@ Script_addvar: ; 97637
add [hl]
ld [hl], a
ret
-; 97640
-Script_random: ; 97640
+Script_random:
; script command 0x17
; parameters:
; input (SingleByteParam)
@@ -2047,9 +1919,8 @@ Script_random: ; 97640
call SimpleDivide
ld [ScriptVar], a
ret
-; 97673
-.Divide256byC: ; 97673
+.Divide256byC:
xor a
ld b, a
sub c
@@ -2060,9 +1931,8 @@ Script_random: ; 97640
dec b
add c
ret
-; 9767d
-Script_checkcode: ; 9767d
+Script_checkcode:
; script command 0x1c
; parameters:
; variable_id (SingleByteParam)
@@ -2072,9 +1942,8 @@ Script_checkcode: ; 9767d
ld a, [de]
ld [ScriptVar], a
ret
-; 97688
-Script_writevarcode: ; 97688
+Script_writevarcode:
; script command 0x1d
; parameters:
; variable_id (SingleByteParam)
@@ -2084,9 +1953,8 @@ Script_writevarcode: ; 97688
ld a, [ScriptVar]
ld [de], a
ret
-; 97693
-Script_writecode: ; 97693
+Script_writecode:
; script command 0x1e
; parameters:
; variable_id (SingleByteParam)
@@ -2097,27 +1965,23 @@ Script_writecode: ; 97693
call GetScriptByte
ld [de], a
ret
-; 9769e
-GetVarAction: ; 9769e
+GetVarAction:
ld c, a
callba _GetVarAction
ret
-; 976a6
-Script_checkver: ; 976a6
+Script_checkver:
; script command 0x18
ld a, [Version]
ld [ScriptVar], a
ret
-; 976ad
-Version: ; 976ad
+Version:
db VERSION
-; 976ae
-Script_pokenamemem: ; 976ae
+Script_pokenamemem:
; script command 0x40
; parameters:
; pokemon (PokemonParam); leave $0 to draw from script var
@@ -2132,22 +1996,21 @@ Script_pokenamemem: ; 976ae
call GetPokemonName
ld de, StringBuffer1
-ConvertMemToText: ; 976c0
+ConvertMemToText:
call GetScriptByte
cp 3
jr c, .ok
xor a
.ok
-CopyConvertedText: ; 976c8
+CopyConvertedText:
ld hl, StringBuffer3
ld bc, StringBuffer4 - StringBuffer3
call AddNTimes
call CopyName2
ret
-; 976d5
-Script_itemtotext: ; 976d5
+Script_itemtotext:
; script command 0x41
; parameters:
; item (ItemLabelByte); use 0 to draw from ScriptVar
@@ -2162,9 +2025,8 @@ Script_itemtotext: ; 976d5
call GetItemName
ld de, StringBuffer1
jr ConvertMemToText
-; 976e9
-Script_mapnametotext: ; 976e9
+Script_mapnametotext:
; script command 0x42
; parameters:
; memory (SingleByteParam)
@@ -2175,14 +2037,13 @@ Script_mapnametotext: ; 976e9
ld c, a
call GetWorldMapLocation
-ConvertLandmarkToText: ; 976f4
+ConvertLandmarkToText:
ld e, a
callba GetLandmarkName
ld de, StringBuffer1
jp ConvertMemToText
-; 97701
-Script_landmarktotext: ; 97701
+Script_landmarktotext:
; script command 0xa5
; parameters:
; id (SingleByteParam)
@@ -2190,9 +2051,8 @@ Script_landmarktotext: ; 97701
call GetScriptByte
jr ConvertLandmarkToText
-; 97706
-Script_trainertotext: ; 97706
+Script_trainertotext:
; script command 0x43
; parameters:
; trainer_id (TrainerGroupParam)
@@ -2205,9 +2065,8 @@ Script_trainertotext: ; 97706
ld b, a
callba GetTrainerName
jr ConvertMemToText
-; 97716
-Script_name: ; 97716
+Script_name:
; script command 0xa7
; parameters:
; type (SingleByteParam)
@@ -2217,15 +2076,14 @@ Script_name: ; 97716
call GetScriptByte
ld [wNamedObjectTypeBuffer], a
-ContinueToGetName: ; 9771c
+ContinueToGetName:
call GetScriptByte
ld [CurSpecies], a
call GetName
ld de, StringBuffer1
jp ConvertMemToText
-; 9772b
-Script_trainerclassname: ; 9772b
+Script_trainerclassname:
; script command 0xa6
; parameters:
; id (SingleByteParam)
@@ -2234,9 +2092,8 @@ Script_trainerclassname: ; 9772b
ld a, TRAINER_NAME
ld [wNamedObjectTypeBuffer], a
jr ContinueToGetName
-; 97732
-Script_readmoney: ; 97732
+Script_readmoney:
; script command 0x3d
; parameters:
; account (SingleByteParam)
@@ -2249,9 +2106,8 @@ Script_readmoney: ; 97732
call PrintNum
ld de, StringBuffer1
jp ConvertMemToText
-; 97747
-Script_readcoins: ; 97747
+Script_readcoins:
; script command 0x3e
; parameters:
; memory (SingleByteParam)
@@ -2263,9 +2119,8 @@ Script_readcoins: ; 97747
call PrintNum
ld de, StringBuffer1
jp ConvertMemToText
-; 9775c
-Script_RAM2MEM: ; 9775c
+Script_RAM2MEM:
; script command 0x3f
; parameters:
; memory (SingleByteParam)
@@ -2277,17 +2132,15 @@ Script_RAM2MEM: ; 9775c
call PrintNum
ld de, StringBuffer1
jp ConvertMemToText
-; 97771
-ResetStringBuffer1: ; 97771
+ResetStringBuffer1:
ld hl, StringBuffer1
ld bc, NAME_LENGTH
ld a, "@"
call ByteFill
ret
-; 9777d
-Script_stringtotext: ; 9777d
+Script_stringtotext:
; script command 0x44
; parameters:
; text_pointer (EncodedTextLabelParam)
@@ -2302,9 +2155,8 @@ Script_stringtotext: ; 9777d
rst FarCall
ld de, StringBuffer2
jp ConvertMemToText
-; 97792
-Script_givepokeitem: ; 97792
+Script_givepokeitem:
; script command 0x2f
; parameters:
; pointer (PointerParamToItemAndLetter)
@@ -2325,9 +2177,8 @@ Script_givepokeitem: ; 97792
pop bc
callba GivePokeItem
ret
-; 977b7
-Script_checkpokeitem: ; 977b7
+Script_checkpokeitem:
; script command 0x30
; parameters:
; pointer (PointerParamToItemAndLetter)
@@ -2340,9 +2191,8 @@ Script_checkpokeitem: ; 977b7
ld b, a
callba CheckPokeItem
ret
-; 977ca
-Script_giveitem: ; 977ca
+Script_giveitem:
; script command 0x1f
; parameters:
; item (ItemLabelByte)
@@ -2366,9 +2216,8 @@ Script_giveitem: ; 977ca
xor a
ld [ScriptVar], a
ret
-; 977f0
-Script_takeitem: ; 977f0
+Script_takeitem:
; script command 0x20
; parameters:
; item (ItemLabelByte)
@@ -2388,9 +2237,8 @@ Script_takeitem: ; 977f0
ld a, TRUE
ld [ScriptVar], a
ret
-; 97812
-Script_checkitem: ; 97812
+Script_checkitem:
; script command 0x21
; parameters:
; item (ItemLabelByte)
@@ -2405,9 +2253,8 @@ Script_checkitem: ; 97812
ld a, TRUE
ld [ScriptVar], a
ret
-; 97829
-Script_givemoney: ; 97829
+Script_givemoney:
; script command 0x22
; parameters:
; account (SingleByteParam)
@@ -2417,9 +2264,8 @@ Script_givemoney: ; 97829
call LoadMoneyAmountToMem
callba GiveMoney
ret
-; 97836
-Script_takemoney: ; 97836
+Script_takemoney:
; script command 0x23
; parameters:
; account (SingleByteParam)
@@ -2429,9 +2275,8 @@ Script_takemoney: ; 97836
call LoadMoneyAmountToMem
callba TakeMoney
ret
-; 97843
-Script_checkmoney: ; 97843
+Script_checkmoney:
; script command 0x24
; parameters:
; account (SingleByteParam)
@@ -2440,9 +2285,8 @@ Script_checkmoney: ; 97843
call GetMoneyAccount
call LoadMoneyAmountToMem
callba CompareMoney
-; 9784f
-CompareMoneyAction: ; 9784f
+CompareMoneyAction:
jr c, .two
jr z, .one
ld a, 0
@@ -2455,18 +2299,16 @@ CompareMoneyAction: ; 9784f
.done
ld [ScriptVar], a
ret
-; 97861
-GetMoneyAccount: ; 97861
+GetMoneyAccount:
call GetScriptByte
and a
ld de, Money
ret z
ld de, wMomsMoney
ret
-; 9786d
-LoadMoneyAmountToMem: ; 9786d
+LoadMoneyAmountToMem:
ld bc, hMoneyTemp
push bc
call GetScriptByte
@@ -2479,9 +2321,8 @@ LoadMoneyAmountToMem: ; 9786d
ld [bc], a
pop bc
ret
-; 97881
-Script_givecoins: ; 97881
+Script_givecoins:
; script command 0x25
; parameters:
; coins (CoinByteParam)
@@ -2489,9 +2330,8 @@ Script_givecoins: ; 97881
call LoadCoinAmountToMem
callba GiveCoins
ret
-; 9788b
-Script_takecoins: ; 9788b
+Script_takecoins:
; script command 0x26
; parameters:
; coins (CoinByteParam)
@@ -2499,9 +2339,8 @@ Script_takecoins: ; 9788b
call LoadCoinAmountToMem
callba TakeCoins
ret
-; 97895
-Script_checkcoins: ; 97895
+Script_checkcoins:
; script command 0x27
; parameters:
; coins (CoinByteParam)
@@ -2509,18 +2348,16 @@ Script_checkcoins: ; 97895
call LoadCoinAmountToMem
callba CheckCoins
jr CompareMoneyAction
-; 978a0
-LoadCoinAmountToMem: ; 978a0
+LoadCoinAmountToMem:
call GetScriptByte
ld [hMoneyTemp + 1], a
call GetScriptByte
ld [hMoneyTemp], a
ld bc, hMoneyTemp
ret
-; 978ae
-Script_checktime: ; 978ae
+Script_checktime:
; script command 0x2b
; parameters:
; time (SingleByteParam)
@@ -2534,9 +2371,8 @@ Script_checktime: ; 978ae
ld a, TRUE
ld [ScriptVar], a
ret
-; 978c3
-Script_checkpoke: ; 978c3
+Script_checkpoke:
; script command 0x2c
; parameters:
; pkmn (PokemonParam)
@@ -2551,9 +2387,8 @@ Script_checkpoke: ; 978c3
ld a, TRUE
ld [ScriptVar], a
ret
-; 978da
-Script_addcellnum: ; 978da
+Script_addcellnum:
; script command 0x28
; parameters:
; person (SingleByteParam)
@@ -2567,9 +2402,8 @@ Script_addcellnum: ; 978da
ld a, TRUE
ld [ScriptVar], a
ret
-; 978ef
-Script_delcellnum: ; 978ef
+Script_delcellnum:
; script command 0x29
; parameters:
; person (SingleByteParam)
@@ -2583,9 +2417,8 @@ Script_delcellnum: ; 978ef
ld a, TRUE
ld [ScriptVar], a
ret
-; 97904
-Script_checkcellnum: ; 97904
+Script_checkcellnum:
; script command 0x2a
; parameters:
; person (SingleByteParam)
@@ -2600,9 +2433,8 @@ Script_checkcellnum: ; 97904
ld a, TRUE
ld [ScriptVar], a
ret
-; 97919
-Script_specialphonecall: ; 97919
+Script_specialphonecall:
; script command 0x9c
; parameters:
; call_id (MultiByteParam)
@@ -2612,9 +2444,8 @@ Script_specialphonecall: ; 97919
call GetScriptByte
ld [wSpecialPhoneCallID + 1], a
ret
-; 97926
-Script_checkphonecall: ; 97926
+Script_checkphonecall:
; script command 0x9d
; returns false if no special phone call is stored
@@ -2625,9 +2456,8 @@ Script_checkphonecall: ; 97926
.ok
ld [ScriptVar], a
ret
-; 97932
-Script_givepoke: ; 97932
+Script_givepoke:
; script command 0x2d
; parameters:
; pokemon (PokemonParam)
@@ -2660,9 +2490,8 @@ Script_givepoke: ; 97932
ld a, b
ld [ScriptVar], a
ret
-; 97968
-Script_giveegg: ; 97968
+Script_giveegg:
; script command 0x2e
; parameters:
; pkmn (PokemonParam)
@@ -2681,9 +2510,8 @@ Script_giveegg: ; 97968
ld a, 2
ld [ScriptVar], a
ret
-; 97988
-Script_setevent: ; 97988
+Script_setevent:
; script command 0x33
; parameters:
; bit_number (MultiByteParam)
@@ -2695,9 +2523,8 @@ Script_setevent: ; 97988
ld b, SET_FLAG
call EventFlagAction
ret
-; 97996
-Script_clearevent: ; 97996
+Script_clearevent:
; script command 0x32
; parameters:
; bit_number (MultiByteParam)
@@ -2709,9 +2536,8 @@ Script_clearevent: ; 97996
ld b, RESET_FLAG
call EventFlagAction
ret
-; 979a4
-Script_checkevent: ; 979a4
+Script_checkevent:
; script command 0x31
; parameters:
; bit_number (MultiByteParam)
@@ -2729,9 +2555,8 @@ Script_checkevent: ; 979a4
.false
ld [ScriptVar], a
ret
-; 979bb
-Script_setflag: ; 979bb
+Script_setflag:
; script command 0x36
; parameters:
; bit_number (MultiByteParam)
@@ -2743,9 +2568,8 @@ Script_setflag: ; 979bb
ld b, SET_FLAG
call _EngineFlagAction
ret
-; 979c9
-Script_clearflag: ; 979c9
+Script_clearflag:
; script command 0x35
; parameters:
; bit_number (MultiByteParam)
@@ -2757,9 +2581,8 @@ Script_clearflag: ; 979c9
ld b, RESET_FLAG
call _EngineFlagAction
ret
-; 979d7
-Script_checkflag: ; 979d7
+Script_checkflag:
; script command 0x34
; parameters:
; bit_number (MultiByteParam)
@@ -2777,30 +2600,26 @@ Script_checkflag: ; 979d7
.false
ld [ScriptVar], a
ret
-; 979ee
-_EngineFlagAction: ; 979ee
+_EngineFlagAction:
callba EngineFlagAction
ret
-; 979f5
-Script_wildoff: ; 979f5
+Script_wildoff:
; script command 0x38
ld hl, StatusFlags
set 5, [hl]
ret
-; 979fb
-Script_wildon: ; 979fb
+Script_wildon:
; script command 0x37
ld hl, StatusFlags
res 5, [hl]
ret
-; 97a01
-Script_xycompare: ; 97a01
+Script_xycompare:
; script command 0x39
; parameters:
; pointer (MultiByteParam)
@@ -2810,9 +2629,8 @@ Script_xycompare: ; 97a01
call GetScriptByte
ld [wXYComparePointer + 1], a
ret
-; 97a0e
-Script_warpfacing: ; 97a0e
+Script_warpfacing:
; script command 0xa3
; parameters:
; facing (SingleByteParam)
@@ -2830,7 +2648,7 @@ Script_warpfacing: ; 97a0e
ld [wPlayerSpriteSetupFlags], a
; fall through
-Script_warp: ; 97a1d
+Script_warp:
; script command 0x3c
; parameters:
; map_group (MapGroupParam)
@@ -2870,9 +2688,8 @@ Script_warp: ; 97a1d
call LoadMapStatus
call StopScript
ret
-; 97a65
-Script_warpmod: ; 97a65
+Script_warpmod:
; script command 0x3a
; parameters:
; warp_id (SingleByteParam)
@@ -2886,9 +2703,8 @@ Script_warpmod: ; 97a65
call GetScriptByte
ld [BackupMapNumber], a
ret
-; 97a78
-Script_blackoutmod: ; 97a78
+Script_blackoutmod:
; script command 0x3b
; parameters:
; map_group (MapGroupParam)
@@ -2899,17 +2715,15 @@ Script_blackoutmod: ; 97a78
call GetScriptByte
ld [wLastSpawnMapNumber], a
ret
-; 97a85
-Script_dontrestartmapmusic: ; 97a85
+Script_dontrestartmapmusic:
; script command 0x83
ld a, 1
ld [wDontPlayMapMusicOnReload], a
ret
-; 97a8b
-Script_writecmdqueue: ; 97a8b
+Script_writecmdqueue:
; script command 0x7d
; parameters:
; queue_pointer (MultiByteParam)
@@ -2922,9 +2736,8 @@ Script_writecmdqueue: ; 97a8b
ld b, a
callba WriteCmdQueue ; no need to farcall
ret
-; 97a9e
-Script_delcmdqueue: ; 97a9e
+Script_delcmdqueue:
; script command 0x7e
; parameters:
; byte (SingleByteParam)
@@ -2938,9 +2751,8 @@ Script_delcmdqueue: ; 97a9e
ld a, 1
ld [ScriptVar], a
ret
-; 97ab3
-Script_changemap: ; 97ab3
+Script_changemap:
; script command 0x79
; parameters:
; map_data_pointer (MapDataPointerParam)
@@ -2954,9 +2766,8 @@ Script_changemap: ; 97ab3
call ChangeMap
call BufferScreen
ret
-; 97acc
-Script_changeblock: ; 97acc
+Script_changeblock:
; script command 0x7a
; parameters:
; x (SingleByteParam)
@@ -2974,9 +2785,8 @@ Script_changeblock: ; 97acc
ld [hl], a
call BufferScreen
ret
-; 97ae3
-Script_reloadmappart:: ; 97ae3
+Script_reloadmappart::
; script command 0x7c
xor a
@@ -2986,23 +2796,20 @@ Script_reloadmappart:: ; 97ae3
callba ReloadMapPart
call UpdateSprites
ret
-; 97af6
-Script_warpcheck: ; 97af6
+Script_warpcheck:
; script command 0x8e
call WarpCheck
ret nc
callba EnableEvents
ret
-; 97b01
Script_enableevents: ; unreferenced
callba EnableEvents
ret
-; 97b08
-Script_newloadmap: ; 97b08
+Script_newloadmap:
; script command 0x8a
; parameters:
; which_method (SingleByteParam)
@@ -3013,23 +2820,20 @@ Script_newloadmap: ; 97b08
call LoadMapStatus
call StopScript
ret
-; 97b16
-Script_reloadandreturn: ; 97b16
+Script_reloadandreturn:
; script command 0x92
call Script_newloadmap
jp Script_end
-; 97b1c
-Script_textbox: ; 97b1c
+Script_textbox:
; script command 0x47
call OpenText
ret
-; 97b20
-Script_refreshscreen: ; 97b20
+Script_refreshscreen:
; script command 0x48
; parameters:
; dummy (SingleByteParam)
@@ -3037,9 +2841,8 @@ Script_refreshscreen: ; 97b20
call RefreshScreen
call GetScriptByte
ret
-; 97b27
-Script_loadbytec2cf: ; 97b27
+Script_loadbytec2cf:
; script command 0x4a
; parameters:
; byte (SingleByteParam)
@@ -3047,20 +2850,18 @@ Script_loadbytec2cf: ; 97b27
call GetScriptByte
ld [wc2cf], a
ret
-; 97b2e
ld c, c ; XXX
-Script_closetext: ; 97b2f
+Script_closetext:
; script command 0x49
- call Function2e20
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call CloseText
ret
-; 97b36
-Script_passtoengine: ; 97b36
+Script_passtoengine:
; script command 0x89
; parameters:
; data_pointer (PointerLabelBeforeBank)
@@ -3074,9 +2875,8 @@ Script_passtoengine: ; 97b36
pop af
call StartAutoInput
ret
-; 97b47
-Script_pause: ; 97b47
+Script_pause:
; script command 0x8b
; parameters:
; length (DecimalParam)
@@ -3092,9 +2892,8 @@ Script_pause: ; 97b47
dec [hl]
jr nz, .loop
ret
-; 97b5c
-Script_deactivatefacing: ; 97b5c
+Script_deactivatefacing:
; script command 0x8c
; parameters:
; time (SingleByteParam)
@@ -3108,18 +2907,16 @@ Script_deactivatefacing: ; 97b5c
ld [ScriptMode], a
call StopScript
ret
-; 97b6e
-Script_ptpriorityjump: ; 97b6e
+Script_ptpriorityjump:
; script command 0x8f
; parameters:
; pointer (ScriptPointerLabelParam)
call StopScript
jp Script_jump
-; 97b74
-Script_end: ; 97b74
+Script_end:
; script command 0x91
call ExitScriptSubroutine
@@ -3135,9 +2932,8 @@ Script_end: ; 97b74
res 0, [hl]
call StopScript
ret
-; 97b8c
-Script_return: ; 97b8c
+Script_return:
; script command 0x90
call ExitScriptSubroutine
@@ -3147,9 +2943,8 @@ Script_return: ; 97b8c
res 0, [hl]
call StopScript
ret
-; 97b9a
-ExitScriptSubroutine: ; 97b9a
+ExitScriptSubroutine:
; Return carry if there's no parent to return to.
ld hl, wScriptStackSize
@@ -3160,9 +2955,9 @@ ExitScriptSubroutine: ; 97b9a
ld e, [hl]
ld d, $0
ld hl, wScriptStack
-rept 3
add hl,de
-endr
+ add hl,de
+ add hl,de
ld a, [hli]
ld b, a
and " "
@@ -3178,9 +2973,8 @@ endr
.done
scf
ret
-; 97bc0
-Script_end_all: ; 97bc0
+Script_end_all:
; script command 0x93
xor a
@@ -3192,22 +2986,20 @@ Script_end_all: ; 97bc0
res 0, [hl]
call StopScript
ret
-; 97bd5
-Script_halloffame: ; 97bd5
+Script_halloffame:
; script command 0xa1
ld hl, GameTimerPause
res 0, [hl]
- callba Mobile_HallOfFame
- callba Mobile_HallOfFame2
+ callba TrainerRankings_HallOfFame
+ callba TrainerRankings_HallOfFame2
callba HallOfFame
ld hl, GameTimerPause
set 0, [hl]
jr ReturnFromCredits
-; 97bf3
-Script_credits: ; 97bf3
+Script_credits:
; script command 0xa2
callba RedCredits
@@ -3217,9 +3009,8 @@ ReturnFromCredits:
call LoadMapStatus
call StopScript
ret
-; 97c051
-Script_wait: ; 97c05
+Script_wait:
; script command 0xa8
; parameters:
; unknown (SingleByteParam)
@@ -3235,23 +3026,20 @@ Script_wait: ; 97c05
jr nz, .loop
pop bc
ret
-; 97c15
-Script_check_save: ; 97c15
+Script_check_save:
; script command 0xa9
callba CheckSave
ld a, c
ld [ScriptVar], a
ret
-; 97c20
-; 97c20 unreferenced
+; unreferenced
ld a, [.byte]
ld [ScriptVar], a
ret
.byte
db 0
-; 97c28
diff --git a/engine/search.asm b/engine/search.asm
index 662623296..9543ecfbb 100755
--- a/engine/search.asm
+++ b/engine/search.asm
@@ -117,9 +117,9 @@ CheckOwnMonAnywhere: ; 0x4a721
; Load the box.
ld hl, BoxAddressTable1
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
diff --git a/engine/search2.asm b/engine/search2.asm
new file mode 100755
index 000000000..9ef5491f0
--- /dev/null
+++ b/engine/search2.asm
@@ -0,0 +1,134 @@
+_FindGreaterThanThatLevel: ; 4dbd2
+ ld hl, PartyMon1Level
+ call FindGreaterThanThatLevel
+ ret
+
+_FindAtLeastThatHappy: ; 4dbd9
+ ld hl, PartyMon1Happiness
+ call FindAtLeastThatHappy
+ ret
+
+_FindThatSpecies: ; 4dbe0
+ ld hl, PartyMon1Species
+ jp FindThatSpecies
+
+_FindThatSpeciesYourTrainerID: ; 4dbe6
+ ld hl, PartyMon1Species
+ call FindThatSpecies
+ ret z
+ ld a, c
+ ld hl, PartyMon1ID
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld a, [PlayerID]
+ cp [hl]
+ jr nz, .nope
+ inc hl
+ ld a, [PlayerID + 1]
+ cp [hl]
+ jr nz, .nope
+ ld a, $1
+ and a
+ ret
+
+.nope
+ xor a
+ ret
+
+FindAtLeastThatHappy: ; 4dc0a
+; Sets the bits for the Pokemon that have a happiness greater than or equal to b.
+; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy.
+ ld c, $0
+ ld a, [PartyCount]
+ ld d, a
+.loop
+ ld a, d
+ dec a
+ push hl
+ push bc
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ pop bc
+ ld a, b
+ cp [hl]
+ pop hl
+ jr z, .greater_equal
+ jr nc, .lower
+
+.greater_equal
+ ld a, c
+ or $1
+ ld c, a
+
+.lower
+ sla c
+ dec d
+ jr nz, .loop
+ call RetroactivelyIgnoreEggs
+ ld a, c
+ and a
+ ret
+
+FindGreaterThanThatLevel: ; 4dc31
+ ld c, $0
+ ld a, [PartyCount]
+ ld d, a
+.loop
+ ld a, d
+ dec a
+ push hl
+ push bc
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ pop bc
+ ld a, b
+ cp [hl]
+ pop hl
+ jr c, .greater
+ ld a, c
+ or $1
+ ld c, a
+
+.greater
+ sla c
+ dec d
+ jr nz, .loop
+ call RetroactivelyIgnoreEggs
+ ld a, c
+ and a
+ ret
+
+FindThatSpecies: ; 4dc56
+; Find species b in your party.
+; If you have no Pokemon, returns c = -1 and z.
+; If that species is in your party, returns its location in c, and nz.
+; Otherwise, returns z.
+ ld c, -1
+ ld hl, PartySpecies
+.loop
+ ld a, [hli]
+ cp -1
+ ret z
+ inc c
+ cp b
+ jr nz, .loop
+ ld a, $1
+ and a
+ ret
+
+RetroactivelyIgnoreEggs: ; 4dc67
+ ld e, -2
+ ld hl, PartySpecies
+.loop
+ ld a, [hli]
+ cp -1
+ ret z
+ cp EGG
+ jr nz, .skip_notegg
+ ld a, c
+ and e
+ ld c, a
+
+.skip_notegg
+ rlc e
+ jr .loop
diff --git a/engine/selectmenu.asm b/engine/selectmenu.asm
index 4e461a68e..838438a4c 100755
--- a/engine/selectmenu.asm
+++ b/engine/selectmenu.asm
@@ -45,9 +45,8 @@ CheckRegisteredItem: ; 13345
inc hl
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
and a
@@ -71,9 +70,8 @@ endr
inc hl
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
ret
diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm
index c31dbd2b3..ea842ea9c 100755
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -20,7 +20,7 @@ _SlotMachine:
call PlaySFX
call WaitSFX
call ClearBGPalettes
- callba MobileFn_105fd0
+ callba TrainerRankings_EndSlotsWinStreak
ld hl, Options
res NO_TEXT_SCROLL, [hl]
ld hl, rLCDC ; $ff40
@@ -201,9 +201,9 @@ Function9282c: ; 9282c
ld a, [hl]
xor $20
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop
ret
@@ -686,9 +686,9 @@ Slots_SpinReels: ; 92b0f (24:6b0f)
ld a, [hl]
add d
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec e
jr nz, .loop
ret
@@ -1812,7 +1812,7 @@ SlotGetPayout: ; 93124 (24:7124)
ld a, [hl]
ld [wPayout], a
ld d, a
- callba MobileFn_105fe3
+ callba TrainerRankings_AddToSlotsPayouts
ret
.PayoutTable:
@@ -1836,7 +1836,7 @@ SlotPayoutText: ; 93158 (24:7158)
jr nz, .MatchedSomething
ld hl, .Text_Darn
call PrintText
- callba MobileFn_105fd0
+ callba TrainerRankings_EndSlotsWinStreak
ret
.MatchedSomething:
@@ -1844,9 +1844,9 @@ SlotPayoutText: ; 93158 (24:7158)
ld e, a
ld d, 0
ld hl, .PayoutStrings
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld de, StringBuffer2
ld bc, 4
call CopyBytes
@@ -1860,7 +1860,7 @@ endr
.return
ld hl, .Text_PrintPayout
call PrintText
- callba MobileFn_105f9f
+ callba TrainerRankings_AddToSlotsWinStreak
ret
; 93195 (24:7195)
@@ -1948,7 +1948,7 @@ endr
; 9321d
SlotMachine_AnimateGolem: ; 9321d (24:721d)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
@@ -1982,7 +1982,7 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d)
.retain
dec [hl]
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0C
@@ -2009,7 +2009,7 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d)
ret
.play_sound
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0D
@@ -2041,7 +2041,7 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d)
ret
.restart
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
xor a
ld [hl], a
@@ -2049,7 +2049,7 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d)
ret
Slots_AnimateChansey: ; 932ac (24:72ac)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
@@ -2082,7 +2082,7 @@ Slots_AnimateChansey: ; 932ac (24:72ac)
ret
.limit
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld a, $1
@@ -2100,7 +2100,7 @@ Slots_AnimateChansey: ; 932ac (24:72ac)
ret
.retain
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0C
@@ -2116,7 +2116,7 @@ Slots_AnimateChansey: ; 932ac (24:72ac)
ret
.spawn_egg
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
dec [hl]
push bc
diff --git a/engine/specials.asm b/engine/specials.asm
index c15422750..2d9b6f998 100644
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -2,9 +2,9 @@
Special:: ; c01b
; Run script special de.
ld hl, SpecialsPointers
-rept 3
add hl,de
-endr
+ add hl,de
+ add hl,de
ld b, [hl]
inc hl
ld a, [hli]
@@ -114,7 +114,7 @@ SpecialsPointers:: ; c029
add_special RandomPhoneRareWildMon
add_special RandomPhoneWildMon
add_special RandomPhoneMon
- add_special RunCallback_04
+ add_special MapCallbackSprites_LoadUsedSpritesGFX
add_special PlaySlowCry
add_special SpecialSnorlaxAwake
add_special Special_YoungerHaircutBrother
@@ -179,7 +179,7 @@ SpecialsPointers:: ; c029
add_special Mobile_SelectThreeMons
add_special Function1037eb
add_special Function10383c
- add_special Mobile_HealParty
+ add_special TrainerRankings_Healings
add_special RefreshSprites
add_special Function1037c2
add_special Mobile_DummyReturnFalse
diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm
index 5addaad5d..0e25cafdf 100755
--- a/engine/sprite_anims.asm
+++ b/engine/sprite_anims.asm
@@ -133,17 +133,17 @@ DoAnimFrame: ; 8d24b
ret
.four ; 8d302 (23:5302)
- call .anonymous_dw
+ call .AnonymousJumptable
jp [hl]
; 8d306 (23:5306)
-; Anonymous dw (see .anonymous_dw)
+; Anonymous dw (see .AnonymousJumptable)
dw .four_zero
dw .four_one
; 8d30a
.four_zero ; 8d30a
- call .IncrementSpriteAnimStruct0B
+ call .IncrementJumptableIndex
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
@@ -245,7 +245,7 @@ DoAnimFrame: ; 8d24b
add hl, bc
dec [hl]
.asm_8d395
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
@@ -267,7 +267,7 @@ DoAnimFrame: ; 8d24b
add hl, bc
ld a, [hl]
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
add [hl]
ld [hl], a
@@ -290,7 +290,7 @@ DoAnimFrame: ; 8d24b
add hl, bc
ld d, [hl]
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
@@ -345,7 +345,7 @@ DoAnimFrame: ; 8d24b
inc hl
ld [hl], d
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
xor $20
@@ -372,7 +372,7 @@ DoAnimFrame: ; 8d24b
ret
.SlotsChanseyEgg: ; 8d43e (23:543e)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
dec [hl]
@@ -417,11 +417,11 @@ DoAnimFrame: ; 8d24b
ret
.sixteen ; 8d483 (23:5483)
- call .anonymous_dw
+ call .AnonymousJumptable
jp [hl]
; 8d487 (23:5487)
-; Anonymous dw (see .anonymous_dw)
+; Anonymous dw (see .AnonymousJumptable)
dw .sixteen_zero
dw .sixteen_one
dw .sixteen_two
@@ -434,7 +434,7 @@ DoAnimFrame: ; 8d24b
ld a, $14
call _ReinitSpriteAnimFrame
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $2
@@ -454,7 +454,7 @@ DoAnimFrame: ; 8d24b
ret
.asm_8d4af
- call .IncrementSpriteAnimStruct0B
+ call .IncrementJumptableIndex
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -482,7 +482,7 @@ DoAnimFrame: ; 8d24b
; 8d4d5
.sixteen_one ; 8d4d5
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $4
@@ -539,7 +539,7 @@ DoAnimFrame: ; 8d24b
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
- call .IncrementSpriteAnimStruct0B
+ call .IncrementJumptableIndex
ret
.sixteen_five ; 8d526
@@ -554,19 +554,19 @@ DoAnimFrame: ; 8d24b
inc [hl]
inc [hl]
cp $b0
- jr nc, .asm_8d53f
+ jr nc, .delete
and $3
ret nz
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
call PlaySFX
ret
-.asm_8d53f
+.delete
call DeinitializeSprite
ret
.eighteen ; 8d543 (23:5543)
- callab Function29676
+ callab TradeAnim_AnimateTrademonInTube
ret
.EggShell: ; 8d54a (23:554a)
@@ -579,7 +579,7 @@ DoAnimFrame: ; 8d24b
add $8
ld [hl], a
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
xor $20
@@ -630,9 +630,9 @@ DoAnimFrame: ; 8d24b
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
push af
push de
call .Sprites_Sine
@@ -804,12 +804,12 @@ endr
ret
.thirtytwo ; 8d680 (23:5680)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld d, [hl]
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -847,21 +847,21 @@ endr
ret
.twentysix ; 8d6b7 (23:56b7)
- callba Function11d0b6
+ callba AnimateEZChatCursor
ret
.thirtyone ; 8d6be (23:56be)
callba UpdateCelebiPosition
ret
-.anonymous_dw ; 8d6c5 (23:56c5)
+.AnonymousJumptable: ; 8d6c5 (23:56c5)
ld hl, [sp+$0]
ld e, [hl]
inc hl
ld d, [hl]
inc de
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld l, [hl]
ld h, $0
@@ -873,8 +873,8 @@ endr
ret
; 8d6d8 (23:56d8)
-.IncrementSpriteAnimStruct0B: ; 8d6d8
- ld hl, SPRITEANIMSTRUCT_0B
+.IncrementJumptableIndex: ; 8d6d8
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
diff --git a/engine/sprites.asm b/engine/sprites.asm
index 5755c6d8f..70240e0e0 100755
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -154,9 +154,9 @@ InitSpriteAnimStruct:: ; 8cfd6
ld e, a
ld d, 0
ld hl, SpriteAnimSeqData
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld e, l
ld d, h
; Set hl to the first field (field 0) in the current structure.
@@ -341,7 +341,7 @@ AddOrSubtractX: ; 8d0ce
push hl
ld a, [hl]
ld hl, wCurrSpriteAddSubFlags
- bit 5, [hl]
+ bit 5, [hl] ; x flip
jr z, .ok
; 8 - a
add $8
@@ -521,9 +521,9 @@ GetFrameOAMPointer: ; 8d1a2
ld e, a
ld d, 0
ld hl, SpriteAnimOAMData
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ret
; 8d1ac
@@ -556,8 +556,8 @@ SpriteAnimSeqData: ; 8d1c4
db SPRITE_ANIM_FRAMESET_07, SPRITE_ANIM_SEQ_04, $00 ; 01
db SPRITE_ANIM_FRAMESET_08, SPRITE_ANIM_SEQ_05, $05 ; 02
db SPRITE_ANIM_FRAMESET_GAMEFREAK_LOGO, SPRITE_ANIM_SEQ_GAMEFREAK_LOGO, $00 ; 03
- db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04
- db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05
+ db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04 gs intro star
+ db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05 gs intro sparkle
db SPRITE_ANIM_FRAMESET_SLOT_GOLEM, SPRITE_ANIM_SEQ_SLOT_GOLEM, $07 ; 06 slots golem
db SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY, SPRITE_ANIM_SEQ_SLOTS_CHANSEY, $07 ; 07 slots chansey
db SPRITE_ANIM_FRAMESET_SLOTS_EGG, SPRITE_ANIM_SEQ_SLOTS_EGG, $07 ; 08 slots egg
@@ -569,11 +569,11 @@ SpriteAnimSeqData: ; 8d1c4
db SPRITE_ANIM_FRAMESET_13, SPRITE_ANIM_SEQ_10, $00 ; 0e
db SPRITE_ANIM_FRAMESET_15, SPRITE_ANIM_SEQ_NULL, $00 ; 0f
db SPRITE_ANIM_FRAMESET_16, SPRITE_ANIM_SEQ_11, $00 ; 10
- db SPRITE_ANIM_FRAMESET_17, SPRITE_ANIM_SEQ_12, $00 ; 11
- db SPRITE_ANIM_FRAMESET_18, SPRITE_ANIM_SEQ_12, $00 ; 12
+ db SPRITE_ANIM_FRAMESET_TRADEMON_ICON, SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE, $00 ; 11
+ db SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE, SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE, $00 ; 12
db SPRITE_ANIM_FRAMESET_19, SPRITE_ANIM_SEQ_13, $00 ; 13
db SPRITE_ANIM_FRAMESET_1A, SPRITE_ANIM_SEQ_14, $00 ; 14 radio tuning knob
- db SPRITE_ANIM_FRAMESET_1B, SPRITE_ANIM_SEQ_NULL, $00 ; 15
+ db SPRITE_ANIM_FRAMESET_1B, SPRITE_ANIM_SEQ_NULL, $00 ; 15 chris on magnet train
db SPRITE_ANIM_FRAMESET_LEAF, SPRITE_ANIM_SEQ_15, $00 ; 16 leaves when cutting down a tree
db SPRITE_ANIM_FRAMESET_1E, SPRITE_ANIM_SEQ_NULL, $00 ; 17
db SPRITE_ANIM_FRAMESET_LEAF, SPRITE_ANIM_SEQ_FLY_LEAF, $00 ; 18 flying leaves
@@ -582,8 +582,8 @@ SpriteAnimSeqData: ; 8d1c4
db SPRITE_ANIM_FRAMESET_25, SPRITE_ANIM_SEQ_NULL, $00 ; 1b headbutt
db SPRITE_ANIM_FRAMESET_20, SPRITE_ANIM_SEQ_13, $00 ; 1c
db SPRITE_ANIM_FRAMESET_26, SPRITE_ANIM_SEQ_1A, $00 ; 1d
- db SPRITE_ANIM_FRAMESET_2D, SPRITE_ANIM_SEQ_NULL, $00 ; 1e
- db SPRITE_ANIM_FRAMESET_2E, SPRITE_ANIM_SEQ_NULL, $00 ; 1f
+ db SPRITE_ANIM_FRAMESET_2D, SPRITE_ANIM_SEQ_NULL, $00 ; 1e kris on map
+ db SPRITE_ANIM_FRAMESET_2E, SPRITE_ANIM_SEQ_NULL, $00 ; 1f kris on magnet train
db SPRITE_ANIM_FRAMESET_2F, SPRITE_ANIM_SEQ_NULL, $00 ; 20
db SPRITE_ANIM_FRAMESET_30, SPRITE_ANIM_SEQ_NULL, $00 ; 21
db SPRITE_ANIM_FRAMESET_31, SPRITE_ANIM_SEQ_NULL, $00 ; 22
diff --git a/engine/startmenu.asm b/engine/startmenu.asm
index b2b82bd6a..fa61d99cb 100755
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -5,7 +5,7 @@ StartMenu:: ; 125cd
ld de, SFX_MENU
call PlaySFX
- callba Function6454
+ callba ReanchorBGMap_NoOAMUpdate
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
@@ -19,11 +19,11 @@ StartMenu:: ; 125cd
ld a, [wd0d2]
ld [wMenuCursorBuffer], a
call .DrawMenuAccount_
- call MenuFunc_1e7f
+ call DrawVariableLengthMenuBox
call .DrawBugContestStatusBox
- call Function2e31
- call Function2e20
- callba Function64bf
+ call SafeUpdateSprites
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
+ callba LoadFonts_NoOAMUpdate
call .DrawBugContestStatus
call UpdateTimePals
jr .Select
@@ -142,7 +142,7 @@ StartMenu:: ; 125cd
call Call_ExitMenu
call ReloadTilesetAndPalettes
call .DrawMenuAccount_
- call MenuFunc_1e7f
+ call DrawVariableLengthMenuBox
call .DrawBugContestStatus
call UpdateSprites
call ret_d90
@@ -194,31 +194,31 @@ StartMenu:: ; 125cd
.QuitString: db "QUIT@"
.PokedexDesc: db "#MON"
- next "database@"
+ next "database@"
.PartyDesc: db "Party ", $4a
- next "status@"
+ next "status@"
.PackDesc: db "Contains"
- next "items@"
+ next "items@"
.PokegearDesc: db "Trainer's"
- next "key device@"
+ next "key device@"
.StatusDesc: db "Your own"
- next "status@"
+ next "status@"
.SaveDesc: db "Save your"
- next "progress@"
+ next "progress@"
.OptionDesc: db "Change"
- next "settings@"
+ next "settings@"
.ExitDesc: db "Close this"
- next "menu@"
+ next "menu@"
.QuitDesc: db "Quit and"
- next "be judged.@"
+ next "be judged.@"
.OpenMenu: ; 127e5
@@ -1255,7 +1255,7 @@ MonMenu_Fly: ; 12e30
jr z, .Fail
cp $0
jr z, .Error
- callba MobileFn_1060b5
+ callba TrainerRankings_Fly
ld b, $4
ld a, $2
ret
@@ -1457,7 +1457,7 @@ ChooseMoveToDelete: ; 12f5b
push af
set NO_TEXT_SCROLL, [hl]
call LoadFontsBattleExtra
- call .asm_12f73
+ call .ChooseMoveToDelete
pop bc
ld a, b
ld [Options], a
@@ -1467,36 +1467,36 @@ ChooseMoveToDelete: ; 12f5b
ret
; 12f73
-.asm_12f73
+.ChooseMoveToDelete
call SetUpMoveScreenBG
ld de, DeleteMoveScreenAttrs
call SetMenuAttributes
call SetUpMoveList
ld hl, w2DMenuFlags1
set 6, [hl]
- jr .asm_12f93
+ jr .enter_loop
-.asm_12f86
+.loop
call ScrollingMenuJoypad
- bit 1, a
- jp nz, .asm_12f9f
- bit 0, a
- jp nz, .asm_12f9c
+ bit B_BUTTON_F, a
+ jp nz, .b_button
+ bit A_BUTTON_F, a
+ jp nz, .a_button
-.asm_12f93
+.enter_loop
call PrepareToPlaceMoveData
call PlaceMoveData
- jp .asm_12f86
+ jp .loop
; 12f9c
-.asm_12f9c
+.a_button
and a
- jr .asm_12fa0
+ jr .finish
-.asm_12f9f
+.b_button
scf
-.asm_12fa0
+.finish
push af
xor a
ld [wSwitchMon], a
@@ -1762,7 +1762,7 @@ SetUpMoveScreenBG: ; 13172
call ClearSprites
xor a
ld [hBGMapMode], a
- callba Functionfb571
+ callba LoadStatsScreenPageTilesGFX
callba ClearSpriteAnims2
ld a, [CurPartyMon]
ld e, a
@@ -1797,7 +1797,7 @@ SetUpMoveScreenBG: ; 13172
call PrintLevel
ld hl, PlayerHPPal
call SetHPPal
- ld b, SCGB_0E
+ ld b, SCGB_MOVE_LIST
call GetSGBLayout
hlcoord 16, 0
lb bc, 1, 3
diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm
index e3bc6069c..2412c0e13 100755
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -6,14 +6,14 @@ BattleStatsScreenInit: ; 4dc7b (13:5c7b)
ld a, [wBattleMode] ; wd22d (aliases: EnemyMonEnd)
and a
jr z, StatsScreenInit
- jr _BattleStatsScreenInit
+ jr _MobileStatsScreenInit
StatsScreenInit: ; 4dc8a
ld hl, StatsScreenMain
jr StatsScreenInit_gotaddress
-_BattleStatsScreenInit: ; 4dc8f
- ld hl, StatsScreenBattle
+_MobileStatsScreenInit: ; 4dc8f
+ ld hl, StatsScreenMobile
jr StatsScreenInit_gotaddress
StatsScreenInit_gotaddress: ; 4dc94
@@ -33,7 +33,7 @@ StatsScreenInit_gotaddress: ; 4dc94
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
- callba Functionfb53e
+ callba StatsScreen_LoadFont
pop hl
call _hl_
call ClearBGPalettes
@@ -73,7 +73,7 @@ StatsScreenMain: ; 0x4dcd2
ret
; 0x4dcf7
-StatsScreenBattle: ; 4dcf7
+StatsScreenMobile: ; 4dcf7
xor a
ld [wJumptableIndex], a
; stupid interns
@@ -89,7 +89,7 @@ StatsScreenBattle: ; 4dcf7
ld hl, StatsScreenPointerTable
rst JumpTable
call StatsScreen_WaitAnim
- callba Function100dfd
+ callba MobileComms_CheckInactivityTimer
jr c, .exit
ld a, [wJumptableIndex]
bit 7, a
@@ -100,7 +100,6 @@ StatsScreenBattle: ; 4dcf7
; 4dd2a
StatsScreenPointerTable: ; 4dd2a
-
dw MonStatsInit ; regular pokémon
dw EggStatsInit ; egg
dw StatsScreenWaitCry
@@ -129,7 +128,7 @@ StatsScreen_WaitAnim: ; 4dd3a (13:5d3a)
.finish
ld hl, wcf64
res 5, [hl]
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62)
@@ -149,7 +148,7 @@ MonStatsInit: ; 4dd72 (13:5d72)
res 6, [hl]
call ClearBGPalettes
call ClearTileMap
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call StatsScreen_CopyToTempMon
ld a, [CurPartySpecies]
cp EGG
@@ -223,7 +222,7 @@ StatsScreenWaitCry: ; 4dde6 (13:5de6)
StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2)
ld a, [MonType]
- cp BREEDMON
+ cp TEMPMON
jr nz, .breedmon
ld a, [wBufferMon]
ld [CurSpecies], a
@@ -250,7 +249,7 @@ StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2)
StatsScreen_GetJoypad: ; 4de2c (13:5e2c)
call GetJoypad
ld a, [MonType]
- cp BREEDMON
+ cp TEMPMON
jr nz, .notbreedmon
push hl
push de
@@ -641,9 +640,8 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
inc a
ld d, a
callba CalcExpAtLevel
-rept 2
ld hl, TempMonExp + 2
-endr
+ ld hl, TempMonExp + 2
ld a, [hQuotient + 2]
sub [hl]
dec hl
@@ -660,9 +658,8 @@ endr
.AlreadyAtMaxLevel:
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ret
; 4e119 (13:6119)
@@ -1016,7 +1013,7 @@ EggStatsScreen: ; 4e33a
call DelayFrame
hlcoord 0, 0
call PrepMonFrontpic
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call StatsScreen_AnimateEgg
ld a, [TempMonHappiness]
@@ -1147,7 +1144,7 @@ GetNicknamePointer: ; 4e528 (13:6528)
ld h, [hl]
ld l, a
ld a, [MonType]
- cp BREEDMON
+ cp TEMPMON
ret z
ld a, [CurPartyMon]
jp SkipNames
diff --git a/engine/std_scripts.asm b/engine/std_scripts.asm
index 9c9542cf4..4b69a4de1 100644
--- a/engine/std_scripts.asm
+++ b/engine/std_scripts.asm
@@ -107,7 +107,7 @@ PokeCenterNurseScript:
farwritetext NurseTakePokemonText
pause 20
- special Mobile_HealParty
+ special TrainerRankings_Healings
spriteface LAST_TALKED, LEFT
pause 10
special HealParty
@@ -1907,8 +1907,8 @@ HappinessCheckScript:
end
Movement_ContestResults_WalkAfterWarp: ; bcea1
- step_right
- step_down
- turn_head_up
+ step RIGHT
+ step DOWN
+ turn_head UP
step_end
; bcea5
diff --git a/engine/switch_items.asm b/engine/switch_items.asm
index 0d4512876..b699d4719 100755
--- a/engine/switch_items.asm
+++ b/engine/switch_items.asm
@@ -231,9 +231,8 @@ ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80)
ld c, a
ld b, 0
ld hl, .spacing_dws
-rept 2
add hl, bc
-endr
+ add hl, bc
ld c, [hl]
inc hl
ld b, [hl]
diff --git a/engine/time.asm b/engine/time.asm
index 255346c0a..2112ec35c 100755
--- a/engine/time.asm
+++ b/engine/time.asm
@@ -102,9 +102,9 @@ CheckDailyResetTimer:: ; 11452
ret nc
xor a
ld hl, DailyFlags
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld hl, wDailyRematchFlags
rept 4
@@ -374,17 +374,16 @@ CalcHoursDaysSince: ; 115d2
; 115d6
CalcMinsHoursDaysSince: ; 115d6
-rept 2
inc hl
-endr
+ inc hl
xor a
jr _CalcMinsHoursDaysSince
; 115db
CalcSecsMinsHoursDaysSince: ; 115db
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, [hSeconds]
ld c, a
sub [hl]
diff --git a/engine/time_capsule/conversion.asm b/engine/time_capsule/conversion.asm
index 5d093d515..561721074 100755
--- a/engine/time_capsule/conversion.asm
+++ b/engine/time_capsule/conversion.asm
@@ -46,9 +46,8 @@ ValidateOTTrademon: ; fb57e
ld [CurSpecies], a
call GetBaseData
ld hl, wLinkOTPartyMonTypes
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [BaseType1]
cp [hl]
jr nz, .abnormal
@@ -384,7 +383,7 @@ NewPokedexEntry: ; fb877
ld [TempMonDVs], a
ld a, [hl]
ld [TempMonDVs + 1], a
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
ret
diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm
index 1bfc2457b..e9b19c6f7 100644
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -140,9 +140,9 @@ Special_BattleTowerFade: ; 8c092
ld b, $4
.asm_8c09c
call DmgToCgbTimePals
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld c, $7
call DelayFrames
dec b
@@ -245,9 +245,8 @@ GetTimePalette: ; 8c117
ld e, a
ld d, 0
ld hl, .TimePalettes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -305,9 +304,9 @@ DmgToCgbTimePals: ; 8c14e
ConvertTimePalsIncHL: ; 8c15e
.loop
call DmgToCgbTimePals
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld c, 2
call DelayFrames
dec b
@@ -318,9 +317,9 @@ endr
ConvertTimePalsDecHL: ; 8c16d
.loop
call DmgToCgbTimePals
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld c, 2
call DelayFrames
dec b
@@ -346,9 +345,8 @@ GetTimePalFade: ; 8c17c
ld c, a
ld b, $0
ld hl, .dmgfades
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/engine/timeset.asm b/engine/timeset.asm
index fd6b2de94..f828b0ff8 100755
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -18,7 +18,7 @@ InitClock: ; 90672 (24:4672)
call RotateFourPalettesLeft
call ClearTileMap
call ClearSprites
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
xor a
ld [hBGMapMode], a
@@ -200,9 +200,8 @@ UnreferencedFunction907f1: ; 907f1
push hl
call DisplayHourOClock
pop de
-rept 2
inc de
-endr
+ inc de
ld a, ":"
ld [de], a
inc de
@@ -216,9 +215,9 @@ endr
ld [hl], a
pop hl
call DisplayMinutesWithMinString
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ret
; 90810
@@ -521,9 +520,8 @@ Special_SetDayOfWeek: ; 90913
ld e, a
ld d, 0
ld hl, .WeekdayStrings
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@@ -579,7 +577,7 @@ Special_InitialSetDSTFlag: ; 90a54
lb bc, 3, 18
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90a6c
@@ -610,7 +608,7 @@ Special_InitialClearDSTFlag: ; 90a88
lb bc, 3, 18
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90aa0
@@ -638,7 +636,7 @@ DebugDisplayTime: ; 90abc
lb bc, 3, SCREEN_WIDTH - 2
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90acc
diff --git a/engine/title.asm b/engine/title.asm
index 30804fbe8..787872939 100644
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -188,8 +188,8 @@ _TitleScreen: ; 10ed67
call ByteFill
; Let LCD Stat know we're messing around with SCX
- ld a, rSCX - rJOYP
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
pop af
ld [rSVBK], a
@@ -351,9 +351,8 @@ InitializeBackground: ; 10ef06
ld b, a
ld a, e
ld [hli], a
-rept 2
inc e
-endr
+ inc e
ld a, $80
ld [hli], a
dec c
@@ -378,9 +377,9 @@ AnimateTitleCrystal: ; 10ef32
ld a, [hl]
add 2
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop
diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm
index 289857623..6e32fdae8 100755
--- a/engine/tmhm2.asm
+++ b/engine/tmhm2.asm
@@ -146,7 +146,7 @@ TeachTMHM: ; 2c867
and a
jr z, .nope
- callba MobileFn_106049
+ callba TrainerRankings_TMsHMsTaught
ld a, [CurItem]
call IsHM
ret c
@@ -423,9 +423,9 @@ TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2)
.NotTMHM:
call TMHMPocket_GetCurrentLineCoord
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
push de
ld de, TMHM_String_Cancel
call PlaceString
@@ -581,9 +581,8 @@ PrintMoveDesc: ; 2cb3e
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
diff --git a/engine/trade/animation.asm b/engine/trade/animation.asm
index 91e190075..d90f45a82 100755
--- a/engine/trade/animation.asm
+++ b/engine/trade/animation.asm
@@ -7,10 +7,10 @@ TradeAnimation: ; 28f24
ld hl, wPlayerTrademonSpecies
ld de, wOTTrademonSpecies
call LinkTradeAnim_LoadTradeMonSpecies
- ld de, .data_28f3f
- jr RunTradeAnimSequence
+ ld de, .script
+ jr RunTradeAnimScript
-.data_28f3f
+.script
tradeanim_setup_givemon_scroll
tradeanim_show_givemon_data
tradeanim_do_givemon_scroll
@@ -22,7 +22,7 @@ TradeAnimation: ; 28f24
tradeanim_wait_anim
tradeanim_bulge_through_tube
tradeanim_wait_anim
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_give_trademon_sfx
tradeanim_tube_to_ot
tradeanim_sent_to_ot_text
@@ -41,10 +41,10 @@ TradeAnimation: ; 28f24
tradeanim_show_getmon_data
tradeanim_poof
tradeanim_wait_anim
- tradeanim_1d
+ tradeanim_frontpic_scroll
tradeanim_animate_frontpic
tradeanim_wait_80_if_ot_egg
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_take_care_of_text
tradeanim_scroll_out_right
tradeanim_end
@@ -58,10 +58,10 @@ TradeAnimationPlayer2: ; 28f63
ld hl, wOTTrademonSpecies
ld de, wPlayerTrademonSpecies
call LinkTradeAnim_LoadTradeMonSpecies
- ld de, .data_28f7e
- jr RunTradeAnimSequence
+ ld de, .script
+ jr RunTradeAnimScript
-.data_28f7e
+.script
tradeanim_ot_sends_text_2
tradeanim_ot_bids_farewell
tradeanim_wait_40
@@ -75,10 +75,10 @@ TradeAnimationPlayer2: ; 28f63
tradeanim_show_getmon_data
tradeanim_poof
tradeanim_wait_anim
- tradeanim_1d
+ tradeanim_frontpic_scroll
tradeanim_animate_frontpic
tradeanim_wait_180_if_ot_egg
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_take_care_of_text
tradeanim_scroll_out_right
@@ -92,14 +92,14 @@ TradeAnimationPlayer2: ; 28f63
tradeanim_wait_anim
tradeanim_bulge_through_tube
tradeanim_wait_anim
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_give_trademon_sfx
tradeanim_tube_to_player
tradeanim_sent_to_ot_text
tradeanim_scroll_out_right
tradeanim_end
-RunTradeAnimSequence: ; 28fa1
+RunTradeAnimScript: ; 28fa1
ld hl, wTradeAnimPointer
ld [hl], e
inc hl
@@ -132,6 +132,7 @@ RunTradeAnimSequence: ; 28fa1
pop af
ld [hMapAnims], a
ret
+
; 28fdb
.TradeAnimLayout: ; 28fdb
@@ -197,8 +198,9 @@ RunTradeAnimSequence: ; 28fa1
ld a, [wOTTrademonSpecies]
ld de, wOTTrademonSpeciesName
call TradeAnim_GetNickname
- call Function297ed
+ call TradeAnim_NormalPals
ret
+
; 29082
DoTradeAnimation: ; 29082
@@ -217,6 +219,7 @@ DoTradeAnimation: ; 29082
call LoadStandardFont
scf
ret
+
; 290a0
.DoTradeAnimCommand: ; 290a0
@@ -224,9 +227,8 @@ DoTradeAnimation: ; 29082
ld e, a
ld d, 0
ld hl, .JumpTable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -234,63 +236,64 @@ endr
; 290af
.JumpTable: ; 290af
- dw TradeAnim_Next ; 00
- dw TradeAnim_ShowGivemonData ; 01
- dw TradeAnim_ShowGetmonData ; 02
- dw TradeAnim_EnterLinkTube ; 03
- dw TradeAnim_04 ; 04
- dw TradeAnim_ExitLinkTube ; 05
- dw TradeAnim_TubeToOT1 ; 06
- dw TradeAnim_TubeToOT2 ; 07
- dw TradeAnim_TubeToOT3 ; 08
- dw TradeAnim_TubeToOT4 ; 09
- dw TradeAnim_TubeToOT5 ; 0a
- dw TradeAnim_TubeToOT6 ; 0b
- dw TradeAnim_TubeToOT7 ; 0c
- dw TradeAnim_TubeToOT8 ; 0d
- dw TradeAnim_TubeToPlayer1 ; 0e
- dw TradeAnim_TubeToPlayer2 ; 0f
- dw TradeAnim_TubeToPlayer3 ; 10
- dw TradeAnim_TubeToPlayer4 ; 11
- dw TradeAnim_TubeToPlayer5 ; 12
- dw TradeAnim_TubeToPlayer6 ; 13
- dw TradeAnim_TubeToPlayer7 ; 14
- dw TradeAnim_TubeToPlayer8 ; 15
- dw TradeAnim_SentToOTText ; 16
- dw TradeAnim_OTBidsFarewell ; 17
- dw TradeAnim_TakeCareOfText ; 18
- dw TradeAnim_OTSendsText1 ; 19
- dw TradeAnim_OTSendsText2 ; 1a
- dw TradeAnim_SetupGivemonScroll ; 1b
- dw TradeAnim_DoGivemonScroll ; 1c
- dw TradeAnim_1d ; 1d
- dw TradeAnim_1e ; 1e
- dw TradeAnim_ScrollOutRight ; 1f
- dw TradeAnim_ScrollOutRight2 ; 20
- dw TraideAnim_Wait80 ; 21
- dw TraideAnim_Wait40 ; 22
- dw TradeAnim_RockingBall ; 23
- dw TradeAnim_DropBall ; 24
- dw TradeAnim_WaitAnim ; 25
- dw TradeAnim_WaitAnim2 ; 26
- dw TradeAnim_Poof ; 27
+ dw TradeAnim_AdvanceScriptPointer ; 00
+ dw TradeAnim_ShowGivemonData ; 01
+ dw TradeAnim_ShowGetmonData ; 02
+ dw TradeAnim_EnterLinkTube1 ; 03
+ dw TradeAnim_EnterLinkTube2 ; 04
+ dw TradeAnim_ExitLinkTube ; 05
+ dw TradeAnim_TubeToOT1 ; 06
+ dw TradeAnim_TubeToOT2 ; 07
+ dw TradeAnim_TubeToOT3 ; 08
+ dw TradeAnim_TubeToOT4 ; 09
+ dw TradeAnim_TubeToOT5 ; 0a
+ dw TradeAnim_TubeToOT6 ; 0b
+ dw TradeAnim_TubeToOT7 ; 0c
+ dw TradeAnim_TubeToOT8 ; 0d
+ dw TradeAnim_TubeToPlayer1 ; 0e
+ dw TradeAnim_TubeToPlayer2 ; 0f
+ dw TradeAnim_TubeToPlayer3 ; 10
+ dw TradeAnim_TubeToPlayer4 ; 11
+ dw TradeAnim_TubeToPlayer5 ; 12
+ dw TradeAnim_TubeToPlayer6 ; 13
+ dw TradeAnim_TubeToPlayer7 ; 14
+ dw TradeAnim_TubeToPlayer8 ; 15
+ dw TradeAnim_SentToOTText ; 16
+ dw TradeAnim_OTBidsFarewell ; 17
+ dw TradeAnim_TakeCareOfText ; 18
+ dw TradeAnim_OTSendsText1 ; 19
+ dw TradeAnim_OTSendsText2 ; 1a
+ dw TradeAnim_SetupGivemonScroll ; 1b
+ dw TradeAnim_DoGivemonScroll ; 1c
+ dw TradeAnim_FrontpicScrollStart ; 1d
+ dw TradeAnim_TextboxScrollStart ; 1e
+ dw TradeAnim_ScrollOutRight ; 1f
+ dw TradeAnim_ScrollOutRight2 ; 20
+ dw TraideAnim_Wait80 ; 21
+ dw TraideAnim_Wait40 ; 22
+ dw TradeAnim_RockingBall ; 23
+ dw TradeAnim_DropBall ; 24
+ dw TradeAnim_WaitAnim ; 25
+ dw TradeAnim_WaitAnim2 ; 26
+ dw TradeAnim_Poof ; 27
dw TradeAnim_BulgeThroughTube ; 28
- dw TradeAnim_GiveTrademonSFX ; 29
- dw TradeAnim_GetTrademonSFX ; 2a
- dw TradeAnim_End ; 2b
- dw TradeAnim_AnimateFrontpic ; 2c
- dw TraideAnim_Wait96 ; 2d
- dw TraideAnim_Wait80IfOTEgg ; 2e
- dw TraideAnim_Wait180IfOTEgg ; 2f
+ dw TradeAnim_GiveTrademonSFX ; 29
+ dw TradeAnim_GetTrademonSFX ; 2a
+ dw TradeAnim_End ; 2b
+ dw TradeAnim_AnimateFrontpic ; 2c
+ dw TraideAnim_Wait96 ; 2d
+ dw TraideAnim_Wait80IfOTEgg ; 2e
+ dw TraideAnim_Wait180IfOTEgg ; 2f
; 2910f
-NextTradeAnim: ; 2910f
+TradeAnim_IncrementJumptableIndex: ; 2910f
ld hl, wJumptableIndex
inc [hl]
ret
+
; 29114
-TradeAnim_Next: ; 29114
+TradeAnim_AdvanceScriptPointer: ; 29114
ld hl, wTradeAnimPointer
ld e, [hl]
inc hl
@@ -302,47 +305,51 @@ TradeAnim_Next: ; 29114
dec hl
ld [hl], e
ret
+
; 29123
TradeAnim_End: ; 29123
ld hl, wJumptableIndex
set 7, [hl]
ret
+
; 29129
TradeAnim_TubeToOT1: ; 29129
- ld a, $ed
- call Function292f6
+ ld a, $ed ; >>>>>>>>
+ call TradeAnim_PlaceTrademonStatsOnTubeAnim
ld a, [wLinkTradeSendmonSpecies]
ld [wd265], a
xor a
depixel 5, 11, 4, 0
ld b, $0
- jr Function2914e
+ jr TradeAnim_InitTubeAnim
TradeAnim_TubeToPlayer1: ; 2913c
- ld a, $ee
- call Function292f6
+ ld a, $ee ; <<<<<<<<
+ call TradeAnim_PlaceTrademonStatsOnTubeAnim
ld a, [wLinkTradeGetmonSpecies]
ld [wd265], a
ld a, $2
depixel 9, 18, 4, 4
ld b, $4
-
-Function2914e: ; 2914e
+TradeAnim_InitTubeAnim: ; 2914e
push bc
push de
push bc
push de
+
push af
call DisableLCD
callab ClearSpriteAnims
hlbgcoord 20, 3
- ld bc, $c
+ ld bc, 12
ld a, $60
call ByteFill
pop af
- call Function29281
+
+ call TradeAnim_TubeAnimJumptable
+
xor a
ld [hSCX], a
ld a, $7
@@ -351,113 +358,127 @@ Function2914e: ; 2914e
ld [hWY], a
call EnableLCD
call LoadTradeBubbleGFX
+
pop de
- ld a, SPRITE_ANIM_INDEX_11
+ ld a, SPRITE_ANIM_INDEX_TRADEMON_ICON
call _InitSpriteAnimStruct
- ld hl, $b
+
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
pop bc
ld [hl], b
+
pop de
- ld a, SPRITE_ANIM_INDEX_12
+ ld a, SPRITE_ANIM_INDEX_TRADEMON_BUBBLE
call _InitSpriteAnimStruct
- ld hl, $b
+
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
pop bc
ld [hl], b
+
call WaitBGMap
- ld b, SCGB_1B
+ ld b, SCGB_TRADE_TUBE
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
- ld a, $d0
+ ld a, %11010000
call DmgToCgbObjPal0
- call NextTradeAnim
+
+ call TradeAnim_IncrementJumptableIndex
ld a, $5c
ld [wcf64], a
ret
+
; 291af
TradeAnim_TubeToOT2: ; 291af
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
add $2
ld [hSCX], a
cp $50
ret nz
ld a, $1
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291c4
TradeAnim_TubeToOT3: ; 291c4
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
add $2
ld [hSCX], a
cp $a0
ret nz
ld a, $2
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291d9
TradeAnim_TubeToOT4: ; 291d9
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
add $2
ld [hSCX], a
and a
ret nz
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291e8
TradeAnim_TubeToPlayer3: ; 291e8
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
sub $2
ld [hSCX], a
cp $b0
ret nz
ld a, $1
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291fd
TradeAnim_TubeToPlayer4: ; 291fd
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
sub $2
ld [hSCX], a
cp $60
ret nz
xor a
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 29211
TradeAnim_TubeToPlayer5: ; 29211
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
sub $2
ld [hSCX], a
and a
ret nz
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 29220
TradeAnim_TubeToOT6:
TradeAnim_TubeToPlayer6: ; 29220
ld a, $80
ld [wcf64], a
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 29229
TradeAnim_TubeToOT8:
@@ -478,16 +499,17 @@ TradeAnim_TubeToPlayer8: ; 29229
call EnableLCD
call LoadTradeBallAndCableGFX
call WaitBGMap
- call Function297ed
- call TradeAnim_Next
+ call TradeAnim_NormalPals
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2925d
TradeAnim_TubeToOT5:
TradeAnim_TubeToOT7:
TradeAnim_TubeToPlayer2:
TradeAnim_TubeToPlayer7: ; 2925d
- call Function2981d
+ call TradeAnim_FlashBGPals
ld hl, wcf64
ld a, [hl]
and a
@@ -496,47 +518,50 @@ TradeAnim_TubeToPlayer7: ; 2925d
ret
.done
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 2926d
TradeAnim_GiveTrademonSFX: ; 2926d
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld de, SFX_GIVE_TRADEMON
call PlaySFX
ret
+
; 29277
TradeAnim_GetTrademonSFX: ; 29277
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld de, SFX_GET_TRADEMON
call PlaySFX
ret
+
; 29281
-Function29281: ; 29281
+TradeAnim_TubeAnimJumptable: ; 29281
and 3
ld e, a
ld d, 0
- ld hl, Jumptable_2928f
-rept 2
+ ld hl, .Jumptable
+ add hl, de
add hl, de
-endr
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 2928f
-Jumptable_2928f: ; 2928f
- dw Function29297
- dw Function292af
- dw Function292be
- dw Function29297
+.Jumptable: ; 2928f
+ dw .Zero
+ dw .One
+ dw .Two
+ dw .Three
; 29297
-Function29297: ; 29297
- call Function297cf
+.Zero: ; 29297
+.Three: ; 29297
+ call TradeAnim_BlankTileMap
hlcoord 9, 3
ld [hl], $5b
inc hl
@@ -544,21 +569,23 @@ Function29297: ; 29297
ld a, $60
call ByteFill
hlcoord 3, 2
- call Function292ec
+ call TradeAnim_CopyTradeGameBoyTilemap
ret
+
; 292af
-Function292af: ; 292af
- call Function297cf
+.One: ; 292af
+ call TradeAnim_BlankTileMap
hlcoord 0, 3
ld bc, SCREEN_WIDTH
ld a, $60
call ByteFill
ret
+
; 292be
-Function292be: ; 292be
- call Function297cf
+.Two: ; 292be
+ call TradeAnim_BlankTileMap
hlcoord 0, 3
ld bc, $11
ld a, $60
@@ -582,18 +609,20 @@ Function292be: ; 292be
ld a, $5b
ld [hl], a
hlcoord 10, 6
- call Function292ec
+ call TradeAnim_CopyTradeGameBoyTilemap
ret
+
; 292ec
-Function292ec: ; 292ec
+TradeAnim_CopyTradeGameBoyTilemap: ; 292ec
ld de, TradeGameBoyTilemap
lb bc, 8, 6
- call Function297db
+ call TradeAnim_CopyBoxFromDEtoHL
ret
+
; 292f6
-Function292f6: ; 292f6
+TradeAnim_PlaceTrademonStatsOnTubeAnim: ; 292f6
push af
call ClearBGPalettes
call WaitTop
@@ -631,20 +660,21 @@ Function292f6: ; 292f6
ld [hBGMapAddress + 1], a
call ClearTileMap
ret
+
; 29348
-TradeAnim_EnterLinkTube: ; 29348
+TradeAnim_EnterLinkTube1: ; 29348
call ClearTileMap
call WaitTop
ld a, $a0
ld [hSCX], a
call DelayFrame
hlcoord 8, 2
- ld de, Tilemap_298f7
+ ld de, TradeLinkTubeTilemap
lb bc, 3, 12
- call Function297db
+ call TradeAnim_CopyBoxFromDEtoHL
call WaitBGMap
- ld b, SCGB_1B
+ ld b, SCGB_TRADE_TUBE
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -652,11 +682,12 @@ TradeAnim_EnterLinkTube: ; 29348
call DmgToCgbObjPals
ld de, SFX_POTION
call PlaySFX
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 2937e
-TradeAnim_04: ; 2937e
+TradeAnim_EnterLinkTube2: ; 2937e
ld a, [hSCX]
and a
jr z, .done
@@ -667,24 +698,26 @@ TradeAnim_04: ; 2937e
.done
ld c, 80
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29391
TradeAnim_ExitLinkTube: ; 29391
ld a, [hSCX]
cp $a0
- jr z, .asm_2939c
+ jr z, .done
sub $4
ld [hSCX], a
ret
-.asm_2939c
+.done
call ClearTileMap
xor a
ld [hSCX], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293a6
TradeAnim_SetupGivemonScroll: ; 293a6
@@ -694,8 +727,9 @@ TradeAnim_SetupGivemonScroll: ; 293a6
ld [hSCX], a
ld a, $50
ld [hWY], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293b6
TradeAnim_DoGivemonScroll: ; 293b6
@@ -714,26 +748,29 @@ TradeAnim_DoGivemonScroll: ; 293b6
ld [hWX], a
xor a
ld [hSCX], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293d2
-TradeAnim_1d: ; 293d2
+TradeAnim_FrontpicScrollStart: ; 293d2
ld a, $7
ld [hWX], a
ld a, $50
ld [hWY], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293de
-TradeAnim_1e: ; 293de
+TradeAnim_TextboxScrollStart: ; 293de
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293ea
TradeAnim_ScrollOutRight: ; 293ea
@@ -750,8 +787,9 @@ TradeAnim_ScrollOutRight: ; 293ea
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
call ClearTileMap
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 2940c
TradeAnim_ScrollOutRight2: ; 2940c
@@ -772,19 +810,20 @@ TradeAnim_ScrollOutRight2: ; 2940c
ld [hWY], a
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2942e
TradeAnim_ShowGivemonData: ; 2942e
- call Function2951f
+ call ShowPlayerTrademonStats
ld a, [wPlayerTrademonSpecies]
ld [CurPartySpecies], a
ld a, [wPlayerTrademonDVs]
ld [TempMonDVs], a
ld a, [wPlayerTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -798,31 +837,34 @@ TradeAnim_ShowGivemonData: ; 2942e
call PlayCryHeader
.skip_cry
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29461
TradeAnim_ShowGetmonData: ; 29461
- call Function29549
+ call ShowOTTrademonStats
ld a, [wOTTrademonSpecies]
ld [CurPartySpecies], a
ld a, [wOTTrademonDVs]
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
call TradeAnim_ShowGetmonFrontpic
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29487
TradeAnim_AnimateFrontpic: ; 29487
callba AnimateTrademonFrontpic
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29491
TradeAnim_GetFrontpic: ; 29491
@@ -836,6 +878,7 @@ TradeAnim_GetFrontpic: ; 29491
pop de
predef GetFrontpic
ret
+
; 294a9
TradeAnim_GetNickname: ; 294a9
@@ -847,6 +890,7 @@ TradeAnim_GetNickname: ; 294a9
ld bc, NAME_LENGTH
call CopyBytes
ret
+
; 294bb
TradeAnim_ShowGivemonFrontpic: ; 294bb
@@ -861,7 +905,7 @@ TradeAnim_ShowFrontpic: ; 294c3
lb bc, 10, $31
call Request2bpp
call WaitTop
- call Function297cf
+ call TradeAnim_BlankTileMap
hlcoord 7, 2
xor a
ld [hGraphicStartTile], a
@@ -869,27 +913,31 @@ TradeAnim_ShowFrontpic: ; 294c3
predef PlaceGraphic
call WaitBGMap
ret
+
; 294e7
TraideAnim_Wait80: ; 294e7
ld c, 80
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 294f0
TraideAnim_Wait40: ; 294f0
ld c, 40
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 294f9
TraideAnim_Wait96: ; 294f9
ld c, 96
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29502
TraideAnim_Wait80IfOTEgg: ; 29502
@@ -898,6 +946,7 @@ TraideAnim_Wait80IfOTEgg: ; 29502
ld c, 80
call DelayFrames
ret
+
; 2950c
TraideAnim_Wait180IfOTEgg: ; 2950c
@@ -906,55 +955,59 @@ TraideAnim_Wait180IfOTEgg: ; 2950c
ld c, 180
call DelayFrames
ret
+
; 29516
IsOTTrademonEgg: ; 29516
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, [wOTTrademonSpecies]
cp EGG
ret
+
; 2951f
-Function2951f: ; 2951f
+ShowPlayerTrademonStats: ; 2951f
ld de, wPlayerTrademonSpecies
ld a, [de]
cp EGG
- jr z, Function295a1
- call Function29573
+ jr z, TrademonStats_Egg
+ call TrademonStats_MonTemplate
ld de, wPlayerTrademonSpecies
- call Function295e3
+ call TrademonStats_PrintSpeciesNumber
ld de, wPlayerTrademonSpeciesName
- call Function295ef
+ call TrademonStats_PrintSpeciesName
ld a, [wPlayerTrademonCaughtData]
ld de, wPlayerTrademonOTName
- call Function295f6
- ld de, PlayerScreens
- call Function29611
- call Function295d8
+ call TrademonStats_PrintOTName
+ ld de, wPlayerTrademonID
+ call TrademonStats_PrintTrademonID
+ call TrademonStats_WaitBGMap
ret
+
; 29549
-Function29549: ; 29549
+ShowOTTrademonStats: ; 29549
ld de, wOTTrademonSpecies
ld a, [de]
cp EGG
- jr z, Function295a1
- call Function29573
+ jr z, TrademonStats_Egg
+ call TrademonStats_MonTemplate
ld de, wOTTrademonSpecies
- call Function295e3
+ call TrademonStats_PrintSpeciesNumber
ld de, wOTTrademonSpeciesName
- call Function295ef
+ call TrademonStats_PrintSpeciesName
ld a, [wOTTrademonCaughtData]
ld de, wOTTrademonOTName
- call Function295f6
+ call TrademonStats_PrintOTName
ld de, wOTTrademonID
- call Function29611
- call Function295d8
+ call TrademonStats_PrintTrademonID
+ call TrademonStats_WaitBGMap
ret
+
; 29573
-Function29573: ; 29573
+TrademonStats_MonTemplate: ; 29573
call WaitTop
- call Function297cf
+ call TradeAnim_BlankTileMap
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
hlcoord 3, 0
@@ -962,129 +1015,138 @@ Function29573: ; 29573
ld c, $d
call TextBox
hlcoord 4, 0
- ld de, String29591
+ ld de, .OTMonData
call PlaceString
ret
+
; 29591
-String29591: ; 29591
+.OTMonData: ; 29591
db "─── №."
next ""
next "OT/"
next "<ID>№.@"
; 295a1
-Function295a1: ; 295a1
+TrademonStats_Egg: ; 295a1
call WaitTop
- call Function297cf
+ call TradeAnim_BlankTileMap
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
hlcoord 3, 0
- ld b, $6
- ld c, $d
+ ld b, 6
+ ld c, 13
call TextBox
hlcoord 4, 2
- ld de, String295c2
+ ld de, .EggData
call PlaceString
- call Function295d8
+ call TrademonStats_WaitBGMap
ret
+
; 295c2
-String295c2: ; 295c2
+.EggData: ; 295c2
db "EGG"
next "OT/?????"
next "<ID>№.?????@"
; 295d8
-Function295d8: ; 295d8
+TrademonStats_WaitBGMap: ; 295d8
call WaitBGMap
call WaitTop
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
ret
+
; 295e3
-Function295e3: ; 295e3
+TrademonStats_PrintSpeciesNumber: ; 295e3
hlcoord 10, 0
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
ld [hl], " "
ret
+
; 295ef
-Function295ef: ; 295ef
+TrademonStats_PrintSpeciesName: ; 295ef
hlcoord 4, 2
call PlaceString
ret
+
; 295f6
-Function295f6: ; 295f6
+TrademonStats_PrintOTName: ; 295f6
cp 3
- jr c, .asm_295fb
+ jr c, .caught_gender_okay
xor a
-
-.asm_295fb
+.caught_gender_okay
push af
hlcoord 7, 4
call PlaceString
inc bc
pop af
- ld hl, Unknown_2960e
+ ld hl, .Gender
ld d, 0
ld e, a
add hl, de
ld a, [hl]
ld [bc], a
ret
+
; 2960e
-Unknown_2960e: ; 2960e
+.Gender: ; 2960e
db " ", "♂", "♀"
; 29611
-Function29611: ; 29611
+TrademonStats_PrintTrademonID: ; 29611
hlcoord 7, 6
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
call PrintNum
ret
+
; 2961b
TradeAnim_RockingBall: ; 2961b
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_0E
call _InitSpriteAnimStruct
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $20
ld [wcf64], a
ret
+
; 2962c
TradeAnim_DropBall: ; 2962c
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_0E
call _InitSpriteAnimStruct
- ld hl, $b
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $1
- ld hl, $7
+ ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $dc
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $38
ld [wcf64], a
ret
+
; 29649
TradeAnim_Poof: ; 29649
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_0F
call _InitSpriteAnimStruct
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $10
ld [wcf64], a
ld de, SFX_BALL_POOF
call PlaySFX
ret
+
; 29660
TradeAnim_BulgeThroughTube: ; 29660
@@ -1093,177 +1155,184 @@ TradeAnim_BulgeThroughTube: ; 29660
depixel 5, 11
ld a, SPRITE_ANIM_INDEX_10
call _InitSpriteAnimStruct
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $40
ld [wcf64], a
ret
+
; 29676
-Function29676: ; 29676 (a:5676)
- ld hl, $b
+TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676)
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
- ld hl, Jumptable_29686
-rept 2
+ ld hl, .Jumptable
+ add hl, de
add hl, de
-endr
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 29686
-Jumptable_29686: ; 29686 (a:5686)
- dw Function2969a
- dw Function296a4
- dw Function296af
- dw Function296bd
- dw Function296cf
- dw Function296dd
- dw Function296f2
+.Jumptable: ; 29686 (a:5686)
+ dw .InitTimer
+ dw .WaitTimer1
+ dw .MoveRight
+ dw .MoveDown
+ dw .MoveUp
+ dw .MoveLeft
+ dw .WaitTimer2
; 2969a
-Function29694: ; 29694 (a:5694)
- ld hl, $b
+.JumptableNext: ; 29694 (a:5694)
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
-Function2969a: ; 2969a (a:569a)
- call Function29694
- ld hl, $c
+.InitTimer: ; 2969a (a:569a)
+ call .JumptableNext
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $80
ret
-Function296a4: ; 296a4 (a:56a4)
- ld hl, $c
+.WaitTimer1: ; 296a4 (a:56a4)
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
- call Function29694
+ call .JumptableNext
-Function296af: ; 296af (a:56af)
- ld hl, $4
+.MoveRight: ; 296af (a:56af)
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $94
- jr nc, .asm_296ba
+ jr nc, .done_move_right
inc [hl]
ret
-.asm_296ba
- call Function29694
-Function296bd: ; 296bd (a:56bd)
- ld hl, $5
+.done_move_right
+ call .JumptableNext
+
+.MoveDown: ; 296bd (a:56bd)
+ ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $4c
- jr nc, .asm_296c8
+ jr nc, .done_move_down
inc [hl]
ret
-.asm_296c8
- ld hl, $
+
+.done_move_down
+ ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
ld [hl], $0
ret
-Function296cf: ; 296cf (a:56cf)
- ld hl, $5
+.MoveUp: ; 296cf (a:56cf)
+ ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $2c
- jr z, .asm_296da
+ jr z, .done_move_up
dec [hl]
ret
-.asm_296da
- call Function29694
-Function296dd: ; 296dd (a:56dd)
- ld hl, $4
+.done_move_up
+ call .JumptableNext
+
+.MoveLeft: ; 296dd (a:56dd)
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $58
- jr z, .asm_296e8
+ jr z, .done_move_left
dec [hl]
ret
-.asm_296e8
- call Function29694
- ld hl, $c
+
+.done_move_left
+ call .JumptableNext
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $80
ret
-Function296f2: ; 296f2 (a:56f2)
- ld hl, $c
+.WaitTimer2: ; 296f2 (a:56f2)
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
- ld hl, $
+ ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
ld [hl], $0
ret
+
; 29701 (a:5701)
TradeAnim_SentToOTText: ; 29701
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
jr z, .time_capsule
- ld hl, UnknownText_0x29737
+ ld hl, .Text_MonName
call PrintText
ld c, 189
call DelayFrames
- ld hl, UnknownText_0x29732
+ ld hl, .Text_WasSentTo
call PrintText
- call Function297c9
+ call TradeAnim_Wait80Frames
ld c, 128
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
.time_capsule
- ld hl, UnknownText_0x29732
+ ld hl, .Text_WasSentTo
call PrintText
- call Function297c9
- call TradeAnim_Next
+ call TradeAnim_Wait80Frames
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29732
-UnknownText_0x29732: ; 0x29732
+.Text_WasSentTo: ; 0x29732
; was sent to @ .
text_jump UnknownText_0x1bc6e9
db "@"
; 0x29737
-UnknownText_0x29737: ; 0x29737
+.Text_MonName: ; 0x29737
;
text_jump UnknownText_0x1bc701
db "@"
; 0x2973c
TradeAnim_OTBidsFarewell: ; 2973c
- ld hl, UnknownText_0x29752
+ ld hl, .Text_BidsFarewellToMon
call PrintText
- call Function297c9
- ld hl, UnknownText_0x29757
+ call TradeAnim_Wait80Frames
+ ld hl, .Text_MonName
call PrintText
- call Function297c9
- call TradeAnim_Next
+ call TradeAnim_Wait80Frames
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29752
-UnknownText_0x29752: ; 0x29752
+.Text_BidsFarewellToMon: ; 0x29752
; bids farewell to
text_jump UnknownText_0x1bc703
db "@"
; 0x29757
-UnknownText_0x29757: ; 0x29757
+.Text_MonName: ; 0x29757
; .
text_jump UnknownText_0x1bc719
db "@"
@@ -1276,103 +1345,109 @@ TradeAnim_TakeCareOfText: ; 2975c
ld a, " "
call ByteFill
call WaitBGMap
- ld hl, UnknownText_0x2977a
+ ld hl, .Text_TakeGoodCareOfMon
call PrintText
- call Function297c9
- call TradeAnim_Next
+ call TradeAnim_Wait80Frames
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2977a
-UnknownText_0x2977a: ; 0x2977a
+.Text_TakeGoodCareOfMon: ; 0x2977a
; Take good care of @ .
text_jump UnknownText_0x1bc71f
db "@"
; 0x2977f
TradeAnim_OTSendsText1: ; 2977f
- ld hl, UnknownText_0x2979a
+ ld hl, .Text_ForYourMon
call PrintText
- call Function297c9
- ld hl, UnknownText_0x2979f
+ call TradeAnim_Wait80Frames
+ ld hl, .Text_OTSends
call PrintText
- call Function297c9
+ call TradeAnim_Wait80Frames
ld c, 14
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2979a
-UnknownText_0x2979a: ; 0x2979a
+.Text_ForYourMon: ; 0x2979a
; For @ 's @ ,
text_jump UnknownText_0x1bc739
db "@"
; 0x2979f
-UnknownText_0x2979f: ; 0x2979f
+.Text_OTSends: ; 0x2979f
; sends @ .
text_jump UnknownText_0x1bc74c
db "@"
; 0x297a4
TradeAnim_OTSendsText2: ; 297a4
- ld hl, UnknownText_0x297bf
+ ld hl, .Text_WillTrade
call PrintText
- call Function297c9
- ld hl, UnknownText_0x297c4
+ call TradeAnim_Wait80Frames
+ ld hl, .Text_ForYourMon
call PrintText
- call Function297c9
+ call TradeAnim_Wait80Frames
ld c, 14
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 297bf
-UnknownText_0x297bf: ; 0x297bf
+.Text_WillTrade: ; 0x297bf
; will trade @ @
text_jump UnknownText_0x1bc75e
db "@"
; 0x297c4
-UnknownText_0x297c4: ; 0x297c4
+.Text_ForYourMon: ; 0x297c4
; for @ 's @ .
text_jump UnknownText_0x1bc774
db "@"
; 0x297c9
-Function297c9: ; 297c9
+TradeAnim_Wait80Frames: ; 297c9
ld c, 80
call DelayFrames
ret
+
; 297cf
-Function297cf: ; 297cf
+TradeAnim_BlankTileMap: ; 297cf
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
call ByteFill
ret
+
; 297db
-Function297db: ; 297db
-.asm_297db
+TradeAnim_CopyBoxFromDEtoHL: ; 297db
+.row
push bc
push hl
-.asm_297dd
+.col
ld a, [de]
inc de
ld [hli], a
dec c
- jr nz, .asm_297dd
+ jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, .asm_297db
+ jr nz, .row
ret
+
; 297ed
-Function297ed: ; 297ed
+TradeAnim_NormalPals: ; 297ed
ld a, [hSGB]
and a
ld a, %11100100 ; 3,2,1,0
@@ -1384,6 +1459,7 @@ Function297ed: ; 297ed
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
ret
+
; 297ff
LinkTradeAnim_LoadTradePlayerNames: ; 297ff
@@ -1396,6 +1472,7 @@ LinkTradeAnim_LoadTradePlayerNames: ; 297ff
ld bc, NAME_LENGTH
call CopyBytes
ret
+
; 29814
LinkTradeAnim_LoadTradeMonSpecies: ; 29814
@@ -1404,16 +1481,18 @@ LinkTradeAnim_LoadTradeMonSpecies: ; 29814
ld a, [de]
ld [wLinkTradeGetmonSpecies], a
ret
+
; 2981d
-Function2981d: ; 2981d
+TradeAnim_FlashBGPals: ; 2981d
ld a, [wcf65]
and $7
ret nz
ld a, [rBGP]
- xor $3c
+ xor %00111100
call DmgToCgbBGPals
ret
+
; 2982b
LoadTradeBallAndCableGFX: ; 2982b
@@ -1435,6 +1514,7 @@ LoadTradeBallAndCableGFX: ; 2982b
ld [hli], a
ld [hl], $62
ret
+
; 2985a
LoadTradeBubbleGFX: ; 2985a
@@ -1450,6 +1530,7 @@ LoadTradeBubbleGFX: ; 2985a
ld [hli], a
ld [hl], $62
ret
+
; 29879
TradeAnim_WaitAnim: ; 29879
@@ -1461,8 +1542,9 @@ TradeAnim_WaitAnim: ; 29879
ret
.done
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29886
TradeAnim_WaitAnim2: ; 29886
@@ -1474,8 +1556,9 @@ TradeAnim_WaitAnim2: ; 29886
ret
.done
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29893
@@ -1484,7 +1567,7 @@ DebugTrade: ; 29893
; It was meant for use in Japanese versions, so the
; constant used for copy length was changed by accident.
- ld hl, Unknown_298b5
+ ld hl, .DebugTradeData
ld a, [hli]
ld [wPlayerTrademonSpecies], a
@@ -1508,9 +1591,10 @@ DebugTrade: ; 29893
dec c
jr nz, .loop2
ret
+
; 298b5
-Unknown_298b5: ; 298b5
+.DebugTradeData: ; 298b5
db VENUSAUR, "ゲーフり@@", $23, $01 ; GAME FREAK
db CHARIZARD, "クりーチャ@", $56, $04 ; Creatures Inc.
; 298c7
@@ -1528,7 +1612,7 @@ TradeGameBoyTilemap: ; 298c7
db $4f, $50, $50, $50, $51, $52
; 297f7
-Tilemap_298f7: ; 297f7
+TradeLinkTubeTilemap: ; 297f7
; 12x3
db $43, $55, $56, $53, $53, $53, $53, $53, $53, $53, $53, $53
db $43, $57, $58, $54, $54, $54, $54, $54, $54, $54, $54, $54
diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm
index b6fac7f7c..a993ce4ba 100755
--- a/engine/trainer_card.asm
+++ b/engine/trainer_card.asm
@@ -62,9 +62,9 @@ TrainerCard: ; 25105
call WaitBGMap
ld hl, wJumptableIndex
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ret
diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm
index ada5244a7..8d46a02a6 100755
--- a/engine/unown_puzzle.asm
+++ b/engine/unown_puzzle.asm
@@ -47,7 +47,7 @@ UnownPuzzle: ; e1190
ld a, $93
ld [rLCDC], a
call WaitBGMap
- ld b, SCGB_18
+ ld b, SCGB_UNOWN_PUZZLE
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -178,9 +178,8 @@ UnownPuzzleJumptable: ; e12ca
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -840,9 +839,8 @@ LoadUnownPuzzlePiecesGFX: ; e17a3
ld e, a
ld d, 0
ld hl, .LZPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/engine/unowndex.asm b/engine/unowndex.asm
index 0b251da0b..d7fe63dc3 100755
--- a/engine/unowndex.asm
+++ b/engine/unowndex.asm
@@ -34,9 +34,8 @@ PrintUnownWord: ; fba2e (3e:7a2e)
ld e, a
ld d, 0
ld hl, UnownWords
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
diff --git a/engine/variables.asm b/engine/variables.asm
index 3ddfce8d6..fde2583b7 100755
--- a/engine/variables.asm
+++ b/engine/variables.asm
@@ -7,9 +7,9 @@ _GetVarAction:: ; 80648 (20:4648)
ld c, a
ld b, 0
ld hl, .VarActionTable
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm
index 9d1f35479..180aada87 100755
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -1,5 +1,5 @@
-RunCallback_05_03: ; 1045b0
+HandleNewMap: ; 1045b0
call Clearwc7e8
call ResetMapBufferEventFlags
call ResetFlashIfOutOfCave
@@ -7,7 +7,7 @@ RunCallback_05_03: ; 1045b0
call ResetBikeFlags
ld a, MAPCALLBACK_NEWMAP
call RunMapCallback
-RunCallback_03: ; 1045c4
+InitCommandQueue: ; 1045c4
callba ClearCmdQueue
ld a, MAPCALLBACK_CMDQUEUE
call RunMapCallback
@@ -20,18 +20,16 @@ EnterMapConnection: ; 1045d6
; Return carry if a connection has been entered.
ld a, [wPlayerStepDirection]
and a
- jp z, EnterSouthConnection
- cp 1
- jp z, EnterNorthConnection
- cp 2
- jp z, EnterWestConnection
- cp 3
- jp z, EnterEastConnection
+ jp z, .south
+ cp UP
+ jp z, .north
+ cp LEFT
+ jp z, .west
+ cp RIGHT
+ jp z, .east
ret
-; 1045ed
-
-EnterWestConnection: ; 1045ed
+.west
ld a, [WestConnectedMapGroup]
ld [MapGroup], a
ld a, [WestConnectedMapNumber]
@@ -64,11 +62,9 @@ EnterWestConnection: ; 1045ed
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- jp EnteredConnection
-; 104629
-
+ jp .done
-EnterEastConnection: ; 104629
+.east
ld a, [EastConnectedMapGroup]
ld [MapGroup], a
ld a, [EastConnectedMapNumber]
@@ -85,27 +81,25 @@ EnterEastConnection: ; 104629
ld h, [hl]
ld l, a
srl c
- jr z, .skip_to_load
+ jr z, .skip_to_load2
ld a, [EastConnectedMapWidth]
add 6
ld e, a
ld d, 0
-.loop
+.loop2
add hl, de
dec c
- jr nz, .loop
+ jr nz, .loop2
-.skip_to_load
+.skip_to_load2
ld a, l
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- jp EnteredConnection
-; 104665
+ jp .done
-
-EnterNorthConnection: ; 104665
+.north
ld a, [NorthConnectedMapGroup]
ld [MapGroup], a
ld a, [NorthConnectedMapNumber]
@@ -128,11 +122,9 @@ EnterNorthConnection: ; 104665
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- jp EnteredConnection
-; 104696
-
+ jp .done
-EnterSouthConnection: ; 104696
+.south
ld a, [SouthConnectedMapGroup]
ld [MapGroup], a
ld a, [SouthConnectedMapNumber]
@@ -155,10 +147,7 @@ EnterSouthConnection: ; 104696
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- ; fallthrough
-; 1046c4
-
-EnteredConnection: ; 1046c4
+.done
scf
ret
; 1046c6
@@ -239,35 +228,39 @@ LoadMapTimeOfDay: ; 104750
callba ReplaceTimeOfDayPals
callba UpdateTimeOfDayPal
call OverworldTextModeSwitch
- call Function104770
- call Function1047a3
+ call .ClearBGMap
+ call .PushAttrMap
ret
-Function104770: ; 104770 (41:4770)
+.ClearBGMap: ; 104770 (41:4770)
ld a, VBGMap0 / $100
ld [wBGMapAnchor + 1], a
xor a
ld [wBGMapAnchor], a
ld [hSCY], a
ld [hSCX], a
- callba Function5958
+ callba ApplyBGMapAnchorToObjects
+
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
+
xor a
ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0
call ByteFill
+
pop af
ld [rVBK], a
+
ld a, $60
ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0
call ByteFill
ret
-Function1047a3: ; 1047a3 (41:47a3)
+.PushAttrMap: ; 1047a3 (41:47a3)
decoord 0, 0
call .copy
ld a, [hCGB]
@@ -326,7 +319,7 @@ RefreshMapSprites: ; 1047f0
jr nz, .skip
ld hl, VramState
set 0, [hl]
- call Function2e31
+ call SafeUpdateSprites
.skip
ld a, [wPlayerSpriteSetupFlags]
and %00011100
@@ -369,7 +362,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
.left
ld a, [PlayerStandingMapX]
- sub $4
+ sub 4
cp -1
jr z, .ok
and a
diff --git a/engine/wildmons.asm b/engine/wildmons.asm
index 140de9205..6208cfbce 100755
--- a/engine/wildmons.asm
+++ b/engine/wildmons.asm
@@ -62,9 +62,9 @@ FindNest: ; 2a01f
ld b, a
ld a, [hli]
ld c, a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, NUM_WILDMONS_PER_AREA_TIME_OF_DAY * 3
call .SearchMapForMon
jr nc, .next_grass
@@ -108,9 +108,8 @@ endr
ld a, [wNamedObjectIndexBuffer]
cp [hl]
jr z, .found
-rept 2
inc hl
-endr
+ inc hl
pop af
dec a
jr nz, .ScanMapLoop
@@ -268,15 +267,14 @@ ChooseWildEncounter: ; 2a14f
call CheckEncounterRoamMon
jp c, .startwildbattle
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
call CheckOnWater
ld de, .WaterMonTable
jr z, .watermon
-rept 2
inc hl
-endr
+ inc hl
ld a, [TimeOfDay]
ld bc, $e
call AddNTimes
@@ -597,9 +595,9 @@ CheckEncounterRoamMon: ; 2a2ce
cp [hl]
jr nz, .DontEncounterRoamMon
; We've decided to take on a beast, so stage its information for battle.
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hli]
ld [TempWildMonSpecies], a
ld a, [hl]
@@ -702,9 +700,8 @@ UpdateRoamMons: ; 2a30d
inc hl
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [wRoamMons_LastMapGroup]
cp [hl]
jr nz, .done
@@ -866,9 +863,8 @@ RandomPhoneRareWildMon: ; 2a4ab
dec a
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
; We now have the pointer to one of the last (rarest) three wild Pokemon found in that area.
inc hl
ld c, [hl] ; Contains the species index of this rare Pokemon
@@ -942,9 +938,8 @@ RandomPhoneWildMon: ; 2a51f
and $3
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
inc hl
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
@@ -963,9 +958,8 @@ RandomPhoneMon: ; 2a567
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(TrainerGroups)
call GetFarHalfword
diff --git a/event/battle_tower.asm b/event/battle_tower.asm
index 091fe7fe1..de6022145 100644
--- a/event/battle_tower.asm
+++ b/event/battle_tower.asm
@@ -157,9 +157,9 @@ BattleTower_ExecuteJumptable: ; 8b25b
; 8b281
.GetTextPointers: ; 8b281
-rept 3
inc de
-endr
+ inc de
+ inc de
ld a, [de]
ld l, a
inc de
@@ -200,13 +200,11 @@ endr
.PrintNthText: ; 8b2a9
push bc
call .GetTextPointers
-rept 2
inc hl
-endr
+ inc hl
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
call .LoadTextPointer
call PrintText
pop bc
diff --git a/event/buena.asm b/event/buena.asm
index 5cff72d53..4802943f9 100644
--- a/event/buena.asm
+++ b/event/buena.asm
@@ -322,9 +322,8 @@ Buena_getprize: ; 8b154
ld hl, .prizes
ld b, 0
ld c, a
-rept 2
add hl, bc
-endr
+ add hl, bc
ret
; 8b15e
diff --git a/event/bug_contest_2.asm b/event/bug_contest_2.asm
index 72fa8a31b..493c69d0c 100755
--- a/event/bug_contest_2.asm
+++ b/event/bug_contest_2.asm
@@ -13,9 +13,8 @@ Special_SelectRandomBugContestContestants: ; 139a8
ld b, RESET_FLAG
call EventFlagAction
pop hl
-rept 2
inc hl
-endr
+ inc hl
pop bc
dec c
jr nz, .loop1
@@ -34,9 +33,8 @@ endr
ld e, b
ld d, 0
ld hl, BugCatchingContestantEventFlagTable
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -66,9 +64,8 @@ Special_CheckBugContestContestantFlag: ; 139ed
ld hl, BugCatchingContestantEventFlagTable
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
diff --git a/event/bug_contest_judging.asm b/event/bug_contest_judging.asm
index 420c46aac..0d400bb39 100755
--- a/event/bug_contest_judging.asm
+++ b/event/bug_contest_judging.asm
@@ -1,6 +1,6 @@
_BugContestJudging: ; 1369d
call ContestScore
- callba MobileFn_105f79
+ callba TrainerRankings_BugContestScore
call BugContest_JudgeContestants
ld a, [wBugContestThirdPlacePersonID]
call LoadContestantName
@@ -85,9 +85,8 @@ LoadContestantName: ; 13730
ld c, a
ld b, 0
ld hl, BugContestantPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -320,23 +319,20 @@ ComputeAIContestantScores: ; 138b0
pop de
jr nz, .done
ld a, e
-rept 2
inc a
-endr
+ inc a
ld [wBugContestTempPersonID], a
dec a
ld c, a
ld b, 0
ld hl, BugContestantPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
.loop2
call Random
and 3
@@ -344,9 +340,9 @@ endr
jr z, .loop2
ld c, a
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld [wBugContestTempMon], a
ld a, [hli]
@@ -412,9 +408,8 @@ ContestScore: ; 13900
ld a, [wContestMonDVs + 0]
ld b, a
and 2
-rept 2
add a
-endr
+ add a
ld c, a
swap b
@@ -433,12 +428,10 @@ endr
ld a, b
and 2
srl a
-rept 2
add c
-endr
-rept 2
+ add c
+ add d
add d
-endr
call .AddContestStat
diff --git a/event/celebi.asm b/event/celebi.asm
index c6d8346b0..05f26fe2e 100755
--- a/event/celebi.asm
+++ b/event/celebi.asm
@@ -55,9 +55,9 @@ Special_CelebiShrineEvent: ; 4989a
ld c, $4
.OAMloop:
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
inc a
dec c
jr nz, .OAMloop
@@ -259,9 +259,8 @@ CelebiEvent_Cosine: ; 49b3b (12:5b3b)
ld a, d
ld d, $0
ld hl, .sinewave
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
diff --git a/event/daycare.asm b/event/daycare.asm
index 3fa8e30c2..a6d8842a9 100755
--- a/event/daycare.asm
+++ b/event/daycare.asm
@@ -723,7 +723,7 @@ DayCare_InitBreeding: ; 16a3b
ld a, [wBreedMon2Species]
cp DITTO
jr z, .GotDVs
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
push hl
callba GetGender
diff --git a/event/dratini.asm b/event/dratini.asm
index 5923ca363..f110b34ab 100644
--- a/event/dratini.asm
+++ b/event/dratini.asm
@@ -37,9 +37,8 @@ SpecialDratini: ; 0x8b170
; get address of mon's first move
pop de
-rept 2
inc de
-endr
+ inc de
.GiveMoves:
ld a, [hl]
diff --git a/event/elevator.asm b/event/elevator.asm
index 316bf382a..7626989b3 100755
--- a/event/elevator.asm
+++ b/event/elevator.asm
@@ -70,9 +70,8 @@ Elevator:: ; 1342d
call GetFarByte
cp -1
jr z, .fail
-rept 2
inc hl
-endr
+ inc hl
ld a, [wElevatorPointerBank]
call GetFarByte
inc hl
@@ -222,9 +221,8 @@ FloorToString: ; 13575
ld e, a
ld d, 0
ld hl, .floors
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/event/field_moves.asm b/event/field_moves.asm
index cf9e1bef0..c1b3bc236 100755
--- a/event/field_moves.asm
+++ b/event/field_moves.asm
@@ -164,9 +164,8 @@ OWCutJumptable: ; 8ca0c
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -192,9 +191,8 @@ Cut_SpawnAnimateTree: ; 8ca23 (23:4a23)
ld [wcf64], a
; Cut_StartWaiting
ld hl, wJumptableIndex
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c)
@@ -269,9 +267,8 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e)
add e
ld e, a
ld hl, .Coords
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -401,9 +398,9 @@ FlyToAnim: ; 8cb33
ld c, $4
.loop2
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
inc a
dec c
jr nz, .loop2
diff --git a/event/forced_movement.asm b/event/forced_movement.asm
index aa0473803..136698501 100755
--- a/event/forced_movement.asm
+++ b/event/forced_movement.asm
@@ -29,32 +29,32 @@ Script_ForcedMovement:: ; 0x1253d
.MovementData_up: ; 0x12564
step_dig 16
- turn_in_down
+ turn_in DOWN
step_dig 16
- turn_head_down
+ turn_head DOWN
step_end
; 0x1256b
.MovementData_down: ; 0x1256b
step_dig 16
- turn_in_up
+ turn_in UP
step_dig 16
- turn_head_up
+ turn_head UP
step_end
; 0x12572
.MovementData_right: ; 0x12572
step_dig 16
- turn_in_left
+ turn_in LEFT
step_dig 16
- turn_head_left
+ turn_head LEFT
step_end
; 0x12579
.MovementData_left: ; 0x12579
step_dig 16
- turn_in_right
+ turn_in RIGHT
step_dig 16
- turn_head_right
+ turn_head RIGHT
step_end
; 0x12580
diff --git a/event/halloffame.asm b/event/halloffame.asm
index d6f2d15ed..8d542addb 100755
--- a/event/halloffame.asm
+++ b/event/halloffame.asm
@@ -3,7 +3,7 @@ HallOfFame:: ; 0x8640e
ld a, [StatusFlags]
push af
ld a, 1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call DisableSpriteUpdates
ld a, SPAWN_LANCE
ld [wSpawnAfterChampion], a
@@ -25,7 +25,7 @@ HallOfFame:: ; 0x8640e
callba AddHallOfFameEntry
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call AnimateHallOfFame
pop af
ld b, a
@@ -44,7 +44,7 @@ RedCredits:: ; 86455
xor a
ld [VramState], a
ld [hMapAnims], a
- callba Function4e8c2
+ callba InitDisplayForRedCredits
ld c, 8
call DelayFrames
call DisableSpriteUpdates
@@ -67,7 +67,7 @@ HallOfFame_FadeOutMusic: ; 8648e
xor a
ld [VramState], a
ld [hMapAnims], a
- callba Function4e881
+ callba InitDisplayForHallOfFame
ld c, 100
jp DelayFrames
; 864b4
@@ -230,14 +230,13 @@ GetHallOfFameParty: ; 8653f
AnimateHOFMonEntrance: ; 865b5
push hl
call ClearBGPalettes
- callba Function4e906
+ callba ResetDisplayBetweenHallOfFameMons
pop hl
ld a, [hli]
ld [TempMonSpecies], a
ld [CurPartySpecies], a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld [TempMonDVs], a
ld a, [hli]
@@ -262,7 +261,7 @@ endr
call WaitBGMap
xor a
ld [hBGMapMode], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
call HOF_SlideBackpic
@@ -298,9 +297,8 @@ HOF_SlideFrontpic:
ld a, [hSCX]
and a
ret z
-rept 2
dec a
-endr
+ dec a
ld [hSCX], a
call DelayFrame
jr .frontpicloop
@@ -398,7 +396,7 @@ _HallOfFamePC: ; 86650
ld de, .EmptyString
call PlaceString
call WaitBGMap
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
decoord 6, 5
@@ -497,7 +495,7 @@ DisplayHOFMon: ; 86748
call GetBasePokemonName
hlcoord 7, 13
call PlaceString
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
callba GetGender
ld a, " "
@@ -555,7 +553,7 @@ HOF_AnimatePlayerPic: ; 86810
xor a
ld [hBGMapMode], a
ld [CurPartySpecies], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
call HOF_SlideBackpic
diff --git a/event/happiness_egg.asm b/event/happiness_egg.asm
index 1e8c2a853..e7eece7c8 100755
--- a/event/happiness_egg.asm
+++ b/event/happiness_egg.asm
@@ -67,9 +67,9 @@ ChangeHappiness: ; 71c2
dec c
ld b, 0
ld hl, .Actions
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld d, 0
add hl, de
ld a, [hl]
diff --git a/event/kurt.asm b/event/kurt.asm
index ac341de49..e1fff12c0 100644
--- a/event/kurt.asm
+++ b/event/kurt.asm
@@ -362,9 +362,8 @@ Kurt_GetAddressOfApricornQuantity: ; 88201
inc hl
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
inc hl
ld a, [hl]
pop bc
@@ -379,9 +378,8 @@ Kurt_GetRidOfItem: ; 88211
ld c, a
ld b, $0
inc hl
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [CurItem]
ld c, a
ld a, [hli]
diff --git a/event/magikarp.asm b/event/magikarp.asm
index b9f73552c..f926196cd 100644
--- a/event/magikarp.asm
+++ b/event/magikarp.asm
@@ -28,7 +28,7 @@ Special_CheckMagikarpLength: ; fbb32
ld c, l
call CalcMagikarpLength
call PrintMagikarpLength
- callba MagikarpLength_Mobile
+ callba TrainerRankings_MagikarpLength
ld hl, .MeasureItText
call PrintText
@@ -250,9 +250,8 @@ CalcMagikarpLength: ; fbbfc
; hl = de × 10
ld h, d
ld l, e
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, de
add hl, hl
diff --git a/event/magnet_train.asm b/event/magnet_train.asm
index c074e6835..ccc41a59d 100755
--- a/event/magnet_train.asm
+++ b/event/magnet_train.asm
@@ -48,7 +48,7 @@ Special_MagnetTrain: ; 8cc04
callab PlaySpriteAnimations
call MagnetTrain_Jumptable
call MagnetTrain_UpdateLYOverrides
- call Function3b0c
+ call PushLYOverrides
call DelayFrame
jr .loop
@@ -61,9 +61,9 @@ Special_MagnetTrain: ; 8cc04
ld [hVBlank], a
call ClearBGPalettes
xor a
- ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLCDCPointer], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
ld [hSCX], a
ld [Requested2bppSource], a
ld [Requested2bppSource + 1], a
@@ -101,9 +101,8 @@ MagnetTrain_UpdateLYOverrides: ; 8cc99
ld d, a
ld hl, wcf64
ld a, [hl]
-rept 2
add d
-endr
+ add d
ld [hl], a
ret
@@ -150,9 +149,9 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9
xor a
ld [hli], a
ld a, [wMagnetTrainInitPosition]
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld de, MUSIC_MAGNET_TRAIN
call PlayMusic2
ret
@@ -211,9 +210,8 @@ GetMagnetTrainBGTiles: ; 8cd74
ld e, a
ld d, 0
ld hl, MagnetTrainBGTiles
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -253,8 +251,8 @@ MagnetTrain_InitLYOverrides: ; 8cda6
ld bc, LYOverridesBackupEnd - LYOverridesBackup
ld a, [wMagnetTrainInitPosition]
call ByteFill
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
ret
; 8cdc3
@@ -296,9 +294,8 @@ MagnetTrain_Jumptable: ; 8cdf7
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -398,17 +395,15 @@ endr
inc a
ld d, a
ld a, e
-rept 2
add d
-endr
+ add d
ld [wcf65], a
ld hl, wGlobalAnimXOffset
ld a, [wMagnetTrainDirection]
ld d, a
ld a, [hl]
-rept 2
add d
-endr
+ add d
ld [hl], a
ret
@@ -431,7 +426,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae
callba PlaySpriteAnimations
call MagnetTrain_Jumptable
call MagnetTrain_UpdateLYOverrides
- call Function3b0c
+ call PushLYOverrides
call DelayFrame
ld a, [rSVBK]
push af
diff --git a/event/mom.asm b/event/mom.asm
index d2b7d2a7c..4002f69d2 100644
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -23,9 +23,8 @@ Special_BankOfMom: ; 16218
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -143,16 +142,15 @@ endr
call PrintText
xor a
ld hl, StringBuffer2
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld a, $5
ld [wcf64], a
call LoadStandardMenuDataHeader
- call Function16517
- call Function1656b
- call Function16571
+ call Mom_SetUpDepositMenu
+ call Mom_Wait10Frames
+ call Mom_WithdrawDepositMenuJoypad
call CloseWindow
jr c, .CancelDeposit
ld hl, StringBuffer2
@@ -211,16 +209,15 @@ endr
call PrintText
xor a
ld hl, StringBuffer2
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld a, $5
ld [wcf64], a
call LoadStandardMenuDataHeader
- call Function16512
- call Function1656b
- call Function16571
+ call Mom_SetUpWithdrawMenu
+ call Mom_Wait10Frames
+ call Mom_WithdrawDepositMenuJoypad
call CloseWindow
jr c, .CancelWithdraw
ld hl, StringBuffer2
@@ -324,13 +321,13 @@ DSTChecks: ; 16439
call .ClearBox
bccoord 1, 14
ld hl, .Text_AdjustClock
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
call .ClearBox
bccoord 1, 14
ld hl, .Text_LostInstructionBooklet
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
.loop
@@ -340,7 +337,7 @@ DSTChecks: ; 16439
bit 7, a
jr z, .SetDST
ld hl, .Text_IsDSTOver
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
ld a, [wDST]
@@ -350,12 +347,12 @@ DSTChecks: ; 16439
call .ClearBox
bccoord 1, 14
ld hl, .Text_SetClockBack
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
.SetDST:
ld hl, .Text_SwitchToDST
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
ld a, [wDST]
@@ -365,7 +362,7 @@ DSTChecks: ; 16439
call .ClearBox
bccoord 1, 14
ld hl, .Text_SetClockForward
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 164b9
@@ -444,14 +441,13 @@ DSTChecks: ; 16439
db "@"
; 0x16512
-Function16512: ; 16512
- ld de, String_1669f
- jr Function1651a
+Mom_SetUpWithdrawMenu: ; 16512
+ ld de, Mon_WithdrawString
+ jr Mom_ContinueMenuSetup
-Function16517: ; 16517
- ld de, String_166a8
-
-Function1651a: ; 1651a
+Mom_SetUpDepositMenu: ; 16517
+ ld de, Mom_DepositString
+Mom_ContinueMenuSetup: ; 1651a
push de
xor a
ld [hBGMapMode], a
@@ -459,14 +455,14 @@ Function1651a: ; 1651a
lb bc, 6, 18
call TextBox
hlcoord 1, 2
- ld de, String_16699
+ ld de, Mom_SavedString
call PlaceString
hlcoord 12, 2
ld de, wMomsMoney
lb bc, PRINTNUM_MONEY | 3, 6
call PrintNum
hlcoord 1, 4
- ld de, String_166b0
+ ld de, Mom_HeldString
call PlaceString
hlcoord 12, 4
ld de, Money
@@ -484,13 +480,13 @@ Function1651a: ; 1651a
ret
; 1656b
-Function1656b: ; 1656b
+Mom_Wait10Frames: ; 1656b
ld c, 10
call DelayFrames
ret
; 16571
-Function16571: ; 16571
+Mom_WithdrawDepositMenuJoypad: ; 16571
.loop
call JoyTextDelay
ld hl, hJoyPressed
@@ -532,9 +528,8 @@ Function16571: ; 16571
.pressedA
and a
ret
-; 165b9
-.dpadaction ; 165b9
+.dpadaction
ld hl, hJoyLast
ld a, [hl]
and D_UP
@@ -584,16 +579,15 @@ Function16571: ; 16571
ld de, StringBuffer2
callba TakeMoney
ret
-; 16607
-.getdigitquantity ; 16607
+.getdigitquantity
ld a, [wMomBankDigitCursorPosition]
push de
ld e, a
ld d, 0
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
pop de
ret
; 16613
@@ -717,19 +711,19 @@ UnknownText_0x16694: ; 0x16694
db "@"
; 0x16699
-String_16699: ; 16699
+Mom_SavedString: ; 16699
db "SAVED@"
; 1669f
-String_1669f: ; 1669f
+Mon_WithdrawString: ; 1669f
db "WITHDRAW@"
; 166a8
-String_166a8: ; 166a8
+Mom_DepositString: ; 166a8
db "DEPOSIT@"
; 166b0
-String_166b0: ; 166b0
+Mom_HeldString: ; 166b0
db "HELD@"
; 166b5
diff --git a/event/overworld.asm b/event/overworld.asm
index c9fe754fe..b27093a00 100755
--- a/event/overworld.asm
+++ b/event/overworld.asm
@@ -472,7 +472,7 @@ UsedSurfScript: ; c986
end
.empty_fn ; c9a2
- callba MobileFn_1060bb ; empty
+ callba TrainerRankings_Surf
ret
UsedSurfText: ; c9a9
@@ -745,13 +745,13 @@ Script_UsedWaterfall: ; 0xcb20
ld a, [PlayerStandingTile]
call CheckWaterfallTile
ret z
- callba MobileFn_1060c1
+ callba TrainerRankings_Waterfall
ld a, $1
ld [ScriptVar], a
ret
.WaterfallStep: ; cb4f
- turn_waterfall_up
+ turn_waterfall UP
step_end
.Text_UsedWaterfall: ; 0xcb51
@@ -1632,7 +1632,7 @@ Script_GotABite: ; 0xd035
fish_got_bite
fish_got_bite
fish_got_bite
- step_sleep_1
+ step_sleep 1
show_emote
step_end
diff --git a/event/photo.asm b/event/photo.asm
index 7f6ec9e66..c47445fc5 100755
--- a/event/photo.asm
+++ b/event/photo.asm
@@ -59,7 +59,7 @@ UnownPrinter: ; 16be4
ld [TempMonDVs], a
ld [TempMonDVs + 1], a
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
@@ -132,7 +132,7 @@ UnownPrinter: ; 16be4
.UpdateUnownFrontpic: ; 16cc8
ld a, [wJumptableIndex]
cp 26
- jr z, Function16d20
+ jr z, .vacant
inc a
ld [UnownLetter], a
ld a, UNOWN
@@ -141,18 +141,17 @@ UnownPrinter: ; 16be4
ld [wBoxAlignment], a
ld de, VTiles2
predef GetFrontpic
- call Function16cff
+ call .Load2bppToSRAM
hlcoord 1, 6
xor a
ld [hGraphicStartTile], a
lb bc, 7, 7
predef PlaceGraphic
ld de, VTiles2 tile $31
- callba Functione0000
+ callba RotateUnownFrontpic
ret
-; 16cff
-Function16cff: ; 16cff
+.Load2bppToSRAM: ; 16cff
ld a, [rSVBK]
push af
ld a, $6
@@ -171,9 +170,8 @@ Function16cff: ; 16cff
pop af
ld [rSVBK], a
ret
-; 16d20
-Function16d20: ; 16d20
+.vacant
hlcoord 1, 6
lb bc, 7, 7
call ClearBox
@@ -221,7 +219,7 @@ UnownDexBTile: ; 16da4
INCBIN "gfx/unknown/016da4.1bpp"
; 16dac
-Function16dac: ; 16dac
+PlaceUnownPrinterFrontpic: ; 16dac
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
diff --git a/event/poke_seer.asm b/event/poke_seer.asm
index 2e942ef07..5e93acc5d 100644
--- a/event/poke_seer.asm
+++ b/event/poke_seer.asm
@@ -298,9 +298,8 @@ PrintSeerText: ; 4f26d
ld e, a
ld d, 0
ld hl, SeerTexts
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/event/special.asm b/event/special.asm
index c5ddabbcf..f1228abc6 100755
--- a/event/special.asm
+++ b/event/special.asm
@@ -188,9 +188,9 @@ MassageOrHaircut: ; 7420
.loop
sub [hl]
jr c, .ok
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.ok
diff --git a/event/squirtbottle.asm b/event/squirtbottle.asm
index 5f43e4029..7b47a96f6 100755
--- a/event/squirtbottle.asm
+++ b/event/squirtbottle.asm
@@ -1,50 +1,46 @@
_Squirtbottle: ; 50730
- ld hl, UnknownScript_0x5073c
+ ld hl, .SquirtbottleScript
call QueueScript
ld a, $1
ld [wItemEffectSucceeded], a
ret
-; 5073c
-UnknownScript_0x5073c: ; 0x5073c
+.SquirtbottleScript:
reloadmappart
special UpdateTimePals
- callasm Function50753
- iffalse UnknownScript_0x5074b
+ callasm .CheckCanUseSquirtbottle
+ iffalse .NothingHappenedScript
farjump WateredWeirdTreeScript
-; 0x5074b
-UnknownScript_0x5074b: ; 0x5074b
- jumptext UnknownText_0x5074e
-; 0x5074e
+.NothingHappenedScript:
+ jumptext .NothingHappenedText
-UnknownText_0x5074e: ; 0x5074e
+.NothingHappenedText:
; sprinkled water. But nothing happened…
text_jump UnknownText_0x1c0b3b
db "@"
-; 0x50753
-Function50753: ; 50753
+.CheckCanUseSquirtbottle:
ld a, [MapGroup]
cp GROUP_ROUTE_36
- jr nz, .asm_50774
+ jr nz, .nope
ld a, [MapNumber]
cp MAP_ROUTE_36
- jr nz, .asm_50774
+ jr nz, .nope
callba GetFacingObject
- jr c, .asm_50774
+ jr c, .nope
ld a, d
- cp $17
- jr nz, .asm_50774
+ cp SPRITEMOVEDATA_SUDOWOODO
+ jr nz, .nope
- ld a, $1
+ ld a, 1
ld [ScriptVar], a
ret
-.asm_50774
+.nope
xor a
ld [ScriptVar], a
ret
diff --git a/event/unown.asm b/event/unown.asm
index b37df3b3a..6b65877f9 100644
--- a/event/unown.asm
+++ b/event/unown.asm
@@ -107,18 +107,18 @@ SpecialKabutoChamber: ; 8ae4e
Special_DisplayUnownWords: ; 8ae68
ld a, [ScriptVar]
- ld hl, MenuDataHeader_0x8aed5
+ ld hl, .MenuDataHeader_Escape
and a
- jr z, .asm_8ae79
+ jr z, .load
ld d, $0
ld e, $5
-.asm_8ae75
+.loop
add hl, de
dec a
- jr nz, .asm_8ae75
+ jr nz, .loop
-.asm_8ae79
+.load
call LoadMenuDataHeader
xor a
ld [hBGMapMode], a
@@ -127,29 +127,27 @@ Special_DisplayUnownWords: ; 8ae68
call ApplyTilemap
call MenuBoxCoord2Tile
inc hl
- ld d, $0
- ld e, $14
-rept 2
+ ld d, 0
+ ld e, SCREEN_WIDTH
+ add hl, de
add hl, de
-endr
ld a, [ScriptVar]
ld c, a
- ld de, Unknown_8aebc
+ ld de, .UnownText
and a
- jr z, .asm_8aea5
-.asm_8ae9c
+ jr z, .copy
+.loop2
ld a, [de]
inc de
cp $ff
- jr nz, .asm_8ae9c
+ jr nz, .loop2
dec c
- jr nz, .asm_8ae9c
-
-.asm_8aea5
- call Function8af09
+ jr nz, .loop2
+.copy
+ call .CopyWord
ld bc, AttrMap - TileMap
add hl, bc
- call Function8aee9
+ call .FillAttr
call WaitBGMap2
call JoyWaitAorB
call PlayClickSFX
@@ -157,59 +155,91 @@ endr
ret
; 8aebc
-Unknown_8aebc: ; 8aebc
- db $08, $44, $04, $00, $2e, $08, $ff
- db $26, $20, $0c, $0e, $46, $ff
- db $4c, $00, $46, $08, $42, $ff
- db $0e, $2c, $64, $2c, $0e, $ff
+.UnownText: ; 8aebc
+
+unownwall: MACRO
+rept _NARG
+if \1 == "-"
+x = $64
+else
+if \1 >= "Y"
+x = 2 * (\1 - "Y") + $60
+else
+if \1 >= "Q"
+x = 2 * (\1 - "Q") + $40
+else
+if \1 >= "I"
+x = 2 * (\1 - "I") + $20
+else
+x = 2 * (\1 - "A")
+endc
+endc
+endc
+endc
+ db x
+shift
+endr
+ db $ff
+endm
+
+.UnownText_Escape:
+ ; db $08, $44, $04, $00, $2e, $08, $ff
+ unownwall "E", "S", "C", "A", "P", "E"
+.UnownText_Light:
+ ; db $26, $20, $0c, $0e, $46, $ff
+ unownwall "L", "I", "G", "H", "T"
+.UnownText_Water:
+ ; db $4c, $00, $46, $08, $42, $ff
+ unownwall "W", "A", "T", "E", "R"
+.UnownText_Ho_Oh:
+ ; db $0e, $2c, $64, $2c, $0e, $ff
+ unownwall "H", "O", "-", "O", "H"
; 8aed5
-MenuDataHeader_0x8aed5: ; 0x8aed5
+.MenuDataHeader_Escape: ; 0x8aed5
db $40 ; flags
db 04, 03 ; start coords
db 09, 16 ; end coords
-MenuDataHeader_0x8aeda: ; 0x8aeda
+.MenuDataHeader_Light: ; 0x8aeda
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
-MenuDataHeader_0x8aedf: ; 0x8aedf
+.MenuDataHeader_Water: ; 0x8aedf
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
-MenuDataHeader_0x8aee4: ; 0x8aee4
+.MenuDataHeader_Ho_Oh: ; 0x8aee4
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
; 8aee9
-Function8aee9: ; 8aee9
-.asm_8aee9
+.FillAttr: ; 8aee9
ld a, [de]
cp $ff
ret z
cp $60
- ld a, $d
- jr c, .asm_8aef5
- ld a, $5
+ ld a, (1 << 3) | PAL_BG_BROWN
+ jr c, .got_pal
+ ld a, PAL_BG_BROWN
-.asm_8aef5
- call Function8aefd
-rept 2
+.got_pal
+ call .PlaceSquare
+ inc hl
inc hl
-endr
inc de
- jr .asm_8aee9
+ jr .FillAttr
; 8aefd
-Function8aefd: ; 8aefd
+.PlaceSquare: ; 8aefd
push hl
ld [hli], a
ld [hld], a
- ld b, $0
- ld c, $14
+ ld b, 0
+ ld c, SCREEN_WIDTH
add hl, bc
ld [hli], a
ld [hl], a
@@ -217,42 +247,41 @@ Function8aefd: ; 8aefd
ret
; 8af09
-Function8af09: ; 8af09
+.CopyWord: ; 8af09
push hl
push de
-.asm_8af0b
+.word_loop
ld a, [de]
cp $ff
- jr z, .asm_8af19
+ jr z, .word_done
ld c, a
- call Function8af1c
-rept 2
+ call .ConvertChar
+ inc hl
inc hl
-endr
inc de
- jr .asm_8af0b
+ jr .word_loop
-.asm_8af19
+.word_done
pop de
pop hl
ret
; 8af1c
-Function8af1c: ; 8af1c
+.ConvertChar: ; 8af1c
push hl
ld a, c
cp $60
- jr z, .asm_8af3b
+ jr z, .Tile60
cp $62
- jr z, .asm_8af4b
+ jr z, .Tile62
cp $64
- jr z, .asm_8af5b
+ jr z, .Tile64
ld [hli], a
inc a
ld [hld], a
dec a
- ld b, $0
- ld c, $14
+ ld b, 0
+ ld c, SCREEN_WIDTH
add hl, bc
ld c, $10
add c
@@ -262,11 +291,11 @@ Function8af1c: ; 8af1c
pop hl
ret
-.asm_8af3b
+.Tile60:
ld [hl], $5b
inc hl
ld [hl], $5c
- ld bc, $0013
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $4d
inc hl
@@ -274,11 +303,11 @@ Function8af1c: ; 8af1c
pop hl
ret
-.asm_8af4b
+.Tile62:
ld [hl], $4e
inc hl
ld [hl], $4f
- ld bc, $0013
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $5e
inc hl
@@ -286,11 +315,11 @@ Function8af1c: ; 8af1c
pop hl
ret
-.asm_8af5b
+.Tile64:
ld [hl], $2
inc hl
ld [hl], $3
- ld bc, $0013
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $3
inc hl
diff --git a/event/whiteout.asm b/event/whiteout.asm
index a076bdcb6..38049b3b5 100755
--- a/event/whiteout.asm
+++ b/event/whiteout.asm
@@ -49,9 +49,7 @@ BattleBGMap: ; 1250a
; 12513
HalveMoney: ; 12513
-
-; Empty function...
- callba MobileFn_1060c7
+ callba TrainerRankings_WhiteOuts
; Halve the player's money.
ld hl, Money
diff --git a/gfx.py b/gfx.py
index 25f951954..7e4329ec1 100644
--- a/gfx.py
+++ b/gfx.py
@@ -8,164 +8,170 @@ from extras.pokemontools import gfx, lz
# Graphics with inverted tilemaps that aren't covered by filepath_rules.
pics = [
- 'gfx/shrink1',
- 'gfx/shrink2',
+ 'gfx/shrink1',
+ 'gfx/shrink2',
]
def recursive_read(filename):
- def recurse(filename_):
- lines = []
- for line in open(filename_):
- if 'include "' in line.lower():
- lines += recurse(line.split('"')[1])
- else:
- lines += [line]
- return lines
- lines = recurse(filename)
- return ''.join(lines)
+ def recurse(filename_):
+ lines = []
+ for line in open(filename_):
+ if 'include "' in line.lower():
+ lines += recurse(line.split('"')[1])
+ else:
+ lines += [line]
+ return lines
+ lines = recurse(filename)
+ return ''.join(lines)
base_stats = None
def get_base_stats():
- global base_stats
- if not base_stats:
- base_stats = recursive_read('data/base_stats.asm')
- return base_stats
+ global base_stats
+ if not base_stats:
+ base_stats = recursive_read('data/base_stats.asm')
+ return base_stats
def get_pokemon_dimensions(name):
- try:
- if name == 'egg':
- return 5, 5
- if name == 'questionmark':
- return 7, 7
- if name.startswith('unown_'):
- name = 'unown'
- base_stats = get_base_stats()
- start = base_stats.find('\tdb ' + name.upper())
- start = base_stats.find('\tdn ', start)
- end = base_stats.find('\n', start)
- line = base_stats[start:end].replace(',', ' ')
- w, h = map(int, line.split()[1:3])
- return w, h
- except:
- return 7, 7
+ try:
+ if name == 'egg':
+ return 5, 5
+ if name == 'questionmark':
+ return 7, 7
+ if name.startswith('unown_'):
+ name = 'unown'
+ base_stats = get_base_stats()
+ start = base_stats.find('\tdb ' + name.upper())
+ start = base_stats.find('\tdn ', start)
+ end = base_stats.find('\n', start)
+ line = base_stats[start:end].replace(',', ' ')
+ w, h = map(int, line.split()[1:3])
+ return w, h
+ except:
+ return 7, 7
def filepath_rules(filepath):
- """Infer attributes of certain graphics by their location in the filesystem."""
- args = {}
-
- filedir, filename = os.path.split(filepath)
- if filedir.startswith('./'):
- filedir = filedir[2:]
-
- name, ext = os.path.splitext(filename)
- if ext == '.lz':
- name, ext = os.path.splitext(name)
-
- pokemon_name = ''
-
- if 'gfx/pics/' in filedir:
- pokemon_name = filedir.split('/')[-1]
- if pokemon_name.startswith('unown_'):
- index = filedir.find(pokemon_name)
- if index != -1:
- filedir = filedir[:index + len('unown')] + filedir[index + len('unown_a'):]
- if name == 'front':
- args['pal_file'] = os.path.join(filedir, 'normal.pal')
- args['pic'] = True
- args['animate'] = True
- elif name == 'back':
- args['pal_file'] = os.path.join(filedir, 'normal.pal')
- args['pic'] = True
-
- elif 'gfx/trainers' in filedir:
- args['pic'] = True
-
- elif os.path.join(filedir, name) in pics:
- args['pic'] = True
-
- if args.get('pal_file'):
- if os.path.exists(args['pal_file']):
- args['palout'] = args['pal_file']
- else:
- del args['pal_file']
-
- if args.get('pic'):
- if ext == '.png':
- w, h = gfx.png.Reader(filepath).asRGBA8()[:2]
- w = min(w/8, h/8)
- args['pic_dimensions'] = w, w
- elif ext == '.2bpp':
- if pokemon_name and name == 'front':
- w, h = get_pokemon_dimensions(pokemon_name)
- args['pic_dimensions'] = w, w
- elif pokemon_name and name == 'back':
- args['pic_dimensions'] = 6, 6
- else:
- args['pic_dimensions'] = 7, 7
- return args
+ """Infer attributes of certain graphics by their location in the filesystem."""
+ args = {}
+
+ filedir, filename = os.path.split(filepath)
+ if filedir.startswith('./'):
+ filedir = filedir[2:]
+
+ name, ext = os.path.splitext(filename)
+ if ext == '.lz':
+ name, ext = os.path.splitext(name)
+
+ pokemon_name = ''
+
+ if 'gfx/pics/' in filedir:
+ pokemon_name = filedir.split('/')[-1]
+ if pokemon_name.startswith('unown_'):
+ index = filedir.find(pokemon_name)
+ if index != -1:
+ filedir = filedir[:index + len('unown')] + filedir[index + len('unown_a'):]
+ if name == 'front':
+ args['pal_file'] = os.path.join(filedir, 'normal.pal')
+ args['pic'] = True
+ args['animate'] = True
+ elif name == 'back':
+ args['pal_file'] = os.path.join(filedir, 'normal.pal')
+ args['pic'] = True
+
+ elif 'gfx/trainers' in filedir:
+ args['pic'] = True
+
+ elif os.path.join(filedir, name) in pics:
+ args['pic'] = True
+
+ elif filedir == 'gfx/tilesets':
+ args['tileset'] = True
+
+ if args.get('pal_file'):
+ if os.path.exists(args['pal_file']):
+ args['palout'] = args['pal_file']
+ else:
+ del args['pal_file']
+
+ if args.get('pic'):
+ if ext == '.png':
+ w, h = gfx.png.Reader(filepath).asRGBA8()[:2]
+ w = min(w/8, h/8)
+ args['pic_dimensions'] = w, w
+ elif ext == '.2bpp':
+ if pokemon_name and name == 'front':
+ w, h = get_pokemon_dimensions(pokemon_name)
+ args['pic_dimensions'] = w, w
+ elif pokemon_name and name == 'back':
+ args['pic_dimensions'] = 6, 6
+ else:
+ args['pic_dimensions'] = 7, 7
+
+ if args.get('tileset'):
+ args['width'] = 128
+ return args
def to_1bpp(filename, **kwargs):
- name, ext = os.path.splitext(filename)
- if ext == '.1bpp': pass
- elif ext == '.2bpp': gfx.export_2bpp_to_1bpp(filename, **kwargs)
- elif ext == '.png': gfx.export_png_to_1bpp(filename, **kwargs)
- elif ext == '.lz':
- decompress(filename, **kwargs)
- to_1bpp(name, **kwargs)
+ name, ext = os.path.splitext(filename)
+ if ext == '.1bpp': pass
+ elif ext == '.2bpp': gfx.export_2bpp_to_1bpp(filename, **kwargs)
+ elif ext == '.png': gfx.export_png_to_1bpp(filename, **kwargs)
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_1bpp(name, **kwargs)
def to_2bpp(filename, **kwargs):
- name, ext = os.path.splitext(filename)
- if ext == '.1bpp': gfx.export_1bpp_to_2bpp(filename, **kwargs)
- elif ext == '.2bpp': pass
- elif ext == '.png': gfx.export_png_to_2bpp(filename, **kwargs)
- elif ext == '.lz':
- decompress(filename, **kwargs)
- to_2bpp(name, **kwargs)
+ name, ext = os.path.splitext(filename)
+ if ext == '.1bpp': gfx.export_1bpp_to_2bpp(filename, **kwargs)
+ elif ext == '.2bpp': pass
+ elif ext == '.png': gfx.export_png_to_2bpp(filename, **kwargs)
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_2bpp(name, **kwargs)
def to_png(filename, **kwargs):
- name, ext = os.path.splitext(filename)
- if ext == '.1bpp': gfx.export_1bpp_to_png(filename, **kwargs)
- elif ext == '.2bpp': gfx.export_2bpp_to_png(filename, **kwargs)
- elif ext == '.png': pass
- elif ext == '.lz':
- decompress(filename, **kwargs)
- to_png(name, **kwargs)
+ name, ext = os.path.splitext(filename)
+ if ext == '.1bpp': gfx.export_1bpp_to_png(filename, **kwargs)
+ elif ext == '.2bpp': gfx.export_2bpp_to_png(filename, **kwargs)
+ elif ext == '.png': pass
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_png(name, **kwargs)
def compress(filename, **kwargs):
- data = open(filename, 'rb').read()
- lz_data = lz.Compressed(data).output
- open(filename + '.lz', 'wb').write(bytearray(lz_data))
+ data = open(filename, 'rb').read()
+ lz_data = lz.Compressed(data).output
+ open(filename + '.lz', 'wb').write(bytearray(lz_data))
def decompress(filename, **kwargs):
- lz_data = open(filename, 'rb').read()
- data = lz.Decompressed(lz_data).output
- name, ext = os.path.splitext(filename)
- open(name, 'wb').write(bytearray(data))
+ lz_data = open(filename, 'rb').read()
+ data = lz.Decompressed(lz_data).output
+ name, ext = os.path.splitext(filename)
+ open(name, 'wb').write(bytearray(data))
methods = {
- '2bpp': to_2bpp,
- '1bpp': to_1bpp,
- 'png': to_png,
- 'lz': compress,
- 'unlz': decompress,
+ '2bpp': to_2bpp,
+ '1bpp': to_1bpp,
+ 'png': to_png,
+ 'lz': compress,
+ 'unlz': decompress,
}
def main(method_name, filenames=None):
- if filenames is None: filenames = []
- for filename in filenames:
- args = filepath_rules(filename)
- method = methods.get(method_name)
- if method:
- method(filename, **args)
+ if filenames is None: filenames = []
+ for filename in filenames:
+ args = filepath_rules(filename)
+ method = methods.get(method_name)
+ if method:
+ method(filename, **args)
def get_args():
- ap = argparse.ArgumentParser()
- ap.add_argument('method_name')
- ap.add_argument('filenames', nargs='*')
- args = ap.parse_args()
- return args
+ ap = argparse.ArgumentParser()
+ ap.add_argument('method_name')
+ ap.add_argument('filenames', nargs='*')
+ args = ap.parse_args()
+ return args
if __name__ == '__main__':
- main(**get_args().__dict__)
+ main(**get_args().__dict__)
diff --git a/gfx/font.asm b/gfx/font.asm
index 12e20e7f0..92bc25f25 100755
--- a/gfx/font.asm
+++ b/gfx/font.asm
@@ -21,14 +21,16 @@ INCBIN "gfx/frames/9.1bpp"
; TODO: Various misc graphics here.
-GFX_f89b0: ; f89b0
+StatsScreenPageTilesGFX: ; f89b0
INCBIN "gfx/unknown/0f89b0.2bpp"
; f8a90
ShinyIcon: ; f8a90
+; also part of StatsScreenPageTilesGFX
INCBIN "gfx/stats/shiny.2bpp"
-GFX_f8aa0: ; f8aa0
+StatsScreenPageTilesGFX_Part2: ; f8aa0
+; not referenced on its own, but part of StatsScreenPageTilesGFX
INCBIN "gfx/unknown/0f8aa0.2bpp"
; f8ac0
@@ -48,7 +50,7 @@ TownMapGFX: ; f8ba0
INCBIN "gfx/misc/town_map.2bpp.lz"
; f8ea4
-GFX_f8ea4: ; unused
+GFX_f8ea4: ; unused kanji
INCBIN "gfx/unknown/0f8ea4.2bpp"
; f8f24
@@ -56,8 +58,8 @@ OverworldPhoneIconGFX: ; f8f24
INCBIN "gfx/mobile/overworld_phone_icon.2bpp"
; f8f34
-GFX_f8f34: ; unused
-INCBIN "gfx/unknown/0f8f34.2bpp"
+GFX_f8f34: ; unused bold letters + unown chars
+INCBIN "gfx/unknown/0f8f34.w64.1bpp"
; f9204
TextBoxSpaceGFX: ; f9204
@@ -72,7 +74,7 @@ MapEntryFrameGFX: ; f9344
INCBIN "gfx/frames/map_entry_sign.2bpp"
; f9424
-GFX_f9424: ; f9424
+FontsExtra2_UpArrowGFX: ; f9424
INCBIN "gfx/unknown/0f9424.2bpp"
; f9434
@@ -81,6 +83,7 @@ INCBIN "gfx/misc/footprints.1bpp"
; fb434
; This and the following two functions are unreferenced.
+; Debug, perhaps?
Unknown_fb434:
db 0
@@ -143,9 +146,9 @@ _LoadFontsExtra1:: ; fb48a
; fb4b0
_LoadFontsExtra2:: ; fb4b0
- ld de, GFX_f9424
+ ld de, FontsExtra2_UpArrowGFX
ld hl, VTiles2 tile $61
- ld b, BANK(GFX_f9424)
+ ld b, BANK(FontsExtra2_UpArrowGFX)
ld c, 1
call Get2bpp_2
ret
@@ -208,7 +211,7 @@ LoadHPBar: ; fb50d
ret
; fb53e
-Functionfb53e: ; fb53e
+StatsScreen_LoadFont: ; fb53e
call _LoadFontsBattleExtra
ld de, EnemyHPBarBorderGFX
ld hl, VTiles2 tile $6c
@@ -226,11 +229,10 @@ Functionfb53e: ; fb53e
ld hl, VTiles2 tile $55
lb bc, BANK(ExpBarGFX), 8
call Get2bpp_2
-
-Functionfb571: ; fb571
- ld de, GFX_f89b0
+LoadStatsScreenPageTilesGFX: ; fb571
+ ld de, StatsScreenPageTilesGFX
ld hl, VTiles2 tile $31
- lb bc, BANK(GFX_f89b0), $11
+ lb bc, BANK(StatsScreenPageTilesGFX), $11
call Get2bpp_2
ret
; fb57e
diff --git a/gfx/mail.asm b/gfx/mail.asm
index cb3c25bc8..fa0736ca6 100755
--- a/gfx/mail.asm
+++ b/gfx/mail.asm
@@ -32,12 +32,12 @@ ReadAnyMail: ; b9237
lb bc, BANK(StandardEnglishFont), $80
call Get1bpp
pop de
- call Functionb92b8
+ call .LoadGFX
call EnableLCD
call WaitBGMap
ld a, [Buffer3]
ld e, a
- callba Function8cb4
+ callba LoadMailPalettes
call SetPalettes
xor a
ld [hJoyPressed], a
@@ -65,7 +65,7 @@ ReadAnyMail: ; b9237
jr .loop
; b92b8
-Functionb92b8: ; b92b8
+.LoadGFX: ; b92b8
ld h, d
ld l, e
push hl
@@ -83,17 +83,16 @@ Functionb92b8: ; b92b8
call CloseSRAM
ld hl, MailGFXPointers
ld c, 0
-.loop
+.loop2
ld a, [hli]
cp b
jr z, .got_pointer
cp -1
jr z, .invalid
inc c
-rept 2
inc hl
-endr
- jr .loop
+ inc hl
+ jr .loop2
.invalid
ld hl, MailGFXPointers
@@ -727,6 +726,7 @@ MailGFX_PlaceMessage: ; b9803
; b984e
Functionb984e: ; b984e
+; XXX
.loop
ld a, [hl]
xor $ff
@@ -931,9 +931,8 @@ LoadMailGFX_Color3: ; b991e
.loop
ld a, [de]
inc de
-rept 2
ld [hli], a
-endr
+ ld [hli], a
dec c
jr nz, .loop
ret
diff --git a/gfx/pics/animation.asm b/gfx/pics/animation.asm
index 3284a271b..e26592fd7 100644
--- a/gfx/pics/animation.asm
+++ b/gfx/pics/animation.asm
@@ -99,7 +99,7 @@ AnimateFrontpic: ; d008e
.loop
call SetUpPokeAnim
push af
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
pop af
jr nc, .loop
ret
@@ -110,14 +110,13 @@ LoadMonAnimation: ; d00a3
ld c, e
ld b, 0
ld hl, PokeAnims
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld b, [hl]
ld c, a
pop hl
- call Functiond01d6
+ call PokeAnim_InitPicAttributes
ret
; d00b4
@@ -153,7 +152,7 @@ setup_command: macro
\1_: dw \1
endm
setup_command PokeAnim_Finish
- setup_command PokeAnim_Nop
+ setup_command PokeAnim_BasePic
setup_command PokeAnim_SetWait
setup_command PokeAnim_Wait
setup_command PokeAnim_Setup
@@ -186,8 +185,8 @@ PokeAnim_Wait: ; d00fe
PokeAnim_Setup: ; d010b
ld c, FALSE
ld b, 0
- call Functiond0228
- call Functiond0504
+ call PokeAnim_InitAnim
+ call PokeAnim_SetVBank1
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -197,8 +196,8 @@ PokeAnim_Setup: ; d010b
PokeAnim_Setup2: ; d011d
ld c, FALSE
ld b, 4
- call Functiond0228
- call Functiond0504
+ call PokeAnim_InitAnim
+ call PokeAnim_SetVBank1
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -208,8 +207,8 @@ PokeAnim_Setup2: ; d011d
PokeAnim_Extra: ; d012f
ld c, TRUE
ld b, 0
- call Functiond0228
- call Functiond0504
+ call PokeAnim_InitAnim
+ call PokeAnim_SetVBank1
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -217,11 +216,11 @@ PokeAnim_Extra: ; d012f
; d0141
PokeAnim_Play: ; d0141
- call Functiond0250
- ld a, [w2_d17e]
+ call PokeAnim_DoAnimScript
+ ld a, [wPokeAnimJumptableIndex]
bit 7, a
ret z
- call Functiond04bd
+ call PokeAnim_PlaceGraphic
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -229,8 +228,8 @@ PokeAnim_Play: ; d0141
; d0155
PokeAnim_Play2: ; d0155
- call Functiond0250
- ld a, [w2_d17e]
+ call PokeAnim_DoAnimScript
+ ld a, [wPokeAnimJumptableIndex]
bit 7, a
ret z
ld a, [wPokeAnimSceneIndex]
@@ -239,8 +238,8 @@ PokeAnim_Play2: ; d0155
ret
; d0166
-PokeAnim_Nop: ; d0166
- call Functiond01a9
+PokeAnim_BasePic: ; d0166
+ call PokeAnim_DeinitFrames
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -248,7 +247,7 @@ PokeAnim_Nop: ; d0166
; d0171
PokeAnim_Finish: ; d0171
- call Functiond01a9
+ call PokeAnim_DeinitFrames
ld hl, wPokeAnimSceneIndex
set 7, [hl]
ret
@@ -283,15 +282,15 @@ PokeAnim_StereoCry: ; d0196
ret
; d01a9
-Functiond01a9: ; d01a9
+PokeAnim_DeinitFrames: ; d01a9
ld a, [rSVBK]
push af
ld a, $2
ld [rSVBK], a
- call Functiond04bd
- callba Function10402d
- call Functiond0536
- callba Function104047
+ call PokeAnim_PlaceGraphic
+ callba HDMATransferTileMapToWRAMBank3
+ call PokeAnim_SetVBank0
+ callba HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ret
@@ -311,7 +310,7 @@ AnimateMon_CheckIfPokemon: ; d01c6
ret
; d01d6
-Functiond01d6: ; d01d6
+PokeAnim_InitPicAttributes: ; d01d6
ld a, [rSVBK]
push af
ld a, $2
@@ -338,28 +337,33 @@ Functiond01d6: ; d01d6
ld [wPokeAnimCoord], a
ld a, h
ld [wPokeAnimCoord + 1], a
-; d = ?????
+; d = start tile
ld a, d
- ld [w2_d16e], a
+ ld [wPokeAnimGraphicStartTile], a
+
ld a, $1
ld hl, CurPartySpecies
call GetFarWRAMByte
ld [wPokeAnimSpecies], a
+
ld a, $1
ld hl, UnownLetter
call GetFarWRAMByte
ld [wPokeAnimUnownLetter], a
+
call PokeAnim_GetSpeciesOrUnown
ld [wPokeAnimSpeciesOrUnown], a
+
call PokeAnim_GetFrontpicDims
ld a, c
ld [wPokeAnimFrontpicHeight], a
+
pop af
ld [rSVBK], a
ret
; d0228
-Functiond0228: ; d0228
+PokeAnim_InitAnim: ; d0228
ld a, [rSVBK]
push af
ld a, $2
@@ -371,7 +375,7 @@ Functiond0228: ; d0228
call ByteFill
pop bc
ld a, b
- ld [w2_d173], a
+ ld [wPokeAnimSpeed], a
ld a, c
ld [wPokeAnimExtraFlag], a
call GetMonAnimPointer
@@ -382,76 +386,75 @@ Functiond0228: ; d0228
ret
; d0250
-Functiond0250: ; d0250
+PokeAnim_DoAnimScript: ; d0250
xor a
ld [hBGMapMode], a
-
-Functiond0253: ; d0253
- ld a, [w2_d17e]
+.loop
+ ld a, [wPokeAnimJumptableIndex]
and $7f
- ld hl, Tabled025d
+ ld hl, .Jumptable
rst JumpTable
ret
; d025d
-Tabled025d: ; d025d
- dw Functiond0261
- dw Functiond0282
+.Jumptable: ; d025d
+ dw .RunAnim
+ dw .WaitAnim
; d0261
-Functiond0261: ; d0261
- call Functiond02f8
- ld a, [w2_d182]
- cp $ff
+.RunAnim: ; d0261
+ call PokeAnim_GetPointer
+ ld a, [wPokeAnimCommand]
+ cp -1
jr z, PokeAnim_End
- cp $fe
- jr z, PokeAnim_SetRepeat
- cp $fd
- jr z, PokeAnim_DoRepeat
- call Functiond02c8
- ld a, [w2_d183]
- call Functiond02ae
+ cp -2
+ jr z, .SetRepeat
+ cp -3
+ jr z, .DoRepeat
+ call PokeAnim_GetFrame
+ ld a, [wPokeAnimParameter]
+ call PokeAnim_GetDuration
ld [wPokeAnimWaitCounter], a
- call Functiond02dc
-
-Functiond0282: ; d0282
+ call PokeAnim_StartWaitAnim
+.WaitAnim: ; d0282
ld a, [wPokeAnimWaitCounter]
dec a
ld [wPokeAnimWaitCounter], a
ret nz
- call Functiond02e4
+ call PokeAnim_StopWaitAnim
ret
; d028e
-PokeAnim_SetRepeat: ; d028e
- ld a, [w2_d183]
+.SetRepeat: ; d028e
+ ld a, [wPokeAnimParameter]
ld [wPokeAnimRepeatTimer], a
- jr Functiond0253
+ jr .loop
; d0296
-PokeAnim_DoRepeat: ; d0296
+.DoRepeat: ; d0296
ld a, [wPokeAnimRepeatTimer]
and a
ret z
dec a
ld [wPokeAnimRepeatTimer], a
ret z
- ld a, [w2_d183]
- ld [w2_d17d], a
- jr Functiond0253
+ ld a, [wPokeAnimParameter]
+ ld [wPokeAnimFrame], a
+ jr .loop
; d02a8
PokeAnim_End: ; d02a8
- ld hl, w2_d17e
+ ld hl, wPokeAnimJumptableIndex
set 7, [hl]
ret
; d02ae
-Functiond02ae: ; d02ae
+PokeAnim_GetDuration: ; d02ae
+; a * (1 + [wPokeAnimSpeed] / 16)
ld c, a
ld b, $0
ld hl, 0
- ld a, [w2_d173]
+ ld a, [wPokeAnimSpeed]
call AddNTimes
ld a, h
swap a
@@ -465,30 +468,30 @@ Functiond02ae: ; d02ae
ret
; d02c8
-Functiond02c8: ; d02c8
- call Functiond04bd
- ld a, [w2_d182]
+PokeAnim_GetFrame: ; d02c8
+ call PokeAnim_PlaceGraphic
+ ld a, [wPokeAnimCommand]
and a
ret z
- call Functiond031b
+ call PokeAnim_GetBitmaskIndex
push hl
- call Functiond033b
+ call PokeAnim_CopyBitmaskToBuffer
pop hl
- call Functiond036b
+ call PokeAnim_ConvertAndApplyBitmask
ret
; d02dc
-Functiond02dc: ; d02dc
- ld a, [w2_d17e]
+PokeAnim_StartWaitAnim: ; d02dc
+ ld a, [wPokeAnimJumptableIndex]
inc a
- ld [w2_d17e], a
+ ld [wPokeAnimJumptableIndex], a
ret
; d02e4
-Functiond02e4: ; d02e4
- ld a, [w2_d17e]
+PokeAnim_StopWaitAnim: ; d02e4
+ ld a, [wPokeAnimJumptableIndex]
dec a
- ld [w2_d17e], a
+ ld [wPokeAnimJumptableIndex], a
ret
; d02ec
@@ -504,32 +507,31 @@ PokeAnim_IsEgg: ; d02f2
ret
; d02f8
-Functiond02f8: ; d02f8
+PokeAnim_GetPointer: ; d02f8
push hl
- ld a, [w2_d17d]
+ ld a, [wPokeAnimFrame]
ld e, a
ld d, $0
ld hl, wPokeAnimPointerAddr
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wPokeAnimPointerBank]
call GetFarHalfword
ld a, l
- ld [w2_d182], a
+ ld [wPokeAnimCommand], a
ld a, h
- ld [w2_d183], a
- ld hl, w2_d17d
+ ld [wPokeAnimParameter], a
+ ld hl, wPokeAnimFrame
inc [hl]
pop hl
ret
; d031b
-Functiond031b: ; d031b
- ld a, [w2_d182]
+PokeAnim_GetBitmaskIndex: ; d031b
+ ld a, [wPokeAnimCommand]
dec a
ld c, a
ld b, $0
@@ -537,41 +539,40 @@ Functiond031b: ; d031b
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [wPokeAnimFramesBank]
call GetFarHalfword
ld a, [wPokeAnimFramesBank]
call GetFarByte
- ld [w2_d180], a
+ ld [wPokeAnimCurBitmask], a
inc hl
ret
; d033b
-Functiond033b: ; d033b
- call Functiond0356
+PokeAnim_CopyBitmaskToBuffer: ; d033b
+ call .GetSize
push bc
ld hl, wPokeAnimBitmaskAddr
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [w2_d180]
+ ld a, [wPokeAnimCurBitmask]
call AddNTimes
pop bc
- ld de, w2_d188
+ ld de, wPokeAnimBitmaskBuffer
ld a, [wPokeAnimBitmaskBank]
call FarCopyBytes
ret
; d0356
-Functiond0356: ; d0356
+.GetSize: ; d0356
push hl
ld a, [wPokeAnimFrontpicHeight]
- sub 5
+ sub 5 ; to get a number 0, 1, or 2
ld c, a
ld b, 0
- ld hl, Unknown_d0368
+ ld hl, .Sizes
add hl, bc
ld c, [hl]
ld b, 0
@@ -579,16 +580,28 @@ Functiond0356: ; d0356
ret
; d0368
-Unknown_d0368: db 4, 5, 7
+.Sizes: db 4, 5, 7
+
+poke_anim_box: MACRO
+y = 7
+rept \1
+x = 7 +- \1
+rept \1
+ db x + y
+x = x + 1
+endr
+y = y + 7
+endr
+endm
-Functiond036b: ; d036b
+PokeAnim_ConvertAndApplyBitmask: ; d036b
xor a
- ld [w2_d187], a
- ld [w2_d186], a
- ld [w2_d185], a
+ ld [wPokeAnimBitmaskCurBit], a
+ ld [wPokeAnimBitmaskCurRow], a
+ ld [wPokeAnimBitmaskCurCol], a
.loop
push hl
- call Functiond0392
+ call .IsCurBitSet
pop hl
ld a, b
and a
@@ -598,38 +611,40 @@ Functiond036b: ; d036b
call GetFarByte
inc hl
push hl
- call Functiond03bd
+ call .ApplyFrame
pop hl
.next
push hl
- call Functiond0499
+ call .NextBit
pop hl
jr nc, .loop
ret
; d0392
-Functiond0392: ; d0392
- ld a, [w2_d187]
+.IsCurBitSet: ; d0392
+; which byte
+ ld a, [wPokeAnimBitmaskCurBit]
and $f8
rrca
rrca
rrca
ld e, a
ld d, 0
- ld hl, w2_d188
+ ld hl, wPokeAnimBitmaskBuffer
add hl, de
ld b, [hl]
- ld a, [w2_d187]
- and 7
+; which bit
+ ld a, [wPokeAnimBitmaskCurBit]
+ and $7
jr z, .skip
ld c, a
ld a, b
-.loop
+.loop2
rrca
dec c
- jr nz, .loop
+ jr nz, .loop2
ld b, a
.skip
@@ -640,40 +655,40 @@ Functiond0392: ; d0392
.finish
ld b, a
- ld hl, w2_d187
+ ld hl, wPokeAnimBitmaskCurBit
inc [hl]
ret
; d03bd
-Functiond03bd: ; d03bd
+.ApplyFrame: ; d03bd
push af
- call Functiond03cd
+ call .GetCoord
pop af
push hl
- call Functiond03f7
- ld hl, w2_d16e
+ call .GetTilemap
+ ld hl, wPokeAnimGraphicStartTile
add [hl]
pop hl
ld [hl], a
ret
; d03cd
-Functiond03cd: ; d03cd
- call Functiond046c
- ld a, [w2_d186]
+.GetCoord: ; d03cd
+ call .GetStartCoord
+ ld a, [wPokeAnimBitmaskCurRow]
ld bc, SCREEN_WIDTH
call AddNTimes
ld a, [wBoxAlignment]
and a
jr nz, .go
- ld a, [w2_d185]
+ ld a, [wPokeAnimBitmaskCurCol]
ld e, a
ld d, 0
add hl, de
- jr .skip
+ jr .skip2
.go
- ld a, [w2_d185]
+ ld a, [wPokeAnimBitmaskCurCol]
ld e, a
ld a, l
sub e
@@ -682,13 +697,14 @@ Functiond03cd: ; d03cd
sbc 0
ld h, a
-.skip
+.skip2
ret
; d03f4
-Unknown_d03f4: db 6, 5, 4
+; XXX
+ db 6, 5, 4
-Functiond03f7: ; d03f7
+.GetTilemap: ; d03f7
push af
ld a, [wPokeAnimFrontpicHeight]
cp 5
@@ -704,7 +720,7 @@ Functiond03f7: ; d03f7
jr nc, .add_24
push hl
push de
- ld hl, Unknown_d042f
+ ld hl, ._5by5
ld e, a
ld d, 0
add hl, de
@@ -723,7 +739,7 @@ Functiond03f7: ; d03f7
jr nc, .add_13
push hl
push de
- ld hl, Unknown_d0448
+ ld hl, ._6by6
ld e, a
ld d, 0
add hl, de
@@ -737,28 +753,16 @@ Functiond03f7: ; d03f7
ret
; d042f
-macro_d042f: MACRO
-y = 7
-rept 7 +- \1
-x = \1
-rept 7 +- \1
- db x + y
-x = x + 1
-endr
-y = y + 7
-endr
-endm
-
-Unknown_d042f:
- macro_d042f 2
+._5by5:
+ poke_anim_box 5
; db 9, 10, 11, 12, 13
; db 16, 17, 18, 19, 20
; db 23, 24, 25, 26, 27
; db 30, 31, 32, 33, 34
; db 37, 38, 39, 40, 41
-Unknown_d0448:
- macro_d042f 1
+._6by6:
+ poke_anim_box 6
; db 8, 9, 10, 11, 12, 13
; db 15, 16, 17, 18, 19, 20
; db 22, 23, 24, 25, 26, 27
@@ -767,7 +771,7 @@ Unknown_d0448:
; db 43, 44, 45, 46, 47, 48
-Functiond046c: ; d046c
+.GetStartCoord: ; d046c
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -778,12 +782,12 @@ Functiond046c: ; d046c
ld bc, 6
cp 7
jr z, .okay
- ld de, 21
- ld bc, 25
+ ld de, SCREEN_WIDTH + 1
+ ld bc, SCREEN_WIDTH + 5
cp 6
jr z, .okay
- ld de, 41
- ld bc, 45
+ ld de, 2 * SCREEN_WIDTH + 1
+ ld bc, 2 * SCREEN_WIDTH + 5
.okay
ld a, [wBoxAlignment]
@@ -797,19 +801,19 @@ Functiond046c: ; d046c
ret
; d0499
-Functiond0499: ; d0499
- ld a, [w2_d186]
+.NextBit: ; d0499
+ ld a, [wPokeAnimBitmaskCurRow]
inc a
- ld [w2_d186], a
+ ld [wPokeAnimBitmaskCurRow], a
ld c, a
ld a, [wPokeAnimFrontpicHeight]
cp c
jr nz, .no_carry
xor a
- ld [w2_d186], a
- ld a, [w2_d185]
+ ld [wPokeAnimBitmaskCurRow], a
+ ld a, [wPokeAnimBitmaskCurCol]
inc a
- ld [w2_d185], a
+ ld [wPokeAnimBitmaskCurCol], a
ld c, a
ld a, [wPokeAnimFrontpicHeight]
cp c
@@ -822,16 +826,16 @@ Functiond0499: ; d0499
ret
; d04bd
-Functiond04bd: ; d04bd
- call Functiond04f6
+PokeAnim_PlaceGraphic: ; d04bd
+ call .ClearBox
ld a, [wBoxAlignment]
and a
- jr nz, .minus_one_and_six
+ jr nz, .flipped
ld de, 1
ld bc, 0
jr .okay
-.minus_one_and_six
+.flipped
ld de, -1
ld bc, 6
@@ -843,7 +847,7 @@ Functiond04bd: ; d04bd
add hl, bc
ld c, 7
ld b, 7
- ld a, [w2_d16e]
+ ld a, [wPokeAnimGraphicStartTile]
.loop
push bc
push hl
@@ -864,7 +868,7 @@ Functiond04bd: ; d04bd
ret
; d04f6
-Functiond04f6: ; d04f6
+.ClearBox: ; d04f6
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -875,67 +879,67 @@ Functiond04f6: ; d04f6
ret
; d0504
-Functiond0504: ; d0504
+PokeAnim_SetVBank1: ; d0504
ld a, [rSVBK]
push af
ld a, $2
ld [rSVBK], a
xor a
ld [hBGMapMode], a
- call Functiond051b
- callba Function104047
+ call .SetFlag
+ callba HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ret
; d051b
-Functiond051b: ; d051b
- call Functiond0551
+.SetFlag: ; d051b
+ call PokeAnim_GetAttrMapCoord
ld b, 7
ld c, 7
- ld de, $0014
-.asm_d0525
+ ld de, SCREEN_WIDTH
+.row
push bc
push hl
-.asm_d0527
+.col
ld a, [hl]
or 8
ld [hl], a
add hl, de
dec c
- jr nz, .asm_d0527
+ jr nz, .col
pop hl
inc hl
pop bc
dec b
- jr nz, .asm_d0525
+ jr nz, .row
ret
; d0536
-Functiond0536: ; d0536
- call Functiond0551
+PokeAnim_SetVBank0: ; d0536
+ call PokeAnim_GetAttrMapCoord
ld b, 7
ld c, 7
- ld de, $0014
-.asm_d0540
+ ld de, SCREEN_WIDTH
+.row
push bc
push hl
-.asm_d0542
+.col
ld a, [hl]
and $f7
ld [hl], a
add hl, de
dec c
- jr nz, .asm_d0542
+ jr nz, .col
pop hl
inc hl
pop bc
dec b
- jr nz, .asm_d0540
+ jr nz, .row
ret
; d0551
-Functiond0551: ; d0551
+PokeAnim_GetAttrMapCoord: ; d0551
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -970,9 +974,8 @@ GetMonAnimPointer: ; d055c
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, c
ld [wPokeAnimPointerBank], a
call GetFarHalfword
@@ -1041,9 +1044,8 @@ GetMonFramesPointer: ; d05ce
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, b
call GetFarHalfword
ld a, l
@@ -1081,9 +1083,8 @@ GetMonBitmaskPointer: ; d061b
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wPokeAnimBitmaskBank]
call GetFarHalfword
ld a, l
@@ -1115,10 +1116,9 @@ PokeAnim_GetSpeciesOrUnown: ; d065c
ret
; d0669
-Functiond0669: ; d0669 Predef 48
+Predef48: ; d0669 Predef 48
ld a, $1
ld [wBoxAlignment], a
-
HOF_AnimateFrontpic: ; d066e Predef 49
call AnimateMon_CheckIfPokemon
jr c, .fail
diff --git a/gfx/unknown/011e5d.2bpp b/gfx/unknown/011e5d.1bpp
index 7bbee183b..7bbee183b 100644
--- a/gfx/unknown/011e5d.2bpp
+++ b/gfx/unknown/011e5d.1bpp
diff --git a/gfx/unknown/011e65.2bpp b/gfx/unknown/011e65.1bpp
index 9713c883a..9713c883a 100644
--- a/gfx/unknown/011e65.2bpp
+++ b/gfx/unknown/011e65.1bpp
Binary files differ
diff --git a/gfx/unknown/011e6d.2bpp b/gfx/unknown/011e6d.1bpp
index 3da14ecbe..3da14ecbe 100644
--- a/gfx/unknown/011e6d.2bpp
+++ b/gfx/unknown/011e6d.1bpp
Binary files differ
diff --git a/gfx/unknown/0f8f34.2bpp b/gfx/unknown/0f8f34.w64.1bpp
index 7209b2608..7209b2608 100644
--- a/gfx/unknown/0f8f34.2bpp
+++ b/gfx/unknown/0f8f34.w64.1bpp
Binary files differ
diff --git a/gfx/unknown/16c903.pal b/gfx/unknown/16c903.pal
new file mode 100755
index 000000000..a72635167
--- /dev/null
+++ b/gfx/unknown/16c903.pal
@@ -0,0 +1,39 @@
+ RGB 31, 31, 31
+ RGB 04, 10, 20
+ RGB 16, 19, 25
+ RGB 25, 27, 29
+
+ 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 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
diff --git a/home.asm b/home.asm
index e0099b7e8..89b1b3d42 100644
--- a/home.asm
+++ b/home.asm
@@ -37,7 +37,7 @@ INCLUDE "home/handshake.asm"
INCLUDE "home/game_time.asm"
INCLUDE "home/map.asm"
-Function2d43:: ; 2d43
+InexplicablyEmptyFunction:: ; 2d43
; Inexplicably empty.
; Seen in PredefPointers.
rept 16
@@ -49,13 +49,6 @@ Function2d43:: ; 2d43
INCLUDE "home/farcall.asm"
INCLUDE "home/predef.asm"
INCLUDE "home/window.asm"
-
-Function2e4e:: ; 2e4e
-; Unreferenced.
- scf
- ret
-; 2e50
-
INCLUDE "home/flag.asm"
Function2ebb:: ; 2ebb
@@ -342,7 +335,7 @@ PrintLetterDelay:: ; 313d
call GetJoypad
; input override
- ld a, [wc2d7]
+ ld a, [wDisableTextAcceleration]
and a
jr nz, .wait
@@ -393,28 +386,12 @@ CopyDataUntil:: ; 318c
; 0x3198
PrintNum:: ; 3198
- ld a, [hROMBank]
- push af
- ld a, BANK(_PrintNum)
- rst Bankswitch
-
- call _PrintNum
-
- pop af
- rst Bankswitch
+ homecall _PrintNum
ret
; 31a4
MobilePrintNum:: ; 31a4
- ld a, [hROMBank]
- push af
- ld a, BANK(_MobilePrintNum)
- rst Bankswitch
-
- call _MobilePrintNum
-
- pop af
- rst Bankswitch
+ homecall _MobilePrintNum
ret
; 31b0
@@ -570,7 +547,7 @@ LoadEDTile:: ; 323d
; 323f
; XXX
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 3246
@@ -744,10 +721,10 @@ GetHPPal:: ; 3353
ld d, HP_GREEN
ld a, e
- cp 24
+ cp (50 * 48 / 100)
ret nc
inc d ; yellow
- cp 10
+ cp (21 * 48 / 100)
ret nc
inc d ; red
ret
@@ -798,12 +775,7 @@ NamesPointers:: ; 33ab
dbw 0, PartyMonOT
dbw 0, OTPartyMonOT
dba TrainerClassNames
-; 33c0
-
-Function33c0:
- inc b
- ld d, d
- ld c, e
+ dbw $4, $4b52 ; within PackMenuGFX
; 33c3
GetName:: ; 33c3
@@ -834,9 +806,9 @@ GetName:: ; 33c3
ld e, a
ld d, 0
ld hl, NamesPointers
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hli]
rst Bankswitch
ld a, [hli]
@@ -853,9 +825,9 @@ endr
.done
ld a, e
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, d
- ld [wd103], a
+ ld [wUnusedD102 + 1], a
pop de
pop bc
@@ -1142,7 +1114,7 @@ InitScrollingMenu:: ; 352f
jp TextBox
; 354b
-Function354b:: ; 354b joypad
+JoyTextDelay_ForcehJoyDown:: ; 354b joypad
call DelayFrame
ld a, [hInMenu]
@@ -1692,22 +1664,22 @@ PrintLevel:: ; 382d
; How many digits?
ld c, 2
cp 100
- jr c, Function3842
+ jr c, Print8BitNumRightAlign
; 3-digit numbers overwrite the :L.
dec hl
inc c
- jr Function3842
+ jr Print8BitNumRightAlign
; 383d
-Function383d:: ; 383d
+PrintLevel_Force3Digits:: ; 383d
; Print :L and all 3 digits
ld [hl], "<LV>"
inc hl
ld c, 3
; 3842
-Function3842:: ; 3842
+Print8BitNumRightAlign:: ; 3842
ld [wd265], a
ld de, wd265
ld b, PRINTNUM_RIGHTALIGN | 1
@@ -1715,6 +1687,8 @@ Function3842:: ; 3842
; 384d
Function384d:: ; 384d
+; XXX
+; GetNthMove
ld hl, wListMoves_MoveIndicesBuffer
ld c, a
ld b, 0
@@ -1907,13 +1881,17 @@ GetPartyLocation:: ; 3927
; 392d
Function392d:: ; 392d
+; XXX
+; GetDexNumber
+; Probably used in gen 1 to convert index number to dex number
+; Not required in gen 2 because index number == dex number
push hl
ld a, b
dec a
ld b, 0
add hl, bc
ld hl, BaseData + 0
- ld bc, $0020
+ ld bc, BaseData1 - BaseData0
call AddNTimes
ld a, BANK(BaseData)
call GetFarHalfword
@@ -1925,9 +1903,9 @@ Function392d:: ; 392d
INCLUDE "home/battle.asm"
-Function3b0c:: ; 3b0c
+PushLYOverrides:: ; 3b0c
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
and a
ret z
diff --git a/home/audio.asm b/home/audio.asm
index c6982fbbc..5e6eafe9a 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -196,7 +196,7 @@ endr
PlaySFX:: ; 3c23
; Play sound effect de.
-; Sound effects are ordered by priority (lowest to highest)
+; Sound effects are ordered by priority (highest to lowest)
push hl
push de
diff --git a/home/battle.asm b/home/battle.asm
index ea228851e..e8aa0747c 100644
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -153,9 +153,8 @@ GetBattleVarAddr:: ; 39e7
ld hl, .battlevarpairs
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
@@ -175,9 +174,8 @@ endr
ld b, 0
ld hl, .vars
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
diff --git a/home/copy.asm b/home/copy.asm
index d4e3e2da7..8a307b3df 100644
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -6,13 +6,7 @@ Get2bpp_2:: ; dc9
bit 7, a
jp z, Copy2bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get2bpp)
- rst Bankswitch
- call _Get2bpp
- pop af
- rst Bankswitch
+ homecall _Get2bpp
ret
; ddc
@@ -22,13 +16,7 @@ Get1bpp_2:: ; ddc
bit 7, a
jp z, Copy1bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get1bpp)
- rst Bankswitch
- call _Get1bpp
- pop af
- rst Bankswitch
+ homecall _Get1bpp
ret
; def
@@ -205,9 +193,8 @@ FarCopyBytesDouble:: ; e9b
.loop
ld a, [de]
inc de
-rept 2
ld [hli], a
-endr
+ ld [hli], a
.dec
dec c
jr nz, .loop
@@ -422,9 +409,9 @@ Copy1bpp:: ; fa4
push af
ld h, 0
ld l, c
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld b, h
ld c, l
pop af
diff --git a/home/decompress.asm b/home/decompress.asm
index 373e9fe89..216b861f6 100644
--- a/home/decompress.asm
+++ b/home/decompress.asm
@@ -99,7 +99,7 @@ LZ_LONG_HI EQU %00000011
add a ; << 3
add a
- ; This is our new control code.
+ ; This is our new control code.
and LZ_CMD
push af
diff --git a/home/fade.asm b/home/fade.asm
index 579a4125a..c5eb2c2eb 100644
--- a/home/fade.asm
+++ b/home/fade.asm
@@ -2,6 +2,8 @@
Function48c:: ; 48c
+; XXX
+; TimeOfDayFade
ld a, [TimeOfDayPal]
ld b, a
ld hl, IncGradGBPalTable_11
diff --git a/home/game_time.asm b/home/game_time.asm
index 54cad89c9..09d558eef 100644
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -33,7 +33,7 @@ UpdateGameTimer:: ; 20ad
; Don't update if game logic is paused.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
diff --git a/home/handshake.asm b/home/handshake.asm
index 2f067e7f6..14daf08a7 100644
--- a/home/handshake.asm
+++ b/home/handshake.asm
@@ -1,28 +1,22 @@
PrinterReceive:: ; 2057
- ld a, [hROMBank]
- push af
- ld a, BANK(_PrinterReceive)
- rst Bankswitch
-
- call _PrinterReceive
- pop af
- rst Bankswitch
+ homecall _PrinterReceive
ret
; 2063
AskSerial:: ; 2063
; send out a handshake while serial int is off
- ld a, [wc2d4]
+ ld a, [wPrinterConnectionOpen]
bit 0, a
ret z
- ld a, [wc2d5]
+; if we're still interpreting data, don't try to receive
+ ld a, [wPrinterOpcode]
and a
ret nz
; once every 6 frames
- ld hl, wca8a
+ ld hl, wHandshakeFrameDelay
inc [hl]
ld a, [hl]
cp 6
@@ -31,8 +25,8 @@ AskSerial:: ; 2063
xor a
ld [hl], a
- ld a, $c
- ld [wc2d5], a
+ ld a, 12
+ ld [wPrinterOpcode], a
; handshake
ld a, $88
diff --git a/home/init.asm b/home/init.asm
index 8c847ec76..b983ce826 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -100,7 +100,7 @@ Init:: ; 17d
ld [rSVBK], a
call ClearVRAM
call ClearSprites
- call Function270
+ call ClearsScratch
ld a, BANK(LoadPushOAM)
@@ -139,7 +139,7 @@ Init:: ; 17d
ld a, -1
ld [hLinkPlayerNumber], a
- callba Function9890
+ callba InitCGBPals
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
@@ -154,9 +154,9 @@ Init:: ; 17d
ld a, [hCGB]
and a
- jr z, .asm_22b
+ jr z, .no_double_speed
call NormalSpeed
-.asm_22b
+.no_double_speed
xor a
ld [rIF], a
@@ -166,7 +166,7 @@ Init:: ; 17d
call DelayFrame
- predef Function9853
+ predef InitSGBBorder ; SGB init
call MapSetup_Sound_Off
xor a
@@ -194,9 +194,10 @@ ClearVRAM:: ; 245
ClearWRAM:: ; 25a
; Wipe swappable WRAM banks (1-7)
+; Assumes CGB or AGB
ld a, 1
-.asm_25c
+.bank_loop
push af
ld [rSVBK], a
xor a
@@ -206,15 +207,17 @@ ClearWRAM:: ; 25a
pop af
inc a
cp 8
- jr nc, .asm_25c
+ jr nc, .bank_loop ; Should be jr c
ret
; 270
-Function270:: ; 270
- ld a, $0
+ClearsScratch:: ; 270
+; Wipe the first 32 bytes of sScratch
+
+ ld a, BANK(sScratch)
call GetSRAMBank
- ld hl, $a000
- ld bc, $0020
+ ld hl, sScratch
+ ld bc, $20
xor a
call ByteFill
call CloseSRAM
diff --git a/home/joypad.asm b/home/joypad.asm
index d66cdb662..0cb2f6206 100644
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -33,7 +33,7 @@ Joypad:: ; 935
ret nz
; If we're saving, input is disabled.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
@@ -42,9 +42,8 @@ Joypad:: ; 935
ld a, R_DPAD
ld [rJOYP], a
; Read twice to give the request time to take.
-rept 2
ld a, [rJOYP]
-endr
+ ld a, [rJOYP]
; The Joypad register output is in the lo nybble (inversed).
; We make the hi nybble of our new container d-pad input.
@@ -209,9 +208,8 @@ GetJoypad:: ; 984
jr nz, .next
; The current input is overwritten.
-rept 2
dec hl
-endr
+ dec hl
ld b, NO_INPUT
jr .finishauto
diff --git a/home/lcd.asm b/home/lcd.asm
index fd62808d2..b73e9e5be 100644
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -3,7 +3,7 @@
Function547:: ; 547
; Unreferenced
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
cp rSCX - $ff00
ret nz
ld c, a
@@ -15,7 +15,7 @@ Function547:: ; 547
LCD:: ; 552
push af
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
and a
jr z, .done
@@ -26,7 +26,7 @@ LCD:: ; 552
ld b, LYOverrides >> 8
ld a, [bc]
ld b, a
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
ld c, a
ld a, b
ld [$ff00+c], a
diff --git a/home/map.asm b/home/map.asm
index 96eae7d37..967d13af5 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -155,9 +155,9 @@ LoadMetatiles:: ; 2198
add a
ld l, a
ld h, 0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld a, [TilesetBlocksAddress]
add l
ld l, a
@@ -694,9 +694,9 @@ RestoreFacingAfterWarp:: ; 248a
ld a, [hli]
ld h, [hl]
ld l, a
-rept 3
inc hl ; get to the warp coords
-endr
+ inc hl ; get to the warp coords
+ inc hl ; get to the warp coords
ld a, [WarpNumber]
dec a
ld c, a
@@ -751,9 +751,9 @@ ChangeMap:: ; 24e4
ld [hConnectionStripLength], a
ld c, a
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld c, 3
add hl, bc
ld a, [MapBlockDataBank]
@@ -1072,7 +1072,7 @@ MapTextbox:: ; 269a
push hl
call SpeechTextBox
- call Function2e31
+ call SafeUpdateSprites
ld a, 1
ld [hOAMUpdate], a
call ApplyTilemap
@@ -1382,7 +1382,7 @@ UpdateBGMapColumn:: ; 27f8
; unreferenced
ld hl, BGMapBuffer
- ld bc, SGBPredef - BGMapBuffer
+ ld bc, BGMapBufferEnd - BGMapBuffer
xor a
call ByteFill
ret
diff --git a/home/map_objects.asm b/home/map_objects.asm
index 3c70233eb..f64ebd8ab 100644
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -28,9 +28,8 @@ GetSpriteVTile:: ; 180e
.loop
cp [hl]
jr z, .found
-rept 2
inc hl
-endr
+ inc hl
dec c
jr nz, .loop
ld a, [UsedSprites + 1]
@@ -503,9 +502,8 @@ rept SPRITEMOVEDATA_FIELDS
endr
ld a, BANK(SpriteMovementData)
call GetFarByte
-rept 2
add a
-endr
+ add a
and $c
pop de
pop bc
@@ -638,7 +636,7 @@ GetObjectStruct:: ; 1ae5
ret
; 1af1
-GetObjectSprite:: ; 1af1
+DoesObjectHaveASprite:: ; 1af1
ld hl, OBJECT_SPRITE
add hl, bc
ld a, [hl]
diff --git a/home/math.asm b/home/math.asm
index c320fd15c..01aea6b72 100644
--- a/home/math.asm
+++ b/home/math.asm
@@ -59,15 +59,7 @@ Divide:: ; 3124
push hl
push de
push bc
- ld a, [hROMBank]
- push af
- ld a, BANK(_Divide)
- rst Bankswitch
-
- call _Divide
-
- pop af
- rst Bankswitch
+ homecall _Divide
pop bc
pop de
pop hl
diff --git a/home/menu.asm b/home/menu.asm
index b7755de08..563ee9f99 100644
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -229,9 +229,9 @@ _OffsetMenuDataHeader:: ; 1e35
; 1e5d
DoNthMenu:: ; 1e5d
- call MenuFunc_1e7f
+ call DrawVariableLengthMenuBox
call MenuWriteText
- call Function1eff
+ call InitMenuCursorAndButtonPermissions
call GetStaticMenuJoypad
call GetMenuJoypad
call MenuClickSound
@@ -239,17 +239,17 @@ DoNthMenu:: ; 1e5d
; 1e70
SetUpMenu:: ; 1e70
- call MenuFunc_1e7f ; ???
+ call DrawVariableLengthMenuBox ; ???
call MenuWriteText
- call Function1eff ; set up selection pointer
+ call InitMenuCursorAndButtonPermissions ; set up selection pointer
ld hl, w2DMenuFlags1
set 7, [hl]
ret
-MenuFunc_1e7f::
+DrawVariableLengthMenuBox::
call CopyMenuData2
call GetMenuIndexSet
- call Function1ea6
+ call AutomaticGetMenuBottomCoord
call MenuBox
ret
@@ -257,8 +257,8 @@ MenuWriteText::
xor a
ld [hBGMapMode], a
call GetMenuIndexSet ; sort out the text
- call Function1eda ; actually write it
- call Function2e31
+ call RunMenuItemPrintingFunction ; actually write it
+ call SafeUpdateSprites
ld a, [hOAMUpdate]
push af
ld a, $1
@@ -269,7 +269,7 @@ MenuWriteText::
ret
; 0x1ea6
-Function1ea6:: ; 1ea6
+AutomaticGetMenuBottomCoord:: ; 1ea6
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderRightCoord]
@@ -310,7 +310,7 @@ GetMenuIndexSet:: ; 1ebd
ret
; 1eda
-Function1eda:: ; 1eda
+RunMenuItemPrintingFunction:: ; 1eda
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
@@ -325,7 +325,7 @@ Function1eda:: ; 1eda
ld d, h
ld e, l
ld hl, wMenuData2DisplayFunctionPointer
- call .__wMenuData2DisplayFunction__
+ call ._hl_
pop hl
ld de, 2 * SCREEN_WIDTH
add hl, de
@@ -333,14 +333,14 @@ Function1eda:: ; 1eda
jr .loop
; 1efb
-.__wMenuData2DisplayFunction__ ; 1efb
+._hl_ ; 1efb
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1eff
-Function1eff:: ; 1eff
+InitMenuCursorAndButtonPermissions:: ; 1eff
call InitVerticalMenuCursor
ld hl, wMenuJoypadFilter
ld a, [wMenuData2Flags]
diff --git a/home/mobile.asm b/home/mobile.asm
index afe5d1b59..f50571ff4 100644
--- a/home/mobile.asm
+++ b/home/mobile.asm
@@ -6,7 +6,7 @@ Function3e32:: ; 3e32
ld [$c986], a
ld a, h
ld [$c987], a
- jr nz, .asm_3e4f
+ jr nz, .okay
ld [$c982], a
ld a, l
@@ -17,7 +17,7 @@ Function3e32:: ; 3e32
ld a, b
ld [hl], a
-.asm_3e4f
+.okay
ld hl, $c822
set 6, [hl]
ld a, [hROMBank]
@@ -30,6 +30,7 @@ Function3e32:: ; 3e32
; 3e60
Function3e60:: ; 3e60
+; Return from Function110030
ld [$c986], a
ld a, l
ld [$c987], a
diff --git a/home/movement.asm b/home/movement.asm
index 0e131e468..c4b5b578d 100644
--- a/home/movement.asm
+++ b/home/movement.asm
@@ -107,9 +107,8 @@ ComputePathToWalkToPlayer:: ; 1b5f
push hl
ld l, b
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld e, a
ld d, 0
add hl, de
@@ -122,18 +121,18 @@ endr
; 1ba5
.MovementData:
- slow_step_down
- slow_step_up
- slow_step_left
- slow_step_right
- step_down
- step_up
- step_left
- step_right
- big_step_down
- big_step_up
- big_step_left
- big_step_right
+ slow_step DOWN
+ slow_step UP
+ slow_step LEFT
+ slow_step RIGHT
+ step DOWN
+ step UP
+ step LEFT
+ step RIGHT
+ big_step DOWN
+ big_step UP
+ big_step LEFT
+ big_step RIGHT
; 1bb1
SetMenuAttributes:: ; 1bb1
@@ -148,13 +147,12 @@ SetMenuAttributes:: ; 1bb1
dec b
jr nz, .loop
ld a, $1
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
pop bc
pop hl
ret
diff --git a/home/palettes.asm b/home/palettes.asm
index 1d060dbb4..4eec68b5d 100644
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -341,25 +341,11 @@ Special_ReloadSpritesNoPalettes:: ; d91
FarCallSwapTextboxPalettes:: ; db1
- ld a, [hROMBank]
- push af
- ld a, BANK(SwapTextboxPalettes)
- rst Bankswitch
- call SwapTextboxPalettes
- pop af
- rst Bankswitch
+ homecall SwapTextboxPalettes
ret
; dbd
FarCallScrollBGMapPalettes:: ; dbd
- ld a, [hROMBank]
- push af
- ld a, BANK(ScrollBGMapPalettes)
- rst Bankswitch
-
- call ScrollBGMapPalettes
-
- pop af
- rst Bankswitch
+ homecall ScrollBGMapPalettes
ret
; dc9
diff --git a/home/serial.asm b/home/serial.asm
index 97e0c2442..e60704f3d 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -10,7 +10,7 @@ Serial:: ; 6ef
and a
jr nz, .mobile
- ld a, [wc2d4]
+ ld a, [wPrinterConnectionOpen]
bit 0, a
jr nz, .printer
@@ -78,7 +78,7 @@ Serial:: ; 6ef
.player2
ld a, $1
ld [hFFCA], a
- ld a, -2
+ ld a, $fe
ld [hSerialSend], a
.end
@@ -126,92 +126,95 @@ Function75f:: ; 75f
; 78a
Function78a:: ; 78a
+.loop
xor a
ld [hFFCA], a
ld a, [hLinkPlayerNumber]
cp $2
- jr nz, .asm_79b
+ jr nz, .not_player_2
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
-
-.asm_79b
+.not_player_2
+.loop2
ld a, [hFFCA]
and a
- jr nz, .asm_7e5
+ jr nz, .reset_ffca
ld a, [hLinkPlayerNumber]
cp $1
- jr nz, .asm_7c0
- call Function82b
- jr z, .asm_7c0
- call .asm_825
+ jr nz, .not_player_1_or_wLinkTimeoutFrames_zero
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .not_player_1_or_wLinkTimeoutFrames_zero
+ call .delay_15_cycles
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
inc [hl]
- jr nz, .asm_7b7
+ jr nz, .no_rollover_up
dec hl
inc [hl]
-.asm_7b7
+.no_rollover_up
pop hl
- call Function82b
- jr nz, .asm_79b
- jp Function833
+ call CheckwLinkTimeoutFramesNonzero
+ jr nz, .loop2
+ jp SerialDisconnected
-.asm_7c0
+.not_player_1_or_wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [wcf5d]
dec a
ld [wcf5d], a
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [wcf5d + 1]
dec a
ld [wcf5d + 1], a
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [hLinkPlayerNumber]
cp $1
- jr z, .asm_7e5
- ld a, $ff
-.asm_7e2
+ jr z, .reset_ffca
+
+ ld a, 255
+.delay_255_cycles
dec a
- jr nz, .asm_7e2
+ jr nz, .delay_255_cycles
-.asm_7e5
+.reset_ffca
xor a
ld [hFFCA], a
ld a, [rIE]
and $f
sub $8
- jr nz, .asm_7f8
+ jr nz, .rIE_not_equal_8
+
ld [wcf5d], a
ld a, $50
ld [wcf5d + 1], a
-.asm_7f8
+.rIE_not_equal_8
ld a, [hSerialReceive]
cp $fe
ret nz
- call Function82b
- jr z, .asm_813
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .wLinkTimeoutFrames_zero
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
ld a, [hl]
dec a
ld [hld], a
inc a
- jr nz, .asm_80d
+ jr nz, .no_rollover
dec [hl]
-.asm_80d
+.no_rollover
pop hl
- call Function82b
- jr z, Function833
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, SerialDisconnected
-.asm_813
+.wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
@@ -220,29 +223,29 @@ Function78a:: ; 78a
ld a, [hl]
ld [hSerialSend], a
call DelayFrame
- jp Function78a
+ jp .loop
-.asm_825
- ld a, $f
-.asm_827
+.delay_15_cycles
+ ld a, 15
+.delay_cycles
dec a
- jr nz, .asm_827
+ jr nz, .delay_cycles
ret
; 82b
-Function82b:: ; 82b
+CheckwLinkTimeoutFramesNonzero:: ; 82b
push hl
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, [hli]
or [hl]
pop hl
ret
; 833
-Function833:: ; 833
+SerialDisconnected:: ; 833
dec a
- ld [wcf5b], a
- ld [wcf5c], a
+ ld [wLinkTimeoutFrames], a
+ ld [wLinkTimeoutFrames + 1], a
ret
; 83b
@@ -275,7 +278,7 @@ Function83b:: ; 83b
Function862:: ; 862
call LoadTileMapToTempTileMap
callab PlaceWaitingText
- call Function87d
+ call WaitLinkTransfer
jp Call_LoadTempTileMapToTileMap
; 871
@@ -283,29 +286,30 @@ Function862:: ; 862
Function871:: ; 871
call LoadTileMapToTempTileMap
callab PlaceWaitingText
- jp Function87d
+ jp WaitLinkTransfer
; 87d
; One "giant" leap for machinekind
-Function87d:: ; 87d
+WaitLinkTransfer:: ; 87d
ld a, $ff
ld [wOtherPlayerLinkAction], a
.loop
call LinkTransfer
call DelayFrame
- call Function82b
+ call CheckwLinkTimeoutFramesNonzero
jr z, .check
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
dec [hl]
jr nz, .skip
dec hl
dec [hl]
jr nz, .skip
+ ; We might be disconnected
pop hl
xor a
- jp Function833
+ jp SerialDisconnected
.skip
pop hl
@@ -395,6 +399,7 @@ LinkDataReceived:: ; 908
; 919
Function919:: ; 919
+; XXX
ld a, [wLinkMode]
and a
ret nz
diff --git a/home/sine.asm b/home/sine.asm
index e1552db24..810845860 100644
--- a/home/sine.asm
+++ b/home/sine.asm
@@ -8,14 +8,6 @@ Sine:: ; 1b11
ld e, a
- ld a, [hROMBank]
- push af
- ld a, BANK(_Sine)
- rst Bankswitch
-
- call _Sine
-
- pop af
- rst Bankswitch
+ homecall _Sine
ret
; 1b1e
diff --git a/home/string.asm b/home/string.asm
index 70a0f2dd5..492246832 100644
--- a/home/string.asm
+++ b/home/string.asm
@@ -8,8 +8,6 @@ InitName:: ; 2ef9
; Intended for names, so this function is limited to ten characters.
push hl
ld c, 10
-; 2efc
-
_InitString:: ; 2efc
; if the string pointed to by hl is empty (defined as "zero or more spaces
; followed by a null"), then initialize it to the string pointed to by de.
@@ -31,6 +29,7 @@ _InitString:: ; 2efc
inc c
call CopyBytes
ret
+
.notblank
pop bc
pop hl
diff --git a/home/text.asm b/home/text.asm
index 6b4ce4f78..a5ddf43c9 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -129,12 +129,10 @@ TextBoxPalette:: ; 1024
; Fill text box width c height b at hl with pal 7
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
+ inc c
inc c
-endr
ld a, TEXTBOX_PAL
.col
push bc
@@ -184,7 +182,7 @@ BuenaPrintText:: ; 105a
PrintTextBoxText:: ; 1065
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 106c
@@ -527,7 +525,7 @@ Paragraph:: ; 12f2
call LoadBlinkingCursor
.linkbattle
- call Function13b6
+ call Text_WaitBGMap
call ButtonSound
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
@@ -548,7 +546,7 @@ Char4B:: ; 131f
call LoadBlinkingCursor
.communication
- call Function13b6
+ call Text_WaitBGMap
push de
call ButtonSound
@@ -600,7 +598,7 @@ PromptText:: ; 135a
call LoadBlinkingCursor
.ok
- call Function13b6
+ call Text_WaitBGMap
call ButtonSound
ld a, [wLinkMode]
cp LINK_COLOSSEUM
@@ -640,12 +638,10 @@ TextScroll:: ; 138c
dec c
jr nz, .row
-rept 2
inc de
-endr
-rept 2
+ inc de
+ inc hl
inc hl
-endr
pop af
dec a
jr nz, .col
@@ -659,7 +655,7 @@ endr
ret
; 13b6
-Function13b6:: ; 13b6
+Text_WaitBGMap:: ; 13b6
push bc
ld a, [hOAMUpdate]
push af
@@ -712,7 +708,7 @@ PokeFluteTerminatorCharacter:: ; 13e0
; 13e5
-PlaceWholeStringInBoxAtOnce:: ; 13e5
+PlaceHLTextAtBC:: ; 13e5
ld a, [TextBoxFlags]
push af
set 1, a
@@ -738,9 +734,8 @@ DoTextUntilTerminator:: ; 13f6
ld c, a
ld b, 0
ld hl, TextCommands
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
@@ -1014,9 +1009,8 @@ Text_PlaySound:: ; 1500
jr z, .done
cp b
jr z, .play
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.play
@@ -1035,6 +1029,8 @@ endr
; 1522
Function1522:: ; 1522
+; XXX
+; TX_CRY
push de
ld e, [hl]
inc hl
@@ -1113,9 +1109,8 @@ Text_TX_STRINGBUFFER:: ; 156a
ld e, a
ld d, 0
ld hl, StringBufferPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, BANK(StringBufferPointers)
call GetFarHalfword
ld d, h
@@ -1136,9 +1131,8 @@ Text_TX_DAY:: ; 1582
ld c, a
ld b, 0
ld hl, .Days
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/home/time.asm b/home/time.asm
index 008b7a062..338168752 100644
--- a/home/time.asm
+++ b/home/time.asm
@@ -48,17 +48,20 @@ GetClock:: ; 5b7
ld [hl], RTC_S
ld a, [de]
- and $3f
+ maskbits 60
+ and x
ld [hRTCSeconds], a
ld [hl], RTC_M
ld a, [de]
- and $3f
+ maskbits 60
+ and x
ld [hRTCMinutes], a
ld [hl], RTC_H
ld a, [de]
- and $1f
+ maskbits 24
+ and x
ld [hRTCHours], a
ld [hl], RTC_DL
diff --git a/home/vblank.asm b/home/vblank.asm
index b93519298..cb8c5ba56 100644
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -19,9 +19,8 @@ VBlank:: ; 283
ld e, a
ld d, 0
ld hl, .VBlanks
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/home/window.asm b/home/window.asm
index d000b7fdd..ff7d766e2 100644
--- a/home/window.asm
+++ b/home/window.asm
@@ -3,12 +3,12 @@ RefreshScreen:: ; 2dba
call ClearWindowData
ld a, [hROMBank]
push af
- ld a, BANK(Function6454) ; and BANK(Function64bf)
+ ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
- call Function6454
- call Function2e20
- call Function64bf
+ call ReanchorBGMap_NoOAMUpdate
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
+ call LoadFonts_NoOAMUpdate
pop af
rst Bankswitch
@@ -36,10 +36,10 @@ CloseText:: ; 2dcf
xor a
ld [hBGMapMode], a
call OverworldTextModeSwitch
- call Function2e20
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
xor a
ld [hBGMapMode], a
- call Function2e31
+ call SafeUpdateSprites
ld a, $90
ld [hWY], a
call ReplaceKrisSprite
@@ -52,33 +52,33 @@ OpenText:: ; 2e08
call ClearWindowData
ld a, [hROMBank]
push af
- ld a, BANK(Function6454) ; and BANK(Function64bf)
+ ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
- call Function6454 ; clear bgmap
+ call ReanchorBGMap_NoOAMUpdate ; clear bgmap
call SpeechTextBox
- call Function2e20 ; anchor bgmap
- call Function64bf ; load font
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap ; anchor bgmap
+ call LoadFonts_NoOAMUpdate ; load font
pop af
rst Bankswitch
ret
; 2e20
-Function2e20:: ; 2e20
+_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 2e20
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
- callba Function104110
+ callba OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
pop af
ld [hOAMUpdate], a
ret
; 2e31
-Function2e31:: ; 2e31
+SafeUpdateSprites:: ; 2e31
ld a, [hOAMUpdate]
push af
ld a, [hBGMapMode]
@@ -87,7 +87,9 @@ Function2e31:: ; 2e31
ld [hBGMapMode], a
ld a, $1
ld [hOAMUpdate], a
+
call UpdateSprites
+
xor a
ld [hOAMUpdate], a
call DelayFrame
@@ -96,4 +98,8 @@ Function2e31:: ; 2e31
pop af
ld [hOAMUpdate], a
ret
-; 2e4e
+
+; XXX
+ scf
+ ret
+; 2e50
diff --git a/hram.asm b/hram.asm
index dc6c480bf..d036085bc 100644
--- a/hram.asm
+++ b/hram.asm
@@ -1,5 +1,5 @@
HRAM_START EQU $ff80
-hPushOAM EQU $ff80
+hPushOAM EQU $ff80 ; 10 bytes
hROMBankBackup EQU $ff8a
hBuffer EQU $ff8b
@@ -69,6 +69,8 @@ hPrintNum8 EQU $ffba
hPrintNum9 EQU $ffbb
hPrintNum10 EQU $ffbc
+hMGStatusFlags EQU $ffbc
+
hUsedSpriteIndex EQU $ffbd
hUsedSpriteTile EQU $ffbe
hFFBF EQU $ffbf
@@ -77,9 +79,12 @@ hFFC1 EQU $ffc1
hFFC2 EQU $ffc2
hMoneyTemp EQU $ffc3
-hFFC6 EQU $ffc6
-hFFC7 EQU $ffc7
-hFFC8 EQU $ffc8
+hMGJoypadPressed EQU $ffc3
+hMGJoypadReleased EQU $ffc4
+
+hLCDCPointer EQU $ffc6
+hLYOverrideStart EQU $ffc7
+hLYOverrideEnd EQU $ffc8
hMobileReceive EQU $ffc9
hFFCA EQU $ffca
hLinkPlayerNumber EQU $ffcb
diff --git a/items/item_descriptions.asm b/items/item_descriptions.asm
index 7ff574d11..40e91b2c9 100644
--- a/items/item_descriptions.asm
+++ b/items/item_descriptions.asm
@@ -21,9 +21,8 @@ PrintItemDescription: ; 0x1c8955
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
diff --git a/items/item_effects.asm b/items/item_effects.asm
index ef05de8fd..7061909f6 100644
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -253,9 +253,8 @@ ParkBall: ; e8a2
jr z, .skip_or_return_from_ball_fn
cp c
jr z, .call_ball_function
-rept 2
inc hl
-endr
+ inc hl
jr .get_multiplier_loop
.call_ball_function
@@ -288,9 +287,8 @@ endr
ld h, d
ld l, e
-rept 2
add hl, de
-endr
+ add hl, de
ld d, h
ld e, l
ld a, d
@@ -514,7 +512,7 @@ endr
cp BATTLETYPE_TUTORIAL
jp z, .FinishTutorial
- callba MobileFn_10607f
+ callba TrainerRankings_WildMonsCaught
ld hl, Text_GotchaMonWasCaught
call PrintText
@@ -805,9 +803,8 @@ HeavyBallMultiplier:
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, BANK(PokedexDataPointerTable)
call GetFarHalfword
@@ -820,9 +817,8 @@ endr
call GetPokedexEntryBank
push bc
-rept 2
inc hl
-endr
+ inc hl
call GetFarHalfword
srl h
@@ -868,9 +864,8 @@ endr
ld a, c
cp [hl]
jr c, .heavymon
-rept 2
inc hl
-endr
+ inc hl
jr .lookup
.heavymon
@@ -929,9 +924,8 @@ GLOBAL EvosAttacksPointers
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
pop bc
@@ -943,9 +937,9 @@ endr
pop bc
ret nz
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
; Moon Stone's constant from Pokémon Red is used.
; No Pokémon evolve with Burn Heal,
@@ -2127,9 +2121,8 @@ GetHealingItemAmount: ; f395 (3:7395)
jr z, .NotFound
cp d
jr z, .done
-rept 2
inc hl
-endr
+ inc hl
jr .next
.NotFound:
@@ -2335,9 +2328,8 @@ XSpecial: ; f4c5
.loop
cp [hl]
jr z, .got_it
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.got_it
@@ -2488,20 +2480,20 @@ CoinCase: ; f59a
OldRod: ; f5a5
ld e, $0
- jr Function_0xf5b1
+ jr UseRod
; f5a9
GoodRod: ; f5a9
ld e, $1
- jr Function_0xf5b1
+ jr UseRod
; f5ad
SuperRod: ; f5ad
ld e, $2
- jr Function_0xf5b1
+ jr UseRod
; f5b1
-Function_0xf5b1: ; f5b1
+UseRod: ; f5b1
callba FishFunction
ret
; f5b8
@@ -2523,7 +2515,7 @@ Mysteryberry: ; f5bf
ld [wd002], a
.loop
- ; Party Screen opens to choose on which Pkmn to use the Item
+ ; Party Screen opens to choose on which Pkmn to use the Item
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
jp c, PPRestoreItem_Cancel
@@ -2937,7 +2929,7 @@ Play_SFX_FULL_HEAL: ; f780
ret
; f789
-UseItemText ; f789
+UseItemText: ; f789
ld hl, UsedItemText
call PrintText
call Play_SFX_FULL_HEAL
@@ -3250,11 +3242,11 @@ GetMaxPPOfMove: ; f8ec
ld hl, TempMonMoves ; Wasted cycles
dec a
- jr z, .got_nonpartymon ; BREEDMON
+ jr z, .got_nonpartymon ; TEMPMON
ld hl, BattleMonMoves ; WILDMON
-.got_nonpartymon ; BOXMON, BREEDMON, WILDMON
+.got_nonpartymon ; BOXMON, TEMPMON, WILDMON
call GetMthMoveOfCurrentMon
jr .gotdatmove
diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm
index de1dc854b..0261bc564 100644
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -75,7 +75,7 @@ Function110029: ; 110029 (44:4029)
Function110030:: ; 110030 (44:4030)
; Use the byte at $c988 as a parameter
; for a dw.
-; If [$c988] in {12, 14, 16},
+; If [$c988] not in {12, 14, 16},
; clear [$c835].
push de
ld a, [$c988]
@@ -89,24 +89,29 @@ Function110030:: ; 110030 (44:4030)
ld [$c835], a
ld a, [$c988]
.noreset
- ld d, $0
+ ; Get the pointer
+ ld d, 0
ld e, a
ld hl, .dw
add hl, de
+ ; Store the low byte in [$c988]
ld a, [hli]
ld [$c988], a
ld a, [hl]
+ ; restore de
pop de
- ld hl, Function3e60
+ ld hl, Function3e60 ; return here
push hl
+ ; If the destination function is not Function110236,
+ ; call Function1100b4.
ld h, a
ld a, [$c988]
ld l, a
push hl
- ld a, $36
+ ld a, Function110236 % $100
cp l
jr nz, .okay
- ld a, $42
+ ld a, Function110236 / $100
cp h
.okay
call nz, Function1100b4
@@ -681,9 +686,8 @@ Function1103ac: ; 1103ac
ld hl, Unknown_112037
ld de, $cb74
call Function110000
-rept 2
inc de
-endr
+ inc de
pop hl
ld bc, 0
call Function110007
@@ -741,9 +745,9 @@ Function110438: ; 110438
ld a, $c8
ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld a, $ff
ld [$c86e], a
@@ -964,9 +968,9 @@ Function1105dd: ; 1105dd
ld a, $c8
ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld a, $ff
ld [$c86e], a
@@ -1127,9 +1131,8 @@ Function1106ef: ; 1106ef
ld hl, Unknown_112072
ld b, $5
call Function110000
-rept 2
inc de
-endr
+ inc de
ld bc, $0001
ld hl, Unknown_11209e
call Function110007
@@ -1395,9 +1398,8 @@ Function110905: ; 110905
ld hl, Unknown_112072
ld b, $5
call Function110000
-rept 2
inc de
-endr
+ inc de
ld hl, Unknown_1120c8
call Function110007
pop hl
@@ -1561,12 +1563,10 @@ Function110a5b: ; 110a5b
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
-rept 2
+ inc de
+ dec bc
dec bc
-endr
ld hl, $c98f
ld a, e
ld [hli], a
@@ -1586,9 +1586,8 @@ endr
xor a
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
ld [$c86b], a
ld de, $cb47
@@ -1628,9 +1627,8 @@ Function110af4: ; 110af4
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
+ inc de
ld a, e
ld [hli], a
ld a, d
@@ -1641,9 +1639,8 @@ endr
ld [$c86e], a
ld [$c86f], a
jr z, .asm_110b5c
-rept 2
dec bc
-endr
+ dec bc
ld a, [$c993]
or a
jp nz, .asm_110bd5
@@ -1909,12 +1906,10 @@ Function110c9e: ; 110c9e
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
-rept 2
+ inc de
+ dec bc
dec bc
-endr
ld hl, $c98f
ld a, e
ld [hli], a
@@ -1934,9 +1929,8 @@ endr
xor a
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
ld [$c86b], a
ld de, $cb47
@@ -2151,16 +2145,14 @@ Function110ddd: ; 110ddd
ld [$c833], a
ld a, [hli]
ld [$c834], a
-rept 2
inc hl
-endr
+ inc hl
ld a, l
ld [$c97f], a
ld a, h
ld [$c980], a
-rept 2
dec hl
-endr
+ dec hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2282,9 +2274,9 @@ endr
.asm_110ee3
ld hl, $c98b
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
pop bc
pop de
@@ -2302,9 +2294,8 @@ endr
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc hl
-endr
+ inc hl
xor a
ld [$c994], a
@@ -2350,9 +2341,8 @@ Function110f07: ; 110f07
ld hl, $c866
ld b, $4
call Function110000
-rept 2
inc de
-endr
+ inc de
ld b, $6
call Function111f63
ld a, [$cabc]
@@ -2424,9 +2414,8 @@ Function111044: ; 111044
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
+ inc de
ld a, e
ld [hli], a
ld a, d
@@ -2436,9 +2425,8 @@ endr
or c
ld [$c86e], a
ld [$c86f], a
-rept 2
dec bc
-endr
+ dec bc
jp z, Function1111ca
ld a, [$c991]
or a
@@ -2741,16 +2729,14 @@ endr
ld [$c833], a
ld a, [hli]
ld [$c834], a
-rept 2
inc hl
-endr
+ inc hl
ld a, l
ld [$c97f], a
ld a, h
ld [$c980], a
-rept 2
dec hl
-endr
+ dec hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2828,9 +2814,8 @@ endr
ld a, [hld]
cp $2f
jr nz, .asm_1112a4
-rept 2
inc hl
-endr
+ inc hl
ld a, [hl]
cp $30
jr c, .asm_1112cc
@@ -2884,9 +2869,8 @@ endr
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc hl
-endr
+ inc hl
ld a, e
ld [hli], a
ld a, d
@@ -2904,9 +2888,8 @@ endr
ld [$c9ac], a
ld a, [hli]
ld [$c9ad], a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld [$c876], a
ld a, [hl]
@@ -2922,9 +2905,8 @@ Function111335: ; 111335
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -3099,9 +3081,9 @@ Function1113fe: ; 1113fe
push hl
ld hl, $c829
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld de, $cb47
ld hl, Unknown_112072
@@ -3114,9 +3096,8 @@ endr
cp $81
jr nc, .asm_111485
ld c, a
-rept 2
inc a
-endr
+ inc a
ld [de], a
inc de
ld a, $ff
@@ -3128,9 +3109,8 @@ endr
ld b, c
call Function110000
ld b, c
-rept 2
inc b
-endr
+ inc b
call Function111f63
ld hl, $c822
set 7, [hl]
@@ -3457,9 +3437,8 @@ Function11164f: ; 11164f (44:564f)
ld a, b
srl a
srl a
-rept 2
add b
-endr
+ add b
ld [hl], a
ret
@@ -3599,9 +3578,9 @@ _MobileReceive:: ; 1116c5 (44:56c5)
ld [$c800], a
xor a
ld hl, $c80a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld hl, $c81f
ld a, [hli]
ld b, a
@@ -4126,9 +4105,8 @@ Function111abd: ; 111abd (44:5abd)
ld [$c800], a
xor a
ld hl, $c80a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld hl, $c815
ld a, [$c820]
@@ -4331,9 +4309,8 @@ Function111c17: ; 111c17 (44:5c17)
.asm_111c52
ld b, a
ld a, [$ca3f]
-rept 2
dec a
-endr
+ dec a
cp b
jr c, .asm_111c6e
.asm_111c5b
@@ -5604,9 +5581,8 @@ Function112451: ; 112451
xor a
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
pop de
ld a, $1
ld [$c994], a
@@ -5731,24 +5707,21 @@ Function1125c7: ; 1125c7
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
+ inc de
ld a, $80
ld [hli], a
ld a, $c8
ld [hli], a
-rept 2
dec bc
-endr
+ dec bc
ld a, $fa
ld [hli], a
ld a, $0
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld de, $cb47
ld hl, Unknown_112072
ld b, $6
@@ -6236,9 +6209,8 @@ Function1128db: ; 1128db
ld de, $cb4c
ld a, $1
ld [de], a
-rept 2
inc de
-endr
+ inc de
ld b, $1
call Function111f63
jr .asm_112941
@@ -6471,9 +6443,8 @@ Function112a56: ; 112a56
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, e
ld [hli], a
ld a, d
@@ -6970,9 +6941,8 @@ Function112d33: ; 112d33
ld hl, $c821
res 2, [hl]
ld hl, $c86b
-rept 2
dec [hl]
-endr
+ dec [hl]
.asm_112d82
ld hl, $c86b
@@ -7131,9 +7101,8 @@ endr
cp $1
ld a, $32
jr z, .asm_112e95
-rept 2
inc de
-endr
+ inc de
inc a
.asm_112e95
@@ -7512,9 +7481,8 @@ Function113095: ; 113095
.asm_1130d6
ld a, [$c82b]
ld c, a
-rept 2
dec b
-endr
+ dec b
ld a, b
ld [$c82d], a
jr z, .asm_11310d
@@ -7522,9 +7490,8 @@ endr
ld d, a
ld a, [$c872]
ld e, a
-rept 2
dec de
-endr
+ dec de
xor a
or d
jr nz, .asm_1130f5
@@ -7543,9 +7510,8 @@ endr
ld e, a
ld a, [$c875]
ld d, a
-rept 2
inc de
-endr
+ inc de
call Function110000
.asm_11310d
@@ -7658,9 +7624,8 @@ Function113197: ; 113197
ld a, b
ld [de], a
inc de
-rept 2
dec b
-endr
+ dec b
call Function110000
xor a
ld [de], a
@@ -7682,9 +7647,8 @@ Function1131a9: ; 1131a9
inc b
cp $a
jr nz, .asm_1131b7
-rept 2
inc hl
-endr
+ inc hl
dec b
ld c, b
call Function110000
@@ -7728,9 +7692,8 @@ endr
ld hl, $c821
res 2, [hl]
ld hl, $c86b
-rept 2
dec [hl]
-endr
+ dec [hl]
ld a, $4
ret
; 113206
@@ -7753,9 +7716,8 @@ Function113206: ; 113206
ld e, a
ld a, [$c875]
ld d, a
-rept 2
inc de
-endr
+ inc de
call Function110000
ld a, [$c991]
ld [$c993], a
@@ -8026,9 +7988,8 @@ Function1133fe: ; 1133fe
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -8039,9 +8000,8 @@ endr
ld a, [hld]
cp $2f
jr nz, .asm_11344c
-rept 2
inc hl
-endr
+ inc hl
ld e, l
ld d, h
.asm_113455
@@ -8059,9 +8019,8 @@ endr
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -8158,9 +8117,8 @@ Function1134cb: ; 1134cb
ret
.asm_1134f0
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .asm_1134fc
.asm_1134f4
@@ -9185,9 +9143,9 @@ Function113c8e: ; 113c8e
ld bc, $0003
.asm_113ccf
-rept 3
dec bc
-endr
+ dec bc
+ dec bc
ld a, c
ld [$cc10], a
ld a, b
@@ -9223,9 +9181,8 @@ endr
ld a, $3f
and c
ld [hld], a
-rept 2
dec hl
-endr
+ dec hl
pop de
ld b, h
ld c, l
@@ -9572,9 +9529,8 @@ Function113ec7: ; 113ec7
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
dec hl
xor $80
@@ -9615,9 +9571,8 @@ Function113ef2: ; 113ef2
ld l, a
ld e, l
ld d, h
-rept 2
add hl, de
-endr
+ add hl, de
ld e, l
ld d, h
ld hl, $c815
@@ -9677,9 +9632,8 @@ Function113f2d: ; 113f2d
ld l, a
ld e, l
ld d, h
-rept 2
add hl, de
-endr
+ add hl, de
ld e, l
ld d, h
ld hl, $c815
diff --git a/macros.asm b/macros.asm
index 6656ca038..c4fd73b3e 100644
--- a/macros.asm
+++ b/macros.asm
@@ -140,7 +140,14 @@ lda_coord: MACRO
; pic animations
frame: MACRO
db \1
- db \2
+x = \2
+IF _NARG > 2
+rept _NARG +- 2
+x = x | (1 << (\3 + 1))
+ shift
+endr
+endc
+ db x
ENDM
setrepeat: MACRO
db $fe
@@ -155,6 +162,12 @@ endanim: MACRO
ENDM
+delanim: MACRO
+ db $fc
+ ENDM
+dorestart: MACRO
+ db $fe
+ ENDM
sine_wave: MACRO
; \1: amplitude
@@ -244,9 +257,9 @@ debgcoord EQUS "bgcoord de,"
bcbgcoord EQUS "bgcoord bc,"
bgrows EQUS "* $20"
-palred EQUS "$0400 *"
+palred EQUS "$0001 *"
palgreen EQUS "$0020 *"
-palblue EQUS "$0001 *"
+palblue EQUS "$0400 *"
dsprite: MACRO
; conditional segment is there because not every instance of
@@ -270,3 +283,34 @@ jumptable: MACRO
ld l, a
jp [hl]
endm
+
+maskbits: macro
+; returns to x
+; usage in rejection sampling
+; .loop
+; call Random
+; maskbits 30
+; and x
+; cp 30
+; jr nc, .loop
+
+x = 1
+rept 8
+IF \1 > x
+x = (x + 1) * 2 +- 1
+ENDC
+endr
+endm
+
+homecall: MACRO
+ ld a, [hROMBank]
+ push af
+ ld a, BANK(\1)
+ rst Bankswitch
+
+ call \1
+
+ pop af
+ rst Bankswitch
+ENDM
+
diff --git a/macros/move_anim.asm b/macros/move_anim.asm
index 05faf253d..c795f561e 100644
--- a/macros/move_anim.asm
+++ b/macros/move_anim.asm
@@ -183,9 +183,9 @@ anim_0xed: macro
db anim_0xed_command
endm
- enum anim_jumpand_command ; ee
-anim_jumpand: macro
- db anim_jumpand_command
+ enum anim_if_param_and_command ; ee
+anim_if_param_and: macro
+ db anim_if_param_and_command
db \1 ; value
dw \2 ; address
endm
@@ -243,9 +243,9 @@ anim_0xf7: macro
db anim_0xf7_command
endm
- enum anim_jumpif_command ; f8
-anim_jumpif: macro
- db anim_jumpif_command
+ enum anim_if_param_equal_command ; f8
+anim_if_param_equal: macro
+ db anim_if_param_equal_command
db \1 ; value
dw \2 ; address
endm
@@ -261,9 +261,9 @@ anim_incvar: macro
db anim_incvar_command
endm
- enum anim_jumpvar_command ; fb
-anim_jumpvar: macro
- db anim_jumpvar_command
+ enum anim_if_var_equal_command ; fb
+anim_if_var_equal: macro
+ db anim_if_var_equal_command
db \1 ; value
dw \2 ; address
endm
diff --git a/macros/movement.asm b/macros/movement.asm
index b5aebdc89..53b8bf107 100644
--- a/macros/movement.asm
+++ b/macros/movement.asm
@@ -1,286 +1,106 @@
-
enum_start
- enum movement_turn_head_down
-turn_head_down: macro
- db movement_turn_head_down ; $00
- endm
-
- enum movement_turn_head_up
-turn_head_up: macro
- db movement_turn_head_up ; $01
- endm
-
- enum movement_turn_head_left
-turn_head_left: macro
- db movement_turn_head_left ; $02
- endm
-
- enum movement_turn_head_right
-turn_head_right: macro
- db movement_turn_head_right ; $03
- endm
-
- enum movement_turn_step_down
-turn_step_down: macro
- db movement_turn_step_down ; $04
- endm
-
- enum movement_turn_step_up
-turn_step_up: macro
- db movement_turn_step_up ; $05
- endm
-
- enum movement_turn_step_left
-turn_step_left: macro
- db movement_turn_step_left ; $06
- endm
-
- enum movement_turn_step_right
-turn_step_right: macro
- db movement_turn_step_right ; $07
- endm
-
- enum movement_slow_step_down
-slow_step_down: macro
- db movement_slow_step_down ; $08
- endm
-
- enum movement_slow_step_up
-slow_step_up: macro
- db movement_slow_step_up ; $09
- endm
-
- enum movement_slow_step_left
-slow_step_left: macro
- db movement_slow_step_left ; $0a
- endm
-
- enum movement_slow_step_right
-slow_step_right: macro
- db movement_slow_step_right ; $0b
- endm
-
- enum movement_step_down
-step_down: macro
- db movement_step_down ; $0c
- endm
-
- enum movement_step_up
-step_up: macro
- db movement_step_up ; $0d
- endm
-
- enum movement_step_left
-step_left: macro
- db movement_step_left ; $0e
- endm
-
- enum movement_step_right
-step_right: macro
- db movement_step_right ; $0f
- endm
-
- enum movement_big_step_down
-big_step_down: macro
- db movement_big_step_down ; $10
- endm
-
- enum movement_big_step_up
-big_step_up: macro
- db movement_big_step_up ; $11
- endm
-
- enum movement_big_step_left
-big_step_left: macro
- db movement_big_step_left ; $12
- endm
-
- enum movement_big_step_right
-big_step_right: macro
- db movement_big_step_right ; $13
- endm
-
- enum movement_slow_slide_step_down
-slow_slide_step_down: macro
- db movement_slow_slide_step_down ; $14
- endm
-
- enum movement_slow_slide_step_up
-slow_slide_step_up: macro
- db movement_slow_slide_step_up ; $15
- endm
-
- enum movement_slow_slide_step_left
-slow_slide_step_left: macro
- db movement_slow_slide_step_left ; $16
- endm
+; Directional movements
- enum movement_slow_slide_step_right
-slow_slide_step_right: macro
- db movement_slow_slide_step_right ; $17
+ enum movement_turn_head
+turn_head: macro
+ db movement_turn_head | \1 ; $00
endm
- enum movement_slide_step_down
-slide_step_down: macro
- db movement_slide_step_down ; $18
- endm
+__enum__ = __enum__ + 3
- enum movement_slide_step_up
-slide_step_up: macro
- db movement_slide_step_up ; $19
+ enum movement_turn_step
+turn_step: macro
+ db movement_turn_step | \1 ; $04
endm
- enum movement_slide_step_left
-slide_step_left: macro
- db movement_slide_step_left ; $1a
- endm
+__enum__ = __enum__ + 3
- enum movement_slide_step_right
-slide_step_right: macro
- db movement_slide_step_right ; $1b
+ enum movement_slow_step
+slow_step: macro
+ db movement_slow_step | \1; $08
endm
- enum movement_fast_slide_step_down
-fast_slide_step_down: macro
- db movement_fast_slide_step_down ; $1c
- endm
+__enum__ = __enum__ + 3
- enum movement_fast_slide_step_up
-fast_slide_step_up: macro
- db movement_fast_slide_step_up ; $1d
+ enum movement_step
+step: macro
+ db movement_step | \1 ; $0c
endm
- enum movement_fast_slide_step_left
-fast_slide_step_left: macro
- db movement_fast_slide_step_left ; $1e
- endm
+__enum__ = __enum__ + 3
- enum movement_fast_slide_step_right
-fast_slide_step_right: macro
- db movement_fast_slide_step_right ; $1f
+ enum movement_big_step
+big_step: macro
+ db movement_big_step | \1 ; $10
endm
- enum movement_turn_away_down
-turn_away_down: macro
- db movement_turn_away_down ; $20
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_away_up
-turn_away_up: macro
- db movement_turn_away_up ; $21
+ enum movement_slow_slide_step
+slow_slide_step: macro
+ db movement_slow_slide_step | \1 ; $14
endm
- enum movement_turn_away_left
-turn_away_left: macro
- db movement_turn_away_left ; $22
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_away_right
-turn_away_right: macro
- db movement_turn_away_right ; $23
+ enum movement_slide_step
+slide_step: macro
+ db movement_slide_step | \1 ; $18
endm
- enum movement_turn_in_down
-turn_in_down: macro
- db movement_turn_in_down ; $24
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_in_up
-turn_in_up: macro
- db movement_turn_in_up ; $25
+ enum movement_fast_slide_step
+fast_slide_step: macro
+ db movement_fast_slide_step | \1 ; $1c
endm
- enum movement_turn_in_left
-turn_in_left: macro
- db movement_turn_in_left ; $26
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_in_right
-turn_in_right: macro
- db movement_turn_in_right ; $27
+ enum movement_turn_away
+turn_away: macro
+ db movement_turn_away | \1 ; $20
endm
- enum movement_turn_waterfall_down
-turn_waterfall_down: macro
- db movement_turn_waterfall_down ; $28
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_waterfall_up
-turn_waterfall_up: macro
- db movement_turn_waterfall_up ; $29
+ enum movement_turn_in
+turn_in: macro
+ db movement_turn_in | \1 ; $24
endm
- enum movement_turn_waterfall_left
-turn_waterfall_left: macro
- db movement_turn_waterfall_left ; $2a
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_waterfall_right
-turn_waterfall_right: macro
- db movement_turn_waterfall_right ; $2b
+ enum movement_turn_waterfall
+turn_waterfall: macro
+ db movement_turn_waterfall | \1 ; $28
endm
- enum movement_slow_jump_step_down
-slow_jump_step_down: macro
- db movement_slow_jump_step_down ; $2c
- endm
+__enum__ = __enum__ + 3
- enum movement_slow_jump_step_up
-slow_jump_step_up: macro
- db movement_slow_jump_step_up ; $2d
+ enum movement_slow_jump_step
+slow_jump_step: macro
+ db movement_slow_jump_step | \1 ; $2c
endm
- enum movement_slow_jump_step_left
-slow_jump_step_left: macro
- db movement_slow_jump_step_left ; $2e
- endm
-
- enum movement_slow_jump_step_right
-slow_jump_step_right: macro
- db movement_slow_jump_step_right ; $2f
- endm
+__enum__ = __enum__ + 3
- enum movement_jump_step_down
-jump_step_down: macro
- db movement_jump_step_down ; $30
+ enum movement_jump_step
+jump_step: macro
+ db movement_jump_step | \1 ; $30
endm
- enum movement_jump_step_up
-jump_step_up: macro
- db movement_jump_step_up ; $31
- endm
-
- enum movement_jump_step_left
-jump_step_left: macro
- db movement_jump_step_left ; $32
- endm
+__enum__ = __enum__ + 3
- enum movement_jump_step_right
-jump_step_right: macro
- db movement_jump_step_right ; $33
+ enum movement_fast_jump_step
+fast_jump_step: macro
+ db movement_fast_jump_step | \1 ; $34
endm
- enum movement_fast_jump_step_down
-fast_jump_step_down: macro
- db movement_fast_jump_step_down ; $34
- endm
-
- enum movement_fast_jump_step_up
-fast_jump_step_up: macro
- db movement_fast_jump_step_up ; $35
- endm
-
- enum movement_fast_jump_step_left
-fast_jump_step_left: macro
- db movement_fast_jump_step_left ; $36
- endm
-
- enum movement_fast_jump_step_right
-fast_jump_step_right: macro
- db movement_fast_jump_step_right ; $37
- endm
+__enum__ = __enum__ + 3
+; Control
enum movement_remove_sliding
remove_sliding: macro
db movement_remove_sliding ; $38
@@ -311,51 +131,18 @@ hide_person: macro
db movement_hide_person ; $3d
endm
- enum movement_step_sleep_1
-step_sleep_1: macro
- db movement_step_sleep_1 ; $3e
- endm
-
- enum movement_step_sleep_2
-step_sleep_2: macro
- db movement_step_sleep_2 ; $3f
- endm
-
- enum movement_step_sleep_3
-step_sleep_3: macro
- db movement_step_sleep_3 ; $40
- endm
-
- enum movement_step_sleep_4
-step_sleep_4: macro
- db movement_step_sleep_4 ; $41
- endm
-
- enum movement_step_sleep_5
-step_sleep_5: macro
- db movement_step_sleep_5 ; $42
- endm
-
- enum movement_step_sleep_6
-step_sleep_6: macro
- db movement_step_sleep_6 ; $43
- endm
-
- enum movement_step_sleep_7
-step_sleep_7: macro
- db movement_step_sleep_7 ; $44
- endm
-
- enum movement_step_sleep_8
-step_sleep_8: macro
- db movement_step_sleep_8 ; $45
- endm
+; Sleep
enum movement_step_sleep
step_sleep: macro
- db movement_step_sleep ; $46
- db \1 ; duration
- endm
+if \1 <= 8
+ db movement_step_sleep + \1 - 1
+else
+ db movement_step_sleep + 8, \1
+endc
+endm
+
+__enum__ = __enum__ + 8
enum movement_step_end
step_end: macro
@@ -363,8 +150,11 @@ step_end: macro
endm
; Whatever Movement_48 is, it takes a one-byte parameter
-
-__enum__ = $49
+ enum movement_step_48
+step_48: macro
+ db movement_step_48
+ db \1
+ endm
enum movement_remove_person
remove_person: macro
diff --git a/macros/sound.asm b/macros/sound.asm
index 64fe309cb..ad6a50749 100644
--- a/macros/sound.asm
+++ b/macros/sound.asm
@@ -37,10 +37,10 @@ notetype: macro
endc
endm
- enum forceoctave_cmd
-forceoctave: macro
- db forceoctave_cmd
- db \1 ; octave
+ enum pitchoffset_cmd
+pitchoffset: macro
+ db pitchoffset_cmd
+ dn \1, \2 - 1 ; octave, key
endm
enum tempo_cmd
@@ -67,10 +67,10 @@ soundinput: macro
db \1 ; input
endm
- enum unknownmusic0xde_cmd
-unknownmusic0xde: macro
- db unknownmusic0xde_cmd
- db \1 ; unknown
+ enum sound_duty_cmd
+sound_duty: macro
+ db sound_duty_cmd
+ db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6) ; duty sequence
endm
enum togglesfx_cmd
@@ -78,11 +78,10 @@ togglesfx: macro
db togglesfx_cmd
endm
- enum unknownmusic0xe0_cmd
-unknownmusic0xe0: macro
- db unknownmusic0xe0_cmd
- db \1 ; unknown
- ; db \2 ; unknown
+ enum slidepitchto_cmd
+slidepitchto: macro
+ db slidepitchto_cmd
+ db \1 - 1 ; duration
dn \2, \3 ; octave, pitch
endm
diff --git a/macros/trade_anim.asm b/macros/trade_anim.asm
index 04d3b7d0e..c590cb620 100755
--- a/macros/trade_anim.asm
+++ b/macros/trade_anim.asm
@@ -75,14 +75,14 @@ tradeanim_do_givemon_scroll: macro
db tradeanim_do_givemon_scroll_command ; 1c
endm
- enum tradeanim_1d_command
-tradeanim_1d: macro
- db tradeanim_1d_command ; 1d
+ enum tradeanim_frontpic_scroll_command
+tradeanim_frontpic_scroll: macro
+ db tradeanim_frontpic_scroll_command ; 1d
endm
- enum tradeanim_1e_command
-tradeanim_1e: macro
- db tradeanim_1e_command ; 1e
+ enum tradeanim_textbox_scroll_command
+tradeanim_textbox_scroll: macro
+ db tradeanim_textbox_scroll_command ; 1e
endm
enum tradeanim_scroll_out_right_command
diff --git a/macros/wram.asm b/macros/wram.asm
index 1b296bb04..ce53dc5c7 100755
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -134,22 +134,21 @@ channel_struct: MACRO
\1FrequencyHi:: db
\1Pitch:: db ; 0:rest 1-c:note
\1Octave:: db ; 7-0 (0 is highest)
-\1StartingOctave:: db ; raises existing octaves (to repeat phrases)
+\1PitchOffset:: db ; raises existing octaves (to repeat phrases)
\1NoteDuration:: db ; frames remaining for the current note
\1Field0x16:: ds 1 ; c117
ds 1 ; c118
\1LoopCount:: db
\1Tempo:: dw
\1Tracks:: db ; hi:left lo:right
-\1Field0x1c:: ds 1 ; c11d
+\1SFXDutyLoop:: ds 1 ; c11d
\1VibratoDelayCount:: db ; initialized by \1VibratoDelay
\1VibratoDelay:: db ; number of frames a note plays until vibrato starts
\1VibratoExtent:: db
\1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt
-\1Field0x21:: ds 1 ; c122
-\1Field0x22:: ds 1 ; c123
-\1Field0x23:: ds 1 ; c124
-\1Field0x24:: ds 1 ; c125
+\1PitchWheelTarget:: dw ; frequency endpoint for pitch wheel
+\1PitchWheelAmount:: db ; c124
+\1PitchWheelAmountFraction:: db ; c125
\1Field0x25:: ds 1 ; c126
ds 1 ; c127
\1CryPitch:: dw
@@ -199,6 +198,21 @@ hof_mon: MACRO
\1End::
endm
+roam_struct: MACRO
+\1Species:: db
+\1Level:: db
+\1MapGroup:: db
+\1MapNumber:: db
+\1HP:: ds 1
+\1DVs:: ds 2
+ENDM
+
+bugcontestwinner: macro
+\1PersonID:: ds 1
+\1Mon:: ds 1
+\1Score:: ds 2
+endm
+
hall_of_fame: MACRO
\1::
\1WinCount:: ds 1
@@ -248,4 +262,113 @@ slot_reel: MACRO
\1Slot0d:: ds 1
\1Slot0e:: ds 1
\1Slot0f:: ds 1
-endm \ No newline at end of file
+endm
+
+object_struct: MACRO
+\1Struct::
+\1Sprite:: ds 1
+\1MapObjectIndex:: ds 1
+\1SpriteTile:: ds 1
+\1MovementType:: ds 1
+\1Flags:: ds 2
+\1Palette:: ds 1
+\1Walking:: ds 1
+\1Direction:: ds 1
+\1StepType:: ds 1
+\1StepDuration:: ds 1
+\1Action:: ds 1
+\1ObjectStepFrame:: ds 1
+\1Facing:: ds 1
+\1StandingTile:: ds 1 ; collision
+\1LastTile:: ds 1 ; collision
+\1StandingMapX:: ds 1
+\1StandingMapY:: ds 1
+\1LastMapX:: ds 1
+\1LastMapY:: ds 1
+\1ObjectInitX:: ds 1
+\1ObjectInitY:: ds 1
+\1Radius:: ds 1
+\1SpriteX:: ds 1
+\1SpriteY:: ds 1
+\1SpriteXOffset:: ds 1
+\1SpriteYOffset:: ds 1
+\1MovementByteIndex:: ds 1
+\1Object28:: ds 1
+\1Object29:: ds 1
+\1Object30:: ds 1
+\1Object31:: ds 1
+\1Range:: ds 1
+ ds 7
+\1StructEnd::
+ENDM
+
+map_object: MACRO
+\1Object::
+\1ObjectStructID:: ds 1
+\1ObjectSprite:: ds 1
+\1ObjectYCoord:: ds 1
+\1ObjectXCoord:: ds 1
+\1ObjectMovement:: ds 1
+\1ObjectRadius:: ds 1
+\1ObjectHour:: ds 1
+\1ObjectTimeOfDay:: ds 1
+\1ObjectColor:: ds 1
+\1ObjectRange:: ds 1
+\1ObjectScript:: ds 2
+\1ObjectEventFlag:: ds 2
+ ds 2
+endm
+
+sprite_anim_struct: MACRO
+\1Index:: ds 1 ; 0
+\1FramesetID:: ds 1 ; 1
+\1AnimSeqID:: ds 1 ; 2
+\1TileID:: ds 1 ; 3
+\1XCoord:: ds 1 ; 4
+\1YCoord:: ds 1 ; 5
+\1XOffset:: ds 1 ; 6
+\1YOffset:: ds 1 ; 7
+\1Duration:: ds 1 ; 8
+\1DurationOffset:: ds 1 ; 9
+\1FrameIndex:: ds 1 ; a
+\1Sprite0b:: ds 1
+\1Sprite0c:: ds 1
+\1Sprite0d:: ds 1
+\1Sprite0e:: ds 1
+\1Sprite0f:: ds 1
+ENDM
+
+battle_anim_struct: MACRO
+; Placeholder until we can figure out what it all means
+\1_Index:: ds 1
+\1_Anim01:: ds 1
+\1_Anim02:: ds 1
+\1_FramesetIndex:: ds 1
+\1_FunctionIndex:: ds 1
+\1_Anim05:: ds 1
+\1_TileID:: ds 1
+\1_XCoord:: ds 1
+\1_YCoord:: ds 1
+\1_XOffset:: ds 1
+\1_YOffset:: ds 1
+\1_Anim0b:: ds 1
+\1_Anim0c:: ds 1
+\1_Anim0d:: ds 1
+\1_AnonJumptableIndex:: ds 1
+\1_Anim0f:: ds 1
+\1_Anim10:: ds 1
+\1_Anim11:: ds 1
+\1_Anim12:: ds 1
+\1_Anim13:: ds 1
+\1_Anim14:: ds 1
+\1_Anim15:: ds 1
+\1_Anim16:: ds 1
+\1_Anim17:: ds 1
+endm
+
+battle_bg_effect: MACRO
+\1_Function:: ds 1
+\1_01:: ds 1
+\1_02:: ds 1
+\1_03:: ds 1
+endm
diff --git a/main.asm b/main.asm
index 304a29b3e..385f865d7 100644
--- a/main.asm
+++ b/main.asm
@@ -42,7 +42,7 @@ LoadPushOAM:: ; 4031
PushOAM: ; 403f
ld a, Sprites / $100
ld [rDMA], a
- ld a, 40
+ ld a, (SpritesEnd - Sprites) / 4 ; 40
.loop
dec a
jr nz, .loop
@@ -53,7 +53,7 @@ INCLUDE "engine/map_objects.asm"
INCLUDE "engine/intro_menu.asm"
-Function6454:: ; 6454
+ReanchorBGMap_NoOAMUpdate:: ; 6454
call DelayFrame
ld a, [hOAMUpdate]
push af
@@ -64,7 +64,8 @@ Function6454:: ; 6454
push af
xor a
ld [hBGMapMode], a
- call .Function6473
+
+ call .ReanchorBGMap
pop af
ld [hBGMapMode], a
@@ -74,16 +75,16 @@ Function6454:: ; 6454
set 6, [hl]
ret
-.Function6473:
+.ReanchorBGMap:
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
call OverworldTextModeSwitch
ld a, VBGMap1 / $100
- call .Function64b9
- call Function2e20
+ call .LoadBGMapAddrIntoHRAM
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
callba LoadOW_BGPal7
callba ApplyPals
ld a, $1
@@ -91,9 +92,9 @@ Function6454:: ; 6454
xor a
ld [hBGMapMode], a
ld [hWY], a
- callba Function64db ; no need to farcall
+ callba HDMATransfer_FillBGMap0WithTile60 ; no need to farcall
ld a, VBGMap0 / $100
- call .Function64b9
+ call .LoadBGMapAddrIntoHRAM
xor a
ld [wBGMapAnchor], a
ld a, VBGMap0 / $100
@@ -101,36 +102,36 @@ Function6454:: ; 6454
xor a
ld [hSCX], a
ld [hSCY], a
- call Function5958
+ call ApplyBGMapAnchorToObjects
ret
-.Function64b9: ; 64b9
+.LoadBGMapAddrIntoHRAM: ; 64b9
ld [hBGMapAddress + 1], a
xor a
ld [hBGMapAddress], a
ret
-Function64bf:: ; 64bf
+LoadFonts_NoOAMUpdate:: ; 64bf
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
- call .Function64cd
+ call .LoadGFX
pop af
ld [hOAMUpdate], a
ret
-.Function64cd:
+.LoadGFX:
call LoadFontsExtra
ld a, $90
ld [hWY], a
- call Function2e31
+ call SafeUpdateSprites
call LoadStandardFont
ret
-Function64db: ; 64db
+HDMATransfer_FillBGMap0WithTile60: ; 64db
ld a, [rSVBK]
push af
ld a, $6
@@ -138,7 +139,7 @@ Function64db: ; 64db
ld a, $60
ld hl, wDecompressScratch
- ld bc, wBackupAttrMap - wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
call ByteFill
ld a, wDecompressScratch / $100
ld [rHDMA1], a
@@ -932,8 +933,8 @@ StartMenu_PrintBugContestStatus: ; 24be7
ld h, b
ld l, c
inc hl
- ld c, $3
- call Function3842
+ ld c, 3
+ call Print8BitNumRightAlign
.skip_level
pop af
@@ -1174,169 +1175,7 @@ Function29fe4: ; unreferenced
ret
INCLUDE "engine/wildmons.asm"
-
-DetermineLinkBattleResult: ; 2b930
- callba UpdateEnemyMonInParty
- ld hl, PartyMon1HP
- call .CountMonsRemaining
- push bc
- ld hl, OTPartyMon1HP
- call .CountMonsRemaining
- ld a, c
- pop bc
- cp c
- jr z, .even_number_of_mons_remaining
- jr c, .defeat
- jr .victory
-
-.even_number_of_mons_remaining
- call .BothSides_CheckNumberMonsAtFullHealth
- jr z, .drawn
- ld a, e
- cp $1
- jr z, .victory
- cp $2
- jr z, .defeat
- ld hl, PartyMon1HP
- call .CalcPercentHPRemaining
- push de
- ld hl, OTPartyMon1HP
- call .CalcPercentHPRemaining
- pop hl
- ld a, d
- cp h
- jr c, .victory
- jr z, .compare_lo
- jr .defeat
-
-.compare_lo
- ld a, e
- cp l
- jr z, .drawn
- jr nc, .defeat
-
-.victory
- ld a, [wBattleResult]
- and $f0
- ld [wBattleResult], a
- ret
-
-.defeat
- ld a, [wBattleResult]
- and $f0
- add $1
- ld [wBattleResult], a
- ret
-
-.drawn
- ld a, [wBattleResult]
- and $f0
- add $2
- ld [wBattleResult], a
- ret
-
-.CountMonsRemaining: ; 2b995
- ld c, 0
- ld b, 3
- ld de, PARTYMON_STRUCT_LENGTH - 1
-.loop
- ld a, [hli]
- or [hl]
- jr nz, .not_fainted
- inc c
-
-.not_fainted
- add hl, de
- dec b
- jr nz, .loop
- ret
-
-.CalcPercentHPRemaining: ; 2b9a6
- ld de, 0
- ld c, $3
-.loop2
- ld a, [hli]
- or [hl]
- jr z, .next
- dec hl
- xor a
- ld [hDividend + 0], a
- ld a, [hli]
- ld [hDividend + 1], a
- ld a, [hli]
- ld [hDividend + 2], a
- xor a
- ld [hDividend + 3], a
- ld a, [hli]
- ld b, a
- ld a, [hld]
- srl b
- rr a
- srl b
- rr a
- ld [hDivisor], a
- ld b, $4
- call Divide
- ld a, [hQuotient + 2]
- add e
- ld e, a
- ld a, [hQuotient + 1]
- adc d
- ld d, a
- dec hl
-
-.next
- push de
- ld de, $2f
- add hl, de
- pop de
- dec c
- jr nz, .loop2
- ret
-
-.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
- ld hl, PartyMon1HP
- call .CheckFaintedOrFullHealth
- jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
- ld hl, OTPartyMon1HP
- call .CheckFaintedOrFullHealth
- ld e, $1
- ret
-
-.finish
- ld hl, OTPartyMon1HP
- call .CheckFaintedOrFullHealth
- ld e, $0
- ret nz ; we both have pokemon that are neither fainted nor at full health
- ld e, $2
- ld a, $1
- and a
- ret
-
-.CheckFaintedOrFullHealth: ; 2ba01
- ld d, 3
-.loop3
- ld a, [hli]
- ld b, a
- ld a, [hli]
- ld c, a
- or b
- jr z, .fainted_or_full_health
- ld a, [hli]
- cp b
- ret nz
- ld a, [hld]
- cp c
- ret nz
-
-.fainted_or_full_health
- push de
- ld de, PARTYMON_STRUCT_LENGTH - 2
- add hl, de
- pop de
- dec d
- jr nz, .loop3
- ret
+INCLUDE "battle/link_result.asm"
ChrisBackpic: ; 2ba1a
INCBIN "gfx/misc/player.6x6.2bpp.lz"
@@ -1678,9 +1517,9 @@ ClearBattleRAM: ; 2ef18
ld [wBattleResult], a
ld hl, wPartyMenuCursor
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld [wMenuScrollPosition], a
@@ -2103,78 +1942,6 @@ DisplayDexEntry: ; 4424d
String_44331: ; 44331
db "#@"
-GetDexEntryPointer: ; 44333
-; return dex entry pointer b:de
- push hl
- ld hl, PokedexDataPointerTable
- ld a, b
- dec a
- ld d, 0
- ld e, a
- add hl, de
- add hl, de
- ld e, [hl]
- inc hl
- ld d, [hl]
- push de
- rlca
- rlca
- and $3
- ld hl, .PokedexEntryBanks
- ld d, 0
- ld e, a
- add hl, de
- ld b, [hl]
- pop de
- pop hl
- ret
-
-.PokedexEntryBanks: ; 44351
-
-GLOBAL PokedexEntries1
-GLOBAL PokedexEntries2
-GLOBAL PokedexEntries3
-GLOBAL PokedexEntries4
-
- db BANK(PokedexEntries1)
- db BANK(PokedexEntries2)
- db BANK(PokedexEntries3)
- db BANK(PokedexEntries4)
-
-GetDexEntryPagePointer: ; 44355
- call GetDexEntryPointer ; b:de
- push hl
- ld h, d
- ld l, e
-; skip species name
-.loop1
- ld a, b
- call GetFarByte
- inc hl
- cp "@"
- jr nz, .loop1
-; skip height and weight
-rept 4
- inc hl
-endr
-; if c != 1: skip entry
- dec c
- jr z, .done
-; skip entry
-.loop2
- ld a, b
- call GetFarByte
- inc hl
- cp "@"
- jr nz, .loop2
-
-.done
- ld d, h
- ld e, l
- pop hl
- ret
-
-PokedexDataPointerTable: ; 0x44378
INCLUDE "data/pokedex/entry_pointers.asm"
INCLUDE "engine/mail.asm"
@@ -2505,7 +2272,7 @@ SaveMenu_LoadEDTile: ; 4cf45 (13:4f45)
and a
jp z, WaitBGMap
-; The following is a modified version of Function3246.
+; The following is a modified version of LoadEDTile.
ld a, [hBGMapMode]
push af
xor a
@@ -2646,7 +2413,7 @@ PhoneRing_LoadEDTile: ; 4d188
cp $0
jp z, WaitBGMap
-; What follows is a modified version of Function3246 (LoadEDTile).
+; What follows is a modified version of LoadEDTile.
ld a, [hBGMapMode]
push af
xor a
@@ -2740,7 +2507,7 @@ LinkMonStatsScreen: ; 4d319
callba LoadTradeScreenBorder
callba Link_WaitBGMap
callba InitTradeSpeciesList
- callba Function28eff
+ callba SetTradeRoomBGPals
call WaitBGMap2
ret
@@ -2817,304 +2584,7 @@ LinkTextbox2: ; 4d35b
jr nz, .row_loop
ret
-_ResetClock: ; 4d3b1
- callba BlankScreen
- ld b, SCGB_08
- call GetSGBLayout
- call LoadStandardFont
- call LoadFontsExtra
- ld de, MUSIC_MAIN_MENU
- call PlayMusic
- ld hl, .text_askreset
- call PrintText
- ld hl, .NoYes_MenuDataHeader
- call CopyMenuDataHeader
- call VerticalMenu
- ret c
- ld a, [wMenuCursorY]
- cp $1
- ret z
- call ClockResetPassword
- jr c, .wrongpassword
- ld a, BANK(sRTCStatusFlags)
- call GetSRAMBank
- ld a, $80
- ld [sRTCStatusFlags], a
- call CloseSRAM
- ld hl, .text_okay
- call PrintText
- ret
-
-.wrongpassword
- ld hl, .text_wrong
- call PrintText
- ret
-
-.text_okay ; 0x4d3fe
- ; Password OK. Select CONTINUE & reset settings.
- text_jump UnknownText_0x1c55db
- db "@"
-
-.text_wrong ; 0x4d403
- ; Wrong password!
- text_jump UnknownText_0x1c560b
- db "@"
-
-.text_askreset ; 0x4d408
- ; Reset the clock?
- text_jump UnknownText_0x1c561c
- db "@"
-
-.NoYes_MenuDataHeader: ; 0x4d40d
- db $00 ; flags
- db 07, 14 ; start coords
- db 11, 19 ; end coords
- dw .NoYes_MenuData2
- db 1 ; default option
-
-.NoYes_MenuData2: ; 0x4d415
- db $c0 ; flags
- db 2 ; items
- db "NO@"
- db "YES@"
-
-ClockResetPassword: ; 4d41e
- call .CalculatePassword
- push de
- ld hl, StringBuffer2
- ld bc, 5
- xor a
- call ByteFill
- ld a, $4
- ld [StringBuffer2 + 5], a
- ld hl, .pleaseenterpasswordtext
- call PrintText
-.loop
- call .updateIDdisplay
-.loop2
- call JoyTextDelay
- ld a, [hJoyLast]
- ld b, a
- and A_BUTTON
- jr nz, .confirm
- ld a, b
- and D_PAD
- jr z, .loop2
- call .dpadinput
- ld c, 3
- call DelayFrames
- jr .loop
-
-.confirm
- call .ConvertDecIDToBytes
- pop de
- ld a, e
- cp l
- jr nz, .nope
- ld a, d
- cp h
- jr nz, .nope
- and a
- ret
-
-.nope
- scf
- ret
-
-.pleaseenterpasswordtext ; 0x4d463
- ; Please enter the password.
- text_jump UnknownText_0x1c562e
- db "@"
-
-.updateIDdisplay ; 4d468
- hlcoord 14, 15
- ld de, StringBuffer2
- ld c, 5
-.loop3
- ld a, [de]
- add "0"
- ld [hli], a
- inc de
- dec c
- jr nz, .loop3
- hlcoord 14, 16
- ld bc, 5
- ld a, " "
- call ByteFill
- hlcoord 14, 16
- ld a, [StringBuffer2 + 5]
- ld e, a
- ld d, $0
- add hl, de
- ld [hl], $61
- ret
-
-.dpadinput ; 4d490
- ld a, b
- and D_LEFT
- jr nz, .left
- ld a, b
- and D_RIGHT
- jr nz, .right
- ld a, b
- and D_UP
- jr nz, .up
- ld a, b
- and D_DOWN
- jr nz, .down
- ret
-
-.left
- ld a, [StringBuffer2 + 5]
- and a
- ret z
- dec a
- ld [StringBuffer2 + 5], a
- ret
-
-.right
- ld a, [StringBuffer2 + 5]
- cp $4
- ret z
- inc a
- ld [StringBuffer2 + 5], a
- ret
-
-.up
- call .getcurrentdigit
- ld a, [hl]
- cp 9
- jr z, .wraparound_up
- inc a
- ld [hl], a
- ret
-
-.wraparound_up
- ld [hl], $0
- ret
-
-.down
- call .getcurrentdigit
- ld a, [hl]
- and a
- jr z, .wraparound_down
- dec a
- ld [hl], a
- ret
-
-.wraparound_down
- ld [hl], 9
- ret
-
-.getcurrentdigit ; 4d4d5
- ld a, [StringBuffer2 + 5]
- ld e, a
- ld d, $0
- ld hl, StringBuffer2
- add hl, de
- ret
-
-.ConvertDecIDToBytes: ; 4d4e0
- ld hl, 0
- ld de, StringBuffer2 + 4
- ld bc, 1
- call .ConvertToBytes
- ld bc, 10
- call .ConvertToBytes
- ld bc, 100
- call .ConvertToBytes
- ld bc, 1000
- call .ConvertToBytes
- ld bc, 10000
-.ConvertToBytes: ; 4d501
- ld a, [de]
- dec de
- push hl
- ld hl, 0
- call AddNTimes
- ld c, l
- ld b, h
- pop hl
- add hl, bc
- ret
-
-.CalculatePassword: ; 4d50f
- ld a, BANK(sPlayerData)
- call GetSRAMBank
- ld de, 0
- ld hl, sPlayerData + (PlayerID - wPlayerData)
- ld c, $2
- call .ComponentFromNumber
- ld hl, sPlayerData + (PlayerName - wPlayerData)
- ld c, $5 ; PLAYER_NAME_LENGTH_J
- call .ComponentFromString
- ld hl, sPlayerData + (Money - wPlayerData)
- ld c, $3
- call .ComponentFromNumber
- call CloseSRAM
- ret
-
-.ComponentFromNumber: ; 4d533
- ld a, [hli]
- add e
- ld e, a
- ld a, $0
- adc d
- ld d, a
- dec c
- jr nz, .ComponentFromNumber
- ret
-
-.ComponentFromString: ; 4d53e
- ld a, [hli]
- cp "@"
- ret z
- add e
- ld e, a
- ld a, $0
- adc d
- ld d, a
- dec c
- jr nz, .ComponentFromString
- ret
-
-_DeleteSaveData: ; 4d54c
- callba BlankScreen
- ld b, SCGB_08
- call GetSGBLayout
- call LoadStandardFont
- call LoadFontsExtra
- ld de, MUSIC_MAIN_MENU
- call PlayMusic
- ld hl, .Text_ClearAllSaveData
- call PrintText
- ld hl, .NoYesMenuDataHeader
- call CopyMenuDataHeader
- call VerticalMenu
- ret c
- ld a, [wMenuCursorY]
- cp $1
- ret z
- callba EmptyAllSRAMBanks
- ret
-
-.Text_ClearAllSaveData: ; 0x4d580
- ; Clear all save data?
- text_jump UnknownText_0x1c564a
- db "@"
-
-.NoYesMenuDataHeader: ; 0x4d585
- db $00 ; flags
- db 07, 14 ; start coords
- db 11, 19 ; end coords
- dw .MenuData2
- db 1 ; default option
-
-.MenuData2: ; 0x4d58d
- db $c0 ; flags
- db 2 ; items
- db "NO@"
- db "YES@"
+INCLUDE "engine/delete_save_change_clock.asm"
Tilesets::
INCLUDE "tilesets/tileset_headers.asm"
@@ -3209,14 +2679,14 @@ AnimateTrademonFrontpic: ; 4d81e
ld a, [wOTTrademonSpecies]
call IsAPokemon
ret c
- callba Function29549
+ callba ShowOTTrademonStats
ld a, [wOTTrademonSpecies]
ld [CurPartySpecies], a
ld a, [wOTTrademonDVs]
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -3312,9 +2782,9 @@ Special_CheckForLuckyNumberWinners: ; 4d87a
jr z, .SkipBox
ld hl, .BoxBankAddresses
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
@@ -3360,7 +2830,7 @@ endr
ld a, [ScriptVar]
and a
ret z ; found nothing
- callba MobileFn_1060cd
+ callba TrainerRankings_LuckyNumberShow
ld a, [wFoundMatchingIDInParty]
and a
push af
@@ -3587,7 +3057,7 @@ CheckPartyFullAfterContest: ; 4d9e5
ld de, wBufferMonOT
ld bc, NAME_LENGTH
call CopyBytes
- callab Function51322
+ callab InsertPokemonIntoBox
ld a, [CurPartySpecies]
ld [wd265], a
call GetPokemonName
@@ -3730,141 +3200,7 @@ SetEggMonCaughtData: ; 4dbb8 (13:5bb8)
ld [CurPartyLevel], a
ret
-_FindGreaterThanThatLevel: ; 4dbd2
- ld hl, PartyMon1Level
- call FindGreaterThanThatLevel
- ret
-
-_FindAtLeastThatHappy: ; 4dbd9
- ld hl, PartyMon1Happiness
- call FindAtLeastThatHappy
- ret
-
-_FindThatSpecies: ; 4dbe0
- ld hl, PartyMon1Species
- jp FindThatSpecies
-
-_FindThatSpeciesYourTrainerID: ; 4dbe6
- ld hl, PartyMon1Species
- call FindThatSpecies
- ret z
- ld a, c
- ld hl, PartyMon1ID
- ld bc, PARTYMON_STRUCT_LENGTH
- call AddNTimes
- ld a, [PlayerID]
- cp [hl]
- jr nz, .nope
- inc hl
- ld a, [PlayerID + 1]
- cp [hl]
- jr nz, .nope
- ld a, $1
- and a
- ret
-
-.nope
- xor a
- ret
-
-FindAtLeastThatHappy: ; 4dc0a
-; Sets the bits for the Pokemon that have a happiness greater than or equal to b.
-; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy.
- ld c, $0
- ld a, [PartyCount]
- ld d, a
-.loop
- ld a, d
- dec a
- push hl
- push bc
- ld bc, PARTYMON_STRUCT_LENGTH
- call AddNTimes
- pop bc
- ld a, b
- cp [hl]
- pop hl
- jr z, .greater_equal
- jr nc, .lower
-
-.greater_equal
- ld a, c
- or $1
- ld c, a
-
-.lower
- sla c
- dec d
- jr nz, .loop
- call RetroactivelyIgnoreEggs
- ld a, c
- and a
- ret
-
-FindGreaterThanThatLevel: ; 4dc31
- ld c, $0
- ld a, [PartyCount]
- ld d, a
-.loop
- ld a, d
- dec a
- push hl
- push bc
- ld bc, PARTYMON_STRUCT_LENGTH
- call AddNTimes
- pop bc
- ld a, b
- cp [hl]
- pop hl
- jr c, .greater
- ld a, c
- or $1
- ld c, a
-
-.greater
- sla c
- dec d
- jr nz, .loop
- call RetroactivelyIgnoreEggs
- ld a, c
- and a
- ret
-
-FindThatSpecies: ; 4dc56
-; Find species b in your party.
-; If you have no Pokemon, returns c = -1 and z.
-; If that species is in your party, returns its location in c, and nz.
-; Otherwise, returns z.
- ld c, -1
- ld hl, PartySpecies
-.loop
- ld a, [hli]
- cp -1
- ret z
- inc c
- cp b
- jr nz, .loop
- ld a, $1
- and a
- ret
-
-RetroactivelyIgnoreEggs: ; 4dc67
- ld e, -2
- ld hl, PartySpecies
-.loop
- ld a, [hli]
- cp -1
- ret z
- cp EGG
- jr nz, .skip_notegg
- ld a, c
- and e
- ld c, a
-
-.skip_notegg
- rlc e
- jr .loop
-
+INCLUDE "engine/search2.asm"
INCLUDE "engine/stats_screen.asm"
CatchTutorial:: ; 4e554
@@ -3951,7 +3287,7 @@ CatchTutorial:: ; 4e554
INCLUDE "engine/evolution_animation.asm"
-Function4e881: ; 4e881
+InitDisplayForHallOfFame: ; 4e881
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -3981,7 +3317,7 @@ Function4e881: ; 4e881
text_jump UnknownText_0x1bd39e
db "@"
-Function4e8c2: ; 4e8c2
+InitDisplayForRedCredits: ; 4e8c2
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -3997,7 +3333,7 @@ Function4e8c2: ; 4e8c2
xor a
call ByteFill
ld hl, wd000 ; UnknBGPals
- ld c, 4 * $10
+ ld c, 4 tiles
.load_white_palettes
ld a, (palred 31 + palgreen 31 + palblue 31) % $100
ld [hli], a
@@ -4013,32 +3349,32 @@ Function4e8c2: ; 4e8c2
call SetPalettes
ret
-Function4e906: ; 4e906
+ResetDisplayBetweenHallOfFameMons: ; 4e906
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld hl, wDecompressScratch
- ld bc, wBackupAttrMap - wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
ld a, " "
call ByteFill
hlbgcoord 0, 0
ld de, wDecompressScratch
- ld b, $0
- ld c, $40
+ ld b, 0
+ ld c, 4 tiles
call Request2bpp
pop af
ld [rSVBK], a
ret
-Function4e929: ; mobile function
+GetMobileOTTrainerClass: ; mobile function
ld h, b
ld l, c
- call Function4e930
+ call .GetMobileOTTrainerClass
ld c, a
ret
-Function4e930: ; 4e930
+.GetMobileOTTrainerClass: ; 4e930
ld a, [hli]
xor [hl]
ld c, a
@@ -4119,7 +3455,7 @@ FemaleTrainersEnd:
INCLUDE "battle/sliding_intro.asm"
-Function4ea0a: ; 4ea0a
+Mobile_PrintOpponentBattleMessage: ; 4ea0a
ld a, c
push af
call SpeechTextBox
@@ -4127,11 +3463,11 @@ Function4ea0a: ; 4ea0a
pop af
dec a
ld bc, $c
- ld hl, w5_dc1a
+ ld hl, w5_MobileOpponentBattleMessages
call AddNTimes
- ld de, wcd53
+ ld de, wMobileOpponentBattleMessage
ld bc, $c
- ld a, $5 ; BANK(w5_dc1a)
+ ld a, $5 ; BANK(w5_MobileOpponentBattleMessages)
call FarCopyWRAM
ld a, [rSVBK]
@@ -4139,9 +3475,9 @@ Function4ea0a: ; 4ea0a
ld a, $1
ld [rSVBK], a
- ld bc, wcd53
+ ld bc, wMobileOpponentBattleMessage
decoord 1, 14
- callba Function11c0c6
+ callba PrintEZChatBattleMessage
pop af
ld [rSVBK], a
@@ -4169,7 +3505,7 @@ CheckBattleScene: ; 4ea44
.mobile
ld a, [wcd2f]
and a
- jr nz, .asm_4ea72
+ jr nz, .from_wram
ld a, $4
call GetSRAMBank
@@ -4184,7 +3520,7 @@ CheckBattleScene: ; 4ea44
and a
ret
-.asm_4ea72
+.from_wram
ld a, $5
ld hl, w5_dc00
call GetFarWRAMByte
@@ -4307,7 +3643,7 @@ GetPkmnSpecies: ; 508d5
jr z, .otpartymon
cp BOXMON
jr z, .boxmon
- cp BREEDMON
+ cp TEMPMON
jr z, .breedmon
; WILDMON
@@ -4343,7 +3679,8 @@ GetPkmnSpecies: ; 508d5
INCLUDE "text/types.asm"
Function50a28: ; 50a28
- ld hl, Strings50a42
+; XXX
+ ld hl, .Strings
ld a, [TrainerClass]
dec a
ld c, a
@@ -4362,7 +3699,7 @@ Function50a28: ; 50a28
jr nz, .copy
ret
-Strings50a42: ; 50a42
+.Strings: ; 50a42
; Untranslated trainer class names from Red.
dw .Youngster
dw .BugCatcher
@@ -4445,9 +3782,10 @@ DrawHP: ; 50b10
ld [wWhichHPBar], a
push hl
push bc
+ ; box mons have full HP
ld a, [MonType]
cp BOXMON
- jr z, .asm_50b30
+ jr z, .at_least_1_hp
ld a, [TempMonHP]
ld b, a
@@ -4456,34 +3794,34 @@ DrawHP: ; 50b10
; Any HP?
or b
- jr nz, .asm_50b30
+ jr nz, .at_least_1_hp
xor a
ld c, a
ld e, a
ld a, 6
ld d, a
- jp .asm_50b4a
+ jp .fainted
-.asm_50b30
+.at_least_1_hp
ld a, [TempMonMaxHP]
ld d, a
ld a, [TempMonMaxHP + 1]
ld e, a
ld a, [MonType]
cp BOXMON
- jr nz, .asm_50b41
+ jr nz, .not_boxmon
ld b, d
ld c, e
-.asm_50b41
+.not_boxmon
predef ComputeHPBarPixels
ld a, 6
ld d, a
ld c, a
-.asm_50b4a
+.fainted
ld a, c
pop bc
ld c, a
@@ -4495,14 +3833,14 @@ DrawHP: ; 50b10
pop hl
; Print HP
- ld bc, $15 ; move (1,1)
+ bccoord 1, 1, 0
add hl, bc
ld de, TempMonHP
ld a, [MonType]
cp BOXMON
- jr nz, .asm_50b66
+ jr nz, .not_boxmon_2
ld de, TempMonMaxHP
-.asm_50b66
+.not_boxmon_2
lb bc, 2, 3
call PrintNum
@@ -4692,9 +4030,9 @@ ListMovePP: ; 50c50
.skip
pop hl
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld d, h
ld e, l
ld hl, TempMonMoves
@@ -4760,17 +4098,18 @@ endr
ret
Function50cd0: ; 50cd0
-.asm_50cd0
+; XXX
+.loop
ld [hl], $32
inc hl
ld [hl], $3e
dec hl
add hl, de
dec c
- jr nz, .asm_50cd0
+ jr nz, .loop
ret
-Function50cdb: ; unreferenced predef
+Predef22: ; unreferenced predef
push hl
push hl
ld hl, PartyMonNicknames
@@ -4782,7 +4121,7 @@ Function50cdb: ; unreferenced predef
pop hl
ld a, [CurPartySpecies]
cp EGG
- jr z, .asm_50d09
+ jr z, .egg
push hl
ld bc, -12
add hl, bc
@@ -4795,7 +4134,7 @@ Function50cdb: ; unreferenced predef
call PrintLevel
pop de
-.asm_50d09
+.egg
ret
PlaceStatusString: ; 50d0a
@@ -4919,60 +4258,59 @@ ListMoves: ; 50d6f
.done
ret
-Function50db9: ; 50db9
- ld a, [wd263]
+InitList: ; 50db9
+ ld a, [wInitListType]
- cp $1
+ cp INIT_ENEMYOT_LIST
jr nz, .check_party_ot_name
ld hl, OTPartyCount
ld de, OTPartyMonOT
ld a, ENEMY_OT_NAME
jr .done
-.check_party_ot_name
- cp $4
+.check_party_ot_name
+ cp INIT_PLAYEROT_LIST
jr nz, .check_mon_name
ld hl, PartyCount
ld de, PartyMonOT
ld a, PARTY_OT_NAME
jr .done
-.check_mon_name
- cp $5
+.check_mon_name
+ cp INIT_MON_LIST
jr nz, .check_item_name
ld hl, CurMart
ld de, PokemonNames
ld a, PKMN_NAME
jr .done
-.check_item_name
- cp $2
+.check_item_name
+ cp INIT_BAG_ITEM_LIST
jr nz, .check_ob_item_name
ld hl, NumItems
ld de, ItemNames
ld a, ITEM_NAME
jr .done
-.check_ob_item_name
+.check_ob_item_name
ld hl, CurMart
ld de, ItemNames
ld a, ITEM_NAME
-
.done
- ld [wNamedObjectTypeBuffer], a
+ ld [wNamedObjectTypeBuffer], a ; d265
ld a, l
- ld [wd100], a
+ ld [wListPointer], a
ld a, h
- ld [wd101], a
+ ld [wListPointer + 1], a
ld a, e
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, d
- ld [wd103], a
- ld bc, ItemAttributes
+ ld [wUnusedD102 + 1], a
+ ld bc, ItemAttributes ; ParseEnemyAction, HandleMapTimeAndJoypad, Music_LakeOfRage_Ch3, String_11a7c1 $67c1
ld a, c
- ld [wd104], a
+ ld [wItemAttributesPtr], a
ld a, b
- ld [wd105], a
+ ld [wItemAttributesPtr + 1], a
ret
CalcLevel: ; 50e1b
@@ -5303,141 +4641,7 @@ _SwitchPartyMons:
ret
INCLUDE "gfx/load_pics.asm"
-
-Function51322: ; 51322
- ld a, BANK(sBoxCount)
- call GetSRAMBank
- ld hl, sBoxCount
- call Function513cb
- ld a, [sBoxCount]
- dec a
- ld [wd265], a
- ld hl, sBoxMonNicknames
- ld bc, PKMN_NAME_LENGTH
- ld de, wBufferMonNick
- call Function513e0
- ld a, [sBoxCount]
- dec a
- ld [wd265], a
- ld hl, sBoxMonOT
- ld bc, NAME_LENGTH
- ld de, wBufferMonOT
- call Function513e0
- ld a, [sBoxCount]
- dec a
- ld [wd265], a
- ld hl, sBoxMons
- ld bc, BOXMON_STRUCT_LENGTH
- ld de, wBufferMon
- call Function513e0
- ld hl, wBufferMonMoves
- ld de, TempMonMoves
- ld bc, NUM_MOVES
- call CopyBytes
- ld hl, wBufferMonPP
- ld de, TempMonPP
- ld bc, NUM_MOVES
- call CopyBytes
- ld a, [CurPartyMon]
- ld b, a
- callba Functiondcb6
- jp CloseSRAM
-
-Function5138b: ; 5138b
- ld hl, PartyCount
- call Function513cb
- ld a, [PartyCount]
- dec a
- ld [wd265], a
- ld hl, PartyMonNicknames
- ld bc, PKMN_NAME_LENGTH
- ld de, wBufferMonNick
- call Function513e0
- ld a, [PartyCount]
- dec a
- ld [wd265], a
- ld hl, PartyMonOT
- ld bc, NAME_LENGTH
- ld de, wBufferMonOT
- call Function513e0
- ld a, [PartyCount]
- dec a
- ld [wd265], a
- ld hl, PartyMons
- ld bc, PARTYMON_STRUCT_LENGTH
- ld de, wBufferMon
- call Function513e0
- ret
-
-Function513cb: ; 513cb
- inc [hl]
- inc hl
- ld a, [CurPartyMon]
- ld c, a
- ld b, 0
- add hl, bc
- ld a, [CurPartySpecies]
- ld c, a
-.asm_513d8
- ld a, [hl]
- ld [hl], c
- inc hl
- inc c
- ld c, a
- jr nz, .asm_513d8
- ret
-
-Function513e0: ; 513e0
- push de
- push hl
- push bc
- ld a, [wd265]
- dec a
- call AddNTimes
- push hl
- add hl, bc
- ld d, h
- ld e, l
- pop hl
-.asm_513ef
- push bc
- ld a, [wd265]
- ld b, a
- ld a, [CurPartyMon]
- cp b
- pop bc
- jr z, .asm_51415
- push hl
- push de
- push bc
- call CopyBytes
- pop bc
- pop de
- pop hl
- push hl
- ld a, l
- sub c
- ld l, a
- ld a, h
- sbc b
- ld h, a
- pop de
- ld a, [wd265]
- dec a
- ld [wd265], a
- jr .asm_513ef
-
-.asm_51415
- pop bc
- pop hl
- ld a, [CurPartyMon]
- call AddNTimes
- ld d, h
- ld e, l
- pop hl
- call CopyBytes
- ret
-
+INCLUDE "engine/move_mon_wo_mail.asm"
BaseData::
INCLUDE "data/base_stats.asm"
@@ -5492,6 +4696,7 @@ SECTION "bank22", ROMX, BANK[$22]
INCLUDE "event/kurt.asm"
Function88248: ; 88248
+; XXX
ld c, CAL
ld a, [PlayerGender]
bit 0, a
@@ -5773,7 +4978,8 @@ Predef36:
INCLUDE "engine/timeofdaypals.asm"
INCLUDE "engine/battle_start.asm"
-Function8c7c9: ; unreferenced
+Function8c7c9:
+; XXX
ld a, $1
ld [hBGMapMode], a
call WaitBGMap
@@ -5895,7 +5101,7 @@ LoadPoisonBGPals: ; cbcdd
ld a, [hCGB]
and a
ret nz
- ret
+ ret ; ????
.LoadPals: ; cbce5
ld a, [hCGB]
@@ -5904,9 +5110,9 @@ LoadPoisonBGPals: ; cbcdd
ld a, [TimeOfDayPal]
and $3
cp $3
- ld a, $0
+ ld a, %00000000
jr z, .convert_pals
- ld a, $aa
+ ld a, %10101010
.convert_pals
call DmgToCgbBGPals
@@ -5923,10 +5129,10 @@ LoadPoisonBGPals: ; cbcdd
ld hl, BGPals
ld c, $20
.loop
-; RGB 31, 21, 28
- ld a, (palred 31 + palgreen 21 + palblue 28) % $100
+; RGB 28, 21, 31
+ ld a, (palred 28 + palgreen 21 + palblue 31) % $100
ld [hli], a
- ld a, (palred 31 + palgreen 21 + palblue 28) / $100
+ ld a, (palred 28 + palgreen 21 + palblue 31) / $100
ld [hli], a
dec c
jr nz, .loop
@@ -6021,7 +5227,7 @@ DisplayCaughtContestMonStats: ; cc000
ld [Options], a
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ret
@@ -6118,7 +5324,7 @@ INCLUDE "tilesets/data_6.asm"
SECTION "bank38", ROMX, BANK[$38]
-Functione0000: ; e0000
+RotateUnownFrontpic: ; e0000
; something to do with Unown printer
push de
xor a
@@ -6131,8 +5337,8 @@ Functione0000: ; e0000
push bc
ld de, wd002
call .Copy
- call .Decompress
- ld hl, Unknown_e008b
+ call .Rotate
+ ld hl, UnownPrinter_OverworldMapRectangle
pop bc
add hl, bc
add hl, bc
@@ -6147,16 +5353,16 @@ Functione0000: ; e0000
pop bc
inc c
ld a, c
- cp $31
+ cp 7 * 7
jr c, .loop
ld hl, OverworldMap
ld de, sScratch
- ld bc, $31 tiles
+ ld bc, 7 * 7 tiles
call CopyBytes
pop hl
ld de, sScratch
- ld c, $31
+ ld c, 7 * 7
ld a, [hROMBank]
ld b, a
call Get2bpp
@@ -6173,7 +5379,7 @@ Functione0000: ; e0000
jr nz, .loop_copy
ret
-.Decompress: ; e0057
+.Rotate: ; e0057
ld hl, wd012
ld e, %10000000
ld d, 8
@@ -6215,20 +5421,19 @@ Functione0000: ; e0000
jr nz, .loop_count
ret
-overworldmaptile EQUS "dw OverworldMap + $10 *"
overworldmaprect: MACRO
y = 0
rept \1
x = \1 * (\2 +- 1) + y
rept \2
- overworldmaptile x
+ dw OverworldMap tile x
x = x +- \2
endr
y = y + 1
endr
endm
-Unknown_e008b: ; e008b
+UnownPrinter_OverworldMapRectangle: ; e008b
overworldmaprect 7, 7
Unknown_e00ed:
@@ -6388,6 +5593,7 @@ INCLUDE "tilesets/data_7.asm"
SECTION "bank77_2", ROMX, BANK[$77]
Function1dd6a9: ; 1dd6a9
+; XXX
ld a, b
ld b, c
ld c, a
@@ -6454,19 +5660,19 @@ String_PM: db "PM@" ; 1dd6ff
INCLUDE "engine/diploma.asm"
LoadSGBPokedexGFX: ; 1ddf1c
- ld hl, LZ_1ddf33
+ ld hl, SGBPokedexGFX_LZ
ld de, VTiles2 tile $31
call Decompress
ret
-Function1ddf26: ; 1ddf26 (77:5f26)
- ld hl, LZ_1ddf33
+LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26)
+ ld hl, SGBPokedexGFX_LZ
ld de, VTiles2 tile $31
- lb bc, BANK(LZ_1ddf33), $3a
+ lb bc, BANK(SGBPokedexGFX_LZ), $3a
call DecompressRequest2bpp
ret
-LZ_1ddf33: ; 1ddf33
+SGBPokedexGFX_LZ: ; 1ddf33
INCBIN "gfx/pokedex/sgb.2bpp.lz"
LoadQuestionMarkPic: ; 1de0d7
@@ -6568,7 +5774,8 @@ DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1)
.esults_D ; 1de23c
; (SEARCH R)
- db "ESULTS<NEXT>"
+ db "ESULTS"
+ next ""
; (### FOUN)
next "D!@"
@@ -6659,7 +5866,7 @@ DudeAutoInput_DownA: ; 1de2af
db A_BUTTON, $00
db NO_INPUT, $ff ; end
-Function1de2c5: ; 1de2c5
+TownMap_ConvertLineBreakCharacters: ; 1de2c5
ld hl, StringBuffer1
.loop
ld a, [hl]
@@ -6831,42 +6038,44 @@ SECTION "bank7D", ROMX, BANK[$7D]
db $cc, $6b, $1e ; XXX
Function1f4003: ; 1f4003
+; XXX
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f4018
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
call CloseSRAM
ret
-Unknown_1f4018:
+.unknown_data
INCBIN "unknown/1f4018.bin"
Function1f4dbe: ; 1f4dbe
+; XXX
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f4dd3
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
call CloseSRAM
ret
-Unknown_1f4dd3:
+.unknown_data
INCBIN "unknown/1f4dd3.bin"
Function1f5d9f: ; 1f5d9f
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f5db4
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
call CloseSRAM
ret
-Unknown_1f5db4:
+.unknown_data
INCBIN "unknown/1f5db4.bin"
SECTION "bank7E", ROMX, BANK[$7E]
diff --git a/maps/AzaleaTown.asm b/maps/AzaleaTown.asm
index 93526a4a5..769067421 100644
--- a/maps/AzaleaTown.asm
+++ b/maps/AzaleaTown.asm
@@ -219,36 +219,36 @@ AzaleaTownHiddenFullHeal:
AzaleaTownRivalBattleApproachMovement1:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
AzaleaTownRivalBattleApproachMovement2:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
AzaleaTownRivalBattleExitMovement:
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
step_end
Movement_PlayerWalksOutOfKurtsHouse:
- step_left
- step_left
- step_up
- turn_head_left
+ step LEFT
+ step LEFT
+ step UP
+ turn_head LEFT
step_end
AzaleaTownRivalBeforeText:
diff --git a/maps/BattleTower1F.asm b/maps/BattleTower1F.asm
index 38257a0be..5d8809b10 100644
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -168,7 +168,6 @@ Script_WaitButton: ; 0x9e4bb
closetext
end
-
UnreferencedScript_0x9e4be:
writetext Text_SaveBeforeEnteringBattleRoom
yesorno
@@ -268,87 +267,87 @@ GrannyScript_0x9e56e:
jumptextfaceplayer Text_BattleTowerGranny
MovementData_BattleTower1FWalkToElevator:
- step_up
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
MovementData_BattleTowerHallwayPlayerEntersBattleRoom:
- step_up
+ step UP
step_end
MovementData_BattleTowerElevatorExitElevator:
- step_down
+ step DOWN
step_end
MovementData_BattleTowerHallwayWalkTo1020Room:
- step_right
- step_right
+ step RIGHT
+ step RIGHT
MovementData_BattleTowerHallwayWalkTo3040Room:
- step_right
- step_right
- step_up
- step_right
- turn_head_left
+ step RIGHT
+ step RIGHT
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_BattleTowerHallwayWalkTo90100Room:
- step_left
- step_left
+ step LEFT
+ step LEFT
MovementData_BattleTowerHallwayWalkTo7080Room:
- step_left
- step_left
+ step LEFT
+ step LEFT
MovementData_BattleTowerHallwayWalkTo5060Room:
- step_left
- step_left
- step_up
- step_left
- turn_head_right
+ step LEFT
+ step LEFT
+ step UP
+ step LEFT
+ turn_head RIGHT
step_end
MovementData_BattleTowerBattleRoomPlayerWalksIn:
- step_up
- step_up
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head RIGHT
step_end
MovementData_BattleTowerBattleRoomOpponentWalksIn:
- slow_step_down
- slow_step_down
- slow_step_down
- turn_head_left
+ slow_step DOWN
+ slow_step DOWN
+ slow_step DOWN
+ turn_head LEFT
step_end
MovementData_BattleTowerBattleRoomOpponentWalksOut:
- turn_head_up
- slow_step_up
- slow_step_up
- slow_step_up
+ turn_head UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
MovementData_BattleTowerBattleRoomReceptionistWalksToPlayer:
- slow_step_right
- slow_step_right
- slow_step_up
- slow_step_up
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
step_end
MovementData_BattleTowerBattleRoomReceptionistWalksAway:
- slow_step_down
- slow_step_down
- slow_step_left
- slow_step_left
- turn_head_right
+ slow_step DOWN
+ slow_step DOWN
+ slow_step LEFT
+ slow_step LEFT
+ turn_head RIGHT
step_end
MovementData_BattleTowerBattleRoomPlayerTurnsToFaceReceptionist:
- turn_head_down
+ turn_head DOWN
step_end
MovementData_BattleTowerBattleRoomPlayerTurnsToFaceNextOpponent:
- turn_head_right
+ turn_head RIGHT
step_end
Text_BattleTowerWelcomesYou: ; 0x9e5ab
diff --git a/maps/BattleTowerElevator.asm b/maps/BattleTowerElevator.asm
index dbbce6f3d..2ae68654c 100644
--- a/maps/BattleTowerElevator.asm
+++ b/maps/BattleTowerElevator.asm
@@ -38,12 +38,12 @@ BattleTowerElevator_MapScriptHeader:
end
MovementData_BattleTowerElevatorReceptionistWalksIn:
- step_right
- turn_head_down
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_BattleTowerElevatorPlayerWalksIn:
- turn_head_down
+ turn_head DOWN
step_end
BattleTowerElevator_MapEventHeader:
diff --git a/maps/BillsHouse.asm b/maps/BillsHouse.asm
index 0eefa4fdd..9a0aae54b 100644
--- a/maps/BillsHouse.asm
+++ b/maps/BillsHouse.asm
@@ -8,7 +8,7 @@ BillsHouse_MapScriptHeader:
.MapCallbacks:
db 0
-GrampsScript_0x189538:
+BillsGrandpa:
faceplayer
opentext
checkevent EVENT_GAVE_KURT_APRICORNS
@@ -74,7 +74,7 @@ GrampsScript_0x189538:
.GotWaterStone:
checkver
- iftrue .Crystal11
+ iftrue .AskVulpix
writetext BillsGrandpaGrowlitheText
buttonsound
writetext BillsGrandpaAskToSeeMonText
@@ -88,7 +88,7 @@ GrampsScript_0x189538:
setevent EVENT_SHOWED_GROWLITHE_VULPIX_TO_BILLS_GRANDPA
jump .ShowedGrowlitheVulpix
-.Crystal11:
+.AskVulpix:
writetext BillsGrandpaVulpixText
buttonsound
writetext BillsGrandpaAskToSeeMonText
@@ -370,4 +370,4 @@ BillsHouse_MapEventHeader:
.PersonEvents:
db 1
- person_event SPRITE_GRAMPS, 3, 2, SPRITEMOVEDATA_STANDING_UP, 2, 0, -1, -1, (1 << 3) | PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, GrampsScript_0x189538, -1
+ person_event SPRITE_GRAMPS, 3, 2, SPRITEMOVEDATA_STANDING_UP, 2, 0, -1, -1, (1 << 3) | PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, BillsGrandpa, -1
diff --git a/maps/BrunosRoom.asm b/maps/BrunosRoom.asm
index c7049239b..19e7dc46d 100644
--- a/maps/BrunosRoom.asm
+++ b/maps/BrunosRoom.asm
@@ -79,10 +79,10 @@ UnknownScript_0x1809f3:
end
MovementData_0x1809f9:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x1809fe:
diff --git a/maps/BurnedTower1F.asm b/maps/BurnedTower1F.asm
index d1170332c..369d89b02 100644
--- a/maps/BurnedTower1F.asm
+++ b/maps/BurnedTower1F.asm
@@ -147,11 +147,11 @@ BurnedTower1FHPUp:
itemball HP_UP
BurnedTowerMovement_PlayerWalksToSilver:
- step_left
+ step LEFT
step_end
BurnedTowerMovement_SilverWalksToPlayer:
- step_right
+ step RIGHT
step_end
BurnedTower1FMovement_PlayerStartsToFall:
@@ -159,11 +159,11 @@ BurnedTower1FMovement_PlayerStartsToFall:
step_end
BurnedTower1FEusineMovement:
- step_down
- step_left
- step_left
- step_left
- step_down
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
step_end
BurnedTowerSilver_BeforeText:
diff --git a/maps/BurnedTowerB1F.asm b/maps/BurnedTowerB1F.asm
index d607e7deb..97b1a1531 100644
--- a/maps/BurnedTowerB1F.asm
+++ b/maps/BurnedTowerB1F.asm
@@ -131,70 +131,70 @@ BurnedTowerB1FBoulder:
BurnedTowerRaikouMovement:
set_sliding
- fast_jump_step_down
- fast_jump_step_left
+ fast_jump_step DOWN
+ fast_jump_step LEFT
remove_sliding
step_end
BurnedTowerEnteiMovement:
set_sliding
- fast_jump_step_right
- fast_jump_step_down
- fast_jump_step_right
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
remove_sliding
step_end
BurnedTowerSuicuneMovement1:
set_sliding
- fast_jump_step_right
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_left
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step LEFT
remove_sliding
step_end
BurnedTowerSuicuneMovement2:
set_sliding
- fast_jump_step_left
- fast_jump_step_up
- big_step_up
- fast_jump_step_right
+ fast_jump_step LEFT
+ fast_jump_step UP
+ big_step UP
+ fast_jump_step RIGHT
remove_sliding
step_end
MovementData_0x18624f:
set_sliding
- big_step_down
+ big_step DOWN
remove_sliding
step_end
BurnedTowerSuicuneMovement3:
set_sliding
- big_step_up
- fast_jump_step_right
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_down
+ big_step UP
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step DOWN
remove_sliding
step_end
BurnedTowerB1FEusineMovement2:
- step_left
- step_left
- step_down
- step_down
- step_left
- step_down
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step LEFT
+ step DOWN
step_end
BurnedTowerB1FEusineMovement1:
- step_down
- step_left
- step_left
- step_left
- step_down
- step_down
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
step_end
BurnedTowerB1FEusineText:
diff --git a/maps/CeladonGameCorner.asm b/maps/CeladonGameCorner.asm
index d763e6bc0..b44c66dcc 100644
--- a/maps/CeladonGameCorner.asm
+++ b/maps/CeladonGameCorner.asm
@@ -145,8 +145,8 @@ MapCeladonGameCornerSignpost9Script:
MovementData_0x721cd:
; Unreferenced.
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x721d0:
diff --git a/maps/CeladonPokeCenter1F.asm b/maps/CeladonPokeCenter1F.asm
index 90f1e43c2..9bd47c4fc 100644
--- a/maps/CeladonPokeCenter1F.asm
+++ b/maps/CeladonPokeCenter1F.asm
@@ -58,18 +58,18 @@ CeladonEusine:
end
.Movement2:
- step_left
- step_down
- step_down
- step_down
- step_down
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
.Movement1:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x71e70:
diff --git a/maps/CeruleanGym.asm b/maps/CeruleanGym.asm
index ddadd6f9c..a91a3cc9d 100644
--- a/maps/CeruleanGym.asm
+++ b/maps/CeruleanGym.asm
@@ -167,36 +167,36 @@ CeruleanGymStatue:
jumpstd gymstatue2
MovementData_0x1884e3:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x1884e8:
- big_step_right
- big_step_down
+ big_step RIGHT
+ big_step DOWN
step_end
MovementData_0x1884eb:
fix_facing
db $39 ; movement
- jump_step_up
+ jump_step UP
db $38 ; movement
remove_fixed_facing
- step_sleep_8
- step_sleep_8
- step_down
- step_down
+ step_sleep 8
+ step_sleep 8
+ step DOWN
+ step DOWN
step_end
MovementData_0x1884f5:
- big_step_down
+ big_step DOWN
step_end
MovementData_0x1884f7:
fix_facing
- slow_step_up
+ slow_step UP
remove_fixed_facing
step_end
diff --git a/maps/CherrygroveCity.asm b/maps/CherrygroveCity.asm
index 39083c5ab..5b0db50f2 100644
--- a/maps/CherrygroveCity.asm
+++ b/maps/CherrygroveCity.asm
@@ -242,101 +242,101 @@ CherrygroveCityMartSign:
jumpstd martsign
GuideGentMovement1:
- step_left
- step_left
- step_up
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step UP
+ step LEFT
+ turn_head UP
step_end
GuideGentMovement2:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
GuideGentMovement3:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
GuideGentMovement4:
- step_left
- step_left
- step_left
- step_down
- step_left
- step_left
- step_left
- step_down
- turn_head_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ turn_head LEFT
step_end
GuideGentMovement5:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- turn_head_up
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
GuideGentMovement6:
- step_up
- step_up
+ step UP
+ step UP
step_end
CherrygroveCity_RivalWalksToYou:
- step_left
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
CherrygroveCity_RivalPushesYouOutOfTheWay:
- big_step_down
- turn_head_up
+ big_step DOWN
+ turn_head UP
step_end
CherrygroveCity_UnusedMovementData:
- step_left
- turn_head_down
+ step LEFT
+ turn_head DOWN
step_end
CherrygroveCity_RivalExitsStageLeft:
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
GuideGentIntroText:
diff --git a/maps/CianwoodCity.asm b/maps/CianwoodCity.asm
index 512e4812f..bbb62dbf5 100644
--- a/maps/CianwoodCity.asm
+++ b/maps/CianwoodCity.asm
@@ -156,33 +156,33 @@ CianwoodCityHiddenMaxEther:
MovementData_0x1a00da:
db $39 ; movement
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_right
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
db $38 ; movement
step_end
MovementData_0x1a00e0:
db $39 ; movement
- fast_jump_step_right
- fast_jump_step_up
- fast_jump_step_right
- fast_jump_step_right
+ fast_jump_step RIGHT
+ fast_jump_step UP
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
db $38 ; movement
step_end
MovementData_0x1a00e7:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a00ec:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x1a00f1:
diff --git a/maps/CianwoodGym.asm b/maps/CianwoodGym.asm
index d20e3d4fa..6e7f508ec 100644
--- a/maps/CianwoodGym.asm
+++ b/maps/CianwoodGym.asm
@@ -143,9 +143,9 @@ CianwoodGymStatue:
CianwoodGymMovement_ChuckChucksBoulder:
set_sliding
- big_step_left
- big_step_up
- fast_jump_step_right
+ big_step LEFT
+ big_step UP
+ fast_jump_step RIGHT
remove_sliding
step_end
diff --git a/maps/CopycatsHouse2F.asm b/maps/CopycatsHouse2F.asm
index b307126c8..41689241d 100644
--- a/maps/CopycatsHouse2F.asm
+++ b/maps/CopycatsHouse2F.asm
@@ -1,10 +1,10 @@
const_value set 2
- const COPYCATSHOUSE2F_COPYCAT1
+ const COPYCATSHOUSE2F_COPYCAT1 ; if player is male
const COPYCATSHOUSE2F_DODRIO
- const COPYCATSHOUSE2F_FAIRYDOLL
+ const COPYCATSHOUSE2F_FAIRYDOLL ; lost item
const COPYCATSHOUSE2F_MONSTERDOLL
const COPYCATSHOUSE2F_BIRDDOLL
- const COPYCATSHOUSE2F_COPYCAT2
+ const COPYCATSHOUSE2F_COPYCAT2 ; if player is female
CopycatsHouse2F_MapScriptHeader:
.MapTriggers:
@@ -15,15 +15,15 @@ CopycatsHouse2F_MapScriptHeader:
; callbacks
- dbw MAPCALLBACK_OBJECTS, CopycatsHouse2FCallback
+ dbw MAPCALLBACK_OBJECTS, .Callback
-CopycatsHouse2FCallback:
+.Callback:
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part1
+ iftrue .Female
disappear COPYCATSHOUSE2F_COPYCAT2
appear COPYCATSHOUSE2F_COPYCAT1
jump .Done
-.Part1:
+.Female:
disappear COPYCATSHOUSE2F_COPYCAT1
appear COPYCATSHOUSE2F_COPYCAT2
.Done:
@@ -32,146 +32,146 @@ CopycatsHouse2FCallback:
Copycat:
faceplayer
checkevent EVENT_GOT_PASS_FROM_COPYCAT
- iftrue .Part15
+ iftrue .GotPass
checkevent EVENT_RETURNED_LOST_ITEM_TO_COPYCAT
- iftrue .Part13
+ iftrue .TryGivePassAgain
checkitem LOST_ITEM
- iftrue .Part12
+ iftrue .ReturnLostItem
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part1
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
+ iftrue .Default_Female_1
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_CHRIS
- jump .Part2
+ jump .Default_Merge_1
-.Part1:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
+.Default_Female_1:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_KRIS
-.Part2:
- special RunCallback_04
+.Default_Merge_1:
+ special MapCallbackSprites_LoadUsedSpritesGFX
checkevent EVENT_RETURNED_MACHINE_PART
- iftrue .Part7
+ iftrue .TalkAboutLostItem
opentext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part3
- writetext UnknownText_0x18afda
- jump .Part4
+ iftrue .Default_Female_2a
+ writetext CopycatText_Male_1
+ jump .Default_Merge_2a
-.Part3:
- writetext UnknownText_0x18b316
-.Part4:
+.Default_Female_2a:
+ writetext CopycatText_Female_1
+.Default_Merge_2a:
waitbutton
closetext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part5
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
- jump .Part6
+ iftrue .Default_Female_3a
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
+ jump .Default_Merge_3a
-.Part5:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
-.Part6:
+.Default_Female_3a:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
+.Default_Merge_3a:
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
- writetext UnknownText_0x18b028
+ writetext CopycatText_QuickMimicking
waitbutton
closetext
end
-.Part7:
+.TalkAboutLostItem:
opentext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part8
- writetext UnknownText_0x18b064
- jump .Part9
+ iftrue .Default_Female_2b
+ writetext CopycatText_Male_2
+ jump .Default_Merge_2b
-.Part8:
- writetext UnknownText_0x18b366
-.Part9:
+.Default_Female_2b:
+ writetext CopycatText_Female_2
+.Default_Merge_2b:
waitbutton
closetext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part10
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
- jump .Part11
+ iftrue .Default_Female_3b
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
+ jump .Default_Merge_3b
-.Part10:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
-.Part11:
+.Default_Female_3b:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
+.Default_Merge_3b:
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
- writetext UnknownText_0x18b116
+ writetext CopycatText_Worried
waitbutton
closetext
setevent EVENT_MET_COPYCAT_FOUND_OUT_ABOUT_LOST_ITEM
end
-.Part12:
+.ReturnLostItem:
opentext
- writetext UnknownText_0x18b17f
+ writetext CopycatText_GiveDoll
buttonsound
takeitem LOST_ITEM
setevent EVENT_RETURNED_LOST_ITEM_TO_COPYCAT
clearevent EVENT_COPYCATS_HOUSE_2F_DOLL
- jump .Part14
+ jump .GivePass
-.Part13:
+.TryGivePassAgain:
opentext
-.Part14:
- writetext UnknownText_0x18b1e2
+.GivePass:
+ writetext CopycatText_GivePass
buttonsound
verbosegiveitem PASS
- iffalse .Part22
+ iffalse .Cancel
setevent EVENT_GOT_PASS_FROM_COPYCAT
- writetext UnknownText_0x18b214
+ writetext CopycatText_ExplainPass
waitbutton
closetext
end
-.Part15:
+.GotPass:
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part16
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
+ iftrue .GotPass_Female_1
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_CHRIS
- jump .Part17
+ jump .GotPass_Merge_1
-.Part16:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
+.GotPass_Female_1:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_KRIS
-.Part17:
- special RunCallback_04
+.GotPass_Merge_1:
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part18
- writetext UnknownText_0x18b298
- jump .Part19
+ iftrue .GotPass_Female_2
+ writetext CopycatText_Male_3
+ jump .GotPass_Merge_2
-.Part18:
- writetext UnknownText_0x18b415
-.Part19:
+.GotPass_Female_2:
+ writetext CopycatText_Female_3
+.GotPass_Merge_2:
waitbutton
closetext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part20
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
- jump .Part21
+ iftrue .GotPass_Female_3
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
+ jump .GotPass_Merge_3
-.Part20:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
-.Part21:
+.GotPass_Female_3:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
+.GotPass_Merge_3:
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
- writetext UnknownText_0x18b2f5
+ writetext CopycatText_ItsAScream
waitbutton
-.Part22:
+.Cancel:
closetext
end
@@ -191,19 +191,19 @@ CopycatsHouse2FDoll:
CopycatsHouse2FBookshelf:
jumpstd picturebookshelf
-MovementData_0x18afd0:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+CopycatSpinAroundMovementData:
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
-UnknownText_0x18afda:
+CopycatText_Male_1:
text "<PLAYER>: Hi! Do"
line "you like #MON?"
@@ -214,7 +214,7 @@ UnknownText_0x18afda:
line "You're strange!"
done
-UnknownText_0x18b028:
+CopycatText_QuickMimicking:
text "COPYCAT: Hmm?"
line "Quit mimicking?"
@@ -222,7 +222,7 @@ UnknownText_0x18b028:
line "favorite hobby!"
done
-UnknownText_0x18b064:
+CopycatText_Male_2:
text "<PLAYER>: Hi!"
line "I heard that you"
@@ -241,7 +241,7 @@ UnknownText_0x18b064:
cont "to VERMILION CITY?"
done
-UnknownText_0x18b116:
+CopycatText_Worried:
text "COPYCAT: Pardon?"
para "I shouldn't decide"
@@ -253,7 +253,7 @@ UnknownText_0x18b116:
cont "someone finds it?"
done
-UnknownText_0x18b17f:
+CopycatText_GiveDoll:
text "COPYCAT: Yay!"
line "That's my CLEFAIRY"
cont "# DOLL!"
@@ -265,13 +265,13 @@ UnknownText_0x18b17f:
line "proof!"
done
-UnknownText_0x18b1e2:
+CopycatText_GivePass:
text "OK. Here's the"
line "MAGNET TRAIN PASS"
cont "like I promised!"
done
-UnknownText_0x18b214:
+CopycatText_ExplainPass:
text "COPYCAT: That's"
line "the PASS for the"
cont "MAGNET TRAIN."
@@ -284,7 +284,7 @@ UnknownText_0x18b214:
cont "for the STATION."
done
-UnknownText_0x18b298:
+CopycatText_Male_3:
text "<PLAYER>: Hi!"
line "Thanks a lot for"
cont "the rail PASS!"
@@ -296,12 +296,12 @@ UnknownText_0x18b298:
cont "my every move?"
done
-UnknownText_0x18b2f5:
+CopycatText_ItsAScream:
text "COPYCAT: You bet!"
line "It's a scream!"
done
-UnknownText_0x18b316:
+CopycatText_Female_1:
text "<PLAYER>: Hi. You"
line "must like #MON."
@@ -312,7 +312,7 @@ UnknownText_0x18b316:
line "You're weird!"
done
-UnknownText_0x18b366:
+CopycatText_Female_2:
text "<PLAYER>: Hi. Did"
line "you really lose"
cont "your # DOLL?"
@@ -331,7 +331,7 @@ UnknownText_0x18b366:
cont "in VERMILION?"
done
-UnknownText_0x18b415:
+CopycatText_Female_3:
text "<PLAYER>: Thank you"
line "for the rail PASS!"
diff --git a/maps/DragonShrine.asm b/maps/DragonShrine.asm
index a2fa23b7b..ebd833ccd 100644
--- a/maps/DragonShrine.asm
+++ b/maps/DragonShrine.asm
@@ -344,66 +344,66 @@ MenuData2_0x18d2ad:
MovementData_0x18d2bf:
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_right
- slow_step_up
- slow_step_up
- slow_step_up
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
MovementData_0x18d2c7:
- slow_step_down
+ slow_step DOWN
step_end
MovementData_0x18d2c9:
- slow_step_left
- slow_step_left
- slow_step_left
- turn_head_down
+ slow_step LEFT
+ slow_step LEFT
+ slow_step LEFT
+ turn_head DOWN
step_end
MovementData_0x18d2ce:
- slow_step_right
- slow_step_right
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x18d2d1:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
MovementData_0x18d2d4:
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_up
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
MovementData_0x18d2da:
fix_facing
- big_step_left
+ big_step LEFT
step_end
MovementData_0x18d2dd:
- slow_step_left
+ slow_step LEFT
remove_fixed_facing
step_end
MovementData_0x18d2e0:
- slow_step_right
- slow_step_right
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x18d2e3:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x18d2ea:
diff --git a/maps/DragonsDenB1F.asm b/maps/DragonsDenB1F.asm
index c6b94ca74..3a93fc87d 100644
--- a/maps/DragonsDenB1F.asm
+++ b/maps/DragonsDenB1F.asm
@@ -197,17 +197,17 @@ DragonsDenB1FHiddenMaxElixer:
dwb EVENT_DRAGONS_DEN_B1F_HIDDEN_MAX_ELIXER, MAX_ELIXER
MovementDragonsDen_ClairWalksToYou:
- slow_step_right
- slow_step_right
- slow_step_right
- slow_step_right
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementDragonsDen_ClairWalksAway:
- slow_step_left
- slow_step_left
- slow_step_left
- slow_step_left
+ slow_step LEFT
+ slow_step LEFT
+ slow_step LEFT
+ slow_step LEFT
step_end
ClairText_Wait:
diff --git a/maps/EarlsPokemonAcademy.asm b/maps/EarlsPokemonAcademy.asm
index 2a49c6993..a43e652a8 100644
--- a/maps/EarlsPokemonAcademy.asm
+++ b/maps/EarlsPokemonAcademy.asm
@@ -149,19 +149,19 @@ AcademyBookshelf:
jumpstd difficultbookshelf
MovementData_0x68b2d:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
UnknownText_0x68b3b:
diff --git a/maps/EcruteakGym.asm b/maps/EcruteakGym.asm
index 7be7c7eeb..265e502e8 100644
--- a/maps/EcruteakGym.asm
+++ b/maps/EcruteakGym.asm
@@ -168,17 +168,17 @@ EcruteakGymStatue:
jumpstd gymstatue2
MovementData_0x99e5d:
- step_up
+ step UP
step_end
MovementData_0x99e5f:
fix_facing
- slow_step_down
+ slow_step DOWN
remove_fixed_facing
step_end
MovementData_0x99e63:
- slow_step_down
+ slow_step DOWN
step_end
UnknownText_0x99e65:
diff --git a/maps/EcruteakHouse.asm b/maps/EcruteakHouse.asm
index a11746e9a..2b795ebd6 100644
--- a/maps/EcruteakHouse.asm
+++ b/maps/EcruteakHouse.asm
@@ -144,16 +144,16 @@ GrampsScript_0x980c4:
MovementData_0x980c7:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
MovementData_0x980cc:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
UnknownText_0x980d1:
diff --git a/maps/EcruteakPokeCenter1F.asm b/maps/EcruteakPokeCenter1F.asm
index b611e7df4..dc578d2e0 100644
--- a/maps/EcruteakPokeCenter1F.asm
+++ b/maps/EcruteakPokeCenter1F.asm
@@ -77,28 +77,28 @@ EcruteakPokeCenter1FGymGuyScript:
jumptextfaceplayer EcruteakPokeCenter1FGymGuyText
EcruteakPokeCenter1FBillMovement1:
- step_up
- step_up
- step_up
- step_up
- step_right
- step_right
- step_right
- turn_head_up
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
EcruteakPokeCenter1FBillMovement2:
- step_right
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
EcruteakPokeCenter1FPlayerMovement1:
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
step_end
EcruteakPokeCenter1F_BillText1:
diff --git a/maps/ElmsLab.asm b/maps/ElmsLab.asm
index b939a2fb6..c49c522fc 100644
--- a/maps/ElmsLab.asm
+++ b/maps/ElmsLab.asm
@@ -313,7 +313,7 @@ ElmsLabHealingMachine:
end
ElmsLabHealingMachine_HealParty:
- special Mobile_HealParty
+ special TrainerRankings_Healings
special HealParty
playmusic MUSIC_NONE
writebyte 1 ; Machine is in Elm's Lab
@@ -616,118 +616,118 @@ ElmsLabBookshelf:
jumpstd difficultbookshelf
ElmsLab_WalkUpToElmMovement:
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head LEFT
step_end
MovementData_0x78f70:
- step_up
+ step UP
step_end
MeetCopScript2_StepLeft:
- step_left
+ step LEFT
step_end
MeetCopScript_WalkUp:
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ turn_head RIGHT
step_end
OfficerLeavesMovement:
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
AideWalksRight1:
- step_right
- step_right
- turn_head_up
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
AideWalksRight2:
- step_right
- step_right
- step_right
- turn_head_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
AideWalksLeft1:
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
AideWalksLeft2:
- step_left
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
ElmJumpUpMovement:
fix_facing
- big_step_up
+ big_step UP
remove_fixed_facing
step_end
ElmJumpDownMovement:
fix_facing
- big_step_down
+ big_step DOWN
remove_fixed_facing
step_end
ElmJumpLeftMovement:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
step_end
ElmJumpRightMovement:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
step_end
ElmsLab_ElmToDefaultPositionMovement1:
- step_up
+ step UP
step_end
ElmsLab_ElmToDefaultPositionMovement2:
- step_right
- step_right
- step_up
- turn_head_down
+ step RIGHT
+ step RIGHT
+ step UP
+ turn_head DOWN
step_end
AfterCyndaquilMovement:
- step_left
- step_up
- turn_head_up
+ step LEFT
+ step UP
+ turn_head UP
step_end
AfterTotodileMovement:
- step_left
- step_left
- step_up
- turn_head_up
+ step LEFT
+ step LEFT
+ step UP
+ turn_head UP
step_end
AfterChikoritaMovement:
- step_left
- step_left
- step_left
- step_up
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ turn_head UP
step_end
ElmText_Intro:
diff --git a/maps/FastShip1F.asm b/maps/FastShip1F.asm
index bb42631e0..3440cd848 100644
--- a/maps/FastShip1F.asm
+++ b/maps/FastShip1F.asm
@@ -141,72 +141,72 @@ WorriedGrandpaTriggerLeft:
end
MovementData_0x7520e:
- slow_step_left
- turn_head_right
+ slow_step LEFT
+ turn_head RIGHT
step_end
MovementData_0x75211:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
MovementData_0x75214:
- slow_step_down
- turn_head_up
+ slow_step DOWN
+ turn_head UP
step_end
MovementData_0x75217:
- step_down
- step_down
- turn_head_down
+ step DOWN
+ step DOWN
+ turn_head DOWN
step_end
MovementData_0x7521b:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_0x75220:
- step_right
+ step RIGHT
step_end
MovementData_0x75222:
- big_step_down
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x7522e:
- big_step_right
- turn_head_left
+ big_step RIGHT
+ turn_head LEFT
step_end
MovementData_0x75231:
- step_up
+ step UP
step_end
MovementData_0x75233:
- step_down
+ step DOWN
step_end
MovementData_0x75235:
- step_up
- step_up
+ step UP
+ step UP
step_end
MovementData_0x75238:
- step_right
- step_up
+ step RIGHT
+ step UP
step_end
UnknownText_0x7523b:
diff --git a/maps/FastShipB1F.asm b/maps/FastShipB1F.asm
index b5167bfdc..4a4d3a87c 100644
--- a/maps/FastShipB1F.asm
+++ b/maps/FastShipB1F.asm
@@ -210,16 +210,16 @@ FashShipB1FTrashcan:
MovementData_0x76871:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
MovementData_0x76876:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
UnknownText_0x7687b:
diff --git a/maps/FastShipCabins_NNW_NNE_NE.asm b/maps/FastShipCabins_NNW_NNE_NE.asm
index b19fa8773..9c7960201 100644
--- a/maps/FastShipCabins_NNW_NNE_NE.asm
+++ b/maps/FastShipCabins_NNW_NNE_NE.asm
@@ -118,19 +118,19 @@ FastShipCabins_NNW_NNE_NETrashcan:
jumpstd trashcan
MovementData_0x75637:
- step_left
- step_left
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x7563c:
- step_down
- step_left
- step_left
- step_up
- step_up
- step_up
+ step DOWN
+ step LEFT
+ step LEFT
+ step UP
+ step UP
+ step UP
step_end
CooltrainermSeanSeenText:
diff --git a/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm b/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm
index eea6bbc36..9b8aeac85 100644
--- a/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm
+++ b/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm
@@ -221,23 +221,23 @@ FastShipCaptainsCabinTrashcan:
jumpstd trashcan
MovementData_0x76004:
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_0x7600c:
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ turn_head LEFT
step_end
MovementData_0x76010:
- step_down
+ step DOWN
step_end
UnknownText_0x76012:
diff --git a/maps/FastShipCabins_SW_SSW_NW.asm b/maps/FastShipCabins_SW_SSW_NW.asm
index 536515dd7..76933c600 100644
--- a/maps/FastShipCabins_SW_SSW_NW.asm
+++ b/maps/FastShipCabins_SW_SSW_NW.asm
@@ -71,7 +71,7 @@ FastShipBed:
closetext
special Special_FadeBlackQuickly
special Special_ReloadSpritesNoPalettes
- special Mobile_HealParty
+ special TrainerRankings_Healings
special HealParty
playmusic MUSIC_HEAL
pause 60
diff --git a/maps/FuchsiaGym.asm b/maps/FuchsiaGym.asm
index 2f91b85f0..05feb0245 100644
--- a/maps/FuchsiaGym.asm
+++ b/maps/FuchsiaGym.asm
@@ -35,7 +35,7 @@ JanineScript_0x195db9:
variablesprite SPRITE_FUCHSIA_GYM_2, SPRITE_LASS
variablesprite SPRITE_FUCHSIA_GYM_3, SPRITE_LASS
variablesprite SPRITE_FUCHSIA_GYM_4, SPRITE_YOUNGSTER
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
writetext UnknownText_0x195feb
playsound SFX_GET_BADGE
@@ -65,7 +65,7 @@ FuschiaGym1Script_0x195e1b:
applymovement FUCHSIAGYM_FUCHSIA_GYM_1, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_1, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195e2c:
faceplayer
opentext
@@ -99,7 +99,7 @@ FuschiaGym2Script_0x195e55:
applymovement FUCHSIAGYM_FUCHSIA_GYM_2, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_2, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195e66:
faceplayer
opentext
@@ -133,7 +133,7 @@ FuschiaGym3Script_0x195e8f:
applymovement FUCHSIAGYM_FUCHSIA_GYM_3, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_3, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195ea0:
faceplayer
opentext
@@ -167,7 +167,7 @@ FuschiaGym4Script_0x195ec9:
applymovement FUCHSIAGYM_FUCHSIA_GYM_4, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_4, SPRITE_YOUNGSTER
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195eda:
faceplayer
opentext
@@ -220,19 +220,19 @@ FuchsiaGymStatue:
jumpstd gymstatue2
MovementData_0x195f27:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
UnknownText_0x195f35:
diff --git a/maps/FuchsiaPokeCenter1F.asm b/maps/FuchsiaPokeCenter1F.asm
index 36557c0ae..820d854c5 100644
--- a/maps/FuchsiaPokeCenter1F.asm
+++ b/maps/FuchsiaPokeCenter1F.asm
@@ -35,7 +35,7 @@ JanineImpersonatorScript_0x196462:
applymovement FUCHSIAPOKECENTER1F_JANINE_IMPERSONATOR, MovementData_0x196486
faceplayer
variablesprite SPRITE_JANINE_IMPERSONATOR, SPRITE_JANINE
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
writetext UnknownText_0x19654e
waitbutton
@@ -43,23 +43,23 @@ JanineImpersonatorScript_0x196462:
applymovement FUCHSIAPOKECENTER1F_JANINE_IMPERSONATOR, MovementData_0x196486
faceplayer
variablesprite SPRITE_JANINE_IMPERSONATOR, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
end
MovementData_0x196486:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
UnknownText_0x196494:
diff --git a/maps/GoldenrodCity.asm b/maps/GoldenrodCity.asm
index 0054647c3..7642bf6b7 100644
--- a/maps/GoldenrodCity.asm
+++ b/maps/GoldenrodCity.asm
@@ -275,17 +275,17 @@ GoldenrodCityFlowerShopSign:
jumptext GoldenrodCityFlowerShopSignText
MovementData_0x198a5f:
- step_right
- step_right
- step_up
+ step RIGHT
+ step RIGHT
+ step UP
step_end
MovementData_0x198a63:
- step_down
- step_right
- step_right
- step_up
- step_up
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
UnknownText_0x198a69:
diff --git a/maps/GoldenrodGym.asm b/maps/GoldenrodGym.asm
index 95d4693b5..3fb6057dc 100644
--- a/maps/GoldenrodGym.asm
+++ b/maps/GoldenrodGym.asm
@@ -177,13 +177,13 @@ GoldenrodGymStatue:
jumpstd gymstatue2
BridgetWalksUpMovement:
- step_left
- turn_head_up
+ step LEFT
+ turn_head UP
step_end
BridgetWalksAwayMovement:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x54122:
diff --git a/maps/GoldenrodMagnetTrainStation.asm b/maps/GoldenrodMagnetTrainStation.asm
index 44b6d6247..eea47ac8f 100644
--- a/maps/GoldenrodMagnetTrainStation.asm
+++ b/maps/GoldenrodMagnetTrainStation.asm
@@ -45,7 +45,7 @@ OfficerScript_0x550ec:
end
.MovementBoardTheTrain:
- turn_head_down
+ turn_head DOWN
step_end
.PassNotInBag:
@@ -74,37 +74,37 @@ GentlemanScript_0x55143:
jumptextfaceplayer UnknownText_0x552a3
MovementData_0x55146:
- step_up
- step_up
- step_right
- turn_head_left
+ step UP
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x5514b:
- step_left
- step_down
- step_down
+ step LEFT
+ step DOWN
+ step DOWN
step_end
MovementData_0x5514f:
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x55158:
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
- turn_head_up
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ turn_head UP
step_end
UnknownText_0x55160:
diff --git a/maps/GoldenrodPokeCenter1F.asm b/maps/GoldenrodPokeCenter1F.asm
index 6cb9cc80d..ed027321d 100644
--- a/maps/GoldenrodPokeCenter1F.asm
+++ b/maps/GoldenrodPokeCenter1F.asm
@@ -120,35 +120,35 @@ UnknownScript_0x61051:
end
MovementData_0x6105a:
- step_up
- step_right
- step_right
- step_right
- turn_head_down
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_0x61060:
- step_left
- step_left
- step_left
- step_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
step_end
MovementData_0x61065:
- step_up
- step_right
- step_right
- step_right
- step_right
- turn_head_down
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_0x6106c:
- step_left
- step_left
- step_left
- step_left
- step_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
step_end
; unused
diff --git a/maps/HallOfFame.asm b/maps/HallOfFame.asm
index d0f59a861..bf5804c42 100644
--- a/maps/HallOfFame.asm
+++ b/maps/HallOfFame.asm
@@ -50,20 +50,20 @@ HallOfFameScript:
end
HallOfFame_WalkUpWithLance:
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_right
- turn_head_left
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
HallOfFame_SlowlyApproachMachine:
- slow_step_up
+ slow_step UP
step_end
HallOfFame_LanceText:
diff --git a/maps/IlexForest.asm b/maps/IlexForest.asm
index 7ac703e3f..d09ec7ab7 100644
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -489,257 +489,257 @@ MapIlexForestSignpost4Script:
end
MovementData_Farfetchd_Pos1_Pos2:
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetchd_Pos2_Pos3:
- big_step_up
- big_step_up
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_down
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step DOWN
step_end
MovementData_Farfetchd_Pos2_Pos8:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_Farfetchd_Pos3_Pos4:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetchd_Pos3_Pos2:
- big_step_up
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetchd_Pos4_Pos5:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_Farfetchd_Pos4_Pos3:
- big_step_left
- jump_step_left
- big_step_left
- big_step_left
+ big_step LEFT
+ jump_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetchd_Pos5_Pos6:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetchd_Pos5_Pos7:
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetched_Pos5_Pos4_Up:
- big_step_up
- big_step_up
- big_step_up
- big_step_right
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
step_end
MovementData_Farfetched_Pos5_Pos4_Right:
- big_step_right
- turn_head_up
- step_sleep_1
- turn_head_down
- step_sleep_1
- turn_head_up
- step_sleep_1
- big_step_down
- big_step_down
+ big_step RIGHT
+ turn_head UP
+ step_sleep 1
+ turn_head DOWN
+ step_sleep 1
+ turn_head UP
+ step_sleep 1
+ big_step DOWN
+ big_step DOWN
fix_facing
- jump_step_up
- step_sleep_8
- step_sleep_8
+ jump_step UP
+ step_sleep 8
+ step_sleep 8
remove_fixed_facing
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos6_Pos7:
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_right
- big_step_up
- big_step_up
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos6_Pos5:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos7_Pos8:
- big_step_up
- big_step_up
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetched_Pos7_Pos6:
- big_step_down
- big_step_down
- big_step_left
- big_step_down
- big_step_down
- big_step_right
- big_step_right
- big_step_right
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetched_Pos7_Pos5:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetched_Pos8_Pos9:
- big_step_down
- big_step_left
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step LEFT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_Farfetched_Pos8_Pos7:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetched_Pos8_Pos2:
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos9_Pos10:
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
fix_facing
- jump_step_right
- step_sleep_8
- step_sleep_8
+ jump_step RIGHT
+ step_sleep 8
+ step_sleep 8
remove_fixed_facing
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos9_Pos8_Right:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos9_Pos8_Down:
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
fix_facing
- jump_step_right
- step_sleep_8
- step_sleep_8
+ jump_step RIGHT
+ step_sleep 8
+ step_sleep 8
remove_fixed_facing
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_0x6ef4e:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x6ef53:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x6ef58:
fix_facing
- slow_step_down
+ slow_step DOWN
remove_fixed_facing
step_end
diff --git a/maps/IndigoPlateauPokeCenter1F.asm b/maps/IndigoPlateauPokeCenter1F.asm
index 348828ea2..4ebc80cd1 100644
--- a/maps/IndigoPlateauPokeCenter1F.asm
+++ b/maps/IndigoPlateauPokeCenter1F.asm
@@ -183,29 +183,29 @@ AbraScript:
end
PlateauRivalMovement1:
- step_up
- step_up
- step_up
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head LEFT
step_end
PlateauRivalMovement2:
- step_up
- step_up
- step_up
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head RIGHT
step_end
PlateauRivalLeavesMovement:
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x180178:
diff --git a/maps/KarensRoom.asm b/maps/KarensRoom.asm
index c1e8a93cf..228dec1eb 100644
--- a/maps/KarensRoom.asm
+++ b/maps/KarensRoom.asm
@@ -79,10 +79,10 @@ UnknownScript_0x180c1c:
end
MovementData_0x180c22:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x180c27:
diff --git a/maps/KogasRoom.asm b/maps/KogasRoom.asm
index 2ed66f1bd..0c6ca7eae 100644
--- a/maps/KogasRoom.asm
+++ b/maps/KogasRoom.asm
@@ -79,10 +79,10 @@ UnknownScript_0x180788:
end
MovementData_0x18078e:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x180793:
diff --git a/maps/KrissHouse1F.asm b/maps/KrissHouse1F.asm
index 88639d8d7..70aad1590 100644
--- a/maps/KrissHouse1F.asm
+++ b/maps/KrissHouse1F.asm
@@ -199,19 +199,19 @@ FridgeScript:
jumptext FridgeText
MovementData_0x7a5fc:
- turn_head_right
+ turn_head RIGHT
step_end
MovementData_0x7a5fe:
- slow_step_right
+ slow_step RIGHT
step_end
MovementData_0x7a600:
- turn_head_left
+ turn_head LEFT
step_end
MovementData_0x7a602:
- slow_step_left
+ slow_step LEFT
step_end
UnknownText_0x7a604:
diff --git a/maps/KurtsHouse.asm b/maps/KurtsHouse.asm
index 4d20200cd..17a278d65 100644
--- a/maps/KurtsHouse.asm
+++ b/maps/KurtsHouse.asm
@@ -437,20 +437,20 @@ KurtsHouseRadio:
jumpstd radio2
MovementData_0x18e466:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x18e46c:
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
UnknownText_0x18e473:
diff --git a/maps/LancesRoom.asm b/maps/LancesRoom.asm
index a3c9018e2..e3572d50d 100644
--- a/maps/LancesRoom.asm
+++ b/maps/LancesRoom.asm
@@ -136,79 +136,79 @@ LanceScript_0x180e7b:
end
LancesRoom_PlayerWalksInMovementData:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_ApproachLanceFromLeft:
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ turn_head RIGHT
step_end
MovementData_ApproachLanceFromRight:
- step_up
- step_left
- step_up
- turn_head_right
+ step UP
+ step LEFT
+ step UP
+ turn_head RIGHT
step_end
LancesRoomMovementData_MaryRushesIn:
- big_step_up
- big_step_up
- big_step_up
- turn_head_down
+ big_step UP
+ big_step UP
+ big_step UP
+ turn_head DOWN
step_end
LancesRoomMovementData_OakWalksIn:
- step_up
- step_up
+ step UP
+ step UP
step_end
LancesRoomMovementData_MaryYieldsToOak:
- step_left
- turn_head_right
+ step LEFT
+ turn_head RIGHT
step_end
LancesRoomMovementData_MaryInterviewChampion:
- big_step_up
- turn_head_right
+ big_step UP
+ turn_head RIGHT
step_end
LancesRoomMovementData_LancePositionsSelfToGuidePlayerAway:
- step_up
- step_left
- turn_head_down
+ step UP
+ step LEFT
+ turn_head DOWN
step_end
LancesRoomMovementData_LanceLeadsPlayerToHallOfFame:
- step_up
+ step UP
step_end
LancesRoomMovementData_PlayerExits:
- step_up
+ step UP
step_end
LancesRoomMovementData_MaryTriesToFollow:
- step_up
- step_right
- turn_head_up
+ step UP
+ step RIGHT
+ turn_head UP
step_end
LancesRoomMovementData_MaryRunsBackAndForth:
- big_step_right
- big_step_right
- big_step_left
- big_step_left
- big_step_left
- big_step_right
- big_step_right
- big_step_right
- big_step_left
- big_step_left
- turn_head_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step LEFT
+ big_step LEFT
+ turn_head UP
step_end
LanceBattleIntroText:
diff --git a/maps/MahoganyMart1F.asm b/maps/MahoganyMart1F.asm
index 77d5cdc85..532574644 100644
--- a/maps/MahoganyMart1F.asm
+++ b/maps/MahoganyMart1F.asm
@@ -119,46 +119,46 @@ GrannyScript_0x6c3ee:
MovementData_0x6c3f6:
fix_facing
- big_step_left
- big_step_right
+ big_step LEFT
+ big_step RIGHT
remove_fixed_facing
step_end
MovementData_0x6c3fb:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
step_end
MovementData_0x6c403:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
step_end
MovementData_0x6c407:
- slow_step_left
- turn_head_down
+ slow_step LEFT
+ turn_head DOWN
step_end
MovementData_0x6c40a:
- slow_step_right
- slow_step_up
- slow_step_up
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
step_end
MovementData_0x6c40e:
- slow_step_up
- slow_step_right
- slow_step_right
+ slow_step UP
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x6c412:
- slow_step_right
+ slow_step RIGHT
step_end
UnknownText_0x6c414:
diff --git a/maps/MahoganyTown.asm b/maps/MahoganyTown.asm
index b632fe50e..0612b0811 100644
--- a/maps/MahoganyTown.asm
+++ b/maps/MahoganyTown.asm
@@ -126,22 +126,22 @@ MahoganyTownPokeCenterSign:
jumpstd pokecentersign
MovementData_0x1900a4:
- step_down
- big_step_up
- turn_head_down
+ step DOWN
+ big_step UP
+ turn_head DOWN
MovementData_0x1900a7:
- step_left
+ step LEFT
step_end
MovementData_0x1900a9:
- step_right
- step_down
- turn_head_left
+ step RIGHT
+ step DOWN
+ turn_head LEFT
step_end
MovementData_0x1900ad:
- step_up
- turn_head_down
+ step UP
+ turn_head DOWN
step_end
UnknownText_0x1900b0:
diff --git a/maps/MobileBattleRoom.asm b/maps/MobileBattleRoom.asm
index 109322ad6..7c5628955 100644
--- a/maps/MobileBattleRoom.asm
+++ b/maps/MobileBattleRoom.asm
@@ -43,7 +43,7 @@ MapMobileBattleRoomSignpost0Script:
special RestartMapMusic
refreshscreen $0
.two_
- special Mobile_HealParty
+ special TrainerRankings_Healings
special HealParty
special Function10383c
iftrue .false
diff --git a/maps/MountMoon.asm b/maps/MountMoon.asm
index b2ce702bb..649b5686f 100644
--- a/maps/MountMoon.asm
+++ b/maps/MountMoon.asm
@@ -74,19 +74,19 @@ MountMoon_MapScriptHeader:
end
MountMoonSilverMovementBefore:
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MountMoonSilverMovementAfter:
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MountMoonSilverTextBefore:
diff --git a/maps/MountMoonSquare.asm b/maps/MountMoonSquare.asm
index 7c974e21d..1c84c2e65 100644
--- a/maps/MountMoonSquare.asm
+++ b/maps/MountMoonSquare.asm
@@ -8,25 +8,24 @@ MountMoonSquare_MapScriptHeader:
db 1
; triggers
- dw UnknownScript_0x77092, 0
+ dw .Trigger0, 0
.MapCallbacks:
db 2
; callbacks
- dbw MAPCALLBACK_NEWMAP, UnknownScript_0x77093
+ dbw MAPCALLBACK_NEWMAP, .DisappearMoonStone
+ dbw MAPCALLBACK_OBJECTS, .DisappearRock
- dbw MAPCALLBACK_OBJECTS, UnknownScript_0x77097
-
-UnknownScript_0x77092:
+.Trigger0:
end
-UnknownScript_0x77093:
+.DisappearMoonStone:
setevent EVENT_MOUNT_MOON_SQUARE_HIDDEN_MOON_STONE
return
-UnknownScript_0x77097:
+.DisappearRock:
disappear MOUNTMOONSQUARE_ROCK
return
@@ -39,7 +38,7 @@ ClefairyDance:
iffalse .NoDancing
appear MOUNTMOONSQUARE_FAIRY1
appear MOUNTMOONSQUARE_FAIRY2
- applymovement PLAYER, MovementData_0x77121
+ applymovement PLAYER, PlayerWalksUpToDancingClefairies
pause 15
appear MOUNTMOONSQUARE_ROCK
spriteface MOUNTMOONSQUARE_FAIRY1, RIGHT
@@ -48,19 +47,19 @@ ClefairyDance:
pause 30
follow MOUNTMOONSQUARE_FAIRY1, MOUNTMOONSQUARE_FAIRY2
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77123
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep1
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77126
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep2
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77128
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep3
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x7712b
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep4
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x7712d
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep5
stopfollow
- applymovement MOUNTMOONSQUARE_FAIRY2, MovementData_0x77130
+ applymovement MOUNTMOONSQUARE_FAIRY2, ClefairyDanceStep6
follow MOUNTMOONSQUARE_FAIRY1, MOUNTMOONSQUARE_FAIRY2
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77132
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep7
stopfollow
spriteface MOUNTMOONSQUARE_FAIRY1, DOWN
pause 10
@@ -69,7 +68,7 @@ ClefairyDance:
cry CLEFAIRY
pause 15
follow MOUNTMOONSQUARE_FAIRY1, MOUNTMOONSQUARE_FAIRY2
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77134
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyFleeMovement
disappear MOUNTMOONSQUARE_FAIRY1
disappear MOUNTMOONSQUARE_FAIRY2
stopfollow
@@ -90,48 +89,48 @@ DontLitterSign:
MtMoonSquareRock:
jumpstd smashrock
-MovementData_0x77121:
- step_up
+PlayerWalksUpToDancingClefairies:
+ step UP
step_end
-MovementData_0x77123:
- slow_step_down
- slow_jump_step_down
+ClefairyDanceStep1:
+ slow_step DOWN
+ slow_jump_step DOWN
step_end
-MovementData_0x77126:
- slow_jump_step_right
+ClefairyDanceStep2:
+ slow_jump_step RIGHT
step_end
-MovementData_0x77128:
- slow_step_up
- slow_jump_step_up
+ClefairyDanceStep3:
+ slow_step UP
+ slow_jump_step UP
step_end
-MovementData_0x7712b:
- slow_jump_step_left
+ClefairyDanceStep4:
+ slow_jump_step LEFT
step_end
-MovementData_0x7712d:
- slow_step_down
- slow_jump_step_down
+ClefairyDanceStep5:
+ slow_step DOWN
+ slow_jump_step DOWN
step_end
-MovementData_0x77130:
- slow_step_down
+ClefairyDanceStep6:
+ slow_step DOWN
step_end
-MovementData_0x77132:
- slow_step_right
+ClefairyDanceStep7:
+ slow_step RIGHT
step_end
-MovementData_0x77134:
- step_right
- step_right
- step_right
- jump_step_right
- step_right
- step_right
+ClefairyFleeMovement:
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ jump_step RIGHT
+ step RIGHT
+ step RIGHT
step_end
DontLitterSignText:
diff --git a/maps/MrPokemonsHouse.asm b/maps/MrPokemonsHouse.asm
index 4d06e3516..6449ad404 100644
--- a/maps/MrPokemonsHouse.asm
+++ b/maps/MrPokemonsHouse.asm
@@ -115,7 +115,7 @@ MrPokemonsHouse_OakScript:
special Special_FadeBlackQuickly
special Special_ReloadSpritesNoPalettes
playmusic MUSIC_HEAL
- special Mobile_HealParty
+ special TrainerRankings_Healings
special HealParty
pause 60
special Special_FadeInQuickly
@@ -157,20 +157,20 @@ MapMrPokemonsHouseSignpost4Script:
jumptext MrPokemonsHouse_StrangeCoinsText
MrPokemonsHouse_PlayerWalksToMrPokemon:
- step_right
- step_up
+ step RIGHT
+ step UP
step_end
MrPokemonsHouse_OakWalksToPlayer:
- step_down
- step_left
- step_left
+ step DOWN
+ step LEFT
+ step LEFT
step_end
MrPokemonsHouse_OakExits:
- step_down
- step_left
- turn_head_down
+ step DOWN
+ step LEFT
+ turn_head DOWN
db $3f ; movement
step_end
diff --git a/maps/NewBarkTown.asm b/maps/NewBarkTown.asm
index e83139fe7..d382a4cf1 100644
--- a/maps/NewBarkTown.asm
+++ b/maps/NewBarkTown.asm
@@ -144,52 +144,52 @@ MapNewBarkTownSignpost3Script:
jumptext ElmsHouseSignText
Movement_TeacherRunsToYou1_NBT:
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
Movement_TeacherRunsToYou2_NBT:
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
Movement_TeacherBringsYouBack1_NBT:
- step_right
- step_right
- step_right
- step_right
- turn_head_left
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head LEFT
step_end
Movement_TeacherBringsYouBack2_NBT:
- step_right
- step_right
- step_right
- step_right
- step_right
- turn_head_left
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head LEFT
step_end
Movement_SilverPushesYouAway_NBT:
- turn_head_up
- step_down
+ turn_head UP
+ step DOWN
step_end
Movement_SilverShovesYouOut_NBT:
- turn_head_up
+ turn_head UP
fix_facing
- jump_step_down
+ jump_step DOWN
remove_fixed_facing
step_end
Movement_SilverReturnsToTheShadows_NBT:
- step_right
+ step RIGHT
step_end
Text_GearIsImpressive:
diff --git a/maps/OlivineCity.asm b/maps/OlivineCity.asm
index 6a05af16c..87b842a39 100644
--- a/maps/OlivineCity.asm
+++ b/maps/OlivineCity.asm
@@ -49,7 +49,7 @@ UnknownScript_0x1a8833:
disappear OLIVINECITY_OLIVINE_RIVAL
special RestartMapMusic
variablesprite SPRITE_OLIVINE_RIVAL, SPRITE_SWIMMER_GUY
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
end
UnknownScript_0x1a886b:
@@ -73,7 +73,7 @@ UnknownScript_0x1a886b:
dotrigger $1
special RestartMapMusic
variablesprite SPRITE_OLIVINE_RIVAL, SPRITE_SWIMMER_GUY
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
end
SailorScript_0x1a88a3:
@@ -120,55 +120,55 @@ OlivineCityMartSign:
jumpstd martsign
MovementData_0x1a88d2:
- step_down
- step_right
- step_right
+ step DOWN
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x1a88d6:
- step_down
- step_down
- step_right
- step_right
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x1a88db:
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a88e8:
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a88f4:
- step_down
- turn_head_up
+ step DOWN
+ turn_head UP
step_end
MovementData_0x1a88f7:
- step_up
- turn_head_down
+ step UP
+ turn_head DOWN
step_end
UnknownText_0x1a88fa:
diff --git a/maps/OlivineLighthouse6F.asm b/maps/OlivineLighthouse6F.asm
index d1c6527c9..f99085ea2 100644
--- a/maps/OlivineLighthouse6F.asm
+++ b/maps/OlivineLighthouse6F.asm
@@ -131,34 +131,34 @@ OlivineLighthouse6FSuperPotion:
itemball SUPER_POTION
MovementData_0x60c68:
- slow_step_up
- slow_step_up
- slow_step_right
- slow_step_up
- slow_step_up
- step_sleep_8
- step_sleep_8
+ slow_step UP
+ slow_step UP
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
+ step_sleep 8
+ step_sleep 8
step_end
MovementData_0x60c70:
- slow_step_down
- slow_step_right
- slow_step_right
- slow_step_right
- slow_step_up
- slow_step_right
- slow_step_right
- slow_step_right
+ slow_step DOWN
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step UP
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x60c79:
- slow_step_up
- slow_step_up
- slow_step_right
- slow_step_up
- slow_step_up
- slow_step_up
- step_sleep_8
+ slow_step UP
+ slow_step UP
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ step_sleep 8
step_end
UnknownText_0x60c81:
diff --git a/maps/OlivinePort.asm b/maps/OlivinePort.asm
index e985ac45f..b7830eaed 100644
--- a/maps/OlivinePort.asm
+++ b/maps/OlivinePort.asm
@@ -240,52 +240,52 @@ OlivinePortHiddenProtein:
MovementData_0x74a30:
- step_down
+ step DOWN
step_end
MovementData_0x74a32:
- step_up
+ step UP
step_end
MovementData_0x74a34:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x74a37:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x74a3f:
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x74a49:
- step_up
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step UP
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x74a55:
diff --git a/maps/PokeCenter2F.asm b/maps/PokeCenter2F.asm
index 7989143c3..3730b6708 100644
--- a/maps/PokeCenter2F.asm
+++ b/maps/PokeCenter2F.asm
@@ -625,180 +625,180 @@ OfficerScript_0x192c9a:
end
PokeCenter2FMovementData_ReceptionistWalksUpAndLeft_LookRight:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMobileMobileMovementData_ReceptionistWalksUpAndLeft_LookDown:
- slow_step_up
- slow_step_left
- turn_head_down
+ slow_step UP
+ slow_step LEFT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsLeftLooksDown:
- slow_step_left
- turn_head_down
+ slow_step LEFT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksDown:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistWalksUpAndLeft_LookRight_2:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_ReceptionistLooksRight:
- turn_head_right
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_PlayerTakesThreeStepsUp:
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsUp:
- step_up
- step_up
+ step UP
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesOneStepUp:
- step_up
+ step UP
step_end
PokeCenter2FMobileMovementData_PlayerWalksIntoMobileBattleRoom:
- step_up
- step_up
- step_right
- step_up
+ step UP
+ step UP
+ step RIGHT
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsUp_2:
- step_up
- step_up
+ step UP
+ step UP
step_end
PokeCenter2FMovementData_PlayerWalksLeftAndUp:
- step_left
- step_up
+ step LEFT
+ step UP
step_end
PokeCenter2FMovementData_PlayerWalksRightAndUp:
- step_right
- step_up
+ step RIGHT
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesThreeStepsDown:
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsDown:
- step_down
- step_down
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesOneStepDown:
- step_down
+ step DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightAndDown:
- slow_step_right
- slow_step_down
+ slow_step RIGHT
+ slow_step DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksDown_2:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksDown_3:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_ReceptionistStepsLeftLooksRight:
- slow_step_left
- turn_head_right
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMobileMovementData_ReceptionistWalksUpAndLeft:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_PlayerWalksOutOfMobileRoom:
- step_down
- step_left
- step_down
- step_down
+ step DOWN
+ step LEFT
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMobileMovementData_ReceptionistWalksRightAndDown:
- slow_step_right
- slow_step_down
+ slow_step RIGHT
+ slow_step DOWN
step_end
PokeCenter2FMovementData_PlayerSpinsClockwiseEndsFacingRight:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_PlayerSpinsClockwiseEndsFacingLeft:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_left
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head LEFT
step_end
PokeCenter2FMovementData_PlayerSpinsClockwiseEndsFacingDown:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_PlayerTakesOneStepDown_2:
- step_down
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsDown_2:
- step_down
- step_down
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesOneStepUp_2:
- step_up
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesOneStepRight:
- step_right
+ step RIGHT
step_end
PokeCenter2FMovementData_PlayerTakesOneStepLeft:
- step_left
+ step LEFT
step_end
PokeCenter2FMovementData_ReceptionistStepsLeftLooksRight_2:
- slow_step_left
- turn_head_right
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksLeft_2:
- slow_step_right
- turn_head_left
+ slow_step RIGHT
+ turn_head LEFT
step_end
Text_BattleReceptionistMobile:
diff --git a/maps/PowerPlant.asm b/maps/PowerPlant.asm
index 04e860de2..62a539eb3 100644
--- a/maps/PowerPlant.asm
+++ b/maps/PowerPlant.asm
@@ -202,18 +202,18 @@ PowerPlantBookshelf:
jumpstd difficultbookshelf
MovementData_0x188ed5:
- step_right
- step_right
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
MovementData_0x188eda:
- step_down
- step_down
- step_left
- step_left
- turn_head_down
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
UnknownText_0x188ee0:
diff --git a/maps/RadioTower1F.asm b/maps/RadioTower1F.asm
index efcfeb65f..a2ecaed91 100644
--- a/maps/RadioTower1F.asm
+++ b/maps/RadioTower1F.asm
@@ -203,13 +203,13 @@ MapRadioTower1FSignpost1Script:
jumptext UnknownText_0x5d631
MovementData_0x5ce71:
- step_right
- turn_head_up
+ step RIGHT
+ turn_head UP
step_end
MovementData_0x5ce74:
- step_left
- turn_head_up
+ step LEFT
+ turn_head UP
step_end
UnknownText_0x5ce77:
diff --git a/maps/RadioTower2F.asm b/maps/RadioTower2F.asm
index 63b37abed..658f64aa4 100644
--- a/maps/RadioTower2F.asm
+++ b/maps/RadioTower2F.asm
@@ -339,8 +339,8 @@ RadioTower2FBookshelf:
jumpstd magazinebookshelf
MovementData_0x5d921:
- slow_step_down
- slow_step_right
+ slow_step DOWN
+ slow_step RIGHT
step_end
UnknownText_0x5d924:
diff --git a/maps/RadioTower5F.asm b/maps/RadioTower5F.asm
index 16447b2a6..31d54e742 100644
--- a/maps/RadioTower5F.asm
+++ b/maps/RadioTower5F.asm
@@ -156,42 +156,42 @@ RadioTower5FBookshelf:
jumpstd magazinebookshelf
FakeDirectorMovement:
- step_left
- step_left
- step_left
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
RadioTower5FDirectorWalksIn:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_down
- step_down
- step_down
- step_left
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
step_end
RadioTower5FDirectorWalksOut:
- step_right
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
- step_left
- step_up
- step_up
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x60125:
- step_left
- step_left
+ step LEFT
+ step LEFT
step_end
FakeDirectorTextBefore1:
diff --git a/maps/Route16Gate.asm b/maps/Route16Gate.asm
index 5ed348e52..e1ed8c714 100644
--- a/maps/Route16Gate.asm
+++ b/maps/Route16Gate.asm
@@ -33,8 +33,8 @@ UnknownScript_0x733f3:
end
MovementData_0x73405:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x73408:
diff --git a/maps/Route1718Gate.asm b/maps/Route1718Gate.asm
index a09dde909..e1650702b 100644
--- a/maps/Route1718Gate.asm
+++ b/maps/Route1718Gate.asm
@@ -33,8 +33,8 @@ UnknownScript_0x73617:
end
MovementData_0x73629:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x7362c:
diff --git a/maps/Route25.asm b/maps/Route25.asm
index 5fb6d3166..f49c4c3d4 100644
--- a/maps/Route25.asm
+++ b/maps/Route25.asm
@@ -197,47 +197,47 @@ Route25HiddenPotion:
MovementData_0x19efe8:
- big_step_down
+ big_step DOWN
step_end
MovementData_0x19efea:
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x19efed:
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x19eff4:
- step_up
- step_up
- step_left
- step_left
- step_left
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x19effa:
- step_down
- step_left
+ step DOWN
+ step LEFT
step_end
MovementData_0x19effd:
- step_up
- step_left
+ step UP
+ step LEFT
step_end
MovementData_0x19f000:
- step_left
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
UnknownText_0x19f006:
diff --git a/maps/Route26HealSpeechHouse.asm b/maps/Route26HealSpeechHouse.asm
index 7dd01776a..050493637 100644
--- a/maps/Route26HealSpeechHouse.asm
+++ b/maps/Route26HealSpeechHouse.asm
@@ -16,7 +16,7 @@ TeacherScript_0x7b125:
closetext
special Special_FadeBlackQuickly
special Special_ReloadSpritesNoPalettes
- special Mobile_HealParty
+ special TrainerRankings_Healings
playmusic MUSIC_HEAL
special HealParty
pause 60
diff --git a/maps/Route27.asm b/maps/Route27.asm
index 0f291364d..1ff42703a 100644
--- a/maps/Route27.asm
+++ b/maps/Route27.asm
@@ -310,12 +310,12 @@ Route27RareCandy:
itemball RARE_CANDY
MovementData_0x1a0a66:
- step_left
- step_left
+ step LEFT
+ step LEFT
step_end
MovementData_0x1a0a69:
- step_left
+ step LEFT
step_end
UnknownText_0x1a0a6b:
diff --git a/maps/Route29.asm b/maps/Route29.asm
index ab90ea757..629c4dd77 100644
--- a/maps/Route29.asm
+++ b/maps/Route29.asm
@@ -220,37 +220,37 @@ Route29Potion:
itemball POTION
DudeMovementData1a:
- step_up
- step_up
- step_up
- step_up
- step_right
- step_right
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
step_end
DudeMovementData2a:
- step_up
- step_up
- step_up
- step_right
- step_right
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
step_end
DudeMovementData1b:
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
DudeMovementData2b:
- step_left
- step_left
- step_down
- step_down
- step_down
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x1a10a7:
diff --git a/maps/Route30.asm b/maps/Route30.asm
index 640a17742..e4f1f03d3 100644
--- a/maps/Route30.asm
+++ b/maps/Route30.asm
@@ -253,14 +253,14 @@ Route30HiddenPotion:
Route30_JoeysRattataAttacksMovement:
fix_facing
- big_step_up
- big_step_down
+ big_step UP
+ big_step DOWN
step_end
Route30_MikeysRattataAttacksMovement:
fix_facing
- big_step_down
- big_step_up
+ big_step DOWN
+ big_step UP
step_end
Text_UseTackle:
diff --git a/maps/Route32.asm b/maps/Route32.asm
index cb12060b5..da9eb5c70 100644
--- a/maps/Route32.asm
+++ b/maps/Route32.asm
@@ -519,16 +519,16 @@ Route32HiddenSuperPotion:
Movement_Route32CooltrainerMPushesYouBackToViolet:
- step_up
- step_up
+ step UP
+ step UP
step_end
Movement_Route32CooltrainerMReset1:
- step_down
+ step DOWN
step_end
Movement_Route32CooltrainerMReset2:
- step_right
+ step RIGHT
step_end
Route32CooltrainerMText_WhatsTheHurry:
diff --git a/maps/Route34.asm b/maps/Route34.asm
index 582b7fa3d..607de8968 100644
--- a/maps/Route34.asm
+++ b/maps/Route34.asm
@@ -499,17 +499,17 @@ Route34HiddenSuperPotion:
Route34MovementData_DayCareManWalksBackInside:
- slow_step_left
- slow_step_left
- slow_step_up
+ slow_step LEFT
+ slow_step LEFT
+ slow_step UP
step_end
Route34MovementData_DayCareManWalksBackInside_WalkAroundPlayer:
- slow_step_down
- slow_step_left
- slow_step_left
- slow_step_up
- slow_step_up
+ slow_step DOWN
+ slow_step LEFT
+ slow_step LEFT
+ slow_step UP
+ slow_step UP
step_end
YoungsterSamuelSeenText:
diff --git a/maps/Route34IlexForestGate.asm b/maps/Route34IlexForestGate.asm
index fd5847f80..674bca42d 100644
--- a/maps/Route34IlexForestGate.asm
+++ b/maps/Route34IlexForestGate.asm
@@ -82,13 +82,13 @@ LassScript_0x62d94:
jumptextfaceplayer UnknownText_0x62e97
MovementData_0x62d97:
- step_up
- step_up
+ step UP
+ step UP
step_end
MovementData_0x62d9a:
- step_down
- step_right
+ step DOWN
+ step RIGHT
step_end
UnknownText_0x62d9d:
diff --git a/maps/Route35NationalParkgate.asm b/maps/Route35NationalParkgate.asm
index f20bf7be0..d2df78c46 100644
--- a/maps/Route35NationalParkgate.asm
+++ b/maps/Route35NationalParkgate.asm
@@ -216,18 +216,18 @@ Route35NationalParkgate_GetDayOfWeek:
end
MovementData_0x6a2e2:
- step_down
- turn_head_left
+ step DOWN
+ turn_head LEFT
step_end
MovementData_0x6a2e5:
- step_right
- step_up
- step_up
+ step RIGHT
+ step UP
+ step UP
step_end
MovementData_0x6a2e9:
- step_up
+ step UP
step_end
UnknownText_0x6a2eb:
diff --git a/maps/Route36.asm b/maps/Route36.asm
index 6b25577b7..02ca0e9cd 100644
--- a/maps/Route36.asm
+++ b/maps/Route36.asm
@@ -99,7 +99,7 @@ DidntCatchSudowoodo:
applymovement ROUTE36_WEIRD_TREE, WeirdTreeMovement_Flee
disappear ROUTE36_WEIRD_TREE
variablesprite SPRITE_WEIRD_TREE, SPRITE_TWIN
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
special RefreshSprites
end
@@ -376,42 +376,42 @@ SudowoodoShakeMovement:
step_end
WeirdTreeMovement_Flee:
- fast_jump_step_up
- fast_jump_step_up
+ fast_jump_step UP
+ fast_jump_step UP
step_end
FloriaMovement1:
- step_down
- step_down
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
FloriaMovement2:
- step_left
- step_down
- step_down
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
Route36SuicuneMovement:
set_sliding
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_right
- fast_jump_step_right
- fast_jump_step_right
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
remove_sliding
step_end
diff --git a/maps/Route36NationalParkgate.asm b/maps/Route36NationalParkgate.asm
index 3c4527813..d55cc48cf 100644
--- a/maps/Route36NationalParkgate.asm
+++ b/maps/Route36NationalParkgate.asm
@@ -475,9 +475,9 @@ UnknownScript_0x6adce:
jumptext UnknownText_0x6b84c
MovementData_0x6add1:
- big_step_down
- big_step_right
- turn_head_up
+ big_step DOWN
+ big_step RIGHT
+ turn_head UP
step_end
UnknownText_0x6add5:
diff --git a/maps/Route40.asm b/maps/Route40.asm
index a0bddde89..6ae3d5922 100644
--- a/maps/Route40.asm
+++ b/maps/Route40.asm
@@ -141,28 +141,28 @@ Route40HiddenHyperPotion:
dwb EVENT_ROUTE_40_HIDDEN_HYPER_POTION, HYPER_POTION
MovementData_0x1a621c:
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a6224:
- step_up
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a622a:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
SwimmermSimonSeenText:
diff --git a/maps/Route42.asm b/maps/Route42.asm
index 2e4caf940..b9007bb08 100644
--- a/maps/Route42.asm
+++ b/maps/Route42.asm
@@ -219,12 +219,12 @@ Route42HiddenMaxPotion:
MovementData_0x1a9356:
db $39 ; movement
- fast_jump_step_up
- fast_jump_step_up
- fast_jump_step_up
- fast_jump_step_right
- fast_jump_step_right
- fast_jump_step_right
+ fast_jump_step UP
+ fast_jump_step UP
+ fast_jump_step UP
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
db $38 ; movement
step_end
diff --git a/maps/Route43Gate.asm b/maps/Route43Gate.asm
index 42801472b..8cf2e73ff 100644
--- a/maps/Route43Gate.asm
+++ b/maps/Route43Gate.asm
@@ -132,69 +132,69 @@ UnknownScript_0x19aca0:
end
MovementData_0x19aca2:
- step_down
+ step DOWN
step_end
MovementData_0x19aca4:
- big_step_up
- big_step_up
- big_step_right
- big_step_right
- turn_head_up
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step RIGHT
+ turn_head UP
step_end
MovementData_0x19acaa:
- big_step_left
- big_step_left
- big_step_down
- big_step_down
+ big_step LEFT
+ big_step LEFT
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x19acaf:
- big_step_down
- big_step_down
- big_step_right
- big_step_right
- turn_head_down
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step RIGHT
+ turn_head DOWN
step_end
MovementData_0x19acb5:
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- turn_head_down
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ turn_head DOWN
step_end
MovementData_0x19acbb:
- big_step_up
- big_step_up
- big_step_left
- big_step_left
- turn_head_up
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ turn_head UP
step_end
MovementData_0x19acc1:
- big_step_right
- big_step_right
- big_step_down
- big_step_down
- turn_head_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ turn_head UP
step_end
MovementData_0x19acc7:
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- turn_head_down
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ turn_head DOWN
step_end
MovementData_0x19accd:
- big_step_right
- big_step_right
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
step_end
UnknownText_0x19acd2:
diff --git a/maps/RuinsofAlphOutside.asm b/maps/RuinsofAlphOutside.asm
index c8acac06a..8cad45e29 100644
--- a/maps/RuinsofAlphOutside.asm
+++ b/maps/RuinsofAlphOutside.asm
@@ -140,20 +140,20 @@ MapRuinsofAlphOutsideSignpost2Script:
jumptext UnknownText_0x58362
MovementData_0x580ba:
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_right
- step_right
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
MovementData_0x580c5:
- step_up
+ step UP
step_end
UnknownText_0x580c7:
diff --git a/maps/RuinsofAlphResearchCenter.asm b/maps/RuinsofAlphResearchCenter.asm
index 988198340..b1d0f45c5 100644
--- a/maps/RuinsofAlphResearchCenter.asm
+++ b/maps/RuinsofAlphResearchCenter.asm
@@ -181,18 +181,18 @@ MapRuinsofAlphResearchCenterSignpost0Script:
jumptext UnknownText_0x59886
MovementData_0x5926f:
- step_up
- step_up
- step_left
- turn_head_up
+ step UP
+ step UP
+ step LEFT
+ turn_head UP
step_end
MovementData_0x59274:
- step_down
+ step DOWN
step_end
MovementData_0x59276:
- step_up
+ step UP
step_end
UnknownText_0x59278:
diff --git a/maps/SaffronTrainStation.asm b/maps/SaffronTrainStation.asm
index 14e3722a8..5b14dc196 100644
--- a/maps/SaffronTrainStation.asm
+++ b/maps/SaffronTrainStation.asm
@@ -47,7 +47,7 @@ OfficerScript_0x18a81e:
end
.MovementBoardTheTrain:
- turn_head_down
+ turn_head DOWN
step_end
.PassNotInBag:
@@ -95,37 +95,37 @@ LassScript_0x18a88c:
jumptextfaceplayer UnknownText_0x18ab20
MovementData_0x18a88f:
- step_up
- step_up
- step_right
- turn_head_left
+ step UP
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x18a894:
- step_left
- step_down
- step_down
+ step LEFT
+ step DOWN
+ step DOWN
step_end
MovementData_0x18a898:
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x18a8a1:
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
- turn_head_up
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ turn_head UP
step_end
UnknownText_0x18a8a9:
diff --git a/maps/SlowpokeWellB1F.asm b/maps/SlowpokeWellB1F.asm
index b905140f8..b7bc61906 100644
--- a/maps/SlowpokeWellB1F.asm
+++ b/maps/SlowpokeWellB1F.asm
@@ -127,21 +127,21 @@ SlowpokeWellB1FSuperPotion:
itemball SUPER_POTION
KurtSlowpokeWellVictoryMovementData:
- step_left
- step_left
- step_left
- step_left
- step_up
- step_sleep_8
- step_sleep_8
- step_sleep_8
- step_left
- step_up
- step_up
- step_sleep_8
- step_sleep_8
- step_sleep_8
- turn_head_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step_sleep 8
+ step_sleep 8
+ step_sleep 8
+ step LEFT
+ step UP
+ step UP
+ step_sleep 8
+ step_sleep 8
+ step_sleep 8
+ turn_head LEFT
step_end
UnknownText_0x5a6b5:
diff --git a/maps/SproutTower3F.asm b/maps/SproutTower3F.asm
index 03c49ee0b..ee6420d35 100644
--- a/maps/SproutTower3F.asm
+++ b/maps/SproutTower3F.asm
@@ -140,19 +140,19 @@ SproutTower3FEscapeRope:
itemball ESCAPE_ROPE
MovementData_0x184a1d:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x184a22:
- step_up
+ step UP
step_end
MovementData_0x184a24:
- step_right
- step_down
+ step RIGHT
+ step DOWN
step_end
UnknownText_0x184a27:
diff --git a/maps/TeamRocketBaseB1F.asm b/maps/TeamRocketBaseB1F.asm
index 9bbda8eae..fad534c8b 100644
--- a/maps/TeamRocketBaseB1F.asm
+++ b/maps/TeamRocketBaseB1F.asm
@@ -549,91 +549,91 @@ TeamRocketBaseB1FHiddenRevive:
SecurityCameraMovement1:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
SecurityCameraMovement2:
- big_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- turn_head_right
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ turn_head RIGHT
step_end
SecurityCameraMovement3:
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
SecurityCameraMovement4:
; he jumps over a trap
- jump_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- turn_head_right
+ jump_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ turn_head RIGHT
step_end
SecurityCameraMovement5:
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
SecurityCameraMovement6:
- big_step_up
- big_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_left
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
step_end
SecurityCameraMovement7:
- big_step_up
- big_step_up
- big_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_left
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step LEFT
step_end
SecurityCameraMovement8:
- big_step_down
- big_step_down
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- big_step_left
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
SecurityCameraMovement9:
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
CameraGrunt1SeenText:
diff --git a/maps/TeamRocketBaseB2F.asm b/maps/TeamRocketBaseB2F.asm
index 01713758e..25994fc92 100644
--- a/maps/TeamRocketBaseB2F.asm
+++ b/maps/TeamRocketBaseB2F.asm
@@ -172,7 +172,7 @@ LanceHealsCommon:
waitbutton
closetext
special FadeOutPalettes
- special Mobile_HealParty
+ special TrainerRankings_Healings
playsound SFX_FULL_HEAL
special HealParty
special FadeInPalettes
@@ -367,204 +367,204 @@ TeamRocketBaseB2FHiddenFullHeal:
MovementData_0x6d212:
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d219:
- step_right
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d21f:
- step_down
- step_down
- step_down
- turn_head_right
+ step DOWN
+ step DOWN
+ step DOWN
+ turn_head RIGHT
step_end
MovementData_0x6d224:
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- turn_head_down
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ turn_head DOWN
step_end
MovementData_0x6d22f:
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_0x6d236:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_0x6d23b:
fix_facing
db $39 ; movement
- jump_step_right
+ jump_step RIGHT
db $38 ; movement
remove_fixed_facing
step_end
MovementData_0x6d241:
- slow_step_down
- turn_head_left
+ slow_step DOWN
+ turn_head LEFT
step_end
MovementData_0x6d244:
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d248:
- big_step_left
+ big_step LEFT
step_end
MovementData_0x6d24a:
- big_step_left
+ big_step LEFT
step_end
MovementData_0x6d24c:
- big_step_left
- big_step_up
- turn_head_left
+ big_step LEFT
+ big_step UP
+ turn_head LEFT
step_end
MovementData_0x6d250:
- step_right
- step_right
- turn_head_down
+ step RIGHT
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_0x6d254:
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x6d258:
- step_sleep_8
- step_left
- step_left
- turn_head_up
- step_sleep_8
- step_right
- step_right
- step_right
- step_right
- turn_head_up
- step_sleep_8
- step_left
- step_left
- turn_head_down
+ step_sleep 8
+ step LEFT
+ step LEFT
+ turn_head UP
+ step_sleep 8
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
+ step_sleep 8
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
MovementData_0x6d267:
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x6d271:
- step_up
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x6d278:
- step_left
+ step LEFT
step_end
MovementData_0x6d27a:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x6d283:
- step_down
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x6d28c:
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d299:
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d2a4:
- step_right
- step_right
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
UnknownText_0x6d2ad:
diff --git a/maps/TeamRocketBaseB3F.asm b/maps/TeamRocketBaseB3F.asm
index 049559b51..d3826b94e 100644
--- a/maps/TeamRocketBaseB3F.asm
+++ b/maps/TeamRocketBaseB3F.asm
@@ -226,101 +226,101 @@ TeamRocketBaseB3FUltraBall:
itemball ULTRA_BALL
MovementData_0x6e12a:
- step_right
+ step RIGHT
step_end
MovementData_0x6e12c:
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x6e133:
- step_up
- step_up
- step_up
- step_left
- step_left
- turn_head_up
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x6e13a:
- step_up
- step_up
- step_left
- step_up
- step_left
- step_left
- turn_head_up
+ step UP
+ step UP
+ step LEFT
+ step UP
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x6e142:
- step_down
+ step DOWN
step_end
MovementData_0x6e144:
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_0x6e147:
fix_facing
- fast_jump_step_left
+ fast_jump_step LEFT
remove_fixed_facing
- step_sleep_8
- step_sleep_8
- slow_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ step_sleep 8
+ step_sleep 8
+ slow_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
RocketBaseRivalEnterMovement:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_right
- step_right
- step_right
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
RocketBaseRivalLeaveMovement:
- step_left
- step_left
- step_up
- step_up
- step_up
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
RocketBaseRivalShovesPlayerMovement:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
step_end
diff --git a/maps/TinTower1F.asm b/maps/TinTower1F.asm
index 2613f1630..c2b88b2a1 100644
--- a/maps/TinTower1F.asm
+++ b/maps/TinTower1F.asm
@@ -236,83 +236,83 @@ TinTowerEusine:
jumptextfaceplayer TinTowerEusineHoOhText
TinTowerPlayerMovement1:
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_up
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
TinTowerRaikouMovement1:
set_sliding
- fast_jump_step_down
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerRaikouMovement2:
set_sliding
- fast_jump_step_down
- fast_jump_step_right
- fast_jump_step_down
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerEnteiMovement1:
set_sliding
- fast_jump_step_down
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerEnteiMovement2:
set_sliding
- fast_jump_step_down
- fast_jump_step_left
- fast_jump_step_down
+ fast_jump_step DOWN
+ fast_jump_step LEFT
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerSuicuneMovement:
set_sliding
- fast_jump_step_down
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerPlayerMovement2:
fix_facing
- big_step_down
+ big_step DOWN
remove_fixed_facing
step_end
MovementData_0x1851ec:
- step_up
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ step UP
+ turn_head LEFT
step_end
MovementData_0x1851f1:
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x1851f5:
- step_up
- step_up
- step_left
- step_left
- turn_head_up
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x1851fb:
- step_up
- step_up
+ step UP
+ step UP
step_end
MovementData_0x1851fe:
- step_up
- step_right
- step_right
- step_up
+ step UP
+ step RIGHT
+ step RIGHT
+ step UP
step_end
TinTowerEusineSuicuneText:
diff --git a/maps/TrainerHouseB1F.asm b/maps/TrainerHouseB1F.asm
index bca44441c..c96f5973b 100644
--- a/maps/TrainerHouseB1F.asm
+++ b/maps/TrainerHouseB1F.asm
@@ -77,40 +77,40 @@ TrainerHouseReceptionistScript:
end
Movement_EnterTrainerHouseBattleRoom:
- step_left
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_left
- turn_head_right
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ turn_head RIGHT
step_end
Movement_ExitTrainerHouseBattleRoom:
- step_up
- step_up
- step_up
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
- step_right
- step_right
- step_right
- step_right
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
Movement_TrainerHouseTurnBack:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
TrainerHouseB1FIntroText:
diff --git a/maps/UndergroundPathSwitchRoomEntrances.asm b/maps/UndergroundPathSwitchRoomEntrances.asm
index 0fcff3c0e..85427ade3 100644
--- a/maps/UndergroundPathSwitchRoomEntrances.asm
+++ b/maps/UndergroundPathSwitchRoomEntrances.asm
@@ -643,33 +643,33 @@ UndergroundPathSwitchRoomEntrancesHiddenRevive:
UndergroundSilverApproachMovement1:
- step_down
- step_left
- step_left
- step_left
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
step_end
UndergroundSilverApproachMovement2:
- step_down
- step_down
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
step_end
UndergroundSilverRetreatMovement1:
- step_right
- step_right
- step_right
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
step_end
UndergroundSilverRetreatMovement2:
- step_right
- step_right
- step_right
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
UndergroundSilverBeforeText:
diff --git a/maps/VermilionPort.asm b/maps/VermilionPort.asm
index bd2cd6e97..4cbb78604 100644
--- a/maps/VermilionPort.asm
+++ b/maps/VermilionPort.asm
@@ -203,34 +203,34 @@ VermilionPortHiddenIron:
MovementData_0x74ef1:
- step_down
+ step DOWN
step_end
MovementData_0x74ef3:
- step_up
+ step UP
step_end
MovementData_0x74ef5:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x74ef8:
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x74efe:
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x74f06:
diff --git a/maps/VictoryRoad.asm b/maps/VictoryRoad.asm
index 7ebead201..3b85a534a 100644
--- a/maps/VictoryRoad.asm
+++ b/maps/VictoryRoad.asm
@@ -122,49 +122,49 @@ VictoryRoadHiddenFullHeal:
MovementData_0x74539:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x74542:
- step_up
- step_up
- step_left
- step_left
- step_left
- step_left
- step_left
- step_up
- step_up
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x7454c:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x74555:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
step_end
UnknownText_0x7455f:
diff --git a/maps/VictoryRoadGate.asm b/maps/VictoryRoadGate.asm
index 8195ac971..08737c111 100644
--- a/maps/VictoryRoadGate.asm
+++ b/maps/VictoryRoadGate.asm
@@ -52,7 +52,7 @@ BlackBeltScript_0x9ba24:
jumptextfaceplayer UnknownText_0x9bb37
MovementData_0x9ba27:
- step_down
+ step DOWN
step_end
UnknownText_0x9ba29:
diff --git a/maps/VioletCity.asm b/maps/VioletCity.asm
index a67c59e71..87ec32077 100644
--- a/maps/VioletCity.asm
+++ b/maps/VioletCity.asm
@@ -103,82 +103,82 @@ VioletCityHiddenHyperPotion:
dwb EVENT_VIOLET_CITY_HIDDEN_HYPER_POTION, HYPER_POTION
VioletCityFollowEarl_MovementData:
- big_step_down
- big_step_down
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- big_step_down
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- big_step_up
- turn_head_down
+ big_step DOWN
+ big_step DOWN
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ big_step DOWN
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ big_step UP
+ turn_head DOWN
step_end
VioletCityFinishFollowEarl_MovementData:
- step_up
+ step UP
step_end
VioletCitySpinningEarl_MovementData:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
Text_EarlAsksIfYouBeatFalkner:
diff --git a/maps/VioletPokeCenter1F.asm b/maps/VioletPokeCenter1F.asm
index 117897a21..607c8e915 100644
--- a/maps/VioletPokeCenter1F.asm
+++ b/maps/VioletPokeCenter1F.asm
@@ -88,21 +88,21 @@ YoungsterScript_0x69546:
jumptextfaceplayer UnknownText_0x698b8
MovementData_AideWalksStraightOutOfPokecenter:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_AideWalksLeftToExitPokecenter:
- step_left
- step_down
+ step LEFT
+ step DOWN
step_end
MovementData_AideFinishesLeavingPokecenter:
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x69555:
diff --git a/maps/WillsRoom.asm b/maps/WillsRoom.asm
index a63f6b478..cc3986c33 100644
--- a/maps/WillsRoom.asm
+++ b/maps/WillsRoom.asm
@@ -79,10 +79,10 @@ UnknownScript_0x180526:
end
MovementData_0x18052c:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x180531:
diff --git a/maps/WiseTriosRoom.asm b/maps/WiseTriosRoom.asm
index 8bdb0f700..2aab72239 100644
--- a/maps/WiseTriosRoom.asm
+++ b/maps/WiseTriosRoom.asm
@@ -121,18 +121,18 @@ UnknownScript_0x9861b:
end
MovementData_0x98622:
- step_left
- step_left
+ step LEFT
+ step LEFT
step_end
MovementData_0x98625:
- step_right
- step_down
+ step RIGHT
+ step DOWN
step_end
MovementData_0x98628:
- step_right
- step_down
+ step RIGHT
+ step DOWN
step_end
UnknownText_0x9862b:
diff --git a/misc/battle_tower_47.asm b/misc/battle_tower_47.asm
index a11f61064..f9e2ac0ea 100755
--- a/misc/battle_tower_47.asm
+++ b/misc/battle_tower_47.asm
@@ -61,9 +61,8 @@ ENDC
.okay2
push af
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
@@ -72,9 +71,8 @@ endr
pop af
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
@@ -83,7 +81,7 @@ endr
bccoord 1, 14
pop af
ld [rSVBK], a
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 11c05d
diff --git a/misc/battle_tower_5c.asm b/misc/battle_tower_5c.asm
index fb441a3f8..09c827146 100755
--- a/misc/battle_tower_5c.asm
+++ b/misc/battle_tower_5c.asm
@@ -111,7 +111,7 @@ Function170139: ; 170139
call CopyBytes
ld bc, PlayerID
ld de, PlayerGender
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld de, wBT_OTTempPkmn1CaughtGender
ld a, c
ld [de], a
@@ -217,9 +217,8 @@ _BattleTowerBattle: ; 17022c
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -244,7 +243,7 @@ RunBattleTowerTrainer: ; 17024d
xor a
ld [wLinkMode], a
- callba Mobile_HealParty
+ callba TrainerRankings_Healings
callba HealParty
call ReadBTTrainerParty
call Clears5_a89a
@@ -459,9 +458,8 @@ endr
ld a, POUND
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
jr .done_moves
@@ -489,9 +487,8 @@ endr
predef CalcPkmnStats
pop de
pop hl
-rept 2
dec de
-endr
+ dec de
ld a, [hli]
ld [de], a
inc de
@@ -690,9 +687,8 @@ Function1704e1: ; 1704e1
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -908,9 +904,8 @@ endr
ld [hli], a
dec c
jr nz, .clearbox_column
-rept 2
inc hl
-endr
+ inc hl
dec b
jr nz, .clearbox_row
ret
@@ -947,9 +942,8 @@ BattleTowerAction: ; 170687
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1393,9 +1387,8 @@ rept 4
dec hl
endr
ld a, "@"
-rept 2
ld [hli], a
-endr
+ ld [hli], a
pop hl
ld a, EGG_TICKET
ld [CurItem], a
@@ -1445,9 +1438,8 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10
ld e, a
ld d, 0
ld hl, Jumptable_1709e7
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/misc/crystal_misc.asm b/misc/crystal_misc.asm
index 01538a3d6..66f0a92ae 100644
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -47,7 +47,7 @@ Function17a6a8: ; 17a6a8 (5e:66a8)
call Function17aba0
callba Function106464
call Function17ac0c
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
call Function17abcf
callba LoadOW_BGPal7
callba Function49420
@@ -169,7 +169,7 @@ Function17a78f: ; 17a78f (5e:678f)
bit 7, [hl]
res 7, [hl]
jr nz, .asm_17a79f
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
.asm_17a79f
@@ -576,16 +576,16 @@ Function17aa22: ; 17aa22 (5e:6a22)
push de
ld a, $3
call Function17aae0
-rept 3
add a
-endr
+ add a
+ add a
add $0
push af
ld a, $4
call Function17aae0
-rept 3
add a
-endr
+ add a
+ add a
add $8
ld c, a
pop af
@@ -682,15 +682,13 @@ Function17aaa9: ; 17aaa9 (5e:6aa9)
Function17aac3: ; 17aac3 (5e:6ac3)
ld a, $b
push hl
-rept 2
ld [hli], a
-endr
+ ld [hli], a
pop hl
ld de, SCREEN_WIDTH
add hl, de
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ret
Function17aad0: ; 17aad0 (5e:6ad0)
diff --git a/misc/fixed_words.asm b/misc/fixed_words.asm
index ed4160351..14ef91e9d 100755
--- a/misc/fixed_words.asm
+++ b/misc/fixed_words.asm
@@ -4,24 +4,23 @@
Function11c05d: ; 11c05d
ld a, e
or d
- jr z, .asm_11c071
+ jr z, .error
ld a, e
and d
cp $ff
- jr z, .asm_11c071
+ jr z, .error
push hl
- call Function11c156
+ call CopyMobileEZChatToC608
pop hl
call PlaceString
and a
ret
-.asm_11c071
+.error
ld c, l
ld b, h
scf
ret
-
; 11c075
Function11c075: ; 11c075
@@ -32,26 +31,25 @@ Function11c075: ; 11c075
ld bc, wcd36
call Function11c08f
ret
-
; 11c082
Function11c082: ; 11c082
+; XXX
push de
ld a, c
call Function11c254
pop de
ld bc, wcd36
- call Function11c0c6
+ call PrintEZChatBattleMessage
ret
-
; 11c08f
Function11c08f: ; 11c08f
ld l, e
ld h, d
push hl
- ld a, $3
-.asm_11c094
+ ld a, 3
+.loop
push af
ld a, [bc]
ld e, a
@@ -61,21 +59,21 @@ Function11c08f: ; 11c08f
inc bc
push bc
call Function11c05d
- jr c, .asm_11c0a2
+ jr c, .okay
inc bc
-.asm_11c0a2
+.okay
ld l, c
ld h, b
pop bc
pop af
dec a
- jr nz, .asm_11c094
+ jr nz, .loop
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
ld a, $3
-.asm_11c0b0
+.loop2
push af
ld a, [bc]
ld e, a
@@ -85,139 +83,160 @@ Function11c08f: ; 11c08f
inc bc
push bc
call Function11c05d
- jr c, .asm_11c0be
+ jr c, .okay2
inc bc
-.asm_11c0be
+.okay2
ld l, c
ld h, b
pop bc
pop af
dec a
- jr nz, .asm_11c0b0
+ jr nz, .loop2
ret
-
; 11c0c6
-
-Function11c0c6: ; 11c0c6
+PrintEZChatBattleMessage: ; 11c0c6
+; Use up to 6 words from bc to print text starting at de.
+ ; Preserve $cf63, $cf64
ld a, [wJumptableIndex]
ld l, a
ld a, [wcf64]
ld h, a
push hl
- ld hl, $c608 + 16
+ ; reset value at c618 (not preserved)
+ ld hl, $c618
ld a, $0
ld [hli], a
+ ; preserve de
push de
+ ; $cf63 keeps track of which line we're on (0, 1, or 2)
+ ; $cf64 keeps track of how much room we have left in the current line
xor a
ld [wJumptableIndex], a
- ld a, $12
+ ld a, 18
ld [wcf64], a
- ld a, $6
-.asm_11c0e1
+ ld a, $6 ; up to 6 times
+.loop
push af
+ ; load the 2-byte word data pointed to by bc
ld a, [bc]
ld e, a
inc bc
ld a, [bc]
ld d, a
inc bc
+ ; if $0000, we're done
or e
- jr z, .asm_11c133
+ jr z, .done
+ ; preserving hl and bc, get the length of the word
push hl
push bc
- call Function11c156
- call Function11c14a
+ call CopyMobileEZChatToC608
+ call GetLengthOfWordAtC608
ld e, c
pop bc
pop hl
+ ; if the functions return 0, we're done
ld a, e
or a
- jr z, .asm_11c133
-.asm_11c0fa
+ jr z, .done
+.loop2
+ ; e contains the length of the word
+ ; add 1 for the space, unless we're at the start of the line
ld a, [wcf64]
- cp $12
- jr z, .asm_11c102
+ cp 18
+ jr z, .skip_inc
inc e
-.asm_11c102
+.skip_inc
+ ; if the word fits, put it on the same line
cp e
- jr nc, .asm_11c11c
+ jr nc, .same_line
+ ; otherwise, go to the next line
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
- ld [hl], $4e
+ ; if we're on line 2, insert "<NEXT>"
+ ld [hl], "<NEXT>"
rra
- jr c, .asm_11c113
- ld [hl], $55
+ jr c, .got_line_terminator
+ ; else, insert "<CONT>"
+ ld [hl], "<CONT>"
-.asm_11c113
+.got_line_terminator
inc hl
- ld a, $12
+ ; init the next line, holding on to the same word
+ ld a, 18
ld [wcf64], a
dec e
- jr .asm_11c0fa
+ jr .loop2
-.asm_11c11c
- cp $12
- jr z, .asm_11c123
- ld [hl], $7f
+.same_line
+ ; add the space, unless we're at the start of the line
+ cp 18
+ jr z, .skip_space
+ ld [hl], " "
inc hl
-.asm_11c123
+.skip_space
+ ; deduct the length of the word
sub e
ld [wcf64], a
ld de, $c608
-.asm_11c12a
+.place_string_loop
+ ; load the string from de to hl
ld a, [de]
- cp $50
- jr z, .asm_11c133
+ cp "@"
+ jr z, .done
inc de
ld [hli], a
- jr .asm_11c12a
+ jr .place_string_loop
-.asm_11c133
+.done
+ ; next word?
pop af
dec a
- jr nz, .asm_11c0e1
- ld [hl], $57
+ jr nz, .loop
+ ; we're finished, place "<DONE>"
+ ld [hl], "<DONE>"
+ ; now, let's place the string from c618 to bc
pop bc
- ld hl, $c608 + 16
- call PlaceWholeStringInBoxAtOnce
+ ld hl, $c618
+ call PlaceHLTextAtBC
+ ; restore the original values of $cf63 and $cf64
pop hl
ld a, l
ld [wJumptableIndex], a
ld a, h
ld [wcf64], a
ret
-
; 11c14a
-Function11c14a: ; 11c14a
+GetLengthOfWordAtC608: ; 11c14a
ld c, $0
ld hl, $c608
-.asm_11c14f
+.loop
ld a, [hli]
- cp $50
+ cp "@"
ret z
inc c
- jr .asm_11c14f
+ jr .loop
; 11c156
-Function11c156: ; 11c156
+CopyMobileEZChatToC608: ; 11c156
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
- ld a, $50
+ ld a, "@"
ld hl, $c608
- ld bc, $000b
+ ld bc, NAME_LENGTH
call ByteFill
ld a, d
and a
jr z, .get_name
- ld hl, MobileFixedWordCategoryPointers
+ ld hl, MobileEZChatCategoryPointers
dec d
sla d
ld c, d
@@ -239,7 +258,7 @@ Function11c156: ; 11c156
rl b
add hl, bc
ld bc, 5 ; length of a string
-.loop
+.copy_string
ld de, $c608
call CopyBytes
ld de, $c608
@@ -253,7 +272,7 @@ Function11c156: ; 11c156
call GetPokemonName
ld hl, StringBuffer1
ld bc, PKMN_NAME_LENGTH - 1
- jr .loop
+ jr .copy_string
; 11c1ab
Function11c1ab: ; 11c1ab
@@ -265,23 +284,21 @@ Function11c1ab: ; 11c1ab
pop af
ld [hInMenu], a
ret
-
; 11c1b9
Function11c1b9: ; 11c1b9
- call Function11c1ca
+ call .InitKanaMode
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
- call Function11c283
+ call EZChat_MasterLoop
pop af
ld [rSVBK], a
ret
-
; 11c1ca
-Function11c1ca: ; 11c1ca
+.InitKanaMode: ; 11c1ca
xor a
ld [wJumptableIndex], a
ld [wcf64], a
@@ -326,10 +343,9 @@ Function11c1ca: ; 11c1ca
call CopyBytes
pop af
ld [rSVBK], a
- call Function11d4aa
- call Function11d3ba
+ call EZChat_GetCategoryWordsByKana
+ call EZChat_GetSeenPokemonByKana
ret
-
; 11c254
Function11c254: ; 11c254
@@ -347,22 +363,20 @@ Function11c254: ; 11c254
ld b, $0
add hl, bc
ld de, wcd36
- ld bc, $000c
+ ld bc, 12
call CopyBytes
call CloseSRAM
ret
-
; 11c277
-
-Function11c277: ; 11c277 (47:4277)
+EZChat_ClearBottom12Rows: ; 11c277 (47:4277)
ld a, " "
hlcoord 0, 6
ld bc, (SCREEN_HEIGHT - 6) * SCREEN_WIDTH
call ByteFill
ret
-Function11c283: ; 11c283
+EZChat_MasterLoop: ; 11c283
.loop
call JoyTextDelay
ld a, [hJoyPressed]
@@ -379,17 +393,15 @@ Function11c283: ; 11c283
callba ClearSpriteAnims
call ClearSprites
ret
-
; 11c2ac
.DoJumptableFunction: ; 11c2ac
jumptable .Jumptable, wJumptableIndex
; 11c2bb
-
.Jumptable: ; 11c2bb (47:42bb)
- dw Function11c2e9 ; 00
- dw Function11c346 ; 01
+ dw .SpawnObjects ; 00
+ dw .InitRAM ; 01
dw Function11c35f ; 02
dw Function11c373 ; 03
dw Function11c3c2 ; 04
@@ -412,52 +424,57 @@ Function11c283: ; 11c283
dw Function11ce0b ; 15
dw Function11ce2b ; 16
-
-Function11c2e9: ; 11c2e9 (47:42e9)
+.SpawnObjects: ; 11c2e9 (47:42e9)
depixel 3, 1, 2, 5
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
depixel 8, 1, 2, 5
+
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $1
ld [hl], a
+
depixel 9, 2, 2, 0
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $3
ld [hl], a
+
depixel 10, 16
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $4
ld [hl], a
+
depixel 10, 4
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $5
ld [hl], a
+
depixel 10, 2
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $2
ld [hl], a
+
ld hl, wcd23
set 1, [hl]
set 2, [hl]
jp Function11cfb5
-Function11c346: ; 11c346 (47:4346)
+.InitRAM: ; 11c346 (47:4346)
ld a, $9
ld [wcd2d], a
ld a, $2
@@ -535,7 +552,6 @@ Function11c38a: ; 11c38a (47:438a)
dec a
jr nz, .asm_11c392
ret
-
; 11c3bc (47:43bc)
String_11c3bc: ; 11c3bc
@@ -543,7 +559,7 @@ String_11c3bc: ; 11c3bc
; 11c3c2
Function11c3c2: ; 11c3c2 (47:43c2)
- call Function11c277
+ call EZChat_ClearBottom12Rows
ld de, Unknown_11cfbe
call Function11d035
hlcoord 1, 7
@@ -560,7 +576,7 @@ Function11c3c2: ; 11c3c2 (47:43c2)
call Function11cfb5
Function11c3ed: ; 11c3ed (47:43ed)
- ld hl, wcd20 ; wcd20 (aliases: CreditsPos)
+ ld hl, wcd20 ; wcd20
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $8
@@ -595,11 +611,11 @@ Function11c3ed: ; 11c3ed (47:43ed)
jr .asm_11c475
.asm_11c426
ld a, $8
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
ret
.asm_11c42c
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
cp $6
jr c, .asm_11c472
sub $6
@@ -705,7 +721,6 @@ Function11c4be: ; 11c4be (47:44be)
call ByteFill
callba ReloadMapPart
ret
-
; 11c4db (47:44db)
String_11c4db: ; 11c4db
@@ -721,8 +736,8 @@ String_11c51b: ; 11c51b
; 11c52c
Function11c52c: ; 11c52c (47:452c)
- call Function11c277
- call Function11c5f0
+ call EZChat_ClearBottom12Rows
+ call EZChat_PlaceCategoryNames
call Function11c618
ld hl, wcd24
res 1, [hl]
@@ -770,47 +785,47 @@ Function11c53d: ; 11c53d (47:453d)
.a
ld a, [wcd21]
- cp $f
- jr c, .asm_11c59d
+ cp 15
+ jr c, .got_category
sub $f
- jr z, .asm_11c5ab
+ jr z, .done
dec a
- jr z, .asm_11c599
+ jr z, .mode
jr .b
.start
ld hl, wcd24
set 0, [hl]
ld a, $8
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
.b
ld a, $4
- jr .asm_11c59f
+ jr .go_to_function
.select
ld a, [wcd2b]
xor $1
ld [wcd2b], a
ld a, $15
- jr .asm_11c59f
+ jr .go_to_function
-.asm_11c599
+.mode
ld a, $13
- jr .asm_11c59f
+ jr .go_to_function
-.asm_11c59d
+.got_category
ld a, $8
-.asm_11c59f
+.go_to_function
ld hl, wcd24
set 1, [hl]
ld [wJumptableIndex], a
call PlayClickSFX
ret
-.asm_11c5ab
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+.done
+ ld a, [wcd20] ; wcd20
call Function11ca6a
call PlayClickSFX
ret
@@ -820,14 +835,14 @@ Function11c53d: ; 11c53d (47:453d)
cp $3
ret c
sub $3
- jr .asm_11c5ee
+ jr .finish_dpad
.down
ld a, [hl]
cp $f
ret nc
add $3
- jr .asm_11c5ee
+ jr .finish_dpad
.left
ld a, [hl]
@@ -844,7 +859,7 @@ Function11c53d: ; 11c53d (47:453d)
cp $f
ret z
dec a
- jr .asm_11c5ee
+ jr .finish_dpad
.right
ld a, [hl]
@@ -862,17 +877,16 @@ Function11c53d: ; 11c53d (47:453d)
ret z
inc a
-.asm_11c5ee
+.finish_dpad
ld [hl], a
ret
-
; 11c5f0
-Function11c5f0: ; 11c5f0 (47:45f0)
- ld de, MobileFixedWordCategoryNames
- ld bc, Unknown_11c63a
- ld a, $f
-.asm_11c5f8
+EZChat_PlaceCategoryNames: ; 11c5f0 (47:45f0)
+ ld de, MobileEZChatCategoryNames
+ ld bc, Coords_11c63a
+ ld a, 15
+.loop
push af
ld a, [bc]
inc bc
@@ -882,17 +896,20 @@ Function11c5f0: ; 11c5f0 (47:45f0)
ld h, a
push bc
call PlaceString
-.asm_11c603
+ ; The category names are padded with "@".
+ ; To find the next category, the system must
+ ; find the first character at de that is not "@".
+.find_next_string_loop
inc de
ld a, [de]
- cp $50
- jr z, .asm_11c603
+ cp "@"
+ jr z, .find_next_string_loop
pop bc
pop af
dec a
- jr nz, .asm_11c5f8
+ jr nz, .loop
hlcoord 1, 17
- ld de, String_11c62a
+ ld de, EZChatString_Stop_Mode_Cancel
call PlaceString
ret
@@ -903,14 +920,13 @@ Function11c618: ; 11c618 (47:4618)
call ByteFill
callba ReloadMapPart
ret
-
; 11c62a (47:462a)
-String_11c62a: ; 11c62a
+EZChatString_Stop_Mode_Cancel: ; 11c62a
db "けす モード やめる@"
; 11c63a
-Unknown_11c63a: ; 11c63a
+Coords_11c63a: ; 11c63a
dwcoord 1, 7
dwcoord 7, 7
dwcoord 13, 7
@@ -929,7 +945,7 @@ Unknown_11c63a: ; 11c63a
; 11c658
Function11c658: ; 11c658 (47:4658)
- call Function11c277
+ call EZChat_ClearBottom12Rows
call Function11c770
ld de, Unknown_11cfc2
call Function11d035
@@ -941,7 +957,7 @@ Function11c658: ; 11c658 (47:4658)
call Function11cfb5
Function11c675: ; 11c675 (47:4675)
- ld hl, wcd25
+ ld hl, wMobileCommsJumptableIndex
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and A_BUTTON
@@ -975,7 +991,7 @@ Function11c675: ; 11c675 (47:4675)
ld [wcd26], a
ld a, [hl]
ld b, a
- ld hl, wcd25
+ ld hl, wMobileCommsJumptableIndex
ld a, [wcd26]
add [hl]
jr c, .asm_11c6b9
@@ -986,7 +1002,7 @@ Function11c675: ; 11c675 (47:4675)
ld hl, wcd26
sub [hl]
dec a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
.asm_11c6c4
call Function11c992
call Function11c7bc
@@ -1101,42 +1117,46 @@ Function11c675: ; 11c675 (47:4675)
Function11c770: ; 11c770 (47:4770)
xor a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld [wcd26], a
ld [wcd27], a
ld a, [wcd2b]
and a
- jr nz, .asm_11c7ab
+ jr nz, .cd2b_is_nonzero
ld a, [wcd21]
and a
- jr z, .asm_11c799
+ jr z, .cd21_is_zero
+ ; load from data array
dec a
sla a
- ld hl, Unknown_11f220
+ ld hl, MobileEZChatData_WordAndPageCounts
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld [wcd28], a
ld a, [hl]
-.asm_11c795
+.load
ld [wcd29], a
ret
-.asm_11c799
+.cd21_is_zero
+ ; compute from [wc7d2]
ld a, [wc7d2]
ld [wcd28], a
-.asm_11c79f
- ld c, $c
+.div_12
+ ld c, 12
call SimpleDivide
and a
- jr nz, .asm_11c7a8
+ jr nz, .no_need_to_floor
dec b
-.asm_11c7a8
+.no_need_to_floor
ld a, b
- jr .asm_11c795
-.asm_11c7ab
- ld hl, $c68a + 30
+ jr .load
+
+.cd2b_is_nonzero
+ ; compute from [c6a8 + 2 * [cd22]]
+ ld hl, $c6a8 ; $c68a + 30
ld a, [wcd22]
ld c, a
ld b, 0
@@ -1144,7 +1164,7 @@ Function11c770: ; 11c770 (47:4770)
add hl, bc
ld a, [hl]
ld [wcd28], a
- jr .asm_11c79f
+ jr .div_12
Function11c7bc: ; 11c7bc (47:47bc)
ld bc, Unknown_11c854
@@ -1179,7 +1199,7 @@ Function11c7bc: ; 11c7bc (47:47bc)
ret
.asm_11c7e9
- ld hl, wd100
+ ld hl, wListPointer
ld a, [wcd26]
ld e, a
add hl, de
@@ -1265,7 +1285,6 @@ Function11c7bc: ; 11c7bc (47:47bc)
pop hl
pop de
ret
-
; 11c854 (47:4854)
Unknown_11c854: ; 11c854
@@ -1339,7 +1358,6 @@ Function11c86e: ; 11c86e (47:486e)
dec c
jr nz, .asm_11c8c2
ret
-
; 11c8c7 (47:48c7)
BCD2String: ; 11c8c7
@@ -1363,7 +1381,6 @@ BCD2String: ; 11c8c7
add "0"
ld [hli], a
ret
-
; 11c8ec
MobileString_Page: ; 11c8ec
@@ -1379,7 +1396,7 @@ MobileString_Next: ; 11c8f3
; 11c8f6
Function11c8f6: ; 11c8f6 (47:48f6)
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
call Function11c95d
push hl
ld a, [wcd2b]
@@ -1390,7 +1407,7 @@ Function11c8f6: ; 11c8f6 (47:48f6)
and a
jr z, .asm_11c927
ld hl, wcd26
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
add [hl]
.asm_11c911
ld e, a
@@ -1399,7 +1416,7 @@ Function11c8f6: ; 11c8f6 (47:48f6)
push de
call Function11c05d
pop de
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
ld c, a
ld b, $0
ld hl, wcd36
@@ -1412,11 +1429,11 @@ Function11c8f6: ; 11c8f6 (47:48f6)
.asm_11c927
ld hl, wcd26
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
add [hl]
ld c, a
ld b, $0
- ld hl, wd100
+ ld hl, wListPointer
add hl, bc
ld a, [hl]
jr .asm_11c911
@@ -1438,7 +1455,7 @@ Function11c8f6: ; 11c8f6 (47:48f6)
ld d, $0
add hl, de
add hl, de
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld e, a
add hl, de
add hl, de
@@ -1480,7 +1497,6 @@ Function11c95d: ; 11c95d (47:495d)
jr nz, .asm_11c980
pop hl
ret
-
; 11c986 (47:4986)
Unknown_11c986:
@@ -1544,7 +1560,7 @@ Function11c9c3: ; 11c9c3 (47:49c3)
jr nz, .asm_11c9e9
call Function11ca5e
xor a
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
.asm_11c9e9
ld hl, wcd24
set 4, [hl]
@@ -1606,7 +1622,6 @@ Function11ca19: ; 11ca19 (47:4a19)
jr nz, .asm_11ca22
callba ReloadMapPart
ret
-
; 11ca38 (47:4a38)
String_11ca38: ; 11ca38
@@ -1621,13 +1636,13 @@ String_11ca57: ; 11ca57
Function11ca5e: ; 11ca5e (47:4a5e)
xor a
-.asm_11ca5f
+.loop
push af
call Function11ca6a
pop af
inc a
cp $6
- jr nz, .asm_11ca5f
+ jr nz, .loop
ret
Function11ca6a: ; 11ca6a (47:4a6a)
@@ -1736,7 +1751,6 @@ Function11cab3: ; 11cab3 (47:4ab3)
ret nz
inc [hl]
ret
-
; 11cb1c (47:4b1c)
String_11cb1c: ; 11cb1c
@@ -1867,7 +1881,6 @@ Function11cbf5: ; 11cbf5 (47:4bf5)
dec hl
set 7, [hl]
ret
-
; 11cc01 (47:4c01)
Unknown_11cc01: ; 11cc01
@@ -1933,7 +1946,6 @@ Function11cd04: ; 11cd04 (47:4d04)
ld a, $4
ld [wJumptableIndex], a
ret
-
; 11cd10 (47:4d10)
String_11cd10: ; 11cd10
@@ -1941,7 +1953,7 @@ String_11cd10: ; 11cd10
; 11cd20
Function11cd20: ; 11cd20 (47:4d20)
- call Function11c277
+ call EZChat_ClearBottom12Rows
ld de, Unknown_11cfc6
call Function11cfce
hlcoord 1, 14
@@ -2033,7 +2045,6 @@ Function11cdaa: ; 11cdaa (47:4daa)
call ByteFill
callba ReloadMapPart
ret
-
; 11cdc7 (47:4dc7)
String_11cdc7: ; 11cdc7
@@ -2054,12 +2065,12 @@ String_11cdf5: ; 11cdf5
; 11ce0b
Function11ce0b: ; 11ce0b (47:4e0b)
- call Function11c277
+ call EZChat_ClearBottom12Rows
hlcoord 1, 7
ld de, String_11cf79
call PlaceString
hlcoord 1, 17
- ld de, String_11c62a
+ ld de, EZChatString_Stop_Mode_Cancel
call PlaceString
call Function11c618
ld hl, wcd24
@@ -2110,16 +2121,16 @@ Function11ce2b: ; 11ce2b (47:4e2b)
cp NUM_KANA
jr c, .place
sub NUM_KANA
- jr z, .asm_11cea4
+ jr z, .done
dec a
- jr z, .asm_11ce96
+ jr z, .mode
jr .b
.start
ld hl, wcd24
set 0, [hl]
ld a, $8
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
.b
ld a, $4
jr .load
@@ -2135,7 +2146,7 @@ Function11ce2b: ; 11ce2b (47:4e2b)
ld a, $8
jr .load
-.asm_11ce96
+.mode
ld a, $13
.load
ld [wJumptableIndex], a
@@ -2144,8 +2155,8 @@ Function11ce2b: ; 11ce2b (47:4e2b)
call PlayClickSFX
ret
-.asm_11cea4
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+.done
+ ld a, [wcd20] ; wcd20
call Function11ca6a
call PlayClickSFX
ret
@@ -2162,7 +2173,6 @@ Function11ce2b: ; 11ce2b (47:4e2b)
ret z
ld [wcd22], a
ret
-
; 11ceb9 (47:4eb9)
Unknown_11ceb9: ; 11ceb9
@@ -2278,7 +2288,6 @@ Function11cfb5: ; 11cfb5 (47:4fb5)
ld hl, wJumptableIndex
inc [hl]
ret
-
; 11cfba (47:4fba)
Unknown_11cfba:
@@ -2304,19 +2313,19 @@ Unknown_11cfca:
Function11cfce: ; 11cfce (47:4fce)
hlcoord 0, 0
- ld bc, $14
+ ld bc, SCREEN_WIDTH
ld a, [de]
inc de
push af
ld a, [de]
inc de
and a
-.asm_11cfda
- jr z, .asm_11cfe0
+.add_n_times
+ jr z, .done_add_n_times
add hl, bc
dec a
- jr .asm_11cfda
-.asm_11cfe0
+ jr .add_n_times
+.done_add_n_times
pop af
ld c, a
ld b, 0
@@ -2328,82 +2337,82 @@ Function11cfce: ; 11cfce (47:4fce)
inc de
dec a
dec a
- jr z, .asm_11cff6
+ jr z, .skip_fill
ld c, a
ld a, $7a
-.asm_11cff2
+.fill_loop
ld [hli], a
dec c
- jr nz, .asm_11cff2
-.asm_11cff6
+ jr nz, .fill_loop
+.skip_fill
ld a, $7b
ld [hl], a
pop hl
- ld bc, $14
+ ld bc, SCREEN_WIDTH
add hl, bc
ld a, [de]
dec de
dec a
dec a
- jr z, .asm_11d022
+ jr z, .skip_section
ld b, a
-.asm_11d005
+.loop
push hl
ld a, $7c
ld [hli], a
ld a, [de]
dec a
dec a
- jr z, .asm_11d015
+ jr z, .skip_row
ld c, a
ld a, $7f
-.asm_11d011
+.row_loop
ld [hli], a
dec c
- jr nz, .asm_11d011
-.asm_11d015
+ jr nz, .row_loop
+.skip_row
ld a, $7c
ld [hl], a
pop hl
push bc
- ld bc, $14
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, .asm_11d005
-.asm_11d022
+ jr nz, .loop
+.skip_section
ld a, $7d
ld [hli], a
ld a, [de]
dec a
dec a
- jr z, .asm_11d031
+ jr z, .skip_remainder
ld c, a
ld a, $7a
-.asm_11d02d
+.final_loop
ld [hli], a
dec c
- jr nz, .asm_11d02d
-.asm_11d031
+ jr nz, .final_loop
+.skip_remainder
ld a, $7e
ld [hl], a
ret
Function11d035: ; 11d035 (47:5035)
hlcoord 0, 0
- ld bc, $14
+ ld bc, SCREEN_WIDTH
ld a, [de]
inc de
push af
ld a, [de]
inc de
and a
-.asm_11d041
- jr z, .asm_11d047
+.add_n_times
+ jr z, .done_add_n_times
add hl, bc
dec a
- jr .asm_11d041
-.asm_11d047
+ jr .add_n_times
+.done_add_n_times
pop af
ld c, a
ld b, $0
@@ -2420,27 +2429,27 @@ Function11d035: ; 11d035 (47:5035)
add hl, bc
ld a, $7b
ld [hl], a
- call Function11d0ac
+ call .AddNMinusOneTimes
ld a, $7e
ld [hl], a
pop hl
push hl
- call Function11d0ac
+ call .AddNMinusOneTimes
ld a, $7d
ld [hl], a
pop hl
push hl
inc hl
push hl
- call Function11d0ac
+ call .AddNMinusOneTimes
pop bc
dec de
ld a, [de]
cp $2
- jr z, .asm_11d082
+ jr z, .skip
dec a
dec a
-.asm_11d078
+.loop
push af
ld a, $7a
ld [hli], a
@@ -2448,8 +2457,8 @@ Function11d035: ; 11d035 (47:5035)
inc bc
pop af
dec a
- jr nz, .asm_11d078
-.asm_11d082
+ jr nz, .loop
+.skip
pop hl
ld bc, $14
add hl, bc
@@ -2470,32 +2479,32 @@ Function11d035: ; 11d035 (47:5035)
ld c, a
ld b, a
ld de, $14
-.asm_11d09c
+.loop2
ld a, $7c
ld [hl], a
add hl, de
dec c
- jr nz, .asm_11d09c
+ jr nz, .loop2
pop hl
-.asm_11d0a4
+.loop3
ld a, $7c
ld [hl], a
add hl, de
dec b
- jr nz, .asm_11d0a4
+ jr nz, .loop3
ret
-Function11d0ac: ; 11d0ac (47:50ac)
+.AddNMinusOneTimes: ; 11d0ac (47:50ac)
ld a, [de]
dec a
- ld bc, $14
-.asm_11d0b1
+ ld bc, SCREEN_WIDTH
+.add_n_minus_one_times
add hl, bc
dec a
- jr nz, .asm_11d0b1
+ jr nz, .add_n_minus_one_times
ret
-Function11d0b6: ; 11d0b6 (47:50b6)
+AnimateEZChatCursor: ; 11d0b6 (47:50b6)
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -2522,41 +2531,41 @@ Function11d0b6: ; 11d0b6 (47:50b6)
dw .nine
dw .ten
-
.zero ; 11d0dd (47:50dd)
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
sla a
- ld hl, Unknown_11d208
+ ld hl, .Coords_Zero
ld e, $1
jr .load
.one ; 11d0e9 (47:50e9)
ld a, [wcd21]
sla a
- ld hl, Unknown_11d21a
+ ld hl, .Coords_One
ld e, $2
jr .load
.two ; 11d0f5 (47:50f5)
- ld hl, Unknown_11d2be
+ ld hl, .FramesetsIDs_Two
ld a, [wcd22]
ld e, a
ld d, $0
add hl, de
ld a, [hl]
call ReinitSpriteAnimFrame
+
ld a, [wcd22]
sla a
- ld hl, Unknown_11d23e
+ ld hl, .Coords_Two
ld e, $4
jr .load
.three ; 11d10f (47:510f)
ld a, SPRITE_ANIM_FRAMESET_27
call ReinitSpriteAnimFrame
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
sla a
- ld hl, Unknown_11d29e
+ ld hl, .Coords_Three
ld e, $8
.load ; 11d11e (47:511e)
push de
@@ -2574,7 +2583,7 @@ Function11d0b6: ; 11d0b6 (47:50b6)
ld [hl], a
pop de
ld a, e
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.four ; 11d134 (47:5134)
@@ -2582,7 +2591,7 @@ Function11d0b6: ; 11d0b6 (47:50b6)
call ReinitSpriteAnimFrame
ld a, [wcd2a]
sla a
- ld hl, Unknown_11d2b6
+ ld hl, .Coords_Four
ld e, $10
jr .load
@@ -2591,42 +2600,47 @@ Function11d0b6: ; 11d0b6 (47:50b6)
call ReinitSpriteAnimFrame
ld a, [wcd2c]
sla a
- ld hl, Unknown_11d2ba
+ ld hl, .Coords_Five
ld e, $20
jr .load
.six ; 11d156 (47:5156)
ld a, SPRITE_ANIM_FRAMESET_2A
call ReinitSpriteAnimFrame
+ ; X = [wcd4a] * 8 + 24
ld a, [wcd4a]
sla a
sla a
sla a
add $18
- ld hl, $4
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
+ ; Y = 48
ld a, $30
ld [hl], a
+
ld a, $1
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.seven ; 11d175 (47:5175)
- ld a, [wcd4d]
+ ld a, [wEZChatCursorYCoord]
cp $4
- jr z, .asm_11d180
+ jr z, .frameset_26
ld a, SPRITE_ANIM_FRAMESET_28
- jr .asm_11d182
-.asm_11d180
+ jr .got_frameset
+
+.frameset_26
ld a, SPRITE_ANIM_FRAMESET_26
-.asm_11d182
+.got_frameset
call ReinitSpriteAnimFrame
- ld a, [wcd4d]
+ ld a, [wEZChatCursorYCoord]
cp $4
jr z, .asm_11d1b1
- ld a, [wcd4c]
+ ; X = [wEZChatCursorXCoord] * 8 + 32
+ ld a, [wEZChatCursorXCoord]
sla a
sla a
sla a
@@ -2634,7 +2648,8 @@ Function11d0b6: ; 11d0b6 (47:50b6)
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
- ld a, [wcd4d]
+ ; Y = [wEZChatCursorYCoord] * 16 + 72
+ ld a, [wEZChatCursorYCoord]
sla a
sla a
sla a
@@ -2643,11 +2658,12 @@ Function11d0b6: ; 11d0b6 (47:50b6)
ld [hl], a
ld a, $2
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.asm_11d1b1
- ld a, [wcd4c]
+ ; X = [wEZChatCursorXCoord] * 40 + 24
+ ld a, [wEZChatCursorXCoord]
sla a
sla a
sla a
@@ -2659,11 +2675,12 @@ Function11d0b6: ; 11d0b6 (47:50b6)
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
+ ; Y = 138
ld a, $8a
ld [hl], a
ld a, $2
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.nine ; 11d1d1 (47:51d1)
@@ -2692,7 +2709,7 @@ Function11d0b6: ; 11d0b6 (47:50b6)
ld [hl], a
ld a, $4
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.ten ; 11d1fc (47:51fc)
@@ -2700,141 +2717,164 @@ Function11d0b6: ; 11d0b6 (47:50b6)
call ReinitSpriteAnimFrame
ld a, $8
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
-
; 11d208 (47:5208)
-Unknown_11d208: ; 11d208
- db $0d, $1a
- db $3d, $1a
- db $6d, $1a
- db $0d, $2a
- db $3d, $2a
- db $6d, $2a
- db $0d, $8a
- db $3d, $8a
- db $6d, $8a
-
-Unknown_11d21a: ; 11d21a
- db $0d, $42
- db $3d, $42
- db $6d, $42
- db $0d, $52
- db $3d, $52
- db $6d, $52
- db $0d, $62
- db $3d, $62
- db $6d, $62
- db $0d, $72
- db $3d, $72
- db $6d, $72
- db $0d, $82
- db $3d, $82
- db $6d, $82
- db $0d, $92
- db $3d, $92
- db $6d, $92
-
-Unknown_11d23e: ; 11d23e
- db $10, $48
- db $18, $48
- db $20, $48
- db $28, $48
- db $30, $48
- db $10, $58
- db $18, $58
- db $20, $58
- db $28, $58
- db $30, $58
- db $10, $68
- db $18, $68
- db $20, $68
- db $28, $68
- db $30, $68
- db $10, $78
- db $18, $78
- db $20, $78
- db $28, $78
- db $30, $78
- db $40, $48
- db $48, $48
- db $50, $48
- db $58, $48
- db $60, $48
- db $40, $58
- db $48, $58
- db $50, $58
- db $58, $58
- db $60, $58
- db $40, $68
- db $48, $68
- db $50, $68
- db $58, $68
- db $60, $68
- db $70, $48
- db $80, $48
- db $90, $48
- db $40, $78
- db $48, $78
- db $50, $78
- db $58, $78
- db $60, $78
- db $70, $58
- db $70, $68
- db $0d, $92
- db $3d, $92
- db $6d, $92
-
-Unknown_11d29e: ; 11d29e
- db $10, $50
- db $40, $50
- db $70, $50
- db $10, $60
- db $40, $60
- db $70, $60
- db $10, $70
- db $40, $70
- db $70, $70
- db $10, $80
- db $40, $80
- db $70, $80
-
-Unknown_11d2b6: ; 11d2b6
- db $80, $50
- db $80, $60
-
-Unknown_11d2ba: ; 11d2ba
- db $20, $50
- db $20, $60
-
-Unknown_11d2be: ; 11d2be
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $29, $26
- db $26, $26
-
-Function11d2ee: ; 11d2ee (47:52ee)
+.Coords_Zero: ; 11d208
+ dbpixel 1, 3, 5, 2
+ dbpixel 7, 3, 5, 2
+ dbpixel 13, 3, 5, 2
+ dbpixel 1, 5, 5, 2
+ dbpixel 7, 5, 5, 2
+ dbpixel 13, 5, 5, 2
+ dbpixel 1, 17, 5, 2
+ dbpixel 7, 17, 5, 2
+ dbpixel 13, 17, 5, 2
+
+.Coords_One: ; 11d21a
+ dbpixel 1, 8, 5, 2
+ dbpixel 7, 8, 5, 2
+ dbpixel 13, 8, 5, 2
+ dbpixel 1, 10, 5, 2
+ dbpixel 7, 10, 5, 2
+ dbpixel 13, 10, 5, 2
+ dbpixel 1, 12, 5, 2
+ dbpixel 7, 12, 5, 2
+ dbpixel 13, 12, 5, 2
+ dbpixel 1, 14, 5, 2
+ dbpixel 7, 14, 5, 2
+ dbpixel 13, 14, 5, 2
+ dbpixel 1, 16, 5, 2
+ dbpixel 7, 16, 5, 2
+ dbpixel 13, 16, 5, 2
+ dbpixel 1, 18, 5, 2
+ dbpixel 7, 18, 5, 2
+ dbpixel 13, 18, 5, 2
+
+.Coords_Two: ; 11d23e
+ dbpixel 2, 9 ; 00
+ dbpixel 3, 9 ; 01
+ dbpixel 4, 9 ; 02
+ dbpixel 5, 9 ; 03
+ dbpixel 6, 9 ; 04
+ dbpixel 2, 11 ; 05
+ dbpixel 3, 11 ; 06
+ dbpixel 4, 11 ; 07
+ dbpixel 5, 11 ; 08
+ dbpixel 6, 11 ; 09
+ dbpixel 2, 13 ; 0a
+ dbpixel 3, 13 ; 0b
+ dbpixel 4, 13 ; 0c
+ dbpixel 5, 13 ; 0d
+ dbpixel 6, 13 ; 0e
+ dbpixel 2, 15 ; 0f
+ dbpixel 3, 15 ; 10
+ dbpixel 4, 15 ; 11
+ dbpixel 5, 15 ; 12
+ dbpixel 6, 15 ; 13
+ dbpixel 8, 9 ; 14
+ dbpixel 9, 9 ; 15
+ dbpixel 10, 9 ; 16
+ dbpixel 11, 9 ; 17
+ dbpixel 12, 9 ; 18
+ dbpixel 8, 11 ; 19
+ dbpixel 9, 11 ; 1a
+ dbpixel 10, 11 ; 1b
+ dbpixel 11, 11 ; 1c
+ dbpixel 12, 11 ; 1d
+ dbpixel 8, 13 ; 1e
+ dbpixel 9, 13 ; 1f
+ dbpixel 10, 13 ; 20
+ dbpixel 11, 13 ; 21
+ dbpixel 12, 13 ; 22
+ dbpixel 14, 9 ; 23
+ dbpixel 16, 9 ; 24
+ dbpixel 18, 9 ; 25
+ dbpixel 8, 15 ; 26
+ dbpixel 9, 15 ; 27
+ dbpixel 10, 15 ; 28
+ dbpixel 11, 15 ; 29
+ dbpixel 12, 15 ; 2a
+ dbpixel 14, 11 ; 2b
+ dbpixel 14, 13 ; 2c
+ dbpixel 1, 18, 5, 2 ; 2d
+ dbpixel 7, 18, 5, 2 ; 2e
+ dbpixel 13, 18, 5, 2 ; 2f
+
+.Coords_Three: ; 11d29e
+ dbpixel 2, 10
+ dbpixel 8, 10
+ dbpixel 14, 10
+ dbpixel 2, 12
+ dbpixel 8, 12
+ dbpixel 14, 12
+ dbpixel 2, 14
+ dbpixel 8, 14
+ dbpixel 14, 14
+ dbpixel 2, 16
+ dbpixel 8, 16
+ dbpixel 14, 16
+
+.Coords_Four: ; 11d2b6
+ dbpixel 16, 10
+ dbpixel 16, 12
+
+.Coords_Five: ; 11d2ba
+ dbpixel 4, 10
+ dbpixel 4, 12
+
+.FramesetsIDs_Two: ; 11d2be
+ db SPRITE_ANIM_FRAMESET_28 ; 00
+ db SPRITE_ANIM_FRAMESET_28 ; 01
+ db SPRITE_ANIM_FRAMESET_28 ; 02
+ db SPRITE_ANIM_FRAMESET_28 ; 03
+ db SPRITE_ANIM_FRAMESET_28 ; 04
+ db SPRITE_ANIM_FRAMESET_28 ; 05
+ db SPRITE_ANIM_FRAMESET_28 ; 06
+ db SPRITE_ANIM_FRAMESET_28 ; 07
+ db SPRITE_ANIM_FRAMESET_28 ; 08
+ db SPRITE_ANIM_FRAMESET_28 ; 09
+ db SPRITE_ANIM_FRAMESET_28 ; 0a
+ db SPRITE_ANIM_FRAMESET_28 ; 0b
+ db SPRITE_ANIM_FRAMESET_28 ; 0c
+ db SPRITE_ANIM_FRAMESET_28 ; 0d
+ db SPRITE_ANIM_FRAMESET_28 ; 0e
+ db SPRITE_ANIM_FRAMESET_28 ; 0f
+ db SPRITE_ANIM_FRAMESET_28 ; 10
+ db SPRITE_ANIM_FRAMESET_28 ; 11
+ db SPRITE_ANIM_FRAMESET_28 ; 12
+ db SPRITE_ANIM_FRAMESET_28 ; 13
+ db SPRITE_ANIM_FRAMESET_28 ; 14
+ db SPRITE_ANIM_FRAMESET_28 ; 15
+ db SPRITE_ANIM_FRAMESET_28 ; 16
+ db SPRITE_ANIM_FRAMESET_28 ; 17
+ db SPRITE_ANIM_FRAMESET_28 ; 18
+ db SPRITE_ANIM_FRAMESET_28 ; 19
+ db SPRITE_ANIM_FRAMESET_28 ; 1a
+ db SPRITE_ANIM_FRAMESET_28 ; 1b
+ db SPRITE_ANIM_FRAMESET_28 ; 1c
+ db SPRITE_ANIM_FRAMESET_28 ; 1d
+ db SPRITE_ANIM_FRAMESET_28 ; 1e
+ db SPRITE_ANIM_FRAMESET_28 ; 1f
+ db SPRITE_ANIM_FRAMESET_28 ; 20
+ db SPRITE_ANIM_FRAMESET_28 ; 21
+ db SPRITE_ANIM_FRAMESET_28 ; 22
+ db SPRITE_ANIM_FRAMESET_28 ; 23
+ db SPRITE_ANIM_FRAMESET_28 ; 24
+ db SPRITE_ANIM_FRAMESET_28 ; 25
+ db SPRITE_ANIM_FRAMESET_28 ; 26
+ db SPRITE_ANIM_FRAMESET_28 ; 27
+ db SPRITE_ANIM_FRAMESET_28 ; 28
+ db SPRITE_ANIM_FRAMESET_28 ; 29
+ db SPRITE_ANIM_FRAMESET_28 ; 2a
+ db SPRITE_ANIM_FRAMESET_28 ; 2b
+ db SPRITE_ANIM_FRAMESET_29 ; 2c
+ db SPRITE_ANIM_FRAMESET_26 ; 2d
+ db SPRITE_ANIM_FRAMESET_26 ; 2e
+ db SPRITE_ANIM_FRAMESET_26 ; 2f
+
+.UpdateObjectFlags: ; 11d2ee (47:52ee)
ld hl, wcd24
and [hl]
jr nz, .update_y_offset
@@ -2887,7 +2927,6 @@ Function11d323: ; 11d323
pop af
ld [rSVBK], a
ret
-
; 11d33a
Palette_11d33a:
@@ -2970,10 +3009,9 @@ Palette_11d33a:
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
-
; 11d3ba
-Function11d3ba: ; 11d3ba
+EZChat_GetSeenPokemonByKana: ; 11d3ba
ld a, [rSVBK]
push af
ld hl, $c648
@@ -2999,23 +3037,25 @@ Function11d3ba: ; 11d3ba
ld a, $c64a / $100
ld [wcd34], a
- ld hl, Unknown_11f23c
- ld a, (Unknown_11f23cEnd - Unknown_11f23c) / 4
+ ld hl, EZChat_SortedWords
+ ld a, (EZChat_SortedWordsEnd - EZChat_SortedWords) / 4
.MasterLoop: ; 11d3ef
push af
; read row
+; offset
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
+; size
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
; save the pointer to the next row
push hl
-; add de to hl
+; add de to w3_d000
ld hl, w3_d000
add hl, de
; recover de from wcd2d (default: w5_d800)
@@ -3052,6 +3092,7 @@ Function11d3ba: ; 11d3ba
ld a, c
or b
jr nz, .loop1
+
; recover the pointer from wcd2f (default: SortedPokemon)
ld a, [wcd2f]
ld l, a
@@ -3146,7 +3187,6 @@ Function11d3ba: ; 11d3ba
pop af
ld [rSVBK], a
ret
-
; 11d493
.CheckSeenMon: ; 11d493
@@ -3165,55 +3205,79 @@ Function11d3ba: ; 11d3ba
pop bc
pop hl
ret
-
; 11d4aa
-Function11d4aa: ; 11d4aa
+EZChat_GetCategoryWordsByKana: ; 11d4aa
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
- ld hl, MobileFixedWordCategoryPointers
- ld bc, Unknown_11f220
+
+ ; load pointers
+ ld hl, MobileEZChatCategoryPointers
+ ld bc, MobileEZChatData_WordAndPageCounts
+
+ ; init WRAM registers
xor a
ld [wcd2d], a
inc a
ld [wcd2e], a
- ld a, $e
+
+ ; enter the first loop
+ ld a, 14
.loop1
push af
+
+ ; load the pointer to the category
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
+
+ ; skip to the attributes
ld hl, 5 ; length of a string
add hl, de
- ld a, [bc]
+
+ ; get the number of words in the category
+ ld a, [bc] ; number of entries to copy
inc bc
inc bc
push bc
+
.loop2
push af
push hl
+
+ ; load offset at [hl]
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
+
+ ; add to w3_d000
ld hl, w3_d000
add hl, de
+
+ ; copy from wcd2d and increment [wcd2d] in place
ld a, [wcd2d]
ld [hli], a
inc a
ld [wcd2d], a
+
+ ; copy from wcd2e
ld a, [wcd2e]
ld [hl], a
+
+ ; next entry
pop hl
ld de, 8
add hl, de
pop af
dec a
jr nz, .loop2
+
+ ; reset and go to next category
ld hl, wcd2d
xor a
ld [hli], a
@@ -3226,10 +3290,8 @@ Function11d4aa: ; 11d4aa
pop af
ld [rSVBK], a
ret
-
; 11d4fe
-
SortedPokemon:
; Pokemon sorted by kana.
; Notably, Rhydon is missing.
@@ -3377,7 +3439,7 @@ LZ_11d6de:
INCBIN "gfx/pokedex/slowpoke.2bpp.lz"
; 11da52
-MobileFixedWordCategoryNames: ; 11da52
+MobileEZChatCategoryNames: ; 11da52
; Fixed message categories
db "ポケモン@@" ; 00
db "タイプ@@@" ; 01
@@ -3396,7 +3458,7 @@ MobileFixedWordCategoryNames: ; 11da52
db "あれこれ@@" ; 0e
; 11daac
-MobileFixedWordCategoryPointers: ; 11daac
+MobileEZChatCategoryPointers: ; 11daac
dw .Types ; 01
dw .Greetings ; 02
dw .People ; 03
@@ -4188,72 +4250,87 @@ MobileFixedWordCategoryPointers: ; 11daac
db "なんの@@", $2, $4, $0
; 11f220
-Unknown_11f220:
- db $12, $01 ; 01
- db $24, $02 ; 02
- db $45, $05 ; 03
- db $45, $05 ; 04
- db $42, $05 ; 05
- db $42, $05 ; 06
- db $45, $05 ; 07
- db $42, $05 ; 08
- db $27, $03 ; 09
- db $27, $03 ; 0a
- db $45, $05 ; 0b
- db $27, $03 ; 0c
- db $42, $05 ; 0d
- db $24, $02 ; 0e
-
-Unknown_11f23c:
+MobileEZChatData_WordAndPageCounts:
+macro_11f220: macro
+; parameter: number of words
+ db \1
+; 12 words per page (0-based indexing)
+x = \1 / 12
+if \1 % 12 == 0
+x = x +- 1
+endc
+ db x
+endm
+ macro_11f220 18 ; 01: Types
+ macro_11f220 36 ; 02: Greetings
+ macro_11f220 69 ; 03: People
+ macro_11f220 69 ; 04: Battle
+ macro_11f220 66 ; 05: Exclamations
+ macro_11f220 66 ; 06: Conversation
+ macro_11f220 69 ; 07: Feelings
+ macro_11f220 66 ; 08: Conditions
+ macro_11f220 39 ; 09: Life
+ macro_11f220 39 ; 0a: Hobbies
+ macro_11f220 69 ; 0b: Actions
+ macro_11f220 39 ; 0c: Time
+ macro_11f220 66 ; 0d: Farewells
+ macro_11f220 36 ; 0e: ThisAndThat
+
+EZChat_SortedWords:
+; Addresses in WRAM bank 3 where EZChat words beginning
+; with the given kana are sorted in memory, and the pre-
+; allocated size for each.
+; These arrays are expanded dynamically to accomodate
+; any Pokemon you've seen that starts with each kana.\
macro_11f23c: macro
dw x - w3_d000, \1
x = x + 2 * \1
endm
x = $d012
- macro_11f23c $2f
- macro_11f23c $1e
- macro_11f23c $11
- macro_11f23c $09
- macro_11f23c $2e
- macro_11f23c $24
- macro_11f23c $1b
- macro_11f23c $09
- macro_11f23c $07
- macro_11f23c $1c
- macro_11f23c $12
- macro_11f23c $2b
- macro_11f23c $10
- macro_11f23c $08
- macro_11f23c $0c
- macro_11f23c $2c
- macro_11f23c $09
- macro_11f23c $12
- macro_11f23c $1b
- macro_11f23c $1a
- macro_11f23c $1c
- macro_11f23c $05
- macro_11f23c $02
- macro_11f23c $05
- macro_11f23c $07
- macro_11f23c $16
- macro_11f23c $0e
- macro_11f23c $0c
- macro_11f23c $05
- macro_11f23c $16
- macro_11f23c $19
- macro_11f23c $0e
- macro_11f23c $08
- macro_11f23c $07
- macro_11f23c $09
- macro_11f23c $0d
- macro_11f23c $04
- macro_11f23c $14
- macro_11f23c $0b
- macro_11f23c $01
- macro_11f23c $02
- macro_11f23c $02
- macro_11f23c $02
- macro_11f23c $15
+ macro_11f23c $2f ; a
+ macro_11f23c $1e ; i
+ macro_11f23c $11 ; u
+ macro_11f23c $09 ; e
+ macro_11f23c $2e ; o
+ macro_11f23c $24 ; ka_ga
+ macro_11f23c $1b ; ki_gi
+ macro_11f23c $09 ; ku_gu
+ macro_11f23c $07 ; ke_ge
+ macro_11f23c $1c ; ko_go
+ macro_11f23c $12 ; sa_za
+ macro_11f23c $2b ; shi_ji
+ macro_11f23c $10 ; su_zu
+ macro_11f23c $08 ; se_ze
+ macro_11f23c $0c ; so_zo
+ macro_11f23c $2c ; ta_da
+ macro_11f23c $09 ; chi_dhi
+ macro_11f23c $12 ; tsu_du
+ macro_11f23c $1b ; te_de
+ macro_11f23c $1a ; to_do
+ macro_11f23c $1c ; na
+ macro_11f23c $05 ; ni
+ macro_11f23c $02 ; nu
+ macro_11f23c $05 ; ne
+ macro_11f23c $07 ; no
+ macro_11f23c $16 ; ha_ba_pa
+ macro_11f23c $0e ; hi_bi_pi
+ macro_11f23c $0c ; fu_bu_pu
+ macro_11f23c $05 ; he_be_pe
+ macro_11f23c $16 ; ho_bo_po
+ macro_11f23c $19 ; ma
+ macro_11f23c $0e ; mi
+ macro_11f23c $08 ; mu
+ macro_11f23c $07 ; me
+ macro_11f23c $09 ; mo
+ macro_11f23c $0d ; ya
+ macro_11f23c $04 ; yu
+ macro_11f23c $14 ; yo
+ macro_11f23c $0b ; ra
+ macro_11f23c $01 ; ri
+ macro_11f23c $02 ; ru
+ macro_11f23c $02 ; re
+ macro_11f23c $02 ; ro
+ macro_11f23c $15 ; wa
x = $d000
- macro_11f23c $09
-Unknown_11f23cEnd:
+ macro_11f23c $09 ; end
+EZChat_SortedWordsEnd:
diff --git a/misc/gfx_41.asm b/misc/gfx_41.asm
index dc5110e2e..e3a1a0375 100755
--- a/misc/gfx_41.asm
+++ b/misc/gfx_41.asm
@@ -1,52 +1,52 @@
-Function104000:: ; 104000
+HDMATransferAttrMapAndTileMapToWRAMBank3:: ; 104000
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function10419d
+ ld hl, wScratchTileMap
+ call HDMATransferToWRAMBank3
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function10419d
+ ld hl, wScratchAttrMap
+ call HDMATransferToWRAMBank3
ret
; 10402d
-Function10402d:: ; 10402d
+HDMATransferTileMapToWRAMBank3:: ; 10402d
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function10419d
+ ld hl, wScratchTileMap
+ call HDMATransferToWRAMBank3
ret
; 104047
-Function104047: ; 104047
+HDMATransferAttrMapToWRAMBank3: ; 104047
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function10419d
+ ld hl, wScratchAttrMap
+ call HDMATransferToWRAMBank3
ret
; 104061
@@ -56,63 +56,67 @@ ReloadMapPart:: ; 104061
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
call DelayFrame
+
di
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041ad
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041ad
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
pop af
ld [rVBK], a
ei
+
ret
-Function104099: ; 104099
+Mobile_ReloadMapPart: ; 104099
ld hl, ReloadMapPart ; useless
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
call DelayFrame
+
di
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041c1
+ ld hl, wScratchAttrMap
+ call HDMATransfer_NoDI
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041c1
+ ld hl, wScratchTileMap
+ call HDMATransfer_NoDI
pop af
ld [rVBK], a
ei
+
ret
; 1040d4
-Function1040d4: ; 1040d4
- ld hl, .Function
+; XXX
+ ld hl, .unreferenced_1040da
jp CallInSafeGFXMode
-.Function:
+.unreferenced_1040da
ld a, $1
ld [rVBK], a
ld a, $3
@@ -132,31 +136,34 @@ Function1040d4: ; 1040d4
ret
; 1040fb
-Function1040fb: ; 1040fb
- ld hl, .Function
+; XXX
+ ld hl, .unreferenced_104101
jp CallInSafeGFXMode
-.Function:
+.unreferenced_104101
ld a, $1
ld [rVBK], a
ld a, $3
ld [rSVBK], a
ld hl, w3_d800
- call Function10419d
+ call HDMATransferToWRAMBank3
ret
; 104110
-Function104110:: ; 104110
+OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 104110
; OpenText
ld hl, .Function
jp CallInSafeGFXMode
.Function:
+ ; Transfer AttrMap and Tilemap to BGMap
+ ; Fill vBGAttrs with $00
+ ; Fill vBGTiles with " "
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
call DelayFrame
@@ -165,38 +172,42 @@ Function104110:: ; 104110
push af
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041b7
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait123Scanlines_toBGMap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041b7
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait123Scanlines_toBGMap
pop af
ld [rVBK], a
ei
ret
; 104148
-Function104148: ; 104148 (41:4148)
+Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap: ; 104148 (41:4148)
ld hl, .Function
jp CallInSafeGFXMode
.Function:
+ ; Transfer AttrMap and Tilemap to BGMap
+ ; Fill vBGAttrs with $00
+ ; Fill vBGTiles with $ff
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
ld c, $ff
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteMap
+
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041ad
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041ad
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
ret
; 104177
@@ -233,8 +244,8 @@ CallInSafeGFXMode: ; 104177
; 10419d
-Function10419d: ; 10419d (41:419d)
- call Function10424e
+HDMATransferToWRAMBank3: ; 10419d (41:419d)
+ call _LoadHDMAParameters
ld a, $23
ld [hDMATransfer], a
@@ -246,60 +257,76 @@ WaitDMATransfer: ; 104a14
jr nz, .loop
ret
-Function1041ad: ; 1041ad (41:41ad)
+HDMATransfer_Wait127Scanlines_toBGMap: ; 1041ad (41:41ad)
+; HDMA transfer from hl to [hBGMapAddress]
+; hBGMapAddress -> de
+; 2 * SCREEN_HEIGHT -> c
ld a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ld e, a
- ld c, $24
- jr Function104209
+ ld c, 2 * SCREEN_HEIGHT
+ jr HDMATransfer_Wait127Scanlines
-Function1041b7: ; 1041b7 (41:41b7)
+HDMATransfer_Wait123Scanlines_toBGMap: ; 1041b7 (41:41b7)
+; HDMA transfer from hl to [hBGMapAddress]
; hBGMapAddress -> de
-; $24 -> c
+; 2 * SCREEN_HEIGHT -> c
; $7b --> b
ld a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ld e, a
- ld c, $24
- jr asm_104205
+ ld c, 2 * SCREEN_HEIGHT
+ jr HDMATransfer_Wait123Scanlines
; 1041c1 (41:41c1)
-Function1041c1: ; 1041c1
+HDMATransfer_NoDI: ; 1041c1
+; HDMA transfer from hl to [hBGMapAddress]
+; [hBGMapAddress] --> de
+; 2 * SCREEN_HEIGHT --> c
ld a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ld e, a
- ld c, $24
+ ld c, 2 * SCREEN_HEIGHT
+
+ ; [rHDMA1, rHDMA2] = hl & $fff0
ld a, h
ld [rHDMA1], a
ld a, l
and $f0
ld [rHDMA2], a
+ ; [rHDMA3, rHDMA4] = de & $1ff0
ld a, d
and $1f
ld [rHDMA3], a
ld a, e
and $f0
ld [rHDMA4], a
+ ; b = c | %10000000
ld a, c
dec c
or $80
ld b, a
+ ; d = $7f - c + 1
ld a, $7f
sub c
ld d, a
+ ; while [rLY] >= d: pass
.loop1
ld a, [rLY]
cp d
jr nc, .loop1
+ ; while not [rSTAT] & 3: pass
.loop2
ld a, [rSTAT]
and $3
jr z, .loop2
+ ; load the 5th byte of HDMA
ld a, b
ld [rHDMA5], a
+ ; wait until rLY advances (c + 1) times
ld a, [rLY]
inc c
ld hl, rLY
@@ -314,49 +341,58 @@ Function1041c1: ; 1041c1
ret
; 104205
-asm_104205:
+HDMATransfer_Wait123Scanlines:
ld b, $7b
- jr asm_10420b
+ jr _continue_HDMATransfer
-Function104209:
-; LY magic
+HDMATransfer_Wait127Scanlines:
ld b, $7f
-asm_10420b:
+_continue_HDMATransfer:
+; a lot of waiting around for hardware registers
+ ; [rHDMA1, rHDMA2] = hl & $fff0
ld a, h
ld [rHDMA1], a
ld a, l
and $f0 ; high nybble
ld [rHDMA2], a
+ ; [rHDMA3, rHDMA4] = de & $1ff0
ld a, d
and $1f ; lower 5 bits
ld [rHDMA3], a
ld a, e
and $f0 ; high nybble
ld [rHDMA4], a
+ ; e = c | %10000000
ld a, c
dec c
- or $80 ; set 7, a
+ or $80
ld e, a
+ ; d = b - c + 1
ld a, b
sub c
ld d, a
+ ; while [rLY] >= d: pass
.ly_loop
ld a, [rLY]
cp d
jr nc, .ly_loop
di
+ ; while [rSTAT] & 3: pass
.rstat_loop_1
ld a, [rSTAT]
and $3
jr nz, .rstat_loop_1
+ ; while not [rSTAT] & 3: pass
.rstat_loop_2
ld a, [rSTAT]
and $3
jr z, .rstat_loop_2
+ ; load the 5th byte of HDMA
ld a, e
ld [rHDMA5], a
+ ; wait until rLY advances (c + 1) times
ld a, [rLY]
inc c
ld hl, rLY
@@ -374,7 +410,7 @@ asm_10420b:
; 10424e
-Function10424e: ; 10424e (41:424e)
+_LoadHDMAParameters: ; 10424e (41:424e)
ld a, h
ld [rHDMA1], a
ld a, l
@@ -415,7 +451,7 @@ CutAndPasteMap: ; 104265 (41:4265)
; load the original value of c into hl 12 times
ld a, [hMapObjectIndexBuffer]
- ld b, 12
+ ld b, BG_MAP_WIDTH - SCREEN_WIDTH
.loop3
ld [hli], a
dec b
@@ -441,18 +477,20 @@ _Get2bpp:: ; 104284
push bc
push hl
- ; Copy c tiles of the 2bpp from b:de to wDecompressScratch
+ ; Copy c tiles of the 2bpp from b:de to wScratchTileMap
ld a, b ; bank
ld l, c ; number of tiles
ld h, $0
-rept 4
- add hl, hl ; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
-endr
+ ; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ add hl, hl
ld b, h
ld c, l
ld h, d ; address
ld l, e
- ld de, wDecompressScratch
+ ld de, wScratchTileMap
call FarCopyBytes
pop hl
@@ -464,8 +502,8 @@ endr
ld d, h
ld e, l
- ld hl, wDecompressScratch
- call Function104209
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines
; restore the previous bank
pop af
@@ -512,14 +550,14 @@ _Get1bpp:: ; 1042b2
ld a, b
ld l, c
ld h, $0
-rept 3
add hl, hl ; multiply by 8
-endr
+ add hl, hl ; multiply by 8
+ add hl, hl ; multiply by 8
ld c, l
ld b, h
ld h, d
ld l, e
- ld de, wDecompressScratch
+ ld de, wScratchTileMap
call FarCopyBytesDouble_DoubleBankSwitch
pop hl
@@ -531,41 +569,41 @@ endr
ld d, h
ld e, l
- ld hl, wDecompressScratch
- call Function104209
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines
pop af
ld [rSVBK], a
ret
; 104303
-Function104303: ; 104303
- ld hl, Function104309
+HDMATransfer_OnlyTopFourRows: ; 104303
+ ld hl, .Function
jp CallInSafeGFXMode
; 104309
-Function104309:
- ld hl, wDecompressScratch
+.Function:
+ ld hl, wScratchTileMap
decoord 0, 0
- call Function10433a
- ld hl, wDecompressScratch + $80
+ call .Copy
+ ld hl, wScratchTileMap + $80
decoord 0, 0, AttrMap
- call Function10433a
+ call .Copy
ld a, $1
ld [rVBK], a
ld c, $8
- ld hl, wDecompressScratch + $80
+ ld hl, wScratchTileMap + $80
debgcoord 0, 0, VBGMap1
- call Function104209
+ call HDMATransfer_Wait127Scanlines
ld a, $0
ld [rVBK], a
ld c, $8
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
debgcoord 0, 0, VBGMap1
- call Function104209
+ call HDMATransfer_Wait127Scanlines
ret
-Function10433a: ; 10433a (41:433a)
+.Copy: ; 10433a (41:433a)
ld b, 4
.outer_loop
ld c, SCREEN_WIDTH
@@ -576,7 +614,7 @@ Function10433a: ; 10433a (41:433a)
dec c
jr nz, .inner_loop
ld a, l
- add $20 - SCREEN_WIDTH
+ add BG_MAP_WIDTH - SCREEN_WIDTH
ld l, a
ld a, h
adc $0
diff --git a/misc/mobile_12.asm b/misc/mobile_12.asm
index dd0f63135..69a5551a7 100755
--- a/misc/mobile_12.asm
+++ b/misc/mobile_12.asm
@@ -11,14 +11,14 @@ InitMobileProfile: ; 4802f (12:402f)
call Function48d3d
ld a, [wd479]
bit 1, a
- jr z, .asm_4805a
+ jr z, .not_yet_initialized
ld a, [wd003]
set 0, a
set 1, a
set 2, a
set 3, a
ld [wd003], a
-.asm_4805a
+.not_yet_initialized
call Function486bf
call LoadFontsExtra
ld de, GFX_488c3
@@ -125,22 +125,22 @@ Function48157: ; 48157 (12:4157)
ld hl, wMenuCursorY
ld b, [hl]
push bc
-
asm_4815f: ; 4815f (12:415f)
- bit 0, a
+ bit A_BUTTON_F, a
jp nz, Function4820d
ld b, a
ld a, [wd002]
bit 6, a
- jr z, .asm_48177
+ jr z, .dont_check_b_button
ld hl, wd479
bit 1, [hl]
- jr z, .asm_48177
- bit 1, b
- jr nz, .asm_4817a
-.asm_48177
+ jr z, .dont_check_b_button
+ bit B_BUTTON_F, b
+ jr nz, .b_button
+.dont_check_b_button
jp Function48272
-.asm_4817a
+
+.b_button
call ClearBGPalettes
call Function48d30
pop bc
@@ -258,7 +258,7 @@ Function4820d: ; 4820d (12:420d)
call Function48d30
pop bc
call ClearTileMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
ld hl, wd479
set 1, [hl]
@@ -359,7 +359,7 @@ Function48304: ; 48304 (12:4304)
ld a, $29
.asm_4833f
ld [wMenuScrollPosition], a
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
.asm_48348
call ScrollingMenu
ld de, $629
@@ -385,7 +385,7 @@ Function48304: ; 48304 (12:4304)
ld [wd003], a
.asm_48377
call Function48187
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
jp Function4840c
Function48383: ; 48383 (12:4383)
@@ -497,13 +497,14 @@ Function4840c: ; 4840c (12:440c)
ld [hl], b
ld a, [wd002]
bit 6, a
- jr nz, .asm_48437
+ jr nz, .narrower_box
ld b, 9
ld c, 1
hlcoord 1, 4
call ClearBox
jp Function48157
-.asm_48437
+
+.narrower_box
ld b, 7
ld c, 1
hlcoord 1, 6
@@ -667,13 +668,13 @@ Function48689: ; 48689 (12:4689)
call GetMysteryGift_MobileAdapterLayout
call ClearBGPalettes
hlcoord 0, 0
- ld b, $4
- ld c, $14
+ ld b, 4
+ ld c, SCREEN_WIDTH
call ClearBox
hlcoord 0, 2
ld a, $c
ld [hl], a
- ld bc, $13
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], a
ld de, MobileProfileString
@@ -689,121 +690,139 @@ Function486bf: ; 486bf (12:46bf)
ld hl, w2DMenuCursorInitY
ld a, [wd002]
bit 6, a
- jr nz, .asm_486ce
- ld a, $4
- ld [hli], a
- jr .asm_486d1
-.asm_486ce
- ld a, $6
+ jr nz, .start_at_6
+ ld a, 4
ld [hli], a
-.asm_486d1
- ld a, $1
+ jr .got_init_y
+
+.start_at_6
+ ld a, 6
ld [hli], a
+.got_init_y
+ ld a, 1
+ ld [hli], a ; init x
ld a, [wd002]
bit 6, a
- jr nz, .asm_486e7
+ jr nz, .check_wd479
call Function48725
- ld a, $4
- jr nc, .asm_486e4
- ld a, $5
-.asm_486e4
+ ld a, 4
+ jr nc, .got_num_rows_1
+ ld a, 5
+.got_num_rows_1
ld [hli], a
- jr .asm_486fb
-.asm_486e7
+ jr .got_num_rows_2
+
+.check_wd479
ld a, [wd479]
bit 1, a
- jr nz, .asm_486f8
+ jr nz, .four_rows
call Function48725
- jr c, .asm_486f8
- ld a, $3
- ld [hli], a
- jr .asm_486fb
-.asm_486f8
- ld a, $4
+ jr c, .four_rows
+ ld a, 3
ld [hli], a
-.asm_486fb
- ld a, $1
+ jr .got_num_rows_2
+
+.four_rows
+ ld a, 4
ld [hli], a
- ld [hl], $0
+.got_num_rows_2
+ ld a, 1
+ ld [hli], a ; num cols
+ ld [hl], $0 ; flags 1
set 5, [hl]
inc hl
xor a
- ld [hli], a
+ ld [hli], a ; flags 2
ld a, $20
- ld [hli], a
- ld a, $1
- add $40
- add $80
+ ld [hli], a ; cursor offsets
+ ld a, A_BUTTON
+ add D_UP
+ add D_DOWN
push af
ld a, [wd002]
bit 6, a
- jr z, .asm_4871a
+ jr z, .got_joypad_mask
pop af
- add $2
+ add B_BUTTON
push af
-.asm_4871a
+.got_joypad_mask
pop af
ld [hli], a
ld a, $1
- ld [hli], a
- ld [hli], a
+ ld [hli], a ; cursor y
+ ld [hli], a ; cursor x
xor a
-rept 3
- ld [hli], a
-endr
+ ld [hli], a ; off char
+ ld [hli], a ; cursor tile
+ ld [hli], a ; cursor tile + 1
ret
Function48725: ; 48725 (12:4725)
+; ld a, [wd003]
+; and $f
+; cp $f
+; jr nz, .clear_carry
+; scf
+; ret
+; .clear_carry
+; and a
+; ret
+
ld a, [wd003]
bit 0, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 1, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 2, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 3, a
- jr z, .asm_4873a
+ jr z, .clear_carry
scf
ret
-.asm_4873a
+
+.clear_carry
and a
ret
Function4873c: ; 4873c (12:473c)
ld hl, w2DMenuCursorInitY
- ld a, $4
- ld [hli], a
- ld a, $c
- ld [hli], a
- ld a, $2
- ld [hli], a
- ld a, $1
+ ld a, 4
ld [hli], a
- ld [hl], $0
+ ld a, 12
+ ld [hli], a ; init x
+ ld a, 2
+ ld [hli], a ; num rows
+ ld a, 1
+ ld [hli], a ; num cols
+ ld [hl], $0 ; flags 1
set 5, [hl]
inc hl
xor a
- ld [hli], a
- ld a, $20
- ld [hli], a
- ld a, $1
- add $2
- ld [hli], a
+ ld [hli], a ; flags 2
+ ln a, 2, 0
+ ld [hli], a ; cursor offsets
+ ld a, A_BUTTON
+ add B_BUTTON
+ ld [hli], a ; joypad filter
+ ; ld a, [PlayerGender]
+ ; xor 1
+ ; inc a
ld a, [PlayerGender]
and a
- jr z, .asm_48764
- ld a, $2
- jr .asm_48766
-.asm_48764
+ jr z, .male
+ ld a, 2
+ jr .okay_gender
+
+.male
+ ld a, 1
+.okay_gender
+ ld [hli], a ; cursor y
ld a, $1
-.asm_48766
- ld [hli], a
- ld a, $1
- ld [hli], a
+ ld [hli], a ; cursor x
xor a
-rept 3
- ld [hli], a
-endr
+ ld [hli], a ; off char
+ ld [hli], a ; cursor tile
+ ld [hli], a ; cursor tile + 1
ret
Function4876f: ; 4876f (12:476f)
diff --git a/misc/mobile_12_2.asm b/misc/mobile_12_2.asm
index 05e92cd55..2bdd6ddc3 100755
--- a/misc/mobile_12_2.asm
+++ b/misc/mobile_12_2.asm
@@ -53,9 +53,9 @@ MobileCheckOwnMonAnywhere: ; 4a843
jr z, .asm_4a8d1
ld hl, .BoxAddrs
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
@@ -616,9 +616,8 @@ Function4abc3: ; 4abc3
ld a, [wMenuCursorY]
ld [wMenuCursorY], a
ld a, [PartyCount]
-rept 2
inc a
-endr
+ inc a
ld b, a
ld a, [wMenuCursorY]
cp b
diff --git a/misc/mobile_22.asm b/misc/mobile_22.asm
index c9a844b42..17b526586 100644
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -45,7 +45,9 @@ Function8917a: ; 8917a (22:517a)
ret
Function89185: ; 89185 (22:5185)
-; Compares c bytes starting at de and hl and incrementing together until a match is found.
+; strcmp(hl, de, c)
+; Compares c bytes starting at de and hl and incrementing together until a mismatch is found.
+; Preserves hl and de.
push de
push hl
.loop
@@ -62,7 +64,9 @@ Function89185: ; 89185 (22:5185)
ret
Function89193: ; 89193
+; copy(hl, de, 4)
; Copies c bytes from hl to de.
+; Preserves hl and de.
push de
push hl
.loop
@@ -92,14 +96,14 @@ Function8919e: ; 8919e (22:519e)
ret
Function891ab: ; 891ab
- call Function89240
+ call Mobile22_SetBGMapMode1
callba ReloadMapPart
- call Function8923c
+ call Mobile22_SetBGMapMode0
ret
; 891b8
Function891b8: ; 891b8
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 0, 0
ld a, " "
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
@@ -125,7 +129,7 @@ Function891d3: ; 891d3 (22:51d3)
ret
Function891de: ; 891de
- call Function8923c
+ call Mobile22_SetBGMapMode0
call ClearPalettes
hlcoord 0, 0, AttrMap
ld a, $7
@@ -193,18 +197,18 @@ Function8921f: ; 8921f (22:521f)
pop de
ret
-Function89235: ; 89235 (22:5235)
+Mobile22_ButtonSound: ; 89235 (22:5235)
call JoyWaitAorB
call PlayClickSFX
ret
-Function8923c: ; 8923c
+Mobile22_SetBGMapMode0: ; 8923c
xor a
ld [hBGMapMode], a
ret
; 89240
-Function89240: ; 89240
+Mobile22_SetBGMapMode1: ; 89240
ld a, $1
ld [hBGMapMode], a
ret
@@ -249,7 +253,7 @@ Function89261: ; 89261
pop af
ld [wMenuCursorBuffer], a
call PushWindow
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function89209
call VerticalMenu
push af
@@ -355,10 +359,10 @@ Function89305: ; 89305 (22:5305)
Function8931b: ; 8931b
push hl
- ld hl, $a03b
+ ld hl, $a03b ; 4:a03b
ld a, [MenuSelection]
dec a
- ld bc, $0025
+ ld bc, 37
call AddNTimes
ld b, h
ld c, l
@@ -371,7 +375,9 @@ Function8932d: ; 8932d
add hl, bc
Function89331: ; 89331
-; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator. Sets carry if it does not find a nonspace character. Returns the location of the following character in hl.
+; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator.
+; Sets carry if it does not find a nonspace character.
+; Returns the location of the following character in hl.
push bc
ld c, 5
.loop
@@ -669,9 +675,8 @@ Function894dc: ; 894dc
ld c, d
ld b, 0
ld hl, .PalettePointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -770,7 +775,7 @@ Function8956f: ; 8956f
add hl, bc
ld b, h
ld c, l
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld a, c
ld [TrainerClass], a
ld a, [rSVBK]
@@ -787,9 +792,8 @@ Function8956f: ; 8956f
ld a, [TrainerClass]
ld h, 0
ld l, a
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, TrainerPalettes
add hl, de
ld a, [rSVBK]
@@ -1043,9 +1047,8 @@ Function896eb: ; 896eb
Function896f5: ; 896f5
call Function8971f
call Function89736
-rept 2
inc hl
-endr
+ inc hl
ld b, 2
ClearScreenArea: ; 0x896ff
@@ -1071,9 +1074,8 @@ ClearScreenArea: ; 0x896ff
jr nz, .loop
dec hl
-rept 2
inc c
-endr
+ inc c
.asm_89713
ld a, $36
ld [hli], a
@@ -1107,9 +1109,8 @@ Function8971f: ; 8971f
Function89736: ; 89736
push hl
-rept 2
inc hl
-endr
+ inc hl
ld e, c
ld d, $0
add hl, de
@@ -1145,9 +1146,8 @@ Function8975b: ; 8975b
ld [hli], a
ld a, $d
ld [hl], a
-rept 2
dec hl
-endr
+ dec hl
ld a, $4
ld e, $3
.asm_89769
@@ -1220,7 +1220,7 @@ Function897af: ; 897af
add hl, bc
ld b, h
ld c, l
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld a, c
ld [TrainerClass], a
xor a
@@ -1655,44 +1655,44 @@ String_89a53: ; 89a53
; 89a57
Function89a57: ; 89a57
- call Function354b
- bit 6, c
- jr nz, .asm_89a78
- bit 7, c
- jr nz, .asm_89a81
- bit 0, c
- jr nz, .asm_89a70
- bit 1, c
- jr nz, .asm_89a70
- bit 3, c
- jr nz, .asm_89a74
+ call JoyTextDelay_ForcehJoyDown ; joypad
+ bit D_UP_F, c
+ jr nz, .d_up
+ bit D_DOWN_F, c
+ jr nz, .d_down
+ bit A_BUTTON_F, c
+ jr nz, .a_b_button
+ bit B_BUTTON_F, c
+ jr nz, .a_b_button
+ bit START_F, c
+ jr nz, .start_button
scf
ret
-.asm_89a70
+.a_b_button
ld a, $1
and a
ret
-.asm_89a74
+.start_button
ld a, $2
and a
ret
-.asm_89a78
- call Function89a9b
- call nc, Function89a8a
+.d_up
+ call .MoveCursorUp
+ call nc, .PlayPocketSwitchSFX
ld a, $0
ret
-.asm_89a81
- call Function89a93
- call nc, Function89a8a
+.d_down
+ call .MoveCursorDown
+ call nc, .PlayPocketSwitchSFX
ld a, $0
ret
; 89a8a
-Function89a8a: ; 89a8a
+.PlayPocketSwitchSFX: ; 89a8a
push af
ld de, SFX_SWITCH_POCKETS
call PlaySFX
@@ -1700,42 +1700,42 @@ Function89a8a: ; 89a8a
ret
; 89a93
-Function89a93: ; 89a93
- ld d, $28
- ld e, $1
- call Function89aa3
+.MoveCursorDown: ; 89a93
+ ld d, 40
+ ld e, 1
+ call .ApplyCursorMovement
ret
; 89a9b
-Function89a9b: ; 89a9b
- ld d, $1
- ld e, $ff
- call Function89aa3
+.MoveCursorUp: ; 89a9b
+ ld d, 1
+ ld e, -1
+ call .ApplyCursorMovement
ret
; 89aa3
-Function89aa3: ; 89aa3
+.ApplyCursorMovement: ; 89aa3
ld a, [MenuSelection]
ld c, a
push bc
-.asm_89aa8
+.loop
ld a, [MenuSelection]
cp d
- jr z, .asm_89ac0
+ jr z, .equal_to_d
add e
- jr nz, .asm_89ab2
+ jr nz, .not_zero
inc a
-.asm_89ab2
+.not_zero
ld [MenuSelection], a
- call Function89ac7
- jr nc, .asm_89aa8
- call Function89ae6
+ call .Function89ac7 ; BCD conversion of data in SRAM?
+ jr nc, .loop
+ call .Function89ae6 ; split [MenuSelection] into [wd030] + [wd031] where [wd030] <= 5
pop bc
and a
ret
-.asm_89ac0
+.equal_to_d
pop bc
ld a, c
ld [MenuSelection], a
@@ -1743,48 +1743,48 @@ Function89aa3: ; 89aa3
ret
; 89ac7
-Function89ac7: ; 89ac7
+.Function89ac7: ; 89ac7
call OpenSRAMBank4
call Function8931b
- call Function89ad4
+ call .Function89ad4
call CloseSRAM
ret
; 89ad4
-Function89ad4: ; 89ad4
+.Function89ad4: ; 89ad4
push de
- call Function8932d
- jr c, .asm_89ae3
- ld hl, $0011
+ call Function8932d ; find a non-space character within 5 bytes of bc
+ jr c, .no_nonspace_character
+ ld hl, 17
add hl, bc
call Function89b45
- jr c, .asm_89ae4
+ jr c, .finish_decode
-.asm_89ae3
+.no_nonspace_character
and a
-.asm_89ae4
+.finish_decode
pop de
ret
; 89ae6
-Function89ae6: ; 89ae6
+.Function89ae6: ; 89ae6
ld hl, wd031
xor a
ld [hl], a
ld a, [MenuSelection]
-.asm_89aee
- cp $6
- jr c, .asm_89afc
- sub $5
+.loop2
+ cp 6
+ jr c, .load_and_ret
+ sub 5
ld c, a
ld a, [hl]
- add $5
+ add 5
ld [hl], a
ld a, c
- jr .asm_89aee
+ jr .loop2
-.asm_89afc
+.load_and_ret
ld [wd030], a
ret
; 89b00
@@ -1796,7 +1796,7 @@ Function89b00: ; 89b00 (22:5b00)
; 89b07 (22:5b07)
Function89b07: ; 89b07
- call Function8923c
+ call Mobile22_SetBGMapMode0
call DelayFrame
callba Function4a3a7
ret
@@ -1824,53 +1824,55 @@ Function89b28: ; 89b28 (22:5b28)
ret
Function89b3b: ; 89b3b (22:5b3b)
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function48cda
ret
Function89b45: ; 89b45
+ ; some sort of decoder?
+ ; BCD?
push hl
push bc
ld c, $10
ld e, $0
-.asm_89b4b
+.loop
ld a, [hli]
ld b, a
and $f
- cp $a
- jr c, .asm_89b5a
+ cp 10
+ jr c, .low_nybble_less_than_10
ld a, c
cp $b
- jr nc, .asm_89b74
- jr .asm_89b71
+ jr nc, .clear_carry
+ jr .set_carry
-.asm_89b5a
+.low_nybble_less_than_10
dec c
swap b
inc e
ld a, b
and $f
- cp $a
- jr c, .asm_89b6c
+ cp 10
+ jr c, .high_nybble_less_than_10
ld a, c
cp $b
- jr nc, .asm_89b74
- jr .asm_89b71
+ jr nc, .clear_carry
+ jr .set_carry
-.asm_89b6c
+.high_nybble_less_than_10
inc e
dec c
- jr nz, .asm_89b4b
+ jr nz, .loop
dec e
-.asm_89b71
+.set_carry
scf
- jr .asm_89b75
+ jr .finish
-.asm_89b74
+.clear_carry
and a
-.asm_89b75
+.finish
pop bc
pop hl
ret
@@ -1912,9 +1914,8 @@ Function89b97: ; 89b97 (22:5b97)
and a
jr z, .asm_89bae
.asm_89ba9
-rept 2
inc hl
-endr
+ inc hl
dec a
jr nz, .asm_89ba9
.asm_89bae
@@ -2034,56 +2035,59 @@ Function89c44: ; 89c44 (22:5c44)
ret
Function89c67: ; 89c67 (22:5c67)
- call Function354b
+; menu scrolling?
+ call JoyTextDelay_ForcehJoyDown ; joypad
ld b, $0
- bit 0, c
- jr z, .asm_89c74
+ bit A_BUTTON_F, c
+ jr z, .not_a_button
ld b, $1
and a
ret
-.asm_89c74
- bit 1, c
- jr z, .asm_89c7a
+
+.not_a_button
+ bit B_BUTTON_F, c
+ jr z, .not_b_button
scf
ret
-.asm_89c7a
+
+.not_b_button
xor a
- bit 6, c
- jr z, .asm_89c81
+ bit D_UP_F, c
+ jr z, .not_d_up
ld a, $1
-.asm_89c81
- bit 7, c
- jr z, .asm_89c87
+.not_d_up
+ bit D_DOWN_F, c
+ jr z, .not_d_down
ld a, $2
-.asm_89c87
- bit 5, c
- jr z, .asm_89c8d
+.not_d_down
+ bit D_LEFT_F, c
+ jr z, .not_d_left
ld a, $3
-.asm_89c8d
- bit 4, c
- jr z, .asm_89c93
+.not_d_left
+ bit D_RIGHT_F, c
+ jr z, .not_d_right
ld a, $4
-.asm_89c93
+.not_d_right
and a
- ret z
+ ret z ; no dpad pressed
dec a
ld c, a
ld d, $0
- ld hl, Unknown_89cbf
+ ld hl, .ScrollData0
ld a, [wd02f]
and a
- jr z, .asm_89ca5
- ld hl, Unknown_89ccf
-.asm_89ca5
+ jr z, .got_data
+ ld hl, .ScrollData1
+.got_data
ld a, [wd011]
and a
- jr z, .asm_89cb1
+ jr z, .got_row
ld e, $4
-.asm_89cad
+.add_n_times
add hl, de
dec a
- jr nz, .asm_89cad
-.asm_89cb1
+ jr nz, .add_n_times
+.got_row
ld e, c
add hl, de
ld a, [hl]
@@ -2096,13 +2100,13 @@ Function89c67: ; 89c67 (22:5c67)
ret
; 89cbf (22:5cbf)
-Unknown_89cbf: ; 89cbf
+.ScrollData0: ; 89cbf
db 0, 2, 0, 0
db 1, 3, 0, 0
db 2, 4, 0, 0
db 3, 0, 0, 0
-Unknown_89ccf: ; 89ccf
+.ScrollData1: ; 89ccf
db 0, 0, 0, 0
db 0, 3, 0, 0
db 2, 4, 0, 0
@@ -2148,44 +2152,48 @@ Function89cdf: ; 89cdf (22:5cdf)
ret
Function89d0d: ; 89d0d (22:5d0d)
- call Function8923c
+ call Mobile22_SetBGMapMode0
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
- ld c, $8
+
+ ld c, 8
ld de, UnknBGPals
-.asm_89d1c
+.loop
push bc
- ld hl, Palette_89d4e
- ld bc, $8
+ ld hl, .Palette1
+ ld bc, 1 palettes
call CopyBytes
pop bc
dec c
- jr nz, .asm_89d1c
- ld hl, Palette_89d56
- ld de, wd010
- ld bc, $8
+ jr nz, .loop
+
+ ld hl, .Palette2
+ ld de, UnknBGPals + 2 palettes
+ ld bc, 1 palettes
call CopyBytes
+
pop af
ld [rSVBK], a
+
call SetPalettes
- callba Function845db
- call Function89240
- ld c, $18
+ callba PrintMail_
+ call Mobile22_SetBGMapMode1
+ ld c, 24
call DelayFrames
call RestartMapMusic
ret
; 89d4e (22:5d4e)
-Palette_89d4e: ; 89d4e
+.Palette1: ; 89d4e
RGB 31, 31, 31
RGB 19, 19, 19
RGB 15, 15, 15
RGB 00, 00, 00
; 89d56
-Palette_89d56: ; 89d56
+.Palette2: ; 89d56
RGB 31, 31, 31
RGB 19, 19, 19
RGB 19, 19, 19
@@ -2197,7 +2205,7 @@ Function89d5e: ; 89d5e (22:5d5e)
call CopyMenuDataHeader
pop af
ld [wMenuCursorBuffer], a
- call Function8923c
+ call Mobile22_SetBGMapMode0
call PlaceVerticalMenuItems
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
@@ -2206,21 +2214,21 @@ Function89d5e: ; 89d5e (22:5d5e)
Function89d75: ; 89d75 (22:5d75)
push hl
- call Function8923c
+ call Mobile22_SetBGMapMode0
call _hl_
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
pop hl
jr asm_89d90
Function89d85: ; 89d85 (22:5d85)
push hl
- call Function8923c
+ call Mobile22_SetBGMapMode0
call _hl_
call CGBOnly_LoadEDTile
pop hl
asm_89d90: ; 89d90 (22:5d90)
- call Function8923c
+ call Mobile22_SetBGMapMode0
push hl
call _hl_
call Function89dab
@@ -2238,9 +2246,9 @@ asm_89d90: ; 89d90 (22:5d90)
ret
Function89dab: ; 89dab (22:5dab)
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba MobileMenuJoypad
- call Function8923c
+ call Mobile22_SetBGMapMode0
ld a, c
ld hl, wMenuJoypadFilter
and [hl]
@@ -2312,7 +2320,7 @@ Jumptable_89e18: ; 89e18 (22:5e18)
Function89e1e: ; 89e1e (22:5e1e)
call OpenSRAMBank4
- ld bc, $a037
+ ld bc, $a037 ; 4:a037
call Function8b36c
call CloseSRAM
xor a
@@ -2418,7 +2426,7 @@ Function89eb9: ; 89eb9 (22:5eb9)
Function89ee1: ; 89ee1 (22:5ee1)
call ClearBGPalettes
call Function893e2
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function4a3a7
callba MG_Mobile_Layout_CreatePalBoxes
hlcoord 1, 0
@@ -2523,9 +2531,8 @@ Function89f77: ; 89f77 (22:5f77)
ld [hli], a
ld a, c
ld [hli], a
-rept 2
inc hl
-endr
+ inc hl
ld a, $8
add c
ld c, a
@@ -2625,7 +2632,7 @@ Function89ff6: ; 89ff6 (22:5ff6)
call Function89a0c
call CloseSRAM
call Function891ab
- call Function89235
+ call Mobile22_ButtonSound
jp Function89e36
Function8a03d: ; 8a03d (22:603d)
@@ -2656,9 +2663,9 @@ Function8a055: ; 8a055 (22:6055)
ld a, $5
call Function8a5a3
pop hl
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, $6
call Function8a5a3
call CGBOnly_LoadEDTile
@@ -2680,7 +2687,7 @@ endr
jp Function89e36
Function8a0a1: ; 8a0a1 (22:60a1)
- call Function8923c
+ call Mobile22_SetBGMapMode0
push bc
call Function8a0c9
ld e, $6
@@ -2781,7 +2788,7 @@ Function8a116: ; 8a116 (22:6116)
ld hl, MenuDataHeader_0x8a176
call LoadMenuDataHeader
.asm_8a121
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8a17b
jr c, .asm_8a16b
ld a, [wMenuCursorY]
@@ -2948,7 +2955,7 @@ Function8a241: ; 8a241 (22:6241)
Function8a262: ; 8a262 (22:6262)
call ClearBGPalettes
call Function893e2
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function4a3a7
callba MG_Mobile_Layout_CreatePalBoxes
hlcoord 1, 0
@@ -3042,7 +3049,7 @@ Function8a313: ; 8a313 (22:6313)
Function8a31c: ; 8a31c (22:631c)
push bc
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function4a3a7
callba MG_Mobile_Layout_CreatePalBoxes
hlcoord 1, 0
@@ -3060,7 +3067,7 @@ Function8a31c: ; 8a31c (22:631c)
set 7, [hl]
.asm_8a34e
call Function8a3a2
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8a453
call Function8a4d3
call Function8a4fc
@@ -3585,7 +3592,7 @@ Function8a6cd: ; 8a6cd (22:66cd)
call Function8a765
call CloseSRAM
jr nc, .asm_8a73f
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function89448
call Function89a23
hlcoord 1, 13
@@ -3804,7 +3811,7 @@ Function8a8c3: ; 8a8c3 (22:68c3)
call Function892b4
call CloseSRAM
call Function89a23
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 1, 13
ld de, String_8a926
call PlaceString
@@ -4069,7 +4076,7 @@ Function8aab6: ; 8aab6 (22:6ab6)
; 8aaf0 (22:6af0)
String_8aaf0: ; 8aaf0
- db "あたらしい めいし", $4a, "できまし", $22, "@"
+ db "あたらしい めいし<PKMN>できまし<LNBRK>@"
; 8ab00
Function8ab00: ; 8ab00
@@ -4077,7 +4084,7 @@ Function8ab00: ; 8ab00
hlcoord 1, 13
call PlaceString
call WaitBGMap
- call Function89235
+ call Mobile22_ButtonSound
and a
ret
@@ -4104,6 +4111,7 @@ Function8ab11: ; 8ab11 (22:6b11)
ret
Function8ab3b: ; 8ab3b (22:6b3b)
+.pressed_start
call Function891fe
call ClearBGPalettes
call Function893cc
@@ -4122,23 +4130,24 @@ Function8ab3b: ; 8ab3b (22:6b3b)
call Function89a0c
call CloseSRAM
call Function891ab
- call Function8ab77
- jr c, Function8ab3b
- ret
-
-Function8ab77: ; 8ab77 (22:6b77)
- call Function354b
- bit 0, c
- jr nz, .asm_8ab8e
- bit 1, c
- jr nz, .asm_8ab8e
- bit 3, c
- jr z, Function8ab77
+ call .JoypadLoop
+ jr c, .pressed_start
+ ret
+
+.JoypadLoop: ; 8ab77 (22:6b77)
+ call JoyTextDelay_ForcehJoyDown
+ bit A_BUTTON_F, c
+ jr nz, .a_b_button
+ bit B_BUTTON_F, c
+ jr nz, .a_b_button
+ bit START_F, c
+ jr z, .JoypadLoop
call PlayClickSFX
call Function89d0d
scf
ret
-.asm_8ab8e
+
+.a_b_button
call PlayClickSFX
and a
ret
@@ -4363,7 +4372,7 @@ Function8ad0b: ; 8ad0b
jr z, .asm_8ad0b
cp $2
jr z, .asm_8ad37
- call Function8923c
+ call Mobile22_SetBGMapMode0
push bc
hlcoord 0, 12
ld b, $4
@@ -4375,7 +4384,7 @@ Function8ad0b: ; 8ad0b
ld a, $2
call Function8925e
jr c, .asm_8ad87
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 0, 12
ld b, $4
ld c, $12
diff --git a/misc/mobile_22_2.asm b/misc/mobile_22_2.asm
index 880ae460a..321998dc7 100644
--- a/misc/mobile_22_2.asm
+++ b/misc/mobile_22_2.asm
@@ -54,16 +54,18 @@ Function8b363: ; 8b363
; 8b36c
Function8b36c: ; 8b36c (22:736c)
+ ; [bc + (0:4)] = -1
push bc
ld h, b
ld l, c
- ld bc, $4
+ ld bc, 4
ld a, -1
call ByteFill
pop bc
ret
Function8b379: ; 8b379 (22:7379)
+ ; d = [bc + e]
push bc
ld a, c
add e
@@ -77,6 +79,7 @@ Function8b379: ; 8b379 (22:7379)
ret
Function8b385: ; 8b385 (22:7385)
+ ; [bc + e] = d
push bc
ld a, c
add e
@@ -90,36 +93,39 @@ Function8b385: ; 8b385 (22:7385)
ret
Function8b391: ; 8b391 (22:7391)
+ ; find first e in range(4) such that [bc + e] == -1
+ ; if none exist, return carry
push bc
- ld e, $0
- ld d, $4
-.asm_8b396
+ ld e, 0
+ ld d, 4
+.loop
ld a, [bc]
inc bc
- cp $ff
- jr z, .asm_8b3a2
+ cp -1
+ jr z, .done
inc e
dec d
- jr nz, .asm_8b396
+ jr nz, .loop
dec e
scf
-.asm_8b3a2
+.done
pop bc
ret
Function8b3a4: ; 8b3a4 (22:73a4)
+ ; strcmp(hl, bc, 4)
push de
push bc
ld d, b
ld e, c
- ld c, $4
+ ld c, 4
call Function89185
pop bc
pop de
ret
Function8b3b0: ; 8b3b0 (22:73b0)
- ld bc, $a037
+ ld bc, $a037 ; 4:a037
ld a, [$a60b]
and a
jr z, .asm_8b3c2
@@ -153,82 +159,88 @@ Function8b3cd: ; 8b3cd (22:73cd)
Function8b3dd: ; 8b3dd (22:73dd)
push de
push bc
- call Function354b
+ call JoyTextDelay_ForcehJoyDown ; joypad
ld a, c
pop bc
pop de
- bit 0, a
- jr nz, .asm_8b3f7
- bit 1, a
- jr nz, .asm_8b40e
- bit 6, a
- jr nz, .asm_8b429
- bit 7, a
- jr nz, .asm_8b443
+ bit A_BUTTON_F, a
+ jr nz, .a_button
+ bit B_BUTTON_F, a
+ jr nz, .b_button
+ bit D_UP_F, a
+ jr nz, .d_up
+ bit D_DOWN_F, a
+ jr nz, .d_down
and a
ret
-.asm_8b3f7
+
+.a_button
ld a, e
cp $3
- jr z, .asm_8b407
+ jr z, .e_is_zero
inc e
- ld d, $0
+ ld d, 0
call Function8b385
xor a
ld [wd010], a
ret
-.asm_8b407
+
+.e_is_zero
call PlayClickSFX
ld d, $0
scf
ret
-.asm_8b40e
+
+.b_button
ld a, e
and a
- jr nz, .asm_8b41e
+ jr nz, .e_is_not_zero
call PlayClickSFX
- ld d, $ff
+ ld d, -1
call Function8b385
- ld d, $1
+ ld d, 1
scf
ret
-.asm_8b41e
- ld d, $ff
+
+.e_is_not_zero
+ ld d, -1
call Function8b385
dec e
xor a
ld [wd010], a
ret
-.asm_8b429
+
+.d_up
call Function8b379
ld a, d
cp $a
- jr c, .asm_8b433
+ jr c, .less_than_10_up_1
ld d, $9
-.asm_8b433
+.less_than_10_up_1
inc d
ld a, d
cp $a
- jr c, .asm_8b43b
+ jr c, .less_than_10_up_2
ld d, $0
-.asm_8b43b
+.less_than_10_up_2
call Function8b385
xor a
ld [wd010], a
ret
-.asm_8b443
+
+.d_down
call Function8b379
ld a, d
cp $a
- jr c, .asm_8b44d
+ jr c, .less_than_10_down
ld d, $0
-.asm_8b44d
+.less_than_10_down
ld a, d
dec d
and a
- jr nz, .asm_8b454
+ jr nz, .nonzero_down
ld d, $9
-.asm_8b454
+.nonzero_down
call Function8b385
xor a
ld [wd010], a
@@ -243,7 +255,7 @@ Function8b45c: ; 8b45c (22:745c)
ld d, $0
call Function8b385
.asm_8b46e
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8b493
call Function8b4cc
call Function8b518
@@ -264,7 +276,7 @@ Function8b45c: ; 8b45c (22:745c)
Function8b493: ; 8b493 (22:7493)
push bc
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8b521
ld hl, Jumptable_8b4a0
pop bc
@@ -314,9 +326,8 @@ Function8b4d8: ; 8b4d8 (22:74d8)
ld hl, Unknown_8b529
call Function8b50a
push hl
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld b, a
ld a, [hl]
@@ -331,9 +342,8 @@ Function8b4ea: ; 8b4ea (22:74ea)
ld hl, Unknown_8b529
call Function8b50a
push hl
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld b, a
ld a, [hl]
@@ -405,6 +415,7 @@ Function8b539: ; 8b539 (22:7539)
ret
Function8b555: ; 8b555 (22:7555)
+.loop
ld hl, UnknownText_0x8b5ce
call PrintText
ld bc, wd017
@@ -418,27 +429,29 @@ Function8b555: ; 8b555 (22:7555)
jr nz, .asm_8b57c
ld hl, UnknownText_0x8b5e2
call PrintText
- jr Function8b555
+ jr .loop
+
.asm_8b57c
ld hl, UnknownText_0x8b5d3
call PrintText
ld bc, wd013
call Function8b45c
- jr c, Function8b555
+ jr c, .loop
ld bc, wd017
ld hl, wd013
call Function8b3a4
- jr z, .asm_8b5a6
+ jr z, .strings_equal
call Function89448
ld bc, wd013
call Function8b493
ld hl, UnknownText_0x8b5d8
call PrintText
jr .asm_8b57c
-.asm_8b5a6
+
+.strings_equal
call OpenSRAMBank4
ld hl, wd013
- ld de, $a037
+ ld de, $a037 ; 4:a037
ld bc, $4
call CopyBytes
call CloseSRAM
@@ -506,7 +519,7 @@ Function8b5e7: ; 8b5e7 (22:75e7)
ld bc, wd013
call Function8b493
call OpenSRAMBank4
- ld hl, $a037
+ ld hl, $a037 ; 4:a037
call Function8b3a4
call CloseSRAM
jr z, .asm_8b635
@@ -644,7 +657,7 @@ Function8b6ed: ; 8b6ed
; 8b703
Function8b703: ; 8b703
- call Function8923c
+ call Mobile22_SetBGMapMode0
push hl
ld a, $c
ld [hli], a
@@ -698,12 +711,10 @@ Function8b73e: ; 8b73e
Function8b744: ; 8b744
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
+ inc c
inc c
-endr
xor a
.asm_8b74d
push bc
@@ -722,7 +733,7 @@ endr
; 8b75d
Function8b75d: ; 8b75d
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 0, 0
ld a, $1
ld bc, SCREEN_WIDTH
@@ -975,9 +986,8 @@ Function8b8c8: ; 8b8c8
ld b, 0
ld c, a
ld hl, Unknown_8b903
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm
index c2a6c20b9..3c7a34710 100644
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -4,7 +4,7 @@ Function100000: ; 100000
; bc: addr
ld a, [rSVBK]
push af
- ld a, $01
+ ld a, 1
ld [rSVBK], a
call Function100022
@@ -26,7 +26,7 @@ Function100000: ; 100000
Function100022: ; 100022
push de
push bc
- call Function100063
+ call SetRAMStateForMobile
pop bc
pop de
ld a, d
@@ -47,14 +47,14 @@ Function100022: ; 100022
; 100057
Function100057: ; 100057
- call Function1000a4
+ call DisableMobile
call ReturnToMapFromSubmenu
ld hl, VramState
res 1, [hl]
ret
; 100063
-Function100063: ; 100063
+SetRAMStateForMobile: ; 100063
xor a
ld hl, BGMapBuffer
ld bc, $65
@@ -67,15 +67,16 @@ Function100063: ; 100063
ld [BGMapBuffer], a
xor a
ld [hMapAnims], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ret
; 100082
-Function100082: ; 100082
+EnableMobile: ; 100082
xor a
ld hl, OverworldMap
ld bc, OverworldMapEnd - OverworldMap
call ByteFill
+
di
call DoubleSpeed
xor a
@@ -84,15 +85,16 @@ Function100082: ; 100082
ld [rIE], a
xor a
ld [hMapAnims], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, $01
ld [hMobileReceive], a
ld [hMobile], a
ei
+
ret
; 0x1000a4
-Function1000a4: ; 1000a4
+DisableMobile: ; 1000a4
di
xor a
ld [hMobileReceive], a
@@ -110,12 +112,12 @@ Function1000a4: ; 1000a4
Function1000ba: ; 1000ba
.loop
- ; call [wcd22]:([wcd23][wcd24] + [wcd25])
+ ; call [wcd22]:([wcd23][wcd24] + [wMobileCommsJumptableIndex])
ld hl, wcd23
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld e, a
ld d, 0
add hl, de
@@ -202,7 +204,7 @@ Function100144: ; 100144
ret z
res 2, [hl]
res 6, [hl]
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
; 100163
@@ -445,12 +447,12 @@ Function100301: ; 100301
; 100320
Function100320: ; 100320
- callba Function104099
+ callba Mobile_ReloadMapPart
ret
; 100327
Function100327: ; 100327
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
; 100327
@@ -984,67 +986,66 @@ MenuData2_100604: ; 100604
db "まつ@"
; 10060d
-Function10060d: ; 10060d
+Mobile_CommunicationStandby: ; 10060d
hlcoord 3, 10
- ld b, $01
- ld c, $0b
+ ld b, 1
+ ld c, 11
call Function3eea
- ld de, String_100621
+ ld de, .String
hlcoord 4, 11
call PlaceString
ret
; 100621
-String_100621: ; 100621
+.String: ; 100621
db "つうしんたいきちゅう!@"
; 10062d
-Function10062d: ; 10062d
+AdvanceMobileInactivityTimerAndCheckExpired: ; 10062d
push bc
- call Function10064e
+ call IncrementMobileInactivityTimerByCFrames
pop bc
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
cp b
- jr nc, .asm_10063a
+ jr nc, .timed_out
and a
ret
-.asm_10063a
+.timed_out
ld a, $fa
ld [wcd2b], a
scf
ret
; 100641
-Function100641: ; 100641
+StartMobileInactivityTimer: ; 100641
xor a
- ld [wcd44], a
- ld [wcd45], a
- ld [wcd46], a
+ ld [wMobileInactivityTimerMinutes], a
+ ld [wMobileInactivityTimerSeconds], a
+ ld [wMobileInactivityTimerFrames], a
ret
; 10064c
-Function10064c: ; 10064c
+IncrementMobileInactivityTimerBy1Frame: ; 10064c
ld c, 1
-
-Function10064e: ; 10064e
- ld hl, wcd46
+IncrementMobileInactivityTimerByCFrames: ; 10064e
+ ld hl, wMobileInactivityTimerFrames ; timer?
ld a, [hl]
add c
- cp $3c
- jr c, .asm_100658
+ cp 60
+ jr c, .seconds
xor a
-.asm_100658
+.seconds
ld [hld], a
ret c
ld a, [hl]
inc a
- cp $3c
- jr c, .asm_100661
+ cp 60
+ jr c, .minutes
xor a
-.asm_100661
+.minutes
ld [hld], a
ret c
inc [hl]
@@ -1166,9 +1167,9 @@ Function1006fd: ; 1006fd
ld hl, $a800
call GetSRAMBank
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
call CloseSRAM
ret
; 10070d
@@ -1266,35 +1267,35 @@ Function100772: ; 100772
Function10079c: ; 10079c
ld a, [wcd21]
cp $01
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld hl, wcd2a
bit 5, [hl]
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld hl, wcd2a
bit 6, [hl]
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld a, [wcd6a]
add c
- cp $3c
- jr nc, .asm_1007be
+ cp 60
+ jr nc, .overflow
ld [wcd6a], a
and a
ret
-.asm_1007be
- sub $3c
+.overflow
+ sub 60
ld [wcd6a], a
ld d, b
push de
call Function1007f6
pop de
- jr c, .asm_1007e5
+ jr c, .quit
ld a, c
and a
- jr nz, .asm_1007e5
+ jr nz, .quit
ld a, b
- cp $0a
- jr nc, .asm_1007e5
+ cp 10
+ jr nc, .quit
ld a, d
and a
ret z
@@ -1307,7 +1308,7 @@ Function10079c: ; 10079c
and a
ret
-.asm_1007e5
+.quit
call Function1008e0
ld hl, wcd2a
set 4, [hl]
@@ -1316,7 +1317,7 @@ Function10079c: ; 10079c
scf
ret
-.asm_1007f4
+.dont_quit
and a
ret
; 1007f6
@@ -1702,7 +1703,7 @@ _LinkBattleSendReceiveAction: ; 100a09
.MobileBattle_SendReceiveAction: ; 100a87
call Function100acf
- call Function100641
+ call StartMobileInactivityTimer
ld a, 0
ld [wcd27], a
.asm_100a92
@@ -1712,7 +1713,7 @@ _LinkBattleSendReceiveAction: ; 100a09
ld c, $01
ld b, $03
push bc
- call Function10062d
+ call AdvanceMobileInactivityTimerAndCheckExpired
pop bc
jr c, .asm_100ac7
ld b, $01
@@ -1821,7 +1822,7 @@ Function100b45: ; 100b45
call Mobile_SetOverworldDelay
callba MobileMenuJoypad
push bc
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call Function100e2d
pop bc
jr c, .asm_100b6b
@@ -1882,7 +1883,7 @@ MobileMoveSelectionScreen: ; 100b9f
call Mobile_SetOverworldDelay
callba MobileMenuJoypad
push bc
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call Function100e2d
pop bc
jr c, .b_button
@@ -2016,8 +2017,8 @@ Mobile_PartyMenuSelect: ; 100cb5
callba MobileMenuJoypad
push bc
callba PlaySpriteAnimations
- callba Function10402d
- call Function100dfd
+ callba HDMATransferTileMapToWRAMBank3
+ call MobileComms_CheckInactivityTimer
pop bc
jr c, .done
ld a, [wMenuJoypadFilter]
@@ -2070,8 +2071,8 @@ MobileBattleMonMenu: ; 100d22
callba MobileMenuJoypad
push bc
callba PlaySpriteAnimations
- callba Function10402d
- call Function100dfd
+ callba HDMATransferTileMapToWRAMBank3
+ call MobileComms_CheckInactivityTimer
pop bc
jr c, .asm_100d54
ld a, [wMenuJoypadFilter]
@@ -2178,7 +2179,7 @@ Mobile_SetOverworldDelay: ; 100dd2
Function100dd8: ; 100dd8
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
jr c, .asm_100dfb
ld c, $3c
ld b, $01
@@ -2196,7 +2197,7 @@ Function100dd8: ; 100dd8
ret
; 100dfd
-Function100dfd: ; 100dfd
+MobileComms_CheckInactivityTimer: ; 100dfd
ld a, [OverworldDelay]
ld c, a
ld a, 30
@@ -2204,22 +2205,22 @@ Function100dfd: ; 100dfd
ld c, a
ld b, 3
push bc
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired ; useless to farcall
pop bc
- jr c, .asm_100e2b
+ jr c, .quit
ld b, 1
call Function10079c
- jr c, .asm_100e2b
+ jr c, .quit
call Function1009f3
- jr c, .asm_100e2b
- callba Function10032e
+ jr c, .quit
+ callba Function10032e ; useless to farcall
ld a, [wcd2b]
and a
- jr nz, .asm_100e2b
+ jr nz, .quit
xor a
ret
-.asm_100e2b
+.quit
scf
ret
; 100e2d
@@ -2232,7 +2233,7 @@ Function100e2d: ; 100e2d
ld c, a
ld b, 3
push bc
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
pop bc
jr c, .asm_100e61
ld b, 1
@@ -2641,53 +2642,55 @@ Function1010de: ; 1010de
ret
; 1010f2
-Function1010f2: ; 1010f2
+LoadSelectedPartiesForColosseum: ; 1010f2
xor a
ld hl, StringBuffer2
ld bc, 9
call ByteFill
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld de, PartyCount
- call Function101145
- ld hl, wdc5c
+ call .CopyThreeSpecies
+ ld hl, wPlayerMonSelection
ld de, PartyMon1Species
- call Function10117c
- ld hl, wdc5c
+ call .CopyPartyStruct
+ ld hl, wPlayerMonSelection
ld de, PartyMonOT
- call Function101181
- ld hl, wdc5c
+ call .CopyName
+ ld hl, wPlayerMonSelection
ld de, PartyMonNicknames
- call Function101181
- ld hl, wcd75
+ call .CopyName
+ ld hl, wOTMonSelection
ld de, OTPartyCount
- call Function101145
- ld hl, wcd75
+ call .CopyThreeSpecies
+ ld hl, wOTMonSelection
ld de, OTPartyMon1Species
- call Function10117c
- ld hl, wcd75
+ call .CopyPartyStruct
+ ld hl, wOTMonSelection
ld de, OTPartyMonOT
- call Function101181
- ld hl, wcd75
+ call .CopyName
+ ld hl, wOTMonSelection
ld de, OTPartyMonNicknames
- call Function101181
+ call .CopyName
ret
; 101145
-Function101145: ; 101145
+.CopyThreeSpecies: ; 101145
+; Load the 3 choices to the buffer
push de
ld bc, StringBuffer2 + 6
xor a
-.asm_10114a
+.party_loop
push af
- call Function101168
+ call .GetNthSpecies
ld [bc], a
inc bc
pop af
inc a
- cp $03
- jr nz, .asm_10114a
+ cp 3
+ jr nz, .party_loop
pop de
- ld a, $03
+; Copy the 3 choices to the party
+ ld a, 3
ld [de], a
inc de
ld hl, StringBuffer2 + 6
@@ -2698,7 +2701,9 @@ Function101145: ; 101145
ret
; 101168
-Function101168: ; 101168
+.GetNthSpecies: ; 101168
+; Preserves hl and de
+; Get the index of the Nth selection
push hl
add l
ld l, a
@@ -2707,6 +2712,7 @@ Function101168: ; 101168
ld h, a
ld a, [hl]
pop hl
+; Get the corresponding species
push de
inc de
add e
@@ -2719,34 +2725,38 @@ Function101168: ; 101168
ret
; 10117c
-Function10117c: ; 10117c
- ld bc, $30
- jr asm_101184
+.CopyPartyStruct: ; 10117c
+ ld bc, PARTYMON_STRUCT_LENGTH
+ jr .ContinueCopy
-Function101181: ; 101181
- ld bc, 11
+.CopyName: ; 101181
+ ld bc, NAME_LENGTH
-asm_101184:
+.ContinueCopy:
+ ; Copy, via wc608...
ld a, wc608 % $100
ld [StringBuffer2], a
ld a, wc608 / $100
ld [StringBuffer2 + 1], a
+ ; ... bc bytes...
ld a, c
ld [StringBuffer2 + 2], a
ld a, b
ld [StringBuffer2 + 3], a
+ ; ... to de...
ld a, e
ld [StringBuffer2 + 4], a
ld a, d
ld [StringBuffer2 + 5], a
- ld a, $03
-.asm_1011a0
+ ; ... 3 times.
+ ld a, 3
+.big_copy_loop
push af
ld a, [hli]
push hl
push af
- call Function1011df
- call Function1011e8
+ call .GetDestinationAddress
+ call .GetCopySize
pop af
call AddNTimes
ld a, [StringBuffer2]
@@ -2761,14 +2771,14 @@ asm_101184:
pop hl
pop af
dec a
- jr nz, .asm_1011a0
- call Function1011e8
+ jr nz, .big_copy_loop
+ call .GetCopySize
ld a, 3
ld hl, 0
call AddNTimes
ld b, h
ld c, l
- call Function1011df
+ call .GetDestinationAddress
ld d, h
ld e, l
ld hl, wc608
@@ -2776,7 +2786,7 @@ asm_101184:
ret
; 1011df
-Function1011df: ; 1011df
+.GetDestinationAddress: ; 1011df
ld a, [StringBuffer2 + 4]
ld l, a
ld a, [StringBuffer2 + 5]
@@ -2784,7 +2794,7 @@ Function1011df: ; 1011df
ret
; 1011e8
-Function1011e8: ; 1011e8
+.GetCopySize: ; 1011e8
ld a, [StringBuffer2 + 2]
ld c, a
ld a, [StringBuffer2 + 3]
@@ -2889,146 +2899,144 @@ Function10127d: ; 10127d
Function10127e: ; 10127e
ld a, [wdc5f]
and a
- jr z, .asm_101290
- cp $01
+ jr z, .zero
+ cp 1
ld c, $27
- jr z, .asm_101292
- cp $02
+ jr z, .load
+ cp 2
ld c, $37
- jr z, .asm_101292
-
-.asm_101290
+ jr z, .load
+.zero
ld c, 0
-
-.asm_101292
+.load
ld a, c
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101297
Jumptable_101297: ; 101297
- dw Function101a97
- dw Function101ab4
- dw Function101475
- dw Function101b0f
- dw Function101438
- dw Function101b2b
- dw Function101b59
- dw Function101475
- dw Function101b70
- dw Function101438
- dw Function101b8f
- dw Function101d7b
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101dd0
- dw Function101de3
- dw Function101e39
- dw Function101e09
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101e09
- dw Function101e31
- dw Function101bc8
- dw Function101438
- dw Function101be5
- dw Function101ac6
- dw Function101ab4
- dw Function101475
- dw Function101c11
- dw Function1014f4
- dw Function101cc8
- dw Function1014e2
- dw Function1014e2
- dw Function101d10
- dw Function101d2a
- dw Function101d2a
- dw Function101507
- dw Function10156d
- dw Function101557
- dw Function10158a
- dw Function101c42
- dw Function101aed
- dw Function101ab4
- dw Function101475
- dw Function101c2b
- dw Function1014f4
- dw Function101cdf
- dw Function1014e2
- dw Function1014e2
- dw Function101d1e
- dw Function101d2a
- dw Function101d2a
- dw Function101507
- dw Function10156d
- dw Function101544
- dw Function10158a
- dw Function101c42
- dw Function101c50
- dw Function1014ce
- dw Function101cf6
- dw Function101826
- dw Function1017e4
- dw Function1017f1
- dw Function1018a8
- dw Function1018d6
- dw Function1017e4
- dw Function1017f1
- dw Function1018e1
- dw Function1015df
- dw Function10167d
- dw Function10168a
- dw Function10162a
- dw Function1015be
- dw Function10167d
- dw Function10168a
- dw Function10161f
- dw Function10159d
- dw Function10167d
- dw Function10168a
- dw Function101600
- dw Function101d03
- dw Function101d6b
- dw Function10159d
- dw Function1014ce
- dw Function10168e
- dw Function101600
- dw Function101913
- dw Function10194b
- dw Function10196d
- dw Function1017e4
- dw Function1017f5
- dw Function1019ab
- dw Function101537
- dw Function101571
- dw Function101c92
- dw Function10152a
- dw Function101571
- dw Function101a4f
- dw Function101cbc
- dw Function101c62
- dw Function101537
- dw Function101571
- dw Function101c92
- dw Function10152a
- dw Function101571
- dw Function101ca0
- dw Function101475
- dw Function101cbc
+ dw Function101a97 ; 00
+ dw Function101ab4 ; 01
+ dw Function101475 ; 02
+ dw Function101b0f ; 03
+ dw Function101438 ; 04
+ dw Function101b2b ; 05
+ dw Function101b59 ; 06
+ dw Function101475 ; 07
+ dw Function101b70 ; 08
+ dw Function101438 ; 09
+ dw Function101b8f ; 0a
+ dw Function101d7b ; 0b
+ dw Function101d95 ; 0c
+ dw Function101475 ; 0d
+ dw Function101db2 ; 0e
+ dw Function101e4f ; 0f
+ dw Function101475 ; 10
+ dw Function101e64 ; 11
+ dw Function101e4f ; 12
+ dw Function101475 ; 13
+ dw Function101e64 ; 14
+ dw Function101d95 ; 15
+ dw Function101475 ; 16
+ dw Function101db2 ; 17
+ dw Function101dd0 ; 18
+ dw Function101de3 ; 19
+ dw Function101e39 ; 1a
+ dw Function101e09 ; 1b
+ dw Function101e4f ; 1c
+ dw Function101475 ; 1d
+ dw Function101e64 ; 1e
+ dw Function101d95 ; 1f
+ dw Function101475 ; 20
+ dw Function101db2 ; 21
+ dw Function101e09 ; 22
+ dw Function101e31 ; 23
+ dw Function101bc8 ; 24
+ dw Function101438 ; 25
+ dw Function101be5 ; 26
+ dw Function101ac6 ; 27
+ dw Function101ab4 ; 28
+ dw Function101475 ; 29
+ dw Function101c11 ; 2a
+ dw Function1014f4 ; 2b
+ dw Function101cc8 ; 2c
+ dw Function1014e2 ; 2d
+ dw Function1014e2 ; 2e
+ dw Function101d10 ; 2f
+ dw Function101d2a ; 30
+ dw Function101d2a ; 31
+ dw Function101507 ; 32
+ dw Function10156d ; 33
+ dw Function101557 ; 34
+ dw Function10158a ; 35
+ dw Function101c42 ; 36
+ dw Function101aed ; 37
+ dw Function101ab4 ; 38
+ dw Function101475 ; 39
+ dw Function101c2b ; 3a
+ dw Function1014f4 ; 3b
+ dw Function101cdf ; 3c
+ dw Function1014e2 ; 3d
+ dw Function1014e2 ; 3e
+ dw Function101d1e ; 3f
+ dw Function101d2a ; 40
+ dw Function101d2a ; 41
+ dw Function101507 ; 42
+ dw Function10156d ; 43
+ dw Function101544 ; 44
+ dw Function10158a ; 45
+ dw Function101c42 ; 46
+ dw Function101c50 ; 47
+ dw Function1014ce ; 48
+ dw Function101cf6 ; 49
+ dw Function101826 ; 4a
+ dw Function1017e4 ; 4b
+ dw Function1017f1 ; 4c
+ dw Function1018a8 ; 4d
+ dw Function1018d6 ; 4e
+ dw Function1017e4 ; 4f
+ dw Function1017f1 ; 50
+ dw Function1018e1 ; 51
+ dw Function1015df ; 52
+ dw Function10167d ; 53
+ dw Function10168a ; 54
+ dw Function10162a ; 55
+ dw Function1015be ; 56
+ dw Function10167d ; 57
+ dw Function10168a ; 58
+ dw Function10161f ; 59
+ dw Function10159d ; 5a
+ dw Function10167d ; 5b
+ dw Function10168a ; 5c
+ dw Function101600 ; 5d
+ dw Function101d03 ; 5e
+ dw Function101d6b ; 5f
+ dw Function10159d ; 60
+ dw Function1014ce ; 61
+ dw Function10168e ; 62
+ dw Function101600 ; 63
+ dw Function101913 ; 64
+ dw Function10194b ; 65
+ dw _SelectMonsForMobileBattle ; 66
+ dw Function1017e4 ; 67
+ dw Function1017f5 ; 68
+ dw _StartMobileBattle ; 69
+ dw Function101537 ; 6a
+ dw Function101571 ; 6b
+ dw Function101c92 ; 6c
+ dw Function10152a ; 6d
+ dw Function101571 ; 6e
+ dw Function101a4f ; 6f
+ dw Function101cbc ; 70
+ dw Function101c62 ; 71
+ dw Function101537 ; 72
+ dw Function101571 ; 73
+ dw Function101c92 ; 74
+ dw Function10152a ; 75
+ dw Function101571 ; 76
+ dw Function101ca0 ; 77
+ dw Function101475 ; 78
+ dw Function101cbc ; 79
; 10138b
Function10138b: ; 10138b
@@ -3074,7 +3082,7 @@ Function1013c0: ; 1013c0
; 1013d6
Function1013d6: ; 1013d6
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 1013dd
@@ -3182,9 +3190,9 @@ Function101438: ; 101438
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101457
@@ -3221,9 +3229,9 @@ Function101475: ; 101475
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101494
@@ -3268,10 +3276,10 @@ Function1014b7: ; 1014b7
Function1014ce: ; 1014ce
callba Function100720
- callba Function100641
- ld a, [wcd25]
+ callba StartMobileInactivityTimer
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1014e2
@@ -3280,19 +3288,19 @@ Function1014e2: ; 1014e2
set 6, [hl]
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1014f4
Function1014f4: ; 1014f4
- callba Function100082
+ callba EnableMobile
ld hl, wcd29
set 6, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101507
@@ -3302,57 +3310,57 @@ Function101507: ; 101507
ld bc, $40
ld a, $02
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10151d
Function10151d: ; 10151d ; unreferenced
ld a, $34
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10152a
Function10152a: ; 10152a
ld a, $36
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101537
Function101537: ; 101537
ld a, $0a
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101544
Function101544: ; 101544
- callba Function100641
+ callba StartMobileInactivityTimer
ld a, $12
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101557
Function101557: ; 101557
- callba Function100641
+ callba StartMobileInactivityTimer
ld hl, wcd53
ld a, $08
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10156d
@@ -3371,15 +3379,15 @@ Function101571: ; 101571
ret
.asm_101582
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10158a
Function10158a: ; 10158a
- callba Function10064c
- ld a, [wcd44]
+ callba IncrementMobileInactivityTimerBy1Frame
+ ld a, [wMobileInactivityTimerMinutes]
cp $0a
jr c, Function10156d
ld a, $fb
@@ -3396,9 +3404,9 @@ Function10159d: ; 10159d
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1015be
@@ -3411,9 +3419,9 @@ Function1015be: ; 1015be
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1015df
@@ -3426,9 +3434,9 @@ Function1015df: ; 1015df
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101600
@@ -3440,25 +3448,25 @@ Function101600: ; 101600
call FarCopyWRAM
ld de, wc608
callba Function100ee6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10161f
Function10161f: ; 10161f
call Function101649
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10162a
Function10162a: ; 10162a
call Function101663
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101635
@@ -3513,9 +3521,9 @@ Function101674: ; 101674 ; unreferenced
Function10167d: ; 10167d
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10168a
@@ -3530,7 +3538,7 @@ Function10168e: ; 10168e
ret c
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
ret c
ld a, [wcd26]
ld hl, Jumptable_1016c3
@@ -3542,9 +3550,9 @@ Function10168e: ; 10168e
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1016c3
@@ -3746,9 +3754,9 @@ Function1017c7: ; 1017c7
Function1017e4: ; 1017e4
ld a, 0
ld [wcd27], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1017f1
@@ -3763,20 +3771,20 @@ Function1017f5: ; 1017f5
ret c
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
ret c
callba Function100382
ld a, [wcd27]
bit 7, a
- jr nz, .asm_10181e
+ jr nz, .next
ld hl, wcd29
set 6, [hl]
ret
-.asm_10181e
- ld a, [wcd25]
+.next
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101826
@@ -3792,9 +3800,9 @@ Function101826: ; 101826
ld hl, Unknown_10186f
ld de, wccb4
call Function1013f5
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101844
@@ -3811,9 +3819,9 @@ Function101826: ; 101826
.asm_10185b
ld de, wccb4
call Function1013f5
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101869
@@ -3857,9 +3865,9 @@ Function1018a8: ; 1018a8
ld a, $06
call Function101406
jr c, .asm_1018ca
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1018ca
@@ -3875,17 +3883,17 @@ Function1018a8: ; 1018a8
Function1018d6: ; 1018d6
call Function1018ec
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1018e1
Function1018e1: ; 1018e1
call Function1018fb
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1018ec
@@ -3938,17 +3946,17 @@ Function101913: ; 101913
cp $02
jr z, .asm_101945
ld a, $71
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_10193f
ld a, $66
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101945
ld a, $65
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10194b
@@ -3961,25 +3969,25 @@ Function10194b: ; 10194b
jr nz, .asm_101967
call Function1013c0
ld a, $71
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101967
ld a, $60
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10196d
-Function10196d: ; 10196d
+_SelectMonsForMobileBattle: ; 10196d
callba BlankScreen
- callba Function10060d
+ callba Mobile_CommunicationStandby
ld hl, wcd29
set 5, [hl]
ld hl, wcd2a
set 6, [hl]
ld a, $06
ld [wccb4], a
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld de, wccb5
ld bc, 3
call CopyBytes
@@ -3990,14 +3998,14 @@ Function10196d: ; 10196d
ld [wccb9], a
ld a, [hl]
ld [wccba], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1019ab
-Function1019ab: ; 1019ab
- call Function101a75
+_StartMobileBattle: ; 1019ab
+ call CopyOtherPlayersBattleMonSelection
callba Function100754
xor a
ld [wdc5f], a
@@ -4005,33 +4013,32 @@ Function1019ab: ; 1019ab
callba BlankScreen
call SpeechTextBox
callba Function100846
- ld c, $78
+ ld c, 120
call DelayFrames
callba ClearTileMap
- call Function1019ee
- call Function101a21
+ call .CopyOTDetails
+ call StartMobileBattle
ld a, [wcd2b]
cp $fc
jr nz, .asm_1019e6
xor a
ld [wcd2b], a
-
.asm_1019e6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1019ee
-Function1019ee: ; 1019ee
+.CopyOTDetails: ; 1019ee
ld a, [rSVBK]
push af
- ld a, $05
+ ld a, 5
ld [rSVBK], a
ld bc, w5_dc0d
ld de, w5_dc11
- callba Function4e929
+ callba GetMobileOTTrainerClass
pop af
ld [rSVBK], a
@@ -4044,29 +4051,29 @@ Function1019ee: ; 1019ee
call CopyBytes
ld a, [wcd2f]
and a
- ld a, $02
- jr z, .asm_101a1e
- ld a, $01
-
-.asm_101a1e
+ ld a, 2
+ jr z, .got_link_player_number
+ ld a, 1
+.got_link_player_number
ld [hLinkPlayerNumber], a
ret
; 101a21
-Function101a21: ; 101a21
+StartMobileBattle: ; 101a21
+ ; force stereo and fast text speed
ld hl, Options
ld a, [hl]
push af
- and $20
- or $01
+ and (1 << STEREO)
+ or 1 ; 1 frame per character i.e. fast text
ld [hl], a
- ld a, $01
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
callba BattleIntro
callba DoBattle
callba ShowLinkBattleParticipantsAfterEnd
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
ld a, $ff
ld [hLinkPlayerNumber], a
pop af
@@ -4075,29 +4082,29 @@ Function101a21: ; 101a21
; 101a4f
Function101a4f: ; 101a4f
- ld a, $01
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
callba DetermineMobileBattleResult
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
callba CleanUpBattleRAM
callba LoadPokemonData
call Function1013c0
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101a75
-Function101a75: ; 101a75
+CopyOtherPlayersBattleMonSelection: ; 101a75
ld hl, wcc61
- ld de, wcd75
+ ld de, wOTMonSelection
ld bc, 3
call CopyBytes
ld de, wcc64
callba Function100772
callba Function101050
- callba Function1010f2
+ callba LoadSelectedPartiesForColosseum
ret
; 101a97
@@ -4109,9 +4116,9 @@ Function101a97: ; 101a97
call Function10142c
ld hl, wcd29
set 6, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ab4
@@ -4120,9 +4127,9 @@ Function101ab4: ; 101ab4
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ac6
@@ -4138,9 +4145,9 @@ Function101ac6: ; 101ac6
ld [wcd2f], a
ld de, wdc42
call Function102068
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101aed
@@ -4154,9 +4161,9 @@ Function101aed: ; 101aed
set 6, [hl]
ld a, $01
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b0f
@@ -4167,9 +4174,9 @@ Function101b0f: ; 101b0f
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4193,9 +4200,9 @@ Function101b2b: ; 101b2b
ret
.asm_101b51
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b59
@@ -4206,9 +4213,9 @@ Function101b59: ; 101b59
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b70
@@ -4220,9 +4227,9 @@ Function101b70: ; 101b70
ld hl, wcd29
set 5, [hl]
call UpdateSprites
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4243,17 +4250,17 @@ Function101b8f: ; 101b8f
jr z, .asm_101bbc
ld a, $01
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101bbc
xor a
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101bc8
@@ -4266,9 +4273,9 @@ Function101bc8: ; 101bc8
call Function1013dd
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101be5
@@ -4286,7 +4293,7 @@ Function101be5: ; 101be5
cp $01
jr nz, .asm_101c0b
ld a, $2a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101c0b
@@ -4303,9 +4310,9 @@ Function101c11: ; 101c11
call Function102048
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c2b
@@ -4316,9 +4323,9 @@ Function101c2b: ; 101c2b
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c42
@@ -4327,7 +4334,7 @@ Function101c42: ; 101c42
set 1, [hl]
call Function100665
ld a, $47
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c50
@@ -4336,9 +4343,9 @@ Function101c50: ; 101c50
call Function101ee4
ld hl, wcd29
set 2, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c62
@@ -4356,9 +4363,9 @@ Function101c62: ; 101c62
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4366,9 +4373,9 @@ Function101c62: ; 101c62
Function101c92: ; 101c92
callba Function100675
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ca0
@@ -4379,9 +4386,9 @@ Function101ca0: ; 101ca0
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4406,9 +4413,9 @@ Function101cc8: ; 101cc8
ld [wc30d], a
ld hl, wcd29
set 4, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101cdf
@@ -4419,44 +4426,44 @@ Function101cdf: ; 101cdf
ld [wc30d], a
ld hl, wcd29
set 4, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101cf6
Function101cf6: ; 101cf6
ld a, $0b
ld [wc314 + 1], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d03
Function101d03: ; 101d03
ld a, $0e
ld [wc314 + 1], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d10
Function101d10: ; 101d10
ld c, $01
call Function10142c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
jr Function101d2a
Function101d1e: ; 101d1e
ld c, $03
call Function10142c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function101d2a: ; 101d2a
call Function101418
@@ -4471,9 +4478,9 @@ Function101d2a: ; 101d2a
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d4d
@@ -4506,7 +4513,7 @@ Function101d6b: ; 101d6b
ld hl, wcd29
res 4, [hl]
ld a, $64
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d7b
@@ -4517,7 +4524,7 @@ Function101d7b: ; 101d7b
add hl, bc
ld c, [hl]
ld a, c
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d8d
@@ -4532,9 +4539,9 @@ Function101d95: ; 101d95
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4546,9 +4553,9 @@ Function101db2: ; 101db2
ld hl, wcd29
set 5, [hl]
jr c, .asm_101dca
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101dca
@@ -4562,12 +4569,12 @@ Function101dd0: ; 101dd0
bit 1, [hl]
jr nz, .asm_101ddd
ld a, $19
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101ddd
ld a, $1b
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101de3
@@ -4575,17 +4582,17 @@ Function101de3: ; 101de3
call Function101ecc
call Function101ead
jr c, .asm_101df3
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101df3
call Function101e98
jr c, .asm_101e00
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e00
@@ -4598,9 +4605,9 @@ Function101de3: ; 101de3
Function101e09: ; 101e09
call Function101ead
jr c, .asm_101e16
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e16
@@ -4610,9 +4617,9 @@ Function101e09: ; 101e09
call Function101ed3
pop af
jr c, .asm_101e2b
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e2b
@@ -4623,7 +4630,7 @@ Function101e09: ; 101e09
Function101e31: ; 101e31
ld a, $3a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
jp Function101c2b
; 101e39
@@ -4634,7 +4641,7 @@ Function101e39: ; 101e39
pop af
jr c, .asm_101e49
ld a, $2a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e49
@@ -4647,9 +4654,9 @@ Function101e4f: ; 101e4f
ld e, $06
call Function101ee4
call Function1013d6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4663,7 +4670,7 @@ Function101e64: ; 101e64
pop af
jr c, .asm_101e77
ld a, $24
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e77
@@ -4676,17 +4683,17 @@ Function101e64: ; 101e64
Function101e82: ; 101e82 ; unreferenced
call Function101ecc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101e8d
Function101e8d: ; 101e8d ; unreferenced
call Function101ed3
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101e98
@@ -5182,7 +5189,7 @@ Function10224b: ; 10224b
.asm_10225e
res 1, [hl]
res 2, [hl]
- callba Function104099
+ callba Mobile_ReloadMapPart
scf
ret
; 10226a
@@ -5269,7 +5276,7 @@ Function1022d0: ; 1022d0
sub c
ld c, a
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
jr c, .asm_1022f3
xor a
ret
@@ -5444,8 +5451,8 @@ Function102416: ; 102416
Function102423: ; 102423
call Function102921
ret nc
- callba Function14a58
- callba MobileFn_1060af
+ callba SaveAfterLinkTrade
+ callba TrainerRankings_Trades
callba BackupMobileEventIndex
ld hl, wcd4b
set 1, [hl]
@@ -6145,7 +6152,7 @@ Function1028e8: ; 1028e8
ld hl, wcd4b
res 6, [hl]
ld [wcd50], a
- callba Function100641
+ callba StartMobileInactivityTimer
ld a, 0
ld [wcd4a], a
ret
@@ -6549,7 +6556,7 @@ Function102bac: ; 102bac
ld [CurPartyMon], a
call LowVolume
call ClearSprites
- callba _BattleStatsScreenInit
+ callba _MobileStatsScreenInit
ld a, [CurPartyMon]
inc a
ld [wMenuCursorY], a
@@ -6809,7 +6816,7 @@ Function102d9a: ; 102d9a
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 102db7
@@ -7204,9 +7211,9 @@ Function1030cd: ; 1030cd
ld a, [wcf44]
ld l, a
ld h, 0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld bc, Unknown_103112
add hl, bc
ld b, $30
@@ -7390,7 +7397,7 @@ Function103309: ; 103309
ld [wd1ee], a
call Function1034be
call UpdateSprites
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ld a, $01
ld [wd1f0], a
call Function10339a
@@ -7404,7 +7411,7 @@ Function103362: ; 103362
call Function1033af
call Function10339a
call Function10342c
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ld a, [Buffer2]
bit 7, a
jr z, .asm_103362
@@ -7443,17 +7450,17 @@ Function10339a: ; 10339a
Function1033af: ; 1033af
call GetJoypad
ld a, [hJoyPressed]
- bit 5, a
+ bit D_LEFT_F, a
jr nz, .left
- bit 4, a
+ bit D_RIGHT_F, a
jr nz, .right
- bit 1, a
+ bit B_BUTTON_F, a
jr nz, .b
- bit 0, a
+ bit A_BUTTON_F, a
jr nz, .a
- bit 6, a
+ bit D_UP_F, a
jr nz, .up
- bit 7, a
+ bit D_DOWN_F, a
jr nz, .down
ret
@@ -7461,7 +7468,7 @@ Function1033af: ; 1033af
ld a, [wd1f0]
dec a
ld [wd1f0], a
- cp $01
+ cp 1
ret nc
ld a, [wd1ee]
ld [wd1f0], a
@@ -7475,7 +7482,7 @@ Function1033af: ; 1033af
ld a, [wd1ee]
cp c
ret nc
- ld a, $01
+ ld a, 1
ld [wd1f0], a
ret
@@ -7487,8 +7494,8 @@ Function1033af: ; 1033af
.a
ld a, [wd1f3]
- cp $03
- jr nz, .asm_103412
+ cp 3
+ jr nz, .a_return
ld de, SFX_TRANSACTION
call PlaySFX
ld hl, Buffer2
@@ -7499,9 +7506,9 @@ Function1033af: ; 1033af
.left
.right
-.asm_103412
+.a_return
ld a, [wd1f3]
- cp $03
+ cp 3
ret z
ld de, SFX_PUSH_BUTTON
call PlaySFX
@@ -8101,7 +8108,7 @@ Function10383c: ; 10383c
ld a, $01
ld [wdc60], a
xor a
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld [hli], a
ld [hli], a
ld [hl], a
@@ -8112,7 +8119,7 @@ Function10383c: ; 10383c
callba Function4a94e
jr c, .asm_103870
ld hl, wd002
- ld de, wdc5c
+ ld de, wPlayerMonSelection
ld bc, 3
call CopyBytes
xor a
diff --git a/misc/mobile_41.asm b/misc/mobile_41.asm
index 44db58602..331242d88 100755
--- a/misc/mobile_41.asm
+++ b/misc/mobile_41.asm
@@ -1,50 +1,63 @@
SECTION "bank41_2", ROMX, BANK[$41]
-Mobile_HallOfFame2:: mobile ; 0x105ef6
+; These functions deal with miscellaneous statistics
+; which were used for Trainer Rankings in Pokémon News.
+
+; Copies certain values at the time the player enters the Hall of Fame.
+TrainerRankings_HallOfFame2:: mobile ; 0x105ef6
ld a, $5
call GetSRAMBank
+
ld hl, GameTimeHours
- ld de, $a001
+ ld de, sTrainerRankingGameTimeHOF
ld bc, 4
call CopyBytes
- ld hl, $a010
- ld de, $a005
+
+ ld hl, sTrainerRankingStepCount
+ ld de, sTrainerRankingStepCountHOF
ld bc, 4
call CopyBytes
- ld hl, $a039
- ld de, $a009
+
+ ; sTrainerRankingHealings is only a 3-byte value.
+ ; One extraneous byte is copied from sTrainerRankingMysteryGift.
+ ld hl, sTrainerRankingHealings
+ ld de, sTrainerRankingHealingsHOF
ld bc, 4
call CopyBytes
- ld hl, $a01b
- ld de, $a00d
+
+ ld hl, sTrainerRankingBattles
+ ld de, sTrainerRankingBattlesHOF
ld bc, 3
call CopyBytes
- call Function106162
+
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 105f33
-MagikarpLength_Mobile: mobile ; 105f33
+TrainerRankings_MagikarpLength: mobile ; 105f33
ld a, $5
call GetSRAMBank
ld de, Buffer1
- ld hl, $a07b
+ ld hl, sTrainerRankingLongestMagikarp
+
+ ; Is this Magikarp the longest measured?
ld a, [de]
cp [hl]
- jr z, .asm_105f47
- jr nc, .asm_105f4f
- jr .asm_105f55
+ jr z, .isLowByteHigher
+ jr nc, .newRecordLongest
+ jr .checkShortest
-.asm_105f47
+.isLowByteHigher
inc hl
inc de
ld a, [de]
cp [hl]
dec hl
dec de
- jr c, .asm_105f55
+ jr c, .checkShortest
-.asm_105f4f
+.newRecordLongest
ld a, [de]
inc de
ld [hli], a
@@ -52,150 +65,157 @@ MagikarpLength_Mobile: mobile ; 105f33
dec de
ld [hl], a
-.asm_105f55
- ld hl, $a07d
+.checkShortest
+ ; First, check if the record for shortest Magikarp is 0.
+ ; This seems unnecessary, because the value is initialized to 100.0 cm.
+ ld hl, sTrainerRankingShortestMagikarp
ld a, [hli]
or [hl]
dec hl
- jr z, .asm_105f6d
+ jr z, .newRecordShortest
+
+ ; Now check if this Magikarp is the shortest
ld a, [de]
cp [hl]
- jr z, .asm_105f65
- jr c, .asm_105f6d
- jr .asm_105f72
+ jr z, .isLowByteLower
+ jr c, .newRecordShortest
+ jr .done
-.asm_105f65
+.isLowByteLower
inc hl
inc de
ld a, [de]
cp [hl]
- jr nc, .asm_105f72
+ jr nc, .done
dec hl
dec de
-.asm_105f6d
+.newRecordShortest
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
-.asm_105f72
- call Function106162
+.done
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 105f79
-MobileFn_105f79: mobile ; 105f79
+TrainerRankings_BugContestScore: mobile ; 105f79
ld a, $5
call GetSRAMBank
ld a, [hProduct]
- ld hl, $a07f
+ ld hl, sTrainerRankingBugContestScore
cp [hl]
- jr z, .asm_105f8b
- jr nc, .asm_105f92
- jr .asm_105f98
+ jr z, .isLowByteHigher
+ jr nc, .newHighScore
+ jr .done
-.asm_105f8b
+.isLowByteHigher
inc hl
ld a, [hMultiplicand]
cp [hl]
- jr c, .asm_105f98
+ jr c, .done
dec hl
-.asm_105f92
+.newHighScore
ld a, [hProduct]
ld [hli], a
ld a, [hMultiplicand]
ld [hl], a
-.asm_105f98
- call Function106162
+.done
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 105f9f
-MobileFn_105f9f: mobile ; 105f9f
+TrainerRankings_AddToSlotsWinStreak: mobile ; 105f9f
ld a, $5
call GetSRAMBank
- ld hl, $a070
+
+ ; Increment the current streak
+ ld hl, sTrainerRankingCurrentSlotsStreak + 1
inc [hl]
- jr nz, .asm_105fae
+ jr nz, .noCarry
dec hl
inc [hl]
inc hl
-.asm_105fae
+.noCarry
dec hl
- ld a, [$a071]
+ ; Now check if this is a new record for longest streak
+ ld a, [sTrainerRankingLongestSlotsStreak]
cp [hl]
- jr z, .asm_105fb9
- jr c, .asm_105fc1
- jr .asm_105fc9
+ jr z, .isLowByteHigher
+ jr c, .newRecordStreak
+ jr .done
-.asm_105fb9
+.isLowByteHigher
inc hl
- ld a, [$a072]
+ ld a, [sTrainerRankingLongestSlotsStreak + 1]
cp [hl]
- jr nc, .asm_105fc9
+ jr nc, .done
dec hl
-.asm_105fc1
+.newRecordStreak
ld a, [hli]
- ld [$a071], a
+ ld [sTrainerRankingLongestSlotsStreak], a
ld a, [hl]
- ld [$a072], a
+ ld [sTrainerRankingLongestSlotsStreak + 1], a
-.asm_105fc9
- call Function106162
+.done
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 105fd0
-MobileFn_105fd0: mobile ; 105fd0
+TrainerRankings_EndSlotsWinStreak: mobile ; 105fd0
ld a, $5
call GetSRAMBank
- ld hl, $a06f
+ ld hl, sTrainerRankingCurrentSlotsStreak
xor a
ld [hli], a
ld [hl], a
- call Function106162
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 105fe3
-MobileFn_105fe3: mobile ; 105fe3
+TrainerRankings_AddToSlotsPayouts: mobile ; 105fe3
ld a, $5
call GetSRAMBank
- ld hl, $a076
+ ld hl, sTrainerRankingTotalSlotsPayouts + 3
ld a, e
add [hl]
ld [hld], a
ld a, d
adc [hl]
ld [hld], a
- jr nc, .asm_106001
+ jr nc, .done
inc [hl]
- jr nz, .asm_106001
+ jr nz, .done
dec hl
inc [hl]
- jr nz, .asm_106001
+ jr nz, .done
ld a, $ff
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
-.asm_106001
- call Function106162
+.done
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 106008
-MobileFn_106008: mobile ; 106008
+TrainerRankings_AddToBattlePayouts: mobile ; 106008
ld a, $5
call GetSRAMBank
- ld hl, $a07a
+ ld hl, sTrainerRankingTotalBattlePayouts + 3
ld a, [bc]
dec bc
add [hl]
@@ -207,189 +227,195 @@ MobileFn_106008: mobile ; 106008
ld a, [bc]
adc [hl]
ld [hld], a
- jr nc, .asm_106027
+ jr nc, .done
inc [hl]
- jr nz, .asm_106027
+ jr nz, .done
ld a, $ff
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
-.asm_106027
- call Function106162
+.done
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 10602e
-MobileFn_10602e: mobile ; 10602e (41:602e)
- ld hl, $a010
- jp MobileFn_106117
+TrainerRankings_StepCount: mobile ; 10602e (41:602e)
+ ld hl, sTrainerRankingStepCount
+ jp TrainerRankings_Increment4Byte
-MobileFn_106035: mobile ; 106035
+; Unreferenced in English version.
+TrainerRankings_BattleTowerWins: mobile ; 106035
ld a, $5
call GetSRAMBank
ld a, [$aa8d]
and a
call CloseSRAM
ret nz
- ld hl, $a014
- jp Function106123
+ ld hl, sTrainerRankingBattleTowerWins
+ jp TrainerRankings_Increment2Byte
-MobileFn_106049: mobile ; 106049
- ld hl, $a018
- jp Function10611d
+TrainerRankings_TMsHMsTaught: mobile ; 106049
+ ld hl, sTrainerRankingTMsHMsTaught
+ jp TrainerRankings_Increment3Byte
-MobileFn_106050: mobile ; 106050
+TrainerRankings_Battles: mobile ; 106050
ld a, [BattleType]
- cp BATTLETYPE_TUTORIAL
+ cp BATTLETYPE_TUTORIAL ; Exclude the Dude’s tutorial battle
ret z
- ld hl, $a01b
- jp Function10611d
+ ld hl, sTrainerRankingBattles
+ jp TrainerRankings_Increment3Byte
-MobileFn_10605d: mobile ; 10605d
+TrainerRankings_WildBattles: mobile ; 10605d
ld a, [BattleType]
- cp BATTLETYPE_TUTORIAL
+ cp BATTLETYPE_TUTORIAL ; Exclude the Dude’s tutorial battle
ret z
- ld hl, $a01e
- jp Function10611d
+ ld hl, sTrainerRankingWildBattles
+ jp TrainerRankings_Increment3Byte
-MobileFn_10606a: mobile ; 10606a
- ld hl, $a021
- jp Function10611d
+TrainerRankings_TrainerBattles: mobile ; 10606a
+ ld hl, sTrainerRankingTrainerBattles
+ jp TrainerRankings_Increment3Byte
-MobileFn_106071: mobile ; 106071
- ld hl, $a024
- jp Function10611d
+TrainerRankings_Unused1: mobile ; 106071
+ ld hl, sTrainerRankingUnused1
+ jp TrainerRankings_Increment3Byte
-Mobile_HallOfFame:: mobile ; 0x106078
- ld hl, $a027
- jp Function10611d
+TrainerRankings_HallOfFame:: mobile ; 0x106078
+ ld hl, sTrainerRankingHOFEntries
+ jp TrainerRankings_Increment3Byte
-MobileFn_10607f: mobile ; 10607f (41:607f)
- ld hl, $a02a
- jp Function10611d
+TrainerRankings_WildMonsCaught: mobile ; 10607f (41:607f)
+ ld hl, sTrainerRankingWildMonsCaught
+ jp TrainerRankings_Increment3Byte
-MobileFn_106086: mobile ; 106086
- ld hl, $a02d
- jp Function10611d
+TrainerRankings_HookedEncounters: mobile ; 106086
+ ld hl, sTrainerRankingHookedEncounters
+ jp TrainerRankings_Increment3Byte
-MobileFn_10608d: mobile ; 10608d (41:608d)
- ld hl, $a030
- jp Function10611d
+TrainerRankings_EggsHatched: mobile ; 10608d (41:608d)
+ ld hl, sTrainerRankingEggsHatched
+ jp TrainerRankings_Increment3Byte
-MobileFn_106094: mobile ; 106094
- ld hl, $a033
- jp Function10611d
+TrainerRankings_MonsEvolved: mobile ; 106094
+ ld hl, sTrainerRankingMonsEvolved
+ jp TrainerRankings_Increment3Byte
-MobileFn_10609b: mobile ; 10609b
- ld hl, $a036
- jp Function10611d
+TrainerRankings_FruitPicked: mobile ; 10609b
+ ld hl, sTrainerRankingFruitPicked
+ jp TrainerRankings_Increment3Byte
-Mobile_HealParty: mobile ; 1060a2
- ld hl, $a039
- jp Function10611d
+TrainerRankings_Healings: mobile ; 1060a2
+ ld hl, sTrainerRankingHealings
+ jp TrainerRankings_Increment3Byte
-MobileFn_1060a9: mobile ; 1060a9 (41:60a9)
- ld hl, $a03c
- jr Function10611d
+TrainerRankings_MysteryGift: mobile ; 1060a9 (41:60a9)
+ ld hl, sTrainerRankingMysteryGift
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060af: mobile ; 1060af
- ld hl, $a03f
- jr Function10611d
+TrainerRankings_Trades: mobile ; 1060af
+ ld hl, sTrainerRankingTrades
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060b5: mobile ; 1060b5
- ld hl, $a042
- jr Function10611d
+TrainerRankings_Fly: mobile ; 1060b5
+ ld hl, sTrainerRankingFly
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060bb: mobile ; 1060bb
- ld hl, $a045
- jr Function10611d
+TrainerRankings_Surf: mobile ; 1060bb
+ ld hl, sTrainerRankingSurf
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060c1: mobile ; 1060c1
- ld hl, $a048
- jr Function10611d
+TrainerRankings_Waterfall: mobile ; 1060c1
+ ld hl, sTrainerRankingWaterfall
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060c7: mobile ; 1060c7
- ld hl, $a04b
- jr Function10611d
+TrainerRankings_WhiteOuts: mobile ; 1060c7
+ ld hl, sTrainerRankingWhiteOuts
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060cd: mobile ; 1060cd
- ld hl, $a04e
- jr Function106123
+TrainerRankings_LuckyNumberShow: mobile ; 1060cd
+ ld hl, sTrainerRankingLuckyNumberShow
+ jr TrainerRankings_Increment2Byte
-MobileFn_1060d3: mobile ; 1060d3
- ld hl, $a051
- jr Function10611d
+TrainerRankings_PhoneCalls: mobile ; 1060d3
+ ld hl, sTrainerRankingPhoneCalls
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060d9: mobile ; 1060df
- ld hl, $a054
- jr Function10611d
+TrainerRankings_Unused2: mobile ; 1060df
+ ld hl, sTrainerRankingUnused2
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060df: mobile ; 1060df
- ld hl, $a057
- jr Function10611d
+TrainerRankings_LinkBattles: mobile ; 1060df
+ ld hl, sTrainerRankingLinkBattles
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060e5: mobile ; 1060e5
+TrainerRankings_Splash: mobile ; 1060e5
+ ; Only counts if it’s the player’s turn
ld a, [hBattleTurn]
and a
ret nz
- ld hl, $a05a
- jr Function10611d
+ ld hl, sTrainerRankingSplash
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060ef: mobile ; 1060ef
- ld hl, $a05d
- jr Function10611d
+TrainerRankings_TreeEncounters: mobile ; 1060ef
+ ld hl, sTrainerRankingTreeEncounters
+ jr TrainerRankings_Increment3Byte
-MobileFn_1060f5: mobile ; 1060f5
- ld hl, $a060
- jr Function10611d
+TrainerRankings_Unused3: mobile ; 1060f5
+ ld hl, sTrainerRankingUnused3
+ jr TrainerRankings_Increment3Byte
-MobileFn_SaveBattleResult_Win: mobile ; win
- ld hl, $a063
- jr Function10611d
+TrainerRankings_ColosseumWins: mobile ; win
+ ld hl, sTrainerRankingColosseumWins
+ jr TrainerRankings_Increment3Byte
-MobileFn_SaveBattleResult_Lose: mobile ; lose
- ld hl, $a066
- jr Function10611d
+TrainerRankings_ColosseumLosses: mobile ; lose
+ ld hl, sTrainerRankingColosseumLosses
+ jr TrainerRankings_Increment3Byte
; 106107
-MobileFn_SaveBattleResult_Draw: mobile ; draw
- ld hl, $a069
- jr Function10611d
+TrainerRankings_ColosseumDraws: mobile ; draw
+ ld hl, sTrainerRankingColosseumDraws
+ jr TrainerRankings_Increment3Byte
; 10610d
-MobileFn_10610d: mobile ; 10610d
+; Counts uses of both SelfDestruct and Explosion.
+TrainerRankings_SelfDestruct: mobile ; 10610d
+ ; Only counts if it’s the player’s turn
ld a, [hBattleTurn]
and a
ret nz
- ld hl, $a06c
- jr Function10611d
+ ld hl, sTrainerRankingSelfDestruct
+ jr TrainerRankings_Increment3Byte
; 106117
-MobileFn_106117: ; 106117
+TrainerRankings_Increment4Byte: ; 106117
push bc
ld bc, 3
- jr Function10612d
+ jr TrainerRankings_Increment
; 10611d
-Function10611d: ; 10611d
+TrainerRankings_Increment3Byte: ; 10611d
push bc
ld bc, 2
- jr Function10612d
+ jr TrainerRankings_Increment
; 106123
-Function106123: ; 106123
+TrainerRankings_Increment2Byte: ; 106123
push bc
ld bc, 1
- jr Function10612d
+ jr TrainerRankings_Increment
; 106129
-Function106129: ; 106129
+; unused
+TrainerRankings_Increment1Byte: ; 106129
push bc
ld bc, 0
-Function10612d: ; 10612d
+; Increments a big-endian value of bc + 1 bytes at hl
+TrainerRankings_Increment: ; 10612d
ld a, $5
call GetSRAMBank
push hl
@@ -419,24 +445,25 @@ Function10612d: ; 10612d
jr .asm_106142
.asm_10614d
- call Function106162
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
pop bc
ret
; 106155
-MobileFn_106155: mobile ; 106155
+; Used when SRAM bank 5 isn’t already loaded — what’s the point of this?
+UpdateTrainerRankingsChecksum2: mobile ; 106155
ld a, $5
call GetSRAMBank
- call Function106162
+ call UpdateTrainerRankingsChecksum
call CloseSRAM
ret
; 106162
-Function106162: ; 106162
+UpdateTrainerRankingsChecksum: ; 106162
push de
- call Function10616e
- ld hl, $a081 ; s5_a081
+ call CalculateTrainerRankingsChecksum
+ ld hl, sTrainerRankingsChecksum
ld [hl], d
inc hl
ld [hl], e
@@ -444,10 +471,10 @@ Function106162: ; 106162
ret
; 10616e
-Function10616e: ; 10616e
+CalculateTrainerRankingsChecksum: ; 10616e
push bc
- ld hl, $a001 ; s5_a001
- ld bc, $80
+ ld hl, sTrainerRankings
+ ld bc, sTrainerRankingsChecksum - sTrainerRankings
xor a
ld de, 0
.asm_106179
@@ -495,9 +522,10 @@ RestoreMobileEventIndex: ; 10619d (41:619d)
ret
; 1061b3 (41:61b3)
-Function1061b3: ; 1061b3
- call Function10616e
- ld hl, $a081 ; s5_a081
+; Unreferenced in English version.
+VerifyTrainerRankingsChecksum: ; 1061b3
+ call CalculateTrainerRankingsChecksum
+ ld hl, sTrainerRankingsChecksum
ld a, d
cp [hl]
ret nz
@@ -516,19 +544,24 @@ DeleteMobileEventIndex: ; 1061c0 (41:61c0)
ret
; 1061cd (41:61cd)
-Function1061cd: ; unreferenced
- ld hl, $a001
- ld bc, $82
+; Used in the Japanese version to initialize Trainer Rankings data
+; for a new save file. Unreferenced in the English version.
+InitializeTrainerRankings:
+ ld hl, sTrainerRankings
+ ld bc, sTrainerRankingsEnd - sTrainerRankings
xor a
call ByteFill
- ld hl, $a07d
+
+ ; Initialize the shortest Magikarp to 100.0 cm
+ ld hl, sTrainerRankingShortestMagikarp
ld a, $3
ld [hli], a
ld [hl], $e8
- call Function106162
- ld hl, $a001
- ld de, $a084
- ld bc, $82
+
+ call UpdateTrainerRankingsChecksum
+ ld hl, sTrainerRankings
+ ld de, sTrainerRankingsBackup
+ ld bc, sTrainerRankingsEnd - sTrainerRankings
call CopyBytes
ret
; 1061ef
@@ -606,12 +639,11 @@ _MobilePrintNum:: ; 1061ef
ld de, ._9
.three_to_nine_digits
-rept 3
inc de
-endr
-rept 2
+ inc de
+ inc de
+ dec a
dec a
-endr
.digit_loop
push af
@@ -690,9 +722,9 @@ endr
sbc b
ld [hPrintNum6], a
ld a, [de]
-rept 3
inc de
-endr
+ inc de
+ inc de
ld b, a
ld a, [hPrintNum1]
sbc b
@@ -807,17 +839,17 @@ Function106331: ; 106331 - called by Mobile_DummyReturnFalse in Crystal-J
; 10635c
Function10635c: ; 10635c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
bit 7, a
ret nz
- ld a, [wcd25]
- ld hl, Jumptable_10636a
+ ld a, [wMobileCommsJumptableIndex]
+ ld hl, .Jumptable
rst JumpTable
ret
; 10636a
-Jumptable_10636a: ; 10636a
- dw Function10637c
+.Jumptable: ; 10636a
+ dw .init
dw Function106392
dw Function1063cc
dw Function1063d8
@@ -828,15 +860,15 @@ Jumptable_10636a: ; 10636a
dw Function106453
; 10637c
-Function10637c: ; 10637c
+.init: ; 10637c
ld de, wcd30
ld hl, $41
ld bc, $41
ld a, $40
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106392
@@ -858,39 +890,39 @@ Function106392: ; 106392
ld a, $b
ld [wcf64], a
ld a, $7
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1063b4
ld a, $7
ld [wcf64], a
ld a, $7
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1063bf
ld a, $1
ld [wcf64], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063cc
Function1063cc: ; 1063cc
ld a, $78
ld [wcd42], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function1063d8: ; 1063d8
ld hl, wcd42
dec [hl]
ret nz
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063e5
@@ -898,9 +930,9 @@ Function1063e5: ; 1063e5
ld a, [wcf64]
cp $3
ret nz
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063f3
@@ -908,9 +940,9 @@ Function1063f3: ; 1063f3
ld de, wcd31
ld a, $32
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106403
@@ -931,9 +963,9 @@ Function106403: ; 106403
inc a
ld c, a
call MobileFn_106314
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_106426
@@ -941,17 +973,17 @@ Function106403: ; 106403
ld a, c
and a
jr z, .asm_106435
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_106435
ld c, $0
call MobileFn_106314
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106442
@@ -961,14 +993,14 @@ Function106442: ; 106442
xor a
ld [hMobile], a
ld [hMobileReceive], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function106453: ; 106453
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
set 7, a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
nop
ld a, $4
ld [wcf64], a
@@ -984,9 +1016,9 @@ Function106464:: ; 106464
ld hl, VTiles2 tile $60
lb bc, BANK(MobilePhoneTilesGFX), 1
call Get2bpp
- ld de, GFX_f9424
+ ld de, FontsExtra2_UpArrowGFX
ld hl, VTiles2 tile $61
- lb bc, BANK(GFX_f9424), 1
+ lb bc, BANK(FontsExtra2_UpArrowGFX), 1
call Get2bpp
ld de, GFX_106514
ld hl, VTiles2 tile $62
diff --git a/misc/mobile_42.asm b/misc/mobile_42.asm
index a24efd10c..60f9e6d66 100644
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -372,9 +372,8 @@ MobileTradeAnim_JumptableLoop: ; 10824b
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -446,7 +445,7 @@ Function1082db: ; 1082db
.loop
callba PlaySpriteAnimations
callba SetUpPokeAnim
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
jr nc, .loop
ret
; 1082f0
@@ -493,7 +492,7 @@ MobileTradeAnim_ShowPlayerMonToBeSent: ; 10830e
ld [TempMonDVs], a
ld a, [wPlayerTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -586,7 +585,7 @@ MobileTradeAnim_ShowOTMonFromTrade: ; 10839b
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -628,7 +627,7 @@ MobileTradeAnim_ShowPlayerMonForGTS: ; 10842c
ld [TempMonDVs], a
ld a, [wPlayerTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -730,7 +729,7 @@ MobileTradeAnim_ShowOTMonFromGTS: ; 1084d7
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -799,7 +798,7 @@ MobileTradeAnim_GetOddEgg: ; 108589
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -955,9 +954,8 @@ MobileTradeAnim_GiveTrademon1: ; 108763
ld a, [hSCX]
cp $e0
jr z, .loop2
-rept 2
dec a
-endr
+ dec a
ld [hSCX], a
cp $f8
jr nz, .next
@@ -974,9 +972,8 @@ endr
ld a, [hSCY]
cp $f8
jr z, .done
-rept 2
dec a
-endr
+ dec a
ld [hSCY], a
cp $40
jr z, .init
@@ -1125,9 +1122,8 @@ MobileTradeAnim_GetTrademon2: ; 108894
ld a, [hSCY]
cp $78
jr z, .asm_1088ee
-rept 2
inc a
-endr
+ inc a
ld [hSCY], a
cp $30
jr z, .asm_1088c5
@@ -1166,9 +1162,8 @@ endr
ld a, [hSCX]
cp $c
jr z, .asm_108906
-rept 2
inc a
-endr
+ inc a
ld [hSCX], a
cp -8
jr nz, .asm_1088e7
diff --git a/misc/mobile_45.asm b/misc/mobile_45.asm
index 39d1f46ed..10242b77e 100644
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -153,9 +153,8 @@ Function114243:: ; 114243
Function11425c: ; 11425c
ld [$dc02], a
pop af
-rept 2
ld [hFF8C], a
-endr
+ ld [hFF8C], a
ld [MBC3SRamBank], a
ret
@@ -632,13 +631,12 @@ Function1144c8: ; 1144c8
Function1144d1: ; 1144d1
call Function114561
-rept 2
dec de
-endr
+ dec de
push de
-rept 3
inc de
-endr
+ inc de
+ inc de
inc hl
ld a, [de]
ld [hli], a
@@ -1006,9 +1004,8 @@ Function1146a4: ; 1146a4
and a
jr nz, .asm_1146e8
.asm_1146da
-rept 2
dec bc
-endr
+ dec bc
call Function1149cc
and a
jr nz, .asm_1146e4
@@ -1095,9 +1092,8 @@ Function1146fa: ; 1146fa
ld a, [$dc0e]
cp $3
jr nz, .asm_114773
-rept 2
dec bc
-endr
+ dec bc
.asm_114773
call Function1149cc
@@ -2069,9 +2065,8 @@ Function114c5e: ; 114c5e
inc de
cp $3f
jr nz, .asm_114c62
-rept 2
dec de
-endr
+ dec de
.asm_114c75
ld a, [hli]
cp $3f
@@ -2091,9 +2086,8 @@ endr
ld a, [hli]
cp $3d
jr nz, .asm_114c84
-rept 2
dec bc
-endr
+ dec bc
ld a, l
ld [$dc03], a
ld a, h
@@ -2360,9 +2354,8 @@ Function114d99: ; 114d99
add hl, de
ld b, h
ld c, l
-rept 2
inc bc
-endr
+ inc bc
xor a
ret
@@ -2563,9 +2556,8 @@ Function114ee9: ; 114ee9
ld a, b
ld [hli], a
ld a, c
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld a, [de]
ld [hli], a
inc de
@@ -2970,9 +2962,8 @@ Function1150b3: ; 1150b3
.asm_11510b
pop hl
-rept 2
dec hl
-endr
+ dec hl
push de
call Function1158c2
pop de
@@ -3499,9 +3490,8 @@ Function1153b5: ; 1153b5
ld e, [hl]
inc hl
ld d, [hl]
-rept 2
inc hl
-endr
+ inc hl
ld a, [de]
ld [hli], a
inc de
@@ -4470,9 +4460,9 @@ Function1158c2: ; 1158c2
ld bc, $0003
.asm_115914
-rept 3
dec bc
-endr
+ dec bc
+ dec bc
ld a, c
ld [$dc19], a
ld a, b
@@ -4523,9 +4513,8 @@ endr
ld a, $3f
and c
ld [hld], a
-rept 2
dec hl
-endr
+ dec hl
pop de
ld b, h
ld c, l
@@ -4581,9 +4570,8 @@ endr
ld a, [hli]
ld c, a
ld b, [hl]
-rept 2
inc bc
-endr
+ inc bc
ld a, b
ld [hld], a
ld [hl], c
@@ -4864,9 +4852,8 @@ Function115b00: ; 115b00
ld a, [wStartDay]
cp $4
jr z, .asm_115b43
-rept 2
inc hl
-endr
+ inc hl
jr .asm_115b43
.asm_115b36
@@ -5048,9 +5035,8 @@ Function115bc8: ; 115bc8
ret
.asm_115c33
-rept 2
dec hl
-endr
+ dec hl
xor a
ld [hl], a
ld a, $1
@@ -5153,9 +5139,9 @@ endr
ld e, [hl]
inc hl
ld d, [hl]
-rept 3
inc de
-endr
+ inc de
+ inc de
ld [hl], d
dec hl
ld [hl], e
@@ -5406,9 +5392,8 @@ Function11659d: ; 11659d
ld e, a
ld d, 0
ld hl, Jumptable_1165af
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -6941,9 +6926,8 @@ Function117719: ; 117719 (45:7719)
ld e, a
ld d, 0
ld hl, Jumptable_117728
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -7396,7 +7380,7 @@ Function117a94: ; 0x117a94
call ClearBGPalettes
call ClearSprites
callba Function172e78
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 0x117ab4
@@ -7417,7 +7401,7 @@ Function117acd: ; 0x117acd
bit 7, a
jr nz, .asm_117ae2
call Function117ae9
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
jr Function117acd
.asm_117ae2
@@ -7430,9 +7414,8 @@ Function117ae9: ; 0x117ae9
ld e, a
ld d, $0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/misc/mobile_45_sprite_engine.asm b/misc/mobile_45_sprite_engine.asm
index ab31a9bb9..d0183b2ca 100755
--- a/misc/mobile_45_sprite_engine.asm
+++ b/misc/mobile_45_sprite_engine.asm
@@ -375,9 +375,8 @@ Function1161b8: ; 1161b8
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/misc/mobile_46.asm b/misc/mobile_46.asm
index a7feeea28..644989872 100755
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -1067,7 +1067,7 @@ asm_11886f
ld [wcd3c], a
call Function119e2e
ld a, [wcd33]
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
Function118880: ; 118880 (46:4880)
call Function119ed8
@@ -1344,7 +1344,7 @@ Function118982:
ld a, $7
ld [wcf66], a
ld a, $0
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ret
@@ -1615,7 +1615,7 @@ Function118d80: ; 118d80
ld a, $9
ld [wcd3c], a
ld a, $12
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function118d9b:
@@ -1830,9 +1830,9 @@ Function118ec6: ; 118ec6
ld a, $1d
ld [wcd3c], a
ld a, $24
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $11
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $1c
ld [wcd47], a
jp Function119e2e
@@ -1871,9 +1871,9 @@ Function118f14:
ld a, $9
ld [wcd3c], a
ld a, $24
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $13
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $1c
ld [wcd47], a
jp Function119e2e
@@ -2518,7 +2518,7 @@ Function119388: ; 119388
ld a, $9
ld [wcd3c], a
ld a, $10
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1193a0:
@@ -2565,7 +2565,7 @@ Function1193e3: ; 1193e3
ld a, $9
ld [wcd3c], a
ld a, $11
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1193fb:
@@ -2895,9 +2895,9 @@ Function1195f8: ; 1195f8 (46:55f8)
ld a, $11
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $f
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $14
ld [wcd47], a
call Function119e2e
@@ -2907,9 +2907,9 @@ Function119612: ; 119612 (46:5612)
ld a, $14
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $10
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $14
ld [wcd47], a
jp Function119e2e
@@ -2925,7 +2925,7 @@ Function119629: ; 119629 (46:5629)
ld a, $9
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $14
ld [wcd47], a
call Function119e2e
@@ -3219,7 +3219,7 @@ Function1197c9: ; 1197c9
ld a, $9
ld [wcd3c], a
ld a, $12
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1197dc:
@@ -3767,9 +3767,9 @@ Function119b6b: ; 119b6b
ld [hld], a
dec hl
pop de
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, h
cp $e0
jr c, .asm_119b93
@@ -3943,7 +3943,7 @@ Function119cdf:
Function119cec:
call Function119ed8
ret c
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
ld [wcf66], a
ret
; 119cf7
@@ -4301,16 +4301,16 @@ Function119f45: ; 119f45
ld de, String_11a661
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f56
Function119f56: ; 119f56
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_119f62
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4320,16 +4320,16 @@ Function119f56: ; 119f56
ld de, String_11a6aa
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f76
Function119f76: ; 119f76
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_119f82
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4340,7 +4340,7 @@ Function119f76: ; 119f76
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f98
@@ -4348,7 +4348,7 @@ Function119f98: ; 119f98
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_119fef
call ExitMenu
@@ -4385,7 +4385,7 @@ Function119f98: ; 119f98
call ExitMenu
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
callba Function115dc3
ld a, $a
@@ -4504,12 +4504,12 @@ Function11a113: ; 11a113
Function11a129: ; 11a129
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a131
Function11a131: ; 11a131
- ld hl, wcd44
+ ld hl, wMobileInactivityTimerMinutes
dec [hl]
ret nz
ld a, [wcd3c]
@@ -4541,16 +4541,16 @@ Function11a14b: ; 11a14b
ld de, String_11a6f1
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a16d
Function11a16d: ; 11a16d
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a179
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4562,7 +4562,7 @@ Function11a16d: ; 11a16d
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a192
@@ -4570,7 +4570,7 @@ Function11a192: ; 11a192
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a1b6
call ExitMenu
@@ -4585,7 +4585,7 @@ Function11a192: ; 11a192
.asm_11a1b6
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
call Function11a63c
@@ -4649,7 +4649,7 @@ Function11a207: ; 11a207
ld a, $ed
ld [hl], a
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a235
@@ -4676,11 +4676,11 @@ Function11a235: ; 11a235
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a24c
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 8
ld a, $ed
ld [hl], a
@@ -4693,11 +4693,11 @@ Function11a235: ; 11a235
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a24c
inc a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 8
ld a, $7f
ld [hl], a
@@ -4711,12 +4711,12 @@ Function11a235: ; 11a235
ld [wcd8a], a
ld [wcd8b], a
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a2c4
call ExitMenu
callba ReloadMapPart
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
cp $0
jr z, .asm_11a2b4
ld a, [wcd47]
@@ -4774,16 +4774,16 @@ Function11a2e6: ; 11a2e6
ld de, String_11a71e
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a302
Function11a302: ; 11a302
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a30e
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4801,16 +4801,16 @@ Function11a302: ; 11a302
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a33a
Function11a33a: ; 11a33a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a346
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4828,16 +4828,16 @@ Function11a357: ; 11a357
ld de, String_11a743
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a36b
Function11a36b: ; 11a36b
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a377
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4848,7 +4848,7 @@ Function11a36b: ; 11a36b
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a38d
@@ -4856,7 +4856,7 @@ Function11a38d: ; 11a38d
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a3b1
call ExitMenu
@@ -4871,7 +4871,7 @@ Function11a38d: ; 11a38d
.asm_11a3b1
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
scf
@@ -4884,16 +4884,16 @@ Function11a3c5: ; 11a3c5
ld de, String_11a762
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a3d9
Function11a3d9: ; 11a3d9
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a3e5
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4903,16 +4903,16 @@ Function11a3d9: ; 11a3d9
ld de, String_11a779
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a3f9
Function11a3f9: ; 11a3f9
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a405
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4923,7 +4923,7 @@ Function11a3f9: ; 11a3f9
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a41b
@@ -4931,7 +4931,7 @@ Function11a41b: ; 11a41b
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a43f
call ExitMenu
@@ -4959,7 +4959,7 @@ Function11a452: ; 11a452
ld de, String_11a791
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a466
@@ -4969,16 +4969,16 @@ Function11a466: ; 11a466
ld de, String_11a7c1
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a47a
Function11a47a: ; 11a47a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a486
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4994,7 +4994,7 @@ Function11a488: ; 11a488
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a49e
@@ -5002,7 +5002,7 @@ Function11a49e: ; 11a49e
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a4c7
call ExitMenu
@@ -5019,7 +5019,7 @@ Function11a49e: ; 11a49e
.asm_11a4c7
call ExitMenu
callba ReloadMapPart
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
ld [wcf66], a
ld [wcd80], a
scf
@@ -5041,7 +5041,7 @@ Function11a4e8: ; 11a4e8
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a4fe
@@ -5049,7 +5049,7 @@ Function11a4fe: ; 11a4fe
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a522
call ExitMenu
@@ -5064,7 +5064,7 @@ Function11a4fe: ; 11a4fe
.asm_11a522
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
scf
@@ -5102,11 +5102,11 @@ Function11a536: ; 11a536
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a54d
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 7
ld a, $ed
ld [hl], a
@@ -5119,11 +5119,11 @@ Function11a536: ; 11a536
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a54d
inc a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 7
ld a, $7f
ld [hl], a
@@ -5134,7 +5134,7 @@ Function11a536: ; 11a536
.asm_11a5a2
ld a, $1
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
.asm_11a5a7
xor a
@@ -5308,7 +5308,7 @@ String_11a7ac: ; 11a7ac
next "ちゅうし しますか?@"
; 11a7c1
-String_11a7c1: ; 11a7c1
+String_11a7c1: ; 11a7c1 ; new news?
db "あたらしい ニュースは"
next "ありません でした@"
; 11a7d7
@@ -7331,7 +7331,7 @@ Function11b5c0: ; 11b5c0
ld [wPokemonWithdrawDepositParameter], a
callba RemoveMonFromPartyOrBox
callba Function170807
- callba Function14a58
+ callba SaveAfterLinkTrade
jp Function11ad8a
; 11b5e0
@@ -7616,7 +7616,7 @@ Function11b7e5: ; 11b7e5
callba EvolvePokemon
xor a
ld [wLinkMode], a
- callba Function14a58
+ callba SaveAfterLinkTrade
ld a, $5
call GetSRAMBank
ld a, $5
@@ -7781,7 +7781,7 @@ Function11b93b: ; 11b93b
ld a, $c64b / $100
ld [wMobileMonMailPointerBuffer + 1], a
call AddMobileMonToParty
- callba Function14a58
+ callba SaveAfterLinkTrade
ret
; 11b98f
diff --git a/misc/mobile_5b.asm b/misc/mobile_5b.asm
index 24f2f9189..d317f2af3 100755
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -1,48 +1,56 @@
Function16c000: ; 16c000
+; unreferenced
+ ; Only for CGB
ld a, [hCGB]
and a
ret z
+ ; Only do this once per boot cycle
ld a, [hFFEA]
and a
ret z
+ ; Set some flag, preserving the old state
ld a, [wcfbe]
push af
set 7, a
ld [wcfbe], a
- call Function16c108
- callba Function100063
- callba Function100082
- call Function16c031
- callba Function1000a4
+ ; Do stuff
+ call MobileSystemSplashScreen_InitGFX ; Load GFX
+ callba SetRAMStateForMobile
+ callba EnableMobile
+ call .RunJumptable
+ callba DisableMobile
+ ; Prevent this routine from running again
+ ; until the next time the syatem is turned on
xor a
ld [hFFEA], a
+ ; Restore the flag state
pop af
ld [wcfbe], a
ret
; 16c031
-Function16c031: ; 16c031
+.RunJumptable: ; 16c031
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wd002], a
ld [wd003], a
-.asm_16c03e
+.loop
call DelayFrame
callba Function10635c
ld a, [wd002]
- ld hl, Jumptable_16c05c
+ ld hl, .Jumptable
rst JumpTable
call Function16cb2e
call Function16cbae
ld a, [wd002]
cp $ff
- jr nz, .asm_16c03e
+ jr nz, .loop
ret
; 16c05c
-Jumptable_16c05c: ; 16c05c
- dw Function16c074
+.Jumptable: ; 16c05c
+ dw .init
dw Function16c0ba
dw Function16c089
dw Function16c09e
@@ -53,10 +61,10 @@ Jumptable_16c05c: ; 16c05c
dw Function16c0ca
dw Function16c0dc
dw Function16c0ec
- dw Function16c081
+ dw .quit
; 16c074
-Function16c074: ; 16c074
+.init ; 16c074
ld a, [wcf64]
and a
ret z
@@ -66,7 +74,7 @@ Function16c074: ; 16c074
ret
; 16c081
-Function16c081: ; 16c081
+.quit ; 16c081
push af
ld a, $ff
ld [wd002], a
@@ -160,15 +168,15 @@ Function16c0fa: ; 16c0fa
ret
; 16c108
-Function16c108: ; 16c108
+MobileSystemSplashScreen_InitGFX: ; 16c108
call DisableLCD
ld hl, VTiles2
- ld de, GFX_16c173
- lb bc, BANK(GFX_16c173), $68
+ ld de, .Tiles
+ lb bc, BANK(.Tiles), $68
call Get2bpp
- call Function16c130
- call Function16c145
- call Function16c15c
+ call .LoadPals
+ call .LoadTileMap
+ call .LoadAttrMap
hlbgcoord 0, 0
call Function16cc73
call Function16cc02
@@ -178,9 +186,9 @@ Function16c108: ; 16c108
ret
; 16c130
-Function16c130: ; 16c130
+.LoadPals: ; 16c130
ld de, UnknBGPals
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
ld bc, 8
ld a, $5
call FarCopyWRAM
@@ -188,79 +196,41 @@ Function16c130: ; 16c130
ret
; 16c145
-Function16c145: ; 16c145
+.LoadTileMap: ; 16c145
hlcoord 0, 0
ld bc, 20
xor a
call ByteFill
- ld hl, Tilemap_16c633
+ ld hl, .TileMap
decoord 0, 1
ld bc, $0154
call CopyBytes
ret
; 16c15c
-Function16c15c: ; 16c15c
+.LoadAttrMap: ; 16c15c
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH
xor a
call ByteFill
- ld hl, Tilemap_16c79b
+ ld hl, .AttrMap
decoord 0, 1, AttrMap
ld bc, 17 * SCREEN_WIDTH
call CopyBytes
ret
; 16c173
-GFX_16c173:
+.Tiles:
INCBIN "gfx/unknown/16c173.2bpp"
-Tilemap_16c633:
+.TileMap:
INCBIN "gfx/unknown/16c633.tilemap"
-Tilemap_16c79b:
+.AttrMap:
INCBIN "gfx/unknown/16c79b.tilemap"
-Unknown_16c903:
- RGB 31, 31, 31
- RGB 04, 10, 20
- RGB 16, 19, 25
- RGB 25, 27, 29
-
- 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 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
+UnknownMobilePalettes_16c903: ; 16c903
+INCLUDE "gfx/unknown/16c903.pal"
; 16c943
@@ -287,7 +257,7 @@ Function16c943: ; 16c943
ld e, $0
ld a, $0
.asm_16c969
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cabb
ld d, a
@@ -310,7 +280,7 @@ Function16c943: ; 16c943
call Function16cadc
.asm_16c991
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cad8
ld d, a
@@ -333,7 +303,7 @@ Function16c943: ; 16c943
call Function16cb08
.asm_16c9b9
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cac4
ld d, a
@@ -356,9 +326,8 @@ Function16c943: ; 16c943
call Function16cae8
.asm_16c9e1
-rept 2
inc e
-endr
+ inc e
ld a, e
cp $8
jr nz, .asm_16c969
@@ -459,9 +428,8 @@ Function16ca11: ; 16ca11
call Function16cae8
.asm_16ca88
-rept 2
inc e
-endr
+ inc e
ld a, e
cp $8
jr nz, .asm_16ca28
diff --git a/misc/mobile_5c.asm b/misc/mobile_5c.asm
index 8ecd35edf..5f72f32c7 100755
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -111,9 +111,8 @@ Function170c06: ; 170c06
inc [hl]
.asm_170c15
-rept 2
inc hl
-endr
+ inc hl
ld a, [$a89b]
add [hl]
ld [hld], a
@@ -138,9 +137,8 @@ endr
ld a, [hli]
ld b, a
ld c, [hl]
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
sub c
ld c, a
@@ -370,9 +368,8 @@ Function171a36: ; 171a36 (5c:5a36)
ld e, a
ld d, 0
ld hl, Jumptable_171a45
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -498,9 +495,9 @@ Function171aec: ; 171aec (5c:5aec)
.asm_171b34
pop hl
ld bc, $14
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
pop af
dec a
jr nz, .asm_171b1b
@@ -519,24 +516,27 @@ Function171b4b: ; 171b4b (5c:5b4b)
depixel 8, 2
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $8
ld [hl], a
+
depixel 8, 19
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $9
ld [hl], a
+
depixel 17, 14, 2, 0
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $a
ld [hl], a
+
ld a, $4
ld [wcd23], a
ld a, $8
@@ -732,9 +732,8 @@ Function171ccd: ; 171ccd (5c:5ccd)
Function171cf0: ; 171cf0 (5c:5cf0)
xor a
hlcoord 4, 15
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld a, [wcd4b]
xor $1
ld [wcd4b], a
diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm
index 415ff7e38..2ce71049f 100644
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -180,7 +180,7 @@ HaveWantPals: ; 17cff3
CheckStringForErrors: ; 17d073
; Valid character ranges:
-; $00, $05 - $13, $19 - $1c, $26 - $34, $3a - $3e, $40 - $48, $60 - $ff
+; $0, $5 - $13, $19 - $1c, $26 - $34, $3a - $3e, $40 - $48, $60 - $ff
.loop
ld a, [de]
inc de
@@ -308,7 +308,7 @@ Function17d0f3: ; 17d0f3
callba EvolvePokemon
xor a
ld [wLinkMode], a
- callba Function14a58
+ callba SaveAfterLinkTrade
ld a, $5
call GetSRAMBank
ld a, $5
@@ -612,7 +612,7 @@ Function17d314: ; 17d314
call GetSRAMBank
xor a
ld hl, $aa73
- ld bc, $000c
+ ld bc, $c
call ByteFill
call CloseSRAM
ld a, $2
@@ -747,7 +747,7 @@ Jumptable_17d483: ; 17d483
Function17d48d: ; 17d48d
ld hl, Palette_17eff6
ld de, $c608
- ld bc, $0040
+ ld bc, $40
call CopyBytes
ld hl, TileAttrmap_17eb8e
decoord 0, 0
@@ -775,7 +775,7 @@ Function17d48d: ; 17d48d
jr nz, .asm_17d4a8
pop hl
push bc
- ld bc, $0040
+ ld bc, $40
add hl, bc
pop bc
pop af
@@ -876,7 +876,7 @@ Function17d48d: ; 17d48d
dec a
jr nz, .asm_17d53a
ld de, CreditsTimer
- ld bc, $000c
+ ld bc, $c
call CopyBytes
xor a
ld [wcd2e], a
@@ -885,18 +885,18 @@ Function17d48d: ; 17d48d
ld [wcd30], a
ld [wcd31], a
ld de, wcd32
- ld bc, $0010
+ ld bc, $10
call CopyBytes
ld a, [hli]
ld [wcd42], a
ld a, [hli]
ld [wcd43], a
ld a, [hli]
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
ld a, [hli]
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, [hli]
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, [hli]
and a
jr z, .asm_17d58a
@@ -987,7 +987,7 @@ Function17d60b: ; 17d60b
call GetSRAMBank
ld hl, $b1d3
ld de, $c608
- ld bc, $0020
+ ld bc, $20
call CopyBytes
ld a, [$b1b1]
ld c, a
@@ -1012,7 +1012,7 @@ Function17d60b: ; 17d60b
ld a, h
ld [de], a
inc de
- ld bc, $000a
+ ld bc, $a
add hl, bc
pop bc
ld a, [hli]
@@ -1102,12 +1102,12 @@ Function17d6a1: ; 17d6a1
ld a, h
ld [wcd5f], a
ld de, wcd60
- ld bc, $0004
+ ld bc, $4
call CopyBytes
inc hl
inc hl
ld de, wcd64
- ld bc, $0004
+ ld bc, $4
call CopyBytes
ld a, [hli]
ld [wcd69], a
@@ -1478,7 +1478,7 @@ Function17d902: ; 17d902
Function17d93a: ; 17d93a
call Function17e415
ld de, $c708
- ld bc, $0005
+ ld bc, $5
call CopyBytes
call Function17e41e
call Function17e32b
@@ -1492,7 +1492,7 @@ Function17d93a: ; 17d93a
ld [CurPartySpecies], a
ld a, [$c70c]
ld e, a
- callba Function8bc6
+ callba LoadMonPaletteAsNthBGPal
call SetPalettes
ld a, [$c708]
ld l, a
@@ -1514,7 +1514,7 @@ Function17d93a: ; 17d93a
Function17d98b: ; 17d98b
call Function17e415
ld de, $c708
- ld bc, $0004
+ ld bc, $4
call CopyBytes
call Function17e41e
call Function17e32b
@@ -1528,7 +1528,7 @@ Function17d98b: ; 17d98b
ld [TrainerClass], a
ld a, [$c70b]
ld e, a
- callba Function8bbd
+ callba LoadTrainerClassPaletteAsNthBGPal
call SetPalettes
ld a, [$c708]
ld e, a
@@ -1540,7 +1540,7 @@ Function17d98b: ; 17d98b
pop hl
decoord 0, 0
add hl, de
- ld bc, $0707
+ ld bc, $707
predef PlaceGraphic
pop af
ld [rSVBK], a
@@ -1551,7 +1551,7 @@ Function17d98b: ; 17d98b
Function17d9e3: ; 17d9e3
call Function17e415
ld de, $c708
- ld bc, $0007
+ ld bc, $7
call CopyBytes
call Function17e41e
ld a, [$c70b]
@@ -1597,7 +1597,7 @@ Function17d9e3: ; 17d9e3
Function17da31: ; 17da31
call Function17e415
ld de, $c708
- ld bc, $0004
+ ld bc, $4
call CopyBytes
call Function17e41e
ld a, [$c709]
@@ -1888,7 +1888,7 @@ Function17dbe9: ; 17dbe9
Function17dc1f: ; 17dc1f
call Function17e415
ld de, $c688
- ld bc, $0006
+ ld bc, $6
call CopyBytes
call Function17e32b
ld a, [rSVBK]
@@ -1968,7 +1968,7 @@ Function17dcaf:
ld a, $5
ld [rSVBK], a
ld hl, UnknBGPals
- ld de, $0008
+ ld de, $8
ld c, $8
.asm_17dcbb
push hl
@@ -2050,7 +2050,7 @@ Function17dd13: ; 17dd13
push hl
pop bc
pop hl
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 17dd30
@@ -2076,7 +2076,7 @@ Function17dd30: ; 17dd30
Function17dd49: ; 17dd49
call Function17e415
ld de, $c708
- ld bc, $000a
+ ld bc, $a
call CopyBytes
ld a, [$c711]
ld c, a
@@ -2157,7 +2157,7 @@ Function17dd49: ; 17dd49
Function17ddcd: ; 17ddcd
call Function17e415
ld de, $c708
- ld bc, $0008
+ ld bc, $8
call CopyBytes
ld a, [$c70a]
cp $c0
@@ -2219,7 +2219,7 @@ Function17ddcd: ; 17ddcd
Function17de32: ; 17de32
call Function17e415
ld de, $c708
- ld bc, $0009
+ ld bc, $9
call CopyBytes
ld a, [$c710]
ld c, a
@@ -2278,7 +2278,7 @@ Function17de32: ; 17de32
Function17de91: ; 17de91
call Function17e415
ld de, $c708
- ld bc, $0007
+ ld bc, $7
call CopyBytes
ld a, $6
call GetSRAMBank
@@ -2321,7 +2321,7 @@ Function17de91: ; 17de91
Function17ded9: ; 17ded9
call Function17e415
ld de, $c708
- ld bc, $001f
+ ld bc, $1f
call CopyBytes
call Function17e32b
ld a, [rSVBK]
@@ -2363,7 +2363,7 @@ Function17ded9: ; 17ded9
jr .asm_17df37
.asm_17df33
- ld de, $0006
+ ld de, $6
add hl, de
.asm_17df37
@@ -2388,7 +2388,7 @@ Function17ded9: ; 17ded9
jr .asm_17df5e
.asm_17df5a
- ld de, $0007
+ ld de, $7
add hl, de
.asm_17df5e
@@ -2502,7 +2502,7 @@ Function17ded9: ; 17ded9
ld e, l
pop hl
push de
- ld bc, $0004
+ ld bc, $4
call CopyBytes
pop de
push hl
@@ -2520,7 +2520,7 @@ Function17ded9: ; 17ded9
jp asm_17e0ee
.asm_17e01f
- ld de, $0004
+ ld de, $4
add hl, de
jp asm_17e0ee
; 17e026
@@ -2546,21 +2546,21 @@ Function17e026: ; 17e026
bit 1, b
jr z, .asm_17e067
push bc
- ld bc, $000b
+ ld bc, $b
ld de, sBoxMonNicknames
call CopyBytes
pop bc
jr .asm_17e06b
.asm_17e067
- ld de, $0006
+ ld de, $6
add hl, de
.asm_17e06b
bit 2, b
jr z, .asm_17e08e
push bc
- ld bc, $0006
+ ld bc, $6
ld de, sBoxMonOT
call CopyBytes
ld a, [hli]
@@ -2575,7 +2575,7 @@ Function17e026: ; 17e026
jr .asm_17e092
.asm_17e08e
- ld de, $0007
+ ld de, $7
add hl, de
.asm_17e092
@@ -2623,7 +2623,7 @@ Function17e026: ; 17e026
jr z, .asm_17e0e1
push bc
ld de, sBoxMon1Moves
- ld bc, $0004
+ ld bc, $4
call CopyBytes
push hl
ld hl, sBoxMon1Moves
@@ -2638,12 +2638,12 @@ Function17e026: ; 17e026
.asm_17e0e1
call CloseSRAM
- ld de, $0006
+ ld de, $6
add hl, de
jr asm_17e0ee
.asm_17e0ea
- ld bc, $001a
+ ld bc, $1a
add hl, bc
asm_17e0ee
@@ -2662,7 +2662,7 @@ asm_17e0ee
Function17e0fd: ; 17e0fd
call Function17e415
ld de, $c708
- ld bc, $0006
+ ld bc, $6
call CopyBytes
ld a, [rSVBK]
push af
@@ -2696,7 +2696,7 @@ Function17e0fd: ; 17e0fd
Function17e133: ; 17e133
call Function17e415
ld de, $c708
- ld bc, $0005
+ ld bc, $5
call CopyBytes
ld a, [rSVBK]
push af
@@ -2727,7 +2727,7 @@ Function17e133: ; 17e133
Function17e165: ; 17e165
call Function17e415
ld de, $c708
- ld bc, $0005
+ ld bc, $5
call CopyBytes
ld a, [rSVBK]
push af
@@ -2764,7 +2764,7 @@ Function17e165: ; 17e165
Function17e1a1: ; 17e1a1
call Function17e415
ld de, $c708
- ld bc, $000d
+ ld bc, $d
call CopyBytes
ld a, [$c70a]
cp $c0
@@ -2978,7 +2978,7 @@ Function17e2a7: ; 17e2a7
call GetSRAMBank
ld hl, $aa73
ld de, $aa7f
- ld bc, $000c
+ ld bc, $c
call CopyBytes
call CloseSRAM
ret
@@ -3016,10 +3016,10 @@ Function17e32b: ; 17e32b
call GetSRAMBank
ld hl, $c608
ld de, $b0b1
- ld bc, $0040
+ ld bc, $40
call CopyBytes
ld hl, BGMapBuffer
- ld bc, $005b
+ ld bc, $5b
call CopyBytes
call CloseSRAM
ret
@@ -3030,10 +3030,10 @@ Function17e349: ; 17e349
call GetSRAMBank
ld hl, $b0b1
ld de, $c608
- ld bc, $0040
+ ld bc, $40
call CopyBytes
ld de, BGMapBuffer
- ld bc, $005b
+ ld bc, $5b
call CopyBytes
call CloseSRAM
ret
@@ -3059,7 +3059,7 @@ Function17e37e: ; 17e37e
push af
ld a, $1
ld [rSVBK], a
- callba Function14a58
+ callba SaveAfterLinkTrade
pop af
ld [rSVBK], a
ret
@@ -3098,7 +3098,7 @@ Function17e3c3: ; 17e3c3
push af
ld a, $1
ld [rSVBK], a
- callba MobileFn_106155
+ callba UpdateTrainerRankingsChecksum2
callba BackupMobileEventIndex
pop af
ld [rSVBK], a
@@ -3216,7 +3216,7 @@ Function17e451: ; 17e451
add hl, bc
push hl
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [wcd23]
call AddNTimes
ld a, [CreditsTimer]
@@ -3224,7 +3224,7 @@ Function17e451: ; 17e451
ld b, $0
add hl, bc
pop bc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
.asm_17e48b
push af
push hl
@@ -3267,7 +3267,7 @@ Function17e451: ; 17e451
jr nz, .asm_17e490
pop hl
ld a, [wcd27]
- ld de, $0014
+ ld de, $14
.asm_17e4cb
add hl, de
dec a
@@ -3294,7 +3294,7 @@ Function17e4dd: ; 17e4dd
ret z
ld a, [wcd29]
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
call AddNTimes
ld a, [wcd28]
ld c, a
@@ -3308,7 +3308,7 @@ Function17e4dd: ; 17e4dd
.asm_17e4ff
ld a, [wcd2a]
- ld bc, $0014
+ ld bc, $14
call AddNTimes
ld a, [wcd42]
ld c, a
@@ -3331,7 +3331,7 @@ Function17e51b: ; 17e51b
inc a
ld [wcd4f], a
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [wcd23]
dec a
call AddNTimes
@@ -3339,7 +3339,7 @@ Function17e51b: ; 17e51b
ld c, a
ld b, $0
add hl, bc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld c, a
ld a, [wcd27]
call SimpleMultiply
@@ -3352,7 +3352,7 @@ Function17e51b: ; 17e51b
ld a, $7f
call ByteFill
pop hl
- ld bc, $0014
+ ld bc, $14
add hl, bc
pop af
dec a
@@ -3381,7 +3381,7 @@ Function17e566: ; 17e566
Function17e571: ; 17e571
push af
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [wcd23]
call AddNTimes
ld a, [CreditsTimer]
@@ -3397,7 +3397,7 @@ Function17e571: ; 17e571
call SimpleMultiply
ld l, $0
ld h, l
- ld bc, $0014
+ ld bc, $14
call AddNTimes
ld a, [wcd30]
dec a
@@ -3420,16 +3420,16 @@ Function17e5af: ; 17e5af
ret z
ld a, [wcd43]
ld l, a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
ld h, a
bccoord 0, 0
add hl, bc
ld bc, $ffec
add hl, bc
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld c, a
ld b, $0
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
call Function17e600
ld a, [wcd2e]
ld c, a
@@ -3453,7 +3453,7 @@ Function17e5af: ; 17e5af
pop de
ld a, [wcd43]
ld l, a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
ld h, a
bccoord 0, 0
add hl, bc
@@ -3470,7 +3470,7 @@ Function17e600: ; 17e600
call ByteFill
pop bc
pop hl
- ld de, $0014
+ ld de, $14
add hl, de
pop af
dec a
@@ -3481,7 +3481,7 @@ Function17e600: ; 17e600
Function17e613: ; 17e613
push hl
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [de]
inc de
push af
@@ -3520,7 +3520,7 @@ Function17e613: ; 17e613
add $2
ld [hl], a
pop hl
- ld bc, $0014
+ ld bc, $14
add hl, bc
ld a, [de]
dec de
@@ -3550,7 +3550,7 @@ Function17e613: ; 17e613
ld [hl], a
pop hl
push bc
- ld bc, $0014
+ ld bc, $14
add hl, bc
pop bc
dec b
@@ -3583,7 +3583,7 @@ Function17e613: ; 17e613
Function17e691: ; 17e691
push hl
ld hl, NULL
- ld bc, $0014
+ ld bc, $14
ld a, [de]
inc de
push af
@@ -3636,7 +3636,7 @@ Function17e691: ; 17e691
dec a
jr nz, .asm_17e6af
pop hl
- ld bc, $0014
+ ld bc, $14
add hl, bc
pop af
dec a
@@ -3663,7 +3663,7 @@ Function17e6de: ; 17e6de
dec c
jr nz, .asm_17e6f1
pop hl
- ld de, $0014
+ ld de, $14
add hl, de
dec b
jr nz, .asm_17e6ee
@@ -3733,14 +3733,14 @@ Function17f047: ; 17f047
ld a, [de]
inc de
cp $50
- jr z, .asm_17f05f
+ jr z, .finished
cp $10
- jr nc, .asm_17f05f
+ jr nc, .finished
dec a
push de
ld e, a
ld d, 0
- ld hl, Jumptable_17f061
+ ld hl, .Jumptable
add hl, de
add hl, de
ld a, [hli]
@@ -3748,35 +3748,35 @@ Function17f047: ; 17f047
ld l, a
jp [hl]
-.asm_17f05f
+.finished
scf
ret
; 17f061
-Jumptable_17f061: ; 17f061
- dw Function17f081
- dw Function17f0f8
- dw Function17f154
- dw Function17f181
- dw Function17f1d0
- dw Function17f220
- dw Function17f27b
- dw Function17f2cb
- dw Function17f2ff
- dw Function17f334
- dw Function17f382
- dw Function17f3c9
- dw Function17f3f0
- dw Function17f41d
- dw Function17f44f
- dw Function17f44f
+.Jumptable: ; 17f061
+ dw Function17f081 ; 0
+ dw Function17f0f8 ; 1
+ dw Function17f154 ; 2
+ dw Function17f181 ; 3
+ dw Function17f1d0 ; 4
+ dw Function17f220 ; 5
+ dw Function17f27b ; 6
+ dw Function17f2cb ; 7
+ dw Function17f2ff ; 8
+ dw Function17f334 ; 9
+ dw Function17f382 ; a
+ dw Function17f3c9 ; b
+ dw Function17f3f0 ; c
+ dw Function17f41d ; d
+ dw Function17f44f ; e
+ dw Function17f44f ; f
; 17f081
Function17f081: ; 17f081
pop hl
call Function17f524
jr c, .asm_17f09f
- ld de, $0004
+ ld de, 4
add hl, de
ld a, [hli]
inc hl
@@ -3801,7 +3801,7 @@ Function17f081: ; 17f081
.asm_17f09f
push bc
ld de, wcd54
- ld bc, $0007
+ ld bc, 7
call CopyBytes
pop bc
push hl
@@ -3864,7 +3864,7 @@ Function17f0f8: ; 17f0f8
pop hl
call Function17f524
jr c, .asm_17f114
- ld de, $0003
+ ld de, $3
add hl, de
ld a, [hli]
ld e, l
@@ -3887,7 +3887,7 @@ Function17f0f8: ; 17f0f8
.asm_17f114
push bc
ld de, wcd54
- ld bc, $0004
+ ld bc, $4
call CopyBytes
pop bc
push hl
@@ -3963,7 +3963,7 @@ Function17f181: ; 17f181
pop hl
call Function17f524
jr c, .asm_17f19d
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4018,7 +4018,7 @@ Function17f1d0: ; 17f1d0
pop hl
call Function17f524
jr c, .asm_17f1ec
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4075,7 +4075,7 @@ Function17f220: ; 17f220
pop hl
call Function17f524
jr c, .asm_17f23c
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4139,7 +4139,7 @@ Function17f27b: ; 17f27b
pop hl
call Function17f524
jr c, .asm_17f297
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4236,7 +4236,7 @@ Function17f2ff: ; 17f2ff
ld [rSVBK], a
ld hl, PlayerName
ld de, $c608
- ld bc, $0006
+ ld bc, $6
call CopyBytes
ld a, $4
ld [rSVBK], a
@@ -4346,7 +4346,7 @@ Function17f3c9: ; 17f3c9
push bc
ld hl, wcd36
ld de, $c708
- ld bc, $000c
+ ld bc, 12
call CopyBytes
pop de
ld c, $0
@@ -4354,7 +4354,7 @@ Function17f3c9: ; 17f3c9
push hl
ld hl, $c708
ld de, wcd36
- ld bc, $000c
+ ld bc, $c
call CopyBytes
pop bc
pop de
@@ -4393,9 +4393,9 @@ Function17f3f0: ; 17f3f0
pop hl
add hl, de
add hl, de
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld e, l
ld d, h
ld l, c
@@ -4453,7 +4453,7 @@ Function17f44f: ; 17f44f
pop hl
call Function17f524
jr c, .asm_17f46d
- ld de, $0005
+ ld de, $5
add hl, de
ld a, [hli]
inc hl
@@ -4478,7 +4478,7 @@ Function17f44f: ; 17f44f
.asm_17f46d
push bc
ld de, wcd54
- ld bc, $0008
+ ld bc, $8
call CopyBytes
pop bc
push hl
@@ -4647,7 +4647,7 @@ Function17f555: ; 17f555
ld a, [wc303]
bit 7, a
jr nz, .quit
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
jr .loop
.quit
@@ -4716,7 +4716,7 @@ Function17f5c3: ; 17f5c3
Function17f5d2: ; 17f5d2
call Function17f5e4
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
call SetPalettes
ld a, $1
ld [wc303], a
diff --git a/misc/mobile_menu.asm b/misc/mobile_menu.asm
index d9fd3dd34..84e592fcc 100755
--- a/misc/mobile_menu.asm
+++ b/misc/mobile_menu.asm
@@ -280,7 +280,7 @@ Function4a149: ; 4a149 (12:6149)
call ClearBox
hlcoord 1, 14
call PlaceString
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call SetPalettes
call StaticMenuJoypad
ld hl, wMenuCursorY
@@ -403,7 +403,7 @@ Function4a28a: ; 4a28a (12:628a)
hlcoord 14, 1
ld de, String_4a34b
call PlaceString
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call Function4a118
call ScrollingMenuJoypad
push af
@@ -432,7 +432,7 @@ Function4a28a: ; 4a28a (12:628a)
ld b, 3
ld c, 4
call TextBox
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
ld hl, DeletePassword_YesNo_MenuDataHeader
call LoadMenuDataHeader
call VerticalMenu
@@ -455,7 +455,7 @@ Function4a28a: ; 4a28a (12:628a)
call ExitMenu
.quit
call Call_ExitMenu
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
xor a
ret
; 4a346 (12:6346)
@@ -836,16 +836,16 @@ Function4a680: ; 4a680 (12:6680)
ld [hli], a
ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ret
Function4a6ab: ; 4a6ab (12:66ab)
ld a, $2
call MenuClickSound
call ClearBGPalettes
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
callba Function11c1ab
pop bc
diff --git a/misc/printer_77.asm b/misc/printer_77.asm
index 32f5c734f..c36c21463 100755
--- a/misc/printer_77.asm
+++ b/misc/printer_77.asm
@@ -1,27 +1,27 @@
PrintPage1: ; 1dc1b0
hlcoord 0, 0
- ld de, wca90
+ decoord 0, 0, wPrinterTileMapBuffer
ld bc, 17 * SCREEN_WIDTH
call CopyBytes
- ld hl, wcab5
+ hlcoord 17, 1, wPrinterTileMapBuffer
ld a, $62
ld [hli], a
inc a
ld [hl], a
- ld hl, wcac9
+ hlcoord 17, 2, wPrinterTileMapBuffer
ld a, $64
ld [hli], a
inc a
ld [hl], a
- ld hl, wcb45
+ hlcoord 1, 9, wPrinterTileMapBuffer
ld a, " "
ld [hli], a
ld [hl], a
- ld hl, wcb59
+ hlcoord 1, 10, wPrinterTileMapBuffer
ld a, $61
ld [hli], a
ld [hl], a
- ld hl, wcb6e
+ hlcoord 2, 11, wPrinterTileMapBuffer
lb bc, 5, 18
call ClearBox
ld a, [wd265]
@@ -34,9 +34,9 @@ PrintPage1: ; 1dc1b0
callba GetDexEntryPagePointer
pop af
ld a, b
- ld hl, wcb6d
+ hlcoord 1, 11, wPrinterTileMapBuffer
call nz, FarString
- ld hl, wcaa3
+ hlcoord 19, 0, wPrinterTileMapBuffer
ld [hl], $35
ld de, SCREEN_WIDTH
add hl, de
@@ -51,26 +51,26 @@ PrintPage1: ; 1dc1b0
; 1dc213
PrintPage2: ; 1dc213
- ld hl, wca90
- ld bc, $a0
+ hlcoord 0, 0, wPrinterTileMapBuffer
+ ld bc, 8 * SCREEN_WIDTH
ld a, " "
call ByteFill
- ld hl, wca90
+ hlcoord 0, 0, wPrinterTileMapBuffer
ld a, $36
- ld b, $6
+ ld b, 6
call .FillColumn
- ld hl, wcaa3
+ hlcoord 19, 0, wPrinterTileMapBuffer
ld a, $37
- ld b, $6
+ ld b, 6
call .FillColumn
- ld hl, wcb08
+ hlcoord 0, 6, wPrinterTileMapBuffer
ld [hl], $38
inc hl
ld a, $39
ld bc, SCREEN_HEIGHT
call ByteFill
ld [hl], $3a
- ld hl, wcb1c
+ hlcoord 0, 7, wPrinterTileMapBuffer
ld bc, SCREEN_WIDTH
ld a, $32
call ByteFill
@@ -83,7 +83,7 @@ PrintPage2: ; 1dc213
ld c, 2 ; get page 2
callba GetDexEntryPagePointer
pop af
- ld hl, wcaa5
+ hlcoord 1, 1, wPrinterTileMapBuffer
ld a, b
call nz, FarString
ret
@@ -102,29 +102,29 @@ PrintPage2: ; 1dc213
; 1dc275
GBPrinterStrings:
-String_1dc275: db "@"
-String_1dc276: next " CHECKING LINK...@"
-String_1dc289: next " TRANSMITTING...@"
-String_1dc29c: next " PRINTING...@"
-String_1dc2ad:
+GBPrinterString_Null: db "@"
+GBPrinterString_CheckingLink: next " CHECKING LINK...@"
+GBPrinterString_Transmitting: next " TRANSMITTING...@"
+GBPrinterString_Printing: next " PRINTING...@"
+GBPrinterString_PrinterError1:
db " Printer Error 1"
next ""
next "Check the Game Boy"
next "Printer Manual."
db "@"
-String_1dc2e2:
+GBPrinterString_PrinterError2:
db " Printer Error 2"
next ""
next "Check the Game Boy"
next "Printer Manual."
db "@"
-String_1dc317:
+GBPrinterString_PrinterError3:
db " Printer Error 3"
next ""
next "Check the Game Boy"
next "Printer Manual."
db "@"
-String_1dc34c:
+GBPrinterString_PrinterError4:
db " Printer Error 4"
next ""
next "Check the Game Boy"
@@ -132,7 +132,7 @@ String_1dc34c:
db "@"
; 1dc381
-Function1dc381: ; 1dc381
+PrintPartyMonPage1: ; 1dc381
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -164,7 +164,7 @@ Function1dc381: ; 1dc381
call TextBox
hlcoord 8, 2
ld a, [TempMonLevel]
- call Function383d
+ call PrintLevel_Force3Digits
hlcoord 12, 2
ld [hl], "◀" ; Filled left triangle
inc hl
@@ -232,7 +232,7 @@ Function1dc381: ; 1dc381
ret
; 1dc47b
-Function1dc47b: ; 1dc47b
+PrintPartyMonPage2: ; 1dc47b
call ClearBGPalettes
call ClearTileMap
call ClearSprites
diff --git a/misc/unused_title.asm b/misc/unused_title.asm
index a74a376a3..0f25e8a52 100644
--- a/misc/unused_title.asm
+++ b/misc/unused_title.asm
@@ -10,9 +10,9 @@ UnusedTitleScreen: ; 10c000
ld [hBGMapMode], a
ld hl, wJumptableIndex
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld hl, UnusedTitleBG_GFX
diff --git a/predef/cgb.asm b/predef/cgb.asm
index addbcb0d5..b0c3fdb46 100644
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -14,7 +14,7 @@ Predef_LoadSGBLayoutCGB: ; 8d59
.not_ram
cp SCGB_PARTY_MENU_HP_PALS
jp z, CGB_ApplyPartyMenuHPPals
- call Function9673
+ call ResetBGPals
ld l, a
ld h, 0
add hl, hl
@@ -41,13 +41,13 @@ Predef_LoadSGBLayoutCGB: ; 8d59
dw _CGB_SlotMachine
dw _CGB06
dw _CGB07
- dw _CGB08
+ dw _CGB_Diploma
dw _CGB_MapPals
- dw _CGB0a
- dw _CGB0b
+ dw _CGB_PartyMenu
+ dw _CGB_Evolution
dw _CGB0c
dw _CGB0d
- dw _CGB0e
+ dw _CGB_MoveList
dw _CGB0f
dw _CGB_PokedexSearchOption
dw _CGB11
@@ -56,13 +56,13 @@ Predef_LoadSGBLayoutCGB: ; 8d59
dw _CGB_PackPals
dw _CGB_TrainerCard
dw _CGB_PokedexUnownMode
- dw _CGB17
- dw _CGB18
- dw _CGB19
- dw _CGB1a
- dw _CGB1b
- dw _CGB_FrontpicPals
- dw _CGB1d
+ dw _CGB_BillsPC
+ dw _CGB_UnownPuzzle
+ dw _CGB_GamefreakLogo ; called before copyright
+ dw _CGB_PlayerOrMonFrontpicPals
+ dw _CGB_TradeTube
+ dw _CGB_TrainerOrMonFrontpicPals
+ dw _CGB_MysteryGift
dw _CGB1e
; 8db8
@@ -329,7 +329,7 @@ Palette8fc2: ; 8fc2
RGB 00, 00, 00
; 8fca
-_CGB17: ; 8fca
+_CGB_BillsPC: ; 8fca
ld de, UnknBGPals
ld a, $1d
call GetPredefPal
@@ -568,8 +568,8 @@ _CGB11: ; 9195
ret
; 91ad
-_CGB08: ; 91ad
- ld hl, Palettes_b641
+_CGB_Diploma: ; 91ad
+ ld hl, DiplomaPalettes
ld de, UnknBGPals
ld bc, 16 palettes
ld a, $5
@@ -589,7 +589,7 @@ _CGB_MapPals: ; 91c8
ret
; 91d1
-_CGB0a: ; 91d1
+_CGB_PartyMenu: ; 91d1
ld hl, PalPacket_9c56 + 1
call CopyFourPalettes
call InitPartyMenuBGPal0
@@ -599,7 +599,7 @@ _CGB0a: ; 91d1
ret
; 91e4
-_CGB0b: ; 91e4
+_CGB_Evolution: ; 91e4
ld de, UnknBGPals
ld a, c
and a
@@ -645,7 +645,7 @@ _CGB0c: ; 9228
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
- ld a, SCGB_08
+ ld a, SCGB_DIPLOMA
ld [SGBPredef], a
call ApplyPals
ld a, $1
@@ -661,7 +661,7 @@ _CGB0d: ; 9251
ret
; 925e
-_CGB18: ; 925e
+_CGB_UnownPuzzle: ; 925e
ld hl, PalPacket_9bc6 + 1
call CopyFourPalettes
ld de, UnknOBPals
@@ -786,7 +786,7 @@ _CGB_TrainerCard: ; 9289
ret
; 9373
-_CGB0e: ; 9373
+_CGB_MoveList: ; 9373
ld de, UnknBGPals
ld a, $10
call GetPredefPal
@@ -1002,7 +1002,7 @@ _CGB13: ; 94d0
ret
; 94fa
-_CGB19: ; 94fa
+_CGB_GamefreakLogo: ; 94fa
ld de, UnknBGPals
ld a, $4e
call GetPredefPal
@@ -1026,7 +1026,7 @@ _CGB19: ; 94fa
RGB 00, 00, 00
; 9529
-_CGB1a: ; 9529
+_CGB_PlayerOrMonFrontpicPals: ; 9529
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
@@ -1048,7 +1048,7 @@ _CGB1e: ; 9542
ret
; 9555
-_CGB1b: ; 9555
+_CGB_TradeTube: ; 9555
ld hl, PalPacket_9cc6 + 1
call CopyFourPalettes
ld hl, Palettes_b681
@@ -1064,7 +1064,7 @@ _CGB1b: ; 9555
ret
; 9578
-_CGB_FrontpicPals: ; 9578
+_CGB_TrainerOrMonFrontpicPals: ; 9578
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
@@ -1076,7 +1076,7 @@ _CGB_FrontpicPals: ; 9578
ret
; 9591
-_CGB1d: ; 9591
+_CGB_MysteryGift: ; 9591
ld hl, .Palettes
ld de, UnknBGPals
ld bc, 2 palettes
diff --git a/predef/crystal.asm b/predef/crystal.asm
index c006a96e0..8f542e5dd 100755
--- a/predef/crystal.asm
+++ b/predef/crystal.asm
@@ -5,7 +5,7 @@ GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile)
ld a, [SGBPredef]
.not_ram
push af
- callba Function9673
+ callba ResetBGPals
pop af
ld l, a
ld h, 0
@@ -554,9 +554,9 @@ _InitMG_Mobile_LinkTradePalMap: ; 49797
hlcoord 2, 16, AttrMap
ld [hli], a
ld a, $7
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld a, $2
ld [hl], a
hlcoord 2, 17, AttrMap
@@ -566,7 +566,7 @@ endr
ret
; 49811
-Function49811: ; 49811
+LoadTradeRoomBGPals: ; 49811
ld hl, Palette_49826
ld de, UnknBGPals + $10
ld bc, $30
diff --git a/predef/sgb.asm b/predef/sgb.asm
index c79a173ba..65a09756d 100644
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -32,13 +32,13 @@ Predef_LoadSGBLayout: ; 864c
dw .SGB_SlotMachine
dw .SGB06
dw .SGB07
- dw .SGB08
+ dw .SGB_Diploma
dw .SGB_MapPals
- dw .SGB0a
- dw .SGB0b
+ dw .SGB_PartyMenu
+ dw .SGB_Evolution
dw .SGB0c
dw .SGB0d
- dw .SGB0e
+ dw .SGB_MoveList
dw .SGB0f
dw .SGB_PokedexSearchOption
dw .SGB11
@@ -47,13 +47,13 @@ Predef_LoadSGBLayout: ; 864c
dw .SGB_PackPals
dw .SGB_TrainerCard
dw .SGB_PokedexUnownMode
- dw .SGB17
- dw .SGB18
+ dw .SGB_BillsPC
+ dw .SGB_UnownPuzzle
dw .SGB19
- dw .SGB1a
- dw .SGB1b
- dw .SGB_FrontpicPals
- dw .SGB1d
+ dw .SGB_PlayerOrMonFrontpicPals
+ dw .SGB_TradeTube
+ dw .SGB_TrainerOrMonFrontpicPals
+ dw .SGB_MysteryGift
dw .SGB1e
; 86ad
@@ -65,7 +65,7 @@ Predef_LoadSGBLayout: ; 864c
.SGB_BattleColors: ; 86b4
ld hl, BlkPacket_9aa6
- call Function9809
+ call PushSGBPals_
ld hl, PalPacket_9ce6
ld de, wSGBPals
@@ -75,9 +75,8 @@ Predef_LoadSGBLayout: ; 864c
ld a, [PlayerHPPal]
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Palettes_a8be
add hl, de
@@ -93,9 +92,8 @@ endr
ld a, [EnemyHPPal]
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Palettes_a8be
add hl, de
@@ -140,7 +138,7 @@ endr
ret
; 873c
-.SGB0e: ; 873c
+.SGB_MoveList: ; 873c
ld hl, PalPacket_9bd6
ld de, wSGBPals
ld bc, $10
@@ -148,9 +146,8 @@ endr
ld hl, wSGBPals + 1
ld [hl], $10
-rept 2
inc hl
-endr
+ inc hl
ld a, [PlayerHPPal]
add $2f
@@ -174,9 +171,8 @@ endr
ld a, [wcda1]
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Palettes_a8be
add hl, de
ld a, [hli]
@@ -203,7 +199,7 @@ endr
ret
; 87ab
-.SGB0a: ; 87ab
+.SGB_PartyMenu: ; 87ab
ld hl, PalPacket_9c56
ld de, wSGBPals + 1
ret
@@ -237,7 +233,7 @@ endr
ret
; 87e9
-.SGB17: ; 87e9
+.SGB_BillsPC: ; 87e9
ld hl, PalPacket_9ce6
ld de, wSGBPals
ld bc, $10
@@ -308,8 +304,8 @@ endr
ret
; 8860
-.SGB08:
-.SGB1d: ; 8860
+.SGB_Diploma:
+.SGB_MysteryGift: ; 8860
ld hl, PalPacket_9cb6
ld de, BlkPacket_9a86
ret
@@ -340,7 +336,7 @@ endr
.SGB0c: ; 8884
ld hl, PalPacket_9b96
ld de, BlkPacket_9b56
- ld a, SCGB_08
+ ld a, SCGB_DIPLOMA
ld [SGBPredef], a
ret
; 8890
@@ -381,7 +377,7 @@ endr
ret
; 88cd
-.SGB0b: ; 88cd
+.SGB_Evolution: ; 88cd
push bc
ld hl, PalPacket_9ce6
ld de, wSGBPals
@@ -391,11 +387,14 @@ endr
ld a, c
and a
jr z, .partymon
+ ; Egg
ld hl, wSGBPals + 3
+ ; RGB 7, 7, 7
ld [hl], $e7
inc hl
ld [hl], $1c
inc hl
+ ; RGB 2, 3, 3
ld [hl], $62
inc hl
ld [hl], $c
@@ -432,7 +431,7 @@ endr
ret
; 8921
-.SGB18: ; 8921
+.SGB_UnownPuzzle: ; 8921
ld hl, PalPacket_9bc6
ld de, BlkPacket_9a86
ret
@@ -476,9 +475,9 @@ endr
ld a, [CurPartySpecies]
ld l, a
ld h, 0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld de, PokemonPalettes
add hl, de
ld a, [wcf65]
@@ -507,7 +506,7 @@ endr
ret
; 89ad
-.SGB1a: ; 89ad
+.SGB_PlayerOrMonFrontpicPals: ; 89ad
ld hl, PalPacket_9ce6
ld de, wSGBPals
ld bc, $10
@@ -528,13 +527,13 @@ endr
ret
; 89d9
-.SGB1b: ; 89d9
+.SGB_TradeTube: ; 89d9
ld hl, PalPacket_9cc6
ld de, BlkPacket_9a86
ret
; 89e0
-.SGB_FrontpicPals: ; 89e0
+.SGB_TrainerOrMonFrontpicPals: ; 89e0
ld hl, PalPacket_9ce6
ld de, wSGBPals
ld bc, $10
@@ -631,7 +630,7 @@ endr
.Finish: ; 8a60
push de
- call Function9809
+ call PushSGBPals_
pop hl
- jp Function9809
+ jp PushSGBPals_
; 8a68
diff --git a/rst.asm b/rst.asm
index ae9158b51..c54dc83e2 100644
--- a/rst.asm
+++ b/rst.asm
@@ -22,9 +22,8 @@ SECTION "rst28",ROM0[JumpTable]
push de
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/sram.asm b/sram.asm
index 676453e93..27c258fa6 100644
--- a/sram.asm
+++ b/sram.asm
@@ -83,7 +83,7 @@ sBackupOptions:: ds OptionsEnd - Options
s0_b208:: ds 1 ; loaded with 99, used to check save corruption
-sBackupGameData::
+sBackupGameData:: ; b209
sBackupPlayerData:: ds wPlayerDataEnd - wPlayerData
sBackupMapData:: ds wMapDataEnd - wMapData
sBackupPokemonData:: ds wPokemonDataEnd - wPokemonData
@@ -104,7 +104,7 @@ sOptions:: ds OptionsEnd - Options
s1_a008:: ds 1 ; loaded with 99, used to check save corruption
-sGameData::
+sGameData:: ; a009
sPlayerData:: ds wPlayerDataEnd - wPlayerData
sMapData:: ds wMapDataEnd - wMapData
sPokemonData:: ds wPokemonDataEnd - wPokemonData
diff --git a/text/trainer_class_names.asm b/text/trainer_class_names.asm
index daa7e08a9..555e6c652 100755
--- a/text/trainer_class_names.asm
+++ b/text/trainer_class_names.asm
@@ -64,4 +64,4 @@
db "LEADER@"
db "OFFICER@"
db "ROCKET@"
- db "MYSTICALMAN@" \ No newline at end of file
+ db "MYSTICALMAN@"
diff --git a/text/types.asm b/text/types.asm
index 7084b58eb..adc1b17ef 100644
--- a/text/types.asm
+++ b/text/types.asm
@@ -85,9 +85,8 @@ GetTypeName: ; 50964
ld hl, TypeNames
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/tilesets/animations.asm b/tilesets/animations.asm
index 289638299..a3b0c4f06 100644
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -16,9 +16,8 @@ _AnimateTileset:: ; fc000
ld [hTileAnimFrame], a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, de
; 2-byte parameter
@@ -473,9 +472,9 @@ AnimateWaterTile: ; fc402
and 3 << 1
; 2 x 8 = 16 bytes per tile
-rept 3
add a
-endr
+ add a
+ add a
add WaterTileFrames % $100
ld l, a
@@ -512,9 +511,9 @@ ForestTreeLeftAnimation: ; fc45c
.asm_fc46c
ld a, [TileAnimationTimer]
call GetForestTreeFrame
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -554,9 +553,9 @@ ForestTreeRightAnimation: ; fc4c4
.asm_fc4d4
ld a, [TileAnimationTimer]
call GetForestTreeFrame
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -590,9 +589,9 @@ ForestTreeLeftAnimation2: ; fc4f2
ld a, [TileAnimationTimer]
call GetForestTreeFrame
xor 2
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -622,9 +621,9 @@ ForestTreeRightAnimation2: ; fc51c
ld a, [TileAnimationTimer]
call GetForestTreeFrame
xor 2
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -714,9 +713,8 @@ SafariFountainAnim1: ; fc5cc
ld a, [TileAnimationTimer]
and 6
srl a
-rept 2
inc a
-endr
+ inc a
and 3
swap a
ld e, a
@@ -736,9 +734,9 @@ SafariFountainAnim2: ; fc5eb
ld c, l
ld a, [TileAnimationTimer]
and 6
-rept 3
add a
-endr
+ add a
+ add a
ld e, a
ld d, 0
ld hl, SafariFountainFrames
diff --git a/trainers/dvs.asm b/trainers/dvs.asm
index 1169785d6..2975d60fe 100644
--- a/trainers/dvs.asm
+++ b/trainers/dvs.asm
@@ -8,9 +8,8 @@ GetTrainerDVs: ; 270c4
ld b, 0
ld hl, TrainerClassDVs
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld b, a
diff --git a/trainers/read_party.asm b/trainers/read_party.asm
index af4e63cb9..c74d4c6dc 100755
--- a/trainers/read_party.asm
+++ b/trainers/read_party.asm
@@ -32,9 +32,8 @@ ReadTrainerParty: ; 39771
ld c, a
ld b, 0
ld hl, TrainerGroups
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -62,9 +61,8 @@ endr
ld d, h
ld e, l
ld hl, TrainerTypes
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -312,9 +310,9 @@ TrainerType4: ; 3989d
ComputeTrainerReward: ; 3991b (e:591b)
ld hl, hProduct
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld a, [wEnemyTrainerBaseReward]
ld [hli], a
ld a, [CurPartyLevel]
@@ -364,9 +362,8 @@ GetTrainerName:: ; 3994c
push bc
ld b, 0
ld hl, TrainerGroups
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
diff --git a/unknown/013a47.asm b/unknown/013a47.asm
index fc67c37b1..dd0d2b722 100755
--- a/unknown/013a47.asm
+++ b/unknown/013a47.asm
@@ -1,28 +1,28 @@
-Function13a47: ; unreferenced
+CorrectErrorsInPlayerParty: ; unreferenced
ld hl, PartyCount
ld a, [hl]
and a
ret z
cp PARTY_LENGTH + 1
- jr c, .asm_13a54
+ jr c, .party_length_okay
ld a, PARTY_LENGTH
ld [hl], a
-.asm_13a54
+.party_length_okay
inc hl
ld b, a
ld c, 0
-.asm_13a58
+.loop1
ld a, [hl]
and a
- jr z, .asm_13a64
- cp $fc
- jr z, .asm_13a64
- cp $fe
- jr c, .asm_13a73
+ jr z, .invalid_species
+ cp NUM_POKEMON + 1
+ jr z, .invalid_species
+ cp EGG + 1
+ jr c, .next_species
-.asm_13a64
+.invalid_species
ld [hl], SMEARGLE
push hl
push bc
@@ -33,29 +33,29 @@ Function13a47: ; unreferenced
pop bc
pop hl
-.asm_13a73
+.next_species
inc hl
inc c
dec b
- jr nz, .asm_13a58
+ jr nz, .loop1
ld [hl], $ff
ld hl, PartyMon1
ld a, [PartyCount]
ld d, a
ld e, 0
-.asm_13a83
+.loop2
push de
push hl
ld b, h
ld c, l
ld a, [hl]
and a
- jr z, .asm_13a8f
+ jr z, .invalid_species_2
cp NUM_POKEMON + 1
- jr c, .asm_13a9c
+ jr c, .check_level
-.asm_13a8f
+.invalid_species_2
ld [hl], SMEARGLE
push de
ld d, 0
@@ -65,7 +65,7 @@ Function13a47: ; unreferenced
ld a, SMEARGLE
ld [hl], a
-.asm_13a9c
+.check_level
ld [CurSpecies], a
call GetBaseData
ld hl, MON_LEVEL
@@ -73,14 +73,14 @@ Function13a47: ; unreferenced
ld a, [hl]
cp MIN_LEVEL
ld a, MIN_LEVEL
- jr c, .asm_13ab4
+ jr c, .invalid_level
ld a, [hl]
cp MAX_LEVEL
- jr c, .asm_13ab5
+ jr c, .load_level
ld a, MAX_LEVEL
-.asm_13ab4
+.invalid_level
ld [hl], a
-.asm_13ab5
+.load_level
ld [CurPartyLevel], a
ld hl, MON_MAXHP
@@ -97,20 +97,20 @@ Function13a47: ; unreferenced
pop de
inc e
dec d
- jr nz, .asm_13a83
+ jr nz, .loop2
ld de, PartyMonNicknames
ld a, [PartyCount]
ld b, a
ld c, 0
-.asm_13adc
+.loop3
push bc
- call Function13b71
+ call .GetLengthOfStringWith6CharCap
push de
callba CheckStringForErrors
pop hl
pop bc
- jr nc, .asm_13b0e
+ jr nc, .valid_nickname
push bc
push hl
@@ -122,84 +122,84 @@ Function13a47: ; unreferenced
ld a, [hl]
cp EGG
ld hl, .TAMAGO
- jr z, .asm_13b06
+ jr z, .got_nickname
ld [wd265], a
call GetPokemonName
ld hl, StringBuffer1
-.asm_13b06
+.got_nickname
pop de
ld bc, PKMN_NAME_LENGTH
call CopyBytes
pop bc
-.asm_13b0e
+.valid_nickname
inc c
dec b
- jr nz, .asm_13adc
+ jr nz, .loop3
ld de, PartyMonOT
ld a, [PartyCount]
ld b, a
ld c, 0
-.asm_13b1b
+.loop4
push bc
- call Function13b71
+ call .GetLengthOfStringWith6CharCap
push de
callba CheckStringForErrors
pop hl
- jr nc, .asm_13b34
+ jr nc, .valid_ot_name
ld d, h
ld e, l
ld hl, PlayerName
ld bc, NAME_LENGTH
call CopyBytes
-.asm_13b34
+.valid_ot_name
pop bc
inc c
dec b
- jr nz, .asm_13b1b
+ jr nz, .loop4
ld hl, PartyMon1Moves
ld a, [PartyCount]
ld b, a
-.asm_13b40
+.loop5
push hl
ld c, NUM_MOVES
ld a, [hl]
and a
- jr z, .asm_13b4b
+ jr z, .invalid_move
cp NUM_ATTACKS + 1
- jr c, .asm_13b4d
-.asm_13b4b
+ jr c, .moves_loop
+.invalid_move
ld [hl], POUND
-.asm_13b4d
+.moves_loop
ld a, [hl]
and a
- jr z, .asm_13b55
+ jr z, .fill_invalid_moves
cp NUM_ATTACKS + 1
- jr c, .asm_13b5c
+ jr c, .next_move
-.asm_13b55
+.fill_invalid_moves
xor a
ld [hli], a
dec c
- jr nz, .asm_13b55
- jr .asm_13b60
+ jr nz, .fill_invalid_moves
+ jr .next_pokemon
-.asm_13b5c
+.next_move
inc hl
dec c
- jr nz, .asm_13b4d
+ jr nz, .moves_loop
-.asm_13b60
+.next_pokemon
pop hl
push bc
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
dec b
- jr nz, .asm_13b40
+ jr nz, .loop5
ret
; 13b6b
@@ -207,23 +207,22 @@ Function13a47: ; unreferenced
db "タマゴ@@@"
; 13b71
-Function13b71: ; 13b71
+.GetLengthOfStringWith6CharCap: ; 13b71
push de
ld c, 1
ld b, 6
-.loop
+.search_loop
ld a, [de]
cp "@"
jr z, .done
inc de
inc c
dec b
- jr nz, .loop
+ jr nz, .search_loop
dec c
dec de
ld a, "@"
ld [de], a
-
.done
pop de
ret
diff --git a/wram.asm b/wram.asm
index 61abe3d3d..65d1b1aa7 100644
--- a/wram.asm
+++ b/wram.asm
@@ -34,7 +34,7 @@ wCurTrackDuty:: ds 1
wCurTrackIntensity:: ds 1
wCurTrackFrequency:: dw
wc296:: ds 1 ; BCD value, dummied out
-wc297:: ds 1 ; used in MusicE0 and LoadNote
+wCurNoteDuration:: ds 1 ; used in MusicE0 and LoadNote
CurMusicByte:: ; c298
ds 1
@@ -152,15 +152,15 @@ AutoInputLength:: ; c2cb
ds 1
wMonStatusFlags:: ds 1
-wc2cd:: ds 1
+wGameLogicPaused:: ds 1 ; c2cd
wSpriteUpdatesEnabled:: ds 1
wc2cf:: ds 1
wMapTimeOfDay:: ds 1
ds 3
-wc2d4:: ds 1
-wc2d5:: ds 1
+wPrinterConnectionOpen:: ds 1
+wPrinterOpcode:: ds 1
wLastDexEntry:: ds 1
-wc2d7:: ds 1
+wDisableTextAcceleration:: ds 1
wPreviousLandmark:: ds 1
wCurrentLandmark:: ds 1
wLandmarkSignTimer:: ds 2
@@ -242,26 +242,6 @@ wc311:: ds 1
wc312:: ds 1
wc313:: ds 1
wSpriteAnimationStructs::
-
-sprite_anim_struct: MACRO
-\1Index:: ds 1 ; 0
-\1FramesetID:: ds 1 ; 1
-\1AnimSeqID:: ds 1 ; 2
-\1TileID:: ds 1 ; 3
-\1XCoord:: ds 1 ; 4
-\1YCoord:: ds 1 ; 5
-\1XOffset:: ds 1 ; 6
-\1YOffset:: ds 1 ; 7
-\1Duration:: ds 1 ; 8
-\1DurationOffset:: ds 1 ; 9
-\1FrameIndex:: ds 1 ; a
-\1Sprite0b:: ds 1
-\1Sprite0c:: ds 1
-\1Sprite0d:: ds 1
-\1Sprite0e:: ds 1
-\1Sprite0f:: ds 1
-ENDM
-
; Field 0: Index
; Fields 1-3: Loaded from SpriteAnimSeqData
wc314::
@@ -374,7 +354,9 @@ wBT_OTTemp:: battle_tower_struct wBT_OTTemp
wMisc:: ; ds (SCREEN_WIDTH + 4) * (SCREEN_HEIGHT + 2)
ds 10
wc612::
- ds 10
+ ds 6
+wc618::
+ ds 4
wInitHourBuffer:: ; c61c
ds 10
wc626::
@@ -432,7 +414,7 @@ AttackMissed:: ; c667
PlayerSubStatus1:: ; c668
; bit
; 7 attract
-; 6 encore
+; 6 rollout
; 5 endure
; 4 perish song
; 3 identified
@@ -471,7 +453,7 @@ PlayerSubStatus4:: ; c66b
; 3
; 2 focus energy
; 1 mist
-; 0 bide: unleashed energy
+; 0 x accuracy
ds 1
PlayerSubStatus5:: ; c66c
; bit
@@ -554,10 +536,18 @@ wTurnEnded:: ds 1 ; c6b4
ds 1
PlayerStats:: ; c6b6
- ds 10
+PlayerAttack:: ds 2
+PlayerDefense:: ds 2
+PlayerSpeed:: ds 2
+PlayerSpAtk:: ds 2
+PlayerSpDef:: ds 2
ds 1
EnemyStats:: ; c6c1
- ds 10
+EnemyAttack:: ds 2
+EnemyDefense:: ds 2
+EnemySpeed:: ds 2
+EnemySpAtk:: ds 2
+EnemySpDef:: ds 2
ds 1
PlayerStatLevels:: ; c6cc
@@ -885,8 +875,8 @@ wUnlockedUnownMode:: ds 1
wDexCurrentUnownIndex:: ds 1
wDexUnownCount:: ds 1
wDexConvertedMonType:: ds 1 ; mon type converted from dex search mon type
-wc7e0:: ds 1
-wc7e1:: ds 1
+wDexListingScrollOffsetBackup:: ds 1
+wDexListingCursorBackup:: ds 1
wBackupDexListingCursor::
wc7e2:: ds 1
wBackupDexListingPage::
@@ -906,7 +896,7 @@ ENDC
wMiscEnd::
-wc7e8:: ds 24
+wc7e8:: ds 24 ; ????
SECTION "Overworld Map", WRAM0 [$c800]
@@ -915,7 +905,47 @@ OverworldMap:: ; c800
OverworldMapEnd::
ds OverworldMap - @
-wBillsPCPokemonList::
+wGameboyPrinterRAM::
+wGameboyPrinterScreen:: ds SCREEN_HEIGHT * SCREEN_WIDTH ; c800
+wGameboyPrinterScreenEnd:: ; c968
+ ds wGameboyPrinterScreen - @
+wGameboyPrinter2bppSource::
+ ds 40 tiles
+wGameboyPrinter2bppSourceEnd::
+wca80:: ds 1
+wPrinterRowIndex:: ds 1
+
+; Printer data header
+wca82:: ds 1
+wca83:: ds 1
+wca84:: ds 1
+wca85:: ds 1
+wPrinterChecksum:: dw ; ca86
+wPrinterHandshake:: ds 1
+wPrinterStatusFlags::
+; bit 7: set if error 1 (battery low)
+; bit 6: set if error 4 (too hot or cold)
+; bit 5: set if error 3 (paper jammed or empty)
+; if this and the previous byte are both $ff: error 2 (connection error)
+ ds 1
+
+wHandshakeFrameDelay:: ds 1
+wPrinterSerialFrameDelay:: ds 1
+wPrinterSendByteOffset:: dw
+wPrinterSendByteCounter:: dw
+
+; tilemap backup?
+wPrinterTileMapBuffer:: ds SCREEN_HEIGHT * SCREEN_WIDTH ; ca90
+wPrinterTileMapBufferEnd::
+wPrinterStatus:: ds 1 ; cbf8
+ ds 1
+wcbfa:: ds 1
+wGBPrinterSettings:: ds 1
+ ds 16
+wGameboyPrinterRAMEnd::
+ ds wGameboyPrinterRAM - @
+
+wBillsPCPokemonList:: ; c800
; Pokemon, box number, list index
wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES)
@@ -1036,44 +1066,14 @@ wca40:: ds 16
wca50:: ds 16
wca60:: ds 16
wca70:: ds 16
-wca80:: ds 1
-wca81:: ds 1
-wca82:: ds 1
-wca83:: ds 1
-wca84:: ds 1
-wca85:: ds 1
-wca86:: ds 1
-wca87:: ds 1
-
-; Gameboy Printer
-wca88:: ds 1
-wca89::
-; bit 7: set if error 1
-; bit 6: set if error 4
-; bit 5: set if error 3
- ds 1
-wca8a:: ds 1
-wca8b:: ds 1
-wca8c:: ds 1
-wca8d:: ds 1
-wca8e:: ds 1
-wca8f:: ds 1
+ ds 35
-; tilemap backup?
-wca90:: ds 16
-wcaa0:: ds 3
-wcaa3:: ds 2
-wcaa5:: ds 11
-wcab0:: ds 5
+wcaa3:: ds 2 ; caa3
+wcaa5:: ds 16
wcab5:: ds 10
-wcabf:: ds 1
-wcac0:: ds 9
-wcac9:: ds 7
-wcad0:: ds 16
-wcae0:: ds 16
-wcaf0:: ds 16
-wcb00:: ds 8
+wcabf:: ds 10
+wcac9:: ds 63
wcb08:: ds 6
wcb0e:: ds 5
wcb13:: ds 9
@@ -1096,11 +1096,8 @@ wcb84:: ds 100
wcbe8:: dw
wLinkOTPartyMonTypes::
ds 2 * PARTY_LENGTH
- ds 2
+ ds 84
-wcbf8:: ds 2
-wcbfa:: ds 1
-wcbfb:: ds 79
wcc4a:: ds 22
wcc60:: ds 1
wcc61:: ds 1
@@ -1132,7 +1129,7 @@ CreditsTimer:: ; cd22
wcd23:: ds 1
wcd24:: ds 1
-wcd25:: ds 1
+wMobileCommsJumptableIndex:: ds 1 ; cd25
wcd26:: ds 1
wcd27:: ds 1
wcd28:: ds 1
@@ -1151,8 +1148,12 @@ wcd32:: ds 1
wcd33:: ds 1
wcd34:: ds 1
wcd35:: ds 1
-wcd36:: ds 2
-wcd38:: ds 1
+
+; current time for link/mobile?
+wcd36:: ds 1 ; hours
+wcd37:: ds 1 ; mins
+wcd38:: ds 1 ; secs
+
wcd39:: ds 1
wcd3a:: ds 1
wcd3b:: ds 1
@@ -1164,9 +1165,12 @@ wcd40:: ds 1
wcd41:: ds 1
wcd42:: ds 1
wcd43:: ds 1
-wcd44:: ds 1
-wcd45:: ds 1
-wcd46:: ds 1
+
+; some sort of timer in link battles
+wMobileInactivityTimerMinutes:: ds 1 ; mins
+wMobileInactivityTimerSeconds:: ds 1 ; secs
+wMobileInactivityTimerFrames:: ds 1 ; frames
+
wcd47:: ds 1
BGMapPalBuffer:: ; cd48
@@ -1176,13 +1180,16 @@ wBTTempOTSprite::
wcd49:: ds 1
wcd4a:: ds 1
wcd4b:: ds 1
+wEZChatCursorXCoord::
wcd4c:: ds 1
+wEZChatCursorYCoord::
wcd4d:: ds 1
wcd4e:: ds 1
wcd4f:: ds 1
wcd50:: ds 1
wcd51:: ds 1
wcd52:: ds 1
+wMobileOpponentBattleMessage:: ; dc $c
wcd53:: ds 1
wcd54:: ds 1
wcd55:: ds 1
@@ -1220,7 +1227,7 @@ wcd71:: ds 1
wcd72:: ds 1
wcd73:: ds 1
wcd74:: ds 1
-wcd75:: ds 2
+wOTMonSelection:: ds 2 ; ds 3
wcd77:: ds 1
wcd78:: ds 1
wcd79:: ds 1
@@ -1238,6 +1245,7 @@ wcd8a:: ds 1
wcd8b:: ds 1
wcd8c:: ds 1
wcd8d:: ds 11
+BGMapBufferEnd::
SGBPredef:: ; cd98
ds 1
@@ -1251,10 +1259,14 @@ wcda1:: ds 8
wSGBPals:: ds 48 ; cda9
AttrMap:: ; cdd9
-; 20x18 grid of palettes for 8x8 tiles
+; 20x18 grid of bg tile attributes for 8x8 tiles
; read horizontally from the top row
-; bit 3: vram bank
-; bit 0-2: palette id
+; bit 7: priority
+; bit 6: y flip
+; bit 5: x flip
+; bit 4: pal # (non-cgb)
+; bit 3: vram bank (cgb only)
+; bit 2-0: pal # (cgb only)
ds SCREEN_WIDTH * SCREEN_HEIGHT
AttrMapEnd::
ds 1
@@ -1269,8 +1281,7 @@ wOtherPlayerLinkMode:: ds 1
wOtherPlayerLinkAction:: ds 4
wPlayerLinkAction:: ds 1
wcf57:: ds 4
-wcf5b:: ds 1
-wcf5c:: ds 1
+wLinkTimeoutFrames:: dw ; cf5b
wcf5d:: ds 2
MonType:: ; cf5f
@@ -1301,6 +1312,7 @@ wTitleScreenTimerLo::
wUnownPuzzleCursorPosition::
wCardFlipCursorX::
wCurrPocket::
+wPrinterQueueLength::
wcf65:: ds 1
wCreditsLYOverride::
wTitleScreenTimerHi::
@@ -1524,18 +1536,13 @@ wSeerCaughtData:: ds 1
wSeerCaughtGender:: ds 1
ds wSeerAction - @
-wBufferMonNick:: ds PKMN_NAME_LENGTH
-wBufferMonOT:: ds NAME_LENGTH
-wBufferMon:: party_struct wBufferMon
+wBufferMonNick:: ds PKMN_NAME_LENGTH ; d002
+wBufferMonOT:: ds NAME_LENGTH ; d00d
+wBufferMon:: party_struct wBufferMon ; d018
ds 8
wMonOrItemNameBuffer::
ds wBufferMonNick - @
-bugcontestwinner: macro
-\1PersonID:: ds 1
-\1Mon:: ds 1
-\1Score:: ds 2
-endm
wBugContestResults::
bugcontestwinner wBugContestFirstPlace
bugcontestwinner wBugContestSecondPlace
@@ -1555,6 +1562,7 @@ LuckyNumberDigit1Buffer::
wCurrentRadioLine::
wMovementBufferCount::
wMartItem1BCD::
+wWhichBoxMonToPrint::
ds 1
wd003::
LuckyNumberDigit2Buffer::
@@ -1562,12 +1570,14 @@ PhoneCallerLo::
wNextRadioLine::
wMovementBufferPerson::
wPlaceBallsDirection::
+wFinishedPrintingBox::
ds 1
wd004::
LuckyNumberDigit3Buffer::
PhoneCallerHi::
wRadioTextDelay::
wTrainerHUDTiles::
+wAddrOfBoxToPrint::
ds 1
wd005::
LuckyNumberDigit4Buffer::
@@ -1580,9 +1590,11 @@ wMobileParticipant1Nickname::
LuckyNumberDigit5Buffer::
EndFlypoint:: ; d006
wOaksPkmnTalkSegmentCounter::
+wBankOfBoxToPrint::
ds 1
wd007::
+wWhichBoxToPrint::
MovementBuffer:: ; d007
ds 1
@@ -1701,8 +1713,9 @@ wScriptAfterPointer:: ds 2
wRunningTrainerBattleScript:: ds 1
MenuItemsListEnd::
wTempTrainerHeaderEnd::
-wd04e:: ds 24
-wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH
+wPlayerTurningDirection:: ; d04e
+ ds 24
+wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH ; d066
StringBuffer1:: ; d073
ds 19
@@ -1782,12 +1795,9 @@ wMailboxItems:: ds MAILBOX_CAPACITY
wMailboxEnd:: ds 1 ; d0fe
ds 2
-wd100:: ds 1
-wd101:: ds 1
-wd102:: ds 1
-wd103:: ds 1
-wd104:: ds 1
-wd105:: ds 1
+wListPointer:: dw ; d100
+wUnusedD102:: dw ; d102
+wItemAttributesPtr:: dw ; d104
CurItem:: ds 1 ; d106
CurItemQuantity:: ; d107
@@ -1845,8 +1855,8 @@ wPrevMapGroup:: ds 1
wPrevMapNumber:: ds 1
; d14c
-wFollowNotExactPersonX:: ds 1 ; used in FollowNotExact
-wFollowNotExactPersonY:: ds 1 ; used in FollowNotExact
+wPlayerBGMapOffsetX:: ds 1 ; used in FollowNotExact; unit is pixels
+wPlayerBGMapOffsetY:: ds 1 ; used in FollowNotExact; unit is pixels
; Player movement
wPlayerStepVectorX:: ds 1 ; d14e
@@ -1868,7 +1878,7 @@ UsedSpritesEnd::
wd154:: ; d154
ds 31 ; 64
-wd173:: ds 1
+wd173:: ds 1 ; related to command queue type 3
ds 13
wd181:: ds 1
wd182:: ds 1
@@ -2012,16 +2022,32 @@ TilesetPalettes:: ; d1e6
EvolvableFlags:: ; d1e8
flag_array PARTY_LENGTH
-wForceEvolution:: ds 1
+wForceEvolution:: db ; d1e9
+
+; HP bar animations
+wCurHPAnimMaxHP:: dw ; d1ea
+wCurHPAnimOldHP:: dw ; d1ec
+wCurHPAnimNewHP:: dw ; d1ee
+wCurHPAnimPal:: db ; d1f0
+wCurHPBarPixels:: db ; d1f1
+wNewHPBarPixels:: db ; d1f2
+wCurHPAnimDeltaHP:: dw ; d1f3
+wCurHPAnimLowHP:: db ; d1f5
+wCurHPAnimHighHP:: db ; d1f6
+ ds wCurHPAnimMaxHP - @
+
MagikarpLength::
+wEvolutionOldSpecies::
Buffer1:: ; d1ea
ds 1
MovementType::
+wEvolutionNewSpecies::
Buffer2:: ; d1eb
ds 1
-
+wEvolutionPicOffset::
Buffer3::
wd1ec:: ds 1
+wEvolutionCanceled::
Buffer4::
wd1ed:: ds 1
Buffer5::
@@ -2029,14 +2055,14 @@ wd1ee:: ds 1
Buffer6::
wd1ef:: ds 1
wd1f0:: ds 1
-wCurHPBarPixels::
+CurEnemyItem::
wd1f1:: ds 1
-wNewHPBarPixels::
wd1f2:: ds 1
wd1f3:: ds 1
wd1f4:: ds 1
wd1f5:: ds 1
-wd1f6:: ds 4
+wd1f6::
+ ds 4
LinkBattleRNs:: ; d1fa
ds 10
@@ -2151,8 +2177,8 @@ wNiteEncounterRate:: ds 1 ; d25c
wWaterEncounterRate:: ds 1 ; d25d
wListMoves_MoveIndicesBuffer:: ds NUM_MOVES
wPutativeTMHMMove:: ds 1
-wd263:: ds 1
-wAISwitch:: ds 1
+wInitListType:: ds 1
+wBattleHasJustStarted:: ds 1
wFoundMatchingIDInParty::
wNamedObjectIndexBuffer::
wCurTMHM::
@@ -2351,44 +2377,6 @@ wFollowerMovementQueueLength:: ds 1
wFollowMovementQueue:: ds 5
ObjectStructs:: ; d4d6
-object_struct: MACRO
-\1Struct::
-\1Sprite:: ds 1
-\1MapObjectIndex:: ds 1
-\1SpriteTile:: ds 1
-\1MovementType:: ds 1
-\1Flags:: ds 2
-\1Palette:: ds 1
-\1Walking:: ds 1
-\1Direction:: ds 1
-\1StepType:: ds 1
-\1StepDuration:: ds 1
-\1Action:: ds 1
-\1ObjectStepFrame:: ds 1
-\1Facing:: ds 1
-\1StandingTile:: ds 1 ; collision
-\1LastTile:: ds 1 ; collision
-\1StandingMapX:: ds 1
-\1StandingMapY:: ds 1
-\1LastMapX:: ds 1
-\1LastMapY:: ds 1
-\1ObjectInitX:: ds 1
-\1ObjectInitY:: ds 1
-\1Radius:: ds 1
-\1SpriteX:: ds 1
-\1SpriteY:: ds 1
-\1SpriteXOffset:: ds 1
-\1SpriteYOffset:: ds 1
-\1MovementByteIndex:: ds 1
-\1Object28:: ds 1
-\1Object29:: ds 1
-\1Object30:: ds 1
-\1Object31:: ds 1
-\1Range:: ds 1
- ds 7
-\1StructEnd::
-ENDM
-
object_struct Player
object_struct Object1
object_struct Object2
@@ -2408,23 +2396,6 @@ wCmdQueue:: ds CMDQUEUE_CAPACITY * CMDQUEUE_ENTRY_SIZE
ds $28
MapObjects:: ; d71e
-map_object: MACRO
-\1Object::
-\1ObjectStructID:: ds 1
-\1ObjectSprite:: ds 1
-\1ObjectYCoord:: ds 1
-\1ObjectXCoord:: ds 1
-\1ObjectMovement:: ds 1
-\1ObjectRadius:: ds 1
-\1ObjectHour:: ds 1
-\1ObjectTimeOfDay:: ds 1
-\1ObjectColor:: ds 1
-\1ObjectRange:: ds 1
-\1ObjectScript:: ds 2
-\1ObjectEventFlag:: ds 2
- ds 2
-endm
-
map_object Player
map_object Map1
map_object Map2
@@ -2741,7 +2712,7 @@ wWhichMomItem:: ds 1 ; dc17
wWhichMomItemSet:: ds 1 ; dc18
MomItemTriggerBalance:: ds 3 ; dc19
-wDailyResetTimer:: ds 2
+wDailyResetTimer:: ds 2 ; dc1c
DailyFlags:: ds 1
WeeklyFlags:: ds 1
SwarmFlags:: ds 1
@@ -2753,9 +2724,9 @@ FruitTreeFlags:: flag_array NUM_FRUIT_TREES ; dc27
ds 2
-wLuckyNumberDayBuffer:: ds 2
+wLuckyNumberDayBuffer:: ds 2 ; dc2d
ds 2
-wSpecialPhoneCallID:: ds 1
+wSpecialPhoneCallID:: ds 1 ; dc31
ds 3
wBugContestStartTime:: ds 4 ; day, hour, min, sec ; dc35
wUnusedTwoDayTimerOn:: ds 1 ; dc39
@@ -2773,7 +2744,7 @@ wDailyPhoneTimeOfDayFlags:: ds 4
wKenjiBreakTimer:: ds 2 ; Kenji
wYanmaMapGroup:: ds 1 ; dc5a
wYanmaMapNumber:: ds 1
-wdc5c:: ds 3
+wPlayerMonSelection:: ds 3
wdc5f:: ds 1
wdc60:: ds 19
@@ -2921,15 +2892,6 @@ wDunsparceMapGroup:: ds 1
wDunsparceMapNumber:: ds 1
wFishingSwarmFlag:: ds 1
-roam_struct: MACRO
-\1Species:: db
-\1Level:: db
-\1MapGroup:: db
-\1MapNumber:: db
-\1HP:: ds 1
-\1DVs:: ds 2
-ENDM
-
wRoamMon1:: roam_struct wRoamMon1 ; dfcf
wRoamMon2:: roam_struct wRoamMon2 ; dfd6
wRoamMon3:: roam_struct wRoamMon3 ; dfdd
@@ -2956,31 +2918,31 @@ wPokeAnimPointer:: ds 2
wPokeAnimSpecies:: ds 1
wPokeAnimUnownLetter:: ds 1
wPokeAnimSpeciesOrUnown:: ds 1
-w2_d16e:: ds 1
+wPokeAnimGraphicStartTile:: ds 1
wPokeAnimCoord:: ds 2
wPokeAnimFrontpicHeight:: ds 1
; PokeAnim Data
wPokeAnimExtraFlag:: ds 1
-w2_d173:: ds 1
+wPokeAnimSpeed:: ds 1
wPokeAnimPointerBank:: ds 1
wPokeAnimPointerAddr:: ds 2
wPokeAnimFramesBank:: ds 1
wPokeAnimFramesAddr:: ds 2
wPokeAnimBitmaskBank:: ds 1
wPokeAnimBitmaskAddr:: ds 2
-w2_d17d:: ds 1
-w2_d17e:: ds 1
+wPokeAnimFrame:: ds 1
+wPokeAnimJumptableIndex:: ds 1
wPokeAnimRepeatTimer:: ds 1
-w2_d180:: ds 1
+wPokeAnimCurBitmask:: ds 1
wPokeAnimWaitCounter:: ds 1
-w2_d182:: ds 1
-w2_d183:: ds 1
-w2_d184:: ds 1
-w2_d185:: ds 1
-w2_d186:: ds 1
-w2_d187:: ds 1
-w2_d188:: ds 1
- ds 8
+wPokeAnimCommand:: ds 1
+wPokeAnimParameter:: ds 1
+ ds 1
+wPokeAnimBitmaskCurCol:: ds 1
+wPokeAnimBitmaskCurRow:: ds 1
+wPokeAnimBitmaskCurBit:: ds 1
+wPokeAnimBitmaskBuffer:: ds 7
+ ds 2
wPokeAnimStructEnd::
@@ -3053,7 +3015,7 @@ wMagnetTrainInitPosition:: ds 1
wMagnetTrainHoldPosition:: ds 1
wMagnetTrainFinalPosition:: ds 1
wMagnetTrainPlayerSpriteInitX:: ds 1
-ds 106
+ ds 106
LYOverridesBackup:: ; d200
ds SCREEN_HEIGHT_PX
@@ -3064,34 +3026,6 @@ SECTION "Battle Animations", WRAMX [$d300], BANK [5]
wBattleAnimTileDict:: ds 10
-battle_anim_struct: MACRO
-; Placeholder until we can figure out what it all means
-\1_Index:: ds 1
-\1_Anim01:: ds 1
-\1_Anim02:: ds 1
-\1_FramesetIndex:: ds 1
-\1_FunctionIndex:: ds 1
-\1_Anim05:: ds 1
-\1_TileID:: ds 1
-\1_XCoord:: ds 1
-\1_YCoord:: ds 1
-\1_XOffset:: ds 1
-\1_YOffset:: ds 1
-\1_Anim0b:: ds 1
-\1_Anim0c:: ds 1
-\1_Anim0d:: ds 1
-\1_AnonJumptableIndex:: ds 1
-\1_Anim0f:: ds 1
-\1_Anim10:: ds 1
-\1_Anim11:: ds 1
-\1_Anim12:: ds 1
-\1_Anim13:: ds 1
-\1_Anim14:: ds 1
-\1_Anim15:: ds 1
-\1_Anim16:: ds 1
-\1_Anim17:: ds 1
-endm
-
ActiveAnimObjects:: ; d30a
AnimObject01:: battle_anim_struct AnimObject01
AnimObject02:: battle_anim_struct AnimObject02
@@ -3105,13 +3039,6 @@ AnimObject09:: battle_anim_struct AnimObject09
AnimObject10:: battle_anim_struct AnimObject10
ActiveAnimObjectsEnd:: ; d3aa
-battle_bg_effect: MACRO
-\1_Function:: ds 1
-\1_01:: ds 1
-\1_02:: ds 1
-\1_03:: ds 1
-endm
-
ActiveBGEffects:: ; d3fa
BGEffect1:: battle_bg_effect BGEffect1
BGEffect2:: battle_bg_effect BGEffect2
@@ -3166,15 +3093,17 @@ w5_da00:: ds $200
w5_dc00:: ds $d
w5_dc0d:: ds 4
w5_dc11:: ds 9
-w5_dc1a:: ds $c
-w5_dc26:: ds $c
-w5_dc32:: ds $c
-w5_dc3e:: ds $c
+w5_MobileOpponentBattleMessages:: ds $c ; dc1a
+w5_MobileOpponentBattleStartMessage:: ds $c ; dc26
+w5_MobileOpponentBattleWinMessage:: ds $c ; dc32
+w5_MobileOpponentBattleLossMessage:: ds $c ; dc3e
SECTION "WRAM 6", WRAMX, BANK [6]
-wDecompressScratch:: ds $400
-wBackupAttrMap:: ds $200
+wDecompressScratch::
+wScratchTileMap::
+ ds BG_MAP_WIDTH * BG_MAP_HEIGHT
+wScratchAttrMap:: ds $200
w6_d600:: ds $200
w6_d800::