diff --git a/asm/battle_1.s b/asm/battle_1.s index 9a981e222..9665b0d11 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -1888,7 +1888,7 @@ sub_8035C4C: @ 8035C4C bne _08035C68 ldr r0, =gText_Draw movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035C68: @@ -1964,10 +1964,10 @@ _08035CE2: _08035CFC: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D20: @@ -1985,19 +1985,19 @@ _08035D20: _08035D36: ldr r0, =gText_Win movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D58: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08035D68: pop {r0} bx r0 @@ -2068,14 +2068,14 @@ _08035DDC: _08035DE6: adds r0, r1, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 b _08035E14 _08035DF4: adds r0, r1, 0 movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 str r0, [sp] @@ -2085,7 +2085,7 @@ _08035DF4: _08035E08: adds r0, r1, 0 movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 _08035E14: @@ -2099,7 +2099,7 @@ _08035E1A: _08035E22: adds r0, r1, 0 movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 str r0, [sp] @@ -2139,14 +2139,14 @@ _08035E66: adds r1, r0, r4 adds r0, r1, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter lsls r0, r6, 3 subs r0, r6 lsls r0, 2 adds r1, r0, r4 adds r0, r1, 0 movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0x7 str r4, [sp] adds r0, r7, 0 diff --git a/asm/battle_7.s b/asm/battle_7.s index ea6fc40b3..94cc1ba8e 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -67,8 +67,8 @@ _0805D192: .pool thumb_func_end FreeBattleSpritesData - thumb_func_start sub_805D19C -sub_805D19C: @ 805D19C + thumb_func_start ChooseMoveAndTargetInBattlePalace +ChooseMoveAndTargetInBattlePalace: @ 805D19C push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -448,7 +448,7 @@ _0805D496: pop {r1} bx r1 .pool - thumb_func_end sub_805D19C + thumb_func_end ChooseMoveAndTargetInBattlePalace thumb_func_start sub_805D4A8 sub_805D4A8: @ 805D4A8 @@ -834,8 +834,8 @@ _0805D800: .pool thumb_func_end sub_805D7EC - thumb_func_start move_anim_start_t2_for_situation -move_anim_start_t2_for_situation: @ 805D808 + thumb_func_start DoStatusAnimation +DoStatusAnimation: @ 805D808 push {r4-r6,lr} adds r4, r1, 0 lsls r0, 24 @@ -962,10 +962,10 @@ _0805D902: pop {r4-r6} pop {r0} bx r0 - thumb_func_end move_anim_start_t2_for_situation + thumb_func_end DoStatusAnimation - thumb_func_start move_anim_start_t3 -move_anim_start_t3: @ 805D908 + thumb_func_start DoBattleAnimationFromTable +DoBattleAnimationFromTable: @ 805D908 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -1070,7 +1070,7 @@ _0805D9CC: ldr r0, =gUnknown_082C9320 adds r1, r5, 0 movs r2, 0 - bl DoBattleAnim + bl LaunchBattleAnimation ldr r0, =task0A_0803415C movs r1, 0xA bl CreateTask @@ -1105,7 +1105,7 @@ _0805DA1E: pop {r1} bx r1 .pool - thumb_func_end move_anim_start_t3 + thumb_func_end DoBattleAnimationFromTable thumb_func_start task0A_0803415C task0A_0803415C: @ 805DA48 @@ -1172,8 +1172,8 @@ _0805DABE: bx r1 thumb_func_end sub_805DAA0 - thumb_func_start move_anim_start_t4 -move_anim_start_t4: @ 805DAC4 + thumb_func_start DoSpecialBattleAnimation +DoSpecialBattleAnimation: @ 805DAC4 push {r4,lr} adds r4, r0, 0 lsls r4, 24 @@ -1187,7 +1187,7 @@ move_anim_start_t4: @ 805DAC4 ldr r0, =gUnknown_082C937C adds r1, r3, 0 movs r2, 0 - bl DoBattleAnim + bl LaunchBattleAnimation ldr r0, =task0A_08034248 movs r1, 0xA bl CreateTask @@ -1216,7 +1216,7 @@ move_anim_start_t4: @ 805DAC4 pop {r0} bx r0 .pool - thumb_func_end move_anim_start_t4 + thumb_func_end DoSpecialBattleAnimation thumb_func_start task0A_08034248 task0A_08034248: @ 805DB34 @@ -1258,11 +1258,11 @@ _0805DB76: .pool thumb_func_end task0A_08034248 - thumb_func_start sub_805DB8C -sub_805DB8C: @ 805DB8C + thumb_func_start IsMoveWithoutAnimation +IsMoveWithoutAnimation: @ 805DB8C movs r0, 0 bx lr - thumb_func_end sub_805DB8C + thumb_func_end IsMoveWithoutAnimation thumb_func_start mplay_80342A4 mplay_80342A4: @ 805DB90 @@ -1357,7 +1357,7 @@ BattleLoadOpponentMonSpriteGfx: @ 805DC0C .pool _0805DC50: ldrh r5, [r2, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r6, [r0] _0805DC58: @@ -1510,7 +1510,7 @@ BattleLoadPlayerMonSpriteGfx: @ 805DD7C .pool _0805DDC0: ldrh r5, [r2, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r4, [r0] _0805DDC8: @@ -1670,8 +1670,8 @@ nullsub_24: @ 805DF34 bx lr thumb_func_end nullsub_24 - thumb_func_start sub_805DF38 -sub_805DF38: @ 805DF38 + thumb_func_start DecompressTrainerFrontPic +DecompressTrainerFrontPic: @ 805DF38 push {r4,lr} adds r4, r0, 0 adds r0, r1, 0 @@ -1701,10 +1701,10 @@ sub_805DF38: @ 805DF38 pop {r0} bx r0 .pool - thumb_func_end sub_805DF38 + thumb_func_end DecompressTrainerFrontPic - thumb_func_start LoadBackTrainerBankSpriteGfx -LoadBackTrainerBankSpriteGfx: @ 805DF84 + thumb_func_start DecompressTrainerBackPic +DecompressTrainerBackPic: @ 805DF84 push {r4,r5,lr} adds r5, r0, 0 adds r4, r1, 0 @@ -1742,15 +1742,15 @@ LoadBackTrainerBankSpriteGfx: @ 805DF84 pop {r0} bx r0 .pool - thumb_func_end LoadBackTrainerBankSpriteGfx + thumb_func_end DecompressTrainerBackPic thumb_func_start nullsub_25 nullsub_25: @ 805DFE0 bx lr thumb_func_end nullsub_25 - thumb_func_start sub_805DFE4 -sub_805DFE4: @ 805DFE4 + thumb_func_start FreeTrainerFrontPicPalette +FreeTrainerFrontPicPalette: @ 805DFE4 push {lr} lsls r0, 16 ldr r1, =gTrainerFrontPicPaletteTable @@ -1761,7 +1761,7 @@ sub_805DFE4: @ 805DFE4 pop {r0} bx r0 .pool - thumb_func_end sub_805DFE4 + thumb_func_end FreeTrainerFrontPicPalette thumb_func_start sub_805DFFC sub_805DFFC: @ 805DFFC @@ -2229,8 +2229,8 @@ _0805E3EA: .pool thumb_func_end sub_805E394 - thumb_func_start sub_805E408 -sub_805E408: @ 805E408 + thumb_func_start CopyBattleSpriteInvisibility +CopyBattleSpriteInvisibility: @ 805E408 lsls r0, 24 lsrs r0, 24 ldr r1, =gBattleSpritesDataPtr @@ -2258,7 +2258,7 @@ sub_805E408: @ 805E408 strb r0, [r3] bx lr .pool - thumb_func_end sub_805E408 + thumb_func_end CopyBattleSpriteInvisibility thumb_func_start sub_805E448 sub_805E448: @ 805E448 @@ -2441,7 +2441,7 @@ _0805E59C: adds r1, 0x4 adds r1, r2 ldr r1, [r1] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities lsls r2, r7, 2 adds r2, r3 ldr r3, [r2] @@ -2479,7 +2479,7 @@ _0805E618: adds r1, 0x4 adds r1, r2 ldr r1, [r1] - ldr r3, =gUnknown_020244BC + ldr r3, =gTransformedPersonalities lsls r2, r7, 2 adds r2, r3 ldr r3, [r2] @@ -2795,8 +2795,8 @@ _0805E93E: bx r0 thumb_func_end refresh_graphics_maybe - thumb_func_start sub_805E94C -sub_805E94C: @ 805E94C + thumb_func_start TrySetBehindSubstituteSpriteBit +TrySetBehindSubstituteSpriteBit: @ 805E94C push {lr} lsls r0, 24 lsrs r2, r0, 24 @@ -2817,7 +2817,7 @@ _0805E96C: pop {r0} bx r0 .pool - thumb_func_end sub_805E94C + thumb_func_end TrySetBehindSubstituteSpriteBit thumb_func_start sub_805E974 sub_805E974: @ 805E974 @@ -3111,7 +3111,7 @@ sub_805EB9C: @ 805EB9C _0805EBC8: lsls r0, r5, 24 lsrs r0, 24 - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 beq _0805EC60 @@ -3329,7 +3329,7 @@ sub_805ED70: @ 805ED70 cmp r0, 0 beq _0805EDAC adds r0, r4, 0 - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 bne _0805EDC0 @@ -3572,8 +3572,8 @@ _0805EF6A: .pool thumb_func_end sub_805EF14 - thumb_func_start sub_805EF84 -sub_805EF84: @ 805EF84 + thumb_func_start ClearTemporarySpeciesSpriteData +ClearTemporarySpeciesSpriteData: @ 805EF84 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -3598,7 +3598,7 @@ _0805EFAC: pop {r0} bx r0 .pool - thumb_func_end sub_805EF84 + thumb_func_end ClearTemporarySpeciesSpriteData thumb_func_start AllocateMonSpritesGfx AllocateMonSpritesGfx: @ 805EFBC diff --git a/asm/rom_80A5C6C.s b/asm/battle_anim_80A5C6C.s similarity index 99% rename from asm/rom_80A5C6C.s rename to asm/battle_anim_80A5C6C.s index bf273ac53..705146ce5 100644 --- a/asm/rom_80A5C6C.s +++ b/asm/battle_anim_80A5C6C.s @@ -217,7 +217,7 @@ _080A5E04: b _080A5E42 .pool _080A5E3C: - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r2, [r0] _080A5E42: @@ -307,7 +307,7 @@ _080A5EC8: b _080A5F0A .pool _080A5F04: - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r1, r0 ldr r2, [r0] _080A5F0A: @@ -726,7 +726,7 @@ GetAnimBankSpriteId: @ 80A6240 bne _080A6268 ldr r4, =gAnimBankAttacker ldrb r0, [r4] - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 beq _080A62B6 @@ -739,7 +739,7 @@ _080A6268: bne _080A6288 ldr r4, =gAnimBankTarget ldrb r0, [r4] - bl AnimBankSpriteExists + bl IsBankSpritePresent lsls r0, 24 cmp r0, 0 beq _080A62B6 @@ -1862,8 +1862,8 @@ _080A6A7E: .pool thumb_func_end GetBankByIdentity - thumb_func_start AnimBankSpriteExists -AnimBankSpriteExists: @ 80A6A90 + thumb_func_start IsBankSpritePresent +IsBankSpritePresent: @ 80A6A90 push {r4,r5,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -1926,7 +1926,7 @@ _080A6B1A: pop {r4,r5} pop {r1} bx r1 - thumb_func_end AnimBankSpriteExists + thumb_func_end IsBankSpritePresent thumb_func_start IsDoubleBattle IsDoubleBattle: @ 80A6B20 @@ -5522,7 +5522,7 @@ _080A86C4: .pool _080A871C: ldrh r7, [r1, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r2, r0 ldr r2, [r0] _080A8724: @@ -5612,7 +5612,7 @@ _080A8790: .pool _080A87DC: ldrh r7, [r1, 0x2] - ldr r0, =gUnknown_020244BC + ldr r0, =gTransformedPersonalities adds r0, r2, r0 ldr r2, [r0] _080A87E4: diff --git a/asm/battle_anim_80A9C70.s b/asm/battle_anim_80A9C70.s index 9b2939673..681802e12 100644 --- a/asm/battle_anim_80A9C70.s +++ b/asm/battle_anim_80A9C70.s @@ -869,7 +869,7 @@ move_anim_start_t2: @ 80AA364 strb r4, [r0] ldr r0, =gUnknown_082C92FC movs r2, 0 - bl DoBattleAnim + bl LaunchBattleAnimation ldr r0, =task0A_80788BC movs r1, 0xA bl CreateTask diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index dc927cacc..315f884cf 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -50443,8 +50443,8 @@ _081181CA: bx r1 thumb_func_end sub_8118140 - thumb_func_start battle_intro_launch -battle_intro_launch: @ 81181D4 + thumb_func_start HandleIntroSlide +HandleIntroSlide: @ 81181D4 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -50521,7 +50521,7 @@ _08118258: pop {r0} bx r0 .pool - thumb_func_end battle_intro_launch + thumb_func_end HandleIntroSlide thumb_func_start sub_811828C sub_811828C: @ 811828C diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s deleted file mode 100644 index d4e248d8c..000000000 --- a/asm/battle_controller_linkopponent.s +++ /dev/null @@ -1,6266 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_28 -nullsub_28: @ 8064390 - bx lr - thumb_func_end nullsub_28 - - thumb_func_start SetBankFuncToLinkOpponentBufferRunCommand -SetBankFuncToLinkOpponentBufferRunCommand: @ 8064394 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkOpponentBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToLinkOpponentBufferRunCommand - - thumb_func_start LinkOpponentBufferRunCommand -LinkOpponentBufferRunCommand: @ 80643B0 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _080643FC - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _080643F8 - ldr r0, =gLinkOpponentBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _080643FC - .pool -_080643F8: - bl LinkOpponentBufferExecCompleted -_080643FC: - pop {r0} - bx r0 - thumb_func_end LinkOpponentBufferRunCommand - - thumb_func_start sub_8064400 -sub_8064400: @ 8064400 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08064424 - bl LinkOpponentBufferExecCompleted -_08064424: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064400 - - thumb_func_start sub_8064438 -sub_8064438: @ 8064438 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0806445C - bl LinkOpponentBufferExecCompleted -_0806445C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064438 - - thumb_func_start sub_8064470 -sub_8064470: @ 8064470 - push {r4-r6,lr} - ldr r5, =gSprites - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _080644C2 - adds r0, r2, r5 - ldrh r0, [r0, 0x6] - bl sub_805DFE4 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - bl LinkOpponentBufferExecCompleted -_080644C2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064470 - - thumb_func_start sub_80644D8 -sub_80644D8: @ 80644D8 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _08064510 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl LinkOpponentBufferExecCompleted -_08064510: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80644D8 - - thumb_func_start sub_8064520 -sub_8064520: @ 8064520 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r0, 0 - mov r8, r0 - movs r4, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0806454C - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08064584 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08064584 -_0806454C: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r3, =gActiveBank - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - adds r7, r3, 0 - cmp r1, r0 - bne _080645C2 - b _080645CA - .pool -_08064584: - ldr r3, =gSprites - ldr r6, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r4, [r2] - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r3, 0 - adds r5, 0x1C - adds r0, r5 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - adds r7, r2, 0 - cmp r3, r0 - bne _080645C0 - movs r0, 0x2 - eors r4, r0 - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r3 - bne _080645C0 - movs r1, 0x1 - mov r8, r1 -_080645C0: - movs r4, 0x1 -_080645C2: - mov r0, r8 - cmp r0, 0 - bne _080645CA - b _08064714 -_080645CA: - cmp r4, 0 - bne _080645DE - ldrb r1, [r7] - movs r0, 0x2 - eors r0, r1 - bl IsAnimBankSpriteVisible - lsls r0, 24 - cmp r0, 0 - bne _0806469C -_080645DE: - ldr r1, =gBattleSpritesDataPtr - mov r12, r1 - ldr r0, [r1] - ldr r7, =gActiveBank - ldrb r2, [r7] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4, 0x1] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08064600 - b _08064714 -_08064600: - movs r6, 0x2 - adds r1, r6, 0 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08064714 - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r12 - ldr r0, [r1] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - mov r0, r12 - ldr r2, [r0] - ldrb r0, [r7] - adds r1, r6, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - mov r1, r12 - ldr r2, [r1] - ldrb r0, [r7] - adds r1, r6, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - b _080646F2 - .pool -_0806469C: - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08064714 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r7] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _080646F2 - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag -_080646F2: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80644D8 - str r1, [r0] -_08064714: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064520 - - thumb_func_start sub_8064734 -sub_8064734: @ 8064734 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - movs r6, 0xC4 - lsls r6, 1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _08064776 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08064776: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _080647B4 - ldr r2, [r5] - ldrb r1, [r4] - movs r0, 0x2 - adds r3, r0, 0 - eors r3, r1 - ldr r1, [r2, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _080647B4 - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_080647B4: - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, =gActiveBank - ldrb r5, [r2] - ldr r4, [r0, 0x4] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r6, r0, r4 - ldrb r1, [r6] - movs r0, 0x8 - mov r12, r0 - ands r0, r1 - mov r8, r3 - mov r9, r2 - cmp r0, 0 - bne _08064898 - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r5 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0] - mov r0, r12 - ands r0, r1 - cmp r0, 0 - bne _08064898 - ldrb r1, [r6, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0806487A - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0806484A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0806484A - ldr r4, =gHealthBoxesIds - mov r1, r9 - ldrb r0, [r1] - adds r1, r7, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - bl sub_8076918 - mov r1, r9 - ldrb r0, [r1] - eors r0, r7 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0806484A: - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0806487A: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x1] - mov r8, r4 - mov r9, r3 -_08064898: - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - bne _0806495A - movs r1, 0x2 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0806495A - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0806495A - mov r1, r8 - ldr r0, [r1] - mov r1, r9 - ldrb r2, [r1] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0806493C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08064930 - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0806493C - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _0806493C - .pool -_08064930: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_0806493C: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x20 - orrs r1, r2 - strb r1, [r0, 0x1] - movs r0, 0x1 - mov r10, r0 -_0806495A: - mov r1, r10 - cmp r1, 0 - bne _08064962 - b _08064AC0 -_08064962: - ldr r2, =gSprites - ldr r0, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r3, [r5] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - beq _08064982 - b _08064AC0 -_08064982: - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - beq _08064998 - b _08064AC0 -_08064998: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080649E2 - adds r0, r3, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _080649E2 - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x9] - adds r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08064AC0 - ldr r0, [r3] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] -_080649E2: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08064A3A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08064A3A - ldr r1, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldrb r0, [r5] - eors r4, r0 - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback -_08064A3A: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldrb r5, [r4] - ldr r1, =gBattlePartyID - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064520 - str r1, [r0] -_08064AC0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064734 - - thumb_func_start sub_8064B04 -sub_8064B04: @ 8064B04 - push {r4-r7,lr} - ldr r4, =gSprites - ldr r0, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r3, [r7] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08064BB6 - adds r0, r2, r4 - movs r1, 0x24 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08064BB6 - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r4, r3, 1 - adds r0, r4, r3 - lsls r0, 2 - adds r2, r0, r1 - ldrb r5, [r2] - movs r0, 0x80 - ands r0, r5 - cmp r0, 0 - bne _08064B7C - ldr r0, =gBattlePartyID - adds r0, r4, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 - b _08064BB6 - .pool -_08064B7C: - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08064BB6 - movs r0, 0x7F - ands r0, r5 - strb r0, [r2] - ldr r0, [r6] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - bl LinkOpponentBufferExecCompleted -_08064BB6: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064B04 - - thumb_func_start sub_8064BC0 -sub_8064BC0: @ 8064BC0 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - ldr r5, =gHealthBoxesIds - adds r1, r0, r5 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08064C08 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08064C0C - .pool -_08064C08: - bl LinkOpponentBufferExecCompleted -_08064C0C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8064BC0 - - thumb_func_start sub_8064C14 -sub_8064C14: @ 8064C14 - push {lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _08064C42 - ldr r0, =gHealthBoxesIds - adds r0, r3, r0 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkOpponentBufferExecCompleted -_08064C42: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064C14 - - thumb_func_start sub_8064C58 -sub_8064C58: @ 8064C58 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08064CB2 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkOpponentBufferExecCompleted -_08064CB2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064C58 - - thumb_func_start sub_8064CCC -sub_8064CCC: @ 8064CCC - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _08064CDE - bl LinkOpponentBufferExecCompleted -_08064CDE: - pop {r0} - bx r0 - thumb_func_end sub_8064CCC - - thumb_func_start sub_8064CE4 -sub_8064CE4: @ 8064CE4 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _08064D30 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl LinkOpponentBufferExecCompleted - b _08064D5A - .pool -_08064D30: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08064D54 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_08064D54: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08064D5A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8064CE4 - - thumb_func_start sub_8064D60 -sub_8064D60: @ 8064D60 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08064DAC - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08064DA0 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_08064DA0: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8064DD0 - str r0, [r1] -_08064DAC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064D60 - - thumb_func_start sub_8064DD0 -sub_8064DD0: @ 8064DD0 - push {r4,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r4, =gActiveBank - ldrb r1, [r4] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08064E2A - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08064E2A - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08064E1A - ldr r0, =SpriteCallbackDummy_2 - cmp r1, r0 - bne _08064E2A -_08064E1A: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - bl LinkOpponentBufferExecCompleted -_08064E2A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064DD0 - - thumb_func_start sub_8064E50 -sub_8064E50: @ 8064E50 - push {r4-r7,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r1, [r3, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08064F0C - ldr r7, =gSprites - ldr r6, =gBankSpriteIds - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r7, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08064F0C - ldrb r1, [r3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r3] - ldr r0, [r4] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r5] - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r5] - bl sub_8076918 - ldrb r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldrb r0, [r5] - bl sub_805E408 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064D60 - str r1, [r0] -_08064F0C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064E50 - - thumb_func_start sub_8064F40 -sub_8064F40: @ 8064F40 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _08064F72 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08064F72: - ldr r4, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r5] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08064FDC - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _08064FDC - adds r0, r3, r4 - bl DestroySprite - ldrb r4, [r5] - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064E50 - str r1, [r0] -_08064FDC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8064F40 - - thumb_func_start sub_8065008 -sub_8065008: @ 8065008 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0806502A - bl LinkOpponentBufferExecCompleted -_0806502A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8065008 - - thumb_func_start sub_8065038 -sub_8065038: @ 8065038 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0806505A - bl LinkOpponentBufferExecCompleted -_0806505A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8065038 - - thumb_func_start LinkOpponentBufferExecCompleted -LinkOpponentBufferExecCompleted: @ 8065068 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkOpponentBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080650BC - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _080650CE - .pool -_080650BC: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_080650CE: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkOpponentBufferExecCompleted - - thumb_func_start dp01t_00_2_getattr -dp01t_00_2_getattr: @ 80650E0 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08065118 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_opponent_pokemon - adds r6, r0, 0 - b _0806513A - .pool -_08065118: - ldrb r4, [r1] - movs r5, 0 -_0806511C: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08065132 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_opponent_pokemon - adds r6, r0 -_08065132: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0806511C -_0806513A: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl LinkOpponentBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end dp01t_00_2_getattr - - thumb_func_start dp01_getattr_by_ch1_for_opponent_pokemon -dp01_getattr_by_ch1_for_opponent_pokemon: @ 8065154 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0806517E - bl _080658EA -_0806517E: - lsls r0, 2 - ldr r1, =_08065194 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08065194: - .4byte _08065284 - .4byte _080654A8 - .4byte _080654B8 - .4byte _080654C8 - .4byte _08065530 - .4byte _08065530 - .4byte _08065530 - .4byte _08065530 - .4byte _0806554C - .4byte _08065588 - .4byte _08065588 - .4byte _08065588 - .4byte _08065588 - .4byte _080658EA - .4byte _080658EA - .4byte _080658EA - .4byte _080658EA - .4byte _080655A4 - .4byte _080655B4 - .4byte _080655E4 - .4byte _080655F4 - .4byte _08065604 - .4byte _08065614 - .4byte _08065624 - .4byte _08065634 - .4byte _08065644 - .4byte _08065654 - .4byte _08065664 - .4byte _08065674 - .4byte _08065684 - .4byte _08065694 - .4byte _080656A4 - .4byte _080656F4 - .4byte _08065704 - .4byte _08065714 - .4byte _08065724 - .4byte _08065734 - .4byte _08065744 - .4byte _08065754 - .4byte _08065764 - .4byte _08065774 - .4byte _080657A8 - .4byte _080657B8 - .4byte _080657C8 - .4byte _080657D8 - .4byte _080657E8 - .4byte _080657F8 - .4byte _08065808 - .4byte _08065818 - .4byte _08065838 - .4byte _08065848 - .4byte _08065858 - .4byte _08065868 - .4byte _08065878 - .4byte _08065888 - .4byte _08065898 - .4byte _080658A8 - .4byte _080658B8 - .4byte _080658C8 - .4byte _080658D8 -_08065284: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_080652D0: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _080652D0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_08065488: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _08065488 - b _080658EA - .pool -_080654A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - b _08065822 - .pool -_080654B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xC - b _08065822 - .pool -_080654C8: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - mov r8, r9 -_080654DE: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _080654DE - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0806551C: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0806551C - b _080658EA - .pool -_08065530: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _08065822 - .pool -_0806554C: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gEnemyParty - mov r8, r2 -_08065558: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _08065558 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _080658EA - .pool -_08065588: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _080658E2 - .pool -_080655A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1 - b _080655BE - .pool -_080655B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x19 -_080655BE: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _080658EA - .pool -_080655E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1A - b _080658E2 - .pool -_080655F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1B - b _080658E2 - .pool -_08065604: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1C - b _080658E2 - .pool -_08065614: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1D - b _080658E2 - .pool -_08065624: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1E - b _080658E2 - .pool -_08065634: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1F - b _080658E2 - .pool -_08065644: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x20 - b _080658E2 - .pool -_08065654: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x22 - b _080658E2 - .pool -_08065664: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x23 - b _080658E2 - .pool -_08065674: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x24 - b _080658E2 - .pool -_08065684: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x25 - b _080658E2 - .pool -_08065694: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x26 - b _080658E2 - .pool -_080656A4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _080658EA - .pool -_080656F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x27 - b _080658E2 - .pool -_08065704: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x28 - b _080658E2 - .pool -_08065714: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x29 - b _080658E2 - .pool -_08065724: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2A - b _080658E2 - .pool -_08065734: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2B - b _080658E2 - .pool -_08065744: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2C - b _080658E2 - .pool -_08065754: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0 - b _0806577E - .pool -_08065764: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x9 - b _08065822 - .pool -_08065774: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x37 -_0806577E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _080658EA - .pool -_080657A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x38 - b _080658E2 - .pool -_080657B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - b _08065822 - .pool -_080657C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - b _08065822 - .pool -_080657D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3B - b _08065822 - .pool -_080657E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3C - b _08065822 - .pool -_080657F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3D - b _08065822 - .pool -_08065808: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3E - b _08065822 - .pool -_08065818: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3F -_08065822: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _080658EA - .pool -_08065838: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x16 - b _080658E2 - .pool -_08065848: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x17 - b _080658E2 - .pool -_08065858: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x18 - b _080658E2 - .pool -_08065868: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x21 - b _080658E2 - .pool -_08065878: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2F - b _080658E2 - .pool -_08065888: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x30 - b _080658E2 - .pool -_08065898: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x32 - b _080658E2 - .pool -_080658A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x33 - b _080658E2 - .pool -_080658B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x34 - b _080658E2 - .pool -_080658C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x35 - b _080658E2 - .pool -_080658D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x36 -_080658E2: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_080658EA: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_opponent_pokemon - - thumb_func_start sub_8065900 -sub_8065900: @ 8065900 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8065900 - - thumb_func_start sub_806590C -sub_806590C: @ 806590C - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0806593C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_8065964 - b _0806595A - .pool -_0806593C: - ldrb r4, [r1] - movs r5, 0 -_08065940: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0806594E - adds r0, r5, 0 - bl sub_8065964 -_0806594E: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08065940 -_0806595A: - bl LinkOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_806590C - - thumb_func_start sub_8065964 -sub_8065964: @ 8065964 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x38 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r4, r0, r2 - adds r7, r4, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r6, r3, 0 - adds r3, r2, 0 - cmp r0, 0x3B - bls _08065992 - bl _08066270 -_08065992: - lsls r0, 2 - ldr r1, =_080659A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080659A8: - .4byte _08065A98 - .4byte _08065C30 - .4byte _08065C4C - .4byte _08065C68 - .4byte _08065CBC - .4byte _08065CBC - .4byte _08065CBC - .4byte _08065CBC - .4byte _08065CDC - .4byte _08065D44 - .4byte _08065D44 - .4byte _08065D44 - .4byte _08065D44 - .4byte _08066270 - .4byte _08066270 - .4byte _08066270 - .4byte _08066270 - .4byte _08065D6C - .4byte _08065D88 - .4byte _08065DA4 - .4byte _08065DC0 - .4byte _08065DDC - .4byte _08065DF8 - .4byte _08065E14 - .4byte _08065E30 - .4byte _08065E4C - .4byte _08065E68 - .4byte _08065E84 - .4byte _08065EA0 - .4byte _08065EBC - .4byte _08065ED8 - .4byte _08065EF4 - .4byte _08065F68 - .4byte _08065F84 - .4byte _08065FA0 - .4byte _08065FBC - .4byte _08065FD8 - .4byte _08065FF4 - .4byte _08066010 - .4byte _0806602C - .4byte _08066048 - .4byte _08066064 - .4byte _08066080 - .4byte _0806609C - .4byte _080660B8 - .4byte _080660D4 - .4byte _080660F0 - .4byte _0806610C - .4byte _08066128 - .4byte _08066144 - .4byte _08066160 - .4byte _0806617C - .4byte _08066198 - .4byte _080661B4 - .4byte _080661D0 - .4byte _080661EC - .4byte _08066208 - .4byte _08066224 - .4byte _08066240 - .4byte _0806625C -_08065A98: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r7, 0 - bl SetMonData - adds r2, r7, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r7 - mov r10, r0 - adds r0, r7, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r7, 0x2 - str r0, [sp, 0x4] - adds r0, r7, 0x4 - str r0, [sp, 0x8] - adds r0, r7, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r6, r7, 0 - adds r6, 0x24 - adds r4, r7, 0 - adds r4, 0xC -_08065AFE: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08065AFE - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r7, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r7, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _08066270 - .pool -_08065C30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xB - bl SetMonData - b _08066270 - .pool -_08065C4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xC - bl SetMonData - b _08066270 - .pool -_08065C68: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r4 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r7, r1, r0 - adds r6, r4, 0 - adds r6, 0x8 -_08065C80: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08065C80 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _08066270 - .pool -_08065CBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _08065D5A - .pool -_08065CDC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x11 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _08066270 - .pool -_08065D44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_08065D5A: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _08066270 - .pool -_08065D6C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1 - bl SetMonData - b _08066270 - .pool -_08065D88: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x19 - bl SetMonData - b _08066270 - .pool -_08065DA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1A - bl SetMonData - b _08066270 - .pool -_08065DC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1B - bl SetMonData - b _08066270 - .pool -_08065DDC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1C - bl SetMonData - b _08066270 - .pool -_08065DF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1D - bl SetMonData - b _08066270 - .pool -_08065E14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1E - bl SetMonData - b _08066270 - .pool -_08065E30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1F - bl SetMonData - b _08066270 - .pool -_08065E4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x20 - bl SetMonData - b _08066270 - .pool -_08065E68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x22 - bl SetMonData - b _08066270 - .pool -_08065E84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x23 - bl SetMonData - b _08066270 - .pool -_08065EA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x24 - bl SetMonData - b _08066270 - .pool -_08065EBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x25 - bl SetMonData - b _08066270 - .pool -_08065ED8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x26 - bl SetMonData - b _08066270 - .pool -_08065EF4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x27 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08066002 - .pool -_08065F68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x27 - bl SetMonData - b _08066270 - .pool -_08065F84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x28 - bl SetMonData - b _08066270 - .pool -_08065FA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x29 - bl SetMonData - b _08066270 - .pool -_08065FBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2A - bl SetMonData - b _08066270 - .pool -_08065FD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2B - bl SetMonData - b _08066270 - .pool -_08065FF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 -_08066002: - movs r1, 0x2C - bl SetMonData - b _08066270 - .pool -_08066010: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0 - bl SetMonData - b _08066270 - .pool -_0806602C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x9 - bl SetMonData - b _08066270 - .pool -_08066048: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x37 - bl SetMonData - b _08066270 - .pool -_08066064: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x38 - bl SetMonData - b _08066270 - .pool -_08066080: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x39 - bl SetMonData - b _08066270 - .pool -_0806609C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3A - bl SetMonData - b _08066270 - .pool -_080660B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3B - bl SetMonData - b _08066270 - .pool -_080660D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3C - bl SetMonData - b _08066270 - .pool -_080660F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3D - bl SetMonData - b _08066270 - .pool -_0806610C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3E - bl SetMonData - b _08066270 - .pool -_08066128: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3F - bl SetMonData - b _08066270 - .pool -_08066144: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x16 - bl SetMonData - b _08066270 - .pool -_08066160: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x17 - bl SetMonData - b _08066270 - .pool -_0806617C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x18 - bl SetMonData - b _08066270 - .pool -_08066198: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x21 - bl SetMonData - b _08066270 - .pool -_080661B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2F - bl SetMonData - b _08066270 - .pool -_080661D0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x30 - bl SetMonData - b _08066270 - .pool -_080661EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x32 - bl SetMonData - b _08066270 - .pool -_08066208: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x33 - bl SetMonData - b _08066270 - .pool -_08066224: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x34 - bl SetMonData - b _08066270 - .pool -_08066240: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x35 - bl SetMonData - b _08066270 - .pool -_0806625C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x36 - bl SetMonData -_08066270: - add sp, 0x38 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8065964 - - thumb_func_start sub_8066284 -sub_8066284: @ 8066284 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gEnemyParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _080662DC - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_080662BA: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _080662BA -_080662DC: - bl LinkOpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066284 - - thumb_func_start sub_80662F8 -sub_80662F8: @ 80662F8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r7, =gBattlePartyID - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 1 - adds r0, r7 - ldrh r0, [r0] - movs r1, 0x64 - mov r10, r1 - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - ldr r1, =gEnemyParty - mov r9, r1 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r1, [r6] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - add r0, r9 - bl BattleLoadOpponentMonSpriteGfx - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldrb r4, [r6] - lsls r0, r4, 1 - adds r0, r7 - ldrh r0, [r0] - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064B04 - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80662F8 - - thumb_func_start sub_8066448 -sub_8066448: @ 8066448 - push {r4,lr} - ldr r1, =gBattlePartyID - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r2, r0, 1 - adds r2, r1 - ldr r3, =gBattleBufferA - lsls r0, 9 - adds r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2] - ldrb r0, [r4] - lsls r1, r0, 9 - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - bl sub_8066494 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064F40 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066448 - - thumb_func_start sub_8066494 -sub_8066494: @ 8066494 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_805EF84 - ldr r0, =gBattlePartyID - lsls r4, r6, 1 - adds r4, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4] - ldrh r0, [r4] - movs r1, 0x64 - mov r9, r1 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r10, r1 - add r10, r6 - mov r1, r10 - strb r0, [r1] - ldrh r0, [r4] - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - adds r0, r5 - adds r1, r6, 0 - bl BattleLoadOpponentMonSpriteGfx - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFE - bl sub_80753E8 - mov r1, r10 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066494 - - thumb_func_start sub_8066624 -sub_8066624: @ 8066624 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0806666C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80666BC - str r1, [r0] - b _080666A8 - .pool -_0806666C: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkOpponentBufferExecCompleted -_080666A8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066624 - - thumb_func_start sub_80666BC -sub_80666BC: @ 80666BC - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _080666E4 - cmp r0, 0x1 - beq _08066712 - b _0806673A - .pool -_080666E4: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080666FE - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_080666FE: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0806673A -_08066712: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0806673A - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x2 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064C58 - str r1, [r0] -_0806673A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80666BC - - thumb_func_start sub_8066748 -sub_8066748: @ 8066748 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r4, =gBattleTypeFlags - ldr r0, [r4] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08066840 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0xC8 - cmp r1, 0 - beq _08066770 - movs r7, 0x98 -_08066770: - ldr r0, [r4] - movs r1, 0x80 - lsls r1, 1 - ands r0, r1 - cmp r0, 0 - beq _080667A8 - ldrb r0, [r5] - cmp r0, 0x1 - bne _08066794 - ldr r0, =gTrainerBattleOpponent_A - b _08066796 - .pool -_08066794: - ldr r0, =gTrainerBattleOpponent_B -_08066796: - ldrh r0, [r0] - bl sub_8162AA0 - lsls r0, 24 - lsrs r0, 24 - b _0806694C - .pool -_080667A8: - ldrb r0, [r5] - bl sub_806D864 - ldr r6, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _080667D8 - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _080667F4 -_080667D8: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _080668AA - b _080668BC - .pool -_080667F4: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _08066822 - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _08066838 -_08066822: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _08066916 - b _08066924 -_08066838: - ldrb r0, [r5] - bl sub_806D864 - b _0806693A -_08066840: - movs r7, 0xB0 - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 4 - cmp r1, r0 - bne _08066858 - bl sub_8068B48 - b _08066948 - .pool -_08066858: - bl GetMultiplayerId - ldr r6, =gLinkPlayers - movs r5, 0x1 - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _08066892 - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _080668C8 -_08066892: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - beq _080668BC -_080668AA: - ldr r0, =gUnknown_0831F578 - adds r0, 0x4F - ldrb r0, [r0] - b _0806694C - .pool -_080668BC: - ldr r0, =gUnknown_0831F578 - adds r0, 0x4E - ldrb r0, [r0] - b _0806694C - .pool -_080668C8: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _080668FE - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _08066930 -_080668FE: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - cmp r0, 0 - beq _08066924 -_08066916: - ldr r0, =gUnknown_0831F578 - adds r0, 0x51 - ldrb r0, [r0] - b _0806694C - .pool -_08066924: - ldr r0, =gUnknown_0831F578 - adds r0, 0x50 - ldrb r0, [r0] - b _0806694C - .pool -_08066930: - bl GetMultiplayerId - eors r0, r5 - lsls r0, 24 - lsrs r0, 24 -_0806693A: - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - bl sub_806F000 -_08066948: - lsls r0, 16 - lsrs r0, 16 -_0806694C: - mov r8, r0 - ldr r5, =gActiveBank - ldrb r1, [r5] - bl sub_805DF38 - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r9, r7 - ldr r1, =gTrainerFrontPicCoords - mov r2, r8 - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 14 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r5] - adds r1, r6 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r1, r8 - strh r1, [r0, 0x6] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064400 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066748 - - thumb_func_start sub_8066A58 -sub_8066A58: @ 8066A58 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08066A74 - ldr r0, =gTrainerBattleOpponent_A - b _08066A76 - .pool -_08066A74: - ldr r0, =gTrainerBattleOpponent_B -_08066A76: - ldrh r0, [r0] - bl sub_8162AA0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - bl sub_805DF38 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r2, =gTrainerFrontPicCoords - mov r3, r8 - lsls r1, r3, 2 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 14 - adds r2, r1 - asrs r2, 16 - movs r1, 0xB0 - movs r3, 0x1E - bl CreateSprite - ldr r5, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r5 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x60 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x20] - adds r1, 0x20 - strh r1, [r0, 0x20] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r6] - adds r1, r5 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r3, r8 - strh r3, [r0, 0x6] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064438 - str r1, [r0] - bl LinkOpponentBufferExecCompleted - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066A58 - - thumb_func_start sub_8066B94 -sub_8066B94: @ 8066B94 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064470 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066B94 - - thumb_func_start sub_8066C40 -sub_8066C40: @ 8066C40 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _08066C94 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08066C74 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08066C74: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _08066CD0 - .pool -_08066C94: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08066CD0 - strb r0, [r3, 0x4] - movs r0, 0x10 - movs r1, 0x3F - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039934 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064C14 - str r1, [r0] -_08066CD0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066C40 - - thumb_func_start sub_8066CEC -sub_8066CEC: @ 8066CEC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8066CEC - - thumb_func_start sub_8066CF8 -sub_8066CF8: @ 8066CF8 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8066CF8 - - thumb_func_start sub_8066D04 -sub_8066D04: @ 8066D04 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8066D04 - - thumb_func_start sub_8066D10 -sub_8066D10: @ 8066D10 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8066D10 - - thumb_func_start sub_8066D1C -sub_8066D1C: @ 8066D1C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _08066D32 - b _08066E58 -_08066D32: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r1, [r5] - lsls r1, 9 - adds r0, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - mov r0, r12 - adds r0, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r6, r0 - ldr r0, =gAnimMoveTurn - mov r8, r0 - mov r0, r12 - adds r0, 0x3 - adds r1, r0 - ldrb r0, [r1] - mov r1, r8 - strb r0, [r1] - ldr r3, =gAnimMovePower - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x4 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x5 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r3] - ldr r3, =gAnimMoveDmg - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x6 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x7 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - mov r0, r12 - adds r0, 0x8 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r2, r0 - mov r0, r12 - adds r0, 0x9 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 24 - orrs r2, r0 - str r2, [r3] - ldr r2, =gAnimFriendship - ldrb r0, [r5] - lsls r0, 9 - mov r1, r12 - adds r1, 0xA - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r4, =gWeatherMoveAnim - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0xC - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0xD - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r4] - ldr r7, =gAnimDisableStructPtr - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x10 - adds r1, r0 - str r1, [r7] - ldr r2, =gUnknown_020244BC - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - str r1, [r0] - mov r0, r8 - ldrb r1, [r0] - adds r0, r6, 0 - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _08066E30 - bl LinkOpponentBufferExecCompleted - b _08066E58 - .pool -_08066E30: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8066E70 - str r1, [r0] - ldrh r1, [r4] - ldr r2, [r7] - adds r0, r6, 0 - bl sub_817E0FC -_08066E58: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066D1C - - thumb_func_start sub_8066E70 -sub_8066E70: @ 8066E70 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _08066F08 - cmp r2, 0x1 - bgt _08066EC8 - cmp r2, 0 - beq _08066ED2 - b _08066FE4 - .pool -_08066EC8: - cmp r2, 0x2 - beq _08066F32 - cmp r2, 0x3 - beq _08066FA8 - b _08066FE4 -_08066ED2: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _08066EF4 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08066EF4: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08066FE4 -_08066F08: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08066FE4 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _08066FE4 -_08066F32: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _08066FE4 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08066F80 - mov r0, r8 - cmp r0, 0x1 - bhi _08066F80 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_08066F80: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _08066FE4 - .pool -_08066FA8: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08066FE4 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl LinkOpponentBufferExecCompleted -_08066FE4: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8066E70 - - thumb_func_start sub_8066FF4 -sub_8066FF4: @ 8066FF4 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064CCC - str r1, [r0] - ldrh r0, [r4] - bl sub_817C95C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8066FF4 - - thumb_func_start sub_806704C -sub_806704C: @ 806704C - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_806704C - - thumb_func_start sub_8067058 -sub_8067058: @ 8067058 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067058 - - thumb_func_start sub_8067064 -sub_8067064: @ 8067064 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067064 - - thumb_func_start sub_8067070 -sub_8067070: @ 8067070 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067070 - - thumb_func_start sub_806707C -sub_806707C: @ 806707C - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_806707C - - thumb_func_start sub_8067088 -sub_8067088: @ 8067088 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067088 - - thumb_func_start sub_8067094 -sub_8067094: @ 8067094 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067094 - - thumb_func_start sub_80670A0 -sub_80670A0: @ 80670A0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _08067130 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gEnemyParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0806715A - .pool -_08067130: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0806715A: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064BC0 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80670A0 - - thumb_func_start sub_8067190 -sub_8067190: @ 8067190 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067190 - - thumb_func_start sub_806719C -sub_806719C: @ 806719C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _080671F0 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8065008 - str r1, [r0] -_080671F0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806719C - - thumb_func_start sub_8067214 -sub_8067214: @ 8067214 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08067264 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl move_anim_start_t2_for_situation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8065008 - str r1, [r0] -_08067264: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067214 - - thumb_func_start sub_806727C -sub_806727C: @ 806727C - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_806727C - - thumb_func_start sub_8067288 -sub_8067288: @ 8067288 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067288 - - thumb_func_start sub_8067294 -sub_8067294: @ 8067294 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8067294 - - thumb_func_start sub_80672A0 -sub_80672A0: @ 80672A0 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80672A0 - - thumb_func_start sub_80672AC -sub_80672AC: @ 80672AC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80672AC - - thumb_func_start sub_80672B8 -sub_80672B8: @ 80672B8 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80672B8 - - thumb_func_start sub_80672C4 -sub_80672C4: @ 80672C4 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80672C4 - - thumb_func_start sub_80672D0 -sub_80672D0: @ 80672D0 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80672D0 - - thumb_func_start sub_80672DC -sub_80672DC: @ 80672DC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80672DC - - thumb_func_start sub_80672E8 -sub_80672E8: @ 80672E8 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_80672E8 - - thumb_func_start sub_8067304 -sub_8067304: @ 8067304 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067304 - - thumb_func_start sub_806733C -sub_806733C: @ 806733C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_806733C - - thumb_func_start sub_8067354 -sub_8067354: @ 8067354 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067354 - - thumb_func_start sub_806737C -sub_806737C: @ 806737C - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080673B0 - bl LinkOpponentBufferExecCompleted - b _080673DA - .pool -_080673B0: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064CE4 - str r1, [r0] -_080673DA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806737C - - thumb_func_start sub_80673EC -sub_80673EC: @ 80673EC - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80673EC - - thumb_func_start sub_80673F8 -sub_80673F8: @ 80673F8 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0806740C - movs r3, 0xC0 -_0806740C: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl LinkOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80673F8 - - thumb_func_start sub_806743C -sub_806743C: @ 806743C - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _08067478 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0806748C - .pool -_08067478: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0806748C: - bl LinkOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_806743C - - thumb_func_start sub_8067498 -sub_8067498: @ 8067498 - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - movs r2, 0x5 - bl PlayCry3 - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067498 - - thumb_func_start sub_80674D4 -sub_80674D4: @ 80674D4 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_80674D4 - - thumb_func_start sub_8067508 -sub_8067508: @ 8067508 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_80676FC - bl StoreSpriteCallbackInData6 - ldr r0, =c3_08038DC4 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r6] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080675CA - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_080675CA: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_28 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067508 - - thumb_func_start c3_08038DC4 -c3_08038DC4: @ 8067618 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08067652 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08067684 -_08067652: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_8066494 - b _080676C4 - .pool -_08067684: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r6, =gBattlePartyID - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_8066494 - ldrb r0, [r7] - movs r5, 0x2 - eors r0, r5 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_8066494 - ldrb r0, [r7] - eors r0, r5 - strb r0, [r7] -_080676C4: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8064734 - str r1, [r0] - mov r0, r9 - strb r0, [r2] - mov r0, r8 - bl DestroyTask - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c3_08038DC4 - - thumb_func_start sub_80676FC -sub_80676FC: @ 80676FC - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x6] - bl sub_805DFE4 - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80676FC - - thumb_func_start sub_8067718 -sub_8067718: @ 8067718 - push {r4-r7,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08067748 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08067748 - bl LinkOpponentBufferExecCompleted - b _08067812 - .pool -_08067748: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldr r1, =gBattleBufferA - ldrb r2, [r3] - lsls r0, r2, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r3, 0 - cmp r0, 0 - beq _080677B4 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r2, [r3, 0x1] - lsls r1, r2, 27 - lsrs r0, r1, 28 - cmp r0, 0x1 - bhi _080677AC - adds r0, 0x1 - movs r1, 0xF - ands r0, r1 - lsls r0, 1 - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x1] - b _08067812 - .pool -_080677AC: - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - strb r0, [r3, 0x1] -_080677B4: - adds r5, r7, 0 - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08067806 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_08067806: - ldr r0, =gBattleBankFunc - ldrb r1, [r7] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_806782C - str r0, [r1] -_08067812: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067718 - - thumb_func_start sub_806782C -sub_806782C: @ 806782C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _08067864 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x5] - bl LinkOpponentBufferExecCompleted -_08067864: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806782C - - thumb_func_start sub_8067874 -sub_8067874: @ 8067874 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080678A6 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_080678A6: - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067874 - - thumb_func_start sub_80678C4 -sub_80678C4: @ 80678C4 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80678C4 - - thumb_func_start sub_80678D0 -sub_80678D0: @ 80678D0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _08067916 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl sub_805E408 -_08067916: - bl LinkOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80678D0 - - thumb_func_start sub_8067930 -sub_8067930: @ 8067930 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08067992 - ldr r4, =gBattleBufferA - ldrb r2, [r5] - lsls r1, r2, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - adds r0, r4, 0x2 - adds r0, r1, r0 - ldrb r3, [r0] - adds r4, 0x3 - adds r1, r4 - ldrb r0, [r1] - lsls r0, 8 - orrs r3, r0 - str r3, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - adds r3, r6, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _08067980 - bl LinkOpponentBufferExecCompleted - b _0806798C - .pool -_08067980: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8065038 - str r0, [r1] -_0806798C: - adds r0, r6, 0 - bl sub_817E32C -_08067992: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8067930 - - thumb_func_start sub_80679A4 -sub_80679A4: @ 80679A4 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - bl sub_81851A8 - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_80679A4 - - thumb_func_start sub_80679C4 -sub_80679C4: @ 80679C4 - push {lr} - bl LinkOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80679C4 - - thumb_func_start sub_80679D0 -sub_80679D0: @ 80679D0 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r0, r4 - bl sub_81851A8 - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x3 - adds r0, r4 - ldrb r2, [r0] - cmp r2, 0x3 - bne _08067A00 - ldr r0, =gBattleOutcome - strb r2, [r0] - b _08067A08 - .pool -_08067A00: - ldr r0, =gBattleOutcome - movs r1, 0x3 - eors r1, r2 - strb r1, [r0] -_08067A08: - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =0x00000ca9 - adds r3, r1 - movs r1, 0x1 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r3] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl LinkOpponentBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80679D0 - - thumb_func_start nullsub_92 -nullsub_92: @ 8067A70 - bx lr - thumb_func_end nullsub_92 - - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s deleted file mode 100644 index adc5cdb84..000000000 --- a/asm/battle_controller_linkpartner.s +++ /dev/null @@ -1,5647 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start nullsub_112 -nullsub_112: @ 814AEAC - bx lr - thumb_func_end nullsub_112 - - thumb_func_start SetBankFuncToLinkPartnerBufferRunCommand -SetBankFuncToLinkPartnerBufferRunCommand: @ 814AEB0 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkPartnerBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToLinkPartnerBufferRunCommand - - thumb_func_start LinkPartnerBufferRunCommand -LinkPartnerBufferRunCommand: @ 814AECC - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _0814AF18 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0814AF14 - ldr r0, =gLinkPartnerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _0814AF18 - .pool -_0814AF14: - bl LinkPartnerBufferExecCompleted -_0814AF18: - pop {r0} - bx r0 - thumb_func_end LinkPartnerBufferRunCommand - - thumb_func_start sub_814AF1C -sub_814AF1C: @ 814AF1C - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0814AF40 - bl LinkPartnerBufferExecCompleted -_0814AF40: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814AF1C - - thumb_func_start sub_814AF54 -sub_814AF54: @ 814AF54 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0814AFA4 - movs r0, 0 - bl nullsub_25 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - bl LinkPartnerBufferExecCompleted -_0814AFA4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814AF54 - - thumb_func_start sub_814AFBC -sub_814AFBC: @ 814AFBC - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _0814AFF4 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl LinkPartnerBufferExecCompleted -_0814AFF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814AFBC - - thumb_func_start sub_814B004 -sub_814B004: @ 814B004 - push {r4-r6,lr} - movs r6, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814B028 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814B05C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0814B05C -_0814B028: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0814B094 - b _0814B092 - .pool -_0814B05C: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r2, 0 - adds r4, 0x1C - adds r0, r4 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - cmp r2, r0 - bne _0814B094 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r2 - bne _0814B094 -_0814B092: - movs r6, 0x1 -_0814B094: - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - beq _0814B0A0 - movs r6, 0 -_0814B0A0: - cmp r6, 0 - beq _0814B0C6 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814AFBC - str r1, [r0] -_0814B0C6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B004 - - thumb_func_start sub_814B0E8 -sub_814B0E8: @ 814B0E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gBattleSpritesDataPtr - mov r12, r0 - ldr r0, [r0] - ldr r7, =gActiveBank - ldrb r2, [r7] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4] - movs r5, 0x8 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _0814B114 - b _0814B252 -_0814B114: - movs r1, 0x2 - mov r8, r1 - adds r1, r2, 0 - mov r0, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _0814B136 - b _0814B252 -_0814B136: - ldr r1, =gSprites - mov r10, r1 - ldr r0, =gUnknown_03005D7C - mov r9, r0 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r5, r10 - adds r5, 0x1C - adds r0, r5 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _0814B252 - ldr r0, =gBankSpriteIds - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r3 - bne _0814B252 - ldrb r0, [r4, 0x9] - adds r0, 0x1 - strb r0, [r4, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0814B252 - mov r1, r12 - ldr r0, [r1] - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r6, [r0, 0x9] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814B1F0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0814B1F0 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - add r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r0, [r7] - mov r1, r8 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - bl sub_8076918 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0814B1F0: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldr r5, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B004 - str r1, [r0] -_0814B252: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B0E8 - - thumb_func_start sub_814B290 -sub_814B290: @ 814B290 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _0814B2BE - movs r2, 0x24 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _0814B2BE - bl LinkPartnerBufferExecCompleted -_0814B2BE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B290 - - thumb_func_start bx_t4_healthbar_update -bx_t4_healthbar_update: @ 814B2D0 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r6, =gHealthBoxesIds - adds r1, r0, r6 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0814B318 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _0814B332 - .pool -_0814B318: - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl LinkPartnerBufferExecCompleted -_0814B332: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_t4_healthbar_update - - thumb_func_start sub_814B340 -sub_814B340: @ 814B340 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r2, [r4] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r3, 0x22 - ldrsh r1, [r0, r3] - movs r3, 0x26 - ldrsh r0, [r0, r3] - adds r1, r0 - cmp r1, 0xA0 - ble _0814B3BC - ldr r1, =gBattlePartyID - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl nullsub_24 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkPartnerBufferExecCompleted -_0814B3BC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B340 - - thumb_func_start sub_814B3DC -sub_814B3DC: @ 814B3DC - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0814B430 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkPartnerBufferExecCompleted -_0814B430: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B3DC - - thumb_func_start bx_t4_button_a -bx_t4_button_a: @ 814B44C - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0814B45E - bl LinkPartnerBufferExecCompleted -_0814B45E: - pop {r0} - bx r0 - thumb_func_end bx_t4_button_a - - thumb_func_start dp01t_0F_4_move_anim -dp01t_0F_4_move_anim: @ 814B464 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _0814B4B0 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl LinkPartnerBufferExecCompleted - b _0814B4DA - .pool -_0814B4B0: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0814B4D4 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_0814B4D4: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_0814B4DA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end dp01t_0F_4_move_anim - - thumb_func_start sub_814B4E0 -sub_814B4E0: @ 814B4E0 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0814B532 - adds r0, r3, 0 - bl sub_805E408 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r2, [r4] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0814B526 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_0814B526: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_814B554 - str r0, [r1] -_0814B532: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B4E0 - - thumb_func_start sub_814B554 -sub_814B554: @ 814B554 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0814B590 - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0814B590 - bl LinkPartnerBufferExecCompleted -_0814B590: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B554 - - thumb_func_start sub_814B5A8 -sub_814B5A8: @ 814B5A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r7, =gActiveBank - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0814B664 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r0, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r0, =gBattlePartyID - mov r8, r0 - ldrb r1, [r7] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - bl sub_805E990 - ldr r1, =gBankSpriteIds - ldrb r0, [r7] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - lsls r1, 1 - add r1, r8 - ldrh r1, [r1] - muls r1, r6 - adds r1, r5 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - bl sub_8076918 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B4E0 - str r1, [r0] -_0814B664: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B5A8 - - thumb_func_start sub_814B69C -sub_814B69C: @ 814B69C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _0814B6CE - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0814B6CE: - ldr r5, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r4] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0814B714 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _0814B714 - adds r0, r3, r5 - bl DestroySprite - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B5A8 - str r1, [r0] -_0814B714: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B69C - - thumb_func_start LinkPartnerBufferExecCompleted -LinkPartnerBufferExecCompleted: @ 814B740 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =LinkPartnerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0814B794 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _0814B7A6 - .pool -_0814B794: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_0814B7A6: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LinkPartnerBufferExecCompleted - - thumb_func_start sub_814B7B8 -sub_814B7B8: @ 814B7B8 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0814B7DA - bl LinkPartnerBufferExecCompleted -_0814B7DA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B7B8 - - thumb_func_start sub_814B7E8 -sub_814B7E8: @ 814B7E8 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0814B80A - bl LinkPartnerBufferExecCompleted -_0814B80A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814B7E8 - - thumb_func_start dp01t_00_4_getattr -dp01t_00_4_getattr: @ 814B818 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0814B850 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_player_pokemon__ - adds r6, r0, 0 - b _0814B872 - .pool -_0814B850: - ldrb r4, [r1] - movs r5, 0 -_0814B854: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0814B86A - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_player_pokemon__ - adds r6, r0 -_0814B86A: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0814B854 -_0814B872: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl LinkPartnerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end dp01t_00_4_getattr - - thumb_func_start dp01_getattr_by_ch1_for_player_pokemon__ -dp01_getattr_by_ch1_for_player_pokemon__: @ 814B88C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0814B8B6 - bl _0814C022 -_0814B8B6: - lsls r0, 2 - ldr r1, =_0814B8CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0814B8CC: - .4byte _0814B9BC - .4byte _0814BBE0 - .4byte _0814BBF0 - .4byte _0814BC00 - .4byte _0814BC68 - .4byte _0814BC68 - .4byte _0814BC68 - .4byte _0814BC68 - .4byte _0814BC84 - .4byte _0814BCC0 - .4byte _0814BCC0 - .4byte _0814BCC0 - .4byte _0814BCC0 - .4byte _0814C022 - .4byte _0814C022 - .4byte _0814C022 - .4byte _0814C022 - .4byte _0814BCDC - .4byte _0814BCEC - .4byte _0814BD1C - .4byte _0814BD2C - .4byte _0814BD3C - .4byte _0814BD4C - .4byte _0814BD5C - .4byte _0814BD6C - .4byte _0814BD7C - .4byte _0814BD8C - .4byte _0814BD9C - .4byte _0814BDAC - .4byte _0814BDBC - .4byte _0814BDCC - .4byte _0814BDDC - .4byte _0814BE2C - .4byte _0814BE3C - .4byte _0814BE4C - .4byte _0814BE5C - .4byte _0814BE6C - .4byte _0814BE7C - .4byte _0814BE8C - .4byte _0814BE9C - .4byte _0814BEAC - .4byte _0814BEE0 - .4byte _0814BEF0 - .4byte _0814BF00 - .4byte _0814BF10 - .4byte _0814BF20 - .4byte _0814BF30 - .4byte _0814BF40 - .4byte _0814BF50 - .4byte _0814BF70 - .4byte _0814BF80 - .4byte _0814BF90 - .4byte _0814BFA0 - .4byte _0814BFB0 - .4byte _0814BFC0 - .4byte _0814BFD0 - .4byte _0814BFE0 - .4byte _0814BFF0 - .4byte _0814C000 - .4byte _0814C010 -_0814B9BC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_0814BA08: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _0814BA08 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_0814BBC0: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _0814BBC0 - b _0814C022 - .pool -_0814BBE0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _0814BF5A - .pool -_0814BBF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _0814BF5A - .pool -_0814BC00: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_0814BC16: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0814BC16 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0814BC54: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0814BC54 - b _0814C022 - .pool -_0814BC68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _0814BF5A - .pool -_0814BC84: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_0814BC90: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0814BC90 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0814C022 - .pool -_0814BCC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _0814C01A - .pool -_0814BCDC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0814BCF6 - .pool -_0814BCEC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0814BCF6: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0814C022 - .pool -_0814BD1C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _0814C01A - .pool -_0814BD2C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _0814C01A - .pool -_0814BD3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _0814C01A - .pool -_0814BD4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _0814C01A - .pool -_0814BD5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _0814C01A - .pool -_0814BD6C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _0814C01A - .pool -_0814BD7C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _0814C01A - .pool -_0814BD8C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _0814C01A - .pool -_0814BD9C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _0814C01A - .pool -_0814BDAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _0814C01A - .pool -_0814BDBC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _0814C01A - .pool -_0814BDCC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _0814C01A - .pool -_0814BDDC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0814C022 - .pool -_0814BE2C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _0814C01A - .pool -_0814BE3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _0814C01A - .pool -_0814BE4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _0814C01A - .pool -_0814BE5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _0814C01A - .pool -_0814BE6C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _0814C01A - .pool -_0814BE7C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _0814C01A - .pool -_0814BE8C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0814BEB6 - .pool -_0814BE9C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _0814BF5A - .pool -_0814BEAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0814BEB6: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0814C022 - .pool -_0814BEE0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _0814C01A - .pool -_0814BEF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _0814BF5A - .pool -_0814BF00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _0814BF5A - .pool -_0814BF10: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _0814BF5A - .pool -_0814BF20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _0814BF5A - .pool -_0814BF30: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _0814BF5A - .pool -_0814BF40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _0814BF5A - .pool -_0814BF50: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_0814BF5A: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0814C022 - .pool -_0814BF70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _0814C01A - .pool -_0814BF80: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _0814C01A - .pool -_0814BF90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _0814C01A - .pool -_0814BFA0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _0814C01A - .pool -_0814BFB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _0814C01A - .pool -_0814BFC0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _0814C01A - .pool -_0814BFD0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _0814C01A - .pool -_0814BFE0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _0814C01A - .pool -_0814BFF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _0814C01A - .pool -_0814C000: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _0814C01A - .pool -_0814C010: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_0814C01A: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0814C022: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_player_pokemon__ - - thumb_func_start sub_814C038 -sub_814C038: @ 814C038 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814C038 - - thumb_func_start sub_814C044 -sub_814C044: @ 814C044 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0814C074 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_814C09C - b _0814C092 - .pool -_0814C074: - ldrb r4, [r1] - movs r5, 0 -_0814C078: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0814C086 - adds r0, r5, 0 - bl sub_814C09C -_0814C086: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0814C078 -_0814C092: - bl LinkPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_814C044 - - thumb_func_start sub_814C09C -sub_814C09C: @ 814C09C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _0814C0C8 - bl _0814CA62 -_0814C0C8: - lsls r0, 2 - ldr r1, =_0814C0E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0814C0E0: - .4byte _0814C1D0 - .4byte _0814C368 - .4byte _0814C388 - .4byte _0814C3A8 - .4byte _0814C400 - .4byte _0814C400 - .4byte _0814C400 - .4byte _0814C400 - .4byte _0814C428 - .4byte _0814C48C - .4byte _0814C48C - .4byte _0814C48C - .4byte _0814C48C - .4byte _0814CA62 - .4byte _0814CA62 - .4byte _0814CA62 - .4byte _0814CA62 - .4byte _0814C4BC - .4byte _0814C4DC - .4byte _0814C4FC - .4byte _0814C51C - .4byte _0814C53C - .4byte _0814C55C - .4byte _0814C57C - .4byte _0814C59C - .4byte _0814C5BC - .4byte _0814C5DC - .4byte _0814C5FC - .4byte _0814C61C - .4byte _0814C63C - .4byte _0814C65C - .4byte _0814C67C - .4byte _0814C6EC - .4byte _0814C70C - .4byte _0814C72C - .4byte _0814C74C - .4byte _0814C76C - .4byte _0814C78C - .4byte _0814C7AC - .4byte _0814C7CC - .4byte _0814C7EC - .4byte _0814C80C - .4byte _0814C82C - .4byte _0814C84C - .4byte _0814C86C - .4byte _0814C88C - .4byte _0814C8AC - .4byte _0814C8CC - .4byte _0814C8EC - .4byte _0814C90C - .4byte _0814C92C - .4byte _0814C94C - .4byte _0814C96C - .4byte _0814C98C - .4byte _0814C9AC - .4byte _0814C9CC - .4byte _0814C9EC - .4byte _0814CA0C - .4byte _0814CA2C - .4byte _0814CA4C -_0814C1D0: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_0814C236: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0814C236 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0814CA62 - .pool -_0814C368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _0814CA62 - .pool -_0814C388: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _0814CA62 - .pool -_0814C3A8: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0814C3C2: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0814C3C2 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0814CA62 - .pool -_0814C400: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0814C4A4 - .pool -_0814C428: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0814CA62 - .pool -_0814C48C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0814C4A4: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0814CA62 - .pool -_0814C4BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _0814CA62 - .pool -_0814C4DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _0814CA62 - .pool -_0814C4FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _0814CA62 - .pool -_0814C51C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _0814CA62 - .pool -_0814C53C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _0814CA62 - .pool -_0814C55C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _0814CA62 - .pool -_0814C57C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _0814CA62 - .pool -_0814C59C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _0814CA62 - .pool -_0814C5BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _0814CA62 - .pool -_0814C5DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _0814CA62 - .pool -_0814C5FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _0814CA62 - .pool -_0814C61C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _0814CA62 - .pool -_0814C63C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _0814CA62 - .pool -_0814C65C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _0814CA62 - .pool -_0814C67C: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _0814C79C - .pool -_0814C6EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _0814CA62 - .pool -_0814C70C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _0814CA62 - .pool -_0814C72C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _0814CA62 - .pool -_0814C74C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _0814CA62 - .pool -_0814C76C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _0814CA62 - .pool -_0814C78C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_0814C79C: - movs r1, 0x2C - bl SetMonData - b _0814CA62 - .pool -_0814C7AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _0814CA62 - .pool -_0814C7CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _0814CA62 - .pool -_0814C7EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _0814CA62 - .pool -_0814C80C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _0814CA62 - .pool -_0814C82C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _0814CA62 - .pool -_0814C84C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _0814CA62 - .pool -_0814C86C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _0814CA62 - .pool -_0814C88C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _0814CA62 - .pool -_0814C8AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _0814CA62 - .pool -_0814C8CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _0814CA62 - .pool -_0814C8EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _0814CA62 - .pool -_0814C90C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _0814CA62 - .pool -_0814C92C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _0814CA62 - .pool -_0814C94C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _0814CA62 - .pool -_0814C96C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _0814CA62 - .pool -_0814C98C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _0814CA62 - .pool -_0814C9AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _0814CA62 - .pool -_0814C9CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _0814CA62 - .pool -_0814C9EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _0814CA62 - .pool -_0814CA0C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _0814CA62 - .pool -_0814CA2C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _0814CA62 - .pool -_0814CA4C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_0814CA62: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814C09C - - thumb_func_start sub_814CA98 -sub_814CA98: @ 814CA98 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _0814CAF0 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_0814CACE: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _0814CACE -_0814CAF0: - bl LinkPartnerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CA98 - - thumb_func_start sub_814CB0C -sub_814CB0C: @ 814CB0C - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B290 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CB0C - - thumb_func_start sub_814CC28 -sub_814CC28: @ 814CC28 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl sub_805EF84 - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - strh r0, [r1] - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_814CC98 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B69C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CC28 - - thumb_func_start sub_814CC98 -sub_814CC98: @ 814CC98 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_805EF84 - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CC98 - - thumb_func_start sub_814CE14 -sub_814CE14: @ 814CE14 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0814CE5C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814CEA4 - str r1, [r0] - b _0814CE92 - .pool -_0814CE5C: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl LinkPartnerBufferExecCompleted -_0814CE92: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CE14 - - thumb_func_start sub_814CEA4 -sub_814CEA4: @ 814CEA4 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0814CECC - cmp r0, 0x1 - beq _0814CEFA - b _0814CF22 - .pool -_0814CECC: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0814CEE6 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0814CEE6: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0814CF22 -_0814CEFA: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0814CF22 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B3DC - str r1, [r0] -_0814CF22: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CEA4 - - thumb_func_start sub_814CF30 -sub_814CF30: @ 814CF30 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0814CF60 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0x20 - cmp r1, 0 - beq _0814CF62 - movs r7, 0x5A - b _0814CF62 - .pool -_0814CF60: - movs r7, 0x50 -_0814CF62: - ldr r5, =gActiveBank - ldrb r0, [r5] - bl sub_806D864 - ldr r6, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0814CF94 - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0814CFB0 -_0814CF94: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x2 - b _0814D002 - .pool -_0814CFB0: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0814CFDE - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _0814CFF2 -_0814CFDE: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x4 - b _0814D002 -_0814CFF2: - ldrb r0, [r5] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r4, [r1, 0x13] -_0814D002: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r7 - ldr r0, =gTrainerBackPicCoords - lsls r4, 2 - adds r4, r0 - ldrb r0, [r4] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 15 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814AF1C - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814CF30 - - thumb_func_start sub_814D0E4 -sub_814D0E4: @ 814D0E4 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D0E4 - - thumb_func_start sub_814D0F0 -sub_814D0F0: @ 814D0F0 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814AF54 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D0F0 - - thumb_func_start sub_814D19C -sub_814D19C: @ 814D19C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _0814D1F0 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0814D1D0 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0814D1D0: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _0814D266 - .pool -_0814D1F0: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0814D266 - strb r4, [r3, 0x4] - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B340 - str r1, [r0] -_0814D266: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D19C - - thumb_func_start sub_814D288 -sub_814D288: @ 814D288 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D288 - - thumb_func_start sub_814D294 -sub_814D294: @ 814D294 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D294 - - thumb_func_start sub_814D2A0 -sub_814D2A0: @ 814D2A0 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D2A0 - - thumb_func_start sub_814D2AC -sub_814D2AC: @ 814D2AC - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D2AC - - thumb_func_start sub_814D2B8 -sub_814D2B8: @ 814D2B8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _0814D2CE - b _0814D3F4 -_0814D2CE: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r1, [r5] - lsls r1, 9 - adds r0, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - mov r0, r12 - adds r0, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r6, r0 - ldr r0, =gAnimMoveTurn - mov r8, r0 - mov r0, r12 - adds r0, 0x3 - adds r1, r0 - ldrb r0, [r1] - mov r1, r8 - strb r0, [r1] - ldr r3, =gAnimMovePower - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x4 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x5 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r3] - ldr r3, =gAnimMoveDmg - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x6 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x7 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - mov r0, r12 - adds r0, 0x8 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r2, r0 - mov r0, r12 - adds r0, 0x9 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 24 - orrs r2, r0 - str r2, [r3] - ldr r2, =gAnimFriendship - ldrb r0, [r5] - lsls r0, 9 - mov r1, r12 - adds r1, 0xA - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r4, =gWeatherMoveAnim - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0xC - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0xD - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r4] - ldr r7, =gAnimDisableStructPtr - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x10 - adds r1, r0 - str r1, [r7] - ldr r2, =gUnknown_020244BC - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - str r1, [r0] - mov r0, r8 - ldrb r1, [r0] - adds r0, r6, 0 - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0814D3CC - bl LinkPartnerBufferExecCompleted - b _0814D3F4 - .pool -_0814D3CC: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_4 - str r1, [r0] - ldrh r1, [r4] - ldr r2, [r7] - adds r0, r6, 0 - bl sub_817E0FC -_0814D3F4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D2B8 - - thumb_func_start bx_move_anim_4 -bx_move_anim_4: @ 814D40C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0814D4A4 - cmp r2, 0x1 - bgt _0814D464 - cmp r2, 0 - beq _0814D46E - b _0814D580 - .pool -_0814D464: - cmp r2, 0x2 - beq _0814D4CE - cmp r2, 0x3 - beq _0814D544 - b _0814D580 -_0814D46E: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _0814D490 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0814D490: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0814D580 -_0814D4A4: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0814D580 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0814D580 -_0814D4CE: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0814D580 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0814D51C - mov r0, r8 - cmp r0, 0x1 - bhi _0814D51C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0814D51C: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0814D580 - .pool -_0814D544: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0814D580 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl LinkPartnerBufferExecCompleted -_0814D580: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_4 - - thumb_func_start sub_814D590 -sub_814D590: @ 814D590 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t4_button_a - str r1, [r0] - ldrh r0, [r4] - bl sub_817C95C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D590 - - thumb_func_start sub_814D5E8 -sub_814D5E8: @ 814D5E8 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D5E8 - - thumb_func_start sub_814D5F4 -sub_814D5F4: @ 814D5F4 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D5F4 - - thumb_func_start sub_814D600 -sub_814D600: @ 814D600 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D600 - - thumb_func_start sub_814D60C -sub_814D60C: @ 814D60C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D60C - - thumb_func_start sub_814D618 -sub_814D618: @ 814D618 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D618 - - thumb_func_start sub_814D624 -sub_814D624: @ 814D624 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D624 - - thumb_func_start sub_814D630 -sub_814D630: @ 814D630 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D630 - - thumb_func_start sub_814D63C -sub_814D63C: @ 814D63C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _0814D6CC - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0814D6F6 - .pool -_0814D6CC: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0814D6F6: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t4_healthbar_update - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D63C - - thumb_func_start sub_814D72C -sub_814D72C: @ 814D72C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D72C - - thumb_func_start sub_814D738 -sub_814D738: @ 814D738 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0814D78C - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B7B8 - str r1, [r0] -_0814D78C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D738 - - thumb_func_start sub_814D7B0 -sub_814D7B0: @ 814D7B0 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0814D800 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl move_anim_start_t2_for_situation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B7B8 - str r1, [r0] -_0814D800: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D7B0 - - thumb_func_start sub_814D818 -sub_814D818: @ 814D818 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D818 - - thumb_func_start sub_814D824 -sub_814D824: @ 814D824 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D824 - - thumb_func_start sub_814D830 -sub_814D830: @ 814D830 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D830 - - thumb_func_start sub_814D83C -sub_814D83C: @ 814D83C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D83C - - thumb_func_start sub_814D848 -sub_814D848: @ 814D848 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D848 - - thumb_func_start sub_814D854 -sub_814D854: @ 814D854 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D854 - - thumb_func_start sub_814D860 -sub_814D860: @ 814D860 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D860 - - thumb_func_start sub_814D86C -sub_814D86C: @ 814D86C - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D86C - - thumb_func_start sub_814D878 -sub_814D878: @ 814D878 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D878 - - thumb_func_start sub_814D884 -sub_814D884: @ 814D884 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D884 - - thumb_func_start sub_814D8A0 -sub_814D8A0: @ 814D8A0 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D8A0 - - thumb_func_start sub_814D8D8 -sub_814D8D8: @ 814D8D8 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D8D8 - - thumb_func_start sub_814D8F0 -sub_814D8F0: @ 814D8F0 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D8F0 - - thumb_func_start dp01t_29_4_blink -dp01t_29_4_blink: @ 814D918 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0814D94C - bl LinkPartnerBufferExecCompleted - b _0814D976 - .pool -_0814D94C: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =dp01t_0F_4_move_anim - str r1, [r0] -_0814D976: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_29_4_blink - - thumb_func_start sub_814D988 -sub_814D988: @ 814D988 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814D988 - - thumb_func_start sub_814D994 -sub_814D994: @ 814D994 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0814D9A8 - movs r3, 0xC0 -_0814D9A8: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl LinkPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814D994 - - thumb_func_start sub_814D9D8 -sub_814D9D8: @ 814D9D8 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0814DA14 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0814DA28 - .pool -_0814DA14: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0814DA28: - bl LinkPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_814D9D8 - - thumb_func_start sub_814DA34 -sub_814DA34: @ 814DA34 - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DA34 - - thumb_func_start dp01t_2E_4_battle_intro -dp01t_2E_4_battle_intro: @ 814DA74 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_4_battle_intro - - thumb_func_start sub_814DAA8 -sub_814DAA8: @ 814DAA8 - push {r4-r7,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r6] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x38] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f9 - bl AllocSpritePalette - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r6] - bl sub_806D864 - ldr r4, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - movs r5, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0814DB80 - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r1, [r1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0814DBB4 -_0814DB80: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] - adds r0, 0x2 - b _0814DC06 - .pool -_0814DBB4: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r1, [r1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0814DBE2 - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r1] - ands r5, r0 - cmp r5, 0x1 - bne _0814DBF6 -_0814DBE2: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] - adds r0, 0x4 - b _0814DC06 -_0814DBF6: - ldrb r0, [r6] - bl sub_806D864 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r1, 0x13] -_0814DC06: - ldr r1, =gTrainerBackPicPaletteTable - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - lsls r4, r7, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_814DCCC - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r5] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0814DC80 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0814DC80: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_112 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DAA8 - - thumb_func_start sub_814DCCC -sub_814DCCC: @ 814DCCC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x17 - bgt _0814DCF8 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0814DDB4 - .pool -_0814DCF8: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0814DD18 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0814DD48 -_0814DD18: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_814CC98 - b _0814DD9C - .pool -_0814DD48: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_814CC98 - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_814CC98 - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_0814DD9C: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_814B0E8 - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_0814DDB4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DCCC - - thumb_func_start sub_814DDD8 -sub_814DDD8: @ 814DDD8 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0814DE08 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0814DE08 - bl LinkPartnerBufferExecCompleted - b _0814DE7C - .pool -_0814DE08: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0814DE70 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_0814DE70: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_814DE9C - str r0, [r1] -_0814DE7C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DDD8 - - thumb_func_start sub_814DE9C -sub_814DE9C: @ 814DE9C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _0814DED4 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x5] - bl LinkPartnerBufferExecCompleted -_0814DED4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DE9C - - thumb_func_start sub_814DEE4 -sub_814DEE4: @ 814DEE4 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0814DF16 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_0814DF16: - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DEE4 - - thumb_func_start sub_814DF34 -sub_814DF34: @ 814DF34 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814DF34 - - thumb_func_start sub_814DF40 -sub_814DF40: @ 814DF40 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _0814DF86 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl sub_805E408 -_0814DF86: - bl LinkPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DF40 - - thumb_func_start sub_814DFA0 -sub_814DFA0: @ 814DFA0 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0814E002 - ldr r4, =gBattleBufferA - ldrb r2, [r5] - lsls r1, r2, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - adds r0, r4, 0x2 - adds r0, r1, r0 - ldrb r3, [r0] - adds r4, 0x3 - adds r1, r4 - ldrb r0, [r1] - lsls r0, 8 - orrs r3, r0 - str r3, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - adds r3, r6, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _0814DFF0 - bl LinkPartnerBufferExecCompleted - b _0814DFFC - .pool -_0814DFF0: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_814B7E8 - str r0, [r1] -_0814DFFC: - adds r0, r6, 0 - bl sub_817E32C -_0814E002: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814DFA0 - - thumb_func_start sub_814E014 -sub_814E014: @ 814E014 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - bl sub_81851A8 - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_814E014 - - thumb_func_start sub_814E034 -sub_814E034: @ 814E034 - push {lr} - bl LinkPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_814E034 - - thumb_func_start sub_814E040 -sub_814E040: @ 814E040 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r0, r4 - bl sub_81851A8 - ldr r2, =gBattleOutcome - ldrb r0, [r5] - lsls r0, 9 - subs r1, r4, 0x3 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x2 - adds r0, r4 - ldrb r0, [r0] - ldr r1, =0x00000ca9 - adds r3, r1 - movs r1, 0x1 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r3] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl LinkPartnerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814E040 - - thumb_func_start nullsub_113 -nullsub_113: @ 814E0C0 - bx lr - thumb_func_end nullsub_113 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s deleted file mode 100644 index b66e373ca..000000000 --- a/asm/battle_controller_opponent.s +++ /dev/null @@ -1,6676 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_26 -nullsub_26: @ 805F160 - bx lr - thumb_func_end nullsub_26 - - thumb_func_start SetBankFuncToOpponentBufferRunCommand -SetBankFuncToOpponentBufferRunCommand: @ 805F164 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =OpponentBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToOpponentBufferRunCommand - - thumb_func_start OpponentBufferRunCommand -OpponentBufferRunCommand: @ 805F180 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _0805F1CC - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0805F1C8 - ldr r0, =gOpponentBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _0805F1CC - .pool -_0805F1C8: - bl OpponentBufferExecCompleted -_0805F1CC: - pop {r0} - bx r0 - thumb_func_end OpponentBufferRunCommand - - thumb_func_start sub_805F1D0 -sub_805F1D0: @ 805F1D0 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805F1F4 - bl OpponentBufferExecCompleted -_0805F1F4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F1D0 - - thumb_func_start sub_805F208 -sub_805F208: @ 805F208 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805F22C - bl OpponentBufferExecCompleted -_0805F22C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F208 - - thumb_func_start sub_805F240 -sub_805F240: @ 805F240 - push {r4-r6,lr} - ldr r5, =gSprites - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805F292 - adds r0, r2, r5 - ldrh r0, [r0, 0x6] - bl sub_805DFE4 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - bl OpponentBufferExecCompleted -_0805F292: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F240 - - thumb_func_start sub_805F2A8 -sub_805F2A8: @ 805F2A8 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _0805F2E0 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl OpponentBufferExecCompleted -_0805F2E0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F2A8 - - thumb_func_start sub_805F2F0 -sub_805F2F0: @ 805F2F0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F32C - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F31E - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805F32C -_0805F31E: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0805F368 -_0805F32C: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r3, =gActiveBank - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805F34E - movs r1, 0x1 - mov r10, r1 -_0805F34E: - movs r6, 0 - b _0805F3A2 - .pool -_0805F368: - ldr r3, =gSprites - ldr r6, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r4, [r2] - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, 0x1C - adds r0, r3 - ldr r5, [r0] - ldr r0, =SpriteCallbackDummy - cmp r5, r0 - bne _0805F3A0 - movs r0, 0x2 - eors r4, r0 - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldr r0, [r0] - cmp r0, r5 - bne _0805F3A0 - movs r0, 0x1 - mov r10, r0 -_0805F3A0: - movs r6, 0x1 -_0805F3A2: - ldr r3, =gUnknown_020244D8 - ldr r1, =gBattleSpritesDataPtr - mov r8, r1 - ldr r2, [r1] - ldr r7, =gActiveBank - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r5, [r2, 0x4] - adds r0, r5, r0 - str r0, [r3] - ldr r2, =gUnknown_020244DC - ldrb r0, [r7] - movs r1, 0x2 - mov r9, r1 - mov r1, r9 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5, r0 - str r0, [r2] - mov r0, r10 - cmp r0, 0 - bne _0805F3D8 - b _0805F53C -_0805F3D8: - cmp r6, 0x1 - bne _0805F494 - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r5 - ldrb r1, [r4, 0x1] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F3F2 - b _0805F53C -_0805F3F2: - mov r0, r9 - eors r0, r2 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x1] - ands r6, r0 - cmp r6, 0 - bne _0805F408 - b _0805F53C -_0805F408: - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r8 - ldr r0, [r1] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - mov r0, r8 - ldr r2, [r0] - ldrb r0, [r7] - mov r1, r9 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - mov r1, r8 - ldr r2, [r1] - ldrb r0, [r7] - mov r1, r9 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - b _0805F51A - .pool -_0805F494: - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805F53C - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _0805F4E4 - mov r0, r8 - ldr r2, [r0] - ldrb r0, [r7] - mov r1, r9 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - bne _0805F53C - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag -_0805F4E4: - mov r1, r8 - ldr r0, [r1] - ldr r1, =gActiveBank - ldrb r2, [r1] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1] - mov r1, r8 - ldr r0, [r1] - ldr r1, =gActiveBank - ldrb r2, [r1] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] -_0805F51A: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F2A8 - str r1, [r0] -_0805F53C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F2F0 - - thumb_func_start sub_805F560 -sub_805F560: @ 805F560 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - mov r10, r0 - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - movs r6, 0xC4 - lsls r6, 1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F5A6 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0805F5A6: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x00008040 - ands r0, r1 - cmp r0, 0 - bne _0805F5EE - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F5EE - ldr r2, [r5] - ldrb r1, [r4] - movs r0, 0x2 - adds r3, r0, 0 - eors r3, r1 - ldr r1, [r2, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F5EE - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_0805F5EE: - ldr r2, =gBattleSpritesDataPtr - ldr r0, [r2] - ldr r1, =gActiveBank - mov r8, r1 - ldrb r4, [r1] - ldr r5, [r0, 0x4] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r3, r0, r5 - ldrb r1, [r3] - movs r6, 0x8 - adds r0, r6, 0 - ands r0, r1 - mov r9, r2 - cmp r0, 0 - bne _0805F6D0 - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0805F6D0 - ldrb r1, [r3, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0805F6B4 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F684 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805F684 - ldr r4, =gHealthBoxesIds - mov r1, r8 - ldrb r0, [r1] - adds r1, r7, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - mov r1, r8 - ldrb r0, [r1] - eors r0, r7 - bl sub_8076918 - mov r1, r8 - ldrb r0, [r1] - eors r0, r7 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0805F684: - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0805F6B4: - ldr r3, =gBattleSpritesDataPtr - ldr r2, [r3] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x1] - mov r9, r3 -_0805F6D0: - mov r1, r9 - ldr r0, [r1] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - bne _0805F792 - movs r1, 0x2 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805F792 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0805F792 - mov r1, r9 - ldr r0, [r1] - ldrb r4, [r4] - ldr r1, [r0, 0x4] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0805F774 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _0805F768 - adds r0, r4, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0805F774 - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _0805F774 - .pool -_0805F768: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_0805F774: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x20 - orrs r1, r2 - strb r1, [r0, 0x1] - movs r0, 0x1 - str r0, [sp] -_0805F792: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F7B2 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F810 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0805F810 -_0805F7B2: - ldr r2, =gSprites - ldr r0, =gUnknown_03005D7C - ldr r1, =gActiveBank - ldrb r4, [r1] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _0805F86E - ldr r0, =gBankSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r3 - bne _0805F86E - movs r1, 0x1 - mov r10, r1 - b _0805F86E - .pool -_0805F810: - ldr r2, =gSprites - ldr r7, =gUnknown_03005D7C - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _0805F86E - ldr r6, =gBankSpriteIds - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r5, [r0] - cmp r5, r4 - bne _0805F86E - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r4, [r0] - cmp r4, r5 - bne _0805F86E - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _0805F86E - movs r0, 0x1 - mov r10, r0 -_0805F86E: - ldr r1, [sp] - cmp r1, 0 - beq _0805F958 - mov r0, r10 - cmp r0, 0 - beq _0805F958 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805F8D2 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805F8D2 - ldr r1, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldrb r0, [r5] - eors r4, r0 - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback -_0805F8D2: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldrb r5, [r4] - ldr r1, =gBattlePartyID - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F2F0 - str r1, [r0] -_0805F958: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F560 - - thumb_func_start sub_805F994 -sub_805F994: @ 805F994 - push {r4,r5,lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x24 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _0805F9E0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r2, r3, 1 - adds r0, r2, r3 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - bne _0805F9E0 - ldr r0, =gBattlePartyID - adds r0, r2, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 -_0805F9E0: - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r3, [r5] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805FA48 - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r2, r0, r1 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805FA48 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r4] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - bl OpponentBufferExecCompleted -_0805FA48: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805F994 - - thumb_func_start sub_805FA70 -sub_805FA70: @ 805FA70 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - ldr r5, =gHealthBoxesIds - adds r1, r0, r5 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0805FAB8 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _0805FABC - .pool -_0805FAB8: - bl OpponentBufferExecCompleted -_0805FABC: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_805FA70 - - thumb_func_start sub_805FAC4 -sub_805FAC4: @ 805FAC4 - push {lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _0805FAF2 - ldr r0, =gHealthBoxesIds - adds r0, r3, r0 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl OpponentBufferExecCompleted -_0805FAF2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FAC4 - - thumb_func_start sub_805FB08 -sub_805FB08: @ 805FB08 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805FB62 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl OpponentBufferExecCompleted -_0805FB62: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FB08 - - thumb_func_start bx_t7_button_a -bx_t7_button_a: @ 805FB7C - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0805FB8E - bl OpponentBufferExecCompleted -_0805FB8E: - pop {r0} - bx r0 - thumb_func_end bx_t7_button_a - - thumb_func_start bx_blink_t7 -bx_blink_t7: @ 805FB94 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _0805FBE0 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl OpponentBufferExecCompleted - b _0805FC0A - .pool -_0805FBE0: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0805FC04 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_0805FC04: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_0805FC0A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t7 - - thumb_func_start sub_805FC10 -sub_805FC10: @ 805FC10 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805FC5C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805FC50 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_0805FC50: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_803AEDC - str r0, [r1] -_0805FC5C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FC10 - - thumb_func_start bx_803AEDC -bx_803AEDC: @ 805FC80 - push {r4,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r4, =gActiveBank - ldrb r1, [r4] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805FCDA - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0805FCDA - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0805FCCA - ldr r0, =SpriteCallbackDummy_2 - cmp r1, r0 - bne _0805FCDA -_0805FCCA: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - bl OpponentBufferExecCompleted -_0805FCDA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bx_803AEDC - - thumb_func_start sub_805FD00 -sub_805FD00: @ 805FD00 - push {r4-r7,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r1, [r3, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805FDBC - ldr r7, =gSprites - ldr r6, =gBankSpriteIds - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r7, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805FDBC - ldrb r1, [r3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r3] - ldr r0, [r4] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r5] - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r5] - bl sub_8076918 - ldrb r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldrb r0, [r5] - bl sub_805E408 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FC10 - str r1, [r0] -_0805FDBC: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FD00 - - thumb_func_start sub_805FDF0 -sub_805FDF0: @ 805FDF0 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _0805FE22 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0805FE22: - ldr r4, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r5] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0805FE8C - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _0805FE8C - adds r0, r3, r4 - bl DestroySprite - ldrb r4, [r5] - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FD00 - str r1, [r0] -_0805FE8C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FDF0 - - thumb_func_start sub_805FEB8 -sub_805FEB8: @ 805FEB8 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0805FEDA - bl OpponentBufferExecCompleted -_0805FEDA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805FEB8 - - thumb_func_start bx_803B0F4 -bx_803B0F4: @ 805FEE8 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0805FF0A - bl OpponentBufferExecCompleted -_0805FF0A: - pop {r0} - bx r0 - .pool - thumb_func_end bx_803B0F4 - - thumb_func_start OpponentBufferExecCompleted -OpponentBufferExecCompleted: @ 805FF18 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =OpponentBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0805FF6C - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _0805FF7E - .pool -_0805FF6C: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_0805FF7E: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpponentBufferExecCompleted - - thumb_func_start dp01t_00_7_getattr -dp01t_00_7_getattr: @ 805FF90 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0805FFC8 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_8060004 - adds r6, r0, 0 - b _0805FFEA - .pool -_0805FFC8: - ldrb r4, [r1] - movs r5, 0 -_0805FFCC: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0805FFE2 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_8060004 - adds r6, r0 -_0805FFE2: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _0805FFCC -_0805FFEA: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl OpponentBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end dp01t_00_7_getattr - - thumb_func_start sub_8060004 -sub_8060004: @ 8060004 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _0806002E - bl _0806079A -_0806002E: - lsls r0, 2 - ldr r1, =_08060044 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08060044: - .4byte _08060134 - .4byte _08060358 - .4byte _08060368 - .4byte _08060378 - .4byte _080603E0 - .4byte _080603E0 - .4byte _080603E0 - .4byte _080603E0 - .4byte _080603FC - .4byte _08060438 - .4byte _08060438 - .4byte _08060438 - .4byte _08060438 - .4byte _0806079A - .4byte _0806079A - .4byte _0806079A - .4byte _0806079A - .4byte _08060454 - .4byte _08060464 - .4byte _08060494 - .4byte _080604A4 - .4byte _080604B4 - .4byte _080604C4 - .4byte _080604D4 - .4byte _080604E4 - .4byte _080604F4 - .4byte _08060504 - .4byte _08060514 - .4byte _08060524 - .4byte _08060534 - .4byte _08060544 - .4byte _08060554 - .4byte _080605A4 - .4byte _080605B4 - .4byte _080605C4 - .4byte _080605D4 - .4byte _080605E4 - .4byte _080605F4 - .4byte _08060604 - .4byte _08060614 - .4byte _08060624 - .4byte _08060658 - .4byte _08060668 - .4byte _08060678 - .4byte _08060688 - .4byte _08060698 - .4byte _080606A8 - .4byte _080606B8 - .4byte _080606C8 - .4byte _080606E8 - .4byte _080606F8 - .4byte _08060708 - .4byte _08060718 - .4byte _08060728 - .4byte _08060738 - .4byte _08060748 - .4byte _08060758 - .4byte _08060768 - .4byte _08060778 - .4byte _08060788 -_08060134: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08060180: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08060180 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_08060338: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _08060338 - b _0806079A - .pool -_08060358: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - b _080606D2 - .pool -_08060368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xC - b _080606D2 - .pool -_08060378: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - mov r8, r9 -_0806038E: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0806038E - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_080603CC: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _080603CC - b _0806079A - .pool -_080603E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _080606D2 - .pool -_080603FC: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gEnemyParty - mov r8, r2 -_08060408: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _08060408 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0806079A - .pool -_08060438: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _08060792 - .pool -_08060454: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1 - b _0806046E - .pool -_08060464: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x19 -_0806046E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0806079A - .pool -_08060494: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1A - b _08060792 - .pool -_080604A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1B - b _08060792 - .pool -_080604B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1C - b _08060792 - .pool -_080604C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1D - b _08060792 - .pool -_080604D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1E - b _08060792 - .pool -_080604E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1F - b _08060792 - .pool -_080604F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x20 - b _08060792 - .pool -_08060504: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x22 - b _08060792 - .pool -_08060514: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x23 - b _08060792 - .pool -_08060524: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x24 - b _08060792 - .pool -_08060534: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x25 - b _08060792 - .pool -_08060544: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x26 - b _08060792 - .pool -_08060554: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0806079A - .pool -_080605A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x27 - b _08060792 - .pool -_080605B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x28 - b _08060792 - .pool -_080605C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x29 - b _08060792 - .pool -_080605D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2A - b _08060792 - .pool -_080605E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2B - b _08060792 - .pool -_080605F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2C - b _08060792 - .pool -_08060604: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0 - b _0806062E - .pool -_08060614: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x9 - b _080606D2 - .pool -_08060624: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x37 -_0806062E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0806079A - .pool -_08060658: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x38 - b _08060792 - .pool -_08060668: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - b _080606D2 - .pool -_08060678: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - b _080606D2 - .pool -_08060688: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3B - b _080606D2 - .pool -_08060698: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3C - b _080606D2 - .pool -_080606A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3D - b _080606D2 - .pool -_080606B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3E - b _080606D2 - .pool -_080606C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3F -_080606D2: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0806079A - .pool -_080606E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x16 - b _08060792 - .pool -_080606F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x17 - b _08060792 - .pool -_08060708: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x18 - b _08060792 - .pool -_08060718: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x21 - b _08060792 - .pool -_08060728: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2F - b _08060792 - .pool -_08060738: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x30 - b _08060792 - .pool -_08060748: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x32 - b _08060792 - .pool -_08060758: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x33 - b _08060792 - .pool -_08060768: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x34 - b _08060792 - .pool -_08060778: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x35 - b _08060792 - .pool -_08060788: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x36 -_08060792: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0806079A: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8060004 - - thumb_func_start dp01t_01_2_read_pokmon_data_slice -dp01t_01_2_read_pokmon_data_slice: @ 80607B0 - push {r4-r7,lr} - sub sp, 0x58 - ldr r2, =gBattlePartyID - ldr r5, =gActiveBank - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - adds r4, r2, 0 - muls r4, r0 - ldr r3, =gBattleBufferA - lsls r1, 9 - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r2, [r0] - ldr r0, =gEnemyParty - adds r0, r2, r0 - adds r6, r4, r0 - mov r0, sp - adds r4, r0, r2 - movs r2, 0 - adds r0, r3, 0x2 - adds r1, r0 - adds r7, r5, 0 - mov r12, r3 - ldrb r1, [r1] - cmp r2, r1 - bcs _08060806 - adds r3, r0, 0 -_080607EC: - adds r1, r4, r2 - adds r0, r6, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldrb r0, [r5] - lsls r0, 9 - adds r0, r3 - ldrb r0, [r0] - cmp r2, r0 - bcc _080607EC -_08060806: - ldrb r0, [r7] - lsls r0, 9 - mov r1, r12 - adds r1, 0x2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - adds r2, r4, 0 - bl EmitDataTransfer - bl OpponentBufferExecCompleted - add sp, 0x58 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_01_2_read_pokmon_data_slice - - thumb_func_start dp01t_02_7_setattr -dp01t_02_7_setattr: @ 8060838 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08060868 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_8060890 - b _08060886 - .pool -_08060868: - ldrb r4, [r1] - movs r5, 0 -_0806086C: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0806087A - adds r0, r5, 0 - bl sub_8060890 -_0806087A: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0806086C -_08060886: - bl OpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end dp01t_02_7_setattr - - thumb_func_start sub_8060890 -sub_8060890: @ 8060890 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x38 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r4, r0, r2 - adds r7, r4, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r6, r3, 0 - adds r3, r2, 0 - cmp r0, 0x3B - bls _080608BE - bl _0806119C -_080608BE: - lsls r0, 2 - ldr r1, =_080608D4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080608D4: - .4byte _080609C4 - .4byte _08060B5C - .4byte _08060B78 - .4byte _08060B94 - .4byte _08060BE8 - .4byte _08060BE8 - .4byte _08060BE8 - .4byte _08060BE8 - .4byte _08060C08 - .4byte _08060C70 - .4byte _08060C70 - .4byte _08060C70 - .4byte _08060C70 - .4byte _0806119C - .4byte _0806119C - .4byte _0806119C - .4byte _0806119C - .4byte _08060C98 - .4byte _08060CB4 - .4byte _08060CD0 - .4byte _08060CEC - .4byte _08060D08 - .4byte _08060D24 - .4byte _08060D40 - .4byte _08060D5C - .4byte _08060D78 - .4byte _08060D94 - .4byte _08060DB0 - .4byte _08060DCC - .4byte _08060DE8 - .4byte _08060E04 - .4byte _08060E20 - .4byte _08060E94 - .4byte _08060EB0 - .4byte _08060ECC - .4byte _08060EE8 - .4byte _08060F04 - .4byte _08060F20 - .4byte _08060F3C - .4byte _08060F58 - .4byte _08060F74 - .4byte _08060F90 - .4byte _08060FAC - .4byte _08060FC8 - .4byte _08060FE4 - .4byte _08061000 - .4byte _0806101C - .4byte _08061038 - .4byte _08061054 - .4byte _08061070 - .4byte _0806108C - .4byte _080610A8 - .4byte _080610C4 - .4byte _080610E0 - .4byte _080610FC - .4byte _08061118 - .4byte _08061134 - .4byte _08061150 - .4byte _0806116C - .4byte _08061188 -_080609C4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r7, 0 - bl SetMonData - adds r2, r7, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r7 - mov r10, r0 - adds r0, r7, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r7, 0x2 - str r0, [sp, 0x4] - adds r0, r7, 0x4 - str r0, [sp, 0x8] - adds r0, r7, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r6, r7, 0 - adds r6, 0x24 - adds r4, r7, 0 - adds r4, 0xC -_08060A2A: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08060A2A - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r7, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r7, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0806119C - .pool -_08060B5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xB - bl SetMonData - b _0806119C - .pool -_08060B78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xC - bl SetMonData - b _0806119C - .pool -_08060B94: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r4 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r7, r1, r0 - adds r6, r4, 0 - adds r6, 0x8 -_08060BAC: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08060BAC - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0806119C - .pool -_08060BE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _08060C86 - .pool -_08060C08: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x11 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0806119C - .pool -_08060C70: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_08060C86: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0806119C - .pool -_08060C98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1 - bl SetMonData - b _0806119C - .pool -_08060CB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x19 - bl SetMonData - b _0806119C - .pool -_08060CD0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1A - bl SetMonData - b _0806119C - .pool -_08060CEC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1B - bl SetMonData - b _0806119C - .pool -_08060D08: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1C - bl SetMonData - b _0806119C - .pool -_08060D24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1D - bl SetMonData - b _0806119C - .pool -_08060D40: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1E - bl SetMonData - b _0806119C - .pool -_08060D5C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1F - bl SetMonData - b _0806119C - .pool -_08060D78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x20 - bl SetMonData - b _0806119C - .pool -_08060D94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x22 - bl SetMonData - b _0806119C - .pool -_08060DB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x23 - bl SetMonData - b _0806119C - .pool -_08060DCC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x24 - bl SetMonData - b _0806119C - .pool -_08060DE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x25 - bl SetMonData - b _0806119C - .pool -_08060E04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x26 - bl SetMonData - b _0806119C - .pool -_08060E20: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x27 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08060F2E - .pool -_08060E94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x27 - bl SetMonData - b _0806119C - .pool -_08060EB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x28 - bl SetMonData - b _0806119C - .pool -_08060ECC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x29 - bl SetMonData - b _0806119C - .pool -_08060EE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2A - bl SetMonData - b _0806119C - .pool -_08060F04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2B - bl SetMonData - b _0806119C - .pool -_08060F20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 -_08060F2E: - movs r1, 0x2C - bl SetMonData - b _0806119C - .pool -_08060F3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0 - bl SetMonData - b _0806119C - .pool -_08060F58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x9 - bl SetMonData - b _0806119C - .pool -_08060F74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x37 - bl SetMonData - b _0806119C - .pool -_08060F90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x38 - bl SetMonData - b _0806119C - .pool -_08060FAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x39 - bl SetMonData - b _0806119C - .pool -_08060FC8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3A - bl SetMonData - b _0806119C - .pool -_08060FE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3B - bl SetMonData - b _0806119C - .pool -_08061000: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3C - bl SetMonData - b _0806119C - .pool -_0806101C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3D - bl SetMonData - b _0806119C - .pool -_08061038: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3E - bl SetMonData - b _0806119C - .pool -_08061054: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3F - bl SetMonData - b _0806119C - .pool -_08061070: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x16 - bl SetMonData - b _0806119C - .pool -_0806108C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x17 - bl SetMonData - b _0806119C - .pool -_080610A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x18 - bl SetMonData - b _0806119C - .pool -_080610C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x21 - bl SetMonData - b _0806119C - .pool -_080610E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2F - bl SetMonData - b _0806119C - .pool -_080610FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x30 - bl SetMonData - b _0806119C - .pool -_08061118: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x32 - bl SetMonData - b _0806119C - .pool -_08061134: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x33 - bl SetMonData - b _0806119C - .pool -_08061150: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x34 - bl SetMonData - b _0806119C - .pool -_0806116C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x35 - bl SetMonData - b _0806119C - .pool -_08061188: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x36 - bl SetMonData -_0806119C: - add sp, 0x38 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8060890 - - thumb_func_start sub_80611B0 -sub_80611B0: @ 80611B0 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gEnemyParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _08061208 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_080611E6: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _080611E6 -_08061208: - bl OpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80611B0 - - thumb_func_start sub_8061224 -sub_8061224: @ 8061224 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 1 - ldr r1, =gBattlePartyID - adds r0, r1 - ldrh r0, [r0] - movs r7, 0x64 - muls r0, r7 - ldr r2, =gEnemyParty - mov r10, r2 - add r0, r10 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldrb r1, [r6] - lsls r0, r1, 1 - ldr r2, =gBattlePartyID - adds r0, r2 - ldrh r0, [r0] - muls r0, r7 - add r0, r10 - bl BattleLoadOpponentMonSpriteGfx - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldrb r4, [r6] - lsls r0, r4, 1 - ldr r2, =gBattlePartyID - adds r0, r2 - ldrh r0, [r0] - muls r0, r7 - add r0, r10 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F994 - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061224 - - thumb_func_start sub_806137C -sub_806137C: @ 806137C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - adds r0, 0x5C - movs r1, 0x6 - strb r1, [r0] - ldr r1, =gBattlePartyID - ldrb r0, [r4] - lsls r2, r0, 1 - adds r2, r1 - ldr r3, =gBattleBufferA - lsls r0, 9 - adds r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2] - ldrb r0, [r4] - lsls r1, r0, 9 - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - bl sub_80613DC - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FDF0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806137C - - thumb_func_start sub_80613DC -sub_80613DC: @ 80613DC - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_805EF84 - ldr r0, =gBattlePartyID - lsls r4, r6, 1 - adds r4, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4] - ldrh r0, [r4] - movs r1, 0x64 - mov r9, r1 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r10, r1 - add r10, r6 - mov r1, r10 - strb r0, [r1] - ldrh r0, [r4] - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - adds r0, r5 - adds r1, r6, 0 - bl BattleLoadOpponentMonSpriteGfx - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFE - bl sub_80753E8 - mov r1, r10 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80613DC - - thumb_func_start sub_806156C -sub_806156C: @ 806156C - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _080615B4 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8061604 - str r1, [r0] - b _080615F0 - .pool -_080615B4: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl OpponentBufferExecCompleted -_080615F0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_806156C - - thumb_func_start sub_8061604 -sub_8061604: @ 8061604 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0806162C - cmp r0, 0x1 - beq _0806165A - b _08061682 - .pool -_0806162C: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08061646 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08061646: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08061682 -_0806165A: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08061682 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x2 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FB08 - str r1, [r0] -_08061682: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061604 - - thumb_func_start sub_8061690 -sub_8061690: @ 8061690 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - lsls r0, 20 - ands r0, r2 - cmp r0, 0 - beq _080616B0 - bl GetSecretBaseTrainerPicIndex - b _0806175A - .pool -_080616B0: - ldr r3, =gTrainerBattleOpponent_A - ldrh r1, [r3] - ldr r0, =0x000003fe - cmp r1, r0 - bne _080616C8 - bl sub_81A4CB0 - b _0806175A - .pool -_080616C8: - movs r0, 0x80 - lsls r0, 19 - ands r0, r2 - cmp r0, 0 - beq _08061708 - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _08061700 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _080616F0 - ldrh r0, [r3] - bl sub_81D5588 - b _0806175A - .pool -_080616F0: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl sub_81D5588 - b _0806175A - .pool -_08061700: - ldrh r0, [r3] - bl sub_81D5588 - b _0806175A -_08061708: - ldr r0, =0x003f0100 - ands r0, r2 - cmp r0, 0 - beq _0806174C - ldr r0, =0x00808000 - ands r2, r0 - cmp r2, 0 - beq _08061744 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08061734 - ldrh r0, [r3] - bl sub_8162AA0 - b _0806175A - .pool -_08061734: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl sub_8162AA0 - b _0806175A - .pool -_08061744: - ldrh r0, [r3] - bl sub_8162AA0 - b _0806175A -_0806174C: - movs r0, 0x80 - lsls r0, 4 - ands r0, r2 - cmp r0, 0 - beq _08061760 - bl sub_8165244 -_0806175A: - lsls r0, 24 - lsrs r4, r0, 24 - b _08061796 -_08061760: - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _08061788 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - beq _08061788 - ldr r2, =gTrainers - ldr r0, =gTrainerBattleOpponent_B - ldrh r1, [r0] - b _0806178C - .pool -_08061788: - ldr r2, =gTrainers - ldrh r1, [r3] -_0806178C: - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r4, [r0, 0x3] -_08061796: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x00008040 - ands r0, r1 - cmp r0, 0 - beq _080617C8 - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0xC8 - cmp r1, 0 - beq _080617CA - movs r7, 0x98 - b _080617CA - .pool -_080617C8: - movs r7, 0xB0 -_080617CA: - mov r8, r4 - ldr r5, =gActiveBank - ldrb r1, [r5] - mov r0, r8 - bl sub_805DF38 - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r9, r7 - ldr r1, =gTrainerFrontPicCoords - mov r2, r8 - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 14 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r5] - adds r1, r6 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r1, r8 - strh r1, [r0, 0x6] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F1D0 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061690 - - thumb_func_start sub_80618D8 -sub_80618D8: @ 80618D8 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - lsls r0, 20 - ands r0, r2 - cmp r0, 0 - beq _080618F8 - bl GetSecretBaseTrainerPicIndex - b _080619A2 - .pool -_080618F8: - ldr r3, =gTrainerBattleOpponent_A - ldrh r1, [r3] - ldr r0, =0x000003fe - cmp r1, r0 - bne _08061910 - bl sub_81A4CB0 - b _080619A2 - .pool -_08061910: - movs r0, 0x80 - lsls r0, 19 - ands r0, r2 - cmp r0, 0 - beq _08061950 - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _08061948 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08061938 - ldrh r0, [r3] - bl sub_81D5588 - b _080619A2 - .pool -_08061938: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl sub_81D5588 - b _080619A2 - .pool -_08061948: - ldrh r0, [r3] - bl sub_81D5588 - b _080619A2 -_08061950: - ldr r0, =0x003f0100 - ands r0, r2 - cmp r0, 0 - beq _08061994 - ldr r0, =0x00808000 - ands r2, r0 - cmp r2, 0 - beq _0806198C - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _0806197C - ldrh r0, [r3] - bl sub_8162AA0 - b _080619A2 - .pool -_0806197C: - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl sub_8162AA0 - b _080619A2 - .pool -_0806198C: - ldrh r0, [r3] - bl sub_8162AA0 - b _080619A2 -_08061994: - movs r0, 0x80 - lsls r0, 4 - ands r0, r2 - cmp r0, 0 - beq _080619A8 - bl sub_8165244 -_080619A2: - lsls r0, 24 - lsrs r0, 24 - b _080619DE -_080619A8: - movs r0, 0x80 - lsls r0, 8 - ands r2, r0 - cmp r2, 0 - beq _080619D0 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - beq _080619D0 - ldr r2, =gTrainers - ldr r0, =gTrainerBattleOpponent_B - ldrh r1, [r0] - b _080619D4 - .pool -_080619D0: - ldr r2, =gTrainers - ldrh r1, [r3] -_080619D4: - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r0, [r0, 0x3] -_080619DE: - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - bl sub_805DF38 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r2, =gTrainerFrontPicCoords - mov r3, r8 - lsls r1, r3, 2 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 14 - adds r2, r1 - asrs r2, 16 - movs r1, 0xB0 - movs r3, 0x1E - bl CreateSprite - ldr r5, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r5 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x60 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x20] - adds r1, 0x20 - strh r1, [r0, 0x20] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r6] - adds r1, r5 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r3, r8 - strh r3, [r0, 0x6] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F208 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80618D8 - - thumb_func_start sub_8061AF0 -sub_8061AF0: @ 8061AF0 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F240 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061AF0 - - thumb_func_start sub_8061B9C -sub_8061B9C: @ 8061B9C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _08061BF0 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08061BD0 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08061BD0: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _08061C2C - .pool -_08061BF0: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08061C2C - strb r0, [r3, 0x4] - movs r0, 0x10 - movs r1, 0x3F - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039934 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FAC4 - str r1, [r0] -_08061C2C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061B9C - - thumb_func_start sub_8061C48 -sub_8061C48: @ 8061C48 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8061C48 - - thumb_func_start sub_8061C54 -sub_8061C54: @ 8061C54 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8061C54 - - thumb_func_start sub_8061C60 -sub_8061C60: @ 8061C60 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8061C60 - - thumb_func_start sub_8061C6C -sub_8061C6C: @ 8061C6C - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8061C6C - - thumb_func_start sub_8061C78 -sub_8061C78: @ 8061C78 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _08061C8A - b _08061D9E -_08061C8A: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gUnknown_020244BC - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _08061D80 - bl OpponentBufferExecCompleted - b _08061D9E - .pool -_08061D80: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_7 - str r1, [r0] -_08061D9E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061C78 - - thumb_func_start bx_move_anim_7 -bx_move_anim_7: @ 8061DB0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _08061E48 - cmp r2, 0x1 - bgt _08061E08 - cmp r2, 0 - beq _08061E12 - b _08061F24 - .pool -_08061E08: - cmp r2, 0x2 - beq _08061E72 - cmp r2, 0x3 - beq _08061EE8 - b _08061F24 -_08061E12: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _08061E34 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08061E34: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08061F24 -_08061E48: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08061F24 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _08061F24 -_08061E72: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _08061F24 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08061EC0 - mov r0, r8 - cmp r0, 0x1 - bhi _08061EC0 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_08061EC0: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _08061F24 - .pool -_08061EE8: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08061F24 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl OpponentBufferExecCompleted -_08061F24: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_7 - - thumb_func_start sub_8061F34 -sub_8061F34: @ 8061F34 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t7_button_a - str r1, [r0] - ldrb r0, [r5] - ldrh r1, [r4] - bl sub_81A57E4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8061F34 - - thumb_func_start sub_8061F90 -sub_8061F90: @ 8061F90 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8061F90 - - thumb_func_start sub_8061F9C -sub_8061F9C: @ 8061F9C - push {lr} - bl AI_TrySwitchOrUseItem - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8061F9C - - thumb_func_start sub_8061FAC -sub_8061FAC: @ 8061FAC - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8061FAC - - thumb_func_start sub_8061FB8 -sub_8061FB8: @ 8061FB8 - push {r4-r6,lr} - ldr r0, =gBattleTypeFlags - ldr r2, [r0] - movs r0, 0x80 - lsls r0, 10 - ands r0, r2 - cmp r0, 0 - beq _08061FE4 - bl sub_805D19C - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA -_08061FD6: - bl EmitCmd33 -_08061FDA: - bl OpponentBufferExecCompleted - b _08062156 - .pool -_08061FE4: - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r1, =gBattleBufferA + 4 - adds r5, r0, r1 - movs r0, 0x93 - lsls r0, 3 - ands r2, r0 - cmp r2, 0 - beq _080620C4 - movs r0, 0xF - bl BattleAI_SetupAIData - bl BattleAI_ChooseMoveOrAction - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - beq _08062022 - cmp r4, 0x5 - bgt _0806201C - cmp r4, 0x4 - beq _08062028 - b _08062040 - .pool -_0806201C: - cmp r4, 0x6 - beq _08062030 - b _08062040 -_08062022: - movs r0, 0x1 - movs r1, 0x4 - b _0806202C -_08062028: - movs r0, 0x1 - movs r1, 0x3 -_0806202C: - movs r2, 0 - b _08061FD6 -_08062030: - ldr r0, =gBankTarget - ldrb r2, [r0] - movs r0, 0x1 - movs r1, 0xF - b _08061FD6 - .pool -_08062040: - ldr r3, =gBattleMoves - lsls r0, r4, 1 - adds r2, r5, r0 - ldrh r1, [r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x6] - movs r0, 0x12 - ands r0, r1 - cmp r0, 0 - beq _08062062 - ldr r0, =gBankTarget - ldr r1, =gActiveBank - ldrb r1, [r1] - strb r1, [r0] -_08062062: - ldrh r1, [r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x6] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0806209C - movs r0, 0 - bl GetBankByIdentity - ldr r5, =gBankTarget - strb r0, [r5] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _0806209C - movs r0, 0x2 - bl GetBankByIdentity - strb r0, [r5] -_0806209C: - ldr r0, =gBankTarget - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - movs r0, 0x1 - movs r1, 0xA - adds r2, r4, 0 - bl EmitCmd33 - b _08061FDA - .pool -_080620C4: - movs r6, 0x3 -_080620C6: - bl Random - adds r4, r0, 0 - ands r4, r6 - lsls r0, r4, 1 - adds r0, r5, r0 - ldrh r2, [r0] - cmp r2, 0 - beq _080620C6 - ldr r1, =gBattleMoves - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x6] - movs r0, 0x12 - ands r0, r1 - cmp r0, 0 - beq _08062108 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - movs r0, 0x1 - movs r1, 0xA - adds r2, r4, 0 - bl EmitCmd33 - b _08062152 - .pool -_08062108: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0806213C - bl Random - movs r1, 0x2 - ands r1, r0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r1, 0 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 16 - orrs r2, r4 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - b _08062152 - .pool -_0806213C: - movs r0, 0 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 16 - orrs r2, r4 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 -_08062152: - bl OpponentBufferExecCompleted -_08062156: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8061FB8 - - thumb_func_start sub_806215C -sub_806215C: @ 806215C - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - lsrs r0, 1 - ldr r1, =gBattleStruct - ldr r1, [r1] - lsls r0, 1 - adds r0, r1 - adds r0, 0xC0 - ldrb r1, [r0] - movs r0, 0x1 - bl EmitCmd35 - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_806215C - - thumb_func_start sub_8062188 -sub_8062188: @ 8062188 - push {r4-r7,lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - movs r2, 0xA5 - lsls r2, 2 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x6 - bne _08062254 - bl GetMostSuitableMonToSwitchInto - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bne _0806225A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080621D4 - movs r0, 0x1 - bl GetBankByIdentity - lsls r0, 24 - lsrs r5, r0, 24 - adds r7, r5, 0 - b _080621E8 - .pool -_080621D4: - movs r0, 0x1 - bl GetBankByIdentity - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0x3 - bl GetBankByIdentity - lsls r0, 24 - lsrs r5, r0, 24 -_080621E8: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - ldr r1, =0x00808000 - ands r0, r1 - cmp r0, 0 - beq _08062214 - ldr r0, =gActiveBank - ldrb r0, [r0] - cmp r0, 0x1 - bne _08062210 - movs r0, 0 - movs r6, 0x3 - b _08062218 - .pool -_08062210: - movs r0, 0x3 - b _08062216 -_08062214: - movs r0, 0 -_08062216: - movs r6, 0x6 -_08062218: - adds r4, r0, 0 - b _0806221E -_0806221C: - adds r4, 0x1 -_0806221E: - cmp r4, r6 - bge _0806225A - movs r0, 0x64 - muls r0, r4 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _0806221C - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _0806221C - lsls r0, r5, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _0806221C - b _0806225A - .pool -_08062254: - ldrb r4, [r1] - movs r0, 0x6 - strb r0, [r1] -_0806225A: - ldr r0, =gActiveBank - ldrb r0, [r0] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - adds r0, 0x5C - strb r4, [r0] - lsls r1, r4, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitCmd34 - bl OpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062188 - - thumb_func_start sub_8062288 -sub_8062288: @ 8062288 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062288 - - thumb_func_start sub_8062294 -sub_8062294: @ 8062294 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x3 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r1, 8 - adds r3, 0x2 - adds r2, r3 - ldrb r0, [r2] - orrs r0, r1 - lsls r0, 16 - asrs r7, r0, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _08062324 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gEnemyParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0806234E - .pool -_08062324: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0806234E: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FA70 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062294 - - thumb_func_start sub_8062384 -sub_8062384: @ 8062384 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062384 - - thumb_func_start sub_8062390 -sub_8062390: @ 8062390 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _080623E4 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FEB8 - str r1, [r0] -_080623E4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062390 - - thumb_func_start sub_8062408 -sub_8062408: @ 8062408 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08062458 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl move_anim_start_t2_for_situation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805FEB8 - str r1, [r0] -_08062458: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062408 - - thumb_func_start sub_8062470 -sub_8062470: @ 8062470 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062470 - - thumb_func_start sub_806247C -sub_806247C: @ 806247C - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_806247C - - thumb_func_start sub_8062488 -sub_8062488: @ 8062488 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062488 - - thumb_func_start sub_8062494 -sub_8062494: @ 8062494 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062494 - - thumb_func_start sub_80624A0 -sub_80624A0: @ 80624A0 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80624A0 - - thumb_func_start sub_80624AC -sub_80624AC: @ 80624AC - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80624AC - - thumb_func_start sub_80624B8 -sub_80624B8: @ 80624B8 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80624B8 - - thumb_func_start sub_80624C4 -sub_80624C4: @ 80624C4 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80624C4 - - thumb_func_start sub_80624D0 -sub_80624D0: @ 80624D0 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80624D0 - - thumb_func_start sub_80624DC -sub_80624DC: @ 80624DC - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_80624DC - - thumb_func_start sub_80624F8 -sub_80624F8: @ 80624F8 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_80624F8 - - thumb_func_start sub_8062530 -sub_8062530: @ 8062530 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062530 - - thumb_func_start sub_8062548 -sub_8062548: @ 8062548 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062548 - - thumb_func_start dp01t_29_7_blink -dp01t_29_7_blink: @ 8062570 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080625A4 - bl OpponentBufferExecCompleted - b _080625CE - .pool -_080625A4: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t7 - str r1, [r0] -_080625CE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_29_7_blink - - thumb_func_start sub_80625E0 -sub_80625E0: @ 80625E0 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_80625E0 - - thumb_func_start sub_80625EC -sub_80625EC: @ 80625EC - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _08062600 - movs r3, 0xC0 -_08062600: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl OpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80625EC - - thumb_func_start sub_8062630 -sub_8062630: @ 8062630 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0806266C - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _08062680 - .pool -_0806266C: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_08062680: - bl OpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8062630 - - thumb_func_start sub_806268C -sub_806268C: @ 806268C - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - movs r2, 0x5 - bl PlayCry3 - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_806268C - - thumb_func_start dp01t_2E_7_battle_intro -dp01t_2E_7_battle_intro: @ 80626C8 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_7_battle_intro - - thumb_func_start sub_80626FC -sub_80626FC: @ 80626FC - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_806280C - bl StoreSpriteCallbackInData6 - ldr r0, =sub_8062828 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r6] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080627BE - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_080627BE: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_26 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80626FC - - thumb_func_start sub_806280C -sub_806280C: @ 806280C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x6] - bl sub_805DFE4 - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_806280C - - thumb_func_start sub_8062828 -sub_8062828: @ 8062828 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0806286C - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0806286C - movs r0, 0x80 - lsls r0, 8 - ands r1, r0 - cmp r1, 0 - beq _080628A0 -_0806286C: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_80613DC - b _080628E0 - .pool -_080628A0: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r6, =gBattlePartyID - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_80613DC - ldrb r0, [r7] - movs r5, 0x2 - eors r0, r5 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_80613DC - ldrb r0, [r7] - eors r0, r5 - strb r0, [r7] -_080628E0: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805F560 - str r1, [r0] - mov r0, r9 - strb r0, [r2] - mov r0, r8 - bl DestroyTask - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062828 - - thumb_func_start dp01t_30_7_0803D67C -dp01t_30_7_0803D67C: @ 8062918 - push {r4-r7,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08062948 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08062948 - bl OpponentBufferExecCompleted - b _08062A12 - .pool -_08062948: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldr r1, =gBattleBufferA - ldrb r2, [r3] - lsls r0, r2, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r3, 0 - cmp r0, 0 - beq _080629B4 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r2, [r3, 0x1] - lsls r1, r2, 27 - lsrs r0, r1, 28 - cmp r0, 0x1 - bhi _080629AC - adds r0, 0x1 - movs r1, 0xF - ands r0, r1 - lsls r0, 1 - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x1] - b _08062A12 - .pool -_080629AC: - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - strb r0, [r3, 0x1] -_080629B4: - adds r5, r7, 0 - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08062A06 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_08062A06: - ldr r0, =gBattleBankFunc - ldrb r1, [r7] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_0803D790_t7 - str r0, [r1] -_08062A12: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_30_7_0803D67C - - thumb_func_start bx_0803D790_t7 -bx_0803D790_t7: @ 8062A2C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _08062A64 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x5] - bl OpponentBufferExecCompleted -_08062A64: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bx_0803D790_t7 - - thumb_func_start sub_8062A74 -sub_8062A74: @ 8062A74 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08062AA6 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_08062AA6: - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062A74 - - thumb_func_start sub_8062AC4 -sub_8062AC4: @ 8062AC4 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062AC4 - - thumb_func_start sub_8062AD0 -sub_8062AD0: @ 8062AD0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _08062B16 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl sub_805E408 -_08062B16: - bl OpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062AD0 - - thumb_func_start dp01t_34_7_move_anim_start_t3 -dp01t_34_7_move_anim_start_t3: @ 8062B30 - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08062B88 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _08062B7C - bl OpponentBufferExecCompleted - b _08062B88 - .pool -_08062B7C: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_803B0F4 - str r0, [r1] -_08062B88: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_34_7_move_anim_start_t3 - - thumb_func_start sub_8062B98 -sub_8062B98: @ 8062B98 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062B98 - - thumb_func_start sub_8062BA4 -sub_8062BA4: @ 8062BA4 - push {lr} - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8062BA4 - - thumb_func_start sub_8062BB0 -sub_8062BB0: @ 8062BB0 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _08062BDA - ldr r2, =gMain - ldr r0, =0x00000439 - adds r3, r2, r0 - ldrb r1, [r3] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r2] - ldr r0, [r2, 0x8] - bl SetMainCallback2 -_08062BDA: - bl OpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8062BB0 - - thumb_func_start nullsub_91 -nullsub_91: @ 8062BF4 - bx lr - thumb_func_end nullsub_91 - - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s deleted file mode 100644 index 10b675714..000000000 --- a/asm/battle_controller_player.s +++ /dev/null @@ -1,10419 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start nullsub_21 -nullsub_21: @ 8057458 - bx lr - thumb_func_end nullsub_21 - - thumb_func_start SetBankFuncToPlayerBufferRunCommand -SetBankFuncToPlayerBufferRunCommand: @ 805745C - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerBufferRunCommand - str r1, [r0] - ldr r0, =gDoingBattleAnim - movs r1, 0 - strb r1, [r0] - ldr r0, =gUnknown_020244CC - strb r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToPlayerBufferRunCommand - - thumb_func_start PlayerBufferExecCompleted -PlayerBufferExecCompleted: @ 805748C - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080574E0 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _080574F2 - .pool -_080574E0: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_080574F2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerBufferExecCompleted - - thumb_func_start PlayerBufferRunCommand -PlayerBufferRunCommand: @ 8057504 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08057550 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0805754C - ldr r0, =gPlayerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _08057550 - .pool -_0805754C: - bl PlayerBufferExecCompleted -_08057550: - pop {r0} - bx r0 - thumb_func_end PlayerBufferRunCommand - - thumb_func_start bx_0802E404 -bx_0802E404: @ 8057554 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x24 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08057576 - bl PlayerBufferExecCompleted -_08057576: - pop {r0} - bx r0 - .pool - thumb_func_end bx_0802E404 - - thumb_func_start sub_8057588 -sub_8057588: @ 8057588 - push {r4-r7,lr} - ldr r3, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r2, r0, 9 - adds r1, r3, 0x2 - adds r1, r2, r1 - ldrb r5, [r1] - adds r3, 0x3 - adds r2, r3 - ldrb r1, [r2] - lsls r1, 8 - orrs r5, r1 - movs r1, 0x1 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldrb r0, [r4] - movs r1, 0 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldr r0, =gMain - ldrh r1, [r0, 0x30] - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - beq _080575EC - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _080575EC - ldr r1, =gUnknown_020244CC - ldrb r0, [r1] - adds r0, 0x1 - b _080575F0 - .pool -_080575EC: - ldr r1, =gUnknown_020244CC - movs r0, 0 -_080575F0: - strb r0, [r1] - ldr r0, =gMain - ldrh r2, [r0, 0x2E] - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r2 - cmp r0, 0 - beq _08057658 - movs r0, 0x5 - bl PlaySE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08057640 - cmp r0, 0x1 - bgt _08057630 - cmp r0, 0 - beq _0805763A - b _080577C2 - .pool -_08057630: - cmp r0, 0x2 - beq _08057646 - cmp r0, 0x3 - beq _0805764C - b _080577C2 -_0805763A: - movs r0, 0x1 - movs r1, 0 - b _080577BC -_08057640: - movs r0, 0x1 - movs r1, 0x1 - b _080577BC -_08057646: - movs r0, 0x1 - movs r1, 0x2 - b _080577BC -_0805764C: - movs r0, 0x1 - movs r1, 0x3 - movs r2, 0 - bl EmitCmd33 - b _080577C2 -_08057658: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _08057698 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _08057674 - b _080577E8 -_08057674: - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _08057732 - .pool -_08057698: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _080576D8 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _080576B4 - b _080577E8 -_080576B4: - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _08057732 - .pool -_080576D8: - movs r7, 0x40 - adds r0, r7, 0 - ands r0, r2 - cmp r0, 0 - beq _08057700 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080577E8 - b _0805771A - .pool -_08057700: - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _0805774C - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _080577E8 -_0805771A: - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 -_08057732: - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - b _080577E8 - .pool -_0805774C: - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _0805775A - ldrb r0, [r1] - cmp r0, 0x3B - bls _080577DC -_0805775A: - ldr r4, =gBattleTypeFlags - ldr r0, [r4] - ands r0, r3 - cmp r0, 0 - beq _080577E8 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _080577E8 - movs r0, 0 - bl GetBankByIdentity - ldr r1, =gAbsentBankFlags - ldrb r1, [r1] - ldr r2, =gBitTable - lsls r0, 24 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _080577E8 - ldr r0, [r4] - ands r0, r7 - cmp r0, 0 - bne _080577E8 - ldr r0, =gBattleBufferA - ldrb r1, [r6] - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x1 - bne _080577B2 - cmp r5, 0xC - bhi _080577E8 - adds r0, r5, 0 - movs r1, 0x1 - bl AddBagItem -_080577B2: - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0xC -_080577BC: - movs r2, 0 - bl EmitCmd33 -_080577C2: - bl PlayerBufferExecCompleted - b _080577E8 - .pool -_080577DC: - movs r0, 0x8 - ands r0, r2 - cmp r0, 0 - beq _080577E8 - bl SwapHpBarsWithHpText -_080577E8: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8057588 - - thumb_func_start sub_80577F0 -sub_80577F0: @ 80577F0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - movs r1, 0x1 - bl dp11b_obj_free - ldrb r0, [r4] - movs r1, 0 - bl dp11b_obj_free - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057824 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80577F0 - - thumb_func_start sub_8057824 -sub_8057824: @ 8057824 - push {r4,r5,lr} - sub sp, 0x4 - ldr r1, =gUnknown_0831C5F8 - mov r0, sp - movs r2, 0x4 - bl memcpy - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - movs r1, 0x1 - movs r2, 0xF - movs r3, 0x1 - bl dp11b_obj_instanciate - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r0, 0 - beq _08057866 -_0805784A: - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - cmp r4, r0 - beq _0805785C - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0x1 - bl dp11b_obj_free -_0805785C: - adds r4, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _0805784A -_08057866: - ldr r2, =gMain - ldrh r1, [r2, 0x2C] - movs r0, 0xF0 - ands r0, r1 - cmp r0, 0 - beq _0805789C - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _0805789C - ldr r1, =gUnknown_020244CC - ldrb r0, [r1] - adds r0, 0x1 - b _080578A0 - .pool -_0805789C: - ldr r1, =gUnknown_020244CC - movs r0, 0 -_080578A0: - strb r0, [r1] - ldrh r2, [r2, 0x2E] - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _08057910 - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r2, [r0] - ldrb r0, [r4] - lsls r0, 8 - orrs r2, r0 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - ldrb r0, [r4] - movs r1, 0x1 - bl dp11b_obj_free - bl PlayerBufferExecCompleted - b _08057BC8 - .pool -_08057910: - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _0805791E - ldrb r0, [r1] - cmp r0, 0x3B - bls _0805798C -_0805791E: - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gUnknown_03005D74 - ldrb r0, [r5] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057BFC - str r1, [r0] - ldrb r0, [r4] - movs r1, 0x1 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldrb r0, [r4] - movs r1, 0 - movs r2, 0x7 - movs r3, 0x1 - bl dp11b_obj_instanciate - ldrb r0, [r5] - movs r1, 0x1 - bl dp11b_obj_free - b _08057BC8 - .pool -_0805798C: - movs r0, 0x60 - ands r0, r2 - cmp r0, 0 - bne _08057996 - b _08057AB0 -_08057996: - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r3, =gUnknown_03005D74 - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - adds r5, r3, 0 -_080579B8: - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r1, r0, 24 - movs r4, 0 - mov r0, sp - b _080579E2 - .pool -_080579D8: - adds r4, 0x1 - cmp r4, 0x3 - bgt _080579E8 - mov r2, sp - adds r0, r2, r4 -_080579E2: - ldrb r0, [r0] - cmp r1, r0 - bne _080579D8 -_080579E8: - subs r4, 0x1 - cmp r4, 0 - bge _080579F0 - movs r4, 0x4 -_080579F0: - mov r1, sp - adds r0, r1, r4 - ldrb r0, [r0] - bl GetBankByIdentity - strb r0, [r5] - ldr r1, =gNoOfAllBanks - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - beq _080579E8 - movs r4, 0 - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08057A6E - cmp r0, 0x1 - bgt _08057A28 - cmp r0, 0 - beq _08057A32 - b _08057A70 - .pool -_08057A28: - cmp r0, 0x2 - beq _08057A32 - cmp r0, 0x3 - beq _08057A6E - b _08057A70 -_08057A32: - ldr r2, =gActiveBank - ldrb r0, [r2] - ldrb r1, [r5] - cmp r0, r1 - bne _08057A6E - ldr r1, =gBattlePartyID - ldrb r2, [r2] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gMoveSelectionCursor - adds r2, r1 - ldrb r1, [r2] - adds r1, 0xD - bl GetMonData - ldr r2, =gBattleMoves - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x6] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08057A70 -_08057A6E: - adds r4, 0x1 -_08057A70: - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - ldr r0, =gUnknown_03005D74 - cmp r1, 0 - beq _08057A88 - movs r4, 0 -_08057A88: - cmp r4, 0 - beq _080579B8 - b _08057BB0 - .pool -_08057AB0: - movs r0, 0x90 - ands r0, r2 - cmp r0, 0 - bne _08057ABA - b _08057BC8 -_08057ABA: - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r3, =gUnknown_03005D74 - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039B2C - str r1, [r0] - adds r5, r3, 0 -_08057ADC: - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r1, r0, 24 - movs r4, 0 - mov r0, sp - b _08057B06 - .pool -_08057AFC: - adds r4, 0x1 - cmp r4, 0x3 - bgt _08057B0C - mov r2, sp - adds r0, r2, r4 -_08057B06: - ldrb r0, [r0] - cmp r1, r0 - bne _08057AFC -_08057B0C: - adds r4, 0x1 - cmp r4, 0x3 - ble _08057B14 - movs r4, 0 -_08057B14: - mov r1, sp - adds r0, r1, r4 - ldrb r0, [r0] - bl GetBankByIdentity - strb r0, [r5] - ldr r1, =gNoOfAllBanks - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - beq _08057B0C - movs r4, 0 - ldrb r0, [r5] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08057B92 - cmp r0, 0x1 - bgt _08057B4C - cmp r0, 0 - beq _08057B56 - b _08057B94 - .pool -_08057B4C: - cmp r0, 0x2 - beq _08057B56 - cmp r0, 0x3 - beq _08057B92 - b _08057B94 -_08057B56: - ldr r2, =gActiveBank - ldrb r0, [r2] - ldrb r1, [r5] - cmp r0, r1 - bne _08057B92 - ldr r1, =gBattlePartyID - ldrb r2, [r2] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gMoveSelectionCursor - adds r2, r1 - ldrb r1, [r2] - adds r1, 0xD - bl GetMonData - ldr r2, =gBattleMoves - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x6] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08057B94 -_08057B92: - adds r4, 0x1 -_08057B94: - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - ldr r0, =gUnknown_03005D74 - cmp r1, 0 - beq _08057BAC - movs r4, 0 -_08057BAC: - cmp r4, 0 - beq _08057ADC -_08057BB0: - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039AD8 - str r1, [r0] -_08057BC8: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8057824 - - thumb_func_start sub_8057BFC -sub_8057BFC: @ 8057BFC - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r0, 0 - mov r8, r0 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r1, =gBattleBufferA + 4 - adds r6, r0, r1 - ldr r2, =gMain - ldrh r1, [r2, 0x2C] - movs r0, 0xF0 - ands r0, r1 - adds r7, r3, 0 - cmp r0, 0 - beq _08057C44 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _08057C44 - ldr r1, =gUnknown_020244CC - ldrb r0, [r1] - adds r0, 0x1 - b _08057C48 - .pool -_08057C44: - ldr r1, =gUnknown_020244CC - movs r0, 0 -_08057C48: - strb r0, [r1] - ldrh r2, [r2, 0x2E] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r2 - cmp r0, 0 - bne _08057C58 - b _08057E04 -_08057C58: - movs r0, 0x5 - bl PlaySE - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 1 - adds r1, r6, r0 - ldrh r0, [r1] - cmp r0, 0xAE - bne _08057C98 - ldrb r0, [r6, 0x12] - movs r4, 0 - cmp r0, 0x7 - beq _08057CA6 - ldrb r1, [r6, 0x13] - movs r0, 0x7 - eors r1, r0 - negs r0, r1 - orrs r0, r1 - asrs r4, r0, 31 - movs r0, 0x10 - ands r4, r0 - b _08057CA6 - .pool -_08057C98: - ldr r2, =gBattleMoves - ldrh r1, [r1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r4, [r0, 0x6] -_08057CA6: - movs r0, 0x10 - ands r0, r4 - cmp r0, 0 - beq _08057CC4 - ldr r0, =gUnknown_03005D74 - ldr r1, =gActiveBank - ldrb r1, [r1] - strb r1, [r0] - b _08057CDE - .pool -_08057CC4: - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - adds r1, r0, 0 - movs r2, 0x1 - movs r0, 0x1 - ands r0, r1 - eors r0, r2 - bl GetBankByIdentity - ldr r1, =gUnknown_03005D74 - strb r0, [r1] -_08057CDE: - ldr r5, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r2, r3, 9 - adds r1, r5, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r7, r0, 0 - cmp r1, 0 - bne _08057D18 - movs r0, 0x2 - ands r0, r4 - cmp r0, 0 - beq _08057D5A - adds r0, r5, 0x2 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r0, 0 - bne _08057D5A - movs r0, 0x1 - add r8, r0 - b _08057D5A - .pool -_08057D18: - movs r0, 0x7D - ands r0, r4 - cmp r0, 0 - bne _08057D24 - movs r0, 0x1 - add r8, r0 -_08057D24: - ldr r0, =gMoveSelectionCursor - adds r0, r3, r0 - adds r1, r6, 0 - adds r1, 0x8 - ldrb r0, [r0] - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _08057D62 - movs r0, 0x12 - ands r0, r4 - cmp r0, 0 - bne _08057D5A - movs r0, 0 - bl CountAliveMonsInBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _08057D5A - ldrb r0, [r7] - bl sub_8069F34 - ldr r1, =gUnknown_03005D74 - strb r0, [r1] - movs r0, 0 - mov r8, r0 -_08057D5A: - ldr r7, =gActiveBank - mov r0, r8 - cmp r0, 0 - bne _08057D80 -_08057D62: - ldr r1, =gMoveSelectionCursor - ldrb r0, [r7] - adds r0, r1 - ldrb r2, [r0] - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - b _08057E1C - .pool -_08057D80: - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057824 - str r1, [r0] - movs r0, 0x12 - ands r4, r0 - cmp r4, 0 - beq _08057DA8 - ldr r1, =gUnknown_03005D74 - ldrb r0, [r7] - b _08057DD8 - .pool -_08057DA8: - movs r0, 0x1 - bl GetBankByIdentity - ldr r1, =gAbsentBankFlags - ldrb r1, [r1] - ldr r2, =gBitTable - lsls r0, 24 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08057DD0 - movs r0, 0x3 - b _08057DD2 - .pool -_08057DD0: - movs r0, 0x1 -_08057DD2: - bl GetBankByIdentity - ldr r1, =gUnknown_03005D74 -_08057DD8: - strb r0, [r1] - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039AD8 - b _08057F9C - .pool -_08057E04: - movs r6, 0x2 - adds r0, r6, 0 - ands r0, r2 - cmp r0, 0 - bne _08057E14 - ldrb r0, [r1] - cmp r0, 0x3B - bls _08057E30 -_08057E14: - movs r0, 0x5 - bl PlaySE - ldr r2, =0x0000ffff -_08057E1C: - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - bl PlayerBufferExecCompleted - b _08057F9E - .pool -_08057E30: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _08057E60 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r2, r0, r4 - ldrb r1, [r2] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08057E4A - b _08057F9E -_08057E4A: - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - movs r2, 0x1 - eors r0, r2 - b _08057F08 - .pool -_08057E60: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _08057EA4 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r3, r0, r4 - ldrb r2, [r3] - movs r6, 0x1 - adds r0, r5, 0 - ands r0, r2 - cmp r0, 0 - beq _08057E7C - b _08057F9E -_08057E7C: - ldr r1, =gUnknown_03005D78 - adds r0, r6, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcc _08057E8A - b _08057F9E -_08057E8A: - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - eors r0, r6 - b _08057F08 - .pool -_08057EA4: - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - beq _08057ED4 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r2, r0, r4 - ldrb r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08057F9E - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - movs r2, 0x2 - eors r0, r2 - b _08057F08 - .pool -_08057ED4: - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _08057F30 - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r3, r0, r4 - ldrb r2, [r3] - movs r5, 0x2 - adds r0, r6, 0 - ands r0, r2 - cmp r0, 0 - bne _08057F9E - ldr r1, =gUnknown_03005D78 - adds r0, r5, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _08057F9E - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r7] - adds r1, r4 - ldrb r0, [r1] - eors r0, r5 -_08057F08: - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 - bl sub_8059B3C - bl sub_8059BB0 - b _08057F9E - .pool -_08057F30: - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - beq _08057F9E - ldr r0, =gUnknown_03005D78 - ldrb r0, [r0] - cmp r0, 0x1 - bls _08057F9E - ldr r0, =gBattleTypeFlags - ldr r5, [r0] - ands r5, r6 - cmp r5, 0 - bne _08057F9E - ldr r4, =gMoveSelectionCursor - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08057F78 - ldr r0, =gUnknown_03005D74 - strb r5, [r0] - b _08057F80 - .pool -_08057F78: - ldr r1, =gUnknown_03005D74 - adds r0, 0x1 - strb r0, [r1] - adds r0, r1, 0 -_08057F80: - ldrb r0, [r0] - movs r1, 0x1B - bl battle_menu_cursor_related_2 - ldr r0, =gText_BattleSwitchWhich - movs r1, 0xB - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058138 -_08057F9C: - str r1, [r0] -_08057F9E: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8057BFC - - thumb_func_start sub_8057FBC -sub_8057FBC: @ 8057FBC - push {r4-r7,lr} - movs r7, 0 - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r6, 0x1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08057FD6 - movs r0, 0x5 - bl PlaySE - movs r7, 0x1 -_08057FD6: - ldrh r1, [r4, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08057FF8 - movs r0, 0x5 - bl PlaySE - ldr r1, =gBattle_BG0_X - movs r0, 0 - strh r0, [r1] - ldr r1, =gBattle_BG0_Y - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - movs r7, 0xFF -_08057FF8: - ldrh r1, [r4, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08058038 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r2, r0, r5 - ldrb r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _08058038 - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - eors r0, r2 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_08058038: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08058086 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r3, r0, r5 - ldrb r2, [r3] - movs r6, 0x1 - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - bne _08058086 - ldr r1, =gUnknown_03005D78 - adds r0, r6, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _08058086 - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - eors r0, r6 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_08058086: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080580C8 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r2, r0, r5 - ldrb r1, [r2] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080580C8 - ldrb r0, [r2] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 - eors r0, r2 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_080580C8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08058116 - ldr r5, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r3, r0, r5 - ldrb r2, [r3] - movs r6, 0x2 - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _08058116 - ldr r1, =gUnknown_03005D78 - adds r0, r6, 0 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _08058116 - ldrb r0, [r3] - bl battle_menu_cursor_related - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - eors r0, r6 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 -_08058116: - adds r0, r7, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8057FBC - - thumb_func_start sub_8058138 -sub_8058138: @ 8058138 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x5 - ands r0, r1 - cmp r0, 0 - bne _08058152 - b _08058500 -_08058152: - movs r0, 0x5 - bl PlaySE - ldr r0, =gMoveSelectionCursor - mov r10, r0 - ldr r1, =gActiveBank - mov r8, r1 - ldrb r1, [r1] - adds r2, r1, r0 - ldr r5, =gUnknown_03005D74 - ldrb r0, [r2] - ldrb r3, [r5] - cmp r0, r3 - bne _08058170 - b _080584A8 -_08058170: - lsls r1, 9 - ldr r0, =gBattleBufferA + 4 - adds r1, r0 - mov r9, r1 - ldrb r1, [r2] - lsls r1, 1 - add r1, r9 - ldrh r6, [r1] - ldrb r0, [r5] - lsls r0, 1 - add r0, r9 - ldrh r0, [r0] - strh r0, [r1] - ldrb r0, [r5] - lsls r0, 1 - add r0, r9 - strh r6, [r0] - mov r1, r8 - ldrb r0, [r1] - add r0, r10 - ldrb r1, [r0] - mov r7, r9 - adds r7, 0x8 - adds r1, r7, r1 - ldrb r6, [r1] - ldrb r0, [r5] - adds r0, r7, r0 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r5] - adds r0, r7, r0 - strb r6, [r0] - mov r2, r8 - ldrb r0, [r2] - add r0, r10 - ldrb r1, [r0] - mov r2, r9 - adds r2, 0xC - adds r1, r2, r1 - ldrb r6, [r1] - ldrb r0, [r5] - adds r0, r2, r0 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r5] - adds r2, r0 - strb r6, [r2] - mov r3, r8 - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - ldr r2, =gDisableStructs - adds r6, r0, r2 - ldrb r4, [r6, 0x18] - lsls r3, r4, 24 - lsrs r2, r3, 28 - ldr r0, =gBitTable - mov r12, r0 - add r1, r10 - ldrb r0, [r1] - lsls r0, 2 - add r0, r12 - ldr r0, [r0] - ands r2, r0 - cmp r2, 0 - beq _0805822A - lsrs r1, r3, 28 - bics r1, r0 - lsls r1, 4 - movs r2, 0xF - adds r0, r2, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r6, 0x18] - mov r1, r8 - ldrb r0, [r1] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r3, =gDisableStructs - adds r1, r3 - ldrb r4, [r1, 0x18] - lsrs r3, r4, 4 - ldrb r0, [r5] - lsls r0, 2 - add r0, r12 - ldr r0, [r0] - orrs r0, r3 - lsls r0, 4 - ands r2, r4 - orrs r2, r0 - strb r2, [r1, 0x18] -_0805822A: - bl sub_8059AAC - movs r6, 0 - mov r12, r7 - mov r5, sp - adds r5, 0x18 - str r5, [sp, 0x1C] - ldr r2, =gBattleMons - mov r0, r8 - ldrb r1, [r0] - movs r0, 0x58 - muls r0, r1 - adds r0, r2 - adds r4, r0, 0 - adds r4, 0x3B - mov r7, r8 - mov r10, r2 - movs r5, 0x3 -_0805824E: - mov r1, sp - adds r3, r1, r6 - ldrb r1, [r4] - lsls r2, r6, 1 - adds r0, r5, 0 - lsls r0, r2 - ands r1, r0 - asrs r1, r2 - strb r1, [r3] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805824E - ldr r1, =gMoveSelectionCursor - ldrb r0, [r7] - adds r0, r1 - ldrb r0, [r0] - add r0, sp - ldrb r0, [r0] - ldr r2, [sp, 0x1C] - strb r0, [r2] - ldrb r0, [r7] - adds r0, r1 - ldrb r0, [r0] - mov r3, sp - adds r2, r3, r0 - ldr r1, =gUnknown_03005D74 - ldrb r0, [r1] - add r0, sp - ldrb r0, [r0] - movs r3, 0 - strb r0, [r2] - ldrb r0, [r1] - mov r5, sp - adds r1, r5, r0 - ldr r2, [sp, 0x1C] - ldrb r0, [r2] - strb r0, [r1] - strb r3, [r2] - movs r6, 0 - ldr r2, [sp, 0x1C] -_0805829E: - mov r3, sp - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r6, 1 - lsls r1, r0 - ldrb r0, [r2] - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805829E - ldrb r1, [r7] - movs r0, 0x58 - muls r0, r1 - add r0, r10 - adds r0, 0x3B - ldr r5, [sp, 0x1C] - ldrb r1, [r5] - strb r1, [r0] - movs r6, 0 - adds r4, r7, 0 - movs r3, 0x58 - movs r0, 0x24 - add r0, r10 - mov r8, r0 - mov r2, r9 - mov r7, r10 - adds r7, 0xC - mov r5, r12 -_080582D8: - lsls r1, r6, 1 - ldrb r0, [r4] - muls r0, r3 - adds r1, r0 - adds r1, r7 - ldrh r0, [r2] - strh r0, [r1] - ldrb r0, [r4] - adds r1, r0, 0 - muls r1, r3 - adds r1, r6, r1 - add r1, r8 - adds r0, r5, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _080582D8 - ldr r2, =gActiveBank - ldrb r1, [r2] - movs r0, 0x58 - muls r0, r1 - mov r1, r10 - adds r1, 0x50 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 14 - ands r0, r1 - cmp r0, 0 - beq _0805831A - b _080584A8 -_0805831A: - movs r6, 0 - mov r1, sp - adds r1, 0x4 - str r1, [sp, 0x20] - add r3, sp, 0xC - mov r10, r3 - ldr r5, =gBattlePartyID - mov r9, r5 - mov r8, r2 - movs r7, 0x64 - ldr r5, =gPlayerParty - adds r4, r1, 0 -_08058332: - mov r1, r8 - ldrb r0, [r1] - lsls r0, 1 - add r0, r9 - ldrh r0, [r0] - muls r0, r7 - adds r0, r5 - adds r1, r6, 0 - adds r1, 0xD - bl GetMonData - strh r0, [r4] - mov r2, r8 - ldrb r0, [r2] - lsls r0, 1 - add r0, r9 - ldrh r0, [r0] - muls r0, r7 - adds r0, r5 - adds r1, r6, 0 - adds r1, 0x11 - bl GetMonData - mov r3, r10 - adds r1, r3, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08058332 - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - ldr r5, [sp, 0x1C] - strb r0, [r5] - movs r6, 0 - movs r5, 0x3 - ldr r4, [sp, 0x1C] -_08058392: - mov r0, sp - adds r3, r0, r6 - lsls r2, r6, 1 - adds r1, r5, 0 - lsls r1, r2 - ldrb r0, [r4] - ands r0, r1 - asrs r0, r2 - strb r0, [r3] - adds r6, 0x1 - cmp r6, 0x3 - ble _08058392 - ldr r4, =gMoveSelectionCursor - ldr r3, =gActiveBank - ldrb r0, [r3] - adds r0, r4 - ldrb r1, [r0] - lsls r1, 1 - ldr r2, [sp, 0x20] - adds r1, r2, r1 - ldrh r6, [r1] - ldr r2, =gUnknown_03005D74 - ldrb r0, [r2] - lsls r0, 1 - ldr r5, [sp, 0x20] - adds r0, r5, r0 - ldrh r0, [r0] - movs r5, 0 - strh r0, [r1] - ldrb r0, [r2] - lsls r0, 1 - ldr r1, [sp, 0x20] - adds r0, r1, r0 - strh r6, [r0] - ldrb r0, [r3] - adds r0, r4 - ldrb r1, [r0] - add r1, r10 - ldrb r6, [r1] - ldrb r0, [r2] - add r0, r10 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r2] - add r0, r10 - strb r6, [r0] - ldrb r0, [r3] - adds r0, r4 - ldrb r0, [r0] - add r0, sp - ldrb r0, [r0] - ldr r1, [sp, 0x1C] - strb r0, [r1] - ldrb r0, [r3] - adds r0, r4 - ldrb r0, [r0] - mov r3, sp - adds r1, r3, r0 - ldrb r0, [r2] - add r0, sp - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r2] - adds r1, r3, r0 - ldr r2, [sp, 0x1C] - ldrb r0, [r2] - strb r0, [r1] - strb r5, [r2] - movs r6, 0 - ldr r2, [sp, 0x1C] -_0805841E: - mov r3, sp - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r6, 1 - lsls r1, r0 - ldrb r0, [r2] - orrs r0, r1 - strb r0, [r2] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805841E - movs r6, 0 - ldr r5, =gBattlePartyID - mov r10, r5 - ldr r0, =gActiveBank - mov r9, r0 - movs r1, 0x64 - mov r8, r1 - ldr r7, =gPlayerParty - ldr r5, [sp, 0x20] - adds r5, 0x8 - ldr r4, [sp, 0x20] -_0805844A: - mov r2, r9 - ldrb r0, [r2] - lsls r0, 1 - add r0, r10 - ldrh r0, [r0] - mov r3, r8 - muls r3, r0 - adds r0, r3, 0 - adds r0, r7 - adds r1, r6, 0 - adds r1, 0xD - adds r2, r4, 0 - bl SetMonData - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - add r0, r10 - ldrh r0, [r0] - mov r2, r8 - muls r2, r0 - adds r0, r2, 0 - adds r0, r7 - adds r1, r6, 0 - adds r1, 0x11 - adds r2, r5, 0 - bl SetMonData - adds r5, 0x1 - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _0805844A - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - ldr r2, [sp, 0x1C] - bl SetMonData -_080584A8: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057BFC - str r1, [r0] - ldr r3, =gMoveSelectionCursor - ldrb r0, [r2] - adds r0, r3 - ldr r1, =gUnknown_03005D74 - ldrb r1, [r1] - strb r1, [r0] - ldrb r0, [r2] - adds r0, r3 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 - b _08058532 - .pool -_08058500: - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - beq _08058554 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - bl battle_menu_cursor_related - ldr r1, =gMoveSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057BFC - str r1, [r0] -_08058532: - bl sub_8059B18 - bl sub_8059B3C - bl sub_8059BB0 - b _080586E8 - .pool -_08058554: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080585A4 - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - bne _0805856A - b _080586E8 -_0805856A: - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r5, [r1] - cmp r2, r5 - bne _08058590 -_08058578: - ldrb r0, [r1] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - b _08058596 - .pool -_08058590: - ldrb r0, [r3] - bl battle_menu_cursor_related -_08058596: - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - movs r1, 0x1 - b _0805862C - .pool -_080585A4: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080585E8 - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _080585BA - b _080586E8 -_080585BA: - ldr r1, =gUnknown_03005D78 - movs r0, 0x1 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcc _080585C8 - b _080586E8 -_080585C8: - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r0, [r1] - cmp r2, r0 - beq _08058578 - b _08058590 - .pool -_080585E8: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0805865C - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - beq _080586E8 - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r5, [r1] - cmp r2, r5 - bne _08058620 - ldrb r0, [r1] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - b _08058626 - .pool -_08058620: - ldrb r0, [r3] - bl battle_menu_cursor_related -_08058626: - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - movs r1, 0x2 -_0805862C: - eors r0, r1 - strb r0, [r4] - movs r0, 0x5 - bl PlaySE - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r4] - ldrb r0, [r0] - cmp r1, r0 - beq _080586CA - ldrb r0, [r4] - movs r1, 0x1B - bl battle_menu_cursor_related_2 - b _080586E8 - .pool -_0805865C: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080586E8 - ldr r3, =gUnknown_03005D74 - ldrb r2, [r3] - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _080586E8 - ldr r1, =gUnknown_03005D78 - movs r0, 0x2 - eors r0, r2 - ldrb r1, [r1] - cmp r0, r1 - bcs _080586E8 - ldr r0, =gMoveSelectionCursor - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r1, r0 - ldrb r0, [r1] - cmp r2, r0 - bne _080586A4 - ldrb r0, [r1] - movs r1, 0x1D - bl battle_menu_cursor_related_2 - b _080586AA - .pool -_080586A4: - ldrb r0, [r3] - bl battle_menu_cursor_related -_080586AA: - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - movs r1, 0x2 - eors r0, r1 - strb r0, [r4] - movs r0, 0x5 - bl PlaySE - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r4] - ldrb r0, [r0] - cmp r1, r0 - bne _080586E0 -_080586CA: - adds r0, r1, 0 - movs r1, 0 - bl battle_menu_cursor_related_2 - b _080586E8 - .pool -_080586E0: - ldrb r0, [r4] - movs r1, 0x1B - bl battle_menu_cursor_related_2 -_080586E8: - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8058138 - - thumb_func_start sub_80586F8 -sub_80586F8: @ 80586F8 - push {lr} - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _0805875C - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08058798 - movs r0, 0x5A - bl m4aSongNumStop - ldr r3, =gMain - ldr r0, =0x00000439 - adds r2, r3, r0 - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r3] - ldr r0, =sub_8038D64 - bl SetMainCallback2 - ldr r0, =gBattleOutcome - ldrb r0, [r0] - cmp r0, 0x1 - bne _08058738 - bl sub_817E3F4 -_08058738: - bl FreeAllWindowBuffers - b _08058798 - .pool -_0805875C: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08058798 - movs r0, 0x5A - bl m4aSongNumStop - ldr r3, =gMain - ldr r0, =0x00000439 - adds r2, r3, r0 - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r3] - ldr r0, =sub_8038D64 - bl SetMainCallback2 - ldr r0, =gBattleOutcome - ldrb r0, [r0] - cmp r0, 0x1 - bne _08058794 - bl sub_817E3F4 -_08058794: - bl FreeAllWindowBuffers -_08058798: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80586F8 - - thumb_func_start sub_80587B0 -sub_80587B0: @ 80587B0 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08058832 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08058810 - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _08058832 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _080587F0 - bl sub_800AC34 - b _080587F4 - .pool -_080587F0: - bl sub_800ADF8 -_080587F4: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80586F8 - str r1, [r0] - b _08058832 - .pool -_08058810: - movs r0, 0x5A - bl m4aSongNumStop - ldr r2, =gMain - ldr r0, =0x00000439 - adds r3, r2, r0 - ldrb r1, [r3] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r2] - ldr r0, [r2, 0x8] - bl SetMainCallback2 -_08058832: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80587B0 - - thumb_func_start sub_8058844 -sub_8058844: @ 8058844 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08058868 - bl PlayerBufferExecCompleted -_08058868: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058844 - - thumb_func_start sub_805887C -sub_805887C: @ 805887C - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _080588A0 - bl PlayerBufferExecCompleted -_080588A0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805887C - - thumb_func_start bx_802F7A0 -bx_802F7A0: @ 80588B4 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08058908 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bl nullsub_25 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - bl PlayerBufferExecCompleted -_08058908: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_802F7A0 - - thumb_func_start sub_8058924 -sub_8058924: @ 8058924 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _0805895C - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl PlayerBufferExecCompleted -_0805895C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058924 - - thumb_func_start sub_805896C -sub_805896C: @ 805896C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r7, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058998 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _080589D0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080589D0 -_08058998: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r3, =gActiveBank - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - mov r10, r3 - cmp r1, r0 - bne _08058A0A - b _08058A0E - .pool -_080589D0: - ldr r3, =gSprites - ldr r6, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r4, [r2] - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r3, 0 - adds r5, 0x1C - adds r0, r5 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - mov r10, r2 - cmp r3, r0 - bne _08058A0A - movs r0, 0x2 - eors r4, r0 - adds r0, r4, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r3 - bne _08058A0A - movs r7, 0x1 -_08058A0A: - cmp r7, 0 - beq _08058B08 -_08058A0E: - ldr r0, =gBattleSpritesDataPtr - mov r9, r0 - ldr r0, [r0] - mov r6, r10 - ldrb r2, [r6] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4, 0x1] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08058B08 - movs r1, 0x2 - mov r8, r1 - mov r1, r8 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08058B08 - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r2, r9 - ldr r0, [r2] - ldrb r2, [r6] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - mov r0, r9 - ldr r2, [r0] - ldrb r0, [r6] - mov r1, r8 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - mov r1, r9 - ldr r2, [r1] - ldrb r0, [r6] - mov r1, r8 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r7, =gBattlePartyID - ldrb r1, [r6] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl sub_805E990 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058AE4 - ldrb r0, [r6] - mov r1, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - bl sub_805E990 -_08058AE4: - mov r2, r9 - ldr r0, [r2] - mov r2, r10 - ldrb r1, [r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - mov r2, r10 - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058924 - str r1, [r0] -_08058B08: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805896C - - thumb_func_start sub_8058B40 -sub_8058B40: @ 8058B40 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r0, 0 - mov r9, r0 - mov r8, r0 - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r7, =gActiveBank - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r5, 0x88 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058B80 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08058B80: - ldr r1, [r4] - ldrb r0, [r7] - movs r6, 0x2 - adds r2, r6, 0 - eors r2, r0 - ldr r1, [r1, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058BB2 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08058BB2: - ldr r0, [r4] - ldrb r2, [r7] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4] - movs r5, 0x8 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058C82 - adds r1, r6, 0 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _08058C82 - ldrb r1, [r4, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08058C68 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058C38 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08058C38 - ldr r4, =gHealthBoxesIds - ldrb r0, [r7] - adds r1, r6, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - eors r0, r6 - bl sub_8076918 - ldrb r0, [r7] - eors r0, r6 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08058C38: - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08058C68: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x1] -_08058C82: - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - bne _08058D32 - movs r1, 0x2 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08058D32 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08058D32 - ldr r0, [r5] - ldrb r1, [r4] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08058D14 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08058D08 - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _08058D14 - .pool -_08058D08: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_08058D14: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x20 - orrs r1, r2 - strb r1, [r0, 0x1] - movs r0, 0x1 - mov r9, r0 -_08058D32: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058D52 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058DAC - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08058DAC -_08058D52: - ldr r2, =gSprites - ldr r0, =gUnknown_03005D7C - ldr r1, =gActiveBank - ldrb r4, [r1] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _08058E0A - ldr r0, =gBankSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r3 - bne _08058E0A - b _08058E06 - .pool -_08058DAC: - ldr r2, =gSprites - ldr r7, =gUnknown_03005D7C - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _08058E0A - ldr r6, =gBankSpriteIds - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r5, [r0] - cmp r5, r4 - bne _08058E0A - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r4, [r0] - cmp r4, r5 - bne _08058E0A - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08058E0A -_08058E06: - movs r0, 0x1 - mov r8, r0 -_08058E0A: - mov r0, r9 - cmp r0, 0 - beq _08058EAA - mov r0, r8 - cmp r0, 0 - beq _08058EAA - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08058E48 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08058E48 - ldr r2, =gUnknown_03005D7C - ldr r0, =gActiveBank - ldrb r1, [r0] - movs r0, 0x2 - eors r0, r1 - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite -_08058E48: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805896C - str r1, [r0] -_08058EAA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058B40 - - thumb_func_start sub_8058EDC -sub_8058EDC: @ 8058EDC - push {r4-r6,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r6, =gActiveBank - ldrb r3, [r6] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _08058F94 - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08058F94 - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08058F94 - adds r0, r3, 0 - bl sub_805E408 - ldr r0, [r5] - ldrb r2, [r6] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1] - ldr r0, [r5] - ldrb r2, [r6] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r0, [r5] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08058F88 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_08058F88: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8058FC0 - str r0, [r1] -_08058F94: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058EDC - - thumb_func_start sub_8058FC0 -sub_8058FC0: @ 8058FC0 - push {r4,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r4, =gActiveBank - ldrb r1, [r4] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805900E - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _0805900E - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - ldr r2, =gBattlePartyID - ldrb r1, [r4] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl PlayerBufferExecCompleted -_0805900E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8058FC0 - - thumb_func_start sub_805902C -sub_805902C: @ 805902C - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _0805905E - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_0805905E: - ldr r4, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r5] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _080590D2 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _080590D2 - adds r0, r3, r4 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r1, [r5] - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r5] - bl sub_8076918 - ldrb r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058EDC - str r1, [r0] -_080590D2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805902C - - thumb_func_start c3_0802FDF4 -c3_0802FDF4: @ 8059100 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08059122 - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - adds r0, r4, 0 - bl DestroyTask -_08059122: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end c3_0802FDF4 - - thumb_func_start bx_t1_healthbar_update -bx_t1_healthbar_update: @ 8059130 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r6, =gHealthBoxesIds - adds r1, r0, r6 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08059178 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08059192 - .pool -_08059178: - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl PlayerBufferExecCompleted -_08059192: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_t1_healthbar_update - - thumb_func_start sub_80591A0 -sub_80591A0: @ 80591A0 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080591B2 - bl PlayerBufferExecCompleted -_080591B2: - pop {r0} - bx r0 - thumb_func_end sub_80591A0 - - thumb_func_start sub_80591B8 -sub_80591B8: @ 80591B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - mov r8, r0 - ldrb r0, [r0, 0x8] - mov r10, r0 - mov r1, r8 - ldrb r7, [r1, 0xC] - str r7, [sp, 0x8] - ldrh r2, [r1, 0xA] - str r2, [sp, 0xC] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080591FE - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r10, r0 - bne _080591FE - b _08059314 -_080591FE: - movs r0, 0x64 - mov r1, r10 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x4] - ldr r3, =gExperienceTables - adds r4, 0x1 - lsls r4, 2 - ldr r2, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x13] - movs r1, 0xCA - lsls r1, 1 - muls r1, r2 - adds r4, r1 - adds r4, r3 - ldr r2, [r4] - str r2, [sp] - ldr r3, [sp, 0xC] - lsls r1, r3, 16 - asrs r1, 16 - adds r0, r1 - cmp r0, r2 - bcc _080592EC - adds r0, r6, 0 - movs r1, 0x19 - mov r2, sp - bl SetMonData - adds r0, r6, 0 - bl CalculateMonStats - ldr r2, [sp] - add r0, sp, 0x4 - ldrh r0, [r0] - subs r2, r0 - ldr r0, [sp, 0xC] - subs r2, r0, r2 - ldr r4, =gActiveBank - ldrb r5, [r4] - strb r7, [r4] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xB - bl EmitCmd33 - strb r5, [r4] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080592D4 - ldr r2, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r2 - mov r1, r10 - ldrh r0, [r0] - cmp r1, r0 - beq _080592B2 - movs r0, 0x2 - eors r7, r0 - lsls r0, r7, 1 - adds r0, r2 - ldrh r0, [r0] - cmp r1, r0 - bne _080592D4 -_080592B2: - ldr r0, =sub_8059544 - b _08059316 - .pool -_080592D4: - ldr r0, =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_805965C - b _08059318 - .pool -_080592EC: - str r0, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r6, 0 - movs r1, 0x19 - bl SetMonData - ldr r1, =gBattleBankFunc - ldr r3, [sp, 0x8] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, =sub_80591A0 - str r1, [r0] - mov r0, r9 - bl DestroyTask - b _0805931A - .pool -_08059314: - ldr r0, =sub_8059330 -_08059316: - mov r1, r8 -_08059318: - str r0, [r1] -_0805931A: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80591B8 - - thumb_func_start sub_8059330 -sub_8059330: @ 8059330 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r2, r0, 2 - mov r8, r2 - add r8, r0 - mov r0, r8 - lsls r0, 3 - mov r8, r0 - add r8, r1 - mov r2, r8 - ldrb r1, [r2, 0x8] - movs r0, 0xA - ldrsh r2, [r2, r0] - mov r9, r2 - mov r2, r8 - ldrb r2, [r2, 0xC] - mov r10, r2 - movs r0, 0x64 - adds r6, r1, 0 - muls r6, r0 - ldr r0, =gPlayerParty - adds r6, r0 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r6, 0 - movs r1, 0x19 - bl GetMonData - adds r3, r0, 0 - ldr r6, =gExperienceTables - lsls r1, r4, 2 - ldr r2, =gBaseStats - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - adds r0, r2 - ldrb r2, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r2 - adds r1, r0 - adds r1, r6 - ldr r1, [r1] - subs r3, r1 - adds r4, 0x1 - lsls r4, 2 - adds r4, r0 - adds r4, r6 - ldr r2, [r4] - subs r2, r1 - ldr r0, =gHealthBoxesIds - add r0, r10 - ldrb r1, [r0] - mov r0, r9 - negs r0, r0 - str r0, [sp] - mov r0, r10 - bl SetBattleBarStruct - movs r0, 0x21 - bl PlaySE - ldr r0, =sub_8059400 - mov r1, r8 - str r0, [r1] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059330 - - thumb_func_start sub_8059400 -sub_8059400: @ 8059400 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r6, r0, r1 - ldrh r1, [r6, 0x1C] - movs r2, 0x1C - ldrsh r0, [r6, r2] - cmp r0, 0xC - bgt _08059430 - adds r0, r1, 0x1 - strh r0, [r6, 0x1C] - b _0805952C - .pool -_08059430: - ldrb r0, [r6, 0x8] - mov r9, r0 - ldrh r2, [r6, 0xA] - mov r10, r2 - ldrb r7, [r6, 0xC] - ldr r5, =gHealthBoxesIds - adds r5, r7, r5 - ldrb r1, [r5] - adds r0, r7, 0 - movs r2, 0x1 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - bne _0805952C - movs r0, 0x21 - bl m4aSongNumStop - movs r0, 0x64 - mov r1, r9 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r3, =gExperienceTables - adds r4, 0x1 - lsls r4, 2 - ldr r2, =gBaseStats - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r1 - adds r4, r0 - adds r4, r3 - ldr r1, [r4] - str r1, [sp] - mov r2, r10 - lsls r0, r2, 16 - asrs r4, r0, 16 - ldr r0, [sp, 0x4] - adds r0, r4 - cmp r0, r1 - blt _08059510 - adds r0, r5, 0 - movs r1, 0x19 - mov r2, sp - bl SetMonData - adds r0, r5, 0 - bl CalculateMonStats - ldr r2, [sp] - add r0, sp, 0x4 - ldrh r0, [r0] - subs r2, r0 - subs r2, r4, r2 - ldr r4, =gActiveBank - ldrb r5, [r4] - strb r7, [r4] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xB - bl EmitCmd33 - strb r5, [r4] - ldr r0, =sub_8059544 - str r0, [r6] - b _0805952C - .pool -_08059510: - str r0, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r5, 0 - movs r1, 0x19 - bl SetMonData - ldr r1, =gBattleBankFunc - lsls r0, r7, 2 - adds r0, r1 - ldr r1, =sub_80591A0 - str r1, [r0] - mov r0, r8 - bl DestroyTask -_0805952C: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059400 - - thumb_func_start sub_8059544 -sub_8059544: @ 8059544 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldrb r4, [r0, 0xC] - ldrb r6, [r0, 0x8] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08059578 - ldr r1, =gBattlePartyID - movs r0, 0x2 - adds r2, r4, 0 - eors r2, r0 - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r6, r0 - bne _08059578 - adds r4, r2, 0 -_08059578: - adds r0, r4, 0 - adds r1, r4, 0 - adds r2, r4, 0 - movs r3, 0 - bl move_anim_start_t4 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80595A4 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059544 - - thumb_func_start sub_80595A4 -sub_80595A4: @ 80595A4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r2, r0, r1 - ldrb r5, [r2, 0xC] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08059646 - ldrb r4, [r2, 0x8] - movs r0, 0x64 - adds r1, r4, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0x38 - bl GetMonData - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08059624 - ldr r1, =gBattlePartyID - movs r0, 0x2 - adds r2, r5, 0 - eors r2, r0 - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - bne _08059624 - ldr r0, =gHealthBoxesIds - adds r0, r2, r0 - ldrb r0, [r0] - adds r1, r7, 0 - movs r2, 0 - bl UpdateHealthboxAttribute - b _08059638 - .pool -_08059624: - ldr r0, =gHealthBoxesIds - adds r0, r5, r0 - ldrb r0, [r0] - movs r1, 0x64 - muls r1, r4 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute -_08059638: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_805965C - str r0, [r1] -_08059646: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80595A4 - - thumb_func_start sub_805965C -sub_805965C: @ 805965C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - ldrb r1, [r4, 0x8] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - bl GetMonData - ldrb r0, [r4, 0xC] - ldr r1, =gBattleBankFunc - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80591A0 - str r1, [r0] - adds r0, r5, 0 - bl DestroyTask - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805965C - - thumb_func_start sub_80596A8 -sub_80596A8: @ 80596A8 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r2, [r4] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r3, 0x22 - ldrsh r1, [r0, r3] - movs r3, 0x26 - ldrsh r0, [r0, r3] - adds r1, r0 - cmp r1, 0xA0 - ble _08059724 - ldr r1, =gBattlePartyID - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl nullsub_24 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerBufferExecCompleted -_08059724: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80596A8 - - thumb_func_start sub_8059744 -sub_8059744: @ 8059744 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08059798 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerBufferExecCompleted -_08059798: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059744 - - thumb_func_start sub_80597B4 -sub_80597B4: @ 80597B4 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080597C6 - bl PlayerBufferExecCompleted -_080597C6: - pop {r0} - bx r0 - thumb_func_end sub_80597B4 - - thumb_func_start sub_80597CC -sub_80597CC: @ 80597CC - push {r4,lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0805980A - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059828 - str r1, [r0] - ldr r3, =gTasks - ldr r1, =gUnknown_03005D7C - ldrb r0, [r2] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r3 - ldrb r4, [r1, 0x8] - bl DestroyTask - bl FreeAllWindowBuffers - adds r0, r4, 0 - bl sub_81B89AC -_0805980A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80597CC - - thumb_func_start sub_8059828 -sub_8059828: @ 8059828 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _08059898 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08059898 - ldr r0, =gUnknown_0203CEE8 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08059870 - ldr r0, =gUnknown_0203CEE9 - ldrb r1, [r0] - ldr r2, =gUnknown_0203CF00 - movs r0, 0x1 - bl EmitCmd34 - b _0805987A - .pool -_08059870: - movs r0, 0x1 - movs r1, 0x6 - movs r2, 0 - bl EmitCmd34 -_0805987A: - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _08059894 - bl b_link_standby_message -_08059894: - bl PlayerBufferExecCompleted -_08059898: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059828 - - thumb_func_start sub_80598A4 -sub_80598A4: @ 80598A4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080598CC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80598E0 - str r1, [r0] - bl nullsub_35 - bl FreeAllWindowBuffers - bl sub_81AABB0 -_080598CC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80598A4 - - thumb_func_start sub_80598E0 -sub_80598E0: @ 80598E0 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _08059906 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08059906 - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitCmd35 - bl PlayerBufferExecCompleted -_08059906: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80598E0 - - thumb_func_start bx_wait_t1 -bx_wait_t1: @ 805991C - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - beq _08059942 - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08059946 -_08059942: - bl PlayerBufferExecCompleted -_08059946: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t1 - - thumb_func_start bx_blink_t1 -bx_blink_t1: @ 8059958 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _080599A4 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl PlayerBufferExecCompleted - b _080599CE - .pool -_080599A4: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _080599C8 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_080599C8: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_080599CE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t1 - - thumb_func_start sub_80599D4 -sub_80599D4: @ 80599D4 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08059A02 - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - cmp r0, 0 - beq _08059A02 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - bl BattleDestroyCursorAt - movs r0, 0 - strb r0, [r4] - movs r0, 0 - bl BattleCreateCursorAt -_08059A02: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08059A2C - ldr r4, =gUnknown_03005D74 - ldrb r0, [r4] - cmp r0, 0 - bne _08059A2C - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - bl BattleDestroyCursorAt - movs r0, 0x1 - strb r0, [r4] - movs r0, 0x1 - bl BattleCreateCursorAt -_08059A2C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08059A7A - str r2, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_03005D74 - ldrb r0, [r0] - cmp r0, 0 - beq _08059A6C - movs r0, 0x1 - movs r1, 0xE - movs r2, 0 - bl EmitCmd33 - b _08059A76 - .pool -_08059A6C: - movs r0, 0x1 - movs r1, 0xD - movs r2, 0 - bl EmitCmd33 -_08059A76: - bl PlayerBufferExecCompleted -_08059A7A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08059AA0 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - bl PlayerBufferExecCompleted -_08059AA0: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80599D4 - - thumb_func_start sub_8059AAC -sub_8059AAC: @ 8059AAC - push {r4-r7,lr} - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 9 - ldr r3, =gBattleBufferA + 4 - ldr r2, =gUnknown_03005D78 - movs r0, 0 - strb r0, [r2] - movs r5, 0 - ldr r7, =gDisplayedStringBattle - adds r4, r1, r3 - adds r6, r2, 0 -_08059AC4: - lsls r0, r5, 24 - lsrs r0, 24 - bl battle_menu_cursor_related - ldrh r1, [r4] - movs r0, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r7, 0 - bl StringCopy - adds r1, r5, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r7, 0 - bl sub_814F9EC - ldrh r0, [r4] - cmp r0, 0 - beq _08059AF4 - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_08059AF4: - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _08059AC4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059AAC - - thumb_func_start sub_8059B18 -sub_8059B18: @ 8059B18 - push {r4,lr} - ldr r4, =gDisplayedStringBattle - ldr r1, =gText_MoveInterfacePP - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - movs r1, 0x7 - bl sub_814F9EC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059B18 - - thumb_func_start sub_8059B3C -sub_8059B3C: @ 8059B3C - push {r4-r7,lr} - ldr r5, =gBattleBufferA - ldr r7, =gActiveBank - ldrb r0, [r7] - lsls r0, 9 - adds r1, r5, 0x2 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08059B98 - bl SetPpNumbersPaletteInMoveSelection - ldrb r1, [r7] - lsls r4, r1, 9 - adds r0, r5, 0x4 - adds r4, r0 - ldr r6, =gDisplayedStringBattle - ldr r5, =gMoveSelectionCursor - adds r1, r5 - adds r0, r4, 0 - adds r0, 0x8 - ldrb r1, [r1] - adds r0, r1 - ldrb r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r1, 0xBA - strb r1, [r0] - adds r0, 0x1 - ldrb r1, [r7] - adds r1, r5 - adds r4, 0xC - ldrb r1, [r1] - adds r4, r1 - ldrb r1, [r4] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - movs r1, 0x9 - bl sub_814F9EC -_08059B98: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059B3C - - thumb_func_start sub_8059BB0 -sub_8059BB0: @ 8059BB0 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 4 - adds r4, r0 - ldr r6, =gDisplayedStringBattle - ldr r1, =gText_MoveInterfaceType - adds r0, r6, 0 - bl StringCopy - movs r1, 0xFC - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x6 - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x1 - strb r1, [r0] - adds r0, 0x1 - ldr r3, =gBattleMoves - ldr r2, =gMoveSelectionCursor - ldrb r1, [r5] - adds r1, r2 - ldrb r1, [r1] - lsls r1, 1 - adds r4, r1 - ldrh r2, [r4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r1, 0x2] - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - adds r0, r6, 0 - movs r1, 0xA - bl sub_814F9EC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059BB0 - - thumb_func_start battle_menu_cursor_related_2 -battle_menu_cursor_related_2: @ 8059C28 - push {lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - lsls r1, 24 - lsrs r1, 24 - add r2, sp, 0xC - adds r0, r1, 0x1 - strh r0, [r2] - adds r0, r2, 0 - adds r1, 0x2 - strh r1, [r0, 0x2] - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - lsls r2, r0, 3 - adds r2, r0 - adds r2, 0x1 - movs r0, 0x2 - ands r3, r0 - adds r3, 0x37 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r0} - bx r0 - thumb_func_end battle_menu_cursor_related_2 - - thumb_func_start battle_menu_cursor_related -battle_menu_cursor_related: @ 8059C70 - push {lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - ldr r1, =0x00001016 - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - lsls r2, r0, 3 - adds r2, r0 - adds r2, 0x1 - movs r0, 0x2 - ands r3, r0 - adds r3, 0x37 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end battle_menu_cursor_related - - thumb_func_start ActionSelectionCreateCursorAt -ActionSelectionCreateCursorAt: @ 8059CB4 - push {r4,lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - movs r4, 0x1 - strh r4, [r0] - movs r1, 0x2 - strh r1, [r0, 0x2] - adds r0, r3, 0 - ands r0, r4 - lsls r2, r0, 3 - subs r2, r0 - adds r2, 0x10 - lsls r2, 24 - lsrs r2, 24 - ands r3, r1 - adds r3, 0x23 - str r4, [sp] - str r1, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - thumb_func_end ActionSelectionCreateCursorAt - - thumb_func_start ActionSelectionDestroyCursorAt -ActionSelectionDestroyCursorAt: @ 8059CF8 - push {lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - ldr r1, =0x00001016 - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x1 - adds r0, r3, 0 - ands r0, r1 - lsls r2, r0, 3 - subs r2, r0 - adds r2, 0x10 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x2 - ands r3, r0 - adds r3, 0x23 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - add r1, sp, 0xC - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end ActionSelectionDestroyCursorAt - - thumb_func_start sub_8059D40 -sub_8059D40: @ 8059D40 - push {lr} - ldr r0, =ReshowBattleScreenAfterMenu - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059D40 - - thumb_func_start sub_8059D50 -sub_8059D50: @ 8059D50 - push {lr} - ldr r0, =ReshowBattleScreenAfterMenu - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059D50 - - thumb_func_start sub_8059D60 -sub_8059D60: @ 8059D60 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _08059D82 - bl PlayerBufferExecCompleted -_08059D82: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8059D60 - - thumb_func_start bx_8030B2C -bx_8030B2C: @ 8059D90 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08059DB2 - bl PlayerBufferExecCompleted -_08059DB2: - pop {r0} - bx r0 - .pool - thumb_func_end bx_8030B2C - - thumb_func_start b_link_standby_message -b_link_standby_message: @ 8059DC0 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08059DE0 - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gText_LinkStandby - movs r1, 0 - bl sub_814F9EC -_08059DE0: - pop {r0} - bx r0 - .pool - thumb_func_end b_link_standby_message - - thumb_func_start dp01t_00_1_getattr -dp01t_00_1_getattr: @ 8059DF4 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08059E2C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_player_pokemon_ - adds r6, r0, 0 - b _08059E4E - .pool -_08059E2C: - ldrb r4, [r1] - movs r5, 0 -_08059E30: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08059E46 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_player_pokemon_ - adds r6, r0 -_08059E46: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08059E30 -_08059E4E: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl PlayerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end dp01t_00_1_getattr - - thumb_func_start dp01_getattr_by_ch1_for_player_pokemon_ -dp01_getattr_by_ch1_for_player_pokemon_: @ 8059E68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _08059E92 - bl _0805A5FE -_08059E92: - lsls r0, 2 - ldr r1, =_08059EA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08059EA8: - .4byte _08059F98 - .4byte _0805A1BC - .4byte _0805A1CC - .4byte _0805A1DC - .4byte _0805A244 - .4byte _0805A244 - .4byte _0805A244 - .4byte _0805A244 - .4byte _0805A260 - .4byte _0805A29C - .4byte _0805A29C - .4byte _0805A29C - .4byte _0805A29C - .4byte _0805A5FE - .4byte _0805A5FE - .4byte _0805A5FE - .4byte _0805A5FE - .4byte _0805A2B8 - .4byte _0805A2C8 - .4byte _0805A2F8 - .4byte _0805A308 - .4byte _0805A318 - .4byte _0805A328 - .4byte _0805A338 - .4byte _0805A348 - .4byte _0805A358 - .4byte _0805A368 - .4byte _0805A378 - .4byte _0805A388 - .4byte _0805A398 - .4byte _0805A3A8 - .4byte _0805A3B8 - .4byte _0805A408 - .4byte _0805A418 - .4byte _0805A428 - .4byte _0805A438 - .4byte _0805A448 - .4byte _0805A458 - .4byte _0805A468 - .4byte _0805A478 - .4byte _0805A488 - .4byte _0805A4BC - .4byte _0805A4CC - .4byte _0805A4DC - .4byte _0805A4EC - .4byte _0805A4FC - .4byte _0805A50C - .4byte _0805A51C - .4byte _0805A52C - .4byte _0805A54C - .4byte _0805A55C - .4byte _0805A56C - .4byte _0805A57C - .4byte _0805A58C - .4byte _0805A59C - .4byte _0805A5AC - .4byte _0805A5BC - .4byte _0805A5CC - .4byte _0805A5DC - .4byte _0805A5EC -_08059F98: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08059FE4: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08059FE4 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_0805A19C: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _0805A19C - b _0805A5FE - .pool -_0805A1BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _0805A536 - .pool -_0805A1CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _0805A536 - .pool -_0805A1DC: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_0805A1F2: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0805A1F2 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_0805A230: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _0805A230 - b _0805A5FE - .pool -_0805A244: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _0805A536 - .pool -_0805A260: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_0805A26C: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0805A26C - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _0805A5FE - .pool -_0805A29C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _0805A5F6 - .pool -_0805A2B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0805A2D2 - .pool -_0805A2C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0805A2D2: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _0805A5FE - .pool -_0805A2F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _0805A5F6 - .pool -_0805A308: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _0805A5F6 - .pool -_0805A318: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _0805A5F6 - .pool -_0805A328: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _0805A5F6 - .pool -_0805A338: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _0805A5F6 - .pool -_0805A348: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _0805A5F6 - .pool -_0805A358: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _0805A5F6 - .pool -_0805A368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _0805A5F6 - .pool -_0805A378: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _0805A5F6 - .pool -_0805A388: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _0805A5F6 - .pool -_0805A398: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _0805A5F6 - .pool -_0805A3A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _0805A5F6 - .pool -_0805A3B8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _0805A5FE - .pool -_0805A408: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _0805A5F6 - .pool -_0805A418: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _0805A5F6 - .pool -_0805A428: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _0805A5F6 - .pool -_0805A438: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _0805A5F6 - .pool -_0805A448: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _0805A5F6 - .pool -_0805A458: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _0805A5F6 - .pool -_0805A468: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0805A492 - .pool -_0805A478: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _0805A536 - .pool -_0805A488: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0805A492: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _0805A5FE - .pool -_0805A4BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _0805A5F6 - .pool -_0805A4CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _0805A536 - .pool -_0805A4DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _0805A536 - .pool -_0805A4EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _0805A536 - .pool -_0805A4FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _0805A536 - .pool -_0805A50C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _0805A536 - .pool -_0805A51C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _0805A536 - .pool -_0805A52C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_0805A536: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _0805A5FE - .pool -_0805A54C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _0805A5F6 - .pool -_0805A55C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _0805A5F6 - .pool -_0805A56C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _0805A5F6 - .pool -_0805A57C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _0805A5F6 - .pool -_0805A58C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _0805A5F6 - .pool -_0805A59C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _0805A5F6 - .pool -_0805A5AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _0805A5F6 - .pool -_0805A5BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _0805A5F6 - .pool -_0805A5CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _0805A5F6 - .pool -_0805A5DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _0805A5F6 - .pool -_0805A5EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_0805A5F6: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_0805A5FE: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_player_pokemon_ - - thumb_func_start sub_805A614 -sub_805A614: @ 805A614 - push {r4-r7,lr} - sub sp, 0x58 - ldr r2, =gBattlePartyID - ldr r5, =gActiveBank - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - adds r4, r2, 0 - muls r4, r0 - ldr r3, =gBattleBufferA - lsls r1, 9 - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r2, [r0] - ldr r0, =gPlayerParty - adds r0, r2, r0 - adds r6, r4, r0 - mov r0, sp - adds r4, r0, r2 - movs r2, 0 - adds r0, r3, 0x2 - adds r1, r0 - adds r7, r5, 0 - mov r12, r3 - ldrb r1, [r1] - cmp r2, r1 - bcs _0805A66A - adds r3, r0, 0 -_0805A650: - adds r1, r4, r2 - adds r0, r6, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - ldrb r0, [r5] - lsls r0, 9 - adds r0, r3 - ldrb r0, [r0] - cmp r2, r0 - bcc _0805A650 -_0805A66A: - ldrb r0, [r7] - lsls r0, 9 - mov r1, r12 - adds r1, 0x2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - adds r2, r4, 0 - bl EmitDataTransfer - bl PlayerBufferExecCompleted - add sp, 0x58 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805A614 - - thumb_func_start dp01t_02_1_setattr -dp01t_02_1_setattr: @ 805A69C - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0805A6CC - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl dp01_setattr_by_ch1_for_player_pokemon - b _0805A6EA - .pool -_0805A6CC: - ldrb r4, [r1] - movs r5, 0 -_0805A6D0: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0805A6DE - adds r0, r5, 0 - bl dp01_setattr_by_ch1_for_player_pokemon -_0805A6DE: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0805A6D0 -_0805A6EA: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end dp01t_02_1_setattr - - thumb_func_start dp01_setattr_by_ch1_for_player_pokemon -dp01_setattr_by_ch1_for_player_pokemon: @ 805A6F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _0805A720 - bl _0805B0BA -_0805A720: - lsls r0, 2 - ldr r1, =_0805A738 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0805A738: - .4byte _0805A828 - .4byte _0805A9C0 - .4byte _0805A9E0 - .4byte _0805AA00 - .4byte _0805AA58 - .4byte _0805AA58 - .4byte _0805AA58 - .4byte _0805AA58 - .4byte _0805AA80 - .4byte _0805AAE4 - .4byte _0805AAE4 - .4byte _0805AAE4 - .4byte _0805AAE4 - .4byte _0805B0BA - .4byte _0805B0BA - .4byte _0805B0BA - .4byte _0805B0BA - .4byte _0805AB14 - .4byte _0805AB34 - .4byte _0805AB54 - .4byte _0805AB74 - .4byte _0805AB94 - .4byte _0805ABB4 - .4byte _0805ABD4 - .4byte _0805ABF4 - .4byte _0805AC14 - .4byte _0805AC34 - .4byte _0805AC54 - .4byte _0805AC74 - .4byte _0805AC94 - .4byte _0805ACB4 - .4byte _0805ACD4 - .4byte _0805AD44 - .4byte _0805AD64 - .4byte _0805AD84 - .4byte _0805ADA4 - .4byte _0805ADC4 - .4byte _0805ADE4 - .4byte _0805AE04 - .4byte _0805AE24 - .4byte _0805AE44 - .4byte _0805AE64 - .4byte _0805AE84 - .4byte _0805AEA4 - .4byte _0805AEC4 - .4byte _0805AEE4 - .4byte _0805AF04 - .4byte _0805AF24 - .4byte _0805AF44 - .4byte _0805AF64 - .4byte _0805AF84 - .4byte _0805AFA4 - .4byte _0805AFC4 - .4byte _0805AFE4 - .4byte _0805B004 - .4byte _0805B024 - .4byte _0805B044 - .4byte _0805B064 - .4byte _0805B084 - .4byte _0805B0A4 -_0805A828: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_0805A88E: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0805A88E - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _0805B0BA - .pool -_0805A9C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _0805B0BA - .pool -_0805A9E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _0805B0BA - .pool -_0805AA00: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0805AA1A: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0805AA1A - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _0805B0BA - .pool -_0805AA58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0805AAFC - .pool -_0805AA80: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _0805B0BA - .pool -_0805AAE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0805AAFC: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _0805B0BA - .pool -_0805AB14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _0805B0BA - .pool -_0805AB34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _0805B0BA - .pool -_0805AB54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _0805B0BA - .pool -_0805AB74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _0805B0BA - .pool -_0805AB94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _0805B0BA - .pool -_0805ABB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _0805B0BA - .pool -_0805ABD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _0805B0BA - .pool -_0805ABF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _0805B0BA - .pool -_0805AC14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _0805B0BA - .pool -_0805AC34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _0805B0BA - .pool -_0805AC54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _0805B0BA - .pool -_0805AC74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _0805B0BA - .pool -_0805AC94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _0805B0BA - .pool -_0805ACB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _0805B0BA - .pool -_0805ACD4: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _0805ADF4 - .pool -_0805AD44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _0805B0BA - .pool -_0805AD64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _0805B0BA - .pool -_0805AD84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _0805B0BA - .pool -_0805ADA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _0805B0BA - .pool -_0805ADC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _0805B0BA - .pool -_0805ADE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_0805ADF4: - movs r1, 0x2C - bl SetMonData - b _0805B0BA - .pool -_0805AE04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _0805B0BA - .pool -_0805AE24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _0805B0BA - .pool -_0805AE44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _0805B0BA - .pool -_0805AE64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _0805B0BA - .pool -_0805AE84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _0805B0BA - .pool -_0805AEA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _0805B0BA - .pool -_0805AEC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _0805B0BA - .pool -_0805AEE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _0805B0BA - .pool -_0805AF04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _0805B0BA - .pool -_0805AF24: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _0805B0BA - .pool -_0805AF44: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _0805B0BA - .pool -_0805AF64: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _0805B0BA - .pool -_0805AF84: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _0805B0BA - .pool -_0805AFA4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _0805B0BA - .pool -_0805AFC4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _0805B0BA - .pool -_0805AFE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _0805B0BA - .pool -_0805B004: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _0805B0BA - .pool -_0805B024: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _0805B0BA - .pool -_0805B044: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _0805B0BA - .pool -_0805B064: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _0805B0BA - .pool -_0805B084: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _0805B0BA - .pool -_0805B0A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_0805B0BA: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01_setattr_by_ch1_for_player_pokemon - - thumb_func_start sub_805B0F0 -sub_805B0F0: @ 805B0F0 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _0805B148 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_0805B126: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _0805B126 -_0805B148: - bl PlayerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B0F0 - - thumb_func_start sub_805B164 -sub_805B164: @ 805B164 - push {r4,lr} - ldr r2, =gBattlePartyID - ldr r4, =gActiveBank - ldrb r1, [r4] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_0802E404 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B164 - - thumb_func_start sub_805B1CC -sub_805B1CC: @ 805B1CC - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl sub_805EF84 - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - movs r4, 0 - strh r0, [r1] - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldr r1, =gActionSelectionCursor - ldrb r0, [r5] - adds r0, r1 - strb r4, [r0] - ldr r1, =gMoveSelectionCursor - ldrb r0, [r5] - adds r0, r1 - strb r4, [r0] - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_805B258 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805902C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B1CC - - thumb_func_start sub_805B258 -sub_805B258: @ 805B258 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_805EF84 - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B258 - - thumb_func_start sub_805B3D4 -sub_805B3D4: @ 805B3D4 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _0805B41C - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805B464 - str r1, [r0] - b _0805B452 - .pool -_0805B41C: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerBufferExecCompleted -_0805B452: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B3D4 - - thumb_func_start sub_805B464 -sub_805B464: @ 805B464 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _0805B48C - cmp r0, 0x1 - beq _0805B4BA - b _0805B4E2 - .pool -_0805B48C: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805B4A6 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0805B4A6: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0805B4E2 -_0805B4BA: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0805B4E2 - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059744 - str r1, [r0] -_0805B4E2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B464 - - thumb_func_start sub_805B4F0 -sub_805B4F0: @ 805B4F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0805B5B4 - bl GetMultiplayerId - ldr r5, =gLinkPlayers - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0805B538 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0805B558 -_0805B538: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x2 - b _0805B5BA - .pool -_0805B558: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0805B58A - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _0805B5A0 -_0805B58A: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x4 - b _0805B5BA -_0805B5A0: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r4, [r1, 0x13] - b _0805B5BA -_0805B5B4: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r4, [r0, 0x8] -_0805B5BA: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r2, 0x40 - ands r1, r2 - adds r5, r0, 0 - cmp r1, 0 - beq _0805B63C - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r0, 0x20 - mov r9, r0 - cmp r1, 0 - beq _0805B5E0 - movs r1, 0x5A - mov r9, r1 -_0805B5E0: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _0805B618 - ldr r0, =gPartnerTrainerId - ldrh r1, [r0] - ldr r0, =0x00000c03 - cmp r1, r0 - beq _0805B618 - movs r0, 0x5A - mov r9, r0 - ldr r1, =gTrainerFrontPicCoords - b _0805B642 - .pool -_0805B618: - ldr r1, =gTrainerBackPicCoords - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 - ldr r5, =gBattleTypeFlags - b _0805B656 - .pool -_0805B63C: - movs r0, 0x50 - mov r9, r0 - ldr r1, =gTrainerBackPicCoords -_0805B642: - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 -_0805B656: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - bne _0805B664 - b _0805B794 -_0805B664: - ldr r0, =gPartnerTrainerId - ldrh r1, [r0] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _0805B670 - b _0805B794 -_0805B670: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bl sub_806F000 - lsls r0, 16 - lsrs r4, r0, 16 - adds r5, r4, 0 - ldr r6, =gActiveBank - ldrb r1, [r6] - adds r0, r5, 0 - bl sub_805DF38 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_806A1C0 - ldr r0, =gUnknown_0202499C - mov r8, r0 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r0, =gTrainerFrontPicPaletteTable - lsls r5, 3 - adds r5, r0 - ldrh r0, [r5, 0x4] - bl IndexOfSpritePaletteTag - ldr r5, =gSprites - ldrb r1, [r6] - adds r1, r4 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x30 - strh r1, [r0, 0x26] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_805D7AC - str r1, [r0] - ldrb r0, [r6] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - b _0805B82A - .pool -_0805B794: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r9 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] -_0805B82A: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058844 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B4F0 - - thumb_func_start dp01t_08_1_8032428 -dp01t_08_1_8032428: @ 805B864 - push {r4-r6,lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0805B920 - bl GetMultiplayerId - ldr r5, =gLinkPlayers - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - movs r4, 0xFF - ldrb r0, [r1] - cmp r0, 0x4 - beq _0805B8A6 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x5 - bne _0805B8C4 -_0805B8A6: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x2 - b _0805B926 - .pool -_0805B8C4: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r1, [r1] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0x2 - beq _0805B8F6 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r0, [r1] - ands r4, r0 - cmp r4, 0x1 - bne _0805B90C -_0805B8F6: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x13] - adds r4, r0, 0x4 - b _0805B926 -_0805B90C: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r4, [r1, 0x13] - b _0805B926 -_0805B920: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r4, [r0, 0x8] -_0805B926: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - lsls r4, 2 - adds r4, r1 - ldrb r1, [r4] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffa0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805887C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_08_1_8032428 - - thumb_func_start sub_805B9F8 -sub_805B9F8: @ 805B9F8 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_802F7A0 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805B9F8 - - thumb_func_start sub_805BAB8 -sub_805BAB8: @ 805BAB8 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _0805BB0C - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805BAEC - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0805BAEC: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _0805BB82 - .pool -_0805BB0C: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0805BB82 - strb r4, [r3, 0x4] - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80596A8 - str r1, [r0] -_0805BB82: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805BAB8 - - thumb_func_start sub_805BBA4 -sub_805BBA4: @ 805BBA4 - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r1, 0x2 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl PlayerBufferExecCompleted - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_805BBA4 - - thumb_func_start sub_805BBC4 -sub_805BBC4: @ 805BBC4 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x3 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t1 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805BBC4 - - thumb_func_start sub_805BC18 -sub_805BC18: @ 805BC18 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x3 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t1 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805BC18 - - thumb_func_start sub_805BC78 -sub_805BC78: @ 805BC78 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0805BC96 -_0805BC8C: - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0805BC8C -_0805BC96: - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805BC78 - - thumb_func_start dp01t_0F_1_move_anim -dp01t_0F_1_move_anim: @ 805BCA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _0805BCBE - b _0805BDE4 -_0805BCBE: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r1, [r5] - lsls r1, 9 - adds r0, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - mov r0, r12 - adds r0, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r6, r0 - ldr r0, =gAnimMoveTurn - mov r8, r0 - mov r0, r12 - adds r0, 0x3 - adds r1, r0 - ldrb r0, [r1] - mov r1, r8 - strb r0, [r1] - ldr r3, =gAnimMovePower - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x4 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x5 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r3] - ldr r3, =gAnimMoveDmg - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x6 - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0x7 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r2, r0 - mov r0, r12 - adds r0, 0x8 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r2, r0 - mov r0, r12 - adds r0, 0x9 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 24 - orrs r2, r0 - str r2, [r3] - ldr r2, =gAnimFriendship - ldrb r0, [r5] - lsls r0, 9 - mov r1, r12 - adds r1, 0xA - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r4, =gWeatherMoveAnim - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0xC - adds r0, r1, r0 - ldrb r2, [r0] - mov r0, r12 - adds r0, 0xD - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - strh r2, [r4] - ldr r7, =gAnimDisableStructPtr - ldrb r1, [r5] - lsls r1, 9 - mov r0, r12 - adds r0, 0x10 - adds r1, r0 - str r1, [r7] - ldr r2, =gUnknown_020244BC - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r1, [r1] - str r1, [r0] - mov r0, r8 - ldrb r1, [r0] - adds r0, r6, 0 - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0805BDBC - bl PlayerBufferExecCompleted - b _0805BDE4 - .pool -_0805BDBC: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_1 - str r1, [r0] - ldrh r1, [r4] - ldr r2, [r7] - adds r0, r6, 0 - bl sub_817E0FC -_0805BDE4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_0F_1_move_anim - - thumb_func_start bx_move_anim_1 -bx_move_anim_1: @ 805BDFC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0805BE94 - cmp r2, 0x1 - bgt _0805BE54 - cmp r2, 0 - beq _0805BE5E - b _0805BF70 - .pool -_0805BE54: - cmp r2, 0x2 - beq _0805BEBE - cmp r2, 0x3 - beq _0805BF34 - b _0805BF70 -_0805BE5E: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _0805BE80 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0805BE80: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0805BF70 -_0805BE94: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0805BF70 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0805BF70 -_0805BEBE: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0805BF70 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0805BF0C - mov r0, r8 - cmp r0, 0x1 - bhi _0805BF0C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0805BF0C: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0805BF70 - .pool -_0805BF34: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0805BF70 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl PlayerBufferExecCompleted -_0805BF70: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_1 - - thumb_func_start sub_805BF80 -sub_805BF80: @ 805BF80 - push {r4,r5,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r5, =gActiveBank - ldrb r4, [r5] - lsls r4, 9 - ldr r0, =gBattleBufferA + 2 - adds r4, r0 - ldrh r0, [r4] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80597B4 - str r1, [r0] - ldrh r0, [r4] - bl sub_817C95C - ldrb r0, [r5] - ldrh r1, [r4] - bl sub_81A57E4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805BF80 - - thumb_func_start dp01t_11_1_message_for_player_only -dp01t_11_1_message_for_player_only: @ 805BFE0 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0805BFFC - bl sub_805BF80 - b _0805C000 - .pool -_0805BFFC: - bl PlayerBufferExecCompleted -_0805C000: - pop {r0} - bx r0 - thumb_func_end dp01t_11_1_message_for_player_only - - thumb_func_start sub_805C004 -sub_805C004: @ 805C004 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0805C02A - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057588 - str r1, [r0] -_0805C02A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C004 - - thumb_func_start dp01t_12_6_battle_menu -dp01t_12_6_battle_menu: @ 805C044 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805C004 - str r1, [r0] - bl sub_817F2A8 - ldr r0, =gText_BattleMenu - movs r1, 0x2 - bl sub_814F9EC - movs r4, 0 -_0805C062: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _0805C062 - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillPkmnDo - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl sub_814F9EC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_12_6_battle_menu - - thumb_func_start sub_805C0B0 -sub_805C0B0: @ 805C0B0 - push {r4,lr} - sub sp, 0x4 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0805C108 - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - ldr r0, =gText_BattleYesNoChoice - movs r1, 0xC - bl sub_814F9EC - ldr r1, =gUnknown_03005D74 - movs r0, 0x1 - strb r0, [r1] - movs r0, 0x1 - bl BattleCreateCursorAt - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80599D4 - str r1, [r0] - b _0805C10C - .pool -_0805C108: - bl PlayerBufferExecCompleted -_0805C10C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_805C0B0 - - thumb_func_start sub_805C114 -sub_805C114: @ 805C114 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0805C13E - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8057BFC - str r1, [r0] -_0805C13E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C114 - - thumb_func_start sub_805C158 -sub_805C158: @ 805C158 - push {lr} - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r1, r0 - movs r0, 0xA6 - lsls r0, 2 - adds r1, r0 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _0805C194 - ldr r1, =gBattlePalaceMoveSelectionRngValue - ldr r0, =gRngValue - ldr r0, [r0] - str r0, [r1] - bl sub_805D19C - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - bl PlayerBufferExecCompleted -_0805C194: - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C158 - - thumb_func_start dp01t_14_5_move_menu_pokedude -dp01t_14_5_move_menu_pokedude: @ 805C1A8 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0805C1EC - ldr r2, =gActiveBank - ldrb r0, [r2] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - movs r1, 0xA6 - lsls r1, 2 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805C158 - b _0805C1FC - .pool -_0805C1EC: - bl sub_805C210 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_805C114 -_0805C1FC: - str r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_14_5_move_menu_pokedude - - thumb_func_start sub_805C210 -sub_805C210: @ 805C210 - push {lr} - bl sub_8059AAC - ldr r1, =gUnknown_03005D74 - movs r0, 0xFF - strb r0, [r1] - ldr r1, =gMoveSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl battle_menu_cursor_related_2 - bl sub_8059B18 - bl sub_8059B3C - bl sub_8059BB0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C210 - - thumb_func_start sub_805C248 -sub_805C248: @ 805C248 - push {r4,r5,lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80598A4 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - movs r3, 0 - ldr r5, =gUnknown_0203CF00 - ldr r4, =gBattleBufferA -_0805C276: - adds r0, r3, r5 - ldrb r1, [r2] - lsls r1, 9 - adds r1, 0x1 - adds r1, r3, r1 - adds r1, r4 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0x2 - ble _0805C276 - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C248 - - thumb_func_start sub_805C2AC -sub_805C2AC: @ 805C2AC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - movs r3, 0 - ldr r0, =gUnknown_0203CF00 - mov r12, r0 - ldr r1, =gBattleBufferA - mov r8, r1 - ldr r2, =gActiveBank - ldr r7, =gBattleTypeFlags - mov r6, r12 - mov r5, r8 - adds r4, r2, 0 -_0805C2C8: - adds r0, r3, r6 - ldrb r1, [r4] - lsls r1, 9 - adds r1, 0x4 - adds r1, r3, r1 - adds r1, r5 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0x2 - ble _0805C2C8 - ldr r0, [r7] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - beq _0805C330 - ldrb r3, [r2] - lsls r0, r3, 9 - mov r1, r8 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x2 - beq _0805C330 - ldr r1, =gBattlePartyID - lsls r0, r3, 1 - adds r0, r1 - ldrb r1, [r0] - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - mov r2, r12 - bl EmitCmd34 - bl PlayerBufferExecCompleted - b _0805C3BC - .pool -_0805C330: - ldr r0, =TaskDummy - movs r1, 0xFF - bl CreateTask - ldr r3, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r1, r3 - movs r2, 0 - mov r8, r2 - strb r0, [r1] - ldr r5, =gTasks - ldrb r2, [r4] - adds r3, r2, r3 - ldrb r0, [r3] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldr r5, =gBattleBufferA - lsls r2, 9 - adds r6, r5, 0x1 - adds r2, r6 - ldrb r2, [r2] - movs r0, 0xF - ands r0, r2 - strh r0, [r1, 0x8] - ldr r3, =gBattleStruct - ldr r1, [r3] - adds r1, 0x49 - ldrb r0, [r4] - lsls r0, 9 - adds r0, r6 - ldrb r0, [r0] - lsrs r0, 4 - strb r0, [r1] - ldr r2, [r3] - adds r2, 0x8B - ldrb r0, [r4] - lsls r0, 9 - adds r1, r5, 0x2 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r1, [r3] - adds r1, 0xB0 - ldrb r0, [r4] - lsls r0, 9 - adds r5, 0x3 - adds r0, r5 - ldrb r0, [r0] - strb r0, [r1] - movs r0, 0x1 - negs r0, r0 - mov r1, r8 - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80597CC - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r4] - strb r0, [r1] -_0805C3BC: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C2AC - - thumb_func_start sub_805C3EC -sub_805C3EC: @ 805C3EC - push {lr} - sub sp, 0x4 - bl BattleMusicStop - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r1, 0x2 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl PlayerBufferExecCompleted - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_805C3EC - - thumb_func_start sub_805C410 -sub_805C410: @ 805C410 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r1, [r0] - lsls r1, 9 - adds r0, r3, 0x2 - adds r0, r1, r0 - ldrb r2, [r0] - adds r3, 0x3 - adds r1, r3 - ldrb r0, [r1] - lsls r0, 8 - orrs r2, r0 - lsls r2, 16 - asrs r7, r2, 16 - cmp r7, 0 - ble _0805C44A - ldr r1, =gUnknown_0203CD70 - ldr r0, [r1] - adds r0, r7 - str r0, [r1] -_0805C44A: - ldr r0, =0x00007fff - cmp r7, r0 - beq _0805C4B4 - ldr r6, =gBattlePartyID - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r2, r9 - ldrb r0, [r2] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0805C4F2 - .pool -_0805C4B4: - ldr r1, =gBattlePartyID - mov r2, r9 - ldrb r0, [r2] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r4, =gHealthBoxesIds - adds r1, r0, r4 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct - mov r2, r9 - ldrb r0, [r2] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0 - bl UpdateHpTextInHealthbox -_0805C4F2: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t1_healthbar_update - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C410 - - thumb_func_start sub_805C528 -sub_805C528: @ 805C528 - push {r4-r7,lr} - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 9 - adds r1, r5, 0x1 - adds r0, r1 - ldrb r7, [r0] - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - cmp r0, 0x63 - bls _0805C560 - bl PlayerBufferExecCompleted - b _0805C5AC - .pool -_0805C560: - movs r0, 0x1 - bl LoadBattleBarGfx - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - ldrb r1, [r6] - lsls r1, 9 - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r0, r5, 0x3 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - ldr r0, =sub_80591B8 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r7, [r1, 0x8] - strh r4, [r1, 0xA] - ldrb r0, [r6] - strh r0, [r1, 0xC] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] -_0805C5AC: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C528 - - thumb_func_start sub_805C5C4 -sub_805C5C4: @ 805C5C4 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0805C618 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059D60 - str r1, [r0] -_0805C618: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C5C4 - - thumb_func_start sub_805C63C -sub_805C63C: @ 805C63C - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0805C68C - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl move_anim_start_t2_for_situation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8059D60 - str r1, [r0] -_0805C68C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C63C - - thumb_func_start sub_805C6A4 -sub_805C6A4: @ 805C6A4 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x37 - bl GetMonData - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - eors r0, r1 - mov r1, sp - strb r0, [r1] - ldrb r0, [r4] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r6 - adds r0, r5 - movs r1, 0x37 - mov r2, sp - bl SetMonData - bl PlayerBufferExecCompleted - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C6A4 - - thumb_func_start sub_805C710 -sub_805C710: @ 805C710 - push {lr} - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_805C710 - - thumb_func_start sub_805C71C -sub_805C71C: @ 805C71C - push {r4,r5,lr} - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r2, 9 - adds r0, r3, 0x1 - adds r0, r2, r0 - ldrb r5, [r0] - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r5, r0 - adds r0, r3, 0x3 - adds r0, r2, r0 - ldrb r0, [r0] - lsls r0, 16 - orrs r5, r0 - adds r0, r3, 0x4 - adds r0, r2, r0 - ldrb r4, [r0] - lsls r4, 24 - adds r0, r3, 0x5 - adds r0, r2, r0 - ldrb r1, [r0] - adds r0, r3, 0x6 - adds r0, r2, r0 - ldrb r0, [r0] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - adds r3, 0x7 - adds r2, r3 - orrs r5, r4 - lsrs r4, r1, 16 - movs r0, 0x80 - lsls r0, 5 - cmp r4, r0 - bhi _0805C78C - ldr r0, =0x040000d4 - str r2, [r0] - str r5, [r0, 0x4] - lsrs r1, 17 - movs r2, 0x80 - lsls r2, 24 - orrs r1, r2 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - b _0805C7B8 - .pool -_0805C78C: - ldr r3, =0x040000d4 - str r2, [r3] - str r5, [r3, 0x4] - ldr r0, =0x80000800 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] - movs r0, 0x80 - lsls r0, 5 - adds r2, r0 - adds r5, r0 - ldr r1, =0xfffff000 - adds r4, r1 - cmp r4, r0 - bhi _0805C78C - str r2, [r3] - str r5, [r3, 0x4] - lsrs r0, r4, 1 - movs r1, 0x80 - lsls r1, 24 - orrs r0, r1 - str r0, [r3, 0x8] - ldr r0, [r3, 0x8] -_0805C7B8: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C71C - - thumb_func_start sub_805C7D0 -sub_805C7D0: @ 805C7D0 - push {lr} - ldr r2, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C7D0 - - thumb_func_start sub_805C800 -sub_805C800: @ 805C800 - push {lr} - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_805C800 - - thumb_func_start sub_805C80C -sub_805C80C: @ 805C80C - push {lr} - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl EmitCmd33 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_805C80C - - thumb_func_start sub_805C820 -sub_805C820: @ 805C820 - push {lr} - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl EmitCmd34 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_805C820 - - thumb_func_start sub_805C834 -sub_805C834: @ 805C834 - push {lr} - movs r0, 0x1 - movs r1, 0 - bl EmitCmd35 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_805C834 - - thumb_func_start sub_805C848 -sub_805C848: @ 805C848 - push {lr} - movs r0, 0x1 - movs r1, 0 - bl EmitCmd36 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_805C848 - - thumb_func_start sub_805C85C -sub_805C85C: @ 805C85C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C85C - - thumb_func_start sub_805C878 -sub_805C878: @ 805C878 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C878 - - thumb_func_start sub_805C8B0 -sub_805C8B0: @ 805C8B0 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C8B0 - - thumb_func_start sub_805C8C8 -sub_805C8C8: @ 805C8C8 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C8C8 - - thumb_func_start dp01t_29_1_blink -dp01t_29_1_blink: @ 805C8F0 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0805C924 - bl PlayerBufferExecCompleted - b _0805C94E - .pool -_0805C924: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t1 - str r1, [r0] -_0805C94E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_29_1_blink - - thumb_func_start sub_805C960 -sub_805C960: @ 805C960 - push {lr} - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_805C960 - - thumb_func_start sub_805C96C -sub_805C96C: @ 805C96C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0805C980 - movs r3, 0xC0 -_0805C980: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805C96C - - thumb_func_start sub_805C9B0 -sub_805C9B0: @ 805C9B0 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0805C9EC - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0805CA00 - .pool -_0805C9EC: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0805CA00: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_805C9B0 - - thumb_func_start sub_805CA0C -sub_805CA0C: @ 805CA0C - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CA0C - - thumb_func_start dp01t_2E_1_battle_intro -dp01t_2E_1_battle_intro: @ 805CA4C - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_1_battle_intro - - thumb_func_start dp01t_2F_1_pokemon_enter -dp01t_2F_1_pokemon_enter: @ 805CA80 - push {r4-r7,lr} - ldr r6, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r7] - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x38] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f8 - bl AllocSpritePalette - adds r4, r0, 0 - lsls r4, 24 - ldr r1, =gTrainerBackPicPaletteTable - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - lsrs r4, 20 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldrb r0, [r7] - adds r0, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =task05_08033660 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r7] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805CBA2 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0805CBA2: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2F_1_pokemon_enter - - thumb_func_start sub_805CC00 -sub_805CC00: @ 805CC00 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r4, [r5, 0x38] - lsls r4, 24 - lsrs r4, 24 - bl FreeSpriteOamMatrix - ldrb r0, [r5, 0x5] - lsrs r0, 4 - bl GetSpritePaletteTagByPaletteNum - lsls r0, 16 - lsrs r0, 16 - bl FreeSpritePaletteByTag - adds r0, r5, 0 - bl DestroySprite - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - bl BattleLoadPlayerMonSpriteGfx - ldr r0, =gBankSpriteIds - adds r4, r0 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CC00 - - thumb_func_start task05_08033660 -task05_08033660: @ 805CC68 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x1E - bgt _0805CC94 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0805CD50 - .pool -_0805CC94: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0805CCB4 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0805CCE4 -_0805CCB4: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_805B258 - b _0805CD38 - .pool -_0805CCE4: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_805B258 - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_805B258 - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_0805CD38: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8058B40 - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_0805CD50: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task05_08033660 - - thumb_func_start sub_805CD74 -sub_805CD74: @ 805CD74 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0805CDA4 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0805CDA4 - bl PlayerBufferExecCompleted - b _0805CE18 - .pool -_0805CDA4: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _0805CE0C - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_0805CE0C: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_805CE38 - str r0, [r1] -_0805CE18: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CD74 - - thumb_func_start sub_805CE38 -sub_805CE38: @ 805CE38 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _0805CE70 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x5] - bl PlayerBufferExecCompleted -_0805CE70: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CE38 - - thumb_func_start sub_805CE80 -sub_805CE80: @ 805CE80 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0805CEB2 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_0805CEB2: - bl PlayerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CE80 - - thumb_func_start sub_805CED0 -sub_805CED0: @ 805CED0 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - movs r1, 0x1 - bl dp11b_obj_free - ldrb r0, [r4] - movs r1, 0 - bl dp11b_obj_free - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CED0 - - thumb_func_start dp01t_33_1_enemy_move -dp01t_33_1_enemy_move: @ 805CEF4 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _0805CF3A - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl sub_805E408 -_0805CF3A: - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_33_1_enemy_move - - thumb_func_start sub_805CF54 -sub_805CF54: @ 805CF54 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _0805CFB6 - ldr r4, =gBattleBufferA - ldrb r2, [r5] - lsls r1, r2, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - adds r0, r4, 0x2 - adds r0, r1, r0 - ldrb r3, [r0] - adds r4, 0x3 - adds r1, r4 - ldrb r0, [r1] - lsls r0, 8 - orrs r3, r0 - str r3, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - adds r3, r6, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _0805CFA4 - bl PlayerBufferExecCompleted - b _0805CFB0 - .pool -_0805CFA4: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_8030B2C - str r0, [r1] -_0805CFB0: - adds r0, r6, 0 - bl sub_817E32C -_0805CFB6: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805CF54 - - thumb_func_start dp01t_35_1_link_standby_message_and_free_vram -dp01t_35_1_link_standby_message_and_free_vram: @ 805CFC8 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 2 - adds r0, r4 - bl sub_81851A8 - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0805D002 - cmp r0, 0x1 - bgt _0805CFF8 - cmp r0, 0 - beq _0805CFFE - b _0805D020 - .pool -_0805CFF8: - cmp r0, 0x2 - beq _0805D01C - b _0805D020 -_0805CFFE: - bl b_link_standby_message -_0805D002: - ldr r4, =gActiveBank - ldrb r0, [r4] - movs r1, 0x1 - bl dp11b_obj_free - ldrb r0, [r4] - movs r1, 0 - bl dp11b_obj_free - b _0805D020 - .pool -_0805D01C: - bl b_link_standby_message -_0805D020: - bl PlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end dp01t_35_1_link_standby_message_and_free_vram - - thumb_func_start sub_805D02C -sub_805D02C: @ 805D02C - push {r4,lr} - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r3, [r4] - lsls r0, r3, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r2, [r0] - cmp r2, 0x1 - beq _0805D074 - cmp r2, 0x1 - bgt _0805D054 - cmp r2, 0 - beq _0805D05A - b _0805D084 - .pool -_0805D054: - cmp r2, 0x2 - beq _0805D07C - b _0805D084 -_0805D05A: - ldr r0, =gActionSelectionCursor - adds r0, r3, r0 - strb r2, [r0] - ldr r1, =gMoveSelectionCursor - ldrb r0, [r4] - adds r0, r1 - strb r2, [r0] - b _0805D084 - .pool -_0805D074: - ldr r0, =gActionSelectionCursor - b _0805D07E - .pool -_0805D07C: - ldr r0, =gMoveSelectionCursor -_0805D07E: - adds r0, r3, r0 - movs r1, 0 - strb r1, [r0] -_0805D084: - bl PlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805D02C - - thumb_func_start sub_805D094 -sub_805D094: @ 805D094 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r0, r4 - bl sub_81851A8 - ldr r2, =gBattleOutcome - ldrb r0, [r5] - lsls r0, 9 - subs r1, r4, 0x3 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r0, =gSaveBlock2Ptr - ldr r3, [r0] - ldrb r0, [r5] - lsls r0, 9 - subs r4, 0x2 - adds r0, r4 - ldrb r0, [r0] - ldr r1, =0x00000ca9 - adds r3, r1 - movs r1, 0x1 - ands r1, r0 - lsls r1, 3 - ldrb r2, [r3] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl PlayerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_805D094 - - thumb_func_start nullsub_22 -nullsub_22: @ 805D114 - bx lr - thumb_func_end nullsub_22 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s deleted file mode 100644 index f82e1c3c3..000000000 --- a/asm/battle_controller_player_partner.s +++ /dev/null @@ -1,6347 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_77 -nullsub_77: @ 81BADF0 - bx lr - thumb_func_end nullsub_77 - - thumb_func_start SetBankFuncToPlayerPartnerBufferRunCommand -SetBankFuncToPlayerPartnerBufferRunCommand: @ 81BADF4 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerPartnerBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToPlayerPartnerBufferRunCommand - - thumb_func_start PlayerPartnerBufferRunCommand -PlayerPartnerBufferRunCommand: @ 81BAE10 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _081BAE5C - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _081BAE58 - ldr r0, =gPlayerPartnerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _081BAE5C - .pool -_081BAE58: - bl PlayerPartnerBufferExecCompleted -_081BAE5C: - pop {r0} - bx r0 - thumb_func_end PlayerPartnerBufferRunCommand - - thumb_func_start sub_81BAE60 -sub_81BAE60: @ 81BAE60 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081BAE84 - bl PlayerPartnerBufferExecCompleted -_081BAE84: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAE60 - - thumb_func_start sub_81BAE98 -sub_81BAE98: @ 81BAE98 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081BAEE8 - movs r0, 0 - bl nullsub_25 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - bl PlayerPartnerBufferExecCompleted -_081BAEE8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAE98 - - thumb_func_start sub_81BAF00 -sub_81BAF00: @ 81BAF00 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _081BAF38 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl PlayerPartnerBufferExecCompleted -_081BAF38: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAF00 - - thumb_func_start sub_81BAF48 -sub_81BAF48: @ 81BAF48 - push {r4-r6,lr} - movs r6, 0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BAF6C - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BAFA0 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081BAFA0 -_081BAF6C: - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081BAFD8 - b _081BAFD6 - .pool -_081BAFA0: - ldr r2, =gSprites - ldr r5, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r2, 0 - adds r4, 0x1C - adds r0, r4 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - cmp r2, r0 - bne _081BAFD8 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r2 - bne _081BAFD8 -_081BAFD6: - movs r6, 0x1 -_081BAFD8: - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - beq _081BAFE4 - movs r6, 0 -_081BAFE4: - cmp r6, 0 - beq _081BB00A - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAF00 - str r1, [r0] -_081BB00A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BAF48 - - thumb_func_start sub_81BB02C -sub_81BB02C: @ 81BB02C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gBattleSpritesDataPtr - mov r12, r0 - ldr r0, [r0] - ldr r7, =gActiveBank - ldrb r2, [r7] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4] - movs r5, 0x8 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _081BB058 - b _081BB196 -_081BB058: - movs r1, 0x2 - mov r8, r1 - adds r1, r2, 0 - mov r0, r8 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _081BB07A - b _081BB196 -_081BB07A: - ldr r1, =gSprites - mov r10, r1 - ldr r0, =gUnknown_03005D7C - mov r9, r0 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r5, r10 - adds r5, 0x1C - adds r0, r5 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _081BB196 - ldr r0, =gBankSpriteIds - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r3 - bne _081BB196 - ldrb r0, [r4, 0x9] - adds r0, 0x1 - strb r0, [r4, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081BB196 - mov r1, r12 - ldr r0, [r1] - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r6, [r0, 0x9] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BB134 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BB134 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - add r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r10 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r0, [r7] - mov r1, r8 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - bl sub_8076918 - ldrb r0, [r7] - mov r1, r8 - eors r0, r1 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_081BB134: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldr r5, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAF48 - str r1, [r0] -_081BB196: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB02C - - thumb_func_start sub_81BB1D4 -sub_81BB1D4: @ 81BB1D4 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _081BB202 - movs r2, 0x24 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _081BB202 - bl PlayerPartnerBufferExecCompleted -_081BB202: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB1D4 - - thumb_func_start bx_t3_healthbar_update -bx_t3_healthbar_update: @ 81BB214 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r6, =gHealthBoxesIds - adds r1, r0, r6 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081BB25C - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _081BB276 - .pool -_081BB25C: - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl PlayerPartnerBufferExecCompleted -_081BB276: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bx_t3_healthbar_update - - thumb_func_start sub_81BB284 -sub_81BB284: @ 81BB284 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081BB296 - bl PlayerPartnerBufferExecCompleted -_081BB296: - pop {r0} - bx r0 - thumb_func_end sub_81BB284 - - thumb_func_start sub_81BB29C -sub_81BB29C: @ 81BB29C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - mov r8, r0 - ldrb r0, [r0, 0x8] - mov r10, r0 - mov r1, r8 - ldrb r7, [r1, 0xC] - str r7, [sp, 0x8] - ldrh r2, [r1, 0xA] - str r2, [sp, 0xC] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081BB2E2 - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r10, r0 - bne _081BB2E2 - b _081BB3F8 -_081BB2E2: - movs r0, 0x64 - mov r1, r10 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x4] - ldr r3, =gExperienceTables - adds r4, 0x1 - lsls r4, 2 - ldr r2, =gBaseStats - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x13] - movs r1, 0xCA - lsls r1, 1 - muls r1, r2 - adds r4, r1 - adds r4, r3 - ldr r2, [r4] - str r2, [sp] - ldr r3, [sp, 0xC] - lsls r1, r3, 16 - asrs r1, 16 - adds r0, r1 - cmp r0, r2 - bcc _081BB3D0 - adds r0, r6, 0 - movs r1, 0x19 - mov r2, sp - bl SetMonData - adds r0, r6, 0 - bl CalculateMonStats - ldr r2, [sp] - add r0, sp, 0x4 - ldrh r0, [r0] - subs r2, r0 - ldr r0, [sp, 0xC] - subs r2, r0, r2 - ldr r4, =gActiveBank - ldrb r5, [r4] - strb r7, [r4] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xB - bl EmitCmd33 - strb r5, [r4] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BB3B8 - ldr r2, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r2 - mov r1, r10 - ldrh r0, [r0] - cmp r1, r0 - beq _081BB396 - movs r0, 0x2 - eors r7, r0 - lsls r0, r7, 1 - adds r0, r2 - ldrh r0, [r0] - cmp r1, r0 - bne _081BB3B8 -_081BB396: - ldr r0, =sub_81BB628 - b _081BB3FA - .pool -_081BB3B8: - ldr r0, =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81BB740 - b _081BB3FC - .pool -_081BB3D0: - str r0, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r6, 0 - movs r1, 0x19 - bl SetMonData - ldr r1, =gBattleBankFunc - ldr r3, [sp, 0x8] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, =sub_81BB284 - str r1, [r0] - mov r0, r9 - bl DestroyTask - b _081BB3FE - .pool -_081BB3F8: - ldr r0, =sub_81BB414 -_081BB3FA: - mov r1, r8 -_081BB3FC: - str r0, [r1] -_081BB3FE: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB29C - - thumb_func_start sub_81BB414 -sub_81BB414: @ 81BB414 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r2, r0, 2 - mov r8, r2 - add r8, r0 - mov r0, r8 - lsls r0, 3 - mov r8, r0 - add r8, r1 - mov r2, r8 - ldrb r1, [r2, 0x8] - movs r0, 0xA - ldrsh r2, [r2, r0] - mov r9, r2 - mov r2, r8 - ldrb r2, [r2, 0xC] - mov r10, r2 - movs r0, 0x64 - adds r6, r1, 0 - muls r6, r0 - ldr r0, =gPlayerParty - adds r6, r0 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r6, 0 - movs r1, 0x19 - bl GetMonData - adds r3, r0, 0 - ldr r6, =gExperienceTables - lsls r1, r4, 2 - ldr r2, =gBaseStats - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - adds r0, r2 - ldrb r2, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r2 - adds r1, r0 - adds r1, r6 - ldr r1, [r1] - subs r3, r1 - adds r4, 0x1 - lsls r4, 2 - adds r4, r0 - adds r4, r6 - ldr r2, [r4] - subs r2, r1 - ldr r0, =gHealthBoxesIds - add r0, r10 - ldrb r1, [r0] - mov r0, r9 - negs r0, r0 - str r0, [sp] - mov r0, r10 - bl SetBattleBarStruct - movs r0, 0x21 - bl PlaySE - ldr r0, =sub_81BB4E4 - mov r1, r8 - str r0, [r1] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB414 - - thumb_func_start sub_81BB4E4 -sub_81BB4E4: @ 81BB4E4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r6, r0, r1 - ldrh r1, [r6, 0x1C] - movs r2, 0x1C - ldrsh r0, [r6, r2] - cmp r0, 0xC - bgt _081BB514 - adds r0, r1, 0x1 - strh r0, [r6, 0x1C] - b _081BB610 - .pool -_081BB514: - ldrb r0, [r6, 0x8] - mov r9, r0 - ldrh r2, [r6, 0xA] - mov r10, r2 - ldrb r7, [r6, 0xC] - ldr r5, =gHealthBoxesIds - adds r5, r7, r5 - ldrb r1, [r5] - adds r0, r7, 0 - movs r2, 0x1 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - bne _081BB610 - movs r0, 0x21 - bl m4aSongNumStop - movs r0, 0x64 - mov r1, r9 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r3, =gExperienceTables - adds r4, 0x1 - lsls r4, 2 - ldr r2, =gBaseStats - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r1 - adds r4, r0 - adds r4, r3 - ldr r1, [r4] - str r1, [sp] - mov r2, r10 - lsls r0, r2, 16 - asrs r4, r0, 16 - ldr r0, [sp, 0x4] - adds r0, r4 - cmp r0, r1 - blt _081BB5F4 - adds r0, r5, 0 - movs r1, 0x19 - mov r2, sp - bl SetMonData - adds r0, r5, 0 - bl CalculateMonStats - ldr r2, [sp] - add r0, sp, 0x4 - ldrh r0, [r0] - subs r2, r0 - subs r2, r4, r2 - ldr r4, =gActiveBank - ldrb r5, [r4] - strb r7, [r4] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xB - bl EmitCmd33 - strb r5, [r4] - ldr r0, =sub_81BB628 - str r0, [r6] - b _081BB610 - .pool -_081BB5F4: - str r0, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r5, 0 - movs r1, 0x19 - bl SetMonData - ldr r1, =gBattleBankFunc - lsls r0, r7, 2 - adds r0, r1 - ldr r1, =sub_81BB284 - str r1, [r0] - mov r0, r8 - bl DestroyTask -_081BB610: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB4E4 - - thumb_func_start sub_81BB628 -sub_81BB628: @ 81BB628 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldrb r4, [r0, 0xC] - ldrb r6, [r0, 0x8] - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BB65C - ldr r1, =gBattlePartyID - movs r0, 0x2 - adds r2, r4, 0 - eors r2, r0 - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r6, r0 - bne _081BB65C - adds r4, r2, 0 -_081BB65C: - adds r0, r4, 0 - adds r1, r4, 0 - adds r2, r4, 0 - movs r3, 0 - bl move_anim_start_t4 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81BB688 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB628 - - thumb_func_start sub_81BB688 -sub_81BB688: @ 81BB688 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r2, r0, r1 - ldrb r5, [r2, 0xC] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BB72A - ldrb r4, [r2, 0x8] - movs r0, 0x64 - adds r1, r4, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0x38 - bl GetMonData - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BB708 - ldr r1, =gBattlePartyID - movs r0, 0x2 - adds r2, r5, 0 - eors r2, r0 - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - bne _081BB708 - ldr r0, =gHealthBoxesIds - adds r0, r2, r0 - ldrb r0, [r0] - adds r1, r7, 0 - movs r2, 0 - bl UpdateHealthboxAttribute - b _081BB71C - .pool -_081BB708: - ldr r0, =gHealthBoxesIds - adds r0, r5, r0 - ldrb r0, [r0] - movs r1, 0x64 - muls r1, r4 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute -_081BB71C: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81BB740 - str r0, [r1] -_081BB72A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB688 - - thumb_func_start sub_81BB740 -sub_81BB740: @ 81BB740 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - ldrb r1, [r4, 0x8] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - bl GetMonData - ldrb r0, [r4, 0xC] - ldr r1, =gBattleBankFunc - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB284 - str r1, [r0] - adds r0, r5, 0 - bl DestroyTask - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB740 - - thumb_func_start sub_81BB78C -sub_81BB78C: @ 81BB78C - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r2, [r4] - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r3, 0x22 - ldrsh r1, [r0, r3] - movs r3, 0x26 - ldrsh r0, [r0, r3] - adds r1, r0 - cmp r1, 0xA0 - ble _081BB808 - ldr r1, =gBattlePartyID - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl nullsub_24 - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerPartnerBufferExecCompleted -_081BB808: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB78C - - thumb_func_start sub_81BB828 -sub_81BB828: @ 81BB828 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BB87C - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerPartnerBufferExecCompleted -_081BB87C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB828 - - thumb_func_start sub_81BB898 -sub_81BB898: @ 81BB898 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081BB8AA - bl PlayerPartnerBufferExecCompleted -_081BB8AA: - pop {r0} - bx r0 - thumb_func_end sub_81BB898 - - thumb_func_start bx_blink_t3 -bx_blink_t3: @ 81BB8B0 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _081BB8FC - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl PlayerPartnerBufferExecCompleted - b _081BB926 - .pool -_081BB8FC: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _081BB920 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_081BB920: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_081BB926: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t3 - - thumb_func_start sub_81BB92C -sub_81BB92C: @ 81BB92C - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081BB97E - adds r0, r3, 0 - bl sub_805E408 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r2, [r4] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081BB972 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_081BB972: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =dp01t_35_3_free_vram - str r0, [r1] -_081BB97E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB92C - - thumb_func_start dp01t_35_3_free_vram -dp01t_35_3_free_vram: @ 81BB9A0 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BB9DC - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081BB9DC - bl PlayerPartnerBufferExecCompleted -_081BB9DC: - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_35_3_free_vram - - thumb_func_start sub_81BB9F4 -sub_81BB9F4: @ 81BB9F4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r7, =gActiveBank - ldrb r1, [r7] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081BBAB0 - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r0, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r0, =gBattlePartyID - mov r8, r0 - ldrb r1, [r7] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - bl sub_805E990 - ldr r1, =gBankSpriteIds - ldrb r0, [r7] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - lsls r1, 1 - add r1, r8 - ldrh r1, [r1] - muls r1, r6 - adds r1, r5 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - bl sub_8076918 - ldrb r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB92C - str r1, [r0] -_081BBAB0: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BB9F4 - - thumb_func_start sub_81BBAE8 -sub_81BBAE8: @ 81BBAE8 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _081BBB1A - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081BBB1A: - ldr r5, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r4] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081BBB60 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _081BBB60 - adds r0, r3, r5 - bl DestroySprite - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB9F4 - str r1, [r0] -_081BBB60: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BBAE8 - - thumb_func_start PlayerPartnerBufferExecCompleted -PlayerPartnerBufferExecCompleted: @ 81BBB8C - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =PlayerPartnerBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081BBBE0 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _081BBBF2 - .pool -_081BBBE0: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_081BBBF2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerPartnerBufferExecCompleted - - thumb_func_start sub_81BBC04 -sub_81BBC04: @ 81BBC04 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081BBC26 - bl PlayerPartnerBufferExecCompleted -_081BBC26: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BBC04 - - thumb_func_start bx_80E8A6C -bx_80E8A6C: @ 81BBC34 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081BBC56 - bl PlayerPartnerBufferExecCompleted -_081BBC56: - pop {r0} - bx r0 - .pool - thumb_func_end bx_80E8A6C - - thumb_func_start dp01t_00_3_getattr -dp01t_00_3_getattr: @ 81BBC64 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _081BBC9C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl dp01_getattr_by_ch1_for_player_pokemon - adds r6, r0, 0 - b _081BBCBE - .pool -_081BBC9C: - ldrb r4, [r1] - movs r5, 0 -_081BBCA0: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081BBCB6 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl dp01_getattr_by_ch1_for_player_pokemon - adds r6, r0 -_081BBCB6: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _081BBCA0 -_081BBCBE: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl PlayerPartnerBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end dp01t_00_3_getattr - - thumb_func_start dp01_getattr_by_ch1_for_player_pokemon -dp01_getattr_by_ch1_for_player_pokemon: @ 81BBCD8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _081BBD02 - bl _081BC46E -_081BBD02: - lsls r0, 2 - ldr r1, =_081BBD18 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BBD18: - .4byte _081BBE08 - .4byte _081BC02C - .4byte _081BC03C - .4byte _081BC04C - .4byte _081BC0B4 - .4byte _081BC0B4 - .4byte _081BC0B4 - .4byte _081BC0B4 - .4byte _081BC0D0 - .4byte _081BC10C - .4byte _081BC10C - .4byte _081BC10C - .4byte _081BC10C - .4byte _081BC46E - .4byte _081BC46E - .4byte _081BC46E - .4byte _081BC46E - .4byte _081BC128 - .4byte _081BC138 - .4byte _081BC168 - .4byte _081BC178 - .4byte _081BC188 - .4byte _081BC198 - .4byte _081BC1A8 - .4byte _081BC1B8 - .4byte _081BC1C8 - .4byte _081BC1D8 - .4byte _081BC1E8 - .4byte _081BC1F8 - .4byte _081BC208 - .4byte _081BC218 - .4byte _081BC228 - .4byte _081BC278 - .4byte _081BC288 - .4byte _081BC298 - .4byte _081BC2A8 - .4byte _081BC2B8 - .4byte _081BC2C8 - .4byte _081BC2D8 - .4byte _081BC2E8 - .4byte _081BC2F8 - .4byte _081BC32C - .4byte _081BC33C - .4byte _081BC34C - .4byte _081BC35C - .4byte _081BC36C - .4byte _081BC37C - .4byte _081BC38C - .4byte _081BC39C - .4byte _081BC3BC - .4byte _081BC3CC - .4byte _081BC3DC - .4byte _081BC3EC - .4byte _081BC3FC - .4byte _081BC40C - .4byte _081BC41C - .4byte _081BC42C - .4byte _081BC43C - .4byte _081BC44C - .4byte _081BC45C -_081BBE08: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_081BBE54: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _081BBE54 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_081BC00C: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _081BC00C - b _081BC46E - .pool -_081BC02C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _081BC3A6 - .pool -_081BC03C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _081BC3A6 - .pool -_081BC04C: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_081BC062: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _081BC062 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_081BC0A0: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _081BC0A0 - b _081BC46E - .pool -_081BC0B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _081BC3A6 - .pool -_081BC0D0: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_081BC0DC: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _081BC0DC - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _081BC46E - .pool -_081BC10C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _081BC466 - .pool -_081BC128: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _081BC142 - .pool -_081BC138: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_081BC142: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _081BC46E - .pool -_081BC168: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _081BC466 - .pool -_081BC178: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _081BC466 - .pool -_081BC188: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _081BC466 - .pool -_081BC198: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _081BC466 - .pool -_081BC1A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _081BC466 - .pool -_081BC1B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _081BC466 - .pool -_081BC1C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _081BC466 - .pool -_081BC1D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _081BC466 - .pool -_081BC1E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _081BC466 - .pool -_081BC1F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _081BC466 - .pool -_081BC208: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _081BC466 - .pool -_081BC218: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _081BC466 - .pool -_081BC228: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _081BC46E - .pool -_081BC278: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _081BC466 - .pool -_081BC288: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _081BC466 - .pool -_081BC298: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _081BC466 - .pool -_081BC2A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _081BC466 - .pool -_081BC2B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _081BC466 - .pool -_081BC2C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _081BC466 - .pool -_081BC2D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _081BC302 - .pool -_081BC2E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _081BC3A6 - .pool -_081BC2F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_081BC302: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _081BC46E - .pool -_081BC32C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _081BC466 - .pool -_081BC33C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _081BC3A6 - .pool -_081BC34C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _081BC3A6 - .pool -_081BC35C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _081BC3A6 - .pool -_081BC36C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _081BC3A6 - .pool -_081BC37C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _081BC3A6 - .pool -_081BC38C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _081BC3A6 - .pool -_081BC39C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_081BC3A6: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _081BC46E - .pool -_081BC3BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _081BC466 - .pool -_081BC3CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _081BC466 - .pool -_081BC3DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _081BC466 - .pool -_081BC3EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _081BC466 - .pool -_081BC3FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _081BC466 - .pool -_081BC40C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _081BC466 - .pool -_081BC41C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _081BC466 - .pool -_081BC42C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _081BC466 - .pool -_081BC43C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _081BC466 - .pool -_081BC44C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _081BC466 - .pool -_081BC45C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_081BC466: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_081BC46E: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end dp01_getattr_by_ch1_for_player_pokemon - - thumb_func_start sub_81BC484 -sub_81BC484: @ 81BC484 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BC484 - - thumb_func_start sub_81BC490 -sub_81BC490: @ 81BC490 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _081BC4C0 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_81BC4E8 - b _081BC4DE - .pool -_081BC4C0: - ldrb r4, [r1] - movs r5, 0 -_081BC4C4: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081BC4D2 - adds r0, r5, 0 - bl sub_81BC4E8 -_081BC4D2: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _081BC4C4 -_081BC4DE: - bl PlayerPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81BC490 - - thumb_func_start sub_81BC4E8 -sub_81BC4E8: @ 81BC4E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _081BC514 - bl _081BCEAE -_081BC514: - lsls r0, 2 - ldr r1, =_081BC52C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BC52C: - .4byte _081BC61C - .4byte _081BC7B4 - .4byte _081BC7D4 - .4byte _081BC7F4 - .4byte _081BC84C - .4byte _081BC84C - .4byte _081BC84C - .4byte _081BC84C - .4byte _081BC874 - .4byte _081BC8D8 - .4byte _081BC8D8 - .4byte _081BC8D8 - .4byte _081BC8D8 - .4byte _081BCEAE - .4byte _081BCEAE - .4byte _081BCEAE - .4byte _081BCEAE - .4byte _081BC908 - .4byte _081BC928 - .4byte _081BC948 - .4byte _081BC968 - .4byte _081BC988 - .4byte _081BC9A8 - .4byte _081BC9C8 - .4byte _081BC9E8 - .4byte _081BCA08 - .4byte _081BCA28 - .4byte _081BCA48 - .4byte _081BCA68 - .4byte _081BCA88 - .4byte _081BCAA8 - .4byte _081BCAC8 - .4byte _081BCB38 - .4byte _081BCB58 - .4byte _081BCB78 - .4byte _081BCB98 - .4byte _081BCBB8 - .4byte _081BCBD8 - .4byte _081BCBF8 - .4byte _081BCC18 - .4byte _081BCC38 - .4byte _081BCC58 - .4byte _081BCC78 - .4byte _081BCC98 - .4byte _081BCCB8 - .4byte _081BCCD8 - .4byte _081BCCF8 - .4byte _081BCD18 - .4byte _081BCD38 - .4byte _081BCD58 - .4byte _081BCD78 - .4byte _081BCD98 - .4byte _081BCDB8 - .4byte _081BCDD8 - .4byte _081BCDF8 - .4byte _081BCE18 - .4byte _081BCE38 - .4byte _081BCE58 - .4byte _081BCE78 - .4byte _081BCE98 -_081BC61C: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_081BC682: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _081BC682 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _081BCEAE - .pool -_081BC7B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _081BCEAE - .pool -_081BC7D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _081BCEAE - .pool -_081BC7F4: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_081BC80E: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _081BC80E - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _081BCEAE - .pool -_081BC84C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _081BC8F0 - .pool -_081BC874: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _081BCEAE - .pool -_081BC8D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_081BC8F0: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _081BCEAE - .pool -_081BC908: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _081BCEAE - .pool -_081BC928: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _081BCEAE - .pool -_081BC948: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _081BCEAE - .pool -_081BC968: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _081BCEAE - .pool -_081BC988: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _081BCEAE - .pool -_081BC9A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _081BCEAE - .pool -_081BC9C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _081BCEAE - .pool -_081BC9E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _081BCEAE - .pool -_081BCA08: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _081BCEAE - .pool -_081BCA28: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _081BCEAE - .pool -_081BCA48: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _081BCEAE - .pool -_081BCA68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _081BCEAE - .pool -_081BCA88: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _081BCEAE - .pool -_081BCAA8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _081BCEAE - .pool -_081BCAC8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _081BCBE8 - .pool -_081BCB38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _081BCEAE - .pool -_081BCB58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _081BCEAE - .pool -_081BCB78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _081BCEAE - .pool -_081BCB98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _081BCEAE - .pool -_081BCBB8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _081BCEAE - .pool -_081BCBD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_081BCBE8: - movs r1, 0x2C - bl SetMonData - b _081BCEAE - .pool -_081BCBF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _081BCEAE - .pool -_081BCC18: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _081BCEAE - .pool -_081BCC38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _081BCEAE - .pool -_081BCC58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _081BCEAE - .pool -_081BCC78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _081BCEAE - .pool -_081BCC98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _081BCEAE - .pool -_081BCCB8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _081BCEAE - .pool -_081BCCD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _081BCEAE - .pool -_081BCCF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _081BCEAE - .pool -_081BCD18: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _081BCEAE - .pool -_081BCD38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _081BCEAE - .pool -_081BCD58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _081BCEAE - .pool -_081BCD78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _081BCEAE - .pool -_081BCD98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _081BCEAE - .pool -_081BCDB8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _081BCEAE - .pool -_081BCDD8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _081BCEAE - .pool -_081BCDF8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _081BCEAE - .pool -_081BCE18: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _081BCEAE - .pool -_081BCE38: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _081BCEAE - .pool -_081BCE58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _081BCEAE - .pool -_081BCE78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _081BCEAE - .pool -_081BCE98: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_081BCEAE: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BC4E8 - - thumb_func_start sub_81BCEE4 -sub_81BCEE4: @ 81BCEE4 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gPlayerParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _081BCF3C - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_081BCF1A: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _081BCF1A -_081BCF3C: - bl PlayerPartnerBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BCEE4 - - thumb_func_start sub_81BCF58 -sub_81BCF58: @ 81BCF58 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gBattlePartyID - mov r8, r0 - ldr r6, =gActiveBank - ldrb r1, [r6] - lsls r0, r1, 1 - add r0, r8 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r6] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB1D4 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BCF58 - - thumb_func_start sub_81BD074 -sub_81BD074: @ 81BD074 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r4, =gBattleBufferA - lsls r1, r0, 9 - adds r6, r4, 0x2 - adds r1, r6 - ldrb r1, [r1] - bl sub_805EF84 - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - strh r0, [r1] - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r5] - lsls r1, r0, 9 - adds r1, r6 - ldrb r1, [r1] - bl sub_81BD0E4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BBAE8 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD074 - - thumb_func_start sub_81BD0E4 -sub_81BD0E4: @ 81BD0E4 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_805EF84 - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD0E4 - - thumb_func_start sub_81BD260 -sub_81BD260: @ 81BD260 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _081BD2A8 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BD2F0 - str r1, [r0] - b _081BD2DE - .pool -_081BD2A8: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl PlayerPartnerBufferExecCompleted -_081BD2DE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD260 - - thumb_func_start sub_81BD2F0 -sub_81BD2F0: @ 81BD2F0 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _081BD318 - cmp r0, 0x1 - beq _081BD346 - b _081BD36E - .pool -_081BD318: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081BD332 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_081BD332: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _081BD36E -_081BD346: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081BD36E - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB828 - str r1, [r0] -_081BD36E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD2F0 - - thumb_func_start sub_81BD37C -sub_81BD37C: @ 81BD37C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r2, =gPartnerTrainerId - ldrh r1, [r2] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _081BD3A8 - movs r4, 0x7 - movs r0, 0x5A - mov r9, r0 - ldr r0, =gTrainerBackPicCoords - ldrb r1, [r0, 0x1C] - b _081BD3BE - .pool -_081BD3A8: - ldrh r0, [r2] - bl sub_8162AA0 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x20 - mov r9, r0 - ldr r1, =gTrainerFrontPicCoords - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] -_081BD3BE: - movs r0, 0x8 - subs r0, r1 - lsls r0, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r0, r1 - lsrs r7, r0, 16 - ldr r0, =gPartnerTrainerId - ldrh r1, [r0] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _081BD494 - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r9 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - b _081BD57C - .pool -_081BD494: - adds r5, r4, 0 - ldr r6, =gActiveBank - ldrb r1, [r6] - adds r0, r5, 0 - bl sub_805DF38 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_806A1C0 - ldr r0, =gUnknown_0202499C - mov r8, r0 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r0, =gTrainerFrontPicPaletteTable - lsls r5, 3 - adds r5, r0 - ldrh r0, [r5, 0x4] - bl IndexOfSpritePaletteTag - ldr r5, =gSprites - ldrb r1, [r6] - adds r1, r4 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x30 - strh r1, [r0, 0x26] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_805D7AC - str r1, [r0] - ldrb r0, [r6] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] -_081BD57C: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAE60 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD37C - - thumb_func_start sub_81BD5BC -sub_81BD5BC: @ 81BD5BC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BD5BC - - thumb_func_start sub_81BD5C8 -sub_81BD5C8: @ 81BD5C8 - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BAE98 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD5C8 - - thumb_func_start sub_81BD674 -sub_81BD674: @ 81BD674 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _081BD6C8 - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081BD6A8 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_081BD6A8: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _081BD73E - .pool -_081BD6C8: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081BD73E - strb r4, [r3, 0x4] - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - movs r1, 0x40 - negs r1, r1 - movs r0, 0x10 - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r3, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x30] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x5 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039C00 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB78C - str r1, [r0] -_081BD73E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD674 - - thumb_func_start sub_81BD760 -sub_81BD760: @ 81BD760 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BD760 - - thumb_func_start sub_81BD76C -sub_81BD76C: @ 81BD76C - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BD76C - - thumb_func_start sub_81BD778 -sub_81BD778: @ 81BD778 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BD778 - - thumb_func_start sub_81BD784 -sub_81BD784: @ 81BD784 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BD784 - - thumb_func_start sub_81BD790 -sub_81BD790: @ 81BD790 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _081BD7A2 - b _081BD8B6 -_081BD7A2: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gUnknown_020244BC - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _081BD898 - bl PlayerPartnerBufferExecCompleted - b _081BD8B6 - .pool -_081BD898: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_3 - str r1, [r0] -_081BD8B6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BD790 - - thumb_func_start bx_move_anim_3 -bx_move_anim_3: @ 81BD8C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _081BD960 - cmp r2, 0x1 - bgt _081BD920 - cmp r2, 0 - beq _081BD92A - b _081BDA3C - .pool -_081BD920: - cmp r2, 0x2 - beq _081BD98A - cmp r2, 0x3 - beq _081BDA00 - b _081BDA3C -_081BD92A: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _081BD94C - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_081BD94C: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _081BDA3C -_081BD960: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081BDA3C - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _081BDA3C -_081BD98A: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _081BDA3C - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081BD9D8 - mov r0, r8 - cmp r0, 0x1 - bhi _081BD9D8 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_081BD9D8: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _081BDA3C - .pool -_081BDA00: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081BDA3C - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl PlayerPartnerBufferExecCompleted -_081BDA3C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_3 - - thumb_func_start sub_81BDA4C -sub_81BDA4C: @ 81BDA4C - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB898 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDA4C - - thumb_func_start sub_81BDAA0 -sub_81BDAA0: @ 81BDAA0 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDAA0 - - thumb_func_start sub_81BDAAC -sub_81BDAAC: @ 81BDAAC - push {lr} - bl AI_TrySwitchOrUseItem - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDAAC - - thumb_func_start sub_81BDABC -sub_81BDABC: @ 81BDABC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDABC - - thumb_func_start sub_81BDAC8 -sub_81BDAC8: @ 81BDAC8 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r4, [r6] - lsls r4, 9 - ldr r0, =gBattleBufferA + 4 - adds r4, r0 - movs r0, 0xF - bl BattleAI_SetupAIData - bl BattleAI_ChooseMoveOrAction - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, =gBattleMoves - lsls r0, r5, 1 - adds r4, r0 - ldrh r1, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x6] - movs r0, 0x12 - ands r0, r1 - cmp r0, 0 - beq _081BDB02 - ldr r1, =gBankTarget - ldrb r0, [r6] - strb r0, [r1] -_081BDB02: - ldrh r1, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x6] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081BDB3C - movs r0, 0x1 - bl GetBankByIdentity - ldr r4, =gBankTarget - strb r0, [r4] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _081BDB3C - movs r0, 0x3 - bl GetBankByIdentity - strb r0, [r4] -_081BDB3C: - ldr r0, =gBankTarget - ldrb r2, [r0] - lsls r2, 8 - orrs r2, r5 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - bl PlayerPartnerBufferExecCompleted - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDAC8 - - thumb_func_start sub_81BDB70 -sub_81BDB70: @ 81BDB70 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDB70 - - thumb_func_start sub_81BDB7C -sub_81BDB7C: @ 81BDB7C - push {r4-r6,lr} - bl GetMostSuitableMonToSwitchInto - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bne _081BDBD0 - movs r0, 0 - bl GetBankByIdentity - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0x2 - bl GetBankByIdentity - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0x3 - b _081BDBA4 -_081BDBA2: - adds r4, 0x1 -_081BDBA4: - cmp r4, 0x5 - bgt _081BDBD0 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _081BDBA2 - ldr r1, =gBattlePartyID - lsls r0, r6, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _081BDBA2 - lsls r0, r5, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r4, r0 - beq _081BDBA2 -_081BDBD0: - ldr r0, =gActiveBank - ldrb r0, [r0] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - adds r0, 0x5C - strb r4, [r0] - lsls r1, r4, 24 - lsrs r1, 24 - movs r0, 0x1 - movs r2, 0 - bl EmitCmd34 - bl PlayerPartnerBufferExecCompleted - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDB7C - - thumb_func_start sub_81BDC04 -sub_81BDC04: @ 81BDC04 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDC04 - - thumb_func_start sub_81BDC10 -sub_81BDC10: @ 81BDC10 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _081BDCA0 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _081BDCCA - .pool -_081BDCA0: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_081BDCCA: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t3_healthbar_update - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDC10 - - thumb_func_start sub_81BDD00 -sub_81BDD00: @ 81BDD00 - push {r4-r7,lr} - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 9 - adds r1, r5, 0x1 - adds r0, r1 - ldrb r7, [r0] - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - cmp r0, 0x63 - bls _081BDD38 - bl PlayerPartnerBufferExecCompleted - b _081BDD84 - .pool -_081BDD38: - movs r0, 0x1 - bl LoadBattleBarGfx - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - ldrb r1, [r6] - lsls r1, 9 - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r0, r5, 0x3 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - ldr r0, =sub_81BB29C - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r7, [r1, 0x8] - strh r4, [r1, 0xA] - ldrb r0, [r6] - strh r0, [r1, 0xC] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] -_081BDD84: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDD00 - - thumb_func_start sub_81BDD9C -sub_81BDD9C: @ 81BDD9C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081BDDF0 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BBC04 - str r1, [r0] -_081BDDF0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDD9C - - thumb_func_start sub_81BDE14 -sub_81BDE14: @ 81BDE14 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081BDE64 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl move_anim_start_t2_for_situation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BBC04 - str r1, [r0] -_081BDE64: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDE14 - - thumb_func_start sub_81BDE7C -sub_81BDE7C: @ 81BDE7C - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDE7C - - thumb_func_start sub_81BDE88 -sub_81BDE88: @ 81BDE88 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDE88 - - thumb_func_start sub_81BDE94 -sub_81BDE94: @ 81BDE94 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDE94 - - thumb_func_start sub_81BDEA0 -sub_81BDEA0: @ 81BDEA0 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDEA0 - - thumb_func_start sub_81BDEAC -sub_81BDEAC: @ 81BDEAC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDEAC - - thumb_func_start sub_81BDEB8 -sub_81BDEB8: @ 81BDEB8 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDEB8 - - thumb_func_start sub_81BDEC4 -sub_81BDEC4: @ 81BDEC4 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDEC4 - - thumb_func_start sub_81BDED0 -sub_81BDED0: @ 81BDED0 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDED0 - - thumb_func_start sub_81BDEDC -sub_81BDEDC: @ 81BDEDC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDEDC - - thumb_func_start sub_81BDEE8 -sub_81BDEE8: @ 81BDEE8 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDEE8 - - thumb_func_start sub_81BDF04 -sub_81BDF04: @ 81BDF04 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDF04 - - thumb_func_start sub_81BDF3C -sub_81BDF3C: @ 81BDF3C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDF3C - - thumb_func_start sub_81BDF54 -sub_81BDF54: @ 81BDF54 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDF54 - - thumb_func_start dp01t_29_3_blink -dp01t_29_3_blink: @ 81BDF7C - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _081BDFB0 - bl PlayerPartnerBufferExecCompleted - b _081BDFDA - .pool -_081BDFB0: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t3 - str r1, [r0] -_081BDFDA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_29_3_blink - - thumb_func_start sub_81BDFEC -sub_81BDFEC: @ 81BDFEC - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BDFEC - - thumb_func_start sub_81BDFF8 -sub_81BDFF8: @ 81BDFF8 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _081BE00C - movs r3, 0xC0 -_081BE00C: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl PlayerPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BDFF8 - - thumb_func_start sub_81BE03C -sub_81BE03C: @ 81BE03C - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _081BE078 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _081BE08C - .pool -_081BE078: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_081BE08C: - bl PlayerPartnerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81BE03C - - thumb_func_start sub_81BE098 -sub_81BE098: @ 81BE098 - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - negs r1, r1 - movs r2, 0x5 - bl PlayCry3 - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE098 - - thumb_func_start dp01t_2E_3_battle_intro -dp01t_2E_3_battle_intro: @ 81BE0D8 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_3_battle_intro - - thumb_func_start sub_81BE10C -sub_81BE10C: @ 81BE10C - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r5] - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x38] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f9 - bl AllocSpritePalette - lsls r0, 24 - lsrs r4, r0, 24 - ldr r2, =gPartnerTrainerId - ldrh r1, [r2] - ldr r0, =0x00000c03 - cmp r1, r0 - bne _081BE1FC - ldr r0, =gTrainerBackPicPaletteTable - ldr r0, [r0, 0x38] - lsls r4, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - b _081BE21A - .pool -_081BE1FC: - ldrh r0, [r2] - bl sub_8162AA0 - lsls r0, 24 - ldr r1, =gTrainerFrontPicPaletteTable - lsrs r0, 21 - adds r0, r1 - ldr r0, [r0] - lsls r4, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette -_081BE21A: - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r5, =gActiveBank - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_81BE2C8 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r5] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081BE27E - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_081BE27E: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_77 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE10C - - thumb_func_start sub_81BE2C8 -sub_81BE2C8: @ 81BE2C8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x17 - bgt _081BE2F4 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _081BE3B0 - .pool -_081BE2F4: - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldrh r0, [r1, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081BE314 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081BE344 -_081BE314: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_81BD0E4 - b _081BE398 - .pool -_081BE344: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r5, =gBattlePartyID - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_81BD0E4 - ldrb r0, [r7] - movs r6, 0x2 - eors r0, r6 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strb r0, [r1] - ldrb r1, [r7] - lsls r0, r1, 1 - adds r0, r5 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl BattleLoadPlayerMonSpriteGfx - ldrb r0, [r7] - movs r1, 0 - bl sub_81BD0E4 - ldrb r0, [r7] - eors r0, r6 - strb r0, [r7] -_081BE398: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81BB02C - str r1, [r0] - mov r3, r9 - strb r3, [r2] - mov r0, r8 - bl DestroyTask -_081BE3B0: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE2C8 - - thumb_func_start dp01t_30_3_80EB11C -dp01t_30_3_80EB11C: @ 81BE3D4 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081BE404 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _081BE404 - bl PlayerPartnerBufferExecCompleted - b _081BE478 - .pool -_081BE404: - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _081BE46C - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_081BE46C: - ldr r0, =gBattleBankFunc - ldrb r1, [r5] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81BE498 - str r0, [r1] -_081BE478: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_30_3_80EB11C - - thumb_func_start sub_81BE498 -sub_81BE498: @ 81BE498 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _081BE4D0 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x5] - bl PlayerPartnerBufferExecCompleted -_081BE4D0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE498 - - thumb_func_start sub_81BE4E0 -sub_81BE4E0: @ 81BE4E0 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081BE512 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_081BE512: - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE4E0 - - thumb_func_start sub_81BE530 -sub_81BE530: @ 81BE530 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BE530 - - thumb_func_start sub_81BE53C -sub_81BE53C: @ 81BE53C - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _081BE582 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl sub_805E408 -_081BE582: - bl PlayerPartnerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE53C - - thumb_func_start sub_81BE59C -sub_81BE59C: @ 81BE59C - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081BE5F4 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _081BE5E8 - bl PlayerPartnerBufferExecCompleted - b _081BE5F4 - .pool -_081BE5E8: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =bx_80E8A6C - str r0, [r1] -_081BE5F4: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE59C - - thumb_func_start sub_81BE604 -sub_81BE604: @ 81BE604 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BE604 - - thumb_func_start sub_81BE610 -sub_81BE610: @ 81BE610 - push {lr} - bl PlayerPartnerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81BE610 - - thumb_func_start sub_81BE61C -sub_81BE61C: @ 81BE61C - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl PlayerPartnerBufferExecCompleted - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BE61C - - thumb_func_start nullsub_128 -nullsub_128: @ 81BE668 - bx lr - thumb_func_end nullsub_128 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s deleted file mode 100644 index f98c10a6c..000000000 --- a/asm/battle_controller_recorded_opponent.s +++ /dev/null @@ -1,5969 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start nullsub_70 -nullsub_70: @ 81864E8 - bx lr - thumb_func_end nullsub_70 - - thumb_func_start SetBankFuncToRecordedOpponentBufferRunCommand -SetBankFuncToRecordedOpponentBufferRunCommand: @ 81864EC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedOpponentBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToRecordedOpponentBufferRunCommand - - thumb_func_start RecordedOpponentBufferRunCommand -RecordedOpponentBufferRunCommand: @ 8186508 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08186554 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _08186550 - ldr r0, =gRecordedOpponentBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _08186554 - .pool -_08186550: - bl RecordedOpponentBufferExecCompleted -_08186554: - pop {r0} - bx r0 - thumb_func_end RecordedOpponentBufferRunCommand - - thumb_func_start sub_8186558 -sub_8186558: @ 8186558 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0818657C - bl RecordedOpponentBufferExecCompleted -_0818657C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186558 - - thumb_func_start sub_8186590 -sub_8186590: @ 8186590 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081865B4 - bl RecordedOpponentBufferExecCompleted -_081865B4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186590 - - thumb_func_start sub_81865C8 -sub_81865C8: @ 81865C8 - push {r4-r6,lr} - ldr r5, =gSprites - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _0818661A - adds r0, r2, r5 - ldrh r0, [r0, 0x6] - bl sub_805DFE4 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl FreeSpriteOamMatrix - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - bl RecordedOpponentBufferExecCompleted -_0818661A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81865C8 - - thumb_func_start sub_8186630 -sub_8186630: @ 8186630 - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r1, [r4] - ldr r3, =gActiveBank - ldrb r0, [r3] - ldr r2, [r1, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x9] - subs r0, 0x1 - strb r0, [r1, 0x9] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _08186668 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x9] - bl RecordedOpponentBufferExecCompleted -_08186668: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186630 - - thumb_func_start sub_8186678 -sub_8186678: @ 8186678 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r0, 0 - mov r9, r0 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081866A4 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081866F8 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081866F8 -_081866A4: - ldr r4, =gSprites - ldr r0, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r3, [r2] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - mov r8, r2 - cmp r1, r0 - bne _08186764 - ldr r0, =gBankSpriteIds - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08186764 - b _0818676A - .pool -_081866F8: - ldr r6, =gSprites - ldr r7, =gHealthBoxesIds - ldr r2, =gActiveBank - ldrb r3, [r2] - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r6, 0 - adds r5, 0x1C - adds r0, r5 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - mov r8, r2 - cmp r4, r0 - bne _08186764 - movs r0, 0x2 - adds r2, r3, 0 - eors r2, r0 - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r0, [r0] - cmp r0, r4 - bne _08186764 - ldr r4, =gBankSpriteIds - adds r0, r3, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08186764 - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08186764 - movs r1, 0x1 - mov r9, r1 -_08186764: - mov r2, r9 - cmp r2, 0 - beq _0818683A -_0818676A: - mov r6, r8 - ldrb r0, [r6] - bl GetBankIdentity - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bne _08186816 - ldr r0, =gBattleSpritesDataPtr - mov r12, r0 - ldr r0, [r0] - ldrb r2, [r6] - ldr r5, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r5 - ldrb r1, [r4, 0x1] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0818683A - movs r7, 0x2 - adds r1, r7, 0 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x1] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0818683A - ldrb r1, [r4] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r4] - mov r1, r12 - ldr r0, [r1] - ldrb r2, [r6] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - mov r0, r12 - ldr r2, [r0] - ldrb r0, [r6] - adds r1, r7, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - mov r1, r12 - ldr r2, [r1] - ldrb r0, [r6] - adds r1, r7, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag -_08186816: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - mov r2, r8 - ldrb r1, [r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x9] - ldr r1, =gBattleBankFunc - mov r2, r8 - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186630 - str r1, [r0] -_0818683A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186678 - - thumb_func_start sub_818686C -sub_818686C: @ 818686C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r0, 0 - mov r9, r0 - mov r8, r0 - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r7, =gActiveBank - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r5, 0x88 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _081868AC - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081868AC: - ldr r1, [r4] - ldrb r0, [r7] - movs r6, 0x2 - adds r2, r6, 0 - eors r2, r0 - ldr r1, [r1, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _081868DE - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081868DE: - ldr r0, [r4] - ldrb r2, [r7] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r3 - ldrb r1, [r4] - movs r5, 0x8 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _081869AE - adds r1, r6, 0 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _081869AE - ldrb r1, [r4, 0x1] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08186994 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08186964 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08186964 - ldr r4, =gHealthBoxesIds - ldrb r0, [r7] - adds r1, r6, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r7] - eors r0, r6 - bl sub_8076918 - ldrb r0, [r7] - eors r0, r6 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08186964: - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_08186994: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x1] -_081869AE: - ldr r5, =gBattleSpritesDataPtr - ldr r0, [r5] - ldr r4, =gActiveBank - ldrb r2, [r4] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x80 - bne _08186A6A - movs r1, 0x2 - eors r1, r2 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x1] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08186A6A - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08186A6A - ldr r0, [r5] - ldrb r2, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08186A4C - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x42 - ands r0, r1 - cmp r0, 0x42 - bne _08186A40 - adds r0, r2, 0 - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08186A4C - ldr r0, =gMPlay_BGM - bl m4aMPlayContinue - b _08186A4C - .pool -_08186A40: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl -_08186A4C: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x20 - orrs r1, r2 - strb r1, [r0, 0x1] - movs r0, 0x1 - mov r9, r0 -_08186A6A: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _08186AC8 - ldr r2, =gSprites - ldr r0, =gUnknown_03005D7C - ldr r1, =gActiveBank - ldrb r4, [r1] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _08186B26 - ldr r0, =gBankSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r3 - bne _08186B26 - b _08186B22 - .pool -_08186AC8: - ldr r2, =gSprites - ldr r7, =gUnknown_03005D7C - ldr r0, =gActiveBank - ldrb r3, [r0] - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r4, [r0] - ldr r0, =SpriteCallbackDummy - cmp r4, r0 - bne _08186B26 - ldr r6, =gBankSpriteIds - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r5, [r0] - cmp r5, r4 - bne _08186B26 - movs r0, 0x2 - eors r3, r0 - adds r0, r3, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r4, [r0] - cmp r4, r5 - bne _08186B26 - adds r0, r3, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r0, r4 - bne _08186B26 -_08186B22: - movs r0, 0x1 - mov r8, r0 -_08186B26: - mov r0, r9 - cmp r0, 0 - beq _08186C10 - mov r0, r8 - cmp r0, 0 - beq _08186C10 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08186B8A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08186B8A - ldr r1, =gUnknown_03005D7C - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldrb r0, [r5] - eors r4, r0 - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback -_08186B8A: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldrb r5, [r4] - ldr r1, =gBattlePartyID - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r0, [r3] - ldrb r2, [r4] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186678 - str r1, [r0] -_08186C10: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818686C - - thumb_func_start sub_8186C48 -sub_8186C48: @ 8186C48 - push {r4-r7,lr} - ldr r4, =gSprites - ldr r0, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r3, [r7] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08186CFA - adds r0, r2, r4 - movs r1, 0x24 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08186CFA - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r4, r3, 1 - adds r0, r4, r3 - lsls r0, 2 - adds r2, r0, r1 - ldrb r5, [r2] - movs r0, 0x80 - ands r0, r5 - cmp r0, 0 - bne _08186CC0 - ldr r0, =gBattlePartyID - adds r0, r4, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r3, 0 - bl sub_8172EF0 - b _08186CFA - .pool -_08186CC0: - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08186CFA - movs r0, 0x7F - ands r0, r5 - strb r0, [r2] - ldr r0, [r6] - ldrb r2, [r7] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - bl RecordedOpponentBufferExecCompleted -_08186CFA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186C48 - - thumb_func_start sub_8186D04 -sub_8186D04: @ 8186D04 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - ldr r5, =gHealthBoxesIds - adds r1, r0, r5 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08186D4C - ldrb r0, [r6] - adds r0, r5 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08186D50 - .pool -_08186D4C: - bl RecordedOpponentBufferExecCompleted -_08186D50: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8186D04 - - thumb_func_start sub_8186D58 -sub_8186D58: @ 8186D58 - push {lr} - ldr r2, =gSprites - ldr r0, =gBankSpriteIds - ldr r1, =gActiveBank - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 31 - cmp r0, 0 - bne _08186D86 - ldr r0, =gHealthBoxesIds - adds r0, r3, r0 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedOpponentBufferExecCompleted -_08186D86: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186D58 - - thumb_func_start sub_8186D9C -sub_8186D9C: @ 8186D9C - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08186DF6 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedOpponentBufferExecCompleted -_08186DF6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186D9C - - thumb_func_start sub_8186E10 -sub_8186E10: @ 8186E10 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _08186E22 - bl RecordedOpponentBufferExecCompleted -_08186E22: - pop {r0} - bx r0 - thumb_func_end sub_8186E10 - - thumb_func_start bx_blink_t2 -bx_blink_t2: @ 8186E28 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _08186E74 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl RecordedOpponentBufferExecCompleted - b _08186E9E - .pool -_08186E74: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08186E98 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_08186E98: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08186E9E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t2 - - thumb_func_start sub_8186EA4 -sub_8186EA4: @ 8186EA4 - push {r4,lr} - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r3, [r4] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08186EF0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08186EE4 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_08186EE4: - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8186F14 - str r0, [r1] -_08186EF0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186EA4 - - thumb_func_start sub_8186F14 -sub_8186F14: @ 8186F14 - push {r4,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r4, =gActiveBank - ldrb r1, [r4] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08186F6E - bl IsCryPlayingOrClearCrySongs - lsls r0, 24 - cmp r0, 0 - bne _08186F6E - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08186F5E - ldr r0, =SpriteCallbackDummy_2 - cmp r1, r0 - bne _08186F6E -_08186F5E: - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - bl RecordedOpponentBufferExecCompleted -_08186F6E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186F14 - - thumb_func_start sub_8186F94 -sub_8186F94: @ 8186F94 - push {r4-r7,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r1, [r3, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08187050 - ldr r7, =gSprites - ldr r6, =gBankSpriteIds - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r7, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08187050 - ldrb r1, [r3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r3] - ldr r0, [r4] - ldrb r2, [r5] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0 - bl StartSpriteAnim - ldr r4, =gHealthBoxesIds - ldrb r1, [r5] - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r5] - bl sub_8076918 - ldrb r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldrb r0, [r5] - bl sub_805E408 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186EA4 - str r1, [r0] -_08187050: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8186F94 - - thumb_func_start sub_8187084 -sub_8187084: @ 8187084 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _081870B6 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081870B6: - ldr r4, =gSprites - ldr r0, =gUnknown_03005D7C - ldrb r2, [r5] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r3, r0, 2 - adds r0, r4, 0 - adds r0, 0x1C - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08187120 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _08187120 - adds r0, r3, r4 - bl DestroySprite - ldrb r4, [r5] - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186F94 - str r1, [r0] -_08187120: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8187084 - - thumb_func_start sub_818714C -sub_818714C: @ 818714C - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0818716E - bl RecordedOpponentBufferExecCompleted -_0818716E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818714C - - thumb_func_start sub_818717C -sub_818717C: @ 818717C - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0818719E - bl RecordedOpponentBufferExecCompleted -_0818719E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818717C - - thumb_func_start RecordedOpponentBufferExecCompleted -RecordedOpponentBufferExecCompleted: @ 81871AC - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedOpponentBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08187200 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _08187212 - .pool -_08187200: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_08187212: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RecordedOpponentBufferExecCompleted - - thumb_func_start sub_8187224 -sub_8187224: @ 8187224 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _0818725C - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_8187298 - adds r6, r0, 0 - b _0818727E - .pool -_0818725C: - ldrb r4, [r1] - movs r5, 0 -_08187260: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08187276 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_8187298 - adds r6, r0 -_08187276: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08187260 -_0818727E: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl RecordedOpponentBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8187224 - - thumb_func_start sub_8187298 -sub_8187298: @ 8187298 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _081872C2 - bl _08187A2E -_081872C2: - lsls r0, 2 - ldr r1, =_081872D8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081872D8: - .4byte _081873C8 - .4byte _081875EC - .4byte _081875FC - .4byte _0818760C - .4byte _08187674 - .4byte _08187674 - .4byte _08187674 - .4byte _08187674 - .4byte _08187690 - .4byte _081876CC - .4byte _081876CC - .4byte _081876CC - .4byte _081876CC - .4byte _08187A2E - .4byte _08187A2E - .4byte _08187A2E - .4byte _08187A2E - .4byte _081876E8 - .4byte _081876F8 - .4byte _08187728 - .4byte _08187738 - .4byte _08187748 - .4byte _08187758 - .4byte _08187768 - .4byte _08187778 - .4byte _08187788 - .4byte _08187798 - .4byte _081877A8 - .4byte _081877B8 - .4byte _081877C8 - .4byte _081877D8 - .4byte _081877E8 - .4byte _08187838 - .4byte _08187848 - .4byte _08187858 - .4byte _08187868 - .4byte _08187878 - .4byte _08187888 - .4byte _08187898 - .4byte _081878A8 - .4byte _081878B8 - .4byte _081878EC - .4byte _081878FC - .4byte _0818790C - .4byte _0818791C - .4byte _0818792C - .4byte _0818793C - .4byte _0818794C - .4byte _0818795C - .4byte _0818797C - .4byte _0818798C - .4byte _0818799C - .4byte _081879AC - .4byte _081879BC - .4byte _081879CC - .4byte _081879DC - .4byte _081879EC - .4byte _081879FC - .4byte _08187A0C - .4byte _08187A1C -_081873C8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08187414: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08187414 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_081875CC: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _081875CC - b _08187A2E - .pool -_081875EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - b _08187966 - .pool -_081875FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xC - b _08187966 - .pool -_0818760C: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - mov r8, r9 -_08187622: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _08187622 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_08187660: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _08187660 - b _08187A2E - .pool -_08187674: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _08187966 - .pool -_08187690: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gEnemyParty - mov r8, r2 -_0818769C: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _0818769C - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _08187A2E - .pool -_081876CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _08187A26 - .pool -_081876E8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1 - b _08187702 - .pool -_081876F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x19 -_08187702: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _08187A2E - .pool -_08187728: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1A - b _08187A26 - .pool -_08187738: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1B - b _08187A26 - .pool -_08187748: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1C - b _08187A26 - .pool -_08187758: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1D - b _08187A26 - .pool -_08187768: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1E - b _08187A26 - .pool -_08187778: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x1F - b _08187A26 - .pool -_08187788: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x20 - b _08187A26 - .pool -_08187798: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x22 - b _08187A26 - .pool -_081877A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x23 - b _08187A26 - .pool -_081877B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x24 - b _08187A26 - .pool -_081877C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x25 - b _08187A26 - .pool -_081877D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x26 - b _08187A26 - .pool -_081877E8: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _08187A2E - .pool -_08187838: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x27 - b _08187A26 - .pool -_08187848: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x28 - b _08187A26 - .pool -_08187858: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x29 - b _08187A26 - .pool -_08187868: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2A - b _08187A26 - .pool -_08187878: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2B - b _08187A26 - .pool -_08187888: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2C - b _08187A26 - .pool -_08187898: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0 - b _081878C2 - .pool -_081878A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x9 - b _08187966 - .pool -_081878B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x37 -_081878C2: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _08187A2E - .pool -_081878EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x38 - b _08187A26 - .pool -_081878FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x39 - b _08187966 - .pool -_0818790C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - b _08187966 - .pool -_0818791C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3B - b _08187966 - .pool -_0818792C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3C - b _08187966 - .pool -_0818793C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3D - b _08187966 - .pool -_0818794C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3E - b _08187966 - .pool -_0818795C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3F -_08187966: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _08187A2E - .pool -_0818797C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x16 - b _08187A26 - .pool -_0818798C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x17 - b _08187A26 - .pool -_0818799C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x18 - b _08187A26 - .pool -_081879AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x21 - b _08187A26 - .pool -_081879BC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2F - b _08187A26 - .pool -_081879CC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x30 - b _08187A26 - .pool -_081879DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x32 - b _08187A26 - .pool -_081879EC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x33 - b _08187A26 - .pool -_081879FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x34 - b _08187A26 - .pool -_08187A0C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x35 - b _08187A26 - .pool -_08187A1C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x36 -_08187A26: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_08187A2E: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8187298 - - thumb_func_start sub_8187A44 -sub_8187A44: @ 8187A44 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8187A44 - - thumb_func_start sub_8187A50 -sub_8187A50: @ 8187A50 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08187A80 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl dp01_setattr_for_opponent_pokemon - b _08187A9E - .pool -_08187A80: - ldrb r4, [r1] - movs r5, 0 -_08187A84: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08187A92 - adds r0, r5, 0 - bl dp01_setattr_for_opponent_pokemon -_08187A92: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08187A84 -_08187A9E: - bl RecordedOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8187A50 - - thumb_func_start dp01_setattr_for_opponent_pokemon -dp01_setattr_for_opponent_pokemon: @ 8187AA8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x38 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r4, r0, r2 - adds r7, r4, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r6, r3, 0 - adds r3, r2, 0 - cmp r0, 0x3B - bls _08187AD6 - bl _081883B4 -_08187AD6: - lsls r0, 2 - ldr r1, =_08187AEC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08187AEC: - .4byte _08187BDC - .4byte _08187D74 - .4byte _08187D90 - .4byte _08187DAC - .4byte _08187E00 - .4byte _08187E00 - .4byte _08187E00 - .4byte _08187E00 - .4byte _08187E20 - .4byte _08187E88 - .4byte _08187E88 - .4byte _08187E88 - .4byte _08187E88 - .4byte _081883B4 - .4byte _081883B4 - .4byte _081883B4 - .4byte _081883B4 - .4byte _08187EB0 - .4byte _08187ECC - .4byte _08187EE8 - .4byte _08187F04 - .4byte _08187F20 - .4byte _08187F3C - .4byte _08187F58 - .4byte _08187F74 - .4byte _08187F90 - .4byte _08187FAC - .4byte _08187FC8 - .4byte _08187FE4 - .4byte _08188000 - .4byte _0818801C - .4byte _08188038 - .4byte _081880AC - .4byte _081880C8 - .4byte _081880E4 - .4byte _08188100 - .4byte _0818811C - .4byte _08188138 - .4byte _08188154 - .4byte _08188170 - .4byte _0818818C - .4byte _081881A8 - .4byte _081881C4 - .4byte _081881E0 - .4byte _081881FC - .4byte _08188218 - .4byte _08188234 - .4byte _08188250 - .4byte _0818826C - .4byte _08188288 - .4byte _081882A4 - .4byte _081882C0 - .4byte _081882DC - .4byte _081882F8 - .4byte _08188314 - .4byte _08188330 - .4byte _0818834C - .4byte _08188368 - .4byte _08188384 - .4byte _081883A0 -_08187BDC: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r7, 0 - bl SetMonData - adds r2, r7, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r7 - mov r10, r0 - adds r0, r7, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r7, 0x2 - str r0, [sp, 0x4] - adds r0, r7, 0x4 - str r0, [sp, 0x8] - adds r0, r7, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r6, r7, 0 - adds r6, 0x24 - adds r4, r7, 0 - adds r4, 0xC -_08187C42: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08187C42 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r7, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r7, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r7, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r7, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _081883B4 - .pool -_08187D74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xB - bl SetMonData - b _081883B4 - .pool -_08187D90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0xC - bl SetMonData - b _081883B4 - .pool -_08187DAC: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r4 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r7, r1, r0 - adds r6, r4, 0 - adds r6, 0x8 -_08187DC4: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _08187DC4 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _081883B4 - .pool -_08187E00: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _08187E9E - .pool -_08187E20: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x11 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _081883B4 - .pool -_08187E88: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldrb r2, [r6] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_08187E9E: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _081883B4 - .pool -_08187EB0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1 - bl SetMonData - b _081883B4 - .pool -_08187ECC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x19 - bl SetMonData - b _081883B4 - .pool -_08187EE8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1A - bl SetMonData - b _081883B4 - .pool -_08187F04: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1B - bl SetMonData - b _081883B4 - .pool -_08187F20: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1C - bl SetMonData - b _081883B4 - .pool -_08187F3C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1D - bl SetMonData - b _081883B4 - .pool -_08187F58: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1E - bl SetMonData - b _081883B4 - .pool -_08187F74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x1F - bl SetMonData - b _081883B4 - .pool -_08187F90: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x20 - bl SetMonData - b _081883B4 - .pool -_08187FAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x22 - bl SetMonData - b _081883B4 - .pool -_08187FC8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x23 - bl SetMonData - b _081883B4 - .pool -_08187FE4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x24 - bl SetMonData - b _081883B4 - .pool -_08188000: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x25 - bl SetMonData - b _081883B4 - .pool -_0818801C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x26 - bl SetMonData - b _081883B4 - .pool -_08188038: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - adds r0, r4, 0 - movs r1, 0x27 - str r3, [sp, 0x34] - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r6] - lsls r2, 9 - ldr r3, [sp, 0x34] - adds r0, r3, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08188146 - .pool -_081880AC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x27 - bl SetMonData - b _081883B4 - .pool -_081880C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x28 - bl SetMonData - b _081883B4 - .pool -_081880E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x29 - bl SetMonData - b _081883B4 - .pool -_08188100: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2A - bl SetMonData - b _081883B4 - .pool -_0818811C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2B - bl SetMonData - b _081883B4 - .pool -_08188138: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 -_08188146: - movs r1, 0x2C - bl SetMonData - b _081883B4 - .pool -_08188154: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0 - bl SetMonData - b _081883B4 - .pool -_08188170: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x9 - bl SetMonData - b _081883B4 - .pool -_0818818C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x37 - bl SetMonData - b _081883B4 - .pool -_081881A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x38 - bl SetMonData - b _081883B4 - .pool -_081881C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x39 - bl SetMonData - b _081883B4 - .pool -_081881E0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3A - bl SetMonData - b _081883B4 - .pool -_081881FC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3B - bl SetMonData - b _081883B4 - .pool -_08188218: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3C - bl SetMonData - b _081883B4 - .pool -_08188234: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3D - bl SetMonData - b _081883B4 - .pool -_08188250: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3E - bl SetMonData - b _081883B4 - .pool -_0818826C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x3F - bl SetMonData - b _081883B4 - .pool -_08188288: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x16 - bl SetMonData - b _081883B4 - .pool -_081882A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x17 - bl SetMonData - b _081883B4 - .pool -_081882C0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x18 - bl SetMonData - b _081883B4 - .pool -_081882DC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x21 - bl SetMonData - b _081883B4 - .pool -_081882F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x2F - bl SetMonData - b _081883B4 - .pool -_08188314: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x30 - bl SetMonData - b _081883B4 - .pool -_08188330: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x32 - bl SetMonData - b _081883B4 - .pool -_0818834C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x33 - bl SetMonData - b _081883B4 - .pool -_08188368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x34 - bl SetMonData - b _081883B4 - .pool -_08188384: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x35 - bl SetMonData - b _081883B4 - .pool -_081883A0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - ldrb r2, [r6] - lsls r2, 9 - adds r2, r3 - movs r1, 0x36 - bl SetMonData -_081883B4: - add sp, 0x38 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01_setattr_for_opponent_pokemon - - thumb_func_start sub_81883C8 -sub_81883C8: @ 81883C8 - push {r4-r7,lr} - ldr r1, =gBattlePartyID - ldr r7, =gActiveBank - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - adds r3, r1, 0 - muls r3, r0 - ldr r4, =gBattleBufferA - lsls r2, 9 - adds r0, r4, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - ldr r1, =gEnemyParty - adds r0, r1 - adds r5, r3, r0 - movs r3, 0 - adds r0, r4, 0x2 - adds r2, r0 - ldrb r2, [r2] - cmp r3, r2 - bcs _08188420 - adds r6, r4, 0 - adds r2, r7, 0 - adds r4, r0, 0 -_081883FE: - adds r1, r5, r3 - ldrb r0, [r2] - lsls r0, 9 - adds r0, 0x3 - adds r0, r3, r0 - adds r0, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r0, [r2] - lsls r0, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r3, r0 - bcc _081883FE -_08188420: - bl RecordedOpponentBufferExecCompleted - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81883C8 - - thumb_func_start sub_818843C -sub_818843C: @ 818843C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r7, =gBattlePartyID - ldr r6, =gActiveBank - ldrb r0, [r6] - lsls r0, 1 - adds r0, r7 - ldrh r0, [r0] - movs r1, 0x64 - mov r10, r1 - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - ldr r1, =gEnemyParty - mov r9, r1 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r1, [r6] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - add r0, r9 - bl BattleLoadOpponentMonSpriteGfx - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldrb r0, [r6] - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r6] - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r5, =gSprites - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r2, [r6] - adds r0, r2, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x2E] - ldrb r3, [r6] - adds r0, r3, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r2, [r6] - adds r4, r2, r4 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r2, r1 - ldrb r1, [r2] - bl StartSpriteAnim - ldrb r4, [r6] - lsls r0, r4, 1 - adds r0, r7 - ldrh r0, [r0] - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - add r0, r9 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl SetBankEnemyShadowSpriteCallback - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186C48 - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818843C - - thumb_func_start sub_818858C -sub_818858C: @ 818858C - push {r4,lr} - ldr r1, =gBattlePartyID - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r2, r0, 1 - adds r2, r1 - ldr r3, =gBattleBufferA - lsls r0, 9 - adds r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2] - ldrb r0, [r4] - lsls r1, r0, 9 - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - bl sub_81885D8 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8187084 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818858C - - thumb_func_start sub_81885D8 -sub_81885D8: @ 81885D8 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_805EF84 - ldr r0, =gBattlePartyID - lsls r4, r6, 1 - adds r4, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4] - ldrh r0, [r4] - movs r1, 0x64 - mov r9, r1 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r10, r1 - add r10, r6 - mov r1, r10 - strb r0, [r1] - ldrh r0, [r4] - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - adds r0, r5 - adds r1, r6, 0 - bl BattleLoadOpponentMonSpriteGfx - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r9, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r9 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFE - bl sub_80753E8 - mov r1, r10 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81885D8 - - thumb_func_start sub_8188768 -sub_8188768: @ 8188768 - push {r4-r6,lr} - ldr r1, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r3, [r0] - cmp r3, 0 - bne _081887B0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8188800 - str r1, [r0] - b _081887EC - .pool -_081887B0: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrb r0, [r6] - bl sub_805EEE0 - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl RecordedOpponentBufferExecCompleted -_081887EC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188768 - - thumb_func_start sub_8188800 -sub_8188800: @ 8188800 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r4, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r0, [r3, 0x4] - cmp r0, 0 - beq _08188828 - cmp r0, 0x1 - beq _08188856 - b _0818887E - .pool -_08188828: - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08188842 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08188842: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0818887E -_08188856: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _0818887E - strb r0, [r3, 0x4] - ldrb r2, [r5] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x2 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186D9C - str r1, [r0] -_0818887E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188800 - - thumb_func_start sub_818888C -sub_818888C: @ 818888C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r5, =gBattleTypeFlags - ldr r0, [r5] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081888F6 - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankIdentity - movs r1, 0x2 - ands r1, r0 - movs r7, 0xC8 - cmp r1, 0 - beq _081888B4 - movs r7, 0x98 -_081888B4: - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 1 - ands r0, r1 - cmp r0, 0 - beq _081888EC - ldrb r0, [r4] - cmp r0, 0x1 - bne _081888D8 - ldr r0, =gTrainerBattleOpponent_A - b _081888DA - .pool -_081888D8: - ldr r0, =gTrainerBattleOpponent_B -_081888DA: - ldrh r0, [r0] - bl sub_8162AA0 - lsls r0, 24 - lsrs r0, 24 - b _0818892C - .pool -_081888EC: - bl sub_8185F40 - lsls r0, 24 - lsrs r0, 24 - b _08188924 -_081888F6: - movs r7, 0xB0 - ldr r0, =gTrainerBattleOpponent_A - ldrh r1, [r0] - movs r0, 0xC0 - lsls r0, 4 - cmp r1, r0 - bne _08188910 - bl sub_8068B48 - b _08188928 - .pool -_08188910: - ldr r2, =gLinkPlayers - ldr r0, =gUnknown_0203C7B4 - ldrb r0, [r0] - movs r1, 0x1 - eors r1, r0 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x13] -_08188924: - bl sub_806F000 -_08188928: - lsls r0, 16 - lsrs r0, 16 -_0818892C: - mov r8, r0 - ldr r5, =gActiveBank - ldrb r1, [r5] - bl sub_805DF38 - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r9, r7 - ldr r1, =gTrainerFrontPicCoords - mov r2, r8 - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0] - movs r4, 0x8 - subs r4, r0 - lsls r4, 18 - movs r0, 0xA0 - lsls r0, 14 - adds r4, r0 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ff10 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =gTrainerFrontPicPaletteTable - mov r2, r8 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - ldrb r1, [r5] - adds r1, r6 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r4 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - mov r1, r8 - strh r1, [r0, 0x6] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186558 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818888C - - thumb_func_start sub_8188A40 -sub_8188A40: @ 8188A40 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188A40 - - thumb_func_start sub_8188A4C -sub_8188A4C: @ 8188A4C - push {r4-r6,lr} - ldr r6, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =SpriteCallbackDummy - bl StoreSpriteCallbackInData6 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81865C8 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188A4C - - thumb_func_start sub_8188AF8 -sub_8188AF8: @ 8188AF8 - push {r4-r6,lr} - ldr r6, =gBattleSpritesDataPtr - ldr r4, [r6] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r0, [r4, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3, 0x4] - cmp r0, 0 - bne _08188B4C - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08188B2C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08188B2C: - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x4] - adds r1, 0x1 - strb r1, [r0, 0x4] - b _08188B88 - .pool -_08188B4C: - ldrb r1, [r3] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08188B88 - strb r0, [r3, 0x4] - movs r0, 0x10 - movs r1, 0x3F - bl PlaySE12WithPanning - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldrb r0, [r5] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039934 - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186D58 - str r1, [r0] -_08188B88: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188AF8 - - thumb_func_start sub_8188BA4 -sub_8188BA4: @ 8188BA4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188BA4 - - thumb_func_start sub_8188BB0 -sub_8188BB0: @ 8188BB0 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188BB0 - - thumb_func_start sub_8188BBC -sub_8188BBC: @ 8188BBC - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188BBC - - thumb_func_start sub_8188BC8 -sub_8188BC8: @ 8188BC8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188BC8 - - thumb_func_start sub_8188BD4 -sub_8188BD4: @ 8188BD4 - push {r4-r6,lr} - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - beq _08188BE6 - b _08188CFA -_08188BE6: - ldr r0, =gBattleBufferA - mov r12, r0 - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gUnknown_020244BC - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _08188CDC - bl RecordedOpponentBufferExecCompleted - b _08188CFA - .pool -_08188CDC: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8188D0C - str r1, [r0] -_08188CFA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188BD4 - - thumb_func_start sub_8188D0C -sub_8188D0C: @ 8188D0C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r10, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, r2, 0x2 - mov r9, r5 - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 8 - orrs r4, r0 - adds r2, 0xB - adds r1, r2 - ldrb r1, [r1] - mov r8, r1 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _08188DA4 - cmp r2, 0x1 - bgt _08188D64 - cmp r2, 0 - beq _08188D6E - b _08188E80 - .pool -_08188D64: - cmp r2, 0x2 - beq _08188DCE - cmp r2, 0x3 - beq _08188E44 - b _08188E80 -_08188D6E: - ldr r1, [r5] - lsls r0, r3, 2 - adds r1, r0, r1 - ldrb r2, [r1] - movs r0, 0xC - ands r0, r2 - cmp r0, 0x4 - bne _08188D90 - movs r0, 0x8 - orrs r0, r2 - strb r0, [r1] - ldrb r2, [r6] - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_08188D90: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _08188E80 -_08188DA4: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08188E80 - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _08188E80 -_08188DCE: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _08188E80 - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08188E1C - mov r0, r8 - cmp r0, 0x1 - bhi _08188E1C - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_08188E1C: - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _08188E80 - .pool -_08188E44: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08188E80 - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r10 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r9 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl RecordedOpponentBufferExecCompleted -_08188E80: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8188D0C - - thumb_func_start sub_8188E90 -sub_8188E90: @ 8188E90 - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186E10 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188E90 - - thumb_func_start sub_8188EE4 -sub_8188EE4: @ 8188EE4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188EE4 - - thumb_func_start sub_8188EF0 -sub_8188EF0: @ 8188EF0 - push {lr} - 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 EmitCmd33 - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188EF0 - - thumb_func_start sub_8188F14 -sub_8188F14: @ 8188F14 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188F14 - - thumb_func_start sub_8188F20 -sub_8188F20: @ 8188F20 - push {r4,r5,lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _08188F48 - bl sub_805D19C - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - b _08188F6C - .pool -_08188F48: - 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 EmitCmd33 -_08188F6C: - bl RecordedOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188F20 - - thumb_func_start sub_8188F7C -sub_8188F7C: @ 8188F7C - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188F7C - - thumb_func_start sub_8188F88 -sub_8188F88: @ 8188F88 - 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 EmitCmd34 - bl RecordedOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188F88 - - thumb_func_start sub_8188FC4 -sub_8188FC4: @ 8188FC4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8188FC4 - - thumb_func_start sub_8188FD0 -sub_8188FD0: @ 8188FD0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _08189060 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gEnemyParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0818908A - .pool -_08189060: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct -_0818908A: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8186D04 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8188FD0 - - thumb_func_start sub_81890C0 -sub_81890C0: @ 81890C0 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81890C0 - - thumb_func_start sub_81890CC -sub_81890CC: @ 81890CC - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08189120 - ldr r0, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gEnemyParty - adds r1, r2 - movs r2, 0x9 - bl UpdateHealthboxAttribute - ldrb r2, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818714C - str r1, [r0] -_08189120: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81890CC - - thumb_func_start sub_8189144 -sub_8189144: @ 8189144 - push {r4,r5,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _08189194 - ldr r4, =gBattleBufferA - ldrb r3, [r5] - lsls r3, 9 - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - adds r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - adds r2, r4, 0x4 - adds r2, r3, r2 - ldrb r2, [r2] - lsls r2, 16 - orrs r1, r2 - adds r4, 0x5 - adds r3, r4 - ldrb r2, [r3] - lsls r2, 24 - orrs r1, r2 - bl move_anim_start_t2_for_situation - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818714C - str r1, [r0] -_08189194: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189144 - - thumb_func_start sub_81891AC -sub_81891AC: @ 81891AC - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81891AC - - thumb_func_start sub_81891B8 -sub_81891B8: @ 81891B8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81891B8 - - thumb_func_start sub_81891C4 -sub_81891C4: @ 81891C4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81891C4 - - thumb_func_start sub_81891D0 -sub_81891D0: @ 81891D0 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81891D0 - - thumb_func_start sub_81891DC -sub_81891DC: @ 81891DC - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81891DC - - thumb_func_start sub_81891E8 -sub_81891E8: @ 81891E8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81891E8 - - thumb_func_start sub_81891F4 -sub_81891F4: @ 81891F4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81891F4 - - thumb_func_start sub_8189200 -sub_8189200: @ 8189200 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8189200 - - thumb_func_start sub_818920C -sub_818920C: @ 818920C - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818920C - - thumb_func_start sub_8189218 -sub_8189218: @ 8189218 - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x80 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189218 - - thumb_func_start sub_8189234 -sub_8189234: @ 8189234 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x7F - ands r1, r0 - ldrb r2, [r3] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189234 - - thumb_func_start sub_818926C -sub_818926C: @ 818926C - push {lr} - ldr r2, =gUnknown_02022D0C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_818926C - - thumb_func_start sub_8189284 -sub_8189284: @ 8189284 - push {lr} - ldr r3, =gUnknown_02022D0C - ldr r1, [r3] - lsls r1, 24 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - lsls r1, 7 - ldrb r2, [r3] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189284 - - thumb_func_start sub_81892AC -sub_81892AC: @ 81892AC - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _081892E0 - bl RecordedOpponentBufferExecCompleted - b _0818930A - .pool -_081892E0: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t2 - str r1, [r0] -_0818930A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81892AC - - thumb_func_start sub_818931C -sub_818931C: @ 818931C - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818931C - - thumb_func_start sub_8189328 -sub_8189328: @ 8189328 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _0818933C - movs r3, 0xC0 -_0818933C: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl RecordedOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189328 - - thumb_func_start sub_818936C -sub_818936C: @ 818936C - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _081893A8 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _081893BC - .pool -_081893A8: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_081893BC: - bl RecordedOpponentBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_818936C - - thumb_func_start sub_81893C8 -sub_81893C8: @ 81893C8 - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - movs r2, 0x5 - bl PlayCry3 - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81893C8 - - thumb_func_start sub_8189404 -sub_8189404: @ 8189404 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189404 - - thumb_func_start sub_8189438 -sub_8189438: @ 8189438 - push {r4-r6,lr} - ldr r5, =gBankSpriteIds - ldr r6, =gActiveBank - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x8C - lsls r1, 1 - strh r1, [r0, 0x32] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_818962C - bl StoreSpriteCallbackInData6 - ldr r0, =c3_0803D564 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r6] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081894FA - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_081894FA: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_70 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189438 - - thumb_func_start c3_0803D564 -c3_0803D564: @ 8189548 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r7, =gActiveBank - ldrb r0, [r7] - mov r9, r0 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x8] - strb r0, [r7] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _08189582 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081895B4 -_08189582: - ldr r0, =gBattleBufferA - ldrb r1, [r7] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r7] - movs r1, 0 - bl sub_81885D8 - b _081895F4 - .pool -_081895B4: - ldr r4, =gBattleBufferA - ldrb r0, [r7] - lsls r1, r0, 9 - adds r4, 0x1 - adds r1, r4 - ldr r6, =gBattlePartyID - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_81885D8 - ldrb r0, [r7] - movs r5, 0x2 - eors r0, r5 - strb r0, [r7] - ldrb r0, [r7] - lsls r1, r0, 9 - adds r1, r4 - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - strb r0, [r1] - ldrb r0, [r7] - movs r1, 0 - bl sub_81885D8 - ldrb r0, [r7] - eors r0, r5 - strb r0, [r7] -_081895F4: - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_818686C - str r1, [r0] - mov r0, r9 - strb r0, [r2] - mov r0, r8 - bl DestroyTask - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c3_0803D564 - - thumb_func_start sub_818962C -sub_818962C: @ 818962C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x6] - bl sub_805DFE4 - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_818962C - - thumb_func_start sub_8189648 -sub_8189648: @ 8189648 - push {r4-r7,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08189678 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08189678 - bl RecordedOpponentBufferExecCompleted - b _08189742 - .pool -_08189678: - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldr r1, =gBattleBufferA - ldrb r2, [r3] - lsls r0, r2, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r3, 0 - cmp r0, 0 - beq _081896E4 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrb r2, [r3, 0x1] - lsls r1, r2, 27 - lsrs r0, r1, 28 - cmp r0, 0x1 - bhi _081896DC - adds r0, 0x1 - movs r1, 0xF - ands r0, r1 - lsls r0, 1 - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x1] - b _08189742 - .pool -_081896DC: - movs r0, 0x1F - negs r0, r0 - ands r0, r2 - strb r0, [r3, 0x1] -_081896E4: - adds r5, r7, 0 - ldrb r0, [r5] - lsls r3, r0, 9 - ldr r4, =gBattleBufferA + 4 - adds r1, r3, r4 - subs r2, r4, 0x3 - adds r2, r3, r2 - ldrb r2, [r2] - subs r4, 0x2 - adds r3, r4 - ldrb r3, [r3] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - movs r3, 0 - strb r0, [r1] - ldr r6, =gBattleSpritesDataPtr - ldr r0, [r6] - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x5] - ldrb r2, [r5] - lsls r0, r2, 9 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08189736 - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r1, 0x5D - strb r1, [r0, 0x5] -_08189736: - ldr r0, =gBattleBankFunc - ldrb r1, [r7] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818975C - str r0, [r1] -_08189742: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189648 - - thumb_func_start sub_818975C -sub_818975C: @ 818975C - push {r4,lr} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r3, =gActiveBank - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - adds r2, r1, 0x1 - strb r2, [r0, 0x5] - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x5C - bls _08189794 - ldr r0, [r4] - ldrb r1, [r3] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x5] - bl RecordedOpponentBufferExecCompleted -_08189794: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818975C - - thumb_func_start sub_81897A4 -sub_81897A4: @ 81897A4 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r1, [r0] - ldr r0, =gActiveBank - ldrb r3, [r0] - ldr r1, [r1, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081897D6 - ldr r2, =gTasks - ldr r0, =gUnknown_020244B4 - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldr r1, =sub_8073C30 - str r1, [r0] -_081897D6: - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_81897A4 - - thumb_func_start sub_81897F4 -sub_81897F4: @ 81897F4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81897F4 - - thumb_func_start sub_8189800 -sub_8189800: @ 8189800 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl AnimBankSpriteExists - lsls r0, 24 - cmp r0, 0 - beq _08189846 - ldr r3, =gSprites - ldr r0, =gBankSpriteIds - ldrb r1, [r4] - adds r0, r1, r0 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - ldr r0, =gBattleBufferA - lsls r1, 9 - adds r0, 0x1 - adds r1, r0 - adds r2, 0x3E - movs r0, 0x1 - ldrb r1, [r1] - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4] - bl sub_805E408 -_08189846: - bl RecordedOpponentBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189800 - - thumb_func_start sub_8189860 -sub_8189860: @ 8189860 - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gActiveBank - ldrb r0, [r6] - bl mplay_80342A4 - lsls r0, 24 - cmp r0, 0 - bne _081898B8 - ldr r5, =gBattleBufferA - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _081898AC - bl RecordedOpponentBufferExecCompleted - b _081898B8 - .pool -_081898AC: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_818717C - str r0, [r1] -_081898B8: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8189860 - - thumb_func_start sub_81898C8 -sub_81898C8: @ 81898C8 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81898C8 - - thumb_func_start sub_81898D4 -sub_81898D4: @ 81898D4 - push {lr} - bl RecordedOpponentBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81898D4 - - thumb_func_start sub_81898E0 -sub_81898E0: @ 81898E0 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r2, [r0] - cmp r2, 0x3 - bne _08189908 - ldr r0, =gBattleOutcome - strb r2, [r0] - b _08189910 - .pool -_08189908: - ldr r0, =gBattleOutcome - movs r1, 0x3 - eors r1, r2 - strb r1, [r0] -_08189910: - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl RecordedOpponentBufferExecCompleted - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_80587B0 - str r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81898E0 - - thumb_func_start nullsub_119 -nullsub_119: @ 8189944 - bx lr - thumb_func_end nullsub_119 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s deleted file mode 100644 index 6f3976205..000000000 --- a/asm/battle_controller_recorded_player.s +++ /dev/null @@ -1,6144 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_120 -nullsub_120: @ 8189948 - bx lr - thumb_func_end nullsub_120 - - thumb_func_start SetBankFuncToRecordedPlayerBufferRunCommand -SetBankFuncToRecordedPlayerBufferRunCommand: @ 818994C - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =RecordedPlayerBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToRecordedPlayerBufferRunCommand - - thumb_func_start RecordedPlayerBufferRunCommand -RecordedPlayerBufferRunCommand: @ 8189968 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _081899B4 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _081899B0 - ldr r0, =gRecordedPlayerBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _081899B4 - .pool -_081899B0: - bl RecordedPlayerBufferExecCompleted -_081899B4: - pop {r0} - bx r0 - thumb_func_end RecordedPlayerBufferRunCommand - - thumb_func_start sub_81899B8 -sub_81899B8: @ 81899B8 - push {lr} - 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 sub_805E408 - 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 move_anim_start_t4 -_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 sub_818A5EC -sub_818A5EC: @ 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 sub_818A5EC - - 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 sub_818AE0C -sub_818AE0C: @ 818AE0C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818AE0C - - thumb_func_start sub_818AE18 -sub_818AE18: @ 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 sub_818AE18 - - 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 sub_818B86C -sub_818B86C: @ 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 sub_818B86C - - thumb_func_start sub_818B8E0 -sub_818B8E0: @ 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 sub_818B8E0 - - thumb_func_start sub_818B9FC -sub_818B9FC: @ 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 sub_805EF84 - ldr r2, =gBattlePartyID - ldrb r0, [r5] - lsls r1, r0, 1 - adds r1, r2 - lsls r0, 9 - adds r4, 0x1 - adds r0, r4 - ldrb r0, [r0] - 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 sub_818B9FC - - 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 sub_805EF84 - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818BA6C - - thumb_func_start sub_818BBE8 -sub_818BBE8: @ 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 sub_818BBE8 - - 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 move_anim_start_t4 -_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 move_anim_start_t4 - 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 sub_818BD04 -sub_818BD04: @ 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 sub_806F000 - lsls r0, 16 - lsrs r4, r0, 16 - adds r5, r4, 0 - ldr r6, =gActiveBank - ldrb r1, [r6] - adds r0, r5, 0 - bl sub_805DF38 - ldrb r0, [r6] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_806A1C0 - ldr r0, =gUnknown_0202499C - mov r8, r0 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r6] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - mov r1, r9 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - ldrb r1, [r6] - adds r1, r4 - strb r0, [r1] - ldr r0, =gTrainerFrontPicPaletteTable - lsls r5, 3 - adds r5, r0 - ldrh r0, [r5, 0x4] - bl IndexOfSpritePaletteTag - ldr r5, =gSprites - ldrb r1, [r6] - adds r1, r4 - ldrb r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - lsls r0, 4 - ldrb r3, [r2, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0x5] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x30 - strh r1, [r0, 0x26] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_805D7AC - str r1, [r0] - ldrb r0, [r6] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - b _0818BF72 - .pool -_0818BEDC: - ldr r5, =gActiveBank - ldrb r1, [r5] - adds r0, r4, 0 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_806A12C - ldr r6, =gUnknown_0202499C - mov r8, r9 - lsls r4, r7, 16 - asrs r4, 16 - ldrb r0, [r5] - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0 - mov r1, r8 - adds r2, r4, 0 - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] -_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 sub_818BD04 - - thumb_func_start sub_818BFAC -sub_818BFAC: @ 818BFAC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818BFAC - - thumb_func_start sub_818BFB8 -sub_818BFB8: @ 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 sub_818BFB8 - - thumb_func_start sub_818C064 -sub_818C064: @ 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 move_anim_start_t4 -_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 sub_818C064 - - thumb_func_start sub_818C150 -sub_818C150: @ 818C150 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C150 - - thumb_func_start sub_818C15C -sub_818C15C: @ 818C15C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C15C - - thumb_func_start sub_818C168 -sub_818C168: @ 818C168 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C168 - - thumb_func_start sub_818C174 -sub_818C174: @ 818C174 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C174 - - thumb_func_start sub_818C180 -sub_818C180: @ 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, =gUnknown_020244BC - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl sub_805DB8C - 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 sub_818C180 - - 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 move_anim_start_t4 -_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 move_anim_start_t4 - ldr r0, [r7] - ldrb r1, [r6] - ldr r0, [r0] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x9 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_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 sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl 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 sub_818C43C -sub_818C43C: @ 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 sub_814F9EC - 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 sub_818C43C - - thumb_func_start sub_818C490 -sub_818C490: @ 818C490 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C490 - - 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 EmitCmd33 - bl RecordedPlayerBufferExecCompleted -_0818C4C6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818C49C - - thumb_func_start sub_818C4D8 -sub_818C4D8: @ 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 EmitCmd33 - bl RecordedPlayerBufferExecCompleted -_0818C522: - pop {r0} - bx r0 - .pool - thumb_func_end sub_818C4D8 - - thumb_func_start sub_818C52C -sub_818C52C: @ 818C52C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C52C - - thumb_func_start sub_818C538 -sub_818C538: @ 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 sub_805D19C - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - 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 EmitCmd33 -_0818C584: - bl RecordedPlayerBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818C538 - - thumb_func_start sub_818C594 -sub_818C594: @ 818C594 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C594 - - thumb_func_start sub_818C5A0 -sub_818C5A0: @ 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 EmitCmd34 - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818C5A0 - - thumb_func_start sub_818C5DC -sub_818C5DC: @ 818C5DC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C5DC - - thumb_func_start sub_818C5E8 -sub_818C5E8: @ 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 sub_818C5E8 - - thumb_func_start sub_818C6E8 -sub_818C6E8: @ 818C6E8 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C6E8 - - thumb_func_start sub_818C6F4 -sub_818C6F4: @ 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 sub_818C6F4 - - thumb_func_start sub_818C76C -sub_818C76C: @ 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 move_anim_start_t2_for_situation - 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 sub_818C76C - - thumb_func_start sub_818C7D4 -sub_818C7D4: @ 818C7D4 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C7D4 - - thumb_func_start sub_818C7E0 -sub_818C7E0: @ 818C7E0 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C7E0 - - thumb_func_start sub_818C7EC -sub_818C7EC: @ 818C7EC - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C7EC - - thumb_func_start sub_818C7F8 -sub_818C7F8: @ 818C7F8 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C7F8 - - thumb_func_start sub_818C804 -sub_818C804: @ 818C804 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C804 - - thumb_func_start sub_818C810 -sub_818C810: @ 818C810 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C810 - - thumb_func_start sub_818C81C -sub_818C81C: @ 818C81C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C81C - - thumb_func_start sub_818C828 -sub_818C828: @ 818C828 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C828 - - thumb_func_start sub_818C834 -sub_818C834: @ 818C834 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C834 - - thumb_func_start sub_818C840 -sub_818C840: @ 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 sub_818C840 - - thumb_func_start sub_818C85C -sub_818C85C: @ 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 sub_818C85C - - thumb_func_start sub_818C894 -sub_818C894: @ 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 sub_818C894 - - thumb_func_start sub_818C8AC -sub_818C8AC: @ 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 sub_818C8AC - - thumb_func_start sub_818C8D4 -sub_818C8D4: @ 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 sub_80769F4 - 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 sub_818C8D4 - - thumb_func_start sub_818C944 -sub_818C944: @ 818C944 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818C944 - - thumb_func_start sub_818C950 -sub_818C950: @ 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 sub_818C950 - - thumb_func_start sub_818C994 -sub_818C994: @ 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 sub_818C994 - - thumb_func_start sub_818C9F0 -sub_818C9F0: @ 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 sub_818C9F0 - - thumb_func_start dp01t_2E_2_battle_intro -dp01t_2E_2_battle_intro: @ 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 battle_intro_launch - 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 dp01t_2E_2_battle_intro - - thumb_func_start sub_818CA64 -sub_818CA64: @ 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 sub_818CA64 - - 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 sub_818CD30 -sub_818CD30: @ 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 sub_818CD30 - - 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 sub_818CE3C -sub_818CE3C: @ 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 sub_818CE3C - - thumb_func_start sub_818CE8C -sub_818CE8C: @ 818CE8C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818CE8C - - thumb_func_start sub_818CE98 -sub_818CE98: @ 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 sub_805E408 -_0818CEDE: - bl RecordedPlayerBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818CE98 - - thumb_func_start sub_818CEF8 -sub_818CEF8: @ 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 move_anim_start_t3 - 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 sub_818CEF8 - - thumb_func_start sub_818CF60 -sub_818CF60: @ 818CF60 - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818CF60 - - thumb_func_start sub_818CF6C -sub_818CF6C: @ 818CF6C - push {lr} - bl RecordedPlayerBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_818CF6C - - thumb_func_start sub_818CF78 -sub_818CF78: @ 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 sub_818CF78 - - 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/battle_controller_safari.s b/asm/battle_controller_safari.s deleted file mode 100644 index d7efd69fe..000000000 --- a/asm/battle_controller_safari.s +++ /dev/null @@ -1,1412 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_114 -nullsub_114: @ 8159368 - bx lr - thumb_func_end nullsub_114 - - thumb_func_start SetBankFuncToSafariBufferRunCommand -SetBankFuncToSafariBufferRunCommand: @ 815936C - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =SafariBufferRunCommand - str r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToSafariBufferRunCommand - - thumb_func_start SafariBufferRunCommand -SafariBufferRunCommand: @ 8159388 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _081593D4 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _081593D0 - ldr r0, =gSafariBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _081593D4 - .pool -_081593D0: - bl SafariBufferExecCompleted -_081593D4: - pop {r0} - bx r0 - thumb_func_end SafariBufferRunCommand - - thumb_func_start bx_battle_menu_t6_2 -bx_battle_menu_t6_2: @ 81593D8 - push {r4,r5,lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08159446 - movs r0, 0x5 - bl PlaySE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08159424 - cmp r0, 0x1 - bgt _08159414 - cmp r0, 0 - beq _0815941E - b _08159440 - .pool -_08159414: - cmp r0, 0x2 - beq _0815942A - cmp r0, 0x3 - beq _08159436 - b _08159440 -_0815941E: - movs r0, 0x1 - movs r1, 0x5 - b _0815942E -_08159424: - movs r0, 0x1 - movs r1, 0x6 - b _0815942E -_0815942A: - movs r0, 0x1 - movs r1, 0x7 -_0815942E: - movs r2, 0 - bl EmitCmd33 - b _08159440 -_08159436: - movs r0, 0x1 - movs r1, 0x8 - movs r2, 0 - bl EmitCmd33 -_08159440: - bl SafariBufferExecCompleted - b _0815954E -_08159446: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08159484 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _081594F2 - .pool -_08159484: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081594C0 - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - b _081594F2 - .pool -_081594C0: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0815950C - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 -_081594F2: - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - b _0815954E - .pool -_0815950C: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0815954E - ldr r5, =gActionSelectionCursor - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0815954E - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ActionSelectionDestroyCursorAt - ldrb r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x2 - eors r0, r2 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt -_0815954E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end bx_battle_menu_t6_2 - - thumb_func_start sub_815955C -sub_815955C: @ 815955C - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08159580 - bl SafariBufferExecCompleted -_08159580: - pop {r0} - bx r0 - .pool - thumb_func_end sub_815955C - - thumb_func_start bx_t6_button_a -bx_t6_button_a: @ 8159594 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081595A6 - bl SafariBufferExecCompleted -_081595A6: - pop {r0} - bx r0 - thumb_func_end bx_t6_button_a - - thumb_func_start sub_81595AC -sub_81595AC: @ 81595AC - push {lr} - ldr r2, =gSprites - ldr r1, =gHealthBoxesIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _081595D0 - bl SafariBufferExecCompleted -_081595D0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81595AC - - thumb_func_start sub_81595E4 -sub_81595E4: @ 81595E4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0815960E - ldr r2, =gMain - ldr r0, =0x00000439 - adds r3, r2, r0 - ldrb r1, [r3] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldr r0, =gPreBattleCallback1 - ldr r0, [r0] - str r0, [r2] - ldr r0, [r2, 0x8] - bl SetMainCallback2 -_0815960E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81595E4 - - thumb_func_start bx_wait_t6 -bx_wait_t6: @ 8159624 - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - beq _0815964A - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0815964E -_0815964A: - bl SafariBufferExecCompleted -_0815964E: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t6 - - thumb_func_start sub_8159660 -sub_8159660: @ 8159660 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08159684 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159698 - str r1, [r0] - bl FreeAllWindowBuffers - bl sub_81358F4 -_08159684: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159660 - - thumb_func_start sub_8159698 -sub_8159698: @ 8159698 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _081596BE - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081596BE - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitCmd35 - bl SafariBufferExecCompleted -_081596BE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159698 - - thumb_func_start sub_81596D4 -sub_81596D4: @ 81596D4 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081596F6 - bl SafariBufferExecCompleted -_081596F6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81596D4 - - thumb_func_start SafariBufferExecCompleted -SafariBufferExecCompleted: @ 8159704 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =SafariBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08159758 - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _0815976A - .pool -_08159758: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_0815976A: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SafariBufferExecCompleted - - thumb_func_start bx_80364D0 -bx_80364D0: @ 815977C - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0815979E - bl SafariBufferExecCompleted -_0815979E: - pop {r0} - bx r0 - .pool - thumb_func_end bx_80364D0 - - thumb_func_start sub_81597AC -sub_81597AC: @ 81597AC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597AC - - thumb_func_start sub_81597B8 -sub_81597B8: @ 81597B8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597B8 - - thumb_func_start sub_81597C4 -sub_81597C4: @ 81597C4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597C4 - - thumb_func_start sub_81597D0 -sub_81597D0: @ 81597D0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597D0 - - thumb_func_start sub_81597DC -sub_81597DC: @ 81597DC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597DC - - thumb_func_start sub_81597E8 -sub_81597E8: @ 81597E8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597E8 - - thumb_func_start sub_81597F4 -sub_81597F4: @ 81597F4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81597F4 - - thumb_func_start sub_8159800 -sub_8159800: @ 8159800 - push {r4-r6,lr} - ldr r4, =gSaveBlock2Ptr - ldr r0, [r4] - ldrb r0, [r0, 0x8] - ldr r5, =gActiveBank - ldrb r1, [r5] - bl LoadBackTrainerBankSpriteGfx - ldr r0, [r4] - ldrb r6, [r0, 0x8] - ldrb r0, [r5] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r2, =gTrainerBackPicCoords - ldr r1, [r4] - ldrb r1, [r1, 0x8] - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r5] - adds r1, r6 - strb r0, [r1] - ldr r4, =gSprites - ldrb r3, [r5] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r5] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, 0x1C - adds r0, r4 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_815955C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159800 - - thumb_func_start sub_81598E0 -sub_81598E0: @ 81598E0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598E0 - - thumb_func_start sub_81598EC -sub_81598EC: @ 81598EC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598EC - - thumb_func_start sub_81598F8 -sub_81598F8: @ 81598F8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81598F8 - - thumb_func_start sub_8159904 -sub_8159904: @ 8159904 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159904 - - thumb_func_start sub_8159910 -sub_8159910: @ 8159910 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t6 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159910 - - thumb_func_start sub_8159964 -sub_8159964: @ 8159964 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t6 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159964 - - thumb_func_start sub_81599C4 -sub_81599C4: @ 81599C4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81599C4 - - thumb_func_start sub_81599D0 -sub_81599D0: @ 81599D0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_81599D0 - - thumb_func_start dp01t_10_6_message -dp01t_10_6_message: @ 81599DC - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_t6_button_a - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_10_6_message - - thumb_func_start dp01t_11_6_message_for_player_only -dp01t_11_6_message_for_player_only: @ 8159A30 - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08159A4C - bl dp01t_10_6_message - b _08159A50 - .pool -_08159A4C: - bl SafariBufferExecCompleted -_08159A50: - pop {r0} - bx r0 - thumb_func_end dp01t_11_6_message_for_player_only - - thumb_func_start sub_8159A54 -sub_8159A54: @ 8159A54 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _08159A7A - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_battle_menu_t6_2 - str r1, [r0] -_08159A7A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159A54 - - thumb_func_start sub_8159A94 -sub_8159A94: @ 8159A94 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159A54 - str r1, [r0] - ldr r0, =gText_SafariZoneMenu - movs r1, 0x2 - bl sub_814F9EC - movs r4, 0 -_08159AAE: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _08159AAE - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillPkmnDo2 - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl sub_814F9EC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159A94 - - thumb_func_start sub_8159AFC -sub_8159AFC: @ 8159AFC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159AFC - - thumb_func_start sub_8159B08 -sub_8159B08: @ 8159B08 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B08 - - thumb_func_start sub_8159B14 -sub_8159B14: @ 8159B14 - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8159660 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159B14 - - thumb_func_start sub_8159B54 -sub_8159B54: @ 8159B54 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B54 - - thumb_func_start sub_8159B60 -sub_8159B60: @ 8159B60 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B60 - - thumb_func_start sub_8159B6C -sub_8159B6C: @ 8159B6C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B6C - - thumb_func_start sub_8159B78 -sub_8159B78: @ 8159B78 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159B78 - - thumb_func_start sub_8159B84 -sub_8159B84: @ 8159B84 - push {lr} - ldr r0, =gHealthBoxesIds - ldr r1, =gActiveBank - ldrb r1, [r1] - adds r0, r1, r0 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0xB - bl UpdateHealthboxAttribute - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159B84 - - thumb_func_start sub_8159BC0 -sub_8159BC0: @ 8159BC0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BC0 - - thumb_func_start sub_8159BCC -sub_8159BCC: @ 8159BCC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BCC - - thumb_func_start sub_8159BD8 -sub_8159BD8: @ 8159BD8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BD8 - - thumb_func_start sub_8159BE4 -sub_8159BE4: @ 8159BE4 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BE4 - - thumb_func_start sub_8159BF0 -sub_8159BF0: @ 8159BF0 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BF0 - - thumb_func_start sub_8159BFC -sub_8159BFC: @ 8159BFC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159BFC - - thumb_func_start sub_8159C08 -sub_8159C08: @ 8159C08 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C08 - - thumb_func_start sub_8159C14 -sub_8159C14: @ 8159C14 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C14 - - thumb_func_start sub_8159C20 -sub_8159C20: @ 8159C20 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C20 - - thumb_func_start sub_8159C2C -sub_8159C2C: @ 8159C2C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C2C - - thumb_func_start sub_8159C38 -sub_8159C38: @ 8159C38 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C38 - - thumb_func_start sub_8159C44 -sub_8159C44: @ 8159C44 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C44 - - thumb_func_start sub_8159C50 -sub_8159C50: @ 8159C50 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C50 - - thumb_func_start sub_8159C5C -sub_8159C5C: @ 8159C5C - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C5C - - thumb_func_start sub_8159C68 -sub_8159C68: @ 8159C68 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C68 - - thumb_func_start sub_8159C74 -sub_8159C74: @ 8159C74 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159C74 - - thumb_func_start sub_8159C80 -sub_8159C80: @ 8159C80 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - movs r3, 0x3F - cmp r0, 0 - bne _08159C94 - movs r3, 0xC0 -_08159C94: - ldr r2, =gBattleBufferA - ldrb r1, [r4] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - lsls r1, r3, 24 - asrs r1, 24 - bl PlaySE12WithPanning - bl SafariBufferExecCompleted - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159C80 - - thumb_func_start dp01t_34_6_move_anim_start_t3 -dp01t_34_6_move_anim_start_t3: @ 8159CC4 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _08159D00 - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _08159D14 - .pool -_08159D00: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_08159D14: - bl SafariBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end dp01t_34_6_move_anim_start_t3 - - thumb_func_start sub_8159D20 -sub_8159D20: @ 8159D20 - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - bl PlayCry1 - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159D20 - - thumb_func_start dp01t_2E_6_battle_intro -dp01t_2E_6_battle_intro: @ 8159D5C - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl SafariBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_6_battle_intro - - thumb_func_start sub_8159D90 -sub_8159D90: @ 8159D90 - push {r4,r5,lr} - ldr r5, =gHealthBoxesIds - ldr r4, =gActiveBank - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0xA - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81595AC - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159D90 - - thumb_func_start sub_8159DEC -sub_8159DEC: @ 8159DEC - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159DEC - - thumb_func_start sub_8159DF8 -sub_8159DF8: @ 8159DF8 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159DF8 - - thumb_func_start sub_8159E04 -sub_8159E04: @ 8159E04 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E04 - - thumb_func_start sub_8159E10 -sub_8159E10: @ 8159E10 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E10 - - thumb_func_start sub_8159E1C -sub_8159E1C: @ 8159E1C - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _08159E5C - bl SafariBufferExecCompleted - b _08159E68 - .pool -_08159E5C: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81596D4 - str r0, [r1] -_08159E68: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159E1C - - thumb_func_start sub_8159E78 -sub_8159E78: @ 8159E78 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E78 - - thumb_func_start sub_8159E84 -sub_8159E84: @ 8159E84 - push {lr} - bl SafariBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8159E84 - - thumb_func_start sub_8159E90 -sub_8159E90: @ 8159E90 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl SafariBufferExecCompleted - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _08159ECC - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_81595E4 - str r0, [r1] -_08159ECC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8159E90 - - thumb_func_start nullsub_115 -nullsub_115: @ 8159EEC - bx lr - thumb_func_end nullsub_115 - - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s deleted file mode 100644 index e1d92de0d..000000000 --- a/asm/battle_controller_wally.s +++ /dev/null @@ -1,4787 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_117 -nullsub_117: @ 81683B4 - bx lr - thumb_func_end nullsub_117 - - thumb_func_start SetBankFuncToWallyBufferRunCommand -SetBankFuncToWallyBufferRunCommand: @ 81683B8 - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =WallyBufferRunCommand - str r1, [r0] - ldr r2, =gBattleStruct - ldr r0, [r2] - adds r0, 0x94 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x95 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x96 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x97 - strb r1, [r0] - bx lr - .pool - thumb_func_end SetBankFuncToWallyBufferRunCommand - - thumb_func_start WallyBufferRunCommand -WallyBufferRunCommand: @ 81683F4 - push {lr} - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldr r0, =gActiveBank - ldrb r3, [r0] - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r2] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08168440 - ldr r0, =gBattleBufferA - lsls r1, r3, 9 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x38 - bhi _0816843C - ldr r0, =gWallyBufferCommands - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - b _08168440 - .pool -_0816843C: - bl WallyBufferExecCompleted -_08168440: - pop {r0} - bx r0 - thumb_func_end WallyBufferRunCommand - - thumb_func_start sub_8168444 -sub_8168444: @ 8168444 - push {r4,r5,lr} - ldr r1, =gBattleStruct - ldr r0, [r1] - adds r0, 0x94 - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x5 - bls _08168456 - b _08168564 -_08168456: - lsls r0, 2 - ldr r1, =_08168468 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08168468: - .4byte _08168480 - .4byte _08168492 - .4byte _081684B0 - .4byte _081684CE - .4byte _08168508 - .4byte _08168540 -_08168480: - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08168492: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0 - b _081684E4 -_081684B0: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0 - b _081684E4 -_081684CE: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08168564 - movs r0, 0x1 - movs r1, 0x9 -_081684E4: - movs r2, 0 - bl EmitCmd33 - bl WallyBufferExecCompleted - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x95 - strb r5, [r0] - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - b _08168564 -_08168508: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl ActionSelectionDestroyCursorAt - movs r0, 0x1 - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, [r4] - adds r0, 0x96 - movs r1, 0x40 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x94 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08168564 -_08168540: - ldr r1, [r4] - adds r1, 0x96 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08168564 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl EmitCmd33 - bl WallyBufferExecCompleted -_08168564: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8168444 - - thumb_func_start sub_816856C -sub_816856C: @ 816856C - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08168590 - bl WallyBufferExecCompleted -_08168590: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816856C - - thumb_func_start sub_81685A4 -sub_81685A4: @ 81685A4 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _081685B6 - bl WallyBufferExecCompleted -_081685B6: - pop {r0} - bx r0 - thumb_func_end sub_81685A4 - - thumb_func_start bx_wait_t5 -bx_wait_t5: @ 81685BC - push {lr} - ldr r0, =gDoingBattleAnim - ldrb r0, [r0] - cmp r0, 0 - bne _081685CA - bl WallyBufferExecCompleted -_081685CA: - pop {r0} - bx r0 - .pool - thumb_func_end bx_wait_t5 - - thumb_func_start sub_81685D4 -sub_81685D4: @ 81685D4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081685FC - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168610 - str r1, [r0] - bl nullsub_35 - bl FreeAllWindowBuffers - bl DoWallyTutorialBagMenu -_081685FC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81685D4 - - thumb_func_start sub_8168610 -sub_8168610: @ 8168610 - push {lr} - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =BattleMainCB2 - cmp r1, r0 - bne _08168636 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08168636 - ldr r0, =gScriptItemId - ldrh r1, [r0] - movs r0, 0x1 - bl EmitCmd35 - bl WallyBufferExecCompleted -_08168636: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168610 - - thumb_func_start sub_816864C -sub_816864C: @ 816864C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r4, =gBattleSpritesDataPtr - ldr r0, [r4] - ldr r5, =gActiveBank - ldrb r2, [r5] - ldr r1, [r0, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r7, 0x88 - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - bne _08168684 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_08168684: - ldr r1, [r4] - ldrb r0, [r5] - movs r6, 0x2 - adds r2, r6, 0 - eors r2, r0 - ldr r1, [r1, 0x4] - lsls r3, r2, 1 - adds r0, r3, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - bne _081686B6 - ldr r0, =gBattlePartyID - adds r0, r3, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - adds r0, r2, 0 - bl sub_8172EF0 -_081686B6: - ldr r0, [r4] - ldrb r2, [r5] - ldr r3, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - movs r4, 0x8 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _081686D2 - b _081687DC -_081686D2: - adds r1, r2, 0 - eors r1, r6 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _081687DC - ldr r0, =gSprites - mov r8, r0 - ldr r7, =gUnknown_03005D7C - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r4, r8 - adds r4, 0x1C - adds r0, r4 - ldr r3, [r0] - ldr r0, =SpriteCallbackDummy - cmp r3, r0 - bne _081687DC - ldr r0, =gBankSpriteIds - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r0, r3 - bne _081687DC - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0816877A - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0816877A - ldrb r0, [r5] - eors r0, r6 - adds r0, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - bl DestroySprite - ldr r4, =gHealthBoxesIds - ldrb r0, [r5] - adds r1, r6, 0 - eors r1, r0 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r5] - eors r0, r6 - bl sub_8076918 - ldrb r0, [r5] - eors r0, r6 - adds r0, r4 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible -_0816877A: - ldr r1, =gUnknown_03005D7C - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - ldr r5, =gHealthBoxesIds - ldrb r1, [r4] - adds r0, r1, r5 - ldrb r0, [r0] - ldr r2, =gBattlePartyID - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0x64 - muls r1, r2 - ldr r2, =gPlayerParty - adds r1, r2 - movs r2, 0 - bl UpdateHealthboxAttribute - ldrb r0, [r4] - bl sub_8076918 - ldrb r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x8] - ldrb r1, [r2, 0x9] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168818 - str r1, [r0] -_081687DC: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816864C - - thumb_func_start sub_8168818 -sub_8168818: @ 8168818 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r4, 0 - ldr r2, =gSprites - ldr r0, =gHealthBoxesIds - ldr r1, =gActiveBank - mov r8, r1 - ldrb r3, [r1] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08168842 - movs r4, 0x1 -_08168842: - cmp r4, 0 - beq _08168904 - ldr r7, =gBattleSpritesDataPtr - ldr r0, [r7] - ldr r4, [r0, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r2, r0, r4 - ldrb r1, [r2, 0x1] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08168904 - movs r6, 0x2 - adds r1, r6, 0 - eors r1, r3 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x1] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _08168904 - ldrb r1, [r2] - movs r3, 0x7F - adds r0, r3, 0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r7] - mov r1, r8 - ldrb r2, [r1] - ldr r0, [r0, 0x4] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x1] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x1] - ldr r2, [r7] - mov r1, r8 - ldrb r0, [r1] - adds r1, r6, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - ands r3, r1 - strb r3, [r0] - ldr r2, [r7] - mov r1, r8 - ldrb r0, [r1] - adds r1, r6, 0 - eors r1, r0 - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - ands r4, r1 - strb r4, [r0, 0x1] - ldr r4, =0x000027f9 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldr r0, =c3_0802FDF4 - movs r1, 0xA - bl CreateTask - ldr r2, =gBattlePartyID - mov r0, r8 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl WallyBufferExecCompleted -_08168904: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168818 - - thumb_func_start sub_8168934 -sub_8168934: @ 8168934 - push {r4-r6,lr} - ldr r5, =gActiveBank - ldrb r0, [r5] - ldr r6, =gHealthBoxesIds - adds r1, r0, r6 - ldrb r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_8074AA0 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - lsls r4, 16 - asrs r1, r4, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0816897C - ldrb r0, [r5] - adds r0, r6 - ldrb r0, [r0] - movs r2, 0 - bl UpdateHpTextInHealthbox - b _08168996 - .pool -_0816897C: - ldr r2, =gBattlePartyID - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - bl WallyBufferExecCompleted -_08168996: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168934 - - thumb_func_start bx_blink_t5 -bx_blink_t5: @ 81689A4 - push {r4,lr} - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bne _081689F0 - movs r3, 0 - movs r0, 0 - strh r0, [r4, 0x30] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 - ands r0, r1 - strb r0, [r2] - ldr r0, =gDoingBattleAnim - strb r3, [r0] - bl WallyBufferExecCompleted - b _08168A1A - .pool -_081689F0: - ldrh r0, [r4, 0x30] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08168A14 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_08168A14: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08168A1A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end bx_blink_t5 - - thumb_func_start sub_8168A20 -sub_8168A20: @ 8168A20 - push {r4-r6,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r6, =gActiveBank - ldrb r2, [r6] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08168A74 - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl WallyBufferExecCompleted -_08168A74: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168A20 - - thumb_func_start sub_8168A90 -sub_8168A90: @ 8168A90 - push {lr} - ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - bne _08168AB4 - bl WallyBufferExecCompleted -_08168AB4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168A90 - - thumb_func_start sub_8168AC8 -sub_8168AC8: @ 8168AC8 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08168AEA - bl WallyBufferExecCompleted -_08168AEA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168AC8 - - thumb_func_start WallyBufferExecCompleted -WallyBufferExecCompleted: @ 8168AF8 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gBattleBankFunc - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =WallyBufferRunCommand - str r1, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08168B4C - bl GetMultiplayerId - mov r1, sp - strb r0, [r1] - movs r0, 0x2 - movs r1, 0x4 - mov r2, sp - bl PrepareBufferDataTransferLink - ldr r1, =gBattleBufferA - ldrb r0, [r4] - lsls r0, 9 - adds r0, r1 - movs r1, 0x38 - strb r1, [r0] - b _08168B5E - .pool -_08168B4C: - ldr r2, =gBattleExecBuffer - ldr r1, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r0, [r2] - bics r0, r1 - str r0, [r2] -_08168B5E: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end WallyBufferExecCompleted - - thumb_func_start sub_8168B70 -sub_8168B70: @ 8168B70 - push {lr} - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r0, =gActiveBank - ldrb r1, [r0] - ldr r2, [r2, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _08168B92 - bl WallyBufferExecCompleted -_08168B92: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8168B70 - - thumb_func_start dp01t_00_5_getattr -dp01t_00_5_getattr: @ 8168BA0 - push {r4-r6,lr} - sub sp, 0x100 - movs r6, 0 - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _08168BD8 - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - mov r1, sp - bl sub_8168C14 - adds r6, r0, 0 - b _08168BFA - .pool -_08168BD8: - ldrb r4, [r1] - movs r5, 0 -_08168BDC: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08168BF2 - lsls r0, r5, 24 - lsrs r0, 24 - mov r2, sp - adds r1, r2, r6 - bl sub_8168C14 - adds r6, r0 -_08168BF2: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08168BDC -_08168BFA: - lsls r1, r6, 16 - lsrs r1, 16 - movs r0, 0x1 - mov r2, sp - bl EmitDataTransfer - bl WallyBufferExecCompleted - add sp, 0x100 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end dp01t_00_5_getattr - - thumb_func_start sub_8168C14 -sub_8168C14: @ 8168C14 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x90 - adds r7, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleBufferA - ldr r3, =gActiveBank - ldrb r0, [r3] - lsls r0, 9 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3B - bls _08168C3E - bl _081693AA -_08168C3E: - lsls r0, 2 - ldr r1, =_08168C54 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08168C54: - .4byte _08168D44 - .4byte _08168F68 - .4byte _08168F78 - .4byte _08168F88 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _08168FF0 - .4byte _0816900C - .4byte _08169048 - .4byte _08169048 - .4byte _08169048 - .4byte _08169048 - .4byte _081693AA - .4byte _081693AA - .4byte _081693AA - .4byte _081693AA - .4byte _08169064 - .4byte _08169074 - .4byte _081690A4 - .4byte _081690B4 - .4byte _081690C4 - .4byte _081690D4 - .4byte _081690E4 - .4byte _081690F4 - .4byte _08169104 - .4byte _08169114 - .4byte _08169124 - .4byte _08169134 - .4byte _08169144 - .4byte _08169154 - .4byte _08169164 - .4byte _081691B4 - .4byte _081691C4 - .4byte _081691D4 - .4byte _081691E4 - .4byte _081691F4 - .4byte _08169204 - .4byte _08169214 - .4byte _08169224 - .4byte _08169234 - .4byte _08169268 - .4byte _08169278 - .4byte _08169288 - .4byte _08169298 - .4byte _081692A8 - .4byte _081692B8 - .4byte _081692C8 - .4byte _081692D8 - .4byte _081692F8 - .4byte _08169308 - .4byte _08169318 - .4byte _08169328 - .4byte _08169338 - .4byte _08169348 - .4byte _08169358 - .4byte _08169368 - .4byte _08169378 - .4byte _08169388 - .4byte _08169398 -_08168D44: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2E] - movs r6, 0 - add r0, sp, 0x24 - mov r9, r0 - movs r1, 0x3B - add r1, sp - mov r10, r1 - mov r2, sp - adds r2, 0x2B - str r2, [sp, 0x80] - mov r0, sp - adds r0, 0x2A - str r0, [sp, 0x7C] - mov r1, sp - adds r1, 0x68 - str r1, [sp, 0x8C] - adds r2, 0x5 - str r2, [sp, 0x84] - adds r0, 0x12 - str r0, [sp, 0x88] - mov r8, r4 - add r4, sp, 0xC -_08168D90: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r8 - bl GetMonData - strh r0, [r4] - adds r1, r6, 0 - adds r1, 0x11 - mov r0, r8 - bl GetMonData - mov r2, r9 - adds r1, r2, r6 - strb r0, [r1] - adds r4, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _08168D90 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r10 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - ldr r2, [sp, 0x80] - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x19 - bl GetMonData - str r0, [sp, 0x44] - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - mov r3, sp - movs r5, 0x1F - ands r0, r5 - ldrb r2, [r3, 0x14] - movs r1, 0x20 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - mov r3, sp - movs r6, 0x1F - ands r0, r6 - lsls r0, 5 - ldrh r2, [r3, 0x14] - ldr r1, =0xfffffc1f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x14] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 2 - ldrb r2, [r3, 0x15] - movs r1, 0x7D - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x15] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - movs r1, 0x1F - ands r1, r0 - lsls r1, 15 - ldr r0, [sp, 0x14] - ldr r2, =0xfff07fff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - mov r3, sp - ands r0, r6 - lsls r0, 4 - ldrh r2, [r3, 0x16] - ldr r1, =0xfffffe0f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x16] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - mov r3, sp - ands r0, r5 - lsls r0, 1 - ldrb r2, [r3, 0x17] - movs r1, 0x3F - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x48] - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - str r0, [sp, 0x4C] - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [sp, 0x7C] - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - mov r1, sp - strh r0, [r1, 0x28] - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2C] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - mov r1, sp - strh r0, [r1, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - mov r1, sp - strh r0, [r1, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - mov r1, sp - strh r0, [r1, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - mov r1, sp - strh r0, [r1, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - mov r1, sp - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, sp - movs r1, 0x1 - ands r0, r1 - lsls r0, 6 - ldrb r2, [r3, 0x17] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x2E - bl GetMonData - mov r3, sp - lsls r0, 7 - ldrb r2, [r3, 0x17] - movs r1, 0x7F - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x17] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x54] - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, [sp, 0x8C] - bl GetMonData - ldr r0, [sp, 0x84] - ldr r1, [sp, 0x8C] - bl StringCopy10 - adds r0, r4, 0 - movs r1, 0x7 - ldr r2, [sp, 0x88] - bl GetMonData - mov r2, sp - movs r6, 0 -_08168F48: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0x57 - bls _08168F48 - b _081693AA - .pool -_08168F68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - b _081692E2 - .pool -_08168F78: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - b _081692E2 - .pool -_08168F88: - movs r6, 0 - add r2, sp, 0x58 - mov r9, r2 - add r0, sp, 0x60 - mov r10, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - mov r8, r9 -_08168F9E: - adds r1, r6, 0 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - mov r1, r8 - strh r0, [r1] - adds r1, r6, 0 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - mov r2, r10 - adds r1, r2, r6 - strb r0, [r1] - movs r0, 0x2 - add r8, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _08168F9E - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1, 0xC] - mov r2, r9 - movs r6, 0 -_08168FDC: - adds r0, r7, r6 - adds r1, r2, r6 - ldrb r1, [r1] - strb r1, [r0] - adds r6, 0x1 - cmp r6, 0xF - bls _08168FDC - b _081693AA - .pool -_08168FF0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x9 - b _081692E2 - .pool -_0816900C: - movs r6, 0 - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r2, =gPlayerParty - mov r8, r2 -_08169018: - adds r1, r6, 0 - adds r1, 0x11 - mov r2, r8 - adds r0, r4, r2 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - cmp r6, 0x3 - ble _08169018 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - bl GetMonData - adds r1, r7, r6 - strb r0, [r1] - adds r6, 0x1 - b _081693AA - .pool -_08169048: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldrb r1, [r3] - lsls r1, 9 - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - adds r1, 0x8 - b _081693A2 - .pool -_08169064: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - b _0816907E - .pool -_08169074: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x19 -_0816907E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - movs r6, 0x3 - b _081693AA - .pool -_081690A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1A - b _081693A2 - .pool -_081690B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1B - b _081693A2 - .pool -_081690C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1C - b _081693A2 - .pool -_081690D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1D - b _081693A2 - .pool -_081690E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1E - b _081693A2 - .pool -_081690F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1F - b _081693A2 - .pool -_08169104: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x20 - b _081693A2 - .pool -_08169114: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x22 - b _081693A2 - .pool -_08169124: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x23 - b _081693A2 - .pool -_08169134: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x24 - b _081693A2 - .pool -_08169144: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x25 - b _081693A2 - .pool -_08169154: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x26 - b _081693A2 - .pool -_08169164: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x27 - bl GetMonData - strb r0, [r7] - adds r0, r4, 0 - movs r1, 0x28 - bl GetMonData - strb r0, [r7, 0x1] - adds r0, r4, 0 - movs r1, 0x29 - bl GetMonData - strb r0, [r7, 0x2] - adds r0, r4, 0 - movs r1, 0x2A - bl GetMonData - strb r0, [r7, 0x3] - adds r0, r4, 0 - movs r1, 0x2B - bl GetMonData - strb r0, [r7, 0x4] - adds r0, r4, 0 - movs r1, 0x2C - bl GetMonData - strb r0, [r7, 0x5] - movs r6, 0x6 - b _081693AA - .pool -_081691B4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x27 - b _081693A2 - .pool -_081691C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x28 - b _081693A2 - .pool -_081691D4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x29 - b _081693A2 - .pool -_081691E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2A - b _081693A2 - .pool -_081691F4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2B - b _081693A2 - .pool -_08169204: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2C - b _081693A2 - .pool -_08169214: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - b _0816923E - .pool -_08169224: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x9 - b _081692E2 - .pool -_08169234: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x37 -_0816923E: - bl GetMonData - adds r1, r0, 0 - strb r1, [r7] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r0, 16 - strb r0, [r7, 0x2] - lsrs r0, r1, 24 - strb r0, [r7, 0x3] - movs r6, 0x4 - b _081693AA - .pool -_08169268: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - b _081693A2 - .pool -_08169278: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - b _081692E2 - .pool -_08169288: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - b _081692E2 - .pool -_08169298: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3B - b _081692E2 - .pool -_081692A8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3C - b _081692E2 - .pool -_081692B8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3D - b _081692E2 - .pool -_081692C8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3E - b _081692E2 - .pool -_081692D8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3F -_081692E2: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - strb r0, [r7] - lsrs r0, 8 - strb r0, [r7, 0x1] - movs r6, 0x2 - b _081693AA - .pool -_081692F8: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - b _081693A2 - .pool -_08169308: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - b _081693A2 - .pool -_08169318: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - b _081693A2 - .pool -_08169328: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - b _081693A2 - .pool -_08169338: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - b _081693A2 - .pool -_08169348: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x30 - b _081693A2 - .pool -_08169358: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x32 - b _081693A2 - .pool -_08169368: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x33 - b _081693A2 - .pool -_08169378: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x34 - b _081693A2 - .pool -_08169388: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x35 - b _081693A2 - .pool -_08169398: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x36 -_081693A2: - bl GetMonData - strb r0, [r7] - movs r6, 0x1 -_081693AA: - adds r0, r6, 0 - add sp, 0x90 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8168C14 - - thumb_func_start sub_81693C0 -sub_81693C0: @ 81693C0 - push {lr} - bl sub_805A614 - pop {r0} - bx r0 - thumb_func_end sub_81693C0 - - thumb_func_start sub_81693CC -sub_81693CC: @ 81693CC - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0 - bne _081693FC - ldr r0, =gBattlePartyID - lsls r1, r2, 1 - adds r1, r0 - ldrb r0, [r1] - bl sub_8169424 - b _0816941A - .pool -_081693FC: - ldrb r4, [r1] - movs r5, 0 -_08169400: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0816940E - adds r0, r5, 0 - bl sub_8169424 -_0816940E: - lsrs r4, 1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08169400 -_0816941A: - bl WallyBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81693CC - - thumb_func_start sub_8169424 -sub_8169424: @ 8169424 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - ldr r2, =gBattleBufferA + 3 - adds r3, r0, r2 - adds r6, r3, 0 - subs r1, r2, 0x2 - adds r0, r1 - ldrb r0, [r0] - adds r7, r2, 0 - cmp r0, 0x3B - bls _08169450 - bl _08169DEA -_08169450: - lsls r0, 2 - ldr r1, =_08169468 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08169468: - .4byte _08169558 - .4byte _081696F0 - .4byte _08169710 - .4byte _08169730 - .4byte _08169788 - .4byte _08169788 - .4byte _08169788 - .4byte _08169788 - .4byte _081697B0 - .4byte _08169814 - .4byte _08169814 - .4byte _08169814 - .4byte _08169814 - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169DEA - .4byte _08169844 - .4byte _08169864 - .4byte _08169884 - .4byte _081698A4 - .4byte _081698C4 - .4byte _081698E4 - .4byte _08169904 - .4byte _08169924 - .4byte _08169944 - .4byte _08169964 - .4byte _08169984 - .4byte _081699A4 - .4byte _081699C4 - .4byte _081699E4 - .4byte _08169A04 - .4byte _08169A74 - .4byte _08169A94 - .4byte _08169AB4 - .4byte _08169AD4 - .4byte _08169AF4 - .4byte _08169B14 - .4byte _08169B34 - .4byte _08169B54 - .4byte _08169B74 - .4byte _08169B94 - .4byte _08169BB4 - .4byte _08169BD4 - .4byte _08169BF4 - .4byte _08169C14 - .4byte _08169C34 - .4byte _08169C54 - .4byte _08169C74 - .4byte _08169C94 - .4byte _08169CB4 - .4byte _08169CD4 - .4byte _08169CF4 - .4byte _08169D14 - .4byte _08169D34 - .4byte _08169D54 - .4byte _08169D74 - .4byte _08169D94 - .4byte _08169DB4 - .4byte _08169DD4 -_08169558: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB - adds r2, r6, 0 - bl SetMonData - adds r2, r6, 0 - adds r2, 0x2E - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - movs r0, 0 - mov r8, r0 - movs r0, 0x3B - adds r0, r6 - mov r10, r0 - adds r0, r6, 0 - adds r0, 0x2B - str r0, [sp, 0x20] - adds r0, 0x19 - str r0, [sp, 0x28] - adds r0, 0x4 - str r0, [sp, 0x2C] - adds r0, 0x4 - str r0, [sp, 0x30] - subs r0, 0x22 - str r0, [sp, 0x1C] - subs r0, 0x2 - str r0, [sp, 0x18] - adds r0, 0x4 - str r0, [sp, 0x24] - adds r0, r6, 0x2 - str r0, [sp, 0x4] - adds r0, r6, 0x4 - str r0, [sp, 0x8] - adds r0, r6, 0x6 - str r0, [sp, 0xC] - adds r0, 0x2 - str r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x14] - mov r9, r4 - adds r7, r6, 0 - adds r7, 0x24 - adds r4, r6, 0 - adds r4, 0xC -_081695BE: - mov r1, r8 - adds r1, 0xD - mov r0, r9 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - mov r0, r9 - adds r2, r7, 0 - bl SetMonData - adds r7, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _081695BE - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x15 - mov r2, r10 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x20 - ldr r2, [sp, 0x20] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x19 - ldr r2, [sp, 0x28] - bl SetMonData - ldrb r0, [r6, 0x14] - lsls r0, 27 - lsrs r0, 27 - mov r1, sp - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x27 - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x14] - lsls r0, 22 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x28 - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x15] - lsls r0, 25 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x29 - mov r2, sp - bl SetMonData - mov r1, sp - ldr r0, [r6, 0x14] - lsls r0, 12 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2A - mov r2, sp - bl SetMonData - mov r1, sp - ldrh r0, [r6, 0x16] - lsls r0, 23 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2B - mov r2, sp - bl SetMonData - mov r1, sp - ldrb r0, [r6, 0x17] - lsls r0, 26 - lsrs r0, 27 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2C - mov r2, sp - bl SetMonData - adds r0, r4, 0 - movs r1, 0 - ldr r2, [sp, 0x2C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x37 - ldr r2, [sp, 0x30] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x39 - ldr r2, [sp, 0x18] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3A - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3B - ldr r2, [sp, 0x4] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3C - ldr r2, [sp, 0x8] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3D - ldr r2, [sp, 0xC] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3E - ldr r2, [sp, 0x10] - bl SetMonData - adds r0, r4, 0 - movs r1, 0x3F - ldr r2, [sp, 0x14] - bl SetMonData - b _08169DEA - .pool -_081696F0: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xB - bl SetMonData - b _08169DEA - .pool -_08169710: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0xC - bl SetMonData - b _08169DEA - .pool -_08169730: - movs r0, 0 - mov r8, r0 - movs r0, 0xC - adds r0, r3 - mov r9, r0 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r6, r3, 0 - adds r6, 0x8 - adds r4, r3, 0 -_0816974A: - mov r1, r8 - adds r1, 0xD - adds r0, r7, 0 - adds r2, r4, 0 - bl SetMonData - mov r1, r8 - adds r1, 0x11 - adds r0, r7, 0 - adds r2, r6, 0 - bl SetMonData - adds r6, 0x1 - adds r4, 0x2 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0x3 - ble _0816974A - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x15 - mov r2, r9 - bl SetMonData - b _08169DEA - .pool -_08169788: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x9 - b _0816982C - .pool -_081697B0: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x11 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x12 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x13 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x14 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x15 - bl SetMonData - b _08169DEA - .pool -_08169814: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r3, =gBattleBufferA - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r1, r3, 0x1 - adds r1, r2, r1 - ldrb r1, [r1] - adds r1, 0x8 -_0816982C: - adds r3, 0x3 - adds r2, r3 - bl SetMonData - b _08169DEA - .pool -_08169844: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1 - bl SetMonData - b _08169DEA - .pool -_08169864: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x19 - bl SetMonData - b _08169DEA - .pool -_08169884: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1A - bl SetMonData - b _08169DEA - .pool -_081698A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1B - bl SetMonData - b _08169DEA - .pool -_081698C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1C - bl SetMonData - b _08169DEA - .pool -_081698E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1D - bl SetMonData - b _08169DEA - .pool -_08169904: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1E - bl SetMonData - b _08169DEA - .pool -_08169924: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x1F - bl SetMonData - b _08169DEA - .pool -_08169944: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x20 - bl SetMonData - b _08169DEA - .pool -_08169964: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x22 - bl SetMonData - b _08169DEA - .pool -_08169984: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x23 - bl SetMonData - b _08169DEA - .pool -_081699A4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x24 - bl SetMonData - b _08169DEA - .pool -_081699C4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x25 - bl SetMonData - b _08169DEA - .pool -_081699E4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x26 - bl SetMonData - b _08169DEA - .pool -_08169A04: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - ldr r5, =gActiveBank - ldrb r2, [r5] - lsls r2, 9 - adds r2, r7 - adds r0, r4, 0 - movs r1, 0x27 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x28 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x2 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x29 - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x3 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2A - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x4 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x2B - bl SetMonData - ldrb r2, [r5] - lsls r2, 9 - adds r0, r7, 0x5 - adds r2, r0 - adds r0, r4, 0 - b _08169B24 - .pool -_08169A74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x27 - bl SetMonData - b _08169DEA - .pool -_08169A94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x28 - bl SetMonData - b _08169DEA - .pool -_08169AB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x29 - bl SetMonData - b _08169DEA - .pool -_08169AD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2A - bl SetMonData - b _08169DEA - .pool -_08169AF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2B - bl SetMonData - b _08169DEA - .pool -_08169B14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 -_08169B24: - movs r1, 0x2C - bl SetMonData - b _08169DEA - .pool -_08169B34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0 - bl SetMonData - b _08169DEA - .pool -_08169B54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x9 - bl SetMonData - b _08169DEA - .pool -_08169B74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x37 - bl SetMonData - b _08169DEA - .pool -_08169B94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x38 - bl SetMonData - b _08169DEA - .pool -_08169BB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x39 - bl SetMonData - b _08169DEA - .pool -_08169BD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3A - bl SetMonData - b _08169DEA - .pool -_08169BF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3B - bl SetMonData - b _08169DEA - .pool -_08169C14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3C - bl SetMonData - b _08169DEA - .pool -_08169C34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3D - bl SetMonData - b _08169DEA - .pool -_08169C54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3E - bl SetMonData - b _08169DEA - .pool -_08169C74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x3F - bl SetMonData - b _08169DEA - .pool -_08169C94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x16 - bl SetMonData - b _08169DEA - .pool -_08169CB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x17 - bl SetMonData - b _08169DEA - .pool -_08169CD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x18 - bl SetMonData - b _08169DEA - .pool -_08169CF4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x21 - bl SetMonData - b _08169DEA - .pool -_08169D14: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x2F - bl SetMonData - b _08169DEA - .pool -_08169D34: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x30 - bl SetMonData - b _08169DEA - .pool -_08169D54: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x32 - bl SetMonData - b _08169DEA - .pool -_08169D74: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x33 - bl SetMonData - b _08169DEA - .pool -_08169D94: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x34 - bl SetMonData - b _08169DEA - .pool -_08169DB4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x35 - bl SetMonData - b _08169DEA - .pool -_08169DD4: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gActiveBank - ldrb r2, [r1] - lsls r2, 9 - adds r2, r7 - movs r1, 0x36 - bl SetMonData -_08169DEA: - ldr r2, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r2 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - bl sub_805E990 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8169424 - - thumb_func_start sub_8169E20 -sub_8169E20: @ 8169E20 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8169E20 - - thumb_func_start sub_8169E2C -sub_8169E2C: @ 8169E2C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8169E2C - - thumb_func_start sub_8169E38 -sub_8169E38: @ 8169E38 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_8169E38 - - thumb_func_start sub_8169E44 -sub_8169E44: @ 8169E44 - push {r4-r6,lr} - ldr r0, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - bne _08169E80 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x1 - bl move_anim_start_t4 - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8168A20 - str r0, [r1] - b _08169EB6 - .pool -_08169E80: - ldr r5, =gBankSpriteIds - adds r0, r2, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - ldrb r0, [r6] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, =gHealthBoxesIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible - bl WallyBufferExecCompleted -_08169EB6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8169E44 - - thumb_func_start sub_8169EC8 -sub_8169EC8: @ 8169EC8 - push {r4-r6,lr} - ldr r4, =gActiveBank - ldrb r1, [r4] - movs r0, 0x6 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r4] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x6 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - ldrb r1, [r1, 0x18] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r4] - adds r1, r6 - strb r0, [r1] - ldr r5, =gSprites - ldrb r3, [r4] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xF0 - strh r1, [r0, 0x24] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000fffe - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, 0x1C - adds r0, r5 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816856C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8169EC8 - - thumb_func_start dp01t_07_6_ -dp01t_07_6_: @ 8169F94 - push {r4-r6,lr} - ldr r4, =gActiveBank - ldrb r1, [r4] - movs r0, 0x6 - bl LoadBackTrainerBankSpriteGfx - ldrb r0, [r4] - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x6 - bl sub_806A12C - ldr r0, =gUnknown_0202499C - ldr r1, =gTrainerBackPicCoords - ldrb r1, [r1, 0x18] - movs r2, 0x8 - subs r2, r1 - lsls r2, 18 - movs r1, 0xA0 - lsls r1, 15 - adds r2, r1 - asrs r2, 16 - movs r1, 0x50 - movs r3, 0x1E - bl CreateSprite - ldr r6, =gBankSpriteIds - ldrb r1, [r4] - adds r1, r6 - strb r0, [r1] - ldr r5, =gSprites - ldrb r3, [r4] - adds r0, r3, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffa0 - strh r1, [r0, 0x24] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, 0x1C - adds r0, r5 - ldr r1, =sub_805D7AC - str r1, [r0] - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168A90 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_07_6_ - - thumb_func_start sub_816A060 -sub_816A060: @ 816A060 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A060 - - thumb_func_start sub_816A06C -sub_816A06C: @ 816A06C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A06C - - thumb_func_start sub_816A078 -sub_816A078: @ 816A078 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A078 - - thumb_func_start sub_816A084 -sub_816A084: @ 816A084 - push {r4,r5,lr} - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - movs r0, 0x4 - strb r0, [r1, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldr r5, =gActiveBank - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t5 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A084 - - thumb_func_start sub_816A0D8 -sub_816A0D8: @ 816A0D8 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strb r1, [r0, 0x8] - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r4, [r5] - movs r0, 0x1 - bl GetBankByIdentity - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r4, 0 - movs r3, 0x4 - bl move_anim_start_t4 - ldr r1, =gBattleBankFunc - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_wait_t5 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A0D8 - - thumb_func_start sub_816A138 -sub_816A138: @ 816A138 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A138 - - thumb_func_start sub_816A144 -sub_816A144: @ 816A144 - push {r4-r6,lr} - ldr r0, =gBattleBufferA - mov r12, r0 - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r2, 9 - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - mov r1, r12 - adds r1, 0x2 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - ldr r5, =gAnimMoveTurn - mov r1, r12 - adds r1, 0x3 - adds r2, r1 - ldrb r1, [r2] - strb r1, [r5] - ldr r4, =gAnimMovePower - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x4 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x5 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r4, =gAnimMoveDmg - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x6 - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0x7 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r3, r1 - mov r1, r12 - adds r1, 0x8 - adds r1, r2, r1 - ldrb r1, [r1] - lsls r1, 16 - orrs r3, r1 - mov r1, r12 - adds r1, 0x9 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 24 - orrs r3, r1 - str r3, [r4] - ldr r3, =gAnimFriendship - ldrb r1, [r6] - lsls r1, 9 - mov r2, r12 - adds r2, 0xA - adds r1, r2 - ldrb r1, [r1] - strb r1, [r3] - ldr r4, =gWeatherMoveAnim - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0xC - adds r1, r2, r1 - ldrb r3, [r1] - mov r1, r12 - adds r1, 0xD - adds r2, r1 - ldrb r1, [r2] - lsls r1, 8 - orrs r3, r1 - strh r3, [r4] - ldr r3, =gAnimDisableStructPtr - ldrb r2, [r6] - lsls r2, 9 - mov r1, r12 - adds r1, 0x10 - adds r2, r1 - str r2, [r3] - ldr r3, =gUnknown_020244BC - ldrb r1, [r6] - lsls r1, 2 - adds r1, r3 - ldr r2, [r2] - str r2, [r1] - ldrb r1, [r5] - bl sub_805DB8C - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0816A23C - bl WallyBufferExecCompleted - b _0816A25A - .pool -_0816A23C: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r3, [r0, 0x4] - ldr r1, =gBattleBankFunc - ldrb r0, [r6] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_move_anim_5 - str r1, [r0] -_0816A25A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A144 - - thumb_func_start bx_move_anim_5 -bx_move_anim_5: @ 816A26C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r2, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r3, [r6] - lsls r1, r3, 9 - adds r0, r2, 0x1 - mov r9, r0 - adds r0, r1, r0 - ldrb r4, [r0] - adds r2, 0x2 - mov r8, r2 - add r1, r8 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - ldr r7, =gBattleSpritesDataPtr - ldr r5, [r7] - ldr r1, [r5, 0x4] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - cmp r2, 0x1 - beq _0816A2F6 - cmp r2, 0x1 - bgt _0816A2BC - cmp r2, 0 - beq _0816A2C6 - b _0816A3AC - .pool -_0816A2BC: - cmp r2, 0x2 - beq _0816A320 - cmp r2, 0x3 - beq _0816A370 - b _0816A3AC -_0816A2C6: - ldr r1, [r5] - lsls r0, r3, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0816A2E2 - adds r0, r3, 0 - adds r1, r3, 0 - adds r2, r3, 0 - movs r3, 0x5 - bl move_anim_start_t4 -_0816A2E2: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0, 0x4] - b _0816A3AC -_0816A2F6: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0816A3AC - movs r0, 0 - bl sub_805EB9C - adds r0, r4, 0 - bl DoMoveAnim - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0, 0x4] - b _0816A3AC -_0816A320: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _0816A3AC - movs r0, 0x1 - bl sub_805EB9C - ldr r0, [r7] - ldrb r2, [r6] - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0816A354 - adds r0, r2, 0 - adds r1, r2, 0 - movs r3, 0x6 - bl move_anim_start_t4 -_0816A354: - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0, 0x4] - b _0816A3AC - .pool -_0816A370: - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0816A3AC - bl sub_805E394 - ldrb r0, [r6] - lsls r2, r0, 9 - mov r3, r9 - adds r1, r2, r3 - ldrb r1, [r1] - add r2, r8 - ldrb r2, [r2] - lsls r2, 8 - orrs r1, r2 - bl sub_805E94C - ldr r0, [r7] - ldrb r1, [r6] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strb r4, [r0, 0x4] - bl WallyBufferExecCompleted -_0816A3AC: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end bx_move_anim_5 - - thumb_func_start sub_816A3B8 -sub_816A3B8: @ 816A3B8 - push {r4,lr} - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - ldr r1, =gBattleBufferA + 2 - adds r0, r1 - ldrh r0, [r0] - bl BufferStringBattle - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81685A4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A3B8 - - thumb_func_start dp01t_11_5_message_for_player_only -dp01t_11_5_message_for_player_only: @ 816A40C - push {lr} - ldr r0, =gActiveBank - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0816A428 - bl sub_816A3B8 - b _0816A42C - .pool -_0816A428: - bl WallyBufferExecCompleted -_0816A42C: - pop {r0} - bx r0 - thumb_func_end dp01t_11_5_message_for_player_only - - thumb_func_start sub_816A430 -sub_816A430: @ 816A430 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0816A456 - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r0, 0xA0 - strh r0, [r1] - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168444 - str r1, [r0] -_0816A456: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A430 - - thumb_func_start dp01t_12_1_battle_menu -dp01t_12_1_battle_menu: @ 816A470 - push {r4,lr} - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816A430 - str r1, [r0] - ldr r0, =gText_BattleMenu - movs r1, 0x2 - bl sub_814F9EC - movs r4, 0 -_0816A48A: - lsls r0, r4, 24 - lsrs r0, 24 - bl ActionSelectionDestroyCursorAt - adds r4, 0x1 - cmp r4, 0x3 - ble _0816A48A - ldr r1, =gActionSelectionCursor - ldr r0, =gActiveBank - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl ActionSelectionCreateCursorAt - ldr r0, =gText_WhatWillWallyDo - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0x1 - bl sub_814F9EC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_12_1_battle_menu - - thumb_func_start sub_816A4D8 -sub_816A4D8: @ 816A4D8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A4D8 - - thumb_func_start sub_816A4E4 -sub_816A4E4: @ 816A4E4 - push {r4,lr} - ldr r4, =gBattleStruct - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x95 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0816A522 - cmp r0, 0x1 - bgt _0816A504 - cmp r0, 0 - beq _0816A50A - b _0816A574 - .pool -_0816A504: - cmp r0, 0x2 - beq _0816A550 - b _0816A574 -_0816A50A: - bl sub_805C210 - ldr r1, [r4] - adds r1, 0x95 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x97 - movs r1, 0x50 - strb r1, [r0] - b _0816A574 -_0816A522: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0816A574 - ldr r0, =gBattle_BG0_X - strh r1, [r0] - ldr r1, =gBattle_BG0_Y - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, [r4] - adds r1, 0x95 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0816A574 - .pool -_0816A550: - adds r1, 0x97 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _0816A574 - movs r0, 0x5 - bl PlaySE - movs r2, 0x80 - lsls r2, 1 - movs r0, 0x1 - movs r1, 0xA - bl EmitCmd33 - bl WallyBufferExecCompleted -_0816A574: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816A4E4 - - thumb_func_start sub_816A57C -sub_816A57C: @ 816A57C - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gBattleBankFunc - ldr r2, =gActiveBank - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_81685D4 - str r1, [r0] - ldr r1, =gBankInMenu - ldrb r0, [r2] - strb r0, [r1] - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A57C - - thumb_func_start sub_816A5BC -sub_816A5BC: @ 816A5BC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A5BC - - thumb_func_start sub_816A5C8 -sub_816A5C8: @ 816A5C8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A5C8 - - thumb_func_start sub_816A5D4 -sub_816A5D4: @ 816A5D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r0, 0 - bl LoadBattleBarGfx - ldr r3, =gBattleBufferA - ldr r0, =gActiveBank - mov r9, r0 - ldrb r4, [r0] - lsls r2, r4, 9 - adds r0, r3, 0x2 - adds r0, r2, r0 - ldrb r1, [r0] - adds r3, 0x3 - adds r2, r3 - ldrb r0, [r2] - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - asrs r7, r1, 16 - ldr r0, =0x00007fff - cmp r7, r0 - beq _0816A664 - ldr r6, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3A - bl GetMonData - mov r8, r0 - mov r1, r9 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r6 - ldrh r0, [r0] - muls r0, r5 - adds r0, r4 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r1, =gHealthBoxesIds - adds r1, r0, r1 - ldrb r1, [r1] - str r7, [sp] - mov r2, r8 - bl SetBattleBarStruct - b _0816A69E - .pool -_0816A664: - ldr r1, =gBattlePartyID - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - mov r1, r9 - ldrb r0, [r1] - ldr r4, =gHealthBoxesIds - adds r1, r0, r4 - ldrb r1, [r1] - str r7, [sp] - movs r3, 0 - bl SetBattleBarStruct - mov r1, r9 - ldrb r0, [r1] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0 - bl UpdateHpTextInHealthbox -_0816A69E: - ldr r1, =gBattleBankFunc - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_8168934 - str r1, [r0] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A5D4 - - thumb_func_start sub_816A6D4 -sub_816A6D4: @ 816A6D4 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A6D4 - - thumb_func_start sub_816A6E0 -sub_816A6E0: @ 816A6E0 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A6E0 - - thumb_func_start sub_816A6EC -sub_816A6EC: @ 816A6EC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A6EC - - thumb_func_start sub_816A6F8 -sub_816A6F8: @ 816A6F8 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A6F8 - - thumb_func_start sub_816A704 -sub_816A704: @ 816A704 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A704 - - thumb_func_start sub_816A710 -sub_816A710: @ 816A710 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A710 - - thumb_func_start sub_816A71C -sub_816A71C: @ 816A71C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A71C - - thumb_func_start sub_816A728 -sub_816A728: @ 816A728 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A728 - - thumb_func_start sub_816A734 -sub_816A734: @ 816A734 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A734 - - thumb_func_start sub_816A740 -sub_816A740: @ 816A740 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A740 - - thumb_func_start sub_816A74C -sub_816A74C: @ 816A74C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A74C - - thumb_func_start sub_816A758 -sub_816A758: @ 816A758 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A758 - - thumb_func_start sub_816A764 -sub_816A764: @ 816A764 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A764 - - thumb_func_start sub_816A770 -sub_816A770: @ 816A770 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A770 - - thumb_func_start sub_816A77C -sub_816A77C: @ 816A77C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A77C - - thumb_func_start sub_816A788 -sub_816A788: @ 816A788 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A788 - - thumb_func_start sub_816A794 -sub_816A794: @ 816A794 - push {r4,lr} - ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _0816A7C8 - bl WallyBufferExecCompleted - b _0816A7F2 - .pool -_0816A7C8: - ldr r1, =gDoingBattleAnim - movs r0, 0x1 - strb r0, [r1] - ldrb r0, [r4] - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x30] - ldrb r0, [r4] - bl sub_80769F4 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =bx_blink_t5 - str r1, [r0] -_0816A7F2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A794 - - thumb_func_start sub_816A804 -sub_816A804: @ 816A804 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816A804 - - thumb_func_start sub_816A810 -sub_816A810: @ 816A810 - push {lr} - ldr r2, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r1, 9 - adds r0, r2, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlaySE - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A810 - - thumb_func_start sub_816A840 -sub_816A840: @ 816A840 - push {r4,r5,lr} - ldr r4, =gBattleBufferA - ldr r5, =gActiveBank - ldrb r0, [r5] - lsls r3, r0, 9 - adds r0, r4, 0x3 - adds r0, r3, r0 - ldrb r0, [r0] - cmp r0, 0 - beq _0816A87C - bl BattleMusicStop - ldrb r1, [r5] - lsls r1, 9 - adds r0, r4, 0x1 - adds r0, r1, r0 - ldrb r0, [r0] - adds r2, r4, 0x2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayBGM - b _0816A890 - .pool -_0816A87C: - adds r0, r4, 0x1 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0x2 - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 8 - orrs r0, r1 - bl PlayFanfare -_0816A890: - bl WallyBufferExecCompleted - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_816A840 - - thumb_func_start sub_816A89C -sub_816A89C: @ 816A89C - push {lr} - ldr r1, =gBattlePartyID - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x19 - bl PlayCry1 - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A89C - - thumb_func_start dp01t_2E_5_battle_intro -dp01t_2E_5_battle_intro: @ 816A8D8 - push {lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r0, [r0] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl battle_intro_launch - ldr r2, =gUnknown_020243FC - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - bl WallyBufferExecCompleted - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_2E_5_battle_intro - - thumb_func_start sub_816A90C -sub_816A90C: @ 816A90C - push {r4-r7,lr} - ldr r6, =gBankSpriteIds - ldr r7, =gActiveBank - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - bl oamt_add_pos2_onto_pos1 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x32 - strh r1, [r0, 0x2E] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffd8 - strh r1, [r0, 0x32] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x22] - strh r1, [r0, 0x36] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80A6EEC - str r1, [r0] - ldrb r2, [r7] - adds r0, r2, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x38] - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =sub_805CC00 - bl StoreSpriteCallbackInData6 - ldrb r0, [r7] - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =0x0000d6f8 - bl AllocSpritePalette - adds r4, r0, 0 - lsls r4, 24 - ldr r0, =gTrainerBackPicPaletteTable - ldr r0, [r0, 0x30] - lsrs r4, 20 - movs r2, 0x80 - lsls r2, 1 - adds r1, r4, r2 - movs r2, 0x20 - bl LoadCompressedPalette - ldrb r0, [r7] - adds r0, r6 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r4 - strb r0, [r1, 0x5] - ldr r0, =sub_816AC04 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - ldrb r0, [r7] - strh r0, [r1, 0x8] - ldr r3, =gBattleSpritesDataPtr - ldr r0, [r3] - ldrb r2, [r7] - ldr r1, [r0, 0x4] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816AA24 - ldr r0, =gUnknown_020244B4 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldr r1, =sub_8073C30 - str r1, [r0] -_0816AA24: - ldr r0, [r3] - ldr r2, [r0, 0x8] - ldrb r0, [r2, 0x9] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] - ldr r1, =gBattleBankFunc - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =nullsub_21 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816A90C - - thumb_func_start sub_816AA80 -sub_816AA80: @ 816AA80 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r6, 2 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x2] - ldr r0, =gBattlePartyID - lsls r2, r6, 1 - adds r2, r0 - ldr r0, =gBattleBufferA - lsls r1, r6, 9 - adds r0, 0x1 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r2] - ldrh r1, [r2] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =sub_805D714 - bl CreateInvisibleSpriteWithCallback - ldr r1, =gUnknown_03005D7C - mov r9, r1 - add r9, r6 - mov r1, r9 - strb r0, [r1] - adds r0, r6, 0 - bl GetBankIdentity - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, r8 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r10, r0 - adds r0, r6, 0 - movs r1, 0x2 - bl sub_80A5C6C - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - bl sub_80A6138 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_80A82E4 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - mov r0, r10 - adds r1, r5, 0 - adds r2, r4, 0 - bl CreateSprite - ldr r4, =gBankSpriteIds - adds r4, r6, r4 - strb r0, [r4] - ldr r5, =gSprites - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r4] - strh r1, [r0, 0x30] - mov r0, r9 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x32] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r8 - strh r1, [r0, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - lsls r3, r6, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =gBattleMonForms - adds r6, r1 - ldrb r1, [r6] - bl StartSpriteAnim - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - movs r0, 0 - movs r1, 0xFF - bl sub_80753E8 - mov r1, r9 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x2E] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AA80 - - thumb_func_start sub_816AC04 -sub_816AC04: @ 816AC04 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0xA] - movs r3, 0xA - ldrsh r0, [r1, r3] - cmp r0, 0x1E - bgt _0816AC28 - adds r0, r2, 0x1 - strh r0, [r1, 0xA] - b _0816AC5E - .pool -_0816AC28: - ldr r4, =gActiveBank - ldrb r5, [r4] - ldrh r0, [r1, 0x8] - strb r0, [r4] - ldr r0, =gBattleBufferA - ldrb r1, [r4] - lsls r2, r1, 9 - adds r0, 0x1 - adds r2, r0 - ldr r0, =gBattlePartyID - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - strb r0, [r2] - ldrb r0, [r4] - bl sub_816AA80 - ldr r1, =gBattleBankFunc - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =sub_816864C - str r1, [r0] - strb r5, [r4] - adds r0, r6, 0 - bl DestroyTask -_0816AC5E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AC04 - - thumb_func_start sub_816AC78 -sub_816AC78: @ 816AC78 - push {r4,r5,lr} - ldr r1, =gBattleBufferA - ldr r0, =gActiveBank - ldrb r2, [r0] - lsls r0, r2, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0816ACA8 - adds r0, r2, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0816ACA8 - bl WallyBufferExecCompleted - b _0816ACE6 - .pool -_0816ACA8: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r5, =gActiveBank - ldrb r1, [r5] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - ldrb r0, [r5] - lsls r4, r0, 9 - ldr r3, =gBattleBufferA + 4 - adds r1, r4, r3 - subs r2, r3, 0x3 - adds r2, r4, r2 - ldrb r2, [r2] - subs r3, 0x2 - adds r4, r3 - ldrb r3, [r4] - bl CreatePartyStatusSummarySprites - ldr r2, =gUnknown_020244B4 - ldrb r1, [r5] - adds r1, r2 - strb r0, [r1] - bl WallyBufferExecCompleted -_0816ACE6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AC78 - - thumb_func_start sub_816ACFC -sub_816ACFC: @ 816ACFC - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816ACFC - - thumb_func_start sub_816AD08 -sub_816AD08: @ 816AD08 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816AD08 - - thumb_func_start sub_816AD14 -sub_816AD14: @ 816AD14 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816AD14 - - thumb_func_start sub_816AD20 -sub_816AD20: @ 816AD20 - push {r4-r6,lr} - sub sp, 0x4 - ldr r5, =gBattleBufferA - ldr r6, =gActiveBank - ldrb r2, [r6] - lsls r1, r2, 9 - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - adds r0, r5, 0x2 - adds r0, r1, r0 - ldrb r4, [r0] - adds r5, 0x3 - adds r1, r5 - ldrb r0, [r1] - lsls r0, 8 - orrs r4, r0 - str r4, [sp] - adds r0, r2, 0 - adds r1, r2, 0 - bl move_anim_start_t3 - lsls r0, 24 - cmp r0, 0 - beq _0816AD60 - bl WallyBufferExecCompleted - b _0816AD6C - .pool -_0816AD60: - ldr r0, =gBattleBankFunc - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_8168AC8 - str r0, [r1] -_0816AD6C: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AD20 - - thumb_func_start sub_816AD7C -sub_816AD7C: @ 816AD7C - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816AD7C - - thumb_func_start sub_816AD88 -sub_816AD88: @ 816AD88 - push {lr} - bl WallyBufferExecCompleted - pop {r0} - bx r0 - thumb_func_end sub_816AD88 - - thumb_func_start sub_816AD94 -sub_816AD94: @ 816AD94 - push {r4,lr} - ldr r2, =gBattleOutcome - ldr r1, =gBattleBufferA - ldr r4, =gActiveBank - ldrb r0, [r4] - lsls r0, 9 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - movs r0, 0x5 - bl FadeOutMapMusic - movs r0, 0x3 - bl BeginFastPaletteFade - bl WallyBufferExecCompleted - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x6 - ands r0, r1 - cmp r0, 0x2 - bne _0816ADD0 - ldr r0, =gBattleBankFunc - ldrb r1, [r4] - lsls r1, 2 - adds r1, r0 - ldr r0, =sub_80587B0 - str r0, [r1] -_0816ADD0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AD94 - - thumb_func_start nullsub_118 -nullsub_118: @ 816ADF0 - bx lr - thumb_func_end nullsub_118 - - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index 7ac60f1be..978dd30fa 100755 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -6956,7 +6956,7 @@ _08192574: cmp r2, r0 bne _08192598 ldrb r0, [r1, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 b _081925B6 @@ -6971,7 +6971,7 @@ _08192598: .pool _081925AC: ldr r0, [sp, 0x24] - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId _081925B2: lsls r0, 24 lsrs r0, 24 @@ -8535,7 +8535,7 @@ _081932A2: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 mov r2, r8 @@ -8554,7 +8554,7 @@ _081932D4: _081932E4: lsls r0, r1, 16 lsrs r0, 16 - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId _081932EC: lsls r0, 24 lsrs r0, 24 @@ -8621,7 +8621,7 @@ _0819335A: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 b _081933B0 @@ -8642,7 +8642,7 @@ _08193388: _081933A4: lsls r0, r1, 16 lsrs r0, 16 - bl sub_8162AA0 + bl GetFrontierTrainerFrontSpriteId lsls r0, 24 lsrs r0, 24 _081933B0: diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 37ddc7ac6..ac92b3c2a 100755 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -20557,7 +20557,7 @@ _081A5306: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow b _081A553E .pool _081A531C: @@ -20582,29 +20582,29 @@ _081A5328: ldr r4, =gDisplayedStringBattle adds r0, r4, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Vs movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_OpponentMon1Name bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Mind movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Skill movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Body movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Judgement bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _081A553E .pool _081A53B4: @@ -20688,7 +20688,7 @@ _081A5464: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r0, [r5] adds r0, 0x1 strb r0, [r5] @@ -20733,7 +20733,7 @@ _081A54D4: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0 bl CopyBgTilemapBufferToVram ldr r0, =gMPlay_BGM diff --git a/asm/battle_link_817C95C.s b/asm/battle_link_817C95C.s index aa887bc25..fedb50c45 100644 --- a/asm/battle_link_817C95C.s +++ b/asm/battle_link_817C95C.s @@ -110,7 +110,7 @@ _0817CA4C: ldr r1, =gStringInfo ldr r1, [r1] ldrh r1, [r1] - bl sub_817F33C + bl GetBankMoveSlotId lsls r0, 24 lsrs r0, 24 mov r10, r0 @@ -2572,7 +2572,7 @@ _0817E122: mov r1, r10 ldrb r0, [r1] adds r1, r7, 0 - bl sub_817F33C + bl GetBankMoveSlotId lsls r0, 24 lsrs r6, r0, 24 cmp r6, 0x3 @@ -4793,8 +4793,8 @@ _0817F324: .pool thumb_func_end sub_817F2A8 - thumb_func_start sub_817F33C -sub_817F33C: @ 817F33C + thumb_func_start GetBankMoveSlotId +GetBankMoveSlotId: @ 817F33C push {r4-r7,lr} lsls r0, 24 lsrs r5, r0, 24 @@ -4835,7 +4835,7 @@ _0817F388: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_817F33C + thumb_func_end GetBankMoveSlotId thumb_func_start sub_817F394 sub_817F394: @ 817F394 @@ -4888,97 +4888,4 @@ _0817F3E6: bx r0 thumb_func_end sub_817F394 - thumb_func_start nullsub_69 -nullsub_69: @ 817F3EC - bx lr - thumb_func_end nullsub_69 - - thumb_func_start sub_817F3F0 -sub_817F3F0: @ 817F3F0 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x4 - mov r9, r0 - mov r8, r1 - adds r5, r2, 0 - adds r4, r3, 0 - lsls r5, 16 - negs r5, r5 - lsls r4, 16 - negs r4, r4 - lsrs r4, 16 - mov r0, r8 - lsls r0, 16 - asrs r0, 16 - mov r8, r0 - asrs r5, 16 - adds r1, r5, 0 - bl Cos - adds r6, r0, 0 - lsls r4, 16 - asrs r4, 16 - mov r0, r8 - adds r1, r4, 0 - bl Sin - subs r6, r0 - lsls r6, 16 - lsrs r6, 16 - mov r0, r8 - adds r1, r4, 0 - bl Cos - adds r2, r0, 0 - mov r0, r8 - adds r1, r5, 0 - str r2, [sp] - bl Sin - ldr r2, [sp] - adds r2, r0 - negs r5, r5 - negs r4, r4 - lsls r6, 16 - asrs r6, 16 - lsls r5, 16 - asrs r5, 16 - adds r6, r5 - mov r0, r9 - strh r6, [r0, 0x24] - lsls r2, 16 - asrs r2, 16 - lsls r4, 16 - asrs r4, 16 - adds r2, r4 - strh r2, [r0, 0x26] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817F3F0 - - thumb_func_start GetSpeciesBackAnimId -GetSpeciesBackAnimId: @ 817F474 - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gUnknown_0860A8C8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0817F48C - movs r0, 0 - b _0817F492 - .pool -_0817F48C: - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 -_0817F492: - pop {r1} - bx r1 - thumb_func_end GetSpeciesBackAnimId - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_tower.s b/asm/battle_tower.s index 74c84e34c..122d9d27c 100755 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -1329,8 +1329,8 @@ _08162A8A: .pool thumb_func_end sub_81628A0 - thumb_func_start sub_8162AA0 -sub_8162AA0: @ 8162AA0 + thumb_func_start GetFrontierTrainerFrontSpriteId +GetFrontierTrainerFrontSpriteId: @ 8162AA0 push {r4,r5,lr} lsls r0, 16 lsrs r4, r0, 16 @@ -1454,7 +1454,7 @@ _08162BCA: pop {r1} bx r1 .pool - thumb_func_end sub_8162AA0 + thumb_func_end GetFrontierTrainerFrontSpriteId thumb_func_start GetFrontierOpponentClass GetFrontierOpponentClass: @ 8162BD8 @@ -5843,8 +5843,8 @@ _08165206: .pool thumb_func_end sub_816515C - thumb_func_start sub_8165244 -sub_8165244: @ 8165244 + thumb_func_start GetEreaderTrainerFrontSpriteId +GetEreaderTrainerFrontSpriteId: @ 8165244 ldr r1, =gUnknown_0831F578 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] @@ -5855,7 +5855,7 @@ sub_8165244: @ 8165244 ldrb r0, [r0] bx lr .pool - thumb_func_end sub_8165244 + thumb_func_end GetEreaderTrainerFrontSpriteId thumb_func_start GetEreaderTrainerClassId GetEreaderTrainerClassId: @ 8165264 diff --git a/asm/battle_transition.s b/asm/battle_transition.s index 2f9637594..6ffa17320 100644 --- a/asm/battle_transition.s +++ b/asm/battle_transition.s @@ -4348,7 +4348,7 @@ sub_8148218: @ 8148218 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 24 lsrs r0, 24 movs r1, 0x88 diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index f20070978..e6d30b7cb 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -1415,7 +1415,7 @@ _080F64F2: adds r0, r6, 0 adds r1, r5, 0 adds r2, r4, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette adds r0, r6, 0 diff --git a/asm/evolution_graphics.s b/asm/evolution_graphics.s deleted file mode 100644 index df64857c7..000000000 --- a/asm/evolution_graphics.s +++ /dev/null @@ -1,1751 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start nullsub_67 -nullsub_67: @ 817BA40 - bx lr - thumb_func_end nullsub_67 - - thumb_func_start sub_817BA44 -sub_817BA44: @ 817BA44 - push {r4,r5,lr} - sub sp, 0x4 - movs r4, 0 - ldr r5, =gUnknown_085F5458 -_0817BA4C: - adds r0, r4, 0 - adds r0, 0x14 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r4, 1 - adds r1, r5 - ldrh r1, [r1] - str r1, [sp] - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0xB - bls _0817BA4C - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BA44 - - thumb_func_start sub_817BA7C -sub_817BA7C: @ 817BA7C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x22 - ldrsh r0, [r4, r1] - cmp r0, 0x8 - ble _0817BB2A - movs r2, 0x3C - ldrsh r0, [r4, r2] - adds r1, r0, 0 - muls r1, r0 - adds r0, r1, 0 - movs r1, 0x50 - bl __divsi3 - movs r1, 0x58 - subs r1, r0 - strh r1, [r4, 0x22] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _0817BAB6 - adds r0, 0x3 -_0817BAB6: - asrs r0, 2 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3A] - adds r0, 0x4 - strh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0817BAE0 - ldrh r0, [r4, 0x38] - subs r0, 0x1 - strh r0, [r4, 0x38] -_0817BAE0: - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - movs r1, 0x26 - ldrsh r0, [r4, r1] - cmp r0, 0 - ble _0817BAF6 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1 - b _0817BAFC -_0817BAF6: - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x14 -_0817BAFC: - strb r0, [r1] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0 - bge _0817BB08 - adds r0, 0x3 -_0817BB08: - asrs r0, 2 - adds r0, 0x14 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1F - bls _0817BB16 - movs r2, 0x1F -_0817BB16: - movs r0, 0x1F - ands r2, r0 - lsls r2, 1 - ldrb r1, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x3] - b _0817BB30 -_0817BB2A: - adds r0, r4, 0 - bl DestroySprite -_0817BB30: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BA7C - - thumb_func_start sub_817BB38 -sub_817BB38: @ 817BB38 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x58 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0817BB82 - ldr r4, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r2, r3, r4 - movs r1, 0 - movs r0, 0x30 - strh r0, [r2, 0x38] - strh r5, [r2, 0x3A] - strh r1, [r2, 0x3C] - ldrb r1, [r2, 0x1] - subs r0, 0x34 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r2, 0x3] - movs r1, 0x3E - orrs r0, r1 - strb r0, [r2, 0x3] - adds r4, 0x1C - adds r3, r4 - ldr r0, =sub_817BA7C - str r0, [r3] -_0817BB82: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BB38 - - thumb_func_start sub_817BB94 -sub_817BB94: @ 817BB94 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x22 - ldrsh r0, [r4, r1] - cmp r0, 0x57 - bgt _0817BBFA - movs r2, 0x3C - ldrsh r0, [r4, r2] - adds r1, r0, 0 - muls r1, r0 - adds r0, r1, 0 - movs r1, 0x5 - bl __divsi3 - adds r0, 0x8 - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _0817BBCC - adds r0, 0x3 -_0817BBCC: - asrs r0, 2 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - lsls r0, 26 - lsrs r0, 24 - movs r1, 0x28 - bl Sin - adds r0, 0x8 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - b _0817BC00 -_0817BBFA: - adds r0, r4, 0 - bl DestroySprite -_0817BC00: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BB94 - - thumb_func_start sub_817BC08 -sub_817BC08: @ 817BC08 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x8 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0817BC5E - ldr r4, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r2, r3, r4 - movs r1, 0 - movs r0, 0x8 - strh r0, [r2, 0x38] - strh r5, [r2, 0x3A] - strh r1, [r2, 0x3C] - ldrb r1, [r2, 0x1] - subs r0, 0xC - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r1, [r2, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x32 - orrs r0, r1 - strb r0, [r2, 0x3] - adds r2, 0x43 - movs r0, 0x1 - strb r0, [r2] - adds r4, 0x1C - adds r3, r4 - ldr r0, =sub_817BB94 - str r0, [r3] -_0817BC5E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BC08 - - thumb_func_start sub_817BC70 -sub_817BC70: @ 817BC70 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x8 - ble _0817BCAC - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x38] - ldrh r1, [r4, 0x34] - subs r0, r1 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x3A] - adds r0, 0x4 - strh r0, [r4, 0x3A] - b _0817BCB2 -_0817BCAC: - adds r0, r4, 0 - bl DestroySprite -_0817BCB2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BC70 - - thumb_func_start sub_817BCB8 -sub_817BCB8: @ 817BCB8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x38 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0817BD0E - ldr r4, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r2, r3, r4 - movs r1, 0 - strh r5, [r2, 0x34] - movs r0, 0x78 - strh r0, [r2, 0x38] - strh r6, [r2, 0x3A] - strh r1, [r2, 0x3C] - ldrb r1, [r2, 0x1] - subs r0, 0x7C - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r2, 0x3] - movs r1, 0x3E - orrs r0, r1 - strb r0, [r2, 0x3] - adds r2, 0x43 - movs r0, 0x1 - strb r0, [r2] - adds r4, 0x1C - adds r3, r4 - ldr r0, =sub_817BC70 - str r0, [r3] -_0817BD0E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BCB8 - - thumb_func_start sub_817BD20 -sub_817BD20: @ 817BD20 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x3C] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0817BD34 - ldrh r0, [r4, 0x22] - adds r0, 0x1 - strh r0, [r4, 0x22] -_0817BD34: - ldrh r1, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmp r0, 0x7F - bgt _0817BDE4 - lsls r0, r1, 24 - lsrs r0, 24 - movs r5, 0x38 - ldrsh r1, [r4, r5] - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r2, 0x3C - ldrsh r0, [r4, r2] - muls r0, r1 - movs r1, 0x3 - bl __divsi3 - adds r0, 0x78 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x3A] - adds r3, r0, 0x1 - strh r3, [r4, 0x3A] - movs r5, 0x3A - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - cmp r0, 0 - bge _0817BD78 - adds r0, 0x7F -_0817BD78: - asrs r0, 7 - movs r1, 0x1F - subs r1, r0 - lsls r1, 24 - lsrs r2, r1, 24 - lsls r0, r3, 16 - asrs r0, 16 - cmp r0, 0x40 - ble _0817BD94 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1 - strb r0, [r1] - b _0817BDC4 -_0817BD94: - adds r3, r4, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x14 - strb r0, [r1] - ldrh r1, [r4, 0x3A] - movs r5, 0x3A - ldrsh r0, [r4, r5] - cmp r0, 0x70 - ble _0817BDC4 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0817BDC4 - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] -_0817BDC4: - cmp r2, 0x13 - bhi _0817BDCA - movs r2, 0x14 -_0817BDCA: - movs r0, 0x1F - ands r2, r0 - lsls r2, 1 - ldrb r1, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x3] - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - b _0817BDEA -_0817BDE4: - adds r0, r4, 0 - bl DestroySprite -_0817BDEA: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817BD20 - - thumb_func_start sub_817BDF0 -sub_817BDF0: @ 817BDF0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gUnknown_085F5440 - movs r1, 0x78 - movs r2, 0x38 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x40 - beq _0817BE60 - bl Random - ldr r6, =gSprites - lsls r5, r4, 4 - adds r5, r4 - lsls r5, 2 - adds r4, r5, r6 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x7 - bl __umodsi3 - movs r1, 0x3 - subs r1, r0 - movs r0, 0 - mov r8, r0 - strh r1, [r4, 0x34] - bl Random - movs r1, 0x3F - ands r1, r0 - adds r1, 0x30 - strh r1, [r4, 0x38] - mov r0, r8 - strh r0, [r4, 0x3C] - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r4, 0x3] - movs r1, 0x3E - orrs r0, r1 - strb r0, [r4, 0x3] - adds r4, 0x43 - movs r0, 0x14 - strb r0, [r4] - adds r6, 0x1C - adds r5, r6 - ldr r0, =sub_817BD20 - str r0, [r5] -_0817BE60: - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BDF0 - - thumb_func_start sub_817BE78 -sub_817BE78: @ 817BE78 - push {lr} - ldr r0, =gUnknown_085F540C - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gUnknown_085F541C - bl LoadSpritePalettes - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BE78 - - thumb_func_start sub_817BE94 -sub_817BE94: @ 817BE94 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =sub_817BEC4 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xA] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817BE94 - - thumb_func_start sub_817BEC4 -sub_817BEC4: @ 817BEC4 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_817BA44 - ldr r0, =gTasks - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - adds r5, r0 - movs r0, 0 - strh r0, [r5, 0x26] - movs r0, 0xA - ldrsh r1, [r5, r0] - movs r0, 0x3 - lsls r0, r1 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0xA - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_817BF14 - str r0, [r5] - movs r0, 0x8C - bl PlaySE - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BEC4 - - thumb_func_start sub_817BF14 -sub_817BF14: @ 817BF14 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r3, r5, 2 - adds r0, r3, r5 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0x26] - movs r4, 0x26 - ldrsh r0, [r1, r4] - cmp r0, 0x3F - bgt _0817BF70 - movs r0, 0x7 - ands r0, r2 - adds r7, r3, 0 - cmp r0, 0 - bne _0817BF5A - movs r4, 0 - adds r6, r1, 0 -_0817BF3C: - ldrh r1, [r6, 0x26] - movs r0, 0x78 - ands r0, r1 - lsls r0, 1 - lsls r1, r4, 6 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - bl sub_817BB38 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0817BF3C -_0817BF5A: - ldr r0, =gTasks - adds r1, r7, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817BF78 - .pool -_0817BF70: - movs r0, 0x60 - strh r0, [r1, 0x26] - ldr r0, =sub_817BF84 - str r0, [r1] -_0817BF78: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BF14 - - thumb_func_start sub_817BF84 -sub_817BF84: @ 817BF84 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0, r1 - ldrh r3, [r1, 0x26] - movs r4, 0x26 - ldrsh r0, [r1, r4] - cmp r0, 0 - beq _0817BFA8 - subs r0, r3, 0x1 - strh r0, [r1, 0x26] - b _0817BFAE - .pool -_0817BFA8: - adds r0, r2, 0 - bl DestroyTask -_0817BFAE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817BF84 - - thumb_func_start sub_817BFB4 -sub_817BFB4: @ 817BFB4 - push {lr} - ldr r0, =sub_817BFCC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_817BFB4 - - thumb_func_start sub_817BFCC -sub_817BFCC: @ 817BFCC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_817BA44 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x26] - ldr r1, =sub_817C000 - str r1, [r0] - movs r0, 0xB7 - bl PlaySE - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817BFCC - - thumb_func_start sub_817C000 -sub_817C000: @ 817C000 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r2, r5, 2 - adds r0, r2, r5 - lsls r0, 3 - adds r1, r0, r1 - movs r3, 0x26 - ldrsh r0, [r1, r3] - cmp r0, 0x5F - bgt _0817C048 - adds r6, r2, 0 - cmp r0, 0x5 - bgt _0817C032 - movs r4, 0 -_0817C020: - lsls r0, r4, 28 - lsrs r0, 24 - bl sub_817BC08 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x8 - bls _0817C020 -_0817C032: - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C04C - .pool -_0817C048: - ldr r0, =sub_817C058 - str r0, [r1] -_0817C04C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C000 - - thumb_func_start sub_817C058 -sub_817C058: @ 817C058 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - pop {r0} - bx r0 - thumb_func_end sub_817C058 - - thumb_func_start sub_817C068 -sub_817C068: @ 817C068 - push {lr} - ldr r0, =sub_817C080 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C068 - - thumb_func_start sub_817C080 -sub_817C080: @ 817C080 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_817BA44 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x26] - ldr r1, =sub_817C0B4 - str r1, [r0] - movs r0, 0x66 - bl PlaySE - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C080 - - thumb_func_start sub_817C0B4 -sub_817C0B4: @ 817C0B4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r2, r5, 2 - adds r0, r2, r5 - lsls r0, 3 - adds r1, r0, r1 - movs r3, 0x26 - ldrsh r0, [r1, r3] - cmp r0, 0x2F - bgt _0817C124 - adds r6, r2, 0 - cmp r0, 0 - bne _0817C0E8 - movs r4, 0 -_0817C0D4: - lsls r0, r4, 28 - lsrs r0, 24 - movs r1, 0x4 - bl sub_817BCB8 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _0817C0D4 -_0817C0E8: - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - movs r2, 0x26 - ldrsh r0, [r1, r2] - cmp r0, 0x20 - bne _0817C10E - movs r4, 0 -_0817C0FA: - lsls r0, r4, 28 - lsrs r0, 24 - movs r1, 0x8 - bl sub_817BCB8 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _0817C0FA -_0817C10E: - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C128 - .pool -_0817C124: - ldr r0, =sub_817C134 - str r0, [r1] -_0817C128: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C0B4 - - thumb_func_start sub_817C134 -sub_817C134: @ 817C134 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - pop {r0} - bx r0 - thumb_func_end sub_817C134 - - thumb_func_start sub_817C144 -sub_817C144: @ 817C144 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =sub_817C174 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xC] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C144 - - thumb_func_start sub_817C174 -sub_817C174: @ 817C174 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_817BA44 - ldr r0, =gTasks - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - adds r5, r0 - movs r0, 0 - strh r0, [r5, 0x26] - ldr r0, =gPlttBufferFaded + 0x40 - ldr r1, =gPlttBufferUnfaded + 0x40 - movs r2, 0x30 - bl CpuSet - ldr r0, =0xfff9041c - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_817C1D4 - str r0, [r5] - movs r0, 0xCA - bl PlaySE - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C174 - - thumb_func_start sub_817C1D4 -sub_817C1D4: @ 817C1D4 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r5, r6, 2 - adds r0, r5, r6 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0x26 - ldrsh r2, [r1, r0] - cmp r2, 0x7F - bgt _0817C250 - adds r0, r2, 0 - cmp r0, 0 - beq _0817C210 - cmp r0, 0x20 - beq _0817C224 - cmp r2, 0x31 - bgt _0817C234 - bl Random - movs r1, 0x7 - ands r0, r1 - bl sub_817BDF0 - b _0817C234 - .pool -_0817C210: - movs r4, 0 -_0817C212: - adds r0, r4, 0 - bl sub_817BDF0 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _0817C212 - b _0817C234 -_0817C224: - ldr r0, =0xffff041c - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0x10 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0817C234: - ldr r0, =gTasks - adds r1, r5, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C254 - .pool -_0817C250: - ldr r0, =sub_817C260 - str r0, [r1] -_0817C254: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C1D4 - - thumb_func_start sub_817C260 -sub_817C260: @ 817C260 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0817C278 - adds r0, r2, 0 - bl DestroyTask -_0817C278: - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C260 - - thumb_func_start sub_817C280 -sub_817C280: @ 817C280 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =sub_817C2B0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xC] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C280 - - thumb_func_start sub_817C2B0 -sub_817C2B0: @ 817C2B0 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_817BA44 - ldr r0, =gTasks - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - adds r5, r0 - movs r0, 0 - strh r0, [r5, 0x26] - ldr r0, =gPlttBufferFaded + 0x40 - ldr r1, =gPlttBufferUnfaded + 0x40 - movs r2, 0x30 - bl CpuSet - ldr r0, =0xfff90400 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_817C310 - str r0, [r5] - movs r0, 0xCA - bl PlaySE - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C2B0 - - thumb_func_start sub_817C310 -sub_817C310: @ 817C310 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r5, r6, 2 - adds r0, r5, r6 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0x26 - ldrsh r2, [r1, r0] - cmp r2, 0x7F - bgt _0817C38C - adds r0, r2, 0 - cmp r0, 0 - beq _0817C34C - cmp r0, 0x20 - beq _0817C360 - cmp r2, 0x31 - bgt _0817C370 - bl Random - movs r1, 0x7 - ands r0, r1 - bl sub_817BDF0 - b _0817C370 - .pool -_0817C34C: - movs r4, 0 -_0817C34E: - adds r0, r4, 0 - bl sub_817BDF0 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _0817C34E - b _0817C370 -_0817C360: - ldr r0, =0xffff0400 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0x10 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0817C370: - ldr r0, =gTasks - adds r1, r5, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _0817C390 - .pool -_0817C38C: - ldr r0, =sub_817C260 - str r0, [r1] -_0817C390: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C310 - - thumb_func_start nullsub_68 -nullsub_68: @ 817C39C - bx lr - thumb_func_end nullsub_68 - - thumb_func_start sub_817C3A0 -sub_817C3A0: @ 817C3A0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - movs r1, 0 - ldr r3, =sub_817C4EC - ldr r2, =0x00007fff -_0817C3BA: - lsls r0, r1, 1 - add r0, sp - adds r0, 0x4 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xF - bls _0817C3BA - adds r0, r3, 0 - movs r1, 0 - bl CreateTask - mov r8, r0 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gTasks - mov r1, r8 - lsls r6, r1, 2 - add r6, r8 - lsls r6, 3 - adds r6, r0 - strh r5, [r6, 0xA] - strh r7, [r6, 0xC] - movs r1, 0x80 - lsls r1, 1 - strh r1, [r6, 0xE] - movs r0, 0x10 - strh r0, [r6, 0x10] - movs r4, 0x80 - lsls r4, 9 - str r1, [sp] - movs r0, 0x1E - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - movs r0, 0x10 - ldrsh r1, [r6, r0] - adds r0, r4, 0 - bl __divsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r0, 0x1F - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - ldr r1, =gSprites - mov r9, r1 - lsls r2, r5, 4 - adds r2, r5 - lsls r2, 2 - mov r3, r9 - adds r3, 0x1C - adds r0, r2, r3 - ldr r1, =nullsub_68 - str r1, [r0] - add r2, r9 - ldrb r1, [r2, 0x1] - movs r4, 0x4 - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r1, [r2, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x3C - orrs r0, r1 - strb r0, [r2, 0x3] - movs r0, 0x3E - adds r0, r2 - mov r10, r0 - ldrb r1, [r0] - movs r5, 0x5 - negs r5, r5 - adds r0, r5, 0 - ands r0, r1 - mov r1, r10 - strb r0, [r1] - ldrb r1, [r2, 0x5] - lsrs r1, 4 - lsls r1, 5 - ldr r0, =gPlttBufferFaded + 0x200 - mov r10, r0 - add r1, r10 - add r0, sp, 0x4 - movs r2, 0x10 - str r3, [sp, 0x24] - bl CpuSet - lsls r1, r7, 4 - adds r1, r7 - lsls r1, 2 - ldr r3, [sp, 0x24] - adds r3, r1, r3 - ldr r0, =nullsub_68 - str r0, [r3] - add r1, r9 - ldrb r0, [r1, 0x1] - ands r4, r0 - movs r0, 0x1 - orrs r4, r0 - strb r4, [r1, 0x1] - ldrb r0, [r1, 0x3] - movs r2, 0x3E - orrs r0, r2 - strb r0, [r1, 0x3] - adds r2, r1, 0 - adds r2, 0x3E - ldrb r0, [r2] - ands r5, r0 - strb r5, [r2] - ldrb r1, [r1, 0x5] - lsrs r1, 4 - lsls r1, 5 - add r1, r10 - add r0, sp, 0x4 - movs r2, 0x10 - bl CpuSet - movs r1, 0 - strh r1, [r6, 0x18] - mov r0, r8 - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817C3A0 - - thumb_func_start sub_817C4EC -sub_817C4EC: @ 817C4EC - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x12] - movs r0, 0x8 - strh r0, [r1, 0x14] - ldr r0, =sub_817C510 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_817C4EC - - thumb_func_start sub_817C510 -sub_817C510: @ 817C510 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r2, r0, r1 - movs r1, 0x18 - ldrsh r0, [r2, r1] - cmp r0, 0 - beq _0817C534 - adds r0, r3, 0 - bl sub_817C72C - b _0817C556 - .pool -_0817C534: - ldrh r1, [r2, 0x14] - movs r4, 0x14 - ldrsh r0, [r2, r4] - cmp r0, 0x80 - bne _0817C546 - adds r0, r3, 0 - bl sub_817C67C - b _0817C556 -_0817C546: - adds r0, r1, 0x2 - strh r0, [r2, 0x14] - ldrh r0, [r2, 0x12] - movs r1, 0x1 - eors r0, r1 - strh r0, [r2, 0x12] - ldr r0, =sub_817C560 - str r0, [r2] -_0817C556: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C510 - - thumb_func_start sub_817C560 -sub_817C560: @ 817C560 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r1 - movs r3, 0x18 - ldrsh r0, [r2, r3] - adds r5, r1, 0 - cmp r0, 0 - beq _0817C58C - ldr r0, =sub_817C72C - str r0, [r2] - b _0817C670 - .pool -_0817C58C: - movs r6, 0 - movs r7, 0x12 - ldrsh r0, [r2, r7] - cmp r0, 0 - bne _0817C5DC - movs r0, 0xE - ldrsh r1, [r2, r0] - movs r3, 0x14 - ldrsh r0, [r2, r3] - movs r3, 0x80 - lsls r3, 1 - subs r0, r3, r0 - cmp r1, r0 - bge _0817C5B2 - ldrh r0, [r2, 0x14] - ldrh r7, [r2, 0xE] - adds r0, r7 - strh r0, [r2, 0xE] - b _0817C5B6 -_0817C5B2: - strh r3, [r2, 0xE] - movs r6, 0x1 -_0817C5B6: - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r5 - movs r0, 0x10 - ldrsh r1, [r3, r0] - movs r7, 0x14 - ldrsh r0, [r3, r7] - adds r0, 0x10 - cmp r1, r0 - ble _0817C5D6 - ldrh r0, [r3, 0x10] - ldrh r1, [r3, 0x14] - subs r0, r1 - strh r0, [r3, 0x10] - b _0817C626 -_0817C5D6: - movs r0, 0x10 - strh r0, [r3, 0x10] - b _0817C620 -_0817C5DC: - movs r0, 0x10 - ldrsh r1, [r2, r0] - movs r3, 0x14 - ldrsh r0, [r2, r3] - movs r3, 0x80 - lsls r3, 1 - subs r0, r3, r0 - cmp r1, r0 - bge _0817C5F8 - ldrh r0, [r2, 0x14] - ldrh r7, [r2, 0x10] - adds r0, r7 - strh r0, [r2, 0x10] - b _0817C5FC -_0817C5F8: - strh r3, [r2, 0x10] - movs r6, 0x1 -_0817C5FC: - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r5 - movs r0, 0xE - ldrsh r1, [r3, r0] - movs r7, 0x14 - ldrsh r0, [r3, r7] - adds r0, 0x10 - cmp r1, r0 - ble _0817C61C - ldrh r0, [r3, 0xE] - ldrh r1, [r3, 0x14] - subs r0, r1 - strh r0, [r3, 0xE] - b _0817C626 -_0817C61C: - movs r0, 0x10 - strh r0, [r3, 0xE] -_0817C620: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0817C626: - adds r0, r2, r4 - lsls r0, 3 - adds r5, r0, r5 - movs r0, 0xE - ldrsh r1, [r5, r0] - movs r4, 0x80 - lsls r4, 9 - adds r0, r4, 0 - bl __divsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r0, 0x1E - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - movs r3, 0x10 - ldrsh r1, [r5, r3] - adds r0, r4, 0 - bl __divsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r0, 0x1F - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - cmp r6, 0x2 - bne _0817C670 - ldr r0, =sub_817C510 - str r0, [r5] -_0817C670: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C560 - - thumb_func_start sub_817C67C -sub_817C67C: @ 817C67C - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - mov r8, r1 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x1] - movs r6, 0x4 - negs r6, r6 - adds r1, r6, 0 - ands r1, r3 - strb r1, [r2, 0x1] - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x3] - movs r5, 0x3F - negs r5, r5 - adds r1, r5, 0 - ands r1, r3 - strb r1, [r2, 0x3] - movs r1, 0xA - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r2, [r1] - movs r3, 0x4 - orrs r2, r3 - strb r2, [r1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x1] - ands r6, r2 - strb r6, [r1, 0x1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x3] - ands r5, r2 - strb r5, [r1, 0x3] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - ands r2, r3 - strb r2, [r1] - bl DestroyTask - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C67C - - thumb_func_start sub_817C72C -sub_817C72C: @ 817C72C - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - mov r8, r1 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x1] - movs r6, 0x4 - negs r6, r6 - adds r1, r6, 0 - ands r1, r3 - strb r1, [r2, 0x1] - movs r2, 0xA - ldrsh r1, [r4, r2] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x3] - movs r5, 0x3F - negs r5, r5 - adds r1, r5, 0 - ands r1, r3 - strb r1, [r2, 0x3] - movs r1, 0xA - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - ands r2, r3 - strb r2, [r1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x1] - ands r6, r2 - strb r6, [r1, 0x1] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - ldrb r2, [r1, 0x3] - ands r5, r2 - strb r5, [r1, 0x3] - movs r1, 0xC - ldrsh r2, [r4, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r8 - adds r1, 0x3E - ldrb r2, [r1] - movs r3, 0x4 - orrs r2, r3 - strb r2, [r1] - bl DestroyTask - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817C72C - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s deleted file mode 100644 index e5e9aaab9..000000000 --- a/asm/evolution_scene.s +++ /dev/null @@ -1,4216 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_813D9B0 -sub_813D9B0: @ 813D9B0 - push {lr} - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end sub_813D9B0 - - thumb_func_start sub_813D9C0 -sub_813D9C0: @ 813D9C0 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r2, r0, 24 - movs r7, 0 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r6, r0, r1 - movs r1, 0x8 - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _0813D9E8 - cmp r0, 0x1 - beq _0813DA00 - b _0813DA30 - .pool -_0813D9E8: - movs r0, 0x1 - negs r0, r0 - str r7, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - b _0813DA30 -_0813DA00: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0813DA30 - movs r0, 0x1C - ldrsh r1, [r6, r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - ldrh r4, [r6, 0xC] - ldrb r5, [r6, 0xE] - ldrb r6, [r6, 0x1C] - adds r0, r2, 0 - bl DestroyTask - adds r0, r7, 0 - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl EvolutionScene -_0813DA30: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813D9C0 - - thumb_func_start BeginEvolutionScene -BeginEvolutionScene: @ 813DA40 - push {r4-r6,lr} - adds r4, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =sub_813D9C0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - strh r4, [r1, 0xC] - strh r5, [r1, 0xE] - strh r6, [r1, 0x1C] - ldr r0, =sub_813D9B0 - bl SetMainCallback2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end BeginEvolutionScene - - thumb_func_start EvolutionScene -EvolutionScene: @ 813DA8C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - adds r4, r0, 0 - mov r10, r1 - mov r0, r10 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x18] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x1C] - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - movs r1, 0 - str r1, [sp, 0x14] - add r0, sp, 0x14 - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - bl CpuSet - movs r0, 0x4C - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0 - bl SetGpuReg - movs r0, 0x46 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - bl ResetPaletteFade - ldr r0, =gBattle_BG0_X - movs r2, 0 - strh r2, [r0] - ldr r0, =gBattle_BG0_Y - strh r2, [r0] - ldr r0, =gBattle_BG1_X - strh r2, [r0] - ldr r0, =gBattle_BG1_Y - strh r2, [r0] - ldr r0, =gBattle_BG2_X - strh r2, [r0] - ldr r0, =gBattle_BG2_Y - strh r2, [r0] - ldr r1, =gBattle_BG3_X - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gBattle_BG3_Y - movs r1, 0 - strh r1, [r0] - ldr r1, =gBattleTerrain - movs r0, 0x9 - strb r0, [r1] - bl sub_80356D0 - bl LoadBattleTextboxAndBackground - bl ResetSpriteData - bl remove_some_task - bl ResetTasks - bl FreeAllSpritePalettes - ldr r0, =gReservedSpritePaletteCount - movs r2, 0x4 - strb r2, [r0] - movs r0, 0x64 - bl AllocZeroed - ldr r1, =gUnknown_0203AB80 - str r0, [r1] - bl AllocateMonSpritesGfx - adds r0, r4, 0 - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar1 - mov r1, sp - bl StringCopy10 - ldr r0, =gStringVar2 - movs r1, 0xB - mov r2, r10 - muls r2, r1 - adds r1, r2, 0 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - str r0, [sp, 0x20] - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - mov r9, r0 - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r2, =gMonSpritesGfxPtr - ldr r1, [r2] - ldr r1, [r1, 0x8] - adds r2, r5, 0 - bl DecompressPicFromTable_2 - adds r0, r5, 0 - ldr r1, [sp, 0x20] - mov r2, r9 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x88 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - mov r8, r0 - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB80 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r3, r1, 24 - strb r0, [r2] - ldr r7, =gSprites - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r6, r7, 0 - adds r6, 0x1C - adds r0, r1, r6 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r7 - ldrb r2, [r1, 0x5] - movs r4, 0xF - adds r0, r4, 0 - ands r0, r2 - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - mov r1, r10 - lsls r0, r1, 3 - ldr r2, =gMonFrontPicTable - adds r0, r2 - ldr r2, =gMonSpritesGfxPtr - ldr r1, [r2] - ldr r1, [r1, 0x10] - mov r2, r10 - bl DecompressPicFromTable_2 - mov r0, r10 - ldr r1, [sp, 0x20] - mov r2, r9 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - mov r0, r10 - movs r1, 0x3 - bl sub_806A068 - ldr r0, =gDummySpriteAffineAnimTable - mov r1, r8 - str r0, [r1, 0x10] - mov r0, r8 - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB80 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r3, r1, 24 - strb r0, [r2, 0x1] - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r6, r1, r6 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r6] - adds r1, r7 - ldrb r0, [r1, 0x5] - ands r4, r0 - movs r0, 0x20 - orrs r4, r0 - strb r4, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - bl sub_817BE78 - ldr r0, =evovle_mon_maybe - movs r1, 0 - bl CreateTask - ldr r1, =gUnknown_0203AB80 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r3, r1, 24 - strb r0, [r2, 0x2] - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - strh r2, [r0, 0x8] - strh r5, [r0, 0xA] - mov r1, r10 - strh r1, [r0, 0xC] - mov r2, sp - ldrh r2, [r2, 0x18] - strh r2, [r0, 0xE] - movs r1, 0x1 - strh r1, [r0, 0x10] - movs r1, 0 - strh r1, [r0, 0x1A] - mov r2, sp - ldrh r2, [r2, 0x1C] - strh r2, [r0, 0x1C] - ldr r1, =gUnknown_0203AB80 - ldr r0, [r1] - ldr r1, =gPlttBufferUnfaded + 0x40 - adds r0, 0x4 - movs r2, 0x60 - bl memcpy - movs r1, 0xFA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =nullsub_83 - bl SetHBlankCallback - ldr r0, =sub_813FCDC - bl SetVBlankCallback - bl m4aMPlayAllStop - ldr r0, =sub_813E3A4 - bl SetMainCallback2 - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end EvolutionScene - - thumb_func_start sub_813DD7C -sub_813DD7C: @ 813DD7C - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x8 - ldr r2, =gTasks - ldr r0, =gUnknown_0203AB80 - mov r8, r0 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - adds r4, r2, 0 - muls r4, r1 - ldr r1, =gPlayerParty - adds r4, r1 - ldrh r5, [r0, 0xC] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - mov r9, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r6, r0, 0 - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - movs r4, 0 - str r4, [sp, 0x4] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - add r0, sp, 0x4 - bl CpuSet - movs r0, 0x4C - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0 - bl SetGpuReg - movs r0, 0x46 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - bl ResetPaletteFade - ldr r0, =gBattle_BG0_X - strh r4, [r0] - ldr r0, =gBattle_BG0_Y - strh r4, [r0] - ldr r0, =gBattle_BG1_X - strh r4, [r0] - ldr r0, =gBattle_BG1_Y - strh r4, [r0] - ldr r0, =gBattle_BG2_X - strh r4, [r0] - ldr r0, =gBattle_BG2_Y - strh r4, [r0] - ldr r1, =gBattle_BG3_X - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gBattle_BG3_Y - strh r4, [r0] - ldr r1, =gBattleTerrain - movs r0, 0x9 - strb r0, [r1] - bl sub_80356D0 - bl LoadBattleTextboxAndBackground - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x4 - strb r0, [r1] - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - adds r2, r5, 0 - bl DecompressPicFromTable_2 - adds r0, r5, 0 - mov r1, r9 - adds r2, r6, 0 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0x3 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - mov r2, r8 - ldr r1, [r2] - lsls r2, r0, 24 - lsrs r2, 24 - strb r0, [r1, 0x1] - ldr r3, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - movs r1, 0xFA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =nullsub_83 - bl SetHBlankCallback - ldr r0, =sub_813FCDC - bl SetVBlankCallback - ldr r0, =sub_813E3A4 - bl SetMainCallback2 - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813DD7C - - thumb_func_start sub_813DF70 -sub_813DF70: @ 813DF70 - push {r4-r6,lr} - sub sp, 0xC - ldr r2, =gTasks - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - muls r2, r1 - ldr r1, =gPlayerParty - adds r4, r2, r1 - ldrh r6, [r0, 0xC] - ldr r0, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0x7 - bls _0813DFA2 - b _0813E1C8 -_0813DFA2: - lsls r0, 2 - ldr r1, =_0813DFC0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813DFC0: - .4byte _0813DFE0 - .4byte _0813E050 - .4byte _0813E078 - .4byte _0813E07E - .4byte _0813E0A8 - .4byte _0813E0F0 - .4byte _0813E160 - .4byte _0813E198 -_0813DFE0: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x4 - strb r0, [r1] - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gBattle_BG1_X - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - ldr r2, =gBattle_BG3_X - movs r3, 0x80 - lsls r3, 1 - adds r0, r3, 0 - strh r0, [r2] - ldr r0, =gBattle_BG3_Y - strh r1, [r0] - b _0813E180 - .pool -_0813E050: - bl ResetPaletteFade - ldr r0, =nullsub_83 - bl SetHBlankCallback - ldr r0, =sub_813FD64 - bl SetVBlankCallback - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _0813E188 - .pool -_0813E078: - bl sub_807F19C - b _0813E180 -_0813E07E: - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _0813E188 - .pool -_0813E0A8: - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - adds r5, r0, 0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r4, r0, 0 - lsls r0, r6, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - adds r2, r6, 0 - bl DecompressPicFromTable_2 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - b _0813E180 - .pool -_0813E0F0: - adds r0, r6, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB80 - ldr r1, [r1] - lsls r2, r0, 24 - lsrs r2, 24 - strb r0, [r1, 0x1] - ldr r3, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_807B154 - b _0813E1C8 - .pool -_0813E160: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0813E174 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 -_0813E174: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes -_0813E180: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_0813E188: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0813E1C8 - .pool -_0813E198: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl sub_807B140 - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - ldr r0, =sub_813E3C0 - bl SetMainCallback2 - movs r1, 0x9A - lsls r1, 5 - movs r0, 0 - bl SetGpuReg -_0813E1C8: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813DF70 - - thumb_func_start sub_813E1D4 -sub_813E1D4: @ 813E1D4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar1 - mov r1, sp - bl StringCopy10 - ldr r0, =gStringVar2 - movs r1, 0xB - muls r1, r5 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - ldr r1, =gAffineAnimsDisabled - movs r0, 0x1 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r7, r0, 0 - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - mov r10, r0 - ldr r1, =gUnknown_0203AB80 - mov r9, r1 - movs r0, 0x64 - bl AllocZeroed - mov r2, r9 - str r0, [r2] - movs r4, 0 - strb r6, [r0] - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x8] - adds r2, r5, 0 - bl DecompressPicFromTable_2 - adds r0, r5, 0 - mov r1, r10 - adds r2, r7, 0 - bl sub_806E7CC - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - mov r1, r9 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r6, r1, 24 - strb r0, [r2, 0x1] - ldr r3, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - bl sub_817BE78 - ldr r0, =sub_813F1B8 - movs r1, 0 - bl CreateTask - mov r1, r9 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r6, r1, 24 - strb r0, [r2, 0x2] - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - mov r2, r8 - strh r2, [r0, 0xA] - strh r5, [r0, 0xC] - movs r1, 0x1 - strh r1, [r0, 0x10] - strh r4, [r0, 0x1A] - mov r1, sp - ldrh r1, [r1, 0x14] - strh r1, [r0, 0x1C] - ldr r0, =gBattle_BG0_X - strh r4, [r0] - ldr r0, =gBattle_BG0_Y - strh r4, [r0] - ldr r0, =gBattle_BG1_X - strh r4, [r0] - ldr r0, =gBattle_BG1_Y - strh r4, [r0] - ldr r0, =gBattle_BG2_X - strh r4, [r0] - ldr r0, =gBattle_BG2_Y - strh r4, [r0] - ldr r1, =gBattle_BG3_X - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gBattle_BG3_Y - strh r4, [r0] - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_813FD64 - bl SetVBlankCallback - ldr r0, =sub_813E3C0 - bl SetMainCallback2 - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813E1D4 - - thumb_func_start sub_813E3A4 -sub_813E3A4: @ 813E3A4 - push {lr} - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end sub_813E3A4 - - thumb_func_start sub_813E3C0 -sub_813E3C0: @ 813E3C0 - push {lr} - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end sub_813E3C0 - - thumb_func_start evovle_mon_internal_maybe -evovle_mon_internal_maybe: @ 813E3DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - str r1, [sp, 0x4] - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - movs r0, 0 - str r0, [sp] - mov r0, r10 - lsls r0, 2 - str r0, [sp, 0x8] - add r0, r10 - lsls r7, r0, 3 - ldr r1, =gEvolutionTable - adds r1, r7 - mov r8, r1 - ldrh r0, [r1] - cmp r0, 0xD - beq _0813E40C - b _0813E546 -_0813E40C: - ldr r6, =gPlayerPartyCount - ldrb r0, [r6] - cmp r0, 0x5 - bls _0813E416 - b _0813E546 -_0813E416: - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - mov r9, r0 - ldr r1, [sp, 0x4] - movs r2, 0x64 - bl CopyMon - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - ldr r1, =gEvolutionTable - adds r2, r1, r7 - adds r2, 0xC - movs r1, 0xB - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - mov r1, r8 - ldrh r2, [r1, 0xC] - movs r1, 0xB - muls r2, r1 - ldr r1, =gSpeciesNames - adds r2, r1 - movs r1, 0x2 - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0xC - mov r2, sp - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x8 - mov r2, sp - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0xA - mov r2, sp - bl SetMonData - movs r4, 0x32 - ldr r0, [sp, 0x8] - mov r8, r0 - adds r5, r6, 0 -_0813E484: - ldrb r1, [r5] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - adds r4, 0x1 - cmp r4, 0x36 - ble _0813E484 - movs r4, 0x43 - ldr r7, =gPlayerPartyCount -_0813E4A0: - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - adds r4, 0x1 - cmp r4, 0x4F - ble _0813E4A0 - ldr r4, =gPlayerPartyCount - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x37 - mov r2, sp - bl SetMonData - movs r0, 0xFF - str r0, [sp] - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x40 - mov r2, sp - bl SetMonData - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - bl CalculateMonStats - bl CalculatePlayerPartyCount - ldr r0, =gEvolutionTable - mov r4, r8 - add r4, r10 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - mov r0, r9 - movs r1, 0xB - bl GetMonData - ldr r1, =0x0000012f - cmp r0, r1 - bne _0813E546 - mov r0, r9 - movs r1, 0x3 - bl GetMonData - cmp r0, 0x1 - bne _0813E546 - ldr r0, [sp, 0x4] - movs r1, 0xB - bl GetMonData - movs r1, 0x97 - lsls r1, 1 - cmp r0, r1 - bne _0813E546 - ldr r2, =gUnknown_085B58C4 - mov r0, r9 - movs r1, 0x2 - bl SetMonData -_0813E546: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end evovle_mon_internal_maybe - - thumb_func_start evovle_mon_maybe -evovle_mon_maybe: @ 813E570 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r3, r0, r2 - movs r0, 0x1C - ldrsh r1, [r3, r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - mov r9, r1 - ldr r0, =gMain - ldrh r1, [r0, 0x2C] - adds r5, r2, 0 - adds r6, r0, 0 - cmp r1, 0x2 - bne _0813E5F0 - movs r1, 0x8 - ldrsh r0, [r3, r1] - cmp r0, 0x8 - bne _0813E5F0 - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E5F0 - ldrh r1, [r3, 0xE] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0813E5F0 - movs r0, 0x11 - strh r0, [r3, 0x8] - ldrb r1, [r4, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - strh r2, [r0, 0x18] - bl sub_8140134 - bl _0813F1A4 - .pool -_0813E5F0: - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r0, r5 - movs r2, 0x8 - ldrsh r0, [r0, r2] - mov r8, r1 - cmp r0, 0x16 - bls _0813E606 - bl _0813F1A4 -_0813E606: - lsls r0, 2 - ldr r1, =_0813E614 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813E614: - .4byte _0813E670 - .4byte _0813E6D4 - .4byte _0813E714 - .4byte _0813E740 - .4byte _0813E770 - .4byte _0813E7B0 - .4byte _0813E7E8 - .4byte _0813E828 - .4byte _0813E860 - .4byte _0813E8A4 - .4byte _0813E8C0 - .4byte _0813E8EC - .4byte _0813E918 - .4byte _0813E964 - .4byte _0813E990 - .4byte _0813EA1C - .4byte _0813EAC8 - .4byte _0813EB34 - .4byte _0813EB74 - .4byte _0813EBA8 - .4byte _0813EC10 - .4byte _0813EC6C - .4byte _0813ECA8 -_0813E670: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - bl _0813F1A4 - .pool -_0813E6D4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E6E4 - bl _0813F1A4 -_0813E6E4: - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnIsEvolving - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E714: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813E724 - bl _0813F1A4 -_0813E724: - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r0, [r0] - ldr r1, =gTasks - mov r3, r8 - adds r4, r3, r7 - lsls r4, 3 - adds r4, r1 - b _0813EB90 - .pool -_0813E740: - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813E752 - bl _0813F1A4 -_0813E752: - movs r0, 0xBC - lsls r0, 1 - bl PlaySE - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E770: - bl IsSEPlaying - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0813E780 - bl _0813F1A4 -_0813E780: - ldr r0, =0x00000179 - bl PlayNewMapMusic - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - str r4, [sp] - movs r0, 0x1C - movs r1, 0x4 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl _0813F1A4 - .pool -_0813E7B0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E7C0 - bl _0813F1A4 -_0813E7C0: - movs r0, 0 - bl sub_8140000 - movs r0, 0x11 - bl sub_817BE94 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E7E8: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E7FE - bl _0813F1A4 -_0813E7FE: - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r5 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - ldr r0, =gUnknown_0203AB80 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x3] - bl sub_817BFB4 - strb r0, [r4, 0x2] - bl _0813F1A4 - .pool -_0813E828: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E83E - bl _0813F1A4 -_0813E83E: - ldr r0, =gUnknown_0203AB80 - ldr r1, [r0] - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - bl sub_817C3A0 - strb r0, [r4, 0x2] - mov r0, r8 - adds r1, r0, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E860: - ldr r2, =gUnknown_0203AB80 - ldr r1, [r2] - ldrb r0, [r1, 0x3] - subs r0, 0x1 - strb r0, [r1, 0x3] - lsls r0, 24 - cmp r0, 0 - beq _0813E874 - bl _0813F1A4 -_0813E874: - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1, 0x3] - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813E890 - bl _0813F1A4 -_0813E890: - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E8A4: - bl sub_817C068 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E8C0: - ldr r6, =gBattleCommunication - ldrb r0, [r6, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E8D6 - bl _0813F1A4 -_0813E8D6: - mov r0, r8 - adds r4, r0, r7 - lsls r4, 3 - adds r4, r5 - ldrh r0, [r4, 0xC] - bl sub_817C144 - strb r0, [r6, 0x2] - b _0813EB96 - .pool -_0813E8EC: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813E902 - bl _0813F1A4 -_0813E902: - movs r0, 0x21 - bl PlaySE - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E918: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813E926 - bl _0813F1A4 -_0813E926: - bl m4aMPlayAllStop - ldr r0, =gPlttBufferUnfaded + 0x40 - ldr r1, =gUnknown_0203AB80 - ldr r1, [r1] - adds r1, 0x4 - movs r2, 0x60 - bl memcpy - bl sub_8140174 - movs r0, 0 - str r0, [sp] - movs r0, 0x1C - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E964: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E974 - bl _0813F1A4 -_0813E974: - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - mov r1, r8 - adds r4, r1, r7 - lsls r4, 3 - adds r4, r5 - ldrh r1, [r4, 0xC] - b _0813EB92 - .pool -_0813E990: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813E99E - bl _0813F1A4 -_0813E99E: - ldr r4, =gStringVar4 - ldr r1, =gText_CongratsPkmnEvolved - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_814F9EC - ldr r0, =0x00000173 - bl PlayBGM - ldr r2, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - adds r2, r1 - adds r2, 0xC - mov r0, r9 - movs r1, 0xB - bl SetMonData - mov r0, r9 - bl CalculateMonStats - ldrh r1, [r4, 0xA] - ldrh r2, [r4, 0xC] - mov r0, r9 - bl EvolutionRenameMon - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - movs r0, 0xE - bl IncrementGameStat - b _0813F1A4 - .pool -_0813EA1C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EA2A - b _0813F1A4 -_0813EA2A: - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r4, r0, r1 - ldrb r1, [r4, 0x10] - mov r0, r9 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0 - beq _0813EAA8 - movs r3, 0x1A - ldrsh r5, [r4, r3] - cmp r5, 0 - bne _0813EAA8 - ldrh r1, [r4, 0xE] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0813EA5E - bl StopMapMusic - bl sub_8085784 -_0813EA5E: - ldrh r0, [r4, 0xE] - movs r1, 0x80 - orrs r0, r1 - strh r0, [r4, 0xE] - strh r5, [r4, 0x10] - strh r5, [r4, 0x14] - mov r0, r9 - movs r1, 0x2 - add r2, sp, 0x4 - bl GetMonData - ldr r0, =gBattleTextBuff1 - add r1, sp, 0x4 - bl StringCopy10 - ldr r0, =0x0000ffff - cmp r6, r0 - bne _0813EA94 - movs r0, 0x16 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EA94: - ldr r0, =0x0000fffe - cmp r6, r0 - bne _0813EA9C - b _0813F1A4 -_0813EA9C: - movs r0, 0x14 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EAA8: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813EAC8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _0813EADC - b _0813F1A4 -_0813EADC: - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r4, r0, r5 - ldrh r1, [r4, 0xE] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0813EAF6 - bl StopMapMusic - bl sub_8085784 -_0813EAF6: - movs r1, 0x1A - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0813EB06 - ldrh r0, [r4, 0xA] - mov r1, r9 - bl evovle_mon_internal_maybe -_0813EB06: - adds r0, r7, 0 - bl DestroyTask - bl FreeMonSpritesGfx - ldr r4, =gUnknown_0203AB80 - ldr r0, [r4] - bl Free - str r6, [r4] - bl FreeAllWindowBuffers - ldr r0, =gUnknown_030061E8 - ldr r0, [r0] - bl SetMainCallback2 - b _0813F1A4 - .pool -_0813EB34: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813EB48 - b _0813F1A4 -_0813EB48: - bl m4aMPlayAllStop - ldr r0, =0x0006001c - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813EB74: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EB82 - b _0813F1A4 -_0813EB82: - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r0, [r0] - mov r3, r8 - adds r4, r3, r7 - lsls r4, 3 - adds r4, r5 -_0813EB90: - ldrh r1, [r4, 0xA] -_0813EB92: - bl sub_81401E0 -_0813EB96: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EBA8: - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813EBB8 - b _0813F1A4 -_0813EBB8: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r3, 0x1A - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _0813EBE4 - ldr r0, =gStringVar4 - ldr r1, =gText_EllipsisQuestionMark - bl StringExpandPlaceholders - b _0813EBEC - .pool -_0813EBE4: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnStoppedEvolving - bl StringExpandPlaceholders -_0813EBEC: - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x1A] - b _0813F16E - .pool -_0813EC10: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EC1E - b _0813F1A4 -_0813EC1E: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813EC2A - b _0813F1A4 -_0813EC2A: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =0x0000016f - bl PlayFanfare - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0xC] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x40 - strh r0, [r1, 0x10] -_0813EC52: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0813F1A4 - .pool -_0813EC6C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EC7A - b _0813F1A4 -_0813EC7A: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813EC86 - b _0813F1A4 -_0813EC86: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - cmp r0, 0 - beq _0813EC9E - b _0813F1A4 -_0813EC9E: - movs r0, 0xF - strh r0, [r1, 0x8] - b _0813F1A4 - .pool -_0813ECA8: - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r0, r5 - movs r1, 0x14 - ldrsh r0, [r0, r1] - cmp r0, 0xC - bls _0813ECBA - b _0813F1A4 -_0813ECBA: - lsls r0, 2 - ldr r1, =_0813ECC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813ECC8: - .4byte _0813ECFC - .4byte _0813ED48 - .4byte _0813ED90 - .4byte _0813EDCE - .4byte _0813EE34 - .4byte _0813EF30 - .4byte _0813EF88 - .4byte _0813F05C - .4byte _0813F090 - .4byte _0813F0D8 - .4byte _0813F120 - .4byte _0813F154 - .4byte _0813F180 -_0813ECFC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813ED0A - b _0813F1A4 -_0813ED0A: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813ED16 - b _0813F1A4 -_0813ED16: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x10] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813ED48: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813ED56 - b _0813F1A4 -_0813ED56: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813ED62 - b _0813F1A4 -_0813ED62: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x14] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813ED90: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813EDCE - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813EDCE - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x18] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 - strh r0, [r1, 0x16] - movs r0, 0xA - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x14] - adds r0, 0x1 - strh r0, [r1, 0x14] -_0813EDCE: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EDDC - b _0813F1A4 -_0813EDDC: - bl IsSEPlaying - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0813EDEA - b _0813F1A4 -_0813EDEA: - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - ldr r0, =gText_BattleYesNoChoice - movs r1, 0xC - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x14] - ldr r0, =gBattleCommunication - strb r2, [r0, 0x1] - movs r0, 0 - bl BattleCreateCursorAt - b _0813F1A4 - .pool -_0813EE34: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0813EE5C - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x1] - cmp r0, 0 - beq _0813EE5C - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt - movs r0, 0 - strb r0, [r4, 0x1] - bl BattleCreateCursorAt -_0813EE5C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EE84 - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _0813EE84 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt - movs r0, 0x1 - strb r0, [r4, 0x1] - bl BattleCreateCursorAt -_0813EE84: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0813EEF2 - str r2, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - ldr r0, =gBattleCommunication - ldrb r2, [r0, 0x1] - cmp r2, 0 - beq _0813EECC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x18] - strh r0, [r1, 0x14] - b _0813EEF2 - .pool -_0813EECC: - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x16] - strh r0, [r1, 0x14] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _0813EEF2 - movs r0, 0x1 - negs r0, r0 - str r2, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0813EEF2: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0813EF00 - b _0813F1A4 -_0813EF00: - movs r0, 0x1 - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x18] - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813EF30: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EF3E - b _0813F1A4 -_0813EF3E: - bl FreeAllWindowBuffers - ldr r0, =gPlayerParty - ldr r1, =gTasks - mov r3, r8 - adds r5, r3, r7 - lsls r5, 3 - adds r5, r1 - ldrb r1, [r5, 0x1C] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =sub_813DD7C - ldr r4, =gMoveToLearn - ldrh r4, [r4] - str r4, [sp] - bl sub_81BFA38 - ldrh r0, [r5, 0x14] - adds r0, 0x1 - strh r0, [r5, 0x14] - b _0813F1A4 - .pool -_0813EF88: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EF96 - b _0813F1A4 -_0813EF96: - ldr r1, [r6, 0x4] - ldr r0, =sub_813E3A4 - cmp r1, r0 - beq _0813EFA0 - b _0813F1A4 -_0813EFA0: - bl sub_81C1B94 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bne _0813EFC8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0xA - b _0813F1A2 - .pool -_0813EFC8: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r9 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl IsHMMove2 - cmp r0, 0 - beq _0813F014 - ldr r0, =gBattleStringsTable - ldr r3, =0x000004cc - adds r0, r3 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0xC - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813F014: - ldr r1, =gBattleTextBuff2 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - strb r4, [r1, 0x2] - lsrs r0, r4, 8 - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - lsls r4, r6, 24 - lsrs r4, 24 - mov r0, r9 - adds r1, r4, 0 - bl RemoveMonPPBonus - ldr r0, =gMoveToLearn - ldrh r1, [r0] - mov r0, r9 - adds r2, r4, 0 - bl SetMonMoveSlot - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F05C: - ldr r0, =gBattleStringsTable - movs r1, 0xCF - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F090: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F09E - b _0813F1A4 -_0813F09E: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F0AA - b _0813F1A4 -_0813F0AA: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x1C] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F0D8: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F1A4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F1A4 - ldr r0, =gBattleStringsTable - movs r1, 0xD0 - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x14 - strh r1, [r0, 0x8] - b _0813F1A4 - .pool -_0813F120: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x20] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0xB - strh r1, [r0, 0x16] - strh r2, [r0, 0x18] - movs r1, 0x3 - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813F154: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x24] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 -_0813F16E: - movs r1, 0xF - strh r1, [r0, 0x8] - b _0813F1A4 - .pool -_0813F180: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F1A4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F1A4 - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 -_0813F1A2: - strh r0, [r1, 0x14] -_0813F1A4: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end evovle_mon_maybe - - thumb_func_start sub_813F1B8 -sub_813F1B8: @ 813F1B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r3 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - muls r2, r1 - ldr r1, =gPlayerParty - adds r2, r1 - mov r9, r2 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r5, r3, 0 - cmp r0, 0x14 - bls _0813F1EC - bl _0813FCC4 -_0813F1EC: - lsls r0, 2 - ldr r1, =_0813F204 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813F204: - .4byte _0813F258 - .4byte _0813F284 - .4byte _0813F2AC - .4byte _0813F2DC - .4byte _0813F314 - .4byte _0813F380 - .4byte _0813F3C0 - .4byte _0813F3F0 - .4byte _0813F42C - .4byte _0813F448 - .4byte _0813F474 - .4byte _0813F498 - .4byte _0813F4E4 - .4byte _0813F570 - .4byte _0813F624 - .4byte _0813F668 - .4byte _0813F6D0 - .4byte _0813F704 - .4byte _0813F748 - .4byte _0813F7A4 - .4byte _0813F7E4 -_0813F258: - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnIsEvolving - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F284: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F294 - bl _0813FCC4 -_0813F294: - ldr r0, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0xA] - movs r1, 0 - bl PlayCry1 - b _0813F6F2 - .pool -_0813F2AC: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813F2BA - bl _0813FCC4 -_0813F2BA: - ldr r0, =0x00000179 - bl m4aSongNumStop - movs r0, 0xBC - lsls r0, 1 - bl PlaySE - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F2DC: - bl IsSEPlaying - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _0813F2EC - bl _0813FCC4 -_0813F2EC: - ldr r0, =0x00000179 - bl PlayBGM - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - str r5, [sp] - movs r0, 0x1C - movs r1, 0x4 - b _0813F9C8 - .pool -_0813F314: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813F324 - bl _0813FCC4 -_0813F324: - movs r0, 0x1 - bl sub_8140000 - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - adds r6, r0, 0 - adds r6, 0x10 - adds r0, r6, 0 - bl sub_817BE94 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - ldr r1, =0x00000603 - movs r0, 0xE - bl SetGpuReg - bl _0813FCC4 - .pool -_0813F380: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F396 - bl _0813FCC4 -_0813F396: - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - ldr r0, =gUnknown_0203AB80 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x3] - bl sub_817BFB4 - strb r0, [r4, 0x2] - bl _0813FCC4 - .pool -_0813F3C0: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F3D6 - bl _0813FCC4 -_0813F3D6: - ldr r0, =gUnknown_0203AB80 - ldr r1, [r0] - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - bl sub_817C3A0 - strb r0, [r4, 0x2] - b _0813F6AC - .pool -_0813F3F0: - ldr r2, =gUnknown_0203AB80 - ldr r1, [r2] - ldrb r0, [r1, 0x3] - subs r0, 0x1 - strb r0, [r1, 0x3] - lsls r0, 24 - cmp r0, 0 - beq _0813F404 - bl _0813FCC4 -_0813F404: - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1, 0x3] - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F420 - bl _0813FCC4 -_0813F420: - b _0813F6AC - .pool -_0813F42C: - bl sub_817C068 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F448: - ldr r6, =gBattleCommunication - ldrb r0, [r6, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F45E - bl _0813FCC4 -_0813F45E: - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r5 - ldrh r0, [r4, 0xC] - bl sub_817C280 - strb r0, [r6, 0x2] - b _0813F6F2 - .pool -_0813F474: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F48A - bl _0813FCC4 -_0813F48A: - movs r0, 0x21 - bl PlaySE - b _0813F6AC - .pool -_0813F498: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F4A6 - bl _0813FCC4 -_0813F4A6: - ldr r0, =gUnknown_0203AB84 - ldr r0, [r0] - bl Free - ldr r5, =gUnknown_0203AB80 - ldr r0, [r5] - ldrb r0, [r0, 0x1] - ldr r1, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r1 - ldrh r1, [r4, 0xC] - bl sub_81401E0 - ldr r0, =gPlttBufferUnfaded + 0x40 - ldr r1, [r5] - adds r1, 0x4 - movs r2, 0x60 - bl memcpy - b _0813F6F2 - .pool -_0813F4E4: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813F4F2 - bl _0813FCC4 -_0813F4F2: - ldr r4, =gStringVar4 - ldr r1, =gText_CongratsPkmnEvolved - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =0x00000173 - bl PlayFanfare - ldr r2, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - adds r2, r1 - adds r2, 0xC - mov r0, r9 - movs r1, 0xB - bl SetMonData - mov r0, r9 - bl CalculateMonStats - ldrh r1, [r4, 0xA] - ldrh r2, [r4, 0xC] - mov r0, r9 - bl EvolutionRenameMon - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - movs r0, 0xE - bl IncrementGameStat - b _0813FCC4 - .pool -_0813F570: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F57E - b _0813FCC4 -_0813F57E: - bl IsFanfareTaskInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813F58C - b _0813FCC4 -_0813F58C: - ldr r1, =gTasks - lsls r4, r7, 2 - adds r0, r4, r7 - lsls r0, 3 - adds r5, r0, r1 - ldrb r1, [r5, 0x10] - mov r0, r9 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r6, r0, 16 - mov r8, r4 - cmp r6, 0 - beq _0813F5FC - movs r0, 0x1A - ldrsh r2, [r5, r0] - cmp r2, 0 - bne _0813F5FC - ldrh r1, [r5, 0xE] - movs r0, 0x80 - orrs r0, r1 - strh r0, [r5, 0xE] - strh r2, [r5, 0x10] - strh r2, [r5, 0x14] - mov r0, r9 - movs r1, 0x2 - add r2, sp, 0x4 - bl GetMonData - ldr r0, =gBattleTextBuff1 - add r1, sp, 0x4 - bl StringCopy10 - ldr r0, =0x0000ffff - cmp r6, r0 - bne _0813F5E8 - movs r0, 0x14 - strh r0, [r5, 0x8] - b _0813FCC4 - .pool -_0813F5E8: - ldr r0, =0x0000fffe - cmp r6, r0 - bne _0813F5F0 - b _0813FCC4 -_0813F5F0: - movs r0, 0x12 - strh r0, [r5, 0x8] - b _0813FCC4 - .pool -_0813F5FC: - ldr r0, =0x00000179 - bl PlayBGM - ldr r1, =gText_CommunicationStandby5 - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813F78C - .pool -_0813F624: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _0813F634 - b _0813FCC4 -_0813F634: - adds r0, r7, 0 - bl DestroyTask - ldr r4, =gUnknown_0203AB80 - ldr r0, [r4] - bl Free - str r5, [r4] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =gUnknown_030061E8 - ldr r0, [r0] - bl SetMainCallback2 - b _0813FCC4 - .pool -_0813F668: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F67C - b _0813FCC4 -_0813F67C: - bl m4aMPlayAllStop - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r1, =0x0004001c - orrs r0, r1 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0813F6AC: - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r5 -_0813F6B4: - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813F6D0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813F6DE - b _0813FCC4 -_0813F6DE: - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r0, [r0] - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r5 - ldrh r1, [r4, 0xA] - bl sub_81401E0 -_0813F6F2: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0813FCC4 - .pool -_0813F704: - ldr r0, =gUnknown_0203AB80 - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813F714 - b _0813FCC4 -_0813F714: - ldr r4, =gStringVar4 - ldr r1, =gText_EllipsisQuestionMark - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x1A] - b _0813FC8C - .pool -_0813F748: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F756 - b _0813FCC4 -_0813F756: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F762 - b _0813FCC4 -_0813F762: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =0x0000016f - bl PlayFanfare - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0xC] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x40 - strh r0, [r1, 0x10] -_0813F78C: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0813FCC4 - .pool -_0813F7A4: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F7B2 - b _0813FCC4 -_0813F7B2: - bl IsFanfareTaskInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813F7C0 - b _0813FCC4 -_0813F7C0: - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - cmp r0, 0 - beq _0813F7D8 - b _0813FCC4 -_0813F7D8: - movs r0, 0xD - strh r0, [r1, 0x8] - b _0813FCC4 - .pool -_0813F7E4: - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r0, r5 - movs r2, 0x14 - ldrsh r0, [r0, r2] - mov r8, r1 - cmp r0, 0xB - bls _0813F7F8 - b _0813FCC4 -_0813F7F8: - lsls r0, 2 - ldr r1, =_0813F808 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813F808: - .4byte _0813F838 - .4byte _0813F884 - .4byte _0813F8CC - .4byte _0813F90C - .4byte _0813F96C - .4byte _0813FA24 - .4byte _0813FAA8 - .4byte _0813FBA4 - .4byte _0813FBEC - .4byte _0813FC38 - .4byte _0813FC70 - .4byte _0813FCA0 -_0813F838: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F846 - b _0813FCC4 -_0813F846: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F852 - b _0813FCC4 -_0813F852: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x10] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813F884: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F892 - b _0813FCC4 -_0813F892: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F89E - b _0813FCC4 -_0813F89E: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x14] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813F8CC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F90C - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F90C - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x18] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 - strh r0, [r1, 0x16] - movs r0, 0x9 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x14] - adds r0, 0x1 - strh r0, [r1, 0x14] -_0813F90C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F91A - b _0813FCC4 -_0813F91A: - bl IsSEPlaying - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0813F928 - b _0813FCC4 -_0813F928: - movs r0, 0 - movs r1, 0xA8 - movs r2, 0xE0 - bl sub_809882C - ldr r0, =gUnknown_0833900C - movs r1, 0xA8 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - ldr r3, =gBattleCommunication - strb r4, [r3, 0x1] - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x14] - strb r2, [r3, 0x1] - b _0813FCC4 - .pool -_0813F96C: - bl sub_8198C58 - lsls r0, 24 - asrs r6, r0, 24 - cmp r6, 0 - beq _0813F98C - cmp r6, 0 - bgt _0813F986 - movs r0, 0x1 - negs r0, r0 - cmp r6, r0 - beq _0813F9E4 - b _0813FCC4 -_0813F986: - cmp r6, 0x1 - beq _0813F9E4 - b _0813FCC4 -_0813F98C: - ldr r0, =gBattleCommunication - strb r6, [r0, 0x1] - ldr r0, =gBattleStringsTable - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x16] - strh r1, [r0, 0x14] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x5 - beq _0813F9C0 - b _0813FCC4 -_0813F9C0: - movs r0, 0x1 - negs r0, r0 - str r6, [sp] - movs r1, 0 -_0813F9C8: - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0813FCC4 - .pool -_0813F9E4: - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x1] - ldr r0, =gBattleStringsTable - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x18] - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FA24: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813FA32 - b _0813FCC4 -_0813FA32: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0813FA3E - bl sub_800E084 -_0813FA3E: - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - bl FreeAllWindowBuffers - ldr r0, =gPlayerParty - ldr r1, =gTasks - mov r2, r8 - adds r5, r2, r7 - lsls r5, 3 - adds r5, r1 - ldrb r1, [r5, 0x1C] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =sub_813DF70 - ldr r4, =gMoveToLearn - ldrh r4, [r4] - str r4, [sp] - bl sub_81BFA38 - ldrh r0, [r5, 0x14] - adds r0, 0x1 - strh r0, [r5, 0x14] - b _0813FCC4 - .pool -_0813FAA8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813FAB6 - b _0813FCC4 -_0813FAB6: - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =sub_813E3C0 - cmp r1, r0 - beq _0813FAC2 - b _0813FCC4 -_0813FAC2: - bl sub_81C1B94 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bne _0813FAEC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x9 - b _0813FCC2 - .pool -_0813FAEC: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r9 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl IsHMMove2 - cmp r0, 0 - beq _0813FB3C - ldr r0, =gBattleStringsTable - ldr r1, =0x000004cc - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0xB - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FB3C: - ldr r1, =gBattleTextBuff2 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - strb r4, [r1, 0x2] - lsrs r0, r4, 8 - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - lsls r4, r6, 24 - lsrs r4, 24 - mov r0, r9 - adds r1, r4, 0 - bl RemoveMonPPBonus - ldr r0, =gMoveToLearn - ldrh r1, [r0] - mov r0, r9 - adds r2, r4, 0 - bl SetMonMoveSlot - ldr r0, =gBattleStringsTable - movs r1, 0xCF - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813FBA4: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813FBB2 - b _0813FCC4 -_0813FBB2: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813FBBE - b _0813FCC4 -_0813FBBE: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x1C] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813FBEC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813FCC4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813FCC4 - ldr r0, =gBattleStringsTable - movs r1, 0xD0 - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x12 - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813FC38: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x20] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0xA - strh r1, [r0, 0x16] - strh r2, [r0, 0x18] - movs r1, 0x3 - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FC70: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x24] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 -_0813FC8C: - movs r1, 0xD - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813FCA0: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813FCC4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813FCC4 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 -_0813FCC2: - strh r0, [r1, 0x14] -_0813FCC4: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813F1B8 - - thumb_func_start nullsub_83 -nullsub_83: @ 813FCD8 - bx lr - thumb_func_end nullsub_83 - - thumb_func_start sub_813FCDC -sub_813FCDC: @ 813FCDC - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_80BA0A8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FCDC - - thumb_func_start sub_813FD64 -sub_813FD64: @ 813FD64 - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_80BA0A8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FD64 - - thumb_func_start sub_813FDEC -sub_813FDEC: @ 813FDEC - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r0, 0xC - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _0813FE9A - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0813FE9A - ldrh r1, [r4] - adds r0, r1, 0x1 - strh r0, [r4] - lsls r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_085B58C9 - movs r2, 0x4 - ldrsh r0, [r4, r2] - lsls r2, r0, 2 - adds r0, r3, 0x3 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r1, r0 - ble _0813FE8C - adds r0, r3, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - movs r2, 0x2 - ldrsh r1, [r4, r2] - cmp r0, r1 - bne _0813FE74 - ldrh r0, [r4, 0x6] - adds r0, 0x1 - strh r0, [r4, 0x6] - movs r0, 0x6 - ldrsh r2, [r4, r0] - movs r1, 0x4 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r1, r3, 0x2 - adds r0, r1 - ldrb r0, [r0] - cmp r2, r0 - bne _0813FE5E - strh r5, [r4, 0x6] - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] -_0813FE5E: - movs r2, 0x4 - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0] - b _0813FE8A - .pool -_0813FE74: - ldr r0, =gUnknown_0203AB84 - lsls r1, 5 - ldr r0, [r0] - adds r0, r1 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - strh r5, [r4] - ldrh r0, [r4, 0x2] - adds r0, 0x1 -_0813FE8A: - strh r0, [r4, 0x2] -_0813FE8C: - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bne _0813FE9A - adds r0, r6, 0 - bl DestroyTask -_0813FE9A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FDEC - - thumb_func_start sub_813FEA4 -sub_813FEA4: @ 813FEA4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =sub_813FEE8 - movs r1, 0x7 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 - cmp r4, 0 - bne _0813FED0 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0xC] - b _0813FEDE - .pool -_0813FED0: - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0xC] -_0813FEDE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FEA4 - - thumb_func_start sub_813FEE8 -sub_813FEE8: @ 813FEE8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gBattle_BG1_X - mov r8, r0 - ldr r1, =gBattle_BG1_Y - mov r9, r1 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0xC - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _0813FF28 - ldr r7, =gBattle_BG2_X - ldr r6, =gBattle_BG2_Y - b _0813FF2C - .pool -_0813FF28: - ldr r7, =gBattle_BG3_X - ldr r6, =gBattle_BG3_Y -_0813FF2C: - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x5 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x8] - adds r0, 0x80 - ands r0, r1 - strh r0, [r4, 0xA] - movs r1, 0x8 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Cos - adds r0, 0x8 - mov r2, r8 - strh r0, [r2] - movs r1, 0x8 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Sin - adds r0, 0x10 - mov r2, r9 - strh r0, [r2] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Cos - adds r0, 0x8 - strh r0, [r7] - movs r2, 0xA - ldrsh r0, [r4, r2] - movs r1, 0x4 - bl Sin - adds r0, 0x10 - strh r0, [r6] - ldr r0, =sub_813FDEC - bl FuncIsActiveTask - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0813FFA6 - adds r0, r5, 0 - bl DestroyTask - mov r0, r8 - strh r4, [r0] - mov r1, r9 - strh r4, [r1] - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r7] - strh r4, [r6] -_0813FFA6: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FEE8 - - thumb_func_start sub_813FFC0 -sub_813FFC0: @ 813FFC0 - push {r4-r7,lr} - adds r6, r0, 0 - movs r1, 0 - ldr r5, =gUnknown_085B5884 - ldr r7, =gUnknown_085B58D9 -_0813FFCA: - lsls r0, r1, 4 - adds r4, r1, 0x1 - adds r2, r0, r7 - lsls r0, r1, 5 - adds r1, r0, r6 - movs r3, 0xF -_0813FFD6: - ldrb r0, [r2] - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strh r0, [r1] - adds r2, 0x1 - adds r1, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _0813FFD6 - adds r1, r4, 0 - cmp r1, 0x31 - ble _0813FFCA - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FFC0 - - thumb_func_start sub_8140000 -sub_8140000: @ 8140000 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203AB84 - movs r0, 0xC8 - lsls r0, 3 - bl AllocZeroed - str r0, [r4] - bl sub_813FFC0 - cmp r5, 0 - bne _08140028 - movs r6, 0x1 - movs r4, 0x2 - b _0814002C - .pool -_08140028: - movs r6, 0x1 - movs r4, 0x3 -_0814002C: - ldr r0, =gUnknown_085B51E4 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_085B4134 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl copy_decompressed_tile_data_to_vram_autofree - ldr r1, =gUnknown_085B482C - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gUnknown_085B4D10 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - adds r0, r4, 0 - bl CopyBgTilemapBufferToVram - cmp r5, 0 - bne _081400C4 - ldr r1, =0x00000442 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000808 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xBA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - adds r0, r6, 0 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - adds r0, r4, 0 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - b _081400DE - .pool -_081400C4: - ldr r1, =0x00000842 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000808 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xDA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg -_081400DE: - ldr r0, =sub_813FDEC - movs r1, 0x5 - bl CreateTask - adds r0, r5, 0 - bl sub_813FEA4 - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140000 - - thumb_func_start sub_8140100 -sub_8140100: @ 8140100 - push {lr} - ldr r0, =sub_813FDEC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0814011E - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x14] -_0814011E: - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x20 - bl FillPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140100 - - thumb_func_start sub_8140134 -sub_8140134: @ 8140134 - push {lr} - ldr r0, =sub_813FDEC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08140148 - bl DestroyTask -_08140148: - ldr r0, =sub_813FEE8 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _0814015A - bl DestroyTask -_0814015A: - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x20 - bl FillPalette - bl sub_8140174 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140134 - - thumb_func_start sub_8140174 -sub_8140174: @ 8140174 - push {lr} - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - movs r0, 0x1 - movs r1, 0x5 - bl sub_80391E0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1 - movs r1, 0x7 - bl SetBgAttribute - movs r0, 0x2 - movs r1, 0x5 - bl sub_80391E0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x2 - movs r1, 0x7 - bl SetBgAttribute - movs r1, 0xCA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gUnknown_0203AB84 - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140174 - - thumb_func_start sub_81401E0 -sub_81401E0: @ 81401E0 - push {lr} - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - movs r2, 0 - movs r3, 0 - bl DoMonFrontSpriteAnimation - pop {r0} - bx r0 - .pool - thumb_func_end sub_81401E0 - - thumb_func_start sub_8140208 -sub_8140208: @ 8140208 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r2, 0x1C - adds r1, r2 - ldr r1, [r1] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08140230 - movs r0, 0 - b _08140232 - .pool -_08140230: - movs r0, 0x1 -_08140232: - pop {r1} - bx r1 - thumb_func_end sub_8140208 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/field_effect.s b/asm/field_effect.s index 323e56bfe..964bf8079 100644 --- a/asm/field_effect.s +++ b/asm/field_effect.s @@ -694,7 +694,7 @@ sub_80B5FE8: @ 80B5FE8 lsls r5, 16 lsrs r5, 16 adds r0, r6, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality mov r8, r0 lsls r4, 16 asrs r4, 16 diff --git a/asm/item_menu.s b/asm/item_menu.s index 1e4dfca49..06c0a86ed 100755 --- a/asm/item_menu.s +++ b/asm/item_menu.s @@ -47,14 +47,14 @@ sub_81AABB0: @ 81AABB0 lsls r0, 24 cmp r0, 0 bne _081AABCC - ldr r2, =sub_8059D50 + ldr r2, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 movs r1, 0x5 bl GoToBagMenu b _081AABD4 .pool _081AABCC: - ldr r1, =sub_8059D50 + ldr r1, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 bl sub_81C4F98 _081AABD4: @@ -5634,7 +5634,7 @@ DoWallyTutorialBagMenu: @ 81ADD70 movs r0, 0x4 movs r1, 0x1 bl AddBagItem - ldr r2, =sub_8059D50 + ldr r2, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0xA movs r1, 0 bl GoToBagMenu diff --git a/asm/party_menu.s b/asm/party_menu.s index 9c8f7c449..6b0f92d12 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -13861,7 +13861,7 @@ sub_81B7810: @ 81B7810 cmp r4, 0 beq _081B7860 bl sub_81B06F4 - ldr r0, =gUnknown_030061E8 + ldr r0, =gCB2_AfterEvolution ldr r1, [r6] str r1, [r0] ldrb r3, [r6, 0x9] @@ -14307,7 +14307,7 @@ sub_81B7C74: @ 81B7C74 lsrs r5, r0, 24 movs r0, 0x5 bl PlaySE - ldr r2, =gUnknown_030061E8 + ldr r2, =gCB2_AfterEvolution ldr r1, =gUnknown_0203CEC8 ldr r0, [r1] str r0, [r2] @@ -15908,7 +15908,7 @@ sub_81B89AC: @ 81B89AC str r0, [sp] ldr r0, =sub_81B1370 str r0, [sp, 0x4] - ldr r0, =sub_8059D40 + ldr r0, =SetCB2ToReshowScreenAfterMenu str r0, [sp, 0x8] movs r0, 0x1 adds r2, r4, 0 @@ -16828,7 +16828,7 @@ _081B9136: thumb_func_start sub_81B9140 sub_81B9140: @ 81B9140 push {lr} - ldr r0, =sub_8059D40 + ldr r0, =SetCB2ToReshowScreenAfterMenu bl SetMainCallback2 pop {r0} bx r0 diff --git a/asm/pokeball.s b/asm/pokeball.s index fed227c80..0afd27932 100755 --- a/asm/pokeball.s +++ b/asm/pokeball.s @@ -2685,8 +2685,8 @@ _080769EA: .pool thumb_func_end sub_80769CC - thumb_func_start sub_80769F4 -sub_80769F4: @ 80769F4 + thumb_func_start DoHitAnimHealthboxEffect +DoHitAnimHealthboxEffect: @ 80769F4 push {r4,r5,lr} adds r4, r0, 0 lsls r4, 24 @@ -2714,7 +2714,7 @@ sub_80769F4: @ 80769F4 pop {r0} bx r0 .pool - thumb_func_end sub_80769F4 + thumb_func_end DoHitAnimHealthboxEffect thumb_func_start oamc_804BEB4 oamc_804BEB4: @ 8076A38 diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index 1f8e45f0a..a3047e225 100644 --- a/asm/pokeblock_feed.s +++ b/asm/pokeblock_feed.s @@ -348,7 +348,7 @@ _08179E84: adds r1, r0, 0 adds r0, r5, 0 adds r2, r4, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette ldrh r0, [r4, 0x4] diff --git a/asm/pokedex.s b/asm/pokedex.s index f9ee0eeab..3d69281c2 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -7923,7 +7923,7 @@ _080BF982: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] - bl sub_806F000 + bl PlayerGenderToFrontTrainerPicId lsls r0, 16 lsrs r0, 16 movs r1, 0x98 diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s index a29ecb729..870e658f7 100644 --- a/asm/pokemon_animation.s +++ b/asm/pokemon_animation.s @@ -4,6 +4,100 @@ .syntax unified .text + + + thumb_func_start nullsub_69 +nullsub_69: @ 817F3EC + bx lr + thumb_func_end nullsub_69 + + thumb_func_start sub_817F3F0 +sub_817F3F0: @ 817F3F0 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0x4 + mov r9, r0 + mov r8, r1 + adds r5, r2, 0 + adds r4, r3, 0 + lsls r5, 16 + negs r5, r5 + lsls r4, 16 + negs r4, r4 + lsrs r4, 16 + mov r0, r8 + lsls r0, 16 + asrs r0, 16 + mov r8, r0 + asrs r5, 16 + adds r1, r5, 0 + bl Cos + adds r6, r0, 0 + lsls r4, 16 + asrs r4, 16 + mov r0, r8 + adds r1, r4, 0 + bl Sin + subs r6, r0 + lsls r6, 16 + lsrs r6, 16 + mov r0, r8 + adds r1, r4, 0 + bl Cos + adds r2, r0, 0 + mov r0, r8 + adds r1, r5, 0 + str r2, [sp] + bl Sin + ldr r2, [sp] + adds r2, r0 + negs r5, r5 + negs r4, r4 + lsls r6, 16 + asrs r6, 16 + lsls r5, 16 + asrs r5, 16 + adds r6, r5 + mov r0, r9 + strh r6, [r0, 0x24] + lsls r2, 16 + asrs r2, 16 + lsls r4, 16 + asrs r4, 16 + adds r2, r4 + strh r2, [r0, 0x26] + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_817F3F0 + + thumb_func_start GetSpeciesBackAnimId +GetSpeciesBackAnimId: @ 817F474 + push {lr} + lsls r0, 16 + lsrs r0, 16 + ldr r1, =gUnknown_0860A8C8 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _0817F48C + movs r0, 0 + b _0817F492 + .pool +_0817F48C: + subs r0, 0x1 + lsls r0, 24 + lsrs r0, 24 +_0817F492: + pop {r1} + bx r1 + thumb_func_end GetSpeciesBackAnimId thumb_func_start sub_817F498 sub_817F498: @ 817F498 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index fd2518075..a89c54304 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -1087,7 +1087,7 @@ _081C4750: ldrh r0, [r5, 0x2] ldr r1, [r5, 0x48] ldr r2, [r5, 0xC] - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette ldrh r0, [r4, 0x4] @@ -2035,7 +2035,7 @@ sub_81C4EFC: @ 81C4EFC thumb_func_start sub_81C4F10 sub_81C4F10: @ 81C4F10 push {lr} - ldr r1, =sub_8059D50 + ldr r1, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 bl sub_81C4F98 pop {r0} diff --git a/asm/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/asm/rom6.s b/asm/rom6.s index b729369c8..87b780ba5 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -547,7 +547,7 @@ _081358D4: thumb_func_start sub_81358F4 sub_81358F4: @ 81358F4 push {lr} - ldr r1, =sub_8059D50 + ldr r1, =SetCB2ToReshowScreenAfterMenu2 movs r0, 0x1 bl sub_81357FC pop {r0} diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index 18d7b7fe3..98510dd9e 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -732,7 +732,7 @@ _080F8DD8: adds r0, r6, 0 mov r1, r8 adds r2, r5, 0 - bl sub_806E7CC + bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 bl LoadCompressedObjectPalette adds r0, r6, 0 diff --git a/asm/trade.s b/asm/trade.s index 51b517a0b..ebb624d90 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -10590,7 +10590,7 @@ _0807CEDC: ldrb r0, [r0] movs r1, 0 bl sub_807B4D0 - ldr r1, =gUnknown_030061E8 + ldr r1, =gCB2_AfterEvolution ldr r0, =sub_807B60C str r0, [r1] ldr r7, =gUnknown_02032298 @@ -10615,7 +10615,7 @@ _0807CEDC: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807CF48 .pool _0807CF38: @@ -12695,7 +12695,7 @@ _0807E328: ldrb r0, [r0] movs r1, 0 bl sub_807B4D0 - ldr r1, =gUnknown_030061E8 + ldr r1, =gCB2_AfterEvolution ldr r0, =sub_807B60C str r0, [r1] ldr r7, =gUnknown_02032298 @@ -12720,7 +12720,7 @@ _0807E328: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807E394 .pool _0807E384: @@ -12810,7 +12810,7 @@ _0807E434: b _0807E4B2 .pool _0807E444: - ldr r0, =gUnknown_030061E8 + ldr r0, =gCB2_AfterEvolution ldr r1, =sub_807EB50 mov r8, r1 str r1, [r0] @@ -12836,7 +12836,7 @@ _0807E444: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807E4AE .pool _0807E494: diff --git a/data/battle_anim_815A0D4.s b/data/battle_anim_815A0D4.s index be8439db7..d89a83daf 100644 --- a/data/battle_anim_815A0D4.s +++ b/data/battle_anim_815A0D4.s @@ -3,7 +3,168 @@ .section .rodata + .align 2 +gUnknown_085CE004:: @ 85CE004 + .2byte 0x0000, 0x0004, 0x0010, 0x0004 + .2byte 0x0020, 0x0004, 0x0030, 0x0004 + .2byte 0x0040, 0x0004, 0xffff, 0x0000 + .align 2 +gUnknown_085CE01C:: @ 85CE01C + .4byte gUnknown_085CE004 + + .align 2 +gUnknown_085CE020:: @ 85CE020 + spr_template 0x2799, 0x2799, gUnknown_08524A34, gUnknown_085CE01C, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 + + .align 2 + spr_template 0x2720, 0x2720, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A0D4 + + .align 2 + spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A78AC + + .align 2 +gUnknown_085CE068:: @ 85CE068 + .2byte 0x0000, 0x0028, 0x0010, 0x0008 + .2byte 0x0020, 0x0028, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE078:: @ 85CE078 + .4byte gUnknown_085CE068 + + .align 2 +gUnknown_085CE07C:: @ 85CE07C + spr_template 0x27ce, 0x27ce, gUnknown_08524914, gUnknown_085CE078, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 + + .align 2 + spr_template 0x27cf, 0x27cf, gUnknown_08524A3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A1B0 + + .align 2 + spr_template 0x27cd, 0x27cd, gUnknown_08524974, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A254 + + .align 2 +gUnknown_085CE0C4:: @ 85CE0C4 + .2byte 0x0180, 0x0180, 0x0000, 0x0000 + .2byte 0xffe0, 0x0018, 0x0500, 0x0000 + .2byte 0x0018, 0xffe0, 0x0500, 0x0000 + .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE0E4:: @ 85CE0E4 + .2byte 0x0030, 0x0030, 0x0000, 0x0000 + .2byte 0x0020, 0x0020, 0x0600, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE0FC:: @ 85CE0FC + .4byte gUnknown_085CE0C4 + .4byte gUnknown_085CE0E4 + + .align 2 +gUnknown_085CE104:: @ 85CE104 + spr_template 0x27cb, 0x27cb, gUnknown_08524AFC, gDummySpriteAnimTable, NULL, gUnknown_085CE0FC, sub_815A2F0 + + .align 2 + spr_template 0x27a8, 0x27a8, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A6C4 + + .align 2 +gUnknown_085CE134:: @ 85CE134 + .2byte 0x0000, 0x0003, 0x0010, 0x0003 + .2byte 0x0020, 0x0003, 0x0030, 0x0003 + .2byte 0x0040, 0x0003, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE14C:: @ 85CE14C + .4byte gUnknown_085CE134 + + .align 2 +gUnknown_085CE150:: @ 85CE150 + spr_template 0x272b, 0x272b, gUnknown_08524914, gUnknown_085CE14C, NULL, gDummySpriteAffineAnimTable, sub_815A7B0 + + .align 2 +gUnknown_085CE168:: @ 85CE168 + .2byte 0x0000, 0x0003, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE170:: @ 85CE170 + .4byte gUnknown_085CE168 + + .align 2 +gUnknown_085CE174:: @ 85CE174 + .2byte 0xfff9, 0xfff9, 0x10fd, 0x0000 + .2byte 0x0007, 0x0007, 0x1003, 0x0000 + .2byte 0x7ffe, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE18C:: @ 85CE18C + .4byte gUnknown_085CE174 + + .align 2 +gUnknown_085CE190:: @ 85CE190 + spr_template 0x27f4, 0x27f4, gUnknown_08524974, gUnknown_085CE170, NULL, gUnknown_085CE18C, sub_815A7EC + + .align 2 +gUnknown_085CE1A8:: @ 85CE1A8 + .2byte 0x0000, 0x0008, 0x0010, 0x0010, 0x0020, 0x0004, 0x0030, 0x0004, 0xffff, 0x0000 + + .align 2 +gUnknown_085CE1BC:: @ 85CE1BC + .4byte gUnknown_085CE1A8 + + .align 2 +gUnknown_085CE1C0:: @ 85CE1C0 + .2byte 0x0200, 0x0200, 0x0000, 0x0000 + .2byte 0xffe0, 0xffe0, 0x0800, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE1D8:: @ 85CE1D8 + .4byte gUnknown_085CE1C0 + + .align 2 +gUnknown_085CE1DC:: @ 85CE1DC + spr_template 0x27d0, 0x27d0, gUnknown_085249D4, gUnknown_085CE1BC, NULL, gUnknown_085CE1D8, sub_815A8AC + + .align 2 +gUnknown_085CE1F4:: @ 85CE1F4 + .2byte 0x0000, 0x0180, 0x0000, 0x0000 + .2byte 0x0010, 0x0000, 0x1400, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE20C:: @ 85CE20C + .2byte 0x0140, 0x0180, 0x0000, 0x0000 + .2byte 0xfff0, 0x0000, 0x1300, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gUnknown_085CE224:: @ 85CE224 + .4byte gUnknown_085CE1F4 + .4byte gUnknown_085CE20C + + .align 2 +gUnknown_085CE22C:: @ 85CE22C + spr_template 0x27f3, 0x27f3, gUnknown_085249DC, gDummySpriteAnimTable, NULL, gUnknown_085CE224, sub_815A934 + + .align 2 + spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815AAA4 + + .align 2 + spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815ABD0 + + .align 2 +gUnknown_085CE274:: @ 85CE274 + .2byte 0x0000, 0x0002, 0x0008, 0x0002 + .2byte 0x0010, 0x0002, 0xfffe, 0x0000 + + .align 2 +gUnknown_085CE284:: @ 85CE284 + .4byte gUnknown_085CE274 + + .align 2 +gUnknown_085CE288:: @ 85CE288 + spr_template 0x27f5, 0x27f5, gUnknown_08524934, gUnknown_085CE284, NULL, gDummySpriteAffineAnimTable, sub_815ACD0 + gUnknown_085CE2A0:: @ 85CE2A0 .incbin "baserom.gba", 0x5ce2a0, 0xb0 diff --git a/data/battle_controller_link_opponent.s b/data/battle_controller_link_opponent.s deleted file mode 100644 index ff6c7023b..000000000 --- a/data/battle_controller_link_opponent.s +++ /dev/null @@ -1,64 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gLinkOpponentBufferCommands:: @ 831C7B4 - .4byte dp01t_00_2_getattr - .4byte sub_8065900 - .4byte sub_806590C - .4byte sub_8066284 - .4byte sub_80662F8 - .4byte sub_8066448 - .4byte sub_8066624 - .4byte sub_8066748 - .4byte sub_8066A58 - .4byte sub_8066B94 - .4byte sub_8066C40 - .4byte sub_8066CEC - .4byte sub_8066CF8 - .4byte sub_8066D04 - .4byte sub_8066D10 - .4byte sub_8066D1C - .4byte sub_8066FF4 - .4byte sub_806704C - .4byte sub_8067058 - .4byte sub_8067064 - .4byte sub_8067070 - .4byte sub_806707C - .4byte sub_8067088 - .4byte sub_8067094 - .4byte sub_80670A0 - .4byte sub_8067190 - .4byte sub_806719C - .4byte sub_8067214 - .4byte sub_806727C - .4byte sub_8067288 - .4byte sub_8067294 - .4byte sub_80672A0 - .4byte sub_80672AC - .4byte sub_80672B8 - .4byte sub_80672C4 - .4byte sub_80672D0 - .4byte sub_80672DC - .4byte sub_80672E8 - .4byte sub_8067304 - .4byte sub_806733C - .4byte sub_8067354 - .4byte sub_806737C - .4byte sub_80673EC - .4byte sub_80673F8 - .4byte sub_806743C - .4byte sub_8067498 - .4byte sub_80674D4 - .4byte sub_8067508 - .4byte sub_8067718 - .4byte sub_8067874 - .4byte sub_80678C4 - .4byte sub_80678D0 - .4byte sub_8067930 - .4byte sub_80679A4 - .4byte sub_80679C4 - .4byte sub_80679D0 - .4byte nullsub_92 diff --git a/data/battle_controller_link_partner.s b/data/battle_controller_link_partner.s deleted file mode 100644 index 1990ad870..000000000 --- a/data/battle_controller_link_partner.s +++ /dev/null @@ -1,65 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gLinkPartnerBufferCommands:: @ 85C9A94 - .4byte dp01t_00_4_getattr - .4byte sub_814C038 - .4byte sub_814C044 - .4byte sub_814CA98 - .4byte sub_814CB0C - .4byte sub_814CC28 - .4byte sub_814CE14 - .4byte sub_814CF30 - .4byte sub_814D0E4 - .4byte sub_814D0F0 - .4byte sub_814D19C - .4byte sub_814D288 - .4byte sub_814D294 - .4byte sub_814D2A0 - .4byte sub_814D2AC - .4byte sub_814D2B8 - .4byte sub_814D590 - .4byte sub_814D5E8 - .4byte sub_814D5F4 - .4byte sub_814D600 - .4byte sub_814D60C - .4byte sub_814D618 - .4byte sub_814D624 - .4byte sub_814D630 - .4byte sub_814D63C - .4byte sub_814D72C - .4byte sub_814D738 - .4byte sub_814D7B0 - .4byte sub_814D818 - .4byte sub_814D824 - .4byte sub_814D830 - .4byte sub_814D83C - .4byte sub_814D848 - .4byte sub_814D854 - .4byte sub_814D860 - .4byte sub_814D86C - .4byte sub_814D878 - .4byte sub_814D884 - .4byte sub_814D8A0 - .4byte sub_814D8D8 - .4byte sub_814D8F0 - .4byte dp01t_29_4_blink - .4byte sub_814D988 - .4byte sub_814D994 - .4byte sub_814D9D8 - .4byte sub_814DA34 - .4byte dp01t_2E_4_battle_intro - .4byte sub_814DAA8 - .4byte sub_814DDD8 - .4byte sub_814DEE4 - .4byte sub_814DF34 - .4byte sub_814DF40 - .4byte sub_814DFA0 - .4byte sub_814E014 - .4byte sub_814E034 - .4byte sub_814E040 - .4byte nullsub_113 - diff --git a/data/battle_controller_opponent.s b/data/battle_controller_opponent.s deleted file mode 100644 index 3b7acd003..000000000 --- a/data/battle_controller_opponent.s +++ /dev/null @@ -1,67 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gOpponentBufferCommands:: @ 831C6C8 - .4byte dp01t_00_7_getattr - .4byte dp01t_01_2_read_pokmon_data_slice - .4byte dp01t_02_7_setattr - .4byte sub_80611B0 - .4byte sub_8061224 - .4byte sub_806137C - .4byte sub_806156C - .4byte sub_8061690 - .4byte sub_80618D8 - .4byte sub_8061AF0 - .4byte sub_8061B9C - .4byte sub_8061C48 - .4byte sub_8061C54 - .4byte sub_8061C60 - .4byte sub_8061C6C - .4byte sub_8061C78 - .4byte sub_8061F34 - .4byte sub_8061F90 - .4byte sub_8061F9C - .4byte sub_8061FAC - .4byte sub_8061FB8 - .4byte sub_806215C - .4byte sub_8062188 - .4byte sub_8062288 - .4byte sub_8062294 - .4byte sub_8062384 - .4byte sub_8062390 - .4byte sub_8062408 - .4byte sub_8062470 - .4byte sub_806247C - .4byte sub_8062488 - .4byte sub_8062494 - .4byte sub_80624A0 - .4byte sub_80624AC - .4byte sub_80624B8 - .4byte sub_80624C4 - .4byte sub_80624D0 - .4byte sub_80624DC - .4byte sub_80624F8 - .4byte sub_8062530 - .4byte sub_8062548 - .4byte dp01t_29_7_blink - .4byte sub_80625E0 - .4byte sub_80625EC - .4byte sub_8062630 - .4byte sub_806268C - .4byte dp01t_2E_7_battle_intro - .4byte sub_80626FC - .4byte dp01t_30_7_0803D67C - .4byte sub_8062A74 - .4byte sub_8062AC4 - .4byte sub_8062AD0 - .4byte dp01t_34_7_move_anim_start_t3 - .4byte sub_8062B98 - .4byte sub_8062BA4 - .4byte sub_8062BB0 - .4byte nullsub_91 - - .align 2 - .byte 0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20 diff --git a/data/battle_controller_player.s b/data/battle_controller_player.s deleted file mode 100644 index bc2a18edb..000000000 --- a/data/battle_controller_player.s +++ /dev/null @@ -1,69 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gPlayerBufferCommands:: @ 831C514 - .4byte dp01t_00_1_getattr - .4byte sub_805A614 - .4byte dp01t_02_1_setattr - .4byte sub_805B0F0 - .4byte sub_805B164 - .4byte sub_805B1CC - .4byte sub_805B3D4 - .4byte sub_805B4F0 - .4byte dp01t_08_1_8032428 - .4byte sub_805B9F8 - .4byte sub_805BAB8 - .4byte sub_805BBA4 - .4byte sub_805BBC4 - .4byte sub_805BC18 - .4byte sub_805BC78 - .4byte dp01t_0F_1_move_anim - .4byte sub_805BF80 - .4byte dp01t_11_1_message_for_player_only - .4byte dp01t_12_6_battle_menu - .4byte sub_805C0B0 - .4byte dp01t_14_5_move_menu_pokedude - .4byte sub_805C248 - .4byte sub_805C2AC - .4byte sub_805C3EC - .4byte sub_805C410 - .4byte sub_805C528 - .4byte sub_805C5C4 - .4byte sub_805C63C - .4byte sub_805C6A4 - .4byte sub_805C710 - .4byte sub_805C71C - .4byte sub_805C7D0 - .4byte sub_805C800 - .4byte sub_805C80C - .4byte sub_805C820 - .4byte sub_805C834 - .4byte sub_805C848 - .4byte sub_805C85C - .4byte sub_805C878 - .4byte sub_805C8B0 - .4byte sub_805C8C8 - .4byte dp01t_29_1_blink - .4byte sub_805C960 - .4byte sub_805C96C - .4byte sub_805C9B0 - .4byte sub_805CA0C - .4byte dp01t_2E_1_battle_intro - .4byte dp01t_2F_1_pokemon_enter - .4byte sub_805CD74 - .4byte sub_805CE80 - .4byte sub_805CED0 - .4byte dp01t_33_1_enemy_move - .4byte sub_805CF54 - .4byte dp01t_35_1_link_standby_message_and_free_vram - .4byte sub_805D02C - .4byte sub_805D094 - .4byte nullsub_22 - - .align 2 -gUnknown_0831C5F8:: @ 831C5F8 - .byte 0x00, 0x02, 0x03, 0x01, 0x48, 0x48, 0x20, 0x5a - .byte 0x50, 0x50, 0x50, 0x58 diff --git a/data/battle_controller_player_partner.s b/data/battle_controller_player_partner.s deleted file mode 100644 index 35d78ebe0..000000000 --- a/data/battle_controller_player_partner.s +++ /dev/null @@ -1,71 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gPlayerPartnerBufferCommands:: @ 8617170 - .4byte dp01t_00_3_getattr - .4byte sub_81BC484 - .4byte sub_81BC490 - .4byte sub_81BCEE4 - .4byte sub_81BCF58 - .4byte sub_81BD074 - .4byte sub_81BD260 - .4byte sub_81BD37C - .4byte sub_81BD5BC - .4byte sub_81BD5C8 - .4byte sub_81BD674 - .4byte sub_81BD760 - .4byte sub_81BD76C - .4byte sub_81BD778 - .4byte sub_81BD784 - .4byte sub_81BD790 - .4byte sub_81BDA4C - .4byte sub_81BDAA0 - .4byte sub_81BDAAC - .4byte sub_81BDABC - .4byte sub_81BDAC8 - .4byte sub_81BDB70 - .4byte sub_81BDB7C - .4byte sub_81BDC04 - .4byte sub_81BDC10 - .4byte sub_81BDD00 - .4byte sub_81BDD9C - .4byte sub_81BDE14 - .4byte sub_81BDE7C - .4byte sub_81BDE88 - .4byte sub_81BDE94 - .4byte sub_81BDEA0 - .4byte sub_81BDEAC - .4byte sub_81BDEB8 - .4byte sub_81BDEC4 - .4byte sub_81BDED0 - .4byte sub_81BDEDC - .4byte sub_81BDEE8 - .4byte sub_81BDF04 - .4byte sub_81BDF3C - .4byte sub_81BDF54 - .4byte dp01t_29_3_blink - .4byte sub_81BDFEC - .4byte sub_81BDFF8 - .4byte sub_81BE03C - .4byte sub_81BE098 - .4byte dp01t_2E_3_battle_intro - .4byte sub_81BE10C - .4byte dp01t_30_3_80EB11C - .4byte sub_81BE4E0 - .4byte sub_81BE530 - .4byte sub_81BE53C - .4byte sub_81BE59C - .4byte sub_81BE604 - .4byte sub_81BE610 - .4byte sub_81BE61C - .4byte nullsub_128 - - .align 2 - @ apparently unused data - .byte 0x83, 0x4d, 0xf3, 0x5f, 0x6f, 0x4f, 0xeb, 0x3e - .byte 0x67, 0x2e, 0x10, 0x46, 0x8c, 0x3d, 0x28, 0x35 - .byte 0xc5, 0x2c, 0x15, 0x7f, 0xb5, 0x56, 0x9d, 0x53 - .byte 0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53 diff --git a/data/battle_controller_recorded_opponent.s b/data/battle_controller_recorded_opponent.s deleted file mode 100644 index 8baa57022..000000000 --- a/data/battle_controller_recorded_opponent.s +++ /dev/null @@ -1,65 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gRecordedOpponentBufferCommands:: @ 860AE90 - .4byte sub_8187224 - .4byte sub_8187A44 - .4byte sub_8187A50 - .4byte sub_81883C8 - .4byte sub_818843C - .4byte sub_818858C - .4byte sub_8188768 - .4byte sub_818888C - .4byte sub_8188A40 - .4byte sub_8188A4C - .4byte sub_8188AF8 - .4byte sub_8188BA4 - .4byte sub_8188BB0 - .4byte sub_8188BBC - .4byte sub_8188BC8 - .4byte sub_8188BD4 - .4byte sub_8188E90 - .4byte sub_8188EE4 - .4byte sub_8188EF0 - .4byte sub_8188F14 - .4byte sub_8188F20 - .4byte sub_8188F7C - .4byte sub_8188F88 - .4byte sub_8188FC4 - .4byte sub_8188FD0 - .4byte sub_81890C0 - .4byte sub_81890CC - .4byte sub_8189144 - .4byte sub_81891AC - .4byte sub_81891B8 - .4byte sub_81891C4 - .4byte sub_81891D0 - .4byte sub_81891DC - .4byte sub_81891E8 - .4byte sub_81891F4 - .4byte sub_8189200 - .4byte sub_818920C - .4byte sub_8189218 - .4byte sub_8189234 - .4byte sub_818926C - .4byte sub_8189284 - .4byte sub_81892AC - .4byte sub_818931C - .4byte sub_8189328 - .4byte sub_818936C - .4byte sub_81893C8 - .4byte sub_8189404 - .4byte sub_8189438 - .4byte sub_8189648 - .4byte sub_81897A4 - .4byte sub_81897F4 - .4byte sub_8189800 - .4byte sub_8189860 - .4byte sub_81898C8 - .4byte sub_81898D4 - .4byte sub_81898E0 - .4byte nullsub_119 - diff --git a/data/battle_controller_recorded_player.s b/data/battle_controller_recorded_player.s deleted file mode 100644 index 089e4dcbf..000000000 --- a/data/battle_controller_recorded_player.s +++ /dev/null @@ -1,64 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gRecordedPlayerBufferCommands:: @ 860AF74 - .4byte sub_818A5EC - .4byte sub_818AE0C - .4byte sub_818AE18 - .4byte sub_818B86C - .4byte sub_818B8E0 - .4byte sub_818B9FC - .4byte sub_818BBE8 - .4byte sub_818BD04 - .4byte sub_818BFAC - .4byte sub_818BFB8 - .4byte sub_818C064 - .4byte sub_818C150 - .4byte sub_818C15C - .4byte sub_818C168 - .4byte sub_818C174 - .4byte sub_818C180 - .4byte sub_818C43C - .4byte sub_818C490 - .4byte sub_818C4D8 - .4byte sub_818C52C - .4byte sub_818C538 - .4byte sub_818C594 - .4byte sub_818C5A0 - .4byte sub_818C5DC - .4byte sub_818C5E8 - .4byte sub_818C6E8 - .4byte sub_818C6F4 - .4byte sub_818C76C - .4byte sub_818C7D4 - .4byte sub_818C7E0 - .4byte sub_818C7EC - .4byte sub_818C7F8 - .4byte sub_818C804 - .4byte sub_818C810 - .4byte sub_818C81C - .4byte sub_818C828 - .4byte sub_818C834 - .4byte sub_818C840 - .4byte sub_818C85C - .4byte sub_818C894 - .4byte sub_818C8AC - .4byte sub_818C8D4 - .4byte sub_818C944 - .4byte sub_818C950 - .4byte sub_818C994 - .4byte sub_818C9F0 - .4byte dp01t_2E_2_battle_intro - .4byte sub_818CA64 - .4byte sub_818CD30 - .4byte sub_818CE3C - .4byte sub_818CE8C - .4byte sub_818CE98 - .4byte sub_818CEF8 - .4byte sub_818CF60 - .4byte sub_818CF6C - .4byte sub_818CF78 - .4byte nullsub_121 diff --git a/data/battle_controller_safari.s b/data/battle_controller_safari.s deleted file mode 100644 index 39d1d0de3..000000000 --- a/data/battle_controller_safari.s +++ /dev/null @@ -1,228 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gSafariBufferCommands:: @ 85CDF20 - .4byte sub_81597AC - .4byte sub_81597B8 - .4byte sub_81597C4 - .4byte sub_81597D0 - .4byte sub_81597DC - .4byte sub_81597E8 - .4byte sub_81597F4 - .4byte sub_8159800 - .4byte sub_81598E0 - .4byte sub_81598EC - .4byte sub_81598F8 - .4byte sub_8159904 - .4byte sub_8159910 - .4byte sub_8159964 - .4byte sub_81599C4 - .4byte sub_81599D0 - .4byte dp01t_10_6_message - .4byte dp01t_11_6_message_for_player_only - .4byte sub_8159A94 - .4byte sub_8159AFC - .4byte sub_8159B08 - .4byte sub_8159B14 - .4byte sub_8159B54 - .4byte sub_8159B60 - .4byte sub_8159B6C - .4byte sub_8159B78 - .4byte sub_8159B84 - .4byte sub_8159BC0 - .4byte sub_8159BCC - .4byte sub_8159BD8 - .4byte sub_8159BE4 - .4byte sub_8159BF0 - .4byte sub_8159BFC - .4byte sub_8159C08 - .4byte sub_8159C14 - .4byte sub_8159C20 - .4byte sub_8159C2C - .4byte sub_8159C38 - .4byte sub_8159C44 - .4byte sub_8159C50 - .4byte sub_8159C5C - .4byte sub_8159C68 - .4byte sub_8159C74 - .4byte sub_8159C80 - .4byte dp01t_34_6_move_anim_start_t3 - .4byte sub_8159D20 - .4byte dp01t_2E_6_battle_intro - .4byte sub_8159D90 - .4byte sub_8159DEC - .4byte sub_8159DF8 - .4byte sub_8159E04 - .4byte sub_8159E10 - .4byte sub_8159E1C - .4byte sub_8159E78 - .4byte sub_8159E84 - .4byte sub_8159E90 - .4byte nullsub_115 - - .align 2 -gUnknown_085CE004:: @ 85CE004 - .2byte 0x0000, 0x0004, 0x0010, 0x0004 - .2byte 0x0020, 0x0004, 0x0030, 0x0004 - .2byte 0x0040, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE01C:: @ 85CE01C - .4byte gUnknown_085CE004 - - .align 2 -gUnknown_085CE020:: @ 85CE020 - spr_template 0x2799, 0x2799, gUnknown_08524A34, gUnknown_085CE01C, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 - - .align 2 - spr_template 0x2720, 0x2720, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A0D4 - - .align 2 - spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A78AC - - .align 2 -gUnknown_085CE068:: @ 85CE068 - .2byte 0x0000, 0x0028, 0x0010, 0x0008 - .2byte 0x0020, 0x0028, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE078:: @ 85CE078 - .4byte gUnknown_085CE068 - - .align 2 -gUnknown_085CE07C:: @ 85CE07C - spr_template 0x27ce, 0x27ce, gUnknown_08524914, gUnknown_085CE078, NULL, gDummySpriteAffineAnimTable, sub_80A77C8 - - .align 2 - spr_template 0x27cf, 0x27cf, gUnknown_08524A3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A1B0 - - .align 2 - spr_template 0x27cd, 0x27cd, gUnknown_08524974, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A254 - - .align 2 -gUnknown_085CE0C4:: @ 85CE0C4 - .2byte 0x0180, 0x0180, 0x0000, 0x0000 - .2byte 0xffe0, 0x0018, 0x0500, 0x0000 - .2byte 0x0018, 0xffe0, 0x0500, 0x0000 - .2byte 0x7ffe, 0x0001, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE0E4:: @ 85CE0E4 - .2byte 0x0030, 0x0030, 0x0000, 0x0000 - .2byte 0x0020, 0x0020, 0x0600, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE0FC:: @ 85CE0FC - .4byte gUnknown_085CE0C4 - .4byte gUnknown_085CE0E4 - - .align 2 -gUnknown_085CE104:: @ 85CE104 - spr_template 0x27cb, 0x27cb, gUnknown_08524AFC, gDummySpriteAnimTable, NULL, gUnknown_085CE0FC, sub_815A2F0 - - .align 2 - spr_template 0x27a8, 0x27a8, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815A6C4 - - .align 2 -gUnknown_085CE134:: @ 85CE134 - .2byte 0x0000, 0x0003, 0x0010, 0x0003 - .2byte 0x0020, 0x0003, 0x0030, 0x0003 - .2byte 0x0040, 0x0003, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE14C:: @ 85CE14C - .4byte gUnknown_085CE134 - - .align 2 -gUnknown_085CE150:: @ 85CE150 - spr_template 0x272b, 0x272b, gUnknown_08524914, gUnknown_085CE14C, NULL, gDummySpriteAffineAnimTable, sub_815A7B0 - - .align 2 -gUnknown_085CE168:: @ 85CE168 - .2byte 0x0000, 0x0003, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE170:: @ 85CE170 - .4byte gUnknown_085CE168 - - .align 2 -gUnknown_085CE174:: @ 85CE174 - .2byte 0xfff9, 0xfff9, 0x10fd, 0x0000 - .2byte 0x0007, 0x0007, 0x1003, 0x0000 - .2byte 0x7ffe, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE18C:: @ 85CE18C - .4byte gUnknown_085CE174 - - .align 2 -gUnknown_085CE190:: @ 85CE190 - spr_template 0x27f4, 0x27f4, gUnknown_08524974, gUnknown_085CE170, NULL, gUnknown_085CE18C, sub_815A7EC - - .align 2 -gUnknown_085CE1A8:: @ 85CE1A8 - .2byte 0x0000, 0x0008, 0x0010, 0x0010, 0x0020, 0x0004, 0x0030, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085CE1BC:: @ 85CE1BC - .4byte gUnknown_085CE1A8 - - .align 2 -gUnknown_085CE1C0:: @ 85CE1C0 - .2byte 0x0200, 0x0200, 0x0000, 0x0000 - .2byte 0xffe0, 0xffe0, 0x0800, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE1D8:: @ 85CE1D8 - .4byte gUnknown_085CE1C0 - - .align 2 -gUnknown_085CE1DC:: @ 85CE1DC - spr_template 0x27d0, 0x27d0, gUnknown_085249D4, gUnknown_085CE1BC, NULL, gUnknown_085CE1D8, sub_815A8AC - - .align 2 -gUnknown_085CE1F4:: @ 85CE1F4 - .2byte 0x0000, 0x0180, 0x0000, 0x0000 - .2byte 0x0010, 0x0000, 0x1400, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE20C:: @ 85CE20C - .2byte 0x0140, 0x0180, 0x0000, 0x0000 - .2byte 0xfff0, 0x0000, 0x1300, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085CE224:: @ 85CE224 - .4byte gUnknown_085CE1F4 - .4byte gUnknown_085CE20C - - .align 2 -gUnknown_085CE22C:: @ 85CE22C - spr_template 0x27f3, 0x27f3, gUnknown_085249DC, gDummySpriteAnimTable, NULL, gUnknown_085CE224, sub_815A934 - - .align 2 - spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815AAA4 - - .align 2 - spr_template 0x2807, 0x2807, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_815ABD0 - - .align 2 -gUnknown_085CE274:: @ 85CE274 - .2byte 0x0000, 0x0002, 0x0008, 0x0002 - .2byte 0x0010, 0x0002, 0xfffe, 0x0000 - - .align 2 -gUnknown_085CE284:: @ 85CE284 - .4byte gUnknown_085CE274 - - .align 2 -gUnknown_085CE288:: @ 85CE288 - spr_template 0x27f5, 0x27f5, gUnknown_08524934, gUnknown_085CE284, NULL, gDummySpriteAffineAnimTable, sub_815ACD0 - - diff --git a/data/battle_controller_wally.s b/data/battle_controller_wally.s deleted file mode 100644 index 96d34d4a5..000000000 --- a/data/battle_controller_wally.s +++ /dev/null @@ -1,64 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gWallyBufferCommands:: @ 85DFDC0 - .4byte dp01t_00_5_getattr - .4byte sub_81693C0 - .4byte sub_81693CC - .4byte sub_8169E20 - .4byte sub_8169E2C - .4byte sub_8169E38 - .4byte sub_8169E44 - .4byte sub_8169EC8 - .4byte dp01t_07_6_ - .4byte sub_816A060 - .4byte sub_816A06C - .4byte sub_816A078 - .4byte sub_816A084 - .4byte sub_816A0D8 - .4byte sub_816A138 - .4byte sub_816A144 - .4byte sub_816A3B8 - .4byte dp01t_11_5_message_for_player_only - .4byte dp01t_12_1_battle_menu - .4byte sub_816A4D8 - .4byte sub_816A4E4 - .4byte sub_816A57C - .4byte sub_816A5BC - .4byte sub_816A5C8 - .4byte sub_816A5D4 - .4byte sub_816A6D4 - .4byte sub_816A6E0 - .4byte sub_816A6EC - .4byte sub_816A6F8 - .4byte sub_816A704 - .4byte sub_816A710 - .4byte sub_816A71C - .4byte sub_816A728 - .4byte sub_816A734 - .4byte sub_816A740 - .4byte sub_816A74C - .4byte sub_816A758 - .4byte sub_816A764 - .4byte sub_816A770 - .4byte sub_816A77C - .4byte sub_816A788 - .4byte sub_816A794 - .4byte sub_816A804 - .4byte sub_816A810 - .4byte sub_816A840 - .4byte sub_816A89C - .4byte dp01t_2E_5_battle_intro - .4byte sub_816A90C - .4byte sub_816AC78 - .4byte sub_816ACFC - .4byte sub_816AD08 - .4byte sub_816AD14 - .4byte sub_816AD20 - .4byte sub_816AD7C - .4byte sub_816AD88 - .4byte sub_816AD94 - .4byte nullsub_118 diff --git a/data/data4.s b/data/data4.s index d99336e87..e98518b73 100644 --- a/data/data4.s +++ b/data/data4.s @@ -410,7 +410,7 @@ gUnknown_085B51E4:: @ 85B51E4 gUnknown_085B5884:: @ 85B5884 .incbin "baserom.gba", 0x5b5884, 0x40 -gUnknown_085B58C4:: @ 85B58C4 +gText_ShedinjaJapaneseName2:: @ 85B58C4 .incbin "baserom.gba", 0x5b58c4, 0x5 gUnknown_085B58C9:: @ 85B58C9 diff --git a/data/evolution_graphics.s b/data/evolution_graphics.s deleted file mode 100644 index d6ad2e578..000000000 --- a/data/evolution_graphics.s +++ /dev/null @@ -1,18 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .incbin "baserom.gba", 0x5f53cc, 0x40 - -gUnknown_085F540C:: @ 85F540C - .incbin "baserom.gba", 0x5f540c, 0x10 - -gUnknown_085F541C:: @ 85F541C - .incbin "baserom.gba", 0x5f541c, 0x24 - -gUnknown_085F5440:: @ 85F5440 - .incbin "baserom.gba", 0x5f5440, 0x18 - -gUnknown_085F5458:: @ 85F5458 - .incbin "baserom.gba", 0x5f5458, 0x38 diff --git a/graphics/misc/evo_sparkle.pal b/graphics/misc/evo_sparkle.pal new file mode 100644 index 000000000..7ccbffd1d --- /dev/null +++ b/graphics/misc/evo_sparkle.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +49 82 82 +82 106 106 +106 131 131 +139 156 156 +164 180 180 +197 205 205 +222 230 230 +255 255 255 diff --git a/graphics/misc/evo_sparkle.png b/graphics/misc/evo_sparkle.png new file mode 100644 index 000000000..ac6172602 Binary files /dev/null and b/graphics/misc/evo_sparkle.png differ diff --git a/include/battle.h b/include/battle.h index 3328c691f..1916f450a 100644 --- a/include/battle.h +++ b/include/battle.h @@ -229,6 +229,7 @@ #define BATTLE_TERRAIN_ROCK 6 #define BATTLE_TERRAIN_CAVE 7 #define BATTLE_TERRAIN_INSIDE 8 +#define BATTLE_TERRAIN_PLAIN 9 // array entries for battle communication #define MULTIUSE_STATE 0x0 @@ -348,7 +349,7 @@ struct UnknownFlags struct DisableStruct { - /*0x00*/ u32 unk0; + /*0x00*/ u32 transformedMonPersonality; /*0x04*/ u16 disabledMove; /*0x06*/ u16 encoredMove; /*0x08*/ u8 protectUses; @@ -636,10 +637,10 @@ struct BattleStruct u8 field_91; u8 field_92; u8 field_93; - u8 field_94; - u8 field_95; - u8 field_96; - u8 field_97; + u8 wallyBattleState; + u8 wallyMovesState; + u8 wallyWaitFrames; + u8 wallyMoveFrames; u8 mirrorMoves[8]; // ask gamefreak why they declared it that way u8 field_A0; u8 field_A1; @@ -657,7 +658,7 @@ struct BattleStruct u8 field_B3; void (*savedCallback)(void); u16 usedHeldItems[BATTLE_BANKS_COUNT]; - u8 field_C0[4]; + u8 chosenItem[4]; // why is this an u8? u8 AI_itemType[2]; u8 AI_itemFlags[2]; u16 choicedMove[BATTLE_BANKS_COUNT]; @@ -772,38 +773,39 @@ extern struct BattleStruct* gBattleStruct; #define MOVE_EFFECT_AFFECTS_USER 0x40 #define MOVE_EFFECT_CERTAIN 0x80 -// battle animations ids +// table ids for general animations +#define B_ANIM_CASTFORM_CHANGE 0x0 +#define B_ANIM_STATS_CHANGE 0x1 +#define B_ANIM_SUBSTITUTE_FADE 0x2 +#define B_ANIM_SUBSTITUTE_APPEAR 0x3 +#define B_ANIM_x4 0x4 +#define B_ANIM_ITEM_KNOCKOFF 0x5 +#define B_ANIM_TURN_TRAP 0x6 +#define B_ANIM_ITEM_EFFECT 0x7 +#define B_ANIM_SMOKEBALL_ESCAPE 0x8 +#define B_ANIM_HANGED_ON 0x9 +#define B_ANIM_RAIN_CONTINUES 0xA +#define B_ANIM_SUN_CONTINUES 0xB +#define B_ANIM_SANDSTORM_CONTINUES 0xC +#define B_ANIM_HAIL_CONTINUES 0xD +#define B_ANIM_LEECH_SEED_DRAIN 0xE +#define B_ANIM_MON_HIT 0xF +#define B_ANIM_ITEM_STEAL 0x10 +#define B_ANIM_SNATCH_MOVE 0x11 +#define B_ANIM_FUTURE_SIGHT_HIT 0x12 +#define B_ANIM_x13 0x13 +#define B_ANIM_x14 0x14 +#define B_ANIM_INGRAIN_HEAL 0x15 +#define B_ANIM_WISH_HEAL 0x16 -#define B_ANIM_CASTFORM_CHANGE 0x0 -#define B_ANIM_STATS_CHANGE 0x1 -#define B_ANIM_SUBSTITUTE_FADE 0x2 -#define B_ANIM_SUBSTITUTE_APPEAR 0x3 -#define B_ANIM_x4 0x4 -#define B_ANIM_ITEM_KNOCKOFF 0x5 -#define B_ANIM_TURN_TRAP 0x6 -#define B_ANIM_ITEM_EFFECT 0x7 -#define B_ANIM_SMOKEBALL_ESCAPE 0x8 -#define B_ANIM_HANGED_ON 0x9 -#define B_ANIM_RAIN_CONTINUES 0xA -#define B_ANIM_SUN_CONTINUES 0xB -#define B_ANIM_SANDSTORM_CONTINUES 0xC -#define B_ANIM_HAIL_CONTINUES 0xD -#define B_ANIM_LEECH_SEED_DRAIN 0xE -#define B_ANIM_MON_HIT 0xF -#define B_ANIM_ITEM_STEAL 0x10 -#define B_ANIM_SNATCH_MOVE 0x11 -#define B_ANIM_FUTURE_SIGHT_HIT 0x12 -#define B_ANIM_x13 0x13 -#define B_ANIM_x14 0x14 -#define B_ANIM_INGRAIN_HEAL 0x15 -#define B_ANIM_WISH_HEAL 0x16 -#define B_ANIM_x17 0x17 -#define B_ANIM_x18 0x18 -#define B_ANIM_x19 0x19 -#define B_ANIM_x1A 0x1A -#define B_ANIM_x1B 0x1B -#define B_ANIM_x1C 0x1C -#define B_ANIM_x1D 0x1D +// special animations table +#define B_ANIM_LVL_UP 0x0 +#define B_ANIM_SWITCH_OUT_PLAYER_MON 0x1 +#define B_ANIM_SWITCH_OUT_OPPONENT_MON 0x2 +#define B_ANIM_BALL_THROW 0x3 +#define B_ANIM_SAFARI_BALL_THROW 0x4 +#define B_ANIM_SUBSTITUTE_TO_MON 0x5 +#define B_ANIM_MON_TO_SUBSTITUTE 0x6 #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 #define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 @@ -878,6 +880,26 @@ void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species); void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank); void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank); void BattleLoadSubstituteSpriteGfx(u8 bank, bool8 arg1); +void nullsub_24(u16 arg0); +void nullsub_25(u8 arg0); +void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute); +void sub_805D714(struct Sprite *sprite); +void DecompressTrainerBackPic(u16 backPicId, u8 bank); +void DecompressTrainerFrontPic(u16 frontPicId, u8 bank); +void FreeTrainerFrontPicPalette(u16 frontPicId); +void sub_805D7AC(struct Sprite *sprite); +bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn); +void sub_805EB9C(u8 arg0); +void sub_805E394(void); +void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move); +void DoStatusAnimation(bool8 isStatus2, u32 status); +void DoSpecialBattleAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId); +bool8 DoBattleAnimationFromTable(u8 active, u8 atkBank, u8 defBank, u8 tableId, u16 argument); +void CopyBattleSpriteInvisibility(u8 bank); +u16 ChooseMoveAndTargetInBattlePalace(void); +void LoadBattleBarGfx(u8 arg0); +bool8 mplay_80342A4(u8 bank); +void sub_805EEE0(u8 bank); enum { @@ -890,7 +912,6 @@ enum BACK_PIC_WALLY, BACK_PIC_STEVEN }; -void LoadBackTrainerBankSpriteGfx(u8 backPicId, u8 bank); // rom_80A5C6C u8 GetBankSide(u8 bank); @@ -916,7 +937,7 @@ struct BattleAnimationInfo u8 field_5; u8 field_6; u8 field_7; - u8 field_8; + u8 ballThrowCaseId; u8 field_9_x1 : 1; u8 field_9_x2 : 1; u8 field_9_x1C : 3; @@ -931,11 +952,18 @@ struct BattleHealthboxInfo u8 flag_x2 : 1; u8 flag_x4 : 1; u8 flag_x8 : 1; - u8 flag_x10 : 1; - u8 field_1; + u8 statusAnimActive : 1; // x10 + u8 animFromTableActive : 1; // x20 + u8 specialAnimActive : 1; //x40 + u8 flag_x80 : 1; + u8 field_1_x1 : 1; + u8 field_1_x1E : 4; + u8 field_1_x20 : 1; + u8 field_1_x40 : 1; + u8 field_1_x80 : 1; u8 field_2; u8 field_3; - u8 field_4; + u8 animationState; u8 field_5; u8 field_6; u8 field_7; @@ -950,7 +978,7 @@ struct BattleBarInfo u8 healthboxSpriteId; s32 maxValue; s32 currentValue; - s32 field_C; + s32 receivedValue; s32 field_10; }; diff --git a/include/battle_2.h b/include/battle_2.h index ceec2aa00..ee61efd9b 100644 --- a/include/battle_2.h +++ b/include/battle_2.h @@ -2,23 +2,45 @@ #define GUARD_BATTLE_2_H void CB2_InitBattle(void); -void CB2_QuitRecordedBattle(void); -void FaintClearSetData(void); -void SwitchInClearSetData(void); -void sub_803BDA0(u8 bank); void BattleMainCB2(void); +void CB2_QuitRecordedBattle(void); +void sub_8038528(struct Sprite* sprite); +void sub_8038A04(void); // unused void VBlankCB_Battle(void); -bool8 TryRunFromBattle(u8 bank); -u8 IsRunningFromBattleImpossible(void); -u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves); -void SwapTurnOrder(u8 id1, u8 id2); -void BattleTurnPassed(void); -void RunBattleScriptCommands_PopCallbacksStack(void); -void RunBattleScriptCommands(void); +void nullsub_17(void); +void sub_8038B74(struct Sprite *sprite); +void sub_8038D64(void); +u32 sub_80391E0(u8 arrayId, u8 caseId); u32 sub_80397C4(u32 setId, u32 tableId); +void oac_poke_opponent(struct Sprite *sprite); +void SpriteCallbackDummy_2(struct Sprite *sprite); +void sub_8039934(struct Sprite *sprite); +void sub_8039AD8(struct Sprite *sprite); +void sub_8039B2C(struct Sprite *sprite); +void sub_8039B58(struct Sprite *sprite); +void sub_8039BB4(struct Sprite *sprite); +void sub_80105DC(struct Sprite *sprite); +void sub_8039C00(struct Sprite *sprite); +void dp11b_obj_instanciate(u8 bank, u8 b, s8 c, s8 d); +void dp11b_obj_free(u8 bank, bool8 b); +void sub_8039E44(struct Sprite *sprite); +void sub_8039E60(struct Sprite *sprite); +void sub_8039E84(struct Sprite *sprite); void sub_8039E9C(struct Sprite *sprite); void nullsub_20(void); void BeginBattleIntro(void); +void SwitchInClearSetData(void); +void FaintClearSetData(void); +void sub_803B3AC(void); // unused +void sub_803B598(void); // unused +void BattleTurnPassed(void); +u8 IsRunningFromBattleImpossible(void); +void sub_803BDA0(u8 bank); +void SwapTurnOrder(u8 id1, u8 id2); +u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves); +void RunBattleScriptCommands_PopCallbacksStack(void); +void RunBattleScriptCommands(void); +bool8 TryRunFromBattle(u8 bank); extern const u8 gStatusConditionString_PoisonJpn[8]; extern const u8 gStatusConditionString_SleepJpn[8]; diff --git a/include/battle_anim.h b/include/battle_anim.h index 5282916c0..e912af6b1 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -60,7 +60,7 @@ extern u8 gUnknown_02038440; void ClearBattleAnimationVars(void); void DoMoveAnim(u16 move); -void DoBattleAnim(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim); +void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim); void DestroyAnimSprite(struct Sprite *sprite); void DestroyAnimVisualTask(u8 taskId); void DestroyAnimSoundTask(u8 taskId); @@ -75,5 +75,24 @@ s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); // battle_anim_80FE840.s void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value); void sub_8118FBC(u8 arg0, u8 arg1, u8 arg2, u8 bankIdentity, u8 arg4, void *arg5, u16 *arg6, u16 arg7); +void HandleIntroSlide(u8 terrainId); + +// battle_anim_80A5C6C.s +void sub_80A6EEC(struct Sprite *sprite); +void sub_80A8278(void); +void sub_80A6B30(struct UnknownAnimStruct2*); +void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); +u8 sub_80A82E4(u8 bank); +u8 sub_80A5C6C(u8 bank, u8 attributeId); +bool8 IsBankSpritePresent(u8 bank); +void sub_80A6C68(u8 arg0); +u8 GetAnimBankSpriteId(u8 wantedBank); +bool8 IsDoubleBattle(void); +u8 sub_80A6D94(void); +u8 sub_80A8364(u8); +void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); +void oamt_add_pos2_onto_pos1(struct Sprite *sprite); +u8 sub_80A6138(u8 bank); +u8 sub_80A82E4(u8 bank); #endif // GUARD_BATTLE_ANIM_H diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 4bc6b7b84..973a723e0 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -1,16 +1,69 @@ #ifndef GUARD_BATTLE_CONTROLLERS_H #define GUARD_BATTLE_CONTROLLERS_H -#define REQUEST_ALL_BATTLE 0x0 -#define REQUEST_SPECIES_BATTLE 0x1 -#define REQUEST_HELDITEM_BATTLE 0x2 -#define REQUEST_MOVES_PP_BATTLE 0x3 -#define REQUEST_PPMOVE1_BATTLE 0x9 -#define REQUEST_PPMOVE2_BATTLE 0xA -#define REQUEST_PPMOVE3_BATTLE 0xB -#define REQUEST_PPMOVE4_BATTLE 0xC -#define REQUEST_STATUS_BATTLE 0x28 -#define REQUEST_HP_BATTLE 0x2A +enum +{ + REQUEST_ALL_BATTLE, + REQUEST_SPECIES_BATTLE, + REQUEST_HELDITEM_BATTLE, + REQUEST_MOVES_PP_BATTLE, + REQUEST_MOVE1_BATTLE, + REQUEST_MOVE2_BATTLE, + REQUEST_MOVE3_BATTLE, + REQUEST_MOVE4_BATTLE, + REQUEST_PP_DATA_BATTLE, + REQUEST_PPMOVE1_BATTLE, + REQUEST_PPMOVE2_BATTLE, + REQUEST_PPMOVE3_BATTLE, + REQUEST_PPMOVE4_BATTLE, + REQUEST_UNUSED_13_BATTLE, + REQUEST_UNUSED_14_BATTLE, + REQUEST_UNUSED_15_BATTLE, + REQUEST_UNUSED_16_BATTLE, + REQUEST_OTID_BATTLE, + REQUEST_EXP_BATTLE, + REQUEST_HP_EV_BATTLE, + REQUEST_ATK_EV_BATTLE, + REQUEST_DEF_EV_BATTLE, + REQUEST_SPEED_EV_BATTLE, + REQUEST_SPATK_EV_BATTLE, + REQUEST_SPDEF_EV_BATTLE, + REQUEST_FRIENDSHIP_BATTLE, + REQUEST_POKERUS_BATTLE, + REQUEST_MET_LOCATION_BATTLE, + REQUEST_MET_LEVEL_BATTLE, + REQUEST_MET_GAME_BATTLE, + REQUEST_POKEBALL_BATTLE, + REQUEST_ALL_IVS_BATTLE, + REQUEST_HP_IV_BATTLE, + REQUEST_ATK_IV_BATTLE, + REQUEST_DEF_IV_BATTLE, + REQUEST_SPEED_IV_BATTLE, + REQUEST_SPATK_IV_BATTLE, + REQUEST_SPDEF_IV_BATTLE, + REQUEST_PERSONALITY_BATTLE, + REQUEST_CHECKSUM_BATTLE, + REQUEST_STATUS_BATTLE, + REQUEST_LEVEL_BATTLE, + REQUEST_HP_BATTLE, + REQUEST_MAX_HP_BATTLE, + REQUEST_ATK_BATTLE, + REQUEST_DEF_BATTLE, + REQUEST_SPEED_BATTLE, + REQUEST_SPATK_BATTLE, + REQUEST_SPDEF_BATTLE, + REQUEST_COOL_BATTLE, + REQUEST_BEAUTY_BATTLE, + REQUEST_CUTE_BATTLE, + REQUEST_SMART_BATTLE, + REQUEST_TOUGH_BATTLE, + REQUEST_SHEEN_BATTLE, + REQUEST_COOL_RIBBON_BATTLE, + REQUEST_BEAUTY_RIBBON_BATTLE, + REQUEST_CUTE_RIBBON_BATTLE, + REQUEST_SMART_RIBBON_BATTLE, + REQUEST_TOUGH_RIBBON_BATTLE, +}; #define RESET_ACTION_MOVE_SELECTION 0 #define RESET_ACTION_SELECTION 1 @@ -23,6 +76,16 @@ #define BALL_3_SHAKES_SUCCESS 4 #define BALL_TRAINER_BLOCK 5 +#define RET_VALUE_LEVELLED_UP 11 + +#define INSTANT_HP_BAR_DROP 32767 + +struct UnusedControllerStruct +{ + u8 field_0 : 7; + u8 flag_x80 : 1; +}; + struct HpAndStatus { u16 hp; @@ -31,7 +94,7 @@ struct HpAndStatus struct MovePpInfo { - u16 move[4]; + u16 moves[4]; u8 pp[4]; u8 ppBonuses; }; @@ -59,15 +122,15 @@ enum CONTROLLER_TRAINERSLIDE, CONTROLLER_TRAINERSLIDEBACK, CONTROLLER_FAINTANIMATION, - CONTROLLER_11, - CONTROLLER_12, - CONTROLLER_BALLTHROW, + CONTROLLER_PALETTEFADE, + CONTROLLER_SUCCESSBALLTHROWANIM, + CONTROLLER_BALLTHROWANIM, CONTROLLER_PAUSE, CONTROLLER_MOVEANIMATION, CONTROLLER_PRINTSTRING, CONTROLLER_PRINTSTRINGPLAYERONLY, CONTROLLER_CHOOSEACTION, - CONTROLLER_19, + CONTROLLER_UNKNOWNYESNOBOX, CONTROLLER_CHOOSEMOVE, CONTROLLER_OPENBAG, CONTROLLER_CHOOSEPOKEMON, @@ -81,10 +144,10 @@ enum CONTROLLER_DMA3TRANSFER, CONTROLLER_31, CONTROLLER_32, - CONTROLLER_33, - CONTROLLER_34, - CONTROLLER_35, - CONTROLLER_36, + CONTROLLER_TWORETURNVALUES, + CONTROLLER_CHOSENMONRETURNVALUE, + CONTROLLER_ONERETURNVALUE, + CONTROLLER_ONERETURNVALUE_DUPLICATE, CONTROLLER_37, CONTROLLER_38, CONTROLLER_39, @@ -104,10 +167,11 @@ enum CONTROLLER_LINKSTANDBYMSG, CONTROLLER_RESETACTIONMOVESELECTION, CONTROLLER_55, - CONTROLLER_56 + /*new controllers should go here*/ + CONTROLLER_TERMINATOR_NOP, + CONTROLLER_CMDS_COUNT }; -#define LAST_CONTROLLER_CMD_ID CONTROLLER_56 + 1 // general functions void HandleLinkBattleSetup(void); @@ -117,9 +181,9 @@ void sub_8033648(void); void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters -void EmitGetMonData(u8 bufferId, u8 arg1, u8 arg2); +void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused -void EmitSetMonData(u8 bufferId, u8 request, u8 c, u8 bytes, void *data); +void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused void EmitLoadMonSprite(u8 bufferId); void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); @@ -128,17 +192,17 @@ void EmitDrawTrainerPic(u8 bufferId); void EmitTrainerSlide(u8 bufferId); void EmitTrainerSlideBack(u8 bufferId); void EmitFaintAnimation(u8 bufferId); -void EmitCmd11(u8 bufferId); // unused -void EmitCmd12(u8 bufferId); // unused -void EmitBallThrow(u8 bufferId, u8 caseId); +void EmitPaletteFade(u8 bufferId); // unused +void EmitSuccessBallThrowAnim(u8 bufferId); // unused +void EmitBallThrowAnim(u8 bufferId, u8 caseId); void EmitPause(u8 bufferId, u8 toWait, void *data); // unused void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); void EmitPrintString(u8 bufferId, u16 stringId); void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId); void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2); -void EmitCmd19(u8 bufferId); +void EmitUnknownYesNoBox(u8 bufferId); void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); -void EmitOpenBag(u8 bufferId, u8* arg1); +void EmitChooseItem(u8 bufferId, u8* arg1); void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4); void EmitCmd23(u8 bufferId); // unused void EmitHealthBarUpdate(u8 bufferId, u16 hpValue); @@ -150,14 +214,14 @@ void EmitDataTransfer(u8 bufferId, u16 size, void *data); void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused void EmitCmd32(u8 bufferId, u16 size, void *c); // unused -void EmitCmd33(u8 bufferId, u8 arg1, u16 arg2); -void EmitCmd34(u8 bufferId, u8 b, u8 *c); -void EmitCmd35(u8 bufferId, u16 b); -void EmitCmd36(u8 bufferId, u16 b); -void EmitCmd37(u8 bufferId); -void EmitCmd38(u8 bufferId, u8 b); -void EmitCmd39(u8 bufferId); -void EmitCmd40(u8 bufferId); +void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2); +void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c); +void EmitOneReturnValue(u8 bufferId, u16 arg1); +void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b); +void EmitCmd37(u8 bufferId); // unused +void EmitCmd38(u8 bufferId, u8 b); // unused +void EmitCmd39(u8 bufferId); // unused +void EmitCmd40(u8 bufferId); // unused void EmitHitAnimation(u8 bufferId); void EmitCmd42(u8 bufferId); void EmitEffectivenessSound(u8 bufferId, u16 songId); @@ -175,33 +239,40 @@ void EmitResetActionMoveSelection(u8 bufferId, u8 caseId); void EmitCmd55(u8 bufferId, u8 arg1); // player controller -void SetBankFuncToPlayerBufferRunCommand(void); +void SetControllerToPlayer(void); void nullsub_21(void); +void PlayerHandleGetRawMonData(void); +void sub_80587B0(void); +void sub_805CC00(struct Sprite *sprite); +void SetCB2ToReshowScreenAfterMenu(void); +void SetCB2ToReshowScreenAfterMenu2(void); +void c3_0802FDF4(u8 taskId); void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused); void ActionSelectionDestroyCursorAt(u8 cursorPos); +void InitMoveSelectionsVarsAndStrings(void); // recorded player controller -void SetBankFuncToRecordedPlayerBufferRunCommand(void); +void SetControllerToRecordedPlayer(void); // opponent controller -void SetBankFuncToOpponentBufferRunCommand(void); +void SetControllerToOpponent(void); // player partner controller -void SetBankFuncToPlayerPartnerBufferRunCommand(void); +void SetControllerToPlayerPartner(void); // safari controller -void SetBankFuncToSafariBufferRunCommand(void); +void SetControllerToSafari(void); // wally controller -void SetBankFuncToWallyBufferRunCommand(void); +void SetControllerToWally(void); // recorded opponent controller -void SetBankFuncToRecordedOpponentBufferRunCommand(void); +void SetControllerToRecordedOpponent(void); // link opponent -void SetBankFuncToLinkOpponentBufferRunCommand(void); +void SetControllerToLinkOpponent(void); // link partner -void SetBankFuncToLinkPartnerBufferRunCommand(void); +void SetControllerToLinkPartner(void); #endif // GUARD_BATTLE_CONTROLLERS_H diff --git a/include/battle_interface.h b/include/battle_interface.h index 05ea1c021..aad30f7b3 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -3,6 +3,18 @@ #include "battle_controllers.h" +enum +{ + HP_CURRENT, + HP_MAX +}; + +enum +{ + HEALTH_BAR, + EXP_BAR +}; + #define TAG_HEALTHBOX_PLAYER1_TILE 0xD6FF #define TAG_HEALTHBOX_PLAYER2_TILE 0xD700 #define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701 @@ -35,7 +47,7 @@ enum u8 CreateBankHealthboxSprites(u8 bank); u8 CreateSafariPlayerHealthboxSprites(void); -void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 field_C); +void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue); void SetHealthboxSpriteInvisible(u8 healthboxSpriteId); void SetHealthboxSpriteVisible(u8 healthboxSpriteId); void DestoryHealthboxSprite(u8 healthboxSpriteId); diff --git a/include/battle_link_817C95C.h b/include/battle_link_817C95C.h new file mode 100644 index 000000000..815c1f058 --- /dev/null +++ b/include/battle_link_817C95C.h @@ -0,0 +1,11 @@ +#ifndef GUARD_BATTLE_LINK_817C95C_H +#define GUARD_BATTLE_LINK_817C95C_H + +void sub_817C95C(u16 stringId); +void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr); +void sub_817E32C(u8 animationId); +void sub_817E3F4(void); +void sub_817F2A8(void); +u8 GetBankMoveSlotId(u8 bank, u16 move); + +#endif // GUARD_BATTLE_LINK_817C95C_H diff --git a/include/battle_message.h b/include/battle_message.h index 3b154c5a6..3f9b38cad 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -204,7 +204,7 @@ struct StringInfoBattle void BufferStringBattle(u16 stringID); u32 BattleStringExpandPlaceholdersToDisplayedString(const u8* src); u32 BattleStringExpandPlaceholders(const u8* src, u8* dst); -void sub_814F9EC(const u8* text, u8 arg1); +void BattleHandleAddTextPrinter(const u8* text, u8 arg1); void SetPpNumbersPaletteInMoveSelection(void); u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp); @@ -215,6 +215,7 @@ extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT]; extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT]; extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT]; +extern const u8* const gBattleStringsTable[]; extern const u8* const gStatNamesTable[]; extern const u8* const gPokeblockWasTooXStringTable[]; extern const u8* const gRefereeStringsTable[]; diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 590944f02..a466abc04 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -25,6 +25,7 @@ #define VARIOUS_GET_MOVE_TARGET 3 #define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5 #define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6 +#define VARIOUS_EMIT_YESNOBOX 13 #define VARIOUS_WAIT_CRY 18 #define VARIOUS_RETURN_OPPONENT_MON1 19 #define VARIOUS_RETURN_OPPONENT_MON2 20 @@ -41,15 +42,18 @@ #define STAT_CHANGE_WORKED 0 #define STAT_CHANGE_DIDNT_WORK 1 +#define WINDOW_CLEAR 0x1 +#define WINDOW_x80 0x80 + void AI_CalcDmg(u8 bankAtk, u8 bankDef); u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef); u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility); u8 BankGetTurnOrder(u8 bank); void SetMoveEffect(bool8 primary, u8 certain); -void BattleDestroyCursorAt(u8 cursorPosition); -void BattleCreateCursorAt(u8 cursorPosition); +void BattleDestroyYesNoCursorAt(u8 cursorPosition); +void BattleCreateYesNoCursorAt(u8 cursorPosition); void BufferMoveToLearnIntoBattleTextBuff2(void); -void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); bool8 UproarWakeUpCheck(u8 bank); extern void (* const gBattleScriptingCommandsTable[])(void); diff --git a/include/data2.h b/include/data2.h index db9532811..be0f33ab8 100644 --- a/include/data2.h +++ b/include/data2.h @@ -10,6 +10,7 @@ struct MonCoords }; extern struct MonCoords gTrainerBackPicCoords[]; +extern struct MonCoords gTrainerFrontPicCoords[]; extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; extern const u8 gMoveNames[][13]; diff --git a/include/evolution_graphics.h b/include/evolution_graphics.h new file mode 100644 index 000000000..f52105815 --- /dev/null +++ b/include/evolution_graphics.h @@ -0,0 +1,15 @@ +#ifndef GUARD_EVOLUTION_GRAPHICS_H +#define GUARD_EVOLUTION_GRAPHICS_H + +void LoadEvoSparkleSpriteAndPal(void); + +u8 LaunchTask_PreEvoSparklesSet1(u16 arg0); +u8 LaunchTask_PreEvoSparklesSet2(void); +u8 LaunchTask_PostEvoSparklesSet1(void); +u8 LaunchTask_PostEvoSparklesSet2AndFlash(u16 species); +u8 LaunchTask_PostEvoSparklesSet2AndFlash_Trade(u16 species); +u8 sub_817C3A0(u8 preEvoSpriteID, u8 postEvoSpriteID); + +#define EvoGraphicsTaskEvoStop data[8] + +#endif // GUARD_EVOLUTION_GRAPHICS_H diff --git a/include/evolution_scene.h b/include/evolution_scene.h index 48bd6ebe1..5f8c534b9 100644 --- a/include/evolution_scene.h +++ b/include/evolution_scene.h @@ -1,8 +1,8 @@ #ifndef GUARD_EVOLUTION_SCENE_H #define GUARD_EVOLUTION_SCENE_H -void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); +void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID); extern void (*gCB2_AfterEvolution)(void); diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 83a2a123b..f86f2434c 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -628,6 +628,8 @@ #define KEY_OR_INTR 0x0000 #define KEY_AND_INTR 0x8000 +#define DPAD_ANY ((DPAD_RIGHT | DPAD_LEFT | DPAD_UP | DPAD_DOWN)) + // interrupt flags #define INTR_FLAG_VBLANK (1 << 0) #define INTR_FLAG_HBLANK (1 << 1) diff --git a/include/global.h b/include/global.h index 8860b4ae3..2e3a106eb 100644 --- a/include/global.h +++ b/include/global.h @@ -41,6 +41,8 @@ enum VERSION_SAPPHIRE = 1, VERSION_RUBY = 2, VERSION_EMERALD = 3, + VERSION_FIRE_RED = 4, + VERSION_LEAF_GREEN = 5, }; enum LanguageId { diff --git a/include/link.h b/include/link.h index b8835ce04..7a6563144 100644 --- a/include/link.h +++ b/include/link.h @@ -191,5 +191,6 @@ void sub_800A620(void); void sub_8011BD0(void); u8 sub_800ABAC(void); u8 sub_800ABBC(void); +void sub_800AC34(void); #endif // GUARD_LINK_H diff --git a/include/party_menu.h b/include/party_menu.h index dc1f52f80..7a7d59cd0 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -3,5 +3,6 @@ bool8 pokemon_has_move(struct Pokemon *, u16); void sub_81B58A8(void); +void DoWallyTutorialBagMenu(void); #endif // GUARD_PARTY_MENU_H diff --git a/include/pokeball.h b/include/pokeball.h new file mode 100644 index 000000000..76f084465 --- /dev/null +++ b/include/pokeball.h @@ -0,0 +1,8 @@ +#ifndef GUARD_POKEBALL_H +#define GUARD_POKEBALL_H + +u8 sub_80753E8(u16, u8); +void sub_8076918(u8 bank); +void DoHitAnimHealthboxEffect(u8 bank); + +#endif // GUARD_POKEBALL_H diff --git a/include/pokemon.h b/include/pokemon.h index 4159a2f96..0c7d6ac40 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -620,7 +620,7 @@ void SetWildMonHeldItem(void); u16 GetMonEVCount(struct Pokemon *); const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon); -const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality); +const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality); bool32 IsHMMove2(u16 move); bool8 IsPokeSpriteNotFlipped(u16 species); bool8 IsMonShiny(struct Pokemon *mon); @@ -629,7 +629,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies); bool8 IsTradedMon(struct Pokemon *mon); void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality); -s32 sub_806D864(u16 a1); +s32 GetBankMultiplayerId(u16 a1); bool16 sub_806D82C(u8 id); u16 MonTryLearningNewMove(struct Pokemon* mon, bool8); void sub_8068AA4(void); // sets stats for deoxys @@ -643,6 +643,11 @@ void PartySpreadPokerus(struct Pokemon *party); s8 GetMonFlavourRelation(struct Pokemon *mon, u8 a2); s8 GetFlavourRelationByPersonality(u32 personality, u8 a2); u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit); +u8 GetDefaultMoveTarget(u8 atkBank); +u16 PlayerGenderToFrontTrainerPicId(u8 playerGender); +void sub_806A1C0(u16 arg0, u8 bankIdentity); +void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity); +u8 GetSecretBaseTrainerPicIndex(void); #include "sprite.h" diff --git a/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/include/trainer_classes.h b/include/trainer_classes.h index 3f13dfc37..e5e26b359 100644 --- a/include/trainer_classes.h +++ b/include/trainer_classes.h @@ -3,16 +3,16 @@ enum { - CLASS_PKMN_TRAINER0, //0 - CLASS_PKMN_TRAINER1, //1 - CLASS_HIKER, //2 - CLASS_TEAM_AQUA, //3 - CLASS_PKMN_BREEDER, //4 - CLASS_COOLTRAINER, //5 - CLASS_BIRDKEEPER, //6 - CLASS_COLLECTOR, //7 - CLASS_SWIMMER_MALE, //8 - CLASS_TEAM_MAGMA, //9 + CLASS_PKMN_TRAINER0, // 0 + CLASS_PKMN_TRAINER1, // 1 + CLASS_HIKER, // 2 + CLASS_TEAM_AQUA, // 3 + CLASS_PKMN_BREEDER, // 4 + CLASS_COOLTRAINER, // 5 + CLASS_BIRDKEEPER, // 6 + CLASS_COLLECTOR, // 7 + CLASS_SWIMMER_MALE, // 8 + CLASS_TEAM_MAGMA, // 9 CLASS_EXPERT, // 0xA CLASS_AQUA_ADMIN, // 0xB CLASS_BLACK_BELT, // 0xC @@ -36,11 +36,32 @@ enum CLASS_GENTLEMAN, // 0x1E CLASS_ELITE_FOUR, // 0x1F CLASS_LEADER, // 0x20 - CLASS_CHAMPION = 0x26, - CLASS_MAGMA_ADMIN = 0x31, - CLASS_PKMN_TRAINER_RIVAL = 0x32, - CLASS_MAGMA_LEADER = 0x35, - CLASS_SALON_MAIDEN = 0x3A, + CLASS_SCHOOL_KID, // 0x21 + CLASS_SCHOOL_SR_JR, // 0x22 + CLASS_WINSTRATE, // 0x23 + CLASS_POKE_FAN, // 0x24 + CLASS_YOUNGSTER, // 0x25 + CLASS_CHAMPION, // 0x26 + CLASS_FISHERMAN, // 0x27 + CLASS_TRIATHLETE, // 0x28 + CLASS_DRAGON_TAMER, // 0x29 + CLASS_NINJA_BOY, // 0x2A + CLASS_BATTLE_GIRL, // 0x2B + CLASS_PARASOL_LADY, // 0x2C + CLASS_SWIMMER_FEMALE, // 0x2D + CLASS_TWINS, // 0x2E + CLASS_SAILOR, // 0x2F + CLASS_COOLTRAINER_2, // 0x30 + CLASS_MAGMA_ADMIN, // 0x31 + CLASS_PKMN_TRAINER_RIVAL, // 0x32 + CLASS_BUG_CATCHER, // 0x33 + CLASS_PKMN_RANGER, // 0x34 + CLASS_MAGMA_LEADER, // 0x35 + CLASS_LASS, // 0x36 + CLASS_YOUNG_COUPLE, // 0x37 + CLASS_OLD_COUPLE, // 0x38 + CLASS_SIS_AND_BRO, // 0x39 + CLASS_SALON_MAIDEN, // 0x3A CLASS_DOME_ACE, // 0x3B CLASS_PALACE_MAVEN, // 0x3C CLASS_ARENA_TYCOON, // 0x3D diff --git a/include/trainer_front_sprites.h b/include/trainer_front_sprites.h new file mode 100644 index 000000000..3259bec88 --- /dev/null +++ b/include/trainer_front_sprites.h @@ -0,0 +1,101 @@ +#ifndef GUARD_TRAINER_FRONT_SPRITES_H +#define GUARD_TRAINER_FRONT_SPRITES_H + +enum +{ + TRAINER_FRONT_PIC_HIKER, + TRAINER_FRONT_PIC_AQUA_GRUNT_M, + TRAINER_FRONT_PIC_PKMN_BREEDER_F, + TRAINER_FRONT_PIC_COOLTRAINER_M, + TRAINER_FRONT_PIC_BIRD_KEEPER, + TRAINER_FRONT_PIC_COLLECTOR, + TRAINER_FRONT_PIC_AQUA_GRUNT_F, + TRAINER_FRONT_PIC_SWIMMER_M, + TRAINER_FRONT_PIC_MAGMA_GRUNT_M, + TRAINER_FRONT_PIC_EXPERT_M, + TRAINER_FRONT_PIC_AQUA_ADMIN_M, + TRAINER_FRONT_PIC_BLACK_BELT, + TRAINER_FRONT_PIC_AQUA_ADMIN_F, + TRAINER_FRONT_PIC_AQUA_LEADER, + TRAINER_FRONT_PIC_HEX_MANIAC, + TRAINER_FRONT_PIC_AROMA_LADY, + TRAINER_FRONT_PIC_RUIN_MANIAC, + TRAINER_FRONT_PIC_INTERVIEWER, + TRAINER_FRONT_PIC_TUBER_F, + TRAINER_FRONT_PIC_TUBER_M, + TRAINER_FRONT_PIC_COOLTRAINER_F, + TRAINER_FRONT_PIC_LADY, + TRAINER_FRONT_PIC_BEAUTY, + TRAINER_FRONT_PIC_RICH_BOY, + TRAINER_FRONT_PIC_EXPERT_F, + TRAINER_FRONT_PIC_POKE_MANIAC, + TRAINER_FRONT_PIC_MAGMA_GRUNT_F, + TRAINER_FRONT_PIC_GUITARIST, + TRAINER_FRONT_PIC_KINDLER, + TRAINER_FRONT_PIC_CAMPER, + TRAINER_FRONT_PIC_PICNICKER, + TRAINER_FRONT_PIC_BUG_MANIAC, + TRAINER_FRONT_PIC_PKMN_BREEDER_M, + TRAINER_FRONT_PIC_PSYCHIC_M, + TRAINER_FRONT_PIC_PSYCHIC_F, + TRAINER_FRONT_PIC_GENTLEMAN, + TRAINER_FRONT_PIC_SIDNEY, + TRAINER_FRONT_PIC_PHOEBE, + TRAINER_FRONT_PIC_GLACIA, + TRAINER_FRONT_PIC_DRAKE, + TRAINER_FRONT_PIC_ROXANNE, + TRAINER_FRONT_PIC_BRAWLY, + TRAINER_FRONT_PIC_WATTSON, + TRAINER_FRONT_PIC_FLANNERY, + TRAINER_FRONT_PIC_NORMAN, + TRAINER_FRONT_PIC_WINONA, + TRAINER_FRONT_PIC_TATE_LIZA, + TRAINER_FRONT_PIC_JUAN, + TRAINER_FRONT_PIC_SCHOOL_KID_M, + TRAINER_FRONT_PIC_SCHOOL_KID_F, + TRAINER_FRONT_PIC_SR_JR, + TRAINER_FRONT_PIC_POKÉFAN_M, + TRAINER_FRONT_PIC_POKÉFAN_F, + TRAINER_FRONT_PIC_YOUNGSTER, + TRAINER_FRONT_PIC_WALLACE, + TRAINER_FRONT_PIC_FISHERMAN, + TRAINER_FRONT_PIC_TRIATHLETE_BIKER_M, + TRAINER_FRONT_PIC_TRIATHLETE_BIKER_F, + TRAINER_FRONT_PIC_TRIATHLETE_JOGGER_M, + TRAINER_FRONT_PIC_TRIATHLETE_JOGGER_F, + TRAINER_FRONT_PIC_TRIATHLETE_SWIMMER_M, + TRAINER_FRONT_PIC_TRIATHLETE_SWIMMER_F, + TRAINER_FRONT_PIC_DRAGON_TAMER, + TRAINER_FRONT_PIC_NINJA_BOY, + TRAINER_FRONT_PIC_BATTLE_GIRL, + TRAINER_FRONT_PIC_PARASOL_LADY, + TRAINER_FRONT_PIC_SWIMMER_F, + TRAINER_FRONT_PIC_TWINS, + TRAINER_FRONT_PIC_SAILOR, + TRAINER_FRONT_PIC_MAGMA_ADMIN_M, + TRAINER_FRONT_PIC_WALLY, + TRAINER_FRONT_PIC_BRENDAN_E, + TRAINER_FRONT_PIC_MAY_E, + TRAINER_FRONT_PIC_BUG_CATCHER, + TRAINER_FRONT_PIC_PKMN_RANGER_M, + TRAINER_FRONT_PIC_PKMN_RANGER_F, + TRAINER_FRONT_PIC_MAGMA_LEADER, + TRAINER_FRONT_PIC_LASS, + TRAINER_FRONT_PIC_YOUNG_COUPLE, + TRAINER_FRONT_PIC_OLD_COUPLE, + TRAINER_FRONT_PIC_SIS_AND_BRO, + TRAINER_FRONT_PIC_STEVEN, + TRAINER_FRONT_PIC_ANABEL, + TRAINER_FRONT_PIC_TUCKER, + TRAINER_FRONT_PIC_SPENSER, + TRAINER_FRONT_PIC_GRETA, + TRAINER_FRONT_PIC_NOLAND, + TRAINER_FRONT_PIC_LUCY, + TRAINER_FRONT_PIC_BRANDON, + TRAINER_FRONT_PIC_RED, + TRAINER_FRONT_PIC_LEAF, + TRAINER_FRONT_PIC_BRENDAN_RS, + TRAINER_FRONT_PIC_MAY_RS +}; + +#endif // GUARD_TRAINER_FRONT_SPRITES_H diff --git a/ld_script.txt b/ld_script.txt index 0dec8a1be..efcf72a6a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -61,11 +61,11 @@ SECTIONS { src/battle_util.o(.text); src/battle_script_commands.o(.text); asm/battle_5.o(.text); - asm/battle_controller_player.o(.text); + src/battle_controller_player.o(.text); asm/battle_7.o(.text); - asm/battle_controller_opponent.o(.text); + src/battle_controller_opponent.o(.text); src/battle_ai_switch_items.o(.text); - asm/battle_controller_linkopponent.o(.text); + src/battle_controller_link_opponent.o(.text); src/pokemon_1.o(.text); asm/pokemon_1.o(.text); src/calculate_base_damage.o(.text); @@ -114,7 +114,7 @@ SECTIONS { src/palette.o(.text); src/sound.o(.text); src/battle_anim.o(.text); - asm/rom_80A5C6C.o(.text); + asm/battle_anim_80A5C6C.o(.text); src/task.o(.text); src/reshow_battle_screen.o(.text); asm/battle_anim_80A9C70.o(.text); @@ -180,7 +180,7 @@ SECTIONS { asm/rom6.o(.text); asm/battle_records.o(.text); asm/pokedex_area_screen.o(.text); - asm/evolution_scene.o(.text); + src/evolution_scene.o(.text); asm/roulette.o(.text); asm/pokedex_cry_screen.o(.text); src/coins.o(.text); @@ -188,7 +188,7 @@ SECTIONS { asm/landmark.o(.text); asm/fldeff_strength.o(.text); asm/battle_transition.o(.text); - asm/battle_controller_linkpartner.o(.text); + src/battle_controller_link_partner.o(.text); src/battle_message.o(.text); asm/cable_car.o(.text); asm/math_util.o(.text); @@ -199,7 +199,7 @@ SECTIONS { asm/field_effect_helpers.o(.text); asm/contest_ai.o(.text); asm/battle_anim_sound_tasks.o(.text); - asm/battle_controller_safari.o(.text); + src/battle_controller_safari.o(.text); asm/fldeff_sweetscent.o(.text); asm/battle_anim_815A0D4.o(.text); asm/learn_move.o(.text); @@ -208,7 +208,7 @@ SECTIONS { src/roamer.o(.text); asm/battle_tower.o(.text); asm/use_pokeblock.o(.text); - asm/battle_controller_wally.o(.text); + src/battle_controller_wally.o(.text); asm/player_pc.o(.text); asm/intro.o(.text); src/reset_save_heap.o(.text); @@ -225,14 +225,14 @@ SECTIONS { asm/pokeblock_feed.o(.text); src/clear_save_data_screen.o(.text); asm/intro_credits_graphics.o(.text); - asm/evolution_graphics.o(.text); + src/evolution_graphics.o(.text); asm/bard_music.o(.text); asm/fldeff_teleport.o(.text); asm/battle_link_817C95C.o(.text); asm/pokemon_animation.o(.text); asm/recorded_battle.o(.text); - asm/battle_controller_recorded_opponent.o(.text); - asm/battle_controller_recorded_player.o(.text); + src/battle_controller_recorded_opponent.o(.text); + src/battle_controller_recorded_player.o(.text); src/battle_dome_cards.o(.text); src/lilycove_lady.o(.text); asm/battle_frontier_1.o(.text); @@ -250,7 +250,7 @@ SECTIONS { src/unk_text_util_2.o(.text); src/multiboot.o(.text); asm/unk_81BAD84.o(.text); - asm/battle_controller_player_partner.o(.text); + src/battle_controller_player_partner.o(.text); asm/fldeff_groundshake.o(.text); asm/fossil_specials.o(.text); src/berry_fix_program.o(.text); @@ -335,10 +335,10 @@ SECTIONS { src/battle_2.o(.rodata); src/battle_util.o(.rodata); src/battle_script_commands.o(.rodata); - data/battle_controller_player.o(.rodata); + src/battle_controller_player.o(.rodata); data/smokescreen.o(.rodata); - data/battle_controller_opponent.o(.rodata); - data/battle_controller_link_opponent.o(.rodata); + src/battle_controller_opponent.o(.rodata); + src/battle_controller_link_opponent.o(.rodata); data/data2c.o(.rodata); src/trig.o(.rodata); src/util.o(.rodata); @@ -418,19 +418,19 @@ SECTIONS { data/contest_painting.o(.rodata); src/battle_ai_script_commands.o(.rodata); data/data4.o(.rodata); - data/battle_controller_link_partner.o(.rodata); + src/battle_controller_link_partner.o(.rodata); src/battle_message.o(.rodata); data/cable_car.o(.rodata); data/save.o(.rodata); data/field_effect_helpers.o(.rodata); data/contest_ai.o(.rodata); - data/battle_controller_safari.o(.rodata); + src/battle_controller_safari.o(.rodata); data/battle_anim_815A0D4.o(.rodata); data/learn_move.o(.rodata); src/roamer.o(.rodata); data/battle_tower.o(.rodata); data/use_pokeblock.o(.rodata); - data/battle_controller_wally.o(.rodata); + src/battle_controller_wally.o(.rodata); data/player_pc.o(.rodata); data/intro.o(.rodata); src/field_region_map.o(.rodata); @@ -447,11 +447,11 @@ SECTIONS { data/pokeblock_feed.o(.rodata); src/clear_save_data_screen.o(.rodata); data/intro_credits_graphics.o(.rodata); - data/evolution_graphics.o(.rodata); + src/evolution_graphics.o(.rodata); data/bard_music.o(.rodata); data/data_860A4AC.o(.rodata); - data/battle_controller_recorded_opponent.o(.rodata); - data/battle_controller_recorded_player.o(.rodata); + src/battle_controller_recorded_opponent.o(.rodata); + src/battle_controller_recorded_player.o(.rodata); src/battle_dome_cards.o(.rodata); src/lilycove_lady.o(.rodata); data/battle_frontier_1.o(.rodata); @@ -465,7 +465,7 @@ SECTIONS { data/battle_tent.o(.rodata); src/unk_text_util_2.o(.rodata); data/unk_81BAD84.o(.rodata); - data/battle_controller_player_partner.o(.rodata); + src/battle_controller_player_partner.o(.rodata); data/fossil_special_fldeff_groundshake.o(.rodata); src/berry_fix_program.o(.rodata); data/pokemon_summary_screen.o(.rodata); diff --git a/src/battle_2.c b/src/battle_2.c index 16c07114a..24b43bdbd 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -85,7 +85,7 @@ extern u16 gTrainerBattleOpponent_B; extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT]; extern void (*gPreBattleCallback1)(void); extern void (*gBattleMainFunc)(void); -extern void (*gUnknown_030061E8)(void); +extern void (*gCB2_AfterEvolution)(void); extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for? extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for? extern u8 gUnknown_02039B28[]; // possibly a struct? @@ -238,7 +238,6 @@ static void sub_8038F34(void); static void sub_80392A8(void); static void sub_803937C(void); static void sub_803939C(void); -void oac_poke_opponent(struct Sprite *sprite); static void sub_803980C(struct Sprite *sprite); static void sub_8039838(struct Sprite *sprite); static void sub_8039894(struct Sprite *sprite); @@ -2121,7 +2120,7 @@ static void sub_8038F34(void) if (sub_800A520() == TRUE) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2247,17 +2246,17 @@ static void sub_803939C(void) case 3: if (!gPaletteFade.active) { - sub_814F9EC(gText_RecordBattleToPass, 0); + BattleHandleAddTextPrinter(gText_RecordBattleToPass, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; case 4: if (!IsTextPrinterActive(0)) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2267,9 +2266,9 @@ static void sub_803939C(void) if (gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } } else if (gMain.newKeys & DPAD_DOWN) @@ -2277,9 +2276,9 @@ static void sub_803939C(void) if (gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } } else if (gMain.newKeys & A_BUTTON) @@ -2287,7 +2286,7 @@ static void sub_803939C(void) PlaySE(SE_SELECT); if (gBattleCommunication[CURSOR_POSITION] == 0) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattleCommunication[1] = MoveRecordedBattleToSaveData(); gBattleCommunication[MULTIUSE_STATE] = 10; } @@ -2305,11 +2304,11 @@ static void sub_803939C(void) case 6: if (sub_800A520() == TRUE) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -2340,14 +2339,14 @@ static void sub_803939C(void) { PlaySE(SE_SAVE); BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordedOnPass); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } else { BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordCouldntBeSaved); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } @@ -2358,7 +2357,7 @@ static void sub_803939C(void) if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -3690,7 +3689,7 @@ static void TryDoEventsBeforeFirstTurn(void) TurnValuesCleanUp(FALSE); SpecialStatusesClear(); *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; ResetSentPokesToOpponentValue(); @@ -3797,7 +3796,7 @@ void BattleTurnPassed(void) *(gBattleStruct->field_5C + i) = 6; *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; gRandomTurnNumber = Random(); @@ -4025,7 +4024,7 @@ static void HandleTurnActionSelectionState(void) } else { - EmitOpenBag(0, gBattleStruct->field_60[gActiveBank]); + EmitChooseItem(0, gBattleStruct->field_60[gActiveBank]); MarkBufferBankForExecution(gActiveBank); } break; @@ -4070,7 +4069,7 @@ static void HandleTurnActionSelectionState(void) } break; case ACTION_POKEBLOCK_CASE: - EmitOpenBag(0, gBattleStruct->field_60[gActiveBank]); + EmitChooseItem(0, gBattleStruct->field_60[gActiveBank]); MarkBufferBankForExecution(gActiveBank); break; case ACTION_CANCEL_PARTNER: @@ -4939,7 +4938,7 @@ static void HandleEndTurn_FinishBattle(void) BeginFastPaletteFade(3); FadeOutMapMusic(5); gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions; - gUnknown_030061E8 = BattleMainCB2; + gCB2_AfterEvolution = BattleMainCB2; } else { diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index d86be6fad..a57df85fb 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void) && gDisableStructs[gActiveBank].perishSong1 == 0) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) { // we found a mon *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void) if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void) if (Random() & 1) { *(gBattleStruct->field_294 + gActiveBank) = 6; - EmitCmd33(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0) { *(gBattleStruct->field_294 + gActiveBank) = i; - EmitCmd33(1, 2, 0); + EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void) } } - EmitCmd33(1, 0, (gActiveBank ^ BIT_SIDE) << 8); + EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBank ^ BIT_SIDE) << 8); } #define TYPE_FORESIGHT 0xFE @@ -940,8 +940,8 @@ static bool8 ShouldUseItem(void) if (shouldUse) { - EmitCmd33(1, 1, 0); - *(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item; + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + *(gBattleStruct->chosenItem + (gActiveBank / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; } diff --git a/src/battle_anim.c b/src/battle_anim.c index 023272017..fa3ac73be 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -47,18 +47,6 @@ extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; extern const struct BattleAnimBackground gBattleAnimBackgroundTable[]; -extern void sub_80A8278(void); // rom_80A5C6C.s -extern void sub_80A6B30(struct UnknownAnimStruct2*); // rom_80A5C6C.s -extern void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); // rom_80A5C6C.s -extern u8 sub_80A82E4(u8 bank); // rom_80A5C6C.s -extern u8 sub_80A5C6C(u8 bank, u8 attributeId); // rom_80A5C6C.s -extern bool8 AnimBankSpriteExists(u8 bank); // rom_80A5C6C.s -extern void sub_80A6C68(u8 arg0); // rom_80A5C6C.s -extern u8 GetAnimBankSpriteId(u8 wantedBank); // rom_80A5C6C.s -extern u8 sub_80A6D94(void); -extern u8 sub_80A8364(u8); -extern bool8 IsDoubleBattle(void); - // this file's functions static void ScriptCmd_loadspritegfx(void); static void ScriptCmd_unloadspritegfx(void); @@ -234,10 +222,10 @@ void DoMoveAnim(u16 move) { gAnimBankAttacker = gBankAttacker; gAnimBankTarget = gBankTarget; - DoBattleAnim(gBattleAnims_Moves, move, TRUE); + LaunchBattleAnimation(gBattleAnims_Moves, move, TRUE); } -void DoBattleAnim(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim) +void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim) { s32 i; @@ -672,7 +660,7 @@ bool8 IsAnimBankSpriteVisible(u8 bank) else return FALSE; } - if (!AnimBankSpriteExists(bank)) + if (!IsBankSpritePresent(bank)) return FALSE; if (IsContest()) return TRUE; // this line wont ever be reached. @@ -1281,7 +1269,7 @@ static void ScriptCmd_changebg(void) s8 BattleAnimAdjustPanning(s8 pan) { - if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].flag_x10) + if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive) { if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER) pan = PAN_SIDE_OPPONENT; @@ -1323,7 +1311,7 @@ s8 BattleAnimAdjustPanning(s8 pan) s8 BattleAnimAdjustPanning2(s8 pan) { - if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].flag_x10) + if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive) { if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER) pan = PAN_SIDE_OPPONENT; diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c new file mode 100644 index 000000000..968f6d49f --- /dev/null +++ b/src/battle_controller_link_opponent.c @@ -0,0 +1,1891 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "battle_link_817C95C.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern u16 gTrainerBattleOpponent_A; +extern u16 gTrainerBattleOpponent_B; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; +extern const u8 gUnknown_0831F578[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); +extern void sub_81851A8(u8 *); +extern u16 sub_8068B48(void); + +// this file's functions +static void LinkOpponentHandleGetMonData(void); +static void LinkOpponentHandleGetRawMonData(void); +static void LinkOpponentHandleSetMonData(void); +static void LinkOpponentHandleSetRawMonData(void); +static void LinkOpponentHandleLoadMonSprite(void); +static void LinkOpponentHandleSwitchInAnim(void); +static void LinkOpponentHandleReturnMonToBall(void); +static void LinkOpponentHandleDrawTrainerPic(void); +static void LinkOpponentHandleTrainerSlide(void); +static void LinkOpponentHandleTrainerSlideBack(void); +static void LinkOpponentHandleFaintAnimation(void); +static void LinkOpponentHandlePaletteFade(void); +static void LinkOpponentHandleSuccessBallThrowAnim(void); +static void LinkOpponentHandleBallThrowAnim(void); +static void LinkOpponentHandlePause(void); +static void LinkOpponentHandleMoveAnimation(void); +static void LinkOpponentHandlePrintString(void); +static void LinkOpponentHandlePrintStringPlayerOnly(void); +static void LinkOpponentHandleChooseAction(void); +static void LinkOpponentHandleUnknownYesNoBox(void); +static void LinkOpponentHandleChooseMove(void); +static void LinkOpponentHandleChooseItem(void); +static void LinkOpponentHandleChoosePokemon(void); +static void LinkOpponentHandleCmd23(void); +static void LinkOpponentHandleHealthBarUpdate(void); +static void LinkOpponentHandleExpUpdate(void); +static void LinkOpponentHandleStatusIconUpdate(void); +static void LinkOpponentHandleStatusAnimation(void); +static void LinkOpponentHandleStatusXor(void); +static void LinkOpponentHandleDataTransfer(void); +static void LinkOpponentHandleDMA3Transfer(void); +static void LinkOpponentHandlePlayBGM(void); +static void LinkOpponentHandleCmd32(void); +static void LinkOpponentHandleTwoReturnValues(void); +static void LinkOpponentHandleChosenMonReturnValue(void); +static void LinkOpponentHandleOneReturnValue(void); +static void LinkOpponentHandleOneReturnValue_Duplicate(void); +static void LinkOpponentHandleCmd37(void); +static void LinkOpponentHandleCmd38(void); +static void LinkOpponentHandleCmd39(void); +static void LinkOpponentHandleCmd40(void); +static void LinkOpponentHandleHitAnimation(void); +static void LinkOpponentHandleCmd42(void); +static void LinkOpponentHandleEffectivenessSound(void); +static void LinkOpponentHandlePlayFanfareOrBGM(void); +static void LinkOpponentHandleFaintingCry(void); +static void LinkOpponentHandleIntroSlide(void); +static void LinkOpponentHandleIntroTrainerBallThrow(void); +static void LinkOpponentHandleDrawPartyStatusSummary(void); +static void LinkOpponentHandleCmd49(void); +static void LinkOpponentHandleCmd50(void); +static void LinkOpponentHandleSpriteInvisibility(void); +static void LinkOpponentHandleBattleAnimation(void); +static void LinkOpponentHandleLinkStandbyMsg(void); +static void LinkOpponentHandleResetActionMoveSelection(void); +static void LinkOpponentHandleCmd55(void); +static void nullsub_92(void); + +static void LinkOpponentBufferRunCommand(void); +static void LinkOpponentBufferExecCompleted(void); +static void sub_8064DD0(void); +static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst); +static void SetLinkOpponentMonData(u8 monId); +static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void LinkOpponentDoMoveAnimation(void); +static void sub_8067618(u8 taskId); +static void sub_80676FC(struct Sprite *sprite); +static void sub_806782C(void); + +static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + LinkOpponentHandleGetMonData, + LinkOpponentHandleGetRawMonData, + LinkOpponentHandleSetMonData, + LinkOpponentHandleSetRawMonData, + LinkOpponentHandleLoadMonSprite, + LinkOpponentHandleSwitchInAnim, + LinkOpponentHandleReturnMonToBall, + LinkOpponentHandleDrawTrainerPic, + LinkOpponentHandleTrainerSlide, + LinkOpponentHandleTrainerSlideBack, + LinkOpponentHandleFaintAnimation, + LinkOpponentHandlePaletteFade, + LinkOpponentHandleSuccessBallThrowAnim, + LinkOpponentHandleBallThrowAnim, + LinkOpponentHandlePause, + LinkOpponentHandleMoveAnimation, + LinkOpponentHandlePrintString, + LinkOpponentHandlePrintStringPlayerOnly, + LinkOpponentHandleChooseAction, + LinkOpponentHandleUnknownYesNoBox, + LinkOpponentHandleChooseMove, + LinkOpponentHandleChooseItem, + LinkOpponentHandleChoosePokemon, + LinkOpponentHandleCmd23, + LinkOpponentHandleHealthBarUpdate, + LinkOpponentHandleExpUpdate, + LinkOpponentHandleStatusIconUpdate, + LinkOpponentHandleStatusAnimation, + LinkOpponentHandleStatusXor, + LinkOpponentHandleDataTransfer, + LinkOpponentHandleDMA3Transfer, + LinkOpponentHandlePlayBGM, + LinkOpponentHandleCmd32, + LinkOpponentHandleTwoReturnValues, + LinkOpponentHandleChosenMonReturnValue, + LinkOpponentHandleOneReturnValue, + LinkOpponentHandleOneReturnValue_Duplicate, + LinkOpponentHandleCmd37, + LinkOpponentHandleCmd38, + LinkOpponentHandleCmd39, + LinkOpponentHandleCmd40, + LinkOpponentHandleHitAnimation, + LinkOpponentHandleCmd42, + LinkOpponentHandleEffectivenessSound, + LinkOpponentHandlePlayFanfareOrBGM, + LinkOpponentHandleFaintingCry, + LinkOpponentHandleIntroSlide, + LinkOpponentHandleIntroTrainerBallThrow, + LinkOpponentHandleDrawPartyStatusSummary, + LinkOpponentHandleCmd49, + LinkOpponentHandleCmd50, + LinkOpponentHandleSpriteInvisibility, + LinkOpponentHandleBattleAnimation, + LinkOpponentHandleLinkStandbyMsg, + LinkOpponentHandleResetActionMoveSelection, + LinkOpponentHandleCmd55, + nullsub_92 +}; + +static void nullsub_28(void) +{ +} + +void SetControllerToLinkOpponent(void) +{ + gBattleBankFunc[gActiveBank] = LinkOpponentBufferRunCommand; +} + +static void LinkOpponentBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sLinkOpponentBufferCommands)) + sLinkOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + LinkOpponentBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + LinkOpponentBufferExecCompleted(); +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + LinkOpponentBufferExecCompleted(); +} + +static void sub_8064470(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_80644D8(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_8064520(void) +{ + bool32 r8 = FALSE; + bool32 r4 = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r8 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + r4 = TRUE; + } + + if (r8) + { + if (r4 || !IsAnimBankSpriteVisible(gActiveBank ^ BIT_MON)) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + return; + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + return; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + return; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) + { + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + } + } + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_80644D8; + } +} + +static void sub_8064734(void) +{ + bool32 r10 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + } + + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 1; + } + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x40 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x40 + && !IsCryPlayingOrClearCrySongs()) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + } + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r10 = TRUE; + } + + if (r10) + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) + { + if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 1) + return; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + } + + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + SetBankEnemyShadowSpriteCallback(gActiveBank ^ BIT_MON, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], MON_DATA_SPECIES)); + } + + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_8064520; + } + } +} + +static void sub_8064B04(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + else + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + LinkOpponentBufferExecCompleted(); + } + } + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_8064C14(void) +{ + if (!gSprites[gBankSpriteIds[gActiveBank]].inUse) + { + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkOpponentBufferExecCompleted(); + } +} + +static void sub_8064C58(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkOpponentBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + LinkOpponentBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + LinkOpponentBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_8064D60(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_8064DD0; + } +} + +static void sub_8064DD0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive && !IsCryPlayingOrClearCrySongs()) + { + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + || gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy_2) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + LinkOpponentBufferExecCompleted(); + } + } +} + +static void sub_8064E50(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + CopyBattleSpriteInvisibility(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_8064D60; + } +} + +static void sub_8064F40(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleBankFunc[gActiveBank] = sub_8064E50; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + LinkOpponentBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = LinkOpponentBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void LinkOpponentHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyLinkOpponentMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += CopyLinkOpponentMonData(i, monData + size); + monToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + LinkOpponentBufferExecCompleted(); +} + +static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void LinkOpponentHandleGetRawMonData(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetLinkOpponentMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetLinkOpponentMonData(i); + monToCheck >>= 1; + } + } + LinkOpponentBufferExecCompleted(); +} + +static void SetLinkOpponentMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } +} + +static void LinkOpponentHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleLoadMonSprite(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleBankFunc[gActiveBank] = sub_8064B04; +} + +static void LinkOpponentHandleSwitchInAnim(void) +{ + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + sub_8066494(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_8064F40; +} + +static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE); +} + +static void LinkOpponentHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkOpponentBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + gBattleBankFunc[gActiveBank] = sub_8064C58; + } + break; + } +} + +static void LinkOpponentHandleDrawTrainerPic(void) +{ + s16 xPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 152; + else // first mon + xPos = 200; + + if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) + { + if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) + trainerPicId = gUnknown_0831F578[0x4F]; + else + trainerPicId = gUnknown_0831F578[0x4E]; + } + else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) + { + if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) + trainerPicId = gUnknown_0831F578[0x51]; + else + trainerPicId = gUnknown_0831F578[0x50]; + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender); + } + } + } + else + { + xPos = 176; + if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + { + trainerPicId = sub_8068B48(); + } + else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN) + { + if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) + trainerPicId = gUnknown_0831F578[0x4F]; + else + trainerPicId = gUnknown_0831F578[0x4E]; + } + else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_SAPPHIRE) + { + if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) + trainerPicId = gUnknown_0831F578[0x51]; + else + trainerPicId = gUnknown_0831F578[0x50]; + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender); + } + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + xPos, + (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void LinkOpponentHandleTrainerSlide(void) +{ + u32 trainerPicId; + + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96; + gSprites[gBankSpriteIds[gActiveBank]].pos1.x += 32; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle bank function + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_8064470; +} + +static void LinkOpponentHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039934; + gBattleBankFunc[gActiveBank] = sub_8064C14; + } + } +} + +static void LinkOpponentHandlePaletteFade(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleSuccessBallThrowAnim(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleBallThrowAnim(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandlePause(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + LinkOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = LinkOpponentDoMoveAnimation; + sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); + } + } +} + +static void LinkOpponentDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + LinkOpponentBufferExecCompleted(); + } + break; + } +} + +static void LinkOpponentHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; + sub_817C95C(*stringId); +} + +static void LinkOpponentHandlePrintStringPlayerOnly(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChooseAction(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleUnknownYesNoBox(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChooseMove(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChooseItem(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChoosePokemon(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd23(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void LinkOpponentHandleExpUpdate(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkOpponentHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkOpponentHandleStatusXor(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleDataTransfer(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleDMA3Transfer(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandlePlayBGM(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd32(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleTwoReturnValues(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleChosenMonReturnValue(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleOneReturnValue(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleOneReturnValue_Duplicate(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + LinkOpponentBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void LinkOpponentHandleCmd42(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleFaintingCry(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, 25, 5); + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_80676FC); + + taskId = CreateTask(sub_8067618, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_28; +} + +static void sub_8067618(u8 taskId) +{ + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_8066494(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_8066494(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_8066494(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_8064734; + gActiveBank = savedActiveBank; + DestroyTask(taskId); +} + +static void sub_80676FC(struct Sprite *sprite) +{ + FreeTrainerFrontPicPalette(sprite->oam.affineParam); + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); +} + +static void LinkOpponentHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + LinkOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + + if (gBattleBufferA[gActiveBank][2] != 0) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E < 2) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E++; + return; + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E = 0; + } + } + + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_806782C; + } +} + +static void sub_806782C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + LinkOpponentBufferExecCompleted(); + } +} + +static void LinkOpponentHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd50(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleSpriteInvisibility(void) +{ + if (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + CopyBattleSpriteInvisibility(gActiveBank); + } + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + LinkOpponentBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + + sub_817E32C(animationId); + } +} + +static void LinkOpponentHandleLinkStandbyMsg(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][2]); + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleResetActionMoveSelection(void) +{ + LinkOpponentBufferExecCompleted(); +} + +static void LinkOpponentHandleCmd55(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][4]); + + if (gBattleBufferA[gActiveBank][1] == BATTLE_DREW) + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + else + gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ BATTLE_DREW; + + gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBank][2]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + LinkOpponentBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_92(void) +{ +} diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c new file mode 100644 index 000000000..4a70a4dc1 --- /dev/null +++ b/src/battle_controller_link_partner.c @@ -0,0 +1,1719 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "battle_link_817C95C.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); +extern void sub_81851A8(u8 *); + +// this file's functions +static void LinkPartnerHandleGetMonData(void); +static void LinkPartnerHandleGetRawMonData(void); +static void LinkPartnerHandleSetMonData(void); +static void LinkPartnerHandleSetRawMonData(void); +static void LinkPartnerHandleLoadMonSprite(void); +static void LinkPartnerHandleSwitchInAnim(void); +static void LinkPartnerHandleReturnMonToBall(void); +static void LinkPartnerHandleDrawTrainerPic(void); +static void LinkPartnerHandleTrainerSlide(void); +static void LinkPartnerHandleTrainerSlideBack(void); +static void LinkPartnerHandleFaintAnimation(void); +static void LinkPartnerHandlePaletteFade(void); +static void LinkPartnerHandleSuccessBallThrowAnim(void); +static void LinkPartnerHandleBallThrowAnim(void); +static void LinkPartnerHandlePause(void); +static void LinkPartnerHandleMoveAnimation(void); +static void LinkPartnerHandlePrintString(void); +static void LinkPartnerHandlePrintStringPlayerOnly(void); +static void LinkPartnerHandleChooseAction(void); +static void LinkPartnerHandleUnknownYesNoBox(void); +static void LinkPartnerHandleChooseMove(void); +static void LinkPartnerHandleChooseItem(void); +static void LinkPartnerHandleChoosePokemon(void); +static void LinkPartnerHandleCmd23(void); +static void LinkPartnerHandleHealthBarUpdate(void); +static void LinkPartnerHandleExpUpdate(void); +static void LinkPartnerHandleStatusIconUpdate(void); +static void LinkPartnerHandleStatusAnimation(void); +static void LinkPartnerHandleStatusXor(void); +static void LinkPartnerHandleDataTransfer(void); +static void LinkPartnerHandleDMA3Transfer(void); +static void LinkPartnerHandlePlayBGM(void); +static void LinkPartnerHandleCmd32(void); +static void LinkPartnerHandleTwoReturnValues(void); +static void LinkPartnerHandleChosenMonReturnValue(void); +static void LinkPartnerHandleOneReturnValue(void); +static void LinkPartnerHandleOneReturnValue_Duplicate(void); +static void LinkPartnerHandleCmd37(void); +static void LinkPartnerHandleCmd38(void); +static void LinkPartnerHandleCmd39(void); +static void LinkPartnerHandleCmd40(void); +static void LinkPartnerHandleHitAnimation(void); +static void LinkPartnerHandleCmd42(void); +static void LinkPartnerHandleEffectivenessSound(void); +static void LinkPartnerHandlePlayFanfareOrBGM(void); +static void LinkPartnerHandleFaintingCry(void); +static void LinkPartnerHandleIntroSlide(void); +static void LinkPartnerHandleIntroTrainerBallThrow(void); +static void LinkPartnerHandleDrawPartyStatusSummary(void); +static void LinkPartnerHandleCmd49(void); +static void LinkPartnerHandleCmd50(void); +static void LinkPartnerHandleSpriteInvisibility(void); +static void LinkPartnerHandleBattleAnimation(void); +static void LinkPartnerHandleLinkStandbyMsg(void); +static void LinkPartnerHandleResetActionMoveSelection(void); +static void LinkPartnerHandleCmd55(void); +static void nullsub_113(void); + +static void LinkPartnerBufferRunCommand(void); +static void LinkPartnerBufferExecCompleted(void); +static void sub_814B554(void); +static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst); +static void SetLinkPartnerMonData(u8 monId); +static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void LinkPartnerDoMoveAnimation(void); +static void sub_814DCCC(u8 taskId); +static void sub_814DE9C(void); + +static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + LinkPartnerHandleGetMonData, + LinkPartnerHandleGetRawMonData, + LinkPartnerHandleSetMonData, + LinkPartnerHandleSetRawMonData, + LinkPartnerHandleLoadMonSprite, + LinkPartnerHandleSwitchInAnim, + LinkPartnerHandleReturnMonToBall, + LinkPartnerHandleDrawTrainerPic, + LinkPartnerHandleTrainerSlide, + LinkPartnerHandleTrainerSlideBack, + LinkPartnerHandleFaintAnimation, + LinkPartnerHandlePaletteFade, + LinkPartnerHandleSuccessBallThrowAnim, + LinkPartnerHandleBallThrowAnim, + LinkPartnerHandlePause, + LinkPartnerHandleMoveAnimation, + LinkPartnerHandlePrintString, + LinkPartnerHandlePrintStringPlayerOnly, + LinkPartnerHandleChooseAction, + LinkPartnerHandleUnknownYesNoBox, + LinkPartnerHandleChooseMove, + LinkPartnerHandleChooseItem, + LinkPartnerHandleChoosePokemon, + LinkPartnerHandleCmd23, + LinkPartnerHandleHealthBarUpdate, + LinkPartnerHandleExpUpdate, + LinkPartnerHandleStatusIconUpdate, + LinkPartnerHandleStatusAnimation, + LinkPartnerHandleStatusXor, + LinkPartnerHandleDataTransfer, + LinkPartnerHandleDMA3Transfer, + LinkPartnerHandlePlayBGM, + LinkPartnerHandleCmd32, + LinkPartnerHandleTwoReturnValues, + LinkPartnerHandleChosenMonReturnValue, + LinkPartnerHandleOneReturnValue, + LinkPartnerHandleOneReturnValue_Duplicate, + LinkPartnerHandleCmd37, + LinkPartnerHandleCmd38, + LinkPartnerHandleCmd39, + LinkPartnerHandleCmd40, + LinkPartnerHandleHitAnimation, + LinkPartnerHandleCmd42, + LinkPartnerHandleEffectivenessSound, + LinkPartnerHandlePlayFanfareOrBGM, + LinkPartnerHandleFaintingCry, + LinkPartnerHandleIntroSlide, + LinkPartnerHandleIntroTrainerBallThrow, + LinkPartnerHandleDrawPartyStatusSummary, + LinkPartnerHandleCmd49, + LinkPartnerHandleCmd50, + LinkPartnerHandleSpriteInvisibility, + LinkPartnerHandleBattleAnimation, + LinkPartnerHandleLinkStandbyMsg, + LinkPartnerHandleResetActionMoveSelection, + LinkPartnerHandleCmd55, + nullsub_113 +}; + +static void nullsub_112(void) +{ +} + +void SetControllerToLinkPartner(void) +{ + gBattleBankFunc[gActiveBank] = LinkPartnerBufferRunCommand; +} + +static void LinkPartnerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sLinkPartnerBufferCommands)) + sLinkPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + LinkPartnerBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + LinkPartnerBufferExecCompleted(); +} + +static void sub_814AF54(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(0); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814AFBC(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B004(void) +{ + bool32 r6 = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (IsCryPlayingOrClearCrySongs()) + r6 = FALSE; + + if (r6) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_814AFBC; + } +} + +static void sub_814B0E8(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 != 1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + + gBattleBankFunc[gActiveBank] = sub_814B004; + } +} + +static void sub_814B290(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].animEnded && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + LinkPartnerBufferExecCompleted(); +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B340(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos1.y + gSprites[gBankSpriteIds[gActiveBank]].pos2.y > DISPLAY_HEIGHT) + { + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + nullsub_24(species); + FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBank]].oam.matrixNum); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B3DC(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkPartnerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + LinkPartnerBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + LinkPartnerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_814B4E0(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + CopyBattleSpriteInvisibility(gActiveBank); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_814B554; + } +} + +static void sub_814B554(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + LinkPartnerBufferExecCompleted(); + } +} + +static void sub_814B5A8(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleBankFunc[gActiveBank] = sub_814B4E0; + } +} + +static void sub_814B69C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + gBattleBankFunc[gActiveBank] = sub_814B5A8; + } +} + +static void LinkPartnerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = LinkPartnerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + LinkPartnerBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyLinkPartnerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += CopyLinkPartnerMonData(i, monData + size); + monToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + LinkPartnerBufferExecCompleted(); +} + +static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void LinkPartnerHandleGetRawMonData(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetLinkPartnerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetLinkPartnerMonData(i); + monToCheck >>= 1; + } + } + LinkPartnerBufferExecCompleted(); +} + +static void SetLinkPartnerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void LinkPartnerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleLoadMonSprite(void) +{ + u16 species; + + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_814B290; +} + +static void LinkPartnerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_814CC98(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_814B69C; +} + +static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void LinkPartnerHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + LinkPartnerBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + gBattleBankFunc[gActiveBank] = sub_814B3DC; + } + break; + } +} + +static void LinkPartnerHandleDrawTrainerPic(void) +{ + s16 xPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 90; + else // first mon + xPos = 32; + } + else + { + xPos = 80; + } + + if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender; + } + + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void LinkPartnerHandleTrainerSlide(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_814AF54; +} + +static void LinkPartnerHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_814B340; + } + } +} + +static void LinkPartnerHandlePaletteFade(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleSuccessBallThrowAnim(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleBallThrowAnim(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandlePause(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + LinkPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = LinkPartnerDoMoveAnimation; + sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); + } + } +} + +static void LinkPartnerDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + LinkPartnerBufferExecCompleted(); + } + break; + } +} + +static void LinkPartnerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; + sub_817C95C(*stringId); +} + +static void LinkPartnerHandlePrintStringPlayerOnly(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChooseAction(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleUnknownYesNoBox(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChooseMove(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChooseItem(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChoosePokemon(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd23(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void LinkPartnerHandleExpUpdate(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkPartnerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void LinkPartnerHandleStatusXor(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleDataTransfer(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleDMA3Transfer(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandlePlayBGM(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd32(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleTwoReturnValues(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleChosenMonReturnValue(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleOneReturnValue(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleOneReturnValue_Duplicate(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + LinkPartnerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void LinkPartnerHandleCmd42(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + u32 trainerPicId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F9); + + if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender; + } + + LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_814DCCC, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_112; +} + +static void sub_814DCCC(u8 taskId) +{ + if (gTasks[taskId].data[1] < 24) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_814CC98(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_814CC98(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_814CC98(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_814B0E8; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void LinkPartnerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + LinkPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_814DE9C; + } +} + +static void sub_814DE9C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + LinkPartnerBufferExecCompleted(); + } +} + +static void LinkPartnerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd50(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleSpriteInvisibility(void) +{ + if (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + CopyBattleSpriteInvisibility(gActiveBank); + } + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + LinkPartnerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + + sub_817E32C(animationId); + } +} + +static void LinkPartnerHandleLinkStandbyMsg(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][2]); + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleResetActionMoveSelection(void) +{ + LinkPartnerBufferExecCompleted(); +} + +static void LinkPartnerHandleCmd55(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][4]); + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBank][2]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + LinkPartnerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_113(void) +{ +} diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c new file mode 100644 index 000000000..7ffd9d64b --- /dev/null +++ b/src/battle_controller_opponent.c @@ -0,0 +1,2033 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_link_817C95C.h" +#include "battle_ai_script_commands.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "item.h" +#include "items.h" +#include "songs.h" +#include "sound.h" +#include "moves.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "rng.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern bool8 gDoingBattleAnim; +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void *gUnknown_020244D8; +extern void *gUnknown_020244DC; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern u16 gTrainerBattleOpponent_A; +extern u16 gTrainerBattleOpponent_B; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_020244B4[]; +extern void (*gPreBattleCallback1)(void); + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); +extern void sub_81A57E4(u8 bank, u16 stringId); +extern u8 sub_81A4CB0(void); +extern u8 sub_81D5588(u16 trainerId); +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 GetEreaderTrainerFrontSpriteId(void); + +// this file's functions +static void OpponentHandleGetMonData(void); +static void OpponentHandleGetRawMonData(void); +static void OpponentHandleSetMonData(void); +static void OpponentHandleSetRawMonData(void); +static void OpponentHandleLoadMonSprite(void); +static void OpponentHandleSwitchInAnim(void); +static void OpponentHandleReturnMonToBall(void); +static void OpponentHandleDrawTrainerPic(void); +static void OpponentHandleTrainerSlide(void); +static void OpponentHandleTrainerSlideBack(void); +static void OpponentHandleFaintAnimation(void); +static void OpponentHandlePaletteFade(void); +static void OpponentHandleSuccessBallThrowAnim(void); +static void OpponentHandleBallThrow(void); +static void OpponentHandlePause(void); +static void OpponentHandleMoveAnimation(void); +static void OpponentHandlePrintString(void); +static void OpponentHandlePrintStringPlayerOnly(void); +static void OpponentHandleChooseAction(void); +static void OpponentHandleUnknownYesNoBox(void); +static void OpponentHandleChooseMove(void); +static void OpponentHandleChooseItem(void); +static void OpponentHandleChoosePokemon(void); +static void OpponentHandleCmd23(void); +static void OpponentHandleHealthBarUpdate(void); +static void OpponentHandleExpUpdate(void); +static void OpponentHandleStatusIconUpdate(void); +static void OpponentHandleStatusAnimation(void); +static void OpponentHandleStatusXor(void); +static void OpponentHandleDataTransfer(void); +static void OpponentHandleDMA3Transfer(void); +static void OpponentHandlePlayBGM(void); +static void OpponentHandleCmd32(void); +static void OpponentHandleTwoReturnValues(void); +static void OpponentHandleChosenMonReturnValue(void); +static void OpponentHandleOneReturnValue(void); +static void OpponentHandleOneReturnValue_Duplicate(void); +static void OpponentHandleCmd37(void); +static void OpponentHandleCmd38(void); +static void OpponentHandleCmd39(void); +static void OpponentHandleCmd40(void); +static void OpponentHandleHitAnimation(void); +static void OpponentHandleCmd42(void); +static void OpponentHandleEffectivenessSound(void); +static void OpponentHandlePlayFanfareOrBGM(void); +static void OpponentHandleFaintingCry(void); +static void OpponentHandleIntroSlide(void); +static void OpponentHandleIntroTrainerBallThrow(void); +static void OpponentHandleDrawPartyStatusSummary(void); +static void OpponentHandleCmd49(void); +static void OpponentHandleCmd50(void); +static void OpponentHandleSpriteInvisibility(void); +static void OpponentHandleBattleAnimation(void); +static void OpponentHandleLinkStandbyMsg(void); +static void OpponentHandleResetActionMoveSelection(void); +static void OpponentHandleCmd55(void); +static void nullsub_91(void); + +static void OpponentBufferRunCommand(void); +static void OpponentBufferExecCompleted(void); +static void sub_805FC80(void); +static u32 GetOpponentMonData(u8 monId, u8 *dst); +static void SetOpponentMonData(u8 monId); +static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void OpponentDoMoveAnimation(void); +static void sub_806280C(struct Sprite *sprite); +static void sub_8062828(u8 taskId); +static void sub_8062A2C(void); + +static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + OpponentHandleGetMonData, + OpponentHandleGetRawMonData, + OpponentHandleSetMonData, + OpponentHandleSetRawMonData, + OpponentHandleLoadMonSprite, + OpponentHandleSwitchInAnim, + OpponentHandleReturnMonToBall, + OpponentHandleDrawTrainerPic, + OpponentHandleTrainerSlide, + OpponentHandleTrainerSlideBack, + OpponentHandleFaintAnimation, + OpponentHandlePaletteFade, + OpponentHandleSuccessBallThrowAnim, + OpponentHandleBallThrow, + OpponentHandlePause, + OpponentHandleMoveAnimation, + OpponentHandlePrintString, + OpponentHandlePrintStringPlayerOnly, + OpponentHandleChooseAction, + OpponentHandleUnknownYesNoBox, + OpponentHandleChooseMove, + OpponentHandleChooseItem, + OpponentHandleChoosePokemon, + OpponentHandleCmd23, + OpponentHandleHealthBarUpdate, + OpponentHandleExpUpdate, + OpponentHandleStatusIconUpdate, + OpponentHandleStatusAnimation, + OpponentHandleStatusXor, + OpponentHandleDataTransfer, + OpponentHandleDMA3Transfer, + OpponentHandlePlayBGM, + OpponentHandleCmd32, + OpponentHandleTwoReturnValues, + OpponentHandleChosenMonReturnValue, + OpponentHandleOneReturnValue, + OpponentHandleOneReturnValue_Duplicate, + OpponentHandleCmd37, + OpponentHandleCmd38, + OpponentHandleCmd39, + OpponentHandleCmd40, + OpponentHandleHitAnimation, + OpponentHandleCmd42, + OpponentHandleEffectivenessSound, + OpponentHandlePlayFanfareOrBGM, + OpponentHandleFaintingCry, + OpponentHandleIntroSlide, + OpponentHandleIntroTrainerBallThrow, + OpponentHandleDrawPartyStatusSummary, + OpponentHandleCmd49, + OpponentHandleCmd50, + OpponentHandleSpriteInvisibility, + OpponentHandleBattleAnimation, + OpponentHandleLinkStandbyMsg, + OpponentHandleResetActionMoveSelection, + OpponentHandleCmd55, + nullsub_91 +}; + +// unknown unused data +static const u8 sUnknown_0831C7AC[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20}; + +static void nullsub_26(void) +{ +} + +void SetControllerToOpponent(void) +{ + gBattleBankFunc[gActiveBank] = OpponentBufferRunCommand; +} + +static void OpponentBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sOpponentBufferCommands)) + sOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + OpponentBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + OpponentBufferExecCompleted(); +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + OpponentBufferExecCompleted(); +} + +static void sub_805F240(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + OpponentBufferExecCompleted(); + } +} + +static void sub_805F2A8(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + OpponentBufferExecCompleted(); + } +} + +static void sub_805F2F0(void) +{ + bool8 var = FALSE; + bool8 var2; + + if (!IsDoubleBattle() || ((IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) || (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + var = TRUE; + var2 = FALSE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + var = TRUE; + var2 = TRUE; + } + + gUnknown_020244D8 = &gBattleSpritesDataPtr->healthBoxesData[gActiveBank]; + gUnknown_020244DC = &gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON]; + + if (var) + { + if (var2 == TRUE) + { + if (var2 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + } + else + return; + } + else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + if (GetBankIdentity(gActiveBank) == 3) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 == 0 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 == 0) + { + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + } + else + return; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + } + else + return; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_805F2A8; + } +} + +static void sub_805F560(void) +{ + bool32 sp = FALSE; + bool32 r10 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI) && IsDoubleBattle() && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 1; + } + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x40 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x40 + && !IsCryPlayingOrClearCrySongs()) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (GetBankIdentity(gActiveBank) == 1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + sp = TRUE; + } + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + r10 = TRUE; + } + } + else + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r10 = TRUE; + } + } + + if (sp && r10) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + SetBankEnemyShadowSpriteCallback(gActiveBank ^ BIT_MON, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], MON_DATA_SPECIES)); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_805F2F0; + } +} + +static void sub_805F994(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + OpponentBufferExecCompleted(); + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + OpponentBufferExecCompleted(); +} + +static void sub_805FAC4(void) +{ + if (!gSprites[gBankSpriteIds[gActiveBank]].inUse) + { + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + OpponentBufferExecCompleted(); + } +} + +static void sub_805FB08(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + OpponentBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + OpponentBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + OpponentBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_805FC10(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleBankFunc[gActiveBank] = sub_805FC80; + } +} + +static void sub_805FC80(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive && !IsCryPlayingOrClearCrySongs()) + { + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy || gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy_2) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + OpponentBufferExecCompleted(); + } + } +} + +static void sub_805FD00(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + CopyBattleSpriteInvisibility(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_805FC10; + } +} + +static void sub_805FDF0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleBankFunc[gActiveBank] = sub_805FD00; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + OpponentBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + OpponentBufferExecCompleted(); +} + +static void OpponentBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = OpponentBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void OpponentHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += GetOpponentMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += GetOpponentMonData(i, monData + size); + monToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + OpponentBufferExecCompleted(); +} + +static u32 GetOpponentMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void OpponentHandleGetRawMonData(void) +{ + struct BattlePokemon battleMon; + u8 *src = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 *dst = (u8 *)&battleMon + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = src[i]; + + EmitDataTransfer(1, gBattleBufferA[gActiveBank][2], dst); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetOpponentMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetOpponentMonData(i); + monToCheck >>= 1; + } + } + OpponentBufferExecCompleted(); +} + +static void SetOpponentMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } +} + +static void OpponentHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + OpponentBufferExecCompleted(); +} + +static void OpponentHandleLoadMonSprite(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].data2 = species; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleBankFunc[gActiveBank] = sub_805F994; +} + +static void OpponentHandleSwitchInAnim(void) +{ + *(gBattleStruct->field_5C + gActiveBank) = 6; + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + sub_80613DC(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_805FDF0; +} + +static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE); +} + +static void OpponentHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + OpponentBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + gBattleBankFunc[gActiveBank] = sub_805FB08; + } + break; + } +} + +static void OpponentHandleDrawTrainerPic(void) +{ + u32 trainerPicId; + s16 xPos; + + if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) + { + trainerPicId = GetSecretBaseTrainerPicIndex(); + } + else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE) + { + trainerPicId = sub_81A4CB0(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_x4000000) + { + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank == 1) + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + else + trainerPicId = sub_81D5588(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + { + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_EREADER_TRAINER) + { + trainerPicId = GetEreaderTrainerFrontSpriteId(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank != 1) + trainerPicId = gTrainers[gTrainerBattleOpponent_B].trainerPic; + else + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + else + { + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + + if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS)) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 152; + else // first mon + xPos = 200; + } + else + { + xPos = 176; + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + xPos, + (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void OpponentHandleTrainerSlide(void) +{ + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) + { + trainerPicId = GetSecretBaseTrainerPicIndex(); + } + else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE) + { + trainerPicId = sub_81A4CB0(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_x4000000) + { + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank == 1) + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + else + trainerPicId = sub_81D5588(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = sub_81D5588(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + { + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + } + } + else if (gBattleTypeFlags & BATTLE_TYPE_EREADER_TRAINER) + { + trainerPicId = GetEreaderTrainerFrontSpriteId(); + } + else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + if (gActiveBank != 1) + trainerPicId = gTrainers[gTrainerBattleOpponent_B].trainerPic; + else + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + else + { + trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96; + gSprites[gBankSpriteIds[gActiveBank]].pos1.x += 32; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; +} + +static void OpponentHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_805F240; +} + +static void OpponentHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039934; + gBattleBankFunc[gActiveBank] = sub_805FAC4; + } + } +} + +static void OpponentHandlePaletteFade(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleSuccessBallThrowAnim(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleBallThrow(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandlePause(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + OpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = OpponentDoMoveAnimation; + } + } +} + +static void OpponentDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + OpponentBufferExecCompleted(); + } + break; + } +} + +static void OpponentHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; + sub_81A57E4(gActiveBank, *stringId); +} + +static void OpponentHandlePrintStringPlayerOnly(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleChooseAction(void) +{ + AI_TrySwitchOrUseItem(); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleUnknownYesNoBox(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + OpponentBufferExecCompleted(); + } + else + { + u8 chosenMoveId; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER)) + { + + BattleAI_SetupAIData(0xF); + chosenMoveId = BattleAI_ChooseMoveOrAction(); + + switch (chosenMoveId) + { + case 5: + EmitTwoReturnValues(1, ACTION_WATCHES_CAREFULLY, 0); + break; + case 4: + EmitTwoReturnValues(1, ACTION_RUN, 0); + break; + case 6: + EmitTwoReturnValues(1, 15, gBankTarget); + break; + default: + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_x10)) + gBankTarget = gActiveBank; + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) + { + gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON1); + if (gAbsentBankFlags & gBitTable[gBankTarget]) + gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); + } + EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBankTarget << 8)); + break; + } + OpponentBufferExecCompleted(); + } + else + { + u16 move; + do + { + chosenMoveId = Random() & 3; + move = moveInfo->moves[chosenMoveId]; + } while (move == MOVE_NONE); + + if (gBattleMoves[move].target & (MOVE_TARGET_USER | MOVE_TARGET_x10)) + EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBank << 8)); + else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(Random() & 2) << 8)); + else + EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(IDENTITY_PLAYER_MON1) << 8)); + + OpponentBufferExecCompleted(); + } + } +} + +static void OpponentHandleChooseItem(void) +{ + EmitOneReturnValue(1, *(gBattleStruct->chosenItem + (gActiveBank / 2) * 2)); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleChoosePokemon(void) +{ + s32 chosenMonId; + + if (*(gBattleStruct->field_294 + gActiveBank) == 6) + { + chosenMonId = GetMostSuitableMonToSwitchInto(); + + if (chosenMonId == 6) + { + s32 bank1, bank2, firstId, lastId; + + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + { + bank2 = bank1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + } + else + { + bank1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + bank2 = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + } + + if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) + { + if (gActiveBank == 1) + firstId = 0, lastId = 3; + else + firstId = 3, lastId = 6; + } + else + { + firstId = 0, lastId = 6; + } + + for (chosenMonId = firstId; chosenMonId < lastId; chosenMonId++) + { + if (GetMonData(&gEnemyParty[chosenMonId], MON_DATA_HP) != 0 + && chosenMonId != gBattlePartyID[bank1] + && chosenMonId != gBattlePartyID[bank2]) + { + break; + } + } + } + } + else + { + chosenMonId = *(gBattleStruct->field_294 + gActiveBank); + *(gBattleStruct->field_294 + gActiveBank) = 6; + } + + + *(gBattleStruct->field_5C + gActiveBank) = chosenMonId; + EmitChosenMonReturnValue(1, chosenMonId, NULL); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd23(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = (gBattleBufferA[gActiveBank][3] << 8) | gBattleBufferA[gActiveBank][2]; + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void OpponentHandleExpUpdate(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void OpponentHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void OpponentHandleStatusXor(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleDataTransfer(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleDMA3Transfer(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandlePlayBGM(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd32(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleTwoReturnValues(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleChosenMonReturnValue(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleOneReturnValue(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleOneReturnValue_Duplicate(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + OpponentBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void OpponentHandleCmd42(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + OpponentBufferExecCompleted(); +} + +static void OpponentHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + OpponentBufferExecCompleted(); +} + +static void OpponentHandleFaintingCry(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, 25, 5); + OpponentBufferExecCompleted(); +} + +static void OpponentHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_806280C); + + taskId = CreateTask(sub_8062828, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_26; +} + +static void sub_806280C(struct Sprite *sprite) +{ + FreeTrainerFrontPicPalette(sprite->oam.affineParam); + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); +} + +static void sub_8062828(u8 taskId) +{ + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + } + else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_80613DC(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_805F560; + gActiveBank = savedActiveBank; + DestroyTask(taskId); +} + +static void OpponentHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + OpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + + if (gBattleBufferA[gActiveBank][2] != 0) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E < 2) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E++; + return; + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E = 0; + } + } + + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_8062A2C; + } +} + +static void sub_8062A2C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + OpponentBufferExecCompleted(); + } +} + +static void OpponentHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd50(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleSpriteInvisibility(void) +{ + if (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + CopyBattleSpriteInvisibility(gActiveBank); + } + OpponentBufferExecCompleted(); +} + +static void OpponentHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + OpponentBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void OpponentHandleLinkStandbyMsg(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleResetActionMoveSelection(void) +{ + OpponentBufferExecCompleted(); +} + +static void OpponentHandleCmd55(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_LINK && !(gBattleTypeFlags & BATTLE_TYPE_WILD)) + { + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(gMain.savedCallback); + } + OpponentBufferExecCompleted(); +} + +static void nullsub_91(void) +{ +} diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c new file mode 100644 index 000000000..10d361cb9 --- /dev/null +++ b/src/battle_controller_player.c @@ -0,0 +1,3150 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_link_817C95C.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "item.h" +#include "items.h" +#include "songs.h" +#include "sound.h" +#include "moves.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "rng.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gAbsentBankFlags; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern u8 gPlayerDpadHoldFrames; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern u8 gMultiUsePlayerCursor; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern u16 gPartnerTrainerId; +extern struct SpriteTemplate gUnknown_0202499C; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gScriptItemId; +extern u8 gUnknown_0203CEE8; +extern u8 gUnknown_0203CEE9; +extern u8 gUnknown_0203CF00[]; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u8 gNumberOfMovesToChoose; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern s32 gUnknown_0203CD70; +extern u8 gBankInMenu; +extern u32 gBattlePalaceMoveSelectionRngValue; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u8 gUnknown_020244B4[]; +extern u16 gUnknown_020243FC; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const u8 gTypeNames[][7]; +extern const struct BattleMove gBattleMoves[]; + +extern const u8 gText_BattleSwitchWhich[]; +extern const u8 gText_MoveInterfacePP[]; +extern const u8 gText_MoveInterfaceType[]; +extern const u8 gText_LinkStandby[]; +extern const u8 gText_BattleMenu[]; +extern const u8 gText_WhatWillPkmnDo[]; +extern const u8 gText_BattleYesNoChoice[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_81B89AC(u8 arg0); +extern void sub_81AABB0(void); +extern void sub_806A068(u16, u8); +extern void sub_81A57E4(u8 bank, u16 stringId); +extern void sub_81851A8(u8 *); + +// this file's functions +static void PlayerHandleGetMonData(void); +void PlayerHandleGetRawMonData(void); +static void PlayerHandleSetMonData(void); +static void PlayerHandleSetRawMonData(void); +static void PlayerHandleLoadMonSprite(void); +static void PlayerHandleSwitchInAnim(void); +static void PlayerHandleReturnMonToBall(void); +static void PlayerHandleDrawTrainerPic(void); +static void PlayerHandleTrainerSlide(void); +static void PlayerHandleTrainerSlideBack(void); +static void PlayerHandleFaintAnimation(void); +static void PlayerHandlePaletteFade(void); +static void PlayerHandleSuccessBallThrowAnim(void); +static void PlayerHandleBallThrowAnim(void); +static void PlayerHandlePause(void); +static void PlayerHandleMoveAnimation(void); +static void PlayerHandlePrintString(void); +static void PlayerHandlePrintStringPlayerOnly(void); +static void PlayerHandleChooseAction(void); +static void PlayerHandleUnknownYesNoBox(void); +static void PlayerHandleChooseMove(void); +static void PlayerHandleChooseItem(void); +static void PlayerHandleChoosePokemon(void); +static void PlayerHandleCmd23(void); +static void PlayerHandleHealthBarUpdate(void); +static void PlayerHandleExpUpdate(void); +static void PlayerHandleStatusIconUpdate(void); +static void PlayerHandleStatusAnimation(void); +static void PlayerHandleStatusXor(void); +static void PlayerHandleDataTransfer(void); +static void PlayerHandleDMA3Transfer(void); +static void PlayerHandlePlayBGM(void); +static void PlayerHandleCmd32(void); +static void PlayerHandleTwoReturnValues(void); +static void PlayerHandleChosenMonReturnValue(void); +static void PlayerHandleOneReturnValue(void); +static void PlayerHandleOneReturnValue_Duplicate(void); +static void PlayerHandleCmd37(void); +static void PlayerHandleCmd38(void); +static void PlayerHandleCmd39(void); +static void PlayerHandleCmd40(void); +static void PlayerHandleHitAnimation(void); +static void PlayerHandleCmd42(void); +static void PlayerHandleEffectivenessSound(void); +static void PlayerHandlePlayFanfareOrBGM(void); +static void PlayerHandleFaintingCry(void); +static void PlayerHandleIntroSlide(void); +static void PlayerHandleIntroTrainerBallThrow(void); +static void PlayerHandleDrawPartyStatusSummary(void); +static void PlayerHandleCmd49(void); +static void PlayerHandleCmd50(void); +static void PlayerHandleSpriteInvisibility(void); +static void PlayerHandleBattleAnimation(void); +static void PlayerHandleLinkStandbyMsg(void); +static void PlayerHandleResetActionMoveSelection(void); +static void PlayerHandleCmd55(void); +static void nullsub_22(void); + +static void PlayerBufferRunCommand(void); +static void HandleInputChooseTarget(void); +static void HandleInputChooseMove(void); +static void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1); +static void MoveSelectionDestroyCursorAt(u8 cursorPos); +static void MoveSelectionDisplayPpNumber(void); +static void MoveSelectionDisplayPpString(void); +static void MoveSelectionDisplayMoveType(void); +static void MoveSelectionDisplayMoveNames(void); +static void HandleMoveSwitchting(void); +static void sub_8058FC0(void); +static void sub_8059828(void); +static void CompleteWhenChoseItem(void); +static void sub_8059544(u8 taskId); +static void Task_PrepareToGiveExpWithExpBar(u8 taskId); +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); +static void sub_8059400(u8 taskId); +static void sub_80595A4(u8 taskId); +static void PrintLinkStandbyMsg(void); +static u32 CopyPlayerMonData(u8 monId, u8 *dst); +static void SetPlayerMonData(u8 monId); +static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void PlayerDoMoveAnimation(void); +static void task05_08033660(u8 taskId); +static void sub_805CE38(void); + +static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + PlayerHandleGetMonData, + PlayerHandleGetRawMonData, + PlayerHandleSetMonData, + PlayerHandleSetRawMonData, + PlayerHandleLoadMonSprite, + PlayerHandleSwitchInAnim, + PlayerHandleReturnMonToBall, + PlayerHandleDrawTrainerPic, + PlayerHandleTrainerSlide, + PlayerHandleTrainerSlideBack, + PlayerHandleFaintAnimation, + PlayerHandlePaletteFade, + PlayerHandleSuccessBallThrowAnim, + PlayerHandleBallThrowAnim, + PlayerHandlePause, + PlayerHandleMoveAnimation, + PlayerHandlePrintString, + PlayerHandlePrintStringPlayerOnly, + PlayerHandleChooseAction, + PlayerHandleUnknownYesNoBox, + PlayerHandleChooseMove, + PlayerHandleChooseItem, + PlayerHandleChoosePokemon, + PlayerHandleCmd23, + PlayerHandleHealthBarUpdate, + PlayerHandleExpUpdate, + PlayerHandleStatusIconUpdate, + PlayerHandleStatusAnimation, + PlayerHandleStatusXor, + PlayerHandleDataTransfer, + PlayerHandleDMA3Transfer, + PlayerHandlePlayBGM, + PlayerHandleCmd32, + PlayerHandleTwoReturnValues, + PlayerHandleChosenMonReturnValue, + PlayerHandleOneReturnValue, + PlayerHandleOneReturnValue_Duplicate, + PlayerHandleCmd37, + PlayerHandleCmd38, + PlayerHandleCmd39, + PlayerHandleCmd40, + PlayerHandleHitAnimation, + PlayerHandleCmd42, + PlayerHandleEffectivenessSound, + PlayerHandlePlayFanfareOrBGM, + PlayerHandleFaintingCry, + PlayerHandleIntroSlide, + PlayerHandleIntroTrainerBallThrow, + PlayerHandleDrawPartyStatusSummary, + PlayerHandleCmd49, + PlayerHandleCmd50, + PlayerHandleSpriteInvisibility, + PlayerHandleBattleAnimation, + PlayerHandleLinkStandbyMsg, + PlayerHandleResetActionMoveSelection, + PlayerHandleCmd55, + nullsub_22 +}; + +static const u8 sTargetIdentities[] = {IDENTITY_PLAYER_MON1, IDENTITY_PLAYER_MON2, IDENTITY_OPPONENT_MON2, IDENTITY_OPPONENT_MON1}; + +// unknown unused data +static const u8 gUnknown_0831C5FC[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58}; + +void nullsub_21(void) +{ +} + +void SetControllerToPlayer(void) +{ + gBattleBankFunc[gActiveBank] = PlayerBufferRunCommand; + gDoingBattleAnim = FALSE; + gPlayerDpadHoldFrames = 0; +} + +static void PlayerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = PlayerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void PlayerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sPlayerBufferCommands)) + sPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + PlayerBufferExecCompleted(); + } +} + +static void CompleteOnBankSpritePosX_0(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + PlayerBufferExecCompleted(); +} + +static void HandleInputChooseAction(void) +{ + u16 itemId = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + dp11b_obj_instanciate(gActiveBank, 1, 7, 1); + dp11b_obj_instanciate(gActiveBank, 0, 7, 1); + + if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) + gPlayerDpadHoldFrames++; + else + gPlayerDpadHoldFrames = 0; + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + switch (gActionSelectionCursor[gActiveBank]) + { + case 0: + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + break; + case 1: + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + break; + case 2: + EmitTwoReturnValues(1, ACTION_SWITCH, 0); + break; + case 3: + EmitTwoReturnValues(1, ACTION_RUN, 0); + break; + } + PlayerBufferExecCompleted(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gActionSelectionCursor[gActiveBank] & 1) // if is ACTION_USE_ITEM or ACTION_RUN + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gActionSelectionCursor[gActiveBank] & 1)) // if is ACTION_USE_MOVE or ACTION_SWITCH + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gActionSelectionCursor[gActiveBank] & 2) // if is ACTION_SWITCH or ACTION_RUN + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gActionSelectionCursor[gActiveBank] & 2)) // if is ACTION_USE_MOVE or ACTION_USE_ITEM + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) + { + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + && GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON2 + && !(gAbsentBankFlags & gBitTable[GetBankByIdentity(IDENTITY_PLAYER_MON1)]) + && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + if (gBattleBufferA[gActiveBank][1] == ACTION_USE_ITEM) + { + // Add item to bag if it is a ball + if (itemId <= ITEM_PREMIER_BALL) + AddBagItem(itemId, 1); + else + return; + } + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_CANCEL_PARTNER, 0); + PlayerBufferExecCompleted(); + } + } + else if (gMain.newKeys & START_BUTTON) + { + SwapHpBarsWithHpText(); + } +} + +static void sub_80577F0(void) // unused +{ + dp11b_obj_free(gActiveBank, 1); + dp11b_obj_free(gActiveBank, 0); + gBattleBankFunc[gActiveBank] = HandleInputChooseTarget; +} + +static void HandleInputChooseTarget(void) +{ + s32 i; + u8 identities[4]; + memcpy(identities, sTargetIdentities, ARRAY_COUNT(sTargetIdentities)); + + dp11b_obj_instanciate(gMultiUsePlayerCursor, 1, 0xF, 1); + + // what a weird loop + i = 0; + if (gNoOfAllBanks != 0) + { + do + { + if (i != gMultiUsePlayerCursor) + dp11b_obj_free(i, 1); + i++; + } while (i < gNoOfAllBanks); + } + + if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) + gPlayerDpadHoldFrames++; + else + gPlayerDpadHoldFrames = 0; + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + dp11b_obj_free(gMultiUsePlayerCursor, 1); + PlayerBufferExecCompleted(); + } + else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + dp11b_obj_instanciate(gActiveBank, 1, 7, 1); + dp11b_obj_instanciate(gActiveBank, 0, 7, 1); + dp11b_obj_free(gMultiUsePlayerCursor, 1); + } + else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP)) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + + do + { + u8 currSelIdentity = GetBankIdentity(gMultiUsePlayerCursor); + + for (i = 0; i < BATTLE_BANKS_COUNT; i++) + { + if (currSelIdentity == identities[i]) + break; + } + do + { + if (--i < 0) + i = 4; // UB: array out of range + gMultiUsePlayerCursor = GetBankByIdentity(identities[i]); + } while (gMultiUsePlayerCursor == gNoOfAllBanks); + + i = 0; + switch (GetBankIdentity(gMultiUsePlayerCursor)) + { + case IDENTITY_PLAYER_MON1: + case IDENTITY_PLAYER_MON2: + if (gActiveBank != gMultiUsePlayerCursor) + i++; + else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER) + i++; + break; + case IDENTITY_OPPONENT_MON1: + case IDENTITY_OPPONENT_MON2: + i++; + break; + } + + if (gAbsentBankFlags & gBitTable[gMultiUsePlayerCursor]) + i = 0; + } while (i == 0); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + } + else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN)) + { + PlaySE(SE_SELECT); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + + do + { + u8 currSelIdentity = GetBankIdentity(gMultiUsePlayerCursor); + + for (i = 0; i < BATTLE_BANKS_COUNT; i++) + { + if (currSelIdentity == identities[i]) + break; + } + do + { + if (++i > 3) + i = 0; + gMultiUsePlayerCursor = GetBankByIdentity(identities[i]); + } while (gMultiUsePlayerCursor == gNoOfAllBanks); + + i = 0; + switch (GetBankIdentity(gMultiUsePlayerCursor)) + { + case IDENTITY_PLAYER_MON1: + case IDENTITY_PLAYER_MON2: + if (gActiveBank != gMultiUsePlayerCursor) + i++; + else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER) + i++; + break; + case IDENTITY_OPPONENT_MON1: + case IDENTITY_OPPONENT_MON2: + i++; + break; + } + + if (gAbsentBankFlags & gBitTable[gMultiUsePlayerCursor]) + i = 0; + } while (i == 0); + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + } +} + +static void HandleInputChooseMove(void) +{ + bool32 canSelectTarget = FALSE; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) + gPlayerDpadHoldFrames++; + else + gPlayerDpadHoldFrames = 0; + + if (gMain.newKeys & A_BUTTON) + { + u8 moveTarget; + + PlaySE(SE_SELECT); + if (moveInfo->moves[gMoveSelectionCursor[gActiveBank]] == MOVE_CURSE) + { + if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) + moveTarget = MOVE_TARGET_x10; + else + moveTarget = MOVE_TARGET_SELECTED; + } + else + { + moveTarget = gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBank]]].target; + } + + if (moveTarget & MOVE_TARGET_x10) + gMultiUsePlayerCursor = gActiveBank; + else + gMultiUsePlayerCursor = GetBankByIdentity((GetBankIdentity(gActiveBank) & BIT_SIDE) ^ BIT_SIDE); + + if (!gBattleBufferA[gActiveBank][1]) // not a double battle + { + if (moveTarget & MOVE_TARGET_USER && !gBattleBufferA[gActiveBank][2]) + canSelectTarget++; + } + else // double battle + { + if (!(moveTarget & (MOVE_TARGET_RANDOM | MOVE_TARGET_BOTH | MOVE_TARGET_DEPENDS | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_x10))) + canSelectTarget++; // either selected or user + + if (moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]] == 0) + { + canSelectTarget = FALSE; + } + else if (!(moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) <= 1) + { + gMultiUsePlayerCursor = GetDefaultMoveTarget(gActiveBank); + canSelectTarget = FALSE; + } + } + + if (!canSelectTarget) + { + EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBank] | (gMultiUsePlayerCursor << 8)); + PlayerBufferExecCompleted(); + } + else + { + gBattleBankFunc[gActiveBank] = HandleInputChooseTarget; + + if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) + gMultiUsePlayerCursor = gActiveBank; + else if (gAbsentBankFlags & gBitTable[GetBankByIdentity(IDENTITY_OPPONENT_MON1)]) + gMultiUsePlayerCursor = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + else + gMultiUsePlayerCursor = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + + gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + } + } + else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, 10, 0xFFFF); + PlayerBufferExecCompleted(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gMoveSelectionCursor[gActiveBank] & 1) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gMoveSelectionCursor[gActiveBank] & 1) + && (gMoveSelectionCursor[gActiveBank] ^ 1) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gMoveSelectionCursor[gActiveBank] & 2) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gMoveSelectionCursor[gActiveBank] & 2) + && (gMoveSelectionCursor[gActiveBank] ^ 2) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + } + else if (gMain.newKeys & SELECT_BUTTON) + { + if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK)) + { + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + + if (gMoveSelectionCursor[gActiveBank] != 0) + gMultiUsePlayerCursor = 0; + else + gMultiUsePlayerCursor = gMoveSelectionCursor[gActiveBank] + 1; + + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + BattleHandleAddTextPrinter(gText_BattleSwitchWhich, 0xB); + gBattleBankFunc[gActiveBank] = HandleMoveSwitchting; + } + } +} + +u32 sub_8057FBC(void) // unused +{ + u32 var = 0; + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + var = 1; + } + if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0x140; + var = 0xFF; + } + if (gMain.newKeys & DPAD_LEFT && gMoveSelectionCursor[gActiveBank] & 1) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + if (gMain.newKeys & DPAD_RIGHT && !(gMoveSelectionCursor[gActiveBank] & 1) + && (gMoveSelectionCursor[gActiveBank] ^ 1) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 1; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + if (gMain.newKeys & DPAD_UP && gMoveSelectionCursor[gActiveBank] & 2) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + if (gMain.newKeys & DPAD_DOWN && !(gMoveSelectionCursor[gActiveBank] & 2) + && (gMoveSelectionCursor[gActiveBank] ^ 2) < gNumberOfMovesToChoose) + { + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBank]); + gMoveSelectionCursor[gActiveBank] ^= 2; + PlaySE(SE_SELECT); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + } + + return var; +} + +static void HandleMoveSwitchting(void) +{ + u8 perMovePPBonuses[4]; + struct ChooseMoveStruct moveStruct; + u8 totalPPBonuses; + + if (gMain.newKeys & (A_BUTTON | SELECT_BUTTON)) + { + PlaySE(SE_SELECT); + + if (gMoveSelectionCursor[gActiveBank] != gMultiUsePlayerCursor) + { + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + s32 i; + + // swap moves and pp + i = moveInfo->moves[gMoveSelectionCursor[gActiveBank]]; + moveInfo->moves[gMoveSelectionCursor[gActiveBank]] = moveInfo->moves[gMultiUsePlayerCursor]; + moveInfo->moves[gMultiUsePlayerCursor] = i; + + i = moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]]; + moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]] = moveInfo->currentPp[gMultiUsePlayerCursor]; + moveInfo->currentPp[gMultiUsePlayerCursor] = i; + + i = moveInfo->maxPp[gMoveSelectionCursor[gActiveBank]]; + moveInfo->maxPp[gMoveSelectionCursor[gActiveBank]] = moveInfo->maxPp[gMultiUsePlayerCursor]; + moveInfo->maxPp[gMultiUsePlayerCursor] = i; + + if (gDisableStructs[gActiveBank].unk18_b & gBitTable[gMoveSelectionCursor[gActiveBank]]) + { + gDisableStructs[gActiveBank].unk18_b &= (~gBitTable[gMoveSelectionCursor[gActiveBank]]); + gDisableStructs[gActiveBank].unk18_b |= gBitTable[gMultiUsePlayerCursor]; + } + + MoveSelectionDisplayMoveNames(); + + for (i = 0; i < 4; i++) + perMovePPBonuses[i] = (gBattleMons[gActiveBank].ppBonuses & (3 << (i * 2))) >> (i * 2); + + totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBank]]; + perMovePPBonuses[gMoveSelectionCursor[gActiveBank]] = perMovePPBonuses[gMultiUsePlayerCursor]; + perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; + + totalPPBonuses = 0; + for (i = 0; i < 4; i++) + totalPPBonuses |= perMovePPBonuses[i] << (i * 2); + + gBattleMons[gActiveBank].ppBonuses = totalPPBonuses; + + for (i = 0; i < 4; i++) + { + gBattleMons[gActiveBank].moves[i] = moveInfo->moves[i]; + gBattleMons[gActiveBank].pp[i] = moveInfo->currentPp[i]; + } + + if (!(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED)) + { + for (i = 0; i < 4; i++) + { + moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + i); + moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP1 + i); + } + + totalPPBonuses = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP_BONUSES); + for (i = 0; i < 4; i++) + perMovePPBonuses[i] = (totalPPBonuses & (3 << (i * 2))) >> (i * 2); + + i = moveStruct.moves[gMoveSelectionCursor[gActiveBank]]; + moveStruct.moves[gMoveSelectionCursor[gActiveBank]] = moveStruct.moves[gMultiUsePlayerCursor]; + moveStruct.moves[gMultiUsePlayerCursor] = i; + + i = moveStruct.currentPp[gMoveSelectionCursor[gActiveBank]]; + moveStruct.currentPp[gMoveSelectionCursor[gActiveBank]] = moveStruct.currentPp[gMultiUsePlayerCursor]; + moveStruct.currentPp[gMultiUsePlayerCursor] = i; + + totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBank]]; + perMovePPBonuses[gMoveSelectionCursor[gActiveBank]] = perMovePPBonuses[gMultiUsePlayerCursor]; + perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; + + totalPPBonuses = 0; + for (i = 0; i < 4; i++) + totalPPBonuses |= perMovePPBonuses[i] << (i * 2); + + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]); + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]); + } + + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_PP_BONUSES, &totalPPBonuses); + } + } + + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + gMoveSelectionCursor[gActiveBank] = gMultiUsePlayerCursor; + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpString(); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + else if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON)) + { + PlaySE(SE_SELECT); + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + MoveSelectionDisplayPpString(); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gMultiUsePlayerCursor & 1) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 1; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gMultiUsePlayerCursor & 1) && (gMultiUsePlayerCursor ^ 1) < gNumberOfMovesToChoose) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 1; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gMultiUsePlayerCursor & 2) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 2; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gMultiUsePlayerCursor & 2) && (gMultiUsePlayerCursor ^ 2) < gNumberOfMovesToChoose) + { + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 29); + else + MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); + + gMultiUsePlayerCursor ^= 2; + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBank]) + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); + else + MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); + } + } +} + +static void sub_80586F8(void) +{ + if (gLinkVSyncDisabled == 0) + { + if (gReceivedRemoteLinkPlayers == 0) + { + m4aSongNumStop(SE_HINSI); + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(sub_8038D64); + if (gBattleOutcome == BATTLE_WON) + sub_817E3F4(); + FreeAllWindowBuffers(); + } + } + else + { + if (sub_800A520()) + { + m4aSongNumStop(SE_HINSI); + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(sub_8038D64); + if (gBattleOutcome == BATTLE_WON) + sub_817E3F4(); + FreeAllWindowBuffers(); + } + } +} + +void sub_80587B0(void) +{ + if (!gPaletteFade.active) + { + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (sub_800A520()) + { + if (gLinkVSyncDisabled == 0) + sub_800AC34(); + else + sub_800ADF8(); + + gBattleBankFunc[gActiveBank] = sub_80586F8; + } + } + else + { + m4aSongNumStop(SE_HINSI); + gMain.inBattle = 0; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(gMain.savedCallback); + } + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + PlayerBufferExecCompleted(); +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + PlayerBufferExecCompleted(); +} + +static void sub_80588B4(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(gSaveBlock2Ptr->playerGender); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + PlayerBufferExecCompleted(); + } +} + +static void sub_8058924(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + PlayerBufferExecCompleted(); + } +} + +static void sub_805896C(void) +{ + bool8 var = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + var = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + var = TRUE; + } + + if (var && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + + if (IsDoubleBattle()) + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], gActiveBank ^ BIT_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_8058924; + } +} + +static void sub_8058B40(void) +{ + bool32 r9 = FALSE; + bool32 r8 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 1; + } + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x40 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x40 + && !IsCryPlayingOrClearCrySongs()) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) + m4aMPlayContinue(&gMPlay_BGM); + else + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r9 = TRUE; + } + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + } + else + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + } + + if (r9 && r8) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_805896C; + } +} + +static void sub_8058EDC(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + CopyBattleSpriteInvisibility(gActiveBank); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_8058FC0; + } +} + +static void sub_8058FC0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && !IsCryPlayingOrClearCrySongs()) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlayerBufferExecCompleted(); + } +} + +static void sub_805902C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_8058EDC; + } +} + +void c3_0802FDF4(u8 taskId) +{ + if (!IsCryPlayingOrClearCrySongs()) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + DestroyTask(taskId); + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlayerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + PlayerBufferExecCompleted(); +} + +#define tExpTask_monId data[0] +#define tExpTask_gainedExp data[1] +#define tExpTask_bank data[2] +#define tExpTask_frames data[10] + +static void Task_GiveExpToMon(u8 taskId) +{ + u32 monId = (u8)(gTasks[taskId].tExpTask_monId); + u8 bank = gTasks[taskId].tExpTask_bank; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + + if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) // give exp without the expbar + { + struct Pokemon *mon = &gPlayerParty[monId]; + u16 species = GetMonData(mon, MON_DATA_SPECIES); + u8 level = GetMonData(mon, MON_DATA_LEVEL); + u32 currExp = GetMonData(mon, MON_DATA_EXP); + u32 nextLvlExp = gExperienceTables[gBaseStats[species].growthRate][level + 1]; + + if (currExp + gainedExp >= nextLvlExp) + { + u8 savedActiveBank; + + SetMonData(mon, MON_DATA_EXP, &nextLvlExp); + CalculateMonStats(mon); + gainedExp -= nextLvlExp - currExp; + savedActiveBank = gActiveBank; + gActiveBank = bank; + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + gActiveBank = savedActiveBank; + + if (IsDoubleBattle() == TRUE + && ((u16)(monId) == gBattlePartyID[bank] || (u16)(monId) == gBattlePartyID[bank ^ BIT_MON])) + gTasks[taskId].func = sub_8059544; + else + gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + } + else + { + currExp += gainedExp; + SetMonData(mon, MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + else + { + gTasks[taskId].func = Task_PrepareToGiveExpWithExpBar; + } +} + +static void Task_PrepareToGiveExpWithExpBar(u8 taskId) +{ + u8 monIndex = gTasks[taskId].tExpTask_monId; + s32 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; + struct Pokemon *mon = &gPlayerParty[monIndex]; + u8 level = GetMonData(mon, MON_DATA_LEVEL); + u16 species = GetMonData(mon, MON_DATA_SPECIES); + u32 exp = GetMonData(mon, MON_DATA_EXP); + u32 currLvlExp = gExperienceTables[gBaseStats[species].growthRate][level]; + u32 expToNextLvl; + + exp -= currLvlExp; + expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp; + SetBattleBarStruct(bank, gHealthBoxesIds[bank], expToNextLvl, exp, -gainedExp); + PlaySE(SE_EXP); + gTasks[taskId].func = sub_8059400; +} + +static void sub_8059400(u8 taskId) +{ + if (gTasks[taskId].tExpTask_frames < 13) + { + gTasks[taskId].tExpTask_frames++; + } + else + { + u8 monId = gTasks[taskId].tExpTask_monId; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; + s16 r4; + + r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], EXP_BAR, 0); + SetHealthboxSpriteVisible(gHealthBoxesIds[bank]); + if (r4 == -1) + { + u8 level; + s32 currExp; + u16 species; + s32 expOnNextLvl; + + m4aSongNumStop(SE_EXP); + level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + currExp = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + expOnNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1]; + + if (currExp + gainedExp >= expOnNextLvl) + { + u8 savedActiveBank; + + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &expOnNextLvl); + CalculateMonStats(&gPlayerParty[monId]); + gainedExp -= expOnNextLvl - currExp; + savedActiveBank = gActiveBank; + gActiveBank = bank; + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + gActiveBank = savedActiveBank; + gTasks[taskId].func = sub_8059544; + } + else + { + currExp += gainedExp; + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + } +} + +static void sub_8059544(u8 taskId) +{ + u8 bank = gTasks[taskId].tExpTask_bank; + u8 monIndex = gTasks[taskId].tExpTask_monId; + + if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) + bank ^= BIT_MON; + + DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP); + gTasks[taskId].func = sub_80595A4; +} + +static void sub_80595A4(u8 taskId) +{ + u8 bank = gTasks[taskId].tExpTask_bank; + + if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive) + { + u8 monIndex = gTasks[taskId].tExpTask_monId; + + GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value + + if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) + UpdateHealthboxAttribute(gHealthBoxesIds[bank ^ BIT_MON], &gPlayerParty[monIndex], HEALTHBOX_ALL); + else + UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL); + + gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + } +} + +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) +{ + u8 monIndex; + u8 bank; + + monIndex = gTasks[taskId].tExpTask_monId; + GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value + bank = gTasks[taskId].tExpTask_bank; + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); +} + +static void sub_80596A8(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos1.y + gSprites[gBankSpriteIds[gActiveBank]].pos2.y > DISPLAY_HEIGHT) + { + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + nullsub_24(species); + FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBank]].oam.matrixNum); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerBufferExecCompleted(); + } +} + +static void sub_8059744(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter2(void) +{ + if (!IsTextPrinterActive(0)) + PlayerBufferExecCompleted(); +} + +static void sub_80597CC(void) +{ + if (!gPaletteFade.active) + { + u8 r4; + + gBattleBankFunc[gActiveBank] = sub_8059828; + r4 = gTasks[gUnknown_03005D7C[gActiveBank]].data[0]; + DestroyTask(gUnknown_03005D7C[gActiveBank]); + FreeAllWindowBuffers(); + sub_81B89AC(r4); + } +} + +static void sub_8059828(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + if (gUnknown_0203CEE8 == 1) + EmitChosenMonReturnValue(1, gUnknown_0203CEE9, gUnknown_0203CF00); + else + EmitChosenMonReturnValue(1, 6, NULL); + + if ((gBattleBufferA[gActiveBank][1] & 0xF) == 1) + PrintLinkStandbyMsg(); + + PlayerBufferExecCompleted(); + } +} + +static void OpenBagAndChooseItem(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = CompleteWhenChoseItem; + nullsub_35(); + FreeAllWindowBuffers(); + sub_81AABB0(); + } +} + +static void CompleteWhenChoseItem(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitOneReturnValue(1, gScriptItemId); + PlayerBufferExecCompleted(); + } +} + +static void CompleteOnSpecialAnimDone(void) +{ + if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + PlayerBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + PlayerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void PlayerHandleUnknownYesNoInput(void) +{ + if (gMain.newKeys & DPAD_UP && gMultiUsePlayerCursor != 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor); + gMultiUsePlayerCursor = 0; + BattleCreateYesNoCursorAt(0); + } + if (gMain.newKeys & DPAD_DOWN && gMultiUsePlayerCursor == 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor); + gMultiUsePlayerCursor = 1; + BattleCreateYesNoCursorAt(1); + } + if (gMain.newKeys & A_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); + PlaySE(SE_SELECT); + + if (gMultiUsePlayerCursor != 0) + EmitTwoReturnValues(1, 0xE, 0); + else + EmitTwoReturnValues(1, 0xD, 0); + + PlayerBufferExecCompleted(); + } + if (gMain.newKeys & B_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); + PlaySE(SE_SELECT); + PlayerBufferExecCompleted(); + } +} + +static void MoveSelectionDisplayMoveNames(void) +{ + s32 i; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + gNumberOfMovesToChoose = 0; + + for (i = 0; i < 4; i++) + { + MoveSelectionDestroyCursorAt(i); + StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, i + 3); + if (moveInfo->moves[i] != MOVE_NONE) + gNumberOfMovesToChoose++; + } +} + +static void MoveSelectionDisplayPpString(void) +{ + StringCopy(gDisplayedStringBattle, gText_MoveInterfacePP); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 7); +} + +static void MoveSelectionDisplayPpNumber(void) +{ + u8 *txtPtr; + struct ChooseMoveStruct *moveInfo; + + if (gBattleBufferA[gActiveBank][2] == TRUE) // check if we didn't want to display pp number + return; + + SetPpNumbersPaletteInMoveSelection(); + moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + txtPtr = ConvertIntToDecimalStringN(gDisplayedStringBattle, moveInfo->currentPp[gMoveSelectionCursor[gActiveBank]], STR_CONV_MODE_RIGHT_ALIGN, 2); + txtPtr[0] = CHAR_SLASH; + txtPtr++; + ConvertIntToDecimalStringN(txtPtr, moveInfo->maxPp[gMoveSelectionCursor[gActiveBank]], STR_CONV_MODE_RIGHT_ALIGN, 2); + + BattleHandleAddTextPrinter(gDisplayedStringBattle, 9); +} + +static void MoveSelectionDisplayMoveType(void) +{ + u8 *txtPtr; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); + txtPtr[0] = EXT_CTRL_CODE_BEGIN; + txtPtr++; + txtPtr[0] = 6; + txtPtr++; + txtPtr[0] = 1; + txtPtr++; + + StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBank]]].type]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 10); +} + +static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +{ + u16 src[2]; + src[0] = arg1 + 1; + src[1] = arg1 + 2; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 9 * (cursorPosition & 1) + 1, 55 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +static void MoveSelectionDestroyCursorAt(u8 cursorPosition) +{ + u16 src[2]; + src[0] = 0x1016; + src[1] = 0x1016; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 9 * (cursorPosition & 1) + 1, 55 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +void ActionSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +{ + u16 src[2]; + src[0] = 1; + src[1] = 2; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 7 * (cursorPosition & 1) + 16, 35 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +void ActionSelectionDestroyCursorAt(u8 cursorPosition) +{ + u16 src[2]; + src[0] = 0x1016; + src[1] = 0x1016; + + CopyToBgTilemapBufferRect_ChangePalette(0, src, 7 * (cursorPosition & 1) + 16, 35 + (cursorPosition & 2), 1, 2, 0x11); + CopyBgTilemapBufferToVram(0); +} + +void SetCB2ToReshowScreenAfterMenu(void) +{ + SetMainCallback2(ReshowBattleScreenAfterMenu); +} + +void SetCB2ToReshowScreenAfterMenu2(void) +{ + SetMainCallback2(ReshowBattleScreenAfterMenu); +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + PlayerBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + PlayerBufferExecCompleted(); +} + +static void PrintLinkStandbyMsg(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + BattleHandleAddTextPrinter(gText_LinkStandby, 0); + } +} + +static void PlayerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyPlayerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += CopyPlayerMonData(i, monData + size); + monToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + PlayerBufferExecCompleted(); +} + +static u32 CopyPlayerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +void PlayerHandleGetRawMonData(void) +{ + struct BattlePokemon battleMon; + u8 *src = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 *dst = (u8 *)&battleMon + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = src[i]; + + EmitDataTransfer(1, gBattleBufferA[gActiveBank][2], dst); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetPlayerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetPlayerMonData(i); + monToCheck >>= 1; + } + } + PlayerBufferExecCompleted(); +} + +static void SetPlayerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void PlayerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + PlayerBufferExecCompleted(); +} + +static void PlayerHandleLoadMonSprite(void) +{ + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpritePosX_0; +} + +static void PlayerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + gActionSelectionCursor[gActiveBank] = 0; + gMoveSelectionCursor[gActiveBank] = 0; + sub_805B258(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_805902C; +} + +static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void PlayerHandleReturnMonToBall(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]); + PlayerBufferExecCompleted(); + } +} + +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_PLAYER_MON); + gBattleBankFunc[gActiveBank] = sub_8059744; + } + break; + } +} + +// some explanation here +// in emerald it's possible to have a tag battle in the battle frontier facilities with AI +// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it +static void PlayerHandleDrawTrainerPic(void) +{ + s16 xPos, yPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender; + } + } + else + { + trainerPicId = gSaveBlock2Ptr->playerGender; + } + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 90; + else // first mon + xPos = 32; + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID) + { + xPos = 90; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80; + } + else + { + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + } + else + { + xPos = 80; + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + + // Use front pic table for any tag battles unless your partner is Steven. + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID) + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].pos2.y = 48; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gSprites[gBankSpriteIds[gActiveBank]].oam.affineMode = 0; + gSprites[gBankSpriteIds[gActiveBank]].hFlip = 1; + } + // use the back pic in any other scenario + else + { + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + } + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void PlayerHandleTrainerSlide(void) +{ + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED; + } + else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE) + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN; + } + else + { + trainerPicId = gLinkPlayers[GetMultiplayerId()].gender; + } + } + else + { + trainerPicId = gSaveBlock2Ptr->playerGender; + } + + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -96; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; +} + +static void PlayerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + gBattleBankFunc[gActiveBank] = sub_80588B4; +} + +static void PlayerHandleFaintAnimation(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, PAN_SIDE_PLAYER); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_80596A8; + } + } +} + +static void PlayerHandlePaletteFade(void) +{ + BeginNormalPaletteFade(-1, 2, 0, 16, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleSuccessBallThrowAnim(void) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void PlayerHandleBallThrowAnim(void) +{ + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void PlayerHandlePause(void) +{ + u8 var = gBattleBufferA[gActiveBank][1]; + + // WTF is this?? + while (var != 0) + var--; + + PlayerBufferExecCompleted(); +} + +static void PlayerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + PlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = PlayerDoMoveAnimation; + sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); + } + } +} + +static void PlayerDoMoveAnimation(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; + PlayerBufferExecCompleted(); + } + break; + } +} + +static void PlayerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter2; + sub_817C95C(*stringId); + sub_81A57E4(gActiveBank, *stringId); +} + +static void PlayerHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + PlayerHandlePrintString(); + else + PlayerBufferExecCompleted(); +} + +static void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = HandleInputChooseAction; + } +} + +static void PlayerHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + sub_817F2A8(); + BattleHandleAddTextPrinter(gText_BattleMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +static void PlayerHandleUnknownYesNoBox(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 12); + gMultiUsePlayerCursor = 1; + BattleCreateYesNoCursorAt(1); + gBattleBankFunc[gActiveBank] = PlayerHandleUnknownYesNoInput; + } + else + { + PlayerBufferExecCompleted(); + } +} + +static void HandleChooseMoveAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 320; + gBattleBankFunc[gActiveBank] = HandleInputChooseMove; + } +} + +static void PlayerChooseMoveInBattlePalace(void) +{ + if (--*(gBattleStruct->field_298 + gActiveBank) == 0) + { + gBattlePalaceMoveSelectionRngValue = gRngValue; + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + PlayerBufferExecCompleted(); + } +} + +static void PlayerHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + *(gBattleStruct->field_298 + gActiveBank) = 8; + gBattleBankFunc[gActiveBank] = PlayerChooseMoveInBattlePalace; + } + else + { + InitMoveSelectionsVarsAndStrings(); + gBattleBankFunc[gActiveBank] = HandleChooseMoveAfterDma3; + } +} + +void InitMoveSelectionsVarsAndStrings(void) +{ + MoveSelectionDisplayMoveNames(); + gMultiUsePlayerCursor = 0xFF; + MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBank], 0); + MoveSelectionDisplayPpString(); + MoveSelectionDisplayPpNumber(); + MoveSelectionDisplayMoveType(); +} + +static void PlayerHandleChooseItem(void) +{ + s32 i; + + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = OpenBagAndChooseItem; + gBankInMenu = gActiveBank; + + for (i = 0; i < 3; i++) + gUnknown_0203CF00[i] = gBattleBufferA[gActiveBank][1 + i]; +} + +static void PlayerHandleChoosePokemon(void) +{ + s32 i; + + for (i = 0; i < 3; i++) + gUnknown_0203CF00[i] = gBattleBufferA[gActiveBank][4 + i]; + + if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBank][1] & 0xF) != 2) + { + EmitChosenMonReturnValue(1, gBattlePartyID[gActiveBank] + 1, gUnknown_0203CF00); + PlayerBufferExecCompleted(); + } + else + { + gUnknown_03005D7C[gActiveBank] = CreateTask(TaskDummy, 0xFF); + gTasks[gUnknown_03005D7C[gActiveBank]].data[0] = gBattleBufferA[gActiveBank][1] & 0xF; + *(&gBattleStruct->field_49) = gBattleBufferA[gActiveBank][1] >> 4; + *(&gBattleStruct->field_8B) = gBattleBufferA[gActiveBank][2]; + *(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBank][3]; + BeginNormalPaletteFade(-1, 0, 0, 16, 0); + gBattleBankFunc[gActiveBank] = sub_80597CC; + gBankInMenu = gActiveBank; + } +} + +static void PlayerHandleCmd23(void) +{ + BattleMusicStop(); + BeginNormalPaletteFade(-1, 2, 0, 16, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal > 0) + gUnknown_0203CD70 += hpVal; + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void PlayerHandleExpUpdate(void) +{ + u8 monId = gBattleBufferA[gActiveBank][1]; + + if (GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL) >= MAX_MON_LEVEL) + { + PlayerBufferExecCompleted(); + } + else + { + s16 expPointsToGive; + u8 taskId; + + LoadBattleBarGfx(1); + GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // unused return value + expPointsToGive = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + taskId = CreateTask(Task_GiveExpToMon, 10); + gTasks[taskId].tExpTask_monId = monId; + gTasks[taskId].tExpTask_gainedExp = expPointsToGive; + gTasks[taskId].tExpTask_bank = gActiveBank; + gBattleBankFunc[gActiveBank] = nullsub_21; + } +} + +#undef tExpTask_monId +#undef tExpTask_gainedExp +#undef tExpTask_bank +#undef tExpTask_frames + +static void PlayerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerHandleStatusXor(void) +{ + u8 val = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_STATUS) ^ gBattleBufferA[gActiveBank][1]; + + SetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_STATUS, &val); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleDataTransfer(void) +{ + PlayerBufferExecCompleted(); +} + +static void PlayerHandleDMA3Transfer(void) +{ + u32 dstArg = gBattleBufferA[gActiveBank][1] + | (gBattleBufferA[gActiveBank][2] << 8) + | (gBattleBufferA[gActiveBank][3] << 16) + | (gBattleBufferA[gActiveBank][4] << 24); + u16 sizeArg = gBattleBufferA[gActiveBank][5] | (gBattleBufferA[gActiveBank][6] << 8); + + const u8 *src = &gBattleBufferA[gActiveBank][7]; + u8 *dst = (u8*)(dstArg); + u32 size = sizeArg; + + while (1) + { + if (size <= 0x1000) + { + DmaCopy16(3, src, dst, size); + break; + } + DmaCopy16(3, src, dst, 0x1000); + src += 0x1000; + dst += 0x1000; + size -= 0x1000; + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandlePlayBGM(void) +{ + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd32(void) +{ + PlayerBufferExecCompleted(); +} + +static void PlayerHandleTwoReturnValues(void) +{ + EmitTwoReturnValues(1, 0, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleChosenMonReturnValue(void) +{ + EmitChosenMonReturnValue(1, 0, NULL); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleOneReturnValue(void) +{ + EmitOneReturnValue(1, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleOneReturnValue_Duplicate(void) +{ + EmitOneReturnValue_Duplicate(1, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + PlayerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void PlayerHandleCmd42(void) +{ + PlayerBufferExecCompleted(); +} + +static void PlayerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + PlayerBufferExecCompleted(); +} + +static void PlayerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + PlayerBufferExecCompleted(); +} + +static void PlayerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F8); + LoadCompressedPalette(gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data, 0x100 + paletteNum * 16, 32); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(task05_08033660, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_21; +} + +void sub_805CC00(struct Sprite *sprite) +{ + u8 bank = sprite->data5; + + FreeSpriteOamMatrix(sprite); + FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum)); + DestroySprite(sprite); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], 0); +} + +static void task05_08033660(u8 taskId) +{ + if (gTasks[taskId].data[1] < 31) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_805B258(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_805B258(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_805B258(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_8058B40; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void PlayerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + PlayerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_805CE38; + } +} + +static void sub_805CE38(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + PlayerBufferExecCompleted(); + } +} + +static void PlayerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd50(void) +{ + dp11b_obj_free(gActiveBank, 1); + dp11b_obj_free(gActiveBank, 0); + PlayerBufferExecCompleted(); +} + +static void PlayerHandleSpriteInvisibility(void) +{ + if (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + CopyBattleSpriteInvisibility(gActiveBank); + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + PlayerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + + sub_817E32C(animationId); + } +} + +static void PlayerHandleLinkStandbyMsg(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][2]); + switch (gBattleBufferA[gActiveBank][1]) + { + case 0: + PrintLinkStandbyMsg(); + // fall through + case 1: + dp11b_obj_free(gActiveBank, 1); + dp11b_obj_free(gActiveBank, 0); + break; + case 2: + PrintLinkStandbyMsg(); + break; + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandleResetActionMoveSelection(void) +{ + switch (gBattleBufferA[gActiveBank][1]) + { + case RESET_ACTION_MOVE_SELECTION: + gActionSelectionCursor[gActiveBank] = 0; + gMoveSelectionCursor[gActiveBank] = 0; + break; + case RESET_ACTION_SELECTION: + gActionSelectionCursor[gActiveBank] = 0; + break; + case RESET_MOVE_SELECTION: + gMoveSelectionCursor[gActiveBank] = 0; + break; + } + PlayerBufferExecCompleted(); +} + +static void PlayerHandleCmd55(void) +{ + sub_81851A8(&gBattleBufferA[gActiveBank][4]); + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBank][2]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + PlayerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_22(void) +{ +} diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c new file mode 100644 index 000000000..34fd8a3eb --- /dev/null +++ b/src/battle_controller_player_partner.c @@ -0,0 +1,1960 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct BattleMove gBattleMoves[]; + +extern void sub_81358F4(void); +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); + +// this file's functions +static void PlayerPartnerHandleGetMonData(void); +static void PlayerPartnerHandleGetRawMonData(void); +static void PlayerPartnerHandleSetMonData(void); +static void PlayerPartnerHandleSetRawMonData(void); +static void PlayerPartnerHandleLoadMonSprite(void); +static void PlayerPartnerHandleSwitchInAnim(void); +static void PlayerPartnerHandleReturnMonToBall(void); +static void PlayerPartnerHandleDrawTrainerPic(void); +static void PlayerPartnerHandleTrainerSlide(void); +static void PlayerPartnerHandleTrainerSlideBack(void); +static void PlayerPartnerHandleFaintAnimation(void); +static void PlayerPartnerHandlePaletteFade(void); +static void PlayerPartnerHandleSuccessBallThrowAnim(void); +static void PlayerPartnerHandleBallThrowAnim(void); +static void PlayerPartnerHandlePause(void); +static void PlayerPartnerHandleMoveAnimation(void); +static void PlayerPartnerHandlePrintString(void); +static void PlayerPartnerHandlePrintStringPlayerOnly(void); +static void PlayerPartnerHandleChooseAction(void); +static void PlayerPartnerHandleUnknownYesNoBox(void); +static void PlayerPartnerHandleChooseMove(void); +static void PlayerPartnerHandleChooseItem(void); +static void PlayerPartnerHandleChoosePokemon(void); +static void PlayerPartnerHandleCmd23(void); +static void PlayerPartnerHandleHealthBarUpdate(void); +static void PlayerPartnerHandleExpUpdate(void); +static void PlayerPartnerHandleStatusIconUpdate(void); +static void PlayerPartnerHandleStatusAnimation(void); +static void PlayerPartnerHandleStatusXor(void); +static void PlayerPartnerHandleDataTransfer(void); +static void PlayerPartnerHandleDMA3Transfer(void); +static void PlayerPartnerHandlePlayBGM(void); +static void PlayerPartnerHandleCmd32(void); +static void PlayerPartnerHandleTwoReturnValues(void); +static void PlayerPartnerHandleChosenMonReturnValue(void); +static void PlayerPartnerHandleOneReturnValue(void); +static void PlayerPartnerHandleOneReturnValue_Duplicate(void); +static void PlayerPartnerHandleCmd37(void); +static void PlayerPartnerHandleCmd38(void); +static void PlayerPartnerHandleCmd39(void); +static void PlayerPartnerHandleCmd40(void); +static void PlayerPartnerHandleHitAnimation(void); +static void PlayerPartnerHandleCmd42(void); +static void PlayerPartnerHandleEffectivenessSound(void); +static void PlayerPartnerHandlePlayFanfareOrBGM(void); +static void PlayerPartnerHandleFaintingCry(void); +static void PlayerPartnerHandleIntroSlide(void); +static void PlayerPartnerHandleIntroTrainerBallThrow(void); +static void PlayerPartnerHandleDrawPartyStatusSummary(void); +static void PlayerPartnerHandleCmd49(void); +static void PlayerPartnerHandleCmd50(void); +static void PlayerPartnerHandleSpriteInvisibility(void); +static void PlayerPartnerHandleBattleAnimation(void); +static void PlayerPartnerHandleLinkStandbyMsg(void); +static void PlayerPartnerHandleResetActionMoveSelection(void); +static void PlayerPartnerHandleCmd55(void); +static void nullsub_128(void); + +static void PlayerPartnerBufferRunCommand(void); +static void PlayerPartnerBufferExecCompleted(void); +static void sub_81BB628(u8 taskId); +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); +static void Task_PrepareToGiveExpWithExpBar(u8 taskId); +static void sub_81BB4E4(u8 taskId); +static void sub_81BB628(u8 taskId); +static void sub_81BB688(u8 taskId); +static void sub_81BB9A0(void); +static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst); +static void SetPlayerPartnerMonData(u8 monId); +static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void PlayerPartnerDoMoveAnimation(void); +static void sub_81BE2C8(u8 taskId); +static void sub_81BE498(void); + +static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + PlayerPartnerHandleGetMonData, + PlayerPartnerHandleGetRawMonData, + PlayerPartnerHandleSetMonData, + PlayerPartnerHandleSetRawMonData, + PlayerPartnerHandleLoadMonSprite, + PlayerPartnerHandleSwitchInAnim, + PlayerPartnerHandleReturnMonToBall, + PlayerPartnerHandleDrawTrainerPic, + PlayerPartnerHandleTrainerSlide, + PlayerPartnerHandleTrainerSlideBack, + PlayerPartnerHandleFaintAnimation, + PlayerPartnerHandlePaletteFade, + PlayerPartnerHandleSuccessBallThrowAnim, + PlayerPartnerHandleBallThrowAnim, + PlayerPartnerHandlePause, + PlayerPartnerHandleMoveAnimation, + PlayerPartnerHandlePrintString, + PlayerPartnerHandlePrintStringPlayerOnly, + PlayerPartnerHandleChooseAction, + PlayerPartnerHandleUnknownYesNoBox, + PlayerPartnerHandleChooseMove, + PlayerPartnerHandleChooseItem, + PlayerPartnerHandleChoosePokemon, + PlayerPartnerHandleCmd23, + PlayerPartnerHandleHealthBarUpdate, + PlayerPartnerHandleExpUpdate, + PlayerPartnerHandleStatusIconUpdate, + PlayerPartnerHandleStatusAnimation, + PlayerPartnerHandleStatusXor, + PlayerPartnerHandleDataTransfer, + PlayerPartnerHandleDMA3Transfer, + PlayerPartnerHandlePlayBGM, + PlayerPartnerHandleCmd32, + PlayerPartnerHandleTwoReturnValues, + PlayerPartnerHandleChosenMonReturnValue, + PlayerPartnerHandleOneReturnValue, + PlayerPartnerHandleOneReturnValue_Duplicate, + PlayerPartnerHandleCmd37, + PlayerPartnerHandleCmd38, + PlayerPartnerHandleCmd39, + PlayerPartnerHandleCmd40, + PlayerPartnerHandleHitAnimation, + PlayerPartnerHandleCmd42, + PlayerPartnerHandleEffectivenessSound, + PlayerPartnerHandlePlayFanfareOrBGM, + PlayerPartnerHandleFaintingCry, + PlayerPartnerHandleIntroSlide, + PlayerPartnerHandleIntroTrainerBallThrow, + PlayerPartnerHandleDrawPartyStatusSummary, + PlayerPartnerHandleCmd49, + PlayerPartnerHandleCmd50, + PlayerPartnerHandleSpriteInvisibility, + PlayerPartnerHandleBattleAnimation, + PlayerPartnerHandleLinkStandbyMsg, + PlayerPartnerHandleResetActionMoveSelection, + PlayerPartnerHandleCmd55, + nullsub_128 +}; + +// unknown unused data +static const u8 gUnknown_08617254[] = +{ + 0x83, 0x4d, 0xf3, 0x5f, 0x6f, 0x4f, 0xeb, 0x3e, + 0x67, 0x2e, 0x10, 0x46, 0x8c, 0x3d, 0x28, 0x35, + 0xc5, 0x2c, 0x15, 0x7f, 0xb5, 0x56, 0x9d, 0x53, + 0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53, +}; + +static void nullsub_77(void) +{ +} + +void SetControllerToPlayerPartner(void) +{ + gBattleBankFunc[gActiveBank] = PlayerPartnerBufferRunCommand; +} + +static void PlayerPartnerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sPlayerPartnerBufferCommands)) + sPlayerPartnerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + PlayerPartnerBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + PlayerPartnerBufferExecCompleted(); +} + +static void sub_81BAE98(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + nullsub_25(0); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BAF00(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BAF48(void) +{ + bool32 r6 = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r6 = TRUE; + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r6 = TRUE; + } + } + + if (IsCryPlayingOrClearCrySongs()) + r6 = FALSE; + + if (r6) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_81BAF00; + } +} + +static void sub_81BB02C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 != 1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + + gBattleBankFunc[gActiveBank] = sub_81BAF48; + } +} + +static void sub_81BB1D4(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].animEnded && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + PlayerPartnerBufferExecCompleted(); +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlayerPartnerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + PlayerPartnerBufferExecCompleted(); +} + +// the whole exp task is copied&pasted from player controller +#define tExpTask_monId data[0] +#define tExpTask_gainedExp data[1] +#define tExpTask_bank data[2] +#define tExpTask_frames data[10] + +static void Task_GiveExpToMon(u8 taskId) +{ + u32 monId = (u8)(gTasks[taskId].tExpTask_monId); + u8 bank = gTasks[taskId].tExpTask_bank; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + + if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) // give exp without the expbar + { + struct Pokemon *mon = &gPlayerParty[monId]; + u16 species = GetMonData(mon, MON_DATA_SPECIES); + u8 level = GetMonData(mon, MON_DATA_LEVEL); + u32 currExp = GetMonData(mon, MON_DATA_EXP); + u32 nextLvlExp = gExperienceTables[gBaseStats[species].growthRate][level + 1]; + + if (currExp + gainedExp >= nextLvlExp) + { + u8 savedActiveBank; + + SetMonData(mon, MON_DATA_EXP, &nextLvlExp); + CalculateMonStats(mon); + gainedExp -= nextLvlExp - currExp; + savedActiveBank = gActiveBank; + gActiveBank = bank; + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + gActiveBank = savedActiveBank; + + if (IsDoubleBattle() == TRUE + && ((u16)(monId) == gBattlePartyID[bank] || (u16)(monId) == gBattlePartyID[bank ^ BIT_MON])) + gTasks[taskId].func = sub_81BB628; + else + gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + } + else + { + currExp += gainedExp; + SetMonData(mon, MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + else + { + gTasks[taskId].func = Task_PrepareToGiveExpWithExpBar; + } +} + +static void Task_PrepareToGiveExpWithExpBar(u8 taskId) +{ + u8 monIndex = gTasks[taskId].tExpTask_monId; + s32 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; + struct Pokemon *mon = &gPlayerParty[monIndex]; + u8 level = GetMonData(mon, MON_DATA_LEVEL); + u16 species = GetMonData(mon, MON_DATA_SPECIES); + u32 exp = GetMonData(mon, MON_DATA_EXP); + u32 currLvlExp = gExperienceTables[gBaseStats[species].growthRate][level]; + u32 expToNextLvl; + + exp -= currLvlExp; + expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp; + SetBattleBarStruct(bank, gHealthBoxesIds[bank], expToNextLvl, exp, -gainedExp); + PlaySE(SE_EXP); + gTasks[taskId].func = sub_81BB4E4; +} + +static void sub_81BB4E4(u8 taskId) +{ + if (gTasks[taskId].tExpTask_frames < 13) + { + gTasks[taskId].tExpTask_frames++; + } + else + { + u8 monId = gTasks[taskId].tExpTask_monId; + s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; + u8 bank = gTasks[taskId].tExpTask_bank; + s16 r4; + + r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], EXP_BAR, 0); + SetHealthboxSpriteVisible(gHealthBoxesIds[bank]); + if (r4 == -1) + { + u8 level; + s32 currExp; + u16 species; + s32 expOnNextLvl; + + m4aSongNumStop(SE_EXP); + level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + currExp = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + expOnNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1]; + + if (currExp + gainedExp >= expOnNextLvl) + { + u8 savedActiveBank; + + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &expOnNextLvl); + CalculateMonStats(&gPlayerParty[monId]); + gainedExp -= expOnNextLvl - currExp; + savedActiveBank = gActiveBank; + gActiveBank = bank; + EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + gActiveBank = savedActiveBank; + gTasks[taskId].func = sub_81BB628; + } + else + { + currExp += gainedExp; + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); + } + } + } +} + +static void sub_81BB628(u8 taskId) +{ + u8 bank = gTasks[taskId].tExpTask_bank; + u8 monIndex = gTasks[taskId].tExpTask_monId; + + if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) + bank ^= BIT_MON; + + DoSpecialBattleAnimation(bank, bank, bank, B_ANIM_LVL_UP); + gTasks[taskId].func = sub_81BB688; +} + +static void sub_81BB688(u8 taskId) +{ + u8 bank = gTasks[taskId].tExpTask_bank; + + if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive) + { + u8 monIndex = gTasks[taskId].tExpTask_monId; + + GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value + + if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_MON]) + UpdateHealthboxAttribute(gHealthBoxesIds[bank ^ BIT_MON], &gPlayerParty[monIndex], HEALTHBOX_ALL); + else + UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL); + + gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + } +} + +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) +{ + u8 monIndex; + u8 bank; + + monIndex = gTasks[taskId].tExpTask_monId; + GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value + bank = gTasks[taskId].tExpTask_bank; + gBattleBankFunc[bank] = CompleteOnInactiveTextPrinter; + DestroyTask(taskId); +} + +static void sub_81BB78C(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].pos1.y + gSprites[gBankSpriteIds[gActiveBank]].pos2.y > DISPLAY_HEIGHT) + { + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + nullsub_24(species); + FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBank]].oam.matrixNum); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BB828(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter2(void) +{ + if (!IsTextPrinterActive(0)) + PlayerPartnerBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + PlayerPartnerBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_81BB92C(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + CopyBattleSpriteInvisibility(gActiveBank); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_81BB9A0; + } +} + +static void sub_81BB9A0(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + PlayerPartnerBufferExecCompleted(); + } +} + +static void sub_81BB9F4(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleBankFunc[gActiveBank] = sub_81BB92C; + } +} + +static void sub_81BBAE8(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + gBattleBankFunc[gActiveBank] = sub_81BB9F4; + } +} + +static void PlayerPartnerBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = PlayerPartnerBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + PlayerPartnerBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyPlayerPartnerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += CopyPlayerPartnerMonData(i, monData + size); + monToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + PlayerPartnerBufferExecCompleted(); +} + +static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void PlayerPartnerHandleGetRawMonData(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetPlayerPartnerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetPlayerPartnerMonData(i); + monToCheck >>= 1; + } + } + PlayerPartnerBufferExecCompleted(); +} + +static void SetPlayerPartnerMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void PlayerPartnerHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleLoadMonSprite(void) +{ + u16 species; + + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + gBattleBankFunc[gActiveBank] = sub_81BB1D4; +} + +static void PlayerPartnerHandleSwitchInAnim(void) +{ + ClearTemporarySpeciesSpriteData(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_81BD0E4(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_81BBAE8; +} + +static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite( + &gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void PlayerPartnerHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + PlayerPartnerBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + gBattleBankFunc[gActiveBank] = sub_81BB828; + } + break; + } +} + +// some explanation here +// in emerald it's possible to have a tag battle in the battle frontier facilities with AI +// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it +static void PlayerPartnerHandleDrawTrainerPic(void) +{ + s16 xPos, yPos; + u32 trainerPicId; + + if (gPartnerTrainerId == STEVEN_PARTNER_ID) + { + trainerPicId = BACK_PIC_STEVEN; + xPos = 90; + yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80; + } + else + { + trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId); + xPos = 32; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80; + } + + // Use back pic only if the partner is Steven + if (gPartnerTrainerId == STEVEN_PARTNER_ID) + { + DecompressTrainerBackPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + } + else // otherwise use front sprite + { + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].pos2.y = 48; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gSprites[gBankSpriteIds[gActiveBank]].oam.affineMode = 0; + gSprites[gBankSpriteIds[gActiveBank]].hFlip = 1; + } + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void PlayerPartnerHandleTrainerSlide(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_81BAE98; +} + +static void PlayerPartnerHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; + gBattleBankFunc[gActiveBank] = sub_81BB78C; + } + } +} + +static void PlayerPartnerHandlePaletteFade(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleSuccessBallThrowAnim(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleBallThrowAnim(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandlePause(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + PlayerPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = PlayerPartnerDoMoveAnimation; + } + } +} + +static void PlayerPartnerDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlayerPartnerBufferExecCompleted(); + } + break; + } +} + +static void PlayerPartnerHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter2; +} + +static void PlayerPartnerHandlePrintStringPlayerOnly(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChooseAction(void) +{ + AI_TrySwitchOrUseItem(); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleUnknownYesNoBox(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChooseMove(void) +{ + u8 chosenMoveId; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]); + + BattleAI_SetupAIData(0xF); + chosenMoveId = BattleAI_ChooseMoveOrAction(); + + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) + gBankTarget = gActiveBank; + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) + { + gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1); + if (gAbsentBankFlags & gBitTable[gBankTarget]) + gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON2); + } + + EmitTwoReturnValues(1, 10, chosenMoveId | (gBankTarget << 8)); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChooseItem(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChoosePokemon(void) +{ + s32 chosenMonId = GetMostSuitableMonToSwitchInto(); + + if (chosenMonId == 6) // just switch to the next mon + { + u8 playerMonIdentity = GetBankByIdentity(IDENTITY_PLAYER_MON1); + u8 selfIdentity = GetBankByIdentity(IDENTITY_PLAYER_MON2); + + for (chosenMonId = 3; chosenMonId < 6; chosenMonId++) + { + if (GetMonData(&gPlayerParty[chosenMonId], MON_DATA_HP) != 0 + && chosenMonId != gBattlePartyID[playerMonIdentity] + && chosenMonId != gBattlePartyID[selfIdentity]) + { + break; + } + } + } + + *(gBattleStruct->field_5C + gActiveBank) = chosenMonId; + EmitChosenMonReturnValue(1, chosenMonId, NULL); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd23(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void PlayerPartnerHandleExpUpdate(void) +{ + u8 monId = gBattleBufferA[gActiveBank][1]; + + if (GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL) >= MAX_MON_LEVEL) + { + PlayerPartnerBufferExecCompleted(); + } + else + { + s16 expPointsToGive; + u8 taskId; + + LoadBattleBarGfx(1); + GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // unused return value + expPointsToGive = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + taskId = CreateTask(Task_GiveExpToMon, 10); + gTasks[taskId].tExpTask_monId = monId; + gTasks[taskId].tExpTask_gainedExp = expPointsToGive; + gTasks[taskId].tExpTask_bank = gActiveBank; + gBattleBankFunc[gActiveBank] = nullsub_21; + } +} + +#undef tExpTask_monId +#undef tExpTask_gainedExp +#undef tExpTask_bank +#undef tExpTask_frames + +static void PlayerPartnerHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerPartnerHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void PlayerPartnerHandleStatusXor(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleDataTransfer(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleDMA3Transfer(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandlePlayBGM(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd32(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleTwoReturnValues(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleChosenMonReturnValue(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleOneReturnValue(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleOneReturnValue_Duplicate(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + PlayerPartnerBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void PlayerPartnerHandleCmd42(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, -25, 5); + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F9); + if (gPartnerTrainerId == STEVEN_PARTNER_ID) + { + u8 spriteId = BACK_PIC_STEVEN; + LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32); + } + else + { + u8 spriteId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId); + LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32); + } + + + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_81BE2C8, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_77; +} + +static void sub_81BE2C8(u8 taskId) +{ + if (gTasks[taskId].data[1] < 24) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81BD0E4(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81BD0E4(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_81BD0E4(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_81BB02C; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void PlayerPartnerHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + PlayerPartnerBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_81BE498; + } +} + +static void sub_81BE498(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + PlayerPartnerBufferExecCompleted(); + } +} + +static void PlayerPartnerHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd50(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleSpriteInvisibility(void) +{ + if (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + CopyBattleSpriteInvisibility(gActiveBank); + } + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + PlayerPartnerBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void PlayerPartnerHandleLinkStandbyMsg(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleResetActionMoveSelection(void) +{ + PlayerPartnerBufferExecCompleted(); +} + +static void PlayerPartnerHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + PlayerPartnerBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_128(void) +{ +} diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c new file mode 100644 index 000000000..0dc7631ce --- /dev/null +++ b/src/battle_controller_recorded_opponent.c @@ -0,0 +1,1829 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "battle_link_817C95C.h" +#include "recorded_battle.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern struct UnusedControllerStruct gUnknown_02022D0C; +extern u16 gTrainerBattleOpponent_A; +extern u16 gTrainerBattleOpponent_B; +extern u8 gUnknown_0203C7B4; + +extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); +extern u16 sub_8068B48(void); + +// this file's functions +static void RecordedOpponentHandleGetMonData(void); +static void RecordedOpponentHandleGetRawMonData(void); +static void RecordedOpponentHandleSetMonData(void); +static void RecordedOpponentHandleSetRawMonData(void); +static void RecordedOpponentHandleLoadMonSprite(void); +static void RecordedOpponentHandleSwitchInAnim(void); +static void RecordedOpponentHandleReturnMonToBall(void); +static void RecordedOpponentHandleDrawTrainerPic(void); +static void RecordedOpponentHandleTrainerSlide(void); +static void RecordedOpponentHandleTrainerSlideBack(void); +static void RecordedOpponentHandleFaintAnimation(void); +static void RecordedOpponentHandlePaletteFade(void); +static void RecordedOpponentHandleSuccessBallThrowAnim(void); +static void RecordedOpponentHandleBallThrowAnim(void); +static void RecordedOpponentHandlePause(void); +static void RecordedOpponentHandleMoveAnimation(void); +static void RecordedOpponentHandlePrintString(void); +static void RecordedOpponentHandlePrintStringPlayerOnly(void); +static void RecordedOpponentHandleChooseAction(void); +static void RecordedOpponentHandleUnknownYesNoBox(void); +static void RecordedOpponentHandleChooseMove(void); +static void RecordedOpponentHandleChooseItem(void); +static void RecordedOpponentHandleChoosePokemon(void); +static void RecordedOpponentHandleCmd23(void); +static void RecordedOpponentHandleHealthBarUpdate(void); +static void RecordedOpponentHandleExpUpdate(void); +static void RecordedOpponentHandleStatusIconUpdate(void); +static void RecordedOpponentHandleStatusAnimation(void); +static void RecordedOpponentHandleStatusXor(void); +static void RecordedOpponentHandleDataTransfer(void); +static void RecordedOpponentHandleDMA3Transfer(void); +static void RecordedOpponentHandlePlayBGM(void); +static void RecordedOpponentHandleCmd32(void); +static void RecordedOpponentHandleTwoReturnValues(void); +static void RecordedOpponentHandleChosenMonReturnValue(void); +static void RecordedOpponentHandleOneReturnValue(void); +static void RecordedOpponentHandleOneReturnValue_Duplicate(void); +static void RecordedOpponentHandleCmd37(void); +static void RecordedOpponentHandleCmd38(void); +static void RecordedOpponentHandleCmd39(void); +static void RecordedOpponentHandleCmd40(void); +static void RecordedOpponentHandleHitAnimation(void); +static void RecordedOpponentHandleCmd42(void); +static void RecordedOpponentHandleEffectivenessSound(void); +static void RecordedOpponentHandlePlayFanfareOrBGM(void); +static void RecordedOpponentHandleFaintingCry(void); +static void RecordedOpponentHandleIntroSlide(void); +static void RecordedOpponentHandleIntroTrainerBallThrow(void); +static void RecordedOpponentHandleDrawPartyStatusSummary(void); +static void RecordedOpponentHandleCmd49(void); +static void RecordedOpponentHandleCmd50(void); +static void RecordedOpponentHandleSpriteInvisibility(void); +static void RecordedOpponentHandleBattleAnimation(void); +static void RecordedOpponentHandleLinkStandbyMsg(void); +static void RecordedOpponentHandleResetActionMoveSelection(void); +static void RecordedOpponentHandleCmd55(void); +static void nullsub_119(void); + +static void RecordedOpponentBufferRunCommand(void); +static void RecordedOpponentBufferExecCompleted(void); +static void sub_8186F14(void); +static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst); +static void SetRecordedOpponentMonData(u8 monId); +static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit); +static void DoSwitchOutAnimation(void); +static void RecordedOpponentDoMoveAnimation(void); +static void sub_8189548(u8 taskId); +static void sub_818962C(struct Sprite *sprite); +static void sub_818975C(void); + +static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + RecordedOpponentHandleGetMonData, + RecordedOpponentHandleGetRawMonData, + RecordedOpponentHandleSetMonData, + RecordedOpponentHandleSetRawMonData, + RecordedOpponentHandleLoadMonSprite, + RecordedOpponentHandleSwitchInAnim, + RecordedOpponentHandleReturnMonToBall, + RecordedOpponentHandleDrawTrainerPic, + RecordedOpponentHandleTrainerSlide, + RecordedOpponentHandleTrainerSlideBack, + RecordedOpponentHandleFaintAnimation, + RecordedOpponentHandlePaletteFade, + RecordedOpponentHandleSuccessBallThrowAnim, + RecordedOpponentHandleBallThrowAnim, + RecordedOpponentHandlePause, + RecordedOpponentHandleMoveAnimation, + RecordedOpponentHandlePrintString, + RecordedOpponentHandlePrintStringPlayerOnly, + RecordedOpponentHandleChooseAction, + RecordedOpponentHandleUnknownYesNoBox, + RecordedOpponentHandleChooseMove, + RecordedOpponentHandleChooseItem, + RecordedOpponentHandleChoosePokemon, + RecordedOpponentHandleCmd23, + RecordedOpponentHandleHealthBarUpdate, + RecordedOpponentHandleExpUpdate, + RecordedOpponentHandleStatusIconUpdate, + RecordedOpponentHandleStatusAnimation, + RecordedOpponentHandleStatusXor, + RecordedOpponentHandleDataTransfer, + RecordedOpponentHandleDMA3Transfer, + RecordedOpponentHandlePlayBGM, + RecordedOpponentHandleCmd32, + RecordedOpponentHandleTwoReturnValues, + RecordedOpponentHandleChosenMonReturnValue, + RecordedOpponentHandleOneReturnValue, + RecordedOpponentHandleOneReturnValue_Duplicate, + RecordedOpponentHandleCmd37, + RecordedOpponentHandleCmd38, + RecordedOpponentHandleCmd39, + RecordedOpponentHandleCmd40, + RecordedOpponentHandleHitAnimation, + RecordedOpponentHandleCmd42, + RecordedOpponentHandleEffectivenessSound, + RecordedOpponentHandlePlayFanfareOrBGM, + RecordedOpponentHandleFaintingCry, + RecordedOpponentHandleIntroSlide, + RecordedOpponentHandleIntroTrainerBallThrow, + RecordedOpponentHandleDrawPartyStatusSummary, + RecordedOpponentHandleCmd49, + RecordedOpponentHandleCmd50, + RecordedOpponentHandleSpriteInvisibility, + RecordedOpponentHandleBattleAnimation, + RecordedOpponentHandleLinkStandbyMsg, + RecordedOpponentHandleResetActionMoveSelection, + RecordedOpponentHandleCmd55, + nullsub_119 +}; + +static void nullsub_70(void) +{ +} + +void SetControllerToRecordedOpponent(void) +{ + gBattleBankFunc[gActiveBank] = RecordedOpponentBufferRunCommand; +} + +static void RecordedOpponentBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sRecordedOpponentBufferCommands)) + sRecordedOpponentBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + RecordedOpponentBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + RecordedOpponentBufferExecCompleted(); +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + RecordedOpponentBufferExecCompleted(); +} + +static void sub_81865C8(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186630(void) +{ + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 0xFF) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 0; + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186678(void) +{ + bool8 var = FALSE; + + if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].animEnded) + { + var = TRUE; + } + + } + else + { + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gHealthBoxesIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].animEnded + && gSprites[gBankSpriteIds[gActiveBank ^ BIT_MON]].animEnded) + { + var = TRUE; + } + } + + if (var) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + return; + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + return; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + } + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 = 3; + gBattleBankFunc[gActiveBank] = sub_8186630; + } +} + +static void sub_818686C(void) +{ + bool32 r9 = FALSE; + bool32 r8 = FALSE; + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 1; + } + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x40 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x40 + && !IsCryPlayingOrClearCrySongs()) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20) + { + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) + m4aMPlayContinue(&gMPlay_BGM); + } + else + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + } + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 1; + r9 = TRUE; + } + + if (!IsDoubleBattle()) + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + } + else + { + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank ^ BIT_MON]].callback == SpriteCallbackDummy) + { + r8 = TRUE; + } + } + + if (r9 && r8) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + SetBankEnemyShadowSpriteCallback(gActiveBank ^ BIT_MON, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]], MON_DATA_SPECIES)); + } + + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x20 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80 = 0; + + gBattleBankFunc[gActiveBank] = sub_8186678; + } +} + +static void sub_8186C48(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].pos2.x == 0) + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + else + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + RecordedOpponentBufferExecCompleted(); + } + } + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186D58(void) +{ + if (!gSprites[gBankSpriteIds[gActiveBank]].inUse) + { + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void sub_8186D9C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + RecordedOpponentBufferExecCompleted(); +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + RecordedOpponentBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_8186EA4(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + + gBattleBankFunc[gActiveBank] = sub_8186F14; + } +} + +static void sub_8186F14(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive + && !IsCryPlayingOrClearCrySongs()) + { + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy + || gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy_2) + { + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + RecordedOpponentBufferExecCompleted(); + } + } +} + +static void sub_8186F94(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 0); + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + CopyBattleSpriteInvisibility(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_8186EA4; + } +} + +static void sub_8187084(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80) + { + sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]); + } + + if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + gBattleBankFunc[gActiveBank] = sub_8186F94; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + RecordedOpponentBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = RecordedOpponentBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void RecordedOpponentHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyRecordedOpponentMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += CopyRecordedOpponentMonData(i, monData + size); + monToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + RecordedOpponentBufferExecCompleted(); +} + +static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void RecordedOpponentHandleGetRawMonData(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetRecordedOpponentMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetRecordedOpponentMonData(i); + monToCheck >>= 1; + } + } + RecordedOpponentBufferExecCompleted(); +} + +static void SetRecordedOpponentMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } +} + +static void RecordedOpponentHandleSetRawMonData(void) +{ + u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBank]] + gBattleBufferA[gActiveBank][1]; + u8 i; + + for (i = 0; i < gBattleBufferA[gActiveBank][2]; i++) + dst[i] = gBattleBufferA[gActiveBank][3 + i]; + + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleLoadMonSprite(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); + sub_806A068(species, GetBankIdentity(gActiveBank)); + + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(gActiveBank, 2), + sub_80A6138(gActiveBank), + sub_80A82E4(gActiveBank)); + + + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], gBattleMonForms[gActiveBank]); + + SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES)); + + gBattleBankFunc[gActiveBank] = sub_8186C48; +} + +static void RecordedOpponentHandleSwitchInAnim(void) +{ + gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1]; + sub_81885D8(gActiveBank, gBattleBufferA[gActiveBank][2]); + gBattleBankFunc[gActiveBank] = sub_8187084; +} + +static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit) +{ + u16 species; + + ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + sub_806A068(species, GetBankIdentity(bank)); + + gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE); +} + +static void RecordedOpponentHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = DoSwitchOutAnimation; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + sub_805EEE0(gActiveBank); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + RecordedOpponentBufferExecCompleted(); + } +} + +static void DoSwitchOutAnimation(void) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_OPPONENT_MON); + gBattleBankFunc[gActiveBank] = sub_8186D9C; + } + break; + } +} + +static void RecordedOpponentHandleDrawTrainerPic(void) +{ + s16 xPos; + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon + xPos = 152; + else // first mon + xPos = 200; + + if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) + { + if (gActiveBank == 1) + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); + else + trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(sub_8185F40()); + } + } + else + { + xPos = 176; + if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) + { + trainerPicId = sub_8068B48(); + } + else + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[gUnknown_0203C7B4 ^ BIT_SIDE].gender); + } + } + + DecompressTrainerFrontPic(trainerPicId, gActiveBank); + sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + xPos, + (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, + sub_80A82E4(gActiveBank)); + + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBankSpriteIds[gActiveBank]].oam.affineParam = trainerPicId; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void RecordedOpponentHandleTrainerSlide(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleTrainerSlideBack(void) +{ + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], SpriteCallbackDummy); + gBattleBankFunc[gActiveBank] = sub_81865C8; +} + +static void RecordedOpponentHandleFaintAnimation(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState == 0) + { + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039934; + gBattleBankFunc[gActiveBank] = sub_8186D58; + } + } +} + +static void RecordedOpponentHandlePaletteFade(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleSuccessBallThrowAnim(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleBallThrowAnim(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandlePause(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleMoveAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + RecordedOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = RecordedOpponentDoMoveAnimation; + } + } +} + +static void RecordedOpponentDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + u8 multihit = gBattleBufferA[gActiveBank][11]; + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute + && !gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8) + { + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 1; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute && multihit < 2) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->bankData[gActiveBank].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + RecordedOpponentBufferExecCompleted(); + } + break; + } +} + +static void RecordedOpponentHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void RecordedOpponentHandlePrintStringPlayerOnly(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChooseAction(void) +{ + EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBank), 0); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleUnknownYesNoBox(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChooseMove(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + } + else + { + u8 moveId = RecordedBattle_ReadBankAction(gActiveBank); + u8 target = RecordedBattle_ReadBankAction(gActiveBank); + EmitTwoReturnValues(1, 10, moveId | (target << 8)); + } + + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChooseItem(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChoosePokemon(void) +{ + *(gBattleStruct->field_5C + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank); + EmitChosenMonReturnValue(1, *(gBattleStruct->field_5C + gActiveBank), NULL); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd23(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void RecordedOpponentHandleExpUpdate(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleStatusIconUpdate(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 bank; + + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_STATUS_ICON); + bank = gActiveBank; + gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedOpponentHandleStatusAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + DoStatusAnimation(gBattleBufferA[gActiveBank][1], + gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8) | (gBattleBufferA[gActiveBank][4] << 16) | (gBattleBufferA[gActiveBank][5] << 24)); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedStatusAnimation; + } +} + +static void RecordedOpponentHandleStatusXor(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleDataTransfer(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleDMA3Transfer(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandlePlayBGM(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd32(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleTwoReturnValues(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleChosenMonReturnValue(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleOneReturnValue(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleOneReturnValue_Duplicate(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd37(void) +{ + gUnknown_02022D0C.field_0 = 0; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd38(void) +{ + gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBank][1]; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd39(void) +{ + gUnknown_02022D0C.flag_x80 = 0; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd40(void) +{ + gUnknown_02022D0C.flag_x80 ^= 1; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + RecordedOpponentBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void RecordedOpponentHandleCmd42(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleFaintingCry(void) +{ + u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry3(species, 25, 5); + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 35; + gSprites[gBankSpriteIds[gActiveBank]].data2 = 280; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_818962C); + + taskId = CreateTask(sub_8189548, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_70; +} + +static void sub_8189548(u8 taskId) +{ + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81885D8(gActiveBank, FALSE); + } + else + { + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81885D8(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_81885D8(gActiveBank, FALSE); + gActiveBank ^= BIT_MON; + } + gBattleBankFunc[gActiveBank] = sub_818686C; + gActiveBank = savedActiveBank; + DestroyTask(taskId); +} + +static void sub_818962C(struct Sprite *sprite) +{ + FreeTrainerFrontPicPalette(sprite->oam.affineParam); + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); +} + +static void RecordedOpponentHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + RecordedOpponentBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + + if (gBattleBufferA[gActiveBank][2] != 0) + { + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E < 2) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E++; + return; + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1E = 0; + } + } + + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + + if (gBattleBufferA[gActiveBank][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0x5D; + + gBattleBankFunc[gActiveBank] = sub_818975C; + } +} + +static void sub_818975C(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5++ > 0x5C) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_5 = 0; + RecordedOpponentBufferExecCompleted(); + } +} + +static void RecordedOpponentHandleCmd49(void) +{ + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd50(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleSpriteInvisibility(void) +{ + if (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + CopyBattleSpriteInvisibility(gActiveBank); + } + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleBattleAnimation(void) +{ + if (!mplay_80342A4(gActiveBank)) + { + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + RecordedOpponentBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; + } +} + +static void RecordedOpponentHandleLinkStandbyMsg(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleResetActionMoveSelection(void) +{ + RecordedOpponentBufferExecCompleted(); +} + +static void RecordedOpponentHandleCmd55(void) +{ + if (gBattleBufferA[gActiveBank][1] == BATTLE_DREW) + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + else + gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ BATTLE_DREW; + + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + RecordedOpponentBufferExecCompleted(); + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_119(void) +{ +} diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c new file mode 100644 index 000000000..a3343a391 --- /dev/null +++ b/src/battle_controller_recorded_player.c @@ -0,0 +1,1844 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_ai_script_commands.h" +#include "recorded_battle.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gPartnerTrainerId; +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u8 gUnknown_020244B4[]; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern 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_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); + +// this file's functions +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); + +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); + +static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + RecordedPlayerHandleGetMonData, + RecordedPlayerHandleGetRawMonData, + RecordedPlayerHandleSetMonData, + RecordedPlayerHandleSetRawMonData, + RecordedPlayerHandleLoadMonSprite, + RecordedPlayerHandleSwitchInAnim, + RecordedPlayerHandleReturnMonToBall, + RecordedPlayerHandleDrawTrainerPic, + RecordedPlayerHandleTrainerSlide, + RecordedPlayerHandleTrainerSlideBack, + RecordedPlayerHandleFaintAnimation, + RecordedPlayerHandlePaletteFade, + RecordedPlayerHandleSuccessBallThrowAnim, + RecordedPlayerHandleBallThrowAnim, + RecordedPlayerHandlePause, + RecordedPlayerHandleMoveAnimation, + RecordedPlayerHandlePrintString, + RecordedPlayerHandlePrintStringPlayerOnly, + RecordedPlayerHandleChooseAction, + RecordedPlayerHandleUnknownYesNoBox, + RecordedPlayerHandleChooseMove, + RecordedPlayerHandleChooseItem, + RecordedPlayerHandleChoosePokemon, + RecordedPlayerHandleCmd23, + RecordedPlayerHandleHealthBarUpdate, + RecordedPlayerHandleExpUpdate, + RecordedPlayerHandleStatusIconUpdate, + RecordedPlayerHandleStatusAnimation, + RecordedPlayerHandleStatusXor, + RecordedPlayerHandleDataTransfer, + RecordedPlayerHandleDMA3Transfer, + RecordedPlayerHandlePlayBGM, + RecordedPlayerHandleCmd32, + RecordedPlayerHandleTwoReturnValues, + RecordedPlayerHandleChosenMonReturnValue, + RecordedPlayerHandleOneReturnValue, + RecordedPlayerHandleOneReturnValue_Duplicate, + RecordedPlayerHandleCmd37, + RecordedPlayerHandleCmd38, + RecordedPlayerHandleCmd39, + RecordedPlayerHandleCmd40, + RecordedPlayerHandleHitAnimation, + RecordedPlayerHandleCmd42, + RecordedPlayerHandleEffectivenessSound, + RecordedPlayerHandlePlayFanfareOrBGM, + RecordedPlayerHandleFaintingCry, + RecordedPlayerHandleIntroSlide, + RecordedPlayerHandleIntroTrainerBallThrow, + RecordedPlayerHandleDrawPartyStatusSummary, + RecordedPlayerHandleCmd49, + RecordedPlayerHandleCmd50, + RecordedPlayerHandleSpriteInvisibility, + RecordedPlayerHandleBattleAnimation, + RecordedPlayerHandleLinkStandbyMsg, + RecordedPlayerHandleResetActionMoveSelection, + RecordedPlayerHandleCmd55, + nullsub_121 +}; + +static void nullsub_120(void) +{ +} + +void SetControllerToRecordedPlayer(void) +{ + gBattleBankFunc[gActiveBank] = RecordedPlayerBufferRunCommand; +} + +static void RecordedPlayerBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sRecordedPlayerBufferCommands)) + sRecordedPlayerBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + 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], HEALTH_BAR, 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) + { + CopyBattleSpriteInvisibility(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] = CONTROLLER_TERMINATOR_NOP; + } + 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 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyRecordedPlayerMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += CopyRecordedPlayerMonData(i, monData + size); + monToCheck >>= 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_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void RecordedPlayerHandleGetRawMonData(void) +{ + RecordedPlayerBufferExecCompleted(); +} + +static void RecordedPlayerHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetRecordedPlayerMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetRecordedPlayerMonData(i); + monToCheck >>= 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_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void 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_PLAYER_MON); + gBattleBankFunc[gActiveBank] = sub_818A1B0; + } + break; + } +} + +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[GetBankMultiplayerId(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 (IsBankSpritePresent(gActiveBank)) + { + gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1]; + CopyBattleSpriteInvisibility(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) +{ +} diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c new file mode 100644 index 000000000..0c5b698cf --- /dev/null +++ b/src/battle_controller_safari.c @@ -0,0 +1,714 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "songs.h" +#include "sound.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "pokeball.h" +#include "data2.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern void (*gPreBattleCallback1)(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct SpriteTemplate gUnknown_0202499C; +extern u16 gScriptItemId; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u8 gBankInMenu; +extern u16 gUnknown_020243FC; + +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; + +extern const u8 gText_SafariZoneMenu[]; +extern const u8 gText_WhatWillPkmnDo2[]; + +extern void sub_81358F4(void); + +// this file's functions +static void SafariHandleGetMonData(void); +static void SafariHandleGetRawMonData(void); +static void SafariHandleSetMonData(void); +static void SafariHandleSetRawMonData(void); +static void SafariHandleLoadMonSprite(void); +static void SafariHandleSwitchInAnim(void); +static void SafariHandleReturnMonToBall(void); +static void SafariHandleDrawTrainerPic(void); +static void SafariHandleTrainerSlide(void); +static void SafariHandleTrainerSlideBack(void); +static void SafariHandleFaintAnimation(void); +static void SafariHandlePaletteFade(void); +static void SafariHandleSuccessBallThrowAnim(void); +static void SafariHandleBallThrowAnim(void); +static void SafariHandlePause(void); +static void SafariHandleMoveAnimation(void); +static void SafariHandlePrintString(void); +static void SafariHandlePrintStringPlayerOnly(void); +static void SafariHandleChooseAction(void); +static void SafariHandleUnknownYesNoBox(void); +static void SafariHandleChooseMove(void); +static void SafariHandleChooseItem(void); +static void SafariHandleChoosePokemon(void); +static void SafariHandleCmd23(void); +static void SafariHandleHealthBarUpdate(void); +static void SafariHandleExpUpdate(void); +static void SafariHandleStatusIconUpdate(void); +static void SafariHandleStatusAnimation(void); +static void SafariHandleStatusXor(void); +static void SafariHandleDataTransfer(void); +static void SafariHandleDMA3Transfer(void); +static void SafariHandlePlayBGM(void); +static void SafariHandleCmd32(void); +static void SafariHandleTwoReturnValues(void); +static void SafariHandleChosenMonReturnValue(void); +static void SafariHandleOneReturnValue(void); +static void SafariHandleOneReturnValue_Duplicate(void); +static void SafariHandleCmd37(void); +static void SafariHandleCmd38(void); +static void SafariHandleCmd39(void); +static void SafariHandleCmd40(void); +static void SafariHandleHitAnimation(void); +static void SafariHandleCmd42(void); +static void SafariHandleEffectivenessSound(void); +static void SafariHandlePlayFanfareOrBGM(void); +static void SafariHandleFaintingCry(void); +static void SafariHandleIntroSlide(void); +static void SafariHandleIntroTrainerBallThrow(void); +static void SafariHandleDrawPartyStatusSummary(void); +static void SafariHandleCmd49(void); +static void SafariHandleCmd50(void); +static void SafariHandleSpriteInvisibility(void); +static void SafariHandleBattleAnimation(void); +static void SafariHandleLinkStandbyMsg(void); +static void SafariHandleResetActionMoveSelection(void); +static void SafariHandleCmd55(void); +static void nullsub_115(void); + +static void SafariBufferRunCommand(void); +static void SafariBufferExecCompleted(void); +static void CompleteWhenChosePokeblock(void); + +static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + SafariHandleGetMonData, + SafariHandleGetRawMonData, + SafariHandleSetMonData, + SafariHandleSetRawMonData, + SafariHandleLoadMonSprite, + SafariHandleSwitchInAnim, + SafariHandleReturnMonToBall, + SafariHandleDrawTrainerPic, + SafariHandleTrainerSlide, + SafariHandleTrainerSlideBack, + SafariHandleFaintAnimation, + SafariHandlePaletteFade, + SafariHandleSuccessBallThrowAnim, + SafariHandleBallThrowAnim, + SafariHandlePause, + SafariHandleMoveAnimation, + SafariHandlePrintString, + SafariHandlePrintStringPlayerOnly, + SafariHandleChooseAction, + SafariHandleUnknownYesNoBox, + SafariHandleChooseMove, + SafariHandleChooseItem, + SafariHandleChoosePokemon, + SafariHandleCmd23, + SafariHandleHealthBarUpdate, + SafariHandleExpUpdate, + SafariHandleStatusIconUpdate, + SafariHandleStatusAnimation, + SafariHandleStatusXor, + SafariHandleDataTransfer, + SafariHandleDMA3Transfer, + SafariHandlePlayBGM, + SafariHandleCmd32, + SafariHandleTwoReturnValues, + SafariHandleChosenMonReturnValue, + SafariHandleOneReturnValue, + SafariHandleOneReturnValue_Duplicate, + SafariHandleCmd37, + SafariHandleCmd38, + SafariHandleCmd39, + SafariHandleCmd40, + SafariHandleHitAnimation, + SafariHandleCmd42, + SafariHandleEffectivenessSound, + SafariHandlePlayFanfareOrBGM, + SafariHandleFaintingCry, + SafariHandleIntroSlide, + SafariHandleIntroTrainerBallThrow, + SafariHandleDrawPartyStatusSummary, + SafariHandleCmd49, + SafariHandleCmd50, + SafariHandleSpriteInvisibility, + SafariHandleBattleAnimation, + SafariHandleLinkStandbyMsg, + SafariHandleResetActionMoveSelection, + SafariHandleCmd55, + nullsub_115 +}; + +static void nullsub_114(void) +{ +} + +void SetControllerToSafari(void) +{ + gBattleBankFunc[gActiveBank] = SafariBufferRunCommand; +} + +static void SafariBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sSafariBufferCommands)) + sSafariBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + SafariBufferExecCompleted(); + } +} + +static void HandleInputChooseAction(void) +{ + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + switch (gActionSelectionCursor[gActiveBank]) + { + case 0: + EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_BALL, 0); + break; + case 1: + EmitTwoReturnValues(1, ACTION_POKEBLOCK_CASE, 0); + break; + case 2: + EmitTwoReturnValues(1, ACTION_GO_NEAR, 0); + break; + case 3: + EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_RUN, 0); + break; + } + SafariBufferExecCompleted(); + } + else if (gMain.newKeys & DPAD_LEFT) + { + if (gActionSelectionCursor[gActiveBank] & 1) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_RIGHT) + { + if (!(gActionSelectionCursor[gActiveBank] & 1)) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_UP) + { + if (gActionSelectionCursor[gActiveBank] & 2) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (!(gActionSelectionCursor[gActiveBank] & 2)) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]); + gActionSelectionCursor[gActiveBank] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + } + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + SafariBufferExecCompleted(); +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + SafariBufferExecCompleted(); +} + +static void CompleteOnHealthboxSpriteCallbackDummy(void) +{ + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + SafariBufferExecCompleted(); +} + +static void sub_81595E4(void) +{ + if (!gPaletteFade.active) + { + gMain.inBattle = FALSE; + gMain.callback1 = gPreBattleCallback1; + SetMainCallback2(gMain.savedCallback); + } +} + +static void CompleteOnSpecialAnimDone(void) +{ + if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + SafariBufferExecCompleted(); +} + +static void OpenPokeblockCase(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = CompleteWhenChosePokeblock; + FreeAllWindowBuffers(); + sub_81358F4(); + } +} + +static void CompleteWhenChosePokeblock(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitOneReturnValue(1, gScriptItemId); + SafariBufferExecCompleted(); + } +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + SafariBufferExecCompleted(); +} + +static void SafariBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = SafariBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + SafariBufferExecCompleted(); +} + +static void SafariHandleGetMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleGetRawMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSetMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSetRawMonData(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleLoadMonSprite(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSwitchInAnim(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleReturnMonToBall(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleDrawTrainerPic(void) +{ + DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank); + sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite( + &gUnknown_0202499C, + 80, + (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80, + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void SafariHandleTrainerSlide(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleTrainerSlideBack(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleFaintAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePaletteFade(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSuccessBallThrowAnim(void) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void SafariHandleBallThrowAnim(void) +{ + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; +} + +static void SafariHandlePause(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleMoveAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void SafariHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + SafariHandlePrintString(); + else + SafariBufferExecCompleted(); +} + +static void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = HandleInputChooseAction; + } +} + +static void SafariHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + BattleHandleAddTextPrinter(gText_SafariZoneMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo2); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +static void SafariHandleUnknownYesNoBox(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChooseMove(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChooseItem(void) +{ + s32 i; + + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = OpenPokeblockCase; + gBankInMenu = gActiveBank; +} + +static void SafariHandleChoosePokemon(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd23(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleHealthBarUpdate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleExpUpdate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusIconUpdate(void) +{ + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_BALLS_TEXT); + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleStatusXor(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleDataTransfer(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleDMA3Transfer(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandlePlayBGM(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd32(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleTwoReturnValues(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleChosenMonReturnValue(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleOneReturnValue(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleOneReturnValue_Duplicate(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd37(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd38(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd39(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd40(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleHitAnimation(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd42(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleEffectivenessSound(void) +{ + s8 pan; + + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + pan = PAN_SIDE_PLAYER; + else + pan = PAN_SIDE_OPPONENT; + + PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan); + SafariBufferExecCompleted(); +} + +static void SafariHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + SafariBufferExecCompleted(); +} + +static void SafariHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry1(species, 25); + SafariBufferExecCompleted(); +} + +static void SafariHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + SafariBufferExecCompleted(); +} + +static void SafariHandleIntroTrainerBallThrow(void) +{ + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_ALL_TEXT); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + gBattleBankFunc[gActiveBank] = CompleteOnHealthboxSpriteCallbackDummy; +} + +static void SafariHandleDrawPartyStatusSummary(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd49(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd50(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleSpriteInvisibility(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleBattleAnimation(void) +{ + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + SafariBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; +} + +static void SafariHandleLinkStandbyMsg(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleResetActionMoveSelection(void) +{ + SafariBufferExecCompleted(); +} + +static void SafariHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + SafariBufferExecCompleted(); + if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_WILD)) + gBattleBankFunc[gActiveBank] = sub_81595E4; +} + +static void nullsub_115(void) +{ +} diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c new file mode 100644 index 000000000..c2addd30c --- /dev/null +++ b/src/battle_controller_wally.c @@ -0,0 +1,1597 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_message.h" +#include "battle_interface.h" +#include "battle_anim.h" +#include "battle_link_817C95C.h" +#include "pokemon.h" +#include "link.h" +#include "util.h" +#include "main.h" +#include "item.h" +#include "items.h" +#include "songs.h" +#include "sound.h" +#include "moves.h" +#include "window.h" +#include "m4a.h" +#include "palette.h" +#include "task.h" +#include "text.h" +#include "string_util.h" +#include "bg.h" +#include "reshow_battle_screen.h" +#include "rng.h" +#include "pokeball.h" +#include "data2.h" +#include "party_menu.h" + +extern u32 gBattleExecBuffer; +extern u8 gActiveBank; +extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; +extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT]; +extern u8 gAbsentBankFlags; +extern u8 gNoOfAllBanks; +extern bool8 gDoingBattleAnim; +extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern u8 gMultiUsePlayerCursor; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern struct MusicPlayerInfo gMPlay_BGM; +extern u16 gPartnerTrainerId; +extern struct SpriteTemplate gUnknown_0202499C; +extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; +extern u16 gScriptItemId; +extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; +extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; +extern u8 gBattleOutcome; +extern u8 gNumberOfMovesToChoose; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern s32 gUnknown_0203CD70; +extern u8 gBankInMenu; +extern u32 gBattlePalaceMoveSelectionRngValue; +extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT]; +extern u8 gUnknown_020244B4[]; +extern u16 gUnknown_020243FC; +extern struct UnusedControllerStruct gUnknown_02022D0C; + +extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; + +extern const u8 gText_WhatWillWallyDo[]; +extern const u8 gText_BattleMenu[]; + +extern void sub_8172EF0(u8 bank, struct Pokemon *mon); +extern void sub_806A068(u16, u8); + +// this file's functions +static void WallyHandleGetMonData(void); +static void WallyHandleGetRawMonData(void); +static void WallyHandleSetMonData(void); +static void WallyHandleSetRawMonData(void); +static void WallyHandleLoadMonSprite(void); +static void WallyHandleSwitchInAnim(void); +static void WallyHandleReturnMonToBall(void); +static void WallyHandleDrawTrainerPic(void); +static void WallyHandleTrainerSlide(void); +static void WallyHandleTrainerSlideBack(void); +static void WallyHandleFaintAnimation(void); +static void WallyHandlePaletteFade(void); +static void WallyHandleSuccessBallThrowAnim(void); +static void WallyHandleBallThrowAnim(void); +static void WallyHandlePause(void); +static void WallyHandleMoveAnimation(void); +static void WallyHandlePrintString(void); +static void WallyHandlePrintStringPlayerOnly(void); +static void WallyHandleChooseAction(void); +static void WallyHandleUnknownYesNoBox(void); +static void WallyHandleChooseMove(void); +static void WallyHandleChooseItem(void); +static void WallyHandleChoosePokemon(void); +static void WallyHandleCmd23(void); +static void WallyHandleHealthBarUpdate(void); +static void WallyHandleExpUpdate(void); +static void WallyHandleStatusIconUpdate(void); +static void WallyHandleStatusAnimation(void); +static void WallyHandleStatusXor(void); +static void WallyHandleDataTransfer(void); +static void WallyHandleDMA3Transfer(void); +static void WallyHandlePlayBGM(void); +static void WallyHandleCmd32(void); +static void WallyHandleTwoReturnValues(void); +static void WallyHandleChosenMonReturnValue(void); +static void WallyHandleOneReturnValue(void); +static void WallyHandleOneReturnValue_Duplicate(void); +static void WallyHandleCmd37(void); +static void WallyHandleCmd38(void); +static void WallyHandleCmd39(void); +static void WallyHandleCmd40(void); +static void WallyHandleHitAnimation(void); +static void WallyHandleCmd42(void); +static void WallyHandleEffectivenessSound(void); +static void WallyHandlePlayFanfareOrBGM(void); +static void WallyHandleFaintingCry(void); +static void WallyHandleIntroSlide(void); +static void WallyHandleIntroTrainerBallThrow(void); +static void WallyHandleDrawPartyStatusSummary(void); +static void WallyHandleCmd49(void); +static void WallyHandleCmd50(void); +static void WallyHandleSpriteInvisibility(void); +static void WallyHandleBattleAnimation(void); +static void WallyHandleLinkStandbyMsg(void); +static void WallyHandleResetActionMoveSelection(void); +static void WallyHandleCmd55(void); +static void nullsub_118(void); + +static void WallyBufferRunCommand(void); +static void WallyBufferExecCompleted(void); +static void CompleteOnChosenItem(void); +static void sub_8168818(void); +static u32 CopyWallyMonData(u8 monId, u8 *dst); +static void SetWallyMonData(u8 monId); +static void WallyDoMoveAnimation(void); +static void sub_816AC04(u8 taskId); + +static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +{ + WallyHandleGetMonData, + WallyHandleGetRawMonData, + WallyHandleSetMonData, + WallyHandleSetRawMonData, + WallyHandleLoadMonSprite, + WallyHandleSwitchInAnim, + WallyHandleReturnMonToBall, + WallyHandleDrawTrainerPic, + WallyHandleTrainerSlide, + WallyHandleTrainerSlideBack, + WallyHandleFaintAnimation, + WallyHandlePaletteFade, + WallyHandleSuccessBallThrowAnim, + WallyHandleBallThrowAnim, + WallyHandlePause, + WallyHandleMoveAnimation, + WallyHandlePrintString, + WallyHandlePrintStringPlayerOnly, + WallyHandleChooseAction, + WallyHandleUnknownYesNoBox, + WallyHandleChooseMove, + WallyHandleChooseItem, + WallyHandleChoosePokemon, + WallyHandleCmd23, + WallyHandleHealthBarUpdate, + WallyHandleExpUpdate, + WallyHandleStatusIconUpdate, + WallyHandleStatusAnimation, + WallyHandleStatusXor, + WallyHandleDataTransfer, + WallyHandleDMA3Transfer, + WallyHandlePlayBGM, + WallyHandleCmd32, + WallyHandleTwoReturnValues, + WallyHandleChosenMonReturnValue, + WallyHandleOneReturnValue, + WallyHandleOneReturnValue_Duplicate, + WallyHandleCmd37, + WallyHandleCmd38, + WallyHandleCmd39, + WallyHandleCmd40, + WallyHandleHitAnimation, + WallyHandleCmd42, + WallyHandleEffectivenessSound, + WallyHandlePlayFanfareOrBGM, + WallyHandleFaintingCry, + WallyHandleIntroSlide, + WallyHandleIntroTrainerBallThrow, + WallyHandleDrawPartyStatusSummary, + WallyHandleCmd49, + WallyHandleCmd50, + WallyHandleSpriteInvisibility, + WallyHandleBattleAnimation, + WallyHandleLinkStandbyMsg, + WallyHandleResetActionMoveSelection, + WallyHandleCmd55, + nullsub_118 +}; + +static void nullsub_117(void) +{ +} + +void SetControllerToWally(void) +{ + gBattleBankFunc[gActiveBank] = WallyBufferRunCommand; + gBattleStruct->wallyBattleState = 0; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 0; + gBattleStruct->wallyMoveFrames = 0; +} + +static void WallyBufferRunCommand(void) +{ + if (gBattleExecBuffer & gBitTable[gActiveBank]) + { + if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sWallyBufferCommands)) + sWallyBufferCommands[gBattleBufferA[gActiveBank][0]](); + else + WallyBufferExecCompleted(); + } +} + +static void WallyHandleActions(void) +{ + switch (gBattleStruct->wallyBattleState) + { + case 0: + gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyBattleState++; + case 1: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 2: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 3: + if (--gBattleStruct->wallyWaitFrames == 0) + { + EmitTwoReturnValues(1, 9, 0); + WallyBufferExecCompleted(); + gBattleStruct->wallyBattleState++; + gBattleStruct->wallyMovesState = 0; + gBattleStruct->wallyWaitFrames = 64; + } + break; + case 4: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + ActionSelectionDestroyCursorAt(0); + ActionSelectionCreateCursorAt(1, 0); + gBattleStruct->wallyWaitFrames = 64; + gBattleStruct->wallyBattleState++; + } + break; + case 5: + if (--gBattleStruct->wallyWaitFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + WallyBufferExecCompleted(); + } + break; + } +} + +static void CompleteOnBankSpriteCallbackDummy(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + WallyBufferExecCompleted(); +} + +static void CompleteOnInactiveTextPrinter(void) +{ + if (!IsTextPrinterActive(0)) + WallyBufferExecCompleted(); +} + +static void CompleteOnFinishedAnimation(void) +{ + if (!gDoingBattleAnim) + WallyBufferExecCompleted(); +} + +static void OpenBagAfterPaletteFade(void) +{ + if (!gPaletteFade.active) + { + gBattleBankFunc[gActiveBank] = CompleteOnChosenItem; + nullsub_35(); + FreeAllWindowBuffers(); + DoWallyTutorialBagMenu(); + } +} + +static void CompleteOnChosenItem(void) +{ + if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) + { + EmitOneReturnValue(1, gScriptItemId); + WallyBufferExecCompleted(); + } +} + +static void sub_816864C(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8) + sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]); + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8) + sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]); + + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 + && gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy + && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + { + if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + { + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL); + sub_8076918(gActiveBank ^ BIT_MON); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]); + } + DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]); + UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL); + sub_8076918(gActiveBank); + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleBankFunc[gActiveBank] = sub_8168818; + } + +} + +static void sub_8168818(void) +{ + bool32 r4 = FALSE; + + if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy) + r4 = TRUE; + + if (r4 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 + && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1) + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; + + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0; + + FreeSpriteTilesByTag(0x27F9); + FreeSpritePaletteByTag(0x27F9); + + CreateTask(c3_0802FDF4, 10); + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + + WallyBufferExecCompleted(); + } +} + +static void CompleteOnHealthbarDone(void) +{ + s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0); + + SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]); + + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT); + } + else + { + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); + WallyBufferExecCompleted(); + } +} + +static void DoHitAnimBlinkSpriteEffect(void) +{ + u8 spriteId = gBankSpriteIds[gActiveBank]; + + if (gSprites[spriteId].data1 == 32) + { + gSprites[spriteId].data1 = 0; + gSprites[spriteId].invisible = 0; + gDoingBattleAnim = FALSE; + WallyBufferExecCompleted(); + } + else + { + if ((gSprites[spriteId].data1 % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data1++; + } +} + +static void sub_8168A20(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + WallyBufferExecCompleted(); + } +} + +static void CompleteOnBankSpriteCallbackDummy2(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) + WallyBufferExecCompleted(); +} + +static void CompleteOnFinishedBattleAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive) + WallyBufferExecCompleted(); +} + +static void WallyBufferExecCompleted(void) +{ + gBattleBankFunc[gActiveBank] = WallyBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); + + PrepareBufferDataTransferLink(2, 4, &playerId); + gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP; + } + else + { + gBattleExecBuffer &= ~gBitTable[gActiveBank]; + } +} + +static void CompleteOnFinishedStatusAnimation(void) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive) + WallyBufferExecCompleted(); +} + +static void WallyHandleGetMonData(void) +{ + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + size += CopyWallyMonData(gBattlePartyID[gActiveBank], monData); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + size += CopyWallyMonData(i, monData + size); + monToCheck >>= 1; + } + } + EmitDataTransfer(1, size, monData); + WallyBufferExecCompleted(); +} + +static u32 CopyWallyMonData(u8 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[20]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < 4; size++) + { + battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG); + battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY); + battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); + StringCopy10(battleMon.nickname, nickname); + GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < 4; size++) + { + moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + src = (u8*)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < 4; size++) + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void WallyHandleGetRawMonData(void) +{ + PlayerHandleGetRawMonData(); +} + +static void WallyHandleSetMonData(void) +{ + u8 monToCheck; + u8 i; + + if (gBattleBufferA[gActiveBank][2] == 0) + { + SetWallyMonData(gBattlePartyID[gActiveBank]); + } + else + { + monToCheck = gBattleBufferA[gActiveBank][2]; + for (i = 0; i < 6; i++) + { + if (monToCheck & 1) + SetWallyMonData(i); + monToCheck >>= 1; + } + } + WallyBufferExecCompleted(); +} + +static void SetWallyMonData(u8 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3]; + s32 i; + + switch (gBattleBufferA[gActiveBank][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < 4; i++) + { + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]); + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]); + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]); + break; + } + + sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); +} + +static void WallyHandleSetRawMonData(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleLoadMonSprite(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSwitchInAnim(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleReturnMonToBall(void) +{ + if (gBattleBufferA[gActiveBank][1] == 0) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON); + gBattleBankFunc[gActiveBank] = sub_8168A20; + } + else + { + FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]); + DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]); + SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]); + WallyBufferExecCompleted(); + } +} + +static void WallyHandleDrawTrainerPic(void) +{ + DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); + sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + 80, + 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240; + gSprites[gBankSpriteIds[gActiveBank]].data0 = -2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy; +} + +static void WallyHandleTrainerSlide(void) +{ + DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); + sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); + gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, + 80, + 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), + 30); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; + gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -96; + gSprites[gBankSpriteIds[gActiveBank]].data0 = 2; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC; + gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2; +} + +static void WallyHandleTrainerSlideBack(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleFaintAnimation(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandlePaletteFade(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSuccessBallThrowAnim(void) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; +} + +static void WallyHandleBallThrowAnim(void) +{ + u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1]; + + gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; + gDoingBattleAnim = TRUE; + DoSpecialBattleAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); + gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; +} + +static void WallyHandlePause(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + gAnimMoveTurn = gBattleBufferA[gActiveBank][3]; + gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8); + gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24); + gAnimFriendship = gBattleBufferA[gActiveBank][10]; + gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16]; + gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality; + if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE + { + WallyBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + gBattleBankFunc[gActiveBank] = WallyDoMoveAnimation; + } + +} + +static void WallyDoMoveAnimation(void) +{ + u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8); + + switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState) + { + case 0: + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805EB9C(0); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_805EB9C(1); + if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute) + { + DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE); + } + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) + { + sub_805E394(); + TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; + WallyBufferExecCompleted(); + } + break; + } +} + +static void WallyHandlePrintString(void) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16*)(&gBattleBufferA[gActiveBank][2]); + BufferStringBattle(*stringId); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter; +} + +static void WallyHandlePrintStringPlayerOnly(void) +{ + if (GetBankSide(gActiveBank) == SIDE_PLAYER) + WallyHandlePrintString(); + else + WallyBufferExecCompleted(); +} + +static void HandleChooseActionAfterDma3(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 160; + gBattleBankFunc[gActiveBank] = WallyHandleActions; + } +} + +static void WallyHandleChooseAction(void) +{ + s32 i; + + gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3; + BattleHandleAddTextPrinter(gText_BattleMenu, 2); + + for (i = 0; i < 4; i++) + ActionSelectionDestroyCursorAt(i); + + ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0); + BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillWallyDo); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 1); +} + +static void WallyHandleUnknownYesNoBox(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleChooseMove(void) +{ + switch (gBattleStruct->wallyMovesState) + { + case 0: + InitMoveSelectionsVarsAndStrings(); + gBattleStruct->wallyMovesState++; + gBattleStruct->wallyMoveFrames = 80; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0x140; + gBattleStruct->wallyMovesState++; + } + break; + case 2: + if (--gBattleStruct->wallyMoveFrames == 0) + { + PlaySE(SE_SELECT); + EmitTwoReturnValues(1, 10, 0x100); + WallyBufferExecCompleted(); + } + break; + } +} + +static void WallyHandleChooseItem(void) +{ + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattleBankFunc[gActiveBank] = OpenBagAfterPaletteFade; + gBankInMenu = gActiveBank; +} + +static void WallyHandleChoosePokemon(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd23(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleHealthBarUpdate(void) +{ + s16 hpVal; + + LoadBattleBarGfx(0); + hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP); + + SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT); + } + + gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone; +} + +static void WallyHandleExpUpdate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusIconUpdate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusAnimation(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleStatusXor(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleDataTransfer(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleDMA3Transfer(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandlePlayBGM(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd32(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleTwoReturnValues(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleChosenMonReturnValue(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleOneReturnValue(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleOneReturnValue_Duplicate(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd37(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd38(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd39(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd40(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleHitAnimation(void) +{ + if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE) + { + WallyBufferExecCompleted(); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; + DoHitAnimHealthboxEffect(gActiveBank); + gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; + } +} + +static void WallyHandleCmd42(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleEffectivenessSound(void) +{ + PlaySE(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + WallyBufferExecCompleted(); +} + +static void WallyHandlePlayFanfareOrBGM(void) +{ + if (gBattleBufferA[gActiveBank][3]) + { + BattleMusicStop(); + PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + else + { + PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8)); + } + + WallyBufferExecCompleted(); +} + +static void WallyHandleFaintingCry(void) +{ + u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); + + PlayCry1(species, 25); + WallyBufferExecCompleted(); +} + +static void WallyHandleIntroSlide(void) +{ + HandleIntroSlide(gBattleBufferA[gActiveBank][1]); + gUnknown_020243FC |= 1; + WallyBufferExecCompleted(); +} + +static void WallyHandleIntroTrainerBallThrow(void) +{ + u8 paletteNum; + u8 taskId; + + oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]); + + gSprites[gBankSpriteIds[gActiveBank]].data0 = 50; + gSprites[gBankSpriteIds[gActiveBank]].data2 = -40; + gSprites[gBankSpriteIds[gActiveBank]].data4 = gSprites[gBankSpriteIds[gActiveBank]].pos1.y; + gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC; + gSprites[gBankSpriteIds[gActiveBank]].data5 = gActiveBank; + + StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00); + StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1); + + paletteNum = AllocSpritePalette(0xD6F8); + LoadCompressedPalette(gTrainerBackPicPaletteTable[BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32); + gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum; + + taskId = CreateTask(sub_816AC04, 5); + gTasks[taskId].data[0] = gActiveBank; + + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1) + gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30; + + gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleBankFunc[gActiveBank] = nullsub_21; +} + +static void sub_816AA80(u8 bank) +{ + u16 species; + + gBattleSpritesDataPtr->bankData[bank].transformSpecies = 0; + gBattlePartyID[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); + sub_806A068(species, GetBankIdentity(bank)); + gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + sub_80A5C6C(bank, 2), + sub_80A6138(bank), + sub_80A82E4(bank)); + + gSprites[gUnknown_03005D7C[bank]].data1 = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data2 = bank; + + gSprites[gBankSpriteIds[bank]].data0 = bank; + gSprites[gBankSpriteIds[bank]].data2 = species; + gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + + StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + gSprites[gBankSpriteIds[bank]].invisible = TRUE; + gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF); +} + +static void sub_816AC04(u8 taskId) +{ + if (gTasks[taskId].data[1] < 31) + { + gTasks[taskId].data[1]++; + } + else + { + u8 savedActiveBank = gActiveBank; + + gActiveBank = gTasks[taskId].data[0]; + gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank]; + sub_816AA80(gActiveBank); + gBattleBankFunc[gActiveBank] = sub_816864C; + gActiveBank = savedActiveBank; + DestroyTask(taskId); + } +} + +static void WallyHandleDrawPartyStatusSummary(void) +{ + if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER) + { + WallyBufferExecCompleted(); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1; + gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]); + WallyBufferExecCompleted(); + } +} + +static void WallyHandleCmd49(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd50(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleSpriteInvisibility(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleBattleAnimation(void) +{ + u8 animationId = gBattleBufferA[gActiveBank][1]; + u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8); + + if (DoBattleAnimationFromTable(gActiveBank, gActiveBank, gActiveBank, animationId, argument)) + WallyBufferExecCompleted(); + else + gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation; +} + +static void WallyHandleLinkStandbyMsg(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleResetActionMoveSelection(void) +{ + WallyBufferExecCompleted(); +} + +static void WallyHandleCmd55(void) +{ + gBattleOutcome = gBattleBufferA[gActiveBank][1]; + FadeOutMapMusic(5); + BeginFastPaletteFade(3); + WallyBufferExecCompleted(); + + if (!(gBattleTypeFlags & BATTLE_TYPE_WILD) && gBattleTypeFlags & BATTLE_TYPE_LINK) + gBattleBankFunc[gActiveBank] = sub_80587B0; +} + +static void nullsub_118(void) +{ +} diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 9ac18c72f..5c874438e 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -145,30 +145,30 @@ static void SetControllersVariables(void) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) { - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerPartnerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayerPartner; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } else { - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerPartnerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayerPartner; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } @@ -189,15 +189,15 @@ static void SetControllersVariables(void) gBattleMainFunc = BeginBattleIntro; if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) - gBattleBankFunc[0] = SetBankFuncToSafariBufferRunCommand; + gBattleBankFunc[0] = SetControllerToSafari; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) - gBattleBankFunc[0] = SetBankFuncToWallyBufferRunCommand; + gBattleBankFunc[0] = SetControllerToWally; else - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; @@ -210,20 +210,20 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; } else // see how the banks are switched { - gBattleBankFunc[1] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[0] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; @@ -231,10 +231,10 @@ static void SetControllersVariables(void) } else { - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; } } @@ -243,16 +243,16 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; @@ -263,16 +263,16 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = 0; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = 1; - gBattleBankFunc[2] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToRecordedPlayer; gBanksByIdentity[2] = 2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = 3; gNoOfAllBanks = 4; @@ -307,7 +307,7 @@ static void SetControllersVariables(void) if (i == var) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -325,7 +325,7 @@ static void SetControllersVariables(void) else if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[var].lp_field_18 & 1)) || ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[var].lp_field_18 & 1))) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -342,7 +342,7 @@ static void SetControllersVariables(void) } else { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedOpponent; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -361,51 +361,51 @@ static void SetControllersVariables(void) } else if (gBattleTypeFlags & BATTLE_TYPE_WILD) { - gBattleBankFunc[0] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[2] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToRecordedPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; if (gBattleTypeFlags & BATTLE_TYPE_x2000000) { - gBattleBankFunc[1] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[3] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToRecordedOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } else { - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; } } else { - gBattleBankFunc[1] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToRecordedPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[3] = SetBankFuncToRecordedPlayerBufferRunCommand; + gBattleBankFunc[3] = SetControllerToRecordedPlayer; gBanksByIdentity[3] = IDENTITY_PLAYER_MON2; if (gBattleTypeFlags & BATTLE_TYPE_x2000000) { - gBattleBankFunc[0] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToRecordedOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToRecordedOpponentBufferRunCommand; + gBattleBankFunc[2] = SetControllerToRecordedOpponent; gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; } else { - gBattleBankFunc[0] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[2] = SetControllerToOpponent; gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; } } @@ -424,20 +424,20 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToLinkOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; } else { - gBattleBankFunc[1] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[0] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToLinkOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gNoOfAllBanks = 2; @@ -449,32 +449,32 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToLinkOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToLinkOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; } else { - gBattleBankFunc[1] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[1] = SetControllerToPlayer; gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[0] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[0] = SetControllerToLinkOpponent; gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[3] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[3] = SetControllerToPlayer; gBanksByIdentity[3] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[2] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[2] = SetControllerToLinkOpponent; gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; @@ -486,32 +486,32 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattleBankFunc[0] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToPlayer; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToLinkPartnerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToLinkPartner; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; } else { - gBattleBankFunc[0] = SetBankFuncToLinkPartnerBufferRunCommand; + gBattleBankFunc[0] = SetControllerToLinkPartner; gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; - gBattleBankFunc[1] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[1] = SetControllerToLinkOpponent; gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; - gBattleBankFunc[2] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[2] = SetControllerToPlayer; gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; - gBattleBankFunc[3] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[3] = SetControllerToLinkOpponent; gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gNoOfAllBanks = 4; @@ -549,7 +549,7 @@ static void SetControllersVariablesInLinkBattle(void) if (i == multiplayerId) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToPlayerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -569,7 +569,7 @@ static void SetControllersVariablesInLinkBattle(void) if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[multiplayerId].lp_field_18 & 1)) || ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[multiplayerId].lp_field_18 & 1))) { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToLinkPartnerBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToLinkPartner; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -586,7 +586,7 @@ static void SetControllersVariablesInLinkBattle(void) } else { - gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetBankFuncToLinkOpponentBufferRunCommand; + gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToLinkOpponent; switch (gLinkPlayers[i].lp_field_18) { case 0: @@ -939,11 +939,11 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) } } -void EmitGetMonData(u8 bufferId, u8 arg1, u8 arg2) +void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) { gBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA; - gBattleBuffersTransferData[1] = arg1; - gBattleBuffersTransferData[2] = arg2; + gBattleBuffersTransferData[1] = requestId; + gBattleBuffersTransferData[2] = monToCheck; gBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -957,13 +957,13 @@ void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitSetMonData(u8 bufferId, u8 request, u8 c, u8 bytes, void *data) +void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data) { s32 i; gBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA; - gBattleBuffersTransferData[1] = request; - gBattleBuffersTransferData[2] = c; + gBattleBuffersTransferData[1] = requestId; + gBattleBuffersTransferData[2] = monToCheck; for (i = 0; i < bytes; i++) gBattleBuffersTransferData[3 + i] = *(u8*)(data++); PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 3 + bytes); @@ -984,9 +984,9 @@ void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) void EmitLoadMonSprite(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE; - gBattleBuffersTransferData[1] = 4; - gBattleBuffersTransferData[2] = 4; - gBattleBuffersTransferData[3] = 4; + gBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE; + gBattleBuffersTransferData[2] = CONTROLLER_LOADMONSPRITE; + gBattleBuffersTransferData[3] = CONTROLLER_LOADMONSPRITE; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1009,60 +1009,60 @@ void EmitReturnMonToBall(u8 bufferId, u8 arg1) void EmitDrawTrainerPic(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC; - gBattleBuffersTransferData[1] = 7; - gBattleBuffersTransferData[2] = 7; - gBattleBuffersTransferData[3] = 7; + gBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC; + gBattleBuffersTransferData[2] = CONTROLLER_DRAWTRAINERPIC; + gBattleBuffersTransferData[3] = CONTROLLER_DRAWTRAINERPIC; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitTrainerSlide(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE; - gBattleBuffersTransferData[1] = 8; - gBattleBuffersTransferData[2] = 8; - gBattleBuffersTransferData[3] = 8; + gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE; + gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDE; + gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDE; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitTrainerSlideBack(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK; - gBattleBuffersTransferData[1] = 9; - gBattleBuffersTransferData[2] = 9; - gBattleBuffersTransferData[3] = 9; + gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK; + gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDEBACK; + gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDEBACK; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitFaintAnimation(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION; - gBattleBuffersTransferData[1] = 10; - gBattleBuffersTransferData[2] = 10; - gBattleBuffersTransferData[3] = 10; + gBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION; + gBattleBuffersTransferData[2] = CONTROLLER_FAINTANIMATION; + gBattleBuffersTransferData[3] = CONTROLLER_FAINTANIMATION; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd11(u8 bufferId) +void EmitPaletteFade(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_11; - gBattleBuffersTransferData[1] = 11; - gBattleBuffersTransferData[2] = 11; - gBattleBuffersTransferData[3] = 11; + gBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; + gBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; + gBattleBuffersTransferData[2] = CONTROLLER_PALETTEFADE; + gBattleBuffersTransferData[3] = CONTROLLER_PALETTEFADE; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd12(u8 bufferId) +void EmitSuccessBallThrowAnim(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_12; - gBattleBuffersTransferData[1] = 12; - gBattleBuffersTransferData[2] = 12; - gBattleBuffersTransferData[3] = 12; + gBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleBuffersTransferData[2] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleBuffersTransferData[3] = CONTROLLER_SUCCESSBALLTHROWANIM; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitBallThrow(u8 bufferId, u8 caseId) +void EmitBallThrowAnim(u8 bufferId, u8 caseId) { - gBattleBuffersTransferData[0] = CONTROLLER_BALLTHROW; + gBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM; gBattleBuffersTransferData[1] = caseId; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } @@ -1146,7 +1146,7 @@ void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringID) struct StringInfoBattle* stringInfo; gBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY; - gBattleBuffersTransferData[1] = 17; + gBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY; gBattleBuffersTransferData[2] = stringID; gBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; @@ -1178,12 +1178,12 @@ void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd19(u8 bufferId) +void EmitUnknownYesNoBox(u8 bufferId) { - gBattleBuffersTransferData[0] = CONTROLLER_19; - gBattleBuffersTransferData[1] = 19; - gBattleBuffersTransferData[2] = 19; - gBattleBuffersTransferData[3] = 19; + gBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX; + gBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX; + gBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX; + gBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1200,7 +1200,7 @@ void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(*movePpData) + 4); } -void EmitOpenBag(u8 bufferId, u8 *arg1) +void EmitChooseItem(u8 bufferId, u8 *arg1) { s32 i; @@ -1226,9 +1226,9 @@ void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4) void EmitCmd23(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_23; - gBattleBuffersTransferData[1] = 23; - gBattleBuffersTransferData[2] = 23; - gBattleBuffersTransferData[3] = 23; + gBattleBuffersTransferData[1] = CONTROLLER_23; + gBattleBuffersTransferData[2] = CONTROLLER_23; + gBattleBuffersTransferData[3] = CONTROLLER_23; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1289,7 +1289,7 @@ void EmitDataTransfer(u8 bufferId, u16 size, void *data) s32 i; gBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER; - gBattleBuffersTransferData[1] = 29; + gBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER; gBattleBuffersTransferData[2] = size; gBattleBuffersTransferData[3] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) @@ -1337,38 +1337,38 @@ void EmitCmd32(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 3); } -void EmitCmd33(u8 bufferId, u8 arg1, u16 arg2) +void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) { - gBattleBuffersTransferData[0] = CONTROLLER_33; + gBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; gBattleBuffersTransferData[1] = arg1; gBattleBuffersTransferData[2] = arg2; gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd34(u8 bufferId, u8 b, u8 *c) +void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c) { s32 i; - gBattleBuffersTransferData[0] = CONTROLLER_34; + gBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE; gBattleBuffersTransferData[1] = b; for (i = 0; i < 3; i++) gBattleBuffersTransferData[2 + i] = c[i]; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 5); } -void EmitCmd35(u8 bufferId, u16 b) +void EmitOneReturnValue(u8 bufferId, u16 arg1) { - gBattleBuffersTransferData[0] = CONTROLLER_35; - gBattleBuffersTransferData[1] = b; - gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; + gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; + gBattleBuffersTransferData[1] = arg1; + gBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8; gBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd36(u8 bufferId, u16 b) +void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) { - gBattleBuffersTransferData[0] = CONTROLLER_36; + gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; gBattleBuffersTransferData[1] = b; gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; gBattleBuffersTransferData[3] = 0; @@ -1378,9 +1378,9 @@ void EmitCmd36(u8 bufferId, u16 b) void EmitCmd37(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_37; - gBattleBuffersTransferData[1] = 37; - gBattleBuffersTransferData[2] = 37; - gBattleBuffersTransferData[3] = 37; + gBattleBuffersTransferData[1] = CONTROLLER_37; + gBattleBuffersTransferData[2] = CONTROLLER_37; + gBattleBuffersTransferData[3] = CONTROLLER_37; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1394,36 +1394,36 @@ void EmitCmd38(u8 bufferId, u8 b) void EmitCmd39(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_39; - gBattleBuffersTransferData[1] = 39; - gBattleBuffersTransferData[2] = 39; - gBattleBuffersTransferData[3] = 39; + gBattleBuffersTransferData[1] = CONTROLLER_39; + gBattleBuffersTransferData[2] = CONTROLLER_39; + gBattleBuffersTransferData[3] = CONTROLLER_39; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitCmd40(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_40; - gBattleBuffersTransferData[1] = 40; - gBattleBuffersTransferData[2] = 40; - gBattleBuffersTransferData[3] = 40; + gBattleBuffersTransferData[1] = CONTROLLER_40; + gBattleBuffersTransferData[2] = CONTROLLER_40; + gBattleBuffersTransferData[3] = CONTROLLER_40; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitHitAnimation(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION; - gBattleBuffersTransferData[1] = 41; - gBattleBuffersTransferData[2] = 41; - gBattleBuffersTransferData[3] = 41; + gBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION; + gBattleBuffersTransferData[2] = CONTROLLER_HITANIMATION; + gBattleBuffersTransferData[3] = CONTROLLER_HITANIMATION; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitCmd42(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_42; - gBattleBuffersTransferData[1] = 42; - gBattleBuffersTransferData[2] = 42; - gBattleBuffersTransferData[3] = 42; + gBattleBuffersTransferData[1] = CONTROLLER_42; + gBattleBuffersTransferData[2] = CONTROLLER_42; + gBattleBuffersTransferData[3] = CONTROLLER_42; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1448,9 +1448,9 @@ void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM) void EmitFaintingCry(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY; - gBattleBuffersTransferData[1] = 45; - gBattleBuffersTransferData[2] = 45; - gBattleBuffersTransferData[3] = 45; + gBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY; + gBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY; + gBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1464,9 +1464,9 @@ void EmitIntroSlide(u8 bufferId, u8 terrainId) void EmitIntroTrainerBallThrow(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW; - gBattleBuffersTransferData[1] = 47; - gBattleBuffersTransferData[2] = 47; - gBattleBuffersTransferData[3] = 47; + gBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW; + gBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW; + gBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1477,7 +1477,7 @@ void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 gBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; gBattleBuffersTransferData[1] = arg2 & 0x7F; gBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7; - gBattleBuffersTransferData[3] = 48; + gBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * 6); i++) gBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus)); PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4); @@ -1486,18 +1486,18 @@ void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 void EmitCmd49(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_49; - gBattleBuffersTransferData[1] = 49; - gBattleBuffersTransferData[2] = 49; - gBattleBuffersTransferData[3] = 49; + gBattleBuffersTransferData[1] = CONTROLLER_49; + gBattleBuffersTransferData[2] = CONTROLLER_49; + gBattleBuffersTransferData[3] = CONTROLLER_49; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } void EmitCmd50(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_50; - gBattleBuffersTransferData[1] = 50; - gBattleBuffersTransferData[2] = 50; - gBattleBuffersTransferData[3] = 50; + gBattleBuffersTransferData[1] = CONTROLLER_50; + gBattleBuffersTransferData[2] = CONTROLLER_50; + gBattleBuffersTransferData[3] = CONTROLLER_50; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } @@ -1505,8 +1505,8 @@ void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible) { gBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY; gBattleBuffersTransferData[1] = isInvisible; - gBattleBuffersTransferData[2] = 51; - gBattleBuffersTransferData[3] = 51; + gBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY; + gBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } diff --git a/src/battle_dome_cards.c b/src/battle_dome_cards.c index 5251ee06a..e6c67b20e 100644 --- a/src/battle_dome_cards.c +++ b/src/battle_dome_cards.c @@ -124,7 +124,7 @@ static void sub_818D0C4(u16 species, u32 otId, u32 personality, u8 paletteSlot, else { gUnknown_0203CCEC.paletteTag = paletteTag; - LoadCompressedObjectPalette(sub_806E7CC(species, otId, personality)); + LoadCompressedObjectPalette(GetMonSpritePalStructFromOtIdPersonality(species, otId, personality)); } } else diff --git a/src/battle_interface.c b/src/battle_interface.c index 9241db1d9..5f582a366 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -21,23 +21,11 @@ #include "safari_zone.h" #include "battle_anim.h" -enum -{ - HEALTH_BAR, - EXP_BAR -}; - -enum -{ - HP_CURRENT, - HP_MAX -}; - struct TestingBar { s32 maxValue; s32 currValue; - s32 field_8; + s32 receivedValue; u32 unkC_0:5; u32 unk10; }; @@ -189,7 +177,6 @@ extern const u16 gBattleInterface_BallDisplayPal[]; extern const u8 gHealthboxElementsGfxTable[][32]; // functions -extern bool8 IsDoubleBattle(void); extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, const u8 *str); // menu.h extern void LoadBattleBarGfx(u8 arg0); @@ -220,10 +207,10 @@ static void SpriteCB_StatusSummaryBallsOnBattleStart(struct Sprite *sprite); static void SpriteCB_StatusSummaryBallsOnSwitchout(struct Sprite *sprite); static u8 GetStatusIconForBankId(u8 statusElementId, u8 bank); -static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4, u16 arg5); -static u8 GetScaledExpFraction(s32 currValue, s32 arg1, s32 maxValue, u8 scale); +static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5); +static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale); static void sub_8074B9C(u8 bank, u8 whichBar); -static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 *arg4, u8 arg5); +static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 *arg4, u8 arg5); static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2); // const rom data @@ -1055,12 +1042,12 @@ static void sub_8072924(struct Sprite *sprite) sprite->pos2.y = gSprites[otherSpriteId].pos2.y; } -void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 field_C) +void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue) { gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId = healthboxSpriteId; gBattleSpritesDataPtr->battleBars[bank].maxValue = maxVal; gBattleSpritesDataPtr->battleBars[bank].currentValue = currVal; - gBattleSpritesDataPtr->battleBars[bank].field_C = field_C; + gBattleSpritesDataPtr->battleBars[bank].receivedValue = receivedValue; gBattleSpritesDataPtr->battleBars[bank].field_10 = -32768; } @@ -2268,22 +2255,22 @@ s32 sub_8074AA0(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3) { var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, 6, 1); } else // exp bar { u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, gBattleSpritesDataPtr->battleBars[bank].maxValue, 8); if (expFraction == 0) expFraction = 1; - expFraction = abs(gBattleSpritesDataPtr->battleBars[bank].field_C / expFraction); + expFraction = abs(gBattleSpritesDataPtr->battleBars[bank].receivedValue / expFraction); var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, 8, expFraction); } @@ -2299,7 +2286,7 @@ s32 sub_8074AA0(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3) static void sub_8074B9C(u8 bank, u8 whichBar) { - u8 array[7]; + u8 array[8]; u8 subRet, level; u8 barElementId; u8 i; @@ -2309,7 +2296,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar) case HEALTH_BAR: subRet = sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, array, 6); barElementId = 3; @@ -2333,7 +2320,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar) case EXP_BAR: sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue, gBattleSpritesDataPtr->battleBars[bank].currentValue, - gBattleSpritesDataPtr->battleBars[bank].field_C, + gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, array, 8); level = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_LEVEL); @@ -2355,7 +2342,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar) } } -static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4, u16 arg5) +static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5) { s32 r6; s32 ret; @@ -2369,7 +2356,7 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 *arg3 = currValue; } - currValue -= arg2; + currValue -= receivedValue; if (currValue < 0) currValue = 0; else if (currValue > maxValue) @@ -2394,7 +2381,7 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 { s32 var = (maxValue << 8) / arg4; - if (arg2 < 0) + if (receivedValue < 0) { *arg3 = r6 + var; ret = *arg3 >> 8; @@ -2419,7 +2406,7 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 } else { - if (arg2 < 0) + if (receivedValue < 0) { *arg3 += arg5; if (*arg3 > currValue) @@ -2438,9 +2425,9 @@ static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 arg4 return ret; } -static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 arg2, s32 *arg3, u8 *arg4, u8 arg5) +static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 *arg4, u8 arg5) { - s32 r5 = currValue - arg2; + s32 r5 = currValue - receivedValue; u8 ret; u8 i; u8 r2; @@ -2493,7 +2480,7 @@ static s16 sub_8074F28(struct TestingBar *barInfo, s32 *arg1, u16 *arg2, s32 arg ret = sub_8074DB8(barInfo->maxValue, barInfo->currValue, - barInfo->field_8, + barInfo->receivedValue, arg1, 6, 1); sub_8074F88(barInfo, arg1, arg2); @@ -2514,7 +2501,7 @@ static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2) u8 i; sub_8074E8C(barInfo->maxValue, barInfo->currValue, - barInfo->field_8, arg1, sp8, 6); + barInfo->receivedValue, arg1, sp8, 6); for (i = 0; i < 6; i++) sp10[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]); @@ -2522,13 +2509,13 @@ static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2) CpuCopy16(sp10, arg2, sizeof(sp10)); } -static u8 GetScaledExpFraction(s32 currValue, s32 arg1, s32 maxValue, u8 scale) +static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale) { s32 r5, result; s8 r4, r0; scale *= 8; - r5 = currValue - arg1; + r5 = currValue - receivedValue; if (r5 < 0) r5 = 0; diff --git a/src/battle_message.c b/src/battle_message.c index aeff721d6..52c0c7af5 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1858,16 +1858,16 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst) toCpy = gLinkPlayers[multiplayerID].name; break; case B_TXT_1F: // link partner name? - toCpy = gLinkPlayers[sub_806D864(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_20: // link opponent 1 name? - toCpy = gLinkPlayers[sub_806D864(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_21: // link opponent 2 name? - toCpy = gLinkPlayers[sub_806D864(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_22: // link scripting active name - toCpy = gLinkPlayers[sub_806D864(gBattleScripting.bank)].name; + toCpy = gLinkPlayers[GetBankMultiplayerId(gBattleScripting.bank)].name; break; case B_TXT_PLAYER_NAME: // player name if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) @@ -2209,7 +2209,7 @@ static void sub_814F950(u8* dst) } } -void sub_814F9EC(const u8 *text, u8 arg1) +void BattleHandleAddTextPrinter(const u8 *text, u8 arg1) { const u8 *r8 = gUnknown_085CD660[gBattleScripting.field_24]; bool32 r9; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 28357d984..c6cec7f0d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3625,7 +3625,7 @@ static void atk23_getexp(void) if (gBattleExecBuffer == 0) { gActiveBank = gBattleStruct->expGetterBank; - if (gBattleBufferB[gActiveBank][0] == 0x21 && gBattleBufferB[gActiveBank][1] == 0xB) + if (gBattleBufferB[gActiveBank][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBank][1] == RET_VALUE_LEVELLED_UP) { if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId) sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); @@ -5463,7 +5463,7 @@ static void atk4F_jump_if_cannot_switch(void) party = gPlayerParty; val = 0; - if (sub_806D82C(sub_806D864(gActiveBank)) == TRUE) + if (sub_806D82C(GetBankMultiplayerId(gActiveBank)) == TRUE) val = 3; } else @@ -5485,7 +5485,7 @@ static void atk4F_jump_if_cannot_switch(void) val = 0; - if (sub_806D82C(sub_806D864(gActiveBank)) == TRUE) + if (sub_806D82C(GetBankMultiplayerId(gActiveBank)) == TRUE) val = 3; } @@ -6114,33 +6114,33 @@ static void atk5A_yesnoboxlearnmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); if (gBattleCommunication[1] == 0) { - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); gBattleScripting.learnMoveState++; } @@ -6214,7 +6214,7 @@ static void atk5A_yesnoboxlearnmove(void) } break; case 5: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattlescriptCurrInstr += 5; break; case 6: @@ -6231,26 +6231,26 @@ static void atk5B_yesnoboxstoplearningmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { @@ -6261,13 +6261,13 @@ static void atk5B_yesnoboxstoplearningmove(void) else gBattlescriptCurrInstr += 5; - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); } break; } @@ -6527,38 +6527,38 @@ static void atk67_yesnobox(void) switch (gBattleCommunication[0]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[0]++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & B_BUTTON) { gBattleCommunication[CURSOR_POSITION] = 1; PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattlescriptCurrInstr++; } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); gBattlescriptCurrInstr++; } break; @@ -6674,7 +6674,7 @@ static void atk6C_draw_lvlupbox(void) SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 0); ShowBg(0); ShowBg(1); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x80); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80); gBattleScripting.atk6C_state = 4; break; case 4: @@ -6704,7 +6704,7 @@ static void atk6C_draw_lvlupbox(void) if (gMain.newKeys != 0) { PlaySE(SE_SELECT); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x81); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80 | WINDOW_CLEAR); gBattleScripting.atk6C_state++; } break; @@ -7136,8 +7136,8 @@ static void atk76_various(void) gDisableStructs[0].truantUnknownBit = 1; gDisableStructs[1].truantUnknownBit = 1; break; - case 13: - EmitCmd19(0); + case VARIOUS_EMIT_YESNOBOX: + EmitUnknownYesNoBox(0); MarkBufferBankForExecution(gActiveBank); break; case 14: @@ -7148,7 +7148,7 @@ static void atk76_various(void) break; case 16: BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); - sub_814F9EC(gDisplayedStringBattle, 0x16); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0x16); break; case 17: if (IsTextPrinterActive(0x16)) @@ -7255,7 +7255,7 @@ static void atk78_faintifabilitynotdamp(void) { gActiveBank = gBankAttacker; gBattleMoveDamage = gBattleMons[gActiveBank].hp; - EmitHealthBarUpdate(0, 0x7FFF); + EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr++; @@ -7933,7 +7933,7 @@ static void atk8F_forcerandomswitch(void) else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000)) { - if (sub_806D82C(sub_806D864(gBankTarget)) == 1) + if (sub_806D82C(GetBankMultiplayerId(gBankTarget)) == 1) { firstMonId = 3; lastMonId = 6; @@ -8443,7 +8443,7 @@ static void atk9B_transformdataexecution(void) gBattleMons[gBankAttacker].status2 |= STATUS2_TRANSFORMED; gDisableStructs[gBankAttacker].disabledMove = 0; gDisableStructs[gBankAttacker].disableTimer1 = 0; - gDisableStructs[gBankAttacker].unk0 = gBattleMons[gBankTarget].personality; + gDisableStructs[gBankAttacker].transformedMonPersonality = gBattleMons[gBankTarget].personality; gDisableStructs[gBankAttacker].unk18_b = 0; PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBankTarget].species) @@ -9152,7 +9152,7 @@ static void atkA8_copymovepermanently(void) // sketch for (i = 0; i < 4; i++) { - movePpData.move[i] = gBattleMons[gBankAttacker].moves[i]; + movePpData.moves[i] = gBattleMons[gBankAttacker].moves[i]; movePpData.pp[i] = gBattleMons[gBankAttacker].pp[i]; } movePpData.ppBonuses = gBattleMons[gBankAttacker].ppBonuses; @@ -10184,7 +10184,7 @@ static void atkC9_jumpifattackandspecialattackcannotfall(void) // memento { gActiveBank = gBankAttacker; gBattleMoveDamage = gBattleMons[gActiveBank].hp; - EmitHealthBarUpdate(0, 0x7FFF); + EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr += 5; } @@ -11003,13 +11003,13 @@ static void atkEF_pokeball_catch_calculation(void) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - EmitBallThrow(0, BALL_TRAINER_BLOCK); + EmitBallThrowAnim(0, BALL_TRAINER_BLOCK); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr = BattleScript_TrainerBallBlock; } else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) { - EmitBallThrow(0, BALL_3_SHAKES_SUCCESS); + EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr = BattleScript_WallyBallThrow; } @@ -11098,7 +11098,7 @@ static void atkEF_pokeball_catch_calculation(void) if (odds > 254) // mon caught { - EmitBallThrow(0, BALL_3_SHAKES_SUCCESS); + EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); MarkBufferBankForExecution(gActiveBank); gBattlescriptCurrInstr = BattleScript_SuccessBallThrow; SetMonData(&gEnemyParty[gBattlePartyID[gBankTarget]], MON_DATA_POKEBALL, &gLastUsedItem); @@ -11120,7 +11120,7 @@ static void atkEF_pokeball_catch_calculation(void) if (gLastUsedItem == ITEM_MASTER_BALL) shakes = BALL_3_SHAKES_SUCCESS; // why calculate the shakes before that check? - EmitBallThrow(0, shakes); + EmitBallThrowAnim(0, shakes); MarkBufferBankForExecution(gActiveBank); if (shakes == BALL_3_SHAKES_SUCCESS) // mon caught, copy of the code above @@ -11238,7 +11238,7 @@ static void atkF2_display_dex_info(void) } } -void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) { s32 destY, destX; u16 var = 0; @@ -11275,10 +11275,10 @@ void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) var = 0x1026; } - if (flags & 1) + if (flags & WINDOW_CLEAR) var = 0; - if (flags & 0x80) + if (flags & WINDOW_x80) CopyToBgTilemapBufferRect_ChangePalette(1, &var, destX, destY, 1, 1, 0x11); else CopyToBgTilemapBufferRect_ChangePalette(0, &var, destX, destY, 1, 1, 0x11); @@ -11286,7 +11286,7 @@ void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) } } -void BattleCreateCursorAt(u8 cursorPosition) +void BattleCreateYesNoCursorAt(u8 cursorPosition) { u16 src[2]; src[0] = 1; @@ -11296,7 +11296,7 @@ void BattleCreateCursorAt(u8 cursorPosition) CopyBgTilemapBufferToVram(0); } -void BattleDestroyCursorAt(u8 cursorPosition) +void BattleDestroyYesNoCursorAt(u8 cursorPosition) { u16 src[2]; src[0] = 0x1016; @@ -11311,26 +11311,26 @@ static void atkF3_nickname_caught_poke(void) switch (gBattleCommunication[MULTIUSE_STATE]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[MULTIUSE_STATE]++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { diff --git a/src/battle_util.c b/src/battle_util.c index 0a0badb33..468b2c46d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1729,7 +1729,7 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2) if (GetBankSide(bank) == SIDE_PLAYER) { party = gPlayerParty; - r7 = sub_806D864(bank); + r7 = GetBankMultiplayerId(bank); r6 = sub_806D82C(r7); } else @@ -1748,7 +1748,7 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2) } else { - r7 = sub_806D864(bank); + r7 = GetBankMultiplayerId(bank); if (GetBankSide(bank) == SIDE_PLAYER) party = gPlayerParty; else diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c new file mode 100644 index 000000000..eca5d4bdc --- /dev/null +++ b/src/evolution_graphics.c @@ -0,0 +1,611 @@ +#include "global.h" +#include "evolution_graphics.h" +#include "sprite.h" +#include "trig.h" +#include "rng.h" +#include "decompress.h" +#include "task.h" +#include "sound.h" +#include "songs.h" +#include "palette.h" + +// this file's functions +static void EvoSparkle_DummySpriteCb(struct Sprite* sprite); +static void EvoTask_BeginPreSet1_FadeAndPlaySE(u8 taskID); +static void EvoTask_CreatePreEvoSparkleSet1(u8 taskID); +static void EvoTask_WaitForPre1SparklesToGoUp(u8 taskID); +static void EvoTask_BeginPreSparklesSet2(u8 taskID); +static void EvoTask_CreatePreEvoSparklesSet2(u8 taskID); +static void EvoTask_DestroyPreSet2Task(u8 taskID); +static void EvoTask_BeginPostSparklesSet1(u8 taskID); +static void EvoTask_CreatePostEvoSparklesSet1(u8 taskID); +static void EvoTask_DestroyPostSet1Task(u8 taskID); +static void EvoTask_BeginPostSparklesSet2_AndFlash(u8 taskID); +static void EvoTask_CreatePostEvoSparklesSet2_AndFlash(u8 taskID); +static void EvoTask_BeginPostSparklesSet2_AndFlash_Trade(u8 taskID); +static void EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade(u8 taskID); +static void EvoTask_DestroyPostSet2AndFlashTask(u8 taskID); +static void sub_817C4EC(u8 taskID); +static void sub_817C510(u8 taskID); +static void PreEvoVisible_PostEvoInvisible_KillTask(u8 taskID); +static void PreEvoInvisible_PostEvoVisible_KillTask(u8 taskID); +static void sub_817C560(u8 taskID); + +static const u16 sEvoSparklePalette[] = INCBIN_U16("graphics/misc/evo_sparkle.gbapal"); +static const u8 sEvoSparkleTiles[] = INCBIN_U8("graphics/misc/evo_sparkle.4bpp.lz"); + +static const struct CompressedSpriteSheet sEvoSparkleSpriteSheets[] = +{ + {sEvoSparkleTiles, 0x20, 1001}, + {NULL, 0, 0} +}; + +static const struct SpritePalette sEvoSparkleSpritePals[] = +{ + {sEvoSparklePalette, 1001}, + {NULL, 0} +}; + +static const struct OamData sOamData_EvoSparkle = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_EvoSparkle[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_EvoSparkle[] = +{ + sSpriteAnim_EvoSparkle, +}; + +static const struct SpriteTemplate sEvoSparkleSpriteTemplate = +{ + .tileTag = 1001, + .paletteTag = 1001, + .oam = &sOamData_EvoSparkle, + .anims = sSpriteAnimTable_EvoSparkle, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = EvoSparkle_DummySpriteCb +}; + +static const s16 sEvoSparkleMatrices[] = +{ + 0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, 0x240, 0x200, 0x1C0, + 0x180, 0x140, 0x100, -4, 0x10, -3, 0x30, -2, 0x50, + -1, 0x70, 0x1, 0x70, 0x2, 0x50, 0x3, 0x30, 0x4, 0x10 +}; + +static void EvoSparkle_DummySpriteCb(struct Sprite *sprite) +{ + +} + +static void SetEvoSparklesMatrices(void) +{ + u16 i; + for (i = 0; i < 12; i++) + { + SetOamMatrix(20 + i, sEvoSparkleMatrices[i], 0, 0, sEvoSparkleMatrices[i]); + } +} + +static void SpriteCB_PreEvoSparkleSet1(struct Sprite* sprite) +{ + if (sprite->pos1.y > 8) + { + u8 matrixNum; + + sprite->pos1.y = 88 - (sprite->data7 * sprite->data7) / 80; + sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5) / 4; + sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5); + sprite->data6 += 4; + if (sprite->data7 & 1) + sprite->data5--; + sprite->data7++; + if (sprite->pos2.y > 0) + sprite->subpriority = 1; + else + sprite->subpriority = 20; + matrixNum = sprite->data5 / 4 + 20; + if (matrixNum > 31) + matrixNum = 31; + sprite->oam.matrixNum = matrixNum; + } + else + DestroySprite(sprite); +} + +static void CreatePreEvoSparkleSet1(u8 arg0) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 88, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data5 = 48; + gSprites[spriteID].data6 = arg0; + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 31; + gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet1; + } +} + +static void SpriteCB_PreEvoSparkleSet2(struct Sprite* sprite) +{ + if (sprite->pos1.y < 88) + { + sprite->pos1.y = 8 + (sprite->data7 * sprite->data7) / 5; + sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5) / 4; + sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5); + sprite->data5 = 8 + Sin((u8)(sprite->data7 * 4), 40); + sprite->data7++; + } + else + DestroySprite(sprite); +} + +static void CreatePreEvoSparkleSet2(u8 arg0) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 8, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data5 = 8; + gSprites[spriteID].data6 = arg0; + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 25; + gSprites[spriteID].subpriority = 1; + gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet2; + } +} + +static void SpriteCB_PostEvoSparkleSet1(struct Sprite* sprite) +{ + if (sprite->data5 > 8) + { + sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5); + sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5); + sprite->data5 -= sprite->data3; + sprite->data6 += 4; + } + else + DestroySprite(sprite); +} + +static void CreatePostEvoSparkleSet1(u8 arg0, u8 arg1) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data3 = arg1; + gSprites[spriteID].data5 = 120; + gSprites[spriteID].data6 = arg0; + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 31; + gSprites[spriteID].subpriority = 1; + gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet1; + } +} + +static void SpriteCB_PostEvoSparkleSet2(struct Sprite* sprite) +{ + if (!(sprite->data7 & 3)) + sprite->pos1.y++; + if (sprite->data6 < 128) + { + u8 matrixNum; + + sprite->pos2.y = -Sin((u8)(sprite->data6), sprite->data5); + sprite->pos1.x = 120 + (sprite->data3 * sprite->data7) / 3; + sprite->data6++; + matrixNum = 31 - (sprite->data6 * 12 / 128); + if (sprite->data6 > 64) + sprite->subpriority = 1; + else + { + sprite->invisible = 0; + sprite->subpriority = 20; + if (sprite->data6 > 112 && sprite->data6 & 1) + sprite->invisible = 1; + } + if (matrixNum < 20) + matrixNum = 20; + sprite->oam.matrixNum = matrixNum; + sprite->data7++; + } + else + DestroySprite(sprite); +} + +static void CreatePostEvoSparkleSet2(u8 arg0) +{ + u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); + if (spriteID != MAX_SPRITES) + { + gSprites[spriteID].data3 = 3 - (Random() % 7); + gSprites[spriteID].data5 = 48 + (Random() & 0x3F); + gSprites[spriteID].data7 = 0; + gSprites[spriteID].oam.affineMode = 1; + gSprites[spriteID].oam.matrixNum = 31; + gSprites[spriteID].subpriority = 20; + gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet2; + } +} + +void LoadEvoSparkleSpriteAndPal(void) +{ + LoadCompressedObjectPicUsingHeap(&sEvoSparkleSpriteSheets[0]); + LoadSpritePalettes(sEvoSparkleSpritePals); +} + +#define tFrameCounter data[15] + +u8 LaunchTask_PreEvoSparklesSet1(u16 arg0) +{ + u8 taskID = CreateTask(EvoTask_BeginPreSet1_FadeAndPlaySE, 0); + gTasks[taskID].data[1] = arg0; + return taskID; +} + +static void EvoTask_BeginPreSet1_FadeAndPlaySE(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + BeginNormalPaletteFade(3 << gTasks[taskID].data[1], 0xA, 0, 0x10, 0x7FFF); + gTasks[taskID].func = EvoTask_CreatePreEvoSparkleSet1; + PlaySE(SE_W025); +} + +static void EvoTask_CreatePreEvoSparkleSet1(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 64) + { + if (!(gTasks[taskID].tFrameCounter & 7)) + { + u8 i; + for (i = 0; i < 4; i++) + CreatePreEvoSparkleSet1((0x78 & gTasks[taskID].tFrameCounter) * 2 + i * 64); + } + gTasks[taskID].tFrameCounter++; + } + else + { + gTasks[taskID].tFrameCounter = 96; + gTasks[taskID].func = EvoTask_WaitForPre1SparklesToGoUp; + } +} + +static void EvoTask_WaitForPre1SparklesToGoUp(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter != 0) + gTasks[taskID].tFrameCounter--; + else + DestroyTask(taskID); +} + +u8 LaunchTask_PreEvoSparklesSet2(void) +{ + return CreateTask(EvoTask_BeginPreSparklesSet2, 0); +} + +static void EvoTask_BeginPreSparklesSet2(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + gTasks[taskID].func = EvoTask_CreatePreEvoSparklesSet2; + PlaySE(SE_W062B); +} + +static void EvoTask_CreatePreEvoSparklesSet2(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 96) + { + if (gTasks[taskID].tFrameCounter < 6) + { + u8 i; + for (i = 0; i < 9; i++) + CreatePreEvoSparkleSet2(i * 16); + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPreSet2Task; +} + +static void EvoTask_DestroyPreSet2Task(u8 taskID) +{ + DestroyTask(taskID); +} + +u8 LaunchTask_PostEvoSparklesSet1(void) +{ + return CreateTask(EvoTask_BeginPostSparklesSet1, 0); +} + +static void EvoTask_BeginPostSparklesSet1(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet1; + PlaySE(SE_REAPOKE); +} + +static void EvoTask_CreatePostEvoSparklesSet1(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 48) + { + if (gTasks[taskID].tFrameCounter == 0) + { + u8 i; + for (i = 0; i < 16; i++) + CreatePostEvoSparkleSet1(i * 16, 4); + } + if (gTasks[taskID].tFrameCounter == 32) + { + u8 i; + for (i = 0; i < 16; i++) + CreatePostEvoSparkleSet1(i * 16, 8); + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPostSet1Task; +} + +static void EvoTask_DestroyPostSet1Task(u8 taskID) +{ + DestroyTask(taskID); +} + +u8 LaunchTask_PostEvoSparklesSet2AndFlash(u16 species) +{ + u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash, 0); + gTasks[taskID].data[2] = species; + return taskID; +} + +static void EvoTask_BeginPostSparklesSet2_AndFlash(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30); + BeginNormalPaletteFade(0xFFF9041C, 0, 0, 0x10, 0x7FFF); // was 0xFFF9001C in R/S + gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash; + PlaySE(SE_W080); +} + +static void EvoTask_CreatePostEvoSparklesSet2_AndFlash(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 128) + { + u8 i; + switch (gTasks[taskID].tFrameCounter) + { + default: + if (gTasks[taskID].tFrameCounter < 50) + CreatePostEvoSparkleSet2(Random() & 7); + break; + case 0: + for (i = 0; i < 8; i++) + CreatePostEvoSparkleSet2(i); + break; + case 32: + BeginNormalPaletteFade(0xFFFF041C, 0x10, 0x10, 0, 0x7FFF); // was 0xFFF9001C in R/S + break; + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask; +} + +static void EvoTask_DestroyPostSet2AndFlashTask(u8 taskID) +{ + if (!gPaletteFade.active) + DestroyTask(taskID); +} + +u8 LaunchTask_PostEvoSparklesSet2AndFlash_Trade(u16 species) +{ + u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash_Trade, 0); + gTasks[taskID].data[2] = species; + return taskID; +} + +static void EvoTask_BeginPostSparklesSet2_AndFlash_Trade(u8 taskID) +{ + SetEvoSparklesMatrices(); + gTasks[taskID].tFrameCounter = 0; + CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30); + BeginNormalPaletteFade(0xFFF90400, 0, 0, 0x10, 0x7FFF); // was 0xFFFF0001 in R/S + gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade; + PlaySE(SE_W080); +} + +static void EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade(u8 taskID) +{ + if (gTasks[taskID].tFrameCounter < 128) + { + u8 i; + switch (gTasks[taskID].tFrameCounter) + { + default: + if (gTasks[taskID].tFrameCounter < 50) + CreatePostEvoSparkleSet2(Random() & 7); + break; + case 0: + for (i = 0; i < 8; i++) + CreatePostEvoSparkleSet2(i); + break; + case 32: + BeginNormalPaletteFade(0xFFFF0400, 0x10, 0x10, 0, 0x7FFF); // was 0xFFFF0001 in R/S + break; + } + gTasks[taskID].tFrameCounter++; + } + else + gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask; +} + +#undef tFrameCounter + +static void PokeEvoSprite_DummySpriteCB(struct Sprite* sprite) +{ + +} + +#define tPreEvoSpriteID data[1] +#define tPostEvoSpriteID data[2] +#define tEvoStopped data[8] + +u8 sub_817C3A0(u8 preEvoSpriteID, u8 postEvoSpriteID) +{ + u16 i; + u16 stack[16]; + u8 taskID; + s32 toDiv; + + for (i = 0; i < 16; i++) + stack[i] = 0x7FFF; + + taskID = CreateTask(sub_817C4EC, 0); + gTasks[taskID].tPreEvoSpriteID = preEvoSpriteID; + gTasks[taskID].tPostEvoSpriteID = postEvoSpriteID; + gTasks[taskID].data[3] = 256; + gTasks[taskID].data[4] = 16; + + toDiv = 65536; + SetOamMatrix(30, 256, 0, 0, 256); + SetOamMatrix(31, toDiv / gTasks[taskID].data[4], 0, 0, toDiv / gTasks[taskID].data[4]); + + gSprites[preEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB; + gSprites[preEvoSpriteID].oam.affineMode = 1; + gSprites[preEvoSpriteID].oam.matrixNum = 30; + gSprites[preEvoSpriteID].invisible = 0; + CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[preEvoSpriteID].oam.paletteNum * 16)], 16); + + gSprites[postEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB; + gSprites[postEvoSpriteID].oam.affineMode = 1; + gSprites[postEvoSpriteID].oam.matrixNum = 31; + gSprites[postEvoSpriteID].invisible = 0; + CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[postEvoSpriteID].oam.paletteNum * 16)], 16); + + gTasks[taskID].tEvoStopped = FALSE; + return taskID; +} + +static void sub_817C4EC(u8 taskID) +{ + gTasks[taskID].data[5] = 0; + gTasks[taskID].data[6] = 8; + gTasks[taskID].func = sub_817C510; +} + +static void sub_817C510(u8 taskID) +{ + if (gTasks[taskID].tEvoStopped) + PreEvoVisible_PostEvoInvisible_KillTask(taskID); + else if (gTasks[taskID].data[6] == 128) + PreEvoInvisible_PostEvoVisible_KillTask(taskID); + else + { + gTasks[taskID].data[6] += 2; + gTasks[taskID].data[5] ^= 1; + gTasks[taskID].func = sub_817C560; + } +} + +static void sub_817C560(u8 taskID) +{ + if (gTasks[taskID].tEvoStopped) + gTasks[taskID].func = PreEvoVisible_PostEvoInvisible_KillTask; + else + { + u16 oamMatrixArg; + u8 r6 = 0; + if (gTasks[taskID].data[5] == 0) + { + if (gTasks[taskID].data[3] < 256 - gTasks[taskID].data[6]) + gTasks[taskID].data[3] += gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[3] = 256; + r6++; + } + if (gTasks[taskID].data[4] > 16 + gTasks[taskID].data[6]) + gTasks[taskID].data[4] -= gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[4] = 16; + r6++; + } + } + else + { + if (gTasks[taskID].data[4] < 256 - gTasks[taskID].data[6]) + gTasks[taskID].data[4] += gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[4] = 256; + r6++; + } + if (gTasks[taskID].data[3] > 16 + gTasks[taskID].data[6]) + gTasks[taskID].data[3] -= gTasks[taskID].data[6]; + else + { + gTasks[taskID].data[3] = 16; + r6++; + } + } + oamMatrixArg = 65536 / gTasks[taskID].data[3]; + SetOamMatrix(30, oamMatrixArg, 0, 0, oamMatrixArg); + + oamMatrixArg = 65536 / gTasks[taskID].data[4]; + SetOamMatrix(31, oamMatrixArg, 0, 0, oamMatrixArg); + if (r6 == 2) + gTasks[taskID].func = sub_817C510; + } +} + +static void PreEvoInvisible_PostEvoVisible_KillTask(u8 taskID) +{ + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = 1; + + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = 0; + + DestroyTask(taskID); +} + +static void PreEvoVisible_PostEvoInvisible_KillTask(u8 taskID) +{ + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = 0; + + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0; + gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = 1; + + DestroyTask(taskID); +} diff --git a/src/evolution_scene.c b/src/evolution_scene.c new file mode 100644 index 000000000..68731a14a --- /dev/null +++ b/src/evolution_scene.c @@ -0,0 +1,1506 @@ +#include "global.h" +#include "evolution_scene.h" +#include "evolution_graphics.h" +#include "sprite.h" +#include "malloc.h" +#include "task.h" +#include "palette.h" +#include "main.h" +#include "text.h" +#include "text_window.h" +#include "pokemon.h" +#include "string_util.h" +#include "battle.h" +#include "unknown_task.h" +#include "decompress.h" +#include "m4a.h" +#include "menu.h" +#include "pokedex.h" +#include "species.h" +#include "sound.h" +#include "songs.h" +#include "overworld.h" +#include "battle_message.h" +#include "gpu_regs.h" +#include "bg.h" +#include "link.h" +#include "blend_palette.h" +#include "trig.h" + +struct EvoInfo +{ + u8 preEvoSpriteID; + u8 postEvoSpriteID; + u8 evoTaskID; + u8 field_3; + u16 savedPalette[48]; +}; + +static EWRAM_DATA struct EvoInfo *sEvoStructPtr = NULL; +static EWRAM_DATA u16 *sEvoMovingBgPtr = NULL; + +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gBattle_BG1_X; +extern u16 gBattle_BG1_Y; +extern u16 gBattle_BG2_X; +extern u16 gBattle_BG2_Y; +extern u16 gBattle_BG3_X; +extern u16 gBattle_BG3_Y; +extern u8 gBattleTerrain; +extern struct SpriteTemplate gUnknown_0202499C; +extern bool8 gAffineAnimsDisabled; +extern u16 gMoveToLearn; + +extern u8 gBattleCommunication[]; +#define sEvoCursorPos gBattleCommunication[1] // when learning a new move +#define sEvoGraphicsTaskID gBattleCommunication[2] + +extern const struct WindowTemplate gUnknown_0833900C; +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const u8 gUnknown_085B58C9[][4]; +extern const u16 gUnknown_085B5884[]; +extern const u8 gUnknown_085B58D9[]; +extern const u16 gUnknown_085B51E4[]; +extern const u32 gUnknown_085B4134[]; +extern const u32 gUnknown_085B482C[]; +extern const u32 gUnknown_085B4D10[]; + +// strings +extern const u8 gText_ShedinjaJapaneseName2[]; +extern const u8 gText_PkmnIsEvolving[]; +extern const u8 gText_CongratsPkmnEvolved[]; +extern const u8 gText_BattleYesNoChoice[]; +extern const u8 gText_PkmnStoppedEvolving[]; +extern const u8 gText_EllipsisQuestionMark[]; +extern const u8 gText_CommunicationStandby5[]; + +extern void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, bool32 arg2, u16 arg3, u8 arg4); +extern u32 sub_80391E0(u8, u8); +extern void SpriteCallbackDummy_2(struct Sprite *sprite); +extern void sub_80356D0(void); +extern void sub_807B154(void); +extern void sub_806A068(u16, u8); +extern void sub_807F19C(void); +extern void sub_807B140(void); +extern void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); +extern void sub_8085784(void); +extern void sub_81BFA38(struct Pokemon *party, u8 monId, u8 partyCount, void *CB2_ptr, u16 move); +extern u8 sub_81C1B94(void); +extern void sub_807F1A8(u8 arg0, const u8 *arg1, u8 arg2); +extern void sub_800E084(void); + +// this file's functions +static void Task_EvolutionScene(u8 taskID); +static void Task_TradeEvolutionScene(u8 taskID); +static void CB2_EvolutionSceneUpdate(void); +static void CB2_TradeEvolutionSceneUpdate(void); +static void EvoDummyFunc(void); +static void VBlankCB_EvolutionScene(void); +static void VBlankCB_TradeEvolutionScene(void); +static void sub_81150D8(void); +static void sub_8140134(void); +static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId); +static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId); +static void InitMovingBackgroundTask(bool8 isLink); +static void sub_813FEE8(u8 taskId); +static void sub_8140174(void); + +static void CB2_BeginEvolutionScene(void) +{ + UpdatePaletteFade(); + RunTasks(); +} + +#define tState data[0] +#define tPreEvoSpecies data[1] +#define tPostEvoSpecies data[2] +#define tCanStop data[3] +#define tBits data[3] +#define tLearnsFirstMove data[4] +#define tLearnMoveState data[6] +#define tData7 data[7] +#define tData8 data[8] +#define tEvoWasStopped data[9] +#define tPartyID data[10] + +#define TASK_BIT_CAN_STOP 0x1 +#define TASK_BIT_LEARN_MOVE 0x80 + +static void Task_BeginEvolutionScene(u8 taskID) +{ + struct Pokemon* mon = NULL; + switch (gTasks[taskID].tState) + { + case 0: + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskID].tState++; + break; + case 1: + if (!gPaletteFade.active) + { + u16 speciesToEvolve; + bool8 canStopEvo; + u8 partyID; + + mon = &gPlayerParty[gTasks[taskID].tPartyID]; + speciesToEvolve = gTasks[taskID].tPostEvoSpecies; + canStopEvo = gTasks[taskID].tCanStop; + partyID = gTasks[taskID].tPartyID; + + DestroyTask(taskID); + EvolutionScene(mon, speciesToEvolve, canStopEvo, partyID); + } + break; + } +} + +void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID) +{ + u8 taskID = CreateTask(Task_BeginEvolutionScene, 0); + gTasks[taskID].tState = 0; + gTasks[taskID].tPostEvoSpecies = speciesToEvolve; + gTasks[taskID].tCanStop = canStopEvo; + gTasks[taskID].tPartyID = partyID; + SetMainCallback2(CB2_BeginEvolutionScene); +} + +void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID) +{ + u8 name[20]; + u16 currSpecies; + u32 trainerId, personality; + const struct CompressedSpritePalette* pokePal; + u8 ID; + + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + CpuFill32(0, (void*)(VRAM), VRAM_SIZE); + + SetGpuReg(REG_OFFSET_MOSAIC, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + + ResetPaletteFade(); + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + + gBattleTerrain = BATTLE_TERRAIN_PLAIN; + + sub_80356D0(); + LoadBattleTextboxAndBackground(); + ResetSpriteData(); + remove_some_task(); + ResetTasks(); + FreeAllSpritePalettes(); + + gReservedSpritePaletteCount = 4; + + sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); + AllocateMonSpritesGfx(); + + GetMonData(mon, MON_DATA_NICKNAME, name); + StringCopy10(gStringVar1, name); + StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]); + + // preEvo sprite + currSpecies = GetMonData(mon, MON_DATA_SPECIES); + trainerId = GetMonData(mon, MON_DATA_OT_ID); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + DecompressPicFromTable_2(&gMonFrontPicTable[currSpecies], + gMonSpritesGfxPtr->sprites[1], + currSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, trainerId, personality); + LoadCompressedPalette(pokePal->data, 0x110, 0x20); + + sub_806A068(currSpecies, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 1; + gSprites[ID].invisible = 1; + + // postEvo sprite + DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], + gMonSpritesGfxPtr->sprites[3], + speciesToEvolve); + pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + + sub_806A068(speciesToEvolve, 3); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gSprites[ID].invisible = 1; + + LoadEvoSparkleSpriteAndPal(); + + sEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0); + gTasks[ID].tState = 0; + gTasks[ID].tPreEvoSpecies = currSpecies; + gTasks[ID].tPostEvoSpecies = speciesToEvolve; + gTasks[ID].tCanStop = canStopEvo; + gTasks[ID].tLearnsFirstMove = TRUE; + gTasks[ID].tEvoWasStopped = FALSE; + gTasks[ID].tPartyID = partyID; + + memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); + + SetHBlankCallback(EvoDummyFunc); + SetVBlankCallback(VBlankCB_EvolutionScene); + m4aMPlayAllStop(); + SetMainCallback2(CB2_EvolutionSceneUpdate); +} + +static void CB2_EvolutionSceneLoadGraphics(void) +{ + u8 ID; + const struct CompressedSpritePalette* pokePal; + u16 postEvoSpecies; + u32 trainerId, personality; + struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; + + postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; + trainerId = GetMonData(Mon, MON_DATA_OT_ID); + personality = GetMonData(Mon, MON_DATA_PERSONALITY); + + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + CpuFill32(0, (void*)(VRAM), VRAM_SIZE); + + SetGpuReg(REG_OFFSET_MOSAIC, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + + ResetPaletteFade(); + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + + gBattleTerrain = BATTLE_TERRAIN_PLAIN; + + sub_80356D0(); + LoadBattleTextboxAndBackground(); + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 4; + + DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], + gMonSpritesGfxPtr->sprites[3], + postEvoSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality); + + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + + sub_806A068(postEvoSpecies, 3); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); + + SetHBlankCallback(EvoDummyFunc); + SetVBlankCallback(VBlankCB_EvolutionScene); + SetMainCallback2(CB2_EvolutionSceneUpdate); + + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); +} + +static void CB2_TradeEvolutionSceneLoadGraphics(void) +{ + struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; + u16 postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; + + switch (gMain.state) + { + case 0: + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 4; + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + gMain.state++; + break; + case 1: + ResetPaletteFade(); + SetHBlankCallback(EvoDummyFunc); + SetVBlankCallback(VBlankCB_TradeEvolutionScene); + gMain.state++; + break; + case 2: + sub_807F19C(); + gMain.state++; + break; + case 3: + FillBgTilemapBufferRect(1, 0, 0, 0, 0x20, 0x20, 0x11); + CopyBgTilemapBufferToVram(1); + gMain.state++; + break; + case 4: + { + const struct CompressedSpritePalette* pokePal; + u32 trainerId = GetMonData(Mon, MON_DATA_OT_ID); + u32 personality = GetMonData(Mon, MON_DATA_PERSONALITY); + DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], + gMonSpritesGfxPtr->sprites[3], + postEvoSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + gMain.state++; + } + break; + case 5: + { + u8 ID; + + sub_806A068(postEvoSpecies, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gMain.state++; + sub_807B154(); + } + break; + case 6: + if (gLinkVSyncDisabled) + { + sub_800E0E8(); + sub_800DFB4(0, 0); + } + BlendPalettes(-1,0x10, 0); + gMain.state++; + break; + case 7: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + sub_807B140(); + ShowBg(0); + ShowBg(1); + SetMainCallback2(CB2_TradeEvolutionSceneUpdate); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_1D_MAP); + break; + } +} + +void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID) +{ + u8 name[20]; + u16 currSpecies; + u32 trainerId, personality; + const struct CompressedSpritePalette* pokePal; + u8 ID; + + GetMonData(mon, MON_DATA_NICKNAME, name); + StringCopy10(gStringVar1, name); + StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]); + + gAffineAnimsDisabled = TRUE; + + // preEvo sprite + currSpecies = GetMonData(mon, MON_DATA_SPECIES); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + trainerId = GetMonData(mon, MON_DATA_OT_ID); + + sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); + sEvoStructPtr->preEvoSpriteID = preEvoSpriteID; + + DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], + gMonSpritesGfxPtr->sprites[1], + speciesToEvolve); + + pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + + sub_806A068(speciesToEvolve, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gSprites[ID].invisible = 1; + + LoadEvoSparkleSpriteAndPal(); + + sEvoStructPtr->evoTaskID = ID = CreateTask(Task_TradeEvolutionScene, 0); + gTasks[ID].tState = 0; + gTasks[ID].tPreEvoSpecies = currSpecies; + gTasks[ID].tPostEvoSpecies = speciesToEvolve; + gTasks[ID].tLearnsFirstMove = TRUE; + gTasks[ID].tEvoWasStopped = FALSE; + gTasks[ID].tPartyID = partyID; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + + gTextFlags.flag_1 = 1; + + SetVBlankCallback(VBlankCB_TradeEvolutionScene); + SetMainCallback2(CB2_TradeEvolutionSceneUpdate); +} + +static void CB2_EvolutionSceneUpdate(void) +{ + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); + RunTasks(); +} + +static void CB2_TradeEvolutionSceneUpdate(void) +{ + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); + RunTasks(); +} + +static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) +{ + u32 data = 0; + if (gEvolutionTable[preEvoSpecies].evolutions[0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6) + { + s32 i; + struct Pokemon* Shedinja = &gPlayerParty[gPlayerPartyCount]; + const struct EvolutionData* evoTable; + const struct EvolutionData* evos; + + CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies])); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_10, (&data)); + + for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + 5; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); + for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FATEFUL_ENCOUNTER; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); + + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_STATUS, (&data)); + data = 0xFF; + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MAIL, (&data)); + + CalculateMonStats(&gPlayerParty[gPlayerPartyCount]); + CalculatePlayerPartyCount(); + + // can't match it otherwise, ehh + evoTable = gEvolutionTable; + evos = evoTable + preEvoSpecies; + GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_CAUGHT); + + if (GetMonData(Shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA + && GetMonData(Shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE + && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK) + SetMonData(Shedinja, MON_DATA_NICKNAME, gText_ShedinjaJapaneseName2); + } +} + +static void Task_EvolutionScene(u8 taskID) +{ + u32 var; + struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + + // check if B Button was held, so the evolution gets stopped + if (gMain.heldKeys == B_BUTTON + && gTasks[taskID].tState == 8 + && gTasks[sEvoGraphicsTaskID].isActive + && gTasks[taskID].tBits & TASK_BIT_CAN_STOP) + { + gTasks[taskID].tState = 17; + gTasks[sEvoGraphicsTaskID].EvoGraphicsTaskEvoStop = TRUE; + sub_8140134(); + return; + } + + switch (gTasks[taskID].tState) + { + case 0: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + gSprites[sEvoStructPtr->preEvoSpriteID].invisible = 0; + gTasks[taskID].tState++; + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + break; + case 1: // print 'whoa, poke is evolving!!!' msg + if (!gPaletteFade.active) + { + StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); + BattleHandleAddTextPrinter(gStringVar4, 0); + gTasks[taskID].tState++; + } + break; + case 2: // wait for string, animate mon(and play its cry) + if (!IsTextPrinterActive(0)) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 3: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) // wait for animation, play tu du SE + { + PlaySE(BGM_ME_SHINKA); + gTasks[taskID].tState++; + } + break; + case 4: // play evolution music and fade screen black + if (!IsSEPlaying()) + { + PlayNewMapMusic(BGM_SHINKA); + gTasks[taskID].tState++; + BeginNormalPaletteFade(0x1C, 4, 0, 0x10, 0); + } + break; + case 5: // launch moving bg task, preapre evo sparkles + if (!gPaletteFade.active) + { + InitMovingBackgroundTask(FALSE); + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(17); + gTasks[taskID].tState++; + } + break; + case 6: // another set of evo sparkles + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + gTasks[taskID].tState++; + sEvoStructPtr->field_3 = 1; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + } + break; + case 7: // launch task that flashes pre evo with post evo sprites + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); + gTasks[taskID].tState++; + } + break; + case 8: // wait for the above task to finish + if (--sEvoStructPtr->field_3 == 0) + { + sEvoStructPtr->field_3 = 3; + if (!gTasks[sEvoGraphicsTaskID].isActive) + gTasks[taskID].tState++; + } + break; + case 9: // post evo sparkles + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); + gTasks[taskID].tState++; + break; + case 10: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash(gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 11: // play tu du sound after evolution + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + PlaySE(SE_EXP); + gTasks[taskID].tState++; + } + break; + case 12: // stop music, return screen to pre-fade state + if (IsSEPlaying()) + { + m4aMPlayAllStop(); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); + sub_8140174(); + BeginNormalPaletteFade(0x1C, 0, 0x10, 0, 0); + gTasks[taskID].tState++; + } + break; + case 13: // animate mon + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 14: // congratulations string and rename prompt + if (IsCryFinished()) + { + StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); + BattleHandleAddTextPrinter(gStringVar4, 0); + PlayBGM(BGM_FANFA5); + gTasks[taskID].tState++; + SetMonData(mon, MON_DATA_SPECIES, (void*)(&gTasks[taskID].tPostEvoSpecies)); + CalculateMonStats(mon); + EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); + } + break; + case 15: // check if it wants to learn a new move + if (!IsTextPrinterActive(0)) + { + var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); + if (var != 0 && !gTasks[taskID].tEvoWasStopped) + { + u8 text[20]; + + if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + { + StopMapMusic(); + sub_8085784(); + } + + gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskID].tLearnsFirstMove = FALSE; + gTasks[taskID].tLearnMoveState = 0; + GetMonData(mon, MON_DATA_NICKNAME, text); + StringCopy10(gBattleTextBuff1, text); + + if (var == 0xFFFF) // no place to learn it + gTasks[taskID].tState = 22; + else if (var == 0xFFFE) // it already knows that move + break; + else + gTasks[taskID].tState = 20; // has less than 4 moves, so it's been learned + } + else // no move to learn + { + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskID].tState++; + } + } + break; + case 16: // task has finished, return + if (!gPaletteFade.active) + { + if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + { + StopMapMusic(); + sub_8085784(); + } + if (!gTasks[taskID].tEvoWasStopped) + CreateShedinja(gTasks[taskID].tPreEvoSpecies, mon); + + DestroyTask(taskID); + FreeMonSpritesGfx(); + Free(sEvoStructPtr); + sEvoStructPtr = NULL; + FreeAllWindowBuffers(); + SetMainCallback2(gCB2_AfterEvolution); + } + break; + case 17: // evolution has been canceled, stop music and re-fade palette + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + m4aMPlayAllStop(); + BeginNormalPaletteFade(0x6001C, 0, 0x10, 0, 0x7FFF); + gTasks[taskID].tState++; + } + break; + case 18: // animate pokemon trying to evolve again, evolution has been stopped + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 19: // after the animation, print the string 'WHOA IT DID NOT EVOLVE!!!' + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + { + if (gTasks[taskID].tEvoWasStopped) + StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); + else // Fire Red leftover probably + StringExpandPlaceholders(gStringVar4, gText_PkmnStoppedEvolving); + + BattleHandleAddTextPrinter(gStringVar4, 0); + gTasks[taskID].tEvoWasStopped = TRUE; + gTasks[taskID].tState = 15; + } + break; + case 20: // pokemon learned a new move, print string and play a fanfare + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + PlayFanfare(BGM_FANFA1); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskID].tState++; + } + break; + case 21: // wait a bit and check if can learn another move + if (!IsTextPrinterActive(0) && !IsSEPlaying() && --gTasks[taskID].tLearnsFirstMove == 0) + gTasks[taskID].tState = 15; + break; + case 22: // try to learn a new move + switch (gTasks[taskID].tLearnMoveState) + { + case 0: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 1: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 2: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tData7 = 5; + gTasks[taskID].tData8 = 10; + gTasks[taskID].tLearnMoveState++; + } + case 3: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); + gTasks[taskID].tLearnMoveState++; + sEvoCursorPos = 0; + BattleCreateYesNoCursorAt(0); + } + break; + case 4: + if (gMain.newKeys & DPAD_UP && sEvoCursorPos != 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(sEvoCursorPos); + sEvoCursorPos = 0; + BattleCreateYesNoCursorAt(0); + } + if (gMain.newKeys & DPAD_DOWN && sEvoCursorPos == 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(sEvoCursorPos); + sEvoCursorPos = 1; + BattleCreateYesNoCursorAt(1); + } + if (gMain.newKeys & A_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); + PlaySE(SE_SELECT); + + if (sEvoCursorPos != 0) + { + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + } + else + { + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; + if (gTasks[taskID].tLearnMoveState == 5) + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + } + } + if (gMain.newKeys & B_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); + PlaySE(SE_SELECT); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + } + break; + case 5: + if (!gPaletteFade.active) + { + FreeAllWindowBuffers(); + sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + gPlayerPartyCount - 1, CB2_EvolutionSceneLoadGraphics, + gMoveToLearn); + gTasks[taskID].tLearnMoveState++; + } + break; + case 6: + if (!gPaletteFade.active && gMain.callback2 == CB2_EvolutionSceneUpdate) + { + var = sub_81C1B94(); // moveID + if (var == 4) + { + gTasks[taskID].tLearnMoveState = 10; + } + else + { + u16 move = GetMonData(mon, var + MON_DATA_MOVE1); + if (IsHMMove2(move)) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState = 12; + } + else + { + PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) + + RemoveMonPPBonus(mon, var); + SetMonMoveSlot(mon, gMoveToLearn, var); + gTasks[taskID].tLearnMoveState++; + } + } + } + break; + case 7: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + break; + case 8: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 9: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tState = 20; + } + break; + case 10: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tData7 = 11; + gTasks[taskID].tData8 = 0; + gTasks[taskID].tLearnMoveState = 3; + break; + case 11: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tState = 15; + break; + case 12: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + gTasks[taskID].tLearnMoveState = 5; + break; + } + break; + } +} + +static void Task_TradeEvolutionScene(u8 taskID) +{ + u32 var = 0; + struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + + switch (gTasks[taskID].tState) + { + case 0: + StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); + sub_807F1A8(0, gStringVar4, 1); + gTasks[taskID].tState++; + break; + case 1: + if (!IsTextPrinterActive(0)) + { + PlayCry1(gTasks[taskID].tPreEvoSpecies, 0); + gTasks[taskID].tState++; + } + break; + case 2: + if (IsCryFinished()) + { + m4aSongNumStop(BGM_SHINKA); + PlaySE(BGM_ME_SHINKA); + gTasks[taskID].tState++; + } + break; + case 3: + if (!IsSEPlaying()) + { + PlayBGM(BGM_SHINKA); + gTasks[taskID].tState++; + BeginNormalPaletteFade(0x1C, 4, 0, 0x10, 0); + } + break; + case 4: + if (!gPaletteFade.active) + { + InitMovingBackgroundTask(TRUE); + var = gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(var); + gTasks[taskID].tState++; + SetGpuReg(REG_OFFSET_BG3CNT, 0x603); + } + break; + case 5: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + gTasks[taskID].tState++; + sEvoStructPtr->field_3 = 1; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + } + break; + case 6: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); + gTasks[taskID].tState++; + } + break; + case 7: + if (--sEvoStructPtr->field_3 == 0) + { + sEvoStructPtr->field_3 = 3; + if (!gTasks[sEvoGraphicsTaskID].isActive) + gTasks[taskID].tState++; + } + break; + case 8: + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); + gTasks[taskID].tState++; + break; + case 9: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash_Trade(gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 10: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + PlaySE(SE_EXP); + gTasks[taskID].tState++; + } + break; + case 11: + if (IsSEPlaying()) + { + Free(sEvoMovingBgPtr); + EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); + gTasks[taskID].tState++; + } + break; + case 12: + if (IsCryFinished()) + { + StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); + sub_807F1A8(0, gStringVar4, 1); + PlayFanfare(BGM_FANFA5); + gTasks[taskID].tState++; + SetMonData(mon, MON_DATA_SPECIES, (&gTasks[taskID].tPostEvoSpecies)); + CalculateMonStats(mon); + EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); + } + break; + case 13: + if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE) + { + var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); + if (var != 0 && !gTasks[taskID].tEvoWasStopped) + { + u8 text[20]; + + gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskID].tLearnsFirstMove = FALSE; + gTasks[taskID].tLearnMoveState = 0; + GetMonData(mon, MON_DATA_NICKNAME, text); + StringCopy10(gBattleTextBuff1, text); + + if (var == 0xFFFF) + gTasks[taskID].tState = 20; + else if (var == 0xFFFE) + break; + else + gTasks[taskID].tState = 18; + } + else + { + PlayBGM(BGM_SHINKA); + sub_807F1A8(0, gText_CommunicationStandby5, 1); + gTasks[taskID].tState++; + } + } + break; + case 14: + if (!IsTextPrinterActive(0)) + { + DestroyTask(taskID); + Free(sEvoStructPtr); + sEvoStructPtr = NULL; + gTextFlags.flag_1 = 0; + SetMainCallback2(gCB2_AfterEvolution); + } + break; + case 15: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + m4aMPlayAllStop(); + BeginNormalPaletteFade((1 << (gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16)) | (0x4001C), 0, 0x10, 0, 0x7FFF); + gTasks[taskID].tState++; + } + break; + case 16: + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 17: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + { + StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); + sub_807F1A8(0, gStringVar4, 1); + gTasks[taskID].tEvoWasStopped = 1; + gTasks[taskID].tState = 13; + } + break; + case 18: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + PlayFanfare(BGM_FANFA1); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskID].tState++; + } + break; + case 19: + if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE && --gTasks[taskID].tLearnsFirstMove == 0) + gTasks[taskID].tState = 13; + break; + case 20: + switch (gTasks[taskID].tLearnMoveState) + { + case 0: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 1: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 2: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tData7 = 5; + gTasks[taskID].tData8 = 9; + gTasks[taskID].tLearnMoveState++; + } + case 3: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + sub_809882C(0, 0xA8, 0xE0); + CreateYesNoMenu(&gUnknown_0833900C, 0xA8, 0xE, 0); + sEvoCursorPos = 0; + gTasks[taskID].tLearnMoveState++; + sEvoCursorPos = 0; + } + break; + case 4: + switch (sub_8198C58()) + { + case 0: + sEvoCursorPos = 0; + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; + if (gTasks[taskID].tLearnMoveState == 5) + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + break; + case 1: + case -1: + sEvoCursorPos = 1; + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + break; + } + break; + case 5: + if (!gPaletteFade.active) + { + if (gLinkVSyncDisabled) + sub_800E084(); + + Free(GetBgTilemapBuffer(3)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(0)); + FreeAllWindowBuffers(); + + sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + gPlayerPartyCount - 1, CB2_TradeEvolutionSceneLoadGraphics, + gMoveToLearn); + gTasks[taskID].tLearnMoveState++; + } + break; + case 6: + if (!gPaletteFade.active && gMain.callback2 == CB2_TradeEvolutionSceneUpdate) + { + var = sub_81C1B94(); // moveID + if (var == 4) + { + gTasks[taskID].tLearnMoveState = 9; + } + else + { + u16 move = GetMonData(mon, var + MON_DATA_MOVE1); + if (IsHMMove2(move)) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = 11; + } + else + { + PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) + + RemoveMonPPBonus(mon, var); + SetMonMoveSlot(mon, gMoveToLearn, var); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + } + } + break; + case 7: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 8: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tState = 18; + } + break; + case 9: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tData7 = 10; + gTasks[taskID].tData8 = 0; + gTasks[taskID].tLearnMoveState = 3; + break; + case 10: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tState = 13; + break; + case 11: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + gTasks[taskID].tLearnMoveState = 5; + break; + } + break; + } +} + +#undef tState +#undef tPreEvoSpecies +#undef tPostEvoSpecies +#undef tCanStop +#undef tBits +#undef tLearnsFirstMove +#undef tLearnMoveState +#undef tData7 +#undef tData8 +#undef tEvoWasStopped +#undef tPartyID + +static void EvoDummyFunc(void) +{ +} + +static void VBlankCB_EvolutionScene(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_80BA0A8(); +} + +static void VBlankCB_TradeEvolutionScene(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_80BA0A8(); +} + +static void sub_813FDEC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[6] != 0) + return; + if (data[5]++ < 20) + return; + + if (data[0]++ > gUnknown_085B58C9[data[2]][3]) + { + if (gUnknown_085B58C9[data[2]][1] == data[1]) + { + data[3]++; + if (data[3] == gUnknown_085B58C9[data[2]][2]) + { + data[3] = 0; + data[2]++; + } + data[1] = gUnknown_085B58C9[data[2]][0]; + } + else + { + LoadPalette(&sEvoMovingBgPtr[data[1] * 16], 0xA0, 0x20); + data[0] = 0; + data[1]++; + } + } + + if (data[2] == 4) + DestroyTask(taskId); +} + +static void sub_813FEA4(bool8 isLink) +{ + u8 taskId = CreateTask(sub_813FEE8, 7); + + if (!isLink) + gTasks[taskId].data[2] = 0; + else + gTasks[taskId].data[2] = 1; +} + +static void sub_813FEE8(u8 taskId) +{ + u16 *outer_X, *outer_Y; + + u16 *inner_X = &gBattle_BG1_X; + u16 *inner_Y = &gBattle_BG1_Y; + + if (!gTasks[taskId].data[2]) + { + outer_X = &gBattle_BG2_X; + outer_Y = &gBattle_BG2_Y; + } + else + { + outer_X = &gBattle_BG3_X; + outer_Y = &gBattle_BG3_Y; + } + + gTasks[taskId].data[0] = (gTasks[taskId].data[0] + 5) & 0xFF; + gTasks[taskId].data[1] = (gTasks[taskId].data[0] + 0x80) & 0xFF; + + *inner_X = Cos(gTasks[taskId].data[0], 4) + 8; + *inner_Y = Sin(gTasks[taskId].data[0], 4) + 16; + + *outer_X = Cos(gTasks[taskId].data[1], 4) + 8; + *outer_Y = Sin(gTasks[taskId].data[1], 4) + 16; + + if (!FuncIsActiveTask(sub_813FDEC)) + { + DestroyTask(taskId); + + *inner_X = 0; + *inner_Y = 0; + + *outer_X = 256; + *outer_Y = 0; + } +} + +static void InitMovingBgValues(u16 *movingBgs) +{ + s32 i, j; + + for (i = 0; i < 50; i++) + { + for (j = 0; j < 16; j++) + { + movingBgs[i * 16 + j] = gUnknown_085B5884[gUnknown_085B58D9[i * 16 + j]]; + } + } +} + +static void InitMovingBackgroundTask(bool8 isLink) +{ + u8 innerBgId, outerBgId; + + sEvoMovingBgPtr = AllocZeroed(0x640); + InitMovingBgValues(sEvoMovingBgPtr); + + if (!isLink) + innerBgId = 1, outerBgId = 2; + else + innerBgId = 1, outerBgId = 3; + + LoadPalette(gUnknown_085B51E4, 0xA0, 0x20); + + copy_decompressed_tile_data_to_vram_autofree(1, gUnknown_085B4134, FALSE, 0, 0); + CopyToBgTilemapBuffer(1, gUnknown_085B482C, 0, 0); + CopyToBgTilemapBuffer(outerBgId, gUnknown_085B4D10, 0, 0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(outerBgId); + + if (!isLink) + { + SetGpuReg(REG_OFFSET_BLDCNT, 0x442); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x808); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG2_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + + SetBgAttribute(innerBgId, BG_CTRL_ATTR_MOSAIC, 2); + SetBgAttribute(outerBgId, BG_CTRL_ATTR_MOSAIC, 2); + + ShowBg(1); + ShowBg(2); + } + else + { + SetGpuReg(REG_OFFSET_BLDCNT, 0x842); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x808); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + } + + CreateTask(sub_813FDEC, 5); + sub_813FEA4(isLink); +} + +static void sub_8140100(void) // unused +{ + u8 taskId = FindTaskIdByFunc(sub_813FDEC); + + if (taskId != 0xFF) + gTasks[taskId].data[6] = 1; + + FillPalette(0, 0xA0, 0x20); +} + +static void sub_8140134(void) +{ + u8 taskId; + + if ((taskId = FindTaskIdByFunc(sub_813FDEC)) != 0xFF) + DestroyTask(taskId); + if ((taskId = FindTaskIdByFunc(sub_813FEE8)) != 0xFF) + DestroyTask(taskId); + + FillPalette(0, 0xA0, 0x20); + sub_8140174(); +} + +static void sub_8140174(void) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0); + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, sub_80391E0(1, 5)); + SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, sub_80391E0(2, 5)); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + Free(sEvoMovingBgPtr); +} + +static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId) +{ + DoMonFrontSpriteAnimation(&gSprites[monSpriteId], speciesId, FALSE, 0); +} + +static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId) +{ + if (gSprites[monSpriteId].callback == SpriteCallbackDummy) + return TRUE; + + return FALSE; +} diff --git a/src/pokemon_2.c b/src/pokemon_2.c index 587773836..bb0e265b5 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -84,7 +84,7 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 bank) return FALSE; } -u8 sub_8069F34(u8 bank) +u8 GetDefaultMoveTarget(u8 bank) { u8 status = GetBankIdentity(bank) & 1; @@ -194,6 +194,7 @@ void sub_806A1C0(u16 arg0, u8 bankIdentity) gUnknown_0202499C = gMonSpritesGfxPtr->templates[bankIdentity]; else gUnknown_0202499C = gUnknown_08329D98[bankIdentity]; + gUnknown_0202499C.paletteTag = arg0; gUnknown_0202499C.anims = gUnknown_0830536C[arg0]; } @@ -1304,7 +1305,7 @@ void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) } void sub_803FA70(u8 bank); -void sub_805EF84(u8 bank, bool8); +void ClearTemporarySpeciesSpriteData(u8 bank, bool8); extern struct BattlePokemon gBattleMons[4]; @@ -1360,5 +1361,5 @@ void CopyPlayerPartyMonToBattleData(u8 bank, u8 partyIndex) gBattleMons[bank].status2 = 0; sub_803FA70(bank); - sub_805EF84(bank, FALSE); + ClearTemporarySpeciesSpriteData(bank, FALSE); } diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 5ff99aee2..27da8b18e 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -618,7 +618,7 @@ bool16 sub_806D82C(u8 id) return retVal; } -s32 sub_806D864(u16 a1) +s32 GetBankMultiplayerId(u16 a1) { s32 id; for (id = 0; id < MAX_LINK_PLAYERS; id++) @@ -1267,10 +1267,10 @@ const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon) u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0); u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); - return sub_806E7CC(species, otId, personality); + return GetMonSpritePalStructFromOtIdPersonality(species, otId, personality); } -const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality) +const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality) { u32 shinyValue; @@ -1477,7 +1477,7 @@ const u8* GetTrainerPartnerName(void) else { u8 id = GetMultiplayerId(); - return gLinkPlayers[sub_806D864(gLinkPlayers[id].lp_field_18 ^ 2)].name; + return gLinkPlayers[GetBankMultiplayerId(gLinkPlayers[id].lp_field_18 ^ 2)].name; } } @@ -1659,7 +1659,7 @@ u16 sub_806EFF0(u16 arg0) return gUnknown_0831F578[arg0]; } -u16 sub_806F000(u8 playerGender) +u16 PlayerGenderToFrontTrainerPicId(u8 playerGender) { if (playerGender) return sub_806EFF0(0x3F); diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 343ddb9c0..002f4f069 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -220,9 +220,9 @@ static bool8 LoadBankSpriteGfx(u8 bank) BattleLoadSubstituteSpriteGfx(bank, FALSE); } else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0) - LoadBackTrainerBankSpriteGfx(gSaveBlock2Ptr->playerGender, bank); + DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, bank); else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0) - LoadBackTrainerBankSpriteGfx(BACK_PIC_WALLY, bank); + DecompressTrainerBackPic(BACK_PIC_WALLY, bank); else if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute) BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); else diff --git a/sym_common.txt b/sym_common.txt index 85b508403..1a199dbb3 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -221,10 +221,10 @@ gBattleBankFunc: @ 3005D60 gHealthBoxesIds: @ 3005D70 .space 0x4 -gUnknown_03005D74: @ 3005D74 +gMultiUsePlayerCursor: @ 3005D74 .space 0x4 -gUnknown_03005D78: @ 3005D78 +gNumberOfMovesToChoose: @ 3005D78 .space 0x4 gUnknown_03005D7C: @ 3005D7C @@ -370,7 +370,7 @@ gUnknown_030061C4: @ 30061C4 gUnknown_030061D0: @ 30061D0 .space 0x18 -gUnknown_030061E8: @ 30061E8 +gCB2_AfterEvolution: @ 30061E8 .space 0x4 gUnknown_030061EC: @ 30061EC diff --git a/sym_ewram.txt b/sym_ewram.txt index 8f84d05f5..d2f358cd2 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -495,10 +495,10 @@ gBankInMenu: @ 20244B8 gDoingBattleAnim: @ 20244B9 .space 0x3 -gUnknown_020244BC: @ 20244BC +gTransformedPersonalities: @ 20244BC .space 0x10 -gUnknown_020244CC: @ 20244CC +gPlayerDpadHoldFrames: @ 20244CC .space 0x4 gBattleSpritesDataPtr: @ 20244D0 @@ -1275,11 +1275,7 @@ gUnknown_0203AB78: @ 203AB78 gUnknown_0203AB7C: @ 203AB7C .space 0x4 -gUnknown_0203AB80: @ 203AB80 - .space 0x4 - -gUnknown_0203AB84: @ 203AB84 - .space 0x4 + .include "src/evolution_scene.o" gUnknown_0203AB88: @ 203AB88 .space 0x4