From 3d1c16523e277b0b4044e685aa118c15aaaeffe9 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 21 Oct 2017 17:32:35 +0200 Subject: [PATCH 01/29] 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 From 813b1bfd4a8f0fc316e78b39abaaafd09a42f0c4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 22 Oct 2017 01:04:02 +0200 Subject: [PATCH 02/29] label and do more work at player controller --- asm/battle_1.s | 26 +- asm/battle_7.s | 44 +- asm/battle_controller_linkopponent.s | 20 +- asm/battle_controller_linkpartner.s | 14 +- asm/battle_controller_opponent.s | 28 +- asm/battle_controller_player.s | 3884 +-------------------- asm/battle_controller_player_partner.s | 22 +- asm/battle_controller_recorded_opponent.s | 24 +- asm/battle_controller_recorded_player.s | 26 +- asm/battle_controller_safari.s | 12 +- asm/battle_controller_wally.s | 22 +- asm/battle_frontier_1.s | 6 +- asm/battle_frontier_2.s | 20 +- asm/battle_transition.s | 2 +- asm/evolution_scene.s | 34 +- asm/pokedex.s | 2 +- asm/rom_80A5C6C.s | 8 +- include/battle.h | 13 +- include/battle_controllers.h | 91 +- include/battle_message.h | 2 +- include/battle_script_commands.h | 6 +- include/global.h | 2 + include/pokemon.h | 3 + src/battle_2.c | 24 +- src/battle_ai_switch_items.c | 18 +- src/battle_controller_linkopponent.c | 2 +- src/battle_controller_opponent.c | 2 +- src/battle_controller_player.c | 1110 +++++- src/battle_controller_wally.c | 2 +- src/battle_controllers.c | 36 +- src/battle_message.c | 2 +- src/battle_script_commands.c | 48 +- src/pokemon_2.c | 5 +- src/pokemon_3.c | 2 +- src/reshow_battle_screen.c | 4 +- sym_ewram.txt | 2 +- 36 files changed, 1411 insertions(+), 4157 deletions(-) diff --git a/asm/battle_1.s b/asm/battle_1.s index 9a981e222..9665b0d11 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -1888,7 +1888,7 @@ sub_8035C4C: @ 8035C4C bne _08035C68 ldr r0, =gText_Draw movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035C68: @@ -1964,10 +1964,10 @@ _08035CE2: _08035CFC: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D20: @@ -1985,19 +1985,19 @@ _08035D20: _08035D36: ldr r0, =gText_Win movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D58: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08035D68: pop {r0} bx r0 @@ -2068,14 +2068,14 @@ _08035DDC: _08035DE6: adds r0, r1, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 b _08035E14 _08035DF4: adds r0, r1, 0 movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 str r0, [sp] @@ -2085,7 +2085,7 @@ _08035DF4: _08035E08: adds r0, r1, 0 movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 _08035E14: @@ -2099,7 +2099,7 @@ _08035E1A: _08035E22: adds r0, r1, 0 movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 str r0, [sp] @@ -2139,14 +2139,14 @@ _08035E66: adds r1, r0, r4 adds r0, r1, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter lsls r0, r6, 3 subs r0, r6 lsls r0, 2 adds r1, r0, r4 adds r0, r1, 0 movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0x7 str r4, [sp] adds r0, r7, 0 diff --git a/asm/battle_7.s b/asm/battle_7.s index ea6fc40b3..394cb9571 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -1258,11 +1258,11 @@ _0805DB76: .pool thumb_func_end task0A_08034248 - thumb_func_start sub_805DB8C -sub_805DB8C: @ 805DB8C + thumb_func_start IsMoveWithoutAnimation +IsMoveWithoutAnimation: @ 805DB8C movs r0, 0 bx lr - thumb_func_end sub_805DB8C + thumb_func_end IsMoveWithoutAnimation thumb_func_start mplay_80342A4 mplay_80342A4: @ 805DB90 @@ -1357,7 +1357,7 @@ BattleLoadOpponentMonSpriteGfx: @ 805DC0C .pool _0805DC50: ldrh r5, [r2, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r6, [r0] _0805DC58: @@ -1510,7 +1510,7 @@ BattleLoadPlayerMonSpriteGfx: @ 805DD7C .pool _0805DDC0: ldrh r5, [r2, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r4, [r0] _0805DDC8: @@ -1670,8 +1670,8 @@ nullsub_24: @ 805DF34 bx lr thumb_func_end nullsub_24 - thumb_func_start sub_805DF38 -sub_805DF38: @ 805DF38 + thumb_func_start DecompressTrainerFrontPic +DecompressTrainerFrontPic: @ 805DF38 push {r4,lr} adds r4, r0, 0 adds r0, r1, 0 @@ -1701,10 +1701,10 @@ sub_805DF38: @ 805DF38 pop {r0} bx r0 .pool - thumb_func_end sub_805DF38 + thumb_func_end DecompressTrainerFrontPic - thumb_func_start LoadBackTrainerBankSpriteGfx -LoadBackTrainerBankSpriteGfx: @ 805DF84 + thumb_func_start DecompressTrainerBackPic +DecompressTrainerBackPic: @ 805DF84 push {r4,r5,lr} adds r5, r0, 0 adds r4, r1, 0 @@ -1742,15 +1742,15 @@ LoadBackTrainerBankSpriteGfx: @ 805DF84 pop {r0} bx r0 .pool - thumb_func_end LoadBackTrainerBankSpriteGfx + thumb_func_end DecompressTrainerBackPic thumb_func_start nullsub_25 nullsub_25: @ 805DFE0 bx lr thumb_func_end nullsub_25 - thumb_func_start sub_805DFE4 -sub_805DFE4: @ 805DFE4 + thumb_func_start FreeTrainerFrontPicPalette +FreeTrainerFrontPicPalette: @ 805DFE4 push {lr} lsls r0, 16 ldr r1, =gTrainerFrontPicPaletteTable @@ -1761,7 +1761,7 @@ sub_805DFE4: @ 805DFE4 pop {r0} bx r0 .pool - thumb_func_end sub_805DFE4 + thumb_func_end FreeTrainerFrontPicPalette thumb_func_start sub_805DFFC sub_805DFFC: @ 805DFFC @@ -2441,7 +2441,7 @@ _0805E59C: adds r1, 0x4 adds r1, r2 ldr r1, [r1] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities lsls r2, r7, 2 adds r2, r3 ldr r3, [r2] @@ -2479,7 +2479,7 @@ _0805E618: adds r1, 0x4 adds r1, r2 ldr r1, [r1] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities lsls r2, r7, 2 adds r2, r3 ldr r3, [r2] @@ -2795,8 +2795,8 @@ _0805E93E: bx r0 thumb_func_end refresh_graphics_maybe - thumb_func_start sub_805E94C -sub_805E94C: @ 805E94C + thumb_func_start TrySetBehindSubstituteSpriteBit +TrySetBehindSubstituteSpriteBit: @ 805E94C push {lr} lsls r0, 24 lsrs r2, r0, 24 @@ -2817,7 +2817,7 @@ _0805E96C: pop {r0} bx r0 .pool - thumb_func_end sub_805E94C + thumb_func_end TrySetBehindSubstituteSpriteBit thumb_func_start sub_805E974 sub_805E974: @ 805E974 @@ -3572,8 +3572,8 @@ _0805EF6A: .pool thumb_func_end sub_805EF14 - thumb_func_start sub_805EF84 -sub_805EF84: @ 805EF84 + thumb_func_start ClearTemporarySpeciesSpriteData +ClearTemporarySpeciesSpriteData: @ 805EF84 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -3598,7 +3598,7 @@ _0805EFAC: pop {r0} bx r0 .pool - thumb_func_end sub_805EF84 + thumb_func_end ClearTemporarySpeciesSpriteData thumb_func_start AllocateMonSpritesGfx AllocateMonSpritesGfx: @ 805EFBC diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index 82e3b162e..1cc9191c0 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -113,7 +113,7 @@ sub_8064470: @ 8064470 bne _080644C2 adds r0, r2, r5 ldrh r0, [r0, 0x6] - bl sub_805DFE4 + bl FreeTrainerFrontPicPalette ldrb r0, [r4] adds r0, r6 ldrb r1, [r0] @@ -3718,7 +3718,7 @@ sub_8066494: @ 8066494 lsls r1, 24 lsrs r1, 24 adds r0, r6, 0 - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r0, =gBattlePartyID lsls r4, r6, 1 adds r4, r0 @@ -4248,7 +4248,7 @@ _0806693A: lsls r1, 2 adds r1, r6 ldrb r0, [r1, 0x13] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId _08066948: lsls r0, 16 lsrs r0, 16 @@ -4256,7 +4256,7 @@ _0806694C: mov r8, r0 ldr r5, =gActiveBank ldrb r1, [r5] - bl sub_805DF38 + bl DecompressTrainerFrontPic ldrb r0, [r5] bl GetBankIdentity adds r1, r0, 0 @@ -4385,7 +4385,7 @@ _08066A76: mov r8, r0 ldr r6, =gActiveBank ldrb r1, [r6] - bl sub_805DF38 + bl DecompressTrainerFrontPic ldrb r0, [r6] bl GetBankIdentity adds r1, r0, 0 @@ -4781,7 +4781,7 @@ _08066D32: adds r0, 0x10 adds r1, r0 str r1, [r7] - ldr r2, =gUnknown_020244BC + ldr r2, =gTransformedPersonalities ldrb r0, [r5] lsls r0, 2 adds r0, r2 @@ -4790,7 +4790,7 @@ _08066D32: mov r0, r8 ldrb r1, [r0] adds r0, r6, 0 - bl sub_805DB8C + bl IsMoveWithoutAnimation lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -4991,7 +4991,7 @@ _08066FA8: ldrb r2, [r2] lsls r2, 8 orrs r1, r2 - bl sub_805E94C + bl TrySetBehindSubstituteSpriteBit ldr r0, [r7] ldrb r1, [r6] ldr r2, [r0, 0x4] @@ -5028,7 +5028,7 @@ LinkOpponentHandlePrintString: @ 8066FF4 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -5845,7 +5845,7 @@ sub_80676FC: @ 80676FC push {r4,lr} adds r4, r0, 0 ldrh r0, [r4, 0x6] - bl sub_805DFE4 + bl FreeTrainerFrontPicPalette adds r0, r4, 0 bl FreeSpriteOamMatrix adds r0, r4, 0 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index adc5cdb84..54b3b5f8a 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -3265,7 +3265,7 @@ sub_814CC28: @ 814CC28 adds r6, r4, 0x2 adds r1, r6 ldrb r1, [r1] - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r2, =gBattlePartyID ldrb r0, [r5] lsls r1, r0, 1 @@ -3314,7 +3314,7 @@ sub_814CC98: @ 814CC98 lsls r1, 24 lsrs r1, 24 adds r0, r6, 0 - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r0, =gBattlePartyID lsls r2, r6, 1 adds r2, r0 @@ -3696,7 +3696,7 @@ _0814D002: ldr r5, =gActiveBank ldrb r1, [r5] adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx + bl DecompressTrainerBackPic ldrb r0, [r5] bl GetBankIdentity adds r1, r0, 0 @@ -4107,7 +4107,7 @@ _0814D2CE: adds r0, 0x10 adds r1, r0 str r1, [r7] - ldr r2, =gUnknown_020244BC + ldr r2, =gTransformedPersonalities ldrb r0, [r5] lsls r0, 2 adds r0, r2 @@ -4116,7 +4116,7 @@ _0814D2CE: mov r0, r8 ldrb r1, [r0] adds r0, r6, 0 - bl sub_805DB8C + bl IsMoveWithoutAnimation lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -4317,7 +4317,7 @@ _0814D544: ldrb r2, [r2] lsls r2, 8 orrs r1, r2 - bl sub_805E94C + bl TrySetBehindSubstituteSpriteBit ldr r0, [r7] ldrb r1, [r6] ldr r2, [r0, 0x4] @@ -4354,7 +4354,7 @@ sub_814D590: @ 814D590 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index db86779c4..d4df7ea94 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -112,7 +112,7 @@ sub_805F240: @ 805F240 bne _0805F292 adds r0, r2, r5 ldrh r0, [r0, 0x6] - bl sub_805DFE4 + bl FreeTrainerFrontPicPalette ldrb r0, [r4] adds r0, r6 ldrb r1, [r0] @@ -3879,7 +3879,7 @@ sub_80613DC: @ 80613DC lsls r1, 24 lsrs r1, 24 adds r0, r6, 0 - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r0, =gBattlePartyID lsls r4, r6, 1 adds r4, r0 @@ -4311,7 +4311,7 @@ _080617CA: ldr r5, =gActiveBank ldrb r1, [r5] mov r0, r8 - bl sub_805DF38 + bl DecompressTrainerFrontPic ldrb r0, [r5] bl GetBankIdentity adds r1, r0, 0 @@ -4537,7 +4537,7 @@ _080619DE: mov r8, r0 ldr r6, =gActiveBank ldrb r1, [r6] - bl sub_805DF38 + bl DecompressTrainerFrontPic ldrb r0, [r6] bl GetBankIdentity adds r1, r0, 0 @@ -4928,14 +4928,14 @@ _08061C8A: adds r1, 0x10 adds r2, r1 str r2, [r3] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities ldrb r1, [r6] lsls r1, 2 adds r1, r3 ldr r2, [r2] str r2, [r1] ldrb r1, [r5] - bl sub_805DB8C + bl IsMoveWithoutAnimation lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -5130,7 +5130,7 @@ _08061EE8: ldrb r2, [r2] lsls r2, 8 orrs r1, r2 - bl sub_805E94C + bl TrySetBehindSubstituteSpriteBit ldr r0, [r7] ldrb r1, [r6] ldr r2, [r0, 0x4] @@ -5167,7 +5167,7 @@ OpponentHandlePrintString: @ 8061F34 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -5225,7 +5225,7 @@ OpponentHandleChooseMove: @ 8061FB8 movs r0, 0x1 movs r1, 0xA _08061FD6: - bl EmitCmd33 + bl EmitChoiceReturnValue _08061FDA: bl OpponentBufferExecCompleted b _08062156 @@ -5329,7 +5329,7 @@ _0806209C: movs r0, 0x1 movs r1, 0xA adds r2, r4, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue b _08061FDA .pool _080620C4: @@ -5360,7 +5360,7 @@ _080620C6: movs r0, 0x1 movs r1, 0xA adds r2, r4, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue b _08062152 .pool _08062108: @@ -5383,7 +5383,7 @@ _08062108: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue b _08062152 .pool _0806213C: @@ -5395,7 +5395,7 @@ _0806213C: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue _08062152: bl OpponentBufferExecCompleted _08062156: @@ -6196,7 +6196,7 @@ sub_806280C: @ 806280C push {r4,lr} adds r4, r0, 0 ldrh r0, [r4, 0x6] - bl sub_805DFE4 + bl FreeTrainerFrontPicPalette adds r0, r4, 0 bl FreeSpriteOamMatrix adds r0, r4, 0 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index a86cd7ffe..efad0fb13 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -5,3886 +5,6 @@ .text - - - - thumb_func_start PlayerHandleGetMonData -PlayerHandleGetMonData: @ 8059DF4 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08059E2C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_player_pokemon_ - adds r6, r0, 0 - b _08059E4E - .pool -_08059E2C: - ldrb r4, [r1] - movs r5, 0 -_08059E30: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08059E46 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_player_pokemon_ - adds r6, r0 -_08059E46: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08059E30 -_08059E4E: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl PlayerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end PlayerHandleGetMonData - - thumb_func_start dp01_getattr_by_ch1_for_player_pokemon_ -dp01_getattr_by_ch1_for_player_pokemon_: @ 8059E68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _08059E92 - bl _0805A5FE -_08059E92: - lsls r0, 2 - ldr r1, =_08059EA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08059EA8: - .4byte _08059F98 - .4byte _0805A1BC - .4byte _0805A1CC - .4byte _0805A1DC - .4byte _0805A244 - .4byte _0805A244 - .4byte _0805A244 - .4byte _0805A244 - .4byte _0805A260 - .4byte _0805A29C - .4byte _0805A29C - .4byte _0805A29C - .4byte _0805A29C - .4byte _0805A5FE - .4byte _0805A5FE - .4byte _0805A5FE - .4byte _0805A5FE - .4byte _0805A2B8 - .4byte _0805A2C8 - .4byte _0805A2F8 - .4byte _0805A308 - .4byte _0805A318 - .4byte _0805A328 - .4byte _0805A338 - .4byte _0805A348 - .4byte _0805A358 - .4byte _0805A368 - .4byte _0805A378 - .4byte _0805A388 - .4byte _0805A398 - .4byte _0805A3A8 - .4byte _0805A3B8 - .4byte _0805A408 - .4byte _0805A418 - .4byte _0805A428 - .4byte _0805A438 - .4byte _0805A448 - .4byte _0805A458 - .4byte _0805A468 - .4byte _0805A478 - .4byte _0805A488 - .4byte _0805A4BC - .4byte _0805A4CC - .4byte _0805A4DC - .4byte _0805A4EC - .4byte _0805A4FC - .4byte _0805A50C - .4byte _0805A51C - .4byte _0805A52C - .4byte _0805A54C - .4byte _0805A55C - .4byte _0805A56C - .4byte _0805A57C - .4byte _0805A58C - .4byte _0805A59C - .4byte _0805A5AC - .4byte _0805A5BC - .4byte _0805A5CC - .4byte _0805A5DC - .4byte _0805A5EC -_08059F98: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08059FE4: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08059FE4 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_0805A19C: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _0805A19C - b _0805A5FE - .pool -_0805A1BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _0805A536 - .pool -_0805A1CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _0805A536 - .pool -_0805A1DC: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_0805A1F2: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0805A1F2 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0805A230: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0805A230 - b _0805A5FE - .pool -_0805A244: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _0805A536 - .pool -_0805A260: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_0805A26C: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805A26C - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0805A5FE - .pool -_0805A29C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _0805A5F6 - .pool -_0805A2B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0805A2D2 - .pool -_0805A2C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0805A2D2: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0805A5FE - .pool -_0805A2F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _0805A5F6 - .pool -_0805A308: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _0805A5F6 - .pool -_0805A318: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _0805A5F6 - .pool -_0805A328: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _0805A5F6 - .pool -_0805A338: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _0805A5F6 - .pool -_0805A348: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _0805A5F6 - .pool -_0805A358: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _0805A5F6 - .pool -_0805A368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _0805A5F6 - .pool -_0805A378: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _0805A5F6 - .pool -_0805A388: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _0805A5F6 - .pool -_0805A398: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _0805A5F6 - .pool -_0805A3A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _0805A5F6 - .pool -_0805A3B8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0805A5FE - .pool -_0805A408: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _0805A5F6 - .pool -_0805A418: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _0805A5F6 - .pool -_0805A428: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _0805A5F6 - .pool -_0805A438: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _0805A5F6 - .pool -_0805A448: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _0805A5F6 - .pool -_0805A458: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _0805A5F6 - .pool -_0805A468: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0805A492 - .pool -_0805A478: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _0805A536 - .pool -_0805A488: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0805A492: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0805A5FE - .pool -_0805A4BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _0805A5F6 - .pool -_0805A4CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _0805A536 - .pool -_0805A4DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _0805A536 - .pool -_0805A4EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _0805A536 - .pool -_0805A4FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _0805A536 - .pool -_0805A50C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _0805A536 - .pool -_0805A51C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _0805A536 - .pool -_0805A52C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_0805A536: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0805A5FE - .pool -_0805A54C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _0805A5F6 - .pool -_0805A55C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _0805A5F6 - .pool -_0805A56C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _0805A5F6 - .pool -_0805A57C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _0805A5F6 - .pool -_0805A58C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _0805A5F6 - .pool -_0805A59C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _0805A5F6 - .pool -_0805A5AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _0805A5F6 - .pool -_0805A5BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _0805A5F6 - .pool -_0805A5CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _0805A5F6 - .pool -_0805A5DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _0805A5F6 - .pool -_0805A5EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_0805A5F6: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0805A5FE: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_player_pokemon_ - - thumb_func_start PlayerHandleGetRawMonData -PlayerHandleGetRawMonData: @ 805A614 - push {r4-r7,lr} - sub sp, 0x58 - ldr r2, =gBattlePartyID - ldr r5, =gActiveBank - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - adds r4, r2, 0 - muls r4, r0 - ldr r3, =gBattleBufferA - lsls r1, 9 - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r2, [r0] - ldr r0, =gPlayerParty - adds r0, r2, r0 - adds r6, r4, r0 - mov r0, sp - adds r4, r0, r2 - movs r2, 0 - adds r0, r3, 0x2 - adds r1, r0 - adds r7, r5, 0 - mov r12, r3 - ldrb r1, [r1] - cmp r2, r1 - bcs _0805A66A - adds r3, r0, 0 -_0805A650: - adds r1, r4, r2 - adds r0, r6, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldrb r0, [r5] - lsls r0, 9 - adds r0, r3 - ldrb r0, [r0] - cmp r2, r0 - bcc _0805A650 -_0805A66A: - ldrb r0, [r7] - lsls r0, 9 - mov r1, r12 - adds r1, 0x2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - adds r2, r4, 0 - bl EmitDataTransfer - bl PlayerBufferExecCompleted - add sp, 0x58 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleGetRawMonData - - thumb_func_start PlayerHandleSetMonData -PlayerHandleSetMonData: @ 805A69C - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0805A6CC - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl dp01_setattr_by_ch1_for_player_pokemon - b _0805A6EA - .pool -_0805A6CC: - ldrb r4, [r1] - movs r5, 0 -_0805A6D0: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0805A6DE - adds r0, r5, 0 - bl dp01_setattr_by_ch1_for_player_pokemon -_0805A6DE: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0805A6D0 -_0805A6EA: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end PlayerHandleSetMonData - - thumb_func_start dp01_setattr_by_ch1_for_player_pokemon -dp01_setattr_by_ch1_for_player_pokemon: @ 805A6F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _0805A720 - bl _0805B0BA -_0805A720: - lsls r0, 2 - ldr r1, =_0805A738 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0805A738: - .4byte _0805A828 - .4byte _0805A9C0 - .4byte _0805A9E0 - .4byte _0805AA00 - .4byte _0805AA58 - .4byte _0805AA58 - .4byte _0805AA58 - .4byte _0805AA58 - .4byte _0805AA80 - .4byte _0805AAE4 - .4byte _0805AAE4 - .4byte _0805AAE4 - .4byte _0805AAE4 - .4byte _0805B0BA - .4byte _0805B0BA - .4byte _0805B0BA - .4byte _0805B0BA - .4byte _0805AB14 - .4byte _0805AB34 - .4byte _0805AB54 - .4byte _0805AB74 - .4byte _0805AB94 - .4byte _0805ABB4 - .4byte _0805ABD4 - .4byte _0805ABF4 - .4byte _0805AC14 - .4byte _0805AC34 - .4byte _0805AC54 - .4byte _0805AC74 - .4byte _0805AC94 - .4byte _0805ACB4 - .4byte _0805ACD4 - .4byte _0805AD44 - .4byte _0805AD64 - .4byte _0805AD84 - .4byte _0805ADA4 - .4byte _0805ADC4 - .4byte _0805ADE4 - .4byte _0805AE04 - .4byte _0805AE24 - .4byte _0805AE44 - .4byte _0805AE64 - .4byte _0805AE84 - .4byte _0805AEA4 - .4byte _0805AEC4 - .4byte _0805AEE4 - .4byte _0805AF04 - .4byte _0805AF24 - .4byte _0805AF44 - .4byte _0805AF64 - .4byte _0805AF84 - .4byte _0805AFA4 - .4byte _0805AFC4 - .4byte _0805AFE4 - .4byte _0805B004 - .4byte _0805B024 - .4byte _0805B044 - .4byte _0805B064 - .4byte _0805B084 - .4byte _0805B0A4 -_0805A828: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_0805A88E: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0805A88E - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0805B0BA - .pool -_0805A9C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _0805B0BA - .pool -_0805A9E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _0805B0BA - .pool -_0805AA00: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0805AA1A: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0805AA1A - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0805B0BA - .pool -_0805AA58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0805AAFC - .pool -_0805AA80: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0805B0BA - .pool -_0805AAE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0805AAFC: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0805B0BA - .pool -_0805AB14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _0805B0BA - .pool -_0805AB34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _0805B0BA - .pool -_0805AB54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _0805B0BA - .pool -_0805AB74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _0805B0BA - .pool -_0805AB94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _0805B0BA - .pool -_0805ABB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _0805B0BA - .pool -_0805ABD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _0805B0BA - .pool -_0805ABF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _0805B0BA - .pool -_0805AC14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _0805B0BA - .pool -_0805AC34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _0805B0BA - .pool -_0805AC54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _0805B0BA - .pool -_0805AC74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _0805B0BA - .pool -_0805AC94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _0805B0BA - .pool -_0805ACB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _0805B0BA - .pool -_0805ACD4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _0805ADF4 - .pool -_0805AD44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _0805B0BA - .pool -_0805AD64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _0805B0BA - .pool -_0805AD84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _0805B0BA - .pool -_0805ADA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _0805B0BA - .pool -_0805ADC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _0805B0BA - .pool -_0805ADE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_0805ADF4: - movs r1, 0x2C - bl SetMonData - b _0805B0BA - .pool -_0805AE04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _0805B0BA - .pool -_0805AE24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _0805B0BA - .pool -_0805AE44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _0805B0BA - .pool -_0805AE64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _0805B0BA - .pool -_0805AE84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _0805B0BA - .pool -_0805AEA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _0805B0BA - .pool -_0805AEC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _0805B0BA - .pool -_0805AEE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _0805B0BA - .pool -_0805AF04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _0805B0BA - .pool -_0805AF24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _0805B0BA - .pool -_0805AF44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _0805B0BA - .pool -_0805AF64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _0805B0BA - .pool -_0805AF84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _0805B0BA - .pool -_0805AFA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _0805B0BA - .pool -_0805AFC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _0805B0BA - .pool -_0805AFE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _0805B0BA - .pool -_0805B004: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _0805B0BA - .pool -_0805B024: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _0805B0BA - .pool -_0805B044: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _0805B0BA - .pool -_0805B064: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _0805B0BA - .pool -_0805B084: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _0805B0BA - .pool -_0805B0A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_0805B0BA: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - 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 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01_setattr_by_ch1_for_player_pokemon - - thumb_func_start PlayerHandleSetRawMonData -PlayerHandleSetRawMonData: @ 805B0F0 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _0805B148 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_0805B126: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _0805B126 -_0805B148: - bl PlayerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleSetRawMonData - - thumb_func_start PlayerHandleLoadMonSprite -PlayerHandleLoadMonSprite: @ 805B164 - push {r4,lr} - ldr r2, =gBattlePartyID - ldr r4, =gActiveBank - 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 BattleLoadPlayerMonSpriteGfx - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =CompleteOnBankSpritePosX_0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleLoadMonSprite - - thumb_func_start PlayerHandleSwitchInAnim -PlayerHandleSwitchInAnim: @ 805B1CC - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl sub_805EF84 - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - movs r4, 0 - strh r0, [r1] - 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 BattleLoadPlayerMonSpriteGfx - ldr r1, =gActionSelectionCursor - ldrb r0, [r5] - adds r0, r1 - strb r4, [r0] - ldr r1, =gMoveSelectionCursor - ldrb r0, [r5] - adds r0, r1 - strb r4, [r0] - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_805B258 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805902C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleSwitchInAnim - - thumb_func_start sub_805B258 -sub_805B258: @ 805B258 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_805EF84 - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B258 - - thumb_func_start PlayerHandleReturnMonToBall -PlayerHandleReturnMonToBall: @ 805B3D4 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0805B41C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805B464 - str r1, [r0] - b _0805B452 - .pool -_0805B41C: - 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 -_0805B452: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleReturnMonToBall - - thumb_func_start sub_805B464 -sub_805B464: @ 805B464 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0805B48C - cmp r0, 0x1 - beq _0805B4BA - b _0805B4E2 - .pool -_0805B48C: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805B4A6 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0805B4A6: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0805B4E2 -_0805B4BA: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0805B4E2 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059744 - str r1, [r0] -_0805B4E2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B464 - - thumb_func_start PlayerHandleDrawTrainerPic -PlayerHandleDrawTrainerPic: @ 805B4F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0805B5B4 - bl GetMultiplayerId - ldr r5, =gLinkPlayers - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0805B538 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0805B558 -_0805B538: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x2 - b _0805B5BA - .pool -_0805B558: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0805B58A - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _0805B5A0 -_0805B58A: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x4 - b _0805B5BA -_0805B5A0: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r4, [r1, 0x13] - b _0805B5BA -_0805B5B4: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r4, [r0, 0x8] -_0805B5BA: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0x40 - ands r1, r2 - adds r5, r0, 0 - cmp r1, 0 - beq _0805B63C - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r0, 0x20 - mov r9, r0 - cmp r1, 0 - beq _0805B5E0 - movs r1, 0x5A - mov r9, r1 -_0805B5E0: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _0805B618 - ldr r0, =gPartnerTrainerId - ldrh r1, [r0] - ldr r0, =0x00000c03 - cmp r1, r0 - beq _0805B618 - movs r0, 0x5A - mov r9, r0 - ldr r1, =gTrainerFrontPicCoords - b _0805B642 - .pool -_0805B618: - ldr r1, =gTrainerBackPicCoords - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 - ldr r5, =gBattleTypeFlags - b _0805B656 - .pool -_0805B63C: - movs r0, 0x50 - mov r9, r0 - ldr r1, =gTrainerBackPicCoords -_0805B642: - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 -_0805B656: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - bne _0805B664 - b _0805B794 -_0805B664: - ldr r0, =gPartnerTrainerId - ldrh r1, [r0] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _0805B670 - b _0805B794 -_0805B670: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bl sub_806F000 - lsls r0, 16 - lsrs r4, r0, 16 - adds r5, r4, 0 - ldr r6, =gActiveBank - ldrb r1, [r6] - adds r0, r5, 0 - bl sub_805DF38 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_806A1C0 - ldr r0, =gUnknown_0202499C - mov r8, r0 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r0, =gTrainerFrontPicPaletteTable - lsls r5, 3 - adds r5, r0 - ldrh r0, [r5, 0x4] - bl IndexOfSpritePaletteTag - ldr r5, =gSprites - ldrb r1, [r6] - adds r1, r4 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x30 - strh r1, [r0, 0x26] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_805D7AC - str r1, [r0] - ldrb r0, [r6] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - b _0805B82A - .pool -_0805B794: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r9 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] -_0805B82A: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =CompleteOnBankSpriteCallbackDummy - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleDrawTrainerPic - - thumb_func_start PlayerHandleTrainerSlide -PlayerHandleTrainerSlide: @ 805B864 - push {r4-r6,lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0805B920 - bl GetMultiplayerId - ldr r5, =gLinkPlayers - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0805B8A6 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0805B8C4 -_0805B8A6: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x2 - b _0805B926 - .pool -_0805B8C4: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0805B8F6 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _0805B90C -_0805B8F6: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x4 - b _0805B926 -_0805B90C: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r4, [r1, 0x13] - b _0805B926 -_0805B920: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r4, [r0, 0x8] -_0805B926: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - lsls r4, 2 - adds r4, r1 - ldrb r1, [r4] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffa0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =CompleteOnBankSpriteCallbackDummy2 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleTrainerSlide - - thumb_func_start PlayerHandleTrainerSlideBack -PlayerHandleTrainerSlideBack: @ 805B9F8 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80588B4 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleTrainerSlideBack - - thumb_func_start PlayerHandleFaintAnimation -PlayerHandleFaintAnimation: @ 805BAB8 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _0805BB0C - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805BAEC - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0805BAEC: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _0805BB82 - .pool -_0805BB0C: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0805BB82 - strb r4, [r3, 0x4] - 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 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80596A8 - str r1, [r0] -_0805BB82: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleFaintAnimation - - thumb_func_start PlayerHandleCmd11 -PlayerHandleCmd11: @ 805BBA4 - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r1, 0x2 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl PlayerBufferExecCompleted - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd11 - - thumb_func_start PlayerHandleCmd12 -PlayerHandleCmd12: @ 805BBC4 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x3 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805991C - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd12 - - thumb_func_start PlayerHandleBallThrow -PlayerHandleBallThrow: @ 805BC18 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x3 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805991C - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleBallThrow - - thumb_func_start PlayerHandlePause -PlayerHandlePause: @ 805BC78 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0805BC96 -_0805BC8C: - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0805BC8C -_0805BC96: - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandlePause - - thumb_func_start PlayerHandleMoveAnimation -PlayerHandleMoveAnimation: @ 805BCA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _0805BCBE - b _0805BDE4 -_0805BCBE: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r1, [r5] - lsls r1, 9 - adds r0, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - mov r0, r12 - adds r0, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r6, r0 - ldr r0, =gAnimMoveTurn - mov r8, r0 - mov r0, r12 - adds r0, 0x3 - adds r1, r0 - ldrb r0, [r1] - mov r1, r8 - strb r0, [r1] - ldr r3, =gAnimMovePower - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x4 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x5 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r3] - ldr r3, =gAnimMoveDmg - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x6 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x7 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - mov r0, r12 - adds r0, 0x8 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r2, r0 - mov r0, r12 - adds r0, 0x9 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 24 - orrs r2, r0 - str r2, [r3] - ldr r2, =gAnimFriendship - ldrb r0, [r5] - lsls r0, 9 - mov r1, r12 - adds r1, 0xA - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r4, =gWeatherMoveAnim - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0xC - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0xD - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r4] - ldr r7, =gAnimDisableStructPtr - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x10 - adds r1, r0 - str r1, [r7] - ldr r2, =gUnknown_020244BC - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - str r1, [r0] - mov r0, r8 - ldrb r1, [r0] - adds r0, r6, 0 - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0805BDBC - bl PlayerBufferExecCompleted - b _0805BDE4 - .pool -_0805BDBC: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_1 - str r1, [r0] - ldrh r1, [r4] - ldr r2, [r7] - adds r0, r6, 0 - bl sub_817E0FC -_0805BDE4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleMoveAnimation - - thumb_func_start bx_move_anim_1 -bx_move_anim_1: @ 805BDFC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0805BE94 - cmp r2, 0x1 - bgt _0805BE54 - cmp r2, 0 - beq _0805BE5E - b _0805BF70 - .pool -_0805BE54: - cmp r2, 0x2 - beq _0805BEBE - cmp r2, 0x3 - beq _0805BF34 - b _0805BF70 -_0805BE5E: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _0805BE80 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0805BE80: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0805BF70 -_0805BE94: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805BF70 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0805BF70 -_0805BEBE: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0805BF70 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _0805BF0C - mov r0, r8 - cmp r0, 0x1 - bhi _0805BF0C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0805BF0C: - 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 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0805BF70 - .pool -_0805BF34: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0805BF70 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl PlayerBufferExecCompleted -_0805BF70: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_1 - - thumb_func_start PlayerHandlePrintString -PlayerHandlePrintString: @ 805BF80 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =CompleteOnInactiveTextPrinter2 - str r1, [r0] - ldrh r0, [r4] - bl sub_817C95C - ldrb r0, [r5] - ldrh r1, [r4] - bl sub_81A57E4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandlePrintString - - thumb_func_start PlayerHandlePrintStringPlayerOnly -PlayerHandlePrintStringPlayerOnly: @ 805BFE0 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0805BFFC - bl PlayerHandlePrintString - b _0805C000 - .pool -_0805BFFC: - bl PlayerBufferExecCompleted -_0805C000: - pop {r0} - bx r0 - thumb_func_end PlayerHandlePrintStringPlayerOnly - - thumb_func_start sub_805C004 -sub_805C004: @ 805C004 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0805C02A - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =HandleInputChooseAction - str r1, [r0] -_0805C02A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C004 - - thumb_func_start PlayerHandleChooseAction -PlayerHandleChooseAction: @ 805C044 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805C004 - str r1, [r0] - bl sub_817F2A8 - ldr r0, =gText_BattleMenu - movs r1, 0x2 - bl sub_814F9EC - movs r4, 0 -_0805C062: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _0805C062 - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillPkmnDo - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl sub_814F9EC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleChooseAction - - thumb_func_start PlayerHandleCmd19 -PlayerHandleCmd19: @ 805C0B0 - push {r4,lr} - sub sp, 0x4 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0805C108 - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - ldr r0, =gText_BattleYesNoChoice - movs r1, 0xC - bl sub_814F9EC - ldr r1, =gMultiUsePlayerCursor - movs r0, 0x1 - strb r0, [r1] - movs r0, 0x1 - bl BattleCreateYesNoCursorAt - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80599D4 - str r1, [r0] - b _0805C10C - .pool -_0805C108: - bl PlayerBufferExecCompleted -_0805C10C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd19 thumb_func_start sub_805C114 sub_805C114: @ 805C114 @@ -3941,7 +61,7 @@ sub_805C158: @ 805C158 lsrs r2, 16 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue bl PlayerBufferExecCompleted _0805C194: pop {r0} @@ -4661,7 +781,7 @@ PlayerHandleCmd33: @ 805C80C movs r0, 0x1 movs r1, 0 movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue bl PlayerBufferExecCompleted pop {r0} bx r0 diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index f82e1c3c3..c7ba486a8 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -645,7 +645,7 @@ _081BB2E2: lsrs r2, 16 movs r0, 0x1 movs r1, 0xB - bl EmitCmd33 + bl EmitChoiceReturnValue strb r5, [r4] bl IsDoubleBattle lsls r0, 24 @@ -918,7 +918,7 @@ _081BB514: lsrs r2, 16 movs r0, 0x1 movs r1, 0xB - bl EmitCmd33 + bl EmitChoiceReturnValue strb r5, [r4] ldr r0, =sub_81BB628 str r0, [r6] @@ -3840,7 +3840,7 @@ sub_81BD074: @ 81BD074 adds r6, r4, 0x2 adds r1, r6 ldrb r1, [r1] - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r2, =gBattlePartyID ldrb r0, [r5] lsls r1, r0, 1 @@ -3889,7 +3889,7 @@ sub_81BD0E4: @ 81BD0E4 lsls r1, 24 lsrs r1, 24 adds r0, r6, 0 - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r0, =gBattlePartyID lsls r2, r6, 1 adds r2, r0 @@ -4213,7 +4213,7 @@ _081BD3BE: ldr r5, =gActiveBank ldrb r1, [r5] adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx + bl DecompressTrainerBackPic ldrb r0, [r5] bl GetBankIdentity adds r1, r0, 0 @@ -4287,7 +4287,7 @@ _081BD494: ldr r6, =gActiveBank ldrb r1, [r6] adds r0, r5, 0 - bl sub_805DF38 + bl DecompressTrainerFrontPic ldrb r0, [r6] bl GetBankIdentity adds r1, r0, 0 @@ -4727,14 +4727,14 @@ _081BD7A2: adds r1, 0x10 adds r2, r1 str r2, [r3] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities ldrb r1, [r6] lsls r1, 2 adds r1, r3 ldr r2, [r2] str r2, [r1] ldrb r1, [r5] - bl sub_805DB8C + bl IsMoveWithoutAnimation lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -4929,7 +4929,7 @@ _081BDA00: ldrb r2, [r2] lsls r2, 8 orrs r1, r2 - bl sub_805E94C + bl TrySetBehindSubstituteSpriteBit ldr r0, [r7] ldrb r1, [r6] ldr r2, [r0, 0x4] @@ -4966,7 +4966,7 @@ sub_81BDA4C: @ 81BDA4C bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -5068,7 +5068,7 @@ _081BDB3C: orrs r2, r5 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue bl PlayerPartnerBufferExecCompleted pop {r4-r6} pop {r0} diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index f98c10a6c..189d41771 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -129,7 +129,7 @@ sub_81865C8: @ 81865C8 bne _0818661A adds r0, r2, r5 ldrh r0, [r0, 0x6] - bl sub_805DFE4 + bl FreeTrainerFrontPicPalette ldrb r0, [r4] adds r0, r6 ldrb r1, [r0] @@ -3716,7 +3716,7 @@ sub_81885D8: @ 81885D8 lsls r1, 24 lsrs r1, 24 adds r0, r6, 0 - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r0, =gBattlePartyID lsls r4, r6, 1 adds r4, r0 @@ -4078,7 +4078,7 @@ _08188910: adds r0, r2 ldrb r0, [r0, 0x13] _08188924: - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId _08188928: lsls r0, 16 lsrs r0, 16 @@ -4086,7 +4086,7 @@ _0818892C: mov r8, r0 ldr r5, =gActiveBank ldrb r1, [r5] - bl sub_805DF38 + bl DecompressTrainerFrontPic ldrb r0, [r5] bl GetBankIdentity adds r1, r0, 0 @@ -4483,14 +4483,14 @@ _08188BE6: adds r1, 0x10 adds r2, r1 str r2, [r3] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities ldrb r1, [r6] lsls r1, 2 adds r1, r3 ldr r2, [r2] str r2, [r1] ldrb r1, [r5] - bl sub_805DB8C + bl IsMoveWithoutAnimation lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -4685,7 +4685,7 @@ _08188E44: ldrb r2, [r2] lsls r2, 8 orrs r1, r2 - bl sub_805E94C + bl TrySetBehindSubstituteSpriteBit ldr r0, [r7] ldrb r1, [r6] ldr r2, [r0, 0x4] @@ -4722,7 +4722,7 @@ sub_8188E90: @ 8188E90 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -4754,7 +4754,7 @@ sub_8188EF0: @ 8188EF0 lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 @@ -4785,7 +4785,7 @@ sub_8188F20: @ 8188F20 lsrs r2, 16 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue b _08188F6C .pool _08188F48: @@ -4803,7 +4803,7 @@ _08188F48: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue _08188F6C: bl RecordedOpponentBufferExecCompleted pop {r4,r5} @@ -5601,7 +5601,7 @@ sub_818962C: @ 818962C push {r4,lr} adds r4, r0, 0 ldrh r0, [r4, 0x6] - bl sub_805DFE4 + bl FreeTrainerFrontPicPalette adds r0, r4, 0 bl FreeSpriteOamMatrix adds r0, r4, 0 diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 6f3976205..a5702f5a0 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -3641,7 +3641,7 @@ sub_818B9FC: @ 818B9FC adds r6, r4, 0x2 adds r1, r6 ldrb r1, [r1] - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r2, =gBattlePartyID ldrb r0, [r5] lsls r1, r0, 1 @@ -3690,7 +3690,7 @@ sub_818BA6C: @ 818BA6C lsls r1, 24 lsrs r1, 24 adds r0, r6, 0 - bl sub_805EF84 + bl ClearTemporarySpeciesSpriteData ldr r0, =gBattlePartyID lsls r2, r6, 1 adds r2, r0 @@ -4063,14 +4063,14 @@ _0818BDC0: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r4, r0, 16 adds r5, r4, 0 ldr r6, =gActiveBank ldrb r1, [r6] adds r0, r5, 0 - bl sub_805DF38 + bl DecompressTrainerFrontPic ldrb r0, [r6] bl GetBankIdentity adds r1, r0, 0 @@ -4182,7 +4182,7 @@ _0818BEDC: ldr r5, =gActiveBank ldrb r1, [r5] adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx + bl DecompressTrainerBackPic ldrb r0, [r5] bl GetBankIdentity adds r1, r0, 0 @@ -4583,14 +4583,14 @@ _0818C192: adds r1, 0x10 adds r2, r1 str r2, [r3] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities ldrb r1, [r6] lsls r1, 2 adds r1, r3 ldr r2, [r2] str r2, [r1] ldrb r1, [r5] - bl sub_805DB8C + bl IsMoveWithoutAnimation lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -4785,7 +4785,7 @@ _0818C3F0: ldrb r2, [r2] lsls r2, 8 orrs r1, r2 - bl sub_805E94C + bl TrySetBehindSubstituteSpriteBit ldr r0, [r7] ldrb r1, [r6] ldr r2, [r0, 0x4] @@ -4822,7 +4822,7 @@ sub_818C43C: @ 818C43C bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -4861,7 +4861,7 @@ sub_818C49C: @ 818C49C lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue bl RecordedPlayerBufferExecCompleted _0818C4C6: pop {r0} @@ -4897,7 +4897,7 @@ _0818C508: lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue bl RecordedPlayerBufferExecCompleted _0818C522: pop {r0} @@ -4929,7 +4929,7 @@ sub_818C538: @ 818C538 lsrs r2, 16 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue b _0818C584 .pool _0818C560: @@ -4947,7 +4947,7 @@ _0818C560: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue _0818C584: bl RecordedPlayerBufferExecCompleted pop {r4,r5} diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index d7efd69fe..9745fa7c8 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -103,13 +103,13 @@ _0815942A: movs r1, 0x7 _0815942E: movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue b _08159440 _08159436: movs r0, 0x1 movs r1, 0x8 movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue _08159440: bl SafariBufferExecCompleted b _0815954E @@ -569,7 +569,7 @@ sub_8159800: @ 8159800 ldrb r0, [r0, 0x8] ldr r5, =gActiveBank ldrb r1, [r5] - bl LoadBackTrainerBankSpriteGfx + bl DecompressTrainerBackPic ldr r0, [r4] ldrb r6, [r0, 0x8] ldrb r0, [r5] @@ -792,7 +792,7 @@ dp01t_10_6_message: @ 81599DC bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -862,7 +862,7 @@ sub_8159A94: @ 8159A94 str r1, [r0] ldr r0, =gText_SafariZoneMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _08159AAE: lsls r0, r4, 24 @@ -882,7 +882,7 @@ _08159AAE: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index 02d33e87e..473582d0e 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -121,7 +121,7 @@ _081684CE: movs r1, 0x9 _081684E4: movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue bl WallyBufferExecCompleted ldr r1, [r4] adds r1, 0x94 @@ -176,7 +176,7 @@ _08168540: movs r0, 0x1 movs r1, 0x1 movs r2, 0 - bl EmitCmd33 + bl EmitChoiceReturnValue bl WallyBufferExecCompleted _08168564: pop {r4,r5} @@ -2998,7 +2998,7 @@ WallyHandleDrawTrainerPic: @ 8169EC8 ldr r4, =gActiveBank ldrb r1, [r4] movs r0, 0x6 - bl LoadBackTrainerBankSpriteGfx + bl DecompressTrainerBackPic ldrb r0, [r4] bl GetBankIdentity adds r1, r0, 0 @@ -3083,7 +3083,7 @@ WallyHandleTrainerSlide: @ 8169F94 ldr r4, =gActiveBank ldrb r1, [r4] movs r0, 0x6 - bl LoadBackTrainerBankSpriteGfx + bl DecompressTrainerBackPic ldrb r0, [r4] bl GetBankIdentity adds r1, r0, 0 @@ -3359,14 +3359,14 @@ WallyHandleMoveAnimation: @ 816A144 adds r1, 0x10 adds r2, r1 str r2, [r3] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities ldrb r1, [r6] lsls r1, 2 adds r1, r3 ldr r2, [r2] str r2, [r1] ldrb r1, [r5] - bl sub_805DB8C + bl IsMoveWithoutAnimation lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -3538,7 +3538,7 @@ _0816A370: ldrb r2, [r2] lsls r2, 8 orrs r1, r2 - bl sub_805E94C + bl TrySetBehindSubstituteSpriteBit ldr r0, [r7] ldrb r1, [r6] ldr r2, [r0, 0x4] @@ -3574,7 +3574,7 @@ WallyHandlePrintString: @ 816A3B8 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -3644,7 +3644,7 @@ WallyHandleChooseAction: @ 816A470 str r1, [r0] ldr r0, =gText_BattleMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _0816A48A: lsls r0, r4, 24 @@ -3664,7 +3664,7 @@ _0816A48A: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 @@ -3745,7 +3745,7 @@ _0816A550: lsls r2, 1 movs r0, 0x1 movs r1, 0xA - bl EmitCmd33 + bl EmitChoiceReturnValue bl WallyBufferExecCompleted _0816A574: pop {r4} diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index 7ac60f1be..799e93e4f 100755 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -6956,7 +6956,7 @@ _08192574: cmp r2, r0 bne _08192598 ldrb r0, [r1, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 b _081925B6 @@ -8535,7 +8535,7 @@ _081932A2: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 mov r2, r8 @@ -8621,7 +8621,7 @@ _0819335A: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 b _081933B0 diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 37ddc7ac6..ac92b3c2a 100755 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -20557,7 +20557,7 @@ _081A5306: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow b _081A553E .pool _081A531C: @@ -20582,29 +20582,29 @@ _081A5328: ldr r4, =gDisplayedStringBattle adds r0, r4, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Vs movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_OpponentMon1Name bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Mind movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Skill movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Body movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Judgement bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _081A553E .pool _081A53B4: @@ -20688,7 +20688,7 @@ _081A5464: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r0, [r5] adds r0, 0x1 strb r0, [r5] @@ -20733,7 +20733,7 @@ _081A54D4: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0 bl CopyBgTilemapBufferToVram ldr r0, =gMPlay_BGM diff --git a/asm/battle_transition.s b/asm/battle_transition.s index 2f9637594..6ffa17320 100644 --- a/asm/battle_transition.s +++ b/asm/battle_transition.s @@ -4348,7 +4348,7 @@ sub_8148218: @ 8148218 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 24 lsrs r0, 24 movs r1, 0x88 diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index 2e2221192..1dd5cb4f1 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -1338,7 +1338,7 @@ _0813E6E4: bl StringExpandPlaceholders adds r0, r4, 0 movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r2, r8 adds r1, r2, r7 @@ -1626,7 +1626,7 @@ _0813E99E: bl StringExpandPlaceholders adds r0, r4, 0 movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =0x00000173 bl PlayBGM ldr r2, =gTasks @@ -1868,7 +1868,7 @@ _0813EBE4: _0813EBEC: ldr r0, =gStringVar4 movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gTasks mov r2, r8 adds r0, r2, r7 @@ -1900,7 +1900,7 @@ _0813EC2A: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r3, r8 adds r1, r3, r7 @@ -1997,7 +1997,7 @@ _0813ED16: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r2, r8 adds r1, r2, r7 @@ -2026,7 +2026,7 @@ _0813ED62: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r3, r8 adds r1, r3, r7 @@ -2051,7 +2051,7 @@ _0813ED90: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r2, r8 adds r1, r2, r7 @@ -2084,10 +2084,10 @@ _0813EDEA: movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow ldr r0, =gText_BattleYesNoChoice movs r1, 0xC - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r3, r8 adds r1, r3, r7 @@ -2152,7 +2152,7 @@ _0813EE84: movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0x5 bl PlaySE ldr r0, =gBattleCommunication @@ -2202,7 +2202,7 @@ _0813EF00: movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0x5 bl PlaySE ldr r1, =gTasks @@ -2292,7 +2292,7 @@ _0813EFC8: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gTasks mov r2, r8 adds r0, r2, r7 @@ -2341,7 +2341,7 @@ _0813F05C: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r2, r8 adds r1, r2, r7 @@ -2370,7 +2370,7 @@ _0813F0AA: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gTasks mov r3, r8 adds r1, r3, r7 @@ -2398,7 +2398,7 @@ _0813F0D8: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gTasks mov r2, r8 adds r0, r2, r7 @@ -2414,7 +2414,7 @@ _0813F120: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gTasks mov r3, r8 adds r0, r3, r7 @@ -2434,7 +2434,7 @@ _0813F154: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gTasks mov r2, r8 adds r0, r2, r7 diff --git a/asm/pokedex.s b/asm/pokedex.s index f9ee0eeab..3d69281c2 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -7923,7 +7923,7 @@ _080BF982: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 movs r1, 0x98 diff --git a/asm/rom_80A5C6C.s b/asm/rom_80A5C6C.s index bf273ac53..fa05e36ce 100644 --- a/asm/rom_80A5C6C.s +++ b/asm/rom_80A5C6C.s @@ -217,7 +217,7 @@ _080A5E04: b _080A5E42 .pool _080A5E3C: - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r2, [r0] _080A5E42: @@ -307,7 +307,7 @@ _080A5EC8: b _080A5F0A .pool _080A5F04: - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r2, [r0] _080A5F0A: @@ -5522,7 +5522,7 @@ _080A86C4: .pool _080A871C: ldrh r7, [r1, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r2, r0 ldr r2, [r0] _080A8724: @@ -5612,7 +5612,7 @@ _080A8790: .pool _080A87DC: ldrh r7, [r1, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r2, r0 ldr r2, [r0] _080A87E4: diff --git a/include/battle.h b/include/battle.h index a67442f85..7d97f7777 100644 --- a/include/battle.h +++ b/include/battle.h @@ -326,7 +326,7 @@ struct UnknownFlags struct DisableStruct { - /*0x00*/ u32 unk0; + /*0x00*/ u32 transformedMonPersonality; /*0x04*/ u16 disabledMove; /*0x06*/ u16 encoredMove; /*0x08*/ u8 protectUses; @@ -858,6 +858,16 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank); void BattleLoadSubstituteSpriteGfx(u8 bank, bool8 arg1); void nullsub_24(u16 arg0); void nullsub_25(u8 arg0); +void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute); +void sub_805D714(struct Sprite *sprite); +void DecompressTrainerBackPic(u16 backPicId, u8 bank); +void DecompressTrainerFrontPic(u16 frontPicId, u8 bank); +void FreeTrainerFrontPicPalette(u16 frontPicId); +void sub_805D7AC(struct Sprite *sprite); +bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn); +void sub_805EB9C(u8 arg0); +void sub_805E394(void); +void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move); enum { @@ -870,7 +880,6 @@ enum BACK_PIC_WALLY, BACK_PIC_STEVEN }; -void LoadBackTrainerBankSpriteGfx(u8 backPicId, u8 bank); // rom_80A5C6C u8 GetBankSide(u8 bank); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 1c076b3e0..0b8fb0c0e 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -1,16 +1,69 @@ #ifndef GUARD_BATTLE_CONTROLLERS_H #define GUARD_BATTLE_CONTROLLERS_H -#define REQUEST_ALL_BATTLE 0x0 -#define REQUEST_SPECIES_BATTLE 0x1 -#define REQUEST_HELDITEM_BATTLE 0x2 -#define REQUEST_MOVES_PP_BATTLE 0x3 -#define REQUEST_PPMOVE1_BATTLE 0x9 -#define REQUEST_PPMOVE2_BATTLE 0xA -#define REQUEST_PPMOVE3_BATTLE 0xB -#define REQUEST_PPMOVE4_BATTLE 0xC -#define REQUEST_STATUS_BATTLE 0x28 -#define REQUEST_HP_BATTLE 0x2A +enum +{ + REQUEST_ALL_BATTLE, + REQUEST_SPECIES_BATTLE, + REQUEST_HELDITEM_BATTLE, + REQUEST_MOVES_PP_BATTLE, + REQUEST_MOVE1_BATTLE, + REQUEST_MOVE2_BATTLE, + REQUEST_MOVE3_BATTLE, + REQUEST_MOVE4_BATTLE, + REQUEST_PP_DATA_BATTLE, + REQUEST_PPMOVE1_BATTLE, + REQUEST_PPMOVE2_BATTLE, + REQUEST_PPMOVE3_BATTLE, + REQUEST_PPMOVE4_BATTLE, + REQUEST_UNUSED_13_BATTLE, + REQUEST_UNUSED_14_BATTLE, + REQUEST_UNUSED_15_BATTLE, + REQUEST_UNUSED_16_BATTLE, + REQUEST_OTID_BATTLE, + REQUEST_EXP_BATTLE, + REQUEST_HP_EV_BATTLE, + REQUEST_ATK_EV_BATTLE, + REQUEST_DEF_EV_BATTLE, + REQUEST_SPEED_EV_BATTLE, + REQUEST_SPATK_EV_BATTLE, + REQUEST_SPDEF_EV_BATTLE, + REQUEST_FRIENDSHIP_BATTLE, + REQUEST_POKERUS_BATTLE, + REQUEST_MET_LOCATION_BATTLE, + REQUEST_MET_LEVEL_BATTLE, + REQUEST_MET_GAME_BATTLE, + REQUEST_POKEBALL_BATTLE, + REQUEST_ALL_IVS_BATTLE, + REQUEST_HP_IV_BATTLE, + REQUEST_ATK_IV_BATTLE, + REQUEST_DEF_IV_BATTLE, + REQUEST_SPEED_IV_BATTLE, + REQUEST_SPATK_IV_BATTLE, + REQUEST_SPDEF_IV_BATTLE, + REQUEST_PERSONALITY_BATTLE, + REQUEST_CHECKSUM_BATTLE, + REQUEST_STATUS_BATTLE, + REQUEST_LEVEL_BATTLE, + REQUEST_HP_BATTLE, + REQUEST_MAX_HP_BATTLE, + REQUEST_ATK_BATTLE, + REQUEST_DEF_BATTLE, + REQUEST_SPEED_BATTLE, + REQUEST_SPATK_BATTLE, + REQUEST_SPDEF_BATTLE, + REQUEST_COOL_BATTLE, + REQUEST_BEAUTY_BATTLE, + REQUEST_CUTE_BATTLE, + REQUEST_SMART_BATTLE, + REQUEST_TOUGH_BATTLE, + REQUEST_SHEEN_BATTLE, + REQUEST_COOL_RIBBON_BATTLE, + REQUEST_BEAUTY_RIBBON_BATTLE, + REQUEST_CUTE_RIBBON_BATTLE, + REQUEST_SMART_RIBBON_BATTLE, + REQUEST_TOUGH_RIBBON_BATTLE, +}; #define RESET_ACTION_MOVE_SELECTION 0 #define RESET_ACTION_SELECTION 1 @@ -31,7 +84,7 @@ struct HpAndStatus struct MovePpInfo { - u16 move[4]; + u16 moves[4]; u8 pp[4]; u8 ppBonuses; }; @@ -59,7 +112,7 @@ enum CONTROLLER_TRAINERSLIDE, CONTROLLER_TRAINERSLIDEBACK, CONTROLLER_FAINTANIMATION, - CONTROLLER_11, + CONTROLLER_PALETTEFADE, CONTROLLER_12, CONTROLLER_BALLTHROW, CONTROLLER_PAUSE, @@ -67,7 +120,7 @@ enum CONTROLLER_PRINTSTRING, CONTROLLER_PRINTSTRINGPLAYERONLY, CONTROLLER_CHOOSEACTION, - CONTROLLER_19, + CONTROLLER_YESNOBOX, CONTROLLER_CHOOSEMOVE, CONTROLLER_OPENBAG, CONTROLLER_CHOOSEPOKEMON, @@ -81,7 +134,7 @@ enum CONTROLLER_DMA3TRANSFER, CONTROLLER_31, CONTROLLER_32, - CONTROLLER_33, + CONTROLLER_CHOICERETURNVALUE, CONTROLLER_34, CONTROLLER_35, CONTROLLER_36, @@ -117,9 +170,9 @@ void sub_8033648(void); void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters -void EmitGetMonData(u8 bufferId, u8 arg1, u8 arg2); +void EmitGetMonData(u8 bufferId, u8 requestId, u8 monsToCheck); void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused -void EmitSetMonData(u8 bufferId, u8 request, u8 c, u8 bytes, void *data); +void EmitSetMonData(u8 bufferId, u8 requestId, u8 monsToCheck, u8 bytes, void *data); void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused void EmitLoadMonSprite(u8 bufferId); void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); @@ -128,7 +181,7 @@ void EmitDrawTrainerPic(u8 bufferId); void EmitTrainerSlide(u8 bufferId); void EmitTrainerSlideBack(u8 bufferId); void EmitFaintAnimation(u8 bufferId); -void EmitCmd11(u8 bufferId); // unused +void EmitPaletteFade(u8 bufferId); // unused void EmitCmd12(u8 bufferId); // unused void EmitBallThrow(u8 bufferId, u8 caseId); void EmitPause(u8 bufferId, u8 toWait, void *data); // unused @@ -136,7 +189,7 @@ void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 void EmitPrintString(u8 bufferId, u16 stringId); void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId); void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2); -void EmitCmd19(u8 bufferId); +void EmitYesNoBox(u8 bufferId); void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); void EmitOpenBag(u8 bufferId, u8* arg1); void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4); @@ -150,7 +203,7 @@ void EmitDataTransfer(u8 bufferId, u16 size, void *data); void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused void EmitCmd32(u8 bufferId, u16 size, void *c); // unused -void EmitCmd33(u8 bufferId, u8 arg1, u16 arg2); +void EmitChoiceReturnValue(u8 bufferId, u8 arg1, u16 arg2); void EmitCmd34(u8 bufferId, u8 b, u8 *c); void EmitCmd35(u8 bufferId, u16 b); void EmitCmd36(u8 bufferId, u16 b); diff --git a/include/battle_message.h b/include/battle_message.h index 3b154c5a6..0d7a7f489 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -204,7 +204,7 @@ struct StringInfoBattle void BufferStringBattle(u16 stringID); u32 BattleStringExpandPlaceholdersToDisplayedString(const u8* src); u32 BattleStringExpandPlaceholders(const u8* src, u8* dst); -void sub_814F9EC(const u8* text, u8 arg1); +void BattleHandleAddTextPrinter(const u8* text, u8 arg1); void SetPpNumbersPaletteInMoveSelection(void); u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp); diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 6d3563c3d..a466abc04 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -25,6 +25,7 @@ #define VARIOUS_GET_MOVE_TARGET 3 #define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5 #define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6 +#define VARIOUS_EMIT_YESNOBOX 13 #define VARIOUS_WAIT_CRY 18 #define VARIOUS_RETURN_OPPONENT_MON1 19 #define VARIOUS_RETURN_OPPONENT_MON2 20 @@ -41,6 +42,9 @@ #define STAT_CHANGE_WORKED 0 #define STAT_CHANGE_DIDNT_WORK 1 +#define WINDOW_CLEAR 0x1 +#define WINDOW_x80 0x80 + void AI_CalcDmg(u8 bankAtk, u8 bankDef); u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef); u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility); @@ -49,7 +53,7 @@ void SetMoveEffect(bool8 primary, u8 certain); void BattleDestroyYesNoCursorAt(u8 cursorPosition); void BattleCreateYesNoCursorAt(u8 cursorPosition); void BufferMoveToLearnIntoBattleTextBuff2(void); -void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); bool8 UproarWakeUpCheck(u8 bank); extern void (* const gBattleScriptingCommandsTable[])(void); diff --git a/include/global.h b/include/global.h index d8547d9c3..4afe89de7 100644 --- a/include/global.h +++ b/include/global.h @@ -39,6 +39,8 @@ enum VERSION_SAPPHIRE = 1, VERSION_RUBY = 2, VERSION_EMERALD = 3, + VERSION_FIRE_RED = 4, + VERSION_LEAF_GREEN = 5, }; enum LanguageId { diff --git a/include/pokemon.h b/include/pokemon.h index 5048c1e4c..626d4d7a1 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -644,6 +644,9 @@ 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); +u16 PlayerGenderToFrontTrainerPicId(u8 playerGender); +void sub_806A1C0(u16 arg0, u8 bankIdentity); +void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity); #include "sprite.h" diff --git a/src/battle_2.c b/src/battle_2.c index c50295eba..f2a5508e0 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -2121,7 +2121,7 @@ static void sub_8038F34(void) if (sub_800A520() == TRUE) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2247,15 +2247,15 @@ static void sub_803939C(void) case 3: if (!gPaletteFade.active) { - sub_814F9EC(gText_RecordBattleToPass, 0); + BattleHandleAddTextPrinter(gText_RecordBattleToPass, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; case 4: if (!IsTextPrinterActive(0)) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[CURSOR_POSITION] = 1; BattleCreateYesNoCursorAt(1); gBattleCommunication[MULTIUSE_STATE]++; @@ -2287,7 +2287,7 @@ static void sub_803939C(void) PlaySE(SE_SELECT); if (gBattleCommunication[CURSOR_POSITION] == 0) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattleCommunication[1] = MoveRecordedBattleToSaveData(); gBattleCommunication[MULTIUSE_STATE] = 10; } @@ -2305,11 +2305,11 @@ static void sub_803939C(void) case 6: if (sub_800A520() == TRUE) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -2340,14 +2340,14 @@ static void sub_803939C(void) { PlaySE(SE_SAVE); BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordedOnPass); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } else { BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordCouldntBeSaved); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } @@ -2358,7 +2358,7 @@ static void sub_803939C(void) if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -3690,7 +3690,7 @@ static void TryDoEventsBeforeFirstTurn(void) TurnValuesCleanUp(FALSE); SpecialStatusesClear(); *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; ResetSentPokesToOpponentValue(); @@ -3797,7 +3797,7 @@ void BattleTurnPassed(void) *(gBattleStruct->field_5C + i) = 6; *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; gRandomTurnNumber = Random(); diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index d86be6fad..3f97c59a5 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void) && gDisableStructs[gActiveBank].perishSong1 == 0) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } @@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } } @@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } } @@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void) if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } @@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void) if (Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } @@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0) { *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitChoiceReturnValue(1, 2, 0); return TRUE; } } @@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void) } } - EmitCmd33(1, 0, (gActiveBank ^ BIT_SIDE) << 8); + EmitChoiceReturnValue(1, 0, (gActiveBank ^ BIT_SIDE) << 8); } #define TYPE_FORESIGHT 0xFE @@ -940,7 +940,7 @@ static bool8 ShouldUseItem(void) if (shouldUse) { - EmitCmd33(1, 1, 0); + EmitChoiceReturnValue(1, 1, 0); *(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; diff --git a/src/battle_controller_linkopponent.c b/src/battle_controller_linkopponent.c index fdb9ee10d..fb21865ca 100644 --- a/src/battle_controller_linkopponent.c +++ b/src/battle_controller_linkopponent.c @@ -72,7 +72,7 @@ void nullsub_92(void); void LinkOpponentBufferRunCommand(void); -void (*const gLinkOpponentBufferCommands[CONTOLLER_CMDS_CONT])(void) = +void (*const gLinkOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { LinkOpponentHandleGetMonData, LinkOpponentHandleGetRawMonData, diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 9c72b19dc..e55d78912 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -72,7 +72,7 @@ void nullsub_91(void); void OpponentBufferRunCommand(void); -void (*const gOpponentBufferCommands[CONTOLLER_CMDS_CONT])(void) = +void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { OpponentHandleGetMonData, OpponentHandleGetRawMonData, diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 33807b39a..03b67c28f 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -58,7 +58,7 @@ void PlayerHandleDrawTrainerPic(void); void PlayerHandleTrainerSlide(void); void PlayerHandleTrainerSlideBack(void); void PlayerHandleFaintAnimation(void); -void PlayerHandleCmd11(void); +void PlayerHandlePaletteFade(void); void PlayerHandleCmd12(void); void PlayerHandleBallThrow(void); void PlayerHandlePause(void); @@ -124,6 +124,11 @@ void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); void sub_8059400(u8 taskId); void sub_80595A4(u8 taskId); void PrintLinkStandbyMsg(void); +u32 CopyPlayerMonData(u8 monId, u8 *dst); +void SetPlayerMonData(u8 monId); +void sub_805B258(u8 bank, bool8 dontClearSubstituteBit); +void sub_805B464(void); +void PlayerDoMoveAnimation(void); void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { @@ -138,7 +143,7 @@ void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = PlayerHandleTrainerSlide, PlayerHandleTrainerSlideBack, PlayerHandleFaintAnimation, - PlayerHandleCmd11, + PlayerHandlePaletteFade, PlayerHandleCmd12, PlayerHandleBallThrow, PlayerHandlePause, @@ -254,16 +259,16 @@ void HandleInputChooseAction(void) switch (gActionSelectionCursor[gActiveBank]) { case ACTION_USE_MOVE: - EmitCmd33(1, ACTION_USE_MOVE, 0); + EmitChoiceReturnValue(1, ACTION_USE_MOVE, 0); break; case ACTION_USE_ITEM: - EmitCmd33(1, ACTION_USE_ITEM, 0); + EmitChoiceReturnValue(1, ACTION_USE_ITEM, 0); break; case ACTION_SWITCH: - EmitCmd33(1, ACTION_SWITCH, 0); + EmitChoiceReturnValue(1, ACTION_SWITCH, 0); break; case ACTION_RUN: - EmitCmd33(1, ACTION_RUN, 0); + EmitChoiceReturnValue(1, ACTION_RUN, 0); break; } PlayerBufferExecCompleted(); @@ -324,7 +329,7 @@ void HandleInputChooseAction(void) return; } PlaySE(SE_SELECT); - EmitCmd33(1, ACTION_CANCEL_PARTNER, 0); + EmitChoiceReturnValue(1, ACTION_CANCEL_PARTNER, 0); PlayerBufferExecCompleted(); } } @@ -370,7 +375,7 @@ void HandleInputChooseTarget(void) { PlaySE(SE_SELECT); gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; - EmitCmd33(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + EmitChoiceReturnValue(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); dp11b_obj_free(gMultiUsePlayerCursor, 1); PlayerBufferExecCompleted(); } @@ -527,7 +532,7 @@ void HandleInputChooseMove(void) if (!canSelectTarget) { - EmitCmd33(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + EmitChoiceReturnValue(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); PlayerBufferExecCompleted(); } else @@ -547,7 +552,7 @@ void HandleInputChooseMove(void) else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) { PlaySE(SE_SELECT); - EmitCmd33(1, 10, 0xFFFF); + EmitChoiceReturnValue(1, 10, 0xFFFF); PlayerBufferExecCompleted(); } else if (gMain.newKeys & DPAD_LEFT) @@ -612,7 +617,7 @@ void HandleInputChooseMove(void) gMultiUsePlayerCursor = gMoveSelectionCursor[gActiveBank] + 1; MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); - sub_814F9EC(gText_BattleSwitchWhich, 0xB); + BattleHandleAddTextPrinter(gText_BattleSwitchWhich, 0xB); gBattleBankFunc[gActiveBank] = HandleMoveSwitchting; } } @@ -988,7 +993,7 @@ void sub_805896C(void) extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_8076918(u8 bank); -extern u8 gUnknown_03005D7C[]; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; void sub_8058B40(void) { @@ -1173,7 +1178,7 @@ void sub_80591B8(u8 taskId) gainedExp -= nextLvlExp - currExp; savedActiveBank = gActiveBank; gActiveBank = bank; - EmitCmd33(1, 11, gainedExp); + EmitChoiceReturnValue(1, 11, gainedExp); gActiveBank = savedActiveBank; if (IsDoubleBattle() == TRUE @@ -1252,7 +1257,7 @@ void sub_8059400(u8 taskId) gainedExp -= expOnNextLvl - currExp; savedActiveBank = gActiveBank; gActiveBank = bank; - EmitCmd33(1, 11, gainedExp); + EmitChoiceReturnValue(1, 11, gainedExp); gActiveBank = savedActiveBank; gTasks[taskId].func = sub_8059544; } @@ -1427,7 +1432,7 @@ void DoHitAnimBlinkEffect(void) } } -void sub_80599D4(void) +void PlayerHandleYesNoInput(void) { if (gMain.newKeys & DPAD_UP && gMultiUsePlayerCursor != 0) { @@ -1445,19 +1450,19 @@ void sub_80599D4(void) } if (gMain.newKeys & A_BUTTON) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); PlaySE(SE_SELECT); if (gMultiUsePlayerCursor != 0) - EmitCmd33(1, 0xE, 0); + EmitChoiceReturnValue(1, 0xE, 0); else - EmitCmd33(1, 0xD, 0); + EmitChoiceReturnValue(1, 0xD, 0); PlayerBufferExecCompleted(); } if (gMain.newKeys & B_BUTTON) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); PlaySE(SE_SELECT); PlayerBufferExecCompleted(); } @@ -1476,7 +1481,7 @@ void MoveSelectionDisplayMoveNames(void) { MoveSelectionDestroyCursorAt(i); StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]); - sub_814F9EC(gDisplayedStringBattle, i + 3); + BattleHandleAddTextPrinter(gDisplayedStringBattle, i + 3); if (moveInfo->moves[i] != MOVE_NONE) gNumberOfMovesToChoose++; } @@ -1485,7 +1490,7 @@ void MoveSelectionDisplayMoveNames(void) void MoveSelectionDisplayPpString(void) { StringCopy(gDisplayedStringBattle, gText_MoveInterfacePP); - sub_814F9EC(gDisplayedStringBattle, 7); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 7); } void MoveSelectionDisplayPpNumber(void) @@ -1503,7 +1508,7 @@ void MoveSelectionDisplayPpNumber(void) txtPtr++; ConvertIntToDecimalStringN(txtPtr, moveInfo->maxPp[gMoveSelectionCursor[gActiveBank]], STR_CONV_MODE_RIGHT_ALIGN, 2); - sub_814F9EC(gDisplayedStringBattle, 9); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 9); } extern const u8 gTypeNames[][7]; @@ -1522,7 +1527,7 @@ void MoveSelectionDisplayMoveType(void) txtPtr++; StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBank]]].type]); - sub_814F9EC(gDisplayedStringBattle, 10); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 10); } void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) @@ -1595,6 +1600,1063 @@ void PrintLinkStandbyMsg(void) { gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - sub_814F9EC(gText_LinkStandby, 0); + BattleHandleAddTextPrinter(gText_LinkStandby, 0); + } +} + +void PlayerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyPlayerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyPlayerMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + PlayerBufferExecCompleted(); +} + +u32 CopyPlayerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +void PlayerHandleGetRawMonData(void) +{ + struct BattlePokemon battleMon; + u8 *src = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 *dst = (u8 *)&battleMon + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = src[i]; + + EmitDataTransfer(1, gBattleBufferA[gActiveBank][2], dst); + PlayerBufferExecCompleted(); +} + +void PlayerHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetPlayerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetPlayerMonData(i); + monsToCheck >>= 1; + } + } + PlayerBufferExecCompleted(); +} + +void SetPlayerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +void PlayerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + PlayerBufferExecCompleted(); +} + +void PlayerHandleLoadMonSprite(void) +{ + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpritePosX_0; +} + +void PlayerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + gActionSelectionCursor[gActiveBank] = 0; + gMoveSelectionCursor[gActiveBank] = 0; + sub_805B258(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_805902C; +} + +extern struct SpriteTemplate gUnknown_0202499C; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; + +extern u8 sub_80A5C6C(u16, u8); +extern u8 sub_80A6138(u8 bank); +extern u8 sub_80A82E4(u8 bank); +extern u8 sub_80753E8(u16, u8); +extern void sub_806A068(u16, u8); + +void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +void PlayerHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + gBattleBankFunc[gActiveBank] = sub_805B464; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerBufferExecCompleted(); + } +} + +void sub_805B464(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 5); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 1); + gBattleBankFunc[gActiveBank] = sub_8059744; + } + break; + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; + +extern u16 gPartnerTrainerId; + +// some explanation here +// in emerald it's possible to have a tag battle in the battle frontier facilities with AI +// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it +void PlayerHandleDrawTrainerPic(void) +{ + s16 xPos, yPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender; + } + } + else + { + trainerPicId = gSaveBlock2Ptr->playerGender; + } + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 90; + else // first mon + xPos = 32; + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID) + { + xPos = 90; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80; + } + else + { + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + } + else + { + xPos = 80; + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + // Use front pic table for any tag battles unless your partner is Steven. + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID) + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].pos2.y = 48; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gSprites[gBankSpriteIds[gActiveBank]].oam.affineMode = 0; + gSprites[gBankSpriteIds[gActiveBank]].hFlip = 1; + } + // use the back pic in any other scenario + else + { + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + } + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +void PlayerHandleTrainerSlide(void) +{ + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender; + } + } + else + { + trainerPicId = gSaveBlock2Ptr->playerGender; + } + + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -96; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; +} + +extern void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); +extern void oamt_add_pos2_onto_pos1(struct Sprite *sprite); +extern void sub_80A6EEC(struct Sprite *sprite); +extern void sub_8039C00(struct Sprite *sprite); + +void PlayerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + gBattleBankFunc[gActiveBank] = sub_80588B4; +} + +void PlayerHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 5); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlaySE12WithPanning(SE_POKE_DEAD, -64); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_80596A8; + } + } +} + +void PlayerHandlePaletteFade(void) +{ + BeginNormalPaletteFade(-1, 2, 0, 16, 0); + PlayerBufferExecCompleted(); +} + +void PlayerHandleCmd12(void) +{ + gBattleSpritesDataPtr->animationData->field_8 = 4; + gDoingBattleAnim = TRUE; + move_anim_start_t4(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), 3); + gBattleBankFunc[gActiveBank] = sub_805991C; +} + +void PlayerHandleBallThrow(void) +{ + u8 var = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->field_8 = var; + gDoingBattleAnim = TRUE; + move_anim_start_t4(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), 3); + gBattleBankFunc[gActiveBank] = sub_805991C; +} + +void PlayerHandlePause(void) +{ + u8 var = gBattleBufferA[gActiveBank][1]; + + // WTF is this?? + while (var != 0) + var--; + + PlayerBufferExecCompleted(); +} + +extern void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr); +extern bool8 mplay_80342A4(u8 bank); + +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; + +void PlayerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always return FALSE + { + PlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + gBattleBankFunc[gActiveBank] = PlayerDoMoveAnimation; + sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); + } + } +} + +void PlayerDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 5); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 6); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + PlayerBufferExecCompleted(); + } + break; + } +} + +extern void sub_817C95C(u16 stringId); +extern void sub_81A57E4(u8 bank, u16 stringId); + +void PlayerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter2; + sub_817C95C(*stringId); + sub_81A57E4(gActiveBank, *stringId); +} + +void PlayerHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + PlayerHandlePrintString(); + else + PlayerBufferExecCompleted(); +} + +void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = HandleInputChooseAction; + } +} + +extern void sub_817F2A8(void); +extern const u8 gText_BattleMenu[]; +extern const u8 gText_WhatWillPkmnDo[]; +extern const u8 gText_BattleYesNoChoice[]; + +void PlayerHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + sub_817F2A8(); + BattleHandleAddTextPrinter(gText_BattleMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +void PlayerHandleCmd19(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 12); + gMultiUsePlayerCursor = 1; + BattleCreateYesNoCursorAt(1); + gBattleBankFunc[gActiveBank] = PlayerHandleYesNoInput; + } + else + { + PlayerBufferExecCompleted(); } } diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index e7594a2f0..ce38ca882 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -72,7 +72,7 @@ void nullsub_118(void); void WallyBufferRunCommand(void); -void (*const gWallyBufferCommands[CONTOLLER_CMDS_CONT])(void) = +void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { WallyHandleGetMonData, WallyHandleGetRawMonData, diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 9ac18c72f..1086c6955 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -939,11 +939,11 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) } } -void EmitGetMonData(u8 bufferId, u8 arg1, u8 arg2) +void EmitGetMonData(u8 bufferId, u8 requestId, u8 monsToCheck) { gBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA; - gBattleBuffersTransferData[1] = arg1; - gBattleBuffersTransferData[2] = arg2; + gBattleBuffersTransferData[1] = requestId; + gBattleBuffersTransferData[2] = monsToCheck; gBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -957,13 +957,13 @@ void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitSetMonData(u8 bufferId, u8 request, u8 c, u8 bytes, void *data) +void EmitSetMonData(u8 bufferId, u8 requestId, u8 monsToCheck, u8 bytes, void *data) { s32 i; gBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA; - gBattleBuffersTransferData[1] = request; - gBattleBuffersTransferData[2] = c; + gBattleBuffersTransferData[1] = requestId; + gBattleBuffersTransferData[2] = monsToCheck; for (i = 0; i < bytes; i++) gBattleBuffersTransferData[3 + i] = *(u8*)(data++); PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 3 + bytes); @@ -1042,12 +1042,12 @@ void EmitFaintAnimation(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd11(u8 bufferId) +void EmitPaletteFade(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_11; - gBattleBuffersTransferData[1] = 11; - gBattleBuffersTransferData[2] = 11; - gBattleBuffersTransferData[3] = 11; + gBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; + gBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; + gBattleBuffersTransferData[2] = CONTROLLER_PALETTEFADE; + gBattleBuffersTransferData[3] = CONTROLLER_PALETTEFADE; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1178,12 +1178,12 @@ void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd19(u8 bufferId) +void EmitYesNoBox(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_19; - gBattleBuffersTransferData[1] = 19; - gBattleBuffersTransferData[2] = 19; - gBattleBuffersTransferData[3] = 19; + gBattleBuffersTransferData[0] = CONTROLLER_YESNOBOX; + gBattleBuffersTransferData[1] = CONTROLLER_YESNOBOX; + gBattleBuffersTransferData[2] = CONTROLLER_YESNOBOX; + gBattleBuffersTransferData[3] = CONTROLLER_YESNOBOX; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1337,9 +1337,9 @@ void EmitCmd32(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 3); } -void EmitCmd33(u8 bufferId, u8 arg1, u16 arg2) +void EmitChoiceReturnValue(u8 bufferId, u8 arg1, u16 arg2) { - gBattleBuffersTransferData[0] = CONTROLLER_33; + gBattleBuffersTransferData[0] = CONTROLLER_CHOICERETURNVALUE; gBattleBuffersTransferData[1] = arg1; gBattleBuffersTransferData[2] = arg2; gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; diff --git a/src/battle_message.c b/src/battle_message.c index aeff721d6..d0c7b118d 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2209,7 +2209,7 @@ static void sub_814F950(u8* dst) } } -void sub_814F9EC(const u8 *text, u8 arg1) +void BattleHandleAddTextPrinter(const u8 *text, u8 arg1) { const u8 *r8 = gUnknown_085CD660[gBattleScripting.field_24]; bool32 r9; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4ba86775e..a112cd7b9 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6114,8 +6114,8 @@ static void atk5A_yesnoboxlearnmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; BattleCreateYesNoCursorAt(0); @@ -6140,7 +6140,7 @@ static void atk5A_yesnoboxlearnmove(void) PlaySE(SE_SELECT); if (gBattleCommunication[1] == 0) { - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); gBattleScripting.learnMoveState++; } @@ -6214,7 +6214,7 @@ static void atk5A_yesnoboxlearnmove(void) } break; case 5: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattlescriptCurrInstr += 5; break; case 6: @@ -6231,8 +6231,8 @@ static void atk5B_yesnoboxstoplearningmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; BattleCreateYesNoCursorAt(0); @@ -6261,13 +6261,13 @@ static void atk5B_yesnoboxstoplearningmove(void) else gBattlescriptCurrInstr += 5; - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); } break; } @@ -6527,8 +6527,8 @@ static void atk67_yesnobox(void) switch (gBattleCommunication[0]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[0]++; gBattleCommunication[CURSOR_POSITION] = 0; BattleCreateYesNoCursorAt(0); @@ -6552,13 +6552,13 @@ static void atk67_yesnobox(void) { gBattleCommunication[CURSOR_POSITION] = 1; PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattlescriptCurrInstr++; } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattlescriptCurrInstr++; } break; @@ -6674,7 +6674,7 @@ static void atk6C_draw_lvlupbox(void) SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 0); ShowBg(0); ShowBg(1); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x80); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80); gBattleScripting.atk6C_state = 4; break; case 4: @@ -6704,7 +6704,7 @@ static void atk6C_draw_lvlupbox(void) if (gMain.newKeys != 0) { PlaySE(SE_SELECT); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x81); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80 | WINDOW_CLEAR); gBattleScripting.atk6C_state++; } break; @@ -7136,8 +7136,8 @@ static void atk76_various(void) gDisableStructs[0].truantUnknownBit = 1; gDisableStructs[1].truantUnknownBit = 1; break; - case 13: - EmitCmd19(0); + case VARIOUS_EMIT_YESNOBOX: + EmitYesNoBox(0); MarkBufferBankForExecution(gActiveBank); break; case 14: @@ -7148,7 +7148,7 @@ static void atk76_various(void) break; case 16: BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); - sub_814F9EC(gDisplayedStringBattle, 0x16); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0x16); break; case 17: if (IsTextPrinterActive(0x16)) @@ -8443,7 +8443,7 @@ static void atk9B_transformdataexecution(void) gBattleMons[gBankAttacker].status2 |= STATUS2_TRANSFORMED; gDisableStructs[gBankAttacker].disabledMove = 0; gDisableStructs[gBankAttacker].disableTimer1 = 0; - gDisableStructs[gBankAttacker].unk0 = gBattleMons[gBankTarget].personality; + gDisableStructs[gBankAttacker].transformedMonPersonality = gBattleMons[gBankTarget].personality; gDisableStructs[gBankAttacker].unk18_b = 0; PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBankTarget].species) @@ -9152,7 +9152,7 @@ static void atkA8_copymovepermanently(void) // sketch for (i = 0; i < 4; i++) { - movePpData.move[i] = gBattleMons[gBankAttacker].moves[i]; + movePpData.moves[i] = gBattleMons[gBankAttacker].moves[i]; movePpData.pp[i] = gBattleMons[gBankAttacker].pp[i]; } movePpData.ppBonuses = gBattleMons[gBankAttacker].ppBonuses; @@ -11238,7 +11238,7 @@ static void atkF2_display_dex_info(void) } } -void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) { s32 destY, destX; u16 var = 0; @@ -11275,10 +11275,10 @@ void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) var = 0x1026; } - if (flags & 1) + if (flags & WINDOW_CLEAR) var = 0; - if (flags & 0x80) + if (flags & WINDOW_x80) CopyToBgTilemapBufferRect_ChangePalette(1, &var, destX, destY, 1, 1, 0x11); else CopyToBgTilemapBufferRect_ChangePalette(0, &var, destX, destY, 1, 1, 0x11); @@ -11311,8 +11311,8 @@ static void atkF3_nickname_caught_poke(void) switch (gBattleCommunication[MULTIUSE_STATE]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[MULTIUSE_STATE]++; gBattleCommunication[CURSOR_POSITION] = 0; BattleCreateYesNoCursorAt(0); diff --git a/src/pokemon_2.c b/src/pokemon_2.c index 972e1943a..78c205517 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -194,6 +194,7 @@ void sub_806A1C0(u16 arg0, u8 bankIdentity) gUnknown_0202499C = gMonSpritesGfxPtr->templates[bankIdentity]; else gUnknown_0202499C = gUnknown_08329D98[bankIdentity]; + gUnknown_0202499C.paletteTag = arg0; gUnknown_0202499C.anims = gUnknown_0830536C[arg0]; } @@ -1304,7 +1305,7 @@ void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) } void sub_803FA70(u8 bank); -void sub_805EF84(u8 bank, bool8); +void ClearTemporarySpeciesSpriteData(u8 bank, bool8); extern struct BattlePokemon gBattleMons[4]; @@ -1360,5 +1361,5 @@ void CopyPlayerPartyMonToBattleData(u8 bank, u8 partyIndex) gBattleMons[bank].status2 = 0; sub_803FA70(bank); - sub_805EF84(bank, FALSE); + ClearTemporarySpeciesSpriteData(bank, FALSE); } diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 5ff99aee2..aa45c3d24 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1659,7 +1659,7 @@ u16 sub_806EFF0(u16 arg0) return gUnknown_0831F578[arg0]; } -u16 sub_806F000(u8 playerGender) +u16 PlayerGenderToFrontTrainerPicId(u8 playerGender) { if (playerGender) return sub_806EFF0(0x3F); diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 343ddb9c0..002f4f069 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -220,9 +220,9 @@ static bool8 LoadBankSpriteGfx(u8 bank) BattleLoadSubstituteSpriteGfx(bank, FALSE); } else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0) - LoadBackTrainerBankSpriteGfx(gSaveBlock2Ptr->playerGender, bank); + DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, bank); else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0) - LoadBackTrainerBankSpriteGfx(BACK_PIC_WALLY, bank); + DecompressTrainerBackPic(BACK_PIC_WALLY, bank); else if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute) BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); else diff --git a/sym_ewram.txt b/sym_ewram.txt index a1be5c79a..2ae20d3d3 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -495,7 +495,7 @@ gBankInMenu: @ 20244B8 gDoingBattleAnim: @ 20244B9 .space 0x3 -gUnknown_020244BC: @ 20244BC +gTransformedPersonalities: @ 20244BC .space 0x10 gUnknown_020244CC: @ 20244CC From df4e32a307c17163e9a64e5ea615ab9eb18afc4b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 22 Oct 2017 18:43:15 +0200 Subject: [PATCH 03/29] player battle controller is done --- asm/battle_7.s | 34 +- asm/{rom_80A5C6C.s => battle_anim_80A5C6C.s} | 0 asm/battle_anim_80A9C70.s | 2 +- asm/battle_anim_80FE840.s | 6 +- asm/battle_controller_linkopponent.s | 24 +- asm/battle_controller_linkpartner.s | 24 +- asm/battle_controller_opponent.s | 40 +- asm/battle_controller_player.s | 1822 ------------------ asm/battle_controller_player_partner.s | 34 +- asm/battle_controller_recorded_opponent.s | 34 +- asm/battle_controller_recorded_player.s | 36 +- asm/battle_controller_safari.s | 14 +- asm/battle_controller_wally.s | 26 +- asm/battle_link_817C95C.s | 103 +- asm/pokeball.s | 6 +- asm/pokemon_animation.s | 94 + include/battle.h | 82 +- include/battle_2.h | 45 +- include/battle_anim.h | 21 +- include/battle_controllers.h | 55 +- include/battle_interface.h | 8 +- include/battle_link_817C95C.h | 11 + include/link.h | 1 + include/pokeball.h | 8 + ld_script.txt | 3 +- src/battle_2.c | 5 +- src/battle_ai_switch_items.c | 18 +- src/battle_anim.c | 20 +- src/battle_controller_player.c | 1112 ++++++++--- src/battle_controllers.c | 94 +- src/battle_interface.c | 53 +- src/battle_script_commands.c | 16 +- 32 files changed, 1298 insertions(+), 2553 deletions(-) rename asm/{rom_80A5C6C.s => battle_anim_80A5C6C.s} (100%) delete mode 100644 asm/battle_controller_player.s create mode 100644 include/battle_link_817C95C.h create mode 100644 include/pokeball.h diff --git a/asm/battle_7.s b/asm/battle_7.s index 394cb9571..d86c68dfc 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -67,8 +67,8 @@ _0805D192: .pool thumb_func_end FreeBattleSpritesData - thumb_func_start sub_805D19C -sub_805D19C: @ 805D19C + thumb_func_start ChooseMoveAndTargetInBattlePalace +ChooseMoveAndTargetInBattlePalace: @ 805D19C push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -448,7 +448,7 @@ _0805D496: pop {r1} bx r1 .pool - thumb_func_end sub_805D19C + thumb_func_end ChooseMoveAndTargetInBattlePalace thumb_func_start sub_805D4A8 sub_805D4A8: @ 805D4A8 @@ -834,8 +834,8 @@ _0805D800: .pool thumb_func_end sub_805D7EC - thumb_func_start move_anim_start_t2_for_situation -move_anim_start_t2_for_situation: @ 805D808 + thumb_func_start DoStatusAnimation +DoStatusAnimation: @ 805D808 push {r4-r6,lr} adds r4, r1, 0 lsls r0, 24 @@ -962,10 +962,10 @@ _0805D902: pop {r4-r6} pop {r0} bx r0 - thumb_func_end move_anim_start_t2_for_situation + thumb_func_end DoStatusAnimation - thumb_func_start move_anim_start_t3 -move_anim_start_t3: @ 805D908 + thumb_func_start DoBattleAnimationFromTable +DoBattleAnimationFromTable: @ 805D908 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -1070,7 +1070,7 @@ _0805D9CC: ldr r0, =gUnknown_082C9320 adds r1, r5, 0 movs r2, 0 - bl DoBattleAnim + bl LaunchBattleAnimation ldr r0, =task0A_0803415C movs r1, 0xA bl CreateTask @@ -1105,7 +1105,7 @@ _0805DA1E: pop {r1} bx r1 .pool - thumb_func_end move_anim_start_t3 + thumb_func_end DoBattleAnimationFromTable thumb_func_start task0A_0803415C task0A_0803415C: @ 805DA48 @@ -1172,8 +1172,8 @@ _0805DABE: bx r1 thumb_func_end sub_805DAA0 - thumb_func_start move_anim_start_t4 -move_anim_start_t4: @ 805DAC4 + thumb_func_start DoSpecialBattleAnimation +DoSpecialBattleAnimation: @ 805DAC4 push {r4,lr} adds r4, r0, 0 lsls r4, 24 @@ -1187,7 +1187,7 @@ move_anim_start_t4: @ 805DAC4 ldr r0, =gUnknown_082C937C adds r1, r3, 0 movs r2, 0 - bl DoBattleAnim + bl LaunchBattleAnimation ldr r0, =task0A_08034248 movs r1, 0xA bl CreateTask @@ -1216,7 +1216,7 @@ move_anim_start_t4: @ 805DAC4 pop {r0} bx r0 .pool - thumb_func_end move_anim_start_t4 + thumb_func_end DoSpecialBattleAnimation thumb_func_start task0A_08034248 task0A_08034248: @ 805DB34 @@ -2229,8 +2229,8 @@ _0805E3EA: .pool thumb_func_end sub_805E394 - thumb_func_start sub_805E408 -sub_805E408: @ 805E408 + thumb_func_start SetBattleSpriteInvisibilityBitToSpriteInvisibility +SetBattleSpriteInvisibilityBitToSpriteInvisibility: @ 805E408 lsls r0, 24 lsrs r0, 24 ldr r1, =gBattleSpritesDataPtr @@ -2258,7 +2258,7 @@ sub_805E408: @ 805E408 strb r0, [r3] bx lr .pool - thumb_func_end sub_805E408 + thumb_func_end SetBattleSpriteInvisibilityBitToSpriteInvisibility thumb_func_start sub_805E448 sub_805E448: @ 805E448 diff --git a/asm/rom_80A5C6C.s b/asm/battle_anim_80A5C6C.s similarity index 100% rename from asm/rom_80A5C6C.s rename to asm/battle_anim_80A5C6C.s diff --git a/asm/battle_anim_80A9C70.s b/asm/battle_anim_80A9C70.s index 9b2939673..681802e12 100644 --- a/asm/battle_anim_80A9C70.s +++ b/asm/battle_anim_80A9C70.s @@ -869,7 +869,7 @@ move_anim_start_t2: @ 80AA364 strb r4, [r0] ldr r0, =gUnknown_082C92FC movs r2, 0 - bl DoBattleAnim + bl LaunchBattleAnimation ldr r0, =task0A_80788BC movs r1, 0xA bl CreateTask diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index dc927cacc..315f884cf 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -50443,8 +50443,8 @@ _081181CA: bx r1 thumb_func_end sub_8118140 - thumb_func_start battle_intro_launch -battle_intro_launch: @ 81181D4 + thumb_func_start HandleIntroSlide +HandleIntroSlide: @ 81181D4 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -50521,7 +50521,7 @@ _08118258: pop {r0} bx r0 .pool - thumb_func_end battle_intro_launch + thumb_func_end HandleIntroSlide thumb_func_start sub_811828C sub_811828C: @ 811828C diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index 1cc9191c0..1b4a01f2a 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -1163,7 +1163,7 @@ sub_8064D60: @ 8064D60 adds r1, r3, 0 adds r2, r3, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08064DA0: ldr r0, =gBattleBankFunc ldrb r1, [r4] @@ -1312,7 +1312,7 @@ sub_8064E50: @ 8064E50 ldrb r0, [r0] bl SetHealthboxSpriteVisible ldrb r0, [r5] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -3970,7 +3970,7 @@ _080666E4: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _080666FE: ldr r0, [r6] ldrb r1, [r5] @@ -3995,7 +3995,7 @@ _08066712: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x2 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -4595,7 +4595,7 @@ LinkOpponentHandleFaintAnimation: @ 8066C40 adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08066C74: ldr r0, [r6] ldrb r1, [r5] @@ -4890,7 +4890,7 @@ _08066ED2: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08066EF4: ldr r0, [r7] ldrb r1, [r6] @@ -4948,7 +4948,7 @@ _08066F32: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, [r7] ldrb r1, [r6] ldr r0, [r0] @@ -5285,7 +5285,7 @@ LinkOpponentHandleStatusAnimation: @ 8067214 ldrb r2, [r3] lsls r2, 24 orrs r1, r2 - bl move_anim_start_t2_for_situation + bl DoStatusAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -5481,7 +5481,7 @@ _080673B0: movs r1, 0 strh r1, [r0, 0x30] ldrb r0, [r4] - bl sub_80769F4 + bl DoHitAnimHealthboxEffect ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -5615,7 +5615,7 @@ LinkOpponentHandleIntroSlide: @ 80674D4 adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -6092,7 +6092,7 @@ LinkOpponentHandleSpriteInvisibility: @ 80678D0 orrs r0, r1 strb r0, [r2] ldrb r0, [r4] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility _08067916: bl LinkOpponentBufferExecCompleted pop {r4} @@ -6129,7 +6129,7 @@ LinkOpponentHandleBattleAnimation: @ 8067930 adds r0, r2, 0 adds r1, r2, 0 adds r3, r6, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _08067980 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index 54b3b5f8a..e8581c396 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -736,7 +736,7 @@ sub_814B4E0: @ 814B4E0 cmp r1, r0 bne _0814B532 adds r0, r3, 0 - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility ldr r0, =gBattleSpritesDataPtr ldr r0, [r0] ldrb r2, [r4] @@ -751,7 +751,7 @@ sub_814B4E0: @ 814B4E0 adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0814B526: ldr r0, =gBattleBankFunc ldrb r1, [r4] @@ -3554,7 +3554,7 @@ _0814CECC: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0814CEE6: ldr r0, [r6] ldrb r1, [r5] @@ -3579,7 +3579,7 @@ _0814CEFA: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x1 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -3893,7 +3893,7 @@ sub_814D19C: @ 814D19C adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0814D1D0: ldr r0, [r6] ldrb r1, [r5] @@ -4216,7 +4216,7 @@ _0814D46E: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0814D490: ldr r0, [r7] ldrb r1, [r6] @@ -4274,7 +4274,7 @@ _0814D4CE: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, [r7] ldrb r1, [r6] ldr r0, [r0] @@ -4611,7 +4611,7 @@ sub_814D7B0: @ 814D7B0 ldrb r2, [r3] lsls r2, 24 orrs r1, r2 - bl move_anim_start_t2_for_situation + bl DoStatusAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -4807,7 +4807,7 @@ _0814D94C: movs r1, 0 strh r1, [r0, 0x30] ldrb r0, [r4] - bl sub_80769F4 + bl DoHitAnimHealthboxEffect ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -4942,7 +4942,7 @@ dp01t_2E_4_battle_intro: @ 814DA74 adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -5503,7 +5503,7 @@ sub_814DF40: @ 814DF40 orrs r0, r1 strb r0, [r2] ldrb r0, [r4] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility _0814DF86: bl LinkPartnerBufferExecCompleted pop {r4} @@ -5540,7 +5540,7 @@ sub_814DFA0: @ 814DFA0 adds r0, r2, 0 adds r1, r2, 0 adds r3, r6, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _0814DFF0 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index d4df7ea94..b627404c8 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -1256,7 +1256,7 @@ sub_805FC10: @ 805FC10 adds r1, r3, 0 adds r2, r3, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0805FC50: ldr r0, =gBattleBankFunc ldrb r1, [r4] @@ -1405,7 +1405,7 @@ sub_805FD00: @ 805FD00 ldrb r0, [r0] bl SetHealthboxSpriteVisible ldrb r0, [r5] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -4131,7 +4131,7 @@ _0806162C: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08061646: ldr r0, [r6] ldrb r1, [r5] @@ -4156,7 +4156,7 @@ _0806165A: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x2 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -4746,7 +4746,7 @@ OpponentHandleFaintAnimation: @ 8061B9C adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08061BD0: ldr r0, [r6] ldrb r1, [r5] @@ -5029,7 +5029,7 @@ _08061E12: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08061E34: ldr r0, [r7] ldrb r1, [r6] @@ -5087,7 +5087,7 @@ _08061E72: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, [r7] ldrb r1, [r6] ldr r0, [r0] @@ -5218,14 +5218,14 @@ OpponentHandleChooseMove: @ 8061FB8 ands r0, r2 cmp r0, 0 beq _08061FE4 - bl sub_805D19C + bl ChooseMoveAndTargetInBattlePalace adds r2, r0, 0 lsls r2, 16 lsrs r2, 16 movs r0, 0x1 movs r1, 0xA _08061FD6: - bl EmitChoiceReturnValue + bl EmitTwoReturnValues _08061FDA: bl OpponentBufferExecCompleted b _08062156 @@ -5329,7 +5329,7 @@ _0806209C: movs r0, 0x1 movs r1, 0xA adds r2, r4, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues b _08061FDA .pool _080620C4: @@ -5360,7 +5360,7 @@ _080620C6: movs r0, 0x1 movs r1, 0xA adds r2, r4, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues b _08062152 .pool _08062108: @@ -5383,7 +5383,7 @@ _08062108: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues b _08062152 .pool _0806213C: @@ -5395,7 +5395,7 @@ _0806213C: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues _08062152: bl OpponentBufferExecCompleted _08062156: @@ -5417,7 +5417,7 @@ OpponentHandleOpenBag: @ 806215C adds r0, 0xC0 ldrb r1, [r0] movs r0, 0x1 - bl EmitCmd35 + bl EmitOneReturnValue bl OpponentBufferExecCompleted pop {r0} bx r0 @@ -5532,7 +5532,7 @@ _0806225A: lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitCmd34 + bl EmitChosenMonReturnValue bl OpponentBufferExecCompleted pop {r4-r7} pop {r0} @@ -5734,7 +5734,7 @@ OpponentHandleStatusAnimation: @ 8062408 ldrb r2, [r3] lsls r2, 24 orrs r1, r2 - bl move_anim_start_t2_for_situation + bl DoStatusAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -5930,7 +5930,7 @@ _080625A4: movs r1, 0 strh r1, [r0, 0x30] ldrb r0, [r4] - bl sub_80769F4 + bl DoHitAnimHealthboxEffect ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -6064,7 +6064,7 @@ OpponentHandleIntroSlide: @ 80626C8 adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -6546,7 +6546,7 @@ OpponentHandleSpriteInvisibility: @ 8062AD0 orrs r0, r1 strb r0, [r2] ldrb r0, [r4] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility _08062B16: bl OpponentBufferExecCompleted pop {r4} @@ -6582,7 +6582,7 @@ OpponentHandleBattleAnimation: @ 8062B30 str r4, [sp] adds r0, r2, 0 adds r1, r2, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _08062B7C diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s deleted file mode 100644 index efad0fb13..000000000 --- a/asm/battle_controller_player.s +++ /dev/null @@ -1,1822 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start sub_805C114 -sub_805C114: @ 805C114 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0805C13E - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =HandleInputChooseMove - str r1, [r0] -_0805C13E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C114 - - thumb_func_start sub_805C158 -sub_805C158: @ 805C158 - push {lr} - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r1, r0 - movs r0, 0xA6 - lsls r0, 2 - adds r1, r0 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _0805C194 - ldr r1, =gBattlePalaceMoveSelectionRngValue - ldr r0, =gRngValue - ldr r0, [r0] - str r0, [r1] - bl sub_805D19C - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA - bl EmitChoiceReturnValue - bl PlayerBufferExecCompleted -_0805C194: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C158 - - thumb_func_start PlayerHandleChooseMove -PlayerHandleChooseMove: @ 805C1A8 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0805C1EC - ldr r2, =gActiveBank - ldrb r0, [r2] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - movs r1, 0xA6 - lsls r1, 2 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805C158 - b _0805C1FC - .pool -_0805C1EC: - bl sub_805C210 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805C114 -_0805C1FC: - str r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleChooseMove - - thumb_func_start sub_805C210 -sub_805C210: @ 805C210 - push {lr} - bl MoveSelectionDisplayMoveNames - ldr r1, =gMultiUsePlayerCursor - movs r0, 0xFF - strb r0, [r1] - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl MoveSelectionCreateCursorAt - bl MoveSelectionDisplayPpString - bl MoveSelectionDisplayPpNumber - bl MoveSelectionDisplayMoveType - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C210 - - thumb_func_start PlayerHandleOpenBag -PlayerHandleOpenBag: @ 805C248 - push {r4,r5,lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80598A4 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - movs r3, 0 - ldr r5, =gUnknown_0203CF00 - ldr r4, =gBattleBufferA -_0805C276: - adds r0, r3, r5 - ldrb r1, [r2] - lsls r1, 9 - adds r1, 0x1 - adds r1, r3, r1 - adds r1, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0x2 - ble _0805C276 - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleOpenBag - - thumb_func_start PlayerHandleChoosePokemon -PlayerHandleChoosePokemon: @ 805C2AC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - movs r3, 0 - ldr r0, =gUnknown_0203CF00 - mov r12, r0 - ldr r1, =gBattleBufferA - mov r8, r1 - ldr r2, =gActiveBank - ldr r7, =gBattleTypeFlags - mov r6, r12 - mov r5, r8 - adds r4, r2, 0 -_0805C2C8: - adds r0, r3, r6 - ldrb r1, [r4] - lsls r1, 9 - adds r1, 0x4 - adds r1, r3, r1 - adds r1, r5 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0x2 - ble _0805C2C8 - ldr r0, [r7] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - beq _0805C330 - ldrb r3, [r2] - lsls r0, r3, 9 - mov r1, r8 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x2 - beq _0805C330 - ldr r1, =gBattlePartyID - lsls r0, r3, 1 - adds r0, r1 - ldrb r1, [r0] - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - mov r2, r12 - bl EmitCmd34 - bl PlayerBufferExecCompleted - b _0805C3BC - .pool -_0805C330: - ldr r0, =TaskDummy - movs r1, 0xFF - bl CreateTask - ldr r3, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r1, r3 - movs r2, 0 - mov r8, r2 - strb r0, [r1] - ldr r5, =gTasks - ldrb r2, [r4] - adds r3, r2, r3 - ldrb r0, [r3] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldr r5, =gBattleBufferA - lsls r2, 9 - adds r6, r5, 0x1 - adds r2, r6 - ldrb r2, [r2] - movs r0, 0xF - ands r0, r2 - strh r0, [r1, 0x8] - ldr r3, =gBattleStruct - ldr r1, [r3] - adds r1, 0x49 - ldrb r0, [r4] - lsls r0, 9 - adds r0, r6 - ldrb r0, [r0] - lsrs r0, 4 - strb r0, [r1] - ldr r2, [r3] - adds r2, 0x8B - ldrb r0, [r4] - lsls r0, 9 - adds r1, r5, 0x2 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r1, [r3] - adds r1, 0xB0 - ldrb r0, [r4] - lsls r0, 9 - adds r5, 0x3 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - movs r0, 0x1 - negs r0, r0 - mov r1, r8 - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80597CC - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r4] - strb r0, [r1] -_0805C3BC: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleChoosePokemon - - thumb_func_start PlayerHandleCmd23 -PlayerHandleCmd23: @ 805C3EC - push {lr} - sub sp, 0x4 - bl BattleMusicStop - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r1, 0x2 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl PlayerBufferExecCompleted - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd23 - - thumb_func_start PlayerHandleHealthBarUpdate -PlayerHandleHealthBarUpdate: @ 805C410 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r1, [r0] - lsls r1, 9 - adds r0, r3, 0x2 - adds r0, r1, r0 - ldrb r2, [r0] - adds r3, 0x3 - adds r1, r3 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - lsls r2, 16 - asrs r7, r2, 16 - cmp r7, 0 - ble _0805C44A - ldr r1, =gUnknown_0203CD70 - ldr r0, [r1] - adds r0, r7 - str r0, [r1] -_0805C44A: - ldr r0, =0x00007fff - cmp r7, r0 - beq _0805C4B4 - ldr r6, =gBattlePartyID - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r2, r9 - ldrb r0, [r2] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0805C4F2 - .pool -_0805C4B4: - ldr r1, =gBattlePartyID - mov r2, r9 - ldrb r0, [r2] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r4, =gHealthBoxesIds - adds r1, r0, r4 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct - mov r2, r9 - ldrb r0, [r2] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0 - bl UpdateHpTextInHealthbox -_0805C4F2: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t1_healthbar_update - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleHealthBarUpdate - - thumb_func_start PlayerHandleExpUpdate -PlayerHandleExpUpdate: @ 805C528 - push {r4-r7,lr} - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 9 - adds r1, r5, 0x1 - adds r0, r1 - ldrb r7, [r0] - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - cmp r0, 0x63 - bls _0805C560 - bl PlayerBufferExecCompleted - b _0805C5AC - .pool -_0805C560: - movs r0, 0x1 - bl LoadBattleBarGfx - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - ldrb r1, [r6] - lsls r1, 9 - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r0, r5, 0x3 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - ldr r0, =sub_80591B8 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r7, [r1, 0x8] - strh r4, [r1, 0xA] - ldrb r0, [r6] - strh r0, [r1, 0xC] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] -_0805C5AC: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleExpUpdate - - thumb_func_start PlayerHandleStatusIconUpdate -PlayerHandleStatusIconUpdate: @ 805C5C4 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0805C618 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - 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, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059D60 - str r1, [r0] -_0805C618: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleStatusIconUpdate - - thumb_func_start PlayerHandleStatusAnimation -PlayerHandleStatusAnimation: @ 805C63C - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0805C68C - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl move_anim_start_t2_for_situation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059D60 - str r1, [r0] -_0805C68C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleStatusAnimation - - thumb_func_start PlayerHandleStatusXor -PlayerHandleStatusXor: @ 805C6A4 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x37 - bl GetMonData - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - eors r0, r1 - mov r1, sp - strb r0, [r1] - ldrb r0, [r4] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r6 - adds r0, r5 - movs r1, 0x37 - mov r2, sp - bl SetMonData - bl PlayerBufferExecCompleted - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleStatusXor - - thumb_func_start PlayerHandleDataTransfer -PlayerHandleDataTransfer: @ 805C710 - push {lr} - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerHandleDataTransfer - - thumb_func_start PlayerHandleDMA3Transfer -PlayerHandleDMA3Transfer: @ 805C71C - push {r4,r5,lr} - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r2, 9 - adds r0, r3, 0x1 - adds r0, r2, r0 - ldrb r5, [r0] - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r5, r0 - adds r0, r3, 0x3 - adds r0, r2, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r5, r0 - adds r0, r3, 0x4 - adds r0, r2, r0 - ldrb r4, [r0] - lsls r4, 24 - adds r0, r3, 0x5 - adds r0, r2, r0 - ldrb r1, [r0] - adds r0, r3, 0x6 - adds r0, r2, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - adds r3, 0x7 - adds r2, r3 - orrs r5, r4 - lsrs r4, r1, 16 - movs r0, 0x80 - lsls r0, 5 - cmp r4, r0 - bhi _0805C78C - ldr r0, =0x040000d4 - str r2, [r0] - str r5, [r0, 0x4] - lsrs r1, 17 - movs r2, 0x80 - lsls r2, 24 - orrs r1, r2 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - b _0805C7B8 - .pool -_0805C78C: - ldr r3, =0x040000d4 - str r2, [r3] - str r5, [r3, 0x4] - ldr r0, =0x80000800 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] - movs r0, 0x80 - lsls r0, 5 - adds r2, r0 - adds r5, r0 - ldr r1, =0xfffff000 - adds r4, r1 - cmp r4, r0 - bhi _0805C78C - str r2, [r3] - str r5, [r3, 0x4] - lsrs r0, r4, 1 - movs r1, 0x80 - lsls r1, 24 - orrs r0, r1 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] -_0805C7B8: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleDMA3Transfer - - thumb_func_start PlayerHandlePlayBGM -PlayerHandlePlayBGM: @ 805C7D0 - push {lr} - ldr r2, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandlePlayBGM - - thumb_func_start PlayerHandleCmd32 -PlayerHandleCmd32: @ 805C800 - push {lr} - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd32 - - thumb_func_start PlayerHandleCmd33 -PlayerHandleCmd33: @ 805C80C - push {lr} - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl EmitChoiceReturnValue - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd33 - - thumb_func_start PlayerHandleCmd34 -PlayerHandleCmd34: @ 805C820 - push {lr} - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl EmitCmd34 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd34 - - thumb_func_start PlayerHandleCmd35 -PlayerHandleCmd35: @ 805C834 - push {lr} - movs r0, 0x1 - movs r1, 0 - bl EmitCmd35 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd35 - - thumb_func_start PlayerHandleCmd36 -PlayerHandleCmd36: @ 805C848 - push {lr} - movs r0, 0x1 - movs r1, 0 - bl EmitCmd36 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd36 - - thumb_func_start PlayerHandleCmd37 -PlayerHandleCmd37: @ 805C85C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd37 - - thumb_func_start PlayerHandleCmd38 -PlayerHandleCmd38: @ 805C878 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd38 - - thumb_func_start PlayerHandleCmd39 -PlayerHandleCmd39: @ 805C8B0 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd39 - - thumb_func_start PlayerHandleCmd40 -PlayerHandleCmd40: @ 805C8C8 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd40 - - thumb_func_start PlayerHandleHitAnimation -PlayerHandleHitAnimation: @ 805C8F0 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0805C924 - bl PlayerBufferExecCompleted - b _0805C94E - .pool -_0805C924: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =DoHitAnimBlinkEffect - str r1, [r0] -_0805C94E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleHitAnimation - - thumb_func_start PlayerHandleCmd42 -PlayerHandleCmd42: @ 805C960 - push {lr} - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerHandleCmd42 - - thumb_func_start PlayerHandleEffectivenessSound -PlayerHandleEffectivenessSound: @ 805C96C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0805C980 - movs r3, 0xC0 -_0805C980: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleEffectivenessSound - - thumb_func_start PlayerHandlePlayFanfareOrBGM -PlayerHandlePlayFanfareOrBGM: @ 805C9B0 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0805C9EC - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0805CA00 - .pool -_0805C9EC: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0805CA00: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end PlayerHandlePlayFanfareOrBGM - - thumb_func_start PlayerHandleFaintingCry -PlayerHandleFaintingCry: @ 805CA0C - push {lr} - 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, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleFaintingCry - - thumb_func_start PlayerHandleIntroSlide -PlayerHandleIntroSlide: @ 805CA4C - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleIntroSlide - - thumb_func_start PlayerHandleIntroTrainerBallThrow -PlayerHandleIntroTrainerBallThrow: @ 805CA80 - push {r4-r7,lr} - ldr r6, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r7] - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x38] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f8 - bl AllocSpritePalette - adds r4, r0, 0 - lsls r4, 24 - ldr r1, =gTrainerBackPicPaletteTable - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - lsrs r4, 20 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldrb r0, [r7] - adds r0, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =task05_08033660 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r7] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805CBA2 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0805CBA2: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleIntroTrainerBallThrow - - thumb_func_start sub_805CC00 -sub_805CC00: @ 805CC00 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r4, [r5, 0x38] - lsls r4, 24 - lsrs r4, 24 - bl FreeSpriteOamMatrix - ldrb r0, [r5, 0x5] - lsrs r0, 4 - bl GetSpritePaletteTagByPaletteNum - lsls r0, 16 - lsrs r0, 16 - bl FreeSpritePaletteByTag - adds r0, r5, 0 - bl DestroySprite - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - bl BattleLoadPlayerMonSpriteGfx - ldr r0, =gBankSpriteIds - adds r4, r0 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CC00 - - thumb_func_start task05_08033660 -task05_08033660: @ 805CC68 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x1E - bgt _0805CC94 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0805CD50 - .pool -_0805CC94: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805CCB4 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0805CCE4 -_0805CCB4: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_805B258 - b _0805CD38 - .pool -_0805CCE4: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_805B258 - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_805B258 - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_0805CD38: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058B40 - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_0805CD50: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task05_08033660 - - thumb_func_start PlayerHandleDrawPartyStatusSummary -PlayerHandleDrawPartyStatusSummary: @ 805CD74 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0805CDA4 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0805CDA4 - bl PlayerBufferExecCompleted - b _0805CE18 - .pool -_0805CDA4: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0805CE0C - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_0805CE0C: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_805CE38 - str r0, [r1] -_0805CE18: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleDrawPartyStatusSummary - - thumb_func_start sub_805CE38 -sub_805CE38: @ 805CE38 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _0805CE70 - 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, 0x5] - bl PlayerBufferExecCompleted -_0805CE70: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CE38 - - thumb_func_start PlayerHandleCmd49 -PlayerHandleCmd49: @ 805CE80 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805CEB2 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_0805CEB2: - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd49 - - thumb_func_start PlayerHandleCmd50 -PlayerHandleCmd50: @ 805CED0 - 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 - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd50 - - thumb_func_start PlayerHandleSpriteInvisibility -PlayerHandleSpriteInvisibility: @ 805CEF4 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _0805CF3A - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl sub_805E408 -_0805CF3A: - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleSpriteInvisibility - - thumb_func_start PlayerHandleBattleAnimation -PlayerHandleBattleAnimation: @ 805CF54 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0805CFB6 - ldr r4, =gBattleBufferA - ldrb r2, [r5] - lsls r1, r2, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - adds r0, r4, 0x2 - adds r0, r1, r0 - ldrb r3, [r0] - adds r4, 0x3 - adds r1, r4 - ldrb r0, [r1] - lsls r0, 8 - orrs r3, r0 - str r3, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - adds r3, r6, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _0805CFA4 - bl PlayerBufferExecCompleted - b _0805CFB0 - .pool -_0805CFA4: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8059D90 - str r0, [r1] -_0805CFB0: - adds r0, r6, 0 - bl sub_817E32C -_0805CFB6: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleBattleAnimation - - thumb_func_start PlayerHandleLinkStandbyMsg -PlayerHandleLinkStandbyMsg: @ 805CFC8 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 2 - adds r0, r4 - bl sub_81851A8 - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0805D002 - cmp r0, 0x1 - bgt _0805CFF8 - cmp r0, 0 - beq _0805CFFE - b _0805D020 - .pool -_0805CFF8: - cmp r0, 0x2 - beq _0805D01C - b _0805D020 -_0805CFFE: - bl PrintLinkStandbyMsg -_0805D002: - ldr r4, =gActiveBank - ldrb r0, [r4] - movs r1, 0x1 - bl dp11b_obj_free - ldrb r0, [r4] - movs r1, 0 - bl dp11b_obj_free - b _0805D020 - .pool -_0805D01C: - bl PrintLinkStandbyMsg -_0805D020: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end PlayerHandleLinkStandbyMsg - - thumb_func_start PlayerHandleResetActionMoveSelection -PlayerHandleResetActionMoveSelection: @ 805D02C - push {r4,lr} - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r3, [r4] - lsls r0, r3, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r2, [r0] - cmp r2, 0x1 - beq _0805D074 - cmp r2, 0x1 - bgt _0805D054 - cmp r2, 0 - beq _0805D05A - b _0805D084 - .pool -_0805D054: - cmp r2, 0x2 - beq _0805D07C - b _0805D084 -_0805D05A: - ldr r0, =gActionSelectionCursor - adds r0, r3, r0 - strb r2, [r0] - ldr r1, =gMoveSelectionCursor - ldrb r0, [r4] - adds r0, r1 - strb r2, [r0] - b _0805D084 - .pool -_0805D074: - ldr r0, =gActionSelectionCursor - b _0805D07E - .pool -_0805D07C: - ldr r0, =gMoveSelectionCursor -_0805D07E: - adds r0, r3, r0 - movs r1, 0 - strb r1, [r0] -_0805D084: - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleResetActionMoveSelection - - thumb_func_start PlayerHandleCmd55 -PlayerHandleCmd55: @ 805D094 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r0, r4 - bl sub_81851A8 - ldr r2, =gBattleOutcome - ldrb r0, [r5] - lsls r0, 9 - subs r1, r4, 0x3 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x2 - adds r0, r4 - ldrb r0, [r0] - ldr r1, =0x00000ca9 - adds r3, r1 - movs r1, 0x1 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r3] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl PlayerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerHandleCmd55 - - thumb_func_start nullsub_22 -nullsub_22: @ 805D114 - bx lr - thumb_func_end nullsub_22 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index c7ba486a8..dd96fda80 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -645,7 +645,7 @@ _081BB2E2: lsrs r2, 16 movs r0, 0x1 movs r1, 0xB - bl EmitChoiceReturnValue + bl EmitTwoReturnValues strb r5, [r4] bl IsDoubleBattle lsls r0, 24 @@ -918,7 +918,7 @@ _081BB514: lsrs r2, 16 movs r0, 0x1 movs r1, 0xB - bl EmitChoiceReturnValue + bl EmitTwoReturnValues strb r5, [r4] ldr r0, =sub_81BB628 str r0, [r6] @@ -981,7 +981,7 @@ _081BB65C: adds r1, r4, 0 adds r2, r4, 0 movs r3, 0 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, =gTasks lsls r1, r5, 2 adds r1, r5 @@ -1311,7 +1311,7 @@ sub_81BB92C: @ 81BB92C cmp r1, r0 bne _081BB97E adds r0, r3, 0 - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility ldr r0, =gBattleSpritesDataPtr ldr r0, [r0] ldrb r2, [r4] @@ -1326,7 +1326,7 @@ sub_81BB92C: @ 81BB92C adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _081BB972: ldr r0, =gBattleBankFunc ldrb r1, [r4] @@ -4129,7 +4129,7 @@ _081BD318: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _081BD332: ldr r0, [r6] ldrb r1, [r5] @@ -4154,7 +4154,7 @@ _081BD346: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x1 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -4517,7 +4517,7 @@ sub_81BD674: @ 81BD674 adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _081BD6A8: ldr r0, [r6] ldrb r1, [r5] @@ -4828,7 +4828,7 @@ _081BD92A: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _081BD94C: ldr r0, [r7] ldrb r1, [r6] @@ -4886,7 +4886,7 @@ _081BD98A: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, [r7] ldrb r1, [r6] ldr r0, [r0] @@ -5068,7 +5068,7 @@ _081BDB3C: orrs r2, r5 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues bl PlayerPartnerBufferExecCompleted pop {r4-r6} pop {r0} @@ -5138,7 +5138,7 @@ _081BDBD0: lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitCmd34 + bl EmitChosenMonReturnValue bl PlayerPartnerBufferExecCompleted pop {r4-r6} pop {r0} @@ -5398,7 +5398,7 @@ sub_81BDE14: @ 81BDE14 ldrb r2, [r3] lsls r2, 24 orrs r1, r2 - bl move_anim_start_t2_for_situation + bl DoStatusAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -5594,7 +5594,7 @@ _081BDFB0: movs r1, 0 strh r1, [r0, 0x30] ldrb r0, [r4] - bl sub_80769F4 + bl DoHitAnimHealthboxEffect ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -5729,7 +5729,7 @@ dp01t_2E_3_battle_intro: @ 81BE0D8 adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -6236,7 +6236,7 @@ sub_81BE53C: @ 81BE53C orrs r0, r1 strb r0, [r2] ldrb r0, [r4] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility _081BE582: bl PlayerPartnerBufferExecCompleted pop {r4} @@ -6272,7 +6272,7 @@ sub_81BE59C: @ 81BE59C str r4, [sp] adds r0, r2, 0 adds r1, r2, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _081BE5E8 diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 189d41771..0f5477e88 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -1161,7 +1161,7 @@ sub_8186EA4: @ 8186EA4 adds r1, r3, 0 adds r2, r3, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08186EE4: ldr r0, =gBattleBankFunc ldrb r1, [r4] @@ -1310,7 +1310,7 @@ sub_8186F94: @ 8186F94 ldrb r0, [r0] bl SetHealthboxSpriteVisible ldrb r0, [r5] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -3968,7 +3968,7 @@ _08188828: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08188842: ldr r0, [r6] ldrb r1, [r5] @@ -3993,7 +3993,7 @@ _08188856: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x2 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -4301,7 +4301,7 @@ sub_8188AF8: @ 8188AF8 adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08188B2C: ldr r0, [r6] ldrb r1, [r5] @@ -4584,7 +4584,7 @@ _08188D6E: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _08188D90: ldr r0, [r7] ldrb r1, [r6] @@ -4642,7 +4642,7 @@ _08188DCE: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, [r7] ldrb r1, [r6] ldr r0, [r0] @@ -4754,7 +4754,7 @@ sub_8188EF0: @ 8188EF0 lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 @@ -4779,13 +4779,13 @@ sub_8188F20: @ 8188F20 ands r0, r1 cmp r0, 0 beq _08188F48 - bl sub_805D19C + bl ChooseMoveAndTargetInBattlePalace adds r2, r0, 0 lsls r2, 16 lsrs r2, 16 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues b _08188F6C .pool _08188F48: @@ -4803,7 +4803,7 @@ _08188F48: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues _08188F6C: bl RecordedOpponentBufferExecCompleted pop {r4,r5} @@ -4839,7 +4839,7 @@ sub_8188F88: @ 8188F88 ldrb r1, [r0] movs r0, 0x1 movs r2, 0 - bl EmitCmd34 + bl EmitChosenMonReturnValue bl RecordedOpponentBufferExecCompleted pop {r4} pop {r0} @@ -5041,7 +5041,7 @@ sub_8189144: @ 8189144 ldrb r2, [r3] lsls r2, 24 orrs r1, r2 - bl move_anim_start_t2_for_situation + bl DoStatusAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -5237,7 +5237,7 @@ _081892E0: movs r1, 0 strh r1, [r0, 0x30] ldrb r0, [r4] - bl sub_80769F4 + bl DoHitAnimHealthboxEffect ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -5371,7 +5371,7 @@ sub_8189404: @ 8189404 adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -5848,7 +5848,7 @@ sub_8189800: @ 8189800 orrs r0, r1 strb r0, [r2] ldrb r0, [r4] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility _08189846: bl RecordedOpponentBufferExecCompleted pop {r4} @@ -5884,7 +5884,7 @@ sub_8189860: @ 8189860 str r4, [sp] adds r0, r2, 0 adds r1, r2, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _081898AC diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index a5702f5a0..451b6178b 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -1112,7 +1112,7 @@ sub_818A2B4: @ 818A2B4 cmp r1, r0 bne _0818A306 adds r0, r3, 0 - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility ldr r0, =gBattleSpritesDataPtr ldr r0, [r0] ldrb r2, [r4] @@ -1127,7 +1127,7 @@ sub_818A2B4: @ 818A2B4 adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0818A2FA: ldr r0, =gBattleBankFunc ldrb r1, [r4] @@ -3930,7 +3930,7 @@ _0818BCA0: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0818BCBA: ldr r0, [r6] ldrb r1, [r5] @@ -3955,7 +3955,7 @@ _0818BCCE: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x1 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -4373,7 +4373,7 @@ sub_818C064: @ 818C064 adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0818C098: ldr r0, [r6] ldrb r1, [r5] @@ -4684,7 +4684,7 @@ _0818C31A: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0818C33C: ldr r0, [r7] ldrb r1, [r6] @@ -4742,7 +4742,7 @@ _0818C37A: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, [r7] ldrb r1, [r6] ldr r0, [r0] @@ -4861,7 +4861,7 @@ sub_818C49C: @ 818C49C lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues bl RecordedPlayerBufferExecCompleted _0818C4C6: pop {r0} @@ -4897,7 +4897,7 @@ _0818C508: lsrs r1, 24 movs r0, 0x1 movs r2, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues bl RecordedPlayerBufferExecCompleted _0818C522: pop {r0} @@ -4923,13 +4923,13 @@ sub_818C538: @ 818C538 ands r0, r1 cmp r0, 0 beq _0818C560 - bl sub_805D19C + bl ChooseMoveAndTargetInBattlePalace adds r2, r0, 0 lsls r2, 16 lsrs r2, 16 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues b _0818C584 .pool _0818C560: @@ -4947,7 +4947,7 @@ _0818C560: orrs r2, r4 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues _0818C584: bl RecordedPlayerBufferExecCompleted pop {r4,r5} @@ -4983,7 +4983,7 @@ sub_818C5A0: @ 818C5A0 ldrb r1, [r0] movs r0, 0x1 movs r2, 0 - bl EmitCmd34 + bl EmitChosenMonReturnValue bl RecordedPlayerBufferExecCompleted pop {r4} pop {r0} @@ -5192,7 +5192,7 @@ sub_818C76C: @ 818C76C ldrb r2, [r3] lsls r2, 24 orrs r1, r2 - bl move_anim_start_t2_for_situation + bl DoStatusAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -5388,7 +5388,7 @@ _0818C908: movs r1, 0 strh r1, [r0, 0x30] ldrb r0, [r4] - bl sub_80769F4 + bl DoHitAnimHealthboxEffect ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -5523,7 +5523,7 @@ dp01t_2E_2_battle_intro: @ 818CA30 adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -6032,7 +6032,7 @@ sub_818CE98: @ 818CE98 orrs r0, r1 strb r0, [r2] ldrb r0, [r4] - bl sub_805E408 + bl SetBattleSpriteInvisibilityBitToSpriteInvisibility _0818CEDE: bl RecordedPlayerBufferExecCompleted pop {r4} @@ -6068,7 +6068,7 @@ sub_818CEF8: @ 818CEF8 str r4, [sp] adds r0, r2, 0 adds r1, r2, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _0818CF44 diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index 9745fa7c8..4093d433b 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -103,13 +103,13 @@ _0815942A: movs r1, 0x7 _0815942E: movs r2, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues b _08159440 _08159436: movs r0, 0x1 movs r1, 0x8 movs r2, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues _08159440: bl SafariBufferExecCompleted b _0815954E @@ -399,7 +399,7 @@ sub_8159698: @ 8159698 ldr r0, =gScriptItemId ldrh r1, [r0] movs r0, 0x1 - bl EmitCmd35 + bl EmitOneReturnValue bl SafariBufferExecCompleted _081596BE: pop {r0} @@ -707,7 +707,7 @@ sub_8159910: @ 8159910 adds r0, r4, 0 adds r1, r4, 0 movs r3, 0x4 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -746,7 +746,7 @@ sub_8159964: @ 8159964 adds r0, r4, 0 adds r1, r4, 0 movs r3, 0x4 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -1227,7 +1227,7 @@ dp01t_2E_6_battle_intro: @ 8159D5C adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -1329,7 +1329,7 @@ sub_8159E1C: @ 8159E1C str r4, [sp] adds r0, r2, 0 adds r1, r2, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _08159E5C diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index 473582d0e..10b6d30be 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -121,7 +121,7 @@ _081684CE: movs r1, 0x9 _081684E4: movs r2, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues bl WallyBufferExecCompleted ldr r1, [r4] adds r1, 0x94 @@ -176,7 +176,7 @@ _08168540: movs r0, 0x1 movs r1, 0x1 movs r2, 0 - bl EmitChoiceReturnValue + bl EmitTwoReturnValues bl WallyBufferExecCompleted _08168564: pop {r4,r5} @@ -279,7 +279,7 @@ sub_8168610: @ 8168610 ldr r0, =gScriptItemId ldrh r1, [r0] movs r0, 0x1 - bl EmitCmd35 + bl EmitOneReturnValue bl WallyBufferExecCompleted _08168636: pop {r0} @@ -2952,7 +2952,7 @@ WallyHandleReturnMonToBall: @ 8169E44 adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x1 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r0, =gBattleBankFunc ldrb r1, [r6] lsls r1, 2 @@ -3207,7 +3207,7 @@ WallyHandleCmd12: @ 816A084 adds r0, r4, 0 adds r1, r4, 0 movs r3, 0x4 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -3246,7 +3246,7 @@ WallyHandleBallThrow: @ 816A0D8 adds r0, r4, 0 adds r1, r4, 0 movs r3, 0x4 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -3452,7 +3452,7 @@ _0816A2C6: adds r1, r3, 0 adds r2, r3, 0 movs r3, 0x5 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0816A2E2: ldr r0, [r7] ldrb r1, [r6] @@ -3507,7 +3507,7 @@ _0816A320: adds r0, r2, 0 adds r1, r2, 0 movs r3, 0x6 - bl move_anim_start_t4 + bl DoSpecialBattleAnimation _0816A354: ldr r0, [r7] ldrb r1, [r6] @@ -3700,7 +3700,7 @@ _0816A504: beq _0816A550 b _0816A574 _0816A50A: - bl sub_805C210 + bl InitMoveSelectionsVarsAndStrings ldr r1, [r4] adds r1, 0x95 ldrb r0, [r1] @@ -3745,7 +3745,7 @@ _0816A550: lsls r2, 1 movs r0, 0x1 movs r1, 0xA - bl EmitChoiceReturnValue + bl EmitTwoReturnValues bl WallyBufferExecCompleted _0816A574: pop {r4} @@ -4062,7 +4062,7 @@ _0816A7C8: movs r1, 0 strh r1, [r0, 0x30] ldrb r0, [r4] - bl sub_80769F4 + bl DoHitAnimHealthboxEffect ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -4184,7 +4184,7 @@ WallyHandleIntroSlide: @ 816A8D8 adds r1, 0x1 adds r0, r1 ldrb r0, [r0] - bl battle_intro_launch + bl HandleIntroSlide ldr r2, =gUnknown_020243FC ldrh r0, [r2] movs r1, 0x1 @@ -4672,7 +4672,7 @@ WallyHandleBattleAnimation: @ 816AD20 str r4, [sp] adds r0, r2, 0 adds r1, r2, 0 - bl move_anim_start_t3 + bl DoBattleAnimationFromTable lsls r0, 24 cmp r0, 0 beq _0816AD60 diff --git a/asm/battle_link_817C95C.s b/asm/battle_link_817C95C.s index aa887bc25..fedb50c45 100644 --- a/asm/battle_link_817C95C.s +++ b/asm/battle_link_817C95C.s @@ -110,7 +110,7 @@ _0817CA4C: ldr r1, =gStringInfo ldr r1, [r1] ldrh r1, [r1] - bl sub_817F33C + bl GetBankMoveSlotId lsls r0, 24 lsrs r0, 24 mov r10, r0 @@ -2572,7 +2572,7 @@ _0817E122: mov r1, r10 ldrb r0, [r1] adds r1, r7, 0 - bl sub_817F33C + bl GetBankMoveSlotId lsls r0, 24 lsrs r6, r0, 24 cmp r6, 0x3 @@ -4793,8 +4793,8 @@ _0817F324: .pool thumb_func_end sub_817F2A8 - thumb_func_start sub_817F33C -sub_817F33C: @ 817F33C + thumb_func_start GetBankMoveSlotId +GetBankMoveSlotId: @ 817F33C push {r4-r7,lr} lsls r0, 24 lsrs r5, r0, 24 @@ -4835,7 +4835,7 @@ _0817F388: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_817F33C + thumb_func_end GetBankMoveSlotId thumb_func_start sub_817F394 sub_817F394: @ 817F394 @@ -4888,97 +4888,4 @@ _0817F3E6: bx r0 thumb_func_end sub_817F394 - thumb_func_start nullsub_69 -nullsub_69: @ 817F3EC - bx lr - thumb_func_end nullsub_69 - - thumb_func_start sub_817F3F0 -sub_817F3F0: @ 817F3F0 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x4 - mov r9, r0 - mov r8, r1 - adds r5, r2, 0 - adds r4, r3, 0 - lsls r5, 16 - negs r5, r5 - lsls r4, 16 - negs r4, r4 - lsrs r4, 16 - mov r0, r8 - lsls r0, 16 - asrs r0, 16 - mov r8, r0 - asrs r5, 16 - adds r1, r5, 0 - bl Cos - adds r6, r0, 0 - lsls r4, 16 - asrs r4, 16 - mov r0, r8 - adds r1, r4, 0 - bl Sin - subs r6, r0 - lsls r6, 16 - lsrs r6, 16 - mov r0, r8 - adds r1, r4, 0 - bl Cos - adds r2, r0, 0 - mov r0, r8 - adds r1, r5, 0 - str r2, [sp] - bl Sin - ldr r2, [sp] - adds r2, r0 - negs r5, r5 - negs r4, r4 - lsls r6, 16 - asrs r6, 16 - lsls r5, 16 - asrs r5, 16 - adds r6, r5 - mov r0, r9 - strh r6, [r0, 0x24] - lsls r2, 16 - asrs r2, 16 - lsls r4, 16 - asrs r4, 16 - adds r2, r4 - strh r2, [r0, 0x26] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817F3F0 - - thumb_func_start GetSpeciesBackAnimId -GetSpeciesBackAnimId: @ 817F474 - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gUnknown_0860A8C8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0817F48C - movs r0, 0 - b _0817F492 - .pool -_0817F48C: - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 -_0817F492: - pop {r1} - bx r1 - thumb_func_end GetSpeciesBackAnimId - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokeball.s b/asm/pokeball.s index fed227c80..0afd27932 100755 --- a/asm/pokeball.s +++ b/asm/pokeball.s @@ -2685,8 +2685,8 @@ _080769EA: .pool thumb_func_end sub_80769CC - thumb_func_start sub_80769F4 -sub_80769F4: @ 80769F4 + thumb_func_start DoHitAnimHealthboxEffect +DoHitAnimHealthboxEffect: @ 80769F4 push {r4,r5,lr} adds r4, r0, 0 lsls r4, 24 @@ -2714,7 +2714,7 @@ sub_80769F4: @ 80769F4 pop {r0} bx r0 .pool - thumb_func_end sub_80769F4 + thumb_func_end DoHitAnimHealthboxEffect thumb_func_start oamc_804BEB4 oamc_804BEB4: @ 8076A38 diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index a29ecb729..870e658f7 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -4,6 +4,100 @@ .syntax unified .text + + + thumb_func_start nullsub_69 +nullsub_69: @ 817F3EC + bx lr + thumb_func_end nullsub_69 + + thumb_func_start sub_817F3F0 +sub_817F3F0: @ 817F3F0 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0x4 + mov r9, r0 + mov r8, r1 + adds r5, r2, 0 + adds r4, r3, 0 + lsls r5, 16 + negs r5, r5 + lsls r4, 16 + negs r4, r4 + lsrs r4, 16 + mov r0, r8 + lsls r0, 16 + asrs r0, 16 + mov r8, r0 + asrs r5, 16 + adds r1, r5, 0 + bl Cos + adds r6, r0, 0 + lsls r4, 16 + asrs r4, 16 + mov r0, r8 + adds r1, r4, 0 + bl Sin + subs r6, r0 + lsls r6, 16 + lsrs r6, 16 + mov r0, r8 + adds r1, r4, 0 + bl Cos + adds r2, r0, 0 + mov r0, r8 + adds r1, r5, 0 + str r2, [sp] + bl Sin + ldr r2, [sp] + adds r2, r0 + negs r5, r5 + negs r4, r4 + lsls r6, 16 + asrs r6, 16 + lsls r5, 16 + asrs r5, 16 + adds r6, r5 + mov r0, r9 + strh r6, [r0, 0x24] + lsls r2, 16 + asrs r2, 16 + lsls r4, 16 + asrs r4, 16 + adds r2, r4 + strh r2, [r0, 0x26] + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_817F3F0 + + thumb_func_start GetSpeciesBackAnimId +GetSpeciesBackAnimId: @ 817F474 + push {lr} + lsls r0, 16 + lsrs r0, 16 + ldr r1, =gUnknown_0860A8C8 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _0817F48C + movs r0, 0 + b _0817F492 + .pool +_0817F48C: + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 +_0817F492: + pop {r1} + bx r1 + thumb_func_end GetSpeciesBackAnimId thumb_func_start sub_817F498 sub_817F498: @ 817F498 diff --git a/include/battle.h b/include/battle.h index 7d97f7777..6079d019e 100644 --- a/include/battle.h +++ b/include/battle.h @@ -750,38 +750,39 @@ extern struct BattleStruct* gBattleStruct; #define MOVE_EFFECT_AFFECTS_USER 0x40 #define MOVE_EFFECT_CERTAIN 0x80 -// battle animations ids +// table ids for general animations +#define B_ANIM_CASTFORM_CHANGE 0x0 +#define B_ANIM_STATS_CHANGE 0x1 +#define B_ANIM_SUBSTITUTE_FADE 0x2 +#define B_ANIM_SUBSTITUTE_APPEAR 0x3 +#define B_ANIM_x4 0x4 +#define B_ANIM_ITEM_KNOCKOFF 0x5 +#define B_ANIM_TURN_TRAP 0x6 +#define B_ANIM_ITEM_EFFECT 0x7 +#define B_ANIM_SMOKEBALL_ESCAPE 0x8 +#define B_ANIM_HANGED_ON 0x9 +#define B_ANIM_RAIN_CONTINUES 0xA +#define B_ANIM_SUN_CONTINUES 0xB +#define B_ANIM_SANDSTORM_CONTINUES 0xC +#define B_ANIM_HAIL_CONTINUES 0xD +#define B_ANIM_LEECH_SEED_DRAIN 0xE +#define B_ANIM_MON_HIT 0xF +#define B_ANIM_ITEM_STEAL 0x10 +#define B_ANIM_SNATCH_MOVE 0x11 +#define B_ANIM_FUTURE_SIGHT_HIT 0x12 +#define B_ANIM_x13 0x13 +#define B_ANIM_x14 0x14 +#define B_ANIM_INGRAIN_HEAL 0x15 +#define B_ANIM_WISH_HEAL 0x16 -#define B_ANIM_CASTFORM_CHANGE 0x0 -#define B_ANIM_STATS_CHANGE 0x1 -#define B_ANIM_SUBSTITUTE_FADE 0x2 -#define B_ANIM_SUBSTITUTE_APPEAR 0x3 -#define B_ANIM_x4 0x4 -#define B_ANIM_ITEM_KNOCKOFF 0x5 -#define B_ANIM_TURN_TRAP 0x6 -#define B_ANIM_ITEM_EFFECT 0x7 -#define B_ANIM_SMOKEBALL_ESCAPE 0x8 -#define B_ANIM_HANGED_ON 0x9 -#define B_ANIM_RAIN_CONTINUES 0xA -#define B_ANIM_SUN_CONTINUES 0xB -#define B_ANIM_SANDSTORM_CONTINUES 0xC -#define B_ANIM_HAIL_CONTINUES 0xD -#define B_ANIM_LEECH_SEED_DRAIN 0xE -#define B_ANIM_MON_HIT 0xF -#define B_ANIM_ITEM_STEAL 0x10 -#define B_ANIM_SNATCH_MOVE 0x11 -#define B_ANIM_FUTURE_SIGHT_HIT 0x12 -#define B_ANIM_x13 0x13 -#define B_ANIM_x14 0x14 -#define B_ANIM_INGRAIN_HEAL 0x15 -#define B_ANIM_WISH_HEAL 0x16 -#define B_ANIM_x17 0x17 -#define B_ANIM_x18 0x18 -#define B_ANIM_x19 0x19 -#define B_ANIM_x1A 0x1A -#define B_ANIM_x1B 0x1B -#define B_ANIM_x1C 0x1C -#define B_ANIM_x1D 0x1D +// special animations table +#define B_ANIM_LVL_UP 0x0 +#define B_ANIM_SWITCH_OUT_MON 0x1 +#define B_ANIM_SPECIAL_2 0x2 +#define B_ANIM_BALL_THROW 0x3 +#define B_ANIM_SPECIAL_4 0x4 +#define B_ANIM_SUBSTITUTE_TO_MON 0x5 +#define B_ANIM_MON_TO_SUBSTITUTE 0x6 #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 #define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 @@ -868,6 +869,13 @@ bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn); void sub_805EB9C(u8 arg0); void sub_805E394(void); void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move); +void DoStatusAnimation(bool8 isStatus2, u32 status); +void DoSpecialBattleAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId); +bool8 DoBattleAnimationFromTable(u8 active, u8 atkBank, u8 defBank, u8 tableId, u16 argument); +void SetBattleSpriteInvisibilityBitToSpriteInvisibility(u8 bank); +u16 ChooseMoveAndTargetInBattlePalace(void); +void LoadBattleBarGfx(u8 arg0); +bool8 mplay_80342A4(u8 bank); enum { @@ -905,7 +913,7 @@ struct BattleAnimationInfo u8 field_5; u8 field_6; u8 field_7; - u8 field_8; + u8 ballThrowCaseId; u8 field_9_x1 : 1; u8 field_9_x2 : 1; u8 field_9_x1C : 3; @@ -920,9 +928,9 @@ struct BattleHealthboxInfo u8 flag_x2 : 1; u8 flag_x4 : 1; u8 flag_x8 : 1; - u8 flag_x10 : 1; - u8 flag_x20 : 1; - u8 flag_x40 : 1; + u8 statusAnimActive : 1; // x10 + u8 animFromTableActive : 1; // x20 + u8 specialAnimActive : 1; //x40 u8 flag_x80 : 1; u8 field_1_x1 : 1; u8 field_1_x2 : 1; @@ -934,7 +942,7 @@ struct BattleHealthboxInfo u8 field_1_x80 : 1; u8 field_2; u8 field_3; - u8 field_4; + u8 animationState; u8 field_5; u8 field_6; u8 field_7; @@ -949,7 +957,7 @@ struct BattleBarInfo u8 healthboxSpriteId; s32 maxValue; s32 currentValue; - s32 field_C; + s32 receivedValue; s32 field_10; }; diff --git a/include/battle_2.h b/include/battle_2.h index 0d4bcbc67..ee61efd9b 100644 --- a/include/battle_2.h +++ b/include/battle_2.h @@ -2,26 +2,45 @@ #define GUARD_BATTLE_2_H void CB2_InitBattle(void); -void CB2_QuitRecordedBattle(void); -void FaintClearSetData(void); -void SwitchInClearSetData(void); -void sub_803BDA0(u8 bank); void BattleMainCB2(void); +void CB2_QuitRecordedBattle(void); +void sub_8038528(struct Sprite* sprite); +void sub_8038A04(void); // unused void VBlankCB_Battle(void); -bool8 TryRunFromBattle(u8 bank); -u8 IsRunningFromBattleImpossible(void); -u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves); -void SwapTurnOrder(u8 id1, u8 id2); -void BattleTurnPassed(void); +void nullsub_17(void); +void sub_8038B74(struct Sprite *sprite); void sub_8038D64(void); -void RunBattleScriptCommands_PopCallbacksStack(void); -void RunBattleScriptCommands(void); +u32 sub_80391E0(u8 arrayId, u8 caseId); u32 sub_80397C4(u32 setId, u32 tableId); -void sub_8039E9C(struct Sprite *sprite); -void sub_8039B2C(struct Sprite *sprite); +void oac_poke_opponent(struct Sprite *sprite); +void SpriteCallbackDummy_2(struct Sprite *sprite); +void sub_8039934(struct Sprite *sprite); void sub_8039AD8(struct Sprite *sprite); +void sub_8039B2C(struct Sprite *sprite); +void sub_8039B58(struct Sprite *sprite); +void sub_8039BB4(struct Sprite *sprite); +void sub_80105DC(struct Sprite *sprite); +void sub_8039C00(struct Sprite *sprite); +void dp11b_obj_instanciate(u8 bank, u8 b, s8 c, s8 d); +void dp11b_obj_free(u8 bank, bool8 b); +void sub_8039E44(struct Sprite *sprite); +void sub_8039E60(struct Sprite *sprite); +void sub_8039E84(struct Sprite *sprite); +void sub_8039E9C(struct Sprite *sprite); void nullsub_20(void); void BeginBattleIntro(void); +void SwitchInClearSetData(void); +void FaintClearSetData(void); +void sub_803B3AC(void); // unused +void sub_803B598(void); // unused +void BattleTurnPassed(void); +u8 IsRunningFromBattleImpossible(void); +void sub_803BDA0(u8 bank); +void SwapTurnOrder(u8 id1, u8 id2); +u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves); +void RunBattleScriptCommands_PopCallbacksStack(void); +void RunBattleScriptCommands(void); +bool8 TryRunFromBattle(u8 bank); extern const u8 gStatusConditionString_PoisonJpn[8]; extern const u8 gStatusConditionString_SleepJpn[8]; diff --git a/include/battle_anim.h b/include/battle_anim.h index 5282916c0..67f0813bc 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -60,7 +60,7 @@ extern u8 gUnknown_02038440; void ClearBattleAnimationVars(void); void DoMoveAnim(u16 move); -void DoBattleAnim(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim); +void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim); void DestroyAnimSprite(struct Sprite *sprite); void DestroyAnimVisualTask(u8 taskId); void DestroyAnimSoundTask(u8 taskId); @@ -75,5 +75,24 @@ s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); // battle_anim_80FE840.s void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value); void sub_8118FBC(u8 arg0, u8 arg1, u8 arg2, u8 bankIdentity, u8 arg4, void *arg5, u16 *arg6, u16 arg7); +void HandleIntroSlide(u8 terrainId); + +// battle_anim_80A5C6C.s +void sub_80A6EEC(struct Sprite *sprite); +void sub_80A8278(void); +void sub_80A6B30(struct UnknownAnimStruct2*); +void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); +u8 sub_80A82E4(u8 bank); +u8 sub_80A5C6C(u8 bank, u8 attributeId); +bool8 AnimBankSpriteExists(u8 bank); +void sub_80A6C68(u8 arg0); +u8 GetAnimBankSpriteId(u8 wantedBank); +bool8 IsDoubleBattle(void); +u8 sub_80A6D94(void); +u8 sub_80A8364(u8); +void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); +void oamt_add_pos2_onto_pos1(struct Sprite *sprite); +u8 sub_80A6138(u8 bank); +u8 sub_80A82E4(u8 bank); #endif // GUARD_BATTLE_ANIM_H diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 0b8fb0c0e..8affb1406 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -76,6 +76,16 @@ enum #define BALL_3_SHAKES_SUCCESS 4 #define BALL_TRAINER_BLOCK 5 +#define RET_VALUE_LEVELLED_UP 11 + +#define INSTANT_HP_BAR_DROP 32767 + +struct UnusedControllerStruct +{ + u8 field_0 : 7; + u8 flag_x80 : 1; +}; + struct HpAndStatus { u16 hp; @@ -113,14 +123,14 @@ enum CONTROLLER_TRAINERSLIDEBACK, CONTROLLER_FAINTANIMATION, CONTROLLER_PALETTEFADE, - CONTROLLER_12, - CONTROLLER_BALLTHROW, + CONTROLLER_SUCCESSBALLTHROWANIM, + CONTROLLER_BALLTHROWANIM, CONTROLLER_PAUSE, CONTROLLER_MOVEANIMATION, CONTROLLER_PRINTSTRING, CONTROLLER_PRINTSTRINGPLAYERONLY, CONTROLLER_CHOOSEACTION, - CONTROLLER_YESNOBOX, + CONTROLLER_UNKNOWNYESNOBOX, CONTROLLER_CHOOSEMOVE, CONTROLLER_OPENBAG, CONTROLLER_CHOOSEPOKEMON, @@ -134,10 +144,10 @@ enum CONTROLLER_DMA3TRANSFER, CONTROLLER_31, CONTROLLER_32, - CONTROLLER_CHOICERETURNVALUE, - CONTROLLER_34, - CONTROLLER_35, - CONTROLLER_36, + CONTROLLER_TWORETURNVALUES, + CONTROLLER_CHOSENMONRETURNVALUE, + CONTROLLER_ONERETURNVALUE, + CONTROLLER_ONERETURNVALUE_DUPLICATE, CONTROLLER_37, CONTROLLER_38, CONTROLLER_39, @@ -182,16 +192,16 @@ void EmitTrainerSlide(u8 bufferId); void EmitTrainerSlideBack(u8 bufferId); void EmitFaintAnimation(u8 bufferId); void EmitPaletteFade(u8 bufferId); // unused -void EmitCmd12(u8 bufferId); // unused -void EmitBallThrow(u8 bufferId, u8 caseId); +void EmitSuccessBallThrowAnim(u8 bufferId); // unused +void EmitBallThrowAnim(u8 bufferId, u8 caseId); void EmitPause(u8 bufferId, u8 toWait, void *data); // unused void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); void EmitPrintString(u8 bufferId, u16 stringId); void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId); void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2); -void EmitYesNoBox(u8 bufferId); +void EmitUnknownYesNoBox(u8 bufferId); void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); -void EmitOpenBag(u8 bufferId, u8* arg1); +void EmitChooseItem(u8 bufferId, u8* arg1); void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4); void EmitCmd23(u8 bufferId); // unused void EmitHealthBarUpdate(u8 bufferId, u16 hpValue); @@ -203,14 +213,14 @@ void EmitDataTransfer(u8 bufferId, u16 size, void *data); void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused void EmitCmd32(u8 bufferId, u16 size, void *c); // unused -void EmitChoiceReturnValue(u8 bufferId, u8 arg1, u16 arg2); -void EmitCmd34(u8 bufferId, u8 b, u8 *c); -void EmitCmd35(u8 bufferId, u16 b); -void EmitCmd36(u8 bufferId, u16 b); -void EmitCmd37(u8 bufferId); -void EmitCmd38(u8 bufferId, u8 b); -void EmitCmd39(u8 bufferId); -void EmitCmd40(u8 bufferId); +void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2); +void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c); +void EmitOneReturnValue(u8 bufferId, u16 arg1); +void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b); +void EmitCmd37(u8 bufferId); // unused +void EmitCmd38(u8 bufferId, u8 b); // unused +void EmitCmd39(u8 bufferId); // unused +void EmitCmd40(u8 bufferId); // unused void EmitHitAnimation(u8 bufferId); void EmitCmd42(u8 bufferId); void EmitEffectivenessSound(u8 bufferId, u16 songId); @@ -230,8 +240,15 @@ void EmitCmd55(u8 bufferId, u8 arg1); // player controller void SetBankFuncToPlayerBufferRunCommand(void); void nullsub_21(void); +void PlayerHandleGetRawMonData(void); +void sub_80587B0(void); +void sub_805CC00(struct Sprite *sprite); +void SetCB2ToReshowScreenAfterMenu(void); +void SetCB2ToReshowScreenAfterMenu2(void); +void c3_0802FDF4(u8 taskId); void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused); void ActionSelectionDestroyCursorAt(u8 cursorPos); +void InitMoveSelectionsVarsAndStrings(void); // recorded player controller void SetBankFuncToRecordedPlayerBufferRunCommand(void); diff --git a/include/battle_interface.h b/include/battle_interface.h index 0980b0002..aad30f7b3 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -9,6 +9,12 @@ enum HP_MAX }; +enum +{ + HEALTH_BAR, + EXP_BAR +}; + #define TAG_HEALTHBOX_PLAYER1_TILE 0xD6FF #define TAG_HEALTHBOX_PLAYER2_TILE 0xD700 #define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701 @@ -41,7 +47,7 @@ enum u8 CreateBankHealthboxSprites(u8 bank); u8 CreateSafariPlayerHealthboxSprites(void); -void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 field_C); +void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue); void SetHealthboxSpriteInvisible(u8 healthboxSpriteId); void SetHealthboxSpriteVisible(u8 healthboxSpriteId); void DestoryHealthboxSprite(u8 healthboxSpriteId); diff --git a/include/battle_link_817C95C.h b/include/battle_link_817C95C.h new file mode 100644 index 000000000..815c1f058 --- /dev/null +++ b/include/battle_link_817C95C.h @@ -0,0 +1,11 @@ +#ifndef GUARD_BATTLE_LINK_817C95C_H +#define GUARD_BATTLE_LINK_817C95C_H + +void sub_817C95C(u16 stringId); +void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr); +void sub_817E32C(u8 animationId); +void sub_817E3F4(void); +void sub_817F2A8(void); +u8 GetBankMoveSlotId(u8 bank, u16 move); + +#endif // GUARD_BATTLE_LINK_817C95C_H diff --git a/include/link.h b/include/link.h index b8835ce04..7a6563144 100644 --- a/include/link.h +++ b/include/link.h @@ -191,5 +191,6 @@ void sub_800A620(void); void sub_8011BD0(void); u8 sub_800ABAC(void); u8 sub_800ABBC(void); +void sub_800AC34(void); #endif // GUARD_LINK_H diff --git a/include/pokeball.h b/include/pokeball.h new file mode 100644 index 000000000..76f084465 --- /dev/null +++ b/include/pokeball.h @@ -0,0 +1,8 @@ +#ifndef GUARD_POKEBALL_H +#define GUARD_POKEBALL_H + +u8 sub_80753E8(u16, u8); +void sub_8076918(u8 bank); +void DoHitAnimHealthboxEffect(u8 bank); + +#endif // GUARD_POKEBALL_H diff --git a/ld_script.txt b/ld_script.txt index 71320dd90..31d2fd728 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -62,7 +62,6 @@ SECTIONS { 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); @@ -117,7 +116,7 @@ SECTIONS { src/palette.o(.text); src/sound.o(.text); src/battle_anim.o(.text); - asm/rom_80A5C6C.o(.text); + asm/battle_anim_80A5C6C.o(.text); src/task.o(.text); src/reshow_battle_screen.o(.text); asm/battle_anim_80A9C70.o(.text); diff --git a/src/battle_2.c b/src/battle_2.c index f2a5508e0..fd1b88b48 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -238,7 +238,6 @@ static void sub_8038F34(void); static void sub_80392A8(void); static void sub_803937C(void); static void sub_803939C(void); -void oac_poke_opponent(struct Sprite *sprite); static void sub_803980C(struct Sprite *sprite); static void sub_8039838(struct Sprite *sprite); static void sub_8039894(struct Sprite *sprite); @@ -4025,7 +4024,7 @@ static void HandleTurnActionSelectionState(void) } else { - EmitOpenBag(0, gBattleStruct->field_60[gActiveBank]); + EmitChooseItem(0, gBattleStruct->field_60[gActiveBank]); MarkBufferBankForExecution(gActiveBank); } break; @@ -4070,7 +4069,7 @@ static void HandleTurnActionSelectionState(void) } break; case ACTION_POKEBLOCK_CASE: - EmitOpenBag(0, gBattleStruct->field_60[gActiveBank]); + EmitChooseItem(0, gBattleStruct->field_60[gActiveBank]); MarkBufferBankForExecution(gActiveBank); break; case ACTION_CANCEL_PARTNER: diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 3f97c59a5..de440054c 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void) && gDisableStructs[gActiveBank].perishSong1 == 0) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void) if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void) if (Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0) { *(gBattleStruct->field_294 + gActiveBank) = i; - EmitChoiceReturnValue(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void) } } - EmitChoiceReturnValue(1, 0, (gActiveBank ^ BIT_SIDE) << 8); + EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBank ^ BIT_SIDE) << 8); } #define TYPE_FORESIGHT 0xFE @@ -940,7 +940,7 @@ static bool8 ShouldUseItem(void) if (shouldUse) { - EmitChoiceReturnValue(1, 1, 0); + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); *(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; diff --git a/src/battle_anim.c b/src/battle_anim.c index 023272017..d41dc77c4 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -47,18 +47,6 @@ extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; extern const struct BattleAnimBackground gBattleAnimBackgroundTable[]; -extern void sub_80A8278(void); // rom_80A5C6C.s -extern void sub_80A6B30(struct UnknownAnimStruct2*); // rom_80A5C6C.s -extern void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); // rom_80A5C6C.s -extern u8 sub_80A82E4(u8 bank); // rom_80A5C6C.s -extern u8 sub_80A5C6C(u8 bank, u8 attributeId); // rom_80A5C6C.s -extern bool8 AnimBankSpriteExists(u8 bank); // rom_80A5C6C.s -extern void sub_80A6C68(u8 arg0); // rom_80A5C6C.s -extern u8 GetAnimBankSpriteId(u8 wantedBank); // rom_80A5C6C.s -extern u8 sub_80A6D94(void); -extern u8 sub_80A8364(u8); -extern bool8 IsDoubleBattle(void); - // this file's functions static void ScriptCmd_loadspritegfx(void); static void ScriptCmd_unloadspritegfx(void); @@ -234,10 +222,10 @@ void DoMoveAnim(u16 move) { gAnimBankAttacker = gBankAttacker; gAnimBankTarget = gBankTarget; - DoBattleAnim(gBattleAnims_Moves, move, TRUE); + LaunchBattleAnimation(gBattleAnims_Moves, move, TRUE); } -void DoBattleAnim(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim) +void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim) { s32 i; @@ -1281,7 +1269,7 @@ static void ScriptCmd_changebg(void) s8 BattleAnimAdjustPanning(s8 pan) { - if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].flag_x10) + if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive) { if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER) pan = PAN_SIDE_OPPONENT; @@ -1323,7 +1311,7 @@ s8 BattleAnimAdjustPanning(s8 pan) s8 BattleAnimAdjustPanning2(s8 pan) { - if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].flag_x10) + if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive) { if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER) pan = PAN_SIDE_OPPONENT; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 03b67c28f..b41dbf0bc 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -4,6 +4,7 @@ #include "battle_message.h" #include "battle_interface.h" #include "battle_anim.h" +#include "battle_link_817C95C.h" #include "pokemon.h" #include "link.h" #include "util.h" @@ -21,6 +22,8 @@ #include "string_util.h" #include "bg.h" #include "reshow_battle_screen.h" +#include "rng.h" +#include "pokeball.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -39,98 +42,134 @@ extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; extern u8 gMultiUsePlayerCursor; extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern struct MusicPlayerInfo gMPlay_BGM; +extern u16 gPartnerTrainerId; +extern struct SpriteTemplate gUnknown_0202499C; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gScriptItemId; +extern u8 gUnknown_0203CEE8; +extern u8 gUnknown_0203CEE9; +extern u8 gUnknown_0203CF00[]; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u8 gNumberOfMovesToChoose; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern s32 gUnknown_0203CD70; +extern u8 gBankInMenu; +extern u32 gBattlePalaceMoveSelectionRngValue; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u8 gUnknown_020244B4[]; +extern u16 gUnknown_020243FC; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const u8 gTypeNames[][7]; 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); +extern const u8 gText_BattleSwitchWhich[]; +extern const u8 gText_MoveInterfacePP[]; +extern const u8 gText_MoveInterfaceType[]; +extern const u8 gText_LinkStandby[]; +extern const u8 gText_BattleMenu[]; +extern const u8 gText_WhatWillPkmnDo[]; +extern const u8 gText_BattleYesNoChoice[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_81B89AC(u8 arg0); +extern void sub_81AABB0(void); +extern void sub_806A068(u16, u8); +extern void sub_81A57E4(u8 bank, u16 stringId); +extern void sub_81851A8(u8 *); // this file's functions -void PlayerHandleGetMonData(void); +static 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 PlayerHandlePaletteFade(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); +static void PlayerHandleSetMonData(void); +static void PlayerHandleSetRawMonData(void); +static void PlayerHandleLoadMonSprite(void); +static void PlayerHandleSwitchInAnim(void); +static void PlayerHandleReturnMonToBall(void); +static void PlayerHandleDrawTrainerPic(void); +static void PlayerHandleTrainerSlide(void); +static void PlayerHandleTrainerSlideBack(void); +static void PlayerHandleFaintAnimation(void); +static void PlayerHandlePaletteFade(void); +static void PlayerHandleSuccessBallThrowAnim(void); +static void PlayerHandleBallThrowAnim(void); +static void PlayerHandlePause(void); +static void PlayerHandleMoveAnimation(void); +static void PlayerHandlePrintString(void); +static void PlayerHandlePrintStringPlayerOnly(void); +static void PlayerHandleChooseAction(void); +static void PlayerHandleUnknownYesNoBox(void); +static void PlayerHandleChooseMove(void); +static void PlayerHandleChooseItem(void); +static void PlayerHandleChoosePokemon(void); +static void PlayerHandleCmd23(void); +static void PlayerHandleHealthBarUpdate(void); +static void PlayerHandleExpUpdate(void); +static void PlayerHandleStatusIconUpdate(void); +static void PlayerHandleStatusAnimation(void); +static void PlayerHandleStatusXor(void); +static void PlayerHandleDataTransfer(void); +static void PlayerHandleDMA3Transfer(void); +static void PlayerHandlePlayBGM(void); +static void PlayerHandleCmd32(void); +static void PlayerHandleTwoReturnValues(void); +static void PlayerHandleChosenMonReturnValue(void); +static void PlayerHandleOneReturnValue(void); +static void PlayerHandleOneReturnValue_Duplicate(void); +static void PlayerHandleCmd37(void); +static void PlayerHandleCmd38(void); +static void PlayerHandleCmd39(void); +static void PlayerHandleCmd40(void); +static void PlayerHandleHitAnimation(void); +static void PlayerHandleCmd42(void); +static void PlayerHandleEffectivenessSound(void); +static void PlayerHandlePlayFanfareOrBGM(void); +static void PlayerHandleFaintingCry(void); +static void PlayerHandleIntroSlide(void); +static void PlayerHandleIntroTrainerBallThrow(void); +static void PlayerHandleDrawPartyStatusSummary(void); +static void PlayerHandleCmd49(void); +static void PlayerHandleCmd50(void); +static void PlayerHandleSpriteInvisibility(void); +static void PlayerHandleBattleAnimation(void); +static void PlayerHandleLinkStandbyMsg(void); +static void PlayerHandleResetActionMoveSelection(void); +static void PlayerHandleCmd55(void); +static 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); -u32 CopyPlayerMonData(u8 monId, u8 *dst); -void SetPlayerMonData(u8 monId); -void sub_805B258(u8 bank, bool8 dontClearSubstituteBit); -void sub_805B464(void); -void PlayerDoMoveAnimation(void); +static void PlayerBufferRunCommand(void); +static void HandleInputChooseTarget(void); +static void HandleInputChooseMove(void); +static void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1); +static void MoveSelectionDestroyCursorAt(u8 cursorPos); +static void MoveSelectionDisplayPpNumber(void); +static void MoveSelectionDisplayPpString(void); +static void MoveSelectionDisplayMoveType(void); +static void MoveSelectionDisplayMoveNames(void); +static void HandleMoveSwitchting(void); +static void sub_8058FC0(void); +static void sub_8059828(void); +static void sub_80598E0(void); +static void sub_8059544(u8 taskId); +static void Task_PrepareToGiveExpWithExpBar(u8 taskId); +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); +static void sub_8059400(u8 taskId); +static void sub_80595A4(u8 taskId); +static void PrintLinkStandbyMsg(void); +static u32 CopyPlayerMonData(u8 monId, u8 *dst); +static void SetPlayerMonData(u8 monId); +static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void PlayerDoMoveAnimation(void); +static void task05_08033660(u8 taskId); +static void sub_805CE38(void); -void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { PlayerHandleGetMonData, PlayerHandleGetRawMonData, @@ -144,16 +183,16 @@ void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = PlayerHandleTrainerSlideBack, PlayerHandleFaintAnimation, PlayerHandlePaletteFade, - PlayerHandleCmd12, - PlayerHandleBallThrow, + PlayerHandleSuccessBallThrowAnim, + PlayerHandleBallThrowAnim, PlayerHandlePause, PlayerHandleMoveAnimation, PlayerHandlePrintString, PlayerHandlePrintStringPlayerOnly, PlayerHandleChooseAction, - PlayerHandleCmd19, + PlayerHandleUnknownYesNoBox, PlayerHandleChooseMove, - PlayerHandleOpenBag, + PlayerHandleChooseItem, PlayerHandleChoosePokemon, PlayerHandleCmd23, PlayerHandleHealthBarUpdate, @@ -165,10 +204,10 @@ void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = PlayerHandleDMA3Transfer, PlayerHandlePlayBGM, PlayerHandleCmd32, - PlayerHandleCmd33, - PlayerHandleCmd34, - PlayerHandleCmd35, - PlayerHandleCmd36, + PlayerHandleTwoReturnValues, + PlayerHandleChosenMonReturnValue, + PlayerHandleOneReturnValue, + PlayerHandleOneReturnValue_Duplicate, PlayerHandleCmd37, PlayerHandleCmd38, PlayerHandleCmd39, @@ -207,7 +246,7 @@ void SetBankFuncToPlayerBufferRunCommand(void) gUnknown_020244CC = 0; } -void PlayerBufferExecCompleted(void) +static void PlayerBufferExecCompleted(void) { gBattleBankFunc[gActiveBank] = PlayerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) @@ -223,7 +262,7 @@ void PlayerBufferExecCompleted(void) } } -void PlayerBufferRunCommand(void) +static void PlayerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { @@ -234,13 +273,13 @@ void PlayerBufferRunCommand(void) } } -void CompleteOnBankSpritePosX_0(void) +static void CompleteOnBankSpritePosX_0(void) { if (gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) PlayerBufferExecCompleted(); } -void HandleInputChooseAction(void) +static void HandleInputChooseAction(void) { u16 itemId = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); @@ -259,16 +298,16 @@ void HandleInputChooseAction(void) switch (gActionSelectionCursor[gActiveBank]) { case ACTION_USE_MOVE: - EmitChoiceReturnValue(1, ACTION_USE_MOVE, 0); + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); break; case ACTION_USE_ITEM: - EmitChoiceReturnValue(1, ACTION_USE_ITEM, 0); + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); break; case ACTION_SWITCH: - EmitChoiceReturnValue(1, ACTION_SWITCH, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); break; case ACTION_RUN: - EmitChoiceReturnValue(1, ACTION_RUN, 0); + EmitTwoReturnValues(1, ACTION_RUN, 0); break; } PlayerBufferExecCompleted(); @@ -329,7 +368,7 @@ void HandleInputChooseAction(void) return; } PlaySE(SE_SELECT); - EmitChoiceReturnValue(1, ACTION_CANCEL_PARTNER, 0); + EmitTwoReturnValues(1, ACTION_CANCEL_PARTNER, 0); PlayerBufferExecCompleted(); } } @@ -339,14 +378,14 @@ void HandleInputChooseAction(void) } } -void sub_80577F0(void) // unused +static void sub_80577F0(void) // unused { dp11b_obj_free(gActiveBank, 1); dp11b_obj_free(gActiveBank, 0); gBattleBankFunc[gActiveBank] = HandleInputChooseTarget; } -void HandleInputChooseTarget(void) +static void HandleInputChooseTarget(void) { s32 i; u8 identities[4]; @@ -375,7 +414,7 @@ void HandleInputChooseTarget(void) { PlaySE(SE_SELECT); gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; - EmitChoiceReturnValue(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); dp11b_obj_free(gMultiUsePlayerCursor, 1); PlayerBufferExecCompleted(); } @@ -474,10 +513,7 @@ void HandleInputChooseTarget(void) } } -extern u8 gNumberOfMovesToChoose; -extern const u8 gText_BattleSwitchWhich[]; - -void HandleInputChooseMove(void) +static void HandleInputChooseMove(void) { bool32 canSelectTarget = FALSE; struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); @@ -532,7 +568,7 @@ void HandleInputChooseMove(void) if (!canSelectTarget) { - EmitChoiceReturnValue(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); PlayerBufferExecCompleted(); } else @@ -552,7 +588,7 @@ void HandleInputChooseMove(void) else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) { PlaySE(SE_SELECT); - EmitChoiceReturnValue(1, 10, 0xFFFF); + EmitTwoReturnValues(1, 10, 0xFFFF); PlayerBufferExecCompleted(); } else if (gMain.newKeys & DPAD_LEFT) @@ -623,9 +659,6 @@ void HandleInputChooseMove(void) } } -extern u16 gBattle_BG0_X; -extern u16 gBattle_BG0_Y; - u32 sub_8057FBC(void) // unused { u32 var = 0; @@ -676,7 +709,7 @@ u32 sub_8057FBC(void) // unused return var; } -void HandleMoveSwitchting(void) +static void HandleMoveSwitchting(void) { u8 perMovePPBonuses[4]; struct ChooseMoveStruct moveStruct; @@ -860,10 +893,7 @@ void HandleMoveSwitchting(void) } } -extern u8 gBattleOutcome; -extern void sub_817E3F4(void); // battle_link_817C95C - -void sub_80586F8(void) +static void sub_80586F8(void) { if (gLinkVSyncDisabled == 0) { @@ -919,19 +949,19 @@ void sub_80587B0(void) } } -void CompleteOnBankSpriteCallbackDummy(void) +static void CompleteOnBankSpriteCallbackDummy(void) { if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) PlayerBufferExecCompleted(); } -void CompleteOnBankSpriteCallbackDummy2(void) +static void CompleteOnBankSpriteCallbackDummy2(void) { if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) PlayerBufferExecCompleted(); } -void sub_80588B4(void) +static void sub_80588B4(void) { if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) { @@ -942,7 +972,7 @@ void sub_80588B4(void) } } -void sub_8058924(void) +static void sub_8058924(void) { if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) { @@ -951,11 +981,7 @@ void sub_8058924(void) } } -extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; - -extern bool8 IsDoubleBattle(void); - -void sub_805896C(void) +static void sub_805896C(void) { bool8 var = FALSE; @@ -991,11 +1017,7 @@ void sub_805896C(void) } } -extern void sub_8172EF0(u8 bank, struct Pokemon *mon); -extern void sub_8076918(u8 bank); -extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; - -void sub_8058B40(void) +static void sub_8058B40(void) { bool32 r9 = FALSE; bool32 r8 = FALSE; @@ -1071,31 +1093,28 @@ void sub_8058B40(void) } } -extern void sub_805E408(u8 bank); -extern void move_anim_start_t4(u8 arg0, u8 atkBank, u8 defBank, u8 tableId); - -void sub_8058EDC(void) +static void sub_8058EDC(void) { if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) { - sub_805E408(gActiveBank); + SetBattleSpriteInvisibilityBitToSpriteInvisibility(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); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleBankFunc[gActiveBank] = sub_8058FC0; } } -void sub_8058FC0(void) +static void sub_8058FC0(void) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40 + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); @@ -1104,7 +1123,7 @@ void sub_8058FC0(void) } } -void sub_805902C(void) +static void sub_805902C(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) @@ -1132,7 +1151,7 @@ void c3_0802FDF4(u8 taskId) } } -void bx_t1_healthbar_update(void) +static void CompleteOnHealthbarDone(void) { s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); @@ -1149,19 +1168,24 @@ void bx_t1_healthbar_update(void) } } -void CompleteOnInactiveTextPrinter(void) +static 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]; +#define tExpTask_monId data[0] +#define tExpTask_gainedExp data[1] +#define tExpTask_bank data[2] +#define tExpTask_frames data[10] - if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) +static void Task_GiveExpToMon(u8 taskId) +{ + u32 monId = (u8)(gTasks[taskId].tExpTask_monId); + u8 bank = gTasks[taskId].tExpTask_bank; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + + if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) // give exp without the expbar { struct Pokemon *mon = &gPlayerParty[monId]; u16 species = GetMonData(mon, MON_DATA_SPECIES); @@ -1178,7 +1202,7 @@ void sub_80591B8(u8 taskId) gainedExp -= nextLvlExp - currExp; savedActiveBank = gActiveBank; gActiveBank = bank; - EmitChoiceReturnValue(1, 11, gainedExp); + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); gActiveBank = savedActiveBank; if (IsDoubleBattle() == TRUE @@ -1197,15 +1221,15 @@ void sub_80591B8(u8 taskId) } else { - gTasks[taskId].func = sub_8059330; + gTasks[taskId].func = Task_PrepareToGiveExpWithExpBar; } } -void sub_8059330(u8 taskId) +static void Task_PrepareToGiveExpWithExpBar(u8 taskId) { - u8 monIndex = gTasks[taskId].data[0]; - s32 gainedExp = gTasks[taskId].data[1]; - u8 bank = gTasks[taskId].data[2]; + u8 monIndex = gTasks[taskId].tExpTask_monId; + s32 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; struct Pokemon *mon = &gPlayerParty[monIndex]; u8 level = GetMonData(mon, MON_DATA_LEVEL); u16 species = GetMonData(mon, MON_DATA_SPECIES); @@ -1220,20 +1244,20 @@ void sub_8059330(u8 taskId) gTasks[taskId].func = sub_8059400; } -void sub_8059400(u8 taskId) +static void sub_8059400(u8 taskId) { - if (gTasks[taskId].data[10] < 13) + if (gTasks[taskId].tExpTask_frames < 13) { - gTasks[taskId].data[10]++; + gTasks[taskId].tExpTask_frames++; } else { - u8 monId = gTasks[taskId].data[0]; - s16 gainedExp = gTasks[taskId].data[1]; - u8 bank = gTasks[taskId].data[2]; + u8 monId = gTasks[taskId].tExpTask_monId; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; s16 r4; - r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], 1, 0); + r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], EXP_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[bank]); if (r4 == -1) { @@ -1257,7 +1281,7 @@ void sub_8059400(u8 taskId) gainedExp -= expOnNextLvl - currExp; savedActiveBank = gActiveBank; gActiveBank = bank; - EmitChoiceReturnValue(1, 11, gainedExp); + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); gActiveBank = savedActiveBank; gTasks[taskId].func = sub_8059544; } @@ -1272,25 +1296,25 @@ void sub_8059400(u8 taskId) } } -void sub_8059544(u8 taskId) +static void sub_8059544(u8 taskId) { - u8 bank = gTasks[taskId].data[2]; - u8 monIndex = gTasks[taskId].data[0]; + u8 bank = gTasks[taskId].tExpTask_bank; + u8 monIndex = gTasks[taskId].tExpTask_monId; if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) bank ^= BIT_MON; - move_anim_start_t4(bank, bank, bank, 0); + DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP); gTasks[taskId].func = sub_80595A4; } -void sub_80595A4(u8 taskId) +static void sub_80595A4(u8 taskId) { - u8 bank = gTasks[taskId].data[2]; + u8 bank = gTasks[taskId].tExpTask_bank; - if (!gBattleSpritesDataPtr->healthBoxesData[bank].flag_x40) + if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive) { - u8 monIndex = gTasks[taskId].data[0]; + u8 monIndex = gTasks[taskId].tExpTask_monId; GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value @@ -1303,19 +1327,19 @@ void sub_80595A4(u8 taskId) } } -void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) { u8 monIndex; u8 bank; - monIndex = gTasks[taskId].data[0]; + monIndex = gTasks[taskId].tExpTask_monId; GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value - bank = gTasks[taskId].data[2]; + bank = gTasks[taskId].tExpTask_bank; gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; DestroyTask(taskId); } -void sub_80596A8(void) +static void sub_80596A8(void) { if (gSprites[gBankSpriteIds[gActiveBank]].pos1.y + gSprites[gBankSpriteIds[gActiveBank]].pos2.y > DISPLAY_HEIGHT) { @@ -1329,9 +1353,9 @@ void sub_80596A8(void) } } -void sub_8059744(void) +static void sub_8059744(void) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); @@ -1340,15 +1364,13 @@ void sub_8059744(void) } } -void CompleteOnInactiveTextPrinter2(void) +static void CompleteOnInactiveTextPrinter2(void) { if (!IsTextPrinterActive(0)) PlayerBufferExecCompleted(); } -extern void sub_81B89AC(u8 arg0); - -void sub_80597CC(void) +static void sub_80597CC(void) { if (!gPaletteFade.active) { @@ -1362,18 +1384,14 @@ void sub_80597CC(void) } } -extern u8 gUnknown_0203CEE8; -extern u8 gUnknown_0203CEE9; -extern u8 gUnknown_0203CF00[]; - -void sub_8059828(void) +static void sub_8059828(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { if (gUnknown_0203CEE8 == 1) - EmitCmd34(1, gUnknown_0203CEE9, gUnknown_0203CF00); + EmitChosenMonReturnValue(1, gUnknown_0203CEE9, gUnknown_0203CF00); else - EmitCmd34(1, 6, NULL); + EmitChosenMonReturnValue(1, 6, NULL); if ((gBattleBufferA[gActiveBank][1] & 0xF) == 1) PrintLinkStandbyMsg(); @@ -1382,10 +1400,7 @@ void sub_8059828(void) } } -extern void sub_81AABB0(void); -extern void nullsub_35(void); - -void sub_80598A4(void) +static void sub_80598A4(void) { if (!gPaletteFade.active) { @@ -1396,24 +1411,22 @@ void sub_80598A4(void) } } -extern u16 gScriptItemId; - -void sub_80598E0(void) +static void sub_80598E0(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - EmitCmd35(1, gScriptItemId); + EmitOneReturnValue(1, gScriptItemId); PlayerBufferExecCompleted(); } } -void sub_805991C(void) +static void CompleteOnSpecialAnimDone(void) { - if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) PlayerBufferExecCompleted(); } -void DoHitAnimBlinkEffect(void) +static void DoHitAnimBlinkSpriteEffect(void) { u8 spriteId = gBankSpriteIds[gActiveBank]; @@ -1432,7 +1445,7 @@ void DoHitAnimBlinkEffect(void) } } -void PlayerHandleYesNoInput(void) +static void PlayerHandleUnknownYesNoInput(void) { if (gMain.newKeys & DPAD_UP && gMultiUsePlayerCursor != 0) { @@ -1454,9 +1467,9 @@ void PlayerHandleYesNoInput(void) PlaySE(SE_SELECT); if (gMultiUsePlayerCursor != 0) - EmitChoiceReturnValue(1, 0xE, 0); + EmitTwoReturnValues(1, 0xE, 0); else - EmitChoiceReturnValue(1, 0xD, 0); + EmitTwoReturnValues(1, 0xD, 0); PlayerBufferExecCompleted(); } @@ -1468,10 +1481,7 @@ void PlayerHandleYesNoInput(void) } } -extern const u8 gText_MoveInterfacePP[]; -extern const u8 gText_MoveInterfaceType[]; - -void MoveSelectionDisplayMoveNames(void) +static void MoveSelectionDisplayMoveNames(void) { s32 i; struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); @@ -1487,13 +1497,13 @@ void MoveSelectionDisplayMoveNames(void) } } -void MoveSelectionDisplayPpString(void) +static void MoveSelectionDisplayPpString(void) { StringCopy(gDisplayedStringBattle, gText_MoveInterfacePP); BattleHandleAddTextPrinter(gDisplayedStringBattle, 7); } -void MoveSelectionDisplayPpNumber(void) +static void MoveSelectionDisplayPpNumber(void) { u8 *txtPtr; struct ChooseMoveStruct *moveInfo; @@ -1511,9 +1521,7 @@ void MoveSelectionDisplayPpNumber(void) BattleHandleAddTextPrinter(gDisplayedStringBattle, 9); } -extern const u8 gTypeNames[][7]; - -void MoveSelectionDisplayMoveType(void) +static void MoveSelectionDisplayMoveType(void) { u8 *txtPtr; struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); @@ -1530,7 +1538,7 @@ void MoveSelectionDisplayMoveType(void) BattleHandleAddTextPrinter(gDisplayedStringBattle, 10); } -void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) { u16 src[2]; src[0] = arg1 + 1; @@ -1540,7 +1548,7 @@ void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) CopyBgTilemapBufferToVram(0); } -void MoveSelectionDestroyCursorAt(u8 cursorPosition) +static void MoveSelectionDestroyCursorAt(u8 cursorPosition) { u16 src[2]; src[0] = 0x1016; @@ -1580,21 +1588,19 @@ void SetCB2ToReshowScreenAfterMenu2(void) SetMainCallback2(ReshowBattleScreenAfterMenu); } -void sub_8059D60(void) +static void CompleteOnFinishedStatusAnimation(void) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x10) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) PlayerBufferExecCompleted(); } -void sub_8059D90(void) +static void CompleteOnFinishedBattleAnimation(void) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) PlayerBufferExecCompleted(); } -extern const u8 gText_LinkStandby[]; - -void PrintLinkStandbyMsg(void) +static void PrintLinkStandbyMsg(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) { @@ -1604,7 +1610,7 @@ void PrintLinkStandbyMsg(void) } } -void PlayerHandleGetMonData(void) +static void PlayerHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; @@ -1629,7 +1635,7 @@ void PlayerHandleGetMonData(void) PlayerBufferExecCompleted(); } -u32 CopyPlayerMonData(u8 monId, u8 *dst) +static u32 CopyPlayerMonData(u8 monId, u8 *dst) { struct BattlePokemon battleMon; struct MovePpInfo moveData; @@ -1949,7 +1955,7 @@ void PlayerHandleGetRawMonData(void) PlayerBufferExecCompleted(); } -void PlayerHandleSetMonData(void) +static void PlayerHandleSetMonData(void) { u8 monsToCheck; u8 i; @@ -1971,7 +1977,7 @@ void PlayerHandleSetMonData(void) PlayerBufferExecCompleted(); } -void SetPlayerMonData(u8 monId) +static void SetPlayerMonData(u8 monId) { struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; @@ -2189,7 +2195,7 @@ void SetPlayerMonData(u8 monId) sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); } -void PlayerHandleSetRawMonData(void) +static void PlayerHandleSetRawMonData(void) { u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; u8 i; @@ -2200,14 +2206,14 @@ void PlayerHandleSetRawMonData(void) PlayerBufferExecCompleted(); } -void PlayerHandleLoadMonSprite(void) +static void PlayerHandleLoadMonSprite(void) { BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; gBattleBankFunc[gActiveBank] = CompleteOnBankSpritePosX_0; } -void PlayerHandleSwitchInAnim(void) +static void PlayerHandleSwitchInAnim(void) { ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; @@ -2218,16 +2224,7 @@ void PlayerHandleSwitchInAnim(void) gBattleBankFunc[gActiveBank] = sub_805902C; } -extern struct SpriteTemplate gUnknown_0202499C; -extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; - -extern u8 sub_80A5C6C(u16, u8); -extern u8 sub_80A6138(u8 bank); -extern u8 sub_80A82E4(u8 bank); -extern u8 sub_80753E8(u16, u8); -extern void sub_806A068(u16, u8); - -void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) +static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) { u16 species; @@ -2258,12 +2255,12 @@ void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); } -void PlayerHandleReturnMonToBall(void) +static void PlayerHandleReturnMonToBall(void) { if (gBattleBufferA[gActiveBank][1] == 0) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; - gBattleBankFunc[gActiveBank] = sub_805B464; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; } else { @@ -2274,21 +2271,21 @@ void PlayerHandleReturnMonToBall(void) } } -void sub_805B464(void) +static void DoSwitchOutAnimation(void) { - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4) + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 5); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; - move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 1); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); gBattleBankFunc[gActiveBank] = sub_8059744; } break; @@ -2306,14 +2303,10 @@ struct MonCoords extern const struct MonCoords gTrainerBackPicCoords[]; extern const struct MonCoords gTrainerFrontPicCoords[]; -extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; - -extern u16 gPartnerTrainerId; - // some explanation here // in emerald it's possible to have a tag battle in the battle frontier facilities with AI // which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it -void PlayerHandleDrawTrainerPic(void) +static void PlayerHandleDrawTrainerPic(void) { s16 xPos, yPos; u32 trainerPicId; @@ -2396,7 +2389,7 @@ void PlayerHandleDrawTrainerPic(void) gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; } -void PlayerHandleTrainerSlide(void) +static void PlayerHandleTrainerSlide(void) { u32 trainerPicId; @@ -2434,12 +2427,7 @@ void PlayerHandleTrainerSlide(void) gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; } -extern void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); -extern void oamt_add_pos2_onto_pos1(struct Sprite *sprite); -extern void sub_80A6EEC(struct Sprite *sprite); -extern void sub_8039C00(struct Sprite *sprite); - -void PlayerHandleTrainerSlideBack(void) +static void PlayerHandleTrainerSlideBack(void) { oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; @@ -2451,19 +2439,19 @@ void PlayerHandleTrainerSlideBack(void) gBattleBankFunc[gActiveBank] = sub_80588B4; } -void PlayerHandleFaintAnimation(void) +static void PlayerHandleFaintAnimation(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 == 0) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) - move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 5); - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4++; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; } else { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); PlaySE12WithPanning(SE_POKE_DEAD, -64); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; @@ -2474,31 +2462,31 @@ void PlayerHandleFaintAnimation(void) } } -void PlayerHandlePaletteFade(void) +static void PlayerHandlePaletteFade(void) { BeginNormalPaletteFade(-1, 2, 0, 16, 0); PlayerBufferExecCompleted(); } -void PlayerHandleCmd12(void) +static void PlayerHandleSuccessBallThrowAnim(void) { - gBattleSpritesDataPtr->animationData->field_8 = 4; + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gDoingBattleAnim = TRUE; - move_anim_start_t4(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), 3); - gBattleBankFunc[gActiveBank] = sub_805991C; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; } -void PlayerHandleBallThrow(void) +static void PlayerHandleBallThrowAnim(void) { - u8 var = gBattleBufferA[gActiveBank][1]; + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; - gBattleSpritesDataPtr->animationData->field_8 = var; + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gDoingBattleAnim = TRUE; - move_anim_start_t4(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), 3); - gBattleBankFunc[gActiveBank] = sub_805991C; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; } -void PlayerHandlePause(void) +static void PlayerHandlePause(void) { u8 var = gBattleBufferA[gActiveBank][1]; @@ -2509,12 +2497,7 @@ void PlayerHandlePause(void) PlayerBufferExecCompleted(); } -extern void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr); -extern bool8 mplay_80342A4(u8 bank); - -extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; - -void PlayerHandleMoveAnimation(void) +static void PlayerHandleMoveAnimation(void) { if (!mplay_80342A4(gActiveBank)) { @@ -2533,35 +2516,35 @@ void PlayerHandleMoveAnimation(void) } else { - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleBankFunc[gActiveBank] = PlayerDoMoveAnimation; sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); } } } -void PlayerDoMoveAnimation(void) +static void PlayerDoMoveAnimation(void) { u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); u8 multihit = gBattleBufferA[gActiveBank][11]; - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4) + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) { case 0: if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) { gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; - move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 5); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; break; case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { sub_805EB9C(0); DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 2; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; } break; case 2: @@ -2571,28 +2554,25 @@ void PlayerDoMoveAnimation(void) sub_805EB9C(1); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) { - move_anim_start_t4(gActiveBank, gActiveBank, gActiveBank, 6); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; } - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 3; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; } break; case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x40) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { sub_805E394(); TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_4 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; PlayerBufferExecCompleted(); } break; } } -extern void sub_817C95C(u16 stringId); -extern void sub_81A57E4(u8 bank, u16 stringId); - -void PlayerHandlePrintString(void) +static void PlayerHandlePrintString(void) { u16 *stringId; @@ -2606,7 +2586,7 @@ void PlayerHandlePrintString(void) sub_81A57E4(gActiveBank, *stringId); } -void PlayerHandlePrintStringPlayerOnly(void) +static void PlayerHandlePrintStringPlayerOnly(void) { if (GetBankSide(gActiveBank) == SIDE_PLAYER) PlayerHandlePrintString(); @@ -2614,7 +2594,7 @@ void PlayerHandlePrintStringPlayerOnly(void) PlayerBufferExecCompleted(); } -void HandleChooseActionAfterDma3(void) +static void HandleChooseActionAfterDma3(void) { if (!IsDma3ManagerBusyWithBgCopy()) { @@ -2624,12 +2604,7 @@ void HandleChooseActionAfterDma3(void) } } -extern void sub_817F2A8(void); -extern const u8 gText_BattleMenu[]; -extern const u8 gText_WhatWillPkmnDo[]; -extern const u8 gText_BattleYesNoChoice[]; - -void PlayerHandleChooseAction(void) +static void PlayerHandleChooseAction(void) { s32 i; @@ -2645,7 +2620,7 @@ void PlayerHandleChooseAction(void) BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); } -void PlayerHandleCmd19(void) +static void PlayerHandleUnknownYesNoBox(void) { if (GetBankSide(gActiveBank) == SIDE_PLAYER) { @@ -2653,10 +2628,533 @@ void PlayerHandleCmd19(void) BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 12); gMultiUsePlayerCursor = 1; BattleCreateYesNoCursorAt(1); - gBattleBankFunc[gActiveBank] = PlayerHandleYesNoInput; + gBattleBankFunc[gActiveBank] = PlayerHandleUnknownYesNoInput; } else { PlayerBufferExecCompleted(); } } + +static void HandleChooseMoveAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 320; + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + } +} + +static void PlayerChooseMoveInBattlePalace(void) +{ + if (--*(gBattleStruct->field_298 + gActiveBank) == 0) + { + gBattlePalaceMoveSelectionRngValue = gRngValue; + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + PlayerBufferExecCompleted(); + } +} + +static void PlayerHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + *(gBattleStruct->field_298 + gActiveBank) = 8; + gBattleBankFunc[gActiveBank] = PlayerChooseMoveInBattlePalace; + } + else + { + InitMoveSelectionsVarsAndStrings(); + gBattleBankFunc[gActiveBank] = HandleChooseMoveAfterDma3; + } +} + +void InitMoveSelectionsVarsAndStrings(void) +{ + MoveSelectionDisplayMoveNames(); + gMultiUsePlayerCursor = 0xFF; + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpString(); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); +} + +static void PlayerHandleChooseItem(void) +{ + s32 i; + + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = sub_80598A4; + gBankInMenu = gActiveBank; + + for (i = 0; i < 3; i++) + gUnknown_0203CF00[i] = gBattleBufferA[gActiveBank][1 + i]; +} + +static void PlayerHandleChoosePokemon(void) +{ + s32 i; + + for (i = 0; i < 3; i++) + gUnknown_0203CF00[i] = gBattleBufferA[gActiveBank][4 + i]; + + if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBank][1] & 0xF) != 2) + { + EmitChosenMonReturnValue(1, gBattlePartyID[gActiveBank] + 1, gUnknown_0203CF00); + PlayerBufferExecCompleted(); + } + else + { + gUnknown_03005D7C[gActiveBank] = CreateTask(TaskDummy, 0xFF); + gTasks[gUnknown_03005D7C[gActiveBank]].data[0] = gBattleBufferA[gActiveBank][1] & 0xF; + *(&gBattleStruct->field_49) = gBattleBufferA[gActiveBank][1] >> 4; + *(&gBattleStruct->field_8B) = gBattleBufferA[gActiveBank][2]; + *(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBank][3]; + BeginNormalPaletteFade(-1, 0, 0, 16, 0); + gBattleBankFunc[gActiveBank] = sub_80597CC; + gBankInMenu = gActiveBank; + } +} + +static void PlayerHandleCmd23(void) +{ + BattleMusicStop(); + BeginNormalPaletteFade(-1, 2, 0, 16, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal > 0) + gUnknown_0203CD70 += hpVal; + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void PlayerHandleExpUpdate(void) +{ + u8 monId = gBattleBufferA[gActiveBank][1]; + + if (GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL) >= MAX_MON_LEVEL) + { + PlayerBufferExecCompleted(); + } + else + { + s16 expPointsToGive; + u8 taskId; + + LoadBattleBarGfx(1); + GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // unused return value + expPointsToGive = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + taskId = CreateTask(Task_GiveExpToMon, 10); + gTasks[taskId].tExpTask_monId = monId; + gTasks[taskId].tExpTask_gainedExp = expPointsToGive; + gTasks[taskId].tExpTask_bank = gActiveBank; + gBattleBankFunc[gActiveBank] = nullsub_21; + } +} + +#undef tExpTask_monId +#undef tExpTask_gainedExp +#undef tExpTask_bank +#undef tExpTask_frames + +static void PlayerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerHandleStatusXor(void) +{ + u8 val = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_STATUS) ^ gBattleBufferA[gActiveBank][1]; + + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_STATUS, &val); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleDataTransfer(void) +{ + PlayerBufferExecCompleted(); +} + +static void PlayerHandleDMA3Transfer(void) +{ + u32 dstArg = gBattleBufferA[gActiveBank][1] + | (gBattleBufferA[gActiveBank][2] << 8) + | (gBattleBufferA[gActiveBank][3] << 16) + | (gBattleBufferA[gActiveBank][4] << 24); + u16 sizeArg = gBattleBufferA[gActiveBank][5] | (gBattleBufferA[gActiveBank][6] << 8); + + const u8 *src = &gBattleBufferA[gActiveBank][7]; + u8 *dst = (u8*)(dstArg); + u32 size = sizeArg; + + while (1) + { + if (size <= 0x1000) + { + DmaCopy16(3, src, dst, size); + break; + } + DmaCopy16(3, src, dst, 0x1000); + src += 0x1000; + dst += 0x1000; + size -= 0x1000; + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandlePlayBGM(void) +{ + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd32(void) +{ + PlayerBufferExecCompleted(); +} + +static void PlayerHandleTwoReturnValues(void) +{ + EmitTwoReturnValues(1, 0, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleChosenMonReturnValue(void) +{ + EmitChosenMonReturnValue(1, 0, NULL); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleOneReturnValue(void) +{ + EmitOneReturnValue(1, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleOneReturnValue_Duplicate(void) +{ + EmitOneReturnValue_Duplicate(1, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + PlayerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = 1; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void PlayerHandleCmd42(void) +{ + PlayerBufferExecCompleted(); +} + +static void PlayerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + PlayerBufferExecCompleted(); +} + +static void PlayerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + PlayerBufferExecCompleted(); +} + +static void PlayerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F8); + LoadCompressedPalette(gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data, 0x100 + paletteNum * 16, 32); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(task05_08033660, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_21; +} + +void sub_805CC00(struct Sprite *sprite) +{ + u8 bank = sprite->data5; + + FreeSpriteOamMatrix(sprite); + FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum)); + DestroySprite(sprite); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], 0); +} + +static void task05_08033660(u8 taskId) +{ + if (gTasks[taskId].data[1] < 31) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_805B258(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_805B258(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_805B258(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_8058B40; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void PlayerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + PlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_805CE38; + } +} + +static void sub_805CE38(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + PlayerBufferExecCompleted(); + } +} + +static void PlayerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd50(void) +{ + dp11b_obj_free(gActiveBank, 1); + dp11b_obj_free(gActiveBank, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleSpriteInvisibility(void) +{ + if (AnimBankSpriteExists(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + PlayerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + + sub_817E32C(animationId); + } +} + +static void PlayerHandleLinkStandbyMsg(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][2]); + switch (gBattleBufferA[gActiveBank][1]) + { + case 0: + PrintLinkStandbyMsg(); + // fall through + case 1: + dp11b_obj_free(gActiveBank, 1); + dp11b_obj_free(gActiveBank, 0); + break; + case 2: + PrintLinkStandbyMsg(); + break; + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandleResetActionMoveSelection(void) +{ + switch (gBattleBufferA[gActiveBank][1]) + { + case RESET_ACTION_MOVE_SELECTION: + gActionSelectionCursor[gActiveBank] = 0; + gMoveSelectionCursor[gActiveBank] = 0; + break; + case RESET_ACTION_SELECTION: + gActionSelectionCursor[gActiveBank] = 0; + break; + case RESET_MOVE_SELECTION: + gMoveSelectionCursor[gActiveBank] = 0; + break; + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd55(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][4]); + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBank][2]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + PlayerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_22(void) +{ +} diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 1086c6955..bf6962b1b 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -984,9 +984,9 @@ void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) void EmitLoadMonSprite(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE; - gBattleBuffersTransferData[1] = 4; - gBattleBuffersTransferData[2] = 4; - gBattleBuffersTransferData[3] = 4; + gBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE; + gBattleBuffersTransferData[2] = CONTROLLER_LOADMONSPRITE; + gBattleBuffersTransferData[3] = CONTROLLER_LOADMONSPRITE; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1009,27 +1009,27 @@ void EmitReturnMonToBall(u8 bufferId, u8 arg1) void EmitDrawTrainerPic(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC; - gBattleBuffersTransferData[1] = 7; - gBattleBuffersTransferData[2] = 7; - gBattleBuffersTransferData[3] = 7; + gBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC; + gBattleBuffersTransferData[2] = CONTROLLER_DRAWTRAINERPIC; + gBattleBuffersTransferData[3] = CONTROLLER_DRAWTRAINERPIC; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitTrainerSlide(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE; - gBattleBuffersTransferData[1] = 8; - gBattleBuffersTransferData[2] = 8; - gBattleBuffersTransferData[3] = 8; + gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE; + gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDE; + gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDE; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitTrainerSlideBack(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK; - gBattleBuffersTransferData[1] = 9; - gBattleBuffersTransferData[2] = 9; - gBattleBuffersTransferData[3] = 9; + gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK; + gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDEBACK; + gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDEBACK; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1051,18 +1051,18 @@ void EmitPaletteFade(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd12(u8 bufferId) +void EmitSuccessBallThrowAnim(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_12; - gBattleBuffersTransferData[1] = 12; - gBattleBuffersTransferData[2] = 12; - gBattleBuffersTransferData[3] = 12; + gBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleBuffersTransferData[2] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleBuffersTransferData[3] = CONTROLLER_SUCCESSBALLTHROWANIM; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitBallThrow(u8 bufferId, u8 caseId) +void EmitBallThrowAnim(u8 bufferId, u8 caseId) { - gBattleBuffersTransferData[0] = CONTROLLER_BALLTHROW; + gBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM; gBattleBuffersTransferData[1] = caseId; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } @@ -1178,12 +1178,12 @@ void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitYesNoBox(u8 bufferId) +void EmitUnknownYesNoBox(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_YESNOBOX; - gBattleBuffersTransferData[1] = CONTROLLER_YESNOBOX; - gBattleBuffersTransferData[2] = CONTROLLER_YESNOBOX; - gBattleBuffersTransferData[3] = CONTROLLER_YESNOBOX; + gBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX; + gBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX; + gBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX; + gBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1200,7 +1200,7 @@ void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(*movePpData) + 4); } -void EmitOpenBag(u8 bufferId, u8 *arg1) +void EmitChooseItem(u8 bufferId, u8 *arg1) { s32 i; @@ -1337,38 +1337,38 @@ void EmitCmd32(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 3); } -void EmitChoiceReturnValue(u8 bufferId, u8 arg1, u16 arg2) +void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) { - gBattleBuffersTransferData[0] = CONTROLLER_CHOICERETURNVALUE; + gBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; gBattleBuffersTransferData[1] = arg1; gBattleBuffersTransferData[2] = arg2; gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd34(u8 bufferId, u8 b, u8 *c) +void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_34; + gBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE; gBattleBuffersTransferData[1] = b; for (i = 0; i < 3; i++) gBattleBuffersTransferData[2 + i] = c[i]; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 5); } -void EmitCmd35(u8 bufferId, u16 b) +void EmitOneReturnValue(u8 bufferId, u16 arg1) { - gBattleBuffersTransferData[0] = CONTROLLER_35; - gBattleBuffersTransferData[1] = b; - gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; + gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; + gBattleBuffersTransferData[1] = arg1; + gBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8; gBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd36(u8 bufferId, u16 b) +void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) { - gBattleBuffersTransferData[0] = CONTROLLER_36; + gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; gBattleBuffersTransferData[1] = b; gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; gBattleBuffersTransferData[3] = 0; @@ -1378,9 +1378,9 @@ void EmitCmd36(u8 bufferId, u16 b) void EmitCmd37(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_37; - gBattleBuffersTransferData[1] = 37; - gBattleBuffersTransferData[2] = 37; - gBattleBuffersTransferData[3] = 37; + gBattleBuffersTransferData[1] = CONTROLLER_37; + gBattleBuffersTransferData[2] = CONTROLLER_37; + gBattleBuffersTransferData[3] = CONTROLLER_37; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1394,27 +1394,27 @@ void EmitCmd38(u8 bufferId, u8 b) void EmitCmd39(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_39; - gBattleBuffersTransferData[1] = 39; - gBattleBuffersTransferData[2] = 39; - gBattleBuffersTransferData[3] = 39; + gBattleBuffersTransferData[1] = CONTROLLER_39; + gBattleBuffersTransferData[2] = CONTROLLER_39; + gBattleBuffersTransferData[3] = CONTROLLER_39; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitCmd40(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_40; - gBattleBuffersTransferData[1] = 40; - gBattleBuffersTransferData[2] = 40; - gBattleBuffersTransferData[3] = 40; + gBattleBuffersTransferData[1] = CONTROLLER_40; + gBattleBuffersTransferData[2] = CONTROLLER_40; + gBattleBuffersTransferData[3] = CONTROLLER_40; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitHitAnimation(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION; - gBattleBuffersTransferData[1] = 41; - gBattleBuffersTransferData[2] = 41; - gBattleBuffersTransferData[3] = 41; + gBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION; + gBattleBuffersTransferData[2] = CONTROLLER_HITANIMATION; + gBattleBuffersTransferData[3] = CONTROLLER_HITANIMATION; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } diff --git a/src/battle_interface.c b/src/battle_interface.c index 2318517f5..5f582a366 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -21,17 +21,11 @@ #include "safari_zone.h" #include "battle_anim.h" -enum -{ - HEALTH_BAR, - EXP_BAR -}; - struct TestingBar { s32 maxValue; s32 currValue; - s32 field_8; + s32 receivedValue; u32 unkC_0:5; u32 unk10; }; @@ -183,7 +177,6 @@ extern const u16 gBattleInterface_BallDisplayPal[]; extern const u8 gHealthboxElementsGfxTable[][32]; // functions -extern bool8 IsDoubleBattle(void); extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, const u8 *str); // menu.h extern void LoadBattleBarGfx(u8 arg0); @@ -214,10 +207,10 @@ static void SpriteCB_StatusSummaryBallsOnBattleStart(struct Sprite *sprite); static void SpriteCB_StatusSummaryBallsOnSwitchout(struct Sprite *sprite); static u8 GetStatusIconForBankId(u8 statusElementId, u8 bank); -static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4, u16 arg5); -static u8 GetScaledExpFraction(s32 currValue, s32 arg1, s32 maxValue, u8 scale); +static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5); +static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale); static void sub_8074B9C(u8 bank, u8 whichBar); -static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 *arg4, u8 arg5); +static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 *arg4, u8 arg5); static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2); // const rom data @@ -1049,12 +1042,12 @@ static void sub_8072924(struct Sprite *sprite) sprite->pos2.y = gSprites[otherSpriteId].pos2.y; } -void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 field_C) +void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue) { gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId = healthboxSpriteId; gBattleSpritesDataPtr->battleBars[bank].maxValue = maxVal; gBattleSpritesDataPtr->battleBars[bank].currentValue = currVal; - gBattleSpritesDataPtr->battleBars[bank].field_C = field_C; + gBattleSpritesDataPtr->battleBars[bank].receivedValue = receivedValue; gBattleSpritesDataPtr->battleBars[bank].field_10 = -32768; } @@ -2262,22 +2255,22 @@ s32 sub_8074AA0(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3) { var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, 6, 1); } else // exp bar { u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, gBattleSpritesDataPtr->battleBars[bank].maxValue, 8); if (expFraction == 0) expFraction = 1; - expFraction = abs(gBattleSpritesDataPtr->battleBars[bank].field_C / expFraction); + expFraction = abs(gBattleSpritesDataPtr->battleBars[bank].receivedValue / expFraction); var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, 8, expFraction); } @@ -2293,7 +2286,7 @@ s32 sub_8074AA0(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3) static void sub_8074B9C(u8 bank, u8 whichBar) { - u8 array[7]; + u8 array[8]; u8 subRet, level; u8 barElementId; u8 i; @@ -2303,7 +2296,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar) case HEALTH_BAR: subRet = sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, array, 6); barElementId = 3; @@ -2327,7 +2320,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar) case EXP_BAR: sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, array, 8); level = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_LEVEL); @@ -2349,7 +2342,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar) } } -static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4, u16 arg5) +static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5) { s32 r6; s32 ret; @@ -2363,7 +2356,7 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 *arg3 = currValue; } - currValue -= arg2; + currValue -= receivedValue; if (currValue < 0) currValue = 0; else if (currValue > maxValue) @@ -2388,7 +2381,7 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 { s32 var = (maxValue << 8) / arg4; - if (arg2 < 0) + if (receivedValue < 0) { *arg3 = r6 + var; ret = *arg3 >> 8; @@ -2413,7 +2406,7 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 } else { - if (arg2 < 0) + if (receivedValue < 0) { *arg3 += arg5; if (*arg3 > currValue) @@ -2432,9 +2425,9 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 return ret; } -static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 *arg4, u8 arg5) +static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 *arg4, u8 arg5) { - s32 r5 = currValue - arg2; + s32 r5 = currValue - receivedValue; u8 ret; u8 i; u8 r2; @@ -2487,7 +2480,7 @@ static s16 sub_8074F28(struct TestingBar *barInfo, s32 *arg1, u16 *arg2, s32 arg ret = sub_8074DB8(barInfo->maxValue, barInfo->currValue, - barInfo->field_8, + barInfo->receivedValue, arg1, 6, 1); sub_8074F88(barInfo, arg1, arg2); @@ -2508,7 +2501,7 @@ static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2) u8 i; sub_8074E8C(barInfo->maxValue, barInfo->currValue, - barInfo->field_8, arg1, sp8, 6); + barInfo->receivedValue, arg1, sp8, 6); for (i = 0; i < 6; i++) sp10[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]); @@ -2516,13 +2509,13 @@ static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2) CpuCopy16(sp10, arg2, sizeof(sp10)); } -static u8 GetScaledExpFraction(s32 currValue, s32 arg1, s32 maxValue, u8 scale) +static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale) { s32 r5, result; s8 r4, r0; scale *= 8; - r5 = currValue - arg1; + r5 = currValue - receivedValue; if (r5 < 0) r5 = 0; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a112cd7b9..b2afd9837 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3625,7 +3625,7 @@ static void atk23_getexp(void) if (gBattleExecBuffer == 0) { gActiveBank = gBattleStruct->expGetterBank; - if (gBattleBufferB[gActiveBank][0] == 0x21 && gBattleBufferB[gActiveBank][1] == 0xB) + if (gBattleBufferB[gActiveBank][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBank][1] == RET_VALUE_LEVELLED_UP) { if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId) sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); @@ -7137,7 +7137,7 @@ static void atk76_various(void) gDisableStructs[1].truantUnknownBit = 1; break; case VARIOUS_EMIT_YESNOBOX: - EmitYesNoBox(0); + EmitUnknownYesNoBox(0); MarkBufferBankForExecution(gActiveBank); break; case 14: @@ -7255,7 +7255,7 @@ static void atk78_faintifabilitynotdamp(void) { gActiveBank = gBankAttacker; gBattleMoveDamage = gBattleMons[gActiveBank].hp; - EmitHealthBarUpdate(0, 0x7FFF); + EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr++; @@ -10184,7 +10184,7 @@ static void atkC9_jumpifattackandspecialattackcannotfall(void) // memento { gActiveBank = gBankAttacker; gBattleMoveDamage = gBattleMons[gActiveBank].hp; - EmitHealthBarUpdate(0, 0x7FFF); + EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr += 5; } @@ -11003,13 +11003,13 @@ static void atkEF_pokeball_catch_calculation(void) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - EmitBallThrow(0, BALL_TRAINER_BLOCK); + EmitBallThrowAnim(0, BALL_TRAINER_BLOCK); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr = BattleScript_TrainerBallBlock; } else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) { - EmitBallThrow(0, BALL_3_SHAKES_SUCCESS); + EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr = BattleScript_WallyBallThrow; } @@ -11098,7 +11098,7 @@ static void atkEF_pokeball_catch_calculation(void) if (odds > 254) // mon caught { - EmitBallThrow(0, BALL_3_SHAKES_SUCCESS); + EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr = BattleScript_SuccessBallThrow; SetMonData(&gEnemyParty[gBattlePartyID[gBankTarget]], MON_DATA_POKEBALL, &gLastUsedItem); @@ -11120,7 +11120,7 @@ static void atkEF_pokeball_catch_calculation(void) if (gLastUsedItem == ITEM_MASTER_BALL) shakes = BALL_3_SHAKES_SUCCESS; // why calculate the shakes before that check? - EmitBallThrow(0, shakes); + EmitBallThrowAnim(0, shakes); MarkBufferBankForExecution(gActiveBank); if (shakes == BALL_3_SHAKES_SUCCESS) // mon caught, copy of the code above From 26c79313d86e056b70c758f775ecbadb206dbdbb Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 22 Oct 2017 20:38:23 +0200 Subject: [PATCH 04/29] safari controller is done --- asm/battle_controller_safari.s | 1412 ------------------------------- data/battle_anim_815A0D4.s | 161 ++++ data/battle_controller_safari.s | 228 ----- include/battle.h | 2 +- ld_script.txt | 4 +- src/battle_controller_player.c | 18 +- src/battle_controller_safari.c | 723 ++++++++++++++++ 7 files changed, 896 insertions(+), 1652 deletions(-) delete mode 100644 asm/battle_controller_safari.s delete mode 100644 data/battle_controller_safari.s create mode 100644 src/battle_controller_safari.c diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s deleted file mode 100644 index 4093d433b..000000000 --- a/asm/battle_controller_safari.s +++ /dev/null @@ -1,1412 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_114 -nullsub_114: @ 8159368 - bx lr - thumb_func_end nullsub_114 - - thumb_func_start SetBankFuncToSafariBufferRunCommand -SetBankFuncToSafariBufferRunCommand: @ 815936C - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =SafariBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToSafariBufferRunCommand - - thumb_func_start SafariBufferRunCommand -SafariBufferRunCommand: @ 8159388 - 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 _081593D4 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _081593D0 - ldr r0, =gSafariBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _081593D4 - .pool -_081593D0: - bl SafariBufferExecCompleted -_081593D4: - pop {r0} - bx r0 - thumb_func_end SafariBufferRunCommand - - thumb_func_start bx_battle_menu_t6_2 -bx_battle_menu_t6_2: @ 81593D8 - push {r4,r5,lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08159446 - movs r0, 0x5 - bl PlaySE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08159424 - cmp r0, 0x1 - bgt _08159414 - cmp r0, 0 - beq _0815941E - b _08159440 - .pool -_08159414: - cmp r0, 0x2 - beq _0815942A - cmp r0, 0x3 - beq _08159436 - b _08159440 -_0815941E: - movs r0, 0x1 - movs r1, 0x5 - b _0815942E -_08159424: - movs r0, 0x1 - movs r1, 0x6 - b _0815942E -_0815942A: - movs r0, 0x1 - movs r1, 0x7 -_0815942E: - movs r2, 0 - bl EmitTwoReturnValues - b _08159440 -_08159436: - movs r0, 0x1 - movs r1, 0x8 - movs r2, 0 - bl EmitTwoReturnValues -_08159440: - bl SafariBufferExecCompleted - b _0815954E -_08159446: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08159484 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0815954E - 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 _081594F2 - .pool -_08159484: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081594C0 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0815954E - 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 _081594F2 - .pool -_081594C0: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0815950C - 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 _0815954E - 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 -_081594F2: - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - b _0815954E - .pool -_0815950C: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0815954E - 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 _0815954E - 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 - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt -_0815954E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end bx_battle_menu_t6_2 - - thumb_func_start sub_815955C -sub_815955C: @ 815955C - 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 _08159580 - bl SafariBufferExecCompleted -_08159580: - pop {r0} - bx r0 - .pool - thumb_func_end sub_815955C - - thumb_func_start bx_t6_button_a -bx_t6_button_a: @ 8159594 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081595A6 - bl SafariBufferExecCompleted -_081595A6: - pop {r0} - bx r0 - thumb_func_end bx_t6_button_a - - thumb_func_start sub_81595AC -sub_81595AC: @ 81595AC - push {lr} - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - 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 _081595D0 - bl SafariBufferExecCompleted -_081595D0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81595AC - - thumb_func_start sub_81595E4 -sub_81595E4: @ 81595E4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0815960E - 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 -_0815960E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81595E4 - - thumb_func_start bx_wait_t6 -bx_wait_t6: @ 8159624 - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - beq _0815964A - 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 _0815964E -_0815964A: - bl SafariBufferExecCompleted -_0815964E: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t6 - - thumb_func_start sub_8159660 -sub_8159660: @ 8159660 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08159684 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159698 - str r1, [r0] - bl FreeAllWindowBuffers - bl sub_81358F4 -_08159684: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159660 - - thumb_func_start sub_8159698 -sub_8159698: @ 8159698 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _081596BE - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081596BE - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitOneReturnValue - bl SafariBufferExecCompleted -_081596BE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159698 - - thumb_func_start sub_81596D4 -sub_81596D4: @ 81596D4 - 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 _081596F6 - bl SafariBufferExecCompleted -_081596F6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81596D4 - - thumb_func_start SafariBufferExecCompleted -SafariBufferExecCompleted: @ 8159704 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =SafariBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08159758 - 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 _0815976A - .pool -_08159758: - 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] -_0815976A: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SafariBufferExecCompleted - - thumb_func_start bx_80364D0 -bx_80364D0: @ 815977C - 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 _0815979E - bl SafariBufferExecCompleted -_0815979E: - pop {r0} - bx r0 - .pool - thumb_func_end bx_80364D0 - - thumb_func_start sub_81597AC -sub_81597AC: @ 81597AC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597AC - - thumb_func_start sub_81597B8 -sub_81597B8: @ 81597B8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597B8 - - thumb_func_start sub_81597C4 -sub_81597C4: @ 81597C4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597C4 - - thumb_func_start sub_81597D0 -sub_81597D0: @ 81597D0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597D0 - - thumb_func_start sub_81597DC -sub_81597DC: @ 81597DC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597DC - - thumb_func_start sub_81597E8 -sub_81597E8: @ 81597E8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597E8 - - thumb_func_start sub_81597F4 -sub_81597F4: @ 81597F4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597F4 - - thumb_func_start sub_8159800 -sub_8159800: @ 8159800 - push {r4-r6,lr} - ldr r4, =gSaveBlock2Ptr - ldr r0, [r4] - ldrb r0, [r0, 0x8] - ldr r5, =gActiveBank - ldrb r1, [r5] - bl DecompressTrainerBackPic - ldr r0, [r4] - ldrb r6, [r0, 0x8] - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r2, =gTrainerBackPicCoords - ldr r1, [r4] - ldrb r1, [r1, 0x8] - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_815955C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159800 - - thumb_func_start sub_81598E0 -sub_81598E0: @ 81598E0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598E0 - - thumb_func_start sub_81598EC -sub_81598EC: @ 81598EC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598EC - - thumb_func_start sub_81598F8 -sub_81598F8: @ 81598F8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598F8 - - thumb_func_start sub_8159904 -sub_8159904: @ 8159904 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159904 - - thumb_func_start sub_8159910 -sub_8159910: @ 8159910 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t6 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159910 - - thumb_func_start sub_8159964 -sub_8159964: @ 8159964 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t6 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159964 - - thumb_func_start sub_81599C4 -sub_81599C4: @ 81599C4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81599C4 - - thumb_func_start sub_81599D0 -sub_81599D0: @ 81599D0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81599D0 - - thumb_func_start dp01t_10_6_message -dp01t_10_6_message: @ 81599DC - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t6_button_a - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_10_6_message - - thumb_func_start dp01t_11_6_message_for_player_only -dp01t_11_6_message_for_player_only: @ 8159A30 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08159A4C - bl dp01t_10_6_message - b _08159A50 - .pool -_08159A4C: - bl SafariBufferExecCompleted -_08159A50: - pop {r0} - bx r0 - thumb_func_end dp01t_11_6_message_for_player_only - - thumb_func_start sub_8159A54 -sub_8159A54: @ 8159A54 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _08159A7A - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_battle_menu_t6_2 - str r1, [r0] -_08159A7A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159A54 - - thumb_func_start sub_8159A94 -sub_8159A94: @ 8159A94 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159A54 - str r1, [r0] - ldr r0, =gText_SafariZoneMenu - movs r1, 0x2 - bl BattleHandleAddTextPrinter - movs r4, 0 -_08159AAE: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _08159AAE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillPkmnDo2 - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl BattleHandleAddTextPrinter - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159A94 - - thumb_func_start sub_8159AFC -sub_8159AFC: @ 8159AFC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159AFC - - thumb_func_start sub_8159B08 -sub_8159B08: @ 8159B08 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B08 - - thumb_func_start sub_8159B14 -sub_8159B14: @ 8159B14 - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159660 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159B14 - - thumb_func_start sub_8159B54 -sub_8159B54: @ 8159B54 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B54 - - thumb_func_start sub_8159B60 -sub_8159B60: @ 8159B60 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B60 - - thumb_func_start sub_8159B6C -sub_8159B6C: @ 8159B6C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B6C - - thumb_func_start sub_8159B78 -sub_8159B78: @ 8159B78 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B78 - - thumb_func_start sub_8159B84 -sub_8159B84: @ 8159B84 - push {lr} - ldr r0, =gHealthBoxesIds - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r0, r1, r0 - 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, 0xB - bl UpdateHealthboxAttribute - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159B84 - - thumb_func_start sub_8159BC0 -sub_8159BC0: @ 8159BC0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BC0 - - thumb_func_start sub_8159BCC -sub_8159BCC: @ 8159BCC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BCC - - thumb_func_start sub_8159BD8 -sub_8159BD8: @ 8159BD8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BD8 - - thumb_func_start sub_8159BE4 -sub_8159BE4: @ 8159BE4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BE4 - - thumb_func_start sub_8159BF0 -sub_8159BF0: @ 8159BF0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BF0 - - thumb_func_start sub_8159BFC -sub_8159BFC: @ 8159BFC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BFC - - thumb_func_start sub_8159C08 -sub_8159C08: @ 8159C08 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C08 - - thumb_func_start sub_8159C14 -sub_8159C14: @ 8159C14 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C14 - - thumb_func_start sub_8159C20 -sub_8159C20: @ 8159C20 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C20 - - thumb_func_start sub_8159C2C -sub_8159C2C: @ 8159C2C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C2C - - thumb_func_start sub_8159C38 -sub_8159C38: @ 8159C38 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C38 - - thumb_func_start sub_8159C44 -sub_8159C44: @ 8159C44 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C44 - - thumb_func_start sub_8159C50 -sub_8159C50: @ 8159C50 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C50 - - thumb_func_start sub_8159C5C -sub_8159C5C: @ 8159C5C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C5C - - thumb_func_start sub_8159C68 -sub_8159C68: @ 8159C68 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C68 - - thumb_func_start sub_8159C74 -sub_8159C74: @ 8159C74 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C74 - - thumb_func_start sub_8159C80 -sub_8159C80: @ 8159C80 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _08159C94 - movs r3, 0xC0 -_08159C94: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl SafariBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159C80 - - thumb_func_start dp01t_34_6_move_anim_start_t3 -dp01t_34_6_move_anim_start_t3: @ 8159CC4 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _08159D00 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _08159D14 - .pool -_08159D00: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_08159D14: - bl SafariBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end dp01t_34_6_move_anim_start_t3 - - thumb_func_start sub_8159D20 -sub_8159D20: @ 8159D20 - push {lr} - 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, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - bl PlayCry1 - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159D20 - - thumb_func_start dp01t_2E_6_battle_intro -dp01t_2E_6_battle_intro: @ 8159D5C - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_6_battle_intro - - thumb_func_start sub_8159D90 -sub_8159D90: @ 8159D90 - push {r4,r5,lr} - 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, 0xA - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81595AC - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159D90 - - thumb_func_start sub_8159DEC -sub_8159DEC: @ 8159DEC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159DEC - - thumb_func_start sub_8159DF8 -sub_8159DF8: @ 8159DF8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159DF8 - - thumb_func_start sub_8159E04 -sub_8159E04: @ 8159E04 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E04 - - thumb_func_start sub_8159E10 -sub_8159E10: @ 8159E10 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E10 - - thumb_func_start sub_8159E1C -sub_8159E1C: @ 8159E1C - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _08159E5C - bl SafariBufferExecCompleted - b _08159E68 - .pool -_08159E5C: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81596D4 - str r0, [r1] -_08159E68: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159E1C - - thumb_func_start sub_8159E78 -sub_8159E78: @ 8159E78 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E78 - - thumb_func_start sub_8159E84 -sub_8159E84: @ 8159E84 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E84 - - thumb_func_start sub_8159E90 -sub_8159E90: @ 8159E90 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl SafariBufferExecCompleted - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _08159ECC - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81595E4 - str r0, [r1] -_08159ECC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159E90 - - thumb_func_start nullsub_115 -nullsub_115: @ 8159EEC - bx lr - thumb_func_end nullsub_115 - - - .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_anim_815A0D4.s b/data/battle_anim_815A0D4.s index be8439db7..d89a83daf 100644 --- a/data/battle_anim_815A0D4.s +++ b/data/battle_anim_815A0D4.s @@ -3,7 +3,168 @@ .section .rodata + .align 2 +gUnknown_085CE004:: @ 85CE004 + .2byte 0x0000, 0x0004, 0x0010, 0x0004 + .2byte 0x0020, 0x0004, 0x0030, 0x0004 + .2byte 0x0040, 0x0004, 0xffff, 0x0000 + .align 2 +gUnknown_085CE01C:: @ 85CE01C + .4byte gUnknown_085CE004 + + .align 2 +gUnknown_085CE020:: @ 85CE020 + spr_template 0x2799, 0x2799, gUnknown_08524A34, gUnknown_085CE01C, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 + + .align 2 + spr_template 0x2720, 0x2720, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A0D4 + + .align 2 + spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A78AC + + .align 2 +gUnknown_085CE068:: @ 85CE068 + .2byte 0x0000, 0x0028, 0x0010, 0x0008 + .2byte 0x0020, 0x0028, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE078:: @ 85CE078 + .4byte gUnknown_085CE068 + + .align 2 +gUnknown_085CE07C:: @ 85CE07C + spr_template 0x27ce, 0x27ce, gUnknown_08524914, gUnknown_085CE078, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 + + .align 2 + spr_template 0x27cf, 0x27cf, gUnknown_08524A3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A1B0 + + .align 2 + spr_template 0x27cd, 0x27cd, gUnknown_08524974, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A254 + + .align 2 +gUnknown_085CE0C4:: @ 85CE0C4 + .2byte 0x0180, 0x0180, 0x0000, 0x0000 + .2byte 0xffe0, 0x0018, 0x0500, 0x0000 + .2byte 0x0018, 0xffe0, 0x0500, 0x0000 + .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE0E4:: @ 85CE0E4 + .2byte 0x0030, 0x0030, 0x0000, 0x0000 + .2byte 0x0020, 0x0020, 0x0600, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE0FC:: @ 85CE0FC + .4byte gUnknown_085CE0C4 + .4byte gUnknown_085CE0E4 + + .align 2 +gUnknown_085CE104:: @ 85CE104 + spr_template 0x27cb, 0x27cb, gUnknown_08524AFC, gDummySpriteAnimTable, NULL, gUnknown_085CE0FC, sub_815A2F0 + + .align 2 + spr_template 0x27a8, 0x27a8, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A6C4 + + .align 2 +gUnknown_085CE134:: @ 85CE134 + .2byte 0x0000, 0x0003, 0x0010, 0x0003 + .2byte 0x0020, 0x0003, 0x0030, 0x0003 + .2byte 0x0040, 0x0003, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE14C:: @ 85CE14C + .4byte gUnknown_085CE134 + + .align 2 +gUnknown_085CE150:: @ 85CE150 + spr_template 0x272b, 0x272b, gUnknown_08524914, gUnknown_085CE14C, NULL, gDummySpriteAffineAnimTable, sub_815A7B0 + + .align 2 +gUnknown_085CE168:: @ 85CE168 + .2byte 0x0000, 0x0003, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE170:: @ 85CE170 + .4byte gUnknown_085CE168 + + .align 2 +gUnknown_085CE174:: @ 85CE174 + .2byte 0xfff9, 0xfff9, 0x10fd, 0x0000 + .2byte 0x0007, 0x0007, 0x1003, 0x0000 + .2byte 0x7ffe, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE18C:: @ 85CE18C + .4byte gUnknown_085CE174 + + .align 2 +gUnknown_085CE190:: @ 85CE190 + spr_template 0x27f4, 0x27f4, gUnknown_08524974, gUnknown_085CE170, NULL, gUnknown_085CE18C, sub_815A7EC + + .align 2 +gUnknown_085CE1A8:: @ 85CE1A8 + .2byte 0x0000, 0x0008, 0x0010, 0x0010, 0x0020, 0x0004, 0x0030, 0x0004, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE1BC:: @ 85CE1BC + .4byte gUnknown_085CE1A8 + + .align 2 +gUnknown_085CE1C0:: @ 85CE1C0 + .2byte 0x0200, 0x0200, 0x0000, 0x0000 + .2byte 0xffe0, 0xffe0, 0x0800, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE1D8:: @ 85CE1D8 + .4byte gUnknown_085CE1C0 + + .align 2 +gUnknown_085CE1DC:: @ 85CE1DC + spr_template 0x27d0, 0x27d0, gUnknown_085249D4, gUnknown_085CE1BC, NULL, gUnknown_085CE1D8, sub_815A8AC + + .align 2 +gUnknown_085CE1F4:: @ 85CE1F4 + .2byte 0x0000, 0x0180, 0x0000, 0x0000 + .2byte 0x0010, 0x0000, 0x1400, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE20C:: @ 85CE20C + .2byte 0x0140, 0x0180, 0x0000, 0x0000 + .2byte 0xfff0, 0x0000, 0x1300, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE224:: @ 85CE224 + .4byte gUnknown_085CE1F4 + .4byte gUnknown_085CE20C + + .align 2 +gUnknown_085CE22C:: @ 85CE22C + spr_template 0x27f3, 0x27f3, gUnknown_085249DC, gDummySpriteAnimTable, NULL, gUnknown_085CE224, sub_815A934 + + .align 2 + spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815AAA4 + + .align 2 + spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815ABD0 + + .align 2 +gUnknown_085CE274:: @ 85CE274 + .2byte 0x0000, 0x0002, 0x0008, 0x0002 + .2byte 0x0010, 0x0002, 0xfffe, 0x0000 + + .align 2 +gUnknown_085CE284:: @ 85CE284 + .4byte gUnknown_085CE274 + + .align 2 +gUnknown_085CE288:: @ 85CE288 + spr_template 0x27f5, 0x27f5, gUnknown_08524934, gUnknown_085CE284, NULL, gDummySpriteAffineAnimTable, sub_815ACD0 + gUnknown_085CE2A0:: @ 85CE2A0 .incbin "baserom.gba", 0x5ce2a0, 0xb0 diff --git a/data/battle_controller_safari.s b/data/battle_controller_safari.s deleted file mode 100644 index 39d1d0de3..000000000 --- a/data/battle_controller_safari.s +++ /dev/null @@ -1,228 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gSafariBufferCommands:: @ 85CDF20 - .4byte sub_81597AC - .4byte sub_81597B8 - .4byte sub_81597C4 - .4byte sub_81597D0 - .4byte sub_81597DC - .4byte sub_81597E8 - .4byte sub_81597F4 - .4byte sub_8159800 - .4byte sub_81598E0 - .4byte sub_81598EC - .4byte sub_81598F8 - .4byte sub_8159904 - .4byte sub_8159910 - .4byte sub_8159964 - .4byte sub_81599C4 - .4byte sub_81599D0 - .4byte dp01t_10_6_message - .4byte dp01t_11_6_message_for_player_only - .4byte sub_8159A94 - .4byte sub_8159AFC - .4byte sub_8159B08 - .4byte sub_8159B14 - .4byte sub_8159B54 - .4byte sub_8159B60 - .4byte sub_8159B6C - .4byte sub_8159B78 - .4byte sub_8159B84 - .4byte sub_8159BC0 - .4byte sub_8159BCC - .4byte sub_8159BD8 - .4byte sub_8159BE4 - .4byte sub_8159BF0 - .4byte sub_8159BFC - .4byte sub_8159C08 - .4byte sub_8159C14 - .4byte sub_8159C20 - .4byte sub_8159C2C - .4byte sub_8159C38 - .4byte sub_8159C44 - .4byte sub_8159C50 - .4byte sub_8159C5C - .4byte sub_8159C68 - .4byte sub_8159C74 - .4byte sub_8159C80 - .4byte dp01t_34_6_move_anim_start_t3 - .4byte sub_8159D20 - .4byte dp01t_2E_6_battle_intro - .4byte sub_8159D90 - .4byte sub_8159DEC - .4byte sub_8159DF8 - .4byte sub_8159E04 - .4byte sub_8159E10 - .4byte sub_8159E1C - .4byte sub_8159E78 - .4byte sub_8159E84 - .4byte sub_8159E90 - .4byte nullsub_115 - - .align 2 -gUnknown_085CE004:: @ 85CE004 - .2byte 0x0000, 0x0004, 0x0010, 0x0004 - .2byte 0x0020, 0x0004, 0x0030, 0x0004 - .2byte 0x0040, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE01C:: @ 85CE01C - .4byte gUnknown_085CE004 - - .align 2 -gUnknown_085CE020:: @ 85CE020 - spr_template 0x2799, 0x2799, gUnknown_08524A34, gUnknown_085CE01C, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 - - .align 2 - spr_template 0x2720, 0x2720, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A0D4 - - .align 2 - spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A78AC - - .align 2 -gUnknown_085CE068:: @ 85CE068 - .2byte 0x0000, 0x0028, 0x0010, 0x0008 - .2byte 0x0020, 0x0028, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE078:: @ 85CE078 - .4byte gUnknown_085CE068 - - .align 2 -gUnknown_085CE07C:: @ 85CE07C - spr_template 0x27ce, 0x27ce, gUnknown_08524914, gUnknown_085CE078, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 - - .align 2 - spr_template 0x27cf, 0x27cf, gUnknown_08524A3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A1B0 - - .align 2 - spr_template 0x27cd, 0x27cd, gUnknown_08524974, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A254 - - .align 2 -gUnknown_085CE0C4:: @ 85CE0C4 - .2byte 0x0180, 0x0180, 0x0000, 0x0000 - .2byte 0xffe0, 0x0018, 0x0500, 0x0000 - .2byte 0x0018, 0xffe0, 0x0500, 0x0000 - .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE0E4:: @ 85CE0E4 - .2byte 0x0030, 0x0030, 0x0000, 0x0000 - .2byte 0x0020, 0x0020, 0x0600, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE0FC:: @ 85CE0FC - .4byte gUnknown_085CE0C4 - .4byte gUnknown_085CE0E4 - - .align 2 -gUnknown_085CE104:: @ 85CE104 - spr_template 0x27cb, 0x27cb, gUnknown_08524AFC, gDummySpriteAnimTable, NULL, gUnknown_085CE0FC, sub_815A2F0 - - .align 2 - spr_template 0x27a8, 0x27a8, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A6C4 - - .align 2 -gUnknown_085CE134:: @ 85CE134 - .2byte 0x0000, 0x0003, 0x0010, 0x0003 - .2byte 0x0020, 0x0003, 0x0030, 0x0003 - .2byte 0x0040, 0x0003, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE14C:: @ 85CE14C - .4byte gUnknown_085CE134 - - .align 2 -gUnknown_085CE150:: @ 85CE150 - spr_template 0x272b, 0x272b, gUnknown_08524914, gUnknown_085CE14C, NULL, gDummySpriteAffineAnimTable, sub_815A7B0 - - .align 2 -gUnknown_085CE168:: @ 85CE168 - .2byte 0x0000, 0x0003, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE170:: @ 85CE170 - .4byte gUnknown_085CE168 - - .align 2 -gUnknown_085CE174:: @ 85CE174 - .2byte 0xfff9, 0xfff9, 0x10fd, 0x0000 - .2byte 0x0007, 0x0007, 0x1003, 0x0000 - .2byte 0x7ffe, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE18C:: @ 85CE18C - .4byte gUnknown_085CE174 - - .align 2 -gUnknown_085CE190:: @ 85CE190 - spr_template 0x27f4, 0x27f4, gUnknown_08524974, gUnknown_085CE170, NULL, gUnknown_085CE18C, sub_815A7EC - - .align 2 -gUnknown_085CE1A8:: @ 85CE1A8 - .2byte 0x0000, 0x0008, 0x0010, 0x0010, 0x0020, 0x0004, 0x0030, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE1BC:: @ 85CE1BC - .4byte gUnknown_085CE1A8 - - .align 2 -gUnknown_085CE1C0:: @ 85CE1C0 - .2byte 0x0200, 0x0200, 0x0000, 0x0000 - .2byte 0xffe0, 0xffe0, 0x0800, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE1D8:: @ 85CE1D8 - .4byte gUnknown_085CE1C0 - - .align 2 -gUnknown_085CE1DC:: @ 85CE1DC - spr_template 0x27d0, 0x27d0, gUnknown_085249D4, gUnknown_085CE1BC, NULL, gUnknown_085CE1D8, sub_815A8AC - - .align 2 -gUnknown_085CE1F4:: @ 85CE1F4 - .2byte 0x0000, 0x0180, 0x0000, 0x0000 - .2byte 0x0010, 0x0000, 0x1400, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE20C:: @ 85CE20C - .2byte 0x0140, 0x0180, 0x0000, 0x0000 - .2byte 0xfff0, 0x0000, 0x1300, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE224:: @ 85CE224 - .4byte gUnknown_085CE1F4 - .4byte gUnknown_085CE20C - - .align 2 -gUnknown_085CE22C:: @ 85CE22C - spr_template 0x27f3, 0x27f3, gUnknown_085249DC, gDummySpriteAnimTable, NULL, gUnknown_085CE224, sub_815A934 - - .align 2 - spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815AAA4 - - .align 2 - spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815ABD0 - - .align 2 -gUnknown_085CE274:: @ 85CE274 - .2byte 0x0000, 0x0002, 0x0008, 0x0002 - .2byte 0x0010, 0x0002, 0xfffe, 0x0000 - - .align 2 -gUnknown_085CE284:: @ 85CE284 - .4byte gUnknown_085CE274 - - .align 2 -gUnknown_085CE288:: @ 85CE288 - spr_template 0x27f5, 0x27f5, gUnknown_08524934, gUnknown_085CE284, NULL, gDummySpriteAffineAnimTable, sub_815ACD0 - - diff --git a/include/battle.h b/include/battle.h index 6079d019e..855ff464e 100644 --- a/include/battle.h +++ b/include/battle.h @@ -780,7 +780,7 @@ extern struct BattleStruct* gBattleStruct; #define B_ANIM_SWITCH_OUT_MON 0x1 #define B_ANIM_SPECIAL_2 0x2 #define B_ANIM_BALL_THROW 0x3 -#define B_ANIM_SPECIAL_4 0x4 +#define B_ANIM_SAFARI_BALL_THROW 0x4 #define B_ANIM_SUBSTITUTE_TO_MON 0x5 #define B_ANIM_MON_TO_SUBSTITUTE 0x6 diff --git a/ld_script.txt b/ld_script.txt index 54ed8a7f8..dc379a499 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -201,7 +201,7 @@ SECTIONS { asm/field_effect_helpers.o(.text); asm/contest_ai.o(.text); asm/battle_anim_sound_tasks.o(.text); - asm/battle_controller_safari.o(.text); + src/battle_controller_safari.o(.text); asm/fldeff_sweetscent.o(.text); asm/battle_anim_815A0D4.o(.text); asm/learn_move.o(.text); @@ -426,7 +426,7 @@ SECTIONS { data/save.o(.rodata); data/field_effect_helpers.o(.rodata); data/contest_ai.o(.rodata); - data/battle_controller_safari.o(.rodata); + src/battle_controller_safari.o(.rodata); data/battle_anim_815A0D4.o(.rodata); data/learn_move.o(.rodata); src/roamer.o(.rodata); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index b41dbf0bc..b9ce93a89 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -154,7 +154,7 @@ static void MoveSelectionDisplayMoveNames(void); static void HandleMoveSwitchting(void); static void sub_8058FC0(void); static void sub_8059828(void); -static void sub_80598E0(void); +static void CompleteWhenChoseItem(void); static void sub_8059544(u8 taskId); static void Task_PrepareToGiveExpWithExpBar(u8 taskId); static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); @@ -297,16 +297,16 @@ static void HandleInputChooseAction(void) switch (gActionSelectionCursor[gActiveBank]) { - case ACTION_USE_MOVE: + case 0: EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); break; - case ACTION_USE_ITEM: + case 1: EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); break; - case ACTION_SWITCH: + case 2: EmitTwoReturnValues(1, ACTION_SWITCH, 0); break; - case ACTION_RUN: + case 3: EmitTwoReturnValues(1, ACTION_RUN, 0); break; } @@ -1400,18 +1400,18 @@ static void sub_8059828(void) } } -static void sub_80598A4(void) +static void OpenBagAndChooseItem(void) { if (!gPaletteFade.active) { - gBattleBankFunc[gActiveBank] = sub_80598E0; + gBattleBankFunc[gActiveBank] = CompleteWhenChoseItem; nullsub_35(); FreeAllWindowBuffers(); sub_81AABB0(); } } -static void sub_80598E0(void) +static void CompleteWhenChoseItem(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { @@ -2685,7 +2685,7 @@ static void PlayerHandleChooseItem(void) s32 i; BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); - gBattleBankFunc[gActiveBank] = sub_80598A4; + gBattleBankFunc[gActiveBank] = OpenBagAndChooseItem; gBankInMenu = gActiveBank; for (i = 0; i < 3; i++) diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c new file mode 100644 index 000000000..74210e629 --- /dev/null +++ b/src/battle_controller_safari.c @@ -0,0 +1,723 @@ +#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 "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +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 struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; + +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; + +extern const u8 gText_SafariZoneMenu[]; +extern const u8 gText_WhatWillPkmnDo2[]; + +extern void sub_81358F4(void); + +// this file's functions +static void SafariHandleGetMonData(void); +static void SafariHandleGetRawMonData(void); +static void SafariHandleSetMonData(void); +static void SafariHandleSetRawMonData(void); +static void SafariHandleLoadMonSprite(void); +static void SafariHandleSwitchInAnim(void); +static void SafariHandleReturnMonToBall(void); +static void SafariHandleDrawTrainerPic(void); +static void SafariHandleTrainerSlide(void); +static void SafariHandleTrainerSlideBack(void); +static void SafariHandleFaintAnimation(void); +static void SafariHandlePaletteFade(void); +static void SafariHandleSuccessBallThrowAnim(void); +static void SafariHandleBallThrowAnim(void); +static void SafariHandlePause(void); +static void SafariHandleMoveAnimation(void); +static void SafariHandlePrintString(void); +static void SafariHandlePrintStringPlayerOnly(void); +static void SafariHandleChooseAction(void); +static void SafariHandleUnknownYesNoBox(void); +static void SafariHandleChooseMove(void); +static void SafariHandleChooseItem(void); +static void SafariHandleChoosePokemon(void); +static void SafariHandleCmd23(void); +static void SafariHandleHealthBarUpdate(void); +static void SafariHandleExpUpdate(void); +static void SafariHandleStatusIconUpdate(void); +static void SafariHandleStatusAnimation(void); +static void SafariHandleStatusXor(void); +static void SafariHandleDataTransfer(void); +static void SafariHandleDMA3Transfer(void); +static void SafariHandlePlayBGM(void); +static void SafariHandleCmd32(void); +static void SafariHandleTwoReturnValues(void); +static void SafariHandleChosenMonReturnValue(void); +static void SafariHandleOneReturnValue(void); +static void SafariHandleOneReturnValue_Duplicate(void); +static void SafariHandleCmd37(void); +static void SafariHandleCmd38(void); +static void SafariHandleCmd39(void); +static void SafariHandleCmd40(void); +static void SafariHandleHitAnimation(void); +static void SafariHandleCmd42(void); +static void SafariHandleEffectivenessSound(void); +static void SafariHandlePlayFanfareOrBGM(void); +static void SafariHandleFaintingCry(void); +static void SafariHandleIntroSlide(void); +static void SafariHandleIntroTrainerBallThrow(void); +static void SafariHandleDrawPartyStatusSummary(void); +static void SafariHandleCmd49(void); +static void SafariHandleCmd50(void); +static void SafariHandleSpriteInvisibility(void); +static void SafariHandleBattleAnimation(void); +static void SafariHandleLinkStandbyMsg(void); +static void SafariHandleResetActionMoveSelection(void); +static void SafariHandleCmd55(void); +static void nullsub_115(void); + +static void SafariBufferRunCommand(void); +static void SafariBufferExecCompleted(void); +static void CompleteWhenChosePokeblock(void); + +static void (*const gSafariBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + SafariHandleGetMonData, + SafariHandleGetRawMonData, + SafariHandleSetMonData, + SafariHandleSetRawMonData, + SafariHandleLoadMonSprite, + SafariHandleSwitchInAnim, + SafariHandleReturnMonToBall, + SafariHandleDrawTrainerPic, + SafariHandleTrainerSlide, + SafariHandleTrainerSlideBack, + SafariHandleFaintAnimation, + SafariHandlePaletteFade, + SafariHandleSuccessBallThrowAnim, + SafariHandleBallThrowAnim, + SafariHandlePause, + SafariHandleMoveAnimation, + SafariHandlePrintString, + SafariHandlePrintStringPlayerOnly, + SafariHandleChooseAction, + SafariHandleUnknownYesNoBox, + SafariHandleChooseMove, + SafariHandleChooseItem, + SafariHandleChoosePokemon, + SafariHandleCmd23, + SafariHandleHealthBarUpdate, + SafariHandleExpUpdate, + SafariHandleStatusIconUpdate, + SafariHandleStatusAnimation, + SafariHandleStatusXor, + SafariHandleDataTransfer, + SafariHandleDMA3Transfer, + SafariHandlePlayBGM, + SafariHandleCmd32, + SafariHandleTwoReturnValues, + SafariHandleChosenMonReturnValue, + SafariHandleOneReturnValue, + SafariHandleOneReturnValue_Duplicate, + SafariHandleCmd37, + SafariHandleCmd38, + SafariHandleCmd39, + SafariHandleCmd40, + SafariHandleHitAnimation, + SafariHandleCmd42, + SafariHandleEffectivenessSound, + SafariHandlePlayFanfareOrBGM, + SafariHandleFaintingCry, + SafariHandleIntroSlide, + SafariHandleIntroTrainerBallThrow, + SafariHandleDrawPartyStatusSummary, + SafariHandleCmd49, + SafariHandleCmd50, + SafariHandleSpriteInvisibility, + SafariHandleBattleAnimation, + SafariHandleLinkStandbyMsg, + SafariHandleResetActionMoveSelection, + SafariHandleCmd55, + nullsub_115 +}; + +static void nullsub_114(void) +{ +} + +void SetBankFuncToSafariBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = SafariBufferRunCommand; +} + +static void SafariBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gSafariBufferCommands)) + gSafariBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + SafariBufferExecCompleted(); + } +} + +static void HandleInputChooseAction(void) +{ + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + switch (gActionSelectionCursor[gActiveBank]) + { + case 0: + EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_BALL, 0); + break; + case 1: + EmitTwoReturnValues(1, ACTION_POKEBLOCK_CASE, 0); + break; + case 2: + EmitTwoReturnValues(1, ACTION_GO_NEAR, 0); + break; + case 3: + EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_RUN, 0); + break; + } + SafariBufferExecCompleted(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gActionSelectionCursor[gActiveBank] & 1) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gActionSelectionCursor[gActiveBank] & 1)) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gActionSelectionCursor[gActiveBank] & 2) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gActionSelectionCursor[gActiveBank] & 2)) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + SafariBufferExecCompleted(); +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + SafariBufferExecCompleted(); +} + +static void CompleteOnHealthboxSpriteCallbackDummy(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + SafariBufferExecCompleted(); +} + +static void sub_81595E4(void) +{ + if (!gPaletteFade.active) + { + gMain.inBattle = FALSE; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(gMain.savedCallback); + } +} + +static void CompleteOnSpecialAnimDone(void) +{ + if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + SafariBufferExecCompleted(); +} + +static void OpenPokeblockCase(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = CompleteWhenChosePokeblock; + FreeAllWindowBuffers(); + sub_81358F4(); + } +} + +static void CompleteWhenChosePokeblock(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitOneReturnValue(1, gScriptItemId); + SafariBufferExecCompleted(); + } +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + SafariBufferExecCompleted(); +} + +static void SafariBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = SafariBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + SafariBufferExecCompleted(); +} + +static void SafariHandleGetMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleGetRawMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSetMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSetRawMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleLoadMonSprite(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSwitchInAnim(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleReturnMonToBall(void) +{ + SafariBufferExecCompleted(); +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; + +static void SafariHandleDrawTrainerPic(void) +{ + DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank); + sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite( + &gUnknown_0202499C, + 80, + (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80, + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void SafariHandleTrainerSlide(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleTrainerSlideBack(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleFaintAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePaletteFade(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSuccessBallThrowAnim(void) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void SafariHandleBallThrowAnim(void) +{ + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void SafariHandlePause(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleMoveAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void SafariHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + SafariHandlePrintString(); + else + SafariBufferExecCompleted(); +} + +static void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = HandleInputChooseAction; + } +} + +static void SafariHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + BattleHandleAddTextPrinter(gText_SafariZoneMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo2); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +static void SafariHandleUnknownYesNoBox(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChooseMove(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChooseItem(void) +{ + s32 i; + + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = OpenPokeblockCase; + gBankInMenu = gActiveBank; +} + +static void SafariHandleChoosePokemon(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd23(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleHealthBarUpdate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleExpUpdate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusIconUpdate(void) +{ + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_BALLS_TEXT); + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusXor(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleDataTransfer(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleDMA3Transfer(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePlayBGM(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd32(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleTwoReturnValues(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChosenMonReturnValue(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleOneReturnValue(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleOneReturnValue_Duplicate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd37(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd38(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd39(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd40(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleHitAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd42(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + SafariBufferExecCompleted(); +} + +static void SafariHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + SafariBufferExecCompleted(); +} + +static void SafariHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry1(species, 25); + SafariBufferExecCompleted(); +} + +static void SafariHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + SafariBufferExecCompleted(); +} + +static void SafariHandleIntroTrainerBallThrow(void) +{ + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_ALL_TEXT); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + gBattleBankFunc[gActiveBank] = CompleteOnHealthboxSpriteCallbackDummy; +} + +static void SafariHandleDrawPartyStatusSummary(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd49(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd50(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSpriteInvisibility(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleBattleAnimation(void) +{ + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + SafariBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; +} + +static void SafariHandleLinkStandbyMsg(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleResetActionMoveSelection(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + SafariBufferExecCompleted(); + if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_WILD)) + gBattleBankFunc[gActiveBank] = sub_81595E4; +} + +static void nullsub_115(void) +{ +} From 21f499592201ac4474c365a2b6b2ab1f2b173abc Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 22 Oct 2017 20:49:21 +0200 Subject: [PATCH 05/29] start player partner controller --- asm/battle_controller_player_partner.s | 388 ++++++++++-------------- data/battle_controller_player_partner.s | 71 ----- ld_script.txt | 3 +- src/battle_controller_player_partner.c | 198 ++++++++++++ 4 files changed, 368 insertions(+), 292 deletions(-) delete mode 100644 data/battle_controller_player_partner.s create mode 100644 src/battle_controller_player_partner.c diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index dd96fda80..99a2c5c4f 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -6,58 +6,6 @@ .text - thumb_func_start nullsub_77 -nullsub_77: @ 81BADF0 - bx lr - thumb_func_end nullsub_77 - - thumb_func_start SetBankFuncToPlayerPartnerBufferRunCommand -SetBankFuncToPlayerPartnerBufferRunCommand: @ 81BADF4 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerPartnerBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToPlayerPartnerBufferRunCommand - - thumb_func_start PlayerPartnerBufferRunCommand -PlayerPartnerBufferRunCommand: @ 81BAE10 - 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 _081BAE5C - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _081BAE58 - ldr r0, =gPlayerPartnerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _081BAE5C - .pool -_081BAE58: - bl PlayerPartnerBufferExecCompleted -_081BAE5C: - pop {r0} - bx r0 - thumb_func_end PlayerPartnerBufferRunCommand thumb_func_start sub_81BAE60 sub_81BAE60: @ 81BAE60 @@ -1641,8 +1589,8 @@ _081BBC56: .pool thumb_func_end bx_80E8A6C - thumb_func_start dp01t_00_3_getattr -dp01t_00_3_getattr: @ 81BBC64 + thumb_func_start PlayerPartnerHandleGetMonData +PlayerPartnerHandleGetMonData: @ 81BBC64 push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -1694,7 +1642,7 @@ _081BBCBE: pop {r4-r6} pop {r0} bx r0 - thumb_func_end dp01t_00_3_getattr + thumb_func_end PlayerPartnerHandleGetMonData thumb_func_start dp01_getattr_by_ch1_for_player_pokemon dp01_getattr_by_ch1_for_player_pokemon: @ 81BBCD8 @@ -2574,16 +2522,16 @@ _081BC46E: .pool thumb_func_end dp01_getattr_by_ch1_for_player_pokemon - thumb_func_start sub_81BC484 -sub_81BC484: @ 81BC484 + thumb_func_start PlayerPartnerHandleGetRawMonData +PlayerPartnerHandleGetRawMonData: @ 81BC484 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BC484 + thumb_func_end PlayerPartnerHandleGetRawMonData - thumb_func_start sub_81BC490 -sub_81BC490: @ 81BC490 + thumb_func_start PlayerPartnerHandleSetMonData +PlayerPartnerHandleSetMonData: @ 81BC490 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -2623,7 +2571,7 @@ _081BC4DE: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_81BC490 + thumb_func_end PlayerPartnerHandleSetMonData thumb_func_start sub_81BC4E8 sub_81BC4E8: @ 81BC4E8 @@ -3658,8 +3606,8 @@ _081BCEAE: .pool thumb_func_end sub_81BC4E8 - thumb_func_start sub_81BCEE4 -sub_81BCEE4: @ 81BCEE4 + thumb_func_start PlayerPartnerHandleSetRawMonData +PlayerPartnerHandleSetRawMonData: @ 81BCEE4 push {r4-r7,lr} ldr r1, =gBattlePartyID ldr r7, =gActiveBank @@ -3711,10 +3659,10 @@ _081BCF3C: pop {r0} bx r0 .pool - thumb_func_end sub_81BCEE4 + thumb_func_end PlayerPartnerHandleSetRawMonData - thumb_func_start sub_81BCF58 -sub_81BCF58: @ 81BCF58 + thumb_func_start PlayerPartnerHandleLoadMonSprite +PlayerPartnerHandleLoadMonSprite: @ 81BCF58 push {r4-r6,lr} mov r6, r8 push {r6} @@ -3828,10 +3776,10 @@ sub_81BCF58: @ 81BCF58 pop {r0} bx r0 .pool - thumb_func_end sub_81BCF58 + thumb_func_end PlayerPartnerHandleLoadMonSprite - thumb_func_start sub_81BD074 -sub_81BD074: @ 81BD074 + thumb_func_start PlayerPartnerHandleSwitchInAnim +PlayerPartnerHandleSwitchInAnim: @ 81BD074 push {r4-r6,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -3874,7 +3822,7 @@ sub_81BD074: @ 81BD074 pop {r0} bx r0 .pool - thumb_func_end sub_81BD074 + thumb_func_end PlayerPartnerHandleSwitchInAnim thumb_func_start sub_81BD0E4 sub_81BD0E4: @ 81BD0E4 @@ -4039,8 +3987,8 @@ sub_81BD0E4: @ 81BD0E4 .pool thumb_func_end sub_81BD0E4 - thumb_func_start sub_81BD260 -sub_81BD260: @ 81BD260 + thumb_func_start PlayerPartnerHandleReturnMonToBall +PlayerPartnerHandleReturnMonToBall: @ 81BD260 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r6, =gActiveBank @@ -4096,7 +4044,7 @@ _081BD2DE: pop {r0} bx r0 .pool - thumb_func_end sub_81BD260 + thumb_func_end PlayerPartnerHandleReturnMonToBall thumb_func_start sub_81BD2F0 sub_81BD2F0: @ 81BD2F0 @@ -4168,8 +4116,8 @@ _081BD36E: .pool thumb_func_end sub_81BD2F0 - thumb_func_start sub_81BD37C -sub_81BD37C: @ 81BD37C + thumb_func_start PlayerPartnerHandleDrawTrainerPic +PlayerPartnerHandleDrawTrainerPic: @ 81BD37C push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -4408,18 +4356,18 @@ _081BD57C: pop {r0} bx r0 .pool - thumb_func_end sub_81BD37C + thumb_func_end PlayerPartnerHandleDrawTrainerPic - thumb_func_start sub_81BD5BC -sub_81BD5BC: @ 81BD5BC + thumb_func_start PlayerPartnerHandleTrainerSlide +PlayerPartnerHandleTrainerSlide: @ 81BD5BC push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BD5BC + thumb_func_end PlayerPartnerHandleTrainerSlide - thumb_func_start sub_81BD5C8 -sub_81BD5C8: @ 81BD5C8 + thumb_func_start PlayerPartnerHandleTrainerSlideBack +PlayerPartnerHandleTrainerSlideBack: @ 81BD5C8 push {r4-r6,lr} ldr r6, =gBankSpriteIds ldr r4, =gActiveBank @@ -4489,10 +4437,10 @@ sub_81BD5C8: @ 81BD5C8 pop {r0} bx r0 .pool - thumb_func_end sub_81BD5C8 + thumb_func_end PlayerPartnerHandleTrainerSlideBack - thumb_func_start sub_81BD674 -sub_81BD674: @ 81BD674 + thumb_func_start PlayerPartnerHandleFaintAnimation +PlayerPartnerHandleFaintAnimation: @ 81BD674 push {r4-r6,lr} ldr r6, =gBattleSpritesDataPtr ldr r4, [r6] @@ -4594,42 +4542,42 @@ _081BD73E: pop {r0} bx r0 .pool - thumb_func_end sub_81BD674 + thumb_func_end PlayerPartnerHandleFaintAnimation - thumb_func_start sub_81BD760 -sub_81BD760: @ 81BD760 + thumb_func_start PlayerPartnerHandlePaletteFade +PlayerPartnerHandlePaletteFade: @ 81BD760 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BD760 + thumb_func_end PlayerPartnerHandlePaletteFade - thumb_func_start sub_81BD76C -sub_81BD76C: @ 81BD76C + thumb_func_start PlayerPartnerHandleSuccessBallThrowAnim +PlayerPartnerHandleSuccessBallThrowAnim: @ 81BD76C push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BD76C + thumb_func_end PlayerPartnerHandleSuccessBallThrowAnim - thumb_func_start sub_81BD778 -sub_81BD778: @ 81BD778 + thumb_func_start PlayerPartnerHandleBallThrowAnim +PlayerPartnerHandleBallThrowAnim: @ 81BD778 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BD778 + thumb_func_end PlayerPartnerHandleBallThrowAnim - thumb_func_start sub_81BD784 -sub_81BD784: @ 81BD784 + thumb_func_start PlayerPartnerHandlePause +PlayerPartnerHandlePause: @ 81BD784 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BD784 + thumb_func_end PlayerPartnerHandlePause - thumb_func_start sub_81BD790 -sub_81BD790: @ 81BD790 + thumb_func_start PlayerPartnerHandleMoveAnimation +PlayerPartnerHandleMoveAnimation: @ 81BD790 push {r4-r6,lr} ldr r6, =gActiveBank ldrb r0, [r6] @@ -4763,7 +4711,7 @@ _081BD8B6: pop {r0} bx r0 .pool - thumb_func_end sub_81BD790 + thumb_func_end PlayerPartnerHandleMoveAnimation thumb_func_start bx_move_anim_3 bx_move_anim_3: @ 81BD8C8 @@ -4949,8 +4897,8 @@ _081BDA3C: bx r0 thumb_func_end bx_move_anim_3 - thumb_func_start sub_81BDA4C -sub_81BDA4C: @ 81BDA4C + thumb_func_start PlayerPartnerHandlePrintString +PlayerPartnerHandlePrintString: @ 81BDA4C push {r4,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -4977,35 +4925,35 @@ sub_81BDA4C: @ 81BDA4C pop {r0} bx r0 .pool - thumb_func_end sub_81BDA4C + thumb_func_end PlayerPartnerHandlePrintString - thumb_func_start sub_81BDAA0 -sub_81BDAA0: @ 81BDAA0 + thumb_func_start PlayerPartnerHandlePrintStringPlayerOnly +PlayerPartnerHandlePrintStringPlayerOnly: @ 81BDAA0 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDAA0 + thumb_func_end PlayerPartnerHandlePrintStringPlayerOnly - thumb_func_start sub_81BDAAC -sub_81BDAAC: @ 81BDAAC + thumb_func_start PlayerPartnerHandleChooseAction +PlayerPartnerHandleChooseAction: @ 81BDAAC push {lr} bl AI_TrySwitchOrUseItem bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDAAC + thumb_func_end PlayerPartnerHandleChooseAction - thumb_func_start sub_81BDABC -sub_81BDABC: @ 81BDABC + thumb_func_start PlayerPartnerHandleUnknownYesNoBox +PlayerPartnerHandleUnknownYesNoBox: @ 81BDABC push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDABC + thumb_func_end PlayerPartnerHandleUnknownYesNoBox - thumb_func_start sub_81BDAC8 -sub_81BDAC8: @ 81BDAC8 + thumb_func_start PlayerPartnerHandleChooseMove +PlayerPartnerHandleChooseMove: @ 81BDAC8 push {r4-r6,lr} ldr r6, =gActiveBank ldrb r4, [r6] @@ -5074,18 +5022,18 @@ _081BDB3C: pop {r0} bx r0 .pool - thumb_func_end sub_81BDAC8 + thumb_func_end PlayerPartnerHandleChooseMove - thumb_func_start sub_81BDB70 -sub_81BDB70: @ 81BDB70 + thumb_func_start PlayerPartnerHandleChooseItem +PlayerPartnerHandleChooseItem: @ 81BDB70 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDB70 + thumb_func_end PlayerPartnerHandleChooseItem - thumb_func_start sub_81BDB7C -sub_81BDB7C: @ 81BDB7C + thumb_func_start PlayerPartnerHandleChoosePokemon +PlayerPartnerHandleChoosePokemon: @ 81BDB7C push {r4-r6,lr} bl GetMostSuitableMonToSwitchInto lsls r0, 24 @@ -5144,18 +5092,18 @@ _081BDBD0: pop {r0} bx r0 .pool - thumb_func_end sub_81BDB7C + thumb_func_end PlayerPartnerHandleChoosePokemon - thumb_func_start sub_81BDC04 -sub_81BDC04: @ 81BDC04 + thumb_func_start PlayerPartnerHandleCmd23 +PlayerPartnerHandleCmd23: @ 81BDC04 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDC04 + thumb_func_end PlayerPartnerHandleCmd23 - thumb_func_start sub_81BDC10 -sub_81BDC10: @ 81BDC10 + thumb_func_start PlayerPartnerHandleHealthBarUpdate +PlayerPartnerHandleHealthBarUpdate: @ 81BDC10 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -5248,10 +5196,10 @@ _081BDCCA: pop {r0} bx r0 .pool - thumb_func_end sub_81BDC10 + thumb_func_end PlayerPartnerHandleHealthBarUpdate - thumb_func_start sub_81BDD00 -sub_81BDD00: @ 81BDD00 + thumb_func_start PlayerPartnerHandleExpUpdate +PlayerPartnerHandleExpUpdate: @ 81BDD00 push {r4-r7,lr} ldr r5, =gBattleBufferA ldr r6, =gActiveBank @@ -5314,10 +5262,10 @@ _081BDD84: pop {r0} bx r0 .pool - thumb_func_end sub_81BDD00 + thumb_func_end PlayerPartnerHandleExpUpdate - thumb_func_start sub_81BDD9C -sub_81BDD9C: @ 81BDD9C + thumb_func_start PlayerPartnerHandleStatusIconUpdate +PlayerPartnerHandleStatusIconUpdate: @ 81BDD9C push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5363,10 +5311,10 @@ _081BDDF0: pop {r0} bx r0 .pool - thumb_func_end sub_81BDD9C + thumb_func_end PlayerPartnerHandleStatusIconUpdate - thumb_func_start sub_81BDE14 -sub_81BDE14: @ 81BDE14 + thumb_func_start PlayerPartnerHandleStatusAnimation +PlayerPartnerHandleStatusAnimation: @ 81BDE14 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -5410,82 +5358,82 @@ _081BDE64: pop {r0} bx r0 .pool - thumb_func_end sub_81BDE14 + thumb_func_end PlayerPartnerHandleStatusAnimation - thumb_func_start sub_81BDE7C -sub_81BDE7C: @ 81BDE7C + thumb_func_start PlayerPartnerHandleStatusXor +PlayerPartnerHandleStatusXor: @ 81BDE7C push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDE7C + thumb_func_end PlayerPartnerHandleStatusXor - thumb_func_start sub_81BDE88 -sub_81BDE88: @ 81BDE88 + thumb_func_start PlayerPartnerHandleDataTransfer +PlayerPartnerHandleDataTransfer: @ 81BDE88 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDE88 + thumb_func_end PlayerPartnerHandleDataTransfer - thumb_func_start sub_81BDE94 -sub_81BDE94: @ 81BDE94 + thumb_func_start PlayerPartnerHandleDMA3Transfer +PlayerPartnerHandleDMA3Transfer: @ 81BDE94 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDE94 + thumb_func_end PlayerPartnerHandleDMA3Transfer - thumb_func_start sub_81BDEA0 -sub_81BDEA0: @ 81BDEA0 + thumb_func_start PlayerPartnerHandlePlayBGM +PlayerPartnerHandlePlayBGM: @ 81BDEA0 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDEA0 + thumb_func_end PlayerPartnerHandlePlayBGM - thumb_func_start sub_81BDEAC -sub_81BDEAC: @ 81BDEAC + thumb_func_start PlayerPartnerHandleCmd32 +PlayerPartnerHandleCmd32: @ 81BDEAC push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDEAC + thumb_func_end PlayerPartnerHandleCmd32 - thumb_func_start sub_81BDEB8 -sub_81BDEB8: @ 81BDEB8 + thumb_func_start PlayerPartnerHandleTwoReturnValues +PlayerPartnerHandleTwoReturnValues: @ 81BDEB8 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDEB8 + thumb_func_end PlayerPartnerHandleTwoReturnValues - thumb_func_start sub_81BDEC4 -sub_81BDEC4: @ 81BDEC4 + thumb_func_start PlayerPartnerHandleChosenMonReturnValue +PlayerPartnerHandleChosenMonReturnValue: @ 81BDEC4 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDEC4 + thumb_func_end PlayerPartnerHandleChosenMonReturnValue - thumb_func_start sub_81BDED0 -sub_81BDED0: @ 81BDED0 + thumb_func_start PlayerPartnerHandleOneReturnValue +PlayerPartnerHandleOneReturnValue: @ 81BDED0 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDED0 + thumb_func_end PlayerPartnerHandleOneReturnValue - thumb_func_start sub_81BDEDC -sub_81BDEDC: @ 81BDEDC + thumb_func_start PlayerPartnerHandleOneReturnValue_Duplicate +PlayerPartnerHandleOneReturnValue_Duplicate: @ 81BDEDC push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDEDC + thumb_func_end PlayerPartnerHandleOneReturnValue_Duplicate - thumb_func_start sub_81BDEE8 -sub_81BDEE8: @ 81BDEE8 + thumb_func_start PlayerPartnerHandleCmd37 +PlayerPartnerHandleCmd37: @ 81BDEE8 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5497,10 +5445,10 @@ sub_81BDEE8: @ 81BDEE8 pop {r0} bx r0 .pool - thumb_func_end sub_81BDEE8 + thumb_func_end PlayerPartnerHandleCmd37 - thumb_func_start sub_81BDF04 -sub_81BDF04: @ 81BDF04 + thumb_func_start PlayerPartnerHandleCmd38 +PlayerPartnerHandleCmd38: @ 81BDF04 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, =gBattleBufferA @@ -5522,10 +5470,10 @@ sub_81BDF04: @ 81BDF04 pop {r0} bx r0 .pool - thumb_func_end sub_81BDF04 + thumb_func_end PlayerPartnerHandleCmd38 - thumb_func_start sub_81BDF3C -sub_81BDF3C: @ 81BDF3C + thumb_func_start PlayerPartnerHandleCmd39 +PlayerPartnerHandleCmd39: @ 81BDF3C push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5536,10 +5484,10 @@ sub_81BDF3C: @ 81BDF3C pop {r0} bx r0 .pool - thumb_func_end sub_81BDF3C + thumb_func_end PlayerPartnerHandleCmd39 - thumb_func_start sub_81BDF54 -sub_81BDF54: @ 81BDF54 + thumb_func_start PlayerPartnerHandleCmd40 +PlayerPartnerHandleCmd40: @ 81BDF54 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, [r3] @@ -5557,10 +5505,10 @@ sub_81BDF54: @ 81BDF54 pop {r0} bx r0 .pool - thumb_func_end sub_81BDF54 + thumb_func_end PlayerPartnerHandleCmd40 - thumb_func_start dp01t_29_3_blink -dp01t_29_3_blink: @ 81BDF7C + thumb_func_start PlayerPartnerHandleHitAnimation +PlayerPartnerHandleHitAnimation: @ 81BDF7C push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -5606,18 +5554,18 @@ _081BDFDA: pop {r0} bx r0 .pool - thumb_func_end dp01t_29_3_blink + thumb_func_end PlayerPartnerHandleHitAnimation - thumb_func_start sub_81BDFEC -sub_81BDFEC: @ 81BDFEC + thumb_func_start PlayerPartnerHandleCmd42 +PlayerPartnerHandleCmd42: @ 81BDFEC push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BDFEC + thumb_func_end PlayerPartnerHandleCmd42 - thumb_func_start sub_81BDFF8 -sub_81BDFF8: @ 81BDFF8 + thumb_func_start PlayerPartnerHandleEffectivenessSound +PlayerPartnerHandleEffectivenessSound: @ 81BDFF8 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5647,10 +5595,10 @@ _081BE00C: pop {r0} bx r0 .pool - thumb_func_end sub_81BDFF8 + thumb_func_end PlayerPartnerHandleEffectivenessSound - thumb_func_start sub_81BE03C -sub_81BE03C: @ 81BE03C + thumb_func_start PlayerPartnerHandlePlayFanfareOrBGM +PlayerPartnerHandlePlayFanfareOrBGM: @ 81BE03C push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -5690,10 +5638,10 @@ _081BE08C: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_81BE03C + thumb_func_end PlayerPartnerHandlePlayFanfareOrBGM - thumb_func_start sub_81BE098 -sub_81BE098: @ 81BE098 + thumb_func_start PlayerPartnerHandleFaintingCry +PlayerPartnerHandleFaintingCry: @ 81BE098 push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -5717,10 +5665,10 @@ sub_81BE098: @ 81BE098 pop {r0} bx r0 .pool - thumb_func_end sub_81BE098 + thumb_func_end PlayerPartnerHandleFaintingCry - thumb_func_start dp01t_2E_3_battle_intro -dp01t_2E_3_battle_intro: @ 81BE0D8 + thumb_func_start PlayerPartnerHandleIntroSlide +PlayerPartnerHandleIntroSlide: @ 81BE0D8 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5739,10 +5687,10 @@ dp01t_2E_3_battle_intro: @ 81BE0D8 pop {r0} bx r0 .pool - thumb_func_end dp01t_2E_3_battle_intro + thumb_func_end PlayerPartnerHandleIntroSlide - thumb_func_start sub_81BE10C -sub_81BE10C: @ 81BE10C + thumb_func_start PlayerPartnerHandleIntroTrainerBallThrow +PlayerPartnerHandleIntroTrainerBallThrow: @ 81BE10C push {r4-r6,lr} ldr r6, =gBankSpriteIds ldr r5, =gActiveBank @@ -5919,7 +5867,7 @@ _081BE27E: pop {r0} bx r0 .pool - thumb_func_end sub_81BE10C + thumb_func_end PlayerPartnerHandleIntroTrainerBallThrow thumb_func_start sub_81BE2C8 sub_81BE2C8: @ 81BE2C8 @@ -6038,8 +5986,8 @@ _081BE3B0: .pool thumb_func_end sub_81BE2C8 - thumb_func_start dp01t_30_3_80EB11C -dp01t_30_3_80EB11C: @ 81BE3D4 + thumb_func_start PlayerPartnerHandleDrawPartyStatusSummary +PlayerPartnerHandleDrawPartyStatusSummary: @ 81BE3D4 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -6122,7 +6070,7 @@ _081BE478: pop {r0} bx r0 .pool - thumb_func_end dp01t_30_3_80EB11C + thumb_func_end PlayerPartnerHandleDrawPartyStatusSummary thumb_func_start sub_81BE498 sub_81BE498: @ 81BE498 @@ -6160,8 +6108,8 @@ _081BE4D0: .pool thumb_func_end sub_81BE498 - thumb_func_start sub_81BE4E0 -sub_81BE4E0: @ 81BE4E0 + thumb_func_start PlayerPartnerHandleCmd49 +PlayerPartnerHandleCmd49: @ 81BE4E0 push {lr} ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] @@ -6192,18 +6140,18 @@ _081BE512: pop {r0} bx r0 .pool - thumb_func_end sub_81BE4E0 + thumb_func_end PlayerPartnerHandleCmd49 - thumb_func_start sub_81BE530 -sub_81BE530: @ 81BE530 + thumb_func_start PlayerPartnerHandleCmd50 +PlayerPartnerHandleCmd50: @ 81BE530 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BE530 + thumb_func_end PlayerPartnerHandleCmd50 - thumb_func_start sub_81BE53C -sub_81BE53C: @ 81BE53C + thumb_func_start PlayerPartnerHandleSpriteInvisibility +PlayerPartnerHandleSpriteInvisibility: @ 81BE53C push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -6243,10 +6191,10 @@ _081BE582: pop {r0} bx r0 .pool - thumb_func_end sub_81BE53C + thumb_func_end PlayerPartnerHandleSpriteInvisibility - thumb_func_start sub_81BE59C -sub_81BE59C: @ 81BE59C + thumb_func_start PlayerPartnerHandleBattleAnimation +PlayerPartnerHandleBattleAnimation: @ 81BE59C push {r4-r6,lr} sub sp, 0x4 ldr r6, =gActiveBank @@ -6292,26 +6240,26 @@ _081BE5F4: pop {r0} bx r0 .pool - thumb_func_end sub_81BE59C + thumb_func_end PlayerPartnerHandleBattleAnimation - thumb_func_start sub_81BE604 -sub_81BE604: @ 81BE604 + thumb_func_start PlayerPartnerHandleLinkStandbyMsg +PlayerPartnerHandleLinkStandbyMsg: @ 81BE604 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BE604 + thumb_func_end PlayerPartnerHandleLinkStandbyMsg - thumb_func_start sub_81BE610 -sub_81BE610: @ 81BE610 + thumb_func_start PlayerPartnerHandleResetActionMoveSelection +PlayerPartnerHandleResetActionMoveSelection: @ 81BE610 push {lr} bl PlayerPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81BE610 + thumb_func_end PlayerPartnerHandleResetActionMoveSelection - thumb_func_start sub_81BE61C -sub_81BE61C: @ 81BE61C + thumb_func_start PlayerPartnerHandleCmd55 +PlayerPartnerHandleCmd55: @ 81BE61C push {r4,lr} ldr r2, =gBattleOutcome ldr r1, =gBattleBufferA @@ -6337,7 +6285,7 @@ sub_81BE61C: @ 81BE61C pop {r0} bx r0 .pool - thumb_func_end sub_81BE61C + thumb_func_end PlayerPartnerHandleCmd55 thumb_func_start nullsub_128 nullsub_128: @ 81BE668 diff --git a/data/battle_controller_player_partner.s b/data/battle_controller_player_partner.s deleted file mode 100644 index 35d78ebe0..000000000 --- a/data/battle_controller_player_partner.s +++ /dev/null @@ -1,71 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gPlayerPartnerBufferCommands:: @ 8617170 - .4byte dp01t_00_3_getattr - .4byte sub_81BC484 - .4byte sub_81BC490 - .4byte sub_81BCEE4 - .4byte sub_81BCF58 - .4byte sub_81BD074 - .4byte sub_81BD260 - .4byte sub_81BD37C - .4byte sub_81BD5BC - .4byte sub_81BD5C8 - .4byte sub_81BD674 - .4byte sub_81BD760 - .4byte sub_81BD76C - .4byte sub_81BD778 - .4byte sub_81BD784 - .4byte sub_81BD790 - .4byte sub_81BDA4C - .4byte sub_81BDAA0 - .4byte sub_81BDAAC - .4byte sub_81BDABC - .4byte sub_81BDAC8 - .4byte sub_81BDB70 - .4byte sub_81BDB7C - .4byte sub_81BDC04 - .4byte sub_81BDC10 - .4byte sub_81BDD00 - .4byte sub_81BDD9C - .4byte sub_81BDE14 - .4byte sub_81BDE7C - .4byte sub_81BDE88 - .4byte sub_81BDE94 - .4byte sub_81BDEA0 - .4byte sub_81BDEAC - .4byte sub_81BDEB8 - .4byte sub_81BDEC4 - .4byte sub_81BDED0 - .4byte sub_81BDEDC - .4byte sub_81BDEE8 - .4byte sub_81BDF04 - .4byte sub_81BDF3C - .4byte sub_81BDF54 - .4byte dp01t_29_3_blink - .4byte sub_81BDFEC - .4byte sub_81BDFF8 - .4byte sub_81BE03C - .4byte sub_81BE098 - .4byte dp01t_2E_3_battle_intro - .4byte sub_81BE10C - .4byte dp01t_30_3_80EB11C - .4byte sub_81BE4E0 - .4byte sub_81BE530 - .4byte sub_81BE53C - .4byte sub_81BE59C - .4byte sub_81BE604 - .4byte sub_81BE610 - .4byte sub_81BE61C - .4byte nullsub_128 - - .align 2 - @ apparently unused data - .byte 0x83, 0x4d, 0xf3, 0x5f, 0x6f, 0x4f, 0xeb, 0x3e - .byte 0x67, 0x2e, 0x10, 0x46, 0x8c, 0x3d, 0x28, 0x35 - .byte 0xc5, 0x2c, 0x15, 0x7f, 0xb5, 0x56, 0x9d, 0x53 - .byte 0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53 diff --git a/ld_script.txt b/ld_script.txt index dc379a499..6a7f362c4 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -253,6 +253,7 @@ SECTIONS { src/unk_text_util_2.o(.text); src/multiboot.o(.text); asm/unk_81BAD84.o(.text); + src/battle_controller_player_partner.o(.text); asm/battle_controller_player_partner.o(.text); asm/fldeff_groundshake.o(.text); asm/fossil_specials.o(.text); @@ -467,7 +468,7 @@ SECTIONS { data/battle_tent.o(.rodata); src/unk_text_util_2.o(.rodata); data/unk_81BAD84.o(.rodata); - data/battle_controller_player_partner.o(.rodata); + src/battle_controller_player_partner.o(.rodata); data/fossil_special_fldeff_groundshake.o(.rodata); src/berry_fix_program.o(.rodata); data/pokemon_summary_screen.o(.rodata); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c new file mode 100644 index 000000000..009de472f --- /dev/null +++ b/src/battle_controller_player_partner.c @@ -0,0 +1,198 @@ +#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 "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +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 struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; + +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; + +extern void sub_81358F4(void); + +// this file's functions +void PlayerPartnerHandleGetMonData(void); +void PlayerPartnerHandleGetRawMonData(void); +void PlayerPartnerHandleSetMonData(void); +void PlayerPartnerHandleSetRawMonData(void); +void PlayerPartnerHandleLoadMonSprite(void); +void PlayerPartnerHandleSwitchInAnim(void); +void PlayerPartnerHandleReturnMonToBall(void); +void PlayerPartnerHandleDrawTrainerPic(void); +void PlayerPartnerHandleTrainerSlide(void); +void PlayerPartnerHandleTrainerSlideBack(void); +void PlayerPartnerHandleFaintAnimation(void); +void PlayerPartnerHandlePaletteFade(void); +void PlayerPartnerHandleSuccessBallThrowAnim(void); +void PlayerPartnerHandleBallThrowAnim(void); +void PlayerPartnerHandlePause(void); +void PlayerPartnerHandleMoveAnimation(void); +void PlayerPartnerHandlePrintString(void); +void PlayerPartnerHandlePrintStringPlayerOnly(void); +void PlayerPartnerHandleChooseAction(void); +void PlayerPartnerHandleUnknownYesNoBox(void); +void PlayerPartnerHandleChooseMove(void); +void PlayerPartnerHandleChooseItem(void); +void PlayerPartnerHandleChoosePokemon(void); +void PlayerPartnerHandleCmd23(void); +void PlayerPartnerHandleHealthBarUpdate(void); +void PlayerPartnerHandleExpUpdate(void); +void PlayerPartnerHandleStatusIconUpdate(void); +void PlayerPartnerHandleStatusAnimation(void); +void PlayerPartnerHandleStatusXor(void); +void PlayerPartnerHandleDataTransfer(void); +void PlayerPartnerHandleDMA3Transfer(void); +void PlayerPartnerHandlePlayBGM(void); +void PlayerPartnerHandleCmd32(void); +void PlayerPartnerHandleTwoReturnValues(void); +void PlayerPartnerHandleChosenMonReturnValue(void); +void PlayerPartnerHandleOneReturnValue(void); +void PlayerPartnerHandleOneReturnValue_Duplicate(void); +void PlayerPartnerHandleCmd37(void); +void PlayerPartnerHandleCmd38(void); +void PlayerPartnerHandleCmd39(void); +void PlayerPartnerHandleCmd40(void); +void PlayerPartnerHandleHitAnimation(void); +void PlayerPartnerHandleCmd42(void); +void PlayerPartnerHandleEffectivenessSound(void); +void PlayerPartnerHandlePlayFanfareOrBGM(void); +void PlayerPartnerHandleFaintingCry(void); +void PlayerPartnerHandleIntroSlide(void); +void PlayerPartnerHandleIntroTrainerBallThrow(void); +void PlayerPartnerHandleDrawPartyStatusSummary(void); +void PlayerPartnerHandleCmd49(void); +void PlayerPartnerHandleCmd50(void); +void PlayerPartnerHandleSpriteInvisibility(void); +void PlayerPartnerHandleBattleAnimation(void); +void PlayerPartnerHandleLinkStandbyMsg(void); +void PlayerPartnerHandleResetActionMoveSelection(void); +void PlayerPartnerHandleCmd55(void); +void nullsub_128(void); + +void PlayerPartnerBufferRunCommand(void); +void PlayerPartnerBufferExecCompleted(void); + +void (*const gPlayerPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + PlayerPartnerHandleGetMonData, + PlayerPartnerHandleGetRawMonData, + PlayerPartnerHandleSetMonData, + PlayerPartnerHandleSetRawMonData, + PlayerPartnerHandleLoadMonSprite, + PlayerPartnerHandleSwitchInAnim, + PlayerPartnerHandleReturnMonToBall, + PlayerPartnerHandleDrawTrainerPic, + PlayerPartnerHandleTrainerSlide, + PlayerPartnerHandleTrainerSlideBack, + PlayerPartnerHandleFaintAnimation, + PlayerPartnerHandlePaletteFade, + PlayerPartnerHandleSuccessBallThrowAnim, + PlayerPartnerHandleBallThrowAnim, + PlayerPartnerHandlePause, + PlayerPartnerHandleMoveAnimation, + PlayerPartnerHandlePrintString, + PlayerPartnerHandlePrintStringPlayerOnly, + PlayerPartnerHandleChooseAction, + PlayerPartnerHandleUnknownYesNoBox, + PlayerPartnerHandleChooseMove, + PlayerPartnerHandleChooseItem, + PlayerPartnerHandleChoosePokemon, + PlayerPartnerHandleCmd23, + PlayerPartnerHandleHealthBarUpdate, + PlayerPartnerHandleExpUpdate, + PlayerPartnerHandleStatusIconUpdate, + PlayerPartnerHandleStatusAnimation, + PlayerPartnerHandleStatusXor, + PlayerPartnerHandleDataTransfer, + PlayerPartnerHandleDMA3Transfer, + PlayerPartnerHandlePlayBGM, + PlayerPartnerHandleCmd32, + PlayerPartnerHandleTwoReturnValues, + PlayerPartnerHandleChosenMonReturnValue, + PlayerPartnerHandleOneReturnValue, + PlayerPartnerHandleOneReturnValue_Duplicate, + PlayerPartnerHandleCmd37, + PlayerPartnerHandleCmd38, + PlayerPartnerHandleCmd39, + PlayerPartnerHandleCmd40, + PlayerPartnerHandleHitAnimation, + PlayerPartnerHandleCmd42, + PlayerPartnerHandleEffectivenessSound, + PlayerPartnerHandlePlayFanfareOrBGM, + PlayerPartnerHandleFaintingCry, + PlayerPartnerHandleIntroSlide, + PlayerPartnerHandleIntroTrainerBallThrow, + PlayerPartnerHandleDrawPartyStatusSummary, + PlayerPartnerHandleCmd49, + PlayerPartnerHandleCmd50, + PlayerPartnerHandleSpriteInvisibility, + PlayerPartnerHandleBattleAnimation, + PlayerPartnerHandleLinkStandbyMsg, + PlayerPartnerHandleResetActionMoveSelection, + PlayerPartnerHandleCmd55, + nullsub_128 +}; + +// unknown unused data +static const u8 gUnknown_08617254[] = +{ + 0x83, 0x4d, 0xf3, 0x5f, 0x6f, 0x4f, 0xeb, 0x3e, + 0x67, 0x2e, 0x10, 0x46, 0x8c, 0x3d, 0x28, 0x35, + 0xc5, 0x2c, 0x15, 0x7f, 0xb5, 0x56, 0x9d, 0x53, + 0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53, +}; + +void nullsub_77(void) +{ +} + +void SetBankFuncToPlayerPartnerBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = PlayerPartnerBufferRunCommand; +} + +void PlayerPartnerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gPlayerPartnerBufferCommands)) + gPlayerPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + PlayerPartnerBufferExecCompleted(); + } +} + From a8ea415c81d72a5057f185885512f69405106691 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 11:07:36 +0200 Subject: [PATCH 06/29] player partner controller is done --- asm/battle_controller_linkopponent.s | 4 +- asm/battle_controller_opponent.s | 12 +- asm/battle_controller_player_partner.s | 6295 --------------------- asm/battle_controller_recorded_opponent.s | 2 +- asm/battle_frontier_1.s | 6 +- asm/battle_tower.s | 6 +- ld_script.txt | 1 - src/battle_controller_player_partner.c | 1896 ++++++- 8 files changed, 1849 insertions(+), 6373 deletions(-) delete mode 100644 asm/battle_controller_player_partner.s diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index 1b4a01f2a..f719ab59d 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -4047,7 +4047,7 @@ _08066794: ldr r0, =gTrainerBattleOpponent_B _08066796: ldrh r0, [r0] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId lsls r0, 24 lsrs r0, 24 b _0806694C @@ -4379,7 +4379,7 @@ _08066A74: ldr r0, =gTrainerBattleOpponent_B _08066A76: ldrh r0, [r0] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId lsls r0, 24 lsrs r0, 24 mov r8, r0 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index b627404c8..1fc43b9e9 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -4238,18 +4238,18 @@ _08061708: cmp r0, 0x1 bne _08061734 ldrh r0, [r3] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId b _0806175A .pool _08061734: ldr r0, =gTrainerBattleOpponent_B ldrh r0, [r0] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId b _0806175A .pool _08061744: ldrh r0, [r3] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId b _0806175A _0806174C: movs r0, 0x80 @@ -4485,18 +4485,18 @@ _08061950: cmp r0, 0x1 bne _0806197C ldrh r0, [r3] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId b _080619A2 .pool _0806197C: ldr r0, =gTrainerBattleOpponent_B ldrh r0, [r0] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId b _080619A2 .pool _0806198C: ldrh r0, [r3] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId b _080619A2 _08061994: movs r0, 0x80 diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s deleted file mode 100644 index 99a2c5c4f..000000000 --- a/asm/battle_controller_player_partner.s +++ /dev/null @@ -1,6295 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - thumb_func_start sub_81BAE60 -sub_81BAE60: @ 81BAE60 - 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 _081BAE84 - bl PlayerPartnerBufferExecCompleted -_081BAE84: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAE60 - - thumb_func_start sub_81BAE98 -sub_81BAE98: @ 81BAE98 - 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 _081BAEE8 - movs r0, 0 - 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 PlayerPartnerBufferExecCompleted -_081BAEE8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAE98 - - thumb_func_start sub_81BAF00 -sub_81BAF00: @ 81BAF00 - 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 _081BAF38 - 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 PlayerPartnerBufferExecCompleted -_081BAF38: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAF00 - - thumb_func_start sub_81BAF48 -sub_81BAF48: @ 81BAF48 - push {r4-r6,lr} - movs r6, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BAF6C - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BAFA0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081BAFA0 -_081BAF6C: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - 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 _081BAFD8 - b _081BAFD6 - .pool -_081BAFA0: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r2, 0 - adds r4, 0x1C - adds r0, r4 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - cmp r2, r0 - bne _081BAFD8 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r2 - bne _081BAFD8 -_081BAFD6: - movs r6, 0x1 -_081BAFD8: - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - beq _081BAFE4 - movs r6, 0 -_081BAFE4: - cmp r6, 0 - beq _081BB00A - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - 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 - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAF00 - str r1, [r0] -_081BB00A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAF48 - - thumb_func_start sub_81BB02C -sub_81BB02C: @ 81BB02C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gBattleSpritesDataPtr - mov r12, r0 - ldr r0, [r0] - ldr r7, =gActiveBank - 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 - beq _081BB058 - b _081BB196 -_081BB058: - movs r1, 0x2 - mov r8, r1 - adds r1, r2, 0 - mov r0, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _081BB07A - b _081BB196 -_081BB07A: - ldr r1, =gSprites - mov r10, r1 - ldr r0, =gUnknown_03005D7C - mov r9, r0 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r5, r10 - adds r5, 0x1C - adds r0, r5 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _081BB196 - ldr r0, =gBankSpriteIds - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r3 - bne _081BB196 - ldrb r0, [r4, 0x9] - adds r0, 0x1 - strb r0, [r4, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081BB196 - mov r1, r12 - ldr r0, [r1] - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r6, [r0, 0x9] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BB134 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BB134 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - add r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r0, [r7] - mov r1, r8 - 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] - mov r1, r8 - eors r0, r1 - bl sub_8076918 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_081BB134: - 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 r5, =gHealthBoxesIds - 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 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAF48 - str r1, [r0] -_081BB196: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB02C - - thumb_func_start sub_81BB1D4 -sub_81BB1D4: @ 81BB1D4 - 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 r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _081BB202 - movs r2, 0x24 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _081BB202 - bl PlayerPartnerBufferExecCompleted -_081BB202: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB1D4 - - thumb_func_start bx_t3_healthbar_update -bx_t3_healthbar_update: @ 81BB214 - 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 _081BB25C - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _081BB276 - .pool -_081BB25C: - 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 PlayerPartnerBufferExecCompleted -_081BB276: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_t3_healthbar_update - - thumb_func_start sub_81BB284 -sub_81BB284: @ 81BB284 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081BB296 - bl PlayerPartnerBufferExecCompleted -_081BB296: - pop {r0} - bx r0 - thumb_func_end sub_81BB284 - - thumb_func_start sub_81BB29C -sub_81BB29C: @ 81BB29C - 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 _081BB2E2 - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r10, r0 - bne _081BB2E2 - b _081BB3F8 -_081BB2E2: - 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 _081BB3D0 - 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 EmitTwoReturnValues - strb r5, [r4] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BB3B8 - ldr r2, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r2 - mov r1, r10 - ldrh r0, [r0] - cmp r1, r0 - beq _081BB396 - movs r0, 0x2 - eors r7, r0 - lsls r0, r7, 1 - adds r0, r2 - ldrh r0, [r0] - cmp r1, r0 - bne _081BB3B8 -_081BB396: - ldr r0, =sub_81BB628 - b _081BB3FA - .pool -_081BB3B8: - ldr r0, =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81BB740 - b _081BB3FC - .pool -_081BB3D0: - 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_81BB284 - str r1, [r0] - mov r0, r9 - bl DestroyTask - b _081BB3FE - .pool -_081BB3F8: - ldr r0, =sub_81BB414 -_081BB3FA: - mov r1, r8 -_081BB3FC: - str r0, [r1] -_081BB3FE: - 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_81BB29C - - thumb_func_start sub_81BB414 -sub_81BB414: @ 81BB414 - 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_81BB4E4 - 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_81BB414 - - thumb_func_start sub_81BB4E4 -sub_81BB4E4: @ 81BB4E4 - 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 _081BB514 - adds r0, r1, 0x1 - strh r0, [r6, 0x1C] - b _081BB610 - .pool -_081BB514: - 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 _081BB610 - 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 _081BB5F4 - 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 EmitTwoReturnValues - strb r5, [r4] - ldr r0, =sub_81BB628 - str r0, [r6] - b _081BB610 - .pool -_081BB5F4: - 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_81BB284 - str r1, [r0] - mov r0, r8 - bl DestroyTask -_081BB610: - 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_81BB4E4 - - thumb_func_start sub_81BB628 -sub_81BB628: @ 81BB628 - 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 _081BB65C - 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 _081BB65C - adds r4, r2, 0 -_081BB65C: - adds r0, r4, 0 - adds r1, r4, 0 - adds r2, r4, 0 - movs r3, 0 - bl DoSpecialBattleAnimation - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81BB688 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB628 - - thumb_func_start sub_81BB688 -sub_81BB688: @ 81BB688 - 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 _081BB72A - 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 _081BB708 - 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 _081BB708 - ldr r0, =gHealthBoxesIds - adds r0, r2, r0 - ldrb r0, [r0] - adds r1, r7, 0 - movs r2, 0 - bl UpdateHealthboxAttribute - b _081BB71C - .pool -_081BB708: - 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 -_081BB71C: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81BB740 - str r0, [r1] -_081BB72A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB688 - - thumb_func_start sub_81BB740 -sub_81BB740: @ 81BB740 - 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_81BB284 - str r1, [r0] - adds r0, r5, 0 - bl DestroyTask - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB740 - - thumb_func_start sub_81BB78C -sub_81BB78C: @ 81BB78C - 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 _081BB808 - 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 PlayerPartnerBufferExecCompleted -_081BB808: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB78C - - thumb_func_start sub_81BB828 -sub_81BB828: @ 81BB828 - 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 _081BB87C - 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 PlayerPartnerBufferExecCompleted -_081BB87C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB828 - - thumb_func_start sub_81BB898 -sub_81BB898: @ 81BB898 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081BB8AA - bl PlayerPartnerBufferExecCompleted -_081BB8AA: - pop {r0} - bx r0 - thumb_func_end sub_81BB898 - - thumb_func_start bx_blink_t3 -bx_blink_t3: @ 81BB8B0 - 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 _081BB8FC - 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 PlayerPartnerBufferExecCompleted - b _081BB926 - .pool -_081BB8FC: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _081BB920 - 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] -_081BB920: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_081BB926: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t3 - - thumb_func_start sub_81BB92C -sub_81BB92C: @ 81BB92C - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - 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 _081BB97E - adds r0, r3, 0 - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r2, [r4] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081BB972 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_081BB972: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =dp01t_35_3_free_vram - str r0, [r1] -_081BB97E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB92C - - thumb_func_start dp01t_35_3_free_vram -dp01t_35_3_free_vram: @ 81BB9A0 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BB9DC - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - 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 _081BB9DC - bl PlayerPartnerBufferExecCompleted -_081BB9DC: - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_35_3_free_vram - - thumb_func_start sub_81BB9F4 -sub_81BB9F4: @ 81BB9F4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r7, =gActiveBank - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081BBAB0 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - 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, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r0, =gBattlePartyID - mov r8, r0 - ldrb r1, [r7] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - bl sub_805E990 - ldr r1, =gBankSpriteIds - ldrb r0, [r7] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - lsls r1, 1 - add r1, r8 - ldrh r1, [r1] - muls r1, r6 - adds r1, r5 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - bl sub_8076918 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB92C - str r1, [r0] -_081BBAB0: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB9F4 - - thumb_func_start sub_81BBAE8 -sub_81BBAE8: @ 81BBAE8 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r4, =gActiveBank - ldrb r2, [r4] - 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 _081BBB1A - 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 -_081BBB1A: - ldr r5, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r4] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081BBB60 - 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 _081BBB60 - adds r0, r3, r5 - bl DestroySprite - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB9F4 - str r1, [r0] -_081BBB60: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BBAE8 - - thumb_func_start PlayerPartnerBufferExecCompleted -PlayerPartnerBufferExecCompleted: @ 81BBB8C - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerPartnerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081BBBE0 - 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 _081BBBF2 - .pool -_081BBBE0: - 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] -_081BBBF2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerBufferExecCompleted - - thumb_func_start sub_81BBC04 -sub_81BBC04: @ 81BBC04 - 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 _081BBC26 - bl PlayerPartnerBufferExecCompleted -_081BBC26: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BBC04 - - thumb_func_start bx_80E8A6C -bx_80E8A6C: @ 81BBC34 - 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 _081BBC56 - bl PlayerPartnerBufferExecCompleted -_081BBC56: - pop {r0} - bx r0 - .pool - thumb_func_end bx_80E8A6C - - thumb_func_start PlayerPartnerHandleGetMonData -PlayerPartnerHandleGetMonData: @ 81BBC64 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _081BBC9C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_player_pokemon - adds r6, r0, 0 - b _081BBCBE - .pool -_081BBC9C: - ldrb r4, [r1] - movs r5, 0 -_081BBCA0: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081BBCB6 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_player_pokemon - adds r6, r0 -_081BBCB6: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _081BBCA0 -_081BBCBE: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl PlayerPartnerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleGetMonData - - thumb_func_start dp01_getattr_by_ch1_for_player_pokemon -dp01_getattr_by_ch1_for_player_pokemon: @ 81BBCD8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _081BBD02 - bl _081BC46E -_081BBD02: - lsls r0, 2 - ldr r1, =_081BBD18 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BBD18: - .4byte _081BBE08 - .4byte _081BC02C - .4byte _081BC03C - .4byte _081BC04C - .4byte _081BC0B4 - .4byte _081BC0B4 - .4byte _081BC0B4 - .4byte _081BC0B4 - .4byte _081BC0D0 - .4byte _081BC10C - .4byte _081BC10C - .4byte _081BC10C - .4byte _081BC10C - .4byte _081BC46E - .4byte _081BC46E - .4byte _081BC46E - .4byte _081BC46E - .4byte _081BC128 - .4byte _081BC138 - .4byte _081BC168 - .4byte _081BC178 - .4byte _081BC188 - .4byte _081BC198 - .4byte _081BC1A8 - .4byte _081BC1B8 - .4byte _081BC1C8 - .4byte _081BC1D8 - .4byte _081BC1E8 - .4byte _081BC1F8 - .4byte _081BC208 - .4byte _081BC218 - .4byte _081BC228 - .4byte _081BC278 - .4byte _081BC288 - .4byte _081BC298 - .4byte _081BC2A8 - .4byte _081BC2B8 - .4byte _081BC2C8 - .4byte _081BC2D8 - .4byte _081BC2E8 - .4byte _081BC2F8 - .4byte _081BC32C - .4byte _081BC33C - .4byte _081BC34C - .4byte _081BC35C - .4byte _081BC36C - .4byte _081BC37C - .4byte _081BC38C - .4byte _081BC39C - .4byte _081BC3BC - .4byte _081BC3CC - .4byte _081BC3DC - .4byte _081BC3EC - .4byte _081BC3FC - .4byte _081BC40C - .4byte _081BC41C - .4byte _081BC42C - .4byte _081BC43C - .4byte _081BC44C - .4byte _081BC45C -_081BBE08: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_081BBE54: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _081BBE54 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_081BC00C: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _081BC00C - b _081BC46E - .pool -_081BC02C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _081BC3A6 - .pool -_081BC03C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _081BC3A6 - .pool -_081BC04C: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_081BC062: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _081BC062 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_081BC0A0: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _081BC0A0 - b _081BC46E - .pool -_081BC0B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _081BC3A6 - .pool -_081BC0D0: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_081BC0DC: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _081BC0DC - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _081BC46E - .pool -_081BC10C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _081BC466 - .pool -_081BC128: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _081BC142 - .pool -_081BC138: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_081BC142: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _081BC46E - .pool -_081BC168: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _081BC466 - .pool -_081BC178: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _081BC466 - .pool -_081BC188: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _081BC466 - .pool -_081BC198: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _081BC466 - .pool -_081BC1A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _081BC466 - .pool -_081BC1B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _081BC466 - .pool -_081BC1C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _081BC466 - .pool -_081BC1D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _081BC466 - .pool -_081BC1E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _081BC466 - .pool -_081BC1F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _081BC466 - .pool -_081BC208: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _081BC466 - .pool -_081BC218: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _081BC466 - .pool -_081BC228: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _081BC46E - .pool -_081BC278: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _081BC466 - .pool -_081BC288: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _081BC466 - .pool -_081BC298: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _081BC466 - .pool -_081BC2A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _081BC466 - .pool -_081BC2B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _081BC466 - .pool -_081BC2C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _081BC466 - .pool -_081BC2D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _081BC302 - .pool -_081BC2E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _081BC3A6 - .pool -_081BC2F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_081BC302: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _081BC46E - .pool -_081BC32C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _081BC466 - .pool -_081BC33C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _081BC3A6 - .pool -_081BC34C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _081BC3A6 - .pool -_081BC35C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _081BC3A6 - .pool -_081BC36C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _081BC3A6 - .pool -_081BC37C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _081BC3A6 - .pool -_081BC38C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _081BC3A6 - .pool -_081BC39C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_081BC3A6: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _081BC46E - .pool -_081BC3BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _081BC466 - .pool -_081BC3CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _081BC466 - .pool -_081BC3DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _081BC466 - .pool -_081BC3EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _081BC466 - .pool -_081BC3FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _081BC466 - .pool -_081BC40C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _081BC466 - .pool -_081BC41C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _081BC466 - .pool -_081BC42C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _081BC466 - .pool -_081BC43C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _081BC466 - .pool -_081BC44C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _081BC466 - .pool -_081BC45C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_081BC466: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_081BC46E: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_player_pokemon - - thumb_func_start PlayerPartnerHandleGetRawMonData -PlayerPartnerHandleGetRawMonData: @ 81BC484 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleGetRawMonData - - thumb_func_start PlayerPartnerHandleSetMonData -PlayerPartnerHandleSetMonData: @ 81BC490 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _081BC4C0 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_81BC4E8 - b _081BC4DE - .pool -_081BC4C0: - ldrb r4, [r1] - movs r5, 0 -_081BC4C4: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081BC4D2 - adds r0, r5, 0 - bl sub_81BC4E8 -_081BC4D2: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _081BC4C4 -_081BC4DE: - bl PlayerPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleSetMonData - - thumb_func_start sub_81BC4E8 -sub_81BC4E8: @ 81BC4E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _081BC514 - bl _081BCEAE -_081BC514: - lsls r0, 2 - ldr r1, =_081BC52C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BC52C: - .4byte _081BC61C - .4byte _081BC7B4 - .4byte _081BC7D4 - .4byte _081BC7F4 - .4byte _081BC84C - .4byte _081BC84C - .4byte _081BC84C - .4byte _081BC84C - .4byte _081BC874 - .4byte _081BC8D8 - .4byte _081BC8D8 - .4byte _081BC8D8 - .4byte _081BC8D8 - .4byte _081BCEAE - .4byte _081BCEAE - .4byte _081BCEAE - .4byte _081BCEAE - .4byte _081BC908 - .4byte _081BC928 - .4byte _081BC948 - .4byte _081BC968 - .4byte _081BC988 - .4byte _081BC9A8 - .4byte _081BC9C8 - .4byte _081BC9E8 - .4byte _081BCA08 - .4byte _081BCA28 - .4byte _081BCA48 - .4byte _081BCA68 - .4byte _081BCA88 - .4byte _081BCAA8 - .4byte _081BCAC8 - .4byte _081BCB38 - .4byte _081BCB58 - .4byte _081BCB78 - .4byte _081BCB98 - .4byte _081BCBB8 - .4byte _081BCBD8 - .4byte _081BCBF8 - .4byte _081BCC18 - .4byte _081BCC38 - .4byte _081BCC58 - .4byte _081BCC78 - .4byte _081BCC98 - .4byte _081BCCB8 - .4byte _081BCCD8 - .4byte _081BCCF8 - .4byte _081BCD18 - .4byte _081BCD38 - .4byte _081BCD58 - .4byte _081BCD78 - .4byte _081BCD98 - .4byte _081BCDB8 - .4byte _081BCDD8 - .4byte _081BCDF8 - .4byte _081BCE18 - .4byte _081BCE38 - .4byte _081BCE58 - .4byte _081BCE78 - .4byte _081BCE98 -_081BC61C: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_081BC682: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _081BC682 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _081BCEAE - .pool -_081BC7B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _081BCEAE - .pool -_081BC7D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _081BCEAE - .pool -_081BC7F4: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_081BC80E: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _081BC80E - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _081BCEAE - .pool -_081BC84C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _081BC8F0 - .pool -_081BC874: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _081BCEAE - .pool -_081BC8D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_081BC8F0: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _081BCEAE - .pool -_081BC908: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _081BCEAE - .pool -_081BC928: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _081BCEAE - .pool -_081BC948: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _081BCEAE - .pool -_081BC968: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _081BCEAE - .pool -_081BC988: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _081BCEAE - .pool -_081BC9A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _081BCEAE - .pool -_081BC9C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _081BCEAE - .pool -_081BC9E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _081BCEAE - .pool -_081BCA08: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _081BCEAE - .pool -_081BCA28: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _081BCEAE - .pool -_081BCA48: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _081BCEAE - .pool -_081BCA68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _081BCEAE - .pool -_081BCA88: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _081BCEAE - .pool -_081BCAA8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _081BCEAE - .pool -_081BCAC8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _081BCBE8 - .pool -_081BCB38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _081BCEAE - .pool -_081BCB58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _081BCEAE - .pool -_081BCB78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _081BCEAE - .pool -_081BCB98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _081BCEAE - .pool -_081BCBB8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _081BCEAE - .pool -_081BCBD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_081BCBE8: - movs r1, 0x2C - bl SetMonData - b _081BCEAE - .pool -_081BCBF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _081BCEAE - .pool -_081BCC18: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _081BCEAE - .pool -_081BCC38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _081BCEAE - .pool -_081BCC58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _081BCEAE - .pool -_081BCC78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _081BCEAE - .pool -_081BCC98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _081BCEAE - .pool -_081BCCB8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _081BCEAE - .pool -_081BCCD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _081BCEAE - .pool -_081BCCF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _081BCEAE - .pool -_081BCD18: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _081BCEAE - .pool -_081BCD38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _081BCEAE - .pool -_081BCD58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _081BCEAE - .pool -_081BCD78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _081BCEAE - .pool -_081BCD98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _081BCEAE - .pool -_081BCDB8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _081BCEAE - .pool -_081BCDD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _081BCEAE - .pool -_081BCDF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _081BCEAE - .pool -_081BCE18: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _081BCEAE - .pool -_081BCE38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _081BCEAE - .pool -_081BCE58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _081BCEAE - .pool -_081BCE78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _081BCEAE - .pool -_081BCE98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_081BCEAE: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - 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 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BC4E8 - - thumb_func_start PlayerPartnerHandleSetRawMonData -PlayerPartnerHandleSetRawMonData: @ 81BCEE4 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _081BCF3C - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_081BCF1A: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _081BCF1A -_081BCF3C: - bl PlayerPartnerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleSetRawMonData - - thumb_func_start PlayerPartnerHandleLoadMonSprite -PlayerPartnerHandleLoadMonSprite: @ 81BCF58 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB1D4 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleLoadMonSprite - - thumb_func_start PlayerPartnerHandleSwitchInAnim -PlayerPartnerHandleSwitchInAnim: @ 81BD074 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl ClearTemporarySpeciesSpriteData - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - strh r0, [r1] - 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 BattleLoadPlayerMonSpriteGfx - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_81BD0E4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BBAE8 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleSwitchInAnim - - thumb_func_start sub_81BD0E4 -sub_81BD0E4: @ 81BD0E4 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl ClearTemporarySpeciesSpriteData - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD0E4 - - thumb_func_start PlayerPartnerHandleReturnMonToBall -PlayerPartnerHandleReturnMonToBall: @ 81BD260 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _081BD2A8 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BD2F0 - str r1, [r0] - b _081BD2DE - .pool -_081BD2A8: - 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 PlayerPartnerBufferExecCompleted -_081BD2DE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleReturnMonToBall - - thumb_func_start sub_81BD2F0 -sub_81BD2F0: @ 81BD2F0 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _081BD318 - cmp r0, 0x1 - beq _081BD346 - b _081BD36E - .pool -_081BD318: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081BD332 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_081BD332: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _081BD36E -_081BD346: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081BD36E - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB828 - str r1, [r0] -_081BD36E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD2F0 - - thumb_func_start PlayerPartnerHandleDrawTrainerPic -PlayerPartnerHandleDrawTrainerPic: @ 81BD37C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r2, =gPartnerTrainerId - ldrh r1, [r2] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _081BD3A8 - movs r4, 0x7 - movs r0, 0x5A - mov r9, r0 - ldr r0, =gTrainerBackPicCoords - ldrb r1, [r0, 0x1C] - b _081BD3BE - .pool -_081BD3A8: - ldrh r0, [r2] - bl sub_8162AA0 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x20 - mov r9, r0 - ldr r1, =gTrainerFrontPicCoords - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] -_081BD3BE: - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 - ldr r0, =gPartnerTrainerId - ldrh r1, [r0] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _081BD494 - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl DecompressTrainerBackPic - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r9 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - b _081BD57C - .pool -_081BD494: - adds r5, r4, 0 - ldr r6, =gActiveBank - ldrb r1, [r6] - adds r0, r5, 0 - bl DecompressTrainerFrontPic - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_806A1C0 - ldr r0, =gUnknown_0202499C - mov r8, r0 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r0, =gTrainerFrontPicPaletteTable - lsls r5, 3 - adds r5, r0 - ldrh r0, [r5, 0x4] - bl IndexOfSpritePaletteTag - ldr r5, =gSprites - ldrb r1, [r6] - adds r1, r4 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x30 - strh r1, [r0, 0x26] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_805D7AC - str r1, [r0] - ldrb r0, [r6] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] -_081BD57C: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAE60 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleDrawTrainerPic - - thumb_func_start PlayerPartnerHandleTrainerSlide -PlayerPartnerHandleTrainerSlide: @ 81BD5BC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleTrainerSlide - - thumb_func_start PlayerPartnerHandleTrainerSlideBack -PlayerPartnerHandleTrainerSlideBack: @ 81BD5C8 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAE98 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleTrainerSlideBack - - thumb_func_start PlayerPartnerHandleFaintAnimation -PlayerPartnerHandleFaintAnimation: @ 81BD674 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _081BD6C8 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081BD6A8 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_081BD6A8: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _081BD73E - .pool -_081BD6C8: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081BD73E - strb r4, [r3, 0x4] - 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 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB78C - str r1, [r0] -_081BD73E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleFaintAnimation - - thumb_func_start PlayerPartnerHandlePaletteFade -PlayerPartnerHandlePaletteFade: @ 81BD760 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandlePaletteFade - - thumb_func_start PlayerPartnerHandleSuccessBallThrowAnim -PlayerPartnerHandleSuccessBallThrowAnim: @ 81BD76C - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleSuccessBallThrowAnim - - thumb_func_start PlayerPartnerHandleBallThrowAnim -PlayerPartnerHandleBallThrowAnim: @ 81BD778 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleBallThrowAnim - - thumb_func_start PlayerPartnerHandlePause -PlayerPartnerHandlePause: @ 81BD784 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandlePause - - thumb_func_start PlayerPartnerHandleMoveAnimation -PlayerPartnerHandleMoveAnimation: @ 81BD790 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _081BD7A2 - b _081BD8B6 -_081BD7A2: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gTransformedPersonalities - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _081BD898 - bl PlayerPartnerBufferExecCompleted - b _081BD8B6 - .pool -_081BD898: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_3 - str r1, [r0] -_081BD8B6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleMoveAnimation - - thumb_func_start bx_move_anim_3 -bx_move_anim_3: @ 81BD8C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _081BD960 - cmp r2, 0x1 - bgt _081BD920 - cmp r2, 0 - beq _081BD92A - b _081BDA3C - .pool -_081BD920: - cmp r2, 0x2 - beq _081BD98A - cmp r2, 0x3 - beq _081BDA00 - b _081BDA3C -_081BD92A: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _081BD94C - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_081BD94C: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _081BDA3C -_081BD960: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BDA3C - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _081BDA3C -_081BD98A: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _081BDA3C - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _081BD9D8 - mov r0, r8 - cmp r0, 0x1 - bhi _081BD9D8 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_081BD9D8: - 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 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _081BDA3C - .pool -_081BDA00: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081BDA3C - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl PlayerPartnerBufferExecCompleted -_081BDA3C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_3 - - thumb_func_start PlayerPartnerHandlePrintString -PlayerPartnerHandlePrintString: @ 81BDA4C - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB898 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandlePrintString - - thumb_func_start PlayerPartnerHandlePrintStringPlayerOnly -PlayerPartnerHandlePrintStringPlayerOnly: @ 81BDAA0 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandlePrintStringPlayerOnly - - thumb_func_start PlayerPartnerHandleChooseAction -PlayerPartnerHandleChooseAction: @ 81BDAAC - push {lr} - bl AI_TrySwitchOrUseItem - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleChooseAction - - thumb_func_start PlayerPartnerHandleUnknownYesNoBox -PlayerPartnerHandleUnknownYesNoBox: @ 81BDABC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleUnknownYesNoBox - - thumb_func_start PlayerPartnerHandleChooseMove -PlayerPartnerHandleChooseMove: @ 81BDAC8 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r4, [r6] - lsls r4, 9 - ldr r0, =gBattleBufferA + 4 - adds r4, r0 - movs r0, 0xF - bl BattleAI_SetupAIData - bl BattleAI_ChooseMoveOrAction - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, =gBattleMoves - lsls r0, r5, 1 - adds r4, r0 - ldrh r1, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x6] - movs r0, 0x12 - ands r0, r1 - cmp r0, 0 - beq _081BDB02 - ldr r1, =gBankTarget - ldrb r0, [r6] - strb r0, [r1] -_081BDB02: - ldrh r1, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x6] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081BDB3C - movs r0, 0x1 - bl GetBankByIdentity - ldr r4, =gBankTarget - strb r0, [r4] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _081BDB3C - movs r0, 0x3 - bl GetBankByIdentity - strb r0, [r4] -_081BDB3C: - ldr r0, =gBankTarget - ldrb r2, [r0] - lsls r2, 8 - orrs r2, r5 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues - bl PlayerPartnerBufferExecCompleted - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleChooseMove - - thumb_func_start PlayerPartnerHandleChooseItem -PlayerPartnerHandleChooseItem: @ 81BDB70 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleChooseItem - - thumb_func_start PlayerPartnerHandleChoosePokemon -PlayerPartnerHandleChoosePokemon: @ 81BDB7C - push {r4-r6,lr} - bl GetMostSuitableMonToSwitchInto - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bne _081BDBD0 - movs r0, 0 - bl GetBankByIdentity - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0x2 - bl GetBankByIdentity - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0x3 - b _081BDBA4 -_081BDBA2: - adds r4, 0x1 -_081BDBA4: - cmp r4, 0x5 - bgt _081BDBD0 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _081BDBA2 - ldr r1, =gBattlePartyID - lsls r0, r6, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _081BDBA2 - lsls r0, r5, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _081BDBA2 -_081BDBD0: - ldr r0, =gActiveBank - ldrb r0, [r0] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - adds r0, 0x5C - strb r4, [r0] - lsls r1, r4, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitChosenMonReturnValue - bl PlayerPartnerBufferExecCompleted - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleChoosePokemon - - thumb_func_start PlayerPartnerHandleCmd23 -PlayerPartnerHandleCmd23: @ 81BDC04 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleCmd23 - - thumb_func_start PlayerPartnerHandleHealthBarUpdate -PlayerPartnerHandleHealthBarUpdate: @ 81BDC10 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _081BDCA0 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _081BDCCA - .pool -_081BDCA0: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_081BDCCA: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t3_healthbar_update - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleHealthBarUpdate - - thumb_func_start PlayerPartnerHandleExpUpdate -PlayerPartnerHandleExpUpdate: @ 81BDD00 - push {r4-r7,lr} - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 9 - adds r1, r5, 0x1 - adds r0, r1 - ldrb r7, [r0] - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - cmp r0, 0x63 - bls _081BDD38 - bl PlayerPartnerBufferExecCompleted - b _081BDD84 - .pool -_081BDD38: - movs r0, 0x1 - bl LoadBattleBarGfx - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - ldrb r1, [r6] - lsls r1, 9 - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r0, r5, 0x3 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - ldr r0, =sub_81BB29C - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r7, [r1, 0x8] - strh r4, [r1, 0xA] - ldrb r0, [r6] - strh r0, [r1, 0xC] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] -_081BDD84: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleExpUpdate - - thumb_func_start PlayerPartnerHandleStatusIconUpdate -PlayerPartnerHandleStatusIconUpdate: @ 81BDD9C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081BDDF0 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - 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, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BBC04 - str r1, [r0] -_081BDDF0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleStatusIconUpdate - - thumb_func_start PlayerPartnerHandleStatusAnimation -PlayerPartnerHandleStatusAnimation: @ 81BDE14 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081BDE64 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl DoStatusAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BBC04 - str r1, [r0] -_081BDE64: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleStatusAnimation - - thumb_func_start PlayerPartnerHandleStatusXor -PlayerPartnerHandleStatusXor: @ 81BDE7C - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleStatusXor - - thumb_func_start PlayerPartnerHandleDataTransfer -PlayerPartnerHandleDataTransfer: @ 81BDE88 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleDataTransfer - - thumb_func_start PlayerPartnerHandleDMA3Transfer -PlayerPartnerHandleDMA3Transfer: @ 81BDE94 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleDMA3Transfer - - thumb_func_start PlayerPartnerHandlePlayBGM -PlayerPartnerHandlePlayBGM: @ 81BDEA0 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandlePlayBGM - - thumb_func_start PlayerPartnerHandleCmd32 -PlayerPartnerHandleCmd32: @ 81BDEAC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleCmd32 - - thumb_func_start PlayerPartnerHandleTwoReturnValues -PlayerPartnerHandleTwoReturnValues: @ 81BDEB8 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleTwoReturnValues - - thumb_func_start PlayerPartnerHandleChosenMonReturnValue -PlayerPartnerHandleChosenMonReturnValue: @ 81BDEC4 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleChosenMonReturnValue - - thumb_func_start PlayerPartnerHandleOneReturnValue -PlayerPartnerHandleOneReturnValue: @ 81BDED0 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleOneReturnValue - - thumb_func_start PlayerPartnerHandleOneReturnValue_Duplicate -PlayerPartnerHandleOneReturnValue_Duplicate: @ 81BDEDC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleOneReturnValue_Duplicate - - thumb_func_start PlayerPartnerHandleCmd37 -PlayerPartnerHandleCmd37: @ 81BDEE8 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleCmd37 - - thumb_func_start PlayerPartnerHandleCmd38 -PlayerPartnerHandleCmd38: @ 81BDF04 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleCmd38 - - thumb_func_start PlayerPartnerHandleCmd39 -PlayerPartnerHandleCmd39: @ 81BDF3C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleCmd39 - - thumb_func_start PlayerPartnerHandleCmd40 -PlayerPartnerHandleCmd40: @ 81BDF54 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleCmd40 - - thumb_func_start PlayerPartnerHandleHitAnimation -PlayerPartnerHandleHitAnimation: @ 81BDF7C - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _081BDFB0 - bl PlayerPartnerBufferExecCompleted - b _081BDFDA - .pool -_081BDFB0: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t3 - str r1, [r0] -_081BDFDA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleHitAnimation - - thumb_func_start PlayerPartnerHandleCmd42 -PlayerPartnerHandleCmd42: @ 81BDFEC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleCmd42 - - thumb_func_start PlayerPartnerHandleEffectivenessSound -PlayerPartnerHandleEffectivenessSound: @ 81BDFF8 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _081BE00C - movs r3, 0xC0 -_081BE00C: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl PlayerPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleEffectivenessSound - - thumb_func_start PlayerPartnerHandlePlayFanfareOrBGM -PlayerPartnerHandlePlayFanfareOrBGM: @ 81BE03C - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _081BE078 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _081BE08C - .pool -_081BE078: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_081BE08C: - bl PlayerPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandlePlayFanfareOrBGM - - thumb_func_start PlayerPartnerHandleFaintingCry -PlayerPartnerHandleFaintingCry: @ 81BE098 - push {lr} - 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, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleFaintingCry - - thumb_func_start PlayerPartnerHandleIntroSlide -PlayerPartnerHandleIntroSlide: @ 81BE0D8 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleIntroSlide - - thumb_func_start PlayerPartnerHandleIntroTrainerBallThrow -PlayerPartnerHandleIntroTrainerBallThrow: @ 81BE10C - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r5] - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x38] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f9 - bl AllocSpritePalette - lsls r0, 24 - lsrs r4, r0, 24 - ldr r2, =gPartnerTrainerId - ldrh r1, [r2] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _081BE1FC - ldr r0, =gTrainerBackPicPaletteTable - ldr r0, [r0, 0x38] - lsls r4, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - b _081BE21A - .pool -_081BE1FC: - ldrh r0, [r2] - bl sub_8162AA0 - lsls r0, 24 - ldr r1, =gTrainerFrontPicPaletteTable - lsrs r0, 21 - adds r0, r1 - ldr r0, [r0] - lsls r4, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette -_081BE21A: - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_81BE2C8 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r5] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081BE27E - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_081BE27E: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_77 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleIntroTrainerBallThrow - - thumb_func_start sub_81BE2C8 -sub_81BE2C8: @ 81BE2C8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x17 - bgt _081BE2F4 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _081BE3B0 - .pool -_081BE2F4: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BE314 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081BE344 -_081BE314: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_81BD0E4 - b _081BE398 - .pool -_081BE344: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_81BD0E4 - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_81BD0E4 - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_081BE398: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB02C - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_081BE3B0: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE2C8 - - thumb_func_start PlayerPartnerHandleDrawPartyStatusSummary -PlayerPartnerHandleDrawPartyStatusSummary: @ 81BE3D4 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081BE404 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _081BE404 - bl PlayerPartnerBufferExecCompleted - b _081BE478 - .pool -_081BE404: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _081BE46C - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_081BE46C: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81BE498 - str r0, [r1] -_081BE478: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleDrawPartyStatusSummary - - thumb_func_start sub_81BE498 -sub_81BE498: @ 81BE498 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _081BE4D0 - 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, 0x5] - bl PlayerPartnerBufferExecCompleted -_081BE4D0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE498 - - thumb_func_start PlayerPartnerHandleCmd49 -PlayerPartnerHandleCmd49: @ 81BE4E0 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081BE512 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_081BE512: - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleCmd49 - - thumb_func_start PlayerPartnerHandleCmd50 -PlayerPartnerHandleCmd50: @ 81BE530 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleCmd50 - - thumb_func_start PlayerPartnerHandleSpriteInvisibility -PlayerPartnerHandleSpriteInvisibility: @ 81BE53C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _081BE582 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility -_081BE582: - bl PlayerPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleSpriteInvisibility - - thumb_func_start PlayerPartnerHandleBattleAnimation -PlayerPartnerHandleBattleAnimation: @ 81BE59C - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081BE5F4 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _081BE5E8 - bl PlayerPartnerBufferExecCompleted - b _081BE5F4 - .pool -_081BE5E8: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_80E8A6C - str r0, [r1] -_081BE5F4: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleBattleAnimation - - thumb_func_start PlayerPartnerHandleLinkStandbyMsg -PlayerPartnerHandleLinkStandbyMsg: @ 81BE604 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleLinkStandbyMsg - - thumb_func_start PlayerPartnerHandleResetActionMoveSelection -PlayerPartnerHandleResetActionMoveSelection: @ 81BE610 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end PlayerPartnerHandleResetActionMoveSelection - - thumb_func_start PlayerPartnerHandleCmd55 -PlayerPartnerHandleCmd55: @ 81BE61C - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl PlayerPartnerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerHandleCmd55 - - thumb_func_start nullsub_128 -nullsub_128: @ 81BE668 - bx lr - thumb_func_end nullsub_128 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 0f5477e88..695c179e5 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -4045,7 +4045,7 @@ _081888D8: ldr r0, =gTrainerBattleOpponent_B _081888DA: ldrh r0, [r0] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId lsls r0, 24 lsrs r0, 24 b _0818892C diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index 799e93e4f..978dd30fa 100755 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -6971,7 +6971,7 @@ _08192598: .pool _081925AC: ldr r0, [sp, 0x24] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId _081925B2: lsls r0, 24 lsrs r0, 24 @@ -8554,7 +8554,7 @@ _081932D4: _081932E4: lsls r0, r1, 16 lsrs r0, 16 - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId _081932EC: lsls r0, 24 lsrs r0, 24 @@ -8642,7 +8642,7 @@ _08193388: _081933A4: lsls r0, r1, 16 lsrs r0, 16 - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId lsls r0, 24 lsrs r0, 24 _081933B0: diff --git a/asm/battle_tower.s b/asm/battle_tower.s index 74c84e34c..2b220cb56 100755 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -1329,8 +1329,8 @@ _08162A8A: .pool thumb_func_end sub_81628A0 - thumb_func_start sub_8162AA0 -sub_8162AA0: @ 8162AA0 + thumb_func_start GetFrontierTrainerFrontSpriteId +GetFrontierTrainerFrontSpriteId: @ 8162AA0 push {r4,r5,lr} lsls r0, 16 lsrs r4, r0, 16 @@ -1454,7 +1454,7 @@ _08162BCA: pop {r1} bx r1 .pool - thumb_func_end sub_8162AA0 + thumb_func_end GetFrontierTrainerFrontSpriteId thumb_func_start GetFrontierOpponentClass GetFrontierOpponentClass: @ 8162BD8 diff --git a/ld_script.txt b/ld_script.txt index 6a7f362c4..92f324acd 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -254,7 +254,6 @@ SECTIONS { src/multiboot.o(.text); asm/unk_81BAD84.o(.text); src/battle_controller_player_partner.o(.text); - asm/battle_controller_player_partner.o(.text); asm/fldeff_groundshake.o(.text); asm/fossil_specials.o(.text); src/berry_fix_program.o(.text); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 009de472f..b7479c3cc 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -4,6 +4,7 @@ #include "battle_message.h" #include "battle_interface.h" #include "battle_anim.h" +#include "battle_ai_script_commands.h" #include "pokemon.h" #include "link.h" #include "util.h" @@ -15,6 +16,7 @@ #include "palette.h" #include "task.h" #include "text.h" +#include "string_util.h" #include "bg.h" #include "reshow_battle_screen.h" #include "pokeball.h" @@ -39,74 +41,101 @@ extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; extern u8 gBankInMenu; extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; extern void sub_81358F4(void); +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); // this file's functions -void PlayerPartnerHandleGetMonData(void); -void PlayerPartnerHandleGetRawMonData(void); -void PlayerPartnerHandleSetMonData(void); -void PlayerPartnerHandleSetRawMonData(void); -void PlayerPartnerHandleLoadMonSprite(void); -void PlayerPartnerHandleSwitchInAnim(void); -void PlayerPartnerHandleReturnMonToBall(void); -void PlayerPartnerHandleDrawTrainerPic(void); -void PlayerPartnerHandleTrainerSlide(void); -void PlayerPartnerHandleTrainerSlideBack(void); -void PlayerPartnerHandleFaintAnimation(void); -void PlayerPartnerHandlePaletteFade(void); -void PlayerPartnerHandleSuccessBallThrowAnim(void); -void PlayerPartnerHandleBallThrowAnim(void); -void PlayerPartnerHandlePause(void); -void PlayerPartnerHandleMoveAnimation(void); -void PlayerPartnerHandlePrintString(void); -void PlayerPartnerHandlePrintStringPlayerOnly(void); -void PlayerPartnerHandleChooseAction(void); -void PlayerPartnerHandleUnknownYesNoBox(void); -void PlayerPartnerHandleChooseMove(void); -void PlayerPartnerHandleChooseItem(void); -void PlayerPartnerHandleChoosePokemon(void); -void PlayerPartnerHandleCmd23(void); -void PlayerPartnerHandleHealthBarUpdate(void); -void PlayerPartnerHandleExpUpdate(void); -void PlayerPartnerHandleStatusIconUpdate(void); -void PlayerPartnerHandleStatusAnimation(void); -void PlayerPartnerHandleStatusXor(void); -void PlayerPartnerHandleDataTransfer(void); -void PlayerPartnerHandleDMA3Transfer(void); -void PlayerPartnerHandlePlayBGM(void); -void PlayerPartnerHandleCmd32(void); -void PlayerPartnerHandleTwoReturnValues(void); -void PlayerPartnerHandleChosenMonReturnValue(void); -void PlayerPartnerHandleOneReturnValue(void); -void PlayerPartnerHandleOneReturnValue_Duplicate(void); -void PlayerPartnerHandleCmd37(void); -void PlayerPartnerHandleCmd38(void); -void PlayerPartnerHandleCmd39(void); -void PlayerPartnerHandleCmd40(void); -void PlayerPartnerHandleHitAnimation(void); -void PlayerPartnerHandleCmd42(void); -void PlayerPartnerHandleEffectivenessSound(void); -void PlayerPartnerHandlePlayFanfareOrBGM(void); -void PlayerPartnerHandleFaintingCry(void); -void PlayerPartnerHandleIntroSlide(void); -void PlayerPartnerHandleIntroTrainerBallThrow(void); -void PlayerPartnerHandleDrawPartyStatusSummary(void); -void PlayerPartnerHandleCmd49(void); -void PlayerPartnerHandleCmd50(void); -void PlayerPartnerHandleSpriteInvisibility(void); -void PlayerPartnerHandleBattleAnimation(void); -void PlayerPartnerHandleLinkStandbyMsg(void); -void PlayerPartnerHandleResetActionMoveSelection(void); -void PlayerPartnerHandleCmd55(void); -void nullsub_128(void); +static void PlayerPartnerHandleGetMonData(void); +static void PlayerPartnerHandleGetRawMonData(void); +static void PlayerPartnerHandleSetMonData(void); +static void PlayerPartnerHandleSetRawMonData(void); +static void PlayerPartnerHandleLoadMonSprite(void); +static void PlayerPartnerHandleSwitchInAnim(void); +static void PlayerPartnerHandleReturnMonToBall(void); +static void PlayerPartnerHandleDrawTrainerPic(void); +static void PlayerPartnerHandleTrainerSlide(void); +static void PlayerPartnerHandleTrainerSlideBack(void); +static void PlayerPartnerHandleFaintAnimation(void); +static void PlayerPartnerHandlePaletteFade(void); +static void PlayerPartnerHandleSuccessBallThrowAnim(void); +static void PlayerPartnerHandleBallThrowAnim(void); +static void PlayerPartnerHandlePause(void); +static void PlayerPartnerHandleMoveAnimation(void); +static void PlayerPartnerHandlePrintString(void); +static void PlayerPartnerHandlePrintStringPlayerOnly(void); +static void PlayerPartnerHandleChooseAction(void); +static void PlayerPartnerHandleUnknownYesNoBox(void); +static void PlayerPartnerHandleChooseMove(void); +static void PlayerPartnerHandleChooseItem(void); +static void PlayerPartnerHandleChoosePokemon(void); +static void PlayerPartnerHandleCmd23(void); +static void PlayerPartnerHandleHealthBarUpdate(void); +static void PlayerPartnerHandleExpUpdate(void); +static void PlayerPartnerHandleStatusIconUpdate(void); +static void PlayerPartnerHandleStatusAnimation(void); +static void PlayerPartnerHandleStatusXor(void); +static void PlayerPartnerHandleDataTransfer(void); +static void PlayerPartnerHandleDMA3Transfer(void); +static void PlayerPartnerHandlePlayBGM(void); +static void PlayerPartnerHandleCmd32(void); +static void PlayerPartnerHandleTwoReturnValues(void); +static void PlayerPartnerHandleChosenMonReturnValue(void); +static void PlayerPartnerHandleOneReturnValue(void); +static void PlayerPartnerHandleOneReturnValue_Duplicate(void); +static void PlayerPartnerHandleCmd37(void); +static void PlayerPartnerHandleCmd38(void); +static void PlayerPartnerHandleCmd39(void); +static void PlayerPartnerHandleCmd40(void); +static void PlayerPartnerHandleHitAnimation(void); +static void PlayerPartnerHandleCmd42(void); +static void PlayerPartnerHandleEffectivenessSound(void); +static void PlayerPartnerHandlePlayFanfareOrBGM(void); +static void PlayerPartnerHandleFaintingCry(void); +static void PlayerPartnerHandleIntroSlide(void); +static void PlayerPartnerHandleIntroTrainerBallThrow(void); +static void PlayerPartnerHandleDrawPartyStatusSummary(void); +static void PlayerPartnerHandleCmd49(void); +static void PlayerPartnerHandleCmd50(void); +static void PlayerPartnerHandleSpriteInvisibility(void); +static void PlayerPartnerHandleBattleAnimation(void); +static void PlayerPartnerHandleLinkStandbyMsg(void); +static void PlayerPartnerHandleResetActionMoveSelection(void); +static void PlayerPartnerHandleCmd55(void); +static void nullsub_128(void); -void PlayerPartnerBufferRunCommand(void); -void PlayerPartnerBufferExecCompleted(void); +static void PlayerPartnerBufferRunCommand(void); +static void PlayerPartnerBufferExecCompleted(void); +static void sub_81BB628(u8 taskId); +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); +static void Task_PrepareToGiveExpWithExpBar(u8 taskId); +static void sub_81BB4E4(u8 taskId); +static void sub_81BB628(u8 taskId); +static void sub_81BB688(u8 taskId); +static void sub_81BB9A0(void); +static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst); +static void SetPlayerPartnerMonData(u8 monId); +static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void PlayerPartnerDoMoveAnimation(void); +static void sub_81BE2C8(u8 taskId); +static void sub_81BE498(void); -void (*const gPlayerPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const gPlayerPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { PlayerPartnerHandleGetMonData, PlayerPartnerHandleGetRawMonData, @@ -176,7 +205,7 @@ static const u8 gUnknown_08617254[] = 0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53, }; -void nullsub_77(void) +static void nullsub_77(void) { } @@ -185,7 +214,7 @@ void SetBankFuncToPlayerPartnerBufferRunCommand(void) gBattleBankFunc[gActiveBank] = PlayerPartnerBufferRunCommand; } -void PlayerPartnerBufferRunCommand(void) +static void PlayerPartnerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { @@ -196,3 +225,1746 @@ void PlayerPartnerBufferRunCommand(void) } } +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + PlayerPartnerBufferExecCompleted(); +} + +static void sub_81BAE98(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(0); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BAF00(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BAF48(void) +{ + bool32 r6 = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (IsCryPlayingOrClearCrySongs()) + r6 = FALSE; + + if (r6) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_81BAF00; + } +} + +static void sub_81BB02C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 != 1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + + gBattleBankFunc[gActiveBank] = sub_81BAF48; + } +} + +static void sub_81BB1D4(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].animEnded && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + PlayerPartnerBufferExecCompleted(); +} + +static void CompleteOnHealthbarDone(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); + PlayerPartnerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + PlayerPartnerBufferExecCompleted(); +} + +// the whole exp task is copied&pasted from player controller +#define tExpTask_monId data[0] +#define tExpTask_gainedExp data[1] +#define tExpTask_bank data[2] +#define tExpTask_frames data[10] + +static void Task_GiveExpToMon(u8 taskId) +{ + u32 monId = (u8)(gTasks[taskId].tExpTask_monId); + u8 bank = gTasks[taskId].tExpTask_bank; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + + if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) // give exp without the expbar + { + 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; + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + gActiveBank = savedActiveBank; + + if (IsDoubleBattle() == TRUE + && ((u16)(monId) == gBattlePartyID[bank] || (u16)(monId) == gBattlePartyID[bank ^ BIT_MON])) + gTasks[taskId].func = sub_81BB628; + else + gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + } + else + { + currExp += gainedExp; + SetMonData(mon, MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + else + { + gTasks[taskId].func = Task_PrepareToGiveExpWithExpBar; + } +} + +static void Task_PrepareToGiveExpWithExpBar(u8 taskId) +{ + u8 monIndex = gTasks[taskId].tExpTask_monId; + s32 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; + 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_81BB4E4; +} + +static void sub_81BB4E4(u8 taskId) +{ + if (gTasks[taskId].tExpTask_frames < 13) + { + gTasks[taskId].tExpTask_frames++; + } + else + { + u8 monId = gTasks[taskId].tExpTask_monId; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; + s16 r4; + + r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], EXP_BAR, 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; + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + gActiveBank = savedActiveBank; + gTasks[taskId].func = sub_81BB628; + } + else + { + currExp += gainedExp; + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + } +} + +static void sub_81BB628(u8 taskId) +{ + u8 bank = gTasks[taskId].tExpTask_bank; + u8 monIndex = gTasks[taskId].tExpTask_monId; + + if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) + bank ^= BIT_MON; + + DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP); + gTasks[taskId].func = sub_81BB688; +} + +static void sub_81BB688(u8 taskId) +{ + u8 bank = gTasks[taskId].tExpTask_bank; + + if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive) + { + u8 monIndex = gTasks[taskId].tExpTask_monId; + + 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; + } +} + +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) +{ + u8 monIndex; + u8 bank; + + monIndex = gTasks[taskId].tExpTask_monId; + GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value + bank = gTasks[taskId].tExpTask_bank; + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); +} + +static void sub_81BB78C(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]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BB828(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter2(void) +{ + if (!IsTextPrinterActive(0)) + PlayerPartnerBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + PlayerPartnerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_81BB92C(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_81BB9A0; + } +} + +static void sub_81BB9A0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BB9F4(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleBankFunc[gActiveBank] = sub_81BB92C; + } +} + +static void sub_81BBAE8(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]]); + gBattleBankFunc[gActiveBank] = sub_81BB9F4; + } +} + +static void PlayerPartnerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = PlayerPartnerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + PlayerPartnerBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyPlayerPartnerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyPlayerPartnerMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + PlayerPartnerBufferExecCompleted(); +} + +static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void PlayerPartnerHandleGetRawMonData(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetPlayerPartnerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetPlayerPartnerMonData(i); + monsToCheck >>= 1; + } + } + PlayerPartnerBufferExecCompleted(); +} + +static void SetPlayerPartnerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void PlayerPartnerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleLoadMonSprite(void) +{ + u16 species; + + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_81BB1D4; +} + +static void PlayerPartnerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_81BD0E4(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_81BBAE8; +} + +static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void PlayerPartnerHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + gBattleBankFunc[gActiveBank] = sub_81BB828; + } + break; + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +// some explanation here +// in emerald it's possible to have a tag battle in the battle frontier facilities with AI +// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it +static void PlayerPartnerHandleDrawTrainerPic(void) +{ + s16 xPos, yPos; + u32 trainerPicId; + + if (gPartnerTrainerId == STEVEN_PARTNER_ID) + { + trainerPicId = BACK_PIC_STEVEN; + xPos = 90; + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + else + { + trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId); + xPos = 32; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80; + } + + // Use back pic only if the partner is Steven + if (gPartnerTrainerId == STEVEN_PARTNER_ID) + { + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + } + else // otherwise use front sprite + { + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].pos2.y = 48; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gSprites[gBankSpriteIds[gActiveBank]].oam.affineMode = 0; + gSprites[gBankSpriteIds[gActiveBank]].hFlip = 1; + } + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void PlayerPartnerHandleTrainerSlide(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_81BAE98; +} + +static void PlayerPartnerHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlaySE12WithPanning(SE_POKE_DEAD, -64); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_81BB78C; + } + } +} + +static void PlayerPartnerHandlePaletteFade(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleSuccessBallThrowAnim(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleBallThrowAnim(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandlePause(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always return FALSE + { + PlayerPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = PlayerPartnerDoMoveAnimation; + } + } +} + +static void PlayerPartnerDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlayerPartnerBufferExecCompleted(); + } + break; + } +} + +static void PlayerPartnerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter2; +} + +static void PlayerPartnerHandlePrintStringPlayerOnly(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChooseAction(void) +{ + AI_TrySwitchOrUseItem(); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleUnknownYesNoBox(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChooseMove(void) +{ + u8 chosenMoveId; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + BattleAI_SetupAIData(0xF); + chosenMoveId = BattleAI_ChooseMoveOrAction(); + + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) + gBankTarget = gActiveBank; + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) + { + gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + if (gAbsentBankFlags & gBitTable[gBankTarget]) + gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + } + + EmitTwoReturnValues(1, 10, chosenMoveId | (gBankTarget << 8)); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChooseItem(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChoosePokemon(void) +{ + s32 chosenMonId = GetMostSuitableMonToSwitchInto(); + + if (chosenMonId == 6) // just switch to the next mon + { + u8 playerMonIdentity = GetBankByIdentity(IDENTITY_PLAYER_MON1); + u8 selfIdentity = GetBankByIdentity(IDENTITY_PLAYER_MON2); + + for (chosenMonId = 3; chosenMonId < 6; chosenMonId++) + { + if (GetMonData(&gPlayerParty[chosenMonId], MON_DATA_HP) != 0 + && chosenMonId != gBattlePartyID[playerMonIdentity] + && chosenMonId != gBattlePartyID[selfIdentity]) + { + break; + } + } + } + + *(gBattleStruct->field_5C + gActiveBank) = chosenMonId; + EmitChosenMonReturnValue(1, chosenMonId, NULL); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd23(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void PlayerPartnerHandleExpUpdate(void) +{ + u8 monId = gBattleBufferA[gActiveBank][1]; + + if (GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL) >= MAX_MON_LEVEL) + { + PlayerPartnerBufferExecCompleted(); + } + else + { + s16 expPointsToGive; + u8 taskId; + + LoadBattleBarGfx(1); + GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // unused return value + expPointsToGive = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + taskId = CreateTask(Task_GiveExpToMon, 10); + gTasks[taskId].tExpTask_monId = monId; + gTasks[taskId].tExpTask_gainedExp = expPointsToGive; + gTasks[taskId].tExpTask_bank = gActiveBank; + gBattleBankFunc[gActiveBank] = nullsub_21; + } +} + +#undef tExpTask_monId +#undef tExpTask_gainedExp +#undef tExpTask_bank +#undef tExpTask_frames + +static void PlayerPartnerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerPartnerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerPartnerHandleStatusXor(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleDataTransfer(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleDMA3Transfer(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandlePlayBGM(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd32(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleTwoReturnValues(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChosenMonReturnValue(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleOneReturnValue(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleOneReturnValue_Duplicate(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + PlayerPartnerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void PlayerPartnerHandleCmd42(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F9); + if (gPartnerTrainerId == STEVEN_PARTNER_ID) + { + u8 spriteId = BACK_PIC_STEVEN; + LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32); + } + else + { + u8 spriteId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId); + LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32); + } + + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_81BE2C8, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_77; +} + +static void sub_81BE2C8(u8 taskId) +{ + if (gTasks[taskId].data[1] < 24) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81BD0E4(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81BD0E4(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_81BD0E4(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_81BB02C; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void PlayerPartnerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + PlayerPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_81BE498; + } +} + +static void sub_81BE498(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + PlayerPartnerBufferExecCompleted(); + } +} + +static void PlayerPartnerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd50(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleSpriteInvisibility(void) +{ + if (AnimBankSpriteExists(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + PlayerPartnerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void PlayerPartnerHandleLinkStandbyMsg(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleResetActionMoveSelection(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + PlayerPartnerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_128(void) +{ +} From aa7e97945be693227c254b1e8664a6f7603d69de Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 11:24:58 +0200 Subject: [PATCH 07/29] start recorded player controller --- asm/battle_controller_recorded_player.s | 390 ++++++++++------------- data/battle_controller_recorded_player.s | 64 ---- ld_script.txt | 3 +- src/battle_controller_recorded_player.c | 204 ++++++++++++ 4 files changed, 374 insertions(+), 287 deletions(-) delete mode 100644 data/battle_controller_recorded_player.s create mode 100644 src/battle_controller_recorded_player.c diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 451b6178b..03a6ff0e7 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -5,60 +5,6 @@ .text - - thumb_func_start nullsub_120 -nullsub_120: @ 8189948 - bx lr - thumb_func_end nullsub_120 - - thumb_func_start SetBankFuncToRecordedPlayerBufferRunCommand -SetBankFuncToRecordedPlayerBufferRunCommand: @ 818994C - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedPlayerBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToRecordedPlayerBufferRunCommand - - thumb_func_start RecordedPlayerBufferRunCommand -RecordedPlayerBufferRunCommand: @ 8189968 - 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 _081899B4 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _081899B0 - ldr r0, =gRecordedPlayerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _081899B4 - .pool -_081899B0: - bl RecordedPlayerBufferExecCompleted -_081899B4: - pop {r0} - bx r0 - thumb_func_end RecordedPlayerBufferRunCommand - thumb_func_start sub_81899B8 sub_81899B8: @ 81899B8 push {lr} @@ -1442,8 +1388,8 @@ _0818A5DE: .pool thumb_func_end sub_818A5BC - thumb_func_start sub_818A5EC -sub_818A5EC: @ 818A5EC + thumb_func_start RecordedPlayerHandleGetMonData +RecordedPlayerHandleGetMonData: @ 818A5EC push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -1495,7 +1441,7 @@ _0818A646: pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_818A5EC + thumb_func_end RecordedPlayerHandleGetMonData thumb_func_start sub_818A660 sub_818A660: @ 818A660 @@ -2375,16 +2321,16 @@ _0818ADF6: .pool thumb_func_end sub_818A660 - thumb_func_start sub_818AE0C -sub_818AE0C: @ 818AE0C + thumb_func_start RecordedPlayerHandleGetRawMonData +RecordedPlayerHandleGetRawMonData: @ 818AE0C push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818AE0C + thumb_func_end RecordedPlayerHandleGetRawMonData - thumb_func_start sub_818AE18 -sub_818AE18: @ 818AE18 + thumb_func_start RecordedPlayerHandleSetMonData +RecordedPlayerHandleSetMonData: @ 818AE18 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -2424,7 +2370,7 @@ _0818AE66: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_818AE18 + thumb_func_end RecordedPlayerHandleSetMonData thumb_func_start sub_818AE70 sub_818AE70: @ 818AE70 @@ -3459,8 +3405,8 @@ _0818B836: .pool thumb_func_end sub_818AE70 - thumb_func_start sub_818B86C -sub_818B86C: @ 818B86C + thumb_func_start RecordedPlayerHandleSetRawMonData +RecordedPlayerHandleSetRawMonData: @ 818B86C push {r4-r7,lr} ldr r1, =gBattlePartyID ldr r7, =gActiveBank @@ -3512,10 +3458,10 @@ _0818B8C4: pop {r0} bx r0 .pool - thumb_func_end sub_818B86C + thumb_func_end RecordedPlayerHandleSetRawMonData - thumb_func_start sub_818B8E0 -sub_818B8E0: @ 818B8E0 + thumb_func_start RecordedPlayerHandleLoadMonSprite +RecordedPlayerHandleLoadMonSprite: @ 818B8E0 push {r4-r6,lr} mov r6, r8 push {r6} @@ -3629,10 +3575,10 @@ sub_818B8E0: @ 818B8E0 pop {r0} bx r0 .pool - thumb_func_end sub_818B8E0 + thumb_func_end RecordedPlayerHandleLoadMonSprite - thumb_func_start sub_818B9FC -sub_818B9FC: @ 818B9FC + thumb_func_start RecordedPlayerHandleSwitchInAnim +RecordedPlayerHandleSwitchInAnim: @ 818B9FC push {r4-r6,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -3675,7 +3621,7 @@ sub_818B9FC: @ 818B9FC pop {r0} bx r0 .pool - thumb_func_end sub_818B9FC + thumb_func_end RecordedPlayerHandleSwitchInAnim thumb_func_start sub_818BA6C sub_818BA6C: @ 818BA6C @@ -3840,8 +3786,8 @@ sub_818BA6C: @ 818BA6C .pool thumb_func_end sub_818BA6C - thumb_func_start sub_818BBE8 -sub_818BBE8: @ 818BBE8 + thumb_func_start RecordedPlayerHandleReturnMonToBall +RecordedPlayerHandleReturnMonToBall: @ 818BBE8 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r6, =gActiveBank @@ -3897,7 +3843,7 @@ _0818BC66: pop {r0} bx r0 .pool - thumb_func_end sub_818BBE8 + thumb_func_end RecordedPlayerHandleReturnMonToBall thumb_func_start sub_818BC78 sub_818BC78: @ 818BC78 @@ -3969,8 +3915,8 @@ _0818BCF6: .pool thumb_func_end sub_818BC78 - thumb_func_start sub_818BD04 -sub_818BD04: @ 818BD04 + thumb_func_start RecordedPlayerHandleDrawTrainerPic +RecordedPlayerHandleDrawTrainerPic: @ 818BD04 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -4264,18 +4210,18 @@ _0818BF72: pop {r0} bx r0 .pool - thumb_func_end sub_818BD04 + thumb_func_end RecordedPlayerHandleDrawTrainerPic - thumb_func_start sub_818BFAC -sub_818BFAC: @ 818BFAC + thumb_func_start RecordedPlayerHandleTrainerSlide +RecordedPlayerHandleTrainerSlide: @ 818BFAC push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818BFAC + thumb_func_end RecordedPlayerHandleTrainerSlide - thumb_func_start sub_818BFB8 -sub_818BFB8: @ 818BFB8 + thumb_func_start RecordedPlayerHandleTrainerSlideBack +RecordedPlayerHandleTrainerSlideBack: @ 818BFB8 push {r4-r6,lr} ldr r6, =gBankSpriteIds ldr r4, =gActiveBank @@ -4345,10 +4291,10 @@ sub_818BFB8: @ 818BFB8 pop {r0} bx r0 .pool - thumb_func_end sub_818BFB8 + thumb_func_end RecordedPlayerHandleTrainerSlideBack - thumb_func_start sub_818C064 -sub_818C064: @ 818C064 + thumb_func_start RecordedPlayerHandleFaintAnimation +RecordedPlayerHandleFaintAnimation: @ 818C064 push {r4-r6,lr} ldr r6, =gBattleSpritesDataPtr ldr r4, [r6] @@ -4450,42 +4396,42 @@ _0818C12E: pop {r0} bx r0 .pool - thumb_func_end sub_818C064 + thumb_func_end RecordedPlayerHandleFaintAnimation - thumb_func_start sub_818C150 -sub_818C150: @ 818C150 + thumb_func_start RecordedPlayerHandlePaletteFade +RecordedPlayerHandlePaletteFade: @ 818C150 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C150 + thumb_func_end RecordedPlayerHandlePaletteFade - thumb_func_start sub_818C15C -sub_818C15C: @ 818C15C + thumb_func_start RecordedPlayerHandleSuccessBallThrowAnim +RecordedPlayerHandleSuccessBallThrowAnim: @ 818C15C push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C15C + thumb_func_end RecordedPlayerHandleSuccessBallThrowAnim - thumb_func_start sub_818C168 -sub_818C168: @ 818C168 + thumb_func_start RecordedPlayerHandleBallThrowAnim +RecordedPlayerHandleBallThrowAnim: @ 818C168 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C168 + thumb_func_end RecordedPlayerHandleBallThrowAnim - thumb_func_start sub_818C174 -sub_818C174: @ 818C174 + thumb_func_start RecordedPlayerHandlePause +RecordedPlayerHandlePause: @ 818C174 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C174 + thumb_func_end RecordedPlayerHandlePause - thumb_func_start sub_818C180 -sub_818C180: @ 818C180 + thumb_func_start RecordedPlayerHandleMoveAnimation +RecordedPlayerHandleMoveAnimation: @ 818C180 push {r4-r6,lr} ldr r6, =gActiveBank ldrb r0, [r6] @@ -4619,7 +4565,7 @@ _0818C2A6: pop {r0} bx r0 .pool - thumb_func_end sub_818C180 + thumb_func_end RecordedPlayerHandleMoveAnimation thumb_func_start bx_move_anim_2 bx_move_anim_2: @ 818C2B8 @@ -4805,8 +4751,8 @@ _0818C42C: bx r0 thumb_func_end bx_move_anim_2 - thumb_func_start sub_818C43C -sub_818C43C: @ 818C43C + thumb_func_start RecordedPlayerHandlePrintString +RecordedPlayerHandlePrintString: @ 818C43C push {r4,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -4833,15 +4779,15 @@ sub_818C43C: @ 818C43C pop {r0} bx r0 .pool - thumb_func_end sub_818C43C + thumb_func_end RecordedPlayerHandlePrintString - thumb_func_start sub_818C490 -sub_818C490: @ 818C490 + thumb_func_start RecordedPlayerHandlePrintStringPlayerOnly +RecordedPlayerHandlePrintStringPlayerOnly: @ 818C490 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C490 + thumb_func_end RecordedPlayerHandlePrintStringPlayerOnly thumb_func_start sub_818C49C sub_818C49C: @ 818C49C @@ -4869,8 +4815,8 @@ _0818C4C6: .pool thumb_func_end sub_818C49C - thumb_func_start sub_818C4D8 -sub_818C4D8: @ 818C4D8 + thumb_func_start RecordedPlayerHandleChooseAction +RecordedPlayerHandleChooseAction: @ 818C4D8 push {lr} ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -4903,18 +4849,18 @@ _0818C522: pop {r0} bx r0 .pool - thumb_func_end sub_818C4D8 + thumb_func_end RecordedPlayerHandleChooseAction - thumb_func_start sub_818C52C -sub_818C52C: @ 818C52C + thumb_func_start RecordedPlayerHandleUnknownYesNoBox +RecordedPlayerHandleUnknownYesNoBox: @ 818C52C push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C52C + thumb_func_end RecordedPlayerHandleUnknownYesNoBox - thumb_func_start sub_818C538 -sub_818C538: @ 818C538 + thumb_func_start RecordedPlayerHandleChooseMove +RecordedPlayerHandleChooseMove: @ 818C538 push {r4,r5,lr} ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -4954,18 +4900,18 @@ _0818C584: pop {r0} bx r0 .pool - thumb_func_end sub_818C538 + thumb_func_end RecordedPlayerHandleChooseMove - thumb_func_start sub_818C594 -sub_818C594: @ 818C594 + thumb_func_start RecordedPlayerHandleChooseItem +RecordedPlayerHandleChooseItem: @ 818C594 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C594 + thumb_func_end RecordedPlayerHandleChooseItem - thumb_func_start sub_818C5A0 -sub_818C5A0: @ 818C5A0 + thumb_func_start RecordedPlayerHandleChoosePokemon +RecordedPlayerHandleChoosePokemon: @ 818C5A0 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -4989,18 +4935,18 @@ sub_818C5A0: @ 818C5A0 pop {r0} bx r0 .pool - thumb_func_end sub_818C5A0 + thumb_func_end RecordedPlayerHandleChoosePokemon - thumb_func_start sub_818C5DC -sub_818C5DC: @ 818C5DC + thumb_func_start RecordedPlayerHandleCmd23 +RecordedPlayerHandleCmd23: @ 818C5DC push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C5DC + thumb_func_end RecordedPlayerHandleCmd23 - thumb_func_start sub_818C5E8 -sub_818C5E8: @ 818C5E8 + thumb_func_start RecordedPlayerHandleHealthBarUpdate +RecordedPlayerHandleHealthBarUpdate: @ 818C5E8 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -5100,18 +5046,18 @@ _0818C6B2: pop {r0} bx r0 .pool - thumb_func_end sub_818C5E8 + thumb_func_end RecordedPlayerHandleHealthBarUpdate - thumb_func_start sub_818C6E8 -sub_818C6E8: @ 818C6E8 + thumb_func_start RecordedPlayerHandleExpUpdate +RecordedPlayerHandleExpUpdate: @ 818C6E8 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C6E8 + thumb_func_end RecordedPlayerHandleExpUpdate - thumb_func_start sub_818C6F4 -sub_818C6F4: @ 818C6F4 + thumb_func_start RecordedPlayerHandleStatusIconUpdate +RecordedPlayerHandleStatusIconUpdate: @ 818C6F4 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5157,10 +5103,10 @@ _0818C748: pop {r0} bx r0 .pool - thumb_func_end sub_818C6F4 + thumb_func_end RecordedPlayerHandleStatusIconUpdate - thumb_func_start sub_818C76C -sub_818C76C: @ 818C76C + thumb_func_start RecordedPlayerHandleStatusAnimation +RecordedPlayerHandleStatusAnimation: @ 818C76C push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -5204,82 +5150,82 @@ _0818C7BC: pop {r0} bx r0 .pool - thumb_func_end sub_818C76C + thumb_func_end RecordedPlayerHandleStatusAnimation - thumb_func_start sub_818C7D4 -sub_818C7D4: @ 818C7D4 + thumb_func_start RecordedPlayerHandleStatusXor +RecordedPlayerHandleStatusXor: @ 818C7D4 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C7D4 + thumb_func_end RecordedPlayerHandleStatusXor - thumb_func_start sub_818C7E0 -sub_818C7E0: @ 818C7E0 + thumb_func_start RecordedPlayerHandleDataTransfer +RecordedPlayerHandleDataTransfer: @ 818C7E0 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C7E0 + thumb_func_end RecordedPlayerHandleDataTransfer - thumb_func_start sub_818C7EC -sub_818C7EC: @ 818C7EC + thumb_func_start RecordedPlayerHandleDMA3Transfer +RecordedPlayerHandleDMA3Transfer: @ 818C7EC push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C7EC + thumb_func_end RecordedPlayerHandleDMA3Transfer - thumb_func_start sub_818C7F8 -sub_818C7F8: @ 818C7F8 + thumb_func_start RecordedPlayerHandlePlayBGM +RecordedPlayerHandlePlayBGM: @ 818C7F8 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C7F8 + thumb_func_end RecordedPlayerHandlePlayBGM - thumb_func_start sub_818C804 -sub_818C804: @ 818C804 + thumb_func_start RecordedPlayerHandleCmd32 +RecordedPlayerHandleCmd32: @ 818C804 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C804 + thumb_func_end RecordedPlayerHandleCmd32 - thumb_func_start sub_818C810 -sub_818C810: @ 818C810 + thumb_func_start RecordedPlayerHandleTwoReturnValues +RecordedPlayerHandleTwoReturnValues: @ 818C810 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C810 + thumb_func_end RecordedPlayerHandleTwoReturnValues - thumb_func_start sub_818C81C -sub_818C81C: @ 818C81C + thumb_func_start RecordedPlayerHandleChosenMonReturnValue +RecordedPlayerHandleChosenMonReturnValue: @ 818C81C push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C81C + thumb_func_end RecordedPlayerHandleChosenMonReturnValue - thumb_func_start sub_818C828 -sub_818C828: @ 818C828 + thumb_func_start RecordedPlayerHandleOneReturnValue +RecordedPlayerHandleOneReturnValue: @ 818C828 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C828 + thumb_func_end RecordedPlayerHandleOneReturnValue - thumb_func_start sub_818C834 -sub_818C834: @ 818C834 + thumb_func_start RecordedPlayerHandleOneReturnValue_Duplicate +RecordedPlayerHandleOneReturnValue_Duplicate: @ 818C834 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C834 + thumb_func_end RecordedPlayerHandleOneReturnValue_Duplicate - thumb_func_start sub_818C840 -sub_818C840: @ 818C840 + thumb_func_start RecordedPlayerHandleCmd37 +RecordedPlayerHandleCmd37: @ 818C840 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5291,10 +5237,10 @@ sub_818C840: @ 818C840 pop {r0} bx r0 .pool - thumb_func_end sub_818C840 + thumb_func_end RecordedPlayerHandleCmd37 - thumb_func_start sub_818C85C -sub_818C85C: @ 818C85C + thumb_func_start RecordedPlayerHandleCmd38 +RecordedPlayerHandleCmd38: @ 818C85C push {lr} ldr r3, =gUnknown_02022D0C ldr r1, =gBattleBufferA @@ -5316,10 +5262,10 @@ sub_818C85C: @ 818C85C pop {r0} bx r0 .pool - thumb_func_end sub_818C85C + thumb_func_end RecordedPlayerHandleCmd38 - thumb_func_start sub_818C894 -sub_818C894: @ 818C894 + thumb_func_start RecordedPlayerHandleCmd39 +RecordedPlayerHandleCmd39: @ 818C894 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5330,10 +5276,10 @@ sub_818C894: @ 818C894 pop {r0} bx r0 .pool - thumb_func_end sub_818C894 + thumb_func_end RecordedPlayerHandleCmd39 - thumb_func_start sub_818C8AC -sub_818C8AC: @ 818C8AC + thumb_func_start RecordedPlayerHandleCmd40 +RecordedPlayerHandleCmd40: @ 818C8AC push {lr} ldr r3, =gUnknown_02022D0C ldr r1, [r3] @@ -5351,10 +5297,10 @@ sub_818C8AC: @ 818C8AC pop {r0} bx r0 .pool - thumb_func_end sub_818C8AC + thumb_func_end RecordedPlayerHandleCmd40 - thumb_func_start sub_818C8D4 -sub_818C8D4: @ 818C8D4 + thumb_func_start RecordedPlayerHandleHitAnimation +RecordedPlayerHandleHitAnimation: @ 818C8D4 push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -5400,18 +5346,18 @@ _0818C932: pop {r0} bx r0 .pool - thumb_func_end sub_818C8D4 + thumb_func_end RecordedPlayerHandleHitAnimation - thumb_func_start sub_818C944 -sub_818C944: @ 818C944 + thumb_func_start RecordedPlayerHandleCmd42 +RecordedPlayerHandleCmd42: @ 818C944 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818C944 + thumb_func_end RecordedPlayerHandleCmd42 - thumb_func_start sub_818C950 -sub_818C950: @ 818C950 + thumb_func_start RecordedPlayerHandleEffectivenessSound +RecordedPlayerHandleEffectivenessSound: @ 818C950 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5441,10 +5387,10 @@ _0818C964: pop {r0} bx r0 .pool - thumb_func_end sub_818C950 + thumb_func_end RecordedPlayerHandleEffectivenessSound - thumb_func_start sub_818C994 -sub_818C994: @ 818C994 + thumb_func_start RecordedPlayerHandlePlayFanfareOrBGM +RecordedPlayerHandlePlayFanfareOrBGM: @ 818C994 push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -5484,10 +5430,10 @@ _0818C9E4: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_818C994 + thumb_func_end RecordedPlayerHandlePlayFanfareOrBGM - thumb_func_start sub_818C9F0 -sub_818C9F0: @ 818C9F0 + thumb_func_start RecordedPlayerHandleFaintingCry +RecordedPlayerHandleFaintingCry: @ 818C9F0 push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -5511,10 +5457,10 @@ sub_818C9F0: @ 818C9F0 pop {r0} bx r0 .pool - thumb_func_end sub_818C9F0 + thumb_func_end RecordedPlayerHandleFaintingCry - thumb_func_start dp01t_2E_2_battle_intro -dp01t_2E_2_battle_intro: @ 818CA30 + thumb_func_start RecordedPlayerHandleIntroSlide +RecordedPlayerHandleIntroSlide: @ 818CA30 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5533,10 +5479,10 @@ dp01t_2E_2_battle_intro: @ 818CA30 pop {r0} bx r0 .pool - thumb_func_end dp01t_2E_2_battle_intro + thumb_func_end RecordedPlayerHandleIntroSlide - thumb_func_start sub_818CA64 -sub_818CA64: @ 818CA64 + thumb_func_start RecordedPlayerHandleIntroTrainerBallThrow +RecordedPlayerHandleIntroTrainerBallThrow: @ 818CA64 push {r4-r6,lr} ldr r5, =gBankSpriteIds ldr r6, =gActiveBank @@ -5715,7 +5661,7 @@ _0818CBD4: pop {r0} bx r0 .pool - thumb_func_end sub_818CA64 + thumb_func_end RecordedPlayerHandleIntroTrainerBallThrow thumb_func_start sub_818CC24 sub_818CC24: @ 818CC24 @@ -5834,8 +5780,8 @@ _0818CD0C: .pool thumb_func_end sub_818CC24 - thumb_func_start sub_818CD30 -sub_818CD30: @ 818CD30 + thumb_func_start RecordedPlayerHandleDrawPartyStatusSummary +RecordedPlayerHandleDrawPartyStatusSummary: @ 818CD30 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5918,7 +5864,7 @@ _0818CDD4: pop {r0} bx r0 .pool - thumb_func_end sub_818CD30 + thumb_func_end RecordedPlayerHandleDrawPartyStatusSummary thumb_func_start bx_increment_dp11b_field_5_till_x60_then_resume bx_increment_dp11b_field_5_till_x60_then_resume: @ 818CDF4 @@ -5956,8 +5902,8 @@ _0818CE2C: .pool thumb_func_end bx_increment_dp11b_field_5_till_x60_then_resume - thumb_func_start sub_818CE3C -sub_818CE3C: @ 818CE3C + thumb_func_start RecordedPlayerHandleCmd49 +RecordedPlayerHandleCmd49: @ 818CE3C push {lr} ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] @@ -5988,18 +5934,18 @@ _0818CE6E: pop {r0} bx r0 .pool - thumb_func_end sub_818CE3C + thumb_func_end RecordedPlayerHandleCmd49 - thumb_func_start sub_818CE8C -sub_818CE8C: @ 818CE8C + thumb_func_start RecordedPlayerHandleCmd50 +RecordedPlayerHandleCmd50: @ 818CE8C push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818CE8C + thumb_func_end RecordedPlayerHandleCmd50 - thumb_func_start sub_818CE98 -sub_818CE98: @ 818CE98 + thumb_func_start RecordedPlayerHandleSpriteInvisibility +RecordedPlayerHandleSpriteInvisibility: @ 818CE98 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -6039,10 +5985,10 @@ _0818CEDE: pop {r0} bx r0 .pool - thumb_func_end sub_818CE98 + thumb_func_end RecordedPlayerHandleSpriteInvisibility - thumb_func_start sub_818CEF8 -sub_818CEF8: @ 818CEF8 + thumb_func_start RecordedPlayerHandleBattleAnimation +RecordedPlayerHandleBattleAnimation: @ 818CEF8 push {r4-r6,lr} sub sp, 0x4 ldr r6, =gActiveBank @@ -6088,26 +6034,26 @@ _0818CF50: pop {r0} bx r0 .pool - thumb_func_end sub_818CEF8 + thumb_func_end RecordedPlayerHandleBattleAnimation - thumb_func_start sub_818CF60 -sub_818CF60: @ 818CF60 + thumb_func_start RecordedPlayerHandleLinkStandbyMsg +RecordedPlayerHandleLinkStandbyMsg: @ 818CF60 push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818CF60 + thumb_func_end RecordedPlayerHandleLinkStandbyMsg - thumb_func_start sub_818CF6C -sub_818CF6C: @ 818CF6C + thumb_func_start RecordedPlayerHandleResetActionMoveSelection +RecordedPlayerHandleResetActionMoveSelection: @ 818CF6C push {lr} bl RecordedPlayerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818CF6C + thumb_func_end RecordedPlayerHandleResetActionMoveSelection - thumb_func_start sub_818CF78 -sub_818CF78: @ 818CF78 + thumb_func_start RecordedPlayerHandleCmd55 +RecordedPlayerHandleCmd55: @ 818CF78 push {r4,lr} ldr r2, =gBattleOutcome ldr r1, =gBattleBufferA @@ -6133,7 +6079,7 @@ sub_818CF78: @ 818CF78 pop {r0} bx r0 .pool - thumb_func_end sub_818CF78 + thumb_func_end RecordedPlayerHandleCmd55 thumb_func_start nullsub_121 nullsub_121: @ 818CFC4 diff --git a/data/battle_controller_recorded_player.s b/data/battle_controller_recorded_player.s deleted file mode 100644 index 089e4dcbf..000000000 --- a/data/battle_controller_recorded_player.s +++ /dev/null @@ -1,64 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gRecordedPlayerBufferCommands:: @ 860AF74 - .4byte sub_818A5EC - .4byte sub_818AE0C - .4byte sub_818AE18 - .4byte sub_818B86C - .4byte sub_818B8E0 - .4byte sub_818B9FC - .4byte sub_818BBE8 - .4byte sub_818BD04 - .4byte sub_818BFAC - .4byte sub_818BFB8 - .4byte sub_818C064 - .4byte sub_818C150 - .4byte sub_818C15C - .4byte sub_818C168 - .4byte sub_818C174 - .4byte sub_818C180 - .4byte sub_818C43C - .4byte sub_818C490 - .4byte sub_818C4D8 - .4byte sub_818C52C - .4byte sub_818C538 - .4byte sub_818C594 - .4byte sub_818C5A0 - .4byte sub_818C5DC - .4byte sub_818C5E8 - .4byte sub_818C6E8 - .4byte sub_818C6F4 - .4byte sub_818C76C - .4byte sub_818C7D4 - .4byte sub_818C7E0 - .4byte sub_818C7EC - .4byte sub_818C7F8 - .4byte sub_818C804 - .4byte sub_818C810 - .4byte sub_818C81C - .4byte sub_818C828 - .4byte sub_818C834 - .4byte sub_818C840 - .4byte sub_818C85C - .4byte sub_818C894 - .4byte sub_818C8AC - .4byte sub_818C8D4 - .4byte sub_818C944 - .4byte sub_818C950 - .4byte sub_818C994 - .4byte sub_818C9F0 - .4byte dp01t_2E_2_battle_intro - .4byte sub_818CA64 - .4byte sub_818CD30 - .4byte sub_818CE3C - .4byte sub_818CE8C - .4byte sub_818CE98 - .4byte sub_818CEF8 - .4byte sub_818CF60 - .4byte sub_818CF6C - .4byte sub_818CF78 - .4byte nullsub_121 diff --git a/ld_script.txt b/ld_script.txt index 92f324acd..08dcabd3a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -235,6 +235,7 @@ SECTIONS { asm/pokemon_animation.o(.text); asm/recorded_battle.o(.text); asm/battle_controller_recorded_opponent.o(.text); + src/battle_controller_recorded_player.o(.text); asm/battle_controller_recorded_player.o(.text); src/battle_dome_cards.o(.text); src/lilycove_lady.o(.text); @@ -453,7 +454,7 @@ SECTIONS { data/bard_music.o(.rodata); data/data_860A4AC.o(.rodata); data/battle_controller_recorded_opponent.o(.rodata); - data/battle_controller_recorded_player.o(.rodata); + src/battle_controller_recorded_player.o(.rodata); src/battle_dome_cards.o(.rodata); src/lilycove_lady.o(.rodata); data/battle_frontier_1.o(.rodata); diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c new file mode 100644 index 000000000..1f07b377c --- /dev/null +++ b/src/battle_controller_recorded_player.c @@ -0,0 +1,204 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "recorded_battle.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.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" +#include "pokeball.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +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 struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; + +extern void sub_81358F4(void); +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); + +// this file's functions +void RecordedPlayerHandleGetMonData(void); +void RecordedPlayerHandleGetRawMonData(void); +void RecordedPlayerHandleSetMonData(void); +void RecordedPlayerHandleSetRawMonData(void); +void RecordedPlayerHandleLoadMonSprite(void); +void RecordedPlayerHandleSwitchInAnim(void); +void RecordedPlayerHandleReturnMonToBall(void); +void RecordedPlayerHandleDrawTrainerPic(void); +void RecordedPlayerHandleTrainerSlide(void); +void RecordedPlayerHandleTrainerSlideBack(void); +void RecordedPlayerHandleFaintAnimation(void); +void RecordedPlayerHandlePaletteFade(void); +void RecordedPlayerHandleSuccessBallThrowAnim(void); +void RecordedPlayerHandleBallThrowAnim(void); +void RecordedPlayerHandlePause(void); +void RecordedPlayerHandleMoveAnimation(void); +void RecordedPlayerHandlePrintString(void); +void RecordedPlayerHandlePrintStringPlayerOnly(void); +void RecordedPlayerHandleChooseAction(void); +void RecordedPlayerHandleUnknownYesNoBox(void); +void RecordedPlayerHandleChooseMove(void); +void RecordedPlayerHandleChooseItem(void); +void RecordedPlayerHandleChoosePokemon(void); +void RecordedPlayerHandleCmd23(void); +void RecordedPlayerHandleHealthBarUpdate(void); +void RecordedPlayerHandleExpUpdate(void); +void RecordedPlayerHandleStatusIconUpdate(void); +void RecordedPlayerHandleStatusAnimation(void); +void RecordedPlayerHandleStatusXor(void); +void RecordedPlayerHandleDataTransfer(void); +void RecordedPlayerHandleDMA3Transfer(void); +void RecordedPlayerHandlePlayBGM(void); +void RecordedPlayerHandleCmd32(void); +void RecordedPlayerHandleTwoReturnValues(void); +void RecordedPlayerHandleChosenMonReturnValue(void); +void RecordedPlayerHandleOneReturnValue(void); +void RecordedPlayerHandleOneReturnValue_Duplicate(void); +void RecordedPlayerHandleCmd37(void); +void RecordedPlayerHandleCmd38(void); +void RecordedPlayerHandleCmd39(void); +void RecordedPlayerHandleCmd40(void); +void RecordedPlayerHandleHitAnimation(void); +void RecordedPlayerHandleCmd42(void); +void RecordedPlayerHandleEffectivenessSound(void); +void RecordedPlayerHandlePlayFanfareOrBGM(void); +void RecordedPlayerHandleFaintingCry(void); +void RecordedPlayerHandleIntroSlide(void); +void RecordedPlayerHandleIntroTrainerBallThrow(void); +void RecordedPlayerHandleDrawPartyStatusSummary(void); +void RecordedPlayerHandleCmd49(void); +void RecordedPlayerHandleCmd50(void); +void RecordedPlayerHandleSpriteInvisibility(void); +void RecordedPlayerHandleBattleAnimation(void); +void RecordedPlayerHandleLinkStandbyMsg(void); +void RecordedPlayerHandleResetActionMoveSelection(void); +void RecordedPlayerHandleCmd55(void); +void nullsub_121(void); + +void RecordedPlayerBufferRunCommand(void); +void RecordedPlayerBufferExecCompleted(void); + +void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + RecordedPlayerHandleGetMonData, + RecordedPlayerHandleGetRawMonData, + RecordedPlayerHandleSetMonData, + RecordedPlayerHandleSetRawMonData, + RecordedPlayerHandleLoadMonSprite, + RecordedPlayerHandleSwitchInAnim, + RecordedPlayerHandleReturnMonToBall, + RecordedPlayerHandleDrawTrainerPic, + RecordedPlayerHandleTrainerSlide, + RecordedPlayerHandleTrainerSlideBack, + RecordedPlayerHandleFaintAnimation, + RecordedPlayerHandlePaletteFade, + RecordedPlayerHandleSuccessBallThrowAnim, + RecordedPlayerHandleBallThrowAnim, + RecordedPlayerHandlePause, + RecordedPlayerHandleMoveAnimation, + RecordedPlayerHandlePrintString, + RecordedPlayerHandlePrintStringPlayerOnly, + RecordedPlayerHandleChooseAction, + RecordedPlayerHandleUnknownYesNoBox, + RecordedPlayerHandleChooseMove, + RecordedPlayerHandleChooseItem, + RecordedPlayerHandleChoosePokemon, + RecordedPlayerHandleCmd23, + RecordedPlayerHandleHealthBarUpdate, + RecordedPlayerHandleExpUpdate, + RecordedPlayerHandleStatusIconUpdate, + RecordedPlayerHandleStatusAnimation, + RecordedPlayerHandleStatusXor, + RecordedPlayerHandleDataTransfer, + RecordedPlayerHandleDMA3Transfer, + RecordedPlayerHandlePlayBGM, + RecordedPlayerHandleCmd32, + RecordedPlayerHandleTwoReturnValues, + RecordedPlayerHandleChosenMonReturnValue, + RecordedPlayerHandleOneReturnValue, + RecordedPlayerHandleOneReturnValue_Duplicate, + RecordedPlayerHandleCmd37, + RecordedPlayerHandleCmd38, + RecordedPlayerHandleCmd39, + RecordedPlayerHandleCmd40, + RecordedPlayerHandleHitAnimation, + RecordedPlayerHandleCmd42, + RecordedPlayerHandleEffectivenessSound, + RecordedPlayerHandlePlayFanfareOrBGM, + RecordedPlayerHandleFaintingCry, + RecordedPlayerHandleIntroSlide, + RecordedPlayerHandleIntroTrainerBallThrow, + RecordedPlayerHandleDrawPartyStatusSummary, + RecordedPlayerHandleCmd49, + RecordedPlayerHandleCmd50, + RecordedPlayerHandleSpriteInvisibility, + RecordedPlayerHandleBattleAnimation, + RecordedPlayerHandleLinkStandbyMsg, + RecordedPlayerHandleResetActionMoveSelection, + RecordedPlayerHandleCmd55, + nullsub_121 +}; + +void nullsub_120(void) +{ +} + +void SetBankFuncToRecordedPlayerBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = RecordedPlayerBufferRunCommand; +} + +void RecordedPlayerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gRecordedPlayerBufferCommands)) + gRecordedPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + RecordedPlayerBufferExecCompleted(); + } +} From 918625196ed5e91999f1a244a8881fb9f8069c64 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 13:32:11 +0200 Subject: [PATCH 08/29] recorded player controller is done --- asm/battle_controller_recorded_opponent.s | 8 +- asm/battle_controller_recorded_player.s | 6090 --------------------- asm/recorded_battle.s | 10 +- include/recorded_battle.h | 2 + ld_script.txt | 1 - src/battle_controller_player.c | 2 +- src/battle_controller_player_partner.c | 2 +- src/battle_controller_recorded_player.c | 1776 +++++- 8 files changed, 1726 insertions(+), 6165 deletions(-) delete mode 100644 asm/battle_controller_recorded_player.s diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 695c179e5..2a98967c4 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -4748,7 +4748,7 @@ sub_8188EF0: @ 8188EF0 push {lr} ldr r0, =gActiveBank ldrb r0, [r0] - bl sub_8185054 + bl RecordedBattle_ReadBankAction adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -4791,12 +4791,12 @@ sub_8188F20: @ 8188F20 _08188F48: ldr r5, =gActiveBank ldrb r0, [r5] - bl sub_8185054 + bl RecordedBattle_ReadBankAction adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldrb r0, [r5] - bl sub_8185054 + bl RecordedBattle_ReadBankAction adds r2, r0, 0 lsls r2, 24 lsrs r2, 16 @@ -4825,7 +4825,7 @@ sub_8188F88: @ 8188F88 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] - bl sub_8185054 + bl RecordedBattle_ReadBankAction ldrb r1, [r4] ldr r3, =gBattleStruct ldr r2, [r3] diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s deleted file mode 100644 index 03a6ff0e7..000000000 --- a/asm/battle_controller_recorded_player.s +++ /dev/null @@ -1,6090 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81899B8 -sub_81899B8: @ 81899B8 - 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 _081899DC - bl RecordedPlayerBufferExecCompleted -_081899DC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81899B8 - - thumb_func_start sub_81899F0 -sub_81899F0: @ 81899F0 - 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 _08189A40 - movs r0, 0 - 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 RecordedPlayerBufferExecCompleted -_08189A40: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81899F0 - - thumb_func_start sub_8189A58 -sub_8189A58: @ 8189A58 - 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 _08189A90 - 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 RecordedPlayerBufferExecCompleted -_08189A90: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189A58 - - thumb_func_start sub_8189AA0 -sub_8189AA0: @ 8189AA0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r6, 0 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankIdentity - lsls r0, 24 - cmp r0, 0 - beq _08189ABA - b _08189C60 -_08189ABA: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189ADA - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189B0C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08189B0C -_08189ADA: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - 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, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08189B42 - b _08189B48 - .pool -_08189B0C: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - 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 _08189B42 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08189B42 - movs r6, 0x1 -_08189B42: - cmp r6, 0 - bne _08189B48 - b _08189D18 -_08189B48: - ldr r0, =gBattleSpritesDataPtr - mov r9, r0 - ldr r0, [r0] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4, 0x1] - movs r6, 0x1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189B6A - b _08189D18 -_08189B6A: - 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, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189B86 - b _08189D18 -_08189B86: - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r9 - ldr r0, [r1] - ldrb r2, [r5] - 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, [r5] - 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, [r5] - 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, [r5] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r4, =gPlayerParty - adds r0, r4 - bl sub_805E990 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189C22 - ldrb r0, [r5] - mov r1, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - muls r0, r6 - adds r0, r4 - bl sub_805E990 -_08189C22: - mov r1, r9 - ldr r0, [r1] - ldrb r1, [r5] - 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 - ldrb r0, [r5] - b _08189D10 - .pool -_08189C60: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189C80 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189CB0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08189CB0 -_08189C80: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - 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, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08189CE6 - b _08189CE4 - .pool -_08189CB0: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - 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 _08189CE6 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08189CE6 -_08189CE4: - movs r6, 0x1 -_08189CE6: - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - beq _08189CF2 - movs r6, 0 -_08189CF2: - cmp r6, 0 - beq _08189D18 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - 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 - ldrb r0, [r3] -_08189D10: - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8189A58 - str r1, [r0] -_08189D18: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189AA0 - - thumb_func_start sub_8189D40 -sub_8189D40: @ 8189D40 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankIdentity - lsls r0, 24 - cmp r0, 0 - bne _08189DBE - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r6, 0x88 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189D8C - 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 -_08189D8C: - ldr r2, [r5] - ldrb r1, [r4] - movs r0, 0x2 - adds r3, r0, 0 - eors r3, r1 - ldr r1, [r2, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189DBE - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_08189DBE: - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, =gActiveBank - ldrb r5, [r2] - ldr r4, [r0, 0x4] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r6, r0, r4 - ldrb r1, [r6] - movs r0, 0x8 - mov r12, r0 - ands r0, r1 - mov r9, r2 - mov r8, r3 - cmp r0, 0 - bne _08189EA2 - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r5 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0] - mov r0, r12 - ands r0, r1 - cmp r0, 0 - bne _08189EA2 - ldrb r1, [r6, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08189E84 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189E54 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08189E54 - ldr r4, =gHealthBoxesIds - mov r1, r9 - ldrb r0, [r1] - adds r1, r7, 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 - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - bl sub_8076918 - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08189E54: - 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 -_08189E84: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 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] - mov r9, r3 - mov r8, r4 -_08189EA2: - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - 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 _08189F62 - 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 _08189F62 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08189F62 - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08189F44 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08189F38 - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - cmp r0, 0 - bne _08189F44 - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _08189F44 - .pool -_08189F38: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_08189F44: - 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 r10, r0 -_08189F62: - mov r1, r10 - cmp r1, 0 - beq _0818A02A - ldr r7, =gSprites - ldr r6, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r7, 0 - adds r4, 0x1C - adds r0, r4 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - cmp r2, r0 - bne _0818A02A - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r2 - bne _0818A02A - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189FC8 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08189FC8 - ldrb r1, [r5] - movs r0, 0x2 - eors r0, r1 - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - bl DestroySprite -_08189FC8: - 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_8189AA0 - str r1, [r0] -_0818A02A: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189D40 - - thumb_func_start sub_818A064 -sub_818A064: @ 818A064 - 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 r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _0818A092 - movs r2, 0x24 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _0818A092 - bl RecordedPlayerBufferExecCompleted -_0818A092: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A064 - - thumb_func_start sub_818A0A4 -sub_818A0A4: @ 818A0A4 - 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 _0818A0EC - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _0818A106 - .pool -_0818A0EC: - 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 RecordedPlayerBufferExecCompleted -_0818A106: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A0A4 - - thumb_func_start sub_818A114 -sub_818A114: @ 818A114 - 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 _0818A190 - 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 RecordedPlayerBufferExecCompleted -_0818A190: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A114 - - thumb_func_start sub_818A1B0 -sub_818A1B0: @ 818A1B0 - 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 _0818A204 - 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 RecordedPlayerBufferExecCompleted -_0818A204: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A1B0 - - thumb_func_start sub_818A220 -sub_818A220: @ 818A220 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0818A232 - bl RecordedPlayerBufferExecCompleted -_0818A232: - pop {r0} - bx r0 - thumb_func_end sub_818A220 - - thumb_func_start sub_818A238 -sub_818A238: @ 818A238 - 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 _0818A284 - 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 RecordedPlayerBufferExecCompleted - b _0818A2AE - .pool -_0818A284: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0818A2A8 - 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] -_0818A2A8: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_0818A2AE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_818A238 - - thumb_func_start sub_818A2B4 -sub_818A2B4: @ 818A2B4 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - 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 _0818A306 - adds r0, r3, 0 - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r2, [r4] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0818A2FA - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_0818A2FA: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818A328 - str r0, [r1] -_0818A306: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A2B4 - - thumb_func_start sub_818A328 -sub_818A328: @ 818A328 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0818A364 - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - 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 _0818A364 - bl RecordedPlayerBufferExecCompleted -_0818A364: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A328 - - thumb_func_start sub_818A37C -sub_818A37C: @ 818A37C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r7, =gActiveBank - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0818A438 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - 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, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r0, =gBattlePartyID - mov r8, r0 - ldrb r1, [r7] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - bl sub_805E990 - ldr r1, =gBankSpriteIds - ldrb r0, [r7] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - lsls r1, 1 - add r1, r8 - ldrh r1, [r1] - muls r1, r6 - adds r1, r5 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - bl sub_8076918 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A2B4 - str r1, [r0] -_0818A438: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A37C - - thumb_func_start sub_818A470 -sub_818A470: @ 818A470 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r4, =gActiveBank - ldrb r2, [r4] - 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 _0818A4A2 - 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 -_0818A4A2: - ldr r5, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r4] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0818A4E8 - 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 _0818A4E8 - adds r0, r3, r5 - bl DestroySprite - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A37C - str r1, [r0] -_0818A4E8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A470 - - thumb_func_start RecordedPlayerBufferExecCompleted -RecordedPlayerBufferExecCompleted: @ 818A514 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedPlayerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0818A568 - 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 _0818A57A - .pool -_0818A568: - 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] -_0818A57A: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerBufferExecCompleted - - thumb_func_start sub_818A58C -sub_818A58C: @ 818A58C - 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 _0818A5AE - bl RecordedPlayerBufferExecCompleted -_0818A5AE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A58C - - thumb_func_start sub_818A5BC -sub_818A5BC: @ 818A5BC - 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 _0818A5DE - bl RecordedPlayerBufferExecCompleted -_0818A5DE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A5BC - - thumb_func_start RecordedPlayerHandleGetMonData -RecordedPlayerHandleGetMonData: @ 818A5EC - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0818A624 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_818A660 - adds r6, r0, 0 - b _0818A646 - .pool -_0818A624: - ldrb r4, [r1] - movs r5, 0 -_0818A628: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0818A63E - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_818A660 - adds r6, r0 -_0818A63E: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0818A628 -_0818A646: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl RecordedPlayerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleGetMonData - - thumb_func_start sub_818A660 -sub_818A660: @ 818A660 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0818A68A - bl _0818ADF6 -_0818A68A: - lsls r0, 2 - ldr r1, =_0818A6A0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0818A6A0: - .4byte _0818A790 - .4byte _0818A9B4 - .4byte _0818A9C4 - .4byte _0818A9D4 - .4byte _0818AA3C - .4byte _0818AA3C - .4byte _0818AA3C - .4byte _0818AA3C - .4byte _0818AA58 - .4byte _0818AA94 - .4byte _0818AA94 - .4byte _0818AA94 - .4byte _0818AA94 - .4byte _0818ADF6 - .4byte _0818ADF6 - .4byte _0818ADF6 - .4byte _0818ADF6 - .4byte _0818AAB0 - .4byte _0818AAC0 - .4byte _0818AAF0 - .4byte _0818AB00 - .4byte _0818AB10 - .4byte _0818AB20 - .4byte _0818AB30 - .4byte _0818AB40 - .4byte _0818AB50 - .4byte _0818AB60 - .4byte _0818AB70 - .4byte _0818AB80 - .4byte _0818AB90 - .4byte _0818ABA0 - .4byte _0818ABB0 - .4byte _0818AC00 - .4byte _0818AC10 - .4byte _0818AC20 - .4byte _0818AC30 - .4byte _0818AC40 - .4byte _0818AC50 - .4byte _0818AC60 - .4byte _0818AC70 - .4byte _0818AC80 - .4byte _0818ACB4 - .4byte _0818ACC4 - .4byte _0818ACD4 - .4byte _0818ACE4 - .4byte _0818ACF4 - .4byte _0818AD04 - .4byte _0818AD14 - .4byte _0818AD24 - .4byte _0818AD44 - .4byte _0818AD54 - .4byte _0818AD64 - .4byte _0818AD74 - .4byte _0818AD84 - .4byte _0818AD94 - .4byte _0818ADA4 - .4byte _0818ADB4 - .4byte _0818ADC4 - .4byte _0818ADD4 - .4byte _0818ADE4 -_0818A790: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_0818A7DC: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _0818A7DC - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_0818A994: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _0818A994 - b _0818ADF6 - .pool -_0818A9B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _0818AD2E - .pool -_0818A9C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _0818AD2E - .pool -_0818A9D4: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_0818A9EA: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0818A9EA - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0818AA28: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0818AA28 - b _0818ADF6 - .pool -_0818AA3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _0818AD2E - .pool -_0818AA58: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_0818AA64: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0818AA64 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0818ADF6 - .pool -_0818AA94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _0818ADEE - .pool -_0818AAB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0818AACA - .pool -_0818AAC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0818AACA: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0818ADF6 - .pool -_0818AAF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _0818ADEE - .pool -_0818AB00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _0818ADEE - .pool -_0818AB10: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _0818ADEE - .pool -_0818AB20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _0818ADEE - .pool -_0818AB30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _0818ADEE - .pool -_0818AB40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _0818ADEE - .pool -_0818AB50: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _0818ADEE - .pool -_0818AB60: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _0818ADEE - .pool -_0818AB70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _0818ADEE - .pool -_0818AB80: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _0818ADEE - .pool -_0818AB90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _0818ADEE - .pool -_0818ABA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _0818ADEE - .pool -_0818ABB0: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0818ADF6 - .pool -_0818AC00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _0818ADEE - .pool -_0818AC10: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _0818ADEE - .pool -_0818AC20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _0818ADEE - .pool -_0818AC30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _0818ADEE - .pool -_0818AC40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _0818ADEE - .pool -_0818AC50: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _0818ADEE - .pool -_0818AC60: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0818AC8A - .pool -_0818AC70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _0818AD2E - .pool -_0818AC80: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0818AC8A: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0818ADF6 - .pool -_0818ACB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _0818ADEE - .pool -_0818ACC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _0818AD2E - .pool -_0818ACD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _0818AD2E - .pool -_0818ACE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _0818AD2E - .pool -_0818ACF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _0818AD2E - .pool -_0818AD04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _0818AD2E - .pool -_0818AD14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _0818AD2E - .pool -_0818AD24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_0818AD2E: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0818ADF6 - .pool -_0818AD44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _0818ADEE - .pool -_0818AD54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _0818ADEE - .pool -_0818AD64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _0818ADEE - .pool -_0818AD74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _0818ADEE - .pool -_0818AD84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _0818ADEE - .pool -_0818AD94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _0818ADEE - .pool -_0818ADA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _0818ADEE - .pool -_0818ADB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _0818ADEE - .pool -_0818ADC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _0818ADEE - .pool -_0818ADD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _0818ADEE - .pool -_0818ADE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_0818ADEE: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0818ADF6: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_818A660 - - thumb_func_start RecordedPlayerHandleGetRawMonData -RecordedPlayerHandleGetRawMonData: @ 818AE0C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleGetRawMonData - - thumb_func_start RecordedPlayerHandleSetMonData -RecordedPlayerHandleSetMonData: @ 818AE18 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0818AE48 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_818AE70 - b _0818AE66 - .pool -_0818AE48: - ldrb r4, [r1] - movs r5, 0 -_0818AE4C: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0818AE5A - adds r0, r5, 0 - bl sub_818AE70 -_0818AE5A: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0818AE4C -_0818AE66: - bl RecordedPlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleSetMonData - - thumb_func_start sub_818AE70 -sub_818AE70: @ 818AE70 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _0818AE9C - bl _0818B836 -_0818AE9C: - lsls r0, 2 - ldr r1, =_0818AEB4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0818AEB4: - .4byte _0818AFA4 - .4byte _0818B13C - .4byte _0818B15C - .4byte _0818B17C - .4byte _0818B1D4 - .4byte _0818B1D4 - .4byte _0818B1D4 - .4byte _0818B1D4 - .4byte _0818B1FC - .4byte _0818B260 - .4byte _0818B260 - .4byte _0818B260 - .4byte _0818B260 - .4byte _0818B836 - .4byte _0818B836 - .4byte _0818B836 - .4byte _0818B836 - .4byte _0818B290 - .4byte _0818B2B0 - .4byte _0818B2D0 - .4byte _0818B2F0 - .4byte _0818B310 - .4byte _0818B330 - .4byte _0818B350 - .4byte _0818B370 - .4byte _0818B390 - .4byte _0818B3B0 - .4byte _0818B3D0 - .4byte _0818B3F0 - .4byte _0818B410 - .4byte _0818B430 - .4byte _0818B450 - .4byte _0818B4C0 - .4byte _0818B4E0 - .4byte _0818B500 - .4byte _0818B520 - .4byte _0818B540 - .4byte _0818B560 - .4byte _0818B580 - .4byte _0818B5A0 - .4byte _0818B5C0 - .4byte _0818B5E0 - .4byte _0818B600 - .4byte _0818B620 - .4byte _0818B640 - .4byte _0818B660 - .4byte _0818B680 - .4byte _0818B6A0 - .4byte _0818B6C0 - .4byte _0818B6E0 - .4byte _0818B700 - .4byte _0818B720 - .4byte _0818B740 - .4byte _0818B760 - .4byte _0818B780 - .4byte _0818B7A0 - .4byte _0818B7C0 - .4byte _0818B7E0 - .4byte _0818B800 - .4byte _0818B820 -_0818AFA4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_0818B00A: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0818B00A - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0818B836 - .pool -_0818B13C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _0818B836 - .pool -_0818B15C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _0818B836 - .pool -_0818B17C: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0818B196: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0818B196 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0818B836 - .pool -_0818B1D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0818B278 - .pool -_0818B1FC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0818B836 - .pool -_0818B260: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0818B278: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0818B836 - .pool -_0818B290: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _0818B836 - .pool -_0818B2B0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _0818B836 - .pool -_0818B2D0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _0818B836 - .pool -_0818B2F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _0818B836 - .pool -_0818B310: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _0818B836 - .pool -_0818B330: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _0818B836 - .pool -_0818B350: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _0818B836 - .pool -_0818B370: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _0818B836 - .pool -_0818B390: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _0818B836 - .pool -_0818B3B0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _0818B836 - .pool -_0818B3D0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _0818B836 - .pool -_0818B3F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _0818B836 - .pool -_0818B410: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _0818B836 - .pool -_0818B430: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _0818B836 - .pool -_0818B450: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _0818B570 - .pool -_0818B4C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _0818B836 - .pool -_0818B4E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _0818B836 - .pool -_0818B500: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _0818B836 - .pool -_0818B520: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _0818B836 - .pool -_0818B540: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _0818B836 - .pool -_0818B560: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_0818B570: - movs r1, 0x2C - bl SetMonData - b _0818B836 - .pool -_0818B580: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _0818B836 - .pool -_0818B5A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _0818B836 - .pool -_0818B5C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _0818B836 - .pool -_0818B5E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _0818B836 - .pool -_0818B600: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _0818B836 - .pool -_0818B620: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _0818B836 - .pool -_0818B640: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _0818B836 - .pool -_0818B660: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _0818B836 - .pool -_0818B680: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _0818B836 - .pool -_0818B6A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _0818B836 - .pool -_0818B6C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _0818B836 - .pool -_0818B6E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _0818B836 - .pool -_0818B700: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _0818B836 - .pool -_0818B720: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _0818B836 - .pool -_0818B740: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _0818B836 - .pool -_0818B760: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _0818B836 - .pool -_0818B780: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _0818B836 - .pool -_0818B7A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _0818B836 - .pool -_0818B7C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _0818B836 - .pool -_0818B7E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _0818B836 - .pool -_0818B800: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _0818B836 - .pool -_0818B820: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_0818B836: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - 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 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818AE70 - - thumb_func_start RecordedPlayerHandleSetRawMonData -RecordedPlayerHandleSetRawMonData: @ 818B86C - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _0818B8C4 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_0818B8A2: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _0818B8A2 -_0818B8C4: - bl RecordedPlayerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleSetRawMonData - - thumb_func_start RecordedPlayerHandleLoadMonSprite -RecordedPlayerHandleLoadMonSprite: @ 818B8E0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A064 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleLoadMonSprite - - thumb_func_start RecordedPlayerHandleSwitchInAnim -RecordedPlayerHandleSwitchInAnim: @ 818B9FC - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl ClearTemporarySpeciesSpriteData - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - strh r0, [r1] - 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 BattleLoadPlayerMonSpriteGfx - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_818BA6C - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A470 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleSwitchInAnim - - thumb_func_start sub_818BA6C -sub_818BA6C: @ 818BA6C - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl ClearTemporarySpeciesSpriteData - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818BA6C - - thumb_func_start RecordedPlayerHandleReturnMonToBall -RecordedPlayerHandleReturnMonToBall: @ 818BBE8 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0818BC30 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818BC78 - str r1, [r0] - b _0818BC66 - .pool -_0818BC30: - 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 RecordedPlayerBufferExecCompleted -_0818BC66: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleReturnMonToBall - - thumb_func_start sub_818BC78 -sub_818BC78: @ 818BC78 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0818BCA0 - cmp r0, 0x1 - beq _0818BCCE - b _0818BCF6 - .pool -_0818BCA0: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0818BCBA - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0818BCBA: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0818BCF6 -_0818BCCE: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0818BCF6 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A1B0 - str r1, [r0] -_0818BCF6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818BC78 - - thumb_func_start RecordedPlayerHandleDrawTrainerPic -RecordedPlayerHandleDrawTrainerPic: @ 818BD04 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 18 - ands r0, r1 - cmp r0, 0 - beq _0818BD48 - movs r0, 0x40 - ands r1, r0 - cmp r1, 0 - beq _0818BD30 - bl sub_8185F40 - lsls r0, 24 - lsrs r4, r0, 24 - b _0818BD4C - .pool -_0818BD30: - ldr r2, =gLinkPlayers - ldr r0, =gUnknown_0203C7B4 - ldrb r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - b _0818BD4A - .pool -_0818BD48: - ldr r0, =gLinkPlayers -_0818BD4A: - ldrb r4, [r0, 0x13] -_0818BD4C: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0x40 - ands r1, r2 - adds r5, r0, 0 - cmp r1, 0 - beq _0818BD98 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r0, 0x20 - mov r9, r0 - cmp r1, 0 - beq _0818BD72 - movs r1, 0x5A - mov r9, r1 -_0818BD72: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _0818BD9C - movs r0, 0x5A - mov r9, r0 - ldr r1, =gTrainerFrontPicCoords - b _0818BD9E - .pool -_0818BD98: - movs r0, 0x50 - mov r9, r0 -_0818BD9C: - ldr r1, =gTrainerBackPicCoords -_0818BD9E: - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - bne _0818BDC0 - b _0818BEDC -_0818BDC0: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bl PlayerGenderToFrontTrainerPicId - lsls r0, 16 - lsrs r4, r0, 16 - adds r5, r4, 0 - ldr r6, =gActiveBank - ldrb r1, [r6] - adds r0, r5, 0 - bl DecompressTrainerFrontPic - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_806A1C0 - ldr r0, =gUnknown_0202499C - mov r8, r0 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r0, =gTrainerFrontPicPaletteTable - lsls r5, 3 - adds r5, r0 - ldrh r0, [r5, 0x4] - bl IndexOfSpritePaletteTag - ldr r5, =gSprites - ldrb r1, [r6] - adds r1, r4 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x30 - strh r1, [r0, 0x26] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_805D7AC - str r1, [r0] - ldrb r0, [r6] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - b _0818BF72 - .pool -_0818BEDC: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl DecompressTrainerBackPic - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r9 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] -_0818BF72: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81899B8 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleDrawTrainerPic - - thumb_func_start RecordedPlayerHandleTrainerSlide -RecordedPlayerHandleTrainerSlide: @ 818BFAC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleTrainerSlide - - thumb_func_start RecordedPlayerHandleTrainerSlideBack -RecordedPlayerHandleTrainerSlideBack: @ 818BFB8 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81899F0 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleTrainerSlideBack - - thumb_func_start RecordedPlayerHandleFaintAnimation -RecordedPlayerHandleFaintAnimation: @ 818C064 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _0818C0B8 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0818C098 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0818C098: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _0818C12E - .pool -_0818C0B8: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0818C12E - strb r4, [r3, 0x4] - 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 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A114 - str r1, [r0] -_0818C12E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleFaintAnimation - - thumb_func_start RecordedPlayerHandlePaletteFade -RecordedPlayerHandlePaletteFade: @ 818C150 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePaletteFade - - thumb_func_start RecordedPlayerHandleSuccessBallThrowAnim -RecordedPlayerHandleSuccessBallThrowAnim: @ 818C15C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleSuccessBallThrowAnim - - thumb_func_start RecordedPlayerHandleBallThrowAnim -RecordedPlayerHandleBallThrowAnim: @ 818C168 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleBallThrowAnim - - thumb_func_start RecordedPlayerHandlePause -RecordedPlayerHandlePause: @ 818C174 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePause - - thumb_func_start RecordedPlayerHandleMoveAnimation -RecordedPlayerHandleMoveAnimation: @ 818C180 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _0818C192 - b _0818C2A6 -_0818C192: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gTransformedPersonalities - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0818C288 - bl RecordedPlayerBufferExecCompleted - b _0818C2A6 - .pool -_0818C288: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_2 - str r1, [r0] -_0818C2A6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleMoveAnimation - - thumb_func_start bx_move_anim_2 -bx_move_anim_2: @ 818C2B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0818C350 - cmp r2, 0x1 - bgt _0818C310 - cmp r2, 0 - beq _0818C31A - b _0818C42C - .pool -_0818C310: - cmp r2, 0x2 - beq _0818C37A - cmp r2, 0x3 - beq _0818C3F0 - b _0818C42C -_0818C31A: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _0818C33C - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0818C33C: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0818C42C -_0818C350: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0818C42C - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0818C42C -_0818C37A: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0818C42C - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _0818C3C8 - mov r0, r8 - cmp r0, 0x1 - bhi _0818C3C8 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0818C3C8: - 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 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0818C42C - .pool -_0818C3F0: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0818C42C - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl RecordedPlayerBufferExecCompleted -_0818C42C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_2 - - thumb_func_start RecordedPlayerHandlePrintString -RecordedPlayerHandlePrintString: @ 818C43C - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A220 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandlePrintString - - thumb_func_start RecordedPlayerHandlePrintStringPlayerOnly -RecordedPlayerHandlePrintStringPlayerOnly: @ 818C490 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePrintStringPlayerOnly - - thumb_func_start sub_818C49C -sub_818C49C: @ 818C49C - push {lr} - ldr r1, =gBattleCommunication - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - ldrb r1, [r1, 0x4] - lsrs r0, 1 - cmp r1, r0 - bcc _0818C4C6 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl sub_8185054 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitTwoReturnValues - bl RecordedPlayerBufferExecCompleted -_0818C4C6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818C49C - - thumb_func_start RecordedPlayerHandleChooseAction -RecordedPlayerHandleChooseAction: @ 818C4D8 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0818C508 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818C49C - str r1, [r0] - b _0818C522 - .pool -_0818C508: - ldr r0, =gActiveBank - ldrb r0, [r0] - bl sub_8185054 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitTwoReturnValues - bl RecordedPlayerBufferExecCompleted -_0818C522: - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleChooseAction - - thumb_func_start RecordedPlayerHandleUnknownYesNoBox -RecordedPlayerHandleUnknownYesNoBox: @ 818C52C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleUnknownYesNoBox - - thumb_func_start RecordedPlayerHandleChooseMove -RecordedPlayerHandleChooseMove: @ 818C538 - push {r4,r5,lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0818C560 - bl ChooseMoveAndTargetInBattlePalace - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues - b _0818C584 - .pool -_0818C560: - ldr r5, =gActiveBank - ldrb r0, [r5] - bl sub_8185054 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r5] - bl sub_8185054 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 16 - orrs r2, r4 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues -_0818C584: - bl RecordedPlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleChooseMove - - thumb_func_start RecordedPlayerHandleChooseItem -RecordedPlayerHandleChooseItem: @ 818C594 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleChooseItem - - thumb_func_start RecordedPlayerHandleChoosePokemon -RecordedPlayerHandleChoosePokemon: @ 818C5A0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl sub_8185054 - ldrb r1, [r4] - ldr r3, =gBattleStruct - ldr r2, [r3] - adds r1, r2 - adds r1, 0x5C - strb r0, [r1] - ldrb r0, [r4] - ldr r1, [r3] - adds r0, r1 - adds r0, 0x5C - ldrb r1, [r0] - movs r0, 0x1 - movs r2, 0 - bl EmitChosenMonReturnValue - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleChoosePokemon - - thumb_func_start RecordedPlayerHandleCmd23 -RecordedPlayerHandleCmd23: @ 818C5DC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd23 - - thumb_func_start RecordedPlayerHandleHealthBarUpdate -RecordedPlayerHandleHealthBarUpdate: @ 818C5E8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _0818C678 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0818C6B2 - .pool -_0818C678: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r4, =gHealthBoxesIds - adds r1, r0, r4 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct - mov r1, r9 - ldrb r0, [r1] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0 - bl UpdateHpTextInHealthbox -_0818C6B2: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A0A4 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleHealthBarUpdate - - thumb_func_start RecordedPlayerHandleExpUpdate -RecordedPlayerHandleExpUpdate: @ 818C6E8 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleExpUpdate - - thumb_func_start RecordedPlayerHandleStatusIconUpdate -RecordedPlayerHandleStatusIconUpdate: @ 818C6F4 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0818C748 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - 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, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A58C - str r1, [r0] -_0818C748: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleStatusIconUpdate - - thumb_func_start RecordedPlayerHandleStatusAnimation -RecordedPlayerHandleStatusAnimation: @ 818C76C - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0818C7BC - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl DoStatusAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A58C - str r1, [r0] -_0818C7BC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleStatusAnimation - - thumb_func_start RecordedPlayerHandleStatusXor -RecordedPlayerHandleStatusXor: @ 818C7D4 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleStatusXor - - thumb_func_start RecordedPlayerHandleDataTransfer -RecordedPlayerHandleDataTransfer: @ 818C7E0 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleDataTransfer - - thumb_func_start RecordedPlayerHandleDMA3Transfer -RecordedPlayerHandleDMA3Transfer: @ 818C7EC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleDMA3Transfer - - thumb_func_start RecordedPlayerHandlePlayBGM -RecordedPlayerHandlePlayBGM: @ 818C7F8 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePlayBGM - - thumb_func_start RecordedPlayerHandleCmd32 -RecordedPlayerHandleCmd32: @ 818C804 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd32 - - thumb_func_start RecordedPlayerHandleTwoReturnValues -RecordedPlayerHandleTwoReturnValues: @ 818C810 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleTwoReturnValues - - thumb_func_start RecordedPlayerHandleChosenMonReturnValue -RecordedPlayerHandleChosenMonReturnValue: @ 818C81C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleChosenMonReturnValue - - thumb_func_start RecordedPlayerHandleOneReturnValue -RecordedPlayerHandleOneReturnValue: @ 818C828 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleOneReturnValue - - thumb_func_start RecordedPlayerHandleOneReturnValue_Duplicate -RecordedPlayerHandleOneReturnValue_Duplicate: @ 818C834 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleOneReturnValue_Duplicate - - thumb_func_start RecordedPlayerHandleCmd37 -RecordedPlayerHandleCmd37: @ 818C840 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd37 - - thumb_func_start RecordedPlayerHandleCmd38 -RecordedPlayerHandleCmd38: @ 818C85C - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd38 - - thumb_func_start RecordedPlayerHandleCmd39 -RecordedPlayerHandleCmd39: @ 818C894 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd39 - - thumb_func_start RecordedPlayerHandleCmd40 -RecordedPlayerHandleCmd40: @ 818C8AC - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd40 - - thumb_func_start RecordedPlayerHandleHitAnimation -RecordedPlayerHandleHitAnimation: @ 818C8D4 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0818C908 - bl RecordedPlayerBufferExecCompleted - b _0818C932 - .pool -_0818C908: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A238 - str r1, [r0] -_0818C932: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleHitAnimation - - thumb_func_start RecordedPlayerHandleCmd42 -RecordedPlayerHandleCmd42: @ 818C944 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd42 - - thumb_func_start RecordedPlayerHandleEffectivenessSound -RecordedPlayerHandleEffectivenessSound: @ 818C950 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0818C964 - movs r3, 0xC0 -_0818C964: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleEffectivenessSound - - thumb_func_start RecordedPlayerHandlePlayFanfareOrBGM -RecordedPlayerHandlePlayFanfareOrBGM: @ 818C994 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0818C9D0 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0818C9E4 - .pool -_0818C9D0: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0818C9E4: - bl RecordedPlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePlayFanfareOrBGM - - thumb_func_start RecordedPlayerHandleFaintingCry -RecordedPlayerHandleFaintingCry: @ 818C9F0 - push {lr} - 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, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleFaintingCry - - thumb_func_start RecordedPlayerHandleIntroSlide -RecordedPlayerHandleIntroSlide: @ 818CA30 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleIntroSlide - - thumb_func_start RecordedPlayerHandleIntroTrainerBallThrow -RecordedPlayerHandleIntroTrainerBallThrow: @ 818CA64 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r6] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x38] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f9 - bl AllocSpritePalette - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 18 - ands r0, r1 - cmp r0, 0 - beq _0818CB54 - ldr r4, =gLinkPlayers - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] - b _0818CB5A - .pool -_0818CB54: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] -_0818CB5A: - ldr r1, =gTrainerBackPicPaletteTable - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - lsls r4, r5, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_818CC24 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r5] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0818CBD4 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0818CBD4: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_120 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleIntroTrainerBallThrow - - thumb_func_start sub_818CC24 -sub_818CC24: @ 818CC24 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x17 - bgt _0818CC50 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0818CD0C - .pool -_0818CC50: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0818CC70 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0818CCA0 -_0818CC70: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_818BA6C - b _0818CCF4 - .pool -_0818CCA0: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_818BA6C - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_818BA6C - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_0818CCF4: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8189D40 - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_0818CD0C: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818CC24 - - thumb_func_start RecordedPlayerHandleDrawPartyStatusSummary -RecordedPlayerHandleDrawPartyStatusSummary: @ 818CD30 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0818CD60 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0818CD60 - bl RecordedPlayerBufferExecCompleted - b _0818CDD4 - .pool -_0818CD60: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0818CDC8 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_0818CDC8: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_increment_dp11b_field_5_till_x60_then_resume - str r0, [r1] -_0818CDD4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleDrawPartyStatusSummary - - thumb_func_start bx_increment_dp11b_field_5_till_x60_then_resume -bx_increment_dp11b_field_5_till_x60_then_resume: @ 818CDF4 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _0818CE2C - 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, 0x5] - bl RecordedPlayerBufferExecCompleted -_0818CE2C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bx_increment_dp11b_field_5_till_x60_then_resume - - thumb_func_start RecordedPlayerHandleCmd49 -RecordedPlayerHandleCmd49: @ 818CE3C - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0818CE6E - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_0818CE6E: - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd49 - - thumb_func_start RecordedPlayerHandleCmd50 -RecordedPlayerHandleCmd50: @ 818CE8C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd50 - - thumb_func_start RecordedPlayerHandleSpriteInvisibility -RecordedPlayerHandleSpriteInvisibility: @ 818CE98 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _0818CEDE - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility -_0818CEDE: - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleSpriteInvisibility - - thumb_func_start RecordedPlayerHandleBattleAnimation -RecordedPlayerHandleBattleAnimation: @ 818CEF8 - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0818CF50 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _0818CF44 - bl RecordedPlayerBufferExecCompleted - b _0818CF50 - .pool -_0818CF44: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818A5BC - str r0, [r1] -_0818CF50: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleBattleAnimation - - thumb_func_start RecordedPlayerHandleLinkStandbyMsg -RecordedPlayerHandleLinkStandbyMsg: @ 818CF60 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleLinkStandbyMsg - - thumb_func_start RecordedPlayerHandleResetActionMoveSelection -RecordedPlayerHandleResetActionMoveSelection: @ 818CF6C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleResetActionMoveSelection - - thumb_func_start RecordedPlayerHandleCmd55 -RecordedPlayerHandleCmd55: @ 818CF78 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl RecordedPlayerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd55 - - thumb_func_start nullsub_121 -nullsub_121: @ 818CFC4 - bx lr - thumb_func_end nullsub_121 - - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/recorded_battle.s b/asm/recorded_battle.s index 2209312c2..55cfdf6ef 100644 --- a/asm/recorded_battle.s +++ b/asm/recorded_battle.s @@ -312,8 +312,8 @@ _08185046: .pool thumb_func_end RecordedBattle_ClearBankAction - thumb_func_start sub_8185054 -sub_8185054: @ 8185054 + thumb_func_start RecordedBattle_ReadBankAction +RecordedBattle_ReadBankAction: @ 8185054 push {r4,lr} sub sp, 0x4 lsls r0, 24 @@ -364,7 +364,7 @@ _081850C6: pop {r4} pop {r1} bx r1 - thumb_func_end sub_8185054 + thumb_func_end RecordedBattle_ReadBankAction thumb_func_start sub_81850D0 sub_81850D0: @ 81850D0 @@ -2274,7 +2274,7 @@ _0818611E: b _081863EE _08186142: adds r0, r5, 0 - bl sub_8185054 + bl RecordedBattle_ReadBankAction movs r5, 0 mov r0, sp adds r0, 0x4 @@ -2326,7 +2326,7 @@ _0818617E: _081861A6: ldr r3, [sp, 0x4C] lsrs r0, r3, 24 - bl sub_8185054 + bl RecordedBattle_ReadBankAction strb r0, [r4] ldrb r0, [r4] lsls r0, 1 diff --git a/include/recorded_battle.h b/include/recorded_battle.h index 6b80e220f..ae2ed1a79 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -6,6 +6,7 @@ extern u32 gRecordedBattleRngSeed; void sub_8184DA4(u8 arg0); void sub_8185F84(void); void sub_8184E58(void); +u8 RecordedBattle_ReadBankAction(u8 bank); void RecordedBattle_SetBankAction(u8 bank, u8 action); void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear); void sub_8185F90(u16 arg0); @@ -18,5 +19,6 @@ void sub_8185FD0(void); void sub_8186444(void); void sub_8185EB8(void); u8 sub_81850DC(u8 *arg0); +u8 sub_8185F40(void); #endif // GUARD_RECORDED_BATTLE_H diff --git a/ld_script.txt b/ld_script.txt index 08dcabd3a..0296ddd56 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -236,7 +236,6 @@ SECTIONS { asm/recorded_battle.o(.text); asm/battle_controller_recorded_opponent.o(.text); src/battle_controller_recorded_player.o(.text); - asm/battle_controller_recorded_player.o(.text); src/battle_dome_cards.o(.text); src/lilycove_lady.o(.text); asm/battle_frontier_1.o(.text); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index b9ce93a89..b022d3f87 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -2510,7 +2510,7 @@ static void PlayerHandleMoveAnimation(void) gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; - if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always return FALSE + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE { PlayerBufferExecCompleted(); } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index b7479c3cc..25eaf773f 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -1456,7 +1456,7 @@ static void PlayerPartnerHandleMoveAnimation(void) gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; - if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always return FALSE + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE { PlayerPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 1f07b377c..efedf52b6 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -50,79 +50,89 @@ extern u8 gBankTarget; extern u8 gAbsentBankFlags; extern u8 gUnknown_020244B4[]; extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u8 gBattleCommunication[]; +extern u8 gUnknown_0203C7B4; +extern struct MusicPlayerInfo gMPlay_BGM; extern struct UnusedControllerStruct gUnknown_02022D0C; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; -extern void sub_81358F4(void); extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); // this file's functions -void RecordedPlayerHandleGetMonData(void); -void RecordedPlayerHandleGetRawMonData(void); -void RecordedPlayerHandleSetMonData(void); -void RecordedPlayerHandleSetRawMonData(void); -void RecordedPlayerHandleLoadMonSprite(void); -void RecordedPlayerHandleSwitchInAnim(void); -void RecordedPlayerHandleReturnMonToBall(void); -void RecordedPlayerHandleDrawTrainerPic(void); -void RecordedPlayerHandleTrainerSlide(void); -void RecordedPlayerHandleTrainerSlideBack(void); -void RecordedPlayerHandleFaintAnimation(void); -void RecordedPlayerHandlePaletteFade(void); -void RecordedPlayerHandleSuccessBallThrowAnim(void); -void RecordedPlayerHandleBallThrowAnim(void); -void RecordedPlayerHandlePause(void); -void RecordedPlayerHandleMoveAnimation(void); -void RecordedPlayerHandlePrintString(void); -void RecordedPlayerHandlePrintStringPlayerOnly(void); -void RecordedPlayerHandleChooseAction(void); -void RecordedPlayerHandleUnknownYesNoBox(void); -void RecordedPlayerHandleChooseMove(void); -void RecordedPlayerHandleChooseItem(void); -void RecordedPlayerHandleChoosePokemon(void); -void RecordedPlayerHandleCmd23(void); -void RecordedPlayerHandleHealthBarUpdate(void); -void RecordedPlayerHandleExpUpdate(void); -void RecordedPlayerHandleStatusIconUpdate(void); -void RecordedPlayerHandleStatusAnimation(void); -void RecordedPlayerHandleStatusXor(void); -void RecordedPlayerHandleDataTransfer(void); -void RecordedPlayerHandleDMA3Transfer(void); -void RecordedPlayerHandlePlayBGM(void); -void RecordedPlayerHandleCmd32(void); -void RecordedPlayerHandleTwoReturnValues(void); -void RecordedPlayerHandleChosenMonReturnValue(void); -void RecordedPlayerHandleOneReturnValue(void); -void RecordedPlayerHandleOneReturnValue_Duplicate(void); -void RecordedPlayerHandleCmd37(void); -void RecordedPlayerHandleCmd38(void); -void RecordedPlayerHandleCmd39(void); -void RecordedPlayerHandleCmd40(void); -void RecordedPlayerHandleHitAnimation(void); -void RecordedPlayerHandleCmd42(void); -void RecordedPlayerHandleEffectivenessSound(void); -void RecordedPlayerHandlePlayFanfareOrBGM(void); -void RecordedPlayerHandleFaintingCry(void); -void RecordedPlayerHandleIntroSlide(void); -void RecordedPlayerHandleIntroTrainerBallThrow(void); -void RecordedPlayerHandleDrawPartyStatusSummary(void); -void RecordedPlayerHandleCmd49(void); -void RecordedPlayerHandleCmd50(void); -void RecordedPlayerHandleSpriteInvisibility(void); -void RecordedPlayerHandleBattleAnimation(void); -void RecordedPlayerHandleLinkStandbyMsg(void); -void RecordedPlayerHandleResetActionMoveSelection(void); -void RecordedPlayerHandleCmd55(void); -void nullsub_121(void); +static void RecordedPlayerHandleGetMonData(void); +static void RecordedPlayerHandleGetRawMonData(void); +static void RecordedPlayerHandleSetMonData(void); +static void RecordedPlayerHandleSetRawMonData(void); +static void RecordedPlayerHandleLoadMonSprite(void); +static void RecordedPlayerHandleSwitchInAnim(void); +static void RecordedPlayerHandleReturnMonToBall(void); +static void RecordedPlayerHandleDrawTrainerPic(void); +static void RecordedPlayerHandleTrainerSlide(void); +static void RecordedPlayerHandleTrainerSlideBack(void); +static void RecordedPlayerHandleFaintAnimation(void); +static void RecordedPlayerHandlePaletteFade(void); +static void RecordedPlayerHandleSuccessBallThrowAnim(void); +static void RecordedPlayerHandleBallThrowAnim(void); +static void RecordedPlayerHandlePause(void); +static void RecordedPlayerHandleMoveAnimation(void); +static void RecordedPlayerHandlePrintString(void); +static void RecordedPlayerHandlePrintStringPlayerOnly(void); +static void RecordedPlayerHandleChooseAction(void); +static void RecordedPlayerHandleUnknownYesNoBox(void); +static void RecordedPlayerHandleChooseMove(void); +static void RecordedPlayerHandleChooseItem(void); +static void RecordedPlayerHandleChoosePokemon(void); +static void RecordedPlayerHandleCmd23(void); +static void RecordedPlayerHandleHealthBarUpdate(void); +static void RecordedPlayerHandleExpUpdate(void); +static void RecordedPlayerHandleStatusIconUpdate(void); +static void RecordedPlayerHandleStatusAnimation(void); +static void RecordedPlayerHandleStatusXor(void); +static void RecordedPlayerHandleDataTransfer(void); +static void RecordedPlayerHandleDMA3Transfer(void); +static void RecordedPlayerHandlePlayBGM(void); +static void RecordedPlayerHandleCmd32(void); +static void RecordedPlayerHandleTwoReturnValues(void); +static void RecordedPlayerHandleChosenMonReturnValue(void); +static void RecordedPlayerHandleOneReturnValue(void); +static void RecordedPlayerHandleOneReturnValue_Duplicate(void); +static void RecordedPlayerHandleCmd37(void); +static void RecordedPlayerHandleCmd38(void); +static void RecordedPlayerHandleCmd39(void); +static void RecordedPlayerHandleCmd40(void); +static void RecordedPlayerHandleHitAnimation(void); +static void RecordedPlayerHandleCmd42(void); +static void RecordedPlayerHandleEffectivenessSound(void); +static void RecordedPlayerHandlePlayFanfareOrBGM(void); +static void RecordedPlayerHandleFaintingCry(void); +static void RecordedPlayerHandleIntroSlide(void); +static void RecordedPlayerHandleIntroTrainerBallThrow(void); +static void RecordedPlayerHandleDrawPartyStatusSummary(void); +static void RecordedPlayerHandleCmd49(void); +static void RecordedPlayerHandleCmd50(void); +static void RecordedPlayerHandleSpriteInvisibility(void); +static void RecordedPlayerHandleBattleAnimation(void); +static void RecordedPlayerHandleLinkStandbyMsg(void); +static void RecordedPlayerHandleResetActionMoveSelection(void); +static void RecordedPlayerHandleCmd55(void); +static void nullsub_121(void); -void RecordedPlayerBufferRunCommand(void); -void RecordedPlayerBufferExecCompleted(void); +static void RecordedPlayerBufferRunCommand(void); +static void RecordedPlayerBufferExecCompleted(void); +static void sub_818A328(void); +static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst); +static void SetRecordedPlayerMonData(u8 monId); +static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void RecordedPlayerDoMoveAnimation(void); +static void sub_818CC24(u8 taskId); +static void sub_818CDF4(void); -void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { RecordedPlayerHandleGetMonData, RecordedPlayerHandleGetRawMonData, @@ -183,7 +193,7 @@ void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = nullsub_121 }; -void nullsub_120(void) +static void nullsub_120(void) { } @@ -192,7 +202,7 @@ void SetBankFuncToRecordedPlayerBufferRunCommand(void) gBattleBankFunc[gActiveBank] = RecordedPlayerBufferRunCommand; } -void RecordedPlayerBufferRunCommand(void) +static void RecordedPlayerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { @@ -202,3 +212,1643 @@ void RecordedPlayerBufferRunCommand(void) RecordedPlayerBufferExecCompleted(); } } + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + RecordedPlayerBufferExecCompleted(); +} + +static void sub_81899F0(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(0); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_8189A58(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_8189AA0(void) +{ + bool32 r6 = FALSE; + + if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) + { + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (r6 && 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_8189A58; + } + } + else + { + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (IsCryPlayingOrClearCrySongs()) + r6 = FALSE; + + if (r6) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_8189A58; + } + } +} + +static void sub_8189D40(void) +{ + bool32 r10 = FALSE; + + if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) + { + 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_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x40 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x40 + && !IsCryPlayingOrClearCrySongs()) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20) + { + if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r10 = TRUE; + } + + if (r10 && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + 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_8189AA0; + } +} + +static void sub_818A064(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].animEnded && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + RecordedPlayerBufferExecCompleted(); +} + +static void CompleteOnHealthbarDone(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); + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_818A114(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]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_818A1B0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + RecordedPlayerBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + RecordedPlayerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_818A2B4(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_818A328; + } +} + +static void sub_818A328(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_818A37C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleBankFunc[gActiveBank] = sub_818A2B4; + } +} + +static void sub_818A470(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]]); + gBattleBankFunc[gActiveBank] = sub_818A37C; + } +} + +static void RecordedPlayerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = RecordedPlayerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + RecordedPlayerBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyRecordedPlayerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyRecordedPlayerMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + RecordedPlayerBufferExecCompleted(); +} + +static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void RecordedPlayerHandleGetRawMonData(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetRecordedPlayerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetRecordedPlayerMonData(i); + monsToCheck >>= 1; + } + } + RecordedPlayerBufferExecCompleted(); +} + +static void SetRecordedPlayerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void RecordedPlayerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleLoadMonSprite(void) +{ + u16 species; + + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_818A064; +} + +static void RecordedPlayerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_818BA6C(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_818A470; +} + +static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void RecordedPlayerHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + gBattleBankFunc[gActiveBank] = sub_818A1B0; + } + break; + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +static void RecordedPlayerHandleDrawTrainerPic(void) +{ + s16 xPos, yPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + trainerPicId = sub_8185F40(); + else + trainerPicId = gLinkPlayers[gUnknown_0203C7B4].gender; + } + else + { + trainerPicId = gLinkPlayers[0].gender; + } + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 90; + else // first mon + xPos = 32; + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + { + xPos = 90; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80; + } + else + { + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + } + else + { + xPos = 80; + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].pos2.y = 48; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gSprites[gBankSpriteIds[gActiveBank]].oam.affineMode = 0; + gSprites[gBankSpriteIds[gActiveBank]].hFlip = 1; + } + else + { + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + } + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void RecordedPlayerHandleTrainerSlide(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_81899F0; +} + +static void RecordedPlayerHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlaySE12WithPanning(SE_POKE_DEAD, -64); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_818A114; + } + } +} + +static void RecordedPlayerHandlePaletteFade(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleSuccessBallThrowAnim(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleBallThrowAnim(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandlePause(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + RecordedPlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = RecordedPlayerDoMoveAnimation; + } + } +} + +static void RecordedPlayerDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + RecordedPlayerBufferExecCompleted(); + } + break; + } +} + +static void RecordedPlayerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void RecordedPlayerHandlePrintStringPlayerOnly(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void ChooseActionInBattlePalace(void) +{ + if (gBattleCommunication[4] >= gNoOfAllBanks / 2) + { + EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBank), 0); + RecordedPlayerBufferExecCompleted(); + } +} + +static void RecordedPlayerHandleChooseAction(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gBattleBankFunc[gActiveBank] = ChooseActionInBattlePalace; + } + else + { + EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBank), 0); + RecordedPlayerBufferExecCompleted(); + } +} + +static void RecordedPlayerHandleUnknownYesNoBox(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + } + else + { + u8 moveId = RecordedBattle_ReadBankAction(gActiveBank); + u8 target = RecordedBattle_ReadBankAction(gActiveBank); + EmitTwoReturnValues(1, 10, moveId | (target << 8)); + } + + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChooseItem(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChoosePokemon(void) +{ + *(gBattleStruct->field_5C + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank); + EmitChosenMonReturnValue(1, *(gBattleStruct->field_5C + gActiveBank), NULL); + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd23(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void RecordedPlayerHandleExpUpdate(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedPlayerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedPlayerHandleStatusXor(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleDataTransfer(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleDMA3Transfer(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandlePlayBGM(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd32(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleTwoReturnValues(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChosenMonReturnValue(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleOneReturnValue(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleOneReturnValue_Duplicate(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + RecordedPlayerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void RecordedPlayerHandleCmd42(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + u32 trainerPicId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F9); + if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + trainerPicId = gLinkPlayers[sub_806D864(gActiveBank)].gender; + else + trainerPicId = gSaveBlock2Ptr->playerGender; + + LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_818CC24, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_120; +} + +static void sub_818CC24(u8 taskId) +{ + if (gTasks[taskId].data[1] < 24) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_818BA6C(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_818BA6C(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_818BA6C(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_8189D40; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void RecordedPlayerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + RecordedPlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_818CDF4; + } +} + +static void sub_818CDF4(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + RecordedPlayerBufferExecCompleted(); + } +} + +static void RecordedPlayerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd50(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleSpriteInvisibility(void) +{ + if (AnimBankSpriteExists(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + RecordedPlayerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void RecordedPlayerHandleLinkStandbyMsg(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleResetActionMoveSelection(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + RecordedPlayerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_121(void) +{ +} From 5b703079627cf11a123e3f1a7e7f0e5e0fbeb9ed Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 13:36:55 +0200 Subject: [PATCH 09/29] revert merge coz its bugged --- Makefile | 4 +- asm/decoration.s | 7167 +++++++++++++++ asm/decoration_inventory.s | 459 + asm/pokemon_summary_screen.s | 7826 +++++++++++++++++ asm/secret_base.s | 2 +- asm/trader.s | 10 +- data/cute_sketch.s | 2 +- data/decoration.s | 86 + data/graphics.s | 5 +- .../decorations/decoration_graphics.inc | 252 - data/pokemon_summary_screen.s | 5 +- data/strings.s | 28 +- graphics/decorations/decor_attract_mat.pal | 19 - graphics/decorations/decor_attract_mat.png | Bin 307 -> 0 bytes graphics/decorations/decor_big_plant.pal | 19 - graphics/decorations/decor_big_plant.png | Bin 310 -> 0 bytes graphics/decorations/decor_blastoise_doll.pal | 19 - graphics/decorations/decor_blastoise_doll.png | Bin 371 -> 0 bytes graphics/decorations/decor_blue_brick.pal | 19 - graphics/decorations/decor_blue_brick.png | Bin 226 -> 0 bytes graphics/decorations/decor_blue_tent.pal | 19 - graphics/decorations/decor_blue_tent.png | Bin 321 -> 0 bytes graphics/decorations/decor_breakable_door.pal | 19 - graphics/decorations/decor_breakable_door.png | Bin 274 -> 0 bytes graphics/decorations/decor_brick_desk.pal | 19 - graphics/decorations/decor_brick_desk.png | Bin 270 -> 0 bytes graphics/decorations/decor_camp_desk.pal | 19 - graphics/decorations/decor_camp_desk.png | Bin 265 -> 0 bytes graphics/decorations/decor_charizard_doll.pal | 19 - graphics/decorations/decor_charizard_doll.png | Bin 349 -> 0 bytes graphics/decorations/decor_colorful_plant.pal | 19 - graphics/decorations/decor_colorful_plant.png | Bin 371 -> 0 bytes graphics/decorations/decor_comfort_desk.pal | 19 - graphics/decorations/decor_comfort_desk.png | Bin 320 -> 0 bytes graphics/decorations/decor_fire_blast_mat.pal | 19 - graphics/decorations/decor_fire_blast_mat.png | Bin 287 -> 0 bytes graphics/decorations/decor_fissure_mat.pal | 19 - graphics/decorations/decor_fissure_mat.png | Bin 290 -> 0 bytes graphics/decorations/decor_glass_ornament.pal | 19 - graphics/decorations/decor_glass_ornament.png | Bin 292 -> 0 bytes graphics/decorations/decor_gorgeous_plant.pal | 19 - graphics/decorations/decor_gorgeous_plant.png | Bin 332 -> 0 bytes graphics/decorations/decor_hard_desk.pal | 19 - graphics/decorations/decor_hard_desk.png | Bin 325 -> 0 bytes graphics/decorations/decor_heavy_desk.pal | 19 - graphics/decorations/decor_heavy_desk.png | Bin 268 -> 0 bytes graphics/decorations/decor_lapras_doll.pal | 19 - graphics/decorations/decor_lapras_doll.png | Bin 349 -> 0 bytes .../decorations/decor_powder_snow_mat.pal | 19 - .../decorations/decor_powder_snow_mat.png | Bin 302 -> 0 bytes graphics/decorations/decor_pretty_desk.pal | 19 - graphics/decorations/decor_pretty_desk.png | Bin 296 -> 0 bytes graphics/decorations/decor_pretty_flowers.pal | 19 - graphics/decorations/decor_pretty_flowers.png | Bin 318 -> 0 bytes graphics/decorations/decor_ragged_desk.pal | 19 - graphics/decorations/decor_ragged_desk.png | Bin 257 -> 0 bytes graphics/decorations/decor_red_brick.pal | 19 - graphics/decorations/decor_red_brick.png | Bin 226 -> 0 bytes graphics/decorations/decor_red_plant.pal | 19 - graphics/decorations/decor_red_plant.png | Bin 300 -> 0 bytes graphics/decorations/decor_red_tent.pal | 19 - graphics/decorations/decor_red_tent.png | Bin 317 -> 0 bytes graphics/decorations/decor_regice_doll.pal | 19 - graphics/decorations/decor_regice_doll.png | Bin 346 -> 0 bytes graphics/decorations/decor_regirock_doll.pal | 19 - graphics/decorations/decor_regirock_doll.png | Bin 331 -> 0 bytes graphics/decorations/decor_registeel_doll.pal | 19 - graphics/decorations/decor_registeel_doll.png | Bin 351 -> 0 bytes graphics/decorations/decor_rhydon_doll.pal | 19 - graphics/decorations/decor_rhydon_doll.png | Bin 367 -> 0 bytes graphics/decorations/decor_sand_ornament.pal | 19 - graphics/decorations/decor_sand_ornament.png | Bin 286 -> 0 bytes graphics/decorations/decor_slide.pal | 19 - graphics/decorations/decor_slide.png | Bin 293 -> 0 bytes graphics/decorations/decor_snorlax_doll.pal | 19 - graphics/decorations/decor_snorlax_doll.png | Bin 337 -> 0 bytes graphics/decorations/decor_solid_board.pal | 19 - graphics/decorations/decor_solid_board.png | Bin 221 -> 0 bytes graphics/decorations/decor_spikes_mat.pal | 19 - graphics/decorations/decor_spikes_mat.png | Bin 302 -> 0 bytes graphics/decorations/decor_stand.pal | 19 - graphics/decorations/decor_stand.png | Bin 264 -> 0 bytes graphics/decorations/decor_surf_mat.pal | 19 - graphics/decorations/decor_surf_mat.png | Bin 298 -> 0 bytes graphics/decorations/decor_thunder_mat.pal | 19 - graphics/decorations/decor_thunder_mat.png | Bin 315 -> 0 bytes graphics/decorations/decor_tire.pal | 19 - graphics/decorations/decor_tire.png | Bin 303 -> 0 bytes graphics/decorations/decor_tropical_plant.pal | 19 - graphics/decorations/decor_tropical_plant.png | Bin 307 -> 0 bytes graphics/decorations/decor_venusaur_doll.pal | 19 - graphics/decorations/decor_venusaur_doll.png | Bin 393 -> 0 bytes graphics/decorations/decor_wailmer_doll.pal | 19 - graphics/decorations/decor_wailmer_doll.png | Bin 320 -> 0 bytes graphics/decorations/decor_yellow_brick.pal | 19 - graphics/decorations/decor_yellow_brick.png | Bin 226 -> 0 bytes graphics/decorations/unk_85a6bb0.pal | 19 - graphics/decorations/unk_85a7308.pal | 19 - graphics/decorations/unk_85a7328.pal | 19 - graphics/misc/decoration_unk_85a7358.png | Bin 87 -> 0 bytes include/battle.h | 22 - include/data/decoration/description.h | 581 -- include/data/decoration/header.h | 1100 --- include/data/decoration/icon.h | 132 - include/data/decoration/tilemaps.h | 239 - include/data/decoration/tiles.h | 646 -- include/decoration.h | 53 - include/decoration_inventory.h | 10 - include/event_scripts.h | 4 - include/field_map_obj.h | 1 - include/field_screen.h | 12 - include/fieldmap.h | 3 - include/global.h | 6 +- include/graphics.h | 95 - include/international_string_util.h | 8 +- include/item_icon.h | 17 - include/list_menu.h | 54 - include/map_object_constants.h | 239 - include/menu.h | 17 +- include/menu_helpers.h | 9 - include/menu_indicators.h | 12 - include/new_menu_helpers.h | 7 - include/overworld.h | 4 - include/player_pc.h | 12 - include/secret_base.h | 1 - include/strings.h | 34 - include/tilesets.h | 13 - include/trader.h | 11 - include/tv.h | 1 - ld_script.txt | 7 +- src/decoration.c | 2781 ------ src/decoration_inventory.c | 189 - src/international_string_util.c | 8 +- src/pokemon_summary_screen.c | 3679 -------- src/start_menu.c | 2 +- src/tv.c | 2 +- sym_ewram.txt | 68 +- 137 files changed, 15649 insertions(+), 11131 deletions(-) create mode 100644 asm/decoration.s create mode 100644 asm/decoration_inventory.s create mode 100644 data/decoration.s delete mode 100644 data/graphics/decorations/decoration_graphics.inc delete mode 100644 graphics/decorations/decor_attract_mat.pal delete mode 100644 graphics/decorations/decor_attract_mat.png delete mode 100644 graphics/decorations/decor_big_plant.pal delete mode 100644 graphics/decorations/decor_big_plant.png delete mode 100644 graphics/decorations/decor_blastoise_doll.pal delete mode 100644 graphics/decorations/decor_blastoise_doll.png delete mode 100644 graphics/decorations/decor_blue_brick.pal delete mode 100644 graphics/decorations/decor_blue_brick.png delete mode 100644 graphics/decorations/decor_blue_tent.pal delete mode 100644 graphics/decorations/decor_blue_tent.png delete mode 100644 graphics/decorations/decor_breakable_door.pal delete mode 100644 graphics/decorations/decor_breakable_door.png delete mode 100644 graphics/decorations/decor_brick_desk.pal delete mode 100644 graphics/decorations/decor_brick_desk.png delete mode 100644 graphics/decorations/decor_camp_desk.pal delete mode 100644 graphics/decorations/decor_camp_desk.png delete mode 100644 graphics/decorations/decor_charizard_doll.pal delete mode 100644 graphics/decorations/decor_charizard_doll.png delete mode 100644 graphics/decorations/decor_colorful_plant.pal delete mode 100644 graphics/decorations/decor_colorful_plant.png delete mode 100644 graphics/decorations/decor_comfort_desk.pal delete mode 100644 graphics/decorations/decor_comfort_desk.png delete mode 100644 graphics/decorations/decor_fire_blast_mat.pal delete mode 100644 graphics/decorations/decor_fire_blast_mat.png delete mode 100644 graphics/decorations/decor_fissure_mat.pal delete mode 100644 graphics/decorations/decor_fissure_mat.png delete mode 100644 graphics/decorations/decor_glass_ornament.pal delete mode 100644 graphics/decorations/decor_glass_ornament.png delete mode 100644 graphics/decorations/decor_gorgeous_plant.pal delete mode 100644 graphics/decorations/decor_gorgeous_plant.png delete mode 100644 graphics/decorations/decor_hard_desk.pal delete mode 100644 graphics/decorations/decor_hard_desk.png delete mode 100644 graphics/decorations/decor_heavy_desk.pal delete mode 100644 graphics/decorations/decor_heavy_desk.png delete mode 100644 graphics/decorations/decor_lapras_doll.pal delete mode 100644 graphics/decorations/decor_lapras_doll.png delete mode 100644 graphics/decorations/decor_powder_snow_mat.pal delete mode 100644 graphics/decorations/decor_powder_snow_mat.png delete mode 100644 graphics/decorations/decor_pretty_desk.pal delete mode 100644 graphics/decorations/decor_pretty_desk.png delete mode 100644 graphics/decorations/decor_pretty_flowers.pal delete mode 100644 graphics/decorations/decor_pretty_flowers.png delete mode 100644 graphics/decorations/decor_ragged_desk.pal delete mode 100644 graphics/decorations/decor_ragged_desk.png delete mode 100644 graphics/decorations/decor_red_brick.pal delete mode 100644 graphics/decorations/decor_red_brick.png delete mode 100644 graphics/decorations/decor_red_plant.pal delete mode 100644 graphics/decorations/decor_red_plant.png delete mode 100644 graphics/decorations/decor_red_tent.pal delete mode 100644 graphics/decorations/decor_red_tent.png delete mode 100644 graphics/decorations/decor_regice_doll.pal delete mode 100644 graphics/decorations/decor_regice_doll.png delete mode 100644 graphics/decorations/decor_regirock_doll.pal delete mode 100644 graphics/decorations/decor_regirock_doll.png delete mode 100644 graphics/decorations/decor_registeel_doll.pal delete mode 100644 graphics/decorations/decor_registeel_doll.png delete mode 100644 graphics/decorations/decor_rhydon_doll.pal delete mode 100644 graphics/decorations/decor_rhydon_doll.png delete mode 100644 graphics/decorations/decor_sand_ornament.pal delete mode 100644 graphics/decorations/decor_sand_ornament.png delete mode 100644 graphics/decorations/decor_slide.pal delete mode 100644 graphics/decorations/decor_slide.png delete mode 100644 graphics/decorations/decor_snorlax_doll.pal delete mode 100644 graphics/decorations/decor_snorlax_doll.png delete mode 100644 graphics/decorations/decor_solid_board.pal delete mode 100644 graphics/decorations/decor_solid_board.png delete mode 100644 graphics/decorations/decor_spikes_mat.pal delete mode 100644 graphics/decorations/decor_spikes_mat.png delete mode 100644 graphics/decorations/decor_stand.pal delete mode 100644 graphics/decorations/decor_stand.png delete mode 100644 graphics/decorations/decor_surf_mat.pal delete mode 100644 graphics/decorations/decor_surf_mat.png delete mode 100644 graphics/decorations/decor_thunder_mat.pal delete mode 100644 graphics/decorations/decor_thunder_mat.png delete mode 100644 graphics/decorations/decor_tire.pal delete mode 100644 graphics/decorations/decor_tire.png delete mode 100644 graphics/decorations/decor_tropical_plant.pal delete mode 100644 graphics/decorations/decor_tropical_plant.png delete mode 100644 graphics/decorations/decor_venusaur_doll.pal delete mode 100644 graphics/decorations/decor_venusaur_doll.png delete mode 100644 graphics/decorations/decor_wailmer_doll.pal delete mode 100644 graphics/decorations/decor_wailmer_doll.png delete mode 100644 graphics/decorations/decor_yellow_brick.pal delete mode 100644 graphics/decorations/decor_yellow_brick.png delete mode 100644 graphics/decorations/unk_85a6bb0.pal delete mode 100644 graphics/decorations/unk_85a7308.pal delete mode 100644 graphics/decorations/unk_85a7328.pal delete mode 100644 graphics/misc/decoration_unk_85a7358.png delete mode 100644 include/data/decoration/description.h delete mode 100644 include/data/decoration/header.h delete mode 100644 include/data/decoration/icon.h delete mode 100644 include/data/decoration/tilemaps.h delete mode 100644 include/data/decoration/tiles.h delete mode 100644 include/field_screen.h delete mode 100644 include/graphics.h delete mode 100644 include/item_icon.h delete mode 100644 include/list_menu.h delete mode 100644 include/map_object_constants.h delete mode 100644 include/menu_indicators.h delete mode 100644 include/player_pc.h delete mode 100644 include/tilesets.h delete mode 100644 include/trader.h delete mode 100644 src/decoration.c delete mode 100644 src/decoration_inventory.c delete mode 100755 src/pokemon_summary_screen.c diff --git a/Makefile b/Makefile index 4a1f94352..ca8348f68 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ CPP := $(DEVKITARM)/bin/arm-none-eabi-cpp CPPFLAGS := -I tools/agbcc/include -iquote include -nostdinc -undef LD := $(DEVKITARM)/bin/arm-none-eabi-ld -LDFLAGS = -Map ../../$(MAP) +LDFLAGS = -Map $(MAP) OBJCOPY := $(DEVKITARM)/bin/arm-none-eabi-objcopy @@ -102,7 +102,7 @@ $(C_BUILDDIR)/m4a_2.o: CC1 := tools/agbcc/bin/old_agbcc $(C_BUILDDIR)/m4a_4.o: CC1 := tools/agbcc/bin/old_agbcc ifeq ($(NODEP),) -$(C_BUILDDIR)/%.o: c_dep = $(shell $(SCANINC) -I include $(C_SUBDIR)/$*.c) +$(C_BUILDDIR)/%.o: c_dep = $(shell $(SCANINC) $(C_SUBDIR)/$*.c) else $(C_BUILDDIR)/%.o: c_dep := endif diff --git a/asm/decoration.s b/asm/decoration.s new file mode 100644 index 000000000..0798e3165 --- /dev/null +++ b/asm/decoration.s @@ -0,0 +1,7167 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + thumb_func_start sub_8126968 +sub_8126968: @ 8126968 + push {lr} + ldr r3, =gUnknown_0203A173 + ldrb r0, [r3] + cmp r0, 0x7 + bhi _0812697E + ldr r2, =gUnknown_0203A14C + ldr r1, =gDecorationInventories + lsls r0, 3 + adds r0, r1 + ldr r0, [r0] + str r0, [r2] +_0812697E: + ldr r2, =gUnknown_0203A17C + ldrb r0, [r2, 0x9] + cmp r0, 0 + bne _08126996 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x00001aae + adds r1, r0, r3 + str r1, [r2] + ldr r1, =0x00001abe + adds r0, r1 + str r0, [r2, 0x4] +_08126996: + ldrb r0, [r2, 0x9] + cmp r0, 0x1 + bne _081269AC + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x0000271c + adds r1, r0, r3 + str r1, [r2] + ldr r1, =0x00002728 + adds r0, r1 + str r0, [r2, 0x4] +_081269AC: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126968 + + thumb_func_start sub_81269D4 +sub_81269D4: @ 81269D4 + push {r4,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r1, r0, 24 + ldr r0, =gUnknown_0203A188 + adds r4, r1, r0 + cmp r1, 0 + bne _08126A28 + ldr r0, =gUnknown_085A6B90 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + ldr r0, =gUnknown_085A6B48 + movs r1, 0x4 + bl GetMaxWidthInMenuTable + lsls r0, 24 + ldr r2, =0x00ffffff + ldr r1, [sp] + ands r1, r2 + orrs r1, r0 + str r1, [sp] + lsrs r0, r1, 24 + cmp r0, 0x12 + bls _08126A14 + adds r0, r2, 0 + ands r0, r1 + movs r1, 0x90 + lsls r1, 21 + orrs r0, r1 + str r0, [sp] +_08126A14: + mov r0, sp + b _08126A2E + .pool +_08126A28: + lsls r0, r1, 3 + ldr r1, =gUnknown_085A6B90 + adds r0, r1 +_08126A2E: + bl AddWindow + strb r0, [r4] + ldrb r0, [r4] + movs r2, 0x85 + lsls r2, 2 + movs r1, 0 + movs r3, 0xE + bl SetWindowBorderStyle + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + ldrb r0, [r4] + add sp, 0x8 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81269D4 + + thumb_func_start sub_8126A58 +sub_8126A58: @ 8126A58 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_0203A188 + adds r4, r0 + ldrb r0, [r4] + movs r1, 0 + bl sub_8198070 + ldrb r0, [r4] + bl ClearWindowTilemap + ldrb r0, [r4] + bl RemoveWindow + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126A58 + + thumb_func_start sub_8126A88 +sub_8126A88: @ 8126A88 + push {r4,lr} + movs r0, 0 + bl sub_81269D4 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r2, =gUnknown_085A6B48 + adds r0, r4, 0 + movs r1, 0x4 + bl PrintMenuTable + ldr r0, =gUnknown_0203A150 + ldrb r2, [r0] + adds r0, r4, 0 + movs r1, 0x4 + bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126A88 + + thumb_func_start sub_8126ABC +sub_8126ABC: @ 8126ABC + push {lr} + ldr r1, =gUnknown_0203A150 + movs r0, 0 + strb r0, [r1] + bl ScriptContext2_Enable + bl sub_8126A88 + bl sub_8126C08 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126ABC + + thumb_func_start sub_8126AD8 +sub_8126AD8: @ 8126AD8 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8126ABC + ldr r2, =gUnknown_0203A17C + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x00001aae + adds r1, r0, r3 + str r1, [r2] + ldr r1, =0x00001abe + adds r0, r1 + str r0, [r2, 0x4] + movs r1, 0 + movs r0, 0x10 + strb r0, [r2, 0x8] + strb r1, [r2, 0x9] + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8126B80 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126AD8 + + thumb_func_start sub_8126B2C +sub_8126B2C: @ 8126B2C + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8126ABC + ldr r2, =gUnknown_0203A17C + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x0000271c + adds r1, r0, r3 + str r1, [r2] + ldr r1, =0x00002728 + adds r0, r1 + str r0, [r2, 0x4] + movs r0, 0xC + strb r0, [r2, 0x8] + movs r0, 0x1 + strb r0, [r2, 0x9] + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8126B80 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126B2C + + thumb_func_start sub_8126B80 +sub_8126B80: @ 8126B80 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08126C00 + bl GetMenuCursorPos + lsls r0, 24 + lsrs r4, r0, 24 + bl ProcessMenuInput + lsls r0, 24 + asrs r1, r0, 24 + movs r0, 0x2 + negs r0, r0 + cmp r1, r0 + beq _08126BD8 + adds r0, 0x1 + cmp r1, r0 + beq _08126BF4 + movs r0, 0x5 + bl PlaySE + ldr r1, =gUnknown_085A6B48 + ldr r0, =gUnknown_0203A150 + ldrb r0, [r0] + lsls r0, 3 + adds r1, 0x4 + adds r0, r1 + ldr r1, [r0] + adds r0, r5, 0 + bl _call_via_r1 + b _08126C00 + .pool +_08126BD8: + bl GetMenuCursorPos + ldr r1, =gUnknown_0203A150 + strb r0, [r1] + lsls r0, r4, 24 + asrs r0, 24 + ldrb r1, [r1] + cmp r0, r1 + beq _08126C00 + bl sub_8126C08 + b _08126C00 + .pool +_08126BF4: + movs r0, 0x5 + bl PlaySE + adds r0, r5, 0 + bl sub_8126D6C +_08126C00: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8126B80 + + thumb_func_start sub_8126C08 +sub_8126C08: @ 8126C08 + push {lr} + sub sp, 0x10 + movs r0, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r1, =gUnknown_085A6B68 + ldr r0, =gUnknown_0203A150 + ldrb r0, [r0] + lsls r0, 2 + adds r0, r1 + ldr r2, [r0] + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + movs r3, 0 + bl AddTextPrinterParametrized + add sp, 0x10 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126C08 + + thumb_func_start sub_8126C48 +sub_8126C48: @ 8126C48 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + bl sub_8161B10 + lsls r0, 24 + cmp r0, 0 + bne _08126C7C + ldr r4, =gStringVar4 + ldr r1, =gText_NoDecorations + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8126DA4 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + b _08126C96 + .pool +_08126C7C: + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r2, 0 + movs r1, 0 + strh r1, [r0, 0x1E] + ldr r0, =gUnknown_0203A173 + strb r2, [r0] + adds r0, r5, 0 + bl sub_8126DCC +_08126C96: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126C48 + + thumb_func_start sub_8126CA4 +sub_8126CA4: @ 8126CA4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + adds r0, r5, 0 + bl sub_81299AC + lsls r0, 24 + cmp r0, 0 + bne _08126CD8 + ldr r4, =gStringVar4 + ldr r1, =gText_NoDecorationsInUse + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8126DA4 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + b _08126D00 + .pool +_08126CD8: + movs r0, 0 + bl sub_8126A58 + movs r0, 0 + movs r1, 0 + bl sub_8197434 + movs r0, 0x1 + movs r1, 0 + bl fade_screen + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0xC] + ldr r1, =sub_8129ABC + str r1, [r0] +_08126D00: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126CA4 + + thumb_func_start sub_8126D10 +sub_8126D10: @ 8126D10 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + bl sub_8161B10 + lsls r0, 24 + cmp r0, 0 + bne _08126D44 + ldr r4, =gStringVar4 + ldr r1, =gText_NoDecorations + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8126DA4 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + b _08126D5E + .pool +_08126D44: + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r2, 0 + movs r1, 0x1 + strh r1, [r0, 0x1E] + ldr r0, =gUnknown_0203A173 + strb r2, [r0] + adds r0, r5, 0 + bl sub_8126DCC +_08126D5E: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126D10 + + thumb_func_start sub_8126D6C +sub_8126D6C: @ 8126D6C + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + movs r0, 0 + bl sub_8126A58 + ldr r0, =gUnknown_0203A17C + ldrb r0, [r0, 0x9] + cmp r0, 0 + bne _08126D98 + ldr r0, =gUnknown_0823B4E8 + bl ScriptContext1_SetupScript + adds r0, r4, 0 + bl DestroyTask + b _08126D9E + .pool +_08126D98: + adds r0, r4, 0 + bl sub_816B060 +_08126D9E: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8126D6C + + thumb_func_start sub_8126DA4 +sub_8126DA4: @ 8126DA4 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8126C08 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8126B80 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126DA4 + + thumb_func_start sub_8126DCC +sub_8126DCC: @ 8126DCC + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_085A6BB0 + movs r1, 0xD0 + movs r2, 0x20 + bl LoadPalette + movs r0, 0 + movs r1, 0 + bl sub_8197434 + movs r0, 0 + bl sub_8126A58 + adds r0, r4, 0 + bl sub_8126DFC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126DCC + + thumb_func_start sub_8126DFC +sub_8126DFC: @ 8126DFC + push {r4,r5,lr} + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + movs r0, 0x1 + bl sub_81269D4 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r5, 0 + bl sub_8126E8C + ldr r0, =gUnknown_0203A173 + ldrb r2, [r0] + adds r0, r4, 0 + movs r1, 0x9 + bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8127088 + str r1, [r0] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126DFC + + thumb_func_start sub_8126E44 +sub_8126E44: @ 8126E44 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r5, =gUnknown_0203A188 + ldrb r0, [r5, 0x1] + movs r1, 0x11 + bl FillWindowPixelBuffer + adds r0, r4, 0 + bl sub_8126E8C + ldrb r0, [r5, 0x1] + ldr r1, =gUnknown_0203A173 + ldrb r2, [r1] + movs r1, 0x9 + bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8127088 + str r1, [r0] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126E44 + + thumb_func_start sub_8126E8C +sub_8126E8C: @ 8126E8C + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0xC + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r1, r0, r1 + ldr r0, =gUnknown_0203A188 + ldrb r5, [r0, 0x1] + ldr r0, =gUnknown_0203A17C + ldrb r0, [r0, 0x9] + movs r2, 0 + mov r8, r2 + cmp r0, 0x1 + bne _08126EC0 + movs r2, 0x16 + ldrsh r0, [r1, r2] + cmp r0, 0 + bne _08126EC0 + movs r0, 0x1 + mov r8, r0 +_08126EC0: + movs r4, 0 + lsls r2, r6, 2 + mov r9, r2 + movs r7, 0xFF +_08126EC8: + mov r0, r8 + cmp r0, 0x1 + bne _08126EF8 + cmp r4, 0x6 + beq _08126EF8 + cmp r4, 0x7 + beq _08126EF8 + lsls r3, r4, 28 + lsrs r3, 24 + str r0, [sp] + str r7, [sp, 0x4] + adds r0, r5, 0 + adds r1, r4, 0 + movs r2, 0x8 + bl sub_8126F68 + b _08126F0C + .pool +_08126EF8: + lsls r3, r4, 28 + lsrs r3, 24 + movs r0, 0 + str r0, [sp] + str r7, [sp, 0x4] + adds r0, r5, 0 + adds r1, r4, 0 + movs r2, 0x8 + bl sub_8126F68 +_08126F0C: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x7 + bls _08126EC8 + ldr r0, =gTasks + mov r2, r9 + adds r1, r2, r6 + lsls r1, 3 + adds r1, r0 + movs r2, 0x1E + ldrsh r0, [r1, r2] + ldr r2, =gText_Cancel + cmp r0, 0x2 + bne _08126F2C + ldr r2, =gText_Exit +_08126F2C: + lsls r0, r4, 4 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + str r0, [sp, 0x8] + adds r0, r5, 0 + movs r1, 0x1 + movs r3, 0x8 + bl PrintTextOnWindow + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + add sp, 0xC + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126E8C + + thumb_func_start sub_8126F68 +sub_8126F68: @ 8126F68 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + ldr r4, [sp, 0x38] + ldr r6, [sp, 0x3C] + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0xC] + lsls r1, 24 + lsrs r1, 24 + mov r8, r1 + lsls r2, 24 + lsrs r7, r2, 24 + lsls r3, 24 + lsrs r5, r3, 24 + lsls r4, 24 + lsrs r1, r4, 24 + lsls r6, 24 + lsrs r6, 24 + mov r9, r6 + movs r0, 0x60 + str r0, [sp, 0x14] + cmp r7, 0x8 + bne _08126FA2 + movs r2, 0x68 + str r2, [sp, 0x14] +_08126FA2: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldr r4, =gStringVar4 + adds r0, r4, 0 + bl sub_8127058 + adds r0, r4, 0 + bl StringLength + lsls r0, 16 + lsrs r0, 16 + adds r6, r0, r4 + ldr r1, =gUnknown_085A6B28 + mov r2, r8 + lsls r0, r2, 2 + adds r0, r1 + ldr r1, [r0] + adds r0, r6, 0 + bl StringCopy + str r5, [sp] + mov r0, r9 + str r0, [sp, 0x4] + movs r2, 0 + mov r10, r2 + str r2, [sp, 0x8] + ldr r0, [sp, 0xC] + movs r1, 0x1 + adds r2, r4, 0 + adds r3, r7, 0 + bl PrintTextOnWindow + mov r0, r8 + bl sub_8161AD0 + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r6, 0 + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + adds r6, r0, 0 + movs r0, 0xBA + strb r0, [r6] + adds r6, 0x1 + ldr r1, =gDecorationInventories + mov r2, r8 + lsls r0, r2, 3 + adds r0, r1 + ldrb r1, [r0, 0x4] + adds r0, r6, 0 + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + movs r0, 0x1 + adds r1, r4, 0 + ldr r2, [sp, 0x14] + bl GetStringRightAlignXOffset + lsls r0, 24 + lsrs r7, r0, 24 + str r5, [sp] + mov r0, r9 + str r0, [sp, 0x4] + mov r2, r10 + str r2, [sp, 0x8] + ldr r0, [sp, 0xC] + movs r1, 0x1 + adds r2, r4, 0 + adds r3, r7, 0 + bl PrintTextOnWindow + add sp, 0x18 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8126F68 + + thumb_func_start sub_8127058 +sub_8127058: @ 8127058 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r4, r1, 24 + lsrs r4, 24 + ldr r1, =gText_Color161Shadow161 + bl StringCopy + cmp r4, 0x1 + bne _08127078 + movs r0, 0x4 + strb r0, [r5, 0x2] + movs r0, 0x5 + b _0812707E + .pool +_08127078: + movs r0, 0x2 + strb r0, [r5, 0x2] + movs r0, 0x3 +_0812707E: + strb r0, [r5, 0x5] + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8127058 + + thumb_func_start sub_8127088 +sub_8127088: @ 8127088 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _081270DE + bl ProcessMenuInput + lsls r0, 24 + lsrs r4, r0, 24 + asrs r1, r0, 24 + movs r0, 0x1 + negs r0, r0 + cmp r1, r0 + beq _081270C0 + cmp r1, r0 + bgt _081270BC + subs r0, 0x1 + cmp r1, r0 + beq _081270DE + b _081270CE + .pool +_081270BC: + cmp r1, 0x8 + bne _081270CE +_081270C0: + movs r0, 0x5 + bl PlaySE + adds r0, r5, 0 + bl sub_812719C + b _081270DE +_081270CE: + movs r0, 0x5 + bl PlaySE + ldr r0, =gUnknown_0203A173 + strb r4, [r0] + adds r0, r5, 0 + bl sub_81270E8 +_081270DE: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127088 + + thumb_func_start sub_81270E8 +sub_81270E8: @ 81270E8 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r4, =gUnknown_0203A173 + ldrb r0, [r4] + bl sub_8161AD0 + ldr r1, =gUnknown_0203A151 + strb r0, [r1] + lsls r0, 24 + cmp r0, 0 + beq _08127154 + ldrb r0, [r4] + bl sub_8161A38 + ldr r2, =gUnknown_0203A14C + ldr r1, =gDecorationInventories + ldrb r0, [r4] + lsls r0, 3 + adds r0, r1 + ldr r0, [r0] + str r0, [r2] + adds r0, r5, 0 + bl sub_81279B4 + ldr r0, =gUnknown_0203A170 + movs r1, 0 + strh r1, [r0] + ldr r0, =gUnknown_0203A16E + strh r1, [r0] + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8127620 + str r1, [r0] + b _0812716E + .pool +_08127154: + movs r0, 0x1 + bl sub_8126A58 + ldr r4, =gStringVar4 + ldr r1, =gText_NoDecorations + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8127180 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField +_0812716E: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81270E8 + + thumb_func_start sub_8127180 +sub_8127180: @ 8127180 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0 + bl sub_8197434 + adds r0, r4, 0 + bl sub_8126DFC + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8127180 + + thumb_func_start sub_812719C +sub_812719C: @ 812719C + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r1, =gTasks + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r1 + movs r1, 0x1E + ldrsh r0, [r0, r1] + cmp r0, 0x2 + beq _081271C0 + adds r0, r2, 0 + bl sub_81271CC + b _081271C6 + .pool +_081271C0: + adds r0, r2, 0 + bl sub_8127268 +_081271C6: + pop {r0} + bx r0 + thumb_func_end sub_812719C + + thumb_func_start sub_81271CC +sub_81271CC: @ 81271CC + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + bl sub_8126A58 + bl sub_8126A88 + movs r0, 0 + movs r1, 0 + bl sub_81973C4 + bl sub_8126C08 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8126B80 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81271CC + + thumb_func_start sub_8127208 +sub_8127208: @ 8127208 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_085A6BB0 + movs r1, 0xD0 + movs r2, 0x20 + bl LoadPalette + movs r0, 0 + movs r1, 0 + bl sub_8197434 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r2, 0 + movs r1, 0x2 + strh r1, [r0, 0x1E] + ldr r0, =gUnknown_0203A173 + strb r2, [r0] + adds r0, r4, 0 + bl sub_8126DFC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127208 + + thumb_func_start sub_8127250 +sub_8127250: @ 8127250 + push {lr} + lsls r1, 24 + ldr r2, =gUnknown_085A6B28 + lsrs r1, 22 + adds r1, r2 + ldr r1, [r1] + bl StringCopy + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127250 + + thumb_func_start sub_8127268 +sub_8127268: @ 8127268 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + bl sub_8126A58 + adds r0, r4, 0 + bl sub_8133E1C + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8127268 + + thumb_func_start sub_8127284 +sub_8127284: @ 8127284 + push {lr} + ldr r3, =gUnknown_0203A18C + ldr r2, [r3] + ldr r0, =gUnknown_0203A151 + ldrb r0, [r0] + adds r0, 0x1 + movs r1, 0xA4 + lsls r1, 3 + adds r2, r1 + strb r0, [r2] + ldr r0, [r3] + adds r1, r0, r1 + ldrb r1, [r1] + cmp r1, 0x8 + bls _081272B8 + ldr r2, =0x00000521 + adds r1, r0, r2 + movs r0, 0x8 + strb r0, [r1] + b _081272BE + .pool +_081272B8: + ldr r2, =0x00000521 + adds r0, r2 + strb r1, [r0] +_081272BE: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127284 + + thumb_func_start sub_81272C8 +sub_81272C8: @ 81272C8 + push {r4,lr} + ldr r0, =gUnknown_0203A170 + ldr r1, =gUnknown_0203A16E + ldr r2, =gUnknown_0203A18C + ldr r3, [r2] + ldr r4, =0x00000521 + adds r2, r3, r4 + ldrb r2, [r2] + subs r4, 0x1 + adds r3, r4 + ldrb r3, [r3] + bl sub_812225C + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81272C8 + + thumb_func_start sub_81272F8 +sub_81272F8: @ 81272F8 + push {r4,lr} + sub sp, 0x4 + ldr r0, =gUnknown_0203A170 + ldr r1, =gUnknown_0203A16E + ldr r2, =gUnknown_0203A18C + ldr r3, [r2] + ldr r4, =0x00000521 + adds r2, r3, r4 + ldrb r2, [r2] + subs r4, 0x1 + adds r3, r4 + ldrb r3, [r3] + movs r4, 0x8 + str r4, [sp] + bl sub_8122298 + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81272F8 + + thumb_func_start sub_8127330 +sub_8127330: @ 8127330 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + ldr r0, =gUnknown_0203A173 + ldrb r0, [r0] + subs r0, 0x6 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _08127378 + ldr r0, =gUnknown_0203A17C + ldrb r0, [r0, 0x9] + cmp r0, 0x1 + bne _08127378 + movs r2, 0x16 + ldrsh r0, [r1, r2] + cmp r0, 0 + bne _08127378 + ldr r0, =gStringVar1 + movs r1, 0x1 + bl sub_8127058 + b _08127380 + .pool +_08127378: + ldr r0, =gStringVar1 + movs r1, 0 + bl sub_8127058 +_08127380: + movs r6, 0 + ldr r1, =gUnknown_0203A18C + ldr r0, [r1] + movs r3, 0xA4 + lsls r3, 3 + adds r0, r3 + ldrb r0, [r0] + subs r0, 0x1 + cmp r6, r0 + bge _081273D6 + adds r5, r1, 0 +_08127396: + lsls r4, r6, 1 + adds r4, r6 + lsls r4, 3 + movs r0, 0xA4 + lsls r0, 1 + adds r4, r0 + ldr r0, [r5] + adds r0, r4 + ldr r1, =gUnknown_0203A14C + ldr r1, [r1] + adds r1, r6 + ldrb r1, [r1] + bl sub_8127454 + ldr r1, [r5] + lsls r2, r6, 3 + adds r0, r1, r2 + adds r4, r1, r4 + str r4, [r0] + adds r0, r1, 0x4 + adds r0, r2 + str r6, [r0] + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 + movs r2, 0xA4 + lsls r2, 3 + adds r1, r2 + ldrb r0, [r1] + subs r0, 0x1 + cmp r6, r0 + blt _08127396 +_081273D6: + ldr r5, =gUnknown_0203A18C + lsls r4, r6, 1 + adds r4, r6 + lsls r4, 3 + movs r3, 0xA4 + lsls r3, 1 + adds r4, r3 + ldr r0, [r5] + adds r0, r4 + ldr r1, =gText_Cancel + bl StringCopy + ldr r0, [r5] + lsls r2, r6, 3 + adds r1, r0, r2 + adds r4, r0, r4 + str r4, [r1] + adds r0, 0x4 + adds r0, r2 + movs r1, 0x2 + negs r1, r1 + str r1, [r0] + ldr r2, =gUnknown_03006310 + adds r1, r2, 0 + ldr r0, =gUnknown_085A6BD0 + ldm r0!, {r3,r4,r6} + stm r1!, {r3,r4,r6} + ldm r0!, {r3,r4,r6} + stm r1!, {r3,r4,r6} + ldr r0, =gUnknown_0203A188 + ldrb r0, [r0, 0x1] + strb r0, [r2, 0x10] + ldr r0, [r5] + movs r4, 0xA4 + lsls r4, 3 + adds r1, r0, r4 + ldrb r1, [r1] + strh r1, [r2, 0xC] + str r0, [r2] + ldr r6, =0x00000521 + adds r0, r6 + ldrb r0, [r0] + strh r0, [r2, 0xE] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127330 + + thumb_func_start sub_8127454 +sub_8127454: @ 8127454 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r4, r1, 16 + lsrs r4, 16 + ldr r1, =gStringVar1 + bl StringCopy + lsls r4, 5 + ldr r0, =gDecorations + 1 + adds r4, r0 + adds r0, r5, 0 + adds r1, r4, 0 + bl StringAppend + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127454 + + thumb_func_start sub_8127480 +sub_8127480: @ 8127480 + push {r4,lr} + adds r4, r0, 0 + lsls r1, 24 + lsrs r1, 24 + cmp r1, 0x1 + beq _08127492 + movs r0, 0x5 + bl PlaySE +_08127492: + adds r0, r4, 0 + bl sub_8127744 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8127480 + + thumb_func_start sub_81274A0 +sub_81274A0: @ 81274A0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r6, r0, 24 + mov r8, r6 + lsls r2, 24 + lsrs r5, r2, 24 + adds r7, r5, 0 + movs r0, 0x2 + negs r0, r0 + cmp r1, r0 + beq _081274F6 + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl sub_81277BC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081274DC + adds r3, r5, 0x2 + adds r0, r6, 0 + movs r1, 0x18 + movs r2, 0x5C + bl blit_move_info_icon + b _081274F6 +_081274DC: + adds r0, r4, 0 + bl sub_81277E8 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081274F6 + adds r3, r7, 0x2 + mov r0, r8 + movs r1, 0x19 + movs r2, 0x5C + bl blit_move_info_icon +_081274F6: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81274A0 + + thumb_func_start sub_8127500 +sub_8127500: @ 8127500 + push {r4,lr} + sub sp, 0x10 + ldr r4, =gUnknown_0203A18C + ldr r1, [r4] + ldr r2, =0x00000522 + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0xFF + bne _08127540 + subs r2, 0x2 + adds r0, r1, r2 + ldrb r0, [r0] + adds r2, 0x1 + adds r1, r2 + ldrb r1, [r1] + subs r0, r1 + str r0, [sp] + movs r0, 0x6E + str r0, [sp, 0x4] + str r0, [sp, 0x8] + ldr r0, =gUnknown_0203A170 + str r0, [sp, 0xC] + movs r0, 0x2 + movs r1, 0x3C + movs r2, 0xC + movs r3, 0x94 + bl AddScrollIndicatorArrowPairParametrized + ldr r1, [r4] + ldr r2, =0x00000522 + adds r1, r2 + strb r0, [r1] +_08127540: + add sp, 0x10 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127500 + + thumb_func_start sub_8127554 +sub_8127554: @ 8127554 + push {r4,lr} + ldr r4, =gUnknown_0203A18C + ldr r0, [r4] + ldr r2, =0x00000522 + adds r1, r0, r2 + ldrb r0, [r1] + cmp r0, 0xFF + beq _08127572 + bl RemoveScrollIndicatorArrowPair + ldr r0, [r4] + ldr r1, =0x00000522 + adds r0, r1 + movs r1, 0xFF + strb r1, [r0] +_08127572: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127554 + + thumb_func_start sub_8127580 +sub_8127580: @ 8127580 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + bl sub_81269D4 + adds r0, r4, 0 + bl sub_812759C + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8127580 + + thumb_func_start sub_812759C +sub_812759C: @ 812759C + push {r4-r6,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + lsls r5, r4, 2 + adds r5, r4 + lsls r5, 3 + ldr r0, =gTasks + 0x8 + adds r5, r0 + movs r0, 0x3 + bl sub_81269D4 + ldr r0, =gUnknown_0203A173 + ldrb r0, [r0] + bl sub_8127718 + ldr r6, =gUnknown_0203A18C + ldr r0, =0x00000524 + bl AllocZeroed + str r0, [r6] + ldr r1, =0x00000522 + adds r0, r1 + movs r1, 0xFF + strb r1, [r0] + bl sub_8127284 + bl sub_81272C8 + bl sub_81272F8 + adds r0, r4, 0 + bl sub_8127330 + ldr r0, =gUnknown_03006310 + ldr r1, =gUnknown_0203A170 + ldrh r1, [r1] + ldr r2, =gUnknown_0203A16E + ldrh r2, [r2] + bl ListMenuInit + lsls r0, 24 + lsrs r0, 24 + strh r0, [r5, 0x1A] + bl sub_8127500 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812759C + + thumb_func_start sub_8127620 +sub_8127620: @ 8127620 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r4, 0 + bl sub_812759C + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_812764C + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127620 + + thumb_func_start sub_812764C +sub_812764C: @ 812764C + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r5, r0, r1 + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08127700 + ldrb r0, [r5, 0x1A] + bl ListMenuHandleInput + adds r4, r0, 0 + ldrb r0, [r5, 0x1A] + ldr r7, =gUnknown_0203A170 + ldr r1, =gUnknown_0203A16E + mov r8, r1 + adds r1, r7, 0 + mov r2, r8 + bl get_coro_args_x18_x1A + movs r0, 0x2 + negs r0, r0 + cmp r4, r0 + beq _081276A4 + adds r0, 0x1 + cmp r4, r0 + bne _081276C4 + b _08127700 + .pool +_081276A4: + movs r0, 0x5 + bl PlaySE + ldr r0, =gUnknown_085A6B78 + movs r2, 0x16 + ldrsh r1, [r5, r2] + lsls r1, 3 + adds r0, 0x4 + adds r1, r0 + ldr r1, [r1] + adds r0, r6, 0 + bl _call_via_r1 + b _08127700 + .pool +_081276C4: + movs r0, 0x5 + bl PlaySE + ldr r0, =gUnknown_0203A172 + strb r4, [r0] + bl sub_8127554 + ldrb r0, [r5, 0x1A] + adds r1, r7, 0 + mov r2, r8 + bl sub_81AE6C8 + movs r0, 0x1 + bl sub_8126A58 + bl sub_81277A8 + ldr r0, =gUnknown_0203A18C + ldr r0, [r0] + bl Free + ldr r1, =gUnknown_085A6B78 + movs r2, 0x16 + ldrsh r0, [r5, r2] + lsls r0, 3 + adds r0, r1 + ldr r1, [r0] + adds r0, r6, 0 + bl _call_via_r1 +_08127700: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812764C + + thumb_func_start sub_8127718 +sub_8127718: @ 8127718 + push {r4,lr} + sub sp, 0x8 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x2 + bl sub_81269D4 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + str r1, [sp] + str r1, [sp, 0x4] + adds r1, r4, 0 + movs r2, 0 + movs r3, 0 + bl sub_8126F68 + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8127718 + + thumb_func_start sub_8127744 +sub_8127744: @ 8127744 + push {r4,r5,lr} + sub sp, 0xC + adds r4, r0, 0 + ldr r0, =gUnknown_0203A188 + ldrb r5, [r0, 0x3] + adds r0, r5, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r0, =gUnknown_0203A151 + ldrb r0, [r0] + cmp r4, r0 + bcc _08127770 + ldr r2, =gText_GoBackPrevMenu + b _08127782 + .pool +_08127770: + ldr r1, =gDecorations + ldr r0, =gUnknown_0203A14C + ldr r0, [r0] + adds r0, r4 + ldrb r0, [r0] + lsls r0, 5 + adds r1, 0x18 + adds r0, r1 + ldr r2, [r0] +_08127782: + movs r0, 0x1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + str r0, [sp, 0x8] + adds r0, r5, 0 + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127744 + + thumb_func_start sub_81277A8 +sub_81277A8: @ 81277A8 + push {lr} + movs r0, 0x3 + bl sub_8126A58 + movs r0, 0x2 + bl sub_8126A58 + pop {r0} + bx r0 + thumb_func_end sub_81277A8 + + thumb_func_start sub_81277BC +sub_81277BC: @ 81277BC + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + movs r1, 0 + ldr r3, =gUnknown_0203A152 +_081277C6: + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, r2 + bne _081277D8 + movs r0, 0x1 + b _081277E4 + .pool +_081277D8: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xF + bls _081277C6 + movs r0, 0 +_081277E4: + pop {r1} + bx r1 + thumb_func_end sub_81277BC + + thumb_func_start sub_81277E8 +sub_81277E8: @ 81277E8 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + movs r1, 0 + ldr r3, =gUnknown_0203A162 +_081277F2: + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, r2 + bne _08127804 + movs r0, 0x1 + b _08127810 + .pool +_08127804: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xB + bls _081277F2 + movs r0, 0 +_08127810: + pop {r1} + bx r1 + thumb_func_end sub_81277E8 + + thumb_func_start sub_8127814 +sub_8127814: @ 8127814 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r5, 0 + ldr r0, =gUnknown_0203A152 + movs r1, 0 + movs r2, 0x10 + bl memset + ldr r0, =gUnknown_0203A162 + movs r1, 0 + movs r2, 0xC + bl memset + movs r6, 0 + ldr r0, =gSaveBlock1Ptr + mov r10, r0 + ldr r1, =0x00001aae + mov r9, r1 + ldr r3, =gUnknown_0203A173 + mov r8, r3 +_08127842: + mov r1, r10 + ldr r0, [r1] + add r0, r9 + adds r0, r6 + ldrb r0, [r0] + cmp r0, 0 + beq _081278E2 + movs r2, 0 + mov r3, r8 + ldrb r0, [r3] + lsls r0, 3 + ldr r1, =gDecorationInventories + adds r0, r1 + ldrb r0, [r0, 0x4] + cmp r2, r0 + bcs _081278E2 + ldr r7, =gUnknown_0203A152 + adds r3, r1, 0 + mov r12, r3 +_08127868: + ldr r0, =gUnknown_0203A14C + ldr r1, [r0] + adds r1, r2 + mov r3, r10 + ldr r0, [r3] + add r0, r9 + adds r0, r6 + ldrb r1, [r1] + adds r4, r2, 0x1 + ldrb r0, [r0] + cmp r1, r0 + bne _081278D0 + movs r1, 0 + cmp r1, r5 + bcs _081278A2 + ldrb r0, [r7] + cmp r0, r4 + beq _081278A2 + ldr r3, =gUnknown_0203A152 + adds r2, r4, 0 +_08127890: + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, r5 + bcs _081278A2 + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, r2 + bne _08127890 +_081278A2: + cmp r1, r5 + bne _081278D0 + adds r0, r5, r7 + strb r4, [r0] + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + b _081278E2 + .pool +_081278D0: + lsls r0, r4, 16 + lsrs r2, r0, 16 + mov r1, r8 + ldrb r0, [r1] + lsls r0, 3 + add r0, r12 + ldrb r0, [r0, 0x4] + cmp r2, r0 + bcc _08127868 +_081278E2: + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 + cmp r6, 0xF + bls _08127842 + movs r5, 0 + movs r6, 0 + ldr r3, =gDecorationInventories + mov r8, r3 +_081278F4: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000271c + adds r0, r1 + adds r0, r6 + ldrb r0, [r0] + adds r7, r6, 0x1 + cmp r0, 0 + beq _0812799A + movs r2, 0 + b _0812798C + .pool +_08127918: + ldr r0, =gUnknown_0203A14C + ldr r1, [r0] + adds r1, r2 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x0000271c + adds r0, r3 + adds r0, r6 + ldrb r1, [r1] + adds r4, r2, 0x1 + ldrb r0, [r0] + cmp r1, r0 + bne _08127988 + lsls r0, r4, 24 + lsrs r0, 24 + bl sub_81277BC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08127988 + movs r1, 0 + cmp r1, r5 + bcs _08127966 + ldr r2, =gUnknown_0203A162 + ldrb r0, [r2] + cmp r0, r4 + beq _08127966 + adds r3, r2, 0 + adds r2, r4, 0 +_08127954: + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, r5 + bcs _08127966 + adds r0, r1, r3 + ldrb r0, [r0] + cmp r0, r2 + bne _08127954 +_08127966: + cmp r1, r5 + bne _08127988 + ldr r0, =gUnknown_0203A162 + adds r0, r5, r0 + strb r4, [r0] + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + b _0812799A + .pool +_08127988: + lsls r0, r4, 16 + lsrs r2, r0, 16 +_0812798C: + ldr r0, =gUnknown_0203A173 + ldrb r0, [r0] + lsls r0, 3 + add r0, r8 + ldrb r0, [r0, 0x4] + cmp r2, r0 + bcc _08127918 +_0812799A: + lsls r0, r7, 16 + lsrs r6, r0, 16 + cmp r6, 0xB + bls _081278F4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127814 + + thumb_func_start sub_81279B4 +sub_81279B4: @ 81279B4 + push {lr} + lsls r0, 24 + lsrs r0, 24 + bl sub_8127814 + pop {r0} + bx r0 + thumb_func_end sub_81279B4 + + thumb_func_start sub_81279C4 +sub_81279C4: @ 81279C4 + push {r4,lr} + movs r2, 0 + ldr r0, =gUnknown_0203A170 + ldrh r0, [r0] + ldr r1, =gUnknown_0203A16E + ldrh r1, [r1] + adds r0, r1 + adds r1, r0, 0x1 + ldr r4, =gUnknown_0203A152 + ldr r3, =gUnknown_0203A162 +_081279D8: + adds r0, r2, r4 + ldrb r0, [r0] + cmp r0, r1 + beq _081279EC + cmp r2, 0xB + bhi _08127A00 + adds r0, r2, r3 + ldrb r0, [r0] + cmp r0, r1 + bne _08127A00 +_081279EC: + movs r0, 0 + b _08127A0C + .pool +_08127A00: + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0xF + bls _081279D8 + movs r0, 0x1 +_08127A0C: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81279C4 + + thumb_func_start sub_8127A14 +sub_8127A14: @ 8127A14 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + bl sub_81269D4 + adds r0, r4, 0 + bl sub_8127620 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8127A14 + + thumb_func_start sub_8127A30 +sub_8127A30: @ 8127A30 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0 + bl sub_8197434 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8127A14 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127A30 + + thumb_func_start sub_8127A5C +sub_8127A5C: @ 8127A5C + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _08127A82 + movs r0, 0 + movs r1, 0 + bl sub_8197434 + movs r0, 0x1 + bl sub_81269D4 + adds r0, r4, 0 + bl sub_8127620 +_08127A82: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127A5C + + thumb_func_start sub_8127A8C +sub_8127A8C: @ 8127A8C + push {r4,r5,lr} + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + lsls r4, r5, 2 + adds r4, r5 + lsls r4, 3 + ldr r0, =gTasks + 0x8 + adds r4, r0 + bl sub_8127554 + bl sub_81277A8 + ldrb r0, [r4, 0x1A] + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldr r0, =gUnknown_0203A18C + ldr r0, [r0] + bl Free + adds r0, r5, 0 + bl sub_8126E44 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127A8C + + thumb_func_start sub_8127ACC +sub_8127ACC: @ 8127ACC + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r3, =gTasks + lsls r2, r0, 2 + adds r2, r0 + lsls r2, 3 + adds r4, r2, r3 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldrh r0, [r1] + strh r0, [r4, 0xE] + ldrh r0, [r1, 0x2] + strh r0, [r4, 0x10] + adds r3, 0x8 + adds r2, r3 + adds r1, r2, 0x2 + adds r0, r2, 0 + bl PlayerGetDestCoords + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127ACC + + thumb_func_start sub_8127B04 +sub_8127B04: @ 8127B04 + push {r4,r5,lr} + sub sp, 0x4 + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + bl DrawWholeMapView + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + movs r0, 0x4 + ldrsb r0, [r1, r0] + ldrb r1, [r1, 0x5] + lsls r1, 24 + asrs r1, 24 + movs r2, 0x1 + negs r2, r2 + ldr r3, =gTasks + lsls r4, r5, 2 + adds r4, r5 + lsls r4, 3 + adds r4, r3 + movs r3, 0xE + ldrsb r3, [r4, r3] + ldrb r4, [r4, 0x10] + lsls r4, 24 + asrs r4, 24 + str r4, [sp] + bl Overworld_SetWarpDestination + bl warp_in + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127B04 + + thumb_func_start sub_8127B54 +sub_8127B54: @ 8127B54 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r0, =0x0000ffff + cmp r2, 0x22 + beq _08127B7C + cmp r2, 0x26 + bne _08127B86 + ldr r0, =gUnknown_085A72E4 + adds r0, r1, r0 + ldrb r0, [r0] + lsls r0, 28 + lsrs r0, 16 + b _08127B86 + .pool +_08127B7C: + ldr r0, =gUnknown_085A72EC + adds r0, r1, r0 + ldrb r0, [r0] + lsls r0, 28 + lsrs r0, 16 +_08127B86: + pop {r1} + bx r1 + .pool + thumb_func_end sub_8127B54 + + thumb_func_start sub_8127B90 +sub_8127B90: @ 8127B90 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x34 + ldr r4, [sp, 0x54] + lsls r0, 16 + lsrs r0, 16 + str r0, [sp] + lsls r1, 16 + lsrs r1, 16 + str r1, [sp, 0x4] + lsls r2, 24 + lsrs r2, 24 + str r2, [sp, 0x8] + lsls r3, 24 + lsrs r3, 24 + str r3, [sp, 0xC] + lsls r4, 16 + lsrs r4, 16 + str r4, [sp, 0x10] + movs r2, 0 + lsls r0, r3, 16 + cmp r2, r3 + bcc _08127BC6 + b _08127D28 +_08127BC6: + ldr r1, [sp, 0x8] + str r1, [sp, 0x28] + str r0, [sp, 0x2C] +_08127BCC: + ldr r3, [sp, 0x4] + ldr r4, [sp, 0xC] + subs r1, r3, r4 + lsls r0, r2, 16 + asrs r0, 16 + adds r0, 0x1 + adds r1, r0 + lsls r1, 16 + lsrs r1, 16 + str r1, [sp, 0x14] + movs r0, 0 + mov r10, r0 + adds r1, r2, 0x1 + str r1, [sp, 0x30] + ldr r3, [sp, 0x28] + cmp r10, r3 + bcc _08127BF0 + b _08127D18 +_08127BF0: + ldr r4, [sp, 0x10] + lsls r4, 5 + str r4, [sp, 0x18] + ldr r0, =gUnknown_085A5C24 + adds r0, r4, r0 + str r0, [sp, 0x1C] + ldr r0, =gDecorations + adds r0, r4, r0 + str r0, [sp, 0x24] + ldr r3, [sp, 0x8] + adds r1, r2, 0 + muls r1, r3 + str r1, [sp, 0x20] +_08127C0A: + ldr r0, [sp] + add r0, r10 + lsls r0, 16 + lsrs r5, r0, 16 + ldr r1, [sp, 0x20] + add r1, r10 + ldr r4, [sp, 0x1C] + ldr r0, [r4] + lsls r1, 1 + adds r1, r0 + movs r2, 0x80 + lsls r2, 2 + adds r0, r2, 0 + ldrh r1, [r1] + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl GetBehaviorByMetatileId + lsls r4, r0, 16 + lsls r0, r4, 8 + lsrs r0, 24 + bl MetatileBehavior_IsMB_B9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08127C50 + ldr r3, [sp, 0x24] + ldrb r0, [r3, 0x11] + cmp r0, 0x1 + beq _08127C60 + lsrs r0, r4, 28 + cmp r0, 0 + beq _08127C60 +_08127C50: + movs r4, 0xC0 + lsls r4, 4 + mov r8, r4 + b _08127C64 + .pool +_08127C60: + movs r0, 0 + mov r8, r0 +_08127C64: + ldr r1, [sp, 0x24] + ldrb r0, [r1, 0x11] + lsls r7, r5, 16 + ldr r2, [sp, 0x14] + lsls r2, 16 + mov r9, r2 + cmp r0, 0x3 + beq _08127C8E + asrs r0, r7, 16 + asrs r1, r2, 16 + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r0, 24 + bl MetatileBehavior_IsMB_B7 + lsls r0, 24 + lsrs r0, 24 + movs r6, 0x1 + cmp r0, 0x1 + beq _08127C90 +_08127C8E: + movs r6, 0 +_08127C90: + ldr r3, [sp, 0x18] + ldr r4, =gDecorations + adds r0, r3, r4 + ldrb r0, [r0] + ldr r4, [sp, 0x20] + add r4, r10 + lsls r1, r4, 24 + lsrs r1, 24 + bl sub_8127B54 + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, =0x0000ffff + cmp r5, r0 + beq _08127CE0 + asrs r0, r7, 16 + mov r2, r9 + asrs r1, r2, 16 + ldr r3, [sp, 0x1C] + ldr r2, [r3] + lsls r3, r4, 1 + adds r3, r2 + movs r4, 0x80 + lsls r4, 2 + adds r2, r4, 0 + orrs r6, r2 + ldrh r3, [r3] + adds r2, r6, r3 + mov r3, r8 + orrs r3, r2 + orrs r3, r5 + lsls r2, r3, 16 + lsrs r2, 16 + bl MapGridSetMetatileEntryAt + b _08127D06 + .pool +_08127CE0: + asrs r0, r7, 16 + mov r2, r9 + asrs r1, r2, 16 + ldr r3, [sp, 0x1C] + ldr r2, [r3] + lsls r3, r4, 1 + adds r3, r2 + movs r4, 0x80 + lsls r4, 2 + adds r2, r4, 0 + orrs r6, r2 + ldrh r3, [r3] + adds r2, r6, r3 + mov r3, r8 + orrs r3, r2 + lsls r2, r3, 16 + lsrs r2, 16 + bl MapGridSetMetatileIdAt +_08127D06: + mov r0, r10 + adds r0, 0x1 + lsls r0, 16 + lsrs r0, 16 + mov r10, r0 + ldr r4, [sp, 0x28] + cmp r10, r4 + bcs _08127D18 + b _08127C0A +_08127D18: + ldr r1, [sp, 0x30] + lsls r0, r1, 16 + lsrs r2, r0, 16 + ldr r3, [sp, 0x2C] + lsrs r0, r3, 16 + cmp r2, r0 + bcs _08127D28 + b _08127BCC +_08127D28: + add sp, 0x34 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8127B90 + + thumb_func_start sub_8127D38 +sub_8127D38: @ 8127D38 + push {r4,lr} + sub sp, 0x4 + lsls r0, 16 + lsrs r3, r0, 16 + lsls r1, 16 + lsrs r4, r1, 16 + lsls r2, 16 + lsrs r2, 16 + ldr r1, =gDecorations + lsls r0, r2, 5 + adds r0, r1 + ldrb r0, [r0, 0x12] + cmp r0, 0x9 + bhi _08127E10 + lsls r0, 2 + ldr r1, =_08127D68 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08127D68: + .4byte _08127D90 + .4byte _08127D9A + .4byte _08127DA4 + .4byte _08127DB4 + .4byte _08127DBE + .4byte _08127DC8 + .4byte _08127DD8 + .4byte _08127DE2 + .4byte _08127DF2 + .4byte _08127E02 +_08127D90: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x1 + b _08127DAC +_08127D9A: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x2 + b _08127DAC +_08127DA4: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x3 +_08127DAC: + movs r3, 0x1 + bl sub_8127B90 + b _08127E10 +_08127DB4: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x4 + b _08127DD0 +_08127DBE: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x2 + b _08127DD0 +_08127DC8: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x1 +_08127DD0: + movs r3, 0x2 + bl sub_8127B90 + b _08127E10 +_08127DD8: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x1 + b _08127DFA +_08127DE2: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x2 + movs r3, 0x4 + bl sub_8127B90 + b _08127E10 +_08127DF2: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x3 +_08127DFA: + movs r3, 0x3 + bl sub_8127B90 + b _08127E10 +_08127E02: + str r2, [sp] + adds r0, r3, 0 + adds r1, r4, 0 + movs r2, 0x3 + movs r3, 0x2 + bl sub_8127B90 +_08127E10: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8127D38 + + thumb_func_start sub_8127E18 +sub_8127E18: @ 8127E18 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + movs r6, 0 + ldr r7, =gMapHeader + ldr r0, =gSpecialVar_0x8005 + mov r8, r0 + ldr r1, =gSpecialVar_0x8006 + mov r10, r1 + ldr r2, =gSaveBlock1Ptr + mov r9, r2 +_08127E34: + adds r5, r6, 0 + adds r5, 0xAE + adds r4, r5, 0 + adds r0, r4, 0 + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08127F1C + adds r0, r4, 0 + bl FlagClear + movs r2, 0 + ldr r0, [r7, 0x4] + ldrb r4, [r0] + cmp r2, r4 + bcs _08127E82 + ldr r0, [r0, 0x4] + ldrh r0, [r0, 0x14] + cmp r0, r5 + beq _08127E82 + ldr r0, =gMapHeader + ldr r3, [r0, 0x4] + ldrb r6, [r3] + adds r4, r5, 0 +_08127E68: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, r6 + bcs _08127E82 + ldr r0, [r3, 0x4] + lsls r1, r2, 1 + adds r1, r2 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x14] + cmp r0, r4 + bne _08127E68 +_08127E82: + ldr r0, [r7, 0x4] + ldr r1, [r0, 0x4] + lsls r4, r2, 1 + adds r4, r2 + lsls r4, 3 + adds r1, r4, r1 + ldr r5, =0x00003f20 + adds r0, r5, 0 + ldrb r1, [r1, 0x1] + adds r0, r1 + ldr r1, =gUnknown_0203A190 + ldr r1, [r1] + ldr r1, [r1, 0x1C] + ldrh r1, [r1] + bl VarSet + ldr r0, [r7, 0x4] + ldr r0, [r0, 0x4] + adds r4, r0 + ldrb r0, [r4] + mov r6, r8 + strh r0, [r6] + ldr r1, =gUnknown_0203AA34 + ldrh r1, [r1] + mov r2, r10 + strh r1, [r2] + ldr r1, =gUnknown_0203AA36 + ldrh r1, [r1] + ldr r4, =gSpecialVar_0x8007 + strh r1, [r4] + mov r5, r9 + ldr r2, [r5] + ldrb r1, [r2, 0x5] + ldrb r2, [r2, 0x4] + bl show_sprite + ldrb r0, [r6] + ldr r2, [r5] + ldrb r1, [r2, 0x5] + ldrb r2, [r2, 0x4] + mov r6, r10 + movs r4, 0 + ldrsh r3, [r6, r4] + ldr r5, =gSpecialVar_0x8007 + movs r6, 0 + ldrsh r4, [r5, r6] + str r4, [sp] + bl sub_808EBA8 + mov r1, r8 + ldrb r0, [r1] + mov r4, r9 + ldr r2, [r4] + ldrb r1, [r2, 0x5] + ldrb r2, [r2, 0x4] + bl sub_808F254 + b _08127F26 + .pool +_08127F1C: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, 0xD + bls _08127E34 +_08127F26: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8127E18 + + thumb_func_start sub_8127F38 +sub_8127F38: @ 8127F38 + push {lr} + movs r1, 0 + ldr r0, =gUnknown_0203A17C + ldrb r2, [r0, 0x8] + cmp r1, r2 + bcs _08127F62 + ldr r3, [r0] +_08127F46: + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _08127F58 + movs r0, 0x1 + b _08127F64 + .pool +_08127F58: + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, r2 + bcc _08127F46 +_08127F62: + movs r0, 0 +_08127F64: + pop {r1} + bx r1 + thumb_func_end sub_8127F38 + + thumb_func_start sub_8127F68 +sub_8127F68: @ 8127F68 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_0203A17C + ldrb r0, [r0, 0x9] + cmp r0, 0x1 + bne _08127FAC + ldr r0, =gUnknown_0203A173 + ldrb r0, [r0] + cmp r0, 0x6 + beq _08127FAC + cmp r0, 0x7 + beq _08127FAC + ldr r4, =gStringVar4 + ldr r1, =gText_CantPlaceInRoom + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8127A5C + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + b _0812804C + .pool +_08127FAC: + bl sub_81279C4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08128038 + bl sub_8127F38 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08127FE8 + movs r0, 0x1 + movs r1, 0 + bl fade_screen + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0xC] + ldr r1, =sub_8128060 + str r1, [r0] + b _0812804C + .pool +_08127FE8: + ldr r0, =gStringVar1 + ldr r4, =gUnknown_0203A17C + ldrb r1, [r4, 0x8] + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldrb r0, [r4, 0x9] + cmp r0, 0 + bne _08128018 + ldr r0, =gStringVar4 + ldr r1, =gText_NoMoreDecorations + bl StringExpandPlaceholders + b _08128020 + .pool +_08128018: + ldr r0, =gStringVar4 + ldr r1, =gText_NoMoreDecorations2 + bl StringExpandPlaceholders +_08128020: + ldr r1, =gStringVar4 + ldr r2, =sub_8127A5C + adds r0, r5, 0 + bl DisplayItemMessageOnField + b _0812804C + .pool +_08128038: + ldr r4, =gStringVar4 + ldr r1, =gText_InUseAlready + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8127A5C + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField +_0812804C: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8127F68 + + thumb_func_start sub_8128060 +sub_8128060: @ 8128060 + 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 r7, r0, r1 + movs r1, 0xC + ldrsh r0, [r7, r1] + cmp r0, 0x1 + beq _081280AC + cmp r0, 0x1 + bgt _08128088 + cmp r0, 0 + beq _0812808E + b _08128112 + .pool +_08128088: + cmp r0, 0x2 + beq _081280FC + b _08128112 +_0812808E: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08128112 + adds r0, r6, 0 + bl sub_8127ACC + movs r0, 0x1 + strh r0, [r7, 0xC] + b _08128112 + .pool +_081280AC: + ldr r4, =gPaletteFade + ldrb r0, [r4, 0x8] + movs r1, 0x80 + orrs r0, r1 + strb r0, [r4, 0x8] + ldr r5, =gUnknown_0203A190 + ldr r0, =gUnknown_0203A172 + ldrb r1, [r0] + ldr r0, =gUnknown_0203A14C + ldr r0, [r0] + adds r0, r1 + ldrb r1, [r0] + adds r0, r5, 0 + bl ConfigureCameraObjectForPlacingDecoration + adds r0, r6, 0 + bl sub_812826C + adds r0, r6, 0 + adds r1, r5, 0 + bl SetUpPlacingDecorationPlayerAvatar + bl pal_fill_black + ldrb r1, [r4, 0x8] + movs r0, 0x7F + ands r0, r1 + strb r0, [r4, 0x8] + movs r0, 0x2 + strh r0, [r7, 0xC] + b _08128112 + .pool +_081280FC: + bl sub_80ABDFC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08128112 + movs r0, 0 + strh r0, [r7, 0x20] + adds r0, r6, 0 + bl sub_8128FD8 +_08128112: + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8128060 + + thumb_func_start ConfigureCameraObjectForPlacingDecoration +ConfigureCameraObjectForPlacingDecoration: @ 8128118 + push {r4-r6,lr} + adds r6, r0, 0 + lsls r1, 24 + lsrs r1, 24 + ldr r3, =gUnknown_0203AA38 + ldr r4, =gSprites + ldr r5, =gUnknown_03005DD0 + ldr r2, [r5, 0x4] + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + adds r0, r4 + ldrh r0, [r0, 0x2E] + strb r0, [r3] + adds r0, r6, 0 + bl gpu_pal_decompress_alloc_tag_and_upload + lsls r0, 24 + lsrs r0, 24 + str r0, [r5, 0x4] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r4 + ldrb r2, [r1, 0x5] + movs r0, 0xD + negs r0, r0 + ands r0, r2 + movs r2, 0x4 + orrs r0, r2 + strb r0, [r1, 0x5] + ldr r0, [r5, 0x4] + lsls r2, r0, 4 + adds r2, r0 + lsls r2, 2 + adds r0, r4, 0 + adds r0, 0x1C + adds r0, r2, r0 + ldr r1, =sub_81292D0 + str r1, [r0] + adds r2, r4 + ldr r3, =gUnknown_085A7250 + ldr r0, [r6] + ldrb r0, [r0, 0x12] + lsls r0, 2 + adds r0, r3 + ldrb r0, [r0, 0x2] + strh r0, [r2, 0x20] + ldr r0, [r5, 0x4] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r4 + ldr r0, [r6] + ldrb r0, [r0, 0x12] + lsls r0, 2 + adds r0, r3 + ldrb r0, [r0, 0x3] + strh r0, [r1, 0x22] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end ConfigureCameraObjectForPlacingDecoration + + thumb_func_start SetUpPlacingDecorationPlayerAvatar +SetUpPlacingDecorationPlayerAvatar: @ 81281A8 + push {r4,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r0, 24 + ldr r3, =gTasks + lsls r2, r0, 2 + adds r2, r0 + lsls r2, 3 + adds r2, r3 + ldrb r2, [r2, 0x12] + ldr r3, =gUnknown_085A7250 + ldr r0, [r1] + ldrb r4, [r0, 0x12] + lsls r1, r4, 2 + adds r1, r3 + lsls r0, r2, 4 + ldrb r1, [r1, 0x2] + adds r0, r1 + subs r2, 0x1 + lsls r2, 3 + subs r0, r2 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r4, 0x2 + beq _081281E2 + cmp r4, 0x8 + beq _081281E2 + cmp r4, 0x9 + bne _081281EA +_081281E2: + adds r0, r2, 0 + subs r0, 0x8 + lsls r0, 24 + lsrs r2, r0, 24 +_081281EA: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0 + bne _0812820C + ldr r1, =SpriteCallbackDummy + str r0, [sp] + movs r0, 0xC1 + b _08128214 + .pool +_0812820C: + ldr r1, =SpriteCallbackDummy + movs r0, 0 + str r0, [sp] + movs r0, 0xC2 +_08128214: + movs r3, 0x48 + bl AddPseudoFieldObject + ldr r1, =gUnknown_0203AA39 + strb r0, [r1] + ldr r3, =gSprites + ldr r0, =gUnknown_0203AA39 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + ldrb r2, [r0, 0x5] + movs r1, 0xD + negs r1, r1 + ands r1, r2 + movs r2, 0x4 + orrs r1, r2 + strb r1, [r0, 0x5] + ldr r4, =gUnknown_0203AA38 + ldrb r1, [r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + bl DestroySprite + ldr r0, =gUnknown_03005DD0 + ldr r0, [r0, 0x4] + strb r0, [r4] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end SetUpPlacingDecorationPlayerAvatar + + thumb_func_start sub_812826C +sub_812826C: @ 812826C + push {lr} + lsls r0, 24 + lsrs r3, r0, 24 + ldr r2, =gDecorations + ldr r0, =gUnknown_0203A172 + ldrb r1, [r0] + ldr r0, =gUnknown_0203A14C + ldr r0, [r0] + adds r0, r1 + ldrb r0, [r0] + lsls r0, 5 + adds r0, r2 + ldrb r0, [r0, 0x12] + cmp r0, 0x9 + bls _0812828C + b _081283B2 +_0812828C: + lsls r0, 2 + ldr r1, =_081282A8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081282A8: + .4byte _081282D0 + .4byte _081282E4 + .4byte _081282FC + .4byte _08128314 + .4byte _08128328 + .4byte _0812833C + .4byte _08128350 + .4byte _08128370 + .4byte _08128388 + .4byte _081283A0 +_081282D0: + ldr r0, =gTasks + lsls r1, r3, 2 + adds r1, r3 + lsls r1, 3 + adds r1, r0 + movs r0, 0x1 + b _08128394 + .pool +_081282E4: + ldr r1, =gTasks + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 3 + adds r0, r1 + movs r1, 0x2 + strh r1, [r0, 0x12] + movs r1, 0x1 + b _081283B0 + .pool +_081282FC: + ldr r1, =gTasks + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 3 + adds r0, r1 + movs r1, 0x3 + strh r1, [r0, 0x12] + movs r1, 0x1 + b _081283B0 + .pool +_08128314: + ldr r1, =gTasks + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 3 + adds r0, r1 + movs r1, 0x4 + b _081283AC + .pool +_08128328: + ldr r0, =gTasks + lsls r1, r3, 2 + adds r1, r3 + lsls r1, 3 + adds r1, r0 + movs r0, 0x2 + b _08128394 + .pool +_0812833C: + ldr r1, =gTasks + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 3 + adds r0, r1 + movs r1, 0x1 + b _081283AC + .pool +_08128350: + ldr r0, =gTasks + lsls r1, r3, 2 + adds r1, r3 + lsls r1, 3 + adds r1, r0 + movs r0, 0x1 + strh r0, [r1, 0x12] + movs r0, 0x3 + strh r0, [r1, 0x14] + ldrh r0, [r1, 0xA] + adds r0, 0x1 + strh r0, [r1, 0xA] + b _081283B2 + .pool +_08128370: + ldr r1, =gTasks + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 3 + adds r0, r1 + movs r1, 0x2 + strh r1, [r0, 0x12] + movs r1, 0x4 + b _081283B0 + .pool +_08128388: + ldr r0, =gTasks + lsls r1, r3, 2 + adds r1, r3 + lsls r1, 3 + adds r1, r0 + movs r0, 0x3 +_08128394: + strh r0, [r1, 0x12] + strh r0, [r1, 0x14] + b _081283B2 + .pool +_081283A0: + ldr r1, =gTasks + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 3 + adds r0, r1 + movs r1, 0x3 +_081283AC: + strh r1, [r0, 0x12] + movs r1, 0x2 +_081283B0: + strh r1, [r0, 0x14] +_081283B2: + pop {r0} + bx r0 + .pool + thumb_func_end sub_812826C + + thumb_func_start sub_81283BC +sub_81283BC: @ 81283BC + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0x1C] + ldr r3, =gSprites + ldr r0, =gUnknown_0203AA38 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + movs r2, 0x1 + strh r2, [r0, 0x3C] + ldr r0, =gUnknown_0203AA39 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + strh r2, [r0, 0x3C] + bl sub_8128DE0 + adds r0, r4, 0 + bl sub_8128950 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81283BC + + thumb_func_start sub_8128414 +sub_8128414: @ 8128414 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0x1C] + ldr r3, =gSprites + ldr r0, =gUnknown_0203AA38 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + movs r2, 0x1 + strh r2, [r0, 0x3C] + ldr r0, =gUnknown_0203AA39 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + strh r2, [r0, 0x3C] + bl sub_8128DE0 + ldr r5, =gStringVar4 + ldr r1, =gText_CancelDecorating + adds r0, r5, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8128B80 + adds r0, r4, 0 + adds r1, r5, 0 + bl DisplayItemMessageOnField + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128414 + + thumb_func_start sub_8128484 +sub_8128484: @ 8128484 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, 16 + lsrs r4, r1, 16 + bl MetatileBehavior_IsMB_B3 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0812849E + cmp r4, 0 + beq _081284A2 +_0812849E: + movs r0, 0 + b _081284A4 +_081284A2: + movs r0, 0x1 +_081284A4: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8128484 + + thumb_func_start sub_81284AC +sub_81284AC: @ 81284AC + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r2, 16 + lsrs r4, r2, 16 + lsls r3, 16 + lsrs r5, r3, 16 + lsls r1, 16 + asrs r1, 16 + ldr r3, =gTasks + lsls r2, r0, 2 + adds r2, r0 + lsls r2, 3 + adds r2, r3 + movs r3, 0xE + ldrsh r0, [r2, r3] + adds r0, 0x7 + cmp r1, r0 + bne _081284EC + lsls r1, r4, 16 + asrs r1, 16 + movs r3, 0x10 + ldrsh r0, [r2, r3] + adds r0, 0x7 + cmp r1, r0 + bne _081284EC + cmp r5, 0 + beq _081284EC + movs r0, 0 + b _081284EE + .pool +_081284EC: + movs r0, 0x1 +_081284EE: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81284AC + + thumb_func_start sub_81284F4 +sub_81284F4: @ 81284F4 + push {r4-r6,lr} + adds r5, r1, 0 + lsls r0, 16 + lsrs r6, r0, 16 + lsls r0, r6, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl MetatileBehavior_IsMB_B3 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08128534 + ldrb r0, [r5] + cmp r0, 0x21 + bne _08128522 + adds r0, r4, 0 + bl MetatileBehavior_IsMB_C2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08128530 +_08128522: + lsls r0, r6, 24 + lsrs r0, 24 + bl MetatileBehavior_IsNormal + lsls r0, 24 + cmp r0, 0 + beq _08128534 +_08128530: + movs r0, 0x1 + b _08128536 +_08128534: + movs r0, 0 +_08128536: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_81284F4 + + thumb_func_start sub_812853C +sub_812853C: @ 812853C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x24 + str r1, [sp] + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + ldr r1, =gTasks + lsls r0, 2 + add r0, r10 + lsls r0, 3 + adds r0, r1 + ldrb r2, [r0, 0x14] + str r2, [sp, 0x4] + ldrb r0, [r0, 0x12] + str r0, [sp, 0x8] + ldr r3, [sp] + ldrb r0, [r3, 0x11] + adds r2, r1, 0 + cmp r0, 0x4 + bls _0812856E + b _0812893C +_0812856E: + lsls r0, 2 + ldr r1, =_08128580 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08128580: + .4byte _08128594 + .4byte _08128594 + .4byte _08128680 + .4byte _08128834 + .4byte _081288B8 +_08128594: + movs r6, 0 + ldr r0, [sp, 0x4] + cmp r6, r0 + bcc _0812859E + b _0812893C +_0812859E: + mov r1, r10 + lsls r1, 2 + str r1, [sp, 0x1C] +_081285A4: + mov r2, r10 + lsls r0, r2, 2 + add r0, r10 + lsls r0, 3 + ldr r3, =gTasks + adds r0, r3 + ldrh r0, [r0, 0xA] + subs r0, r6 + lsls r0, 16 + lsrs r0, 16 + mov r9, r0 + movs r7, 0 + adds r6, 0x1 + str r6, [sp, 0x14] + ldr r0, [sp, 0x8] + cmp r7, r0 + bcs _0812866E + mov r1, r9 + lsls r1, 16 + str r1, [sp, 0xC] + asrs r1, 16 + mov r9, r1 +_081285D0: + ldr r0, [sp, 0x1C] + add r0, r10 + lsls r0, 3 + ldr r2, =gTasks + adds r0, r2 + ldrh r0, [r0, 0x8] + adds r0, r7 + lsls r0, 16 + mov r8, r0 + asrs r6, r0, 16 + adds r0, r6, 0 + mov r1, r9 + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r4, r0, 24 + ldr r3, [sp, 0x4] + ldr r1, [sp, 0x14] + subs r0, r3, r1 + ldr r2, [sp, 0x8] + adds r1, r0, 0 + muls r1, r2 + adds r1, r7 + ldr r3, [sp] + ldr r0, [r3, 0x1C] + lsls r1, 1 + adds r1, r0 + movs r2, 0x80 + lsls r2, 2 + adds r0, r2, 0 + ldrh r1, [r1] + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl GetBehaviorByMetatileId + movs r3, 0xF0 + lsls r3, 8 + adds r1, r3, 0 + adds r5, r1, 0 + ands r5, r0 + adds r0, r4, 0 + ldr r1, [sp] + bl sub_81284F4 + lsls r0, 24 + cmp r0, 0 + bne _08128632 + b _0812890C +_08128632: + mov r0, r10 + adds r1, r6, 0 + mov r2, r9 + adds r3, r5, 0 + bl sub_81284AC + lsls r0, 24 + cmp r0, 0 + bne _08128646 + b _0812890C +_08128646: + mov r1, r8 + lsrs r0, r1, 16 + ldr r2, [sp, 0xC] + lsrs r1, r2, 16 + movs r2, 0 + bl GetFieldObjectIdByXYZ + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _08128662 + cmp r4, 0x10 + beq _08128662 + b _0812890C +_08128662: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldr r3, [sp, 0x8] + cmp r7, r3 + bcc _081285D0 +_0812866E: + ldr r1, [sp, 0x14] + lsls r0, r1, 24 + lsrs r6, r0, 24 + ldr r2, [sp, 0x4] + cmp r6, r2 + bcc _081285A4 + b _0812893C + .pool +_08128680: + movs r6, 0 + mov r3, r10 + lsls r3, 2 + str r3, [sp, 0x1C] + ldr r0, [sp, 0x4] + subs r0, 0x1 + str r0, [sp, 0x18] + cmp r6, r0 + bge _0812876C + adds r0, r3, 0 + add r0, r10 + lsls r0, 3 + str r0, [sp, 0x10] +_0812869A: + ldr r1, [sp, 0x10] + adds r0, r1, r2 + ldrh r0, [r0, 0xA] + subs r0, r6 + lsls r0, 16 + lsrs r0, 16 + mov r9, r0 + movs r7, 0 + adds r6, 0x1 + str r6, [sp, 0x14] + ldr r3, [sp, 0x8] + cmp r7, r3 + bcs _08128760 + lsls r0, 16 + str r0, [sp, 0x20] +_081286B8: + ldr r1, [sp, 0x10] + adds r0, r1, r2 + ldrh r0, [r0, 0x8] + adds r0, r7 + lsls r0, 16 + mov r8, r0 + asrs r6, r0, 16 + mov r2, r9 + lsls r1, r2, 16 + adds r0, r6, 0 + asrs r1, 16 + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r4, r0, 24 + ldr r3, [sp, 0x4] + ldr r1, [sp, 0x14] + subs r0, r3, r1 + ldr r2, [sp, 0x8] + adds r1, r0, 0 + muls r1, r2 + adds r1, r7 + ldr r3, [sp] + ldr r0, [r3, 0x1C] + lsls r1, 1 + adds r1, r0 + movs r2, 0x80 + lsls r2, 2 + adds r0, r2, 0 + ldrh r1, [r1] + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl GetBehaviorByMetatileId + movs r3, 0xF0 + lsls r3, 8 + adds r1, r3, 0 + adds r5, r1, 0 + ands r5, r0 + adds r0, r4, 0 + bl MetatileBehavior_IsNormal + lsls r0, 24 + cmp r0, 0 + bne _08128724 + adds r0, r4, 0 + adds r1, r5, 0 + bl sub_8128484 + lsls r0, 24 + cmp r0, 0 + bne _08128724 + b _0812890C +_08128724: + mov r0, r10 + adds r1, r6, 0 + ldr r3, [sp, 0x20] + asrs r2, r3, 16 + adds r3, r5, 0 + bl sub_81284AC + lsls r0, 24 + cmp r0, 0 + bne _0812873A + b _0812890C +_0812873A: + mov r1, r8 + lsrs r0, r1, 16 + ldr r2, [sp, 0x20] + lsrs r1, r2, 16 + movs r2, 0 + bl GetFieldObjectIdByXYZ + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x10 + beq _08128752 + b _0812890C +_08128752: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldr r2, =gTasks + ldr r3, [sp, 0x8] + cmp r7, r3 + bcc _081286B8 +_08128760: + ldr r1, [sp, 0x14] + lsls r0, r1, 24 + lsrs r6, r0, 24 + ldr r3, [sp, 0x18] + cmp r6, r3 + blt _0812869A +_0812876C: + ldr r0, [sp, 0x1C] + add r0, r10 + lsls r0, 3 + adds r0, r2 + ldrh r0, [r0, 0xA] + ldr r1, [sp, 0x4] + subs r0, r1 + adds r0, 0x1 + lsls r0, 16 + lsrs r0, 16 + mov r9, r0 + movs r7, 0 + ldr r3, [sp, 0x8] + cmp r7, r3 + bcc _0812878C + b _0812893C +_0812878C: + lsls r0, 16 + str r0, [sp, 0x20] +_08128790: + ldr r0, [sp, 0x1C] + add r0, r10 + lsls r0, 3 + ldr r1, =gTasks + adds r0, r1 + ldrh r0, [r0, 0x8] + adds r0, r7 + lsls r0, 16 + mov r8, r0 + asrs r6, r0, 16 + mov r2, r9 + lsls r1, r2, 16 + adds r0, r6, 0 + asrs r1, 16 + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r4, r0, 24 + ldr r3, [sp] + ldr r0, [r3, 0x1C] + lsls r1, r7, 1 + adds r1, r0 + movs r2, 0x80 + lsls r2, 2 + adds r0, r2, 0 + ldrh r1, [r1] + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl GetBehaviorByMetatileId + movs r3, 0xF0 + lsls r3, 8 + adds r1, r3, 0 + adds r5, r1, 0 + ands r5, r0 + adds r0, r4, 0 + bl MetatileBehavior_IsNormal + lsls r0, 24 + cmp r0, 0 + bne _081287F2 + adds r0, r4, 0 + bl MetatileBehavior_IsMB_B7 + lsls r0, 24 + cmp r0, 0 + bne _081287F2 + b _0812890C +_081287F2: + mov r0, r10 + adds r1, r6, 0 + ldr r3, [sp, 0x20] + asrs r2, r3, 16 + adds r3, r5, 0 + bl sub_81284AC + lsls r0, 24 + cmp r0, 0 + bne _08128808 + b _0812890C +_08128808: + mov r1, r8 + lsrs r0, r1, 16 + ldr r2, [sp, 0x20] + lsrs r1, r2, 16 + movs r2, 0 + bl GetFieldObjectIdByXYZ + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _08128822 + cmp r4, 0x10 + bne _0812890C +_08128822: + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldr r3, [sp, 0x8] + cmp r7, r3 + bcc _08128790 + b _0812893C + .pool +_08128834: + movs r6, 0 + ldr r0, [sp, 0x4] + cmp r6, r0 + bcc _0812883E + b _0812893C +_0812883E: + mov r1, r10 + lsls r0, r1, 2 + add r0, r10 + lsls r1, r0, 3 + ldr r2, =gTasks + adds r0, r1, r2 + ldrh r0, [r0, 0xA] + subs r0, r6 + lsls r0, 16 + lsrs r0, 16 + mov r9, r0 + movs r7, 0 + ldr r3, [sp, 0x8] + cmp r7, r3 + bcs _081288A4 + adds r0, r2, 0 + adds r1, r0 + mov r8, r1 + mov r1, r9 + lsls r0, r1, 16 + asrs r5, r0, 16 +_08128868: + mov r2, r8 + ldrh r0, [r2, 0x8] + adds r0, r7 + lsls r0, 16 + asrs r4, r0, 16 + adds r0, r4, 0 + adds r1, r5, 0 + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r0, 24 + bl MetatileBehavior_IsMB_B7 + lsls r0, 24 + cmp r0, 0 + beq _0812890C + adds r0, r4, 0 + adds r1, r5, 0x1 + bl MapGridGetMetatileIdAt + movs r1, 0xA3 + lsls r1, 2 + cmp r0, r1 + beq _0812890C + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldr r3, [sp, 0x8] + cmp r7, r3 + bcc _08128868 +_081288A4: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + ldr r0, [sp, 0x4] + cmp r6, r0 + bcc _0812883E + b _0812893C + .pool +_081288B8: + mov r3, r10 + lsls r1, r3, 2 + adds r0, r1, r3 + lsls r0, 3 + adds r0, r2 + ldrh r0, [r0, 0xA] + mov r9, r0 + movs r7, 0 + str r1, [sp, 0x1C] + ldr r0, [sp, 0x8] + cmp r7, r0 + bcs _0812893C + adds r6, r2, 0 + mov r1, r9 + lsls r1, 16 + str r1, [sp, 0x20] +_081288D8: + ldr r0, [sp, 0x1C] + add r0, r10 + lsls r0, 3 + adds r0, r6 + ldrh r0, [r0, 0x8] + adds r0, r7 + lsls r0, 16 + lsrs r5, r0, 16 + asrs r0, 16 + mov r2, r9 + lsls r1, r2, 16 + asrs r1, 16 + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r4, r0, 24 + ldr r3, [sp] + ldrb r0, [r3, 0x12] + cmp r0, 0x5 + bne _08128910 +_08128900: + adds r0, r4, 0 + bl MetatileBehavior_IsMB_C3 + lsls r0, 24 + cmp r0, 0 + bne _0812891C +_0812890C: + movs r0, 0 + b _0812893E +_08128910: + adds r0, r4, 0 + bl MetatileBehavior_IsMB_B5 + lsls r0, 24 + cmp r0, 0 + beq _08128900 +_0812891C: + adds r0, r5, 0 + ldr r2, [sp, 0x20] + lsrs r1, r2, 16 + movs r2, 0 + bl GetFieldObjectIdByXYZ + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x10 + bne _0812890C + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + ldr r3, [sp, 0x8] + cmp r7, r3 + bcc _081288D8 +_0812893C: + movs r0, 0x1 +_0812893E: + add sp, 0x24 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_812853C + + thumb_func_start sub_8128950 +sub_8128950: @ 8128950 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_0203A172 + ldrb r1, [r0] + ldr r0, =gUnknown_0203A14C + ldr r0, [r0] + adds r0, r1 + ldrb r1, [r0] + lsls r1, 5 + ldr r0, =gDecorations + adds r1, r0 + adds r0, r5, 0 + bl sub_812853C + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081289A4 + ldr r4, =gStringVar4 + ldr r1, =gText_PlaceItHere + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_81289D0 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + b _081289BE + .pool +_081289A4: + movs r0, 0x20 + bl PlaySE + ldr r4, =gStringVar4 + ldr r1, =gText_CantBePlacedHere + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8129020 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField +_081289BE: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128950 + + thumb_func_start sub_81289D0 +sub_81289D0: @ 81289D0 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8197930 + ldr r1, =gUnknown_085A72C4 + adds r0, r4, 0 + bl sub_8121F68 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81289D0 + + thumb_func_start sub_81289F0 +sub_81289F0: @ 81289F0 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + movs r0, 0 + movs r1, 0 + bl sub_8197434 + adds r0, r4, 0 + bl sub_8128AAC + ldr r2, =gDecorations + ldr r0, =gUnknown_0203A172 + ldrb r1, [r0] + ldr r0, =gUnknown_0203A14C + ldr r0, [r0] + adds r0, r1 + ldrb r3, [r0] + lsls r0, r3, 5 + adds r0, r2 + ldrb r0, [r0, 0x11] + cmp r0, 0x4 + beq _08128A44 + ldr r0, =gTasks + lsls r1, r4, 2 + adds r1, r4 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + ldrh r1, [r1, 0xA] + adds r2, r3, 0 + bl sub_8127D38 + b _08128A64 + .pool +_08128A44: + ldr r2, =gUnknown_0203AA34 + ldr r0, =gTasks + lsls r1, r4, 2 + adds r1, r4 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + subs r0, 0x7 + strh r0, [r2] + ldr r2, =gUnknown_0203AA36 + ldrh r0, [r1, 0xA] + subs r0, 0x7 + strh r0, [r2] + ldr r0, =gUnknown_08275D1F + bl ScriptContext1_SetupScript +_08128A64: + ldr r2, =gSprites + ldr r0, =gUnknown_0203AA38 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldrh r1, [r0, 0x22] + adds r1, 0x2 + strh r1, [r0, 0x22] + ldr r0, =gMapHeader + ldrb r0, [r0, 0x14] + cmp r0, 0x56 + bne _08128A84 + bl sub_80EE104 +_08128A84: + adds r0, r4, 0 + bl sub_8128BBC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81289F0 + + thumb_func_start sub_8128AAC +sub_8128AAC: @ 8128AAC + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + movs r3, 0 + ldr r0, =gUnknown_0203A17C + ldrb r1, [r0, 0x8] + adds r5, r0, 0 + cmp r3, r1 + bcs _08128AD2 + ldr r4, [r5] +_08128AC0: + adds r2, r4, r3 + ldrb r0, [r2] + cmp r0, 0 + beq _08128AF0 + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, r1 + bcc _08128AC0 +_08128AD2: + ldrb r0, [r5, 0x9] + cmp r0, 0 + bne _08128B3C + movs r3, 0 + ldr r0, =gUnknown_0203A152 + ldrb r1, [r0] + adds r2, r0, 0 + cmp r1, 0 + bne _08128B28 + b _08128B48 + .pool +_08128AF0: + ldr r0, =gUnknown_0203A172 + ldrb r1, [r0] + ldr r0, =gUnknown_0203A14C + ldr r0, [r0] + adds r0, r1 + ldrb r0, [r0] + strb r0, [r2] + ldr r2, [r5, 0x4] + adds r2, r3 + ldr r0, =gTasks + lsls r1, r6, 2 + adds r1, r6 + lsls r1, 3 + adds r1, r0 + ldrb r0, [r1, 0x8] + subs r0, 0x7 + lsls r0, 4 + ldrb r1, [r1, 0xA] + subs r1, 0x7 + adds r0, r1 + strb r0, [r2] + b _08128AD2 + .pool +_08128B28: + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0xF + bhi _08128B76 + adds r1, r3, r2 + ldrb r0, [r1] + cmp r0, 0 + bne _08128B28 + b _08128B6E +_08128B3C: + movs r3, 0 + ldr r0, =gUnknown_0203A162 + ldrb r1, [r0] + adds r2, r0, 0 + cmp r1, 0 + bne _08128B5C +_08128B48: + ldr r0, =gUnknown_0203A172 + ldrb r0, [r0] + adds r0, 0x1 + strb r0, [r2] + b _08128B76 + .pool +_08128B5C: + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0xB + bhi _08128B76 + adds r1, r3, r2 + ldrb r0, [r1] + cmp r0, 0 + bne _08128B5C +_08128B6E: + ldr r0, =gUnknown_0203A172 + ldrb r0, [r0] + adds r0, 0x1 + strb r0, [r1] +_08128B76: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128AAC + + thumb_func_start sub_8128B80 +sub_8128B80: @ 8128B80 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8197930 + ldr r1, =gUnknown_085A72CC + adds r0, r4, 0 + bl sub_8121F68 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128B80 + + thumb_func_start sub_8128BA0 +sub_8128BA0: @ 8128BA0 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0 + bl sub_8197434 + adds r0, r4, 0 + bl sub_8128BBC + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_8128BA0 + + thumb_func_start sub_8128BBC +sub_8128BBC: @ 8128BBC + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + movs r1, 0 + bl fade_screen + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0xC] + ldr r1, =c1_overworld_prev_quest + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128BBC + + thumb_func_start c1_overworld_prev_quest +c1_overworld_prev_quest: @ 8128BEC + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r5, r0, r1 + movs r1, 0xC + ldrsh r0, [r5, r1] + cmp r0, 0 + beq _08128C10 + cmp r0, 0x1 + beq _08128C30 + b _08128C4C + .pool +_08128C10: + bl ScriptContext2_Enable + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08128C4C + adds r0, r4, 0 + bl sub_8127B04 + movs r0, 0x1 + strh r0, [r5, 0xC] + b _08128C4C + .pool +_08128C30: + bl sub_812A3C8 + ldr r0, =0x00000be5 + bl FreeSpritePaletteByTag + ldr r1, =gFieldCallback + ldr r0, =sub_8128CD4 + str r0, [r1] + ldr r0, =c2_exit_to_overworld_2_switch + bl SetMainCallback2 + adds r0, r4, 0 + bl DestroyTask +_08128C4C: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end c1_overworld_prev_quest + + thumb_func_start sub_8128C64 +sub_8128C64: @ 8128C64 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r5, r1, 3 + ldr r6, =gTasks + 0x8 + adds r4, r5, r6 + movs r1, 0x4 + ldrsh r0, [r4, r1] + cmp r0, 0x1 + beq _08128C9C + cmp r0, 0x1 + bgt _08128C8C + cmp r0, 0 + beq _08128C96 + b _08128CCA + .pool +_08128C8C: + cmp r0, 0x2 + beq _08128CA8 + cmp r0, 0x3 + beq _08128CB4 + b _08128CCA +_08128C96: + bl sub_80E9578 + b _08128CAC +_08128C9C: + ldr r0, =gUnknown_08275D0C + bl ScriptContext1_SetupScript + b _08128CAC + .pool +_08128CA8: + bl ScriptContext2_Enable +_08128CAC: + ldrh r0, [r4, 0x4] + adds r0, 0x1 + strh r0, [r4, 0x4] + b _08128CCA +_08128CB4: + bl sub_80ABDFC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08128CCA + adds r0, r6, 0 + subs r0, 0x8 + adds r0, r5, r0 + ldr r1, =sub_812764C + str r1, [r0] +_08128CCA: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128C64 + + thumb_func_start sub_8128CD4 +sub_8128CD4: @ 8128CD4 + push {r4,lr} + bl ScriptContext2_Enable + bl pal_fill_black + ldr r0, =sub_8128C64 + movs r1, 0x8 + bl CreateTask + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r4, 0 + bl sub_8127580 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0xC] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128CD4 + + thumb_func_start sub_8128D10 +sub_8128D10: @ 8128D10 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r2, r1, r0 + ldr r0, =gUnknown_0203AA3A + ldrb r1, [r0] + adds r3, r0, 0 + cmp r1, 0x1 + bne _08128D48 + movs r1, 0x2 + ldrsh r0, [r2, r1] + movs r4, 0xC + ldrsh r1, [r2, r4] + subs r0, r1 + subs r0, 0x6 + cmp r0, 0 + bge _08128D48 + ldrh r0, [r2, 0x2] + adds r0, 0x1 + b _08128D62 + .pool +_08128D48: + ldrb r0, [r3] + cmp r0, 0x2 + bne _08128D6C + movs r0, 0x2 + ldrsh r1, [r2, r0] + subs r1, 0x7 + ldr r0, =gMapHeader + ldr r0, [r0] + ldr r0, [r0, 0x4] + cmp r1, r0 + blt _08128D6C + ldrh r0, [r2, 0x2] + subs r0, 0x1 +_08128D62: + strh r0, [r2, 0x2] + movs r0, 0 + b _08128DAE + .pool +_08128D6C: + ldrb r0, [r3] + cmp r0, 0x3 + bne _08128D82 + movs r1, 0 + ldrsh r0, [r2, r1] + subs r0, 0x7 + cmp r0, 0 + bge _08128D82 + ldrh r0, [r2] + adds r0, 0x1 + b _08128DA2 +_08128D82: + ldrb r0, [r3] + cmp r0, 0x4 + bne _08128DAC + movs r3, 0 + ldrsh r1, [r2, r3] + movs r4, 0xA + ldrsh r0, [r2, r4] + adds r1, r0 + subs r1, 0x8 + ldr r0, =gMapHeader + ldr r0, [r0] + ldr r0, [r0] + cmp r1, r0 + blt _08128DAC + ldrh r0, [r2] + subs r0, 0x1 +_08128DA2: + strh r0, [r2] + movs r0, 0 + b _08128DAE + .pool +_08128DAC: + movs r0, 0x1 +_08128DAE: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8128D10 + + thumb_func_start sub_8128DB4 +sub_8128DB4: @ 8128DB4 + push {lr} + ldr r0, =gMain + ldrh r0, [r0, 0x2C] + movs r1, 0xF0 + ands r1, r0 + cmp r1, 0x40 + beq _08128DD8 + cmp r1, 0x80 + beq _08128DD8 + cmp r1, 0x20 + beq _08128DD8 + cmp r1, 0x10 + beq _08128DD8 + movs r0, 0 + b _08128DDA + .pool +_08128DD8: + movs r0, 0x1 +_08128DDA: + pop {r1} + bx r1 + thumb_func_end sub_8128DB4 + + thumb_func_start sub_8128DE0 +sub_8128DE0: @ 8128DE0 + push {r4,lr} + ldr r1, =gUnknown_0203AA3A + movs r0, 0 + strb r0, [r1] + ldr r4, =gSprites + ldr r3, =gUnknown_0203AA38 + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + movs r2, 0 + strh r2, [r0, 0x32] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + strh r2, [r0, 0x34] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128DE0 + + thumb_func_start sub_8128E18 +sub_8128E18: @ 8128E18 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r2, r0, 24 + mov r8, r2 + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldr r5, =gSprites + ldr r3, =gUnknown_0203AA38 + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + movs r1, 0x36 + ldrsh r6, [r0, r1] + cmp r6, 0 + beq _08128E46 + b _08128F66 +_08128E46: + movs r1, 0x14 + ldrsh r0, [r4, r1] + cmp r0, 0x1 + bne _08128E68 + ldr r0, =gUnknown_085A72D4 + movs r3, 0x18 + ldrsh r1, [r4, r3] + lsls r1, 3 + b _08128E76 + .pool +_08128E68: + cmp r0, 0x2 + bne _08128E88 + ldr r0, =gUnknown_085A72D4 + movs r3, 0x18 + ldrsh r1, [r4, r3] + lsls r1, 3 + adds r0, 0x4 +_08128E76: + adds r1, r0 + ldr r1, [r1] + adds r0, r2, 0 + bl _call_via_r1 + b _08128FBA + .pool +_08128E88: + ldr r2, =gMain + ldrh r1, [r2, 0x2C] + movs r7, 0xF0 + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0x40 + bne _08128EBC + ldr r1, =gUnknown_0203AA3A + movs r0, 0x1 + strb r0, [r1] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + strh r6, [r0, 0x32] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + ldr r1, =0x0000fffe + strh r1, [r0, 0x34] + ldrh r0, [r4, 0x2] + subs r0, 0x1 + strh r0, [r4, 0x2] +_08128EBC: + ldrh r1, [r2, 0x2C] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0x80 + bne _08128EEC + ldr r1, =gUnknown_0203AA3A + movs r0, 0x2 + strb r0, [r1] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + strh r6, [r0, 0x32] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + movs r1, 0x2 + strh r1, [r0, 0x34] + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] +_08128EEC: + ldrh r1, [r2, 0x2C] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0x20 + bne _08128F1C + ldr r1, =gUnknown_0203AA3A + movs r0, 0x3 + strb r0, [r1] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + ldr r1, =0x0000fffe + strh r1, [r0, 0x32] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + strh r6, [r0, 0x34] + ldrh r0, [r4] + subs r0, 0x1 + strh r0, [r4] +_08128F1C: + ldrh r1, [r2, 0x2C] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0x10 + bne _08128F4C + ldr r1, =gUnknown_0203AA3A + movs r0, 0x4 + strb r0, [r1] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + movs r1, 0x2 + strh r1, [r0, 0x32] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r5 + strh r6, [r0, 0x34] + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_08128F4C: + bl sub_8128DB4 + lsls r0, 24 + cmp r0, 0 + beq _08128F62 + mov r0, r8 + bl sub_8128D10 + lsls r0, 24 + cmp r0, 0 + bne _08128F66 +_08128F62: + bl sub_8128DE0 +_08128F66: + ldr r0, =gUnknown_0203AA3A + ldrb r0, [r0] + cmp r0, 0 + beq _08128F94 + ldr r3, =gSprites + ldr r2, =gUnknown_0203AA38 + ldrb r1, [r2] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + ldrh r1, [r0, 0x36] + adds r1, 0x1 + strh r1, [r0, 0x36] + ldrb r0, [r2] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r3 + ldrh r2, [r1, 0x36] + movs r0, 0x7 + ands r0, r2 + strh r0, [r1, 0x36] +_08128F94: + movs r1, 0x14 + ldrsh r0, [r4, r1] + cmp r0, 0 + bne _08128FBA + ldr r3, =gMain + ldrh r1, [r3, 0x2E] + movs r2, 0x1 + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + beq _08128FAC + strh r2, [r4, 0x14] +_08128FAC: + ldrh r1, [r3, 0x2E] + movs r2, 0x2 + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + beq _08128FBA + strh r2, [r4, 0x14] +_08128FBA: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128E18 + + thumb_func_start sub_8128FD8 +sub_8128FD8: @ 8128FD8 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0x1 + bl sub_8197434 + ldr r2, =gSprites + ldr r0, =gUnknown_0203AA38 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r2, 0 + strh r2, [r0, 0x3C] + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + strh r2, [r0, 0x1C] + ldr r1, =sub_8128E18 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8128FD8 + + thumb_func_start sub_8129020 +sub_8129020: @ 8129020 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0812903A + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _08129040 +_0812903A: + adds r0, r2, 0 + bl sub_8128FD8 +_08129040: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129020 + + thumb_func_start sub_8129048 +sub_8129048: @ 8129048 + push {lr} + sub sp, 0x4 + adds r1, r0, 0 + mov r2, sp + movs r0, 0 + strh r0, [r2] + ldr r2, =0x01000452 + mov r0, sp + bl CpuSet + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129048 + + thumb_func_start sub_8129068 +sub_8129068: @ 8129068 + push {lr} + adds r2, r0, 0 + lsls r1, 16 + ldr r0, =gTilesetPointer_SecretBase + ldr r0, [r0] + lsrs r1, 11 + ldr r0, [r0, 0x8] + adds r0, r1 + adds r1, r2, 0 + movs r2, 0x8 + bl CpuFastSet + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129068 + + thumb_func_start sub_8129088 +sub_8129088: @ 8129088 + push {r4-r7,lr} + sub sp, 0x20 + adds r7, r0, 0 + lsls r1, 16 + lsrs r2, r1, 16 + lsrs r4, r1, 26 + adds r5, r4, 0 + cmp r2, 0 + beq _0812909E + ldr r0, =0x000003ff + ands r2, r0 +_0812909E: + ldr r0, =gTilesetPointer_SecretBase + ldr r0, [r0] + lsls r1, r2, 5 + ldr r0, [r0, 0x4] + adds r0, r1 + mov r1, sp + movs r2, 0x8 + bl CpuFastSet + cmp r4, 0x1 + beq _081290DE + cmp r4, 0x1 + bgt _081290C8 + cmp r4, 0 + beq _081290D2 + b _0812919A + .pool +_081290C8: + cmp r5, 0x2 + beq _0812913E + cmp r5, 0x3 + beq _08129176 + b _0812919A +_081290D2: + mov r0, sp + adds r1, r7, 0 + movs r2, 0x8 + bl CpuFastSet + b _0812919A +_081290DE: + movs r5, 0 + movs r6, 0xF +_081290E2: + lsls r4, r5, 2 + adds r4, r7 + adds r5, 0x1 + lsls r3, r5, 2 + subs r0, r3, 0x1 + add r0, sp + ldrb r2, [r0] + lsrs r1, r2, 4 + adds r0, r6, 0 + ands r0, r2 + lsls r0, 4 + adds r1, r0 + strb r1, [r4] + subs r0, r3, 0x2 + add r0, sp + ldrb r2, [r0] + lsrs r1, r2, 4 + adds r0, r6, 0 + ands r0, r2 + lsls r0, 4 + adds r1, r0 + strb r1, [r4, 0x1] + subs r0, r3, 0x3 + add r0, sp + ldrb r2, [r0] + lsrs r1, r2, 4 + adds r0, r6, 0 + ands r0, r2 + lsls r0, 4 + adds r1, r0 + strb r1, [r4, 0x2] + subs r3, 0x4 + mov r1, sp + adds r0, r1, r3 + ldrb r2, [r0] + lsrs r1, r2, 4 + adds r0, r6, 0 + ands r0, r2 + lsls r0, 4 + adds r1, r0 + strb r1, [r4, 0x3] + lsls r5, 16 + lsrs r5, 16 + cmp r5, 0x7 + bls _081290E2 + b _0812919A +_0812913E: + movs r5, 0 + movs r3, 0x7 +_08129142: + lsls r2, r5, 2 + adds r2, r7 + subs r1, r3, r5 + lsls r1, 2 + mov r4, sp + adds r0, r4, r1 + ldrb r0, [r0] + strb r0, [r2] + adds r0, r1, 0x1 + add r0, sp + ldrb r0, [r0] + strb r0, [r2, 0x1] + adds r0, r1, 0x2 + add r0, sp + ldrb r0, [r0] + strb r0, [r2, 0x2] + adds r1, 0x3 + adds r0, r4, r1 + ldrb r0, [r0] + strb r0, [r2, 0x3] + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x7 + bls _08129142 + b _0812919A +_08129176: + movs r5, 0 + movs r4, 0x1F + movs r6, 0xF +_0812917C: + adds r3, r7, r5 + subs r0, r4, r5 + add r0, sp + ldrb r2, [r0] + lsrs r1, r2, 4 + adds r0, r6, 0 + ands r0, r2 + lsls r0, 4 + adds r1, r0 + strb r1, [r3] + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x1F + bls _0812917C +_0812919A: + add sp, 0x20 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8129088 + + thumb_func_start sub_81291A4 +sub_81291A4: @ 81291A4 + push {r4,r5,lr} + adds r5, r0, 0 + movs r4, 0 +_081291AA: + lsls r0, r4, 5 + adds r0, 0x84 + adds r0, r5, r0 + lsls r2, r4, 1 + adds r1, r5, 0x4 + adds r1, r2 + ldrh r1, [r1] + bl sub_8129088 + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0x3F + bls _081291AA + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_81291A4 + + thumb_func_start sub_81291CC +sub_81291CC: @ 81291CC + lsls r0, 16 + ldr r1, =gTilesetPointer_SecretBaseRedCave + ldr r1, [r1] + ldr r1, [r1, 0xC] + lsrs r0, 15 + adds r0, r1 + ldrh r1, [r0] + ldr r0, =0x00000fff + ands r0, r1 + bx lr + .pool + thumb_func_end sub_81291CC + + thumb_func_start sub_81291E8 +sub_81291E8: @ 81291E8 + push {r4-r7,lr} + mov r7, r8 + push {r7} + mov r8, r0 + ldr r0, [r0] + ldrb r0, [r0, 0x12] + movs r6, 0 + ldr r1, =gUnknown_085A71B0 + lsls r5, r0, 4 + adds r0, r5, r1 + ldrb r0, [r0, 0xC] + cmp r6, r0 + bcs _0812924C + adds r7, r1, 0 +_08129204: + mov r4, r8 + ldm r4!, {r1} + adds r0, r7, 0x4 + adds r0, r5, r0 + ldr r0, [r0] + adds r0, r6 + ldrb r0, [r0] + ldr r1, [r1, 0x1C] + lsls r0, 1 + adds r0, r1 + ldrh r0, [r0] + adds r1, r7, 0 + adds r1, 0x8 + adds r1, r5, r1 + ldr r1, [r1] + adds r1, r6 + lsls r0, 3 + ldrb r1, [r1] + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl sub_81291CC + adds r2, r5, r7 + ldr r1, [r2] + adds r1, r6 + ldrb r1, [r1] + lsls r1, 1 + adds r4, r1 + strh r0, [r4] + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + ldrb r2, [r2, 0xC] + cmp r6, r2 + bcc _08129204 +_0812924C: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81291E8 + + thumb_func_start sub_812925C +sub_812925C: @ 812925C + push {r4,r5,lr} + lsls r0, 24 + ldr r3, =gUnknown_0203AA3C + movs r1, 0 + strb r1, [r3] + ldrb r2, [r3, 0x1] + subs r1, 0x4 + ands r1, r2 + movs r5, 0xD + negs r5, r5 + ands r1, r5 + movs r2, 0x11 + negs r2, r2 + ands r1, r2 + subs r2, 0x10 + ands r1, r2 + strb r1, [r3, 0x1] + ldr r1, =gUnknown_085A7250 + lsrs r0, 22 + adds r0, r1 + ldrb r1, [r0] + movs r4, 0x3F + lsls r1, 6 + strb r1, [r3, 0x1] + ldrh r2, [r3, 0x2] + ldr r1, =0xfffffe00 + ands r1, r2 + strh r1, [r3, 0x2] + ldrb r2, [r3, 0x3] + movs r1, 0x3F + negs r1, r1 + ands r1, r2 + strb r1, [r3, 0x3] + ldrb r0, [r0, 0x1] + lsls r0, 6 + ands r4, r1 + orrs r4, r0 + strb r4, [r3, 0x3] + ldrh r1, [r3, 0x4] + ldr r0, =0xfffffc00 + ands r0, r1 + strh r0, [r3, 0x4] + ldrb r0, [r3, 0x5] + ands r5, r0 + movs r0, 0xF + ands r5, r0 + strb r5, [r3, 0x5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812925C + + thumb_func_start sub_81292D0 +sub_81292D0: @ 81292D0 + movs r1, 0 + strh r1, [r0, 0x32] + strh r1, [r0, 0x34] + strh r1, [r0, 0x36] + strh r1, [r0, 0x38] + strh r1, [r0, 0x3A] + strh r1, [r0, 0x3C] + ldr r1, =sub_81292E8 + str r1, [r0, 0x1C] + bx lr + .pool + thumb_func_end sub_81292D0 + + thumb_func_start sub_81292E8 +sub_81292E8: @ 81292E8 + push {lr} + adds r2, r0, 0 + movs r1, 0x3C + ldrsh r0, [r2, r1] + cmp r0, 0 + bne _08129322 + movs r1, 0x3A + ldrsh r0, [r2, r1] + cmp r0, 0xE + bgt _0812930A + adds r3, r2, 0 + adds r3, 0x3E + ldrb r1, [r3] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + b _08129314 +_0812930A: + adds r3, r2, 0 + adds r3, 0x3E + ldrb r0, [r3] + movs r1, 0x4 + orrs r0, r1 +_08129314: + strb r0, [r3] + ldrh r0, [r2, 0x3A] + adds r0, 0x1 + movs r1, 0x1F + ands r0, r1 + strh r0, [r2, 0x3A] + b _0812932E +_08129322: + adds r2, 0x3E + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] +_0812932E: + pop {r0} + bx r0 + thumb_func_end sub_81292E8 + + thumb_func_start gpu_pal_decompress_alloc_tag_and_upload +gpu_pal_decompress_alloc_tag_and_upload: @ 8129334 + push {r4,r5,lr} + sub sp, 0x4 + adds r5, r0, 0 + lsls r4, r1, 24 + lsrs r4, 24 + bl sub_8129048 + lsls r4, 5 + ldr r0, =gDecorations + adds r4, r0 + str r4, [r5] + ldrb r0, [r4, 0x11] + cmp r0, 0x4 + beq _081293B4 + ldr r0, =0x00000be5 + bl FreeSpritePaletteByTag + adds r0, r5, 0 + bl sub_81291E8 + ldr r0, [r5] + ldrb r0, [r0, 0x12] + bl sub_812925C + adds r0, r5, 0 + bl sub_81291A4 + ldr r1, =0x00000884 + adds r0, r5, r1 + ldr r1, =gTilesetPointer_SecretBaseRedCave + ldr r2, [r1] + ldr r1, [r5] + ldr r1, [r1, 0x1C] + ldrh r1, [r1] + ldr r2, [r2, 0xC] + lsls r1, 4 + adds r1, r2 + ldrh r1, [r1, 0xE] + lsrs r1, 12 + bl sub_8129068 + ldr r0, =gUnknown_085A72BC + bl LoadSpritePalette + ldr r0, =gUnknown_085A728C + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl CreateSprite + b _081293C6 + .pool +_081293B4: + ldr r0, [r4, 0x1C] + ldrh r0, [r0] + ldr r1, =SpriteCallbackDummy + movs r2, 0x1 + str r2, [sp] + movs r2, 0 + movs r3, 0 + bl AddPseudoFieldObject +_081293C6: + lsls r0, 24 + lsrs r0, 24 + add sp, 0x4 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end gpu_pal_decompress_alloc_tag_and_upload + + thumb_func_start AddDecorationIconObjectFromIconTable +@ u8 AddDecorationIconObjectFromIconTable(u16 tilesTag, u16 paletteTag, u8 decorationId) +AddDecorationIconObjectFromIconTable: @ 81293D8 + push {r4-r7,lr} + sub sp, 0x10 + lsls r0, 16 + lsrs r7, r0, 16 + lsls r1, 16 + lsrs r6, r1, 16 + lsls r2, 24 + lsrs r5, r2, 24 + bl AllocItemIconTemporaryBuffers + lsls r0, 24 + cmp r0, 0 + beq _08129490 + adds r0, r5, 0 + movs r1, 0 + bl GetDecorationIconPicOrPalette + ldr r4, =gUnknown_0203CEBC + ldr r1, [r4] + bl LZDecompressWram + ldr r0, [r4] + ldr r4, =gUnknown_0203CEC0 + ldr r1, [r4] + bl CopyItemIconPicTo4x4Buffer + ldr r0, [r4] + str r0, [sp] + ldr r4, =0xffff0000 + ldr r0, [sp, 0x4] + ands r0, r4 + movs r1, 0x80 + lsls r1, 2 + orrs r0, r1 + lsls r2, r7, 16 + ldr r1, =0x0000ffff + ands r0, r1 + orrs r0, r2 + str r0, [sp, 0x4] + mov r0, sp + bl LoadSpriteSheet + adds r0, r5, 0 + movs r1, 0x1 + bl GetDecorationIconPicOrPalette + str r0, [sp, 0x8] + add r0, sp, 0x8 + ldr r1, [r0, 0x4] + ands r1, r4 + orrs r1, r6 + str r1, [r0, 0x4] + bl LoadCompressedObjectPalette + movs r0, 0x18 + bl Alloc + adds r5, r0, 0 + adds r1, r5, 0 + ldr r0, =gUnknown_08614FF4 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + strh r7, [r5] + strh r6, [r5, 0x2] + adds r0, r5, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl CreateSprite + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl FreeItemIconTemporaryBuffers + adds r0, r5, 0 + bl Free + adds r0, r4, 0 + b _08129492 + .pool +_08129490: + movs r0, 0x40 +_08129492: + add sp, 0x10 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end AddDecorationIconObjectFromIconTable + + thumb_func_start GetDecorationIconPicOrPalette +@ u32 GetDecorationIconPicOrPalette(u16 decorationId, u8 which) +GetDecorationIconPicOrPalette: @ 812949C + push {lr} + lsls r0, 16 + lsrs r3, r0, 16 + lsls r1, 24 + lsrs r0, r1, 24 + cmp r3, 0x78 + bls _081294AC + movs r3, 0 +_081294AC: + ldr r2, =gUnknown_085A6BE8 + lsls r0, 2 + lsls r1, r3, 3 + adds r0, r1 + adds r0, r2 + ldr r0, [r0] + pop {r1} + bx r1 + .pool + thumb_func_end GetDecorationIconPicOrPalette + + thumb_func_start AddDecorationIconObjectFromFieldObject +@ u8 AddDecorationIconObjectFromFieldObject(u16 tilesTag, u16 paletteTag, u8 decorationId) +AddDecorationIconObjectFromFieldObject: @ 81294C0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x14 + adds r4, r2, 0 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + lsls r1, 16 + lsrs r7, r1, 16 + lsls r4, 24 + lsrs r4, 24 + ldr r6, =gUnknown_0203A190 + adds r0, r6, 0 + bl sub_8129048 + lsls r4, 5 + ldr r0, =gDecorations + adds r4, r0 + str r4, [r6] + ldrb r0, [r4, 0x11] + cmp r0, 0x4 + beq _081295A4 + adds r0, r6, 0 + bl sub_81291E8 + ldr r0, [r6] + ldrb r0, [r0, 0x12] + bl sub_812925C + adds r0, r6, 0 + bl sub_81291A4 + ldr r0, =0x00000884 + adds r5, r6, r0 + ldr r0, =gTilesetPointer_SecretBaseRedCave + ldr r1, [r0] + ldr r0, [r6] + ldr r0, [r0, 0x1C] + ldrh r0, [r0] + ldr r1, [r1, 0xC] + lsls r0, 4 + adds r0, r1 + ldrh r1, [r0, 0xE] + lsrs r1, 12 + adds r0, r5, 0 + bl sub_8129068 + adds r0, r6, 0 + adds r0, 0x84 + str r0, [sp, 0x4] + ldr r1, =gUnknown_085A72F4 + ldr r0, [r6] + ldrb r0, [r0, 0x12] + lsls r0, 1 + adds r0, r1 + ldrh r0, [r0] + lsls r0, 21 + ldr r4, =0xffff0000 + mov r2, r8 + lsls r1, r2, 16 + lsrs r0, 16 + orrs r0, r1 + str r0, [sp, 0x8] + add r0, sp, 0x4 + bl LoadSpriteSheet + str r5, [sp, 0xC] + add r0, sp, 0xC + ldr r1, [r0, 0x4] + ands r1, r4 + orrs r1, r7 + str r1, [r0, 0x4] + bl LoadSpritePalette + movs r0, 0x18 + bl Alloc + adds r4, r0, 0 + adds r1, r4, 0 + ldr r0, =gUnknown_085A72A4 + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + mov r3, r8 + strh r3, [r4] + strh r7, [r4, 0x2] + adds r0, r4, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r5, r0, 24 + adds r0, r4, 0 + bl Free + b _081295BA + .pool +_081295A4: + ldr r0, [r4, 0x1C] + ldrh r0, [r0] + ldr r1, =SpriteCallbackDummy + movs r2, 0x1 + str r2, [sp] + movs r2, 0 + movs r3, 0 + bl AddPseudoFieldObject + lsls r0, 24 + lsrs r5, r0, 24 +_081295BA: + adds r0, r5, 0 + add sp, 0x14 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end AddDecorationIconObjectFromFieldObject + + thumb_func_start AddDecorationIconObject +@ u8 AddDecorationIconObject(u8 decorationId, u16 x, u16 y, u8 priority, u16 tilesTag, u16 paletteTag) +AddDecorationIconObject: @ 81295CC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + ldr r4, [sp, 0x24] + ldr r5, [sp, 0x28] + lsls r0, 24 + lsrs r6, r0, 24 + mov r12, r6 + lsls r1, 16 + lsrs r1, 16 + mov r8, r1 + mov r9, r8 + lsls r2, 16 + lsrs r7, r2, 16 + mov r10, r7 + lsls r3, 24 + lsrs r3, 24 + str r3, [sp] + lsls r4, 16 + lsrs r4, 16 + adds r3, r4, 0 + lsls r5, 16 + lsrs r5, 16 + adds r2, r5, 0 + cmp r6, 0x78 + bls _08129634 + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0 + bl AddDecorationIconObjectFromIconTable + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x40 + beq _08129696 + ldr r2, =gSprites + lsls r3, r4, 4 + adds r1, r3, r4 + lsls r1, 2 + adds r1, r2 + mov r5, r8 + lsls r0, r5, 16 + asrs r0, 16 + adds r0, 0x4 + strh r0, [r1, 0x24] + lsls r0, r7, 16 + b _081296B2 + .pool +_08129634: + ldr r0, =gUnknown_085A6BE8 + lsls r1, r6, 3 + adds r1, r0 + ldr r0, [r1] + cmp r0, 0 + bne _08129684 + adds r0, r4, 0 + adds r1, r5, 0 + adds r2, r6, 0 + bl AddDecorationIconObjectFromFieldObject + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x40 + beq _08129696 + ldr r1, =gSprites + lsls r2, r4, 4 + adds r0, r2, r4 + lsls r0, 2 + adds r5, r0, r1 + mov r0, r8 + strh r0, [r5, 0x24] + adds r0, r6, 0 + subs r0, 0x2A + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _08129680 + lsls r0, r7, 16 + asrs r0, 16 + subs r0, 0x4 + strh r0, [r5, 0x26] + b _081296BC + .pool +_08129680: + strh r7, [r5, 0x26] + b _081296BC +_08129684: + adds r0, r3, 0 + adds r1, r2, 0 + mov r2, r12 + bl AddDecorationIconObjectFromIconTable + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x40 + bne _0812969A +_08129696: + movs r0, 0x40 + b _081296D8 +_0812969A: + ldr r2, =gSprites + lsls r3, r4, 4 + adds r1, r3, r4 + lsls r1, 2 + adds r1, r2 + mov r5, r9 + lsls r0, r5, 16 + asrs r0, 16 + adds r0, 0x4 + strh r0, [r1, 0x24] + mov r5, r10 + lsls r0, r5, 16 +_081296B2: + asrs r0, 16 + adds r0, 0x4 + strh r0, [r1, 0x26] + adds r1, r2, 0 + adds r2, r3, 0 +_081296BC: + adds r2, r4 + lsls r2, 2 + adds r2, r1 + movs r0, 0x3 + ldr r1, [sp] + ands r1, r0 + lsls r1, 2 + ldrb r3, [r2, 0x5] + movs r0, 0xD + negs r0, r0 + ands r0, r3 + orrs r0, r1 + strb r0, [r2, 0x5] + adds r0, r4, 0 +_081296D8: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end AddDecorationIconObject + + thumb_func_start sub_81296EC +sub_81296EC: @ 81296EC + lsls r0, 24 + lsrs r0, 24 + ldr r3, =gUnknown_0203A17C + ldr r1, [r3] + adds r1, r0 + movs r2, 0 + strb r2, [r1] + ldr r1, [r3, 0x4] + adds r1, r0 + strb r2, [r1] + bx lr + .pool + thumb_func_end sub_81296EC + + thumb_func_start sub_8129708 +sub_8129708: @ 8129708 + push {r4-r6,lr} + ldr r6, =gSpecialVar_0x8005 + movs r0, 0 + strh r0, [r6] + ldr r2, =gScriptResult + strh r0, [r2] + ldr r4, =gSpecialVar_0x8004 + ldr r1, =gUnknown_0203AAC4 + ldrh r0, [r4] + ldrb r1, [r1] + cmp r0, r1 + bne _08129744 + movs r0, 0x1 + strh r0, [r2] + b _08129796 + .pool +_08129738: + ldr r1, =gSpecialVar_0x8006 + ldrb r0, [r2] + strh r0, [r1] + b _08129796 + .pool +_08129744: + ldr r3, =gDecorations + ldr r2, =gUnknown_0203A17C + ldr r1, =gUnknown_0203AA44 + ldrh r0, [r4] + lsls r0, 3 + adds r4, r0, r1 + ldrb r1, [r4] + ldr r0, [r2] + adds r0, r1 + ldrb r0, [r0] + lsls r0, 5 + adds r0, r3 + ldrb r0, [r0, 0x11] + cmp r0, 0x4 + bne _08129796 + ldrh r0, [r4, 0x4] + strh r0, [r6] + ldrb r0, [r4] + bl sub_81296EC + movs r1, 0 + ldr r0, =gMapHeader + ldr r0, [r0, 0x4] + ldrb r2, [r0] + cmp r1, r2 + bcs _08129796 + ldr r5, [r0, 0x4] + ldrh r4, [r6] + adds r3, r2, 0 +_0812977E: + lsls r0, r1, 1 + adds r0, r1 + lsls r0, 3 + adds r2, r0, r5 + ldrh r0, [r2, 0x14] + cmp r0, r4 + beq _08129738 + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, r3 + bcc _0812977E +_08129796: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129708 + + thumb_func_start sub_81297AC +sub_81297AC: @ 81297AC + push {r4-r6,lr} + movs r2, 0 + ldr r0, =gMapHeader + ldr r0, [r0, 0x4] + ldrb r1, [r0] + cmp r2, r1 + bcs _081297F0 + adds r3, r0, 0 + ldr r5, [r3, 0x4] + ldr r0, =gSpecialVar_0x8004 + ldrh r4, [r0] + ldr r6, =gSpecialVar_0x8005 +_081297C4: + lsls r0, r2, 1 + adds r0, r2 + lsls r0, 3 + adds r1, r0, r5 + ldrh r0, [r1, 0x14] + cmp r0, r4 + bne _081297E4 + ldrb r0, [r1] + strh r0, [r6] + b _081297F0 + .pool +_081297E4: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + ldrb r0, [r3] + cmp r2, r0 + bcc _081297C4 +_081297F0: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_81297AC + + thumb_func_start sub_81297F8 +sub_81297F8: @ 81297F8 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0xC + movs r6, 0 + b _081298BE +_08129808: + ldr r3, =gUnknown_0203AA44 + lsls r5, r6, 3 + adds r4, r5, r3 + ldrb r1, [r4] + ldr r2, =gUnknown_0203A17C + ldr r0, [r2] + adds r0, r1 + ldrb r0, [r0] + lsls r0, 5 + ldr r7, =gDecorations + adds r0, r7 + ldrb r2, [r0, 0x11] + ldr r7, =gUnknown_0203A17C + ldr r0, [r7, 0x4] + adds r0, r1 + ldrb r0, [r0] + lsrs r1, r0, 4 + mov r8, r1 + movs r7, 0xF + adds r1, r7, 0 + ands r1, r0 + str r1, [sp] + adds r7, r5, 0 + adds r6, 0x1 + str r6, [sp, 0x4] + cmp r2, 0x4 + beq _081298B8 + movs r6, 0 + ldrb r4, [r4, 0x2] + cmp r6, r4 + bcs _081298AE +_08129846: + movs r4, 0 + adds r0, r5, r3 + adds r2, r6, 0x1 + mov r10, r2 + ldrb r0, [r0, 0x1] + cmp r4, r0 + bcs _0812989C + ldr r3, =gUnknown_0203AA44 + adds r3, r7 + mov r9, r3 + subs r5, r6, 0x7 + str r5, [sp, 0x8] +_0812985E: + adds r0, r4, 0x7 + add r0, r8 + ldr r1, =gMapHeader + ldr r3, [r1] + ldr r1, [sp] + subs r2, r1, r6 + ldr r1, [r3] + muls r2, r1 + mov r5, r8 + adds r1, r5, r4 + adds r1, r2 + ldr r2, [r3, 0xC] + lsls r1, 1 + adds r1, r2 + ldrh r1, [r1] + movs r3, 0xC0 + lsls r3, 6 + adds r2, r3, 0 + orrs r2, r1 + ldr r5, [sp] + ldr r3, [sp, 0x8] + subs r1, r5, r3 + bl MapGridSetMetatileEntryAt + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + mov r5, r9 + ldrb r5, [r5, 0x1] + cmp r4, r5 + bcc _0812985E +_0812989C: + mov r1, r10 + lsls r0, r1, 24 + lsrs r6, r0, 24 + ldr r3, =gUnknown_0203AA44 + adds r5, r7, 0 + adds r0, r7, r3 + ldrb r0, [r0, 0x2] + cmp r6, r0 + bcc _08129846 +_081298AE: + ldr r2, =gUnknown_0203AA44 + adds r0, r7, r2 + ldrb r0, [r0] + bl sub_81296EC +_081298B8: + ldr r3, [sp, 0x4] + lsls r0, r3, 24 + lsrs r6, r0, 24 +_081298BE: + ldr r0, =gUnknown_0203AAC4 + ldrb r0, [r0] + cmp r6, r0 + bcc _08129808 + add sp, 0xC + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81297F8 + + thumb_func_start sub_81298EC +sub_81298EC: @ 81298EC + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r4, r0, r1 + movs r1, 0xC + ldrsh r0, [r4, r1] + cmp r0, 0x1 + beq _08129928 + cmp r0, 0x1 + bgt _08129914 + cmp r0, 0 + beq _0812991E + b _08129994 + .pool +_08129914: + cmp r0, 0x2 + beq _08129954 + cmp r0, 0x3 + beq _08129968 + b _08129994 +_0812991E: + bl sub_81297F8 + movs r0, 0x1 + strh r0, [r4, 0xC] + b _08129994 +_08129928: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08129994 + bl DrawWholeMapView + ldr r0, =gUnknown_08275D2E + bl ScriptContext1_SetupScript + movs r0, 0 + movs r1, 0x1 + bl sub_8197434 + movs r0, 0x2 + strh r0, [r4, 0xC] + b _08129994 + .pool +_08129954: + bl ScriptContext2_Enable + adds r0, r5, 0 + bl sub_8127814 + bl pal_fill_black + movs r0, 0x3 + strh r0, [r4, 0xC] + b _08129994 +_08129968: + bl sub_80ABDFC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08129994 + ldr r4, =gStringVar4 + ldr r1, =gText_DecorationReturnedToPC + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8129D64 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + ldr r0, =gMapHeader + ldrb r0, [r0, 0x14] + cmp r0, 0x56 + bne _08129994 + bl sub_80EE104 +_08129994: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81298EC + + thumb_func_start sub_81299AC +sub_81299AC: @ 81299AC + push {lr} + movs r1, 0 + ldr r0, =gUnknown_0203A17C + ldrb r2, [r0, 0x8] + cmp r1, r2 + bcs _081299D6 + ldr r3, [r0] +_081299BA: + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _081299CC + movs r0, 0x1 + b _081299D8 + .pool +_081299CC: + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, r2 + bcc _081299BA +_081299D6: + movs r0, 0 +_081299D8: + pop {r1} + bx r1 + thumb_func_end sub_81299AC + + thumb_func_start SetUpPuttingAwayDecorationPlayerAvatar +SetUpPuttingAwayDecorationPlayerAvatar: @ 81299DC + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x4 + bl player_get_direction_lower_nybble + ldr r3, =gUnknown_0203AA38 + ldr r2, =gSprites + ldr r4, =gUnknown_03005DD0 + ldr r1, [r4, 0x4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldrh r0, [r0, 0x2E] + strb r0, [r3] + bl sub_812A39C + ldr r0, =gUnknown_085A7404 + movs r1, 0x78 + movs r2, 0x50 + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + str r0, [r4, 0x4] + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0 + bne _08129A3C + ldr r1, =SpriteCallbackDummy + str r0, [sp] + movs r0, 0xC1 + b _08129A44 + .pool +_08129A3C: + ldr r1, =SpriteCallbackDummy + movs r0, 0 + str r0, [sp] + movs r0, 0xC2 +_08129A44: + movs r2, 0x88 + movs r3, 0x48 + bl AddPseudoFieldObject + ldr r1, =gUnknown_0203AA39 + strb r0, [r1] + ldr r6, =gSprites + ldr r0, =gUnknown_0203AA39 + ldrb r0, [r0] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r6 + ldrb r2, [r1, 0x5] + movs r4, 0xD + negs r4, r4 + adds r0, r4, 0 + ands r0, r2 + movs r2, 0x4 + mov r8, r2 + mov r2, r8 + orrs r0, r2 + strb r0, [r1, 0x5] + ldr r5, =gUnknown_0203AA38 + ldrb r1, [r5] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r6 + bl DestroySprite + ldr r0, =gUnknown_03005DD0 + ldr r0, [r0, 0x4] + strb r0, [r5] + ldrb r1, [r5] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r6 + ldrb r1, [r0, 0x5] + ands r4, r1 + mov r1, r8 + orrs r4, r1 + strb r4, [r0, 0x5] + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end SetUpPuttingAwayDecorationPlayerAvatar + + thumb_func_start sub_8129ABC +sub_8129ABC: @ 8129ABC + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + movs r1, 0x4 + ldrsh r0, [r4, r1] + cmp r0, 0x1 + beq _08129B0C + cmp r0, 0x1 + bgt _08129AE4 + cmp r0, 0 + beq _08129AEA + b _08129B2E + .pool +_08129AE4: + cmp r0, 0x2 + beq _08129B1A + b _08129B2E +_08129AEA: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08129B2E + adds r0, r5, 0 + bl sub_8127ACC + movs r0, 0x1 + strh r0, [r4, 0x4] + strh r0, [r4, 0xC] + strh r0, [r4, 0xA] + b _08129B2E + .pool +_08129B0C: + bl SetUpPuttingAwayDecorationPlayerAvatar + bl pal_fill_black + movs r0, 0x2 + strh r0, [r4, 0x4] + b _08129B2E +_08129B1A: + bl sub_80ABDFC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08129B2E + strh r0, [r4, 0x18] + adds r0, r5, 0 + bl sub_8129B34 +_08129B2E: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_8129ABC + + thumb_func_start sub_8129B34 +sub_8129B34: @ 8129B34 + push {r4-r6,lr} + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + movs r0, 0 + movs r1, 0x1 + bl sub_8197434 + ldr r4, =gSprites + ldr r3, =gUnknown_0203AA38 + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + movs r6, 0 + strh r6, [r0, 0x3C] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + adds r0, 0x3E + ldrb r2, [r0] + movs r1, 0x5 + negs r1, r1 + ands r1, r2 + strb r1, [r0] + ldrb r1, [r3] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r1, r4, 0 + adds r1, 0x1C + adds r0, r1 + ldr r1, =sub_812A36C + str r1, [r0] + ldr r2, =gUnknown_0203AA39 + ldrb r1, [r2] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + movs r1, 0x88 + strh r1, [r0, 0x20] + ldrb r1, [r2] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r4 + movs r1, 0x48 + strh r1, [r0, 0x22] + ldr r1, =gTasks + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + adds r0, r1 + strh r6, [r0, 0x1C] + ldr r1, =sub_8128E18 + str r1, [r0] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129B34 + + thumb_func_start sub_8129BCC +sub_8129BCC: @ 8129BCC + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0x1C] + bl sub_8128DE0 + adds r0, r4, 0 + bl sub_8129C74 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129BCC + + thumb_func_start sub_8129BF8 +sub_8129BF8: @ 8129BF8 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0x1C] + bl sub_8128DE0 + ldr r3, =gSprites + ldr r5, =gUnknown_0203AA38 + ldrb r1, [r5] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + adds r0, 0x3E + ldrb r2, [r0] + movs r1, 0x5 + negs r1, r1 + ands r1, r2 + strb r1, [r0] + ldrb r1, [r5] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r3, 0x1C + adds r0, r3 + ldr r1, =SpriteCallbackDummy + str r1, [r0] + ldr r5, =gStringVar4 + ldr r1, =gText_StopPuttingAwayDecorations + adds r0, r5, 0 + bl StringExpandPlaceholders + ldr r2, =sub_812A1F0 + adds r0, r4, 0 + adds r1, r5, 0 + bl DisplayItemMessageOnField + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129BF8 + + thumb_func_start sub_8129C74 +sub_8129C74: @ 8129C74 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + adds r0, r5, 0 + bl sub_812A0E8 + ldr r0, =gUnknown_0203AAC4 + ldrb r0, [r0] + cmp r0, 0 + beq _08129CA8 + ldr r4, =gStringVar4 + ldr r1, =gText_ReturnDecorationToPC + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_812A1A0 + b _08129D14 + .pool +_08129CA8: + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r1, r0 + movs r2, 0 + ldrsh r0, [r1, r2] + movs r2, 0x2 + ldrsh r1, [r1, r2] + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r4, r0, 24 + adds r0, r4, 0 + bl MetatileBehavior_IsSecretBasePC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08129CDE + adds r0, r4, 0 + bl MetatileBehavior_IsMB_C5 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _08129D3C +_08129CDE: + ldr r3, =gSprites + ldr r4, =gUnknown_0203AA38 + ldrb r1, [r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + adds r0, 0x3E + ldrb r2, [r0] + movs r1, 0x5 + negs r1, r1 + ands r1, r2 + strb r1, [r0] + ldrb r1, [r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r3, 0x1C + adds r0, r3 + ldr r1, =SpriteCallbackDummy + str r1, [r0] + ldr r4, =gStringVar4 + ldr r1, =gText_StopPuttingAwayDecorations + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_812A1F0 +_08129D14: + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + b _08129D50 + .pool +_08129D3C: + ldr r4, =gStringVar4 + ldr r1, =gText_NoDecorationHere + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8129D64 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField +_08129D50: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129C74 + + thumb_func_start sub_8129D64 +sub_8129D64: @ 8129D64 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _08129D7E + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _08129D84 +_08129D7E: + adds r0, r2, 0 + bl sub_8129B34 +_08129D84: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129D64 + + thumb_func_start sub_8129D8C +sub_8129D8C: @ 8129D8C + push {lr} + adds r2, r1, 0 + lsls r0, 24 + ldr r1, =gDecorations + lsrs r0, 19 + adds r0, r1 + ldrb r1, [r0, 0x12] + cmp r1, 0 + bne _08129DA8 + movs r0, 0x1 + strb r0, [r2, 0x1] + b _08129E06 + .pool +_08129DA8: + cmp r1, 0x1 + bne _08129DB4 + movs r0, 0x2 + strb r0, [r2, 0x1] + strb r1, [r2, 0x2] + b _08129E08 +_08129DB4: + cmp r1, 0x2 + bne _08129DC0 + movs r0, 0x3 + strb r0, [r2, 0x1] + movs r0, 0x1 + b _08129E06 +_08129DC0: + cmp r1, 0x3 + bne _08129DC8 + movs r0, 0x4 + b _08129E02 +_08129DC8: + cmp r1, 0x4 + bne _08129DD2 + movs r0, 0x2 + strb r0, [r2, 0x1] + b _08129E06 +_08129DD2: + cmp r1, 0x5 + bne _08129DDA + movs r0, 0x1 + b _08129E02 +_08129DDA: + cmp r1, 0x6 + bne _08129DE6 + movs r0, 0x1 + strb r0, [r2, 0x1] + movs r0, 0x3 + b _08129E06 +_08129DE6: + cmp r1, 0x7 + bne _08129DF2 + movs r0, 0x2 + strb r0, [r2, 0x1] + movs r0, 0x4 + b _08129E06 +_08129DF2: + cmp r1, 0x8 + bne _08129DFC + movs r0, 0x3 + strb r0, [r2, 0x1] + b _08129E06 +_08129DFC: + cmp r1, 0x9 + bne _08129E08 + movs r0, 0x3 +_08129E02: + strb r0, [r2, 0x1] + movs r0, 0x2 +_08129E06: + strb r0, [r2, 0x2] +_08129E08: + pop {r0} + bx r0 + thumb_func_end sub_8129D8C + + thumb_func_start sub_8129E0C +sub_8129E0C: @ 8129E0C + push {r4-r6,lr} + lsls r0, 24 + lsls r1, 24 + ldr r5, =gSprites + ldr r6, =gUnknown_0203AA38 + ldrb r3, [r6] + lsls r2, r3, 4 + adds r2, r3 + lsls r2, 2 + adds r2, r5 + adds r2, 0x3E + ldrb r3, [r2] + movs r4, 0x4 + orrs r3, r4 + strb r3, [r2] + ldrb r3, [r6] + lsls r2, r3, 4 + adds r2, r3 + lsls r2, 2 + adds r3, r5, 0 + adds r3, 0x1C + adds r2, r3 + ldr r3, =SpriteCallbackDummy + str r3, [r2] + ldr r4, =gUnknown_0203AA39 + ldrb r3, [r4] + lsls r2, r3, 4 + adds r2, r3 + lsls r2, 2 + adds r2, r5 + lsrs r0, 20 + adds r0, 0x88 + strh r0, [r2, 0x20] + ldrb r2, [r4] + lsls r0, r2, 4 + adds r0, r2 + lsls r0, 2 + adds r0, r5 + lsrs r1, 20 + adds r1, 0x48 + strh r1, [r0, 0x22] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8129E0C + + thumb_func_start sub_8129E74 +sub_8129E74: @ 8129E74 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + mov r9, r2 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + ldr r3, =gTasks + lsls r2, r0, 2 + adds r2, r0 + lsls r2, 3 + adds r2, r3 + ldrb r0, [r2, 0x8] + subs r0, 0x7 + lsls r0, 24 + lsrs r7, r0, 24 + ldrb r0, [r2, 0xA] + subs r0, 0x7 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + ldr r2, =gUnknown_0203A17C + ldr r0, [r2, 0x4] + adds r0, r1 + ldrb r0, [r0] + lsrs r5, r0, 4 + movs r6, 0xF + ands r6, r0 + mov r0, r9 + ldrb r4, [r0, 0x2] + ldr r0, [r2] + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x29 + bne _08129ED4 + adds r0, r5, 0x7 + adds r1, r6, 0x7 + bl MapGridGetMetatileIdAt + movs r1, 0xA3 + lsls r1, 2 + cmp r0, r1 + bne _08129ED4 + subs r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 +_08129ED4: + cmp r7, r5 + bcc _08129F10 + mov r0, r9 + ldrb r2, [r0, 0x1] + adds r0, r5, r2 + cmp r7, r0 + bge _08129F10 + subs r0, r6, r4 + cmp r8, r0 + ble _08129F10 + cmp r8, r6 + bhi _08129F10 + subs r0, r7, r5 + adds r0, 0x1 + subs r0, r2, r0 + lsls r0, 24 + lsrs r0, 24 + mov r2, r8 + subs r1, r6, r2 + lsls r1, 24 + lsrs r1, 24 + bl sub_8129E0C + movs r0, 0x1 + b _08129F12 + .pool +_08129F10: + movs r0, 0 +_08129F12: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8129E74 + + thumb_func_start sub_8129F20 +sub_8129F20: @ 8129F20 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + ldr r2, =gUnknown_0203A17C + ldr r3, =gUnknown_0203AA44 + ldr r0, =gUnknown_0203AAC4 + ldrb r0, [r0] + lsls r0, 3 + adds r0, r3 + ldrb r1, [r0] + ldr r0, [r2, 0x4] + adds r0, r1 + ldrb r0, [r0] + lsrs r1, r0, 4 + mov r8, r1 + movs r6, 0xF + ands r6, r0 + movs r4, 0 + ldr r7, =gSaveBlock1Ptr + mov r9, r3 +_08129F4A: + ldr r1, [r7] + lsls r0, r4, 1 + adds r0, r4 + lsls r5, r0, 3 + adds r1, r5 + ldr r2, =0x00000c74 + adds r0, r1, r2 + movs r2, 0 + ldrsh r0, [r0, r2] + cmp r0, r8 + bne _08129FB0 + ldr r2, =0x00000c76 + adds r0, r1, r2 + movs r2, 0 + ldrsh r0, [r0, r2] + cmp r0, r6 + bne _08129FB0 + ldr r2, =0x00000c84 + adds r0, r1, r2 + ldrh r0, [r0] + bl FlagGet + lsls r0, 24 + cmp r0, 0 + bne _08129FB0 + ldr r0, =gUnknown_0203AAC4 + ldrb r1, [r0] + lsls r1, 3 + add r1, r9 + ldr r0, [r7] + adds r0, r5 + ldr r2, =0x00000c84 + adds r0, r2 + ldrh r0, [r0] + strh r0, [r1, 0x4] + b _08129FBA + .pool +_08129FB0: + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0x3F + bls _08129F4A +_08129FBA: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8129F20 + + thumb_func_start sub_8129FC8 +sub_8129FC8: @ 8129FC8 + push {r4-r7,lr} + lsls r0, 24 + lsrs r7, r0, 24 + movs r6, 0 + b _0812A02A +_08129FD2: + ldr r0, [r0] + adds r1, r0, r6 + ldrb r0, [r1] + cmp r0, 0 + beq _0812A024 + ldr r0, =gDecorations + ldrb r2, [r1] + lsls r1, r2, 5 + adds r1, r0 + ldrb r0, [r1, 0x11] + cmp r0, 0x4 + bne _0812A024 + ldr r5, =gUnknown_0203AA44 + adds r0, r2, 0 + adds r1, r5, 0 + bl sub_8129D8C + lsls r1, r6, 24 + lsrs r1, 24 + adds r0, r7, 0 + adds r2, r5, 0 + bl sub_8129E74 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x1 + bne _0812A024 + strb r6, [r5] + bl sub_8129F20 + ldr r0, =gUnknown_0203AAC4 + strb r4, [r0] + movs r0, 0x1 + b _0812A034 + .pool +_0812A024: + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 +_0812A02A: + ldr r0, =gUnknown_0203A17C + ldrb r1, [r0, 0x8] + cmp r6, r1 + bcc _08129FD2 + movs r0, 0 +_0812A034: + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8129FC8 + + thumb_func_start sub_812A040 +sub_812A040: @ 812A040 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp] + lsls r1, 24 + lsrs r1, 24 + mov r10, r1 + lsls r2, 24 + lsrs r2, 24 + mov r9, r2 + lsls r3, 24 + lsrs r3, 24 + mov r8, r3 + movs r4, 0 + ldr r7, =gUnknown_0203A17C + ldrb r0, [r7, 0x8] + cmp r4, r0 + bcs _0812A0C6 + adds r6, r7, 0 + ldr r5, =gUnknown_0203AAC4 +_0812A072: + ldr r0, [r6] + adds r0, r4 + ldrb r1, [r0] + ldr r0, [r6, 0x4] + adds r0, r4 + ldrb r0, [r0] + lsrs r3, r0, 4 + movs r2, 0xF + ands r2, r0 + cmp r1, 0 + beq _0812A0BA + ldr r0, =gDecorations + lsls r1, 5 + adds r1, r0 + ldrb r0, [r1, 0x11] + cmp r0, 0x4 + bne _0812A0BA + ldr r0, [sp] + cmp r0, r3 + bhi _0812A0BA + cmp r10, r2 + bhi _0812A0BA + cmp r9, r3 + bcc _0812A0BA + cmp r8, r2 + bcc _0812A0BA + ldr r0, =gUnknown_0203AA44 + ldrb r1, [r5] + lsls r1, 3 + adds r1, r0 + strb r4, [r1] + bl sub_8129F20 + ldrb r0, [r5] + adds r0, 0x1 + strb r0, [r5] +_0812A0BA: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + ldrb r0, [r7, 0x8] + cmp r4, r0 + bcc _0812A072 +_0812A0C6: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A040 + + thumb_func_start sub_812A0E8 +sub_812A0E8: @ 812A0E8 + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r4, =gUnknown_0203AAC4 + movs r0, 0 + strb r0, [r4] + adds r0, r6, 0 + bl sub_8129FC8 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0812A18C + movs r5, 0 + ldr r0, =gUnknown_0203A17C + ldrb r1, [r0, 0x8] + cmp r5, r1 + bcs _0812A15A + adds r7, r4, 0 +_0812A10E: + ldr r0, [r0] + adds r0, r5 + ldrb r1, [r0] + cmp r1, 0 + beq _0812A14C + ldr r4, =gUnknown_0203AA44 + adds r0, r1, 0 + adds r1, r4, 0 + bl sub_8129D8C + adds r0, r6, 0 + adds r1, r5, 0 + adds r2, r4, 0 + bl sub_8129E74 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0812A14C + strb r5, [r4] + ldrb r0, [r7] + adds r0, 0x1 + strb r0, [r7] + b _0812A15A + .pool +_0812A14C: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_0203A17C + ldrb r1, [r0, 0x8] + cmp r5, r1 + bcc _0812A10E +_0812A15A: + ldr r0, =gUnknown_0203AAC4 + ldrb r0, [r0] + cmp r0, 0 + beq _0812A18C + ldr r0, =gUnknown_0203A17C + ldr r2, =gUnknown_0203AA44 + ldrb r1, [r2] + ldr r0, [r0, 0x4] + adds r0, r1 + ldrb r1, [r0] + lsrs r0, r1, 4 + movs r3, 0xF + ands r3, r1 + ldrb r1, [r2, 0x2] + subs r1, r3, r1 + adds r1, 0x1 + lsls r1, 24 + lsrs r1, 24 + ldrb r2, [r2, 0x1] + adds r2, r0 + subs r2, 0x1 + lsls r2, 24 + lsrs r2, 24 + bl sub_812A040 +_0812A18C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A0E8 + + thumb_func_start sub_812A1A0 +sub_812A1A0: @ 812A1A0 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8197930 + ldr r1, =gUnknown_085A7348 + adds r0, r4, 0 + bl sub_8121F68 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A1A0 + + thumb_func_start sub_812A1C0 +sub_812A1C0: @ 812A1C0 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + movs r1, 0 + bl fade_screen + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0xC] + ldr r1, =sub_81298EC + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A1C0 + + thumb_func_start sub_812A1F0 +sub_812A1F0: @ 812A1F0 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8197930 + ldr r1, =gUnknown_085A7350 + adds r0, r4, 0 + bl sub_8121F68 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A1F0 + + thumb_func_start sub_812A210 +sub_812A210: @ 812A210 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0 + bl sub_8197434 + adds r0, r4, 0 + bl sub_812A22C + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_812A210 + + thumb_func_start sub_812A22C +sub_812A22C: @ 812A22C + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + movs r1, 0 + bl fade_screen + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0 + strh r1, [r0, 0xC] + ldr r1, =sub_812A25C + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A22C + + thumb_func_start sub_812A25C +sub_812A25C: @ 812A25C + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r5, r0, r1 + movs r1, 0xC + ldrsh r0, [r5, r1] + cmp r0, 0 + beq _0812A280 + cmp r0, 0x1 + beq _0812A29C + b _0812A2B2 + .pool +_0812A280: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _0812A2B2 + adds r0, r4, 0 + bl sub_8127B04 + movs r0, 0x1 + strh r0, [r5, 0xC] + b _0812A2B2 + .pool +_0812A29C: + bl sub_812A3C8 + ldr r0, =gFieldCallback + ldr r1, =sub_812A334 + str r1, [r0] + ldr r0, =c2_exit_to_overworld_2_switch + bl SetMainCallback2 + adds r0, r4, 0 + bl DestroyTask +_0812A2B2: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A25C + + thumb_func_start sub_812A2C4 +sub_812A2C4: @ 812A2C4 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r5, r1, 3 + ldr r6, =gTasks + 0x8 + adds r4, r5, r6 + movs r1, 0x4 + ldrsh r0, [r4, r1] + cmp r0, 0x1 + beq _0812A2FC + cmp r0, 0x1 + bgt _0812A2EC + cmp r0, 0 + beq _0812A2F6 + b _0812A32A + .pool +_0812A2EC: + cmp r0, 0x2 + beq _0812A308 + cmp r0, 0x3 + beq _0812A314 + b _0812A32A +_0812A2F6: + bl sub_80E9578 + b _0812A30C +_0812A2FC: + ldr r0, =gUnknown_08275D0C + bl ScriptContext1_SetupScript + b _0812A30C + .pool +_0812A308: + bl ScriptContext2_Enable +_0812A30C: + ldrh r0, [r4, 0x4] + adds r0, 0x1 + strh r0, [r4, 0x4] + b _0812A32A +_0812A314: + bl sub_80ABDFC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0812A32A + adds r0, r6, 0 + subs r0, 0x8 + adds r0, r5, r0 + ldr r1, =sub_8126B80 + str r1, [r0] +_0812A32A: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A2C4 + + thumb_func_start sub_812A334 +sub_812A334: @ 812A334 + push {lr} + bl pal_fill_black + movs r0, 0 + movs r1, 0x1 + bl sub_81973C4 + bl sub_8126ABC + ldr r0, =sub_812A2C4 + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r0, 0 + strh r0, [r1, 0xC] + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A334 + + thumb_func_start sub_812A36C +sub_812A36C: @ 812A36C + push {lr} + adds r2, r0, 0 + ldrh r0, [r2, 0x2E] + adds r0, 0x1 + movs r1, 0x1F + ands r0, r1 + strh r0, [r2, 0x2E] + cmp r0, 0xF + ble _0812A38C + adds r0, r2, 0 + adds r0, 0x3E + ldrb r1, [r0] + movs r2, 0x4 + orrs r1, r2 + strb r1, [r0] + b _0812A398 +_0812A38C: + adds r2, 0x3E + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] +_0812A398: + pop {r0} + bx r0 + thumb_func_end sub_812A36C + + thumb_func_start sub_812A39C +sub_812A39C: @ 812A39C + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0 + bne _0812A3B8 + ldr r0, =gUnknown_085A73D8 + bl LoadSpritePalette + b _0812A3BE + .pool +_0812A3B8: + ldr r0, =gUnknown_085A73E0 + bl LoadSpritePalette +_0812A3BE: + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A39C + + thumb_func_start sub_812A3C8 +sub_812A3C8: @ 812A3C8 + push {lr} + movs r0, 0x8 + bl FreeSpritePaletteByTag + pop {r0} + bx r0 + thumb_func_end sub_812A3C8 + + thumb_func_start sub_812A3D4 +sub_812A3D4: @ 812A3D4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + bl sub_81279C4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0812A430 + ldr r0, =gStringVar1 + ldr r1, =gUnknown_0203A172 + ldrb r2, [r1] + ldr r1, =gUnknown_0203A14C + ldr r1, [r1] + adds r1, r2 + ldrb r1, [r1] + lsls r1, 5 + ldr r2, =gDecorations + 1 + adds r1, r2 + bl StringCopy + ldr r4, =gStringVar4 + ldr r1, =gText_DecorationWillBeDiscarded + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_812A458 + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField + b _0812A444 + .pool +_0812A430: + ldr r4, =gStringVar4 + ldr r1, =gText_CantThrowAwayInUse + adds r0, r4, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8127A5C + adds r0, r5, 0 + adds r1, r4, 0 + bl DisplayItemMessageOnField +_0812A444: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A3D4 + + thumb_func_start sub_812A458 +sub_812A458: @ 812A458 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_8197930 + ldr r1, =gUnknown_085A741C + adds r0, r4, 0 + bl sub_8121F68 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A458 + + thumb_func_start sub_812A478 +sub_812A478: @ 812A478 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_0203A172 + ldrb r1, [r0] + ldr r0, =gUnknown_0203A14C + ldr r0, [r0] + adds r0, r1 + movs r1, 0 + strb r1, [r0] + ldr r5, =gUnknown_0203A173 + ldrb r0, [r5] + bl sub_8161AD0 + ldr r1, =gUnknown_0203A151 + strb r0, [r1] + ldrb r0, [r5] + bl sub_8161A38 + adds r0, r4, 0 + bl sub_8127814 + ldr r5, =gStringVar4 + ldr r1, =gText_DecorationThrownAway + adds r0, r5, 0 + bl StringExpandPlaceholders + ldr r2, =sub_8127A5C + adds r0, r4, 0 + adds r1, r5, 0 + bl DisplayItemMessageOnField + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_812A478 + + .align 2, 0 @ Don't pad with nop. diff --git a/asm/decoration_inventory.s b/asm/decoration_inventory.s new file mode 100644 index 000000000..7a909f585 --- /dev/null +++ b/asm/decoration_inventory.s @@ -0,0 +1,459 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + + thumb_func_start SetDecorationInventoriesPointers +SetDecorationInventoriesPointers: @ 81617F4 + push {r4,lr} + ldr r0, =gDecorationInventories + mov r12, r0 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldr r2, =0x00002734 + adds r0, r1, r2 + mov r4, r12 + str r0, [r4] + movs r3, 0xA + strb r3, [r4, 0x4] + adds r2, 0xA + adds r0, r1, r2 + str r0, [r4, 0x8] + strb r3, [r4, 0xC] + ldr r4, =0x00002748 + adds r0, r1, r4 + mov r2, r12 + str r0, [r2, 0x10] + strb r3, [r2, 0x14] + adds r4, 0xA + adds r0, r1, r4 + str r0, [r2, 0x18] + movs r2, 0x1E + mov r0, r12 + strb r2, [r0, 0x1C] + adds r4, 0x1E + adds r0, r1, r4 + mov r4, r12 + str r0, [r4, 0x20] + mov r0, r12 + adds r0, 0x24 + strb r2, [r0] + ldr r2, =0x0000278e + adds r0, r1, r2 + str r0, [r4, 0x28] + mov r0, r12 + adds r0, 0x2C + strb r3, [r0] + ldr r4, =0x00002798 + adds r0, r1, r4 + mov r2, r12 + str r0, [r2, 0x30] + adds r2, 0x34 + movs r0, 0x28 + strb r0, [r2] + adds r4, 0x28 + adds r1, r4 + mov r0, r12 + str r1, [r0, 0x38] + adds r0, 0x3C + strb r3, [r0] + bl sub_8126968 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end SetDecorationInventoriesPointers + + thumb_func_start ClearDecorationInventory +ClearDecorationInventory: @ 8161880 + push {r4,r5,lr} + lsls r0, 24 + movs r3, 0 + ldr r1, =gDecorationInventories + lsrs r2, r0, 21 + adds r0, r2, r1 + ldrb r0, [r0, 0x4] + cmp r3, r0 + bcs _081618AA + adds r5, r1, 0 + movs r4, 0 +_08161896: + adds r0, r2, r5 + ldr r1, [r0] + adds r1, r3 + strb r4, [r1] + adds r1, r3, 0x1 + lsls r1, 24 + lsrs r3, r1, 24 + ldrb r0, [r0, 0x4] + cmp r3, r0 + bcc _08161896 +_081618AA: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end ClearDecorationInventory + + thumb_func_start ClearDecorationInventories +ClearDecorationInventories: @ 81618B4 + push {r4,lr} + movs r4, 0 +_081618B8: + adds r0, r4, 0 + bl ClearDecorationInventory + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x7 + bls _081618B8 + pop {r4} + pop {r0} + bx r0 + thumb_func_end ClearDecorationInventories + + thumb_func_start sub_81618D0 +sub_81618D0: @ 81618D0 + push {r4,lr} + lsls r0, 24 + movs r2, 0 + ldr r1, =gDecorationInventories + lsrs r0, 21 + adds r0, r1 + movs r1, 0x4 + ldrsb r1, [r0, r1] + cmp r2, r1 + bge _0816190C + adds r4, r0, 0 + adds r3, r1, 0 +_081618E8: + lsls r0, r2, 24 + asrs r1, r0, 24 + ldr r0, [r4] + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _08161900 + adds r0, r1, 0 + b _08161910 + .pool +_08161900: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + asrs r0, 24 + cmp r0, r3 + blt _081618E8 +_0816190C: + movs r0, 0x1 + negs r0, r0 +_08161910: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81618D0 + + thumb_func_start CheckHasDecoration +CheckHasDecoration: @ 8161918 + push {r4,lr} + lsls r0, 24 + lsrs r3, r0, 24 + ldr r1, =gDecorations + lsls r0, r3, 5 + adds r0, r1 + ldrb r0, [r0, 0x13] + movs r2, 0 + ldr r1, =gDecorationInventories + lsls r0, 3 + adds r0, r1 + ldrb r1, [r0, 0x4] + cmp r2, r1 + bcs _08161956 + ldr r4, [r0] +_08161936: + adds r0, r4, r2 + ldrb r0, [r0] + cmp r0, r3 + bne _0816194C + movs r0, 0x1 + b _08161958 + .pool +_0816194C: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, r1 + bcc _08161936 +_08161956: + movs r0, 0 +_08161958: + pop {r4} + pop {r1} + bx r1 + thumb_func_end CheckHasDecoration + + thumb_func_start DecorationAdd +DecorationAdd: @ 8161960 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + adds r4, r0, 0 + cmp r4, 0 + beq _081619A0 + ldr r1, =gDecorations + lsls r0, r4, 5 + adds r0, r1 + ldrb r5, [r0, 0x13] + adds r0, r5, 0 + bl sub_81618D0 + lsls r0, 24 + asrs r2, r0, 24 + movs r0, 0x1 + negs r0, r0 + cmp r2, r0 + beq _081619A0 + ldr r0, =gDecorationInventories + lsls r1, r5, 3 + adds r1, r0 + ldr r0, [r1] + adds r0, r2 + strb r4, [r0] + movs r0, 0x1 + b _081619A2 + .pool +_081619A0: + movs r0, 0 +_081619A2: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end DecorationAdd + + thumb_func_start DecorationCheckSpace +DecorationCheckSpace: @ 81619A8 + push {lr} + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0 + beq _081619D4 + ldr r1, =gDecorations + lsls r0, 5 + adds r0, r1 + ldrb r0, [r0, 0x13] + bl sub_81618D0 + lsls r0, 24 + asrs r0, 24 + movs r1, 0x1 + negs r1, r1 + cmp r0, r1 + beq _081619D4 + movs r0, 0x1 + b _081619D6 + .pool +_081619D4: + movs r0, 0 +_081619D6: + pop {r1} + bx r1 + thumb_func_end DecorationCheckSpace + + thumb_func_start DecorationRemove +DecorationRemove: @ 81619DC + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + movs r3, 0 + cmp r5, 0 + bne _081619F8 + b _08161A26 +_081619EA: + movs r0, 0 + strb r0, [r1] + adds r0, r6, 0 + bl sub_8161A38 + movs r0, 0x1 + b _08161A28 +_081619F8: + ldr r2, =gDecorationInventories + ldr r1, =gDecorations + lsls r0, r5, 5 + adds r0, r1 + ldrb r4, [r0, 0x13] + lsls r0, r4, 3 + adds r0, r2 + ldrb r1, [r0, 0x4] + cmp r3, r1 + bcs _08161A26 + adds r6, r4, 0 + adds r4, r0, 0 + adds r2, r1, 0 +_08161A12: + ldr r0, [r4] + adds r1, r0, r3 + ldrb r0, [r1] + cmp r0, r5 + beq _081619EA + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, r2 + bcc _08161A12 +_08161A26: + movs r0, 0 +_08161A28: + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end DecorationRemove + + thumb_func_start sub_8161A38 +sub_8161A38: @ 8161A38 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + lsls r0, 24 + movs r6, 0 + ldr r2, =gDecorationInventories + lsrs r0, 21 + adds r1, r0, r2 + ldrb r3, [r1, 0x4] + cmp r6, r3 + bcs _08161ABC + adds r7, r0, 0 + mov r10, r1 + mov r0, r10 + str r0, [sp] +_08161A5C: + adds r1, r6, 0x1 + lsls r0, r1, 24 + lsrs r3, r0, 24 + adds r2, r7, 0 + mov r12, r1 + mov r1, r10 + ldrb r1, [r1, 0x4] + cmp r3, r1 + bcs _08161AAE + ldr r0, =gDecorationInventories + mov r9, r0 + adds r1, r0, 0 + mov r8, r1 +_08161A76: + mov r0, r9 + adds r5, r2, r0 + ldr r1, [r5] + adds r0, r1, r3 + ldrb r4, [r0] + adds r2, r4, 0 + cmp r2, 0 + beq _08161A9C + adds r0, r1, r6 + ldrb r1, [r0] + cmp r1, 0 + beq _08161A92 + cmp r1, r2 + bls _08161A9C +_08161A92: + ldrb r1, [r0] + strb r4, [r0] + ldr r0, [r5] + adds r0, r3 + strb r1, [r0] +_08161A9C: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + adds r2, r7, 0 + mov r1, r8 + adds r0, r2, r1 + ldrb r0, [r0, 0x4] + cmp r3, r0 + bcc _08161A76 +_08161AAE: + mov r3, r12 + lsls r0, r3, 24 + lsrs r6, r0, 24 + ldr r0, [sp] + ldrb r0, [r0, 0x4] + cmp r6, r0 + bcc _08161A5C +_08161ABC: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8161A38 + + thumb_func_start sub_8161AD0 +sub_8161AD0: @ 8161AD0 + push {r4,r5,lr} + lsls r0, 24 + movs r4, 0 + movs r3, 0 + ldr r2, =gDecorationInventories + lsrs r1, r0, 21 + adds r0, r1, r2 + ldrb r0, [r0, 0x4] + cmp r4, r0 + bcs _08161B04 + adds r5, r2, 0 +_08161AE6: + adds r2, r1, r5 + ldr r0, [r2] + adds r0, r3 + ldrb r0, [r0] + cmp r0, 0 + beq _08161AF8 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 +_08161AF8: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + ldrb r2, [r2, 0x4] + cmp r3, r2 + bcc _08161AE6 +_08161B04: + adds r0, r4, 0 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8161AD0 + + thumb_func_start sub_8161B10 +sub_8161B10: @ 8161B10 + push {r4,r5,lr} + movs r5, 0 + movs r4, 0 +_08161B16: + adds r0, r4, 0 + bl sub_8161AD0 + adds r0, r5, r0 + lsls r0, 24 + lsrs r5, r0, 24 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x7 + bls _08161B16 + adds r0, r5, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8161B10 + + .align 2, 0 @ Don't pad with nop. + \ No newline at end of file diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 03f6b11d1..50018de9c 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,6 +5,7832 @@ .text + thumb_func_start sub_81BF8EC +sub_81BF8EC: @ 81BF8EC + push {r4-r7,lr} + mov r7, r8 + push {r7} + mov r8, r1 + adds r5, r2, 0 + adds r6, r3, 0 + lsls r0, 24 + lsrs r7, r0, 24 + lsls r5, 24 + lsrs r5, 24 + lsls r6, 24 + lsrs r6, 24 + ldr r4, =gUnknown_0203CF1C + ldr r0, =0x000040f8 + bl AllocZeroed + str r0, [r4] + ldr r1, =0x000040bc + adds r0, r1 + strb r7, [r0] + ldr r0, [r4] + mov r2, r8 + str r2, [r0] + adds r1, 0x2 + adds r0, r1 + strb r5, [r0] + ldr r0, [r4] + ldr r2, =0x000040bf + adds r0, r2 + strb r6, [r0] + ldr r1, [r4] + ldr r0, [sp, 0x18] + str r0, [r1, 0x4] + cmp r7, 0x2 + bne _081BF94C + subs r2, 0x2 + adds r1, r2 + movs r0, 0x1 + b _081BF952 + .pool +_081BF94C: + ldr r0, =0x000040bd + adds r1, r0 + movs r0, 0 +_081BF952: + strb r0, [r1] + cmp r7, 0x1 + beq _081BF9A0 + cmp r7, 0x1 + bgt _081BF96C + cmp r7, 0 + beq _081BF97C + ldr r2, =gUnknown_0203CF1C + b _081BF9EE + .pool +_081BF96C: + cmp r7, 0x2 + beq _081BF97C + cmp r7, 0x3 + beq _081BF9D0 + ldr r2, =gUnknown_0203CF1C + b _081BF9EE + .pool +_081BF97C: + ldr r2, =gUnknown_0203CF1C + ldr r0, [r2] + ldr r1, =0x000040c1 + adds r0, r1 + movs r1, 0 + strb r1, [r0] + ldr r0, [r2] + ldr r1, =0x000040c2 + adds r0, r1 + movs r1, 0x3 + b _081BF9EC + .pool +_081BF9A0: + ldr r2, =gUnknown_0203CF1C + ldr r0, [r2] + ldr r1, =0x000040c1 + adds r0, r1 + movs r1, 0 + strb r1, [r0] + ldr r0, [r2] + ldr r1, =0x000040c2 + adds r0, r1 + movs r1, 0x3 + strb r1, [r0] + ldr r0, [r2] + ldr r1, =0x000040c8 + adds r0, r1 + strb r7, [r0] + b _081BF9EE + .pool +_081BF9D0: + ldr r2, =gUnknown_0203CF1C + ldr r0, [r2] + ldr r1, =0x000040c1 + adds r0, r1 + movs r1, 0x2 + strb r1, [r0] + ldr r0, [r2] + ldr r1, =0x000040c2 + adds r0, r1 + strb r7, [r0] + ldr r0, [r2] + adds r1, 0x1 + adds r0, r1 + movs r1, 0x1 +_081BF9EC: + strb r1, [r0] +_081BF9EE: + ldr r0, [r2] + ldr r2, =0x000040c1 + adds r1, r0, r2 + ldrb r1, [r1] + subs r2, 0x1 + adds r0, r2 + strb r1, [r0] + movs r0, 0xFF + bl sub_81C488C + ldr r0, =gMonSpritesGfxPtr + ldr r0, [r0] + cmp r0, 0 + bne _081BFA12 + movs r0, 0 + movs r1, 0 + bl sub_806F2AC +_081BFA12: + ldr r0, =sub_81BFAE4 + bl SetMainCallback2 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81BF8EC + + thumb_func_start sub_81BFA38 +sub_81BFA38: @ 81BFA38 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x4 + mov r8, r0 + adds r4, r1, 0 + adds r5, r2, 0 + ldr r6, [sp, 0x18] + lsls r4, 24 + lsrs r4, 24 + lsls r5, 24 + lsrs r5, 24 + lsls r6, 16 + lsrs r6, 16 + str r3, [sp] + movs r0, 0x3 + mov r1, r8 + adds r2, r4, 0 + adds r3, r5, 0 + bl sub_81BF8EC + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c4 + adds r0, r1 + strh r6, [r0] + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81BFA38 + + thumb_func_start sub_81BFA80 +sub_81BFA80: @ 81BFA80 + push {r4,lr} + sub sp, 0x4 + ldr r4, [sp, 0xC] + lsls r0, 24 + lsrs r0, 24 + lsls r2, 24 + lsrs r2, 24 + lsls r3, 24 + lsrs r3, 24 + str r4, [sp] + bl sub_81BF8EC + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040ef + adds r0, r1 + movs r1, 0x1 + strb r1, [r0] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81BFA80 + + thumb_func_start sub_81BFAB4 +sub_81BFAB4: @ 81BFAB4 + push {lr} + bl RunTasks + bl AnimateSprites + bl BuildOamBuffer + bl do_scheduled_bg_tilemap_copies_to_vram + bl UpdatePaletteFade + pop {r0} + bx r0 + thumb_func_end sub_81BFAB4 + + thumb_func_start sub_81BFAD0 +sub_81BFAD0: @ 81BFAD0 + push {lr} + bl LoadOam + bl ProcessSpriteCopyRequests + bl TransferPlttBuffer + pop {r0} + bx r0 + thumb_func_end sub_81BFAD0 + + thumb_func_start sub_81BFAE4 +sub_81BFAE4: @ 81BFAE4 + push {lr} +_081BFAE6: + bl sub_81221EC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081BFB0A + bl sub_81BFB10 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081BFB0A + bl sub_81221AC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081BFAE6 +_081BFB0A: + pop {r0} + bx r0 + thumb_func_end sub_81BFAE4 + + thumb_func_start sub_81BFB10 +sub_81BFB10: @ 81BFB10 + push {r4,lr} + sub sp, 0x4 + ldr r0, =gMain + movs r1, 0x87 + lsls r1, 3 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x18 + bls _081BFB24 + b _081BFE00 +_081BFB24: + lsls r0, 2 + ldr r1, =_081BFB38 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081BFB38: + .4byte _081BFB9C + .4byte _081BFBAA + .4byte _081BFBBC + .4byte _081BFBD0 + .4byte _081BFBE4 + .4byte _081BFBEA + .4byte _081BFC04 + .4byte _081BFC20 + .4byte _081BFC26 + .4byte _081BFC38 + .4byte _081BFC58 + .4byte _081BFC7C + .4byte _081BFC82 + .4byte _081BFC94 + .4byte _081BFCAC + .4byte _081BFCC0 + .4byte _081BFCD8 + .4byte _081BFCF8 + .4byte _081BFD34 + .4byte _081BFD50 + .4byte _081BFD60 + .4byte _081BFD74 + .4byte _081BFD7A + .4byte _081BFDB0 + .4byte _081BFDCC +_081BFB9C: + bl SetVBlankHBlankCallbacksToNull + bl sub_8121DA0 + bl clear_scheduled_bg_copies_to_vram + b _081BFDE6 +_081BFBAA: + bl remove_some_task + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFBBC: + bl ResetPaletteFade + ldr r2, =gPaletteFade + ldrb r0, [r2, 0x8] + movs r1, 0x80 + orrs r0, r1 + b _081BFDE4 + .pool +_081BFBD0: + bl ResetSpriteData + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFBE4: + bl FreeAllSpritePalettes + b _081BFDE6 +_081BFBEA: + bl sub_81BFE24 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040f0 + adds r0, r1 + movs r1, 0 + strh r1, [r0] + b _081BFDE6 + .pool +_081BFC04: + bl sub_81BFEB0 + lsls r0, 24 + cmp r0, 0 + bne _081BFC10 + b _081BFE18 +_081BFC10: + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFC20: + bl sub_81C2554 + b _081BFDE6 +_081BFC26: + bl sub_81C1BA0 + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFC38: + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + adds r0, 0xC + bl sub_81C0098 + ldr r0, [r4] + ldr r1, =0x000040f0 + adds r0, r1 + movs r1, 0 + strh r1, [r0] + b _081BFDE6 + .pool +_081BFC58: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + bl sub_81C00F0 + lsls r0, 24 + cmp r0, 0 + bne _081BFC6A + b _081BFE18 +_081BFC6A: + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFC7C: + bl sub_81C25E8 + b _081BFDE6 +_081BFC82: + bl sub_81C286C + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFC94: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + bl sub_81C2D9C + b _081BFDE6 + .pool +_081BFCAC: + bl sub_81C0348 + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFCC0: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + bl sub_81C2AFC + b _081BFDE6 + .pool +_081BFCD8: + bl sub_81C4190 + bl sub_81C42C8 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040f0 + adds r0, r1 + movs r1, 0 + strh r1, [r0] + b _081BFDE6 + .pool +_081BFCF8: + ldr r4, =gUnknown_0203CF1C + ldr r1, [r4] + adds r0, r1, 0 + adds r0, 0xC + ldr r2, =0x000040f0 + adds r1, r2 + bl sub_81C45F4 + ldr r1, [r4] + ldr r2, =0x000040d3 + adds r1, r2 + strb r0, [r1] + ldr r1, [r4] + adds r2, r1, r2 + ldrb r0, [r2] + cmp r0, 0xFF + bne _081BFD1C + b _081BFE18 +_081BFD1C: + ldr r0, =0x000040f0 + adds r1, r0 + movs r0, 0 + strh r0, [r1] + b _081BFDE6 + .pool +_081BFD34: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + bl sub_81C4984 + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFD50: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + bl sub_81C4A08 + b _081BFDE6 + .pool +_081BFD60: + bl sub_81C4A88 + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFD74: + bl sub_81C4280 + b _081BFDE6 +_081BFD7A: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040bc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x3 + beq _081BFDA0 + ldr r0, =sub_81C0510 + movs r1, 0 + bl CreateTask + b _081BFDE6 + .pool +_081BFDA0: + ldr r0, =sub_81C171C + movs r1, 0 + bl CreateTask + b _081BFDE6 + .pool +_081BFDB0: + movs r0, 0x1 + negs r0, r0 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + ldr r1, =gMain + movs r0, 0x87 + lsls r0, 3 + adds r1, r0 + b _081BFDEE + .pool +_081BFDCC: + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + ldr r2, =gPaletteFade + ldrb r1, [r2, 0x8] + movs r0, 0x7F + ands r0, r1 +_081BFDE4: + strb r0, [r2, 0x8] +_081BFDE6: + ldr r1, =gMain + movs r2, 0x87 + lsls r2, 3 + adds r1, r2 +_081BFDEE: + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] + b _081BFE18 + .pool +_081BFE00: + ldr r0, =sub_81BFAD0 + bl SetVBlankCallback + ldr r0, =sub_81BFAB4 + bl SetMainCallback2 + movs r0, 0x1 + b _081BFE1A + .pool +_081BFE18: + movs r0, 0 +_081BFE1A: + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81BFB10 + + thumb_func_start sub_81BFE24 +sub_81BFE24: @ 81BFE24 + push {r4,lr} + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_0861CBB4 + movs r0, 0 + movs r2, 0x4 + bl InitBgsFromTemplates + ldr r4, =gUnknown_0203CF1C + ldr r1, [r4] + ldr r0, =0x000020bc + adds r1, r0 + movs r0, 0x1 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x000010bc + adds r1, r0 + movs r0, 0x2 + bl SetBgTilemapBuffer + ldr r1, [r4] + adds r1, 0xBC + movs r0, 0x3 + bl SetBgTilemapBuffer + bl sub_8121E10 + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x3 + bl schedule_bg_copy_tilemap_to_vram + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + movs r0, 0x50 + movs r1, 0 + bl SetGpuReg + movs r0, 0 + bl ShowBg + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + movs r0, 0x3 + bl ShowBg + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81BFE24 + + thumb_func_start sub_81BFEB0 +sub_81BFEB0: @ 81BFEB0 + push {r4,lr} + sub sp, 0x4 + ldr r1, =gUnknown_0203CF1C + ldr r0, [r1] + ldr r2, =0x000040f0 + adds r0, r2 + movs r2, 0 + ldrsh r0, [r0, r2] + adds r4, r1, 0 + cmp r0, 0xC + bls _081BFEC8 + b _081C008C +_081BFEC8: + lsls r0, 2 + ldr r1, =_081BFEE0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081BFEE0: + .4byte _081BFF14 + .4byte _081BFF30 + .4byte _081BFF60 + .4byte _081BFF78 + .4byte _081BFF90 + .4byte _081BFFA8 + .4byte _081BFFC0 + .4byte _081BFFF0 + .4byte _081BFFFC + .4byte _081C0018 + .4byte _081C0024 + .4byte _081C0040 + .4byte _081C0064 +_081BFF14: + bl reset_temp_tile_data_buffers + ldr r1, =gUnknown_08D97D0C + movs r0, 0 + str r0, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + b _081C0046 + .pool +_081BFF30: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081BFF3E + b _081C008C +_081BFF3E: + ldr r0, =gUnknown_08D9862C + ldr r4, =gUnknown_0203CF1C + ldr r1, [r4] + adds r1, 0xBC + bl LZDecompressWram + ldr r1, [r4] + ldr r2, =0x000040f0 + adds r1, r2 + b _081C004E + .pool +_081BFF60: + ldr r0, =gUnknown_08D98CC8 + ldr r1, [r4] + ldr r2, =0x000008bc + adds r1, r2 + bl LZDecompressWram + ldr r1, [r4] + b _081C004A + .pool +_081BFF78: + ldr r0, =gUnknown_08D987FC + ldr r1, [r4] + ldr r2, =0x000018bc + adds r1, r2 + bl LZDecompressWram + ldr r1, [r4] + b _081C004A + .pool +_081BFF90: + ldr r0, =gUnknown_08D9898C + ldr r1, [r4] + ldr r2, =0x000028bc + adds r1, r2 + bl LZDecompressWram + ldr r1, [r4] + b _081C004A + .pool +_081BFFA8: + ldr r0, =gUnknown_08D98B28 + ldr r1, [r4] + ldr r2, =0x000038bc + adds r1, r2 + bl LZDecompressWram + ldr r1, [r4] + b _081C004A + .pool +_081BFFC0: + ldr r0, =gUnknown_08D9853C + movs r2, 0x80 + lsls r2, 1 + movs r1, 0 + bl LoadCompressedPalette + ldr r0, =gUnknown_08D85620 + movs r1, 0x81 + movs r2, 0x1E + bl LoadPalette + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040f0 + adds r1, r2 + b _081C004E + .pool +_081BFFF0: + ldr r0, =gUnknown_0861CFBC + bl LoadCompressedObjectPic + b _081C0046 + .pool +_081BFFFC: + ldr r0, =gUnknown_0861D074 + bl LoadCompressedObjectPic + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040f0 + adds r1, r2 + b _081C004E + .pool +_081C0018: + ldr r0, =gUnknown_0861D0F8 + bl LoadCompressedObjectPic + b _081C0046 + .pool +_081C0024: + ldr r0, =gUnknown_0861D100 + bl LoadCompressedObjectPalette + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040f0 + adds r1, r2 + b _081C004E + .pool +_081C0040: + ldr r0, =gUnknown_0861D07C + bl LoadCompressedObjectPalette +_081C0046: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] +_081C004A: + ldr r0, =0x000040f0 + adds r1, r0 +_081C004E: + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + b _081C008C + .pool +_081C0064: + ldr r0, =gUnknown_08D97B84 + movs r1, 0xE8 + lsls r1, 1 + movs r2, 0x60 + bl LoadCompressedPalette + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040f0 + adds r0, r1 + movs r1, 0 + strh r1, [r0] + movs r0, 0x1 + b _081C008E + .pool +_081C008C: + movs r0, 0 +_081C008E: + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81BFEB0 + + thumb_func_start sub_81C0098 +sub_81C0098: @ 81C0098 + push {r4,lr} + adds r3, r0, 0 + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040bd + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0 + bne _081C00D0 + ldr r2, [r1] + ldr r4, =0x000040be + adds r0, r1, r4 + ldrb r1, [r0] + movs r0, 0x64 + muls r1, r0 + adds r1, r2 + adds r0, r3, 0 + movs r2, 0x64 + bl memcpy + b _081C00E6 + .pool +_081C00D0: + ldr r0, [r1] + ldr r2, =0x000040be + adds r1, r2 + ldrb r2, [r1] + lsls r1, r2, 2 + adds r1, r2 + lsls r1, 4 + adds r0, r1 + adds r1, r3, 0 + bl sub_8069004 +_081C00E6: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0098 + + thumb_func_start sub_81C00F0 +sub_81C00F0: @ 81C00F0 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r5, r0, 0 + ldr r0, =gUnknown_0203CF1C + ldr r7, [r0] + adds r6, r7, 0 + adds r6, 0x70 + ldr r1, =0x000040f0 + adds r0, r7, r1 + movs r2, 0 + ldrsh r0, [r0, r2] + cmp r0, 0x1 + beq _081C0198 + cmp r0, 0x1 + bgt _081C0120 + cmp r0, 0 + beq _081C012C + b _081C0314 + .pool +_081C0120: + cmp r0, 0x2 + beq _081C01DC + cmp r0, 0x3 + bne _081C012A + b _081C02A8 +_081C012A: + b _081C0314 +_081C012C: + adds r0, r5, 0 + movs r1, 0xB + bl GetMonData + strh r0, [r6] + adds r0, r5, 0 + movs r1, 0x41 + bl GetMonData + strh r0, [r6, 0x2] + adds r0, r5, 0 + movs r1, 0x19 + bl GetMonData + str r0, [r6, 0x10] + adds r0, r5, 0 + movs r1, 0x38 + bl GetMonData + strb r0, [r6, 0x5] + adds r0, r5, 0 + movs r1, 0x2E + bl GetMonData + strb r0, [r6, 0x8] + adds r0, r5, 0 + movs r1, 0xC + bl GetMonData + strh r0, [r6, 0x2E] + adds r0, r5, 0 + movs r1, 0 + bl GetMonData + str r0, [r6, 0xC] + adds r0, r5, 0 + movs r1, 0x4 + bl GetMonData + adds r1, r7, 0 + adds r1, 0xA5 + strb r0, [r1] + lsls r0, 24 + cmp r0, 0 + beq _081C018C + movs r0, 0x1 + strb r0, [r6, 0x4] + b _081C0322 +_081C018C: + adds r0, r5, 0 + movs r1, 0x2D + bl GetMonData + strb r0, [r6, 0x4] + b _081C0322 +_081C0198: + movs r4, 0 + movs r0, 0x8C + adds r0, r7 + mov r8, r0 + movs r1, 0xA4 + adds r1, r7 + mov r9, r1 + adds r6, r7, 0 + adds r6, 0x84 +_081C01AA: + adds r1, r4, 0 + adds r1, 0xD + adds r0, r5, 0 + bl GetMonData + strh r0, [r6] + adds r1, r4, 0 + adds r1, 0x11 + adds r0, r5, 0 + bl GetMonData + mov r2, r8 + adds r1, r2, r4 + strb r0, [r1] + adds r6, 0x2 + adds r4, 0x1 + cmp r4, 0x3 + bls _081C01AA + adds r0, r5, 0 + movs r1, 0x15 + bl GetMonData + mov r1, r9 + strb r0, [r1] + b _081C0322 +_081C01DC: + ldr r1, [r7] + ldr r0, =gPlayerParty + cmp r1, r0 + beq _081C01F8 + ldr r2, =0x000040bc + adds r0, r7, r2 + ldrb r0, [r0] + cmp r0, 0x2 + beq _081C01F8 + ldr r1, =0x000040ef + adds r0, r7, r1 + ldrb r0, [r0] + cmp r0, 0x1 + bne _081C0254 +_081C01F8: + adds r0, r5, 0 + bl GetNature + adds r1, r6, 0 + adds r1, 0x33 + strb r0, [r1] + adds r0, r5, 0 + movs r1, 0x39 + bl GetMonData + strh r0, [r6, 0x20] + adds r0, r5, 0 + movs r1, 0x3A + bl GetMonData + strh r0, [r6, 0x22] + adds r0, r5, 0 + movs r1, 0x3B + bl GetMonData + strh r0, [r6, 0x24] + adds r0, r5, 0 + movs r1, 0x3C + bl GetMonData + strh r0, [r6, 0x26] + adds r0, r5, 0 + movs r1, 0x3E + bl GetMonData + strh r0, [r6, 0x28] + adds r0, r5, 0 + movs r1, 0x3F + bl GetMonData + strh r0, [r6, 0x2A] + adds r0, r5, 0 + movs r1, 0x3D + b _081C02A0 + .pool +_081C0254: + adds r0, r5, 0 + bl GetNature + adds r1, r7, 0 + adds r1, 0xA3 + strb r0, [r1] + adds r0, r5, 0 + movs r1, 0x39 + bl GetMonData + strh r0, [r6, 0x20] + adds r0, r5, 0 + movs r1, 0x3A + bl GetMonData + strh r0, [r6, 0x22] + adds r0, r5, 0 + movs r1, 0x54 + bl GetMonData + strh r0, [r6, 0x24] + adds r0, r5, 0 + movs r1, 0x55 + bl GetMonData + strh r0, [r6, 0x26] + adds r0, r5, 0 + movs r1, 0x57 + bl GetMonData + strh r0, [r6, 0x28] + adds r0, r5, 0 + movs r1, 0x58 + bl GetMonData + strh r0, [r6, 0x2A] + adds r0, r5, 0 + movs r1, 0x56 +_081C02A0: + bl GetMonData + strh r0, [r6, 0x2C] + b _081C0322 +_081C02A8: + adds r4, r7, 0 + adds r4, 0xA6 + adds r0, r5, 0 + movs r1, 0x7 + adds r2, r4, 0 + bl GetMonData + adds r0, r5, 0 + movs r1, 0x3 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + bl ConvertInternationalString + adds r0, r5, 0 + bl sub_81B205C + strb r0, [r6, 0x7] + adds r0, r5, 0 + movs r1, 0x31 + bl GetMonData + adds r1, r7, 0 + adds r1, 0xA2 + strb r0, [r1] + adds r0, r5, 0 + movs r1, 0x1 + bl GetMonData + str r0, [r6, 0x48] + adds r0, r5, 0 + movs r1, 0x23 + bl GetMonData + strb r0, [r6, 0x9] + adds r0, r5, 0 + movs r1, 0x24 + bl GetMonData + strb r0, [r6, 0xA] + adds r0, r5, 0 + movs r1, 0x25 + bl GetMonData + strb r0, [r6, 0xB] + adds r0, r5, 0 + movs r1, 0x20 + bl GetMonData + strh r0, [r6, 0x30] + b _081C0322 +_081C0314: + adds r0, r5, 0 + movs r1, 0x52 + bl GetMonData + strb r0, [r6, 0x6] + movs r0, 0x1 + b _081C0332 +_081C0322: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040f0 + adds r1, r2 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + movs r0, 0 +_081C0332: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81C00F0 + + thumb_func_start sub_81C0348 +sub_81C0348: @ 81C0348 + push {r4-r6,lr} + ldr r6, =gUnknown_0203CF1C + ldr r2, [r6] + ldr r1, =0x000040c0 + adds r0, r2, r1 + ldrb r0, [r0] + subs r0, 0x2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _081C037C + movs r0, 0 + movs r1, 0xFF + bl sub_81C1DA4 + movs r0, 0 + movs r1, 0xFF + movs r2, 0 + bl sub_81C1EFC + b _081C03D8 + .pool +_081C037C: + ldr r1, =0x000040c6 + adds r0, r2, r1 + ldrb r1, [r0] + lsls r1, 1 + adds r0, r2, 0 + adds r0, 0x84 + adds r0, r1 + ldrh r0, [r0] + bl sub_81C240C + ldr r0, [r6] + ldr r5, =0x000020bc + adds r0, r5 + movs r1, 0x3 + movs r2, 0 + bl sub_81C2194 + ldr r0, [r6] + ldr r4, =0x000030bc + adds r0, r4 + movs r1, 0x1 + movs r2, 0 + bl sub_81C2194 + ldr r1, [r6] + adds r1, r4 + movs r0, 0x1 + bl SetBgTilemapBuffer + ldr r1, [r6] + adds r1, r5 + movs r0, 0x2 + bl SetBgTilemapBuffer + movs r1, 0x80 + lsls r1, 9 + movs r0, 0x2 + movs r2, 0x1 + bl ChangeBgX + movs r0, 0x13 + bl ClearWindowTilemap + movs r0, 0xD + bl ClearWindowTilemap +_081C03D8: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x77 + ldrb r0, [r0] + cmp r0, 0 + bne _081C0400 + movs r0, 0 + movs r1, 0xFF + bl sub_81C2074 + b _081C0416 + .pool +_081C0400: + ldr r2, =0x000040c0 + adds r0, r1, r2 + ldrb r0, [r0] + subs r0, 0x2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _081C0416 + movs r0, 0xD + bl PutWindowTilemap +_081C0416: + bl sub_81C2524 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + bl sub_81C2228 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0348 + + thumb_func_start sub_81C0434 +sub_81C0434: @ 81C0434 + push {lr} + bl FreeAllWindowBuffers + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + bl Free + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0434 + + thumb_func_start sub_81C044C +sub_81C044C: @ 81C044C + push {r4,lr} + sub sp, 0x4 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_81C0484 + str r1, [r0] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C044C + + thumb_func_start sub_81C0484 +sub_81C0484: @ 81C0484 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + bl sub_81221EC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C04EC + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _081C04EC + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + ldr r0, [r0, 0x4] + bl SetMainCallback2 + ldr r1, =gUnknown_0203CF20 + ldr r0, [r4] + ldr r2, =0x000040be + adds r0, r2 + ldrb r0, [r0] + strb r0, [r1] + bl sub_81C4898 + bl ResetSpriteData + bl FreeAllSpritePalettes + bl StopCryAndClearCrySongs + ldr r0, =gMPlay_BGM + ldr r1, =0x0000ffff + movs r2, 0x80 + lsls r2, 1 + bl m4aMPlayVolumeControl + ldr r0, =gMonSpritesGfxPtr + ldr r0, [r0] + cmp r0, 0 + bne _081C04E2 + movs r0, 0 + bl sub_806F47C +_081C04E2: + bl sub_81C0434 + adds r0, r5, 0 + bl DestroyTask +_081C04EC: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0484 + + thumb_func_start sub_81C0510 +sub_81C0510: @ 81C0510 + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + bl sub_81221EC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C05FE + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r2, 0x80 + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + bne _081C05FE + ldr r5, =gMain + ldrh r1, [r5, 0x2E] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _081C0550 + movs r1, 0x1 + negs r1, r1 + adds r0, r4, 0 + bl sub_81C0604 + b _081C05FE + .pool +_081C0550: + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + beq _081C0562 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_81C0604 + b _081C05FE +_081C0562: + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + bne _081C0576 + bl GetLRKeysState + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C0582 +_081C0576: + movs r1, 0x1 + negs r1, r1 + adds r0, r4, 0 + bl sub_81C0A8C + b _081C05FE +_081C0582: + ldrh r1, [r5, 0x2E] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + bne _081C0598 + bl GetLRKeysState + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _081C05A2 +_081C0598: + adds r0, r4, 0 + movs r1, 0x1 + bl sub_81C0A8C + b _081C05FE +_081C05A2: + ldrh r1, [r5, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _081C05E6 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x1 + beq _081C05FE + cmp r0, 0 + bne _081C05D8 + bl sub_81C48F0 + movs r0, 0x5 + bl PlaySE + adds r0, r4, 0 + bl sub_81C044C + b _081C05FE + .pool +_081C05D8: + movs r0, 0x5 + bl PlaySE + adds r0, r4, 0 + bl sub_81C0E48 + b _081C05FE +_081C05E6: + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081C05FE + bl sub_81C48F0 + movs r0, 0x5 + bl PlaySE + adds r0, r4, 0 + bl sub_81C044C +_081C05FE: + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_81C0510 + + thumb_func_start sub_81C0604 +sub_81C0604: @ 81C0604 + push {r4-r7,lr} + lsls r0, 24 + lsrs r7, r0, 24 + lsls r1, 24 + lsrs r5, r1, 24 + adds r4, r5, 0 + ldr r1, =gUnknown_0203CF1C + ldr r3, [r1] + ldr r2, =0x000040c3 + adds r0, r3, r2 + ldrb r0, [r0] + adds r6, r1, 0 + cmp r0, 0 + bne _081C06EE + ldr r1, =0x000040bd + adds r0, r3, r1 + ldrb r2, [r0] + cmp r2, 0x1 + bne _081C0678 + adds r1, 0x3 + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _081C0654 + lsls r1, r5, 24 + asrs r1, 24 + movs r4, 0x2 + eors r1, r2 + negs r0, r1 + orrs r0, r1 + asrs r0, 31 + ands r4, r0 + b _081C065C + .pool +_081C0654: + movs r4, 0x3 + cmp r5, 0x1 + bne _081C065C + movs r4, 0x1 +_081C065C: + ldr r2, [r6] + ldr r0, [r2] + ldr r3, =0x000040be + adds r1, r2, r3 + ldrb r1, [r1] + adds r3, 0x1 + adds r2, r3 + ldrb r2, [r2] + adds r3, r4, 0 + bl sub_80D214C + b _081C0696 + .pool +_081C0678: + bl sub_81B1250 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C068E + lsls r0, r5, 24 + asrs r0, 24 + bl sub_81C09B4 + b _081C0696 +_081C068E: + lsls r0, r4, 24 + asrs r0, 24 + bl sub_81C08F8 +_081C0696: + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 24 + asrs r0, 24 + movs r1, 0x1 + negs r1, r1 + cmp r0, r1 + beq _081C06EE + movs r0, 0x5 + bl PlaySE + ldr r5, =gUnknown_0203CF1C + ldr r0, [r5] + adds r0, 0x77 + ldrb r0, [r0] + cmp r0, 0 + beq _081C06D4 + movs r0, 0x2 + movs r1, 0x1 + bl sub_81C4204 + movs r0, 0xD + bl ClearWindowTilemap + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0 + movs r1, 0x2 + bl sub_81C2074 +_081C06D4: + ldr r0, [r5] + ldr r1, =0x000040be + adds r0, r1 + movs r2, 0 + strb r4, [r0] + ldr r1, =gTasks + lsls r0, r7, 2 + adds r0, r7 + lsls r0, 3 + adds r0, r1 + strh r2, [r0, 0x8] + ldr r1, =sub_81C0704 + str r1, [r0] +_081C06EE: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0604 + + thumb_func_start sub_81C0704 +sub_81C0704: @ 81C0704 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r4, r1, 3 + ldr r6, =gTasks + 0x8 + adds r5, r4, r6 + movs r1, 0 + ldrsh r0, [r5, r1] + cmp r0, 0xC + bls _081C071E + b _081C08BC +_081C071E: + lsls r0, 2 + ldr r1, =_081C0730 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081C0730: + .4byte _081C0764 + .4byte _081C076A + .4byte _081C0780 + .4byte _081C07A8 + .4byte _081C07C8 + .4byte _081C07E0 + .4byte _081C07F0 + .4byte _081C0800 + .4byte _081C0828 + .4byte _081C086C + .4byte _081C0872 + .4byte _081C0878 + .4byte _081C0894 +_081C0764: + bl StopCryAndClearCrySongs + b _081C08EC +_081C076A: + bl sub_81C4898 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040d3 + b _081C0786 + .pool +_081C0780: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040d4 +_081C0786: + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + bl DestroySpriteAndFreeResources + b _081C08EC + .pool +_081C07A8: + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + adds r0, 0xC + bl sub_81C0098 + ldr r0, [r4] + ldr r1, =0x000040f0 + adds r0, r1 + movs r1, 0 + strh r1, [r0] + b _081C08EC + .pool +_081C07C8: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + bl sub_81C00F0 + lsls r0, 24 + cmp r0, 0 + bne _081C07DA + b _081C08F2 +_081C07DA: + b _081C08EC + .pool +_081C07E0: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + bl sub_81C49E0 + b _081C08EC + .pool +_081C07F0: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + bl sub_81C4A08 + b _081C08EC + .pool +_081C0800: + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + adds r0, 0x77 + ldrb r0, [r0] + cmp r0, 0 + beq _081C0816 + movs r1, 0x2 + negs r1, r1 + movs r0, 0xA + bl sub_81C2074 +_081C0816: + ldr r0, [r4] + adds r0, 0xC + bl sub_81C2228 + movs r0, 0 + strh r0, [r5, 0x2] + b _081C08EC + .pool +_081C0828: + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + adds r0, 0xC + adds r1, r5, 0x2 + bl sub_81C45F4 + ldr r1, [r4] + ldr r2, =0x000040d3 + adds r1, r2 + strb r0, [r1] + ldr r0, [r4] + adds r1, r0, r2 + ldrb r0, [r1] + cmp r0, 0xFF + beq _081C08F2 + ldr r2, =gSprites + adds r1, r0, 0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r1, 0x1 + strh r1, [r0, 0x32] + bl sub_81C0E24 + movs r0, 0 + strh r0, [r5, 0x2] + b _081C08EC + .pool +_081C086C: + bl sub_81C4280 + b _081C08EC +_081C0872: + bl sub_81C25E8 + b _081C08EC +_081C0878: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + bl sub_81C2D9C + bl sub_81C2524 + b _081C08EC + .pool +_081C0894: + ldr r2, =gSprites + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040d3 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r1, 0 + strh r1, [r0, 0x32] + b _081C08EC + .pool +_081C08BC: + bl sub_81221EC + lsls r0, 24 + cmp r0, 0 + bne _081C08F2 + ldr r0, =sub_81C20F0 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0 + bne _081C08F2 + strh r0, [r5] + adds r0, r6, 0 + subs r0, 0x8 + adds r0, r4, r0 + ldr r1, =sub_81C0510 + str r1, [r0] + b _081C08F2 + .pool +_081C08EC: + ldrh r0, [r5] + adds r0, 0x1 + strh r0, [r5] +_081C08F2: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_81C0704 + + thumb_func_start sub_81C08F8 +sub_81C08F8: @ 81C08F8 + push {r4-r7,lr} + lsls r0, 24 + lsrs r4, r0, 24 + ldr r1, =gUnknown_0203CF1C + ldr r2, [r1] + ldr r7, [r2] + ldr r3, =0x000040c0 + adds r0, r2, r3 + ldrb r0, [r0] + adds r5, r1, 0 + cmp r0, 0 + bne _081C0960 + lsls r0, r4, 24 + asrs r3, r0, 24 + movs r1, 0x1 + negs r1, r1 + adds r6, r0, 0 + cmp r3, r1 + bne _081C0928 + ldr r1, =0x000040be + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _081C0988 +_081C0928: + asrs r0, r6, 24 + cmp r0, 0x1 + bne _081C0940 + ldr r0, [r5] + ldr r2, =0x000040be + adds r1, r0, r2 + ldr r3, =0x000040bf + adds r0, r3 + ldrb r1, [r1] + ldrb r0, [r0] + cmp r1, r0 + bcs _081C0988 +_081C0940: + ldr r0, [r5] + ldr r1, =0x000040be + adds r0, r1 + ldrb r0, [r0] + adds r0, r4 + lsls r0, 24 + asrs r0, 24 + b _081C09AE + .pool +_081C0960: + ldr r3, =0x000040be + adds r0, r2, r3 + ldrb r5, [r0] + lsls r6, r4, 24 +_081C0968: + lsls r0, r5, 24 + asrs r0, 24 + asrs r1, r6, 24 + adds r0, r1 + lsls r0, 24 + lsrs r5, r0, 24 + asrs r4, r0, 24 + cmp r4, 0 + blt _081C0988 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040bf + adds r0, r1 + ldrb r0, [r0] + cmp r4, r0 + ble _081C099C +_081C0988: + movs r0, 0x1 + negs r0, r0 + b _081C09AE + .pool +_081C099C: + movs r0, 0x64 + muls r0, r4 + adds r0, r7, r0 + movs r1, 0x2D + bl GetMonData + cmp r0, 0 + bne _081C0968 + adds r0, r4, 0 +_081C09AE: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_81C08F8 + + thumb_func_start sub_81C09B4 +sub_81C09B4: @ 81C09B4 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r0, 24 + mov r12, r0 + ldr r6, =gUnknown_0203CF1C + ldr r0, [r6] + ldr r1, [r0] + mov r8, r1 + movs r5, 0 + movs r2, 0 + ldr r3, =gUnknown_0861CC1C + movs r1, 0 + ldrsb r1, [r3, r1] + ldr r4, =0x000040be + adds r0, r4 + ldrb r0, [r0] + cmp r1, r0 + beq _081C09FC + adds r7, r3, 0 + adds r3, r4, 0 +_081C09E0: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x5 + bhi _081C09FC + adds r0, r2, r7 + movs r1, 0 + ldrsb r1, [r0, r1] + ldr r0, [r6] + adds r0, r3 + ldrb r0, [r0] + cmp r1, r0 + bne _081C09E0 + adds r5, r2, 0 +_081C09FC: + mov r0, r12 + lsls r6, r0, 24 + ldr r7, =gUnknown_0861CC1C +_081C0A02: + lsls r0, r5, 24 + asrs r0, 24 + asrs r1, r6, 24 + adds r0, r1 + lsls r0, 24 + lsrs r5, r0, 24 + lsls r1, r5, 24 + lsrs r0, r1, 24 + cmp r0, 0x5 + bhi _081C0A40 + asrs r0, r1, 24 + adds r0, r7 + movs r4, 0 + ldrsb r4, [r0, r4] + movs r0, 0x64 + muls r0, r4 + add r0, r8 + bl sub_81C0A50 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C0A02 + adds r0, r4, 0 + b _081C0A44 + .pool +_081C0A40: + movs r0, 0x1 + negs r0, r0 +_081C0A44: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_81C09B4 + + thumb_func_start sub_81C0A50 +sub_81C0A50: @ 81C0A50 + push {r4,lr} + adds r4, r0, 0 + movs r1, 0xB + bl GetMonData + cmp r0, 0 + beq _081C0A84 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040be + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _081C0A78 + adds r0, r4, 0 + movs r1, 0x2D + bl GetMonData + cmp r0, 0 + bne _081C0A84 +_081C0A78: + movs r0, 0x1 + b _081C0A86 + .pool +_081C0A84: + movs r0, 0 +_081C0A86: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81C0A50 + + thumb_func_start sub_81C0A8C +sub_81C0A8C: @ 81C0A8C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0xC + lsls r0, 24 + lsrs r6, r0, 24 + str r6, [sp] + lsls r1, 24 + lsrs r3, r1, 24 + str r3, [sp, 0x4] + ldr r0, =gUnknown_0203CF1C + mov r8, r0 + ldr r2, [r0] + adds r1, r2, 0 + adds r1, 0x70 + lsls r0, r6, 2 + adds r0, r6 + lsls r7, r0, 3 + ldr r0, =gTasks + 0x8 + mov r9, r0 + adds r0, r7, r0 + str r0, [sp, 0x8] + ldrb r1, [r1, 0x4] + mov r10, r1 + cmp r1, 0 + bne _081C0B6E + lsls r0, r3, 24 + asrs r5, r0, 24 + movs r0, 0x1 + negs r0, r0 + cmp r5, r0 + bne _081C0AE0 + ldr r1, =0x000040c0 + adds r0, r2, r1 + ldr r3, =0x000040c1 + adds r1, r2, r3 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + beq _081C0B6E +_081C0AE0: + cmp r5, 0x1 + bne _081C0AF4 + ldr r1, =0x000040c0 + adds r0, r2, r1 + ldr r3, =0x000040c2 + adds r1, r2, r3 + ldrb r0, [r0] + ldrb r1, [r1] + cmp r0, r1 + beq _081C0B6E +_081C0AF4: + movs r0, 0x5 + bl PlaySE + mov r1, r8 + ldr r0, [r1] + ldr r4, =0x000040c0 + adds r0, r4 + ldrb r0, [r0] + bl sub_81C2C38 + mov r2, r8 + ldr r1, [r2] + adds r1, r4 + ldrb r0, [r1] + ldr r3, [sp, 0x4] + adds r0, r3 + strb r0, [r1] + mov r1, r10 + ldr r0, [sp, 0x8] + strh r1, [r0] + cmp r5, 0x1 + bne _081C0B4C + ldr r1, =sub_81C0B8C + mov r0, r9 + subs r0, 0x8 + adds r0, r7, r0 + ldr r2, [r0] + adds r0, r6, 0 + bl SetTaskFuncWithFollowupFunc + b _081C0B5C + .pool +_081C0B4C: + ldr r1, =sub_81C0CC4 + mov r0, r9 + subs r0, 0x8 + adds r0, r7, r0 + ldr r2, [r0] + ldr r0, [sp] + bl SetTaskFuncWithFollowupFunc +_081C0B5C: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r2, =0x000040c0 + adds r0, r2 + ldrb r0, [r0] + bl sub_81C2DE4 + bl sub_81C424C +_081C0B6E: + add sp, 0xC + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0A8C + + thumb_func_start sub_81C0B8C +sub_81C0B8C: @ 81C0B8C + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0 + bne _081C0C2A + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r3, =0x000040c9 + adds r0, r3 + ldrb r0, [r0] + cmp r0, 0 + bne _081C0BE0 + movs r0, 0x1 + strh r0, [r4, 0x2] + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x1 + bl SetBgAttribute + movs r0, 0x2 + movs r1, 0x7 + movs r2, 0x2 + bl SetBgAttribute + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + b _081C0BFE + .pool +_081C0BE0: + movs r0, 0x2 + strh r0, [r4, 0x2] + movs r0, 0x2 + movs r1, 0x7 + movs r2, 0x1 + bl SetBgAttribute + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x2 + bl SetBgAttribute + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram +_081C0BFE: + ldrb r0, [r4, 0x2] + movs r1, 0 + movs r2, 0 + bl ChangeBgX + ldrb r0, [r4, 0x2] + ldr r1, =gUnknown_0203CF1C + ldr r1, [r1] + ldr r3, =0x000040c0 + adds r2, r1, r3 + ldrb r2, [r2] + lsls r2, 12 + adds r2, 0xBC + adds r1, r2 + bl SetBgTilemapBuffer + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg +_081C0C2A: + ldrb r0, [r4, 0x2] + movs r1, 0x80 + lsls r1, 6 + movs r2, 0x1 + bl ChangeBgX + ldrh r0, [r4] + adds r0, 0x20 + strh r0, [r4] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0xFF + ble _081C0C52 + ldr r0, =gTasks + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r1, r0 + ldr r0, =sub_81C0C68 + str r0, [r1] +_081C0C52: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0B8C + + thumb_func_start sub_81C0C68 +sub_81C0C68: @ 81C0C68 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + lsls r2, r4, 2 + adds r2, r4 + lsls r2, 3 + ldr r0, =gTasks + 0x8 + adds r2, r0 + ldr r5, =gUnknown_0203CF1C + ldr r3, [r5] + ldr r0, =0x000040c9 + adds r3, r0 + ldrb r0, [r3] + movs r1, 0x1 + eors r0, r1 + movs r1, 0 + strb r0, [r3] + strh r1, [r2, 0x2] + strh r1, [r2] + bl sub_81C1BA0 + ldr r0, [r5] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + bl sub_81C2AFC + bl sub_81C4280 + bl sub_81C0E24 + adds r0, r4, 0 + bl SwitchTaskToFollowupFunc + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0C68 + + thumb_func_start sub_81C0CC4 +sub_81C0CC4: @ 81C0CC4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0 + bne _081C0D0C + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c9 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _081C0CFC + movs r0, 0x2 + b _081C0CFE + .pool +_081C0CFC: + movs r0, 0x1 +_081C0CFE: + strh r0, [r4, 0x2] + ldrb r0, [r4, 0x2] + movs r1, 0x80 + lsls r1, 9 + movs r2, 0 + bl ChangeBgX +_081C0D0C: + ldrb r0, [r4, 0x2] + movs r1, 0x80 + lsls r1, 6 + movs r2, 0x2 + bl ChangeBgX + ldrh r0, [r4] + adds r0, 0x20 + strh r0, [r4] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0xFF + ble _081C0D34 + ldr r0, =gTasks + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r1, r0 + ldr r0, =sub_81C0D44 + str r0, [r1] +_081C0D34: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0CC4 + + thumb_func_start sub_81C0D44 +sub_81C0D44: @ 81C0D44 + push {r4-r7,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c9 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _081C0D8C + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x1 + bl SetBgAttribute + movs r0, 0x2 + movs r1, 0x7 + movs r2, 0x2 + bl SetBgAttribute + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + b _081C0DA6 + .pool +_081C0D8C: + movs r0, 0x2 + movs r1, 0x7 + movs r2, 0x1 + bl SetBgAttribute + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x2 + bl SetBgAttribute + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram +_081C0DA6: + ldr r6, =gUnknown_0203CF1C + ldr r2, [r6] + ldr r7, =0x000040c0 + adds r1, r2, r7 + ldrb r0, [r1] + cmp r0, 0x1 + bls _081C0DD0 + ldrb r0, [r4, 0x2] + ldrb r1, [r1] + lsls r1, 12 + ldr r3, =0xfffff0bc + adds r1, r3 + adds r1, r2, r1 + bl SetBgTilemapBuffer + ldrb r0, [r4, 0x2] + movs r1, 0x80 + lsls r1, 9 + movs r2, 0 + bl ChangeBgX +_081C0DD0: + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + ldr r2, [r6] + ldr r0, =0x000040c9 + adds r2, r0 + ldrb r0, [r2] + movs r1, 0x1 + eors r0, r1 + movs r1, 0 + strb r0, [r2] + strh r1, [r4, 0x2] + strh r1, [r4] + bl sub_81C1BA0 + ldr r0, [r6] + adds r0, r7 + ldrb r0, [r0] + bl sub_81C2AFC + bl sub_81C4280 + bl sub_81C0E24 + adds r0, r5, 0 + bl SwitchTaskToFollowupFunc + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0D44 + + thumb_func_start sub_81C0E24 +sub_81C0E24: @ 81C0E24 + push {lr} + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040c0 + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x1 + bne _081C0E3C + adds r0, r1, 0 + adds r0, 0xC + bl sub_81C22CC +_081C0E3C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0E24 + + thumb_func_start sub_81C0E48 +sub_81C0E48: @ 81C0E48 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r7, r0, 24 + ldr r5, =gUnknown_0203CF1C + ldr r0, [r5] + ldr r2, =0x000040c6 + adds r0, r2 + movs r1, 0 + strb r1, [r0] + ldr r1, [r5] + adds r2, r1, r2 + ldrb r0, [r2] + lsls r0, 1 + adds r1, 0x84 + adds r1, r0 + ldrh r6, [r1] + mov r8, r6 + movs r0, 0x13 + bl ClearWindowTilemap + ldr r2, =gSprites + ldr r0, [r5] + ldr r1, =0x000040d5 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 29 + cmp r0, 0 + blt _081C0E96 + movs r0, 0xD + bl ClearWindowTilemap +_081C0E96: + movs r4, 0x3 + negs r4, r4 + movs r0, 0x9 + adds r1, r4, 0 + bl sub_81C1DA4 + movs r0, 0x9 + adds r1, r4, 0 + adds r2, r6, 0 + bl sub_81C1EFC + ldr r0, [r5] + ldr r1, =0x000040c8 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _081C0EC4 + movs r0, 0x5 + bl ClearWindowTilemap + movs r0, 0x6 + bl PutWindowTilemap +_081C0EC4: + ldr r0, [r5] + ldr r1, =0x000020bc + adds r0, r1 + movs r1, 0x3 + movs r2, 0 + bl sub_81C2194 + ldr r0, [r5] + ldr r1, =0x000030bc + adds r0, r1 + movs r1, 0x1 + movs r2, 0 + bl sub_81C2194 + mov r0, r8 + bl sub_81C3E9C + bl sub_81C3F44 + bl sub_81C44F0 + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x8 + bl sub_81C4AF8 + ldr r1, =gTasks + lsls r0, r7, 2 + adds r0, r7 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_81C0F44 + str r1, [r0] + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C0E48 + + thumb_func_start sub_81C0F44 +sub_81C0F44: @ 81C0F44 + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + adds r6, r5, 0 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + bl sub_81221EC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C103A + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _081C0F98 + movs r0, 0x4 + strh r0, [r4] + movs r1, 0x1 + negs r1, r1 + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r0, =0x000040c6 + adds r2, r0 + adds r0, r4, 0 + bl sub_81C1070 + b _081C103A + .pool +_081C0F98: + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _081C0FC0 + movs r0, 0x4 + strh r0, [r4] + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r0, =0x000040c6 + adds r2, r0 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_81C1070 + b _081C103A + .pool +_081C0FC0: + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _081C1026 + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040c8 + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x1 + beq _081C0FE8 + subs r2, 0x4 + adds r0, r1, r2 + ldr r0, [r0] + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 11 + cmp r0, r1 + bne _081C1004 +_081C0FE8: + movs r0, 0x5 + bl PlaySE + adds r0, r5, 0 + bl sub_81C11F4 + b _081C103A + .pool +_081C1004: + bl sub_81C1040 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C101E + movs r0, 0x5 + bl PlaySE + adds r0, r5, 0 + bl sub_81C129C + b _081C103A +_081C101E: + movs r0, 0x20 + bl PlaySE + b _081C103A +_081C1026: + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081C103A + movs r0, 0x5 + bl PlaySE + adds r0, r6, 0 + bl sub_81C11F4 +_081C103A: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_81C0F44 + + thumb_func_start sub_81C1040 +sub_81C1040: @ 81C1040 + push {lr} + movs r1, 0x1 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r2, r0, 0 + adds r2, 0x84 +_081C104C: + lsls r0, r1, 1 + adds r0, r2, r0 + ldrh r0, [r0] + cmp r0, 0 + beq _081C1060 + movs r0, 0x1 + b _081C106C + .pool +_081C1060: + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x3 + bls _081C104C + movs r0, 0 +_081C106C: + pop {r1} + bx r1 + thumb_func_end sub_81C1040 + + thumb_func_start sub_81C1070 +sub_81C1070: @ 81C1070 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + adds r7, r0, 0 + adds r4, r1, 0 + mov r8, r2 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x5 + bl PlaySE + mov r0, r8 + ldrb r6, [r0] + movs r2, 0 + lsls r4, 24 + asrs r4, 24 + mov r12, r4 + movs r1, 0 + ldrsh r4, [r7, r1] + ldrb r0, [r7] + lsls r3, r0, 24 +_081C109C: + lsls r0, r6, 24 + asrs r0, 24 + add r0, r12 + lsls r0, 24 + lsrs r6, r0, 24 + asrs r0, 24 + cmp r0, r4 + ble _081C10B0 + movs r6, 0 + b _081C10B6 +_081C10B0: + cmp r0, 0 + bge _081C10B6 + lsrs r6, r3, 24 +_081C10B6: + lsls r0, r6, 24 + asrs r1, r0, 24 + mov r9, r0 + cmp r1, 0x4 + bne _081C10C2 + b _081C11CC +_081C10C2: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + lsls r1, 1 + adds r0, 0x84 + adds r0, r1 + ldrh r5, [r0] + cmp r5, 0 + bne _081C10E2 + lsls r0, r2, 24 + movs r1, 0x80 + lsls r1, 17 + adds r0, r1 + lsrs r2, r0, 24 + asrs r0, 24 + cmp r0, 0x3 + ble _081C109C +_081C10E2: + adds r0, r5, 0 + bl sub_81C240C + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + adds r0, r5, 0 + bl sub_81C3E9C + mov r1, r8 + ldrb r0, [r1] + cmp r0, 0x4 + bne _081C1110 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c4 + adds r0, r1 + ldrh r0, [r0] + cmp r0, 0 + beq _081C1118 +_081C1110: + movs r1, 0x2 + ldrsh r0, [r7, r1] + cmp r0, 0x1 + bne _081C115E +_081C1118: + movs r0, 0x13 + bl ClearWindowTilemap + ldr r2, =gSprites + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040d5 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 29 + cmp r0, 0 + blt _081C1142 + movs r0, 0xD + bl ClearWindowTilemap +_081C1142: + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + movs r4, 0x3 + negs r4, r4 + movs r0, 0x9 + adds r1, r4, 0 + bl sub_81C1DA4 + movs r0, 0x9 + adds r1, r4, 0 + adds r2, r5, 0 + bl sub_81C1EFC +_081C115E: + mov r1, r8 + ldrb r0, [r1] + cmp r0, 0x4 + beq _081C11A0 + mov r1, r9 + asrs r0, r1, 24 + cmp r0, 0x4 + bne _081C11A0 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c4 + adds r0, r1 + ldrh r0, [r0] + cmp r0, 0 + bne _081C11A0 + movs r0, 0xE + bl ClearWindowTilemap + movs r0, 0xF + bl ClearWindowTilemap + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0 + movs r1, 0x3 + bl sub_81C1DA4 + movs r0, 0 + movs r1, 0x3 + movs r2, 0 + bl sub_81C1EFC +_081C11A0: + mov r0, r8 + strb r6, [r0] + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c6 + adds r0, r1 + cmp r8, r0 + bne _081C11E0 + movs r0, 0x8 + bl sub_81C4D18 + b _081C11E6 + .pool +_081C11CC: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c4 + adds r0, r1 + ldrh r5, [r0] + b _081C10E2 + .pool +_081C11E0: + movs r0, 0x12 + bl sub_81C4D18 +_081C11E6: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81C1070 + + thumb_func_start sub_81C11F4 +sub_81C11F4: @ 81C11F4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + movs r0, 0x8 + bl sub_81C4C60 + movs r0, 0x6 + bl ClearWindowTilemap + movs r0, 0x5 + bl PutWindowTilemap + movs r0, 0 + bl sub_81C3E9C + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + ldr r1, =0x000020bc + adds r0, r1 + movs r1, 0x3 + movs r2, 0x1 + bl sub_81C2194 + ldr r0, [r4] + ldr r1, =0x000030bc + adds r0, r1 + movs r1, 0x1 + movs r2, 0x1 + bl sub_81C2194 + bl sub_81C4064 + ldr r0, [r4] + ldr r1, =0x000040c6 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x4 + beq _081C125E + movs r0, 0xE + bl ClearWindowTilemap + movs r0, 0xF + bl ClearWindowTilemap + movs r0, 0 + movs r1, 0x3 + bl sub_81C1DA4 + movs r0, 0 + movs r1, 0x3 + movs r2, 0 + bl sub_81C1EFC +_081C125E: + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + ldr r0, =gTasks + lsls r1, r5, 2 + adds r1, r5 + lsls r1, 3 + adds r1, r0 + ldr r0, =sub_81C0510 + str r0, [r1] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C11F4 + + thumb_func_start sub_81C129C +sub_81C129C: @ 81C129C + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r2, =0x000040c6 + adds r1, r0, r2 + ldrb r1, [r1] + adds r2, 0x1 + adds r0, r2 + strb r1, [r0] + movs r0, 0x1 + bl sub_81C4C84 + movs r0, 0x12 + bl sub_81C4AF8 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_81C12E4 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C129C + + thumb_func_start sub_81C12E4 +sub_81C12E4: @ 81C12E4 + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + adds r6, r5, 0 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + bl sub_81221EC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C13AA + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _081C1338 + movs r0, 0x3 + strh r0, [r4] + movs r1, 0x1 + negs r1, r1 + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r0, =0x000040c7 + adds r2, r0 + adds r0, r4, 0 + bl sub_81C1070 + b _081C13AA + .pool +_081C1338: + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _081C1360 + movs r0, 0x3 + strh r0, [r4] + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r0, =0x000040c7 + adds r2, r0 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_81C1070 + b _081C13AA + .pool +_081C1360: + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _081C139A + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r2, =0x000040c6 + adds r1, r0, r2 + adds r2, 0x1 + adds r0, r2 + ldrb r1, [r1] + ldrb r0, [r0] + cmp r1, r0 + bne _081C1390 + adds r0, r5, 0 + movs r1, 0 + bl sub_81C13B0 + b _081C13AA + .pool +_081C1390: + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81C13B0 + b _081C13AA +_081C139A: + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081C13AA + adds r0, r6, 0 + movs r1, 0 + bl sub_81C13B0 +_081C13AA: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_81C12E4 + + thumb_func_start sub_81C13B0 +sub_81C13B0: @ 81C13B0 + push {r4-r7,lr} + adds r4, r1, 0 + lsls r0, 24 + lsrs r7, r0, 24 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0x5 + bl PlaySE + movs r0, 0 + bl sub_81C4C84 + movs r0, 0x12 + bl sub_81C4C60 + cmp r4, 0x1 + bne _081C1464 + ldr r0, =gUnknown_0203CF1C + ldr r3, [r0] + ldr r1, =0x000040bd + adds r0, r3, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _081C1410 + ldr r0, [r3] + ldr r2, =0x000040be + adds r1, r3, r2 + ldrb r2, [r1] + movs r1, 0x64 + muls r1, r2 + adds r0, r1 + ldr r4, =0x000040c6 + adds r1, r3, r4 + ldrb r1, [r1] + adds r4, 0x1 + adds r2, r3, r4 + ldrb r2, [r2] + bl sub_81C14BC + b _081C1430 + .pool +_081C1410: + ldr r0, [r3] + ldr r2, =0x000040be + adds r1, r3, r2 + ldrb r2, [r1] + lsls r1, r2, 2 + adds r1, r2 + lsls r1, 4 + adds r0, r1 + ldr r4, =0x000040c6 + adds r1, r3, r4 + ldrb r1, [r1] + adds r4, 0x1 + adds r2, r3, r4 + ldrb r2, [r2] + bl sub_81C15EC +_081C1430: + ldr r5, =gUnknown_0203CF1C + ldr r0, [r5] + adds r0, 0xC + bl sub_81C0098 + ldr r1, [r5] + ldr r6, =0x000040c6 + adds r0, r1, r6 + ldrb r0, [r0] + ldr r4, =0x000040c7 + adds r1, r4 + ldrb r1, [r1] + bl sub_81C40A0 + ldr r1, [r5] + adds r0, r1, r6 + ldrb r0, [r0] + adds r1, r4 + ldrb r1, [r1] + bl sub_81C4568 + ldr r0, [r5] + adds r4, r0, r4 + ldrb r1, [r4] + adds r0, r6 + strb r1, [r0] +_081C1464: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040c6 + adds r0, r1, r2 + ldrb r0, [r0] + lsls r0, 1 + adds r1, 0x84 + adds r1, r0 + ldrh r4, [r1] + adds r0, r4, 0 + bl sub_81C3E9C + adds r0, r4, 0 + bl sub_81C240C + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + ldr r1, =gTasks + lsls r0, r7, 2 + adds r0, r7 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_81C0F44 + str r1, [r0] + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C13B0 + + thumb_func_start sub_81C14BC +sub_81C14BC: @ 81C14BC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x28 + adds r7, r0, 0 + adds r4, r1, 0 + adds r6, r2, 0 + lsls r4, 24 + lsrs r4, 24 + lsls r6, 24 + lsrs r6, 24 + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + lsls r0, r4, 1 + mov r10, r0 + adds r1, r2, 0 + adds r1, 0x84 + adds r0, r1, r0 + str r0, [sp, 0x8] + ldrh r0, [r0] + mov r3, sp + adds r3, 0x2 + str r3, [sp, 0x1C] + strh r0, [r3] + lsls r0, r6, 1 + mov r9, r0 + add r1, r9 + str r1, [sp, 0xC] + ldrh r1, [r1] + mov r0, sp + strh r1, [r0] + adds r1, r2, 0 + adds r1, 0x8C + adds r3, r1, r4 + str r3, [sp, 0x10] + ldrb r0, [r3] + mov r3, sp + adds r3, 0x5 + str r3, [sp, 0x24] + strb r0, [r3] + adds r1, r6 + str r1, [sp, 0x14] + ldrb r0, [r1] + mov r1, sp + adds r1, 0x4 + str r1, [sp, 0x20] + strb r0, [r1] + adds r2, 0xA4 + str r2, [sp, 0x18] + ldrb r0, [r2] + mov r5, sp + adds r5, 0x6 + strb r0, [r5] + ldr r1, =gUnknown_08329D22 + adds r0, r4, r1 + ldrb r0, [r0] + mov r8, r0 + ldrb r0, [r5] + adds r2, r0, 0 + mov r3, r8 + ands r2, r3 + mov r3, r10 + asrs r2, r3 + lsls r2, 24 + lsrs r2, 24 + adds r1, r6, r1 + ldrb r1, [r1] + mov r12, r1 + adds r1, r0, 0 + mov r3, r12 + ands r1, r3 + mov r3, r9 + asrs r1, r3 + lsls r1, 24 + lsrs r1, 24 + mov r3, r8 + bics r0, r3 + strb r0, [r5] + ldrb r0, [r5] + mov r3, r12 + bics r0, r3 + strb r0, [r5] + mov r0, r9 + lsls r2, r0 + mov r3, r10 + lsls r1, r3 + adds r2, r1 + ldrb r0, [r5] + orrs r0, r2 + strb r0, [r5] + adds r1, r4, 0 + adds r1, 0xD + adds r0, r7, 0 + mov r2, sp + bl SetMonData + adds r1, r6, 0 + adds r1, 0xD + adds r0, r7, 0 + ldr r2, [sp, 0x1C] + bl SetMonData + adds r4, 0x11 + adds r0, r7, 0 + adds r1, r4, 0 + ldr r2, [sp, 0x20] + bl SetMonData + adds r6, 0x11 + adds r0, r7, 0 + adds r1, r6, 0 + ldr r2, [sp, 0x24] + bl SetMonData + adds r0, r7, 0 + movs r1, 0x15 + adds r2, r5, 0 + bl SetMonData + mov r0, sp + ldrh r0, [r0] + ldr r1, [sp, 0x8] + strh r0, [r1] + ldr r3, [sp, 0x1C] + ldrh r0, [r3] + ldr r1, [sp, 0xC] + strh r0, [r1] + ldr r3, [sp, 0x20] + ldrb r0, [r3] + ldr r1, [sp, 0x10] + strb r0, [r1] + ldr r3, [sp, 0x24] + ldrb r0, [r3] + ldr r1, [sp, 0x14] + strb r0, [r1] + ldrb r0, [r5] + ldr r3, [sp, 0x18] + strb r0, [r3] + add sp, 0x28 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C14BC + + thumb_func_start sub_81C15EC +sub_81C15EC: @ 81C15EC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x28 + adds r7, r0, 0 + adds r4, r1, 0 + adds r6, r2, 0 + lsls r4, 24 + lsrs r4, 24 + lsls r6, 24 + lsrs r6, 24 + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + lsls r0, r4, 1 + mov r10, r0 + adds r1, r2, 0 + adds r1, 0x84 + adds r0, r1, r0 + str r0, [sp, 0x8] + ldrh r0, [r0] + mov r3, sp + adds r3, 0x2 + str r3, [sp, 0x1C] + strh r0, [r3] + lsls r0, r6, 1 + mov r9, r0 + add r1, r9 + str r1, [sp, 0xC] + ldrh r1, [r1] + mov r0, sp + strh r1, [r0] + adds r1, r2, 0 + adds r1, 0x8C + adds r3, r1, r4 + str r3, [sp, 0x10] + ldrb r0, [r3] + mov r3, sp + adds r3, 0x5 + str r3, [sp, 0x24] + strb r0, [r3] + adds r1, r6 + str r1, [sp, 0x14] + ldrb r0, [r1] + mov r1, sp + adds r1, 0x4 + str r1, [sp, 0x20] + strb r0, [r1] + adds r2, 0xA4 + str r2, [sp, 0x18] + ldrb r0, [r2] + mov r5, sp + adds r5, 0x6 + strb r0, [r5] + ldr r1, =gUnknown_08329D22 + adds r0, r4, r1 + ldrb r0, [r0] + mov r8, r0 + ldrb r0, [r5] + adds r2, r0, 0 + mov r3, r8 + ands r2, r3 + mov r3, r10 + asrs r2, r3 + lsls r2, 24 + lsrs r2, 24 + adds r1, r6, r1 + ldrb r1, [r1] + mov r12, r1 + adds r1, r0, 0 + mov r3, r12 + ands r1, r3 + mov r3, r9 + asrs r1, r3 + lsls r1, 24 + lsrs r1, 24 + mov r3, r8 + bics r0, r3 + strb r0, [r5] + ldrb r0, [r5] + mov r3, r12 + bics r0, r3 + strb r0, [r5] + mov r0, r9 + lsls r2, r0 + mov r3, r10 + lsls r1, r3 + adds r2, r1 + ldrb r0, [r5] + orrs r0, r2 + strb r0, [r5] + adds r1, r4, 0 + adds r1, 0xD + adds r0, r7, 0 + mov r2, sp + bl SetBoxMonData + adds r1, r6, 0 + adds r1, 0xD + adds r0, r7, 0 + ldr r2, [sp, 0x1C] + bl SetBoxMonData + adds r4, 0x11 + adds r0, r7, 0 + adds r1, r4, 0 + ldr r2, [sp, 0x20] + bl SetBoxMonData + adds r6, 0x11 + adds r0, r7, 0 + adds r1, r6, 0 + ldr r2, [sp, 0x24] + bl SetBoxMonData + adds r0, r7, 0 + movs r1, 0x15 + adds r2, r5, 0 + bl SetBoxMonData + mov r0, sp + ldrh r0, [r0] + ldr r1, [sp, 0x8] + strh r0, [r1] + ldr r3, [sp, 0x1C] + ldrh r0, [r3] + ldr r1, [sp, 0xC] + strh r0, [r1] + ldr r3, [sp, 0x20] + ldrb r0, [r3] + ldr r1, [sp, 0x10] + strb r0, [r1] + ldr r3, [sp, 0x24] + ldrb r0, [r3] + ldr r1, [sp, 0x14] + strb r0, [r1] + ldrb r0, [r5] + ldr r3, [sp, 0x18] + strb r0, [r3] + add sp, 0x28 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C15EC + + thumb_func_start sub_81C171C +sub_81C171C: @ 81C171C + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl sub_81C44F0 + movs r0, 0x8 + bl sub_81C4AF8 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_81C174C + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C171C + + thumb_func_start sub_81C174C +sub_81C174C: @ 81C174C + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + bl sub_81221EC + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C176A + b _081C189A +_081C176A: + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r2, 0x80 + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + beq _081C177A + b _081C189A +_081C177A: + ldr r6, =gMain + ldrh r1, [r6, 0x2E] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _081C17B4 + movs r0, 0x4 + strh r0, [r4] + movs r1, 0x1 + negs r1, r1 + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r0, =0x000040c6 + adds r2, r0 + adds r0, r4, 0 + bl sub_81C1070 + b _081C189A + .pool +_081C17B4: + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + beq _081C17DC + movs r0, 0x4 + strh r0, [r4] + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r1, =0x000040c6 + adds r2, r1 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_81C1070 + b _081C189A + .pool +_081C17DC: + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + bne _081C17F0 + bl GetLRKeysState + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C17FC +_081C17F0: + movs r1, 0x1 + negs r1, r1 + adds r0, r5, 0 + bl sub_81C0A8C + b _081C189A +_081C17FC: + ldrh r1, [r6, 0x2E] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + bne _081C1812 + bl GetLRKeysState + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _081C181C +_081C1812: + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81C0A8C + b _081C189A +_081C181C: + ldrh r1, [r6, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _081C1876 + bl sub_81C18A8 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C1868 + bl sub_81C48F0 + movs r0, 0x5 + bl PlaySE + ldr r2, =gUnknown_0203CF21 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040c6 + adds r0, r1 + ldrb r0, [r0] + strb r0, [r2] + ldr r1, =gSpecialVar_0x8005 + ldrb r0, [r2] + strh r0, [r1] + adds r0, r5, 0 + bl sub_81C044C + b _081C189A + .pool +_081C1868: + movs r0, 0x20 + bl PlaySE + adds r0, r5, 0 + bl sub_81C18F4 + b _081C189A +_081C1876: + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081C189A + bl sub_81C48F0 + movs r0, 0x5 + bl PlaySE + ldr r1, =gUnknown_0203CF21 + movs r0, 0x4 + strb r0, [r1] + ldr r1, =gSpecialVar_0x8005 + movs r0, 0x4 + strh r0, [r1] + adds r0, r5, 0 + bl sub_81C044C +_081C189A: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C174C + + thumb_func_start sub_81C18A8 +sub_81C18A8: @ 81C18A8 + push {lr} + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r0, =0x000040c6 + adds r1, r2, r0 + ldrb r0, [r1] + cmp r0, 0x4 + beq _081C18DA + ldr r3, =0x000040c4 + adds r0, r2, r3 + ldrh r0, [r0] + cmp r0, 0 + beq _081C18DA + ldrb r1, [r1] + lsls r1, 1 + adds r0, r2, 0 + adds r0, 0x84 + adds r0, r1 + ldrh r0, [r0] + bl sub_81B6D14 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C18EC +_081C18DA: + movs r0, 0x1 + b _081C18EE + .pool +_081C18EC: + movs r0, 0 +_081C18EE: + pop {r1} + bx r1 + thumb_func_end sub_81C18A8 + + thumb_func_start sub_81C18F4 +sub_81C18F4: @ 81C18F4 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0xE + bl ClearWindowTilemap + movs r0, 0xF + bl ClearWindowTilemap + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0 + movs r1, 0x3 + bl sub_81C1DA4 + movs r0, 0 + movs r1, 0x3 + movs r2, 0 + bl sub_81C1EFC + bl sub_81C4154 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_81C1940 + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C18F4 + + thumb_func_start sub_81C1940 +sub_81C1940: @ 81C1940 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + lsls r0, 24 + lsrs r7, r0, 24 + lsls r0, r7, 2 + adds r0, r7 + lsls r0, 3 + mov r8, r0 + ldr r0, =gTasks + 0x8 + mov r9, r0 + mov r4, r8 + add r4, r9 + ldr r0, =sub_81C1E20 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C196C + b _081C1B74 +_081C196C: + ldr r6, =gMain + ldrh r1, [r6, 0x2E] + movs r0, 0x40 + ands r0, r1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0 + beq _081C19B0 + movs r0, 0x1 + strh r0, [r4, 0x2] + movs r0, 0x4 + strh r0, [r4] + movs r1, 0x1 + negs r1, r1 + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r0, =0x000040c6 + adds r2, r0 + adds r0, r4, 0 + bl sub_81C1070 + movs r0, 0 + strh r0, [r4, 0x2] + b _081C1B6A + .pool +_081C19B0: + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _081C19DC + movs r0, 0x1 + strh r0, [r4, 0x2] + movs r0, 0x4 + strh r0, [r4] + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r1, =0x000040c6 + adds r2, r1 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_81C1070 + strh r5, [r4, 0x2] + b _081C1B6A + .pool +_081C19DC: + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + bne _081C19F0 + bl GetLRKeysState + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C1A64 +_081C19F0: + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + ldr r2, =0x000040c0 + adds r0, r2 + ldrb r0, [r0] + cmp r0, 0x2 + bne _081C1A00 + b _081C1B74 +_081C1A00: + movs r0, 0x13 + bl ClearWindowTilemap + ldr r2, =gSprites + ldr r0, [r4] + ldr r1, =0x000040d5 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 29 + cmp r0, 0 + blt _081C1A28 + movs r0, 0xD + bl ClearWindowTilemap +_081C1A28: + ldr r1, [r4] + ldr r2, =0x000040c6 + adds r0, r1, r2 + ldrb r0, [r0] + lsls r0, 1 + adds r1, 0x84 + adds r1, r0 + ldrh r5, [r1] + mov r0, r9 + subs r0, 0x8 + add r0, r8 + ldr r1, =sub_81C174C + str r1, [r0] + movs r1, 0x1 + negs r1, r1 + adds r0, r7, 0 + b _081C1ACE + .pool +_081C1A64: + ldrh r1, [r6, 0x2E] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + bne _081C1A7A + bl GetLRKeysState + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _081C1B04 +_081C1A7A: + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x3 + beq _081C1B74 + movs r0, 0x13 + bl ClearWindowTilemap + ldr r2, =gSprites + ldr r0, [r4] + ldr r1, =0x000040d5 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 29 + cmp r0, 0 + blt _081C1AB0 + movs r0, 0xD + bl ClearWindowTilemap +_081C1AB0: + ldr r1, [r4] + ldr r2, =0x000040c6 + adds r0, r1, r2 + ldrb r0, [r0] + lsls r0, 1 + adds r1, 0x84 + adds r1, r0 + ldrh r5, [r1] + mov r0, r9 + subs r0, 0x8 + add r0, r8 + ldr r1, =sub_81C174C + str r1, [r0] + adds r0, r7, 0 + movs r1, 0x1 +_081C1ACE: + bl sub_81C0A8C + movs r4, 0x2 + negs r4, r4 + movs r0, 0x9 + adds r1, r4, 0 + bl sub_81C1DA4 + movs r0, 0x9 + adds r1, r4, 0 + adds r2, r5, 0 + bl sub_81C1EFC + b _081C1B74 + .pool +_081C1B04: + ldrh r1, [r6, 0x2E] + movs r0, 0x3 + ands r0, r1 + cmp r0, 0 + beq _081C1B74 + movs r0, 0x13 + bl ClearWindowTilemap + ldr r2, =gSprites + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + ldr r1, =0x000040d5 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 29 + cmp r0, 0 + blt _081C1B38 + movs r0, 0xD + bl ClearWindowTilemap +_081C1B38: + ldr r1, [r4] + ldr r2, =0x000040c6 + adds r0, r1, r2 + ldrb r0, [r0] + lsls r0, 1 + adds r1, 0x84 + adds r1, r0 + ldrh r5, [r1] + adds r0, r5, 0 + bl sub_81C3E9C + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + movs r4, 0x3 + negs r4, r4 + movs r0, 0x9 + adds r1, r4, 0 + bl sub_81C1DA4 + movs r0, 0x9 + adds r1, r4, 0 + adds r2, r5, 0 + bl sub_81C1EFC +_081C1B6A: + mov r0, r9 + subs r0, 0x8 + add r0, r8 + ldr r1, =sub_81C174C + str r1, [r0] +_081C1B74: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C1940 + + thumb_func_start sub_81C1B94 +sub_81C1B94: @ 81C1B94 + ldr r0, =gUnknown_0203CF21 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_81C1B94 + + thumb_func_start sub_81C1BA0 +sub_81C1BA0: @ 81C1BA0 + push {r4-r7,lr} + sub sp, 0xC + movs r0, 0x20 + bl Alloc + adds r4, r0, 0 + movs r5, 0 +_081C1BAE: + lsls r0, r5, 25 + lsrs r1, r0, 24 + adds r6, r1, 0 + ldr r0, =gUnknown_0203CF1C + ldr r3, [r0] + ldr r2, =0x000040c1 + adds r0, r3, r2 + ldrb r0, [r0] + cmp r5, r0 + bcs _081C1BD8 + lsls r0, r1, 1 + adds r0, r4 + movs r1, 0x40 + strh r1, [r0] + strh r1, [r0, 0x2] + movs r1, 0x50 + b _081C1BEE + .pool +_081C1BD8: + ldr r7, =0x000040c2 + adds r0, r3, r7 + ldrb r2, [r0] + cmp r5, r2 + bls _081C1BF8 + lsls r0, r1, 1 + adds r0, r4 + movs r1, 0x4A + strh r1, [r0] + strh r1, [r0, 0x2] + movs r1, 0x5A +_081C1BEE: + strh r1, [r0, 0x10] + strh r1, [r0, 0x12] + b _081C1C78 + .pool +_081C1BF8: + ldr r7, =0x000040c0 + adds r0, r3, r7 + ldrb r0, [r0] + cmp r5, r0 + bcs _081C1C1C + lsls r1, 1 + adds r1, r4 + movs r0, 0x46 + strh r0, [r1] + movs r0, 0x47 + strh r0, [r1, 0x2] + movs r0, 0x56 + strh r0, [r1, 0x10] + movs r0, 0x57 + b _081C1C76 + .pool +_081C1C1C: + cmp r5, r0 + bne _081C1C4C + cmp r5, r2 + beq _081C1C38 + lsls r1, 1 + adds r1, r4 + movs r0, 0x41 + strh r0, [r1] + movs r0, 0x42 + strh r0, [r1, 0x2] + movs r0, 0x51 + strh r0, [r1, 0x10] + movs r0, 0x52 + b _081C1C76 +_081C1C38: + lsls r1, 1 + adds r1, r4 + movs r0, 0x4B + strh r0, [r1] + movs r0, 0x4C + strh r0, [r1, 0x2] + movs r0, 0x5B + strh r0, [r1, 0x10] + movs r0, 0x5C + b _081C1C76 +_081C1C4C: + cmp r5, r2 + beq _081C1C64 + lsls r1, 1 + adds r1, r4 + movs r0, 0x43 + strh r0, [r1] + movs r0, 0x44 + strh r0, [r1, 0x2] + movs r0, 0x53 + strh r0, [r1, 0x10] + movs r0, 0x54 + b _081C1C76 +_081C1C64: + lsls r1, r6, 1 + adds r1, r4 + movs r0, 0x48 + strh r0, [r1] + movs r0, 0x49 + strh r0, [r1, 0x2] + movs r0, 0x58 + strh r0, [r1, 0x10] + movs r0, 0x59 +_081C1C76: + strh r0, [r1, 0x12] +_081C1C78: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x3 + bls _081C1BAE + movs r0, 0x8 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x10 + str r0, [sp, 0x8] + movs r0, 0x3 + adds r1, r4, 0 + movs r2, 0xB + movs r3, 0 + bl CopyToBgTilemapBufferRect_ChangePalette + movs r0, 0x3 + bl schedule_bg_copy_tilemap_to_vram + adds r0, r4, 0 + bl Free + add sp, 0xC + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81C1BA0 + + thumb_func_start sub_81C1CB0 +sub_81C1CB0: @ 81C1CB0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + adds r4, r0, 0 + mov r8, r1 + lsls r2, 24 + lsrs r6, r2, 24 + lsls r3, 24 + lsrs r5, r3, 24 + ldrb r1, [r4, 0x6] + ldrb r0, [r4, 0x7] + lsls r0, 1 + muls r0, r1 + bl Alloc + adds r7, r0, 0 + mov r1, sp + ldrh r0, [r4, 0x4] + strh r0, [r1] + ldrb r1, [r4, 0x7] + ldrb r0, [r4, 0x6] + adds r2, r1, 0 + muls r2, r0 + movs r0, 0x80 + lsls r0, 17 + orrs r2, r0 + mov r0, sp + adds r1, r7, 0 + bl CpuSet + ldrb r0, [r4, 0x6] + cmp r0, r6 + beq _081C1D60 + cmp r5, 0 + bne _081C1D30 + movs r5, 0 + ldrb r0, [r4, 0x7] + cmp r5, r0 + bcs _081C1D60 +_081C1D00: + ldrb r2, [r4, 0x6] + adds r1, r2, 0 + muls r1, r5 + adds r3, r6, r1 + lsls r3, 1 + ldr r0, [r4] + adds r0, r3 + lsls r1, 1 + adds r1, r7, r1 + subs r2, r6 + ldr r3, =0x001fffff + ands r2, r3 + bl CpuSet + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + ldrb r3, [r4, 0x7] + cmp r5, r3 + bcc _081C1D00 + b _081C1D60 + .pool +_081C1D30: + movs r5, 0 + ldrb r0, [r4, 0x7] + cmp r5, r0 + bcs _081C1D60 +_081C1D38: + ldrb r2, [r4, 0x6] + adds r1, r2, 0 + muls r1, r5 + lsls r3, r1, 1 + ldr r0, [r4] + adds r0, r3 + adds r1, r6, r1 + lsls r1, 1 + adds r1, r7, r1 + subs r2, r6 + ldr r3, =0x001fffff + ands r2, r3 + bl CpuSet + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + ldrb r3, [r4, 0x7] + cmp r5, r3 + bcc _081C1D38 +_081C1D60: + movs r5, 0 + b _081C1D8A + .pool +_081C1D68: + ldrb r2, [r4, 0x6] + adds r0, r2, 0 + muls r0, r5 + lsls r0, 1 + adds r0, r7, r0 + ldrb r1, [r4, 0x9] + adds r1, r5 + lsls r1, 5 + ldrb r3, [r4, 0x8] + adds r1, r3 + lsls r1, 1 + add r1, r8 + bl CpuSet + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 +_081C1D8A: + ldrb r0, [r4, 0x7] + cmp r5, r0 + bcc _081C1D68 + adds r0, r7, 0 + bl Free + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81C1CB0 + + thumb_func_start sub_81C1DA4 +sub_81C1DA4: @ 81C1DA4 + push {r4-r6,lr} + lsls r0, 16 + lsrs r6, r0, 16 + lsls r1, 16 + lsrs r4, r1, 16 + asrs r1, 16 + ldr r3, =gUnknown_0861CC04 + ldrb r2, [r3, 0x6] + cmp r1, r2 + ble _081C1DBA + adds r4, r2, 0 +_081C1DBA: + lsls r0, r4, 16 + asrs r0, 16 + cmp r0, 0 + beq _081C1DC6 + cmp r0, r2 + bne _081C1DE8 +_081C1DC6: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r0, =0x000020bc + adds r1, r0 + lsls r2, r4, 24 + lsrs r2, 24 + adds r0, r3, 0 + movs r3, 0x1 + bl sub_81C1CB0 + b _081C1E12 + .pool +_081C1DE8: + ldr r5, =sub_81C1E20 + adds r0, r5, 0 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + bne _081C1E04 + adds r0, r5, 0 + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r2, r0, 24 +_081C1E04: + ldr r1, =gTasks + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r1 + strh r4, [r0, 0x8] + strh r6, [r0, 0xA] +_081C1E12: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C1DA4 + + thumb_func_start sub_81C1E20 +sub_81C1E20: @ 81C1E20 + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4] + ldrh r1, [r4, 0x2] + adds r0, r1 + strh r0, [r4, 0x2] + lsls r0, 16 + cmp r0, 0 + bge _081C1E50 + movs r0, 0 + strh r0, [r4, 0x2] + ldr r7, =gUnknown_0861CC04 + b _081C1E60 + .pool +_081C1E50: + movs r0, 0x2 + ldrsh r1, [r4, r0] + ldr r0, =gUnknown_0861CC04 + ldrb r2, [r0, 0x6] + adds r7, r0, 0 + cmp r1, r2 + ble _081C1E60 + strh r2, [r4, 0x2] +_081C1E60: + ldr r5, =gUnknown_0203CF1C + ldr r1, [r5] + ldr r0, =0x000020bc + adds r1, r0 + ldrb r2, [r4, 0x2] + adds r0, r7, 0 + movs r3, 0x1 + bl sub_81C1CB0 + movs r1, 0x2 + ldrsh r0, [r4, r1] + cmp r0, 0 + ble _081C1E80 + ldrb r7, [r7, 0x6] + cmp r0, r7 + blt _081C1EE0 +_081C1E80: + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0 + bge _081C1EAC + ldr r0, [r5] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x2 + bne _081C1ED4 + movs r0, 0xE + bl PutWindowTilemap + b _081C1ED4 + .pool +_081C1EAC: + ldr r2, =gSprites + ldr r0, [r5] + ldr r1, =0x000040d5 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 29 + cmp r0, 0 + blt _081C1ECE + movs r0, 0xD + bl PutWindowTilemap +_081C1ECE: + movs r0, 0x13 + bl PutWindowTilemap +_081C1ED4: + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + adds r0, r6, 0 + bl DestroyTask +_081C1EE0: + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C1E20 + + thumb_func_start sub_81C1EFC +sub_81C1EFC: @ 81C1EFC + push {r4-r7,lr} + lsls r0, 16 + lsrs r7, r0, 16 + lsls r1, 16 + lsls r2, 16 + lsrs r6, r2, 16 + lsrs r4, r1, 16 + asrs r1, 16 + ldr r3, =gUnknown_0861CC10 + ldrb r2, [r3, 0x6] + cmp r1, r2 + ble _081C1F16 + adds r4, r2, 0 +_081C1F16: + lsls r0, r4, 16 + asrs r0, 16 + cmp r0, 0 + beq _081C1F22 + cmp r0, r2 + bne _081C1F44 +_081C1F22: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r0, =0x000030bc + adds r1, r0 + lsls r2, r4, 24 + lsrs r2, 24 + adds r0, r3, 0 + movs r3, 0x1 + bl sub_81C1CB0 + b _081C1F70 + .pool +_081C1F44: + ldr r5, =sub_81C1F80 + adds r0, r5, 0 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + bne _081C1F60 + adds r0, r5, 0 + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r2, r0, 24 +_081C1F60: + ldr r1, =gTasks + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + adds r0, r1 + strh r4, [r0, 0x8] + strh r7, [r0, 0xA] + strh r6, [r0, 0xC] +_081C1F70: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C1EFC + + thumb_func_start sub_81C1F80 +sub_81C1F80: @ 81C1F80 + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4] + ldrh r1, [r4, 0x2] + adds r0, r1 + strh r0, [r4, 0x2] + lsls r0, 16 + cmp r0, 0 + bge _081C1FB0 + movs r0, 0 + strh r0, [r4, 0x2] + ldr r7, =gUnknown_0861CC10 + b _081C1FC0 + .pool +_081C1FB0: + movs r0, 0x2 + ldrsh r1, [r4, r0] + ldr r0, =gUnknown_0861CC10 + ldrb r2, [r0, 0x6] + adds r7, r0, 0 + cmp r1, r2 + ble _081C1FC0 + strh r2, [r4, 0x2] +_081C1FC0: + ldr r5, =gUnknown_0203CF1C + ldr r1, [r5] + ldr r0, =0x000030bc + adds r1, r0 + ldrb r2, [r4, 0x2] + adds r0, r7, 0 + movs r3, 0x1 + bl sub_81C1CB0 + movs r1, 0x2 + ldrsh r0, [r4, r1] + cmp r0, 0 + ble _081C1FE0 + ldrb r7, [r7, 0x6] + cmp r0, r7 + blt _081C2058 +_081C1FE0: + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0 + bge _081C2024 + ldr r0, [r5] + ldr r1, =0x000040c0 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C2006 + ldr r0, =sub_81C0B8C + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + bne _081C2006 + movs r0, 0xF + bl PutWindowTilemap +_081C2006: + ldrh r0, [r4, 0x4] + bl sub_81C240C + b _081C204C + .pool +_081C2024: + ldr r2, =gSprites + ldr r0, [r5] + ldr r1, =0x000040d5 + adds r0, r1 + ldrb r1, [r0] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + adds r0, 0x3E + ldrb r0, [r0] + lsls r0, 29 + cmp r0, 0 + blt _081C2046 + movs r0, 0xD + bl PutWindowTilemap +_081C2046: + movs r0, 0x13 + bl PutWindowTilemap +_081C204C: + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + adds r0, r6, 0 + bl DestroyTask +_081C2058: + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C1F80 + + thumb_func_start sub_81C2074 +sub_81C2074: @ 81C2074 + push {r4,r5,lr} + lsls r0, 16 + lsrs r5, r0, 16 + lsls r1, 16 + lsrs r4, r1, 16 + asrs r1, 16 + ldr r3, =gUnknown_0861CBEC + ldrb r2, [r3, 0x6] + cmp r1, r2 + ble _081C208A + adds r4, r2, 0 +_081C208A: + lsls r0, r4, 16 + asrs r0, 16 + cmp r0, 0 + beq _081C2096 + cmp r0, r2 + bne _081C20C8 +_081C2096: + ldr r5, =gUnknown_0203CF1C + ldr r1, [r5] + adds r1, 0xBC + lsls r4, 24 + lsrs r4, 24 + adds r0, r3, 0 + adds r2, r4, 0 + movs r3, 0 + bl sub_81C1CB0 + ldr r0, =gUnknown_0861CBF8 + ldr r1, [r5] + adds r1, 0xBC + adds r2, r4, 0 + movs r3, 0 + bl sub_81C1CB0 + b _081C20E2 + .pool +_081C20C8: + ldr r0, =sub_81C20F0 + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + strh r4, [r1, 0x8] + strh r5, [r1, 0xA] +_081C20E2: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2074 + + thumb_func_start sub_81C20F0 +sub_81C20F0: @ 81C20F0 + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + lsls r0, r6, 2 + adds r0, r6 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r5, r0, r1 + ldrh r0, [r5] + ldrh r1, [r5, 0x2] + adds r0, r1 + strh r0, [r5, 0x2] + lsls r0, 16 + cmp r0, 0 + bge _081C2120 + movs r0, 0 + strh r0, [r5, 0x2] + ldr r7, =gUnknown_0861CBEC + b _081C2130 + .pool +_081C2120: + movs r0, 0x2 + ldrsh r1, [r5, r0] + ldr r0, =gUnknown_0861CBEC + ldrb r2, [r0, 0x6] + adds r7, r0, 0 + cmp r1, r2 + ble _081C2130 + strh r2, [r5, 0x2] +_081C2130: + ldr r4, =gUnknown_0203CF1C + ldr r1, [r4] + adds r1, 0xBC + ldrb r2, [r5, 0x2] + adds r0, r7, 0 + movs r3, 0 + bl sub_81C1CB0 + ldr r0, =gUnknown_0861CBF8 + ldr r1, [r4] + adds r1, 0xBC + ldrb r2, [r5, 0x2] + movs r3, 0 + bl sub_81C1CB0 + movs r0, 0x3 + bl schedule_bg_copy_tilemap_to_vram + movs r1, 0x2 + ldrsh r0, [r5, r1] + cmp r0, 0 + ble _081C2162 + ldrb r7, [r7, 0x6] + cmp r0, r7 + blt _081C2180 +_081C2162: + movs r1, 0 + ldrsh r0, [r5, r1] + cmp r0, 0 + bge _081C217A + bl sub_81C4A88 + movs r0, 0xD + bl PutWindowTilemap + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram +_081C217A: + adds r0, r6, 0 + bl DestroyTask +_081C2180: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C20F0 + + thumb_func_start sub_81C2194 +sub_81C2194: @ 81C2194 + push {r4-r7,lr} + adds r6, r0, 0 + lsls r2, 24 + lsls r1, 28 + lsrs r4, r1, 16 + ldr r7, =0x0000056a + cmp r2, 0 + bne _081C21E4 + movs r3, 0 + ldr r5, =gUnknown_08DC3CD4 +_081C21A8: + adds r2, r7, r3 + lsls r2, 1 + adds r2, r6 + lsls r0, r3, 1 + adds r0, r5 + ldrh r1, [r0] + adds r1, r4, r1 + strh r1, [r2] + adds r0, r2, 0 + adds r0, 0x40 + strh r1, [r0] + adds r2, 0x80 + adds r0, r3, 0 + adds r0, 0x14 + lsls r0, 1 + adds r0, r5 + ldrh r0, [r0] + adds r0, r4, r0 + strh r0, [r2] + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0x13 + bls _081C21A8 + b _081C221C + .pool +_081C21E4: + movs r3, 0 + ldr r5, =gUnknown_08DC3CD4 +_081C21E8: + adds r1, r7, r3 + lsls r1, 1 + adds r1, r6 + adds r0, r3, 0 + adds r0, 0x14 + lsls r0, 1 + adds r0, r5 + ldrh r0, [r0] + adds r0, r4, r0 + strh r0, [r1] + adds r2, r1, 0 + adds r2, 0x40 + adds r0, r3, 0 + adds r0, 0x28 + lsls r0, 1 + adds r0, r5 + ldrh r0, [r0] + adds r0, r4, r0 + strh r0, [r2] + adds r1, 0x80 + strh r0, [r1] + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0x13 + bls _081C21E8 +_081C221C: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2194 + + thumb_func_start sub_81C2228 +sub_81C2228: @ 81C2228 + push {r4,lr} + adds r4, r0, 0 + movs r1, 0 + bl CheckPartyPokerus + lsls r0, 24 + cmp r0, 0 + bne _081C225C + adds r0, r4, 0 + movs r1, 0 + bl CheckPartyHasHadPokerus + lsls r0, 24 + cmp r0, 0 + beq _081C225C + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r2, =0x00000502 + adds r1, r0, r2 + movs r2, 0x2C + b _081C2266 + .pool +_081C225C: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r2, =0x00000502 + adds r1, r0, r2 + ldr r2, =0x0000081a +_081C2266: + strh r2, [r1] + ldr r1, =0x00000d02 + adds r0, r1 + strh r2, [r0] + movs r0, 0x3 + bl schedule_bg_copy_tilemap_to_vram + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2228 + + thumb_func_start sub_81C228C +sub_81C228C: @ 81C228C + push {lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + bne _081C22AC + movs r0, 0x8 + str r0, [sp] + str r1, [sp, 0x4] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0x4 + movs r3, 0x8 + bl sub_8199C30 + b _081C22C0 +_081C22AC: + movs r0, 0x8 + str r0, [sp] + movs r0, 0x5 + str r0, [sp, 0x4] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0x4 + movs r3, 0x8 + bl sub_8199C30 +_081C22C0: + movs r0, 0x3 + bl schedule_bg_copy_tilemap_to_vram + add sp, 0x8 + pop {r0} + bx r0 + thumb_func_end sub_81C228C + + thumb_func_start sub_81C22CC +sub_81C22CC: @ 81C22CC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + adds r6, r1, 0 + adds r6, 0x70 + ldrb r1, [r6, 0x5] + mov r8, r0 + cmp r1, 0x63 + bhi _081C2340 + ldr r5, =gExperienceTables + adds r2, r1, 0 + adds r1, r2, 0x1 + lsls r1, 2 + ldr r4, =gBaseStats + ldrh r3, [r6] + lsls r0, r3, 3 + subs r0, r3 + lsls r0, 2 + adds r0, r4 + ldrb r3, [r0, 0x13] + movs r0, 0xCA + lsls r0, 1 + muls r0, r3 + adds r1, r0 + adds r1, r5 + lsls r2, 2 + adds r2, r0 + adds r2, r5 + ldr r1, [r1] + ldr r2, [r2] + subs r1, r2 + ldr r0, [r6, 0x10] + subs r4, r0, r2 + lsls r0, r4, 6 + bl __udivsi3 + adds r6, r0, 0 + movs r7, 0 + adds r0, r7, 0 + orrs r0, r6 + cmp r0, 0 + bne _081C2344 + cmp r4, 0 + beq _081C2344 + movs r6, 0x1 + movs r7, 0 + b _081C2344 + .pool +_081C2340: + movs r6, 0 + movs r7, 0 +_081C2344: + mov r1, r8 + ldr r0, [r1] + ldr r2, =0x00001d66 + adds r2, r0 + mov r9, r2 + movs r0, 0 + mov r12, r0 + ldr r1, =0x00002062 + mov r10, r1 +_081C2356: + cmp r7, 0 + bgt _081C2362 + cmp r7, 0 + bne _081C237C + cmp r6, 0x7 + bls _081C237C +_081C2362: + mov r2, r12 + lsls r0, r2, 1 + add r0, r9 + ldr r2, =0x0000206a + adds r1, r2, 0 + strh r1, [r0] + b _081C23B6 + .pool +_081C237C: + mov r1, r12 + lsls r0, r1, 1 + add r0, r9 + mov r8, r0 + adds r5, r7, 0 + adds r4, r6, 0 + cmp r7, 0 + bge _081C2394 + movs r4, 0x7 + movs r5, 0 + adds r4, r6 + adcs r5, r7 +_081C2394: + lsls r3, r5, 29 + lsrs r2, r4, 3 + adds r0, r3, 0 + orrs r0, r2 + asrs r1, r5, 3 + lsrs r5, r0, 29 + lsls r4, r1, 3 + adds r3, r5, 0 + orrs r3, r4 + lsls r2, r0, 3 + adds r1, r7, 0 + adds r0, r6, 0 + subs r0, r2 + sbcs r1, r3 + add r0, r10 + mov r2, r8 + strh r0, [r2] +_081C23B6: + movs r0, 0x8 + negs r0, r0 + asrs r1, r0, 31 + adds r6, r0 + adcs r7, r1 + cmp r7, 0 + bge _081C23C8 + movs r6, 0 + movs r7, 0 +_081C23C8: + mov r0, r12 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r12, r0 + cmp r0, 0x7 + bls _081C2356 + movs r0, 0x1 + bl GetBgTilemapBuffer + ldr r1, =gUnknown_0203CF1C + ldr r1, [r1] + ldr r2, =0x000010bc + adds r1, r2 + cmp r0, r1 + bne _081C23F8 + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + b _081C23FE + .pool +_081C23F8: + movs r0, 0x2 + bl schedule_bg_copy_tilemap_to_vram +_081C23FE: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81C22CC + + thumb_func_start sub_81C240C +sub_81C240C: @ 81C240C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + lsls r0, 16 + lsrs r3, r0, 16 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000038bc + adds r5, r0, r1 + cmp r3, 0 + beq _081C2510 + ldr r1, =gContestEffects + ldr r2, =gContestMoves + lsls r3, 3 + adds r0, r3, r2 + ldrb r0, [r0] + lsls r0, 2 + adds r0, r1 + ldrb r4, [r0, 0x1] + mov r9, r1 + mov r8, r2 + mov r10, r3 + cmp r4, 0xFF + beq _081C244C + adds r0, r4, 0 + movs r1, 0xA + bl __udivsi3 + lsls r0, 24 + lsrs r4, r0, 24 +_081C244C: + movs r2, 0 + movs r6, 0x3 + movs r3, 0xF3 + lsls r3, 2 +_081C2454: + cmp r4, 0xFF + beq _081C2484 + cmp r2, r4 + bcs _081C2484 + lsrs r0, r2, 2 + adds r1, r2, 0 + ands r1, r6 + lsls r0, 5 + adds r0, r1 + lsls r0, 1 + adds r0, r5 + adds r0, r3 + ldr r7, =0x0000103a + b _081C2496 + .pool +_081C2484: + lsrs r0, r2, 2 + adds r1, r2, 0 + ands r1, r6 + lsls r0, 5 + adds r0, r1 + lsls r0, 1 + adds r0, r5 + adds r0, r3 + ldr r7, =0x00001039 +_081C2496: + adds r1, r7, 0 + strh r1, [r0] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x7 + bls _081C2454 + mov r0, r10 + add r0, r8 + ldrb r0, [r0] + lsls r0, 2 + add r0, r9 + ldrb r4, [r0, 0x2] + cmp r4, 0xFF + beq _081C24C0 + adds r0, r4, 0 + movs r1, 0xA + bl __udivsi3 + lsls r0, 24 + lsrs r4, r0, 24 +_081C24C0: + movs r2, 0 + movs r6, 0x3 + ldr r3, =0x0000044c +_081C24C6: + cmp r4, 0xFF + beq _081C24F0 + cmp r2, r4 + bcs _081C24F0 + lsrs r0, r2, 2 + adds r1, r2, 0 + ands r1, r6 + lsls r0, 5 + adds r0, r1 + lsls r0, 1 + adds r0, r5 + adds r0, r3 + ldr r7, =0x0000103c + b _081C2502 + .pool +_081C24F0: + lsrs r0, r2, 2 + adds r1, r2, 0 + ands r1, r6 + lsls r0, 5 + adds r0, r1 + lsls r0, 1 + adds r0, r5 + adds r0, r3 + ldr r7, =0x0000103d +_081C2502: + adds r1, r7, 0 + strh r1, [r0] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x7 + bls _081C24C6 +_081C2510: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C240C + + thumb_func_start sub_81C2524 +sub_81C2524: @ 81C2524 + push {lr} + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0x74 + ldrb r0, [r0] + cmp r0, 0 + beq _081C2544 + movs r1, 0x80 + lsls r1, 9 + movs r0, 0x3 + movs r2, 0 + bl ChangeBgX + b _081C254E + .pool +_081C2544: + movs r0, 0x3 + movs r1, 0 + movs r2, 0 + bl ChangeBgX +_081C254E: + pop {r0} + bx r0 + thumb_func_end sub_81C2524 + + thumb_func_start sub_81C2554 +sub_81C2554: @ 81C2554 + push {r4,r5,lr} + ldr r0, =gUnknown_0861CC24 + bl InitWindows + bl DeactivateAllTextPrinters + movs r4, 0 +_081C2562: + adds r0, r4, 0 + movs r1, 0 + bl FillWindowPixelBuffer + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x13 + bls _081C2562 + movs r4, 0 + ldr r5, =gUnknown_0203CF1C + ldr r3, =0x000040cb + movs r2, 0xFF +_081C257C: + ldr r0, [r5] + adds r0, r3 + adds r0, r4 + ldrb r1, [r0] + orrs r1, r2 + strb r1, [r0] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x7 + bls _081C257C + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2554 + + thumb_func_start sub_81C25A4 +sub_81C25A4: @ 81C25A4 + push {r4-r6,lr} + sub sp, 0x14 + ldr r4, [sp, 0x24] + ldr r5, [sp, 0x28] + lsls r0, 24 + lsrs r0, 24 + lsls r2, 24 + lsrs r2, 24 + lsls r3, 24 + lsrs r3, 24 + lsls r4, 24 + lsrs r4, 24 + lsls r5, 24 + lsrs r5, 24 + movs r6, 0 + str r6, [sp] + str r4, [sp, 0x4] + lsls r4, r5, 1 + adds r4, r5 + ldr r5, =gUnknown_0861CD2C + adds r4, r5 + str r4, [sp, 0x8] + str r6, [sp, 0xC] + str r1, [sp, 0x10] + movs r1, 0x1 + bl AddTextPrinterParametrized2 + add sp, 0x14 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C25A4 + + thumb_func_start sub_81C25E8 +sub_81C25E8: @ 81C25E8 + push {lr} + movs r0, 0x11 + movs r1, 0 + bl FillWindowPixelBuffer + movs r0, 0x12 + movs r1, 0 + bl FillWindowPixelBuffer + movs r0, 0x13 + movs r1, 0 + bl FillWindowPixelBuffer + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0x74 + ldrb r0, [r0] + cmp r0, 0 + bne _081C2618 + bl sub_81C2628 + b _081C261C + .pool +_081C2618: + bl sub_81C2794 +_081C261C: + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + pop {r0} + bx r0 + thumb_func_end sub_81C25E8 + + thumb_func_start sub_81C2628 +sub_81C2628: @ 81C2628 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x18 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + movs r1, 0xC + adds r1, r0 + mov r8, r1 + adds r7, r0, 0 + adds r7, 0x70 + ldrh r0, [r7] + bl SpeciesToPokedexNum + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, =0x0000ffff + cmp r5, r0 + beq _081C26CE + ldr r6, =gStringVar1 + ldr r1, =gText_UnkCtrlF908Clear01 + adds r0, r6, 0 + bl StringCopy + ldr r4, =gStringVar2 + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0x2 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + adds r0, r6, 0 + adds r1, r4, 0 + bl StringAppend + mov r0, r8 + bl IsMonShiny + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0 + bne _081C26AC + str r0, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + movs r0, 0x11 + adds r1, r6, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + movs r0, 0 + bl sub_81C228C + b _081C26C6 + .pool +_081C26AC: + movs r0, 0 + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x11 + adds r1, r6, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + movs r0, 0x1 + bl sub_81C228C +_081C26C6: + movs r0, 0x11 + bl PutWindowTilemap + b _081C26EE +_081C26CE: + movs r0, 0x11 + bl ClearWindowTilemap + mov r0, r8 + bl IsMonShiny + lsls r0, 24 + cmp r0, 0 + bne _081C26E8 + movs r0, 0 + bl sub_81C228C + b _081C26EE +_081C26E8: + movs r0, 0x1 + bl sub_81C228C +_081C26EE: + ldr r4, =gStringVar1 + ldr r1, =gText_LevelSymbol + adds r0, r4, 0 + bl StringCopy + ldr r5, =gStringVar2 + ldrb r1, [r7, 0x5] + adds r0, r5, 0 + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + adds r0, r4, 0 + adds r1, r5, 0 + bl StringAppend + movs r6, 0 + str r6, [sp] + movs r5, 0x1 + str r5, [sp, 0x4] + movs r0, 0x13 + adds r1, r4, 0 + movs r2, 0x18 + movs r3, 0x11 + bl sub_81C25A4 + mov r0, r8 + adds r1, r4, 0 + bl GetMonNickname + str r6, [sp] + str r5, [sp, 0x4] + movs r0, 0x12 + adds r1, r4, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + add r1, sp, 0x8 + movs r0, 0xBA + strb r0, [r1] + mov r0, sp + adds r0, 0x9 + ldrh r2, [r7, 0x2] + movs r1, 0xB + muls r1, r2 + ldr r2, =gSpeciesNames + adds r1, r2 + bl StringCopy + str r6, [sp] + str r5, [sp, 0x4] + movs r0, 0x13 + add r1, sp, 0x8 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldrh r1, [r7, 0x2] + mov r0, r8 + bl sub_81C27DC + movs r0, 0x12 + bl PutWindowTilemap + movs r0, 0x13 + bl PutWindowTilemap + add sp, 0x18 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2628 + + thumb_func_start sub_81C2794 +sub_81C2794: @ 81C2794 + push {r4,lr} + sub sp, 0x8 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0xC + ldr r4, =gStringVar1 + adds r1, r4, 0 + bl GetMonNickname + movs r0, 0 + str r0, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + movs r0, 0x12 + adds r1, r4, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + movs r0, 0x12 + bl PutWindowTilemap + movs r0, 0x11 + bl ClearWindowTilemap + movs r0, 0x13 + bl ClearWindowTilemap + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2794 + + thumb_func_start sub_81C27DC +sub_81C27DC: @ 81C27DC + push {lr} + sub sp, 0x8 + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0x20 + beq _081C282C + cmp r1, 0x1D + beq _081C282C + bl GetMonGender + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0 + beq _081C27FE + cmp r0, 0xFE + beq _081C2818 + b _081C282C +_081C27FE: + ldr r1, =gText_MaleSymbol + str r0, [sp] + movs r0, 0x3 + str r0, [sp, 0x4] + movs r0, 0x13 + movs r2, 0x39 + movs r3, 0x11 + bl sub_81C25A4 + b _081C282C + .pool +_081C2818: + ldr r1, =gText_FemaleSymbol + movs r0, 0 + str r0, [sp] + movs r0, 0x4 + str r0, [sp, 0x4] + movs r0, 0x13 + movs r2, 0x39 + movs r3, 0x11 + bl sub_81C25A4 +_081C282C: + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C27DC + + thumb_func_start sub_81C2838 +sub_81C2838: @ 81C2838 + push {r4,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 24 + ldr r3, =gUnknown_0861CDD3 + cmp r1, 0 + bne _081C284A + subs r3, 0x80 +_081C284A: + lsls r2, 16 + lsrs r2, 16 + movs r0, 0x10 + str r0, [sp] + str r0, [sp, 0x4] + adds r0, r4, 0 + adds r1, r3, 0 + movs r3, 0 + bl BlitBitmapToWindow + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2838 + + thumb_func_start sub_81C286C +sub_81C286C: @ 81C286C + push {r4-r7,lr} + sub sp, 0x8 + ldr r1, =gText_PkmnInfo + movs r5, 0 + str r5, [sp] + movs r6, 0x1 + str r6, [sp, 0x4] + movs r0, 0 + movs r2, 0x2 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_PkmnSkills + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0x1 + movs r2, 0x2 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_BattleMoves + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0x2 + movs r2, 0x2 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_ContestMoves + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0x3 + movs r2, 0x2 + movs r3, 0x1 + bl sub_81C25A4 + ldr r7, =gText_Cancel2 + movs r0, 0x1 + adds r1, r7, 0 + movs r2, 0x3E + bl GetStringRightAlignXOffset + adds r4, r0, 0 + adds r2, r4, 0 + subs r2, 0x10 + cmp r2, 0 + bge _081C28CC + movs r2, 0 +_081C28CC: + movs r0, 0x4 + movs r1, 0 + bl sub_81C2838 + lsls r2, r4, 24 + lsrs r2, 24 + str r5, [sp] + str r5, [sp, 0x4] + movs r0, 0x4 + adds r1, r7, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r7, =gText_Info + movs r0, 0x1 + adds r1, r7, 0 + movs r2, 0x3E + bl GetStringRightAlignXOffset + adds r4, r0, 0 + adds r2, r4, 0 + subs r2, 0x10 + cmp r2, 0 + bge _081C28FE + movs r2, 0 +_081C28FE: + movs r0, 0x5 + movs r1, 0 + bl sub_81C2838 + lsls r2, r4, 24 + lsrs r2, 24 + str r5, [sp] + str r5, [sp, 0x4] + movs r0, 0x5 + adds r1, r7, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r7, =gText_Switch + movs r0, 0x1 + adds r1, r7, 0 + movs r2, 0x3E + bl GetStringRightAlignXOffset + adds r4, r0, 0 + adds r2, r4, 0 + subs r2, 0x10 + cmp r2, 0 + bge _081C2930 + movs r2, 0 +_081C2930: + movs r0, 0x6 + movs r1, 0 + bl sub_81C2838 + lsls r2, r4, 24 + lsrs r2, 24 + str r5, [sp] + str r5, [sp, 0x4] + movs r0, 0x6 + adds r1, r7, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_RentalPkmn + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0x8 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_TypeSlash + str r5, [sp] + str r5, [sp, 0x4] + movs r0, 0x9 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r4, =gText_HP4 + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x2A + bl GetStringCenterAlignXOffset + adds r0, 0x6 + lsls r2, r0, 24 + lsrs r2, 24 + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xA + adds r1, r4, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r4, =gText_Attack3 + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x2A + bl GetStringCenterAlignXOffset + adds r0, 0x6 + lsls r2, r0, 24 + lsrs r2, 24 + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xA + adds r1, r4, 0 + movs r3, 0x11 + bl sub_81C25A4 + ldr r4, =gText_Defense3 + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x2A + bl GetStringCenterAlignXOffset + adds r0, 0x6 + lsls r2, r0, 24 + lsrs r2, 24 + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xA + adds r1, r4, 0 + movs r3, 0x21 + bl sub_81C25A4 + ldr r4, =gText_SpAtk4 + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x24 + bl GetStringCenterAlignXOffset + adds r0, 0x2 + lsls r2, r0, 24 + lsrs r2, 24 + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xB + adds r1, r4, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r4, =gText_SpDef4 + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x24 + bl GetStringCenterAlignXOffset + adds r0, 0x2 + lsls r2, r0, 24 + lsrs r2, 24 + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xB + adds r1, r4, 0 + movs r3, 0x11 + bl sub_81C25A4 + ldr r4, =gText_Speed2 + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x24 + bl GetStringCenterAlignXOffset + adds r0, 0x2 + lsls r2, r0, 24 + lsrs r2, 24 + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xB + adds r1, r4, 0 + movs r3, 0x21 + bl sub_81C25A4 + ldr r1, =gText_ExpPoints + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xC + movs r2, 0x6 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_NextLv + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xC + movs r2, 0x6 + movs r3, 0x11 + bl sub_81C25A4 + ldr r1, =gText_Status + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xD + movs r2, 0x2 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_Power + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xE + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_Accuracy2 + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xE + movs r2, 0 + movs r3, 0x11 + bl sub_81C25A4 + ldr r1, =gText_Appeal + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xF + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_Jam + str r5, [sp] + str r6, [sp, 0x4] + movs r0, 0xF + movs r2, 0 + movs r3, 0x11 + bl sub_81C25A4 + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C286C + + thumb_func_start sub_81C2AFC +sub_81C2AFC: @ 81C2AFC + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + adds r5, r4, 0 + movs r0, 0 + bl ClearWindowTilemap + movs r0, 0x1 + bl ClearWindowTilemap + movs r0, 0x2 + bl ClearWindowTilemap + movs r0, 0x3 + bl ClearWindowTilemap + cmp r4, 0x1 + beq _081C2B66 + cmp r4, 0x1 + bgt _081C2B2A + cmp r4, 0 + beq _081C2B34 + b _081C2C06 +_081C2B2A: + cmp r5, 0x2 + beq _081C2B80 + cmp r5, 0x3 + beq _081C2BC4 + b _081C2C06 +_081C2B34: + movs r0, 0 + bl PutWindowTilemap + movs r0, 0x4 + bl PutWindowTilemap + bl sub_81A6BF4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C2B58 + bl sub_81B9E94 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C2B5E +_081C2B58: + movs r0, 0x8 + bl PutWindowTilemap +_081C2B5E: + movs r0, 0x9 + bl PutWindowTilemap + b _081C2C06 +_081C2B66: + movs r0, 0x1 + bl PutWindowTilemap + movs r0, 0xA + bl PutWindowTilemap + movs r0, 0xB + bl PutWindowTilemap + movs r0, 0xC + bl PutWindowTilemap + b _081C2C06 +_081C2B80: + movs r0, 0x2 + bl PutWindowTilemap + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040bc + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C2BBC + adds r2, 0x8 + adds r0, r1, r2 + ldr r0, [r0] + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 11 + cmp r0, r1 + beq _081C2C06 + movs r0, 0xE + bl PutWindowTilemap + b _081C2C06 + .pool +_081C2BBC: + movs r0, 0x5 + bl PutWindowTilemap + b _081C2C06 +_081C2BC4: + movs r0, 0x3 + bl PutWindowTilemap + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040bc + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C2C00 + adds r2, 0x8 + adds r0, r1, r2 + ldr r0, [r0] + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 11 + cmp r0, r1 + beq _081C2C06 + movs r0, 0xF + bl PutWindowTilemap + b _081C2C06 + .pool +_081C2C00: + movs r0, 0x5 + bl PutWindowTilemap +_081C2C06: + movs r4, 0 + ldr r5, =gUnknown_0203CF1C +_081C2C0A: + ldr r0, [r5] + ldr r1, =0x000040cb + adds r0, r1 + adds r0, r4 + ldrb r0, [r0] + bl PutWindowTilemap + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x7 + bls _081C2C0A + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2AFC + + thumb_func_start sub_81C2C38 +sub_81C2C38: @ 81C2C38 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + adds r1, r0, 0 + cmp r0, 0x1 + beq _081C2C84 + cmp r0, 0x1 + bgt _081C2C4E + cmp r0, 0 + beq _081C2C58 + b _081C2D0E +_081C2C4E: + cmp r1, 0x2 + beq _081C2C98 + cmp r1, 0x3 + beq _081C2CD4 + b _081C2D0E +_081C2C58: + movs r0, 0x4 + bl ClearWindowTilemap + bl sub_81A6BF4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C2C76 + bl sub_81B9E94 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C2C7C +_081C2C76: + movs r0, 0x8 + bl ClearWindowTilemap +_081C2C7C: + movs r0, 0x9 + bl ClearWindowTilemap + b _081C2D0E +_081C2C84: + movs r0, 0xA + bl ClearWindowTilemap + movs r0, 0xB + bl ClearWindowTilemap + movs r0, 0xC + bl ClearWindowTilemap + b _081C2D0E +_081C2C98: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040bc + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C2CCC + adds r2, 0x8 + adds r0, r1, r2 + ldr r0, [r0] + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 11 + cmp r0, r1 + beq _081C2D0E + movs r0, 0xE + bl ClearWindowTilemap + b _081C2D0E + .pool +_081C2CCC: + movs r0, 0x5 + bl ClearWindowTilemap + b _081C2D0E +_081C2CD4: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040bc + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C2D08 + adds r2, 0x8 + adds r0, r1, r2 + ldr r0, [r0] + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 11 + cmp r0, r1 + beq _081C2D0E + movs r0, 0xF + bl ClearWindowTilemap + b _081C2D0E + .pool +_081C2D08: + movs r0, 0x5 + bl ClearWindowTilemap +_081C2D0E: + movs r4, 0 +_081C2D10: + adds r0, r4, 0 + bl sub_81C2D68 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x7 + bls _081C2D10 + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81C2C38 + + thumb_func_start sub_81C2D2C +sub_81C2D2C: @ 81C2D2C + push {r4,lr} + adds r3, r0, 0 + lsls r1, 24 + lsrs r2, r1, 24 + ldr r0, =gUnknown_0203CF1C + ldr r4, =0x000040cb + adds r1, r2, r4 + ldr r0, [r0] + adds r4, r0, r1 + ldrb r0, [r4] + cmp r0, 0xFF + bne _081C2D56 + lsls r0, r2, 3 + adds r0, r3, r0 + bl AddWindow + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0 + bl FillWindowPixelBuffer +_081C2D56: + ldrb r0, [r4] + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81C2D2C + + thumb_func_start sub_81C2D68 +sub_81C2D68: @ 81C2D68 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_0203CF1C + ldr r2, =0x000040cb + adds r0, r2 + ldr r1, [r1] + adds r4, r1, r0 + ldrb r0, [r4] + cmp r0, 0xFF + beq _081C2D8C + bl ClearWindowTilemap + ldrb r0, [r4] + bl RemoveWindow + movs r0, 0xFF + strb r0, [r4] +_081C2D8C: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2D68 + + thumb_func_start sub_81C2D9C +sub_81C2D9C: @ 81C2D9C + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + movs r4, 0 +_081C2DA4: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040cb + adds r0, r1 + adds r1, r0, r4 + ldrb r0, [r1] + cmp r0, 0xFF + beq _081C2DBA + movs r1, 0 + bl FillWindowPixelBuffer +_081C2DBA: + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0x7 + bls _081C2DA4 + ldr r0, =gUnknown_0861CE54 + lsls r1, r5, 2 + adds r1, r0 + ldr r0, [r1] + bl _call_via_r0 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2D9C + + thumb_func_start sub_81C2DE4 +sub_81C2DE4: @ 81C2DE4 + push {lr} + lsls r0, 24 + ldr r1, =gUnknown_0861CE64 + lsrs r0, 22 + adds r0, r1 + ldr r0, [r0] + movs r1, 0x10 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2DE4 + + thumb_func_start sub_81C2E00 +sub_81C2E00: @ 81C2E00 + push {lr} + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0x74 + ldrb r0, [r0] + cmp r0, 0 + beq _081C2E24 + bl sub_81C335C + bl sub_81C33CC + bl sub_81C3428 + bl sub_81C349C + b _081C2E3C + .pool +_081C2E24: + bl sub_81C2EC4 + bl sub_81C2F5C + bl sub_81C2FD8 + bl sub_81C302C + bl sub_81C307C + bl sub_81C3194 +_081C2E3C: + pop {r0} + bx r0 + thumb_func_end sub_81C2E00 + + thumb_func_start sub_81C2E40 +sub_81C2E40: @ 81C2E40 + push {r4,lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x6 + bhi _081C2EB8 + lsls r0, 2 + ldr r1, =_081C2E70 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081C2E70: + .4byte _081C2E8C + .4byte _081C2E92 + .4byte _081C2E98 + .4byte _081C2E9E + .4byte _081C2EA4 + .4byte _081C2EAA + .4byte _081C2EB0 +_081C2E8C: + bl sub_81C2EC4 + b _081C2EB8 +_081C2E92: + bl sub_81C2F5C + b _081C2EB8 +_081C2E98: + bl sub_81C2FD8 + b _081C2EB8 +_081C2E9E: + bl sub_81C302C + b _081C2EB8 +_081C2EA4: + bl sub_81C307C + b _081C2EB8 +_081C2EAA: + bl sub_81C3194 + b _081C2EB8 +_081C2EB0: + adds r0, r2, 0 + bl DestroyTask + b _081C2EBE +_081C2EB8: + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_081C2EBE: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81C2E40 + + thumb_func_start sub_81C2EC4 +sub_81C2EC4: @ 81C2EC4 + push {r4-r6,lr} + sub sp, 0x8 + bl sub_81A6BF4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C2F54 + bl sub_81B9E94 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C2F54 + ldr r0, =gUnknown_0861CCCC + movs r1, 0 + bl sub_81C2D2C + lsls r0, 24 + lsrs r5, r0, 24 + ldr r4, =gText_OTSlash + movs r6, 0 + str r6, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + adds r0, r5, 0 + adds r1, r4, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0 + bl GetStringWidth + adds r2, r0, 0 + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0xA2 + ldrb r0, [r0] + cmp r0, 0 + bne _081C2F40 + adds r1, 0xA6 + lsls r2, 24 + lsrs r2, 24 + str r6, [sp] + movs r0, 0x5 + str r0, [sp, 0x4] + adds r0, r5, 0 + movs r3, 0x1 + bl sub_81C25A4 + b _081C2F54 + .pool +_081C2F40: + adds r1, 0xA6 + lsls r2, 24 + lsrs r2, 24 + str r6, [sp] + movs r0, 0x6 + str r0, [sp, 0x4] + adds r0, r5, 0 + movs r3, 0x1 + bl sub_81C25A4 +_081C2F54: + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_81C2EC4 + + thumb_func_start sub_81C2F5C +sub_81C2F5C: @ 81C2F5C + push {r4,r5,lr} + sub sp, 0x8 + bl sub_81A6BF4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C2FC0 + bl sub_81B9E94 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C2FC0 + ldr r5, =gStringVar1 + ldr r1, =gText_UnkCtrlF907F908 + adds r0, r5, 0 + bl StringCopy + ldr r1, =gUnknown_0203CF1C + ldr r1, [r1] + adds r1, 0xB8 + ldrh r1, [r1] + movs r2, 0x2 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x38 + bl GetStringRightAlignXOffset + adds r4, r0, 0 + ldr r0, =gUnknown_0861CCCC + movs r1, 0x1 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + lsls r4, 24 + lsrs r4, 24 + movs r1, 0 + str r1, [sp] + movs r1, 0x1 + str r1, [sp, 0x4] + adds r1, r5, 0 + adds r2, r4, 0 + movs r3, 0x1 + bl sub_81C25A4 +_081C2FC0: + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2F5C + + thumb_func_start sub_81C2FD8 +sub_81C2FD8: @ 81C2FD8 + push {r4,lr} + sub sp, 0x8 + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x70 + ldrh r0, [r0] + adds r1, 0x78 + ldrb r1, [r1] + bl GetAbilityBySpecies + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_0861CCCC + movs r1, 0x2 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + movs r1, 0xD + muls r1, r4 + ldr r2, =gAbilityNames + adds r1, r2 + movs r2, 0 + str r2, [sp] + movs r2, 0x1 + str r2, [sp, 0x4] + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C2FD8 + + thumb_func_start sub_81C302C +sub_81C302C: @ 81C302C + push {r4,lr} + sub sp, 0x8 + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + adds r0, r1, 0 + adds r0, 0x70 + ldrh r0, [r0] + adds r1, 0x78 + ldrb r1, [r1] + bl GetAbilityBySpecies + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_0861CCCC + movs r1, 0x2 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gAbilityDescriptionPointers + lsls r4, 2 + adds r4, r1 + ldr r1, [r4] + movs r2, 0 + str r2, [sp] + str r2, [sp, 0x4] + movs r3, 0x11 + bl sub_81C25A4 + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C302C + + thumb_func_start sub_81C307C +sub_81C307C: @ 81C307C + push {r4-r6,lr} + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r4, r0, 0 + adds r4, 0x70 + bl sub_81AFBF0 + ldr r1, =gUnknown_0861CE74 + movs r0, 0 + bl sub_81AFC0C + ldr r1, =gUnknown_0861CE7B + movs r0, 0x1 + bl sub_81AFC0C + bl sub_81C31C0 + bl sub_81A6BF4 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C30C2 + bl sub_81B9E94 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081C30C2 + bl sub_81C3304 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C30E0 +_081C30C2: + ldr r0, =gStringVar4 + ldr r1, =gText_XNature + bl sub_81AFC28 + b _081C3182 + .pool +_081C30E0: + movs r0, 0x20 + bl Alloc + adds r6, r0, 0 + movs r0, 0x20 + bl Alloc + adds r5, r0, 0 + adds r0, r6, 0 + bl sub_81C31F0 + ldrb r0, [r4, 0x9] + cmp r0, 0xD4 + bhi _081C310C + adds r1, r0, 0 + adds r0, r5, 0 + bl sub_8124610 + movs r0, 0x4 + adds r1, r5, 0 + bl sub_81AFC0C +_081C310C: + bl sub_81C3220 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C3148 + ldrb r0, [r4, 0xA] + cmp r0, 0 + bne _081C3134 + ldrb r0, [r4, 0x9] + ldr r1, =gText_XNatureHatchedAtYZ + cmp r0, 0xD4 + bls _081C3170 + ldr r1, =gText_XNatureHatchedSomewhereAt + b _081C3170 + .pool +_081C3134: + ldrb r0, [r4, 0x9] + ldr r1, =gText_XNatureMetAtYZ + cmp r0, 0xD4 + bls _081C3170 + ldr r1, =gText_XNatureMetSomewhereAt + b _081C3170 + .pool +_081C3148: + ldrb r0, [r4, 0x9] + cmp r0, 0xFF + bne _081C3158 + ldr r1, =gText_XNatureFatefulEncounter + b _081C3170 + .pool +_081C3158: + cmp r0, 0xFE + beq _081C316E + bl sub_81C32BC + lsls r0, 24 + cmp r0, 0 + beq _081C316E + ldrb r0, [r4, 0x9] + ldr r1, =gText_XNatureProbablyMetAt + cmp r0, 0xD4 + bls _081C3170 +_081C316E: + ldr r1, =gText_XNatureObtainedInTrade +_081C3170: + ldr r0, =gStringVar4 + bl sub_81AFC28 + adds r0, r6, 0 + bl Free + adds r0, r5, 0 + bl Free +_081C3182: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C307C + + thumb_func_start sub_81C3194 +sub_81C3194: @ 81C3194 + push {lr} + sub sp, 0x8 + ldr r0, =gUnknown_0861CCCC + movs r1, 0x3 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gStringVar4 + movs r2, 0 + str r2, [sp] + str r2, [sp, 0x4] + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3194 + + thumb_func_start sub_81C31C0 +sub_81C31C0: @ 81C31C0 + push {lr} + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =gNatureNamePointers + adds r0, 0xA3 + ldrb r0, [r0] + lsls r0, 2 + adds r0, r1 + ldr r1, [r0] + movs r0, 0x2 + bl sub_81AFC0C + ldr r1, =gText_EmptyString5 + movs r0, 0x5 + bl sub_81AFC0C + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C31C0 + + thumb_func_start sub_81C31F0 +sub_81C31F0: @ 81C31F0 + push {r4,lr} + adds r4, r0, 0 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0x7A + ldrb r1, [r0] + cmp r1, 0 + bne _081C3202 + movs r1, 0x5 +_081C3202: + adds r0, r4, 0 + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + movs r0, 0x3 + adds r1, r4, 0 + bl sub_81AFC0C + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C31F0 + + thumb_func_start sub_81C3220 +sub_81C3220: @ 81C3220 + push {r4-r6,lr} + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r6, r0, 0 + adds r6, 0x70 + ldr r1, [r0] + ldr r0, =gEnemyParty + cmp r1, r0 + bne _081C326C + bl GetMultiplayerId + movs r1, 0x1 + eors r0, r1 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gLinkPlayers + lsls r1, r0, 3 + subs r1, r0 + lsls r1, 2 + adds r0, r2, 0x4 + adds r0, r1, r0 + ldrh r4, [r0] + adds r0, r1, r2 + ldrb r5, [r0, 0x13] + ldr r0, =gStringVar1 + adds r2, 0x8 + adds r1, r2 + bl StringCopy + b _081C3282 + .pool +_081C326C: + bl GetPlayerIDAsU32 + adds r4, r0, 0 + ldr r0, =0x0000ffff + ands r4, r0 + ldr r0, =gSaveBlock2Ptr + ldr r1, [r0] + ldrb r5, [r1, 0x8] + ldr r0, =gStringVar1 + bl StringCopy +_081C3282: + adds r0, r6, 0 + adds r0, 0x32 + ldrb r0, [r0] + cmp r5, r0 + bne _081C32A4 + ldr r0, [r6, 0x48] + ldr r1, =0x0000ffff + ands r0, r1 + cmp r4, r0 + bne _081C32A4 + ldr r0, =gStringVar1 + adds r1, r6, 0 + adds r1, 0x36 + bl StringCompareWithoutExtCtrlCodes + cmp r0, 0 + beq _081C32B4 +_081C32A4: + movs r0, 0 + b _081C32B6 + .pool +_081C32B4: + movs r0, 0x1 +_081C32B6: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_81C3220 + + thumb_func_start sub_81C32BC +sub_81C32BC: @ 81C32BC + push {lr} + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0x70 + ldrb r0, [r0, 0xB] + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x4 + bls _081C32D8 + movs r0, 0 + b _081C32DA + .pool +_081C32D8: + movs r0, 0x1 +_081C32DA: + pop {r1} + bx r1 + thumb_func_end sub_81C32BC + + thumb_func_start sub_81C32E0 +sub_81C32E0: @ 81C32E0 + push {lr} + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r0, 0x70 + ldrb r0, [r0, 0xB] + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bls _081C32FC + movs r0, 0 + b _081C32FE + .pool +_081C32FC: + movs r0, 0x1 +_081C32FE: + pop {r1} + bx r1 + thumb_func_end sub_81C32E0 + + thumb_func_start sub_81C3304 +sub_81C3304: @ 81C3304 + push {lr} + ldr r0, =gBattleTypeFlags + ldr r0, [r0] + movs r1, 0x80 + lsls r1, 15 + ands r0, r1 + cmp r0, 0 + beq _081C3354 + ldr r0, =gMain + ldr r1, =0x00000439 + adds r0, r1 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081C3354 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040be + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x1 + beq _081C333A + cmp r0, 0x4 + beq _081C333A + cmp r0, 0x5 + bne _081C3354 +_081C333A: + movs r0, 0x1 + b _081C3356 + .pool +_081C3354: + movs r0, 0 +_081C3356: + pop {r1} + bx r1 + thumb_func_end sub_81C3304 + + thumb_func_start sub_81C335C +sub_81C335C: @ 81C335C + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0x8 + ldr r0, =gUnknown_0861CCCC + movs r1, 0 + bl sub_81C2D2C + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gText_OTSlash + mov r8, r0 + movs r0, 0x1 + mov r1, r8 + movs r2, 0 + bl GetStringWidth + adds r5, r0, 0 + movs r0, 0 + mov r9, r0 + str r0, [sp] + movs r6, 0x1 + str r6, [sp, 0x4] + adds r0, r4, 0 + mov r1, r8 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gText_FiveMarks + lsls r5, 24 + lsrs r5, 24 + mov r0, r9 + str r0, [sp] + str r6, [sp, 0x4] + adds r0, r4, 0 + adds r2, r5, 0 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C335C + + thumb_func_start sub_81C33CC +sub_81C33CC: @ 81C33CC + push {r4,r5,lr} + sub sp, 0x8 + ldr r5, =gStringVar1 + ldr r1, =gText_UnkCtrlF907F908 + adds r0, r5, 0 + bl StringCopy + ldr r1, =gText_FiveMarks + adds r0, r5, 0 + bl StringAppend + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x38 + bl GetStringRightAlignXOffset + adds r4, r0, 0 + ldr r0, =gUnknown_0861CCCC + movs r1, 0x1 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + lsls r4, 24 + lsrs r4, 24 + movs r1, 0 + str r1, [sp] + movs r1, 0x1 + str r1, [sp, 0x4] + adds r1, r5, 0 + adds r2, r4, 0 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C33CC + + thumb_func_start sub_81C3428 +sub_81C3428: @ 81C3428 + push {r4,lr} + sub sp, 0x8 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x70 + adds r0, 0xA5 + ldrb r0, [r0] + cmp r0, 0x1 + bne _081C3448 + ldr r4, =gText_EggWillTakeALongTime + b _081C346C + .pool +_081C3448: + ldrh r0, [r1, 0x30] + cmp r0, 0x5 + bhi _081C3458 + ldr r4, =gText_EggAboutToHatch + b _081C346C + .pool +_081C3458: + cmp r0, 0xA + bhi _081C3464 + ldr r4, =gText_EggWillHatchSoon + b _081C346C + .pool +_081C3464: + ldr r4, =gText_EggWillTakeALongTime + cmp r0, 0x28 + bhi _081C346C + ldr r4, =gText_EggWillTakeSomeTime +_081C346C: + ldr r0, =gUnknown_0861CCCC + movs r1, 0x2 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + str r1, [sp] + str r1, [sp, 0x4] + adds r1, r4, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3428 + + thumb_func_start sub_81C349C +sub_81C349C: @ 81C349C + push {r4,lr} + sub sp, 0x8 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r4, r0, 0 + adds r4, 0x70 + adds r0, 0xA5 + ldrb r0, [r0] + cmp r0, 0x1 + beq _081C3500 + ldrb r0, [r4, 0x9] + cmp r0, 0xFF + bne _081C34C4 + ldr r4, =gText_PeculiarEggNicePlace + b _081C3502 + .pool +_081C34C4: + bl sub_81C32BC + lsls r0, 24 + cmp r0, 0 + beq _081C34D8 + bl sub_81C3220 + lsls r0, 24 + cmp r0, 0 + bne _081C34E0 +_081C34D8: + ldr r4, =gText_PeculiarEggTrade + b _081C3502 + .pool +_081C34E0: + ldrb r0, [r4, 0x9] + cmp r0, 0xFD + bne _081C3500 + bl sub_81C32E0 + lsls r0, 24 + lsrs r0, 24 + ldr r4, =gText_EggFromTraveler + cmp r0, 0x1 + bne _081C3502 + ldr r4, =gText_EggFromHotSprings + b _081C3502 + .pool +_081C3500: + ldr r4, =gText_OddEggFoundByCouple +_081C3502: + ldr r0, =gUnknown_0861CCCC + movs r1, 0x3 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + str r1, [sp] + str r1, [sp, 0x4] + adds r1, r4, 0 + movs r2, 0 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C349C + + thumb_func_start sub_81C3530 +sub_81C3530: @ 81C3530 + push {lr} + bl sub_81C35E4 + bl sub_81C3690 + bl sub_81C3710 + bl sub_81C37D8 + bl sub_81C3808 + bl sub_81C3890 + bl sub_81C38C0 + pop {r0} + bx r0 + thumb_func_end sub_81C3530 + + thumb_func_start sub_81C3554 +sub_81C3554: @ 81C3554 + push {r4,lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x7 + bhi _081C35D6 + lsls r0, 2 + ldr r1, =_081C3584 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081C3584: + .4byte _081C35A4 + .4byte _081C35AA + .4byte _081C35B0 + .4byte _081C35B6 + .4byte _081C35BC + .4byte _081C35C2 + .4byte _081C35C8 + .4byte _081C35CE +_081C35A4: + bl sub_81C35E4 + b _081C35D6 +_081C35AA: + bl sub_81C3690 + b _081C35D6 +_081C35B0: + bl sub_81C3710 + b _081C35D6 +_081C35B6: + bl sub_81C37D8 + b _081C35D6 +_081C35BC: + bl sub_81C3808 + b _081C35D6 +_081C35C2: + bl sub_81C3890 + b _081C35D6 +_081C35C8: + bl sub_81C38C0 + b _081C35D6 +_081C35CE: + adds r0, r2, 0 + bl DestroyTask + b _081C35DC +_081C35D6: + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_081C35DC: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81C3554 + + thumb_func_start sub_81C35E4 +sub_81C35E4: @ 81C35E4 + push {r4,r5,lr} + sub sp, 0x8 + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + adds r0, 0x9E + ldrh r0, [r0] + cmp r0, 0xAF + bne _081C3628 + bl sub_81B1250 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081C3628 + ldr r0, [r4] + ldr r1, =0x000040be + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x1 + beq _081C3614 + cmp r0, 0x4 + beq _081C3614 + cmp r0, 0x5 + bne _081C3628 +_081C3614: + movs r0, 0xAF + bl ItemId_GetItem + adds r5, r0, 0 + b _081C3650 + .pool +_081C3628: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x9E + ldrh r0, [r1] + cmp r0, 0 + bne _081C3644 + ldr r5, =gText_None + b _081C3650 + .pool +_081C3644: + ldrh r0, [r1] + ldr r4, =gStringVar1 + adds r1, r4, 0 + bl CopyItemName + adds r5, r4, 0 +_081C3650: + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x48 + bl GetStringCenterAlignXOffset + adds r4, r0, 0 + adds r4, 0x6 + ldr r0, =gUnknown_0861CCEC + movs r1, 0 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + lsls r4, 24 + lsrs r4, 24 + movs r1, 0 + str r1, [sp] + str r1, [sp, 0x4] + adds r1, r5, 0 + adds r2, r4, 0 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C35E4 + + thumb_func_start sub_81C3690 +sub_81C3690: @ 81C3690 + push {r4,r5,lr} + sub sp, 0x8 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x76 + ldrb r0, [r1] + cmp r0, 0 + bne _081C36B0 + ldr r5, =gText_None + b _081C36C8 + .pool +_081C36B0: + ldr r0, =gStringVar1 + ldrb r1, [r1] + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r4, =gStringVar4 + ldr r1, =gText_RibbonsVar1 + adds r0, r4, 0 + bl StringExpandPlaceholders + adds r5, r4, 0 +_081C36C8: + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x46 + bl GetStringCenterAlignXOffset + adds r4, r0, 0 + adds r4, 0x6 + ldr r0, =gUnknown_0861CCEC + movs r1, 0x1 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + lsls r4, 24 + lsrs r4, 24 + movs r1, 0 + str r1, [sp] + str r1, [sp, 0x4] + adds r1, r5, 0 + adds r2, r4, 0 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3690 + + thumb_func_start sub_81C3710 +sub_81C3710: @ 81C3710 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + movs r0, 0x8 + bl Alloc + mov r9, r0 + movs r0, 0x8 + bl Alloc + mov r8, r0 + movs r0, 0x8 + bl Alloc + adds r6, r0, 0 + movs r0, 0x8 + bl Alloc + adds r5, r0, 0 + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + adds r0, 0x90 + ldrh r1, [r0] + mov r0, r9 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r0, [r4] + adds r0, 0x92 + ldrh r1, [r0] + mov r0, r8 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r0, [r4] + adds r0, 0x94 + ldrh r1, [r0] + adds r0, r6, 0 + movs r2, 0x1 + movs r3, 0x7 + bl ConvertIntToDecimalStringN + ldr r0, [r4] + adds r0, 0x96 + ldrh r1, [r0] + adds r0, r5, 0 + movs r2, 0x1 + movs r3, 0x7 + bl ConvertIntToDecimalStringN + bl sub_81AFBF0 + movs r0, 0 + mov r1, r9 + bl sub_81AFC0C + movs r0, 0x1 + mov r1, r8 + bl sub_81AFC0C + movs r0, 0x2 + adds r1, r6, 0 + bl sub_81AFC0C + movs r0, 0x3 + adds r1, r5, 0 + bl sub_81AFC0C + ldr r0, =gStringVar4 + ldr r1, =gUnknown_0861CE82 + bl sub_81AFC28 + mov r0, r9 + bl Free + mov r0, r8 + bl Free + adds r0, r6, 0 + bl Free + adds r0, r5, 0 + bl Free + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3710 + + thumb_func_start sub_81C37D8 +sub_81C37D8: @ 81C37D8 + push {lr} + sub sp, 0x8 + ldr r0, =gUnknown_0861CCEC + movs r1, 0x2 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gStringVar4 + movs r2, 0 + str r2, [sp] + str r2, [sp, 0x4] + movs r2, 0x4 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C37D8 + + thumb_func_start sub_81C3808 +sub_81C3808: @ 81C3808 + push {r4-r6,lr} + mov r6, r8 + push {r6} + ldr r0, =gStringVar1 + mov r8, r0 + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + adds r0, 0x98 + ldrh r1, [r0] + mov r0, r8 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r6, =gStringVar2 + ldr r0, [r4] + adds r0, 0x9A + ldrh r1, [r0] + adds r0, r6, 0 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + ldr r5, =gStringVar3 + ldr r0, [r4] + adds r0, 0x9C + ldrh r1, [r0] + adds r0, r5, 0 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + bl sub_81AFBF0 + movs r0, 0 + mov r1, r8 + bl sub_81AFC0C + movs r0, 0x1 + adds r1, r6, 0 + bl sub_81AFC0C + movs r0, 0x2 + adds r1, r5, 0 + bl sub_81AFC0C + ldr r0, =gStringVar4 + ldr r1, =gUnknown_0861CE8E + bl sub_81AFC28 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3808 + + thumb_func_start sub_81C3890 +sub_81C3890: @ 81C3890 + push {lr} + sub sp, 0x8 + ldr r0, =gUnknown_0861CCEC + movs r1, 0x3 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gStringVar4 + movs r2, 0 + str r2, [sp] + str r2, [sp, 0x4] + movs r2, 0x2 + movs r3, 0x1 + bl sub_81C25A4 + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3890 + + thumb_func_start sub_81C38C0 +sub_81C38C0: @ 81C38C0 + push {r4-r6,lr} + sub sp, 0x8 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + adds r5, r0, 0 + adds r5, 0x70 + ldr r0, =gUnknown_0861CCEC + movs r1, 0x4 + bl sub_81C2D2C + lsls r0, 24 + lsrs r6, r0, 24 + ldr r4, =gStringVar1 + ldr r1, [r5, 0x10] + adds r0, r4, 0 + movs r2, 0x1 + movs r3, 0x7 + bl ConvertIntToDecimalStringN + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x2A + bl GetStringRightAlignXOffset + adds r0, 0x2 + lsls r2, r0, 24 + lsrs r2, 24 + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + adds r0, r6, 0 + adds r1, r4, 0 + movs r3, 0x1 + bl sub_81C25A4 + ldrb r0, [r5, 0x5] + cmp r0, 0x63 + bhi _081C3948 + ldr r4, =gExperienceTables + adds r1, r0, 0 + adds r1, 0x1 + lsls r1, 2 + ldr r3, =gBaseStats + ldrh r2, [r5] + lsls r0, r2, 3 + subs r0, r2 + lsls r0, 2 + adds r0, r3 + ldrb r2, [r0, 0x13] + movs r0, 0xCA + lsls r0, 1 + muls r0, r2 + adds r1, r0 + adds r1, r4 + ldr r1, [r1] + ldr r0, [r5, 0x10] + subs r1, r0 + b _081C394A + .pool +_081C3948: + movs r1, 0 +_081C394A: + ldr r4, =gStringVar1 + adds r0, r4, 0 + movs r2, 0x1 + movs r3, 0x6 + bl ConvertIntToDecimalStringN + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x2A + bl GetStringRightAlignXOffset + adds r0, 0x2 + lsls r2, r0, 24 + lsrs r2, 24 + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + adds r0, r6, 0 + adds r1, r4, 0 + movs r3, 0x11 + bl sub_81C25A4 + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C38C0 + + thumb_func_start sub_81C3984 +sub_81C3984: @ 81C3984 + push {r4,lr} + movs r0, 0 + bl sub_81C3B08 + movs r0, 0x1 + bl sub_81C3B08 + movs r0, 0x2 + bl sub_81C3B08 + movs r0, 0x3 + bl sub_81C3B08 + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + ldr r1, =0x000040bc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C39EA + bl sub_81C3F44 + ldr r1, [r4] + ldr r0, =0x000040c6 + adds r2, r1, r0 + ldrb r0, [r2] + cmp r0, 0x4 + bne _081C39DC + ldr r0, =0x000040c4 + adds r1, r0 + ldrh r0, [r1] + cmp r0, 0 + beq _081C39EA + bl sub_81C3E9C + b _081C39EA + .pool +_081C39DC: + ldrb r0, [r2] + lsls r0, 1 + adds r1, 0x84 + adds r1, r0 + ldrh r0, [r1] + bl sub_81C3E9C +_081C39EA: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81C3984 + + thumb_func_start sub_81C39F0 +sub_81C39F0: @ 81C39F0 + push {r4,lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x7 + bhi _081C3AFC + lsls r0, 2 + ldr r1, =_081C3A20 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081C3A20: + .4byte _081C3A40 + .4byte _081C3A48 + .4byte _081C3A50 + .4byte _081C3A58 + .4byte _081C3A60 + .4byte _081C3A7C + .4byte _081C3ABE + .4byte _081C3AF4 +_081C3A40: + movs r0, 0 + bl sub_81C3B08 + b _081C3AFC +_081C3A48: + movs r0, 0x1 + bl sub_81C3B08 + b _081C3AFC +_081C3A50: + movs r0, 0x2 + bl sub_81C3B08 + b _081C3AFC +_081C3A58: + movs r0, 0x3 + bl sub_81C3B08 + b _081C3AFC +_081C3A60: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040bc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C3AFC + bl sub_81C3F44 + b _081C3AFC + .pool +_081C3A7C: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040bc + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C3AFC + ldr r0, =0x000040c6 + adds r2, r1, r0 + ldrb r0, [r2] + cmp r0, 0x4 + bne _081C3AB0 + ldr r2, =0x000040c4 + adds r0, r1, r2 + ldrh r0, [r0] + strh r0, [r4, 0x2] + b _081C3AFC + .pool +_081C3AB0: + ldrb r0, [r2] + lsls r0, 1 + adds r1, 0x84 + adds r1, r0 + ldrh r0, [r1] + strh r0, [r4, 0x2] + b _081C3AFC +_081C3ABE: + ldr r0, =gUnknown_0203CF1C + ldr r1, [r0] + ldr r2, =0x000040bc + adds r0, r1, r2 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C3AFC + adds r2, 0x8 + adds r0, r1, r2 + ldr r0, [r0] + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 11 + cmp r0, r1 + beq _081C3AFC + ldrh r0, [r4, 0x2] + bl sub_81C3E9C + b _081C3AFC + .pool +_081C3AF4: + adds r0, r2, 0 + bl DestroyTask + b _081C3B02 +_081C3AFC: + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_081C3B02: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81C39F0 + + thumb_func_start sub_81C3B08 +sub_81C3B08: @ 81C3B08 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0xC + lsls r0, 24 + lsrs r7, r0, 24 + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + mov r10, r0 + ldr r4, =gUnknown_0861CD14 + adds r0, r4, 0 + movs r1, 0 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + adds r0, r4, 0 + movs r1, 0x1 + bl sub_81C2D2C + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x8] + lsls r1, r7, 1 + mov r0, r10 + adds r0, 0x84 + adds r0, r1 + ldrh r5, [r0] + cmp r5, 0 + beq _081C3C00 + mov r0, r10 + adds r0, 0xA4 + ldrb r1, [r0] + adds r0, r5, 0 + adds r2, r7, 0 + bl CalculatePPWithBonus + adds r6, r0, 0 + lsls r6, 24 + lsrs r6, 24 + movs r0, 0xD + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gMoveNames + adds r1, r0 + lsls r0, r7, 4 + mov r9, r0 + mov r3, r9 + adds r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + movs r0, 0 + str r0, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + mov r0, r8 + movs r2, 0 + bl sub_81C25A4 + ldr r0, =gStringVar1 + mov r8, r0 + mov r5, r10 + adds r5, 0x8C + adds r5, r7 + ldrb r1, [r5] + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r4, =gStringVar2 + adds r0, r4, 0 + adds r1, r6, 0 + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + bl sub_81AFBF0 + movs r0, 0 + mov r1, r8 + bl sub_81AFC0C + movs r0, 0x1 + adds r1, r4, 0 + bl sub_81AFC0C + ldr r4, =gStringVar4 + ldr r1, =gUnknown_0861CE97 + adds r0, r4, 0 + bl sub_81AFC28 + adds r7, r4, 0 + ldrb r0, [r5] + adds r1, r6, 0 + bl GetCurrentPpToMaxPpState + lsls r0, 24 + lsrs r0, 24 + adds r5, r0, 0 + adds r5, 0x9 + movs r0, 0x1 + adds r1, r7, 0 + movs r2, 0x2C + bl GetStringRightAlignXOffset + mov r4, r9 + b _081C3C26 + .pool +_081C3C00: + ldr r1, =gText_OneDash + lsls r4, r7, 4 + adds r3, r4, 0x1 + lsls r3, 24 + lsrs r3, 24 + str r5, [sp] + movs r0, 0x1 + str r0, [sp, 0x4] + mov r0, r8 + movs r2, 0 + bl sub_81C25A4 + ldr r7, =gText_TwoDashes + movs r5, 0xC + movs r0, 0x1 + adds r1, r7, 0 + movs r2, 0x2C + bl GetStringCenterAlignXOffset +_081C3C26: + lsls r2, r0, 24 + lsrs r2, 24 + adds r3, r4, 0x1 + lsls r3, 24 + lsrs r3, 24 + movs r0, 0 + str r0, [sp] + lsls r0, r5, 24 + lsrs r0, 24 + str r0, [sp, 0x4] + ldr r0, [sp, 0x8] + adds r1, r7, 0 + bl sub_81C25A4 + add sp, 0xC + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3B08 + + thumb_func_start sub_81C3C5C +sub_81C3C5C: @ 81C3C5C + push {r4-r6,lr} + sub sp, 0x8 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0 + beq _081C3CFC + movs r0, 0x13 + str r0, [sp] + movs r0, 0x20 + str r0, [sp, 0x4] + movs r0, 0xE + movs r1, 0 + movs r2, 0x35 + movs r3, 0 + bl FillWindowPixelRect + ldr r2, =gBattleMoves + lsls r1, r5, 1 + adds r0, r1, r5 + lsls r0, 2 + adds r2, r0, r2 + ldrb r0, [r2, 0x1] + adds r6, r1, 0 + cmp r0, 0x1 + bhi _081C3C9C + ldr r1, =gText_ThreeDashes + b _081C3CAC + .pool +_081C3C9C: + ldr r4, =gStringVar1 + ldrb r1, [r2, 0x1] + adds r0, r4, 0 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + adds r1, r4, 0 +_081C3CAC: + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + movs r0, 0xE + movs r2, 0x35 + movs r3, 0x1 + bl sub_81C25A4 + ldr r1, =gBattleMoves + adds r0, r6, r5 + lsls r0, 2 + adds r1, r0, r1 + ldrb r0, [r1, 0x3] + cmp r0, 0 + bne _081C3CDC + ldr r1, =gText_ThreeDashes + b _081C3CEC + .pool +_081C3CDC: + ldr r4, =gStringVar1 + ldrb r1, [r1, 0x3] + adds r0, r4, 0 + movs r2, 0x1 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + adds r1, r4, 0 +_081C3CEC: + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + movs r0, 0xE + movs r2, 0x35 + movs r3, 0x11 + bl sub_81C25A4 +_081C3CFC: + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3C5C + + thumb_func_start sub_81C3D08 +sub_81C3D08: @ 81C3D08 + push {r4,lr} + movs r0, 0 + bl sub_81C3B08 + movs r0, 0x1 + bl sub_81C3B08 + movs r0, 0x2 + bl sub_81C3B08 + movs r0, 0x3 + bl sub_81C3B08 + ldr r4, =gUnknown_0203CF1C + ldr r0, [r4] + ldr r1, =0x000040bc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C3D40 + bl sub_81C3F44 + ldr r0, [r4] + ldr r1, =0x000040c6 + adds r0, r1 + ldrb r0, [r0] + bl sub_81C3E2C +_081C3D40: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81C3D08 + + thumb_func_start sub_81C3D54 +sub_81C3D54: @ 81C3D54 + push {r4,lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x6 + bhi _081C3E20 + lsls r0, 2 + ldr r1, =_081C3D84 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081C3D84: + .4byte _081C3DA0 + .4byte _081C3DA8 + .4byte _081C3DB0 + .4byte _081C3DB8 + .4byte _081C3DC0 + .4byte _081C3DDC + .4byte _081C3E18 +_081C3DA0: + movs r0, 0 + bl sub_81C3B08 + b _081C3E20 +_081C3DA8: + movs r0, 0x1 + bl sub_81C3B08 + b _081C3E20 +_081C3DB0: + movs r0, 0x2 + bl sub_81C3B08 + b _081C3E20 +_081C3DB8: + movs r0, 0x3 + bl sub_81C3B08 + b _081C3E20 +_081C3DC0: + ldr r0, =gUnknown_0203CF1C + ldr r0, [r0] + ldr r1, =0x000040bc + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C3E20 + bl sub_81C3F44 + b _081C3E20 + .pool +_081C3DDC: + ldr r0, =gUnknown_0203CF1C + ldr r2, [r0] + ldr r1, =0x000040bc + adds r0, r2, r1 + ldrb r0, [r0] + cmp r0, 0x3 + bne _081C3E20 + adds r1, 0x8 + adds r0, r2, r1 + ldr r0, [r0] + ldr r1, =0x00ffffff + ands r0, r1 + movs r1, 0x80 + lsls r1, 11 + cmp r0, r1 + beq _081C3E20 + ldr r1, =0x000040c6 + adds r0, r2, r1 + ldrb r0, [r0] + bl sub_81C3E2C + b _081C3E20 + .pool +_081C3E18: + adds r0, r2, 0 + bl DestroyTask + b _081C3E26 +_081C3E20: + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] +_081C3E26: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81C3D54 + thumb_func_start sub_81C3E2C sub_81C3E2C: @ 81C3E2C push {r4,lr} diff --git a/asm/secret_base.s b/asm/secret_base.s index 69cfff512..d433f5df2 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -1192,7 +1192,7 @@ _080E9462: mov r3, r10 ldrb r1, [r3] lsls r1, 5 - ldr r2, =gDecorations + 0x1c + ldr r2, =gUnknown_085A5C24 adds r1, r2 ldr r1, [r1] ldrh r1, [r1] diff --git a/asm/trader.s b/asm/trader.s index 8e0b17905..8c21648fc 100644 --- a/asm/trader.s +++ b/asm/trader.s @@ -351,7 +351,7 @@ sub_8133CF4: @ 8133CF4 ldr r5, =gScriptResult _08133CFA: adds r0, r4, 0 - bl CountDecorationCategoryN + bl sub_8161AD0 lsls r0, 24 cmp r0, 0 beq _08133D10 @@ -395,7 +395,7 @@ sub_8133D2C: @ 8133D2C cmp r1, r0 beq _08133D72 adds r0, r1, 0 - bl GetFirstEmptyDecorSlot + bl sub_81618D0 lsls r0, 24 asrs r0, 24 movs r1, 0x1 @@ -433,15 +433,15 @@ sub_8133DA0: @ 8133DA0 push {r4-r6,lr} lsls r0, 24 lsrs r6, r0, 24 - bl IsSelectedDecorInThePC + bl sub_81279C4 lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 bne _08133DFC ldr r5, =gSpecialVar_0x8006 - ldr r0, =gCurDecorationIndex + ldr r0, =gUnknown_0203A172 ldrb r1, [r0] - ldr r0, =gCurDecorInventoryItems + ldr r0, =gUnknown_0203A14C ldr r0, [r0] adds r0, r1 ldrb r0, [r0] diff --git a/data/cute_sketch.s b/data/cute_sketch.s index 8a8ee1481..ebdf1e39d 100644 --- a/data/cute_sketch.s +++ b/data/cute_sketch.s @@ -5,4 +5,4 @@ .align 2, 0 gUnknown_085A1F94:: @ 85A1F94 - .incbin "baserom.gba", 0x5a1f94, 0x2580 + .incbin "baserom.gba", 0x5a1f94, 0x3c74 diff --git a/data/decoration.s b/data/decoration.s new file mode 100644 index 000000000..de4478f8d --- /dev/null +++ b/data/decoration.s @@ -0,0 +1,86 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + .align 2, 0 + +gDecorations:: @ 85A5C08 + .incbin "baserom.gba", 0x5a5c08, 0x1c + +gUnknown_085A5C24:: @ 85A5C24 + .incbin "baserom.gba", 0x5a5c24, 0xf04 + +gUnknown_085A6B28:: @ 85A6B28 + .incbin "baserom.gba", 0x5a6b28, 0x20 + +gUnknown_085A6B48:: @ 85A6B48 + .incbin "baserom.gba", 0x5a6b48, 0x20 + +gUnknown_085A6B68:: @ 85A6B68 + .incbin "baserom.gba", 0x5a6b68, 0x10 + +gUnknown_085A6B78:: @ 85A6B78 + .incbin "baserom.gba", 0x5a6b78, 0x18 + +gUnknown_085A6B90:: @ 85A6B90 + .incbin "baserom.gba", 0x5a6b90, 0x20 + +gUnknown_085A6BB0:: @ 85A6BB0 + .incbin "baserom.gba", 0x5a6bb0, 0x20 + +gUnknown_085A6BD0:: @ 85A6BD0 + .incbin "baserom.gba", 0x5a6bd0, 0x18 + +gUnknown_085A6BE8:: @ 85A6BE8 + .incbin "baserom.gba", 0x5a6be8, 0x5c8 + +gUnknown_085A71B0:: @ 85A71B0 + .incbin "baserom.gba", 0x5a71b0, 0xa0 + +gUnknown_085A7250:: @ 85A7250 + .incbin "baserom.gba", 0x5a7250, 0x3c + +gUnknown_085A728C:: @ 85A728C + .incbin "baserom.gba", 0x5a728c, 0x18 + +gUnknown_085A72A4:: @ 85A72A4 + .incbin "baserom.gba", 0x5a72a4, 0x18 + +gUnknown_085A72BC:: @ 85A72BC + .incbin "baserom.gba", 0x5a72bc, 0x8 + +gUnknown_085A72C4:: @ 85A72C4 + .incbin "baserom.gba", 0x5a72c4, 0x8 + +gUnknown_085A72CC:: @ 85A72CC + .incbin "baserom.gba", 0x5a72cc, 0x8 + +gUnknown_085A72D4:: @ 85A72D4 + .incbin "baserom.gba", 0x5a72d4, 0x10 + +gUnknown_085A72E4:: @ 85A72E4 + .incbin "baserom.gba", 0x5a72e4, 0x8 + +gUnknown_085A72EC:: @ 85A72EC + .incbin "baserom.gba", 0x5a72ec, 0x8 + +gUnknown_085A72F4:: @ 85A72F4 + .incbin "baserom.gba", 0x5a72f4, 0x54 + +gUnknown_085A7348:: @ 85A7348 + .incbin "baserom.gba", 0x5a7348, 0x8 + +gUnknown_085A7350:: @ 85A7350 + .incbin "baserom.gba", 0x5a7350, 0x88 + +gUnknown_085A73D8:: @ 85A73D8 + .incbin "baserom.gba", 0x5a73d8, 0x8 + +gUnknown_085A73E0:: @ 85A73E0 + .incbin "baserom.gba", 0x5a73e0, 0x24 + +gUnknown_085A7404:: @ 85A7404 + .incbin "baserom.gba", 0x5a7404, 0x18 + +gUnknown_085A741C:: @ 85A741C + .incbin "baserom.gba", 0x5a741c, 0x8 diff --git a/data/graphics.s b/data/graphics.s index e89177a1d..bf0e3173b 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -881,10 +881,7 @@ gUnknown_08DAAFEC:: @ 8DAAFEC .include "data/graphics/items/item_graphics.inc" @ 8DB7AA0 - .include "data/graphics/decorations/decoration_graphics.inc" - -@ 8DBA14C - .incbin "baserom.gba", 0xdba14c, 0x3cc + .incbin "baserom.gba", 0xdb7aa0, 0x2a78 gUnknown_08DBA518:: @ 8DBA518 .incbin "baserom.gba", 0xdba518, 0x80 diff --git a/data/graphics/decorations/decoration_graphics.inc b/data/graphics/decorations/decoration_graphics.inc deleted file mode 100644 index c7ea9be70..000000000 --- a/data/graphics/decorations/decoration_graphics.inc +++ /dev/null @@ -1,252 +0,0 @@ -gUnknown_08DB7AA0:: - .incbin "graphics/decorations/decor_heavy_desk.4bpp.lz" - -gUnknown_08DB7B34:: - .incbin "graphics/decorations/decor_heavy_desk.gbapal.lz" - -gUnknown_08DB7B5C:: - .incbin "graphics/decorations/decor_ragged_desk.4bpp.lz" - -gUnknown_08DB7BEC:: - .incbin "graphics/decorations/decor_ragged_desk.gbapal.lz" - -gUnknown_08DB7C08:: - .incbin "graphics/decorations/decor_comfort_desk.4bpp.lz" - -gUnknown_08DB7CE8:: - .incbin "graphics/decorations/decor_comfort_desk.gbapal.lz" - -gUnknown_08DB7D08:: - .incbin "graphics/decorations/decor_pretty_desk.4bpp.lz" - -gUnknown_08DB7DCC:: - .incbin "graphics/decorations/decor_pretty_desk.gbapal.lz" - -gUnknown_08DB7DF4:: - .incbin "graphics/decorations/decor_brick_desk.4bpp.lz" - -gUnknown_08DB7EA0:: - .incbin "graphics/decorations/decor_brick_desk.gbapal.lz" - -gUnknown_08DB7EC4:: - .incbin "graphics/decorations/decor_camp_desk.4bpp.lz" - -gUnknown_08DB7F60:: - .incbin "graphics/decorations/decor_camp_desk.gbapal.lz" - -gUnknown_08DB7F7C:: - .incbin "graphics/decorations/decor_hard_desk.4bpp.lz" - -gUnknown_08DB8070:: - .incbin "graphics/decorations/decor_hard_desk.gbapal.lz" - -gUnknown_08DB808C:: - .incbin "graphics/decorations/decor_red_plant.4bpp.lz" - -gUnknown_08DB8138:: - .incbin "graphics/decorations/decor_red_plant.gbapal.lz" - -gUnknown_08DB8160:: - .incbin "graphics/decorations/decor_tropical_plant.4bpp.lz" - -gUnknown_08DB8218:: - .incbin "graphics/decorations/decor_tropical_plant.gbapal.lz" - -gUnknown_08DB823C:: - .incbin "graphics/decorations/decor_pretty_flowers.4bpp.lz" - -gUnknown_08DB8300:: - .incbin "graphics/decorations/decor_pretty_flowers.gbapal.lz" - -gUnknown_08DB8328:: - .incbin "graphics/decorations/decor_colorful_plant.4bpp.lz" - -gUnknown_08DB8430:: - .incbin "graphics/decorations/decor_colorful_plant.gbapal.lz" - -gUnknown_08DB8458:: - .incbin "graphics/decorations/decor_big_plant.4bpp.lz" - -gUnknown_08DB8528:: - .incbin "graphics/decorations/decor_big_plant.gbapal.lz" - -gUnknown_08DB854C:: - .incbin "graphics/decorations/decor_gorgeous_plant.4bpp.lz" - -gUnknown_08DB862C:: - .incbin "graphics/decorations/decor_gorgeous_plant.gbapal.lz" - -gUnknown_08DB8654:: - .incbin "graphics/decorations/decor_red_brick.4bpp.lz" - -gUnknown_08DB86C4:: - .incbin "graphics/decorations/decor_red_brick.gbapal.lz" - -gUnknown_08DB86E0:: - .incbin "graphics/decorations/decor_yellow_brick.4bpp.lz" - -gUnknown_08DB8750:: - .incbin "graphics/decorations/decor_yellow_brick.gbapal.lz" - -gUnknown_08DB876C:: - .incbin "graphics/decorations/decor_blue_brick.4bpp.lz" - -gUnknown_08DB87DC:: - .incbin "graphics/decorations/decor_blue_brick.gbapal.lz" - -gUnknown_08DB87F8:: - .incbin "graphics/decorations/decor_red_tent.4bpp.lz" - -gUnknown_08DB88D8:: - .incbin "graphics/decorations/decor_red_tent.gbapal.lz" - -gUnknown_08DB8900:: - .incbin "graphics/decorations/decor_blue_tent.4bpp.lz" - -gUnknown_08DB89E0:: - .incbin "graphics/decorations/decor_blue_tent.gbapal.lz" - -gUnknown_08DB8A08:: - .incbin "graphics/decorations/decor_solid_board.4bpp.lz" - -gUnknown_08DB8A68:: - .incbin "graphics/decorations/decor_solid_board.gbapal.lz" - -gUnknown_08DB8A84:: - .incbin "graphics/decorations/decor_slide.4bpp.lz" - -gUnknown_08DB8B40:: - .incbin "graphics/decorations/decor_slide.gbapal.lz" - -gUnknown_08DB8B68:: - .incbin "graphics/decorations/decor_tire.4bpp.lz" - -gUnknown_08DB8C40:: - .incbin "graphics/decorations/decor_tire.gbapal.lz" - -gUnknown_08DB8C5C:: - .incbin "graphics/decorations/decor_stand.4bpp.lz" - -gUnknown_08DB8CF4:: - .incbin "graphics/decorations/decor_stand.gbapal.lz" - -gUnknown_08DB8D18:: - .incbin "graphics/decorations/decor_breakable_door.4bpp.lz" - -gUnknown_08DB8DB0:: - .incbin "graphics/decorations/decor_breakable_door.gbapal.lz" - -gUnknown_08DB8DD4:: - .incbin "graphics/decorations/decor_sand_ornament.4bpp.lz" - -gUnknown_08DB8E80:: - .incbin "graphics/decorations/decor_sand_ornament.gbapal.lz" - -gUnknown_08DB8EA0:: - .incbin "graphics/decorations/decor_glass_ornament.4bpp.lz" - -gUnknown_08DB8F58:: - .incbin "graphics/decorations/decor_glass_ornament.gbapal.lz" - -gUnknown_08DB8F7C:: - .incbin "graphics/decorations/decor_surf_mat.4bpp.lz" - -gUnknown_08DB9038:: - .incbin "graphics/decorations/decor_surf_mat.gbapal.lz" - -gUnknown_08DB9058:: - .incbin "graphics/decorations/decor_thunder_mat.4bpp.lz" - -gUnknown_08DB9130:: - .incbin "graphics/decorations/decor_thunder_mat.gbapal.lz" - -gUnknown_08DB9154:: - .incbin "graphics/decorations/decor_fire_blast_mat.4bpp.lz" - -gUnknown_08DB9218:: - .incbin "graphics/decorations/decor_fire_blast_mat.gbapal.lz" - -gUnknown_08DB9234:: - .incbin "graphics/decorations/decor_powder_snow_mat.4bpp.lz" - -gUnknown_08DB92FC:: - .incbin "graphics/decorations/decor_powder_snow_mat.gbapal.lz" - -gUnknown_08DB931C:: - .incbin "graphics/decorations/decor_attract_mat.4bpp.lz" - -gUnknown_08DB93E8:: - .incbin "graphics/decorations/decor_attract_mat.gbapal.lz" - -gUnknown_08DB940C:: - .incbin "graphics/decorations/decor_fissure_mat.4bpp.lz" - -gUnknown_08DB94CC:: - .incbin "graphics/decorations/decor_fissure_mat.gbapal.lz" - -gUnknown_08DB94E8:: - .incbin "graphics/decorations/decor_spikes_mat.4bpp.lz" - -gUnknown_08DB95AC:: - .incbin "graphics/decorations/decor_spikes_mat.gbapal.lz" - -gUnknown_08DB95D0:: - .incbin "graphics/decorations/decor_snorlax_doll.4bpp.lz" - -gUnknown_08DB96C4:: - .incbin "graphics/decorations/decor_snorlax_doll.gbapal.lz" - -gUnknown_08DB96EC:: - .incbin "graphics/decorations/decor_rhydon_doll.4bpp.lz" - -gUnknown_08DB97F4:: - .incbin "graphics/decorations/decor_rhydon_doll.gbapal.lz" - -gUnknown_08DB981C:: - .incbin "graphics/decorations/decor_lapras_doll.4bpp.lz" - -gUnknown_08DB9908:: - .incbin "graphics/decorations/decor_lapras_doll.gbapal.lz" - -gUnknown_08DB9930:: - .incbin "graphics/decorations/decor_venusaur_doll.4bpp.lz" - -gUnknown_08DB9A54:: - .incbin "graphics/decorations/decor_venusaur_doll.gbapal.lz" - -gUnknown_08DB9A7C:: - .incbin "graphics/decorations/decor_charizard_doll.4bpp.lz" - -gUnknown_08DB9B7C:: - .incbin "graphics/decorations/decor_charizard_doll.gbapal.lz" - -gUnknown_08DB9BA4:: - .incbin "graphics/decorations/decor_blastoise_doll.4bpp.lz" - -gUnknown_08DB9CB0:: - .incbin "graphics/decorations/decor_blastoise_doll.gbapal.lz" - -gUnknown_08DB9CD8:: - .incbin "graphics/decorations/decor_wailmer_doll.4bpp.lz" - -gUnknown_08DB9DAC:: - .incbin "graphics/decorations/decor_wailmer_doll.gbapal.lz" - -gUnknown_08DB9DD4:: - .incbin "graphics/decorations/decor_regice_doll.4bpp.lz" - -gUnknown_08DB9EE4:: - .incbin "graphics/decorations/decor_regice_doll.gbapal.lz" - -gUnknown_08DB9F08:: - .incbin "graphics/decorations/decor_regirock_doll.4bpp.lz" - -gUnknown_08DB9FFC:: - .incbin "graphics/decorations/decor_regirock_doll.gbapal.lz" - -gUnknown_08DBA020:: - .incbin "graphics/decorations/decor_registeel_doll.4bpp.lz" - -gUnknown_08DBA12C:: - .incbin "graphics/decorations/decor_registeel_doll.gbapal.lz" - diff --git a/data/pokemon_summary_screen.s b/data/pokemon_summary_screen.s index fc1c79096..ac28d47c5 100644 --- a/data/pokemon_summary_screen.s +++ b/data/pokemon_summary_screen.s @@ -40,10 +40,7 @@ gUnknown_0861CD14:: @ 861CD14 .incbin "baserom.gba", 0x61cd14, 0x18 gUnknown_0861CD2C:: @ 861CD2C - .incbin "baserom.gba", 0x61cd2c, 0x27 - -gUnknown_0861CD53:: @ 861CD53 - .incbin "baserom.gba", 0x61cd53, 0x80 + .incbin "baserom.gba", 0x61cd2c, 0xa7 gUnknown_0861CDD3:: @ 861CDD3 .incbin "baserom.gba", 0x61cdd3, 0x81 diff --git a/data/strings.s b/data/strings.s index 2b88c6d03..90ccad90f 100644 --- a/data/strings.s +++ b/data/strings.s @@ -1517,52 +1517,52 @@ gUnknown_085EA79D:: @ 85EA79D gUnknown_085EA7A9:: @ 85EA7A9 .string "{STR_VAR_3}{STR_VAR_1}/{STR_VAR_2}$" -gText_Decorate:: @ 85EA7B1 +gUnknown_085EA7B1:: @ 85EA7B1 .string "DECORATE$" -gText_PutAway:: @ 85EA7BA +gUnknown_085EA7BA:: @ 85EA7BA .string "PUT AWAY$" -gText_Toss2:: @ 85EA7C3 +gUnknown_085EA7C3:: @ 85EA7C3 .string "TOSS$" gText_Color161Shadow161:: @ 85EA7C8 .string "{COLOR 161}{SHADOW 161}$" -gText_PutOutSelectedDecorItem:: @ 85EA7CF +gUnknown_085EA7CF:: @ 85EA7CF .string "Put out the selected decoration item.$" -gText_StoreChosenDecorInPC:: @ 85EA7F5 +gUnknown_085EA7F5:: @ 85EA7F5 .string "Store the chosen decoration in the PC.$" -gText_ThrowAwayUnwantedDecors:: @ 85EA81C +gUnknown_085EA81C:: @ 85EA81C .string "Throw away unwanted decorations.$" gText_NoDecorations:: @ 85EA83D .string "There are no decorations.{PAUSE_UNTIL_PRESS}$" -gText_Desk:: @ 85EA859 +gUnknown_085EA859:: @ 85EA859 .string "DESK$" -gText_Chair:: @ 85EA85E +gUnknown_085EA85E:: @ 85EA85E .string "CHAIR$" -gText_Plant:: @ 85EA864 +gUnknown_085EA864:: @ 85EA864 .string "PLANT$" -gText_Ornament:: @ 85EA86A +gUnknown_085EA86A:: @ 85EA86A .string "ORNAMENT$" -gText_Mat:: @ 85EA873 +gUnknown_085EA873:: @ 85EA873 .string "MAT$" -gText_Poster:: @ 85EA877 +gUnknown_085EA877:: @ 85EA877 .string "POSTER$" -gText_Doll:: @ 85EA87E +gUnknown_085EA87E:: @ 85EA87E .string "DOLL$" -gText_Cushion:: @ 85EA883 +gUnknown_085EA883:: @ 85EA883 .string "CUSHION$" gText_Gold:: @ 85EA88B diff --git a/graphics/decorations/decor_attract_mat.pal b/graphics/decorations/decor_attract_mat.pal deleted file mode 100644 index 6f188b725..000000000 --- a/graphics/decorations/decor_attract_mat.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -255 230 222 -255 197 197 -246 156 156 -213 115 172 -197 189 131 -246 148 205 -123 82 74 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_attract_mat.png b/graphics/decorations/decor_attract_mat.png deleted file mode 100644 index 16528d9f393ad2658efd5f61b6796e524b731885..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 307 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxQ3E?)^V{ z^xK>{SBuvi-P`-VpAIN&13a-`TY$KkHrw zyF5J-Q2DmYc6*4G-_GmD{;Vj|k~rhmbIUh7>A2?is4B*1at*&GZ+twZI$UYf#GsB!VDxWD_33tQU(D&A+AYBlMD?FfxNxXvZ~j3 zMRhw`CTU*XlC`Bfs5{9p$Wj3)g$#TOX2%2hj3q&S!3+-1ZlnP@TRdGHLnNk__Sy0s zGT>>A&%40m*pY2w-f=RHGu_>*irsD7Ay$Q)oD0E8pN&OMP5yMU?`=A>{iaW6+#Yx| zsT9nyH`R=i*I}CI{^4Nrt!Vm=E>>aFRSI%_g7a=m8t zQ|I+)@t6|m<&|)eTXQN?dT#scznc#2%4wW;bl%l@lXLvehy1(vlJ)FwHRGdu`W{yt s&Xg##xL$Q&(>2?kt!K;QjgQ*fGCU2|kiBqV2_wjJp00i_>zopr0C^U30ssI2 diff --git a/graphics/decorations/decor_blastoise_doll.pal b/graphics/decorations/decor_blastoise_doll.pal deleted file mode 100644 index a4ad56936..000000000 --- a/graphics/decorations/decor_blastoise_doll.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -197 222 255 -131 189 255 -90 139 213 -57 90 131 -213 156 90 -230 189 131 -156 131 90 -98 82 41 -139 90 74 -0 0 0 -0 0 0 -0 0 0 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_blastoise_doll.png b/graphics/decorations/decor_blastoise_doll.png deleted file mode 100644 index 00c55f229e4b92e8f120c578cb39af78c3fe081b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 371 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FkKX&=y!U@p z_f^ZN=Bsm}p6zX((;Sr)q}d(i1yl$D-@bhVGFp{6YJe1DNswPKgTu2MX+X|LPZ!4! ziK(F%_WB(*kZ65q&dfY}u1VmjfKEm6hL~$!s(lf^&8Mgau^AaC7`pb{JakP#(RBNS z-Ao5-KkV!bv6wXfq}{i4iN&d#ffuKU+EeqH({^)qwgv;)_kXa`N!e$)9Ta$-h2+Xt~vCuT-EBm~ch zuzqxN>2G$^o&c{7nef{C!sfn*w`8VF2$Q#1F7bNG>fm*mPwMaL|5{^}s%aV{1PU2X LS3j3^P6B!VDxWD_33tQU(D&A+AYBlMD?F=WO{F)cnjc zX|IH1b5>TCmzNh%9xD)=|2Z8f!B`UH7tG-B>_!@pli=y%7$Pw>Il+OgN5P3hoRPK3 z;lKhG79O`_Zf+hr290bi1%f|xn1l~0II-NVFsbfsY&giuQ4rmdxt^m#pj|krz)-M4 y!oYz?S5sfJT|hHaGgH9OfRT^+k6g=5Hbw?lX^~4OUHD#uT;%EM=d#Wzp$Py>;yDBW diff --git a/graphics/decorations/decor_blue_tent.pal b/graphics/decorations/decor_blue_tent.pal deleted file mode 100644 index e38cb56af..000000000 --- a/graphics/decorations/decor_blue_tent.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -148 172 255 -115 139 238 -65 90 189 -49 57 123 -0 0 0 -197 205 230 -164 164 164 -131 131 131 -90 82 74 -0 0 0 -0 0 0 -0 0 0 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_blue_tent.png b/graphics/decorations/decor_blue_tent.png deleted file mode 100644 index 575b352410675d85ddb97ad49f62c1765868765e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fr>yy3-2Kim zYOkSXHBjd0*=I|ZENO0TjtcSuav|W`w{Jj(V*ddhAjMb`IGe(rTTq4?z1wTruT=9k<*mVPO7;qp?UFYXWYd{k%l z+Ny1`PgB13tftFo!iRXz_-~BsgM%L|Ij0y3@~5Y( KpUXO@geCw*tbV%y diff --git a/graphics/decorations/decor_breakable_door.pal b/graphics/decorations/decor_breakable_door.pal deleted file mode 100644 index 85ece26dc..000000000 --- a/graphics/decorations/decor_breakable_door.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -139 189 255 -106 156 213 -213 189 115 -156 131 41 -123 98 8 -90 74 57 -189 164 74 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -246 246 246 -197 197 197 diff --git a/graphics/decorations/decor_breakable_door.png b/graphics/decorations/decor_breakable_door.png deleted file mode 100644 index 01ba82d28a09d169f52be1765db7262dfc46372e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxPa$|Fh;? zy}Gw}PP1lp5=WGm<=!P;Kyf(u_U+rzqeodpM0J5ej3q&S!3+-1ZlnP@6FglULnNl= zp5M#cV!*?iu>L{Y<+Be(BNT<+nhGjkIPAG)%FPd2mzF90aA$kk((ONS(sb;TM zXw&=_yTDuF!utDv`t?n7+rlNaD&ysm>Ip5cwLxz8 MboFyt=akR{06ej44*&oF diff --git a/graphics/decorations/decor_brick_desk.pal b/graphics/decorations/decor_brick_desk.pal deleted file mode 100644 index 16b581470..000000000 --- a/graphics/decorations/decor_brick_desk.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -255 180 82 -230 139 49 -189 90 16 -0 0 0 -0 0 0 -0 0 0 -197 197 197 -148 148 156 -106 106 98 -74 74 74 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_brick_desk.png b/graphics/decorations/decor_brick_desk.png deleted file mode 100644 index 829e453497ddbd2e0b7d9ad95c5380ef81c1e4d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxQ1)f}V97 z?u`-vvLWE;(W6tQ%*o11^78V6i7`aT1nmWK7)yfuf*Bm1-ADs+dOTemLnNlw_U{&K zG2n5zZrLasFX?h_YCwbVt)?Ta0Sp@_Ydg5!je1smhCzDI$G&U77?$r6U{E)nSX}FC zy~_pyqa+&l$~Dr>%?Mo2bsviD8Z@0>)*mnAQyYO`njxgN@xNA D;RRo; diff --git a/graphics/decorations/decor_camp_desk.pal b/graphics/decorations/decor_camp_desk.pal deleted file mode 100644 index 0ac362c8a..000000000 --- a/graphics/decorations/decor_camp_desk.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -205 189 123 -172 156 90 -148 131 65 -123 98 32 -82 57 41 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_camp_desk.png b/graphics/decorations/decor_camp_desk.png deleted file mode 100644 index b40429229a2b1b6377837b0d8b768d397c482166..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 265 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F&+e^WGbd_F zvtxCVLXf2wUQtVc^uvO%NQJ6w(>ke&0>5rddTAM;vJ`mPm zU0fD-Uz%g*-o{@i8uoESZ?69Nx>d4KJhdfmLgBpAYIeV-%wu2hg-dtw*Vxc>o;2c0gB_YLuFAYU2y(lptDnm{r-UW|$MIYF diff --git a/graphics/decorations/decor_charizard_doll.pal b/graphics/decorations/decor_charizard_doll.pal deleted file mode 100644 index 3e3e6bb79..000000000 --- a/graphics/decorations/decor_charizard_doll.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -238 172 98 -255 205 74 -222 156 41 -115 74 24 -164 98 24 -0 0 0 -230 82 65 -180 49 32 -0 0 0 -0 0 0 -0 0 0 -246 246 246 -255 238 197 diff --git a/graphics/decorations/decor_charizard_doll.png b/graphics/decorations/decor_charizard_doll.png deleted file mode 100644 index ffc3dfcef7b512e93dd7104f91e717dbfdd76a82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxLHXlK!9d zx;IC&*h^wbk_1rXS&-uvLj@oM0=|9w_W#{cUuBu+Kt5whkY6x^!?PP{K+bJX7sn8Z zsk!G3vzQG9STC$k%g!}ivYB7;1ZT=p6Xt(LI}ErdhAiPe(!SAJTyswJ(i4n4mJV)Z zK0y%++EtdUmwfQAz)U^agK3J!{^j>7J+!z20}b4oRr{s*6XI5AQhgG~4v>4eOs~&rDM44}aA?_FC7@UWi|D&m);bGEz+n?Ew#?i~mbP0l+XkKQxJx= diff --git a/graphics/decorations/decor_colorful_plant.pal b/graphics/decorations/decor_colorful_plant.pal deleted file mode 100644 index 996b183d2..000000000 --- a/graphics/decorations/decor_colorful_plant.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -205 180 115 -180 139 98 -131 90 57 -156 222 90 -139 189 139 -98 148 98 -41 90 57 -106 189 255 -255 123 172 -255 213 74 -0 0 0 -238 238 238 -0 0 0 diff --git a/graphics/decorations/decor_colorful_plant.png b/graphics/decorations/decor_colorful_plant.png deleted file mode 100644 index cc0efecc7461945f36207b1333691ed8fcecfb2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 371 zcmV-(0gV2MP)>w2NYcS~;BFT8q7lVw7SjS~+UH|Nnce|J6zW008dp?f?J)fCl?%00001 zbW%=J06^y0W&i*H@kvBMR2Y?AkTGt;FcgM=k8F-qxo{3nPzi3p1+uh4Oe}R;x-iAw zUl(x!rdS)Jm{my!sOB!VDxWD_33tQU(D&A+AYBlMD?Fx7_RQ-rF73 z9ib~XgS6>JD)YH|^Wt~$(69C-{ Bd-4DP diff --git a/graphics/decorations/decor_fire_blast_mat.pal b/graphics/decorations/decor_fire_blast_mat.pal deleted file mode 100644 index ea2301df2..000000000 --- a/graphics/decorations/decor_fire_blast_mat.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -255 180 82 -238 148 41 -213 98 24 -139 65 41 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_fire_blast_mat.png b/graphics/decorations/decor_fire_blast_mat.png deleted file mode 100644 index 510675ee62365ac87e8c4f3e242318fc9a7b7db5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 287 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxQ1)g5FKh zyqYA@?WhUl;sSG*m(~I07)yfuf*Bm1-ADs+=6bp~hDb~eop6x1#ej#!m;J*7smSF` zFxop*lcM!$XacMIElwgbFB zxmP=EZVFk}zg95arT>+^n{7mKB=ccu7nSH$&5U=}R!T(|vNPKpKVW_7Mpv|Opqv0Z zb4Api%VBpCRm>y#;%Dx6b1M>d-e+{(e#W`hiFZ;e?Vi2=$=t9(BTghVbUnyNp00i_ I>zopr01)G1-2eap diff --git a/graphics/decorations/decor_fissure_mat.pal b/graphics/decorations/decor_fissure_mat.pal deleted file mode 100644 index d2a4efb6d..000000000 --- a/graphics/decorations/decor_fissure_mat.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -205 189 131 -189 172 106 -156 139 74 -123 106 41 -98 74 32 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_fissure_mat.png b/graphics/decorations/decor_fissure_mat.png deleted file mode 100644 index 6de66ef9d6b8a03746a29b989a64a1f5e75294d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F&+cvByC!Q+ zw^wzRW|EfzP!bpL{oR}llw&Lj@(X5gcy=QV$XVd&;us<^HFUy3-a`gFuJ!tJRvux= zi%<|_ez1dC#C6W;#=qeQe!Au+Yx-~8FY=nz;=1~|0A}-U?~@0%XOt}ZUn3J9@|{)f zk-^z*iPNebi{|_FujTb_j%WUrGb4Fc@R#YY+72#ZGb!zm41VW3iDk2$%w)H!2IFOS zUjJi@6Y^emrxD2BEqSqb+HC!^yBA$l^oXDJnZIw5;N6U!Z=TiuW%zMSts*PH`!>i^ Mp00i_>zopr08^%Ed;kCd diff --git a/graphics/decorations/decor_glass_ornament.pal b/graphics/decorations/decor_glass_ornament.pal deleted file mode 100644 index 1027a9501..000000000 --- a/graphics/decorations/decor_glass_ornament.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -0 0 0 -189 230 255 -156 197 255 -115 164 238 -82 139 189 -57 98 131 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -238 246 246 -0 0 0 diff --git a/graphics/decorations/decor_glass_ornament.png b/graphics/decorations/decor_glass_ornament.png deleted file mode 100644 index fcc895eb9f0b622bdd5f0bf63de4ba3f4b279dca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl7C`|SUm zqyLMSybJ2yYnjvx5rmWPzI_9-BPO5Q52P4Ng8YIR9G=}s19BF5x;TbNOwH{-$aTm- zz-764KkpTOA+ri$uDe%Ow>MpvOIpVz_Isi2cj-I1B^O^g+~YfGi%Tw-}D$wh9 z&c|Fv?b8e!^A9zNTMF+VbbVABktrd%WLy1S(fX?CyW2za0uAI1e@Fxbp3Ydot5Evn zXl0+QMXOzTjA**+T8o+5_TAHd9JJffblO{UX`G;{ooSFKi&&~f;JxT$@1(aL+-p5w Whf#g1yiRN>$Tyy@elF{r5}E)d=VuWB diff --git a/graphics/decorations/decor_gorgeous_plant.pal b/graphics/decorations/decor_gorgeous_plant.pal deleted file mode 100644 index 782b82eef..000000000 --- a/graphics/decorations/decor_gorgeous_plant.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -180 222 139 -139 180 139 -90 139 106 -49 82 41 -0 0 0 -148 115 82 -115 82 24 -0 0 0 -230 230 230 -164 164 164 -106 106 106 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_gorgeous_plant.png b/graphics/decorations/decor_gorgeous_plant.png deleted file mode 100644 index dc8639c65719314c01888a632ea76484553f2fbc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 332 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fx7_RQ-qIb_ zon;uL36z;q98?@60c1RT_H4(f%)3^gO_b^{s^5Ear3)wrewzGN{PkVH1Yu=q#OXoO8TJy57D)LRmE04Q;+{=6G1lH(r zYK9+*k)0;AFrqOs({}qeagN6pJUaZdMYnGCs;ktVa#rzj%$ok)rg!!oS{1cKtaM4G z%hlUCmX|&;Wu2dDare_hsfS5=$LD@1+`j+0`;)o%FTd>e7muE(`&W8dbY1*oBc6W@ XH~ck^{j)2d1@f$?tDnm{r-UW|7@LZd diff --git a/graphics/decorations/decor_hard_desk.pal b/graphics/decorations/decor_hard_desk.pal deleted file mode 100644 index 7aa8154ab..000000000 --- a/graphics/decorations/decor_hard_desk.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -197 197 197 -156 156 156 -115 115 115 -98 98 98 -74 74 74 -139 139 139 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_hard_desk.png b/graphics/decorations/decor_hard_desk.png deleted file mode 100644 index aa0c7feeacea2b5796fb4adb9e3876d9c0625b8f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fj~+cbXU?4B z;^L&FBrh+o?(S}&JXUab=}ZTp1Y=2%UoeBivm0qZ&S6g%#}J9BvHb`6nhXS7+MDO8 zy4fvod2ggz!yvIH?RKKHKQfk(p*W$&1CKguDVrQ zR_H$8q-I+alc#(~TaaJWrrxz^;ZQ54B!VDxWD_33tQU(D&A+AYBlMD?Fw`@5&Wy+kW zsHp#2f}V979*yFN(gdlmuC8`;bj->s2C^X_)A{FnAd9gi$S;_|;n|HeAg9aI#W6%; zYI4E>CJ9znR!NE8=}Q?qj~?Uc(K~kR#uP)2rYlPs8Ji6S95`fNu}ECn)Wa&#v(}+y zV>bhHvRHs&7*mewjiRMX7ka2AD<7EF&crxjw-19g<0he;%8V&O7w%oYeOgi?rHq?t z?@L_<<%W08%ugK{J}T4&#O-x&a4h)lxIi(QC4psGA;Yl-?TNyl>p=fS?83{ F1OPY{SLXl# diff --git a/graphics/decorations/decor_lapras_doll.pal b/graphics/decorations/decor_lapras_doll.pal deleted file mode 100644 index c7d2fe61a..000000000 --- a/graphics/decorations/decor_lapras_doll.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -189 230 255 -115 180 246 -74 139 189 -32 90 139 -0 0 0 -0 0 0 -246 197 131 -222 156 98 -197 156 123 -106 74 41 -0 0 0 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_lapras_doll.png b/graphics/decorations/decor_lapras_doll.png deleted file mode 100644 index 517553a4a9fdda370ac01ffc620164080ff1fddb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxNxX{ugig z=GDDdA*vh51%hu!oA1p@Iy$F1%S#i){q_w=a$SlA>18Yl@(X5gcy=QV$hqz5;us<^ zHMD@~o&f)4a4g-3V!PC{xWt~$(695!GlzadH diff --git a/graphics/decorations/decor_powder_snow_mat.pal b/graphics/decorations/decor_powder_snow_mat.pal deleted file mode 100644 index 9f365a3da..000000000 --- a/graphics/decorations/decor_powder_snow_mat.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -238 238 246 -180 205 255 -131 164 205 -197 222 255 -213 238 255 -98 131 172 -148 180 222 -49 82 123 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_powder_snow_mat.png b/graphics/decorations/decor_powder_snow_mat.png deleted file mode 100644 index 82dbbfa668a651dde56af7e89fa09088815347ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F-@W^`vM*W2R1?m|Ik97-hf9gGe%iRas`{8IcBrA< zuq$Vtx^Td=*zKo`d_5VyB&{uF;`i8)&hd^v%AWzV2T7EA8_i k{#DgkPuluZf6bDA&HJKL%lW@uX*zopr0M34Sr2qf` diff --git a/graphics/decorations/decor_pretty_desk.pal b/graphics/decorations/decor_pretty_desk.pal deleted file mode 100644 index 7681a17cc..000000000 --- a/graphics/decorations/decor_pretty_desk.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -189 222 255 -156 197 255 -0 0 0 -131 164 246 -49 82 123 -0 0 0 -0 0 0 -0 0 0 -180 180 180 -131 131 131 -90 90 90 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_pretty_desk.png b/graphics/decorations/decor_pretty_desk.png deleted file mode 100644 index 5be05ebcbfb8e625a5b9a0f97281a7265f12b91e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxNx<{?9r3 zAINB4^35=)8pwcvEnBuUH#bK`MSc7B4JfieqnaN`F_r}R1v5B2yO9RuEc0}643U_c zJHe2T$&iP|oWEnr>xZIlQ!+c&JrQ0o<hdqdReP*&2$p%)V==eTFVvb3I2>08ah^PN9ScYSKrvS zo;xRl{dQXQTc*=DFUT4GiD6i-S1V{+toFynX5Eoji=JN4nQ_|dqv@8zYYy9crg|!^ jJy)Zs##S-!cV+}bPKHyJ-A<9eAb)wf`njxgN@xNAK1guQ diff --git a/graphics/decorations/decor_pretty_flowers.pal b/graphics/decorations/decor_pretty_flowers.pal deleted file mode 100644 index c3b0ffce9..000000000 --- a/graphics/decorations/decor_pretty_flowers.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -0 0 0 -205 180 74 -156 139 32 -90 74 49 -123 106 41 -115 180 98 -74 123 57 -41 82 32 -255 205 180 -123 74 49 -238 156 139 -246 246 246 -222 197 197 diff --git a/graphics/decorations/decor_pretty_flowers.png b/graphics/decorations/decor_pretty_flowers.png deleted file mode 100644 index b9fc0f5de24e131df4f635e4bf2d3d4f01b3a0f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl5MyTxlx zw?dScVRe>f@s=d7YD>)^h5u)_RC^h|o74U6+qZj1kN#LTX){nMV@Z%-FoVOh8)-n! z9#0p?5Q(X|{kD8f4k9h>_ma#nzVP~>7j{i#wfcm6F8m4Gv)#9s8{Ru`fK{R8p2Hi@ zFu709&x^$0%ei;vG}Bs{L#y1AW1Fr=H++=(Ih8Rr>TnpJbC`?eq#t>Lwt0sCI)fI7 zXtX{*?-aaWfupD^;hve+WeMSE)q>4QocbG?(hrJm31YjI(Hzji#A+ISEq1qnQ_~{z zvsTtM%Vx7#UwdQl-O%>!wHtEg)h84t%B!VDxWD_33tQU(D&A+AYhlMD?F-`!ht^=S8& zC0SFNy{eN8gB%rr@>s#F@B6!f5{xB5e!&b5&u*jvIrW|{jv*3LYy0=|wi@uX=wHo# z+r@Z~t%dglS0b|yH}9JBs)Ai2b?YqVKKZOJT`_6ZAzsA;fA{LYT)K=y#3uBTbl>H` z8?Tox@yffL!X}=4B!5|G(c~T{pS?L#@2G69^qrb=nd?oAbNL6Q?I%*T-kz15FaKxS j%|q<{y%S>fc0cy}SE`==bK|sWAP0N8`njxgN@xNA!I)f9 diff --git a/graphics/decorations/decor_red_brick.pal b/graphics/decorations/decor_red_brick.pal deleted file mode 100644 index f9d647dda..000000000 --- a/graphics/decorations/decor_red_brick.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -238 123 123 -189 74 65 -148 32 32 -123 16 16 -106 106 106 -74 74 74 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_red_brick.png b/graphics/decorations/decor_red_brick.png deleted file mode 100644 index 3481044ddeca9ad4ae0660ce7ac760dd2097dd07..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F-&I%d^>Un| zpinI!kd>9?<>dvG#|lD|!#aQxj3q&S!3+-1ZlnP@37#&FAre!Q6CBuj6r4E38Cjbg z4lH0{;c+|W=H{Ve(8$J8AoxRvN%)Y06U*HSlj`2ahJ&me1<@^;>p40E+J%z}3B!VDxWD_33tQU(D&A+AYBlMD?F?-f_?^$O}% zPzX{G0Lm0E$#Sf=lnBxUvd^wbno}K=6=Vry1A*_%_8&lsu_VYZn8D%MjWi%haGCC+|Ipd<2=CW zF0hb8iD#m2lLYspsm&3S3OG4CS|)c*=4$T9?$ADb#kiVD(ki*{T*8VOn>Wu*bbH_H z*Y>HeuZXSl<j!OyQ<{GWKb&TMNHxHwgI#8ihW6ot^zZLB^E8#e=Q27m&$4); p~!F%@Dq?%JYD@<);T3K0RRHaXrKT9 diff --git a/graphics/decorations/decor_red_tent.pal b/graphics/decorations/decor_red_tent.pal deleted file mode 100644 index 61951623b..000000000 --- a/graphics/decorations/decor_red_tent.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -246 123 123 -222 90 90 -180 49 49 -115 49 57 -0 0 0 -197 205 230 -164 164 164 -131 131 131 -90 82 74 -0 0 0 -0 0 0 -0 0 0 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_red_tent.png b/graphics/decorations/decor_red_tent.png deleted file mode 100644 index 22e435691ce33c3c507181063a2833dec72d321e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fzg1V?i;CJ} zXjp7$36wc{_SuppOPZUTqk_DETnPB~?HiC0_Kmp_NHLZK`2{mLJiCzwyUv6+k@!~tDCEstaoNsG2Wi?Dr_Mme~`vI-6KmUFNl?qsou2f3D3XvjGBJ` z4!g^>{BIRFtE3W9`rwU$tiu7FnfWSCe2Uk<_uVV~yQF$foX69tv+i>rtYBJ~I%|UF z4BKa{UaqHB#9I|?N%*WVH~iLh|L$c|>nxK6`?I&*k!g20D=Ascd|g~XOUmQTBc6;2 zlFp7T!c%)DT-smf@S>lG)9Z8zuZh93C&58KtSoDpJ~28?4vIWKjT;m!44$rjF6*2U FngAV#cjf>9 diff --git a/graphics/decorations/decor_regice_doll.pal b/graphics/decorations/decor_regice_doll.pal deleted file mode 100644 index 39404f681..000000000 --- a/graphics/decorations/decor_regice_doll.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -238 238 255 -180 189 205 -139 148 172 -82 98 115 -115 123 139 -0 0 0 -0 0 0 -246 180 65 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_regice_doll.png b/graphics/decorations/decor_regice_doll.png deleted file mode 100644 index 88a28df6ddea203dffeb5ed6beb6c31aacb3cab3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 346 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxLI`{%_fP zwtLE&prqpB>TaM25PaL>2w}iU$-Vi$Kn`O`kY6x^!?PP{K+X+M7sn8Zsi6~m^I8me z-1g^0s7oEPb@RNb%u}s$#!A^k?}AtH!iV$z25I@eJ~~t^ezIsuu(?`A>Sj{OAgB!VDxWD_33tQU(D&A+AYBlMD?Ffjl7CvLvax z*f7Wo#64RaG{q65ZLgOENDc-jUrvkwvKdQ){DK)Ap4~_Ta!z`>IEF|}jqP{jYBmsX zt0p3gcHe^*{8Res{_2h}|}T<>uxeSGt5)$L!Ku4dkRs}pnY#`e|AuP&NnK4s=S{rT^XTwpj@ zF0#BM#H(?`0#~l0NphC`!k>zR&Ik)m$<3-%DdUlH-<9qEx1?Kaad5Zep45Gf!i$~H zmMS;>JNRPW4-UC6c8jGy3$L7Mdu3-qLl*Pz-w(FlI=OY;mHId7`?}@5kC=QtZD{-j OB!VDxWD_33tQU(D&A+AYBlMD?FfxLI`-W@%9 zbjgw>)z!^GK~X>vWUwa45yD-!r))Bi#aI&L7tG-B>_!@pbJx?wF+^gjZ~xh@W(R?m z)85~*7WbVORGYB*OoRRg`}CVR)m$30W(LPy-g7R@z06bIPHNYRS4?rw&u+LO)S)EA zTbNO@U;dfW!`~Wm|7?Ujr_28RYLyfs8-Hfr?)f~ng|9j!ydCQ29NkgAV48H`$B-pc zHE@FK0Hh0*DZF%PcY@$#7`zuxBlAgKotf?NGXrY9L%g_5oX1fcvB!VDxWD_33tQU(D&A+AYBlMD?F@7=q%WXY1f zd-ryCcV}f~1qB5?J6gPVidS=z7f>MteEaqd$e1b0_!&qsmIV0)GdMiEkp|?v^>lFz zk(lZ`VPoDQ0}Nz{C0C;G_Ok2T=hA)%xSjZ<B!VDxWD_33tQU(D&A+AYBlMD?FfxN3n=j>e) zHKp1x%1fd-OJU6vFQ6bMuEak7F*Wy`Enl+%59>6ysdTZUgi~YU-?+Xh%PpUYcpZUN^rgGg*)pz&yFP!VGu!_t2YLD?Tg;evi zteVr=bWVC~wY#jk{f_XZMQ0yQiWlAK!8djGnTe;kd5WE7pVsYutNws_*DaOsQ*|jI PFEV(#`njxgN@xNAPh4lH diff --git a/graphics/decorations/decor_slide.pal b/graphics/decorations/decor_slide.pal deleted file mode 100644 index 395694fa3..000000000 --- a/graphics/decorations/decor_slide.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -148 189 238 -106 148 205 -65 115 172 -180 222 255 -0 0 0 -0 0 0 -0 0 0 -213 213 213 -189 189 189 -156 156 156 -106 106 106 -0 0 0 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_slide.png b/graphics/decorations/decor_slide.png deleted file mode 100644 index 8a5dbada5b0a905c0efc85f4eee3bdfaa6c73b51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 293 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fr|f-~HRY^h z@tQ67{sUzo;Of<@d-v|0GiOd#Ru)j?+qZ8(Qpjt?B_PFE666=m;PC858j!Qt)5S4F zVruIIL%u@>Jg#T&HJ-Wa6{#Hhl*wdfvH39$zX{R`Vqq>v6)$aCIH&Rbu@I+*ABQh@ zr`{~;P+@(1%*f!Fzk;n3r($=??(nO#lDsB9N|^k`@RFnff5IOoo~O?aon6-0n*Ju; z`ibnVSZ1CAsSo>jO01?O{blvAF?sWk$ys;t-^3-KI4?KOUbiVFeA%(hVzaZjChpU{ jV5V<;HriMBY4v>3u7C%tmL1;%bS{IZtDnm{r-UW|Oy6|$ diff --git a/graphics/decorations/decor_snorlax_doll.pal b/graphics/decorations/decor_snorlax_doll.pal deleted file mode 100644 index 21026b10d..000000000 --- a/graphics/decorations/decor_snorlax_doll.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -0 0 0 -131 139 164 -82 90 115 -0 0 0 -255 238 222 -255 197 148 -222 156 90 -139 90 49 -172 106 49 -230 172 123 -0 0 0 -238 238 238 -189 189 197 diff --git a/graphics/decorations/decor_snorlax_doll.png b/graphics/decorations/decor_snorlax_doll.png deleted file mode 100644 index 6ff891c13674fac1bcf1df2debc864ca6c90a1fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 337 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl5+?p_iU zRSabOe|PWy(JA-lM0H0QuE{cdwx${=`0m}iy?c*7YB^L7>5`2{mLJiCzwjr1sapoV7 zelh><>i6V`H#(qxZh~ad>P3lJSNYFKyjUPGQ^DYZfXE`P3s(ad`WQdwb#~6|2-Cl( zv7e#EI_5=j_CYr}%lZ9mZ#*AmyLEi|u;R70->QDM|Hu7GJCB%jI6YM?@U&Z~*B!VDxWD_33tQU(D&A+AYBlMD?FfxNv-lIAo! zR!3=OMR@_axPZf}cXmKI#*!evUP>5#xAnMr37Cgn6aI$UYw5NA{nWK#0kAn-%SNo~W;#;FHV1v$TU9bj%^TrHd6 q-@KQfkE6p%r>w!2_uD=NoeIXkI~2@$f1BB!VDxWD_33tQU(D&A+AYRlMD?FfxIb4r(~@u z4w@3xJtyhj+3qb%lFsgJHcYYvN+AQ`)RneCK4VFcUoeBivm0qZ&Kge_#}J9Bp%V=G z4jBlrOrO@}@#o1I<_nP>W?kA*Qgs6M3WxqV2DLTS7sV-egnv49Z*ra~+qSBkH(56? zzTqlbv3ud3JLUIEwVS@%y66N8wpNJ7dq2s z5}ySnPb)li&vH3yVUJ+uOyNl@@69MY6?av-KwNufRPr&+YHh)r9+8!v_c~lsR!?c2 l{^U>deh(M3y!Z7_*4jNWv^te#B4-Bjl&7no%Q~loCICiybp`+c diff --git a/graphics/decorations/decor_stand.pal b/graphics/decorations/decor_stand.pal deleted file mode 100644 index a85f0b7b2..000000000 --- a/graphics/decorations/decor_stand.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -255 180 156 -238 115 106 -197 65 65 -0 0 0 -0 0 0 -0 0 0 -197 197 197 -172 172 172 -131 131 131 -106 106 106 -0 0 0 -0 0 0 -246 246 246 -0 0 0 diff --git a/graphics/decorations/decor_stand.png b/graphics/decorations/decor_stand.png deleted file mode 100644 index 86b1e4d1fea56b15a539b02b2bb4cef01a293da1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 264 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F|8JS|t~l$c zqa#ol0*)R%x@OIq=H}+CtSpGgw{PEo48zu2Q9z2ZB*-tA!Qt7BG$5zV)5S4FVrp-% zAs3UO2&;POtO~Yj?#s_>82uN_OW5wUlEtP+v$dY>{yQa|NlL-CCsORbeAs&EG*78bmC zjoBNQ##ioDT)V)-Vd949you}_58P~?9%}f;`g>B~XCXC~NRV?qUHx3vIVCg!05Te6 Aw*UYD diff --git a/graphics/decorations/decor_surf_mat.pal b/graphics/decorations/decor_surf_mat.pal deleted file mode 100644 index 17be591b7..000000000 --- a/graphics/decorations/decor_surf_mat.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -205 238 255 -164 205 255 -148 180 255 -115 148 222 -57 90 156 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -246 246 255 -0 0 0 diff --git a/graphics/decorations/decor_surf_mat.png b/graphics/decorations/decor_surf_mat.png deleted file mode 100644 index d74cb97bb951238e731ba18577f5230c92fdbd93..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 298 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxNTt{x3QE zf6A8s#Z&HCM$G|=pn-4S{sTpvKScTiDaMi@zhDN3XE)M-oE4rfjv*3Lb0;`*9WoGc zS#F-;@YYpm`c0G4o4(%}9e3-nEEQkpx&Gmk=&i2oMn0dM+r$%ekB0Va*_*nf%;Bl> zhS_h7!dD%+@tyJTV&54$?8}U0Yo6HNtP4%!z8Tc_%;&T5AfI`<`njxgN@xNAheUJ= diff --git a/graphics/decorations/decor_thunder_mat.pal b/graphics/decorations/decor_thunder_mat.pal deleted file mode 100644 index fbe488860..000000000 --- a/graphics/decorations/decor_thunder_mat.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -0 0 0 -0 0 0 -189 222 255 -172 205 238 -139 172 205 -139 156 164 -255 230 123 -90 106 115 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -238 246 255 -0 0 0 diff --git a/graphics/decorations/decor_thunder_mat.png b/graphics/decorations/decor_thunder_mat.png deleted file mode 100644 index 1c5c56e332eb5f415a253384250666829a8fddfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 315 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl7Cd+-06 zv+ugsob8^oAF^Gfz+d^yEg+8u17A{MJ*= zW4c5qGo3fO?fW@B?z-}yO*|T_xaU~8`WPm@+ATTPi_GrCwFRx2z2~m~ zJ>L~xZ+PBiUDyzQ?eUcA%^oh=HwBs;bS6w-wcNtnw59O2^>6D7s?nELE53}|cwF;) zo?FS{r_a1UJ7>6`!w%h{YHGIr-k+2a%3zOoSHzJ;C7V>gTe~DWM4f@ZNtl diff --git a/graphics/decorations/decor_tire.pal b/graphics/decorations/decor_tire.pal deleted file mode 100644 index 18a3279fc..000000000 --- a/graphics/decorations/decor_tire.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -0 0 0 -238 238 238 -189 189 189 -164 164 164 -131 131 131 -98 98 98 -74 74 74 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_tire.png b/graphics/decorations/decor_tire.png deleted file mode 100644 index e394ebbd401f02ba167b8d4e970bd9c1d01898fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlYq>3@80d*yLZWw zCC$yvNl8gwUS2>!tl-1jCDlL)#*!evUmY~R!a|FW}55rNy%gV{r}rSmv~2N zdTK}spZGF)VMeaSG|dFo%UUP8U#PCU^^eW&0MiLm*@lYtjWJz)IrfoV*V7lAyfu%j z_~yH?JHfL$_a^UJ_@6OFA=Krd3=7X^#`4)ZXRlahY=3W?o*=jFS=QY0$J_o098dm_UTRq-6UiWg_+lSjh-t%B!VDxWD_33tQU(D&A+AYBlMD?FkFE(?(rwtB zB@pB&0F(iODfgnXwitRfODIH1Ktv$qbfGyiKo(<3kY6x^!?PP{K+Z-_7sn8ZslENS zd`%7lt@5p+XY&?yZYf|^Vps6UXNsdCXH+RGCm#8H z&$Wl+m=t%uZ~wWSEJ-|9EcR=72YX++y3zIGHD0Fv@}9(dyE{Jqy}c$s?)8F@RyAMl sH&Z6vcvjh|ar%Vwsrx%G+ov61zmTi$_kFjdQKoCSnm5VgDU~GIb`3nDl@!Epa7OD;A(%K+J zWm>6prQ!SNC}juoqw`A@?i`R-9|*b;F300000NkvXXu0mjfB!VDxWD_33tQU(D&A+AYBlMD?Ffjl6{nzF{L zc#36GwWVX$vn^R?rvz>3wk-D21WH}KdiC44Z%dXe(e3@C4dgSH1o;IsI6S+N2ITDX zba4!kn3_Amkc-Jsz_nhBdp3)UfWLCjN2Wzzo#t#2d-u*#NBkpSRMnKVHizaNIBMU0 zbWz<2<;iFM%w+kYpT1h@8Rv`@f9|wD2<%MZFg;{n>1=kaNx+uxozJ}4pM8YqxU}BR z<1lnNoVfp=#d3>x3zfK*MyzKoTgBe-lUvy(mT}e*XaDTO8@%Oi7d?M?YSwwK?s>{K z>yB*M_;T8PWB%TvvrqQDw~C2BFUH&I(EF+A?6JEu-QTt*7AwEoAOC@E>Ut}`OP$-} QfIeaHboFyt=akR{0CfU`Jpcdz diff --git a/graphics/decorations/decor_yellow_brick.pal b/graphics/decorations/decor_yellow_brick.pal deleted file mode 100644 index cfdd874ad..000000000 --- a/graphics/decorations/decor_yellow_brick.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -98 197 98 -49 49 49 -255 230 106 -222 197 49 -180 156 8 -148 123 0 -106 106 106 -74 74 74 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/decorations/decor_yellow_brick.png b/graphics/decorations/decor_yellow_brick.png deleted file mode 100644 index cb865760ca9c5d2c013db4008a76d769a7dd1fde..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F|3AyRchqpp z9F8f~3|U!OUS3{6d90xQ%JxE_1Y=2%UoeBivm0qZPJ*Y4V~E7mb^*;y%}fD914cgPKXNTM*%%pIrA02Cbm4mqa*?O2pUXO@geCyTemTtm diff --git a/graphics/decorations/unk_85a6bb0.pal b/graphics/decorations/unk_85a6bb0.pal deleted file mode 100644 index 4239a1f5e..000000000 --- a/graphics/decorations/unk_85a6bb0.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -115 205 164 -255 255 255 -98 98 98 -213 213 205 -230 230 230 -197 197 197 -0 0 0 -238 238 238 -197 197 197 -148 148 148 -255 0 0 -180 0 0 -255 197 197 -82 82 255 -49 49 180 -197 197 255 diff --git a/graphics/decorations/unk_85a7308.pal b/graphics/decorations/unk_85a7308.pal deleted file mode 100644 index e7717d74e..000000000 --- a/graphics/decorations/unk_85a7308.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -115 197 164 -255 213 180 -255 197 148 -222 148 115 -123 65 65 -57 74 123 -41 57 98 -24 41 82 -16 32 57 -222 230 238 -255 197 90 -189 156 90 -255 98 90 -197 65 65 -255 255 255 -0 0 0 diff --git a/graphics/decorations/unk_85a7328.pal b/graphics/decorations/unk_85a7328.pal deleted file mode 100644 index e106ce693..000000000 --- a/graphics/decorations/unk_85a7328.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -115 197 164 -255 222 205 -222 164 148 -205 131 115 -123 90 82 -98 98 115 -41 57 65 -164 106 82 -74 49 57 -205 205 222 -255 197 90 -189 156 90 -255 98 90 -197 65 65 -255 255 255 -0 0 0 diff --git a/graphics/misc/decoration_unk_85a7358.png b/graphics/misc/decoration_unk_85a7358.png deleted file mode 100644 index 2dc8ed60474f2fc987469d3c40fd34f6cac9a227..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExa-J@ZAsjQ4e`s*9ed1~Qf6!rq jquik%9{g-~f@T;qy!20=JAwc05|9p0S3j3^P6secretBases[0].decorations; - gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPos; - } - if (gUnknown_0203A17C.isPlayerRoom == TRUE) - { - gUnknown_0203A17C.items = gSaveBlock1Ptr->playerRoomDecor; - gUnknown_0203A17C.pos = gSaveBlock1Ptr->playerRoomDecorPos; - } -} - -u8 sub_81269D4(u8 idx) -{ - u8 *winidx; - struct WindowTemplate template; - - winidx = &sDecorMenuWindowIndices[idx]; - if (idx == 0) - { - template = gUnknown_085A6B90[0]; - template.width = GetMaxWidthInMenuTable(sSecretBasePCMenuActions, 4); - if (template.width > 18) - { - template.width = 18; - } - *winidx = AddWindow(&template); - } - else - { - *winidx = AddWindow(&gUnknown_085A6B90[idx]); - } - SetWindowBorderStyle(*winidx, 0, 0x214, 0xe); - schedule_bg_copy_tilemap_to_vram(0); - return *winidx; -} - -void sub_8126A58(u8 idx) -{ - sub_8198070(sDecorMenuWindowIndices[idx], FALSE); - ClearWindowTilemap(sDecorMenuWindowIndices[idx]); - RemoveWindow(sDecorMenuWindowIndices[idx]); - schedule_bg_copy_tilemap_to_vram(0); -} - -void sub_8126A88(void) -{ - u8 idx; - - idx = sub_81269D4(0); - PrintMenuTable(idx, 4, sSecretBasePCMenuActions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(idx, 4, sSecretBasePCMenuCursorPos); -} - -void sub_8126ABC(void) -{ - sSecretBasePCMenuCursorPos = 0; - ScriptContext2_Enable(); - sub_8126A88(); - sub_8126C08(); -} - -void sub_8126AD8(u8 taskId) -{ - sub_8126ABC(); - gUnknown_0203A17C.items = gSaveBlock1Ptr->secretBases[0].decorations; - gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPos; - gUnknown_0203A17C.size = sizeof(gSaveBlock1Ptr->secretBases[0].decorations); - gUnknown_0203A17C.isPlayerRoom = FALSE; - gTasks[taskId].func = sub_8126B80; -} - -void sub_8126B2C(u8 taskId) -{ - sub_8126ABC(); - gUnknown_0203A17C.items = gSaveBlock1Ptr->playerRoomDecor; - gUnknown_0203A17C.pos = gSaveBlock1Ptr->playerRoomDecorPos; - gUnknown_0203A17C.size = sizeof(gSaveBlock1Ptr->playerRoomDecor); - gUnknown_0203A17C.isPlayerRoom = TRUE; - gTasks[taskId].func = sub_8126B80; -} - -void sub_8126B80(u8 taskId) -{ - u8 menuPos; - - if (!gPaletteFade.active) - { - menuPos = GetMenuCursorPos(); - switch (ProcessMenuInput()) - { - default: - PlaySE(SE_SELECT); - sSecretBasePCMenuActions[sSecretBasePCMenuCursorPos].func.void_u8(taskId); - break; - case -2: - sSecretBasePCMenuCursorPos = GetMenuCursorPos(); - if ((s8)menuPos != sSecretBasePCMenuCursorPos) - { - sub_8126C08(); - } - break; - case -1: - PlaySE(SE_SELECT); - SecretBasePC_Cancel(taskId); - break; - } - } -} - -void sub_8126C08(void) -{ - FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParametrized(0, 1, sSecretBasePCMenuItemDescriptions[sSecretBasePCMenuCursorPos], 0, 0, 2, 1, 3); -} - -void SecretBasePC_Decorate(u8 taskId) -{ - if (CountDecorations() == 0) - { - StringExpandPlaceholders(gStringVar4, gText_NoDecorations); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8126DA4); - } - else - { - gTasks[taskId].data[11] = 0; - sCurDecorationCategory = DECORCAT_DESK; - SecretBasePC_PrepMenuForSelectingStoredDecors(taskId); - } -} - -void SecretBasePC_PutAway(u8 taskId) -{ - if (!sub_81299AC(taskId)) - { - StringExpandPlaceholders(gStringVar4, gText_NoDecorationsInUse); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8126DA4); - } - else - { - sub_8126A58(0); - sub_8197434(0, 0); - fade_screen(1, 0); - gTasks[taskId].data[2] = 0; - gTasks[taskId].func = sub_8129ABC; - } -} - -void SecretBasePC_Toss(u8 taskId) -{ - if (CountDecorations() == 0) - { - StringExpandPlaceholders(gStringVar4, gText_NoDecorations); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8126DA4); - } - else - { - gTasks[taskId].data[11] = 1; - sCurDecorationCategory = DECORCAT_DESK; - SecretBasePC_PrepMenuForSelectingStoredDecors(taskId); - } -} - -void SecretBasePC_Cancel(u8 taskId) -{ - sub_8126A58(0); - if (!gUnknown_0203A17C.isPlayerRoom) - { - ScriptContext1_SetupScript(gUnknown_0823B4E8); - DestroyTask(taskId); - } - else - { - sub_816B060(taskId); - } -} - -void sub_8126DA4(u8 taskId) -{ - sub_8126C08(); - gTasks[taskId].func = sub_8126B80; -} - -void SecretBasePC_PrepMenuForSelectingStoredDecors(u8 taskId) -{ - LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20); - sub_8197434(0, 0); - sub_8126A58(0); - sub_8126DFC(taskId); -} - -void sub_8126DFC(u8 taskId) -{ - u8 winIdx; - - winIdx = sub_81269D4(1); - sub_8126E8C(taskId); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(winIdx, 9, sCurDecorationCategory); - gTasks[taskId].func = sub_8127088; -} - -void sub_8126E44(u8 taskId) -{ - FillWindowPixelBuffer(sDecorMenuWindowIndices[1], 0x11); - sub_8126E8C(taskId); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDecorMenuWindowIndices[1], 9, sCurDecorationCategory); - gTasks[taskId].func = sub_8127088; -} - -void sub_8126E8C(u8 taskId) -{ - s16 *data; - u8 r5; - bool8 r8; - u8 i; - bool8 fl; - - data = gTasks[taskId].data; - r5 = sDecorMenuWindowIndices[1]; - fl = gUnknown_0203A17C.isPlayerRoom; - r8 = FALSE; - if (fl == TRUE && data[11] == 0) - { - r8 = TRUE; - } - for (i = 0; i < 8; i ++) - { - if (r8 == TRUE && i != DECORCAT_DOLL && i != DECORCAT_CUSHION) - { - sub_8126F68(r5, i, 8, i << 4, TRUE, 0xFF); - } - else - { - sub_8126F68(r5, i, 8, i << 4, FALSE, 0xFF); - } - } - PrintTextOnWindow(r5, 1, gTasks[taskId].data[11] == 2 ? gText_Exit : gText_Cancel, 8, (i << 4) + 1, 0, 0); - schedule_bg_copy_tilemap_to_vram(0); -} - -void sub_8126F68(u8 winid, u8 decorCat, u8 x, u8 y, bool8 flag, u8 speed) -{ - u8 width; - u8 *strbuf; - - width = x == 8 ? 0x68 : 0x60; - y ++; - sub_8127058(gStringVar4, flag); - strbuf = StringLength(gStringVar4) + gStringVar4; - StringCopy(strbuf, sDecorCatNames[decorCat]); - PrintTextOnWindow(winid, 1, gStringVar4, x, y, speed, NULL); - strbuf = ConvertIntToDecimalStringN(strbuf, CountDecorationCategoryN(decorCat), STR_CONV_MODE_RIGHT_ALIGN, 2); - *strbuf++ = CHAR_SLASH; - ConvertIntToDecimalStringN(strbuf, gDecorationInventories[decorCat].size, STR_CONV_MODE_RIGHT_ALIGN, 2); - x = GetStringRightAlignXOffset(1, gStringVar4, width); - PrintTextOnWindow(winid, 1, gStringVar4, x, y, speed, NULL); -} - -void sub_8127058(u8 *str, bool8 flag) -{ - StringCopy(str, gText_Color161Shadow161); - if (flag == TRUE) - { - str[2] = 0x04; // RED - str[5] = 0x05; // LIGHT_RED - } - else - { - str[2] = 0x02; // DARK_GREY - str[5] = 0x03; // LIGHT_GREY - } -} - -void sub_8127088(u8 taskId) -{ - s8 input; - - if (!gPaletteFade.active) - { - input = ProcessMenuInput(); - switch (input) - { - case -1: - case 8: - PlaySE(SE_SELECT); - sub_812719C(taskId); - break; - case -2: - break; - default: - PlaySE(SE_SELECT); - sCurDecorationCategory = input; - sub_81270E8(taskId); - break; - } - } -} - -void sub_81270E8(u8 taskId) -{ - sCurDecorCatCount = CountDecorationCategoryN(sCurDecorationCategory); - if (sCurDecorCatCount != 0) - { - CondenseDecorationCategoryN(sCurDecorationCategory); - gCurDecorInventoryItems = gDecorationInventories[sCurDecorationCategory].items; - IdentifyOwnedDecorationsCurrentlyInUse(taskId); - sSecretBasePCSelectDecorPageNo = 0; - sSecretBasePCSelectDecorLineNo = 0; - gTasks[taskId].func = sub_8127620; - } - else - { - sub_8126A58(1); - StringExpandPlaceholders(gStringVar4, gText_NoDecorations); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8127180); - } -} - -void sub_8127180(u8 taskId) -{ - sub_8197434(0, 0); - sub_8126DFC(taskId); -} - -void sub_812719C(u8 taskId) -{ - if (gTasks[taskId].data[11] != 2) - { - sub_81271CC(taskId); - } - else - { - sub_8127268(taskId); - } -} - -void sub_81271CC(u8 taskId) -{ - sub_8126A58(1); - sub_8126A88(); - sub_81973C4(0, 0); - sub_8126C08(); - gTasks[taskId].func = sub_8126B80; -} - -void sub_8127208(u8 taskId) -{ - LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20); - sub_8197434(0, 0); - gTasks[taskId].data[11] = 2; - sCurDecorationCategory = DECORCAT_DESK; - sub_8126DFC(taskId); -} - -void sub_8127250(u8 *dest, u8 decorCat) -{ - StringCopy(dest, sDecorCatNames[decorCat]); -} - -void sub_8127268(u8 taskId) -{ - sub_8126A58(1); - sub_8133E1C(taskId); -} - -void sub_8127284(void) -{ - sDecorPCBuffer->unk_520 = sCurDecorCatCount + 1; - if (sDecorPCBuffer->unk_520 > 8) - { - sDecorPCBuffer->unk_521 = 8; - } - else - { - sDecorPCBuffer->unk_521 = sDecorPCBuffer->unk_520; - } -} - -void sub_81272C8(void) -{ - sub_812225C(&sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo, sDecorPCBuffer->unk_521, sDecorPCBuffer->unk_520); -} - -void sub_81272F8(void) -{ - sub_8122298(&sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo, sDecorPCBuffer->unk_521, sDecorPCBuffer->unk_520, 8); -} - -void sub_8127330(u8 taskId) -{ - s16 *data; - u16 i; - - data = gTasks[taskId].data; - if ((sCurDecorationCategory < DECORCAT_DOLL || sCurDecorationCategory > DECORCAT_CUSHION) && gUnknown_0203A17C.isPlayerRoom == TRUE && data[11] == 0) - { - sub_8127058(gStringVar1, TRUE); - } - else - { - sub_8127058(gStringVar1, FALSE); - } - for (i = 0; i < sDecorPCBuffer->unk_520 - 1; i ++) - { - sub_8127454(sDecorPCBuffer->names[i], gCurDecorInventoryItems[i]); - sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; - sDecorPCBuffer->items[i].unk_04 = i; - } - StringCopy(sDecorPCBuffer->names[i], gText_Cancel); - sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; - sDecorPCBuffer->items[i].unk_04 = -2; - gUnknown_03006310 = gUnknown_085A6BD0; - gUnknown_03006310.unk_10 = sDecorMenuWindowIndices[1]; - gUnknown_03006310.unk_0c = sDecorPCBuffer->unk_520; - gUnknown_03006310.unk_00 = sDecorPCBuffer->items; - gUnknown_03006310.unk_0e = sDecorPCBuffer->unk_521; -} - -void sub_8127454(u8 *dest, u16 decorId) -{ - StringCopy(dest, gStringVar1); - StringAppend(dest, gDecorations[decorId].name); -} - -void sub_8127480(u32 a0, bool8 flag, struct ListMenu *menu) -{ - if (flag != TRUE) - { - PlaySE(SE_SELECT); - } - sub_8127744(a0); -} - -void sub_81274A0(u8 a0, s32 a1, u8 a2) -{ - if (a1 != -2) - { - if (sub_81277BC(a1 + 1) == TRUE) - { - blit_move_info_icon(a0, 0x18, 0x5c, a2 + 2); - } - else if (sub_81277E8(a1 + 1) == TRUE) - { - blit_move_info_icon(a0, 0x19, 0x5c, a2 + 2); - } - } -} - -void sub_8127500(void) -{ - if (sDecorPCBuffer->unk_522 == 0xFF) - { - sDecorPCBuffer->unk_522 = AddScrollIndicatorArrowPairParametrized(0x02, 0x3c, 0x0c, 0x94, sDecorPCBuffer->unk_520 - sDecorPCBuffer->unk_521, 0x6e, 0x6e, &sSecretBasePCSelectDecorPageNo); - } -} - -void sub_8127554(void) -{ - if (sDecorPCBuffer->unk_522 != 0xFF) - { - RemoveScrollIndicatorArrowPair(sDecorPCBuffer->unk_522); - sDecorPCBuffer->unk_522 = 0xFF; - } -} - -void sub_8127580(u8 taskId) -{ - sub_81269D4(1); - sub_812759C(taskId); -} - -void sub_812759C(u8 taskId) -{ - s16 *data; - - data = gTasks[taskId].data; - sub_81269D4(3); - sub_8127718(sCurDecorationCategory); - sDecorPCBuffer = calloc(1, sizeof(struct DecorPCBuffer)); - sDecorPCBuffer->unk_522 = 0xFF; - sub_8127284(); - sub_81272C8(); - sub_81272F8(); - sub_8127330(taskId); - data[13] = ListMenuInit(&gUnknown_03006310, sSecretBasePCSelectDecorPageNo, sSecretBasePCSelectDecorLineNo); - sub_8127500(); -} - -void sub_8127620(u8 taskId) -{ - sub_812759C(taskId); - gTasks[taskId].func = sub_812764C; -} - -void sub_812764C(u8 taskId) -{ - s16 *data; - s32 input; - - data = gTasks[taskId].data; - if (!gPaletteFade.active) - { - input = ListMenuHandleInput(data[13]); - get_coro_args_x18_x1A(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); - switch (input) - { - case -1: - break; - case -2: - PlaySE(SE_SELECT); - SecretBasePC_SelectedDecorActions[data[11]][1](taskId); - break; - default: - PlaySE(SE_SELECT); - gCurDecorationIndex = input; - sub_8127554(); - sub_81AE6C8(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); - sub_8126A58(1); - sub_81277A8(); - free(sDecorPCBuffer); - SecretBasePC_SelectedDecorActions[data[11]][0](taskId); - break; - } - } -} - -void sub_8127718(u8 decorCat) -{ - sub_8126F68(sub_81269D4(2), decorCat, 0, 0, 0, 0); -} - -void sub_8127744(u32 a0) -{ - u8 winidx; - const u8 *txt; - - winidx = sDecorMenuWindowIndices[3]; - FillWindowPixelBuffer(winidx, 0x11); - if (a0 >= sCurDecorCatCount) - { - txt = gText_GoBackPrevMenu; - } - else - { - txt = gDecorations[gCurDecorInventoryItems[a0]].description; - } - PrintTextOnWindow(winidx, 1, txt, 0, 1, 0, 0); -} - -void sub_81277A8(void) -{ - sub_8126A58(3); - sub_8126A58(2); -} - -bool8 sub_81277BC(u8 idx) -{ - u8 i; - - for (i = 0; i < 16; i ++) - { - if (sSecretBaseItemsIndicesBuffer[i] == idx) - { - return TRUE; - } - } - return FALSE; -} - -bool8 sub_81277E8(u8 idx) -{ - u8 i; - - for (i = 0; i < 12; i ++) - { - if (sPlayerRoomItemsIndicesBuffer[i] == idx) - { - return TRUE; - } - } - return FALSE; -} - -void IdentifyOwnedDecorationsCurrentlyInUseInternal(u8 taskId) -{ - u16 i; - u16 j; - u16 k; - u16 cnt; - - cnt = 0; - memset(sSecretBaseItemsIndicesBuffer, 0, 16); - memset(sPlayerRoomItemsIndicesBuffer, 0, 12); - for (i = 0; i < 16; i ++) - { - if (gSaveBlock1Ptr->secretBases[0].decorations[i] != DECOR_NONE) - { - for (j = 0; j < gDecorationInventories[sCurDecorationCategory].size; j ++) - { - if (gCurDecorInventoryItems[j] == gSaveBlock1Ptr->secretBases[0].decorations[i]) - { - for (k = 0; k < cnt && sSecretBaseItemsIndicesBuffer[k] != j + 1; k ++); - if (k == cnt) - { - sSecretBaseItemsIndicesBuffer[cnt] = j + 1; - cnt ++; - break; - } - } - } - } - } - cnt = 0; - for (i = 0; i < 12; i ++) - { - if (gSaveBlock1Ptr->playerRoomDecor[i] != DECOR_NONE) - { - for (j = 0; j < gDecorationInventories[sCurDecorationCategory].size; j ++) - { - if (gCurDecorInventoryItems[j] == gSaveBlock1Ptr->playerRoomDecor[i] && sub_81277BC(j + 1) != TRUE) - { - for (k = 0; k < cnt && sPlayerRoomItemsIndicesBuffer[k] != j + 1; k ++); - if (k == cnt) - { - sPlayerRoomItemsIndicesBuffer[cnt] = j + 1; - cnt ++; - break; - } - } - } - } - } -} - -void IdentifyOwnedDecorationsCurrentlyInUse(u8 taskId) -{ - IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); -} - -bool8 IsSelectedDecorInThePC(void) -{ - u16 i; - for (i = 0; i < 16; i ++) - { - if (sSecretBaseItemsIndicesBuffer[i] == sSecretBasePCSelectDecorPageNo + sSecretBasePCSelectDecorLineNo + 1) - { - return FALSE; - } - if (i < 12 && sPlayerRoomItemsIndicesBuffer[i] == sSecretBasePCSelectDecorPageNo + sSecretBasePCSelectDecorLineNo + 1) - { - return FALSE; - } - } - return TRUE; -} - -void sub_8127A14(u8 taskId) -{ - sub_81269D4(1); - sub_8127620(taskId); -} - -void sub_8127A30(u8 taskId) -{ - sub_8197434(0, 0); - gTasks[taskId].func = sub_8127A14; -} - -void sub_8127A5C(u8 taskId) -{ - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - sub_8197434(0, 0); - sub_81269D4(1); - sub_8127620(taskId); - } -} - -void sub_8127A8C(u8 taskId) -{ - s16 *data; - - data = gTasks[taskId].data; - sub_8127554(); - sub_81277A8(); - sub_81AE6C8(data[13], NULL, NULL); - free(sDecorPCBuffer); - sub_8126E44(taskId); -} - -void sub_8127ACC(u8 taskId) -{ - gTasks[taskId].data[3] = gSaveBlock1Ptr->pos.x; - gTasks[taskId].data[4] = gSaveBlock1Ptr->pos.y; - PlayerGetDestCoords(&gTasks[taskId].data[0], &gTasks[taskId].data[1]); -} - -void sub_8127B04(u8 taskId) -{ - DrawWholeMapView(); - Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]); - warp_in(); -} - -u16 sub_8127B54(u8 decor, u8 a1) -{ - u16 resp; - - resp = -1; - switch (decor) - { - case DECOR_STAND: - resp = gUnknown_085A72E4[a1] << 12; - return resp; - case DECOR_SLIDE: - resp = gUnknown_085A72EC[a1] << 12; - return resp; - default: - return resp; - } -} - -void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor) -{ - u16 i; - u16 j; - u16 behavior; - u16 flags; - u16 v0; - u16 v1; - s16 decLeft; - s16 decBottom; - - for (i = 0; i < decHeight; i ++) - { - decBottom = mapY - decHeight + 1 + i; - for (j = 0; j < decWidth; j ++) - { - decLeft = mapX + j; - behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[i * decWidth + j]); - if (MetatileBehavior_IsMB_B9(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12))) - { - flags = 0xc00; - } - else - { - flags = 0x000; - } - if (gDecorations[decor].permission != DECORPERM_NA_WALL && MetatileBehavior_IsMB_B7(MapGridGetMetatileBehaviorAt(decLeft, decBottom)) == TRUE) - { - v0 = 1; - } - else - { - v0 = 0; - } - v1 = sub_8127B54(gDecorations[decor].id, i * decWidth + j); - if (v1 != 0xFFFF) - { - MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags | v1); - } - else - { - MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags); - } - } - } -} - -void sub_8127D38(u16 mapX, u16 mapY, u16 decor) -{ - switch (gDecorations[decor].shape) - { - case DECORSHAPE_1x1: - sub_8127B90(mapX, mapY, 1, 1, decor); - break; - case DECORSHAPE_2x1: - sub_8127B90(mapX, mapY, 2, 1, decor); - break; - case DECORSHAPE_3x1: // unused - sub_8127B90(mapX, mapY, 3, 1, decor); - break; - case DECORSHAPE_4x2: - sub_8127B90(mapX, mapY, 4, 2, decor); - break; - case DECORSHAPE_2x2: - sub_8127B90(mapX, mapY, 2, 2, decor); - break; - case DECORSHAPE_1x2: - sub_8127B90(mapX, mapY, 1, 2, decor); - break; - case DECORSHAPE_1x3: // unused - sub_8127B90(mapX, mapY, 1, 3, decor); - break; - case DECORSHAPE_2x4: - sub_8127B90(mapX, mapY, 2, 4, decor); - break; - case DECORSHAPE_3x3: - sub_8127B90(mapX, mapY, 3, 3, decor); - break; - case DECORSHAPE_3x2: - sub_8127B90(mapX, mapY, 3, 2, decor); - break; - } -} - -void sub_8127E18(void) -{ - u8 i; - u8 j; - - for (i = 0; i < 14; i ++) - { - if (FlagGet(0xAE + i) == TRUE) - { - FlagClear(0xAE + i); - for (j = 0; j < gMapHeader.events->mapObjectCount; j ++) - { - if (gMapHeader.events->mapObjects[j].flagId == 0xAE + i) - { - break; - } - } - VarSet(0x3F20 + gMapHeader.events->mapObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]); - gSpecialVar_0x8005 = gMapHeader.events->mapObjects[j].localId; - gSpecialVar_0x8006 = sCurDecorMapX; - gSpecialVar_0x8007 = sCurDecorMapY; - show_sprite(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); - sub_808EBA8(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007); - sub_808F254(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); - break; - } - } -} - -bool8 sub_8127F38(void) -{ - u16 i; - - for (i = 0; i < gUnknown_0203A17C.size; i ++) - { - if (gUnknown_0203A17C.items[i] == DECOR_NONE) - { - return TRUE; - } - } - return FALSE; -} - -void sub_8127F68(u8 taskId) -{ - if (gUnknown_0203A17C.isPlayerRoom == TRUE && sCurDecorationCategory != DECORCAT_DOLL && sCurDecorationCategory != DECORCAT_CUSHION) - { - StringExpandPlaceholders(gStringVar4, gText_CantPlaceInRoom); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); - } - else if (IsSelectedDecorInThePC() == TRUE) - { - if (sub_8127F38() == TRUE) - { - fade_screen(1, 0); - gTasks[taskId].data[2] = 0; - gTasks[taskId].func = sub_8128060; - } - else - { - ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203A17C.size, STR_CONV_MODE_RIGHT_ALIGN, 2); - if (gUnknown_0203A17C.isPlayerRoom == FALSE) { - StringExpandPlaceholders(gStringVar4, gText_NoMoreDecorations); - } - else - { - StringExpandPlaceholders(gStringVar4, gText_NoMoreDecorations2); - } - DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); - } - } - else - { - StringExpandPlaceholders(gStringVar4, gText_InUseAlready); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); - } -} - -void sub_8128060(u8 taskId) -{ - switch (gTasks[taskId].data[2]) - { - case 0: - if (!gPaletteFade.active) - { - sub_8127ACC(taskId); - gTasks[taskId].data[2] = 1; - } - break; - case 1: - gPaletteFade.bufferTransferDisabled = TRUE; - ConfigureCameraObjectForPlacingDecoration(&sPlaceDecorationGraphicsDataBuffer, gCurDecorInventoryItems[gCurDecorationIndex]); - sub_812826C(taskId); - SetUpPlacingDecorationPlayerAvatar(taskId, &sPlaceDecorationGraphicsDataBuffer); - pal_fill_black(); - gPaletteFade.bufferTransferDisabled = FALSE; - gTasks[taskId].data[2] = 2; - break; - case 2: - if (sub_80ABDFC() == TRUE) - { - gTasks[taskId].data[12] = 0; - sub_8128FD8(taskId); - } - break; - } -} - -void ConfigureCameraObjectForPlacingDecoration(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor) -{ - sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data0; - gUnknown_03005DD0.unk4 = gpu_pal_decompress_alloc_tag_and_upload(data, decor); - gSprites[gUnknown_03005DD0.unk4].oam.priority = 1; - gSprites[gUnknown_03005DD0.unk4].callback = sub_81292D0; - gSprites[gUnknown_03005DD0.unk4].pos1.x = gUnknown_085A7250[data->decoration->shape].x; - gSprites[gUnknown_03005DD0.unk4].pos1.y = gUnknown_085A7250[data->decoration->shape].y; -} - -void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphicsDataBuffer *data) -{ - u8 v0; - - v0 = 16 * (u8)gTasks[taskId].data[5] + gUnknown_085A7250[data->decoration->shape].x - 8 * ((u8)gTasks[taskId].data[5] - 1); - if (data->decoration->shape == DECORSHAPE_3x1 || data->decoration->shape == DECORSHAPE_3x3 || data->decoration->shape == DECORSHAPE_3x2) - { - v0 -= 8; - } - if (gSaveBlock2Ptr->playerGender == MALE) - { - sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, v0, 0x48, 0); - } - else - { - sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, v0, 0x48, 0); - } - gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1; - DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]); - sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4; -} - -void sub_812826C(u8 taskId) -{ - switch (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].shape) - { - case DECORSHAPE_1x1: - gTasks[taskId].data[5] = 1; - gTasks[taskId].data[6] = 1; - break; - case DECORSHAPE_2x1: - gTasks[taskId].data[5] = 2; - gTasks[taskId].data[6] = 1; - break; - case DECORSHAPE_3x1: - gTasks[taskId].data[5] = 3; - gTasks[taskId].data[6] = 1; - break; - case DECORSHAPE_4x2: - gTasks[taskId].data[5] = 4; - gTasks[taskId].data[6] = 2; - break; - case DECORSHAPE_2x2: - gTasks[taskId].data[5] = 2; - gTasks[taskId].data[6] = 2; - break; - case DECORSHAPE_1x2: - gTasks[taskId].data[5] = 1; - gTasks[taskId].data[6] = 2; - break; - case DECORSHAPE_1x3: - gTasks[taskId].data[5] = 1; - gTasks[taskId].data[6] = 3; - gTasks[taskId].data[1]++; - break; - case DECORSHAPE_2x4: - gTasks[taskId].data[5] = 2; - gTasks[taskId].data[6] = 4; - break; - case DECORSHAPE_3x3: - gTasks[taskId].data[5] = 3; - gTasks[taskId].data[6] = 3; - break; - case DECORSHAPE_3x2: - gTasks[taskId].data[5] = 3; - gTasks[taskId].data[6] = 2; - break; - } -} - -void sub_81283BC(u8 taskId) -{ - gTasks[taskId].data[10] = 0; - gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 1; - gSprites[sDecor_CameraSpriteObjectIdx2].data7 = 1; - sub_8128DE0(); - sub_8128950(taskId); -} - -void sub_8128414(u8 taskId) -{ - gTasks[taskId].data[10] = 0; - gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 1; - gSprites[sDecor_CameraSpriteObjectIdx2].data7 = 1; - sub_8128DE0(); - StringExpandPlaceholders(gStringVar4, gText_CancelDecorating); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8128B80); -} - -bool8 sub_8128484(u8 behaviorAt, u16 behaviorBy) -{ - if (MetatileBehavior_IsMB_B3(behaviorAt) != TRUE || behaviorBy != 0) - { - return FALSE; - } - return TRUE; -} - -bool8 sub_81284AC(u8 taskId, s16 x, s16 y, u16 decor) -{ - if (x == gTasks[taskId].data[3] + 7 && y == gTasks[taskId].data[4] + 7 && decor != DECOR_NONE) - { - return FALSE; - } - return TRUE; -} - -bool8 sub_81284F4(u16 behaviorAt, const struct Decoration *decoration) -{ - if (MetatileBehavior_IsMB_B3(behaviorAt) != TRUE) - { - if (decoration->id == DECOR_SOLID_BOARD && MetatileBehavior_IsMB_C2(behaviorAt) == TRUE) - { - return TRUE; - } - if (MetatileBehavior_IsNormal(behaviorAt)) - { - return TRUE; - } - } - return FALSE; -} - -bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) -{ - u8 i; - u8 j; - u8 behaviorAt; - u16 behaviorBy; - u8 mapY; - u8 mapX; - s16 curY; - s16 curX; - mapY = gTasks[taskId].data[6]; - mapX = gTasks[taskId].data[5]; - - switch (decoration->permission) - { - case DECORPERM_SOLID_FLOOR: - case DECORPERM_PASS_FLOOR: - for (i=0; itiles[(mapY - 1 - i) * mapX + j]) & 0xf000; - if (!sub_81284F4(behaviorAt, decoration)) - { - return FALSE; - } - if (!sub_81284AC(taskId, curX, curY, behaviorBy)) - { - return FALSE; - } - behaviorAt = GetFieldObjectIdByXYZ(curX, curY, 0); - if (behaviorAt != 0 && behaviorAt != 16) - { - return FALSE; - } - } - } - break; - case DECORPERM_BEHIND_FLOOR: - for (i=0; itiles[(mapY - 1 - i) * mapX + j]) & 0xf000; - if (!MetatileBehavior_IsNormal(behaviorAt) && !sub_8128484(behaviorAt, behaviorBy)) - { - return FALSE; - } - if (!sub_81284AC(taskId, curX, curY, behaviorBy)) - { - return FALSE; - } - if (GetFieldObjectIdByXYZ(curX, curY, 0) != 16) - { - return FALSE; - } - } - } - curY = gTasks[taskId].data[1] - mapY + 1; - for (j=0; jtiles[j]) & 0xf000; - if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsMB_B7(behaviorAt)) - { - return FALSE; - } - if (!sub_81284AC(taskId, curX, curY, behaviorBy)) - { - return FALSE; - } - behaviorAt = GetFieldObjectIdByXYZ(curX, curY, 0); - if (behaviorAt != 0 && behaviorAt != 16) - { - return FALSE; - } - } - break; - case DECORPERM_NA_WALL: - for (i=0; ishape == DECORSHAPE_1x2) - { - if (!MetatileBehavior_IsMB_C3(behaviorAt)) - { - return FALSE; - } - } - else if (!MetatileBehavior_IsMB_B5(behaviorAt)) - { - if (!MetatileBehavior_IsMB_C3(behaviorAt)) - { - return FALSE; - } - } - if (GetFieldObjectIdByXYZ(curX, curY, 0) != 16) - { - return FALSE; - } - } - break; - } - return TRUE; -} - -void sub_8128950(u8 taskId) -{ - if (sub_812853C(taskId, &gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]]) == TRUE) - { - StringExpandPlaceholders(gStringVar4, gText_PlaceItHere); - DisplayItemMessageOnField(taskId, gStringVar4, sub_81289D0); - } - else - { - PlaySE(SE_HAZURE); - StringExpandPlaceholders(gStringVar4, gText_CantBePlacedHere); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8129020); - } -} - -void sub_81289D0(u8 taskId) -{ - sub_8197930(); - sub_8121F68(taskId, &gUnknown_085A72C4); -} - -void sub_81289F0(u8 taskId) -{ - sub_8197434(0, 0); - sub_8128AAC(taskId); - if (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].permission != DECORPERM_SOLID_MAT) - { - sub_8127D38(gTasks[taskId].data[0], gTasks[taskId].data[1], gCurDecorInventoryItems[gCurDecorationIndex]); - } - else - { - sCurDecorMapX = gTasks[taskId].data[0] - 7; - sCurDecorMapY = gTasks[taskId].data[1] - 7; - ScriptContext1_SetupScript(gUnknown_08275D1F); - } - gSprites[sDecor_CameraSpriteObjectIdx1].pos1.y += 2; - if (gMapHeader.regionMapSectionId == REGION_MAP_SECRET_BASE) - { - TV_PutSecretBaseVisitOnTheAir(); - } - sub_8128BBC(taskId); -} - -void sub_8128AAC(u8 taskId) -{ - u16 i; - - for (i = 0; i < gUnknown_0203A17C.size; i ++) - { - if (gUnknown_0203A17C.items[i] == DECOR_NONE) - { - gUnknown_0203A17C.items[i] = gCurDecorInventoryItems[gCurDecorationIndex]; - gUnknown_0203A17C.pos[i] = ((gTasks[taskId].data[0] - 7) << 4) + (gTasks[taskId].data[1] - 7); - break; - } - } - if (!gUnknown_0203A17C.isPlayerRoom) - { - for (i = 0; i < 16; i ++) - { - if (sSecretBaseItemsIndicesBuffer[i] == 0) - { - sSecretBaseItemsIndicesBuffer[i] = gCurDecorationIndex + 1; - break; - } - } - } - else - { - for (i = 0; i < 12; i ++) - { - if (sPlayerRoomItemsIndicesBuffer[i] == 0) - { - sPlayerRoomItemsIndicesBuffer[i] = gCurDecorationIndex + 1; - break; - } - } - } -} - -void sub_8128B80(u8 taskId) -{ - sub_8197930(); - sub_8121F68(taskId, &gUnknown_085A72CC); -} - -void sub_8128BA0(u8 taskId) -{ - sub_8197434(0, 0); - sub_8128BBC(taskId); -} - -void sub_8128BBC(u8 taskId) -{ - fade_screen(1, 0); - gTasks[taskId].data[2] = 0; - gTasks[taskId].func = c1_overworld_prev_quest; -} - -void c1_overworld_prev_quest(u8 taskId) -{ - switch (gTasks[taskId].data[2]) - { - case 0: - ScriptContext2_Enable(); - if (!gPaletteFade.active) - { - sub_8127B04(taskId); - gTasks[taskId].data[2] = 1; - } - break; - case 1: - sub_812A3C8(); - FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG); - gFieldCallback = sub_8128CD4; - SetMainCallback2(c2_exit_to_overworld_2_switch); - DestroyTask(taskId); - break; - } -} - -void sub_8128C64(u8 taskId) -{ - s16 *data; - - data = gTasks[taskId].data; - switch (data[2]) - { - case 0: - sub_80E9578(); - data[2] ++; - break; - case 1: - ScriptContext1_SetupScript(gUnknown_08275D0C); - data[2] ++; - break; - case 2: - ScriptContext2_Enable(); - data[2] ++; - break; - case 3: - if (sub_80ABDFC() == TRUE) - { - gTasks[taskId].func = sub_812764C; - } - break; - } -} - -void sub_8128CD4(void) -{ - u8 taskId; - - ScriptContext2_Enable(); - pal_fill_black(); - taskId = CreateTask(sub_8128C64, 8); - sub_8127580(taskId); - gTasks[taskId].data[2] = 0; -} - -bool8 sub_8128D10(u8 taskId) -{ - s16 *data; - - data = gTasks[taskId].data; - if (sDecorationLastDirectionMoved == DIR_SOUTH && data[1] - data[6] - 6 < 0) - { - data[1] ++; - return FALSE; - } - if (sDecorationLastDirectionMoved == DIR_NORTH && data[1] - 7 >= gMapHeader.mapData->height) - { - data[1] --; - return FALSE; - } - if (sDecorationLastDirectionMoved == DIR_WEST && data[0] - 7 < 0) - { - data[0] ++; - return FALSE; - } - if (sDecorationLastDirectionMoved == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapData->width) - { - data[0] --; - return FALSE; - } - return TRUE; -} - -bool8 sub_8128DB4(void) -{ - u16 heldKeys; - - heldKeys = gMain.heldKeys & 0x0F0; - if (heldKeys != DPAD_UP && heldKeys != DPAD_DOWN && heldKeys != DPAD_LEFT && heldKeys != DPAD_RIGHT) - { - return FALSE; - } - return TRUE; -} - -void sub_8128DE0(void) -{ - sDecorationLastDirectionMoved = 0; - gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; - gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; -} - -void sub_8128E18(u8 taskId) -{ - s16 *data; - - data = gTasks[taskId].data; - if (!gSprites[sDecor_CameraSpriteObjectIdx1].data4) - { - if (data[10] == 1) - { - gUnknown_085A72D4[data[12]].yesFunc(taskId); - return; - } else if (data[10] == 2) - { - gUnknown_085A72D4[data[12]].noFunc(taskId); - return; - } - if ((gMain.heldKeys & 0x0F0) == DPAD_UP) - { - sDecorationLastDirectionMoved = DIR_SOUTH; - gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; - gSprites[sDecor_CameraSpriteObjectIdx1].data3 = -2; - data[1]--; - } - if ((gMain.heldKeys & 0x0F0) == DPAD_DOWN) - { - sDecorationLastDirectionMoved = DIR_NORTH; - gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; - gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 2; - data[1]++; - } - if ((gMain.heldKeys & 0x0F0) == DPAD_LEFT) - { - sDecorationLastDirectionMoved = DIR_WEST; - gSprites[sDecor_CameraSpriteObjectIdx1].data2 = -2; - gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; - data[0]--; - } - if ((gMain.heldKeys & 0x0F0) == DPAD_RIGHT) - { - sDecorationLastDirectionMoved = DIR_EAST; - gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 2; - gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; - data[0]++; - } - if (!sub_8128DB4() || !sub_8128D10(taskId)) - { - sub_8128DE0(); - } - } - if (sDecorationLastDirectionMoved) - { - gSprites[sDecor_CameraSpriteObjectIdx1].data4++; - gSprites[sDecor_CameraSpriteObjectIdx1].data4 &= 7; - } - if (!data[10]) - { - if (gMain.newKeys & A_BUTTON) - { - data[10] = A_BUTTON; - } - if (gMain.newKeys & B_BUTTON) - { - data[10] = B_BUTTON; - } - } -} - -void sub_8128FD8(u8 taskId) -{ - sub_8197434(0, 1); - gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 0; - gTasks[taskId].data[10] = 0; - gTasks[taskId].func = sub_8128E18; -} - -void sub_8129020(u8 taskId) -{ - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) - { - sub_8128FD8(taskId); - } -} - -void sub_8129048(struct PlaceDecorationGraphicsDataBuffer *data) -{ - CpuFill16(0, data, sizeof(*data)); -} - -void sub_8129068(u16 *dest, u16 pal) -{ - CpuFastCopy(&((u16 *)gTilesetPointer_SecretBase->palettes)[pal << 4], dest, 32); -} - -void sub_8129088(u8 *dest, u16 tile) -{ - u8 buffer[32]; - u16 mode; - u16 i; - - mode = tile >> 10; - if (tile != 0) - { - tile &= 0x03FF; - } - CpuFastCopy(&((u8 *)gTilesetPointer_SecretBase->tiles)[tile << 5], buffer, 32); - switch (mode) - { - case 0: - CpuFastCopy(buffer, dest, 32); - break; - case 1: - for (i = 0; i < 8; i ++) - { - dest[4 * i] = (buffer[4 * (i + 1) - 1] >> 4) + ((buffer[4 * (i + 1) - 1] & 0x0F) << 4); - dest[4 * i + 1] = (buffer[4 * (i + 1) - 2] >> 4) + ((buffer[4 * (i + 1) - 2] & 0x0F) << 4); - dest[4 * i + 2] = (buffer[4 * (i + 1) - 3] >> 4) + ((buffer[4 * (i + 1) - 3] & 0x0F) << 4); - dest[4 * i + 3] = (buffer[4 * (i + 1) - 4] >> 4) + ((buffer[4 * (i + 1) - 4] & 0x0F) << 4); - } - break; - case 2: - for (i = 0; i < 8; i ++) - { - dest[4 * i] = buffer[4 * (7 - i)]; - dest[4 * i + 1] = buffer[4 * (7 - i) + 1]; - dest[4 * i + 2] = buffer[4 * (7 - i) + 2]; - dest[4 * i + 3] = buffer[4 * (7 - i) + 3]; - } - break; - case 3: - for (i = 0; i < 32; i ++) - { - dest[i] = (buffer[31 - i] >> 4) + ((buffer[31 - i] & 0x0F) << 4); - } - break; - } -} - -void sub_81291A4(struct PlaceDecorationGraphicsDataBuffer *data) -{ - u16 i; - for (i = 0; i < 64; i ++) - { - sub_8129088(&data->image[i * 32], data->tiles[i]); - } -} - -u16 sub_81291CC(u16 tile) -{ - return ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[tile] & 0xFFF; -} - -void sub_81291E8(struct PlaceDecorationGraphicsDataBuffer *data) -{ - u8 i; - u8 shape; - - shape = data->decoration->shape; - for (i = 0; i < gUnknown_085A71B0[shape].size; i ++) - { - data->tiles[gUnknown_085A71B0[shape].tiles[i]] = sub_81291CC(data->decoration->tiles[gUnknown_085A71B0[shape].y[i]] * 8 + gUnknown_085A71B0[shape].x[i]); - } -} - -void SetDecorSelectionBoxOamAttributes(u8 decorShape) -{ - sDecorSelectorOam.y = 0; - sDecorSelectorOam.affineMode = ST_OAM_AFFINE_OFF; - sDecorSelectorOam.objMode = ST_OAM_OBJ_NORMAL; - sDecorSelectorOam.mosaic = 0; - sDecorSelectorOam.bpp = ST_OAM_4BPP; - sDecorSelectorOam.shape = gUnknown_085A7250[decorShape].shape; - sDecorSelectorOam.x = 0; - sDecorSelectorOam.matrixNum = 0; - sDecorSelectorOam.size = gUnknown_085A7250[decorShape].size; - sDecorSelectorOam.tileNum = 0; - sDecorSelectorOam.priority = 0; - sDecorSelectorOam.paletteNum = 0; -} - -void sub_81292D0(struct Sprite *sprite) -{ - sprite->data2 = 0; - sprite->data3 = 0; - sprite->data4 = 0; - sprite->data5 = 0; - sprite->data6 = 0; - sprite->data7 = 0; - sprite->callback = sub_81292E8; -} - -void sub_81292E8(struct Sprite *sprite) -{ - if (sprite->data7 == 0) - { - if (sprite->data6 < 15) - { - sprite->invisible = FALSE; - } - else - { - sprite->invisible = TRUE; - } - sprite->data6 ++; - sprite->data6 &= 0x1F; - } - else - { - sprite->invisible = FALSE; - } -} - -u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor) -{ - sub_8129048(data); - data->decoration = &gDecorations[decor]; - if (data->decoration->permission == DECORPERM_SOLID_MAT) - { - return AddPseudoFieldObject(data->decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); - } - FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG); - sub_81291E8(data); - SetDecorSelectionBoxOamAttributes(data->decoration->shape); - sub_81291A4(data); - sub_8129068(data->palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(data->decoration->tiles[0] * 8) + 7] >> 12); - LoadSpritePalette(&gUnknown_085A72BC); - return CreateSprite(&sDecorSelectorSpriteTemplate, 0, 0, 0); -} - -u8 AddDecorationIconObjectFromIconTable(u16 tilesTag, u16 paletteTag, u8 decor) -{ - struct SpriteSheet sheet; - struct CompressedSpritePalette palette; - struct SpriteTemplate *template; - u8 spriteId; - - if (!AllocItemIconTemporaryBuffers()) - { - return MAX_SPRITES; - } - LZDecompressWram(GetDecorationIconPicOrPalette(decor, 0), gUnknown_0203CEBC); - CopyItemIconPicTo4x4Buffer(gUnknown_0203CEBC, gUnknown_0203CEC0); - sheet.data = gUnknown_0203CEC0; - sheet.size = 0x200; - sheet.tag = tilesTag; - LoadSpriteSheet(&sheet); - palette.data = GetDecorationIconPicOrPalette(decor, 1); - palette.tag = paletteTag; - LoadCompressedObjectPalette(&palette); - template = malloc(sizeof(struct SpriteTemplate)); - *template = gUnknown_08614FF4; - template->tileTag = tilesTag; - template->paletteTag = paletteTag; - spriteId = CreateSprite(template, 0, 0, 0); - FreeItemIconTemporaryBuffers(); - free(template); - return spriteId; -} - -const u8 *GetDecorationIconPicOrPalette(u16 decor, u8 mode) -{ - if (decor > 120) - { - decor = DECOR_NONE; - } - return gUnknown_085A6BE8[decor][mode]; -} - -u8 AddDecorationIconObjectFromFieldObject(u16 tilesTag, u16 paletteTag, u8 decor) -{ - u8 spriteId; - struct SpriteSheet sheet; - struct SpritePalette palette; - struct SpriteTemplate *template; - - sub_8129048(&sPlaceDecorationGraphicsDataBuffer); - sPlaceDecorationGraphicsDataBuffer.decoration = &gDecorations[decor]; - if (sPlaceDecorationGraphicsDataBuffer.decoration->permission != DECORPERM_SOLID_MAT) - { - sub_81291E8(&sPlaceDecorationGraphicsDataBuffer); - SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape); - sub_81291A4(&sPlaceDecorationGraphicsDataBuffer); - sub_8129068(sPlaceDecorationGraphicsDataBuffer.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0] * 8) + 7] >> 12); - sheet.data = sPlaceDecorationGraphicsDataBuffer.image; - sheet.size = gUnknown_085A72F4[sPlaceDecorationGraphicsDataBuffer.decoration->shape] << 5; - sheet.tag = tilesTag; - LoadSpriteSheet(&sheet); - palette.data = sPlaceDecorationGraphicsDataBuffer.palette; - palette.tag = paletteTag; - LoadSpritePalette(&palette); - template = Alloc(sizeof(struct SpriteTemplate)); - *template = sDecorWhilePlacingSpriteTemplate; - template->tileTag = tilesTag; - template->paletteTag = paletteTag; - spriteId = CreateSprite(template, 0, 0, 0); - free(template); - } - else - { - spriteId = AddPseudoFieldObject(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); - } - return spriteId; -} - -u8 AddDecorationIconObject(u8 decor, s16 x, s16 y, u8 priority, u16 tilesTag, u16 paletteTag) -{ - u8 spriteId; - - if (decor > 120) - { - spriteId = AddDecorationIconObjectFromIconTable(tilesTag, paletteTag, DECOR_NONE); - if (spriteId == MAX_SPRITES) - { - return MAX_SPRITES; - } - gSprites[spriteId].pos2.x = x + 4; - gSprites[spriteId].pos2.y = y + 4; - } - else if (gUnknown_085A6BE8[decor][0] == NULL) - { - spriteId = AddDecorationIconObjectFromFieldObject(tilesTag, paletteTag, decor); - if (spriteId == MAX_SPRITES) - { - return MAX_SPRITES; - } - gSprites[spriteId].pos2.x = x; - if (decor == DECOR_SILVER_SHIELD || decor == DECOR_GOLD_SHIELD) - { - gSprites[spriteId].pos2.y = y - 4; - } - else - { - gSprites[spriteId].pos2.y = y; - } - } - else - { - spriteId = AddDecorationIconObjectFromIconTable(tilesTag, paletteTag, decor); - if (spriteId == MAX_SPRITES) - { - return MAX_SPRITES; - } - gSprites[spriteId].pos2.x = x + 4; - gSprites[spriteId].pos2.y = y + 4; - } - gSprites[spriteId].oam.priority = priority; - return spriteId; -} - -void sub_81296EC(u8 idx) -{ - gUnknown_0203A17C.items[idx] = 0; - gUnknown_0203A17C.pos[idx] = 0; -} - -void sub_8129708(void) -{ - u16 i; - - gSpecialVar_0x8005 = 0; - gScriptResult = 0; - if (gSpecialVar_0x8004 == sCurDecorSelectedInRearrangement) - { - gScriptResult = 1; - } - else if (gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx]].permission == DECORPERM_SOLID_MAT) - { - gSpecialVar_0x8005 = sDecorRearrangementDataBuffer[gSpecialVar_0x8004].flagId; - sub_81296EC(sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx); - for (i = 0; i < gMapHeader.events->mapObjectCount; i ++) - { - if (gMapHeader.events->mapObjects[i].flagId == gSpecialVar_0x8005) - { - gSpecialVar_0x8006 = gMapHeader.events->mapObjects[i].localId; - break; - } - } - } -} - -void sub_81297AC(void) -{ - u8 i; - - for (i = 0; i < gMapHeader.events->mapObjectCount; i ++) - { - if (gMapHeader.events->mapObjects[i].flagId == gSpecialVar_0x8004) - { - gSpecialVar_0x8005 = gMapHeader.events->mapObjects[i].localId; - break; - } - } -} - -void sub_81297F8(void) -{ - u8 i; - u8 y; - u8 x; - int posX; - int posY; - u8 perm; - - for (i = 0; i < sCurDecorSelectedInRearrangement; i ++) - { - perm = gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[i].idx]].permission; - posX = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] >> 4; - posY = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] & 0x0F; - if (perm != DECORPERM_SOLID_MAT) - { - for (y = 0; y < sDecorRearrangementDataBuffer[i].height; y ++) - { - for (x = 0; x < sDecorRearrangementDataBuffer[i].width; x ++) - { - MapGridSetMetatileEntryAt(posX + 7 + x, posY + 7 - y, gMapHeader.mapData->map[posX + x + gMapHeader.mapData->width * (posY - y)] | 0x3000); - } - } - sub_81296EC(sDecorRearrangementDataBuffer[i].idx); - } - } -} - -void sub_81298EC(u8 taskId) -{ - switch (gTasks[taskId].data[2]) - { - case 0: - sub_81297F8(); - gTasks[taskId].data[2] = 1; - break; - case 1: - if (!gPaletteFade.active) { - DrawWholeMapView(); - ScriptContext1_SetupScript(gUnknown_08275D2E); - sub_8197434(0, 1); - gTasks[taskId].data[2] = 2; - } - break; - case 2: - ScriptContext2_Enable(); - IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); - pal_fill_black(); - gTasks[taskId].data[2] = 3; - break; - case 3: - if (sub_80ABDFC() == TRUE) - { - StringExpandPlaceholders(gStringVar4, gText_DecorationReturnedToPC); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8129D64); - if (gMapHeader.regionMapSectionId == REGION_MAP_SECRET_BASE) - { - TV_PutSecretBaseVisitOnTheAir(); - } - } - break; - } -} - - -bool8 sub_81299AC(u8 taskId) -{ - u16 i; - - for (i = 0; i < gUnknown_0203A17C.size; i ++) - { - if (gUnknown_0203A17C.items[i] != DECOR_NONE) - { - return TRUE; - } - } - return FALSE; -} - -void SetUpPuttingAwayDecorationPlayerAvatar(void) -{ - player_get_direction_lower_nybble(); - sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data0; - sub_812A39C(); - gUnknown_03005DD0.unk4 = CreateSprite(&gUnknown_085A7404, 0x78, 0x50, 0); - if (gSaveBlock2Ptr->playerGender == MALE) - { - sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, 0x88, 0x48, 0); - } - else - { - sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, 0x88, 0x48, 0); - } - gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1; - DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]); - sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4; - gSprites[sDecor_CameraSpriteObjectIdx1].oam.priority = 1; -} - -void sub_8129ABC(u8 taskId) -{ - s16 *data; - - data = gTasks[taskId].data; - switch (data[2]) - { - case 0: - if (!gPaletteFade.active) - { - sub_8127ACC(taskId); - data[2] = 1; - data[6] = 1; - data[5] = 1; - } - break; - case 1: - SetUpPuttingAwayDecorationPlayerAvatar(); - pal_fill_black(); - data[2] = 2; - break; - case 2: - if (sub_80ABDFC() == TRUE) - { - data[12] = 1; - sub_8129B34(taskId); - } - break; - } -} - -void sub_8129B34(u8 taskId) -{ - sub_8197434(0, 1); - gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 0; - gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; - gSprites[sDecor_CameraSpriteObjectIdx1].callback = sub_812A36C; - gSprites[sDecor_CameraSpriteObjectIdx2].pos1.x = 0x88; - gSprites[sDecor_CameraSpriteObjectIdx2].pos1.y = 0x48; - gTasks[taskId].data[10] = 0; - gTasks[taskId].func = sub_8128E18; -} - -void sub_8129BCC(u8 taskId) -{ - gTasks[taskId].data[10] = 0; - sub_8128DE0(); - sub_8129C74(taskId); -} - -void sub_8129BF8(u8 taskId) -{ - gTasks[taskId].data[10] = 0; - sub_8128DE0(); - gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; - gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; - StringExpandPlaceholders(gStringVar4, gText_StopPuttingAwayDecorations); - DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1F0); -} - -void sub_8129C74(u8 taskId) -{ - s16 *data; - u8 behavior; - - sub_812A0E8(taskId); - if (sCurDecorSelectedInRearrangement != 0) - { - StringExpandPlaceholders(gStringVar4, gText_ReturnDecorationToPC); - DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1A0); - } - else - { - data = gTasks[taskId].data; - behavior = MapGridGetMetatileBehaviorAt(data[0], data[1]); - if (MetatileBehavior_IsSecretBasePC(behavior) == TRUE || MetatileBehavior_IsMB_C5(behavior) == TRUE) - { - gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; - gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; - StringExpandPlaceholders(gStringVar4, gText_StopPuttingAwayDecorations); - DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1F0); - } - else - { - StringExpandPlaceholders(gStringVar4, gText_NoDecorationHere); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8129D64); - } - } -} - -void sub_8129D64(u8 taskId) -{ - if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) - { - sub_8129B34(taskId); - } -} - -void sub_8129D8C(u8 decor, struct DecorRearrangementDataBuffer *data) -{ - if (gDecorations[decor].shape == DECORSHAPE_1x1) - { - data->width = 1; - data->height = 1; - } else if (gDecorations[decor].shape == DECORSHAPE_2x1) - { - data->width = 2; - data->height = 1; - } else if (gDecorations[decor].shape == DECORSHAPE_3x1) - { - data->width = 3; - data->height = 1; - } else if (gDecorations[decor].shape == DECORSHAPE_4x2) - { - data->width = 4; - data->height = 2; - } else if (gDecorations[decor].shape == DECORSHAPE_2x2) - { - data->width = 2; - data->height = 2; - } else if (gDecorations[decor].shape == DECORSHAPE_1x2) - { - data->width = 1; - data->height = 2; - } else if (gDecorations[decor].shape == DECORSHAPE_1x3) - { - data->width = 1; - data->height = 3; - } else if (gDecorations[decor].shape == DECORSHAPE_2x4) - { - data->width = 2; - data->height = 4; - } else if (gDecorations[decor].shape == DECORSHAPE_3x3) - { - data->width = 3; - data->height = 3; - } else if (gDecorations[decor].shape == DECORSHAPE_3x2) - { - data->width = 3; - data->height = 2; - } -} - -void sub_8129E0C(u8 x, u8 y) -{ - gSprites[sDecor_CameraSpriteObjectIdx1].invisible = TRUE; - gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; - gSprites[sDecor_CameraSpriteObjectIdx2].pos1.x = (x << 4) + 0x88; - gSprites[sDecor_CameraSpriteObjectIdx2].pos1.y = (y << 4) + 0x48; -} - -bool8 sub_8129E74(u8 taskId, u8 idx, struct DecorRearrangementDataBuffer *data) -{ - u8 x; - u8 y; - u8 xOff; - u8 yOff; - u8 ht; - - x = gTasks[taskId].data[0] - 7; - y = gTasks[taskId].data[1] - 7; - xOff = gUnknown_0203A17C.pos[idx] >> 4; - yOff = gUnknown_0203A17C.pos[idx] & 0x0F; - ht = data->height; - if (gUnknown_0203A17C.items[idx] == DECOR_SAND_ORNAMENT && MapGridGetMetatileIdAt(xOff + 7, yOff + 7) == 0x28C) - { - ht --; - } - if (x >= xOff && x < xOff + data->width && y > yOff - ht && y <= yOff) - { - sub_8129E0C(data->width - (x - xOff + 1), yOff - y); - return TRUE; - } - return FALSE; -} - -void sub_8129F20(void) -{ - u8 xOff; - u8 yOff; - u16 i; - - xOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx] >> 4; - yOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx] & 0x0F; - for (i = 0; i < 0x40; i ++) - { - if (gSaveBlock1Ptr->mapObjectTemplates[i].x == xOff && gSaveBlock1Ptr->mapObjectTemplates[i].y == yOff && !FlagGet(gSaveBlock1Ptr->mapObjectTemplates[i].flagId)) - { - sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].flagId = gSaveBlock1Ptr->mapObjectTemplates[i].flagId; - break; - } - } -} - -bool8 sub_8129FC8(u8 taskId) -{ - u16 i; - - for (i = 0; i < gUnknown_0203A17C.size; i ++) - { - if (gUnknown_0203A17C.items[i] != 0) - { - if (gDecorations[gUnknown_0203A17C.items[i]].permission == DECORPERM_SOLID_MAT) - { - sub_8129D8C(gUnknown_0203A17C.items[i], sDecorRearrangementDataBuffer); - if (sub_8129E74(taskId, i, sDecorRearrangementDataBuffer) == TRUE) - { - sDecorRearrangementDataBuffer->idx = i; - sub_8129F20(); - sCurDecorSelectedInRearrangement = 1; - return TRUE; - } - } - } - } - return FALSE; -} - -void sub_812A040(u8 left, u8 top, u8 right, u8 bottom) -{ - u8 i; - u8 xOff; - u8 yOff; - u8 decorIdx; - - for (i = 0; i < gUnknown_0203A17C.size; i ++) - { - decorIdx = gUnknown_0203A17C.items[i]; - xOff = gUnknown_0203A17C.pos[i] >> 4; - yOff = gUnknown_0203A17C.pos[i] & 0x0F; - if (decorIdx != 0 && gDecorations[decorIdx].permission == DECORPERM_SOLID_MAT && left <= xOff && top <= yOff && right >= xOff && bottom >= yOff) - { - sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx = i; - sub_8129F20(); - sCurDecorSelectedInRearrangement++; - } - } -} - -#ifdef NONMATCHING -void sub_812A0E8(u8 taskId) -{ - u8 i; - u8 xOff; - u8 yOff; - u8 decor; - register u8 decor asm("r1"); - struct DecorRearrangementDataBuffer *data; - - sCurDecorSelectedInRearrangement = 0; - if (sub_8129FC8(taskId) != TRUE) - { - for (i = 0; i < gUnknown_0203A17C.size; i ++) - { - decor = gUnknown_0203A17C.items[i]; - if (decor != DECOR_NONE) - { - data = &sDecorRearrangementDataBuffer[0]; - sub_8129D8C(decor, data); - if (sub_8129E74(taskId, i, data) == TRUE) - { - data->idx = i; - sCurDecorSelectedInRearrangement ++; - break; - } - } - } - if (sCurDecorSelectedInRearrangement != 0) - { - xOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] >> 4; - yOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] & 0x0F; - sub_812A040(xOff, yOff - sDecorRearrangementDataBuffer[0].height + 1, xOff + sDecorRearrangementDataBuffer[0].width - 1, yOff); // Arithmetic register swap at the r2 argument: `add r2, r0, r2` instead of `add r2, r2, r0` - } - } -} -#else -__attribute__((naked)) void sub_812A0E8(u8 taskId) -{ - asm_unified("\tpush {r4-r7,lr}\n" - "\tlsls r0, 24\n" - "\tlsrs r6, r0, 24\n" - "\tldr r4, =sCurDecorSelectedInRearrangement\n" - "\tmovs r0, 0\n" - "\tstrb r0, [r4]\n" - "\tadds r0, r6, 0\n" - "\tbl sub_8129FC8\n" - "\tlsls r0, 24\n" - "\tlsrs r0, 24\n" - "\tcmp r0, 0x1\n" - "\tbeq _0812A18C\n" - "\tmovs r5, 0\n" - "\tldr r0, =gUnknown_0203A17C\n" - "\tldrb r1, [r0, 0x8]\n" - "\tcmp r5, r1\n" - "\tbcs _0812A15A\n" - "\tadds r7, r4, 0\n" - "_0812A10E:\n" - "\tldr r0, [r0]\n" - "\tadds r0, r5\n" - "\tldrb r1, [r0]\n" - "\tcmp r1, 0\n" - "\tbeq _0812A14C\n" - "\tldr r4, =sDecorRearrangementDataBuffer\n" - "\tadds r0, r1, 0\n" - "\tadds r1, r4, 0\n" - "\tbl sub_8129D8C\n" - "\tadds r0, r6, 0\n" - "\tadds r1, r5, 0\n" - "\tadds r2, r4, 0\n" - "\tbl sub_8129E74\n" - "\tlsls r0, 24\n" - "\tlsrs r0, 24\n" - "\tcmp r0, 0x1\n" - "\tbne _0812A14C\n" - "\tstrb r5, [r4]\n" - "\tldrb r0, [r7]\n" - "\tadds r0, 0x1\n" - "\tstrb r0, [r7]\n" - "\tb _0812A15A\n" - "\t.pool\n" - "_0812A14C:\n" - "\tadds r0, r5, 0x1\n" - "\tlsls r0, 24\n" - "\tlsrs r5, r0, 24\n" - "\tldr r0, =gUnknown_0203A17C\n" - "\tldrb r1, [r0, 0x8]\n" - "\tcmp r5, r1\n" - "\tbcc _0812A10E\n" - "_0812A15A:\n" - "\tldr r0, =sCurDecorSelectedInRearrangement\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0\n" - "\tbeq _0812A18C\n" - "\tldr r0, =gUnknown_0203A17C\n" - "\tldr r2, =sDecorRearrangementDataBuffer\n" - "\tldrb r1, [r2]\n" - "\tldr r0, [r0, 0x4]\n" - "\tadds r0, r1\n" - "\tldrb r1, [r0]\n" - "\tlsrs r0, r1, 4\n" - "\tmovs r3, 0xF\n" - "\tands r3, r1\n" - "\tldrb r1, [r2, 0x2]\n" - "\tsubs r1, r3, r1\n" - "\tadds r1, 0x1\n" - "\tlsls r1, 24\n" - "\tlsrs r1, 24\n" - "\tldrb r2, [r2, 0x1]\n" - "\tadds r2, r0\n" - "\tsubs r2, 0x1\n" - "\tlsls r2, 24\n" - "\tlsrs r2, 24\n" - "\tbl sub_812A040\n" - "_0812A18C:\n" - "\tpop {r4-r7}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.pool"); -} -#endif - -void sub_812A1A0(u8 taskId) -{ - sub_8197930(); - sub_8121F68(taskId, &gUnknown_085A7348); -} - -void sub_812A1C0(u8 taskId) -{ - fade_screen(1, 0); - gTasks[taskId].data[2] = 0; - gTasks[taskId].func = sub_81298EC; -} - -void sub_812A1F0(u8 taskId) -{ - sub_8197930(); - sub_8121F68(taskId, &gUnknown_085A7350); -} - -void sub_812A210(u8 taskId) -{ - sub_8197434(0, 0); - sub_812A22C(taskId); -} - -void sub_812A22C(u8 taskId) -{ - fade_screen(1, 0); - gTasks[taskId].data[2] = 0; - gTasks[taskId].func = sub_812A25C; -} - -void sub_812A25C(u8 taskId) -{ - switch (gTasks[taskId].data[2]) - { - case 0: - if (!gPaletteFade.active) - { - sub_8127B04(taskId); - gTasks[taskId].data[2] = 1; - } - break; - case 1: - sub_812A3C8(); - gFieldCallback = sub_812A334; - SetMainCallback2(c2_exit_to_overworld_2_switch); - DestroyTask(taskId); - break; - } -} - -void sub_812A2C4(u8 taskId) -{ - s16 *data; - - data = gTasks[taskId].data; - switch (data[2]) - { - case 0: - sub_80E9578(); - data[2] ++; - break; - case 1: - ScriptContext1_SetupScript(gUnknown_08275D0C); - data[2] ++; - break; - case 2: - ScriptContext2_Enable(); - data[2] ++; - break; - case 3: - if (sub_80ABDFC() == TRUE) - { - gTasks[taskId].func = sub_8126B80; - } - break; - } -} - -void sub_812A334(void) -{ - u8 taskId; - - pal_fill_black(); - sub_81973C4(0, 1); - sub_8126ABC(); - taskId = CreateTask(sub_812A2C4, 8); - gTasks[taskId].data[2] = 0; -} - -void sub_812A36C(struct Sprite *sprite) -{ - sprite->data0 ++; - sprite->data0 &= 0x1F; - if (sprite->data0 > 15) - { - sprite->invisible = TRUE; - } - else - { - sprite->invisible = FALSE; - } -} - -void sub_812A39C(void) -{ - if (gSaveBlock2Ptr->playerGender == MALE) - { - LoadSpritePalette(&gUnknown_085A73D8); - } - else - { - LoadSpritePalette(&gUnknown_085A73E0); - } -} - -void sub_812A3C8(void) -{ - FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG); -} - -void sub_812A3D4(u8 taskId) -{ - if (IsSelectedDecorInThePC() == TRUE) - { - StringCopy(gStringVar1, gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].name); - StringExpandPlaceholders(gStringVar4, gText_DecorationWillBeDiscarded); - DisplayItemMessageOnField(taskId, gStringVar4, sub_812A458); - } - else - { - StringExpandPlaceholders(gStringVar4, gText_CantThrowAwayInUse); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); - } -} - -void sub_812A458(u8 taskId) -{ - sub_8197930(); - sub_8121F68(taskId, &gUnknown_085A741C); -} - -void sub_812A478(u8 taskId) -{ - gCurDecorInventoryItems[gCurDecorationIndex] = DECOR_NONE; - sCurDecorCatCount = CountDecorationCategoryN(sCurDecorationCategory); - CondenseDecorationCategoryN(sCurDecorationCategory); - IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); - StringExpandPlaceholders(gStringVar4, gText_DecorationThrownAway); - DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); -} diff --git a/src/decoration_inventory.c b/src/decoration_inventory.c deleted file mode 100644 index 03ab6c00c..000000000 --- a/src/decoration_inventory.c +++ /dev/null @@ -1,189 +0,0 @@ - -// Includes -#include "global.h" -#include "decoration.h" -#include "decoration_inventory.h" - -// Static type declarations - -// Static RAM declarations - -EWRAM_DATA struct DecorationInventory gDecorationInventories[8] = {}; - -// Static ROM declarations - -// .rodata - -// .text - -#define SET_DECOR_INV(i, ptr) {\ - gDecorationInventories[i].items = ptr;\ - gDecorationInventories[i].size = sizeof(ptr);\ -} - -void SetDecorationInventoriesPointers(void) -{ - SET_DECOR_INV(0, gSaveBlock1Ptr->decorDesk); - SET_DECOR_INV(1, gSaveBlock1Ptr->decorChair); - SET_DECOR_INV(2, gSaveBlock1Ptr->decorPlant); - SET_DECOR_INV(3, gSaveBlock1Ptr->decorOrnament); - SET_DECOR_INV(4, gSaveBlock1Ptr->decorMat); - SET_DECOR_INV(5, gSaveBlock1Ptr->decorPoster); - SET_DECOR_INV(6, gSaveBlock1Ptr->decorDoll); - SET_DECOR_INV(7, gSaveBlock1Ptr->decorCushion); - sub_8126968(); -} - -static void ClearDecorationInventory(u8 idx) -{ - u8 i; - - for (i = 0; i < gDecorationInventories[idx].size; i ++) - { - gDecorationInventories[idx].items[i] = DECOR_NONE; - } -} - -void ClearDecorationInventories(void) -{ - u8 idx; - - for (idx = 0; idx < 8; idx ++) - { - ClearDecorationInventory(idx); - } -} - -s8 GetFirstEmptyDecorSlot(u8 idx) -{ - s8 i; - - for (i = 0; i < (s8)gDecorationInventories[idx].size; i ++) - { - if (gDecorationInventories[idx].items[i] == DECOR_NONE) - { - return i; - } - } - return -1; -} - -bool8 CheckHasDecoration(u8 decor) -{ - u8 i; - u8 category; - - category = gDecorations[decor].category; - for (i = 0; i < gDecorationInventories[category].size; i ++) - { - if (gDecorationInventories[category].items[i] == decor) - { - return TRUE; - } - } - return FALSE; -} - -bool8 DecorationAdd(u8 decor) -{ - u8 category; - s8 idx; - - if (decor == DECOR_NONE) - { - return FALSE; - } - category = gDecorations[decor].category; - idx = GetFirstEmptyDecorSlot(category); - if (idx == -1) - { - return FALSE; - } - gDecorationInventories[category].items[idx] = decor; - return TRUE; -} - -bool8 DecorationCheckSpace(u8 decor) -{ - if (decor == DECOR_NONE) - { - return FALSE; - } - if (GetFirstEmptyDecorSlot(gDecorations[decor].category) == -1) - { - return FALSE; - } - return TRUE; -} - -s8 DecorationRemove(u8 decor) -{ - u8 i; - u8 idx; - - i = 0; - if (decor == DECOR_NONE) - { - return 0; - } - for (i = 0; i < gDecorationInventories[gDecorations[decor].category].size; i ++) - { - idx = gDecorations[decor].category; - if (gDecorationInventories[idx].items[i] == decor) - { - gDecorationInventories[idx].items[i] = DECOR_NONE; - CondenseDecorationCategoryN(idx); - return 1; - } - } - return 0; -} - -void CondenseDecorationCategoryN(u8 idx) -{ - u8 i; - u8 j; - u8 tmp; - - for (i = 0; i < gDecorationInventories[idx].size; i ++) - { - for (j = i + 1; j < gDecorationInventories[idx].size; j ++) - { - if (gDecorationInventories[idx].items[j] != DECOR_NONE && (gDecorationInventories[idx].items[i] == DECOR_NONE || gDecorationInventories[idx].items[i] > gDecorationInventories[idx].items[j])) - { - tmp = gDecorationInventories[idx].items[i]; - gDecorationInventories[idx].items[i] = gDecorationInventories[idx].items[j]; - gDecorationInventories[idx].items[j] = tmp; - } - } - } -} - -u8 CountDecorationCategoryN(u8 idx) -{ - u8 i; - u8 ct; - - ct = 0; - for (i = 0; i < gDecorationInventories[idx].size; i ++) - { - if (gDecorationInventories[idx].items[i] != DECOR_NONE) - { - ct ++; - } - } - return ct; -} - -u8 CountDecorations(void) -{ - u8 idx; - u8 ct; - - ct = 0; - for (idx = 0; idx < 8; idx ++) - { - ct += CountDecorationCategoryN(idx); - } - return ct; -} diff --git a/src/international_string_util.c b/src/international_string_util.c index 81985d614..c77b4f8ff 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -28,13 +28,13 @@ s32 GetStringWidthDifference(s32 fontId, const u8 *str, s32 totalWidth, s32 lett return 0; } -s32 GetMaxWidthInMenuTable(const struct MenuAction *str, s32 arg1) +s32 GetMaxWidthInMenuTable(const u8 **str, s32 arg1) { s32 i, var; for (var = 0, i = 0; i < arg1; i++) { - s32 stringWidth = GetStringWidth(1, str[i].text, 0); + s32 stringWidth = GetStringWidth(1, str[i * 2], 0); if (stringWidth > var) var = stringWidth; } @@ -42,13 +42,13 @@ s32 GetMaxWidthInMenuTable(const struct MenuAction *str, s32 arg1) return convert_pixel_width_to_tile_width(var); } -s32 sub_81DB3D8(const struct MenuAction *str, u8* arg1, s32 arg2) +s32 sub_81DB3D8(const u8 **str, u8* arg1, s32 arg2) { s32 i, var; for (var = 0, i = 0; i < arg2; i++) { - s32 stringWidth = GetStringWidth(1, str[arg1[i]].text, 0); + s32 stringWidth = GetStringWidth(1, str[arg1[i] * 2], 0); if (stringWidth > var) var = stringWidth; } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c deleted file mode 100755 index 37ecdc982..000000000 --- a/src/pokemon_summary_screen.c +++ /dev/null @@ -1,3679 +0,0 @@ -#include "global.h" -#include "battle.h" -#include "bg.h" -#include "decompress.h" -#include "item.h" -#include "items.h" -#include "link.h" -#include "m4a.h" -#include "main.h" -#include "malloc.h" -#include "moves.h" -#include "palette.h" -#include "pokemon.h" -#include "songs.h" -#include "sound.h" -#include "species.h" -#include "sprite.h" -#include "string_util.h" -#include "task.h" -#include "text.h" -#include "window.h" - -struct ContestMove -{ - u8 effect; - u8 type; - u8 comboID; - u8 combo[4]; -}; - -struct ContestEffect -{ - u8 type; - u8 appeal; - u8 jam; -}; - - - -extern struct UnkSummaryStruct* gUnknown_0203CF1C; -extern struct BgTemplate gUnknown_0861CBB4; -extern u8 gUnknown_0203CF20; -extern struct MusicPlayerInfo gMPlay_BGM; -extern s8 gUnknown_0861CC1C[]; -extern u8 gUnknown_08329D22[]; -extern u8 gUnknown_0203CF21; -extern u16 gSpecialVar_0x8005; -extern struct UnkStruct_61CC04 gUnknown_0861CC04; -extern struct UnkStruct_61CC04 gUnknown_0861CC10; -extern struct UnkStruct_61CC04 gUnknown_0861CBEC; -extern struct UnkStruct_61CC04 gUnknown_0861CBF8; -extern u16 gUnknown_08DC3CD4[]; -extern struct ContestMove gContestMoves[]; -extern struct ContestEffect gContestEffects[]; -extern struct WindowTemplate gUnknown_0861CC24; -extern struct TextColor gUnknown_0861CD2C[]; -extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; -extern u8 gText_MaleSymbol[]; -extern u8 gText_FemaleSymbol[]; -extern u8 gUnknown_0861CDD3[]; -extern void (*const gUnknown_0861CE54[])(); -extern void (*const gUnknown_0861CE64[])(u8 taskId); -extern struct WindowTemplate gUnknown_0861CCCC; -extern u8 gUnknown_0861CE74[]; -extern u8 gUnknown_0861CE7B[]; -extern struct WindowTemplate gUnknown_0861CCEC; -extern struct WindowTemplate gUnknown_0861CD14; - -extern void sub_806F2AC(u8 a, u8 b); -void sub_81C488C(u8 a); -extern void do_scheduled_bg_tilemap_copies_to_vram(void); -extern u8 sub_81221EC(); -extern u8 sub_81221AC(); -extern void SetVBlankHBlankCallbacksToNull(); -extern void sub_8121DA0(); -extern void clear_scheduled_bg_copies_to_vram(); -extern void remove_some_task(); -extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable); -extern void ShowBg(u8 a); -extern void SetGpuReg(u8 regOffset, u16 value); -extern void schedule_bg_copy_tilemap_to_vram(u8 a); -extern void SetBgTilemapBuffer(u8 bg, void *tilemap); -extern u8 gUnknown_08D9862C; -extern u8 gUnknown_08D98CC8; -extern u8 gUnknown_08D987FC; -extern u8 gUnknown_08D9898C; -extern u8 gUnknown_08D98B28; -extern u8 gUnknown_08D9853C; -extern u8 gUnknown_08D85620; -extern struct CompressedSpriteSheet gUnknown_0861CFBC; -extern struct CompressedSpriteSheet gUnknown_0861D074; -extern struct CompressedSpriteSheet gUnknown_0861D0F8; -extern struct CompressedSpritePalette gUnknown_0861D100; -extern struct CompressedSpritePalette gUnknown_0861D07C; -extern u8 gUnknown_08D97B84; -extern u8 gUnknown_08D97D0C; -extern void reset_temp_tile_data_buffers(); -extern void decompress_and_copy_tile_data_to_vram(u8 a, void* tiledata, u8 b, u8 c, u8 d); -extern u8 free_temp_tile_data_buffers_if_possible(); -extern void sub_8069004(struct BoxPokemon* a, void* b); -extern void sub_81C1E20(u8 taskId); -extern u8 *GetMonNickname(struct Pokemon *mon, u8 *dest); -extern u16 SpeciesToPokedexNum(u16 species); -extern u8 gText_UnkCtrlF908Clear01[]; -extern u8 gText_LevelSymbol[]; -extern u8 gText_PkmnInfo[]; -extern u8 gText_PkmnSkills[]; -extern u8 gText_BattleMoves[]; -extern u8 gText_ContestMoves[]; -extern u8 gText_Cancel2[]; -extern u8 gText_Info[]; -extern u8 gText_Switch[]; -extern u8 gText_RentalPkmn[]; -extern u8 gText_TypeSlash[]; -extern u8 gText_HP4[]; -extern u8 gText_Attack3[]; -extern u8 gText_Defense3[]; -extern u8 gText_SpAtk4[]; -extern u8 gText_SpDef4[]; -extern u8 gText_Speed2[]; -extern u8 gText_ExpPoints[]; -extern u8 gText_NextLv[]; -extern u8 gText_Status[]; -extern u8 gText_Power[]; -extern u8 gText_Accuracy2[]; -extern u8 gText_Appeal[]; -extern u8 gText_Jam[]; -extern u8 gText_OTSlash[]; -extern u8 gText_UnkCtrlF907F908[]; -extern u8 gAbilityNames[][13]; -extern u8 *gAbilityDescriptionPointers[]; -extern u8 gText_XNature[]; -extern u8 gText_XNatureHatchedAtYZ[]; -extern u8 gText_XNatureHatchedSomewhereAt[]; -extern u8 gText_XNatureMetAtYZ[]; -extern u8 gText_XNatureMetSomewhereAt[]; -extern u8 gText_XNatureFatefulEncounter[]; -extern u8 gText_XNatureProbablyMetAt[]; -extern u8 gText_XNatureObtainedInTrade[]; -extern u8 *gNatureNamePointers[]; -extern u8 gText_EmptyString5[]; -extern u32 gBattleTypeFlags; -extern u8 gText_FiveMarks[]; -extern u8 gText_EggWillTakeALongTime[]; -extern u8 gText_EggAboutToHatch[]; -extern u8 gText_EggWillHatchSoon[]; -extern u8 gText_EggWillTakeSomeTime[]; -extern u8 gText_PeculiarEggNicePlace[]; -extern u8 gText_PeculiarEggTrade[]; -extern u8 gText_EggFromTraveler[]; -extern u8 gText_EggFromHotSprings[]; -extern u8 gText_OddEggFoundByCouple[]; -extern u8 gText_None[]; -extern u8 gText_RibbonsVar1[]; -extern u8 gUnknown_0861CE82[]; -extern u8 gUnknown_0861CE8E[]; -extern u8 gText_OneDash[]; -extern u8 gText_TwoDashes[]; -extern u8 gText_ThreeDashes[]; -extern u8 gUnknown_0861CE97[]; -extern struct BattleMove gBattleMoves[]; - -extern u32 ChangeBgX(u8 bg, u32 value, u8 op); -extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f); -extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); -extern s32 GetStringCenterAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); -extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); -extern bool8 sub_81A6BF4(); -extern bool8 sub_81B9E94(); -extern void sub_81AFBF0(); -extern u8 sub_81AFC0C(u8 a, u8 *b); -extern void sub_81AFC28(u8 *a, u8 *b); -extern void sub_8124610(u8 *a, u8 b); -extern int GetPlayerIDAsU32(); -extern u8 GetCurrentPpToMaxPpState(u8 a, u8 b); - -void sub_81BFAE4(void); -void sub_81BFE24(); -u8 sub_81BFEB0(); -void sub_81C2554(); -void sub_81C1BA0(); -void sub_81C0098(struct Pokemon* a); -bool8 sub_81C00F0(struct Pokemon* a); -void sub_81C25E8(); -void sub_81C286C(); -void sub_81C2D9C(u8 a); -void sub_81C0348(); -void sub_81C2AFC(u8 a); -void sub_81C4190(); -void sub_81C42C8(); -u8 sub_81C45F4(void* a, u16* b); -void sub_81C4984(); -void sub_81C4A08(); -void sub_81C4A88(); -void sub_81C4280(); -void sub_81C0510(u8 taskId); -void sub_81C171C(u8 taskId); -void sub_8121E10(); -u8 sub_81B205C(struct Pokemon* a); -void sub_81C1DA4(u16 a, s16 b); -void sub_81C1EFC(u16 a, s16 b, u16 c); -void sub_81C240C(u16 a); -void sub_81C2194(u16 *a, u16 b, u8 c); -void sub_81C2074(u16 a, s16 b); -void sub_81C2524(); -void sub_81C2228(struct Pokemon* mon); -void sub_81C0484(u8 taskId); -void sub_81C4898(); -void sub_806F47C(u8 a); -u8 GetLRKeysState(); -void sub_81C0604(u8 taskId, s8 a); -void sub_81C0A8C(u8 taskId, s8 a); -void sub_81C48F0(); -void sub_81C0E48(u8 taskId); -void sub_81C0704(u8 taskId); -s8 sub_81C09B4(s8 a); -s8 sub_81C08F8(s8 a); -void sub_81C4204(u8 a, u8 b); -void sub_81C20F0(u8 taskId); -bool8 sub_81C0A50(struct Pokemon* mon); -void sub_81C49E0(); -void sub_81C0E24(); -void sub_81C2C38(u8 a); -void sub_81C0B8C(u8 taskId); -void sub_81C0CC4(u8 taskId); -void sub_81C2DE4(u8 a); -void sub_81C424C(); -void sub_81C0C68(u8 taskId); -void sub_81C0D44(u8 taskId); -void sub_81C22CC(struct Pokemon* mon); -void sub_81C0F44(u8 taskId); -void sub_81C3E9C(u16 a); -void sub_81C3F44(); -void sub_81C44F0(); -void sub_81C4AF8(u8 a); -void sub_81C1070(s16* a, s8 b, u8* c); -void sub_81C11F4(u8 a); -void sub_81C129C(u8 a); -bool8 sub_81C1040(); -void sub_81C4064(); -void sub_81C4C60(u8 a); -void sub_81C12E4(u8 taskId); -void sub_81C4C84(u8 a); -void sub_81C13B0(u8 a, u8 b); -void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); -void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); -void sub_81C40A0(u8 a, u8 b); -void sub_81C4568(u8 a, u8 b); -void sub_81C174C(u8 taskId); -bool8 sub_81C18A8(); -void sub_81C18F4(u8 a); -u8 sub_81B6D14(u16 a); -void sub_81C1940(u8 taskId); -void sub_81C4154(); -void sub_81C1F80(u8 taskId); -void sub_81C2628(); -void sub_81C2794(); -void sub_81C27DC(struct Pokemon *mon, u16 a); -void sub_81C2D68(u8 a); -void sub_81C335C(); -void sub_81C33CC(); -void sub_81C3428(); -void sub_81C349C(); -void sub_81C2EC4(); -void sub_81C2F5C(); -void sub_81C2FD8(); -void sub_81C302C(); -void sub_81C307C(); -void sub_81C3194(); -void sub_81C31C0(); -bool8 sub_81C3304(); -void sub_81C31F0(u8 *a); -u8 sub_81C3220(); -bool8 sub_81C32BC(); -void sub_81C35E4(); -void sub_81C3690(); -void sub_81C3710(); -void sub_81C37D8(); -void sub_81C3808(); -void sub_81C3890(); -void sub_81C38C0(); -void sub_81C3B08(u8 a); -void sub_81C3E2C(u8 a); -void sub_81C4D18(); - -void SetBgAttribute(u8 bg, u8 attributeId, u8 value); - -bool8 sub_81BFB10(); -u8 sub_81B1250(); - -union UnkUnion -{ - struct Pokemon mon[6]; - struct BoxPokemon boxMon[6]; -}; - - -u8 sub_80D214C(union UnkUnion* a, u8 b, u8 c, u8 d); - -struct PokeSummary -{ - u16 species; // 0x0 - u16 species2; // 0x2 - u8 isEgg; // 0x4 - u8 level; // 0x5 - u8 ribbons; // 0x6 - u8 unk7; // 0x7 - u8 altAbility; // 0x8 - u8 metLocation; // 0x9 - u8 metLevel; // 0xA - u8 metGame; // 0xB - u32 pid; // 0xC - u32 exp; // 0x10 - u16 moves[4]; // 0x14 - u8 pp[4]; // 0x1C - u16 currentHP; // 0x20 - u16 maxHP; // 0x22 - u16 atk; // 0x24 - u16 def; // 0x26 - u16 spatk; // 0x28 - u16 spdef; // 0x2A - u16 speed; // 0x2C - u16 item; // 0x2E - u16 friendship; // 0x30 - u8 OTGender; // 0x32 - u8 nature; // 0x33 - u8 ppBonuses; // 0x34 - u8 sanity; // 0x35 - u8 OTName[8]; // 0x36 - u8 unk3E[9]; // 0x3E - u32 OTID; // 0x48 -}; - -struct UnkSummaryStruct -{ - /*0x00*/ union UnkUnion *unk0; - /*0x04*/ void *unk4; - /*0x08*/ void *unk8; - /*0x0C*/ struct Pokemon currentMon; - /*0x70*/ struct PokeSummary summary; - u16 unkTilemap0[0x400]; - u16 unkTilemap0_1[0x400]; - u16 unkTilemap1[0x400]; - u16 unkTilemap1_1[0x400]; - u16 unkTilemap2[0x400]; - u16 unkTilemap2_1[0x400]; - u16 unkTilemap3[0x400]; - u16 unkTilemap3_1[0x400]; - u8 unk40BC; - u8 unk40BD; - u8 unk40BE; - u8 unk40BF; - u8 unk40C0; - u8 unk40C1; - u8 unk40C2; - u8 unk40C3; - u16 unk40C4; - u8 unk40C6; - u8 unk40C7; - u8 unk40C8; - u8 unk40C9; - u8 unk40CA; - u8 unk40CB[8]; - u8 unk40D3; - u8 unk40D4; - u8 unk40D5; - u8 unk_filler5[0x19]; - u8 unk40EF; - s16 unk40F0; - u8 unk_filler4[6]; -}; - -void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) -{ - u8 byte; - gUnknown_0203CF1C = AllocZeroed(sizeof(struct UnkSummaryStruct)); - gUnknown_0203CF1C->unk40BC = a; - gUnknown_0203CF1C->unk0 = b; - gUnknown_0203CF1C->unk40BE = c; - gUnknown_0203CF1C->unk40BF = d; - gUnknown_0203CF1C->unk4 = e; - if (a == 2) - gUnknown_0203CF1C->unk40BD = 1; - else - gUnknown_0203CF1C->unk40BD = 0; - switch (a) - { - case 0: - case 2: - gUnknown_0203CF1C->unk40C1 = 0; - gUnknown_0203CF1C->unk40C2 = 3; - break; - case 1: - gUnknown_0203CF1C->unk40C1 = 0; - gUnknown_0203CF1C->unk40C2 = 3; - gUnknown_0203CF1C->unk40C8 = 1; - break; - case 3: - gUnknown_0203CF1C->unk40C1 = 2; - gUnknown_0203CF1C->unk40C2 = 3; - gUnknown_0203CF1C->unk40C3 = 1; - break; - } - byte = gUnknown_0203CF1C->unk40C1; - gUnknown_0203CF1C->unk40C0 = byte; - sub_81C488C(0xFF); - if (gMonSpritesGfxPtr == 0) - sub_806F2AC(0, 0); - SetMainCallback2(sub_81BFAE4); -} - -void sub_81BFA38(void *a, u8 b, u8 c, void *d, u16 e) -{ - sub_81BF8EC(3, a, b, c, d); - gUnknown_0203CF1C->unk40C4 = e; -} - -void sub_81BFA80(u8 a, void *b, u8 c, u8 d, void *e) -{ - sub_81BF8EC(a, b, c, d, e); - gUnknown_0203CF1C->unk40EF = 1; -} - -void sub_81BFAB4(void) -{ - RunTasks(); - AnimateSprites(); - BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); - UpdatePaletteFade(); -} - -void sub_81BFAD0(void) -{ - LoadOam(); - ProcessSpriteCopyRequests(); - TransferPlttBuffer(); -} - -void sub_81BFAE4() -{ - while (1) - { - if (sub_81221EC() == 1 || sub_81BFB10() == TRUE || sub_81221AC() == 1) - break; - } -} - -bool8 sub_81BFB10(void) -{ - switch (gMain.state) - { - case 0: - SetVBlankHBlankCallbacksToNull(); - sub_8121DA0(); - clear_scheduled_bg_copies_to_vram(); - gMain.state++; - break; - case 1: - remove_some_task(); - gMain.state++; - break; - case 2: - ResetPaletteFade(); - gPaletteFade.bufferTransferDisabled = 1; - gMain.state++; - break; - case 3: - ResetSpriteData(); - gMain.state++; - break; - case 4: - FreeAllSpritePalettes(); - gMain.state++; - break; - case 5: - sub_81BFE24(); - gUnknown_0203CF1C->unk40F0 = 0; - gMain.state++; - break; - case 6: - if (sub_81BFEB0() != 0) - gMain.state++; - break; - case 7: - sub_81C2554(); - gMain.state++; - break; - case 8: - sub_81C1BA0(); - gMain.state++; - break; - case 9: - sub_81C0098(&gUnknown_0203CF1C->currentMon); - gUnknown_0203CF1C->unk40F0 = 0; - gMain.state++; - break; - case 10: - if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) != 0) - gMain.state++; - break; - case 11: - sub_81C25E8(); - gMain.state++; - break; - case 12: - sub_81C286C(); - gMain.state++; - break; - case 13: - sub_81C2D9C(gUnknown_0203CF1C->unk40C0); - gMain.state++; - break; - case 14: - sub_81C0348(); - gMain.state++; - break; - case 15: - sub_81C2AFC(gUnknown_0203CF1C->unk40C0); - gMain.state++; - break; - case 16: - sub_81C4190(); - sub_81C42C8(); - gUnknown_0203CF1C->unk40F0 = 0; - gMain.state++; - break; - case 17: - gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0); - if (gUnknown_0203CF1C->unk40D3 != 0xFF) - { - gUnknown_0203CF1C->unk40F0 = 0; - gMain.state++; - } - break; - case 18: - sub_81C4984(&gUnknown_0203CF1C->currentMon); - gMain.state++; - break; - case 19: - sub_81C4A08(&gUnknown_0203CF1C->currentMon); - gMain.state++; - break; - case 20: - sub_81C4A88(); - gMain.state++; - break; - case 21: - sub_81C4280(); - gMain.state++; - break; - case 22: - if (gUnknown_0203CF1C->unk40BC != 3) - CreateTask(sub_81C0510, 0); - else - CreateTask(sub_81C171C, 0); - gMain.state++; - break; - case 23: - BlendPalettes(-1, 16, 0); - gMain.state++; - break; - case 24: - BeginNormalPaletteFade(-1, 0, 16, 0, 0); - gPaletteFade.bufferTransferDisabled = 0; - gMain.state++; - break; - default: - SetVBlankCallback(sub_81BFAD0); - SetMainCallback2(sub_81BFAB4); - return TRUE; - } - return FALSE; -} - -void sub_81BFE24() -{ - ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, &gUnknown_0861CBB4, 4); - SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap2); - SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap1); - SetBgTilemapBuffer(3, &gUnknown_0203CF1C->unkTilemap0); - sub_8121E10(); - schedule_bg_copy_tilemap_to_vram(1); - schedule_bg_copy_tilemap_to_vram(2); - schedule_bg_copy_tilemap_to_vram(3); - SetGpuReg(REG_OFFSET_DISPCNT, 0x1040); - SetGpuReg(REG_OFFSET_BLDCNT, 0); - ShowBg(0); - ShowBg(1); - ShowBg(2); - ShowBg(3); -} - -u8 sub_81BFEB0() -{ - switch (gUnknown_0203CF1C->unk40F0) - { - case 0: - reset_temp_tile_data_buffers(); - decompress_and_copy_tile_data_to_vram(1, &gUnknown_08D97D0C, 0, 0, 0); - gUnknown_0203CF1C->unk40F0++; - break; - case 1: - if (free_temp_tile_data_buffers_if_possible() != 1) - { - LZDecompressWram(&gUnknown_08D9862C, gUnknown_0203CF1C->unkTilemap0); - gUnknown_0203CF1C->unk40F0++; - } - break; - case 2: - LZDecompressWram(&gUnknown_08D98CC8, gUnknown_0203CF1C->unkTilemap0_1); - gUnknown_0203CF1C->unk40F0++; - break; - case 3: - LZDecompressWram(&gUnknown_08D987FC, gUnknown_0203CF1C->unkTilemap1_1); - gUnknown_0203CF1C->unk40F0++; - break; - case 4: - LZDecompressWram(&gUnknown_08D9898C, gUnknown_0203CF1C->unkTilemap2_1); - gUnknown_0203CF1C->unk40F0++; - break; - case 5: - LZDecompressWram(&gUnknown_08D98B28, gUnknown_0203CF1C->unkTilemap3_1); - gUnknown_0203CF1C->unk40F0++; - break; - case 6: - LoadCompressedPalette(&gUnknown_08D9853C, 0, 0x100); - LoadPalette(&gUnknown_08D85620, 0x81, 0x1E); - gUnknown_0203CF1C->unk40F0++; - break; - case 7: - LoadCompressedObjectPic(&gUnknown_0861CFBC); - gUnknown_0203CF1C->unk40F0++; - break; - case 8: - LoadCompressedObjectPic(&gUnknown_0861D074); - gUnknown_0203CF1C->unk40F0++; - break; - case 9: - LoadCompressedObjectPic(&gUnknown_0861D0F8); - gUnknown_0203CF1C->unk40F0++; - break; - case 10: - LoadCompressedObjectPalette(&gUnknown_0861D100); - gUnknown_0203CF1C->unk40F0++; - break; - case 11: - LoadCompressedObjectPalette(&gUnknown_0861D07C); - gUnknown_0203CF1C->unk40F0++; - break; - case 12: - LoadCompressedPalette(&gUnknown_08D97B84, 0x1D0, 0x60); - gUnknown_0203CF1C->unk40F0 = 0; - return 1; - } - return 0; -} - -void sub_81C0098(struct Pokemon *mon) -{ - if (gUnknown_0203CF1C->unk40BD == 0) - { - struct Pokemon *partyMon = gUnknown_0203CF1C->unk0->mon; - *mon = partyMon[gUnknown_0203CF1C->unk40BE]; - } - else - { - struct BoxPokemon *boxMon = gUnknown_0203CF1C->unk0->boxMon; - sub_8069004(&boxMon[gUnknown_0203CF1C->unk40BE], mon); - } -} - -bool8 sub_81C00F0(struct Pokemon *a) -{ - u32 i; - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - switch (gUnknown_0203CF1C->unk40F0) - { - case 0: - sum->species = GetMonData(a, MON_DATA_SPECIES); - sum->species2 = GetMonData(a, MON_DATA_SPECIES2); - sum->exp = GetMonData(a, MON_DATA_EXP); - sum->level = GetMonData(a, MON_DATA_LEVEL); - sum->altAbility = GetMonData(a, MON_DATA_ALT_ABILITY); - sum->item = GetMonData(a, MON_DATA_HELD_ITEM); - sum->pid = GetMonData(a, MON_DATA_PERSONALITY); - sum->sanity = GetMonData(a, MON_DATA_SANITY_BIT1); - if (sum->sanity != 0) - sum->isEgg = 1; - else - sum->isEgg = GetMonData(a, MON_DATA_IS_EGG); - break; - case 1: - for (i = 0; i < 4; i++) - { - sum->moves[i] = GetMonData(a, MON_DATA_MOVE1+i); - sum->pp[i] = GetMonData(a, MON_DATA_PP1+i); - } - sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES); - break; - case 2: - if ((struct Pokemon*)gUnknown_0203CF1C->unk0 == gPlayerParty || gUnknown_0203CF1C->unk40BC == 2 || gUnknown_0203CF1C->unk40EF == 1) - { - sum->nature = GetNature(a); - sum->currentHP = GetMonData(a, MON_DATA_HP); - sum->maxHP = GetMonData(a, MON_DATA_MAX_HP); - sum->atk = GetMonData(a, MON_DATA_ATK); - sum->def = GetMonData(a, MON_DATA_DEF); - sum->spatk = GetMonData(a, MON_DATA_SPATK); - sum->spdef = GetMonData(a, MON_DATA_SPDEF); - sum->speed = GetMonData(a, MON_DATA_SPD); - } - else - { - sum->nature = GetNature(a); - sum->currentHP = GetMonData(a, MON_DATA_HP); - sum->maxHP = GetMonData(a, MON_DATA_MAX_HP); - sum->atk = GetMonData(a, MON_DATA_ATK2); - sum->def = GetMonData(a, MON_DATA_DEF2); - sum->spatk = GetMonData(a, MON_DATA_SPATK2); - sum->spdef = GetMonData(a, MON_DATA_SPDEF2); - sum->speed = GetMonData(a, MON_DATA_SPD2); - } - break; - case 3: - GetMonData(a, MON_DATA_OT_NAME, &sum->OTName); - ConvertInternationalString((u8*)&sum->OTName, GetMonData(a, MON_DATA_LANGUAGE)); - sum->unk7 = sub_81B205C(a); - sum->OTGender = GetMonData(a, MON_DATA_OT_GENDER); - sum->OTID = GetMonData(a, MON_DATA_OT_ID); - sum->metLocation = GetMonData(a, MON_DATA_MET_LOCATION); - sum->metLevel = GetMonData(a, MON_DATA_MET_LEVEL); - sum->metGame = GetMonData(a, MON_DATA_MET_GAME); - sum->friendship = GetMonData(a, MON_DATA_FRIENDSHIP); - break; - default: - sum->ribbons = GetMonData(a, MON_DATA_RIBBON_COUNT); - return TRUE; - } - gUnknown_0203CF1C->unk40F0++; - return FALSE; -} - -void sub_81C0348(void) -{ - if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) - { - sub_81C1DA4(0, 255); - sub_81C1EFC(0, 255, 0); - } - else - { - sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); - SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap3); - SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap2); - ChangeBgX(2, 0x10000, 1); - ClearWindowTilemap(0x13); - ClearWindowTilemap(0xD); - } - if (gUnknown_0203CF1C->summary.unk7 == 0) - { - sub_81C2074(0, 0xFF); - } - else - { - if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) - PutWindowTilemap(0xD); - } - sub_81C2524(); - sub_81C2228(&gUnknown_0203CF1C->currentMon); -} - -void sub_81C0434() -{ - FreeAllWindowBuffers(); - Free(gUnknown_0203CF1C); -} - -void sub_81C044C(u8 taskId) -{ - BeginNormalPaletteFade(-1, 0, 0, 16, 0); - gTasks[taskId].func = sub_81C0484; -} - -void sub_81C0484(u8 taskId) -{ - if (sub_81221EC() != 1 && !gPaletteFade.active) - { - SetMainCallback2(gUnknown_0203CF1C->unk4); - gUnknown_0203CF20 = gUnknown_0203CF1C->unk40BE; - sub_81C4898(); - ResetSpriteData(); - FreeAllSpritePalettes(); - StopCryAndClearCrySongs(); - m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); - if (gMonSpritesGfxPtr == 0) - sub_806F47C(0); - sub_81C0434(); - DestroyTask(taskId); - } -} - -void sub_81C0510(u8 taskId) -{ - if (sub_81221EC() != 1 && !gPaletteFade.active) - { - if (gMain.newKeys & DPAD_UP) - { - sub_81C0604(taskId, -1); - } - else if (gMain.newKeys & DPAD_DOWN) - { - sub_81C0604(taskId, 1); - } - else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysState() == 1) - { - sub_81C0A8C(taskId, -1); - } - else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysState() == 2) - { - sub_81C0A8C(taskId, 1); - } - else if (gMain.newKeys & A_BUTTON) - { - if (gUnknown_0203CF1C->unk40C0 != 1) - { - if (gUnknown_0203CF1C->unk40C0 == 0) - { - sub_81C48F0(); - PlaySE(SE_SELECT); - sub_81C044C(taskId); - } - else - { - PlaySE(SE_SELECT); - sub_81C0E48(taskId); - } - } - } - else if (gMain.newKeys & B_BUTTON) - { - sub_81C48F0(); - PlaySE(SE_SELECT); - sub_81C044C(taskId); - } - } -} - -void sub_81C0604(u8 taskId, s8 a) -{ - s8 r4_2; - - if (gUnknown_0203CF1C->unk40C3 == 0) - { - if (gUnknown_0203CF1C->unk40BD == 1) - { - if (gUnknown_0203CF1C->unk40C0 != 0) - { - if (a == 1) - a = 0; - else - a = 2; - } - else - { - if (a == 1) - a = 1; - else - a = 3; - } - r4_2 = sub_80D214C(gUnknown_0203CF1C->unk0, gUnknown_0203CF1C->unk40BE, gUnknown_0203CF1C->unk40BF, a); - } - else if (sub_81B1250() == 1) - { - r4_2 = sub_81C09B4(a); - } - else - { - r4_2 = sub_81C08F8(a); - } - - if (r4_2 != -1) - { - PlaySE(SE_SELECT); - if (gUnknown_0203CF1C->summary.unk7 != 0) - { - sub_81C4204(2, 1); - ClearWindowTilemap(0xD); - schedule_bg_copy_tilemap_to_vram(0); - sub_81C2074(0, 2); - } - gUnknown_0203CF1C->unk40BE = r4_2; - gTasks[taskId].data[0] = 0; - gTasks[taskId].func = sub_81C0704; - } - } -} - -void sub_81C0704(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - - switch (data[0]) - { - case 0: - StopCryAndClearCrySongs(); - break; - case 1: - sub_81C4898(); - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3]); - break; - case 2: - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D4]); - break; - case 3: - sub_81C0098(&gUnknown_0203CF1C->currentMon); - gUnknown_0203CF1C->unk40F0 = 0; - break; - case 4: - if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) == FALSE) - return; - break; - case 5: - sub_81C49E0(&gUnknown_0203CF1C->currentMon); - break; - case 6: - sub_81C4A08(&gUnknown_0203CF1C->currentMon); - break; - case 7: - if (gUnknown_0203CF1C->summary.unk7) - sub_81C2074(10, -2); - sub_81C2228(&gUnknown_0203CF1C->currentMon); - data[1] = 0; - break; - case 8: - gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]); - if (gUnknown_0203CF1C->unk40D3 == 0xFF) - return; - gSprites[gUnknown_0203CF1C->unk40D3].data2 = 1; - sub_81C0E24(); - data[1] = 0; - break; - case 9: - sub_81C4280(); - break; - case 10: - sub_81C25E8(); - break; - case 11: - sub_81C2D9C(gUnknown_0203CF1C->unk40C0); - sub_81C2524(); - break; - case 12: - gSprites[gUnknown_0203CF1C->unk40D3].data2 = 0; - break; - default: - if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0) - { - data[0] = 0; - gTasks[taskId].func = sub_81C0510; - } - return; - } - data[0]++; -} - -s8 sub_81C08F8(s8 a) -{ - struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; - - if (gUnknown_0203CF1C->unk40C0 == 0) - { - if (a == -1 && gUnknown_0203CF1C->unk40BE == 0) - return -1; - if (a == 1 && gUnknown_0203CF1C->unk40BE >= gUnknown_0203CF1C->unk40BF) - return -1; - return gUnknown_0203CF1C->unk40BE + a; - } - else - { - s8 index = gUnknown_0203CF1C->unk40BE; - - do - { - index += a; - if (index < 0 || index > gUnknown_0203CF1C->unk40BF) - return -1; - } while (GetMonData(&mon[index], MON_DATA_IS_EGG) != 0); - return index; - } -} - -s8 sub_81C09B4(s8 a) -{ - struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; - s8 r5 = 0; - u8 i; - - for (i = 0; i < 6; i++) - { - if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->unk40BE) - { - r5 = i; - break; - } - } - - while (1) - { - int b; - s8* c = &gUnknown_0861CC1C[0]; - - r5 += a; - if (r5 < 0 || r5 >= 6) - return -1; - b = c[r5]; - if (sub_81C0A50(&mon[b]) == TRUE) - return b; - } -} - -bool8 sub_81C0A50(struct Pokemon* mon) -{ - if (GetMonData(mon, MON_DATA_SPECIES) == 0) - return FALSE; - else if (gUnknown_0203CF1C->unk40BE != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) - return TRUE; - else - return FALSE; -} - -void sub_81C0A8C(u8 taskId, s8 b) -{ - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; - s16 *data = gTasks[taskId].data; - - if (summary->isEgg) - return; - if (b == -1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C1) - return; - if (b == 1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C2) - return; - PlaySE(SE_SELECT); - sub_81C2C38(gUnknown_0203CF1C->unk40C0); - gUnknown_0203CF1C->unk40C0 += b; - data[0] = 0; - if (b == 1) - SetTaskFuncWithFollowupFunc(taskId, sub_81C0B8C, gTasks[taskId].func); - else - SetTaskFuncWithFollowupFunc(taskId, sub_81C0CC4, gTasks[taskId].func); - sub_81C2DE4(gUnknown_0203CF1C->unk40C0); - sub_81C424C(); -} - -void sub_81C0B8C(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - if (data[0] == 0) - { - if (gUnknown_0203CF1C->unk40C9 == 0) - { - data[1] = 1; - SetBgAttribute(1, 7, 1); - SetBgAttribute(2, 7, 2); - schedule_bg_copy_tilemap_to_vram(1); - } - else - { - data[1] = 2; - SetBgAttribute(2, 7, 1); - SetBgAttribute(1, 7, 2); - schedule_bg_copy_tilemap_to_vram(2); - } - ChangeBgX(data[1], 0, 0); - SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xBC)); - ShowBg(1); - ShowBg(2); - } - ChangeBgX(data[1], 0x2000, 1); - data[0] += 32; - if (data[0] > 0xFF) - gTasks[taskId].func = sub_81C0C68; -} - -void sub_81C0C68(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - gUnknown_0203CF1C->unk40C9 ^= 1; - data[1] = 0; - data[0] = 0; - sub_81C1BA0(); - sub_81C2AFC(gUnknown_0203CF1C->unk40C0); - sub_81C4280(); - sub_81C0E24(); - SwitchTaskToFollowupFunc(taskId); -} - -void sub_81C0CC4(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - if (data[0] == 0) - { - if (gUnknown_0203CF1C->unk40C9 == 0) - data[1] = 2; - else - data[1] = 1; - ChangeBgX(data[1], 0x10000, 0); - } - ChangeBgX(data[1], 0x2000, 2); - data[0] += 32; - if (data[0] > 0xFF) - gTasks[taskId].func = sub_81C0D44; -} - -void sub_81C0D44(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - if (gUnknown_0203CF1C->unk40C9 == 0) - { - SetBgAttribute(1, 7, 1); - SetBgAttribute(2, 7, 2); - schedule_bg_copy_tilemap_to_vram(2); - } - else - { - SetBgAttribute(2, 7, 1); - SetBgAttribute(1, 7, 2); - schedule_bg_copy_tilemap_to_vram(1); - } - if (gUnknown_0203CF1C->unk40C0 > 1) - { - SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xFFFFF0BC)); - ChangeBgX(data[1], 0x10000, 0); - } - ShowBg(1); - ShowBg(2); - gUnknown_0203CF1C->unk40C9 ^= 1; - data[1] = 0; - data[0] = 0; - sub_81C1BA0(); - sub_81C2AFC(gUnknown_0203CF1C->unk40C0); - sub_81C4280(); - sub_81C0E24(); - SwitchTaskToFollowupFunc(taskId); -} - -void sub_81C0E24() -{ - if (gUnknown_0203CF1C->unk40C0 == 1) - sub_81C22CC(&gUnknown_0203CF1C->currentMon); -} - -void sub_81C0E48(u8 taskId) -{ - u16 move; - gUnknown_0203CF1C->unk40C6 = 0; - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; - ClearWindowTilemap(0x13); - if (gSprites[gUnknown_0203CF1C->unk40D5].invisible == 0) - ClearWindowTilemap(0xD); - sub_81C1DA4(9, -3); - sub_81C1EFC(9, -3, move); - if (gUnknown_0203CF1C->unk40C8 == 0) - { - ClearWindowTilemap(5); - PutWindowTilemap(6); - } - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); - sub_81C3E9C(move); - sub_81C3F44(); - sub_81C44F0(); - schedule_bg_copy_tilemap_to_vram(0); - schedule_bg_copy_tilemap_to_vram(1); - schedule_bg_copy_tilemap_to_vram(2); - sub_81C4AF8(8); - gTasks[taskId].func = sub_81C0F44; -} - -void sub_81C0F44(u8 taskId) -{ - u8 id = taskId; - s16 *data = gTasks[taskId].data; - - if (sub_81221EC() != 1) - { - if (gMain.newKeys & DPAD_UP) - { - data[0] = 4; - sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); - } - else if (gMain.newKeys & DPAD_DOWN) - { - data[0] = 4; - sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); - } - else if (gMain.newKeys & A_BUTTON) - { - if (gUnknown_0203CF1C->unk40C8 == 1 - || (gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - { - PlaySE(SE_SELECT); - sub_81C11F4(taskId); - } - else if (sub_81C1040() == TRUE) - { - PlaySE(SE_SELECT); - sub_81C129C(taskId); - } - else - { - PlaySE(SE_HAZURE); - } - } - else if (gMain.newKeys & B_BUTTON) - { - PlaySE(SE_SELECT); - sub_81C11F4(id); - } - } -} - -bool8 sub_81C1040(void) -{ - u8 i; - for (i = 1; i < 4; i++) - { - if (gUnknown_0203CF1C->summary.moves[i] != 0) - return TRUE; - } - return FALSE; -} - -void sub_81C1070(s16 *a, s8 b, u8 *c) -{ - s8 i; - s8 moveIndex; - u16 move; - - PlaySE(SE_SELECT); - moveIndex = *c; - for (i = 0; i < 4; i++) - { - moveIndex += b; - if (moveIndex > a[0]) - moveIndex = 0; - else if (moveIndex < 0) - moveIndex = a[0]; - if (moveIndex == 4) - { - move = gUnknown_0203CF1C->unk40C4; - break; - } - move = gUnknown_0203CF1C->summary.moves[moveIndex]; - if (move != 0) - break; - } - sub_81C240C(move); - schedule_bg_copy_tilemap_to_vram(1); - schedule_bg_copy_tilemap_to_vram(2); - sub_81C3E9C(move); - if ((*c == 4 && gUnknown_0203CF1C->unk40C4 == 0) || a[1] == 1) - { - ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) - ClearWindowTilemap(13); - schedule_bg_copy_tilemap_to_vram(0); - sub_81C1DA4(9, -3); - sub_81C1EFC(9, -3, move); - } - if (*c != 4 && moveIndex == 4 && gUnknown_0203CF1C->unk40C4 == 0) - { - ClearWindowTilemap(14); - ClearWindowTilemap(15); - schedule_bg_copy_tilemap_to_vram(0); - sub_81C1DA4(0, 3); - sub_81C1EFC(0, 3, 0); - } - *c = moveIndex; - if (c == &gUnknown_0203CF1C->unk40C6) - sub_81C4D18(8); - else - sub_81C4D18(18); -} - -void sub_81C11F4(u8 taskId) -{ - sub_81C4C60(8); - ClearWindowTilemap(6); - PutWindowTilemap(5); - sub_81C3E9C(0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 1); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 1); - sub_81C4064(); - if (gUnknown_0203CF1C->unk40C6 != 4) - { - ClearWindowTilemap(14); - ClearWindowTilemap(15); - sub_81C1DA4(0, 3); - sub_81C1EFC(0, 3, 0); - } - schedule_bg_copy_tilemap_to_vram(0); - schedule_bg_copy_tilemap_to_vram(1); - schedule_bg_copy_tilemap_to_vram(2); - gTasks[taskId].func = sub_81C0510; -} - -void sub_81C129C(u8 taskId) -{ - gUnknown_0203CF1C->unk40C7 = gUnknown_0203CF1C->unk40C6; - sub_81C4C84(1); - sub_81C4AF8(18); - gTasks[taskId].func = sub_81C12E4; -} - -void sub_81C12E4(u8 taskId) -{ - u8 a = taskId; - s16* data = gTasks[taskId].data; - if (sub_81221EC() != 1) - { - if (gMain.newKeys & DPAD_UP) - { - data[0] = 3; - sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C7); - } - else if (gMain.newKeys & DPAD_DOWN) - { - data[0] = 3; - sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C7); - } - else if (gMain.newKeys & A_BUTTON) - { - if (gUnknown_0203CF1C->unk40C6 == gUnknown_0203CF1C->unk40C7) - { - sub_81C13B0(taskId, 0); - } - else - sub_81C13B0(taskId, 1); - } - else if (gMain.newKeys & B_BUTTON) - sub_81C13B0(a, 0); - } -} - -void sub_81C13B0(u8 taskId, u8 b) -{ - u16 move; - PlaySE(SE_SELECT); - sub_81C4C84(0); - sub_81C4C60(18); - if (b == 1) - { - if (gUnknown_0203CF1C->unk40BD == 0) - { - struct Pokemon *why = gUnknown_0203CF1C->unk0->mon; - sub_81C14BC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); - } - else - { - struct BoxPokemon *why = gUnknown_0203CF1C->unk0->boxMon; - sub_81C15EC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); - } - sub_81C0098(&gUnknown_0203CF1C->currentMon); - sub_81C40A0(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); - sub_81C4568(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); - gUnknown_0203CF1C->unk40C6 = gUnknown_0203CF1C->unk40C7; - } - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; - sub_81C3E9C(move); - sub_81C240C(move); - schedule_bg_copy_tilemap_to_vram(1); - schedule_bg_copy_tilemap_to_vram(2); - gTasks[taskId].func = sub_81C0F44; -} - - -#ifdef NONMATCHING -void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) -{ - u16 localMoveTo; - u16 localMoveFrom; - u8 localPpTo; - u8 localPpFrom; - u8 localPpBonuses; - u16* moveFromPtr; - u16* moveToPtr; - u8* ppFromPtr; - u8* ppToPtr; - u8* ppBonusesPtr; - - moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; - localMoveFrom = *moveFromPtr; - - moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; - localMoveTo = *moveToPtr; - - ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; - localPpFrom = *ppFromPtr; - - ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; - localPpTo = *ppToPtr; - - ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses; - localPpBonuses = *ppBonusesPtr; - -{ - u8 bitsFrom, bitsTo; - - bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1); - bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1); - - - localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]); - localPpBonuses &= ~(gUnknown_08329D22[swappingToId]); - - localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1))); -} - - SetMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo); - SetMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom); - - SetMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo); - SetMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom); - - SetMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); - - *moveFromPtr = localMoveTo; - *moveToPtr = localMoveFrom; - - *ppFromPtr = localPpTo; - *ppToPtr = localPpFrom; - - *ppBonusesPtr = localPpBonuses; -} -#else -__attribute__((naked)) -void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x28\n\ - adds r7, r0, 0\n\ - adds r4, r1, 0\n\ - adds r6, r2, 0\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - lsls r6, 24\n\ - lsrs r6, 24\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r2, [r0]\n\ - lsls r0, r4, 1\n\ - mov r10, r0\n\ - adds r1, r2, 0\n\ - adds r1, 0x84\n\ - adds r0, r1, r0\n\ - str r0, [sp, 0x8]\n\ - ldrh r0, [r0]\n\ - mov r3, sp\n\ - adds r3, 0x2\n\ - str r3, [sp, 0x1C]\n\ - strh r0, [r3]\n\ - lsls r0, r6, 1\n\ - mov r9, r0\n\ - add r1, r9\n\ - str r1, [sp, 0xC]\n\ - ldrh r1, [r1]\n\ - mov r0, sp\n\ - strh r1, [r0]\n\ - adds r1, r2, 0\n\ - adds r1, 0x8C\n\ - adds r3, r1, r4\n\ - str r3, [sp, 0x10]\n\ - ldrb r0, [r3]\n\ - mov r3, sp\n\ - adds r3, 0x5\n\ - str r3, [sp, 0x24]\n\ - strb r0, [r3]\n\ - adds r1, r6\n\ - str r1, [sp, 0x14]\n\ - ldrb r0, [r1]\n\ - mov r1, sp\n\ - adds r1, 0x4\n\ - str r1, [sp, 0x20]\n\ - strb r0, [r1]\n\ - adds r2, 0xA4\n\ - str r2, [sp, 0x18]\n\ - ldrb r0, [r2]\n\ - mov r5, sp\n\ - adds r5, 0x6\n\ - strb r0, [r5]\n\ - ldr r1, =gUnknown_08329D22\n\ - adds r0, r4, r1\n\ - ldrb r0, [r0]\n\ - mov r8, r0\n\ - ldrb r0, [r5]\n\ - adds r2, r0, 0\n\ - mov r3, r8\n\ - ands r2, r3\n\ - mov r3, r10\n\ - asrs r2, r3\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - adds r1, r6, r1\n\ - ldrb r1, [r1]\n\ - mov r12, r1\n\ - adds r1, r0, 0\n\ - mov r3, r12\n\ - ands r1, r3\n\ - mov r3, r9\n\ - asrs r1, r3\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - mov r3, r8\n\ - bics r0, r3\n\ - strb r0, [r5]\n\ - ldrb r0, [r5]\n\ - mov r3, r12\n\ - bics r0, r3\n\ - strb r0, [r5]\n\ - mov r0, r9\n\ - lsls r2, r0\n\ - mov r3, r10\n\ - lsls r1, r3\n\ - adds r2, r1\n\ - ldrb r0, [r5]\n\ - orrs r0, r2\n\ - strb r0, [r5]\n\ - adds r1, r4, 0\n\ - adds r1, 0xD\n\ - adds r0, r7, 0\n\ - mov r2, sp\n\ - bl SetMonData\n\ - adds r1, r6, 0\n\ - adds r1, 0xD\n\ - adds r0, r7, 0\n\ - ldr r2, [sp, 0x1C]\n\ - bl SetMonData\n\ - adds r4, 0x11\n\ - adds r0, r7, 0\n\ - adds r1, r4, 0\n\ - ldr r2, [sp, 0x20]\n\ - bl SetMonData\n\ - adds r6, 0x11\n\ - adds r0, r7, 0\n\ - adds r1, r6, 0\n\ - ldr r2, [sp, 0x24]\n\ - bl SetMonData\n\ - adds r0, r7, 0\n\ - movs r1, 0x15\n\ - adds r2, r5, 0\n\ - bl SetMonData\n\ - mov r0, sp\n\ - ldrh r0, [r0]\n\ - ldr r1, [sp, 0x8]\n\ - strh r0, [r1]\n\ - ldr r3, [sp, 0x1C]\n\ - ldrh r0, [r3]\n\ - ldr r1, [sp, 0xC]\n\ - strh r0, [r1]\n\ - ldr r3, [sp, 0x20]\n\ - ldrb r0, [r3]\n\ - ldr r1, [sp, 0x10]\n\ - strb r0, [r1]\n\ - ldr r3, [sp, 0x24]\n\ - ldrb r0, [r3]\n\ - ldr r1, [sp, 0x14]\n\ - strb r0, [r1]\n\ - ldrb r0, [r5]\n\ - ldr r3, [sp, 0x18]\n\ - strb r0, [r3]\n\ - add sp, 0x28\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif - -#ifdef NONMATCHING -void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) -{ - u16 localMoveTo; - u16 localMoveFrom; - u8 localPpTo; - u8 localPpFrom; - u8 localPpBonuses; - u16* moveFromPtr; - u16* moveToPtr; - u8* ppFromPtr; - u8* ppToPtr; - u8* ppBonusesPtr; - - moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; - localMoveFrom = *moveFromPtr; - - moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; - localMoveTo = *moveToPtr; - - ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; - localPpFrom = *ppFromPtr; - - ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; - localPpTo = *ppToPtr; - - ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses; - localPpBonuses = *ppBonusesPtr; - -{ - u8 bitsFrom, bitsTo; - - bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1); - bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1); - - - localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]); - localPpBonuses &= ~(gUnknown_08329D22[swappingToId]); - - localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1))); -} - - SetBoxMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo); - SetBoxMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom); - - SetBoxMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo); - SetBoxMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom); - - SetBoxMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); - - *moveFromPtr = localMoveTo; - *moveToPtr = localMoveFrom; - - *ppFromPtr = localPpTo; - *ppToPtr = localPpFrom; - - *ppBonusesPtr = localPpBonuses; -} -#else -__attribute__((naked)) -void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x28\n\ - adds r7, r0, 0\n\ - adds r4, r1, 0\n\ - adds r6, r2, 0\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - lsls r6, 24\n\ - lsrs r6, 24\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r2, [r0]\n\ - lsls r0, r4, 1\n\ - mov r10, r0\n\ - adds r1, r2, 0\n\ - adds r1, 0x84\n\ - adds r0, r1, r0\n\ - str r0, [sp, 0x8]\n\ - ldrh r0, [r0]\n\ - mov r3, sp\n\ - adds r3, 0x2\n\ - str r3, [sp, 0x1C]\n\ - strh r0, [r3]\n\ - lsls r0, r6, 1\n\ - mov r9, r0\n\ - add r1, r9\n\ - str r1, [sp, 0xC]\n\ - ldrh r1, [r1]\n\ - mov r0, sp\n\ - strh r1, [r0]\n\ - adds r1, r2, 0\n\ - adds r1, 0x8C\n\ - adds r3, r1, r4\n\ - str r3, [sp, 0x10]\n\ - ldrb r0, [r3]\n\ - mov r3, sp\n\ - adds r3, 0x5\n\ - str r3, [sp, 0x24]\n\ - strb r0, [r3]\n\ - adds r1, r6\n\ - str r1, [sp, 0x14]\n\ - ldrb r0, [r1]\n\ - mov r1, sp\n\ - adds r1, 0x4\n\ - str r1, [sp, 0x20]\n\ - strb r0, [r1]\n\ - adds r2, 0xA4\n\ - str r2, [sp, 0x18]\n\ - ldrb r0, [r2]\n\ - mov r5, sp\n\ - adds r5, 0x6\n\ - strb r0, [r5]\n\ - ldr r1, =gUnknown_08329D22\n\ - adds r0, r4, r1\n\ - ldrb r0, [r0]\n\ - mov r8, r0\n\ - ldrb r0, [r5]\n\ - adds r2, r0, 0\n\ - mov r3, r8\n\ - ands r2, r3\n\ - mov r3, r10\n\ - asrs r2, r3\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - adds r1, r6, r1\n\ - ldrb r1, [r1]\n\ - mov r12, r1\n\ - adds r1, r0, 0\n\ - mov r3, r12\n\ - ands r1, r3\n\ - mov r3, r9\n\ - asrs r1, r3\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - mov r3, r8\n\ - bics r0, r3\n\ - strb r0, [r5]\n\ - ldrb r0, [r5]\n\ - mov r3, r12\n\ - bics r0, r3\n\ - strb r0, [r5]\n\ - mov r0, r9\n\ - lsls r2, r0\n\ - mov r3, r10\n\ - lsls r1, r3\n\ - adds r2, r1\n\ - ldrb r0, [r5]\n\ - orrs r0, r2\n\ - strb r0, [r5]\n\ - adds r1, r4, 0\n\ - adds r1, 0xD\n\ - adds r0, r7, 0\n\ - mov r2, sp\n\ - bl SetBoxMonData\n\ - adds r1, r6, 0\n\ - adds r1, 0xD\n\ - adds r0, r7, 0\n\ - ldr r2, [sp, 0x1C]\n\ - bl SetBoxMonData\n\ - adds r4, 0x11\n\ - adds r0, r7, 0\n\ - adds r1, r4, 0\n\ - ldr r2, [sp, 0x20]\n\ - bl SetBoxMonData\n\ - adds r6, 0x11\n\ - adds r0, r7, 0\n\ - adds r1, r6, 0\n\ - ldr r2, [sp, 0x24]\n\ - bl SetBoxMonData\n\ - adds r0, r7, 0\n\ - movs r1, 0x15\n\ - adds r2, r5, 0\n\ - bl SetBoxMonData\n\ - mov r0, sp\n\ - ldrh r0, [r0]\n\ - ldr r1, [sp, 0x8]\n\ - strh r0, [r1]\n\ - ldr r3, [sp, 0x1C]\n\ - ldrh r0, [r3]\n\ - ldr r1, [sp, 0xC]\n\ - strh r0, [r1]\n\ - ldr r3, [sp, 0x20]\n\ - ldrb r0, [r3]\n\ - ldr r1, [sp, 0x10]\n\ - strb r0, [r1]\n\ - ldr r3, [sp, 0x24]\n\ - ldrb r0, [r3]\n\ - ldr r1, [sp, 0x14]\n\ - strb r0, [r1]\n\ - ldrb r0, [r5]\n\ - ldr r3, [sp, 0x18]\n\ - strb r0, [r3]\n\ - add sp, 0x28\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif - -void sub_81C171C(u8 taskId) -{ - sub_81C44F0(); - sub_81C4AF8(8); - gTasks[taskId].func = sub_81C174C; -} - -void sub_81C174C(u8 taskId) -{ - s16* data = gTasks[taskId].data; - - if (sub_81221EC() != 1) - { - if (gPaletteFade.active != 1) - { - if (gMain.newKeys & DPAD_UP) - { - data[0] = 4; - sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); - } - else if (gMain.newKeys & DPAD_DOWN) - { - data[0] = 4; - sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); - } - else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) - { - sub_81C0A8C(taskId, -1); - } - else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2) - { - sub_81C0A8C(taskId, 1); - } - else if (gMain.newKeys & A_BUTTON) - { - if (sub_81C18A8() == TRUE) - { - sub_81C48F0(); - PlaySE(SE_SELECT); - gUnknown_0203CF21 = gUnknown_0203CF1C->unk40C6; - gSpecialVar_0x8005 = gUnknown_0203CF21; - sub_81C044C(taskId); - } - else - { - PlaySE(0x20); - sub_81C18F4(taskId); - } - } - else if (gMain.newKeys & B_BUTTON) - { - u32 var1; - sub_81C48F0(); - PlaySE(SE_SELECT); - gUnknown_0203CF21 = 4; - gSpecialVar_0x8005 = 4; - sub_81C044C(taskId); - } - } - } -} - -bool8 sub_81C18A8() -{ - if (gUnknown_0203CF1C->unk40C6 == 4 || gUnknown_0203CF1C->unk40C4 == 0 || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]) != 1) - return TRUE; - else - return FALSE; -} - -void sub_81C18F4(u8 taskId) -{ - ClearWindowTilemap(14); - ClearWindowTilemap(15); - schedule_bg_copy_tilemap_to_vram(0); - sub_81C1DA4(0, 3); - sub_81C1EFC(0, 3, 0); - sub_81C4154(); - gTasks[taskId].func = sub_81C1940; -} - -void sub_81C1940(u8 taskId) -{ - s16* data = gTasks[taskId].data; - u16 move; - if (FuncIsActiveTask(sub_81C1E20) != 1) - { - if (gMain.newKeys & DPAD_UP) - { - data[1] = 1; - data[0] = 4; - sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C6); - data[1] = 0; - gTasks[taskId].func = sub_81C174C; - } - else if (gMain.newKeys & DPAD_DOWN) - { - data[1] = 1; - data[0] = 4; - sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C6); - data[1] = 0; - gTasks[taskId].func = sub_81C174C; - } - else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) - { - if (gUnknown_0203CF1C->unk40C0 != 2) - { - - ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) - ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; - gTasks[taskId].func = sub_81C174C; - sub_81C0A8C(taskId, -1); - sub_81C1DA4(9, -2); - sub_81C1EFC(9, -2, move); - } - } - else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2) - { - if (gUnknown_0203CF1C->unk40C0 != 3) - { - ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) - ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; - gTasks[taskId].func = sub_81C174C; - sub_81C0A8C(taskId, 1); - sub_81C1DA4(9, -2); - sub_81C1EFC(9, -2, move); - } - } - else if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) - ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; - sub_81C3E9C(move); - schedule_bg_copy_tilemap_to_vram(0); - sub_81C1DA4(9, -3); - sub_81C1EFC(9, -3, move); - gTasks[taskId].func = sub_81C174C; - } - } -} - -u8 sub_81C1B94() -{ - return gUnknown_0203CF21; -} - -void sub_81C1BA0() -{ - u16 *alloced = Alloc(32); - u8 i; - for (i = 0; i < 4; i++) - { - u8 j = i << 1; - if (i < gUnknown_0203CF1C->unk40C1) - { - alloced[j+0] = 0x40; - alloced[j+1] = 0x40; - alloced[j+8] = 0x50; - alloced[j+9] = 0x50; - } - else if (i > gUnknown_0203CF1C->unk40C2) - { - alloced[j+0] = 0x4A; - alloced[j+1] = 0x4A; - alloced[j+8] = 0x5A; - alloced[j+9] = 0x5A; - } - else if (i < gUnknown_0203CF1C->unk40C0) - { - alloced[j+0] = 0x46; - alloced[j+1] = 0x47; - alloced[j+8] = 0x56; - alloced[j+9] = 0x57; - } - else if (i == gUnknown_0203CF1C->unk40C0) - { - if (i != gUnknown_0203CF1C->unk40C2) - { - alloced[j+0] = 0x41; - alloced[j+1] = 0x42; - alloced[j+8] = 0x51; - alloced[j+9] = 0x52; - } - else - { - alloced[j+0] = 0x4B; - alloced[j+1] = 0x4C; - alloced[j+8] = 0x5B; - alloced[j+9] = 0x5C; - } - } - else if (i != gUnknown_0203CF1C->unk40C2) - { - alloced[j+0] = 0x43; - alloced[j+1] = 0x44; - alloced[j+8] = 0x53; - alloced[j+9] = 0x54; - } - else - { - alloced[j+0] = 0x48; - alloced[j+1] = 0x49; - alloced[j+8] = 0x58; - alloced[j+9] = 0x59; - } - } - CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16); - schedule_bg_copy_tilemap_to_vram(3); - Free(alloced); -} - -struct UnkStruct_61CC04 -{ - u8 *ptr; - u8 field_4; - u8 field_5; - u8 field_6; - u8 field_7; - u8 field_8; - u8 field_9; -}; - -#ifdef NONMATCHING -void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) -{ - u8 *alloced = Alloc(a->field_6 * (a->field_7 << 1)); - CpuFill16(a->field_4, alloced, a->field_7*a->field_6); - if (a->field_6 != c) - { - if (!d) - { - for (d;d < a->field_7; d++) - { - CpuCopy16(&a->ptr + ((c + a->field_6*d)), alloced + ((a->field_6*d) << 1), (a->field_6 - c) * 2); - } - } - else - { - for (d = 0;d < a->field_7; d++) - { - CpuCopy16(&a->ptr + (a->field_6*d), alloced + ((c + a->field_6*d) << 1), (a->field_6 - c) * 2); - } - } - } - d = 0; - while (d < a->field_7) - { - CpuCopy16(alloced + ((a->field_6*d) << 1), b + ((((a->field_9 + d) << 5) + a->field_8) << 1), a->field_6 * 2); - d++; - } - Free(alloced); -} -#else -__attribute__((naked)) -void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r8\n\ - push {r7}\n\ - sub sp, 0x4\n\ - adds r4, r0, 0\n\ - mov r8, r1\n\ - lsls r2, 24\n\ - lsrs r6, r2, 24\n\ - lsls r3, 24\n\ - lsrs r5, r3, 24\n\ - ldrb r1, [r4, 0x6]\n\ - ldrb r0, [r4, 0x7]\n\ - lsls r0, 1\n\ - muls r0, r1\n\ - bl Alloc\n\ - adds r7, r0, 0\n\ - mov r1, sp\n\ - ldrh r0, [r4, 0x4]\n\ - strh r0, [r1]\n\ - ldrb r1, [r4, 0x7]\n\ - ldrb r0, [r4, 0x6]\n\ - adds r2, r1, 0\n\ - muls r2, r0\n\ - movs r0, 0x80\n\ - lsls r0, 17\n\ - orrs r2, r0\n\ - mov r0, sp\n\ - adds r1, r7, 0\n\ - bl CpuSet\n\ - ldrb r0, [r4, 0x6]\n\ - cmp r0, r6\n\ - beq _081C1D60\n\ - cmp r5, 0\n\ - bne _081C1D30\n\ - movs r5, 0\n\ - ldrb r0, [r4, 0x7]\n\ - cmp r5, r0\n\ - bcs _081C1D60\n\ -_081C1D00:\n\ - ldrb r2, [r4, 0x6]\n\ - adds r1, r2, 0\n\ - muls r1, r5\n\ - adds r3, r6, r1\n\ - lsls r3, 1\n\ - ldr r0, [r4]\n\ - adds r0, r3\n\ - lsls r1, 1\n\ - adds r1, r7, r1\n\ - subs r2, r6\n\ - ldr r3, =0x001fffff\n\ - ands r2, r3\n\ - bl CpuSet\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - ldrb r3, [r4, 0x7]\n\ - cmp r5, r3\n\ - bcc _081C1D00\n\ - b _081C1D60\n\ - .pool\n\ -_081C1D30:\n\ - movs r5, 0\n\ - ldrb r0, [r4, 0x7]\n\ - cmp r5, r0\n\ - bcs _081C1D60\n\ -_081C1D38:\n\ - ldrb r2, [r4, 0x6]\n\ - adds r1, r2, 0\n\ - muls r1, r5\n\ - lsls r3, r1, 1\n\ - ldr r0, [r4]\n\ - adds r0, r3\n\ - adds r1, r6, r1\n\ - lsls r1, 1\n\ - adds r1, r7, r1\n\ - subs r2, r6\n\ - ldr r3, =0x001fffff\n\ - ands r2, r3\n\ - bl CpuSet\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - ldrb r3, [r4, 0x7]\n\ - cmp r5, r3\n\ - bcc _081C1D38\n\ -_081C1D60:\n\ - movs r5, 0\n\ - b _081C1D8A\n\ - .pool\n\ -_081C1D68:\n\ - ldrb r2, [r4, 0x6]\n\ - adds r0, r2, 0\n\ - muls r0, r5\n\ - lsls r0, 1\n\ - adds r0, r7, r0\n\ - ldrb r1, [r4, 0x9]\n\ - adds r1, r5\n\ - lsls r1, 5\n\ - ldrb r3, [r4, 0x8]\n\ - adds r1, r3\n\ - lsls r1, 1\n\ - add r1, r8\n\ - bl CpuSet\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ -_081C1D8A:\n\ - ldrb r0, [r4, 0x7]\n\ - cmp r5, r0\n\ - bcc _081C1D68\n\ - adds r0, r7, 0\n\ - bl Free\n\ - add sp, 0x4\n\ - pop {r3}\n\ - mov r8, r3\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .syntax divided\n"); -} -#endif - -void sub_81C1DA4(u16 a, s16 b) -{ - if (b > gUnknown_0861CC04.field_6) - b = gUnknown_0861CC04.field_6; - if (b == 0 || b == gUnknown_0861CC04.field_6) - { - sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], b, 1); - } - else - { - u8 taskId = FindTaskIdByFunc(sub_81C1E20); - if (taskId == 0xFF) - { - taskId = CreateTask(sub_81C1E20, 8); - } - gTasks[taskId].data[0] = b; - gTasks[taskId].data[1] = a; - } -} - -void sub_81C1E20(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - data[1] += data[0]; - if (data[1] < 0) - { - data[1] = 0; - } - else if (data[1] > gUnknown_0861CC04.field_6) - { - data[1] = gUnknown_0861CC04.field_6; - } - sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], data[1], 1); - if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6) - { - if (data[0] < 0) - { - if (gUnknown_0203CF1C->unk40C0 == 2) - PutWindowTilemap(14); - - } - else - { - if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) - PutWindowTilemap(13); - PutWindowTilemap(19); - } - schedule_bg_copy_tilemap_to_vram(0); - DestroyTask(taskId); - } - schedule_bg_copy_tilemap_to_vram(1); - schedule_bg_copy_tilemap_to_vram(2); -} - -void sub_81C1EFC(u16 a, s16 b, u16 move) -{ - if (b > gUnknown_0861CC10.field_6) - b = gUnknown_0861CC10.field_6; - if (b == 0 || b == gUnknown_0861CC10.field_6) - sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], b, 1); - else - { - u8 taskId = FindTaskIdByFunc(sub_81C1F80); - if (taskId == 0xFF) - taskId = CreateTask(sub_81C1F80, 8); - gTasks[taskId].data[0] = b; - gTasks[taskId].data[1] = a; - gTasks[taskId].data[2] = move; - } -} - -void sub_81C1F80(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - data[1] += data[0]; - if (data[1] < 0) - { - data[1] = 0; - } - else if (data[1] > gUnknown_0861CC10.field_6) - { - data[1] = gUnknown_0861CC10.field_6; - } - sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], data[1], 1); - if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6) - { - if (data[0] < 0) - { - if (gUnknown_0203CF1C->unk40C0 == 3 && FuncIsActiveTask(sub_81C0B8C) == 0) - PutWindowTilemap(15); - sub_81C240C(data[2]); - } - else - { - if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) - { - PutWindowTilemap(13); - } - PutWindowTilemap(19); - } - schedule_bg_copy_tilemap_to_vram(0); - DestroyTask(taskId); - } - schedule_bg_copy_tilemap_to_vram(1); - schedule_bg_copy_tilemap_to_vram(2); -} - -void sub_81C2074(u16 a, s16 b) -{ - if (b > gUnknown_0861CBEC.field_6) - b = gUnknown_0861CBEC.field_6; - if (b == 0 || b == gUnknown_0861CBEC.field_6) - { - sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); - sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); - } - else - { - u8 taskId = CreateTask(sub_81C20F0, 8); - gTasks[taskId].data[0] = b; - gTasks[taskId].data[1] = a; - } -} - -void sub_81C20F0(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - data[1] += data[0]; - if (data[1] < 0) - data[1] = 0; - else if (data[1] > gUnknown_0861CBEC.field_6) - data[1] = gUnknown_0861CBEC.field_6; - sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); - sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); - schedule_bg_copy_tilemap_to_vram(3); - if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6) - { - if (data[0] < 0) - { - sub_81C4A88(); - PutWindowTilemap(13); - schedule_bg_copy_tilemap_to_vram(0); - } - DestroyTask(taskId); - } -} - -// somebody send help this is a complete fucking mess -#ifdef NONMATCHING -void sub_81C2194(u16 *a, u16 b, u8 c) -{ - u16 i; - int var; - b *= 0x1000; - var = 0x56A; - - if (c == 0) - { - for (i = 0; i < 20; i++) - { - a[(i + var) << 1] = gUnknown_08DC3CD4[i] + b; - a[((i + var) << 1) + 0x40] = gUnknown_08DC3CD4[i] + b; - a[((i + var) << 1) + 0x80] = gUnknown_08DC3CD4[i + 20] + b; - } - } - else - { - for (i = 0; i < 20; i++) - { - a[(i + var)] = gUnknown_08DC3CD4[i + 20] + b; - a[((i + var)) + 0x40] = gUnknown_08DC3CD4[i + 40] + b; - a[((i + var)) + 0x80] = gUnknown_08DC3CD4[i + 40] + b; - } - } -} -#else -__attribute__((naked)) -void sub_81C2194(u16 *a, u16 b, u8 c) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - adds r6, r0, 0\n\ - lsls r2, 24\n\ - lsls r1, 28\n\ - lsrs r4, r1, 16\n\ - ldr r7, =0x0000056a\n\ - cmp r2, 0\n\ - bne _081C21E4\n\ - movs r3, 0\n\ - ldr r5, =gUnknown_08DC3CD4\n\ -_081C21A8:\n\ - adds r2, r7, r3\n\ - lsls r2, 1\n\ - adds r2, r6\n\ - lsls r0, r3, 1\n\ - adds r0, r5\n\ - ldrh r1, [r0]\n\ - adds r1, r4, r1\n\ - strh r1, [r2]\n\ - adds r0, r2, 0\n\ - adds r0, 0x40\n\ - strh r1, [r0]\n\ - adds r2, 0x80\n\ - adds r0, r3, 0\n\ - adds r0, 0x14\n\ - lsls r0, 1\n\ - adds r0, r5\n\ - ldrh r0, [r0]\n\ - adds r0, r4, r0\n\ - strh r0, [r2]\n\ - adds r0, r3, 0x1\n\ - lsls r0, 16\n\ - lsrs r3, r0, 16\n\ - cmp r3, 0x13\n\ - bls _081C21A8\n\ - b _081C221C\n\ - .pool\n\ -_081C21E4:\n\ - movs r3, 0\n\ - ldr r5, =gUnknown_08DC3CD4\n\ -_081C21E8:\n\ - adds r1, r7, r3\n\ - lsls r1, 1\n\ - adds r1, r6\n\ - adds r0, r3, 0\n\ - adds r0, 0x14\n\ - lsls r0, 1\n\ - adds r0, r5\n\ - ldrh r0, [r0]\n\ - adds r0, r4, r0\n\ - strh r0, [r1]\n\ - adds r2, r1, 0\n\ - adds r2, 0x40\n\ - adds r0, r3, 0\n\ - adds r0, 0x28\n\ - lsls r0, 1\n\ - adds r0, r5\n\ - ldrh r0, [r0]\n\ - adds r0, r4, r0\n\ - strh r0, [r2]\n\ - adds r1, 0x80\n\ - strh r0, [r1]\n\ - adds r0, r3, 0x1\n\ - lsls r0, 16\n\ - lsrs r3, r0, 16\n\ - cmp r3, 0x13\n\ - bls _081C21E8\n\ -_081C221C:\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif - -void sub_81C2228(struct Pokemon *mon) -{ - if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0)) - { - gUnknown_0203CF1C->unkTilemap0[0x223] = 0x2C; - gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x2C; - } - else - { - gUnknown_0203CF1C->unkTilemap0[0x223] = 0x81A; - gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x81A; - } - schedule_bg_copy_tilemap_to_vram(3); -} - -void sub_81C228C(u8 a) -{ - if (a == 0) - sub_8199C30(3, 1, 4, 8, 8, 0); - else - sub_8199C30(3, 1, 4, 8, 8, 5); - schedule_bg_copy_tilemap_to_vram(3); -} - -void sub_81C22CC(struct Pokemon *unused) -{ - s64 r6r7; - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; - u16 *r9; - u8 i; - - if (summary->level < MAX_MON_LEVEL) - { - u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; - u32 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; - - r6r7 = r4 * 64 / r1; - if (r6r7 == 0 && r4 != 0) - r6r7 = 1; - } - else - { - r6r7 = 0; - } - - r9 = &gUnknown_0203CF1C->unkTilemap1_1[0x255]; - for (i = 0; i < 8; i++) - { - if (r6r7 > 7) - r9[i] = 0x206A; - else - r9[i] = 0x2062 + (r6r7 % 8); - r6r7 -= 8; - if (r6r7 < 0) - r6r7 = 0; - } - - if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->unkTilemap1) - schedule_bg_copy_tilemap_to_vram(1); - else - schedule_bg_copy_tilemap_to_vram(2); -} - -void sub_81C240C(u16 move) -{ - u16* r5 = &gUnknown_0203CF1C->unkTilemap3_1[0]; - u8 i; - u8 r4; - if (move != MOVE_NONE) - { - r4 = gContestEffects[gContestMoves[move].effect].appeal; - if (r4 != 0xFF) - r4 /= 10; - for (i = 0;i < 8; i++) - { - if (r4 != 0xFF && i < r4) - { - r5[((i>>2)*32)+(i&3)+0x1E6] = 0x103A; - } - else - r5[((i>>2)*32)+(i&3)+0x1E6] = 0x1039; - } - r4 = gContestEffects[gContestMoves[move].effect].jam; - if (r4 != 0xFF) - r4 /= 10; - for (i = 0;i < 8; i++) - { - if (r4 != 0xFF && i < r4) - { - r5[((i>>2)*32)+(i&3)+0x226] = 0x103C; - } - else - r5[((i>>2)*32)+(i&3)+0x226] = 0x103D; - } - } -} - -void sub_81C2524() -{ - if (gUnknown_0203CF1C->summary.isEgg != 0) - ChangeBgX(3, 0x10000, 0); - else - ChangeBgX(3, 0, 0); -} - -void sub_81C2554() -{ - u8 i; - InitWindows(&gUnknown_0861CC24); - DeactivateAllTextPrinters(); - for (i = 0; i < 20; i++) - FillWindowPixelBuffer(i, 0); - for (i = 0; i < 8; i++) - gUnknown_0203CF1C->unk40CB[i] |= 0xFF; -} - -void sub_81C25A4(u8 a, u8 *b, u8 c, u8 d, u8 e, u8 f) -{ - AddTextPrinterParametrized2(a, 1, c, d, 0, e, &gUnknown_0861CD2C[f], 0, b); -} - -void sub_81C25E8() -{ - FillWindowPixelBuffer(17, 0); - FillWindowPixelBuffer(18, 0); - FillWindowPixelBuffer(19, 0); - if (gUnknown_0203CF1C->summary.isEgg == 0) - sub_81C2628(); - else - sub_81C2794(); - schedule_bg_copy_tilemap_to_vram(0); -} - -void sub_81C2628() -{ - u8 strArray[16]; - struct Pokemon *mon = &gUnknown_0203CF1C->currentMon; - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; - u16 r5 = SpeciesToPokedexNum(summary->species); - if (r5 != 0xFFFF) - { - StringCopy(gStringVar1, &gText_UnkCtrlF908Clear01[0]); - ConvertIntToDecimalStringN(gStringVar2, r5, 2, 3); - StringAppend(gStringVar1, gStringVar2); - if (IsMonShiny(mon) == 0) - { - sub_81C25A4(17, gStringVar1, 0, 1, 0, 1); - sub_81C228C(0); - } - else - { - sub_81C25A4(17, gStringVar1, 0, 1, 0, 7); - sub_81C228C(1); - } - PutWindowTilemap(17); - } - else - { - ClearWindowTilemap(17); - if (IsMonShiny(mon) == 0) - sub_81C228C(0); - else - sub_81C228C(1); - } - StringCopy(gStringVar1, &gText_LevelSymbol[0]); - ConvertIntToDecimalStringN(gStringVar2, summary->level, 0, 3); - StringAppend(gStringVar1, gStringVar2); - sub_81C25A4(19, gStringVar1, 0x18, 17, 0, 1); - GetMonNickname(mon, gStringVar1); - sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); - strArray[0] = CHAR_SLASH; - StringCopy(&strArray[1], &gSpeciesNames[summary->species2][0]); - sub_81C25A4(19, &strArray[0], 0, 1, 0, 1); - sub_81C27DC(mon, summary->species2); - PutWindowTilemap(18); - PutWindowTilemap(19); -} - -void sub_81C2794() -{ - GetMonNickname(&gUnknown_0203CF1C->currentMon, gStringVar1); - sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); - PutWindowTilemap(18); - ClearWindowTilemap(17); - ClearWindowTilemap(19); -} - -void sub_81C27DC(struct Pokemon *mon, u16 a) -{ - if (a != SPECIES_NIDORAN_M && a != SPECIES_NIDORAN_F) - { - u8 gender = GetMonGender(mon); - switch (gender) - { - case 0: - sub_81C25A4(0x13, &gText_MaleSymbol[0], 0x39, 17, 0, 3); - break; - case 0xFE: - sub_81C25A4(0x13, &gText_FemaleSymbol[0], 0x39, 17, 0, 4); - break; - } - } -} - -void sub_81C2838(u8 a, bool8 b, u32 c) -{ - BlitBitmapToWindow(a, (b) ? &gUnknown_0861CDD3[0] : &gUnknown_0861CDD3[0] - 0x80, c, 0, 16, 16); -} - -void sub_81C286C() -{ - int r4; - int r2; - int temp; - sub_81C25A4(0, gText_PkmnInfo, 2, 1, 0, 1); - sub_81C25A4(1, gText_PkmnSkills, 2, 1, 0, 1); - sub_81C25A4(2, gText_BattleMoves, 2, 1, 0, 1); - sub_81C25A4(3, gText_ContestMoves, 2, 1, 0, 1); - r4 = GetStringRightAlignXOffset(1, gText_Cancel2, 0x3E); - r2 = r4 - 16; - if (r2 < 0) - r2 = 0; - sub_81C2838(4, 0, r2); - sub_81C25A4(4, gText_Cancel2, r4, 1, 0, 0); - r4 = GetStringRightAlignXOffset(1, gText_Info, 0x3E); - r2 = r4 - 16; - if (r2 < 0) - r2 = 0; - sub_81C2838(5, 0, r2); - sub_81C25A4(5, gText_Info, r4, 1, 0, 0); - r4 = GetStringRightAlignXOffset(1, gText_Switch, 0x3E); - r2 = r4 - 16; - if (r2 < 0) - r2 = 0; - sub_81C2838(6, 0, r2); - sub_81C25A4(6, gText_Switch, r4, 1, 0, 0); - sub_81C25A4(8, gText_RentalPkmn, 0, 1, 0, 1); - sub_81C25A4(9, gText_TypeSlash, 0, 1, 0, 0); - temp = 6; - temp += GetStringCenterAlignXOffset(1, gText_HP4, 42); - sub_81C25A4(10, gText_HP4, temp, 1, 0, 1); - temp = 6; - temp += GetStringCenterAlignXOffset(1, gText_Attack3, 42); - sub_81C25A4(10, gText_Attack3, temp, 17, 0, 1); - temp = 6; - temp += GetStringCenterAlignXOffset(1, gText_Defense3, 42); - sub_81C25A4(10, gText_Defense3, temp, 33, 0, 1); - temp = 2; - temp += GetStringCenterAlignXOffset(1, gText_SpAtk4, 36); - sub_81C25A4(11, gText_SpAtk4, temp, 1, 0, 1); - temp = 2; - temp += GetStringCenterAlignXOffset(1, gText_SpDef4, 36); - sub_81C25A4(11, gText_SpDef4, temp, 17, 0, 1); - temp = 2; - temp += GetStringCenterAlignXOffset(1, gText_Speed2, 36); - sub_81C25A4(11, gText_Speed2, temp, 33, 0, 1); - sub_81C25A4(12, gText_ExpPoints, 6, 1, 0, 1); - sub_81C25A4(12, gText_NextLv, 6, 17, 0, 1); - sub_81C25A4(13, gText_Status, 2, 1, 0, 1); - sub_81C25A4(14, gText_Power, 0, 1, 0, 1); - sub_81C25A4(14, gText_Accuracy2, 0, 17, 0, 1); - sub_81C25A4(15, gText_Appeal, 0, 1, 0, 1); - sub_81C25A4(15, gText_Jam, 0, 17, 0, 1); -} - -void sub_81C2AFC(u8 a) -{ - u8 i; - ClearWindowTilemap(0); - ClearWindowTilemap(1); - ClearWindowTilemap(2); - ClearWindowTilemap(3); - switch (a) - { - case 0: - PutWindowTilemap(0); - PutWindowTilemap(4); - if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE) - PutWindowTilemap(8); - PutWindowTilemap(9); - break; - case 1: - PutWindowTilemap(1); - PutWindowTilemap(10); - PutWindowTilemap(11); - PutWindowTilemap(12); - break; - case 2: - PutWindowTilemap(2); - if (gUnknown_0203CF1C->unk40BC == 3) - { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - PutWindowTilemap(14); - } - else - PutWindowTilemap(5); - break; - case 3: - PutWindowTilemap(3); - if (gUnknown_0203CF1C->unk40BC == 3) - { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - PutWindowTilemap(15); - } - else - PutWindowTilemap(5); - break; - } - for (i = 0; i < 8; i++) - { - PutWindowTilemap(gUnknown_0203CF1C->unk40CB[i]); - } - schedule_bg_copy_tilemap_to_vram(0); -} - -void sub_81C2C38(u8 a) -{ - u8 i; - switch (a) - { - case 0: - ClearWindowTilemap(4); - if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE) - ClearWindowTilemap(8); - ClearWindowTilemap(9); - break; - case 1: - ClearWindowTilemap(10); - ClearWindowTilemap(11); - ClearWindowTilemap(12); - break; - case 2: - if (gUnknown_0203CF1C->unk40BC == 3) - { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - ClearWindowTilemap(14); - } - else - ClearWindowTilemap(5); - break; - case 3: - if (gUnknown_0203CF1C->unk40BC == 3) - { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - ClearWindowTilemap(15); - } - else - ClearWindowTilemap(5); - break; - } - for (i = 0; i < 8; i++) - sub_81C2D68(i); - schedule_bg_copy_tilemap_to_vram(0); -} - - - -#ifdef NONMATCHING -u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) -{ - u8 *r4 = gUnknown_0203CF1C->unk40CB; - if (r4[a] == 0xFF) - { - r4[a] = AddWindow(&template[a]); - FillWindowPixelBuffer(r4[a], 0); - } - return r4[a]; -} -#else -__attribute__((naked)) -u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) -{ - asm(".syntax unified\n\ - push {r4,lr}\n\ - adds r3, r0, 0\n\ - lsls r1, 24\n\ - lsrs r2, r1, 24\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r4, =0x000040cb\n\ - adds r1, r2, r4\n\ - ldr r0, [r0]\n\ - adds r4, r0, r1\n\ - ldrb r0, [r4]\n\ - cmp r0, 0xFF\n\ - bne _081C2D56\n\ - lsls r0, r2, 3\n\ - adds r0, r3, r0\n\ - bl AddWindow\n\ - strb r0, [r4]\n\ - ldrb r0, [r4]\n\ - movs r1, 0\n\ - bl FillWindowPixelBuffer\n\ -_081C2D56:\n\ - ldrb r0, [r4]\n\ - pop {r4}\n\ - pop {r1}\n\ - bx r1\n\ - .pool\n\ - .syntax divided\n"); -} -#endif - -#ifdef NONMATCHING -void sub_81C2D68(u8 a) -{ - u8 *r4 = gUnknown_0203CF1C->unk40CB; - if (r4[a] != 0xFF) - { - ClearWindowTilemap(r4[a]); - RemoveWindow(r4[a]); - r4[a] = 0xFF; - } -} -#else -__attribute__((naked)) -void sub_81C2D68(u8 a) -{ - asm(".syntax unified\n\ - push {r4,lr}\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - ldr r1, =gUnknown_0203CF1C\n\ - ldr r2, =0x000040cb\n\ - adds r0, r2\n\ - ldr r1, [r1]\n\ - adds r4, r1, r0\n\ - ldrb r0, [r4]\n\ - cmp r0, 0xFF\n\ - beq _081C2D8C\n\ - bl ClearWindowTilemap\n\ - ldrb r0, [r4]\n\ - bl RemoveWindow\n\ - movs r0, 0xFF\n\ - strb r0, [r4]\n\ -_081C2D8C:\n\ - pop {r4}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif - -void sub_81C2D9C(u8 a) -{ - u16 i; - for (i = 0; i < 8; i++) - { - if (gUnknown_0203CF1C->unk40CB[i] != 0xFF) - FillWindowPixelBuffer(gUnknown_0203CF1C->unk40CB[i], 0); - } - gUnknown_0861CE54[a](); -} - -void sub_81C2DE4(u8 a) -{ - CreateTask(gUnknown_0861CE64[a], 16); -} - -void sub_81C2E00() -{ - if (gUnknown_0203CF1C->summary.isEgg) - { - sub_81C335C(); - sub_81C33CC(); - sub_81C3428(); - sub_81C349C(); - } - else - { - sub_81C2EC4(); - sub_81C2F5C(); - sub_81C2FD8(); - sub_81C302C(); - sub_81C307C(); - sub_81C3194(); - } -} - -void sub_81C2E40(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - s16 dataa = data[0] - 1; - switch (dataa) - { - case 0: - sub_81C2EC4(); - break; - case 1: - sub_81C2F5C(); - break; - case 2: - sub_81C2FD8(); - break; - case 3: - sub_81C302C(); - break; - case 4: - sub_81C307C(); - break; - case 5: - sub_81C3194(); - break; - case 6: - DestroyTask(taskId); - return; - } - data[0]++; -} - -void sub_81C2EC4() -{ - u8 r5; - int r2; - if (sub_81A6BF4() != 1 && sub_81B9E94() != 1) - { - r5 = sub_81C2D2C(&gUnknown_0861CCCC, 0); - sub_81C25A4(r5, gText_OTSlash, 0, 1, 0, 1); - r2 = GetStringWidth(1, gText_OTSlash, 0); - if (gUnknown_0203CF1C->summary.OTGender == 0) - sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 5); - else - sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 6); - } -} - -void sub_81C2F5C() -{ - int r4; - if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE) - { - ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5); - r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); - } -} - -void sub_81C2FD8() -{ - u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); -} - -void sub_81C302C() -{ - u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); -} - -void sub_81C307C() -{ - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 *text; - sub_81AFBF0(); - sub_81AFC0C(0, gUnknown_0861CE74); - sub_81AFC0C(1, gUnknown_0861CE7B); - sub_81C31C0(); - if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE || sub_81C3304() == TRUE) - sub_81AFC28(gStringVar4, gText_XNature); - else - { - u8 *alloced1 = Alloc(32); - u8 *alloced2 = Alloc(32); - sub_81C31F0(alloced1); - if (sum->metLocation <= 0xD4) - { - sub_8124610(alloced2, sum->metLocation); - sub_81AFC0C(4, alloced2); - } - if (sub_81C3220() == 1) - { - if (sum->metLevel == 0) - text = (sum->metLocation > 0xD4) ? gText_XNatureHatchedSomewhereAt : gText_XNatureHatchedAtYZ; - else - text = (sum->metLocation > 0xD4) ? gText_XNatureMetSomewhereAt : gText_XNatureMetAtYZ; - } - else if (sum->metLocation == 0xFF) - text = gText_XNatureFatefulEncounter; - else if (sum->metLocation != 0xFE && sub_81C32BC()) - text = (sum->metLocation > 0xD4) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt; - else - text = gText_XNatureObtainedInTrade; - sub_81AFC28(gStringVar4, text); - Free(alloced1); - Free(alloced2); - } -} - -void sub_81C3194() -{ - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); -} - -void sub_81C31C0() -{ - struct UnkSummaryStruct *sumStruct = gUnknown_0203CF1C; - sub_81AFC0C(2, gNatureNamePointers[sumStruct->summary.nature]); - sub_81AFC0C(5, gText_EmptyString5); -} - -void sub_81C31F0(u8 *a) -{ - u8 level = gUnknown_0203CF1C->summary.metLevel; - if (level == 0) - level = 5; - ConvertIntToDecimalStringN(a, level, 0, 3); - sub_81AFC0C(3, a); -} - -u8 sub_81C3220() -{ - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u32 r4; - u8 r5; - if (gUnknown_0203CF1C->unk0 == (union UnkUnion *)&gEnemyParty) - { - u8 multiID = GetMultiplayerId()^1; - r4 = (u16)gLinkPlayers[multiID].trainerId; - r5 = gLinkPlayers[multiID].gender; - StringCopy(gStringVar1, gLinkPlayers[multiID].name); - } - else - { - r4 = GetPlayerIDAsU32() & 0xFFFF; - r5 = gSaveBlock2Ptr->playerGender; - StringCopy(gStringVar1, gSaveBlock2Ptr->playerName); - } - if (r5 != sum->OTGender || r4 != (sum->OTID & 0xFFFF) || StringCompareWithoutExtCtrlCodes(gStringVar1, sum->OTName)) - { - return 0; - } - return 1; -} - -bool8 sub_81C32BC() -{ - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 r0 = sum->metGame - 1; - if (r0 <= 4) - return TRUE; - return FALSE; -} - -bool8 sub_81C32E0() -{ - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 r0 = sum->metGame - 1; - if (r0 <= 2) - return TRUE; - return FALSE; -} - -bool8 sub_81C3304() -{ - if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle) - { - if (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5) - return TRUE; - } - return FALSE; -} - -#ifdef NONMATCHING -void sub_81C335C() -{ - u8 r4 = sub_81C2D2C(&gUnknown_0861CCCC, 0); - u32 r5 = GetStringWidth(1, gText_OTSlash, 0); - sub_81C25A4(r4, gText_OTSlash, 0, 1, 0, 1); - sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1); -} -#else -__attribute__((naked)) -void sub_81C335C() -{ - asm(".syntax unified\n\ - push {r4-r6,lr}\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5,r6}\n\ - sub sp, 0x8\n\ - ldr r0, =gUnknown_0861CCCC\n\ - movs r1, 0\n\ - bl sub_81C2D2C\n\ - adds r4, r0, 0\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - ldr r0, =gText_OTSlash\n\ - mov r8, r0\n\ - movs r0, 0x1\n\ - mov r1, r8\n\ - movs r2, 0\n\ - bl GetStringWidth\n\ - adds r5, r0, 0\n\ - movs r0, 0\n\ - mov r9, r0\n\ - str r0, [sp]\n\ - movs r6, 0x1\n\ - str r6, [sp, 0x4]\n\ - adds r0, r4, 0\n\ - mov r1, r8\n\ - movs r2, 0\n\ - movs r3, 0x1\n\ - bl sub_81C25A4\n\ - ldr r1, =gText_FiveMarks\n\ - lsls r5, 24\n\ - lsrs r5, 24\n\ - mov r0, r9\n\ - str r0, [sp]\n\ - str r6, [sp, 0x4]\n\ - adds r0, r4, 0\n\ - adds r2, r5, 0\n\ - movs r3, 0x1\n\ - bl sub_81C25A4\n\ - add sp, 0x8\n\ - pop {r3,r4}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - pop {r4-r6}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif - -void sub_81C33CC() -{ - int r4; - StringCopy(gStringVar1, gText_UnkCtrlF907F908); - StringAppend(gStringVar1, gText_FiveMarks); - r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); -} - -void sub_81C3428() -{ - u8 *text; - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - if (gUnknown_0203CF1C->summary.sanity == 1) - text = gText_EggWillTakeALongTime; - else if (sum->friendship <= 5) - text = gText_EggAboutToHatch; - else if (sum->friendship <= 10) - text = gText_EggWillHatchSoon; - else if (sum->friendship <= 40) - text = gText_EggWillTakeSomeTime; - else - text = gText_EggWillTakeALongTime; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); -} - -void sub_81C349C() -{ - u8 *text; - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - if (gUnknown_0203CF1C->summary.sanity != 1) - { - if (sum->metLocation == 0xFF) - text = gText_PeculiarEggNicePlace; - else if (sub_81C32BC() == 0 || sub_81C3220() == 0) - text = gText_PeculiarEggTrade; - else if (sum->metLocation == 0xFD) - text = (sub_81C32E0() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler; - else - text = gText_OddEggFoundByCouple; - } - else - text = gText_OddEggFoundByCouple; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); -} - -void sub_81C3530() -{ - sub_81C35E4(); - sub_81C3690(); - sub_81C3710(); - sub_81C37D8(); - sub_81C3808(); - sub_81C3890(); - sub_81C38C0(); -} - -void sub_81C3554(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - s16 dataa = data[0] - 1; - switch (dataa) - { - case 0: - sub_81C35E4(); - break; - case 1: - sub_81C3690(); - break; - case 2: - sub_81C3710(); - break; - case 3: - sub_81C37D8(); - break; - case 4: - sub_81C3808(); - break; - case 5: - sub_81C3890(); - break; - case 6: - sub_81C38C0(); - break; - case 7: - DestroyTask(taskId); - return; - } - data[0]++; -} - -void sub_81C35E4() -{ - u8 *text; - int offset; - if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == 1 && (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5)) - { - text = (u8*)ItemId_GetItem(ITEM_ENIGMA_BERRY); - } - else if (gUnknown_0203CF1C->summary.item == ITEM_NONE) - text = gText_None; - else - { - CopyItemName(gUnknown_0203CF1C->summary.item, gStringVar1); - text = gStringVar1; - } - offset = GetStringCenterAlignXOffset(1, text, 0x48) + 6; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); -} - -void sub_81C3690() -{ - u8 *text; - int offset; - if (gUnknown_0203CF1C->summary.ribbons == 0) - text = gText_None; - else - { - ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.ribbons, 1, 2); - StringExpandPlaceholders(gStringVar4, gText_RibbonsVar1); - text = gStringVar4; - } - offset = GetStringCenterAlignXOffset(1, text, 0x46) + 6; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); -} - -void sub_81C3710() -{ - u8 *alloced1 = Alloc(8); - u8 *alloced2 = Alloc(8); - u8 *alloced3 = Alloc(8); - u8 *alloced4 = Alloc(8); - ConvertIntToDecimalStringN(alloced1, gUnknown_0203CF1C->summary.currentHP, 1, 3); - ConvertIntToDecimalStringN(alloced2, gUnknown_0203CF1C->summary.maxHP, 1, 3); - ConvertIntToDecimalStringN(alloced3, gUnknown_0203CF1C->summary.atk, 1, 7); - ConvertIntToDecimalStringN(alloced4, gUnknown_0203CF1C->summary.def, 1, 7); - sub_81AFBF0(); - sub_81AFC0C(0, alloced1); - sub_81AFC0C(1, alloced2); - sub_81AFC0C(2, alloced3); - sub_81AFC0C(3, alloced4); - sub_81AFC28(gStringVar4, gUnknown_0861CE82); - Free(alloced1); - Free(alloced2); - Free(alloced3); - Free(alloced4); -} - -void sub_81C37D8() -{ - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); -} - -void sub_81C3808() -{ - ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.spatk, 1, 3); - ConvertIntToDecimalStringN(gStringVar2, gUnknown_0203CF1C->summary.spdef, 1, 3); - ConvertIntToDecimalStringN(gStringVar3, gUnknown_0203CF1C->summary.speed, 1, 3); - sub_81AFBF0(); - sub_81AFC0C(0, gStringVar1); - sub_81AFC0C(1, gStringVar2); - sub_81AFC0C(2, gStringVar3); - sub_81AFC28(gStringVar4, gUnknown_0861CE8E); -} - -void sub_81C3890() -{ - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); -} - -void sub_81C38C0() -{ - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 r6 = sub_81C2D2C(&gUnknown_0861CCEC, 4); - int offset; - u32 expToNextLevel; - ConvertIntToDecimalStringN(gStringVar1, sum->exp, 1, 7); - offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; - sub_81C25A4(r6, gStringVar1, offset, 1, 0, 0); - if (sum->level < MAX_MON_LEVEL) - expToNextLevel = gExperienceTables[gBaseStats[sum->species].growthRate][sum->level + 1] - sum->exp; - else - expToNextLevel = 0; - ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, 1, 6); - offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; - sub_81C25A4(r6, gStringVar1, offset, 17, 0, 0); -} - -void sub_81C3984() -{ - sub_81C3B08(0); - sub_81C3B08(1); - sub_81C3B08(2); - sub_81C3B08(3); - if (gUnknown_0203CF1C->unk40BC == 3) - { - sub_81C3F44(); - if (gUnknown_0203CF1C->unk40C6 == 4) - { - if (gUnknown_0203CF1C->unk40C4 != 0) - sub_81C3E9C(gUnknown_0203CF1C->unk40C4); - } - else - sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); - } -} - -void sub_81C39F0(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - s16 dataa = data[0] - 1; - - switch (dataa) - { - case 0: - sub_81C3B08(0); - break; - case 1: - sub_81C3B08(1); - break; - case 2: - sub_81C3B08(2); - break; - case 3: - sub_81C3B08(3); - break; - case 4: - if (gUnknown_0203CF1C->unk40BC == 3) - sub_81C3F44(); - break; - case 5: - if (gUnknown_0203CF1C->unk40BC == 3) - { - if (gUnknown_0203CF1C->unk40C6 == 4) - data[1] = gUnknown_0203CF1C->unk40C4; - else - data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; - } - break; - case 6: - if (gUnknown_0203CF1C->unk40BC == 3) - { - if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - sub_81C3E9C(data[1]); - } - break; - case 7: - DestroyTask(taskId); - return; - } - data[0]++; -} - -#ifdef NONMATCHING -void sub_81C3B08(u8 a) -{ - struct UnkSummaryStruct *r10 = gUnknown_0203CF1C; - u8 r8 = sub_81C2D2C(&gUnknown_0861CD14, 0); - u8 sp = sub_81C2D2C(&gUnknown_0861CD14, 1); - u8 r6; - u8 r5; - u8 *text; - int offset; - u16 move; - if (r10->summary.moves[a] != 0) - { - move = r10->summary.moves[a]; - r6 = CalculatePPWithBonus(move, r10->summary.ppBonuses, a); - sub_81C25A4(r8, gMoveNames[move], 0, (a<<4) + 1, 0, 1); - ConvertIntToDecimalStringN(gStringVar1, r10->summary.pp[a], 1, 2); - ConvertIntToDecimalStringN(gStringVar2, r6, 1, 2); - sub_81AFBF0(); - sub_81AFC0C(0, gStringVar1); - sub_81AFC0C(1, gStringVar2); - sub_81AFC28(gStringVar4, gUnknown_0861CE97); - text = gStringVar4; - r5 = GetCurrentPpToMaxPpState(r10->summary.pp[a], r6) + 9; - offset = GetStringRightAlignXOffset(1, text, 0x2C); - } - else - { - sub_81C25A4(r8, gText_OneDash, 0, (a<<4) + 1, 0, 1); - text = gText_TwoDashes; - r5 = 12; - offset = GetStringCenterAlignXOffset(1, text, 0x2C); - } - sub_81C25A4(sp, text, offset, (a<<4), 0, r5); -} -#else -__attribute__((naked)) -void sub_81C3B08(u8 a) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0xC\n\ - lsls r0, 24\n\ - lsrs r7, r0, 24\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - mov r10, r0\n\ - ldr r4, =gUnknown_0861CD14\n\ - adds r0, r4, 0\n\ - movs r1, 0\n\ - bl sub_81C2D2C\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - mov r8, r0\n\ - adds r0, r4, 0\n\ - movs r1, 0x1\n\ - bl sub_81C2D2C\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - str r0, [sp, 0x8]\n\ - lsls r1, r7, 1\n\ - mov r0, r10\n\ - adds r0, 0x84\n\ - adds r0, r1\n\ - ldrh r5, [r0]\n\ - cmp r5, 0\n\ - beq _081C3C00\n\ - mov r0, r10\n\ - adds r0, 0xA4\n\ - ldrb r1, [r0]\n\ - adds r0, r5, 0\n\ - adds r2, r7, 0\n\ - bl CalculatePPWithBonus\n\ - adds r6, r0, 0\n\ - lsls r6, 24\n\ - lsrs r6, 24\n\ - movs r0, 0xD\n\ - adds r1, r5, 0\n\ - muls r1, r0\n\ - ldr r0, =gMoveNames\n\ - adds r1, r0\n\ - lsls r0, r7, 4\n\ - mov r9, r0\n\ - mov r3, r9\n\ - adds r3, 0x1\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - movs r0, 0\n\ - str r0, [sp]\n\ - movs r0, 0x1\n\ - str r0, [sp, 0x4]\n\ - mov r0, r8\n\ - movs r2, 0\n\ - bl sub_81C25A4\n\ - ldr r0, =gStringVar1\n\ - mov r8, r0\n\ - mov r5, r10\n\ - adds r5, 0x8C\n\ - adds r5, r7\n\ - ldrb r1, [r5]\n\ - movs r2, 0x1\n\ - movs r3, 0x2\n\ - bl ConvertIntToDecimalStringN\n\ - ldr r4, =gStringVar2\n\ - adds r0, r4, 0\n\ - adds r1, r6, 0\n\ - movs r2, 0x1\n\ - movs r3, 0x2\n\ - bl ConvertIntToDecimalStringN\n\ - bl sub_81AFBF0\n\ - movs r0, 0\n\ - mov r1, r8\n\ - bl sub_81AFC0C\n\ - movs r0, 0x1\n\ - adds r1, r4, 0\n\ - bl sub_81AFC0C\n\ - ldr r4, =gStringVar4\n\ - ldr r1, =gUnknown_0861CE97\n\ - adds r0, r4, 0\n\ - bl sub_81AFC28\n\ - adds r7, r4, 0\n\ - ldrb r0, [r5]\n\ - adds r1, r6, 0\n\ - bl GetCurrentPpToMaxPpState\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - adds r5, r0, 0\n\ - adds r5, 0x9\n\ - movs r0, 0x1\n\ - adds r1, r7, 0\n\ - movs r2, 0x2C\n\ - bl GetStringRightAlignXOffset\n\ - mov r4, r9\n\ - b _081C3C26\n\ - .pool\n\ -_081C3C00:\n\ - ldr r1, =gText_OneDash\n\ - lsls r4, r7, 4\n\ - adds r3, r4, 0x1\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - str r5, [sp]\n\ - movs r0, 0x1\n\ - str r0, [sp, 0x4]\n\ - mov r0, r8\n\ - movs r2, 0\n\ - bl sub_81C25A4\n\ - ldr r7, =gText_TwoDashes\n\ - movs r5, 0xC\n\ - movs r0, 0x1\n\ - adds r1, r7, 0\n\ - movs r2, 0x2C\n\ - bl GetStringCenterAlignXOffset\n\ -_081C3C26:\n\ - lsls r2, r0, 24\n\ - lsrs r2, 24\n\ - adds r3, r4, 0x1\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - movs r0, 0\n\ - str r0, [sp]\n\ - lsls r0, r5, 24\n\ - lsrs r0, 24\n\ - str r0, [sp, 0x4]\n\ - ldr r0, [sp, 0x8]\n\ - adds r1, r7, 0\n\ - bl sub_81C25A4\n\ - add sp, 0xC\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif - -void sub_81C3C5C(u16 move) -{ - u8 *text; - if (move != 0) - { - FillWindowPixelRect(14, 0, 0x35, 0, 0x13, 0x20); - if (gBattleMoves[move].power <= 1) - text = gText_ThreeDashes; - else - { - ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, 1, 3); - text = gStringVar1; - } - sub_81C25A4(14, text, 0x35, 1, 0, 0); - if (gBattleMoves[move].accuracy == 0) - text = gText_ThreeDashes; - else - { - ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, 1, 3); - text = gStringVar1; - } - sub_81C25A4(14, text, 0x35, 17, 0, 0); - } -} - -void sub_81C3D08() -{ - sub_81C3B08(0); - sub_81C3B08(1); - sub_81C3B08(2); - sub_81C3B08(3); - if (gUnknown_0203CF1C->unk40BC == 3) - { - sub_81C3F44(); - sub_81C3E2C(gUnknown_0203CF1C->unk40C6); - } -} - -void sub_81C3D54(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - s16 dataa = data[0] - 1; - - switch (dataa) - { - case 0: - sub_81C3B08(0); - break; - case 1: - sub_81C3B08(1); - break; - case 2: - sub_81C3B08(2); - break; - case 3: - sub_81C3B08(3); - break; - case 4: - if (gUnknown_0203CF1C->unk40BC == 3) - sub_81C3F44(); - break; - case 5: - if (gUnknown_0203CF1C->unk40BC == 3) - { - if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - sub_81C3E2C(gUnknown_0203CF1C->unk40C6); - } - break; - case 6: - DestroyTask(taskId); - return; - } - data[0]++; -} \ No newline at end of file diff --git a/src/start_menu.c b/src/start_menu.c index 37331a922..be30d0e53 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -207,7 +207,7 @@ static bool32 PrintStartMenuItemsMultistep(s16 *index, u32 n) do { - if (sStartMenuItems[sCurrentStartMenuActions[_index]].func.u8_void == StartMenu_PlayerName) + if (sStartMenuItems[sCurrentStartMenuActions[_index]].func == StartMenu_PlayerName) { } diff --git a/src/tv.c b/src/tv.c index 3c822b394..7f64b46ac 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2353,7 +2353,7 @@ void sub_80EDFB4(TVShow *show) show->secretBaseVisit.move = sTV_SecretBaseVisitMonsTemp[j].move; } -void TV_PutSecretBaseVisitOnTheAir(void) +void sub_80EE104(void) { TVShow *show; diff --git a/sym_ewram.txt b/sym_ewram.txt index f64bb98b8..2ae20d3d3 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1119,10 +1119,68 @@ gUnknown_0203A144: @ 203A144 gUnknown_0203A148: @ 203A148 .space 0x4 - .include "src/decoration.o" - .align 2 +gUnknown_0203A14C: @ 203A14C + .space 0x4 -@ slot_machine +gUnknown_0203A150: @ 203A150 + .space 0x1 + +gUnknown_0203A151: @ 203A151 + .space 0x1 + +gUnknown_0203A152: @ 203A152 + .space 0x10 + +gUnknown_0203A162: @ 203A162 + .space 0xC + +gUnknown_0203A16E: @ 203A16E + .space 0x2 + +gUnknown_0203A170: @ 203A170 + .space 0x2 + +gUnknown_0203A172: @ 203A172 + .space 0x1 + +gUnknown_0203A173: @ 203A173 + .space 0x9 + +gUnknown_0203A17C: @ 203A17C + .space 0xC + +gUnknown_0203A188: @ 203A188 + .space 0x4 + +gUnknown_0203A18C: @ 203A18C + .space 0x4 + +gUnknown_0203A190: @ 203A190 + .space 0x8A4 + +gUnknown_0203AA34: @ 203AA34 + .space 0x2 + +gUnknown_0203AA36: @ 203AA36 + .space 0x2 + +gUnknown_0203AA38: @ 203AA38 + .space 0x1 + +gUnknown_0203AA39: @ 203AA39 + .space 0x1 + +gUnknown_0203AA3A: @ 203AA3A + .space 0x2 + +gUnknown_0203AA3C: @ 203AA3C + .space 0x8 + +gUnknown_0203AA44: @ 203AA44 + .space 0x80 + +gUnknown_0203AAC4: @ 203AAC4 + .space 0x4 gUnknown_0203AAC8: @ 203AAC8 .space 0x4 @@ -1350,7 +1408,9 @@ gUnknown_0203BC34: @ 203BC34 gUnknown_0203BC38: @ 203BC38 .space 0x8 - .include "src/decoration_inventory.o" +gDecorationInventories: @ 203BC40 + .space 0x40 + .include "src/roamer.o" gUnknown_0203BC88: @ 203BC88 From 5b05811dd944e51ce055ad5ddca570808457c7a0 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 14:24:54 +0200 Subject: [PATCH 10/29] start link partner controller --- asm/battle_controller_linkpartner.s | 387 +++++++++++--------------- data/battle_controller_link_partner.s | 65 ----- ld_script.txt | 3 +- src/battle_controller_link_partner.c | 203 ++++++++++++++ 4 files changed, 373 insertions(+), 285 deletions(-) delete mode 100644 data/battle_controller_link_partner.s create mode 100644 src/battle_controller_link_partner.c diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index e8581c396..9f96d592a 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -5,58 +5,7 @@ .text - thumb_func_start nullsub_112 -nullsub_112: @ 814AEAC - bx lr - thumb_func_end nullsub_112 - thumb_func_start SetBankFuncToLinkPartnerBufferRunCommand -SetBankFuncToLinkPartnerBufferRunCommand: @ 814AEB0 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkPartnerBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToLinkPartnerBufferRunCommand - - thumb_func_start LinkPartnerBufferRunCommand -LinkPartnerBufferRunCommand: @ 814AECC - 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 _0814AF18 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0814AF14 - ldr r0, =gLinkPartnerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _0814AF18 - .pool -_0814AF14: - bl LinkPartnerBufferExecCompleted -_0814AF18: - pop {r0} - bx r0 - thumb_func_end LinkPartnerBufferRunCommand thumb_func_start sub_814AF1C sub_814AF1C: @ 814AF1C @@ -1066,8 +1015,8 @@ _0814B80A: .pool thumb_func_end sub_814B7E8 - thumb_func_start dp01t_00_4_getattr -dp01t_00_4_getattr: @ 814B818 + thumb_func_start LinkPartnerHandleGetMonData +LinkPartnerHandleGetMonData: @ 814B818 push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -1119,7 +1068,7 @@ _0814B872: pop {r4-r6} pop {r0} bx r0 - thumb_func_end dp01t_00_4_getattr + thumb_func_end LinkPartnerHandleGetMonData thumb_func_start dp01_getattr_by_ch1_for_player_pokemon__ dp01_getattr_by_ch1_for_player_pokemon__: @ 814B88C @@ -1999,16 +1948,16 @@ _0814C022: .pool thumb_func_end dp01_getattr_by_ch1_for_player_pokemon__ - thumb_func_start sub_814C038 -sub_814C038: @ 814C038 + thumb_func_start LinkPartnerHandleGetRawMonData +LinkPartnerHandleGetRawMonData: @ 814C038 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814C038 + thumb_func_end LinkPartnerHandleGetRawMonData - thumb_func_start sub_814C044 -sub_814C044: @ 814C044 + thumb_func_start LinkPartnerHandleSetMonData +LinkPartnerHandleSetMonData: @ 814C044 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -2048,7 +1997,7 @@ _0814C092: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_814C044 + thumb_func_end LinkPartnerHandleSetMonData thumb_func_start sub_814C09C sub_814C09C: @ 814C09C @@ -3083,8 +3032,8 @@ _0814CA62: .pool thumb_func_end sub_814C09C - thumb_func_start sub_814CA98 -sub_814CA98: @ 814CA98 + thumb_func_start LinkPartnerHandleSetRawMonData +LinkPartnerHandleSetRawMonData: @ 814CA98 push {r4-r7,lr} ldr r1, =gBattlePartyID ldr r7, =gActiveBank @@ -3136,10 +3085,10 @@ _0814CAF0: pop {r0} bx r0 .pool - thumb_func_end sub_814CA98 + thumb_func_end LinkPartnerHandleSetRawMonData - thumb_func_start sub_814CB0C -sub_814CB0C: @ 814CB0C + thumb_func_start LinkPartnerHandleLoadMonSprite +LinkPartnerHandleLoadMonSprite: @ 814CB0C push {r4-r6,lr} mov r6, r8 push {r6} @@ -3253,10 +3202,10 @@ sub_814CB0C: @ 814CB0C pop {r0} bx r0 .pool - thumb_func_end sub_814CB0C + thumb_func_end LinkPartnerHandleLoadMonSprite - thumb_func_start sub_814CC28 -sub_814CC28: @ 814CC28 + thumb_func_start LinkPartnerHandleSwitchInAnim +LinkPartnerHandleSwitchInAnim: @ 814CC28 push {r4-r6,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -3299,7 +3248,7 @@ sub_814CC28: @ 814CC28 pop {r0} bx r0 .pool - thumb_func_end sub_814CC28 + thumb_func_end LinkPartnerHandleSwitchInAnim thumb_func_start sub_814CC98 sub_814CC98: @ 814CC98 @@ -3464,8 +3413,8 @@ sub_814CC98: @ 814CC98 .pool thumb_func_end sub_814CC98 - thumb_func_start sub_814CE14 -sub_814CE14: @ 814CE14 + thumb_func_start LinkPartnerHandleReturnMonToBall +LinkPartnerHandleReturnMonToBall: @ 814CE14 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r6, =gActiveBank @@ -3521,7 +3470,7 @@ _0814CE92: pop {r0} bx r0 .pool - thumb_func_end sub_814CE14 + thumb_func_end LinkPartnerHandleReturnMonToBall thumb_func_start sub_814CEA4 sub_814CEA4: @ 814CEA4 @@ -3593,8 +3542,8 @@ _0814CF22: .pool thumb_func_end sub_814CEA4 - thumb_func_start sub_814CF30 -sub_814CF30: @ 814CF30 + thumb_func_start LinkPartnerHandleDrawTrainerPic +LinkPartnerHandleDrawTrainerPic: @ 814CF30 push {r4-r7,lr} mov r7, r8 push {r7} @@ -3784,18 +3733,18 @@ _0814D002: pop {r0} bx r0 .pool - thumb_func_end sub_814CF30 + thumb_func_end LinkPartnerHandleDrawTrainerPic - thumb_func_start sub_814D0E4 -sub_814D0E4: @ 814D0E4 + thumb_func_start LinkPartnerHandleTrainerSlide +LinkPartnerHandleTrainerSlide: @ 814D0E4 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D0E4 + thumb_func_end LinkPartnerHandleTrainerSlide - thumb_func_start sub_814D0F0 -sub_814D0F0: @ 814D0F0 + thumb_func_start LinkPartnerHandleTrainerSlideBack +LinkPartnerHandleTrainerSlideBack: @ 814D0F0 push {r4-r6,lr} ldr r6, =gBankSpriteIds ldr r4, =gActiveBank @@ -3865,10 +3814,10 @@ sub_814D0F0: @ 814D0F0 pop {r0} bx r0 .pool - thumb_func_end sub_814D0F0 + thumb_func_end LinkPartnerHandleTrainerSlideBack - thumb_func_start sub_814D19C -sub_814D19C: @ 814D19C + thumb_func_start LinkPartnerHandleFaintAnimation +LinkPartnerHandleFaintAnimation: @ 814D19C push {r4-r6,lr} ldr r6, =gBattleSpritesDataPtr ldr r4, [r6] @@ -3970,42 +3919,42 @@ _0814D266: pop {r0} bx r0 .pool - thumb_func_end sub_814D19C + thumb_func_end LinkPartnerHandleFaintAnimation - thumb_func_start sub_814D288 -sub_814D288: @ 814D288 + thumb_func_start LinkPartnerHandlePaletteFade +LinkPartnerHandlePaletteFade: @ 814D288 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D288 + thumb_func_end LinkPartnerHandlePaletteFade - thumb_func_start sub_814D294 -sub_814D294: @ 814D294 + thumb_func_start LinkPartnerHandleSuccessBallThrowAnim +LinkPartnerHandleSuccessBallThrowAnim: @ 814D294 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D294 + thumb_func_end LinkPartnerHandleSuccessBallThrowAnim - thumb_func_start sub_814D2A0 -sub_814D2A0: @ 814D2A0 + thumb_func_start LinkPartnerHandleBallThrowAnim +LinkPartnerHandleBallThrowAnim: @ 814D2A0 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D2A0 + thumb_func_end LinkPartnerHandleBallThrowAnim - thumb_func_start sub_814D2AC -sub_814D2AC: @ 814D2AC + thumb_func_start LinkPartnerHandlePause +LinkPartnerHandlePause: @ 814D2AC push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D2AC + thumb_func_end LinkPartnerHandlePause - thumb_func_start sub_814D2B8 -sub_814D2B8: @ 814D2B8 + thumb_func_start LinkPartnerHandleMoveAnimation +LinkPartnerHandleMoveAnimation: @ 814D2B8 push {r4-r7,lr} mov r7, r8 push {r7} @@ -4151,7 +4100,7 @@ _0814D3F4: pop {r0} bx r0 .pool - thumb_func_end sub_814D2B8 + thumb_func_end LinkPartnerHandleMoveAnimation thumb_func_start bx_move_anim_4 bx_move_anim_4: @ 814D40C @@ -4337,8 +4286,8 @@ _0814D580: bx r0 thumb_func_end bx_move_anim_4 - thumb_func_start sub_814D590 -sub_814D590: @ 814D590 + thumb_func_start LinkPartnerHandlePrintString +LinkPartnerHandlePrintString: @ 814D590 push {r4,r5,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -4367,66 +4316,66 @@ sub_814D590: @ 814D590 pop {r0} bx r0 .pool - thumb_func_end sub_814D590 + thumb_func_end LinkPartnerHandlePrintString - thumb_func_start sub_814D5E8 -sub_814D5E8: @ 814D5E8 + thumb_func_start LinkPartnerHandlePrintStringPlayerOnly +LinkPartnerHandlePrintStringPlayerOnly: @ 814D5E8 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D5E8 + thumb_func_end LinkPartnerHandlePrintStringPlayerOnly - thumb_func_start sub_814D5F4 -sub_814D5F4: @ 814D5F4 + thumb_func_start LinkPartnerHandleChooseAction +LinkPartnerHandleChooseAction: @ 814D5F4 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D5F4 + thumb_func_end LinkPartnerHandleChooseAction - thumb_func_start sub_814D600 -sub_814D600: @ 814D600 + thumb_func_start LinkPartnerHandleUnknownYesNoBox +LinkPartnerHandleUnknownYesNoBox: @ 814D600 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D600 + thumb_func_end LinkPartnerHandleUnknownYesNoBox - thumb_func_start sub_814D60C -sub_814D60C: @ 814D60C + thumb_func_start LinkPartnerHandleChooseMove +LinkPartnerHandleChooseMove: @ 814D60C push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D60C + thumb_func_end LinkPartnerHandleChooseMove - thumb_func_start sub_814D618 -sub_814D618: @ 814D618 + thumb_func_start LinkPartnerHandleChooseItem +LinkPartnerHandleChooseItem: @ 814D618 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D618 + thumb_func_end LinkPartnerHandleChooseItem - thumb_func_start sub_814D624 -sub_814D624: @ 814D624 + thumb_func_start LinkPartnerHandleChoosePokemon +LinkPartnerHandleChoosePokemon: @ 814D624 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D624 + thumb_func_end LinkPartnerHandleChoosePokemon - thumb_func_start sub_814D630 -sub_814D630: @ 814D630 + thumb_func_start LinkPartnerHandleCmd23 +LinkPartnerHandleCmd23: @ 814D630 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D630 + thumb_func_end LinkPartnerHandleCmd23 - thumb_func_start sub_814D63C -sub_814D63C: @ 814D63C + thumb_func_start LinkPartnerHandleHealthBarUpdate +LinkPartnerHandleHealthBarUpdate: @ 814D63C push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -4519,18 +4468,18 @@ _0814D6F6: pop {r0} bx r0 .pool - thumb_func_end sub_814D63C + thumb_func_end LinkPartnerHandleHealthBarUpdate - thumb_func_start sub_814D72C -sub_814D72C: @ 814D72C + thumb_func_start LinkPartnerHandleExpUpdate +LinkPartnerHandleExpUpdate: @ 814D72C push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D72C + thumb_func_end LinkPartnerHandleExpUpdate - thumb_func_start sub_814D738 -sub_814D738: @ 814D738 + thumb_func_start LinkPartnerHandleStatusIconUpdate +LinkPartnerHandleStatusIconUpdate: @ 814D738 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -4576,10 +4525,10 @@ _0814D78C: pop {r0} bx r0 .pool - thumb_func_end sub_814D738 + thumb_func_end LinkPartnerHandleStatusIconUpdate - thumb_func_start sub_814D7B0 -sub_814D7B0: @ 814D7B0 + thumb_func_start LinkPartnerHandleStatusAnimation +LinkPartnerHandleStatusAnimation: @ 814D7B0 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -4623,82 +4572,82 @@ _0814D800: pop {r0} bx r0 .pool - thumb_func_end sub_814D7B0 + thumb_func_end LinkPartnerHandleStatusAnimation - thumb_func_start sub_814D818 -sub_814D818: @ 814D818 + thumb_func_start LinkPartnerHandleStatusXor +LinkPartnerHandleStatusXor: @ 814D818 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D818 + thumb_func_end LinkPartnerHandleStatusXor - thumb_func_start sub_814D824 -sub_814D824: @ 814D824 + thumb_func_start LinkPartnerHandleDataTransfer +LinkPartnerHandleDataTransfer: @ 814D824 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D824 + thumb_func_end LinkPartnerHandleDataTransfer - thumb_func_start sub_814D830 -sub_814D830: @ 814D830 + thumb_func_start LinkPartnerHandleDMA3Transfer +LinkPartnerHandleDMA3Transfer: @ 814D830 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D830 + thumb_func_end LinkPartnerHandleDMA3Transfer - thumb_func_start sub_814D83C -sub_814D83C: @ 814D83C + thumb_func_start LinkPartnerHandlePlayBGM +LinkPartnerHandlePlayBGM: @ 814D83C push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D83C + thumb_func_end LinkPartnerHandlePlayBGM - thumb_func_start sub_814D848 -sub_814D848: @ 814D848 + thumb_func_start LinkPartnerHandleCmd32 +LinkPartnerHandleCmd32: @ 814D848 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D848 + thumb_func_end LinkPartnerHandleCmd32 - thumb_func_start sub_814D854 -sub_814D854: @ 814D854 + thumb_func_start LinkPartnerHandleTwoReturnValues +LinkPartnerHandleTwoReturnValues: @ 814D854 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D854 + thumb_func_end LinkPartnerHandleTwoReturnValues - thumb_func_start sub_814D860 -sub_814D860: @ 814D860 + thumb_func_start LinkPartnerHandleChosenMonReturnValue +LinkPartnerHandleChosenMonReturnValue: @ 814D860 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D860 + thumb_func_end LinkPartnerHandleChosenMonReturnValue - thumb_func_start sub_814D86C -sub_814D86C: @ 814D86C + thumb_func_start LinkPartnerHandleOneReturnValue +LinkPartnerHandleOneReturnValue: @ 814D86C push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D86C + thumb_func_end LinkPartnerHandleOneReturnValue - thumb_func_start sub_814D878 -sub_814D878: @ 814D878 + thumb_func_start LinkPartnerHandleOneReturnValue_Duplicate +LinkPartnerHandleOneReturnValue_Duplicate: @ 814D878 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D878 + thumb_func_end LinkPartnerHandleOneReturnValue_Duplicate - thumb_func_start sub_814D884 -sub_814D884: @ 814D884 + thumb_func_start LinkPartnerHandleCmd37 +LinkPartnerHandleCmd37: @ 814D884 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -4710,10 +4659,10 @@ sub_814D884: @ 814D884 pop {r0} bx r0 .pool - thumb_func_end sub_814D884 + thumb_func_end LinkPartnerHandleCmd37 - thumb_func_start sub_814D8A0 -sub_814D8A0: @ 814D8A0 + thumb_func_start LinkPartnerHandleCmd38 +LinkPartnerHandleCmd38: @ 814D8A0 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, =gBattleBufferA @@ -4735,10 +4684,10 @@ sub_814D8A0: @ 814D8A0 pop {r0} bx r0 .pool - thumb_func_end sub_814D8A0 + thumb_func_end LinkPartnerHandleCmd38 - thumb_func_start sub_814D8D8 -sub_814D8D8: @ 814D8D8 + thumb_func_start LinkPartnerHandleCmd39 +LinkPartnerHandleCmd39: @ 814D8D8 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -4749,10 +4698,10 @@ sub_814D8D8: @ 814D8D8 pop {r0} bx r0 .pool - thumb_func_end sub_814D8D8 + thumb_func_end LinkPartnerHandleCmd39 - thumb_func_start sub_814D8F0 -sub_814D8F0: @ 814D8F0 + thumb_func_start LinkPartnerHandleCmd40 +LinkPartnerHandleCmd40: @ 814D8F0 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, [r3] @@ -4770,10 +4719,10 @@ sub_814D8F0: @ 814D8F0 pop {r0} bx r0 .pool - thumb_func_end sub_814D8F0 + thumb_func_end LinkPartnerHandleCmd40 - thumb_func_start dp01t_29_4_blink -dp01t_29_4_blink: @ 814D918 + thumb_func_start LinkPartnerHandleHitAnimation +LinkPartnerHandleHitAnimation: @ 814D918 push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -4819,18 +4768,18 @@ _0814D976: pop {r0} bx r0 .pool - thumb_func_end dp01t_29_4_blink + thumb_func_end LinkPartnerHandleHitAnimation - thumb_func_start sub_814D988 -sub_814D988: @ 814D988 + thumb_func_start LinkPartnerHandleCmd42 +LinkPartnerHandleCmd42: @ 814D988 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814D988 + thumb_func_end LinkPartnerHandleCmd42 - thumb_func_start sub_814D994 -sub_814D994: @ 814D994 + thumb_func_start LinkPartnerHandleEffectivenessSound +LinkPartnerHandleEffectivenessSound: @ 814D994 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -4860,10 +4809,10 @@ _0814D9A8: pop {r0} bx r0 .pool - thumb_func_end sub_814D994 + thumb_func_end LinkPartnerHandleEffectivenessSound - thumb_func_start sub_814D9D8 -sub_814D9D8: @ 814D9D8 + thumb_func_start LinkPartnerHandlePlayFanfareOrBGM +LinkPartnerHandlePlayFanfareOrBGM: @ 814D9D8 push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -4903,10 +4852,10 @@ _0814DA28: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_814D9D8 + thumb_func_end LinkPartnerHandlePlayFanfareOrBGM - thumb_func_start sub_814DA34 -sub_814DA34: @ 814DA34 + thumb_func_start LinkPartnerHandleFaintingCry +LinkPartnerHandleFaintingCry: @ 814DA34 push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -4930,10 +4879,10 @@ sub_814DA34: @ 814DA34 pop {r0} bx r0 .pool - thumb_func_end sub_814DA34 + thumb_func_end LinkPartnerHandleFaintingCry - thumb_func_start dp01t_2E_4_battle_intro -dp01t_2E_4_battle_intro: @ 814DA74 + thumb_func_start LinkPartnerHandleIntroSlide +LinkPartnerHandleIntroSlide: @ 814DA74 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -4952,10 +4901,10 @@ dp01t_2E_4_battle_intro: @ 814DA74 pop {r0} bx r0 .pool - thumb_func_end dp01t_2E_4_battle_intro + thumb_func_end LinkPartnerHandleIntroSlide - thumb_func_start sub_814DAA8 -sub_814DAA8: @ 814DAA8 + thumb_func_start LinkPartnerHandleIntroTrainerBallThrow +LinkPartnerHandleIntroTrainerBallThrow: @ 814DAA8 push {r4-r7,lr} ldr r5, =gBankSpriteIds ldr r6, =gActiveBank @@ -5186,7 +5135,7 @@ _0814DC80: pop {r0} bx r0 .pool - thumb_func_end sub_814DAA8 + thumb_func_end LinkPartnerHandleIntroTrainerBallThrow thumb_func_start sub_814DCCC sub_814DCCC: @ 814DCCC @@ -5305,8 +5254,8 @@ _0814DDB4: .pool thumb_func_end sub_814DCCC - thumb_func_start sub_814DDD8 -sub_814DDD8: @ 814DDD8 + thumb_func_start LinkPartnerHandleDrawPartyStatusSummary +LinkPartnerHandleDrawPartyStatusSummary: @ 814DDD8 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5389,7 +5338,7 @@ _0814DE7C: pop {r0} bx r0 .pool - thumb_func_end sub_814DDD8 + thumb_func_end LinkPartnerHandleDrawPartyStatusSummary thumb_func_start sub_814DE9C sub_814DE9C: @ 814DE9C @@ -5427,8 +5376,8 @@ _0814DED4: .pool thumb_func_end sub_814DE9C - thumb_func_start sub_814DEE4 -sub_814DEE4: @ 814DEE4 + thumb_func_start LinkPartnerHandleCmd49 +LinkPartnerHandleCmd49: @ 814DEE4 push {lr} ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] @@ -5459,18 +5408,18 @@ _0814DF16: pop {r0} bx r0 .pool - thumb_func_end sub_814DEE4 + thumb_func_end LinkPartnerHandleCmd49 - thumb_func_start sub_814DF34 -sub_814DF34: @ 814DF34 + thumb_func_start LinkPartnerHandleCmd50 +LinkPartnerHandleCmd50: @ 814DF34 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814DF34 + thumb_func_end LinkPartnerHandleCmd50 - thumb_func_start sub_814DF40 -sub_814DF40: @ 814DF40 + thumb_func_start LinkPartnerHandleSpriteInvisibility +LinkPartnerHandleSpriteInvisibility: @ 814DF40 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5510,10 +5459,10 @@ _0814DF86: pop {r0} bx r0 .pool - thumb_func_end sub_814DF40 + thumb_func_end LinkPartnerHandleSpriteInvisibility - thumb_func_start sub_814DFA0 -sub_814DFA0: @ 814DFA0 + thumb_func_start LinkPartnerHandleBattleAnimation +LinkPartnerHandleBattleAnimation: @ 814DFA0 push {r4-r6,lr} sub sp, 0x4 ldr r5, =gActiveBank @@ -5563,10 +5512,10 @@ _0814E002: pop {r0} bx r0 .pool - thumb_func_end sub_814DFA0 + thumb_func_end LinkPartnerHandleBattleAnimation - thumb_func_start sub_814E014 -sub_814E014: @ 814E014 + thumb_func_start LinkPartnerHandleLinkStandbyMsg +LinkPartnerHandleLinkStandbyMsg: @ 814E014 push {lr} ldr r0, =gActiveBank ldrb r0, [r0] @@ -5578,18 +5527,18 @@ sub_814E014: @ 814E014 pop {r0} bx r0 .pool - thumb_func_end sub_814E014 + thumb_func_end LinkPartnerHandleLinkStandbyMsg - thumb_func_start sub_814E034 -sub_814E034: @ 814E034 + thumb_func_start LinkPartnerHandleResetActionMoveSelection +LinkPartnerHandleResetActionMoveSelection: @ 814E034 push {lr} bl LinkPartnerBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_814E034 + thumb_func_end LinkPartnerHandleResetActionMoveSelection - thumb_func_start sub_814E040 -sub_814E040: @ 814E040 + thumb_func_start LinkPartnerHandleCmd55 +LinkPartnerHandleCmd55: @ 814E040 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -5637,7 +5586,7 @@ sub_814E040: @ 814E040 pop {r0} bx r0 .pool - thumb_func_end sub_814E040 + thumb_func_end LinkPartnerHandleCmd55 thumb_func_start nullsub_113 nullsub_113: @ 814E0C0 diff --git a/data/battle_controller_link_partner.s b/data/battle_controller_link_partner.s deleted file mode 100644 index 1990ad870..000000000 --- a/data/battle_controller_link_partner.s +++ /dev/null @@ -1,65 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gLinkPartnerBufferCommands:: @ 85C9A94 - .4byte dp01t_00_4_getattr - .4byte sub_814C038 - .4byte sub_814C044 - .4byte sub_814CA98 - .4byte sub_814CB0C - .4byte sub_814CC28 - .4byte sub_814CE14 - .4byte sub_814CF30 - .4byte sub_814D0E4 - .4byte sub_814D0F0 - .4byte sub_814D19C - .4byte sub_814D288 - .4byte sub_814D294 - .4byte sub_814D2A0 - .4byte sub_814D2AC - .4byte sub_814D2B8 - .4byte sub_814D590 - .4byte sub_814D5E8 - .4byte sub_814D5F4 - .4byte sub_814D600 - .4byte sub_814D60C - .4byte sub_814D618 - .4byte sub_814D624 - .4byte sub_814D630 - .4byte sub_814D63C - .4byte sub_814D72C - .4byte sub_814D738 - .4byte sub_814D7B0 - .4byte sub_814D818 - .4byte sub_814D824 - .4byte sub_814D830 - .4byte sub_814D83C - .4byte sub_814D848 - .4byte sub_814D854 - .4byte sub_814D860 - .4byte sub_814D86C - .4byte sub_814D878 - .4byte sub_814D884 - .4byte sub_814D8A0 - .4byte sub_814D8D8 - .4byte sub_814D8F0 - .4byte dp01t_29_4_blink - .4byte sub_814D988 - .4byte sub_814D994 - .4byte sub_814D9D8 - .4byte sub_814DA34 - .4byte dp01t_2E_4_battle_intro - .4byte sub_814DAA8 - .4byte sub_814DDD8 - .4byte sub_814DEE4 - .4byte sub_814DF34 - .4byte sub_814DF40 - .4byte sub_814DFA0 - .4byte sub_814E014 - .4byte sub_814E034 - .4byte sub_814E040 - .4byte nullsub_113 - diff --git a/ld_script.txt b/ld_script.txt index 0296ddd56..53144817f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -190,6 +190,7 @@ SECTIONS { asm/landmark.o(.text); asm/fldeff_strength.o(.text); asm/battle_transition.o(.text); + src/battle_controller_link_partner.o(.text); asm/battle_controller_linkpartner.o(.text); src/battle_message.o(.text); asm/cable_car.o(.text); @@ -420,7 +421,7 @@ SECTIONS { data/contest_painting.o(.rodata); src/battle_ai_script_commands.o(.rodata); data/data4.o(.rodata); - data/battle_controller_link_partner.o(.rodata); + src/battle_controller_link_partner.o(.rodata); src/battle_message.o(.rodata); data/cable_car.o(.rodata); data/save.o(.rodata); diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c new file mode 100644 index 000000000..62361ebef --- /dev/null +++ b/src/battle_controller_link_partner.c @@ -0,0 +1,203 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.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" +#include "pokeball.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +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 struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; + +extern void sub_81358F4(void); +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); + +// this file's functions +void LinkPartnerHandleGetMonData(void); +void LinkPartnerHandleGetRawMonData(void); +void LinkPartnerHandleSetMonData(void); +void LinkPartnerHandleSetRawMonData(void); +void LinkPartnerHandleLoadMonSprite(void); +void LinkPartnerHandleSwitchInAnim(void); +void LinkPartnerHandleReturnMonToBall(void); +void LinkPartnerHandleDrawTrainerPic(void); +void LinkPartnerHandleTrainerSlide(void); +void LinkPartnerHandleTrainerSlideBack(void); +void LinkPartnerHandleFaintAnimation(void); +void LinkPartnerHandlePaletteFade(void); +void LinkPartnerHandleSuccessBallThrowAnim(void); +void LinkPartnerHandleBallThrowAnim(void); +void LinkPartnerHandlePause(void); +void LinkPartnerHandleMoveAnimation(void); +void LinkPartnerHandlePrintString(void); +void LinkPartnerHandlePrintStringPlayerOnly(void); +void LinkPartnerHandleChooseAction(void); +void LinkPartnerHandleUnknownYesNoBox(void); +void LinkPartnerHandleChooseMove(void); +void LinkPartnerHandleChooseItem(void); +void LinkPartnerHandleChoosePokemon(void); +void LinkPartnerHandleCmd23(void); +void LinkPartnerHandleHealthBarUpdate(void); +void LinkPartnerHandleExpUpdate(void); +void LinkPartnerHandleStatusIconUpdate(void); +void LinkPartnerHandleStatusAnimation(void); +void LinkPartnerHandleStatusXor(void); +void LinkPartnerHandleDataTransfer(void); +void LinkPartnerHandleDMA3Transfer(void); +void LinkPartnerHandlePlayBGM(void); +void LinkPartnerHandleCmd32(void); +void LinkPartnerHandleTwoReturnValues(void); +void LinkPartnerHandleChosenMonReturnValue(void); +void LinkPartnerHandleOneReturnValue(void); +void LinkPartnerHandleOneReturnValue_Duplicate(void); +void LinkPartnerHandleCmd37(void); +void LinkPartnerHandleCmd38(void); +void LinkPartnerHandleCmd39(void); +void LinkPartnerHandleCmd40(void); +void LinkPartnerHandleHitAnimation(void); +void LinkPartnerHandleCmd42(void); +void LinkPartnerHandleEffectivenessSound(void); +void LinkPartnerHandlePlayFanfareOrBGM(void); +void LinkPartnerHandleFaintingCry(void); +void LinkPartnerHandleIntroSlide(void); +void LinkPartnerHandleIntroTrainerBallThrow(void); +void LinkPartnerHandleDrawPartyStatusSummary(void); +void LinkPartnerHandleCmd49(void); +void LinkPartnerHandleCmd50(void); +void LinkPartnerHandleSpriteInvisibility(void); +void LinkPartnerHandleBattleAnimation(void); +void LinkPartnerHandleLinkStandbyMsg(void); +void LinkPartnerHandleResetActionMoveSelection(void); +void LinkPartnerHandleCmd55(void); +void nullsub_113(void); + +void LinkPartnerBufferRunCommand(void); +void LinkPartnerBufferExecCompleted(void); + +void (*const gLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + LinkPartnerHandleGetMonData, + LinkPartnerHandleGetRawMonData, + LinkPartnerHandleSetMonData, + LinkPartnerHandleSetRawMonData, + LinkPartnerHandleLoadMonSprite, + LinkPartnerHandleSwitchInAnim, + LinkPartnerHandleReturnMonToBall, + LinkPartnerHandleDrawTrainerPic, + LinkPartnerHandleTrainerSlide, + LinkPartnerHandleTrainerSlideBack, + LinkPartnerHandleFaintAnimation, + LinkPartnerHandlePaletteFade, + LinkPartnerHandleSuccessBallThrowAnim, + LinkPartnerHandleBallThrowAnim, + LinkPartnerHandlePause, + LinkPartnerHandleMoveAnimation, + LinkPartnerHandlePrintString, + LinkPartnerHandlePrintStringPlayerOnly, + LinkPartnerHandleChooseAction, + LinkPartnerHandleUnknownYesNoBox, + LinkPartnerHandleChooseMove, + LinkPartnerHandleChooseItem, + LinkPartnerHandleChoosePokemon, + LinkPartnerHandleCmd23, + LinkPartnerHandleHealthBarUpdate, + LinkPartnerHandleExpUpdate, + LinkPartnerHandleStatusIconUpdate, + LinkPartnerHandleStatusAnimation, + LinkPartnerHandleStatusXor, + LinkPartnerHandleDataTransfer, + LinkPartnerHandleDMA3Transfer, + LinkPartnerHandlePlayBGM, + LinkPartnerHandleCmd32, + LinkPartnerHandleTwoReturnValues, + LinkPartnerHandleChosenMonReturnValue, + LinkPartnerHandleOneReturnValue, + LinkPartnerHandleOneReturnValue_Duplicate, + LinkPartnerHandleCmd37, + LinkPartnerHandleCmd38, + LinkPartnerHandleCmd39, + LinkPartnerHandleCmd40, + LinkPartnerHandleHitAnimation, + LinkPartnerHandleCmd42, + LinkPartnerHandleEffectivenessSound, + LinkPartnerHandlePlayFanfareOrBGM, + LinkPartnerHandleFaintingCry, + LinkPartnerHandleIntroSlide, + LinkPartnerHandleIntroTrainerBallThrow, + LinkPartnerHandleDrawPartyStatusSummary, + LinkPartnerHandleCmd49, + LinkPartnerHandleCmd50, + LinkPartnerHandleSpriteInvisibility, + LinkPartnerHandleBattleAnimation, + LinkPartnerHandleLinkStandbyMsg, + LinkPartnerHandleResetActionMoveSelection, + LinkPartnerHandleCmd55, + nullsub_113 +}; + +void nullsub_112(void) +{ +} + +void SetBankFuncToLinkPartnerBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = LinkPartnerBufferRunCommand; +} + +void LinkPartnerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gLinkPartnerBufferCommands)) + gLinkPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + LinkPartnerBufferExecCompleted(); + } +} From 356eb34e3213c95a7ce072bdfc860601dbf464fe Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 14:40:22 +0200 Subject: [PATCH 11/29] undo revert --- Makefile | 4 +- asm/decoration.s | 7167 --------------- asm/decoration_inventory.s | 459 - asm/pokemon_summary_screen.s | 7826 ----------------- asm/secret_base.s | 2 +- asm/trader.s | 10 +- data/cute_sketch.s | 2 +- data/decoration.s | 86 - data/graphics.s | 5 +- .../decorations/decoration_graphics.inc | 252 + data/pokemon_summary_screen.s | 5 +- data/strings.s | 28 +- graphics/decorations/decor_attract_mat.pal | 19 + graphics/decorations/decor_attract_mat.png | Bin 0 -> 307 bytes graphics/decorations/decor_big_plant.pal | 19 + graphics/decorations/decor_big_plant.png | Bin 0 -> 310 bytes graphics/decorations/decor_blastoise_doll.pal | 19 + graphics/decorations/decor_blastoise_doll.png | Bin 0 -> 371 bytes graphics/decorations/decor_blue_brick.pal | 19 + graphics/decorations/decor_blue_brick.png | Bin 0 -> 226 bytes graphics/decorations/decor_blue_tent.pal | 19 + graphics/decorations/decor_blue_tent.png | Bin 0 -> 321 bytes graphics/decorations/decor_breakable_door.pal | 19 + graphics/decorations/decor_breakable_door.png | Bin 0 -> 274 bytes graphics/decorations/decor_brick_desk.pal | 19 + graphics/decorations/decor_brick_desk.png | Bin 0 -> 270 bytes graphics/decorations/decor_camp_desk.pal | 19 + graphics/decorations/decor_camp_desk.png | Bin 0 -> 265 bytes graphics/decorations/decor_charizard_doll.pal | 19 + graphics/decorations/decor_charizard_doll.png | Bin 0 -> 349 bytes graphics/decorations/decor_colorful_plant.pal | 19 + graphics/decorations/decor_colorful_plant.png | Bin 0 -> 371 bytes graphics/decorations/decor_comfort_desk.pal | 19 + graphics/decorations/decor_comfort_desk.png | Bin 0 -> 320 bytes graphics/decorations/decor_fire_blast_mat.pal | 19 + graphics/decorations/decor_fire_blast_mat.png | Bin 0 -> 287 bytes graphics/decorations/decor_fissure_mat.pal | 19 + graphics/decorations/decor_fissure_mat.png | Bin 0 -> 290 bytes graphics/decorations/decor_glass_ornament.pal | 19 + graphics/decorations/decor_glass_ornament.png | Bin 0 -> 292 bytes graphics/decorations/decor_gorgeous_plant.pal | 19 + graphics/decorations/decor_gorgeous_plant.png | Bin 0 -> 332 bytes graphics/decorations/decor_hard_desk.pal | 19 + graphics/decorations/decor_hard_desk.png | Bin 0 -> 325 bytes graphics/decorations/decor_heavy_desk.pal | 19 + graphics/decorations/decor_heavy_desk.png | Bin 0 -> 268 bytes graphics/decorations/decor_lapras_doll.pal | 19 + graphics/decorations/decor_lapras_doll.png | Bin 0 -> 349 bytes .../decorations/decor_powder_snow_mat.pal | 19 + .../decorations/decor_powder_snow_mat.png | Bin 0 -> 302 bytes graphics/decorations/decor_pretty_desk.pal | 19 + graphics/decorations/decor_pretty_desk.png | Bin 0 -> 296 bytes graphics/decorations/decor_pretty_flowers.pal | 19 + graphics/decorations/decor_pretty_flowers.png | Bin 0 -> 318 bytes graphics/decorations/decor_ragged_desk.pal | 19 + graphics/decorations/decor_ragged_desk.png | Bin 0 -> 257 bytes graphics/decorations/decor_red_brick.pal | 19 + graphics/decorations/decor_red_brick.png | Bin 0 -> 226 bytes graphics/decorations/decor_red_plant.pal | 19 + graphics/decorations/decor_red_plant.png | Bin 0 -> 300 bytes graphics/decorations/decor_red_tent.pal | 19 + graphics/decorations/decor_red_tent.png | Bin 0 -> 317 bytes graphics/decorations/decor_regice_doll.pal | 19 + graphics/decorations/decor_regice_doll.png | Bin 0 -> 346 bytes graphics/decorations/decor_regirock_doll.pal | 19 + graphics/decorations/decor_regirock_doll.png | Bin 0 -> 331 bytes graphics/decorations/decor_registeel_doll.pal | 19 + graphics/decorations/decor_registeel_doll.png | Bin 0 -> 351 bytes graphics/decorations/decor_rhydon_doll.pal | 19 + graphics/decorations/decor_rhydon_doll.png | Bin 0 -> 367 bytes graphics/decorations/decor_sand_ornament.pal | 19 + graphics/decorations/decor_sand_ornament.png | Bin 0 -> 286 bytes graphics/decorations/decor_slide.pal | 19 + graphics/decorations/decor_slide.png | Bin 0 -> 293 bytes graphics/decorations/decor_snorlax_doll.pal | 19 + graphics/decorations/decor_snorlax_doll.png | Bin 0 -> 337 bytes graphics/decorations/decor_solid_board.pal | 19 + graphics/decorations/decor_solid_board.png | Bin 0 -> 221 bytes graphics/decorations/decor_spikes_mat.pal | 19 + graphics/decorations/decor_spikes_mat.png | Bin 0 -> 302 bytes graphics/decorations/decor_stand.pal | 19 + graphics/decorations/decor_stand.png | Bin 0 -> 264 bytes graphics/decorations/decor_surf_mat.pal | 19 + graphics/decorations/decor_surf_mat.png | Bin 0 -> 298 bytes graphics/decorations/decor_thunder_mat.pal | 19 + graphics/decorations/decor_thunder_mat.png | Bin 0 -> 315 bytes graphics/decorations/decor_tire.pal | 19 + graphics/decorations/decor_tire.png | Bin 0 -> 303 bytes graphics/decorations/decor_tropical_plant.pal | 19 + graphics/decorations/decor_tropical_plant.png | Bin 0 -> 307 bytes graphics/decorations/decor_venusaur_doll.pal | 19 + graphics/decorations/decor_venusaur_doll.png | Bin 0 -> 393 bytes graphics/decorations/decor_wailmer_doll.pal | 19 + graphics/decorations/decor_wailmer_doll.png | Bin 0 -> 320 bytes graphics/decorations/decor_yellow_brick.pal | 19 + graphics/decorations/decor_yellow_brick.png | Bin 0 -> 226 bytes graphics/decorations/unk_85a6bb0.pal | 19 + graphics/decorations/unk_85a7308.pal | 19 + graphics/decorations/unk_85a7328.pal | 19 + graphics/misc/decoration_unk_85a7358.png | Bin 0 -> 87 bytes include/battle.h | 22 + include/data/decoration/description.h | 581 ++ include/data/decoration/header.h | 1100 +++ include/data/decoration/icon.h | 132 + include/data/decoration/tilemaps.h | 239 + include/data/decoration/tiles.h | 646 ++ include/decoration.h | 53 + include/decoration_inventory.h | 10 + include/event_scripts.h | 4 + include/field_map_obj.h | 1 + include/field_screen.h | 12 + include/fieldmap.h | 3 + include/global.h | 6 +- include/graphics.h | 95 + include/international_string_util.h | 8 +- include/item_icon.h | 17 + include/list_menu.h | 54 + include/map_object_constants.h | 239 + include/menu.h | 17 +- include/menu_helpers.h | 9 + include/menu_indicators.h | 12 + include/new_menu_helpers.h | 7 + include/overworld.h | 4 + include/player_pc.h | 12 + include/secret_base.h | 1 + include/strings.h | 34 + include/tilesets.h | 13 + include/trader.h | 11 + include/tv.h | 1 + ld_script.txt | 7 +- src/decoration.c | 2781 ++++++ src/decoration_inventory.c | 189 + src/international_string_util.c | 8 +- src/pokemon_summary_screen.c | 3679 ++++++++ src/start_menu.c | 2 +- src/tv.c | 2 +- sym_ewram.txt | 68 +- 137 files changed, 11131 insertions(+), 15649 deletions(-) delete mode 100644 asm/decoration.s delete mode 100644 asm/decoration_inventory.s delete mode 100644 data/decoration.s create mode 100644 data/graphics/decorations/decoration_graphics.inc create mode 100644 graphics/decorations/decor_attract_mat.pal create mode 100644 graphics/decorations/decor_attract_mat.png create mode 100644 graphics/decorations/decor_big_plant.pal create mode 100644 graphics/decorations/decor_big_plant.png create mode 100644 graphics/decorations/decor_blastoise_doll.pal create mode 100644 graphics/decorations/decor_blastoise_doll.png create mode 100644 graphics/decorations/decor_blue_brick.pal create mode 100644 graphics/decorations/decor_blue_brick.png create mode 100644 graphics/decorations/decor_blue_tent.pal create mode 100644 graphics/decorations/decor_blue_tent.png create mode 100644 graphics/decorations/decor_breakable_door.pal create mode 100644 graphics/decorations/decor_breakable_door.png create mode 100644 graphics/decorations/decor_brick_desk.pal create mode 100644 graphics/decorations/decor_brick_desk.png create mode 100644 graphics/decorations/decor_camp_desk.pal create mode 100644 graphics/decorations/decor_camp_desk.png create mode 100644 graphics/decorations/decor_charizard_doll.pal create mode 100644 graphics/decorations/decor_charizard_doll.png create mode 100644 graphics/decorations/decor_colorful_plant.pal create mode 100644 graphics/decorations/decor_colorful_plant.png create mode 100644 graphics/decorations/decor_comfort_desk.pal create mode 100644 graphics/decorations/decor_comfort_desk.png create mode 100644 graphics/decorations/decor_fire_blast_mat.pal create mode 100644 graphics/decorations/decor_fire_blast_mat.png create mode 100644 graphics/decorations/decor_fissure_mat.pal create mode 100644 graphics/decorations/decor_fissure_mat.png create mode 100644 graphics/decorations/decor_glass_ornament.pal create mode 100644 graphics/decorations/decor_glass_ornament.png create mode 100644 graphics/decorations/decor_gorgeous_plant.pal create mode 100644 graphics/decorations/decor_gorgeous_plant.png create mode 100644 graphics/decorations/decor_hard_desk.pal create mode 100644 graphics/decorations/decor_hard_desk.png create mode 100644 graphics/decorations/decor_heavy_desk.pal create mode 100644 graphics/decorations/decor_heavy_desk.png create mode 100644 graphics/decorations/decor_lapras_doll.pal create mode 100644 graphics/decorations/decor_lapras_doll.png create mode 100644 graphics/decorations/decor_powder_snow_mat.pal create mode 100644 graphics/decorations/decor_powder_snow_mat.png create mode 100644 graphics/decorations/decor_pretty_desk.pal create mode 100644 graphics/decorations/decor_pretty_desk.png create mode 100644 graphics/decorations/decor_pretty_flowers.pal create mode 100644 graphics/decorations/decor_pretty_flowers.png create mode 100644 graphics/decorations/decor_ragged_desk.pal create mode 100644 graphics/decorations/decor_ragged_desk.png create mode 100644 graphics/decorations/decor_red_brick.pal create mode 100644 graphics/decorations/decor_red_brick.png create mode 100644 graphics/decorations/decor_red_plant.pal create mode 100644 graphics/decorations/decor_red_plant.png create mode 100644 graphics/decorations/decor_red_tent.pal create mode 100644 graphics/decorations/decor_red_tent.png create mode 100644 graphics/decorations/decor_regice_doll.pal create mode 100644 graphics/decorations/decor_regice_doll.png create mode 100644 graphics/decorations/decor_regirock_doll.pal create mode 100644 graphics/decorations/decor_regirock_doll.png create mode 100644 graphics/decorations/decor_registeel_doll.pal create mode 100644 graphics/decorations/decor_registeel_doll.png create mode 100644 graphics/decorations/decor_rhydon_doll.pal create mode 100644 graphics/decorations/decor_rhydon_doll.png create mode 100644 graphics/decorations/decor_sand_ornament.pal create mode 100644 graphics/decorations/decor_sand_ornament.png create mode 100644 graphics/decorations/decor_slide.pal create mode 100644 graphics/decorations/decor_slide.png create mode 100644 graphics/decorations/decor_snorlax_doll.pal create mode 100644 graphics/decorations/decor_snorlax_doll.png create mode 100644 graphics/decorations/decor_solid_board.pal create mode 100644 graphics/decorations/decor_solid_board.png create mode 100644 graphics/decorations/decor_spikes_mat.pal create mode 100644 graphics/decorations/decor_spikes_mat.png create mode 100644 graphics/decorations/decor_stand.pal create mode 100644 graphics/decorations/decor_stand.png create mode 100644 graphics/decorations/decor_surf_mat.pal create mode 100644 graphics/decorations/decor_surf_mat.png create mode 100644 graphics/decorations/decor_thunder_mat.pal create mode 100644 graphics/decorations/decor_thunder_mat.png create mode 100644 graphics/decorations/decor_tire.pal create mode 100644 graphics/decorations/decor_tire.png create mode 100644 graphics/decorations/decor_tropical_plant.pal create mode 100644 graphics/decorations/decor_tropical_plant.png create mode 100644 graphics/decorations/decor_venusaur_doll.pal create mode 100644 graphics/decorations/decor_venusaur_doll.png create mode 100644 graphics/decorations/decor_wailmer_doll.pal create mode 100644 graphics/decorations/decor_wailmer_doll.png create mode 100644 graphics/decorations/decor_yellow_brick.pal create mode 100644 graphics/decorations/decor_yellow_brick.png create mode 100644 graphics/decorations/unk_85a6bb0.pal create mode 100644 graphics/decorations/unk_85a7308.pal create mode 100644 graphics/decorations/unk_85a7328.pal create mode 100644 graphics/misc/decoration_unk_85a7358.png create mode 100644 include/data/decoration/description.h create mode 100644 include/data/decoration/header.h create mode 100644 include/data/decoration/icon.h create mode 100644 include/data/decoration/tilemaps.h create mode 100644 include/data/decoration/tiles.h create mode 100644 include/field_screen.h create mode 100644 include/graphics.h create mode 100644 include/item_icon.h create mode 100644 include/list_menu.h create mode 100644 include/map_object_constants.h create mode 100644 include/menu_indicators.h create mode 100644 include/player_pc.h create mode 100644 include/tilesets.h create mode 100644 include/trader.h create mode 100644 src/decoration.c create mode 100644 src/decoration_inventory.c create mode 100755 src/pokemon_summary_screen.c diff --git a/Makefile b/Makefile index ca8348f68..4a1f94352 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ CPP := $(DEVKITARM)/bin/arm-none-eabi-cpp CPPFLAGS := -I tools/agbcc/include -iquote include -nostdinc -undef LD := $(DEVKITARM)/bin/arm-none-eabi-ld -LDFLAGS = -Map $(MAP) +LDFLAGS = -Map ../../$(MAP) OBJCOPY := $(DEVKITARM)/bin/arm-none-eabi-objcopy @@ -102,7 +102,7 @@ $(C_BUILDDIR)/m4a_2.o: CC1 := tools/agbcc/bin/old_agbcc $(C_BUILDDIR)/m4a_4.o: CC1 := tools/agbcc/bin/old_agbcc ifeq ($(NODEP),) -$(C_BUILDDIR)/%.o: c_dep = $(shell $(SCANINC) $(C_SUBDIR)/$*.c) +$(C_BUILDDIR)/%.o: c_dep = $(shell $(SCANINC) -I include $(C_SUBDIR)/$*.c) else $(C_BUILDDIR)/%.o: c_dep := endif diff --git a/asm/decoration.s b/asm/decoration.s deleted file mode 100644 index 0798e3165..000000000 --- a/asm/decoration.s +++ /dev/null @@ -1,7167 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8126968 -sub_8126968: @ 8126968 - push {lr} - ldr r3, =gUnknown_0203A173 - ldrb r0, [r3] - cmp r0, 0x7 - bhi _0812697E - ldr r2, =gUnknown_0203A14C - ldr r1, =gDecorationInventories - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] -_0812697E: - ldr r2, =gUnknown_0203A17C - ldrb r0, [r2, 0x9] - cmp r0, 0 - bne _08126996 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x00001aae - adds r1, r0, r3 - str r1, [r2] - ldr r1, =0x00001abe - adds r0, r1 - str r0, [r2, 0x4] -_08126996: - ldrb r0, [r2, 0x9] - cmp r0, 0x1 - bne _081269AC - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x0000271c - adds r1, r0, r3 - str r1, [r2] - ldr r1, =0x00002728 - adds r0, r1 - str r0, [r2, 0x4] -_081269AC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126968 - - thumb_func_start sub_81269D4 -sub_81269D4: @ 81269D4 - push {r4,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_0203A188 - adds r4, r1, r0 - cmp r1, 0 - bne _08126A28 - ldr r0, =gUnknown_085A6B90 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, =gUnknown_085A6B48 - movs r1, 0x4 - bl GetMaxWidthInMenuTable - lsls r0, 24 - ldr r2, =0x00ffffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - lsrs r0, r1, 24 - cmp r0, 0x12 - bls _08126A14 - adds r0, r2, 0 - ands r0, r1 - movs r1, 0x90 - lsls r1, 21 - orrs r0, r1 - str r0, [sp] -_08126A14: - mov r0, sp - b _08126A2E - .pool -_08126A28: - lsls r0, r1, 3 - ldr r1, =gUnknown_085A6B90 - adds r0, r1 -_08126A2E: - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r2, 0x85 - lsls r2, 2 - movs r1, 0 - movs r3, 0xE - bl SetWindowBorderStyle - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldrb r0, [r4] - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81269D4 - - thumb_func_start sub_8126A58 -sub_8126A58: @ 8126A58 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203A188 - adds r4, r0 - ldrb r0, [r4] - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126A58 - - thumb_func_start sub_8126A88 -sub_8126A88: @ 8126A88 - push {r4,lr} - movs r0, 0 - bl sub_81269D4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r2, =gUnknown_085A6B48 - adds r0, r4, 0 - movs r1, 0x4 - bl PrintMenuTable - ldr r0, =gUnknown_0203A150 - ldrb r2, [r0] - adds r0, r4, 0 - movs r1, 0x4 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126A88 - - thumb_func_start sub_8126ABC -sub_8126ABC: @ 8126ABC - push {lr} - ldr r1, =gUnknown_0203A150 - movs r0, 0 - strb r0, [r1] - bl ScriptContext2_Enable - bl sub_8126A88 - bl sub_8126C08 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126ABC - - thumb_func_start sub_8126AD8 -sub_8126AD8: @ 8126AD8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8126ABC - ldr r2, =gUnknown_0203A17C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x00001aae - adds r1, r0, r3 - str r1, [r2] - ldr r1, =0x00001abe - adds r0, r1 - str r0, [r2, 0x4] - movs r1, 0 - movs r0, 0x10 - strb r0, [r2, 0x8] - strb r1, [r2, 0x9] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8126B80 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126AD8 - - thumb_func_start sub_8126B2C -sub_8126B2C: @ 8126B2C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8126ABC - ldr r2, =gUnknown_0203A17C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x0000271c - adds r1, r0, r3 - str r1, [r2] - ldr r1, =0x00002728 - adds r0, r1 - str r0, [r2, 0x4] - movs r0, 0xC - strb r0, [r2, 0x8] - movs r0, 0x1 - strb r0, [r2, 0x9] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8126B80 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126B2C - - thumb_func_start sub_8126B80 -sub_8126B80: @ 8126B80 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08126C00 - bl GetMenuCursorPos - lsls r0, 24 - lsrs r4, r0, 24 - bl ProcessMenuInput - lsls r0, 24 - asrs r1, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _08126BD8 - adds r0, 0x1 - cmp r1, r0 - beq _08126BF4 - movs r0, 0x5 - bl PlaySE - ldr r1, =gUnknown_085A6B48 - ldr r0, =gUnknown_0203A150 - ldrb r0, [r0] - lsls r0, 3 - adds r1, 0x4 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 - b _08126C00 - .pool -_08126BD8: - bl GetMenuCursorPos - ldr r1, =gUnknown_0203A150 - strb r0, [r1] - lsls r0, r4, 24 - asrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - beq _08126C00 - bl sub_8126C08 - b _08126C00 - .pool -_08126BF4: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_8126D6C -_08126C00: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8126B80 - - thumb_func_start sub_8126C08 -sub_8126C08: @ 8126C08 - push {lr} - sub sp, 0x10 - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r1, =gUnknown_085A6B68 - ldr r0, =gUnknown_0203A150 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r2, [r0] - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParametrized - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126C08 - - thumb_func_start sub_8126C48 -sub_8126C48: @ 8126C48 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_8161B10 - lsls r0, 24 - cmp r0, 0 - bne _08126C7C - ldr r4, =gStringVar4 - ldr r1, =gText_NoDecorations - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8126DA4 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - b _08126C96 - .pool -_08126C7C: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0 - strh r1, [r0, 0x1E] - ldr r0, =gUnknown_0203A173 - strb r2, [r0] - adds r0, r5, 0 - bl sub_8126DCC -_08126C96: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126C48 - - thumb_func_start sub_8126CA4 -sub_8126CA4: @ 8126CA4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - bl sub_81299AC - lsls r0, 24 - cmp r0, 0 - bne _08126CD8 - ldr r4, =gStringVar4 - ldr r1, =gText_NoDecorationsInUse - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8126DA4 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - b _08126D00 - .pool -_08126CD8: - movs r0, 0 - bl sub_8126A58 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - movs r0, 0x1 - movs r1, 0 - bl fade_screen - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - ldr r1, =sub_8129ABC - str r1, [r0] -_08126D00: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126CA4 - - thumb_func_start sub_8126D10 -sub_8126D10: @ 8126D10 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_8161B10 - lsls r0, 24 - cmp r0, 0 - bne _08126D44 - ldr r4, =gStringVar4 - ldr r1, =gText_NoDecorations - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8126DA4 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - b _08126D5E - .pool -_08126D44: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x1 - strh r1, [r0, 0x1E] - ldr r0, =gUnknown_0203A173 - strb r2, [r0] - adds r0, r5, 0 - bl sub_8126DCC -_08126D5E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126D10 - - thumb_func_start sub_8126D6C -sub_8126D6C: @ 8126D6C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0 - bl sub_8126A58 - ldr r0, =gUnknown_0203A17C - ldrb r0, [r0, 0x9] - cmp r0, 0 - bne _08126D98 - ldr r0, =gUnknown_0823B4E8 - bl ScriptContext1_SetupScript - adds r0, r4, 0 - bl DestroyTask - b _08126D9E - .pool -_08126D98: - adds r0, r4, 0 - bl sub_816B060 -_08126D9E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8126D6C - - thumb_func_start sub_8126DA4 -sub_8126DA4: @ 8126DA4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8126C08 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8126B80 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126DA4 - - thumb_func_start sub_8126DCC -sub_8126DCC: @ 8126DCC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_085A6BB0 - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - movs r1, 0 - bl sub_8197434 - movs r0, 0 - bl sub_8126A58 - adds r0, r4, 0 - bl sub_8126DFC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126DCC - - thumb_func_start sub_8126DFC -sub_8126DFC: @ 8126DFC - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x1 - bl sub_81269D4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - bl sub_8126E8C - ldr r0, =gUnknown_0203A173 - ldrb r2, [r0] - adds r0, r4, 0 - movs r1, 0x9 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8127088 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126DFC - - thumb_func_start sub_8126E44 -sub_8126E44: @ 8126E44 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_0203A188 - ldrb r0, [r5, 0x1] - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r4, 0 - bl sub_8126E8C - ldrb r0, [r5, 0x1] - ldr r1, =gUnknown_0203A173 - ldrb r2, [r1] - movs r1, 0x9 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8127088 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126E44 - - thumb_func_start sub_8126E8C -sub_8126E8C: @ 8126E8C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r1, r0, r1 - ldr r0, =gUnknown_0203A188 - ldrb r5, [r0, 0x1] - ldr r0, =gUnknown_0203A17C - ldrb r0, [r0, 0x9] - movs r2, 0 - mov r8, r2 - cmp r0, 0x1 - bne _08126EC0 - movs r2, 0x16 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08126EC0 - movs r0, 0x1 - mov r8, r0 -_08126EC0: - movs r4, 0 - lsls r2, r6, 2 - mov r9, r2 - movs r7, 0xFF -_08126EC8: - mov r0, r8 - cmp r0, 0x1 - bne _08126EF8 - cmp r4, 0x6 - beq _08126EF8 - cmp r4, 0x7 - beq _08126EF8 - lsls r3, r4, 28 - lsrs r3, 24 - str r0, [sp] - str r7, [sp, 0x4] - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0x8 - bl sub_8126F68 - b _08126F0C - .pool -_08126EF8: - lsls r3, r4, 28 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - str r7, [sp, 0x4] - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0x8 - bl sub_8126F68 -_08126F0C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _08126EC8 - ldr r0, =gTasks - mov r2, r9 - adds r1, r2, r6 - lsls r1, 3 - adds r1, r0 - movs r2, 0x1E - ldrsh r0, [r1, r2] - ldr r2, =gText_Cancel - cmp r0, 0x2 - bne _08126F2C - ldr r2, =gText_Exit -_08126F2C: - lsls r0, r4, 4 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126E8C - - thumb_func_start sub_8126F68 -sub_8126F68: @ 8126F68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - ldr r4, [sp, 0x38] - ldr r6, [sp, 0x3C] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r5, r3, 24 - lsls r4, 24 - lsrs r1, r4, 24 - lsls r6, 24 - lsrs r6, 24 - mov r9, r6 - movs r0, 0x60 - str r0, [sp, 0x14] - cmp r7, 0x8 - bne _08126FA2 - movs r2, 0x68 - str r2, [sp, 0x14] -_08126FA2: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gStringVar4 - adds r0, r4, 0 - bl sub_8127058 - adds r0, r4, 0 - bl StringLength - lsls r0, 16 - lsrs r0, 16 - adds r6, r0, r4 - ldr r1, =gUnknown_085A6B28 - mov r2, r8 - lsls r0, r2, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - bl StringCopy - str r5, [sp] - mov r0, r9 - str r0, [sp, 0x4] - movs r2, 0 - mov r10, r2 - str r2, [sp, 0x8] - ldr r0, [sp, 0xC] - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r7, 0 - bl PrintTextOnWindow - mov r0, r8 - bl sub_8161AD0 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r6, r0, 0 - movs r0, 0xBA - strb r0, [r6] - adds r6, 0x1 - ldr r1, =gDecorationInventories - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrb r1, [r0, 0x4] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - adds r1, r4, 0 - ldr r2, [sp, 0x14] - bl GetStringRightAlignXOffset - lsls r0, 24 - lsrs r7, r0, 24 - str r5, [sp] - mov r0, r9 - str r0, [sp, 0x4] - mov r2, r10 - str r2, [sp, 0x8] - ldr r0, [sp, 0xC] - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r7, 0 - bl PrintTextOnWindow - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8126F68 - - thumb_func_start sub_8127058 -sub_8127058: @ 8127058 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - ldr r1, =gText_Color161Shadow161 - bl StringCopy - cmp r4, 0x1 - bne _08127078 - movs r0, 0x4 - strb r0, [r5, 0x2] - movs r0, 0x5 - b _0812707E - .pool -_08127078: - movs r0, 0x2 - strb r0, [r5, 0x2] - movs r0, 0x3 -_0812707E: - strb r0, [r5, 0x5] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8127058 - - thumb_func_start sub_8127088 -sub_8127088: @ 8127088 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081270DE - bl ProcessMenuInput - lsls r0, 24 - lsrs r4, r0, 24 - asrs r1, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081270C0 - cmp r1, r0 - bgt _081270BC - subs r0, 0x1 - cmp r1, r0 - beq _081270DE - b _081270CE - .pool -_081270BC: - cmp r1, 0x8 - bne _081270CE -_081270C0: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_812719C - b _081270DE -_081270CE: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203A173 - strb r4, [r0] - adds r0, r5, 0 - bl sub_81270E8 -_081270DE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127088 - - thumb_func_start sub_81270E8 -sub_81270E8: @ 81270E8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203A173 - ldrb r0, [r4] - bl sub_8161AD0 - ldr r1, =gUnknown_0203A151 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - beq _08127154 - ldrb r0, [r4] - bl sub_8161A38 - ldr r2, =gUnknown_0203A14C - ldr r1, =gDecorationInventories - ldrb r0, [r4] - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - adds r0, r5, 0 - bl sub_81279B4 - ldr r0, =gUnknown_0203A170 - movs r1, 0 - strh r1, [r0] - ldr r0, =gUnknown_0203A16E - strh r1, [r0] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8127620 - str r1, [r0] - b _0812716E - .pool -_08127154: - movs r0, 0x1 - bl sub_8126A58 - ldr r4, =gStringVar4 - ldr r1, =gText_NoDecorations - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8127180 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_0812716E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81270E8 - - thumb_func_start sub_8127180 -sub_8127180: @ 8127180 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - adds r0, r4, 0 - bl sub_8126DFC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8127180 - - thumb_func_start sub_812719C -sub_812719C: @ 812719C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1E - ldrsh r0, [r0, r1] - cmp r0, 0x2 - beq _081271C0 - adds r0, r2, 0 - bl sub_81271CC - b _081271C6 - .pool -_081271C0: - adds r0, r2, 0 - bl sub_8127268 -_081271C6: - pop {r0} - bx r0 - thumb_func_end sub_812719C - - thumb_func_start sub_81271CC -sub_81271CC: @ 81271CC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_8126A58 - bl sub_8126A88 - movs r0, 0 - movs r1, 0 - bl sub_81973C4 - bl sub_8126C08 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8126B80 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81271CC - - thumb_func_start sub_8127208 -sub_8127208: @ 8127208 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_085A6BB0 - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - movs r1, 0 - bl sub_8197434 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x2 - strh r1, [r0, 0x1E] - ldr r0, =gUnknown_0203A173 - strb r2, [r0] - adds r0, r4, 0 - bl sub_8126DFC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127208 - - thumb_func_start sub_8127250 -sub_8127250: @ 8127250 - push {lr} - lsls r1, 24 - ldr r2, =gUnknown_085A6B28 - lsrs r1, 22 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127250 - - thumb_func_start sub_8127268 -sub_8127268: @ 8127268 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_8126A58 - adds r0, r4, 0 - bl sub_8133E1C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8127268 - - thumb_func_start sub_8127284 -sub_8127284: @ 8127284 - push {lr} - ldr r3, =gUnknown_0203A18C - ldr r2, [r3] - ldr r0, =gUnknown_0203A151 - ldrb r0, [r0] - adds r0, 0x1 - movs r1, 0xA4 - lsls r1, 3 - adds r2, r1 - strb r0, [r2] - ldr r0, [r3] - adds r1, r0, r1 - ldrb r1, [r1] - cmp r1, 0x8 - bls _081272B8 - ldr r2, =0x00000521 - adds r1, r0, r2 - movs r0, 0x8 - strb r0, [r1] - b _081272BE - .pool -_081272B8: - ldr r2, =0x00000521 - adds r0, r2 - strb r1, [r0] -_081272BE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127284 - - thumb_func_start sub_81272C8 -sub_81272C8: @ 81272C8 - push {r4,lr} - ldr r0, =gUnknown_0203A170 - ldr r1, =gUnknown_0203A16E - ldr r2, =gUnknown_0203A18C - ldr r3, [r2] - ldr r4, =0x00000521 - adds r2, r3, r4 - ldrb r2, [r2] - subs r4, 0x1 - adds r3, r4 - ldrb r3, [r3] - bl sub_812225C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81272C8 - - thumb_func_start sub_81272F8 -sub_81272F8: @ 81272F8 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_0203A170 - ldr r1, =gUnknown_0203A16E - ldr r2, =gUnknown_0203A18C - ldr r3, [r2] - ldr r4, =0x00000521 - adds r2, r3, r4 - ldrb r2, [r2] - subs r4, 0x1 - adds r3, r4 - ldrb r3, [r3] - movs r4, 0x8 - str r4, [sp] - bl sub_8122298 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81272F8 - - thumb_func_start sub_8127330 -sub_8127330: @ 8127330 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - ldr r0, =gUnknown_0203A173 - ldrb r0, [r0] - subs r0, 0x6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _08127378 - ldr r0, =gUnknown_0203A17C - ldrb r0, [r0, 0x9] - cmp r0, 0x1 - bne _08127378 - movs r2, 0x16 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08127378 - ldr r0, =gStringVar1 - movs r1, 0x1 - bl sub_8127058 - b _08127380 - .pool -_08127378: - ldr r0, =gStringVar1 - movs r1, 0 - bl sub_8127058 -_08127380: - movs r6, 0 - ldr r1, =gUnknown_0203A18C - ldr r0, [r1] - movs r3, 0xA4 - lsls r3, 3 - adds r0, r3 - ldrb r0, [r0] - subs r0, 0x1 - cmp r6, r0 - bge _081273D6 - adds r5, r1, 0 -_08127396: - lsls r4, r6, 1 - adds r4, r6 - lsls r4, 3 - movs r0, 0xA4 - lsls r0, 1 - adds r4, r0 - ldr r0, [r5] - adds r0, r4 - ldr r1, =gUnknown_0203A14C - ldr r1, [r1] - adds r1, r6 - ldrb r1, [r1] - bl sub_8127454 - ldr r1, [r5] - lsls r2, r6, 3 - adds r0, r1, r2 - adds r4, r1, r4 - str r4, [r0] - adds r0, r1, 0x4 - adds r0, r2 - str r6, [r0] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - movs r2, 0xA4 - lsls r2, 3 - adds r1, r2 - ldrb r0, [r1] - subs r0, 0x1 - cmp r6, r0 - blt _08127396 -_081273D6: - ldr r5, =gUnknown_0203A18C - lsls r4, r6, 1 - adds r4, r6 - lsls r4, 3 - movs r3, 0xA4 - lsls r3, 1 - adds r4, r3 - ldr r0, [r5] - adds r0, r4 - ldr r1, =gText_Cancel - bl StringCopy - ldr r0, [r5] - lsls r2, r6, 3 - adds r1, r0, r2 - adds r4, r0, r4 - str r4, [r1] - adds r0, 0x4 - adds r0, r2 - movs r1, 0x2 - negs r1, r1 - str r1, [r0] - ldr r2, =gUnknown_03006310 - adds r1, r2, 0 - ldr r0, =gUnknown_085A6BD0 - ldm r0!, {r3,r4,r6} - stm r1!, {r3,r4,r6} - ldm r0!, {r3,r4,r6} - stm r1!, {r3,r4,r6} - ldr r0, =gUnknown_0203A188 - ldrb r0, [r0, 0x1] - strb r0, [r2, 0x10] - ldr r0, [r5] - movs r4, 0xA4 - lsls r4, 3 - adds r1, r0, r4 - ldrb r1, [r1] - strh r1, [r2, 0xC] - str r0, [r2] - ldr r6, =0x00000521 - adds r0, r6 - ldrb r0, [r0] - strh r0, [r2, 0xE] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127330 - - thumb_func_start sub_8127454 -sub_8127454: @ 8127454 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r4, r1, 16 - lsrs r4, 16 - ldr r1, =gStringVar1 - bl StringCopy - lsls r4, 5 - ldr r0, =gDecorations + 1 - adds r4, r0 - adds r0, r5, 0 - adds r1, r4, 0 - bl StringAppend - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127454 - - thumb_func_start sub_8127480 -sub_8127480: @ 8127480 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x1 - beq _08127492 - movs r0, 0x5 - bl PlaySE -_08127492: - adds r0, r4, 0 - bl sub_8127744 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8127480 - - thumb_func_start sub_81274A0 -sub_81274A0: @ 81274A0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - mov r8, r6 - lsls r2, 24 - lsrs r5, r2, 24 - adds r7, r5, 0 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _081274F6 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_81277BC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081274DC - adds r3, r5, 0x2 - adds r0, r6, 0 - movs r1, 0x18 - movs r2, 0x5C - bl blit_move_info_icon - b _081274F6 -_081274DC: - adds r0, r4, 0 - bl sub_81277E8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081274F6 - adds r3, r7, 0x2 - mov r0, r8 - movs r1, 0x19 - movs r2, 0x5C - bl blit_move_info_icon -_081274F6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81274A0 - - thumb_func_start sub_8127500 -sub_8127500: @ 8127500 - push {r4,lr} - sub sp, 0x10 - ldr r4, =gUnknown_0203A18C - ldr r1, [r4] - ldr r2, =0x00000522 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08127540 - subs r2, 0x2 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - subs r0, r1 - str r0, [sp] - movs r0, 0x6E - str r0, [sp, 0x4] - str r0, [sp, 0x8] - ldr r0, =gUnknown_0203A170 - str r0, [sp, 0xC] - movs r0, 0x2 - movs r1, 0x3C - movs r2, 0xC - movs r3, 0x94 - bl AddScrollIndicatorArrowPairParametrized - ldr r1, [r4] - ldr r2, =0x00000522 - adds r1, r2 - strb r0, [r1] -_08127540: - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127500 - - thumb_func_start sub_8127554 -sub_8127554: @ 8127554 - push {r4,lr} - ldr r4, =gUnknown_0203A18C - ldr r0, [r4] - ldr r2, =0x00000522 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _08127572 - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r1, =0x00000522 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] -_08127572: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127554 - - thumb_func_start sub_8127580 -sub_8127580: @ 8127580 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_81269D4 - adds r0, r4, 0 - bl sub_812759C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8127580 - - thumb_func_start sub_812759C -sub_812759C: @ 812759C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - ldr r0, =gTasks + 0x8 - adds r5, r0 - movs r0, 0x3 - bl sub_81269D4 - ldr r0, =gUnknown_0203A173 - ldrb r0, [r0] - bl sub_8127718 - ldr r6, =gUnknown_0203A18C - ldr r0, =0x00000524 - bl AllocZeroed - str r0, [r6] - ldr r1, =0x00000522 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - bl sub_8127284 - bl sub_81272C8 - bl sub_81272F8 - adds r0, r4, 0 - bl sub_8127330 - ldr r0, =gUnknown_03006310 - ldr r1, =gUnknown_0203A170 - ldrh r1, [r1] - ldr r2, =gUnknown_0203A16E - ldrh r2, [r2] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x1A] - bl sub_8127500 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812759C - - thumb_func_start sub_8127620 -sub_8127620: @ 8127620 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_812759C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_812764C - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127620 - - thumb_func_start sub_812764C -sub_812764C: @ 812764C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08127700 - ldrb r0, [r5, 0x1A] - bl ListMenuHandleInput - adds r4, r0, 0 - ldrb r0, [r5, 0x1A] - ldr r7, =gUnknown_0203A170 - ldr r1, =gUnknown_0203A16E - mov r8, r1 - adds r1, r7, 0 - mov r2, r8 - bl get_coro_args_x18_x1A - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _081276A4 - adds r0, 0x1 - cmp r4, r0 - bne _081276C4 - b _08127700 - .pool -_081276A4: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_085A6B78 - movs r2, 0x16 - ldrsh r1, [r5, r2] - lsls r1, 3 - adds r0, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r6, 0 - bl _call_via_r1 - b _08127700 - .pool -_081276C4: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203A172 - strb r4, [r0] - bl sub_8127554 - ldrb r0, [r5, 0x1A] - adds r1, r7, 0 - mov r2, r8 - bl sub_81AE6C8 - movs r0, 0x1 - bl sub_8126A58 - bl sub_81277A8 - ldr r0, =gUnknown_0203A18C - ldr r0, [r0] - bl Free - ldr r1, =gUnknown_085A6B78 - movs r2, 0x16 - ldrsh r0, [r5, r2] - lsls r0, 3 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - bl _call_via_r1 -_08127700: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812764C - - thumb_func_start sub_8127718 -sub_8127718: @ 8127718 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x2 - bl sub_81269D4 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl sub_8126F68 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8127718 - - thumb_func_start sub_8127744 -sub_8127744: @ 8127744 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r0, 0 - ldr r0, =gUnknown_0203A188 - ldrb r5, [r0, 0x3] - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0203A151 - ldrb r0, [r0] - cmp r4, r0 - bcc _08127770 - ldr r2, =gText_GoBackPrevMenu - b _08127782 - .pool -_08127770: - ldr r1, =gDecorations - ldr r0, =gUnknown_0203A14C - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0] - lsls r0, 5 - adds r1, 0x18 - adds r0, r1 - ldr r2, [r0] -_08127782: - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127744 - - thumb_func_start sub_81277A8 -sub_81277A8: @ 81277A8 - push {lr} - movs r0, 0x3 - bl sub_8126A58 - movs r0, 0x2 - bl sub_8126A58 - pop {r0} - bx r0 - thumb_func_end sub_81277A8 - - thumb_func_start sub_81277BC -sub_81277BC: @ 81277BC - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - ldr r3, =gUnknown_0203A152 -_081277C6: - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r2 - bne _081277D8 - movs r0, 0x1 - b _081277E4 - .pool -_081277D8: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xF - bls _081277C6 - movs r0, 0 -_081277E4: - pop {r1} - bx r1 - thumb_func_end sub_81277BC - - thumb_func_start sub_81277E8 -sub_81277E8: @ 81277E8 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - ldr r3, =gUnknown_0203A162 -_081277F2: - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r2 - bne _08127804 - movs r0, 0x1 - b _08127810 - .pool -_08127804: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xB - bls _081277F2 - movs r0, 0 -_08127810: - pop {r1} - bx r1 - thumb_func_end sub_81277E8 - - thumb_func_start sub_8127814 -sub_8127814: @ 8127814 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r5, 0 - ldr r0, =gUnknown_0203A152 - movs r1, 0 - movs r2, 0x10 - bl memset - ldr r0, =gUnknown_0203A162 - movs r1, 0 - movs r2, 0xC - bl memset - movs r6, 0 - ldr r0, =gSaveBlock1Ptr - mov r10, r0 - ldr r1, =0x00001aae - mov r9, r1 - ldr r3, =gUnknown_0203A173 - mov r8, r3 -_08127842: - mov r1, r10 - ldr r0, [r1] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0 - beq _081278E2 - movs r2, 0 - mov r3, r8 - ldrb r0, [r3] - lsls r0, 3 - ldr r1, =gDecorationInventories - adds r0, r1 - ldrb r0, [r0, 0x4] - cmp r2, r0 - bcs _081278E2 - ldr r7, =gUnknown_0203A152 - adds r3, r1, 0 - mov r12, r3 -_08127868: - ldr r0, =gUnknown_0203A14C - ldr r1, [r0] - adds r1, r2 - mov r3, r10 - ldr r0, [r3] - add r0, r9 - adds r0, r6 - ldrb r1, [r1] - adds r4, r2, 0x1 - ldrb r0, [r0] - cmp r1, r0 - bne _081278D0 - movs r1, 0 - cmp r1, r5 - bcs _081278A2 - ldrb r0, [r7] - cmp r0, r4 - beq _081278A2 - ldr r3, =gUnknown_0203A152 - adds r2, r4, 0 -_08127890: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r5 - bcs _081278A2 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r2 - bne _08127890 -_081278A2: - cmp r1, r5 - bne _081278D0 - adds r0, r5, r7 - strb r4, [r0] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - b _081278E2 - .pool -_081278D0: - lsls r0, r4, 16 - lsrs r2, r0, 16 - mov r1, r8 - ldrb r0, [r1] - lsls r0, 3 - add r0, r12 - ldrb r0, [r0, 0x4] - cmp r2, r0 - bcc _08127868 -_081278E2: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0xF - bls _08127842 - movs r5, 0 - movs r6, 0 - ldr r3, =gDecorationInventories - mov r8, r3 -_081278F4: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000271c - adds r0, r1 - adds r0, r6 - ldrb r0, [r0] - adds r7, r6, 0x1 - cmp r0, 0 - beq _0812799A - movs r2, 0 - b _0812798C - .pool -_08127918: - ldr r0, =gUnknown_0203A14C - ldr r1, [r0] - adds r1, r2 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x0000271c - adds r0, r3 - adds r0, r6 - ldrb r1, [r1] - adds r4, r2, 0x1 - ldrb r0, [r0] - cmp r1, r0 - bne _08127988 - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_81277BC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08127988 - movs r1, 0 - cmp r1, r5 - bcs _08127966 - ldr r2, =gUnknown_0203A162 - ldrb r0, [r2] - cmp r0, r4 - beq _08127966 - adds r3, r2, 0 - adds r2, r4, 0 -_08127954: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r5 - bcs _08127966 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r2 - bne _08127954 -_08127966: - cmp r1, r5 - bne _08127988 - ldr r0, =gUnknown_0203A162 - adds r0, r5, r0 - strb r4, [r0] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - b _0812799A - .pool -_08127988: - lsls r0, r4, 16 - lsrs r2, r0, 16 -_0812798C: - ldr r0, =gUnknown_0203A173 - ldrb r0, [r0] - lsls r0, 3 - add r0, r8 - ldrb r0, [r0, 0x4] - cmp r2, r0 - bcc _08127918 -_0812799A: - lsls r0, r7, 16 - lsrs r6, r0, 16 - cmp r6, 0xB - bls _081278F4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127814 - - thumb_func_start sub_81279B4 -sub_81279B4: @ 81279B4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_8127814 - pop {r0} - bx r0 - thumb_func_end sub_81279B4 - - thumb_func_start sub_81279C4 -sub_81279C4: @ 81279C4 - push {r4,lr} - movs r2, 0 - ldr r0, =gUnknown_0203A170 - ldrh r0, [r0] - ldr r1, =gUnknown_0203A16E - ldrh r1, [r1] - adds r0, r1 - adds r1, r0, 0x1 - ldr r4, =gUnknown_0203A152 - ldr r3, =gUnknown_0203A162 -_081279D8: - adds r0, r2, r4 - ldrb r0, [r0] - cmp r0, r1 - beq _081279EC - cmp r2, 0xB - bhi _08127A00 - adds r0, r2, r3 - ldrb r0, [r0] - cmp r0, r1 - bne _08127A00 -_081279EC: - movs r0, 0 - b _08127A0C - .pool -_08127A00: - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0xF - bls _081279D8 - movs r0, 0x1 -_08127A0C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81279C4 - - thumb_func_start sub_8127A14 -sub_8127A14: @ 8127A14 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_81269D4 - adds r0, r4, 0 - bl sub_8127620 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8127A14 - - thumb_func_start sub_8127A30 -sub_8127A30: @ 8127A30 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8127A14 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127A30 - - thumb_func_start sub_8127A5C -sub_8127A5C: @ 8127A5C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08127A82 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - movs r0, 0x1 - bl sub_81269D4 - adds r0, r4, 0 - bl sub_8127620 -_08127A82: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127A5C - - thumb_func_start sub_8127A8C -sub_8127A8C: @ 8127A8C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - bl sub_8127554 - bl sub_81277A8 - ldrb r0, [r4, 0x1A] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldr r0, =gUnknown_0203A18C - ldr r0, [r0] - bl Free - adds r0, r5, 0 - bl sub_8126E44 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127A8C - - thumb_func_start sub_8127ACC -sub_8127ACC: @ 8127ACC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gTasks - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - adds r4, r2, r3 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldrh r0, [r1] - strh r0, [r4, 0xE] - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x10] - adds r3, 0x8 - adds r2, r3 - adds r1, r2, 0x2 - adds r0, r2, 0 - bl PlayerGetDestCoords - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127ACC - - thumb_func_start sub_8127B04 -sub_8127B04: @ 8127B04 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - bl DrawWholeMapView - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r0, 0x4 - ldrsb r0, [r1, r0] - ldrb r1, [r1, 0x5] - lsls r1, 24 - asrs r1, 24 - movs r2, 0x1 - negs r2, r2 - ldr r3, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r3 - movs r3, 0xE - ldrsb r3, [r4, r3] - ldrb r4, [r4, 0x10] - lsls r4, 24 - asrs r4, 24 - str r4, [sp] - bl Overworld_SetWarpDestination - bl warp_in - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127B04 - - thumb_func_start sub_8127B54 -sub_8127B54: @ 8127B54 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =0x0000ffff - cmp r2, 0x22 - beq _08127B7C - cmp r2, 0x26 - bne _08127B86 - ldr r0, =gUnknown_085A72E4 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 16 - b _08127B86 - .pool -_08127B7C: - ldr r0, =gUnknown_085A72EC - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 16 -_08127B86: - pop {r1} - bx r1 - .pool - thumb_func_end sub_8127B54 - - thumb_func_start sub_8127B90 -sub_8127B90: @ 8127B90 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - ldr r4, [sp, 0x54] - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - lsls r1, 16 - lsrs r1, 16 - str r1, [sp, 0x4] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x8] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0xC] - lsls r4, 16 - lsrs r4, 16 - str r4, [sp, 0x10] - movs r2, 0 - lsls r0, r3, 16 - cmp r2, r3 - bcc _08127BC6 - b _08127D28 -_08127BC6: - ldr r1, [sp, 0x8] - str r1, [sp, 0x28] - str r0, [sp, 0x2C] -_08127BCC: - ldr r3, [sp, 0x4] - ldr r4, [sp, 0xC] - subs r1, r3, r4 - lsls r0, r2, 16 - asrs r0, 16 - adds r0, 0x1 - adds r1, r0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp, 0x14] - movs r0, 0 - mov r10, r0 - adds r1, r2, 0x1 - str r1, [sp, 0x30] - ldr r3, [sp, 0x28] - cmp r10, r3 - bcc _08127BF0 - b _08127D18 -_08127BF0: - ldr r4, [sp, 0x10] - lsls r4, 5 - str r4, [sp, 0x18] - ldr r0, =gUnknown_085A5C24 - adds r0, r4, r0 - str r0, [sp, 0x1C] - ldr r0, =gDecorations - adds r0, r4, r0 - str r0, [sp, 0x24] - ldr r3, [sp, 0x8] - adds r1, r2, 0 - muls r1, r3 - str r1, [sp, 0x20] -_08127C0A: - ldr r0, [sp] - add r0, r10 - lsls r0, 16 - lsrs r5, r0, 16 - ldr r1, [sp, 0x20] - add r1, r10 - ldr r4, [sp, 0x1C] - ldr r0, [r4] - lsls r1, 1 - adds r1, r0 - movs r2, 0x80 - lsls r2, 2 - adds r0, r2, 0 - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl GetBehaviorByMetatileId - lsls r4, r0, 16 - lsls r0, r4, 8 - lsrs r0, 24 - bl MetatileBehavior_IsMB_B9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08127C50 - ldr r3, [sp, 0x24] - ldrb r0, [r3, 0x11] - cmp r0, 0x1 - beq _08127C60 - lsrs r0, r4, 28 - cmp r0, 0 - beq _08127C60 -_08127C50: - movs r4, 0xC0 - lsls r4, 4 - mov r8, r4 - b _08127C64 - .pool -_08127C60: - movs r0, 0 - mov r8, r0 -_08127C64: - ldr r1, [sp, 0x24] - ldrb r0, [r1, 0x11] - lsls r7, r5, 16 - ldr r2, [sp, 0x14] - lsls r2, 16 - mov r9, r2 - cmp r0, 0x3 - beq _08127C8E - asrs r0, r7, 16 - asrs r1, r2, 16 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsMB_B7 - lsls r0, 24 - lsrs r0, 24 - movs r6, 0x1 - cmp r0, 0x1 - beq _08127C90 -_08127C8E: - movs r6, 0 -_08127C90: - ldr r3, [sp, 0x18] - ldr r4, =gDecorations - adds r0, r3, r4 - ldrb r0, [r0] - ldr r4, [sp, 0x20] - add r4, r10 - lsls r1, r4, 24 - lsrs r1, 24 - bl sub_8127B54 - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _08127CE0 - asrs r0, r7, 16 - mov r2, r9 - asrs r1, r2, 16 - ldr r3, [sp, 0x1C] - ldr r2, [r3] - lsls r3, r4, 1 - adds r3, r2 - movs r4, 0x80 - lsls r4, 2 - adds r2, r4, 0 - orrs r6, r2 - ldrh r3, [r3] - adds r2, r6, r3 - mov r3, r8 - orrs r3, r2 - orrs r3, r5 - lsls r2, r3, 16 - lsrs r2, 16 - bl MapGridSetMetatileEntryAt - b _08127D06 - .pool -_08127CE0: - asrs r0, r7, 16 - mov r2, r9 - asrs r1, r2, 16 - ldr r3, [sp, 0x1C] - ldr r2, [r3] - lsls r3, r4, 1 - adds r3, r2 - movs r4, 0x80 - lsls r4, 2 - adds r2, r4, 0 - orrs r6, r2 - ldrh r3, [r3] - adds r2, r6, r3 - mov r3, r8 - orrs r3, r2 - lsls r2, r3, 16 - lsrs r2, 16 - bl MapGridSetMetatileIdAt -_08127D06: - mov r0, r10 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - ldr r4, [sp, 0x28] - cmp r10, r4 - bcs _08127D18 - b _08127C0A -_08127D18: - ldr r1, [sp, 0x30] - lsls r0, r1, 16 - lsrs r2, r0, 16 - ldr r3, [sp, 0x2C] - lsrs r0, r3, 16 - cmp r2, r0 - bcs _08127D28 - b _08127BCC -_08127D28: - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8127B90 - - thumb_func_start sub_8127D38 -sub_8127D38: @ 8127D38 - push {r4,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r3, r0, 16 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 16 - lsrs r2, 16 - ldr r1, =gDecorations - lsls r0, r2, 5 - adds r0, r1 - ldrb r0, [r0, 0x12] - cmp r0, 0x9 - bhi _08127E10 - lsls r0, 2 - ldr r1, =_08127D68 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08127D68: - .4byte _08127D90 - .4byte _08127D9A - .4byte _08127DA4 - .4byte _08127DB4 - .4byte _08127DBE - .4byte _08127DC8 - .4byte _08127DD8 - .4byte _08127DE2 - .4byte _08127DF2 - .4byte _08127E02 -_08127D90: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x1 - b _08127DAC -_08127D9A: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x2 - b _08127DAC -_08127DA4: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x3 -_08127DAC: - movs r3, 0x1 - bl sub_8127B90 - b _08127E10 -_08127DB4: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x4 - b _08127DD0 -_08127DBE: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x2 - b _08127DD0 -_08127DC8: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x1 -_08127DD0: - movs r3, 0x2 - bl sub_8127B90 - b _08127E10 -_08127DD8: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x1 - b _08127DFA -_08127DE2: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x2 - movs r3, 0x4 - bl sub_8127B90 - b _08127E10 -_08127DF2: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x3 -_08127DFA: - movs r3, 0x3 - bl sub_8127B90 - b _08127E10 -_08127E02: - str r2, [sp] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0x3 - movs r3, 0x2 - bl sub_8127B90 -_08127E10: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8127D38 - - thumb_func_start sub_8127E18 -sub_8127E18: @ 8127E18 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r6, 0 - ldr r7, =gMapHeader - ldr r0, =gSpecialVar_0x8005 - mov r8, r0 - ldr r1, =gSpecialVar_0x8006 - mov r10, r1 - ldr r2, =gSaveBlock1Ptr - mov r9, r2 -_08127E34: - adds r5, r6, 0 - adds r5, 0xAE - adds r4, r5, 0 - adds r0, r4, 0 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08127F1C - adds r0, r4, 0 - bl FlagClear - movs r2, 0 - ldr r0, [r7, 0x4] - ldrb r4, [r0] - cmp r2, r4 - bcs _08127E82 - ldr r0, [r0, 0x4] - ldrh r0, [r0, 0x14] - cmp r0, r5 - beq _08127E82 - ldr r0, =gMapHeader - ldr r3, [r0, 0x4] - ldrb r6, [r3] - adds r4, r5, 0 -_08127E68: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r6 - bcs _08127E82 - ldr r0, [r3, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - cmp r0, r4 - bne _08127E68 -_08127E82: - ldr r0, [r7, 0x4] - ldr r1, [r0, 0x4] - lsls r4, r2, 1 - adds r4, r2 - lsls r4, 3 - adds r1, r4, r1 - ldr r5, =0x00003f20 - adds r0, r5, 0 - ldrb r1, [r1, 0x1] - adds r0, r1 - ldr r1, =gUnknown_0203A190 - ldr r1, [r1] - ldr r1, [r1, 0x1C] - ldrh r1, [r1] - bl VarSet - ldr r0, [r7, 0x4] - ldr r0, [r0, 0x4] - adds r4, r0 - ldrb r0, [r4] - mov r6, r8 - strh r0, [r6] - ldr r1, =gUnknown_0203AA34 - ldrh r1, [r1] - mov r2, r10 - strh r1, [r2] - ldr r1, =gUnknown_0203AA36 - ldrh r1, [r1] - ldr r4, =gSpecialVar_0x8007 - strh r1, [r4] - mov r5, r9 - ldr r2, [r5] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl show_sprite - ldrb r0, [r6] - ldr r2, [r5] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - mov r6, r10 - movs r4, 0 - ldrsh r3, [r6, r4] - ldr r5, =gSpecialVar_0x8007 - movs r6, 0 - ldrsh r4, [r5, r6] - str r4, [sp] - bl sub_808EBA8 - mov r1, r8 - ldrb r0, [r1] - mov r4, r9 - ldr r2, [r4] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl sub_808F254 - b _08127F26 - .pool -_08127F1C: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0xD - bls _08127E34 -_08127F26: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8127E18 - - thumb_func_start sub_8127F38 -sub_8127F38: @ 8127F38 - push {lr} - movs r1, 0 - ldr r0, =gUnknown_0203A17C - ldrb r2, [r0, 0x8] - cmp r1, r2 - bcs _08127F62 - ldr r3, [r0] -_08127F46: - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08127F58 - movs r0, 0x1 - b _08127F64 - .pool -_08127F58: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r2 - bcc _08127F46 -_08127F62: - movs r0, 0 -_08127F64: - pop {r1} - bx r1 - thumb_func_end sub_8127F38 - - thumb_func_start sub_8127F68 -sub_8127F68: @ 8127F68 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203A17C - ldrb r0, [r0, 0x9] - cmp r0, 0x1 - bne _08127FAC - ldr r0, =gUnknown_0203A173 - ldrb r0, [r0] - cmp r0, 0x6 - beq _08127FAC - cmp r0, 0x7 - beq _08127FAC - ldr r4, =gStringVar4 - ldr r1, =gText_CantPlaceInRoom - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8127A5C - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - b _0812804C - .pool -_08127FAC: - bl sub_81279C4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08128038 - bl sub_8127F38 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08127FE8 - movs r0, 0x1 - movs r1, 0 - bl fade_screen - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - ldr r1, =sub_8128060 - str r1, [r0] - b _0812804C - .pool -_08127FE8: - ldr r0, =gStringVar1 - ldr r4, =gUnknown_0203A17C - ldrb r1, [r4, 0x8] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldrb r0, [r4, 0x9] - cmp r0, 0 - bne _08128018 - ldr r0, =gStringVar4 - ldr r1, =gText_NoMoreDecorations - bl StringExpandPlaceholders - b _08128020 - .pool -_08128018: - ldr r0, =gStringVar4 - ldr r1, =gText_NoMoreDecorations2 - bl StringExpandPlaceholders -_08128020: - ldr r1, =gStringVar4 - ldr r2, =sub_8127A5C - adds r0, r5, 0 - bl DisplayItemMessageOnField - b _0812804C - .pool -_08128038: - ldr r4, =gStringVar4 - ldr r1, =gText_InUseAlready - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8127A5C - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_0812804C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8127F68 - - thumb_func_start sub_8128060 -sub_8128060: @ 8128060 - 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 r7, r0, r1 - movs r1, 0xC - ldrsh r0, [r7, r1] - cmp r0, 0x1 - beq _081280AC - cmp r0, 0x1 - bgt _08128088 - cmp r0, 0 - beq _0812808E - b _08128112 - .pool -_08128088: - cmp r0, 0x2 - beq _081280FC - b _08128112 -_0812808E: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08128112 - adds r0, r6, 0 - bl sub_8127ACC - movs r0, 0x1 - strh r0, [r7, 0xC] - b _08128112 - .pool -_081280AC: - ldr r4, =gPaletteFade - ldrb r0, [r4, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r4, 0x8] - ldr r5, =gUnknown_0203A190 - ldr r0, =gUnknown_0203A172 - ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C - ldr r0, [r0] - adds r0, r1 - ldrb r1, [r0] - adds r0, r5, 0 - bl ConfigureCameraObjectForPlacingDecoration - adds r0, r6, 0 - bl sub_812826C - adds r0, r6, 0 - adds r1, r5, 0 - bl SetUpPlacingDecorationPlayerAvatar - bl pal_fill_black - ldrb r1, [r4, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r4, 0x8] - movs r0, 0x2 - strh r0, [r7, 0xC] - b _08128112 - .pool -_081280FC: - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08128112 - movs r0, 0 - strh r0, [r7, 0x20] - adds r0, r6, 0 - bl sub_8128FD8 -_08128112: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8128060 - - thumb_func_start ConfigureCameraObjectForPlacingDecoration -ConfigureCameraObjectForPlacingDecoration: @ 8128118 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gUnknown_0203AA38 - ldr r4, =gSprites - ldr r5, =gUnknown_03005DD0 - ldr r2, [r5, 0x4] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x2E] - strb r0, [r3] - adds r0, r6, 0 - bl gpu_pal_decompress_alloc_tag_and_upload - lsls r0, 24 - lsrs r0, 24 - str r0, [r5, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r0, [r5, 0x4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, =sub_81292D0 - str r1, [r0] - adds r2, r4 - ldr r3, =gUnknown_085A7250 - ldr r0, [r6] - ldrb r0, [r0, 0x12] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x2] - strh r0, [r2, 0x20] - ldr r0, [r5, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldr r0, [r6] - ldrb r0, [r0, 0x12] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x3] - strh r0, [r1, 0x22] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end ConfigureCameraObjectForPlacingDecoration - - thumb_func_start SetUpPlacingDecorationPlayerAvatar -SetUpPlacingDecorationPlayerAvatar: @ 81281A8 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gTasks - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - adds r2, r3 - ldrb r2, [r2, 0x12] - ldr r3, =gUnknown_085A7250 - ldr r0, [r1] - ldrb r4, [r0, 0x12] - lsls r1, r4, 2 - adds r1, r3 - lsls r0, r2, 4 - ldrb r1, [r1, 0x2] - adds r0, r1 - subs r2, 0x1 - lsls r2, 3 - subs r0, r2 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r4, 0x2 - beq _081281E2 - cmp r4, 0x8 - beq _081281E2 - cmp r4, 0x9 - bne _081281EA -_081281E2: - adds r0, r2, 0 - subs r0, 0x8 - lsls r0, 24 - lsrs r2, r0, 24 -_081281EA: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _0812820C - ldr r1, =SpriteCallbackDummy - str r0, [sp] - movs r0, 0xC1 - b _08128214 - .pool -_0812820C: - ldr r1, =SpriteCallbackDummy - movs r0, 0 - str r0, [sp] - movs r0, 0xC2 -_08128214: - movs r3, 0x48 - bl AddPseudoFieldObject - ldr r1, =gUnknown_0203AA39 - strb r0, [r1] - ldr r3, =gSprites - ldr r0, =gUnknown_0203AA39 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r2, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0, 0x5] - ldr r4, =gUnknown_0203AA38 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - bl DestroySprite - ldr r0, =gUnknown_03005DD0 - ldr r0, [r0, 0x4] - strb r0, [r4] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SetUpPlacingDecorationPlayerAvatar - - thumb_func_start sub_812826C -sub_812826C: @ 812826C - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, =gDecorations - ldr r0, =gUnknown_0203A172 - ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C - ldr r0, [r0] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 5 - adds r0, r2 - ldrb r0, [r0, 0x12] - cmp r0, 0x9 - bls _0812828C - b _081283B2 -_0812828C: - lsls r0, 2 - ldr r1, =_081282A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081282A8: - .4byte _081282D0 - .4byte _081282E4 - .4byte _081282FC - .4byte _08128314 - .4byte _08128328 - .4byte _0812833C - .4byte _08128350 - .4byte _08128370 - .4byte _08128388 - .4byte _081283A0 -_081282D0: - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - b _08128394 - .pool -_081282E4: - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r1, 0x2 - strh r1, [r0, 0x12] - movs r1, 0x1 - b _081283B0 - .pool -_081282FC: - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r1, 0x3 - strh r1, [r0, 0x12] - movs r1, 0x1 - b _081283B0 - .pool -_08128314: - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r1, 0x4 - b _081283AC - .pool -_08128328: - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - movs r0, 0x2 - b _08128394 - .pool -_0812833C: - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - b _081283AC - .pool -_08128350: - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x12] - movs r0, 0x3 - strh r0, [r1, 0x14] - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - b _081283B2 - .pool -_08128370: - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r1, 0x2 - strh r1, [r0, 0x12] - movs r1, 0x4 - b _081283B0 - .pool -_08128388: - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - movs r0, 0x3 -_08128394: - strh r0, [r1, 0x12] - strh r0, [r1, 0x14] - b _081283B2 - .pool -_081283A0: - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r1, 0x3 -_081283AC: - strh r1, [r0, 0x12] - movs r1, 0x2 -_081283B0: - strh r1, [r0, 0x14] -_081283B2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_812826C - - thumb_func_start sub_81283BC -sub_81283BC: @ 81283BC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - ldr r3, =gSprites - ldr r0, =gUnknown_0203AA38 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r2, 0x1 - strh r2, [r0, 0x3C] - ldr r0, =gUnknown_0203AA39 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - strh r2, [r0, 0x3C] - bl sub_8128DE0 - adds r0, r4, 0 - bl sub_8128950 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81283BC - - thumb_func_start sub_8128414 -sub_8128414: @ 8128414 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - ldr r3, =gSprites - ldr r0, =gUnknown_0203AA38 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r2, 0x1 - strh r2, [r0, 0x3C] - ldr r0, =gUnknown_0203AA39 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - strh r2, [r0, 0x3C] - bl sub_8128DE0 - ldr r5, =gStringVar4 - ldr r1, =gText_CancelDecorating - adds r0, r5, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8128B80 - adds r0, r4, 0 - adds r1, r5, 0 - bl DisplayItemMessageOnField - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128414 - - thumb_func_start sub_8128484 -sub_8128484: @ 8128484 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r4, r1, 16 - bl MetatileBehavior_IsMB_B3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0812849E - cmp r4, 0 - beq _081284A2 -_0812849E: - movs r0, 0 - b _081284A4 -_081284A2: - movs r0, 0x1 -_081284A4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8128484 - - thumb_func_start sub_81284AC -sub_81284AC: @ 81284AC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r2, 16 - lsrs r4, r2, 16 - lsls r3, 16 - lsrs r5, r3, 16 - lsls r1, 16 - asrs r1, 16 - ldr r3, =gTasks - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - adds r2, r3 - movs r3, 0xE - ldrsh r0, [r2, r3] - adds r0, 0x7 - cmp r1, r0 - bne _081284EC - lsls r1, r4, 16 - asrs r1, 16 - movs r3, 0x10 - ldrsh r0, [r2, r3] - adds r0, 0x7 - cmp r1, r0 - bne _081284EC - cmp r5, 0 - beq _081284EC - movs r0, 0 - b _081284EE - .pool -_081284EC: - movs r0, 0x1 -_081284EE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81284AC - - thumb_func_start sub_81284F4 -sub_81284F4: @ 81284F4 - push {r4-r6,lr} - adds r5, r1, 0 - lsls r0, 16 - lsrs r6, r0, 16 - lsls r0, r6, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl MetatileBehavior_IsMB_B3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08128534 - ldrb r0, [r5] - cmp r0, 0x21 - bne _08128522 - adds r0, r4, 0 - bl MetatileBehavior_IsMB_C2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08128530 -_08128522: - lsls r0, r6, 24 - lsrs r0, 24 - bl MetatileBehavior_IsNormal - lsls r0, 24 - cmp r0, 0 - beq _08128534 -_08128530: - movs r0, 0x1 - b _08128536 -_08128534: - movs r0, 0 -_08128536: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81284F4 - - thumb_func_start sub_812853C -sub_812853C: @ 812853C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - str r1, [sp] - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r10 - lsls r0, 3 - adds r0, r1 - ldrb r2, [r0, 0x14] - str r2, [sp, 0x4] - ldrb r0, [r0, 0x12] - str r0, [sp, 0x8] - ldr r3, [sp] - ldrb r0, [r3, 0x11] - adds r2, r1, 0 - cmp r0, 0x4 - bls _0812856E - b _0812893C -_0812856E: - lsls r0, 2 - ldr r1, =_08128580 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08128580: - .4byte _08128594 - .4byte _08128594 - .4byte _08128680 - .4byte _08128834 - .4byte _081288B8 -_08128594: - movs r6, 0 - ldr r0, [sp, 0x4] - cmp r6, r0 - bcc _0812859E - b _0812893C -_0812859E: - mov r1, r10 - lsls r1, 2 - str r1, [sp, 0x1C] -_081285A4: - mov r2, r10 - lsls r0, r2, 2 - add r0, r10 - lsls r0, 3 - ldr r3, =gTasks - adds r0, r3 - ldrh r0, [r0, 0xA] - subs r0, r6 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - movs r7, 0 - adds r6, 0x1 - str r6, [sp, 0x14] - ldr r0, [sp, 0x8] - cmp r7, r0 - bcs _0812866E - mov r1, r9 - lsls r1, 16 - str r1, [sp, 0xC] - asrs r1, 16 - mov r9, r1 -_081285D0: - ldr r0, [sp, 0x1C] - add r0, r10 - lsls r0, 3 - ldr r2, =gTasks - adds r0, r2 - ldrh r0, [r0, 0x8] - adds r0, r7 - lsls r0, 16 - mov r8, r0 - asrs r6, r0, 16 - adds r0, r6, 0 - mov r1, r9 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - ldr r3, [sp, 0x4] - ldr r1, [sp, 0x14] - subs r0, r3, r1 - ldr r2, [sp, 0x8] - adds r1, r0, 0 - muls r1, r2 - adds r1, r7 - ldr r3, [sp] - ldr r0, [r3, 0x1C] - lsls r1, 1 - adds r1, r0 - movs r2, 0x80 - lsls r2, 2 - adds r0, r2, 0 - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl GetBehaviorByMetatileId - movs r3, 0xF0 - lsls r3, 8 - adds r1, r3, 0 - adds r5, r1, 0 - ands r5, r0 - adds r0, r4, 0 - ldr r1, [sp] - bl sub_81284F4 - lsls r0, 24 - cmp r0, 0 - bne _08128632 - b _0812890C -_08128632: - mov r0, r10 - adds r1, r6, 0 - mov r2, r9 - adds r3, r5, 0 - bl sub_81284AC - lsls r0, 24 - cmp r0, 0 - bne _08128646 - b _0812890C -_08128646: - mov r1, r8 - lsrs r0, r1, 16 - ldr r2, [sp, 0xC] - lsrs r1, r2, 16 - movs r2, 0 - bl GetFieldObjectIdByXYZ - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _08128662 - cmp r4, 0x10 - beq _08128662 - b _0812890C -_08128662: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, [sp, 0x8] - cmp r7, r3 - bcc _081285D0 -_0812866E: - ldr r1, [sp, 0x14] - lsls r0, r1, 24 - lsrs r6, r0, 24 - ldr r2, [sp, 0x4] - cmp r6, r2 - bcc _081285A4 - b _0812893C - .pool -_08128680: - movs r6, 0 - mov r3, r10 - lsls r3, 2 - str r3, [sp, 0x1C] - ldr r0, [sp, 0x4] - subs r0, 0x1 - str r0, [sp, 0x18] - cmp r6, r0 - bge _0812876C - adds r0, r3, 0 - add r0, r10 - lsls r0, 3 - str r0, [sp, 0x10] -_0812869A: - ldr r1, [sp, 0x10] - adds r0, r1, r2 - ldrh r0, [r0, 0xA] - subs r0, r6 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - movs r7, 0 - adds r6, 0x1 - str r6, [sp, 0x14] - ldr r3, [sp, 0x8] - cmp r7, r3 - bcs _08128760 - lsls r0, 16 - str r0, [sp, 0x20] -_081286B8: - ldr r1, [sp, 0x10] - adds r0, r1, r2 - ldrh r0, [r0, 0x8] - adds r0, r7 - lsls r0, 16 - mov r8, r0 - asrs r6, r0, 16 - mov r2, r9 - lsls r1, r2, 16 - adds r0, r6, 0 - asrs r1, 16 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - ldr r3, [sp, 0x4] - ldr r1, [sp, 0x14] - subs r0, r3, r1 - ldr r2, [sp, 0x8] - adds r1, r0, 0 - muls r1, r2 - adds r1, r7 - ldr r3, [sp] - ldr r0, [r3, 0x1C] - lsls r1, 1 - adds r1, r0 - movs r2, 0x80 - lsls r2, 2 - adds r0, r2, 0 - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl GetBehaviorByMetatileId - movs r3, 0xF0 - lsls r3, 8 - adds r1, r3, 0 - adds r5, r1, 0 - ands r5, r0 - adds r0, r4, 0 - bl MetatileBehavior_IsNormal - lsls r0, 24 - cmp r0, 0 - bne _08128724 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_8128484 - lsls r0, 24 - cmp r0, 0 - bne _08128724 - b _0812890C -_08128724: - mov r0, r10 - adds r1, r6, 0 - ldr r3, [sp, 0x20] - asrs r2, r3, 16 - adds r3, r5, 0 - bl sub_81284AC - lsls r0, 24 - cmp r0, 0 - bne _0812873A - b _0812890C -_0812873A: - mov r1, r8 - lsrs r0, r1, 16 - ldr r2, [sp, 0x20] - lsrs r1, r2, 16 - movs r2, 0 - bl GetFieldObjectIdByXYZ - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x10 - beq _08128752 - b _0812890C -_08128752: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gTasks - ldr r3, [sp, 0x8] - cmp r7, r3 - bcc _081286B8 -_08128760: - ldr r1, [sp, 0x14] - lsls r0, r1, 24 - lsrs r6, r0, 24 - ldr r3, [sp, 0x18] - cmp r6, r3 - blt _0812869A -_0812876C: - ldr r0, [sp, 0x1C] - add r0, r10 - lsls r0, 3 - adds r0, r2 - ldrh r0, [r0, 0xA] - ldr r1, [sp, 0x4] - subs r0, r1 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - movs r7, 0 - ldr r3, [sp, 0x8] - cmp r7, r3 - bcc _0812878C - b _0812893C -_0812878C: - lsls r0, 16 - str r0, [sp, 0x20] -_08128790: - ldr r0, [sp, 0x1C] - add r0, r10 - lsls r0, 3 - ldr r1, =gTasks - adds r0, r1 - ldrh r0, [r0, 0x8] - adds r0, r7 - lsls r0, 16 - mov r8, r0 - asrs r6, r0, 16 - mov r2, r9 - lsls r1, r2, 16 - adds r0, r6, 0 - asrs r1, 16 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - ldr r3, [sp] - ldr r0, [r3, 0x1C] - lsls r1, r7, 1 - adds r1, r0 - movs r2, 0x80 - lsls r2, 2 - adds r0, r2, 0 - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl GetBehaviorByMetatileId - movs r3, 0xF0 - lsls r3, 8 - adds r1, r3, 0 - adds r5, r1, 0 - ands r5, r0 - adds r0, r4, 0 - bl MetatileBehavior_IsNormal - lsls r0, 24 - cmp r0, 0 - bne _081287F2 - adds r0, r4, 0 - bl MetatileBehavior_IsMB_B7 - lsls r0, 24 - cmp r0, 0 - bne _081287F2 - b _0812890C -_081287F2: - mov r0, r10 - adds r1, r6, 0 - ldr r3, [sp, 0x20] - asrs r2, r3, 16 - adds r3, r5, 0 - bl sub_81284AC - lsls r0, 24 - cmp r0, 0 - bne _08128808 - b _0812890C -_08128808: - mov r1, r8 - lsrs r0, r1, 16 - ldr r2, [sp, 0x20] - lsrs r1, r2, 16 - movs r2, 0 - bl GetFieldObjectIdByXYZ - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _08128822 - cmp r4, 0x10 - bne _0812890C -_08128822: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, [sp, 0x8] - cmp r7, r3 - bcc _08128790 - b _0812893C - .pool -_08128834: - movs r6, 0 - ldr r0, [sp, 0x4] - cmp r6, r0 - bcc _0812883E - b _0812893C -_0812883E: - mov r1, r10 - lsls r0, r1, 2 - add r0, r10 - lsls r1, r0, 3 - ldr r2, =gTasks - adds r0, r1, r2 - ldrh r0, [r0, 0xA] - subs r0, r6 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - movs r7, 0 - ldr r3, [sp, 0x8] - cmp r7, r3 - bcs _081288A4 - adds r0, r2, 0 - adds r1, r0 - mov r8, r1 - mov r1, r9 - lsls r0, r1, 16 - asrs r5, r0, 16 -_08128868: - mov r2, r8 - ldrh r0, [r2, 0x8] - adds r0, r7 - lsls r0, 16 - asrs r4, r0, 16 - adds r0, r4, 0 - adds r1, r5, 0 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsMB_B7 - lsls r0, 24 - cmp r0, 0 - beq _0812890C - adds r0, r4, 0 - adds r1, r5, 0x1 - bl MapGridGetMetatileIdAt - movs r1, 0xA3 - lsls r1, 2 - cmp r0, r1 - beq _0812890C - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, [sp, 0x8] - cmp r7, r3 - bcc _08128868 -_081288A4: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, [sp, 0x4] - cmp r6, r0 - bcc _0812883E - b _0812893C - .pool -_081288B8: - mov r3, r10 - lsls r1, r3, 2 - adds r0, r1, r3 - lsls r0, 3 - adds r0, r2 - ldrh r0, [r0, 0xA] - mov r9, r0 - movs r7, 0 - str r1, [sp, 0x1C] - ldr r0, [sp, 0x8] - cmp r7, r0 - bcs _0812893C - adds r6, r2, 0 - mov r1, r9 - lsls r1, 16 - str r1, [sp, 0x20] -_081288D8: - ldr r0, [sp, 0x1C] - add r0, r10 - lsls r0, 3 - adds r0, r6 - ldrh r0, [r0, 0x8] - adds r0, r7 - lsls r0, 16 - lsrs r5, r0, 16 - asrs r0, 16 - mov r2, r9 - lsls r1, r2, 16 - asrs r1, 16 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - ldr r3, [sp] - ldrb r0, [r3, 0x12] - cmp r0, 0x5 - bne _08128910 -_08128900: - adds r0, r4, 0 - bl MetatileBehavior_IsMB_C3 - lsls r0, 24 - cmp r0, 0 - bne _0812891C -_0812890C: - movs r0, 0 - b _0812893E -_08128910: - adds r0, r4, 0 - bl MetatileBehavior_IsMB_B5 - lsls r0, 24 - cmp r0, 0 - beq _08128900 -_0812891C: - adds r0, r5, 0 - ldr r2, [sp, 0x20] - lsrs r1, r2, 16 - movs r2, 0 - bl GetFieldObjectIdByXYZ - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x10 - bne _0812890C - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, [sp, 0x8] - cmp r7, r3 - bcc _081288D8 -_0812893C: - movs r0, 0x1 -_0812893E: - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_812853C - - thumb_func_start sub_8128950 -sub_8128950: @ 8128950 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203A172 - ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C - ldr r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r1, 5 - ldr r0, =gDecorations - adds r1, r0 - adds r0, r5, 0 - bl sub_812853C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081289A4 - ldr r4, =gStringVar4 - ldr r1, =gText_PlaceItHere - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_81289D0 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - b _081289BE - .pool -_081289A4: - movs r0, 0x20 - bl PlaySE - ldr r4, =gStringVar4 - ldr r1, =gText_CantBePlacedHere - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8129020 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_081289BE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128950 - - thumb_func_start sub_81289D0 -sub_81289D0: @ 81289D0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8197930 - ldr r1, =gUnknown_085A72C4 - adds r0, r4, 0 - bl sub_8121F68 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81289D0 - - thumb_func_start sub_81289F0 -sub_81289F0: @ 81289F0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - adds r0, r4, 0 - bl sub_8128AAC - ldr r2, =gDecorations - ldr r0, =gUnknown_0203A172 - ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C - ldr r0, [r0] - adds r0, r1 - ldrb r3, [r0] - lsls r0, r3, 5 - adds r0, r2 - ldrb r0, [r0, 0x11] - cmp r0, 0x4 - beq _08128A44 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - ldrh r1, [r1, 0xA] - adds r2, r3, 0 - bl sub_8127D38 - b _08128A64 - .pool -_08128A44: - ldr r2, =gUnknown_0203AA34 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - subs r0, 0x7 - strh r0, [r2] - ldr r2, =gUnknown_0203AA36 - ldrh r0, [r1, 0xA] - subs r0, 0x7 - strh r0, [r2] - ldr r0, =gUnknown_08275D1F - bl ScriptContext1_SetupScript -_08128A64: - ldr r2, =gSprites - ldr r0, =gUnknown_0203AA38 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - adds r1, 0x2 - strh r1, [r0, 0x22] - ldr r0, =gMapHeader - ldrb r0, [r0, 0x14] - cmp r0, 0x56 - bne _08128A84 - bl sub_80EE104 -_08128A84: - adds r0, r4, 0 - bl sub_8128BBC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81289F0 - - thumb_func_start sub_8128AAC -sub_8128AAC: @ 8128AAC - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r3, 0 - ldr r0, =gUnknown_0203A17C - ldrb r1, [r0, 0x8] - adds r5, r0, 0 - cmp r3, r1 - bcs _08128AD2 - ldr r4, [r5] -_08128AC0: - adds r2, r4, r3 - ldrb r0, [r2] - cmp r0, 0 - beq _08128AF0 - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, r1 - bcc _08128AC0 -_08128AD2: - ldrb r0, [r5, 0x9] - cmp r0, 0 - bne _08128B3C - movs r3, 0 - ldr r0, =gUnknown_0203A152 - ldrb r1, [r0] - adds r2, r0, 0 - cmp r1, 0 - bne _08128B28 - b _08128B48 - .pool -_08128AF0: - ldr r0, =gUnknown_0203A172 - ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C - ldr r0, [r0] - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r2, [r5, 0x4] - adds r2, r3 - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldrb r0, [r1, 0x8] - subs r0, 0x7 - lsls r0, 4 - ldrb r1, [r1, 0xA] - subs r1, 0x7 - adds r0, r1 - strb r0, [r2] - b _08128AD2 - .pool -_08128B28: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0xF - bhi _08128B76 - adds r1, r3, r2 - ldrb r0, [r1] - cmp r0, 0 - bne _08128B28 - b _08128B6E -_08128B3C: - movs r3, 0 - ldr r0, =gUnknown_0203A162 - ldrb r1, [r0] - adds r2, r0, 0 - cmp r1, 0 - bne _08128B5C -_08128B48: - ldr r0, =gUnknown_0203A172 - ldrb r0, [r0] - adds r0, 0x1 - strb r0, [r2] - b _08128B76 - .pool -_08128B5C: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0xB - bhi _08128B76 - adds r1, r3, r2 - ldrb r0, [r1] - cmp r0, 0 - bne _08128B5C -_08128B6E: - ldr r0, =gUnknown_0203A172 - ldrb r0, [r0] - adds r0, 0x1 - strb r0, [r1] -_08128B76: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128AAC - - thumb_func_start sub_8128B80 -sub_8128B80: @ 8128B80 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8197930 - ldr r1, =gUnknown_085A72CC - adds r0, r4, 0 - bl sub_8121F68 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128B80 - - thumb_func_start sub_8128BA0 -sub_8128BA0: @ 8128BA0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - adds r0, r4, 0 - bl sub_8128BBC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8128BA0 - - thumb_func_start sub_8128BBC -sub_8128BBC: @ 8128BBC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0 - bl fade_screen - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - ldr r1, =c1_overworld_prev_quest - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128BBC - - thumb_func_start c1_overworld_prev_quest -c1_overworld_prev_quest: @ 8128BEC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r5, r0, r1 - movs r1, 0xC - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _08128C10 - cmp r0, 0x1 - beq _08128C30 - b _08128C4C - .pool -_08128C10: - bl ScriptContext2_Enable - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08128C4C - adds r0, r4, 0 - bl sub_8127B04 - movs r0, 0x1 - strh r0, [r5, 0xC] - b _08128C4C - .pool -_08128C30: - bl sub_812A3C8 - ldr r0, =0x00000be5 - bl FreeSpritePaletteByTag - ldr r1, =gFieldCallback - ldr r0, =sub_8128CD4 - str r0, [r1] - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 - adds r0, r4, 0 - bl DestroyTask -_08128C4C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end c1_overworld_prev_quest - - thumb_func_start sub_8128C64 -sub_8128C64: @ 8128C64 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r5, r1, 3 - ldr r6, =gTasks + 0x8 - adds r4, r5, r6 - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08128C9C - cmp r0, 0x1 - bgt _08128C8C - cmp r0, 0 - beq _08128C96 - b _08128CCA - .pool -_08128C8C: - cmp r0, 0x2 - beq _08128CA8 - cmp r0, 0x3 - beq _08128CB4 - b _08128CCA -_08128C96: - bl sub_80E9578 - b _08128CAC -_08128C9C: - ldr r0, =gUnknown_08275D0C - bl ScriptContext1_SetupScript - b _08128CAC - .pool -_08128CA8: - bl ScriptContext2_Enable -_08128CAC: - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] - b _08128CCA -_08128CB4: - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08128CCA - adds r0, r6, 0 - subs r0, 0x8 - adds r0, r5, r0 - ldr r1, =sub_812764C - str r1, [r0] -_08128CCA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128C64 - - thumb_func_start sub_8128CD4 -sub_8128CD4: @ 8128CD4 - push {r4,lr} - bl ScriptContext2_Enable - bl pal_fill_black - ldr r0, =sub_8128C64 - movs r1, 0x8 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_8127580 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128CD4 - - thumb_func_start sub_8128D10 -sub_8128D10: @ 8128D10 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r2, r1, r0 - ldr r0, =gUnknown_0203AA3A - ldrb r1, [r0] - adds r3, r0, 0 - cmp r1, 0x1 - bne _08128D48 - movs r1, 0x2 - ldrsh r0, [r2, r1] - movs r4, 0xC - ldrsh r1, [r2, r4] - subs r0, r1 - subs r0, 0x6 - cmp r0, 0 - bge _08128D48 - ldrh r0, [r2, 0x2] - adds r0, 0x1 - b _08128D62 - .pool -_08128D48: - ldrb r0, [r3] - cmp r0, 0x2 - bne _08128D6C - movs r0, 0x2 - ldrsh r1, [r2, r0] - subs r1, 0x7 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x4] - cmp r1, r0 - blt _08128D6C - ldrh r0, [r2, 0x2] - subs r0, 0x1 -_08128D62: - strh r0, [r2, 0x2] - movs r0, 0 - b _08128DAE - .pool -_08128D6C: - ldrb r0, [r3] - cmp r0, 0x3 - bne _08128D82 - movs r1, 0 - ldrsh r0, [r2, r1] - subs r0, 0x7 - cmp r0, 0 - bge _08128D82 - ldrh r0, [r2] - adds r0, 0x1 - b _08128DA2 -_08128D82: - ldrb r0, [r3] - cmp r0, 0x4 - bne _08128DAC - movs r3, 0 - ldrsh r1, [r2, r3] - movs r4, 0xA - ldrsh r0, [r2, r4] - adds r1, r0 - subs r1, 0x8 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0] - cmp r1, r0 - blt _08128DAC - ldrh r0, [r2] - subs r0, 0x1 -_08128DA2: - strh r0, [r2] - movs r0, 0 - b _08128DAE - .pool -_08128DAC: - movs r0, 0x1 -_08128DAE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8128D10 - - thumb_func_start sub_8128DB4 -sub_8128DB4: @ 8128DB4 - push {lr} - ldr r0, =gMain - ldrh r0, [r0, 0x2C] - movs r1, 0xF0 - ands r1, r0 - cmp r1, 0x40 - beq _08128DD8 - cmp r1, 0x80 - beq _08128DD8 - cmp r1, 0x20 - beq _08128DD8 - cmp r1, 0x10 - beq _08128DD8 - movs r0, 0 - b _08128DDA - .pool -_08128DD8: - movs r0, 0x1 -_08128DDA: - pop {r1} - bx r1 - thumb_func_end sub_8128DB4 - - thumb_func_start sub_8128DE0 -sub_8128DE0: @ 8128DE0 - push {r4,lr} - ldr r1, =gUnknown_0203AA3A - movs r0, 0 - strb r0, [r1] - ldr r4, =gSprites - ldr r3, =gUnknown_0203AA38 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r2, 0 - strh r2, [r0, 0x32] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x34] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128DE0 - - thumb_func_start sub_8128E18 -sub_8128E18: @ 8128E18 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r2, r0, 24 - mov r8, r2 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r5, =gSprites - ldr r3, =gUnknown_0203AA38 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x36 - ldrsh r6, [r0, r1] - cmp r6, 0 - beq _08128E46 - b _08128F66 -_08128E46: - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _08128E68 - ldr r0, =gUnknown_085A72D4 - movs r3, 0x18 - ldrsh r1, [r4, r3] - lsls r1, 3 - b _08128E76 - .pool -_08128E68: - cmp r0, 0x2 - bne _08128E88 - ldr r0, =gUnknown_085A72D4 - movs r3, 0x18 - ldrsh r1, [r4, r3] - lsls r1, 3 - adds r0, 0x4 -_08128E76: - adds r1, r0 - ldr r1, [r1] - adds r0, r2, 0 - bl _call_via_r1 - b _08128FBA - .pool -_08128E88: - ldr r2, =gMain - ldrh r1, [r2, 0x2C] - movs r7, 0xF0 - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0x40 - bne _08128EBC - ldr r1, =gUnknown_0203AA3A - movs r0, 0x1 - strb r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x34] - ldrh r0, [r4, 0x2] - subs r0, 0x1 - strh r0, [r4, 0x2] -_08128EBC: - ldrh r1, [r2, 0x2C] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0x80 - bne _08128EEC - ldr r1, =gUnknown_0203AA3A - movs r0, 0x2 - strb r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x2 - strh r1, [r0, 0x34] - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] -_08128EEC: - ldrh r1, [r2, 0x2C] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0x20 - bne _08128F1C - ldr r1, =gUnknown_0203AA3A - movs r0, 0x3 - strb r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x32] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x34] - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r4] -_08128F1C: - ldrh r1, [r2, 0x2C] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0x10 - bne _08128F4C - ldr r1, =gUnknown_0203AA3A - movs r0, 0x4 - strb r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x2 - strh r1, [r0, 0x32] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x34] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_08128F4C: - bl sub_8128DB4 - lsls r0, 24 - cmp r0, 0 - beq _08128F62 - mov r0, r8 - bl sub_8128D10 - lsls r0, 24 - cmp r0, 0 - bne _08128F66 -_08128F62: - bl sub_8128DE0 -_08128F66: - ldr r0, =gUnknown_0203AA3A - ldrb r0, [r0] - cmp r0, 0 - beq _08128F94 - ldr r3, =gSprites - ldr r2, =gUnknown_0203AA38 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x36] - adds r1, 0x1 - strh r1, [r0, 0x36] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrh r2, [r1, 0x36] - movs r0, 0x7 - ands r0, r2 - strh r0, [r1, 0x36] -_08128F94: - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08128FBA - ldr r3, =gMain - ldrh r1, [r3, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08128FAC - strh r2, [r4, 0x14] -_08128FAC: - ldrh r1, [r3, 0x2E] - movs r2, 0x2 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08128FBA - strh r2, [r4, 0x14] -_08128FBA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128E18 - - thumb_func_start sub_8128FD8 -sub_8128FD8: @ 8128FD8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - ldr r2, =gSprites - ldr r0, =gUnknown_0203AA38 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r2, 0 - strh r2, [r0, 0x3C] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0x1C] - ldr r1, =sub_8128E18 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8128FD8 - - thumb_func_start sub_8129020 -sub_8129020: @ 8129020 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0812903A - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08129040 -_0812903A: - adds r0, r2, 0 - bl sub_8128FD8 -_08129040: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129020 - - thumb_func_start sub_8129048 -sub_8129048: @ 8129048 - push {lr} - sub sp, 0x4 - adds r1, r0, 0 - mov r2, sp - movs r0, 0 - strh r0, [r2] - ldr r2, =0x01000452 - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129048 - - thumb_func_start sub_8129068 -sub_8129068: @ 8129068 - push {lr} - adds r2, r0, 0 - lsls r1, 16 - ldr r0, =gTilesetPointer_SecretBase - ldr r0, [r0] - lsrs r1, 11 - ldr r0, [r0, 0x8] - adds r0, r1 - adds r1, r2, 0 - movs r2, 0x8 - bl CpuFastSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129068 - - thumb_func_start sub_8129088 -sub_8129088: @ 8129088 - push {r4-r7,lr} - sub sp, 0x20 - adds r7, r0, 0 - lsls r1, 16 - lsrs r2, r1, 16 - lsrs r4, r1, 26 - adds r5, r4, 0 - cmp r2, 0 - beq _0812909E - ldr r0, =0x000003ff - ands r2, r0 -_0812909E: - ldr r0, =gTilesetPointer_SecretBase - ldr r0, [r0] - lsls r1, r2, 5 - ldr r0, [r0, 0x4] - adds r0, r1 - mov r1, sp - movs r2, 0x8 - bl CpuFastSet - cmp r4, 0x1 - beq _081290DE - cmp r4, 0x1 - bgt _081290C8 - cmp r4, 0 - beq _081290D2 - b _0812919A - .pool -_081290C8: - cmp r5, 0x2 - beq _0812913E - cmp r5, 0x3 - beq _08129176 - b _0812919A -_081290D2: - mov r0, sp - adds r1, r7, 0 - movs r2, 0x8 - bl CpuFastSet - b _0812919A -_081290DE: - movs r5, 0 - movs r6, 0xF -_081290E2: - lsls r4, r5, 2 - adds r4, r7 - adds r5, 0x1 - lsls r3, r5, 2 - subs r0, r3, 0x1 - add r0, sp - ldrb r2, [r0] - lsrs r1, r2, 4 - adds r0, r6, 0 - ands r0, r2 - lsls r0, 4 - adds r1, r0 - strb r1, [r4] - subs r0, r3, 0x2 - add r0, sp - ldrb r2, [r0] - lsrs r1, r2, 4 - adds r0, r6, 0 - ands r0, r2 - lsls r0, 4 - adds r1, r0 - strb r1, [r4, 0x1] - subs r0, r3, 0x3 - add r0, sp - ldrb r2, [r0] - lsrs r1, r2, 4 - adds r0, r6, 0 - ands r0, r2 - lsls r0, 4 - adds r1, r0 - strb r1, [r4, 0x2] - subs r3, 0x4 - mov r1, sp - adds r0, r1, r3 - ldrb r2, [r0] - lsrs r1, r2, 4 - adds r0, r6, 0 - ands r0, r2 - lsls r0, 4 - adds r1, r0 - strb r1, [r4, 0x3] - lsls r5, 16 - lsrs r5, 16 - cmp r5, 0x7 - bls _081290E2 - b _0812919A -_0812913E: - movs r5, 0 - movs r3, 0x7 -_08129142: - lsls r2, r5, 2 - adds r2, r7 - subs r1, r3, r5 - lsls r1, 2 - mov r4, sp - adds r0, r4, r1 - ldrb r0, [r0] - strb r0, [r2] - adds r0, r1, 0x1 - add r0, sp - ldrb r0, [r0] - strb r0, [r2, 0x1] - adds r0, r1, 0x2 - add r0, sp - ldrb r0, [r0] - strb r0, [r2, 0x2] - adds r1, 0x3 - adds r0, r4, r1 - ldrb r0, [r0] - strb r0, [r2, 0x3] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x7 - bls _08129142 - b _0812919A -_08129176: - movs r5, 0 - movs r4, 0x1F - movs r6, 0xF -_0812917C: - adds r3, r7, r5 - subs r0, r4, r5 - add r0, sp - ldrb r2, [r0] - lsrs r1, r2, 4 - adds r0, r6, 0 - ands r0, r2 - lsls r0, 4 - adds r1, r0 - strb r1, [r3] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x1F - bls _0812917C -_0812919A: - add sp, 0x20 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8129088 - - thumb_func_start sub_81291A4 -sub_81291A4: @ 81291A4 - push {r4,r5,lr} - adds r5, r0, 0 - movs r4, 0 -_081291AA: - lsls r0, r4, 5 - adds r0, 0x84 - adds r0, r5, r0 - lsls r2, r4, 1 - adds r1, r5, 0x4 - adds r1, r2 - ldrh r1, [r1] - bl sub_8129088 - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x3F - bls _081291AA - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81291A4 - - thumb_func_start sub_81291CC -sub_81291CC: @ 81291CC - lsls r0, 16 - ldr r1, =gTilesetPointer_SecretBaseRedCave - ldr r1, [r1] - ldr r1, [r1, 0xC] - lsrs r0, 15 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x00000fff - ands r0, r1 - bx lr - .pool - thumb_func_end sub_81291CC - - thumb_func_start sub_81291E8 -sub_81291E8: @ 81291E8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r0 - ldr r0, [r0] - ldrb r0, [r0, 0x12] - movs r6, 0 - ldr r1, =gUnknown_085A71B0 - lsls r5, r0, 4 - adds r0, r5, r1 - ldrb r0, [r0, 0xC] - cmp r6, r0 - bcs _0812924C - adds r7, r1, 0 -_08129204: - mov r4, r8 - ldm r4!, {r1} - adds r0, r7, 0x4 - adds r0, r5, r0 - ldr r0, [r0] - adds r0, r6 - ldrb r0, [r0] - ldr r1, [r1, 0x1C] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - adds r1, r7, 0 - adds r1, 0x8 - adds r1, r5, r1 - ldr r1, [r1] - adds r1, r6 - lsls r0, 3 - ldrb r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl sub_81291CC - adds r2, r5, r7 - ldr r1, [r2] - adds r1, r6 - ldrb r1, [r1] - lsls r1, 1 - adds r4, r1 - strh r0, [r4] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r2, [r2, 0xC] - cmp r6, r2 - bcc _08129204 -_0812924C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81291E8 - - thumb_func_start sub_812925C -sub_812925C: @ 812925C - push {r4,r5,lr} - lsls r0, 24 - ldr r3, =gUnknown_0203AA3C - movs r1, 0 - strb r1, [r3] - ldrb r2, [r3, 0x1] - subs r1, 0x4 - ands r1, r2 - movs r5, 0xD - negs r5, r5 - ands r1, r5 - movs r2, 0x11 - negs r2, r2 - ands r1, r2 - subs r2, 0x10 - ands r1, r2 - strb r1, [r3, 0x1] - ldr r1, =gUnknown_085A7250 - lsrs r0, 22 - adds r0, r1 - ldrb r1, [r0] - movs r4, 0x3F - lsls r1, 6 - strb r1, [r3, 0x1] - ldrh r2, [r3, 0x2] - ldr r1, =0xfffffe00 - ands r1, r2 - strh r1, [r3, 0x2] - ldrb r2, [r3, 0x3] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - strb r1, [r3, 0x3] - ldrb r0, [r0, 0x1] - lsls r0, 6 - ands r4, r1 - orrs r4, r0 - strb r4, [r3, 0x3] - ldrh r1, [r3, 0x4] - ldr r0, =0xfffffc00 - ands r0, r1 - strh r0, [r3, 0x4] - ldrb r0, [r3, 0x5] - ands r5, r0 - movs r0, 0xF - ands r5, r0 - strb r5, [r3, 0x5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812925C - - thumb_func_start sub_81292D0 -sub_81292D0: @ 81292D0 - movs r1, 0 - strh r1, [r0, 0x32] - strh r1, [r0, 0x34] - strh r1, [r0, 0x36] - strh r1, [r0, 0x38] - strh r1, [r0, 0x3A] - strh r1, [r0, 0x3C] - ldr r1, =sub_81292E8 - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_81292D0 - - thumb_func_start sub_81292E8 -sub_81292E8: @ 81292E8 - push {lr} - adds r2, r0, 0 - movs r1, 0x3C - ldrsh r0, [r2, r1] - cmp r0, 0 - bne _08129322 - movs r1, 0x3A - ldrsh r0, [r2, r1] - cmp r0, 0xE - bgt _0812930A - adds r3, r2, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - b _08129314 -_0812930A: - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 -_08129314: - strb r0, [r3] - ldrh r0, [r2, 0x3A] - adds r0, 0x1 - movs r1, 0x1F - ands r0, r1 - strh r0, [r2, 0x3A] - b _0812932E -_08129322: - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_0812932E: - pop {r0} - bx r0 - thumb_func_end sub_81292E8 - - thumb_func_start gpu_pal_decompress_alloc_tag_and_upload -gpu_pal_decompress_alloc_tag_and_upload: @ 8129334 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - bl sub_8129048 - lsls r4, 5 - ldr r0, =gDecorations - adds r4, r0 - str r4, [r5] - ldrb r0, [r4, 0x11] - cmp r0, 0x4 - beq _081293B4 - ldr r0, =0x00000be5 - bl FreeSpritePaletteByTag - adds r0, r5, 0 - bl sub_81291E8 - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl sub_812925C - adds r0, r5, 0 - bl sub_81291A4 - ldr r1, =0x00000884 - adds r0, r5, r1 - ldr r1, =gTilesetPointer_SecretBaseRedCave - ldr r2, [r1] - ldr r1, [r5] - ldr r1, [r1, 0x1C] - ldrh r1, [r1] - ldr r2, [r2, 0xC] - lsls r1, 4 - adds r1, r2 - ldrh r1, [r1, 0xE] - lsrs r1, 12 - bl sub_8129068 - ldr r0, =gUnknown_085A72BC - bl LoadSpritePalette - ldr r0, =gUnknown_085A728C - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSprite - b _081293C6 - .pool -_081293B4: - ldr r0, [r4, 0x1C] - ldrh r0, [r0] - ldr r1, =SpriteCallbackDummy - movs r2, 0x1 - str r2, [sp] - movs r2, 0 - movs r3, 0 - bl AddPseudoFieldObject -_081293C6: - lsls r0, 24 - lsrs r0, 24 - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end gpu_pal_decompress_alloc_tag_and_upload - - thumb_func_start AddDecorationIconObjectFromIconTable -@ u8 AddDecorationIconObjectFromIconTable(u16 tilesTag, u16 paletteTag, u8 decorationId) -AddDecorationIconObjectFromIconTable: @ 81293D8 - push {r4-r7,lr} - sub sp, 0x10 - lsls r0, 16 - lsrs r7, r0, 16 - lsls r1, 16 - lsrs r6, r1, 16 - lsls r2, 24 - lsrs r5, r2, 24 - bl AllocItemIconTemporaryBuffers - lsls r0, 24 - cmp r0, 0 - beq _08129490 - adds r0, r5, 0 - movs r1, 0 - bl GetDecorationIconPicOrPalette - ldr r4, =gUnknown_0203CEBC - ldr r1, [r4] - bl LZDecompressWram - ldr r0, [r4] - ldr r4, =gUnknown_0203CEC0 - ldr r1, [r4] - bl CopyItemIconPicTo4x4Buffer - ldr r0, [r4] - str r0, [sp] - ldr r4, =0xffff0000 - ldr r0, [sp, 0x4] - ands r0, r4 - movs r1, 0x80 - lsls r1, 2 - orrs r0, r1 - lsls r2, r7, 16 - ldr r1, =0x0000ffff - ands r0, r1 - orrs r0, r2 - str r0, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet - adds r0, r5, 0 - movs r1, 0x1 - bl GetDecorationIconPicOrPalette - str r0, [sp, 0x8] - add r0, sp, 0x8 - ldr r1, [r0, 0x4] - ands r1, r4 - orrs r1, r6 - str r1, [r0, 0x4] - bl LoadCompressedObjectPalette - movs r0, 0x18 - bl Alloc - adds r5, r0, 0 - adds r1, r5, 0 - ldr r0, =gUnknown_08614FF4 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - strh r7, [r5] - strh r6, [r5, 0x2] - adds r0, r5, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSprite - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl FreeItemIconTemporaryBuffers - adds r0, r5, 0 - bl Free - adds r0, r4, 0 - b _08129492 - .pool -_08129490: - movs r0, 0x40 -_08129492: - add sp, 0x10 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end AddDecorationIconObjectFromIconTable - - thumb_func_start GetDecorationIconPicOrPalette -@ u32 GetDecorationIconPicOrPalette(u16 decorationId, u8 which) -GetDecorationIconPicOrPalette: @ 812949C - push {lr} - lsls r0, 16 - lsrs r3, r0, 16 - lsls r1, 24 - lsrs r0, r1, 24 - cmp r3, 0x78 - bls _081294AC - movs r3, 0 -_081294AC: - ldr r2, =gUnknown_085A6BE8 - lsls r0, 2 - lsls r1, r3, 3 - adds r0, r1 - adds r0, r2 - ldr r0, [r0] - pop {r1} - bx r1 - .pool - thumb_func_end GetDecorationIconPicOrPalette - - thumb_func_start AddDecorationIconObjectFromFieldObject -@ u8 AddDecorationIconObjectFromFieldObject(u16 tilesTag, u16 paletteTag, u8 decorationId) -AddDecorationIconObjectFromFieldObject: @ 81294C0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x14 - adds r4, r2, 0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gUnknown_0203A190 - adds r0, r6, 0 - bl sub_8129048 - lsls r4, 5 - ldr r0, =gDecorations - adds r4, r0 - str r4, [r6] - ldrb r0, [r4, 0x11] - cmp r0, 0x4 - beq _081295A4 - adds r0, r6, 0 - bl sub_81291E8 - ldr r0, [r6] - ldrb r0, [r0, 0x12] - bl sub_812925C - adds r0, r6, 0 - bl sub_81291A4 - ldr r0, =0x00000884 - adds r5, r6, r0 - ldr r0, =gTilesetPointer_SecretBaseRedCave - ldr r1, [r0] - ldr r0, [r6] - ldr r0, [r0, 0x1C] - ldrh r0, [r0] - ldr r1, [r1, 0xC] - lsls r0, 4 - adds r0, r1 - ldrh r1, [r0, 0xE] - lsrs r1, 12 - adds r0, r5, 0 - bl sub_8129068 - adds r0, r6, 0 - adds r0, 0x84 - str r0, [sp, 0x4] - ldr r1, =gUnknown_085A72F4 - ldr r0, [r6] - ldrb r0, [r0, 0x12] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 21 - ldr r4, =0xffff0000 - mov r2, r8 - lsls r1, r2, 16 - lsrs r0, 16 - orrs r0, r1 - str r0, [sp, 0x8] - add r0, sp, 0x4 - bl LoadSpriteSheet - str r5, [sp, 0xC] - add r0, sp, 0xC - ldr r1, [r0, 0x4] - ands r1, r4 - orrs r1, r7 - str r1, [r0, 0x4] - bl LoadSpritePalette - movs r0, 0x18 - bl Alloc - adds r4, r0, 0 - adds r1, r4, 0 - ldr r0, =gUnknown_085A72A4 - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - mov r3, r8 - strh r3, [r4] - strh r7, [r4, 0x2] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r4, 0 - bl Free - b _081295BA - .pool -_081295A4: - ldr r0, [r4, 0x1C] - ldrh r0, [r0] - ldr r1, =SpriteCallbackDummy - movs r2, 0x1 - str r2, [sp] - movs r2, 0 - movs r3, 0 - bl AddPseudoFieldObject - lsls r0, 24 - lsrs r5, r0, 24 -_081295BA: - adds r0, r5, 0 - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end AddDecorationIconObjectFromFieldObject - - thumb_func_start AddDecorationIconObject -@ u8 AddDecorationIconObject(u8 decorationId, u16 x, u16 y, u8 priority, u16 tilesTag, u16 paletteTag) -AddDecorationIconObject: @ 81295CC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r4, [sp, 0x24] - ldr r5, [sp, 0x28] - lsls r0, 24 - lsrs r6, r0, 24 - mov r12, r6 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - mov r9, r8 - lsls r2, 16 - lsrs r7, r2, 16 - mov r10, r7 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp] - lsls r4, 16 - lsrs r4, 16 - adds r3, r4, 0 - lsls r5, 16 - lsrs r5, 16 - adds r2, r5, 0 - cmp r6, 0x78 - bls _08129634 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - bl AddDecorationIconObjectFromIconTable - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x40 - beq _08129696 - ldr r2, =gSprites - lsls r3, r4, 4 - adds r1, r3, r4 - lsls r1, 2 - adds r1, r2 - mov r5, r8 - lsls r0, r5, 16 - asrs r0, 16 - adds r0, 0x4 - strh r0, [r1, 0x24] - lsls r0, r7, 16 - b _081296B2 - .pool -_08129634: - ldr r0, =gUnknown_085A6BE8 - lsls r1, r6, 3 - adds r1, r0 - ldr r0, [r1] - cmp r0, 0 - bne _08129684 - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl AddDecorationIconObjectFromFieldObject - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x40 - beq _08129696 - ldr r1, =gSprites - lsls r2, r4, 4 - adds r0, r2, r4 - lsls r0, 2 - adds r5, r0, r1 - mov r0, r8 - strh r0, [r5, 0x24] - adds r0, r6, 0 - subs r0, 0x2A - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08129680 - lsls r0, r7, 16 - asrs r0, 16 - subs r0, 0x4 - strh r0, [r5, 0x26] - b _081296BC - .pool -_08129680: - strh r7, [r5, 0x26] - b _081296BC -_08129684: - adds r0, r3, 0 - adds r1, r2, 0 - mov r2, r12 - bl AddDecorationIconObjectFromIconTable - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x40 - bne _0812969A -_08129696: - movs r0, 0x40 - b _081296D8 -_0812969A: - ldr r2, =gSprites - lsls r3, r4, 4 - adds r1, r3, r4 - lsls r1, 2 - adds r1, r2 - mov r5, r9 - lsls r0, r5, 16 - asrs r0, 16 - adds r0, 0x4 - strh r0, [r1, 0x24] - mov r5, r10 - lsls r0, r5, 16 -_081296B2: - asrs r0, 16 - adds r0, 0x4 - strh r0, [r1, 0x26] - adds r1, r2, 0 - adds r2, r3, 0 -_081296BC: - adds r2, r4 - lsls r2, 2 - adds r2, r1 - movs r0, 0x3 - ldr r1, [sp] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - adds r0, r4, 0 -_081296D8: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end AddDecorationIconObject - - thumb_func_start sub_81296EC -sub_81296EC: @ 81296EC - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gUnknown_0203A17C - ldr r1, [r3] - adds r1, r0 - movs r2, 0 - strb r2, [r1] - ldr r1, [r3, 0x4] - adds r1, r0 - strb r2, [r1] - bx lr - .pool - thumb_func_end sub_81296EC - - thumb_func_start sub_8129708 -sub_8129708: @ 8129708 - push {r4-r6,lr} - ldr r6, =gSpecialVar_0x8005 - movs r0, 0 - strh r0, [r6] - ldr r2, =gScriptResult - strh r0, [r2] - ldr r4, =gSpecialVar_0x8004 - ldr r1, =gUnknown_0203AAC4 - ldrh r0, [r4] - ldrb r1, [r1] - cmp r0, r1 - bne _08129744 - movs r0, 0x1 - strh r0, [r2] - b _08129796 - .pool -_08129738: - ldr r1, =gSpecialVar_0x8006 - ldrb r0, [r2] - strh r0, [r1] - b _08129796 - .pool -_08129744: - ldr r3, =gDecorations - ldr r2, =gUnknown_0203A17C - ldr r1, =gUnknown_0203AA44 - ldrh r0, [r4] - lsls r0, 3 - adds r4, r0, r1 - ldrb r1, [r4] - ldr r0, [r2] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 5 - adds r0, r3 - ldrb r0, [r0, 0x11] - cmp r0, 0x4 - bne _08129796 - ldrh r0, [r4, 0x4] - strh r0, [r6] - ldrb r0, [r4] - bl sub_81296EC - movs r1, 0 - ldr r0, =gMapHeader - ldr r0, [r0, 0x4] - ldrb r2, [r0] - cmp r1, r2 - bcs _08129796 - ldr r5, [r0, 0x4] - ldrh r4, [r6] - adds r3, r2, 0 -_0812977E: - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r2, r0, r5 - ldrh r0, [r2, 0x14] - cmp r0, r4 - beq _08129738 - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r3 - bcc _0812977E -_08129796: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129708 - - thumb_func_start sub_81297AC -sub_81297AC: @ 81297AC - push {r4-r6,lr} - movs r2, 0 - ldr r0, =gMapHeader - ldr r0, [r0, 0x4] - ldrb r1, [r0] - cmp r2, r1 - bcs _081297F0 - adds r3, r0, 0 - ldr r5, [r3, 0x4] - ldr r0, =gSpecialVar_0x8004 - ldrh r4, [r0] - ldr r6, =gSpecialVar_0x8005 -_081297C4: - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 3 - adds r1, r0, r5 - ldrh r0, [r1, 0x14] - cmp r0, r4 - bne _081297E4 - ldrb r0, [r1] - strh r0, [r6] - b _081297F0 - .pool -_081297E4: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldrb r0, [r3] - cmp r2, r0 - bcc _081297C4 -_081297F0: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81297AC - - thumb_func_start sub_81297F8 -sub_81297F8: @ 81297F8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r6, 0 - b _081298BE -_08129808: - ldr r3, =gUnknown_0203AA44 - lsls r5, r6, 3 - adds r4, r5, r3 - ldrb r1, [r4] - ldr r2, =gUnknown_0203A17C - ldr r0, [r2] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 5 - ldr r7, =gDecorations - adds r0, r7 - ldrb r2, [r0, 0x11] - ldr r7, =gUnknown_0203A17C - ldr r0, [r7, 0x4] - adds r0, r1 - ldrb r0, [r0] - lsrs r1, r0, 4 - mov r8, r1 - movs r7, 0xF - adds r1, r7, 0 - ands r1, r0 - str r1, [sp] - adds r7, r5, 0 - adds r6, 0x1 - str r6, [sp, 0x4] - cmp r2, 0x4 - beq _081298B8 - movs r6, 0 - ldrb r4, [r4, 0x2] - cmp r6, r4 - bcs _081298AE -_08129846: - movs r4, 0 - adds r0, r5, r3 - adds r2, r6, 0x1 - mov r10, r2 - ldrb r0, [r0, 0x1] - cmp r4, r0 - bcs _0812989C - ldr r3, =gUnknown_0203AA44 - adds r3, r7 - mov r9, r3 - subs r5, r6, 0x7 - str r5, [sp, 0x8] -_0812985E: - adds r0, r4, 0x7 - add r0, r8 - ldr r1, =gMapHeader - ldr r3, [r1] - ldr r1, [sp] - subs r2, r1, r6 - ldr r1, [r3] - muls r2, r1 - mov r5, r8 - adds r1, r5, r4 - adds r1, r2 - ldr r2, [r3, 0xC] - lsls r1, 1 - adds r1, r2 - ldrh r1, [r1] - movs r3, 0xC0 - lsls r3, 6 - adds r2, r3, 0 - orrs r2, r1 - ldr r5, [sp] - ldr r3, [sp, 0x8] - subs r1, r5, r3 - bl MapGridSetMetatileEntryAt - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - mov r5, r9 - ldrb r5, [r5, 0x1] - cmp r4, r5 - bcc _0812985E -_0812989C: - mov r1, r10 - lsls r0, r1, 24 - lsrs r6, r0, 24 - ldr r3, =gUnknown_0203AA44 - adds r5, r7, 0 - adds r0, r7, r3 - ldrb r0, [r0, 0x2] - cmp r6, r0 - bcc _08129846 -_081298AE: - ldr r2, =gUnknown_0203AA44 - adds r0, r7, r2 - ldrb r0, [r0] - bl sub_81296EC -_081298B8: - ldr r3, [sp, 0x4] - lsls r0, r3, 24 - lsrs r6, r0, 24 -_081298BE: - ldr r0, =gUnknown_0203AAC4 - ldrb r0, [r0] - cmp r6, r0 - bcc _08129808 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81297F8 - - thumb_func_start sub_81298EC -sub_81298EC: @ 81298EC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08129928 - cmp r0, 0x1 - bgt _08129914 - cmp r0, 0 - beq _0812991E - b _08129994 - .pool -_08129914: - cmp r0, 0x2 - beq _08129954 - cmp r0, 0x3 - beq _08129968 - b _08129994 -_0812991E: - bl sub_81297F8 - movs r0, 0x1 - strh r0, [r4, 0xC] - b _08129994 -_08129928: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08129994 - bl DrawWholeMapView - ldr r0, =gUnknown_08275D2E - bl ScriptContext1_SetupScript - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - movs r0, 0x2 - strh r0, [r4, 0xC] - b _08129994 - .pool -_08129954: - bl ScriptContext2_Enable - adds r0, r5, 0 - bl sub_8127814 - bl pal_fill_black - movs r0, 0x3 - strh r0, [r4, 0xC] - b _08129994 -_08129968: - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08129994 - ldr r4, =gStringVar4 - ldr r1, =gText_DecorationReturnedToPC - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8129D64 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - ldr r0, =gMapHeader - ldrb r0, [r0, 0x14] - cmp r0, 0x56 - bne _08129994 - bl sub_80EE104 -_08129994: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81298EC - - thumb_func_start sub_81299AC -sub_81299AC: @ 81299AC - push {lr} - movs r1, 0 - ldr r0, =gUnknown_0203A17C - ldrb r2, [r0, 0x8] - cmp r1, r2 - bcs _081299D6 - ldr r3, [r0] -_081299BA: - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081299CC - movs r0, 0x1 - b _081299D8 - .pool -_081299CC: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, r2 - bcc _081299BA -_081299D6: - movs r0, 0 -_081299D8: - pop {r1} - bx r1 - thumb_func_end sub_81299AC - - thumb_func_start SetUpPuttingAwayDecorationPlayerAvatar -SetUpPuttingAwayDecorationPlayerAvatar: @ 81299DC - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - bl player_get_direction_lower_nybble - ldr r3, =gUnknown_0203AA38 - ldr r2, =gSprites - ldr r4, =gUnknown_03005DD0 - ldr r1, [r4, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x2E] - strb r0, [r3] - bl sub_812A39C - ldr r0, =gUnknown_085A7404 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - str r0, [r4, 0x4] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _08129A3C - ldr r1, =SpriteCallbackDummy - str r0, [sp] - movs r0, 0xC1 - b _08129A44 - .pool -_08129A3C: - ldr r1, =SpriteCallbackDummy - movs r0, 0 - str r0, [sp] - movs r0, 0xC2 -_08129A44: - movs r2, 0x88 - movs r3, 0x48 - bl AddPseudoFieldObject - ldr r1, =gUnknown_0203AA39 - strb r0, [r1] - ldr r6, =gSprites - ldr r0, =gUnknown_0203AA39 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r2, [r1, 0x5] - movs r4, 0xD - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - movs r2, 0x4 - mov r8, r2 - mov r2, r8 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r5, =gUnknown_0203AA38 - ldrb r1, [r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - ldr r0, =gUnknown_03005DD0 - ldr r0, [r0, 0x4] - strb r0, [r5] - ldrb r1, [r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0, 0x5] - ands r4, r1 - mov r1, r8 - orrs r4, r1 - strb r4, [r0, 0x5] - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end SetUpPuttingAwayDecorationPlayerAvatar - - thumb_func_start sub_8129ABC -sub_8129ABC: @ 8129ABC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08129B0C - cmp r0, 0x1 - bgt _08129AE4 - cmp r0, 0 - beq _08129AEA - b _08129B2E - .pool -_08129AE4: - cmp r0, 0x2 - beq _08129B1A - b _08129B2E -_08129AEA: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08129B2E - adds r0, r5, 0 - bl sub_8127ACC - movs r0, 0x1 - strh r0, [r4, 0x4] - strh r0, [r4, 0xC] - strh r0, [r4, 0xA] - b _08129B2E - .pool -_08129B0C: - bl SetUpPuttingAwayDecorationPlayerAvatar - bl pal_fill_black - movs r0, 0x2 - strh r0, [r4, 0x4] - b _08129B2E -_08129B1A: - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08129B2E - strh r0, [r4, 0x18] - adds r0, r5, 0 - bl sub_8129B34 -_08129B2E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8129ABC - - thumb_func_start sub_8129B34 -sub_8129B34: @ 8129B34 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - ldr r4, =gSprites - ldr r3, =gUnknown_0203AA38 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r6, 0 - strh r6, [r0, 0x3C] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_812A36C - str r1, [r0] - ldr r2, =gUnknown_0203AA39 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x88 - strh r1, [r0, 0x20] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x48 - strh r1, [r0, 0x22] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r6, [r0, 0x1C] - ldr r1, =sub_8128E18 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129B34 - - thumb_func_start sub_8129BCC -sub_8129BCC: @ 8129BCC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - bl sub_8128DE0 - adds r0, r4, 0 - bl sub_8129C74 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129BCC - - thumb_func_start sub_8129BF8 -sub_8129BF8: @ 8129BF8 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - bl sub_8128DE0 - ldr r3, =gSprites - ldr r5, =gUnknown_0203AA38 - ldrb r1, [r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r1, [r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, 0x1C - adds r0, r3 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - ldr r5, =gStringVar4 - ldr r1, =gText_StopPuttingAwayDecorations - adds r0, r5, 0 - bl StringExpandPlaceholders - ldr r2, =sub_812A1F0 - adds r0, r4, 0 - adds r1, r5, 0 - bl DisplayItemMessageOnField - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129BF8 - - thumb_func_start sub_8129C74 -sub_8129C74: @ 8129C74 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - bl sub_812A0E8 - ldr r0, =gUnknown_0203AAC4 - ldrb r0, [r0] - cmp r0, 0 - beq _08129CA8 - ldr r4, =gStringVar4 - ldr r1, =gText_ReturnDecorationToPC - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_812A1A0 - b _08129D14 - .pool -_08129CA8: - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl MetatileBehavior_IsSecretBasePC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08129CDE - adds r0, r4, 0 - bl MetatileBehavior_IsMB_C5 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08129D3C -_08129CDE: - ldr r3, =gSprites - ldr r4, =gUnknown_0203AA38 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, 0x1C - adds r0, r3 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - ldr r4, =gStringVar4 - ldr r1, =gText_StopPuttingAwayDecorations - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_812A1F0 -_08129D14: - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - b _08129D50 - .pool -_08129D3C: - ldr r4, =gStringVar4 - ldr r1, =gText_NoDecorationHere - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8129D64 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_08129D50: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129C74 - - thumb_func_start sub_8129D64 -sub_8129D64: @ 8129D64 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08129D7E - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08129D84 -_08129D7E: - adds r0, r2, 0 - bl sub_8129B34 -_08129D84: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129D64 - - thumb_func_start sub_8129D8C -sub_8129D8C: @ 8129D8C - push {lr} - adds r2, r1, 0 - lsls r0, 24 - ldr r1, =gDecorations - lsrs r0, 19 - adds r0, r1 - ldrb r1, [r0, 0x12] - cmp r1, 0 - bne _08129DA8 - movs r0, 0x1 - strb r0, [r2, 0x1] - b _08129E06 - .pool -_08129DA8: - cmp r1, 0x1 - bne _08129DB4 - movs r0, 0x2 - strb r0, [r2, 0x1] - strb r1, [r2, 0x2] - b _08129E08 -_08129DB4: - cmp r1, 0x2 - bne _08129DC0 - movs r0, 0x3 - strb r0, [r2, 0x1] - movs r0, 0x1 - b _08129E06 -_08129DC0: - cmp r1, 0x3 - bne _08129DC8 - movs r0, 0x4 - b _08129E02 -_08129DC8: - cmp r1, 0x4 - bne _08129DD2 - movs r0, 0x2 - strb r0, [r2, 0x1] - b _08129E06 -_08129DD2: - cmp r1, 0x5 - bne _08129DDA - movs r0, 0x1 - b _08129E02 -_08129DDA: - cmp r1, 0x6 - bne _08129DE6 - movs r0, 0x1 - strb r0, [r2, 0x1] - movs r0, 0x3 - b _08129E06 -_08129DE6: - cmp r1, 0x7 - bne _08129DF2 - movs r0, 0x2 - strb r0, [r2, 0x1] - movs r0, 0x4 - b _08129E06 -_08129DF2: - cmp r1, 0x8 - bne _08129DFC - movs r0, 0x3 - strb r0, [r2, 0x1] - b _08129E06 -_08129DFC: - cmp r1, 0x9 - bne _08129E08 - movs r0, 0x3 -_08129E02: - strb r0, [r2, 0x1] - movs r0, 0x2 -_08129E06: - strb r0, [r2, 0x2] -_08129E08: - pop {r0} - bx r0 - thumb_func_end sub_8129D8C - - thumb_func_start sub_8129E0C -sub_8129E0C: @ 8129E0C - push {r4-r6,lr} - lsls r0, 24 - lsls r1, 24 - ldr r5, =gSprites - ldr r6, =gUnknown_0203AA38 - ldrb r3, [r6] - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - adds r2, r5 - adds r2, 0x3E - ldrb r3, [r2] - movs r4, 0x4 - orrs r3, r4 - strb r3, [r2] - ldrb r3, [r6] - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - adds r3, r5, 0 - adds r3, 0x1C - adds r2, r3 - ldr r3, =SpriteCallbackDummy - str r3, [r2] - ldr r4, =gUnknown_0203AA39 - ldrb r3, [r4] - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - adds r2, r5 - lsrs r0, 20 - adds r0, 0x88 - strh r0, [r2, 0x20] - ldrb r2, [r4] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - lsrs r1, 20 - adds r1, 0x48 - strh r1, [r0, 0x22] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8129E0C - - thumb_func_start sub_8129E74 -sub_8129E74: @ 8129E74 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r9, r2 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gTasks - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - adds r2, r3 - ldrb r0, [r2, 0x8] - subs r0, 0x7 - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r2, 0xA] - subs r0, 0x7 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r2, =gUnknown_0203A17C - ldr r0, [r2, 0x4] - adds r0, r1 - ldrb r0, [r0] - lsrs r5, r0, 4 - movs r6, 0xF - ands r6, r0 - mov r0, r9 - ldrb r4, [r0, 0x2] - ldr r0, [r2] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x29 - bne _08129ED4 - adds r0, r5, 0x7 - adds r1, r6, 0x7 - bl MapGridGetMetatileIdAt - movs r1, 0xA3 - lsls r1, 2 - cmp r0, r1 - bne _08129ED4 - subs r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_08129ED4: - cmp r7, r5 - bcc _08129F10 - mov r0, r9 - ldrb r2, [r0, 0x1] - adds r0, r5, r2 - cmp r7, r0 - bge _08129F10 - subs r0, r6, r4 - cmp r8, r0 - ble _08129F10 - cmp r8, r6 - bhi _08129F10 - subs r0, r7, r5 - adds r0, 0x1 - subs r0, r2, r0 - lsls r0, 24 - lsrs r0, 24 - mov r2, r8 - subs r1, r6, r2 - lsls r1, 24 - lsrs r1, 24 - bl sub_8129E0C - movs r0, 0x1 - b _08129F12 - .pool -_08129F10: - movs r0, 0 -_08129F12: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8129E74 - - thumb_func_start sub_8129F20 -sub_8129F20: @ 8129F20 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r2, =gUnknown_0203A17C - ldr r3, =gUnknown_0203AA44 - ldr r0, =gUnknown_0203AAC4 - ldrb r0, [r0] - lsls r0, 3 - adds r0, r3 - ldrb r1, [r0] - ldr r0, [r2, 0x4] - adds r0, r1 - ldrb r0, [r0] - lsrs r1, r0, 4 - mov r8, r1 - movs r6, 0xF - ands r6, r0 - movs r4, 0 - ldr r7, =gSaveBlock1Ptr - mov r9, r3 -_08129F4A: - ldr r1, [r7] - lsls r0, r4, 1 - adds r0, r4 - lsls r5, r0, 3 - adds r1, r5 - ldr r2, =0x00000c74 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, r8 - bne _08129FB0 - ldr r2, =0x00000c76 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, r6 - bne _08129FB0 - ldr r2, =0x00000c84 - adds r0, r1, r2 - ldrh r0, [r0] - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _08129FB0 - ldr r0, =gUnknown_0203AAC4 - ldrb r1, [r0] - lsls r1, 3 - add r1, r9 - ldr r0, [r7] - adds r0, r5 - ldr r2, =0x00000c84 - adds r0, r2 - ldrh r0, [r0] - strh r0, [r1, 0x4] - b _08129FBA - .pool -_08129FB0: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x3F - bls _08129F4A -_08129FBA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8129F20 - - thumb_func_start sub_8129FC8 -sub_8129FC8: @ 8129FC8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0 - b _0812A02A -_08129FD2: - ldr r0, [r0] - adds r1, r0, r6 - ldrb r0, [r1] - cmp r0, 0 - beq _0812A024 - ldr r0, =gDecorations - ldrb r2, [r1] - lsls r1, r2, 5 - adds r1, r0 - ldrb r0, [r1, 0x11] - cmp r0, 0x4 - bne _0812A024 - ldr r5, =gUnknown_0203AA44 - adds r0, r2, 0 - adds r1, r5, 0 - bl sub_8129D8C - lsls r1, r6, 24 - lsrs r1, 24 - adds r0, r7, 0 - adds r2, r5, 0 - bl sub_8129E74 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - bne _0812A024 - strb r6, [r5] - bl sub_8129F20 - ldr r0, =gUnknown_0203AAC4 - strb r4, [r0] - movs r0, 0x1 - b _0812A034 - .pool -_0812A024: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 -_0812A02A: - ldr r0, =gUnknown_0203A17C - ldrb r1, [r0, 0x8] - cmp r6, r1 - bcc _08129FD2 - movs r0, 0 -_0812A034: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8129FC8 - - thumb_func_start sub_812A040 -sub_812A040: @ 812A040 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - movs r4, 0 - ldr r7, =gUnknown_0203A17C - ldrb r0, [r7, 0x8] - cmp r4, r0 - bcs _0812A0C6 - adds r6, r7, 0 - ldr r5, =gUnknown_0203AAC4 -_0812A072: - ldr r0, [r6] - adds r0, r4 - ldrb r1, [r0] - ldr r0, [r6, 0x4] - adds r0, r4 - ldrb r0, [r0] - lsrs r3, r0, 4 - movs r2, 0xF - ands r2, r0 - cmp r1, 0 - beq _0812A0BA - ldr r0, =gDecorations - lsls r1, 5 - adds r1, r0 - ldrb r0, [r1, 0x11] - cmp r0, 0x4 - bne _0812A0BA - ldr r0, [sp] - cmp r0, r3 - bhi _0812A0BA - cmp r10, r2 - bhi _0812A0BA - cmp r9, r3 - bcc _0812A0BA - cmp r8, r2 - bcc _0812A0BA - ldr r0, =gUnknown_0203AA44 - ldrb r1, [r5] - lsls r1, 3 - adds r1, r0 - strb r4, [r1] - bl sub_8129F20 - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] -_0812A0BA: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrb r0, [r7, 0x8] - cmp r4, r0 - bcc _0812A072 -_0812A0C6: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A040 - - thumb_func_start sub_812A0E8 -sub_812A0E8: @ 812A0E8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r4, =gUnknown_0203AAC4 - movs r0, 0 - strb r0, [r4] - adds r0, r6, 0 - bl sub_8129FC8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0812A18C - movs r5, 0 - ldr r0, =gUnknown_0203A17C - ldrb r1, [r0, 0x8] - cmp r5, r1 - bcs _0812A15A - adds r7, r4, 0 -_0812A10E: - ldr r0, [r0] - adds r0, r5 - ldrb r1, [r0] - cmp r1, 0 - beq _0812A14C - ldr r4, =gUnknown_0203AA44 - adds r0, r1, 0 - adds r1, r4, 0 - bl sub_8129D8C - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_8129E74 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0812A14C - strb r5, [r4] - ldrb r0, [r7] - adds r0, 0x1 - strb r0, [r7] - b _0812A15A - .pool -_0812A14C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203A17C - ldrb r1, [r0, 0x8] - cmp r5, r1 - bcc _0812A10E -_0812A15A: - ldr r0, =gUnknown_0203AAC4 - ldrb r0, [r0] - cmp r0, 0 - beq _0812A18C - ldr r0, =gUnknown_0203A17C - ldr r2, =gUnknown_0203AA44 - ldrb r1, [r2] - ldr r0, [r0, 0x4] - adds r0, r1 - ldrb r1, [r0] - lsrs r0, r1, 4 - movs r3, 0xF - ands r3, r1 - ldrb r1, [r2, 0x2] - subs r1, r3, r1 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r2, 0x1] - adds r2, r0 - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - bl sub_812A040 -_0812A18C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A0E8 - - thumb_func_start sub_812A1A0 -sub_812A1A0: @ 812A1A0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8197930 - ldr r1, =gUnknown_085A7348 - adds r0, r4, 0 - bl sub_8121F68 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A1A0 - - thumb_func_start sub_812A1C0 -sub_812A1C0: @ 812A1C0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0 - bl fade_screen - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - ldr r1, =sub_81298EC - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A1C0 - - thumb_func_start sub_812A1F0 -sub_812A1F0: @ 812A1F0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8197930 - ldr r1, =gUnknown_085A7350 - adds r0, r4, 0 - bl sub_8121F68 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A1F0 - - thumb_func_start sub_812A210 -sub_812A210: @ 812A210 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - adds r0, r4, 0 - bl sub_812A22C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_812A210 - - thumb_func_start sub_812A22C -sub_812A22C: @ 812A22C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0 - bl fade_screen - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - ldr r1, =sub_812A25C - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A22C - - thumb_func_start sub_812A25C -sub_812A25C: @ 812A25C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r5, r0, r1 - movs r1, 0xC - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _0812A280 - cmp r0, 0x1 - beq _0812A29C - b _0812A2B2 - .pool -_0812A280: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0812A2B2 - adds r0, r4, 0 - bl sub_8127B04 - movs r0, 0x1 - strh r0, [r5, 0xC] - b _0812A2B2 - .pool -_0812A29C: - bl sub_812A3C8 - ldr r0, =gFieldCallback - ldr r1, =sub_812A334 - str r1, [r0] - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 - adds r0, r4, 0 - bl DestroyTask -_0812A2B2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A25C - - thumb_func_start sub_812A2C4 -sub_812A2C4: @ 812A2C4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r5, r1, 3 - ldr r6, =gTasks + 0x8 - adds r4, r5, r6 - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0812A2FC - cmp r0, 0x1 - bgt _0812A2EC - cmp r0, 0 - beq _0812A2F6 - b _0812A32A - .pool -_0812A2EC: - cmp r0, 0x2 - beq _0812A308 - cmp r0, 0x3 - beq _0812A314 - b _0812A32A -_0812A2F6: - bl sub_80E9578 - b _0812A30C -_0812A2FC: - ldr r0, =gUnknown_08275D0C - bl ScriptContext1_SetupScript - b _0812A30C - .pool -_0812A308: - bl ScriptContext2_Enable -_0812A30C: - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] - b _0812A32A -_0812A314: - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0812A32A - adds r0, r6, 0 - subs r0, 0x8 - adds r0, r5, r0 - ldr r1, =sub_8126B80 - str r1, [r0] -_0812A32A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A2C4 - - thumb_func_start sub_812A334 -sub_812A334: @ 812A334 - push {lr} - bl pal_fill_black - movs r0, 0 - movs r1, 0x1 - bl sub_81973C4 - bl sub_8126ABC - ldr r0, =sub_812A2C4 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0xC] - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A334 - - thumb_func_start sub_812A36C -sub_812A36C: @ 812A36C - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - movs r1, 0x1F - ands r0, r1 - strh r0, [r2, 0x2E] - cmp r0, 0xF - ble _0812A38C - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _0812A398 -_0812A38C: - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_0812A398: - pop {r0} - bx r0 - thumb_func_end sub_812A36C - - thumb_func_start sub_812A39C -sub_812A39C: @ 812A39C - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _0812A3B8 - ldr r0, =gUnknown_085A73D8 - bl LoadSpritePalette - b _0812A3BE - .pool -_0812A3B8: - ldr r0, =gUnknown_085A73E0 - bl LoadSpritePalette -_0812A3BE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A39C - - thumb_func_start sub_812A3C8 -sub_812A3C8: @ 812A3C8 - push {lr} - movs r0, 0x8 - bl FreeSpritePaletteByTag - pop {r0} - bx r0 - thumb_func_end sub_812A3C8 - - thumb_func_start sub_812A3D4 -sub_812A3D4: @ 812A3D4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_81279C4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0812A430 - ldr r0, =gStringVar1 - ldr r1, =gUnknown_0203A172 - ldrb r2, [r1] - ldr r1, =gUnknown_0203A14C - ldr r1, [r1] - adds r1, r2 - ldrb r1, [r1] - lsls r1, 5 - ldr r2, =gDecorations + 1 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_DecorationWillBeDiscarded - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_812A458 - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField - b _0812A444 - .pool -_0812A430: - ldr r4, =gStringVar4 - ldr r1, =gText_CantThrowAwayInUse - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8127A5C - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_0812A444: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A3D4 - - thumb_func_start sub_812A458 -sub_812A458: @ 812A458 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8197930 - ldr r1, =gUnknown_085A741C - adds r0, r4, 0 - bl sub_8121F68 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A458 - - thumb_func_start sub_812A478 -sub_812A478: @ 812A478 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203A172 - ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C - ldr r0, [r0] - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r5, =gUnknown_0203A173 - ldrb r0, [r5] - bl sub_8161AD0 - ldr r1, =gUnknown_0203A151 - strb r0, [r1] - ldrb r0, [r5] - bl sub_8161A38 - adds r0, r4, 0 - bl sub_8127814 - ldr r5, =gStringVar4 - ldr r1, =gText_DecorationThrownAway - adds r0, r5, 0 - bl StringExpandPlaceholders - ldr r2, =sub_8127A5C - adds r0, r4, 0 - adds r1, r5, 0 - bl DisplayItemMessageOnField - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A478 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/decoration_inventory.s b/asm/decoration_inventory.s deleted file mode 100644 index 7a909f585..000000000 --- a/asm/decoration_inventory.s +++ /dev/null @@ -1,459 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start SetDecorationInventoriesPointers -SetDecorationInventoriesPointers: @ 81617F4 - push {r4,lr} - ldr r0, =gDecorationInventories - mov r12, r0 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r2, =0x00002734 - adds r0, r1, r2 - mov r4, r12 - str r0, [r4] - movs r3, 0xA - strb r3, [r4, 0x4] - adds r2, 0xA - adds r0, r1, r2 - str r0, [r4, 0x8] - strb r3, [r4, 0xC] - ldr r4, =0x00002748 - adds r0, r1, r4 - mov r2, r12 - str r0, [r2, 0x10] - strb r3, [r2, 0x14] - adds r4, 0xA - adds r0, r1, r4 - str r0, [r2, 0x18] - movs r2, 0x1E - mov r0, r12 - strb r2, [r0, 0x1C] - adds r4, 0x1E - adds r0, r1, r4 - mov r4, r12 - str r0, [r4, 0x20] - mov r0, r12 - adds r0, 0x24 - strb r2, [r0] - ldr r2, =0x0000278e - adds r0, r1, r2 - str r0, [r4, 0x28] - mov r0, r12 - adds r0, 0x2C - strb r3, [r0] - ldr r4, =0x00002798 - adds r0, r1, r4 - mov r2, r12 - str r0, [r2, 0x30] - adds r2, 0x34 - movs r0, 0x28 - strb r0, [r2] - adds r4, 0x28 - adds r1, r4 - mov r0, r12 - str r1, [r0, 0x38] - adds r0, 0x3C - strb r3, [r0] - bl sub_8126968 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SetDecorationInventoriesPointers - - thumb_func_start ClearDecorationInventory -ClearDecorationInventory: @ 8161880 - push {r4,r5,lr} - lsls r0, 24 - movs r3, 0 - ldr r1, =gDecorationInventories - lsrs r2, r0, 21 - adds r0, r2, r1 - ldrb r0, [r0, 0x4] - cmp r3, r0 - bcs _081618AA - adds r5, r1, 0 - movs r4, 0 -_08161896: - adds r0, r2, r5 - ldr r1, [r0] - adds r1, r3 - strb r4, [r1] - adds r1, r3, 0x1 - lsls r1, 24 - lsrs r3, r1, 24 - ldrb r0, [r0, 0x4] - cmp r3, r0 - bcc _08161896 -_081618AA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ClearDecorationInventory - - thumb_func_start ClearDecorationInventories -ClearDecorationInventories: @ 81618B4 - push {r4,lr} - movs r4, 0 -_081618B8: - adds r0, r4, 0 - bl ClearDecorationInventory - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _081618B8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end ClearDecorationInventories - - thumb_func_start sub_81618D0 -sub_81618D0: @ 81618D0 - push {r4,lr} - lsls r0, 24 - movs r2, 0 - ldr r1, =gDecorationInventories - lsrs r0, 21 - adds r0, r1 - movs r1, 0x4 - ldrsb r1, [r0, r1] - cmp r2, r1 - bge _0816190C - adds r4, r0, 0 - adds r3, r1, 0 -_081618E8: - lsls r0, r2, 24 - asrs r1, r0, 24 - ldr r0, [r4] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08161900 - adds r0, r1, 0 - b _08161910 - .pool -_08161900: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, r3 - blt _081618E8 -_0816190C: - movs r0, 0x1 - negs r0, r0 -_08161910: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81618D0 - - thumb_func_start CheckHasDecoration -CheckHasDecoration: @ 8161918 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gDecorations - lsls r0, r3, 5 - adds r0, r1 - ldrb r0, [r0, 0x13] - movs r2, 0 - ldr r1, =gDecorationInventories - lsls r0, 3 - adds r0, r1 - ldrb r1, [r0, 0x4] - cmp r2, r1 - bcs _08161956 - ldr r4, [r0] -_08161936: - adds r0, r4, r2 - ldrb r0, [r0] - cmp r0, r3 - bne _0816194C - movs r0, 0x1 - b _08161958 - .pool -_0816194C: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r1 - bcc _08161936 -_08161956: - movs r0, 0 -_08161958: - pop {r4} - pop {r1} - bx r1 - thumb_func_end CheckHasDecoration - - thumb_func_start DecorationAdd -DecorationAdd: @ 8161960 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - cmp r4, 0 - beq _081619A0 - ldr r1, =gDecorations - lsls r0, r4, 5 - adds r0, r1 - ldrb r5, [r0, 0x13] - adds r0, r5, 0 - bl sub_81618D0 - lsls r0, 24 - asrs r2, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r2, r0 - beq _081619A0 - ldr r0, =gDecorationInventories - lsls r1, r5, 3 - adds r1, r0 - ldr r0, [r1] - adds r0, r2 - strb r4, [r0] - movs r0, 0x1 - b _081619A2 - .pool -_081619A0: - movs r0, 0 -_081619A2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end DecorationAdd - - thumb_func_start DecorationCheckSpace -DecorationCheckSpace: @ 81619A8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081619D4 - ldr r1, =gDecorations - lsls r0, 5 - adds r0, r1 - ldrb r0, [r0, 0x13] - bl sub_81618D0 - lsls r0, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _081619D4 - movs r0, 0x1 - b _081619D6 - .pool -_081619D4: - movs r0, 0 -_081619D6: - pop {r1} - bx r1 - thumb_func_end DecorationCheckSpace - - thumb_func_start DecorationRemove -DecorationRemove: @ 81619DC - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r3, 0 - cmp r5, 0 - bne _081619F8 - b _08161A26 -_081619EA: - movs r0, 0 - strb r0, [r1] - adds r0, r6, 0 - bl sub_8161A38 - movs r0, 0x1 - b _08161A28 -_081619F8: - ldr r2, =gDecorationInventories - ldr r1, =gDecorations - lsls r0, r5, 5 - adds r0, r1 - ldrb r4, [r0, 0x13] - lsls r0, r4, 3 - adds r0, r2 - ldrb r1, [r0, 0x4] - cmp r3, r1 - bcs _08161A26 - adds r6, r4, 0 - adds r4, r0, 0 - adds r2, r1, 0 -_08161A12: - ldr r0, [r4] - adds r1, r0, r3 - ldrb r0, [r1] - cmp r0, r5 - beq _081619EA - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, r2 - bcc _08161A12 -_08161A26: - movs r0, 0 -_08161A28: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end DecorationRemove - - thumb_func_start sub_8161A38 -sub_8161A38: @ 8161A38 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - movs r6, 0 - ldr r2, =gDecorationInventories - lsrs r0, 21 - adds r1, r0, r2 - ldrb r3, [r1, 0x4] - cmp r6, r3 - bcs _08161ABC - adds r7, r0, 0 - mov r10, r1 - mov r0, r10 - str r0, [sp] -_08161A5C: - adds r1, r6, 0x1 - lsls r0, r1, 24 - lsrs r3, r0, 24 - adds r2, r7, 0 - mov r12, r1 - mov r1, r10 - ldrb r1, [r1, 0x4] - cmp r3, r1 - bcs _08161AAE - ldr r0, =gDecorationInventories - mov r9, r0 - adds r1, r0, 0 - mov r8, r1 -_08161A76: - mov r0, r9 - adds r5, r2, r0 - ldr r1, [r5] - adds r0, r1, r3 - ldrb r4, [r0] - adds r2, r4, 0 - cmp r2, 0 - beq _08161A9C - adds r0, r1, r6 - ldrb r1, [r0] - cmp r1, 0 - beq _08161A92 - cmp r1, r2 - bls _08161A9C -_08161A92: - ldrb r1, [r0] - strb r4, [r0] - ldr r0, [r5] - adds r0, r3 - strb r1, [r0] -_08161A9C: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - adds r2, r7, 0 - mov r1, r8 - adds r0, r2, r1 - ldrb r0, [r0, 0x4] - cmp r3, r0 - bcc _08161A76 -_08161AAE: - mov r3, r12 - lsls r0, r3, 24 - lsrs r6, r0, 24 - ldr r0, [sp] - ldrb r0, [r0, 0x4] - cmp r6, r0 - bcc _08161A5C -_08161ABC: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8161A38 - - thumb_func_start sub_8161AD0 -sub_8161AD0: @ 8161AD0 - push {r4,r5,lr} - lsls r0, 24 - movs r4, 0 - movs r3, 0 - ldr r2, =gDecorationInventories - lsrs r1, r0, 21 - adds r0, r1, r2 - ldrb r0, [r0, 0x4] - cmp r4, r0 - bcs _08161B04 - adds r5, r2, 0 -_08161AE6: - adds r2, r1, r5 - ldr r0, [r2] - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0 - beq _08161AF8 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_08161AF8: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r2, [r2, 0x4] - cmp r3, r2 - bcc _08161AE6 -_08161B04: - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8161AD0 - - thumb_func_start sub_8161B10 -sub_8161B10: @ 8161B10 - push {r4,r5,lr} - movs r5, 0 - movs r4, 0 -_08161B16: - adds r0, r4, 0 - bl sub_8161AD0 - adds r0, r5, r0 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _08161B16 - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8161B10 - - .align 2, 0 @ Don't pad with nop. - \ No newline at end of file diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 50018de9c..03f6b11d1 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,7832 +5,6 @@ .text - thumb_func_start sub_81BF8EC -sub_81BF8EC: @ 81BF8EC - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r1 - adds r5, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r4, =gUnknown_0203CF1C - ldr r0, =0x000040f8 - bl AllocZeroed - str r0, [r4] - ldr r1, =0x000040bc - adds r0, r1 - strb r7, [r0] - ldr r0, [r4] - mov r2, r8 - str r2, [r0] - adds r1, 0x2 - adds r0, r1 - strb r5, [r0] - ldr r0, [r4] - ldr r2, =0x000040bf - adds r0, r2 - strb r6, [r0] - ldr r1, [r4] - ldr r0, [sp, 0x18] - str r0, [r1, 0x4] - cmp r7, 0x2 - bne _081BF94C - subs r2, 0x2 - adds r1, r2 - movs r0, 0x1 - b _081BF952 - .pool -_081BF94C: - ldr r0, =0x000040bd - adds r1, r0 - movs r0, 0 -_081BF952: - strb r0, [r1] - cmp r7, 0x1 - beq _081BF9A0 - cmp r7, 0x1 - bgt _081BF96C - cmp r7, 0 - beq _081BF97C - ldr r2, =gUnknown_0203CF1C - b _081BF9EE - .pool -_081BF96C: - cmp r7, 0x2 - beq _081BF97C - cmp r7, 0x3 - beq _081BF9D0 - ldr r2, =gUnknown_0203CF1C - b _081BF9EE - .pool -_081BF97C: - ldr r2, =gUnknown_0203CF1C - ldr r0, [r2] - ldr r1, =0x000040c1 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c2 - adds r0, r1 - movs r1, 0x3 - b _081BF9EC - .pool -_081BF9A0: - ldr r2, =gUnknown_0203CF1C - ldr r0, [r2] - ldr r1, =0x000040c1 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c2 - adds r0, r1 - movs r1, 0x3 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c8 - adds r0, r1 - strb r7, [r0] - b _081BF9EE - .pool -_081BF9D0: - ldr r2, =gUnknown_0203CF1C - ldr r0, [r2] - ldr r1, =0x000040c1 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c2 - adds r0, r1 - strb r7, [r0] - ldr r0, [r2] - adds r1, 0x1 - adds r0, r1 - movs r1, 0x1 -_081BF9EC: - strb r1, [r0] -_081BF9EE: - ldr r0, [r2] - ldr r2, =0x000040c1 - adds r1, r0, r2 - ldrb r1, [r1] - subs r2, 0x1 - adds r0, r2 - strb r1, [r0] - movs r0, 0xFF - bl sub_81C488C - ldr r0, =gMonSpritesGfxPtr - ldr r0, [r0] - cmp r0, 0 - bne _081BFA12 - movs r0, 0 - movs r1, 0 - bl sub_806F2AC -_081BFA12: - ldr r0, =sub_81BFAE4 - bl SetMainCallback2 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BF8EC - - thumb_func_start sub_81BFA38 -sub_81BFA38: @ 81BFA38 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - mov r8, r0 - adds r4, r1, 0 - adds r5, r2, 0 - ldr r6, [sp, 0x18] - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 16 - lsrs r6, 16 - str r3, [sp] - movs r0, 0x3 - mov r1, r8 - adds r2, r4, 0 - adds r3, r5, 0 - bl sub_81BF8EC - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - strh r6, [r0] - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BFA38 - - thumb_func_start sub_81BFA80 -sub_81BFA80: @ 81BFA80 - push {r4,lr} - sub sp, 0x4 - ldr r4, [sp, 0xC] - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - str r4, [sp] - bl sub_81BF8EC - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040ef - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BFA80 - - thumb_func_start sub_81BFAB4 -sub_81BFAB4: @ 81BFAB4 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl do_scheduled_bg_tilemap_copies_to_vram - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_81BFAB4 - - thumb_func_start sub_81BFAD0 -sub_81BFAD0: @ 81BFAD0 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_81BFAD0 - - thumb_func_start sub_81BFAE4 -sub_81BFAE4: @ 81BFAE4 - push {lr} -_081BFAE6: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081BFB0A - bl sub_81BFB10 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081BFB0A - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BFAE6 -_081BFB0A: - pop {r0} - bx r0 - thumb_func_end sub_81BFAE4 - - thumb_func_start sub_81BFB10 -sub_81BFB10: @ 81BFB10 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x18 - bls _081BFB24 - b _081BFE00 -_081BFB24: - lsls r0, 2 - ldr r1, =_081BFB38 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BFB38: - .4byte _081BFB9C - .4byte _081BFBAA - .4byte _081BFBBC - .4byte _081BFBD0 - .4byte _081BFBE4 - .4byte _081BFBEA - .4byte _081BFC04 - .4byte _081BFC20 - .4byte _081BFC26 - .4byte _081BFC38 - .4byte _081BFC58 - .4byte _081BFC7C - .4byte _081BFC82 - .4byte _081BFC94 - .4byte _081BFCAC - .4byte _081BFCC0 - .4byte _081BFCD8 - .4byte _081BFCF8 - .4byte _081BFD34 - .4byte _081BFD50 - .4byte _081BFD60 - .4byte _081BFD74 - .4byte _081BFD7A - .4byte _081BFDB0 - .4byte _081BFDCC -_081BFB9C: - bl SetVBlankHBlankCallbacksToNull - bl sub_8121DA0 - bl clear_scheduled_bg_copies_to_vram - b _081BFDE6 -_081BFBAA: - bl remove_some_task - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFBBC: - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - b _081BFDE4 - .pool -_081BFBD0: - bl ResetSpriteData - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFBE4: - bl FreeAllSpritePalettes - b _081BFDE6 -_081BFBEA: - bl sub_81BFE24 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081BFDE6 - .pool -_081BFC04: - bl sub_81BFEB0 - lsls r0, 24 - cmp r0, 0 - bne _081BFC10 - b _081BFE18 -_081BFC10: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC20: - bl sub_81C2554 - b _081BFDE6 -_081BFC26: - bl sub_81C1BA0 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC38: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0xC - bl sub_81C0098 - ldr r0, [r4] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081BFDE6 - .pool -_081BFC58: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C00F0 - lsls r0, 24 - cmp r0, 0 - bne _081BFC6A - b _081BFE18 -_081BFC6A: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC7C: - bl sub_81C25E8 - b _081BFDE6 -_081BFC82: - bl sub_81C286C - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC94: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2D9C - b _081BFDE6 - .pool -_081BFCAC: - bl sub_81C0348 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFCC0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2AFC - b _081BFDE6 - .pool -_081BFCD8: - bl sub_81C4190 - bl sub_81C42C8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081BFDE6 - .pool -_081BFCF8: - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0xC - ldr r2, =0x000040f0 - adds r1, r2 - bl sub_81C45F4 - ldr r1, [r4] - ldr r2, =0x000040d3 - adds r1, r2 - strb r0, [r1] - ldr r1, [r4] - adds r2, r1, r2 - ldrb r0, [r2] - cmp r0, 0xFF - bne _081BFD1C - b _081BFE18 -_081BFD1C: - ldr r0, =0x000040f0 - adds r1, r0 - movs r0, 0 - strh r0, [r1] - b _081BFDE6 - .pool -_081BFD34: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C4984 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFD50: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C4A08 - b _081BFDE6 - .pool -_081BFD60: - bl sub_81C4A88 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFD74: - bl sub_81C4280 - b _081BFDE6 -_081BFD7A: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - beq _081BFDA0 - ldr r0, =sub_81C0510 - movs r1, 0 - bl CreateTask - b _081BFDE6 - .pool -_081BFDA0: - ldr r0, =sub_81C171C - movs r1, 0 - bl CreateTask - b _081BFDE6 - .pool -_081BFDB0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFDCC: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 -_081BFDE4: - strb r0, [r2, 0x8] -_081BFDE6: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_081BFDEE: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _081BFE18 - .pool -_081BFE00: - ldr r0, =sub_81BFAD0 - bl SetVBlankCallback - ldr r0, =sub_81BFAB4 - bl SetMainCallback2 - movs r0, 0x1 - b _081BFE1A - .pool -_081BFE18: - movs r0, 0 -_081BFE1A: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81BFB10 - - thumb_func_start sub_81BFE24 -sub_81BFE24: @ 81BFE24 - push {r4,lr} - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0861CBB4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - ldr r0, =0x000020bc - adds r1, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x000010bc - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - ldr r1, [r4] - adds r1, 0xBC - movs r0, 0x3 - bl SetBgTilemapBuffer - bl sub_8121E10 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BFE24 - - thumb_func_start sub_81BFEB0 -sub_81BFEB0: @ 81BFEB0 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_0203CF1C - ldr r0, [r1] - ldr r2, =0x000040f0 - adds r0, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - adds r4, r1, 0 - cmp r0, 0xC - bls _081BFEC8 - b _081C008C -_081BFEC8: - lsls r0, 2 - ldr r1, =_081BFEE0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BFEE0: - .4byte _081BFF14 - .4byte _081BFF30 - .4byte _081BFF60 - .4byte _081BFF78 - .4byte _081BFF90 - .4byte _081BFFA8 - .4byte _081BFFC0 - .4byte _081BFFF0 - .4byte _081BFFFC - .4byte _081C0018 - .4byte _081C0024 - .4byte _081C0040 - .4byte _081C0064 -_081BFF14: - bl reset_temp_tile_data_buffers - ldr r1, =gUnknown_08D97D0C - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _081C0046 - .pool -_081BFF30: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BFF3E - b _081C008C -_081BFF3E: - ldr r0, =gUnknown_08D9862C - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - adds r1, 0xBC - bl LZDecompressWram - ldr r1, [r4] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081BFF60: - ldr r0, =gUnknown_08D98CC8 - ldr r1, [r4] - ldr r2, =0x000008bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFF78: - ldr r0, =gUnknown_08D987FC - ldr r1, [r4] - ldr r2, =0x000018bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFF90: - ldr r0, =gUnknown_08D9898C - ldr r1, [r4] - ldr r2, =0x000028bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFFA8: - ldr r0, =gUnknown_08D98B28 - ldr r1, [r4] - ldr r2, =0x000038bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFFC0: - ldr r0, =gUnknown_08D9853C - movs r2, 0x80 - lsls r2, 1 - movs r1, 0 - bl LoadCompressedPalette - ldr r0, =gUnknown_08D85620 - movs r1, 0x81 - movs r2, 0x1E - bl LoadPalette - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081BFFF0: - ldr r0, =gUnknown_0861CFBC - bl LoadCompressedObjectPic - b _081C0046 - .pool -_081BFFFC: - ldr r0, =gUnknown_0861D074 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081C0018: - ldr r0, =gUnknown_0861D0F8 - bl LoadCompressedObjectPic - b _081C0046 - .pool -_081C0024: - ldr r0, =gUnknown_0861D100 - bl LoadCompressedObjectPalette - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081C0040: - ldr r0, =gUnknown_0861D07C - bl LoadCompressedObjectPalette -_081C0046: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] -_081C004A: - ldr r0, =0x000040f0 - adds r1, r0 -_081C004E: - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _081C008C - .pool -_081C0064: - ldr r0, =gUnknown_08D97B84 - movs r1, 0xE8 - lsls r1, 1 - movs r2, 0x60 - bl LoadCompressedPalette - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - movs r0, 0x1 - b _081C008E - .pool -_081C008C: - movs r0, 0 -_081C008E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81BFEB0 - - thumb_func_start sub_81C0098 -sub_81C0098: @ 81C0098 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bd - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _081C00D0 - ldr r2, [r1] - ldr r4, =0x000040be - adds r0, r1, r4 - ldrb r1, [r0] - movs r0, 0x64 - muls r1, r0 - adds r1, r2 - adds r0, r3, 0 - movs r2, 0x64 - bl memcpy - b _081C00E6 - .pool -_081C00D0: - ldr r0, [r1] - ldr r2, =0x000040be - adds r1, r2 - ldrb r2, [r1] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 4 - adds r0, r1 - adds r1, r3, 0 - bl sub_8069004 -_081C00E6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0098 - - thumb_func_start sub_81C00F0 -sub_81C00F0: @ 81C00F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r5, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r7, [r0] - adds r6, r7, 0 - adds r6, 0x70 - ldr r1, =0x000040f0 - adds r0, r7, r1 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0x1 - beq _081C0198 - cmp r0, 0x1 - bgt _081C0120 - cmp r0, 0 - beq _081C012C - b _081C0314 - .pool -_081C0120: - cmp r0, 0x2 - beq _081C01DC - cmp r0, 0x3 - bne _081C012A - b _081C02A8 -_081C012A: - b _081C0314 -_081C012C: - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - strh r0, [r6] - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - strh r0, [r6, 0x2] - adds r0, r5, 0 - movs r1, 0x19 - bl GetMonData - str r0, [r6, 0x10] - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - strb r0, [r6, 0x5] - adds r0, r5, 0 - movs r1, 0x2E - bl GetMonData - strb r0, [r6, 0x8] - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - strh r0, [r6, 0x2E] - adds r0, r5, 0 - movs r1, 0 - bl GetMonData - str r0, [r6, 0xC] - adds r0, r5, 0 - movs r1, 0x4 - bl GetMonData - adds r1, r7, 0 - adds r1, 0xA5 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - beq _081C018C - movs r0, 0x1 - strb r0, [r6, 0x4] - b _081C0322 -_081C018C: - adds r0, r5, 0 - movs r1, 0x2D - bl GetMonData - strb r0, [r6, 0x4] - b _081C0322 -_081C0198: - movs r4, 0 - movs r0, 0x8C - adds r0, r7 - mov r8, r0 - movs r1, 0xA4 - adds r1, r7 - mov r9, r1 - adds r6, r7, 0 - adds r6, 0x84 -_081C01AA: - adds r1, r4, 0 - adds r1, 0xD - adds r0, r5, 0 - bl GetMonData - strh r0, [r6] - adds r1, r4, 0 - adds r1, 0x11 - adds r0, r5, 0 - bl GetMonData - mov r2, r8 - adds r1, r2, r4 - strb r0, [r1] - adds r6, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - bls _081C01AA - adds r0, r5, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1] - b _081C0322 -_081C01DC: - ldr r1, [r7] - ldr r0, =gPlayerParty - cmp r1, r0 - beq _081C01F8 - ldr r2, =0x000040bc - adds r0, r7, r2 - ldrb r0, [r0] - cmp r0, 0x2 - beq _081C01F8 - ldr r1, =0x000040ef - adds r0, r7, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C0254 -_081C01F8: - adds r0, r5, 0 - bl GetNature - adds r1, r6, 0 - adds r1, 0x33 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - strh r0, [r6, 0x20] - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r6, 0x22] - adds r0, r5, 0 - movs r1, 0x3B - bl GetMonData - strh r0, [r6, 0x24] - adds r0, r5, 0 - movs r1, 0x3C - bl GetMonData - strh r0, [r6, 0x26] - adds r0, r5, 0 - movs r1, 0x3E - bl GetMonData - strh r0, [r6, 0x28] - adds r0, r5, 0 - movs r1, 0x3F - bl GetMonData - strh r0, [r6, 0x2A] - adds r0, r5, 0 - movs r1, 0x3D - b _081C02A0 - .pool -_081C0254: - adds r0, r5, 0 - bl GetNature - adds r1, r7, 0 - adds r1, 0xA3 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - strh r0, [r6, 0x20] - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r6, 0x22] - adds r0, r5, 0 - movs r1, 0x54 - bl GetMonData - strh r0, [r6, 0x24] - adds r0, r5, 0 - movs r1, 0x55 - bl GetMonData - strh r0, [r6, 0x26] - adds r0, r5, 0 - movs r1, 0x57 - bl GetMonData - strh r0, [r6, 0x28] - adds r0, r5, 0 - movs r1, 0x58 - bl GetMonData - strh r0, [r6, 0x2A] - adds r0, r5, 0 - movs r1, 0x56 -_081C02A0: - bl GetMonData - strh r0, [r6, 0x2C] - b _081C0322 -_081C02A8: - adds r4, r7, 0 - adds r4, 0xA6 - adds r0, r5, 0 - movs r1, 0x7 - adds r2, r4, 0 - bl GetMonData - adds r0, r5, 0 - movs r1, 0x3 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl ConvertInternationalString - adds r0, r5, 0 - bl sub_81B205C - strb r0, [r6, 0x7] - adds r0, r5, 0 - movs r1, 0x31 - bl GetMonData - adds r1, r7, 0 - adds r1, 0xA2 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x1 - bl GetMonData - str r0, [r6, 0x48] - adds r0, r5, 0 - movs r1, 0x23 - bl GetMonData - strb r0, [r6, 0x9] - adds r0, r5, 0 - movs r1, 0x24 - bl GetMonData - strb r0, [r6, 0xA] - adds r0, r5, 0 - movs r1, 0x25 - bl GetMonData - strb r0, [r6, 0xB] - adds r0, r5, 0 - movs r1, 0x20 - bl GetMonData - strh r0, [r6, 0x30] - b _081C0322 -_081C0314: - adds r0, r5, 0 - movs r1, 0x52 - bl GetMonData - strb r0, [r6, 0x6] - movs r0, 0x1 - b _081C0332 -_081C0322: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0 -_081C0332: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C00F0 - - thumb_func_start sub_81C0348 -sub_81C0348: @ 81C0348 - push {r4-r6,lr} - ldr r6, =gUnknown_0203CF1C - ldr r2, [r6] - ldr r1, =0x000040c0 - adds r0, r2, r1 - ldrb r0, [r0] - subs r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _081C037C - movs r0, 0 - movs r1, 0xFF - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0xFF - movs r2, 0 - bl sub_81C1EFC - b _081C03D8 - .pool -_081C037C: - ldr r1, =0x000040c6 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r1, 1 - adds r0, r2, 0 - adds r0, 0x84 - adds r0, r1 - ldrh r0, [r0] - bl sub_81C240C - ldr r0, [r6] - ldr r5, =0x000020bc - adds r0, r5 - movs r1, 0x3 - movs r2, 0 - bl sub_81C2194 - ldr r0, [r6] - ldr r4, =0x000030bc - adds r0, r4 - movs r1, 0x1 - movs r2, 0 - bl sub_81C2194 - ldr r1, [r6] - adds r1, r4 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r6] - adds r1, r5 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r1, 0x80 - lsls r1, 9 - movs r0, 0x2 - movs r2, 0x1 - bl ChangeBgX - movs r0, 0x13 - bl ClearWindowTilemap - movs r0, 0xD - bl ClearWindowTilemap -_081C03D8: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x77 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0400 - movs r0, 0 - movs r1, 0xFF - bl sub_81C2074 - b _081C0416 - .pool -_081C0400: - ldr r2, =0x000040c0 - adds r0, r1, r2 - ldrb r0, [r0] - subs r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _081C0416 - movs r0, 0xD - bl PutWindowTilemap -_081C0416: - bl sub_81C2524 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C2228 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0348 - - thumb_func_start sub_81C0434 -sub_81C0434: @ 81C0434 - push {lr} - bl FreeAllWindowBuffers - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0434 - - thumb_func_start sub_81C044C -sub_81C044C: @ 81C044C - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C0484 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C044C - - thumb_func_start sub_81C0484 -sub_81C0484: @ 81C0484 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C04EC - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081C04EC - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r0, [r0, 0x4] - bl SetMainCallback2 - ldr r1, =gUnknown_0203CF20 - ldr r0, [r4] - ldr r2, =0x000040be - adds r0, r2 - ldrb r0, [r0] - strb r0, [r1] - bl sub_81C4898 - bl ResetSpriteData - bl FreeAllSpritePalettes - bl StopCryAndClearCrySongs - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - ldr r0, =gMonSpritesGfxPtr - ldr r0, [r0] - cmp r0, 0 - bne _081C04E2 - movs r0, 0 - bl sub_806F47C -_081C04E2: - bl sub_81C0434 - adds r0, r5, 0 - bl DestroyTask -_081C04EC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0484 - - thumb_func_start sub_81C0510 -sub_81C0510: @ 81C0510 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C05FE - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _081C05FE - ldr r5, =gMain - ldrh r1, [r5, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C0550 - movs r1, 0x1 - negs r1, r1 - adds r0, r4, 0 - bl sub_81C0604 - b _081C05FE - .pool -_081C0550: - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _081C0562 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C0604 - b _081C05FE -_081C0562: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081C0576 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C0582 -_081C0576: - movs r1, 0x1 - negs r1, r1 - adds r0, r4, 0 - bl sub_81C0A8C - b _081C05FE -_081C0582: - ldrh r1, [r5, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081C0598 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081C05A2 -_081C0598: - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C0A8C - b _081C05FE -_081C05A2: - ldrh r1, [r5, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C05E6 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C05FE - cmp r0, 0 - bne _081C05D8 - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81C044C - b _081C05FE - .pool -_081C05D8: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81C0E48 - b _081C05FE -_081C05E6: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C05FE - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81C044C -_081C05FE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C0510 - - thumb_func_start sub_81C0604 -sub_81C0604: @ 81C0604 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - adds r4, r5, 0 - ldr r1, =gUnknown_0203CF1C - ldr r3, [r1] - ldr r2, =0x000040c3 - adds r0, r3, r2 - ldrb r0, [r0] - adds r6, r1, 0 - cmp r0, 0 - bne _081C06EE - ldr r1, =0x000040bd - adds r0, r3, r1 - ldrb r2, [r0] - cmp r2, 0x1 - bne _081C0678 - adds r1, 0x3 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081C0654 - lsls r1, r5, 24 - asrs r1, 24 - movs r4, 0x2 - eors r1, r2 - negs r0, r1 - orrs r0, r1 - asrs r0, 31 - ands r4, r0 - b _081C065C - .pool -_081C0654: - movs r4, 0x3 - cmp r5, 0x1 - bne _081C065C - movs r4, 0x1 -_081C065C: - ldr r2, [r6] - ldr r0, [r2] - ldr r3, =0x000040be - adds r1, r2, r3 - ldrb r1, [r1] - adds r3, 0x1 - adds r2, r3 - ldrb r2, [r2] - adds r3, r4, 0 - bl sub_80D214C - b _081C0696 - .pool -_081C0678: - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C068E - lsls r0, r5, 24 - asrs r0, 24 - bl sub_81C09B4 - b _081C0696 -_081C068E: - lsls r0, r4, 24 - asrs r0, 24 - bl sub_81C08F8 -_081C0696: - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _081C06EE - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - adds r0, 0x77 - ldrb r0, [r0] - cmp r0, 0 - beq _081C06D4 - movs r0, 0x2 - movs r1, 0x1 - bl sub_81C4204 - movs r0, 0xD - bl ClearWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0 - movs r1, 0x2 - bl sub_81C2074 -_081C06D4: - ldr r0, [r5] - ldr r1, =0x000040be - adds r0, r1 - movs r2, 0 - strb r4, [r0] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0x8] - ldr r1, =sub_81C0704 - str r1, [r0] -_081C06EE: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0604 - - thumb_func_start sub_81C0704 -sub_81C0704: @ 81C0704 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r4, r1, 3 - ldr r6, =gTasks + 0x8 - adds r5, r4, r6 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0xC - bls _081C071E - b _081C08BC -_081C071E: - lsls r0, 2 - ldr r1, =_081C0730 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C0730: - .4byte _081C0764 - .4byte _081C076A - .4byte _081C0780 - .4byte _081C07A8 - .4byte _081C07C8 - .4byte _081C07E0 - .4byte _081C07F0 - .4byte _081C0800 - .4byte _081C0828 - .4byte _081C086C - .4byte _081C0872 - .4byte _081C0878 - .4byte _081C0894 -_081C0764: - bl StopCryAndClearCrySongs - b _081C08EC -_081C076A: - bl sub_81C4898 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d3 - b _081C0786 - .pool -_081C0780: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d4 -_081C0786: - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySpriteAndFreeResources - b _081C08EC - .pool -_081C07A8: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0xC - bl sub_81C0098 - ldr r0, [r4] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081C08EC - .pool -_081C07C8: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C00F0 - lsls r0, 24 - cmp r0, 0 - bne _081C07DA - b _081C08F2 -_081C07DA: - b _081C08EC - .pool -_081C07E0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C49E0 - b _081C08EC - .pool -_081C07F0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C4A08 - b _081C08EC - .pool -_081C0800: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x77 - ldrb r0, [r0] - cmp r0, 0 - beq _081C0816 - movs r1, 0x2 - negs r1, r1 - movs r0, 0xA - bl sub_81C2074 -_081C0816: - ldr r0, [r4] - adds r0, 0xC - bl sub_81C2228 - movs r0, 0 - strh r0, [r5, 0x2] - b _081C08EC - .pool -_081C0828: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0xC - adds r1, r5, 0x2 - bl sub_81C45F4 - ldr r1, [r4] - ldr r2, =0x000040d3 - adds r1, r2 - strb r0, [r1] - ldr r0, [r4] - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081C08F2 - ldr r2, =gSprites - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strh r1, [r0, 0x32] - bl sub_81C0E24 - movs r0, 0 - strh r0, [r5, 0x2] - b _081C08EC - .pool -_081C086C: - bl sub_81C4280 - b _081C08EC -_081C0872: - bl sub_81C25E8 - b _081C08EC -_081C0878: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2D9C - bl sub_81C2524 - b _081C08EC - .pool -_081C0894: - ldr r2, =gSprites - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d3 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x32] - b _081C08EC - .pool -_081C08BC: - bl sub_81221EC - lsls r0, 24 - cmp r0, 0 - bne _081C08F2 - ldr r0, =sub_81C20F0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081C08F2 - strh r0, [r5] - adds r0, r6, 0 - subs r0, 0x8 - adds r0, r4, r0 - ldr r1, =sub_81C0510 - str r1, [r0] - b _081C08F2 - .pool -_081C08EC: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_081C08F2: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C0704 - - thumb_func_start sub_81C08F8 -sub_81C08F8: @ 81C08F8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gUnknown_0203CF1C - ldr r2, [r1] - ldr r7, [r2] - ldr r3, =0x000040c0 - adds r0, r2, r3 - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0 - bne _081C0960 - lsls r0, r4, 24 - asrs r3, r0, 24 - movs r1, 0x1 - negs r1, r1 - adds r6, r0, 0 - cmp r3, r1 - bne _081C0928 - ldr r1, =0x000040be - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081C0988 -_081C0928: - asrs r0, r6, 24 - cmp r0, 0x1 - bne _081C0940 - ldr r0, [r5] - ldr r2, =0x000040be - adds r1, r0, r2 - ldr r3, =0x000040bf - adds r0, r3 - ldrb r1, [r1] - ldrb r0, [r0] - cmp r1, r0 - bcs _081C0988 -_081C0940: - ldr r0, [r5] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - adds r0, r4 - lsls r0, 24 - asrs r0, 24 - b _081C09AE - .pool -_081C0960: - ldr r3, =0x000040be - adds r0, r2, r3 - ldrb r5, [r0] - lsls r6, r4, 24 -_081C0968: - lsls r0, r5, 24 - asrs r0, 24 - asrs r1, r6, 24 - adds r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - asrs r4, r0, 24 - cmp r4, 0 - blt _081C0988 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bf - adds r0, r1 - ldrb r0, [r0] - cmp r4, r0 - ble _081C099C -_081C0988: - movs r0, 0x1 - negs r0, r0 - b _081C09AE - .pool -_081C099C: - movs r0, 0x64 - muls r0, r4 - adds r0, r7, r0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081C0968 - adds r0, r4, 0 -_081C09AE: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81C08F8 - - thumb_func_start sub_81C09B4 -sub_81C09B4: @ 81C09B4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - ldr r6, =gUnknown_0203CF1C - ldr r0, [r6] - ldr r1, [r0] - mov r8, r1 - movs r5, 0 - movs r2, 0 - ldr r3, =gUnknown_0861CC1C - movs r1, 0 - ldrsb r1, [r3, r1] - ldr r4, =0x000040be - adds r0, r4 - ldrb r0, [r0] - cmp r1, r0 - beq _081C09FC - adds r7, r3, 0 - adds r3, r4, 0 -_081C09E0: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x5 - bhi _081C09FC - adds r0, r2, r7 - movs r1, 0 - ldrsb r1, [r0, r1] - ldr r0, [r6] - adds r0, r3 - ldrb r0, [r0] - cmp r1, r0 - bne _081C09E0 - adds r5, r2, 0 -_081C09FC: - mov r0, r12 - lsls r6, r0, 24 - ldr r7, =gUnknown_0861CC1C -_081C0A02: - lsls r0, r5, 24 - asrs r0, 24 - asrs r1, r6, 24 - adds r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, r5, 24 - lsrs r0, r1, 24 - cmp r0, 0x5 - bhi _081C0A40 - asrs r0, r1, 24 - adds r0, r7 - movs r4, 0 - ldrsb r4, [r0, r4] - movs r0, 0x64 - muls r0, r4 - add r0, r8 - bl sub_81C0A50 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C0A02 - adds r0, r4, 0 - b _081C0A44 - .pool -_081C0A40: - movs r0, 0x1 - negs r0, r0 -_081C0A44: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81C09B4 - - thumb_func_start sub_81C0A50 -sub_81C0A50: @ 81C0A50 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081C0A84 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0A78 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081C0A84 -_081C0A78: - movs r0, 0x1 - b _081C0A86 - .pool -_081C0A84: - movs r0, 0 -_081C0A86: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81C0A50 - - thumb_func_start sub_81C0A8C -sub_81C0A8C: @ 81C0A8C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - str r6, [sp] - lsls r1, 24 - lsrs r3, r1, 24 - str r3, [sp, 0x4] - ldr r0, =gUnknown_0203CF1C - mov r8, r0 - ldr r2, [r0] - adds r1, r2, 0 - adds r1, 0x70 - lsls r0, r6, 2 - adds r0, r6 - lsls r7, r0, 3 - ldr r0, =gTasks + 0x8 - mov r9, r0 - adds r0, r7, r0 - str r0, [sp, 0x8] - ldrb r1, [r1, 0x4] - mov r10, r1 - cmp r1, 0 - bne _081C0B6E - lsls r0, r3, 24 - asrs r5, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _081C0AE0 - ldr r1, =0x000040c0 - adds r0, r2, r1 - ldr r3, =0x000040c1 - adds r1, r2, r3 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _081C0B6E -_081C0AE0: - cmp r5, 0x1 - bne _081C0AF4 - ldr r1, =0x000040c0 - adds r0, r2, r1 - ldr r3, =0x000040c2 - adds r1, r2, r3 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _081C0B6E -_081C0AF4: - movs r0, 0x5 - bl PlaySE - mov r1, r8 - ldr r0, [r1] - ldr r4, =0x000040c0 - adds r0, r4 - ldrb r0, [r0] - bl sub_81C2C38 - mov r2, r8 - ldr r1, [r2] - adds r1, r4 - ldrb r0, [r1] - ldr r3, [sp, 0x4] - adds r0, r3 - strb r0, [r1] - mov r1, r10 - ldr r0, [sp, 0x8] - strh r1, [r0] - cmp r5, 0x1 - bne _081C0B4C - ldr r1, =sub_81C0B8C - mov r0, r9 - subs r0, 0x8 - adds r0, r7, r0 - ldr r2, [r0] - adds r0, r6, 0 - bl SetTaskFuncWithFollowupFunc - b _081C0B5C - .pool -_081C0B4C: - ldr r1, =sub_81C0CC4 - mov r0, r9 - subs r0, 0x8 - adds r0, r7, r0 - ldr r2, [r0] - ldr r0, [sp] - bl SetTaskFuncWithFollowupFunc -_081C0B5C: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x000040c0 - adds r0, r2 - ldrb r0, [r0] - bl sub_81C2DE4 - bl sub_81C424C -_081C0B6E: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0A8C - - thumb_func_start sub_81C0B8C -sub_81C0B8C: @ 81C0B8C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081C0C2A - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r3, =0x000040c9 - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0BE0 - movs r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - b _081C0BFE - .pool -_081C0BE0: - movs r0, 0x2 - strh r0, [r4, 0x2] - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081C0BFE: - ldrb r0, [r4, 0x2] - movs r1, 0 - movs r2, 0 - bl ChangeBgX - ldrb r0, [r4, 0x2] - ldr r1, =gUnknown_0203CF1C - ldr r1, [r1] - ldr r3, =0x000040c0 - adds r2, r1, r3 - ldrb r2, [r2] - lsls r2, 12 - adds r2, 0xBC - adds r1, r2 - bl SetBgTilemapBuffer - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg -_081C0C2A: - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 6 - movs r2, 0x1 - bl ChangeBgX - ldrh r0, [r4] - adds r0, 0x20 - strh r0, [r4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _081C0C52 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81C0C68 - str r0, [r1] -_081C0C52: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0B8C - - thumb_func_start sub_81C0C68 -sub_81C0C68: @ 81C0C68 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 3 - ldr r0, =gTasks + 0x8 - adds r2, r0 - ldr r5, =gUnknown_0203CF1C - ldr r3, [r5] - ldr r0, =0x000040c9 - adds r3, r0 - ldrb r0, [r3] - movs r1, 0x1 - eors r0, r1 - movs r1, 0 - strb r0, [r3] - strh r1, [r2, 0x2] - strh r1, [r2] - bl sub_81C1BA0 - ldr r0, [r5] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2AFC - bl sub_81C4280 - bl sub_81C0E24 - adds r0, r4, 0 - bl SwitchTaskToFollowupFunc - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0C68 - - thumb_func_start sub_81C0CC4 -sub_81C0CC4: @ 81C0CC4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081C0D0C - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c9 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0CFC - movs r0, 0x2 - b _081C0CFE - .pool -_081C0CFC: - movs r0, 0x1 -_081C0CFE: - strh r0, [r4, 0x2] - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 9 - movs r2, 0 - bl ChangeBgX -_081C0D0C: - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 6 - movs r2, 0x2 - bl ChangeBgX - ldrh r0, [r4] - adds r0, 0x20 - strh r0, [r4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _081C0D34 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81C0D44 - str r0, [r1] -_081C0D34: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0CC4 - - thumb_func_start sub_81C0D44 -sub_81C0D44: @ 81C0D44 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c9 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0D8C - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - b _081C0DA6 - .pool -_081C0D8C: - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram -_081C0DA6: - ldr r6, =gUnknown_0203CF1C - ldr r2, [r6] - ldr r7, =0x000040c0 - adds r1, r2, r7 - ldrb r0, [r1] - cmp r0, 0x1 - bls _081C0DD0 - ldrb r0, [r4, 0x2] - ldrb r1, [r1] - lsls r1, 12 - ldr r3, =0xfffff0bc - adds r1, r3 - adds r1, r2, r1 - bl SetBgTilemapBuffer - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 9 - movs r2, 0 - bl ChangeBgX -_081C0DD0: - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - ldr r2, [r6] - ldr r0, =0x000040c9 - adds r2, r0 - ldrb r0, [r2] - movs r1, 0x1 - eors r0, r1 - movs r1, 0 - strb r0, [r2] - strh r1, [r4, 0x2] - strh r1, [r4] - bl sub_81C1BA0 - ldr r0, [r6] - adds r0, r7 - ldrb r0, [r0] - bl sub_81C2AFC - bl sub_81C4280 - bl sub_81C0E24 - adds r0, r5, 0 - bl SwitchTaskToFollowupFunc - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0D44 - - thumb_func_start sub_81C0E24 -sub_81C0E24: @ 81C0E24 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040c0 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C0E3C - adds r0, r1, 0 - adds r0, 0xC - bl sub_81C22CC -_081C0E3C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0E24 - - thumb_func_start sub_81C0E48 -sub_81C0E48: @ 81C0E48 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - ldr r2, =0x000040c6 - adds r0, r2 - movs r1, 0 - strb r1, [r0] - ldr r1, [r5] - adds r2, r1, r2 - ldrb r0, [r2] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r6, [r1] - mov r8, r6 - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, [r5] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C0E96 - movs r0, 0xD - bl ClearWindowTilemap -_081C0E96: - movs r4, 0x3 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r6, 0 - bl sub_81C1EFC - ldr r0, [r5] - ldr r1, =0x000040c8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0EC4 - movs r0, 0x5 - bl ClearWindowTilemap - movs r0, 0x6 - bl PutWindowTilemap -_081C0EC4: - ldr r0, [r5] - ldr r1, =0x000020bc - adds r0, r1 - movs r1, 0x3 - movs r2, 0 - bl sub_81C2194 - ldr r0, [r5] - ldr r1, =0x000030bc - adds r0, r1 - movs r1, 0x1 - movs r2, 0 - bl sub_81C2194 - mov r0, r8 - bl sub_81C3E9C - bl sub_81C3F44 - bl sub_81C44F0 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x8 - bl sub_81C4AF8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C0F44 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0E48 - - thumb_func_start sub_81C0F44 -sub_81C0F44: @ 81C0F44 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C103A - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C0F98 - movs r0, 0x4 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - b _081C103A - .pool -_081C0F98: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081C0FC0 - movs r0, 0x4 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - b _081C103A - .pool -_081C0FC0: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C1026 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040c8 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C0FE8 - subs r2, 0x4 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - bne _081C1004 -_081C0FE8: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81C11F4 - b _081C103A - .pool -_081C1004: - bl sub_81C1040 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C101E - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81C129C - b _081C103A -_081C101E: - movs r0, 0x20 - bl PlaySE - b _081C103A -_081C1026: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C103A - movs r0, 0x5 - bl PlaySE - adds r0, r6, 0 - bl sub_81C11F4 -_081C103A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C0F44 - - thumb_func_start sub_81C1040 -sub_81C1040: @ 81C1040 - push {lr} - movs r1, 0x1 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r2, r0, 0 - adds r2, 0x84 -_081C104C: - lsls r0, r1, 1 - adds r0, r2, r0 - ldrh r0, [r0] - cmp r0, 0 - beq _081C1060 - movs r0, 0x1 - b _081C106C - .pool -_081C1060: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _081C104C - movs r0, 0 -_081C106C: - pop {r1} - bx r1 - thumb_func_end sub_81C1040 - - thumb_func_start sub_81C1070 -sub_81C1070: @ 81C1070 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - adds r4, r1, 0 - mov r8, r2 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - mov r0, r8 - ldrb r6, [r0] - movs r2, 0 - lsls r4, 24 - asrs r4, 24 - mov r12, r4 - movs r1, 0 - ldrsh r4, [r7, r1] - ldrb r0, [r7] - lsls r3, r0, 24 -_081C109C: - lsls r0, r6, 24 - asrs r0, 24 - add r0, r12 - lsls r0, 24 - lsrs r6, r0, 24 - asrs r0, 24 - cmp r0, r4 - ble _081C10B0 - movs r6, 0 - b _081C10B6 -_081C10B0: - cmp r0, 0 - bge _081C10B6 - lsrs r6, r3, 24 -_081C10B6: - lsls r0, r6, 24 - asrs r1, r0, 24 - mov r9, r0 - cmp r1, 0x4 - bne _081C10C2 - b _081C11CC -_081C10C2: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - lsls r1, 1 - adds r0, 0x84 - adds r0, r1 - ldrh r5, [r0] - cmp r5, 0 - bne _081C10E2 - lsls r0, r2, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, 0x3 - ble _081C109C -_081C10E2: - adds r0, r5, 0 - bl sub_81C240C - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r5, 0 - bl sub_81C3E9C - mov r1, r8 - ldrb r0, [r1] - cmp r0, 0x4 - bne _081C1110 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _081C1118 -_081C1110: - movs r1, 0x2 - ldrsh r0, [r7, r1] - cmp r0, 0x1 - bne _081C115E -_081C1118: - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1142 - movs r0, 0xD - bl ClearWindowTilemap -_081C1142: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r4, 0x3 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81C1EFC -_081C115E: - mov r1, r8 - ldrb r0, [r1] - cmp r0, 0x4 - beq _081C11A0 - mov r1, r9 - asrs r0, r1, 24 - cmp r0, 0x4 - bne _081C11A0 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - bne _081C11A0 - movs r0, 0xE - bl ClearWindowTilemap - movs r0, 0xF - bl ClearWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0 - movs r1, 0x3 - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0x3 - movs r2, 0 - bl sub_81C1EFC -_081C11A0: - mov r0, r8 - strb r6, [r0] - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c6 - adds r0, r1 - cmp r8, r0 - bne _081C11E0 - movs r0, 0x8 - bl sub_81C4D18 - b _081C11E6 - .pool -_081C11CC: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - ldrh r5, [r0] - b _081C10E2 - .pool -_081C11E0: - movs r0, 0x12 - bl sub_81C4D18 -_081C11E6: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C1070 - - thumb_func_start sub_81C11F4 -sub_81C11F4: @ 81C11F4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x8 - bl sub_81C4C60 - movs r0, 0x6 - bl ClearWindowTilemap - movs r0, 0x5 - bl PutWindowTilemap - movs r0, 0 - bl sub_81C3E9C - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000020bc - adds r0, r1 - movs r1, 0x3 - movs r2, 0x1 - bl sub_81C2194 - ldr r0, [r4] - ldr r1, =0x000030bc - adds r0, r1 - movs r1, 0x1 - movs r2, 0x1 - bl sub_81C2194 - bl sub_81C4064 - ldr r0, [r4] - ldr r1, =0x000040c6 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x4 - beq _081C125E - movs r0, 0xE - bl ClearWindowTilemap - movs r0, 0xF - bl ClearWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0x3 - movs r2, 0 - bl sub_81C1EFC -_081C125E: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81C0510 - str r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C11F4 - - thumb_func_start sub_81C129C -sub_81C129C: @ 81C129C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x000040c6 - adds r1, r0, r2 - ldrb r1, [r1] - adds r2, 0x1 - adds r0, r2 - strb r1, [r0] - movs r0, 0x1 - bl sub_81C4C84 - movs r0, 0x12 - bl sub_81C4AF8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C12E4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C129C - - thumb_func_start sub_81C12E4 -sub_81C12E4: @ 81C12E4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C13AA - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C1338 - movs r0, 0x3 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c7 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - b _081C13AA - .pool -_081C1338: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081C1360 - movs r0, 0x3 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c7 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - b _081C13AA - .pool -_081C1360: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C139A - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x000040c6 - adds r1, r0, r2 - adds r2, 0x1 - adds r0, r2 - ldrb r1, [r1] - ldrb r0, [r0] - cmp r1, r0 - bne _081C1390 - adds r0, r5, 0 - movs r1, 0 - bl sub_81C13B0 - b _081C13AA - .pool -_081C1390: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81C13B0 - b _081C13AA -_081C139A: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C13AA - adds r0, r6, 0 - movs r1, 0 - bl sub_81C13B0 -_081C13AA: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C12E4 - - thumb_func_start sub_81C13B0 -sub_81C13B0: @ 81C13B0 - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl sub_81C4C84 - movs r0, 0x12 - bl sub_81C4C60 - cmp r4, 0x1 - bne _081C1464 - ldr r0, =gUnknown_0203CF1C - ldr r3, [r0] - ldr r1, =0x000040bd - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C1410 - ldr r0, [r3] - ldr r2, =0x000040be - adds r1, r3, r2 - ldrb r2, [r1] - movs r1, 0x64 - muls r1, r2 - adds r0, r1 - ldr r4, =0x000040c6 - adds r1, r3, r4 - ldrb r1, [r1] - adds r4, 0x1 - adds r2, r3, r4 - ldrb r2, [r2] - bl sub_81C14BC - b _081C1430 - .pool -_081C1410: - ldr r0, [r3] - ldr r2, =0x000040be - adds r1, r3, r2 - ldrb r2, [r1] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 4 - adds r0, r1 - ldr r4, =0x000040c6 - adds r1, r3, r4 - ldrb r1, [r1] - adds r4, 0x1 - adds r2, r3, r4 - ldrb r2, [r2] - bl sub_81C15EC -_081C1430: - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - adds r0, 0xC - bl sub_81C0098 - ldr r1, [r5] - ldr r6, =0x000040c6 - adds r0, r1, r6 - ldrb r0, [r0] - ldr r4, =0x000040c7 - adds r1, r4 - ldrb r1, [r1] - bl sub_81C40A0 - ldr r1, [r5] - adds r0, r1, r6 - ldrb r0, [r0] - adds r1, r4 - ldrb r1, [r1] - bl sub_81C4568 - ldr r0, [r5] - adds r4, r0, r4 - ldrb r1, [r4] - adds r0, r6 - strb r1, [r0] -_081C1464: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r4, [r1] - adds r0, r4, 0 - bl sub_81C3E9C - adds r0, r4, 0 - bl sub_81C240C - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C0F44 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C13B0 - - thumb_func_start sub_81C14BC -sub_81C14BC: @ 81C14BC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - adds r7, r0, 0 - adds r4, r1, 0 - adds r6, r2, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - lsls r0, r4, 1 - mov r10, r0 - adds r1, r2, 0 - adds r1, 0x84 - adds r0, r1, r0 - str r0, [sp, 0x8] - ldrh r0, [r0] - mov r3, sp - adds r3, 0x2 - str r3, [sp, 0x1C] - strh r0, [r3] - lsls r0, r6, 1 - mov r9, r0 - add r1, r9 - str r1, [sp, 0xC] - ldrh r1, [r1] - mov r0, sp - strh r1, [r0] - adds r1, r2, 0 - adds r1, 0x8C - adds r3, r1, r4 - str r3, [sp, 0x10] - ldrb r0, [r3] - mov r3, sp - adds r3, 0x5 - str r3, [sp, 0x24] - strb r0, [r3] - adds r1, r6 - str r1, [sp, 0x14] - ldrb r0, [r1] - mov r1, sp - adds r1, 0x4 - str r1, [sp, 0x20] - strb r0, [r1] - adds r2, 0xA4 - str r2, [sp, 0x18] - ldrb r0, [r2] - mov r5, sp - adds r5, 0x6 - strb r0, [r5] - ldr r1, =gUnknown_08329D22 - adds r0, r4, r1 - ldrb r0, [r0] - mov r8, r0 - ldrb r0, [r5] - adds r2, r0, 0 - mov r3, r8 - ands r2, r3 - mov r3, r10 - asrs r2, r3 - lsls r2, 24 - lsrs r2, 24 - adds r1, r6, r1 - ldrb r1, [r1] - mov r12, r1 - adds r1, r0, 0 - mov r3, r12 - ands r1, r3 - mov r3, r9 - asrs r1, r3 - lsls r1, 24 - lsrs r1, 24 - mov r3, r8 - bics r0, r3 - strb r0, [r5] - ldrb r0, [r5] - mov r3, r12 - bics r0, r3 - strb r0, [r5] - mov r0, r9 - lsls r2, r0 - mov r3, r10 - lsls r1, r3 - adds r2, r1 - ldrb r0, [r5] - orrs r0, r2 - strb r0, [r5] - adds r1, r4, 0 - adds r1, 0xD - adds r0, r7, 0 - mov r2, sp - bl SetMonData - adds r1, r6, 0 - adds r1, 0xD - adds r0, r7, 0 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r4, 0x11 - adds r0, r7, 0 - adds r1, r4, 0 - ldr r2, [sp, 0x20] - bl SetMonData - adds r6, 0x11 - adds r0, r7, 0 - adds r1, r6, 0 - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x15 - adds r2, r5, 0 - bl SetMonData - mov r0, sp - ldrh r0, [r0] - ldr r1, [sp, 0x8] - strh r0, [r1] - ldr r3, [sp, 0x1C] - ldrh r0, [r3] - ldr r1, [sp, 0xC] - strh r0, [r1] - ldr r3, [sp, 0x20] - ldrb r0, [r3] - ldr r1, [sp, 0x10] - strb r0, [r1] - ldr r3, [sp, 0x24] - ldrb r0, [r3] - ldr r1, [sp, 0x14] - strb r0, [r1] - ldrb r0, [r5] - ldr r3, [sp, 0x18] - strb r0, [r3] - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C14BC - - thumb_func_start sub_81C15EC -sub_81C15EC: @ 81C15EC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - adds r7, r0, 0 - adds r4, r1, 0 - adds r6, r2, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - lsls r0, r4, 1 - mov r10, r0 - adds r1, r2, 0 - adds r1, 0x84 - adds r0, r1, r0 - str r0, [sp, 0x8] - ldrh r0, [r0] - mov r3, sp - adds r3, 0x2 - str r3, [sp, 0x1C] - strh r0, [r3] - lsls r0, r6, 1 - mov r9, r0 - add r1, r9 - str r1, [sp, 0xC] - ldrh r1, [r1] - mov r0, sp - strh r1, [r0] - adds r1, r2, 0 - adds r1, 0x8C - adds r3, r1, r4 - str r3, [sp, 0x10] - ldrb r0, [r3] - mov r3, sp - adds r3, 0x5 - str r3, [sp, 0x24] - strb r0, [r3] - adds r1, r6 - str r1, [sp, 0x14] - ldrb r0, [r1] - mov r1, sp - adds r1, 0x4 - str r1, [sp, 0x20] - strb r0, [r1] - adds r2, 0xA4 - str r2, [sp, 0x18] - ldrb r0, [r2] - mov r5, sp - adds r5, 0x6 - strb r0, [r5] - ldr r1, =gUnknown_08329D22 - adds r0, r4, r1 - ldrb r0, [r0] - mov r8, r0 - ldrb r0, [r5] - adds r2, r0, 0 - mov r3, r8 - ands r2, r3 - mov r3, r10 - asrs r2, r3 - lsls r2, 24 - lsrs r2, 24 - adds r1, r6, r1 - ldrb r1, [r1] - mov r12, r1 - adds r1, r0, 0 - mov r3, r12 - ands r1, r3 - mov r3, r9 - asrs r1, r3 - lsls r1, 24 - lsrs r1, 24 - mov r3, r8 - bics r0, r3 - strb r0, [r5] - ldrb r0, [r5] - mov r3, r12 - bics r0, r3 - strb r0, [r5] - mov r0, r9 - lsls r2, r0 - mov r3, r10 - lsls r1, r3 - adds r2, r1 - ldrb r0, [r5] - orrs r0, r2 - strb r0, [r5] - adds r1, r4, 0 - adds r1, 0xD - adds r0, r7, 0 - mov r2, sp - bl SetBoxMonData - adds r1, r6, 0 - adds r1, 0xD - adds r0, r7, 0 - ldr r2, [sp, 0x1C] - bl SetBoxMonData - adds r4, 0x11 - adds r0, r7, 0 - adds r1, r4, 0 - ldr r2, [sp, 0x20] - bl SetBoxMonData - adds r6, 0x11 - adds r0, r7, 0 - adds r1, r6, 0 - ldr r2, [sp, 0x24] - bl SetBoxMonData - adds r0, r7, 0 - movs r1, 0x15 - adds r2, r5, 0 - bl SetBoxMonData - mov r0, sp - ldrh r0, [r0] - ldr r1, [sp, 0x8] - strh r0, [r1] - ldr r3, [sp, 0x1C] - ldrh r0, [r3] - ldr r1, [sp, 0xC] - strh r0, [r1] - ldr r3, [sp, 0x20] - ldrb r0, [r3] - ldr r1, [sp, 0x10] - strb r0, [r1] - ldr r3, [sp, 0x24] - ldrb r0, [r3] - ldr r1, [sp, 0x14] - strb r0, [r1] - ldrb r0, [r5] - ldr r3, [sp, 0x18] - strb r0, [r3] - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C15EC - - thumb_func_start sub_81C171C -sub_81C171C: @ 81C171C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_81C44F0 - movs r0, 0x8 - bl sub_81C4AF8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C174C - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C171C - - thumb_func_start sub_81C174C -sub_81C174C: @ 81C174C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C176A - b _081C189A -_081C176A: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _081C177A - b _081C189A -_081C177A: - ldr r6, =gMain - ldrh r1, [r6, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C17B4 - movs r0, 0x4 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - b _081C189A - .pool -_081C17B4: - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _081C17DC - movs r0, 0x4 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r1, =0x000040c6 - adds r2, r1 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - b _081C189A - .pool -_081C17DC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081C17F0 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C17FC -_081C17F0: - movs r1, 0x1 - negs r1, r1 - adds r0, r5, 0 - bl sub_81C0A8C - b _081C189A -_081C17FC: - ldrh r1, [r6, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081C1812 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081C181C -_081C1812: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81C0A8C - b _081C189A -_081C181C: - ldrh r1, [r6, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C1876 - bl sub_81C18A8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C1868 - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - ldr r2, =gUnknown_0203CF21 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c6 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r1, =gSpecialVar_0x8005 - ldrb r0, [r2] - strh r0, [r1] - adds r0, r5, 0 - bl sub_81C044C - b _081C189A - .pool -_081C1868: - movs r0, 0x20 - bl PlaySE - adds r0, r5, 0 - bl sub_81C18F4 - b _081C189A -_081C1876: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C189A - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - ldr r1, =gUnknown_0203CF21 - movs r0, 0x4 - strb r0, [r1] - ldr r1, =gSpecialVar_0x8005 - movs r0, 0x4 - strh r0, [r1] - adds r0, r5, 0 - bl sub_81C044C -_081C189A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C174C - - thumb_func_start sub_81C18A8 -sub_81C18A8: @ 81C18A8 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r1, r2, r0 - ldrb r0, [r1] - cmp r0, 0x4 - beq _081C18DA - ldr r3, =0x000040c4 - adds r0, r2, r3 - ldrh r0, [r0] - cmp r0, 0 - beq _081C18DA - ldrb r1, [r1] - lsls r1, 1 - adds r0, r2, 0 - adds r0, 0x84 - adds r0, r1 - ldrh r0, [r0] - bl sub_81B6D14 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C18EC -_081C18DA: - movs r0, 0x1 - b _081C18EE - .pool -_081C18EC: - movs r0, 0 -_081C18EE: - pop {r1} - bx r1 - thumb_func_end sub_81C18A8 - - thumb_func_start sub_81C18F4 -sub_81C18F4: @ 81C18F4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xE - bl ClearWindowTilemap - movs r0, 0xF - bl ClearWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0 - movs r1, 0x3 - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0x3 - movs r2, 0 - bl sub_81C1EFC - bl sub_81C4154 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C1940 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C18F4 - - thumb_func_start sub_81C1940 -sub_81C1940: @ 81C1940 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - mov r8, r0 - ldr r0, =gTasks + 0x8 - mov r9, r0 - mov r4, r8 - add r4, r9 - ldr r0, =sub_81C1E20 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C196C - b _081C1B74 -_081C196C: - ldr r6, =gMain - ldrh r1, [r6, 0x2E] - movs r0, 0x40 - ands r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _081C19B0 - movs r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x4 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - movs r0, 0 - strh r0, [r4, 0x2] - b _081C1B6A - .pool -_081C19B0: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081C19DC - movs r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x4 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r1, =0x000040c6 - adds r2, r1 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - strh r5, [r4, 0x2] - b _081C1B6A - .pool -_081C19DC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081C19F0 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C1A64 -_081C19F0: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r2, =0x000040c0 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0x2 - bne _081C1A00 - b _081C1B74 -_081C1A00: - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, [r4] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1A28 - movs r0, 0xD - bl ClearWindowTilemap -_081C1A28: - ldr r1, [r4] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r5, [r1] - mov r0, r9 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_81C174C - str r1, [r0] - movs r1, 0x1 - negs r1, r1 - adds r0, r7, 0 - b _081C1ACE - .pool -_081C1A64: - ldrh r1, [r6, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081C1A7A - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081C1B04 -_081C1A7A: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - beq _081C1B74 - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, [r4] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1AB0 - movs r0, 0xD - bl ClearWindowTilemap -_081C1AB0: - ldr r1, [r4] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r5, [r1] - mov r0, r9 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_81C174C - str r1, [r0] - adds r0, r7, 0 - movs r1, 0x1 -_081C1ACE: - bl sub_81C0A8C - movs r4, 0x2 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81C1EFC - b _081C1B74 - .pool -_081C1B04: - ldrh r1, [r6, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _081C1B74 - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1B38 - movs r0, 0xD - bl ClearWindowTilemap -_081C1B38: - ldr r1, [r4] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r5, [r1] - adds r0, r5, 0 - bl sub_81C3E9C - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r4, 0x3 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81C1EFC -_081C1B6A: - mov r0, r9 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_81C174C - str r1, [r0] -_081C1B74: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1940 - - thumb_func_start sub_81C1B94 -sub_81C1B94: @ 81C1B94 - ldr r0, =gUnknown_0203CF21 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_81C1B94 - - thumb_func_start sub_81C1BA0 -sub_81C1BA0: @ 81C1BA0 - push {r4-r7,lr} - sub sp, 0xC - movs r0, 0x20 - bl Alloc - adds r4, r0, 0 - movs r5, 0 -_081C1BAE: - lsls r0, r5, 25 - lsrs r1, r0, 24 - adds r6, r1, 0 - ldr r0, =gUnknown_0203CF1C - ldr r3, [r0] - ldr r2, =0x000040c1 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r5, r0 - bcs _081C1BD8 - lsls r0, r1, 1 - adds r0, r4 - movs r1, 0x40 - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x50 - b _081C1BEE - .pool -_081C1BD8: - ldr r7, =0x000040c2 - adds r0, r3, r7 - ldrb r2, [r0] - cmp r5, r2 - bls _081C1BF8 - lsls r0, r1, 1 - adds r0, r4 - movs r1, 0x4A - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x5A -_081C1BEE: - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - b _081C1C78 - .pool -_081C1BF8: - ldr r7, =0x000040c0 - adds r0, r3, r7 - ldrb r0, [r0] - cmp r5, r0 - bcs _081C1C1C - lsls r1, 1 - adds r1, r4 - movs r0, 0x46 - strh r0, [r1] - movs r0, 0x47 - strh r0, [r1, 0x2] - movs r0, 0x56 - strh r0, [r1, 0x10] - movs r0, 0x57 - b _081C1C76 - .pool -_081C1C1C: - cmp r5, r0 - bne _081C1C4C - cmp r5, r2 - beq _081C1C38 - lsls r1, 1 - adds r1, r4 - movs r0, 0x41 - strh r0, [r1] - movs r0, 0x42 - strh r0, [r1, 0x2] - movs r0, 0x51 - strh r0, [r1, 0x10] - movs r0, 0x52 - b _081C1C76 -_081C1C38: - lsls r1, 1 - adds r1, r4 - movs r0, 0x4B - strh r0, [r1] - movs r0, 0x4C - strh r0, [r1, 0x2] - movs r0, 0x5B - strh r0, [r1, 0x10] - movs r0, 0x5C - b _081C1C76 -_081C1C4C: - cmp r5, r2 - beq _081C1C64 - lsls r1, 1 - adds r1, r4 - movs r0, 0x43 - strh r0, [r1] - movs r0, 0x44 - strh r0, [r1, 0x2] - movs r0, 0x53 - strh r0, [r1, 0x10] - movs r0, 0x54 - b _081C1C76 -_081C1C64: - lsls r1, r6, 1 - adds r1, r4 - movs r0, 0x48 - strh r0, [r1] - movs r0, 0x49 - strh r0, [r1, 0x2] - movs r0, 0x58 - strh r0, [r1, 0x10] - movs r0, 0x59 -_081C1C76: - strh r0, [r1, 0x12] -_081C1C78: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _081C1BAE - movs r0, 0x8 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x10 - str r0, [sp, 0x8] - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0xB - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r4, 0 - bl Free - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C1BA0 - - thumb_func_start sub_81C1CB0 -sub_81C1CB0: @ 81C1CB0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r0, 0 - mov r8, r1 - lsls r2, 24 - lsrs r6, r2, 24 - lsls r3, 24 - lsrs r5, r3, 24 - ldrb r1, [r4, 0x6] - ldrb r0, [r4, 0x7] - lsls r0, 1 - muls r0, r1 - bl Alloc - adds r7, r0, 0 - mov r1, sp - ldrh r0, [r4, 0x4] - strh r0, [r1] - ldrb r1, [r4, 0x7] - ldrb r0, [r4, 0x6] - adds r2, r1, 0 - muls r2, r0 - movs r0, 0x80 - lsls r0, 17 - orrs r2, r0 - mov r0, sp - adds r1, r7, 0 - bl CpuSet - ldrb r0, [r4, 0x6] - cmp r0, r6 - beq _081C1D60 - cmp r5, 0 - bne _081C1D30 - movs r5, 0 - ldrb r0, [r4, 0x7] - cmp r5, r0 - bcs _081C1D60 -_081C1D00: - ldrb r2, [r4, 0x6] - adds r1, r2, 0 - muls r1, r5 - adds r3, r6, r1 - lsls r3, 1 - ldr r0, [r4] - adds r0, r3 - lsls r1, 1 - adds r1, r7, r1 - subs r2, r6 - ldr r3, =0x001fffff - ands r2, r3 - bl CpuSet - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - ldrb r3, [r4, 0x7] - cmp r5, r3 - bcc _081C1D00 - b _081C1D60 - .pool -_081C1D30: - movs r5, 0 - ldrb r0, [r4, 0x7] - cmp r5, r0 - bcs _081C1D60 -_081C1D38: - ldrb r2, [r4, 0x6] - adds r1, r2, 0 - muls r1, r5 - lsls r3, r1, 1 - ldr r0, [r4] - adds r0, r3 - adds r1, r6, r1 - lsls r1, 1 - adds r1, r7, r1 - subs r2, r6 - ldr r3, =0x001fffff - ands r2, r3 - bl CpuSet - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - ldrb r3, [r4, 0x7] - cmp r5, r3 - bcc _081C1D38 -_081C1D60: - movs r5, 0 - b _081C1D8A - .pool -_081C1D68: - ldrb r2, [r4, 0x6] - adds r0, r2, 0 - muls r0, r5 - lsls r0, 1 - adds r0, r7, r0 - ldrb r1, [r4, 0x9] - adds r1, r5 - lsls r1, 5 - ldrb r3, [r4, 0x8] - adds r1, r3 - lsls r1, 1 - add r1, r8 - bl CpuSet - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_081C1D8A: - ldrb r0, [r4, 0x7] - cmp r5, r0 - bcc _081C1D68 - adds r0, r7, 0 - bl Free - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C1CB0 - - thumb_func_start sub_81C1DA4 -sub_81C1DA4: @ 81C1DA4 - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 16 - lsrs r4, r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_0861CC04 - ldrb r2, [r3, 0x6] - cmp r1, r2 - ble _081C1DBA - adds r4, r2, 0 -_081C1DBA: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - beq _081C1DC6 - cmp r0, r2 - bne _081C1DE8 -_081C1DC6: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r0, =0x000020bc - adds r1, r0 - lsls r2, r4, 24 - lsrs r2, 24 - adds r0, r3, 0 - movs r3, 0x1 - bl sub_81C1CB0 - b _081C1E12 - .pool -_081C1DE8: - ldr r5, =sub_81C1E20 - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _081C1E04 - adds r0, r5, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 -_081C1E04: - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - strh r6, [r0, 0xA] -_081C1E12: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1DA4 - - thumb_func_start sub_81C1E20 -sub_81C1E20: @ 81C1E20 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r4, 0x2] - lsls r0, 16 - cmp r0, 0 - bge _081C1E50 - movs r0, 0 - strh r0, [r4, 0x2] - ldr r7, =gUnknown_0861CC04 - b _081C1E60 - .pool -_081C1E50: - movs r0, 0x2 - ldrsh r1, [r4, r0] - ldr r0, =gUnknown_0861CC04 - ldrb r2, [r0, 0x6] - adds r7, r0, 0 - cmp r1, r2 - ble _081C1E60 - strh r2, [r4, 0x2] -_081C1E60: - ldr r5, =gUnknown_0203CF1C - ldr r1, [r5] - ldr r0, =0x000020bc - adds r1, r0 - ldrb r2, [r4, 0x2] - adds r0, r7, 0 - movs r3, 0x1 - bl sub_81C1CB0 - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0 - ble _081C1E80 - ldrb r7, [r7, 0x6] - cmp r0, r7 - blt _081C1EE0 -_081C1E80: - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bge _081C1EAC - ldr r0, [r5] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x2 - bne _081C1ED4 - movs r0, 0xE - bl PutWindowTilemap - b _081C1ED4 - .pool -_081C1EAC: - ldr r2, =gSprites - ldr r0, [r5] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1ECE - movs r0, 0xD - bl PutWindowTilemap -_081C1ECE: - movs r0, 0x13 - bl PutWindowTilemap -_081C1ED4: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r6, 0 - bl DestroyTask -_081C1EE0: - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1E20 - - thumb_func_start sub_81C1EFC -sub_81C1EFC: @ 81C1EFC - push {r4-r7,lr} - lsls r0, 16 - lsrs r7, r0, 16 - lsls r1, 16 - lsls r2, 16 - lsrs r6, r2, 16 - lsrs r4, r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_0861CC10 - ldrb r2, [r3, 0x6] - cmp r1, r2 - ble _081C1F16 - adds r4, r2, 0 -_081C1F16: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - beq _081C1F22 - cmp r0, r2 - bne _081C1F44 -_081C1F22: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r0, =0x000030bc - adds r1, r0 - lsls r2, r4, 24 - lsrs r2, 24 - adds r0, r3, 0 - movs r3, 0x1 - bl sub_81C1CB0 - b _081C1F70 - .pool -_081C1F44: - ldr r5, =sub_81C1F80 - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _081C1F60 - adds r0, r5, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 -_081C1F60: - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - strh r7, [r0, 0xA] - strh r6, [r0, 0xC] -_081C1F70: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1EFC - - thumb_func_start sub_81C1F80 -sub_81C1F80: @ 81C1F80 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r4, 0x2] - lsls r0, 16 - cmp r0, 0 - bge _081C1FB0 - movs r0, 0 - strh r0, [r4, 0x2] - ldr r7, =gUnknown_0861CC10 - b _081C1FC0 - .pool -_081C1FB0: - movs r0, 0x2 - ldrsh r1, [r4, r0] - ldr r0, =gUnknown_0861CC10 - ldrb r2, [r0, 0x6] - adds r7, r0, 0 - cmp r1, r2 - ble _081C1FC0 - strh r2, [r4, 0x2] -_081C1FC0: - ldr r5, =gUnknown_0203CF1C - ldr r1, [r5] - ldr r0, =0x000030bc - adds r1, r0 - ldrb r2, [r4, 0x2] - adds r0, r7, 0 - movs r3, 0x1 - bl sub_81C1CB0 - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0 - ble _081C1FE0 - ldrb r7, [r7, 0x6] - cmp r0, r7 - blt _081C2058 -_081C1FE0: - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bge _081C2024 - ldr r0, [r5] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2006 - ldr r0, =sub_81C0B8C - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _081C2006 - movs r0, 0xF - bl PutWindowTilemap -_081C2006: - ldrh r0, [r4, 0x4] - bl sub_81C240C - b _081C204C - .pool -_081C2024: - ldr r2, =gSprites - ldr r0, [r5] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C2046 - movs r0, 0xD - bl PutWindowTilemap -_081C2046: - movs r0, 0x13 - bl PutWindowTilemap -_081C204C: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r6, 0 - bl DestroyTask -_081C2058: - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1F80 - - thumb_func_start sub_81C2074 -sub_81C2074: @ 81C2074 - push {r4,r5,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 16 - lsrs r4, r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_0861CBEC - ldrb r2, [r3, 0x6] - cmp r1, r2 - ble _081C208A - adds r4, r2, 0 -_081C208A: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - beq _081C2096 - cmp r0, r2 - bne _081C20C8 -_081C2096: - ldr r5, =gUnknown_0203CF1C - ldr r1, [r5] - adds r1, 0xBC - lsls r4, 24 - lsrs r4, 24 - adds r0, r3, 0 - adds r2, r4, 0 - movs r3, 0 - bl sub_81C1CB0 - ldr r0, =gUnknown_0861CBF8 - ldr r1, [r5] - adds r1, 0xBC - adds r2, r4, 0 - movs r3, 0 - bl sub_81C1CB0 - b _081C20E2 - .pool -_081C20C8: - ldr r0, =sub_81C20F0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - strh r5, [r1, 0xA] -_081C20E2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2074 - - thumb_func_start sub_81C20F0 -sub_81C20F0: @ 81C20F0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrh r0, [r5] - ldrh r1, [r5, 0x2] - adds r0, r1 - strh r0, [r5, 0x2] - lsls r0, 16 - cmp r0, 0 - bge _081C2120 - movs r0, 0 - strh r0, [r5, 0x2] - ldr r7, =gUnknown_0861CBEC - b _081C2130 - .pool -_081C2120: - movs r0, 0x2 - ldrsh r1, [r5, r0] - ldr r0, =gUnknown_0861CBEC - ldrb r2, [r0, 0x6] - adds r7, r0, 0 - cmp r1, r2 - ble _081C2130 - strh r2, [r5, 0x2] -_081C2130: - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - adds r1, 0xBC - ldrb r2, [r5, 0x2] - adds r0, r7, 0 - movs r3, 0 - bl sub_81C1CB0 - ldr r0, =gUnknown_0861CBF8 - ldr r1, [r4] - adds r1, 0xBC - ldrb r2, [r5, 0x2] - movs r3, 0 - bl sub_81C1CB0 - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - movs r1, 0x2 - ldrsh r0, [r5, r1] - cmp r0, 0 - ble _081C2162 - ldrb r7, [r7, 0x6] - cmp r0, r7 - blt _081C2180 -_081C2162: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bge _081C217A - bl sub_81C4A88 - movs r0, 0xD - bl PutWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram -_081C217A: - adds r0, r6, 0 - bl DestroyTask -_081C2180: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C20F0 - - thumb_func_start sub_81C2194 -sub_81C2194: @ 81C2194 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r2, 24 - lsls r1, 28 - lsrs r4, r1, 16 - ldr r7, =0x0000056a - cmp r2, 0 - bne _081C21E4 - movs r3, 0 - ldr r5, =gUnknown_08DC3CD4 -_081C21A8: - adds r2, r7, r3 - lsls r2, 1 - adds r2, r6 - lsls r0, r3, 1 - adds r0, r5 - ldrh r1, [r0] - adds r1, r4, r1 - strh r1, [r2] - adds r0, r2, 0 - adds r0, 0x40 - strh r1, [r0] - adds r2, 0x80 - adds r0, r3, 0 - adds r0, 0x14 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - adds r0, r4, r0 - strh r0, [r2] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x13 - bls _081C21A8 - b _081C221C - .pool -_081C21E4: - movs r3, 0 - ldr r5, =gUnknown_08DC3CD4 -_081C21E8: - adds r1, r7, r3 - lsls r1, 1 - adds r1, r6 - adds r0, r3, 0 - adds r0, 0x14 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - adds r0, r4, r0 - strh r0, [r1] - adds r2, r1, 0 - adds r2, 0x40 - adds r0, r3, 0 - adds r0, 0x28 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - adds r0, r4, r0 - strh r0, [r2] - adds r1, 0x80 - strh r0, [r1] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x13 - bls _081C21E8 -_081C221C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2194 - - thumb_func_start sub_81C2228 -sub_81C2228: @ 81C2228 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - bl CheckPartyPokerus - lsls r0, 24 - cmp r0, 0 - bne _081C225C - adds r0, r4, 0 - movs r1, 0 - bl CheckPartyHasHadPokerus - lsls r0, 24 - cmp r0, 0 - beq _081C225C - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x00000502 - adds r1, r0, r2 - movs r2, 0x2C - b _081C2266 - .pool -_081C225C: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x00000502 - adds r1, r0, r2 - ldr r2, =0x0000081a -_081C2266: - strh r2, [r1] - ldr r1, =0x00000d02 - adds r0, r1 - strh r2, [r0] - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2228 - - thumb_func_start sub_81C228C -sub_81C228C: @ 81C228C - push {lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _081C22AC - movs r0, 0x8 - str r0, [sp] - str r1, [sp, 0x4] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x8 - bl sub_8199C30 - b _081C22C0 -_081C22AC: - movs r0, 0x8 - str r0, [sp] - movs r0, 0x5 - str r0, [sp, 0x4] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x8 - bl sub_8199C30 -_081C22C0: - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_81C228C - - thumb_func_start sub_81C22CC -sub_81C22CC: @ 81C22CC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r6, r1, 0 - adds r6, 0x70 - ldrb r1, [r6, 0x5] - mov r8, r0 - cmp r1, 0x63 - bhi _081C2340 - ldr r5, =gExperienceTables - adds r2, r1, 0 - adds r1, r2, 0x1 - lsls r1, 2 - ldr r4, =gBaseStats - ldrh r3, [r6] - lsls r0, r3, 3 - subs r0, r3 - lsls r0, 2 - adds r0, r4 - ldrb r3, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r3 - adds r1, r0 - adds r1, r5 - lsls r2, 2 - adds r2, r0 - adds r2, r5 - ldr r1, [r1] - ldr r2, [r2] - subs r1, r2 - ldr r0, [r6, 0x10] - subs r4, r0, r2 - lsls r0, r4, 6 - bl __udivsi3 - adds r6, r0, 0 - movs r7, 0 - adds r0, r7, 0 - orrs r0, r6 - cmp r0, 0 - bne _081C2344 - cmp r4, 0 - beq _081C2344 - movs r6, 0x1 - movs r7, 0 - b _081C2344 - .pool -_081C2340: - movs r6, 0 - movs r7, 0 -_081C2344: - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x00001d66 - adds r2, r0 - mov r9, r2 - movs r0, 0 - mov r12, r0 - ldr r1, =0x00002062 - mov r10, r1 -_081C2356: - cmp r7, 0 - bgt _081C2362 - cmp r7, 0 - bne _081C237C - cmp r6, 0x7 - bls _081C237C -_081C2362: - mov r2, r12 - lsls r0, r2, 1 - add r0, r9 - ldr r2, =0x0000206a - adds r1, r2, 0 - strh r1, [r0] - b _081C23B6 - .pool -_081C237C: - mov r1, r12 - lsls r0, r1, 1 - add r0, r9 - mov r8, r0 - adds r5, r7, 0 - adds r4, r6, 0 - cmp r7, 0 - bge _081C2394 - movs r4, 0x7 - movs r5, 0 - adds r4, r6 - adcs r5, r7 -_081C2394: - lsls r3, r5, 29 - lsrs r2, r4, 3 - adds r0, r3, 0 - orrs r0, r2 - asrs r1, r5, 3 - lsrs r5, r0, 29 - lsls r4, r1, 3 - adds r3, r5, 0 - orrs r3, r4 - lsls r2, r0, 3 - adds r1, r7, 0 - adds r0, r6, 0 - subs r0, r2 - sbcs r1, r3 - add r0, r10 - mov r2, r8 - strh r0, [r2] -_081C23B6: - movs r0, 0x8 - negs r0, r0 - asrs r1, r0, 31 - adds r6, r0 - adcs r7, r1 - cmp r7, 0 - bge _081C23C8 - movs r6, 0 - movs r7, 0 -_081C23C8: - mov r0, r12 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - cmp r0, 0x7 - bls _081C2356 - movs r0, 0x1 - bl GetBgTilemapBuffer - ldr r1, =gUnknown_0203CF1C - ldr r1, [r1] - ldr r2, =0x000010bc - adds r1, r2 - cmp r0, r1 - bne _081C23F8 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - b _081C23FE - .pool -_081C23F8: - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081C23FE: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C22CC - - thumb_func_start sub_81C240C -sub_81C240C: @ 81C240C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 16 - lsrs r3, r0, 16 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000038bc - adds r5, r0, r1 - cmp r3, 0 - beq _081C2510 - ldr r1, =gContestEffects - ldr r2, =gContestMoves - lsls r3, 3 - adds r0, r3, r2 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldrb r4, [r0, 0x1] - mov r9, r1 - mov r8, r2 - mov r10, r3 - cmp r4, 0xFF - beq _081C244C - adds r0, r4, 0 - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r4, r0, 24 -_081C244C: - movs r2, 0 - movs r6, 0x3 - movs r3, 0xF3 - lsls r3, 2 -_081C2454: - cmp r4, 0xFF - beq _081C2484 - cmp r2, r4 - bcs _081C2484 - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x0000103a - b _081C2496 - .pool -_081C2484: - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x00001039 -_081C2496: - adds r1, r7, 0 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _081C2454 - mov r0, r10 - add r0, r8 - ldrb r0, [r0] - lsls r0, 2 - add r0, r9 - ldrb r4, [r0, 0x2] - cmp r4, 0xFF - beq _081C24C0 - adds r0, r4, 0 - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r4, r0, 24 -_081C24C0: - movs r2, 0 - movs r6, 0x3 - ldr r3, =0x0000044c -_081C24C6: - cmp r4, 0xFF - beq _081C24F0 - cmp r2, r4 - bcs _081C24F0 - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x0000103c - b _081C2502 - .pool -_081C24F0: - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x0000103d -_081C2502: - adds r1, r7, 0 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _081C24C6 -_081C2510: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C240C - - thumb_func_start sub_81C2524 -sub_81C2524: @ 81C2524 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x74 - ldrb r0, [r0] - cmp r0, 0 - beq _081C2544 - movs r1, 0x80 - lsls r1, 9 - movs r0, 0x3 - movs r2, 0 - bl ChangeBgX - b _081C254E - .pool -_081C2544: - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX -_081C254E: - pop {r0} - bx r0 - thumb_func_end sub_81C2524 - - thumb_func_start sub_81C2554 -sub_81C2554: @ 81C2554 - push {r4,r5,lr} - ldr r0, =gUnknown_0861CC24 - bl InitWindows - bl DeactivateAllTextPrinters - movs r4, 0 -_081C2562: - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x13 - bls _081C2562 - movs r4, 0 - ldr r5, =gUnknown_0203CF1C - ldr r3, =0x000040cb - movs r2, 0xFF -_081C257C: - ldr r0, [r5] - adds r0, r3 - adds r0, r4 - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _081C257C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2554 - - thumb_func_start sub_81C25A4 -sub_81C25A4: @ 81C25A4 - push {r4-r6,lr} - sub sp, 0x14 - ldr r4, [sp, 0x24] - ldr r5, [sp, 0x28] - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - movs r6, 0 - str r6, [sp] - str r4, [sp, 0x4] - lsls r4, r5, 1 - adds r4, r5 - ldr r5, =gUnknown_0861CD2C - adds r4, r5 - str r4, [sp, 0x8] - str r6, [sp, 0xC] - str r1, [sp, 0x10] - movs r1, 0x1 - bl AddTextPrinterParametrized2 - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C25A4 - - thumb_func_start sub_81C25E8 -sub_81C25E8: @ 81C25E8 - push {lr} - movs r0, 0x11 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x12 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x13 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x74 - ldrb r0, [r0] - cmp r0, 0 - bne _081C2618 - bl sub_81C2628 - b _081C261C - .pool -_081C2618: - bl sub_81C2794 -_081C261C: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r0} - bx r0 - thumb_func_end sub_81C25E8 - - thumb_func_start sub_81C2628 -sub_81C2628: @ 81C2628 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - movs r1, 0xC - adds r1, r0 - mov r8, r1 - adds r7, r0, 0 - adds r7, 0x70 - ldrh r0, [r7] - bl SpeciesToPokedexNum - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _081C26CE - ldr r6, =gStringVar1 - ldr r1, =gText_UnkCtrlF908Clear01 - adds r0, r6, 0 - bl StringCopy - ldr r4, =gStringVar2 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x2 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - adds r1, r4, 0 - bl StringAppend - mov r0, r8 - bl IsMonShiny - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081C26AC - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x11 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0 - bl sub_81C228C - b _081C26C6 - .pool -_081C26AC: - movs r0, 0 - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x11 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0x1 - bl sub_81C228C -_081C26C6: - movs r0, 0x11 - bl PutWindowTilemap - b _081C26EE -_081C26CE: - movs r0, 0x11 - bl ClearWindowTilemap - mov r0, r8 - bl IsMonShiny - lsls r0, 24 - cmp r0, 0 - bne _081C26E8 - movs r0, 0 - bl sub_81C228C - b _081C26EE -_081C26E8: - movs r0, 0x1 - bl sub_81C228C -_081C26EE: - ldr r4, =gStringVar1 - ldr r1, =gText_LevelSymbol - adds r0, r4, 0 - bl StringCopy - ldr r5, =gStringVar2 - ldrb r1, [r7, 0x5] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r4, 0 - adds r1, r5, 0 - bl StringAppend - movs r6, 0 - str r6, [sp] - movs r5, 0x1 - str r5, [sp, 0x4] - movs r0, 0x13 - adds r1, r4, 0 - movs r2, 0x18 - movs r3, 0x11 - bl sub_81C25A4 - mov r0, r8 - adds r1, r4, 0 - bl GetMonNickname - str r6, [sp] - str r5, [sp, 0x4] - movs r0, 0x12 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add r1, sp, 0x8 - movs r0, 0xBA - strb r0, [r1] - mov r0, sp - adds r0, 0x9 - ldrh r2, [r7, 0x2] - movs r1, 0xB - muls r1, r2 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - str r6, [sp] - str r5, [sp, 0x4] - movs r0, 0x13 - add r1, sp, 0x8 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldrh r1, [r7, 0x2] - mov r0, r8 - bl sub_81C27DC - movs r0, 0x12 - bl PutWindowTilemap - movs r0, 0x13 - bl PutWindowTilemap - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2628 - - thumb_func_start sub_81C2794 -sub_81C2794: @ 81C2794 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - ldr r4, =gStringVar1 - adds r1, r4, 0 - bl GetMonNickname - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x12 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0x12 - bl PutWindowTilemap - movs r0, 0x11 - bl ClearWindowTilemap - movs r0, 0x13 - bl ClearWindowTilemap - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2794 - - thumb_func_start sub_81C27DC -sub_81C27DC: @ 81C27DC - push {lr} - sub sp, 0x8 - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0x20 - beq _081C282C - cmp r1, 0x1D - beq _081C282C - bl GetMonGender - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081C27FE - cmp r0, 0xFE - beq _081C2818 - b _081C282C -_081C27FE: - ldr r1, =gText_MaleSymbol - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0x13 - movs r2, 0x39 - movs r3, 0x11 - bl sub_81C25A4 - b _081C282C - .pool -_081C2818: - ldr r1, =gText_FemaleSymbol - movs r0, 0 - str r0, [sp] - movs r0, 0x4 - str r0, [sp, 0x4] - movs r0, 0x13 - movs r2, 0x39 - movs r3, 0x11 - bl sub_81C25A4 -_081C282C: - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C27DC - - thumb_func_start sub_81C2838 -sub_81C2838: @ 81C2838 - push {r4,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - ldr r3, =gUnknown_0861CDD3 - cmp r1, 0 - bne _081C284A - subs r3, 0x80 -_081C284A: - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x10 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r4, 0 - adds r1, r3, 0 - movs r3, 0 - bl BlitBitmapToWindow - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2838 - - thumb_func_start sub_81C286C -sub_81C286C: @ 81C286C - push {r4-r7,lr} - sub sp, 0x8 - ldr r1, =gText_PkmnInfo - movs r5, 0 - str r5, [sp] - movs r6, 0x1 - str r6, [sp, 0x4] - movs r0, 0 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_PkmnSkills - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x1 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_BattleMoves - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x2 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_ContestMoves - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x3 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r7, =gText_Cancel2 - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x3E - bl GetStringRightAlignXOffset - adds r4, r0, 0 - adds r2, r4, 0 - subs r2, 0x10 - cmp r2, 0 - bge _081C28CC - movs r2, 0 -_081C28CC: - movs r0, 0x4 - movs r1, 0 - bl sub_81C2838 - lsls r2, r4, 24 - lsrs r2, 24 - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x4 - adds r1, r7, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r7, =gText_Info - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x3E - bl GetStringRightAlignXOffset - adds r4, r0, 0 - adds r2, r4, 0 - subs r2, 0x10 - cmp r2, 0 - bge _081C28FE - movs r2, 0 -_081C28FE: - movs r0, 0x5 - movs r1, 0 - bl sub_81C2838 - lsls r2, r4, 24 - lsrs r2, 24 - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x5 - adds r1, r7, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r7, =gText_Switch - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x3E - bl GetStringRightAlignXOffset - adds r4, r0, 0 - adds r2, r4, 0 - subs r2, 0x10 - cmp r2, 0 - bge _081C2930 - movs r2, 0 -_081C2930: - movs r0, 0x6 - movs r1, 0 - bl sub_81C2838 - lsls r2, r4, 24 - lsrs r2, 24 - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x6 - adds r1, r7, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_RentalPkmn - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x8 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_TypeSlash - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x9 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r4, =gText_HP4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringCenterAlignXOffset - adds r0, 0x6 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xA - adds r1, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r4, =gText_Attack3 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringCenterAlignXOffset - adds r0, 0x6 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xA - adds r1, r4, 0 - movs r3, 0x11 - bl sub_81C25A4 - ldr r4, =gText_Defense3 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringCenterAlignXOffset - adds r0, 0x6 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xA - adds r1, r4, 0 - movs r3, 0x21 - bl sub_81C25A4 - ldr r4, =gText_SpAtk4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x24 - bl GetStringCenterAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xB - adds r1, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r4, =gText_SpDef4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x24 - bl GetStringCenterAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xB - adds r1, r4, 0 - movs r3, 0x11 - bl sub_81C25A4 - ldr r4, =gText_Speed2 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x24 - bl GetStringCenterAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xB - adds r1, r4, 0 - movs r3, 0x21 - bl sub_81C25A4 - ldr r1, =gText_ExpPoints - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xC - movs r2, 0x6 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_NextLv - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xC - movs r2, 0x6 - movs r3, 0x11 - bl sub_81C25A4 - ldr r1, =gText_Status - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xD - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_Power - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xE - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_Accuracy2 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xE - movs r2, 0 - movs r3, 0x11 - bl sub_81C25A4 - ldr r1, =gText_Appeal - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xF - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_Jam - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xF - movs r2, 0 - movs r3, 0x11 - bl sub_81C25A4 - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C286C - - thumb_func_start sub_81C2AFC -sub_81C2AFC: @ 81C2AFC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - movs r0, 0 - bl ClearWindowTilemap - movs r0, 0x1 - bl ClearWindowTilemap - movs r0, 0x2 - bl ClearWindowTilemap - movs r0, 0x3 - bl ClearWindowTilemap - cmp r4, 0x1 - beq _081C2B66 - cmp r4, 0x1 - bgt _081C2B2A - cmp r4, 0 - beq _081C2B34 - b _081C2C06 -_081C2B2A: - cmp r5, 0x2 - beq _081C2B80 - cmp r5, 0x3 - beq _081C2BC4 - b _081C2C06 -_081C2B34: - movs r0, 0 - bl PutWindowTilemap - movs r0, 0x4 - bl PutWindowTilemap - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2B58 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C2B5E -_081C2B58: - movs r0, 0x8 - bl PutWindowTilemap -_081C2B5E: - movs r0, 0x9 - bl PutWindowTilemap - b _081C2C06 -_081C2B66: - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0xA - bl PutWindowTilemap - movs r0, 0xB - bl PutWindowTilemap - movs r0, 0xC - bl PutWindowTilemap - b _081C2C06 -_081C2B80: - movs r0, 0x2 - bl PutWindowTilemap - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2BBC - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2C06 - movs r0, 0xE - bl PutWindowTilemap - b _081C2C06 - .pool -_081C2BBC: - movs r0, 0x5 - bl PutWindowTilemap - b _081C2C06 -_081C2BC4: - movs r0, 0x3 - bl PutWindowTilemap - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2C00 - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2C06 - movs r0, 0xF - bl PutWindowTilemap - b _081C2C06 - .pool -_081C2C00: - movs r0, 0x5 - bl PutWindowTilemap -_081C2C06: - movs r4, 0 - ldr r5, =gUnknown_0203CF1C -_081C2C0A: - ldr r0, [r5] - ldr r1, =0x000040cb - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _081C2C0A - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2AFC - - thumb_func_start sub_81C2C38 -sub_81C2C38: @ 81C2C38 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x1 - beq _081C2C84 - cmp r0, 0x1 - bgt _081C2C4E - cmp r0, 0 - beq _081C2C58 - b _081C2D0E -_081C2C4E: - cmp r1, 0x2 - beq _081C2C98 - cmp r1, 0x3 - beq _081C2CD4 - b _081C2D0E -_081C2C58: - movs r0, 0x4 - bl ClearWindowTilemap - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2C76 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C2C7C -_081C2C76: - movs r0, 0x8 - bl ClearWindowTilemap -_081C2C7C: - movs r0, 0x9 - bl ClearWindowTilemap - b _081C2D0E -_081C2C84: - movs r0, 0xA - bl ClearWindowTilemap - movs r0, 0xB - bl ClearWindowTilemap - movs r0, 0xC - bl ClearWindowTilemap - b _081C2D0E -_081C2C98: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2CCC - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2D0E - movs r0, 0xE - bl ClearWindowTilemap - b _081C2D0E - .pool -_081C2CCC: - movs r0, 0x5 - bl ClearWindowTilemap - b _081C2D0E -_081C2CD4: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2D08 - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2D0E - movs r0, 0xF - bl ClearWindowTilemap - b _081C2D0E - .pool -_081C2D08: - movs r0, 0x5 - bl ClearWindowTilemap -_081C2D0E: - movs r4, 0 -_081C2D10: - adds r0, r4, 0 - bl sub_81C2D68 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _081C2D10 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C2C38 - - thumb_func_start sub_81C2D2C -sub_81C2D2C: @ 81C2D2C - push {r4,lr} - adds r3, r0, 0 - lsls r1, 24 - lsrs r2, r1, 24 - ldr r0, =gUnknown_0203CF1C - ldr r4, =0x000040cb - adds r1, r2, r4 - ldr r0, [r0] - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0xFF - bne _081C2D56 - lsls r0, r2, 3 - adds r0, r3, r0 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl FillWindowPixelBuffer -_081C2D56: - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C2D2C - - thumb_func_start sub_81C2D68 -sub_81C2D68: @ 81C2D68 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CF1C - ldr r2, =0x000040cb - adds r0, r2 - ldr r1, [r1] - adds r4, r1, r0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _081C2D8C - bl ClearWindowTilemap - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] -_081C2D8C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2D68 - - thumb_func_start sub_81C2D9C -sub_81C2D9C: @ 81C2D9C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 -_081C2DA4: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040cb - adds r0, r1 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081C2DBA - movs r1, 0 - bl FillWindowPixelBuffer -_081C2DBA: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x7 - bls _081C2DA4 - ldr r0, =gUnknown_0861CE54 - lsls r1, r5, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2D9C - - thumb_func_start sub_81C2DE4 -sub_81C2DE4: @ 81C2DE4 - push {lr} - lsls r0, 24 - ldr r1, =gUnknown_0861CE64 - lsrs r0, 22 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x10 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2DE4 - - thumb_func_start sub_81C2E00 -sub_81C2E00: @ 81C2E00 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x74 - ldrb r0, [r0] - cmp r0, 0 - beq _081C2E24 - bl sub_81C335C - bl sub_81C33CC - bl sub_81C3428 - bl sub_81C349C - b _081C2E3C - .pool -_081C2E24: - bl sub_81C2EC4 - bl sub_81C2F5C - bl sub_81C2FD8 - bl sub_81C302C - bl sub_81C307C - bl sub_81C3194 -_081C2E3C: - pop {r0} - bx r0 - thumb_func_end sub_81C2E00 - - thumb_func_start sub_81C2E40 -sub_81C2E40: @ 81C2E40 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - bhi _081C2EB8 - lsls r0, 2 - ldr r1, =_081C2E70 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C2E70: - .4byte _081C2E8C - .4byte _081C2E92 - .4byte _081C2E98 - .4byte _081C2E9E - .4byte _081C2EA4 - .4byte _081C2EAA - .4byte _081C2EB0 -_081C2E8C: - bl sub_81C2EC4 - b _081C2EB8 -_081C2E92: - bl sub_81C2F5C - b _081C2EB8 -_081C2E98: - bl sub_81C2FD8 - b _081C2EB8 -_081C2E9E: - bl sub_81C302C - b _081C2EB8 -_081C2EA4: - bl sub_81C307C - b _081C2EB8 -_081C2EAA: - bl sub_81C3194 - b _081C2EB8 -_081C2EB0: - adds r0, r2, 0 - bl DestroyTask - b _081C2EBE -_081C2EB8: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C2EBE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C2E40 - - thumb_func_start sub_81C2EC4 -sub_81C2EC4: @ 81C2EC4 - push {r4-r6,lr} - sub sp, 0x8 - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2F54 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2F54 - ldr r0, =gUnknown_0861CCCC - movs r1, 0 - bl sub_81C2D2C - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gText_OTSlash - movs r6, 0 - str r6, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - adds r2, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xA2 - ldrb r0, [r0] - cmp r0, 0 - bne _081C2F40 - adds r1, 0xA6 - lsls r2, 24 - lsrs r2, 24 - str r6, [sp] - movs r0, 0x5 - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r3, 0x1 - bl sub_81C25A4 - b _081C2F54 - .pool -_081C2F40: - adds r1, 0xA6 - lsls r2, 24 - lsrs r2, 24 - str r6, [sp] - movs r0, 0x6 - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r3, 0x1 - bl sub_81C25A4 -_081C2F54: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C2EC4 - - thumb_func_start sub_81C2F5C -sub_81C2F5C: @ 81C2F5C - push {r4,r5,lr} - sub sp, 0x8 - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2FC0 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2FC0 - ldr r5, =gStringVar1 - ldr r1, =gText_UnkCtrlF907F908 - adds r0, r5, 0 - bl StringCopy - ldr r1, =gUnknown_0203CF1C - ldr r1, [r1] - adds r1, 0xB8 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x38 - bl GetStringRightAlignXOffset - adds r4, r0, 0 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 -_081C2FC0: - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2F5C - - thumb_func_start sub_81C2FD8 -sub_81C2FD8: @ 81C2FD8 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x70 - ldrh r0, [r0] - adds r1, 0x78 - ldrb r1, [r1] - bl GetAbilityBySpecies - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xD - muls r1, r4 - ldr r2, =gAbilityNames - adds r1, r2 - movs r2, 0 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2FD8 - - thumb_func_start sub_81C302C -sub_81C302C: @ 81C302C - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x70 - ldrh r0, [r0] - adds r1, 0x78 - ldrb r1, [r1] - bl GetAbilityBySpecies - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gAbilityDescriptionPointers - lsls r4, 2 - adds r4, r1 - ldr r1, [r4] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r3, 0x11 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C302C - - thumb_func_start sub_81C307C -sub_81C307C: @ 81C307C - push {r4-r6,lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r4, r0, 0 - adds r4, 0x70 - bl sub_81AFBF0 - ldr r1, =gUnknown_0861CE74 - movs r0, 0 - bl sub_81AFC0C - ldr r1, =gUnknown_0861CE7B - movs r0, 0x1 - bl sub_81AFC0C - bl sub_81C31C0 - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C30C2 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C30C2 - bl sub_81C3304 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C30E0 -_081C30C2: - ldr r0, =gStringVar4 - ldr r1, =gText_XNature - bl sub_81AFC28 - b _081C3182 - .pool -_081C30E0: - movs r0, 0x20 - bl Alloc - adds r6, r0, 0 - movs r0, 0x20 - bl Alloc - adds r5, r0, 0 - adds r0, r6, 0 - bl sub_81C31F0 - ldrb r0, [r4, 0x9] - cmp r0, 0xD4 - bhi _081C310C - adds r1, r0, 0 - adds r0, r5, 0 - bl sub_8124610 - movs r0, 0x4 - adds r1, r5, 0 - bl sub_81AFC0C -_081C310C: - bl sub_81C3220 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C3148 - ldrb r0, [r4, 0xA] - cmp r0, 0 - bne _081C3134 - ldrb r0, [r4, 0x9] - ldr r1, =gText_XNatureHatchedAtYZ - cmp r0, 0xD4 - bls _081C3170 - ldr r1, =gText_XNatureHatchedSomewhereAt - b _081C3170 - .pool -_081C3134: - ldrb r0, [r4, 0x9] - ldr r1, =gText_XNatureMetAtYZ - cmp r0, 0xD4 - bls _081C3170 - ldr r1, =gText_XNatureMetSomewhereAt - b _081C3170 - .pool -_081C3148: - ldrb r0, [r4, 0x9] - cmp r0, 0xFF - bne _081C3158 - ldr r1, =gText_XNatureFatefulEncounter - b _081C3170 - .pool -_081C3158: - cmp r0, 0xFE - beq _081C316E - bl sub_81C32BC - lsls r0, 24 - cmp r0, 0 - beq _081C316E - ldrb r0, [r4, 0x9] - ldr r1, =gText_XNatureProbablyMetAt - cmp r0, 0xD4 - bls _081C3170 -_081C316E: - ldr r1, =gText_XNatureObtainedInTrade -_081C3170: - ldr r0, =gStringVar4 - bl sub_81AFC28 - adds r0, r6, 0 - bl Free - adds r0, r5, 0 - bl Free -_081C3182: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C307C - - thumb_func_start sub_81C3194 -sub_81C3194: @ 81C3194 - push {lr} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x3 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar4 - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3194 - - thumb_func_start sub_81C31C0 -sub_81C31C0: @ 81C31C0 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =gNatureNamePointers - adds r0, 0xA3 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x2 - bl sub_81AFC0C - ldr r1, =gText_EmptyString5 - movs r0, 0x5 - bl sub_81AFC0C - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C31C0 - - thumb_func_start sub_81C31F0 -sub_81C31F0: @ 81C31F0 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x7A - ldrb r1, [r0] - cmp r1, 0 - bne _081C3202 - movs r1, 0x5 -_081C3202: - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r0, 0x3 - adds r1, r4, 0 - bl sub_81AFC0C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C31F0 - - thumb_func_start sub_81C3220 -sub_81C3220: @ 81C3220 - push {r4-r6,lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r6, r0, 0 - adds r6, 0x70 - ldr r1, [r0] - ldr r0, =gEnemyParty - cmp r1, r0 - bne _081C326C - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r0, r2, 0x4 - adds r0, r1, r0 - ldrh r4, [r0] - adds r0, r1, r2 - ldrb r5, [r0, 0x13] - ldr r0, =gStringVar1 - adds r2, 0x8 - adds r1, r2 - bl StringCopy - b _081C3282 - .pool -_081C326C: - bl GetPlayerIDAsU32 - adds r4, r0, 0 - ldr r0, =0x0000ffff - ands r4, r0 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r5, [r1, 0x8] - ldr r0, =gStringVar1 - bl StringCopy -_081C3282: - adds r0, r6, 0 - adds r0, 0x32 - ldrb r0, [r0] - cmp r5, r0 - bne _081C32A4 - ldr r0, [r6, 0x48] - ldr r1, =0x0000ffff - ands r0, r1 - cmp r4, r0 - bne _081C32A4 - ldr r0, =gStringVar1 - adds r1, r6, 0 - adds r1, 0x36 - bl StringCompareWithoutExtCtrlCodes - cmp r0, 0 - beq _081C32B4 -_081C32A4: - movs r0, 0 - b _081C32B6 - .pool -_081C32B4: - movs r0, 0x1 -_081C32B6: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81C3220 - - thumb_func_start sub_81C32BC -sub_81C32BC: @ 81C32BC - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x70 - ldrb r0, [r0, 0xB] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _081C32D8 - movs r0, 0 - b _081C32DA - .pool -_081C32D8: - movs r0, 0x1 -_081C32DA: - pop {r1} - bx r1 - thumb_func_end sub_81C32BC - - thumb_func_start sub_81C32E0 -sub_81C32E0: @ 81C32E0 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x70 - ldrb r0, [r0, 0xB] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _081C32FC - movs r0, 0 - b _081C32FE - .pool -_081C32FC: - movs r0, 0x1 -_081C32FE: - pop {r1} - bx r1 - thumb_func_end sub_81C32E0 - - thumb_func_start sub_81C3304 -sub_81C3304: @ 81C3304 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _081C3354 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C3354 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C333A - cmp r0, 0x4 - beq _081C333A - cmp r0, 0x5 - bne _081C3354 -_081C333A: - movs r0, 0x1 - b _081C3356 - .pool -_081C3354: - movs r0, 0 -_081C3356: - pop {r1} - bx r1 - thumb_func_end sub_81C3304 - - thumb_func_start sub_81C335C -sub_81C335C: @ 81C335C - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCCC - movs r1, 0 - bl sub_81C2D2C - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gText_OTSlash - mov r8, r0 - movs r0, 0x1 - mov r1, r8 - movs r2, 0 - bl GetStringWidth - adds r5, r0, 0 - movs r0, 0 - mov r9, r0 - str r0, [sp] - movs r6, 0x1 - str r6, [sp, 0x4] - adds r0, r4, 0 - mov r1, r8 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_FiveMarks - lsls r5, 24 - lsrs r5, 24 - mov r0, r9 - str r0, [sp] - str r6, [sp, 0x4] - adds r0, r4, 0 - adds r2, r5, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C335C - - thumb_func_start sub_81C33CC -sub_81C33CC: @ 81C33CC - push {r4,r5,lr} - sub sp, 0x8 - ldr r5, =gStringVar1 - ldr r1, =gText_UnkCtrlF907F908 - adds r0, r5, 0 - bl StringCopy - ldr r1, =gText_FiveMarks - adds r0, r5, 0 - bl StringAppend - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x38 - bl GetStringRightAlignXOffset - adds r4, r0, 0 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C33CC - - thumb_func_start sub_81C3428 -sub_81C3428: @ 81C3428 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x70 - adds r0, 0xA5 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C3448 - ldr r4, =gText_EggWillTakeALongTime - b _081C346C - .pool -_081C3448: - ldrh r0, [r1, 0x30] - cmp r0, 0x5 - bhi _081C3458 - ldr r4, =gText_EggAboutToHatch - b _081C346C - .pool -_081C3458: - cmp r0, 0xA - bhi _081C3464 - ldr r4, =gText_EggWillHatchSoon - b _081C346C - .pool -_081C3464: - ldr r4, =gText_EggWillTakeALongTime - cmp r0, 0x28 - bhi _081C346C - ldr r4, =gText_EggWillTakeSomeTime -_081C346C: - ldr r0, =gUnknown_0861CCCC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3428 - - thumb_func_start sub_81C349C -sub_81C349C: @ 81C349C - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r4, r0, 0 - adds r4, 0x70 - adds r0, 0xA5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C3500 - ldrb r0, [r4, 0x9] - cmp r0, 0xFF - bne _081C34C4 - ldr r4, =gText_PeculiarEggNicePlace - b _081C3502 - .pool -_081C34C4: - bl sub_81C32BC - lsls r0, 24 - cmp r0, 0 - beq _081C34D8 - bl sub_81C3220 - lsls r0, 24 - cmp r0, 0 - bne _081C34E0 -_081C34D8: - ldr r4, =gText_PeculiarEggTrade - b _081C3502 - .pool -_081C34E0: - ldrb r0, [r4, 0x9] - cmp r0, 0xFD - bne _081C3500 - bl sub_81C32E0 - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gText_EggFromTraveler - cmp r0, 0x1 - bne _081C3502 - ldr r4, =gText_EggFromHotSprings - b _081C3502 - .pool -_081C3500: - ldr r4, =gText_OddEggFoundByCouple -_081C3502: - ldr r0, =gUnknown_0861CCCC - movs r1, 0x3 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C349C - - thumb_func_start sub_81C3530 -sub_81C3530: @ 81C3530 - push {lr} - bl sub_81C35E4 - bl sub_81C3690 - bl sub_81C3710 - bl sub_81C37D8 - bl sub_81C3808 - bl sub_81C3890 - bl sub_81C38C0 - pop {r0} - bx r0 - thumb_func_end sub_81C3530 - - thumb_func_start sub_81C3554 -sub_81C3554: @ 81C3554 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - bhi _081C35D6 - lsls r0, 2 - ldr r1, =_081C3584 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C3584: - .4byte _081C35A4 - .4byte _081C35AA - .4byte _081C35B0 - .4byte _081C35B6 - .4byte _081C35BC - .4byte _081C35C2 - .4byte _081C35C8 - .4byte _081C35CE -_081C35A4: - bl sub_81C35E4 - b _081C35D6 -_081C35AA: - bl sub_81C3690 - b _081C35D6 -_081C35B0: - bl sub_81C3710 - b _081C35D6 -_081C35B6: - bl sub_81C37D8 - b _081C35D6 -_081C35BC: - bl sub_81C3808 - b _081C35D6 -_081C35C2: - bl sub_81C3890 - b _081C35D6 -_081C35C8: - bl sub_81C38C0 - b _081C35D6 -_081C35CE: - adds r0, r2, 0 - bl DestroyTask - b _081C35DC -_081C35D6: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C35DC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C3554 - - thumb_func_start sub_81C35E4 -sub_81C35E4: @ 81C35E4 - push {r4,r5,lr} - sub sp, 0x8 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x9E - ldrh r0, [r0] - cmp r0, 0xAF - bne _081C3628 - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C3628 - ldr r0, [r4] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C3614 - cmp r0, 0x4 - beq _081C3614 - cmp r0, 0x5 - bne _081C3628 -_081C3614: - movs r0, 0xAF - bl ItemId_GetItem - adds r5, r0, 0 - b _081C3650 - .pool -_081C3628: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x9E - ldrh r0, [r1] - cmp r0, 0 - bne _081C3644 - ldr r5, =gText_None - b _081C3650 - .pool -_081C3644: - ldrh r0, [r1] - ldr r4, =gStringVar1 - adds r1, r4, 0 - bl CopyItemName - adds r5, r4, 0 -_081C3650: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x48 - bl GetStringCenterAlignXOffset - adds r4, r0, 0 - adds r4, 0x6 - ldr r0, =gUnknown_0861CCEC - movs r1, 0 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C35E4 - - thumb_func_start sub_81C3690 -sub_81C3690: @ 81C3690 - push {r4,r5,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x76 - ldrb r0, [r1] - cmp r0, 0 - bne _081C36B0 - ldr r5, =gText_None - b _081C36C8 - .pool -_081C36B0: - ldr r0, =gStringVar1 - ldrb r1, [r1] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_RibbonsVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r5, r4, 0 -_081C36C8: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x46 - bl GetStringCenterAlignXOffset - adds r4, r0, 0 - adds r4, 0x6 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3690 - - thumb_func_start sub_81C3710 -sub_81C3710: @ 81C3710 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - movs r0, 0x8 - bl Alloc - mov r9, r0 - movs r0, 0x8 - bl Alloc - mov r8, r0 - movs r0, 0x8 - bl Alloc - adds r6, r0, 0 - movs r0, 0x8 - bl Alloc - adds r5, r0, 0 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x90 - ldrh r1, [r0] - mov r0, r9 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x92 - ldrh r1, [r0] - mov r0, r8 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x94 - ldrh r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x96 - ldrh r1, [r0] - adds r0, r5, 0 - movs r2, 0x1 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - bl sub_81AFBF0 - movs r0, 0 - mov r1, r9 - bl sub_81AFC0C - movs r0, 0x1 - mov r1, r8 - bl sub_81AFC0C - movs r0, 0x2 - adds r1, r6, 0 - bl sub_81AFC0C - movs r0, 0x3 - adds r1, r5, 0 - bl sub_81AFC0C - ldr r0, =gStringVar4 - ldr r1, =gUnknown_0861CE82 - bl sub_81AFC28 - mov r0, r9 - bl Free - mov r0, r8 - bl Free - adds r0, r6, 0 - bl Free - adds r0, r5, 0 - bl Free - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3710 - - thumb_func_start sub_81C37D8 -sub_81C37D8: @ 81C37D8 - push {lr} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar4 - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r2, 0x4 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C37D8 - - thumb_func_start sub_81C3808 -sub_81C3808: @ 81C3808 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gStringVar1 - mov r8, r0 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x98 - ldrh r1, [r0] - mov r0, r8 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r6, =gStringVar2 - ldr r0, [r4] - adds r0, 0x9A - ldrh r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r5, =gStringVar3 - ldr r0, [r4] - adds r0, 0x9C - ldrh r1, [r0] - adds r0, r5, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - bl sub_81AFBF0 - movs r0, 0 - mov r1, r8 - bl sub_81AFC0C - movs r0, 0x1 - adds r1, r6, 0 - bl sub_81AFC0C - movs r0, 0x2 - adds r1, r5, 0 - bl sub_81AFC0C - ldr r0, =gStringVar4 - ldr r1, =gUnknown_0861CE8E - bl sub_81AFC28 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3808 - - thumb_func_start sub_81C3890 -sub_81C3890: @ 81C3890 - push {lr} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x3 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar4 - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3890 - - thumb_func_start sub_81C38C0 -sub_81C38C0: @ 81C38C0 - push {r4-r6,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r5, r0, 0 - adds r5, 0x70 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x4 - bl sub_81C2D2C - lsls r0, 24 - lsrs r6, r0, 24 - ldr r4, =gStringVar1 - ldr r1, [r5, 0x10] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringRightAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r6, 0 - adds r1, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldrb r0, [r5, 0x5] - cmp r0, 0x63 - bhi _081C3948 - ldr r4, =gExperienceTables - adds r1, r0, 0 - adds r1, 0x1 - lsls r1, 2 - ldr r3, =gBaseStats - ldrh r2, [r5] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r2, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r2 - adds r1, r0 - adds r1, r4 - ldr r1, [r1] - ldr r0, [r5, 0x10] - subs r1, r0 - b _081C394A - .pool -_081C3948: - movs r1, 0 -_081C394A: - ldr r4, =gStringVar1 - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringRightAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r6, 0 - adds r1, r4, 0 - movs r3, 0x11 - bl sub_81C25A4 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C38C0 - - thumb_func_start sub_81C3984 -sub_81C3984: @ 81C3984 - push {r4,lr} - movs r0, 0 - bl sub_81C3B08 - movs r0, 0x1 - bl sub_81C3B08 - movs r0, 0x2 - bl sub_81C3B08 - movs r0, 0x3 - bl sub_81C3B08 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C39EA - bl sub_81C3F44 - ldr r1, [r4] - ldr r0, =0x000040c6 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0x4 - bne _081C39DC - ldr r0, =0x000040c4 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _081C39EA - bl sub_81C3E9C - b _081C39EA - .pool -_081C39DC: - ldrb r0, [r2] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r0, [r1] - bl sub_81C3E9C -_081C39EA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C3984 - - thumb_func_start sub_81C39F0 -sub_81C39F0: @ 81C39F0 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - bhi _081C3AFC - lsls r0, 2 - ldr r1, =_081C3A20 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C3A20: - .4byte _081C3A40 - .4byte _081C3A48 - .4byte _081C3A50 - .4byte _081C3A58 - .4byte _081C3A60 - .4byte _081C3A7C - .4byte _081C3ABE - .4byte _081C3AF4 -_081C3A40: - movs r0, 0 - bl sub_81C3B08 - b _081C3AFC -_081C3A48: - movs r0, 0x1 - bl sub_81C3B08 - b _081C3AFC -_081C3A50: - movs r0, 0x2 - bl sub_81C3B08 - b _081C3AFC -_081C3A58: - movs r0, 0x3 - bl sub_81C3B08 - b _081C3AFC -_081C3A60: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3AFC - bl sub_81C3F44 - b _081C3AFC - .pool -_081C3A7C: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3AFC - ldr r0, =0x000040c6 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0x4 - bne _081C3AB0 - ldr r2, =0x000040c4 - adds r0, r1, r2 - ldrh r0, [r0] - strh r0, [r4, 0x2] - b _081C3AFC - .pool -_081C3AB0: - ldrb r0, [r2] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r0, [r1] - strh r0, [r4, 0x2] - b _081C3AFC -_081C3ABE: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3AFC - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C3AFC - ldrh r0, [r4, 0x2] - bl sub_81C3E9C - b _081C3AFC - .pool -_081C3AF4: - adds r0, r2, 0 - bl DestroyTask - b _081C3B02 -_081C3AFC: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C3B02: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C39F0 - - thumb_func_start sub_81C3B08 -sub_81C3B08: @ 81C3B08 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - mov r10, r0 - ldr r4, =gUnknown_0861CD14 - adds r0, r4, 0 - movs r1, 0 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - lsls r1, r7, 1 - mov r0, r10 - adds r0, 0x84 - adds r0, r1 - ldrh r5, [r0] - cmp r5, 0 - beq _081C3C00 - mov r0, r10 - adds r0, 0xA4 - ldrb r1, [r0] - adds r0, r5, 0 - adds r2, r7, 0 - bl CalculatePPWithBonus - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - movs r0, 0xD - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - lsls r0, r7, 4 - mov r9, r0 - mov r3, r9 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - mov r0, r8 - movs r2, 0 - bl sub_81C25A4 - ldr r0, =gStringVar1 - mov r8, r0 - mov r5, r10 - adds r5, 0x8C - adds r5, r7 - ldrb r1, [r5] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar2 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - bl sub_81AFBF0 - movs r0, 0 - mov r1, r8 - bl sub_81AFC0C - movs r0, 0x1 - adds r1, r4, 0 - bl sub_81AFC0C - ldr r4, =gStringVar4 - ldr r1, =gUnknown_0861CE97 - adds r0, r4, 0 - bl sub_81AFC28 - adds r7, r4, 0 - ldrb r0, [r5] - adds r1, r6, 0 - bl GetCurrentPpToMaxPpState - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - adds r5, 0x9 - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x2C - bl GetStringRightAlignXOffset - mov r4, r9 - b _081C3C26 - .pool -_081C3C00: - ldr r1, =gText_OneDash - lsls r4, r7, 4 - adds r3, r4, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - mov r0, r8 - movs r2, 0 - bl sub_81C25A4 - ldr r7, =gText_TwoDashes - movs r5, 0xC - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x2C - bl GetStringCenterAlignXOffset -_081C3C26: - lsls r2, r0, 24 - lsrs r2, 24 - adds r3, r4, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - lsls r0, r5, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - ldr r0, [sp, 0x8] - adds r1, r7, 0 - bl sub_81C25A4 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3B08 - - thumb_func_start sub_81C3C5C -sub_81C3C5C: @ 81C3C5C - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _081C3CFC - movs r0, 0x13 - str r0, [sp] - movs r0, 0x20 - str r0, [sp, 0x4] - movs r0, 0xE - movs r1, 0 - movs r2, 0x35 - movs r3, 0 - bl FillWindowPixelRect - ldr r2, =gBattleMoves - lsls r1, r5, 1 - adds r0, r1, r5 - lsls r0, 2 - adds r2, r0, r2 - ldrb r0, [r2, 0x1] - adds r6, r1, 0 - cmp r0, 0x1 - bhi _081C3C9C - ldr r1, =gText_ThreeDashes - b _081C3CAC - .pool -_081C3C9C: - ldr r4, =gStringVar1 - ldrb r1, [r2, 0x1] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r1, r4, 0 -_081C3CAC: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xE - movs r2, 0x35 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gBattleMoves - adds r0, r6, r5 - lsls r0, 2 - adds r1, r0, r1 - ldrb r0, [r1, 0x3] - cmp r0, 0 - bne _081C3CDC - ldr r1, =gText_ThreeDashes - b _081C3CEC - .pool -_081C3CDC: - ldr r4, =gStringVar1 - ldrb r1, [r1, 0x3] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r1, r4, 0 -_081C3CEC: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xE - movs r2, 0x35 - movs r3, 0x11 - bl sub_81C25A4 -_081C3CFC: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3C5C - - thumb_func_start sub_81C3D08 -sub_81C3D08: @ 81C3D08 - push {r4,lr} - movs r0, 0 - bl sub_81C3B08 - movs r0, 0x1 - bl sub_81C3B08 - movs r0, 0x2 - bl sub_81C3B08 - movs r0, 0x3 - bl sub_81C3B08 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3D40 - bl sub_81C3F44 - ldr r0, [r4] - ldr r1, =0x000040c6 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C3E2C -_081C3D40: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3D08 - - thumb_func_start sub_81C3D54 -sub_81C3D54: @ 81C3D54 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - bhi _081C3E20 - lsls r0, 2 - ldr r1, =_081C3D84 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C3D84: - .4byte _081C3DA0 - .4byte _081C3DA8 - .4byte _081C3DB0 - .4byte _081C3DB8 - .4byte _081C3DC0 - .4byte _081C3DDC - .4byte _081C3E18 -_081C3DA0: - movs r0, 0 - bl sub_81C3B08 - b _081C3E20 -_081C3DA8: - movs r0, 0x1 - bl sub_81C3B08 - b _081C3E20 -_081C3DB0: - movs r0, 0x2 - bl sub_81C3B08 - b _081C3E20 -_081C3DB8: - movs r0, 0x3 - bl sub_81C3B08 - b _081C3E20 -_081C3DC0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3E20 - bl sub_81C3F44 - b _081C3E20 - .pool -_081C3DDC: - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r1, =0x000040bc - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3E20 - adds r1, 0x8 - adds r0, r2, r1 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C3E20 - ldr r1, =0x000040c6 - adds r0, r2, r1 - ldrb r0, [r0] - bl sub_81C3E2C - b _081C3E20 - .pool -_081C3E18: - adds r0, r2, 0 - bl DestroyTask - b _081C3E26 -_081C3E20: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C3E26: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C3D54 - thumb_func_start sub_81C3E2C sub_81C3E2C: @ 81C3E2C push {r4,lr} diff --git a/asm/secret_base.s b/asm/secret_base.s index d433f5df2..69cfff512 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -1192,7 +1192,7 @@ _080E9462: mov r3, r10 ldrb r1, [r3] lsls r1, 5 - ldr r2, =gUnknown_085A5C24 + ldr r2, =gDecorations + 0x1c adds r1, r2 ldr r1, [r1] ldrh r1, [r1] diff --git a/asm/trader.s b/asm/trader.s index 8c21648fc..8e0b17905 100644 --- a/asm/trader.s +++ b/asm/trader.s @@ -351,7 +351,7 @@ sub_8133CF4: @ 8133CF4 ldr r5, =gScriptResult _08133CFA: adds r0, r4, 0 - bl sub_8161AD0 + bl CountDecorationCategoryN lsls r0, 24 cmp r0, 0 beq _08133D10 @@ -395,7 +395,7 @@ sub_8133D2C: @ 8133D2C cmp r1, r0 beq _08133D72 adds r0, r1, 0 - bl sub_81618D0 + bl GetFirstEmptyDecorSlot lsls r0, 24 asrs r0, 24 movs r1, 0x1 @@ -433,15 +433,15 @@ sub_8133DA0: @ 8133DA0 push {r4-r6,lr} lsls r0, 24 lsrs r6, r0, 24 - bl sub_81279C4 + bl IsSelectedDecorInThePC lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 bne _08133DFC ldr r5, =gSpecialVar_0x8006 - ldr r0, =gUnknown_0203A172 + ldr r0, =gCurDecorationIndex ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C + ldr r0, =gCurDecorInventoryItems ldr r0, [r0] adds r0, r1 ldrb r0, [r0] diff --git a/data/cute_sketch.s b/data/cute_sketch.s index ebdf1e39d..8a8ee1481 100644 --- a/data/cute_sketch.s +++ b/data/cute_sketch.s @@ -5,4 +5,4 @@ .align 2, 0 gUnknown_085A1F94:: @ 85A1F94 - .incbin "baserom.gba", 0x5a1f94, 0x3c74 + .incbin "baserom.gba", 0x5a1f94, 0x2580 diff --git a/data/decoration.s b/data/decoration.s deleted file mode 100644 index de4478f8d..000000000 --- a/data/decoration.s +++ /dev/null @@ -1,86 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gDecorations:: @ 85A5C08 - .incbin "baserom.gba", 0x5a5c08, 0x1c - -gUnknown_085A5C24:: @ 85A5C24 - .incbin "baserom.gba", 0x5a5c24, 0xf04 - -gUnknown_085A6B28:: @ 85A6B28 - .incbin "baserom.gba", 0x5a6b28, 0x20 - -gUnknown_085A6B48:: @ 85A6B48 - .incbin "baserom.gba", 0x5a6b48, 0x20 - -gUnknown_085A6B68:: @ 85A6B68 - .incbin "baserom.gba", 0x5a6b68, 0x10 - -gUnknown_085A6B78:: @ 85A6B78 - .incbin "baserom.gba", 0x5a6b78, 0x18 - -gUnknown_085A6B90:: @ 85A6B90 - .incbin "baserom.gba", 0x5a6b90, 0x20 - -gUnknown_085A6BB0:: @ 85A6BB0 - .incbin "baserom.gba", 0x5a6bb0, 0x20 - -gUnknown_085A6BD0:: @ 85A6BD0 - .incbin "baserom.gba", 0x5a6bd0, 0x18 - -gUnknown_085A6BE8:: @ 85A6BE8 - .incbin "baserom.gba", 0x5a6be8, 0x5c8 - -gUnknown_085A71B0:: @ 85A71B0 - .incbin "baserom.gba", 0x5a71b0, 0xa0 - -gUnknown_085A7250:: @ 85A7250 - .incbin "baserom.gba", 0x5a7250, 0x3c - -gUnknown_085A728C:: @ 85A728C - .incbin "baserom.gba", 0x5a728c, 0x18 - -gUnknown_085A72A4:: @ 85A72A4 - .incbin "baserom.gba", 0x5a72a4, 0x18 - -gUnknown_085A72BC:: @ 85A72BC - .incbin "baserom.gba", 0x5a72bc, 0x8 - -gUnknown_085A72C4:: @ 85A72C4 - .incbin "baserom.gba", 0x5a72c4, 0x8 - -gUnknown_085A72CC:: @ 85A72CC - .incbin "baserom.gba", 0x5a72cc, 0x8 - -gUnknown_085A72D4:: @ 85A72D4 - .incbin "baserom.gba", 0x5a72d4, 0x10 - -gUnknown_085A72E4:: @ 85A72E4 - .incbin "baserom.gba", 0x5a72e4, 0x8 - -gUnknown_085A72EC:: @ 85A72EC - .incbin "baserom.gba", 0x5a72ec, 0x8 - -gUnknown_085A72F4:: @ 85A72F4 - .incbin "baserom.gba", 0x5a72f4, 0x54 - -gUnknown_085A7348:: @ 85A7348 - .incbin "baserom.gba", 0x5a7348, 0x8 - -gUnknown_085A7350:: @ 85A7350 - .incbin "baserom.gba", 0x5a7350, 0x88 - -gUnknown_085A73D8:: @ 85A73D8 - .incbin "baserom.gba", 0x5a73d8, 0x8 - -gUnknown_085A73E0:: @ 85A73E0 - .incbin "baserom.gba", 0x5a73e0, 0x24 - -gUnknown_085A7404:: @ 85A7404 - .incbin "baserom.gba", 0x5a7404, 0x18 - -gUnknown_085A741C:: @ 85A741C - .incbin "baserom.gba", 0x5a741c, 0x8 diff --git a/data/graphics.s b/data/graphics.s index bf0e3173b..e89177a1d 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -881,7 +881,10 @@ gUnknown_08DAAFEC:: @ 8DAAFEC .include "data/graphics/items/item_graphics.inc" @ 8DB7AA0 - .incbin "baserom.gba", 0xdb7aa0, 0x2a78 + .include "data/graphics/decorations/decoration_graphics.inc" + +@ 8DBA14C + .incbin "baserom.gba", 0xdba14c, 0x3cc gUnknown_08DBA518:: @ 8DBA518 .incbin "baserom.gba", 0xdba518, 0x80 diff --git a/data/graphics/decorations/decoration_graphics.inc b/data/graphics/decorations/decoration_graphics.inc new file mode 100644 index 000000000..c7ea9be70 --- /dev/null +++ b/data/graphics/decorations/decoration_graphics.inc @@ -0,0 +1,252 @@ +gUnknown_08DB7AA0:: + .incbin "graphics/decorations/decor_heavy_desk.4bpp.lz" + +gUnknown_08DB7B34:: + .incbin "graphics/decorations/decor_heavy_desk.gbapal.lz" + +gUnknown_08DB7B5C:: + .incbin "graphics/decorations/decor_ragged_desk.4bpp.lz" + +gUnknown_08DB7BEC:: + .incbin "graphics/decorations/decor_ragged_desk.gbapal.lz" + +gUnknown_08DB7C08:: + .incbin "graphics/decorations/decor_comfort_desk.4bpp.lz" + +gUnknown_08DB7CE8:: + .incbin "graphics/decorations/decor_comfort_desk.gbapal.lz" + +gUnknown_08DB7D08:: + .incbin "graphics/decorations/decor_pretty_desk.4bpp.lz" + +gUnknown_08DB7DCC:: + .incbin "graphics/decorations/decor_pretty_desk.gbapal.lz" + +gUnknown_08DB7DF4:: + .incbin "graphics/decorations/decor_brick_desk.4bpp.lz" + +gUnknown_08DB7EA0:: + .incbin "graphics/decorations/decor_brick_desk.gbapal.lz" + +gUnknown_08DB7EC4:: + .incbin "graphics/decorations/decor_camp_desk.4bpp.lz" + +gUnknown_08DB7F60:: + .incbin "graphics/decorations/decor_camp_desk.gbapal.lz" + +gUnknown_08DB7F7C:: + .incbin "graphics/decorations/decor_hard_desk.4bpp.lz" + +gUnknown_08DB8070:: + .incbin "graphics/decorations/decor_hard_desk.gbapal.lz" + +gUnknown_08DB808C:: + .incbin "graphics/decorations/decor_red_plant.4bpp.lz" + +gUnknown_08DB8138:: + .incbin "graphics/decorations/decor_red_plant.gbapal.lz" + +gUnknown_08DB8160:: + .incbin "graphics/decorations/decor_tropical_plant.4bpp.lz" + +gUnknown_08DB8218:: + .incbin "graphics/decorations/decor_tropical_plant.gbapal.lz" + +gUnknown_08DB823C:: + .incbin "graphics/decorations/decor_pretty_flowers.4bpp.lz" + +gUnknown_08DB8300:: + .incbin "graphics/decorations/decor_pretty_flowers.gbapal.lz" + +gUnknown_08DB8328:: + .incbin "graphics/decorations/decor_colorful_plant.4bpp.lz" + +gUnknown_08DB8430:: + .incbin "graphics/decorations/decor_colorful_plant.gbapal.lz" + +gUnknown_08DB8458:: + .incbin "graphics/decorations/decor_big_plant.4bpp.lz" + +gUnknown_08DB8528:: + .incbin "graphics/decorations/decor_big_plant.gbapal.lz" + +gUnknown_08DB854C:: + .incbin "graphics/decorations/decor_gorgeous_plant.4bpp.lz" + +gUnknown_08DB862C:: + .incbin "graphics/decorations/decor_gorgeous_plant.gbapal.lz" + +gUnknown_08DB8654:: + .incbin "graphics/decorations/decor_red_brick.4bpp.lz" + +gUnknown_08DB86C4:: + .incbin "graphics/decorations/decor_red_brick.gbapal.lz" + +gUnknown_08DB86E0:: + .incbin "graphics/decorations/decor_yellow_brick.4bpp.lz" + +gUnknown_08DB8750:: + .incbin "graphics/decorations/decor_yellow_brick.gbapal.lz" + +gUnknown_08DB876C:: + .incbin "graphics/decorations/decor_blue_brick.4bpp.lz" + +gUnknown_08DB87DC:: + .incbin "graphics/decorations/decor_blue_brick.gbapal.lz" + +gUnknown_08DB87F8:: + .incbin "graphics/decorations/decor_red_tent.4bpp.lz" + +gUnknown_08DB88D8:: + .incbin "graphics/decorations/decor_red_tent.gbapal.lz" + +gUnknown_08DB8900:: + .incbin "graphics/decorations/decor_blue_tent.4bpp.lz" + +gUnknown_08DB89E0:: + .incbin "graphics/decorations/decor_blue_tent.gbapal.lz" + +gUnknown_08DB8A08:: + .incbin "graphics/decorations/decor_solid_board.4bpp.lz" + +gUnknown_08DB8A68:: + .incbin "graphics/decorations/decor_solid_board.gbapal.lz" + +gUnknown_08DB8A84:: + .incbin "graphics/decorations/decor_slide.4bpp.lz" + +gUnknown_08DB8B40:: + .incbin "graphics/decorations/decor_slide.gbapal.lz" + +gUnknown_08DB8B68:: + .incbin "graphics/decorations/decor_tire.4bpp.lz" + +gUnknown_08DB8C40:: + .incbin "graphics/decorations/decor_tire.gbapal.lz" + +gUnknown_08DB8C5C:: + .incbin "graphics/decorations/decor_stand.4bpp.lz" + +gUnknown_08DB8CF4:: + .incbin "graphics/decorations/decor_stand.gbapal.lz" + +gUnknown_08DB8D18:: + .incbin "graphics/decorations/decor_breakable_door.4bpp.lz" + +gUnknown_08DB8DB0:: + .incbin "graphics/decorations/decor_breakable_door.gbapal.lz" + +gUnknown_08DB8DD4:: + .incbin "graphics/decorations/decor_sand_ornament.4bpp.lz" + +gUnknown_08DB8E80:: + .incbin "graphics/decorations/decor_sand_ornament.gbapal.lz" + +gUnknown_08DB8EA0:: + .incbin "graphics/decorations/decor_glass_ornament.4bpp.lz" + +gUnknown_08DB8F58:: + .incbin "graphics/decorations/decor_glass_ornament.gbapal.lz" + +gUnknown_08DB8F7C:: + .incbin "graphics/decorations/decor_surf_mat.4bpp.lz" + +gUnknown_08DB9038:: + .incbin "graphics/decorations/decor_surf_mat.gbapal.lz" + +gUnknown_08DB9058:: + .incbin "graphics/decorations/decor_thunder_mat.4bpp.lz" + +gUnknown_08DB9130:: + .incbin "graphics/decorations/decor_thunder_mat.gbapal.lz" + +gUnknown_08DB9154:: + .incbin "graphics/decorations/decor_fire_blast_mat.4bpp.lz" + +gUnknown_08DB9218:: + .incbin "graphics/decorations/decor_fire_blast_mat.gbapal.lz" + +gUnknown_08DB9234:: + .incbin "graphics/decorations/decor_powder_snow_mat.4bpp.lz" + +gUnknown_08DB92FC:: + .incbin "graphics/decorations/decor_powder_snow_mat.gbapal.lz" + +gUnknown_08DB931C:: + .incbin "graphics/decorations/decor_attract_mat.4bpp.lz" + +gUnknown_08DB93E8:: + .incbin "graphics/decorations/decor_attract_mat.gbapal.lz" + +gUnknown_08DB940C:: + .incbin "graphics/decorations/decor_fissure_mat.4bpp.lz" + +gUnknown_08DB94CC:: + .incbin "graphics/decorations/decor_fissure_mat.gbapal.lz" + +gUnknown_08DB94E8:: + .incbin "graphics/decorations/decor_spikes_mat.4bpp.lz" + +gUnknown_08DB95AC:: + .incbin "graphics/decorations/decor_spikes_mat.gbapal.lz" + +gUnknown_08DB95D0:: + .incbin "graphics/decorations/decor_snorlax_doll.4bpp.lz" + +gUnknown_08DB96C4:: + .incbin "graphics/decorations/decor_snorlax_doll.gbapal.lz" + +gUnknown_08DB96EC:: + .incbin "graphics/decorations/decor_rhydon_doll.4bpp.lz" + +gUnknown_08DB97F4:: + .incbin "graphics/decorations/decor_rhydon_doll.gbapal.lz" + +gUnknown_08DB981C:: + .incbin "graphics/decorations/decor_lapras_doll.4bpp.lz" + +gUnknown_08DB9908:: + .incbin "graphics/decorations/decor_lapras_doll.gbapal.lz" + +gUnknown_08DB9930:: + .incbin "graphics/decorations/decor_venusaur_doll.4bpp.lz" + +gUnknown_08DB9A54:: + .incbin "graphics/decorations/decor_venusaur_doll.gbapal.lz" + +gUnknown_08DB9A7C:: + .incbin "graphics/decorations/decor_charizard_doll.4bpp.lz" + +gUnknown_08DB9B7C:: + .incbin "graphics/decorations/decor_charizard_doll.gbapal.lz" + +gUnknown_08DB9BA4:: + .incbin "graphics/decorations/decor_blastoise_doll.4bpp.lz" + +gUnknown_08DB9CB0:: + .incbin "graphics/decorations/decor_blastoise_doll.gbapal.lz" + +gUnknown_08DB9CD8:: + .incbin "graphics/decorations/decor_wailmer_doll.4bpp.lz" + +gUnknown_08DB9DAC:: + .incbin "graphics/decorations/decor_wailmer_doll.gbapal.lz" + +gUnknown_08DB9DD4:: + .incbin "graphics/decorations/decor_regice_doll.4bpp.lz" + +gUnknown_08DB9EE4:: + .incbin "graphics/decorations/decor_regice_doll.gbapal.lz" + +gUnknown_08DB9F08:: + .incbin "graphics/decorations/decor_regirock_doll.4bpp.lz" + +gUnknown_08DB9FFC:: + .incbin "graphics/decorations/decor_regirock_doll.gbapal.lz" + +gUnknown_08DBA020:: + .incbin "graphics/decorations/decor_registeel_doll.4bpp.lz" + +gUnknown_08DBA12C:: + .incbin "graphics/decorations/decor_registeel_doll.gbapal.lz" + diff --git a/data/pokemon_summary_screen.s b/data/pokemon_summary_screen.s index ac28d47c5..fc1c79096 100644 --- a/data/pokemon_summary_screen.s +++ b/data/pokemon_summary_screen.s @@ -40,7 +40,10 @@ gUnknown_0861CD14:: @ 861CD14 .incbin "baserom.gba", 0x61cd14, 0x18 gUnknown_0861CD2C:: @ 861CD2C - .incbin "baserom.gba", 0x61cd2c, 0xa7 + .incbin "baserom.gba", 0x61cd2c, 0x27 + +gUnknown_0861CD53:: @ 861CD53 + .incbin "baserom.gba", 0x61cd53, 0x80 gUnknown_0861CDD3:: @ 861CDD3 .incbin "baserom.gba", 0x61cdd3, 0x81 diff --git a/data/strings.s b/data/strings.s index 90ccad90f..2b88c6d03 100644 --- a/data/strings.s +++ b/data/strings.s @@ -1517,52 +1517,52 @@ gUnknown_085EA79D:: @ 85EA79D gUnknown_085EA7A9:: @ 85EA7A9 .string "{STR_VAR_3}{STR_VAR_1}/{STR_VAR_2}$" -gUnknown_085EA7B1:: @ 85EA7B1 +gText_Decorate:: @ 85EA7B1 .string "DECORATE$" -gUnknown_085EA7BA:: @ 85EA7BA +gText_PutAway:: @ 85EA7BA .string "PUT AWAY$" -gUnknown_085EA7C3:: @ 85EA7C3 +gText_Toss2:: @ 85EA7C3 .string "TOSS$" gText_Color161Shadow161:: @ 85EA7C8 .string "{COLOR 161}{SHADOW 161}$" -gUnknown_085EA7CF:: @ 85EA7CF +gText_PutOutSelectedDecorItem:: @ 85EA7CF .string "Put out the selected decoration item.$" -gUnknown_085EA7F5:: @ 85EA7F5 +gText_StoreChosenDecorInPC:: @ 85EA7F5 .string "Store the chosen decoration in the PC.$" -gUnknown_085EA81C:: @ 85EA81C +gText_ThrowAwayUnwantedDecors:: @ 85EA81C .string "Throw away unwanted decorations.$" gText_NoDecorations:: @ 85EA83D .string "There are no decorations.{PAUSE_UNTIL_PRESS}$" -gUnknown_085EA859:: @ 85EA859 +gText_Desk:: @ 85EA859 .string "DESK$" -gUnknown_085EA85E:: @ 85EA85E +gText_Chair:: @ 85EA85E .string "CHAIR$" -gUnknown_085EA864:: @ 85EA864 +gText_Plant:: @ 85EA864 .string "PLANT$" -gUnknown_085EA86A:: @ 85EA86A +gText_Ornament:: @ 85EA86A .string "ORNAMENT$" -gUnknown_085EA873:: @ 85EA873 +gText_Mat:: @ 85EA873 .string "MAT$" -gUnknown_085EA877:: @ 85EA877 +gText_Poster:: @ 85EA877 .string "POSTER$" -gUnknown_085EA87E:: @ 85EA87E +gText_Doll:: @ 85EA87E .string "DOLL$" -gUnknown_085EA883:: @ 85EA883 +gText_Cushion:: @ 85EA883 .string "CUSHION$" gText_Gold:: @ 85EA88B diff --git a/graphics/decorations/decor_attract_mat.pal b/graphics/decorations/decor_attract_mat.pal new file mode 100644 index 000000000..6f188b725 --- /dev/null +++ b/graphics/decorations/decor_attract_mat.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +255 230 222 +255 197 197 +246 156 156 +213 115 172 +197 189 131 +246 148 205 +123 82 74 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_attract_mat.png b/graphics/decorations/decor_attract_mat.png new file mode 100644 index 0000000000000000000000000000000000000000..16528d9f393ad2658efd5f61b6796e524b731885 GIT binary patch literal 307 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxQ3E?)^V{ z^xK>{SBuvi-P`-VpAIN&13a-`TY$KkHrw zyF5J-Q2DmYc6*4G-_GmD{;Vj|k~rhmbIUh7>A2?is4B*1at*&GZ+twZI$UYf#GsB!VDxWD_33tQU(D&A+AYBlMD?FfxNxXvZ~j3 zMRhw`CTU*XlC`Bfs5{9p$Wj3)g$#TOX2%2hj3q&S!3+-1ZlnP@TRdGHLnNk__Sy0s zGT>>A&%40m*pY2w-f=RHGu_>*irsD7Ay$Q)oD0E8pN&OMP5yMU?`=A>{iaW6+#Yx| zsT9nyH`R=i*I}CI{^4Nrt!Vm=E>>aFRSI%_g7a=m8t zQ|I+)@t6|m<&|)eTXQN?dT#scznc#2%4wW;bl%l@lXLvehy1(vlJ)FwHRGdu`W{yt s&Xg##xL$Q&(>2?kt!K;QjgQ*fGCU2|kiBqV2_wjJp00i_>zopr0C^U30ssI2 literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_blastoise_doll.pal b/graphics/decorations/decor_blastoise_doll.pal new file mode 100644 index 000000000..a4ad56936 --- /dev/null +++ b/graphics/decorations/decor_blastoise_doll.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +197 222 255 +131 189 255 +90 139 213 +57 90 131 +213 156 90 +230 189 131 +156 131 90 +98 82 41 +139 90 74 +0 0 0 +0 0 0 +0 0 0 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_blastoise_doll.png b/graphics/decorations/decor_blastoise_doll.png new file mode 100644 index 0000000000000000000000000000000000000000..00c55f229e4b92e8f120c578cb39af78c3fe081b GIT binary patch literal 371 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FkKX&=y!U@p z_f^ZN=Bsm}p6zX((;Sr)q}d(i1yl$D-@bhVGFp{6YJe1DNswPKgTu2MX+X|LPZ!4! ziK(F%_WB(*kZ65q&dfY}u1VmjfKEm6hL~$!s(lf^&8Mgau^AaC7`pb{JakP#(RBNS z-Ao5-KkV!bv6wXfq}{i4iN&d#ffuKU+EeqH({^)qwgv;)_kXa`N!e$)9Ta$-h2+Xt~vCuT-EBm~ch zuzqxN>2G$^o&c{7nef{C!sfn*w`8VF2$Q#1F7bNG>fm*mPwMaL|5{^}s%aV{1PU2X LS3j3^P6B!VDxWD_33tQU(D&A+AYBlMD?F=WO{F)cnjc zX|IH1b5>TCmzNh%9xD)=|2Z8f!B`UH7tG-B>_!@pli=y%7$Pw>Il+OgN5P3hoRPK3 z;lKhG79O`_Zf+hr290bi1%f|xn1l~0II-NVFsbfsY&giuQ4rmdxt^m#pj|krz)-M4 y!oYz?S5sfJT|hHaGgH9OfRT^+k6g=5Hbw?lX^~4OUHD#uT;%EM=d#Wzp$Py>;yDBW literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_blue_tent.pal b/graphics/decorations/decor_blue_tent.pal new file mode 100644 index 000000000..e38cb56af --- /dev/null +++ b/graphics/decorations/decor_blue_tent.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +148 172 255 +115 139 238 +65 90 189 +49 57 123 +0 0 0 +197 205 230 +164 164 164 +131 131 131 +90 82 74 +0 0 0 +0 0 0 +0 0 0 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_blue_tent.png b/graphics/decorations/decor_blue_tent.png new file mode 100644 index 0000000000000000000000000000000000000000..575b352410675d85ddb97ad49f62c1765868765e GIT binary patch literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fr>yy3-2Kim zYOkSXHBjd0*=I|ZENO0TjtcSuav|W`w{Jj(V*ddhAjMb`IGe(rTTq4?z1wTruT=9k<*mVPO7;qp?UFYXWYd{k%l z+Ny1`PgB13tftFo!iRXz_-~BsgM%L|Ij0y3@~5Y( KpUXO@geCw*tbV%y literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_breakable_door.pal b/graphics/decorations/decor_breakable_door.pal new file mode 100644 index 000000000..85ece26dc --- /dev/null +++ b/graphics/decorations/decor_breakable_door.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +139 189 255 +106 156 213 +213 189 115 +156 131 41 +123 98 8 +90 74 57 +189 164 74 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +246 246 246 +197 197 197 diff --git a/graphics/decorations/decor_breakable_door.png b/graphics/decorations/decor_breakable_door.png new file mode 100644 index 0000000000000000000000000000000000000000..01ba82d28a09d169f52be1765db7262dfc46372e GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxPa$|Fh;? zy}Gw}PP1lp5=WGm<=!P;Kyf(u_U+rzqeodpM0J5ej3q&S!3+-1ZlnP@6FglULnNl= zp5M#cV!*?iu>L{Y<+Be(BNT<+nhGjkIPAG)%FPd2mzF90aA$kk((ONS(sb;TM zXw&=_yTDuF!utDv`t?n7+rlNaD&ysm>Ip5cwLxz8 MboFyt=akR{06ej44*&oF literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_brick_desk.pal b/graphics/decorations/decor_brick_desk.pal new file mode 100644 index 000000000..16b581470 --- /dev/null +++ b/graphics/decorations/decor_brick_desk.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +255 180 82 +230 139 49 +189 90 16 +0 0 0 +0 0 0 +0 0 0 +197 197 197 +148 148 156 +106 106 98 +74 74 74 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_brick_desk.png b/graphics/decorations/decor_brick_desk.png new file mode 100644 index 0000000000000000000000000000000000000000..829e453497ddbd2e0b7d9ad95c5380ef81c1e4d6 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxQ1)f}V97 z?u`-vvLWE;(W6tQ%*o11^78V6i7`aT1nmWK7)yfuf*Bm1-ADs+dOTemLnNlw_U{&K zG2n5zZrLasFX?h_YCwbVt)?Ta0Sp@_Ydg5!je1smhCzDI$G&U77?$r6U{E)nSX}FC zy~_pyqa+&l$~Dr>%?Mo2bsviD8Z@0>)*mnAQyYO`njxgN@xNA D;RRo; literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_camp_desk.pal b/graphics/decorations/decor_camp_desk.pal new file mode 100644 index 000000000..0ac362c8a --- /dev/null +++ b/graphics/decorations/decor_camp_desk.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +205 189 123 +172 156 90 +148 131 65 +123 98 32 +82 57 41 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_camp_desk.png b/graphics/decorations/decor_camp_desk.png new file mode 100644 index 0000000000000000000000000000000000000000..b40429229a2b1b6377837b0d8b768d397c482166 GIT binary patch literal 265 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F&+e^WGbd_F zvtxCVLXf2wUQtVc^uvO%NQJ6w(>ke&0>5rddTAM;vJ`mPm zU0fD-Uz%g*-o{@i8uoESZ?69Nx>d4KJhdfmLgBpAYIeV-%wu2hg-dtw*Vxc>o;2c0gB_YLuFAYU2y(lptDnm{r-UW|$MIYF literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_charizard_doll.pal b/graphics/decorations/decor_charizard_doll.pal new file mode 100644 index 000000000..3e3e6bb79 --- /dev/null +++ b/graphics/decorations/decor_charizard_doll.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +238 172 98 +255 205 74 +222 156 41 +115 74 24 +164 98 24 +0 0 0 +230 82 65 +180 49 32 +0 0 0 +0 0 0 +0 0 0 +246 246 246 +255 238 197 diff --git a/graphics/decorations/decor_charizard_doll.png b/graphics/decorations/decor_charizard_doll.png new file mode 100644 index 0000000000000000000000000000000000000000..ffc3dfcef7b512e93dd7104f91e717dbfdd76a82 GIT binary patch literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxLHXlK!9d zx;IC&*h^wbk_1rXS&-uvLj@oM0=|9w_W#{cUuBu+Kt5whkY6x^!?PP{K+bJX7sn8Z zsk!G3vzQG9STC$k%g!}ivYB7;1ZT=p6Xt(LI}ErdhAiPe(!SAJTyswJ(i4n4mJV)Z zK0y%++EtdUmwfQAz)U^agK3J!{^j>7J+!z20}b4oRr{s*6XI5AQhgG~4v>4eOs~&rDM44}aA?_FC7@UWi|D&m);bGEz+n?Ew#?i~mbP0l+XkKQxJx= literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_colorful_plant.pal b/graphics/decorations/decor_colorful_plant.pal new file mode 100644 index 000000000..996b183d2 --- /dev/null +++ b/graphics/decorations/decor_colorful_plant.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +205 180 115 +180 139 98 +131 90 57 +156 222 90 +139 189 139 +98 148 98 +41 90 57 +106 189 255 +255 123 172 +255 213 74 +0 0 0 +238 238 238 +0 0 0 diff --git a/graphics/decorations/decor_colorful_plant.png b/graphics/decorations/decor_colorful_plant.png new file mode 100644 index 0000000000000000000000000000000000000000..cc0efecc7461945f36207b1333691ed8fcecfb2e GIT binary patch literal 371 zcmV-(0gV2MP)>w2NYcS~;BFT8q7lVw7SjS~+UH|Nnce|J6zW008dp?f?J)fCl?%00001 zbW%=J06^y0W&i*H@kvBMR2Y?AkTGt;FcgM=k8F-qxo{3nPzi3p1+uh4Oe}R;x-iAw zUl(x!rdS)Jm{my!sOB!VDxWD_33tQU(D&A+AYBlMD?Fx7_RQ-rF73 z9ib~XgS6>JD)YH|^Wt~$(69C-{ Bd-4DP literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_fire_blast_mat.pal b/graphics/decorations/decor_fire_blast_mat.pal new file mode 100644 index 000000000..ea2301df2 --- /dev/null +++ b/graphics/decorations/decor_fire_blast_mat.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +255 180 82 +238 148 41 +213 98 24 +139 65 41 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_fire_blast_mat.png b/graphics/decorations/decor_fire_blast_mat.png new file mode 100644 index 0000000000000000000000000000000000000000..510675ee62365ac87e8c4f3e242318fc9a7b7db5 GIT binary patch literal 287 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxQ1)g5FKh zyqYA@?WhUl;sSG*m(~I07)yfuf*Bm1-ADs+=6bp~hDb~eop6x1#ej#!m;J*7smSF` zFxop*lcM!$XacMIElwgbFB zxmP=EZVFk}zg95arT>+^n{7mKB=ccu7nSH$&5U=}R!T(|vNPKpKVW_7Mpv|Opqv0Z zb4Api%VBpCRm>y#;%Dx6b1M>d-e+{(e#W`hiFZ;e?Vi2=$=t9(BTghVbUnyNp00i_ I>zopr01)G1-2eap literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_fissure_mat.pal b/graphics/decorations/decor_fissure_mat.pal new file mode 100644 index 000000000..d2a4efb6d --- /dev/null +++ b/graphics/decorations/decor_fissure_mat.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +205 189 131 +189 172 106 +156 139 74 +123 106 41 +98 74 32 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_fissure_mat.png b/graphics/decorations/decor_fissure_mat.png new file mode 100644 index 0000000000000000000000000000000000000000..6de66ef9d6b8a03746a29b989a64a1f5e75294d7 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F&+cvByC!Q+ zw^wzRW|EfzP!bpL{oR}llw&Lj@(X5gcy=QV$XVd&;us<^HFUy3-a`gFuJ!tJRvux= zi%<|_ez1dC#C6W;#=qeQe!Au+Yx-~8FY=nz;=1~|0A}-U?~@0%XOt}ZUn3J9@|{)f zk-^z*iPNebi{|_FujTb_j%WUrGb4Fc@R#YY+72#ZGb!zm41VW3iDk2$%w)H!2IFOS zUjJi@6Y^emrxD2BEqSqb+HC!^yBA$l^oXDJnZIw5;N6U!Z=TiuW%zMSts*PH`!>i^ Mp00i_>zopr08^%Ed;kCd literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_glass_ornament.pal b/graphics/decorations/decor_glass_ornament.pal new file mode 100644 index 000000000..1027a9501 --- /dev/null +++ b/graphics/decorations/decor_glass_ornament.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +0 0 0 +189 230 255 +156 197 255 +115 164 238 +82 139 189 +57 98 131 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +238 246 246 +0 0 0 diff --git a/graphics/decorations/decor_glass_ornament.png b/graphics/decorations/decor_glass_ornament.png new file mode 100644 index 0000000000000000000000000000000000000000..fcc895eb9f0b622bdd5f0bf63de4ba3f4b279dca GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl7C`|SUm zqyLMSybJ2yYnjvx5rmWPzI_9-BPO5Q52P4Ng8YIR9G=}s19BF5x;TbNOwH{-$aTm- zz-764KkpTOA+ri$uDe%Ow>MpvOIpVz_Isi2cj-I1B^O^g+~YfGi%Tw-}D$wh9 z&c|Fv?b8e!^A9zNTMF+VbbVABktrd%WLy1S(fX?CyW2za0uAI1e@Fxbp3Ydot5Evn zXl0+QMXOzTjA**+T8o+5_TAHd9JJffblO{UX`G;{ooSFKi&&~f;JxT$@1(aL+-p5w Whf#g1yiRN>$Tyy@elF{r5}E)d=VuWB literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_gorgeous_plant.pal b/graphics/decorations/decor_gorgeous_plant.pal new file mode 100644 index 000000000..782b82eef --- /dev/null +++ b/graphics/decorations/decor_gorgeous_plant.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +180 222 139 +139 180 139 +90 139 106 +49 82 41 +0 0 0 +148 115 82 +115 82 24 +0 0 0 +230 230 230 +164 164 164 +106 106 106 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_gorgeous_plant.png b/graphics/decorations/decor_gorgeous_plant.png new file mode 100644 index 0000000000000000000000000000000000000000..dc8639c65719314c01888a632ea76484553f2fbc GIT binary patch literal 332 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fx7_RQ-qIb_ zon;uL36z;q98?@60c1RT_H4(f%)3^gO_b^{s^5Ear3)wrewzGN{PkVH1Yu=q#OXoO8TJy57D)LRmE04Q;+{=6G1lH(r zYK9+*k)0;AFrqOs({}qeagN6pJUaZdMYnGCs;ktVa#rzj%$ok)rg!!oS{1cKtaM4G z%hlUCmX|&;Wu2dDare_hsfS5=$LD@1+`j+0`;)o%FTd>e7muE(`&W8dbY1*oBc6W@ XH~ck^{j)2d1@f$?tDnm{r-UW|7@LZd literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_hard_desk.pal b/graphics/decorations/decor_hard_desk.pal new file mode 100644 index 000000000..7aa8154ab --- /dev/null +++ b/graphics/decorations/decor_hard_desk.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +197 197 197 +156 156 156 +115 115 115 +98 98 98 +74 74 74 +139 139 139 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_hard_desk.png b/graphics/decorations/decor_hard_desk.png new file mode 100644 index 0000000000000000000000000000000000000000..aa0c7feeacea2b5796fb4adb9e3876d9c0625b8f GIT binary patch literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fj~+cbXU?4B z;^L&FBrh+o?(S}&JXUab=}ZTp1Y=2%UoeBivm0qZ&S6g%#}J9BvHb`6nhXS7+MDO8 zy4fvod2ggz!yvIH?RKKHKQfk(p*W$&1CKguDVrQ zR_H$8q-I+alc#(~TaaJWrrxz^;ZQ54B!VDxWD_33tQU(D&A+AYBlMD?Fw`@5&Wy+kW zsHp#2f}V979*yFN(gdlmuC8`;bj->s2C^X_)A{FnAd9gi$S;_|;n|HeAg9aI#W6%; zYI4E>CJ9znR!NE8=}Q?qj~?Uc(K~kR#uP)2rYlPs8Ji6S95`fNu}ECn)Wa&#v(}+y zV>bhHvRHs&7*mewjiRMX7ka2AD<7EF&crxjw-19g<0he;%8V&O7w%oYeOgi?rHq?t z?@L_<<%W08%ugK{J}T4&#O-x&a4h)lxIi(QC4psGA;Yl-?TNyl>p=fS?83{ F1OPY{SLXl# literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_lapras_doll.pal b/graphics/decorations/decor_lapras_doll.pal new file mode 100644 index 000000000..c7d2fe61a --- /dev/null +++ b/graphics/decorations/decor_lapras_doll.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +189 230 255 +115 180 246 +74 139 189 +32 90 139 +0 0 0 +0 0 0 +246 197 131 +222 156 98 +197 156 123 +106 74 41 +0 0 0 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_lapras_doll.png b/graphics/decorations/decor_lapras_doll.png new file mode 100644 index 0000000000000000000000000000000000000000..517553a4a9fdda370ac01ffc620164080ff1fddb GIT binary patch literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxNxX{ugig z=GDDdA*vh51%hu!oA1p@Iy$F1%S#i){q_w=a$SlA>18Yl@(X5gcy=QV$hqz5;us<^ zHMD@~o&f)4a4g-3V!PC{xWt~$(695!GlzadH literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_powder_snow_mat.pal b/graphics/decorations/decor_powder_snow_mat.pal new file mode 100644 index 000000000..9f365a3da --- /dev/null +++ b/graphics/decorations/decor_powder_snow_mat.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +238 238 246 +180 205 255 +131 164 205 +197 222 255 +213 238 255 +98 131 172 +148 180 222 +49 82 123 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_powder_snow_mat.png b/graphics/decorations/decor_powder_snow_mat.png new file mode 100644 index 0000000000000000000000000000000000000000..82dbbfa668a651dde56af7e89fa09088815347ef GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F-@W^`vM*W2R1?m|Ik97-hf9gGe%iRas`{8IcBrA< zuq$Vtx^Td=*zKo`d_5VyB&{uF;`i8)&hd^v%AWzV2T7EA8_i k{#DgkPuluZf6bDA&HJKL%lW@uX*zopr0M34Sr2qf` literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_pretty_desk.pal b/graphics/decorations/decor_pretty_desk.pal new file mode 100644 index 000000000..7681a17cc --- /dev/null +++ b/graphics/decorations/decor_pretty_desk.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +189 222 255 +156 197 255 +0 0 0 +131 164 246 +49 82 123 +0 0 0 +0 0 0 +0 0 0 +180 180 180 +131 131 131 +90 90 90 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_pretty_desk.png b/graphics/decorations/decor_pretty_desk.png new file mode 100644 index 0000000000000000000000000000000000000000..5be05ebcbfb8e625a5b9a0f97281a7265f12b91e GIT binary patch literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxNx<{?9r3 zAINB4^35=)8pwcvEnBuUH#bK`MSc7B4JfieqnaN`F_r}R1v5B2yO9RuEc0}643U_c zJHe2T$&iP|oWEnr>xZIlQ!+c&JrQ0o<hdqdReP*&2$p%)V==eTFVvb3I2>08ah^PN9ScYSKrvS zo;xRl{dQXQTc*=DFUT4GiD6i-S1V{+toFynX5Eoji=JN4nQ_|dqv@8zYYy9crg|!^ jJy)Zs##S-!cV+}bPKHyJ-A<9eAb)wf`njxgN@xNAK1guQ literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_pretty_flowers.pal b/graphics/decorations/decor_pretty_flowers.pal new file mode 100644 index 000000000..c3b0ffce9 --- /dev/null +++ b/graphics/decorations/decor_pretty_flowers.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +0 0 0 +205 180 74 +156 139 32 +90 74 49 +123 106 41 +115 180 98 +74 123 57 +41 82 32 +255 205 180 +123 74 49 +238 156 139 +246 246 246 +222 197 197 diff --git a/graphics/decorations/decor_pretty_flowers.png b/graphics/decorations/decor_pretty_flowers.png new file mode 100644 index 0000000000000000000000000000000000000000..b9fc0f5de24e131df4f635e4bf2d3d4f01b3a0f2 GIT binary patch literal 318 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl5MyTxlx zw?dScVRe>f@s=d7YD>)^h5u)_RC^h|o74U6+qZj1kN#LTX){nMV@Z%-FoVOh8)-n! z9#0p?5Q(X|{kD8f4k9h>_ma#nzVP~>7j{i#wfcm6F8m4Gv)#9s8{Ru`fK{R8p2Hi@ zFu709&x^$0%ei;vG}Bs{L#y1AW1Fr=H++=(Ih8Rr>TnpJbC`?eq#t>Lwt0sCI)fI7 zXtX{*?-aaWfupD^;hve+WeMSE)q>4QocbG?(hrJm31YjI(Hzji#A+ISEq1qnQ_~{z zvsTtM%Vx7#UwdQl-O%>!wHtEg)h84t%B!VDxWD_33tQU(D&A+AYhlMD?F-`!ht^=S8& zC0SFNy{eN8gB%rr@>s#F@B6!f5{xB5e!&b5&u*jvIrW|{jv*3LYy0=|wi@uX=wHo# z+r@Z~t%dglS0b|yH}9JBs)Ai2b?YqVKKZOJT`_6ZAzsA;fA{LYT)K=y#3uBTbl>H` z8?Tox@yffL!X}=4B!5|G(c~T{pS?L#@2G69^qrb=nd?oAbNL6Q?I%*T-kz15FaKxS j%|q<{y%S>fc0cy}SE`==bK|sWAP0N8`njxgN@xNA!I)f9 literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_red_brick.pal b/graphics/decorations/decor_red_brick.pal new file mode 100644 index 000000000..f9d647dda --- /dev/null +++ b/graphics/decorations/decor_red_brick.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +238 123 123 +189 74 65 +148 32 32 +123 16 16 +106 106 106 +74 74 74 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_red_brick.png b/graphics/decorations/decor_red_brick.png new file mode 100644 index 0000000000000000000000000000000000000000..3481044ddeca9ad4ae0660ce7ac760dd2097dd07 GIT binary patch literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F-&I%d^>Un| zpinI!kd>9?<>dvG#|lD|!#aQxj3q&S!3+-1ZlnP@37#&FAre!Q6CBuj6r4E38Cjbg z4lH0{;c+|W=H{Ve(8$J8AoxRvN%)Y06U*HSlj`2ahJ&me1<@^;>p40E+J%z}3B!VDxWD_33tQU(D&A+AYBlMD?F?-f_?^$O}% zPzX{G0Lm0E$#Sf=lnBxUvd^wbno}K=6=Vry1A*_%_8&lsu_VYZn8D%MjWi%haGCC+|Ipd<2=CW zF0hb8iD#m2lLYspsm&3S3OG4CS|)c*=4$T9?$ADb#kiVD(ki*{T*8VOn>Wu*bbH_H z*Y>HeuZXSl<j!OyQ<{GWKb&TMNHxHwgI#8ihW6ot^zZLB^E8#e=Q27m&$4); p~!F%@Dq?%JYD@<);T3K0RRHaXrKT9 literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_red_tent.pal b/graphics/decorations/decor_red_tent.pal new file mode 100644 index 000000000..61951623b --- /dev/null +++ b/graphics/decorations/decor_red_tent.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +246 123 123 +222 90 90 +180 49 49 +115 49 57 +0 0 0 +197 205 230 +164 164 164 +131 131 131 +90 82 74 +0 0 0 +0 0 0 +0 0 0 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_red_tent.png b/graphics/decorations/decor_red_tent.png new file mode 100644 index 0000000000000000000000000000000000000000..22e435691ce33c3c507181063a2833dec72d321e GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fzg1V?i;CJ} zXjp7$36wc{_SuppOPZUTqk_DETnPB~?HiC0_Kmp_NHLZK`2{mLJiCzwyUv6+k@!~tDCEstaoNsG2Wi?Dr_Mme~`vI-6KmUFNl?qsou2f3D3XvjGBJ` z4!g^>{BIRFtE3W9`rwU$tiu7FnfWSCe2Uk<_uVV~yQF$foX69tv+i>rtYBJ~I%|UF z4BKa{UaqHB#9I|?N%*WVH~iLh|L$c|>nxK6`?I&*k!g20D=Ascd|g~XOUmQTBc6;2 zlFp7T!c%)DT-smf@S>lG)9Z8zuZh93C&58KtSoDpJ~28?4vIWKjT;m!44$rjF6*2U FngAV#cjf>9 literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_regice_doll.pal b/graphics/decorations/decor_regice_doll.pal new file mode 100644 index 000000000..39404f681 --- /dev/null +++ b/graphics/decorations/decor_regice_doll.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +238 238 255 +180 189 205 +139 148 172 +82 98 115 +115 123 139 +0 0 0 +0 0 0 +246 180 65 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_regice_doll.png b/graphics/decorations/decor_regice_doll.png new file mode 100644 index 0000000000000000000000000000000000000000..88a28df6ddea203dffeb5ed6beb6c31aacb3cab3 GIT binary patch literal 346 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxLI`{%_fP zwtLE&prqpB>TaM25PaL>2w}iU$-Vi$Kn`O`kY6x^!?PP{K+X+M7sn8Zsi6~m^I8me z-1g^0s7oEPb@RNb%u}s$#!A^k?}AtH!iV$z25I@eJ~~t^ezIsuu(?`A>Sj{OAgB!VDxWD_33tQU(D&A+AYBlMD?Ffjl7CvLvax z*f7Wo#64RaG{q65ZLgOENDc-jUrvkwvKdQ){DK)Ap4~_Ta!z`>IEF|}jqP{jYBmsX zt0p3gcHe^*{8Res{_2h}|}T<>uxeSGt5)$L!Ku4dkRs}pnY#`e|AuP&NnK4s=S{rT^XTwpj@ zF0#BM#H(?`0#~l0NphC`!k>zR&Ik)m$<3-%DdUlH-<9qEx1?Kaad5Zep45Gf!i$~H zmMS;>JNRPW4-UC6c8jGy3$L7Mdu3-qLl*Pz-w(FlI=OY;mHId7`?}@5kC=QtZD{-j OB!VDxWD_33tQU(D&A+AYBlMD?FfxLI`-W@%9 zbjgw>)z!^GK~X>vWUwa45yD-!r))Bi#aI&L7tG-B>_!@pbJx?wF+^gjZ~xh@W(R?m z)85~*7WbVORGYB*OoRRg`}CVR)m$30W(LPy-g7R@z06bIPHNYRS4?rw&u+LO)S)EA zTbNO@U;dfW!`~Wm|7?Ujr_28RYLyfs8-Hfr?)f~ng|9j!ydCQ29NkgAV48H`$B-pc zHE@FK0Hh0*DZF%PcY@$#7`zuxBlAgKotf?NGXrY9L%g_5oX1fcvB!VDxWD_33tQU(D&A+AYBlMD?F@7=q%WXY1f zd-ryCcV}f~1qB5?J6gPVidS=z7f>MteEaqd$e1b0_!&qsmIV0)GdMiEkp|?v^>lFz zk(lZ`VPoDQ0}Nz{C0C;G_Ok2T=hA)%xSjZ<B!VDxWD_33tQU(D&A+AYBlMD?FfxN3n=j>e) zHKp1x%1fd-OJU6vFQ6bMuEak7F*Wy`Enl+%59>6ysdTZUgi~YU-?+Xh%PpUYcpZUN^rgGg*)pz&yFP!VGu!_t2YLD?Tg;evi zteVr=bWVC~wY#jk{f_XZMQ0yQiWlAK!8djGnTe;kd5WE7pVsYutNws_*DaOsQ*|jI PFEV(#`njxgN@xNAPh4lH literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_slide.pal b/graphics/decorations/decor_slide.pal new file mode 100644 index 000000000..395694fa3 --- /dev/null +++ b/graphics/decorations/decor_slide.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +148 189 238 +106 148 205 +65 115 172 +180 222 255 +0 0 0 +0 0 0 +0 0 0 +213 213 213 +189 189 189 +156 156 156 +106 106 106 +0 0 0 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_slide.png b/graphics/decorations/decor_slide.png new file mode 100644 index 0000000000000000000000000000000000000000..8a5dbada5b0a905c0efc85f4eee3bdfaa6c73b51 GIT binary patch literal 293 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Fr|f-~HRY^h z@tQ67{sUzo;Of<@d-v|0GiOd#Ru)j?+qZ8(Qpjt?B_PFE666=m;PC858j!Qt)5S4F zVruIIL%u@>Jg#T&HJ-Wa6{#Hhl*wdfvH39$zX{R`Vqq>v6)$aCIH&Rbu@I+*ABQh@ zr`{~;P+@(1%*f!Fzk;n3r($=??(nO#lDsB9N|^k`@RFnff5IOoo~O?aon6-0n*Ju; z`ibnVSZ1CAsSo>jO01?O{blvAF?sWk$ys;t-^3-KI4?KOUbiVFeA%(hVzaZjChpU{ jV5V<;HriMBY4v>3u7C%tmL1;%bS{IZtDnm{r-UW|Oy6|$ literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_snorlax_doll.pal b/graphics/decorations/decor_snorlax_doll.pal new file mode 100644 index 000000000..21026b10d --- /dev/null +++ b/graphics/decorations/decor_snorlax_doll.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +0 0 0 +131 139 164 +82 90 115 +0 0 0 +255 238 222 +255 197 148 +222 156 90 +139 90 49 +172 106 49 +230 172 123 +0 0 0 +238 238 238 +189 189 197 diff --git a/graphics/decorations/decor_snorlax_doll.png b/graphics/decorations/decor_snorlax_doll.png new file mode 100644 index 0000000000000000000000000000000000000000..6ff891c13674fac1bcf1df2debc864ca6c90a1fe GIT binary patch literal 337 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl5+?p_iU zRSabOe|PWy(JA-lM0H0QuE{cdwx${=`0m}iy?c*7YB^L7>5`2{mLJiCzwjr1sapoV7 zelh><>i6V`H#(qxZh~ad>P3lJSNYFKyjUPGQ^DYZfXE`P3s(ad`WQdwb#~6|2-Cl( zv7e#EI_5=j_CYr}%lZ9mZ#*AmyLEi|u;R70->QDM|Hu7GJCB%jI6YM?@U&Z~*B!VDxWD_33tQU(D&A+AYBlMD?FfxNv-lIAo! zR!3=OMR@_axPZf}cXmKI#*!evUP>5#xAnMr37Cgn6aI$UYw5NA{nWK#0kAn-%SNo~W;#;FHV1v$TU9bj%^TrHd6 q-@KQfkE6p%r>w!2_uD=NoeIXkI~2@$f1BB!VDxWD_33tQU(D&A+AYRlMD?FfxIb4r(~@u z4w@3xJtyhj+3qb%lFsgJHcYYvN+AQ`)RneCK4VFcUoeBivm0qZ&Kge_#}J9Bp%V=G z4jBlrOrO@}@#o1I<_nP>W?kA*Qgs6M3WxqV2DLTS7sV-egnv49Z*ra~+qSBkH(56? zzTqlbv3ud3JLUIEwVS@%y66N8wpNJ7dq2s z5}ySnPb)li&vH3yVUJ+uOyNl@@69MY6?av-KwNufRPr&+YHh)r9+8!v_c~lsR!?c2 l{^U>deh(M3y!Z7_*4jNWv^te#B4-Bjl&7no%Q~loCICiybp`+c literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_stand.pal b/graphics/decorations/decor_stand.pal new file mode 100644 index 000000000..a85f0b7b2 --- /dev/null +++ b/graphics/decorations/decor_stand.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +255 180 156 +238 115 106 +197 65 65 +0 0 0 +0 0 0 +0 0 0 +197 197 197 +172 172 172 +131 131 131 +106 106 106 +0 0 0 +0 0 0 +246 246 246 +0 0 0 diff --git a/graphics/decorations/decor_stand.png b/graphics/decorations/decor_stand.png new file mode 100644 index 0000000000000000000000000000000000000000..86b1e4d1fea56b15a539b02b2bb4cef01a293da1 GIT binary patch literal 264 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F|8JS|t~l$c zqa#ol0*)R%x@OIq=H}+CtSpGgw{PEo48zu2Q9z2ZB*-tA!Qt7BG$5zV)5S4FVrp-% zAs3UO2&;POtO~Yj?#s_>82uN_OW5wUlEtP+v$dY>{yQa|NlL-CCsORbeAs&EG*78bmC zjoBNQ##ioDT)V)-Vd949you}_58P~?9%}f;`g>B~XCXC~NRV?qUHx3vIVCg!05Te6 Aw*UYD literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_surf_mat.pal b/graphics/decorations/decor_surf_mat.pal new file mode 100644 index 000000000..17be591b7 --- /dev/null +++ b/graphics/decorations/decor_surf_mat.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +205 238 255 +164 205 255 +148 180 255 +115 148 222 +57 90 156 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +246 246 255 +0 0 0 diff --git a/graphics/decorations/decor_surf_mat.png b/graphics/decorations/decor_surf_mat.png new file mode 100644 index 0000000000000000000000000000000000000000..d74cb97bb951238e731ba18577f5230c92fdbd93 GIT binary patch literal 298 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?FfxNTt{x3QE zf6A8s#Z&HCM$G|=pn-4S{sTpvKScTiDaMi@zhDN3XE)M-oE4rfjv*3Lb0;`*9WoGc zS#F-;@YYpm`c0G4o4(%}9e3-nEEQkpx&Gmk=&i2oMn0dM+r$%ekB0Va*_*nf%;Bl> zhS_h7!dD%+@tyJTV&54$?8}U0Yo6HNtP4%!z8Tc_%;&T5AfI`<`njxgN@xNAheUJ= literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_thunder_mat.pal b/graphics/decorations/decor_thunder_mat.pal new file mode 100644 index 000000000..fbe488860 --- /dev/null +++ b/graphics/decorations/decor_thunder_mat.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +0 0 0 +0 0 0 +189 222 255 +172 205 238 +139 172 205 +139 156 164 +255 230 123 +90 106 115 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +238 246 255 +0 0 0 diff --git a/graphics/decorations/decor_thunder_mat.png b/graphics/decorations/decor_thunder_mat.png new file mode 100644 index 0000000000000000000000000000000000000000..1c5c56e332eb5f415a253384250666829a8fddfe GIT binary patch literal 315 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?Ffjl7Cd+-06 zv+ugsob8^oAF^Gfz+d^yEg+8u17A{MJ*= zW4c5qGo3fO?fW@B?z-}yO*|T_xaU~8`WPm@+ATTPi_GrCwFRx2z2~m~ zJ>L~xZ+PBiUDyzQ?eUcA%^oh=HwBs;bS6w-wcNtnw59O2^>6D7s?nELE53}|cwF;) zo?FS{r_a1UJ7>6`!w%h{YHGIr-k+2a%3zOoSHzJ;C7V>gTe~DWM4f@ZNtl literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_tire.pal b/graphics/decorations/decor_tire.pal new file mode 100644 index 000000000..18a3279fc --- /dev/null +++ b/graphics/decorations/decor_tire.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +0 0 0 +238 238 238 +189 189 189 +164 164 164 +131 131 131 +98 98 98 +74 74 74 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_tire.png b/graphics/decorations/decor_tire.png new file mode 100644 index 0000000000000000000000000000000000000000..e394ebbd401f02ba167b8d4e970bd9c1d01898fb GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlYq>3@80d*yLZWw zCC$yvNl8gwUS2>!tl-1jCDlL)#*!evUmY~R!a|FW}55rNy%gV{r}rSmv~2N zdTK}spZGF)VMeaSG|dFo%UUP8U#PCU^^eW&0MiLm*@lYtjWJz)IrfoV*V7lAyfu%j z_~yH?JHfL$_a^UJ_@6OFA=Krd3=7X^#`4)ZXRlahY=3W?o*=jFS=QY0$J_o098dm_UTRq-6UiWg_+lSjh-t%B!VDxWD_33tQU(D&A+AYBlMD?FkFE(?(rwtB zB@pB&0F(iODfgnXwitRfODIH1Ktv$qbfGyiKo(<3kY6x^!?PP{K+Z-_7sn8ZslENS zd`%7lt@5p+XY&?yZYf|^Vps6UXNsdCXH+RGCm#8H z&$Wl+m=t%uZ~wWSEJ-|9EcR=72YX++y3zIGHD0Fv@}9(dyE{Jqy}c$s?)8F@RyAMl sH&Z6vcvjh|ar%Vwsrx%G+ov61zmTi$_kFjdQKoCSnm5VgDU~GIb`3nDl@!Epa7OD;A(%K+J zWm>6prQ!SNC}juoqw`A@?i`R-9|*b;F300000NkvXXu0mjfB!VDxWD_33tQU(D&A+AYBlMD?Ffjl6{nzF{L zc#36GwWVX$vn^R?rvz>3wk-D21WH}KdiC44Z%dXe(e3@C4dgSH1o;IsI6S+N2ITDX zba4!kn3_Amkc-Jsz_nhBdp3)UfWLCjN2Wzzo#t#2d-u*#NBkpSRMnKVHizaNIBMU0 zbWz<2<;iFM%w+kYpT1h@8Rv`@f9|wD2<%MZFg;{n>1=kaNx+uxozJ}4pM8YqxU}BR z<1lnNoVfp=#d3>x3zfK*MyzKoTgBe-lUvy(mT}e*XaDTO8@%Oi7d?M?YSwwK?s>{K z>yB*M_;T8PWB%TvvrqQDw~C2BFUH&I(EF+A?6JEu-QTt*7AwEoAOC@E>Ut}`OP$-} QfIeaHboFyt=akR{0CfU`Jpcdz literal 0 HcmV?d00001 diff --git a/graphics/decorations/decor_yellow_brick.pal b/graphics/decorations/decor_yellow_brick.pal new file mode 100644 index 000000000..cfdd874ad --- /dev/null +++ b/graphics/decorations/decor_yellow_brick.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +98 197 98 +49 49 49 +255 230 106 +222 197 49 +180 156 8 +148 123 0 +106 106 106 +74 74 74 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/decorations/decor_yellow_brick.png b/graphics/decorations/decor_yellow_brick.png new file mode 100644 index 0000000000000000000000000000000000000000..cb865760ca9c5d2c013db4008a76d769a7dd1fde GIT binary patch literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^96;>B!VDxWD_33tQU(D&A+AYBlMD?F|3AyRchqpp z9F8f~3|U!OUS3{6d90xQ%JxE_1Y=2%UoeBivm0qZPJ*Y4V~E7mb^*;y%}fD914cgPKXNTM*%%pIrA02Cbm4mqa*?O2pUXO@geCyTemTtm literal 0 HcmV?d00001 diff --git a/graphics/decorations/unk_85a6bb0.pal b/graphics/decorations/unk_85a6bb0.pal new file mode 100644 index 000000000..4239a1f5e --- /dev/null +++ b/graphics/decorations/unk_85a6bb0.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +115 205 164 +255 255 255 +98 98 98 +213 213 205 +230 230 230 +197 197 197 +0 0 0 +238 238 238 +197 197 197 +148 148 148 +255 0 0 +180 0 0 +255 197 197 +82 82 255 +49 49 180 +197 197 255 diff --git a/graphics/decorations/unk_85a7308.pal b/graphics/decorations/unk_85a7308.pal new file mode 100644 index 000000000..e7717d74e --- /dev/null +++ b/graphics/decorations/unk_85a7308.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +115 197 164 +255 213 180 +255 197 148 +222 148 115 +123 65 65 +57 74 123 +41 57 98 +24 41 82 +16 32 57 +222 230 238 +255 197 90 +189 156 90 +255 98 90 +197 65 65 +255 255 255 +0 0 0 diff --git a/graphics/decorations/unk_85a7328.pal b/graphics/decorations/unk_85a7328.pal new file mode 100644 index 000000000..e106ce693 --- /dev/null +++ b/graphics/decorations/unk_85a7328.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +115 197 164 +255 222 205 +222 164 148 +205 131 115 +123 90 82 +98 98 115 +41 57 65 +164 106 82 +74 49 57 +205 205 222 +255 197 90 +189 156 90 +255 98 90 +197 65 65 +255 255 255 +0 0 0 diff --git a/graphics/misc/decoration_unk_85a7358.png b/graphics/misc/decoration_unk_85a7358.png new file mode 100644 index 0000000000000000000000000000000000000000..2dc8ed60474f2fc987469d3c40fd34f6cac9a227 GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx+BpCi@`0fExa-J@ZAsjQ4e`s*9ed1~Qf6!rq jquik%9{g-~f@T;qy!20=JAwc05|9p0S3j3^P6secretBases[0].decorations; + gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPos; + } + if (gUnknown_0203A17C.isPlayerRoom == TRUE) + { + gUnknown_0203A17C.items = gSaveBlock1Ptr->playerRoomDecor; + gUnknown_0203A17C.pos = gSaveBlock1Ptr->playerRoomDecorPos; + } +} + +u8 sub_81269D4(u8 idx) +{ + u8 *winidx; + struct WindowTemplate template; + + winidx = &sDecorMenuWindowIndices[idx]; + if (idx == 0) + { + template = gUnknown_085A6B90[0]; + template.width = GetMaxWidthInMenuTable(sSecretBasePCMenuActions, 4); + if (template.width > 18) + { + template.width = 18; + } + *winidx = AddWindow(&template); + } + else + { + *winidx = AddWindow(&gUnknown_085A6B90[idx]); + } + SetWindowBorderStyle(*winidx, 0, 0x214, 0xe); + schedule_bg_copy_tilemap_to_vram(0); + return *winidx; +} + +void sub_8126A58(u8 idx) +{ + sub_8198070(sDecorMenuWindowIndices[idx], FALSE); + ClearWindowTilemap(sDecorMenuWindowIndices[idx]); + RemoveWindow(sDecorMenuWindowIndices[idx]); + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_8126A88(void) +{ + u8 idx; + + idx = sub_81269D4(0); + PrintMenuTable(idx, 4, sSecretBasePCMenuActions); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(idx, 4, sSecretBasePCMenuCursorPos); +} + +void sub_8126ABC(void) +{ + sSecretBasePCMenuCursorPos = 0; + ScriptContext2_Enable(); + sub_8126A88(); + sub_8126C08(); +} + +void sub_8126AD8(u8 taskId) +{ + sub_8126ABC(); + gUnknown_0203A17C.items = gSaveBlock1Ptr->secretBases[0].decorations; + gUnknown_0203A17C.pos = gSaveBlock1Ptr->secretBases[0].decorationPos; + gUnknown_0203A17C.size = sizeof(gSaveBlock1Ptr->secretBases[0].decorations); + gUnknown_0203A17C.isPlayerRoom = FALSE; + gTasks[taskId].func = sub_8126B80; +} + +void sub_8126B2C(u8 taskId) +{ + sub_8126ABC(); + gUnknown_0203A17C.items = gSaveBlock1Ptr->playerRoomDecor; + gUnknown_0203A17C.pos = gSaveBlock1Ptr->playerRoomDecorPos; + gUnknown_0203A17C.size = sizeof(gSaveBlock1Ptr->playerRoomDecor); + gUnknown_0203A17C.isPlayerRoom = TRUE; + gTasks[taskId].func = sub_8126B80; +} + +void sub_8126B80(u8 taskId) +{ + u8 menuPos; + + if (!gPaletteFade.active) + { + menuPos = GetMenuCursorPos(); + switch (ProcessMenuInput()) + { + default: + PlaySE(SE_SELECT); + sSecretBasePCMenuActions[sSecretBasePCMenuCursorPos].func.void_u8(taskId); + break; + case -2: + sSecretBasePCMenuCursorPos = GetMenuCursorPos(); + if ((s8)menuPos != sSecretBasePCMenuCursorPos) + { + sub_8126C08(); + } + break; + case -1: + PlaySE(SE_SELECT); + SecretBasePC_Cancel(taskId); + break; + } + } +} + +void sub_8126C08(void) +{ + FillWindowPixelBuffer(0, 0x11); + AddTextPrinterParametrized(0, 1, sSecretBasePCMenuItemDescriptions[sSecretBasePCMenuCursorPos], 0, 0, 2, 1, 3); +} + +void SecretBasePC_Decorate(u8 taskId) +{ + if (CountDecorations() == 0) + { + StringExpandPlaceholders(gStringVar4, gText_NoDecorations); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8126DA4); + } + else + { + gTasks[taskId].data[11] = 0; + sCurDecorationCategory = DECORCAT_DESK; + SecretBasePC_PrepMenuForSelectingStoredDecors(taskId); + } +} + +void SecretBasePC_PutAway(u8 taskId) +{ + if (!sub_81299AC(taskId)) + { + StringExpandPlaceholders(gStringVar4, gText_NoDecorationsInUse); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8126DA4); + } + else + { + sub_8126A58(0); + sub_8197434(0, 0); + fade_screen(1, 0); + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_8129ABC; + } +} + +void SecretBasePC_Toss(u8 taskId) +{ + if (CountDecorations() == 0) + { + StringExpandPlaceholders(gStringVar4, gText_NoDecorations); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8126DA4); + } + else + { + gTasks[taskId].data[11] = 1; + sCurDecorationCategory = DECORCAT_DESK; + SecretBasePC_PrepMenuForSelectingStoredDecors(taskId); + } +} + +void SecretBasePC_Cancel(u8 taskId) +{ + sub_8126A58(0); + if (!gUnknown_0203A17C.isPlayerRoom) + { + ScriptContext1_SetupScript(gUnknown_0823B4E8); + DestroyTask(taskId); + } + else + { + sub_816B060(taskId); + } +} + +void sub_8126DA4(u8 taskId) +{ + sub_8126C08(); + gTasks[taskId].func = sub_8126B80; +} + +void SecretBasePC_PrepMenuForSelectingStoredDecors(u8 taskId) +{ + LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20); + sub_8197434(0, 0); + sub_8126A58(0); + sub_8126DFC(taskId); +} + +void sub_8126DFC(u8 taskId) +{ + u8 winIdx; + + winIdx = sub_81269D4(1); + sub_8126E8C(taskId); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(winIdx, 9, sCurDecorationCategory); + gTasks[taskId].func = sub_8127088; +} + +void sub_8126E44(u8 taskId) +{ + FillWindowPixelBuffer(sDecorMenuWindowIndices[1], 0x11); + sub_8126E8C(taskId); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDecorMenuWindowIndices[1], 9, sCurDecorationCategory); + gTasks[taskId].func = sub_8127088; +} + +void sub_8126E8C(u8 taskId) +{ + s16 *data; + u8 r5; + bool8 r8; + u8 i; + bool8 fl; + + data = gTasks[taskId].data; + r5 = sDecorMenuWindowIndices[1]; + fl = gUnknown_0203A17C.isPlayerRoom; + r8 = FALSE; + if (fl == TRUE && data[11] == 0) + { + r8 = TRUE; + } + for (i = 0; i < 8; i ++) + { + if (r8 == TRUE && i != DECORCAT_DOLL && i != DECORCAT_CUSHION) + { + sub_8126F68(r5, i, 8, i << 4, TRUE, 0xFF); + } + else + { + sub_8126F68(r5, i, 8, i << 4, FALSE, 0xFF); + } + } + PrintTextOnWindow(r5, 1, gTasks[taskId].data[11] == 2 ? gText_Exit : gText_Cancel, 8, (i << 4) + 1, 0, 0); + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_8126F68(u8 winid, u8 decorCat, u8 x, u8 y, bool8 flag, u8 speed) +{ + u8 width; + u8 *strbuf; + + width = x == 8 ? 0x68 : 0x60; + y ++; + sub_8127058(gStringVar4, flag); + strbuf = StringLength(gStringVar4) + gStringVar4; + StringCopy(strbuf, sDecorCatNames[decorCat]); + PrintTextOnWindow(winid, 1, gStringVar4, x, y, speed, NULL); + strbuf = ConvertIntToDecimalStringN(strbuf, CountDecorationCategoryN(decorCat), STR_CONV_MODE_RIGHT_ALIGN, 2); + *strbuf++ = CHAR_SLASH; + ConvertIntToDecimalStringN(strbuf, gDecorationInventories[decorCat].size, STR_CONV_MODE_RIGHT_ALIGN, 2); + x = GetStringRightAlignXOffset(1, gStringVar4, width); + PrintTextOnWindow(winid, 1, gStringVar4, x, y, speed, NULL); +} + +void sub_8127058(u8 *str, bool8 flag) +{ + StringCopy(str, gText_Color161Shadow161); + if (flag == TRUE) + { + str[2] = 0x04; // RED + str[5] = 0x05; // LIGHT_RED + } + else + { + str[2] = 0x02; // DARK_GREY + str[5] = 0x03; // LIGHT_GREY + } +} + +void sub_8127088(u8 taskId) +{ + s8 input; + + if (!gPaletteFade.active) + { + input = ProcessMenuInput(); + switch (input) + { + case -1: + case 8: + PlaySE(SE_SELECT); + sub_812719C(taskId); + break; + case -2: + break; + default: + PlaySE(SE_SELECT); + sCurDecorationCategory = input; + sub_81270E8(taskId); + break; + } + } +} + +void sub_81270E8(u8 taskId) +{ + sCurDecorCatCount = CountDecorationCategoryN(sCurDecorationCategory); + if (sCurDecorCatCount != 0) + { + CondenseDecorationCategoryN(sCurDecorationCategory); + gCurDecorInventoryItems = gDecorationInventories[sCurDecorationCategory].items; + IdentifyOwnedDecorationsCurrentlyInUse(taskId); + sSecretBasePCSelectDecorPageNo = 0; + sSecretBasePCSelectDecorLineNo = 0; + gTasks[taskId].func = sub_8127620; + } + else + { + sub_8126A58(1); + StringExpandPlaceholders(gStringVar4, gText_NoDecorations); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8127180); + } +} + +void sub_8127180(u8 taskId) +{ + sub_8197434(0, 0); + sub_8126DFC(taskId); +} + +void sub_812719C(u8 taskId) +{ + if (gTasks[taskId].data[11] != 2) + { + sub_81271CC(taskId); + } + else + { + sub_8127268(taskId); + } +} + +void sub_81271CC(u8 taskId) +{ + sub_8126A58(1); + sub_8126A88(); + sub_81973C4(0, 0); + sub_8126C08(); + gTasks[taskId].func = sub_8126B80; +} + +void sub_8127208(u8 taskId) +{ + LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20); + sub_8197434(0, 0); + gTasks[taskId].data[11] = 2; + sCurDecorationCategory = DECORCAT_DESK; + sub_8126DFC(taskId); +} + +void sub_8127250(u8 *dest, u8 decorCat) +{ + StringCopy(dest, sDecorCatNames[decorCat]); +} + +void sub_8127268(u8 taskId) +{ + sub_8126A58(1); + sub_8133E1C(taskId); +} + +void sub_8127284(void) +{ + sDecorPCBuffer->unk_520 = sCurDecorCatCount + 1; + if (sDecorPCBuffer->unk_520 > 8) + { + sDecorPCBuffer->unk_521 = 8; + } + else + { + sDecorPCBuffer->unk_521 = sDecorPCBuffer->unk_520; + } +} + +void sub_81272C8(void) +{ + sub_812225C(&sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo, sDecorPCBuffer->unk_521, sDecorPCBuffer->unk_520); +} + +void sub_81272F8(void) +{ + sub_8122298(&sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo, sDecorPCBuffer->unk_521, sDecorPCBuffer->unk_520, 8); +} + +void sub_8127330(u8 taskId) +{ + s16 *data; + u16 i; + + data = gTasks[taskId].data; + if ((sCurDecorationCategory < DECORCAT_DOLL || sCurDecorationCategory > DECORCAT_CUSHION) && gUnknown_0203A17C.isPlayerRoom == TRUE && data[11] == 0) + { + sub_8127058(gStringVar1, TRUE); + } + else + { + sub_8127058(gStringVar1, FALSE); + } + for (i = 0; i < sDecorPCBuffer->unk_520 - 1; i ++) + { + sub_8127454(sDecorPCBuffer->names[i], gCurDecorInventoryItems[i]); + sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; + sDecorPCBuffer->items[i].unk_04 = i; + } + StringCopy(sDecorPCBuffer->names[i], gText_Cancel); + sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; + sDecorPCBuffer->items[i].unk_04 = -2; + gUnknown_03006310 = gUnknown_085A6BD0; + gUnknown_03006310.unk_10 = sDecorMenuWindowIndices[1]; + gUnknown_03006310.unk_0c = sDecorPCBuffer->unk_520; + gUnknown_03006310.unk_00 = sDecorPCBuffer->items; + gUnknown_03006310.unk_0e = sDecorPCBuffer->unk_521; +} + +void sub_8127454(u8 *dest, u16 decorId) +{ + StringCopy(dest, gStringVar1); + StringAppend(dest, gDecorations[decorId].name); +} + +void sub_8127480(u32 a0, bool8 flag, struct ListMenu *menu) +{ + if (flag != TRUE) + { + PlaySE(SE_SELECT); + } + sub_8127744(a0); +} + +void sub_81274A0(u8 a0, s32 a1, u8 a2) +{ + if (a1 != -2) + { + if (sub_81277BC(a1 + 1) == TRUE) + { + blit_move_info_icon(a0, 0x18, 0x5c, a2 + 2); + } + else if (sub_81277E8(a1 + 1) == TRUE) + { + blit_move_info_icon(a0, 0x19, 0x5c, a2 + 2); + } + } +} + +void sub_8127500(void) +{ + if (sDecorPCBuffer->unk_522 == 0xFF) + { + sDecorPCBuffer->unk_522 = AddScrollIndicatorArrowPairParametrized(0x02, 0x3c, 0x0c, 0x94, sDecorPCBuffer->unk_520 - sDecorPCBuffer->unk_521, 0x6e, 0x6e, &sSecretBasePCSelectDecorPageNo); + } +} + +void sub_8127554(void) +{ + if (sDecorPCBuffer->unk_522 != 0xFF) + { + RemoveScrollIndicatorArrowPair(sDecorPCBuffer->unk_522); + sDecorPCBuffer->unk_522 = 0xFF; + } +} + +void sub_8127580(u8 taskId) +{ + sub_81269D4(1); + sub_812759C(taskId); +} + +void sub_812759C(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + sub_81269D4(3); + sub_8127718(sCurDecorationCategory); + sDecorPCBuffer = calloc(1, sizeof(struct DecorPCBuffer)); + sDecorPCBuffer->unk_522 = 0xFF; + sub_8127284(); + sub_81272C8(); + sub_81272F8(); + sub_8127330(taskId); + data[13] = ListMenuInit(&gUnknown_03006310, sSecretBasePCSelectDecorPageNo, sSecretBasePCSelectDecorLineNo); + sub_8127500(); +} + +void sub_8127620(u8 taskId) +{ + sub_812759C(taskId); + gTasks[taskId].func = sub_812764C; +} + +void sub_812764C(u8 taskId) +{ + s16 *data; + s32 input; + + data = gTasks[taskId].data; + if (!gPaletteFade.active) + { + input = ListMenuHandleInput(data[13]); + get_coro_args_x18_x1A(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); + switch (input) + { + case -1: + break; + case -2: + PlaySE(SE_SELECT); + SecretBasePC_SelectedDecorActions[data[11]][1](taskId); + break; + default: + PlaySE(SE_SELECT); + gCurDecorationIndex = input; + sub_8127554(); + sub_81AE6C8(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); + sub_8126A58(1); + sub_81277A8(); + free(sDecorPCBuffer); + SecretBasePC_SelectedDecorActions[data[11]][0](taskId); + break; + } + } +} + +void sub_8127718(u8 decorCat) +{ + sub_8126F68(sub_81269D4(2), decorCat, 0, 0, 0, 0); +} + +void sub_8127744(u32 a0) +{ + u8 winidx; + const u8 *txt; + + winidx = sDecorMenuWindowIndices[3]; + FillWindowPixelBuffer(winidx, 0x11); + if (a0 >= sCurDecorCatCount) + { + txt = gText_GoBackPrevMenu; + } + else + { + txt = gDecorations[gCurDecorInventoryItems[a0]].description; + } + PrintTextOnWindow(winidx, 1, txt, 0, 1, 0, 0); +} + +void sub_81277A8(void) +{ + sub_8126A58(3); + sub_8126A58(2); +} + +bool8 sub_81277BC(u8 idx) +{ + u8 i; + + for (i = 0; i < 16; i ++) + { + if (sSecretBaseItemsIndicesBuffer[i] == idx) + { + return TRUE; + } + } + return FALSE; +} + +bool8 sub_81277E8(u8 idx) +{ + u8 i; + + for (i = 0; i < 12; i ++) + { + if (sPlayerRoomItemsIndicesBuffer[i] == idx) + { + return TRUE; + } + } + return FALSE; +} + +void IdentifyOwnedDecorationsCurrentlyInUseInternal(u8 taskId) +{ + u16 i; + u16 j; + u16 k; + u16 cnt; + + cnt = 0; + memset(sSecretBaseItemsIndicesBuffer, 0, 16); + memset(sPlayerRoomItemsIndicesBuffer, 0, 12); + for (i = 0; i < 16; i ++) + { + if (gSaveBlock1Ptr->secretBases[0].decorations[i] != DECOR_NONE) + { + for (j = 0; j < gDecorationInventories[sCurDecorationCategory].size; j ++) + { + if (gCurDecorInventoryItems[j] == gSaveBlock1Ptr->secretBases[0].decorations[i]) + { + for (k = 0; k < cnt && sSecretBaseItemsIndicesBuffer[k] != j + 1; k ++); + if (k == cnt) + { + sSecretBaseItemsIndicesBuffer[cnt] = j + 1; + cnt ++; + break; + } + } + } + } + } + cnt = 0; + for (i = 0; i < 12; i ++) + { + if (gSaveBlock1Ptr->playerRoomDecor[i] != DECOR_NONE) + { + for (j = 0; j < gDecorationInventories[sCurDecorationCategory].size; j ++) + { + if (gCurDecorInventoryItems[j] == gSaveBlock1Ptr->playerRoomDecor[i] && sub_81277BC(j + 1) != TRUE) + { + for (k = 0; k < cnt && sPlayerRoomItemsIndicesBuffer[k] != j + 1; k ++); + if (k == cnt) + { + sPlayerRoomItemsIndicesBuffer[cnt] = j + 1; + cnt ++; + break; + } + } + } + } + } +} + +void IdentifyOwnedDecorationsCurrentlyInUse(u8 taskId) +{ + IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); +} + +bool8 IsSelectedDecorInThePC(void) +{ + u16 i; + for (i = 0; i < 16; i ++) + { + if (sSecretBaseItemsIndicesBuffer[i] == sSecretBasePCSelectDecorPageNo + sSecretBasePCSelectDecorLineNo + 1) + { + return FALSE; + } + if (i < 12 && sPlayerRoomItemsIndicesBuffer[i] == sSecretBasePCSelectDecorPageNo + sSecretBasePCSelectDecorLineNo + 1) + { + return FALSE; + } + } + return TRUE; +} + +void sub_8127A14(u8 taskId) +{ + sub_81269D4(1); + sub_8127620(taskId); +} + +void sub_8127A30(u8 taskId) +{ + sub_8197434(0, 0); + gTasks[taskId].func = sub_8127A14; +} + +void sub_8127A5C(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_8197434(0, 0); + sub_81269D4(1); + sub_8127620(taskId); + } +} + +void sub_8127A8C(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + sub_8127554(); + sub_81277A8(); + sub_81AE6C8(data[13], NULL, NULL); + free(sDecorPCBuffer); + sub_8126E44(taskId); +} + +void sub_8127ACC(u8 taskId) +{ + gTasks[taskId].data[3] = gSaveBlock1Ptr->pos.x; + gTasks[taskId].data[4] = gSaveBlock1Ptr->pos.y; + PlayerGetDestCoords(&gTasks[taskId].data[0], &gTasks[taskId].data[1]); +} + +void sub_8127B04(u8 taskId) +{ + DrawWholeMapView(); + Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]); + warp_in(); +} + +u16 sub_8127B54(u8 decor, u8 a1) +{ + u16 resp; + + resp = -1; + switch (decor) + { + case DECOR_STAND: + resp = gUnknown_085A72E4[a1] << 12; + return resp; + case DECOR_SLIDE: + resp = gUnknown_085A72EC[a1] << 12; + return resp; + default: + return resp; + } +} + +void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor) +{ + u16 i; + u16 j; + u16 behavior; + u16 flags; + u16 v0; + u16 v1; + s16 decLeft; + s16 decBottom; + + for (i = 0; i < decHeight; i ++) + { + decBottom = mapY - decHeight + 1 + i; + for (j = 0; j < decWidth; j ++) + { + decLeft = mapX + j; + behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[i * decWidth + j]); + if (MetatileBehavior_IsMB_B9(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12))) + { + flags = 0xc00; + } + else + { + flags = 0x000; + } + if (gDecorations[decor].permission != DECORPERM_NA_WALL && MetatileBehavior_IsMB_B7(MapGridGetMetatileBehaviorAt(decLeft, decBottom)) == TRUE) + { + v0 = 1; + } + else + { + v0 = 0; + } + v1 = sub_8127B54(gDecorations[decor].id, i * decWidth + j); + if (v1 != 0xFFFF) + { + MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags | v1); + } + else + { + MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags); + } + } + } +} + +void sub_8127D38(u16 mapX, u16 mapY, u16 decor) +{ + switch (gDecorations[decor].shape) + { + case DECORSHAPE_1x1: + sub_8127B90(mapX, mapY, 1, 1, decor); + break; + case DECORSHAPE_2x1: + sub_8127B90(mapX, mapY, 2, 1, decor); + break; + case DECORSHAPE_3x1: // unused + sub_8127B90(mapX, mapY, 3, 1, decor); + break; + case DECORSHAPE_4x2: + sub_8127B90(mapX, mapY, 4, 2, decor); + break; + case DECORSHAPE_2x2: + sub_8127B90(mapX, mapY, 2, 2, decor); + break; + case DECORSHAPE_1x2: + sub_8127B90(mapX, mapY, 1, 2, decor); + break; + case DECORSHAPE_1x3: // unused + sub_8127B90(mapX, mapY, 1, 3, decor); + break; + case DECORSHAPE_2x4: + sub_8127B90(mapX, mapY, 2, 4, decor); + break; + case DECORSHAPE_3x3: + sub_8127B90(mapX, mapY, 3, 3, decor); + break; + case DECORSHAPE_3x2: + sub_8127B90(mapX, mapY, 3, 2, decor); + break; + } +} + +void sub_8127E18(void) +{ + u8 i; + u8 j; + + for (i = 0; i < 14; i ++) + { + if (FlagGet(0xAE + i) == TRUE) + { + FlagClear(0xAE + i); + for (j = 0; j < gMapHeader.events->mapObjectCount; j ++) + { + if (gMapHeader.events->mapObjects[j].flagId == 0xAE + i) + { + break; + } + } + VarSet(0x3F20 + gMapHeader.events->mapObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]); + gSpecialVar_0x8005 = gMapHeader.events->mapObjects[j].localId; + gSpecialVar_0x8006 = sCurDecorMapX; + gSpecialVar_0x8007 = sCurDecorMapY; + show_sprite(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + sub_808EBA8(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007); + sub_808F254(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + break; + } + } +} + +bool8 sub_8127F38(void) +{ + u16 i; + + for (i = 0; i < gUnknown_0203A17C.size; i ++) + { + if (gUnknown_0203A17C.items[i] == DECOR_NONE) + { + return TRUE; + } + } + return FALSE; +} + +void sub_8127F68(u8 taskId) +{ + if (gUnknown_0203A17C.isPlayerRoom == TRUE && sCurDecorationCategory != DECORCAT_DOLL && sCurDecorationCategory != DECORCAT_CUSHION) + { + StringExpandPlaceholders(gStringVar4, gText_CantPlaceInRoom); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); + } + else if (IsSelectedDecorInThePC() == TRUE) + { + if (sub_8127F38() == TRUE) + { + fade_screen(1, 0); + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_8128060; + } + else + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203A17C.size, STR_CONV_MODE_RIGHT_ALIGN, 2); + if (gUnknown_0203A17C.isPlayerRoom == FALSE) { + StringExpandPlaceholders(gStringVar4, gText_NoMoreDecorations); + } + else + { + StringExpandPlaceholders(gStringVar4, gText_NoMoreDecorations2); + } + DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); + } + } + else + { + StringExpandPlaceholders(gStringVar4, gText_InUseAlready); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); + } +} + +void sub_8128060(u8 taskId) +{ + switch (gTasks[taskId].data[2]) + { + case 0: + if (!gPaletteFade.active) + { + sub_8127ACC(taskId); + gTasks[taskId].data[2] = 1; + } + break; + case 1: + gPaletteFade.bufferTransferDisabled = TRUE; + ConfigureCameraObjectForPlacingDecoration(&sPlaceDecorationGraphicsDataBuffer, gCurDecorInventoryItems[gCurDecorationIndex]); + sub_812826C(taskId); + SetUpPlacingDecorationPlayerAvatar(taskId, &sPlaceDecorationGraphicsDataBuffer); + pal_fill_black(); + gPaletteFade.bufferTransferDisabled = FALSE; + gTasks[taskId].data[2] = 2; + break; + case 2: + if (sub_80ABDFC() == TRUE) + { + gTasks[taskId].data[12] = 0; + sub_8128FD8(taskId); + } + break; + } +} + +void ConfigureCameraObjectForPlacingDecoration(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor) +{ + sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data0; + gUnknown_03005DD0.unk4 = gpu_pal_decompress_alloc_tag_and_upload(data, decor); + gSprites[gUnknown_03005DD0.unk4].oam.priority = 1; + gSprites[gUnknown_03005DD0.unk4].callback = sub_81292D0; + gSprites[gUnknown_03005DD0.unk4].pos1.x = gUnknown_085A7250[data->decoration->shape].x; + gSprites[gUnknown_03005DD0.unk4].pos1.y = gUnknown_085A7250[data->decoration->shape].y; +} + +void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphicsDataBuffer *data) +{ + u8 v0; + + v0 = 16 * (u8)gTasks[taskId].data[5] + gUnknown_085A7250[data->decoration->shape].x - 8 * ((u8)gTasks[taskId].data[5] - 1); + if (data->decoration->shape == DECORSHAPE_3x1 || data->decoration->shape == DECORSHAPE_3x3 || data->decoration->shape == DECORSHAPE_3x2) + { + v0 -= 8; + } + if (gSaveBlock2Ptr->playerGender == MALE) + { + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, v0, 0x48, 0); + } + else + { + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, v0, 0x48, 0); + } + gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1; + DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]); + sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4; +} + +void sub_812826C(u8 taskId) +{ + switch (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].shape) + { + case DECORSHAPE_1x1: + gTasks[taskId].data[5] = 1; + gTasks[taskId].data[6] = 1; + break; + case DECORSHAPE_2x1: + gTasks[taskId].data[5] = 2; + gTasks[taskId].data[6] = 1; + break; + case DECORSHAPE_3x1: + gTasks[taskId].data[5] = 3; + gTasks[taskId].data[6] = 1; + break; + case DECORSHAPE_4x2: + gTasks[taskId].data[5] = 4; + gTasks[taskId].data[6] = 2; + break; + case DECORSHAPE_2x2: + gTasks[taskId].data[5] = 2; + gTasks[taskId].data[6] = 2; + break; + case DECORSHAPE_1x2: + gTasks[taskId].data[5] = 1; + gTasks[taskId].data[6] = 2; + break; + case DECORSHAPE_1x3: + gTasks[taskId].data[5] = 1; + gTasks[taskId].data[6] = 3; + gTasks[taskId].data[1]++; + break; + case DECORSHAPE_2x4: + gTasks[taskId].data[5] = 2; + gTasks[taskId].data[6] = 4; + break; + case DECORSHAPE_3x3: + gTasks[taskId].data[5] = 3; + gTasks[taskId].data[6] = 3; + break; + case DECORSHAPE_3x2: + gTasks[taskId].data[5] = 3; + gTasks[taskId].data[6] = 2; + break; + } +} + +void sub_81283BC(u8 taskId) +{ + gTasks[taskId].data[10] = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 1; + gSprites[sDecor_CameraSpriteObjectIdx2].data7 = 1; + sub_8128DE0(); + sub_8128950(taskId); +} + +void sub_8128414(u8 taskId) +{ + gTasks[taskId].data[10] = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 1; + gSprites[sDecor_CameraSpriteObjectIdx2].data7 = 1; + sub_8128DE0(); + StringExpandPlaceholders(gStringVar4, gText_CancelDecorating); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8128B80); +} + +bool8 sub_8128484(u8 behaviorAt, u16 behaviorBy) +{ + if (MetatileBehavior_IsMB_B3(behaviorAt) != TRUE || behaviorBy != 0) + { + return FALSE; + } + return TRUE; +} + +bool8 sub_81284AC(u8 taskId, s16 x, s16 y, u16 decor) +{ + if (x == gTasks[taskId].data[3] + 7 && y == gTasks[taskId].data[4] + 7 && decor != DECOR_NONE) + { + return FALSE; + } + return TRUE; +} + +bool8 sub_81284F4(u16 behaviorAt, const struct Decoration *decoration) +{ + if (MetatileBehavior_IsMB_B3(behaviorAt) != TRUE) + { + if (decoration->id == DECOR_SOLID_BOARD && MetatileBehavior_IsMB_C2(behaviorAt) == TRUE) + { + return TRUE; + } + if (MetatileBehavior_IsNormal(behaviorAt)) + { + return TRUE; + } + } + return FALSE; +} + +bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) +{ + u8 i; + u8 j; + u8 behaviorAt; + u16 behaviorBy; + u8 mapY; + u8 mapX; + s16 curY; + s16 curX; + mapY = gTasks[taskId].data[6]; + mapX = gTasks[taskId].data[5]; + + switch (decoration->permission) + { + case DECORPERM_SOLID_FLOOR: + case DECORPERM_PASS_FLOOR: + for (i=0; itiles[(mapY - 1 - i) * mapX + j]) & 0xf000; + if (!sub_81284F4(behaviorAt, decoration)) + { + return FALSE; + } + if (!sub_81284AC(taskId, curX, curY, behaviorBy)) + { + return FALSE; + } + behaviorAt = GetFieldObjectIdByXYZ(curX, curY, 0); + if (behaviorAt != 0 && behaviorAt != 16) + { + return FALSE; + } + } + } + break; + case DECORPERM_BEHIND_FLOOR: + for (i=0; itiles[(mapY - 1 - i) * mapX + j]) & 0xf000; + if (!MetatileBehavior_IsNormal(behaviorAt) && !sub_8128484(behaviorAt, behaviorBy)) + { + return FALSE; + } + if (!sub_81284AC(taskId, curX, curY, behaviorBy)) + { + return FALSE; + } + if (GetFieldObjectIdByXYZ(curX, curY, 0) != 16) + { + return FALSE; + } + } + } + curY = gTasks[taskId].data[1] - mapY + 1; + for (j=0; jtiles[j]) & 0xf000; + if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsMB_B7(behaviorAt)) + { + return FALSE; + } + if (!sub_81284AC(taskId, curX, curY, behaviorBy)) + { + return FALSE; + } + behaviorAt = GetFieldObjectIdByXYZ(curX, curY, 0); + if (behaviorAt != 0 && behaviorAt != 16) + { + return FALSE; + } + } + break; + case DECORPERM_NA_WALL: + for (i=0; ishape == DECORSHAPE_1x2) + { + if (!MetatileBehavior_IsMB_C3(behaviorAt)) + { + return FALSE; + } + } + else if (!MetatileBehavior_IsMB_B5(behaviorAt)) + { + if (!MetatileBehavior_IsMB_C3(behaviorAt)) + { + return FALSE; + } + } + if (GetFieldObjectIdByXYZ(curX, curY, 0) != 16) + { + return FALSE; + } + } + break; + } + return TRUE; +} + +void sub_8128950(u8 taskId) +{ + if (sub_812853C(taskId, &gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]]) == TRUE) + { + StringExpandPlaceholders(gStringVar4, gText_PlaceItHere); + DisplayItemMessageOnField(taskId, gStringVar4, sub_81289D0); + } + else + { + PlaySE(SE_HAZURE); + StringExpandPlaceholders(gStringVar4, gText_CantBePlacedHere); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8129020); + } +} + +void sub_81289D0(u8 taskId) +{ + sub_8197930(); + sub_8121F68(taskId, &gUnknown_085A72C4); +} + +void sub_81289F0(u8 taskId) +{ + sub_8197434(0, 0); + sub_8128AAC(taskId); + if (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].permission != DECORPERM_SOLID_MAT) + { + sub_8127D38(gTasks[taskId].data[0], gTasks[taskId].data[1], gCurDecorInventoryItems[gCurDecorationIndex]); + } + else + { + sCurDecorMapX = gTasks[taskId].data[0] - 7; + sCurDecorMapY = gTasks[taskId].data[1] - 7; + ScriptContext1_SetupScript(gUnknown_08275D1F); + } + gSprites[sDecor_CameraSpriteObjectIdx1].pos1.y += 2; + if (gMapHeader.regionMapSectionId == REGION_MAP_SECRET_BASE) + { + TV_PutSecretBaseVisitOnTheAir(); + } + sub_8128BBC(taskId); +} + +void sub_8128AAC(u8 taskId) +{ + u16 i; + + for (i = 0; i < gUnknown_0203A17C.size; i ++) + { + if (gUnknown_0203A17C.items[i] == DECOR_NONE) + { + gUnknown_0203A17C.items[i] = gCurDecorInventoryItems[gCurDecorationIndex]; + gUnknown_0203A17C.pos[i] = ((gTasks[taskId].data[0] - 7) << 4) + (gTasks[taskId].data[1] - 7); + break; + } + } + if (!gUnknown_0203A17C.isPlayerRoom) + { + for (i = 0; i < 16; i ++) + { + if (sSecretBaseItemsIndicesBuffer[i] == 0) + { + sSecretBaseItemsIndicesBuffer[i] = gCurDecorationIndex + 1; + break; + } + } + } + else + { + for (i = 0; i < 12; i ++) + { + if (sPlayerRoomItemsIndicesBuffer[i] == 0) + { + sPlayerRoomItemsIndicesBuffer[i] = gCurDecorationIndex + 1; + break; + } + } + } +} + +void sub_8128B80(u8 taskId) +{ + sub_8197930(); + sub_8121F68(taskId, &gUnknown_085A72CC); +} + +void sub_8128BA0(u8 taskId) +{ + sub_8197434(0, 0); + sub_8128BBC(taskId); +} + +void sub_8128BBC(u8 taskId) +{ + fade_screen(1, 0); + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = c1_overworld_prev_quest; +} + +void c1_overworld_prev_quest(u8 taskId) +{ + switch (gTasks[taskId].data[2]) + { + case 0: + ScriptContext2_Enable(); + if (!gPaletteFade.active) + { + sub_8127B04(taskId); + gTasks[taskId].data[2] = 1; + } + break; + case 1: + sub_812A3C8(); + FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG); + gFieldCallback = sub_8128CD4; + SetMainCallback2(c2_exit_to_overworld_2_switch); + DestroyTask(taskId); + break; + } +} + +void sub_8128C64(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + switch (data[2]) + { + case 0: + sub_80E9578(); + data[2] ++; + break; + case 1: + ScriptContext1_SetupScript(gUnknown_08275D0C); + data[2] ++; + break; + case 2: + ScriptContext2_Enable(); + data[2] ++; + break; + case 3: + if (sub_80ABDFC() == TRUE) + { + gTasks[taskId].func = sub_812764C; + } + break; + } +} + +void sub_8128CD4(void) +{ + u8 taskId; + + ScriptContext2_Enable(); + pal_fill_black(); + taskId = CreateTask(sub_8128C64, 8); + sub_8127580(taskId); + gTasks[taskId].data[2] = 0; +} + +bool8 sub_8128D10(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + if (sDecorationLastDirectionMoved == DIR_SOUTH && data[1] - data[6] - 6 < 0) + { + data[1] ++; + return FALSE; + } + if (sDecorationLastDirectionMoved == DIR_NORTH && data[1] - 7 >= gMapHeader.mapData->height) + { + data[1] --; + return FALSE; + } + if (sDecorationLastDirectionMoved == DIR_WEST && data[0] - 7 < 0) + { + data[0] ++; + return FALSE; + } + if (sDecorationLastDirectionMoved == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapData->width) + { + data[0] --; + return FALSE; + } + return TRUE; +} + +bool8 sub_8128DB4(void) +{ + u16 heldKeys; + + heldKeys = gMain.heldKeys & 0x0F0; + if (heldKeys != DPAD_UP && heldKeys != DPAD_DOWN && heldKeys != DPAD_LEFT && heldKeys != DPAD_RIGHT) + { + return FALSE; + } + return TRUE; +} + +void sub_8128DE0(void) +{ + sDecorationLastDirectionMoved = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; +} + +void sub_8128E18(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + if (!gSprites[sDecor_CameraSpriteObjectIdx1].data4) + { + if (data[10] == 1) + { + gUnknown_085A72D4[data[12]].yesFunc(taskId); + return; + } else if (data[10] == 2) + { + gUnknown_085A72D4[data[12]].noFunc(taskId); + return; + } + if ((gMain.heldKeys & 0x0F0) == DPAD_UP) + { + sDecorationLastDirectionMoved = DIR_SOUTH; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = -2; + data[1]--; + } + if ((gMain.heldKeys & 0x0F0) == DPAD_DOWN) + { + sDecorationLastDirectionMoved = DIR_NORTH; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 2; + data[1]++; + } + if ((gMain.heldKeys & 0x0F0) == DPAD_LEFT) + { + sDecorationLastDirectionMoved = DIR_WEST; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = -2; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; + data[0]--; + } + if ((gMain.heldKeys & 0x0F0) == DPAD_RIGHT) + { + sDecorationLastDirectionMoved = DIR_EAST; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 2; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; + data[0]++; + } + if (!sub_8128DB4() || !sub_8128D10(taskId)) + { + sub_8128DE0(); + } + } + if (sDecorationLastDirectionMoved) + { + gSprites[sDecor_CameraSpriteObjectIdx1].data4++; + gSprites[sDecor_CameraSpriteObjectIdx1].data4 &= 7; + } + if (!data[10]) + { + if (gMain.newKeys & A_BUTTON) + { + data[10] = A_BUTTON; + } + if (gMain.newKeys & B_BUTTON) + { + data[10] = B_BUTTON; + } + } +} + +void sub_8128FD8(u8 taskId) +{ + sub_8197434(0, 1); + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 0; + gTasks[taskId].data[10] = 0; + gTasks[taskId].func = sub_8128E18; +} + +void sub_8129020(u8 taskId) +{ + if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + { + sub_8128FD8(taskId); + } +} + +void sub_8129048(struct PlaceDecorationGraphicsDataBuffer *data) +{ + CpuFill16(0, data, sizeof(*data)); +} + +void sub_8129068(u16 *dest, u16 pal) +{ + CpuFastCopy(&((u16 *)gTilesetPointer_SecretBase->palettes)[pal << 4], dest, 32); +} + +void sub_8129088(u8 *dest, u16 tile) +{ + u8 buffer[32]; + u16 mode; + u16 i; + + mode = tile >> 10; + if (tile != 0) + { + tile &= 0x03FF; + } + CpuFastCopy(&((u8 *)gTilesetPointer_SecretBase->tiles)[tile << 5], buffer, 32); + switch (mode) + { + case 0: + CpuFastCopy(buffer, dest, 32); + break; + case 1: + for (i = 0; i < 8; i ++) + { + dest[4 * i] = (buffer[4 * (i + 1) - 1] >> 4) + ((buffer[4 * (i + 1) - 1] & 0x0F) << 4); + dest[4 * i + 1] = (buffer[4 * (i + 1) - 2] >> 4) + ((buffer[4 * (i + 1) - 2] & 0x0F) << 4); + dest[4 * i + 2] = (buffer[4 * (i + 1) - 3] >> 4) + ((buffer[4 * (i + 1) - 3] & 0x0F) << 4); + dest[4 * i + 3] = (buffer[4 * (i + 1) - 4] >> 4) + ((buffer[4 * (i + 1) - 4] & 0x0F) << 4); + } + break; + case 2: + for (i = 0; i < 8; i ++) + { + dest[4 * i] = buffer[4 * (7 - i)]; + dest[4 * i + 1] = buffer[4 * (7 - i) + 1]; + dest[4 * i + 2] = buffer[4 * (7 - i) + 2]; + dest[4 * i + 3] = buffer[4 * (7 - i) + 3]; + } + break; + case 3: + for (i = 0; i < 32; i ++) + { + dest[i] = (buffer[31 - i] >> 4) + ((buffer[31 - i] & 0x0F) << 4); + } + break; + } +} + +void sub_81291A4(struct PlaceDecorationGraphicsDataBuffer *data) +{ + u16 i; + for (i = 0; i < 64; i ++) + { + sub_8129088(&data->image[i * 32], data->tiles[i]); + } +} + +u16 sub_81291CC(u16 tile) +{ + return ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[tile] & 0xFFF; +} + +void sub_81291E8(struct PlaceDecorationGraphicsDataBuffer *data) +{ + u8 i; + u8 shape; + + shape = data->decoration->shape; + for (i = 0; i < gUnknown_085A71B0[shape].size; i ++) + { + data->tiles[gUnknown_085A71B0[shape].tiles[i]] = sub_81291CC(data->decoration->tiles[gUnknown_085A71B0[shape].y[i]] * 8 + gUnknown_085A71B0[shape].x[i]); + } +} + +void SetDecorSelectionBoxOamAttributes(u8 decorShape) +{ + sDecorSelectorOam.y = 0; + sDecorSelectorOam.affineMode = ST_OAM_AFFINE_OFF; + sDecorSelectorOam.objMode = ST_OAM_OBJ_NORMAL; + sDecorSelectorOam.mosaic = 0; + sDecorSelectorOam.bpp = ST_OAM_4BPP; + sDecorSelectorOam.shape = gUnknown_085A7250[decorShape].shape; + sDecorSelectorOam.x = 0; + sDecorSelectorOam.matrixNum = 0; + sDecorSelectorOam.size = gUnknown_085A7250[decorShape].size; + sDecorSelectorOam.tileNum = 0; + sDecorSelectorOam.priority = 0; + sDecorSelectorOam.paletteNum = 0; +} + +void sub_81292D0(struct Sprite *sprite) +{ + sprite->data2 = 0; + sprite->data3 = 0; + sprite->data4 = 0; + sprite->data5 = 0; + sprite->data6 = 0; + sprite->data7 = 0; + sprite->callback = sub_81292E8; +} + +void sub_81292E8(struct Sprite *sprite) +{ + if (sprite->data7 == 0) + { + if (sprite->data6 < 15) + { + sprite->invisible = FALSE; + } + else + { + sprite->invisible = TRUE; + } + sprite->data6 ++; + sprite->data6 &= 0x1F; + } + else + { + sprite->invisible = FALSE; + } +} + +u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor) +{ + sub_8129048(data); + data->decoration = &gDecorations[decor]; + if (data->decoration->permission == DECORPERM_SOLID_MAT) + { + return AddPseudoFieldObject(data->decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); + } + FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG); + sub_81291E8(data); + SetDecorSelectionBoxOamAttributes(data->decoration->shape); + sub_81291A4(data); + sub_8129068(data->palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(data->decoration->tiles[0] * 8) + 7] >> 12); + LoadSpritePalette(&gUnknown_085A72BC); + return CreateSprite(&sDecorSelectorSpriteTemplate, 0, 0, 0); +} + +u8 AddDecorationIconObjectFromIconTable(u16 tilesTag, u16 paletteTag, u8 decor) +{ + struct SpriteSheet sheet; + struct CompressedSpritePalette palette; + struct SpriteTemplate *template; + u8 spriteId; + + if (!AllocItemIconTemporaryBuffers()) + { + return MAX_SPRITES; + } + LZDecompressWram(GetDecorationIconPicOrPalette(decor, 0), gUnknown_0203CEBC); + CopyItemIconPicTo4x4Buffer(gUnknown_0203CEBC, gUnknown_0203CEC0); + sheet.data = gUnknown_0203CEC0; + sheet.size = 0x200; + sheet.tag = tilesTag; + LoadSpriteSheet(&sheet); + palette.data = GetDecorationIconPicOrPalette(decor, 1); + palette.tag = paletteTag; + LoadCompressedObjectPalette(&palette); + template = malloc(sizeof(struct SpriteTemplate)); + *template = gUnknown_08614FF4; + template->tileTag = tilesTag; + template->paletteTag = paletteTag; + spriteId = CreateSprite(template, 0, 0, 0); + FreeItemIconTemporaryBuffers(); + free(template); + return spriteId; +} + +const u8 *GetDecorationIconPicOrPalette(u16 decor, u8 mode) +{ + if (decor > 120) + { + decor = DECOR_NONE; + } + return gUnknown_085A6BE8[decor][mode]; +} + +u8 AddDecorationIconObjectFromFieldObject(u16 tilesTag, u16 paletteTag, u8 decor) +{ + u8 spriteId; + struct SpriteSheet sheet; + struct SpritePalette palette; + struct SpriteTemplate *template; + + sub_8129048(&sPlaceDecorationGraphicsDataBuffer); + sPlaceDecorationGraphicsDataBuffer.decoration = &gDecorations[decor]; + if (sPlaceDecorationGraphicsDataBuffer.decoration->permission != DECORPERM_SOLID_MAT) + { + sub_81291E8(&sPlaceDecorationGraphicsDataBuffer); + SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape); + sub_81291A4(&sPlaceDecorationGraphicsDataBuffer); + sub_8129068(sPlaceDecorationGraphicsDataBuffer.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0] * 8) + 7] >> 12); + sheet.data = sPlaceDecorationGraphicsDataBuffer.image; + sheet.size = gUnknown_085A72F4[sPlaceDecorationGraphicsDataBuffer.decoration->shape] << 5; + sheet.tag = tilesTag; + LoadSpriteSheet(&sheet); + palette.data = sPlaceDecorationGraphicsDataBuffer.palette; + palette.tag = paletteTag; + LoadSpritePalette(&palette); + template = Alloc(sizeof(struct SpriteTemplate)); + *template = sDecorWhilePlacingSpriteTemplate; + template->tileTag = tilesTag; + template->paletteTag = paletteTag; + spriteId = CreateSprite(template, 0, 0, 0); + free(template); + } + else + { + spriteId = AddPseudoFieldObject(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); + } + return spriteId; +} + +u8 AddDecorationIconObject(u8 decor, s16 x, s16 y, u8 priority, u16 tilesTag, u16 paletteTag) +{ + u8 spriteId; + + if (decor > 120) + { + spriteId = AddDecorationIconObjectFromIconTable(tilesTag, paletteTag, DECOR_NONE); + if (spriteId == MAX_SPRITES) + { + return MAX_SPRITES; + } + gSprites[spriteId].pos2.x = x + 4; + gSprites[spriteId].pos2.y = y + 4; + } + else if (gUnknown_085A6BE8[decor][0] == NULL) + { + spriteId = AddDecorationIconObjectFromFieldObject(tilesTag, paletteTag, decor); + if (spriteId == MAX_SPRITES) + { + return MAX_SPRITES; + } + gSprites[spriteId].pos2.x = x; + if (decor == DECOR_SILVER_SHIELD || decor == DECOR_GOLD_SHIELD) + { + gSprites[spriteId].pos2.y = y - 4; + } + else + { + gSprites[spriteId].pos2.y = y; + } + } + else + { + spriteId = AddDecorationIconObjectFromIconTable(tilesTag, paletteTag, decor); + if (spriteId == MAX_SPRITES) + { + return MAX_SPRITES; + } + gSprites[spriteId].pos2.x = x + 4; + gSprites[spriteId].pos2.y = y + 4; + } + gSprites[spriteId].oam.priority = priority; + return spriteId; +} + +void sub_81296EC(u8 idx) +{ + gUnknown_0203A17C.items[idx] = 0; + gUnknown_0203A17C.pos[idx] = 0; +} + +void sub_8129708(void) +{ + u16 i; + + gSpecialVar_0x8005 = 0; + gScriptResult = 0; + if (gSpecialVar_0x8004 == sCurDecorSelectedInRearrangement) + { + gScriptResult = 1; + } + else if (gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx]].permission == DECORPERM_SOLID_MAT) + { + gSpecialVar_0x8005 = sDecorRearrangementDataBuffer[gSpecialVar_0x8004].flagId; + sub_81296EC(sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx); + for (i = 0; i < gMapHeader.events->mapObjectCount; i ++) + { + if (gMapHeader.events->mapObjects[i].flagId == gSpecialVar_0x8005) + { + gSpecialVar_0x8006 = gMapHeader.events->mapObjects[i].localId; + break; + } + } + } +} + +void sub_81297AC(void) +{ + u8 i; + + for (i = 0; i < gMapHeader.events->mapObjectCount; i ++) + { + if (gMapHeader.events->mapObjects[i].flagId == gSpecialVar_0x8004) + { + gSpecialVar_0x8005 = gMapHeader.events->mapObjects[i].localId; + break; + } + } +} + +void sub_81297F8(void) +{ + u8 i; + u8 y; + u8 x; + int posX; + int posY; + u8 perm; + + for (i = 0; i < sCurDecorSelectedInRearrangement; i ++) + { + perm = gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[i].idx]].permission; + posX = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] >> 4; + posY = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] & 0x0F; + if (perm != DECORPERM_SOLID_MAT) + { + for (y = 0; y < sDecorRearrangementDataBuffer[i].height; y ++) + { + for (x = 0; x < sDecorRearrangementDataBuffer[i].width; x ++) + { + MapGridSetMetatileEntryAt(posX + 7 + x, posY + 7 - y, gMapHeader.mapData->map[posX + x + gMapHeader.mapData->width * (posY - y)] | 0x3000); + } + } + sub_81296EC(sDecorRearrangementDataBuffer[i].idx); + } + } +} + +void sub_81298EC(u8 taskId) +{ + switch (gTasks[taskId].data[2]) + { + case 0: + sub_81297F8(); + gTasks[taskId].data[2] = 1; + break; + case 1: + if (!gPaletteFade.active) { + DrawWholeMapView(); + ScriptContext1_SetupScript(gUnknown_08275D2E); + sub_8197434(0, 1); + gTasks[taskId].data[2] = 2; + } + break; + case 2: + ScriptContext2_Enable(); + IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); + pal_fill_black(); + gTasks[taskId].data[2] = 3; + break; + case 3: + if (sub_80ABDFC() == TRUE) + { + StringExpandPlaceholders(gStringVar4, gText_DecorationReturnedToPC); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8129D64); + if (gMapHeader.regionMapSectionId == REGION_MAP_SECRET_BASE) + { + TV_PutSecretBaseVisitOnTheAir(); + } + } + break; + } +} + + +bool8 sub_81299AC(u8 taskId) +{ + u16 i; + + for (i = 0; i < gUnknown_0203A17C.size; i ++) + { + if (gUnknown_0203A17C.items[i] != DECOR_NONE) + { + return TRUE; + } + } + return FALSE; +} + +void SetUpPuttingAwayDecorationPlayerAvatar(void) +{ + player_get_direction_lower_nybble(); + sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data0; + sub_812A39C(); + gUnknown_03005DD0.unk4 = CreateSprite(&gUnknown_085A7404, 0x78, 0x50, 0); + if (gSaveBlock2Ptr->playerGender == MALE) + { + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, 0x88, 0x48, 0); + } + else + { + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, 0x88, 0x48, 0); + } + gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1; + DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]); + sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4; + gSprites[sDecor_CameraSpriteObjectIdx1].oam.priority = 1; +} + +void sub_8129ABC(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + switch (data[2]) + { + case 0: + if (!gPaletteFade.active) + { + sub_8127ACC(taskId); + data[2] = 1; + data[6] = 1; + data[5] = 1; + } + break; + case 1: + SetUpPuttingAwayDecorationPlayerAvatar(); + pal_fill_black(); + data[2] = 2; + break; + case 2: + if (sub_80ABDFC() == TRUE) + { + data[12] = 1; + sub_8129B34(taskId); + } + break; + } +} + +void sub_8129B34(u8 taskId) +{ + sub_8197434(0, 1); + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = sub_812A36C; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.x = 0x88; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.y = 0x48; + gTasks[taskId].data[10] = 0; + gTasks[taskId].func = sub_8128E18; +} + +void sub_8129BCC(u8 taskId) +{ + gTasks[taskId].data[10] = 0; + sub_8128DE0(); + sub_8129C74(taskId); +} + +void sub_8129BF8(u8 taskId) +{ + gTasks[taskId].data[10] = 0; + sub_8128DE0(); + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; + StringExpandPlaceholders(gStringVar4, gText_StopPuttingAwayDecorations); + DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1F0); +} + +void sub_8129C74(u8 taskId) +{ + s16 *data; + u8 behavior; + + sub_812A0E8(taskId); + if (sCurDecorSelectedInRearrangement != 0) + { + StringExpandPlaceholders(gStringVar4, gText_ReturnDecorationToPC); + DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1A0); + } + else + { + data = gTasks[taskId].data; + behavior = MapGridGetMetatileBehaviorAt(data[0], data[1]); + if (MetatileBehavior_IsSecretBasePC(behavior) == TRUE || MetatileBehavior_IsMB_C5(behavior) == TRUE) + { + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; + StringExpandPlaceholders(gStringVar4, gText_StopPuttingAwayDecorations); + DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1F0); + } + else + { + StringExpandPlaceholders(gStringVar4, gText_NoDecorationHere); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8129D64); + } + } +} + +void sub_8129D64(u8 taskId) +{ + if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) + { + sub_8129B34(taskId); + } +} + +void sub_8129D8C(u8 decor, struct DecorRearrangementDataBuffer *data) +{ + if (gDecorations[decor].shape == DECORSHAPE_1x1) + { + data->width = 1; + data->height = 1; + } else if (gDecorations[decor].shape == DECORSHAPE_2x1) + { + data->width = 2; + data->height = 1; + } else if (gDecorations[decor].shape == DECORSHAPE_3x1) + { + data->width = 3; + data->height = 1; + } else if (gDecorations[decor].shape == DECORSHAPE_4x2) + { + data->width = 4; + data->height = 2; + } else if (gDecorations[decor].shape == DECORSHAPE_2x2) + { + data->width = 2; + data->height = 2; + } else if (gDecorations[decor].shape == DECORSHAPE_1x2) + { + data->width = 1; + data->height = 2; + } else if (gDecorations[decor].shape == DECORSHAPE_1x3) + { + data->width = 1; + data->height = 3; + } else if (gDecorations[decor].shape == DECORSHAPE_2x4) + { + data->width = 2; + data->height = 4; + } else if (gDecorations[decor].shape == DECORSHAPE_3x3) + { + data->width = 3; + data->height = 3; + } else if (gDecorations[decor].shape == DECORSHAPE_3x2) + { + data->width = 3; + data->height = 2; + } +} + +void sub_8129E0C(u8 x, u8 y) +{ + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = TRUE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.x = (x << 4) + 0x88; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.y = (y << 4) + 0x48; +} + +bool8 sub_8129E74(u8 taskId, u8 idx, struct DecorRearrangementDataBuffer *data) +{ + u8 x; + u8 y; + u8 xOff; + u8 yOff; + u8 ht; + + x = gTasks[taskId].data[0] - 7; + y = gTasks[taskId].data[1] - 7; + xOff = gUnknown_0203A17C.pos[idx] >> 4; + yOff = gUnknown_0203A17C.pos[idx] & 0x0F; + ht = data->height; + if (gUnknown_0203A17C.items[idx] == DECOR_SAND_ORNAMENT && MapGridGetMetatileIdAt(xOff + 7, yOff + 7) == 0x28C) + { + ht --; + } + if (x >= xOff && x < xOff + data->width && y > yOff - ht && y <= yOff) + { + sub_8129E0C(data->width - (x - xOff + 1), yOff - y); + return TRUE; + } + return FALSE; +} + +void sub_8129F20(void) +{ + u8 xOff; + u8 yOff; + u16 i; + + xOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx] >> 4; + yOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx] & 0x0F; + for (i = 0; i < 0x40; i ++) + { + if (gSaveBlock1Ptr->mapObjectTemplates[i].x == xOff && gSaveBlock1Ptr->mapObjectTemplates[i].y == yOff && !FlagGet(gSaveBlock1Ptr->mapObjectTemplates[i].flagId)) + { + sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].flagId = gSaveBlock1Ptr->mapObjectTemplates[i].flagId; + break; + } + } +} + +bool8 sub_8129FC8(u8 taskId) +{ + u16 i; + + for (i = 0; i < gUnknown_0203A17C.size; i ++) + { + if (gUnknown_0203A17C.items[i] != 0) + { + if (gDecorations[gUnknown_0203A17C.items[i]].permission == DECORPERM_SOLID_MAT) + { + sub_8129D8C(gUnknown_0203A17C.items[i], sDecorRearrangementDataBuffer); + if (sub_8129E74(taskId, i, sDecorRearrangementDataBuffer) == TRUE) + { + sDecorRearrangementDataBuffer->idx = i; + sub_8129F20(); + sCurDecorSelectedInRearrangement = 1; + return TRUE; + } + } + } + } + return FALSE; +} + +void sub_812A040(u8 left, u8 top, u8 right, u8 bottom) +{ + u8 i; + u8 xOff; + u8 yOff; + u8 decorIdx; + + for (i = 0; i < gUnknown_0203A17C.size; i ++) + { + decorIdx = gUnknown_0203A17C.items[i]; + xOff = gUnknown_0203A17C.pos[i] >> 4; + yOff = gUnknown_0203A17C.pos[i] & 0x0F; + if (decorIdx != 0 && gDecorations[decorIdx].permission == DECORPERM_SOLID_MAT && left <= xOff && top <= yOff && right >= xOff && bottom >= yOff) + { + sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx = i; + sub_8129F20(); + sCurDecorSelectedInRearrangement++; + } + } +} + +#ifdef NONMATCHING +void sub_812A0E8(u8 taskId) +{ + u8 i; + u8 xOff; + u8 yOff; + u8 decor; + register u8 decor asm("r1"); + struct DecorRearrangementDataBuffer *data; + + sCurDecorSelectedInRearrangement = 0; + if (sub_8129FC8(taskId) != TRUE) + { + for (i = 0; i < gUnknown_0203A17C.size; i ++) + { + decor = gUnknown_0203A17C.items[i]; + if (decor != DECOR_NONE) + { + data = &sDecorRearrangementDataBuffer[0]; + sub_8129D8C(decor, data); + if (sub_8129E74(taskId, i, data) == TRUE) + { + data->idx = i; + sCurDecorSelectedInRearrangement ++; + break; + } + } + } + if (sCurDecorSelectedInRearrangement != 0) + { + xOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] >> 4; + yOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] & 0x0F; + sub_812A040(xOff, yOff - sDecorRearrangementDataBuffer[0].height + 1, xOff + sDecorRearrangementDataBuffer[0].width - 1, yOff); // Arithmetic register swap at the r2 argument: `add r2, r0, r2` instead of `add r2, r2, r0` + } + } +} +#else +__attribute__((naked)) void sub_812A0E8(u8 taskId) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tlsls r0, 24\n" + "\tlsrs r6, r0, 24\n" + "\tldr r4, =sCurDecorSelectedInRearrangement\n" + "\tmovs r0, 0\n" + "\tstrb r0, [r4]\n" + "\tadds r0, r6, 0\n" + "\tbl sub_8129FC8\n" + "\tlsls r0, 24\n" + "\tlsrs r0, 24\n" + "\tcmp r0, 0x1\n" + "\tbeq _0812A18C\n" + "\tmovs r5, 0\n" + "\tldr r0, =gUnknown_0203A17C\n" + "\tldrb r1, [r0, 0x8]\n" + "\tcmp r5, r1\n" + "\tbcs _0812A15A\n" + "\tadds r7, r4, 0\n" + "_0812A10E:\n" + "\tldr r0, [r0]\n" + "\tadds r0, r5\n" + "\tldrb r1, [r0]\n" + "\tcmp r1, 0\n" + "\tbeq _0812A14C\n" + "\tldr r4, =sDecorRearrangementDataBuffer\n" + "\tadds r0, r1, 0\n" + "\tadds r1, r4, 0\n" + "\tbl sub_8129D8C\n" + "\tadds r0, r6, 0\n" + "\tadds r1, r5, 0\n" + "\tadds r2, r4, 0\n" + "\tbl sub_8129E74\n" + "\tlsls r0, 24\n" + "\tlsrs r0, 24\n" + "\tcmp r0, 0x1\n" + "\tbne _0812A14C\n" + "\tstrb r5, [r4]\n" + "\tldrb r0, [r7]\n" + "\tadds r0, 0x1\n" + "\tstrb r0, [r7]\n" + "\tb _0812A15A\n" + "\t.pool\n" + "_0812A14C:\n" + "\tadds r0, r5, 0x1\n" + "\tlsls r0, 24\n" + "\tlsrs r5, r0, 24\n" + "\tldr r0, =gUnknown_0203A17C\n" + "\tldrb r1, [r0, 0x8]\n" + "\tcmp r5, r1\n" + "\tbcc _0812A10E\n" + "_0812A15A:\n" + "\tldr r0, =sCurDecorSelectedInRearrangement\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0\n" + "\tbeq _0812A18C\n" + "\tldr r0, =gUnknown_0203A17C\n" + "\tldr r2, =sDecorRearrangementDataBuffer\n" + "\tldrb r1, [r2]\n" + "\tldr r0, [r0, 0x4]\n" + "\tadds r0, r1\n" + "\tldrb r1, [r0]\n" + "\tlsrs r0, r1, 4\n" + "\tmovs r3, 0xF\n" + "\tands r3, r1\n" + "\tldrb r1, [r2, 0x2]\n" + "\tsubs r1, r3, r1\n" + "\tadds r1, 0x1\n" + "\tlsls r1, 24\n" + "\tlsrs r1, 24\n" + "\tldrb r2, [r2, 0x1]\n" + "\tadds r2, r0\n" + "\tsubs r2, 0x1\n" + "\tlsls r2, 24\n" + "\tlsrs r2, 24\n" + "\tbl sub_812A040\n" + "_0812A18C:\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.pool"); +} +#endif + +void sub_812A1A0(u8 taskId) +{ + sub_8197930(); + sub_8121F68(taskId, &gUnknown_085A7348); +} + +void sub_812A1C0(u8 taskId) +{ + fade_screen(1, 0); + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_81298EC; +} + +void sub_812A1F0(u8 taskId) +{ + sub_8197930(); + sub_8121F68(taskId, &gUnknown_085A7350); +} + +void sub_812A210(u8 taskId) +{ + sub_8197434(0, 0); + sub_812A22C(taskId); +} + +void sub_812A22C(u8 taskId) +{ + fade_screen(1, 0); + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_812A25C; +} + +void sub_812A25C(u8 taskId) +{ + switch (gTasks[taskId].data[2]) + { + case 0: + if (!gPaletteFade.active) + { + sub_8127B04(taskId); + gTasks[taskId].data[2] = 1; + } + break; + case 1: + sub_812A3C8(); + gFieldCallback = sub_812A334; + SetMainCallback2(c2_exit_to_overworld_2_switch); + DestroyTask(taskId); + break; + } +} + +void sub_812A2C4(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + switch (data[2]) + { + case 0: + sub_80E9578(); + data[2] ++; + break; + case 1: + ScriptContext1_SetupScript(gUnknown_08275D0C); + data[2] ++; + break; + case 2: + ScriptContext2_Enable(); + data[2] ++; + break; + case 3: + if (sub_80ABDFC() == TRUE) + { + gTasks[taskId].func = sub_8126B80; + } + break; + } +} + +void sub_812A334(void) +{ + u8 taskId; + + pal_fill_black(); + sub_81973C4(0, 1); + sub_8126ABC(); + taskId = CreateTask(sub_812A2C4, 8); + gTasks[taskId].data[2] = 0; +} + +void sub_812A36C(struct Sprite *sprite) +{ + sprite->data0 ++; + sprite->data0 &= 0x1F; + if (sprite->data0 > 15) + { + sprite->invisible = TRUE; + } + else + { + sprite->invisible = FALSE; + } +} + +void sub_812A39C(void) +{ + if (gSaveBlock2Ptr->playerGender == MALE) + { + LoadSpritePalette(&gUnknown_085A73D8); + } + else + { + LoadSpritePalette(&gUnknown_085A73E0); + } +} + +void sub_812A3C8(void) +{ + FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG); +} + +void sub_812A3D4(u8 taskId) +{ + if (IsSelectedDecorInThePC() == TRUE) + { + StringCopy(gStringVar1, gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].name); + StringExpandPlaceholders(gStringVar4, gText_DecorationWillBeDiscarded); + DisplayItemMessageOnField(taskId, gStringVar4, sub_812A458); + } + else + { + StringExpandPlaceholders(gStringVar4, gText_CantThrowAwayInUse); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); + } +} + +void sub_812A458(u8 taskId) +{ + sub_8197930(); + sub_8121F68(taskId, &gUnknown_085A741C); +} + +void sub_812A478(u8 taskId) +{ + gCurDecorInventoryItems[gCurDecorationIndex] = DECOR_NONE; + sCurDecorCatCount = CountDecorationCategoryN(sCurDecorationCategory); + CondenseDecorationCategoryN(sCurDecorationCategory); + IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); + StringExpandPlaceholders(gStringVar4, gText_DecorationThrownAway); + DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); +} diff --git a/src/decoration_inventory.c b/src/decoration_inventory.c new file mode 100644 index 000000000..03ab6c00c --- /dev/null +++ b/src/decoration_inventory.c @@ -0,0 +1,189 @@ + +// Includes +#include "global.h" +#include "decoration.h" +#include "decoration_inventory.h" + +// Static type declarations + +// Static RAM declarations + +EWRAM_DATA struct DecorationInventory gDecorationInventories[8] = {}; + +// Static ROM declarations + +// .rodata + +// .text + +#define SET_DECOR_INV(i, ptr) {\ + gDecorationInventories[i].items = ptr;\ + gDecorationInventories[i].size = sizeof(ptr);\ +} + +void SetDecorationInventoriesPointers(void) +{ + SET_DECOR_INV(0, gSaveBlock1Ptr->decorDesk); + SET_DECOR_INV(1, gSaveBlock1Ptr->decorChair); + SET_DECOR_INV(2, gSaveBlock1Ptr->decorPlant); + SET_DECOR_INV(3, gSaveBlock1Ptr->decorOrnament); + SET_DECOR_INV(4, gSaveBlock1Ptr->decorMat); + SET_DECOR_INV(5, gSaveBlock1Ptr->decorPoster); + SET_DECOR_INV(6, gSaveBlock1Ptr->decorDoll); + SET_DECOR_INV(7, gSaveBlock1Ptr->decorCushion); + sub_8126968(); +} + +static void ClearDecorationInventory(u8 idx) +{ + u8 i; + + for (i = 0; i < gDecorationInventories[idx].size; i ++) + { + gDecorationInventories[idx].items[i] = DECOR_NONE; + } +} + +void ClearDecorationInventories(void) +{ + u8 idx; + + for (idx = 0; idx < 8; idx ++) + { + ClearDecorationInventory(idx); + } +} + +s8 GetFirstEmptyDecorSlot(u8 idx) +{ + s8 i; + + for (i = 0; i < (s8)gDecorationInventories[idx].size; i ++) + { + if (gDecorationInventories[idx].items[i] == DECOR_NONE) + { + return i; + } + } + return -1; +} + +bool8 CheckHasDecoration(u8 decor) +{ + u8 i; + u8 category; + + category = gDecorations[decor].category; + for (i = 0; i < gDecorationInventories[category].size; i ++) + { + if (gDecorationInventories[category].items[i] == decor) + { + return TRUE; + } + } + return FALSE; +} + +bool8 DecorationAdd(u8 decor) +{ + u8 category; + s8 idx; + + if (decor == DECOR_NONE) + { + return FALSE; + } + category = gDecorations[decor].category; + idx = GetFirstEmptyDecorSlot(category); + if (idx == -1) + { + return FALSE; + } + gDecorationInventories[category].items[idx] = decor; + return TRUE; +} + +bool8 DecorationCheckSpace(u8 decor) +{ + if (decor == DECOR_NONE) + { + return FALSE; + } + if (GetFirstEmptyDecorSlot(gDecorations[decor].category) == -1) + { + return FALSE; + } + return TRUE; +} + +s8 DecorationRemove(u8 decor) +{ + u8 i; + u8 idx; + + i = 0; + if (decor == DECOR_NONE) + { + return 0; + } + for (i = 0; i < gDecorationInventories[gDecorations[decor].category].size; i ++) + { + idx = gDecorations[decor].category; + if (gDecorationInventories[idx].items[i] == decor) + { + gDecorationInventories[idx].items[i] = DECOR_NONE; + CondenseDecorationCategoryN(idx); + return 1; + } + } + return 0; +} + +void CondenseDecorationCategoryN(u8 idx) +{ + u8 i; + u8 j; + u8 tmp; + + for (i = 0; i < gDecorationInventories[idx].size; i ++) + { + for (j = i + 1; j < gDecorationInventories[idx].size; j ++) + { + if (gDecorationInventories[idx].items[j] != DECOR_NONE && (gDecorationInventories[idx].items[i] == DECOR_NONE || gDecorationInventories[idx].items[i] > gDecorationInventories[idx].items[j])) + { + tmp = gDecorationInventories[idx].items[i]; + gDecorationInventories[idx].items[i] = gDecorationInventories[idx].items[j]; + gDecorationInventories[idx].items[j] = tmp; + } + } + } +} + +u8 CountDecorationCategoryN(u8 idx) +{ + u8 i; + u8 ct; + + ct = 0; + for (i = 0; i < gDecorationInventories[idx].size; i ++) + { + if (gDecorationInventories[idx].items[i] != DECOR_NONE) + { + ct ++; + } + } + return ct; +} + +u8 CountDecorations(void) +{ + u8 idx; + u8 ct; + + ct = 0; + for (idx = 0; idx < 8; idx ++) + { + ct += CountDecorationCategoryN(idx); + } + return ct; +} diff --git a/src/international_string_util.c b/src/international_string_util.c index c77b4f8ff..81985d614 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -28,13 +28,13 @@ s32 GetStringWidthDifference(s32 fontId, const u8 *str, s32 totalWidth, s32 lett return 0; } -s32 GetMaxWidthInMenuTable(const u8 **str, s32 arg1) +s32 GetMaxWidthInMenuTable(const struct MenuAction *str, s32 arg1) { s32 i, var; for (var = 0, i = 0; i < arg1; i++) { - s32 stringWidth = GetStringWidth(1, str[i * 2], 0); + s32 stringWidth = GetStringWidth(1, str[i].text, 0); if (stringWidth > var) var = stringWidth; } @@ -42,13 +42,13 @@ s32 GetMaxWidthInMenuTable(const u8 **str, s32 arg1) return convert_pixel_width_to_tile_width(var); } -s32 sub_81DB3D8(const u8 **str, u8* arg1, s32 arg2) +s32 sub_81DB3D8(const struct MenuAction *str, u8* arg1, s32 arg2) { s32 i, var; for (var = 0, i = 0; i < arg2; i++) { - s32 stringWidth = GetStringWidth(1, str[arg1[i] * 2], 0); + s32 stringWidth = GetStringWidth(1, str[arg1[i]].text, 0); if (stringWidth > var) var = stringWidth; } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c new file mode 100755 index 000000000..37ecdc982 --- /dev/null +++ b/src/pokemon_summary_screen.c @@ -0,0 +1,3679 @@ +#include "global.h" +#include "battle.h" +#include "bg.h" +#include "decompress.h" +#include "item.h" +#include "items.h" +#include "link.h" +#include "m4a.h" +#include "main.h" +#include "malloc.h" +#include "moves.h" +#include "palette.h" +#include "pokemon.h" +#include "songs.h" +#include "sound.h" +#include "species.h" +#include "sprite.h" +#include "string_util.h" +#include "task.h" +#include "text.h" +#include "window.h" + +struct ContestMove +{ + u8 effect; + u8 type; + u8 comboID; + u8 combo[4]; +}; + +struct ContestEffect +{ + u8 type; + u8 appeal; + u8 jam; +}; + + + +extern struct UnkSummaryStruct* gUnknown_0203CF1C; +extern struct BgTemplate gUnknown_0861CBB4; +extern u8 gUnknown_0203CF20; +extern struct MusicPlayerInfo gMPlay_BGM; +extern s8 gUnknown_0861CC1C[]; +extern u8 gUnknown_08329D22[]; +extern u8 gUnknown_0203CF21; +extern u16 gSpecialVar_0x8005; +extern struct UnkStruct_61CC04 gUnknown_0861CC04; +extern struct UnkStruct_61CC04 gUnknown_0861CC10; +extern struct UnkStruct_61CC04 gUnknown_0861CBEC; +extern struct UnkStruct_61CC04 gUnknown_0861CBF8; +extern u16 gUnknown_08DC3CD4[]; +extern struct ContestMove gContestMoves[]; +extern struct ContestEffect gContestEffects[]; +extern struct WindowTemplate gUnknown_0861CC24; +extern struct TextColor gUnknown_0861CD2C[]; +extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; +extern u8 gText_MaleSymbol[]; +extern u8 gText_FemaleSymbol[]; +extern u8 gUnknown_0861CDD3[]; +extern void (*const gUnknown_0861CE54[])(); +extern void (*const gUnknown_0861CE64[])(u8 taskId); +extern struct WindowTemplate gUnknown_0861CCCC; +extern u8 gUnknown_0861CE74[]; +extern u8 gUnknown_0861CE7B[]; +extern struct WindowTemplate gUnknown_0861CCEC; +extern struct WindowTemplate gUnknown_0861CD14; + +extern void sub_806F2AC(u8 a, u8 b); +void sub_81C488C(u8 a); +extern void do_scheduled_bg_tilemap_copies_to_vram(void); +extern u8 sub_81221EC(); +extern u8 sub_81221AC(); +extern void SetVBlankHBlankCallbacksToNull(); +extern void sub_8121DA0(); +extern void clear_scheduled_bg_copies_to_vram(); +extern void remove_some_task(); +extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable); +extern void ShowBg(u8 a); +extern void SetGpuReg(u8 regOffset, u16 value); +extern void schedule_bg_copy_tilemap_to_vram(u8 a); +extern void SetBgTilemapBuffer(u8 bg, void *tilemap); +extern u8 gUnknown_08D9862C; +extern u8 gUnknown_08D98CC8; +extern u8 gUnknown_08D987FC; +extern u8 gUnknown_08D9898C; +extern u8 gUnknown_08D98B28; +extern u8 gUnknown_08D9853C; +extern u8 gUnknown_08D85620; +extern struct CompressedSpriteSheet gUnknown_0861CFBC; +extern struct CompressedSpriteSheet gUnknown_0861D074; +extern struct CompressedSpriteSheet gUnknown_0861D0F8; +extern struct CompressedSpritePalette gUnknown_0861D100; +extern struct CompressedSpritePalette gUnknown_0861D07C; +extern u8 gUnknown_08D97B84; +extern u8 gUnknown_08D97D0C; +extern void reset_temp_tile_data_buffers(); +extern void decompress_and_copy_tile_data_to_vram(u8 a, void* tiledata, u8 b, u8 c, u8 d); +extern u8 free_temp_tile_data_buffers_if_possible(); +extern void sub_8069004(struct BoxPokemon* a, void* b); +extern void sub_81C1E20(u8 taskId); +extern u8 *GetMonNickname(struct Pokemon *mon, u8 *dest); +extern u16 SpeciesToPokedexNum(u16 species); +extern u8 gText_UnkCtrlF908Clear01[]; +extern u8 gText_LevelSymbol[]; +extern u8 gText_PkmnInfo[]; +extern u8 gText_PkmnSkills[]; +extern u8 gText_BattleMoves[]; +extern u8 gText_ContestMoves[]; +extern u8 gText_Cancel2[]; +extern u8 gText_Info[]; +extern u8 gText_Switch[]; +extern u8 gText_RentalPkmn[]; +extern u8 gText_TypeSlash[]; +extern u8 gText_HP4[]; +extern u8 gText_Attack3[]; +extern u8 gText_Defense3[]; +extern u8 gText_SpAtk4[]; +extern u8 gText_SpDef4[]; +extern u8 gText_Speed2[]; +extern u8 gText_ExpPoints[]; +extern u8 gText_NextLv[]; +extern u8 gText_Status[]; +extern u8 gText_Power[]; +extern u8 gText_Accuracy2[]; +extern u8 gText_Appeal[]; +extern u8 gText_Jam[]; +extern u8 gText_OTSlash[]; +extern u8 gText_UnkCtrlF907F908[]; +extern u8 gAbilityNames[][13]; +extern u8 *gAbilityDescriptionPointers[]; +extern u8 gText_XNature[]; +extern u8 gText_XNatureHatchedAtYZ[]; +extern u8 gText_XNatureHatchedSomewhereAt[]; +extern u8 gText_XNatureMetAtYZ[]; +extern u8 gText_XNatureMetSomewhereAt[]; +extern u8 gText_XNatureFatefulEncounter[]; +extern u8 gText_XNatureProbablyMetAt[]; +extern u8 gText_XNatureObtainedInTrade[]; +extern u8 *gNatureNamePointers[]; +extern u8 gText_EmptyString5[]; +extern u32 gBattleTypeFlags; +extern u8 gText_FiveMarks[]; +extern u8 gText_EggWillTakeALongTime[]; +extern u8 gText_EggAboutToHatch[]; +extern u8 gText_EggWillHatchSoon[]; +extern u8 gText_EggWillTakeSomeTime[]; +extern u8 gText_PeculiarEggNicePlace[]; +extern u8 gText_PeculiarEggTrade[]; +extern u8 gText_EggFromTraveler[]; +extern u8 gText_EggFromHotSprings[]; +extern u8 gText_OddEggFoundByCouple[]; +extern u8 gText_None[]; +extern u8 gText_RibbonsVar1[]; +extern u8 gUnknown_0861CE82[]; +extern u8 gUnknown_0861CE8E[]; +extern u8 gText_OneDash[]; +extern u8 gText_TwoDashes[]; +extern u8 gText_ThreeDashes[]; +extern u8 gUnknown_0861CE97[]; +extern struct BattleMove gBattleMoves[]; + +extern u32 ChangeBgX(u8 bg, u32 value, u8 op); +extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f); +extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); +extern s32 GetStringCenterAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); +extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); +extern bool8 sub_81A6BF4(); +extern bool8 sub_81B9E94(); +extern void sub_81AFBF0(); +extern u8 sub_81AFC0C(u8 a, u8 *b); +extern void sub_81AFC28(u8 *a, u8 *b); +extern void sub_8124610(u8 *a, u8 b); +extern int GetPlayerIDAsU32(); +extern u8 GetCurrentPpToMaxPpState(u8 a, u8 b); + +void sub_81BFAE4(void); +void sub_81BFE24(); +u8 sub_81BFEB0(); +void sub_81C2554(); +void sub_81C1BA0(); +void sub_81C0098(struct Pokemon* a); +bool8 sub_81C00F0(struct Pokemon* a); +void sub_81C25E8(); +void sub_81C286C(); +void sub_81C2D9C(u8 a); +void sub_81C0348(); +void sub_81C2AFC(u8 a); +void sub_81C4190(); +void sub_81C42C8(); +u8 sub_81C45F4(void* a, u16* b); +void sub_81C4984(); +void sub_81C4A08(); +void sub_81C4A88(); +void sub_81C4280(); +void sub_81C0510(u8 taskId); +void sub_81C171C(u8 taskId); +void sub_8121E10(); +u8 sub_81B205C(struct Pokemon* a); +void sub_81C1DA4(u16 a, s16 b); +void sub_81C1EFC(u16 a, s16 b, u16 c); +void sub_81C240C(u16 a); +void sub_81C2194(u16 *a, u16 b, u8 c); +void sub_81C2074(u16 a, s16 b); +void sub_81C2524(); +void sub_81C2228(struct Pokemon* mon); +void sub_81C0484(u8 taskId); +void sub_81C4898(); +void sub_806F47C(u8 a); +u8 GetLRKeysState(); +void sub_81C0604(u8 taskId, s8 a); +void sub_81C0A8C(u8 taskId, s8 a); +void sub_81C48F0(); +void sub_81C0E48(u8 taskId); +void sub_81C0704(u8 taskId); +s8 sub_81C09B4(s8 a); +s8 sub_81C08F8(s8 a); +void sub_81C4204(u8 a, u8 b); +void sub_81C20F0(u8 taskId); +bool8 sub_81C0A50(struct Pokemon* mon); +void sub_81C49E0(); +void sub_81C0E24(); +void sub_81C2C38(u8 a); +void sub_81C0B8C(u8 taskId); +void sub_81C0CC4(u8 taskId); +void sub_81C2DE4(u8 a); +void sub_81C424C(); +void sub_81C0C68(u8 taskId); +void sub_81C0D44(u8 taskId); +void sub_81C22CC(struct Pokemon* mon); +void sub_81C0F44(u8 taskId); +void sub_81C3E9C(u16 a); +void sub_81C3F44(); +void sub_81C44F0(); +void sub_81C4AF8(u8 a); +void sub_81C1070(s16* a, s8 b, u8* c); +void sub_81C11F4(u8 a); +void sub_81C129C(u8 a); +bool8 sub_81C1040(); +void sub_81C4064(); +void sub_81C4C60(u8 a); +void sub_81C12E4(u8 taskId); +void sub_81C4C84(u8 a); +void sub_81C13B0(u8 a, u8 b); +void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); +void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); +void sub_81C40A0(u8 a, u8 b); +void sub_81C4568(u8 a, u8 b); +void sub_81C174C(u8 taskId); +bool8 sub_81C18A8(); +void sub_81C18F4(u8 a); +u8 sub_81B6D14(u16 a); +void sub_81C1940(u8 taskId); +void sub_81C4154(); +void sub_81C1F80(u8 taskId); +void sub_81C2628(); +void sub_81C2794(); +void sub_81C27DC(struct Pokemon *mon, u16 a); +void sub_81C2D68(u8 a); +void sub_81C335C(); +void sub_81C33CC(); +void sub_81C3428(); +void sub_81C349C(); +void sub_81C2EC4(); +void sub_81C2F5C(); +void sub_81C2FD8(); +void sub_81C302C(); +void sub_81C307C(); +void sub_81C3194(); +void sub_81C31C0(); +bool8 sub_81C3304(); +void sub_81C31F0(u8 *a); +u8 sub_81C3220(); +bool8 sub_81C32BC(); +void sub_81C35E4(); +void sub_81C3690(); +void sub_81C3710(); +void sub_81C37D8(); +void sub_81C3808(); +void sub_81C3890(); +void sub_81C38C0(); +void sub_81C3B08(u8 a); +void sub_81C3E2C(u8 a); +void sub_81C4D18(); + +void SetBgAttribute(u8 bg, u8 attributeId, u8 value); + +bool8 sub_81BFB10(); +u8 sub_81B1250(); + +union UnkUnion +{ + struct Pokemon mon[6]; + struct BoxPokemon boxMon[6]; +}; + + +u8 sub_80D214C(union UnkUnion* a, u8 b, u8 c, u8 d); + +struct PokeSummary +{ + u16 species; // 0x0 + u16 species2; // 0x2 + u8 isEgg; // 0x4 + u8 level; // 0x5 + u8 ribbons; // 0x6 + u8 unk7; // 0x7 + u8 altAbility; // 0x8 + u8 metLocation; // 0x9 + u8 metLevel; // 0xA + u8 metGame; // 0xB + u32 pid; // 0xC + u32 exp; // 0x10 + u16 moves[4]; // 0x14 + u8 pp[4]; // 0x1C + u16 currentHP; // 0x20 + u16 maxHP; // 0x22 + u16 atk; // 0x24 + u16 def; // 0x26 + u16 spatk; // 0x28 + u16 spdef; // 0x2A + u16 speed; // 0x2C + u16 item; // 0x2E + u16 friendship; // 0x30 + u8 OTGender; // 0x32 + u8 nature; // 0x33 + u8 ppBonuses; // 0x34 + u8 sanity; // 0x35 + u8 OTName[8]; // 0x36 + u8 unk3E[9]; // 0x3E + u32 OTID; // 0x48 +}; + +struct UnkSummaryStruct +{ + /*0x00*/ union UnkUnion *unk0; + /*0x04*/ void *unk4; + /*0x08*/ void *unk8; + /*0x0C*/ struct Pokemon currentMon; + /*0x70*/ struct PokeSummary summary; + u16 unkTilemap0[0x400]; + u16 unkTilemap0_1[0x400]; + u16 unkTilemap1[0x400]; + u16 unkTilemap1_1[0x400]; + u16 unkTilemap2[0x400]; + u16 unkTilemap2_1[0x400]; + u16 unkTilemap3[0x400]; + u16 unkTilemap3_1[0x400]; + u8 unk40BC; + u8 unk40BD; + u8 unk40BE; + u8 unk40BF; + u8 unk40C0; + u8 unk40C1; + u8 unk40C2; + u8 unk40C3; + u16 unk40C4; + u8 unk40C6; + u8 unk40C7; + u8 unk40C8; + u8 unk40C9; + u8 unk40CA; + u8 unk40CB[8]; + u8 unk40D3; + u8 unk40D4; + u8 unk40D5; + u8 unk_filler5[0x19]; + u8 unk40EF; + s16 unk40F0; + u8 unk_filler4[6]; +}; + +void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) +{ + u8 byte; + gUnknown_0203CF1C = AllocZeroed(sizeof(struct UnkSummaryStruct)); + gUnknown_0203CF1C->unk40BC = a; + gUnknown_0203CF1C->unk0 = b; + gUnknown_0203CF1C->unk40BE = c; + gUnknown_0203CF1C->unk40BF = d; + gUnknown_0203CF1C->unk4 = e; + if (a == 2) + gUnknown_0203CF1C->unk40BD = 1; + else + gUnknown_0203CF1C->unk40BD = 0; + switch (a) + { + case 0: + case 2: + gUnknown_0203CF1C->unk40C1 = 0; + gUnknown_0203CF1C->unk40C2 = 3; + break; + case 1: + gUnknown_0203CF1C->unk40C1 = 0; + gUnknown_0203CF1C->unk40C2 = 3; + gUnknown_0203CF1C->unk40C8 = 1; + break; + case 3: + gUnknown_0203CF1C->unk40C1 = 2; + gUnknown_0203CF1C->unk40C2 = 3; + gUnknown_0203CF1C->unk40C3 = 1; + break; + } + byte = gUnknown_0203CF1C->unk40C1; + gUnknown_0203CF1C->unk40C0 = byte; + sub_81C488C(0xFF); + if (gMonSpritesGfxPtr == 0) + sub_806F2AC(0, 0); + SetMainCallback2(sub_81BFAE4); +} + +void sub_81BFA38(void *a, u8 b, u8 c, void *d, u16 e) +{ + sub_81BF8EC(3, a, b, c, d); + gUnknown_0203CF1C->unk40C4 = e; +} + +void sub_81BFA80(u8 a, void *b, u8 c, u8 d, void *e) +{ + sub_81BF8EC(a, b, c, d, e); + gUnknown_0203CF1C->unk40EF = 1; +} + +void sub_81BFAB4(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +void sub_81BFAD0(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_81BFAE4() +{ + while (1) + { + if (sub_81221EC() == 1 || sub_81BFB10() == TRUE || sub_81221AC() == 1) + break; + } +} + +bool8 sub_81BFB10(void) +{ + switch (gMain.state) + { + case 0: + SetVBlankHBlankCallbacksToNull(); + sub_8121DA0(); + clear_scheduled_bg_copies_to_vram(); + gMain.state++; + break; + case 1: + remove_some_task(); + gMain.state++; + break; + case 2: + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = 1; + gMain.state++; + break; + case 3: + ResetSpriteData(); + gMain.state++; + break; + case 4: + FreeAllSpritePalettes(); + gMain.state++; + break; + case 5: + sub_81BFE24(); + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + break; + case 6: + if (sub_81BFEB0() != 0) + gMain.state++; + break; + case 7: + sub_81C2554(); + gMain.state++; + break; + case 8: + sub_81C1BA0(); + gMain.state++; + break; + case 9: + sub_81C0098(&gUnknown_0203CF1C->currentMon); + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + break; + case 10: + if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) != 0) + gMain.state++; + break; + case 11: + sub_81C25E8(); + gMain.state++; + break; + case 12: + sub_81C286C(); + gMain.state++; + break; + case 13: + sub_81C2D9C(gUnknown_0203CF1C->unk40C0); + gMain.state++; + break; + case 14: + sub_81C0348(); + gMain.state++; + break; + case 15: + sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + gMain.state++; + break; + case 16: + sub_81C4190(); + sub_81C42C8(); + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + break; + case 17: + gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0); + if (gUnknown_0203CF1C->unk40D3 != 0xFF) + { + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + } + break; + case 18: + sub_81C4984(&gUnknown_0203CF1C->currentMon); + gMain.state++; + break; + case 19: + sub_81C4A08(&gUnknown_0203CF1C->currentMon); + gMain.state++; + break; + case 20: + sub_81C4A88(); + gMain.state++; + break; + case 21: + sub_81C4280(); + gMain.state++; + break; + case 22: + if (gUnknown_0203CF1C->unk40BC != 3) + CreateTask(sub_81C0510, 0); + else + CreateTask(sub_81C171C, 0); + gMain.state++; + break; + case 23: + BlendPalettes(-1, 16, 0); + gMain.state++; + break; + case 24: + BeginNormalPaletteFade(-1, 0, 16, 0, 0); + gPaletteFade.bufferTransferDisabled = 0; + gMain.state++; + break; + default: + SetVBlankCallback(sub_81BFAD0); + SetMainCallback2(sub_81BFAB4); + return TRUE; + } + return FALSE; +} + +void sub_81BFE24() +{ + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, &gUnknown_0861CBB4, 4); + SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap2); + SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap1); + SetBgTilemapBuffer(3, &gUnknown_0203CF1C->unkTilemap0); + sub_8121E10(); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + schedule_bg_copy_tilemap_to_vram(3); + SetGpuReg(REG_OFFSET_DISPCNT, 0x1040); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); +} + +u8 sub_81BFEB0() +{ + switch (gUnknown_0203CF1C->unk40F0) + { + case 0: + reset_temp_tile_data_buffers(); + decompress_and_copy_tile_data_to_vram(1, &gUnknown_08D97D0C, 0, 0, 0); + gUnknown_0203CF1C->unk40F0++; + break; + case 1: + if (free_temp_tile_data_buffers_if_possible() != 1) + { + LZDecompressWram(&gUnknown_08D9862C, gUnknown_0203CF1C->unkTilemap0); + gUnknown_0203CF1C->unk40F0++; + } + break; + case 2: + LZDecompressWram(&gUnknown_08D98CC8, gUnknown_0203CF1C->unkTilemap0_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 3: + LZDecompressWram(&gUnknown_08D987FC, gUnknown_0203CF1C->unkTilemap1_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 4: + LZDecompressWram(&gUnknown_08D9898C, gUnknown_0203CF1C->unkTilemap2_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 5: + LZDecompressWram(&gUnknown_08D98B28, gUnknown_0203CF1C->unkTilemap3_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 6: + LoadCompressedPalette(&gUnknown_08D9853C, 0, 0x100); + LoadPalette(&gUnknown_08D85620, 0x81, 0x1E); + gUnknown_0203CF1C->unk40F0++; + break; + case 7: + LoadCompressedObjectPic(&gUnknown_0861CFBC); + gUnknown_0203CF1C->unk40F0++; + break; + case 8: + LoadCompressedObjectPic(&gUnknown_0861D074); + gUnknown_0203CF1C->unk40F0++; + break; + case 9: + LoadCompressedObjectPic(&gUnknown_0861D0F8); + gUnknown_0203CF1C->unk40F0++; + break; + case 10: + LoadCompressedObjectPalette(&gUnknown_0861D100); + gUnknown_0203CF1C->unk40F0++; + break; + case 11: + LoadCompressedObjectPalette(&gUnknown_0861D07C); + gUnknown_0203CF1C->unk40F0++; + break; + case 12: + LoadCompressedPalette(&gUnknown_08D97B84, 0x1D0, 0x60); + gUnknown_0203CF1C->unk40F0 = 0; + return 1; + } + return 0; +} + +void sub_81C0098(struct Pokemon *mon) +{ + if (gUnknown_0203CF1C->unk40BD == 0) + { + struct Pokemon *partyMon = gUnknown_0203CF1C->unk0->mon; + *mon = partyMon[gUnknown_0203CF1C->unk40BE]; + } + else + { + struct BoxPokemon *boxMon = gUnknown_0203CF1C->unk0->boxMon; + sub_8069004(&boxMon[gUnknown_0203CF1C->unk40BE], mon); + } +} + +bool8 sub_81C00F0(struct Pokemon *a) +{ + u32 i; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + switch (gUnknown_0203CF1C->unk40F0) + { + case 0: + sum->species = GetMonData(a, MON_DATA_SPECIES); + sum->species2 = GetMonData(a, MON_DATA_SPECIES2); + sum->exp = GetMonData(a, MON_DATA_EXP); + sum->level = GetMonData(a, MON_DATA_LEVEL); + sum->altAbility = GetMonData(a, MON_DATA_ALT_ABILITY); + sum->item = GetMonData(a, MON_DATA_HELD_ITEM); + sum->pid = GetMonData(a, MON_DATA_PERSONALITY); + sum->sanity = GetMonData(a, MON_DATA_SANITY_BIT1); + if (sum->sanity != 0) + sum->isEgg = 1; + else + sum->isEgg = GetMonData(a, MON_DATA_IS_EGG); + break; + case 1: + for (i = 0; i < 4; i++) + { + sum->moves[i] = GetMonData(a, MON_DATA_MOVE1+i); + sum->pp[i] = GetMonData(a, MON_DATA_PP1+i); + } + sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES); + break; + case 2: + if ((struct Pokemon*)gUnknown_0203CF1C->unk0 == gPlayerParty || gUnknown_0203CF1C->unk40BC == 2 || gUnknown_0203CF1C->unk40EF == 1) + { + sum->nature = GetNature(a); + sum->currentHP = GetMonData(a, MON_DATA_HP); + sum->maxHP = GetMonData(a, MON_DATA_MAX_HP); + sum->atk = GetMonData(a, MON_DATA_ATK); + sum->def = GetMonData(a, MON_DATA_DEF); + sum->spatk = GetMonData(a, MON_DATA_SPATK); + sum->spdef = GetMonData(a, MON_DATA_SPDEF); + sum->speed = GetMonData(a, MON_DATA_SPD); + } + else + { + sum->nature = GetNature(a); + sum->currentHP = GetMonData(a, MON_DATA_HP); + sum->maxHP = GetMonData(a, MON_DATA_MAX_HP); + sum->atk = GetMonData(a, MON_DATA_ATK2); + sum->def = GetMonData(a, MON_DATA_DEF2); + sum->spatk = GetMonData(a, MON_DATA_SPATK2); + sum->spdef = GetMonData(a, MON_DATA_SPDEF2); + sum->speed = GetMonData(a, MON_DATA_SPD2); + } + break; + case 3: + GetMonData(a, MON_DATA_OT_NAME, &sum->OTName); + ConvertInternationalString((u8*)&sum->OTName, GetMonData(a, MON_DATA_LANGUAGE)); + sum->unk7 = sub_81B205C(a); + sum->OTGender = GetMonData(a, MON_DATA_OT_GENDER); + sum->OTID = GetMonData(a, MON_DATA_OT_ID); + sum->metLocation = GetMonData(a, MON_DATA_MET_LOCATION); + sum->metLevel = GetMonData(a, MON_DATA_MET_LEVEL); + sum->metGame = GetMonData(a, MON_DATA_MET_GAME); + sum->friendship = GetMonData(a, MON_DATA_FRIENDSHIP); + break; + default: + sum->ribbons = GetMonData(a, MON_DATA_RIBBON_COUNT); + return TRUE; + } + gUnknown_0203CF1C->unk40F0++; + return FALSE; +} + +void sub_81C0348(void) +{ + if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) + { + sub_81C1DA4(0, 255); + sub_81C1EFC(0, 255, 0); + } + else + { + sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); + SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap3); + SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap2); + ChangeBgX(2, 0x10000, 1); + ClearWindowTilemap(0x13); + ClearWindowTilemap(0xD); + } + if (gUnknown_0203CF1C->summary.unk7 == 0) + { + sub_81C2074(0, 0xFF); + } + else + { + if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) + PutWindowTilemap(0xD); + } + sub_81C2524(); + sub_81C2228(&gUnknown_0203CF1C->currentMon); +} + +void sub_81C0434() +{ + FreeAllWindowBuffers(); + Free(gUnknown_0203CF1C); +} + +void sub_81C044C(u8 taskId) +{ + BeginNormalPaletteFade(-1, 0, 0, 16, 0); + gTasks[taskId].func = sub_81C0484; +} + +void sub_81C0484(u8 taskId) +{ + if (sub_81221EC() != 1 && !gPaletteFade.active) + { + SetMainCallback2(gUnknown_0203CF1C->unk4); + gUnknown_0203CF20 = gUnknown_0203CF1C->unk40BE; + sub_81C4898(); + ResetSpriteData(); + FreeAllSpritePalettes(); + StopCryAndClearCrySongs(); + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + if (gMonSpritesGfxPtr == 0) + sub_806F47C(0); + sub_81C0434(); + DestroyTask(taskId); + } +} + +void sub_81C0510(u8 taskId) +{ + if (sub_81221EC() != 1 && !gPaletteFade.active) + { + if (gMain.newKeys & DPAD_UP) + { + sub_81C0604(taskId, -1); + } + else if (gMain.newKeys & DPAD_DOWN) + { + sub_81C0604(taskId, 1); + } + else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysState() == 1) + { + sub_81C0A8C(taskId, -1); + } + else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysState() == 2) + { + sub_81C0A8C(taskId, 1); + } + else if (gMain.newKeys & A_BUTTON) + { + if (gUnknown_0203CF1C->unk40C0 != 1) + { + if (gUnknown_0203CF1C->unk40C0 == 0) + { + sub_81C48F0(); + PlaySE(SE_SELECT); + sub_81C044C(taskId); + } + else + { + PlaySE(SE_SELECT); + sub_81C0E48(taskId); + } + } + } + else if (gMain.newKeys & B_BUTTON) + { + sub_81C48F0(); + PlaySE(SE_SELECT); + sub_81C044C(taskId); + } + } +} + +void sub_81C0604(u8 taskId, s8 a) +{ + s8 r4_2; + + if (gUnknown_0203CF1C->unk40C3 == 0) + { + if (gUnknown_0203CF1C->unk40BD == 1) + { + if (gUnknown_0203CF1C->unk40C0 != 0) + { + if (a == 1) + a = 0; + else + a = 2; + } + else + { + if (a == 1) + a = 1; + else + a = 3; + } + r4_2 = sub_80D214C(gUnknown_0203CF1C->unk0, gUnknown_0203CF1C->unk40BE, gUnknown_0203CF1C->unk40BF, a); + } + else if (sub_81B1250() == 1) + { + r4_2 = sub_81C09B4(a); + } + else + { + r4_2 = sub_81C08F8(a); + } + + if (r4_2 != -1) + { + PlaySE(SE_SELECT); + if (gUnknown_0203CF1C->summary.unk7 != 0) + { + sub_81C4204(2, 1); + ClearWindowTilemap(0xD); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C2074(0, 2); + } + gUnknown_0203CF1C->unk40BE = r4_2; + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = sub_81C0704; + } + } +} + +void sub_81C0704(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + StopCryAndClearCrySongs(); + break; + case 1: + sub_81C4898(); + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3]); + break; + case 2: + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D4]); + break; + case 3: + sub_81C0098(&gUnknown_0203CF1C->currentMon); + gUnknown_0203CF1C->unk40F0 = 0; + break; + case 4: + if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) == FALSE) + return; + break; + case 5: + sub_81C49E0(&gUnknown_0203CF1C->currentMon); + break; + case 6: + sub_81C4A08(&gUnknown_0203CF1C->currentMon); + break; + case 7: + if (gUnknown_0203CF1C->summary.unk7) + sub_81C2074(10, -2); + sub_81C2228(&gUnknown_0203CF1C->currentMon); + data[1] = 0; + break; + case 8: + gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]); + if (gUnknown_0203CF1C->unk40D3 == 0xFF) + return; + gSprites[gUnknown_0203CF1C->unk40D3].data2 = 1; + sub_81C0E24(); + data[1] = 0; + break; + case 9: + sub_81C4280(); + break; + case 10: + sub_81C25E8(); + break; + case 11: + sub_81C2D9C(gUnknown_0203CF1C->unk40C0); + sub_81C2524(); + break; + case 12: + gSprites[gUnknown_0203CF1C->unk40D3].data2 = 0; + break; + default: + if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0) + { + data[0] = 0; + gTasks[taskId].func = sub_81C0510; + } + return; + } + data[0]++; +} + +s8 sub_81C08F8(s8 a) +{ + struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; + + if (gUnknown_0203CF1C->unk40C0 == 0) + { + if (a == -1 && gUnknown_0203CF1C->unk40BE == 0) + return -1; + if (a == 1 && gUnknown_0203CF1C->unk40BE >= gUnknown_0203CF1C->unk40BF) + return -1; + return gUnknown_0203CF1C->unk40BE + a; + } + else + { + s8 index = gUnknown_0203CF1C->unk40BE; + + do + { + index += a; + if (index < 0 || index > gUnknown_0203CF1C->unk40BF) + return -1; + } while (GetMonData(&mon[index], MON_DATA_IS_EGG) != 0); + return index; + } +} + +s8 sub_81C09B4(s8 a) +{ + struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; + s8 r5 = 0; + u8 i; + + for (i = 0; i < 6; i++) + { + if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->unk40BE) + { + r5 = i; + break; + } + } + + while (1) + { + int b; + s8* c = &gUnknown_0861CC1C[0]; + + r5 += a; + if (r5 < 0 || r5 >= 6) + return -1; + b = c[r5]; + if (sub_81C0A50(&mon[b]) == TRUE) + return b; + } +} + +bool8 sub_81C0A50(struct Pokemon* mon) +{ + if (GetMonData(mon, MON_DATA_SPECIES) == 0) + return FALSE; + else if (gUnknown_0203CF1C->unk40BE != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) + return TRUE; + else + return FALSE; +} + +void sub_81C0A8C(u8 taskId, s8 b) +{ + struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + s16 *data = gTasks[taskId].data; + + if (summary->isEgg) + return; + if (b == -1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C1) + return; + if (b == 1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C2) + return; + PlaySE(SE_SELECT); + sub_81C2C38(gUnknown_0203CF1C->unk40C0); + gUnknown_0203CF1C->unk40C0 += b; + data[0] = 0; + if (b == 1) + SetTaskFuncWithFollowupFunc(taskId, sub_81C0B8C, gTasks[taskId].func); + else + SetTaskFuncWithFollowupFunc(taskId, sub_81C0CC4, gTasks[taskId].func); + sub_81C2DE4(gUnknown_0203CF1C->unk40C0); + sub_81C424C(); +} + +void sub_81C0B8C(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + if (data[0] == 0) + { + if (gUnknown_0203CF1C->unk40C9 == 0) + { + data[1] = 1; + SetBgAttribute(1, 7, 1); + SetBgAttribute(2, 7, 2); + schedule_bg_copy_tilemap_to_vram(1); + } + else + { + data[1] = 2; + SetBgAttribute(2, 7, 1); + SetBgAttribute(1, 7, 2); + schedule_bg_copy_tilemap_to_vram(2); + } + ChangeBgX(data[1], 0, 0); + SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xBC)); + ShowBg(1); + ShowBg(2); + } + ChangeBgX(data[1], 0x2000, 1); + data[0] += 32; + if (data[0] > 0xFF) + gTasks[taskId].func = sub_81C0C68; +} + +void sub_81C0C68(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + gUnknown_0203CF1C->unk40C9 ^= 1; + data[1] = 0; + data[0] = 0; + sub_81C1BA0(); + sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + sub_81C4280(); + sub_81C0E24(); + SwitchTaskToFollowupFunc(taskId); +} + +void sub_81C0CC4(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + if (data[0] == 0) + { + if (gUnknown_0203CF1C->unk40C9 == 0) + data[1] = 2; + else + data[1] = 1; + ChangeBgX(data[1], 0x10000, 0); + } + ChangeBgX(data[1], 0x2000, 2); + data[0] += 32; + if (data[0] > 0xFF) + gTasks[taskId].func = sub_81C0D44; +} + +void sub_81C0D44(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + if (gUnknown_0203CF1C->unk40C9 == 0) + { + SetBgAttribute(1, 7, 1); + SetBgAttribute(2, 7, 2); + schedule_bg_copy_tilemap_to_vram(2); + } + else + { + SetBgAttribute(2, 7, 1); + SetBgAttribute(1, 7, 2); + schedule_bg_copy_tilemap_to_vram(1); + } + if (gUnknown_0203CF1C->unk40C0 > 1) + { + SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xFFFFF0BC)); + ChangeBgX(data[1], 0x10000, 0); + } + ShowBg(1); + ShowBg(2); + gUnknown_0203CF1C->unk40C9 ^= 1; + data[1] = 0; + data[0] = 0; + sub_81C1BA0(); + sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + sub_81C4280(); + sub_81C0E24(); + SwitchTaskToFollowupFunc(taskId); +} + +void sub_81C0E24() +{ + if (gUnknown_0203CF1C->unk40C0 == 1) + sub_81C22CC(&gUnknown_0203CF1C->currentMon); +} + +void sub_81C0E48(u8 taskId) +{ + u16 move; + gUnknown_0203CF1C->unk40C6 = 0; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + ClearWindowTilemap(0x13); + if (gSprites[gUnknown_0203CF1C->unk40D5].invisible == 0) + ClearWindowTilemap(0xD); + sub_81C1DA4(9, -3); + sub_81C1EFC(9, -3, move); + if (gUnknown_0203CF1C->unk40C8 == 0) + { + ClearWindowTilemap(5); + PutWindowTilemap(6); + } + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); + sub_81C3E9C(move); + sub_81C3F44(); + sub_81C44F0(); + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + sub_81C4AF8(8); + gTasks[taskId].func = sub_81C0F44; +} + +void sub_81C0F44(u8 taskId) +{ + u8 id = taskId; + s16 *data = gTasks[taskId].data; + + if (sub_81221EC() != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[0] = 4; + sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[0] = 4; + sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); + } + else if (gMain.newKeys & A_BUTTON) + { + if (gUnknown_0203CF1C->unk40C8 == 1 + || (gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + { + PlaySE(SE_SELECT); + sub_81C11F4(taskId); + } + else if (sub_81C1040() == TRUE) + { + PlaySE(SE_SELECT); + sub_81C129C(taskId); + } + else + { + PlaySE(SE_HAZURE); + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + sub_81C11F4(id); + } + } +} + +bool8 sub_81C1040(void) +{ + u8 i; + for (i = 1; i < 4; i++) + { + if (gUnknown_0203CF1C->summary.moves[i] != 0) + return TRUE; + } + return FALSE; +} + +void sub_81C1070(s16 *a, s8 b, u8 *c) +{ + s8 i; + s8 moveIndex; + u16 move; + + PlaySE(SE_SELECT); + moveIndex = *c; + for (i = 0; i < 4; i++) + { + moveIndex += b; + if (moveIndex > a[0]) + moveIndex = 0; + else if (moveIndex < 0) + moveIndex = a[0]; + if (moveIndex == 4) + { + move = gUnknown_0203CF1C->unk40C4; + break; + } + move = gUnknown_0203CF1C->summary.moves[moveIndex]; + if (move != 0) + break; + } + sub_81C240C(move); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + sub_81C3E9C(move); + if ((*c == 4 && gUnknown_0203CF1C->unk40C4 == 0) || a[1] == 1) + { + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(9, -3); + sub_81C1EFC(9, -3, move); + } + if (*c != 4 && moveIndex == 4 && gUnknown_0203CF1C->unk40C4 == 0) + { + ClearWindowTilemap(14); + ClearWindowTilemap(15); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(0, 3); + sub_81C1EFC(0, 3, 0); + } + *c = moveIndex; + if (c == &gUnknown_0203CF1C->unk40C6) + sub_81C4D18(8); + else + sub_81C4D18(18); +} + +void sub_81C11F4(u8 taskId) +{ + sub_81C4C60(8); + ClearWindowTilemap(6); + PutWindowTilemap(5); + sub_81C3E9C(0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 1); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 1); + sub_81C4064(); + if (gUnknown_0203CF1C->unk40C6 != 4) + { + ClearWindowTilemap(14); + ClearWindowTilemap(15); + sub_81C1DA4(0, 3); + sub_81C1EFC(0, 3, 0); + } + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81C0510; +} + +void sub_81C129C(u8 taskId) +{ + gUnknown_0203CF1C->unk40C7 = gUnknown_0203CF1C->unk40C6; + sub_81C4C84(1); + sub_81C4AF8(18); + gTasks[taskId].func = sub_81C12E4; +} + +void sub_81C12E4(u8 taskId) +{ + u8 a = taskId; + s16* data = gTasks[taskId].data; + if (sub_81221EC() != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[0] = 3; + sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C7); + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[0] = 3; + sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C7); + } + else if (gMain.newKeys & A_BUTTON) + { + if (gUnknown_0203CF1C->unk40C6 == gUnknown_0203CF1C->unk40C7) + { + sub_81C13B0(taskId, 0); + } + else + sub_81C13B0(taskId, 1); + } + else if (gMain.newKeys & B_BUTTON) + sub_81C13B0(a, 0); + } +} + +void sub_81C13B0(u8 taskId, u8 b) +{ + u16 move; + PlaySE(SE_SELECT); + sub_81C4C84(0); + sub_81C4C60(18); + if (b == 1) + { + if (gUnknown_0203CF1C->unk40BD == 0) + { + struct Pokemon *why = gUnknown_0203CF1C->unk0->mon; + sub_81C14BC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + } + else + { + struct BoxPokemon *why = gUnknown_0203CF1C->unk0->boxMon; + sub_81C15EC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + } + sub_81C0098(&gUnknown_0203CF1C->currentMon); + sub_81C40A0(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + sub_81C4568(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + gUnknown_0203CF1C->unk40C6 = gUnknown_0203CF1C->unk40C7; + } + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + sub_81C3E9C(move); + sub_81C240C(move); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81C0F44; +} + + +#ifdef NONMATCHING +void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) +{ + u16 localMoveTo; + u16 localMoveFrom; + u8 localPpTo; + u8 localPpFrom; + u8 localPpBonuses; + u16* moveFromPtr; + u16* moveToPtr; + u8* ppFromPtr; + u8* ppToPtr; + u8* ppBonusesPtr; + + moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; + localMoveFrom = *moveFromPtr; + + moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; + localMoveTo = *moveToPtr; + + ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; + localPpFrom = *ppFromPtr; + + ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; + localPpTo = *ppToPtr; + + ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses; + localPpBonuses = *ppBonusesPtr; + +{ + u8 bitsFrom, bitsTo; + + bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1); + bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1); + + + localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]); + localPpBonuses &= ~(gUnknown_08329D22[swappingToId]); + + localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1))); +} + + SetMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo); + SetMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom); + + SetMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo); + SetMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom); + + SetMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); + + *moveFromPtr = localMoveTo; + *moveToPtr = localMoveFrom; + + *ppFromPtr = localPpTo; + *ppToPtr = localPpFrom; + + *ppBonusesPtr = localPpBonuses; +} +#else +__attribute__((naked)) +void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x28\n\ + adds r7, r0, 0\n\ + adds r4, r1, 0\n\ + adds r6, r2, 0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r2, [r0]\n\ + lsls r0, r4, 1\n\ + mov r10, r0\n\ + adds r1, r2, 0\n\ + adds r1, 0x84\n\ + adds r0, r1, r0\n\ + str r0, [sp, 0x8]\n\ + ldrh r0, [r0]\n\ + mov r3, sp\n\ + adds r3, 0x2\n\ + str r3, [sp, 0x1C]\n\ + strh r0, [r3]\n\ + lsls r0, r6, 1\n\ + mov r9, r0\n\ + add r1, r9\n\ + str r1, [sp, 0xC]\n\ + ldrh r1, [r1]\n\ + mov r0, sp\n\ + strh r1, [r0]\n\ + adds r1, r2, 0\n\ + adds r1, 0x8C\n\ + adds r3, r1, r4\n\ + str r3, [sp, 0x10]\n\ + ldrb r0, [r3]\n\ + mov r3, sp\n\ + adds r3, 0x5\n\ + str r3, [sp, 0x24]\n\ + strb r0, [r3]\n\ + adds r1, r6\n\ + str r1, [sp, 0x14]\n\ + ldrb r0, [r1]\n\ + mov r1, sp\n\ + adds r1, 0x4\n\ + str r1, [sp, 0x20]\n\ + strb r0, [r1]\n\ + adds r2, 0xA4\n\ + str r2, [sp, 0x18]\n\ + ldrb r0, [r2]\n\ + mov r5, sp\n\ + adds r5, 0x6\n\ + strb r0, [r5]\n\ + ldr r1, =gUnknown_08329D22\n\ + adds r0, r4, r1\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldrb r0, [r5]\n\ + adds r2, r0, 0\n\ + mov r3, r8\n\ + ands r2, r3\n\ + mov r3, r10\n\ + asrs r2, r3\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + adds r1, r6, r1\n\ + ldrb r1, [r1]\n\ + mov r12, r1\n\ + adds r1, r0, 0\n\ + mov r3, r12\n\ + ands r1, r3\n\ + mov r3, r9\n\ + asrs r1, r3\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r3, r8\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + ldrb r0, [r5]\n\ + mov r3, r12\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + mov r0, r9\n\ + lsls r2, r0\n\ + mov r3, r10\n\ + lsls r1, r3\n\ + adds r2, r1\n\ + ldrb r0, [r5]\n\ + orrs r0, r2\n\ + strb r0, [r5]\n\ + adds r1, r4, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + mov r2, sp\n\ + bl SetMonData\n\ + adds r1, r6, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + ldr r2, [sp, 0x1C]\n\ + bl SetMonData\n\ + adds r4, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r4, 0\n\ + ldr r2, [sp, 0x20]\n\ + bl SetMonData\n\ + adds r6, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r6, 0\n\ + ldr r2, [sp, 0x24]\n\ + bl SetMonData\n\ + adds r0, r7, 0\n\ + movs r1, 0x15\n\ + adds r2, r5, 0\n\ + bl SetMonData\n\ + mov r0, sp\n\ + ldrh r0, [r0]\n\ + ldr r1, [sp, 0x8]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x1C]\n\ + ldrh r0, [r3]\n\ + ldr r1, [sp, 0xC]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x20]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x10]\n\ + strb r0, [r1]\n\ + ldr r3, [sp, 0x24]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x14]\n\ + strb r0, [r1]\n\ + ldrb r0, [r5]\n\ + ldr r3, [sp, 0x18]\n\ + strb r0, [r3]\n\ + add sp, 0x28\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) +{ + u16 localMoveTo; + u16 localMoveFrom; + u8 localPpTo; + u8 localPpFrom; + u8 localPpBonuses; + u16* moveFromPtr; + u16* moveToPtr; + u8* ppFromPtr; + u8* ppToPtr; + u8* ppBonusesPtr; + + moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; + localMoveFrom = *moveFromPtr; + + moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; + localMoveTo = *moveToPtr; + + ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; + localPpFrom = *ppFromPtr; + + ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; + localPpTo = *ppToPtr; + + ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses; + localPpBonuses = *ppBonusesPtr; + +{ + u8 bitsFrom, bitsTo; + + bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1); + bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1); + + + localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]); + localPpBonuses &= ~(gUnknown_08329D22[swappingToId]); + + localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1))); +} + + SetBoxMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo); + SetBoxMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom); + + SetBoxMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo); + SetBoxMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom); + + SetBoxMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); + + *moveFromPtr = localMoveTo; + *moveToPtr = localMoveFrom; + + *ppFromPtr = localPpTo; + *ppToPtr = localPpFrom; + + *ppBonusesPtr = localPpBonuses; +} +#else +__attribute__((naked)) +void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x28\n\ + adds r7, r0, 0\n\ + adds r4, r1, 0\n\ + adds r6, r2, 0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r2, [r0]\n\ + lsls r0, r4, 1\n\ + mov r10, r0\n\ + adds r1, r2, 0\n\ + adds r1, 0x84\n\ + adds r0, r1, r0\n\ + str r0, [sp, 0x8]\n\ + ldrh r0, [r0]\n\ + mov r3, sp\n\ + adds r3, 0x2\n\ + str r3, [sp, 0x1C]\n\ + strh r0, [r3]\n\ + lsls r0, r6, 1\n\ + mov r9, r0\n\ + add r1, r9\n\ + str r1, [sp, 0xC]\n\ + ldrh r1, [r1]\n\ + mov r0, sp\n\ + strh r1, [r0]\n\ + adds r1, r2, 0\n\ + adds r1, 0x8C\n\ + adds r3, r1, r4\n\ + str r3, [sp, 0x10]\n\ + ldrb r0, [r3]\n\ + mov r3, sp\n\ + adds r3, 0x5\n\ + str r3, [sp, 0x24]\n\ + strb r0, [r3]\n\ + adds r1, r6\n\ + str r1, [sp, 0x14]\n\ + ldrb r0, [r1]\n\ + mov r1, sp\n\ + adds r1, 0x4\n\ + str r1, [sp, 0x20]\n\ + strb r0, [r1]\n\ + adds r2, 0xA4\n\ + str r2, [sp, 0x18]\n\ + ldrb r0, [r2]\n\ + mov r5, sp\n\ + adds r5, 0x6\n\ + strb r0, [r5]\n\ + ldr r1, =gUnknown_08329D22\n\ + adds r0, r4, r1\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldrb r0, [r5]\n\ + adds r2, r0, 0\n\ + mov r3, r8\n\ + ands r2, r3\n\ + mov r3, r10\n\ + asrs r2, r3\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + adds r1, r6, r1\n\ + ldrb r1, [r1]\n\ + mov r12, r1\n\ + adds r1, r0, 0\n\ + mov r3, r12\n\ + ands r1, r3\n\ + mov r3, r9\n\ + asrs r1, r3\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r3, r8\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + ldrb r0, [r5]\n\ + mov r3, r12\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + mov r0, r9\n\ + lsls r2, r0\n\ + mov r3, r10\n\ + lsls r1, r3\n\ + adds r2, r1\n\ + ldrb r0, [r5]\n\ + orrs r0, r2\n\ + strb r0, [r5]\n\ + adds r1, r4, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + mov r2, sp\n\ + bl SetBoxMonData\n\ + adds r1, r6, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + ldr r2, [sp, 0x1C]\n\ + bl SetBoxMonData\n\ + adds r4, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r4, 0\n\ + ldr r2, [sp, 0x20]\n\ + bl SetBoxMonData\n\ + adds r6, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r6, 0\n\ + ldr r2, [sp, 0x24]\n\ + bl SetBoxMonData\n\ + adds r0, r7, 0\n\ + movs r1, 0x15\n\ + adds r2, r5, 0\n\ + bl SetBoxMonData\n\ + mov r0, sp\n\ + ldrh r0, [r0]\n\ + ldr r1, [sp, 0x8]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x1C]\n\ + ldrh r0, [r3]\n\ + ldr r1, [sp, 0xC]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x20]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x10]\n\ + strb r0, [r1]\n\ + ldr r3, [sp, 0x24]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x14]\n\ + strb r0, [r1]\n\ + ldrb r0, [r5]\n\ + ldr r3, [sp, 0x18]\n\ + strb r0, [r3]\n\ + add sp, 0x28\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C171C(u8 taskId) +{ + sub_81C44F0(); + sub_81C4AF8(8); + gTasks[taskId].func = sub_81C174C; +} + +void sub_81C174C(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (sub_81221EC() != 1) + { + if (gPaletteFade.active != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[0] = 4; + sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[0] = 4; + sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); + } + else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) + { + sub_81C0A8C(taskId, -1); + } + else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2) + { + sub_81C0A8C(taskId, 1); + } + else if (gMain.newKeys & A_BUTTON) + { + if (sub_81C18A8() == TRUE) + { + sub_81C48F0(); + PlaySE(SE_SELECT); + gUnknown_0203CF21 = gUnknown_0203CF1C->unk40C6; + gSpecialVar_0x8005 = gUnknown_0203CF21; + sub_81C044C(taskId); + } + else + { + PlaySE(0x20); + sub_81C18F4(taskId); + } + } + else if (gMain.newKeys & B_BUTTON) + { + u32 var1; + sub_81C48F0(); + PlaySE(SE_SELECT); + gUnknown_0203CF21 = 4; + gSpecialVar_0x8005 = 4; + sub_81C044C(taskId); + } + } + } +} + +bool8 sub_81C18A8() +{ + if (gUnknown_0203CF1C->unk40C6 == 4 || gUnknown_0203CF1C->unk40C4 == 0 || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]) != 1) + return TRUE; + else + return FALSE; +} + +void sub_81C18F4(u8 taskId) +{ + ClearWindowTilemap(14); + ClearWindowTilemap(15); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(0, 3); + sub_81C1EFC(0, 3, 0); + sub_81C4154(); + gTasks[taskId].func = sub_81C1940; +} + +void sub_81C1940(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16 move; + if (FuncIsActiveTask(sub_81C1E20) != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[1] = 1; + data[0] = 4; + sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C6); + data[1] = 0; + gTasks[taskId].func = sub_81C174C; + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[1] = 1; + data[0] = 4; + sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C6); + data[1] = 0; + gTasks[taskId].func = sub_81C174C; + } + else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) + { + if (gUnknown_0203CF1C->unk40C0 != 2) + { + + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + gTasks[taskId].func = sub_81C174C; + sub_81C0A8C(taskId, -1); + sub_81C1DA4(9, -2); + sub_81C1EFC(9, -2, move); + } + } + else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2) + { + if (gUnknown_0203CF1C->unk40C0 != 3) + { + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + gTasks[taskId].func = sub_81C174C; + sub_81C0A8C(taskId, 1); + sub_81C1DA4(9, -2); + sub_81C1EFC(9, -2, move); + } + } + else if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + sub_81C3E9C(move); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(9, -3); + sub_81C1EFC(9, -3, move); + gTasks[taskId].func = sub_81C174C; + } + } +} + +u8 sub_81C1B94() +{ + return gUnknown_0203CF21; +} + +void sub_81C1BA0() +{ + u16 *alloced = Alloc(32); + u8 i; + for (i = 0; i < 4; i++) + { + u8 j = i << 1; + if (i < gUnknown_0203CF1C->unk40C1) + { + alloced[j+0] = 0x40; + alloced[j+1] = 0x40; + alloced[j+8] = 0x50; + alloced[j+9] = 0x50; + } + else if (i > gUnknown_0203CF1C->unk40C2) + { + alloced[j+0] = 0x4A; + alloced[j+1] = 0x4A; + alloced[j+8] = 0x5A; + alloced[j+9] = 0x5A; + } + else if (i < gUnknown_0203CF1C->unk40C0) + { + alloced[j+0] = 0x46; + alloced[j+1] = 0x47; + alloced[j+8] = 0x56; + alloced[j+9] = 0x57; + } + else if (i == gUnknown_0203CF1C->unk40C0) + { + if (i != gUnknown_0203CF1C->unk40C2) + { + alloced[j+0] = 0x41; + alloced[j+1] = 0x42; + alloced[j+8] = 0x51; + alloced[j+9] = 0x52; + } + else + { + alloced[j+0] = 0x4B; + alloced[j+1] = 0x4C; + alloced[j+8] = 0x5B; + alloced[j+9] = 0x5C; + } + } + else if (i != gUnknown_0203CF1C->unk40C2) + { + alloced[j+0] = 0x43; + alloced[j+1] = 0x44; + alloced[j+8] = 0x53; + alloced[j+9] = 0x54; + } + else + { + alloced[j+0] = 0x48; + alloced[j+1] = 0x49; + alloced[j+8] = 0x58; + alloced[j+9] = 0x59; + } + } + CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16); + schedule_bg_copy_tilemap_to_vram(3); + Free(alloced); +} + +struct UnkStruct_61CC04 +{ + u8 *ptr; + u8 field_4; + u8 field_5; + u8 field_6; + u8 field_7; + u8 field_8; + u8 field_9; +}; + +#ifdef NONMATCHING +void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) +{ + u8 *alloced = Alloc(a->field_6 * (a->field_7 << 1)); + CpuFill16(a->field_4, alloced, a->field_7*a->field_6); + if (a->field_6 != c) + { + if (!d) + { + for (d;d < a->field_7; d++) + { + CpuCopy16(&a->ptr + ((c + a->field_6*d)), alloced + ((a->field_6*d) << 1), (a->field_6 - c) * 2); + } + } + else + { + for (d = 0;d < a->field_7; d++) + { + CpuCopy16(&a->ptr + (a->field_6*d), alloced + ((c + a->field_6*d) << 1), (a->field_6 - c) * 2); + } + } + } + d = 0; + while (d < a->field_7) + { + CpuCopy16(alloced + ((a->field_6*d) << 1), b + ((((a->field_9 + d) << 5) + a->field_8) << 1), a->field_6 * 2); + d++; + } + Free(alloced); +} +#else +__attribute__((naked)) +void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0x4\n\ + adds r4, r0, 0\n\ + mov r8, r1\n\ + lsls r2, 24\n\ + lsrs r6, r2, 24\n\ + lsls r3, 24\n\ + lsrs r5, r3, 24\n\ + ldrb r1, [r4, 0x6]\n\ + ldrb r0, [r4, 0x7]\n\ + lsls r0, 1\n\ + muls r0, r1\n\ + bl Alloc\n\ + adds r7, r0, 0\n\ + mov r1, sp\n\ + ldrh r0, [r4, 0x4]\n\ + strh r0, [r1]\n\ + ldrb r1, [r4, 0x7]\n\ + ldrb r0, [r4, 0x6]\n\ + adds r2, r1, 0\n\ + muls r2, r0\n\ + movs r0, 0x80\n\ + lsls r0, 17\n\ + orrs r2, r0\n\ + mov r0, sp\n\ + adds r1, r7, 0\n\ + bl CpuSet\n\ + ldrb r0, [r4, 0x6]\n\ + cmp r0, r6\n\ + beq _081C1D60\n\ + cmp r5, 0\n\ + bne _081C1D30\n\ + movs r5, 0\n\ + ldrb r0, [r4, 0x7]\n\ + cmp r5, r0\n\ + bcs _081C1D60\n\ +_081C1D00:\n\ + ldrb r2, [r4, 0x6]\n\ + adds r1, r2, 0\n\ + muls r1, r5\n\ + adds r3, r6, r1\n\ + lsls r3, 1\n\ + ldr r0, [r4]\n\ + adds r0, r3\n\ + lsls r1, 1\n\ + adds r1, r7, r1\n\ + subs r2, r6\n\ + ldr r3, =0x001fffff\n\ + ands r2, r3\n\ + bl CpuSet\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + ldrb r3, [r4, 0x7]\n\ + cmp r5, r3\n\ + bcc _081C1D00\n\ + b _081C1D60\n\ + .pool\n\ +_081C1D30:\n\ + movs r5, 0\n\ + ldrb r0, [r4, 0x7]\n\ + cmp r5, r0\n\ + bcs _081C1D60\n\ +_081C1D38:\n\ + ldrb r2, [r4, 0x6]\n\ + adds r1, r2, 0\n\ + muls r1, r5\n\ + lsls r3, r1, 1\n\ + ldr r0, [r4]\n\ + adds r0, r3\n\ + adds r1, r6, r1\n\ + lsls r1, 1\n\ + adds r1, r7, r1\n\ + subs r2, r6\n\ + ldr r3, =0x001fffff\n\ + ands r2, r3\n\ + bl CpuSet\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + ldrb r3, [r4, 0x7]\n\ + cmp r5, r3\n\ + bcc _081C1D38\n\ +_081C1D60:\n\ + movs r5, 0\n\ + b _081C1D8A\n\ + .pool\n\ +_081C1D68:\n\ + ldrb r2, [r4, 0x6]\n\ + adds r0, r2, 0\n\ + muls r0, r5\n\ + lsls r0, 1\n\ + adds r0, r7, r0\n\ + ldrb r1, [r4, 0x9]\n\ + adds r1, r5\n\ + lsls r1, 5\n\ + ldrb r3, [r4, 0x8]\n\ + adds r1, r3\n\ + lsls r1, 1\n\ + add r1, r8\n\ + bl CpuSet\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ +_081C1D8A:\n\ + ldrb r0, [r4, 0x7]\n\ + cmp r5, r0\n\ + bcc _081C1D68\n\ + adds r0, r7, 0\n\ + bl Free\n\ + add sp, 0x4\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +void sub_81C1DA4(u16 a, s16 b) +{ + if (b > gUnknown_0861CC04.field_6) + b = gUnknown_0861CC04.field_6; + if (b == 0 || b == gUnknown_0861CC04.field_6) + { + sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], b, 1); + } + else + { + u8 taskId = FindTaskIdByFunc(sub_81C1E20); + if (taskId == 0xFF) + { + taskId = CreateTask(sub_81C1E20, 8); + } + gTasks[taskId].data[0] = b; + gTasks[taskId].data[1] = a; + } +} + +void sub_81C1E20(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1] += data[0]; + if (data[1] < 0) + { + data[1] = 0; + } + else if (data[1] > gUnknown_0861CC04.field_6) + { + data[1] = gUnknown_0861CC04.field_6; + } + sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], data[1], 1); + if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6) + { + if (data[0] < 0) + { + if (gUnknown_0203CF1C->unk40C0 == 2) + PutWindowTilemap(14); + + } + else + { + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + PutWindowTilemap(13); + PutWindowTilemap(19); + } + schedule_bg_copy_tilemap_to_vram(0); + DestroyTask(taskId); + } + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81C1EFC(u16 a, s16 b, u16 move) +{ + if (b > gUnknown_0861CC10.field_6) + b = gUnknown_0861CC10.field_6; + if (b == 0 || b == gUnknown_0861CC10.field_6) + sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], b, 1); + else + { + u8 taskId = FindTaskIdByFunc(sub_81C1F80); + if (taskId == 0xFF) + taskId = CreateTask(sub_81C1F80, 8); + gTasks[taskId].data[0] = b; + gTasks[taskId].data[1] = a; + gTasks[taskId].data[2] = move; + } +} + +void sub_81C1F80(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1] += data[0]; + if (data[1] < 0) + { + data[1] = 0; + } + else if (data[1] > gUnknown_0861CC10.field_6) + { + data[1] = gUnknown_0861CC10.field_6; + } + sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], data[1], 1); + if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6) + { + if (data[0] < 0) + { + if (gUnknown_0203CF1C->unk40C0 == 3 && FuncIsActiveTask(sub_81C0B8C) == 0) + PutWindowTilemap(15); + sub_81C240C(data[2]); + } + else + { + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + { + PutWindowTilemap(13); + } + PutWindowTilemap(19); + } + schedule_bg_copy_tilemap_to_vram(0); + DestroyTask(taskId); + } + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81C2074(u16 a, s16 b) +{ + if (b > gUnknown_0861CBEC.field_6) + b = gUnknown_0861CBEC.field_6; + if (b == 0 || b == gUnknown_0861CBEC.field_6) + { + sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); + sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); + } + else + { + u8 taskId = CreateTask(sub_81C20F0, 8); + gTasks[taskId].data[0] = b; + gTasks[taskId].data[1] = a; + } +} + +void sub_81C20F0(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1] += data[0]; + if (data[1] < 0) + data[1] = 0; + else if (data[1] > gUnknown_0861CBEC.field_6) + data[1] = gUnknown_0861CBEC.field_6; + sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); + schedule_bg_copy_tilemap_to_vram(3); + if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6) + { + if (data[0] < 0) + { + sub_81C4A88(); + PutWindowTilemap(13); + schedule_bg_copy_tilemap_to_vram(0); + } + DestroyTask(taskId); + } +} + +// somebody send help this is a complete fucking mess +#ifdef NONMATCHING +void sub_81C2194(u16 *a, u16 b, u8 c) +{ + u16 i; + int var; + b *= 0x1000; + var = 0x56A; + + if (c == 0) + { + for (i = 0; i < 20; i++) + { + a[(i + var) << 1] = gUnknown_08DC3CD4[i] + b; + a[((i + var) << 1) + 0x40] = gUnknown_08DC3CD4[i] + b; + a[((i + var) << 1) + 0x80] = gUnknown_08DC3CD4[i + 20] + b; + } + } + else + { + for (i = 0; i < 20; i++) + { + a[(i + var)] = gUnknown_08DC3CD4[i + 20] + b; + a[((i + var)) + 0x40] = gUnknown_08DC3CD4[i + 40] + b; + a[((i + var)) + 0x80] = gUnknown_08DC3CD4[i + 40] + b; + } + } +} +#else +__attribute__((naked)) +void sub_81C2194(u16 *a, u16 b, u8 c) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + adds r6, r0, 0\n\ + lsls r2, 24\n\ + lsls r1, 28\n\ + lsrs r4, r1, 16\n\ + ldr r7, =0x0000056a\n\ + cmp r2, 0\n\ + bne _081C21E4\n\ + movs r3, 0\n\ + ldr r5, =gUnknown_08DC3CD4\n\ +_081C21A8:\n\ + adds r2, r7, r3\n\ + lsls r2, 1\n\ + adds r2, r6\n\ + lsls r0, r3, 1\n\ + adds r0, r5\n\ + ldrh r1, [r0]\n\ + adds r1, r4, r1\n\ + strh r1, [r2]\n\ + adds r0, r2, 0\n\ + adds r0, 0x40\n\ + strh r1, [r0]\n\ + adds r2, 0x80\n\ + adds r0, r3, 0\n\ + adds r0, 0x14\n\ + lsls r0, 1\n\ + adds r0, r5\n\ + ldrh r0, [r0]\n\ + adds r0, r4, r0\n\ + strh r0, [r2]\n\ + adds r0, r3, 0x1\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + cmp r3, 0x13\n\ + bls _081C21A8\n\ + b _081C221C\n\ + .pool\n\ +_081C21E4:\n\ + movs r3, 0\n\ + ldr r5, =gUnknown_08DC3CD4\n\ +_081C21E8:\n\ + adds r1, r7, r3\n\ + lsls r1, 1\n\ + adds r1, r6\n\ + adds r0, r3, 0\n\ + adds r0, 0x14\n\ + lsls r0, 1\n\ + adds r0, r5\n\ + ldrh r0, [r0]\n\ + adds r0, r4, r0\n\ + strh r0, [r1]\n\ + adds r2, r1, 0\n\ + adds r2, 0x40\n\ + adds r0, r3, 0\n\ + adds r0, 0x28\n\ + lsls r0, 1\n\ + adds r0, r5\n\ + ldrh r0, [r0]\n\ + adds r0, r4, r0\n\ + strh r0, [r2]\n\ + adds r1, 0x80\n\ + strh r0, [r1]\n\ + adds r0, r3, 0x1\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + cmp r3, 0x13\n\ + bls _081C21E8\n\ +_081C221C:\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C2228(struct Pokemon *mon) +{ + if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0)) + { + gUnknown_0203CF1C->unkTilemap0[0x223] = 0x2C; + gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x2C; + } + else + { + gUnknown_0203CF1C->unkTilemap0[0x223] = 0x81A; + gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x81A; + } + schedule_bg_copy_tilemap_to_vram(3); +} + +void sub_81C228C(u8 a) +{ + if (a == 0) + sub_8199C30(3, 1, 4, 8, 8, 0); + else + sub_8199C30(3, 1, 4, 8, 8, 5); + schedule_bg_copy_tilemap_to_vram(3); +} + +void sub_81C22CC(struct Pokemon *unused) +{ + s64 r6r7; + struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + u16 *r9; + u8 i; + + if (summary->level < MAX_MON_LEVEL) + { + u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; + u32 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; + + r6r7 = r4 * 64 / r1; + if (r6r7 == 0 && r4 != 0) + r6r7 = 1; + } + else + { + r6r7 = 0; + } + + r9 = &gUnknown_0203CF1C->unkTilemap1_1[0x255]; + for (i = 0; i < 8; i++) + { + if (r6r7 > 7) + r9[i] = 0x206A; + else + r9[i] = 0x2062 + (r6r7 % 8); + r6r7 -= 8; + if (r6r7 < 0) + r6r7 = 0; + } + + if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->unkTilemap1) + schedule_bg_copy_tilemap_to_vram(1); + else + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81C240C(u16 move) +{ + u16* r5 = &gUnknown_0203CF1C->unkTilemap3_1[0]; + u8 i; + u8 r4; + if (move != MOVE_NONE) + { + r4 = gContestEffects[gContestMoves[move].effect].appeal; + if (r4 != 0xFF) + r4 /= 10; + for (i = 0;i < 8; i++) + { + if (r4 != 0xFF && i < r4) + { + r5[((i>>2)*32)+(i&3)+0x1E6] = 0x103A; + } + else + r5[((i>>2)*32)+(i&3)+0x1E6] = 0x1039; + } + r4 = gContestEffects[gContestMoves[move].effect].jam; + if (r4 != 0xFF) + r4 /= 10; + for (i = 0;i < 8; i++) + { + if (r4 != 0xFF && i < r4) + { + r5[((i>>2)*32)+(i&3)+0x226] = 0x103C; + } + else + r5[((i>>2)*32)+(i&3)+0x226] = 0x103D; + } + } +} + +void sub_81C2524() +{ + if (gUnknown_0203CF1C->summary.isEgg != 0) + ChangeBgX(3, 0x10000, 0); + else + ChangeBgX(3, 0, 0); +} + +void sub_81C2554() +{ + u8 i; + InitWindows(&gUnknown_0861CC24); + DeactivateAllTextPrinters(); + for (i = 0; i < 20; i++) + FillWindowPixelBuffer(i, 0); + for (i = 0; i < 8; i++) + gUnknown_0203CF1C->unk40CB[i] |= 0xFF; +} + +void sub_81C25A4(u8 a, u8 *b, u8 c, u8 d, u8 e, u8 f) +{ + AddTextPrinterParametrized2(a, 1, c, d, 0, e, &gUnknown_0861CD2C[f], 0, b); +} + +void sub_81C25E8() +{ + FillWindowPixelBuffer(17, 0); + FillWindowPixelBuffer(18, 0); + FillWindowPixelBuffer(19, 0); + if (gUnknown_0203CF1C->summary.isEgg == 0) + sub_81C2628(); + else + sub_81C2794(); + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_81C2628() +{ + u8 strArray[16]; + struct Pokemon *mon = &gUnknown_0203CF1C->currentMon; + struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + u16 r5 = SpeciesToPokedexNum(summary->species); + if (r5 != 0xFFFF) + { + StringCopy(gStringVar1, &gText_UnkCtrlF908Clear01[0]); + ConvertIntToDecimalStringN(gStringVar2, r5, 2, 3); + StringAppend(gStringVar1, gStringVar2); + if (IsMonShiny(mon) == 0) + { + sub_81C25A4(17, gStringVar1, 0, 1, 0, 1); + sub_81C228C(0); + } + else + { + sub_81C25A4(17, gStringVar1, 0, 1, 0, 7); + sub_81C228C(1); + } + PutWindowTilemap(17); + } + else + { + ClearWindowTilemap(17); + if (IsMonShiny(mon) == 0) + sub_81C228C(0); + else + sub_81C228C(1); + } + StringCopy(gStringVar1, &gText_LevelSymbol[0]); + ConvertIntToDecimalStringN(gStringVar2, summary->level, 0, 3); + StringAppend(gStringVar1, gStringVar2); + sub_81C25A4(19, gStringVar1, 0x18, 17, 0, 1); + GetMonNickname(mon, gStringVar1); + sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); + strArray[0] = CHAR_SLASH; + StringCopy(&strArray[1], &gSpeciesNames[summary->species2][0]); + sub_81C25A4(19, &strArray[0], 0, 1, 0, 1); + sub_81C27DC(mon, summary->species2); + PutWindowTilemap(18); + PutWindowTilemap(19); +} + +void sub_81C2794() +{ + GetMonNickname(&gUnknown_0203CF1C->currentMon, gStringVar1); + sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); + PutWindowTilemap(18); + ClearWindowTilemap(17); + ClearWindowTilemap(19); +} + +void sub_81C27DC(struct Pokemon *mon, u16 a) +{ + if (a != SPECIES_NIDORAN_M && a != SPECIES_NIDORAN_F) + { + u8 gender = GetMonGender(mon); + switch (gender) + { + case 0: + sub_81C25A4(0x13, &gText_MaleSymbol[0], 0x39, 17, 0, 3); + break; + case 0xFE: + sub_81C25A4(0x13, &gText_FemaleSymbol[0], 0x39, 17, 0, 4); + break; + } + } +} + +void sub_81C2838(u8 a, bool8 b, u32 c) +{ + BlitBitmapToWindow(a, (b) ? &gUnknown_0861CDD3[0] : &gUnknown_0861CDD3[0] - 0x80, c, 0, 16, 16); +} + +void sub_81C286C() +{ + int r4; + int r2; + int temp; + sub_81C25A4(0, gText_PkmnInfo, 2, 1, 0, 1); + sub_81C25A4(1, gText_PkmnSkills, 2, 1, 0, 1); + sub_81C25A4(2, gText_BattleMoves, 2, 1, 0, 1); + sub_81C25A4(3, gText_ContestMoves, 2, 1, 0, 1); + r4 = GetStringRightAlignXOffset(1, gText_Cancel2, 0x3E); + r2 = r4 - 16; + if (r2 < 0) + r2 = 0; + sub_81C2838(4, 0, r2); + sub_81C25A4(4, gText_Cancel2, r4, 1, 0, 0); + r4 = GetStringRightAlignXOffset(1, gText_Info, 0x3E); + r2 = r4 - 16; + if (r2 < 0) + r2 = 0; + sub_81C2838(5, 0, r2); + sub_81C25A4(5, gText_Info, r4, 1, 0, 0); + r4 = GetStringRightAlignXOffset(1, gText_Switch, 0x3E); + r2 = r4 - 16; + if (r2 < 0) + r2 = 0; + sub_81C2838(6, 0, r2); + sub_81C25A4(6, gText_Switch, r4, 1, 0, 0); + sub_81C25A4(8, gText_RentalPkmn, 0, 1, 0, 1); + sub_81C25A4(9, gText_TypeSlash, 0, 1, 0, 0); + temp = 6; + temp += GetStringCenterAlignXOffset(1, gText_HP4, 42); + sub_81C25A4(10, gText_HP4, temp, 1, 0, 1); + temp = 6; + temp += GetStringCenterAlignXOffset(1, gText_Attack3, 42); + sub_81C25A4(10, gText_Attack3, temp, 17, 0, 1); + temp = 6; + temp += GetStringCenterAlignXOffset(1, gText_Defense3, 42); + sub_81C25A4(10, gText_Defense3, temp, 33, 0, 1); + temp = 2; + temp += GetStringCenterAlignXOffset(1, gText_SpAtk4, 36); + sub_81C25A4(11, gText_SpAtk4, temp, 1, 0, 1); + temp = 2; + temp += GetStringCenterAlignXOffset(1, gText_SpDef4, 36); + sub_81C25A4(11, gText_SpDef4, temp, 17, 0, 1); + temp = 2; + temp += GetStringCenterAlignXOffset(1, gText_Speed2, 36); + sub_81C25A4(11, gText_Speed2, temp, 33, 0, 1); + sub_81C25A4(12, gText_ExpPoints, 6, 1, 0, 1); + sub_81C25A4(12, gText_NextLv, 6, 17, 0, 1); + sub_81C25A4(13, gText_Status, 2, 1, 0, 1); + sub_81C25A4(14, gText_Power, 0, 1, 0, 1); + sub_81C25A4(14, gText_Accuracy2, 0, 17, 0, 1); + sub_81C25A4(15, gText_Appeal, 0, 1, 0, 1); + sub_81C25A4(15, gText_Jam, 0, 17, 0, 1); +} + +void sub_81C2AFC(u8 a) +{ + u8 i; + ClearWindowTilemap(0); + ClearWindowTilemap(1); + ClearWindowTilemap(2); + ClearWindowTilemap(3); + switch (a) + { + case 0: + PutWindowTilemap(0); + PutWindowTilemap(4); + if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE) + PutWindowTilemap(8); + PutWindowTilemap(9); + break; + case 1: + PutWindowTilemap(1); + PutWindowTilemap(10); + PutWindowTilemap(11); + PutWindowTilemap(12); + break; + case 2: + PutWindowTilemap(2); + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + PutWindowTilemap(14); + } + else + PutWindowTilemap(5); + break; + case 3: + PutWindowTilemap(3); + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + PutWindowTilemap(15); + } + else + PutWindowTilemap(5); + break; + } + for (i = 0; i < 8; i++) + { + PutWindowTilemap(gUnknown_0203CF1C->unk40CB[i]); + } + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_81C2C38(u8 a) +{ + u8 i; + switch (a) + { + case 0: + ClearWindowTilemap(4); + if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE) + ClearWindowTilemap(8); + ClearWindowTilemap(9); + break; + case 1: + ClearWindowTilemap(10); + ClearWindowTilemap(11); + ClearWindowTilemap(12); + break; + case 2: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + ClearWindowTilemap(14); + } + else + ClearWindowTilemap(5); + break; + case 3: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + ClearWindowTilemap(15); + } + else + ClearWindowTilemap(5); + break; + } + for (i = 0; i < 8; i++) + sub_81C2D68(i); + schedule_bg_copy_tilemap_to_vram(0); +} + + + +#ifdef NONMATCHING +u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) +{ + u8 *r4 = gUnknown_0203CF1C->unk40CB; + if (r4[a] == 0xFF) + { + r4[a] = AddWindow(&template[a]); + FillWindowPixelBuffer(r4[a], 0); + } + return r4[a]; +} +#else +__attribute__((naked)) +u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + adds r3, r0, 0\n\ + lsls r1, 24\n\ + lsrs r2, r1, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r4, =0x000040cb\n\ + adds r1, r2, r4\n\ + ldr r0, [r0]\n\ + adds r4, r0, r1\n\ + ldrb r0, [r4]\n\ + cmp r0, 0xFF\n\ + bne _081C2D56\n\ + lsls r0, r2, 3\n\ + adds r0, r3, r0\n\ + bl AddWindow\n\ + strb r0, [r4]\n\ + ldrb r0, [r4]\n\ + movs r1, 0\n\ + bl FillWindowPixelBuffer\n\ +_081C2D56:\n\ + ldrb r0, [r4]\n\ + pop {r4}\n\ + pop {r1}\n\ + bx r1\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81C2D68(u8 a) +{ + u8 *r4 = gUnknown_0203CF1C->unk40CB; + if (r4[a] != 0xFF) + { + ClearWindowTilemap(r4[a]); + RemoveWindow(r4[a]); + r4[a] = 0xFF; + } +} +#else +__attribute__((naked)) +void sub_81C2D68(u8 a) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + ldr r1, =gUnknown_0203CF1C\n\ + ldr r2, =0x000040cb\n\ + adds r0, r2\n\ + ldr r1, [r1]\n\ + adds r4, r1, r0\n\ + ldrb r0, [r4]\n\ + cmp r0, 0xFF\n\ + beq _081C2D8C\n\ + bl ClearWindowTilemap\n\ + ldrb r0, [r4]\n\ + bl RemoveWindow\n\ + movs r0, 0xFF\n\ + strb r0, [r4]\n\ +_081C2D8C:\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C2D9C(u8 a) +{ + u16 i; + for (i = 0; i < 8; i++) + { + if (gUnknown_0203CF1C->unk40CB[i] != 0xFF) + FillWindowPixelBuffer(gUnknown_0203CF1C->unk40CB[i], 0); + } + gUnknown_0861CE54[a](); +} + +void sub_81C2DE4(u8 a) +{ + CreateTask(gUnknown_0861CE64[a], 16); +} + +void sub_81C2E00() +{ + if (gUnknown_0203CF1C->summary.isEgg) + { + sub_81C335C(); + sub_81C33CC(); + sub_81C3428(); + sub_81C349C(); + } + else + { + sub_81C2EC4(); + sub_81C2F5C(); + sub_81C2FD8(); + sub_81C302C(); + sub_81C307C(); + sub_81C3194(); + } +} + +void sub_81C2E40(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + switch (dataa) + { + case 0: + sub_81C2EC4(); + break; + case 1: + sub_81C2F5C(); + break; + case 2: + sub_81C2FD8(); + break; + case 3: + sub_81C302C(); + break; + case 4: + sub_81C307C(); + break; + case 5: + sub_81C3194(); + break; + case 6: + DestroyTask(taskId); + return; + } + data[0]++; +} + +void sub_81C2EC4() +{ + u8 r5; + int r2; + if (sub_81A6BF4() != 1 && sub_81B9E94() != 1) + { + r5 = sub_81C2D2C(&gUnknown_0861CCCC, 0); + sub_81C25A4(r5, gText_OTSlash, 0, 1, 0, 1); + r2 = GetStringWidth(1, gText_OTSlash, 0); + if (gUnknown_0203CF1C->summary.OTGender == 0) + sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 5); + else + sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 6); + } +} + +void sub_81C2F5C() +{ + int r4; + if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE) + { + ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5); + r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); + } +} + +void sub_81C2FD8() +{ + u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); +} + +void sub_81C302C() +{ + u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); +} + +void sub_81C307C() +{ + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 *text; + sub_81AFBF0(); + sub_81AFC0C(0, gUnknown_0861CE74); + sub_81AFC0C(1, gUnknown_0861CE7B); + sub_81C31C0(); + if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE || sub_81C3304() == TRUE) + sub_81AFC28(gStringVar4, gText_XNature); + else + { + u8 *alloced1 = Alloc(32); + u8 *alloced2 = Alloc(32); + sub_81C31F0(alloced1); + if (sum->metLocation <= 0xD4) + { + sub_8124610(alloced2, sum->metLocation); + sub_81AFC0C(4, alloced2); + } + if (sub_81C3220() == 1) + { + if (sum->metLevel == 0) + text = (sum->metLocation > 0xD4) ? gText_XNatureHatchedSomewhereAt : gText_XNatureHatchedAtYZ; + else + text = (sum->metLocation > 0xD4) ? gText_XNatureMetSomewhereAt : gText_XNatureMetAtYZ; + } + else if (sum->metLocation == 0xFF) + text = gText_XNatureFatefulEncounter; + else if (sum->metLocation != 0xFE && sub_81C32BC()) + text = (sum->metLocation > 0xD4) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt; + else + text = gText_XNatureObtainedInTrade; + sub_81AFC28(gStringVar4, text); + Free(alloced1); + Free(alloced2); + } +} + +void sub_81C3194() +{ + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); +} + +void sub_81C31C0() +{ + struct UnkSummaryStruct *sumStruct = gUnknown_0203CF1C; + sub_81AFC0C(2, gNatureNamePointers[sumStruct->summary.nature]); + sub_81AFC0C(5, gText_EmptyString5); +} + +void sub_81C31F0(u8 *a) +{ + u8 level = gUnknown_0203CF1C->summary.metLevel; + if (level == 0) + level = 5; + ConvertIntToDecimalStringN(a, level, 0, 3); + sub_81AFC0C(3, a); +} + +u8 sub_81C3220() +{ + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + u32 r4; + u8 r5; + if (gUnknown_0203CF1C->unk0 == (union UnkUnion *)&gEnemyParty) + { + u8 multiID = GetMultiplayerId()^1; + r4 = (u16)gLinkPlayers[multiID].trainerId; + r5 = gLinkPlayers[multiID].gender; + StringCopy(gStringVar1, gLinkPlayers[multiID].name); + } + else + { + r4 = GetPlayerIDAsU32() & 0xFFFF; + r5 = gSaveBlock2Ptr->playerGender; + StringCopy(gStringVar1, gSaveBlock2Ptr->playerName); + } + if (r5 != sum->OTGender || r4 != (sum->OTID & 0xFFFF) || StringCompareWithoutExtCtrlCodes(gStringVar1, sum->OTName)) + { + return 0; + } + return 1; +} + +bool8 sub_81C32BC() +{ + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 r0 = sum->metGame - 1; + if (r0 <= 4) + return TRUE; + return FALSE; +} + +bool8 sub_81C32E0() +{ + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 r0 = sum->metGame - 1; + if (r0 <= 2) + return TRUE; + return FALSE; +} + +bool8 sub_81C3304() +{ + if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle) + { + if (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5) + return TRUE; + } + return FALSE; +} + +#ifdef NONMATCHING +void sub_81C335C() +{ + u8 r4 = sub_81C2D2C(&gUnknown_0861CCCC, 0); + u32 r5 = GetStringWidth(1, gText_OTSlash, 0); + sub_81C25A4(r4, gText_OTSlash, 0, 1, 0, 1); + sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1); +} +#else +__attribute__((naked)) +void sub_81C335C() +{ + asm(".syntax unified\n\ + push {r4-r6,lr}\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5,r6}\n\ + sub sp, 0x8\n\ + ldr r0, =gUnknown_0861CCCC\n\ + movs r1, 0\n\ + bl sub_81C2D2C\n\ + adds r4, r0, 0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + ldr r0, =gText_OTSlash\n\ + mov r8, r0\n\ + movs r0, 0x1\n\ + mov r1, r8\n\ + movs r2, 0\n\ + bl GetStringWidth\n\ + adds r5, r0, 0\n\ + movs r0, 0\n\ + mov r9, r0\n\ + str r0, [sp]\n\ + movs r6, 0x1\n\ + str r6, [sp, 0x4]\n\ + adds r0, r4, 0\n\ + mov r1, r8\n\ + movs r2, 0\n\ + movs r3, 0x1\n\ + bl sub_81C25A4\n\ + ldr r1, =gText_FiveMarks\n\ + lsls r5, 24\n\ + lsrs r5, 24\n\ + mov r0, r9\n\ + str r0, [sp]\n\ + str r6, [sp, 0x4]\n\ + adds r0, r4, 0\n\ + adds r2, r5, 0\n\ + movs r3, 0x1\n\ + bl sub_81C25A4\n\ + add sp, 0x8\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C33CC() +{ + int r4; + StringCopy(gStringVar1, gText_UnkCtrlF907F908); + StringAppend(gStringVar1, gText_FiveMarks); + r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); +} + +void sub_81C3428() +{ + u8 *text; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + if (gUnknown_0203CF1C->summary.sanity == 1) + text = gText_EggWillTakeALongTime; + else if (sum->friendship <= 5) + text = gText_EggAboutToHatch; + else if (sum->friendship <= 10) + text = gText_EggWillHatchSoon; + else if (sum->friendship <= 40) + text = gText_EggWillTakeSomeTime; + else + text = gText_EggWillTakeALongTime; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); +} + +void sub_81C349C() +{ + u8 *text; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + if (gUnknown_0203CF1C->summary.sanity != 1) + { + if (sum->metLocation == 0xFF) + text = gText_PeculiarEggNicePlace; + else if (sub_81C32BC() == 0 || sub_81C3220() == 0) + text = gText_PeculiarEggTrade; + else if (sum->metLocation == 0xFD) + text = (sub_81C32E0() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler; + else + text = gText_OddEggFoundByCouple; + } + else + text = gText_OddEggFoundByCouple; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); +} + +void sub_81C3530() +{ + sub_81C35E4(); + sub_81C3690(); + sub_81C3710(); + sub_81C37D8(); + sub_81C3808(); + sub_81C3890(); + sub_81C38C0(); +} + +void sub_81C3554(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + switch (dataa) + { + case 0: + sub_81C35E4(); + break; + case 1: + sub_81C3690(); + break; + case 2: + sub_81C3710(); + break; + case 3: + sub_81C37D8(); + break; + case 4: + sub_81C3808(); + break; + case 5: + sub_81C3890(); + break; + case 6: + sub_81C38C0(); + break; + case 7: + DestroyTask(taskId); + return; + } + data[0]++; +} + +void sub_81C35E4() +{ + u8 *text; + int offset; + if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == 1 && (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5)) + { + text = (u8*)ItemId_GetItem(ITEM_ENIGMA_BERRY); + } + else if (gUnknown_0203CF1C->summary.item == ITEM_NONE) + text = gText_None; + else + { + CopyItemName(gUnknown_0203CF1C->summary.item, gStringVar1); + text = gStringVar1; + } + offset = GetStringCenterAlignXOffset(1, text, 0x48) + 6; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); +} + +void sub_81C3690() +{ + u8 *text; + int offset; + if (gUnknown_0203CF1C->summary.ribbons == 0) + text = gText_None; + else + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.ribbons, 1, 2); + StringExpandPlaceholders(gStringVar4, gText_RibbonsVar1); + text = gStringVar4; + } + offset = GetStringCenterAlignXOffset(1, text, 0x46) + 6; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); +} + +void sub_81C3710() +{ + u8 *alloced1 = Alloc(8); + u8 *alloced2 = Alloc(8); + u8 *alloced3 = Alloc(8); + u8 *alloced4 = Alloc(8); + ConvertIntToDecimalStringN(alloced1, gUnknown_0203CF1C->summary.currentHP, 1, 3); + ConvertIntToDecimalStringN(alloced2, gUnknown_0203CF1C->summary.maxHP, 1, 3); + ConvertIntToDecimalStringN(alloced3, gUnknown_0203CF1C->summary.atk, 1, 7); + ConvertIntToDecimalStringN(alloced4, gUnknown_0203CF1C->summary.def, 1, 7); + sub_81AFBF0(); + sub_81AFC0C(0, alloced1); + sub_81AFC0C(1, alloced2); + sub_81AFC0C(2, alloced3); + sub_81AFC0C(3, alloced4); + sub_81AFC28(gStringVar4, gUnknown_0861CE82); + Free(alloced1); + Free(alloced2); + Free(alloced3); + Free(alloced4); +} + +void sub_81C37D8() +{ + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); +} + +void sub_81C3808() +{ + ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.spatk, 1, 3); + ConvertIntToDecimalStringN(gStringVar2, gUnknown_0203CF1C->summary.spdef, 1, 3); + ConvertIntToDecimalStringN(gStringVar3, gUnknown_0203CF1C->summary.speed, 1, 3); + sub_81AFBF0(); + sub_81AFC0C(0, gStringVar1); + sub_81AFC0C(1, gStringVar2); + sub_81AFC0C(2, gStringVar3); + sub_81AFC28(gStringVar4, gUnknown_0861CE8E); +} + +void sub_81C3890() +{ + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); +} + +void sub_81C38C0() +{ + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 r6 = sub_81C2D2C(&gUnknown_0861CCEC, 4); + int offset; + u32 expToNextLevel; + ConvertIntToDecimalStringN(gStringVar1, sum->exp, 1, 7); + offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; + sub_81C25A4(r6, gStringVar1, offset, 1, 0, 0); + if (sum->level < MAX_MON_LEVEL) + expToNextLevel = gExperienceTables[gBaseStats[sum->species].growthRate][sum->level + 1] - sum->exp; + else + expToNextLevel = 0; + ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, 1, 6); + offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; + sub_81C25A4(r6, gStringVar1, offset, 17, 0, 0); +} + +void sub_81C3984() +{ + sub_81C3B08(0); + sub_81C3B08(1); + sub_81C3B08(2); + sub_81C3B08(3); + if (gUnknown_0203CF1C->unk40BC == 3) + { + sub_81C3F44(); + if (gUnknown_0203CF1C->unk40C6 == 4) + { + if (gUnknown_0203CF1C->unk40C4 != 0) + sub_81C3E9C(gUnknown_0203CF1C->unk40C4); + } + else + sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); + } +} + +void sub_81C39F0(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + + switch (dataa) + { + case 0: + sub_81C3B08(0); + break; + case 1: + sub_81C3B08(1); + break; + case 2: + sub_81C3B08(2); + break; + case 3: + sub_81C3B08(3); + break; + case 4: + if (gUnknown_0203CF1C->unk40BC == 3) + sub_81C3F44(); + break; + case 5: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if (gUnknown_0203CF1C->unk40C6 == 4) + data[1] = gUnknown_0203CF1C->unk40C4; + else + data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + } + break; + case 6: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + sub_81C3E9C(data[1]); + } + break; + case 7: + DestroyTask(taskId); + return; + } + data[0]++; +} + +#ifdef NONMATCHING +void sub_81C3B08(u8 a) +{ + struct UnkSummaryStruct *r10 = gUnknown_0203CF1C; + u8 r8 = sub_81C2D2C(&gUnknown_0861CD14, 0); + u8 sp = sub_81C2D2C(&gUnknown_0861CD14, 1); + u8 r6; + u8 r5; + u8 *text; + int offset; + u16 move; + if (r10->summary.moves[a] != 0) + { + move = r10->summary.moves[a]; + r6 = CalculatePPWithBonus(move, r10->summary.ppBonuses, a); + sub_81C25A4(r8, gMoveNames[move], 0, (a<<4) + 1, 0, 1); + ConvertIntToDecimalStringN(gStringVar1, r10->summary.pp[a], 1, 2); + ConvertIntToDecimalStringN(gStringVar2, r6, 1, 2); + sub_81AFBF0(); + sub_81AFC0C(0, gStringVar1); + sub_81AFC0C(1, gStringVar2); + sub_81AFC28(gStringVar4, gUnknown_0861CE97); + text = gStringVar4; + r5 = GetCurrentPpToMaxPpState(r10->summary.pp[a], r6) + 9; + offset = GetStringRightAlignXOffset(1, text, 0x2C); + } + else + { + sub_81C25A4(r8, gText_OneDash, 0, (a<<4) + 1, 0, 1); + text = gText_TwoDashes; + r5 = 12; + offset = GetStringCenterAlignXOffset(1, text, 0x2C); + } + sub_81C25A4(sp, text, offset, (a<<4), 0, r5); +} +#else +__attribute__((naked)) +void sub_81C3B08(u8 a) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0xC\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + mov r10, r0\n\ + ldr r4, =gUnknown_0861CD14\n\ + adds r0, r4, 0\n\ + movs r1, 0\n\ + bl sub_81C2D2C\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + adds r0, r4, 0\n\ + movs r1, 0x1\n\ + bl sub_81C2D2C\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x8]\n\ + lsls r1, r7, 1\n\ + mov r0, r10\n\ + adds r0, 0x84\n\ + adds r0, r1\n\ + ldrh r5, [r0]\n\ + cmp r5, 0\n\ + beq _081C3C00\n\ + mov r0, r10\n\ + adds r0, 0xA4\n\ + ldrb r1, [r0]\n\ + adds r0, r5, 0\n\ + adds r2, r7, 0\n\ + bl CalculatePPWithBonus\n\ + adds r6, r0, 0\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + movs r0, 0xD\n\ + adds r1, r5, 0\n\ + muls r1, r0\n\ + ldr r0, =gMoveNames\n\ + adds r1, r0\n\ + lsls r0, r7, 4\n\ + mov r9, r0\n\ + mov r3, r9\n\ + adds r3, 0x1\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + movs r0, 0\n\ + str r0, [sp]\n\ + movs r0, 0x1\n\ + str r0, [sp, 0x4]\n\ + mov r0, r8\n\ + movs r2, 0\n\ + bl sub_81C25A4\n\ + ldr r0, =gStringVar1\n\ + mov r8, r0\n\ + mov r5, r10\n\ + adds r5, 0x8C\n\ + adds r5, r7\n\ + ldrb r1, [r5]\n\ + movs r2, 0x1\n\ + movs r3, 0x2\n\ + bl ConvertIntToDecimalStringN\n\ + ldr r4, =gStringVar2\n\ + adds r0, r4, 0\n\ + adds r1, r6, 0\n\ + movs r2, 0x1\n\ + movs r3, 0x2\n\ + bl ConvertIntToDecimalStringN\n\ + bl sub_81AFBF0\n\ + movs r0, 0\n\ + mov r1, r8\n\ + bl sub_81AFC0C\n\ + movs r0, 0x1\n\ + adds r1, r4, 0\n\ + bl sub_81AFC0C\n\ + ldr r4, =gStringVar4\n\ + ldr r1, =gUnknown_0861CE97\n\ + adds r0, r4, 0\n\ + bl sub_81AFC28\n\ + adds r7, r4, 0\n\ + ldrb r0, [r5]\n\ + adds r1, r6, 0\n\ + bl GetCurrentPpToMaxPpState\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + adds r5, r0, 0\n\ + adds r5, 0x9\n\ + movs r0, 0x1\n\ + adds r1, r7, 0\n\ + movs r2, 0x2C\n\ + bl GetStringRightAlignXOffset\n\ + mov r4, r9\n\ + b _081C3C26\n\ + .pool\n\ +_081C3C00:\n\ + ldr r1, =gText_OneDash\n\ + lsls r4, r7, 4\n\ + adds r3, r4, 0x1\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + str r5, [sp]\n\ + movs r0, 0x1\n\ + str r0, [sp, 0x4]\n\ + mov r0, r8\n\ + movs r2, 0\n\ + bl sub_81C25A4\n\ + ldr r7, =gText_TwoDashes\n\ + movs r5, 0xC\n\ + movs r0, 0x1\n\ + adds r1, r7, 0\n\ + movs r2, 0x2C\n\ + bl GetStringCenterAlignXOffset\n\ +_081C3C26:\n\ + lsls r2, r0, 24\n\ + lsrs r2, 24\n\ + adds r3, r4, 0x1\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + movs r0, 0\n\ + str r0, [sp]\n\ + lsls r0, r5, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x4]\n\ + ldr r0, [sp, 0x8]\n\ + adds r1, r7, 0\n\ + bl sub_81C25A4\n\ + add sp, 0xC\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C3C5C(u16 move) +{ + u8 *text; + if (move != 0) + { + FillWindowPixelRect(14, 0, 0x35, 0, 0x13, 0x20); + if (gBattleMoves[move].power <= 1) + text = gText_ThreeDashes; + else + { + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, 1, 3); + text = gStringVar1; + } + sub_81C25A4(14, text, 0x35, 1, 0, 0); + if (gBattleMoves[move].accuracy == 0) + text = gText_ThreeDashes; + else + { + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, 1, 3); + text = gStringVar1; + } + sub_81C25A4(14, text, 0x35, 17, 0, 0); + } +} + +void sub_81C3D08() +{ + sub_81C3B08(0); + sub_81C3B08(1); + sub_81C3B08(2); + sub_81C3B08(3); + if (gUnknown_0203CF1C->unk40BC == 3) + { + sub_81C3F44(); + sub_81C3E2C(gUnknown_0203CF1C->unk40C6); + } +} + +void sub_81C3D54(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + + switch (dataa) + { + case 0: + sub_81C3B08(0); + break; + case 1: + sub_81C3B08(1); + break; + case 2: + sub_81C3B08(2); + break; + case 3: + sub_81C3B08(3); + break; + case 4: + if (gUnknown_0203CF1C->unk40BC == 3) + sub_81C3F44(); + break; + case 5: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + sub_81C3E2C(gUnknown_0203CF1C->unk40C6); + } + break; + case 6: + DestroyTask(taskId); + return; + } + data[0]++; +} \ No newline at end of file diff --git a/src/start_menu.c b/src/start_menu.c index be30d0e53..37331a922 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -207,7 +207,7 @@ static bool32 PrintStartMenuItemsMultistep(s16 *index, u32 n) do { - if (sStartMenuItems[sCurrentStartMenuActions[_index]].func == StartMenu_PlayerName) + if (sStartMenuItems[sCurrentStartMenuActions[_index]].func.u8_void == StartMenu_PlayerName) { } diff --git a/src/tv.c b/src/tv.c index 7f64b46ac..3c822b394 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2353,7 +2353,7 @@ void sub_80EDFB4(TVShow *show) show->secretBaseVisit.move = sTV_SecretBaseVisitMonsTemp[j].move; } -void sub_80EE104(void) +void TV_PutSecretBaseVisitOnTheAir(void) { TVShow *show; diff --git a/sym_ewram.txt b/sym_ewram.txt index 2ae20d3d3..f64bb98b8 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1119,68 +1119,10 @@ gUnknown_0203A144: @ 203A144 gUnknown_0203A148: @ 203A148 .space 0x4 -gUnknown_0203A14C: @ 203A14C - .space 0x4 + .include "src/decoration.o" + .align 2 -gUnknown_0203A150: @ 203A150 - .space 0x1 - -gUnknown_0203A151: @ 203A151 - .space 0x1 - -gUnknown_0203A152: @ 203A152 - .space 0x10 - -gUnknown_0203A162: @ 203A162 - .space 0xC - -gUnknown_0203A16E: @ 203A16E - .space 0x2 - -gUnknown_0203A170: @ 203A170 - .space 0x2 - -gUnknown_0203A172: @ 203A172 - .space 0x1 - -gUnknown_0203A173: @ 203A173 - .space 0x9 - -gUnknown_0203A17C: @ 203A17C - .space 0xC - -gUnknown_0203A188: @ 203A188 - .space 0x4 - -gUnknown_0203A18C: @ 203A18C - .space 0x4 - -gUnknown_0203A190: @ 203A190 - .space 0x8A4 - -gUnknown_0203AA34: @ 203AA34 - .space 0x2 - -gUnknown_0203AA36: @ 203AA36 - .space 0x2 - -gUnknown_0203AA38: @ 203AA38 - .space 0x1 - -gUnknown_0203AA39: @ 203AA39 - .space 0x1 - -gUnknown_0203AA3A: @ 203AA3A - .space 0x2 - -gUnknown_0203AA3C: @ 203AA3C - .space 0x8 - -gUnknown_0203AA44: @ 203AA44 - .space 0x80 - -gUnknown_0203AAC4: @ 203AAC4 - .space 0x4 +@ slot_machine gUnknown_0203AAC8: @ 203AAC8 .space 0x4 @@ -1408,9 +1350,7 @@ gUnknown_0203BC34: @ 203BC34 gUnknown_0203BC38: @ 203BC38 .space 0x8 -gDecorationInventories: @ 203BC40 - .space 0x40 - + .include "src/decoration_inventory.o" .include "src/roamer.o" gUnknown_0203BC88: @ 203BC88 From 1f3a867a0b05c52344c5a145db3272e653deb697 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 16:38:11 +0200 Subject: [PATCH 12/29] battle link partner controller is done --- asm/battle_controller_linkopponent.s | 14 +- asm/battle_controller_linkpartner.s | 5596 ----------------------- include/pokemon.h | 2 +- ld_script.txt | 1 - src/battle_controller_link_partner.c | 1653 ++++++- src/battle_controller_recorded_player.c | 2 +- src/battle_controllers.c | 44 +- src/battle_message.c | 8 +- src/battle_script_commands.c | 6 +- src/battle_util.c | 4 +- src/pokemon_3.c | 4 +- 11 files changed, 1632 insertions(+), 5702 deletions(-) delete mode 100644 asm/battle_controller_linkpartner.s diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index f719ab59d..d0ada0d5d 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -4054,7 +4054,7 @@ _08066796: .pool _080667A8: ldrb r0, [r5] - bl sub_806D864 + bl GetBankMultiplayerId ldr r6, =gLinkPlayers lsls r1, r0, 3 subs r1, r0 @@ -4065,7 +4065,7 @@ _080667A8: cmp r0, 0x4 beq _080667D8 ldrb r0, [r5] - bl sub_806D864 + bl GetBankMultiplayerId lsls r1, r0, 3 subs r1, r0 lsls r1, 2 @@ -4077,7 +4077,7 @@ _080667A8: bne _080667F4 _080667D8: ldrb r0, [r5] - bl sub_806D864 + bl GetBankMultiplayerId lsls r1, r0, 3 subs r1, r0 lsls r1, 2 @@ -4089,7 +4089,7 @@ _080667D8: .pool _080667F4: ldrb r0, [r5] - bl sub_806D864 + bl GetBankMultiplayerId lsls r1, r0, 3 subs r1, r0 lsls r1, 2 @@ -4100,7 +4100,7 @@ _080667F4: cmp r0, 0x2 beq _08066822 ldrb r0, [r5] - bl sub_806D864 + bl GetBankMultiplayerId lsls r1, r0, 3 subs r1, r0 lsls r1, 2 @@ -4111,7 +4111,7 @@ _080667F4: bne _08066838 _08066822: ldrb r0, [r5] - bl sub_806D864 + bl GetBankMultiplayerId lsls r1, r0, 3 subs r1, r0 lsls r1, 2 @@ -4122,7 +4122,7 @@ _08066822: b _08066924 _08066838: ldrb r0, [r5] - bl sub_806D864 + bl GetBankMultiplayerId b _0806693A _08066840: movs r7, 0xB0 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s deleted file mode 100644 index 9f96d592a..000000000 --- a/asm/battle_controller_linkpartner.s +++ /dev/null @@ -1,5596 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - thumb_func_start sub_814AF1C -sub_814AF1C: @ 814AF1C - 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 _0814AF40 - bl LinkPartnerBufferExecCompleted -_0814AF40: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814AF1C - - thumb_func_start sub_814AF54 -sub_814AF54: @ 814AF54 - 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 _0814AFA4 - movs r0, 0 - 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 LinkPartnerBufferExecCompleted -_0814AFA4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814AF54 - - thumb_func_start sub_814AFBC -sub_814AFBC: @ 814AFBC - 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 _0814AFF4 - 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 LinkPartnerBufferExecCompleted -_0814AFF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814AFBC - - thumb_func_start sub_814B004 -sub_814B004: @ 814B004 - push {r4-r6,lr} - movs r6, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814B028 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814B05C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0814B05C -_0814B028: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - 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 _0814B094 - b _0814B092 - .pool -_0814B05C: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r2, 0 - adds r4, 0x1C - adds r0, r4 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - cmp r2, r0 - bne _0814B094 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r2 - bne _0814B094 -_0814B092: - movs r6, 0x1 -_0814B094: - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - beq _0814B0A0 - movs r6, 0 -_0814B0A0: - cmp r6, 0 - beq _0814B0C6 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - 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 - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814AFBC - str r1, [r0] -_0814B0C6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B004 - - thumb_func_start sub_814B0E8 -sub_814B0E8: @ 814B0E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gBattleSpritesDataPtr - mov r12, r0 - ldr r0, [r0] - ldr r7, =gActiveBank - 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 - beq _0814B114 - b _0814B252 -_0814B114: - movs r1, 0x2 - mov r8, r1 - adds r1, r2, 0 - mov r0, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _0814B136 - b _0814B252 -_0814B136: - ldr r1, =gSprites - mov r10, r1 - ldr r0, =gUnknown_03005D7C - mov r9, r0 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r5, r10 - adds r5, 0x1C - adds r0, r5 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _0814B252 - ldr r0, =gBankSpriteIds - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r3 - bne _0814B252 - ldrb r0, [r4, 0x9] - adds r0, 0x1 - strb r0, [r4, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0814B252 - mov r1, r12 - ldr r0, [r1] - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r6, [r0, 0x9] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814B1F0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0814B1F0 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - add r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r0, [r7] - mov r1, r8 - 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] - mov r1, r8 - eors r0, r1 - bl sub_8076918 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0814B1F0: - 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 r5, =gHealthBoxesIds - 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 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B004 - str r1, [r0] -_0814B252: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B0E8 - - thumb_func_start sub_814B290 -sub_814B290: @ 814B290 - 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 r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _0814B2BE - movs r2, 0x24 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _0814B2BE - bl LinkPartnerBufferExecCompleted -_0814B2BE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B290 - - thumb_func_start bx_t4_healthbar_update -bx_t4_healthbar_update: @ 814B2D0 - 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 _0814B318 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _0814B332 - .pool -_0814B318: - 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 LinkPartnerBufferExecCompleted -_0814B332: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_t4_healthbar_update - - thumb_func_start sub_814B340 -sub_814B340: @ 814B340 - 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 _0814B3BC - 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 LinkPartnerBufferExecCompleted -_0814B3BC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B340 - - thumb_func_start sub_814B3DC -sub_814B3DC: @ 814B3DC - 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 _0814B430 - 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 LinkPartnerBufferExecCompleted -_0814B430: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B3DC - - thumb_func_start bx_t4_button_a -bx_t4_button_a: @ 814B44C - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0814B45E - bl LinkPartnerBufferExecCompleted -_0814B45E: - pop {r0} - bx r0 - thumb_func_end bx_t4_button_a - - thumb_func_start dp01t_0F_4_move_anim -dp01t_0F_4_move_anim: @ 814B464 - 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 _0814B4B0 - 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 LinkPartnerBufferExecCompleted - b _0814B4DA - .pool -_0814B4B0: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0814B4D4 - 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] -_0814B4D4: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_0814B4DA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end dp01t_0F_4_move_anim - - thumb_func_start sub_814B4E0 -sub_814B4E0: @ 814B4E0 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - 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 _0814B532 - adds r0, r3, 0 - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r2, [r4] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0814B526 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_0814B526: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_814B554 - str r0, [r1] -_0814B532: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B4E0 - - thumb_func_start sub_814B554 -sub_814B554: @ 814B554 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0814B590 - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - 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 _0814B590 - bl LinkPartnerBufferExecCompleted -_0814B590: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B554 - - thumb_func_start sub_814B5A8 -sub_814B5A8: @ 814B5A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r7, =gActiveBank - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0814B664 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - 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, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r0, =gBattlePartyID - mov r8, r0 - ldrb r1, [r7] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - bl sub_805E990 - ldr r1, =gBankSpriteIds - ldrb r0, [r7] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - lsls r1, 1 - add r1, r8 - ldrh r1, [r1] - muls r1, r6 - adds r1, r5 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - bl sub_8076918 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B4E0 - str r1, [r0] -_0814B664: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B5A8 - - thumb_func_start sub_814B69C -sub_814B69C: @ 814B69C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r4, =gActiveBank - ldrb r2, [r4] - 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 _0814B6CE - 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 -_0814B6CE: - ldr r5, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r4] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0814B714 - 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 _0814B714 - adds r0, r3, r5 - bl DestroySprite - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B5A8 - str r1, [r0] -_0814B714: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B69C - - thumb_func_start LinkPartnerBufferExecCompleted -LinkPartnerBufferExecCompleted: @ 814B740 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkPartnerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0814B794 - 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 _0814B7A6 - .pool -_0814B794: - 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] -_0814B7A6: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerBufferExecCompleted - - thumb_func_start sub_814B7B8 -sub_814B7B8: @ 814B7B8 - 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 _0814B7DA - bl LinkPartnerBufferExecCompleted -_0814B7DA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B7B8 - - thumb_func_start sub_814B7E8 -sub_814B7E8: @ 814B7E8 - 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 _0814B80A - bl LinkPartnerBufferExecCompleted -_0814B80A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B7E8 - - thumb_func_start LinkPartnerHandleGetMonData -LinkPartnerHandleGetMonData: @ 814B818 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0814B850 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_player_pokemon__ - adds r6, r0, 0 - b _0814B872 - .pool -_0814B850: - ldrb r4, [r1] - movs r5, 0 -_0814B854: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0814B86A - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_player_pokemon__ - adds r6, r0 -_0814B86A: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0814B854 -_0814B872: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl LinkPartnerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleGetMonData - - thumb_func_start dp01_getattr_by_ch1_for_player_pokemon__ -dp01_getattr_by_ch1_for_player_pokemon__: @ 814B88C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0814B8B6 - bl _0814C022 -_0814B8B6: - lsls r0, 2 - ldr r1, =_0814B8CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0814B8CC: - .4byte _0814B9BC - .4byte _0814BBE0 - .4byte _0814BBF0 - .4byte _0814BC00 - .4byte _0814BC68 - .4byte _0814BC68 - .4byte _0814BC68 - .4byte _0814BC68 - .4byte _0814BC84 - .4byte _0814BCC0 - .4byte _0814BCC0 - .4byte _0814BCC0 - .4byte _0814BCC0 - .4byte _0814C022 - .4byte _0814C022 - .4byte _0814C022 - .4byte _0814C022 - .4byte _0814BCDC - .4byte _0814BCEC - .4byte _0814BD1C - .4byte _0814BD2C - .4byte _0814BD3C - .4byte _0814BD4C - .4byte _0814BD5C - .4byte _0814BD6C - .4byte _0814BD7C - .4byte _0814BD8C - .4byte _0814BD9C - .4byte _0814BDAC - .4byte _0814BDBC - .4byte _0814BDCC - .4byte _0814BDDC - .4byte _0814BE2C - .4byte _0814BE3C - .4byte _0814BE4C - .4byte _0814BE5C - .4byte _0814BE6C - .4byte _0814BE7C - .4byte _0814BE8C - .4byte _0814BE9C - .4byte _0814BEAC - .4byte _0814BEE0 - .4byte _0814BEF0 - .4byte _0814BF00 - .4byte _0814BF10 - .4byte _0814BF20 - .4byte _0814BF30 - .4byte _0814BF40 - .4byte _0814BF50 - .4byte _0814BF70 - .4byte _0814BF80 - .4byte _0814BF90 - .4byte _0814BFA0 - .4byte _0814BFB0 - .4byte _0814BFC0 - .4byte _0814BFD0 - .4byte _0814BFE0 - .4byte _0814BFF0 - .4byte _0814C000 - .4byte _0814C010 -_0814B9BC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_0814BA08: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _0814BA08 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_0814BBC0: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _0814BBC0 - b _0814C022 - .pool -_0814BBE0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _0814BF5A - .pool -_0814BBF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _0814BF5A - .pool -_0814BC00: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_0814BC16: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0814BC16 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0814BC54: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0814BC54 - b _0814C022 - .pool -_0814BC68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _0814BF5A - .pool -_0814BC84: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_0814BC90: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0814BC90 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0814C022 - .pool -_0814BCC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _0814C01A - .pool -_0814BCDC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0814BCF6 - .pool -_0814BCEC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0814BCF6: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0814C022 - .pool -_0814BD1C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _0814C01A - .pool -_0814BD2C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _0814C01A - .pool -_0814BD3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _0814C01A - .pool -_0814BD4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _0814C01A - .pool -_0814BD5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _0814C01A - .pool -_0814BD6C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _0814C01A - .pool -_0814BD7C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _0814C01A - .pool -_0814BD8C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _0814C01A - .pool -_0814BD9C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _0814C01A - .pool -_0814BDAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _0814C01A - .pool -_0814BDBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _0814C01A - .pool -_0814BDCC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _0814C01A - .pool -_0814BDDC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0814C022 - .pool -_0814BE2C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _0814C01A - .pool -_0814BE3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _0814C01A - .pool -_0814BE4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _0814C01A - .pool -_0814BE5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _0814C01A - .pool -_0814BE6C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _0814C01A - .pool -_0814BE7C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _0814C01A - .pool -_0814BE8C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0814BEB6 - .pool -_0814BE9C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _0814BF5A - .pool -_0814BEAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0814BEB6: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0814C022 - .pool -_0814BEE0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _0814C01A - .pool -_0814BEF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _0814BF5A - .pool -_0814BF00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _0814BF5A - .pool -_0814BF10: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _0814BF5A - .pool -_0814BF20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _0814BF5A - .pool -_0814BF30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _0814BF5A - .pool -_0814BF40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _0814BF5A - .pool -_0814BF50: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_0814BF5A: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0814C022 - .pool -_0814BF70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _0814C01A - .pool -_0814BF80: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _0814C01A - .pool -_0814BF90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _0814C01A - .pool -_0814BFA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _0814C01A - .pool -_0814BFB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _0814C01A - .pool -_0814BFC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _0814C01A - .pool -_0814BFD0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _0814C01A - .pool -_0814BFE0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _0814C01A - .pool -_0814BFF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _0814C01A - .pool -_0814C000: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _0814C01A - .pool -_0814C010: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_0814C01A: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0814C022: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_player_pokemon__ - - thumb_func_start LinkPartnerHandleGetRawMonData -LinkPartnerHandleGetRawMonData: @ 814C038 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleGetRawMonData - - thumb_func_start LinkPartnerHandleSetMonData -LinkPartnerHandleSetMonData: @ 814C044 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0814C074 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_814C09C - b _0814C092 - .pool -_0814C074: - ldrb r4, [r1] - movs r5, 0 -_0814C078: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0814C086 - adds r0, r5, 0 - bl sub_814C09C -_0814C086: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0814C078 -_0814C092: - bl LinkPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleSetMonData - - thumb_func_start sub_814C09C -sub_814C09C: @ 814C09C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _0814C0C8 - bl _0814CA62 -_0814C0C8: - lsls r0, 2 - ldr r1, =_0814C0E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0814C0E0: - .4byte _0814C1D0 - .4byte _0814C368 - .4byte _0814C388 - .4byte _0814C3A8 - .4byte _0814C400 - .4byte _0814C400 - .4byte _0814C400 - .4byte _0814C400 - .4byte _0814C428 - .4byte _0814C48C - .4byte _0814C48C - .4byte _0814C48C - .4byte _0814C48C - .4byte _0814CA62 - .4byte _0814CA62 - .4byte _0814CA62 - .4byte _0814CA62 - .4byte _0814C4BC - .4byte _0814C4DC - .4byte _0814C4FC - .4byte _0814C51C - .4byte _0814C53C - .4byte _0814C55C - .4byte _0814C57C - .4byte _0814C59C - .4byte _0814C5BC - .4byte _0814C5DC - .4byte _0814C5FC - .4byte _0814C61C - .4byte _0814C63C - .4byte _0814C65C - .4byte _0814C67C - .4byte _0814C6EC - .4byte _0814C70C - .4byte _0814C72C - .4byte _0814C74C - .4byte _0814C76C - .4byte _0814C78C - .4byte _0814C7AC - .4byte _0814C7CC - .4byte _0814C7EC - .4byte _0814C80C - .4byte _0814C82C - .4byte _0814C84C - .4byte _0814C86C - .4byte _0814C88C - .4byte _0814C8AC - .4byte _0814C8CC - .4byte _0814C8EC - .4byte _0814C90C - .4byte _0814C92C - .4byte _0814C94C - .4byte _0814C96C - .4byte _0814C98C - .4byte _0814C9AC - .4byte _0814C9CC - .4byte _0814C9EC - .4byte _0814CA0C - .4byte _0814CA2C - .4byte _0814CA4C -_0814C1D0: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_0814C236: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0814C236 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0814CA62 - .pool -_0814C368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _0814CA62 - .pool -_0814C388: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _0814CA62 - .pool -_0814C3A8: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0814C3C2: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0814C3C2 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0814CA62 - .pool -_0814C400: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0814C4A4 - .pool -_0814C428: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0814CA62 - .pool -_0814C48C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0814C4A4: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0814CA62 - .pool -_0814C4BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _0814CA62 - .pool -_0814C4DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _0814CA62 - .pool -_0814C4FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _0814CA62 - .pool -_0814C51C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _0814CA62 - .pool -_0814C53C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _0814CA62 - .pool -_0814C55C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _0814CA62 - .pool -_0814C57C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _0814CA62 - .pool -_0814C59C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _0814CA62 - .pool -_0814C5BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _0814CA62 - .pool -_0814C5DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _0814CA62 - .pool -_0814C5FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _0814CA62 - .pool -_0814C61C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _0814CA62 - .pool -_0814C63C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _0814CA62 - .pool -_0814C65C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _0814CA62 - .pool -_0814C67C: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _0814C79C - .pool -_0814C6EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _0814CA62 - .pool -_0814C70C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _0814CA62 - .pool -_0814C72C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _0814CA62 - .pool -_0814C74C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _0814CA62 - .pool -_0814C76C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _0814CA62 - .pool -_0814C78C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_0814C79C: - movs r1, 0x2C - bl SetMonData - b _0814CA62 - .pool -_0814C7AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _0814CA62 - .pool -_0814C7CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _0814CA62 - .pool -_0814C7EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _0814CA62 - .pool -_0814C80C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _0814CA62 - .pool -_0814C82C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _0814CA62 - .pool -_0814C84C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _0814CA62 - .pool -_0814C86C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _0814CA62 - .pool -_0814C88C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _0814CA62 - .pool -_0814C8AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _0814CA62 - .pool -_0814C8CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _0814CA62 - .pool -_0814C8EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _0814CA62 - .pool -_0814C90C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _0814CA62 - .pool -_0814C92C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _0814CA62 - .pool -_0814C94C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _0814CA62 - .pool -_0814C96C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _0814CA62 - .pool -_0814C98C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _0814CA62 - .pool -_0814C9AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _0814CA62 - .pool -_0814C9CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _0814CA62 - .pool -_0814C9EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _0814CA62 - .pool -_0814CA0C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _0814CA62 - .pool -_0814CA2C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _0814CA62 - .pool -_0814CA4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_0814CA62: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - 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 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814C09C - - thumb_func_start LinkPartnerHandleSetRawMonData -LinkPartnerHandleSetRawMonData: @ 814CA98 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _0814CAF0 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_0814CACE: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _0814CACE -_0814CAF0: - bl LinkPartnerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleSetRawMonData - - thumb_func_start LinkPartnerHandleLoadMonSprite -LinkPartnerHandleLoadMonSprite: @ 814CB0C - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B290 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleLoadMonSprite - - thumb_func_start LinkPartnerHandleSwitchInAnim -LinkPartnerHandleSwitchInAnim: @ 814CC28 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl ClearTemporarySpeciesSpriteData - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - strh r0, [r1] - 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 BattleLoadPlayerMonSpriteGfx - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_814CC98 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B69C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleSwitchInAnim - - thumb_func_start sub_814CC98 -sub_814CC98: @ 814CC98 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl ClearTemporarySpeciesSpriteData - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CC98 - - thumb_func_start LinkPartnerHandleReturnMonToBall -LinkPartnerHandleReturnMonToBall: @ 814CE14 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0814CE5C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814CEA4 - str r1, [r0] - b _0814CE92 - .pool -_0814CE5C: - 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 LinkPartnerBufferExecCompleted -_0814CE92: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleReturnMonToBall - - thumb_func_start sub_814CEA4 -sub_814CEA4: @ 814CEA4 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0814CECC - cmp r0, 0x1 - beq _0814CEFA - b _0814CF22 - .pool -_0814CECC: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0814CEE6 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0814CEE6: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0814CF22 -_0814CEFA: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0814CF22 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B3DC - str r1, [r0] -_0814CF22: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CEA4 - - thumb_func_start LinkPartnerHandleDrawTrainerPic -LinkPartnerHandleDrawTrainerPic: @ 814CF30 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0814CF60 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0x20 - cmp r1, 0 - beq _0814CF62 - movs r7, 0x5A - b _0814CF62 - .pool -_0814CF60: - movs r7, 0x50 -_0814CF62: - ldr r5, =gActiveBank - ldrb r0, [r5] - bl sub_806D864 - ldr r6, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0814CF94 - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0814CFB0 -_0814CF94: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x2 - b _0814D002 - .pool -_0814CFB0: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0814CFDE - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _0814CFF2 -_0814CFDE: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x4 - b _0814D002 -_0814CFF2: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r4, [r1, 0x13] -_0814D002: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl DecompressTrainerBackPic - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r7 - ldr r0, =gTrainerBackPicCoords - lsls r4, 2 - adds r4, r0 - ldrb r0, [r4] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 15 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814AF1C - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleDrawTrainerPic - - thumb_func_start LinkPartnerHandleTrainerSlide -LinkPartnerHandleTrainerSlide: @ 814D0E4 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleTrainerSlide - - thumb_func_start LinkPartnerHandleTrainerSlideBack -LinkPartnerHandleTrainerSlideBack: @ 814D0F0 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814AF54 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleTrainerSlideBack - - thumb_func_start LinkPartnerHandleFaintAnimation -LinkPartnerHandleFaintAnimation: @ 814D19C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _0814D1F0 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0814D1D0 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0814D1D0: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _0814D266 - .pool -_0814D1F0: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0814D266 - strb r4, [r3, 0x4] - 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 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B340 - str r1, [r0] -_0814D266: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleFaintAnimation - - thumb_func_start LinkPartnerHandlePaletteFade -LinkPartnerHandlePaletteFade: @ 814D288 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandlePaletteFade - - thumb_func_start LinkPartnerHandleSuccessBallThrowAnim -LinkPartnerHandleSuccessBallThrowAnim: @ 814D294 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleSuccessBallThrowAnim - - thumb_func_start LinkPartnerHandleBallThrowAnim -LinkPartnerHandleBallThrowAnim: @ 814D2A0 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleBallThrowAnim - - thumb_func_start LinkPartnerHandlePause -LinkPartnerHandlePause: @ 814D2AC - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandlePause - - thumb_func_start LinkPartnerHandleMoveAnimation -LinkPartnerHandleMoveAnimation: @ 814D2B8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _0814D2CE - b _0814D3F4 -_0814D2CE: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r1, [r5] - lsls r1, 9 - adds r0, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - mov r0, r12 - adds r0, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r6, r0 - ldr r0, =gAnimMoveTurn - mov r8, r0 - mov r0, r12 - adds r0, 0x3 - adds r1, r0 - ldrb r0, [r1] - mov r1, r8 - strb r0, [r1] - ldr r3, =gAnimMovePower - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x4 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x5 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r3] - ldr r3, =gAnimMoveDmg - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x6 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x7 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - mov r0, r12 - adds r0, 0x8 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r2, r0 - mov r0, r12 - adds r0, 0x9 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 24 - orrs r2, r0 - str r2, [r3] - ldr r2, =gAnimFriendship - ldrb r0, [r5] - lsls r0, 9 - mov r1, r12 - adds r1, 0xA - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r4, =gWeatherMoveAnim - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0xC - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0xD - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r4] - ldr r7, =gAnimDisableStructPtr - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x10 - adds r1, r0 - str r1, [r7] - ldr r2, =gTransformedPersonalities - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - str r1, [r0] - mov r0, r8 - ldrb r1, [r0] - adds r0, r6, 0 - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0814D3CC - bl LinkPartnerBufferExecCompleted - b _0814D3F4 - .pool -_0814D3CC: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_4 - str r1, [r0] - ldrh r1, [r4] - ldr r2, [r7] - adds r0, r6, 0 - bl sub_817E0FC -_0814D3F4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleMoveAnimation - - thumb_func_start bx_move_anim_4 -bx_move_anim_4: @ 814D40C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0814D4A4 - cmp r2, 0x1 - bgt _0814D464 - cmp r2, 0 - beq _0814D46E - b _0814D580 - .pool -_0814D464: - cmp r2, 0x2 - beq _0814D4CE - cmp r2, 0x3 - beq _0814D544 - b _0814D580 -_0814D46E: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _0814D490 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0814D490: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0814D580 -_0814D4A4: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0814D580 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0814D580 -_0814D4CE: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0814D580 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _0814D51C - mov r0, r8 - cmp r0, 0x1 - bhi _0814D51C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0814D51C: - 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 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0814D580 - .pool -_0814D544: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0814D580 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl LinkPartnerBufferExecCompleted -_0814D580: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_4 - - thumb_func_start LinkPartnerHandlePrintString -LinkPartnerHandlePrintString: @ 814D590 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t4_button_a - str r1, [r0] - ldrh r0, [r4] - bl sub_817C95C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandlePrintString - - thumb_func_start LinkPartnerHandlePrintStringPlayerOnly -LinkPartnerHandlePrintStringPlayerOnly: @ 814D5E8 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandlePrintStringPlayerOnly - - thumb_func_start LinkPartnerHandleChooseAction -LinkPartnerHandleChooseAction: @ 814D5F4 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleChooseAction - - thumb_func_start LinkPartnerHandleUnknownYesNoBox -LinkPartnerHandleUnknownYesNoBox: @ 814D600 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleUnknownYesNoBox - - thumb_func_start LinkPartnerHandleChooseMove -LinkPartnerHandleChooseMove: @ 814D60C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleChooseMove - - thumb_func_start LinkPartnerHandleChooseItem -LinkPartnerHandleChooseItem: @ 814D618 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleChooseItem - - thumb_func_start LinkPartnerHandleChoosePokemon -LinkPartnerHandleChoosePokemon: @ 814D624 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleChoosePokemon - - thumb_func_start LinkPartnerHandleCmd23 -LinkPartnerHandleCmd23: @ 814D630 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleCmd23 - - thumb_func_start LinkPartnerHandleHealthBarUpdate -LinkPartnerHandleHealthBarUpdate: @ 814D63C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _0814D6CC - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0814D6F6 - .pool -_0814D6CC: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0814D6F6: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t4_healthbar_update - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleHealthBarUpdate - - thumb_func_start LinkPartnerHandleExpUpdate -LinkPartnerHandleExpUpdate: @ 814D72C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleExpUpdate - - thumb_func_start LinkPartnerHandleStatusIconUpdate -LinkPartnerHandleStatusIconUpdate: @ 814D738 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0814D78C - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - 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, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B7B8 - str r1, [r0] -_0814D78C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleStatusIconUpdate - - thumb_func_start LinkPartnerHandleStatusAnimation -LinkPartnerHandleStatusAnimation: @ 814D7B0 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0814D800 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl DoStatusAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B7B8 - str r1, [r0] -_0814D800: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleStatusAnimation - - thumb_func_start LinkPartnerHandleStatusXor -LinkPartnerHandleStatusXor: @ 814D818 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleStatusXor - - thumb_func_start LinkPartnerHandleDataTransfer -LinkPartnerHandleDataTransfer: @ 814D824 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleDataTransfer - - thumb_func_start LinkPartnerHandleDMA3Transfer -LinkPartnerHandleDMA3Transfer: @ 814D830 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleDMA3Transfer - - thumb_func_start LinkPartnerHandlePlayBGM -LinkPartnerHandlePlayBGM: @ 814D83C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandlePlayBGM - - thumb_func_start LinkPartnerHandleCmd32 -LinkPartnerHandleCmd32: @ 814D848 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleCmd32 - - thumb_func_start LinkPartnerHandleTwoReturnValues -LinkPartnerHandleTwoReturnValues: @ 814D854 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleTwoReturnValues - - thumb_func_start LinkPartnerHandleChosenMonReturnValue -LinkPartnerHandleChosenMonReturnValue: @ 814D860 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleChosenMonReturnValue - - thumb_func_start LinkPartnerHandleOneReturnValue -LinkPartnerHandleOneReturnValue: @ 814D86C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleOneReturnValue - - thumb_func_start LinkPartnerHandleOneReturnValue_Duplicate -LinkPartnerHandleOneReturnValue_Duplicate: @ 814D878 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleOneReturnValue_Duplicate - - thumb_func_start LinkPartnerHandleCmd37 -LinkPartnerHandleCmd37: @ 814D884 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleCmd37 - - thumb_func_start LinkPartnerHandleCmd38 -LinkPartnerHandleCmd38: @ 814D8A0 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleCmd38 - - thumb_func_start LinkPartnerHandleCmd39 -LinkPartnerHandleCmd39: @ 814D8D8 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleCmd39 - - thumb_func_start LinkPartnerHandleCmd40 -LinkPartnerHandleCmd40: @ 814D8F0 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleCmd40 - - thumb_func_start LinkPartnerHandleHitAnimation -LinkPartnerHandleHitAnimation: @ 814D918 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0814D94C - bl LinkPartnerBufferExecCompleted - b _0814D976 - .pool -_0814D94C: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =dp01t_0F_4_move_anim - str r1, [r0] -_0814D976: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleHitAnimation - - thumb_func_start LinkPartnerHandleCmd42 -LinkPartnerHandleCmd42: @ 814D988 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleCmd42 - - thumb_func_start LinkPartnerHandleEffectivenessSound -LinkPartnerHandleEffectivenessSound: @ 814D994 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0814D9A8 - movs r3, 0xC0 -_0814D9A8: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl LinkPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleEffectivenessSound - - thumb_func_start LinkPartnerHandlePlayFanfareOrBGM -LinkPartnerHandlePlayFanfareOrBGM: @ 814D9D8 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0814DA14 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0814DA28 - .pool -_0814DA14: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0814DA28: - bl LinkPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandlePlayFanfareOrBGM - - thumb_func_start LinkPartnerHandleFaintingCry -LinkPartnerHandleFaintingCry: @ 814DA34 - push {lr} - 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, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleFaintingCry - - thumb_func_start LinkPartnerHandleIntroSlide -LinkPartnerHandleIntroSlide: @ 814DA74 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleIntroSlide - - thumb_func_start LinkPartnerHandleIntroTrainerBallThrow -LinkPartnerHandleIntroTrainerBallThrow: @ 814DAA8 - push {r4-r7,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r6] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x38] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f9 - bl AllocSpritePalette - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r6] - bl sub_806D864 - ldr r4, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - movs r5, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0814DB80 - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r1, [r1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0814DBB4 -_0814DB80: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] - adds r0, 0x2 - b _0814DC06 - .pool -_0814DBB4: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r1, [r1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0814DBE2 - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r1] - ands r5, r0 - cmp r5, 0x1 - bne _0814DBF6 -_0814DBE2: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] - adds r0, 0x4 - b _0814DC06 -_0814DBF6: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] -_0814DC06: - ldr r1, =gTrainerBackPicPaletteTable - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - lsls r4, r7, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_814DCCC - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r5] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0814DC80 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0814DC80: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_112 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleIntroTrainerBallThrow - - thumb_func_start sub_814DCCC -sub_814DCCC: @ 814DCCC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x17 - bgt _0814DCF8 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0814DDB4 - .pool -_0814DCF8: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814DD18 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0814DD48 -_0814DD18: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_814CC98 - b _0814DD9C - .pool -_0814DD48: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_814CC98 - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_814CC98 - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_0814DD9C: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B0E8 - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_0814DDB4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DCCC - - thumb_func_start LinkPartnerHandleDrawPartyStatusSummary -LinkPartnerHandleDrawPartyStatusSummary: @ 814DDD8 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0814DE08 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0814DE08 - bl LinkPartnerBufferExecCompleted - b _0814DE7C - .pool -_0814DE08: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0814DE70 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_0814DE70: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_814DE9C - str r0, [r1] -_0814DE7C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleDrawPartyStatusSummary - - thumb_func_start sub_814DE9C -sub_814DE9C: @ 814DE9C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _0814DED4 - 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, 0x5] - bl LinkPartnerBufferExecCompleted -_0814DED4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DE9C - - thumb_func_start LinkPartnerHandleCmd49 -LinkPartnerHandleCmd49: @ 814DEE4 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0814DF16 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_0814DF16: - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleCmd49 - - thumb_func_start LinkPartnerHandleCmd50 -LinkPartnerHandleCmd50: @ 814DF34 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleCmd50 - - thumb_func_start LinkPartnerHandleSpriteInvisibility -LinkPartnerHandleSpriteInvisibility: @ 814DF40 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _0814DF86 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility -_0814DF86: - bl LinkPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleSpriteInvisibility - - thumb_func_start LinkPartnerHandleBattleAnimation -LinkPartnerHandleBattleAnimation: @ 814DFA0 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0814E002 - ldr r4, =gBattleBufferA - ldrb r2, [r5] - lsls r1, r2, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - adds r0, r4, 0x2 - adds r0, r1, r0 - ldrb r3, [r0] - adds r4, 0x3 - adds r1, r4 - ldrb r0, [r1] - lsls r0, 8 - orrs r3, r0 - str r3, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - adds r3, r6, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _0814DFF0 - bl LinkPartnerBufferExecCompleted - b _0814DFFC - .pool -_0814DFF0: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_814B7E8 - str r0, [r1] -_0814DFFC: - adds r0, r6, 0 - bl sub_817E32C -_0814E002: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleBattleAnimation - - thumb_func_start LinkPartnerHandleLinkStandbyMsg -LinkPartnerHandleLinkStandbyMsg: @ 814E014 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - bl sub_81851A8 - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleLinkStandbyMsg - - thumb_func_start LinkPartnerHandleResetActionMoveSelection -LinkPartnerHandleResetActionMoveSelection: @ 814E034 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkPartnerHandleResetActionMoveSelection - - thumb_func_start LinkPartnerHandleCmd55 -LinkPartnerHandleCmd55: @ 814E040 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r0, r4 - bl sub_81851A8 - ldr r2, =gBattleOutcome - ldrb r0, [r5] - lsls r0, 9 - subs r1, r4, 0x3 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x2 - adds r0, r4 - ldrb r0, [r0] - ldr r1, =0x00000ca9 - adds r3, r1 - movs r1, 0x1 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r3] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl LinkPartnerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerHandleCmd55 - - thumb_func_start nullsub_113 -nullsub_113: @ 814E0C0 - bx lr - thumb_func_end nullsub_113 - - .align 2, 0 @ Don't pad with nop. diff --git a/include/pokemon.h b/include/pokemon.h index 626d4d7a1..478f7c345 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -629,7 +629,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies); bool8 IsTradedMon(struct Pokemon *mon); void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality); -s32 sub_806D864(u16 a1); +s32 GetBankMultiplayerId(u16 a1); bool16 sub_806D82C(u8 id); u16 MonTryLearningNewMove(struct Pokemon* mon, bool8); void sub_8068AA4(void); // sets stats for deoxys diff --git a/ld_script.txt b/ld_script.txt index b28f822f7..1acb181eb 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -191,7 +191,6 @@ SECTIONS { asm/fldeff_strength.o(.text); asm/battle_transition.o(.text); src/battle_controller_link_partner.o(.text); - asm/battle_controller_linkpartner.o(.text); src/battle_message.o(.text); asm/cable_car.o(.text); asm/math_util.o(.text); diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 62361ebef..07bab9d5f 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -5,6 +5,7 @@ #include "battle_interface.h" #include "battle_anim.h" #include "battle_ai_script_commands.h" +#include "battle_link_817C95C.h" #include "pokemon.h" #include "link.h" #include "util.h" @@ -55,73 +56,81 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; -extern void sub_81358F4(void); extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); +extern void sub_81851A8(u8 *); // this file's functions -void LinkPartnerHandleGetMonData(void); -void LinkPartnerHandleGetRawMonData(void); -void LinkPartnerHandleSetMonData(void); -void LinkPartnerHandleSetRawMonData(void); -void LinkPartnerHandleLoadMonSprite(void); -void LinkPartnerHandleSwitchInAnim(void); -void LinkPartnerHandleReturnMonToBall(void); -void LinkPartnerHandleDrawTrainerPic(void); -void LinkPartnerHandleTrainerSlide(void); -void LinkPartnerHandleTrainerSlideBack(void); -void LinkPartnerHandleFaintAnimation(void); -void LinkPartnerHandlePaletteFade(void); -void LinkPartnerHandleSuccessBallThrowAnim(void); -void LinkPartnerHandleBallThrowAnim(void); -void LinkPartnerHandlePause(void); -void LinkPartnerHandleMoveAnimation(void); -void LinkPartnerHandlePrintString(void); -void LinkPartnerHandlePrintStringPlayerOnly(void); -void LinkPartnerHandleChooseAction(void); -void LinkPartnerHandleUnknownYesNoBox(void); -void LinkPartnerHandleChooseMove(void); -void LinkPartnerHandleChooseItem(void); -void LinkPartnerHandleChoosePokemon(void); -void LinkPartnerHandleCmd23(void); -void LinkPartnerHandleHealthBarUpdate(void); -void LinkPartnerHandleExpUpdate(void); -void LinkPartnerHandleStatusIconUpdate(void); -void LinkPartnerHandleStatusAnimation(void); -void LinkPartnerHandleStatusXor(void); -void LinkPartnerHandleDataTransfer(void); -void LinkPartnerHandleDMA3Transfer(void); -void LinkPartnerHandlePlayBGM(void); -void LinkPartnerHandleCmd32(void); -void LinkPartnerHandleTwoReturnValues(void); -void LinkPartnerHandleChosenMonReturnValue(void); -void LinkPartnerHandleOneReturnValue(void); -void LinkPartnerHandleOneReturnValue_Duplicate(void); -void LinkPartnerHandleCmd37(void); -void LinkPartnerHandleCmd38(void); -void LinkPartnerHandleCmd39(void); -void LinkPartnerHandleCmd40(void); -void LinkPartnerHandleHitAnimation(void); -void LinkPartnerHandleCmd42(void); -void LinkPartnerHandleEffectivenessSound(void); -void LinkPartnerHandlePlayFanfareOrBGM(void); -void LinkPartnerHandleFaintingCry(void); -void LinkPartnerHandleIntroSlide(void); -void LinkPartnerHandleIntroTrainerBallThrow(void); -void LinkPartnerHandleDrawPartyStatusSummary(void); -void LinkPartnerHandleCmd49(void); -void LinkPartnerHandleCmd50(void); -void LinkPartnerHandleSpriteInvisibility(void); -void LinkPartnerHandleBattleAnimation(void); -void LinkPartnerHandleLinkStandbyMsg(void); -void LinkPartnerHandleResetActionMoveSelection(void); -void LinkPartnerHandleCmd55(void); -void nullsub_113(void); +static void LinkPartnerHandleGetMonData(void); +static void LinkPartnerHandleGetRawMonData(void); +static void LinkPartnerHandleSetMonData(void); +static void LinkPartnerHandleSetRawMonData(void); +static void LinkPartnerHandleLoadMonSprite(void); +static void LinkPartnerHandleSwitchInAnim(void); +static void LinkPartnerHandleReturnMonToBall(void); +static void LinkPartnerHandleDrawTrainerPic(void); +static void LinkPartnerHandleTrainerSlide(void); +static void LinkPartnerHandleTrainerSlideBack(void); +static void LinkPartnerHandleFaintAnimation(void); +static void LinkPartnerHandlePaletteFade(void); +static void LinkPartnerHandleSuccessBallThrowAnim(void); +static void LinkPartnerHandleBallThrowAnim(void); +static void LinkPartnerHandlePause(void); +static void LinkPartnerHandleMoveAnimation(void); +static void LinkPartnerHandlePrintString(void); +static void LinkPartnerHandlePrintStringPlayerOnly(void); +static void LinkPartnerHandleChooseAction(void); +static void LinkPartnerHandleUnknownYesNoBox(void); +static void LinkPartnerHandleChooseMove(void); +static void LinkPartnerHandleChooseItem(void); +static void LinkPartnerHandleChoosePokemon(void); +static void LinkPartnerHandleCmd23(void); +static void LinkPartnerHandleHealthBarUpdate(void); +static void LinkPartnerHandleExpUpdate(void); +static void LinkPartnerHandleStatusIconUpdate(void); +static void LinkPartnerHandleStatusAnimation(void); +static void LinkPartnerHandleStatusXor(void); +static void LinkPartnerHandleDataTransfer(void); +static void LinkPartnerHandleDMA3Transfer(void); +static void LinkPartnerHandlePlayBGM(void); +static void LinkPartnerHandleCmd32(void); +static void LinkPartnerHandleTwoReturnValues(void); +static void LinkPartnerHandleChosenMonReturnValue(void); +static void LinkPartnerHandleOneReturnValue(void); +static void LinkPartnerHandleOneReturnValue_Duplicate(void); +static void LinkPartnerHandleCmd37(void); +static void LinkPartnerHandleCmd38(void); +static void LinkPartnerHandleCmd39(void); +static void LinkPartnerHandleCmd40(void); +static void LinkPartnerHandleHitAnimation(void); +static void LinkPartnerHandleCmd42(void); +static void LinkPartnerHandleEffectivenessSound(void); +static void LinkPartnerHandlePlayFanfareOrBGM(void); +static void LinkPartnerHandleFaintingCry(void); +static void LinkPartnerHandleIntroSlide(void); +static void LinkPartnerHandleIntroTrainerBallThrow(void); +static void LinkPartnerHandleDrawPartyStatusSummary(void); +static void LinkPartnerHandleCmd49(void); +static void LinkPartnerHandleCmd50(void); +static void LinkPartnerHandleSpriteInvisibility(void); +static void LinkPartnerHandleBattleAnimation(void); +static void LinkPartnerHandleLinkStandbyMsg(void); +static void LinkPartnerHandleResetActionMoveSelection(void); +static void LinkPartnerHandleCmd55(void); +static void nullsub_113(void); -void LinkPartnerBufferRunCommand(void); -void LinkPartnerBufferExecCompleted(void); +static void LinkPartnerBufferRunCommand(void); +static void LinkPartnerBufferExecCompleted(void); +static void sub_814B554(void); +static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst); +static void SetLinkPartnerMonData(u8 monId); +static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void LinkPartnerDoMoveAnimation(void); +static void sub_814DCCC(u8 taskId); +static void sub_814DE9C(void); -void (*const gLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const gLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { LinkPartnerHandleGetMonData, LinkPartnerHandleGetRawMonData, @@ -182,7 +191,7 @@ void (*const gLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = nullsub_113 }; -void nullsub_112(void) +static void nullsub_112(void) { } @@ -191,7 +200,7 @@ void SetBankFuncToLinkPartnerBufferRunCommand(void) gBattleBankFunc[gActiveBank] = LinkPartnerBufferRunCommand; } -void LinkPartnerBufferRunCommand(void) +static void LinkPartnerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { @@ -201,3 +210,1521 @@ void LinkPartnerBufferRunCommand(void) LinkPartnerBufferExecCompleted(); } } + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + LinkPartnerBufferExecCompleted(); +} + +static void sub_814AF54(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(0); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814AFBC(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B004(void) +{ + bool32 r6 = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (IsCryPlayingOrClearCrySongs()) + r6 = FALSE; + + if (r6) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_814AFBC; + } +} + +static void sub_814B0E8(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 != 1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + + gBattleBankFunc[gActiveBank] = sub_814B004; + } +} + +static void sub_814B290(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].animEnded && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + LinkPartnerBufferExecCompleted(); +} + +static void CompleteOnHealthbarDone(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); + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B340(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]); + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B3DC(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkPartnerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + LinkPartnerBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + LinkPartnerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_814B4E0(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_814B554; + } +} + +static void sub_814B554(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B5A8(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleBankFunc[gActiveBank] = sub_814B4E0; + } +} + +static void sub_814B69C(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]]); + gBattleBankFunc[gActiveBank] = sub_814B5A8; + } +} + +static void LinkPartnerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = LinkPartnerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + LinkPartnerBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyLinkPartnerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyLinkPartnerMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + LinkPartnerBufferExecCompleted(); +} + +static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void LinkPartnerHandleGetRawMonData(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetLinkPartnerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetLinkPartnerMonData(i); + monsToCheck >>= 1; + } + } + LinkPartnerBufferExecCompleted(); +} + +static void SetLinkPartnerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void LinkPartnerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleLoadMonSprite(void) +{ + u16 species; + + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_814B290; +} + +static void LinkPartnerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_814CC98(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_814B69C; +} + +static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void LinkPartnerHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkPartnerBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + gBattleBankFunc[gActiveBank] = sub_814B3DC; + } + break; + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +static void LinkPartnerHandleDrawTrainerPic(void) +{ + s16 xPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 90; + else // first mon + xPos = 32; + } + else + { + xPos = 80; + } + + if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender; + } + + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void LinkPartnerHandleTrainerSlide(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_814AF54; +} + +static void LinkPartnerHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlaySE12WithPanning(SE_POKE_DEAD, -64); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_814B340; + } + } +} + +static void LinkPartnerHandlePaletteFade(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleSuccessBallThrowAnim(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleBallThrowAnim(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandlePause(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + LinkPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = LinkPartnerDoMoveAnimation; + sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); + } + } +} + +static void LinkPartnerDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + LinkPartnerBufferExecCompleted(); + } + break; + } +} + +static void LinkPartnerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; + sub_817C95C(*stringId); +} + +static void LinkPartnerHandlePrintStringPlayerOnly(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChooseAction(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleUnknownYesNoBox(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChooseMove(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChooseItem(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChoosePokemon(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd23(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void LinkPartnerHandleExpUpdate(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkPartnerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkPartnerHandleStatusXor(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleDataTransfer(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleDMA3Transfer(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandlePlayBGM(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd32(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleTwoReturnValues(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChosenMonReturnValue(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleOneReturnValue(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleOneReturnValue_Duplicate(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + LinkPartnerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void LinkPartnerHandleCmd42(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + u32 trainerPicId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F9); + + if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender; + } + + LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_814DCCC, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_112; +} + +static void sub_814DCCC(u8 taskId) +{ + if (gTasks[taskId].data[1] < 24) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_814CC98(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_814CC98(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_814CC98(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_814B0E8; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void LinkPartnerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + LinkPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_814DE9C; + } +} + +static void sub_814DE9C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + LinkPartnerBufferExecCompleted(); + } +} + +static void LinkPartnerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd50(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleSpriteInvisibility(void) +{ + if (AnimBankSpriteExists(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + LinkPartnerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + + sub_817E32C(animationId); + } +} + +static void LinkPartnerHandleLinkStandbyMsg(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][2]); + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleResetActionMoveSelection(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd55(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][4]); + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBank][2]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + LinkPartnerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_113(void) +{ +} diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index efedf52b6..0b0f1e626 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1716,7 +1716,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) paletteNum = AllocSpritePalette(0xD6F9); if (gBattleTypeFlags & BATTLE_TYPE_x2000000) - trainerPicId = gLinkPlayers[sub_806D864(gActiveBank)].gender; + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender; else trainerPicId = gSaveBlock2Ptr->playerGender; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index bf6962b1b..ee835586b 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1226,9 +1226,9 @@ void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4) void EmitCmd23(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_23; - gBattleBuffersTransferData[1] = 23; - gBattleBuffersTransferData[2] = 23; - gBattleBuffersTransferData[3] = 23; + gBattleBuffersTransferData[1] = CONTROLLER_23; + gBattleBuffersTransferData[2] = CONTROLLER_23; + gBattleBuffersTransferData[3] = CONTROLLER_23; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1289,7 +1289,7 @@ void EmitDataTransfer(u8 bufferId, u16 size, void *data) s32 i; gBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER; - gBattleBuffersTransferData[1] = 29; + gBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER; gBattleBuffersTransferData[2] = size; gBattleBuffersTransferData[3] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) @@ -1421,9 +1421,9 @@ void EmitHitAnimation(u8 bufferId) void EmitCmd42(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_42; - gBattleBuffersTransferData[1] = 42; - gBattleBuffersTransferData[2] = 42; - gBattleBuffersTransferData[3] = 42; + gBattleBuffersTransferData[1] = CONTROLLER_42; + gBattleBuffersTransferData[2] = CONTROLLER_42; + gBattleBuffersTransferData[3] = CONTROLLER_42; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1448,9 +1448,9 @@ void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM) void EmitFaintingCry(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY; - gBattleBuffersTransferData[1] = 45; - gBattleBuffersTransferData[2] = 45; - gBattleBuffersTransferData[3] = 45; + gBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY; + gBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY; + gBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1464,9 +1464,9 @@ void EmitIntroSlide(u8 bufferId, u8 terrainId) void EmitIntroTrainerBallThrow(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW; - gBattleBuffersTransferData[1] = 47; - gBattleBuffersTransferData[2] = 47; - gBattleBuffersTransferData[3] = 47; + gBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW; + gBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW; + gBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1477,7 +1477,7 @@ void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 gBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; gBattleBuffersTransferData[1] = arg2 & 0x7F; gBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7; - gBattleBuffersTransferData[3] = 48; + gBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * 6); i++) gBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus)); PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4); @@ -1486,18 +1486,18 @@ void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 void EmitCmd49(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_49; - gBattleBuffersTransferData[1] = 49; - gBattleBuffersTransferData[2] = 49; - gBattleBuffersTransferData[3] = 49; + gBattleBuffersTransferData[1] = CONTROLLER_49; + gBattleBuffersTransferData[2] = CONTROLLER_49; + gBattleBuffersTransferData[3] = CONTROLLER_49; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitCmd50(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_50; - gBattleBuffersTransferData[1] = 50; - gBattleBuffersTransferData[2] = 50; - gBattleBuffersTransferData[3] = 50; + gBattleBuffersTransferData[1] = CONTROLLER_50; + gBattleBuffersTransferData[2] = CONTROLLER_50; + gBattleBuffersTransferData[3] = CONTROLLER_50; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1505,8 +1505,8 @@ void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible) { gBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY; gBattleBuffersTransferData[1] = isInvisible; - gBattleBuffersTransferData[2] = 51; - gBattleBuffersTransferData[3] = 51; + gBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY; + gBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } diff --git a/src/battle_message.c b/src/battle_message.c index d0c7b118d..52c0c7af5 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1858,16 +1858,16 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst) toCpy = gLinkPlayers[multiplayerID].name; break; case B_TXT_1F: // link partner name? - toCpy = gLinkPlayers[sub_806D864(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_20: // link opponent 1 name? - toCpy = gLinkPlayers[sub_806D864(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_21: // link opponent 2 name? - toCpy = gLinkPlayers[sub_806D864(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_22: // link scripting active name - toCpy = gLinkPlayers[sub_806D864(gBattleScripting.bank)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(gBattleScripting.bank)].name; break; case B_TXT_PLAYER_NAME: // player name if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b2afd9837..6dfc848d7 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5463,7 +5463,7 @@ static void atk4F_jump_if_cannot_switch(void) party = gPlayerParty; val = 0; - if (sub_806D82C(sub_806D864(gActiveBank)) == TRUE) + if (sub_806D82C(GetBankMultiplayerId(gActiveBank)) == TRUE) val = 3; } else @@ -5485,7 +5485,7 @@ static void atk4F_jump_if_cannot_switch(void) val = 0; - if (sub_806D82C(sub_806D864(gActiveBank)) == TRUE) + if (sub_806D82C(GetBankMultiplayerId(gActiveBank)) == TRUE) val = 3; } @@ -7933,7 +7933,7 @@ static void atk8F_forcerandomswitch(void) else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000)) { - if (sub_806D82C(sub_806D864(gBankTarget)) == 1) + if (sub_806D82C(GetBankMultiplayerId(gBankTarget)) == 1) { firstMonId = 3; lastMonId = 6; diff --git a/src/battle_util.c b/src/battle_util.c index 0a0badb33..468b2c46d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1729,7 +1729,7 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2) if (GetBankSide(bank) == SIDE_PLAYER) { party = gPlayerParty; - r7 = sub_806D864(bank); + r7 = GetBankMultiplayerId(bank); r6 = sub_806D82C(r7); } else @@ -1748,7 +1748,7 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2) } else { - r7 = sub_806D864(bank); + r7 = GetBankMultiplayerId(bank); if (GetBankSide(bank) == SIDE_PLAYER) party = gPlayerParty; else diff --git a/src/pokemon_3.c b/src/pokemon_3.c index aa45c3d24..73d23fe6f 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -618,7 +618,7 @@ bool16 sub_806D82C(u8 id) return retVal; } -s32 sub_806D864(u16 a1) +s32 GetBankMultiplayerId(u16 a1) { s32 id; for (id = 0; id < MAX_LINK_PLAYERS; id++) @@ -1477,7 +1477,7 @@ const u8* GetTrainerPartnerName(void) else { u8 id = GetMultiplayerId(); - return gLinkPlayers[sub_806D864(gLinkPlayers[id].lp_field_18 ^ 2)].name; + return gLinkPlayers[GetBankMultiplayerId(gLinkPlayers[id].lp_field_18 ^ 2)].name; } } From bffcd426cf1414287443c67d955fb36b861dbd91 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 24 Oct 2017 15:25:20 +0200 Subject: [PATCH 13/29] link opponent controller is done --- asm/battle_controller_linkopponent.s | 6249 ----------------------- include/battle.h | 10 +- ld_script.txt | 5 +- src/battle_controller_link_opponent.c | 1903 +++++++ src/battle_controller_link_partner.c | 5 +- src/battle_controller_linkopponent.c | 143 - src/battle_controller_player.c | 6 +- src/battle_controller_player_partner.c | 4 +- src/battle_controller_recorded_player.c | 2 +- 9 files changed, 1917 insertions(+), 6410 deletions(-) delete mode 100644 asm/battle_controller_linkopponent.s create mode 100644 src/battle_controller_link_opponent.c delete mode 100644 src/battle_controller_linkopponent.c diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s deleted file mode 100644 index d0ada0d5d..000000000 --- a/asm/battle_controller_linkopponent.s +++ /dev/null @@ -1,6249 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - thumb_func_start LinkOpponentBufferRunCommand -LinkOpponentBufferRunCommand: @ 80643B0 - 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 _080643FC - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _080643F8 - ldr r0, =gLinkOpponentBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _080643FC - .pool -_080643F8: - bl LinkOpponentBufferExecCompleted -_080643FC: - pop {r0} - bx r0 - thumb_func_end LinkOpponentBufferRunCommand - - thumb_func_start sub_8064400 -sub_8064400: @ 8064400 - 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 _08064424 - bl LinkOpponentBufferExecCompleted -_08064424: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064400 - - thumb_func_start sub_8064438 -sub_8064438: @ 8064438 - 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 _0806445C - bl LinkOpponentBufferExecCompleted -_0806445C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064438 - - thumb_func_start sub_8064470 -sub_8064470: @ 8064470 - push {r4-r6,lr} - ldr r5, =gSprites - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _080644C2 - adds r0, r2, r5 - ldrh r0, [r0, 0x6] - bl FreeTrainerFrontPicPalette - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - bl LinkOpponentBufferExecCompleted -_080644C2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064470 - - thumb_func_start sub_80644D8 -sub_80644D8: @ 80644D8 - 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 _08064510 - 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 LinkOpponentBufferExecCompleted -_08064510: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80644D8 - - thumb_func_start sub_8064520 -sub_8064520: @ 8064520 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r0, 0 - mov r8, r0 - movs r4, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0806454C - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08064584 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08064584 -_0806454C: - 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 - adds r7, r3, 0 - cmp r1, r0 - bne _080645C2 - b _080645CA - .pool -_08064584: - 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 - adds r7, r2, 0 - cmp r3, r0 - bne _080645C0 - 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 _080645C0 - movs r1, 0x1 - mov r8, r1 -_080645C0: - movs r4, 0x1 -_080645C2: - mov r0, r8 - cmp r0, 0 - bne _080645CA - b _08064714 -_080645CA: - cmp r4, 0 - bne _080645DE - ldrb r1, [r7] - movs r0, 0x2 - eors r0, r1 - bl IsAnimBankSpriteVisible - lsls r0, 24 - cmp r0, 0 - bne _0806469C -_080645DE: - ldr r1, =gBattleSpritesDataPtr - mov r12, r1 - ldr r0, [r1] - ldr r7, =gActiveBank - ldrb r2, [r7] - 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 - bne _08064600 - b _08064714 -_08064600: - movs r6, 0x2 - adds r1, r6, 0 - 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 _08064714 - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r12 - ldr r0, [r1] - ldrb r2, [r7] - 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, r12 - ldr r2, [r0] - ldrb r0, [r7] - adds r1, r6, 0 - 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, r12 - ldr r2, [r1] - ldrb r0, [r7] - adds r1, r6, 0 - 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 - b _080646F2 - .pool -_0806469C: - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08064714 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - 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] - ldrb r0, [r7] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _080646F2 - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag -_080646F2: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - 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 - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80644D8 - str r1, [r0] -_08064714: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064520 - - thumb_func_start sub_8064734 -sub_8064734: @ 8064734 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - movs r6, 0xC4 - lsls r6, 1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08064776 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08064776: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _080647B4 - ldr r2, [r5] - ldrb r1, [r4] - movs r0, 0x2 - adds r3, r0, 0 - eors r3, r1 - ldr r1, [r2, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _080647B4 - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_080647B4: - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, =gActiveBank - ldrb r5, [r2] - ldr r4, [r0, 0x4] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r6, r0, r4 - ldrb r1, [r6] - movs r0, 0x8 - mov r12, r0 - ands r0, r1 - mov r8, r3 - mov r9, r2 - cmp r0, 0 - bne _08064898 - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r5 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0] - mov r0, r12 - ands r0, r1 - cmp r0, 0 - bne _08064898 - ldrb r1, [r6, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0806487A - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0806484A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0806484A - ldr r4, =gHealthBoxesIds - mov r1, r9 - ldrb r0, [r1] - adds r1, r7, 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, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - bl sub_8076918 - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0806484A: - 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, =gEnemyParty - 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 -_0806487A: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 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] - mov r8, r4 - mov r9, r3 -_08064898: - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - 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 _0806495A - 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 _0806495A - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0806495A - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0806493C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08064930 - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0806493C - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _0806493C - .pool -_08064930: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_0806493C: - 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 r10, r0 -_0806495A: - mov r1, r10 - cmp r1, 0 - bne _08064962 - b _08064AC0 -_08064962: - ldr r2, =gSprites - ldr r0, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r3, [r5] - 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 - beq _08064982 - b _08064AC0 -_08064982: - 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 - beq _08064998 - b _08064AC0 -_08064998: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080649E2 - adds r0, r3, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _080649E2 - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x9] - adds r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08064AC0 - ldr r0, [r3] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] -_080649E2: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08064A3A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08064A3A - ldr r1, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x2 - eors 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 - ldrb r0, [r5] - eors r4, r0 - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback -_08064A3A: - 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 - ldrb r5, [r4] - ldr r1, =gBattlePartyID - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - bl SetBankEnemyShadowSpriteCallback - 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_8064520 - str r1, [r0] -_08064AC0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064734 - - thumb_func_start sub_8064B04 -sub_8064B04: @ 8064B04 - push {r4-r7,lr} - ldr r4, =gSprites - ldr r0, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r3, [r7] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08064BB6 - adds r0, r2, r4 - movs r1, 0x24 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08064BB6 - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r4, r3, 1 - adds r0, r4, r3 - lsls r0, 2 - adds r2, r0, r1 - ldrb r5, [r2] - movs r0, 0x80 - ands r0, r5 - cmp r0, 0 - bne _08064B7C - ldr r0, =gBattlePartyID - adds r0, r4, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 - b _08064BB6 - .pool -_08064B7C: - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08064BB6 - movs r0, 0x7F - ands r0, r5 - strb r0, [r2] - ldr r0, [r6] - ldrb r2, [r7] - 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 - bl LinkOpponentBufferExecCompleted -_08064BB6: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064B04 - - thumb_func_start sub_8064BC0 -sub_8064BC0: @ 8064BC0 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - ldr r5, =gHealthBoxesIds - adds r1, r0, r5 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08064C08 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08064C0C - .pool -_08064C08: - bl LinkOpponentBufferExecCompleted -_08064C0C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8064BC0 - - thumb_func_start sub_8064C14 -sub_8064C14: @ 8064C14 - push {lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _08064C42 - ldr r0, =gHealthBoxesIds - adds r0, r3, r0 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkOpponentBufferExecCompleted -_08064C42: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064C14 - - thumb_func_start sub_8064C58 -sub_8064C58: @ 8064C58 - 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 _08064CB2 - 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 - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkOpponentBufferExecCompleted -_08064CB2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064C58 - - thumb_func_start sub_8064CCC -sub_8064CCC: @ 8064CCC - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _08064CDE - bl LinkOpponentBufferExecCompleted -_08064CDE: - pop {r0} - bx r0 - thumb_func_end sub_8064CCC - - thumb_func_start sub_8064CE4 -sub_8064CE4: @ 8064CE4 - 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 _08064D30 - 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 LinkOpponentBufferExecCompleted - b _08064D5A - .pool -_08064D30: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08064D54 - 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] -_08064D54: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08064D5A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8064CE4 - - thumb_func_start sub_8064D60 -sub_8064D60: @ 8064D60 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - 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 _08064DAC - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08064DA0 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_08064DA0: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8064DD0 - str r0, [r1] -_08064DAC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064D60 - - thumb_func_start sub_8064DD0 -sub_8064DD0: @ 8064DD0 - 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 _08064E2A - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08064E2A - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - 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, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08064E1A - ldr r0, =SpriteCallbackDummy_2 - cmp r1, r0 - bne _08064E2A -_08064E1A: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - bl LinkOpponentBufferExecCompleted -_08064E2A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064DD0 - - thumb_func_start sub_8064E50 -sub_8064E50: @ 8064E50 - push {r4-r7,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r1, [r3, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08064F0C - ldr r7, =gSprites - ldr r6, =gBankSpriteIds - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r7, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08064F0C - ldrb r1, [r3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r3] - ldr r0, [r4] - ldrb r2, [r5] - 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 - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0 - bl StartSpriteAnim - 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, =gEnemyParty - 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 - ldrb r0, [r5] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064D60 - str r1, [r0] -_08064F0C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064E50 - - thumb_func_start sub_8064F40 -sub_8064F40: @ 8064F40 - 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 _08064F72 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08064F72: - 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 _08064FDC - 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 _08064FDC - adds r0, r3, r4 - bl DestroySprite - ldrb r4, [r5] - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064E50 - str r1, [r0] -_08064FDC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064F40 - - thumb_func_start sub_8065008 -sub_8065008: @ 8065008 - 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 _0806502A - bl LinkOpponentBufferExecCompleted -_0806502A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8065008 - - thumb_func_start sub_8065038 -sub_8065038: @ 8065038 - 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 _0806505A - bl LinkOpponentBufferExecCompleted -_0806505A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8065038 - - thumb_func_start LinkOpponentBufferExecCompleted -LinkOpponentBufferExecCompleted: @ 8065068 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkOpponentBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080650BC - 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 _080650CE - .pool -_080650BC: - 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] -_080650CE: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentBufferExecCompleted - - thumb_func_start LinkOpponentHandleGetMonData -LinkOpponentHandleGetMonData: @ 80650E0 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08065118 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_opponent_pokemon - adds r6, r0, 0 - b _0806513A - .pool -_08065118: - ldrb r4, [r1] - movs r5, 0 -_0806511C: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08065132 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_opponent_pokemon - adds r6, r0 -_08065132: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0806511C -_0806513A: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl LinkOpponentBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleGetMonData - - thumb_func_start dp01_getattr_by_ch1_for_opponent_pokemon -dp01_getattr_by_ch1_for_opponent_pokemon: @ 8065154 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0806517E - bl _080658EA -_0806517E: - lsls r0, 2 - ldr r1, =_08065194 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08065194: - .4byte _08065284 - .4byte _080654A8 - .4byte _080654B8 - .4byte _080654C8 - .4byte _08065530 - .4byte _08065530 - .4byte _08065530 - .4byte _08065530 - .4byte _0806554C - .4byte _08065588 - .4byte _08065588 - .4byte _08065588 - .4byte _08065588 - .4byte _080658EA - .4byte _080658EA - .4byte _080658EA - .4byte _080658EA - .4byte _080655A4 - .4byte _080655B4 - .4byte _080655E4 - .4byte _080655F4 - .4byte _08065604 - .4byte _08065614 - .4byte _08065624 - .4byte _08065634 - .4byte _08065644 - .4byte _08065654 - .4byte _08065664 - .4byte _08065674 - .4byte _08065684 - .4byte _08065694 - .4byte _080656A4 - .4byte _080656F4 - .4byte _08065704 - .4byte _08065714 - .4byte _08065724 - .4byte _08065734 - .4byte _08065744 - .4byte _08065754 - .4byte _08065764 - .4byte _08065774 - .4byte _080657A8 - .4byte _080657B8 - .4byte _080657C8 - .4byte _080657D8 - .4byte _080657E8 - .4byte _080657F8 - .4byte _08065808 - .4byte _08065818 - .4byte _08065838 - .4byte _08065848 - .4byte _08065858 - .4byte _08065868 - .4byte _08065878 - .4byte _08065888 - .4byte _08065898 - .4byte _080658A8 - .4byte _080658B8 - .4byte _080658C8 - .4byte _080658D8 -_08065284: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_080652D0: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _080652D0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_08065488: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _08065488 - b _080658EA - .pool -_080654A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - b _08065822 - .pool -_080654B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xC - b _08065822 - .pool -_080654C8: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - mov r8, r9 -_080654DE: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _080654DE - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0806551C: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0806551C - b _080658EA - .pool -_08065530: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _08065822 - .pool -_0806554C: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gEnemyParty - mov r8, r2 -_08065558: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _08065558 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _080658EA - .pool -_08065588: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _080658E2 - .pool -_080655A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1 - b _080655BE - .pool -_080655B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x19 -_080655BE: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _080658EA - .pool -_080655E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1A - b _080658E2 - .pool -_080655F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1B - b _080658E2 - .pool -_08065604: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1C - b _080658E2 - .pool -_08065614: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1D - b _080658E2 - .pool -_08065624: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1E - b _080658E2 - .pool -_08065634: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1F - b _080658E2 - .pool -_08065644: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x20 - b _080658E2 - .pool -_08065654: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x22 - b _080658E2 - .pool -_08065664: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x23 - b _080658E2 - .pool -_08065674: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x24 - b _080658E2 - .pool -_08065684: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x25 - b _080658E2 - .pool -_08065694: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x26 - b _080658E2 - .pool -_080656A4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _080658EA - .pool -_080656F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x27 - b _080658E2 - .pool -_08065704: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x28 - b _080658E2 - .pool -_08065714: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x29 - b _080658E2 - .pool -_08065724: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2A - b _080658E2 - .pool -_08065734: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2B - b _080658E2 - .pool -_08065744: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2C - b _080658E2 - .pool -_08065754: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0 - b _0806577E - .pool -_08065764: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x9 - b _08065822 - .pool -_08065774: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x37 -_0806577E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _080658EA - .pool -_080657A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x38 - b _080658E2 - .pool -_080657B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - b _08065822 - .pool -_080657C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - b _08065822 - .pool -_080657D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3B - b _08065822 - .pool -_080657E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3C - b _08065822 - .pool -_080657F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3D - b _08065822 - .pool -_08065808: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3E - b _08065822 - .pool -_08065818: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3F -_08065822: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _080658EA - .pool -_08065838: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x16 - b _080658E2 - .pool -_08065848: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x17 - b _080658E2 - .pool -_08065858: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x18 - b _080658E2 - .pool -_08065868: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x21 - b _080658E2 - .pool -_08065878: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2F - b _080658E2 - .pool -_08065888: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x30 - b _080658E2 - .pool -_08065898: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x32 - b _080658E2 - .pool -_080658A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x33 - b _080658E2 - .pool -_080658B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x34 - b _080658E2 - .pool -_080658C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x35 - b _080658E2 - .pool -_080658D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x36 -_080658E2: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_080658EA: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_opponent_pokemon - - thumb_func_start LinkOpponentHandleGetRawMonData -LinkOpponentHandleGetRawMonData: @ 8065900 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleGetRawMonData - - thumb_func_start LinkOpponentHandleSetMonData -LinkOpponentHandleSetMonData: @ 806590C - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0806593C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_8065964 - b _0806595A - .pool -_0806593C: - ldrb r4, [r1] - movs r5, 0 -_08065940: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0806594E - adds r0, r5, 0 - bl sub_8065964 -_0806594E: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08065940 -_0806595A: - bl LinkOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleSetMonData - - thumb_func_start sub_8065964 -sub_8065964: @ 8065964 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x38 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r4, r0, r2 - adds r7, r4, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r6, r3, 0 - adds r3, r2, 0 - cmp r0, 0x3B - bls _08065992 - bl _08066270 -_08065992: - lsls r0, 2 - ldr r1, =_080659A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080659A8: - .4byte _08065A98 - .4byte _08065C30 - .4byte _08065C4C - .4byte _08065C68 - .4byte _08065CBC - .4byte _08065CBC - .4byte _08065CBC - .4byte _08065CBC - .4byte _08065CDC - .4byte _08065D44 - .4byte _08065D44 - .4byte _08065D44 - .4byte _08065D44 - .4byte _08066270 - .4byte _08066270 - .4byte _08066270 - .4byte _08066270 - .4byte _08065D6C - .4byte _08065D88 - .4byte _08065DA4 - .4byte _08065DC0 - .4byte _08065DDC - .4byte _08065DF8 - .4byte _08065E14 - .4byte _08065E30 - .4byte _08065E4C - .4byte _08065E68 - .4byte _08065E84 - .4byte _08065EA0 - .4byte _08065EBC - .4byte _08065ED8 - .4byte _08065EF4 - .4byte _08065F68 - .4byte _08065F84 - .4byte _08065FA0 - .4byte _08065FBC - .4byte _08065FD8 - .4byte _08065FF4 - .4byte _08066010 - .4byte _0806602C - .4byte _08066048 - .4byte _08066064 - .4byte _08066080 - .4byte _0806609C - .4byte _080660B8 - .4byte _080660D4 - .4byte _080660F0 - .4byte _0806610C - .4byte _08066128 - .4byte _08066144 - .4byte _08066160 - .4byte _0806617C - .4byte _08066198 - .4byte _080661B4 - .4byte _080661D0 - .4byte _080661EC - .4byte _08066208 - .4byte _08066224 - .4byte _08066240 - .4byte _0806625C -_08065A98: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r7, 0 - bl SetMonData - adds r2, r7, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r7 - mov r10, r0 - adds r0, r7, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r7, 0x2 - str r0, [sp, 0x4] - adds r0, r7, 0x4 - str r0, [sp, 0x8] - adds r0, r7, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r6, r7, 0 - adds r6, 0x24 - adds r4, r7, 0 - adds r4, 0xC -_08065AFE: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08065AFE - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r7, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r7, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _08066270 - .pool -_08065C30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xB - bl SetMonData - b _08066270 - .pool -_08065C4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xC - bl SetMonData - b _08066270 - .pool -_08065C68: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r4 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r7, r1, r0 - adds r6, r4, 0 - adds r6, 0x8 -_08065C80: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08065C80 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _08066270 - .pool -_08065CBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _08065D5A - .pool -_08065CDC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x11 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _08066270 - .pool -_08065D44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_08065D5A: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _08066270 - .pool -_08065D6C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1 - bl SetMonData - b _08066270 - .pool -_08065D88: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x19 - bl SetMonData - b _08066270 - .pool -_08065DA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1A - bl SetMonData - b _08066270 - .pool -_08065DC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1B - bl SetMonData - b _08066270 - .pool -_08065DDC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1C - bl SetMonData - b _08066270 - .pool -_08065DF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1D - bl SetMonData - b _08066270 - .pool -_08065E14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1E - bl SetMonData - b _08066270 - .pool -_08065E30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1F - bl SetMonData - b _08066270 - .pool -_08065E4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x20 - bl SetMonData - b _08066270 - .pool -_08065E68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x22 - bl SetMonData - b _08066270 - .pool -_08065E84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x23 - bl SetMonData - b _08066270 - .pool -_08065EA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x24 - bl SetMonData - b _08066270 - .pool -_08065EBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x25 - bl SetMonData - b _08066270 - .pool -_08065ED8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x26 - bl SetMonData - b _08066270 - .pool -_08065EF4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x27 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08066002 - .pool -_08065F68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x27 - bl SetMonData - b _08066270 - .pool -_08065F84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x28 - bl SetMonData - b _08066270 - .pool -_08065FA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x29 - bl SetMonData - b _08066270 - .pool -_08065FBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2A - bl SetMonData - b _08066270 - .pool -_08065FD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2B - bl SetMonData - b _08066270 - .pool -_08065FF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 -_08066002: - movs r1, 0x2C - bl SetMonData - b _08066270 - .pool -_08066010: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0 - bl SetMonData - b _08066270 - .pool -_0806602C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x9 - bl SetMonData - b _08066270 - .pool -_08066048: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x37 - bl SetMonData - b _08066270 - .pool -_08066064: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x38 - bl SetMonData - b _08066270 - .pool -_08066080: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x39 - bl SetMonData - b _08066270 - .pool -_0806609C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3A - bl SetMonData - b _08066270 - .pool -_080660B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3B - bl SetMonData - b _08066270 - .pool -_080660D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3C - bl SetMonData - b _08066270 - .pool -_080660F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3D - bl SetMonData - b _08066270 - .pool -_0806610C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3E - bl SetMonData - b _08066270 - .pool -_08066128: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3F - bl SetMonData - b _08066270 - .pool -_08066144: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x16 - bl SetMonData - b _08066270 - .pool -_08066160: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x17 - bl SetMonData - b _08066270 - .pool -_0806617C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x18 - bl SetMonData - b _08066270 - .pool -_08066198: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x21 - bl SetMonData - b _08066270 - .pool -_080661B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2F - bl SetMonData - b _08066270 - .pool -_080661D0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x30 - bl SetMonData - b _08066270 - .pool -_080661EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x32 - bl SetMonData - b _08066270 - .pool -_08066208: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x33 - bl SetMonData - b _08066270 - .pool -_08066224: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x34 - bl SetMonData - b _08066270 - .pool -_08066240: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x35 - bl SetMonData - b _08066270 - .pool -_0806625C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x36 - bl SetMonData -_08066270: - add sp, 0x38 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8065964 - - thumb_func_start LinkOpponentHandleSetRawMonData -LinkOpponentHandleSetRawMonData: @ 8066284 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gEnemyParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _080662DC - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_080662BA: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _080662BA -_080662DC: - bl LinkOpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleSetRawMonData - - thumb_func_start LinkOpponentHandleLoadMonSprite -LinkOpponentHandleLoadMonSprite: @ 80662F8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r7, =gBattlePartyID - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 1 - adds r0, r7 - ldrh r0, [r0] - movs r1, 0x64 - mov r10, r1 - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - ldr r1, =gEnemyParty - mov r9, r1 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r1, [r6] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - add r0, r9 - bl BattleLoadOpponentMonSpriteGfx - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldrb r4, [r6] - lsls r0, r4, 1 - adds r0, r7 - ldrh r0, [r0] - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064B04 - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleLoadMonSprite - - thumb_func_start LinkOpponentHandleSwitchInAnim -LinkOpponentHandleSwitchInAnim: @ 8066448 - push {r4,lr} - ldr r1, =gBattlePartyID - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r2, r0, 1 - adds r2, r1 - ldr r3, =gBattleBufferA - lsls r0, 9 - adds r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2] - ldrb r0, [r4] - lsls r1, r0, 9 - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - bl sub_8066494 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064F40 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleSwitchInAnim - - thumb_func_start sub_8066494 -sub_8066494: @ 8066494 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl ClearTemporarySpeciesSpriteData - ldr r0, =gBattlePartyID - lsls r4, r6, 1 - adds r4, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4] - ldrh r0, [r4] - movs r1, 0x64 - mov r9, r1 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r10, r1 - add r10, r6 - mov r1, r10 - strb r0, [r1] - ldrh r0, [r4] - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - adds r0, r5 - adds r1, r6, 0 - bl BattleLoadOpponentMonSpriteGfx - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFE - bl sub_80753E8 - mov r1, r10 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066494 - - thumb_func_start LinkOpponentHandleReturnMonToBall -LinkOpponentHandleReturnMonToBall: @ 8066624 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0806666C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80666BC - str r1, [r0] - b _080666A8 - .pool -_0806666C: - 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 - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkOpponentBufferExecCompleted -_080666A8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleReturnMonToBall - - thumb_func_start sub_80666BC -sub_80666BC: @ 80666BC - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _080666E4 - cmp r0, 0x1 - beq _08066712 - b _0806673A - .pool -_080666E4: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080666FE - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_080666FE: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0806673A -_08066712: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0806673A - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x2 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064C58 - str r1, [r0] -_0806673A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80666BC - - thumb_func_start LinkOpponentHandleDrawTrainerPic -LinkOpponentHandleDrawTrainerPic: @ 8066748 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r4, =gBattleTypeFlags - ldr r0, [r4] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08066840 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0xC8 - cmp r1, 0 - beq _08066770 - movs r7, 0x98 -_08066770: - ldr r0, [r4] - movs r1, 0x80 - lsls r1, 1 - ands r0, r1 - cmp r0, 0 - beq _080667A8 - ldrb r0, [r5] - cmp r0, 0x1 - bne _08066794 - ldr r0, =gTrainerBattleOpponent_A - b _08066796 - .pool -_08066794: - ldr r0, =gTrainerBattleOpponent_B -_08066796: - ldrh r0, [r0] - bl GetFrontierTrainerFrontSpriteId - lsls r0, 24 - lsrs r0, 24 - b _0806694C - .pool -_080667A8: - ldrb r0, [r5] - bl GetBankMultiplayerId - ldr r6, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _080667D8 - ldrb r0, [r5] - bl GetBankMultiplayerId - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _080667F4 -_080667D8: - ldrb r0, [r5] - bl GetBankMultiplayerId - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _080668AA - b _080668BC - .pool -_080667F4: - ldrb r0, [r5] - bl GetBankMultiplayerId - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _08066822 - ldrb r0, [r5] - bl GetBankMultiplayerId - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _08066838 -_08066822: - ldrb r0, [r5] - bl GetBankMultiplayerId - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _08066916 - b _08066924 -_08066838: - ldrb r0, [r5] - bl GetBankMultiplayerId - b _0806693A -_08066840: - movs r7, 0xB0 - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 4 - cmp r1, r0 - bne _08066858 - bl sub_8068B48 - b _08066948 - .pool -_08066858: - bl GetMultiplayerId - ldr r6, =gLinkPlayers - movs r5, 0x1 - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _08066892 - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _080668C8 -_08066892: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - beq _080668BC -_080668AA: - ldr r0, =gUnknown_0831F578 - adds r0, 0x4F - ldrb r0, [r0] - b _0806694C - .pool -_080668BC: - ldr r0, =gUnknown_0831F578 - adds r0, 0x4E - ldrb r0, [r0] - b _0806694C - .pool -_080668C8: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _080668FE - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _08066930 -_080668FE: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - beq _08066924 -_08066916: - ldr r0, =gUnknown_0831F578 - adds r0, 0x51 - ldrb r0, [r0] - b _0806694C - .pool -_08066924: - ldr r0, =gUnknown_0831F578 - adds r0, 0x50 - ldrb r0, [r0] - b _0806694C - .pool -_08066930: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 -_0806693A: - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - bl PlayerGenderToFrontTrainerPicId -_08066948: - lsls r0, 16 - lsrs r0, 16 -_0806694C: - mov r8, r0 - ldr r5, =gActiveBank - ldrb r1, [r5] - bl DecompressTrainerFrontPic - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r9, r7 - ldr r1, =gTrainerFrontPicCoords - mov r2, r8 - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 14 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r5] - adds r1, r6 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r1, r8 - strh r1, [r0, 0x6] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064400 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleDrawTrainerPic - - thumb_func_start LinkOpponentHandleTrainerSlide -LinkOpponentHandleTrainerSlide: @ 8066A58 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08066A74 - ldr r0, =gTrainerBattleOpponent_A - b _08066A76 - .pool -_08066A74: - ldr r0, =gTrainerBattleOpponent_B -_08066A76: - ldrh r0, [r0] - bl GetFrontierTrainerFrontSpriteId - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - bl DecompressTrainerFrontPic - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r2, =gTrainerFrontPicCoords - mov r3, r8 - lsls r1, r3, 2 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 14 - adds r2, r1 - asrs r2, 16 - movs r1, 0xB0 - movs r3, 0x1E - bl CreateSprite - ldr r5, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r5 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x60 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x20] - adds r1, 0x20 - strh r1, [r0, 0x20] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r6] - adds r1, r5 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r3, r8 - strh r3, [r0, 0x6] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064438 - str r1, [r0] - bl LinkOpponentBufferExecCompleted - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleTrainerSlide - - thumb_func_start LinkOpponentHandleTrainerSlideBack -LinkOpponentHandleTrainerSlideBack: @ 8066B94 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064470 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleTrainerSlideBack - - thumb_func_start LinkOpponentHandleFaintAnimation -LinkOpponentHandleFaintAnimation: @ 8066C40 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _08066C94 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08066C74 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08066C74: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _08066CD0 - .pool -_08066C94: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08066CD0 - strb r0, [r3, 0x4] - movs r0, 0x10 - movs r1, 0x3F - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - 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_8039934 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064C14 - str r1, [r0] -_08066CD0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleFaintAnimation - - thumb_func_start LinkOpponentHandleCmd11 -LinkOpponentHandleCmd11: @ 8066CEC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd11 - - thumb_func_start LinkOpponentHandleCmd12 -LinkOpponentHandleCmd12: @ 8066CF8 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd12 - - thumb_func_start LinkOpponentHandleBallThrow -LinkOpponentHandleBallThrow: @ 8066D04 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleBallThrow - - thumb_func_start LinkOpponentHandlePause -LinkOpponentHandlePause: @ 8066D10 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandlePause - - thumb_func_start LinkOpponentHandleMoveAnimation -LinkOpponentHandleMoveAnimation: @ 8066D1C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _08066D32 - b _08066E58 -_08066D32: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r1, [r5] - lsls r1, 9 - adds r0, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - mov r0, r12 - adds r0, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r6, r0 - ldr r0, =gAnimMoveTurn - mov r8, r0 - mov r0, r12 - adds r0, 0x3 - adds r1, r0 - ldrb r0, [r1] - mov r1, r8 - strb r0, [r1] - ldr r3, =gAnimMovePower - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x4 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x5 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r3] - ldr r3, =gAnimMoveDmg - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x6 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x7 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - mov r0, r12 - adds r0, 0x8 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r2, r0 - mov r0, r12 - adds r0, 0x9 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 24 - orrs r2, r0 - str r2, [r3] - ldr r2, =gAnimFriendship - ldrb r0, [r5] - lsls r0, 9 - mov r1, r12 - adds r1, 0xA - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r4, =gWeatherMoveAnim - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0xC - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0xD - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r4] - ldr r7, =gAnimDisableStructPtr - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x10 - adds r1, r0 - str r1, [r7] - ldr r2, =gTransformedPersonalities - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - str r1, [r0] - mov r0, r8 - ldrb r1, [r0] - adds r0, r6, 0 - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _08066E30 - bl LinkOpponentBufferExecCompleted - b _08066E58 - .pool -_08066E30: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8066E70 - str r1, [r0] - ldrh r1, [r4] - ldr r2, [r7] - adds r0, r6, 0 - bl sub_817E0FC -_08066E58: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleMoveAnimation - - thumb_func_start sub_8066E70 -sub_8066E70: @ 8066E70 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _08066F08 - cmp r2, 0x1 - bgt _08066EC8 - cmp r2, 0 - beq _08066ED2 - b _08066FE4 - .pool -_08066EC8: - cmp r2, 0x2 - beq _08066F32 - cmp r2, 0x3 - beq _08066FA8 - b _08066FE4 -_08066ED2: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _08066EF4 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08066EF4: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08066FE4 -_08066F08: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08066FE4 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _08066FE4 -_08066F32: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _08066FE4 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _08066F80 - mov r0, r8 - cmp r0, 0x1 - bhi _08066F80 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_08066F80: - 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 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _08066FE4 - .pool -_08066FA8: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08066FE4 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl LinkOpponentBufferExecCompleted -_08066FE4: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8066E70 - - thumb_func_start LinkOpponentHandlePrintString -LinkOpponentHandlePrintString: @ 8066FF4 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064CCC - str r1, [r0] - ldrh r0, [r4] - bl sub_817C95C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandlePrintString - - thumb_func_start LinkOpponentHandlePrintStringPlayerOnly -LinkOpponentHandlePrintStringPlayerOnly: @ 806704C - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandlePrintStringPlayerOnly - - thumb_func_start LinkOpponentHandleChooseAction -LinkOpponentHandleChooseAction: @ 8067058 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleChooseAction - - thumb_func_start LinkOpponentHandleCmd19 -LinkOpponentHandleCmd19: @ 8067064 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd19 - - thumb_func_start LinkOpponentHandleChooseMove -LinkOpponentHandleChooseMove: @ 8067070 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleChooseMove - - thumb_func_start LinkOpponentHandleOpenBag -LinkOpponentHandleOpenBag: @ 806707C - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleOpenBag - - thumb_func_start LinkOpponentHandleChoosePokemon -LinkOpponentHandleChoosePokemon: @ 8067088 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleChoosePokemon - - thumb_func_start LinkOpponentHandleCmd23 -LinkOpponentHandleCmd23: @ 8067094 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd23 - - thumb_func_start LinkOpponentHandleHealthBarUpdate -LinkOpponentHandleHealthBarUpdate: @ 80670A0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _08067130 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gEnemyParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0806715A - .pool -_08067130: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0806715A: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064BC0 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleHealthBarUpdate - - thumb_func_start LinkOpponentHandleExpUpdate -LinkOpponentHandleExpUpdate: @ 8067190 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleExpUpdate - - thumb_func_start LinkOpponentHandleStatusIconUpdate -LinkOpponentHandleStatusIconUpdate: @ 806719C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _080671F0 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8065008 - str r1, [r0] -_080671F0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleStatusIconUpdate - - thumb_func_start LinkOpponentHandleStatusAnimation -LinkOpponentHandleStatusAnimation: @ 8067214 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08067264 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl DoStatusAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8065008 - str r1, [r0] -_08067264: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleStatusAnimation - - thumb_func_start LinkOpponentHandleStatusXor -LinkOpponentHandleStatusXor: @ 806727C - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleStatusXor - - thumb_func_start LinkOpponentHandleDataTransfer -LinkOpponentHandleDataTransfer: @ 8067288 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleDataTransfer - - thumb_func_start LinkOpponentHandleDMA3Transfer -LinkOpponentHandleDMA3Transfer: @ 8067294 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleDMA3Transfer - - thumb_func_start LinkOpponentHandlePlayBGM -LinkOpponentHandlePlayBGM: @ 80672A0 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandlePlayBGM - - thumb_func_start LinkOpponentHandleCmd32 -LinkOpponentHandleCmd32: @ 80672AC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd32 - - thumb_func_start LinkOpponentHandleCmd33 -LinkOpponentHandleCmd33: @ 80672B8 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd33 - - thumb_func_start LinkOpponentHandleCmd34 -LinkOpponentHandleCmd34: @ 80672C4 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd34 - - thumb_func_start LinkOpponentHandleCmd35 -LinkOpponentHandleCmd35: @ 80672D0 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd35 - - thumb_func_start LinkOpponentHandleCmd36 -LinkOpponentHandleCmd36: @ 80672DC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd36 - - thumb_func_start LinkOpponentHandleCmd37 -LinkOpponentHandleCmd37: @ 80672E8 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleCmd37 - - thumb_func_start LinkOpponentHandleCmd38 -LinkOpponentHandleCmd38: @ 8067304 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleCmd38 - - thumb_func_start LinkOpponentHandleCmd39 -LinkOpponentHandleCmd39: @ 806733C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleCmd39 - - thumb_func_start LinkOpponentHandleCmd40 -LinkOpponentHandleCmd40: @ 8067354 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleCmd40 - - thumb_func_start LinkOpponentHandleHitAnimation -LinkOpponentHandleHitAnimation: @ 806737C - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080673B0 - bl LinkOpponentBufferExecCompleted - b _080673DA - .pool -_080673B0: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064CE4 - str r1, [r0] -_080673DA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleHitAnimation - - thumb_func_start LinkOpponentHandleCmd42 -LinkOpponentHandleCmd42: @ 80673EC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd42 - - thumb_func_start LinkOpponentHandleEffectivenessSound -LinkOpponentHandleEffectivenessSound: @ 80673F8 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0806740C - movs r3, 0xC0 -_0806740C: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl LinkOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleEffectivenessSound - - thumb_func_start LinkOpponentHandlePlayFanfareOrBGM -LinkOpponentHandlePlayFanfareOrBGM: @ 806743C - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _08067478 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0806748C - .pool -_08067478: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0806748C: - bl LinkOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandlePlayFanfareOrBGM - - thumb_func_start LinkOpponentHandleFaintingCry -LinkOpponentHandleFaintingCry: @ 8067498 - push {lr} - 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, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - movs r2, 0x5 - bl PlayCry3 - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleFaintingCry - - thumb_func_start LinkOpponentHandleIntroSlide -LinkOpponentHandleIntroSlide: @ 80674D4 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleIntroSlide - - thumb_func_start LinkOpponentHandleIntroTrainerBallThrow -LinkOpponentHandleIntroTrainerBallThrow: @ 8067508 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_80676FC - bl StoreSpriteCallbackInData6 - ldr r0, =c3_08038DC4 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r6] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - 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, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080675CA - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_080675CA: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_28 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleIntroTrainerBallThrow - - thumb_func_start c3_08038DC4 -c3_08038DC4: @ 8067618 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08067652 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08067684 -_08067652: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_8066494 - b _080676C4 - .pool -_08067684: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r6, =gBattlePartyID - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_8066494 - ldrb r0, [r7] - movs r5, 0x2 - eors r0, r5 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_8066494 - ldrb r0, [r7] - eors r0, r5 - strb r0, [r7] -_080676C4: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064734 - str r1, [r0] - mov r0, r9 - strb r0, [r2] - mov r0, r8 - bl DestroyTask - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c3_08038DC4 - - thumb_func_start sub_80676FC -sub_80676FC: @ 80676FC - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x6] - bl FreeTrainerFrontPicPalette - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80676FC - - thumb_func_start LinkOpponentHandleDrawPartyStatusSummary -LinkOpponentHandleDrawPartyStatusSummary: @ 8067718 - push {r4-r7,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08067748 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08067748 - bl LinkOpponentBufferExecCompleted - b _08067812 - .pool -_08067748: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldr r1, =gBattleBufferA - ldrb r2, [r3] - lsls r0, r2, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r3, 0 - cmp r0, 0 - beq _080677B4 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r2, [r3, 0x1] - lsls r1, r2, 27 - lsrs r0, r1, 28 - cmp r0, 0x1 - bhi _080677AC - adds r0, 0x1 - movs r1, 0xF - ands r0, r1 - lsls r0, 1 - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x1] - b _08067812 - .pool -_080677AC: - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - strb r0, [r3, 0x1] -_080677B4: - adds r5, r7, 0 - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08067806 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_08067806: - ldr r0, =gBattleBankFunc - ldrb r1, [r7] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_806782C - str r0, [r1] -_08067812: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleDrawPartyStatusSummary - - thumb_func_start sub_806782C -sub_806782C: @ 806782C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _08067864 - 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, 0x5] - bl LinkOpponentBufferExecCompleted -_08067864: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806782C - - thumb_func_start LinkOpponentHandleCmd49 -LinkOpponentHandleCmd49: @ 8067874 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080678A6 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_080678A6: - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleCmd49 - - thumb_func_start LinkOpponentHandleCmd50 -LinkOpponentHandleCmd50: @ 80678C4 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleCmd50 - - thumb_func_start LinkOpponentHandleSpriteInvisibility -LinkOpponentHandleSpriteInvisibility: @ 80678D0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _08067916 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility -_08067916: - bl LinkOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleSpriteInvisibility - - thumb_func_start LinkOpponentHandleBattleAnimation -LinkOpponentHandleBattleAnimation: @ 8067930 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08067992 - ldr r4, =gBattleBufferA - ldrb r2, [r5] - lsls r1, r2, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - adds r0, r4, 0x2 - adds r0, r1, r0 - ldrb r3, [r0] - adds r4, 0x3 - adds r1, r4 - ldrb r0, [r1] - lsls r0, 8 - orrs r3, r0 - str r3, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - adds r3, r6, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _08067980 - bl LinkOpponentBufferExecCompleted - b _0806798C - .pool -_08067980: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8065038 - str r0, [r1] -_0806798C: - adds r0, r6, 0 - bl sub_817E32C -_08067992: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleBattleAnimation - - thumb_func_start LinkOpponentHandleLinkStandbyMsg -LinkOpponentHandleLinkStandbyMsg: @ 80679A4 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - bl sub_81851A8 - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleLinkStandbyMsg - - thumb_func_start LinkOpponentHandleResetActionMoveSelection -LinkOpponentHandleResetActionMoveSelection: @ 80679C4 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end LinkOpponentHandleResetActionMoveSelection - - thumb_func_start LinkOpponentHandleCmd55 -LinkOpponentHandleCmd55: @ 80679D0 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r0, r4 - bl sub_81851A8 - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x3 - adds r0, r4 - ldrb r2, [r0] - cmp r2, 0x3 - bne _08067A00 - ldr r0, =gBattleOutcome - strb r2, [r0] - b _08067A08 - .pool -_08067A00: - ldr r0, =gBattleOutcome - movs r1, 0x3 - eors r1, r2 - strb r1, [r0] -_08067A08: - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =0x00000ca9 - adds r3, r1 - movs r1, 0x1 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r3] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl LinkOpponentBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentHandleCmd55 - - thumb_func_start nullsub_92 -nullsub_92: @ 8067A70 - bx lr - thumb_func_end nullsub_92 - - - .align 2, 0 @ Don't pad with nop. diff --git a/include/battle.h b/include/battle.h index f731168dd..e4f3ea77d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -799,8 +799,8 @@ extern struct BattleStruct* gBattleStruct; // special animations table #define B_ANIM_LVL_UP 0x0 -#define B_ANIM_SWITCH_OUT_MON 0x1 -#define B_ANIM_SPECIAL_2 0x2 +#define B_ANIM_SWITCH_OUT_PLAYER_MON 0x1 +#define B_ANIM_SWITCH_OUT_OPPONENT_MON 0x2 #define B_ANIM_BALL_THROW 0x3 #define B_ANIM_SAFARI_BALL_THROW 0x4 #define B_ANIM_SUBSTITUTE_TO_MON 0x5 @@ -898,6 +898,7 @@ void SetBattleSpriteInvisibilityBitToSpriteInvisibility(u8 bank); u16 ChooseMoveAndTargetInBattlePalace(void); void LoadBattleBarGfx(u8 arg0); bool8 mplay_80342A4(u8 bank); +void sub_805EEE0(u8 bank); enum { @@ -955,10 +956,7 @@ struct BattleHealthboxInfo u8 specialAnimActive : 1; //x40 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_x1E : 4; u8 field_1_x20 : 1; u8 field_1_x40 : 1; u8 field_1_x80 : 1; diff --git a/ld_script.txt b/ld_script.txt index 1acb181eb..cf07574d2 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -66,8 +66,7 @@ SECTIONS { 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/battle_controller_link_opponent.o(.text); src/pokemon_1.o(.text); asm/pokemon_1.o(.text); src/calculate_base_damage.o(.text); @@ -341,7 +340,7 @@ SECTIONS { src/battle_controller_player.o(.rodata); data/smokescreen.o(.rodata); src/battle_controller_opponent.o(.rodata); - src/battle_controller_linkopponent.o(.rodata); + src/battle_controller_link_opponent.o(.rodata); data/data2c.o(.rodata); src/trig.o(.rodata); src/util.o(.rodata); diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c new file mode 100644 index 000000000..084a84d0b --- /dev/null +++ b/src/battle_controller_link_opponent.c @@ -0,0 +1,1903 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "battle_link_817C95C.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.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" +#include "pokeball.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +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 struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern u16 gTrainerBattleOpponent_A; +extern u16 gTrainerBattleOpponent_B; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; +extern const u8 gUnknown_0831F578[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); +extern void sub_81851A8(u8 *); +extern u16 sub_8068B48(void); + +// this file's functions +static void LinkOpponentHandleGetMonData(void); +static void LinkOpponentHandleGetRawMonData(void); +static void LinkOpponentHandleSetMonData(void); +static void LinkOpponentHandleSetRawMonData(void); +static void LinkOpponentHandleLoadMonSprite(void); +static void LinkOpponentHandleSwitchInAnim(void); +static void LinkOpponentHandleReturnMonToBall(void); +static void LinkOpponentHandleDrawTrainerPic(void); +static void LinkOpponentHandleTrainerSlide(void); +static void LinkOpponentHandleTrainerSlideBack(void); +static void LinkOpponentHandleFaintAnimation(void); +static void LinkOpponentHandlePaletteFade(void); +static void LinkOpponentHandleSuccessBallThrowAnim(void); +static void LinkOpponentHandleBallThrowAnim(void); +static void LinkOpponentHandlePause(void); +static void LinkOpponentHandleMoveAnimation(void); +static void LinkOpponentHandlePrintString(void); +static void LinkOpponentHandlePrintStringPlayerOnly(void); +static void LinkOpponentHandleChooseAction(void); +static void LinkOpponentHandleUnknownYesNoBox(void); +static void LinkOpponentHandleChooseMove(void); +static void LinkOpponentHandleChooseItem(void); +static void LinkOpponentHandleChoosePokemon(void); +static void LinkOpponentHandleCmd23(void); +static void LinkOpponentHandleHealthBarUpdate(void); +static void LinkOpponentHandleExpUpdate(void); +static void LinkOpponentHandleStatusIconUpdate(void); +static void LinkOpponentHandleStatusAnimation(void); +static void LinkOpponentHandleStatusXor(void); +static void LinkOpponentHandleDataTransfer(void); +static void LinkOpponentHandleDMA3Transfer(void); +static void LinkOpponentHandlePlayBGM(void); +static void LinkOpponentHandleCmd32(void); +static void LinkOpponentHandleTwoReturnValues(void); +static void LinkOpponentHandleChosenMonReturnValue(void); +static void LinkOpponentHandleOneReturnValue(void); +static void LinkOpponentHandleOneReturnValue_Duplicate(void); +static void LinkOpponentHandleCmd37(void); +static void LinkOpponentHandleCmd38(void); +static void LinkOpponentHandleCmd39(void); +static void LinkOpponentHandleCmd40(void); +static void LinkOpponentHandleHitAnimation(void); +static void LinkOpponentHandleCmd42(void); +static void LinkOpponentHandleEffectivenessSound(void); +static void LinkOpponentHandlePlayFanfareOrBGM(void); +static void LinkOpponentHandleFaintingCry(void); +static void LinkOpponentHandleIntroSlide(void); +static void LinkOpponentHandleIntroTrainerBallThrow(void); +static void LinkOpponentHandleDrawPartyStatusSummary(void); +static void LinkOpponentHandleCmd49(void); +static void LinkOpponentHandleCmd50(void); +static void LinkOpponentHandleSpriteInvisibility(void); +static void LinkOpponentHandleBattleAnimation(void); +static void LinkOpponentHandleLinkStandbyMsg(void); +static void LinkOpponentHandleResetActionMoveSelection(void); +static void LinkOpponentHandleCmd55(void); +static void nullsub_92(void); + +static void LinkOpponentBufferRunCommand(void); +static void LinkOpponentBufferExecCompleted(void); +static void sub_8064DD0(void); +static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst); +static void SetLinkOpponentMonData(u8 monId); +static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void LinkOpponentDoMoveAnimation(void); +static void sub_8067618(u8 taskId); +static void sub_80676FC(struct Sprite *sprite); +static void sub_806782C(void); + +static void (*const gLinkOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + LinkOpponentHandleGetMonData, + LinkOpponentHandleGetRawMonData, + LinkOpponentHandleSetMonData, + LinkOpponentHandleSetRawMonData, + LinkOpponentHandleLoadMonSprite, + LinkOpponentHandleSwitchInAnim, + LinkOpponentHandleReturnMonToBall, + LinkOpponentHandleDrawTrainerPic, + LinkOpponentHandleTrainerSlide, + LinkOpponentHandleTrainerSlideBack, + LinkOpponentHandleFaintAnimation, + LinkOpponentHandlePaletteFade, + LinkOpponentHandleSuccessBallThrowAnim, + LinkOpponentHandleBallThrowAnim, + LinkOpponentHandlePause, + LinkOpponentHandleMoveAnimation, + LinkOpponentHandlePrintString, + LinkOpponentHandlePrintStringPlayerOnly, + LinkOpponentHandleChooseAction, + LinkOpponentHandleUnknownYesNoBox, + LinkOpponentHandleChooseMove, + LinkOpponentHandleChooseItem, + LinkOpponentHandleChoosePokemon, + LinkOpponentHandleCmd23, + LinkOpponentHandleHealthBarUpdate, + LinkOpponentHandleExpUpdate, + LinkOpponentHandleStatusIconUpdate, + LinkOpponentHandleStatusAnimation, + LinkOpponentHandleStatusXor, + LinkOpponentHandleDataTransfer, + LinkOpponentHandleDMA3Transfer, + LinkOpponentHandlePlayBGM, + LinkOpponentHandleCmd32, + LinkOpponentHandleTwoReturnValues, + LinkOpponentHandleChosenMonReturnValue, + LinkOpponentHandleOneReturnValue, + LinkOpponentHandleOneReturnValue_Duplicate, + LinkOpponentHandleCmd37, + LinkOpponentHandleCmd38, + LinkOpponentHandleCmd39, + LinkOpponentHandleCmd40, + LinkOpponentHandleHitAnimation, + LinkOpponentHandleCmd42, + LinkOpponentHandleEffectivenessSound, + LinkOpponentHandlePlayFanfareOrBGM, + LinkOpponentHandleFaintingCry, + LinkOpponentHandleIntroSlide, + LinkOpponentHandleIntroTrainerBallThrow, + LinkOpponentHandleDrawPartyStatusSummary, + LinkOpponentHandleCmd49, + LinkOpponentHandleCmd50, + LinkOpponentHandleSpriteInvisibility, + LinkOpponentHandleBattleAnimation, + LinkOpponentHandleLinkStandbyMsg, + LinkOpponentHandleResetActionMoveSelection, + LinkOpponentHandleCmd55, + nullsub_92 +}; + +static void nullsub_28(void) +{ +} + +void SetBankFuncToLinkOpponentBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = LinkOpponentBufferRunCommand; +} + +static void LinkOpponentBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gLinkOpponentBufferCommands)) + gLinkOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + LinkOpponentBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + LinkOpponentBufferExecCompleted(); +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + LinkOpponentBufferExecCompleted(); +} + +static void sub_8064470(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_80644D8(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_8064520(void) +{ + bool32 r8 = FALSE; + bool32 r4 = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r8 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + r4 = TRUE; + } + + if (r8) + { + if (r4 || !IsAnimBankSpriteVisible(gActiveBank ^ BIT_MON)) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + return; + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + return; + + 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); + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + return; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) + { + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + } + } + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_80644D8; + } +} + +static void sub_8064734(void) +{ + bool32 r10 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[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], &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[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) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + } + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r10 = TRUE; + } + + if (r10) + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) + { + if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 1) + return; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + } + + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + SetBankEnemyShadowSpriteCallback(gActiveBank ^ BIT_MON, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], MON_DATA_SPECIES)); + } + + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_8064520; + } + } +} + +static void sub_8064B04(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + else + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + LinkOpponentBufferExecCompleted(); + } + } + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_8064C14(void) +{ + if (!gSprites[gBankSpriteIds[gActiveBank]].inUse) + { + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_8064C58(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkOpponentBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + LinkOpponentBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + LinkOpponentBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_8064D60(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_8064DD0; + } +} + +static void sub_8064DD0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive && !IsCryPlayingOrClearCrySongs()) + { + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + || gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy_2) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + LinkOpponentBufferExecCompleted(); + } + } +} + +static void sub_8064E50(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_8064D60; + } +} + +static void sub_8064F40(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleBankFunc[gActiveBank] = sub_8064E50; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + LinkOpponentBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = LinkOpponentBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void LinkOpponentHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyLinkOpponentMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyLinkOpponentMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + LinkOpponentBufferExecCompleted(); +} + +static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV); + battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPD); + battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV); + dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPD); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void LinkOpponentHandleGetRawMonData(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetLinkOpponentMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetLinkOpponentMonData(i); + monsToCheck >>= 1; + } + } + LinkOpponentBufferExecCompleted(); +} + +static void SetLinkOpponentMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gEnemyParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } +} + +static void LinkOpponentHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleLoadMonSprite(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + + + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleBankFunc[gActiveBank] = sub_8064B04; +} + +static void LinkOpponentHandleSwitchInAnim(void) +{ + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + sub_8066494(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_8064F40; +} + +static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE); +} + +static void LinkOpponentHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkOpponentBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + gBattleBankFunc[gActiveBank] = sub_8064C58; + } + break; + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +static void LinkOpponentHandleDrawTrainerPic(void) +{ + s16 xPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 152; + else // first mon + xPos = 200; + + if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) + { + if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) + trainerPicId = gUnknown_0831F578[0x4F]; + else + trainerPicId = gUnknown_0831F578[0x4E]; + } + else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) + { + if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) + trainerPicId = gUnknown_0831F578[0x51]; + else + trainerPicId = gUnknown_0831F578[0x50]; + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender); + } + } + } + else + { + xPos = 176; + if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + { + trainerPicId = sub_8068B48(); + } + else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN) + { + if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) + trainerPicId = gUnknown_0831F578[0x4F]; + else + trainerPicId = gUnknown_0831F578[0x4E]; + } + else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_SAPPHIRE) + { + if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) + trainerPicId = gUnknown_0831F578[0x51]; + else + trainerPicId = gUnknown_0831F578[0x50]; + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender); + } + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + xPos, + (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void LinkOpponentHandleTrainerSlide(void) +{ + u32 trainerPicId; + + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96; + gSprites[gBankSpriteIds[gActiveBank]].pos1.x += 32; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle bank function + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_8064470; +} + +static void LinkOpponentHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039934; + gBattleBankFunc[gActiveBank] = sub_8064C14; + } + } +} + +static void LinkOpponentHandlePaletteFade(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleSuccessBallThrowAnim(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleBallThrowAnim(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandlePause(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + LinkOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = LinkOpponentDoMoveAnimation; + sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); + } + } +} + +static void LinkOpponentDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + LinkOpponentBufferExecCompleted(); + } + break; + } +} + +static void LinkOpponentHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; + sub_817C95C(*stringId); +} + +static void LinkOpponentHandlePrintStringPlayerOnly(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChooseAction(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleUnknownYesNoBox(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChooseMove(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChooseItem(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChoosePokemon(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd23(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void LinkOpponentHandleExpUpdate(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkOpponentHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkOpponentHandleStatusXor(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleDataTransfer(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleDMA3Transfer(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandlePlayBGM(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd32(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleTwoReturnValues(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChosenMonReturnValue(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleOneReturnValue(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleOneReturnValue_Duplicate(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + LinkOpponentBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void LinkOpponentHandleCmd42(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleFaintingCry(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, 25, 5); + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_80676FC); + + taskId = CreateTask(sub_8067618, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_28; +} + +static void sub_8067618(u8 taskId) +{ + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_8066494(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_8066494(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_8066494(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_8064734; + gActiveBank = savedActiveBank; + DestroyTask(taskId); +} + +static void sub_80676FC(struct Sprite *sprite) +{ + FreeTrainerFrontPicPalette(sprite->oam.affineParam); + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); +} + +static void LinkOpponentHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + LinkOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + + if (gBattleBufferA[gActiveBank][2] != 0) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E < 2) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E++; + return; + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E = 0; + } + } + + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_806782C; + } +} + +static void sub_806782C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + LinkOpponentBufferExecCompleted(); + } +} + +static void LinkOpponentHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd50(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleSpriteInvisibility(void) +{ + if (AnimBankSpriteExists(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + LinkOpponentBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + + sub_817E32C(animationId); + } +} + +static void LinkOpponentHandleLinkStandbyMsg(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][2]); + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleResetActionMoveSelection(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd55(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][4]); + + if (gBattleBufferA[gActiveBank][1] == BATTLE_DREW) + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + else + gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ BATTLE_DREW; + + gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBank][2]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + LinkOpponentBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_92(void) +{ +} diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 07bab9d5f..2c5cdd6d9 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -40,7 +40,6 @@ extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; -extern u8 gBankInMenu; extern u16 gUnknown_020243FC; extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; @@ -1129,7 +1128,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_814B3DC; } break; @@ -1221,7 +1220,7 @@ static void LinkPartnerHandleFaintAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); - PlaySE12WithPanning(SE_POKE_DEAD, -64); + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; diff --git a/src/battle_controller_linkopponent.c b/src/battle_controller_linkopponent.c deleted file mode 100644 index fb21865ca..000000000 --- a/src/battle_controller_linkopponent.c +++ /dev/null @@ -1,143 +0,0 @@ -#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_COUNT])(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_player.c b/src/battle_controller_player.c index b022d3f87..cbf924235 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -2285,7 +2285,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_8059744; } break; @@ -2453,7 +2453,7 @@ static void PlayerHandleFaintAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); - PlaySE12WithPanning(SE_POKE_DEAD, -64); + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; @@ -2911,7 +2911,7 @@ static void PlayerHandleHitAnimation(void) } else { - gDoingBattleAnim = 1; + gDoingBattleAnim = TRUE; gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; DoHitAnimHealthboxEffect(gActiveBank); gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 25eaf773f..82f358921 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -1315,7 +1315,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_81BB828; } break; @@ -1414,7 +1414,7 @@ static void PlayerPartnerHandleFaintAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); - PlaySE12WithPanning(SE_POKE_DEAD, -64); + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 0b0f1e626..429edf9f7 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1213,7 +1213,7 @@ static void DoSwitchOutAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; - DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); gBattleBankFunc[gActiveBank] = sub_818A1B0; } break; From 94b3a8dd69699f7a127cf27282c06ca8a27d0a63 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 24 Oct 2017 15:35:36 +0200 Subject: [PATCH 14/29] spd to speed --- include/pokemon.h | 6 +++--- src/battle_controller_link_opponent.c | 24 ++++++++++++------------ src/battle_controller_link_partner.c | 24 ++++++++++++------------ src/battle_controller_player.c | 24 ++++++++++++------------ src/battle_controller_player_partner.c | 24 ++++++++++++------------ src/battle_controller_recorded_player.c | 24 ++++++++++++------------ src/pokemon_1.c | 4 ++-- src/pokemon_2.c | 4 ++-- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index d732552f4..98cff2094 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -30,7 +30,7 @@ #define MON_DATA_HP_EV 26 #define MON_DATA_ATK_EV 27 #define MON_DATA_DEF_EV 28 -#define MON_DATA_SPD_EV 29 +#define MON_DATA_SPEED_EV 29 #define MON_DATA_SPATK_EV 30 #define MON_DATA_SPDEF_EV 31 #define MON_DATA_FRIENDSHIP 32 @@ -43,7 +43,7 @@ #define MON_DATA_HP_IV 39 #define MON_DATA_ATK_IV 40 #define MON_DATA_DEF_IV 41 -#define MON_DATA_SPEED_IV 42 +#define MON_DATA_SPEED_IV 42 #define MON_DATA_SPATK_IV 43 #define MON_DATA_SPDEF_IV 44 #define MON_DATA_IS_EGG 45 @@ -62,7 +62,7 @@ #define MON_DATA_MAX_HP 58 #define MON_DATA_ATK 59 #define MON_DATA_DEF 60 -#define MON_DATA_SPEED 61 +#define MON_DATA_SPEED 61 #define MON_DATA_SPATK 62 #define MON_DATA_SPDEF 63 #define MON_DATA_MAIL 64 diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 084a84d0b..c7613001b 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -621,7 +621,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV); + battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); @@ -631,7 +631,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPD); + battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG); @@ -716,7 +716,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_EV); + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); size = 1; break; case REQUEST_SPATK_EV_BATTLE: @@ -755,7 +755,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV); + dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); size = 6; @@ -773,7 +773,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV); + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); size = 1; break; case REQUEST_SPATK_IV_BATTLE: @@ -835,7 +835,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) size = 2; break; case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPD); + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); dst[0] = data16; dst[1] = data16 >> 8; size = 2; @@ -957,7 +957,7 @@ static void SetLinkOpponentMonData(u8 monId) iv = battlePokemon->defenseIV; SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); iv = battlePokemon->speedIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV, &iv); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); iv = battlePokemon->spAttackIV; SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); iv = battlePokemon->spDefenseIV; @@ -969,7 +969,7 @@ static void SetLinkOpponentMonData(u8 monId) SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gEnemyParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); } @@ -1023,7 +1023,7 @@ static void SetLinkOpponentMonData(u8 monId) SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_EV_BATTLE: SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); @@ -1053,7 +1053,7 @@ static void SetLinkOpponentMonData(u8 monId) SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); break; @@ -1067,7 +1067,7 @@ static void SetLinkOpponentMonData(u8 monId) SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_IV_BATTLE: SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); @@ -1100,7 +1100,7 @@ static void SetLinkOpponentMonData(u8 monId) SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_BATTLE: SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 2c5cdd6d9..d5ce7ef70 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -503,7 +503,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); @@ -513,7 +513,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); @@ -598,7 +598,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); size = 1; break; case REQUEST_SPATK_EV_BATTLE: @@ -637,7 +637,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); size = 6; @@ -655,7 +655,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); size = 1; break; case REQUEST_SPATK_IV_BATTLE: @@ -717,7 +717,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) size = 2; break; case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); dst[0] = data16; dst[1] = data16 >> 8; size = 2; @@ -839,7 +839,7 @@ static void SetLinkPartnerMonData(u8 monId) iv = battlePokemon->defenseIV; SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); iv = battlePokemon->spAttackIV; SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); iv = battlePokemon->spDefenseIV; @@ -851,7 +851,7 @@ static void SetLinkPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); } @@ -905,7 +905,7 @@ static void SetLinkPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_EV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); @@ -935,7 +935,7 @@ static void SetLinkPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); break; @@ -949,7 +949,7 @@ static void SetLinkPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_IV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); @@ -982,7 +982,7 @@ static void SetLinkPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index cbf924235..e6c32adb5 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1661,7 +1661,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); @@ -1671,7 +1671,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); @@ -1756,7 +1756,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); size = 1; break; case REQUEST_SPATK_EV_BATTLE: @@ -1795,7 +1795,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); size = 6; @@ -1813,7 +1813,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); size = 1; break; case REQUEST_SPATK_IV_BATTLE: @@ -1875,7 +1875,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) size = 2; break; case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); dst[0] = data16; dst[1] = data16 >> 8; size = 2; @@ -2006,7 +2006,7 @@ static void SetPlayerMonData(u8 monId) iv = battlePokemon->defenseIV; SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); iv = battlePokemon->spAttackIV; SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); iv = battlePokemon->spDefenseIV; @@ -2018,7 +2018,7 @@ static void SetPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); } @@ -2072,7 +2072,7 @@ static void SetPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_EV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); @@ -2102,7 +2102,7 @@ static void SetPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); break; @@ -2116,7 +2116,7 @@ static void SetPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_IV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); @@ -2149,7 +2149,7 @@ static void SetPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 82f358921..34ac92e74 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -690,7 +690,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); @@ -700,7 +700,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); @@ -785,7 +785,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); size = 1; break; case REQUEST_SPATK_EV_BATTLE: @@ -824,7 +824,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); size = 6; @@ -842,7 +842,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); size = 1; break; case REQUEST_SPATK_IV_BATTLE: @@ -904,7 +904,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) size = 2; break; case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); dst[0] = data16; dst[1] = data16 >> 8; size = 2; @@ -1026,7 +1026,7 @@ static void SetPlayerPartnerMonData(u8 monId) iv = battlePokemon->defenseIV; SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); iv = battlePokemon->spAttackIV; SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); iv = battlePokemon->spDefenseIV; @@ -1038,7 +1038,7 @@ static void SetPlayerPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); } @@ -1092,7 +1092,7 @@ static void SetPlayerPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_EV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); @@ -1122,7 +1122,7 @@ static void SetPlayerPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); break; @@ -1136,7 +1136,7 @@ static void SetPlayerPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_IV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); @@ -1169,7 +1169,7 @@ static void SetPlayerPartnerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 429edf9f7..605268f13 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -588,7 +588,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); @@ -598,7 +598,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); @@ -683,7 +683,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); size = 1; break; case REQUEST_SPATK_EV_BATTLE: @@ -722,7 +722,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); size = 6; @@ -740,7 +740,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) size = 1; break; case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); size = 1; break; case REQUEST_SPATK_IV_BATTLE: @@ -802,7 +802,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) size = 2; break; case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); dst[0] = data16; dst[1] = data16 >> 8; size = 2; @@ -924,7 +924,7 @@ static void SetRecordedPlayerMonData(u8 monId) iv = battlePokemon->defenseIV; SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); iv = battlePokemon->spAttackIV; SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); iv = battlePokemon->spDefenseIV; @@ -936,7 +936,7 @@ static void SetRecordedPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); } @@ -990,7 +990,7 @@ static void SetRecordedPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_EV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); @@ -1020,7 +1020,7 @@ static void SetRecordedPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); break; @@ -1034,7 +1034,7 @@ static void SetRecordedPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_IV_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); @@ -1067,7 +1067,7 @@ static void SetRecordedPlayerMonData(u8 monId) SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); break; case REQUEST_SPATK_BATTLE: SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); diff --git a/src/pokemon_1.c b/src/pokemon_1.c index 79fa15343..f56ade967 100644 --- a/src/pokemon_1.c +++ b/src/pokemon_1.c @@ -305,7 +305,7 @@ void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src) SetMonData(mon, MON_DATA_HP_EV, &src->hpEV); SetMonData(mon, MON_DATA_ATK_EV, &src->attackEV); SetMonData(mon, MON_DATA_DEF_EV, &src->defenseEV); - SetMonData(mon, MON_DATA_SPD_EV, &src->speedEV); + SetMonData(mon, MON_DATA_SPEED_EV, &src->speedEV); SetMonData(mon, MON_DATA_SPATK_EV, &src->spAttackEV); SetMonData(mon, MON_DATA_SPDEF_EV, &src->spDefenseEV); value = src->altAbility; @@ -369,7 +369,7 @@ void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lv SetMonData(mon, MON_DATA_HP_EV, &src->hpEV); SetMonData(mon, MON_DATA_ATK_EV, &src->attackEV); SetMonData(mon, MON_DATA_DEF_EV, &src->defenseEV); - SetMonData(mon, MON_DATA_SPD_EV, &src->speedEV); + SetMonData(mon, MON_DATA_SPEED_EV, &src->speedEV); SetMonData(mon, MON_DATA_SPATK_EV, &src->spAttackEV); SetMonData(mon, MON_DATA_SPDEF_EV, &src->spDefenseEV); value = src->altAbility; diff --git a/src/pokemon_2.c b/src/pokemon_2.c index 7a1f51b1c..b0ec7460d 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -513,7 +513,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) case MON_DATA_DEF_EV: retVal = substruct2->defenseEV; break; - case MON_DATA_SPD_EV: + case MON_DATA_SPEED_EV: retVal = substruct2->speedEV; break; case MON_DATA_SPATK_EV: @@ -881,7 +881,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_DEF_EV: SET8(substruct2->defenseEV); break; - case MON_DATA_SPD_EV: + case MON_DATA_SPEED_EV: SET8(substruct2->speedEV); break; case MON_DATA_SPATK_EV: From 3ece244246cbd8aa689f3e471bb0e1cb1cf0d8f7 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 24 Oct 2017 21:45:41 +0200 Subject: [PATCH 15/29] wally controller is done --- asm/battle_controller_wally.s | 4755 --------------------------------- include/battle.h | 8 +- include/party_menu.h | 1 + ld_script.txt | 1 - src/battle_controller_wally.c | 1606 ++++++++++- 5 files changed, 1538 insertions(+), 4833 deletions(-) delete mode 100644 asm/battle_controller_wally.s diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s deleted file mode 100644 index 10b6d30be..000000000 --- a/asm/battle_controller_wally.s +++ /dev/null @@ -1,4755 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start WallyBufferRunCommand -WallyBufferRunCommand: @ 81683F4 - 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 _08168440 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0816843C - ldr r0, =gWallyBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _08168440 - .pool -_0816843C: - bl WallyBufferExecCompleted -_08168440: - pop {r0} - bx r0 - thumb_func_end WallyBufferRunCommand - - thumb_func_start sub_8168444 -sub_8168444: @ 8168444 - push {r4,r5,lr} - ldr r1, =gBattleStruct - ldr r0, [r1] - adds r0, 0x94 - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x5 - bls _08168456 - b _08168564 -_08168456: - lsls r0, 2 - ldr r1, =_08168468 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08168468: - .4byte _08168480 - .4byte _08168492 - .4byte _081684B0 - .4byte _081684CE - .4byte _08168508 - .4byte _08168540 -_08168480: - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08168492: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0 - b _081684E4 -_081684B0: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0 - b _081684E4 -_081684CE: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x1 - movs r1, 0x9 -_081684E4: - movs r2, 0 - bl EmitTwoReturnValues - bl WallyBufferExecCompleted - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x95 - strb r5, [r0] - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - b _08168564 -_08168508: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl ActionSelectionDestroyCursorAt - movs r0, 0x1 - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08168564 -_08168540: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl EmitTwoReturnValues - bl WallyBufferExecCompleted -_08168564: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8168444 - - thumb_func_start sub_816856C -sub_816856C: @ 816856C - 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 _08168590 - bl WallyBufferExecCompleted -_08168590: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816856C - - thumb_func_start sub_81685A4 -sub_81685A4: @ 81685A4 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081685B6 - bl WallyBufferExecCompleted -_081685B6: - pop {r0} - bx r0 - thumb_func_end sub_81685A4 - - thumb_func_start bx_wait_t5 -bx_wait_t5: @ 81685BC - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - bne _081685CA - bl WallyBufferExecCompleted -_081685CA: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t5 - - thumb_func_start sub_81685D4 -sub_81685D4: @ 81685D4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081685FC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168610 - str r1, [r0] - bl nullsub_35 - bl FreeAllWindowBuffers - bl DoWallyTutorialBagMenu -_081685FC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81685D4 - - thumb_func_start sub_8168610 -sub_8168610: @ 8168610 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _08168636 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08168636 - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitOneReturnValue - bl WallyBufferExecCompleted -_08168636: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168610 - - thumb_func_start sub_816864C -sub_816864C: @ 816864C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - 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 r7, 0x88 - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - bne _08168684 - 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 -_08168684: - ldr r1, [r4] - ldrb r0, [r5] - 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, r7, 0 - ands r0, r1 - cmp r0, 0 - bne _081686B6 - 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 -_081686B6: - ldr r0, [r4] - ldrb r2, [r5] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - movs r4, 0x8 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _081686D2 - b _081687DC -_081686D2: - adds r1, r2, 0 - eors r1, r6 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _081687DC - ldr r0, =gSprites - mov r8, r0 - ldr r7, =gUnknown_03005D7C - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r4, r8 - adds r4, 0x1C - adds r0, r4 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _081687DC - ldr r0, =gBankSpriteIds - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r3 - bne _081687DC - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0816877A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0816877A - ldrb r0, [r5] - eors r0, r6 - adds r0, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r0, [r5] - 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, [r5] - eors r0, r6 - bl sub_8076918 - ldrb r0, [r5] - eors r0, r6 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0816877A: - 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 r5, =gHealthBoxesIds - 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 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168818 - str r1, [r0] -_081687DC: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816864C - - thumb_func_start sub_8168818 -sub_8168818: @ 8168818 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r4, 0 - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r1, =gActiveBank - mov r8, r1 - ldrb r3, [r1] - adds r0, r3, r0 - 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 _08168842 - movs r4, 0x1 -_08168842: - cmp r4, 0 - beq _08168904 - ldr r7, =gBattleSpritesDataPtr - ldr r0, [r7] - ldr r4, [r0, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r2, r0, r4 - ldrb r1, [r2, 0x1] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08168904 - movs r6, 0x2 - adds r1, r6, 0 - eors r1, r3 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08168904 - ldrb r1, [r2] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r7] - mov r1, r8 - ldrb r2, [r1] - 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] - ldr r2, [r7] - mov r1, r8 - ldrb r0, [r1] - adds r1, r6, 0 - 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] - ldr r2, [r7] - mov r1, r8 - ldrb r0, [r1] - adds r1, r6, 0 - 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 r0, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r2, =gBattlePartyID - mov r0, r8 - ldrb r1, [r0] - 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 WallyBufferExecCompleted -_08168904: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168818 - - thumb_func_start sub_8168934 -sub_8168934: @ 8168934 - 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 _0816897C - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08168996 - .pool -_0816897C: - 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 WallyBufferExecCompleted -_08168996: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168934 - - thumb_func_start bx_blink_t5 -bx_blink_t5: @ 81689A4 - 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 _081689F0 - 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 WallyBufferExecCompleted - b _08168A1A - .pool -_081689F0: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08168A14 - 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] -_08168A14: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08168A1A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t5 - - thumb_func_start sub_8168A20 -sub_8168A20: @ 8168A20 - 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 _08168A74 - 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 WallyBufferExecCompleted -_08168A74: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168A20 - - thumb_func_start sub_8168A90 -sub_8168A90: @ 8168A90 - 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 _08168AB4 - bl WallyBufferExecCompleted -_08168AB4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168A90 - - thumb_func_start sub_8168AC8 -sub_8168AC8: @ 8168AC8 - 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 _08168AEA - bl WallyBufferExecCompleted -_08168AEA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168AC8 - - thumb_func_start WallyBufferExecCompleted -WallyBufferExecCompleted: @ 8168AF8 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =WallyBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08168B4C - 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 _08168B5E - .pool -_08168B4C: - 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] -_08168B5E: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyBufferExecCompleted - - thumb_func_start sub_8168B70 -sub_8168B70: @ 8168B70 - 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 _08168B92 - bl WallyBufferExecCompleted -_08168B92: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168B70 - - thumb_func_start WallyHandleGetMonData -WallyHandleGetMonData: @ 8168BA0 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08168BD8 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_8168C14 - adds r6, r0, 0 - b _08168BFA - .pool -_08168BD8: - ldrb r4, [r1] - movs r5, 0 -_08168BDC: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08168BF2 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_8168C14 - adds r6, r0 -_08168BF2: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08168BDC -_08168BFA: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl WallyBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end WallyHandleGetMonData - - thumb_func_start sub_8168C14 -sub_8168C14: @ 8168C14 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _08168C3E - bl _081693AA -_08168C3E: - lsls r0, 2 - ldr r1, =_08168C54 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08168C54: - .4byte _08168D44 - .4byte _08168F68 - .4byte _08168F78 - .4byte _08168F88 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _0816900C - .4byte _08169048 - .4byte _08169048 - .4byte _08169048 - .4byte _08169048 - .4byte _081693AA - .4byte _081693AA - .4byte _081693AA - .4byte _081693AA - .4byte _08169064 - .4byte _08169074 - .4byte _081690A4 - .4byte _081690B4 - .4byte _081690C4 - .4byte _081690D4 - .4byte _081690E4 - .4byte _081690F4 - .4byte _08169104 - .4byte _08169114 - .4byte _08169124 - .4byte _08169134 - .4byte _08169144 - .4byte _08169154 - .4byte _08169164 - .4byte _081691B4 - .4byte _081691C4 - .4byte _081691D4 - .4byte _081691E4 - .4byte _081691F4 - .4byte _08169204 - .4byte _08169214 - .4byte _08169224 - .4byte _08169234 - .4byte _08169268 - .4byte _08169278 - .4byte _08169288 - .4byte _08169298 - .4byte _081692A8 - .4byte _081692B8 - .4byte _081692C8 - .4byte _081692D8 - .4byte _081692F8 - .4byte _08169308 - .4byte _08169318 - .4byte _08169328 - .4byte _08169338 - .4byte _08169348 - .4byte _08169358 - .4byte _08169368 - .4byte _08169378 - .4byte _08169388 - .4byte _08169398 -_08168D44: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08168D90: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08168D90 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_08168F48: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _08168F48 - b _081693AA - .pool -_08168F68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _081692E2 - .pool -_08168F78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _081692E2 - .pool -_08168F88: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_08168F9E: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _08168F9E - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_08168FDC: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _08168FDC - b _081693AA - .pool -_08168FF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _081692E2 - .pool -_0816900C: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_08169018: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _08169018 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _081693AA - .pool -_08169048: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _081693A2 - .pool -_08169064: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0816907E - .pool -_08169074: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0816907E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _081693AA - .pool -_081690A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _081693A2 - .pool -_081690B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _081693A2 - .pool -_081690C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _081693A2 - .pool -_081690D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _081693A2 - .pool -_081690E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _081693A2 - .pool -_081690F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _081693A2 - .pool -_08169104: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _081693A2 - .pool -_08169114: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _081693A2 - .pool -_08169124: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _081693A2 - .pool -_08169134: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _081693A2 - .pool -_08169144: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _081693A2 - .pool -_08169154: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _081693A2 - .pool -_08169164: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _081693AA - .pool -_081691B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _081693A2 - .pool -_081691C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _081693A2 - .pool -_081691D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _081693A2 - .pool -_081691E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _081693A2 - .pool -_081691F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _081693A2 - .pool -_08169204: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _081693A2 - .pool -_08169214: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0816923E - .pool -_08169224: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _081692E2 - .pool -_08169234: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0816923E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _081693AA - .pool -_08169268: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _081693A2 - .pool -_08169278: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _081692E2 - .pool -_08169288: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _081692E2 - .pool -_08169298: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _081692E2 - .pool -_081692A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _081692E2 - .pool -_081692B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _081692E2 - .pool -_081692C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _081692E2 - .pool -_081692D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_081692E2: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _081693AA - .pool -_081692F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _081693A2 - .pool -_08169308: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _081693A2 - .pool -_08169318: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _081693A2 - .pool -_08169328: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _081693A2 - .pool -_08169338: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _081693A2 - .pool -_08169348: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _081693A2 - .pool -_08169358: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _081693A2 - .pool -_08169368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _081693A2 - .pool -_08169378: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _081693A2 - .pool -_08169388: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _081693A2 - .pool -_08169398: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_081693A2: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_081693AA: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8168C14 - - thumb_func_start WallyHandleGetRawMonData -WallyHandleGetRawMonData: @ 81693C0 - push {lr} - bl PlayerHandleGetRawMonData - pop {r0} - bx r0 - thumb_func_end WallyHandleGetRawMonData - - thumb_func_start WallyHandleSetMonData -WallyHandleSetMonData: @ 81693CC - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _081693FC - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_8169424 - b _0816941A - .pool -_081693FC: - ldrb r4, [r1] - movs r5, 0 -_08169400: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0816940E - adds r0, r5, 0 - bl sub_8169424 -_0816940E: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08169400 -_0816941A: - bl WallyBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end WallyHandleSetMonData - - thumb_func_start sub_8169424 -sub_8169424: @ 8169424 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _08169450 - bl _08169DEA -_08169450: - lsls r0, 2 - ldr r1, =_08169468 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08169468: - .4byte _08169558 - .4byte _081696F0 - .4byte _08169710 - .4byte _08169730 - .4byte _08169788 - .4byte _08169788 - .4byte _08169788 - .4byte _08169788 - .4byte _081697B0 - .4byte _08169814 - .4byte _08169814 - .4byte _08169814 - .4byte _08169814 - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169844 - .4byte _08169864 - .4byte _08169884 - .4byte _081698A4 - .4byte _081698C4 - .4byte _081698E4 - .4byte _08169904 - .4byte _08169924 - .4byte _08169944 - .4byte _08169964 - .4byte _08169984 - .4byte _081699A4 - .4byte _081699C4 - .4byte _081699E4 - .4byte _08169A04 - .4byte _08169A74 - .4byte _08169A94 - .4byte _08169AB4 - .4byte _08169AD4 - .4byte _08169AF4 - .4byte _08169B14 - .4byte _08169B34 - .4byte _08169B54 - .4byte _08169B74 - .4byte _08169B94 - .4byte _08169BB4 - .4byte _08169BD4 - .4byte _08169BF4 - .4byte _08169C14 - .4byte _08169C34 - .4byte _08169C54 - .4byte _08169C74 - .4byte _08169C94 - .4byte _08169CB4 - .4byte _08169CD4 - .4byte _08169CF4 - .4byte _08169D14 - .4byte _08169D34 - .4byte _08169D54 - .4byte _08169D74 - .4byte _08169D94 - .4byte _08169DB4 - .4byte _08169DD4 -_08169558: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_081695BE: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _081695BE - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _08169DEA - .pool -_081696F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _08169DEA - .pool -_08169710: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _08169DEA - .pool -_08169730: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0816974A: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0816974A - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _08169DEA - .pool -_08169788: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0816982C - .pool -_081697B0: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _08169DEA - .pool -_08169814: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0816982C: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _08169DEA - .pool -_08169844: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _08169DEA - .pool -_08169864: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _08169DEA - .pool -_08169884: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _08169DEA - .pool -_081698A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _08169DEA - .pool -_081698C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _08169DEA - .pool -_081698E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _08169DEA - .pool -_08169904: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _08169DEA - .pool -_08169924: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _08169DEA - .pool -_08169944: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _08169DEA - .pool -_08169964: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _08169DEA - .pool -_08169984: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _08169DEA - .pool -_081699A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _08169DEA - .pool -_081699C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _08169DEA - .pool -_081699E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _08169DEA - .pool -_08169A04: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08169B24 - .pool -_08169A74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _08169DEA - .pool -_08169A94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _08169DEA - .pool -_08169AB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _08169DEA - .pool -_08169AD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _08169DEA - .pool -_08169AF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _08169DEA - .pool -_08169B14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_08169B24: - movs r1, 0x2C - bl SetMonData - b _08169DEA - .pool -_08169B34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _08169DEA - .pool -_08169B54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _08169DEA - .pool -_08169B74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _08169DEA - .pool -_08169B94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _08169DEA - .pool -_08169BB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _08169DEA - .pool -_08169BD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _08169DEA - .pool -_08169BF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _08169DEA - .pool -_08169C14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _08169DEA - .pool -_08169C34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _08169DEA - .pool -_08169C54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _08169DEA - .pool -_08169C74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _08169DEA - .pool -_08169C94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _08169DEA - .pool -_08169CB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _08169DEA - .pool -_08169CD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _08169DEA - .pool -_08169CF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _08169DEA - .pool -_08169D14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _08169DEA - .pool -_08169D34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _08169DEA - .pool -_08169D54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _08169DEA - .pool -_08169D74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _08169DEA - .pool -_08169D94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _08169DEA - .pool -_08169DB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _08169DEA - .pool -_08169DD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_08169DEA: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - 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 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8169424 - - thumb_func_start WallyHandleSetRawMonData -WallyHandleSetRawMonData: @ 8169E20 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleSetRawMonData - - thumb_func_start WallyHandleLoadMonSprite -WallyHandleLoadMonSprite: @ 8169E2C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleLoadMonSprite - - thumb_func_start WallyHandleSwitchInAnim -WallyHandleSwitchInAnim: @ 8169E38 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleSwitchInAnim - - thumb_func_start WallyHandleReturnMonToBall -WallyHandleReturnMonToBall: @ 8169E44 - push {r4-r6,lr} - ldr r0, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - bne _08169E80 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl DoSpecialBattleAnimation - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8168A20 - str r0, [r1] - b _08169EB6 - .pool -_08169E80: - 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 WallyBufferExecCompleted -_08169EB6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleReturnMonToBall - - thumb_func_start WallyHandleDrawTrainerPic -WallyHandleDrawTrainerPic: @ 8169EC8 - push {r4-r6,lr} - ldr r4, =gActiveBank - ldrb r1, [r4] - movs r0, 0x6 - bl DecompressTrainerBackPic - ldrb r0, [r4] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x6 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - ldrb r1, [r1, 0x18] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r4] - adds r1, r6 - strb r0, [r1] - ldr r5, =gSprites - ldrb r3, [r4] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, 0x1C - adds r0, r5 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816856C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleDrawTrainerPic - - thumb_func_start WallyHandleTrainerSlide -WallyHandleTrainerSlide: @ 8169F94 - push {r4-r6,lr} - ldr r4, =gActiveBank - ldrb r1, [r4] - movs r0, 0x6 - bl DecompressTrainerBackPic - ldrb r0, [r4] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x6 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - ldrb r1, [r1, 0x18] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r4] - adds r1, r6 - strb r0, [r1] - ldr r5, =gSprites - ldrb r3, [r4] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffa0 - strh r1, [r0, 0x24] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, 0x1C - adds r0, r5 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168A90 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleTrainerSlide - - thumb_func_start WallyHandleTrainerSlideBack -WallyHandleTrainerSlideBack: @ 816A060 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleTrainerSlideBack - - thumb_func_start WallyHandleFaintAnimation -WallyHandleFaintAnimation: @ 816A06C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleFaintAnimation - - thumb_func_start WallyHandleCmd11 -WallyHandleCmd11: @ 816A078 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd11 - - thumb_func_start WallyHandleCmd12 -WallyHandleCmd12: @ 816A084 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t5 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleCmd12 - - thumb_func_start WallyHandleBallThrow -WallyHandleBallThrow: @ 816A0D8 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t5 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleBallThrow - - thumb_func_start WallyHandlePause -WallyHandlePause: @ 816A138 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandlePause - - thumb_func_start WallyHandleMoveAnimation -WallyHandleMoveAnimation: @ 816A144 - push {r4-r6,lr} - ldr r0, =gBattleBufferA - mov r12, r0 - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gTransformedPersonalities - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0816A23C - bl WallyBufferExecCompleted - b _0816A25A - .pool -_0816A23C: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_5 - str r1, [r0] -_0816A25A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleMoveAnimation - - thumb_func_start bx_move_anim_5 -bx_move_anim_5: @ 816A26C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r9, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r2, 0x2 - mov r8, r2 - add r1, r8 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0816A2F6 - cmp r2, 0x1 - bgt _0816A2BC - cmp r2, 0 - beq _0816A2C6 - b _0816A3AC - .pool -_0816A2BC: - cmp r2, 0x2 - beq _0816A320 - cmp r2, 0x3 - beq _0816A370 - b _0816A3AC -_0816A2C6: - ldr r1, [r5] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0816A2E2 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0816A2E2: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0816A3AC -_0816A2F6: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0816A3AC - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0816A3AC -_0816A320: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0816A3AC - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _0816A354 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_0816A354: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0816A3AC - .pool -_0816A370: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0816A3AC - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r9 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r8 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl WallyBufferExecCompleted -_0816A3AC: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_5 - - thumb_func_start WallyHandlePrintString -WallyHandlePrintString: @ 816A3B8 - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81685A4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandlePrintString - - thumb_func_start WallyHandlePrintStringPlayerOnly -WallyHandlePrintStringPlayerOnly: @ 816A40C - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0816A428 - bl WallyHandlePrintString - b _0816A42C - .pool -_0816A428: - bl WallyBufferExecCompleted -_0816A42C: - pop {r0} - bx r0 - thumb_func_end WallyHandlePrintStringPlayerOnly - - thumb_func_start sub_816A430 -sub_816A430: @ 816A430 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0816A456 - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168444 - str r1, [r0] -_0816A456: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A430 - - thumb_func_start WallyHandleChooseAction -WallyHandleChooseAction: @ 816A470 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816A430 - str r1, [r0] - ldr r0, =gText_BattleMenu - movs r1, 0x2 - bl BattleHandleAddTextPrinter - movs r4, 0 -_0816A48A: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _0816A48A - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillWallyDo - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl BattleHandleAddTextPrinter - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleChooseAction - - thumb_func_start WallyHandleCmd19 -WallyHandleCmd19: @ 816A4D8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd19 - - thumb_func_start WallyHandleChooseMove -WallyHandleChooseMove: @ 816A4E4 - push {r4,lr} - ldr r4, =gBattleStruct - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x95 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0816A522 - cmp r0, 0x1 - bgt _0816A504 - cmp r0, 0 - beq _0816A50A - b _0816A574 - .pool -_0816A504: - cmp r0, 0x2 - beq _0816A550 - b _0816A574 -_0816A50A: - bl InitMoveSelectionsVarsAndStrings - ldr r1, [r4] - adds r1, 0x95 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x97 - movs r1, 0x50 - strb r1, [r0] - b _0816A574 -_0816A522: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0816A574 - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, [r4] - adds r1, 0x95 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0816A574 - .pool -_0816A550: - adds r1, 0x97 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _0816A574 - movs r0, 0x5 - bl PlaySE - movs r2, 0x80 - lsls r2, 1 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues - bl WallyBufferExecCompleted -_0816A574: - pop {r4} - pop {r0} - bx r0 - thumb_func_end WallyHandleChooseMove - - thumb_func_start WallyHandleOpenBag -WallyHandleOpenBag: @ 816A57C - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81685D4 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleOpenBag - - thumb_func_start WallyHandleChoosePokemon -WallyHandleChoosePokemon: @ 816A5BC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleChoosePokemon - - thumb_func_start WallyHandleCmd23 -WallyHandleCmd23: @ 816A5C8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd23 - - thumb_func_start WallyHandleHealthBarUpdate -WallyHandleHealthBarUpdate: @ 816A5D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _0816A664 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0816A69E - .pool -_0816A664: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r4, =gHealthBoxesIds - adds r1, r0, r4 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct - mov r1, r9 - ldrb r0, [r1] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0 - bl UpdateHpTextInHealthbox -_0816A69E: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168934 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleHealthBarUpdate - - thumb_func_start WallyHandleExpUpdate -WallyHandleExpUpdate: @ 816A6D4 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleExpUpdate - - thumb_func_start WallyHandleStatusIconUpdate -WallyHandleStatusIconUpdate: @ 816A6E0 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleStatusIconUpdate - - thumb_func_start WallyHandleStatusAnimation -WallyHandleStatusAnimation: @ 816A6EC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleStatusAnimation - - thumb_func_start WallyHandleStatusXor -WallyHandleStatusXor: @ 816A6F8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleStatusXor - - thumb_func_start WallyHandleDataTransfer -WallyHandleDataTransfer: @ 816A704 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleDataTransfer - - thumb_func_start WallyHandleDMA3Transfer -WallyHandleDMA3Transfer: @ 816A710 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleDMA3Transfer - - thumb_func_start WallyHandlePlayBGM -WallyHandlePlayBGM: @ 816A71C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandlePlayBGM - - thumb_func_start WallyHandleCmd32 -WallyHandleCmd32: @ 816A728 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd32 - - thumb_func_start WallyHandleCmd33 -WallyHandleCmd33: @ 816A734 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd33 - - thumb_func_start WallyHandleCmd34 -WallyHandleCmd34: @ 816A740 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd34 - - thumb_func_start WallyHandleCmd35 -WallyHandleCmd35: @ 816A74C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd35 - - thumb_func_start WallyHandleCmd36 -WallyHandleCmd36: @ 816A758 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd36 - - thumb_func_start WallyHandleCmd37 -WallyHandleCmd37: @ 816A764 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd37 - - thumb_func_start WallyHandleCmd38 -WallyHandleCmd38: @ 816A770 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd38 - - thumb_func_start WallyHandleCmd39 -WallyHandleCmd39: @ 816A77C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd39 - - thumb_func_start WallyHandleCmd40 -WallyHandleCmd40: @ 816A788 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd40 - - thumb_func_start WallyHandleHitAnimation -WallyHandleHitAnimation: @ 816A794 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0816A7C8 - bl WallyBufferExecCompleted - b _0816A7F2 - .pool -_0816A7C8: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t5 - str r1, [r0] -_0816A7F2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleHitAnimation - - thumb_func_start WallyHandleCmd42 -WallyHandleCmd42: @ 816A804 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd42 - - thumb_func_start WallyHandleEffectivenessSound -WallyHandleEffectivenessSound: @ 816A810 - push {lr} - ldr r2, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlaySE - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleEffectivenessSound - - thumb_func_start WallyHandlePlayFanfareOrBGM -WallyHandlePlayFanfareOrBGM: @ 816A840 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0816A87C - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0816A890 - .pool -_0816A87C: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0816A890: - bl WallyBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end WallyHandlePlayFanfareOrBGM - - thumb_func_start WallyHandleFaintingCry -WallyHandleFaintingCry: @ 816A89C - push {lr} - 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, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - bl PlayCry1 - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleFaintingCry - - thumb_func_start WallyHandleIntroSlide -WallyHandleIntroSlide: @ 816A8D8 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleIntroSlide - - thumb_func_start WallyHandleIntroTrainerBallThrow -WallyHandleIntroTrainerBallThrow: @ 816A90C - push {r4-r7,lr} - ldr r6, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r7] - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x38] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f8 - bl AllocSpritePalette - adds r4, r0, 0 - lsls r4, 24 - ldr r0, =gTrainerBackPicPaletteTable - ldr r0, [r0, 0x30] - lsrs r4, 20 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldrb r0, [r7] - adds r0, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_816AC04 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r7] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816AA24 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0816AA24: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleIntroTrainerBallThrow - - thumb_func_start sub_816AA80 -sub_816AA80: @ 816AA80 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r6, 2 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x2] - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AA80 - - thumb_func_start sub_816AC04 -sub_816AC04: @ 816AC04 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x1E - bgt _0816AC28 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0816AC5E - .pool -_0816AC28: - ldr r4, =gActiveBank - ldrb r5, [r4] - ldrh r0, [r1, 0x8] - strb r0, [r4] - ldr r0, =gBattleBufferA - ldrb r1, [r4] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r4] - bl sub_816AA80 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816864C - str r1, [r0] - strb r5, [r4] - adds r0, r6, 0 - bl DestroyTask -_0816AC5E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AC04 - - thumb_func_start WallyHandleDrawPartyStatusSummary -WallyHandleDrawPartyStatusSummary: @ 816AC78 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0816ACA8 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0816ACA8 - bl WallyBufferExecCompleted - b _0816ACE6 - .pool -_0816ACA8: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r4, r0, 9 - ldr r3, =gBattleBufferA + 4 - adds r1, r4, r3 - subs r2, r3, 0x3 - adds r2, r4, r2 - ldrb r2, [r2] - subs r3, 0x2 - adds r4, r3 - ldrb r3, [r4] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - strb r0, [r1] - bl WallyBufferExecCompleted -_0816ACE6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleDrawPartyStatusSummary - - thumb_func_start WallyHandleCmd49 -WallyHandleCmd49: @ 816ACFC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd49 - - thumb_func_start WallyHandleCmd50 -WallyHandleCmd50: @ 816AD08 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd50 - - thumb_func_start WallyHandleSpriteInvisibility -WallyHandleSpriteInvisibility: @ 816AD14 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleSpriteInvisibility - - thumb_func_start WallyHandleBattleAnimation -WallyHandleBattleAnimation: @ 816AD20 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _0816AD60 - bl WallyBufferExecCompleted - b _0816AD6C - .pool -_0816AD60: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8168AC8 - str r0, [r1] -_0816AD6C: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleBattleAnimation - - thumb_func_start WallyHandleLinkStandbyMsg -WallyHandleLinkStandbyMsg: @ 816AD7C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleLinkStandbyMsg - - thumb_func_start WallyHandleResetActionMoveSelection -WallyHandleResetActionMoveSelection: @ 816AD88 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleResetActionMoveSelection - - thumb_func_start WallyHandleCmd55 -WallyHandleCmd55: @ 816AD94 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl WallyBufferExecCompleted - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _0816ADD0 - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_80587B0 - str r0, [r1] -_0816ADD0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleCmd55 - - thumb_func_start nullsub_118 -nullsub_118: @ 816ADF0 - bx lr - thumb_func_end nullsub_118 - - - .align 2, 0 @ Don't pad with nop. diff --git a/include/battle.h b/include/battle.h index e4f3ea77d..5bb05755b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -636,10 +636,10 @@ struct BattleStruct u8 field_91; u8 field_92; u8 field_93; - u8 field_94; - u8 field_95; - u8 field_96; - u8 field_97; + u8 wallyBattleState; + u8 wallyMovesState; + u8 wallyWaitFrames; + u8 wallyMoveFrames; u8 mirrorMoves[8]; // ask gamefreak why they declared it that way u8 field_A0; u8 field_A1; diff --git a/include/party_menu.h b/include/party_menu.h index 175aba639..c93f63a6d 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -2,5 +2,6 @@ #define GUARD_PARTY_MENU_H bool8 pokemon_has_move(struct Pokemon *, u16); +void DoWallyTutorialBagMenu(void); #endif // GUARD_PARTY_MENU_H diff --git a/ld_script.txt b/ld_script.txt index cf07574d2..6d0db8ab9 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -210,7 +210,6 @@ SECTIONS { 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); src/reset_save_heap.o(.text); diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index ce38ca882..5e454deb5 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -4,75 +4,139 @@ #include "battle_message.h" #include "battle_interface.h" #include "battle_anim.h" +#include "battle_link_817C95C.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" +#include "rng.h" +#include "pokeball.h" +#include "party_menu.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 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 u16 gPartnerTrainerId; +extern struct SpriteTemplate gUnknown_0202499C; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gScriptItemId; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u8 gNumberOfMovesToChoose; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern s32 gUnknown_0203CD70; +extern u8 gBankInMenu; +extern u32 gBattlePalaceMoveSelectionRngValue; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u8 gUnknown_020244B4[]; +extern u16 gUnknown_020243FC; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; + +extern const u8 gText_WhatWillWallyDo[]; +extern const u8 gText_BattleMenu[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); // 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); +static void WallyHandleGetMonData(void); +static void WallyHandleGetRawMonData(void); +static void WallyHandleSetMonData(void); +static void WallyHandleSetRawMonData(void); +static void WallyHandleLoadMonSprite(void); +static void WallyHandleSwitchInAnim(void); +static void WallyHandleReturnMonToBall(void); +static void WallyHandleDrawTrainerPic(void); +static void WallyHandleTrainerSlide(void); +static void WallyHandleTrainerSlideBack(void); +static void WallyHandleFaintAnimation(void); +static void WallyHandlePaletteFade(void); +static void WallyHandleSuccessBallThrowAnim(void); +static void WallyHandleBallThrowAnim(void); +static void WallyHandlePause(void); +static void WallyHandleMoveAnimation(void); +static void WallyHandlePrintString(void); +static void WallyHandlePrintStringPlayerOnly(void); +static void WallyHandleChooseAction(void); +static void WallyHandleUnknownYesNoBox(void); +static void WallyHandleChooseMove(void); +static void WallyHandleChooseItem(void); +static void WallyHandleChoosePokemon(void); +static void WallyHandleCmd23(void); +static void WallyHandleHealthBarUpdate(void); +static void WallyHandleExpUpdate(void); +static void WallyHandleStatusIconUpdate(void); +static void WallyHandleStatusAnimation(void); +static void WallyHandleStatusXor(void); +static void WallyHandleDataTransfer(void); +static void WallyHandleDMA3Transfer(void); +static void WallyHandlePlayBGM(void); +static void WallyHandleCmd32(void); +static void WallyHandleTwoReturnValues(void); +static void WallyHandleChosenMonReturnValue(void); +static void WallyHandleOneReturnValue(void); +static void WallyHandleOneReturnValue_Duplicate(void); +static void WallyHandleCmd37(void); +static void WallyHandleCmd38(void); +static void WallyHandleCmd39(void); +static void WallyHandleCmd40(void); +static void WallyHandleHitAnimation(void); +static void WallyHandleCmd42(void); +static void WallyHandleEffectivenessSound(void); +static void WallyHandlePlayFanfareOrBGM(void); +static void WallyHandleFaintingCry(void); +static void WallyHandleIntroSlide(void); +static void WallyHandleIntroTrainerBallThrow(void); +static void WallyHandleDrawPartyStatusSummary(void); +static void WallyHandleCmd49(void); +static void WallyHandleCmd50(void); +static void WallyHandleSpriteInvisibility(void); +static void WallyHandleBattleAnimation(void); +static void WallyHandleLinkStandbyMsg(void); +static void WallyHandleResetActionMoveSelection(void); +static void WallyHandleCmd55(void); +static void nullsub_118(void); -void WallyBufferRunCommand(void); +static void WallyBufferRunCommand(void); +static void WallyBufferExecCompleted(void); +static void CompleteOnChosenItem(void); +static void sub_8168818(void); +static u32 CopyWallyMonData(u8 monId, u8 *dst); +static void SetWallyMonData(u8 monId); +static void WallyDoMoveAnimation(void); +static void sub_816AC04(u8 taskId); -void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { WallyHandleGetMonData, WallyHandleGetRawMonData, @@ -85,17 +149,17 @@ void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = WallyHandleTrainerSlide, WallyHandleTrainerSlideBack, WallyHandleFaintAnimation, - WallyHandleCmd11, - WallyHandleCmd12, - WallyHandleBallThrow, + WallyHandlePaletteFade, + WallyHandleSuccessBallThrowAnim, + WallyHandleBallThrowAnim, WallyHandlePause, WallyHandleMoveAnimation, WallyHandlePrintString, WallyHandlePrintStringPlayerOnly, WallyHandleChooseAction, - WallyHandleCmd19, + WallyHandleUnknownYesNoBox, WallyHandleChooseMove, - WallyHandleOpenBag, + WallyHandleChooseItem, WallyHandleChoosePokemon, WallyHandleCmd23, WallyHandleHealthBarUpdate, @@ -107,10 +171,10 @@ void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = WallyHandleDMA3Transfer, WallyHandlePlayBGM, WallyHandleCmd32, - WallyHandleCmd33, - WallyHandleCmd34, - WallyHandleCmd35, - WallyHandleCmd36, + WallyHandleTwoReturnValues, + WallyHandleChosenMonReturnValue, + WallyHandleOneReturnValue, + WallyHandleOneReturnValue_Duplicate, WallyHandleCmd37, WallyHandleCmd38, WallyHandleCmd39, @@ -133,15 +197,1411 @@ void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = nullsub_118 }; -void nullsub_117(void) +static 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; + gBattleStruct->wallyBattleState = 0; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 0; + gBattleStruct->wallyMoveFrames = 0; +} + +static void WallyBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sWallyBufferCommands)) + sWallyBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + WallyBufferExecCompleted(); + } +} + +static void WallyHandleActions(void) +{ + switch (gBattleStruct->wallyBattleState) + { + case 0: + gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyBattleState++; + case 1: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 2: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 3: + if (--gBattleStruct->wallyWaitFrames == 0) + { + EmitTwoReturnValues(1, 9, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 4: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(0); + ActionSelectionCreateCursorAt(1, 0); + gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyBattleState++; + } + break; + case 5: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + WallyBufferExecCompleted(); + } + break; + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + WallyBufferExecCompleted(); +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + WallyBufferExecCompleted(); +} + +static void CompleteOnFinishedAnimation(void) +{ + if (!gDoingBattleAnim) + WallyBufferExecCompleted(); +} + +static void OpenBagAfterPaletteFade(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = CompleteOnChosenItem; + nullsub_35(); + FreeAllWindowBuffers(); + DoWallyTutorialBagMenu(); + } +} + +static void CompleteOnChosenItem(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitOneReturnValue(1, gScriptItemId); + WallyBufferExecCompleted(); + } +} + +static void sub_816864C(void) +{ + 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 + && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleBankFunc[gActiveBank] = sub_8168818; + } + +} + +static void sub_8168818(void) +{ + bool32 r4 = FALSE; + + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r4 = TRUE; + + if (r4 && 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); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + + WallyBufferExecCompleted(); + } +} + +static void CompleteOnHealthbarDone(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); + WallyBufferExecCompleted(); + } +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + WallyBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_8168A20(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + WallyBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + WallyBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + WallyBufferExecCompleted(); +} + +static void WallyBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = WallyBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + WallyBufferExecCompleted(); +} + +static void WallyHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyWallyMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyWallyMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + WallyBufferExecCompleted(); +} + +static u32 CopyWallyMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void WallyHandleGetRawMonData(void) +{ + PlayerHandleGetRawMonData(); +} + +static void WallyHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetWallyMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetWallyMonData(i); + monsToCheck >>= 1; + } + } + WallyBufferExecCompleted(); +} + +static void SetWallyMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void WallyHandleSetRawMonData(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleLoadMonSprite(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSwitchInAnim(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + gBattleBankFunc[gActiveBank] = sub_8168A20; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + WallyBufferExecCompleted(); + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; + +static void WallyHandleDrawTrainerPic(void) +{ + DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); + sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + 80, + 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void WallyHandleTrainerSlide(void) +{ + DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); + sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + 80, + 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -96; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; +} + +static void WallyHandleTrainerSlideBack(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleFaintAnimation(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandlePaletteFade(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSuccessBallThrowAnim(void) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; +} + +static void WallyHandleBallThrowAnim(void) +{ + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; +} + +static void WallyHandlePause(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + WallyBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = WallyDoMoveAnimation; + } + +} + +static void WallyDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + WallyBufferExecCompleted(); + } + break; + } +} + +static void WallyHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void WallyHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + WallyHandlePrintString(); + else + WallyBufferExecCompleted(); +} + +static void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = WallyHandleActions; + } +} + +static void WallyHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + BattleHandleAddTextPrinter(gText_BattleMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillWallyDo); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +static void WallyHandleUnknownYesNoBox(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleChooseMove(void) +{ + switch (gBattleStruct->wallyMovesState) + { + case 0: + InitMoveSelectionsVarsAndStrings(); + gBattleStruct->wallyMovesState++; + gBattleStruct->wallyMoveFrames = 80; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0x140; + gBattleStruct->wallyMovesState++; + } + break; + case 2: + if (--gBattleStruct->wallyMoveFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, 10, 0x100); + WallyBufferExecCompleted(); + } + break; + } +} + +static void WallyHandleChooseItem(void) +{ + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = OpenBagAfterPaletteFade; + gBankInMenu = gActiveBank; +} + +static void WallyHandleChoosePokemon(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd23(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void WallyHandleExpUpdate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusIconUpdate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusAnimation(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusXor(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleDataTransfer(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleDMA3Transfer(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandlePlayBGM(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd32(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleTwoReturnValues(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleChosenMonReturnValue(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleOneReturnValue(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleOneReturnValue_Duplicate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd37(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd38(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd39(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd40(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + WallyBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void WallyHandleCmd42(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleEffectivenessSound(void) +{ + PlaySE(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + WallyBufferExecCompleted(); +} + +static void WallyHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + WallyBufferExecCompleted(); +} + +static void WallyHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry1(species, 25); + WallyBufferExecCompleted(); +} + +static void WallyHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + WallyBufferExecCompleted(); +} + +static void WallyHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F8); + LoadCompressedPalette(gTrainerBackPicPaletteTable[BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_816AC04, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_21; +} + +static void sub_816AA80(u8 bank) +{ + u16 species; + + gBattleSpritesDataPtr->bankData[bank].transformSpecies = 0; + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void sub_816AC04(u8 taskId) +{ + if (gTasks[taskId].data[1] < 31) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_816AA80(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_816864C; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void WallyHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + WallyBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + WallyBufferExecCompleted(); + } +} + +static void WallyHandleCmd49(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd50(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSpriteInvisibility(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleBattleAnimation(void) +{ + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + WallyBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; +} + +static void WallyHandleLinkStandbyMsg(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleResetActionMoveSelection(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + WallyBufferExecCompleted(); + + if (!(gBattleTypeFlags & BATTLE_TYPE_WILD) && gBattleTypeFlags & BATTLE_TYPE_LINK) + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_118(void) +{ } From 91b010299f13125b0424d13f8e8119c40266df2c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 25 Oct 2017 16:24:17 +0200 Subject: [PATCH 16/29] start recorded opponent controller --- asm/battle_controller_recorded_opponent.s | 389 +++++++++------------ data/battle_controller_recorded_opponent.s | 65 ---- ld_script.txt | 3 +- src/battle_controller_recorded_opponent.c | 208 +++++++++++ 4 files changed, 378 insertions(+), 287 deletions(-) delete mode 100644 data/battle_controller_recorded_opponent.s create mode 100644 src/battle_controller_recorded_opponent.c diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 2a98967c4..847dda4c8 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -5,59 +5,6 @@ .text - thumb_func_start nullsub_70 -nullsub_70: @ 81864E8 - bx lr - thumb_func_end nullsub_70 - - thumb_func_start SetBankFuncToRecordedOpponentBufferRunCommand -SetBankFuncToRecordedOpponentBufferRunCommand: @ 81864EC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedOpponentBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToRecordedOpponentBufferRunCommand - - thumb_func_start RecordedOpponentBufferRunCommand -RecordedOpponentBufferRunCommand: @ 8186508 - 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 _08186554 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _08186550 - ldr r0, =gRecordedOpponentBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _08186554 - .pool -_08186550: - bl RecordedOpponentBufferExecCompleted -_08186554: - pop {r0} - bx r0 - thumb_func_end RecordedOpponentBufferRunCommand - thumb_func_start sub_8186558 sub_8186558: @ 8186558 push {lr} @@ -1506,8 +1453,8 @@ _08187212: .pool thumb_func_end RecordedOpponentBufferExecCompleted - thumb_func_start sub_8187224 -sub_8187224: @ 8187224 + thumb_func_start RecordedOpponentHandleGetMonData +RecordedOpponentHandleGetMonData: @ 8187224 push {r4-r6,lr} sub sp, 0x100 movs r6, 0 @@ -1559,7 +1506,7 @@ _0818727E: pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_8187224 + thumb_func_end RecordedOpponentHandleGetMonData thumb_func_start sub_8187298 sub_8187298: @ 8187298 @@ -2439,16 +2386,16 @@ _08187A2E: .pool thumb_func_end sub_8187298 - thumb_func_start sub_8187A44 -sub_8187A44: @ 8187A44 + thumb_func_start RecordedOpponentHandleGetRawMonData +RecordedOpponentHandleGetRawMonData: @ 8187A44 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8187A44 + thumb_func_end RecordedOpponentHandleGetRawMonData - thumb_func_start sub_8187A50 -sub_8187A50: @ 8187A50 + thumb_func_start RecordedOpponentHandleSetMonData +RecordedOpponentHandleSetMonData: @ 8187A50 push {r4,r5,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -2488,7 +2435,7 @@ _08187A9E: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_8187A50 + thumb_func_end RecordedOpponentHandleSetMonData thumb_func_start dp01_setattr_for_opponent_pokemon dp01_setattr_for_opponent_pokemon: @ 8187AA8 @@ -3475,8 +3422,8 @@ _081883B4: .pool thumb_func_end dp01_setattr_for_opponent_pokemon - thumb_func_start sub_81883C8 -sub_81883C8: @ 81883C8 + thumb_func_start RecordedOpponentHandleSetRawMonData +RecordedOpponentHandleSetRawMonData: @ 81883C8 push {r4-r7,lr} ldr r1, =gBattlePartyID ldr r7, =gActiveBank @@ -3528,10 +3475,10 @@ _08188420: pop {r0} bx r0 .pool - thumb_func_end sub_81883C8 + thumb_func_end RecordedOpponentHandleSetRawMonData - thumb_func_start sub_818843C -sub_818843C: @ 818843C + thumb_func_start RecordedOpponentHandleLoadMonSprite +RecordedOpponentHandleLoadMonSprite: @ 818843C push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -3669,10 +3616,10 @@ sub_818843C: @ 818843C pop {r0} bx r0 .pool - thumb_func_end sub_818843C + thumb_func_end RecordedOpponentHandleLoadMonSprite - thumb_func_start sub_818858C -sub_818858C: @ 818858C + thumb_func_start RecordedOpponentHandleSwitchInAnim +RecordedOpponentHandleSwitchInAnim: @ 818858C push {r4,lr} ldr r1, =gBattlePartyID ldr r4, =gActiveBank @@ -3701,7 +3648,7 @@ sub_818858C: @ 818858C pop {r0} bx r0 .pool - thumb_func_end sub_818858C + thumb_func_end RecordedOpponentHandleSwitchInAnim thumb_func_start sub_81885D8 sub_81885D8: @ 81885D8 @@ -3876,8 +3823,8 @@ sub_81885D8: @ 81885D8 .pool thumb_func_end sub_81885D8 - thumb_func_start sub_8188768 -sub_8188768: @ 8188768 + thumb_func_start RecordedOpponentHandleReturnMonToBall +RecordedOpponentHandleReturnMonToBall: @ 8188768 push {r4-r6,lr} ldr r1, =gBattleBufferA ldr r6, =gActiveBank @@ -3935,7 +3882,7 @@ _081887EC: pop {r0} bx r0 .pool - thumb_func_end sub_8188768 + thumb_func_end RecordedOpponentHandleReturnMonToBall thumb_func_start sub_8188800 sub_8188800: @ 8188800 @@ -4007,8 +3954,8 @@ _0818887E: .pool thumb_func_end sub_8188800 - thumb_func_start sub_818888C -sub_818888C: @ 818888C + thumb_func_start RecordedOpponentHandleDrawTrainerPic +RecordedOpponentHandleDrawTrainerPic: @ 818888C push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -4191,18 +4138,18 @@ _0818892C: pop {r0} bx r0 .pool - thumb_func_end sub_818888C + thumb_func_end RecordedOpponentHandleDrawTrainerPic - thumb_func_start sub_8188A40 -sub_8188A40: @ 8188A40 + thumb_func_start RecordedOpponentHandleTrainerSlide +RecordedOpponentHandleTrainerSlide: @ 8188A40 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188A40 + thumb_func_end RecordedOpponentHandleTrainerSlide - thumb_func_start sub_8188A4C -sub_8188A4C: @ 8188A4C + thumb_func_start RecordedOpponentHandleTrainerSlideBack +RecordedOpponentHandleTrainerSlideBack: @ 8188A4C push {r4-r6,lr} ldr r6, =gBankSpriteIds ldr r4, =gActiveBank @@ -4273,10 +4220,10 @@ sub_8188A4C: @ 8188A4C pop {r0} bx r0 .pool - thumb_func_end sub_8188A4C + thumb_func_end RecordedOpponentHandleTrainerSlideBack - thumb_func_start sub_8188AF8 -sub_8188AF8: @ 8188AF8 + thumb_func_start RecordedOpponentHandleFaintAnimation +RecordedOpponentHandleFaintAnimation: @ 8188AF8 push {r4-r6,lr} ldr r6, =gBattleSpritesDataPtr ldr r4, [r6] @@ -4350,42 +4297,42 @@ _08188B88: pop {r0} bx r0 .pool - thumb_func_end sub_8188AF8 + thumb_func_end RecordedOpponentHandleFaintAnimation - thumb_func_start sub_8188BA4 -sub_8188BA4: @ 8188BA4 + thumb_func_start RecordedOpponentHandlePaletteFade +RecordedOpponentHandlePaletteFade: @ 8188BA4 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188BA4 + thumb_func_end RecordedOpponentHandlePaletteFade - thumb_func_start sub_8188BB0 -sub_8188BB0: @ 8188BB0 + thumb_func_start RecordedOpponentHandleSuccessBallThrowAnim +RecordedOpponentHandleSuccessBallThrowAnim: @ 8188BB0 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188BB0 + thumb_func_end RecordedOpponentHandleSuccessBallThrowAnim - thumb_func_start sub_8188BBC -sub_8188BBC: @ 8188BBC + thumb_func_start RecordedOpponentHandleBallThrowAnim +RecordedOpponentHandleBallThrowAnim: @ 8188BBC push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188BBC + thumb_func_end RecordedOpponentHandleBallThrowAnim - thumb_func_start sub_8188BC8 -sub_8188BC8: @ 8188BC8 + thumb_func_start RecordedOpponentHandlePause +RecordedOpponentHandlePause: @ 8188BC8 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188BC8 + thumb_func_end RecordedOpponentHandlePause - thumb_func_start sub_8188BD4 -sub_8188BD4: @ 8188BD4 + thumb_func_start RecordedOpponentHandleMoveAnimation +RecordedOpponentHandleMoveAnimation: @ 8188BD4 push {r4-r6,lr} ldr r6, =gActiveBank ldrb r0, [r6] @@ -4519,7 +4466,7 @@ _08188CFA: pop {r0} bx r0 .pool - thumb_func_end sub_8188BD4 + thumb_func_end RecordedOpponentHandleMoveAnimation thumb_func_start sub_8188D0C sub_8188D0C: @ 8188D0C @@ -4705,8 +4652,8 @@ _08188E80: bx r0 thumb_func_end sub_8188D0C - thumb_func_start sub_8188E90 -sub_8188E90: @ 8188E90 + thumb_func_start RecordedOpponentHandlePrintString +RecordedOpponentHandlePrintString: @ 8188E90 push {r4,lr} ldr r0, =gBattle_BG0_X movs r1, 0 @@ -4733,18 +4680,18 @@ sub_8188E90: @ 8188E90 pop {r0} bx r0 .pool - thumb_func_end sub_8188E90 + thumb_func_end RecordedOpponentHandlePrintString - thumb_func_start sub_8188EE4 -sub_8188EE4: @ 8188EE4 + thumb_func_start RecordedOpponentHandlePrintStringPlayerOnly +RecordedOpponentHandlePrintStringPlayerOnly: @ 8188EE4 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188EE4 + thumb_func_end RecordedOpponentHandlePrintStringPlayerOnly - thumb_func_start sub_8188EF0 -sub_8188EF0: @ 8188EF0 + thumb_func_start RecordedOpponentHandleChooseAction +RecordedOpponentHandleChooseAction: @ 8188EF0 push {lr} ldr r0, =gActiveBank ldrb r0, [r0] @@ -4759,18 +4706,18 @@ sub_8188EF0: @ 8188EF0 pop {r0} bx r0 .pool - thumb_func_end sub_8188EF0 + thumb_func_end RecordedOpponentHandleChooseAction - thumb_func_start sub_8188F14 -sub_8188F14: @ 8188F14 + thumb_func_start RecordedOpponentHandleUnknownYesNoBox +RecordedOpponentHandleUnknownYesNoBox: @ 8188F14 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188F14 + thumb_func_end RecordedOpponentHandleUnknownYesNoBox - thumb_func_start sub_8188F20 -sub_8188F20: @ 8188F20 + thumb_func_start RecordedOpponentHandleChooseMove +RecordedOpponentHandleChooseMove: @ 8188F20 push {r4,r5,lr} ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -4810,18 +4757,18 @@ _08188F6C: pop {r0} bx r0 .pool - thumb_func_end sub_8188F20 + thumb_func_end RecordedOpponentHandleChooseMove - thumb_func_start sub_8188F7C -sub_8188F7C: @ 8188F7C + thumb_func_start RecordedOpponentHandleChooseItem +RecordedOpponentHandleChooseItem: @ 8188F7C push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188F7C + thumb_func_end RecordedOpponentHandleChooseItem - thumb_func_start sub_8188F88 -sub_8188F88: @ 8188F88 + thumb_func_start RecordedOpponentHandleChoosePokemon +RecordedOpponentHandleChoosePokemon: @ 8188F88 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -4845,18 +4792,18 @@ sub_8188F88: @ 8188F88 pop {r0} bx r0 .pool - thumb_func_end sub_8188F88 + thumb_func_end RecordedOpponentHandleChoosePokemon - thumb_func_start sub_8188FC4 -sub_8188FC4: @ 8188FC4 + thumb_func_start RecordedOpponentHandleCmd23 +RecordedOpponentHandleCmd23: @ 8188FC4 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8188FC4 + thumb_func_end RecordedOpponentHandleCmd23 - thumb_func_start sub_8188FD0 -sub_8188FD0: @ 8188FD0 + thumb_func_start RecordedOpponentHandleHealthBarUpdate +RecordedOpponentHandleHealthBarUpdate: @ 8188FD0 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -4949,18 +4896,18 @@ _0818908A: pop {r0} bx r0 .pool - thumb_func_end sub_8188FD0 + thumb_func_end RecordedOpponentHandleHealthBarUpdate - thumb_func_start sub_81890C0 -sub_81890C0: @ 81890C0 + thumb_func_start RecordedOpponentHandleExpUpdate +RecordedOpponentHandleExpUpdate: @ 81890C0 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81890C0 + thumb_func_end RecordedOpponentHandleExpUpdate - thumb_func_start sub_81890CC -sub_81890CC: @ 81890CC + thumb_func_start RecordedOpponentHandleStatusIconUpdate +RecordedOpponentHandleStatusIconUpdate: @ 81890CC push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5006,10 +4953,10 @@ _08189120: pop {r0} bx r0 .pool - thumb_func_end sub_81890CC + thumb_func_end RecordedOpponentHandleStatusIconUpdate - thumb_func_start sub_8189144 -sub_8189144: @ 8189144 + thumb_func_start RecordedOpponentHandleStatusAnimation +RecordedOpponentHandleStatusAnimation: @ 8189144 push {r4,r5,lr} ldr r5, =gActiveBank ldrb r0, [r5] @@ -5053,82 +5000,82 @@ _08189194: pop {r0} bx r0 .pool - thumb_func_end sub_8189144 + thumb_func_end RecordedOpponentHandleStatusAnimation - thumb_func_start sub_81891AC -sub_81891AC: @ 81891AC + thumb_func_start RecordedOpponentHandleStatusXor +RecordedOpponentHandleStatusXor: @ 81891AC push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81891AC + thumb_func_end RecordedOpponentHandleStatusXor - thumb_func_start sub_81891B8 -sub_81891B8: @ 81891B8 + thumb_func_start RecordedOpponentHandleDataTransfer +RecordedOpponentHandleDataTransfer: @ 81891B8 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81891B8 + thumb_func_end RecordedOpponentHandleDataTransfer - thumb_func_start sub_81891C4 -sub_81891C4: @ 81891C4 + thumb_func_start RecordedOpponentHandleDMA3Transfer +RecordedOpponentHandleDMA3Transfer: @ 81891C4 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81891C4 + thumb_func_end RecordedOpponentHandleDMA3Transfer - thumb_func_start sub_81891D0 -sub_81891D0: @ 81891D0 + thumb_func_start RecordedOpponentHandlePlayBGM +RecordedOpponentHandlePlayBGM: @ 81891D0 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81891D0 + thumb_func_end RecordedOpponentHandlePlayBGM - thumb_func_start sub_81891DC -sub_81891DC: @ 81891DC + thumb_func_start RecordedOpponentHandleCmd32 +RecordedOpponentHandleCmd32: @ 81891DC push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81891DC + thumb_func_end RecordedOpponentHandleCmd32 - thumb_func_start sub_81891E8 -sub_81891E8: @ 81891E8 + thumb_func_start RecordedOpponentHandleTwoReturnValues +RecordedOpponentHandleTwoReturnValues: @ 81891E8 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81891E8 + thumb_func_end RecordedOpponentHandleTwoReturnValues - thumb_func_start sub_81891F4 -sub_81891F4: @ 81891F4 + thumb_func_start RecordedOpponentHandleChosenMonReturnValue +RecordedOpponentHandleChosenMonReturnValue: @ 81891F4 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81891F4 + thumb_func_end RecordedOpponentHandleChosenMonReturnValue - thumb_func_start sub_8189200 -sub_8189200: @ 8189200 + thumb_func_start RecordedOpponentHandleOneReturnValue +RecordedOpponentHandleOneReturnValue: @ 8189200 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_8189200 + thumb_func_end RecordedOpponentHandleOneReturnValue - thumb_func_start sub_818920C -sub_818920C: @ 818920C + thumb_func_start RecordedOpponentHandleOneReturnValue_Duplicate +RecordedOpponentHandleOneReturnValue_Duplicate: @ 818920C push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818920C + thumb_func_end RecordedOpponentHandleOneReturnValue_Duplicate - thumb_func_start sub_8189218 -sub_8189218: @ 8189218 + thumb_func_start RecordedOpponentHandleCmd37 +RecordedOpponentHandleCmd37: @ 8189218 push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5140,10 +5087,10 @@ sub_8189218: @ 8189218 pop {r0} bx r0 .pool - thumb_func_end sub_8189218 + thumb_func_end RecordedOpponentHandleCmd37 - thumb_func_start sub_8189234 -sub_8189234: @ 8189234 + thumb_func_start RecordedOpponentHandleCmd38 +RecordedOpponentHandleCmd38: @ 8189234 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, =gBattleBufferA @@ -5165,10 +5112,10 @@ sub_8189234: @ 8189234 pop {r0} bx r0 .pool - thumb_func_end sub_8189234 + thumb_func_end RecordedOpponentHandleCmd38 - thumb_func_start sub_818926C -sub_818926C: @ 818926C + thumb_func_start RecordedOpponentHandleCmd39 +RecordedOpponentHandleCmd39: @ 818926C push {lr} ldr r2, =gUnknown_02022D0C ldrb r1, [r2] @@ -5179,10 +5126,10 @@ sub_818926C: @ 818926C pop {r0} bx r0 .pool - thumb_func_end sub_818926C + thumb_func_end RecordedOpponentHandleCmd39 - thumb_func_start sub_8189284 -sub_8189284: @ 8189284 + thumb_func_start RecordedOpponentHandleCmd40 +RecordedOpponentHandleCmd40: @ 8189284 push {lr} ldr r3, =gUnknown_02022D0C ldr r1, [r3] @@ -5200,10 +5147,10 @@ sub_8189284: @ 8189284 pop {r0} bx r0 .pool - thumb_func_end sub_8189284 + thumb_func_end RecordedOpponentHandleCmd40 - thumb_func_start sub_81892AC -sub_81892AC: @ 81892AC + thumb_func_start RecordedOpponentHandleHitAnimation +RecordedOpponentHandleHitAnimation: @ 81892AC push {r4,lr} ldr r3, =gSprites ldr r2, =gBankSpriteIds @@ -5249,18 +5196,18 @@ _0818930A: pop {r0} bx r0 .pool - thumb_func_end sub_81892AC + thumb_func_end RecordedOpponentHandleHitAnimation - thumb_func_start sub_818931C -sub_818931C: @ 818931C + thumb_func_start RecordedOpponentHandleCmd42 +RecordedOpponentHandleCmd42: @ 818931C push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_818931C + thumb_func_end RecordedOpponentHandleCmd42 - thumb_func_start sub_8189328 -sub_8189328: @ 8189328 + thumb_func_start RecordedOpponentHandleEffectivenessSound +RecordedOpponentHandleEffectivenessSound: @ 8189328 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5290,10 +5237,10 @@ _0818933C: pop {r0} bx r0 .pool - thumb_func_end sub_8189328 + thumb_func_end RecordedOpponentHandleEffectivenessSound - thumb_func_start sub_818936C -sub_818936C: @ 818936C + thumb_func_start RecordedOpponentHandlePlayFanfareOrBGM +RecordedOpponentHandlePlayFanfareOrBGM: @ 818936C push {r4,r5,lr} ldr r4, =gBattleBufferA ldr r5, =gActiveBank @@ -5333,10 +5280,10 @@ _081893BC: pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_818936C + thumb_func_end RecordedOpponentHandlePlayFanfareOrBGM - thumb_func_start sub_81893C8 -sub_81893C8: @ 81893C8 + thumb_func_start RecordedOpponentHandleFaintingCry +RecordedOpponentHandleFaintingCry: @ 81893C8 push {lr} ldr r1, =gBattlePartyID ldr r0, =gActiveBank @@ -5359,10 +5306,10 @@ sub_81893C8: @ 81893C8 pop {r0} bx r0 .pool - thumb_func_end sub_81893C8 + thumb_func_end RecordedOpponentHandleFaintingCry - thumb_func_start sub_8189404 -sub_8189404: @ 8189404 + thumb_func_start RecordedOpponentHandleIntroSlide +RecordedOpponentHandleIntroSlide: @ 8189404 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5381,10 +5328,10 @@ sub_8189404: @ 8189404 pop {r0} bx r0 .pool - thumb_func_end sub_8189404 + thumb_func_end RecordedOpponentHandleIntroSlide - thumb_func_start sub_8189438 -sub_8189438: @ 8189438 + thumb_func_start RecordedOpponentHandleIntroTrainerBallThrow +RecordedOpponentHandleIntroTrainerBallThrow: @ 8189438 push {r4-r6,lr} ldr r5, =gBankSpriteIds ldr r6, =gActiveBank @@ -5496,7 +5443,7 @@ _081894FA: pop {r0} bx r0 .pool - thumb_func_end sub_8189438 + thumb_func_end RecordedOpponentHandleIntroTrainerBallThrow thumb_func_start c3_0803D564 c3_0803D564: @ 8189548 @@ -5611,8 +5558,8 @@ sub_818962C: @ 818962C bx r0 thumb_func_end sub_818962C - thumb_func_start sub_8189648 -sub_8189648: @ 8189648 + thumb_func_start RecordedOpponentHandleDrawPartyStatusSummary +RecordedOpponentHandleDrawPartyStatusSummary: @ 8189648 push {r4-r7,lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5734,7 +5681,7 @@ _08189742: pop {r0} bx r0 .pool - thumb_func_end sub_8189648 + thumb_func_end RecordedOpponentHandleDrawPartyStatusSummary thumb_func_start sub_818975C sub_818975C: @ 818975C @@ -5772,8 +5719,8 @@ _08189794: .pool thumb_func_end sub_818975C - thumb_func_start sub_81897A4 -sub_81897A4: @ 81897A4 + thumb_func_start RecordedOpponentHandleCmd49 +RecordedOpponentHandleCmd49: @ 81897A4 push {lr} ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] @@ -5804,18 +5751,18 @@ _081897D6: pop {r0} bx r0 .pool - thumb_func_end sub_81897A4 + thumb_func_end RecordedOpponentHandleCmd49 - thumb_func_start sub_81897F4 -sub_81897F4: @ 81897F4 + thumb_func_start RecordedOpponentHandleCmd50 +RecordedOpponentHandleCmd50: @ 81897F4 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81897F4 + thumb_func_end RecordedOpponentHandleCmd50 - thumb_func_start sub_8189800 -sub_8189800: @ 8189800 + thumb_func_start RecordedOpponentHandleSpriteInvisibility +RecordedOpponentHandleSpriteInvisibility: @ 8189800 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] @@ -5855,10 +5802,10 @@ _08189846: pop {r0} bx r0 .pool - thumb_func_end sub_8189800 + thumb_func_end RecordedOpponentHandleSpriteInvisibility - thumb_func_start sub_8189860 -sub_8189860: @ 8189860 + thumb_func_start RecordedOpponentHandleBattleAnimation +RecordedOpponentHandleBattleAnimation: @ 8189860 push {r4-r6,lr} sub sp, 0x4 ldr r6, =gActiveBank @@ -5904,26 +5851,26 @@ _081898B8: pop {r0} bx r0 .pool - thumb_func_end sub_8189860 + thumb_func_end RecordedOpponentHandleBattleAnimation - thumb_func_start sub_81898C8 -sub_81898C8: @ 81898C8 + thumb_func_start RecordedOpponentHandleLinkStandbyMsg +RecordedOpponentHandleLinkStandbyMsg: @ 81898C8 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81898C8 + thumb_func_end RecordedOpponentHandleLinkStandbyMsg - thumb_func_start sub_81898D4 -sub_81898D4: @ 81898D4 + thumb_func_start RecordedOpponentHandleResetActionMoveSelection +RecordedOpponentHandleResetActionMoveSelection: @ 81898D4 push {lr} bl RecordedOpponentBufferExecCompleted pop {r0} bx r0 - thumb_func_end sub_81898D4 + thumb_func_end RecordedOpponentHandleResetActionMoveSelection - thumb_func_start sub_81898E0 -sub_81898E0: @ 81898E0 + thumb_func_start RecordedOpponentHandleCmd55 +RecordedOpponentHandleCmd55: @ 81898E0 push {lr} ldr r1, =gBattleBufferA ldr r0, =gActiveBank @@ -5959,7 +5906,7 @@ _08189910: pop {r0} bx r0 .pool - thumb_func_end sub_81898E0 + thumb_func_end RecordedOpponentHandleCmd55 thumb_func_start nullsub_119 nullsub_119: @ 8189944 diff --git a/data/battle_controller_recorded_opponent.s b/data/battle_controller_recorded_opponent.s deleted file mode 100644 index 8baa57022..000000000 --- a/data/battle_controller_recorded_opponent.s +++ /dev/null @@ -1,65 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gRecordedOpponentBufferCommands:: @ 860AE90 - .4byte sub_8187224 - .4byte sub_8187A44 - .4byte sub_8187A50 - .4byte sub_81883C8 - .4byte sub_818843C - .4byte sub_818858C - .4byte sub_8188768 - .4byte sub_818888C - .4byte sub_8188A40 - .4byte sub_8188A4C - .4byte sub_8188AF8 - .4byte sub_8188BA4 - .4byte sub_8188BB0 - .4byte sub_8188BBC - .4byte sub_8188BC8 - .4byte sub_8188BD4 - .4byte sub_8188E90 - .4byte sub_8188EE4 - .4byte sub_8188EF0 - .4byte sub_8188F14 - .4byte sub_8188F20 - .4byte sub_8188F7C - .4byte sub_8188F88 - .4byte sub_8188FC4 - .4byte sub_8188FD0 - .4byte sub_81890C0 - .4byte sub_81890CC - .4byte sub_8189144 - .4byte sub_81891AC - .4byte sub_81891B8 - .4byte sub_81891C4 - .4byte sub_81891D0 - .4byte sub_81891DC - .4byte sub_81891E8 - .4byte sub_81891F4 - .4byte sub_8189200 - .4byte sub_818920C - .4byte sub_8189218 - .4byte sub_8189234 - .4byte sub_818926C - .4byte sub_8189284 - .4byte sub_81892AC - .4byte sub_818931C - .4byte sub_8189328 - .4byte sub_818936C - .4byte sub_81893C8 - .4byte sub_8189404 - .4byte sub_8189438 - .4byte sub_8189648 - .4byte sub_81897A4 - .4byte sub_81897F4 - .4byte sub_8189800 - .4byte sub_8189860 - .4byte sub_81898C8 - .4byte sub_81898D4 - .4byte sub_81898E0 - .4byte nullsub_119 - diff --git a/ld_script.txt b/ld_script.txt index 6d0db8ab9..30f5a797d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -232,6 +232,7 @@ SECTIONS { asm/battle_link_817C95C.o(.text); asm/pokemon_animation.o(.text); asm/recorded_battle.o(.text); + src/battle_controller_recorded_opponent.o(.text); asm/battle_controller_recorded_opponent.o(.text); src/battle_controller_recorded_player.o(.text); src/battle_dome_cards.o(.text); @@ -451,7 +452,7 @@ SECTIONS { data/evolution_graphics.o(.rodata); data/bard_music.o(.rodata); data/data_860A4AC.o(.rodata); - data/battle_controller_recorded_opponent.o(.rodata); + src/battle_controller_recorded_opponent.o(.rodata); src/battle_controller_recorded_player.o(.rodata); src/battle_dome_cards.o(.rodata); src/lilycove_lady.o(.rodata); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c new file mode 100644 index 000000000..9cfd821f5 --- /dev/null +++ b/src/battle_controller_recorded_opponent.c @@ -0,0 +1,208 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "battle_link_817C95C.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.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" +#include "pokeball.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +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 struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern u16 gTrainerBattleOpponent_A; +extern u16 gTrainerBattleOpponent_B; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; +extern const u8 gUnknown_0831F578[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); +extern void sub_81851A8(u8 *); +extern u16 sub_8068B48(void); + +// this file's functions +void RecordedOpponentHandleGetMonData(void); +void RecordedOpponentHandleGetRawMonData(void); +void RecordedOpponentHandleSetMonData(void); +void RecordedOpponentHandleSetRawMonData(void); +void RecordedOpponentHandleLoadMonSprite(void); +void RecordedOpponentHandleSwitchInAnim(void); +void RecordedOpponentHandleReturnMonToBall(void); +void RecordedOpponentHandleDrawTrainerPic(void); +void RecordedOpponentHandleTrainerSlide(void); +void RecordedOpponentHandleTrainerSlideBack(void); +void RecordedOpponentHandleFaintAnimation(void); +void RecordedOpponentHandlePaletteFade(void); +void RecordedOpponentHandleSuccessBallThrowAnim(void); +void RecordedOpponentHandleBallThrowAnim(void); +void RecordedOpponentHandlePause(void); +void RecordedOpponentHandleMoveAnimation(void); +void RecordedOpponentHandlePrintString(void); +void RecordedOpponentHandlePrintStringPlayerOnly(void); +void RecordedOpponentHandleChooseAction(void); +void RecordedOpponentHandleUnknownYesNoBox(void); +void RecordedOpponentHandleChooseMove(void); +void RecordedOpponentHandleChooseItem(void); +void RecordedOpponentHandleChoosePokemon(void); +void RecordedOpponentHandleCmd23(void); +void RecordedOpponentHandleHealthBarUpdate(void); +void RecordedOpponentHandleExpUpdate(void); +void RecordedOpponentHandleStatusIconUpdate(void); +void RecordedOpponentHandleStatusAnimation(void); +void RecordedOpponentHandleStatusXor(void); +void RecordedOpponentHandleDataTransfer(void); +void RecordedOpponentHandleDMA3Transfer(void); +void RecordedOpponentHandlePlayBGM(void); +void RecordedOpponentHandleCmd32(void); +void RecordedOpponentHandleTwoReturnValues(void); +void RecordedOpponentHandleChosenMonReturnValue(void); +void RecordedOpponentHandleOneReturnValue(void); +void RecordedOpponentHandleOneReturnValue_Duplicate(void); +void RecordedOpponentHandleCmd37(void); +void RecordedOpponentHandleCmd38(void); +void RecordedOpponentHandleCmd39(void); +void RecordedOpponentHandleCmd40(void); +void RecordedOpponentHandleHitAnimation(void); +void RecordedOpponentHandleCmd42(void); +void RecordedOpponentHandleEffectivenessSound(void); +void RecordedOpponentHandlePlayFanfareOrBGM(void); +void RecordedOpponentHandleFaintingCry(void); +void RecordedOpponentHandleIntroSlide(void); +void RecordedOpponentHandleIntroTrainerBallThrow(void); +void RecordedOpponentHandleDrawPartyStatusSummary(void); +void RecordedOpponentHandleCmd49(void); +void RecordedOpponentHandleCmd50(void); +void RecordedOpponentHandleSpriteInvisibility(void); +void RecordedOpponentHandleBattleAnimation(void); +void RecordedOpponentHandleLinkStandbyMsg(void); +void RecordedOpponentHandleResetActionMoveSelection(void); +void RecordedOpponentHandleCmd55(void); +void nullsub_119(void); + +void RecordedOpponentBufferRunCommand(void); +void RecordedOpponentBufferExecCompleted(void); + +void (*const gRecordedOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +{ + RecordedOpponentHandleGetMonData, + RecordedOpponentHandleGetRawMonData, + RecordedOpponentHandleSetMonData, + RecordedOpponentHandleSetRawMonData, + RecordedOpponentHandleLoadMonSprite, + RecordedOpponentHandleSwitchInAnim, + RecordedOpponentHandleReturnMonToBall, + RecordedOpponentHandleDrawTrainerPic, + RecordedOpponentHandleTrainerSlide, + RecordedOpponentHandleTrainerSlideBack, + RecordedOpponentHandleFaintAnimation, + RecordedOpponentHandlePaletteFade, + RecordedOpponentHandleSuccessBallThrowAnim, + RecordedOpponentHandleBallThrowAnim, + RecordedOpponentHandlePause, + RecordedOpponentHandleMoveAnimation, + RecordedOpponentHandlePrintString, + RecordedOpponentHandlePrintStringPlayerOnly, + RecordedOpponentHandleChooseAction, + RecordedOpponentHandleUnknownYesNoBox, + RecordedOpponentHandleChooseMove, + RecordedOpponentHandleChooseItem, + RecordedOpponentHandleChoosePokemon, + RecordedOpponentHandleCmd23, + RecordedOpponentHandleHealthBarUpdate, + RecordedOpponentHandleExpUpdate, + RecordedOpponentHandleStatusIconUpdate, + RecordedOpponentHandleStatusAnimation, + RecordedOpponentHandleStatusXor, + RecordedOpponentHandleDataTransfer, + RecordedOpponentHandleDMA3Transfer, + RecordedOpponentHandlePlayBGM, + RecordedOpponentHandleCmd32, + RecordedOpponentHandleTwoReturnValues, + RecordedOpponentHandleChosenMonReturnValue, + RecordedOpponentHandleOneReturnValue, + RecordedOpponentHandleOneReturnValue_Duplicate, + RecordedOpponentHandleCmd37, + RecordedOpponentHandleCmd38, + RecordedOpponentHandleCmd39, + RecordedOpponentHandleCmd40, + RecordedOpponentHandleHitAnimation, + RecordedOpponentHandleCmd42, + RecordedOpponentHandleEffectivenessSound, + RecordedOpponentHandlePlayFanfareOrBGM, + RecordedOpponentHandleFaintingCry, + RecordedOpponentHandleIntroSlide, + RecordedOpponentHandleIntroTrainerBallThrow, + RecordedOpponentHandleDrawPartyStatusSummary, + RecordedOpponentHandleCmd49, + RecordedOpponentHandleCmd50, + RecordedOpponentHandleSpriteInvisibility, + RecordedOpponentHandleBattleAnimation, + RecordedOpponentHandleLinkStandbyMsg, + RecordedOpponentHandleResetActionMoveSelection, + RecordedOpponentHandleCmd55, + nullsub_119 +}; + +void nullsub_70(void) +{ +} + +void SetBankFuncToRecordedOpponentBufferRunCommand(void) +{ + gBattleBankFunc[gActiveBank] = RecordedOpponentBufferRunCommand; +} + +void RecordedOpponentBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gRecordedOpponentBufferCommands)) + gRecordedOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + RecordedOpponentBufferExecCompleted(); + } +} From a9bc67dbb090277c8c6c4df1cf16a43ad36e413b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 25 Oct 2017 18:59:07 +0200 Subject: [PATCH 17/29] recorded opponent controller is done --- asm/battle_controller_recorded_opponent.s | 5916 --------------------- ld_script.txt | 1 - src/battle_controller_link_opponent.c | 6 +- src/battle_controller_link_partner.c | 6 +- src/battle_controller_player.c | 6 +- src/battle_controller_player_partner.c | 6 +- src/battle_controller_recorded_opponent.c | 1766 +++++- src/battle_controller_recorded_player.c | 6 +- src/battle_controller_safari.c | 6 +- 9 files changed, 1716 insertions(+), 6003 deletions(-) delete mode 100644 asm/battle_controller_recorded_opponent.s diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s deleted file mode 100644 index 847dda4c8..000000000 --- a/asm/battle_controller_recorded_opponent.s +++ /dev/null @@ -1,5916 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8186558 -sub_8186558: @ 8186558 - 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 _0818657C - bl RecordedOpponentBufferExecCompleted -_0818657C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186558 - - thumb_func_start sub_8186590 -sub_8186590: @ 8186590 - 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 _081865B4 - bl RecordedOpponentBufferExecCompleted -_081865B4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186590 - - thumb_func_start sub_81865C8 -sub_81865C8: @ 81865C8 - push {r4-r6,lr} - ldr r5, =gSprites - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0818661A - adds r0, r2, r5 - ldrh r0, [r0, 0x6] - bl FreeTrainerFrontPicPalette - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - bl RecordedOpponentBufferExecCompleted -_0818661A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81865C8 - - thumb_func_start sub_8186630 -sub_8186630: @ 8186630 - 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 _08186668 - 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 RecordedOpponentBufferExecCompleted -_08186668: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186630 - - thumb_func_start sub_8186678 -sub_8186678: @ 8186678 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r0, 0 - mov r9, r0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081866A4 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081866F8 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081866F8 -_081866A4: - ldr r4, =gSprites - ldr r0, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r3, [r2] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - mov r8, r2 - cmp r1, r0 - bne _08186764 - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08186764 - b _0818676A - .pool -_081866F8: - ldr r6, =gSprites - ldr r7, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r3, [r2] - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r6, 0 - adds r5, 0x1C - adds r0, r5 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - mov r8, r2 - cmp r4, r0 - bne _08186764 - movs r0, 0x2 - adds r2, r3, 0 - eors r2, r0 - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r4 - bne _08186764 - ldr r4, =gBankSpriteIds - adds r0, r3, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08186764 - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08186764 - movs r1, 0x1 - mov r9, r1 -_08186764: - mov r2, r9 - cmp r2, 0 - beq _0818683A -_0818676A: - mov r6, r8 - ldrb r0, [r6] - bl GetBankIdentity - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bne _08186816 - ldr r0, =gBattleSpritesDataPtr - mov r12, r0 - ldr r0, [r0] - ldrb r2, [r6] - ldr r5, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r5 - ldrb r1, [r4, 0x1] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0818683A - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x1] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0818683A - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r12 - ldr r0, [r1] - 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, r12 - ldr r2, [r0] - ldrb r0, [r6] - adds r1, r7, 0 - 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, r12 - ldr r2, [r1] - ldrb r0, [r6] - adds r1, r7, 0 - 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 -_08186816: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - mov r2, r8 - 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, r8 - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186630 - str r1, [r0] -_0818683A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186678 - - thumb_func_start sub_818686C -sub_818686C: @ 818686C - 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 _081868AC - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081868AC: - 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 _081868DE - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081868DE: - 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 _081869AE - 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 _081869AE - ldrb r1, [r4, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08186994 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08186964 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08186964 - 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, =gEnemyParty - 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 -_08186964: - 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, =gEnemyParty - 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 -_08186994: - 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] -_081869AE: - 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 _08186A6A - 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 _08186A6A - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08186A6A - ldr r0, [r5] - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08186A4C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08186A40 - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08186A4C - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _08186A4C - .pool -_08186A40: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_08186A4C: - 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 -_08186A6A: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _08186AC8 - 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 _08186B26 - 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 _08186B26 - b _08186B22 - .pool -_08186AC8: - 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 _08186B26 - 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 _08186B26 - 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 _08186B26 - 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 _08186B26 -_08186B22: - movs r0, 0x1 - mov r8, r0 -_08186B26: - mov r0, r9 - cmp r0, 0 - beq _08186C10 - mov r0, r8 - cmp r0, 0 - beq _08186C10 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08186B8A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08186B8A - ldr r1, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x2 - eors 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 - ldrb r0, [r5] - eors r4, r0 - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback -_08186B8A: - 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 - ldrb r5, [r4] - ldr r1, =gBattlePartyID - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - bl SetBankEnemyShadowSpriteCallback - 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_8186678 - str r1, [r0] -_08186C10: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818686C - - thumb_func_start sub_8186C48 -sub_8186C48: @ 8186C48 - push {r4-r7,lr} - ldr r4, =gSprites - ldr r0, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r3, [r7] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08186CFA - adds r0, r2, r4 - movs r1, 0x24 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08186CFA - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r4, r3, 1 - adds r0, r4, r3 - lsls r0, 2 - adds r2, r0, r1 - ldrb r5, [r2] - movs r0, 0x80 - ands r0, r5 - cmp r0, 0 - bne _08186CC0 - ldr r0, =gBattlePartyID - adds r0, r4, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 - b _08186CFA - .pool -_08186CC0: - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08186CFA - movs r0, 0x7F - ands r0, r5 - strb r0, [r2] - ldr r0, [r6] - ldrb r2, [r7] - 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 - bl RecordedOpponentBufferExecCompleted -_08186CFA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186C48 - - thumb_func_start sub_8186D04 -sub_8186D04: @ 8186D04 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - ldr r5, =gHealthBoxesIds - adds r1, r0, r5 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08186D4C - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08186D50 - .pool -_08186D4C: - bl RecordedOpponentBufferExecCompleted -_08186D50: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8186D04 - - thumb_func_start sub_8186D58 -sub_8186D58: @ 8186D58 - push {lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _08186D86 - ldr r0, =gHealthBoxesIds - adds r0, r3, r0 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedOpponentBufferExecCompleted -_08186D86: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186D58 - - thumb_func_start sub_8186D9C -sub_8186D9C: @ 8186D9C - 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 _08186DF6 - 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 - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedOpponentBufferExecCompleted -_08186DF6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186D9C - - thumb_func_start sub_8186E10 -sub_8186E10: @ 8186E10 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _08186E22 - bl RecordedOpponentBufferExecCompleted -_08186E22: - pop {r0} - bx r0 - thumb_func_end sub_8186E10 - - thumb_func_start bx_blink_t2 -bx_blink_t2: @ 8186E28 - 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 _08186E74 - 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 RecordedOpponentBufferExecCompleted - b _08186E9E - .pool -_08186E74: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08186E98 - 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] -_08186E98: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08186E9E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t2 - - thumb_func_start sub_8186EA4 -sub_8186EA4: @ 8186EA4 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - 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 _08186EF0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08186EE4 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_08186EE4: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8186F14 - str r0, [r1] -_08186EF0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186EA4 - - thumb_func_start sub_8186F14 -sub_8186F14: @ 8186F14 - 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 _08186F6E - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08186F6E - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - 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, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08186F5E - ldr r0, =SpriteCallbackDummy_2 - cmp r1, r0 - bne _08186F6E -_08186F5E: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - bl RecordedOpponentBufferExecCompleted -_08186F6E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186F14 - - thumb_func_start sub_8186F94 -sub_8186F94: @ 8186F94 - push {r4-r7,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r1, [r3, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08187050 - ldr r7, =gSprites - ldr r6, =gBankSpriteIds - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r7, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08187050 - ldrb r1, [r3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r3] - ldr r0, [r4] - ldrb r2, [r5] - 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 - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0 - bl StartSpriteAnim - 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, =gEnemyParty - 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 - ldrb r0, [r5] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186EA4 - str r1, [r0] -_08187050: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186F94 - - thumb_func_start sub_8187084 -sub_8187084: @ 8187084 - 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 _081870B6 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081870B6: - 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 _08187120 - 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 _08187120 - adds r0, r3, r4 - bl DestroySprite - ldrb r4, [r5] - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186F94 - str r1, [r0] -_08187120: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8187084 - - thumb_func_start sub_818714C -sub_818714C: @ 818714C - 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 _0818716E - bl RecordedOpponentBufferExecCompleted -_0818716E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818714C - - thumb_func_start sub_818717C -sub_818717C: @ 818717C - 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 _0818719E - bl RecordedOpponentBufferExecCompleted -_0818719E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818717C - - thumb_func_start RecordedOpponentBufferExecCompleted -RecordedOpponentBufferExecCompleted: @ 81871AC - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedOpponentBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08187200 - 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 _08187212 - .pool -_08187200: - 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] -_08187212: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentBufferExecCompleted - - thumb_func_start RecordedOpponentHandleGetMonData -RecordedOpponentHandleGetMonData: @ 8187224 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0818725C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_8187298 - adds r6, r0, 0 - b _0818727E - .pool -_0818725C: - ldrb r4, [r1] - movs r5, 0 -_08187260: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08187276 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_8187298 - adds r6, r0 -_08187276: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08187260 -_0818727E: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl RecordedOpponentBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleGetMonData - - thumb_func_start sub_8187298 -sub_8187298: @ 8187298 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _081872C2 - bl _08187A2E -_081872C2: - lsls r0, 2 - ldr r1, =_081872D8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081872D8: - .4byte _081873C8 - .4byte _081875EC - .4byte _081875FC - .4byte _0818760C - .4byte _08187674 - .4byte _08187674 - .4byte _08187674 - .4byte _08187674 - .4byte _08187690 - .4byte _081876CC - .4byte _081876CC - .4byte _081876CC - .4byte _081876CC - .4byte _08187A2E - .4byte _08187A2E - .4byte _08187A2E - .4byte _08187A2E - .4byte _081876E8 - .4byte _081876F8 - .4byte _08187728 - .4byte _08187738 - .4byte _08187748 - .4byte _08187758 - .4byte _08187768 - .4byte _08187778 - .4byte _08187788 - .4byte _08187798 - .4byte _081877A8 - .4byte _081877B8 - .4byte _081877C8 - .4byte _081877D8 - .4byte _081877E8 - .4byte _08187838 - .4byte _08187848 - .4byte _08187858 - .4byte _08187868 - .4byte _08187878 - .4byte _08187888 - .4byte _08187898 - .4byte _081878A8 - .4byte _081878B8 - .4byte _081878EC - .4byte _081878FC - .4byte _0818790C - .4byte _0818791C - .4byte _0818792C - .4byte _0818793C - .4byte _0818794C - .4byte _0818795C - .4byte _0818797C - .4byte _0818798C - .4byte _0818799C - .4byte _081879AC - .4byte _081879BC - .4byte _081879CC - .4byte _081879DC - .4byte _081879EC - .4byte _081879FC - .4byte _08187A0C - .4byte _08187A1C -_081873C8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08187414: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08187414 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_081875CC: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _081875CC - b _08187A2E - .pool -_081875EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - b _08187966 - .pool -_081875FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xC - b _08187966 - .pool -_0818760C: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - mov r8, r9 -_08187622: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _08187622 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_08187660: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _08187660 - b _08187A2E - .pool -_08187674: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _08187966 - .pool -_08187690: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gEnemyParty - mov r8, r2 -_0818769C: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0818769C - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _08187A2E - .pool -_081876CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _08187A26 - .pool -_081876E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1 - b _08187702 - .pool -_081876F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x19 -_08187702: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _08187A2E - .pool -_08187728: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1A - b _08187A26 - .pool -_08187738: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1B - b _08187A26 - .pool -_08187748: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1C - b _08187A26 - .pool -_08187758: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1D - b _08187A26 - .pool -_08187768: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1E - b _08187A26 - .pool -_08187778: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1F - b _08187A26 - .pool -_08187788: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x20 - b _08187A26 - .pool -_08187798: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x22 - b _08187A26 - .pool -_081877A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x23 - b _08187A26 - .pool -_081877B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x24 - b _08187A26 - .pool -_081877C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x25 - b _08187A26 - .pool -_081877D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x26 - b _08187A26 - .pool -_081877E8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _08187A2E - .pool -_08187838: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x27 - b _08187A26 - .pool -_08187848: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x28 - b _08187A26 - .pool -_08187858: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x29 - b _08187A26 - .pool -_08187868: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2A - b _08187A26 - .pool -_08187878: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2B - b _08187A26 - .pool -_08187888: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2C - b _08187A26 - .pool -_08187898: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0 - b _081878C2 - .pool -_081878A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x9 - b _08187966 - .pool -_081878B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x37 -_081878C2: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _08187A2E - .pool -_081878EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x38 - b _08187A26 - .pool -_081878FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - b _08187966 - .pool -_0818790C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - b _08187966 - .pool -_0818791C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3B - b _08187966 - .pool -_0818792C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3C - b _08187966 - .pool -_0818793C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3D - b _08187966 - .pool -_0818794C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3E - b _08187966 - .pool -_0818795C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3F -_08187966: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _08187A2E - .pool -_0818797C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x16 - b _08187A26 - .pool -_0818798C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x17 - b _08187A26 - .pool -_0818799C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x18 - b _08187A26 - .pool -_081879AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x21 - b _08187A26 - .pool -_081879BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2F - b _08187A26 - .pool -_081879CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x30 - b _08187A26 - .pool -_081879DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x32 - b _08187A26 - .pool -_081879EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x33 - b _08187A26 - .pool -_081879FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x34 - b _08187A26 - .pool -_08187A0C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x35 - b _08187A26 - .pool -_08187A1C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x36 -_08187A26: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_08187A2E: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8187298 - - thumb_func_start RecordedOpponentHandleGetRawMonData -RecordedOpponentHandleGetRawMonData: @ 8187A44 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleGetRawMonData - - thumb_func_start RecordedOpponentHandleSetMonData -RecordedOpponentHandleSetMonData: @ 8187A50 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08187A80 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl dp01_setattr_for_opponent_pokemon - b _08187A9E - .pool -_08187A80: - ldrb r4, [r1] - movs r5, 0 -_08187A84: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08187A92 - adds r0, r5, 0 - bl dp01_setattr_for_opponent_pokemon -_08187A92: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08187A84 -_08187A9E: - bl RecordedOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleSetMonData - - thumb_func_start dp01_setattr_for_opponent_pokemon -dp01_setattr_for_opponent_pokemon: @ 8187AA8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x38 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r4, r0, r2 - adds r7, r4, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r6, r3, 0 - adds r3, r2, 0 - cmp r0, 0x3B - bls _08187AD6 - bl _081883B4 -_08187AD6: - lsls r0, 2 - ldr r1, =_08187AEC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08187AEC: - .4byte _08187BDC - .4byte _08187D74 - .4byte _08187D90 - .4byte _08187DAC - .4byte _08187E00 - .4byte _08187E00 - .4byte _08187E00 - .4byte _08187E00 - .4byte _08187E20 - .4byte _08187E88 - .4byte _08187E88 - .4byte _08187E88 - .4byte _08187E88 - .4byte _081883B4 - .4byte _081883B4 - .4byte _081883B4 - .4byte _081883B4 - .4byte _08187EB0 - .4byte _08187ECC - .4byte _08187EE8 - .4byte _08187F04 - .4byte _08187F20 - .4byte _08187F3C - .4byte _08187F58 - .4byte _08187F74 - .4byte _08187F90 - .4byte _08187FAC - .4byte _08187FC8 - .4byte _08187FE4 - .4byte _08188000 - .4byte _0818801C - .4byte _08188038 - .4byte _081880AC - .4byte _081880C8 - .4byte _081880E4 - .4byte _08188100 - .4byte _0818811C - .4byte _08188138 - .4byte _08188154 - .4byte _08188170 - .4byte _0818818C - .4byte _081881A8 - .4byte _081881C4 - .4byte _081881E0 - .4byte _081881FC - .4byte _08188218 - .4byte _08188234 - .4byte _08188250 - .4byte _0818826C - .4byte _08188288 - .4byte _081882A4 - .4byte _081882C0 - .4byte _081882DC - .4byte _081882F8 - .4byte _08188314 - .4byte _08188330 - .4byte _0818834C - .4byte _08188368 - .4byte _08188384 - .4byte _081883A0 -_08187BDC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r7, 0 - bl SetMonData - adds r2, r7, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r7 - mov r10, r0 - adds r0, r7, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r7, 0x2 - str r0, [sp, 0x4] - adds r0, r7, 0x4 - str r0, [sp, 0x8] - adds r0, r7, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r6, r7, 0 - adds r6, 0x24 - adds r4, r7, 0 - adds r4, 0xC -_08187C42: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08187C42 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r7, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r7, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _081883B4 - .pool -_08187D74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xB - bl SetMonData - b _081883B4 - .pool -_08187D90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xC - bl SetMonData - b _081883B4 - .pool -_08187DAC: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r4 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r7, r1, r0 - adds r6, r4, 0 - adds r6, 0x8 -_08187DC4: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08187DC4 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _081883B4 - .pool -_08187E00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _08187E9E - .pool -_08187E20: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x11 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _081883B4 - .pool -_08187E88: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_08187E9E: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _081883B4 - .pool -_08187EB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1 - bl SetMonData - b _081883B4 - .pool -_08187ECC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x19 - bl SetMonData - b _081883B4 - .pool -_08187EE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1A - bl SetMonData - b _081883B4 - .pool -_08187F04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1B - bl SetMonData - b _081883B4 - .pool -_08187F20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1C - bl SetMonData - b _081883B4 - .pool -_08187F3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1D - bl SetMonData - b _081883B4 - .pool -_08187F58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1E - bl SetMonData - b _081883B4 - .pool -_08187F74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1F - bl SetMonData - b _081883B4 - .pool -_08187F90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x20 - bl SetMonData - b _081883B4 - .pool -_08187FAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x22 - bl SetMonData - b _081883B4 - .pool -_08187FC8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x23 - bl SetMonData - b _081883B4 - .pool -_08187FE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x24 - bl SetMonData - b _081883B4 - .pool -_08188000: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x25 - bl SetMonData - b _081883B4 - .pool -_0818801C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x26 - bl SetMonData - b _081883B4 - .pool -_08188038: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x27 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08188146 - .pool -_081880AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x27 - bl SetMonData - b _081883B4 - .pool -_081880C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x28 - bl SetMonData - b _081883B4 - .pool -_081880E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x29 - bl SetMonData - b _081883B4 - .pool -_08188100: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2A - bl SetMonData - b _081883B4 - .pool -_0818811C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2B - bl SetMonData - b _081883B4 - .pool -_08188138: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 -_08188146: - movs r1, 0x2C - bl SetMonData - b _081883B4 - .pool -_08188154: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0 - bl SetMonData - b _081883B4 - .pool -_08188170: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x9 - bl SetMonData - b _081883B4 - .pool -_0818818C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x37 - bl SetMonData - b _081883B4 - .pool -_081881A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x38 - bl SetMonData - b _081883B4 - .pool -_081881C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x39 - bl SetMonData - b _081883B4 - .pool -_081881E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3A - bl SetMonData - b _081883B4 - .pool -_081881FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3B - bl SetMonData - b _081883B4 - .pool -_08188218: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3C - bl SetMonData - b _081883B4 - .pool -_08188234: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3D - bl SetMonData - b _081883B4 - .pool -_08188250: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3E - bl SetMonData - b _081883B4 - .pool -_0818826C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3F - bl SetMonData - b _081883B4 - .pool -_08188288: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x16 - bl SetMonData - b _081883B4 - .pool -_081882A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x17 - bl SetMonData - b _081883B4 - .pool -_081882C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x18 - bl SetMonData - b _081883B4 - .pool -_081882DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x21 - bl SetMonData - b _081883B4 - .pool -_081882F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2F - bl SetMonData - b _081883B4 - .pool -_08188314: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x30 - bl SetMonData - b _081883B4 - .pool -_08188330: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x32 - bl SetMonData - b _081883B4 - .pool -_0818834C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x33 - bl SetMonData - b _081883B4 - .pool -_08188368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x34 - bl SetMonData - b _081883B4 - .pool -_08188384: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x35 - bl SetMonData - b _081883B4 - .pool -_081883A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x36 - bl SetMonData -_081883B4: - add sp, 0x38 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01_setattr_for_opponent_pokemon - - thumb_func_start RecordedOpponentHandleSetRawMonData -RecordedOpponentHandleSetRawMonData: @ 81883C8 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gEnemyParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _08188420 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_081883FE: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _081883FE -_08188420: - bl RecordedOpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleSetRawMonData - - thumb_func_start RecordedOpponentHandleLoadMonSprite -RecordedOpponentHandleLoadMonSprite: @ 818843C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r7, =gBattlePartyID - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 1 - adds r0, r7 - ldrh r0, [r0] - movs r1, 0x64 - mov r10, r1 - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - ldr r1, =gEnemyParty - mov r9, r1 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r1, [r6] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - add r0, r9 - bl BattleLoadOpponentMonSpriteGfx - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldrb r4, [r6] - lsls r0, r4, 1 - adds r0, r7 - ldrh r0, [r0] - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186C48 - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleLoadMonSprite - - thumb_func_start RecordedOpponentHandleSwitchInAnim -RecordedOpponentHandleSwitchInAnim: @ 818858C - push {r4,lr} - ldr r1, =gBattlePartyID - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r2, r0, 1 - adds r2, r1 - ldr r3, =gBattleBufferA - lsls r0, 9 - adds r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2] - ldrb r0, [r4] - lsls r1, r0, 9 - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - bl sub_81885D8 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8187084 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleSwitchInAnim - - thumb_func_start sub_81885D8 -sub_81885D8: @ 81885D8 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl ClearTemporarySpeciesSpriteData - ldr r0, =gBattlePartyID - lsls r4, r6, 1 - adds r4, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4] - ldrh r0, [r4] - movs r1, 0x64 - mov r9, r1 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r10, r1 - add r10, r6 - mov r1, r10 - strb r0, [r1] - ldrh r0, [r4] - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - adds r0, r5 - adds r1, r6, 0 - bl BattleLoadOpponentMonSpriteGfx - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFE - bl sub_80753E8 - mov r1, r10 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81885D8 - - thumb_func_start RecordedOpponentHandleReturnMonToBall -RecordedOpponentHandleReturnMonToBall: @ 8188768 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _081887B0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8188800 - str r1, [r0] - b _081887EC - .pool -_081887B0: - 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 - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedOpponentBufferExecCompleted -_081887EC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleReturnMonToBall - - thumb_func_start sub_8188800 -sub_8188800: @ 8188800 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _08188828 - cmp r0, 0x1 - beq _08188856 - b _0818887E - .pool -_08188828: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08188842 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08188842: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0818887E -_08188856: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0818887E - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x2 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186D9C - str r1, [r0] -_0818887E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188800 - - thumb_func_start RecordedOpponentHandleDrawTrainerPic -RecordedOpponentHandleDrawTrainerPic: @ 818888C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r5, =gBattleTypeFlags - ldr r0, [r5] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081888F6 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0xC8 - cmp r1, 0 - beq _081888B4 - movs r7, 0x98 -_081888B4: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 1 - ands r0, r1 - cmp r0, 0 - beq _081888EC - ldrb r0, [r4] - cmp r0, 0x1 - bne _081888D8 - ldr r0, =gTrainerBattleOpponent_A - b _081888DA - .pool -_081888D8: - ldr r0, =gTrainerBattleOpponent_B -_081888DA: - ldrh r0, [r0] - bl GetFrontierTrainerFrontSpriteId - lsls r0, 24 - lsrs r0, 24 - b _0818892C - .pool -_081888EC: - bl sub_8185F40 - lsls r0, 24 - lsrs r0, 24 - b _08188924 -_081888F6: - movs r7, 0xB0 - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 4 - cmp r1, r0 - bne _08188910 - bl sub_8068B48 - b _08188928 - .pool -_08188910: - ldr r2, =gLinkPlayers - ldr r0, =gUnknown_0203C7B4 - ldrb r0, [r0] - movs r1, 0x1 - eors r1, r0 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x13] -_08188924: - bl PlayerGenderToFrontTrainerPicId -_08188928: - lsls r0, 16 - lsrs r0, 16 -_0818892C: - mov r8, r0 - ldr r5, =gActiveBank - ldrb r1, [r5] - bl DecompressTrainerFrontPic - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r9, r7 - ldr r1, =gTrainerFrontPicCoords - mov r2, r8 - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 14 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r5] - adds r1, r6 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r1, r8 - strh r1, [r0, 0x6] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186558 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleDrawTrainerPic - - thumb_func_start RecordedOpponentHandleTrainerSlide -RecordedOpponentHandleTrainerSlide: @ 8188A40 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleTrainerSlide - - thumb_func_start RecordedOpponentHandleTrainerSlideBack -RecordedOpponentHandleTrainerSlideBack: @ 8188A4C - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81865C8 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleTrainerSlideBack - - thumb_func_start RecordedOpponentHandleFaintAnimation -RecordedOpponentHandleFaintAnimation: @ 8188AF8 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _08188B4C - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08188B2C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08188B2C: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _08188B88 - .pool -_08188B4C: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08188B88 - strb r0, [r3, 0x4] - movs r0, 0x10 - movs r1, 0x3F - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - 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_8039934 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186D58 - str r1, [r0] -_08188B88: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleFaintAnimation - - thumb_func_start RecordedOpponentHandlePaletteFade -RecordedOpponentHandlePaletteFade: @ 8188BA4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandlePaletteFade - - thumb_func_start RecordedOpponentHandleSuccessBallThrowAnim -RecordedOpponentHandleSuccessBallThrowAnim: @ 8188BB0 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleSuccessBallThrowAnim - - thumb_func_start RecordedOpponentHandleBallThrowAnim -RecordedOpponentHandleBallThrowAnim: @ 8188BBC - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleBallThrowAnim - - thumb_func_start RecordedOpponentHandlePause -RecordedOpponentHandlePause: @ 8188BC8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandlePause - - thumb_func_start RecordedOpponentHandleMoveAnimation -RecordedOpponentHandleMoveAnimation: @ 8188BD4 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _08188BE6 - b _08188CFA -_08188BE6: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gTransformedPersonalities - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _08188CDC - bl RecordedOpponentBufferExecCompleted - b _08188CFA - .pool -_08188CDC: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8188D0C - str r1, [r0] -_08188CFA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleMoveAnimation - - thumb_func_start sub_8188D0C -sub_8188D0C: @ 8188D0C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _08188DA4 - cmp r2, 0x1 - bgt _08188D64 - cmp r2, 0 - beq _08188D6E - b _08188E80 - .pool -_08188D64: - cmp r2, 0x2 - beq _08188DCE - cmp r2, 0x3 - beq _08188E44 - b _08188E80 -_08188D6E: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _08188D90 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08188D90: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08188E80 -_08188DA4: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08188E80 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _08188E80 -_08188DCE: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _08188E80 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _08188E1C - mov r0, r8 - cmp r0, 0x1 - bhi _08188E1C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_08188E1C: - 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 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _08188E80 - .pool -_08188E44: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08188E80 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl RecordedOpponentBufferExecCompleted -_08188E80: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8188D0C - - thumb_func_start RecordedOpponentHandlePrintString -RecordedOpponentHandlePrintString: @ 8188E90 - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186E10 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandlePrintString - - thumb_func_start RecordedOpponentHandlePrintStringPlayerOnly -RecordedOpponentHandlePrintStringPlayerOnly: @ 8188EE4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandlePrintStringPlayerOnly - - thumb_func_start RecordedOpponentHandleChooseAction -RecordedOpponentHandleChooseAction: @ 8188EF0 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl RecordedBattle_ReadBankAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitTwoReturnValues - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleChooseAction - - thumb_func_start RecordedOpponentHandleUnknownYesNoBox -RecordedOpponentHandleUnknownYesNoBox: @ 8188F14 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleUnknownYesNoBox - - thumb_func_start RecordedOpponentHandleChooseMove -RecordedOpponentHandleChooseMove: @ 8188F20 - push {r4,r5,lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _08188F48 - bl ChooseMoveAndTargetInBattlePalace - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues - b _08188F6C - .pool -_08188F48: - ldr r5, =gActiveBank - ldrb r0, [r5] - bl RecordedBattle_ReadBankAction - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r5] - bl RecordedBattle_ReadBankAction - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 16 - orrs r2, r4 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues -_08188F6C: - bl RecordedOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleChooseMove - - thumb_func_start RecordedOpponentHandleChooseItem -RecordedOpponentHandleChooseItem: @ 8188F7C - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleChooseItem - - thumb_func_start RecordedOpponentHandleChoosePokemon -RecordedOpponentHandleChoosePokemon: @ 8188F88 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl RecordedBattle_ReadBankAction - ldrb r1, [r4] - ldr r3, =gBattleStruct - ldr r2, [r3] - adds r1, r2 - adds r1, 0x5C - strb r0, [r1] - ldrb r0, [r4] - ldr r1, [r3] - adds r0, r1 - adds r0, 0x5C - ldrb r1, [r0] - movs r0, 0x1 - movs r2, 0 - bl EmitChosenMonReturnValue - bl RecordedOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleChoosePokemon - - thumb_func_start RecordedOpponentHandleCmd23 -RecordedOpponentHandleCmd23: @ 8188FC4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleCmd23 - - thumb_func_start RecordedOpponentHandleHealthBarUpdate -RecordedOpponentHandleHealthBarUpdate: @ 8188FD0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _08189060 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gEnemyParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0818908A - .pool -_08189060: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0818908A: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186D04 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleHealthBarUpdate - - thumb_func_start RecordedOpponentHandleExpUpdate -RecordedOpponentHandleExpUpdate: @ 81890C0 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleExpUpdate - - thumb_func_start RecordedOpponentHandleStatusIconUpdate -RecordedOpponentHandleStatusIconUpdate: @ 81890CC - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08189120 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818714C - str r1, [r0] -_08189120: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleStatusIconUpdate - - thumb_func_start RecordedOpponentHandleStatusAnimation -RecordedOpponentHandleStatusAnimation: @ 8189144 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08189194 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl DoStatusAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818714C - str r1, [r0] -_08189194: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleStatusAnimation - - thumb_func_start RecordedOpponentHandleStatusXor -RecordedOpponentHandleStatusXor: @ 81891AC - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleStatusXor - - thumb_func_start RecordedOpponentHandleDataTransfer -RecordedOpponentHandleDataTransfer: @ 81891B8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleDataTransfer - - thumb_func_start RecordedOpponentHandleDMA3Transfer -RecordedOpponentHandleDMA3Transfer: @ 81891C4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleDMA3Transfer - - thumb_func_start RecordedOpponentHandlePlayBGM -RecordedOpponentHandlePlayBGM: @ 81891D0 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandlePlayBGM - - thumb_func_start RecordedOpponentHandleCmd32 -RecordedOpponentHandleCmd32: @ 81891DC - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleCmd32 - - thumb_func_start RecordedOpponentHandleTwoReturnValues -RecordedOpponentHandleTwoReturnValues: @ 81891E8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleTwoReturnValues - - thumb_func_start RecordedOpponentHandleChosenMonReturnValue -RecordedOpponentHandleChosenMonReturnValue: @ 81891F4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleChosenMonReturnValue - - thumb_func_start RecordedOpponentHandleOneReturnValue -RecordedOpponentHandleOneReturnValue: @ 8189200 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleOneReturnValue - - thumb_func_start RecordedOpponentHandleOneReturnValue_Duplicate -RecordedOpponentHandleOneReturnValue_Duplicate: @ 818920C - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleOneReturnValue_Duplicate - - thumb_func_start RecordedOpponentHandleCmd37 -RecordedOpponentHandleCmd37: @ 8189218 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleCmd37 - - thumb_func_start RecordedOpponentHandleCmd38 -RecordedOpponentHandleCmd38: @ 8189234 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleCmd38 - - thumb_func_start RecordedOpponentHandleCmd39 -RecordedOpponentHandleCmd39: @ 818926C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleCmd39 - - thumb_func_start RecordedOpponentHandleCmd40 -RecordedOpponentHandleCmd40: @ 8189284 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleCmd40 - - thumb_func_start RecordedOpponentHandleHitAnimation -RecordedOpponentHandleHitAnimation: @ 81892AC - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _081892E0 - bl RecordedOpponentBufferExecCompleted - b _0818930A - .pool -_081892E0: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t2 - str r1, [r0] -_0818930A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleHitAnimation - - thumb_func_start RecordedOpponentHandleCmd42 -RecordedOpponentHandleCmd42: @ 818931C - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleCmd42 - - thumb_func_start RecordedOpponentHandleEffectivenessSound -RecordedOpponentHandleEffectivenessSound: @ 8189328 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0818933C - movs r3, 0xC0 -_0818933C: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl RecordedOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleEffectivenessSound - - thumb_func_start RecordedOpponentHandlePlayFanfareOrBGM -RecordedOpponentHandlePlayFanfareOrBGM: @ 818936C - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _081893A8 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _081893BC - .pool -_081893A8: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_081893BC: - bl RecordedOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandlePlayFanfareOrBGM - - thumb_func_start RecordedOpponentHandleFaintingCry -RecordedOpponentHandleFaintingCry: @ 81893C8 - push {lr} - 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, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - movs r2, 0x5 - bl PlayCry3 - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleFaintingCry - - thumb_func_start RecordedOpponentHandleIntroSlide -RecordedOpponentHandleIntroSlide: @ 8189404 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleIntroSlide - - thumb_func_start RecordedOpponentHandleIntroTrainerBallThrow -RecordedOpponentHandleIntroTrainerBallThrow: @ 8189438 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_818962C - bl StoreSpriteCallbackInData6 - ldr r0, =c3_0803D564 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r6] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - 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, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081894FA - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_081894FA: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_70 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleIntroTrainerBallThrow - - thumb_func_start c3_0803D564 -c3_0803D564: @ 8189548 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189582 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081895B4 -_08189582: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_81885D8 - b _081895F4 - .pool -_081895B4: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r6, =gBattlePartyID - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_81885D8 - ldrb r0, [r7] - movs r5, 0x2 - eors r0, r5 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_81885D8 - ldrb r0, [r7] - eors r0, r5 - strb r0, [r7] -_081895F4: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818686C - str r1, [r0] - mov r0, r9 - strb r0, [r2] - mov r0, r8 - bl DestroyTask - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c3_0803D564 - - thumb_func_start sub_818962C -sub_818962C: @ 818962C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x6] - bl FreeTrainerFrontPicPalette - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_818962C - - thumb_func_start RecordedOpponentHandleDrawPartyStatusSummary -RecordedOpponentHandleDrawPartyStatusSummary: @ 8189648 - push {r4-r7,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08189678 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08189678 - bl RecordedOpponentBufferExecCompleted - b _08189742 - .pool -_08189678: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldr r1, =gBattleBufferA - ldrb r2, [r3] - lsls r0, r2, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r3, 0 - cmp r0, 0 - beq _081896E4 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r2, [r3, 0x1] - lsls r1, r2, 27 - lsrs r0, r1, 28 - cmp r0, 0x1 - bhi _081896DC - adds r0, 0x1 - movs r1, 0xF - ands r0, r1 - lsls r0, 1 - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x1] - b _08189742 - .pool -_081896DC: - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - strb r0, [r3, 0x1] -_081896E4: - adds r5, r7, 0 - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08189736 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_08189736: - ldr r0, =gBattleBankFunc - ldrb r1, [r7] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818975C - str r0, [r1] -_08189742: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleDrawPartyStatusSummary - - thumb_func_start sub_818975C -sub_818975C: @ 818975C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _08189794 - 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, 0x5] - bl RecordedOpponentBufferExecCompleted -_08189794: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818975C - - thumb_func_start RecordedOpponentHandleCmd49 -RecordedOpponentHandleCmd49: @ 81897A4 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081897D6 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_081897D6: - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleCmd49 - - thumb_func_start RecordedOpponentHandleCmd50 -RecordedOpponentHandleCmd50: @ 81897F4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleCmd50 - - thumb_func_start RecordedOpponentHandleSpriteInvisibility -RecordedOpponentHandleSpriteInvisibility: @ 8189800 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _08189846 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility -_08189846: - bl RecordedOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleSpriteInvisibility - - thumb_func_start RecordedOpponentHandleBattleAnimation -RecordedOpponentHandleBattleAnimation: @ 8189860 - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081898B8 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _081898AC - bl RecordedOpponentBufferExecCompleted - b _081898B8 - .pool -_081898AC: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818717C - str r0, [r1] -_081898B8: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleBattleAnimation - - thumb_func_start RecordedOpponentHandleLinkStandbyMsg -RecordedOpponentHandleLinkStandbyMsg: @ 81898C8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleLinkStandbyMsg - - thumb_func_start RecordedOpponentHandleResetActionMoveSelection -RecordedOpponentHandleResetActionMoveSelection: @ 81898D4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedOpponentHandleResetActionMoveSelection - - thumb_func_start RecordedOpponentHandleCmd55 -RecordedOpponentHandleCmd55: @ 81898E0 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r2, [r0] - cmp r2, 0x3 - bne _08189908 - ldr r0, =gBattleOutcome - strb r2, [r0] - b _08189910 - .pool -_08189908: - ldr r0, =gBattleOutcome - movs r1, 0x3 - eors r1, r2 - strb r1, [r0] -_08189910: - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl RecordedOpponentBufferExecCompleted - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentHandleCmd55 - - thumb_func_start nullsub_119 -nullsub_119: @ 8189944 - bx lr - thumb_func_end nullsub_119 - - .align 2, 0 @ Don't pad with nop. diff --git a/ld_script.txt b/ld_script.txt index 30f5a797d..a33ea9e71 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -233,7 +233,6 @@ SECTIONS { asm/pokemon_animation.o(.text); asm/recorded_battle.o(.text); src/battle_controller_recorded_opponent.o(.text); - asm/battle_controller_recorded_opponent.o(.text); src/battle_controller_recorded_player.o(.text); src/battle_dome_cards.o(.text); src/lilycove_lady.o(.text); diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index c7613001b..b8e82fe60 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -135,7 +135,7 @@ static void sub_8067618(u8 taskId); static void sub_80676FC(struct Sprite *sprite); static void sub_806782C(void); -static void (*const gLinkOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sLinkOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { LinkOpponentHandleGetMonData, LinkOpponentHandleGetRawMonData, @@ -209,8 +209,8 @@ static void LinkOpponentBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gLinkOpponentBufferCommands)) - gLinkOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sLinkOpponentBufferCommands)) + sLinkOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); else LinkOpponentBufferExecCompleted(); } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index d5ce7ef70..8ad497807 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -129,7 +129,7 @@ static void LinkPartnerDoMoveAnimation(void); static void sub_814DCCC(u8 taskId); static void sub_814DE9C(void); -static void (*const gLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { LinkPartnerHandleGetMonData, LinkPartnerHandleGetRawMonData, @@ -203,8 +203,8 @@ static void LinkPartnerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gLinkPartnerBufferCommands)) - gLinkPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sLinkPartnerBufferCommands)) + sLinkPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); else LinkPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index e6c32adb5..68e328acc 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -169,7 +169,7 @@ static void PlayerDoMoveAnimation(void); static void task05_08033660(u8 taskId); static void sub_805CE38(void); -static void (*const gPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { PlayerHandleGetMonData, PlayerHandleGetRawMonData, @@ -266,8 +266,8 @@ static void PlayerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gPlayerBufferCommands)) - gPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sPlayerBufferCommands)) + sPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); else PlayerBufferExecCompleted(); } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 34ac92e74..283c79e66 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -135,7 +135,7 @@ static void PlayerPartnerDoMoveAnimation(void); static void sub_81BE2C8(u8 taskId); static void sub_81BE498(void); -static void (*const gPlayerPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sPlayerPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { PlayerPartnerHandleGetMonData, PlayerPartnerHandleGetRawMonData, @@ -218,8 +218,8 @@ static void PlayerPartnerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gPlayerPartnerBufferCommands)) - gPlayerPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sPlayerPartnerBufferCommands)) + sPlayerPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); else PlayerPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 9cfd821f5..8f30febe2 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -6,6 +6,7 @@ #include "battle_anim.h" #include "battle_ai_script_commands.h" #include "battle_link_817C95C.h" +#include "recorded_battle.h" #include "pokemon.h" #include "link.h" #include "util.h" @@ -53,80 +54,86 @@ extern struct MusicPlayerInfo gMPlay_BGM; extern struct UnusedControllerStruct gUnknown_02022D0C; extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_B; +extern u8 gUnknown_0203C7B4; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; -extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; -extern const struct BattleMove gBattleMoves[]; -extern const u8 gUnknown_0831F578[]; extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); -extern void sub_81851A8(u8 *); extern u16 sub_8068B48(void); // this file's functions -void RecordedOpponentHandleGetMonData(void); -void RecordedOpponentHandleGetRawMonData(void); -void RecordedOpponentHandleSetMonData(void); -void RecordedOpponentHandleSetRawMonData(void); -void RecordedOpponentHandleLoadMonSprite(void); -void RecordedOpponentHandleSwitchInAnim(void); -void RecordedOpponentHandleReturnMonToBall(void); -void RecordedOpponentHandleDrawTrainerPic(void); -void RecordedOpponentHandleTrainerSlide(void); -void RecordedOpponentHandleTrainerSlideBack(void); -void RecordedOpponentHandleFaintAnimation(void); -void RecordedOpponentHandlePaletteFade(void); -void RecordedOpponentHandleSuccessBallThrowAnim(void); -void RecordedOpponentHandleBallThrowAnim(void); -void RecordedOpponentHandlePause(void); -void RecordedOpponentHandleMoveAnimation(void); -void RecordedOpponentHandlePrintString(void); -void RecordedOpponentHandlePrintStringPlayerOnly(void); -void RecordedOpponentHandleChooseAction(void); -void RecordedOpponentHandleUnknownYesNoBox(void); -void RecordedOpponentHandleChooseMove(void); -void RecordedOpponentHandleChooseItem(void); -void RecordedOpponentHandleChoosePokemon(void); -void RecordedOpponentHandleCmd23(void); -void RecordedOpponentHandleHealthBarUpdate(void); -void RecordedOpponentHandleExpUpdate(void); -void RecordedOpponentHandleStatusIconUpdate(void); -void RecordedOpponentHandleStatusAnimation(void); -void RecordedOpponentHandleStatusXor(void); -void RecordedOpponentHandleDataTransfer(void); -void RecordedOpponentHandleDMA3Transfer(void); -void RecordedOpponentHandlePlayBGM(void); -void RecordedOpponentHandleCmd32(void); -void RecordedOpponentHandleTwoReturnValues(void); -void RecordedOpponentHandleChosenMonReturnValue(void); -void RecordedOpponentHandleOneReturnValue(void); -void RecordedOpponentHandleOneReturnValue_Duplicate(void); -void RecordedOpponentHandleCmd37(void); -void RecordedOpponentHandleCmd38(void); -void RecordedOpponentHandleCmd39(void); -void RecordedOpponentHandleCmd40(void); -void RecordedOpponentHandleHitAnimation(void); -void RecordedOpponentHandleCmd42(void); -void RecordedOpponentHandleEffectivenessSound(void); -void RecordedOpponentHandlePlayFanfareOrBGM(void); -void RecordedOpponentHandleFaintingCry(void); -void RecordedOpponentHandleIntroSlide(void); -void RecordedOpponentHandleIntroTrainerBallThrow(void); -void RecordedOpponentHandleDrawPartyStatusSummary(void); -void RecordedOpponentHandleCmd49(void); -void RecordedOpponentHandleCmd50(void); -void RecordedOpponentHandleSpriteInvisibility(void); -void RecordedOpponentHandleBattleAnimation(void); -void RecordedOpponentHandleLinkStandbyMsg(void); -void RecordedOpponentHandleResetActionMoveSelection(void); -void RecordedOpponentHandleCmd55(void); -void nullsub_119(void); +static void RecordedOpponentHandleGetMonData(void); +static void RecordedOpponentHandleGetRawMonData(void); +static void RecordedOpponentHandleSetMonData(void); +static void RecordedOpponentHandleSetRawMonData(void); +static void RecordedOpponentHandleLoadMonSprite(void); +static void RecordedOpponentHandleSwitchInAnim(void); +static void RecordedOpponentHandleReturnMonToBall(void); +static void RecordedOpponentHandleDrawTrainerPic(void); +static void RecordedOpponentHandleTrainerSlide(void); +static void RecordedOpponentHandleTrainerSlideBack(void); +static void RecordedOpponentHandleFaintAnimation(void); +static void RecordedOpponentHandlePaletteFade(void); +static void RecordedOpponentHandleSuccessBallThrowAnim(void); +static void RecordedOpponentHandleBallThrowAnim(void); +static void RecordedOpponentHandlePause(void); +static void RecordedOpponentHandleMoveAnimation(void); +static void RecordedOpponentHandlePrintString(void); +static void RecordedOpponentHandlePrintStringPlayerOnly(void); +static void RecordedOpponentHandleChooseAction(void); +static void RecordedOpponentHandleUnknownYesNoBox(void); +static void RecordedOpponentHandleChooseMove(void); +static void RecordedOpponentHandleChooseItem(void); +static void RecordedOpponentHandleChoosePokemon(void); +static void RecordedOpponentHandleCmd23(void); +static void RecordedOpponentHandleHealthBarUpdate(void); +static void RecordedOpponentHandleExpUpdate(void); +static void RecordedOpponentHandleStatusIconUpdate(void); +static void RecordedOpponentHandleStatusAnimation(void); +static void RecordedOpponentHandleStatusXor(void); +static void RecordedOpponentHandleDataTransfer(void); +static void RecordedOpponentHandleDMA3Transfer(void); +static void RecordedOpponentHandlePlayBGM(void); +static void RecordedOpponentHandleCmd32(void); +static void RecordedOpponentHandleTwoReturnValues(void); +static void RecordedOpponentHandleChosenMonReturnValue(void); +static void RecordedOpponentHandleOneReturnValue(void); +static void RecordedOpponentHandleOneReturnValue_Duplicate(void); +static void RecordedOpponentHandleCmd37(void); +static void RecordedOpponentHandleCmd38(void); +static void RecordedOpponentHandleCmd39(void); +static void RecordedOpponentHandleCmd40(void); +static void RecordedOpponentHandleHitAnimation(void); +static void RecordedOpponentHandleCmd42(void); +static void RecordedOpponentHandleEffectivenessSound(void); +static void RecordedOpponentHandlePlayFanfareOrBGM(void); +static void RecordedOpponentHandleFaintingCry(void); +static void RecordedOpponentHandleIntroSlide(void); +static void RecordedOpponentHandleIntroTrainerBallThrow(void); +static void RecordedOpponentHandleDrawPartyStatusSummary(void); +static void RecordedOpponentHandleCmd49(void); +static void RecordedOpponentHandleCmd50(void); +static void RecordedOpponentHandleSpriteInvisibility(void); +static void RecordedOpponentHandleBattleAnimation(void); +static void RecordedOpponentHandleLinkStandbyMsg(void); +static void RecordedOpponentHandleResetActionMoveSelection(void); +static void RecordedOpponentHandleCmd55(void); +static void nullsub_119(void); -void RecordedOpponentBufferRunCommand(void); -void RecordedOpponentBufferExecCompleted(void); +static void RecordedOpponentBufferRunCommand(void); +static void RecordedOpponentBufferExecCompleted(void); +static void sub_8186F14(void); +static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst); +static void SetRecordedOpponentMonData(u8 monId); +static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void RecordedOpponentDoMoveAnimation(void); +static void sub_8189548(u8 taskId); +static void sub_818962C(struct Sprite *sprite); +static void sub_818975C(void); -void (*const gRecordedOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sRecordedOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { RecordedOpponentHandleGetMonData, RecordedOpponentHandleGetRawMonData, @@ -187,7 +194,7 @@ void (*const gRecordedOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = nullsub_119 }; -void nullsub_70(void) +static void nullsub_70(void) { } @@ -196,13 +203,1636 @@ void SetBankFuncToRecordedOpponentBufferRunCommand(void) gBattleBankFunc[gActiveBank] = RecordedOpponentBufferRunCommand; } -void RecordedOpponentBufferRunCommand(void) +static void RecordedOpponentBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gRecordedOpponentBufferCommands)) - gRecordedOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sRecordedOpponentBufferCommands)) + sRecordedOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); else RecordedOpponentBufferExecCompleted(); } } + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + RecordedOpponentBufferExecCompleted(); +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + RecordedOpponentBufferExecCompleted(); +} + +static void sub_81865C8(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186630(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186678(void) +{ + bool8 var = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].animEnded) + { + var = TRUE; + } + + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].animEnded + && gSprites[gBankSpriteIds[gActiveBank ^ BIT_MON]].animEnded) + { + var = TRUE; + } + } + + if (var) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + return; + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + return; + + 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); + } + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_8186630; + } +} + +static void sub_818686C(void) +{ + bool32 r9 = FALSE; + bool32 r8 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[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], &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[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) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r9 = TRUE; + } + + if (!IsDoubleBattle()) + { + 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]]); + SetBankEnemyShadowSpriteCallback(gActiveBank ^ BIT_MON, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], MON_DATA_SPECIES)); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_8186678; + } +} + +static void sub_8186C48(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + else + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + RecordedOpponentBufferExecCompleted(); + } + } + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186D58(void) +{ + if (!gSprites[gBankSpriteIds[gActiveBank]].inUse) + { + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186D9C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + RecordedOpponentBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + RecordedOpponentBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_8186EA4(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_8186F14; + } +} + +static void sub_8186F14(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && !IsCryPlayingOrClearCrySongs()) + { + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + || gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy_2) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + RecordedOpponentBufferExecCompleted(); + } + } +} + +static void sub_8186F94(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_8186EA4; + } +} + +static void sub_8187084(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleBankFunc[gActiveBank] = sub_8186F94; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + RecordedOpponentBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = RecordedOpponentBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void RecordedOpponentHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyRecordedOpponentMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyRecordedOpponentMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + RecordedOpponentBufferExecCompleted(); +} + +static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void RecordedOpponentHandleGetRawMonData(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetRecordedOpponentMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetRecordedOpponentMonData(i); + monsToCheck >>= 1; + } + } + RecordedOpponentBufferExecCompleted(); +} + +static void SetRecordedOpponentMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } +} + +static void RecordedOpponentHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleLoadMonSprite(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + + + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleBankFunc[gActiveBank] = sub_8186C48; +} + +static void RecordedOpponentHandleSwitchInAnim(void) +{ + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + sub_81885D8(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_8187084; +} + +static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE); +} + +static void RecordedOpponentHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + gBattleBankFunc[gActiveBank] = sub_8186D9C; + } + break; + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +static void RecordedOpponentHandleDrawTrainerPic(void) +{ + s16 xPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 152; + else // first mon + xPos = 200; + + if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(sub_8185F40()); + } + } + else + { + xPos = 176; + if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + { + trainerPicId = sub_8068B48(); + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[gUnknown_0203C7B4 ^ BIT_SIDE].gender); + } + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + xPos, + (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void RecordedOpponentHandleTrainerSlide(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_81865C8; +} + +static void RecordedOpponentHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039934; + gBattleBankFunc[gActiveBank] = sub_8186D58; + } + } +} + +static void RecordedOpponentHandlePaletteFade(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleSuccessBallThrowAnim(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleBallThrowAnim(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandlePause(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + RecordedOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = RecordedOpponentDoMoveAnimation; + } + } +} + +static void RecordedOpponentDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + RecordedOpponentBufferExecCompleted(); + } + break; + } +} + +static void RecordedOpponentHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void RecordedOpponentHandlePrintStringPlayerOnly(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChooseAction(void) +{ + EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBank), 0); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleUnknownYesNoBox(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + } + else + { + u8 moveId = RecordedBattle_ReadBankAction(gActiveBank); + u8 target = RecordedBattle_ReadBankAction(gActiveBank); + EmitTwoReturnValues(1, 10, moveId | (target << 8)); + } + + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChooseItem(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChoosePokemon(void) +{ + *(gBattleStruct->field_5C + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank); + EmitChosenMonReturnValue(1, *(gBattleStruct->field_5C + gActiveBank), NULL); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd23(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void RecordedOpponentHandleExpUpdate(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedOpponentHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedOpponentHandleStatusXor(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleDataTransfer(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleDMA3Transfer(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandlePlayBGM(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd32(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleTwoReturnValues(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChosenMonReturnValue(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleOneReturnValue(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleOneReturnValue_Duplicate(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + RecordedOpponentBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void RecordedOpponentHandleCmd42(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleFaintingCry(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, 25, 5); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_818962C); + + taskId = CreateTask(sub_8189548, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_70; +} + +static void sub_8189548(u8 taskId) +{ + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81885D8(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81885D8(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81885D8(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_818686C; + gActiveBank = savedActiveBank; + DestroyTask(taskId); +} + +static void sub_818962C(struct Sprite *sprite) +{ + FreeTrainerFrontPicPalette(sprite->oam.affineParam); + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); +} + +static void RecordedOpponentHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + RecordedOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + + if (gBattleBufferA[gActiveBank][2] != 0) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E < 2) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E++; + return; + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E = 0; + } + } + + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_818975C; + } +} + +static void sub_818975C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + RecordedOpponentBufferExecCompleted(); + } +} + +static void RecordedOpponentHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd50(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleSpriteInvisibility(void) +{ + if (AnimBankSpriteExists(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + RecordedOpponentBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void RecordedOpponentHandleLinkStandbyMsg(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleResetActionMoveSelection(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd55(void) +{ + if (gBattleBufferA[gActiveBank][1] == BATTLE_DREW) + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + else + gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ BATTLE_DREW; + + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + RecordedOpponentBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_119(void) +{ +} diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 605268f13..4e71537b0 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -132,7 +132,7 @@ static void RecordedPlayerDoMoveAnimation(void); static void sub_818CC24(u8 taskId); static void sub_818CDF4(void); -static void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { RecordedPlayerHandleGetMonData, RecordedPlayerHandleGetRawMonData, @@ -206,8 +206,8 @@ static void RecordedPlayerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gRecordedPlayerBufferCommands)) - gRecordedPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sRecordedPlayerBufferCommands)) + sRecordedPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); else RecordedPlayerBufferExecCompleted(); } diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 74210e629..6eb19df84 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -110,7 +110,7 @@ static void SafariBufferRunCommand(void); static void SafariBufferExecCompleted(void); static void CompleteWhenChosePokeblock(void); -static void (*const gSafariBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sSafariBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { SafariHandleGetMonData, SafariHandleGetRawMonData, @@ -184,8 +184,8 @@ static void SafariBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gSafariBufferCommands)) - gSafariBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sSafariBufferCommands)) + sSafariBufferCommands[gBattleBufferA[gActiveBank][0]](); else SafariBufferExecCompleted(); } From fa36e23683a27876156d74829c543f69fcd1f297 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 25 Oct 2017 21:57:28 +0200 Subject: [PATCH 18/29] start opponent controller, thx bird --- asm/battle_controller_opponent.s | 5395 ------------------------- asm/battle_tower.s | 20 +- asm/pokenav.s | 4 +- data/trainer_pic_indices.inc | 2 +- include/pokemon.h | 1 + src/battle_controller_link_opponent.c | 19 +- src/battle_controller_opponent.c | 1491 ++++++- src/battle_dome_cards.c | 6 +- src/pokemon_2.c | 4 +- src/pokemon_3.c | 4 +- 10 files changed, 1514 insertions(+), 5432 deletions(-) diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index 1fc43b9e9..d362c2cca 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -6,5403 +6,8 @@ .text - thumb_func_start OpponentBufferRunCommand -OpponentBufferRunCommand: @ 805F180 - 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 _0805F1CC - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0805F1C8 - ldr r0, =gOpponentBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _0805F1CC - .pool -_0805F1C8: - bl OpponentBufferExecCompleted -_0805F1CC: - pop {r0} - bx r0 - thumb_func_end OpponentBufferRunCommand - thumb_func_start sub_805F1D0 -sub_805F1D0: @ 805F1D0 - 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 _0805F1F4 - bl OpponentBufferExecCompleted -_0805F1F4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F1D0 - thumb_func_start sub_805F208 -sub_805F208: @ 805F208 - 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 _0805F22C - bl OpponentBufferExecCompleted -_0805F22C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F208 - - thumb_func_start sub_805F240 -sub_805F240: @ 805F240 - push {r4-r6,lr} - ldr r5, =gSprites - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805F292 - adds r0, r2, r5 - ldrh r0, [r0, 0x6] - bl FreeTrainerFrontPicPalette - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - bl OpponentBufferExecCompleted -_0805F292: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F240 - - thumb_func_start sub_805F2A8 -sub_805F2A8: @ 805F2A8 - 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 _0805F2E0 - 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 OpponentBufferExecCompleted -_0805F2E0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F2A8 - - thumb_func_start sub_805F2F0 -sub_805F2F0: @ 805F2F0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F32C - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F31E - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805F32C -_0805F31E: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0805F368 -_0805F32C: - 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 - cmp r1, r0 - bne _0805F34E - movs r1, 0x1 - mov r10, r1 -_0805F34E: - movs r6, 0 - b _0805F3A2 - .pool -_0805F368: - 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 r3, 0x1C - adds r0, r3 - ldr r5, [r0] - ldr r0, =SpriteCallbackDummy - cmp r5, r0 - bne _0805F3A0 - 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, r3 - ldr r0, [r0] - cmp r0, r5 - bne _0805F3A0 - movs r0, 0x1 - mov r10, r0 -_0805F3A0: - movs r6, 0x1 -_0805F3A2: - ldr r3, =gUnknown_020244D8 - ldr r1, =gBattleSpritesDataPtr - mov r8, r1 - ldr r2, [r1] - ldr r7, =gActiveBank - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r5, [r2, 0x4] - adds r0, r5, r0 - str r0, [r3] - ldr r2, =gUnknown_020244DC - ldrb r0, [r7] - movs r1, 0x2 - mov r9, r1 - mov r1, r9 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5, r0 - str r0, [r2] - mov r0, r10 - cmp r0, 0 - bne _0805F3D8 - b _0805F53C -_0805F3D8: - cmp r6, 0x1 - bne _0805F494 - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r5 - ldrb r1, [r4, 0x1] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F3F2 - b _0805F53C -_0805F3F2: - mov r0, r9 - eors r0, r2 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x1] - ands r6, r0 - cmp r6, 0 - bne _0805F408 - b _0805F53C -_0805F408: - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r8 - ldr r0, [r1] - ldrb r2, [r7] - 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, r8 - ldr r2, [r0] - ldrb r0, [r7] - mov r1, r9 - 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, r8 - ldr r2, [r1] - ldrb r0, [r7] - mov r1, r9 - 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 - b _0805F51A - .pool -_0805F494: - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805F53C - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _0805F4E4 - mov r0, r8 - ldr r2, [r0] - ldrb r0, [r7] - mov r1, r9 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - bne _0805F53C - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag -_0805F4E4: - mov r1, r8 - ldr r0, [r1] - ldr r1, =gActiveBank - ldrb r2, [r1] - 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] - mov r1, r8 - ldr r0, [r1] - ldr r1, =gActiveBank - ldrb r2, [r1] - 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] -_0805F51A: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - 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 - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F2A8 - str r1, [r0] -_0805F53C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F2F0 - - thumb_func_start sub_805F560 -sub_805F560: @ 805F560 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - mov r10, r0 - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - movs r6, 0xC4 - lsls r6, 1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F5A6 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0805F5A6: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x00008040 - ands r0, r1 - cmp r0, 0 - bne _0805F5EE - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F5EE - ldr r2, [r5] - ldrb r1, [r4] - movs r0, 0x2 - adds r3, r0, 0 - eors r3, r1 - ldr r1, [r2, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F5EE - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_0805F5EE: - ldr r2, =gBattleSpritesDataPtr - ldr r0, [r2] - ldr r1, =gActiveBank - mov r8, r1 - ldrb r4, [r1] - ldr r5, [r0, 0x4] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r3, r0, r5 - ldrb r1, [r3] - movs r6, 0x8 - adds r0, r6, 0 - ands r0, r1 - mov r9, r2 - cmp r0, 0 - bne _0805F6D0 - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F6D0 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0805F6B4 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F684 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805F684 - ldr r4, =gHealthBoxesIds - mov r1, r8 - ldrb r0, [r1] - adds r1, r7, 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, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - mov r1, r8 - ldrb r0, [r1] - eors r0, r7 - bl sub_8076918 - mov r1, r8 - ldrb r0, [r1] - eors r0, r7 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0805F684: - 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, =gEnemyParty - 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 -_0805F6B4: - ldr r3, =gBattleSpritesDataPtr - ldr r2, [r3] - 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] - mov r9, r3 -_0805F6D0: - mov r1, r9 - ldr r0, [r1] - 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 _0805F792 - 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 _0805F792 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0805F792 - mov r1, r9 - ldr r0, [r1] - ldrb r4, [r4] - ldr r1, [r0, 0x4] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0805F774 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _0805F768 - adds r0, r4, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0805F774 - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _0805F774 - .pool -_0805F768: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_0805F774: - 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 - str r0, [sp] -_0805F792: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F7B2 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F810 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0805F810 -_0805F7B2: - 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 _0805F86E - 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 _0805F86E - movs r1, 0x1 - mov r10, r1 - b _0805F86E - .pool -_0805F810: - 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 _0805F86E - 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 _0805F86E - 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 _0805F86E - 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 _0805F86E - movs r0, 0x1 - mov r10, r0 -_0805F86E: - ldr r1, [sp] - cmp r1, 0 - beq _0805F958 - mov r0, r10 - cmp r0, 0 - beq _0805F958 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F8D2 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805F8D2 - ldr r1, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x2 - eors 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 - ldrb r0, [r5] - eors r4, r0 - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback -_0805F8D2: - 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 - ldrb r5, [r4] - ldr r1, =gBattlePartyID - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - bl SetBankEnemyShadowSpriteCallback - 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_805F2F0 - str r1, [r0] -_0805F958: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F560 - - thumb_func_start sub_805F994 -sub_805F994: @ 805F994 - push {r4,r5,lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - 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 _0805F9E0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - bne _0805F9E0 - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_0805F9E0: - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r3, [r5] - adds r0, r3, r0 - 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 _0805FA48 - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r2, r0, r1 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805FA48 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r4] - ldrb r2, [r5] - 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 - bl OpponentBufferExecCompleted -_0805FA48: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F994 - - thumb_func_start sub_805FA70 -sub_805FA70: @ 805FA70 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - ldr r5, =gHealthBoxesIds - adds r1, r0, r5 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0805FAB8 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _0805FABC - .pool -_0805FAB8: - bl OpponentBufferExecCompleted -_0805FABC: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_805FA70 - - thumb_func_start sub_805FAC4 -sub_805FAC4: @ 805FAC4 - push {lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _0805FAF2 - ldr r0, =gHealthBoxesIds - adds r0, r3, r0 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl OpponentBufferExecCompleted -_0805FAF2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FAC4 - - thumb_func_start sub_805FB08 -sub_805FB08: @ 805FB08 - 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 _0805FB62 - 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 - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl OpponentBufferExecCompleted -_0805FB62: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FB08 - - thumb_func_start bx_t7_button_a -bx_t7_button_a: @ 805FB7C - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0805FB8E - bl OpponentBufferExecCompleted -_0805FB8E: - pop {r0} - bx r0 - thumb_func_end bx_t7_button_a - - thumb_func_start bx_blink_t7 -bx_blink_t7: @ 805FB94 - 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 _0805FBE0 - 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 OpponentBufferExecCompleted - b _0805FC0A - .pool -_0805FBE0: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0805FC04 - 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] -_0805FC04: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_0805FC0A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t7 - - thumb_func_start sub_805FC10 -sub_805FC10: @ 805FC10 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - 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 _0805FC5C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805FC50 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_0805FC50: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_803AEDC - str r0, [r1] -_0805FC5C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FC10 - - thumb_func_start bx_803AEDC -bx_803AEDC: @ 805FC80 - 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 _0805FCDA - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0805FCDA - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - 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, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0805FCCA - ldr r0, =SpriteCallbackDummy_2 - cmp r1, r0 - bne _0805FCDA -_0805FCCA: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - bl OpponentBufferExecCompleted -_0805FCDA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bx_803AEDC - - thumb_func_start sub_805FD00 -sub_805FD00: @ 805FD00 - push {r4-r7,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r1, [r3, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805FDBC - ldr r7, =gSprites - ldr r6, =gBankSpriteIds - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r7, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805FDBC - ldrb r1, [r3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r3] - ldr r0, [r4] - ldrb r2, [r5] - 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 - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0 - bl StartSpriteAnim - 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, =gEnemyParty - 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 - ldrb r0, [r5] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FC10 - str r1, [r0] -_0805FDBC: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FD00 - - thumb_func_start sub_805FDF0 -sub_805FDF0: @ 805FDF0 - 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 _0805FE22 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0805FE22: - 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 _0805FE8C - 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 _0805FE8C - adds r0, r3, r4 - bl DestroySprite - ldrb r4, [r5] - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FD00 - str r1, [r0] -_0805FE8C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FDF0 - - thumb_func_start sub_805FEB8 -sub_805FEB8: @ 805FEB8 - 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 _0805FEDA - bl OpponentBufferExecCompleted -_0805FEDA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FEB8 - - thumb_func_start bx_803B0F4 -bx_803B0F4: @ 805FEE8 - 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 _0805FF0A - bl OpponentBufferExecCompleted -_0805FF0A: - pop {r0} - bx r0 - .pool - thumb_func_end bx_803B0F4 - - thumb_func_start OpponentBufferExecCompleted -OpponentBufferExecCompleted: @ 805FF18 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =OpponentBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0805FF6C - 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 _0805FF7E - .pool -_0805FF6C: - 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] -_0805FF7E: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentBufferExecCompleted - - thumb_func_start OpponentHandleGetMonData -OpponentHandleGetMonData: @ 805FF90 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0805FFC8 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_8060004 - adds r6, r0, 0 - b _0805FFEA - .pool -_0805FFC8: - ldrb r4, [r1] - movs r5, 0 -_0805FFCC: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0805FFE2 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_8060004 - adds r6, r0 -_0805FFE2: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0805FFCC -_0805FFEA: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl OpponentBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end OpponentHandleGetMonData - - thumb_func_start sub_8060004 -sub_8060004: @ 8060004 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0806002E - bl _0806079A -_0806002E: - lsls r0, 2 - ldr r1, =_08060044 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08060044: - .4byte _08060134 - .4byte _08060358 - .4byte _08060368 - .4byte _08060378 - .4byte _080603E0 - .4byte _080603E0 - .4byte _080603E0 - .4byte _080603E0 - .4byte _080603FC - .4byte _08060438 - .4byte _08060438 - .4byte _08060438 - .4byte _08060438 - .4byte _0806079A - .4byte _0806079A - .4byte _0806079A - .4byte _0806079A - .4byte _08060454 - .4byte _08060464 - .4byte _08060494 - .4byte _080604A4 - .4byte _080604B4 - .4byte _080604C4 - .4byte _080604D4 - .4byte _080604E4 - .4byte _080604F4 - .4byte _08060504 - .4byte _08060514 - .4byte _08060524 - .4byte _08060534 - .4byte _08060544 - .4byte _08060554 - .4byte _080605A4 - .4byte _080605B4 - .4byte _080605C4 - .4byte _080605D4 - .4byte _080605E4 - .4byte _080605F4 - .4byte _08060604 - .4byte _08060614 - .4byte _08060624 - .4byte _08060658 - .4byte _08060668 - .4byte _08060678 - .4byte _08060688 - .4byte _08060698 - .4byte _080606A8 - .4byte _080606B8 - .4byte _080606C8 - .4byte _080606E8 - .4byte _080606F8 - .4byte _08060708 - .4byte _08060718 - .4byte _08060728 - .4byte _08060738 - .4byte _08060748 - .4byte _08060758 - .4byte _08060768 - .4byte _08060778 - .4byte _08060788 -_08060134: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08060180: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08060180 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_08060338: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _08060338 - b _0806079A - .pool -_08060358: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - b _080606D2 - .pool -_08060368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xC - b _080606D2 - .pool -_08060378: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - mov r8, r9 -_0806038E: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0806038E - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_080603CC: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _080603CC - b _0806079A - .pool -_080603E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _080606D2 - .pool -_080603FC: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gEnemyParty - mov r8, r2 -_08060408: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _08060408 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0806079A - .pool -_08060438: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _08060792 - .pool -_08060454: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1 - b _0806046E - .pool -_08060464: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x19 -_0806046E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0806079A - .pool -_08060494: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1A - b _08060792 - .pool -_080604A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1B - b _08060792 - .pool -_080604B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1C - b _08060792 - .pool -_080604C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1D - b _08060792 - .pool -_080604D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1E - b _08060792 - .pool -_080604E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1F - b _08060792 - .pool -_080604F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x20 - b _08060792 - .pool -_08060504: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x22 - b _08060792 - .pool -_08060514: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x23 - b _08060792 - .pool -_08060524: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x24 - b _08060792 - .pool -_08060534: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x25 - b _08060792 - .pool -_08060544: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x26 - b _08060792 - .pool -_08060554: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0806079A - .pool -_080605A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x27 - b _08060792 - .pool -_080605B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x28 - b _08060792 - .pool -_080605C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x29 - b _08060792 - .pool -_080605D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2A - b _08060792 - .pool -_080605E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2B - b _08060792 - .pool -_080605F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2C - b _08060792 - .pool -_08060604: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0 - b _0806062E - .pool -_08060614: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x9 - b _080606D2 - .pool -_08060624: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x37 -_0806062E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0806079A - .pool -_08060658: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x38 - b _08060792 - .pool -_08060668: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - b _080606D2 - .pool -_08060678: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - b _080606D2 - .pool -_08060688: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3B - b _080606D2 - .pool -_08060698: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3C - b _080606D2 - .pool -_080606A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3D - b _080606D2 - .pool -_080606B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3E - b _080606D2 - .pool -_080606C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3F -_080606D2: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0806079A - .pool -_080606E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x16 - b _08060792 - .pool -_080606F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x17 - b _08060792 - .pool -_08060708: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x18 - b _08060792 - .pool -_08060718: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x21 - b _08060792 - .pool -_08060728: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2F - b _08060792 - .pool -_08060738: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x30 - b _08060792 - .pool -_08060748: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x32 - b _08060792 - .pool -_08060758: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x33 - b _08060792 - .pool -_08060768: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x34 - b _08060792 - .pool -_08060778: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x35 - b _08060792 - .pool -_08060788: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x36 -_08060792: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0806079A: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8060004 - - thumb_func_start OpponentHandleGetRawMonData -OpponentHandleGetRawMonData: @ 80607B0 - push {r4-r7,lr} - sub sp, 0x58 - ldr r2, =gBattlePartyID - ldr r5, =gActiveBank - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - adds r4, r2, 0 - muls r4, r0 - ldr r3, =gBattleBufferA - lsls r1, 9 - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r2, [r0] - ldr r0, =gEnemyParty - adds r0, r2, r0 - adds r6, r4, r0 - mov r0, sp - adds r4, r0, r2 - movs r2, 0 - adds r0, r3, 0x2 - adds r1, r0 - adds r7, r5, 0 - mov r12, r3 - ldrb r1, [r1] - cmp r2, r1 - bcs _08060806 - adds r3, r0, 0 -_080607EC: - adds r1, r4, r2 - adds r0, r6, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldrb r0, [r5] - lsls r0, 9 - adds r0, r3 - ldrb r0, [r0] - cmp r2, r0 - bcc _080607EC -_08060806: - ldrb r0, [r7] - lsls r0, 9 - mov r1, r12 - adds r1, 0x2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - adds r2, r4, 0 - bl EmitDataTransfer - bl OpponentBufferExecCompleted - add sp, 0x58 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleGetRawMonData - - thumb_func_start OpponentHandleSetMonData -OpponentHandleSetMonData: @ 8060838 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08060868 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_8060890 - b _08060886 - .pool -_08060868: - ldrb r4, [r1] - movs r5, 0 -_0806086C: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0806087A - adds r0, r5, 0 - bl sub_8060890 -_0806087A: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0806086C -_08060886: - bl OpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end OpponentHandleSetMonData - - thumb_func_start sub_8060890 -sub_8060890: @ 8060890 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x38 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r4, r0, r2 - adds r7, r4, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r6, r3, 0 - adds r3, r2, 0 - cmp r0, 0x3B - bls _080608BE - bl _0806119C -_080608BE: - lsls r0, 2 - ldr r1, =_080608D4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080608D4: - .4byte _080609C4 - .4byte _08060B5C - .4byte _08060B78 - .4byte _08060B94 - .4byte _08060BE8 - .4byte _08060BE8 - .4byte _08060BE8 - .4byte _08060BE8 - .4byte _08060C08 - .4byte _08060C70 - .4byte _08060C70 - .4byte _08060C70 - .4byte _08060C70 - .4byte _0806119C - .4byte _0806119C - .4byte _0806119C - .4byte _0806119C - .4byte _08060C98 - .4byte _08060CB4 - .4byte _08060CD0 - .4byte _08060CEC - .4byte _08060D08 - .4byte _08060D24 - .4byte _08060D40 - .4byte _08060D5C - .4byte _08060D78 - .4byte _08060D94 - .4byte _08060DB0 - .4byte _08060DCC - .4byte _08060DE8 - .4byte _08060E04 - .4byte _08060E20 - .4byte _08060E94 - .4byte _08060EB0 - .4byte _08060ECC - .4byte _08060EE8 - .4byte _08060F04 - .4byte _08060F20 - .4byte _08060F3C - .4byte _08060F58 - .4byte _08060F74 - .4byte _08060F90 - .4byte _08060FAC - .4byte _08060FC8 - .4byte _08060FE4 - .4byte _08061000 - .4byte _0806101C - .4byte _08061038 - .4byte _08061054 - .4byte _08061070 - .4byte _0806108C - .4byte _080610A8 - .4byte _080610C4 - .4byte _080610E0 - .4byte _080610FC - .4byte _08061118 - .4byte _08061134 - .4byte _08061150 - .4byte _0806116C - .4byte _08061188 -_080609C4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r7, 0 - bl SetMonData - adds r2, r7, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r7 - mov r10, r0 - adds r0, r7, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r7, 0x2 - str r0, [sp, 0x4] - adds r0, r7, 0x4 - str r0, [sp, 0x8] - adds r0, r7, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r6, r7, 0 - adds r6, 0x24 - adds r4, r7, 0 - adds r4, 0xC -_08060A2A: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08060A2A - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r7, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r7, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0806119C - .pool -_08060B5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xB - bl SetMonData - b _0806119C - .pool -_08060B78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xC - bl SetMonData - b _0806119C - .pool -_08060B94: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r4 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r7, r1, r0 - adds r6, r4, 0 - adds r6, 0x8 -_08060BAC: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08060BAC - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0806119C - .pool -_08060BE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _08060C86 - .pool -_08060C08: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x11 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0806119C - .pool -_08060C70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_08060C86: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0806119C - .pool -_08060C98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1 - bl SetMonData - b _0806119C - .pool -_08060CB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x19 - bl SetMonData - b _0806119C - .pool -_08060CD0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1A - bl SetMonData - b _0806119C - .pool -_08060CEC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1B - bl SetMonData - b _0806119C - .pool -_08060D08: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1C - bl SetMonData - b _0806119C - .pool -_08060D24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1D - bl SetMonData - b _0806119C - .pool -_08060D40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1E - bl SetMonData - b _0806119C - .pool -_08060D5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1F - bl SetMonData - b _0806119C - .pool -_08060D78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x20 - bl SetMonData - b _0806119C - .pool -_08060D94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x22 - bl SetMonData - b _0806119C - .pool -_08060DB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x23 - bl SetMonData - b _0806119C - .pool -_08060DCC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x24 - bl SetMonData - b _0806119C - .pool -_08060DE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x25 - bl SetMonData - b _0806119C - .pool -_08060E04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x26 - bl SetMonData - b _0806119C - .pool -_08060E20: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x27 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08060F2E - .pool -_08060E94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x27 - bl SetMonData - b _0806119C - .pool -_08060EB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x28 - bl SetMonData - b _0806119C - .pool -_08060ECC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x29 - bl SetMonData - b _0806119C - .pool -_08060EE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2A - bl SetMonData - b _0806119C - .pool -_08060F04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2B - bl SetMonData - b _0806119C - .pool -_08060F20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 -_08060F2E: - movs r1, 0x2C - bl SetMonData - b _0806119C - .pool -_08060F3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0 - bl SetMonData - b _0806119C - .pool -_08060F58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x9 - bl SetMonData - b _0806119C - .pool -_08060F74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x37 - bl SetMonData - b _0806119C - .pool -_08060F90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x38 - bl SetMonData - b _0806119C - .pool -_08060FAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x39 - bl SetMonData - b _0806119C - .pool -_08060FC8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3A - bl SetMonData - b _0806119C - .pool -_08060FE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3B - bl SetMonData - b _0806119C - .pool -_08061000: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3C - bl SetMonData - b _0806119C - .pool -_0806101C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3D - bl SetMonData - b _0806119C - .pool -_08061038: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3E - bl SetMonData - b _0806119C - .pool -_08061054: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3F - bl SetMonData - b _0806119C - .pool -_08061070: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x16 - bl SetMonData - b _0806119C - .pool -_0806108C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x17 - bl SetMonData - b _0806119C - .pool -_080610A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x18 - bl SetMonData - b _0806119C - .pool -_080610C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x21 - bl SetMonData - b _0806119C - .pool -_080610E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2F - bl SetMonData - b _0806119C - .pool -_080610FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x30 - bl SetMonData - b _0806119C - .pool -_08061118: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x32 - bl SetMonData - b _0806119C - .pool -_08061134: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x33 - bl SetMonData - b _0806119C - .pool -_08061150: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x34 - bl SetMonData - b _0806119C - .pool -_0806116C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x35 - bl SetMonData - b _0806119C - .pool -_08061188: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x36 - bl SetMonData -_0806119C: - add sp, 0x38 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8060890 - - thumb_func_start OpponentHandleSetRawMonData -OpponentHandleSetRawMonData: @ 80611B0 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gEnemyParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _08061208 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_080611E6: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _080611E6 -_08061208: - bl OpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleSetRawMonData - - thumb_func_start OpponentHandleLoadMonSprite -OpponentHandleLoadMonSprite: @ 8061224 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 1 - ldr r1, =gBattlePartyID - adds r0, r1 - ldrh r0, [r0] - movs r7, 0x64 - muls r0, r7 - ldr r2, =gEnemyParty - mov r10, r2 - add r0, r10 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldrb r1, [r6] - lsls r0, r1, 1 - ldr r2, =gBattlePartyID - adds r0, r2 - ldrh r0, [r0] - muls r0, r7 - add r0, r10 - bl BattleLoadOpponentMonSpriteGfx - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldrb r4, [r6] - lsls r0, r4, 1 - ldr r2, =gBattlePartyID - adds r0, r2 - ldrh r0, [r0] - muls r0, r7 - add r0, r10 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F994 - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleLoadMonSprite - - thumb_func_start OpponentHandleSwitchInAnim -OpponentHandleSwitchInAnim: @ 806137C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - adds r0, 0x5C - movs r1, 0x6 - strb r1, [r0] - ldr r1, =gBattlePartyID - ldrb r0, [r4] - lsls r2, r0, 1 - adds r2, r1 - ldr r3, =gBattleBufferA - lsls r0, 9 - adds r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2] - ldrb r0, [r4] - lsls r1, r0, 9 - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - bl sub_80613DC - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FDF0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleSwitchInAnim - - thumb_func_start sub_80613DC -sub_80613DC: @ 80613DC - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl ClearTemporarySpeciesSpriteData - ldr r0, =gBattlePartyID - lsls r4, r6, 1 - adds r4, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4] - ldrh r0, [r4] - movs r1, 0x64 - mov r9, r1 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r10, r1 - add r10, r6 - mov r1, r10 - strb r0, [r1] - ldrh r0, [r4] - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - adds r0, r5 - adds r1, r6, 0 - bl BattleLoadOpponentMonSpriteGfx - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFE - bl sub_80753E8 - mov r1, r10 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80613DC - - thumb_func_start OpponentHandleReturnMonToBall -OpponentHandleReturnMonToBall: @ 806156C - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _080615B4 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8061604 - str r1, [r0] - b _080615F0 - .pool -_080615B4: - 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 - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl OpponentBufferExecCompleted -_080615F0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleReturnMonToBall - - thumb_func_start sub_8061604 -sub_8061604: @ 8061604 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0806162C - cmp r0, 0x1 - beq _0806165A - b _08061682 - .pool -_0806162C: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08061646 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08061646: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08061682 -_0806165A: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08061682 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x2 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FB08 - str r1, [r0] -_08061682: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061604 - - thumb_func_start OpponentHandleDrawTrainerPic -OpponentHandleDrawTrainerPic: @ 8061690 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - lsls r0, 20 - ands r0, r2 - cmp r0, 0 - beq _080616B0 - bl GetSecretBaseTrainerPicIndex - b _0806175A - .pool -_080616B0: - ldr r3, =gTrainerBattleOpponent_A - ldrh r1, [r3] - ldr r0, =0x000003fe - cmp r1, r0 - bne _080616C8 - bl sub_81A4CB0 - b _0806175A - .pool -_080616C8: - movs r0, 0x80 - lsls r0, 19 - ands r0, r2 - cmp r0, 0 - beq _08061708 - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _08061700 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _080616F0 - ldrh r0, [r3] - bl sub_81D5588 - b _0806175A - .pool -_080616F0: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl sub_81D5588 - b _0806175A - .pool -_08061700: - ldrh r0, [r3] - bl sub_81D5588 - b _0806175A -_08061708: - ldr r0, =0x003f0100 - ands r0, r2 - cmp r0, 0 - beq _0806174C - ldr r0, =0x00808000 - ands r2, r0 - cmp r2, 0 - beq _08061744 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08061734 - ldrh r0, [r3] - bl GetFrontierTrainerFrontSpriteId - b _0806175A - .pool -_08061734: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl GetFrontierTrainerFrontSpriteId - b _0806175A - .pool -_08061744: - ldrh r0, [r3] - bl GetFrontierTrainerFrontSpriteId - b _0806175A -_0806174C: - movs r0, 0x80 - lsls r0, 4 - ands r0, r2 - cmp r0, 0 - beq _08061760 - bl sub_8165244 -_0806175A: - lsls r0, 24 - lsrs r4, r0, 24 - b _08061796 -_08061760: - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _08061788 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - beq _08061788 - ldr r2, =gTrainers - ldr r0, =gTrainerBattleOpponent_B - ldrh r1, [r0] - b _0806178C - .pool -_08061788: - ldr r2, =gTrainers - ldrh r1, [r3] -_0806178C: - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r4, [r0, 0x3] -_08061796: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x00008040 - ands r0, r1 - cmp r0, 0 - beq _080617C8 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0xC8 - cmp r1, 0 - beq _080617CA - movs r7, 0x98 - b _080617CA - .pool -_080617C8: - movs r7, 0xB0 -_080617CA: - mov r8, r4 - ldr r5, =gActiveBank - ldrb r1, [r5] - mov r0, r8 - bl DecompressTrainerFrontPic - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r9, r7 - ldr r1, =gTrainerFrontPicCoords - mov r2, r8 - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 14 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r5] - adds r1, r6 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r1, r8 - strh r1, [r0, 0x6] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F1D0 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleDrawTrainerPic - - thumb_func_start OpponentHandleTrainerSlide -OpponentHandleTrainerSlide: @ 80618D8 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - lsls r0, 20 - ands r0, r2 - cmp r0, 0 - beq _080618F8 - bl GetSecretBaseTrainerPicIndex - b _080619A2 - .pool -_080618F8: - ldr r3, =gTrainerBattleOpponent_A - ldrh r1, [r3] - ldr r0, =0x000003fe - cmp r1, r0 - bne _08061910 - bl sub_81A4CB0 - b _080619A2 - .pool -_08061910: - movs r0, 0x80 - lsls r0, 19 - ands r0, r2 - cmp r0, 0 - beq _08061950 - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _08061948 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08061938 - ldrh r0, [r3] - bl sub_81D5588 - b _080619A2 - .pool -_08061938: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl sub_81D5588 - b _080619A2 - .pool -_08061948: - ldrh r0, [r3] - bl sub_81D5588 - b _080619A2 -_08061950: - ldr r0, =0x003f0100 - ands r0, r2 - cmp r0, 0 - beq _08061994 - ldr r0, =0x00808000 - ands r2, r0 - cmp r2, 0 - beq _0806198C - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _0806197C - ldrh r0, [r3] - bl GetFrontierTrainerFrontSpriteId - b _080619A2 - .pool -_0806197C: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl GetFrontierTrainerFrontSpriteId - b _080619A2 - .pool -_0806198C: - ldrh r0, [r3] - bl GetFrontierTrainerFrontSpriteId - b _080619A2 -_08061994: - movs r0, 0x80 - lsls r0, 4 - ands r0, r2 - cmp r0, 0 - beq _080619A8 - bl sub_8165244 -_080619A2: - lsls r0, 24 - lsrs r0, 24 - b _080619DE -_080619A8: - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _080619D0 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - beq _080619D0 - ldr r2, =gTrainers - ldr r0, =gTrainerBattleOpponent_B - ldrh r1, [r0] - b _080619D4 - .pool -_080619D0: - ldr r2, =gTrainers - ldrh r1, [r3] -_080619D4: - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r0, [r0, 0x3] -_080619DE: - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - bl DecompressTrainerFrontPic - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r2, =gTrainerFrontPicCoords - mov r3, r8 - lsls r1, r3, 2 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 14 - adds r2, r1 - asrs r2, 16 - movs r1, 0xB0 - movs r3, 0x1E - bl CreateSprite - ldr r5, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r5 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x60 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x20] - adds r1, 0x20 - strh r1, [r0, 0x20] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r6] - adds r1, r5 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r3, r8 - strh r3, [r0, 0x6] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F208 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleTrainerSlide - - thumb_func_start OpponentHandleTrainerSlideBack -OpponentHandleTrainerSlideBack: @ 8061AF0 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F240 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleTrainerSlideBack - - thumb_func_start OpponentHandleFaintAnimation -OpponentHandleFaintAnimation: @ 8061B9C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _08061BF0 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08061BD0 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08061BD0: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _08061C2C - .pool -_08061BF0: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08061C2C - strb r0, [r3, 0x4] - movs r0, 0x10 - movs r1, 0x3F - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - 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_8039934 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FAC4 - str r1, [r0] -_08061C2C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleFaintAnimation - - thumb_func_start OpponentHandleCmd11 -OpponentHandleCmd11: @ 8061C48 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd11 - - thumb_func_start OpponentHandleCmd12 -OpponentHandleCmd12: @ 8061C54 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd12 - - thumb_func_start OpponentHandleBallThrow -OpponentHandleBallThrow: @ 8061C60 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleBallThrow - - thumb_func_start OpponentHandlePause -OpponentHandlePause: @ 8061C6C - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandlePause - - thumb_func_start OpponentHandleMoveAnimation -OpponentHandleMoveAnimation: @ 8061C78 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _08061C8A - b _08061D9E -_08061C8A: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gTransformedPersonalities - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _08061D80 - bl OpponentBufferExecCompleted - b _08061D9E - .pool -_08061D80: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_7 - str r1, [r0] -_08061D9E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleMoveAnimation - - thumb_func_start bx_move_anim_7 -bx_move_anim_7: @ 8061DB0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _08061E48 - cmp r2, 0x1 - bgt _08061E08 - cmp r2, 0 - beq _08061E12 - b _08061F24 - .pool -_08061E08: - cmp r2, 0x2 - beq _08061E72 - cmp r2, 0x3 - beq _08061EE8 - b _08061F24 -_08061E12: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _08061E34 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_08061E34: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08061F24 -_08061E48: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08061F24 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _08061F24 -_08061E72: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _08061F24 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - 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 _08061EC0 - mov r0, r8 - cmp r0, 0x1 - bhi _08061EC0 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_08061EC0: - 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 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _08061F24 - .pool -_08061EE8: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08061F24 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl OpponentBufferExecCompleted -_08061F24: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_7 - - thumb_func_start OpponentHandlePrintString -OpponentHandlePrintString: @ 8061F34 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t7_button_a - str r1, [r0] - ldrb r0, [r5] - ldrh r1, [r4] - bl sub_81A57E4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandlePrintString - - thumb_func_start OpponentHandlePrintStringPlayerOnly -OpponentHandlePrintStringPlayerOnly: @ 8061F90 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandlePrintStringPlayerOnly - - thumb_func_start OpponentHandleChooseAction -OpponentHandleChooseAction: @ 8061F9C - push {lr} - bl AI_TrySwitchOrUseItem - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleChooseAction - - thumb_func_start OpponentHandleCmd19 -OpponentHandleCmd19: @ 8061FAC - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd19 - - thumb_func_start OpponentHandleChooseMove -OpponentHandleChooseMove: @ 8061FB8 - push {r4-r6,lr} - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - lsls r0, 10 - ands r0, r2 - cmp r0, 0 - beq _08061FE4 - bl ChooseMoveAndTargetInBattlePalace - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA -_08061FD6: - bl EmitTwoReturnValues -_08061FDA: - bl OpponentBufferExecCompleted - b _08062156 - .pool -_08061FE4: - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r1, =gBattleBufferA + 4 - adds r5, r0, r1 - movs r0, 0x93 - lsls r0, 3 - ands r2, r0 - cmp r2, 0 - beq _080620C4 - movs r0, 0xF - bl BattleAI_SetupAIData - bl BattleAI_ChooseMoveOrAction - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - beq _08062022 - cmp r4, 0x5 - bgt _0806201C - cmp r4, 0x4 - beq _08062028 - b _08062040 - .pool -_0806201C: - cmp r4, 0x6 - beq _08062030 - b _08062040 -_08062022: - movs r0, 0x1 - movs r1, 0x4 - b _0806202C -_08062028: - movs r0, 0x1 - movs r1, 0x3 -_0806202C: - movs r2, 0 - b _08061FD6 -_08062030: - ldr r0, =gBankTarget - ldrb r2, [r0] - movs r0, 0x1 - movs r1, 0xF - b _08061FD6 - .pool -_08062040: - ldr r3, =gBattleMoves - lsls r0, r4, 1 - adds r2, r5, r0 - ldrh r1, [r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x6] - movs r0, 0x12 - ands r0, r1 - cmp r0, 0 - beq _08062062 - ldr r0, =gBankTarget - ldr r1, =gActiveBank - ldrb r1, [r1] - strb r1, [r0] -_08062062: - ldrh r1, [r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x6] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0806209C - movs r0, 0 - bl GetBankByIdentity - ldr r5, =gBankTarget - strb r0, [r5] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _0806209C - movs r0, 0x2 - bl GetBankByIdentity - strb r0, [r5] -_0806209C: - ldr r0, =gBankTarget - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - movs r0, 0x1 - movs r1, 0xA - adds r2, r4, 0 - bl EmitTwoReturnValues - b _08061FDA - .pool -_080620C4: - movs r6, 0x3 -_080620C6: - bl Random - adds r4, r0, 0 - ands r4, r6 - lsls r0, r4, 1 - adds r0, r5, r0 - ldrh r2, [r0] - cmp r2, 0 - beq _080620C6 - ldr r1, =gBattleMoves - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x6] - movs r0, 0x12 - ands r0, r1 - cmp r0, 0 - beq _08062108 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - movs r0, 0x1 - movs r1, 0xA - adds r2, r4, 0 - bl EmitTwoReturnValues - b _08062152 - .pool -_08062108: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0806213C - bl Random - movs r1, 0x2 - ands r1, r0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r1, 0 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 16 - orrs r2, r4 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues - b _08062152 - .pool -_0806213C: - movs r0, 0 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 16 - orrs r2, r4 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues -_08062152: - bl OpponentBufferExecCompleted -_08062156: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end OpponentHandleChooseMove thumb_func_start OpponentHandleOpenBag OpponentHandleOpenBag: @ 806215C diff --git a/asm/battle_tower.s b/asm/battle_tower.s index 2b220cb56..0415ffe5c 100755 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -1340,7 +1340,7 @@ GetFrontierTrainerFrontSpriteId: @ 8162AA0 lsls r0, 1 cmp r4, r0 bne _08162AD0 - ldr r1, =gUnknown_0831F578 + ldr r1, =gTrainerClassToFrontPicId ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed @@ -1362,7 +1362,7 @@ _08162AE4: ldr r0, =0x0000012b cmp r4, r0 bhi _08162B08 - ldr r2, =gUnknown_0831F578 + ldr r2, =gTrainerClassToFrontPicId ldr r0, =gUnknown_0203BC88 ldr r1, [r0] movs r0, 0x34 @@ -1383,7 +1383,7 @@ _08162B08: ands r0, r1 cmp r0, 0 beq _08162B38 - ldr r4, =gUnknown_0831F578 + ldr r4, =gTrainerClassToFrontPicId bl sub_818649C lsls r0, 24 lsrs r0, 24 @@ -1391,7 +1391,7 @@ _08162B08: b _08162BC8 .pool _08162B38: - ldr r3, =gUnknown_0831F578 + ldr r3, =gTrainerClassToFrontPicId ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r1, =0xfffffed4 @@ -1413,7 +1413,7 @@ _08162B64: ands r0, r1 cmp r0, 0 bne _08162BB0 - ldr r4, =gUnknown_0831F578 + ldr r4, =gTrainerClassToFrontPicId ldr r3, =gUnknown_08610970 ldr r0, =gSaveBlock2Ptr ldr r1, [r0] @@ -1436,7 +1436,7 @@ _08162B64: b _08162BC8 .pool _08162BB0: - ldr r5, =gUnknown_0831F578 + ldr r5, =gTrainerClassToFrontPicId ldr r4, =gUnknown_08610970 bl sub_81864A8 lsls r0, 24 @@ -5843,9 +5843,9 @@ _08165206: .pool thumb_func_end sub_816515C - thumb_func_start sub_8165244 -sub_8165244: @ 8165244 - ldr r1, =gUnknown_0831F578 + thumb_func_start GetEreaderTrainerFrontSpriteId +GetEreaderTrainerFrontSpriteId: @ 8165244 + ldr r1, =gTrainerClassToFrontPicId ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed @@ -5855,7 +5855,7 @@ sub_8165244: @ 8165244 ldrb r0, [r0] bx lr .pool - thumb_func_end sub_8165244 + thumb_func_end GetEreaderTrainerFrontSpriteId thumb_func_start GetEreaderTrainerClassId GetEreaderTrainerClassId: @ 8165264 diff --git a/asm/pokenav.s b/asm/pokenav.s index 0c7a80742..d115f2a67 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -7890,7 +7890,7 @@ _081CAF34: adds r0, r5, 0 bl sub_81D1BD0 adds r4, r0, 0 - ldr r0, =gUnknown_0831F578 + ldr r0, =gTrainerClassToFrontPicId adds r0, r4, r0 ldrb r0, [r0] b _081CAF6C @@ -28947,7 +28947,7 @@ sub_81D5588: @ 81D5588 adds r3, r0 ldrb r4, [r3, 0x1B] bl sub_81D5710 - ldr r0, =gUnknown_0831F578 + ldr r0, =gTrainerClassToFrontPicId adds r4, r0 ldrb r0, [r4] pop {r4} diff --git a/data/trainer_pic_indices.inc b/data/trainer_pic_indices.inc index 22fb9aaa2..d859c39b7 100644 --- a/data/trainer_pic_indices.inc +++ b/data/trainer_pic_indices.inc @@ -1,5 +1,5 @@ .align 2 -gUnknown_0831F578:: @ 831F578 +gTrainerClassToFrontPicId:: @ 831F578 .byte TRAINER_PIC_HIKER .byte TRAINER_PIC_AQUA_GRUNT_M .byte TRAINER_PIC_POKEMON_BREEDER_F diff --git a/include/pokemon.h b/include/pokemon.h index 98cff2094..9967fcc34 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -647,6 +647,7 @@ u8 GetDefaultMoveTarget(u8 atkBank); u16 PlayerGenderToFrontTrainerPicId(u8 playerGender); void sub_806A1C0(u16 arg0, u8 bankIdentity); void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity); +u8 GetSecretBaseTrainerPicIndex(void); #include "sprite.h" diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index b8e82fe60..95cb80146 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -55,9 +55,8 @@ extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_B; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; -extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; -extern const u8 gUnknown_0831F578[]; +extern const u8 gTrainerClassToFrontPicId[]; extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); @@ -1291,17 +1290,17 @@ static void LinkOpponentHandleDrawTrainerPic(void) || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) { if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) - trainerPicId = gUnknown_0831F578[0x4F]; + trainerPicId = gTrainerClassToFrontPicId[0x4F]; else - trainerPicId = gUnknown_0831F578[0x4E]; + trainerPicId = gTrainerClassToFrontPicId[0x4E]; } else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) { if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) - trainerPicId = gUnknown_0831F578[0x51]; + trainerPicId = gTrainerClassToFrontPicId[0x51]; else - trainerPicId = gUnknown_0831F578[0x50]; + trainerPicId = gTrainerClassToFrontPicId[0x50]; } else { @@ -1320,17 +1319,17 @@ static void LinkOpponentHandleDrawTrainerPic(void) || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gUnknown_0831F578[0x4F]; + trainerPicId = gTrainerClassToFrontPicId[0x4F]; else - trainerPicId = gUnknown_0831F578[0x4E]; + trainerPicId = gTrainerClassToFrontPicId[0x4E]; } else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_SAPPHIRE) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gUnknown_0831F578[0x51]; + trainerPicId = gTrainerClassToFrontPicId[0x51]; else - trainerPicId = gUnknown_0831F578[0x50]; + trainerPicId = gTrainerClassToFrontPicId[0x50]; } else { diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index e55d78912..664d12142 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -4,12 +4,59 @@ #include "battle_message.h" #include "battle_interface.h" #include "battle_anim.h" +#include "battle_link_817C95C.h" +#include "battle_ai_script_commands.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" +#include "rng.h" +#include "pokeball.h" +extern u32 gBattleExecBuffer; extern u8 gActiveBank; +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; extern bool8 gDoingBattleAnim; extern u8 gUnknown_020244CC; +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void *gUnknown_020244D8; +extern void *gUnknown_020244DC; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern u16 gTrainerBattleOpponent_A; +extern u16 gTrainerBattleOpponent_B; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); +extern void sub_81A57E4(u8 bank, u16 stringId); // this file's functions void OpponentHandleGetMonData(void); @@ -23,15 +70,15 @@ void OpponentHandleDrawTrainerPic(void); void OpponentHandleTrainerSlide(void); void OpponentHandleTrainerSlideBack(void); void OpponentHandleFaintAnimation(void); -void OpponentHandleCmd11(void); -void OpponentHandleCmd12(void); +void OpponentHandlePaletteFade(void); +void OpponentHandleSuccessBallThrowAnim(void); void OpponentHandleBallThrow(void); void OpponentHandlePause(void); void OpponentHandleMoveAnimation(void); void OpponentHandlePrintString(void); void OpponentHandlePrintStringPlayerOnly(void); void OpponentHandleChooseAction(void); -void OpponentHandleCmd19(void); +void OpponentHandleUnknownYesNoBox(void); void OpponentHandleChooseMove(void); void OpponentHandleOpenBag(void); void OpponentHandleChoosePokemon(void); @@ -71,6 +118,13 @@ void OpponentHandleCmd55(void); void nullsub_91(void); void OpponentBufferRunCommand(void); +void OpponentBufferExecCompleted(void); +void bx_803AEDC(void); +u32 sub_8060004(u8 monId, u8 *dst); +void sub_8060890(u8 monId); +void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit); +void DoSwitchOutAnimation(void); +void OpponentDoMoveAnimation(void); void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { @@ -85,15 +139,15 @@ void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = OpponentHandleTrainerSlide, OpponentHandleTrainerSlideBack, OpponentHandleFaintAnimation, - OpponentHandleCmd11, - OpponentHandleCmd12, + OpponentHandlePaletteFade, + OpponentHandleSuccessBallThrowAnim, OpponentHandleBallThrow, OpponentHandlePause, OpponentHandleMoveAnimation, OpponentHandlePrintString, OpponentHandlePrintStringPlayerOnly, OpponentHandleChooseAction, - OpponentHandleCmd19, + OpponentHandleUnknownYesNoBox, OpponentHandleChooseMove, OpponentHandleOpenBag, OpponentHandleChoosePokemon, @@ -134,7 +188,7 @@ void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = }; // unknown unused data -static const u8 gUnknown_0831C7AC[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20}; +static const u8 sUnknown_0831C7AC[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20}; void nullsub_26(void) { @@ -144,3 +198,1426 @@ void SetBankFuncToOpponentBufferRunCommand(void) { gBattleBankFunc[gActiveBank] = OpponentBufferRunCommand; } + +void OpponentBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gOpponentBufferCommands)) + gOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + OpponentBufferExecCompleted(); + } +} + +void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + OpponentBufferExecCompleted(); +} + +void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + OpponentBufferExecCompleted(); +} + +void sub_805F240(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + OpponentBufferExecCompleted(); + } +} + +void sub_805F2A8(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + OpponentBufferExecCompleted(); + } +} + +void sub_805F2F0(void) +{ + bool8 var = FALSE; + bool8 var2; + + if (!IsDoubleBattle() || ((IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) || (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + var = TRUE; + var2 = FALSE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + var = TRUE; + var2 = TRUE; + } + + gUnknown_020244D8 = &gBattleSpritesDataPtr->healthBoxesData[gActiveBank]; + gUnknown_020244DC = &gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON]; + + if (var) + { + if (var2 == TRUE) + { + if (var2 && 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); + } + else + return; + } + else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + if (GetBankIdentity(gActiveBank) == 3) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 == 0 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 == 0) + { + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + } + else + return; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + } + else + return; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_805F2A8; + } +} + +void sub_805F560(void) +{ + bool32 sp = FALSE; + bool32 r10 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI) && IsDoubleBattle() && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[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], &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[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) + { + if (GetBankIdentity(gActiveBank) == 1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + sp = TRUE; + } + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + r10 = 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) + { + r10 = TRUE; + } + } + + if (sp && r10) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + SetBankEnemyShadowSpriteCallback(gActiveBank ^ BIT_MON, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], MON_DATA_SPECIES)); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_805F2F0; + } +} + +void sub_805F994(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + OpponentBufferExecCompleted(); + } +} + +void sub_805FA70(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + OpponentBufferExecCompleted(); +} + +void sub_805FAC4(void) +{ + if (!gSprites[gBankSpriteIds[gActiveBank]].inUse) + { + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + OpponentBufferExecCompleted(); + } +} + +void sub_805FB08(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + OpponentBufferExecCompleted(); + } +} + +void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + OpponentBufferExecCompleted(); +} + +void bx_blink_t7(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + OpponentBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +void sub_805FC10(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleBankFunc[gActiveBank] = bx_803AEDC; + } +} + +void bx_803AEDC(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive && !IsCryPlayingOrClearCrySongs()) + { + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy || gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy_2) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + OpponentBufferExecCompleted(); + } + } +} + +void sub_805FD00(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_805FC10; + } +} + +void sub_805FDF0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleBankFunc[gActiveBank] = sub_805FD00; + } +} + +void sub_805FEB8(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + OpponentBufferExecCompleted(); +} + +void bx_803B0F4(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + OpponentBufferExecCompleted(); +} + +void OpponentBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = OpponentBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +void OpponentHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += sub_8060004(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += sub_8060004(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + OpponentBufferExecCompleted(); +} + +u32 sub_8060004(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +void OpponentHandleGetRawMonData(void) +{ + struct BattlePokemon battleMon; + u8 *src = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 *dst = (u8 *)&battleMon + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = src[i]; + + EmitDataTransfer(1, gBattleBufferA[gActiveBank][2], dst); + OpponentBufferExecCompleted(); +} + +void OpponentHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + sub_8060890(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + sub_8060890(i); + monsToCheck >>= 1; + } + } + OpponentBufferExecCompleted(); +} + +void sub_8060890(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } +} + +void OpponentHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + OpponentBufferExecCompleted(); +} + +void OpponentHandleLoadMonSprite(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].data2 = species; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleBankFunc[gActiveBank] = sub_805F994; +} + +void OpponentHandleSwitchInAnim(void) +{ + *(gBattleStruct->field_5C + gActiveBank) = 6; + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + sub_80613DC(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_805FDF0; +} + +void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE); +} + +void OpponentHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + OpponentBufferExecCompleted(); + } +} + +void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + gBattleBankFunc[gActiveBank] = sub_805FB08; + } + break; + } +} + +u8 sub_81A4CB0(void); +u8 sub_81D5588(u16 trainerId); +u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +u8 GetEreaderTrainerFrontSpriteId(void); + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +void OpponentHandleDrawTrainerPic(void) +{ + u32 trainerPicId; + s16 xPos; + + if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) + { + trainerPicId = GetSecretBaseTrainerPicIndex(); + } + else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE) + { + trainerPicId = sub_81A4CB0(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_x4000000) + { + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank == 1) + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + else + trainerPicId = sub_81D5588(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + { + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_EREADER_TRAINER) + { + trainerPicId = GetEreaderTrainerFrontSpriteId(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank != 1) + trainerPicId = gTrainers[gTrainerBattleOpponent_B].trainerPic; + else + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + else + { + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + + if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS)) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 152; + else // first mon + xPos = 200; + } + else + { + xPos = 176; + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + xPos, + (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +void OpponentHandleTrainerSlide(void) +{ + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) + { + trainerPicId = GetSecretBaseTrainerPicIndex(); + } + else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE) + { + trainerPicId = sub_81A4CB0(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_x4000000) + { + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank == 1) + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + else + trainerPicId = sub_81D5588(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + { + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_EREADER_TRAINER) + { + trainerPicId = GetEreaderTrainerFrontSpriteId(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank != 1) + trainerPicId = gTrainers[gTrainerBattleOpponent_B].trainerPic; + else + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + else + { + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96; + gSprites[gBankSpriteIds[gActiveBank]].pos1.x += 32; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; +} + +void OpponentHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_805F240; +} + +void OpponentHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039934; + gBattleBankFunc[gActiveBank] = sub_805FAC4; + } + } +} + +void OpponentHandlePaletteFade(void) +{ + OpponentBufferExecCompleted(); +} + +void OpponentHandleSuccessBallThrowAnim(void) +{ + OpponentBufferExecCompleted(); +} + +void OpponentHandleBallThrow(void) +{ + OpponentBufferExecCompleted(); +} + +void OpponentHandlePause(void) +{ + OpponentBufferExecCompleted(); +} + +void OpponentHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + OpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = OpponentDoMoveAnimation; + } + } +} + +void OpponentDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + OpponentBufferExecCompleted(); + } + break; + } +} + +void OpponentHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; + sub_81A57E4(gActiveBank, *stringId); +} + +void OpponentHandlePrintStringPlayerOnly(void) +{ + OpponentBufferExecCompleted(); +} + +void OpponentHandleChooseAction(void) +{ + AI_TrySwitchOrUseItem(); + OpponentBufferExecCompleted(); +} + +void OpponentHandleUnknownYesNoBox(void) +{ + OpponentBufferExecCompleted(); +} + +void OpponentHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + OpponentBufferExecCompleted(); + } + else + { + u8 chosenMoveId; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER)) + { + + BattleAI_SetupAIData(0xF); + chosenMoveId = BattleAI_ChooseMoveOrAction(); + + switch (chosenMoveId) + { + case 5: + EmitTwoReturnValues(1, ACTION_WATCHES_CAREFULLY, 0); + break; + case 4: + EmitTwoReturnValues(1, ACTION_RUN, 0); + break; + case 6: + EmitTwoReturnValues(1, 15, gBankTarget); + break; + default: + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_x10)) + gBankTarget = gActiveBank; + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) + { + gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON1); + if (gAbsentBankFlags & gBitTable[gBankTarget]) + gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); + } + EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBankTarget << 8)); + break; + } + OpponentBufferExecCompleted(); + } + else + { + u16 move; + do + { + chosenMoveId = Random() & 3; + move = moveInfo->moves[chosenMoveId]; + } while (move == MOVE_NONE); + + if (gBattleMoves[move].target & (MOVE_TARGET_USER | MOVE_TARGET_x10)) + EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBank << 8)); + else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(Random() & 2) << 8)); + else + EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(IDENTITY_PLAYER_MON1) << 8)); + + OpponentBufferExecCompleted(); + } + } +} diff --git a/src/battle_dome_cards.c b/src/battle_dome_cards.c index 5251ee06a..030290a0d 100644 --- a/src/battle_dome_cards.c +++ b/src/battle_dome_cards.c @@ -19,7 +19,7 @@ extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const union AnimCmd *const gUnknown_082FF70C[]; extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[NUM_SPECIES]; extern const union AnimCmd *const *const gUnknown_0830536C[]; -extern const u8 gUnknown_0831F578[]; +extern const u8 gTrainerClassToFrontPicId[]; // Static type declarations @@ -421,9 +421,9 @@ u8 sub_818D97C(u8 a0, u8 a1) switch (a0) { default: - return gUnknown_0831F578[0x3F]; + return gTrainerClassToFrontPicId[0x3F]; case 0: - return gUnknown_0831F578[0x3C]; + return gTrainerClassToFrontPicId[0x3C]; } } return a0; diff --git a/src/pokemon_2.c b/src/pokemon_2.c index b0ec7460d..b78fd3db8 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -1222,14 +1222,14 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord) } } -extern const u8 gUnknown_0831F578[]; +extern const u8 gTrainerClassToFrontPicId[]; extern const u8 gTrainerClassToNameIndex[]; extern const u8 gSecretBaseTrainerClasses[][5]; u8 GetSecretBaseTrainerPicIndex(void) { u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5]; - return gUnknown_0831F578[trainerClass]; + return gTrainerClassToFrontPicId[trainerClass]; } u8 GetSecretBaseTrainerNameIndex(void) diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 73d23fe6f..f5043db01 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1652,11 +1652,11 @@ u8 sub_806EF84(u8 arg0, u8 arg1) return i; } -extern const u8 gUnknown_0831F578[]; +extern const u8 gTrainerClassToFrontPicId[]; u16 sub_806EFF0(u16 arg0) { - return gUnknown_0831F578[arg0]; + return gTrainerClassToFrontPicId[arg0]; } u16 PlayerGenderToFrontTrainerPicId(u8 playerGender) From 15061844651c0d0cdbe5ec0a3097b054d58e7f88 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 26 Oct 2017 23:12:48 +0200 Subject: [PATCH 19/29] battle controller opponent is done --- asm/battle_7.s | 4 +- asm/battle_anim_80A5C6C.s | 10 +- asm/battle_controller_opponent.s | 1263 --------------------- include/battle.h | 2 +- include/battle_anim.h | 2 +- include/battle_controllers.h | 18 +- ld_script.txt | 1 - src/battle_ai_switch_items.c | 2 +- src/battle_anim.c | 2 +- src/battle_controller_link_opponent.c | 4 +- src/battle_controller_link_partner.c | 4 +- src/battle_controller_opponent.c | 682 ++++++++--- src/battle_controller_player.c | 4 +- src/battle_controller_player_partner.c | 4 +- src/battle_controller_recorded_opponent.c | 4 +- src/battle_controller_recorded_player.c | 4 +- src/battle_controller_safari.c | 2 +- src/battle_controller_wally.c | 2 +- src/battle_controllers.c | 128 +-- 19 files changed, 649 insertions(+), 1493 deletions(-) delete mode 100644 asm/battle_controller_opponent.s diff --git a/asm/battle_7.s b/asm/battle_7.s index d86c68dfc..87c7b2713 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -3111,7 +3111,7 @@ sub_805EB9C: @ 805EB9C _0805EBC8: lsls r0, r5, 24 lsrs r0, 24 - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 beq _0805EC60 @@ -3329,7 +3329,7 @@ sub_805ED70: @ 805ED70 cmp r0, 0 beq _0805EDAC adds r0, r4, 0 - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 bne _0805EDC0 diff --git a/asm/battle_anim_80A5C6C.s b/asm/battle_anim_80A5C6C.s index fa05e36ce..705146ce5 100644 --- a/asm/battle_anim_80A5C6C.s +++ b/asm/battle_anim_80A5C6C.s @@ -726,7 +726,7 @@ GetAnimBankSpriteId: @ 80A6240 bne _080A6268 ldr r4, =gAnimBankAttacker ldrb r0, [r4] - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 beq _080A62B6 @@ -739,7 +739,7 @@ _080A6268: bne _080A6288 ldr r4, =gAnimBankTarget ldrb r0, [r4] - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 beq _080A62B6 @@ -1862,8 +1862,8 @@ _080A6A7E: .pool thumb_func_end GetBankByIdentity - thumb_func_start AnimBankSpriteExists -AnimBankSpriteExists: @ 80A6A90 + thumb_func_start IsBankSpritePresent +IsBankSpritePresent: @ 80A6A90 push {r4,r5,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -1926,7 +1926,7 @@ _080A6B1A: pop {r4,r5} pop {r1} bx r1 - thumb_func_end AnimBankSpriteExists + thumb_func_end IsBankSpritePresent thumb_func_start IsDoubleBattle IsDoubleBattle: @ 80A6B20 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s deleted file mode 100644 index d362c2cca..000000000 --- a/asm/battle_controller_opponent.s +++ /dev/null @@ -1,1263 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - - thumb_func_start OpponentHandleOpenBag -OpponentHandleOpenBag: @ 806215C - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - lsrs r0, 1 - ldr r1, =gBattleStruct - ldr r1, [r1] - lsls r0, 1 - adds r0, r1 - adds r0, 0xC0 - ldrb r1, [r0] - movs r0, 0x1 - bl EmitOneReturnValue - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleOpenBag - - thumb_func_start OpponentHandleChoosePokemon -OpponentHandleChoosePokemon: @ 8062188 - push {r4-r7,lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - movs r2, 0xA5 - lsls r2, 2 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x6 - bne _08062254 - bl GetMostSuitableMonToSwitchInto - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bne _0806225A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080621D4 - movs r0, 0x1 - bl GetBankByIdentity - lsls r0, 24 - lsrs r5, r0, 24 - adds r7, r5, 0 - b _080621E8 - .pool -_080621D4: - movs r0, 0x1 - bl GetBankByIdentity - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0x3 - bl GetBankByIdentity - lsls r0, 24 - lsrs r5, r0, 24 -_080621E8: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x00808000 - ands r0, r1 - cmp r0, 0 - beq _08062214 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08062210 - movs r0, 0 - movs r6, 0x3 - b _08062218 - .pool -_08062210: - movs r0, 0x3 - b _08062216 -_08062214: - movs r0, 0 -_08062216: - movs r6, 0x6 -_08062218: - adds r4, r0, 0 - b _0806221E -_0806221C: - adds r4, 0x1 -_0806221E: - cmp r4, r6 - bge _0806225A - movs r0, 0x64 - muls r0, r4 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _0806221C - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _0806221C - lsls r0, r5, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _0806221C - b _0806225A - .pool -_08062254: - ldrb r4, [r1] - movs r0, 0x6 - strb r0, [r1] -_0806225A: - ldr r0, =gActiveBank - ldrb r0, [r0] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - adds r0, 0x5C - strb r4, [r0] - lsls r1, r4, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitChosenMonReturnValue - bl OpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleChoosePokemon - - thumb_func_start OpponentHandleCmd23 -OpponentHandleCmd23: @ 8062288 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd23 - - thumb_func_start OpponentHandleHealthBarUpdate -OpponentHandleHealthBarUpdate: @ 8062294 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x3 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r1, 8 - adds r3, 0x2 - adds r2, r3 - ldrb r0, [r2] - orrs r0, r1 - lsls r0, 16 - asrs r7, r0, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _08062324 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gEnemyParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0806234E - .pool -_08062324: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0806234E: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FA70 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleHealthBarUpdate - - thumb_func_start OpponentHandleExpUpdate -OpponentHandleExpUpdate: @ 8062384 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleExpUpdate - - thumb_func_start OpponentHandleStatusIconUpdate -OpponentHandleStatusIconUpdate: @ 8062390 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _080623E4 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FEB8 - str r1, [r0] -_080623E4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleStatusIconUpdate - - thumb_func_start OpponentHandleStatusAnimation -OpponentHandleStatusAnimation: @ 8062408 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08062458 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl DoStatusAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FEB8 - str r1, [r0] -_08062458: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleStatusAnimation - - thumb_func_start OpponentHandleStatusXor -OpponentHandleStatusXor: @ 8062470 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleStatusXor - - thumb_func_start OpponentHandleDataTransfer -OpponentHandleDataTransfer: @ 806247C - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleDataTransfer - - thumb_func_start OpponentHandleDMA3Transfer -OpponentHandleDMA3Transfer: @ 8062488 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleDMA3Transfer - - thumb_func_start OpponentHandlePlayBGM -OpponentHandlePlayBGM: @ 8062494 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandlePlayBGM - - thumb_func_start OpponentHandleCmd32 -OpponentHandleCmd32: @ 80624A0 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd32 - - thumb_func_start OpponentHandleCmd33 -OpponentHandleCmd33: @ 80624AC - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd33 - - thumb_func_start OpponentHandleCmd34 -OpponentHandleCmd34: @ 80624B8 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd34 - - thumb_func_start OpponentHandleCmd35 -OpponentHandleCmd35: @ 80624C4 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd35 - - thumb_func_start OpponentHandleCmd36 -OpponentHandleCmd36: @ 80624D0 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd36 - - thumb_func_start OpponentHandleCmd37 -OpponentHandleCmd37: @ 80624DC - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleCmd37 - - thumb_func_start OpponentHandleCmd38 -OpponentHandleCmd38: @ 80624F8 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleCmd38 - - thumb_func_start OpponentHandleCmd39 -OpponentHandleCmd39: @ 8062530 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleCmd39 - - thumb_func_start OpponentHandleCmd40 -OpponentHandleCmd40: @ 8062548 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleCmd40 - - thumb_func_start OpponentHandleHitAnimation -OpponentHandleHitAnimation: @ 8062570 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080625A4 - bl OpponentBufferExecCompleted - b _080625CE - .pool -_080625A4: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t7 - str r1, [r0] -_080625CE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleHitAnimation - - thumb_func_start OpponentHandleCmd42 -OpponentHandleCmd42: @ 80625E0 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd42 - - thumb_func_start OpponentHandleEffectivenessSound -OpponentHandleEffectivenessSound: @ 80625EC - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _08062600 - movs r3, 0xC0 -_08062600: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl OpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleEffectivenessSound - - thumb_func_start OpponentHandlePlayFanfareOrBGM -OpponentHandlePlayFanfareOrBGM: @ 8062630 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0806266C - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _08062680 - .pool -_0806266C: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_08062680: - bl OpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end OpponentHandlePlayFanfareOrBGM - - thumb_func_start OpponentHandleFaintingCry -OpponentHandleFaintingCry: @ 806268C - push {lr} - 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, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - movs r2, 0x5 - bl PlayCry3 - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleFaintingCry - - thumb_func_start OpponentHandleIntroSlide -OpponentHandleIntroSlide: @ 80626C8 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleIntroSlide - - thumb_func_start OpponentHandleIntroTrainerBallThrow -OpponentHandleIntroTrainerBallThrow: @ 80626FC - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_806280C - bl StoreSpriteCallbackInData6 - ldr r0, =sub_8062828 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r6] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - 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, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080627BE - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_080627BE: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_26 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleIntroTrainerBallThrow - - thumb_func_start sub_806280C -sub_806280C: @ 806280C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x6] - bl FreeTrainerFrontPicPalette - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_806280C - - thumb_func_start sub_8062828 -sub_8062828: @ 8062828 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0806286C - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0806286C - movs r0, 0x80 - lsls r0, 8 - ands r1, r0 - cmp r1, 0 - beq _080628A0 -_0806286C: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_80613DC - b _080628E0 - .pool -_080628A0: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r6, =gBattlePartyID - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_80613DC - ldrb r0, [r7] - movs r5, 0x2 - eors r0, r5 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_80613DC - ldrb r0, [r7] - eors r0, r5 - strb r0, [r7] -_080628E0: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F560 - str r1, [r0] - mov r0, r9 - strb r0, [r2] - mov r0, r8 - bl DestroyTask - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062828 - - thumb_func_start OpponentHandleDrawPartyStatusSummary -OpponentHandleDrawPartyStatusSummary: @ 8062918 - push {r4-r7,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08062948 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08062948 - bl OpponentBufferExecCompleted - b _08062A12 - .pool -_08062948: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldr r1, =gBattleBufferA - ldrb r2, [r3] - lsls r0, r2, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r3, 0 - cmp r0, 0 - beq _080629B4 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r2, [r3, 0x1] - lsls r1, r2, 27 - lsrs r0, r1, 28 - cmp r0, 0x1 - bhi _080629AC - adds r0, 0x1 - movs r1, 0xF - ands r0, r1 - lsls r0, 1 - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x1] - b _08062A12 - .pool -_080629AC: - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - strb r0, [r3, 0x1] -_080629B4: - adds r5, r7, 0 - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08062A06 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_08062A06: - ldr r0, =gBattleBankFunc - ldrb r1, [r7] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_0803D790_t7 - str r0, [r1] -_08062A12: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleDrawPartyStatusSummary - - thumb_func_start bx_0803D790_t7 -bx_0803D790_t7: @ 8062A2C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _08062A64 - 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, 0x5] - bl OpponentBufferExecCompleted -_08062A64: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bx_0803D790_t7 - - thumb_func_start OpponentHandleCmd49 -OpponentHandleCmd49: @ 8062A74 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08062AA6 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_08062AA6: - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleCmd49 - - thumb_func_start OpponentHandleCmd50 -OpponentHandleCmd50: @ 8062AC4 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleCmd50 - - thumb_func_start OpponentHandleSpriteInvisibility -OpponentHandleSpriteInvisibility: @ 8062AD0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _08062B16 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility -_08062B16: - bl OpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleSpriteInvisibility - - thumb_func_start OpponentHandleBattleAnimation -OpponentHandleBattleAnimation: @ 8062B30 - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08062B88 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _08062B7C - bl OpponentBufferExecCompleted - b _08062B88 - .pool -_08062B7C: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_803B0F4 - str r0, [r1] -_08062B88: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleBattleAnimation - - thumb_func_start OpponentHandleLinkStandbyMsg -OpponentHandleLinkStandbyMsg: @ 8062B98 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleLinkStandbyMsg - - thumb_func_start OpponentHandleResetActionMoveSelection -OpponentHandleResetActionMoveSelection: @ 8062BA4 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end OpponentHandleResetActionMoveSelection - - thumb_func_start OpponentHandleCmd55 -OpponentHandleCmd55: @ 8062BB0 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _08062BDA - 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 -_08062BDA: - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end OpponentHandleCmd55 - - thumb_func_start nullsub_91 -nullsub_91: @ 8062BF4 - bx lr - thumb_func_end nullsub_91 - - - .align 2, 0 @ Don't pad with nop. diff --git a/include/battle.h b/include/battle.h index 5bb05755b..3a6ed2c24 100644 --- a/include/battle.h +++ b/include/battle.h @@ -657,7 +657,7 @@ struct BattleStruct u8 field_B3; void (*savedCallback)(void); u16 usedHeldItems[BATTLE_BANKS_COUNT]; - u8 field_C0[4]; + u8 chosenItem[4]; // why is this an u8? u8 AI_itemType[2]; u8 AI_itemFlags[2]; u16 choicedMove[BATTLE_BANKS_COUNT]; diff --git a/include/battle_anim.h b/include/battle_anim.h index 67f0813bc..e912af6b1 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -84,7 +84,7 @@ void sub_80A6B30(struct UnknownAnimStruct2*); void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); u8 sub_80A82E4(u8 bank); u8 sub_80A5C6C(u8 bank, u8 attributeId); -bool8 AnimBankSpriteExists(u8 bank); +bool8 IsBankSpritePresent(u8 bank); void sub_80A6C68(u8 arg0); u8 GetAnimBankSpriteId(u8 wantedBank); bool8 IsDoubleBattle(void); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 8affb1406..2f7b88c2f 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -238,7 +238,7 @@ void EmitResetActionMoveSelection(u8 bufferId, u8 caseId); void EmitCmd55(u8 bufferId, u8 arg1); // player controller -void SetBankFuncToPlayerBufferRunCommand(void); +void SetControllerToPlayer(void); void nullsub_21(void); void PlayerHandleGetRawMonData(void); void sub_80587B0(void); @@ -251,27 +251,27 @@ void ActionSelectionDestroyCursorAt(u8 cursorPos); void InitMoveSelectionsVarsAndStrings(void); // recorded player controller -void SetBankFuncToRecordedPlayerBufferRunCommand(void); +void SetControllerToRecordedPlayer(void); // opponent controller -void SetBankFuncToOpponentBufferRunCommand(void); +void SetControllerToOpponent(void); // player partner controller -void SetBankFuncToPlayerPartnerBufferRunCommand(void); +void SetControllerToPlayerPartner(void); // safari controller -void SetBankFuncToSafariBufferRunCommand(void); +void SetControllerToSafari(void); // wally controller -void SetBankFuncToWallyBufferRunCommand(void); +void SetControllerToWally(void); // recorded opponent controller -void SetBankFuncToRecordedOpponentBufferRunCommand(void); +void SetControllerToRecordedOpponent(void); // link opponent -void SetBankFuncToLinkOpponentBufferRunCommand(void); +void SetControllerToLinkOpponent(void); // link partner -void SetBankFuncToLinkPartnerBufferRunCommand(void); +void SetControllerToLinkPartner(void); #endif // GUARD_BATTLE_CONTROLLERS_H diff --git a/ld_script.txt b/ld_script.txt index a33ea9e71..42b468d3f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -64,7 +64,6 @@ SECTIONS { src/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_link_opponent.o(.text); src/pokemon_1.o(.text); diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index de440054c..a57df85fb 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -941,7 +941,7 @@ static bool8 ShouldUseItem(void) if (shouldUse) { EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); - *(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item; + *(gBattleStruct->chosenItem + (gActiveBank / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; } diff --git a/src/battle_anim.c b/src/battle_anim.c index d41dc77c4..fa3ac73be 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -660,7 +660,7 @@ bool8 IsAnimBankSpriteVisible(u8 bank) else return FALSE; } - if (!AnimBankSpriteExists(bank)) + if (!IsBankSpritePresent(bank)) return FALSE; if (IsContest()) return TRUE; // this line wont ever be reached. diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 95cb80146..6d5059787 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -199,7 +199,7 @@ static void nullsub_28(void) { } -void SetBankFuncToLinkOpponentBufferRunCommand(void) +void SetControllerToLinkOpponent(void) { gBattleBankFunc[gActiveBank] = LinkOpponentBufferRunCommand; } @@ -1846,7 +1846,7 @@ static void LinkOpponentHandleCmd50(void) static void LinkOpponentHandleSpriteInvisibility(void) { - if (AnimBankSpriteExists(gActiveBank)) + if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 8ad497807..4fee08431 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -194,7 +194,7 @@ static void nullsub_112(void) { } -void SetBankFuncToLinkPartnerBufferRunCommand(void) +void SetControllerToLinkPartner(void) { gBattleBankFunc[gActiveBank] = LinkPartnerBufferRunCommand; } @@ -1678,7 +1678,7 @@ static void LinkPartnerHandleCmd50(void) static void LinkPartnerHandleSpriteInvisibility(void) { - if (AnimBankSpriteExists(gActiveBank)) + if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 664d12142..fc19f9065 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -50,6 +50,9 @@ extern u16 gTrainerBattleOpponent_B; extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_020244B4[]; +extern void (*gPreBattleCallback1)(void); extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; @@ -57,76 +60,83 @@ extern const struct BattleMove gBattleMoves[]; extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); extern void sub_81A57E4(u8 bank, u16 stringId); +extern u8 sub_81A4CB0(void); +extern u8 sub_81D5588(u16 trainerId); +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 GetEreaderTrainerFrontSpriteId(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 OpponentHandlePaletteFade(void); -void OpponentHandleSuccessBallThrowAnim(void); -void OpponentHandleBallThrow(void); -void OpponentHandlePause(void); -void OpponentHandleMoveAnimation(void); -void OpponentHandlePrintString(void); -void OpponentHandlePrintStringPlayerOnly(void); -void OpponentHandleChooseAction(void); -void OpponentHandleUnknownYesNoBox(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); +static void OpponentHandleGetMonData(void); +static void OpponentHandleGetRawMonData(void); +static void OpponentHandleSetMonData(void); +static void OpponentHandleSetRawMonData(void); +static void OpponentHandleLoadMonSprite(void); +static void OpponentHandleSwitchInAnim(void); +static void OpponentHandleReturnMonToBall(void); +static void OpponentHandleDrawTrainerPic(void); +static void OpponentHandleTrainerSlide(void); +static void OpponentHandleTrainerSlideBack(void); +static void OpponentHandleFaintAnimation(void); +static void OpponentHandlePaletteFade(void); +static void OpponentHandleSuccessBallThrowAnim(void); +static void OpponentHandleBallThrow(void); +static void OpponentHandlePause(void); +static void OpponentHandleMoveAnimation(void); +static void OpponentHandlePrintString(void); +static void OpponentHandlePrintStringPlayerOnly(void); +static void OpponentHandleChooseAction(void); +static void OpponentHandleUnknownYesNoBox(void); +static void OpponentHandleChooseMove(void); +static void OpponentHandleChooseItem(void); +static void OpponentHandleChoosePokemon(void); +static void OpponentHandleCmd23(void); +static void OpponentHandleHealthBarUpdate(void); +static void OpponentHandleExpUpdate(void); +static void OpponentHandleStatusIconUpdate(void); +static void OpponentHandleStatusAnimation(void); +static void OpponentHandleStatusXor(void); +static void OpponentHandleDataTransfer(void); +static void OpponentHandleDMA3Transfer(void); +static void OpponentHandlePlayBGM(void); +static void OpponentHandleCmd32(void); +static void OpponentHandleTwoReturnValues(void); +static void OpponentHandleChosenMonReturnValue(void); +static void OpponentHandleOneReturnValue(void); +static void OpponentHandleOneReturnValue_Duplicate(void); +static void OpponentHandleCmd37(void); +static void OpponentHandleCmd38(void); +static void OpponentHandleCmd39(void); +static void OpponentHandleCmd40(void); +static void OpponentHandleHitAnimation(void); +static void OpponentHandleCmd42(void); +static void OpponentHandleEffectivenessSound(void); +static void OpponentHandlePlayFanfareOrBGM(void); +static void OpponentHandleFaintingCry(void); +static void OpponentHandleIntroSlide(void); +static void OpponentHandleIntroTrainerBallThrow(void); +static void OpponentHandleDrawPartyStatusSummary(void); +static void OpponentHandleCmd49(void); +static void OpponentHandleCmd50(void); +static void OpponentHandleSpriteInvisibility(void); +static void OpponentHandleBattleAnimation(void); +static void OpponentHandleLinkStandbyMsg(void); +static void OpponentHandleResetActionMoveSelection(void); +static void OpponentHandleCmd55(void); +static void nullsub_91(void); -void OpponentBufferRunCommand(void); -void OpponentBufferExecCompleted(void); -void bx_803AEDC(void); -u32 sub_8060004(u8 monId, u8 *dst); -void sub_8060890(u8 monId); -void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit); -void DoSwitchOutAnimation(void); -void OpponentDoMoveAnimation(void); +static void OpponentBufferRunCommand(void); +static void OpponentBufferExecCompleted(void); +static void sub_805FC80(void); +static u32 GetOpponentMonData(u8 monId, u8 *dst); +static void SetOpponentMonData(u8 monId); +static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void OpponentDoMoveAnimation(void); +static void sub_806280C(struct Sprite *sprite); +static void sub_8062828(u8 taskId); +static void sub_8062A2C(void); -void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { OpponentHandleGetMonData, OpponentHandleGetRawMonData, @@ -149,7 +159,7 @@ void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = OpponentHandleChooseAction, OpponentHandleUnknownYesNoBox, OpponentHandleChooseMove, - OpponentHandleOpenBag, + OpponentHandleChooseItem, OpponentHandleChoosePokemon, OpponentHandleCmd23, OpponentHandleHealthBarUpdate, @@ -161,10 +171,10 @@ void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = OpponentHandleDMA3Transfer, OpponentHandlePlayBGM, OpponentHandleCmd32, - OpponentHandleCmd33, - OpponentHandleCmd34, - OpponentHandleCmd35, - OpponentHandleCmd36, + OpponentHandleTwoReturnValues, + OpponentHandleChosenMonReturnValue, + OpponentHandleOneReturnValue, + OpponentHandleOneReturnValue_Duplicate, OpponentHandleCmd37, OpponentHandleCmd38, OpponentHandleCmd39, @@ -190,39 +200,39 @@ void (*const gOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = // unknown unused data static const u8 sUnknown_0831C7AC[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20}; -void nullsub_26(void) +static void nullsub_26(void) { } -void SetBankFuncToOpponentBufferRunCommand(void) +void SetControllerToOpponent(void) { gBattleBankFunc[gActiveBank] = OpponentBufferRunCommand; } -void OpponentBufferRunCommand(void) +static void OpponentBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { - if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(gOpponentBufferCommands)) - gOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sOpponentBufferCommands)) + sOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); else OpponentBufferExecCompleted(); } } -void CompleteOnBankSpriteCallbackDummy(void) +static void CompleteOnBankSpriteCallbackDummy(void) { if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) OpponentBufferExecCompleted(); } -void CompleteOnBankSpriteCallbackDummy2(void) +static void CompleteOnBankSpriteCallbackDummy2(void) { if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) OpponentBufferExecCompleted(); } -void sub_805F240(void) +static void sub_805F240(void) { if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) { @@ -233,7 +243,7 @@ void sub_805F240(void) } } -void sub_805F2A8(void) +static void sub_805F2A8(void) { if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) { @@ -242,7 +252,7 @@ void sub_805F2A8(void) } } -void sub_805F2F0(void) +static void sub_805F2F0(void) { bool8 var = FALSE; bool8 var2; @@ -303,7 +313,7 @@ void sub_805F2F0(void) } } -void sub_805F560(void) +static void sub_805F560(void) { bool32 sp = FALSE; bool32 r10 = FALSE; @@ -385,7 +395,7 @@ void sub_805F560(void) } } -void sub_805F994(void) +static void sub_805F994(void) { if (gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); @@ -400,7 +410,7 @@ void sub_805F994(void) } } -void sub_805FA70(void) +static void CompleteOnHealthbarDone(void) { s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); @@ -412,7 +422,7 @@ void sub_805FA70(void) OpponentBufferExecCompleted(); } -void sub_805FAC4(void) +static void sub_805FAC4(void) { if (!gSprites[gBankSpriteIds[gActiveBank]].inUse) { @@ -421,7 +431,7 @@ void sub_805FAC4(void) } } -void sub_805FB08(void) +static void sub_805FB08(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) { @@ -433,13 +443,13 @@ void sub_805FB08(void) } } -void CompleteOnInactiveTextPrinter(void) +static void CompleteOnInactiveTextPrinter(void) { if (!IsTextPrinterActive(0)) OpponentBufferExecCompleted(); } -void bx_blink_t7(void) +static void DoHitAnimBlinkSpriteEffect(void) { u8 spriteId = gBankSpriteIds[gActiveBank]; @@ -458,17 +468,17 @@ void bx_blink_t7(void) } } -void sub_805FC10(void) +static void sub_805FC10(void) { if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); - gBattleBankFunc[gActiveBank] = bx_803AEDC; + gBattleBankFunc[gActiveBank] = sub_805FC80; } } -void bx_803AEDC(void) +static void sub_805FC80(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { @@ -480,7 +490,7 @@ void bx_803AEDC(void) } } -void sub_805FD00(void) +static void sub_805FD00(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) { @@ -497,7 +507,7 @@ void sub_805FD00(void) } } -void sub_805FDF0(void) +static void sub_805FDF0(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); @@ -511,19 +521,19 @@ void sub_805FDF0(void) } } -void sub_805FEB8(void) +static void CompleteOnFinishedStatusAnimation(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) OpponentBufferExecCompleted(); } -void bx_803B0F4(void) +static void CompleteOnFinishedBattleAnimation(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) OpponentBufferExecCompleted(); } -void OpponentBufferExecCompleted(void) +static void OpponentBufferExecCompleted(void) { gBattleBankFunc[gActiveBank] = OpponentBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) @@ -539,7 +549,7 @@ void OpponentBufferExecCompleted(void) } } -void OpponentHandleGetMonData(void) +static void OpponentHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; @@ -548,7 +558,7 @@ void OpponentHandleGetMonData(void) if (gBattleBufferA[gActiveBank][2] == 0) { - size += sub_8060004(gBattlePartyID[gActiveBank], monData); + size += GetOpponentMonData(gBattlePartyID[gActiveBank], monData); } else { @@ -556,7 +566,7 @@ void OpponentHandleGetMonData(void) for (i = 0; i < 6; i++) { if (monsToCheck & 1) - size += sub_8060004(i, monData + size); + size += GetOpponentMonData(i, monData + size); monsToCheck >>= 1; } } @@ -564,7 +574,7 @@ void OpponentHandleGetMonData(void) OpponentBufferExecCompleted(); } -u32 sub_8060004(u8 monId, u8 *dst) +static u32 GetOpponentMonData(u8 monId, u8 *dst) { struct BattlePokemon battleMon; struct MovePpInfo moveData; @@ -870,7 +880,7 @@ u32 sub_8060004(u8 monId, u8 *dst) return size; } -void OpponentHandleGetRawMonData(void) +static void OpponentHandleGetRawMonData(void) { struct BattlePokemon battleMon; u8 *src = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; @@ -884,14 +894,14 @@ void OpponentHandleGetRawMonData(void) OpponentBufferExecCompleted(); } -void OpponentHandleSetMonData(void) +static void OpponentHandleSetMonData(void) { u8 monsToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) { - sub_8060890(gBattlePartyID[gActiveBank]); + SetOpponentMonData(gBattlePartyID[gActiveBank]); } else { @@ -899,14 +909,14 @@ void OpponentHandleSetMonData(void) for (i = 0; i < 6; i++) { if (monsToCheck & 1) - sub_8060890(i); + SetOpponentMonData(i); monsToCheck >>= 1; } } OpponentBufferExecCompleted(); } -void sub_8060890(u8 monId) +static void SetOpponentMonData(u8 monId) { struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; @@ -1122,7 +1132,7 @@ void sub_8060890(u8 monId) } } -void OpponentHandleSetRawMonData(void) +static void OpponentHandleSetRawMonData(void) { u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; u8 i; @@ -1133,7 +1143,7 @@ void OpponentHandleSetRawMonData(void) OpponentBufferExecCompleted(); } -void OpponentHandleLoadMonSprite(void) +static void OpponentHandleLoadMonSprite(void) { u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); @@ -1156,7 +1166,7 @@ void OpponentHandleLoadMonSprite(void) gBattleBankFunc[gActiveBank] = sub_805F994; } -void OpponentHandleSwitchInAnim(void) +static void OpponentHandleSwitchInAnim(void) { *(gBattleStruct->field_5C + gActiveBank) = 6; gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; @@ -1164,7 +1174,7 @@ void OpponentHandleSwitchInAnim(void) gBattleBankFunc[gActiveBank] = sub_805FDF0; } -void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) +static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) { u16 species; @@ -1196,7 +1206,7 @@ void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE); } -void OpponentHandleReturnMonToBall(void) +static void OpponentHandleReturnMonToBall(void) { if (gBattleBufferA[gActiveBank][1] == 0) { @@ -1213,7 +1223,7 @@ void OpponentHandleReturnMonToBall(void) } } -void DoSwitchOutAnimation(void) +static void DoSwitchOutAnimation(void) { switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) { @@ -1234,11 +1244,6 @@ void DoSwitchOutAnimation(void) } } -u8 sub_81A4CB0(void); -u8 sub_81D5588(u16 trainerId); -u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); -u8 GetEreaderTrainerFrontSpriteId(void); - // todo: get rid of it once the struct is declared in a header struct MonCoords { @@ -1249,7 +1254,7 @@ struct MonCoords }; extern const struct MonCoords gTrainerFrontPicCoords[]; -void OpponentHandleDrawTrainerPic(void) +static void OpponentHandleDrawTrainerPic(void) { u32 trainerPicId; s16 xPos; @@ -1334,7 +1339,7 @@ void OpponentHandleDrawTrainerPic(void) gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; } -void OpponentHandleTrainerSlide(void) +static void OpponentHandleTrainerSlide(void) { u32 trainerPicId; @@ -1404,7 +1409,7 @@ void OpponentHandleTrainerSlide(void) gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; } -void OpponentHandleTrainerSlideBack(void) +static void OpponentHandleTrainerSlideBack(void) { oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; @@ -1415,7 +1420,7 @@ void OpponentHandleTrainerSlideBack(void) gBattleBankFunc[gActiveBank] = sub_805F240; } -void OpponentHandleFaintAnimation(void) +static void OpponentHandleFaintAnimation(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) { @@ -1435,27 +1440,27 @@ void OpponentHandleFaintAnimation(void) } } -void OpponentHandlePaletteFade(void) +static void OpponentHandlePaletteFade(void) { OpponentBufferExecCompleted(); } -void OpponentHandleSuccessBallThrowAnim(void) +static void OpponentHandleSuccessBallThrowAnim(void) { OpponentBufferExecCompleted(); } -void OpponentHandleBallThrow(void) +static void OpponentHandleBallThrow(void) { OpponentBufferExecCompleted(); } -void OpponentHandlePause(void) +static void OpponentHandlePause(void) { OpponentBufferExecCompleted(); } -void OpponentHandleMoveAnimation(void) +static void OpponentHandleMoveAnimation(void) { if (!mplay_80342A4(gActiveBank)) { @@ -1480,7 +1485,7 @@ void OpponentHandleMoveAnimation(void) } } -void OpponentDoMoveAnimation(void) +static void OpponentDoMoveAnimation(void) { u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); u8 multihit = gBattleBufferA[gActiveBank][11]; @@ -1529,7 +1534,7 @@ void OpponentDoMoveAnimation(void) } } -void OpponentHandlePrintString(void) +static void OpponentHandlePrintString(void) { u16 *stringId; @@ -1542,23 +1547,23 @@ void OpponentHandlePrintString(void) sub_81A57E4(gActiveBank, *stringId); } -void OpponentHandlePrintStringPlayerOnly(void) +static void OpponentHandlePrintStringPlayerOnly(void) { OpponentBufferExecCompleted(); } -void OpponentHandleChooseAction(void) +static void OpponentHandleChooseAction(void) { AI_TrySwitchOrUseItem(); OpponentBufferExecCompleted(); } -void OpponentHandleUnknownYesNoBox(void) +static void OpponentHandleUnknownYesNoBox(void) { OpponentBufferExecCompleted(); } -void OpponentHandleChooseMove(void) +static void OpponentHandleChooseMove(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { @@ -1621,3 +1626,418 @@ void OpponentHandleChooseMove(void) } } } + +static void OpponentHandleChooseItem(void) +{ + EmitOneReturnValue(1, *(gBattleStruct->chosenItem + (gActiveBank / 2) * 2)); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleChoosePokemon(void) +{ + s32 chosenMonId; + + if (*(gBattleStruct->field_294 + gActiveBank) == 6) + { + chosenMonId = GetMostSuitableMonToSwitchInto(); + + if (chosenMonId == 6) + { + s32 bank1, bank2, firstId, lastId; + + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + { + bank2 = bank1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + } + else + { + bank1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + bank2 = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + } + + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + { + if (gActiveBank == 1) + firstId = 0, lastId = 3; + else + firstId = 3, lastId = 6; + } + else + { + firstId = 0, lastId = 6; + } + + for (chosenMonId = firstId; chosenMonId < lastId; chosenMonId++) + { + if (GetMonData(&gEnemyParty[chosenMonId], MON_DATA_HP) != 0 + && chosenMonId != gBattlePartyID[bank1] + && chosenMonId != gBattlePartyID[bank2]) + { + break; + } + } + } + } + else + { + chosenMonId = *(gBattleStruct->field_294 + gActiveBank); + *(gBattleStruct->field_294 + gActiveBank) = 6; + } + + + *(gBattleStruct->field_5C + gActiveBank) = chosenMonId; + EmitChosenMonReturnValue(1, chosenMonId, NULL); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd23(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = (gBattleBufferA[gActiveBank][3] << 8) | gBattleBufferA[gActiveBank][2]; + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void OpponentHandleExpUpdate(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void OpponentHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void OpponentHandleStatusXor(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleDataTransfer(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleDMA3Transfer(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandlePlayBGM(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd32(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleTwoReturnValues(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleChosenMonReturnValue(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleOneReturnValue(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleOneReturnValue_Duplicate(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + OpponentBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void OpponentHandleCmd42(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + OpponentBufferExecCompleted(); +} + +static void OpponentHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + OpponentBufferExecCompleted(); +} + +static void OpponentHandleFaintingCry(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, 25, 5); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_806280C); + + taskId = CreateTask(sub_8062828, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_26; +} + +static void sub_806280C(struct Sprite *sprite) +{ + FreeTrainerFrontPicPalette(sprite->oam.affineParam); + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); +} + +static void sub_8062828(u8 taskId) +{ + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + } + else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_805F560; + gActiveBank = savedActiveBank; + DestroyTask(taskId); +} + +static void OpponentHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + OpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + + if (gBattleBufferA[gActiveBank][2] != 0) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E < 2) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E++; + return; + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E = 0; + } + } + + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_8062A2C; + } +} + +static void sub_8062A2C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + OpponentBufferExecCompleted(); + } +} + +static void OpponentHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd50(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleSpriteInvisibility(void) +{ + if (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + OpponentBufferExecCompleted(); +} + +static void OpponentHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + OpponentBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void OpponentHandleLinkStandbyMsg(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleResetActionMoveSelection(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd55(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_LINK && !(gBattleTypeFlags & BATTLE_TYPE_WILD)) + { + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(gMain.savedCallback); + } + OpponentBufferExecCompleted(); +} + +static void nullsub_91(void) +{ +} diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 68e328acc..a07aacd20 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -239,7 +239,7 @@ void nullsub_21(void) { } -void SetBankFuncToPlayerBufferRunCommand(void) +void SetControllerToPlayer(void) { gBattleBankFunc[gActiveBank] = PlayerBufferRunCommand; gDoingBattleAnim = FALSE; @@ -3083,7 +3083,7 @@ static void PlayerHandleCmd50(void) static void PlayerHandleSpriteInvisibility(void) { - if (AnimBankSpriteExists(gActiveBank)) + if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 283c79e66..cc659972e 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -209,7 +209,7 @@ static void nullsub_77(void) { } -void SetBankFuncToPlayerPartnerBufferRunCommand(void) +void SetControllerToPlayerPartner(void) { gBattleBankFunc[gActiveBank] = PlayerPartnerBufferRunCommand; } @@ -1924,7 +1924,7 @@ static void PlayerPartnerHandleCmd50(void) static void PlayerPartnerHandleSpriteInvisibility(void) { - if (AnimBankSpriteExists(gActiveBank)) + if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 8f30febe2..9043f84e6 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -198,7 +198,7 @@ static void nullsub_70(void) { } -void SetBankFuncToRecordedOpponentBufferRunCommand(void) +void SetControllerToRecordedOpponent(void) { gBattleBankFunc[gActiveBank] = RecordedOpponentBufferRunCommand; } @@ -1788,7 +1788,7 @@ static void RecordedOpponentHandleCmd50(void) static void RecordedOpponentHandleSpriteInvisibility(void) { - if (AnimBankSpriteExists(gActiveBank)) + if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 4e71537b0..971a3e656 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -197,7 +197,7 @@ static void nullsub_120(void) { } -void SetBankFuncToRecordedPlayerBufferRunCommand(void) +void SetControllerToRecordedPlayer(void) { gBattleBankFunc[gActiveBank] = RecordedPlayerBufferRunCommand; } @@ -1808,7 +1808,7 @@ static void RecordedPlayerHandleCmd50(void) static void RecordedPlayerHandleSpriteInvisibility(void) { - if (AnimBankSpriteExists(gActiveBank)) + if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 6eb19df84..292a631f4 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -175,7 +175,7 @@ static void nullsub_114(void) { } -void SetBankFuncToSafariBufferRunCommand(void) +void SetControllerToSafari(void) { gBattleBankFunc[gActiveBank] = SafariBufferRunCommand; } diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 5e454deb5..3314cfe21 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -201,7 +201,7 @@ static void nullsub_117(void) { } -void SetBankFuncToWallyBufferRunCommand(void) +void SetControllerToWally(void) { gBattleBankFunc[gActiveBank] = WallyBufferRunCommand; gBattleStruct->wallyBattleState = 0; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index ee835586b..2ba245363 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -145,30 +145,30 @@ static void SetControllersVariables(void) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) { - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerPartnerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayerPartner; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } else { - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerPartnerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayerPartner; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } @@ -189,15 +189,15 @@ static void SetControllersVariables(void) gBattleMainFunc = BeginBattleIntro; if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) - gBattleBankFunc[0] = SetBankFuncToSafariBufferRunCommand; + gBattleBankFunc[0] = SetControllerToSafari; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) - gBattleBankFunc[0] = SetBankFuncToWallyBufferRunCommand; + gBattleBankFunc[0] = SetControllerToWally; else - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; @@ -210,20 +210,20 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; } else // see how the banks are switched { - gBattleBankFunc[1] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[0] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; @@ -231,10 +231,10 @@ static void SetControllersVariables(void) } else { - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; } } @@ -243,16 +243,16 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; @@ -263,16 +263,16 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = 0; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = 1; - gBattleBankFunc[2] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToRecordedPlayer; gBanksByIdentity[2] = 2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = 3; gNoOfAllBanks = 4; @@ -307,7 +307,7 @@ static void SetControllersVariables(void) if (i == var) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -325,7 +325,7 @@ static void SetControllersVariables(void) else if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[var].lp_field_18 & 1)) || ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[var].lp_field_18 & 1))) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -342,7 +342,7 @@ static void SetControllersVariables(void) } else { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedOpponent; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -361,51 +361,51 @@ static void SetControllersVariables(void) } else if (gBattleTypeFlags & BATTLE_TYPE_WILD) { - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[2] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToRecordedPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; if (gBattleTypeFlags & BATTLE_TYPE_x2000000) { - gBattleBankFunc[1] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[3] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToRecordedOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } else { - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } } else { - gBattleBankFunc[1] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[3] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[3] = SetControllerToRecordedPlayer; gBanksByIdentity[3] = IDENTITY_PLAYER_MON2; if (gBattleTypeFlags & BATTLE_TYPE_x2000000) { - gBattleBankFunc[0] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[2] = SetControllerToRecordedOpponent; gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; } else { - gBattleBankFunc[0] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[2] = SetControllerToOpponent; gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; } } @@ -424,20 +424,20 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToLinkOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; } else { - gBattleBankFunc[1] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[0] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToLinkOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; @@ -449,32 +449,32 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToLinkOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToLinkOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; } else { - gBattleBankFunc[1] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[0] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToLinkOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[3] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[3] = SetControllerToPlayer; gBanksByIdentity[3] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[2] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[2] = SetControllerToLinkOpponent; gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; @@ -486,32 +486,32 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToLinkPartnerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToLinkPartner; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; } else { - gBattleBankFunc[0] = SetBankFuncToLinkPartnerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToLinkPartner; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToLinkOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToLinkOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; @@ -549,7 +549,7 @@ static void SetControllersVariablesInLinkBattle(void) if (i == multiplayerId) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -569,7 +569,7 @@ static void SetControllersVariablesInLinkBattle(void) if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[multiplayerId].lp_field_18 & 1)) || ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[multiplayerId].lp_field_18 & 1))) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToLinkPartnerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToLinkPartner; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -586,7 +586,7 @@ static void SetControllersVariablesInLinkBattle(void) } else { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToLinkOpponent; switch (gLinkPlayers[i].lp_field_18) { case 0: From a41b90ae6224167497a8fa6a28d064195ff369da Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 26 Oct 2017 23:18:24 +0200 Subject: [PATCH 20/29] clear two emitters --- src/battle_controllers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 2ba245363..9d9eea24c 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1036,9 +1036,9 @@ void EmitTrainerSlideBack(u8 bufferId) void EmitFaintAnimation(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION; - gBattleBuffersTransferData[1] = 10; - gBattleBuffersTransferData[2] = 10; - gBattleBuffersTransferData[3] = 10; + gBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION; + gBattleBuffersTransferData[2] = CONTROLLER_FAINTANIMATION; + gBattleBuffersTransferData[3] = CONTROLLER_FAINTANIMATION; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1146,7 +1146,7 @@ void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringID) struct StringInfoBattle* stringInfo; gBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY; - gBattleBuffersTransferData[1] = 17; + gBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY; gBattleBuffersTransferData[2] = stringID; gBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; From 2d14e6bb67a40f2824c9b183fc52fa0837cfebf8 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 27 Oct 2017 13:29:18 +0200 Subject: [PATCH 21/29] name one var --- src/battle_controller_link_opponent.c | 2 +- src/battle_controller_link_partner.c | 2 +- src/battle_controller_opponent.c | 3 +-- src/battle_controller_player.c | 24 +++++++++++------------ src/battle_controller_player_partner.c | 2 +- src/battle_controller_recorded_opponent.c | 2 +- src/battle_controller_recorded_player.c | 2 +- src/battle_controller_wally.c | 3 +-- sym_ewram.txt | 2 +- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 6d5059787..02a2ffdff 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -419,7 +419,7 @@ static void sub_8064B04(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 4fee08431..9f44fcf1c 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -301,7 +301,7 @@ static void sub_814B290(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index fc19f9065..61886575c 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -31,7 +31,6 @@ extern u8 gActiveBank; extern u8 gBankTarget; extern u8 gAbsentBankFlags; extern bool8 gDoingBattleAnim; -extern u8 gUnknown_020244CC; extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; @@ -412,7 +411,7 @@ static void sub_805F994(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); if (hpValue != -1) { diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index a07aacd20..69df9f70b 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -33,7 +33,7 @@ extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT]; extern u8 gAbsentBankFlags; extern u8 gNoOfAllBanks; extern bool8 gDoingBattleAnim; -extern u8 gUnknown_020244CC; +extern u8 gPlayerDpadHoldFrames; extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); extern void (*gPreBattleCallback1)(void); extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; @@ -243,7 +243,7 @@ void SetControllerToPlayer(void) { gBattleBankFunc[gActiveBank] = PlayerBufferRunCommand; gDoingBattleAnim = FALSE; - gUnknown_020244CC = 0; + gPlayerDpadHoldFrames = 0; } static void PlayerBufferExecCompleted(void) @@ -287,9 +287,9 @@ static void HandleInputChooseAction(void) dp11b_obj_instanciate(gActiveBank, 0, 7, 1); if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) - gUnknown_020244CC++; + gPlayerDpadHoldFrames++; else - gUnknown_020244CC = 0; + gPlayerDpadHoldFrames = 0; if (gMain.newKeys & A_BUTTON) { @@ -352,7 +352,7 @@ static void HandleInputChooseAction(void) ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); } } - else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) + else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) { if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON2 @@ -406,9 +406,9 @@ static void HandleInputChooseTarget(void) } if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) - gUnknown_020244CC++; + gPlayerDpadHoldFrames++; else - gUnknown_020244CC = 0; + gPlayerDpadHoldFrames = 0; if (gMain.newKeys & A_BUTTON) { @@ -418,7 +418,7 @@ static void HandleInputChooseTarget(void) dp11b_obj_free(gMultiUsePlayerCursor, 1); PlayerBufferExecCompleted(); } - else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) + else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; @@ -519,9 +519,9 @@ static void HandleInputChooseMove(void) struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) - gUnknown_020244CC++; + gPlayerDpadHoldFrames++; else - gUnknown_020244CC = 0; + gPlayerDpadHoldFrames = 0; if (gMain.newKeys & A_BUTTON) { @@ -585,7 +585,7 @@ static void HandleInputChooseMove(void) gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; } } - else if (gMain.newKeys & B_BUTTON || gUnknown_020244CC > 59) + else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); EmitTwoReturnValues(1, 10, 0xFFFF); @@ -1153,7 +1153,7 @@ void c3_0802FDF4(u8 taskId) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index cc659972e..e40ba8a69 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -316,7 +316,7 @@ static void sub_81BB1D4(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 9043f84e6..69ae9e343 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -403,7 +403,7 @@ static void sub_8186C48(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 971a3e656..76ac40ef0 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -386,7 +386,7 @@ static void sub_818A064(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 3314cfe21..693008110 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -34,7 +34,6 @@ 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 u16 gBattlePartyID[BATTLE_BANKS_COUNT]; extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; @@ -377,7 +376,7 @@ static void sub_8168818(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); diff --git a/sym_ewram.txt b/sym_ewram.txt index f64bb98b8..ea526ec45 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -498,7 +498,7 @@ gDoingBattleAnim: @ 20244B9 gTransformedPersonalities: @ 20244BC .space 0x10 -gUnknown_020244CC: @ 20244CC +gPlayerDpadHoldFrames: @ 20244CC .space 0x4 gBattleSpritesDataPtr: @ 20244D0 From 0f992c8f5c2440db63273b195157a3b6a6d624b6 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 27 Oct 2017 14:59:55 +0200 Subject: [PATCH 22/29] begin working on evolution graphics --- asm/evolution_graphics.s | 44 +++++---------------------------------- data/evolution_graphics.s | 3 --- ld_script.txt | 2 ++ src/evolution_graphics.c | 31 +++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 42 deletions(-) create mode 100644 src/evolution_graphics.c diff --git a/asm/evolution_graphics.s b/asm/evolution_graphics.s index df64857c7..8938ec224 100644 --- a/asm/evolution_graphics.s +++ b/asm/evolution_graphics.s @@ -5,40 +5,6 @@ .text - thumb_func_start nullsub_67 -nullsub_67: @ 817BA40 - bx lr - thumb_func_end nullsub_67 - - thumb_func_start sub_817BA44 -sub_817BA44: @ 817BA44 - push {r4,r5,lr} - sub sp, 0x4 - movs r4, 0 - ldr r5, =gUnknown_085F5458 -_0817BA4C: - adds r0, r4, 0 - adds r0, 0x14 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r4, 1 - adds r1, r5 - ldrh r1, [r1] - str r1, [sp] - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0xB - bls _0817BA4C - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BA44 thumb_func_start sub_817BA7C sub_817BA7C: @ 817BA7C @@ -603,7 +569,7 @@ sub_817BEC4: @ 817BEC4 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_817BA44 + bl SetEvoSparklesMatrices ldr r0, =gTasks lsls r5, r4, 2 adds r5, r4 @@ -738,7 +704,7 @@ sub_817BFCC: @ 817BFCC adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_817BA44 + bl SetEvoSparklesMatrices ldr r1, =gTasks lsls r0, r4, 2 adds r0, r4 @@ -832,7 +798,7 @@ sub_817C080: @ 817C080 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_817BA44 + bl SetEvoSparklesMatrices ldr r1, =gTasks lsls r0, r4, 2 adds r0, r4 @@ -958,7 +924,7 @@ sub_817C174: @ 817C174 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_817BA44 + bl SetEvoSparklesMatrices ldr r0, =gTasks lsls r5, r4, 2 adds r5, r4 @@ -1105,7 +1071,7 @@ sub_817C2B0: @ 817C2B0 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_817BA44 + bl SetEvoSparklesMatrices ldr r0, =gTasks lsls r5, r4, 2 adds r5, r4 diff --git a/data/evolution_graphics.s b/data/evolution_graphics.s index d6ad2e578..6eee4f186 100644 --- a/data/evolution_graphics.s +++ b/data/evolution_graphics.s @@ -13,6 +13,3 @@ gUnknown_085F541C:: @ 85F541C gUnknown_085F5440:: @ 85F5440 .incbin "baserom.gba", 0x5f5440, 0x18 - -gUnknown_085F5458:: @ 85F5458 - .incbin "baserom.gba", 0x5f5458, 0x38 diff --git a/ld_script.txt b/ld_script.txt index f655711dd..b7db38528 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -225,6 +225,7 @@ SECTIONS { asm/pokeblock_feed.o(.text); src/clear_save_data_screen.o(.text); asm/intro_credits_graphics.o(.text); + src/evolution_graphics.o(.text); asm/evolution_graphics.o(.text); asm/bard_music.o(.text); asm/fldeff_teleport.o(.text); @@ -448,6 +449,7 @@ SECTIONS { src/clear_save_data_screen.o(.rodata); data/intro_credits_graphics.o(.rodata); data/evolution_graphics.o(.rodata); + src/evolution_graphics.o(.rodata); data/bard_music.o(.rodata); data/data_860A4AC.o(.rodata); data/battle_controller_recorded_opponent.o(.rodata); diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c new file mode 100644 index 000000000..7f24827a2 --- /dev/null +++ b/src/evolution_graphics.c @@ -0,0 +1,31 @@ +#include "global.h" +//#include "evolution_graphics.h" +#include "sprite.h" +#include "trig.h" +#include "rng.h" +#include "decompress.h" +#include "task.h" +#include "sound.h" +#include "songs.h" +#include "palette.h" + +static const s16 sEvoSparkleMatricies[] = +{ + 0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, 0x240, 0x200, 0x1C0, + 0x180, 0x140, 0x100, -4, 0x10, -3, 0x30, -2, 0x50, + -1, 0x70, 0x1, 0x70, 0x2, 0x50, 0x3, 0x30, 0x4, 0x10 +}; + +void EvoSparkle_DummySpriteCb(struct Sprite *sprite) +{ + +} + +void SetEvoSparklesMatrices(void) +{ + u16 i; + for (i = 0; i < 12; i++) + { + SetOamMatrix(20 + i, sEvoSparkleMatricies[i], 0, 0, sEvoSparkleMatricies[i]); + } +} From f4e134569f0abf5f6b0bd23043a28e135b0c188c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 27 Oct 2017 15:49:14 +0200 Subject: [PATCH 23/29] evo graphics file is done --- asm/evolution_graphics.s | 1717 --------------------------------- asm/evolution_scene.s | 20 +- data/evolution_graphics.s | 15 - graphics/misc/evo_sparkle.pal | 19 + graphics/misc/evo_sparkle.png | Bin 0 -> 154 bytes include/evolution_graphics.h | 15 + ld_script.txt | 2 - src/evolution_graphics.c | 586 ++++++++++- 8 files changed, 627 insertions(+), 1747 deletions(-) delete mode 100644 asm/evolution_graphics.s delete mode 100644 data/evolution_graphics.s create mode 100644 graphics/misc/evo_sparkle.pal create mode 100644 graphics/misc/evo_sparkle.png create mode 100644 include/evolution_graphics.h diff --git a/asm/evolution_graphics.s b/asm/evolution_graphics.s deleted file mode 100644 index 8938ec224..000000000 --- a/asm/evolution_graphics.s +++ /dev/null @@ -1,1717 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start sub_817BA7C -sub_817BA7C: @ 817BA7C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x22 - ldrsh r0, [r4, r1] - cmp r0, 0x8 - ble _0817BB2A - movs r2, 0x3C - ldrsh r0, [r4, r2] - adds r1, r0, 0 - muls r1, r0 - adds r0, r1, 0 - movs r1, 0x50 - bl __divsi3 - movs r1, 0x58 - subs r1, r0 - strh r1, [r4, 0x22] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _0817BAB6 - adds r0, 0x3 -_0817BAB6: - asrs r0, 2 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3A] - adds r0, 0x4 - strh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0817BAE0 - ldrh r0, [r4, 0x38] - subs r0, 0x1 - strh r0, [r4, 0x38] -_0817BAE0: - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - movs r1, 0x26 - ldrsh r0, [r4, r1] - cmp r0, 0 - ble _0817BAF6 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1 - b _0817BAFC -_0817BAF6: - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x14 -_0817BAFC: - strb r0, [r1] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0 - bge _0817BB08 - adds r0, 0x3 -_0817BB08: - asrs r0, 2 - adds r0, 0x14 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1F - bls _0817BB16 - movs r2, 0x1F -_0817BB16: - movs r0, 0x1F - ands r2, r0 - lsls r2, 1 - ldrb r1, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x3] - b _0817BB30 -_0817BB2A: - adds r0, r4, 0 - bl DestroySprite -_0817BB30: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BA7C - - thumb_func_start sub_817BB38 -sub_817BB38: @ 817BB38 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x58 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0817BB82 - ldr r4, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r2, r3, r4 - movs r1, 0 - movs r0, 0x30 - strh r0, [r2, 0x38] - strh r5, [r2, 0x3A] - strh r1, [r2, 0x3C] - ldrb r1, [r2, 0x1] - subs r0, 0x34 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r2, 0x3] - movs r1, 0x3E - orrs r0, r1 - strb r0, [r2, 0x3] - adds r4, 0x1C - adds r3, r4 - ldr r0, =sub_817BA7C - str r0, [r3] -_0817BB82: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BB38 - - thumb_func_start sub_817BB94 -sub_817BB94: @ 817BB94 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x22 - ldrsh r0, [r4, r1] - cmp r0, 0x57 - bgt _0817BBFA - movs r2, 0x3C - ldrsh r0, [r4, r2] - adds r1, r0, 0 - muls r1, r0 - adds r0, r1, 0 - movs r1, 0x5 - bl __divsi3 - adds r0, 0x8 - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _0817BBCC - adds r0, 0x3 -_0817BBCC: - asrs r0, 2 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - lsls r0, 26 - lsrs r0, 24 - movs r1, 0x28 - bl Sin - adds r0, 0x8 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - b _0817BC00 -_0817BBFA: - adds r0, r4, 0 - bl DestroySprite -_0817BC00: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BB94 - - thumb_func_start sub_817BC08 -sub_817BC08: @ 817BC08 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x8 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0817BC5E - ldr r4, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r2, r3, r4 - movs r1, 0 - movs r0, 0x8 - strh r0, [r2, 0x38] - strh r5, [r2, 0x3A] - strh r1, [r2, 0x3C] - ldrb r1, [r2, 0x1] - subs r0, 0xC - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r1, [r2, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x32 - orrs r0, r1 - strb r0, [r2, 0x3] - adds r2, 0x43 - movs r0, 0x1 - strb r0, [r2] - adds r4, 0x1C - adds r3, r4 - ldr r0, =sub_817BB94 - str r0, [r3] -_0817BC5E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BC08 - - thumb_func_start sub_817BC70 -sub_817BC70: @ 817BC70 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x8 - ble _0817BCAC - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x38] - ldrh r1, [r4, 0x34] - subs r0, r1 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x3A] - adds r0, 0x4 - strh r0, [r4, 0x3A] - b _0817BCB2 -_0817BCAC: - adds r0, r4, 0 - bl DestroySprite -_0817BCB2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BC70 - - thumb_func_start sub_817BCB8 -sub_817BCB8: @ 817BCB8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x38 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0817BD0E - ldr r4, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r2, r3, r4 - movs r1, 0 - strh r5, [r2, 0x34] - movs r0, 0x78 - strh r0, [r2, 0x38] - strh r6, [r2, 0x3A] - strh r1, [r2, 0x3C] - ldrb r1, [r2, 0x1] - subs r0, 0x7C - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r2, 0x3] - movs r1, 0x3E - orrs r0, r1 - strb r0, [r2, 0x3] - adds r2, 0x43 - movs r0, 0x1 - strb r0, [r2] - adds r4, 0x1C - adds r3, r4 - ldr r0, =sub_817BC70 - str r0, [r3] -_0817BD0E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BCB8 - - thumb_func_start sub_817BD20 -sub_817BD20: @ 817BD20 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x3C] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0817BD34 - ldrh r0, [r4, 0x22] - adds r0, 0x1 - strh r0, [r4, 0x22] -_0817BD34: - ldrh r1, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmp r0, 0x7F - bgt _0817BDE4 - lsls r0, r1, 24 - lsrs r0, 24 - movs r5, 0x38 - ldrsh r1, [r4, r5] - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r2, 0x3C - ldrsh r0, [r4, r2] - muls r0, r1 - movs r1, 0x3 - bl __divsi3 - adds r0, 0x78 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x3A] - adds r3, r0, 0x1 - strh r3, [r4, 0x3A] - movs r5, 0x3A - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - cmp r0, 0 - bge _0817BD78 - adds r0, 0x7F -_0817BD78: - asrs r0, 7 - movs r1, 0x1F - subs r1, r0 - lsls r1, 24 - lsrs r2, r1, 24 - lsls r0, r3, 16 - asrs r0, 16 - cmp r0, 0x40 - ble _0817BD94 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1 - strb r0, [r1] - b _0817BDC4 -_0817BD94: - adds r3, r4, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x14 - strb r0, [r1] - ldrh r1, [r4, 0x3A] - movs r5, 0x3A - ldrsh r0, [r4, r5] - cmp r0, 0x70 - ble _0817BDC4 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0817BDC4 - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] -_0817BDC4: - cmp r2, 0x13 - bhi _0817BDCA - movs r2, 0x14 -_0817BDCA: - movs r0, 0x1F - ands r2, r0 - lsls r2, 1 - ldrb r1, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x3] - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - b _0817BDEA -_0817BDE4: - adds r0, r4, 0 - bl DestroySprite -_0817BDEA: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817BD20 - - thumb_func_start sub_817BDF0 -sub_817BDF0: @ 817BDF0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x38 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x40 - beq _0817BE60 - bl Random - ldr r6, =gSprites - lsls r5, r4, 4 - adds r5, r4 - lsls r5, 2 - adds r4, r5, r6 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x7 - bl __umodsi3 - movs r1, 0x3 - subs r1, r0 - movs r0, 0 - mov r8, r0 - strh r1, [r4, 0x34] - bl Random - movs r1, 0x3F - ands r1, r0 - adds r1, 0x30 - strh r1, [r4, 0x38] - mov r0, r8 - strh r0, [r4, 0x3C] - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r4, 0x3] - movs r1, 0x3E - orrs r0, r1 - strb r0, [r4, 0x3] - adds r4, 0x43 - movs r0, 0x14 - strb r0, [r4] - adds r6, 0x1C - adds r5, r6 - ldr r0, =sub_817BD20 - str r0, [r5] -_0817BE60: - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BDF0 - - thumb_func_start sub_817BE78 -sub_817BE78: @ 817BE78 - push {lr} - ldr r0, =gUnknown_085F540C - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gUnknown_085F541C - bl LoadSpritePalettes - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BE78 - - thumb_func_start sub_817BE94 -sub_817BE94: @ 817BE94 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =sub_817BEC4 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xA] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817BE94 - - thumb_func_start sub_817BEC4 -sub_817BEC4: @ 817BEC4 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl SetEvoSparklesMatrices - ldr r0, =gTasks - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - adds r5, r0 - movs r0, 0 - strh r0, [r5, 0x26] - movs r0, 0xA - ldrsh r1, [r5, r0] - movs r0, 0x3 - lsls r0, r1 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0xA - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_817BF14 - str r0, [r5] - movs r0, 0x8C - bl PlaySE - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BEC4 - - thumb_func_start sub_817BF14 -sub_817BF14: @ 817BF14 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r3, r5, 2 - adds r0, r3, r5 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0x26] - movs r4, 0x26 - ldrsh r0, [r1, r4] - cmp r0, 0x3F - bgt _0817BF70 - movs r0, 0x7 - ands r0, r2 - adds r7, r3, 0 - cmp r0, 0 - bne _0817BF5A - movs r4, 0 - adds r6, r1, 0 -_0817BF3C: - ldrh r1, [r6, 0x26] - movs r0, 0x78 - ands r0, r1 - lsls r0, 1 - lsls r1, r4, 6 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - bl sub_817BB38 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0817BF3C -_0817BF5A: - ldr r0, =gTasks - adds r1, r7, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817BF78 - .pool -_0817BF70: - movs r0, 0x60 - strh r0, [r1, 0x26] - ldr r0, =sub_817BF84 - str r0, [r1] -_0817BF78: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BF14 - - thumb_func_start sub_817BF84 -sub_817BF84: @ 817BF84 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0, r1 - ldrh r3, [r1, 0x26] - movs r4, 0x26 - ldrsh r0, [r1, r4] - cmp r0, 0 - beq _0817BFA8 - subs r0, r3, 0x1 - strh r0, [r1, 0x26] - b _0817BFAE - .pool -_0817BFA8: - adds r0, r2, 0 - bl DestroyTask -_0817BFAE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BF84 - - thumb_func_start sub_817BFB4 -sub_817BFB4: @ 817BFB4 - push {lr} - ldr r0, =sub_817BFCC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_817BFB4 - - thumb_func_start sub_817BFCC -sub_817BFCC: @ 817BFCC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl SetEvoSparklesMatrices - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x26] - ldr r1, =sub_817C000 - str r1, [r0] - movs r0, 0xB7 - bl PlaySE - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BFCC - - thumb_func_start sub_817C000 -sub_817C000: @ 817C000 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r2, r5, 2 - adds r0, r2, r5 - lsls r0, 3 - adds r1, r0, r1 - movs r3, 0x26 - ldrsh r0, [r1, r3] - cmp r0, 0x5F - bgt _0817C048 - adds r6, r2, 0 - cmp r0, 0x5 - bgt _0817C032 - movs r4, 0 -_0817C020: - lsls r0, r4, 28 - lsrs r0, 24 - bl sub_817BC08 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x8 - bls _0817C020 -_0817C032: - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C04C - .pool -_0817C048: - ldr r0, =sub_817C058 - str r0, [r1] -_0817C04C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C000 - - thumb_func_start sub_817C058 -sub_817C058: @ 817C058 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - pop {r0} - bx r0 - thumb_func_end sub_817C058 - - thumb_func_start sub_817C068 -sub_817C068: @ 817C068 - push {lr} - ldr r0, =sub_817C080 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C068 - - thumb_func_start sub_817C080 -sub_817C080: @ 817C080 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl SetEvoSparklesMatrices - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x26] - ldr r1, =sub_817C0B4 - str r1, [r0] - movs r0, 0x66 - bl PlaySE - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C080 - - thumb_func_start sub_817C0B4 -sub_817C0B4: @ 817C0B4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r2, r5, 2 - adds r0, r2, r5 - lsls r0, 3 - adds r1, r0, r1 - movs r3, 0x26 - ldrsh r0, [r1, r3] - cmp r0, 0x2F - bgt _0817C124 - adds r6, r2, 0 - cmp r0, 0 - bne _0817C0E8 - movs r4, 0 -_0817C0D4: - lsls r0, r4, 28 - lsrs r0, 24 - movs r1, 0x4 - bl sub_817BCB8 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _0817C0D4 -_0817C0E8: - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - movs r2, 0x26 - ldrsh r0, [r1, r2] - cmp r0, 0x20 - bne _0817C10E - movs r4, 0 -_0817C0FA: - lsls r0, r4, 28 - lsrs r0, 24 - movs r1, 0x8 - bl sub_817BCB8 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _0817C0FA -_0817C10E: - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C128 - .pool -_0817C124: - ldr r0, =sub_817C134 - str r0, [r1] -_0817C128: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C0B4 - - thumb_func_start sub_817C134 -sub_817C134: @ 817C134 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - pop {r0} - bx r0 - thumb_func_end sub_817C134 - - thumb_func_start sub_817C144 -sub_817C144: @ 817C144 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =sub_817C174 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xC] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C144 - - thumb_func_start sub_817C174 -sub_817C174: @ 817C174 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl SetEvoSparklesMatrices - ldr r0, =gTasks - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - adds r5, r0 - movs r0, 0 - strh r0, [r5, 0x26] - ldr r0, =gPlttBufferFaded + 0x40 - ldr r1, =gPlttBufferUnfaded + 0x40 - movs r2, 0x30 - bl CpuSet - ldr r0, =0xfff9041c - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_817C1D4 - str r0, [r5] - movs r0, 0xCA - bl PlaySE - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C174 - - thumb_func_start sub_817C1D4 -sub_817C1D4: @ 817C1D4 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r5, r6, 2 - adds r0, r5, r6 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0x26 - ldrsh r2, [r1, r0] - cmp r2, 0x7F - bgt _0817C250 - adds r0, r2, 0 - cmp r0, 0 - beq _0817C210 - cmp r0, 0x20 - beq _0817C224 - cmp r2, 0x31 - bgt _0817C234 - bl Random - movs r1, 0x7 - ands r0, r1 - bl sub_817BDF0 - b _0817C234 - .pool -_0817C210: - movs r4, 0 -_0817C212: - adds r0, r4, 0 - bl sub_817BDF0 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _0817C212 - b _0817C234 -_0817C224: - ldr r0, =0xffff041c - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0x10 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0817C234: - ldr r0, =gTasks - adds r1, r5, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C254 - .pool -_0817C250: - ldr r0, =sub_817C260 - str r0, [r1] -_0817C254: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C1D4 - - thumb_func_start sub_817C260 -sub_817C260: @ 817C260 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0817C278 - adds r0, r2, 0 - bl DestroyTask -_0817C278: - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C260 - - thumb_func_start sub_817C280 -sub_817C280: @ 817C280 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =sub_817C2B0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xC] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C280 - - thumb_func_start sub_817C2B0 -sub_817C2B0: @ 817C2B0 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl SetEvoSparklesMatrices - ldr r0, =gTasks - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - adds r5, r0 - movs r0, 0 - strh r0, [r5, 0x26] - ldr r0, =gPlttBufferFaded + 0x40 - ldr r1, =gPlttBufferUnfaded + 0x40 - movs r2, 0x30 - bl CpuSet - ldr r0, =0xfff90400 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_817C310 - str r0, [r5] - movs r0, 0xCA - bl PlaySE - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C2B0 - - thumb_func_start sub_817C310 -sub_817C310: @ 817C310 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r5, r6, 2 - adds r0, r5, r6 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0x26 - ldrsh r2, [r1, r0] - cmp r2, 0x7F - bgt _0817C38C - adds r0, r2, 0 - cmp r0, 0 - beq _0817C34C - cmp r0, 0x20 - beq _0817C360 - cmp r2, 0x31 - bgt _0817C370 - bl Random - movs r1, 0x7 - ands r0, r1 - bl sub_817BDF0 - b _0817C370 - .pool -_0817C34C: - movs r4, 0 -_0817C34E: - adds r0, r4, 0 - bl sub_817BDF0 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _0817C34E - b _0817C370 -_0817C360: - ldr r0, =0xffff0400 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0x10 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0817C370: - ldr r0, =gTasks - adds r1, r5, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C390 - .pool -_0817C38C: - ldr r0, =sub_817C260 - str r0, [r1] -_0817C390: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C310 - - thumb_func_start nullsub_68 -nullsub_68: @ 817C39C - bx lr - thumb_func_end nullsub_68 - - thumb_func_start sub_817C3A0 -sub_817C3A0: @ 817C3A0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - movs r1, 0 - ldr r3, =sub_817C4EC - ldr r2, =0x00007fff -_0817C3BA: - lsls r0, r1, 1 - add r0, sp - adds r0, 0x4 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xF - bls _0817C3BA - adds r0, r3, 0 - movs r1, 0 - bl CreateTask - mov r8, r0 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gTasks - mov r1, r8 - lsls r6, r1, 2 - add r6, r8 - lsls r6, 3 - adds r6, r0 - strh r5, [r6, 0xA] - strh r7, [r6, 0xC] - movs r1, 0x80 - lsls r1, 1 - strh r1, [r6, 0xE] - movs r0, 0x10 - strh r0, [r6, 0x10] - movs r4, 0x80 - lsls r4, 9 - str r1, [sp] - movs r0, 0x1E - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - movs r0, 0x10 - ldrsh r1, [r6, r0] - adds r0, r4, 0 - bl __divsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r0, 0x1F - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - ldr r1, =gSprites - mov r9, r1 - lsls r2, r5, 4 - adds r2, r5 - lsls r2, 2 - mov r3, r9 - adds r3, 0x1C - adds r0, r2, r3 - ldr r1, =nullsub_68 - str r1, [r0] - add r2, r9 - ldrb r1, [r2, 0x1] - movs r4, 0x4 - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r1, [r2, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x3C - orrs r0, r1 - strb r0, [r2, 0x3] - movs r0, 0x3E - adds r0, r2 - mov r10, r0 - ldrb r1, [r0] - movs r5, 0x5 - negs r5, r5 - adds r0, r5, 0 - ands r0, r1 - mov r1, r10 - strb r0, [r1] - ldrb r1, [r2, 0x5] - lsrs r1, 4 - lsls r1, 5 - ldr r0, =gPlttBufferFaded + 0x200 - mov r10, r0 - add r1, r10 - add r0, sp, 0x4 - movs r2, 0x10 - str r3, [sp, 0x24] - bl CpuSet - lsls r1, r7, 4 - adds r1, r7 - lsls r1, 2 - ldr r3, [sp, 0x24] - adds r3, r1, r3 - ldr r0, =nullsub_68 - str r0, [r3] - add r1, r9 - ldrb r0, [r1, 0x1] - ands r4, r0 - movs r0, 0x1 - orrs r4, r0 - strb r4, [r1, 0x1] - ldrb r0, [r1, 0x3] - movs r2, 0x3E - orrs r0, r2 - strb r0, [r1, 0x3] - adds r2, r1, 0 - adds r2, 0x3E - ldrb r0, [r2] - ands r5, r0 - strb r5, [r2] - ldrb r1, [r1, 0x5] - lsrs r1, 4 - lsls r1, 5 - add r1, r10 - add r0, sp, 0x4 - movs r2, 0x10 - bl CpuSet - movs r1, 0 - strh r1, [r6, 0x18] - mov r0, r8 - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C3A0 - - thumb_func_start sub_817C4EC -sub_817C4EC: @ 817C4EC - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x12] - movs r0, 0x8 - strh r0, [r1, 0x14] - ldr r0, =sub_817C510 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_817C4EC - - thumb_func_start sub_817C510 -sub_817C510: @ 817C510 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r2, r0, r1 - movs r1, 0x18 - ldrsh r0, [r2, r1] - cmp r0, 0 - beq _0817C534 - adds r0, r3, 0 - bl sub_817C72C - b _0817C556 - .pool -_0817C534: - ldrh r1, [r2, 0x14] - movs r4, 0x14 - ldrsh r0, [r2, r4] - cmp r0, 0x80 - bne _0817C546 - adds r0, r3, 0 - bl sub_817C67C - b _0817C556 -_0817C546: - adds r0, r1, 0x2 - strh r0, [r2, 0x14] - ldrh r0, [r2, 0x12] - movs r1, 0x1 - eors r0, r1 - strh r0, [r2, 0x12] - ldr r0, =sub_817C560 - str r0, [r2] -_0817C556: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C510 - - thumb_func_start sub_817C560 -sub_817C560: @ 817C560 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r1 - movs r3, 0x18 - ldrsh r0, [r2, r3] - adds r5, r1, 0 - cmp r0, 0 - beq _0817C58C - ldr r0, =sub_817C72C - str r0, [r2] - b _0817C670 - .pool -_0817C58C: - movs r6, 0 - movs r7, 0x12 - ldrsh r0, [r2, r7] - cmp r0, 0 - bne _0817C5DC - movs r0, 0xE - ldrsh r1, [r2, r0] - movs r3, 0x14 - ldrsh r0, [r2, r3] - movs r3, 0x80 - lsls r3, 1 - subs r0, r3, r0 - cmp r1, r0 - bge _0817C5B2 - ldrh r0, [r2, 0x14] - ldrh r7, [r2, 0xE] - adds r0, r7 - strh r0, [r2, 0xE] - b _0817C5B6 -_0817C5B2: - strh r3, [r2, 0xE] - movs r6, 0x1 -_0817C5B6: - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r5 - movs r0, 0x10 - ldrsh r1, [r3, r0] - movs r7, 0x14 - ldrsh r0, [r3, r7] - adds r0, 0x10 - cmp r1, r0 - ble _0817C5D6 - ldrh r0, [r3, 0x10] - ldrh r1, [r3, 0x14] - subs r0, r1 - strh r0, [r3, 0x10] - b _0817C626 -_0817C5D6: - movs r0, 0x10 - strh r0, [r3, 0x10] - b _0817C620 -_0817C5DC: - movs r0, 0x10 - ldrsh r1, [r2, r0] - movs r3, 0x14 - ldrsh r0, [r2, r3] - movs r3, 0x80 - lsls r3, 1 - subs r0, r3, r0 - cmp r1, r0 - bge _0817C5F8 - ldrh r0, [r2, 0x14] - ldrh r7, [r2, 0x10] - adds r0, r7 - strh r0, [r2, 0x10] - b _0817C5FC -_0817C5F8: - strh r3, [r2, 0x10] - movs r6, 0x1 -_0817C5FC: - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r5 - movs r0, 0xE - ldrsh r1, [r3, r0] - movs r7, 0x14 - ldrsh r0, [r3, r7] - adds r0, 0x10 - cmp r1, r0 - ble _0817C61C - ldrh r0, [r3, 0xE] - ldrh r1, [r3, 0x14] - subs r0, r1 - strh r0, [r3, 0xE] - b _0817C626 -_0817C61C: - movs r0, 0x10 - strh r0, [r3, 0xE] -_0817C620: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0817C626: - adds r0, r2, r4 - lsls r0, 3 - adds r5, r0, r5 - movs r0, 0xE - ldrsh r1, [r5, r0] - movs r4, 0x80 - lsls r4, 9 - adds r0, r4, 0 - bl __divsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r0, 0x1E - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - movs r3, 0x10 - ldrsh r1, [r5, r3] - adds r0, r4, 0 - bl __divsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r0, 0x1F - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - cmp r6, 0x2 - bne _0817C670 - ldr r0, =sub_817C510 - str r0, [r5] -_0817C670: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C560 - - thumb_func_start sub_817C67C -sub_817C67C: @ 817C67C - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - mov r8, r1 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x1] - movs r6, 0x4 - negs r6, r6 - adds r1, r6, 0 - ands r1, r3 - strb r1, [r2, 0x1] - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x3] - movs r5, 0x3F - negs r5, r5 - adds r1, r5, 0 - ands r1, r3 - strb r1, [r2, 0x3] - movs r1, 0xA - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r2, [r1] - movs r3, 0x4 - orrs r2, r3 - strb r2, [r1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x1] - ands r6, r2 - strb r6, [r1, 0x1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x3] - ands r5, r2 - strb r5, [r1, 0x3] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - ands r2, r3 - strb r2, [r1] - bl DestroyTask - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C67C - - thumb_func_start sub_817C72C -sub_817C72C: @ 817C72C - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - mov r8, r1 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x1] - movs r6, 0x4 - negs r6, r6 - adds r1, r6, 0 - ands r1, r3 - strb r1, [r2, 0x1] - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x3] - movs r5, 0x3F - negs r5, r5 - adds r1, r5, 0 - ands r1, r3 - strb r1, [r2, 0x3] - movs r1, 0xA - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - ands r2, r3 - strb r2, [r1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x1] - ands r6, r2 - strb r6, [r1, 0x1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x3] - ands r5, r2 - strb r5, [r1, 0x3] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r2, [r1] - movs r3, 0x4 - orrs r2, r3 - strb r2, [r1] - bl DestroyTask - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C72C - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index e5e9aaab9..52def72d3 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -338,7 +338,7 @@ EvolutionScene: @ 813DA8C movs r2, 0x4 orrs r0, r2 strb r0, [r1] - bl sub_817BE78 + bl LoadEvoSparkleSpriteAndPal ldr r0, =evovle_mon_maybe movs r1, 0 bl CreateTask @@ -917,7 +917,7 @@ sub_813E1D4: @ 813E1D4 movs r2, 0x4 orrs r0, r2 strb r0, [r1] - bl sub_817BE78 + bl LoadEvoSparkleSpriteAndPal ldr r0, =sub_813F1B8 movs r1, 0 bl CreateTask @@ -1421,7 +1421,7 @@ _0813E7C0: movs r0, 0 bl sub_8140000 movs r0, 0x11 - bl sub_817BE94 + bl LaunchTask_PreEvoSparklesSet1 ldr r1, =gBattleCommunication strb r0, [r1, 0x2] ldr r0, =gTasks @@ -1454,7 +1454,7 @@ _0813E7FE: ldr r1, [r0] movs r0, 0x1 strb r0, [r1, 0x3] - bl sub_817BFB4 + bl LaunchTask_PreEvoSparklesSet2 strb r0, [r4, 0x2] bl _0813F1A4 .pool @@ -1514,7 +1514,7 @@ _0813E890: b _0813EC52 .pool _0813E8A4: - bl sub_817C068 + bl LaunchTask_PostEvoSparklesSet1 ldr r1, =gBattleCommunication strb r0, [r1, 0x2] ldr r0, =gTasks @@ -1541,7 +1541,7 @@ _0813E8D6: lsls r4, 3 adds r4, r5 ldrh r0, [r4, 0xC] - bl sub_817C144 + bl LaunchTask_PostEvoSparklesSet2AndFlash strb r0, [r6, 0x2] b _0813EB96 .pool @@ -2631,7 +2631,7 @@ _0813F324: adds r6, r0, 0 adds r6, 0x10 adds r0, r6, 0 - bl sub_817BE94 + bl LaunchTask_PreEvoSparklesSet1 ldr r1, =gBattleCommunication strb r0, [r1, 0x2] ldr r1, =gTasks @@ -2670,7 +2670,7 @@ _0813F396: ldr r1, [r0] movs r0, 0x1 strb r0, [r1, 0x3] - bl sub_817BFB4 + bl LaunchTask_PreEvoSparklesSet2 strb r0, [r4, 0x2] bl _0813FCC4 .pool @@ -2722,7 +2722,7 @@ _0813F420: b _0813F6AC .pool _0813F42C: - bl sub_817C068 + bl LaunchTask_PostEvoSparklesSet1 ldr r1, =gBattleCommunication strb r0, [r1, 0x2] ldr r1, =gTasks @@ -2749,7 +2749,7 @@ _0813F45E: lsls r4, 3 adds r4, r5 ldrh r0, [r4, 0xC] - bl sub_817C280 + bl LaunchTask_PostEvoSparklesSet2AndFlash_Trade strb r0, [r6, 0x2] b _0813F6F2 .pool diff --git a/data/evolution_graphics.s b/data/evolution_graphics.s deleted file mode 100644 index 6eee4f186..000000000 --- a/data/evolution_graphics.s +++ /dev/null @@ -1,15 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .incbin "baserom.gba", 0x5f53cc, 0x40 - -gUnknown_085F540C:: @ 85F540C - .incbin "baserom.gba", 0x5f540c, 0x10 - -gUnknown_085F541C:: @ 85F541C - .incbin "baserom.gba", 0x5f541c, 0x24 - -gUnknown_085F5440:: @ 85F5440 - .incbin "baserom.gba", 0x5f5440, 0x18 diff --git a/graphics/misc/evo_sparkle.pal b/graphics/misc/evo_sparkle.pal new file mode 100644 index 000000000..7ccbffd1d --- /dev/null +++ b/graphics/misc/evo_sparkle.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +49 82 82 +82 106 106 +106 131 131 +139 156 156 +164 180 180 +197 205 205 +222 230 230 +255 255 255 diff --git a/graphics/misc/evo_sparkle.png b/graphics/misc/evo_sparkle.png new file mode 100644 index 0000000000000000000000000000000000000000..ac6172602aa1371fe78bb40a10b283fb3591d34f GIT binary patch literal 154 zcmeAS@N?(olHy`uVBq!ia0vp^93afX3?$7I7w-U41_3@Hu0R?qFboO`%F4=WZtk8l zXUUc=N6((U_w3pK|Nj?7xSj`UQ1x_i4B?oWoUr5jw8qBw|Npb|dpos1.y > 8) + { + u8 matrixNum; + + sprite->pos1.y = 88 - (sprite->data7 * sprite->data7) / 80; + sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5) / 4; + sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5); + sprite->data6 += 4; + if (sprite->data7 & 1) + sprite->data5--; + sprite->data7++; + if (sprite->pos2.y > 0) + sprite->subpriority = 1; + else + sprite->subpriority = 20; + matrixNum = sprite->data5 / 4 + 20; + if (matrixNum > 31) + matrixNum = 31; + sprite->oam.matrixNum = matrixNum; + } + else + DestroySprite(sprite); +} + +static void CreatePreEvoSparkleSet1(u8 arg0) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 88, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data5 = 48; + gSprites[spriteID].data6 = arg0; + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 31; + gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet1; + } +} + +static void SpriteCB_PreEvoSparkleSet2(struct Sprite* sprite) +{ + if (sprite->pos1.y < 88) + { + sprite->pos1.y = 8 + (sprite->data7 * sprite->data7) / 5; + sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5) / 4; + sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5); + sprite->data5 = 8 + Sin((u8)(sprite->data7 * 4), 40); + sprite->data7++; + } + else + DestroySprite(sprite); +} + +static void CreatePreEvoSparkleSet2(u8 arg0) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 8, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data5 = 8; + gSprites[spriteID].data6 = arg0; + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 25; + gSprites[spriteID].subpriority = 1; + gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet2; + } +} + +static void SpriteCB_PostEvoSparkleSet1(struct Sprite* sprite) +{ + if (sprite->data5 > 8) + { + sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5); + sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5); + sprite->data5 -= sprite->data3; + sprite->data6 += 4; + } + else + DestroySprite(sprite); +} + +static void CreatePostEvoSparkleSet1(u8 arg0, u8 arg1) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data3 = arg1; + gSprites[spriteID].data5 = 120; + gSprites[spriteID].data6 = arg0; + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 31; + gSprites[spriteID].subpriority = 1; + gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet1; + } +} + +static void SpriteCB_PostEvoSparkleSet2(struct Sprite* sprite) +{ + if (!(sprite->data7 & 3)) + sprite->pos1.y++; + if (sprite->data6 < 128) + { + u8 matrixNum; + + sprite->pos2.y = -Sin((u8)(sprite->data6), sprite->data5); + sprite->pos1.x = 120 + (sprite->data3 * sprite->data7) / 3; + sprite->data6++; + matrixNum = 31 - (sprite->data6 * 12 / 128); + if (sprite->data6 > 64) + sprite->subpriority = 1; + else + { + sprite->invisible = 0; + sprite->subpriority = 20; + if (sprite->data6 > 112 && sprite->data6 & 1) + sprite->invisible = 1; + } + if (matrixNum < 20) + matrixNum = 20; + sprite->oam.matrixNum = matrixNum; + sprite->data7++; + } + else + DestroySprite(sprite); +} + +static void CreatePostEvoSparkleSet2(u8 arg0) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data3 = 3 - (Random() % 7); + gSprites[spriteID].data5 = 48 + (Random() & 0x3F); + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 31; + gSprites[spriteID].subpriority = 20; + gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet2; + } +} + +void LoadEvoSparkleSpriteAndPal(void) +{ + LoadCompressedObjectPicUsingHeap(&sEvoSparkleSpriteSheets[0]); + LoadSpritePalettes(sEvoSparkleSpritePals); +} + +#define tFrameCounter data[15] + +u8 LaunchTask_PreEvoSparklesSet1(u16 arg0) +{ + u8 taskID = CreateTask(EvoTask_BeginPreSet1_FadeAndPlaySE, 0); + gTasks[taskID].data[1] = arg0; + return taskID; +} + +static void EvoTask_BeginPreSet1_FadeAndPlaySE(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + BeginNormalPaletteFade(3 << gTasks[taskID].data[1], 0xA, 0, 0x10, 0x7FFF); + gTasks[taskID].func = EvoTask_CreatePreEvoSparkleSet1; + PlaySE(SE_W025); +} + +static void EvoTask_CreatePreEvoSparkleSet1(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 64) + { + if (!(gTasks[taskID].tFrameCounter & 7)) + { + u8 i; + for (i = 0; i < 4; i++) + CreatePreEvoSparkleSet1((0x78 & gTasks[taskID].tFrameCounter) * 2 + i * 64); + } + gTasks[taskID].tFrameCounter++; + } + else + { + gTasks[taskID].tFrameCounter = 96; + gTasks[taskID].func = EvoTask_WaitForPre1SparklesToGoUp; + } +} + +static void EvoTask_WaitForPre1SparklesToGoUp(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter != 0) + gTasks[taskID].tFrameCounter--; + else + DestroyTask(taskID); +} + +u8 LaunchTask_PreEvoSparklesSet2(void) +{ + return CreateTask(EvoTask_BeginPreSparklesSet2, 0); +} + +static void EvoTask_BeginPreSparklesSet2(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + gTasks[taskID].func = EvoTask_CreatePreEvoSparklesSet2; + PlaySE(SE_W062B); +} + +static void EvoTask_CreatePreEvoSparklesSet2(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 96) + { + if (gTasks[taskID].tFrameCounter < 6) + { + u8 i; + for (i = 0; i < 9; i++) + CreatePreEvoSparkleSet2(i * 16); + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPreSet2Task; +} + +static void EvoTask_DestroyPreSet2Task(u8 taskID) +{ + DestroyTask(taskID); +} + +u8 LaunchTask_PostEvoSparklesSet1(void) +{ + return CreateTask(EvoTask_BeginPostSparklesSet1, 0); +} + +static void EvoTask_BeginPostSparklesSet1(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet1; + PlaySE(SE_REAPOKE); +} + +static void EvoTask_CreatePostEvoSparklesSet1(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 48) + { + if (gTasks[taskID].tFrameCounter == 0) + { + u8 i; + for (i = 0; i < 16; i++) + CreatePostEvoSparkleSet1(i * 16, 4); + } + if (gTasks[taskID].tFrameCounter == 32) + { + u8 i; + for (i = 0; i < 16; i++) + CreatePostEvoSparkleSet1(i * 16, 8); + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPostSet1Task; +} + +static void EvoTask_DestroyPostSet1Task(u8 taskID) +{ + DestroyTask(taskID); +} + +u8 LaunchTask_PostEvoSparklesSet2AndFlash(u16 species) +{ + u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash, 0); + gTasks[taskID].data[2] = species; + return taskID; +} + +static void EvoTask_BeginPostSparklesSet2_AndFlash(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30); + BeginNormalPaletteFade(0xFFF9041C, 0, 0, 0x10, 0x7FFF); // was 0xFFF9001C in R/S + gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash; + PlaySE(SE_W080); +} + +static void EvoTask_CreatePostEvoSparklesSet2_AndFlash(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 128) + { + u8 i; + switch (gTasks[taskID].tFrameCounter) + { + default: + if (gTasks[taskID].tFrameCounter < 50) + CreatePostEvoSparkleSet2(Random() & 7); + break; + case 0: + for (i = 0; i < 8; i++) + CreatePostEvoSparkleSet2(i); + break; + case 32: + BeginNormalPaletteFade(0xFFFF041C, 0x10, 0x10, 0, 0x7FFF); // was 0xFFF9001C in R/S + break; + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask; +} + +static void EvoTask_DestroyPostSet2AndFlashTask(u8 taskID) +{ + if (!gPaletteFade.active) + DestroyTask(taskID); +} + +u8 LaunchTask_PostEvoSparklesSet2AndFlash_Trade(u16 species) +{ + u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash_Trade, 0); + gTasks[taskID].data[2] = species; + return taskID; +} + +static void EvoTask_BeginPostSparklesSet2_AndFlash_Trade(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30); + BeginNormalPaletteFade(0xFFF90400, 0, 0, 0x10, 0x7FFF); // was 0xFFFF0001 in R/S + gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade; + PlaySE(SE_W080); +} + +static void EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 128) + { + u8 i; + switch (gTasks[taskID].tFrameCounter) + { + default: + if (gTasks[taskID].tFrameCounter < 50) + CreatePostEvoSparkleSet2(Random() & 7); + break; + case 0: + for (i = 0; i < 8; i++) + CreatePostEvoSparkleSet2(i); + break; + case 32: + BeginNormalPaletteFade(0xFFFF0400, 0x10, 0x10, 0, 0x7FFF); // was 0xFFFF0001 in R/S + break; + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask; +} + +#undef tFrameCounter + +static void PokeEvoSprite_DummySpriteCB(struct Sprite* sprite) +{ + +} + +#define tPreEvoSpriteID data[1] +#define tPostEvoSpriteID data[2] +#define tEvoStopped data[8] + +u8 sub_817C3A0(u8 preEvoSpriteID, u8 postEvoSpriteID) +{ + u16 i; + u16 stack[16]; + u8 taskID; + s32 toDiv; + + for (i = 0; i < 16; i++) + stack[i] = 0x7FFF; + + taskID = CreateTask(sub_817C4EC, 0); + gTasks[taskID].tPreEvoSpriteID = preEvoSpriteID; + gTasks[taskID].tPostEvoSpriteID = postEvoSpriteID; + gTasks[taskID].data[3] = 256; + gTasks[taskID].data[4] = 16; + + toDiv = 65536; + SetOamMatrix(30, 256, 0, 0, 256); + SetOamMatrix(31, toDiv / gTasks[taskID].data[4], 0, 0, toDiv / gTasks[taskID].data[4]); + + gSprites[preEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB; + gSprites[preEvoSpriteID].oam.affineMode = 1; + gSprites[preEvoSpriteID].oam.matrixNum = 30; + gSprites[preEvoSpriteID].invisible = 0; + CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[preEvoSpriteID].oam.paletteNum * 16)], 16); + + gSprites[postEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB; + gSprites[postEvoSpriteID].oam.affineMode = 1; + gSprites[postEvoSpriteID].oam.matrixNum = 31; + gSprites[postEvoSpriteID].invisible = 0; + CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[postEvoSpriteID].oam.paletteNum * 16)], 16); + + gTasks[taskID].tEvoStopped = FALSE; + return taskID; +} + +static void sub_817C4EC(u8 taskID) +{ + gTasks[taskID].data[5] = 0; + gTasks[taskID].data[6] = 8; + gTasks[taskID].func = sub_817C510; +} + +static void sub_817C510(u8 taskID) +{ + if (gTasks[taskID].tEvoStopped) + PreEvoVisible_PostEvoInvisible_KillTask(taskID); + else if (gTasks[taskID].data[6] == 128) + PreEvoInvisible_PostEvoVisible_KillTask(taskID); + else + { + gTasks[taskID].data[6] += 2; + gTasks[taskID].data[5] ^= 1; + gTasks[taskID].func = sub_817C560; + } +} + +static void sub_817C560(u8 taskID) +{ + if (gTasks[taskID].tEvoStopped) + gTasks[taskID].func = PreEvoVisible_PostEvoInvisible_KillTask; + else + { + u16 oamMatrixArg; + u8 r6 = 0; + if (gTasks[taskID].data[5] == 0) + { + if (gTasks[taskID].data[3] < 256 - gTasks[taskID].data[6]) + gTasks[taskID].data[3] += gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[3] = 256; + r6++; + } + if (gTasks[taskID].data[4] > 16 + gTasks[taskID].data[6]) + gTasks[taskID].data[4] -= gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[4] = 16; + r6++; + } + } + else + { + if (gTasks[taskID].data[4] < 256 - gTasks[taskID].data[6]) + gTasks[taskID].data[4] += gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[4] = 256; + r6++; + } + if (gTasks[taskID].data[3] > 16 + gTasks[taskID].data[6]) + gTasks[taskID].data[3] -= gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[3] = 16; + r6++; + } + } + oamMatrixArg = 65536 / gTasks[taskID].data[3]; + SetOamMatrix(30, oamMatrixArg, 0, 0, oamMatrixArg); + + oamMatrixArg = 65536 / gTasks[taskID].data[4]; + SetOamMatrix(31, oamMatrixArg, 0, 0, oamMatrixArg); + if (r6 == 2) + gTasks[taskID].func = sub_817C510; + } +} + +static void PreEvoInvisible_PostEvoVisible_KillTask(u8 taskID) +{ + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = 1; + + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = 0; + + DestroyTask(taskID); +} + +static void PreEvoVisible_PostEvoInvisible_KillTask(u8 taskID) +{ + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = 0; + + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = 1; + + DestroyTask(taskID); +} From e8903fb4dd3e1f9ef260beb93a939a7e6e9a045b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 27 Oct 2017 18:52:21 +0200 Subject: [PATCH 24/29] start workin on evo scene --- asm/contest_link_80F57C4.s | 2 +- asm/evolution_scene.s | 646 ++---------------------------- asm/field_effect.s | 2 +- asm/pokeblock_feed.s | 2 +- asm/pokemon_summary_screen.s | 2 +- asm/script_pokemon_util_80F87D8.s | 2 +- include/battle.h | 1 + include/pokemon.h | 2 +- ld_script.txt | 1 + src/battle_dome_cards.c | 2 +- src/evolution_scene.c | 299 ++++++++++++++ src/pokemon_3.c | 4 +- sym_ewram.txt | 2 +- 13 files changed, 351 insertions(+), 616 deletions(-) create mode 100644 src/evolution_scene.c diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index f20070978..e6d30b7cb 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -1415,7 +1415,7 @@ _080F64F2: adds r0, r6, 0 adds r1, r5, 0 adds r2, r4, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette adds r0, r6, 0 diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index 52def72d3..23d0f5b36 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -5,579 +5,13 @@ .text - thumb_func_start sub_813D9B0 -sub_813D9B0: @ 813D9B0 - push {lr} - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end sub_813D9B0 - - thumb_func_start sub_813D9C0 -sub_813D9C0: @ 813D9C0 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r2, r0, 24 - movs r7, 0 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r6, r0, r1 - movs r1, 0x8 - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _0813D9E8 - cmp r0, 0x1 - beq _0813DA00 - b _0813DA30 - .pool -_0813D9E8: - movs r0, 0x1 - negs r0, r0 - str r7, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - b _0813DA30 -_0813DA00: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0813DA30 - movs r0, 0x1C - ldrsh r1, [r6, r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - ldrh r4, [r6, 0xC] - ldrb r5, [r6, 0xE] - ldrb r6, [r6, 0x1C] - adds r0, r2, 0 - bl DestroyTask - adds r0, r7, 0 - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl EvolutionScene -_0813DA30: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813D9C0 - - thumb_func_start BeginEvolutionScene -BeginEvolutionScene: @ 813DA40 - push {r4-r6,lr} - adds r4, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =sub_813D9C0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - strh r4, [r1, 0xC] - strh r5, [r1, 0xE] - strh r6, [r1, 0x1C] - ldr r0, =sub_813D9B0 - bl SetMainCallback2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end BeginEvolutionScene - - thumb_func_start EvolutionScene -EvolutionScene: @ 813DA8C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - adds r4, r0, 0 - mov r10, r1 - mov r0, r10 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x18] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x1C] - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - movs r1, 0 - str r1, [sp, 0x14] - add r0, sp, 0x14 - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - bl CpuSet - movs r0, 0x4C - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0 - bl SetGpuReg - movs r0, 0x46 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - bl ResetPaletteFade - ldr r0, =gBattle_BG0_X - movs r2, 0 - strh r2, [r0] - ldr r0, =gBattle_BG0_Y - strh r2, [r0] - ldr r0, =gBattle_BG1_X - strh r2, [r0] - ldr r0, =gBattle_BG1_Y - strh r2, [r0] - ldr r0, =gBattle_BG2_X - strh r2, [r0] - ldr r0, =gBattle_BG2_Y - strh r2, [r0] - ldr r1, =gBattle_BG3_X - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gBattle_BG3_Y - movs r1, 0 - strh r1, [r0] - ldr r1, =gBattleTerrain - movs r0, 0x9 - strb r0, [r1] - bl sub_80356D0 - bl LoadBattleTextboxAndBackground - bl ResetSpriteData - bl remove_some_task - bl ResetTasks - bl FreeAllSpritePalettes - ldr r0, =gReservedSpritePaletteCount - movs r2, 0x4 - strb r2, [r0] - movs r0, 0x64 - bl AllocZeroed - ldr r1, =gUnknown_0203AB80 - str r0, [r1] - bl AllocateMonSpritesGfx - adds r0, r4, 0 - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar1 - mov r1, sp - bl StringCopy10 - ldr r0, =gStringVar2 - movs r1, 0xB - mov r2, r10 - muls r2, r1 - adds r1, r2, 0 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x20] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - mov r9, r0 - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r2, =gMonSpritesGfxPtr - ldr r1, [r2] - ldr r1, [r1, 0x8] - adds r2, r5, 0 - bl DecompressPicFromTable_2 - adds r0, r5, 0 - ldr r1, [sp, 0x20] - mov r2, r9 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x88 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB80 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r3, r1, 24 - strb r0, [r2] - ldr r7, =gSprites - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r6, r7, 0 - adds r6, 0x1C - adds r0, r1, r6 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r7 - ldrb r2, [r1, 0x5] - movs r4, 0xF - adds r0, r4, 0 - ands r0, r2 - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - mov r1, r10 - lsls r0, r1, 3 - ldr r2, =gMonFrontPicTable - adds r0, r2 - ldr r2, =gMonSpritesGfxPtr - ldr r1, [r2] - ldr r1, [r1, 0x10] - mov r2, r10 - bl DecompressPicFromTable_2 - mov r0, r10 - ldr r1, [sp, 0x20] - mov r2, r9 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - mov r0, r10 - movs r1, 0x3 - bl sub_806A068 - ldr r0, =gDummySpriteAffineAnimTable - mov r1, r8 - str r0, [r1, 0x10] - mov r0, r8 - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB80 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r3, r1, 24 - strb r0, [r2, 0x1] - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r6, r1, r6 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r6] - adds r1, r7 - ldrb r0, [r1, 0x5] - ands r4, r0 - movs r0, 0x20 - orrs r4, r0 - strb r4, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - bl LoadEvoSparkleSpriteAndPal - ldr r0, =evovle_mon_maybe - movs r1, 0 - bl CreateTask - ldr r1, =gUnknown_0203AB80 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r3, r1, 24 - strb r0, [r2, 0x2] - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - strh r2, [r0, 0x8] - strh r5, [r0, 0xA] - mov r1, r10 - strh r1, [r0, 0xC] - mov r2, sp - ldrh r2, [r2, 0x18] - strh r2, [r0, 0xE] - movs r1, 0x1 - strh r1, [r0, 0x10] - movs r1, 0 - strh r1, [r0, 0x1A] - mov r2, sp - ldrh r2, [r2, 0x1C] - strh r2, [r0, 0x1C] - ldr r1, =gUnknown_0203AB80 - ldr r0, [r1] - ldr r1, =gPlttBufferUnfaded + 0x40 - adds r0, 0x4 - movs r2, 0x60 - bl memcpy - movs r1, 0xFA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =nullsub_83 - bl SetHBlankCallback - ldr r0, =sub_813FCDC - bl SetVBlankCallback - bl m4aMPlayAllStop - ldr r0, =sub_813E3A4 - bl SetMainCallback2 - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end EvolutionScene - - thumb_func_start sub_813DD7C -sub_813DD7C: @ 813DD7C - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x8 - ldr r2, =gTasks - ldr r0, =gUnknown_0203AB80 - mov r8, r0 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - adds r4, r2, 0 - muls r4, r1 - ldr r1, =gPlayerParty - adds r4, r1 - ldrh r5, [r0, 0xC] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - mov r9, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r6, r0, 0 - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - movs r4, 0 - str r4, [sp, 0x4] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - add r0, sp, 0x4 - bl CpuSet - movs r0, 0x4C - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0 - bl SetGpuReg - movs r0, 0x46 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - bl ResetPaletteFade - ldr r0, =gBattle_BG0_X - strh r4, [r0] - ldr r0, =gBattle_BG0_Y - strh r4, [r0] - ldr r0, =gBattle_BG1_X - strh r4, [r0] - ldr r0, =gBattle_BG1_Y - strh r4, [r0] - ldr r0, =gBattle_BG2_X - strh r4, [r0] - ldr r0, =gBattle_BG2_Y - strh r4, [r0] - ldr r1, =gBattle_BG3_X - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gBattle_BG3_Y - strh r4, [r0] - ldr r1, =gBattleTerrain - movs r0, 0x9 - strb r0, [r1] - bl sub_80356D0 - bl LoadBattleTextboxAndBackground - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x4 - strb r0, [r1] - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - adds r2, r5, 0 - bl DecompressPicFromTable_2 - adds r0, r5, 0 - mov r1, r9 - adds r2, r6, 0 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0x3 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - mov r2, r8 - ldr r1, [r2] - lsls r2, r0, 24 - lsrs r2, 24 - strb r0, [r1, 0x1] - ldr r3, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - movs r1, 0xFA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =nullsub_83 - bl SetHBlankCallback - ldr r0, =sub_813FCDC - bl SetVBlankCallback - ldr r0, =sub_813E3A4 - bl SetMainCallback2 - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813DD7C thumb_func_start sub_813DF70 sub_813DF70: @ 813DF70 push {r4-r6,lr} sub sp, 0xC ldr r2, =gTasks - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r1, [r0, 0x2] lsls r0, r1, 2 @@ -653,7 +87,7 @@ _0813DFE0: .pool _0813E050: bl ResetPaletteFade - ldr r0, =nullsub_83 + ldr r0, =EvoDummyFunc bl SetHBlankCallback ldr r0, =sub_813FD64 bl SetVBlankCallback @@ -705,7 +139,7 @@ _0813E0A8: adds r0, r6, 0 adds r1, r5, 0 adds r2, r4, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality ldr r0, [r0] movs r1, 0x90 lsls r1, 1 @@ -724,7 +158,7 @@ _0813E0F0: movs r2, 0x40 movs r3, 0x1E bl CreateSprite - ldr r1, =gUnknown_0203AB80 + ldr r1, =gEvoStructPtr ldr r1, [r1] lsls r2, r0, 24 lsrs r2, 24 @@ -856,7 +290,7 @@ sub_813E1D4: @ 813E1D4 movs r1, 0x1 bl GetMonData mov r10, r0 - ldr r1, =gUnknown_0203AB80 + ldr r1, =gEvoStructPtr mov r9, r1 movs r0, 0x64 bl AllocZeroed @@ -875,7 +309,7 @@ sub_813E1D4: @ 813E1D4 adds r0, r5, 0 mov r1, r10 adds r2, r7, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality ldr r0, [r0] movs r1, 0x90 lsls r1, 1 @@ -980,8 +414,8 @@ sub_813E1D4: @ 813E1D4 .pool thumb_func_end sub_813E1D4 - thumb_func_start sub_813E3A4 -sub_813E3A4: @ 813E3A4 + thumb_func_start CB2_EvolutionSceneUpdate +CB2_EvolutionSceneUpdate: @ 813E3A4 push {lr} bl AnimateSprites bl BuildOamBuffer @@ -990,7 +424,7 @@ sub_813E3A4: @ 813E3A4 bl RunTasks pop {r0} bx r0 - thumb_func_end sub_813E3A4 + thumb_func_end CB2_EvolutionSceneUpdate thumb_func_start sub_813E3C0 sub_813E3C0: @ 813E3C0 @@ -1183,8 +617,8 @@ _0813E546: .pool thumb_func_end evovle_mon_internal_maybe - thumb_func_start evovle_mon_maybe -evovle_mon_maybe: @ 813E570 + thumb_func_start Task_EvolutionScene +Task_EvolutionScene: @ 813E570 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -1292,7 +726,7 @@ _0813E670: movs r3, 0 bl BeginNormalPaletteFade ldr r2, =gSprites - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r1, [r0] lsls r0, r1, 4 @@ -1354,7 +788,7 @@ _0813E714: beq _0813E724 bl _0813F1A4 _0813E724: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r0, [r0] ldr r1, =gTasks @@ -1365,7 +799,7 @@ _0813E724: b _0813EB90 .pool _0813E740: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r0, [r0] bl sub_8140208 @@ -1450,7 +884,7 @@ _0813E7FE: ldrh r0, [r1, 0x8] adds r0, 0x1 strh r0, [r1, 0x8] - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r1, [r0] movs r0, 0x1 strb r0, [r1, 0x3] @@ -1470,7 +904,7 @@ _0813E828: beq _0813E83E bl _0813F1A4 _0813E83E: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r1, [r0] ldrb r0, [r1] ldrb r1, [r1, 0x1] @@ -1483,7 +917,7 @@ _0813E83E: b _0813EC52 .pool _0813E860: - ldr r2, =gUnknown_0203AB80 + ldr r2, =gEvoStructPtr ldr r1, [r2] ldrb r0, [r1, 0x3] subs r0, 0x1 @@ -1574,7 +1008,7 @@ _0813E918: _0813E926: bl m4aMPlayAllStop ldr r0, =gPlttBufferUnfaded + 0x40 - ldr r1, =gUnknown_0203AB80 + ldr r1, =gEvoStructPtr ldr r1, [r1] adds r1, 0x4 movs r2, 0x60 @@ -1603,7 +1037,7 @@ _0813E964: beq _0813E974 bl _0813F1A4 _0813E974: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r0, [r0, 0x1] mov r1, r8 @@ -1776,7 +1210,7 @@ _0813EB06: adds r0, r7, 0 bl DestroyTask bl FreeMonSpritesGfx - ldr r4, =gUnknown_0203AB80 + ldr r4, =gEvoStructPtr ldr r0, [r4] bl Free str r6, [r4] @@ -1821,7 +1255,7 @@ _0813EB74: beq _0813EB82 b _0813F1A4 _0813EB82: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r0, [r0] mov r3, r8 @@ -1839,7 +1273,7 @@ _0813EB96: b _0813F1A4 .pool _0813EBA8: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r0, [r0] bl sub_8140208 @@ -2236,7 +1670,7 @@ _0813EF3E: subs r2, 0x1 lsls r2, 24 lsrs r2, 24 - ldr r3, =sub_813DD7C + ldr r3, =CB2_EvolutionSceneLoadGraphics ldr r4, =gMoveToLearn ldrh r4, [r4] str r4, [sp] @@ -2256,7 +1690,7 @@ _0813EF88: b _0813F1A4 _0813EF96: ldr r1, [r6, 0x4] - ldr r0, =sub_813E3A4 + ldr r0, =CB2_EvolutionSceneUpdate cmp r1, r0 beq _0813EFA0 b _0813F1A4 @@ -2472,7 +1906,7 @@ _0813F1A4: pop {r0} bx r0 .pool - thumb_func_end evovle_mon_maybe + thumb_func_end Task_EvolutionScene thumb_func_start sub_813F1B8 sub_813F1B8: @ 813F1B8 @@ -2619,7 +2053,7 @@ _0813F324: movs r0, 0x1 bl sub_8140000 ldr r2, =gSprites - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r1, [r0] lsls r0, r1, 4 @@ -2666,7 +2100,7 @@ _0813F396: ldrh r1, [r0, 0x8] adds r1, 0x1 strh r1, [r0, 0x8] - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r1, [r0] movs r0, 0x1 strb r0, [r1, 0x3] @@ -2686,7 +2120,7 @@ _0813F3C0: beq _0813F3D6 bl _0813FCC4 _0813F3D6: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r1, [r0] ldrb r0, [r1] ldrb r1, [r1, 0x1] @@ -2695,7 +2129,7 @@ _0813F3D6: b _0813F6AC .pool _0813F3F0: - ldr r2, =gUnknown_0203AB80 + ldr r2, =gEvoStructPtr ldr r1, [r2] ldrb r0, [r1, 0x3] subs r0, 0x1 @@ -2779,7 +2213,7 @@ _0813F4A6: ldr r0, =gUnknown_0203AB84 ldr r0, [r0] bl Free - ldr r5, =gUnknown_0203AB80 + ldr r5, =gEvoStructPtr ldr r0, [r5] ldrb r0, [r0, 0x1] ldr r1, =gTasks @@ -2935,7 +2369,7 @@ _0813F624: _0813F634: adds r0, r7, 0 bl DestroyTask - ldr r4, =gUnknown_0203AB80 + ldr r4, =gEvoStructPtr ldr r0, [r4] bl Free str r5, [r4] @@ -2964,7 +2398,7 @@ _0813F668: _0813F67C: bl m4aMPlayAllStop ldr r2, =gSprites - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r1, [r0] lsls r0, r1, 4 @@ -3004,7 +2438,7 @@ _0813F6D0: beq _0813F6DE b _0813FCC4 _0813F6DE: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r0, [r0] lsls r4, r7, 2 @@ -3020,7 +2454,7 @@ _0813F6F2: b _0813FCC4 .pool _0813F704: - ldr r0, =gUnknown_0203AB80 + ldr r0, =gEvoStructPtr ldr r0, [r0] ldrb r0, [r0] bl sub_8140208 @@ -3622,13 +3056,13 @@ _0813FCC4: .pool thumb_func_end sub_813F1B8 - thumb_func_start nullsub_83 -nullsub_83: @ 813FCD8 + thumb_func_start EvoDummyFunc +EvoDummyFunc: @ 813FCD8 bx lr - thumb_func_end nullsub_83 + thumb_func_end EvoDummyFunc - thumb_func_start sub_813FCDC -sub_813FCDC: @ 813FCDC + thumb_func_start VBlankCB_EvolutionScene +VBlankCB_EvolutionScene: @ 813FCDC push {lr} ldr r0, =gBattle_BG0_X ldrh r1, [r0] @@ -3669,7 +3103,7 @@ sub_813FCDC: @ 813FCDC pop {r0} bx r0 .pool - thumb_func_end sub_813FCDC + thumb_func_end VBlankCB_EvolutionScene thumb_func_start sub_813FD64 sub_813FD64: @ 813FD64 diff --git a/asm/field_effect.s b/asm/field_effect.s index 323e56bfe..964bf8079 100644 --- a/asm/field_effect.s +++ b/asm/field_effect.s @@ -694,7 +694,7 @@ sub_80B5FE8: @ 80B5FE8 lsls r5, 16 lsrs r5, 16 adds r0, r6, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality mov r8, r0 lsls r4, 16 asrs r4, 16 diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index 1f8e45f0a..a3047e225 100644 --- a/asm/pokeblock_feed.s +++ b/asm/pokeblock_feed.s @@ -348,7 +348,7 @@ _08179E84: adds r1, r0, 0 adds r0, r5, 0 adds r2, r4, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette ldrh r0, [r4, 0x4] diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index fd2518075..232af794d 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -1087,7 +1087,7 @@ _081C4750: ldrh r0, [r5, 0x2] ldr r1, [r5, 0x48] ldr r2, [r5, 0xC] - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette ldrh r0, [r4, 0x4] diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index 18d7b7fe3..98510dd9e 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -732,7 +732,7 @@ _080F8DD8: adds r0, r6, 0 mov r1, r8 adds r2, r5, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette adds r0, r6, 0 diff --git a/include/battle.h b/include/battle.h index 3328c691f..0bdeb4f1e 100644 --- a/include/battle.h +++ b/include/battle.h @@ -229,6 +229,7 @@ #define BATTLE_TERRAIN_ROCK 6 #define BATTLE_TERRAIN_CAVE 7 #define BATTLE_TERRAIN_INSIDE 8 +#define BATTLE_TERRAIN_PLAIN 9 // array entries for battle communication #define MULTIUSE_STATE 0x0 diff --git a/include/pokemon.h b/include/pokemon.h index 4159a2f96..c1c61d241 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -620,7 +620,7 @@ void SetWildMonHeldItem(void); u16 GetMonEVCount(struct Pokemon *); const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon); -const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality); +const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality); bool32 IsHMMove2(u16 move); bool8 IsPokeSpriteNotFlipped(u16 species); bool8 IsMonShiny(struct Pokemon *mon); diff --git a/ld_script.txt b/ld_script.txt index da9d4a154..98fc00ce4 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -180,6 +180,7 @@ SECTIONS { asm/rom6.o(.text); asm/battle_records.o(.text); asm/pokedex_area_screen.o(.text); + src/evolution_scene.o(.text); asm/evolution_scene.o(.text); asm/roulette.o(.text); asm/pokedex_cry_screen.o(.text); diff --git a/src/battle_dome_cards.c b/src/battle_dome_cards.c index 5251ee06a..e6c67b20e 100644 --- a/src/battle_dome_cards.c +++ b/src/battle_dome_cards.c @@ -124,7 +124,7 @@ static void sub_818D0C4(u16 species, u32 otId, u32 personality, u8 paletteSlot, else { gUnknown_0203CCEC.paletteTag = paletteTag; - LoadCompressedObjectPalette(sub_806E7CC(species, otId, personality)); + LoadCompressedObjectPalette(GetMonSpritePalStructFromOtIdPersonality(species, otId, personality)); } } else diff --git a/src/evolution_scene.c b/src/evolution_scene.c new file mode 100644 index 000000000..d86258444 --- /dev/null +++ b/src/evolution_scene.c @@ -0,0 +1,299 @@ +#include "global.h" +#include "evolution_scene.h" +#include "evolution_graphics.h" +#include "sprite.h" +#include "malloc.h" +#include "task.h" +#include "palette.h" +#include "main.h" +#include "text.h" +#include "text_window.h" +#include "pokemon.h" +#include "string_util.h" +#include "battle.h" +#include "unknown_task.h" +#include "decompress.h" +#include "m4a.h" +#include "menu.h" +#include "pokedex.h" +#include "species.h" +#include "sound.h" +#include "songs.h" +#include "overworld.h" +#include "battle_message.h" +#include "gpu_regs.h" +#include "bg.h" + +struct EvoInfo +{ + u8 preEvoSpriteID; + u8 postEvoSpriteID; + u8 evoTaskID; + u16 savedPalette[48]; +}; + +extern struct EvoInfo *gEvoStructPtr; + +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gBattle_BG1_X; +extern u16 gBattle_BG1_Y; +extern u16 gBattle_BG2_X; +extern u16 gBattle_BG2_Y; +extern u16 gBattle_BG3_X; +extern u16 gBattle_BG3_Y; +extern u16 gBattle_WIN0H; +extern u16 gBattle_WIN0V; +extern u16 gBattle_WIN1H; +extern u16 gBattle_WIN1V; +extern u8 gBattleTerrain; +extern struct SpriteTemplate gUnknown_0202499C; + +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; + +extern void SpriteCallbackDummy_2(struct Sprite *sprite); +extern void sub_80356D0(void); +extern void sub_806A068(u16, u8); + +// this file's functions +void Task_EvolutionScene(u8 taskID); +void Task_TradeEvolutionScene(u8 taskID); +void CB2_EvolutionSceneUpdate(void); +void CB2_TradeEvolutionSceneUpdate(void); +void EvoDummyFunc(void); +void EvoDummyFunc2(void); +void VBlankCB_EvolutionScene(void); +void VBlankCB_TradeEvolutionScene(void); +void sub_81150D8(void); + +void CB2_BeginEvolutionScene(void) +{ + UpdatePaletteFade(); + RunTasks(); +} + +#define tState data[0] +#define tPreEvoSpecies data[1] +#define tPostEvoSpecies data[2] +#define tCanStop data[3] +#define tBits data[3] +#define tLearnsFirstMove data[4] +#define tLearnMoveState data[6] +#define tData7 data[7] +#define tData8 data[8] +#define tEvoWasStopped data[9] +#define tPartyID data[10] + +#define TASK_BIT_CAN_STOP 0x1 +#define TASK_BIT_LEARN_MOVE 0x80 + +void Task_BeginEvolutionScene(u8 taskID) +{ + struct Pokemon* mon = NULL; + switch (gTasks[taskID].tState) + { + case 0: + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskID].tState++; + break; + case 1: + if (!gPaletteFade.active) + { + u16 speciesToEvolve; + bool8 canStopEvo; + u8 partyID; + + mon = &gPlayerParty[gTasks[taskID].tPartyID]; + speciesToEvolve = gTasks[taskID].tPostEvoSpecies; + canStopEvo = gTasks[taskID].tCanStop; + partyID = gTasks[taskID].tPartyID; + + DestroyTask(taskID); + EvolutionScene(mon, speciesToEvolve, canStopEvo, partyID); + } + break; + } +} + +void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID) +{ + u8 taskID = CreateTask(Task_BeginEvolutionScene, 0); + gTasks[taskID].tState = 0; + gTasks[taskID].tPostEvoSpecies = speciesToEvolve; + gTasks[taskID].tCanStop = canStopEvo; + gTasks[taskID].tPartyID = partyID; + SetMainCallback2(CB2_BeginEvolutionScene); +} + +void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID) +{ + u8 name[20]; + u16 currSpecies; + u32 TiD, PiD; + const struct CompressedSpritePalette* pokePal; + u8 ID; + + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + CpuFill32(0, (void*)(VRAM), VRAM_SIZE); + + SetGpuReg(REG_OFFSET_MOSAIC, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + + ResetPaletteFade(); + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + + gBattleTerrain = BATTLE_TERRAIN_PLAIN; + + sub_80356D0(); + LoadBattleTextboxAndBackground(); + ResetSpriteData(); + remove_some_task(); + ResetTasks(); + FreeAllSpritePalettes(); + + gReservedSpritePaletteCount = 4; + + gEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); + AllocateMonSpritesGfx(); + + GetMonData(mon, MON_DATA_NICKNAME, name); + StringCopy10(gStringVar1, name); + StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]); + + // preEvo sprite + currSpecies = GetMonData(mon, MON_DATA_SPECIES); + TiD = GetMonData(mon, MON_DATA_OT_ID); + PiD = GetMonData(mon, MON_DATA_PERSONALITY); + DecompressPicFromTable_2(&gMonFrontPicTable[currSpecies], + gMonSpritesGfxPtr->sprites[1], + currSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, TiD, PiD); + LoadCompressedPalette(pokePal->data, 0x110, 0x20); + + sub_806A068(currSpecies, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + gEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 1; + gSprites[ID].invisible = 1; + + // postEvo sprite + DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], + gMonSpritesGfxPtr->sprites[3], + speciesToEvolve); + pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, TiD, PiD); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + + sub_806A068(speciesToEvolve, 3); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gSprites[ID].invisible = 1; + + LoadEvoSparkleSpriteAndPal(); + + gEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0); + gTasks[ID].tState = 0; + gTasks[ID].tPreEvoSpecies = currSpecies; + gTasks[ID].tPostEvoSpecies = speciesToEvolve; + gTasks[ID].tCanStop = canStopEvo; + gTasks[ID].tLearnsFirstMove = TRUE; + gTasks[ID].tEvoWasStopped = FALSE; + gTasks[ID].tPartyID = partyID; + + memcpy(&gEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); + + SetHBlankCallback(EvoDummyFunc); + SetVBlankCallback(VBlankCB_EvolutionScene); + m4aMPlayAllStop(); + SetMainCallback2(CB2_EvolutionSceneUpdate); +} + +void CB2_EvolutionSceneLoadGraphics(void) +{ + u8 ID; + const struct CompressedSpritePalette* pokePal; + u16 postEvoSpecies; + u32 TiD, PiD; + struct Pokemon* Mon = &gPlayerParty[gTasks[gEvoStructPtr->evoTaskID].tPartyID]; + + postEvoSpecies = gTasks[gEvoStructPtr->evoTaskID].tPostEvoSpecies; + TiD = GetMonData(Mon, MON_DATA_OT_ID); + PiD = GetMonData(Mon, MON_DATA_PERSONALITY); + + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + CpuFill32(0, (void*)(VRAM), VRAM_SIZE); + + SetGpuReg(REG_OFFSET_MOSAIC, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + + ResetPaletteFade(); + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + + gBattleTerrain = BATTLE_TERRAIN_PLAIN; + + sub_80356D0(); + LoadBattleTextboxAndBackground(); + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 4; + + DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], + gMonSpritesGfxPtr->sprites[3], + postEvoSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, TiD, PiD); + + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + + sub_806A068(postEvoSpecies, 3); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); + + SetHBlankCallback(EvoDummyFunc); + SetVBlankCallback(VBlankCB_EvolutionScene); + SetMainCallback2(CB2_EvolutionSceneUpdate); + + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); +} diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 5ff99aee2..25b30ef77 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1267,10 +1267,10 @@ const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon) u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0); u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); - return sub_806E7CC(species, otId, personality); + return GetMonSpritePalStructFromOtIdPersonality(species, otId, personality); } -const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality) +const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality) { u32 shinyValue; diff --git a/sym_ewram.txt b/sym_ewram.txt index d2779079e..32189b126 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1280,7 +1280,7 @@ gUnknown_0203AB78: @ 203AB78 gUnknown_0203AB7C: @ 203AB7C .space 0x4 -gUnknown_0203AB80: @ 203AB80 +gEvoStructPtr: @ 203AB80 .space 0x4 gUnknown_0203AB84: @ 203AB84 From 51df918c04a8dc0db21ad6a80eb74bebc16cba9f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 29 Oct 2017 16:15:23 +0100 Subject: [PATCH 25/29] evo scene file is done --- asm/battle_1.s | 26 +- asm/battle_controller_linkopponent.s | 2 +- asm/battle_controller_linkpartner.s | 2 +- asm/battle_controller_opponent.s | 2 +- asm/battle_controller_player.s | 36 +- asm/battle_controller_player_partner.s | 2 +- asm/battle_controller_recorded_opponent.s | 2 +- asm/battle_controller_recorded_player.s | 2 +- asm/battle_controller_safari.s | 6 +- asm/battle_controller_wally.s | 6 +- asm/battle_frontier_2.s | 20 +- asm/evolution_scene.s | 3650 --------------------- asm/party_menu.s | 4 +- asm/trade.s | 12 +- include/battle_message.h | 3 +- include/battle_script_commands.h | 6 +- include/evolution_scene.h | 2 +- ld_script.txt | 1 - src/battle_2.c | 38 +- src/battle_message.c | 2 +- src/battle_script_commands.c | 80 +- src/evolution_scene.c | 1257 ++++++- sym_common.txt | 2 +- sym_ewram.txt | 6 +- 24 files changed, 1361 insertions(+), 3808 deletions(-) delete mode 100644 asm/evolution_scene.s diff --git a/asm/battle_1.s b/asm/battle_1.s index 9a981e222..9665b0d11 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -1888,7 +1888,7 @@ sub_8035C4C: @ 8035C4C bne _08035C68 ldr r0, =gText_Draw movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035C68: @@ -1964,10 +1964,10 @@ _08035CE2: _08035CFC: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D20: @@ -1985,19 +1985,19 @@ _08035D20: _08035D36: ldr r0, =gText_Win movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D58: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08035D68: pop {r0} bx r0 @@ -2068,14 +2068,14 @@ _08035DDC: _08035DE6: adds r0, r1, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 b _08035E14 _08035DF4: adds r0, r1, 0 movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 str r0, [sp] @@ -2085,7 +2085,7 @@ _08035DF4: _08035E08: adds r0, r1, 0 movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 _08035E14: @@ -2099,7 +2099,7 @@ _08035E1A: _08035E22: adds r0, r1, 0 movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 str r0, [sp] @@ -2139,14 +2139,14 @@ _08035E66: adds r1, r0, r4 adds r0, r1, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter lsls r0, r6, 3 subs r0, r6 lsls r0, 2 adds r1, r0, r4 adds r0, r1, 0 movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0x7 str r4, [sp] adds r0, r7, 0 diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index d4e248d8c..3c7915861 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -5045,7 +5045,7 @@ sub_8066FF4: @ 8066FF4 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index adc5cdb84..9962c0bdb 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -4354,7 +4354,7 @@ sub_814D590: @ 814D590 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index b66e373ca..1536ba75c 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -5185,7 +5185,7 @@ sub_8061F34: @ 8061F34 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 10b675714..4788be082 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -1247,7 +1247,7 @@ _08057F80: bl battle_menu_cursor_related_2 ldr r0, =gText_BattleSwitchWhich movs r1, 0xB - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldr r0, =gActiveBank ldrb r0, [r0] @@ -4244,11 +4244,11 @@ sub_80599D4: @ 80599D4 movs r0, 0x5 bl PlaySE ldrb r0, [r4] - bl BattleDestroyCursorAt + bl BattleDestroyYesNoCursorAt movs r0, 0 strb r0, [r4] movs r0, 0 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt _08059A02: ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -4263,11 +4263,11 @@ _08059A02: movs r0, 0x5 bl PlaySE ldrb r0, [r4] - bl BattleDestroyCursorAt + bl BattleDestroyYesNoCursorAt movs r0, 0x1 strb r0, [r4] movs r0, 0x1 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt _08059A2C: ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -4281,7 +4281,7 @@ _08059A2C: movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0x5 bl PlaySE ldr r0, =gUnknown_03005D74 @@ -4314,7 +4314,7 @@ _08059A7A: movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0x5 bl PlaySE bl PlayerBufferExecCompleted @@ -4355,7 +4355,7 @@ _08059AC4: lsls r1, 24 lsrs r1, 24 adds r0, r7, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrh r0, [r4] cmp r0, 0 beq _08059AF4 @@ -4382,7 +4382,7 @@ sub_8059B18: @ 8059B18 bl StringCopy adds r0, r4, 0 movs r1, 0x7 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 @@ -4432,7 +4432,7 @@ sub_8059B3C: @ 8059B3C bl ConvertIntToDecimalStringN adds r0, r6, 0 movs r1, 0x9 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08059B98: pop {r4-r7} pop {r0} @@ -4481,7 +4481,7 @@ sub_8059BB0: @ 8059BB0 bl StringCopy adds r0, r6, 0 movs r1, 0xA - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4-r6} pop {r0} bx r0 @@ -4718,7 +4718,7 @@ b_link_standby_message: @ 8059DC0 strh r1, [r0] ldr r0, =gText_LinkStandby movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08059DE0: pop {r0} bx r0 @@ -8458,7 +8458,7 @@ sub_805BF80: @ 805BF80 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -8534,7 +8534,7 @@ dp01t_12_6_battle_menu: @ 805C044 bl sub_817F2A8 ldr r0, =gText_BattleMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _0805C062: lsls r0, r4, 24 @@ -8554,7 +8554,7 @@ _0805C062: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 @@ -8577,15 +8577,15 @@ sub_805C0B0: @ 805C0B0 movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow ldr r0, =gText_BattleYesNoChoice movs r1, 0xC - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gUnknown_03005D74 movs r0, 0x1 strb r0, [r1] movs r0, 0x1 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index f82e1c3c3..4d24f101f 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -4966,7 +4966,7 @@ sub_81BDA4C: @ 81BDA4C bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index f98c10a6c..9afc8ee2f 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -4722,7 +4722,7 @@ sub_8188E90: @ 8188E90 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 6f3976205..7dd4d59d4 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -4822,7 +4822,7 @@ sub_818C43C: @ 818C43C bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index d7efd69fe..9c16ae343 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -792,7 +792,7 @@ dp01t_10_6_message: @ 81599DC bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -862,7 +862,7 @@ sub_8159A94: @ 8159A94 str r1, [r0] ldr r0, =gText_SafariZoneMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _08159AAE: lsls r0, r4, 24 @@ -882,7 +882,7 @@ _08159AAE: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index e1d92de0d..d7c1cc666 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -3606,7 +3606,7 @@ sub_816A3B8: @ 816A3B8 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -3676,7 +3676,7 @@ dp01t_12_1_battle_menu: @ 816A470 str r1, [r0] ldr r0, =gText_BattleMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _0816A48A: lsls r0, r4, 24 @@ -3696,7 +3696,7 @@ _0816A48A: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 37ddc7ac6..ac92b3c2a 100755 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -20557,7 +20557,7 @@ _081A5306: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow b _081A553E .pool _081A531C: @@ -20582,29 +20582,29 @@ _081A5328: ldr r4, =gDisplayedStringBattle adds r0, r4, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Vs movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_OpponentMon1Name bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Mind movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Skill movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Body movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Judgement bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _081A553E .pool _081A53B4: @@ -20688,7 +20688,7 @@ _081A5464: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r0, [r5] adds r0, 0x1 strb r0, [r5] @@ -20733,7 +20733,7 @@ _081A54D4: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0 bl CopyBgTilemapBufferToVram ldr r0, =gMPlay_BGM diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s deleted file mode 100644 index 23d0f5b36..000000000 --- a/asm/evolution_scene.s +++ /dev/null @@ -1,3650 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start sub_813DF70 -sub_813DF70: @ 813DF70 - push {r4-r6,lr} - sub sp, 0xC - ldr r2, =gTasks - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - muls r2, r1 - ldr r1, =gPlayerParty - adds r4, r2, r1 - ldrh r6, [r0, 0xC] - ldr r0, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0x7 - bls _0813DFA2 - b _0813E1C8 -_0813DFA2: - lsls r0, 2 - ldr r1, =_0813DFC0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813DFC0: - .4byte _0813DFE0 - .4byte _0813E050 - .4byte _0813E078 - .4byte _0813E07E - .4byte _0813E0A8 - .4byte _0813E0F0 - .4byte _0813E160 - .4byte _0813E198 -_0813DFE0: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x4 - strb r0, [r1] - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gBattle_BG1_X - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - ldr r2, =gBattle_BG3_X - movs r3, 0x80 - lsls r3, 1 - adds r0, r3, 0 - strh r0, [r2] - ldr r0, =gBattle_BG3_Y - strh r1, [r0] - b _0813E180 - .pool -_0813E050: - bl ResetPaletteFade - ldr r0, =EvoDummyFunc - bl SetHBlankCallback - ldr r0, =sub_813FD64 - bl SetVBlankCallback - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _0813E188 - .pool -_0813E078: - bl sub_807F19C - b _0813E180 -_0813E07E: - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _0813E188 - .pool -_0813E0A8: - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - adds r5, r0, 0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r4, r0, 0 - lsls r0, r6, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - adds r2, r6, 0 - bl DecompressPicFromTable_2 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r4, 0 - bl GetMonSpritePalStructFromOtIdPersonality - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - b _0813E180 - .pool -_0813E0F0: - adds r0, r6, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gEvoStructPtr - ldr r1, [r1] - lsls r2, r0, 24 - lsrs r2, 24 - strb r0, [r1, 0x1] - ldr r3, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_807B154 - b _0813E1C8 - .pool -_0813E160: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0813E174 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 -_0813E174: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes -_0813E180: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_0813E188: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0813E1C8 - .pool -_0813E198: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl sub_807B140 - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - ldr r0, =sub_813E3C0 - bl SetMainCallback2 - movs r1, 0x9A - lsls r1, 5 - movs r0, 0 - bl SetGpuReg -_0813E1C8: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813DF70 - - thumb_func_start sub_813E1D4 -sub_813E1D4: @ 813E1D4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar1 - mov r1, sp - bl StringCopy10 - ldr r0, =gStringVar2 - movs r1, 0xB - muls r1, r5 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - ldr r1, =gAffineAnimsDisabled - movs r0, 0x1 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r7, r0, 0 - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - mov r10, r0 - ldr r1, =gEvoStructPtr - mov r9, r1 - movs r0, 0x64 - bl AllocZeroed - mov r2, r9 - str r0, [r2] - movs r4, 0 - strb r6, [r0] - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x8] - adds r2, r5, 0 - bl DecompressPicFromTable_2 - adds r0, r5, 0 - mov r1, r10 - adds r2, r7, 0 - bl GetMonSpritePalStructFromOtIdPersonality - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - mov r1, r9 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r6, r1, 24 - strb r0, [r2, 0x1] - ldr r3, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - bl LoadEvoSparkleSpriteAndPal - ldr r0, =sub_813F1B8 - movs r1, 0 - bl CreateTask - mov r1, r9 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r6, r1, 24 - strb r0, [r2, 0x2] - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - mov r2, r8 - strh r2, [r0, 0xA] - strh r5, [r0, 0xC] - movs r1, 0x1 - strh r1, [r0, 0x10] - strh r4, [r0, 0x1A] - mov r1, sp - ldrh r1, [r1, 0x14] - strh r1, [r0, 0x1C] - ldr r0, =gBattle_BG0_X - strh r4, [r0] - ldr r0, =gBattle_BG0_Y - strh r4, [r0] - ldr r0, =gBattle_BG1_X - strh r4, [r0] - ldr r0, =gBattle_BG1_Y - strh r4, [r0] - ldr r0, =gBattle_BG2_X - strh r4, [r0] - ldr r0, =gBattle_BG2_Y - strh r4, [r0] - ldr r1, =gBattle_BG3_X - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gBattle_BG3_Y - strh r4, [r0] - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_813FD64 - bl SetVBlankCallback - ldr r0, =sub_813E3C0 - bl SetMainCallback2 - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813E1D4 - - thumb_func_start CB2_EvolutionSceneUpdate -CB2_EvolutionSceneUpdate: @ 813E3A4 - push {lr} - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end CB2_EvolutionSceneUpdate - - thumb_func_start sub_813E3C0 -sub_813E3C0: @ 813E3C0 - push {lr} - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end sub_813E3C0 - - thumb_func_start evovle_mon_internal_maybe -evovle_mon_internal_maybe: @ 813E3DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - str r1, [sp, 0x4] - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - movs r0, 0 - str r0, [sp] - mov r0, r10 - lsls r0, 2 - str r0, [sp, 0x8] - add r0, r10 - lsls r7, r0, 3 - ldr r1, =gEvolutionTable - adds r1, r7 - mov r8, r1 - ldrh r0, [r1] - cmp r0, 0xD - beq _0813E40C - b _0813E546 -_0813E40C: - ldr r6, =gPlayerPartyCount - ldrb r0, [r6] - cmp r0, 0x5 - bls _0813E416 - b _0813E546 -_0813E416: - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - mov r9, r0 - ldr r1, [sp, 0x4] - movs r2, 0x64 - bl CopyMon - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - ldr r1, =gEvolutionTable - adds r2, r1, r7 - adds r2, 0xC - movs r1, 0xB - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - mov r1, r8 - ldrh r2, [r1, 0xC] - movs r1, 0xB - muls r2, r1 - ldr r1, =gSpeciesNames - adds r2, r1 - movs r1, 0x2 - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0xC - mov r2, sp - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x8 - mov r2, sp - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0xA - mov r2, sp - bl SetMonData - movs r4, 0x32 - ldr r0, [sp, 0x8] - mov r8, r0 - adds r5, r6, 0 -_0813E484: - ldrb r1, [r5] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - adds r4, 0x1 - cmp r4, 0x36 - ble _0813E484 - movs r4, 0x43 - ldr r7, =gPlayerPartyCount -_0813E4A0: - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - adds r4, 0x1 - cmp r4, 0x4F - ble _0813E4A0 - ldr r4, =gPlayerPartyCount - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x37 - mov r2, sp - bl SetMonData - movs r0, 0xFF - str r0, [sp] - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x40 - mov r2, sp - bl SetMonData - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - bl CalculateMonStats - bl CalculatePlayerPartyCount - ldr r0, =gEvolutionTable - mov r4, r8 - add r4, r10 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - mov r0, r9 - movs r1, 0xB - bl GetMonData - ldr r1, =0x0000012f - cmp r0, r1 - bne _0813E546 - mov r0, r9 - movs r1, 0x3 - bl GetMonData - cmp r0, 0x1 - bne _0813E546 - ldr r0, [sp, 0x4] - movs r1, 0xB - bl GetMonData - movs r1, 0x97 - lsls r1, 1 - cmp r0, r1 - bne _0813E546 - ldr r2, =gUnknown_085B58C4 - mov r0, r9 - movs r1, 0x2 - bl SetMonData -_0813E546: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end evovle_mon_internal_maybe - - thumb_func_start Task_EvolutionScene -Task_EvolutionScene: @ 813E570 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r3, r0, r2 - movs r0, 0x1C - ldrsh r1, [r3, r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - mov r9, r1 - ldr r0, =gMain - ldrh r1, [r0, 0x2C] - adds r5, r2, 0 - adds r6, r0, 0 - cmp r1, 0x2 - bne _0813E5F0 - movs r1, 0x8 - ldrsh r0, [r3, r1] - cmp r0, 0x8 - bne _0813E5F0 - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E5F0 - ldrh r1, [r3, 0xE] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0813E5F0 - movs r0, 0x11 - strh r0, [r3, 0x8] - ldrb r1, [r4, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - strh r2, [r0, 0x18] - bl sub_8140134 - bl _0813F1A4 - .pool -_0813E5F0: - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r0, r5 - movs r2, 0x8 - ldrsh r0, [r0, r2] - mov r8, r1 - cmp r0, 0x16 - bls _0813E606 - bl _0813F1A4 -_0813E606: - lsls r0, 2 - ldr r1, =_0813E614 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813E614: - .4byte _0813E670 - .4byte _0813E6D4 - .4byte _0813E714 - .4byte _0813E740 - .4byte _0813E770 - .4byte _0813E7B0 - .4byte _0813E7E8 - .4byte _0813E828 - .4byte _0813E860 - .4byte _0813E8A4 - .4byte _0813E8C0 - .4byte _0813E8EC - .4byte _0813E918 - .4byte _0813E964 - .4byte _0813E990 - .4byte _0813EA1C - .4byte _0813EAC8 - .4byte _0813EB34 - .4byte _0813EB74 - .4byte _0813EBA8 - .4byte _0813EC10 - .4byte _0813EC6C - .4byte _0813ECA8 -_0813E670: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gSprites - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - bl _0813F1A4 - .pool -_0813E6D4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E6E4 - bl _0813F1A4 -_0813E6E4: - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnIsEvolving - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E714: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813E724 - bl _0813F1A4 -_0813E724: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - ldr r1, =gTasks - mov r3, r8 - adds r4, r3, r7 - lsls r4, 3 - adds r4, r1 - b _0813EB90 - .pool -_0813E740: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813E752 - bl _0813F1A4 -_0813E752: - movs r0, 0xBC - lsls r0, 1 - bl PlaySE - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E770: - bl IsSEPlaying - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0813E780 - bl _0813F1A4 -_0813E780: - ldr r0, =0x00000179 - bl PlayNewMapMusic - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - str r4, [sp] - movs r0, 0x1C - movs r1, 0x4 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl _0813F1A4 - .pool -_0813E7B0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E7C0 - bl _0813F1A4 -_0813E7C0: - movs r0, 0 - bl sub_8140000 - movs r0, 0x11 - bl LaunchTask_PreEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E7E8: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E7FE - bl _0813F1A4 -_0813E7FE: - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r5 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - ldr r0, =gEvoStructPtr - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x3] - bl LaunchTask_PreEvoSparklesSet2 - strb r0, [r4, 0x2] - bl _0813F1A4 - .pool -_0813E828: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E83E - bl _0813F1A4 -_0813E83E: - ldr r0, =gEvoStructPtr - ldr r1, [r0] - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - bl sub_817C3A0 - strb r0, [r4, 0x2] - mov r0, r8 - adds r1, r0, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E860: - ldr r2, =gEvoStructPtr - ldr r1, [r2] - ldrb r0, [r1, 0x3] - subs r0, 0x1 - strb r0, [r1, 0x3] - lsls r0, 24 - cmp r0, 0 - beq _0813E874 - bl _0813F1A4 -_0813E874: - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1, 0x3] - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813E890 - bl _0813F1A4 -_0813E890: - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E8A4: - bl LaunchTask_PostEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E8C0: - ldr r6, =gBattleCommunication - ldrb r0, [r6, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E8D6 - bl _0813F1A4 -_0813E8D6: - mov r0, r8 - adds r4, r0, r7 - lsls r4, 3 - adds r4, r5 - ldrh r0, [r4, 0xC] - bl LaunchTask_PostEvoSparklesSet2AndFlash - strb r0, [r6, 0x2] - b _0813EB96 - .pool -_0813E8EC: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813E902 - bl _0813F1A4 -_0813E902: - movs r0, 0x21 - bl PlaySE - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E918: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813E926 - bl _0813F1A4 -_0813E926: - bl m4aMPlayAllStop - ldr r0, =gPlttBufferUnfaded + 0x40 - ldr r1, =gEvoStructPtr - ldr r1, [r1] - adds r1, 0x4 - movs r2, 0x60 - bl memcpy - bl sub_8140174 - movs r0, 0 - str r0, [sp] - movs r0, 0x1C - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E964: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E974 - bl _0813F1A4 -_0813E974: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0, 0x1] - mov r1, r8 - adds r4, r1, r7 - lsls r4, 3 - adds r4, r5 - ldrh r1, [r4, 0xC] - b _0813EB92 - .pool -_0813E990: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813E99E - bl _0813F1A4 -_0813E99E: - ldr r4, =gStringVar4 - ldr r1, =gText_CongratsPkmnEvolved - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_814F9EC - ldr r0, =0x00000173 - bl PlayBGM - ldr r2, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - adds r2, r1 - adds r2, 0xC - mov r0, r9 - movs r1, 0xB - bl SetMonData - mov r0, r9 - bl CalculateMonStats - ldrh r1, [r4, 0xA] - ldrh r2, [r4, 0xC] - mov r0, r9 - bl EvolutionRenameMon - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - movs r0, 0xE - bl IncrementGameStat - b _0813F1A4 - .pool -_0813EA1C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EA2A - b _0813F1A4 -_0813EA2A: - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r4, r0, r1 - ldrb r1, [r4, 0x10] - mov r0, r9 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0 - beq _0813EAA8 - movs r3, 0x1A - ldrsh r5, [r4, r3] - cmp r5, 0 - bne _0813EAA8 - ldrh r1, [r4, 0xE] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0813EA5E - bl StopMapMusic - bl sub_8085784 -_0813EA5E: - ldrh r0, [r4, 0xE] - movs r1, 0x80 - orrs r0, r1 - strh r0, [r4, 0xE] - strh r5, [r4, 0x10] - strh r5, [r4, 0x14] - mov r0, r9 - movs r1, 0x2 - add r2, sp, 0x4 - bl GetMonData - ldr r0, =gBattleTextBuff1 - add r1, sp, 0x4 - bl StringCopy10 - ldr r0, =0x0000ffff - cmp r6, r0 - bne _0813EA94 - movs r0, 0x16 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EA94: - ldr r0, =0x0000fffe - cmp r6, r0 - bne _0813EA9C - b _0813F1A4 -_0813EA9C: - movs r0, 0x14 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EAA8: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813EAC8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _0813EADC - b _0813F1A4 -_0813EADC: - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r4, r0, r5 - ldrh r1, [r4, 0xE] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0813EAF6 - bl StopMapMusic - bl sub_8085784 -_0813EAF6: - movs r1, 0x1A - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0813EB06 - ldrh r0, [r4, 0xA] - mov r1, r9 - bl evovle_mon_internal_maybe -_0813EB06: - adds r0, r7, 0 - bl DestroyTask - bl FreeMonSpritesGfx - ldr r4, =gEvoStructPtr - ldr r0, [r4] - bl Free - str r6, [r4] - bl FreeAllWindowBuffers - ldr r0, =gUnknown_030061E8 - ldr r0, [r0] - bl SetMainCallback2 - b _0813F1A4 - .pool -_0813EB34: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813EB48 - b _0813F1A4 -_0813EB48: - bl m4aMPlayAllStop - ldr r0, =0x0006001c - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813EB74: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EB82 - b _0813F1A4 -_0813EB82: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - mov r3, r8 - adds r4, r3, r7 - lsls r4, 3 - adds r4, r5 -_0813EB90: - ldrh r1, [r4, 0xA] -_0813EB92: - bl sub_81401E0 -_0813EB96: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EBA8: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813EBB8 - b _0813F1A4 -_0813EBB8: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r3, 0x1A - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _0813EBE4 - ldr r0, =gStringVar4 - ldr r1, =gText_EllipsisQuestionMark - bl StringExpandPlaceholders - b _0813EBEC - .pool -_0813EBE4: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnStoppedEvolving - bl StringExpandPlaceholders -_0813EBEC: - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x1A] - b _0813F16E - .pool -_0813EC10: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EC1E - b _0813F1A4 -_0813EC1E: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813EC2A - b _0813F1A4 -_0813EC2A: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =0x0000016f - bl PlayFanfare - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0xC] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x40 - strh r0, [r1, 0x10] -_0813EC52: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0813F1A4 - .pool -_0813EC6C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EC7A - b _0813F1A4 -_0813EC7A: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813EC86 - b _0813F1A4 -_0813EC86: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - cmp r0, 0 - beq _0813EC9E - b _0813F1A4 -_0813EC9E: - movs r0, 0xF - strh r0, [r1, 0x8] - b _0813F1A4 - .pool -_0813ECA8: - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r0, r5 - movs r1, 0x14 - ldrsh r0, [r0, r1] - cmp r0, 0xC - bls _0813ECBA - b _0813F1A4 -_0813ECBA: - lsls r0, 2 - ldr r1, =_0813ECC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813ECC8: - .4byte _0813ECFC - .4byte _0813ED48 - .4byte _0813ED90 - .4byte _0813EDCE - .4byte _0813EE34 - .4byte _0813EF30 - .4byte _0813EF88 - .4byte _0813F05C - .4byte _0813F090 - .4byte _0813F0D8 - .4byte _0813F120 - .4byte _0813F154 - .4byte _0813F180 -_0813ECFC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813ED0A - b _0813F1A4 -_0813ED0A: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813ED16 - b _0813F1A4 -_0813ED16: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x10] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813ED48: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813ED56 - b _0813F1A4 -_0813ED56: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813ED62 - b _0813F1A4 -_0813ED62: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x14] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813ED90: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813EDCE - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813EDCE - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x18] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 - strh r0, [r1, 0x16] - movs r0, 0xA - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x14] - adds r0, 0x1 - strh r0, [r1, 0x14] -_0813EDCE: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EDDC - b _0813F1A4 -_0813EDDC: - bl IsSEPlaying - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0813EDEA - b _0813F1A4 -_0813EDEA: - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - ldr r0, =gText_BattleYesNoChoice - movs r1, 0xC - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x14] - ldr r0, =gBattleCommunication - strb r2, [r0, 0x1] - movs r0, 0 - bl BattleCreateCursorAt - b _0813F1A4 - .pool -_0813EE34: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0813EE5C - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x1] - cmp r0, 0 - beq _0813EE5C - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt - movs r0, 0 - strb r0, [r4, 0x1] - bl BattleCreateCursorAt -_0813EE5C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EE84 - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _0813EE84 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt - movs r0, 0x1 - strb r0, [r4, 0x1] - bl BattleCreateCursorAt -_0813EE84: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0813EEF2 - 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, =gBattleCommunication - ldrb r2, [r0, 0x1] - cmp r2, 0 - beq _0813EECC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x18] - strh r0, [r1, 0x14] - b _0813EEF2 - .pool -_0813EECC: - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x16] - strh r0, [r1, 0x14] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _0813EEF2 - movs r0, 0x1 - negs r0, r0 - str r2, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0813EEF2: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0813EF00 - b _0813F1A4 -_0813EF00: - 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 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x18] - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813EF30: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EF3E - b _0813F1A4 -_0813EF3E: - bl FreeAllWindowBuffers - ldr r0, =gPlayerParty - ldr r1, =gTasks - mov r3, r8 - adds r5, r3, r7 - lsls r5, 3 - adds r5, r1 - ldrb r1, [r5, 0x1C] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =CB2_EvolutionSceneLoadGraphics - ldr r4, =gMoveToLearn - ldrh r4, [r4] - str r4, [sp] - bl sub_81BFA38 - ldrh r0, [r5, 0x14] - adds r0, 0x1 - strh r0, [r5, 0x14] - b _0813F1A4 - .pool -_0813EF88: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EF96 - b _0813F1A4 -_0813EF96: - ldr r1, [r6, 0x4] - ldr r0, =CB2_EvolutionSceneUpdate - cmp r1, r0 - beq _0813EFA0 - b _0813F1A4 -_0813EFA0: - bl sub_81C1B94 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bne _0813EFC8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0xA - b _0813F1A2 - .pool -_0813EFC8: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r9 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl IsHMMove2 - cmp r0, 0 - beq _0813F014 - ldr r0, =gBattleStringsTable - ldr r3, =0x000004cc - adds r0, r3 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0xC - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813F014: - ldr r1, =gBattleTextBuff2 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - strb r4, [r1, 0x2] - lsrs r0, r4, 8 - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - lsls r4, r6, 24 - lsrs r4, 24 - mov r0, r9 - adds r1, r4, 0 - bl RemoveMonPPBonus - ldr r0, =gMoveToLearn - ldrh r1, [r0] - mov r0, r9 - adds r2, r4, 0 - bl SetMonMoveSlot - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F05C: - ldr r0, =gBattleStringsTable - movs r1, 0xCF - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F090: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F09E - b _0813F1A4 -_0813F09E: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F0AA - b _0813F1A4 -_0813F0AA: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x1C] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F0D8: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F1A4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F1A4 - ldr r0, =gBattleStringsTable - movs r1, 0xD0 - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x14 - strh r1, [r0, 0x8] - b _0813F1A4 - .pool -_0813F120: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x20] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0xB - strh r1, [r0, 0x16] - strh r2, [r0, 0x18] - movs r1, 0x3 - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813F154: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x24] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 -_0813F16E: - movs r1, 0xF - strh r1, [r0, 0x8] - b _0813F1A4 - .pool -_0813F180: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F1A4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F1A4 - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 -_0813F1A2: - strh r0, [r1, 0x14] -_0813F1A4: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end Task_EvolutionScene - - thumb_func_start sub_813F1B8 -sub_813F1B8: @ 813F1B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r3 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - muls r2, r1 - ldr r1, =gPlayerParty - adds r2, r1 - mov r9, r2 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r5, r3, 0 - cmp r0, 0x14 - bls _0813F1EC - bl _0813FCC4 -_0813F1EC: - lsls r0, 2 - ldr r1, =_0813F204 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813F204: - .4byte _0813F258 - .4byte _0813F284 - .4byte _0813F2AC - .4byte _0813F2DC - .4byte _0813F314 - .4byte _0813F380 - .4byte _0813F3C0 - .4byte _0813F3F0 - .4byte _0813F42C - .4byte _0813F448 - .4byte _0813F474 - .4byte _0813F498 - .4byte _0813F4E4 - .4byte _0813F570 - .4byte _0813F624 - .4byte _0813F668 - .4byte _0813F6D0 - .4byte _0813F704 - .4byte _0813F748 - .4byte _0813F7A4 - .4byte _0813F7E4 -_0813F258: - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnIsEvolving - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F284: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F294 - bl _0813FCC4 -_0813F294: - ldr r0, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0xA] - movs r1, 0 - bl PlayCry1 - b _0813F6F2 - .pool -_0813F2AC: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813F2BA - bl _0813FCC4 -_0813F2BA: - ldr r0, =0x00000179 - bl m4aSongNumStop - movs r0, 0xBC - lsls r0, 1 - bl PlaySE - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F2DC: - bl IsSEPlaying - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _0813F2EC - bl _0813FCC4 -_0813F2EC: - ldr r0, =0x00000179 - bl PlayBGM - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - str r5, [sp] - movs r0, 0x1C - movs r1, 0x4 - b _0813F9C8 - .pool -_0813F314: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813F324 - bl _0813FCC4 -_0813F324: - movs r0, 0x1 - bl sub_8140000 - ldr r2, =gSprites - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - adds r6, r0, 0 - adds r6, 0x10 - adds r0, r6, 0 - bl LaunchTask_PreEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - ldr r1, =0x00000603 - movs r0, 0xE - bl SetGpuReg - bl _0813FCC4 - .pool -_0813F380: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F396 - bl _0813FCC4 -_0813F396: - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - ldr r0, =gEvoStructPtr - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x3] - bl LaunchTask_PreEvoSparklesSet2 - strb r0, [r4, 0x2] - bl _0813FCC4 - .pool -_0813F3C0: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F3D6 - bl _0813FCC4 -_0813F3D6: - ldr r0, =gEvoStructPtr - ldr r1, [r0] - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - bl sub_817C3A0 - strb r0, [r4, 0x2] - b _0813F6AC - .pool -_0813F3F0: - ldr r2, =gEvoStructPtr - ldr r1, [r2] - ldrb r0, [r1, 0x3] - subs r0, 0x1 - strb r0, [r1, 0x3] - lsls r0, 24 - cmp r0, 0 - beq _0813F404 - bl _0813FCC4 -_0813F404: - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1, 0x3] - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F420 - bl _0813FCC4 -_0813F420: - b _0813F6AC - .pool -_0813F42C: - bl LaunchTask_PostEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F448: - ldr r6, =gBattleCommunication - ldrb r0, [r6, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F45E - bl _0813FCC4 -_0813F45E: - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r5 - ldrh r0, [r4, 0xC] - bl LaunchTask_PostEvoSparklesSet2AndFlash_Trade - strb r0, [r6, 0x2] - b _0813F6F2 - .pool -_0813F474: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F48A - bl _0813FCC4 -_0813F48A: - movs r0, 0x21 - bl PlaySE - b _0813F6AC - .pool -_0813F498: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F4A6 - bl _0813FCC4 -_0813F4A6: - ldr r0, =gUnknown_0203AB84 - ldr r0, [r0] - bl Free - ldr r5, =gEvoStructPtr - ldr r0, [r5] - ldrb r0, [r0, 0x1] - ldr r1, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r1 - ldrh r1, [r4, 0xC] - bl sub_81401E0 - ldr r0, =gPlttBufferUnfaded + 0x40 - ldr r1, [r5] - adds r1, 0x4 - movs r2, 0x60 - bl memcpy - b _0813F6F2 - .pool -_0813F4E4: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813F4F2 - bl _0813FCC4 -_0813F4F2: - ldr r4, =gStringVar4 - ldr r1, =gText_CongratsPkmnEvolved - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =0x00000173 - bl PlayFanfare - ldr r2, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - adds r2, r1 - adds r2, 0xC - mov r0, r9 - movs r1, 0xB - bl SetMonData - mov r0, r9 - bl CalculateMonStats - ldrh r1, [r4, 0xA] - ldrh r2, [r4, 0xC] - mov r0, r9 - bl EvolutionRenameMon - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - movs r0, 0xE - bl IncrementGameStat - b _0813FCC4 - .pool -_0813F570: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F57E - b _0813FCC4 -_0813F57E: - bl IsFanfareTaskInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813F58C - b _0813FCC4 -_0813F58C: - ldr r1, =gTasks - lsls r4, r7, 2 - adds r0, r4, r7 - lsls r0, 3 - adds r5, r0, r1 - ldrb r1, [r5, 0x10] - mov r0, r9 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r6, r0, 16 - mov r8, r4 - cmp r6, 0 - beq _0813F5FC - movs r0, 0x1A - ldrsh r2, [r5, r0] - cmp r2, 0 - bne _0813F5FC - ldrh r1, [r5, 0xE] - movs r0, 0x80 - orrs r0, r1 - strh r0, [r5, 0xE] - strh r2, [r5, 0x10] - strh r2, [r5, 0x14] - mov r0, r9 - movs r1, 0x2 - add r2, sp, 0x4 - bl GetMonData - ldr r0, =gBattleTextBuff1 - add r1, sp, 0x4 - bl StringCopy10 - ldr r0, =0x0000ffff - cmp r6, r0 - bne _0813F5E8 - movs r0, 0x14 - strh r0, [r5, 0x8] - b _0813FCC4 - .pool -_0813F5E8: - ldr r0, =0x0000fffe - cmp r6, r0 - bne _0813F5F0 - b _0813FCC4 -_0813F5F0: - movs r0, 0x12 - strh r0, [r5, 0x8] - b _0813FCC4 - .pool -_0813F5FC: - ldr r0, =0x00000179 - bl PlayBGM - ldr r1, =gText_CommunicationStandby5 - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813F78C - .pool -_0813F624: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _0813F634 - b _0813FCC4 -_0813F634: - adds r0, r7, 0 - bl DestroyTask - ldr r4, =gEvoStructPtr - ldr r0, [r4] - bl Free - str r5, [r4] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =gUnknown_030061E8 - ldr r0, [r0] - bl SetMainCallback2 - b _0813FCC4 - .pool -_0813F668: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F67C - b _0813FCC4 -_0813F67C: - bl m4aMPlayAllStop - ldr r2, =gSprites - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r1, =0x0004001c - orrs r0, r1 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0813F6AC: - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r5 -_0813F6B4: - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813F6D0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813F6DE - b _0813FCC4 -_0813F6DE: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r5 - ldrh r1, [r4, 0xA] - bl sub_81401E0 -_0813F6F2: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0813FCC4 - .pool -_0813F704: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813F714 - b _0813FCC4 -_0813F714: - ldr r4, =gStringVar4 - ldr r1, =gText_EllipsisQuestionMark - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x1A] - b _0813FC8C - .pool -_0813F748: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F756 - b _0813FCC4 -_0813F756: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F762 - b _0813FCC4 -_0813F762: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =0x0000016f - bl PlayFanfare - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0xC] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x40 - strh r0, [r1, 0x10] -_0813F78C: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0813FCC4 - .pool -_0813F7A4: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F7B2 - b _0813FCC4 -_0813F7B2: - bl IsFanfareTaskInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813F7C0 - b _0813FCC4 -_0813F7C0: - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - cmp r0, 0 - beq _0813F7D8 - b _0813FCC4 -_0813F7D8: - movs r0, 0xD - strh r0, [r1, 0x8] - b _0813FCC4 - .pool -_0813F7E4: - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r0, r5 - movs r2, 0x14 - ldrsh r0, [r0, r2] - mov r8, r1 - cmp r0, 0xB - bls _0813F7F8 - b _0813FCC4 -_0813F7F8: - lsls r0, 2 - ldr r1, =_0813F808 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813F808: - .4byte _0813F838 - .4byte _0813F884 - .4byte _0813F8CC - .4byte _0813F90C - .4byte _0813F96C - .4byte _0813FA24 - .4byte _0813FAA8 - .4byte _0813FBA4 - .4byte _0813FBEC - .4byte _0813FC38 - .4byte _0813FC70 - .4byte _0813FCA0 -_0813F838: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F846 - b _0813FCC4 -_0813F846: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F852 - b _0813FCC4 -_0813F852: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x10] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813F884: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F892 - b _0813FCC4 -_0813F892: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F89E - b _0813FCC4 -_0813F89E: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x14] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813F8CC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F90C - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F90C - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x18] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 - strh r0, [r1, 0x16] - movs r0, 0x9 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x14] - adds r0, 0x1 - strh r0, [r1, 0x14] -_0813F90C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F91A - b _0813FCC4 -_0813F91A: - bl IsSEPlaying - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0813F928 - b _0813FCC4 -_0813F928: - movs r0, 0 - movs r1, 0xA8 - movs r2, 0xE0 - bl sub_809882C - ldr r0, =gUnknown_0833900C - movs r1, 0xA8 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - ldr r3, =gBattleCommunication - strb r4, [r3, 0x1] - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x14] - strb r2, [r3, 0x1] - b _0813FCC4 - .pool -_0813F96C: - bl sub_8198C58 - lsls r0, 24 - asrs r6, r0, 24 - cmp r6, 0 - beq _0813F98C - cmp r6, 0 - bgt _0813F986 - movs r0, 0x1 - negs r0, r0 - cmp r6, r0 - beq _0813F9E4 - b _0813FCC4 -_0813F986: - cmp r6, 0x1 - beq _0813F9E4 - b _0813FCC4 -_0813F98C: - ldr r0, =gBattleCommunication - strb r6, [r0, 0x1] - ldr r0, =gBattleStringsTable - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x16] - strh r1, [r0, 0x14] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x5 - beq _0813F9C0 - b _0813FCC4 -_0813F9C0: - movs r0, 0x1 - negs r0, r0 - str r6, [sp] - movs r1, 0 -_0813F9C8: - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0813FCC4 - .pool -_0813F9E4: - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x1] - ldr r0, =gBattleStringsTable - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x18] - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FA24: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813FA32 - b _0813FCC4 -_0813FA32: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0813FA3E - bl sub_800E084 -_0813FA3E: - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - bl FreeAllWindowBuffers - ldr r0, =gPlayerParty - ldr r1, =gTasks - mov r2, r8 - adds r5, r2, r7 - lsls r5, 3 - adds r5, r1 - ldrb r1, [r5, 0x1C] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =sub_813DF70 - ldr r4, =gMoveToLearn - ldrh r4, [r4] - str r4, [sp] - bl sub_81BFA38 - ldrh r0, [r5, 0x14] - adds r0, 0x1 - strh r0, [r5, 0x14] - b _0813FCC4 - .pool -_0813FAA8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813FAB6 - b _0813FCC4 -_0813FAB6: - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =sub_813E3C0 - cmp r1, r0 - beq _0813FAC2 - b _0813FCC4 -_0813FAC2: - bl sub_81C1B94 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bne _0813FAEC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x9 - b _0813FCC2 - .pool -_0813FAEC: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r9 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl IsHMMove2 - cmp r0, 0 - beq _0813FB3C - ldr r0, =gBattleStringsTable - ldr r1, =0x000004cc - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0xB - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FB3C: - ldr r1, =gBattleTextBuff2 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - strb r4, [r1, 0x2] - lsrs r0, r4, 8 - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - lsls r4, r6, 24 - lsrs r4, 24 - mov r0, r9 - adds r1, r4, 0 - bl RemoveMonPPBonus - ldr r0, =gMoveToLearn - ldrh r1, [r0] - mov r0, r9 - adds r2, r4, 0 - bl SetMonMoveSlot - ldr r0, =gBattleStringsTable - movs r1, 0xCF - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813FBA4: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813FBB2 - b _0813FCC4 -_0813FBB2: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813FBBE - b _0813FCC4 -_0813FBBE: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x1C] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813FBEC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813FCC4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813FCC4 - ldr r0, =gBattleStringsTable - movs r1, 0xD0 - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x12 - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813FC38: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x20] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0xA - strh r1, [r0, 0x16] - strh r2, [r0, 0x18] - movs r1, 0x3 - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FC70: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x24] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 -_0813FC8C: - movs r1, 0xD - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813FCA0: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813FCC4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813FCC4 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 -_0813FCC2: - strh r0, [r1, 0x14] -_0813FCC4: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813F1B8 - - thumb_func_start EvoDummyFunc -EvoDummyFunc: @ 813FCD8 - bx lr - thumb_func_end EvoDummyFunc - - thumb_func_start VBlankCB_EvolutionScene -VBlankCB_EvolutionScene: @ 813FCDC - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_80BA0A8 - pop {r0} - bx r0 - .pool - thumb_func_end VBlankCB_EvolutionScene - - thumb_func_start sub_813FD64 -sub_813FD64: @ 813FD64 - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_80BA0A8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FD64 - - thumb_func_start sub_813FDEC -sub_813FDEC: @ 813FDEC - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r0, 0xC - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _0813FE9A - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0813FE9A - ldrh r1, [r4] - adds r0, r1, 0x1 - strh r0, [r4] - lsls r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_085B58C9 - movs r2, 0x4 - ldrsh r0, [r4, r2] - lsls r2, r0, 2 - adds r0, r3, 0x3 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r1, r0 - ble _0813FE8C - adds r0, r3, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - movs r2, 0x2 - ldrsh r1, [r4, r2] - cmp r0, r1 - bne _0813FE74 - ldrh r0, [r4, 0x6] - adds r0, 0x1 - strh r0, [r4, 0x6] - movs r0, 0x6 - ldrsh r2, [r4, r0] - movs r1, 0x4 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r1, r3, 0x2 - adds r0, r1 - ldrb r0, [r0] - cmp r2, r0 - bne _0813FE5E - strh r5, [r4, 0x6] - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] -_0813FE5E: - movs r2, 0x4 - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0] - b _0813FE8A - .pool -_0813FE74: - ldr r0, =gUnknown_0203AB84 - lsls r1, 5 - ldr r0, [r0] - adds r0, r1 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - strh r5, [r4] - ldrh r0, [r4, 0x2] - adds r0, 0x1 -_0813FE8A: - strh r0, [r4, 0x2] -_0813FE8C: - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bne _0813FE9A - adds r0, r6, 0 - bl DestroyTask -_0813FE9A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FDEC - - thumb_func_start sub_813FEA4 -sub_813FEA4: @ 813FEA4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =sub_813FEE8 - movs r1, 0x7 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 - cmp r4, 0 - bne _0813FED0 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0xC] - b _0813FEDE - .pool -_0813FED0: - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0xC] -_0813FEDE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FEA4 - - thumb_func_start sub_813FEE8 -sub_813FEE8: @ 813FEE8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gBattle_BG1_X - mov r8, r0 - ldr r1, =gBattle_BG1_Y - mov r9, r1 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0xC - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _0813FF28 - ldr r7, =gBattle_BG2_X - ldr r6, =gBattle_BG2_Y - b _0813FF2C - .pool -_0813FF28: - ldr r7, =gBattle_BG3_X - ldr r6, =gBattle_BG3_Y -_0813FF2C: - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x5 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x8] - adds r0, 0x80 - ands r0, r1 - strh r0, [r4, 0xA] - movs r1, 0x8 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Cos - adds r0, 0x8 - mov r2, r8 - strh r0, [r2] - movs r1, 0x8 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Sin - adds r0, 0x10 - mov r2, r9 - strh r0, [r2] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Cos - adds r0, 0x8 - strh r0, [r7] - movs r2, 0xA - ldrsh r0, [r4, r2] - movs r1, 0x4 - bl Sin - adds r0, 0x10 - strh r0, [r6] - ldr r0, =sub_813FDEC - bl FuncIsActiveTask - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0813FFA6 - adds r0, r5, 0 - bl DestroyTask - mov r0, r8 - strh r4, [r0] - mov r1, r9 - strh r4, [r1] - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r7] - strh r4, [r6] -_0813FFA6: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FEE8 - - thumb_func_start sub_813FFC0 -sub_813FFC0: @ 813FFC0 - push {r4-r7,lr} - adds r6, r0, 0 - movs r1, 0 - ldr r5, =gUnknown_085B5884 - ldr r7, =gUnknown_085B58D9 -_0813FFCA: - lsls r0, r1, 4 - adds r4, r1, 0x1 - adds r2, r0, r7 - lsls r0, r1, 5 - adds r1, r0, r6 - movs r3, 0xF -_0813FFD6: - ldrb r0, [r2] - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strh r0, [r1] - adds r2, 0x1 - adds r1, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _0813FFD6 - adds r1, r4, 0 - cmp r1, 0x31 - ble _0813FFCA - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FFC0 - - thumb_func_start sub_8140000 -sub_8140000: @ 8140000 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203AB84 - movs r0, 0xC8 - lsls r0, 3 - bl AllocZeroed - str r0, [r4] - bl sub_813FFC0 - cmp r5, 0 - bne _08140028 - movs r6, 0x1 - movs r4, 0x2 - b _0814002C - .pool -_08140028: - movs r6, 0x1 - movs r4, 0x3 -_0814002C: - ldr r0, =gUnknown_085B51E4 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_085B4134 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl copy_decompressed_tile_data_to_vram_autofree - ldr r1, =gUnknown_085B482C - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gUnknown_085B4D10 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - adds r0, r4, 0 - bl CopyBgTilemapBufferToVram - cmp r5, 0 - bne _081400C4 - ldr r1, =0x00000442 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000808 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xBA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - adds r0, r6, 0 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - adds r0, r4, 0 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - b _081400DE - .pool -_081400C4: - ldr r1, =0x00000842 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000808 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xDA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg -_081400DE: - ldr r0, =sub_813FDEC - movs r1, 0x5 - bl CreateTask - adds r0, r5, 0 - bl sub_813FEA4 - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140000 - - thumb_func_start sub_8140100 -sub_8140100: @ 8140100 - push {lr} - ldr r0, =sub_813FDEC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0814011E - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x14] -_0814011E: - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x20 - bl FillPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140100 - - thumb_func_start sub_8140134 -sub_8140134: @ 8140134 - push {lr} - ldr r0, =sub_813FDEC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08140148 - bl DestroyTask -_08140148: - ldr r0, =sub_813FEE8 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _0814015A - bl DestroyTask -_0814015A: - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x20 - bl FillPalette - bl sub_8140174 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140134 - - thumb_func_start sub_8140174 -sub_8140174: @ 8140174 - push {lr} - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - movs r0, 0x1 - movs r1, 0x5 - bl sub_80391E0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1 - movs r1, 0x7 - bl SetBgAttribute - movs r0, 0x2 - movs r1, 0x5 - bl sub_80391E0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x2 - movs r1, 0x7 - bl SetBgAttribute - movs r1, 0xCA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gUnknown_0203AB84 - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140174 - - thumb_func_start sub_81401E0 -sub_81401E0: @ 81401E0 - push {lr} - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - movs r2, 0 - movs r3, 0 - bl DoMonFrontSpriteAnimation - pop {r0} - bx r0 - .pool - thumb_func_end sub_81401E0 - - thumb_func_start sub_8140208 -sub_8140208: @ 8140208 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r2, 0x1C - adds r1, r2 - ldr r1, [r1] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08140230 - movs r0, 0 - b _08140232 - .pool -_08140230: - movs r0, 0x1 -_08140232: - pop {r1} - bx r1 - thumb_func_end sub_8140208 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/party_menu.s b/asm/party_menu.s index f2e681b9b..e92a638e5 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -13861,7 +13861,7 @@ sub_81B7810: @ 81B7810 cmp r4, 0 beq _081B7860 bl sub_81B06F4 - ldr r0, =gUnknown_030061E8 + ldr r0, =gCB2_AfterEvolution ldr r1, [r6] str r1, [r0] ldrb r3, [r6, 0x9] @@ -14307,7 +14307,7 @@ sub_81B7C74: @ 81B7C74 lsrs r5, r0, 24 movs r0, 0x5 bl PlaySE - ldr r2, =gUnknown_030061E8 + ldr r2, =gCB2_AfterEvolution ldr r1, =gUnknown_0203CEC8 ldr r0, [r1] str r0, [r2] diff --git a/asm/trade.s b/asm/trade.s index 51b517a0b..ebb624d90 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -10590,7 +10590,7 @@ _0807CEDC: ldrb r0, [r0] movs r1, 0 bl sub_807B4D0 - ldr r1, =gUnknown_030061E8 + ldr r1, =gCB2_AfterEvolution ldr r0, =sub_807B60C str r0, [r1] ldr r7, =gUnknown_02032298 @@ -10615,7 +10615,7 @@ _0807CEDC: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807CF48 .pool _0807CF38: @@ -12695,7 +12695,7 @@ _0807E328: ldrb r0, [r0] movs r1, 0 bl sub_807B4D0 - ldr r1, =gUnknown_030061E8 + ldr r1, =gCB2_AfterEvolution ldr r0, =sub_807B60C str r0, [r1] ldr r7, =gUnknown_02032298 @@ -12720,7 +12720,7 @@ _0807E328: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807E394 .pool _0807E384: @@ -12810,7 +12810,7 @@ _0807E434: b _0807E4B2 .pool _0807E444: - ldr r0, =gUnknown_030061E8 + ldr r0, =gCB2_AfterEvolution ldr r1, =sub_807EB50 mov r8, r1 str r1, [r0] @@ -12836,7 +12836,7 @@ _0807E444: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807E4AE .pool _0807E494: diff --git a/include/battle_message.h b/include/battle_message.h index 3b154c5a6..3f9b38cad 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -204,7 +204,7 @@ struct StringInfoBattle void BufferStringBattle(u16 stringID); u32 BattleStringExpandPlaceholdersToDisplayedString(const u8* src); u32 BattleStringExpandPlaceholders(const u8* src, u8* dst); -void sub_814F9EC(const u8* text, u8 arg1); +void BattleHandleAddTextPrinter(const u8* text, u8 arg1); void SetPpNumbersPaletteInMoveSelection(void); u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp); @@ -215,6 +215,7 @@ extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT]; extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT]; extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT]; +extern const u8* const gBattleStringsTable[]; extern const u8* const gStatNamesTable[]; extern const u8* const gPokeblockWasTooXStringTable[]; extern const u8* const gRefereeStringsTable[]; diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 590944f02..9684425fe 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -46,10 +46,10 @@ 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); +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); bool8 UproarWakeUpCheck(u8 bank); extern void (* const gBattleScriptingCommandsTable[])(void); diff --git a/include/evolution_scene.h b/include/evolution_scene.h index 48bd6ebe1..5f8c534b9 100644 --- a/include/evolution_scene.h +++ b/include/evolution_scene.h @@ -1,8 +1,8 @@ #ifndef GUARD_EVOLUTION_SCENE_H #define GUARD_EVOLUTION_SCENE_H -void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); +void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID); extern void (*gCB2_AfterEvolution)(void); diff --git a/ld_script.txt b/ld_script.txt index 98fc00ce4..624b9f2c3 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -181,7 +181,6 @@ SECTIONS { asm/battle_records.o(.text); asm/pokedex_area_screen.o(.text); src/evolution_scene.o(.text); - asm/evolution_scene.o(.text); asm/roulette.o(.text); asm/pokedex_cry_screen.o(.text); src/coins.o(.text); diff --git a/src/battle_2.c b/src/battle_2.c index 16c07114a..212c7253e 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -85,7 +85,7 @@ extern u16 gTrainerBattleOpponent_B; extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT]; extern void (*gPreBattleCallback1)(void); extern void (*gBattleMainFunc)(void); -extern void (*gUnknown_030061E8)(void); +extern void (*gCB2_AfterEvolution)(void); extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for? extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for? extern u8 gUnknown_02039B28[]; // possibly a struct? @@ -2121,7 +2121,7 @@ static void sub_8038F34(void) if (sub_800A520() == TRUE) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2247,17 +2247,17 @@ static void sub_803939C(void) case 3: if (!gPaletteFade.active) { - sub_814F9EC(gText_RecordBattleToPass, 0); + BattleHandleAddTextPrinter(gText_RecordBattleToPass, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; case 4: if (!IsTextPrinterActive(0)) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(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) @@ -2287,7 +2287,7 @@ static void sub_803939C(void) PlaySE(SE_SELECT); if (gBattleCommunication[CURSOR_POSITION] == 0) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattleCommunication[1] = MoveRecordedBattleToSaveData(); gBattleCommunication[MULTIUSE_STATE] = 10; } @@ -2305,11 +2305,11 @@ static void sub_803939C(void) case 6: if (sub_800A520() == TRUE) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -2340,14 +2340,14 @@ static void sub_803939C(void) { PlaySE(SE_SAVE); BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordedOnPass); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } else { BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordCouldntBeSaved); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } @@ -2358,7 +2358,7 @@ static void sub_803939C(void) if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -3690,7 +3690,7 @@ static void TryDoEventsBeforeFirstTurn(void) TurnValuesCleanUp(FALSE); SpecialStatusesClear(); *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; ResetSentPokesToOpponentValue(); @@ -3797,7 +3797,7 @@ void BattleTurnPassed(void) *(gBattleStruct->field_5C + i) = 6; *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; gRandomTurnNumber = Random(); @@ -4939,7 +4939,7 @@ static void HandleEndTurn_FinishBattle(void) BeginFastPaletteFade(3); FadeOutMapMusic(5); gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions; - gUnknown_030061E8 = BattleMainCB2; + gCB2_AfterEvolution = BattleMainCB2; } else { diff --git a/src/battle_message.c b/src/battle_message.c index aeff721d6..d0c7b118d 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2209,7 +2209,7 @@ static void sub_814F950(u8* dst) } } -void sub_814F9EC(const u8 *text, u8 arg1) +void BattleHandleAddTextPrinter(const u8 *text, u8 arg1) { const u8 *r8 = gUnknown_085CD660[gBattleScripting.field_24]; bool32 r9; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 28357d984..22e2d6a0c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6114,33 +6114,33 @@ static void atk5A_yesnoboxlearnmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(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) { PlaySE(SE_SELECT); if (gBattleCommunication[1] == 0) { - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, 1); BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); gBattleScripting.learnMoveState++; } @@ -6214,7 +6214,7 @@ static void atk5A_yesnoboxlearnmove(void) } break; case 5: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattlescriptCurrInstr += 5; break; case 6: @@ -6231,26 +6231,26 @@ static void atk5B_yesnoboxstoplearningmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(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) { @@ -6261,13 +6261,13 @@ static void atk5B_yesnoboxstoplearningmove(void) else gBattlescriptCurrInstr += 5; - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, 1); } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, 1); } break; } @@ -6527,38 +6527,38 @@ static void atk67_yesnobox(void) switch (gBattleCommunication[0]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(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) { gBattleCommunication[CURSOR_POSITION] = 1; PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattlescriptCurrInstr++; } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattlescriptCurrInstr++; } break; @@ -6674,7 +6674,7 @@ static void atk6C_draw_lvlupbox(void) SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 0); ShowBg(0); ShowBg(1); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x80); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, 0x80); gBattleScripting.atk6C_state = 4; break; case 4: @@ -6704,7 +6704,7 @@ static void atk6C_draw_lvlupbox(void) if (gMain.newKeys != 0) { PlaySE(SE_SELECT); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x81); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, 0x81); gBattleScripting.atk6C_state++; } break; @@ -7148,7 +7148,7 @@ static void atk76_various(void) break; case 16: BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); - sub_814F9EC(gDisplayedStringBattle, 0x16); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0x16); break; case 17: if (IsTextPrinterActive(0x16)) @@ -11238,7 +11238,7 @@ static void atkF2_display_dex_info(void) } } -void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) { s32 destY, destX; u16 var = 0; @@ -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; @@ -11311,26 +11311,26 @@ static void atkF3_nickname_caught_poke(void) switch (gBattleCommunication[MULTIUSE_STATE]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(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/evolution_scene.c b/src/evolution_scene.c index d86258444..e53981eeb 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -23,16 +23,21 @@ #include "battle_message.h" #include "gpu_regs.h" #include "bg.h" +#include "link.h" +#include "blend_palette.h" +#include "trig.h" struct EvoInfo { u8 preEvoSpriteID; u8 postEvoSpriteID; u8 evoTaskID; + u8 field_3; u16 savedPalette[48]; }; -extern struct EvoInfo *gEvoStructPtr; +static EWRAM_DATA struct EvoInfo *sEvoStructPtr = NULL; +static EWRAM_DATA u16 *sEvoMovingBgPtr = NULL; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -42,31 +47,66 @@ extern u16 gBattle_BG2_X; extern u16 gBattle_BG2_Y; extern u16 gBattle_BG3_X; extern u16 gBattle_BG3_Y; -extern u16 gBattle_WIN0H; -extern u16 gBattle_WIN0V; -extern u16 gBattle_WIN1H; -extern u16 gBattle_WIN1V; extern u8 gBattleTerrain; extern struct SpriteTemplate gUnknown_0202499C; +extern bool8 gAffineAnimsDisabled; +extern u16 gMoveToLearn; +extern u8 gBattleCommunication[]; +#define sEvoCursorPos gBattleCommunication[1] // when learning a new move +#define sEvoGraphicsTaskID gBattleCommunication[2] + +extern const struct WindowTemplate gUnknown_0833900C; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const u8 gUnknown_085B58C9[][4]; +extern const u16 gUnknown_085B5884[]; +extern const u8 gUnknown_085B58D9[]; +extern const u16 gUnknown_085B51E4[]; +extern const u32 gUnknown_085B4134[]; +extern const u32 gUnknown_085B482C[]; +extern const u32 gUnknown_085B4D10[]; +// strings +extern const u8 gUnknown_085B58C4[]; +extern const u8 gText_PkmnIsEvolving[]; +extern const u8 gText_CongratsPkmnEvolved[]; +extern const u8 gText_BattleYesNoChoice[]; +extern const u8 gText_PkmnStoppedEvolving[]; +extern const u8 gText_EllipsisQuestionMark[]; +extern const u8 gText_CommunicationStandby5[]; + +extern void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, bool32 arg2, u16 arg3, u8 arg4); +extern u32 sub_80391E0(u8, u8); extern void SpriteCallbackDummy_2(struct Sprite *sprite); extern void sub_80356D0(void); +extern void sub_807B154(void); extern void sub_806A068(u16, u8); +extern void sub_807F19C(void); +extern void sub_807B140(void); +extern void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); +extern void sub_8085784(void); +extern void sub_81BFA38(struct Pokemon *party, u8 monId, u8 partyCount, void *CB2_ptr, u16 move); +extern u8 sub_81C1B94(void); +extern void sub_807F1A8(u8 arg0, const u8 *arg1, u8 arg2); +extern void sub_800E084(void); // this file's functions -void Task_EvolutionScene(u8 taskID); -void Task_TradeEvolutionScene(u8 taskID); -void CB2_EvolutionSceneUpdate(void); -void CB2_TradeEvolutionSceneUpdate(void); -void EvoDummyFunc(void); -void EvoDummyFunc2(void); -void VBlankCB_EvolutionScene(void); -void VBlankCB_TradeEvolutionScene(void); -void sub_81150D8(void); +static void Task_EvolutionScene(u8 taskID); +static void Task_TradeEvolutionScene(u8 taskID); +static void CB2_EvolutionSceneUpdate(void); +static void CB2_TradeEvolutionSceneUpdate(void); +static void EvoDummyFunc(void); +static void VBlankCB_EvolutionScene(void); +static void VBlankCB_TradeEvolutionScene(void); +static void sub_81150D8(void); +static void sub_8140134(void); +static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId); +static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId); +static void InitMovingBackgroundTask(bool8 isLink); +static void sub_813FEE8(u8 taskId); +static void sub_8140174(void); -void CB2_BeginEvolutionScene(void) +static void CB2_BeginEvolutionScene(void) { UpdatePaletteFade(); RunTasks(); @@ -87,7 +127,7 @@ void CB2_BeginEvolutionScene(void) #define TASK_BIT_CAN_STOP 0x1 #define TASK_BIT_LEARN_MOVE 0x80 -void Task_BeginEvolutionScene(u8 taskID) +static void Task_BeginEvolutionScene(u8 taskID) { struct Pokemon* mon = NULL; switch (gTasks[taskID].tState) @@ -167,7 +207,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, gReservedSpritePaletteCount = 4; - gEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); + sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); AllocateMonSpritesGfx(); GetMonData(mon, MON_DATA_NICKNAME, name); @@ -186,7 +226,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, sub_806A068(currSpecies, 1); gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; - gEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 1; @@ -201,14 +241,14 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, sub_806A068(speciesToEvolve, 3); gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; - gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; gSprites[ID].invisible = 1; LoadEvoSparkleSpriteAndPal(); - gEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0); + sEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0); gTasks[ID].tState = 0; gTasks[ID].tPreEvoSpecies = currSpecies; gTasks[ID].tPostEvoSpecies = speciesToEvolve; @@ -217,7 +257,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, gTasks[ID].tEvoWasStopped = FALSE; gTasks[ID].tPartyID = partyID; - memcpy(&gEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60); + memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); @@ -227,15 +267,15 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, SetMainCallback2(CB2_EvolutionSceneUpdate); } -void CB2_EvolutionSceneLoadGraphics(void) +static void CB2_EvolutionSceneLoadGraphics(void) { u8 ID; const struct CompressedSpritePalette* pokePal; u16 postEvoSpecies; u32 TiD, PiD; - struct Pokemon* Mon = &gPlayerParty[gTasks[gEvoStructPtr->evoTaskID].tPartyID]; + struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; - postEvoSpecies = gTasks[gEvoStructPtr->evoTaskID].tPostEvoSpecies; + postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; TiD = GetMonData(Mon, MON_DATA_OT_ID); PiD = GetMonData(Mon, MON_DATA_PERSONALITY); @@ -279,7 +319,7 @@ void CB2_EvolutionSceneLoadGraphics(void) sub_806A068(postEvoSpecies, 3); gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; - gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; @@ -297,3 +337,1170 @@ void CB2_EvolutionSceneLoadGraphics(void) ShowBg(2); ShowBg(3); } + +static void CB2_TradeEvolutionSceneLoadGraphics(void) +{ + struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; + u16 postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; + + switch (gMain.state) + { + case 0: + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 4; + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + gMain.state++; + break; + case 1: + ResetPaletteFade(); + SetHBlankCallback(EvoDummyFunc); + SetVBlankCallback(VBlankCB_TradeEvolutionScene); + gMain.state++; + break; + case 2: + sub_807F19C(); + gMain.state++; + break; + case 3: + FillBgTilemapBufferRect(1, 0, 0, 0, 0x20, 0x20, 0x11); + CopyBgTilemapBufferToVram(1); + gMain.state++; + break; + case 4: + { + const struct CompressedSpritePalette* pokePal; + u32 TiD = GetMonData(Mon, MON_DATA_OT_ID); + u32 PiD = GetMonData(Mon, MON_DATA_PERSONALITY); + DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], + gMonSpritesGfxPtr->sprites[3], + postEvoSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, TiD, PiD); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + gMain.state++; + } + break; + case 5: + { + u8 ID; + + sub_806A068(postEvoSpecies, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gMain.state++; + sub_807B154(); + } + break; + case 6: + if (gLinkVSyncDisabled) + { + sub_800E0E8(); + sub_800DFB4(0, 0); + } + BlendPalettes(-1,0x10, 0); + gMain.state++; + break; + case 7: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + sub_807B140(); + ShowBg(0); + ShowBg(1); + SetMainCallback2(CB2_TradeEvolutionSceneUpdate); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_1D_MAP); + break; + } +} + +void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID) +{ + u8 name[20]; + u16 currSpecies; + u32 TiD, PiD; + const struct CompressedSpritePalette* pokePal; + u8 ID; + + GetMonData(mon, MON_DATA_NICKNAME, name); + StringCopy10(gStringVar1, name); + StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]); + + gAffineAnimsDisabled = TRUE; + + // preEvo sprite + currSpecies = GetMonData(mon, MON_DATA_SPECIES); + PiD = GetMonData(mon, MON_DATA_PERSONALITY); + TiD = GetMonData(mon, MON_DATA_OT_ID); + + sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); + sEvoStructPtr->preEvoSpriteID = preEvoSpriteID; + + DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], + gMonSpritesGfxPtr->sprites[1], + speciesToEvolve); + + pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, TiD, PiD); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + + sub_806A068(speciesToEvolve, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gSprites[ID].invisible = 1; + + LoadEvoSparkleSpriteAndPal(); + + sEvoStructPtr->evoTaskID = ID = CreateTask(Task_TradeEvolutionScene, 0); + gTasks[ID].tState = 0; + gTasks[ID].tPreEvoSpecies = currSpecies; + gTasks[ID].tPostEvoSpecies = speciesToEvolve; + gTasks[ID].tLearnsFirstMove = TRUE; + gTasks[ID].tEvoWasStopped = FALSE; + gTasks[ID].tPartyID = partyID; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + + gTextFlags.flag_1 = 1; + + SetVBlankCallback(VBlankCB_TradeEvolutionScene); + SetMainCallback2(CB2_TradeEvolutionSceneUpdate); +} + +static void CB2_EvolutionSceneUpdate(void) +{ + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); + RunTasks(); +} + +static void CB2_TradeEvolutionSceneUpdate(void) +{ + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); + RunTasks(); +} + +static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) +{ + u32 data = 0; + if (gEvolutionTable[preEvoSpecies].evolutions[0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6) + { + s32 i; + struct Pokemon* Shedinja = &gPlayerParty[gPlayerPartyCount]; + const struct EvolutionData* EvoTable; + const struct EvolutionData* Evos; + + CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies])); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_10, (&data)); + + for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + 5; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); + for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FATEFUL_ENCOUNTER; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); + + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_STATUS, (&data)); + data = 0xFF; + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MAIL, (&data)); + + CalculateMonStats(&gPlayerParty[gPlayerPartyCount]); + CalculatePlayerPartyCount(); + + // can't match it otherwise, ehh + EvoTable = gEvolutionTable; + Evos = EvoTable + preEvoSpecies; + GetSetPokedexFlag(SpeciesToNationalPokedexNum(Evos->evolutions[1].targetSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(Evos->evolutions[1].targetSpecies), FLAG_SET_CAUGHT); + + if (GetMonData(Shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA + && GetMonData(Shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE + && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK) + SetMonData(Shedinja, MON_DATA_NICKNAME, gUnknown_085B58C4); + } +} + +static void Task_EvolutionScene(u8 taskID) +{ + u32 var; + struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + + // check if B Button was held, so the evolution gets stopped + if (gMain.heldKeys == B_BUTTON + && gTasks[taskID].tState == 8 + && gTasks[sEvoGraphicsTaskID].isActive + && gTasks[taskID].tBits & TASK_BIT_CAN_STOP) + { + gTasks[taskID].tState = 17; + gTasks[sEvoGraphicsTaskID].EvoGraphicsTaskEvoStop = TRUE; + sub_8140134(); + return; + } + + switch (gTasks[taskID].tState) + { + case 0: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + gSprites[sEvoStructPtr->preEvoSpriteID].invisible = 0; + gTasks[taskID].tState++; + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + break; + case 1: // print 'whoa, poke is evolving!!!' msg + if (!gPaletteFade.active) + { + StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); + BattleHandleAddTextPrinter(gStringVar4, 0); + gTasks[taskID].tState++; + } + break; + case 2: // wait for string, animate mon(and play its cry) + if (!IsTextPrinterActive(0)) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 3: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) // wait for animation, play tu du SE + { + PlaySE(BGM_ME_SHINKA); + gTasks[taskID].tState++; + } + break; + case 4: // play evolution music and fade screen black + if (!IsSEPlaying()) + { + PlayNewMapMusic(BGM_SHINKA); + gTasks[taskID].tState++; + BeginNormalPaletteFade(0x1C, 4, 0, 0x10, 0); + } + break; + case 5: // launch moving bg task, preapre evo sparkles + if (!gPaletteFade.active) + { + InitMovingBackgroundTask(FALSE); + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(17); + gTasks[taskID].tState++; + } + break; + case 6: // another set of evo sparkles + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + gTasks[taskID].tState++; + sEvoStructPtr->field_3 = 1; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + } + break; + case 7: // launch task that flashes pre evo with post evo sprites + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); + gTasks[taskID].tState++; + } + break; + case 8: // wait for the above task to finish + if (--sEvoStructPtr->field_3 == 0) + { + sEvoStructPtr->field_3 = 3; + if (!gTasks[sEvoGraphicsTaskID].isActive) + gTasks[taskID].tState++; + } + break; + case 9: // post evo sparkles + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); + gTasks[taskID].tState++; + break; + case 10: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash(gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 11: // play tu du sound after evolution + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + PlaySE(SE_EXP); + gTasks[taskID].tState++; + } + break; + case 12: // stop music, return screen to pre-fade state + if (IsSEPlaying()) + { + m4aMPlayAllStop(); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); + sub_8140174(); + BeginNormalPaletteFade(0x1C, 0, 0x10, 0, 0); + gTasks[taskID].tState++; + } + break; + case 13: // animate mon + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 14: // congratulations string and rename prompt + if (IsCryFinished()) + { + StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); + BattleHandleAddTextPrinter(gStringVar4, 0); + PlayBGM(BGM_FANFA5); + gTasks[taskID].tState++; + SetMonData(mon, MON_DATA_SPECIES, (void*)(&gTasks[taskID].tPostEvoSpecies)); + CalculateMonStats(mon); + EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); + } + break; + case 15: // check if it wants to learn a new move + if (!IsTextPrinterActive(0)) + { + var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); + if (var != 0 && !gTasks[taskID].tEvoWasStopped) + { + u8 text[20]; + + if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + { + StopMapMusic(); + sub_8085784(); + } + + gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskID].tLearnsFirstMove = FALSE; + gTasks[taskID].tLearnMoveState = 0; + GetMonData(mon, MON_DATA_NICKNAME, text); + StringCopy10(gBattleTextBuff1, text); + + if (var == 0xFFFF) // no place to learn it + gTasks[taskID].tState = 22; + else if (var == 0xFFFE) // it already knows that move + break; + else + gTasks[taskID].tState = 20; // has less than 4 moves, so it's been learned + } + else // no move to learn + { + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskID].tState++; + } + } + break; + case 16: // task has finished, return + if (!gPaletteFade.active) + { + if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + { + StopMapMusic(); + sub_8085784(); + } + if (!gTasks[taskID].tEvoWasStopped) + CreateShedinja(gTasks[taskID].tPreEvoSpecies, mon); + + DestroyTask(taskID); + FreeMonSpritesGfx(); + Free(sEvoStructPtr); + sEvoStructPtr = NULL; + FreeAllWindowBuffers(); + SetMainCallback2(gCB2_AfterEvolution); + } + break; + case 17: // evolution has been canceled, stop music and re-fade palette + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + m4aMPlayAllStop(); + BeginNormalPaletteFade(0x6001C, 0, 0x10, 0, 0x7FFF); + gTasks[taskID].tState++; + } + break; + case 18: // animate pokemon trying to evolve again, evolution has been stopped + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 19: // after the animation, print the string 'WHOA IT DID NOT EVOLVE!!!' + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + { + if (gTasks[taskID].tEvoWasStopped) + StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); + else // Fire Red leftover probably + StringExpandPlaceholders(gStringVar4, gText_PkmnStoppedEvolving); + + BattleHandleAddTextPrinter(gStringVar4, 0); + gTasks[taskID].tEvoWasStopped = TRUE; + gTasks[taskID].tState = 15; + } + break; + case 20: // pokemon learned a new move, print string and play a fanfare + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + PlayFanfare(BGM_FANFA1); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskID].tState++; + } + break; + case 21: // wait a bit and check if can learn another move + if (!IsTextPrinterActive(0) && !IsSEPlaying() && --gTasks[taskID].tLearnsFirstMove == 0) + gTasks[taskID].tState = 15; + break; + case 22: // try to learn a new move + switch (gTasks[taskID].tLearnMoveState) + { + case 0: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 1: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 2: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tData7 = 5; + gTasks[taskID].tData8 = 10; + gTasks[taskID].tLearnMoveState++; + } + case 3: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); + gTasks[taskID].tLearnMoveState++; + sEvoCursorPos = 0; + BattleCreateYesNoCursorAt(0); + } + break; + case 4: + if (gMain.newKeys & DPAD_UP && sEvoCursorPos != 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(sEvoCursorPos); + sEvoCursorPos = 0; + BattleCreateYesNoCursorAt(0); + } + if (gMain.newKeys & DPAD_DOWN && sEvoCursorPos == 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(sEvoCursorPos); + sEvoCursorPos = 1; + BattleCreateYesNoCursorAt(1); + } + if (gMain.newKeys & A_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); + PlaySE(SE_SELECT); + + if (sEvoCursorPos != 0) + { + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + } + else + { + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; + if (gTasks[taskID].tLearnMoveState == 5) + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + } + } + if (gMain.newKeys & B_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); + PlaySE(SE_SELECT); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + } + break; + case 5: + if (!gPaletteFade.active) + { + FreeAllWindowBuffers(); + sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + gPlayerPartyCount - 1, CB2_EvolutionSceneLoadGraphics, + gMoveToLearn); + gTasks[taskID].tLearnMoveState++; + } + break; + case 6: + if (!gPaletteFade.active && gMain.callback2 == CB2_EvolutionSceneUpdate) + { + var = sub_81C1B94(); // moveID + if (var == 4) + { + gTasks[taskID].tLearnMoveState = 10; + } + else + { + u16 move = GetMonData(mon, var + MON_DATA_MOVE1); + if (IsHMMove2(move)) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState = 12; + } + else + { + PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) + + RemoveMonPPBonus(mon, var); + SetMonMoveSlot(mon, gMoveToLearn, var); + gTasks[taskID].tLearnMoveState++; + } + } + } + break; + case 7: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + break; + case 8: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 9: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tState = 20; + } + break; + case 10: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tData7 = 11; + gTasks[taskID].tData8 = 0; + gTasks[taskID].tLearnMoveState = 3; + break; + case 11: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tState = 15; + break; + case 12: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + gTasks[taskID].tLearnMoveState = 5; + break; + } + break; + } +} + +static void Task_TradeEvolutionScene(u8 taskID) +{ + u32 var = 0; + struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + + switch (gTasks[taskID].tState) + { + case 0: + StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); + sub_807F1A8(0, gStringVar4, 1); + gTasks[taskID].tState++; + break; + case 1: + if (!IsTextPrinterActive(0)) + { + PlayCry1(gTasks[taskID].tPreEvoSpecies, 0); + gTasks[taskID].tState++; + } + break; + case 2: + if (IsCryFinished()) + { + m4aSongNumStop(BGM_SHINKA); + PlaySE(BGM_ME_SHINKA); + gTasks[taskID].tState++; + } + break; + case 3: + if (!IsSEPlaying()) + { + PlayBGM(BGM_SHINKA); + gTasks[taskID].tState++; + BeginNormalPaletteFade(0x1C, 4, 0, 0x10, 0); + } + break; + case 4: + if (!gPaletteFade.active) + { + InitMovingBackgroundTask(TRUE); + var = gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(var); + gTasks[taskID].tState++; + SetGpuReg(REG_OFFSET_BG3CNT, 0x603); + } + break; + case 5: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + gTasks[taskID].tState++; + sEvoStructPtr->field_3 = 1; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + } + break; + case 6: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); + gTasks[taskID].tState++; + } + break; + case 7: + if (--sEvoStructPtr->field_3 == 0) + { + sEvoStructPtr->field_3 = 3; + if (!gTasks[sEvoGraphicsTaskID].isActive) + gTasks[taskID].tState++; + } + break; + case 8: + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); + gTasks[taskID].tState++; + break; + case 9: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash_Trade(gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 10: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + PlaySE(SE_EXP); + gTasks[taskID].tState++; + } + break; + case 11: + if (IsSEPlaying()) + { + Free(sEvoMovingBgPtr); + EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); + gTasks[taskID].tState++; + } + break; + case 12: + if (IsCryFinished()) + { + StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); + sub_807F1A8(0, gStringVar4, 1); + PlayFanfare(BGM_FANFA5); + gTasks[taskID].tState++; + SetMonData(mon, MON_DATA_SPECIES, (&gTasks[taskID].tPostEvoSpecies)); + CalculateMonStats(mon); + EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); + } + break; + case 13: + if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE) + { + var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); + if (var != 0 && !gTasks[taskID].tEvoWasStopped) + { + u8 text[20]; + + gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskID].tLearnsFirstMove = FALSE; + gTasks[taskID].tLearnMoveState = 0; + GetMonData(mon, MON_DATA_NICKNAME, text); + StringCopy10(gBattleTextBuff1, text); + + if (var == 0xFFFF) + gTasks[taskID].tState = 20; + else if (var == 0xFFFE) + break; + else + gTasks[taskID].tState = 18; + } + else + { + PlayBGM(BGM_SHINKA); + sub_807F1A8(0, gText_CommunicationStandby5, 1); + gTasks[taskID].tState++; + } + } + break; + case 14: + if (!IsTextPrinterActive(0)) + { + DestroyTask(taskID); + Free(sEvoStructPtr); + sEvoStructPtr = NULL; + gTextFlags.flag_1 = 0; + SetMainCallback2(gCB2_AfterEvolution); + } + break; + case 15: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + m4aMPlayAllStop(); + BeginNormalPaletteFade((1 << (gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16)) | (0x4001C), 0, 0x10, 0, 0x7FFF); + gTasks[taskID].tState++; + } + break; + case 16: + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 17: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + { + StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); + sub_807F1A8(0, gStringVar4, 1); + gTasks[taskID].tEvoWasStopped = 1; + gTasks[taskID].tState = 13; + } + break; + case 18: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + PlayFanfare(BGM_FANFA1); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskID].tState++; + } + break; + case 19: + if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE && --gTasks[taskID].tLearnsFirstMove == 0) + gTasks[taskID].tState = 13; + break; + case 20: + switch (gTasks[taskID].tLearnMoveState) + { + case 0: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 1: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 2: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tData7 = 5; + gTasks[taskID].tData8 = 9; + gTasks[taskID].tLearnMoveState++; + } + case 3: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + sub_809882C(0, 0xA8, 0xE0); + CreateYesNoMenu(&gUnknown_0833900C, 0xA8, 0xE, 0); + sEvoCursorPos = 0; + gTasks[taskID].tLearnMoveState++; + sEvoCursorPos = 0; + } + break; + case 4: + switch (sub_8198C58()) + { + case 0: + sEvoCursorPos = 0; + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; + if (gTasks[taskID].tLearnMoveState == 5) + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + break; + case 1: + case -1: + sEvoCursorPos = 1; + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + break; + } + break; + case 5: + if (!gPaletteFade.active) + { + if (gLinkVSyncDisabled) + sub_800E084(); + + Free(GetBgTilemapBuffer(3)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(0)); + FreeAllWindowBuffers(); + + sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + gPlayerPartyCount - 1, CB2_TradeEvolutionSceneLoadGraphics, + gMoveToLearn); + gTasks[taskID].tLearnMoveState++; + } + break; + case 6: + if (!gPaletteFade.active && gMain.callback2 == CB2_TradeEvolutionSceneUpdate) + { + var = sub_81C1B94(); // moveID + if (var == 4) + { + gTasks[taskID].tLearnMoveState = 9; + } + else + { + u16 move = GetMonData(mon, var + MON_DATA_MOVE1); + if (IsHMMove2(move)) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = 11; + } + else + { + PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) + + RemoveMonPPBonus(mon, var); + SetMonMoveSlot(mon, gMoveToLearn, var); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + } + } + break; + case 7: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 8: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tState = 18; + } + break; + case 9: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tData7 = 10; + gTasks[taskID].tData8 = 0; + gTasks[taskID].tLearnMoveState = 3; + break; + case 10: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tState = 13; + break; + case 11: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + gTasks[taskID].tLearnMoveState = 5; + break; + } + break; + } +} + +#undef tState +#undef tPreEvoSpecies +#undef tPostEvoSpecies +#undef tCanStop +#undef tBits +#undef tLearnsFirstMove +#undef tLearnMoveState +#undef tData7 +#undef tData8 +#undef tEvoWasStopped +#undef tPartyID + +static void EvoDummyFunc(void) +{ +} + +static void VBlankCB_EvolutionScene(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_80BA0A8(); +} + +static void VBlankCB_TradeEvolutionScene(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_80BA0A8(); +} + +static void sub_813FDEC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[6] != 0) + return; + if (data[5]++ < 20) + return; + + if (data[0]++ > gUnknown_085B58C9[data[2]][3]) + { + if (gUnknown_085B58C9[data[2]][1] == data[1]) + { + data[3]++; + if (data[3] == gUnknown_085B58C9[data[2]][2]) + { + data[3] = 0; + data[2]++; + } + data[1] = gUnknown_085B58C9[data[2]][0]; + } + else + { + LoadPalette(&sEvoMovingBgPtr[data[1] * 16], 0xA0, 0x20); + data[0] = 0; + data[1]++; + } + } + + if (data[2] == 4) + DestroyTask(taskId); +} + +static void sub_813FEA4(bool8 isLink) +{ + u8 taskId = CreateTask(sub_813FEE8, 7); + + if (!isLink) + gTasks[taskId].data[2] = 0; + else + gTasks[taskId].data[2] = 1; +} + +static void sub_813FEE8(u8 taskId) +{ + u16 *outer_X, *outer_Y; + + u16 *inner_X = &gBattle_BG1_X; + u16 *inner_Y = &gBattle_BG1_Y; + + if (!gTasks[taskId].data[2]) + { + outer_X = &gBattle_BG2_X; + outer_Y = &gBattle_BG2_Y; + } + else + { + outer_X = &gBattle_BG3_X; + outer_Y = &gBattle_BG3_Y; + } + + gTasks[taskId].data[0] = (gTasks[taskId].data[0] + 5) & 0xFF; + gTasks[taskId].data[1] = (gTasks[taskId].data[0] + 0x80) & 0xFF; + + *inner_X = Cos(gTasks[taskId].data[0], 4) + 8; + *inner_Y = Sin(gTasks[taskId].data[0], 4) + 16; + + *outer_X = Cos(gTasks[taskId].data[1], 4) + 8; + *outer_Y = Sin(gTasks[taskId].data[1], 4) + 16; + + if (!FuncIsActiveTask(sub_813FDEC)) + { + DestroyTask(taskId); + + *inner_X = 0; + *inner_Y = 0; + + *outer_X = 256; + *outer_Y = 0; + } +} + +static void InitMovingBgValues(u16 *movingBgs) +{ + s32 i, j; + + for (i = 0; i < 50; i++) + { + for (j = 0; j < 16; j++) + { + movingBgs[i * 16 + j] = gUnknown_085B5884[gUnknown_085B58D9[i * 16 + j]]; + } + } +} + +static void InitMovingBackgroundTask(bool8 isLink) +{ + u8 innerBgId, outerBgId; + + sEvoMovingBgPtr = AllocZeroed(0x640); + InitMovingBgValues(sEvoMovingBgPtr); + + if (!isLink) + innerBgId = 1, outerBgId = 2; + else + innerBgId = 1, outerBgId = 3; + + LoadPalette(gUnknown_085B51E4, 0xA0, 0x20); + + copy_decompressed_tile_data_to_vram_autofree(1, gUnknown_085B4134, FALSE, 0, 0); + CopyToBgTilemapBuffer(1, gUnknown_085B482C, 0, 0); + CopyToBgTilemapBuffer(outerBgId, gUnknown_085B4D10, 0, 0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(outerBgId); + + if (!isLink) + { + SetGpuReg(REG_OFFSET_BLDCNT, 0x442); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x808); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG2_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + + SetBgAttribute(innerBgId, BG_CTRL_ATTR_MOSAIC, 2); + SetBgAttribute(outerBgId, BG_CTRL_ATTR_MOSAIC, 2); + + ShowBg(1); + ShowBg(2); + } + else + { + SetGpuReg(REG_OFFSET_BLDCNT, 0x842); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x808); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + } + + CreateTask(sub_813FDEC, 5); + sub_813FEA4(isLink); +} + +static void sub_8140100(void) // unused +{ + u8 taskId = FindTaskIdByFunc(sub_813FDEC); + + if (taskId != 0xFF) + gTasks[taskId].data[6] = 1; + + FillPalette(0, 0xA0, 0x20); +} + +static void sub_8140134(void) +{ + u8 taskId; + + if ((taskId = FindTaskIdByFunc(sub_813FDEC)) != 0xFF) + DestroyTask(taskId); + if ((taskId = FindTaskIdByFunc(sub_813FEE8)) != 0xFF) + DestroyTask(taskId); + + FillPalette(0, 0xA0, 0x20); + sub_8140174(); +} + +static void sub_8140174(void) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0); + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, sub_80391E0(1, 5)); + SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, sub_80391E0(2, 5)); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + Free(sEvoMovingBgPtr); +} + +static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId) +{ + DoMonFrontSpriteAnimation(&gSprites[monSpriteId], speciesId, FALSE, 0); +} + +static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId) +{ + if (gSprites[monSpriteId].callback == SpriteCallbackDummy) + return TRUE; + + return FALSE; +} diff --git a/sym_common.txt b/sym_common.txt index 85b508403..9369020c8 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -370,7 +370,7 @@ gUnknown_030061C4: @ 30061C4 gUnknown_030061D0: @ 30061D0 .space 0x18 -gUnknown_030061E8: @ 30061E8 +gCB2_AfterEvolution: @ 30061E8 .space 0x4 gUnknown_030061EC: @ 30061EC diff --git a/sym_ewram.txt b/sym_ewram.txt index 32189b126..776245161 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1280,11 +1280,7 @@ gUnknown_0203AB78: @ 203AB78 gUnknown_0203AB7C: @ 203AB7C .space 0x4 -gEvoStructPtr: @ 203AB80 - .space 0x4 - -gUnknown_0203AB84: @ 203AB84 - .space 0x4 + .include "src/evolution_scene.o" gUnknown_0203AB88: @ 203AB88 .space 0x4 From 712ae5616734f91fdc3cea821349f397af798905 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 31 Oct 2017 18:04:08 +0100 Subject: [PATCH 26/29] review change battle controllers --- asm/battle_7.s | 6 +- asm/battle_tower.s | 14 +-- asm/pokenav.s | 4 +- data/trainer_pic_indices.inc | 2 +- include/battle.h | 2 +- include/battle_controllers.h | 9 +- include/data2.h | 1 + include/trainer_classes.h | 51 +++++++---- include/trainer_front_sprites.h | 101 ++++++++++++++++++++++ src/battle_controller_link_opponent.c | 55 +++++------- src/battle_controller_link_partner.c | 36 +++----- src/battle_controller_opponent.c | 35 +++----- src/battle_controller_player.c | 36 +++----- src/battle_controller_player_partner.c | 36 +++----- src/battle_controller_recorded_opponent.c | 35 +++----- src/battle_controller_recorded_player.c | 36 +++----- src/battle_controller_safari.c | 15 +--- src/battle_controller_wally.c | 31 +++---- src/battle_controllers.c | 8 +- src/battle_dome_cards.c | 6 +- src/pokemon_2.c | 4 +- src/pokemon_3.c | 4 +- 22 files changed, 282 insertions(+), 245 deletions(-) create mode 100644 include/trainer_front_sprites.h diff --git a/asm/battle_7.s b/asm/battle_7.s index 87c7b2713..94cc1ba8e 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -2229,8 +2229,8 @@ _0805E3EA: .pool thumb_func_end sub_805E394 - thumb_func_start SetBattleSpriteInvisibilityBitToSpriteInvisibility -SetBattleSpriteInvisibilityBitToSpriteInvisibility: @ 805E408 + thumb_func_start CopyBattleSpriteInvisibility +CopyBattleSpriteInvisibility: @ 805E408 lsls r0, 24 lsrs r0, 24 ldr r1, =gBattleSpritesDataPtr @@ -2258,7 +2258,7 @@ SetBattleSpriteInvisibilityBitToSpriteInvisibility: @ 805E408 strb r0, [r3] bx lr .pool - thumb_func_end SetBattleSpriteInvisibilityBitToSpriteInvisibility + thumb_func_end CopyBattleSpriteInvisibility thumb_func_start sub_805E448 sub_805E448: @ 805E448 diff --git a/asm/battle_tower.s b/asm/battle_tower.s index 0415ffe5c..122d9d27c 100755 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -1340,7 +1340,7 @@ GetFrontierTrainerFrontSpriteId: @ 8162AA0 lsls r0, 1 cmp r4, r0 bne _08162AD0 - ldr r1, =gTrainerClassToFrontPicId + ldr r1, =gUnknown_0831F578 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed @@ -1362,7 +1362,7 @@ _08162AE4: ldr r0, =0x0000012b cmp r4, r0 bhi _08162B08 - ldr r2, =gTrainerClassToFrontPicId + ldr r2, =gUnknown_0831F578 ldr r0, =gUnknown_0203BC88 ldr r1, [r0] movs r0, 0x34 @@ -1383,7 +1383,7 @@ _08162B08: ands r0, r1 cmp r0, 0 beq _08162B38 - ldr r4, =gTrainerClassToFrontPicId + ldr r4, =gUnknown_0831F578 bl sub_818649C lsls r0, 24 lsrs r0, 24 @@ -1391,7 +1391,7 @@ _08162B08: b _08162BC8 .pool _08162B38: - ldr r3, =gTrainerClassToFrontPicId + ldr r3, =gUnknown_0831F578 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r1, =0xfffffed4 @@ -1413,7 +1413,7 @@ _08162B64: ands r0, r1 cmp r0, 0 bne _08162BB0 - ldr r4, =gTrainerClassToFrontPicId + ldr r4, =gUnknown_0831F578 ldr r3, =gUnknown_08610970 ldr r0, =gSaveBlock2Ptr ldr r1, [r0] @@ -1436,7 +1436,7 @@ _08162B64: b _08162BC8 .pool _08162BB0: - ldr r5, =gTrainerClassToFrontPicId + ldr r5, =gUnknown_0831F578 ldr r4, =gUnknown_08610970 bl sub_81864A8 lsls r0, 24 @@ -5845,7 +5845,7 @@ _08165206: thumb_func_start GetEreaderTrainerFrontSpriteId GetEreaderTrainerFrontSpriteId: @ 8165244 - ldr r1, =gTrainerClassToFrontPicId + ldr r1, =gUnknown_0831F578 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r2, =0x00000bed diff --git a/asm/pokenav.s b/asm/pokenav.s index d115f2a67..0c7a80742 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -7890,7 +7890,7 @@ _081CAF34: adds r0, r5, 0 bl sub_81D1BD0 adds r4, r0, 0 - ldr r0, =gTrainerClassToFrontPicId + ldr r0, =gUnknown_0831F578 adds r0, r4, r0 ldrb r0, [r0] b _081CAF6C @@ -28947,7 +28947,7 @@ sub_81D5588: @ 81D5588 adds r3, r0 ldrb r4, [r3, 0x1B] bl sub_81D5710 - ldr r0, =gTrainerClassToFrontPicId + ldr r0, =gUnknown_0831F578 adds r4, r0 ldrb r0, [r4] pop {r4} diff --git a/data/trainer_pic_indices.inc b/data/trainer_pic_indices.inc index d859c39b7..22fb9aaa2 100644 --- a/data/trainer_pic_indices.inc +++ b/data/trainer_pic_indices.inc @@ -1,5 +1,5 @@ .align 2 -gTrainerClassToFrontPicId:: @ 831F578 +gUnknown_0831F578:: @ 831F578 .byte TRAINER_PIC_HIKER .byte TRAINER_PIC_AQUA_GRUNT_M .byte TRAINER_PIC_POKEMON_BREEDER_F diff --git a/include/battle.h b/include/battle.h index 3a6ed2c24..112999a62 100644 --- a/include/battle.h +++ b/include/battle.h @@ -894,7 +894,7 @@ void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move); void DoStatusAnimation(bool8 isStatus2, u32 status); void DoSpecialBattleAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId); bool8 DoBattleAnimationFromTable(u8 active, u8 atkBank, u8 defBank, u8 tableId, u16 argument); -void SetBattleSpriteInvisibilityBitToSpriteInvisibility(u8 bank); +void CopyBattleSpriteInvisibility(u8 bank); u16 ChooseMoveAndTargetInBattlePalace(void); void LoadBattleBarGfx(u8 arg0); bool8 mplay_80342A4(u8 bank); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 2f7b88c2f..517df3edb 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -167,10 +167,11 @@ enum CONTROLLER_LINKSTANDBYMSG, CONTROLLER_RESETACTIONMOVESELECTION, CONTROLLER_55, - CONTROLLER_56 + /*new controllers should go after 55 and before 56*/ + CONTROLLER_56, + CONTROLLER_CMDS_COUNT }; -#define CONTOLLER_CMDS_COUNT CONTROLLER_56 + 1 // general functions void HandleLinkBattleSetup(void); @@ -180,9 +181,9 @@ void sub_8033648(void); void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters -void EmitGetMonData(u8 bufferId, u8 requestId, u8 monsToCheck); +void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused -void EmitSetMonData(u8 bufferId, u8 requestId, u8 monsToCheck, u8 bytes, void *data); +void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused void EmitLoadMonSprite(u8 bufferId); void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); diff --git a/include/data2.h b/include/data2.h index db9532811..be0f33ab8 100644 --- a/include/data2.h +++ b/include/data2.h @@ -10,6 +10,7 @@ struct MonCoords }; extern struct MonCoords gTrainerBackPicCoords[]; +extern struct MonCoords gTrainerFrontPicCoords[]; extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; extern const u8 gMoveNames[][13]; diff --git a/include/trainer_classes.h b/include/trainer_classes.h index 3f13dfc37..e5e26b359 100644 --- a/include/trainer_classes.h +++ b/include/trainer_classes.h @@ -3,16 +3,16 @@ enum { - CLASS_PKMN_TRAINER0, //0 - CLASS_PKMN_TRAINER1, //1 - CLASS_HIKER, //2 - CLASS_TEAM_AQUA, //3 - CLASS_PKMN_BREEDER, //4 - CLASS_COOLTRAINER, //5 - CLASS_BIRDKEEPER, //6 - CLASS_COLLECTOR, //7 - CLASS_SWIMMER_MALE, //8 - CLASS_TEAM_MAGMA, //9 + CLASS_PKMN_TRAINER0, // 0 + CLASS_PKMN_TRAINER1, // 1 + CLASS_HIKER, // 2 + CLASS_TEAM_AQUA, // 3 + CLASS_PKMN_BREEDER, // 4 + CLASS_COOLTRAINER, // 5 + CLASS_BIRDKEEPER, // 6 + CLASS_COLLECTOR, // 7 + CLASS_SWIMMER_MALE, // 8 + CLASS_TEAM_MAGMA, // 9 CLASS_EXPERT, // 0xA CLASS_AQUA_ADMIN, // 0xB CLASS_BLACK_BELT, // 0xC @@ -36,11 +36,32 @@ enum CLASS_GENTLEMAN, // 0x1E CLASS_ELITE_FOUR, // 0x1F CLASS_LEADER, // 0x20 - CLASS_CHAMPION = 0x26, - CLASS_MAGMA_ADMIN = 0x31, - CLASS_PKMN_TRAINER_RIVAL = 0x32, - CLASS_MAGMA_LEADER = 0x35, - CLASS_SALON_MAIDEN = 0x3A, + CLASS_SCHOOL_KID, // 0x21 + CLASS_SCHOOL_SR_JR, // 0x22 + CLASS_WINSTRATE, // 0x23 + CLASS_POKE_FAN, // 0x24 + CLASS_YOUNGSTER, // 0x25 + CLASS_CHAMPION, // 0x26 + CLASS_FISHERMAN, // 0x27 + CLASS_TRIATHLETE, // 0x28 + CLASS_DRAGON_TAMER, // 0x29 + CLASS_NINJA_BOY, // 0x2A + CLASS_BATTLE_GIRL, // 0x2B + CLASS_PARASOL_LADY, // 0x2C + CLASS_SWIMMER_FEMALE, // 0x2D + CLASS_TWINS, // 0x2E + CLASS_SAILOR, // 0x2F + CLASS_COOLTRAINER_2, // 0x30 + CLASS_MAGMA_ADMIN, // 0x31 + CLASS_PKMN_TRAINER_RIVAL, // 0x32 + CLASS_BUG_CATCHER, // 0x33 + CLASS_PKMN_RANGER, // 0x34 + CLASS_MAGMA_LEADER, // 0x35 + CLASS_LASS, // 0x36 + CLASS_YOUNG_COUPLE, // 0x37 + CLASS_OLD_COUPLE, // 0x38 + CLASS_SIS_AND_BRO, // 0x39 + CLASS_SALON_MAIDEN, // 0x3A CLASS_DOME_ACE, // 0x3B CLASS_PALACE_MAVEN, // 0x3C CLASS_ARENA_TYCOON, // 0x3D diff --git a/include/trainer_front_sprites.h b/include/trainer_front_sprites.h new file mode 100644 index 000000000..3259bec88 --- /dev/null +++ b/include/trainer_front_sprites.h @@ -0,0 +1,101 @@ +#ifndef GUARD_TRAINER_FRONT_SPRITES_H +#define GUARD_TRAINER_FRONT_SPRITES_H + +enum +{ + TRAINER_FRONT_PIC_HIKER, + TRAINER_FRONT_PIC_AQUA_GRUNT_M, + TRAINER_FRONT_PIC_PKMN_BREEDER_F, + TRAINER_FRONT_PIC_COOLTRAINER_M, + TRAINER_FRONT_PIC_BIRD_KEEPER, + TRAINER_FRONT_PIC_COLLECTOR, + TRAINER_FRONT_PIC_AQUA_GRUNT_F, + TRAINER_FRONT_PIC_SWIMMER_M, + TRAINER_FRONT_PIC_MAGMA_GRUNT_M, + TRAINER_FRONT_PIC_EXPERT_M, + TRAINER_FRONT_PIC_AQUA_ADMIN_M, + TRAINER_FRONT_PIC_BLACK_BELT, + TRAINER_FRONT_PIC_AQUA_ADMIN_F, + TRAINER_FRONT_PIC_AQUA_LEADER, + TRAINER_FRONT_PIC_HEX_MANIAC, + TRAINER_FRONT_PIC_AROMA_LADY, + TRAINER_FRONT_PIC_RUIN_MANIAC, + TRAINER_FRONT_PIC_INTERVIEWER, + TRAINER_FRONT_PIC_TUBER_F, + TRAINER_FRONT_PIC_TUBER_M, + TRAINER_FRONT_PIC_COOLTRAINER_F, + TRAINER_FRONT_PIC_LADY, + TRAINER_FRONT_PIC_BEAUTY, + TRAINER_FRONT_PIC_RICH_BOY, + TRAINER_FRONT_PIC_EXPERT_F, + TRAINER_FRONT_PIC_POKE_MANIAC, + TRAINER_FRONT_PIC_MAGMA_GRUNT_F, + TRAINER_FRONT_PIC_GUITARIST, + TRAINER_FRONT_PIC_KINDLER, + TRAINER_FRONT_PIC_CAMPER, + TRAINER_FRONT_PIC_PICNICKER, + TRAINER_FRONT_PIC_BUG_MANIAC, + TRAINER_FRONT_PIC_PKMN_BREEDER_M, + TRAINER_FRONT_PIC_PSYCHIC_M, + TRAINER_FRONT_PIC_PSYCHIC_F, + TRAINER_FRONT_PIC_GENTLEMAN, + TRAINER_FRONT_PIC_SIDNEY, + TRAINER_FRONT_PIC_PHOEBE, + TRAINER_FRONT_PIC_GLACIA, + TRAINER_FRONT_PIC_DRAKE, + TRAINER_FRONT_PIC_ROXANNE, + TRAINER_FRONT_PIC_BRAWLY, + TRAINER_FRONT_PIC_WATTSON, + TRAINER_FRONT_PIC_FLANNERY, + TRAINER_FRONT_PIC_NORMAN, + TRAINER_FRONT_PIC_WINONA, + TRAINER_FRONT_PIC_TATE_LIZA, + TRAINER_FRONT_PIC_JUAN, + TRAINER_FRONT_PIC_SCHOOL_KID_M, + TRAINER_FRONT_PIC_SCHOOL_KID_F, + TRAINER_FRONT_PIC_SR_JR, + TRAINER_FRONT_PIC_POKÉFAN_M, + TRAINER_FRONT_PIC_POKÉFAN_F, + TRAINER_FRONT_PIC_YOUNGSTER, + TRAINER_FRONT_PIC_WALLACE, + TRAINER_FRONT_PIC_FISHERMAN, + TRAINER_FRONT_PIC_TRIATHLETE_BIKER_M, + TRAINER_FRONT_PIC_TRIATHLETE_BIKER_F, + TRAINER_FRONT_PIC_TRIATHLETE_JOGGER_M, + TRAINER_FRONT_PIC_TRIATHLETE_JOGGER_F, + TRAINER_FRONT_PIC_TRIATHLETE_SWIMMER_M, + TRAINER_FRONT_PIC_TRIATHLETE_SWIMMER_F, + TRAINER_FRONT_PIC_DRAGON_TAMER, + TRAINER_FRONT_PIC_NINJA_BOY, + TRAINER_FRONT_PIC_BATTLE_GIRL, + TRAINER_FRONT_PIC_PARASOL_LADY, + TRAINER_FRONT_PIC_SWIMMER_F, + TRAINER_FRONT_PIC_TWINS, + TRAINER_FRONT_PIC_SAILOR, + TRAINER_FRONT_PIC_MAGMA_ADMIN_M, + TRAINER_FRONT_PIC_WALLY, + TRAINER_FRONT_PIC_BRENDAN_E, + TRAINER_FRONT_PIC_MAY_E, + TRAINER_FRONT_PIC_BUG_CATCHER, + TRAINER_FRONT_PIC_PKMN_RANGER_M, + TRAINER_FRONT_PIC_PKMN_RANGER_F, + TRAINER_FRONT_PIC_MAGMA_LEADER, + TRAINER_FRONT_PIC_LASS, + TRAINER_FRONT_PIC_YOUNG_COUPLE, + TRAINER_FRONT_PIC_OLD_COUPLE, + TRAINER_FRONT_PIC_SIS_AND_BRO, + TRAINER_FRONT_PIC_STEVEN, + TRAINER_FRONT_PIC_ANABEL, + TRAINER_FRONT_PIC_TUCKER, + TRAINER_FRONT_PIC_SPENSER, + TRAINER_FRONT_PIC_GRETA, + TRAINER_FRONT_PIC_NOLAND, + TRAINER_FRONT_PIC_LUCY, + TRAINER_FRONT_PIC_BRANDON, + TRAINER_FRONT_PIC_RED, + TRAINER_FRONT_PIC_LEAF, + TRAINER_FRONT_PIC_BRENDAN_RS, + TRAINER_FRONT_PIC_MAY_RS +}; + +#endif // GUARD_TRAINER_FRONT_SPRITES_H diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 02a2ffdff..a7e7ad022 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -21,6 +21,7 @@ #include "bg.h" #include "reshow_battle_screen.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -56,7 +57,7 @@ extern u16 gTrainerBattleOpponent_B; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; -extern const u8 gTrainerClassToFrontPicId[]; +extern const u8 gUnknown_0831F578[]; extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); @@ -134,7 +135,7 @@ static void sub_8067618(u8 taskId); static void sub_80676FC(struct Sprite *sprite); static void sub_806782C(void); -static void (*const sLinkOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { LinkOpponentHandleGetMonData, LinkOpponentHandleGetRawMonData, @@ -519,7 +520,7 @@ static void sub_8064E50(void) UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); sub_8076918(gActiveBank); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); gBattleBankFunc[gActiveBank] = sub_8064D60; } } @@ -561,7 +562,7 @@ static void LinkOpponentBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -573,7 +574,7 @@ static void LinkOpponentHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -582,12 +583,12 @@ static void LinkOpponentHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += CopyLinkOpponentMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -907,7 +908,7 @@ static void LinkOpponentHandleGetRawMonData(void) static void LinkOpponentHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -916,12 +917,12 @@ static void LinkOpponentHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetLinkOpponentMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } LinkOpponentBufferExecCompleted(); @@ -1166,8 +1167,6 @@ static void LinkOpponentHandleLoadMonSprite(void) sub_80A6138(gActiveBank), sub_80A82E4(gActiveBank)); - - gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; @@ -1255,16 +1254,6 @@ static void DoSwitchOutAnimation(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerFrontPicCoords[]; - static void LinkOpponentHandleDrawTrainerPic(void) { s16 xPos; @@ -1290,17 +1279,17 @@ static void LinkOpponentHandleDrawTrainerPic(void) || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) { if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) - trainerPicId = gTrainerClassToFrontPicId[0x4F]; + trainerPicId = gUnknown_0831F578[0x4F]; else - trainerPicId = gTrainerClassToFrontPicId[0x4E]; + trainerPicId = gUnknown_0831F578[0x4E]; } else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) { if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) - trainerPicId = gTrainerClassToFrontPicId[0x51]; + trainerPicId = gUnknown_0831F578[0x51]; else - trainerPicId = gTrainerClassToFrontPicId[0x50]; + trainerPicId = gUnknown_0831F578[0x50]; } else { @@ -1319,17 +1308,17 @@ static void LinkOpponentHandleDrawTrainerPic(void) || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gTrainerClassToFrontPicId[0x4F]; + trainerPicId = gUnknown_0831F578[0x4F]; else - trainerPicId = gTrainerClassToFrontPicId[0x4E]; + trainerPicId = gUnknown_0831F578[0x4E]; } else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_SAPPHIRE) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gTrainerClassToFrontPicId[0x51]; + trainerPicId = gUnknown_0831F578[0x51]; else - trainerPicId = gTrainerClassToFrontPicId[0x50]; + trainerPicId = gUnknown_0831F578[0x50]; } else { @@ -1849,7 +1838,7 @@ static void LinkOpponentHandleSpriteInvisibility(void) if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); } LinkOpponentBufferExecCompleted(); } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 9f44fcf1c..33fa7abd5 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -21,6 +21,7 @@ #include "bg.h" #include "reshow_battle_screen.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -129,7 +130,7 @@ static void LinkPartnerDoMoveAnimation(void); static void sub_814DCCC(u8 taskId); static void sub_814DE9C(void); -static void (*const sLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { LinkPartnerHandleGetMonData, LinkPartnerHandleGetRawMonData, @@ -370,7 +371,7 @@ static void sub_814B4E0(void) { if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) { - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); @@ -432,7 +433,7 @@ static void LinkPartnerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -456,7 +457,7 @@ static void LinkPartnerHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -465,12 +466,12 @@ static void LinkPartnerHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += CopyLinkPartnerMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -790,7 +791,7 @@ static void LinkPartnerHandleGetRawMonData(void) static void LinkPartnerHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -799,12 +800,12 @@ static void LinkPartnerHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetLinkPartnerMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } LinkPartnerBufferExecCompleted(); @@ -1135,17 +1136,6 @@ static void DoSwitchOutAnimation(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerBackPicCoords[]; -extern const struct MonCoords gTrainerFrontPicCoords[]; - static void LinkPartnerHandleDrawTrainerPic(void) { s16 xPos; @@ -1681,7 +1671,7 @@ static void LinkPartnerHandleSpriteInvisibility(void) if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); } LinkPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 61886575c..4772cba50 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -25,6 +25,7 @@ #include "reshow_battle_screen.h" #include "rng.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -135,7 +136,7 @@ static void sub_806280C(struct Sprite *sprite); static void sub_8062828(u8 taskId); static void sub_8062A2C(void); -static void (*const sOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { OpponentHandleGetMonData, OpponentHandleGetRawMonData, @@ -501,7 +502,7 @@ static void sub_805FD00(void) UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); sub_8076918(gActiveBank); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); gBattleBankFunc[gActiveBank] = sub_805FC10; } } @@ -540,7 +541,7 @@ static void OpponentBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -552,7 +553,7 @@ static void OpponentHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -561,12 +562,12 @@ static void OpponentHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += GetOpponentMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -895,7 +896,7 @@ static void OpponentHandleGetRawMonData(void) static void OpponentHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -904,12 +905,12 @@ static void OpponentHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetOpponentMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } OpponentBufferExecCompleted(); @@ -1243,16 +1244,6 @@ static void DoSwitchOutAnimation(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerFrontPicCoords[]; - static void OpponentHandleDrawTrainerPic(void) { u32 trainerPicId; @@ -1997,7 +1988,7 @@ static void OpponentHandleSpriteInvisibility(void) if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); } OpponentBufferExecCompleted(); } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 69df9f70b..ffd0a6ce3 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -24,6 +24,7 @@ #include "reshow_battle_screen.h" #include "rng.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -169,7 +170,7 @@ static void PlayerDoMoveAnimation(void); static void task05_08033660(u8 taskId); static void sub_805CE38(void); -static void (*const sPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { PlayerHandleGetMonData, PlayerHandleGetRawMonData, @@ -254,7 +255,7 @@ static void PlayerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -1099,7 +1100,7 @@ static void sub_8058EDC(void) && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) { - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; FreeSpriteTilesByTag(0x27F9); @@ -1614,7 +1615,7 @@ static void PlayerHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -1623,12 +1624,12 @@ static void PlayerHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += CopyPlayerMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -1957,7 +1958,7 @@ void PlayerHandleGetRawMonData(void) static void PlayerHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -1966,12 +1967,12 @@ static void PlayerHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetPlayerMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } PlayerBufferExecCompleted(); @@ -2292,17 +2293,6 @@ static void DoSwitchOutAnimation(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerBackPicCoords[]; -extern const struct MonCoords gTrainerFrontPicCoords[]; - // some explanation here // in emerald it's possible to have a tag battle in the battle frontier facilities with AI // which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it @@ -3086,7 +3076,7 @@ static void PlayerHandleSpriteInvisibility(void) if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); } PlayerBufferExecCompleted(); } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index e40ba8a69..df35e54c4 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -20,6 +20,7 @@ #include "bg.h" #include "reshow_battle_screen.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -135,7 +136,7 @@ static void PlayerPartnerDoMoveAnimation(void); static void sub_81BE2C8(u8 taskId); static void sub_81BE498(void); -static void (*const sPlayerPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { PlayerPartnerHandleGetMonData, PlayerPartnerHandleGetRawMonData, @@ -557,7 +558,7 @@ static void sub_81BB92C(void) { if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) { - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); @@ -619,7 +620,7 @@ static void PlayerPartnerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -643,7 +644,7 @@ static void PlayerPartnerHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -652,12 +653,12 @@ static void PlayerPartnerHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += CopyPlayerPartnerMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -977,7 +978,7 @@ static void PlayerPartnerHandleGetRawMonData(void) static void PlayerPartnerHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -986,12 +987,12 @@ static void PlayerPartnerHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetPlayerPartnerMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } PlayerPartnerBufferExecCompleted(); @@ -1322,17 +1323,6 @@ static void DoSwitchOutAnimation(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerBackPicCoords[]; -extern const struct MonCoords gTrainerFrontPicCoords[]; - // some explanation here // in emerald it's possible to have a tag battle in the battle frontier facilities with AI // which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it @@ -1927,7 +1917,7 @@ static void PlayerPartnerHandleSpriteInvisibility(void) if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); } PlayerPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 69ae9e343..feb8aef19 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -22,6 +22,7 @@ #include "bg.h" #include "reshow_battle_screen.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -133,7 +134,7 @@ static void sub_8189548(u8 taskId); static void sub_818962C(struct Sprite *sprite); static void sub_818975C(void); -static void (*const sRecordedOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { RecordedOpponentHandleGetMonData, RecordedOpponentHandleGetRawMonData, @@ -504,7 +505,7 @@ static void sub_8186F94(void) UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); sub_8076918(gActiveBank); SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); gBattleBankFunc[gActiveBank] = sub_8186EA4; } } @@ -546,7 +547,7 @@ static void RecordedOpponentBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -558,7 +559,7 @@ static void RecordedOpponentHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -567,12 +568,12 @@ static void RecordedOpponentHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += CopyRecordedOpponentMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -892,7 +893,7 @@ static void RecordedOpponentHandleGetRawMonData(void) static void RecordedOpponentHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -901,12 +902,12 @@ static void RecordedOpponentHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetRecordedOpponentMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } RecordedOpponentBufferExecCompleted(); @@ -1239,16 +1240,6 @@ static void DoSwitchOutAnimation(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerFrontPicCoords[]; - static void RecordedOpponentHandleDrawTrainerPic(void) { s16 xPos; @@ -1791,7 +1782,7 @@ static void RecordedOpponentHandleSpriteInvisibility(void) if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); } RecordedOpponentBufferExecCompleted(); } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 76ac40ef0..ca9fcda52 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -21,6 +21,7 @@ #include "bg.h" #include "reshow_battle_screen.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -132,7 +133,7 @@ static void RecordedPlayerDoMoveAnimation(void); static void sub_818CC24(u8 taskId); static void sub_818CDF4(void); -static void (*const sRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { RecordedPlayerHandleGetMonData, RecordedPlayerHandleGetRawMonData, @@ -455,7 +456,7 @@ static void sub_818A2B4(void) { if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) { - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); @@ -517,7 +518,7 @@ static void RecordedPlayerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -541,7 +542,7 @@ static void RecordedPlayerHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -550,12 +551,12 @@ static void RecordedPlayerHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += CopyRecordedPlayerMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -875,7 +876,7 @@ static void RecordedPlayerHandleGetRawMonData(void) static void RecordedPlayerHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -884,12 +885,12 @@ static void RecordedPlayerHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetRecordedPlayerMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } RecordedPlayerBufferExecCompleted(); @@ -1220,17 +1221,6 @@ static void DoSwitchOutAnimation(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerBackPicCoords[]; -extern const struct MonCoords gTrainerFrontPicCoords[]; - static void RecordedPlayerHandleDrawTrainerPic(void) { s16 xPos, yPos; @@ -1811,7 +1801,7 @@ static void RecordedPlayerHandleSpriteInvisibility(void) if (IsBankSpritePresent(gActiveBank)) { gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; - SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + CopyBattleSpriteInvisibility(gActiveBank); } RecordedPlayerBufferExecCompleted(); } diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 292a631f4..61097b190 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -18,6 +18,7 @@ #include "bg.h" #include "reshow_battle_screen.h" #include "pokeball.h" +#include "data2.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -110,7 +111,7 @@ static void SafariBufferRunCommand(void); static void SafariBufferExecCompleted(void); static void CompleteWhenChosePokeblock(void); -static void (*const sSafariBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { SafariHandleGetMonData, SafariHandleGetRawMonData, @@ -323,7 +324,7 @@ static void SafariBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -372,16 +373,6 @@ static void SafariHandleReturnMonToBall(void) SafariBufferExecCompleted(); } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerBackPicCoords[]; - static void SafariHandleDrawTrainerPic(void) { DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank); diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 693008110..9ff6044c4 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -24,6 +24,7 @@ #include "reshow_battle_screen.h" #include "rng.h" #include "pokeball.h" +#include "data2.h" #include "party_menu.h" extern u32 gBattleExecBuffer; @@ -135,7 +136,7 @@ static void SetWallyMonData(u8 monId); static void WallyDoMoveAnimation(void); static void sub_816AC04(u8 taskId); -static void (*const sWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { WallyHandleGetMonData, WallyHandleGetRawMonData, @@ -441,7 +442,7 @@ static void WallyBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; } else { @@ -459,7 +460,7 @@ static void WallyHandleGetMonData(void) { u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data u32 size = 0; - u8 monsToCheck; + u8 monToCheck; s32 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -468,12 +469,12 @@ static void WallyHandleGetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) size += CopyWallyMonData(i, monData + size); - monsToCheck >>= 1; + monToCheck >>= 1; } } EmitDataTransfer(1, size, monData); @@ -793,7 +794,7 @@ static void WallyHandleGetRawMonData(void) static void WallyHandleSetMonData(void) { - u8 monsToCheck; + u8 monToCheck; u8 i; if (gBattleBufferA[gActiveBank][2] == 0) @@ -802,12 +803,12 @@ static void WallyHandleSetMonData(void) } else { - monsToCheck = gBattleBufferA[gActiveBank][2]; + monToCheck = gBattleBufferA[gActiveBank][2]; for (i = 0; i < 6; i++) { - if (monsToCheck & 1) + if (monToCheck & 1) SetWallyMonData(i); - monsToCheck >>= 1; + monToCheck >>= 1; } } WallyBufferExecCompleted(); @@ -1062,16 +1063,6 @@ static void WallyHandleReturnMonToBall(void) } } -// todo: get rid of it once the struct is declared in a header -struct MonCoords -{ - // This would use a bitfield, but sub_8079F44 - // uses it as a u8 and casting won't match. - u8 coords; // u8 x:4, y:4; - u8 y_offset; -}; -extern const struct MonCoords gTrainerBackPicCoords[]; - static void WallyHandleDrawTrainerPic(void) { DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 9d9eea24c..5c874438e 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -939,11 +939,11 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) } } -void EmitGetMonData(u8 bufferId, u8 requestId, u8 monsToCheck) +void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) { gBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA; gBattleBuffersTransferData[1] = requestId; - gBattleBuffersTransferData[2] = monsToCheck; + gBattleBuffersTransferData[2] = monToCheck; gBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -957,13 +957,13 @@ void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitSetMonData(u8 bufferId, u8 requestId, u8 monsToCheck, u8 bytes, void *data) +void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data) { s32 i; gBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA; gBattleBuffersTransferData[1] = requestId; - gBattleBuffersTransferData[2] = monsToCheck; + gBattleBuffersTransferData[2] = monToCheck; for (i = 0; i < bytes; i++) gBattleBuffersTransferData[3 + i] = *(u8*)(data++); PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 3 + bytes); diff --git a/src/battle_dome_cards.c b/src/battle_dome_cards.c index 030290a0d..5251ee06a 100644 --- a/src/battle_dome_cards.c +++ b/src/battle_dome_cards.c @@ -19,7 +19,7 @@ extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const union AnimCmd *const gUnknown_082FF70C[]; extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[NUM_SPECIES]; extern const union AnimCmd *const *const gUnknown_0830536C[]; -extern const u8 gTrainerClassToFrontPicId[]; +extern const u8 gUnknown_0831F578[]; // Static type declarations @@ -421,9 +421,9 @@ u8 sub_818D97C(u8 a0, u8 a1) switch (a0) { default: - return gTrainerClassToFrontPicId[0x3F]; + return gUnknown_0831F578[0x3F]; case 0: - return gTrainerClassToFrontPicId[0x3C]; + return gUnknown_0831F578[0x3C]; } } return a0; diff --git a/src/pokemon_2.c b/src/pokemon_2.c index 9b2394184..bb0e265b5 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -1222,14 +1222,14 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord) } } -extern const u8 gTrainerClassToFrontPicId[]; +extern const u8 gUnknown_0831F578[]; extern const u8 gTrainerClassToNameIndex[]; extern const u8 gSecretBaseTrainerClasses[][5]; u8 GetSecretBaseTrainerPicIndex(void) { u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5]; - return gTrainerClassToFrontPicId[trainerClass]; + return gUnknown_0831F578[trainerClass]; } u8 GetSecretBaseTrainerNameIndex(void) diff --git a/src/pokemon_3.c b/src/pokemon_3.c index f5043db01..73d23fe6f 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1652,11 +1652,11 @@ u8 sub_806EF84(u8 arg0, u8 arg1) return i; } -extern const u8 gTrainerClassToFrontPicId[]; +extern const u8 gUnknown_0831F578[]; u16 sub_806EFF0(u16 arg0) { - return gTrainerClassToFrontPicId[arg0]; + return gUnknown_0831F578[arg0]; } u16 PlayerGenderToFrontTrainerPicId(u8 playerGender) From 192817a7dcbfb4cab5eef0d57c95536cf5971584 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 31 Oct 2017 18:49:29 +0100 Subject: [PATCH 27/29] clarify controllers terminator --- include/battle_controllers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 517df3edb..973a723e0 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -167,8 +167,8 @@ enum CONTROLLER_LINKSTANDBYMSG, CONTROLLER_RESETACTIONMOVESELECTION, CONTROLLER_55, - /*new controllers should go after 55 and before 56*/ - CONTROLLER_56, + /*new controllers should go here*/ + CONTROLLER_TERMINATOR_NOP, CONTROLLER_CMDS_COUNT }; From f724213a040f3c6a2f9685d52ae4e06d57aa0c41 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 31 Oct 2017 18:52:18 +0100 Subject: [PATCH 28/29] review change 3 battle controllers --- src/battle_controller_link_opponent.c | 2 +- src/battle_controller_link_partner.c | 2 +- src/battle_controller_opponent.c | 2 +- src/battle_controller_player.c | 2 +- src/battle_controller_player_partner.c | 2 +- src/battle_controller_recorded_opponent.c | 2 +- src/battle_controller_recorded_player.c | 2 +- src/battle_controller_safari.c | 2 +- src/battle_controller_wally.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index a7e7ad022..968f6d49f 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -562,7 +562,7 @@ static void LinkOpponentBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 33fa7abd5..4a70a4dc1 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -433,7 +433,7 @@ static void LinkPartnerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 4772cba50..7ffd9d64b 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -541,7 +541,7 @@ static void OpponentBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index ffd0a6ce3..10d361cb9 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -255,7 +255,7 @@ static void PlayerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index df35e54c4..34fd8a3eb 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -620,7 +620,7 @@ static void PlayerPartnerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index feb8aef19..0dc7631ce 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -547,7 +547,7 @@ static void RecordedOpponentBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index ca9fcda52..a3343a391 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -518,7 +518,7 @@ static void RecordedPlayerBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 61097b190..0c5b698cf 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -324,7 +324,7 @@ static void SafariBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 9ff6044c4..c2addd30c 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -442,7 +442,7 @@ static void WallyBufferExecCompleted(void) u8 playerId = GetMultiplayerId(); PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1; + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; } else { From 665734d689fbd6da708e482b1cb9fdf3ee2345bc Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 31 Oct 2017 19:28:43 +0100 Subject: [PATCH 29/29] evolution files review changes --- data/data4.s | 2 +- src/evolution_graphics.c | 4 ++-- src/evolution_scene.c | 48 ++++++++++++++++++++-------------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/data/data4.s b/data/data4.s index d99336e87..e98518b73 100644 --- a/data/data4.s +++ b/data/data4.s @@ -410,7 +410,7 @@ gUnknown_085B51E4:: @ 85B51E4 gUnknown_085B5884:: @ 85B5884 .incbin "baserom.gba", 0x5b5884, 0x40 -gUnknown_085B58C4:: @ 85B58C4 +gText_ShedinjaJapaneseName2:: @ 85B58C4 .incbin "baserom.gba", 0x5b58c4, 0x5 gUnknown_085B58C9:: @ 85B58C9 diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c index 42acdd1d6..eca5d4bdc 100644 --- a/src/evolution_graphics.c +++ b/src/evolution_graphics.c @@ -85,7 +85,7 @@ static const struct SpriteTemplate sEvoSparkleSpriteTemplate = .callback = EvoSparkle_DummySpriteCb }; -static const s16 sEvoSparkleMatricies[] = +static const s16 sEvoSparkleMatrices[] = { 0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, 0x240, 0x200, 0x1C0, 0x180, 0x140, 0x100, -4, 0x10, -3, 0x30, -2, 0x50, @@ -102,7 +102,7 @@ static void SetEvoSparklesMatrices(void) u16 i; for (i = 0; i < 12; i++) { - SetOamMatrix(20 + i, sEvoSparkleMatricies[i], 0, 0, sEvoSparkleMatricies[i]); + SetOamMatrix(20 + i, sEvoSparkleMatrices[i], 0, 0, sEvoSparkleMatrices[i]); } } diff --git a/src/evolution_scene.c b/src/evolution_scene.c index e53981eeb..7c38f2190 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -67,7 +67,7 @@ extern const u32 gUnknown_085B482C[]; extern const u32 gUnknown_085B4D10[]; // strings -extern const u8 gUnknown_085B58C4[]; +extern const u8 gText_ShedinjaJapaneseName2[]; extern const u8 gText_PkmnIsEvolving[]; extern const u8 gText_CongratsPkmnEvolved[]; extern const u8 gText_BattleYesNoChoice[]; @@ -169,7 +169,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, { u8 name[20]; u16 currSpecies; - u32 TiD, PiD; + u32 trainerId, personality; const struct CompressedSpritePalette* pokePal; u8 ID; @@ -216,12 +216,12 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, // preEvo sprite currSpecies = GetMonData(mon, MON_DATA_SPECIES); - TiD = GetMonData(mon, MON_DATA_OT_ID); - PiD = GetMonData(mon, MON_DATA_PERSONALITY); + trainerId = GetMonData(mon, MON_DATA_OT_ID); + personality = GetMonData(mon, MON_DATA_PERSONALITY); DecompressPicFromTable_2(&gMonFrontPicTable[currSpecies], gMonSpritesGfxPtr->sprites[1], currSpecies); - pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, TiD, PiD); + pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, trainerId, personality); LoadCompressedPalette(pokePal->data, 0x110, 0x20); sub_806A068(currSpecies, 1); @@ -236,7 +236,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], gMonSpritesGfxPtr->sprites[3], speciesToEvolve); - pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, TiD, PiD); + pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality); LoadCompressedPalette(pokePal->data, 0x120, 0x20); sub_806A068(speciesToEvolve, 3); @@ -272,12 +272,12 @@ static void CB2_EvolutionSceneLoadGraphics(void) u8 ID; const struct CompressedSpritePalette* pokePal; u16 postEvoSpecies; - u32 TiD, PiD; + u32 trainerId, personality; struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; - TiD = GetMonData(Mon, MON_DATA_OT_ID); - PiD = GetMonData(Mon, MON_DATA_PERSONALITY); + trainerId = GetMonData(Mon, MON_DATA_OT_ID); + personality = GetMonData(Mon, MON_DATA_PERSONALITY); SetHBlankCallback(NULL); SetVBlankCallback(NULL); @@ -313,7 +313,7 @@ static void CB2_EvolutionSceneLoadGraphics(void) DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], gMonSpritesGfxPtr->sprites[3], postEvoSpecies); - pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, TiD, PiD); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality); LoadCompressedPalette(pokePal->data, 0x120, 0x20); @@ -380,12 +380,12 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) case 4: { const struct CompressedSpritePalette* pokePal; - u32 TiD = GetMonData(Mon, MON_DATA_OT_ID); - u32 PiD = GetMonData(Mon, MON_DATA_PERSONALITY); + u32 trainerId = GetMonData(Mon, MON_DATA_OT_ID); + u32 personality = GetMonData(Mon, MON_DATA_PERSONALITY); DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], gMonSpritesGfxPtr->sprites[3], postEvoSpecies); - pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, TiD, PiD); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality); LoadCompressedPalette(pokePal->data, 0x120, 0x20); gMain.state++; } @@ -428,7 +428,7 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri { u8 name[20]; u16 currSpecies; - u32 TiD, PiD; + u32 trainerId, personality; const struct CompressedSpritePalette* pokePal; u8 ID; @@ -440,8 +440,8 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri // preEvo sprite currSpecies = GetMonData(mon, MON_DATA_SPECIES); - PiD = GetMonData(mon, MON_DATA_PERSONALITY); - TiD = GetMonData(mon, MON_DATA_OT_ID); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + trainerId = GetMonData(mon, MON_DATA_OT_ID); sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); sEvoStructPtr->preEvoSpriteID = preEvoSpriteID; @@ -450,7 +450,7 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri gMonSpritesGfxPtr->sprites[1], speciesToEvolve); - pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, TiD, PiD); + pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality); LoadCompressedPalette(pokePal->data, 0x120, 0x20); sub_806A068(speciesToEvolve, 1); @@ -511,8 +511,8 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) { s32 i; struct Pokemon* Shedinja = &gPlayerParty[gPlayerPartyCount]; - const struct EvolutionData* EvoTable; - const struct EvolutionData* Evos; + const struct EvolutionData* evoTable; + const struct EvolutionData* evos; CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies)); @@ -534,15 +534,15 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) CalculatePlayerPartyCount(); // can't match it otherwise, ehh - EvoTable = gEvolutionTable; - Evos = EvoTable + preEvoSpecies; - GetSetPokedexFlag(SpeciesToNationalPokedexNum(Evos->evolutions[1].targetSpecies), FLAG_SET_SEEN); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(Evos->evolutions[1].targetSpecies), FLAG_SET_CAUGHT); + evoTable = gEvolutionTable; + evos = EvoTable + preEvoSpecies; + GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_CAUGHT); if (GetMonData(Shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA && GetMonData(Shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK) - SetMonData(Shedinja, MON_DATA_NICKNAME, gUnknown_085B58C4); + SetMonData(Shedinja, MON_DATA_NICKNAME, gText_ShedinjaJapaneseName2); } }