From 3d1c16523e277b0b4044e685aa118c15aaaeffe9 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 21 Oct 2017 17:32:35 +0200 Subject: [PATCH] start working on battle controllers, especially player --- asm/battle_controller_linkopponent.s | 353 +- asm/battle_controller_opponent.s | 354 +- asm/battle_controller_player.s | 5101 +----------------------- asm/battle_controller_wally.s | 372 +- asm/evolution_scene.s | 10 +- asm/item_menu.s | 6 +- asm/party_menu.s | 4 +- asm/pokemon_summary_screen.s | 2 +- asm/rom6.s | 2 +- data/battle_controller_link_opponent.s | 64 - data/battle_controller_opponent.s | 67 - data/battle_controller_player.s | 69 - data/battle_controller_wally.s | 64 - include/battle.h | 14 +- include/battle_2.h | 3 + include/battle_controllers.h | 2 +- include/battle_interface.h | 6 + include/battle_script_commands.h | 4 +- include/gba/io_reg.h | 2 + include/pokemon.h | 1 + ld_script.txt | 12 +- src/battle_2.c | 10 +- src/battle_controller_linkopponent.c | 143 + src/battle_controller_opponent.c | 146 + src/battle_controller_player.c | 1600 ++++++++ src/battle_controller_wally.c | 147 + src/battle_interface.c | 6 - src/battle_script_commands.c | 44 +- src/pokemon_2.c | 2 +- sym_common.txt | 4 +- 30 files changed, 2812 insertions(+), 5802 deletions(-) delete mode 100644 data/battle_controller_link_opponent.s delete mode 100644 data/battle_controller_opponent.s delete mode 100644 data/battle_controller_player.s delete mode 100644 data/battle_controller_wally.s create mode 100644 src/battle_controller_linkopponent.c create mode 100644 src/battle_controller_opponent.c create mode 100644 src/battle_controller_player.c create mode 100644 src/battle_controller_wally.c diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index d4e248d8c..82e3b162e 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -6,23 +6,6 @@ .text - thumb_func_start nullsub_28 -nullsub_28: @ 8064390 - bx lr - thumb_func_end nullsub_28 - - thumb_func_start SetBankFuncToLinkOpponentBufferRunCommand -SetBankFuncToLinkOpponentBufferRunCommand: @ 8064394 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkOpponentBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToLinkOpponentBufferRunCommand thumb_func_start LinkOpponentBufferRunCommand LinkOpponentBufferRunCommand: @ 80643B0 @@ -1525,8 +1508,8 @@ _080650CE: .pool thumb_func_end LinkOpponentBufferExecCompleted - thumb_func_start dp01t_00_2_getattr -dp01t_00_2_getattr: @ 80650E0 + thumb_func_start LinkOpponentHandleGetMonData +LinkOpponentHandleGetMonData: @ 80650E0 push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -1578,7 +1561,7 @@ _0806513A: pop {r4-r6} pop {r0} bx r0 - thumb_func_end dp01t_00_2_getattr + thumb_func_end LinkOpponentHandleGetMonData thumb_func_start dp01_getattr_by_ch1_for_opponent_pokemon dp01_getattr_by_ch1_for_opponent_pokemon: @ 8065154 @@ -2458,16 +2441,16 @@ _080658EA: .pool thumb_func_end dp01_getattr_by_ch1_for_opponent_pokemon - thumb_func_start sub_8065900 -sub_8065900: @ 8065900 + thumb_func_start LinkOpponentHandleGetRawMonData +LinkOpponentHandleGetRawMonData: @ 8065900 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8065900 + thumb_func_end LinkOpponentHandleGetRawMonData - thumb_func_start sub_806590C -sub_806590C: @ 806590C + thumb_func_start LinkOpponentHandleSetMonData +LinkOpponentHandleSetMonData: @ 806590C push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -2507,7 +2490,7 @@ _0806595A: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_806590C + thumb_func_end LinkOpponentHandleSetMonData thumb_func_start sub_8065964 sub_8065964: @ 8065964 @@ -3494,8 +3477,8 @@ _08066270: .pool thumb_func_end sub_8065964 - thumb_func_start sub_8066284 -sub_8066284: @ 8066284 + thumb_func_start LinkOpponentHandleSetRawMonData +LinkOpponentHandleSetRawMonData: @ 8066284 push {r4-r7,lr} ldr r1, =gBattlePartyID ldr r7, =gActiveBank @@ -3547,10 +3530,10 @@ _080662DC: pop {r0} bx r0 .pool - thumb_func_end sub_8066284 + thumb_func_end LinkOpponentHandleSetRawMonData - thumb_func_start sub_80662F8 -sub_80662F8: @ 80662F8 + thumb_func_start LinkOpponentHandleLoadMonSprite +LinkOpponentHandleLoadMonSprite: @ 80662F8 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -3688,10 +3671,10 @@ sub_80662F8: @ 80662F8 pop {r0} bx r0 .pool - thumb_func_end sub_80662F8 + thumb_func_end LinkOpponentHandleLoadMonSprite - thumb_func_start sub_8066448 -sub_8066448: @ 8066448 + thumb_func_start LinkOpponentHandleSwitchInAnim +LinkOpponentHandleSwitchInAnim: @ 8066448 push {r4,lr} ldr r1, =gBattlePartyID ldr r4, =gActiveBank @@ -3720,7 +3703,7 @@ sub_8066448: @ 8066448 pop {r0} bx r0 .pool - thumb_func_end sub_8066448 + thumb_func_end LinkOpponentHandleSwitchInAnim thumb_func_start sub_8066494 sub_8066494: @ 8066494 @@ -3895,8 +3878,8 @@ sub_8066494: @ 8066494 .pool thumb_func_end sub_8066494 - thumb_func_start sub_8066624 -sub_8066624: @ 8066624 + thumb_func_start LinkOpponentHandleReturnMonToBall +LinkOpponentHandleReturnMonToBall: @ 8066624 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r6, =gActiveBank @@ -3954,7 +3937,7 @@ _080666A8: pop {r0} bx r0 .pool - thumb_func_end sub_8066624 + thumb_func_end LinkOpponentHandleReturnMonToBall thumb_func_start sub_80666BC sub_80666BC: @ 80666BC @@ -4026,8 +4009,8 @@ _0806673A: .pool thumb_func_end sub_80666BC - thumb_func_start sub_8066748 -sub_8066748: @ 8066748 + thumb_func_start LinkOpponentHandleDrawTrainerPic +LinkOpponentHandleDrawTrainerPic: @ 8066748 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -4378,10 +4361,10 @@ _0806694C: pop {r0} bx r0 .pool - thumb_func_end sub_8066748 + thumb_func_end LinkOpponentHandleDrawTrainerPic - thumb_func_start sub_8066A58 -sub_8066A58: @ 8066A58 + thumb_func_start LinkOpponentHandleTrainerSlide +LinkOpponentHandleTrainerSlide: @ 8066A58 push {r4-r6,lr} mov r6, r8 push {r6} @@ -4510,10 +4493,10 @@ _08066A76: pop {r0} bx r0 .pool - thumb_func_end sub_8066A58 + thumb_func_end LinkOpponentHandleTrainerSlide - thumb_func_start sub_8066B94 -sub_8066B94: @ 8066B94 + thumb_func_start LinkOpponentHandleTrainerSlideBack +LinkOpponentHandleTrainerSlideBack: @ 8066B94 push {r4-r6,lr} ldr r6, =gBankSpriteIds ldr r4, =gActiveBank @@ -4584,10 +4567,10 @@ sub_8066B94: @ 8066B94 pop {r0} bx r0 .pool - thumb_func_end sub_8066B94 + thumb_func_end LinkOpponentHandleTrainerSlideBack - thumb_func_start sub_8066C40 -sub_8066C40: @ 8066C40 + thumb_func_start LinkOpponentHandleFaintAnimation +LinkOpponentHandleFaintAnimation: @ 8066C40 push {r4-r6,lr} ldr r6, =gBattleSpritesDataPtr ldr r4, [r6] @@ -4661,42 +4644,42 @@ _08066CD0: pop {r0} bx r0 .pool - thumb_func_end sub_8066C40 + thumb_func_end LinkOpponentHandleFaintAnimation - thumb_func_start sub_8066CEC -sub_8066CEC: @ 8066CEC + thumb_func_start LinkOpponentHandleCmd11 +LinkOpponentHandleCmd11: @ 8066CEC push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8066CEC + thumb_func_end LinkOpponentHandleCmd11 - thumb_func_start sub_8066CF8 -sub_8066CF8: @ 8066CF8 + thumb_func_start LinkOpponentHandleCmd12 +LinkOpponentHandleCmd12: @ 8066CF8 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8066CF8 + thumb_func_end LinkOpponentHandleCmd12 - thumb_func_start sub_8066D04 -sub_8066D04: @ 8066D04 + thumb_func_start LinkOpponentHandleBallThrow +LinkOpponentHandleBallThrow: @ 8066D04 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8066D04 + thumb_func_end LinkOpponentHandleBallThrow - thumb_func_start sub_8066D10 -sub_8066D10: @ 8066D10 + thumb_func_start LinkOpponentHandlePause +LinkOpponentHandlePause: @ 8066D10 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8066D10 + thumb_func_end LinkOpponentHandlePause - thumb_func_start sub_8066D1C -sub_8066D1C: @ 8066D1C + thumb_func_start LinkOpponentHandleMoveAnimation +LinkOpponentHandleMoveAnimation: @ 8066D1C push {r4-r7,lr} mov r7, r8 push {r7} @@ -4842,7 +4825,7 @@ _08066E58: pop {r0} bx r0 .pool - thumb_func_end sub_8066D1C + thumb_func_end LinkOpponentHandleMoveAnimation thumb_func_start sub_8066E70 sub_8066E70: @ 8066E70 @@ -5028,8 +5011,8 @@ _08066FE4: bx r0 thumb_func_end sub_8066E70 - thumb_func_start sub_8066FF4 -sub_8066FF4: @ 8066FF4 + thumb_func_start LinkOpponentHandlePrintString +LinkOpponentHandlePrintString: @ 8066FF4 push {r4,r5,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -5058,66 +5041,66 @@ sub_8066FF4: @ 8066FF4 pop {r0} bx r0 .pool - thumb_func_end sub_8066FF4 + thumb_func_end LinkOpponentHandlePrintString - thumb_func_start sub_806704C -sub_806704C: @ 806704C + thumb_func_start LinkOpponentHandlePrintStringPlayerOnly +LinkOpponentHandlePrintStringPlayerOnly: @ 806704C push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_806704C + thumb_func_end LinkOpponentHandlePrintStringPlayerOnly - thumb_func_start sub_8067058 -sub_8067058: @ 8067058 + thumb_func_start LinkOpponentHandleChooseAction +LinkOpponentHandleChooseAction: @ 8067058 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067058 + thumb_func_end LinkOpponentHandleChooseAction - thumb_func_start sub_8067064 -sub_8067064: @ 8067064 + thumb_func_start LinkOpponentHandleCmd19 +LinkOpponentHandleCmd19: @ 8067064 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067064 + thumb_func_end LinkOpponentHandleCmd19 - thumb_func_start sub_8067070 -sub_8067070: @ 8067070 + thumb_func_start LinkOpponentHandleChooseMove +LinkOpponentHandleChooseMove: @ 8067070 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067070 + thumb_func_end LinkOpponentHandleChooseMove - thumb_func_start sub_806707C -sub_806707C: @ 806707C + thumb_func_start LinkOpponentHandleOpenBag +LinkOpponentHandleOpenBag: @ 806707C push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_806707C + thumb_func_end LinkOpponentHandleOpenBag - thumb_func_start sub_8067088 -sub_8067088: @ 8067088 + thumb_func_start LinkOpponentHandleChoosePokemon +LinkOpponentHandleChoosePokemon: @ 8067088 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067088 + thumb_func_end LinkOpponentHandleChoosePokemon - thumb_func_start sub_8067094 -sub_8067094: @ 8067094 + thumb_func_start LinkOpponentHandleCmd23 +LinkOpponentHandleCmd23: @ 8067094 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067094 + thumb_func_end LinkOpponentHandleCmd23 - thumb_func_start sub_80670A0 -sub_80670A0: @ 80670A0 + thumb_func_start LinkOpponentHandleHealthBarUpdate +LinkOpponentHandleHealthBarUpdate: @ 80670A0 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -5210,18 +5193,18 @@ _0806715A: pop {r0} bx r0 .pool - thumb_func_end sub_80670A0 + thumb_func_end LinkOpponentHandleHealthBarUpdate - thumb_func_start sub_8067190 -sub_8067190: @ 8067190 + thumb_func_start LinkOpponentHandleExpUpdate +LinkOpponentHandleExpUpdate: @ 8067190 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067190 + thumb_func_end LinkOpponentHandleExpUpdate - thumb_func_start sub_806719C -sub_806719C: @ 806719C + thumb_func_start LinkOpponentHandleStatusIconUpdate +LinkOpponentHandleStatusIconUpdate: @ 806719C push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5267,10 +5250,10 @@ _080671F0: pop {r0} bx r0 .pool - thumb_func_end sub_806719C + thumb_func_end LinkOpponentHandleStatusIconUpdate - thumb_func_start sub_8067214 -sub_8067214: @ 8067214 + thumb_func_start LinkOpponentHandleStatusAnimation +LinkOpponentHandleStatusAnimation: @ 8067214 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -5314,82 +5297,82 @@ _08067264: pop {r0} bx r0 .pool - thumb_func_end sub_8067214 + thumb_func_end LinkOpponentHandleStatusAnimation - thumb_func_start sub_806727C -sub_806727C: @ 806727C + thumb_func_start LinkOpponentHandleStatusXor +LinkOpponentHandleStatusXor: @ 806727C push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_806727C + thumb_func_end LinkOpponentHandleStatusXor - thumb_func_start sub_8067288 -sub_8067288: @ 8067288 + thumb_func_start LinkOpponentHandleDataTransfer +LinkOpponentHandleDataTransfer: @ 8067288 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067288 + thumb_func_end LinkOpponentHandleDataTransfer - thumb_func_start sub_8067294 -sub_8067294: @ 8067294 + thumb_func_start LinkOpponentHandleDMA3Transfer +LinkOpponentHandleDMA3Transfer: @ 8067294 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8067294 + thumb_func_end LinkOpponentHandleDMA3Transfer - thumb_func_start sub_80672A0 -sub_80672A0: @ 80672A0 + thumb_func_start LinkOpponentHandlePlayBGM +LinkOpponentHandlePlayBGM: @ 80672A0 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80672A0 + thumb_func_end LinkOpponentHandlePlayBGM - thumb_func_start sub_80672AC -sub_80672AC: @ 80672AC + thumb_func_start LinkOpponentHandleCmd32 +LinkOpponentHandleCmd32: @ 80672AC push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80672AC + thumb_func_end LinkOpponentHandleCmd32 - thumb_func_start sub_80672B8 -sub_80672B8: @ 80672B8 + thumb_func_start LinkOpponentHandleCmd33 +LinkOpponentHandleCmd33: @ 80672B8 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80672B8 + thumb_func_end LinkOpponentHandleCmd33 - thumb_func_start sub_80672C4 -sub_80672C4: @ 80672C4 + thumb_func_start LinkOpponentHandleCmd34 +LinkOpponentHandleCmd34: @ 80672C4 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80672C4 + thumb_func_end LinkOpponentHandleCmd34 - thumb_func_start sub_80672D0 -sub_80672D0: @ 80672D0 + thumb_func_start LinkOpponentHandleCmd35 +LinkOpponentHandleCmd35: @ 80672D0 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80672D0 + thumb_func_end LinkOpponentHandleCmd35 - thumb_func_start sub_80672DC -sub_80672DC: @ 80672DC + thumb_func_start LinkOpponentHandleCmd36 +LinkOpponentHandleCmd36: @ 80672DC push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80672DC + thumb_func_end LinkOpponentHandleCmd36 - thumb_func_start sub_80672E8 -sub_80672E8: @ 80672E8 + thumb_func_start LinkOpponentHandleCmd37 +LinkOpponentHandleCmd37: @ 80672E8 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5401,10 +5384,10 @@ sub_80672E8: @ 80672E8 pop {r0} bx r0 .pool - thumb_func_end sub_80672E8 + thumb_func_end LinkOpponentHandleCmd37 - thumb_func_start sub_8067304 -sub_8067304: @ 8067304 + thumb_func_start LinkOpponentHandleCmd38 +LinkOpponentHandleCmd38: @ 8067304 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, =gBattleBufferA @@ -5426,10 +5409,10 @@ sub_8067304: @ 8067304 pop {r0} bx r0 .pool - thumb_func_end sub_8067304 + thumb_func_end LinkOpponentHandleCmd38 - thumb_func_start sub_806733C -sub_806733C: @ 806733C + thumb_func_start LinkOpponentHandleCmd39 +LinkOpponentHandleCmd39: @ 806733C push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5440,10 +5423,10 @@ sub_806733C: @ 806733C pop {r0} bx r0 .pool - thumb_func_end sub_806733C + thumb_func_end LinkOpponentHandleCmd39 - thumb_func_start sub_8067354 -sub_8067354: @ 8067354 + thumb_func_start LinkOpponentHandleCmd40 +LinkOpponentHandleCmd40: @ 8067354 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, [r3] @@ -5461,10 +5444,10 @@ sub_8067354: @ 8067354 pop {r0} bx r0 .pool - thumb_func_end sub_8067354 + thumb_func_end LinkOpponentHandleCmd40 - thumb_func_start sub_806737C -sub_806737C: @ 806737C + thumb_func_start LinkOpponentHandleHitAnimation +LinkOpponentHandleHitAnimation: @ 806737C push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -5510,18 +5493,18 @@ _080673DA: pop {r0} bx r0 .pool - thumb_func_end sub_806737C + thumb_func_end LinkOpponentHandleHitAnimation - thumb_func_start sub_80673EC -sub_80673EC: @ 80673EC + thumb_func_start LinkOpponentHandleCmd42 +LinkOpponentHandleCmd42: @ 80673EC push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80673EC + thumb_func_end LinkOpponentHandleCmd42 - thumb_func_start sub_80673F8 -sub_80673F8: @ 80673F8 + thumb_func_start LinkOpponentHandleEffectivenessSound +LinkOpponentHandleEffectivenessSound: @ 80673F8 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5551,10 +5534,10 @@ _0806740C: pop {r0} bx r0 .pool - thumb_func_end sub_80673F8 + thumb_func_end LinkOpponentHandleEffectivenessSound - thumb_func_start sub_806743C -sub_806743C: @ 806743C + thumb_func_start LinkOpponentHandlePlayFanfareOrBGM +LinkOpponentHandlePlayFanfareOrBGM: @ 806743C push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -5594,10 +5577,10 @@ _0806748C: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_806743C + thumb_func_end LinkOpponentHandlePlayFanfareOrBGM - thumb_func_start sub_8067498 -sub_8067498: @ 8067498 + thumb_func_start LinkOpponentHandleFaintingCry +LinkOpponentHandleFaintingCry: @ 8067498 push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -5620,10 +5603,10 @@ sub_8067498: @ 8067498 pop {r0} bx r0 .pool - thumb_func_end sub_8067498 + thumb_func_end LinkOpponentHandleFaintingCry - thumb_func_start sub_80674D4 -sub_80674D4: @ 80674D4 + thumb_func_start LinkOpponentHandleIntroSlide +LinkOpponentHandleIntroSlide: @ 80674D4 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5642,10 +5625,10 @@ sub_80674D4: @ 80674D4 pop {r0} bx r0 .pool - thumb_func_end sub_80674D4 + thumb_func_end LinkOpponentHandleIntroSlide - thumb_func_start sub_8067508 -sub_8067508: @ 8067508 + thumb_func_start LinkOpponentHandleIntroTrainerBallThrow +LinkOpponentHandleIntroTrainerBallThrow: @ 8067508 push {r4-r6,lr} ldr r5, =gBankSpriteIds ldr r6, =gActiveBank @@ -5757,7 +5740,7 @@ _080675CA: pop {r0} bx r0 .pool - thumb_func_end sub_8067508 + thumb_func_end LinkOpponentHandleIntroTrainerBallThrow thumb_func_start c3_08038DC4 c3_08038DC4: @ 8067618 @@ -5872,8 +5855,8 @@ sub_80676FC: @ 80676FC bx r0 thumb_func_end sub_80676FC - thumb_func_start sub_8067718 -sub_8067718: @ 8067718 + thumb_func_start LinkOpponentHandleDrawPartyStatusSummary +LinkOpponentHandleDrawPartyStatusSummary: @ 8067718 push {r4-r7,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5995,7 +5978,7 @@ _08067812: pop {r0} bx r0 .pool - thumb_func_end sub_8067718 + thumb_func_end LinkOpponentHandleDrawPartyStatusSummary thumb_func_start sub_806782C sub_806782C: @ 806782C @@ -6033,8 +6016,8 @@ _08067864: .pool thumb_func_end sub_806782C - thumb_func_start sub_8067874 -sub_8067874: @ 8067874 + thumb_func_start LinkOpponentHandleCmd49 +LinkOpponentHandleCmd49: @ 8067874 push {lr} ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] @@ -6065,18 +6048,18 @@ _080678A6: pop {r0} bx r0 .pool - thumb_func_end sub_8067874 + thumb_func_end LinkOpponentHandleCmd49 - thumb_func_start sub_80678C4 -sub_80678C4: @ 80678C4 + thumb_func_start LinkOpponentHandleCmd50 +LinkOpponentHandleCmd50: @ 80678C4 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80678C4 + thumb_func_end LinkOpponentHandleCmd50 - thumb_func_start sub_80678D0 -sub_80678D0: @ 80678D0 + thumb_func_start LinkOpponentHandleSpriteInvisibility +LinkOpponentHandleSpriteInvisibility: @ 80678D0 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -6116,10 +6099,10 @@ _08067916: pop {r0} bx r0 .pool - thumb_func_end sub_80678D0 + thumb_func_end LinkOpponentHandleSpriteInvisibility - thumb_func_start sub_8067930 -sub_8067930: @ 8067930 + thumb_func_start LinkOpponentHandleBattleAnimation +LinkOpponentHandleBattleAnimation: @ 8067930 push {r4-r6,lr} sub sp, 0x4 ldr r5, =gActiveBank @@ -6169,10 +6152,10 @@ _08067992: pop {r0} bx r0 .pool - thumb_func_end sub_8067930 + thumb_func_end LinkOpponentHandleBattleAnimation - thumb_func_start sub_80679A4 -sub_80679A4: @ 80679A4 + thumb_func_start LinkOpponentHandleLinkStandbyMsg +LinkOpponentHandleLinkStandbyMsg: @ 80679A4 push {lr} ldr r0, =gActiveBank ldrb r0, [r0] @@ -6184,18 +6167,18 @@ sub_80679A4: @ 80679A4 pop {r0} bx r0 .pool - thumb_func_end sub_80679A4 + thumb_func_end LinkOpponentHandleLinkStandbyMsg - thumb_func_start sub_80679C4 -sub_80679C4: @ 80679C4 + thumb_func_start LinkOpponentHandleResetActionMoveSelection +LinkOpponentHandleResetActionMoveSelection: @ 80679C4 push {lr} bl LinkOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80679C4 + thumb_func_end LinkOpponentHandleResetActionMoveSelection - thumb_func_start sub_80679D0 -sub_80679D0: @ 80679D0 + thumb_func_start LinkOpponentHandleCmd55 +LinkOpponentHandleCmd55: @ 80679D0 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -6255,7 +6238,7 @@ _08067A08: pop {r0} bx r0 .pool - thumb_func_end sub_80679D0 + thumb_func_end LinkOpponentHandleCmd55 thumb_func_start nullsub_92 nullsub_92: @ 8067A70 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index b66e373ca..db86779c4 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -5,24 +5,6 @@ .text - - thumb_func_start nullsub_26 -nullsub_26: @ 805F160 - bx lr - thumb_func_end nullsub_26 - - thumb_func_start SetBankFuncToOpponentBufferRunCommand -SetBankFuncToOpponentBufferRunCommand: @ 805F164 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =OpponentBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToOpponentBufferRunCommand thumb_func_start OpponentBufferRunCommand OpponentBufferRunCommand: @ 805F180 @@ -1619,8 +1601,8 @@ _0805FF7E: .pool thumb_func_end OpponentBufferExecCompleted - thumb_func_start dp01t_00_7_getattr -dp01t_00_7_getattr: @ 805FF90 + thumb_func_start OpponentHandleGetMonData +OpponentHandleGetMonData: @ 805FF90 push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -1672,7 +1654,7 @@ _0805FFEA: pop {r4-r6} pop {r0} bx r0 - thumb_func_end dp01t_00_7_getattr + thumb_func_end OpponentHandleGetMonData thumb_func_start sub_8060004 sub_8060004: @ 8060004 @@ -2552,8 +2534,8 @@ _0806079A: .pool thumb_func_end sub_8060004 - thumb_func_start dp01t_01_2_read_pokmon_data_slice -dp01t_01_2_read_pokmon_data_slice: @ 80607B0 + thumb_func_start OpponentHandleGetRawMonData +OpponentHandleGetRawMonData: @ 80607B0 push {r4-r7,lr} sub sp, 0x58 ldr r2, =gBattlePartyID @@ -2614,10 +2596,10 @@ _08060806: pop {r0} bx r0 .pool - thumb_func_end dp01t_01_2_read_pokmon_data_slice + thumb_func_end OpponentHandleGetRawMonData - thumb_func_start dp01t_02_7_setattr -dp01t_02_7_setattr: @ 8060838 + thumb_func_start OpponentHandleSetMonData +OpponentHandleSetMonData: @ 8060838 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -2657,7 +2639,7 @@ _08060886: pop {r4,r5} pop {r0} bx r0 - thumb_func_end dp01t_02_7_setattr + thumb_func_end OpponentHandleSetMonData thumb_func_start sub_8060890 sub_8060890: @ 8060890 @@ -3644,8 +3626,8 @@ _0806119C: .pool thumb_func_end sub_8060890 - thumb_func_start sub_80611B0 -sub_80611B0: @ 80611B0 + thumb_func_start OpponentHandleSetRawMonData +OpponentHandleSetRawMonData: @ 80611B0 push {r4-r7,lr} ldr r1, =gBattlePartyID ldr r7, =gActiveBank @@ -3697,10 +3679,10 @@ _08061208: pop {r0} bx r0 .pool - thumb_func_end sub_80611B0 + thumb_func_end OpponentHandleSetRawMonData - thumb_func_start sub_8061224 -sub_8061224: @ 8061224 + thumb_func_start OpponentHandleLoadMonSprite +OpponentHandleLoadMonSprite: @ 8061224 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -3843,10 +3825,10 @@ sub_8061224: @ 8061224 pop {r0} bx r0 .pool - thumb_func_end sub_8061224 + thumb_func_end OpponentHandleLoadMonSprite - thumb_func_start sub_806137C -sub_806137C: @ 806137C + thumb_func_start OpponentHandleSwitchInAnim +OpponentHandleSwitchInAnim: @ 806137C push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -3882,7 +3864,7 @@ sub_806137C: @ 806137C pop {r0} bx r0 .pool - thumb_func_end sub_806137C + thumb_func_end OpponentHandleSwitchInAnim thumb_func_start sub_80613DC sub_80613DC: @ 80613DC @@ -4057,8 +4039,8 @@ sub_80613DC: @ 80613DC .pool thumb_func_end sub_80613DC - thumb_func_start sub_806156C -sub_806156C: @ 806156C + thumb_func_start OpponentHandleReturnMonToBall +OpponentHandleReturnMonToBall: @ 806156C push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r6, =gActiveBank @@ -4116,7 +4098,7 @@ _080615F0: pop {r0} bx r0 .pool - thumb_func_end sub_806156C + thumb_func_end OpponentHandleReturnMonToBall thumb_func_start sub_8061604 sub_8061604: @ 8061604 @@ -4188,8 +4170,8 @@ _08061682: .pool thumb_func_end sub_8061604 - thumb_func_start sub_8061690 -sub_8061690: @ 8061690 + thumb_func_start OpponentHandleDrawTrainerPic +OpponentHandleDrawTrainerPic: @ 8061690 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -4434,10 +4416,10 @@ _080617CA: pop {r0} bx r0 .pool - thumb_func_end sub_8061690 + thumb_func_end OpponentHandleDrawTrainerPic - thumb_func_start sub_80618D8 -sub_80618D8: @ 80618D8 + thumb_func_start OpponentHandleTrainerSlide +OpponentHandleTrainerSlide: @ 80618D8 push {r4-r6,lr} mov r6, r8 push {r6} @@ -4662,10 +4644,10 @@ _080619DE: pop {r0} bx r0 .pool - thumb_func_end sub_80618D8 + thumb_func_end OpponentHandleTrainerSlide - thumb_func_start sub_8061AF0 -sub_8061AF0: @ 8061AF0 + thumb_func_start OpponentHandleTrainerSlideBack +OpponentHandleTrainerSlideBack: @ 8061AF0 push {r4-r6,lr} ldr r6, =gBankSpriteIds ldr r4, =gActiveBank @@ -4736,10 +4718,10 @@ sub_8061AF0: @ 8061AF0 pop {r0} bx r0 .pool - thumb_func_end sub_8061AF0 + thumb_func_end OpponentHandleTrainerSlideBack - thumb_func_start sub_8061B9C -sub_8061B9C: @ 8061B9C + thumb_func_start OpponentHandleFaintAnimation +OpponentHandleFaintAnimation: @ 8061B9C push {r4-r6,lr} ldr r6, =gBattleSpritesDataPtr ldr r4, [r6] @@ -4813,42 +4795,42 @@ _08061C2C: pop {r0} bx r0 .pool - thumb_func_end sub_8061B9C + thumb_func_end OpponentHandleFaintAnimation - thumb_func_start sub_8061C48 -sub_8061C48: @ 8061C48 + thumb_func_start OpponentHandleCmd11 +OpponentHandleCmd11: @ 8061C48 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8061C48 + thumb_func_end OpponentHandleCmd11 - thumb_func_start sub_8061C54 -sub_8061C54: @ 8061C54 + thumb_func_start OpponentHandleCmd12 +OpponentHandleCmd12: @ 8061C54 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8061C54 + thumb_func_end OpponentHandleCmd12 - thumb_func_start sub_8061C60 -sub_8061C60: @ 8061C60 + thumb_func_start OpponentHandleBallThrow +OpponentHandleBallThrow: @ 8061C60 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8061C60 + thumb_func_end OpponentHandleBallThrow - thumb_func_start sub_8061C6C -sub_8061C6C: @ 8061C6C + thumb_func_start OpponentHandlePause +OpponentHandlePause: @ 8061C6C push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8061C6C + thumb_func_end OpponentHandlePause - thumb_func_start sub_8061C78 -sub_8061C78: @ 8061C78 + thumb_func_start OpponentHandleMoveAnimation +OpponentHandleMoveAnimation: @ 8061C78 push {r4-r6,lr} ldr r6, =gActiveBank ldrb r0, [r6] @@ -4982,7 +4964,7 @@ _08061D9E: pop {r0} bx r0 .pool - thumb_func_end sub_8061C78 + thumb_func_end OpponentHandleMoveAnimation thumb_func_start bx_move_anim_7 bx_move_anim_7: @ 8061DB0 @@ -5168,8 +5150,8 @@ _08061F24: bx r0 thumb_func_end bx_move_anim_7 - thumb_func_start sub_8061F34 -sub_8061F34: @ 8061F34 + thumb_func_start OpponentHandlePrintString +OpponentHandlePrintString: @ 8061F34 push {r4,r5,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -5199,35 +5181,35 @@ sub_8061F34: @ 8061F34 pop {r0} bx r0 .pool - thumb_func_end sub_8061F34 + thumb_func_end OpponentHandlePrintString - thumb_func_start sub_8061F90 -sub_8061F90: @ 8061F90 + thumb_func_start OpponentHandlePrintStringPlayerOnly +OpponentHandlePrintStringPlayerOnly: @ 8061F90 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8061F90 + thumb_func_end OpponentHandlePrintStringPlayerOnly - thumb_func_start sub_8061F9C -sub_8061F9C: @ 8061F9C + thumb_func_start OpponentHandleChooseAction +OpponentHandleChooseAction: @ 8061F9C push {lr} bl AI_TrySwitchOrUseItem bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8061F9C + thumb_func_end OpponentHandleChooseAction - thumb_func_start sub_8061FAC -sub_8061FAC: @ 8061FAC + thumb_func_start OpponentHandleCmd19 +OpponentHandleCmd19: @ 8061FAC push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8061FAC + thumb_func_end OpponentHandleCmd19 - thumb_func_start sub_8061FB8 -sub_8061FB8: @ 8061FB8 + thumb_func_start OpponentHandleChooseMove +OpponentHandleChooseMove: @ 8061FB8 push {r4-r6,lr} ldr r0, =gBattleTypeFlags ldr r2, [r0] @@ -5420,10 +5402,10 @@ _08062156: pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_8061FB8 + thumb_func_end OpponentHandleChooseMove - thumb_func_start sub_806215C -sub_806215C: @ 806215C + thumb_func_start OpponentHandleOpenBag +OpponentHandleOpenBag: @ 806215C push {lr} ldr r0, =gActiveBank ldrb r0, [r0] @@ -5440,10 +5422,10 @@ sub_806215C: @ 806215C pop {r0} bx r0 .pool - thumb_func_end sub_806215C + thumb_func_end OpponentHandleOpenBag - thumb_func_start sub_8062188 -sub_8062188: @ 8062188 + thumb_func_start OpponentHandleChoosePokemon +OpponentHandleChoosePokemon: @ 8062188 push {r4-r7,lr} ldr r0, =gActiveBank ldrb r0, [r0] @@ -5556,18 +5538,18 @@ _0806225A: pop {r0} bx r0 .pool - thumb_func_end sub_8062188 + thumb_func_end OpponentHandleChoosePokemon - thumb_func_start sub_8062288 -sub_8062288: @ 8062288 + thumb_func_start OpponentHandleCmd23 +OpponentHandleCmd23: @ 8062288 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062288 + thumb_func_end OpponentHandleCmd23 - thumb_func_start sub_8062294 -sub_8062294: @ 8062294 + thumb_func_start OpponentHandleHealthBarUpdate +OpponentHandleHealthBarUpdate: @ 8062294 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -5660,18 +5642,18 @@ _0806234E: pop {r0} bx r0 .pool - thumb_func_end sub_8062294 + thumb_func_end OpponentHandleHealthBarUpdate - thumb_func_start sub_8062384 -sub_8062384: @ 8062384 + thumb_func_start OpponentHandleExpUpdate +OpponentHandleExpUpdate: @ 8062384 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062384 + thumb_func_end OpponentHandleExpUpdate - thumb_func_start sub_8062390 -sub_8062390: @ 8062390 + thumb_func_start OpponentHandleStatusIconUpdate +OpponentHandleStatusIconUpdate: @ 8062390 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5717,10 +5699,10 @@ _080623E4: pop {r0} bx r0 .pool - thumb_func_end sub_8062390 + thumb_func_end OpponentHandleStatusIconUpdate - thumb_func_start sub_8062408 -sub_8062408: @ 8062408 + thumb_func_start OpponentHandleStatusAnimation +OpponentHandleStatusAnimation: @ 8062408 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -5764,82 +5746,82 @@ _08062458: pop {r0} bx r0 .pool - thumb_func_end sub_8062408 + thumb_func_end OpponentHandleStatusAnimation - thumb_func_start sub_8062470 -sub_8062470: @ 8062470 + thumb_func_start OpponentHandleStatusXor +OpponentHandleStatusXor: @ 8062470 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062470 + thumb_func_end OpponentHandleStatusXor - thumb_func_start sub_806247C -sub_806247C: @ 806247C + thumb_func_start OpponentHandleDataTransfer +OpponentHandleDataTransfer: @ 806247C push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_806247C + thumb_func_end OpponentHandleDataTransfer - thumb_func_start sub_8062488 -sub_8062488: @ 8062488 + thumb_func_start OpponentHandleDMA3Transfer +OpponentHandleDMA3Transfer: @ 8062488 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062488 + thumb_func_end OpponentHandleDMA3Transfer - thumb_func_start sub_8062494 -sub_8062494: @ 8062494 + thumb_func_start OpponentHandlePlayBGM +OpponentHandlePlayBGM: @ 8062494 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062494 + thumb_func_end OpponentHandlePlayBGM - thumb_func_start sub_80624A0 -sub_80624A0: @ 80624A0 + thumb_func_start OpponentHandleCmd32 +OpponentHandleCmd32: @ 80624A0 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80624A0 + thumb_func_end OpponentHandleCmd32 - thumb_func_start sub_80624AC -sub_80624AC: @ 80624AC + thumb_func_start OpponentHandleCmd33 +OpponentHandleCmd33: @ 80624AC push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80624AC + thumb_func_end OpponentHandleCmd33 - thumb_func_start sub_80624B8 -sub_80624B8: @ 80624B8 + thumb_func_start OpponentHandleCmd34 +OpponentHandleCmd34: @ 80624B8 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80624B8 + thumb_func_end OpponentHandleCmd34 - thumb_func_start sub_80624C4 -sub_80624C4: @ 80624C4 + thumb_func_start OpponentHandleCmd35 +OpponentHandleCmd35: @ 80624C4 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80624C4 + thumb_func_end OpponentHandleCmd35 - thumb_func_start sub_80624D0 -sub_80624D0: @ 80624D0 + thumb_func_start OpponentHandleCmd36 +OpponentHandleCmd36: @ 80624D0 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80624D0 + thumb_func_end OpponentHandleCmd36 - thumb_func_start sub_80624DC -sub_80624DC: @ 80624DC + thumb_func_start OpponentHandleCmd37 +OpponentHandleCmd37: @ 80624DC push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5851,10 +5833,10 @@ sub_80624DC: @ 80624DC pop {r0} bx r0 .pool - thumb_func_end sub_80624DC + thumb_func_end OpponentHandleCmd37 - thumb_func_start sub_80624F8 -sub_80624F8: @ 80624F8 + thumb_func_start OpponentHandleCmd38 +OpponentHandleCmd38: @ 80624F8 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, =gBattleBufferA @@ -5876,10 +5858,10 @@ sub_80624F8: @ 80624F8 pop {r0} bx r0 .pool - thumb_func_end sub_80624F8 + thumb_func_end OpponentHandleCmd38 - thumb_func_start sub_8062530 -sub_8062530: @ 8062530 + thumb_func_start OpponentHandleCmd39 +OpponentHandleCmd39: @ 8062530 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5890,10 +5872,10 @@ sub_8062530: @ 8062530 pop {r0} bx r0 .pool - thumb_func_end sub_8062530 + thumb_func_end OpponentHandleCmd39 - thumb_func_start sub_8062548 -sub_8062548: @ 8062548 + thumb_func_start OpponentHandleCmd40 +OpponentHandleCmd40: @ 8062548 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, [r3] @@ -5911,10 +5893,10 @@ sub_8062548: @ 8062548 pop {r0} bx r0 .pool - thumb_func_end sub_8062548 + thumb_func_end OpponentHandleCmd40 - thumb_func_start dp01t_29_7_blink -dp01t_29_7_blink: @ 8062570 + thumb_func_start OpponentHandleHitAnimation +OpponentHandleHitAnimation: @ 8062570 push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -5960,18 +5942,18 @@ _080625CE: pop {r0} bx r0 .pool - thumb_func_end dp01t_29_7_blink + thumb_func_end OpponentHandleHitAnimation - thumb_func_start sub_80625E0 -sub_80625E0: @ 80625E0 + thumb_func_start OpponentHandleCmd42 +OpponentHandleCmd42: @ 80625E0 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_80625E0 + thumb_func_end OpponentHandleCmd42 - thumb_func_start sub_80625EC -sub_80625EC: @ 80625EC + thumb_func_start OpponentHandleEffectivenessSound +OpponentHandleEffectivenessSound: @ 80625EC push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -6001,10 +5983,10 @@ _08062600: pop {r0} bx r0 .pool - thumb_func_end sub_80625EC + thumb_func_end OpponentHandleEffectivenessSound - thumb_func_start sub_8062630 -sub_8062630: @ 8062630 + thumb_func_start OpponentHandlePlayFanfareOrBGM +OpponentHandlePlayFanfareOrBGM: @ 8062630 push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -6044,10 +6026,10 @@ _08062680: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_8062630 + thumb_func_end OpponentHandlePlayFanfareOrBGM - thumb_func_start sub_806268C -sub_806268C: @ 806268C + thumb_func_start OpponentHandleFaintingCry +OpponentHandleFaintingCry: @ 806268C push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -6070,10 +6052,10 @@ sub_806268C: @ 806268C pop {r0} bx r0 .pool - thumb_func_end sub_806268C + thumb_func_end OpponentHandleFaintingCry - thumb_func_start dp01t_2E_7_battle_intro -dp01t_2E_7_battle_intro: @ 80626C8 + thumb_func_start OpponentHandleIntroSlide +OpponentHandleIntroSlide: @ 80626C8 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -6092,10 +6074,10 @@ dp01t_2E_7_battle_intro: @ 80626C8 pop {r0} bx r0 .pool - thumb_func_end dp01t_2E_7_battle_intro + thumb_func_end OpponentHandleIntroSlide - thumb_func_start sub_80626FC -sub_80626FC: @ 80626FC + thumb_func_start OpponentHandleIntroTrainerBallThrow +OpponentHandleIntroTrainerBallThrow: @ 80626FC push {r4-r6,lr} ldr r5, =gBankSpriteIds ldr r6, =gActiveBank @@ -6207,7 +6189,7 @@ _080627BE: pop {r0} bx r0 .pool - thumb_func_end sub_80626FC + thumb_func_end OpponentHandleIntroTrainerBallThrow thumb_func_start sub_806280C sub_806280C: @ 806280C @@ -6327,8 +6309,8 @@ _080628E0: .pool thumb_func_end sub_8062828 - thumb_func_start dp01t_30_7_0803D67C -dp01t_30_7_0803D67C: @ 8062918 + thumb_func_start OpponentHandleDrawPartyStatusSummary +OpponentHandleDrawPartyStatusSummary: @ 8062918 push {r4-r7,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -6450,7 +6432,7 @@ _08062A12: pop {r0} bx r0 .pool - thumb_func_end dp01t_30_7_0803D67C + thumb_func_end OpponentHandleDrawPartyStatusSummary thumb_func_start bx_0803D790_t7 bx_0803D790_t7: @ 8062A2C @@ -6488,8 +6470,8 @@ _08062A64: .pool thumb_func_end bx_0803D790_t7 - thumb_func_start sub_8062A74 -sub_8062A74: @ 8062A74 + thumb_func_start OpponentHandleCmd49 +OpponentHandleCmd49: @ 8062A74 push {lr} ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] @@ -6520,18 +6502,18 @@ _08062AA6: pop {r0} bx r0 .pool - thumb_func_end sub_8062A74 + thumb_func_end OpponentHandleCmd49 - thumb_func_start sub_8062AC4 -sub_8062AC4: @ 8062AC4 + thumb_func_start OpponentHandleCmd50 +OpponentHandleCmd50: @ 8062AC4 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062AC4 + thumb_func_end OpponentHandleCmd50 - thumb_func_start sub_8062AD0 -sub_8062AD0: @ 8062AD0 + thumb_func_start OpponentHandleSpriteInvisibility +OpponentHandleSpriteInvisibility: @ 8062AD0 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -6571,10 +6553,10 @@ _08062B16: pop {r0} bx r0 .pool - thumb_func_end sub_8062AD0 + thumb_func_end OpponentHandleSpriteInvisibility - thumb_func_start dp01t_34_7_move_anim_start_t3 -dp01t_34_7_move_anim_start_t3: @ 8062B30 + thumb_func_start OpponentHandleBattleAnimation +OpponentHandleBattleAnimation: @ 8062B30 push {r4-r6,lr} sub sp, 0x4 ldr r6, =gActiveBank @@ -6620,26 +6602,26 @@ _08062B88: pop {r0} bx r0 .pool - thumb_func_end dp01t_34_7_move_anim_start_t3 + thumb_func_end OpponentHandleBattleAnimation - thumb_func_start sub_8062B98 -sub_8062B98: @ 8062B98 + thumb_func_start OpponentHandleLinkStandbyMsg +OpponentHandleLinkStandbyMsg: @ 8062B98 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062B98 + thumb_func_end OpponentHandleLinkStandbyMsg - thumb_func_start sub_8062BA4 -sub_8062BA4: @ 8062BA4 + thumb_func_start OpponentHandleResetActionMoveSelection +OpponentHandleResetActionMoveSelection: @ 8062BA4 push {lr} bl OpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8062BA4 + thumb_func_end OpponentHandleResetActionMoveSelection - thumb_func_start sub_8062BB0 -sub_8062BB0: @ 8062BB0 + thumb_func_start OpponentHandleCmd55 +OpponentHandleCmd55: @ 8062BB0 push {lr} ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -6665,7 +6647,7 @@ _08062BDA: pop {r0} bx r0 .pool - thumb_func_end sub_8062BB0 + thumb_func_end OpponentHandleCmd55 thumb_func_start nullsub_91 nullsub_91: @ 8062BF4 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 10b675714..a86cd7ffe 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -5,4728 +5,11 @@ .text - thumb_func_start nullsub_21 -nullsub_21: @ 8057458 - bx lr - thumb_func_end nullsub_21 + + - thumb_func_start SetBankFuncToPlayerBufferRunCommand -SetBankFuncToPlayerBufferRunCommand: @ 805745C - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerBufferRunCommand - str r1, [r0] - ldr r0, =gDoingBattleAnim - movs r1, 0 - strb r1, [r0] - ldr r0, =gUnknown_020244CC - strb r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToPlayerBufferRunCommand - - thumb_func_start PlayerBufferExecCompleted -PlayerBufferExecCompleted: @ 805748C - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080574E0 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _080574F2 - .pool -_080574E0: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_080574F2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerBufferExecCompleted - - thumb_func_start PlayerBufferRunCommand -PlayerBufferRunCommand: @ 8057504 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08057550 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0805754C - ldr r0, =gPlayerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _08057550 - .pool -_0805754C: - bl PlayerBufferExecCompleted -_08057550: - pop {r0} - bx r0 - thumb_func_end PlayerBufferRunCommand - - thumb_func_start bx_0802E404 -bx_0802E404: @ 8057554 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x24 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08057576 - bl PlayerBufferExecCompleted -_08057576: - pop {r0} - bx r0 - .pool - thumb_func_end bx_0802E404 - - thumb_func_start sub_8057588 -sub_8057588: @ 8057588 - push {r4-r7,lr} - ldr r3, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r2, r0, 9 - adds r1, r3, 0x2 - adds r1, r2, r1 - ldrb r5, [r1] - adds r3, 0x3 - adds r2, r3 - ldrb r1, [r2] - lsls r1, 8 - orrs r5, r1 - movs r1, 0x1 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldrb r0, [r4] - movs r1, 0 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldr r0, =gMain - ldrh r1, [r0, 0x30] - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - beq _080575EC - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _080575EC - ldr r1, =gUnknown_020244CC - ldrb r0, [r1] - adds r0, 0x1 - b _080575F0 - .pool -_080575EC: - ldr r1, =gUnknown_020244CC - movs r0, 0 -_080575F0: - strb r0, [r1] - ldr r0, =gMain - ldrh r2, [r0, 0x2E] - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r2 - cmp r0, 0 - beq _08057658 - movs r0, 0x5 - bl PlaySE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08057640 - cmp r0, 0x1 - bgt _08057630 - cmp r0, 0 - beq _0805763A - b _080577C2 - .pool -_08057630: - cmp r0, 0x2 - beq _08057646 - cmp r0, 0x3 - beq _0805764C - b _080577C2 -_0805763A: - movs r0, 0x1 - movs r1, 0 - b _080577BC -_08057640: - movs r0, 0x1 - movs r1, 0x1 - b _080577BC -_08057646: - movs r0, 0x1 - movs r1, 0x2 - b _080577BC -_0805764C: - movs r0, 0x1 - movs r1, 0x3 - movs r2, 0 - bl EmitCmd33 - b _080577C2 -_08057658: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _08057698 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _08057674 - b _080577E8 -_08057674: - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _08057732 - .pool -_08057698: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _080576D8 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _080576B4 - b _080577E8 -_080576B4: - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _08057732 - .pool -_080576D8: - movs r7, 0x40 - adds r0, r7, 0 - ands r0, r2 - cmp r0, 0 - beq _08057700 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080577E8 - b _0805771A - .pool -_08057700: - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _0805774C - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _080577E8 -_0805771A: - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 -_08057732: - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - b _080577E8 - .pool -_0805774C: - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _0805775A - ldrb r0, [r1] - cmp r0, 0x3B - bls _080577DC -_0805775A: - ldr r4, =gBattleTypeFlags - ldr r0, [r4] - ands r0, r3 - cmp r0, 0 - beq _080577E8 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _080577E8 - movs r0, 0 - bl GetBankByIdentity - ldr r1, =gAbsentBankFlags - ldrb r1, [r1] - ldr r2, =gBitTable - lsls r0, 24 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _080577E8 - ldr r0, [r4] - ands r0, r7 - cmp r0, 0 - bne _080577E8 - ldr r0, =gBattleBufferA - ldrb r1, [r6] - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x1 - bne _080577B2 - cmp r5, 0xC - bhi _080577E8 - adds r0, r5, 0 - movs r1, 0x1 - bl AddBagItem -_080577B2: - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0xC -_080577BC: - movs r2, 0 - bl EmitCmd33 -_080577C2: - bl PlayerBufferExecCompleted - b _080577E8 - .pool -_080577DC: - movs r0, 0x8 - ands r0, r2 - cmp r0, 0 - beq _080577E8 - bl SwapHpBarsWithHpText -_080577E8: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8057588 - - thumb_func_start sub_80577F0 -sub_80577F0: @ 80577F0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - movs r1, 0x1 - bl dp11b_obj_free - ldrb r0, [r4] - movs r1, 0 - bl dp11b_obj_free - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057824 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80577F0 - - thumb_func_start sub_8057824 -sub_8057824: @ 8057824 - push {r4,r5,lr} - sub sp, 0x4 - ldr r1, =gUnknown_0831C5F8 - mov r0, sp - movs r2, 0x4 - bl memcpy - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - movs r1, 0x1 - movs r2, 0xF - movs r3, 0x1 - bl dp11b_obj_instanciate - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r0, 0 - beq _08057866 -_0805784A: - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - cmp r4, r0 - beq _0805785C - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0x1 - bl dp11b_obj_free -_0805785C: - adds r4, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _0805784A -_08057866: - ldr r2, =gMain - ldrh r1, [r2, 0x2C] - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - beq _0805789C - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _0805789C - ldr r1, =gUnknown_020244CC - ldrb r0, [r1] - adds r0, 0x1 - b _080578A0 - .pool -_0805789C: - ldr r1, =gUnknown_020244CC - movs r0, 0 -_080578A0: - strb r0, [r1] - ldrh r2, [r2, 0x2E] - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _08057910 - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r2, [r0] - ldrb r0, [r4] - lsls r0, 8 - orrs r2, r0 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - ldrb r0, [r4] - movs r1, 0x1 - bl dp11b_obj_free - bl PlayerBufferExecCompleted - b _08057BC8 - .pool -_08057910: - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _0805791E - ldrb r0, [r1] - cmp r0, 0x3B - bls _0805798C -_0805791E: - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gUnknown_03005D74 - ldrb r0, [r5] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057BFC - str r1, [r0] - ldrb r0, [r4] - movs r1, 0x1 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldrb r0, [r4] - movs r1, 0 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldrb r0, [r5] - movs r1, 0x1 - bl dp11b_obj_free - b _08057BC8 - .pool -_0805798C: - movs r0, 0x60 - ands r0, r2 - cmp r0, 0 - bne _08057996 - b _08057AB0 -_08057996: - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r3, =gUnknown_03005D74 - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - adds r5, r3, 0 -_080579B8: - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r1, r0, 24 - movs r4, 0 - mov r0, sp - b _080579E2 - .pool -_080579D8: - adds r4, 0x1 - cmp r4, 0x3 - bgt _080579E8 - mov r2, sp - adds r0, r2, r4 -_080579E2: - ldrb r0, [r0] - cmp r1, r0 - bne _080579D8 -_080579E8: - subs r4, 0x1 - cmp r4, 0 - bge _080579F0 - movs r4, 0x4 -_080579F0: - mov r1, sp - adds r0, r1, r4 - ldrb r0, [r0] - bl GetBankByIdentity - strb r0, [r5] - ldr r1, =gNoOfAllBanks - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - beq _080579E8 - movs r4, 0 - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08057A6E - cmp r0, 0x1 - bgt _08057A28 - cmp r0, 0 - beq _08057A32 - b _08057A70 - .pool -_08057A28: - cmp r0, 0x2 - beq _08057A32 - cmp r0, 0x3 - beq _08057A6E - b _08057A70 -_08057A32: - ldr r2, =gActiveBank - ldrb r0, [r2] - ldrb r1, [r5] - cmp r0, r1 - bne _08057A6E - ldr r1, =gBattlePartyID - ldrb r2, [r2] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gMoveSelectionCursor - adds r2, r1 - ldrb r1, [r2] - adds r1, 0xD - bl GetMonData - ldr r2, =gBattleMoves - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x6] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08057A70 -_08057A6E: - adds r4, 0x1 -_08057A70: - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - ldr r0, =gUnknown_03005D74 - cmp r1, 0 - beq _08057A88 - movs r4, 0 -_08057A88: - cmp r4, 0 - beq _080579B8 - b _08057BB0 - .pool -_08057AB0: - movs r0, 0x90 - ands r0, r2 - cmp r0, 0 - bne _08057ABA - b _08057BC8 -_08057ABA: - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r3, =gUnknown_03005D74 - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - adds r5, r3, 0 -_08057ADC: - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r1, r0, 24 - movs r4, 0 - mov r0, sp - b _08057B06 - .pool -_08057AFC: - adds r4, 0x1 - cmp r4, 0x3 - bgt _08057B0C - mov r2, sp - adds r0, r2, r4 -_08057B06: - ldrb r0, [r0] - cmp r1, r0 - bne _08057AFC -_08057B0C: - adds r4, 0x1 - cmp r4, 0x3 - ble _08057B14 - movs r4, 0 -_08057B14: - mov r1, sp - adds r0, r1, r4 - ldrb r0, [r0] - bl GetBankByIdentity - strb r0, [r5] - ldr r1, =gNoOfAllBanks - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - beq _08057B0C - movs r4, 0 - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08057B92 - cmp r0, 0x1 - bgt _08057B4C - cmp r0, 0 - beq _08057B56 - b _08057B94 - .pool -_08057B4C: - cmp r0, 0x2 - beq _08057B56 - cmp r0, 0x3 - beq _08057B92 - b _08057B94 -_08057B56: - ldr r2, =gActiveBank - ldrb r0, [r2] - ldrb r1, [r5] - cmp r0, r1 - bne _08057B92 - ldr r1, =gBattlePartyID - ldrb r2, [r2] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gMoveSelectionCursor - adds r2, r1 - ldrb r1, [r2] - adds r1, 0xD - bl GetMonData - ldr r2, =gBattleMoves - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x6] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08057B94 -_08057B92: - adds r4, 0x1 -_08057B94: - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - ldr r0, =gUnknown_03005D74 - cmp r1, 0 - beq _08057BAC - movs r4, 0 -_08057BAC: - cmp r4, 0 - beq _08057ADC -_08057BB0: - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039AD8 - str r1, [r0] -_08057BC8: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8057824 - - thumb_func_start sub_8057BFC -sub_8057BFC: @ 8057BFC - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r0, 0 - mov r8, r0 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r1, =gBattleBufferA + 4 - adds r6, r0, r1 - ldr r2, =gMain - ldrh r1, [r2, 0x2C] - movs r0, 0xF0 - ands r0, r1 - adds r7, r3, 0 - cmp r0, 0 - beq _08057C44 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _08057C44 - ldr r1, =gUnknown_020244CC - ldrb r0, [r1] - adds r0, 0x1 - b _08057C48 - .pool -_08057C44: - ldr r1, =gUnknown_020244CC - movs r0, 0 -_08057C48: - strb r0, [r1] - ldrh r2, [r2, 0x2E] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r2 - cmp r0, 0 - bne _08057C58 - b _08057E04 -_08057C58: - movs r0, 0x5 - bl PlaySE - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 1 - adds r1, r6, r0 - ldrh r0, [r1] - cmp r0, 0xAE - bne _08057C98 - ldrb r0, [r6, 0x12] - movs r4, 0 - cmp r0, 0x7 - beq _08057CA6 - ldrb r1, [r6, 0x13] - movs r0, 0x7 - eors r1, r0 - negs r0, r1 - orrs r0, r1 - asrs r4, r0, 31 - movs r0, 0x10 - ands r4, r0 - b _08057CA6 - .pool -_08057C98: - ldr r2, =gBattleMoves - ldrh r1, [r1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r4, [r0, 0x6] -_08057CA6: - movs r0, 0x10 - ands r0, r4 - cmp r0, 0 - beq _08057CC4 - ldr r0, =gUnknown_03005D74 - ldr r1, =gActiveBank - ldrb r1, [r1] - strb r1, [r0] - b _08057CDE - .pool -_08057CC4: - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - adds r1, r0, 0 - movs r2, 0x1 - movs r0, 0x1 - ands r0, r1 - eors r0, r2 - bl GetBankByIdentity - ldr r1, =gUnknown_03005D74 - strb r0, [r1] -_08057CDE: - ldr r5, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r2, r3, 9 - adds r1, r5, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r7, r0, 0 - cmp r1, 0 - bne _08057D18 - movs r0, 0x2 - ands r0, r4 - cmp r0, 0 - beq _08057D5A - adds r0, r5, 0x2 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r0, 0 - bne _08057D5A - movs r0, 0x1 - add r8, r0 - b _08057D5A - .pool -_08057D18: - movs r0, 0x7D - ands r0, r4 - cmp r0, 0 - bne _08057D24 - movs r0, 0x1 - add r8, r0 -_08057D24: - ldr r0, =gMoveSelectionCursor - adds r0, r3, r0 - adds r1, r6, 0 - adds r1, 0x8 - ldrb r0, [r0] - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _08057D62 - movs r0, 0x12 - ands r0, r4 - cmp r0, 0 - bne _08057D5A - movs r0, 0 - bl CountAliveMonsInBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08057D5A - ldrb r0, [r7] - bl sub_8069F34 - ldr r1, =gUnknown_03005D74 - strb r0, [r1] - movs r0, 0 - mov r8, r0 -_08057D5A: - ldr r7, =gActiveBank - mov r0, r8 - cmp r0, 0 - bne _08057D80 -_08057D62: - ldr r1, =gMoveSelectionCursor - ldrb r0, [r7] - adds r0, r1 - ldrb r2, [r0] - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - b _08057E1C - .pool -_08057D80: - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057824 - str r1, [r0] - movs r0, 0x12 - ands r4, r0 - cmp r4, 0 - beq _08057DA8 - ldr r1, =gUnknown_03005D74 - ldrb r0, [r7] - b _08057DD8 - .pool -_08057DA8: - movs r0, 0x1 - bl GetBankByIdentity - ldr r1, =gAbsentBankFlags - ldrb r1, [r1] - ldr r2, =gBitTable - lsls r0, 24 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08057DD0 - movs r0, 0x3 - b _08057DD2 - .pool -_08057DD0: - movs r0, 0x1 -_08057DD2: - bl GetBankByIdentity - ldr r1, =gUnknown_03005D74 -_08057DD8: - strb r0, [r1] - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039AD8 - b _08057F9C - .pool -_08057E04: - movs r6, 0x2 - adds r0, r6, 0 - ands r0, r2 - cmp r0, 0 - bne _08057E14 - ldrb r0, [r1] - cmp r0, 0x3B - bls _08057E30 -_08057E14: - movs r0, 0x5 - bl PlaySE - ldr r2, =0x0000ffff -_08057E1C: - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - bl PlayerBufferExecCompleted - b _08057F9E - .pool -_08057E30: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _08057E60 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r2, r0, r4 - ldrb r1, [r2] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08057E4A - b _08057F9E -_08057E4A: - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - movs r2, 0x1 - eors r0, r2 - b _08057F08 - .pool -_08057E60: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _08057EA4 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r3, r0, r4 - ldrb r2, [r3] - movs r6, 0x1 - adds r0, r5, 0 - ands r0, r2 - cmp r0, 0 - beq _08057E7C - b _08057F9E -_08057E7C: - ldr r1, =gUnknown_03005D78 - adds r0, r6, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcc _08057E8A - b _08057F9E -_08057E8A: - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - eors r0, r6 - b _08057F08 - .pool -_08057EA4: - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - beq _08057ED4 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r2, r0, r4 - ldrb r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08057F9E - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - movs r2, 0x2 - eors r0, r2 - b _08057F08 - .pool -_08057ED4: - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _08057F30 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r3, r0, r4 - ldrb r2, [r3] - movs r5, 0x2 - adds r0, r6, 0 - ands r0, r2 - cmp r0, 0 - bne _08057F9E - ldr r1, =gUnknown_03005D78 - adds r0, r5, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _08057F9E - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - eors r0, r5 -_08057F08: - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 - bl sub_8059B3C - bl sub_8059BB0 - b _08057F9E - .pool -_08057F30: - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - beq _08057F9E - ldr r0, =gUnknown_03005D78 - ldrb r0, [r0] - cmp r0, 0x1 - bls _08057F9E - ldr r0, =gBattleTypeFlags - ldr r5, [r0] - ands r5, r6 - cmp r5, 0 - bne _08057F9E - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08057F78 - ldr r0, =gUnknown_03005D74 - strb r5, [r0] - b _08057F80 - .pool -_08057F78: - ldr r1, =gUnknown_03005D74 - adds r0, 0x1 - strb r0, [r1] - adds r0, r1, 0 -_08057F80: - ldrb r0, [r0] - movs r1, 0x1B - bl battle_menu_cursor_related_2 - ldr r0, =gText_BattleSwitchWhich - movs r1, 0xB - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058138 -_08057F9C: - str r1, [r0] -_08057F9E: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8057BFC - - thumb_func_start sub_8057FBC -sub_8057FBC: @ 8057FBC - push {r4-r7,lr} - movs r7, 0 - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r6, 0x1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08057FD6 - movs r0, 0x5 - bl PlaySE - movs r7, 0x1 -_08057FD6: - ldrh r1, [r4, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08057FF8 - movs r0, 0x5 - bl PlaySE - ldr r1, =gBattle_BG0_X - movs r0, 0 - strh r0, [r1] - ldr r1, =gBattle_BG0_Y - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - movs r7, 0xFF -_08057FF8: - ldrh r1, [r4, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08058038 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r2, r0, r5 - ldrb r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08058038 - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - eors r0, r2 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_08058038: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08058086 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r3, r0, r5 - ldrb r2, [r3] - movs r6, 0x1 - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - bne _08058086 - ldr r1, =gUnknown_03005D78 - adds r0, r6, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _08058086 - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - eors r0, r6 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_08058086: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080580C8 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r2, r0, r5 - ldrb r1, [r2] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080580C8 - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 - eors r0, r2 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_080580C8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08058116 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r3, r0, r5 - ldrb r2, [r3] - movs r6, 0x2 - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _08058116 - ldr r1, =gUnknown_03005D78 - adds r0, r6, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _08058116 - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - eors r0, r6 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_08058116: - adds r0, r7, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8057FBC - - thumb_func_start sub_8058138 -sub_8058138: @ 8058138 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x5 - ands r0, r1 - cmp r0, 0 - bne _08058152 - b _08058500 -_08058152: - movs r0, 0x5 - bl PlaySE - ldr r0, =gMoveSelectionCursor - mov r10, r0 - ldr r1, =gActiveBank - mov r8, r1 - ldrb r1, [r1] - adds r2, r1, r0 - ldr r5, =gUnknown_03005D74 - ldrb r0, [r2] - ldrb r3, [r5] - cmp r0, r3 - bne _08058170 - b _080584A8 -_08058170: - lsls r1, 9 - ldr r0, =gBattleBufferA + 4 - adds r1, r0 - mov r9, r1 - ldrb r1, [r2] - lsls r1, 1 - add r1, r9 - ldrh r6, [r1] - ldrb r0, [r5] - lsls r0, 1 - add r0, r9 - ldrh r0, [r0] - strh r0, [r1] - ldrb r0, [r5] - lsls r0, 1 - add r0, r9 - strh r6, [r0] - mov r1, r8 - ldrb r0, [r1] - add r0, r10 - ldrb r1, [r0] - mov r7, r9 - adds r7, 0x8 - adds r1, r7, r1 - ldrb r6, [r1] - ldrb r0, [r5] - adds r0, r7, r0 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r5] - adds r0, r7, r0 - strb r6, [r0] - mov r2, r8 - ldrb r0, [r2] - add r0, r10 - ldrb r1, [r0] - mov r2, r9 - adds r2, 0xC - adds r1, r2, r1 - ldrb r6, [r1] - ldrb r0, [r5] - adds r0, r2, r0 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r5] - adds r2, r0 - strb r6, [r2] - mov r3, r8 - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - ldr r2, =gDisableStructs - adds r6, r0, r2 - ldrb r4, [r6, 0x18] - lsls r3, r4, 24 - lsrs r2, r3, 28 - ldr r0, =gBitTable - mov r12, r0 - add r1, r10 - ldrb r0, [r1] - lsls r0, 2 - add r0, r12 - ldr r0, [r0] - ands r2, r0 - cmp r2, 0 - beq _0805822A - lsrs r1, r3, 28 - bics r1, r0 - lsls r1, 4 - movs r2, 0xF - adds r0, r2, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r6, 0x18] - mov r1, r8 - ldrb r0, [r1] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r3, =gDisableStructs - adds r1, r3 - ldrb r4, [r1, 0x18] - lsrs r3, r4, 4 - ldrb r0, [r5] - lsls r0, 2 - add r0, r12 - ldr r0, [r0] - orrs r0, r3 - lsls r0, 4 - ands r2, r4 - orrs r2, r0 - strb r2, [r1, 0x18] -_0805822A: - bl sub_8059AAC - movs r6, 0 - mov r12, r7 - mov r5, sp - adds r5, 0x18 - str r5, [sp, 0x1C] - ldr r2, =gBattleMons - mov r0, r8 - ldrb r1, [r0] - movs r0, 0x58 - muls r0, r1 - adds r0, r2 - adds r4, r0, 0 - adds r4, 0x3B - mov r7, r8 - mov r10, r2 - movs r5, 0x3 -_0805824E: - mov r1, sp - adds r3, r1, r6 - ldrb r1, [r4] - lsls r2, r6, 1 - adds r0, r5, 0 - lsls r0, r2 - ands r1, r0 - asrs r1, r2 - strb r1, [r3] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805824E - ldr r1, =gMoveSelectionCursor - ldrb r0, [r7] - adds r0, r1 - ldrb r0, [r0] - add r0, sp - ldrb r0, [r0] - ldr r2, [sp, 0x1C] - strb r0, [r2] - ldrb r0, [r7] - adds r0, r1 - ldrb r0, [r0] - mov r3, sp - adds r2, r3, r0 - ldr r1, =gUnknown_03005D74 - ldrb r0, [r1] - add r0, sp - ldrb r0, [r0] - movs r3, 0 - strb r0, [r2] - ldrb r0, [r1] - mov r5, sp - adds r1, r5, r0 - ldr r2, [sp, 0x1C] - ldrb r0, [r2] - strb r0, [r1] - strb r3, [r2] - movs r6, 0 - ldr r2, [sp, 0x1C] -_0805829E: - mov r3, sp - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r6, 1 - lsls r1, r0 - ldrb r0, [r2] - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805829E - ldrb r1, [r7] - movs r0, 0x58 - muls r0, r1 - add r0, r10 - adds r0, 0x3B - ldr r5, [sp, 0x1C] - ldrb r1, [r5] - strb r1, [r0] - movs r6, 0 - adds r4, r7, 0 - movs r3, 0x58 - movs r0, 0x24 - add r0, r10 - mov r8, r0 - mov r2, r9 - mov r7, r10 - adds r7, 0xC - mov r5, r12 -_080582D8: - lsls r1, r6, 1 - ldrb r0, [r4] - muls r0, r3 - adds r1, r0 - adds r1, r7 - ldrh r0, [r2] - strh r0, [r1] - ldrb r0, [r4] - adds r1, r0, 0 - muls r1, r3 - adds r1, r6, r1 - add r1, r8 - adds r0, r5, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _080582D8 - ldr r2, =gActiveBank - ldrb r1, [r2] - movs r0, 0x58 - muls r0, r1 - mov r1, r10 - adds r1, 0x50 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 14 - ands r0, r1 - cmp r0, 0 - beq _0805831A - b _080584A8 -_0805831A: - movs r6, 0 - mov r1, sp - adds r1, 0x4 - str r1, [sp, 0x20] - add r3, sp, 0xC - mov r10, r3 - ldr r5, =gBattlePartyID - mov r9, r5 - mov r8, r2 - movs r7, 0x64 - ldr r5, =gPlayerParty - adds r4, r1, 0 -_08058332: - mov r1, r8 - ldrb r0, [r1] - lsls r0, 1 - add r0, r9 - ldrh r0, [r0] - muls r0, r7 - adds r0, r5 - adds r1, r6, 0 - adds r1, 0xD - bl GetMonData - strh r0, [r4] - mov r2, r8 - ldrb r0, [r2] - lsls r0, 1 - add r0, r9 - ldrh r0, [r0] - muls r0, r7 - adds r0, r5 - adds r1, r6, 0 - adds r1, 0x11 - bl GetMonData - mov r3, r10 - adds r1, r3, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08058332 - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - ldr r5, [sp, 0x1C] - strb r0, [r5] - movs r6, 0 - movs r5, 0x3 - ldr r4, [sp, 0x1C] -_08058392: - mov r0, sp - adds r3, r0, r6 - lsls r2, r6, 1 - adds r1, r5, 0 - lsls r1, r2 - ldrb r0, [r4] - ands r0, r1 - asrs r0, r2 - strb r0, [r3] - adds r6, 0x1 - cmp r6, 0x3 - ble _08058392 - ldr r4, =gMoveSelectionCursor - ldr r3, =gActiveBank - ldrb r0, [r3] - adds r0, r4 - ldrb r1, [r0] - lsls r1, 1 - ldr r2, [sp, 0x20] - adds r1, r2, r1 - ldrh r6, [r1] - ldr r2, =gUnknown_03005D74 - ldrb r0, [r2] - lsls r0, 1 - ldr r5, [sp, 0x20] - adds r0, r5, r0 - ldrh r0, [r0] - movs r5, 0 - strh r0, [r1] - ldrb r0, [r2] - lsls r0, 1 - ldr r1, [sp, 0x20] - adds r0, r1, r0 - strh r6, [r0] - ldrb r0, [r3] - adds r0, r4 - ldrb r1, [r0] - add r1, r10 - ldrb r6, [r1] - ldrb r0, [r2] - add r0, r10 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r2] - add r0, r10 - strb r6, [r0] - ldrb r0, [r3] - adds r0, r4 - ldrb r0, [r0] - add r0, sp - ldrb r0, [r0] - ldr r1, [sp, 0x1C] - strb r0, [r1] - ldrb r0, [r3] - adds r0, r4 - ldrb r0, [r0] - mov r3, sp - adds r1, r3, r0 - ldrb r0, [r2] - add r0, sp - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r2] - adds r1, r3, r0 - ldr r2, [sp, 0x1C] - ldrb r0, [r2] - strb r0, [r1] - strb r5, [r2] - movs r6, 0 - ldr r2, [sp, 0x1C] -_0805841E: - mov r3, sp - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r6, 1 - lsls r1, r0 - ldrb r0, [r2] - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805841E - movs r6, 0 - ldr r5, =gBattlePartyID - mov r10, r5 - ldr r0, =gActiveBank - mov r9, r0 - movs r1, 0x64 - mov r8, r1 - ldr r7, =gPlayerParty - ldr r5, [sp, 0x20] - adds r5, 0x8 - ldr r4, [sp, 0x20] -_0805844A: - mov r2, r9 - ldrb r0, [r2] - lsls r0, 1 - add r0, r10 - ldrh r0, [r0] - mov r3, r8 - muls r3, r0 - adds r0, r3, 0 - adds r0, r7 - adds r1, r6, 0 - adds r1, 0xD - adds r2, r4, 0 - bl SetMonData - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - add r0, r10 - ldrh r0, [r0] - mov r2, r8 - muls r2, r0 - adds r0, r2, 0 - adds r0, r7 - adds r1, r6, 0 - adds r1, 0x11 - adds r2, r5, 0 - bl SetMonData - adds r5, 0x1 - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _0805844A - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - ldr r2, [sp, 0x1C] - bl SetMonData -_080584A8: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057BFC - str r1, [r0] - ldr r3, =gMoveSelectionCursor - ldrb r0, [r2] - adds r0, r3 - ldr r1, =gUnknown_03005D74 - ldrb r1, [r1] - strb r1, [r0] - ldrb r0, [r2] - adds r0, r3 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 - b _08058532 - .pool -_08058500: - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - beq _08058554 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - bl battle_menu_cursor_related - ldr r1, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057BFC - str r1, [r0] -_08058532: - bl sub_8059B18 - bl sub_8059B3C - bl sub_8059BB0 - b _080586E8 - .pool -_08058554: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080585A4 - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - bne _0805856A - b _080586E8 -_0805856A: - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r5, [r1] - cmp r2, r5 - bne _08058590 -_08058578: - ldrb r0, [r1] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - b _08058596 - .pool -_08058590: - ldrb r0, [r3] - bl battle_menu_cursor_related -_08058596: - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - movs r1, 0x1 - b _0805862C - .pool -_080585A4: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080585E8 - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _080585BA - b _080586E8 -_080585BA: - ldr r1, =gUnknown_03005D78 - movs r0, 0x1 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcc _080585C8 - b _080586E8 -_080585C8: - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r0, [r1] - cmp r2, r0 - beq _08058578 - b _08058590 - .pool -_080585E8: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0805865C - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - beq _080586E8 - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r5, [r1] - cmp r2, r5 - bne _08058620 - ldrb r0, [r1] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - b _08058626 - .pool -_08058620: - ldrb r0, [r3] - bl battle_menu_cursor_related -_08058626: - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - movs r1, 0x2 -_0805862C: - eors r0, r1 - strb r0, [r4] - movs r0, 0x5 - bl PlaySE - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r4] - ldrb r0, [r0] - cmp r1, r0 - beq _080586CA - ldrb r0, [r4] - movs r1, 0x1B - bl battle_menu_cursor_related_2 - b _080586E8 - .pool -_0805865C: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080586E8 - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _080586E8 - ldr r1, =gUnknown_03005D78 - movs r0, 0x2 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _080586E8 - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r0, [r1] - cmp r2, r0 - bne _080586A4 - ldrb r0, [r1] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - b _080586AA - .pool -_080586A4: - ldrb r0, [r3] - bl battle_menu_cursor_related -_080586AA: - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - movs r1, 0x2 - eors r0, r1 - strb r0, [r4] - movs r0, 0x5 - bl PlaySE - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r4] - ldrb r0, [r0] - cmp r1, r0 - bne _080586E0 -_080586CA: - adds r0, r1, 0 - movs r1, 0 - bl battle_menu_cursor_related_2 - b _080586E8 - .pool -_080586E0: - ldrb r0, [r4] - movs r1, 0x1B - bl battle_menu_cursor_related_2 -_080586E8: - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8058138 - - thumb_func_start sub_80586F8 -sub_80586F8: @ 80586F8 - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _0805875C - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08058798 - movs r0, 0x5A - bl m4aSongNumStop - ldr r3, =gMain - ldr r0, =0x00000439 - adds r2, r3, r0 - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r3] - ldr r0, =sub_8038D64 - bl SetMainCallback2 - ldr r0, =gBattleOutcome - ldrb r0, [r0] - cmp r0, 0x1 - bne _08058738 - bl sub_817E3F4 -_08058738: - bl FreeAllWindowBuffers - b _08058798 - .pool -_0805875C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08058798 - movs r0, 0x5A - bl m4aSongNumStop - ldr r3, =gMain - ldr r0, =0x00000439 - adds r2, r3, r0 - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r3] - ldr r0, =sub_8038D64 - bl SetMainCallback2 - ldr r0, =gBattleOutcome - ldrb r0, [r0] - cmp r0, 0x1 - bne _08058794 - bl sub_817E3F4 -_08058794: - bl FreeAllWindowBuffers -_08058798: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80586F8 - - thumb_func_start sub_80587B0 -sub_80587B0: @ 80587B0 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08058832 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08058810 - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08058832 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _080587F0 - bl sub_800AC34 - b _080587F4 - .pool -_080587F0: - bl sub_800ADF8 -_080587F4: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80586F8 - str r1, [r0] - b _08058832 - .pool -_08058810: - movs r0, 0x5A - bl m4aSongNumStop - ldr r2, =gMain - ldr r0, =0x00000439 - adds r3, r2, r0 - ldrb r1, [r3] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r2] - ldr r0, [r2, 0x8] - bl SetMainCallback2 -_08058832: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80587B0 - - thumb_func_start sub_8058844 -sub_8058844: @ 8058844 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08058868 - bl PlayerBufferExecCompleted -_08058868: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058844 - - thumb_func_start sub_805887C -sub_805887C: @ 805887C - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _080588A0 - bl PlayerBufferExecCompleted -_080588A0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805887C - - thumb_func_start bx_802F7A0 -bx_802F7A0: @ 80588B4 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08058908 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bl nullsub_25 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - bl PlayerBufferExecCompleted -_08058908: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_802F7A0 - - thumb_func_start sub_8058924 -sub_8058924: @ 8058924 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _0805895C - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl PlayerBufferExecCompleted -_0805895C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058924 - - thumb_func_start sub_805896C -sub_805896C: @ 805896C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r7, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058998 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _080589D0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080589D0 -_08058998: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r3, =gActiveBank - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - mov r10, r3 - cmp r1, r0 - bne _08058A0A - b _08058A0E - .pool -_080589D0: - ldr r3, =gSprites - ldr r6, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r4, [r2] - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r3, 0 - adds r5, 0x1C - adds r0, r5 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - mov r10, r2 - cmp r3, r0 - bne _08058A0A - movs r0, 0x2 - eors r4, r0 - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r3 - bne _08058A0A - movs r7, 0x1 -_08058A0A: - cmp r7, 0 - beq _08058B08 -_08058A0E: - ldr r0, =gBattleSpritesDataPtr - mov r9, r0 - ldr r0, [r0] - mov r6, r10 - ldrb r2, [r6] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4, 0x1] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08058B08 - movs r1, 0x2 - mov r8, r1 - mov r1, r8 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08058B08 - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r2, r9 - ldr r0, [r2] - ldrb r2, [r6] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - mov r0, r9 - ldr r2, [r0] - ldrb r0, [r6] - mov r1, r8 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - mov r1, r9 - ldr r2, [r1] - ldrb r0, [r6] - mov r1, r8 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r7, =gBattlePartyID - ldrb r1, [r6] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl sub_805E990 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058AE4 - ldrb r0, [r6] - mov r1, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - bl sub_805E990 -_08058AE4: - mov r2, r9 - ldr r0, [r2] - mov r2, r10 - ldrb r1, [r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - mov r2, r10 - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058924 - str r1, [r0] -_08058B08: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805896C - - thumb_func_start sub_8058B40 -sub_8058B40: @ 8058B40 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r0, 0 - mov r9, r0 - mov r8, r0 - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r7, =gActiveBank - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r5, 0x88 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058B80 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08058B80: - ldr r1, [r4] - ldrb r0, [r7] - movs r6, 0x2 - adds r2, r6, 0 - eors r2, r0 - ldr r1, [r1, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058BB2 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08058BB2: - ldr r0, [r4] - ldrb r2, [r7] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4] - movs r5, 0x8 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058C82 - adds r1, r6, 0 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058C82 - ldrb r1, [r4, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08058C68 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058C38 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08058C38 - ldr r4, =gHealthBoxesIds - ldrb r0, [r7] - adds r1, r6, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - eors r0, r6 - bl sub_8076918 - ldrb r0, [r7] - eors r0, r6 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08058C38: - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08058C68: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x1] -_08058C82: - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - bne _08058D32 - movs r1, 0x2 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08058D32 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08058D32 - ldr r0, [r5] - ldrb r1, [r4] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08058D14 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08058D08 - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _08058D14 - .pool -_08058D08: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_08058D14: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x20 - orrs r1, r2 - strb r1, [r0, 0x1] - movs r0, 0x1 - mov r9, r0 -_08058D32: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058D52 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058DAC - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08058DAC -_08058D52: - ldr r2, =gSprites - ldr r0, =gUnknown_03005D7C - ldr r1, =gActiveBank - ldrb r4, [r1] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _08058E0A - ldr r0, =gBankSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r3 - bne _08058E0A - b _08058E06 - .pool -_08058DAC: - ldr r2, =gSprites - ldr r7, =gUnknown_03005D7C - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _08058E0A - ldr r6, =gBankSpriteIds - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r5, [r0] - cmp r5, r4 - bne _08058E0A - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r4, [r0] - cmp r4, r5 - bne _08058E0A - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08058E0A -_08058E06: - movs r0, 0x1 - mov r8, r0 -_08058E0A: - mov r0, r9 - cmp r0, 0 - beq _08058EAA - mov r0, r8 - cmp r0, 0 - beq _08058EAA - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058E48 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08058E48 - ldr r2, =gUnknown_03005D7C - ldr r0, =gActiveBank - ldrb r1, [r0] - movs r0, 0x2 - eors r0, r1 - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite -_08058E48: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805896C - str r1, [r0] -_08058EAA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058B40 - - thumb_func_start sub_8058EDC -sub_8058EDC: @ 8058EDC - push {r4-r6,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r6, =gActiveBank - ldrb r3, [r6] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _08058F94 - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08058F94 - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08058F94 - adds r0, r3, 0 - bl sub_805E408 - ldr r0, [r5] - ldrb r2, [r6] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1] - ldr r0, [r5] - ldrb r2, [r6] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r0, [r5] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08058F88 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_08058F88: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8058FC0 - str r0, [r1] -_08058F94: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058EDC - - thumb_func_start sub_8058FC0 -sub_8058FC0: @ 8058FC0 - push {r4,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r4, =gActiveBank - ldrb r1, [r4] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805900E - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0805900E - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - ldr r2, =gBattlePartyID - ldrb r1, [r4] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl PlayerBufferExecCompleted -_0805900E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058FC0 - - thumb_func_start sub_805902C -sub_805902C: @ 805902C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _0805905E - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0805905E: - ldr r4, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r5] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _080590D2 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _080590D2 - adds r0, r3, r4 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r1, [r5] - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r5] - bl sub_8076918 - ldrb r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058EDC - str r1, [r0] -_080590D2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805902C - - thumb_func_start c3_0802FDF4 -c3_0802FDF4: @ 8059100 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08059122 - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - adds r0, r4, 0 - bl DestroyTask -_08059122: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end c3_0802FDF4 - - thumb_func_start bx_t1_healthbar_update -bx_t1_healthbar_update: @ 8059130 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r6, =gHealthBoxesIds - adds r1, r0, r6 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08059178 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08059192 - .pool -_08059178: - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl PlayerBufferExecCompleted -_08059192: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_t1_healthbar_update - - thumb_func_start sub_80591A0 -sub_80591A0: @ 80591A0 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080591B2 - bl PlayerBufferExecCompleted -_080591B2: - pop {r0} - bx r0 - thumb_func_end sub_80591A0 - - thumb_func_start sub_80591B8 -sub_80591B8: @ 80591B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - mov r8, r0 - ldrb r0, [r0, 0x8] - mov r10, r0 - mov r1, r8 - ldrb r7, [r1, 0xC] - str r7, [sp, 0x8] - ldrh r2, [r1, 0xA] - str r2, [sp, 0xC] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080591FE - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r10, r0 - bne _080591FE - b _08059314 -_080591FE: - movs r0, 0x64 - mov r1, r10 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x4] - ldr r3, =gExperienceTables - adds r4, 0x1 - lsls r4, 2 - ldr r2, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x13] - movs r1, 0xCA - lsls r1, 1 - muls r1, r2 - adds r4, r1 - adds r4, r3 - ldr r2, [r4] - str r2, [sp] - ldr r3, [sp, 0xC] - lsls r1, r3, 16 - asrs r1, 16 - adds r0, r1 - cmp r0, r2 - bcc _080592EC - adds r0, r6, 0 - movs r1, 0x19 - mov r2, sp - bl SetMonData - adds r0, r6, 0 - bl CalculateMonStats - ldr r2, [sp] - add r0, sp, 0x4 - ldrh r0, [r0] - subs r2, r0 - ldr r0, [sp, 0xC] - subs r2, r0, r2 - ldr r4, =gActiveBank - ldrb r5, [r4] - strb r7, [r4] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xB - bl EmitCmd33 - strb r5, [r4] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080592D4 - ldr r2, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r2 - mov r1, r10 - ldrh r0, [r0] - cmp r1, r0 - beq _080592B2 - movs r0, 0x2 - eors r7, r0 - lsls r0, r7, 1 - adds r0, r2 - ldrh r0, [r0] - cmp r1, r0 - bne _080592D4 -_080592B2: - ldr r0, =sub_8059544 - b _08059316 - .pool -_080592D4: - ldr r0, =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_805965C - b _08059318 - .pool -_080592EC: - str r0, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r6, 0 - movs r1, 0x19 - bl SetMonData - ldr r1, =gBattleBankFunc - ldr r3, [sp, 0x8] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, =sub_80591A0 - str r1, [r0] - mov r0, r9 - bl DestroyTask - b _0805931A - .pool -_08059314: - ldr r0, =sub_8059330 -_08059316: - mov r1, r8 -_08059318: - str r0, [r1] -_0805931A: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80591B8 - - thumb_func_start sub_8059330 -sub_8059330: @ 8059330 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r2, r0, 2 - mov r8, r2 - add r8, r0 - mov r0, r8 - lsls r0, 3 - mov r8, r0 - add r8, r1 - mov r2, r8 - ldrb r1, [r2, 0x8] - movs r0, 0xA - ldrsh r2, [r2, r0] - mov r9, r2 - mov r2, r8 - ldrb r2, [r2, 0xC] - mov r10, r2 - movs r0, 0x64 - adds r6, r1, 0 - muls r6, r0 - ldr r0, =gPlayerParty - adds r6, r0 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r6, 0 - movs r1, 0x19 - bl GetMonData - adds r3, r0, 0 - ldr r6, =gExperienceTables - lsls r1, r4, 2 - ldr r2, =gBaseStats - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - adds r0, r2 - ldrb r2, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r2 - adds r1, r0 - adds r1, r6 - ldr r1, [r1] - subs r3, r1 - adds r4, 0x1 - lsls r4, 2 - adds r4, r0 - adds r4, r6 - ldr r2, [r4] - subs r2, r1 - ldr r0, =gHealthBoxesIds - add r0, r10 - ldrb r1, [r0] - mov r0, r9 - negs r0, r0 - str r0, [sp] - mov r0, r10 - bl SetBattleBarStruct - movs r0, 0x21 - bl PlaySE - ldr r0, =sub_8059400 - mov r1, r8 - str r0, [r1] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059330 - - thumb_func_start sub_8059400 -sub_8059400: @ 8059400 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r6, r0, r1 - ldrh r1, [r6, 0x1C] - movs r2, 0x1C - ldrsh r0, [r6, r2] - cmp r0, 0xC - bgt _08059430 - adds r0, r1, 0x1 - strh r0, [r6, 0x1C] - b _0805952C - .pool -_08059430: - ldrb r0, [r6, 0x8] - mov r9, r0 - ldrh r2, [r6, 0xA] - mov r10, r2 - ldrb r7, [r6, 0xC] - ldr r5, =gHealthBoxesIds - adds r5, r7, r5 - ldrb r1, [r5] - adds r0, r7, 0 - movs r2, 0x1 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - bne _0805952C - movs r0, 0x21 - bl m4aSongNumStop - movs r0, 0x64 - mov r1, r9 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r3, =gExperienceTables - adds r4, 0x1 - lsls r4, 2 - ldr r2, =gBaseStats - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r1 - adds r4, r0 - adds r4, r3 - ldr r1, [r4] - str r1, [sp] - mov r2, r10 - lsls r0, r2, 16 - asrs r4, r0, 16 - ldr r0, [sp, 0x4] - adds r0, r4 - cmp r0, r1 - blt _08059510 - adds r0, r5, 0 - movs r1, 0x19 - mov r2, sp - bl SetMonData - adds r0, r5, 0 - bl CalculateMonStats - ldr r2, [sp] - add r0, sp, 0x4 - ldrh r0, [r0] - subs r2, r0 - subs r2, r4, r2 - ldr r4, =gActiveBank - ldrb r5, [r4] - strb r7, [r4] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xB - bl EmitCmd33 - strb r5, [r4] - ldr r0, =sub_8059544 - str r0, [r6] - b _0805952C - .pool -_08059510: - str r0, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r5, 0 - movs r1, 0x19 - bl SetMonData - ldr r1, =gBattleBankFunc - lsls r0, r7, 2 - adds r0, r1 - ldr r1, =sub_80591A0 - str r1, [r0] - mov r0, r8 - bl DestroyTask -_0805952C: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059400 - - thumb_func_start sub_8059544 -sub_8059544: @ 8059544 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldrb r4, [r0, 0xC] - ldrb r6, [r0, 0x8] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08059578 - ldr r1, =gBattlePartyID - movs r0, 0x2 - adds r2, r4, 0 - eors r2, r0 - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r6, r0 - bne _08059578 - adds r4, r2, 0 -_08059578: - adds r0, r4, 0 - adds r1, r4, 0 - adds r2, r4, 0 - movs r3, 0 - bl move_anim_start_t4 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80595A4 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059544 - - thumb_func_start sub_80595A4 -sub_80595A4: @ 80595A4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r2, r0, r1 - ldrb r5, [r2, 0xC] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08059646 - ldrb r4, [r2, 0x8] - movs r0, 0x64 - adds r1, r4, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0x38 - bl GetMonData - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08059624 - ldr r1, =gBattlePartyID - movs r0, 0x2 - adds r2, r5, 0 - eors r2, r0 - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - bne _08059624 - ldr r0, =gHealthBoxesIds - adds r0, r2, r0 - ldrb r0, [r0] - adds r1, r7, 0 - movs r2, 0 - bl UpdateHealthboxAttribute - b _08059638 - .pool -_08059624: - ldr r0, =gHealthBoxesIds - adds r0, r5, r0 - ldrb r0, [r0] - movs r1, 0x64 - muls r1, r4 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute -_08059638: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_805965C - str r0, [r1] -_08059646: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80595A4 - - thumb_func_start sub_805965C -sub_805965C: @ 805965C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - ldrb r1, [r4, 0x8] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - bl GetMonData - ldrb r0, [r4, 0xC] - ldr r1, =gBattleBankFunc - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80591A0 - str r1, [r0] - adds r0, r5, 0 - bl DestroyTask - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805965C - - thumb_func_start sub_80596A8 -sub_80596A8: @ 80596A8 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r2, [r4] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r3, 0x22 - ldrsh r1, [r0, r3] - movs r3, 0x26 - ldrsh r0, [r0, r3] - adds r1, r0 - cmp r1, 0xA0 - ble _08059724 - ldr r1, =gBattlePartyID - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl nullsub_24 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerBufferExecCompleted -_08059724: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80596A8 - - thumb_func_start sub_8059744 -sub_8059744: @ 8059744 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08059798 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerBufferExecCompleted -_08059798: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059744 - - thumb_func_start sub_80597B4 -sub_80597B4: @ 80597B4 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080597C6 - bl PlayerBufferExecCompleted -_080597C6: - pop {r0} - bx r0 - thumb_func_end sub_80597B4 - - thumb_func_start sub_80597CC -sub_80597CC: @ 80597CC - push {r4,lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0805980A - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059828 - str r1, [r0] - ldr r3, =gTasks - ldr r1, =gUnknown_03005D7C - ldrb r0, [r2] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r3 - ldrb r4, [r1, 0x8] - bl DestroyTask - bl FreeAllWindowBuffers - adds r0, r4, 0 - bl sub_81B89AC -_0805980A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80597CC - - thumb_func_start sub_8059828 -sub_8059828: @ 8059828 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _08059898 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08059898 - ldr r0, =gUnknown_0203CEE8 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08059870 - ldr r0, =gUnknown_0203CEE9 - ldrb r1, [r0] - ldr r2, =gUnknown_0203CF00 - movs r0, 0x1 - bl EmitCmd34 - b _0805987A - .pool -_08059870: - movs r0, 0x1 - movs r1, 0x6 - movs r2, 0 - bl EmitCmd34 -_0805987A: - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _08059894 - bl b_link_standby_message -_08059894: - bl PlayerBufferExecCompleted -_08059898: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059828 - - thumb_func_start sub_80598A4 -sub_80598A4: @ 80598A4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080598CC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80598E0 - str r1, [r0] - bl nullsub_35 - bl FreeAllWindowBuffers - bl sub_81AABB0 -_080598CC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80598A4 - - thumb_func_start sub_80598E0 -sub_80598E0: @ 80598E0 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _08059906 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08059906 - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitCmd35 - bl PlayerBufferExecCompleted -_08059906: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80598E0 - - thumb_func_start bx_wait_t1 -bx_wait_t1: @ 805991C - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - beq _08059942 - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08059946 -_08059942: - bl PlayerBufferExecCompleted -_08059946: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t1 - - thumb_func_start bx_blink_t1 -bx_blink_t1: @ 8059958 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _080599A4 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl PlayerBufferExecCompleted - b _080599CE - .pool -_080599A4: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _080599C8 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_080599C8: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_080599CE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t1 - - thumb_func_start sub_80599D4 -sub_80599D4: @ 80599D4 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08059A02 - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - cmp r0, 0 - beq _08059A02 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - bl BattleDestroyCursorAt - movs r0, 0 - strb r0, [r4] - movs r0, 0 - bl BattleCreateCursorAt -_08059A02: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08059A2C - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - cmp r0, 0 - bne _08059A2C - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - bl BattleDestroyCursorAt - movs r0, 0x1 - strb r0, [r4] - movs r0, 0x1 - bl BattleCreateCursorAt -_08059A2C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08059A7A - str r2, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - cmp r0, 0 - beq _08059A6C - movs r0, 0x1 - movs r1, 0xE - movs r2, 0 - bl EmitCmd33 - b _08059A76 - .pool -_08059A6C: - movs r0, 0x1 - movs r1, 0xD - movs r2, 0 - bl EmitCmd33 -_08059A76: - bl PlayerBufferExecCompleted -_08059A7A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08059AA0 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - bl PlayerBufferExecCompleted -_08059AA0: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80599D4 - - thumb_func_start sub_8059AAC -sub_8059AAC: @ 8059AAC - push {r4-r7,lr} - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 9 - ldr r3, =gBattleBufferA + 4 - ldr r2, =gUnknown_03005D78 - movs r0, 0 - strb r0, [r2] - movs r5, 0 - ldr r7, =gDisplayedStringBattle - adds r4, r1, r3 - adds r6, r2, 0 -_08059AC4: - lsls r0, r5, 24 - lsrs r0, 24 - bl battle_menu_cursor_related - ldrh r1, [r4] - movs r0, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r7, 0 - bl StringCopy - adds r1, r5, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r7, 0 - bl sub_814F9EC - ldrh r0, [r4] - cmp r0, 0 - beq _08059AF4 - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_08059AF4: - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _08059AC4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059AAC - - thumb_func_start sub_8059B18 -sub_8059B18: @ 8059B18 - push {r4,lr} - ldr r4, =gDisplayedStringBattle - ldr r1, =gText_MoveInterfacePP - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - movs r1, 0x7 - bl sub_814F9EC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059B18 - - thumb_func_start sub_8059B3C -sub_8059B3C: @ 8059B3C - push {r4-r7,lr} - ldr r5, =gBattleBufferA - ldr r7, =gActiveBank - ldrb r0, [r7] - lsls r0, 9 - adds r1, r5, 0x2 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08059B98 - bl SetPpNumbersPaletteInMoveSelection - ldrb r1, [r7] - lsls r4, r1, 9 - adds r0, r5, 0x4 - adds r4, r0 - ldr r6, =gDisplayedStringBattle - ldr r5, =gMoveSelectionCursor - adds r1, r5 - adds r0, r4, 0 - adds r0, 0x8 - ldrb r1, [r1] - adds r0, r1 - ldrb r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r1, 0xBA - strb r1, [r0] - adds r0, 0x1 - ldrb r1, [r7] - adds r1, r5 - adds r4, 0xC - ldrb r1, [r1] - adds r4, r1 - ldrb r1, [r4] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - movs r1, 0x9 - bl sub_814F9EC -_08059B98: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059B3C - - thumb_func_start sub_8059BB0 -sub_8059BB0: @ 8059BB0 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 4 - adds r4, r0 - ldr r6, =gDisplayedStringBattle - ldr r1, =gText_MoveInterfaceType - adds r0, r6, 0 - bl StringCopy - movs r1, 0xFC - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x6 - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x1 - strb r1, [r0] - adds r0, 0x1 - ldr r3, =gBattleMoves - ldr r2, =gMoveSelectionCursor - ldrb r1, [r5] - adds r1, r2 - ldrb r1, [r1] - lsls r1, 1 - adds r4, r1 - ldrh r2, [r4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r1, 0x2] - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - adds r0, r6, 0 - movs r1, 0xA - bl sub_814F9EC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059BB0 - - thumb_func_start battle_menu_cursor_related_2 -battle_menu_cursor_related_2: @ 8059C28 - push {lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - lsls r1, 24 - lsrs r1, 24 - add r2, sp, 0xC - adds r0, r1, 0x1 - strh r0, [r2] - adds r0, r2, 0 - adds r1, 0x2 - strh r1, [r0, 0x2] - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - lsls r2, r0, 3 - adds r2, r0 - adds r2, 0x1 - movs r0, 0x2 - ands r3, r0 - adds r3, 0x37 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r0} - bx r0 - thumb_func_end battle_menu_cursor_related_2 - - thumb_func_start battle_menu_cursor_related -battle_menu_cursor_related: @ 8059C70 - push {lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - ldr r1, =0x00001016 - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - lsls r2, r0, 3 - adds r2, r0 - adds r2, 0x1 - movs r0, 0x2 - ands r3, r0 - adds r3, 0x37 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end battle_menu_cursor_related - - thumb_func_start ActionSelectionCreateCursorAt -ActionSelectionCreateCursorAt: @ 8059CB4 - push {r4,lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - movs r4, 0x1 - strh r4, [r0] - movs r1, 0x2 - strh r1, [r0, 0x2] - adds r0, r3, 0 - ands r0, r4 - lsls r2, r0, 3 - subs r2, r0 - adds r2, 0x10 - lsls r2, 24 - lsrs r2, 24 - ands r3, r1 - adds r3, 0x23 - str r4, [sp] - str r1, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - thumb_func_end ActionSelectionCreateCursorAt - - thumb_func_start ActionSelectionDestroyCursorAt -ActionSelectionDestroyCursorAt: @ 8059CF8 - push {lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - ldr r1, =0x00001016 - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - lsls r2, r0, 3 - subs r2, r0 - adds r2, 0x10 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x2 - ands r3, r0 - adds r3, 0x23 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end ActionSelectionDestroyCursorAt - - thumb_func_start sub_8059D40 -sub_8059D40: @ 8059D40 - push {lr} - ldr r0, =ReshowBattleScreenAfterMenu - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059D40 - - thumb_func_start sub_8059D50 -sub_8059D50: @ 8059D50 - push {lr} - ldr r0, =ReshowBattleScreenAfterMenu - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059D50 - - thumb_func_start sub_8059D60 -sub_8059D60: @ 8059D60 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _08059D82 - bl PlayerBufferExecCompleted -_08059D82: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059D60 - - thumb_func_start bx_8030B2C -bx_8030B2C: @ 8059D90 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08059DB2 - bl PlayerBufferExecCompleted -_08059DB2: - pop {r0} - bx r0 - .pool - thumb_func_end bx_8030B2C - - thumb_func_start b_link_standby_message -b_link_standby_message: @ 8059DC0 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08059DE0 - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gText_LinkStandby - movs r1, 0 - bl sub_814F9EC -_08059DE0: - pop {r0} - bx r0 - .pool - thumb_func_end b_link_standby_message - - thumb_func_start dp01t_00_1_getattr -dp01t_00_1_getattr: @ 8059DF4 + thumb_func_start PlayerHandleGetMonData +PlayerHandleGetMonData: @ 8059DF4 push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -4778,7 +61,7 @@ _08059E4E: pop {r4-r6} pop {r0} bx r0 - thumb_func_end dp01t_00_1_getattr + thumb_func_end PlayerHandleGetMonData thumb_func_start dp01_getattr_by_ch1_for_player_pokemon_ dp01_getattr_by_ch1_for_player_pokemon_: @ 8059E68 @@ -5658,8 +941,8 @@ _0805A5FE: .pool thumb_func_end dp01_getattr_by_ch1_for_player_pokemon_ - thumb_func_start sub_805A614 -sub_805A614: @ 805A614 + thumb_func_start PlayerHandleGetRawMonData +PlayerHandleGetRawMonData: @ 805A614 push {r4-r7,lr} sub sp, 0x58 ldr r2, =gBattlePartyID @@ -5720,10 +1003,10 @@ _0805A66A: pop {r0} bx r0 .pool - thumb_func_end sub_805A614 + thumb_func_end PlayerHandleGetRawMonData - thumb_func_start dp01t_02_1_setattr -dp01t_02_1_setattr: @ 805A69C + thumb_func_start PlayerHandleSetMonData +PlayerHandleSetMonData: @ 805A69C push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5763,7 +1046,7 @@ _0805A6EA: pop {r4,r5} pop {r0} bx r0 - thumb_func_end dp01t_02_1_setattr + thumb_func_end PlayerHandleSetMonData thumb_func_start dp01_setattr_by_ch1_for_player_pokemon dp01_setattr_by_ch1_for_player_pokemon: @ 805A6F4 @@ -6798,8 +2081,8 @@ _0805B0BA: .pool thumb_func_end dp01_setattr_by_ch1_for_player_pokemon - thumb_func_start sub_805B0F0 -sub_805B0F0: @ 805B0F0 + thumb_func_start PlayerHandleSetRawMonData +PlayerHandleSetRawMonData: @ 805B0F0 push {r4-r7,lr} ldr r1, =gBattlePartyID ldr r7, =gActiveBank @@ -6851,10 +2134,10 @@ _0805B148: pop {r0} bx r0 .pool - thumb_func_end sub_805B0F0 + thumb_func_end PlayerHandleSetRawMonData - thumb_func_start sub_805B164 -sub_805B164: @ 805B164 + thumb_func_start PlayerHandleLoadMonSprite +PlayerHandleLoadMonSprite: @ 805B164 push {r4,lr} ldr r2, =gBattlePartyID ldr r4, =gActiveBank @@ -6886,16 +2169,16 @@ sub_805B164: @ 805B164 ldrb r0, [r4] lsls r0, 2 adds r0, r1 - ldr r1, =bx_0802E404 + ldr r1, =CompleteOnBankSpritePosX_0 str r1, [r0] pop {r4} pop {r0} bx r0 .pool - thumb_func_end sub_805B164 + thumb_func_end PlayerHandleLoadMonSprite - thumb_func_start sub_805B1CC -sub_805B1CC: @ 805B1CC + thumb_func_start PlayerHandleSwitchInAnim +PlayerHandleSwitchInAnim: @ 805B1CC push {r4-r6,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -6947,7 +2230,7 @@ sub_805B1CC: @ 805B1CC pop {r0} bx r0 .pool - thumb_func_end sub_805B1CC + thumb_func_end PlayerHandleSwitchInAnim thumb_func_start sub_805B258 sub_805B258: @ 805B258 @@ -7112,8 +2395,8 @@ sub_805B258: @ 805B258 .pool thumb_func_end sub_805B258 - thumb_func_start sub_805B3D4 -sub_805B3D4: @ 805B3D4 + thumb_func_start PlayerHandleReturnMonToBall +PlayerHandleReturnMonToBall: @ 805B3D4 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r6, =gActiveBank @@ -7169,7 +2452,7 @@ _0805B452: pop {r0} bx r0 .pool - thumb_func_end sub_805B3D4 + thumb_func_end PlayerHandleReturnMonToBall thumb_func_start sub_805B464 sub_805B464: @ 805B464 @@ -7241,8 +2524,8 @@ _0805B4E2: .pool thumb_func_end sub_805B464 - thumb_func_start sub_805B4F0 -sub_805B4F0: @ 805B4F0 + thumb_func_start PlayerHandleDrawTrainerPic +PlayerHandleDrawTrainerPic: @ 805B4F0 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -7615,7 +2898,7 @@ _0805B82A: ldrb r0, [r0] lsls r0, 2 adds r0, r1 - ldr r1, =sub_8058844 + ldr r1, =CompleteOnBankSpriteCallbackDummy str r1, [r0] pop {r3,r4} mov r8, r3 @@ -7624,10 +2907,10 @@ _0805B82A: pop {r0} bx r0 .pool - thumb_func_end sub_805B4F0 + thumb_func_end PlayerHandleDrawTrainerPic - thumb_func_start dp01t_08_1_8032428 -dp01t_08_1_8032428: @ 805B864 + thumb_func_start PlayerHandleTrainerSlide +PlayerHandleTrainerSlide: @ 805B864 push {r4-r6,lr} ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -7797,16 +3080,16 @@ _0805B926: ldrb r0, [r5] lsls r0, 2 adds r0, r1 - ldr r1, =sub_805887C + ldr r1, =CompleteOnBankSpriteCallbackDummy2 str r1, [r0] pop {r4-r6} pop {r0} bx r0 .pool - thumb_func_end dp01t_08_1_8032428 + thumb_func_end PlayerHandleTrainerSlide - thumb_func_start sub_805B9F8 -sub_805B9F8: @ 805B9F8 + thumb_func_start PlayerHandleTrainerSlideBack +PlayerHandleTrainerSlideBack: @ 805B9F8 push {r4-r6,lr} ldr r5, =gBankSpriteIds ldr r6, =gActiveBank @@ -7879,16 +3162,16 @@ sub_805B9F8: @ 805B9F8 ldrb r0, [r6] lsls r0, 2 adds r0, r1 - ldr r1, =bx_802F7A0 + ldr r1, =sub_80588B4 str r1, [r0] pop {r4-r6} pop {r0} bx r0 .pool - thumb_func_end sub_805B9F8 + thumb_func_end PlayerHandleTrainerSlideBack - thumb_func_start sub_805BAB8 -sub_805BAB8: @ 805BAB8 + thumb_func_start PlayerHandleFaintAnimation +PlayerHandleFaintAnimation: @ 805BAB8 push {r4-r6,lr} ldr r6, =gBattleSpritesDataPtr ldr r4, [r6] @@ -7990,10 +3273,10 @@ _0805BB82: pop {r0} bx r0 .pool - thumb_func_end sub_805BAB8 + thumb_func_end PlayerHandleFaintAnimation - thumb_func_start sub_805BBA4 -sub_805BBA4: @ 805BBA4 + thumb_func_start PlayerHandleCmd11 +PlayerHandleCmd11: @ 805BBA4 push {lr} sub sp, 0x4 movs r0, 0x1 @@ -8008,10 +3291,10 @@ sub_805BBA4: @ 805BBA4 add sp, 0x4 pop {r0} bx r0 - thumb_func_end sub_805BBA4 + thumb_func_end PlayerHandleCmd11 - thumb_func_start sub_805BBC4 -sub_805BBC4: @ 805BBC4 + thumb_func_start PlayerHandleCmd12 +PlayerHandleCmd12: @ 805BBC4 push {r4,r5,lr} ldr r0, =gBattleSpritesDataPtr ldr r0, [r0] @@ -8036,16 +3319,16 @@ sub_805BBC4: @ 805BBC4 ldrb r0, [r5] lsls r0, 2 adds r0, r1 - ldr r1, =bx_wait_t1 + ldr r1, =sub_805991C str r1, [r0] pop {r4,r5} pop {r0} bx r0 .pool - thumb_func_end sub_805BBC4 + thumb_func_end PlayerHandleCmd12 - thumb_func_start sub_805BC18 -sub_805BC18: @ 805BC18 + thumb_func_start PlayerHandleBallThrow +PlayerHandleBallThrow: @ 805BC18 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r5, =gActiveBank @@ -8075,16 +3358,16 @@ sub_805BC18: @ 805BC18 ldrb r0, [r5] lsls r0, 2 adds r0, r1 - ldr r1, =bx_wait_t1 + ldr r1, =sub_805991C str r1, [r0] pop {r4,r5} pop {r0} bx r0 .pool - thumb_func_end sub_805BC18 + thumb_func_end PlayerHandleBallThrow - thumb_func_start sub_805BC78 -sub_805BC78: @ 805BC78 + thumb_func_start PlayerHandlePause +PlayerHandlePause: @ 805BC78 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -8106,10 +3389,10 @@ _0805BC96: pop {r0} bx r0 .pool - thumb_func_end sub_805BC78 + thumb_func_end PlayerHandlePause - thumb_func_start dp01t_0F_1_move_anim -dp01t_0F_1_move_anim: @ 805BCA8 + thumb_func_start PlayerHandleMoveAnimation +PlayerHandleMoveAnimation: @ 805BCA8 push {r4-r7,lr} mov r7, r8 push {r7} @@ -8255,7 +3538,7 @@ _0805BDE4: pop {r0} bx r0 .pool - thumb_func_end dp01t_0F_1_move_anim + thumb_func_end PlayerHandleMoveAnimation thumb_func_start bx_move_anim_1 bx_move_anim_1: @ 805BDFC @@ -8441,8 +3724,8 @@ _0805BF70: bx r0 thumb_func_end bx_move_anim_1 - thumb_func_start sub_805BF80 -sub_805BF80: @ 805BF80 + thumb_func_start PlayerHandlePrintString +PlayerHandlePrintString: @ 805BF80 push {r4,r5,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -8463,7 +3746,7 @@ sub_805BF80: @ 805BF80 ldrb r0, [r5] lsls r0, 2 adds r0, r1 - ldr r1, =sub_80597B4 + ldr r1, =CompleteOnInactiveTextPrinter2 str r1, [r0] ldrh r0, [r4] bl sub_817C95C @@ -8474,10 +3757,10 @@ sub_805BF80: @ 805BF80 pop {r0} bx r0 .pool - thumb_func_end sub_805BF80 + thumb_func_end PlayerHandlePrintString - thumb_func_start dp01t_11_1_message_for_player_only -dp01t_11_1_message_for_player_only: @ 805BFE0 + thumb_func_start PlayerHandlePrintStringPlayerOnly +PlayerHandlePrintStringPlayerOnly: @ 805BFE0 push {lr} ldr r0, =gActiveBank ldrb r0, [r0] @@ -8485,7 +3768,7 @@ dp01t_11_1_message_for_player_only: @ 805BFE0 lsls r0, 24 cmp r0, 0 bne _0805BFFC - bl sub_805BF80 + bl PlayerHandlePrintString b _0805C000 .pool _0805BFFC: @@ -8493,7 +3776,7 @@ _0805BFFC: _0805C000: pop {r0} bx r0 - thumb_func_end dp01t_11_1_message_for_player_only + thumb_func_end PlayerHandlePrintStringPlayerOnly thumb_func_start sub_805C004 sub_805C004: @ 805C004 @@ -8513,7 +3796,7 @@ sub_805C004: @ 805C004 ldrb r0, [r0] lsls r0, 2 adds r0, r1 - ldr r1, =sub_8057588 + ldr r1, =HandleInputChooseAction str r1, [r0] _0805C02A: pop {r0} @@ -8521,8 +3804,8 @@ _0805C02A: .pool thumb_func_end sub_805C004 - thumb_func_start dp01t_12_6_battle_menu -dp01t_12_6_battle_menu: @ 805C044 + thumb_func_start PlayerHandleChooseAction +PlayerHandleChooseAction: @ 805C044 push {r4,lr} ldr r1, =gBattleBankFunc ldr r0, =gActiveBank @@ -8559,10 +3842,10 @@ _0805C062: pop {r0} bx r0 .pool - thumb_func_end dp01t_12_6_battle_menu + thumb_func_end PlayerHandleChooseAction - thumb_func_start sub_805C0B0 -sub_805C0B0: @ 805C0B0 + thumb_func_start PlayerHandleCmd19 +PlayerHandleCmd19: @ 805C0B0 push {r4,lr} sub sp, 0x4 ldr r4, =gActiveBank @@ -8581,11 +3864,11 @@ sub_805C0B0: @ 805C0B0 ldr r0, =gText_BattleYesNoChoice movs r1, 0xC bl sub_814F9EC - ldr r1, =gUnknown_03005D74 + ldr r1, =gMultiUsePlayerCursor movs r0, 0x1 strb r0, [r1] movs r0, 0x1 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -8601,7 +3884,7 @@ _0805C10C: pop {r4} pop {r0} bx r0 - thumb_func_end sub_805C0B0 + thumb_func_end PlayerHandleCmd19 thumb_func_start sub_805C114 sub_805C114: @ 805C114 @@ -8623,7 +3906,7 @@ sub_805C114: @ 805C114 ldrb r0, [r0] lsls r0, 2 adds r0, r1 - ldr r1, =sub_8057BFC + ldr r1, =HandleInputChooseMove str r1, [r0] _0805C13E: pop {r0} @@ -8666,8 +3949,8 @@ _0805C194: .pool thumb_func_end sub_805C158 - thumb_func_start dp01t_14_5_move_menu_pokedude -dp01t_14_5_move_menu_pokedude: @ 805C1A8 + thumb_func_start PlayerHandleChooseMove +PlayerHandleChooseMove: @ 805C1A8 push {lr} ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -8706,13 +3989,13 @@ _0805C1FC: pop {r0} bx r0 .pool - thumb_func_end dp01t_14_5_move_menu_pokedude + thumb_func_end PlayerHandleChooseMove thumb_func_start sub_805C210 sub_805C210: @ 805C210 push {lr} - bl sub_8059AAC - ldr r1, =gUnknown_03005D74 + bl MoveSelectionDisplayMoveNames + ldr r1, =gMultiUsePlayerCursor movs r0, 0xFF strb r0, [r1] ldr r1, =gMoveSelectionCursor @@ -8721,17 +4004,17 @@ sub_805C210: @ 805C210 adds r0, r1 ldrb r0, [r0] movs r1, 0 - bl battle_menu_cursor_related_2 - bl sub_8059B18 - bl sub_8059B3C - bl sub_8059BB0 + bl MoveSelectionCreateCursorAt + bl MoveSelectionDisplayPpString + bl MoveSelectionDisplayPpNumber + bl MoveSelectionDisplayMoveType pop {r0} bx r0 .pool thumb_func_end sub_805C210 - thumb_func_start sub_805C248 -sub_805C248: @ 805C248 + thumb_func_start PlayerHandleOpenBag +PlayerHandleOpenBag: @ 805C248 push {r4,r5,lr} sub sp, 0x4 movs r0, 0x1 @@ -8771,10 +4054,10 @@ _0805C276: pop {r0} bx r0 .pool - thumb_func_end sub_805C248 + thumb_func_end PlayerHandleOpenBag - thumb_func_start sub_805C2AC -sub_805C2AC: @ 805C2AC + thumb_func_start PlayerHandleChoosePokemon +PlayerHandleChoosePokemon: @ 805C2AC push {r4-r7,lr} mov r7, r8 push {r7} @@ -8907,10 +4190,10 @@ _0805C3BC: pop {r0} bx r0 .pool - thumb_func_end sub_805C2AC + thumb_func_end PlayerHandleChoosePokemon - thumb_func_start sub_805C3EC -sub_805C3EC: @ 805C3EC + thumb_func_start PlayerHandleCmd23 +PlayerHandleCmd23: @ 805C3EC push {lr} sub sp, 0x4 bl BattleMusicStop @@ -8926,10 +4209,10 @@ sub_805C3EC: @ 805C3EC add sp, 0x4 pop {r0} bx r0 - thumb_func_end sub_805C3EC + thumb_func_end PlayerHandleCmd23 - thumb_func_start sub_805C410 -sub_805C410: @ 805C410 + thumb_func_start PlayerHandleHealthBarUpdate +PlayerHandleHealthBarUpdate: @ 805C410 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -9040,10 +4323,10 @@ _0805C4F2: pop {r0} bx r0 .pool - thumb_func_end sub_805C410 + thumb_func_end PlayerHandleHealthBarUpdate - thumb_func_start sub_805C528 -sub_805C528: @ 805C528 + thumb_func_start PlayerHandleExpUpdate +PlayerHandleExpUpdate: @ 805C528 push {r4-r7,lr} ldr r5, =gBattleBufferA ldr r6, =gActiveBank @@ -9106,10 +4389,10 @@ _0805C5AC: pop {r0} bx r0 .pool - thumb_func_end sub_805C528 + thumb_func_end PlayerHandleExpUpdate - thumb_func_start sub_805C5C4 -sub_805C5C4: @ 805C5C4 + thumb_func_start PlayerHandleStatusIconUpdate +PlayerHandleStatusIconUpdate: @ 805C5C4 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -9155,10 +4438,10 @@ _0805C618: pop {r0} bx r0 .pool - thumb_func_end sub_805C5C4 + thumb_func_end PlayerHandleStatusIconUpdate - thumb_func_start sub_805C63C -sub_805C63C: @ 805C63C + thumb_func_start PlayerHandleStatusAnimation +PlayerHandleStatusAnimation: @ 805C63C push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -9202,10 +4485,10 @@ _0805C68C: pop {r0} bx r0 .pool - thumb_func_end sub_805C63C + thumb_func_end PlayerHandleStatusAnimation - thumb_func_start sub_805C6A4 -sub_805C6A4: @ 805C6A4 + thumb_func_start PlayerHandleStatusXor +PlayerHandleStatusXor: @ 805C6A4 push {r4-r6,lr} mov r6, r8 push {r6} @@ -9249,18 +4532,18 @@ sub_805C6A4: @ 805C6A4 pop {r0} bx r0 .pool - thumb_func_end sub_805C6A4 + thumb_func_end PlayerHandleStatusXor - thumb_func_start sub_805C710 -sub_805C710: @ 805C710 + thumb_func_start PlayerHandleDataTransfer +PlayerHandleDataTransfer: @ 805C710 push {lr} bl PlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_805C710 + thumb_func_end PlayerHandleDataTransfer - thumb_func_start sub_805C71C -sub_805C71C: @ 805C71C + thumb_func_start PlayerHandleDMA3Transfer +PlayerHandleDMA3Transfer: @ 805C71C push {r4,r5,lr} ldr r3, =gBattleBufferA ldr r0, =gActiveBank @@ -9340,10 +4623,10 @@ _0805C7B8: pop {r0} bx r0 .pool - thumb_func_end sub_805C71C + thumb_func_end PlayerHandleDMA3Transfer - thumb_func_start sub_805C7D0 -sub_805C7D0: @ 805C7D0 + thumb_func_start PlayerHandlePlayBGM +PlayerHandlePlayBGM: @ 805C7D0 push {lr} ldr r2, =gBattleBufferA ldr r0, =gActiveBank @@ -9362,18 +4645,18 @@ sub_805C7D0: @ 805C7D0 pop {r0} bx r0 .pool - thumb_func_end sub_805C7D0 + thumb_func_end PlayerHandlePlayBGM - thumb_func_start sub_805C800 -sub_805C800: @ 805C800 + thumb_func_start PlayerHandleCmd32 +PlayerHandleCmd32: @ 805C800 push {lr} bl PlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_805C800 + thumb_func_end PlayerHandleCmd32 - thumb_func_start sub_805C80C -sub_805C80C: @ 805C80C + thumb_func_start PlayerHandleCmd33 +PlayerHandleCmd33: @ 805C80C push {lr} movs r0, 0x1 movs r1, 0 @@ -9382,10 +4665,10 @@ sub_805C80C: @ 805C80C bl PlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_805C80C + thumb_func_end PlayerHandleCmd33 - thumb_func_start sub_805C820 -sub_805C820: @ 805C820 + thumb_func_start PlayerHandleCmd34 +PlayerHandleCmd34: @ 805C820 push {lr} movs r0, 0x1 movs r1, 0 @@ -9394,10 +4677,10 @@ sub_805C820: @ 805C820 bl PlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_805C820 + thumb_func_end PlayerHandleCmd34 - thumb_func_start sub_805C834 -sub_805C834: @ 805C834 + thumb_func_start PlayerHandleCmd35 +PlayerHandleCmd35: @ 805C834 push {lr} movs r0, 0x1 movs r1, 0 @@ -9405,10 +4688,10 @@ sub_805C834: @ 805C834 bl PlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_805C834 + thumb_func_end PlayerHandleCmd35 - thumb_func_start sub_805C848 -sub_805C848: @ 805C848 + thumb_func_start PlayerHandleCmd36 +PlayerHandleCmd36: @ 805C848 push {lr} movs r0, 0x1 movs r1, 0 @@ -9416,10 +4699,10 @@ sub_805C848: @ 805C848 bl PlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_805C848 + thumb_func_end PlayerHandleCmd36 - thumb_func_start sub_805C85C -sub_805C85C: @ 805C85C + thumb_func_start PlayerHandleCmd37 +PlayerHandleCmd37: @ 805C85C push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -9431,10 +4714,10 @@ sub_805C85C: @ 805C85C pop {r0} bx r0 .pool - thumb_func_end sub_805C85C + thumb_func_end PlayerHandleCmd37 - thumb_func_start sub_805C878 -sub_805C878: @ 805C878 + thumb_func_start PlayerHandleCmd38 +PlayerHandleCmd38: @ 805C878 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, =gBattleBufferA @@ -9456,10 +4739,10 @@ sub_805C878: @ 805C878 pop {r0} bx r0 .pool - thumb_func_end sub_805C878 + thumb_func_end PlayerHandleCmd38 - thumb_func_start sub_805C8B0 -sub_805C8B0: @ 805C8B0 + thumb_func_start PlayerHandleCmd39 +PlayerHandleCmd39: @ 805C8B0 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -9470,10 +4753,10 @@ sub_805C8B0: @ 805C8B0 pop {r0} bx r0 .pool - thumb_func_end sub_805C8B0 + thumb_func_end PlayerHandleCmd39 - thumb_func_start sub_805C8C8 -sub_805C8C8: @ 805C8C8 + thumb_func_start PlayerHandleCmd40 +PlayerHandleCmd40: @ 805C8C8 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, [r3] @@ -9491,10 +4774,10 @@ sub_805C8C8: @ 805C8C8 pop {r0} bx r0 .pool - thumb_func_end sub_805C8C8 + thumb_func_end PlayerHandleCmd40 - thumb_func_start dp01t_29_1_blink -dp01t_29_1_blink: @ 805C8F0 + thumb_func_start PlayerHandleHitAnimation +PlayerHandleHitAnimation: @ 805C8F0 push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -9533,25 +4816,25 @@ _0805C924: ldrb r0, [r4] lsls r0, 2 adds r0, r1 - ldr r1, =bx_blink_t1 + ldr r1, =DoHitAnimBlinkEffect str r1, [r0] _0805C94E: pop {r4} pop {r0} bx r0 .pool - thumb_func_end dp01t_29_1_blink + thumb_func_end PlayerHandleHitAnimation - thumb_func_start sub_805C960 -sub_805C960: @ 805C960 + thumb_func_start PlayerHandleCmd42 +PlayerHandleCmd42: @ 805C960 push {lr} bl PlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_805C960 + thumb_func_end PlayerHandleCmd42 - thumb_func_start sub_805C96C -sub_805C96C: @ 805C96C + thumb_func_start PlayerHandleEffectivenessSound +PlayerHandleEffectivenessSound: @ 805C96C push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -9581,10 +4864,10 @@ _0805C980: pop {r0} bx r0 .pool - thumb_func_end sub_805C96C + thumb_func_end PlayerHandleEffectivenessSound - thumb_func_start sub_805C9B0 -sub_805C9B0: @ 805C9B0 + thumb_func_start PlayerHandlePlayFanfareOrBGM +PlayerHandlePlayFanfareOrBGM: @ 805C9B0 push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -9624,10 +4907,10 @@ _0805CA00: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_805C9B0 + thumb_func_end PlayerHandlePlayFanfareOrBGM - thumb_func_start sub_805CA0C -sub_805CA0C: @ 805CA0C + thumb_func_start PlayerHandleFaintingCry +PlayerHandleFaintingCry: @ 805CA0C push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -9651,10 +4934,10 @@ sub_805CA0C: @ 805CA0C pop {r0} bx r0 .pool - thumb_func_end sub_805CA0C + thumb_func_end PlayerHandleFaintingCry - thumb_func_start dp01t_2E_1_battle_intro -dp01t_2E_1_battle_intro: @ 805CA4C + thumb_func_start PlayerHandleIntroSlide +PlayerHandleIntroSlide: @ 805CA4C push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -9673,10 +4956,10 @@ dp01t_2E_1_battle_intro: @ 805CA4C pop {r0} bx r0 .pool - thumb_func_end dp01t_2E_1_battle_intro + thumb_func_end PlayerHandleIntroSlide - thumb_func_start dp01t_2F_1_pokemon_enter -dp01t_2F_1_pokemon_enter: @ 805CA80 + thumb_func_start PlayerHandleIntroTrainerBallThrow +PlayerHandleIntroTrainerBallThrow: @ 805CA80 push {r4-r7,lr} ldr r6, =gBankSpriteIds ldr r7, =gActiveBank @@ -9833,7 +5116,7 @@ _0805CBA2: pop {r0} bx r0 .pool - thumb_func_end dp01t_2F_1_pokemon_enter + thumb_func_end PlayerHandleIntroTrainerBallThrow thumb_func_start sub_805CC00 sub_805CC00: @ 805CC00 @@ -9994,8 +5277,8 @@ _0805CD50: .pool thumb_func_end task05_08033660 - thumb_func_start sub_805CD74 -sub_805CD74: @ 805CD74 + thumb_func_start PlayerHandleDrawPartyStatusSummary +PlayerHandleDrawPartyStatusSummary: @ 805CD74 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -10078,7 +5361,7 @@ _0805CE18: pop {r0} bx r0 .pool - thumb_func_end sub_805CD74 + thumb_func_end PlayerHandleDrawPartyStatusSummary thumb_func_start sub_805CE38 sub_805CE38: @ 805CE38 @@ -10116,8 +5399,8 @@ _0805CE70: .pool thumb_func_end sub_805CE38 - thumb_func_start sub_805CE80 -sub_805CE80: @ 805CE80 + thumb_func_start PlayerHandleCmd49 +PlayerHandleCmd49: @ 805CE80 push {lr} ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] @@ -10148,10 +5431,10 @@ _0805CEB2: pop {r0} bx r0 .pool - thumb_func_end sub_805CE80 + thumb_func_end PlayerHandleCmd49 - thumb_func_start sub_805CED0 -sub_805CED0: @ 805CED0 + thumb_func_start PlayerHandleCmd50 +PlayerHandleCmd50: @ 805CED0 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -10165,10 +5448,10 @@ sub_805CED0: @ 805CED0 pop {r0} bx r0 .pool - thumb_func_end sub_805CED0 + thumb_func_end PlayerHandleCmd50 - thumb_func_start dp01t_33_1_enemy_move -dp01t_33_1_enemy_move: @ 805CEF4 + thumb_func_start PlayerHandleSpriteInvisibility +PlayerHandleSpriteInvisibility: @ 805CEF4 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -10208,10 +5491,10 @@ _0805CF3A: pop {r0} bx r0 .pool - thumb_func_end dp01t_33_1_enemy_move + thumb_func_end PlayerHandleSpriteInvisibility - thumb_func_start sub_805CF54 -sub_805CF54: @ 805CF54 + thumb_func_start PlayerHandleBattleAnimation +PlayerHandleBattleAnimation: @ 805CF54 push {r4-r6,lr} sub sp, 0x4 ldr r5, =gActiveBank @@ -10250,7 +5533,7 @@ _0805CFA4: ldrb r1, [r5] lsls r1, 2 adds r1, r0 - ldr r0, =bx_8030B2C + ldr r0, =sub_8059D90 str r0, [r1] _0805CFB0: adds r0, r6, 0 @@ -10261,10 +5544,10 @@ _0805CFB6: pop {r0} bx r0 .pool - thumb_func_end sub_805CF54 + thumb_func_end PlayerHandleBattleAnimation - thumb_func_start dp01t_35_1_link_standby_message_and_free_vram -dp01t_35_1_link_standby_message_and_free_vram: @ 805CFC8 + thumb_func_start PlayerHandleLinkStandbyMsg +PlayerHandleLinkStandbyMsg: @ 805CFC8 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -10290,7 +5573,7 @@ _0805CFF8: beq _0805D01C b _0805D020 _0805CFFE: - bl b_link_standby_message + bl PrintLinkStandbyMsg _0805D002: ldr r4, =gActiveBank ldrb r0, [r4] @@ -10302,16 +5585,16 @@ _0805D002: b _0805D020 .pool _0805D01C: - bl b_link_standby_message + bl PrintLinkStandbyMsg _0805D020: bl PlayerBufferExecCompleted pop {r4,r5} pop {r0} bx r0 - thumb_func_end dp01t_35_1_link_standby_message_and_free_vram + thumb_func_end PlayerHandleLinkStandbyMsg - thumb_func_start sub_805D02C -sub_805D02C: @ 805D02C + thumb_func_start PlayerHandleResetActionMoveSelection +PlayerHandleResetActionMoveSelection: @ 805D02C push {r4,lr} ldr r1, =gBattleBufferA ldr r4, =gActiveBank @@ -10358,10 +5641,10 @@ _0805D084: pop {r0} bx r0 .pool - thumb_func_end sub_805D02C + thumb_func_end PlayerHandleResetActionMoveSelection - thumb_func_start sub_805D094 -sub_805D094: @ 805D094 + thumb_func_start PlayerHandleCmd55 +PlayerHandleCmd55: @ 805D094 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -10409,7 +5692,7 @@ sub_805D094: @ 805D094 pop {r0} bx r0 .pool - thumb_func_end sub_805D094 + thumb_func_end PlayerHandleCmd55 thumb_func_start nullsub_22 nullsub_22: @ 805D114 diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index e1d92de0d..02d33e87e 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -5,38 +5,6 @@ .text - - thumb_func_start nullsub_117 -nullsub_117: @ 81683B4 - bx lr - thumb_func_end nullsub_117 - - thumb_func_start SetBankFuncToWallyBufferRunCommand -SetBankFuncToWallyBufferRunCommand: @ 81683B8 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =WallyBufferRunCommand - str r1, [r0] - ldr r2, =gBattleStruct - ldr r0, [r2] - adds r0, 0x94 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x95 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x96 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x97 - strb r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToWallyBufferRunCommand thumb_func_start WallyBufferRunCommand WallyBufferRunCommand: @ 81683F4 @@ -928,8 +896,8 @@ _08168B92: .pool thumb_func_end sub_8168B70 - thumb_func_start dp01t_00_5_getattr -dp01t_00_5_getattr: @ 8168BA0 + thumb_func_start WallyHandleGetMonData +WallyHandleGetMonData: @ 8168BA0 push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -981,7 +949,7 @@ _08168BFA: pop {r4-r6} pop {r0} bx r0 - thumb_func_end dp01t_00_5_getattr + thumb_func_end WallyHandleGetMonData thumb_func_start sub_8168C14 sub_8168C14: @ 8168C14 @@ -1861,16 +1829,16 @@ _081693AA: .pool thumb_func_end sub_8168C14 - thumb_func_start sub_81693C0 -sub_81693C0: @ 81693C0 + thumb_func_start WallyHandleGetRawMonData +WallyHandleGetRawMonData: @ 81693C0 push {lr} - bl sub_805A614 + bl PlayerHandleGetRawMonData pop {r0} bx r0 - thumb_func_end sub_81693C0 + thumb_func_end WallyHandleGetRawMonData - thumb_func_start sub_81693CC -sub_81693CC: @ 81693CC + thumb_func_start WallyHandleSetMonData +WallyHandleSetMonData: @ 81693CC push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -1910,7 +1878,7 @@ _0816941A: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_81693CC + thumb_func_end WallyHandleSetMonData thumb_func_start sub_8169424 sub_8169424: @ 8169424 @@ -2945,32 +2913,32 @@ _08169DEA: .pool thumb_func_end sub_8169424 - thumb_func_start sub_8169E20 -sub_8169E20: @ 8169E20 + thumb_func_start WallyHandleSetRawMonData +WallyHandleSetRawMonData: @ 8169E20 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8169E20 + thumb_func_end WallyHandleSetRawMonData - thumb_func_start sub_8169E2C -sub_8169E2C: @ 8169E2C + thumb_func_start WallyHandleLoadMonSprite +WallyHandleLoadMonSprite: @ 8169E2C push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8169E2C + thumb_func_end WallyHandleLoadMonSprite - thumb_func_start sub_8169E38 -sub_8169E38: @ 8169E38 + thumb_func_start WallyHandleSwitchInAnim +WallyHandleSwitchInAnim: @ 8169E38 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8169E38 + thumb_func_end WallyHandleSwitchInAnim - thumb_func_start sub_8169E44 -sub_8169E44: @ 8169E44 + thumb_func_start WallyHandleReturnMonToBall +WallyHandleReturnMonToBall: @ 8169E44 push {r4-r6,lr} ldr r0, =gBattleBufferA ldr r6, =gActiveBank @@ -3022,10 +2990,10 @@ _08169EB6: pop {r0} bx r0 .pool - thumb_func_end sub_8169E44 + thumb_func_end WallyHandleReturnMonToBall - thumb_func_start sub_8169EC8 -sub_8169EC8: @ 8169EC8 + thumb_func_start WallyHandleDrawTrainerPic +WallyHandleDrawTrainerPic: @ 8169EC8 push {r4-r6,lr} ldr r4, =gActiveBank ldrb r1, [r4] @@ -3107,10 +3075,10 @@ sub_8169EC8: @ 8169EC8 pop {r0} bx r0 .pool - thumb_func_end sub_8169EC8 + thumb_func_end WallyHandleDrawTrainerPic - thumb_func_start dp01t_07_6_ -dp01t_07_6_: @ 8169F94 + thumb_func_start WallyHandleTrainerSlide +WallyHandleTrainerSlide: @ 8169F94 push {r4-r6,lr} ldr r4, =gActiveBank ldrb r1, [r4] @@ -3192,34 +3160,34 @@ dp01t_07_6_: @ 8169F94 pop {r0} bx r0 .pool - thumb_func_end dp01t_07_6_ + thumb_func_end WallyHandleTrainerSlide - thumb_func_start sub_816A060 -sub_816A060: @ 816A060 + thumb_func_start WallyHandleTrainerSlideBack +WallyHandleTrainerSlideBack: @ 816A060 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A060 + thumb_func_end WallyHandleTrainerSlideBack - thumb_func_start sub_816A06C -sub_816A06C: @ 816A06C + thumb_func_start WallyHandleFaintAnimation +WallyHandleFaintAnimation: @ 816A06C push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A06C + thumb_func_end WallyHandleFaintAnimation - thumb_func_start sub_816A078 -sub_816A078: @ 816A078 + thumb_func_start WallyHandleCmd11 +WallyHandleCmd11: @ 816A078 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A078 + thumb_func_end WallyHandleCmd11 - thumb_func_start sub_816A084 -sub_816A084: @ 816A084 + thumb_func_start WallyHandleCmd12 +WallyHandleCmd12: @ 816A084 push {r4,r5,lr} ldr r0, =gBattleSpritesDataPtr ldr r0, [r0] @@ -3250,10 +3218,10 @@ sub_816A084: @ 816A084 pop {r0} bx r0 .pool - thumb_func_end sub_816A084 + thumb_func_end WallyHandleCmd12 - thumb_func_start sub_816A0D8 -sub_816A0D8: @ 816A0D8 + thumb_func_start WallyHandleBallThrow +WallyHandleBallThrow: @ 816A0D8 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r5, =gActiveBank @@ -3289,18 +3257,18 @@ sub_816A0D8: @ 816A0D8 pop {r0} bx r0 .pool - thumb_func_end sub_816A0D8 + thumb_func_end WallyHandleBallThrow - thumb_func_start sub_816A138 -sub_816A138: @ 816A138 + thumb_func_start WallyHandlePause +WallyHandlePause: @ 816A138 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A138 + thumb_func_end WallyHandlePause - thumb_func_start sub_816A144 -sub_816A144: @ 816A144 + thumb_func_start WallyHandleMoveAnimation +WallyHandleMoveAnimation: @ 816A144 push {r4-r6,lr} ldr r0, =gBattleBufferA mov r12, r0 @@ -3427,7 +3395,7 @@ _0816A25A: pop {r0} bx r0 .pool - thumb_func_end sub_816A144 + thumb_func_end WallyHandleMoveAnimation thumb_func_start bx_move_anim_5 bx_move_anim_5: @ 816A26C @@ -3589,8 +3557,8 @@ _0816A3AC: bx r0 thumb_func_end bx_move_anim_5 - thumb_func_start sub_816A3B8 -sub_816A3B8: @ 816A3B8 + thumb_func_start WallyHandlePrintString +WallyHandlePrintString: @ 816A3B8 push {r4,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -3617,10 +3585,10 @@ sub_816A3B8: @ 816A3B8 pop {r0} bx r0 .pool - thumb_func_end sub_816A3B8 + thumb_func_end WallyHandlePrintString - thumb_func_start dp01t_11_5_message_for_player_only -dp01t_11_5_message_for_player_only: @ 816A40C + thumb_func_start WallyHandlePrintStringPlayerOnly +WallyHandlePrintStringPlayerOnly: @ 816A40C push {lr} ldr r0, =gActiveBank ldrb r0, [r0] @@ -3628,7 +3596,7 @@ dp01t_11_5_message_for_player_only: @ 816A40C lsls r0, 24 cmp r0, 0 bne _0816A428 - bl sub_816A3B8 + bl WallyHandlePrintString b _0816A42C .pool _0816A428: @@ -3636,7 +3604,7 @@ _0816A428: _0816A42C: pop {r0} bx r0 - thumb_func_end dp01t_11_5_message_for_player_only + thumb_func_end WallyHandlePrintStringPlayerOnly thumb_func_start sub_816A430 sub_816A430: @ 816A430 @@ -3664,8 +3632,8 @@ _0816A456: .pool thumb_func_end sub_816A430 - thumb_func_start dp01t_12_1_battle_menu -dp01t_12_1_battle_menu: @ 816A470 + thumb_func_start WallyHandleChooseAction +WallyHandleChooseAction: @ 816A470 push {r4,lr} ldr r1, =gBattleBankFunc ldr r0, =gActiveBank @@ -3701,18 +3669,18 @@ _0816A48A: pop {r0} bx r0 .pool - thumb_func_end dp01t_12_1_battle_menu + thumb_func_end WallyHandleChooseAction - thumb_func_start sub_816A4D8 -sub_816A4D8: @ 816A4D8 + thumb_func_start WallyHandleCmd19 +WallyHandleCmd19: @ 816A4D8 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A4D8 + thumb_func_end WallyHandleCmd19 - thumb_func_start sub_816A4E4 -sub_816A4E4: @ 816A4E4 + thumb_func_start WallyHandleChooseMove +WallyHandleChooseMove: @ 816A4E4 push {r4,lr} ldr r4, =gBattleStruct ldr r1, [r4] @@ -3783,10 +3751,10 @@ _0816A574: pop {r4} pop {r0} bx r0 - thumb_func_end sub_816A4E4 + thumb_func_end WallyHandleChooseMove - thumb_func_start sub_816A57C -sub_816A57C: @ 816A57C + thumb_func_start WallyHandleOpenBag +WallyHandleOpenBag: @ 816A57C push {lr} sub sp, 0x4 movs r0, 0x1 @@ -3810,26 +3778,26 @@ sub_816A57C: @ 816A57C pop {r0} bx r0 .pool - thumb_func_end sub_816A57C + thumb_func_end WallyHandleOpenBag - thumb_func_start sub_816A5BC -sub_816A5BC: @ 816A5BC + thumb_func_start WallyHandleChoosePokemon +WallyHandleChoosePokemon: @ 816A5BC push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A5BC + thumb_func_end WallyHandleChoosePokemon - thumb_func_start sub_816A5C8 -sub_816A5C8: @ 816A5C8 + thumb_func_start WallyHandleCmd23 +WallyHandleCmd23: @ 816A5C8 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A5C8 + thumb_func_end WallyHandleCmd23 - thumb_func_start sub_816A5D4 -sub_816A5D4: @ 816A5D4 + thumb_func_start WallyHandleHealthBarUpdate +WallyHandleHealthBarUpdate: @ 816A5D4 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -3929,138 +3897,138 @@ _0816A69E: pop {r0} bx r0 .pool - thumb_func_end sub_816A5D4 + thumb_func_end WallyHandleHealthBarUpdate - thumb_func_start sub_816A6D4 -sub_816A6D4: @ 816A6D4 + thumb_func_start WallyHandleExpUpdate +WallyHandleExpUpdate: @ 816A6D4 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A6D4 + thumb_func_end WallyHandleExpUpdate - thumb_func_start sub_816A6E0 -sub_816A6E0: @ 816A6E0 + thumb_func_start WallyHandleStatusIconUpdate +WallyHandleStatusIconUpdate: @ 816A6E0 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A6E0 + thumb_func_end WallyHandleStatusIconUpdate - thumb_func_start sub_816A6EC -sub_816A6EC: @ 816A6EC + thumb_func_start WallyHandleStatusAnimation +WallyHandleStatusAnimation: @ 816A6EC push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A6EC + thumb_func_end WallyHandleStatusAnimation - thumb_func_start sub_816A6F8 -sub_816A6F8: @ 816A6F8 + thumb_func_start WallyHandleStatusXor +WallyHandleStatusXor: @ 816A6F8 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A6F8 + thumb_func_end WallyHandleStatusXor - thumb_func_start sub_816A704 -sub_816A704: @ 816A704 + thumb_func_start WallyHandleDataTransfer +WallyHandleDataTransfer: @ 816A704 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A704 + thumb_func_end WallyHandleDataTransfer - thumb_func_start sub_816A710 -sub_816A710: @ 816A710 + thumb_func_start WallyHandleDMA3Transfer +WallyHandleDMA3Transfer: @ 816A710 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A710 + thumb_func_end WallyHandleDMA3Transfer - thumb_func_start sub_816A71C -sub_816A71C: @ 816A71C + thumb_func_start WallyHandlePlayBGM +WallyHandlePlayBGM: @ 816A71C push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A71C + thumb_func_end WallyHandlePlayBGM - thumb_func_start sub_816A728 -sub_816A728: @ 816A728 + thumb_func_start WallyHandleCmd32 +WallyHandleCmd32: @ 816A728 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A728 + thumb_func_end WallyHandleCmd32 - thumb_func_start sub_816A734 -sub_816A734: @ 816A734 + thumb_func_start WallyHandleCmd33 +WallyHandleCmd33: @ 816A734 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A734 + thumb_func_end WallyHandleCmd33 - thumb_func_start sub_816A740 -sub_816A740: @ 816A740 + thumb_func_start WallyHandleCmd34 +WallyHandleCmd34: @ 816A740 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A740 + thumb_func_end WallyHandleCmd34 - thumb_func_start sub_816A74C -sub_816A74C: @ 816A74C + thumb_func_start WallyHandleCmd35 +WallyHandleCmd35: @ 816A74C push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A74C + thumb_func_end WallyHandleCmd35 - thumb_func_start sub_816A758 -sub_816A758: @ 816A758 + thumb_func_start WallyHandleCmd36 +WallyHandleCmd36: @ 816A758 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A758 + thumb_func_end WallyHandleCmd36 - thumb_func_start sub_816A764 -sub_816A764: @ 816A764 + thumb_func_start WallyHandleCmd37 +WallyHandleCmd37: @ 816A764 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A764 + thumb_func_end WallyHandleCmd37 - thumb_func_start sub_816A770 -sub_816A770: @ 816A770 + thumb_func_start WallyHandleCmd38 +WallyHandleCmd38: @ 816A770 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A770 + thumb_func_end WallyHandleCmd38 - thumb_func_start sub_816A77C -sub_816A77C: @ 816A77C + thumb_func_start WallyHandleCmd39 +WallyHandleCmd39: @ 816A77C push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A77C + thumb_func_end WallyHandleCmd39 - thumb_func_start sub_816A788 -sub_816A788: @ 816A788 + thumb_func_start WallyHandleCmd40 +WallyHandleCmd40: @ 816A788 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A788 + thumb_func_end WallyHandleCmd40 - thumb_func_start sub_816A794 -sub_816A794: @ 816A794 + thumb_func_start WallyHandleHitAnimation +WallyHandleHitAnimation: @ 816A794 push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -4106,18 +4074,18 @@ _0816A7F2: pop {r0} bx r0 .pool - thumb_func_end sub_816A794 + thumb_func_end WallyHandleHitAnimation - thumb_func_start sub_816A804 -sub_816A804: @ 816A804 + thumb_func_start WallyHandleCmd42 +WallyHandleCmd42: @ 816A804 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816A804 + thumb_func_end WallyHandleCmd42 - thumb_func_start sub_816A810 -sub_816A810: @ 816A810 + thumb_func_start WallyHandleEffectivenessSound +WallyHandleEffectivenessSound: @ 816A810 push {lr} ldr r2, =gBattleBufferA ldr r0, =gActiveBank @@ -4136,10 +4104,10 @@ sub_816A810: @ 816A810 pop {r0} bx r0 .pool - thumb_func_end sub_816A810 + thumb_func_end WallyHandleEffectivenessSound - thumb_func_start sub_816A840 -sub_816A840: @ 816A840 + thumb_func_start WallyHandlePlayFanfareOrBGM +WallyHandlePlayFanfareOrBGM: @ 816A840 push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -4179,10 +4147,10 @@ _0816A890: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_816A840 + thumb_func_end WallyHandlePlayFanfareOrBGM - thumb_func_start sub_816A89C -sub_816A89C: @ 816A89C + thumb_func_start WallyHandleFaintingCry +WallyHandleFaintingCry: @ 816A89C push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -4204,10 +4172,10 @@ sub_816A89C: @ 816A89C pop {r0} bx r0 .pool - thumb_func_end sub_816A89C + thumb_func_end WallyHandleFaintingCry - thumb_func_start dp01t_2E_5_battle_intro -dp01t_2E_5_battle_intro: @ 816A8D8 + thumb_func_start WallyHandleIntroSlide +WallyHandleIntroSlide: @ 816A8D8 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -4226,10 +4194,10 @@ dp01t_2E_5_battle_intro: @ 816A8D8 pop {r0} bx r0 .pool - thumb_func_end dp01t_2E_5_battle_intro + thumb_func_end WallyHandleIntroSlide - thumb_func_start sub_816A90C -sub_816A90C: @ 816A90C + thumb_func_start WallyHandleIntroTrainerBallThrow +WallyHandleIntroTrainerBallThrow: @ 816A90C push {r4-r7,lr} ldr r6, =gBankSpriteIds ldr r7, =gActiveBank @@ -4381,7 +4349,7 @@ _0816AA24: pop {r0} bx r0 .pool - thumb_func_end sub_816A90C + thumb_func_end WallyHandleIntroTrainerBallThrow thumb_func_start sub_816AA80 sub_816AA80: @ 816AA80 @@ -4601,8 +4569,8 @@ _0816AC5E: .pool thumb_func_end sub_816AC04 - thumb_func_start sub_816AC78 -sub_816AC78: @ 816AC78 + thumb_func_start WallyHandleDrawPartyStatusSummary +WallyHandleDrawPartyStatusSummary: @ 816AC78 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -4656,34 +4624,34 @@ _0816ACE6: pop {r0} bx r0 .pool - thumb_func_end sub_816AC78 + thumb_func_end WallyHandleDrawPartyStatusSummary - thumb_func_start sub_816ACFC -sub_816ACFC: @ 816ACFC + thumb_func_start WallyHandleCmd49 +WallyHandleCmd49: @ 816ACFC push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816ACFC + thumb_func_end WallyHandleCmd49 - thumb_func_start sub_816AD08 -sub_816AD08: @ 816AD08 + thumb_func_start WallyHandleCmd50 +WallyHandleCmd50: @ 816AD08 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816AD08 + thumb_func_end WallyHandleCmd50 - thumb_func_start sub_816AD14 -sub_816AD14: @ 816AD14 + thumb_func_start WallyHandleSpriteInvisibility +WallyHandleSpriteInvisibility: @ 816AD14 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816AD14 + thumb_func_end WallyHandleSpriteInvisibility - thumb_func_start sub_816AD20 -sub_816AD20: @ 816AD20 + thumb_func_start WallyHandleBattleAnimation +WallyHandleBattleAnimation: @ 816AD20 push {r4-r6,lr} sub sp, 0x4 ldr r5, =gBattleBufferA @@ -4724,26 +4692,26 @@ _0816AD6C: pop {r0} bx r0 .pool - thumb_func_end sub_816AD20 + thumb_func_end WallyHandleBattleAnimation - thumb_func_start sub_816AD7C -sub_816AD7C: @ 816AD7C + thumb_func_start WallyHandleLinkStandbyMsg +WallyHandleLinkStandbyMsg: @ 816AD7C push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816AD7C + thumb_func_end WallyHandleLinkStandbyMsg - thumb_func_start sub_816AD88 -sub_816AD88: @ 816AD88 + thumb_func_start WallyHandleResetActionMoveSelection +WallyHandleResetActionMoveSelection: @ 816AD88 push {lr} bl WallyBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_816AD88 + thumb_func_end WallyHandleResetActionMoveSelection - thumb_func_start sub_816AD94 -sub_816AD94: @ 816AD94 + thumb_func_start WallyHandleCmd55 +WallyHandleCmd55: @ 816AD94 push {r4,lr} ldr r2, =gBattleOutcome ldr r1, =gBattleBufferA @@ -4776,7 +4744,7 @@ _0816ADD0: pop {r0} bx r0 .pool - thumb_func_end sub_816AD94 + thumb_func_end WallyHandleCmd55 thumb_func_start nullsub_118 nullsub_118: @ 816ADF0 diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index e5e9aaab9..2e2221192 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -2100,7 +2100,7 @@ _0813EDEA: ldr r0, =gBattleCommunication strb r2, [r0, 0x1] movs r0, 0 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt b _0813F1A4 .pool _0813EE34: @@ -2117,10 +2117,10 @@ _0813EE34: movs r0, 0x5 bl PlaySE ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt + bl BattleDestroyYesNoCursorAt movs r0, 0 strb r0, [r4, 0x1] - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt _0813EE5C: ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -2135,10 +2135,10 @@ _0813EE5C: movs r0, 0x5 bl PlaySE ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt + bl BattleDestroyYesNoCursorAt movs r0, 0x1 strb r0, [r4, 0x1] - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt _0813EE84: ldr r0, =gMain ldrh r1, [r0, 0x2E] diff --git a/asm/item_menu.s b/asm/item_menu.s index 1e4dfca49..06c0a86ed 100755 --- a/asm/item_menu.s +++ b/asm/item_menu.s @@ -47,14 +47,14 @@ sub_81AABB0: @ 81AABB0 lsls r0, 24 cmp r0, 0 bne _081AABCC - ldr r2, =sub_8059D50 + ldr r2, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 movs r1, 0x5 bl GoToBagMenu b _081AABD4 .pool _081AABCC: - ldr r1, =sub_8059D50 + ldr r1, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 bl sub_81C4F98 _081AABD4: @@ -5634,7 +5634,7 @@ DoWallyTutorialBagMenu: @ 81ADD70 movs r0, 0x4 movs r1, 0x1 bl AddBagItem - ldr r2, =sub_8059D50 + ldr r2, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0xA movs r1, 0 bl GoToBagMenu diff --git a/asm/party_menu.s b/asm/party_menu.s index f2e681b9b..0ab4eb318 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -15908,7 +15908,7 @@ sub_81B89AC: @ 81B89AC str r0, [sp] ldr r0, =sub_81B1370 str r0, [sp, 0x4] - ldr r0, =sub_8059D40 + ldr r0, =SetCB2ToReshowScreenAfterMenu str r0, [sp, 0x8] movs r0, 0x1 adds r2, r4, 0 @@ -16828,7 +16828,7 @@ _081B9136: thumb_func_start sub_81B9140 sub_81B9140: @ 81B9140 push {lr} - ldr r0, =sub_8059D40 + ldr r0, =SetCB2ToReshowScreenAfterMenu bl SetMainCallback2 pop {r0} bx r0 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 7c314f8db..50018de9c 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -9861,7 +9861,7 @@ sub_81C4EFC: @ 81C4EFC thumb_func_start sub_81C4F10 sub_81C4F10: @ 81C4F10 push {lr} - ldr r1, =sub_8059D50 + ldr r1, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 bl sub_81C4F98 pop {r0} diff --git a/asm/rom6.s b/asm/rom6.s index b729369c8..87b780ba5 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -547,7 +547,7 @@ _081358D4: thumb_func_start sub_81358F4 sub_81358F4: @ 81358F4 push {lr} - ldr r1, =sub_8059D50 + ldr r1, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 bl sub_81357FC pop {r0} diff --git a/data/battle_controller_link_opponent.s b/data/battle_controller_link_opponent.s deleted file mode 100644 index ff6c7023b..000000000 --- a/data/battle_controller_link_opponent.s +++ /dev/null @@ -1,64 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gLinkOpponentBufferCommands:: @ 831C7B4 - .4byte dp01t_00_2_getattr - .4byte sub_8065900 - .4byte sub_806590C - .4byte sub_8066284 - .4byte sub_80662F8 - .4byte sub_8066448 - .4byte sub_8066624 - .4byte sub_8066748 - .4byte sub_8066A58 - .4byte sub_8066B94 - .4byte sub_8066C40 - .4byte sub_8066CEC - .4byte sub_8066CF8 - .4byte sub_8066D04 - .4byte sub_8066D10 - .4byte sub_8066D1C - .4byte sub_8066FF4 - .4byte sub_806704C - .4byte sub_8067058 - .4byte sub_8067064 - .4byte sub_8067070 - .4byte sub_806707C - .4byte sub_8067088 - .4byte sub_8067094 - .4byte sub_80670A0 - .4byte sub_8067190 - .4byte sub_806719C - .4byte sub_8067214 - .4byte sub_806727C - .4byte sub_8067288 - .4byte sub_8067294 - .4byte sub_80672A0 - .4byte sub_80672AC - .4byte sub_80672B8 - .4byte sub_80672C4 - .4byte sub_80672D0 - .4byte sub_80672DC - .4byte sub_80672E8 - .4byte sub_8067304 - .4byte sub_806733C - .4byte sub_8067354 - .4byte sub_806737C - .4byte sub_80673EC - .4byte sub_80673F8 - .4byte sub_806743C - .4byte sub_8067498 - .4byte sub_80674D4 - .4byte sub_8067508 - .4byte sub_8067718 - .4byte sub_8067874 - .4byte sub_80678C4 - .4byte sub_80678D0 - .4byte sub_8067930 - .4byte sub_80679A4 - .4byte sub_80679C4 - .4byte sub_80679D0 - .4byte nullsub_92 diff --git a/data/battle_controller_opponent.s b/data/battle_controller_opponent.s deleted file mode 100644 index 3b7acd003..000000000 --- a/data/battle_controller_opponent.s +++ /dev/null @@ -1,67 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gOpponentBufferCommands:: @ 831C6C8 - .4byte dp01t_00_7_getattr - .4byte dp01t_01_2_read_pokmon_data_slice - .4byte dp01t_02_7_setattr - .4byte sub_80611B0 - .4byte sub_8061224 - .4byte sub_806137C - .4byte sub_806156C - .4byte sub_8061690 - .4byte sub_80618D8 - .4byte sub_8061AF0 - .4byte sub_8061B9C - .4byte sub_8061C48 - .4byte sub_8061C54 - .4byte sub_8061C60 - .4byte sub_8061C6C - .4byte sub_8061C78 - .4byte sub_8061F34 - .4byte sub_8061F90 - .4byte sub_8061F9C - .4byte sub_8061FAC - .4byte sub_8061FB8 - .4byte sub_806215C - .4byte sub_8062188 - .4byte sub_8062288 - .4byte sub_8062294 - .4byte sub_8062384 - .4byte sub_8062390 - .4byte sub_8062408 - .4byte sub_8062470 - .4byte sub_806247C - .4byte sub_8062488 - .4byte sub_8062494 - .4byte sub_80624A0 - .4byte sub_80624AC - .4byte sub_80624B8 - .4byte sub_80624C4 - .4byte sub_80624D0 - .4byte sub_80624DC - .4byte sub_80624F8 - .4byte sub_8062530 - .4byte sub_8062548 - .4byte dp01t_29_7_blink - .4byte sub_80625E0 - .4byte sub_80625EC - .4byte sub_8062630 - .4byte sub_806268C - .4byte dp01t_2E_7_battle_intro - .4byte sub_80626FC - .4byte dp01t_30_7_0803D67C - .4byte sub_8062A74 - .4byte sub_8062AC4 - .4byte sub_8062AD0 - .4byte dp01t_34_7_move_anim_start_t3 - .4byte sub_8062B98 - .4byte sub_8062BA4 - .4byte sub_8062BB0 - .4byte nullsub_91 - - .align 2 - .byte 0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20 diff --git a/data/battle_controller_player.s b/data/battle_controller_player.s deleted file mode 100644 index bc2a18edb..000000000 --- a/data/battle_controller_player.s +++ /dev/null @@ -1,69 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gPlayerBufferCommands:: @ 831C514 - .4byte dp01t_00_1_getattr - .4byte sub_805A614 - .4byte dp01t_02_1_setattr - .4byte sub_805B0F0 - .4byte sub_805B164 - .4byte sub_805B1CC - .4byte sub_805B3D4 - .4byte sub_805B4F0 - .4byte dp01t_08_1_8032428 - .4byte sub_805B9F8 - .4byte sub_805BAB8 - .4byte sub_805BBA4 - .4byte sub_805BBC4 - .4byte sub_805BC18 - .4byte sub_805BC78 - .4byte dp01t_0F_1_move_anim - .4byte sub_805BF80 - .4byte dp01t_11_1_message_for_player_only - .4byte dp01t_12_6_battle_menu - .4byte sub_805C0B0 - .4byte dp01t_14_5_move_menu_pokedude - .4byte sub_805C248 - .4byte sub_805C2AC - .4byte sub_805C3EC - .4byte sub_805C410 - .4byte sub_805C528 - .4byte sub_805C5C4 - .4byte sub_805C63C - .4byte sub_805C6A4 - .4byte sub_805C710 - .4byte sub_805C71C - .4byte sub_805C7D0 - .4byte sub_805C800 - .4byte sub_805C80C - .4byte sub_805C820 - .4byte sub_805C834 - .4byte sub_805C848 - .4byte sub_805C85C - .4byte sub_805C878 - .4byte sub_805C8B0 - .4byte sub_805C8C8 - .4byte dp01t_29_1_blink - .4byte sub_805C960 - .4byte sub_805C96C - .4byte sub_805C9B0 - .4byte sub_805CA0C - .4byte dp01t_2E_1_battle_intro - .4byte dp01t_2F_1_pokemon_enter - .4byte sub_805CD74 - .4byte sub_805CE80 - .4byte sub_805CED0 - .4byte dp01t_33_1_enemy_move - .4byte sub_805CF54 - .4byte dp01t_35_1_link_standby_message_and_free_vram - .4byte sub_805D02C - .4byte sub_805D094 - .4byte nullsub_22 - - .align 2 -gUnknown_0831C5F8:: @ 831C5F8 - .byte 0x00, 0x02, 0x03, 0x01, 0x48, 0x48, 0x20, 0x5a - .byte 0x50, 0x50, 0x50, 0x58 diff --git a/data/battle_controller_wally.s b/data/battle_controller_wally.s deleted file mode 100644 index 96d34d4a5..000000000 --- a/data/battle_controller_wally.s +++ /dev/null @@ -1,64 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gWallyBufferCommands:: @ 85DFDC0 - .4byte dp01t_00_5_getattr - .4byte sub_81693C0 - .4byte sub_81693CC - .4byte sub_8169E20 - .4byte sub_8169E2C - .4byte sub_8169E38 - .4byte sub_8169E44 - .4byte sub_8169EC8 - .4byte dp01t_07_6_ - .4byte sub_816A060 - .4byte sub_816A06C - .4byte sub_816A078 - .4byte sub_816A084 - .4byte sub_816A0D8 - .4byte sub_816A138 - .4byte sub_816A144 - .4byte sub_816A3B8 - .4byte dp01t_11_5_message_for_player_only - .4byte dp01t_12_1_battle_menu - .4byte sub_816A4D8 - .4byte sub_816A4E4 - .4byte sub_816A57C - .4byte sub_816A5BC - .4byte sub_816A5C8 - .4byte sub_816A5D4 - .4byte sub_816A6D4 - .4byte sub_816A6E0 - .4byte sub_816A6EC - .4byte sub_816A6F8 - .4byte sub_816A704 - .4byte sub_816A710 - .4byte sub_816A71C - .4byte sub_816A728 - .4byte sub_816A734 - .4byte sub_816A740 - .4byte sub_816A74C - .4byte sub_816A758 - .4byte sub_816A764 - .4byte sub_816A770 - .4byte sub_816A77C - .4byte sub_816A788 - .4byte sub_816A794 - .4byte sub_816A804 - .4byte sub_816A810 - .4byte sub_816A840 - .4byte sub_816A89C - .4byte dp01t_2E_5_battle_intro - .4byte sub_816A90C - .4byte sub_816AC78 - .4byte sub_816ACFC - .4byte sub_816AD08 - .4byte sub_816AD14 - .4byte sub_816AD20 - .4byte sub_816AD7C - .4byte sub_816AD88 - .4byte sub_816AD94 - .4byte nullsub_118 diff --git a/include/battle.h b/include/battle.h index 8ea1b78f4..a67442f85 100644 --- a/include/battle.h +++ b/include/battle.h @@ -856,6 +856,8 @@ void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species); void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank); void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank); void BattleLoadSubstituteSpriteGfx(u8 bank, bool8 arg1); +void nullsub_24(u16 arg0); +void nullsub_25(u8 arg0); enum { @@ -910,7 +912,17 @@ struct BattleHealthboxInfo u8 flag_x4 : 1; u8 flag_x8 : 1; u8 flag_x10 : 1; - u8 field_1; + u8 flag_x20 : 1; + u8 flag_x40 : 1; + u8 flag_x80 : 1; + u8 field_1_x1 : 1; + u8 field_1_x2 : 1; + u8 field_1_x4 : 1; + u8 field_1_x8 : 1; + u8 field_1_x10 : 1; + u8 field_1_x20 : 1; + u8 field_1_x40 : 1; + u8 field_1_x80 : 1; u8 field_2; u8 field_3; u8 field_4; diff --git a/include/battle_2.h b/include/battle_2.h index ceec2aa00..0d4bcbc67 100644 --- a/include/battle_2.h +++ b/include/battle_2.h @@ -13,10 +13,13 @@ u8 IsRunningFromBattleImpossible(void); u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves); void SwapTurnOrder(u8 id1, u8 id2); void BattleTurnPassed(void); +void sub_8038D64(void); void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); u32 sub_80397C4(u32 setId, u32 tableId); void sub_8039E9C(struct Sprite *sprite); +void sub_8039B2C(struct Sprite *sprite); +void sub_8039AD8(struct Sprite *sprite); void nullsub_20(void); void BeginBattleIntro(void); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 4bc6b7b84..1c076b3e0 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -107,7 +107,7 @@ enum CONTROLLER_56 }; -#define LAST_CONTROLLER_CMD_ID CONTROLLER_56 + 1 +#define CONTOLLER_CMDS_COUNT CONTROLLER_56 + 1 // general functions void HandleLinkBattleSetup(void); diff --git a/include/battle_interface.h b/include/battle_interface.h index 05ea1c021..0980b0002 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -3,6 +3,12 @@ #include "battle_controllers.h" +enum +{ + HP_CURRENT, + HP_MAX +}; + #define TAG_HEALTHBOX_PLAYER1_TILE 0xD6FF #define TAG_HEALTHBOX_PLAYER2_TILE 0xD700 #define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701 diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 590944f02..6d3563c3d 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -46,8 +46,8 @@ u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef); u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility); u8 BankGetTurnOrder(u8 bank); void SetMoveEffect(bool8 primary, u8 certain); -void BattleDestroyCursorAt(u8 cursorPosition); -void BattleCreateCursorAt(u8 cursorPosition); +void BattleDestroyYesNoCursorAt(u8 cursorPosition); +void BattleCreateYesNoCursorAt(u8 cursorPosition); void BufferMoveToLearnIntoBattleTextBuff2(void); void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); bool8 UproarWakeUpCheck(u8 bank); diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index f8c89fdbd..a2be31975 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -622,6 +622,8 @@ #define KEY_OR_INTR 0x0000 #define KEY_AND_INTR 0x8000 +#define DPAD_ANY ((DPAD_RIGHT | DPAD_LEFT | DPAD_UP | DPAD_DOWN)) + // interrupt flags #define INTR_FLAG_VBLANK (1 << 0) #define INTR_FLAG_HBLANK (1 << 1) diff --git a/include/pokemon.h b/include/pokemon.h index c26c28afa..5048c1e4c 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -643,6 +643,7 @@ void PartySpreadPokerus(struct Pokemon *party); s8 GetMonFlavourRelation(struct Pokemon *mon, u8 a2); s8 GetFlavourRelationByPersonality(u32 personality, u8 a2); u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit); +u8 GetDefaultMoveTarget(u8 atkBank); #include "sprite.h" diff --git a/ld_script.txt b/ld_script.txt index 163d72e25..71320dd90 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -61,10 +61,13 @@ SECTIONS { src/battle_util.o(.text); src/battle_script_commands.o(.text); asm/battle_5.o(.text); + src/battle_controller_player.o(.text); asm/battle_controller_player.o(.text); asm/battle_7.o(.text); + src/battle_controller_opponent.o(.text); asm/battle_controller_opponent.o(.text); src/battle_ai_switch_items.o(.text); + src/battle_controller_linkopponent.o(.text); asm/battle_controller_linkopponent.o(.text); src/pokemon_1.o(.text); asm/pokemon_1.o(.text); @@ -208,6 +211,7 @@ SECTIONS { src/roamer.o(.text); asm/battle_tower.o(.text); asm/use_pokeblock.o(.text); + src/battle_controller_wally.o(.text); asm/battle_controller_wally.o(.text); asm/player_pc.o(.text); asm/intro.o(.text); @@ -330,10 +334,10 @@ SECTIONS { src/battle_2.o(.rodata); src/battle_util.o(.rodata); src/battle_script_commands.o(.rodata); - data/battle_controller_player.o(.rodata); + src/battle_controller_player.o(.rodata); data/smokescreen.o(.rodata); - data/battle_controller_opponent.o(.rodata); - data/battle_controller_link_opponent.o(.rodata); + src/battle_controller_opponent.o(.rodata); + src/battle_controller_linkopponent.o(.rodata); data/data2c.o(.rodata); src/trig.o(.rodata); src/util.o(.rodata); @@ -425,7 +429,7 @@ SECTIONS { src/roamer.o(.rodata); data/battle_tower.o(.rodata); data/use_pokeblock.o(.rodata); - data/battle_controller_wally.o(.rodata); + src/battle_controller_wally.o(.rodata); data/player_pc.o(.rodata); data/intro.o(.rodata); data/field_region_map.o(.rodata); diff --git a/src/battle_2.c b/src/battle_2.c index 16c07114a..c50295eba 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -2257,7 +2257,7 @@ static void sub_803939C(void) sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); sub_814F9EC(gText_BattleYesNoChoice, 0xC); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2267,9 +2267,9 @@ static void sub_803939C(void) if (gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } } else if (gMain.newKeys & DPAD_DOWN) @@ -2277,9 +2277,9 @@ static void sub_803939C(void) if (gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } } else if (gMain.newKeys & A_BUTTON) diff --git a/src/battle_controller_linkopponent.c b/src/battle_controller_linkopponent.c new file mode 100644 index 000000000..fdb9ee10d --- /dev/null +++ b/src/battle_controller_linkopponent.c @@ -0,0 +1,143 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "link.h" + +extern u8 gActiveBank; +extern bool8 gDoingBattleAnim; +extern u8 gUnknown_020244CC; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); + +// this file's functions +void LinkOpponentHandleGetMonData(void); +void LinkOpponentHandleGetRawMonData(void); +void LinkOpponentHandleSetMonData(void); +void LinkOpponentHandleSetRawMonData(void); +void LinkOpponentHandleLoadMonSprite(void); +void LinkOpponentHandleSwitchInAnim(void); +void LinkOpponentHandleReturnMonToBall(void); +void LinkOpponentHandleDrawTrainerPic(void); +void LinkOpponentHandleTrainerSlide(void); +void LinkOpponentHandleTrainerSlideBack(void); +void LinkOpponentHandleFaintAnimation(void); +void LinkOpponentHandleCmd11(void); +void LinkOpponentHandleCmd12(void); +void LinkOpponentHandleBallThrow(void); +void LinkOpponentHandlePause(void); +void LinkOpponentHandleMoveAnimation(void); +void LinkOpponentHandlePrintString(void); +void LinkOpponentHandlePrintStringPlayerOnly(void); +void LinkOpponentHandleChooseAction(void); +void LinkOpponentHandleCmd19(void); +void LinkOpponentHandleChooseMove(void); +void LinkOpponentHandleOpenBag(void); +void LinkOpponentHandleChoosePokemon(void); +void LinkOpponentHandleCmd23(void); +void LinkOpponentHandleHealthBarUpdate(void); +void LinkOpponentHandleExpUpdate(void); +void LinkOpponentHandleStatusIconUpdate(void); +void LinkOpponentHandleStatusAnimation(void); +void LinkOpponentHandleStatusXor(void); +void LinkOpponentHandleDataTransfer(void); +void LinkOpponentHandleDMA3Transfer(void); +void LinkOpponentHandlePlayBGM(void); +void LinkOpponentHandleCmd32(void); +void LinkOpponentHandleCmd33(void); +void LinkOpponentHandleCmd34(void); +void LinkOpponentHandleCmd35(void); +void LinkOpponentHandleCmd36(void); +void LinkOpponentHandleCmd37(void); +void LinkOpponentHandleCmd38(void); +void LinkOpponentHandleCmd39(void); +void LinkOpponentHandleCmd40(void); +void LinkOpponentHandleHitAnimation(void); +void LinkOpponentHandleCmd42(void); +void LinkOpponentHandleEffectivenessSound(void); +void LinkOpponentHandlePlayFanfareOrBGM(void); +void LinkOpponentHandleFaintingCry(void); +void LinkOpponentHandleIntroSlide(void); +void LinkOpponentHandleIntroTrainerBallThrow(void); +void LinkOpponentHandleDrawPartyStatusSummary(void); +void LinkOpponentHandleCmd49(void); +void LinkOpponentHandleCmd50(void); +void LinkOpponentHandleSpriteInvisibility(void); +void LinkOpponentHandleBattleAnimation(void); +void LinkOpponentHandleLinkStandbyMsg(void); +void LinkOpponentHandleResetActionMoveSelection(void); +void LinkOpponentHandleCmd55(void); +void nullsub_92(void); + +void LinkOpponentBufferRunCommand(void); + +void (*const gLinkOpponentBufferCommands[CONTOLLER_CMDS_CONT])(void) = +{ + LinkOpponentHandleGetMonData, + LinkOpponentHandleGetRawMonData, + LinkOpponentHandleSetMonData, + LinkOpponentHandleSetRawMonData, + LinkOpponentHandleLoadMonSprite, + LinkOpponentHandleSwitchInAnim, + LinkOpponentHandleReturnMonToBall, + LinkOpponentHandleDrawTrainerPic, + LinkOpponentHandleTrainerSlide, + LinkOpponentHandleTrainerSlideBack, + LinkOpponentHandleFaintAnimation, + LinkOpponentHandleCmd11, + LinkOpponentHandleCmd12, + LinkOpponentHandleBallThrow, + LinkOpponentHandlePause, + LinkOpponentHandleMoveAnimation, + LinkOpponentHandlePrintString, + LinkOpponentHandlePrintStringPlayerOnly, + LinkOpponentHandleChooseAction, + LinkOpponentHandleCmd19, + LinkOpponentHandleChooseMove, + LinkOpponentHandleOpenBag, + LinkOpponentHandleChoosePokemon, + LinkOpponentHandleCmd23, + LinkOpponentHandleHealthBarUpdate, + LinkOpponentHandleExpUpdate, + LinkOpponentHandleStatusIconUpdate, + LinkOpponentHandleStatusAnimation, + LinkOpponentHandleStatusXor, + LinkOpponentHandleDataTransfer, + LinkOpponentHandleDMA3Transfer, + LinkOpponentHandlePlayBGM, + LinkOpponentHandleCmd32, + LinkOpponentHandleCmd33, + LinkOpponentHandleCmd34, + LinkOpponentHandleCmd35, + LinkOpponentHandleCmd36, + LinkOpponentHandleCmd37, + LinkOpponentHandleCmd38, + LinkOpponentHandleCmd39, + LinkOpponentHandleCmd40, + LinkOpponentHandleHitAnimation, + LinkOpponentHandleCmd42, + LinkOpponentHandleEffectivenessSound, + LinkOpponentHandlePlayFanfareOrBGM, + LinkOpponentHandleFaintingCry, + LinkOpponentHandleIntroSlide, + LinkOpponentHandleIntroTrainerBallThrow, + LinkOpponentHandleDrawPartyStatusSummary, + LinkOpponentHandleCmd49, + LinkOpponentHandleCmd50, + LinkOpponentHandleSpriteInvisibility, + LinkOpponentHandleBattleAnimation, + LinkOpponentHandleLinkStandbyMsg, + LinkOpponentHandleResetActionMoveSelection, + LinkOpponentHandleCmd55, + nullsub_92 +}; + +void nullsub_28(void) +{ +} + +void SetBankFuncToLinkOpponentBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = LinkOpponentBufferRunCommand; +} diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c new file mode 100644 index 000000000..9c72b19dc --- /dev/null +++ b/src/battle_controller_opponent.c @@ -0,0 +1,146 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "link.h" + +extern u8 gActiveBank; +extern bool8 gDoingBattleAnim; +extern u8 gUnknown_020244CC; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); + +// this file's functions +void OpponentHandleGetMonData(void); +void OpponentHandleGetRawMonData(void); +void OpponentHandleSetMonData(void); +void OpponentHandleSetRawMonData(void); +void OpponentHandleLoadMonSprite(void); +void OpponentHandleSwitchInAnim(void); +void OpponentHandleReturnMonToBall(void); +void OpponentHandleDrawTrainerPic(void); +void OpponentHandleTrainerSlide(void); +void OpponentHandleTrainerSlideBack(void); +void OpponentHandleFaintAnimation(void); +void OpponentHandleCmd11(void); +void OpponentHandleCmd12(void); +void OpponentHandleBallThrow(void); +void OpponentHandlePause(void); +void OpponentHandleMoveAnimation(void); +void OpponentHandlePrintString(void); +void OpponentHandlePrintStringPlayerOnly(void); +void OpponentHandleChooseAction(void); +void OpponentHandleCmd19(void); +void OpponentHandleChooseMove(void); +void OpponentHandleOpenBag(void); +void OpponentHandleChoosePokemon(void); +void OpponentHandleCmd23(void); +void OpponentHandleHealthBarUpdate(void); +void OpponentHandleExpUpdate(void); +void OpponentHandleStatusIconUpdate(void); +void OpponentHandleStatusAnimation(void); +void OpponentHandleStatusXor(void); +void OpponentHandleDataTransfer(void); +void OpponentHandleDMA3Transfer(void); +void OpponentHandlePlayBGM(void); +void OpponentHandleCmd32(void); +void OpponentHandleCmd33(void); +void OpponentHandleCmd34(void); +void OpponentHandleCmd35(void); +void OpponentHandleCmd36(void); +void OpponentHandleCmd37(void); +void OpponentHandleCmd38(void); +void OpponentHandleCmd39(void); +void OpponentHandleCmd40(void); +void OpponentHandleHitAnimation(void); +void OpponentHandleCmd42(void); +void OpponentHandleEffectivenessSound(void); +void OpponentHandlePlayFanfareOrBGM(void); +void OpponentHandleFaintingCry(void); +void OpponentHandleIntroSlide(void); +void OpponentHandleIntroTrainerBallThrow(void); +void OpponentHandleDrawPartyStatusSummary(void); +void OpponentHandleCmd49(void); +void OpponentHandleCmd50(void); +void OpponentHandleSpriteInvisibility(void); +void OpponentHandleBattleAnimation(void); +void OpponentHandleLinkStandbyMsg(void); +void OpponentHandleResetActionMoveSelection(void); +void OpponentHandleCmd55(void); +void nullsub_91(void); + +void OpponentBufferRunCommand(void); + +void (*const gOpponentBufferCommands[CONTOLLER_CMDS_CONT])(void) = +{ + OpponentHandleGetMonData, + OpponentHandleGetRawMonData, + OpponentHandleSetMonData, + OpponentHandleSetRawMonData, + OpponentHandleLoadMonSprite, + OpponentHandleSwitchInAnim, + OpponentHandleReturnMonToBall, + OpponentHandleDrawTrainerPic, + OpponentHandleTrainerSlide, + OpponentHandleTrainerSlideBack, + OpponentHandleFaintAnimation, + OpponentHandleCmd11, + OpponentHandleCmd12, + OpponentHandleBallThrow, + OpponentHandlePause, + OpponentHandleMoveAnimation, + OpponentHandlePrintString, + OpponentHandlePrintStringPlayerOnly, + OpponentHandleChooseAction, + OpponentHandleCmd19, + OpponentHandleChooseMove, + OpponentHandleOpenBag, + OpponentHandleChoosePokemon, + OpponentHandleCmd23, + OpponentHandleHealthBarUpdate, + OpponentHandleExpUpdate, + OpponentHandleStatusIconUpdate, + OpponentHandleStatusAnimation, + OpponentHandleStatusXor, + OpponentHandleDataTransfer, + OpponentHandleDMA3Transfer, + OpponentHandlePlayBGM, + OpponentHandleCmd32, + OpponentHandleCmd33, + OpponentHandleCmd34, + OpponentHandleCmd35, + OpponentHandleCmd36, + OpponentHandleCmd37, + OpponentHandleCmd38, + OpponentHandleCmd39, + OpponentHandleCmd40, + OpponentHandleHitAnimation, + OpponentHandleCmd42, + OpponentHandleEffectivenessSound, + OpponentHandlePlayFanfareOrBGM, + OpponentHandleFaintingCry, + OpponentHandleIntroSlide, + OpponentHandleIntroTrainerBallThrow, + OpponentHandleDrawPartyStatusSummary, + OpponentHandleCmd49, + OpponentHandleCmd50, + OpponentHandleSpriteInvisibility, + OpponentHandleBattleAnimation, + OpponentHandleLinkStandbyMsg, + OpponentHandleResetActionMoveSelection, + OpponentHandleCmd55, + nullsub_91 +}; + +// unknown unused data +static const u8 gUnknown_0831C7AC[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20}; + +void nullsub_26(void) +{ +} + +void SetBankFuncToOpponentBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = OpponentBufferRunCommand; +} diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c new file mode 100644 index 000000000..33807b39a --- /dev/null +++ b/src/battle_controller_player.c @@ -0,0 +1,1600 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "item.h" +#include "items.h" +#include "songs.h" +#include "sound.h" +#include "moves.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gAbsentBankFlags; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern u8 gUnknown_020244CC; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern u8 gMultiUsePlayerCursor; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; + +extern const struct BattleMove gBattleMoves[]; + +extern void dp11b_obj_instanciate(u8, u8, s8, s8); +extern void dp11b_obj_free(u8, u8); +extern void sub_800AC34(void); + +// this file's functions +void PlayerHandleGetMonData(void); +void PlayerHandleGetRawMonData(void); +void PlayerHandleSetMonData(void); +void PlayerHandleSetRawMonData(void); +void PlayerHandleLoadMonSprite(void); +void PlayerHandleSwitchInAnim(void); +void PlayerHandleReturnMonToBall(void); +void PlayerHandleDrawTrainerPic(void); +void PlayerHandleTrainerSlide(void); +void PlayerHandleTrainerSlideBack(void); +void PlayerHandleFaintAnimation(void); +void PlayerHandleCmd11(void); +void PlayerHandleCmd12(void); +void PlayerHandleBallThrow(void); +void PlayerHandlePause(void); +void PlayerHandleMoveAnimation(void); +void PlayerHandlePrintString(void); +void PlayerHandlePrintStringPlayerOnly(void); +void PlayerHandleChooseAction(void); +void PlayerHandleCmd19(void); +void PlayerHandleChooseMove(void); +void PlayerHandleOpenBag(void); +void PlayerHandleChoosePokemon(void); +void PlayerHandleCmd23(void); +void PlayerHandleHealthBarUpdate(void); +void PlayerHandleExpUpdate(void); +void PlayerHandleStatusIconUpdate(void); +void PlayerHandleStatusAnimation(void); +void PlayerHandleStatusXor(void); +void PlayerHandleDataTransfer(void); +void PlayerHandleDMA3Transfer(void); +void PlayerHandlePlayBGM(void); +void PlayerHandleCmd32(void); +void PlayerHandleCmd33(void); +void PlayerHandleCmd34(void); +void PlayerHandleCmd35(void); +void PlayerHandleCmd36(void); +void PlayerHandleCmd37(void); +void PlayerHandleCmd38(void); +void PlayerHandleCmd39(void); +void PlayerHandleCmd40(void); +void PlayerHandleHitAnimation(void); +void PlayerHandleCmd42(void); +void PlayerHandleEffectivenessSound(void); +void PlayerHandlePlayFanfareOrBGM(void); +void PlayerHandleFaintingCry(void); +void PlayerHandleIntroSlide(void); +void PlayerHandleIntroTrainerBallThrow(void); +void PlayerHandleDrawPartyStatusSummary(void); +void PlayerHandleCmd49(void); +void PlayerHandleCmd50(void); +void PlayerHandleSpriteInvisibility(void); +void PlayerHandleBattleAnimation(void); +void PlayerHandleLinkStandbyMsg(void); +void PlayerHandleResetActionMoveSelection(void); +void PlayerHandleCmd55(void); +void nullsub_22(void); + +void PlayerBufferRunCommand(void); +void HandleInputChooseTarget(void); +void HandleInputChooseMove(void); +void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1); +void MoveSelectionDestroyCursorAt(u8 cursorPos); +void MoveSelectionDisplayPpNumber(void); +void MoveSelectionDisplayPpString(void); +void MoveSelectionDisplayMoveType(void); +void MoveSelectionDisplayMoveNames(void); +void HandleMoveSwitchting(void); +void sub_8058FC0(void); +void sub_8059828(void); +void sub_80598E0(void); +void sub_8059544(u8 taskId); +void sub_8059330(u8 taskId); +void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); +void sub_8059400(u8 taskId); +void sub_80595A4(u8 taskId); +void PrintLinkStandbyMsg(void); + +void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + PlayerHandleGetMonData, + PlayerHandleGetRawMonData, + PlayerHandleSetMonData, + PlayerHandleSetRawMonData, + PlayerHandleLoadMonSprite, + PlayerHandleSwitchInAnim, + PlayerHandleReturnMonToBall, + PlayerHandleDrawTrainerPic, + PlayerHandleTrainerSlide, + PlayerHandleTrainerSlideBack, + PlayerHandleFaintAnimation, + PlayerHandleCmd11, + PlayerHandleCmd12, + PlayerHandleBallThrow, + PlayerHandlePause, + PlayerHandleMoveAnimation, + PlayerHandlePrintString, + PlayerHandlePrintStringPlayerOnly, + PlayerHandleChooseAction, + PlayerHandleCmd19, + PlayerHandleChooseMove, + PlayerHandleOpenBag, + PlayerHandleChoosePokemon, + PlayerHandleCmd23, + PlayerHandleHealthBarUpdate, + PlayerHandleExpUpdate, + PlayerHandleStatusIconUpdate, + PlayerHandleStatusAnimation, + PlayerHandleStatusXor, + PlayerHandleDataTransfer, + PlayerHandleDMA3Transfer, + PlayerHandlePlayBGM, + PlayerHandleCmd32, + PlayerHandleCmd33, + PlayerHandleCmd34, + PlayerHandleCmd35, + PlayerHandleCmd36, + PlayerHandleCmd37, + PlayerHandleCmd38, + PlayerHandleCmd39, + PlayerHandleCmd40, + PlayerHandleHitAnimation, + PlayerHandleCmd42, + PlayerHandleEffectivenessSound, + PlayerHandlePlayFanfareOrBGM, + PlayerHandleFaintingCry, + PlayerHandleIntroSlide, + PlayerHandleIntroTrainerBallThrow, + PlayerHandleDrawPartyStatusSummary, + PlayerHandleCmd49, + PlayerHandleCmd50, + PlayerHandleSpriteInvisibility, + PlayerHandleBattleAnimation, + PlayerHandleLinkStandbyMsg, + PlayerHandleResetActionMoveSelection, + PlayerHandleCmd55, + nullsub_22 +}; + +static const u8 sTargetIdentities[] = {IDENTITY_PLAYER_MON1, IDENTITY_PLAYER_MON2, IDENTITY_OPPONENT_MON2, IDENTITY_OPPONENT_MON1}; + +// unknown unused data +static const u8 gUnknown_0831C5FC[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58}; + +void nullsub_21(void) +{ +} + +void SetBankFuncToPlayerBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = PlayerBufferRunCommand; + gDoingBattleAnim = FALSE; + gUnknown_020244CC = 0; +} + +void PlayerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = PlayerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +void PlayerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gPlayerBufferCommands)) + gPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + PlayerBufferExecCompleted(); + } +} + +void CompleteOnBankSpritePosX_0(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + PlayerBufferExecCompleted(); +} + +void HandleInputChooseAction(void) +{ + u16 itemId = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + dp11b_obj_instanciate(gActiveBank, 1, 7, 1); + dp11b_obj_instanciate(gActiveBank, 0, 7, 1); + + if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) + gUnknown_020244CC++; + else + gUnknown_020244CC = 0; + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + switch (gActionSelectionCursor[gActiveBank]) + { + case ACTION_USE_MOVE: + EmitCmd33(1, ACTION_USE_MOVE, 0); + break; + case ACTION_USE_ITEM: + EmitCmd33(1, ACTION_USE_ITEM, 0); + break; + case ACTION_SWITCH: + EmitCmd33(1, ACTION_SWITCH, 0); + break; + case ACTION_RUN: + EmitCmd33(1, ACTION_RUN, 0); + break; + } + PlayerBufferExecCompleted(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gActionSelectionCursor[gActiveBank] & 1) // if is ACTION_USE_ITEM or ACTION_RUN + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gActionSelectionCursor[gActiveBank] & 1)) // if is ACTION_USE_MOVE or ACTION_SWITCH + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gActionSelectionCursor[gActiveBank] & 2) // if is ACTION_SWITCH or ACTION_RUN + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gActionSelectionCursor[gActiveBank] & 2)) // if is ACTION_USE_MOVE or ACTION_USE_ITEM + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) + { + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + && GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON2 + && !(gAbsentBankFlags & gBitTable[GetBankByIdentity(IDENTITY_PLAYER_MON1)]) + && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + if (gBattleBufferA[gActiveBank][1] == ACTION_USE_ITEM) + { + // Add item to bag if it is a ball + if (itemId <= ITEM_PREMIER_BALL) + AddBagItem(itemId, 1); + else + return; + } + PlaySE(SE_SELECT); + EmitCmd33(1, ACTION_CANCEL_PARTNER, 0); + PlayerBufferExecCompleted(); + } + } + else if (gMain.newKeys & START_BUTTON) + { + SwapHpBarsWithHpText(); + } +} + +void sub_80577F0(void) // unused +{ + dp11b_obj_free(gActiveBank, 1); + dp11b_obj_free(gActiveBank, 0); + gBattleBankFunc[gActiveBank] = HandleInputChooseTarget; +} + +void HandleInputChooseTarget(void) +{ + s32 i; + u8 identities[4]; + memcpy(identities, sTargetIdentities, ARRAY_COUNT(sTargetIdentities)); + + dp11b_obj_instanciate(gMultiUsePlayerCursor, 1, 0xF, 1); + + // what a weird loop + i = 0; + if (gNoOfAllBanks != 0) + { + do + { + if (i != gMultiUsePlayerCursor) + dp11b_obj_free(i, 1); + i++; + } while (i < gNoOfAllBanks); + } + + if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) + gUnknown_020244CC++; + else + gUnknown_020244CC = 0; + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + EmitCmd33(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + dp11b_obj_free(gMultiUsePlayerCursor, 1); + PlayerBufferExecCompleted(); + } + else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + dp11b_obj_instanciate(gActiveBank, 1, 7, 1); + dp11b_obj_instanciate(gActiveBank, 0, 7, 1); + dp11b_obj_free(gMultiUsePlayerCursor, 1); + } + else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP)) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + + do + { + u8 currSelIdentity = GetBankIdentity(gMultiUsePlayerCursor); + + for (i = 0; i < BATTLE_BANKS_COUNT; i++) + { + if (currSelIdentity == identities[i]) + break; + } + do + { + if (--i < 0) + i = 4; // UB: array out of range + gMultiUsePlayerCursor = GetBankByIdentity(identities[i]); + } while (gMultiUsePlayerCursor == gNoOfAllBanks); + + i = 0; + switch (GetBankIdentity(gMultiUsePlayerCursor)) + { + case IDENTITY_PLAYER_MON1: + case IDENTITY_PLAYER_MON2: + if (gActiveBank != gMultiUsePlayerCursor) + i++; + else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER) + i++; + break; + case IDENTITY_OPPONENT_MON1: + case IDENTITY_OPPONENT_MON2: + i++; + break; + } + + if (gAbsentBankFlags & gBitTable[gMultiUsePlayerCursor]) + i = 0; + } while (i == 0); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + } + else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN)) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + + do + { + u8 currSelIdentity = GetBankIdentity(gMultiUsePlayerCursor); + + for (i = 0; i < BATTLE_BANKS_COUNT; i++) + { + if (currSelIdentity == identities[i]) + break; + } + do + { + if (++i > 3) + i = 0; + gMultiUsePlayerCursor = GetBankByIdentity(identities[i]); + } while (gMultiUsePlayerCursor == gNoOfAllBanks); + + i = 0; + switch (GetBankIdentity(gMultiUsePlayerCursor)) + { + case IDENTITY_PLAYER_MON1: + case IDENTITY_PLAYER_MON2: + if (gActiveBank != gMultiUsePlayerCursor) + i++; + else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER) + i++; + break; + case IDENTITY_OPPONENT_MON1: + case IDENTITY_OPPONENT_MON2: + i++; + break; + } + + if (gAbsentBankFlags & gBitTable[gMultiUsePlayerCursor]) + i = 0; + } while (i == 0); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + } +} + +extern u8 gNumberOfMovesToChoose; +extern const u8 gText_BattleSwitchWhich[]; + +void HandleInputChooseMove(void) +{ + bool32 canSelectTarget = FALSE; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) + gUnknown_020244CC++; + else + gUnknown_020244CC = 0; + + if (gMain.newKeys & A_BUTTON) + { + u8 moveTarget; + + PlaySE(SE_SELECT); + if (moveInfo->moves[gMoveSelectionCursor[gActiveBank]] == MOVE_CURSE) + { + if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) + moveTarget = MOVE_TARGET_x10; + else + moveTarget = MOVE_TARGET_SELECTED; + } + else + { + moveTarget = gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBank]]].target; + } + + if (moveTarget & MOVE_TARGET_x10) + gMultiUsePlayerCursor = gActiveBank; + else + gMultiUsePlayerCursor = GetBankByIdentity((GetBankIdentity(gActiveBank) & BIT_SIDE) ^ BIT_SIDE); + + if (!gBattleBufferA[gActiveBank][1]) // not a double battle + { + if (moveTarget & MOVE_TARGET_USER && !gBattleBufferA[gActiveBank][2]) + canSelectTarget++; + } + else // double battle + { + if (!(moveTarget & (MOVE_TARGET_RANDOM | MOVE_TARGET_BOTH | MOVE_TARGET_DEPENDS | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_x10))) + canSelectTarget++; // either selected or user + + if (moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]] == 0) + { + canSelectTarget = FALSE; + } + else if (!(moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) <= 1) + { + gMultiUsePlayerCursor = GetDefaultMoveTarget(gActiveBank); + canSelectTarget = FALSE; + } + } + + if (!canSelectTarget) + { + EmitCmd33(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + PlayerBufferExecCompleted(); + } + else + { + gBattleBankFunc[gActiveBank] = HandleInputChooseTarget; + + if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) + gMultiUsePlayerCursor = gActiveBank; + else if (gAbsentBankFlags & gBitTable[GetBankByIdentity(IDENTITY_OPPONENT_MON1)]) + gMultiUsePlayerCursor = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + else + gMultiUsePlayerCursor = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + } + } + else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) + { + PlaySE(SE_SELECT); + EmitCmd33(1, 10, 0xFFFF); + PlayerBufferExecCompleted(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gMoveSelectionCursor[gActiveBank] & 1) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gMoveSelectionCursor[gActiveBank] & 1) + && (gMoveSelectionCursor[gActiveBank] ^ 1) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gMoveSelectionCursor[gActiveBank] & 2) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gMoveSelectionCursor[gActiveBank] & 2) + && (gMoveSelectionCursor[gActiveBank] ^ 2) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & SELECT_BUTTON) + { + if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK)) + { + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + + if (gMoveSelectionCursor[gActiveBank] != 0) + gMultiUsePlayerCursor = 0; + else + gMultiUsePlayerCursor = gMoveSelectionCursor[gActiveBank] + 1; + + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + sub_814F9EC(gText_BattleSwitchWhich, 0xB); + gBattleBankFunc[gActiveBank] = HandleMoveSwitchting; + } + } +} + +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; + +u32 sub_8057FBC(void) // unused +{ + u32 var = 0; + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + var = 1; + } + if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0x140; + var = 0xFF; + } + if (gMain.newKeys & DPAD_LEFT && gMoveSelectionCursor[gActiveBank] & 1) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + if (gMain.newKeys & DPAD_RIGHT && !(gMoveSelectionCursor[gActiveBank] & 1) + && (gMoveSelectionCursor[gActiveBank] ^ 1) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + if (gMain.newKeys & DPAD_UP && gMoveSelectionCursor[gActiveBank] & 2) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + if (gMain.newKeys & DPAD_DOWN && !(gMoveSelectionCursor[gActiveBank] & 2) + && (gMoveSelectionCursor[gActiveBank] ^ 2) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + + return var; +} + +void HandleMoveSwitchting(void) +{ + u8 perMovePPBonuses[4]; + struct ChooseMoveStruct moveStruct; + u8 totalPPBonuses; + + if (gMain.newKeys & (A_BUTTON | SELECT_BUTTON)) + { + PlaySE(SE_SELECT); + + if (gMoveSelectionCursor[gActiveBank] != gMultiUsePlayerCursor) + { + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + s32 i; + + // swap moves and pp + i = moveInfo->moves[gMoveSelectionCursor[gActiveBank]]; + moveInfo->moves[gMoveSelectionCursor[gActiveBank]] = moveInfo->moves[gMultiUsePlayerCursor]; + moveInfo->moves[gMultiUsePlayerCursor] = i; + + i = moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]]; + moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]] = moveInfo->currentPp[gMultiUsePlayerCursor]; + moveInfo->currentPp[gMultiUsePlayerCursor] = i; + + i = moveInfo->maxPp[gMoveSelectionCursor[gActiveBank]]; + moveInfo->maxPp[gMoveSelectionCursor[gActiveBank]] = moveInfo->maxPp[gMultiUsePlayerCursor]; + moveInfo->maxPp[gMultiUsePlayerCursor] = i; + + if (gDisableStructs[gActiveBank].unk18_b & gBitTable[gMoveSelectionCursor[gActiveBank]]) + { + gDisableStructs[gActiveBank].unk18_b &= (~gBitTable[gMoveSelectionCursor[gActiveBank]]); + gDisableStructs[gActiveBank].unk18_b |= gBitTable[gMultiUsePlayerCursor]; + } + + MoveSelectionDisplayMoveNames(); + + for (i = 0; i < 4; i++) + perMovePPBonuses[i] = (gBattleMons[gActiveBank].ppBonuses & (3 << (i * 2))) >> (i * 2); + + totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBank]]; + perMovePPBonuses[gMoveSelectionCursor[gActiveBank]] = perMovePPBonuses[gMultiUsePlayerCursor]; + perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; + + totalPPBonuses = 0; + for (i = 0; i < 4; i++) + totalPPBonuses |= perMovePPBonuses[i] << (i * 2); + + gBattleMons[gActiveBank].ppBonuses = totalPPBonuses; + + for (i = 0; i < 4; i++) + { + gBattleMons[gActiveBank].moves[i] = moveInfo->moves[i]; + gBattleMons[gActiveBank].pp[i] = moveInfo->currentPp[i]; + } + + if (!(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED)) + { + for (i = 0; i < 4; i++) + { + moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + i); + moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP1 + i); + } + + totalPPBonuses = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP_BONUSES); + for (i = 0; i < 4; i++) + perMovePPBonuses[i] = (totalPPBonuses & (3 << (i * 2))) >> (i * 2); + + i = moveStruct.moves[gMoveSelectionCursor[gActiveBank]]; + moveStruct.moves[gMoveSelectionCursor[gActiveBank]] = moveStruct.moves[gMultiUsePlayerCursor]; + moveStruct.moves[gMultiUsePlayerCursor] = i; + + i = moveStruct.currentPp[gMoveSelectionCursor[gActiveBank]]; + moveStruct.currentPp[gMoveSelectionCursor[gActiveBank]] = moveStruct.currentPp[gMultiUsePlayerCursor]; + moveStruct.currentPp[gMultiUsePlayerCursor] = i; + + totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBank]]; + perMovePPBonuses[gMoveSelectionCursor[gActiveBank]] = perMovePPBonuses[gMultiUsePlayerCursor]; + perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; + + totalPPBonuses = 0; + for (i = 0; i < 4; i++) + totalPPBonuses |= perMovePPBonuses[i] << (i * 2); + + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]); + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]); + } + + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP_BONUSES, &totalPPBonuses); + } + } + + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + gMoveSelectionCursor[gActiveBank] = gMultiUsePlayerCursor; + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpString(); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + else if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON)) + { + PlaySE(SE_SELECT); + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + MoveSelectionDisplayPpString(); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gMultiUsePlayerCursor & 1) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 1; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gMultiUsePlayerCursor & 1) && (gMultiUsePlayerCursor ^ 1) < gNumberOfMovesToChoose) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 1; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gMultiUsePlayerCursor & 2) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 2; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gMultiUsePlayerCursor & 2) && (gMultiUsePlayerCursor ^ 2) < gNumberOfMovesToChoose) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 2; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } +} + +extern u8 gBattleOutcome; +extern void sub_817E3F4(void); // battle_link_817C95C + +void sub_80586F8(void) +{ + if (gLinkVSyncDisabled == 0) + { + if (gReceivedRemoteLinkPlayers == 0) + { + m4aSongNumStop(SE_HINSI); + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(sub_8038D64); + if (gBattleOutcome == BATTLE_WON) + sub_817E3F4(); + FreeAllWindowBuffers(); + } + } + else + { + if (sub_800A520()) + { + m4aSongNumStop(SE_HINSI); + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(sub_8038D64); + if (gBattleOutcome == BATTLE_WON) + sub_817E3F4(); + FreeAllWindowBuffers(); + } + } +} + +void sub_80587B0(void) +{ + if (!gPaletteFade.active) + { + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (sub_800A520()) + { + if (gLinkVSyncDisabled == 0) + sub_800AC34(); + else + sub_800ADF8(); + + gBattleBankFunc[gActiveBank] = sub_80586F8; + } + } + else + { + m4aSongNumStop(SE_HINSI); + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(gMain.savedCallback); + } + } +} + +void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + PlayerBufferExecCompleted(); +} + +void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + PlayerBufferExecCompleted(); +} + +void sub_80588B4(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(gSaveBlock2Ptr->playerGender); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + PlayerBufferExecCompleted(); + } +} + +void sub_8058924(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + PlayerBufferExecCompleted(); + } +} + +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; + +extern bool8 IsDoubleBattle(void); + +void sub_805896C(void) +{ + bool8 var = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + var = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + var = TRUE; + } + + if (var && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + + if (IsDoubleBattle()) + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_8058924; + } +} + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_8076918(u8 bank); +extern u8 gUnknown_03005D7C[]; + +void sub_8058B40(void) +{ + bool32 r9 = FALSE; + bool32 r8 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 1; + } + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x40 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x40 + && !IsCryPlayingOrClearCrySongs()) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) + m4aMPlayContinue(&gMPlay_BGM); + else + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r9 = TRUE; + } + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + } + else + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + } + + if (r9 && r8) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_805896C; + } +} + +extern void sub_805E408(u8 bank); +extern void move_anim_start_t4(u8 arg0, u8 atkBank, u8 defBank, u8 tableId); + +void sub_8058EDC(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + sub_805E408(gActiveBank); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 6); + + gBattleBankFunc[gActiveBank] = sub_8058FC0; + } +} + +void sub_8058FC0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40 + && !IsCryPlayingOrClearCrySongs()) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlayerBufferExecCompleted(); + } +} + +void sub_805902C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_8058EDC; + } +} + +void c3_0802FDF4(u8 taskId) +{ + if (!IsCryPlayingOrClearCrySongs()) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + DestroyTask(taskId); + } +} + +void bx_t1_healthbar_update(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlayerBufferExecCompleted(); + } +} + +void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + PlayerBufferExecCompleted(); +} + +void sub_80591B8(u8 taskId) +{ + u32 monId = (u8)(gTasks[taskId].data[0]); + u8 bank = gTasks[taskId].data[2]; + s16 gainedExp = gTasks[taskId].data[1]; + + if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) + { + struct Pokemon *mon = &gPlayerParty[monId]; + u16 species = GetMonData(mon, MON_DATA_SPECIES); + u8 level = GetMonData(mon, MON_DATA_LEVEL); + u32 currExp = GetMonData(mon, MON_DATA_EXP); + u32 nextLvlExp = gExperienceTables[gBaseStats[species].growthRate][level + 1]; + + if (currExp + gainedExp >= nextLvlExp) + { + u8 savedActiveBank; + + SetMonData(mon, MON_DATA_EXP, &nextLvlExp); + CalculateMonStats(mon); + gainedExp -= nextLvlExp - currExp; + savedActiveBank = gActiveBank; + gActiveBank = bank; + EmitCmd33(1, 11, gainedExp); + gActiveBank = savedActiveBank; + + if (IsDoubleBattle() == TRUE + && ((u16)(monId) == gBattlePartyID[bank] || (u16)(monId) == gBattlePartyID[bank ^ BIT_MON])) + gTasks[taskId].func = sub_8059544; + else + gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + } + else + { + currExp += gainedExp; + SetMonData(mon, MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + else + { + gTasks[taskId].func = sub_8059330; + } +} + +void sub_8059330(u8 taskId) +{ + u8 monIndex = gTasks[taskId].data[0]; + s32 gainedExp = gTasks[taskId].data[1]; + u8 bank = gTasks[taskId].data[2]; + struct Pokemon *mon = &gPlayerParty[monIndex]; + u8 level = GetMonData(mon, MON_DATA_LEVEL); + u16 species = GetMonData(mon, MON_DATA_SPECIES); + u32 exp = GetMonData(mon, MON_DATA_EXP); + u32 currLvlExp = gExperienceTables[gBaseStats[species].growthRate][level]; + u32 expToNextLvl; + + exp -= currLvlExp; + expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp; + SetBattleBarStruct(bank, gHealthBoxesIds[bank], expToNextLvl, exp, -gainedExp); + PlaySE(SE_EXP); + gTasks[taskId].func = sub_8059400; +} + +void sub_8059400(u8 taskId) +{ + if (gTasks[taskId].data[10] < 13) + { + gTasks[taskId].data[10]++; + } + else + { + u8 monId = gTasks[taskId].data[0]; + s16 gainedExp = gTasks[taskId].data[1]; + u8 bank = gTasks[taskId].data[2]; + s16 r4; + + r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], 1, 0); + SetHealthboxSpriteVisible(gHealthBoxesIds[bank]); + if (r4 == -1) + { + u8 level; + s32 currExp; + u16 species; + s32 expOnNextLvl; + + m4aSongNumStop(SE_EXP); + level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + currExp = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + expOnNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1]; + + if (currExp + gainedExp >= expOnNextLvl) + { + u8 savedActiveBank; + + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &expOnNextLvl); + CalculateMonStats(&gPlayerParty[monId]); + gainedExp -= expOnNextLvl - currExp; + savedActiveBank = gActiveBank; + gActiveBank = bank; + EmitCmd33(1, 11, gainedExp); + gActiveBank = savedActiveBank; + gTasks[taskId].func = sub_8059544; + } + else + { + currExp += gainedExp; + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + } +} + +void sub_8059544(u8 taskId) +{ + u8 bank = gTasks[taskId].data[2]; + u8 monIndex = gTasks[taskId].data[0]; + + if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) + bank ^= BIT_MON; + + move_anim_start_t4(bank, bank, bank, 0); + gTasks[taskId].func = sub_80595A4; +} + +void sub_80595A4(u8 taskId) +{ + u8 bank = gTasks[taskId].data[2]; + + if (!gBattleSpritesDataPtr->healthBoxesData[bank].flag_x40) + { + u8 monIndex = gTasks[taskId].data[0]; + + GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value + + if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) + UpdateHealthboxAttribute(gHealthBoxesIds[bank ^ BIT_MON], &gPlayerParty[monIndex], HEALTHBOX_ALL); + else + UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL); + + gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + } +} + +void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) +{ + u8 monIndex; + u8 bank; + + monIndex = gTasks[taskId].data[0]; + GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value + bank = gTasks[taskId].data[2]; + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); +} + +void sub_80596A8(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos1.y + gSprites[gBankSpriteIds[gActiveBank]].pos2.y > DISPLAY_HEIGHT) + { + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + nullsub_24(species); + FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBank]].oam.matrixNum); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerBufferExecCompleted(); + } +} + +void sub_8059744(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerBufferExecCompleted(); + } +} + +void CompleteOnInactiveTextPrinter2(void) +{ + if (!IsTextPrinterActive(0)) + PlayerBufferExecCompleted(); +} + +extern void sub_81B89AC(u8 arg0); + +void sub_80597CC(void) +{ + if (!gPaletteFade.active) + { + u8 r4; + + gBattleBankFunc[gActiveBank] = sub_8059828; + r4 = gTasks[gUnknown_03005D7C[gActiveBank]].data[0]; + DestroyTask(gUnknown_03005D7C[gActiveBank]); + FreeAllWindowBuffers(); + sub_81B89AC(r4); + } +} + +extern u8 gUnknown_0203CEE8; +extern u8 gUnknown_0203CEE9; +extern u8 gUnknown_0203CF00[]; + +void sub_8059828(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + if (gUnknown_0203CEE8 == 1) + EmitCmd34(1, gUnknown_0203CEE9, gUnknown_0203CF00); + else + EmitCmd34(1, 6, NULL); + + if ((gBattleBufferA[gActiveBank][1] & 0xF) == 1) + PrintLinkStandbyMsg(); + + PlayerBufferExecCompleted(); + } +} + +extern void sub_81AABB0(void); +extern void nullsub_35(void); + +void sub_80598A4(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = sub_80598E0; + nullsub_35(); + FreeAllWindowBuffers(); + sub_81AABB0(); + } +} + +extern u16 gScriptItemId; + +void sub_80598E0(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitCmd35(1, gScriptItemId); + PlayerBufferExecCompleted(); + } +} + +void sub_805991C(void) +{ + if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + PlayerBufferExecCompleted(); +} + +void DoHitAnimBlinkEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + PlayerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +void sub_80599D4(void) +{ + if (gMain.newKeys & DPAD_UP && gMultiUsePlayerCursor != 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor); + gMultiUsePlayerCursor = 0; + BattleCreateYesNoCursorAt(0); + } + if (gMain.newKeys & DPAD_DOWN && gMultiUsePlayerCursor == 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor); + gMultiUsePlayerCursor = 1; + BattleCreateYesNoCursorAt(1); + } + if (gMain.newKeys & A_BUTTON) + { + sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor != 0) + EmitCmd33(1, 0xE, 0); + else + EmitCmd33(1, 0xD, 0); + + PlayerBufferExecCompleted(); + } + if (gMain.newKeys & B_BUTTON) + { + sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + PlaySE(SE_SELECT); + PlayerBufferExecCompleted(); + } +} + +extern const u8 gText_MoveInterfacePP[]; +extern const u8 gText_MoveInterfaceType[]; + +void MoveSelectionDisplayMoveNames(void) +{ + s32 i; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + gNumberOfMovesToChoose = 0; + + for (i = 0; i < 4; i++) + { + MoveSelectionDestroyCursorAt(i); + StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]); + sub_814F9EC(gDisplayedStringBattle, i + 3); + if (moveInfo->moves[i] != MOVE_NONE) + gNumberOfMovesToChoose++; + } +} + +void MoveSelectionDisplayPpString(void) +{ + StringCopy(gDisplayedStringBattle, gText_MoveInterfacePP); + sub_814F9EC(gDisplayedStringBattle, 7); +} + +void MoveSelectionDisplayPpNumber(void) +{ + u8 *txtPtr; + struct ChooseMoveStruct *moveInfo; + + if (gBattleBufferA[gActiveBank][2] == TRUE) // check if we didn't want to display pp number + return; + + SetPpNumbersPaletteInMoveSelection(); + moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + txtPtr = ConvertIntToDecimalStringN(gDisplayedStringBattle, moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]], STR_CONV_MODE_RIGHT_ALIGN, 2); + txtPtr[0] = CHAR_SLASH; + txtPtr++; + ConvertIntToDecimalStringN(txtPtr, moveInfo->maxPp[gMoveSelectionCursor[gActiveBank]], STR_CONV_MODE_RIGHT_ALIGN, 2); + + sub_814F9EC(gDisplayedStringBattle, 9); +} + +extern const u8 gTypeNames[][7]; + +void MoveSelectionDisplayMoveType(void) +{ + u8 *txtPtr; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); + txtPtr[0] = EXT_CTRL_CODE_BEGIN; + txtPtr++; + txtPtr[0] = 6; + txtPtr++; + txtPtr[0] = 1; + txtPtr++; + + StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBank]]].type]); + sub_814F9EC(gDisplayedStringBattle, 10); +} + +void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +{ + u16 src[2]; + src[0] = arg1 + 1; + src[1] = arg1 + 2; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 9 * (cursorPosition & 1) + 1, 55 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +void MoveSelectionDestroyCursorAt(u8 cursorPosition) +{ + u16 src[2]; + src[0] = 0x1016; + src[1] = 0x1016; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 9 * (cursorPosition & 1) + 1, 55 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +void ActionSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +{ + u16 src[2]; + src[0] = 1; + src[1] = 2; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 7 * (cursorPosition & 1) + 16, 35 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +void ActionSelectionDestroyCursorAt(u8 cursorPosition) +{ + u16 src[2]; + src[0] = 0x1016; + src[1] = 0x1016; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 7 * (cursorPosition & 1) + 16, 35 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +void SetCB2ToReshowScreenAfterMenu(void) +{ + SetMainCallback2(ReshowBattleScreenAfterMenu); +} + +void SetCB2ToReshowScreenAfterMenu2(void) +{ + SetMainCallback2(ReshowBattleScreenAfterMenu); +} + +void sub_8059D60(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x10) + PlayerBufferExecCompleted(); +} + +void sub_8059D90(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x20) + PlayerBufferExecCompleted(); +} + +extern const u8 gText_LinkStandby[]; + +void PrintLinkStandbyMsg(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + sub_814F9EC(gText_LinkStandby, 0); + } +} diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c new file mode 100644 index 000000000..e7594a2f0 --- /dev/null +++ b/src/battle_controller_wally.c @@ -0,0 +1,147 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "link.h" + +extern u8 gActiveBank; +extern bool8 gDoingBattleAnim; +extern u8 gUnknown_020244CC; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); + +// this file's functions +void WallyHandleGetMonData(void); +void WallyHandleGetRawMonData(void); +void WallyHandleSetMonData(void); +void WallyHandleSetRawMonData(void); +void WallyHandleLoadMonSprite(void); +void WallyHandleSwitchInAnim(void); +void WallyHandleReturnMonToBall(void); +void WallyHandleDrawTrainerPic(void); +void WallyHandleTrainerSlide(void); +void WallyHandleTrainerSlideBack(void); +void WallyHandleFaintAnimation(void); +void WallyHandleCmd11(void); +void WallyHandleCmd12(void); +void WallyHandleBallThrow(void); +void WallyHandlePause(void); +void WallyHandleMoveAnimation(void); +void WallyHandlePrintString(void); +void WallyHandlePrintStringPlayerOnly(void); +void WallyHandleChooseAction(void); +void WallyHandleCmd19(void); +void WallyHandleChooseMove(void); +void WallyHandleOpenBag(void); +void WallyHandleChoosePokemon(void); +void WallyHandleCmd23(void); +void WallyHandleHealthBarUpdate(void); +void WallyHandleExpUpdate(void); +void WallyHandleStatusIconUpdate(void); +void WallyHandleStatusAnimation(void); +void WallyHandleStatusXor(void); +void WallyHandleDataTransfer(void); +void WallyHandleDMA3Transfer(void); +void WallyHandlePlayBGM(void); +void WallyHandleCmd32(void); +void WallyHandleCmd33(void); +void WallyHandleCmd34(void); +void WallyHandleCmd35(void); +void WallyHandleCmd36(void); +void WallyHandleCmd37(void); +void WallyHandleCmd38(void); +void WallyHandleCmd39(void); +void WallyHandleCmd40(void); +void WallyHandleHitAnimation(void); +void WallyHandleCmd42(void); +void WallyHandleEffectivenessSound(void); +void WallyHandlePlayFanfareOrBGM(void); +void WallyHandleFaintingCry(void); +void WallyHandleIntroSlide(void); +void WallyHandleIntroTrainerBallThrow(void); +void WallyHandleDrawPartyStatusSummary(void); +void WallyHandleCmd49(void); +void WallyHandleCmd50(void); +void WallyHandleSpriteInvisibility(void); +void WallyHandleBattleAnimation(void); +void WallyHandleLinkStandbyMsg(void); +void WallyHandleResetActionMoveSelection(void); +void WallyHandleCmd55(void); +void nullsub_118(void); + +void WallyBufferRunCommand(void); + +void (*const gWallyBufferCommands[CONTOLLER_CMDS_CONT])(void) = +{ + WallyHandleGetMonData, + WallyHandleGetRawMonData, + WallyHandleSetMonData, + WallyHandleSetRawMonData, + WallyHandleLoadMonSprite, + WallyHandleSwitchInAnim, + WallyHandleReturnMonToBall, + WallyHandleDrawTrainerPic, + WallyHandleTrainerSlide, + WallyHandleTrainerSlideBack, + WallyHandleFaintAnimation, + WallyHandleCmd11, + WallyHandleCmd12, + WallyHandleBallThrow, + WallyHandlePause, + WallyHandleMoveAnimation, + WallyHandlePrintString, + WallyHandlePrintStringPlayerOnly, + WallyHandleChooseAction, + WallyHandleCmd19, + WallyHandleChooseMove, + WallyHandleOpenBag, + WallyHandleChoosePokemon, + WallyHandleCmd23, + WallyHandleHealthBarUpdate, + WallyHandleExpUpdate, + WallyHandleStatusIconUpdate, + WallyHandleStatusAnimation, + WallyHandleStatusXor, + WallyHandleDataTransfer, + WallyHandleDMA3Transfer, + WallyHandlePlayBGM, + WallyHandleCmd32, + WallyHandleCmd33, + WallyHandleCmd34, + WallyHandleCmd35, + WallyHandleCmd36, + WallyHandleCmd37, + WallyHandleCmd38, + WallyHandleCmd39, + WallyHandleCmd40, + WallyHandleHitAnimation, + WallyHandleCmd42, + WallyHandleEffectivenessSound, + WallyHandlePlayFanfareOrBGM, + WallyHandleFaintingCry, + WallyHandleIntroSlide, + WallyHandleIntroTrainerBallThrow, + WallyHandleDrawPartyStatusSummary, + WallyHandleCmd49, + WallyHandleCmd50, + WallyHandleSpriteInvisibility, + WallyHandleBattleAnimation, + WallyHandleLinkStandbyMsg, + WallyHandleResetActionMoveSelection, + WallyHandleCmd55, + nullsub_118 +}; + +void nullsub_117(void) +{ +} + +void SetBankFuncToWallyBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = WallyBufferRunCommand; + gBattleStruct->field_94 = 0; + gBattleStruct->field_95 = 0; + gBattleStruct->field_96 = 0; + gBattleStruct->field_97 = 0; +} diff --git a/src/battle_interface.c b/src/battle_interface.c index 9241db1d9..2318517f5 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -27,12 +27,6 @@ enum EXP_BAR }; -enum -{ - HP_CURRENT, - HP_MAX -}; - struct TestingBar { s32 maxValue; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a1e5767ad..4ba86775e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6118,22 +6118,22 @@ static void atk5A_yesnoboxlearnmove(void) sub_814F9EC(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { @@ -6235,22 +6235,22 @@ static void atk5B_yesnoboxstoplearningmove(void) sub_814F9EC(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { @@ -6531,22 +6531,22 @@ static void atk67_yesnobox(void) sub_814F9EC(gText_BattleYesNoChoice, 0xC); gBattleCommunication[0]++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & B_BUTTON) { @@ -11286,7 +11286,7 @@ void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) } } -void BattleCreateCursorAt(u8 cursorPosition) +void BattleCreateYesNoCursorAt(u8 cursorPosition) { u16 src[2]; src[0] = 1; @@ -11296,7 +11296,7 @@ void BattleCreateCursorAt(u8 cursorPosition) CopyBgTilemapBufferToVram(0); } -void BattleDestroyCursorAt(u8 cursorPosition) +void BattleDestroyYesNoCursorAt(u8 cursorPosition) { u16 src[2]; src[0] = 0x1016; @@ -11315,22 +11315,22 @@ static void atkF3_nickname_caught_poke(void) sub_814F9EC(gText_BattleYesNoChoice, 0xC); gBattleCommunication[MULTIUSE_STATE]++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { diff --git a/src/pokemon_2.c b/src/pokemon_2.c index 27441f952..972e1943a 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -84,7 +84,7 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 bank) return FALSE; } -u8 sub_8069F34(u8 bank) +u8 GetDefaultMoveTarget(u8 bank) { u8 status = GetBankIdentity(bank) & 1; diff --git a/sym_common.txt b/sym_common.txt index acc6cf862..996463bb8 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -221,10 +221,10 @@ gBattleBankFunc: @ 3005D60 gHealthBoxesIds: @ 3005D70 .space 0x4 -gUnknown_03005D74: @ 3005D74 +gMultiUsePlayerCursor: @ 3005D74 .space 0x4 -gUnknown_03005D78: @ 3005D78 +gNumberOfMovesToChoose: @ 3005D78 .space 0x4 gUnknown_03005D7C: @ 3005D7C