diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index f719ab59d7..d0ada0d5de 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 9f96d592a2..0000000000 --- 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 626d4d7a1f..478f7c3456 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 b28f822f73..1acb181eb1 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 62361ebef2..07bab9d5f6 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 efedf52b6c..0b0f1e6266 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 bf6962b1b7..ee835586b4 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 d0c7b118d2..52c0c7af58 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 b2afd98372..6dfc848d7c 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 0a0badb335..468b2c46d1 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 aa45c3d249..73d23fe6fa 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; } }