diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s deleted file mode 100644 index 10b6d30be..000000000 --- a/asm/battle_controller_wally.s +++ /dev/null @@ -1,4755 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start WallyBufferRunCommand -WallyBufferRunCommand: @ 81683F4 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08168440 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0816843C - ldr r0, =gWallyBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _08168440 - .pool -_0816843C: - bl WallyBufferExecCompleted -_08168440: - pop {r0} - bx r0 - thumb_func_end WallyBufferRunCommand - - thumb_func_start sub_8168444 -sub_8168444: @ 8168444 - push {r4,r5,lr} - ldr r1, =gBattleStruct - ldr r0, [r1] - adds r0, 0x94 - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x5 - bls _08168456 - b _08168564 -_08168456: - lsls r0, 2 - ldr r1, =_08168468 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08168468: - .4byte _08168480 - .4byte _08168492 - .4byte _081684B0 - .4byte _081684CE - .4byte _08168508 - .4byte _08168540 -_08168480: - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08168492: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0 - b _081684E4 -_081684B0: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0 - b _081684E4 -_081684CE: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x1 - movs r1, 0x9 -_081684E4: - movs r2, 0 - bl EmitTwoReturnValues - bl WallyBufferExecCompleted - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x95 - strb r5, [r0] - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - b _08168564 -_08168508: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl ActionSelectionDestroyCursorAt - movs r0, 0x1 - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08168564 -_08168540: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl EmitTwoReturnValues - bl WallyBufferExecCompleted -_08168564: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8168444 - - thumb_func_start sub_816856C -sub_816856C: @ 816856C - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08168590 - bl WallyBufferExecCompleted -_08168590: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816856C - - thumb_func_start sub_81685A4 -sub_81685A4: @ 81685A4 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081685B6 - bl WallyBufferExecCompleted -_081685B6: - pop {r0} - bx r0 - thumb_func_end sub_81685A4 - - thumb_func_start bx_wait_t5 -bx_wait_t5: @ 81685BC - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - bne _081685CA - bl WallyBufferExecCompleted -_081685CA: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t5 - - thumb_func_start sub_81685D4 -sub_81685D4: @ 81685D4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081685FC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168610 - str r1, [r0] - bl nullsub_35 - bl FreeAllWindowBuffers - bl DoWallyTutorialBagMenu -_081685FC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81685D4 - - thumb_func_start sub_8168610 -sub_8168610: @ 8168610 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _08168636 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08168636 - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitOneReturnValue - bl WallyBufferExecCompleted -_08168636: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168610 - - thumb_func_start sub_816864C -sub_816864C: @ 816864C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r7, 0x88 - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - bne _08168684 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08168684: - ldr r1, [r4] - ldrb r0, [r5] - movs r6, 0x2 - adds r2, r6, 0 - eors r2, r0 - ldr r1, [r1, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - bne _081686B6 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081686B6: - ldr r0, [r4] - ldrb r2, [r5] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - movs r4, 0x8 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _081686D2 - b _081687DC -_081686D2: - adds r1, r2, 0 - eors r1, r6 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _081687DC - ldr r0, =gSprites - mov r8, r0 - ldr r7, =gUnknown_03005D7C - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r4, r8 - adds r4, 0x1C - adds r0, r4 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _081687DC - ldr r0, =gBankSpriteIds - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r3 - bne _081687DC - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0816877A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0816877A - ldrb r0, [r5] - eors r0, r6 - adds r0, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r0, [r5] - adds r1, r6, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r5] - eors r0, r6 - bl sub_8076918 - ldrb r0, [r5] - eors r0, r6 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0816877A: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldr r5, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168818 - str r1, [r0] -_081687DC: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816864C - - thumb_func_start sub_8168818 -sub_8168818: @ 8168818 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r4, 0 - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r1, =gActiveBank - mov r8, r1 - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08168842 - movs r4, 0x1 -_08168842: - cmp r4, 0 - beq _08168904 - ldr r7, =gBattleSpritesDataPtr - ldr r0, [r7] - ldr r4, [r0, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r2, r0, r4 - ldrb r1, [r2, 0x1] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08168904 - movs r6, 0x2 - adds r1, r6, 0 - eors r1, r3 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08168904 - ldrb r1, [r2] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r7] - mov r1, r8 - ldrb r2, [r1] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r2, [r7] - mov r1, r8 - ldrb r0, [r1] - adds r1, r6, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - ldr r2, [r7] - mov r1, r8 - ldrb r0, [r1] - adds r1, r6, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r0, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r2, =gBattlePartyID - mov r0, r8 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl WallyBufferExecCompleted -_08168904: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168818 - - thumb_func_start sub_8168934 -sub_8168934: @ 8168934 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r6, =gHealthBoxesIds - adds r1, r0, r6 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0816897C - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08168996 - .pool -_0816897C: - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl WallyBufferExecCompleted -_08168996: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168934 - - thumb_func_start bx_blink_t5 -bx_blink_t5: @ 81689A4 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _081689F0 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl WallyBufferExecCompleted - b _08168A1A - .pool -_081689F0: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08168A14 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_08168A14: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08168A1A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t5 - - thumb_func_start sub_8168A20 -sub_8168A20: @ 8168A20 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08168A74 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl WallyBufferExecCompleted -_08168A74: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168A20 - - thumb_func_start sub_8168A90 -sub_8168A90: @ 8168A90 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08168AB4 - bl WallyBufferExecCompleted -_08168AB4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168A90 - - thumb_func_start sub_8168AC8 -sub_8168AC8: @ 8168AC8 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08168AEA - bl WallyBufferExecCompleted -_08168AEA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168AC8 - - thumb_func_start WallyBufferExecCompleted -WallyBufferExecCompleted: @ 8168AF8 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =WallyBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08168B4C - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _08168B5E - .pool -_08168B4C: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_08168B5E: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyBufferExecCompleted - - thumb_func_start sub_8168B70 -sub_8168B70: @ 8168B70 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _08168B92 - bl WallyBufferExecCompleted -_08168B92: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168B70 - - thumb_func_start WallyHandleGetMonData -WallyHandleGetMonData: @ 8168BA0 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08168BD8 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_8168C14 - adds r6, r0, 0 - b _08168BFA - .pool -_08168BD8: - ldrb r4, [r1] - movs r5, 0 -_08168BDC: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08168BF2 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_8168C14 - adds r6, r0 -_08168BF2: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08168BDC -_08168BFA: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl WallyBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end WallyHandleGetMonData - - thumb_func_start sub_8168C14 -sub_8168C14: @ 8168C14 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _08168C3E - bl _081693AA -_08168C3E: - lsls r0, 2 - ldr r1, =_08168C54 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08168C54: - .4byte _08168D44 - .4byte _08168F68 - .4byte _08168F78 - .4byte _08168F88 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _0816900C - .4byte _08169048 - .4byte _08169048 - .4byte _08169048 - .4byte _08169048 - .4byte _081693AA - .4byte _081693AA - .4byte _081693AA - .4byte _081693AA - .4byte _08169064 - .4byte _08169074 - .4byte _081690A4 - .4byte _081690B4 - .4byte _081690C4 - .4byte _081690D4 - .4byte _081690E4 - .4byte _081690F4 - .4byte _08169104 - .4byte _08169114 - .4byte _08169124 - .4byte _08169134 - .4byte _08169144 - .4byte _08169154 - .4byte _08169164 - .4byte _081691B4 - .4byte _081691C4 - .4byte _081691D4 - .4byte _081691E4 - .4byte _081691F4 - .4byte _08169204 - .4byte _08169214 - .4byte _08169224 - .4byte _08169234 - .4byte _08169268 - .4byte _08169278 - .4byte _08169288 - .4byte _08169298 - .4byte _081692A8 - .4byte _081692B8 - .4byte _081692C8 - .4byte _081692D8 - .4byte _081692F8 - .4byte _08169308 - .4byte _08169318 - .4byte _08169328 - .4byte _08169338 - .4byte _08169348 - .4byte _08169358 - .4byte _08169368 - .4byte _08169378 - .4byte _08169388 - .4byte _08169398 -_08168D44: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08168D90: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08168D90 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_08168F48: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _08168F48 - b _081693AA - .pool -_08168F68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _081692E2 - .pool -_08168F78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _081692E2 - .pool -_08168F88: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_08168F9E: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _08168F9E - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_08168FDC: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _08168FDC - b _081693AA - .pool -_08168FF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _081692E2 - .pool -_0816900C: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_08169018: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _08169018 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _081693AA - .pool -_08169048: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _081693A2 - .pool -_08169064: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0816907E - .pool -_08169074: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0816907E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _081693AA - .pool -_081690A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _081693A2 - .pool -_081690B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _081693A2 - .pool -_081690C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _081693A2 - .pool -_081690D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _081693A2 - .pool -_081690E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _081693A2 - .pool -_081690F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _081693A2 - .pool -_08169104: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _081693A2 - .pool -_08169114: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _081693A2 - .pool -_08169124: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _081693A2 - .pool -_08169134: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _081693A2 - .pool -_08169144: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _081693A2 - .pool -_08169154: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _081693A2 - .pool -_08169164: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _081693AA - .pool -_081691B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _081693A2 - .pool -_081691C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _081693A2 - .pool -_081691D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _081693A2 - .pool -_081691E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _081693A2 - .pool -_081691F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _081693A2 - .pool -_08169204: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _081693A2 - .pool -_08169214: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0816923E - .pool -_08169224: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _081692E2 - .pool -_08169234: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0816923E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _081693AA - .pool -_08169268: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _081693A2 - .pool -_08169278: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _081692E2 - .pool -_08169288: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _081692E2 - .pool -_08169298: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _081692E2 - .pool -_081692A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _081692E2 - .pool -_081692B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _081692E2 - .pool -_081692C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _081692E2 - .pool -_081692D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_081692E2: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _081693AA - .pool -_081692F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _081693A2 - .pool -_08169308: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _081693A2 - .pool -_08169318: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _081693A2 - .pool -_08169328: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _081693A2 - .pool -_08169338: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _081693A2 - .pool -_08169348: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _081693A2 - .pool -_08169358: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _081693A2 - .pool -_08169368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _081693A2 - .pool -_08169378: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _081693A2 - .pool -_08169388: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _081693A2 - .pool -_08169398: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_081693A2: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_081693AA: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8168C14 - - thumb_func_start WallyHandleGetRawMonData -WallyHandleGetRawMonData: @ 81693C0 - push {lr} - bl PlayerHandleGetRawMonData - pop {r0} - bx r0 - thumb_func_end WallyHandleGetRawMonData - - thumb_func_start WallyHandleSetMonData -WallyHandleSetMonData: @ 81693CC - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _081693FC - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_8169424 - b _0816941A - .pool -_081693FC: - ldrb r4, [r1] - movs r5, 0 -_08169400: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0816940E - adds r0, r5, 0 - bl sub_8169424 -_0816940E: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08169400 -_0816941A: - bl WallyBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end WallyHandleSetMonData - - thumb_func_start sub_8169424 -sub_8169424: @ 8169424 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _08169450 - bl _08169DEA -_08169450: - lsls r0, 2 - ldr r1, =_08169468 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08169468: - .4byte _08169558 - .4byte _081696F0 - .4byte _08169710 - .4byte _08169730 - .4byte _08169788 - .4byte _08169788 - .4byte _08169788 - .4byte _08169788 - .4byte _081697B0 - .4byte _08169814 - .4byte _08169814 - .4byte _08169814 - .4byte _08169814 - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169844 - .4byte _08169864 - .4byte _08169884 - .4byte _081698A4 - .4byte _081698C4 - .4byte _081698E4 - .4byte _08169904 - .4byte _08169924 - .4byte _08169944 - .4byte _08169964 - .4byte _08169984 - .4byte _081699A4 - .4byte _081699C4 - .4byte _081699E4 - .4byte _08169A04 - .4byte _08169A74 - .4byte _08169A94 - .4byte _08169AB4 - .4byte _08169AD4 - .4byte _08169AF4 - .4byte _08169B14 - .4byte _08169B34 - .4byte _08169B54 - .4byte _08169B74 - .4byte _08169B94 - .4byte _08169BB4 - .4byte _08169BD4 - .4byte _08169BF4 - .4byte _08169C14 - .4byte _08169C34 - .4byte _08169C54 - .4byte _08169C74 - .4byte _08169C94 - .4byte _08169CB4 - .4byte _08169CD4 - .4byte _08169CF4 - .4byte _08169D14 - .4byte _08169D34 - .4byte _08169D54 - .4byte _08169D74 - .4byte _08169D94 - .4byte _08169DB4 - .4byte _08169DD4 -_08169558: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_081695BE: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _081695BE - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _08169DEA - .pool -_081696F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _08169DEA - .pool -_08169710: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _08169DEA - .pool -_08169730: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0816974A: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0816974A - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _08169DEA - .pool -_08169788: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0816982C - .pool -_081697B0: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _08169DEA - .pool -_08169814: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0816982C: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _08169DEA - .pool -_08169844: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _08169DEA - .pool -_08169864: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _08169DEA - .pool -_08169884: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _08169DEA - .pool -_081698A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _08169DEA - .pool -_081698C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _08169DEA - .pool -_081698E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _08169DEA - .pool -_08169904: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _08169DEA - .pool -_08169924: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _08169DEA - .pool -_08169944: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _08169DEA - .pool -_08169964: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _08169DEA - .pool -_08169984: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _08169DEA - .pool -_081699A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _08169DEA - .pool -_081699C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _08169DEA - .pool -_081699E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _08169DEA - .pool -_08169A04: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08169B24 - .pool -_08169A74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _08169DEA - .pool -_08169A94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _08169DEA - .pool -_08169AB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _08169DEA - .pool -_08169AD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _08169DEA - .pool -_08169AF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _08169DEA - .pool -_08169B14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_08169B24: - movs r1, 0x2C - bl SetMonData - b _08169DEA - .pool -_08169B34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _08169DEA - .pool -_08169B54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _08169DEA - .pool -_08169B74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _08169DEA - .pool -_08169B94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _08169DEA - .pool -_08169BB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _08169DEA - .pool -_08169BD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _08169DEA - .pool -_08169BF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _08169DEA - .pool -_08169C14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _08169DEA - .pool -_08169C34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _08169DEA - .pool -_08169C54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _08169DEA - .pool -_08169C74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _08169DEA - .pool -_08169C94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _08169DEA - .pool -_08169CB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _08169DEA - .pool -_08169CD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _08169DEA - .pool -_08169CF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _08169DEA - .pool -_08169D14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _08169DEA - .pool -_08169D34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _08169DEA - .pool -_08169D54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _08169DEA - .pool -_08169D74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _08169DEA - .pool -_08169D94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _08169DEA - .pool -_08169DB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _08169DEA - .pool -_08169DD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_08169DEA: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8169424 - - thumb_func_start WallyHandleSetRawMonData -WallyHandleSetRawMonData: @ 8169E20 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleSetRawMonData - - thumb_func_start WallyHandleLoadMonSprite -WallyHandleLoadMonSprite: @ 8169E2C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleLoadMonSprite - - thumb_func_start WallyHandleSwitchInAnim -WallyHandleSwitchInAnim: @ 8169E38 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleSwitchInAnim - - thumb_func_start WallyHandleReturnMonToBall -WallyHandleReturnMonToBall: @ 8169E44 - push {r4-r6,lr} - ldr r0, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - bne _08169E80 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl DoSpecialBattleAnimation - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8168A20 - str r0, [r1] - b _08169EB6 - .pool -_08169E80: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl WallyBufferExecCompleted -_08169EB6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleReturnMonToBall - - thumb_func_start WallyHandleDrawTrainerPic -WallyHandleDrawTrainerPic: @ 8169EC8 - push {r4-r6,lr} - ldr r4, =gActiveBank - ldrb r1, [r4] - movs r0, 0x6 - bl DecompressTrainerBackPic - ldrb r0, [r4] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x6 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - ldrb r1, [r1, 0x18] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r4] - adds r1, r6 - strb r0, [r1] - ldr r5, =gSprites - ldrb r3, [r4] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, 0x1C - adds r0, r5 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816856C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleDrawTrainerPic - - thumb_func_start WallyHandleTrainerSlide -WallyHandleTrainerSlide: @ 8169F94 - push {r4-r6,lr} - ldr r4, =gActiveBank - ldrb r1, [r4] - movs r0, 0x6 - bl DecompressTrainerBackPic - ldrb r0, [r4] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x6 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - ldrb r1, [r1, 0x18] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r4] - adds r1, r6 - strb r0, [r1] - ldr r5, =gSprites - ldrb r3, [r4] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffa0 - strh r1, [r0, 0x24] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, 0x1C - adds r0, r5 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168A90 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleTrainerSlide - - thumb_func_start WallyHandleTrainerSlideBack -WallyHandleTrainerSlideBack: @ 816A060 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleTrainerSlideBack - - thumb_func_start WallyHandleFaintAnimation -WallyHandleFaintAnimation: @ 816A06C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleFaintAnimation - - thumb_func_start WallyHandleCmd11 -WallyHandleCmd11: @ 816A078 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd11 - - thumb_func_start WallyHandleCmd12 -WallyHandleCmd12: @ 816A084 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t5 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleCmd12 - - thumb_func_start WallyHandleBallThrow -WallyHandleBallThrow: @ 816A0D8 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t5 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleBallThrow - - thumb_func_start WallyHandlePause -WallyHandlePause: @ 816A138 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandlePause - - thumb_func_start WallyHandleMoveAnimation -WallyHandleMoveAnimation: @ 816A144 - push {r4-r6,lr} - ldr r0, =gBattleBufferA - mov r12, r0 - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gTransformedPersonalities - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0816A23C - bl WallyBufferExecCompleted - b _0816A25A - .pool -_0816A23C: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_5 - str r1, [r0] -_0816A25A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleMoveAnimation - - thumb_func_start bx_move_anim_5 -bx_move_anim_5: @ 816A26C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r9, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r2, 0x2 - mov r8, r2 - add r1, r8 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0816A2F6 - cmp r2, 0x1 - bgt _0816A2BC - cmp r2, 0 - beq _0816A2C6 - b _0816A3AC - .pool -_0816A2BC: - cmp r2, 0x2 - beq _0816A320 - cmp r2, 0x3 - beq _0816A370 - b _0816A3AC -_0816A2C6: - ldr r1, [r5] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0816A2E2 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0816A2E2: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0816A3AC -_0816A2F6: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0816A3AC - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0816A3AC -_0816A320: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0816A3AC - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0816A354 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_0816A354: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0816A3AC - .pool -_0816A370: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0816A3AC - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r9 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r8 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl WallyBufferExecCompleted -_0816A3AC: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_5 - - thumb_func_start WallyHandlePrintString -WallyHandlePrintString: @ 816A3B8 - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81685A4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandlePrintString - - thumb_func_start WallyHandlePrintStringPlayerOnly -WallyHandlePrintStringPlayerOnly: @ 816A40C - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0816A428 - bl WallyHandlePrintString - b _0816A42C - .pool -_0816A428: - bl WallyBufferExecCompleted -_0816A42C: - pop {r0} - bx r0 - thumb_func_end WallyHandlePrintStringPlayerOnly - - thumb_func_start sub_816A430 -sub_816A430: @ 816A430 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0816A456 - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168444 - str r1, [r0] -_0816A456: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A430 - - thumb_func_start WallyHandleChooseAction -WallyHandleChooseAction: @ 816A470 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816A430 - str r1, [r0] - ldr r0, =gText_BattleMenu - movs r1, 0x2 - bl BattleHandleAddTextPrinter - movs r4, 0 -_0816A48A: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _0816A48A - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillWallyDo - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl BattleHandleAddTextPrinter - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleChooseAction - - thumb_func_start WallyHandleCmd19 -WallyHandleCmd19: @ 816A4D8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd19 - - thumb_func_start WallyHandleChooseMove -WallyHandleChooseMove: @ 816A4E4 - push {r4,lr} - ldr r4, =gBattleStruct - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x95 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0816A522 - cmp r0, 0x1 - bgt _0816A504 - cmp r0, 0 - beq _0816A50A - b _0816A574 - .pool -_0816A504: - cmp r0, 0x2 - beq _0816A550 - b _0816A574 -_0816A50A: - bl InitMoveSelectionsVarsAndStrings - ldr r1, [r4] - adds r1, 0x95 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x97 - movs r1, 0x50 - strb r1, [r0] - b _0816A574 -_0816A522: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0816A574 - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, [r4] - adds r1, 0x95 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0816A574 - .pool -_0816A550: - adds r1, 0x97 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _0816A574 - movs r0, 0x5 - bl PlaySE - movs r2, 0x80 - lsls r2, 1 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues - bl WallyBufferExecCompleted -_0816A574: - pop {r4} - pop {r0} - bx r0 - thumb_func_end WallyHandleChooseMove - - thumb_func_start WallyHandleOpenBag -WallyHandleOpenBag: @ 816A57C - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81685D4 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleOpenBag - - thumb_func_start WallyHandleChoosePokemon -WallyHandleChoosePokemon: @ 816A5BC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleChoosePokemon - - thumb_func_start WallyHandleCmd23 -WallyHandleCmd23: @ 816A5C8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd23 - - thumb_func_start WallyHandleHealthBarUpdate -WallyHandleHealthBarUpdate: @ 816A5D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _0816A664 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0816A69E - .pool -_0816A664: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r4, =gHealthBoxesIds - adds r1, r0, r4 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct - mov r1, r9 - ldrb r0, [r1] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0 - bl UpdateHpTextInHealthbox -_0816A69E: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168934 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleHealthBarUpdate - - thumb_func_start WallyHandleExpUpdate -WallyHandleExpUpdate: @ 816A6D4 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleExpUpdate - - thumb_func_start WallyHandleStatusIconUpdate -WallyHandleStatusIconUpdate: @ 816A6E0 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleStatusIconUpdate - - thumb_func_start WallyHandleStatusAnimation -WallyHandleStatusAnimation: @ 816A6EC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleStatusAnimation - - thumb_func_start WallyHandleStatusXor -WallyHandleStatusXor: @ 816A6F8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleStatusXor - - thumb_func_start WallyHandleDataTransfer -WallyHandleDataTransfer: @ 816A704 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleDataTransfer - - thumb_func_start WallyHandleDMA3Transfer -WallyHandleDMA3Transfer: @ 816A710 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleDMA3Transfer - - thumb_func_start WallyHandlePlayBGM -WallyHandlePlayBGM: @ 816A71C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandlePlayBGM - - thumb_func_start WallyHandleCmd32 -WallyHandleCmd32: @ 816A728 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd32 - - thumb_func_start WallyHandleCmd33 -WallyHandleCmd33: @ 816A734 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd33 - - thumb_func_start WallyHandleCmd34 -WallyHandleCmd34: @ 816A740 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd34 - - thumb_func_start WallyHandleCmd35 -WallyHandleCmd35: @ 816A74C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd35 - - thumb_func_start WallyHandleCmd36 -WallyHandleCmd36: @ 816A758 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd36 - - thumb_func_start WallyHandleCmd37 -WallyHandleCmd37: @ 816A764 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd37 - - thumb_func_start WallyHandleCmd38 -WallyHandleCmd38: @ 816A770 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd38 - - thumb_func_start WallyHandleCmd39 -WallyHandleCmd39: @ 816A77C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd39 - - thumb_func_start WallyHandleCmd40 -WallyHandleCmd40: @ 816A788 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd40 - - thumb_func_start WallyHandleHitAnimation -WallyHandleHitAnimation: @ 816A794 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0816A7C8 - bl WallyBufferExecCompleted - b _0816A7F2 - .pool -_0816A7C8: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t5 - str r1, [r0] -_0816A7F2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleHitAnimation - - thumb_func_start WallyHandleCmd42 -WallyHandleCmd42: @ 816A804 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd42 - - thumb_func_start WallyHandleEffectivenessSound -WallyHandleEffectivenessSound: @ 816A810 - push {lr} - ldr r2, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlaySE - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleEffectivenessSound - - thumb_func_start WallyHandlePlayFanfareOrBGM -WallyHandlePlayFanfareOrBGM: @ 816A840 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0816A87C - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0816A890 - .pool -_0816A87C: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0816A890: - bl WallyBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end WallyHandlePlayFanfareOrBGM - - thumb_func_start WallyHandleFaintingCry -WallyHandleFaintingCry: @ 816A89C - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - bl PlayCry1 - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleFaintingCry - - thumb_func_start WallyHandleIntroSlide -WallyHandleIntroSlide: @ 816A8D8 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleIntroSlide - - thumb_func_start WallyHandleIntroTrainerBallThrow -WallyHandleIntroTrainerBallThrow: @ 816A90C - push {r4-r7,lr} - ldr r6, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r7] - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x38] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f8 - bl AllocSpritePalette - adds r4, r0, 0 - lsls r4, 24 - ldr r0, =gTrainerBackPicPaletteTable - ldr r0, [r0, 0x30] - lsrs r4, 20 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldrb r0, [r7] - adds r0, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_816AC04 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r7] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816AA24 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0816AA24: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleIntroTrainerBallThrow - - thumb_func_start sub_816AA80 -sub_816AA80: @ 816AA80 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r6, 2 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x2] - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AA80 - - thumb_func_start sub_816AC04 -sub_816AC04: @ 816AC04 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x1E - bgt _0816AC28 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0816AC5E - .pool -_0816AC28: - ldr r4, =gActiveBank - ldrb r5, [r4] - ldrh r0, [r1, 0x8] - strb r0, [r4] - ldr r0, =gBattleBufferA - ldrb r1, [r4] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r4] - bl sub_816AA80 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816864C - str r1, [r0] - strb r5, [r4] - adds r0, r6, 0 - bl DestroyTask -_0816AC5E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AC04 - - thumb_func_start WallyHandleDrawPartyStatusSummary -WallyHandleDrawPartyStatusSummary: @ 816AC78 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0816ACA8 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0816ACA8 - bl WallyBufferExecCompleted - b _0816ACE6 - .pool -_0816ACA8: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r4, r0, 9 - ldr r3, =gBattleBufferA + 4 - adds r1, r4, r3 - subs r2, r3, 0x3 - adds r2, r4, r2 - ldrb r2, [r2] - subs r3, 0x2 - adds r4, r3 - ldrb r3, [r4] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - strb r0, [r1] - bl WallyBufferExecCompleted -_0816ACE6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleDrawPartyStatusSummary - - thumb_func_start WallyHandleCmd49 -WallyHandleCmd49: @ 816ACFC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd49 - - thumb_func_start WallyHandleCmd50 -WallyHandleCmd50: @ 816AD08 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleCmd50 - - thumb_func_start WallyHandleSpriteInvisibility -WallyHandleSpriteInvisibility: @ 816AD14 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleSpriteInvisibility - - thumb_func_start WallyHandleBattleAnimation -WallyHandleBattleAnimation: @ 816AD20 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _0816AD60 - bl WallyBufferExecCompleted - b _0816AD6C - .pool -_0816AD60: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8168AC8 - str r0, [r1] -_0816AD6C: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleBattleAnimation - - thumb_func_start WallyHandleLinkStandbyMsg -WallyHandleLinkStandbyMsg: @ 816AD7C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleLinkStandbyMsg - - thumb_func_start WallyHandleResetActionMoveSelection -WallyHandleResetActionMoveSelection: @ 816AD88 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end WallyHandleResetActionMoveSelection - - thumb_func_start WallyHandleCmd55 -WallyHandleCmd55: @ 816AD94 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl WallyBufferExecCompleted - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _0816ADD0 - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_80587B0 - str r0, [r1] -_0816ADD0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyHandleCmd55 - - thumb_func_start nullsub_118 -nullsub_118: @ 816ADF0 - bx lr - thumb_func_end nullsub_118 - - - .align 2, 0 @ Don't pad with nop. diff --git a/include/battle.h b/include/battle.h index e4f3ea77d..5bb05755b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -636,10 +636,10 @@ struct BattleStruct u8 field_91; u8 field_92; u8 field_93; - u8 field_94; - u8 field_95; - u8 field_96; - u8 field_97; + u8 wallyBattleState; + u8 wallyMovesState; + u8 wallyWaitFrames; + u8 wallyMoveFrames; u8 mirrorMoves[8]; // ask gamefreak why they declared it that way u8 field_A0; u8 field_A1; diff --git a/include/party_menu.h b/include/party_menu.h index 175aba639..c93f63a6d 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -2,5 +2,6 @@ #define GUARD_PARTY_MENU_H bool8 pokemon_has_move(struct Pokemon *, u16); +void DoWallyTutorialBagMenu(void); #endif // GUARD_PARTY_MENU_H diff --git a/ld_script.txt b/ld_script.txt index cf07574d2..6d0db8ab9 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -210,7 +210,6 @@ SECTIONS { asm/battle_tower.o(.text); asm/use_pokeblock.o(.text); src/battle_controller_wally.o(.text); - asm/battle_controller_wally.o(.text); asm/player_pc.o(.text); asm/intro.o(.text); src/reset_save_heap.o(.text); diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index ce38ca882..5e454deb5 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -4,75 +4,139 @@ #include "battle_message.h" #include "battle_interface.h" #include "battle_anim.h" +#include "battle_link_817C95C.h" +#include "pokemon.h" #include "link.h" +#include "util.h" +#include "main.h" +#include "item.h" +#include "items.h" +#include "songs.h" +#include "sound.h" +#include "moves.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "rng.h" +#include "pokeball.h" +#include "party_menu.h" +extern u32 gBattleExecBuffer; extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gAbsentBankFlags; +extern u8 gNoOfAllBanks; extern bool8 gDoingBattleAnim; extern u8 gUnknown_020244CC; extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern u8 gMultiUsePlayerCursor; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern u16 gPartnerTrainerId; +extern struct SpriteTemplate gUnknown_0202499C; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gScriptItemId; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u8 gNumberOfMovesToChoose; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern s32 gUnknown_0203CD70; +extern u8 gBankInMenu; +extern u32 gBattlePalaceMoveSelectionRngValue; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u8 gUnknown_020244B4[]; +extern u16 gUnknown_020243FC; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; + +extern const u8 gText_WhatWillWallyDo[]; +extern const u8 gText_BattleMenu[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); // this file's functions -void WallyHandleGetMonData(void); -void WallyHandleGetRawMonData(void); -void WallyHandleSetMonData(void); -void WallyHandleSetRawMonData(void); -void WallyHandleLoadMonSprite(void); -void WallyHandleSwitchInAnim(void); -void WallyHandleReturnMonToBall(void); -void WallyHandleDrawTrainerPic(void); -void WallyHandleTrainerSlide(void); -void WallyHandleTrainerSlideBack(void); -void WallyHandleFaintAnimation(void); -void WallyHandleCmd11(void); -void WallyHandleCmd12(void); -void WallyHandleBallThrow(void); -void WallyHandlePause(void); -void WallyHandleMoveAnimation(void); -void WallyHandlePrintString(void); -void WallyHandlePrintStringPlayerOnly(void); -void WallyHandleChooseAction(void); -void WallyHandleCmd19(void); -void WallyHandleChooseMove(void); -void WallyHandleOpenBag(void); -void WallyHandleChoosePokemon(void); -void WallyHandleCmd23(void); -void WallyHandleHealthBarUpdate(void); -void WallyHandleExpUpdate(void); -void WallyHandleStatusIconUpdate(void); -void WallyHandleStatusAnimation(void); -void WallyHandleStatusXor(void); -void WallyHandleDataTransfer(void); -void WallyHandleDMA3Transfer(void); -void WallyHandlePlayBGM(void); -void WallyHandleCmd32(void); -void WallyHandleCmd33(void); -void WallyHandleCmd34(void); -void WallyHandleCmd35(void); -void WallyHandleCmd36(void); -void WallyHandleCmd37(void); -void WallyHandleCmd38(void); -void WallyHandleCmd39(void); -void WallyHandleCmd40(void); -void WallyHandleHitAnimation(void); -void WallyHandleCmd42(void); -void WallyHandleEffectivenessSound(void); -void WallyHandlePlayFanfareOrBGM(void); -void WallyHandleFaintingCry(void); -void WallyHandleIntroSlide(void); -void WallyHandleIntroTrainerBallThrow(void); -void WallyHandleDrawPartyStatusSummary(void); -void WallyHandleCmd49(void); -void WallyHandleCmd50(void); -void WallyHandleSpriteInvisibility(void); -void WallyHandleBattleAnimation(void); -void WallyHandleLinkStandbyMsg(void); -void WallyHandleResetActionMoveSelection(void); -void WallyHandleCmd55(void); -void nullsub_118(void); +static void WallyHandleGetMonData(void); +static void WallyHandleGetRawMonData(void); +static void WallyHandleSetMonData(void); +static void WallyHandleSetRawMonData(void); +static void WallyHandleLoadMonSprite(void); +static void WallyHandleSwitchInAnim(void); +static void WallyHandleReturnMonToBall(void); +static void WallyHandleDrawTrainerPic(void); +static void WallyHandleTrainerSlide(void); +static void WallyHandleTrainerSlideBack(void); +static void WallyHandleFaintAnimation(void); +static void WallyHandlePaletteFade(void); +static void WallyHandleSuccessBallThrowAnim(void); +static void WallyHandleBallThrowAnim(void); +static void WallyHandlePause(void); +static void WallyHandleMoveAnimation(void); +static void WallyHandlePrintString(void); +static void WallyHandlePrintStringPlayerOnly(void); +static void WallyHandleChooseAction(void); +static void WallyHandleUnknownYesNoBox(void); +static void WallyHandleChooseMove(void); +static void WallyHandleChooseItem(void); +static void WallyHandleChoosePokemon(void); +static void WallyHandleCmd23(void); +static void WallyHandleHealthBarUpdate(void); +static void WallyHandleExpUpdate(void); +static void WallyHandleStatusIconUpdate(void); +static void WallyHandleStatusAnimation(void); +static void WallyHandleStatusXor(void); +static void WallyHandleDataTransfer(void); +static void WallyHandleDMA3Transfer(void); +static void WallyHandlePlayBGM(void); +static void WallyHandleCmd32(void); +static void WallyHandleTwoReturnValues(void); +static void WallyHandleChosenMonReturnValue(void); +static void WallyHandleOneReturnValue(void); +static void WallyHandleOneReturnValue_Duplicate(void); +static void WallyHandleCmd37(void); +static void WallyHandleCmd38(void); +static void WallyHandleCmd39(void); +static void WallyHandleCmd40(void); +static void WallyHandleHitAnimation(void); +static void WallyHandleCmd42(void); +static void WallyHandleEffectivenessSound(void); +static void WallyHandlePlayFanfareOrBGM(void); +static void WallyHandleFaintingCry(void); +static void WallyHandleIntroSlide(void); +static void WallyHandleIntroTrainerBallThrow(void); +static void WallyHandleDrawPartyStatusSummary(void); +static void WallyHandleCmd49(void); +static void WallyHandleCmd50(void); +static void WallyHandleSpriteInvisibility(void); +static void WallyHandleBattleAnimation(void); +static void WallyHandleLinkStandbyMsg(void); +static void WallyHandleResetActionMoveSelection(void); +static void WallyHandleCmd55(void); +static void nullsub_118(void); -void WallyBufferRunCommand(void); +static void WallyBufferRunCommand(void); +static void WallyBufferExecCompleted(void); +static void CompleteOnChosenItem(void); +static void sub_8168818(void); +static u32 CopyWallyMonData(u8 monId, u8 *dst); +static void SetWallyMonData(u8 monId); +static void WallyDoMoveAnimation(void); +static void sub_816AC04(u8 taskId); -void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const sWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { WallyHandleGetMonData, WallyHandleGetRawMonData, @@ -85,17 +149,17 @@ void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = WallyHandleTrainerSlide, WallyHandleTrainerSlideBack, WallyHandleFaintAnimation, - WallyHandleCmd11, - WallyHandleCmd12, - WallyHandleBallThrow, + WallyHandlePaletteFade, + WallyHandleSuccessBallThrowAnim, + WallyHandleBallThrowAnim, WallyHandlePause, WallyHandleMoveAnimation, WallyHandlePrintString, WallyHandlePrintStringPlayerOnly, WallyHandleChooseAction, - WallyHandleCmd19, + WallyHandleUnknownYesNoBox, WallyHandleChooseMove, - WallyHandleOpenBag, + WallyHandleChooseItem, WallyHandleChoosePokemon, WallyHandleCmd23, WallyHandleHealthBarUpdate, @@ -107,10 +171,10 @@ void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = WallyHandleDMA3Transfer, WallyHandlePlayBGM, WallyHandleCmd32, - WallyHandleCmd33, - WallyHandleCmd34, - WallyHandleCmd35, - WallyHandleCmd36, + WallyHandleTwoReturnValues, + WallyHandleChosenMonReturnValue, + WallyHandleOneReturnValue, + WallyHandleOneReturnValue_Duplicate, WallyHandleCmd37, WallyHandleCmd38, WallyHandleCmd39, @@ -133,15 +197,1411 @@ void (*const gWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) = nullsub_118 }; -void nullsub_117(void) +static void nullsub_117(void) { } void SetBankFuncToWallyBufferRunCommand(void) { gBattleBankFunc[gActiveBank] = WallyBufferRunCommand; - gBattleStruct->field_94 = 0; - gBattleStruct->field_95 = 0; - gBattleStruct->field_96 = 0; - gBattleStruct->field_97 = 0; + gBattleStruct->wallyBattleState = 0; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 0; + gBattleStruct->wallyMoveFrames = 0; +} + +static void WallyBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sWallyBufferCommands)) + sWallyBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + WallyBufferExecCompleted(); + } +} + +static void WallyHandleActions(void) +{ + switch (gBattleStruct->wallyBattleState) + { + case 0: + gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyBattleState++; + case 1: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 2: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 3: + if (--gBattleStruct->wallyWaitFrames == 0) + { + EmitTwoReturnValues(1, 9, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 4: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(0); + ActionSelectionCreateCursorAt(1, 0); + gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyBattleState++; + } + break; + case 5: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + WallyBufferExecCompleted(); + } + break; + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + WallyBufferExecCompleted(); +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + WallyBufferExecCompleted(); +} + +static void CompleteOnFinishedAnimation(void) +{ + if (!gDoingBattleAnim) + WallyBufferExecCompleted(); +} + +static void OpenBagAfterPaletteFade(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = CompleteOnChosenItem; + nullsub_35(); + FreeAllWindowBuffers(); + DoWallyTutorialBagMenu(); + } +} + +static void CompleteOnChosenItem(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitOneReturnValue(1, gScriptItemId); + WallyBufferExecCompleted(); + } +} + +static void sub_816864C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleBankFunc[gActiveBank] = sub_8168818; + } + +} + +static void sub_8168818(void) +{ + bool32 r4 = FALSE; + + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r4 = TRUE; + + if (r4 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + + WallyBufferExecCompleted(); + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + WallyBufferExecCompleted(); + } +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + WallyBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_8168A20(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + WallyBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + WallyBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + WallyBufferExecCompleted(); +} + +static void WallyBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = WallyBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + WallyBufferExecCompleted(); +} + +static void WallyHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyWallyMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyWallyMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + WallyBufferExecCompleted(); +} + +static u32 CopyWallyMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void WallyHandleGetRawMonData(void) +{ + PlayerHandleGetRawMonData(); +} + +static void WallyHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetWallyMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetWallyMonData(i); + monsToCheck >>= 1; + } + } + WallyBufferExecCompleted(); +} + +static void SetWallyMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void WallyHandleSetRawMonData(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleLoadMonSprite(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSwitchInAnim(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + gBattleBankFunc[gActiveBank] = sub_8168A20; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + WallyBufferExecCompleted(); + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; + +static void WallyHandleDrawTrainerPic(void) +{ + DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); + sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + 80, + 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void WallyHandleTrainerSlide(void) +{ + DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); + sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + 80, + 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -96; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; +} + +static void WallyHandleTrainerSlideBack(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleFaintAnimation(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandlePaletteFade(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSuccessBallThrowAnim(void) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; +} + +static void WallyHandleBallThrowAnim(void) +{ + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; +} + +static void WallyHandlePause(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + WallyBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = WallyDoMoveAnimation; + } + +} + +static void WallyDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + WallyBufferExecCompleted(); + } + break; + } +} + +static void WallyHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void WallyHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + WallyHandlePrintString(); + else + WallyBufferExecCompleted(); +} + +static void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = WallyHandleActions; + } +} + +static void WallyHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + BattleHandleAddTextPrinter(gText_BattleMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillWallyDo); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +static void WallyHandleUnknownYesNoBox(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleChooseMove(void) +{ + switch (gBattleStruct->wallyMovesState) + { + case 0: + InitMoveSelectionsVarsAndStrings(); + gBattleStruct->wallyMovesState++; + gBattleStruct->wallyMoveFrames = 80; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0x140; + gBattleStruct->wallyMovesState++; + } + break; + case 2: + if (--gBattleStruct->wallyMoveFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, 10, 0x100); + WallyBufferExecCompleted(); + } + break; + } +} + +static void WallyHandleChooseItem(void) +{ + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = OpenBagAfterPaletteFade; + gBankInMenu = gActiveBank; +} + +static void WallyHandleChoosePokemon(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd23(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void WallyHandleExpUpdate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusIconUpdate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusAnimation(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusXor(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleDataTransfer(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleDMA3Transfer(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandlePlayBGM(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd32(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleTwoReturnValues(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleChosenMonReturnValue(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleOneReturnValue(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleOneReturnValue_Duplicate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd37(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd38(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd39(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd40(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + WallyBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void WallyHandleCmd42(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleEffectivenessSound(void) +{ + PlaySE(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + WallyBufferExecCompleted(); +} + +static void WallyHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + WallyBufferExecCompleted(); +} + +static void WallyHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry1(species, 25); + WallyBufferExecCompleted(); +} + +static void WallyHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + WallyBufferExecCompleted(); +} + +static void WallyHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F8); + LoadCompressedPalette(gTrainerBackPicPaletteTable[BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_816AC04, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_21; +} + +static void sub_816AA80(u8 bank) +{ + u16 species; + + gBattleSpritesDataPtr->bankData[bank].transformSpecies = 0; + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void sub_816AC04(u8 taskId) +{ + if (gTasks[taskId].data[1] < 31) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_816AA80(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_816864C; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void WallyHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + WallyBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + WallyBufferExecCompleted(); + } +} + +static void WallyHandleCmd49(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd50(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSpriteInvisibility(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleBattleAnimation(void) +{ + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + WallyBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; +} + +static void WallyHandleLinkStandbyMsg(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleResetActionMoveSelection(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + WallyBufferExecCompleted(); + + if (!(gBattleTypeFlags & BATTLE_TYPE_WILD) && gBattleTypeFlags & BATTLE_TYPE_LINK) + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_118(void) +{ }