From 918625196ed5e91999f1a244a8881fb9f8069c64 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 23 Oct 2017 13:32:11 +0200 Subject: [PATCH] recorded player controller is done --- asm/battle_controller_recorded_opponent.s | 8 +- asm/battle_controller_recorded_player.s | 6090 --------------------- asm/recorded_battle.s | 10 +- include/recorded_battle.h | 2 + ld_script.txt | 1 - src/battle_controller_player.c | 2 +- src/battle_controller_player_partner.c | 2 +- src/battle_controller_recorded_player.c | 1776 +++++- 8 files changed, 1726 insertions(+), 6165 deletions(-) delete mode 100644 asm/battle_controller_recorded_player.s diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index 695c179e5..2a98967c4 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -4748,7 +4748,7 @@ sub_8188EF0: @ 8188EF0 push {lr} ldr r0, =gActiveBank ldrb r0, [r0] - bl sub_8185054 + bl RecordedBattle_ReadBankAction adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -4791,12 +4791,12 @@ sub_8188F20: @ 8188F20 _08188F48: ldr r5, =gActiveBank ldrb r0, [r5] - bl sub_8185054 + bl RecordedBattle_ReadBankAction adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldrb r0, [r5] - bl sub_8185054 + bl RecordedBattle_ReadBankAction adds r2, r0, 0 lsls r2, 24 lsrs r2, 16 @@ -4825,7 +4825,7 @@ sub_8188F88: @ 8188F88 push {r4,lr} ldr r4, =gActiveBank ldrb r0, [r4] - bl sub_8185054 + bl RecordedBattle_ReadBankAction ldrb r1, [r4] ldr r3, =gBattleStruct ldr r2, [r3] diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s deleted file mode 100644 index 03a6ff0e7..000000000 --- a/asm/battle_controller_recorded_player.s +++ /dev/null @@ -1,6090 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81899B8 -sub_81899B8: @ 81899B8 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081899DC - bl RecordedPlayerBufferExecCompleted -_081899DC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81899B8 - - thumb_func_start sub_81899F0 -sub_81899F0: @ 81899F0 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08189A40 - movs r0, 0 - bl nullsub_25 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - bl RecordedPlayerBufferExecCompleted -_08189A40: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81899F0 - - thumb_func_start sub_8189A58 -sub_8189A58: @ 8189A58 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _08189A90 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl RecordedPlayerBufferExecCompleted -_08189A90: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189A58 - - thumb_func_start sub_8189AA0 -sub_8189AA0: @ 8189AA0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r6, 0 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankIdentity - lsls r0, 24 - cmp r0, 0 - beq _08189ABA - b _08189C60 -_08189ABA: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189ADA - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189B0C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08189B0C -_08189ADA: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08189B42 - b _08189B48 - .pool -_08189B0C: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _08189B42 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08189B42 - movs r6, 0x1 -_08189B42: - cmp r6, 0 - bne _08189B48 - b _08189D18 -_08189B48: - ldr r0, =gBattleSpritesDataPtr - mov r9, r0 - ldr r0, [r0] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4, 0x1] - movs r6, 0x1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189B6A - b _08189D18 -_08189B6A: - movs r1, 0x2 - mov r8, r1 - mov r1, r8 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189B86 - b _08189D18 -_08189B86: - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r9 - ldr r0, [r1] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - mov r0, r9 - ldr r2, [r0] - ldrb r0, [r5] - mov r1, r8 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - mov r1, r9 - ldr r2, [r1] - ldrb r0, [r5] - mov r1, r8 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r7, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r4, =gPlayerParty - adds r0, r4 - bl sub_805E990 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189C22 - ldrb r0, [r5] - mov r1, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - muls r0, r6 - adds r0, r4 - bl sub_805E990 -_08189C22: - mov r1, r9 - ldr r0, [r1] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - b _08189D10 - .pool -_08189C60: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189C80 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189CB0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08189CB0 -_08189C80: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08189CE6 - b _08189CE4 - .pool -_08189CB0: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _08189CE6 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08189CE6 -_08189CE4: - movs r6, 0x1 -_08189CE6: - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - beq _08189CF2 - movs r6, 0 -_08189CF2: - cmp r6, 0 - beq _08189D18 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r3] -_08189D10: - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8189A58 - str r1, [r0] -_08189D18: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189AA0 - - thumb_func_start sub_8189D40 -sub_8189D40: @ 8189D40 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankIdentity - lsls r0, 24 - cmp r0, 0 - bne _08189DBE - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r6, 0x88 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189D8C - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08189D8C: - ldr r2, [r5] - ldrb r1, [r4] - movs r0, 0x2 - adds r3, r0, 0 - eors r3, r1 - ldr r1, [r2, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08189DBE - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_08189DBE: - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, =gActiveBank - ldrb r5, [r2] - ldr r4, [r0, 0x4] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r6, r0, r4 - ldrb r1, [r6] - movs r0, 0x8 - mov r12, r0 - ands r0, r1 - mov r9, r2 - mov r8, r3 - cmp r0, 0 - bne _08189EA2 - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r5 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0] - mov r0, r12 - ands r0, r1 - cmp r0, 0 - bne _08189EA2 - ldrb r1, [r6, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08189E84 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189E54 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08189E54 - ldr r4, =gHealthBoxesIds - mov r1, r9 - ldrb r0, [r1] - adds r1, r7, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - bl sub_8076918 - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08189E54: - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08189E84: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x1] - mov r9, r3 - mov r8, r4 -_08189EA2: - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - bne _08189F62 - movs r1, 0x2 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08189F62 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08189F62 - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08189F44 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08189F38 - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - cmp r0, 0 - bne _08189F44 - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _08189F44 - .pool -_08189F38: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_08189F44: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x20 - orrs r1, r2 - strb r1, [r0, 0x1] - movs r0, 0x1 - mov r10, r0 -_08189F62: - mov r1, r10 - cmp r1, 0 - beq _0818A02A - ldr r7, =gSprites - ldr r6, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r7, 0 - adds r4, 0x1C - adds r0, r4 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - cmp r2, r0 - bne _0818A02A - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r2 - bne _0818A02A - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189FC8 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08189FC8 - ldrb r1, [r5] - movs r0, 0x2 - eors r0, r1 - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - bl DestroySprite -_08189FC8: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8189AA0 - str r1, [r0] -_0818A02A: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189D40 - - thumb_func_start sub_818A064 -sub_818A064: @ 818A064 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _0818A092 - movs r2, 0x24 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _0818A092 - bl RecordedPlayerBufferExecCompleted -_0818A092: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A064 - - thumb_func_start sub_818A0A4 -sub_818A0A4: @ 818A0A4 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r6, =gHealthBoxesIds - adds r1, r0, r6 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0818A0EC - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _0818A106 - .pool -_0818A0EC: - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl RecordedPlayerBufferExecCompleted -_0818A106: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A0A4 - - thumb_func_start sub_818A114 -sub_818A114: @ 818A114 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r2, [r4] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r3, 0x22 - ldrsh r1, [r0, r3] - movs r3, 0x26 - ldrsh r0, [r0, r3] - adds r1, r0 - cmp r1, 0xA0 - ble _0818A190 - ldr r1, =gBattlePartyID - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl nullsub_24 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedPlayerBufferExecCompleted -_0818A190: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A114 - - thumb_func_start sub_818A1B0 -sub_818A1B0: @ 818A1B0 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0818A204 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedPlayerBufferExecCompleted -_0818A204: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A1B0 - - thumb_func_start sub_818A220 -sub_818A220: @ 818A220 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0818A232 - bl RecordedPlayerBufferExecCompleted -_0818A232: - pop {r0} - bx r0 - thumb_func_end sub_818A220 - - thumb_func_start sub_818A238 -sub_818A238: @ 818A238 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _0818A284 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl RecordedPlayerBufferExecCompleted - b _0818A2AE - .pool -_0818A284: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0818A2A8 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_0818A2A8: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_0818A2AE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_818A238 - - thumb_func_start sub_818A2B4 -sub_818A2B4: @ 818A2B4 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0818A306 - adds r0, r3, 0 - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r2, [r4] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0818A2FA - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation -_0818A2FA: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818A328 - str r0, [r1] -_0818A306: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A2B4 - - thumb_func_start sub_818A328 -sub_818A328: @ 818A328 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0818A364 - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0818A364 - bl RecordedPlayerBufferExecCompleted -_0818A364: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A328 - - thumb_func_start sub_818A37C -sub_818A37C: @ 818A37C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r7, =gActiveBank - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0818A438 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r0, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r0, =gBattlePartyID - mov r8, r0 - ldrb r1, [r7] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - bl sub_805E990 - ldr r1, =gBankSpriteIds - ldrb r0, [r7] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - lsls r1, 1 - add r1, r8 - ldrh r1, [r1] - muls r1, r6 - adds r1, r5 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - bl sub_8076918 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A2B4 - str r1, [r0] -_0818A438: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A37C - - thumb_func_start sub_818A470 -sub_818A470: @ 818A470 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _0818A4A2 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0818A4A2: - ldr r5, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r4] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0818A4E8 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _0818A4E8 - adds r0, r3, r5 - bl DestroySprite - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A37C - str r1, [r0] -_0818A4E8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A470 - - thumb_func_start RecordedPlayerBufferExecCompleted -RecordedPlayerBufferExecCompleted: @ 818A514 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedPlayerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0818A568 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _0818A57A - .pool -_0818A568: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_0818A57A: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerBufferExecCompleted - - thumb_func_start sub_818A58C -sub_818A58C: @ 818A58C - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0818A5AE - bl RecordedPlayerBufferExecCompleted -_0818A5AE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A58C - - thumb_func_start sub_818A5BC -sub_818A5BC: @ 818A5BC - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0818A5DE - bl RecordedPlayerBufferExecCompleted -_0818A5DE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818A5BC - - thumb_func_start RecordedPlayerHandleGetMonData -RecordedPlayerHandleGetMonData: @ 818A5EC - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0818A624 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_818A660 - adds r6, r0, 0 - b _0818A646 - .pool -_0818A624: - ldrb r4, [r1] - movs r5, 0 -_0818A628: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0818A63E - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_818A660 - adds r6, r0 -_0818A63E: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0818A628 -_0818A646: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl RecordedPlayerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleGetMonData - - thumb_func_start sub_818A660 -sub_818A660: @ 818A660 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0818A68A - bl _0818ADF6 -_0818A68A: - lsls r0, 2 - ldr r1, =_0818A6A0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0818A6A0: - .4byte _0818A790 - .4byte _0818A9B4 - .4byte _0818A9C4 - .4byte _0818A9D4 - .4byte _0818AA3C - .4byte _0818AA3C - .4byte _0818AA3C - .4byte _0818AA3C - .4byte _0818AA58 - .4byte _0818AA94 - .4byte _0818AA94 - .4byte _0818AA94 - .4byte _0818AA94 - .4byte _0818ADF6 - .4byte _0818ADF6 - .4byte _0818ADF6 - .4byte _0818ADF6 - .4byte _0818AAB0 - .4byte _0818AAC0 - .4byte _0818AAF0 - .4byte _0818AB00 - .4byte _0818AB10 - .4byte _0818AB20 - .4byte _0818AB30 - .4byte _0818AB40 - .4byte _0818AB50 - .4byte _0818AB60 - .4byte _0818AB70 - .4byte _0818AB80 - .4byte _0818AB90 - .4byte _0818ABA0 - .4byte _0818ABB0 - .4byte _0818AC00 - .4byte _0818AC10 - .4byte _0818AC20 - .4byte _0818AC30 - .4byte _0818AC40 - .4byte _0818AC50 - .4byte _0818AC60 - .4byte _0818AC70 - .4byte _0818AC80 - .4byte _0818ACB4 - .4byte _0818ACC4 - .4byte _0818ACD4 - .4byte _0818ACE4 - .4byte _0818ACF4 - .4byte _0818AD04 - .4byte _0818AD14 - .4byte _0818AD24 - .4byte _0818AD44 - .4byte _0818AD54 - .4byte _0818AD64 - .4byte _0818AD74 - .4byte _0818AD84 - .4byte _0818AD94 - .4byte _0818ADA4 - .4byte _0818ADB4 - .4byte _0818ADC4 - .4byte _0818ADD4 - .4byte _0818ADE4 -_0818A790: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_0818A7DC: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _0818A7DC - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_0818A994: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _0818A994 - b _0818ADF6 - .pool -_0818A9B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _0818AD2E - .pool -_0818A9C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _0818AD2E - .pool -_0818A9D4: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_0818A9EA: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0818A9EA - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0818AA28: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0818AA28 - b _0818ADF6 - .pool -_0818AA3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _0818AD2E - .pool -_0818AA58: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_0818AA64: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0818AA64 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0818ADF6 - .pool -_0818AA94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _0818ADEE - .pool -_0818AAB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0818AACA - .pool -_0818AAC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0818AACA: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0818ADF6 - .pool -_0818AAF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _0818ADEE - .pool -_0818AB00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _0818ADEE - .pool -_0818AB10: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _0818ADEE - .pool -_0818AB20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _0818ADEE - .pool -_0818AB30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _0818ADEE - .pool -_0818AB40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _0818ADEE - .pool -_0818AB50: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _0818ADEE - .pool -_0818AB60: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _0818ADEE - .pool -_0818AB70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _0818ADEE - .pool -_0818AB80: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _0818ADEE - .pool -_0818AB90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _0818ADEE - .pool -_0818ABA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _0818ADEE - .pool -_0818ABB0: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0818ADF6 - .pool -_0818AC00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _0818ADEE - .pool -_0818AC10: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _0818ADEE - .pool -_0818AC20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _0818ADEE - .pool -_0818AC30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _0818ADEE - .pool -_0818AC40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _0818ADEE - .pool -_0818AC50: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _0818ADEE - .pool -_0818AC60: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0818AC8A - .pool -_0818AC70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _0818AD2E - .pool -_0818AC80: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0818AC8A: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0818ADF6 - .pool -_0818ACB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _0818ADEE - .pool -_0818ACC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _0818AD2E - .pool -_0818ACD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _0818AD2E - .pool -_0818ACE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _0818AD2E - .pool -_0818ACF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _0818AD2E - .pool -_0818AD04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _0818AD2E - .pool -_0818AD14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _0818AD2E - .pool -_0818AD24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_0818AD2E: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0818ADF6 - .pool -_0818AD44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _0818ADEE - .pool -_0818AD54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _0818ADEE - .pool -_0818AD64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _0818ADEE - .pool -_0818AD74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _0818ADEE - .pool -_0818AD84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _0818ADEE - .pool -_0818AD94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _0818ADEE - .pool -_0818ADA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _0818ADEE - .pool -_0818ADB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _0818ADEE - .pool -_0818ADC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _0818ADEE - .pool -_0818ADD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _0818ADEE - .pool -_0818ADE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_0818ADEE: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0818ADF6: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_818A660 - - thumb_func_start RecordedPlayerHandleGetRawMonData -RecordedPlayerHandleGetRawMonData: @ 818AE0C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleGetRawMonData - - thumb_func_start RecordedPlayerHandleSetMonData -RecordedPlayerHandleSetMonData: @ 818AE18 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0818AE48 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_818AE70 - b _0818AE66 - .pool -_0818AE48: - ldrb r4, [r1] - movs r5, 0 -_0818AE4C: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0818AE5A - adds r0, r5, 0 - bl sub_818AE70 -_0818AE5A: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0818AE4C -_0818AE66: - bl RecordedPlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleSetMonData - - thumb_func_start sub_818AE70 -sub_818AE70: @ 818AE70 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _0818AE9C - bl _0818B836 -_0818AE9C: - lsls r0, 2 - ldr r1, =_0818AEB4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0818AEB4: - .4byte _0818AFA4 - .4byte _0818B13C - .4byte _0818B15C - .4byte _0818B17C - .4byte _0818B1D4 - .4byte _0818B1D4 - .4byte _0818B1D4 - .4byte _0818B1D4 - .4byte _0818B1FC - .4byte _0818B260 - .4byte _0818B260 - .4byte _0818B260 - .4byte _0818B260 - .4byte _0818B836 - .4byte _0818B836 - .4byte _0818B836 - .4byte _0818B836 - .4byte _0818B290 - .4byte _0818B2B0 - .4byte _0818B2D0 - .4byte _0818B2F0 - .4byte _0818B310 - .4byte _0818B330 - .4byte _0818B350 - .4byte _0818B370 - .4byte _0818B390 - .4byte _0818B3B0 - .4byte _0818B3D0 - .4byte _0818B3F0 - .4byte _0818B410 - .4byte _0818B430 - .4byte _0818B450 - .4byte _0818B4C0 - .4byte _0818B4E0 - .4byte _0818B500 - .4byte _0818B520 - .4byte _0818B540 - .4byte _0818B560 - .4byte _0818B580 - .4byte _0818B5A0 - .4byte _0818B5C0 - .4byte _0818B5E0 - .4byte _0818B600 - .4byte _0818B620 - .4byte _0818B640 - .4byte _0818B660 - .4byte _0818B680 - .4byte _0818B6A0 - .4byte _0818B6C0 - .4byte _0818B6E0 - .4byte _0818B700 - .4byte _0818B720 - .4byte _0818B740 - .4byte _0818B760 - .4byte _0818B780 - .4byte _0818B7A0 - .4byte _0818B7C0 - .4byte _0818B7E0 - .4byte _0818B800 - .4byte _0818B820 -_0818AFA4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_0818B00A: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0818B00A - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0818B836 - .pool -_0818B13C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _0818B836 - .pool -_0818B15C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _0818B836 - .pool -_0818B17C: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0818B196: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0818B196 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0818B836 - .pool -_0818B1D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0818B278 - .pool -_0818B1FC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0818B836 - .pool -_0818B260: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0818B278: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0818B836 - .pool -_0818B290: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _0818B836 - .pool -_0818B2B0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _0818B836 - .pool -_0818B2D0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _0818B836 - .pool -_0818B2F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _0818B836 - .pool -_0818B310: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _0818B836 - .pool -_0818B330: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _0818B836 - .pool -_0818B350: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _0818B836 - .pool -_0818B370: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _0818B836 - .pool -_0818B390: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _0818B836 - .pool -_0818B3B0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _0818B836 - .pool -_0818B3D0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _0818B836 - .pool -_0818B3F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _0818B836 - .pool -_0818B410: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _0818B836 - .pool -_0818B430: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _0818B836 - .pool -_0818B450: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _0818B570 - .pool -_0818B4C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _0818B836 - .pool -_0818B4E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _0818B836 - .pool -_0818B500: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _0818B836 - .pool -_0818B520: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _0818B836 - .pool -_0818B540: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _0818B836 - .pool -_0818B560: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_0818B570: - movs r1, 0x2C - bl SetMonData - b _0818B836 - .pool -_0818B580: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _0818B836 - .pool -_0818B5A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _0818B836 - .pool -_0818B5C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _0818B836 - .pool -_0818B5E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _0818B836 - .pool -_0818B600: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _0818B836 - .pool -_0818B620: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _0818B836 - .pool -_0818B640: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _0818B836 - .pool -_0818B660: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _0818B836 - .pool -_0818B680: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _0818B836 - .pool -_0818B6A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _0818B836 - .pool -_0818B6C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _0818B836 - .pool -_0818B6E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _0818B836 - .pool -_0818B700: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _0818B836 - .pool -_0818B720: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _0818B836 - .pool -_0818B740: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _0818B836 - .pool -_0818B760: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _0818B836 - .pool -_0818B780: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _0818B836 - .pool -_0818B7A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _0818B836 - .pool -_0818B7C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _0818B836 - .pool -_0818B7E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _0818B836 - .pool -_0818B800: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _0818B836 - .pool -_0818B820: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_0818B836: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818AE70 - - thumb_func_start RecordedPlayerHandleSetRawMonData -RecordedPlayerHandleSetRawMonData: @ 818B86C - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _0818B8C4 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_0818B8A2: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _0818B8A2 -_0818B8C4: - bl RecordedPlayerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleSetRawMonData - - thumb_func_start RecordedPlayerHandleLoadMonSprite -RecordedPlayerHandleLoadMonSprite: @ 818B8E0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A064 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleLoadMonSprite - - thumb_func_start RecordedPlayerHandleSwitchInAnim -RecordedPlayerHandleSwitchInAnim: @ 818B9FC - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl ClearTemporarySpeciesSpriteData - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - strh r0, [r1] - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_818BA6C - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A470 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleSwitchInAnim - - thumb_func_start sub_818BA6C -sub_818BA6C: @ 818BA6C - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl ClearTemporarySpeciesSpriteData - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818BA6C - - thumb_func_start RecordedPlayerHandleReturnMonToBall -RecordedPlayerHandleReturnMonToBall: @ 818BBE8 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0818BC30 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818BC78 - str r1, [r0] - b _0818BC66 - .pool -_0818BC30: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedPlayerBufferExecCompleted -_0818BC66: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleReturnMonToBall - - thumb_func_start sub_818BC78 -sub_818BC78: @ 818BC78 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0818BCA0 - cmp r0, 0x1 - beq _0818BCCE - b _0818BCF6 - .pool -_0818BCA0: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0818BCBA - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0818BCBA: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0818BCF6 -_0818BCCE: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0818BCF6 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl DoSpecialBattleAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A1B0 - str r1, [r0] -_0818BCF6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818BC78 - - thumb_func_start RecordedPlayerHandleDrawTrainerPic -RecordedPlayerHandleDrawTrainerPic: @ 818BD04 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 18 - ands r0, r1 - cmp r0, 0 - beq _0818BD48 - movs r0, 0x40 - ands r1, r0 - cmp r1, 0 - beq _0818BD30 - bl sub_8185F40 - lsls r0, 24 - lsrs r4, r0, 24 - b _0818BD4C - .pool -_0818BD30: - ldr r2, =gLinkPlayers - ldr r0, =gUnknown_0203C7B4 - ldrb r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - b _0818BD4A - .pool -_0818BD48: - ldr r0, =gLinkPlayers -_0818BD4A: - ldrb r4, [r0, 0x13] -_0818BD4C: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0x40 - ands r1, r2 - adds r5, r0, 0 - cmp r1, 0 - beq _0818BD98 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r0, 0x20 - mov r9, r0 - cmp r1, 0 - beq _0818BD72 - movs r1, 0x5A - mov r9, r1 -_0818BD72: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _0818BD9C - movs r0, 0x5A - mov r9, r0 - ldr r1, =gTrainerFrontPicCoords - b _0818BD9E - .pool -_0818BD98: - movs r0, 0x50 - mov r9, r0 -_0818BD9C: - ldr r1, =gTrainerBackPicCoords -_0818BD9E: - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - bne _0818BDC0 - b _0818BEDC -_0818BDC0: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bl PlayerGenderToFrontTrainerPicId - lsls r0, 16 - lsrs r4, r0, 16 - adds r5, r4, 0 - ldr r6, =gActiveBank - ldrb r1, [r6] - adds r0, r5, 0 - bl DecompressTrainerFrontPic - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_806A1C0 - ldr r0, =gUnknown_0202499C - mov r8, r0 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r0, =gTrainerFrontPicPaletteTable - lsls r5, 3 - adds r5, r0 - ldrh r0, [r5, 0x4] - bl IndexOfSpritePaletteTag - ldr r5, =gSprites - ldrb r1, [r6] - adds r1, r4 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x30 - strh r1, [r0, 0x26] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_805D7AC - str r1, [r0] - ldrb r0, [r6] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - b _0818BF72 - .pool -_0818BEDC: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl DecompressTrainerBackPic - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r9 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] -_0818BF72: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81899B8 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleDrawTrainerPic - - thumb_func_start RecordedPlayerHandleTrainerSlide -RecordedPlayerHandleTrainerSlide: @ 818BFAC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleTrainerSlide - - thumb_func_start RecordedPlayerHandleTrainerSlideBack -RecordedPlayerHandleTrainerSlideBack: @ 818BFB8 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81899F0 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleTrainerSlideBack - - thumb_func_start RecordedPlayerHandleFaintAnimation -RecordedPlayerHandleFaintAnimation: @ 818C064 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _0818C0B8 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0818C098 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0818C098: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _0818C12E - .pool -_0818C0B8: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0818C12E - strb r4, [r3, 0x4] - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A114 - str r1, [r0] -_0818C12E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleFaintAnimation - - thumb_func_start RecordedPlayerHandlePaletteFade -RecordedPlayerHandlePaletteFade: @ 818C150 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePaletteFade - - thumb_func_start RecordedPlayerHandleSuccessBallThrowAnim -RecordedPlayerHandleSuccessBallThrowAnim: @ 818C15C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleSuccessBallThrowAnim - - thumb_func_start RecordedPlayerHandleBallThrowAnim -RecordedPlayerHandleBallThrowAnim: @ 818C168 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleBallThrowAnim - - thumb_func_start RecordedPlayerHandlePause -RecordedPlayerHandlePause: @ 818C174 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePause - - thumb_func_start RecordedPlayerHandleMoveAnimation -RecordedPlayerHandleMoveAnimation: @ 818C180 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _0818C192 - b _0818C2A6 -_0818C192: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gTransformedPersonalities - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl IsMoveWithoutAnimation - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0818C288 - bl RecordedPlayerBufferExecCompleted - b _0818C2A6 - .pool -_0818C288: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_2 - str r1, [r0] -_0818C2A6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleMoveAnimation - - thumb_func_start bx_move_anim_2 -bx_move_anim_2: @ 818C2B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0818C350 - cmp r2, 0x1 - bgt _0818C310 - cmp r2, 0 - beq _0818C31A - b _0818C42C - .pool -_0818C310: - cmp r2, 0x2 - beq _0818C37A - cmp r2, 0x3 - beq _0818C3F0 - b _0818C42C -_0818C31A: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _0818C33C - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl DoSpecialBattleAnimation -_0818C33C: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0818C42C -_0818C350: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0818C42C - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0818C42C -_0818C37A: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0818C42C - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0818C3C8 - mov r0, r8 - cmp r0, 0x1 - bhi _0818C3C8 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl DoSpecialBattleAnimation - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0818C3C8: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0818C42C - .pool -_0818C3F0: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0818C42C - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl TrySetBehindSubstituteSpriteBit - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl RecordedPlayerBufferExecCompleted -_0818C42C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_2 - - thumb_func_start RecordedPlayerHandlePrintString -RecordedPlayerHandlePrintString: @ 818C43C - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl BattleHandleAddTextPrinter - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A220 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandlePrintString - - thumb_func_start RecordedPlayerHandlePrintStringPlayerOnly -RecordedPlayerHandlePrintStringPlayerOnly: @ 818C490 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePrintStringPlayerOnly - - thumb_func_start sub_818C49C -sub_818C49C: @ 818C49C - push {lr} - ldr r1, =gBattleCommunication - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - ldrb r1, [r1, 0x4] - lsrs r0, 1 - cmp r1, r0 - bcc _0818C4C6 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl sub_8185054 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitTwoReturnValues - bl RecordedPlayerBufferExecCompleted -_0818C4C6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818C49C - - thumb_func_start RecordedPlayerHandleChooseAction -RecordedPlayerHandleChooseAction: @ 818C4D8 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0818C508 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818C49C - str r1, [r0] - b _0818C522 - .pool -_0818C508: - ldr r0, =gActiveBank - ldrb r0, [r0] - bl sub_8185054 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitTwoReturnValues - bl RecordedPlayerBufferExecCompleted -_0818C522: - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleChooseAction - - thumb_func_start RecordedPlayerHandleUnknownYesNoBox -RecordedPlayerHandleUnknownYesNoBox: @ 818C52C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleUnknownYesNoBox - - thumb_func_start RecordedPlayerHandleChooseMove -RecordedPlayerHandleChooseMove: @ 818C538 - push {r4,r5,lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0818C560 - bl ChooseMoveAndTargetInBattlePalace - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues - b _0818C584 - .pool -_0818C560: - ldr r5, =gActiveBank - ldrb r0, [r5] - bl sub_8185054 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r5] - bl sub_8185054 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 16 - orrs r2, r4 - movs r0, 0x1 - movs r1, 0xA - bl EmitTwoReturnValues -_0818C584: - bl RecordedPlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleChooseMove - - thumb_func_start RecordedPlayerHandleChooseItem -RecordedPlayerHandleChooseItem: @ 818C594 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleChooseItem - - thumb_func_start RecordedPlayerHandleChoosePokemon -RecordedPlayerHandleChoosePokemon: @ 818C5A0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl sub_8185054 - ldrb r1, [r4] - ldr r3, =gBattleStruct - ldr r2, [r3] - adds r1, r2 - adds r1, 0x5C - strb r0, [r1] - ldrb r0, [r4] - ldr r1, [r3] - adds r0, r1 - adds r0, 0x5C - ldrb r1, [r0] - movs r0, 0x1 - movs r2, 0 - bl EmitChosenMonReturnValue - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleChoosePokemon - - thumb_func_start RecordedPlayerHandleCmd23 -RecordedPlayerHandleCmd23: @ 818C5DC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd23 - - thumb_func_start RecordedPlayerHandleHealthBarUpdate -RecordedPlayerHandleHealthBarUpdate: @ 818C5E8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _0818C678 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0818C6B2 - .pool -_0818C678: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r4, =gHealthBoxesIds - adds r1, r0, r4 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct - mov r1, r9 - ldrb r0, [r1] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0 - bl UpdateHpTextInHealthbox -_0818C6B2: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A0A4 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleHealthBarUpdate - - thumb_func_start RecordedPlayerHandleExpUpdate -RecordedPlayerHandleExpUpdate: @ 818C6E8 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleExpUpdate - - thumb_func_start RecordedPlayerHandleStatusIconUpdate -RecordedPlayerHandleStatusIconUpdate: @ 818C6F4 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0818C748 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A58C - str r1, [r0] -_0818C748: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleStatusIconUpdate - - thumb_func_start RecordedPlayerHandleStatusAnimation -RecordedPlayerHandleStatusAnimation: @ 818C76C - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0818C7BC - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl DoStatusAnimation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A58C - str r1, [r0] -_0818C7BC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleStatusAnimation - - thumb_func_start RecordedPlayerHandleStatusXor -RecordedPlayerHandleStatusXor: @ 818C7D4 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleStatusXor - - thumb_func_start RecordedPlayerHandleDataTransfer -RecordedPlayerHandleDataTransfer: @ 818C7E0 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleDataTransfer - - thumb_func_start RecordedPlayerHandleDMA3Transfer -RecordedPlayerHandleDMA3Transfer: @ 818C7EC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleDMA3Transfer - - thumb_func_start RecordedPlayerHandlePlayBGM -RecordedPlayerHandlePlayBGM: @ 818C7F8 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePlayBGM - - thumb_func_start RecordedPlayerHandleCmd32 -RecordedPlayerHandleCmd32: @ 818C804 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd32 - - thumb_func_start RecordedPlayerHandleTwoReturnValues -RecordedPlayerHandleTwoReturnValues: @ 818C810 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleTwoReturnValues - - thumb_func_start RecordedPlayerHandleChosenMonReturnValue -RecordedPlayerHandleChosenMonReturnValue: @ 818C81C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleChosenMonReturnValue - - thumb_func_start RecordedPlayerHandleOneReturnValue -RecordedPlayerHandleOneReturnValue: @ 818C828 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleOneReturnValue - - thumb_func_start RecordedPlayerHandleOneReturnValue_Duplicate -RecordedPlayerHandleOneReturnValue_Duplicate: @ 818C834 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleOneReturnValue_Duplicate - - thumb_func_start RecordedPlayerHandleCmd37 -RecordedPlayerHandleCmd37: @ 818C840 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd37 - - thumb_func_start RecordedPlayerHandleCmd38 -RecordedPlayerHandleCmd38: @ 818C85C - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd38 - - thumb_func_start RecordedPlayerHandleCmd39 -RecordedPlayerHandleCmd39: @ 818C894 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd39 - - thumb_func_start RecordedPlayerHandleCmd40 -RecordedPlayerHandleCmd40: @ 818C8AC - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd40 - - thumb_func_start RecordedPlayerHandleHitAnimation -RecordedPlayerHandleHitAnimation: @ 818C8D4 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0818C908 - bl RecordedPlayerBufferExecCompleted - b _0818C932 - .pool -_0818C908: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl DoHitAnimHealthboxEffect - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818A238 - str r1, [r0] -_0818C932: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleHitAnimation - - thumb_func_start RecordedPlayerHandleCmd42 -RecordedPlayerHandleCmd42: @ 818C944 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd42 - - thumb_func_start RecordedPlayerHandleEffectivenessSound -RecordedPlayerHandleEffectivenessSound: @ 818C950 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0818C964 - movs r3, 0xC0 -_0818C964: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleEffectivenessSound - - thumb_func_start RecordedPlayerHandlePlayFanfareOrBGM -RecordedPlayerHandlePlayFanfareOrBGM: @ 818C994 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0818C9D0 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0818C9E4 - .pool -_0818C9D0: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0818C9E4: - bl RecordedPlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandlePlayFanfareOrBGM - - thumb_func_start RecordedPlayerHandleFaintingCry -RecordedPlayerHandleFaintingCry: @ 818C9F0 - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleFaintingCry - - thumb_func_start RecordedPlayerHandleIntroSlide -RecordedPlayerHandleIntroSlide: @ 818CA30 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl HandleIntroSlide - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleIntroSlide - - thumb_func_start RecordedPlayerHandleIntroTrainerBallThrow -RecordedPlayerHandleIntroTrainerBallThrow: @ 818CA64 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r6] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x38] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f9 - bl AllocSpritePalette - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 18 - ands r0, r1 - cmp r0, 0 - beq _0818CB54 - ldr r4, =gLinkPlayers - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] - b _0818CB5A - .pool -_0818CB54: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] -_0818CB5A: - ldr r1, =gTrainerBackPicPaletteTable - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - lsls r4, r5, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_818CC24 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r5] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0818CBD4 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0818CBD4: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_120 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleIntroTrainerBallThrow - - thumb_func_start sub_818CC24 -sub_818CC24: @ 818CC24 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x17 - bgt _0818CC50 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0818CD0C - .pool -_0818CC50: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0818CC70 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0818CCA0 -_0818CC70: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_818BA6C - b _0818CCF4 - .pool -_0818CCA0: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_818BA6C - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_818BA6C - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_0818CCF4: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8189D40 - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_0818CD0C: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818CC24 - - thumb_func_start RecordedPlayerHandleDrawPartyStatusSummary -RecordedPlayerHandleDrawPartyStatusSummary: @ 818CD30 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0818CD60 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0818CD60 - bl RecordedPlayerBufferExecCompleted - b _0818CDD4 - .pool -_0818CD60: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0818CDC8 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_0818CDC8: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_increment_dp11b_field_5_till_x60_then_resume - str r0, [r1] -_0818CDD4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleDrawPartyStatusSummary - - thumb_func_start bx_increment_dp11b_field_5_till_x60_then_resume -bx_increment_dp11b_field_5_till_x60_then_resume: @ 818CDF4 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _0818CE2C - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x5] - bl RecordedPlayerBufferExecCompleted -_0818CE2C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bx_increment_dp11b_field_5_till_x60_then_resume - - thumb_func_start RecordedPlayerHandleCmd49 -RecordedPlayerHandleCmd49: @ 818CE3C - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0818CE6E - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_0818CE6E: - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd49 - - thumb_func_start RecordedPlayerHandleCmd50 -RecordedPlayerHandleCmd50: @ 818CE8C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleCmd50 - - thumb_func_start RecordedPlayerHandleSpriteInvisibility -RecordedPlayerHandleSpriteInvisibility: @ 818CE98 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _0818CEDE - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl SetBattleSpriteInvisibilityBitToSpriteInvisibility -_0818CEDE: - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleSpriteInvisibility - - thumb_func_start RecordedPlayerHandleBattleAnimation -RecordedPlayerHandleBattleAnimation: @ 818CEF8 - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0818CF50 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl DoBattleAnimationFromTable - lsls r0, 24 - cmp r0, 0 - beq _0818CF44 - bl RecordedPlayerBufferExecCompleted - b _0818CF50 - .pool -_0818CF44: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818A5BC - str r0, [r1] -_0818CF50: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleBattleAnimation - - thumb_func_start RecordedPlayerHandleLinkStandbyMsg -RecordedPlayerHandleLinkStandbyMsg: @ 818CF60 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleLinkStandbyMsg - - thumb_func_start RecordedPlayerHandleResetActionMoveSelection -RecordedPlayerHandleResetActionMoveSelection: @ 818CF6C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end RecordedPlayerHandleResetActionMoveSelection - - thumb_func_start RecordedPlayerHandleCmd55 -RecordedPlayerHandleCmd55: @ 818CF78 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl RecordedPlayerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedPlayerHandleCmd55 - - thumb_func_start nullsub_121 -nullsub_121: @ 818CFC4 - bx lr - thumb_func_end nullsub_121 - - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/recorded_battle.s b/asm/recorded_battle.s index 2209312c2..55cfdf6ef 100644 --- a/asm/recorded_battle.s +++ b/asm/recorded_battle.s @@ -312,8 +312,8 @@ _08185046: .pool thumb_func_end RecordedBattle_ClearBankAction - thumb_func_start sub_8185054 -sub_8185054: @ 8185054 + thumb_func_start RecordedBattle_ReadBankAction +RecordedBattle_ReadBankAction: @ 8185054 push {r4,lr} sub sp, 0x4 lsls r0, 24 @@ -364,7 +364,7 @@ _081850C6: pop {r4} pop {r1} bx r1 - thumb_func_end sub_8185054 + thumb_func_end RecordedBattle_ReadBankAction thumb_func_start sub_81850D0 sub_81850D0: @ 81850D0 @@ -2274,7 +2274,7 @@ _0818611E: b _081863EE _08186142: adds r0, r5, 0 - bl sub_8185054 + bl RecordedBattle_ReadBankAction movs r5, 0 mov r0, sp adds r0, 0x4 @@ -2326,7 +2326,7 @@ _0818617E: _081861A6: ldr r3, [sp, 0x4C] lsrs r0, r3, 24 - bl sub_8185054 + bl RecordedBattle_ReadBankAction strb r0, [r4] ldrb r0, [r4] lsls r0, 1 diff --git a/include/recorded_battle.h b/include/recorded_battle.h index 6b80e220f..ae2ed1a79 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -6,6 +6,7 @@ extern u32 gRecordedBattleRngSeed; void sub_8184DA4(u8 arg0); void sub_8185F84(void); void sub_8184E58(void); +u8 RecordedBattle_ReadBankAction(u8 bank); void RecordedBattle_SetBankAction(u8 bank, u8 action); void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear); void sub_8185F90(u16 arg0); @@ -18,5 +19,6 @@ void sub_8185FD0(void); void sub_8186444(void); void sub_8185EB8(void); u8 sub_81850DC(u8 *arg0); +u8 sub_8185F40(void); #endif // GUARD_RECORDED_BATTLE_H diff --git a/ld_script.txt b/ld_script.txt index 08dcabd3a..0296ddd56 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -236,7 +236,6 @@ SECTIONS { asm/recorded_battle.o(.text); asm/battle_controller_recorded_opponent.o(.text); src/battle_controller_recorded_player.o(.text); - asm/battle_controller_recorded_player.o(.text); src/battle_dome_cards.o(.text); src/lilycove_lady.o(.text); asm/battle_frontier_1.o(.text); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index b9ce93a89..b022d3f87 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -2510,7 +2510,7 @@ static void PlayerHandleMoveAnimation(void) gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; - if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always return FALSE + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE { PlayerBufferExecCompleted(); } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index b7479c3cc..25eaf773f 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -1456,7 +1456,7 @@ static void PlayerPartnerHandleMoveAnimation(void) gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; - if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always return FALSE + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE { PlayerPartnerBufferExecCompleted(); } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 1f07b377c..efedf52b6 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -50,79 +50,89 @@ extern u8 gBankTarget; extern u8 gAbsentBankFlags; extern u8 gUnknown_020244B4[]; extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u8 gBattleCommunication[]; +extern u8 gUnknown_0203C7B4; +extern struct MusicPlayerInfo gMPlay_BGM; extern struct UnusedControllerStruct gUnknown_02022D0C; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; -extern void sub_81358F4(void); extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); // this file's functions -void RecordedPlayerHandleGetMonData(void); -void RecordedPlayerHandleGetRawMonData(void); -void RecordedPlayerHandleSetMonData(void); -void RecordedPlayerHandleSetRawMonData(void); -void RecordedPlayerHandleLoadMonSprite(void); -void RecordedPlayerHandleSwitchInAnim(void); -void RecordedPlayerHandleReturnMonToBall(void); -void RecordedPlayerHandleDrawTrainerPic(void); -void RecordedPlayerHandleTrainerSlide(void); -void RecordedPlayerHandleTrainerSlideBack(void); -void RecordedPlayerHandleFaintAnimation(void); -void RecordedPlayerHandlePaletteFade(void); -void RecordedPlayerHandleSuccessBallThrowAnim(void); -void RecordedPlayerHandleBallThrowAnim(void); -void RecordedPlayerHandlePause(void); -void RecordedPlayerHandleMoveAnimation(void); -void RecordedPlayerHandlePrintString(void); -void RecordedPlayerHandlePrintStringPlayerOnly(void); -void RecordedPlayerHandleChooseAction(void); -void RecordedPlayerHandleUnknownYesNoBox(void); -void RecordedPlayerHandleChooseMove(void); -void RecordedPlayerHandleChooseItem(void); -void RecordedPlayerHandleChoosePokemon(void); -void RecordedPlayerHandleCmd23(void); -void RecordedPlayerHandleHealthBarUpdate(void); -void RecordedPlayerHandleExpUpdate(void); -void RecordedPlayerHandleStatusIconUpdate(void); -void RecordedPlayerHandleStatusAnimation(void); -void RecordedPlayerHandleStatusXor(void); -void RecordedPlayerHandleDataTransfer(void); -void RecordedPlayerHandleDMA3Transfer(void); -void RecordedPlayerHandlePlayBGM(void); -void RecordedPlayerHandleCmd32(void); -void RecordedPlayerHandleTwoReturnValues(void); -void RecordedPlayerHandleChosenMonReturnValue(void); -void RecordedPlayerHandleOneReturnValue(void); -void RecordedPlayerHandleOneReturnValue_Duplicate(void); -void RecordedPlayerHandleCmd37(void); -void RecordedPlayerHandleCmd38(void); -void RecordedPlayerHandleCmd39(void); -void RecordedPlayerHandleCmd40(void); -void RecordedPlayerHandleHitAnimation(void); -void RecordedPlayerHandleCmd42(void); -void RecordedPlayerHandleEffectivenessSound(void); -void RecordedPlayerHandlePlayFanfareOrBGM(void); -void RecordedPlayerHandleFaintingCry(void); -void RecordedPlayerHandleIntroSlide(void); -void RecordedPlayerHandleIntroTrainerBallThrow(void); -void RecordedPlayerHandleDrawPartyStatusSummary(void); -void RecordedPlayerHandleCmd49(void); -void RecordedPlayerHandleCmd50(void); -void RecordedPlayerHandleSpriteInvisibility(void); -void RecordedPlayerHandleBattleAnimation(void); -void RecordedPlayerHandleLinkStandbyMsg(void); -void RecordedPlayerHandleResetActionMoveSelection(void); -void RecordedPlayerHandleCmd55(void); -void nullsub_121(void); +static void RecordedPlayerHandleGetMonData(void); +static void RecordedPlayerHandleGetRawMonData(void); +static void RecordedPlayerHandleSetMonData(void); +static void RecordedPlayerHandleSetRawMonData(void); +static void RecordedPlayerHandleLoadMonSprite(void); +static void RecordedPlayerHandleSwitchInAnim(void); +static void RecordedPlayerHandleReturnMonToBall(void); +static void RecordedPlayerHandleDrawTrainerPic(void); +static void RecordedPlayerHandleTrainerSlide(void); +static void RecordedPlayerHandleTrainerSlideBack(void); +static void RecordedPlayerHandleFaintAnimation(void); +static void RecordedPlayerHandlePaletteFade(void); +static void RecordedPlayerHandleSuccessBallThrowAnim(void); +static void RecordedPlayerHandleBallThrowAnim(void); +static void RecordedPlayerHandlePause(void); +static void RecordedPlayerHandleMoveAnimation(void); +static void RecordedPlayerHandlePrintString(void); +static void RecordedPlayerHandlePrintStringPlayerOnly(void); +static void RecordedPlayerHandleChooseAction(void); +static void RecordedPlayerHandleUnknownYesNoBox(void); +static void RecordedPlayerHandleChooseMove(void); +static void RecordedPlayerHandleChooseItem(void); +static void RecordedPlayerHandleChoosePokemon(void); +static void RecordedPlayerHandleCmd23(void); +static void RecordedPlayerHandleHealthBarUpdate(void); +static void RecordedPlayerHandleExpUpdate(void); +static void RecordedPlayerHandleStatusIconUpdate(void); +static void RecordedPlayerHandleStatusAnimation(void); +static void RecordedPlayerHandleStatusXor(void); +static void RecordedPlayerHandleDataTransfer(void); +static void RecordedPlayerHandleDMA3Transfer(void); +static void RecordedPlayerHandlePlayBGM(void); +static void RecordedPlayerHandleCmd32(void); +static void RecordedPlayerHandleTwoReturnValues(void); +static void RecordedPlayerHandleChosenMonReturnValue(void); +static void RecordedPlayerHandleOneReturnValue(void); +static void RecordedPlayerHandleOneReturnValue_Duplicate(void); +static void RecordedPlayerHandleCmd37(void); +static void RecordedPlayerHandleCmd38(void); +static void RecordedPlayerHandleCmd39(void); +static void RecordedPlayerHandleCmd40(void); +static void RecordedPlayerHandleHitAnimation(void); +static void RecordedPlayerHandleCmd42(void); +static void RecordedPlayerHandleEffectivenessSound(void); +static void RecordedPlayerHandlePlayFanfareOrBGM(void); +static void RecordedPlayerHandleFaintingCry(void); +static void RecordedPlayerHandleIntroSlide(void); +static void RecordedPlayerHandleIntroTrainerBallThrow(void); +static void RecordedPlayerHandleDrawPartyStatusSummary(void); +static void RecordedPlayerHandleCmd49(void); +static void RecordedPlayerHandleCmd50(void); +static void RecordedPlayerHandleSpriteInvisibility(void); +static void RecordedPlayerHandleBattleAnimation(void); +static void RecordedPlayerHandleLinkStandbyMsg(void); +static void RecordedPlayerHandleResetActionMoveSelection(void); +static void RecordedPlayerHandleCmd55(void); +static void nullsub_121(void); -void RecordedPlayerBufferRunCommand(void); -void RecordedPlayerBufferExecCompleted(void); +static void RecordedPlayerBufferRunCommand(void); +static void RecordedPlayerBufferExecCompleted(void); +static void sub_818A328(void); +static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst); +static void SetRecordedPlayerMonData(u8 monId); +static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void RecordedPlayerDoMoveAnimation(void); +static void sub_818CC24(u8 taskId); +static void sub_818CDF4(void); -void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = +static void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = { RecordedPlayerHandleGetMonData, RecordedPlayerHandleGetRawMonData, @@ -183,7 +193,7 @@ void (*const gRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) = nullsub_121 }; -void nullsub_120(void) +static void nullsub_120(void) { } @@ -192,7 +202,7 @@ void SetBankFuncToRecordedPlayerBufferRunCommand(void) gBattleBankFunc[gActiveBank] = RecordedPlayerBufferRunCommand; } -void RecordedPlayerBufferRunCommand(void) +static void RecordedPlayerBufferRunCommand(void) { if (gBattleExecBuffer & gBitTable[gActiveBank]) { @@ -202,3 +212,1643 @@ void RecordedPlayerBufferRunCommand(void) RecordedPlayerBufferExecCompleted(); } } + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + RecordedPlayerBufferExecCompleted(); +} + +static void sub_81899F0(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(0); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_8189A58(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_8189AA0(void) +{ + bool32 r6 = FALSE; + + if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) + { + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (r6 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + if (IsDoubleBattle()) + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_8189A58; + } + } + else + { + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (IsCryPlayingOrClearCrySongs()) + r6 = FALSE; + + if (r6) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_8189A58; + } + } +} + +static void sub_8189D40(void) +{ + bool32 r10 = FALSE; + + if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + } + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + { + sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + } + } + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 1; + } + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x40 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x40 + && !IsCryPlayingOrClearCrySongs()) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20) + { + if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r10 = TRUE; + } + + if (r10 && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + gBattleBankFunc[gActiveBank] = sub_8189AA0; + } +} + +static void sub_818A064(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].animEnded && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + RecordedPlayerBufferExecCompleted(); +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], 0, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_818A114(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos1.y + gSprites[gBankSpriteIds[gActiveBank]].pos2.y > DISPLAY_HEIGHT) + { + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + nullsub_24(species); + FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBank]].oam.matrixNum); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_818A1B0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + RecordedPlayerBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + RecordedPlayerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_818A2B4(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_818A328; + } +} + +static void sub_818A328(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + RecordedPlayerBufferExecCompleted(); + } +} + +static void sub_818A37C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleBankFunc[gActiveBank] = sub_818A2B4; + } +} + +static void sub_818A470(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + gBattleBankFunc[gActiveBank] = sub_818A37C; + } +} + +static void RecordedPlayerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = RecordedPlayerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + RecordedPlayerBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monsToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyRecordedPlayerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + size += CopyRecordedPlayerMonData(i, monData + size); + monsToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + RecordedPlayerBufferExecCompleted(); +} + +static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPD); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void RecordedPlayerHandleGetRawMonData(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleSetMonData(void) +{ + u8 monsToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetRecordedPlayerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monsToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monsToCheck & 1) + SetRecordedPlayerMonData(i); + monsToCheck >>= 1; + } + } + RecordedPlayerBufferExecCompleted(); +} + +static void SetRecordedPlayerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPD, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void RecordedPlayerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleLoadMonSprite(void) +{ + u16 species; + + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_818A064; +} + +static void RecordedPlayerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_818BA6C(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_818A470; +} + +static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void RecordedPlayerHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedPlayerBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); + gBattleBankFunc[gActiveBank] = sub_818A1B0; + } + break; + } +} + +// todo: get rid of it once the struct is declared in a header +struct MonCoords +{ + // This would use a bitfield, but sub_8079F44 + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; +extern const struct MonCoords gTrainerBackPicCoords[]; +extern const struct MonCoords gTrainerFrontPicCoords[]; + +static void RecordedPlayerHandleDrawTrainerPic(void) +{ + s16 xPos, yPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + trainerPicId = sub_8185F40(); + else + trainerPicId = gLinkPlayers[gUnknown_0203C7B4].gender; + } + else + { + trainerPicId = gLinkPlayers[0].gender; + } + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 90; + else // first mon + xPos = 32; + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + { + xPos = 90; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80; + } + else + { + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + } + else + { + xPos = 80; + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].pos2.y = 48; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gSprites[gBankSpriteIds[gActiveBank]].oam.affineMode = 0; + gSprites[gBankSpriteIds[gActiveBank]].hFlip = 1; + } + else + { + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + } + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void RecordedPlayerHandleTrainerSlide(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_81899F0; +} + +static void RecordedPlayerHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlaySE12WithPanning(SE_POKE_DEAD, -64); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_818A114; + } + } +} + +static void RecordedPlayerHandlePaletteFade(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleSuccessBallThrowAnim(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleBallThrowAnim(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandlePause(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + RecordedPlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = RecordedPlayerDoMoveAnimation; + } + } +} + +static void RecordedPlayerDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + RecordedPlayerBufferExecCompleted(); + } + break; + } +} + +static void RecordedPlayerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void RecordedPlayerHandlePrintStringPlayerOnly(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void ChooseActionInBattlePalace(void) +{ + if (gBattleCommunication[4] >= gNoOfAllBanks / 2) + { + EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBank), 0); + RecordedPlayerBufferExecCompleted(); + } +} + +static void RecordedPlayerHandleChooseAction(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gBattleBankFunc[gActiveBank] = ChooseActionInBattlePalace; + } + else + { + EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBank), 0); + RecordedPlayerBufferExecCompleted(); + } +} + +static void RecordedPlayerHandleUnknownYesNoBox(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + } + else + { + u8 moveId = RecordedBattle_ReadBankAction(gActiveBank); + u8 target = RecordedBattle_ReadBankAction(gActiveBank); + EmitTwoReturnValues(1, 10, moveId | (target << 8)); + } + + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChooseItem(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChoosePokemon(void) +{ + *(gBattleStruct->field_5C + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank); + EmitChosenMonReturnValue(1, *(gBattleStruct->field_5C + gActiveBank), NULL); + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd23(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void RecordedPlayerHandleExpUpdate(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedPlayerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedPlayerHandleStatusXor(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleDataTransfer(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleDMA3Transfer(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandlePlayBGM(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd32(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleTwoReturnValues(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleChosenMonReturnValue(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleOneReturnValue(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleOneReturnValue_Duplicate(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + RecordedPlayerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void RecordedPlayerHandleCmd42(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + u32 trainerPicId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F9); + if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + trainerPicId = gLinkPlayers[sub_806D864(gActiveBank)].gender; + else + trainerPicId = gSaveBlock2Ptr->playerGender; + + LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_818CC24, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_120; +} + +static void sub_818CC24(u8 taskId) +{ + if (gTasks[taskId].data[1] < 24) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_818BA6C(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_818BA6C(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_818BA6C(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_8189D40; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void RecordedPlayerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + RecordedPlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_818CDF4; + } +} + +static void sub_818CDF4(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + RecordedPlayerBufferExecCompleted(); + } +} + +static void RecordedPlayerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd50(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleSpriteInvisibility(void) +{ + if (AnimBankSpriteExists(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank); + } + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + RecordedPlayerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void RecordedPlayerHandleLinkStandbyMsg(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleResetActionMoveSelection(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + RecordedPlayerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_121(void) +{ +}