From 60484153a5630bfe88c1623b7ec1cf7052d67752 Mon Sep 17 00:00:00 2001 From: shinny456 Date: Sun, 16 Dec 2018 22:23:05 -0500 Subject: [PATCH] decompile electric.s --- asm/battle_anim_815A0D4.s | 14 +- asm/battle_anim_effects_2.s | 12 +- asm/electric.s | 2547 --------------------- asm/water.s | 8 +- include/battle_anim.h | 3 +- ld_script.txt | 2 +- src/battle_anim.c | 4 +- src/battle_anim_80A5C6C.c | 8 +- src/battle_anim_8170478.c | 2 +- src/battle_anim_effects_1.c | 12 +- src/battle_controller_link_opponent.c | 6 +- src/battle_controller_link_partner.c | 6 +- src/battle_controller_opponent.c | 6 +- src/battle_controller_player.c | 6 +- src/battle_controller_player_partner.c | 8 +- src/battle_controller_recorded_opponent.c | 6 +- src/battle_controller_recorded_player.c | 8 +- src/battle_controller_wally.c | 2 +- src/contest.c | 2 +- src/electric.c | 1100 ++++++++- src/ghost.c | 2 +- src/reshow_battle_screen.c | 8 +- 22 files changed, 1146 insertions(+), 2626 deletions(-) delete mode 100644 asm/electric.s diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index 362183765..394bc7104 100644 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -5588,14 +5588,14 @@ sub_815CDFC: @ 815CDFC _0815CE36: ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority subs r0, 0x1 b _0815CE52 .pool _0815CE48: ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority adds r0, 0x1 _0815CE52: adds r1, r4, 0 @@ -7393,7 +7393,7 @@ _0815DCEA: lsrs r0, 24 strh r0, [r5, 0x12] adds r0, r4, 0 - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x14] @@ -8395,7 +8395,7 @@ _0815E4EE: ldrsh r6, [r7, r1] mov r1, r8 ldrb r0, [r1] - bl sub_80A82E4 + bl GetBattlerSubpriority adds r3, r0, 0 subs r3, 0x5 lsls r3, 24 @@ -10367,7 +10367,7 @@ sub_815F48C: @ 815F48C cmp r0, 0 bne _0815F4B8 ldrb r0, [r4] - bl sub_80A82E4 + bl GetBattlerSubpriority subs r0, 0x2 adds r1, r5, 0 adds r1, 0x43 @@ -10377,7 +10377,7 @@ sub_815F48C: @ 815F48C .pool _0815F4B8: ldrb r0, [r4] - bl sub_80A82E4 + bl GetBattlerSubpriority adds r0, 0x2 adds r1, r5, 0 adds r1, 0x43 @@ -11038,7 +11038,7 @@ _0815F9F4: ldrh r6, [r0] ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r4, r0, 24 movs r7, 0 diff --git a/asm/battle_anim_effects_2.s b/asm/battle_anim_effects_2.s index c8cd53398..75b50f90f 100644 --- a/asm/battle_anim_effects_2.s +++ b/asm/battle_anim_effects_2.s @@ -1357,7 +1357,7 @@ _08103F28: ble _08103FA0 ldr r0, =gBattleAnimTarget ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r0, 24 ldr r2, =0x0000ffc0 @@ -1374,7 +1374,7 @@ _08103F78: ble _08103FA0 ldr r0, =gBattleAnimTarget ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r0, 24 ldr r3, =0x0000ffc0 @@ -1387,7 +1387,7 @@ _08103F78: _08103FA0: ldr r0, =gBattleAnimTarget ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x8] @@ -2246,7 +2246,7 @@ sub_8104674: @ 8104674 strh r5, [r4, 0x14] ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x16] @@ -6256,7 +6256,7 @@ sub_810673C: @ 810673C ldrh r0, [r1, 0x2] strh r0, [r4, 0x30] ldrb r0, [r5] - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x3C] @@ -6774,7 +6774,7 @@ sub_8106B54: @ 8106B54 bl StartSpriteAnim ldr r0, =gBattleAnimTarget ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority subs r0, 0x1 adds r1, r4, 0 adds r1, 0x43 diff --git a/asm/electric.s b/asm/electric.s deleted file mode 100644 index b1fa8b9ae..000000000 --- a/asm/electric.s +++ /dev/null @@ -1,2547 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_810A1A8 -sub_810A1A8: @ 810A1A8 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810A1D0 - ldr r0, =gBattleAnimArgs - ldrh r1, [r4, 0x20] - ldrh r2, [r0] - subs r1, r2 - strh r1, [r4, 0x20] - b _0810A1DC - .pool -_0810A1D0: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - adds r0, r1, 0 -_0810A1DC: - ldrh r0, [r0, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - ldr r0, =sub_810A1F8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A1A8 - - thumb_func_start sub_810A1F8 -sub_810A1F8: @ 810A1F8 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0810A20E - adds r0, r2, 0 - bl DestroyAnimSprite -_0810A20E: - pop {r0} - bx r0 - thumb_func_end sub_810A1F8 - - thumb_func_start sub_810A214 -sub_810A214: @ 810A214 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810A23C - ldr r0, =gBattleAnimArgs - ldrh r1, [r4, 0x20] - ldrh r0, [r0] - subs r1, r0 - strh r1, [r4, 0x20] - b _0810A246 - .pool -_0810A23C: - ldr r0, =gBattleAnimArgs - ldrh r0, [r0] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] -_0810A246: - ldr r0, =sub_810A258 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A214 - - thumb_func_start sub_810A258 -sub_810A258: @ 810A258 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0810A26E - adds r0, r2, 0 - bl move_anim_8074EE0 -_0810A26E: - pop {r0} - bx r0 - thumb_func_end sub_810A258 - - thumb_func_start sub_810A274 -sub_810A274: @ 810A274 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810A2C4 - ldr r2, =gBattleAnimArgs - ldrh r0, [r5, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r5, 0x20] - ldrh r0, [r5, 0x22] - ldrh r1, [r2, 0x2] - subs r0, r1 - strh r0, [r5, 0x22] - b _0810A2D8 - .pool -_0810A2C4: - ldr r0, =gBattleAnimArgs - ldrh r1, [r0] - ldrh r2, [r5, 0x20] - adds r1, r2 - strh r1, [r5, 0x20] - ldrh r1, [r0, 0x2] - ldrh r2, [r5, 0x22] - adds r1, r2 - strh r1, [r5, 0x22] - adds r2, r0, 0 -_0810A2D8: - movs r0, 0 - strh r0, [r5, 0x2E] - ldrh r0, [r2, 0x4] - strh r0, [r5, 0x30] - ldrh r0, [r2, 0x6] - strh r0, [r5, 0x32] - ldrh r0, [r2, 0x8] - strh r0, [r5, 0x34] - ldr r1, =move_anim_8074EE0 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A62EC - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A274 - - thumb_func_start sub_810A308 -sub_810A308: @ 810A308 - push {r4-r7,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0x8 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - beq _0810A380 - cmp r0, 0x1 - bgt _0810A324 - cmp r0, 0 - beq _0810A32E - b _0810A380 - .pool -_0810A324: - cmp r0, 0x2 - beq _0810A338 - cmp r0, 0x3 - beq _0810A35C - b _0810A380 -_0810A32E: - ldr r0, =gBattleAnimAttacker - b _0810A382 - .pool -_0810A338: - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r6, 0x2 - eors r0, r6 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - bne _0810A354 - ldrb r4, [r4] - b _0810A384 - .pool -_0810A354: - ldrb r0, [r4] - adds r4, r6, 0 - eors r4, r0 - b _0810A384 -_0810A35C: - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - movs r4, 0x2 - eors r0, r4 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810A380 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - eors r4, r0 - b _0810A384 - .pool -_0810A380: - ldr r0, =gBattleAnimTarget -_0810A382: - ldrb r4, [r0] -_0810A384: - ldr r0, =gBattleAnimArgs - movs r2, 0xA - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _0810A3AC - adds r0, r4, 0 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - adds r0, r4, 0 - movs r1, 0x1 - b _0810A3BE - .pool -_0810A3AC: - adds r0, r4, 0 - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - adds r0, r4, 0 - movs r1, 0x3 -_0810A3BE: - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldr r7, =gSineTable - ldr r6, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r6, r1] - lsls r0, 1 - adds r0, r7 - movs r2, 0 - ldrsh r1, [r0, r2] - movs r2, 0x2 - ldrsh r0, [r6, r2] - muls r0, r1 - asrs r0, 8 - strh r0, [r5, 0x24] - movs r1, 0 - ldrsh r0, [r6, r1] - adds r0, 0x40 - lsls r0, 1 - adds r0, r7 - movs r2, 0 - ldrsh r1, [r0, r2] - movs r2, 0x2 - ldrsh r0, [r6, r2] - muls r0, r1 - asrs r0, 8 - strh r0, [r5, 0x26] - ldrh r1, [r6, 0xC] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0810A422 - adds r0, r4, 0 - bl sub_80A8328 - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r5, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0x5] -_0810A422: - ldrb r2, [r5, 0x3] - lsls r2, 26 - lsrs r2, 27 - movs r0, 0x4 - ldrsh r1, [r6, r0] - lsls r0, r1, 1 - adds r0, r7 - ldrh r0, [r0] - ldr r3, =gOamMatrices - lsls r2, 3 - adds r2, r3 - adds r1, 0x40 - lsls r1, 1 - adds r1, r7 - ldrh r1, [r1] - strh r1, [r2, 0x6] - strh r1, [r2] - strh r0, [r2, 0x2] - lsls r0, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r2, 0x4] - ldrh r0, [r6, 0x6] - strh r0, [r5, 0x2E] - ldr r0, =sub_810E2C8 - str r0, [r5, 0x1C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A308 - - thumb_func_start sub_810A46C -sub_810A46C: @ 810A46C - push {r4-r6,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldr r6, =gBattleAnimTarget - ldrb r0, [r6] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - ldrb r0, [r6] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl InitAnimLinearTranslation - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x38] - ldrh r0, [r5, 0xA] - strh r0, [r4, 0x3A] - ldrh r0, [r5, 0x8] - strh r0, [r4, 0x3C] - ldrh r2, [r4, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - movs r3, 0xC - ldrsh r0, [r5, r3] - lsls r0, 2 - adds r1, r0 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r4, 0x4] - ldr r1, =sub_810A4F4 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A46C - - thumb_func_start sub_810A4F4 -sub_810A4F4: @ 810A4F4 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - bne _0810A55E - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - ldrh r2, [r4, 0x3C] - adds r0, r2 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _0810A564 - 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] - b _0810A564 -_0810A55E: - adds r0, r4, 0 - bl DestroyAnimSprite -_0810A564: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810A4F4 - - thumb_func_start sub_810A56C -sub_810A56C: @ 810A56C - push {lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x38] - subs r0, 0x1 - strh r0, [r3, 0x38] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _0810A5A4 - movs r0, 0x3E - adds r0, r3 - mov r12, r0 - ldrb r2, [r0] - 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 - mov r1, r12 - strb r0, [r1] - ldrh r0, [r3, 0x36] - strh r0, [r3, 0x38] -_0810A5A4: - ldrh r0, [r3, 0x34] - subs r1, r0, 0x1 - strh r1, [r3, 0x34] - lsls r0, 16 - cmp r0, 0 - bgt _0810A5B6 - adds r0, r3, 0 - bl DestroyAnimSprite -_0810A5B6: - pop {r0} - bx r0 - thumb_func_end sub_810A56C - - thumb_func_start sub_810A5BC -sub_810A5BC: @ 810A5BC - push {r4-r6,lr} - adds r6, r0, 0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0810A5D8 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810A5E0 -_0810A5D8: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] -_0810A5E0: - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r6, 0x20] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x4] - adds r0, r1 - strh r0, [r6, 0x22] - ldrh r0, [r4] - strh r0, [r6, 0x34] - ldrh r0, [r4, 0x6] - strh r0, [r6, 0x36] - strh r0, [r6, 0x38] - ldr r0, =sub_810A56C - str r0, [r6, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A5BC - - thumb_func_start sub_810A628 -sub_810A628: @ 810A628 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x6] - strh r0, [r5, 0x2E] - movs r2, 0xE - ldrsh r0, [r1, r2] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0810A64C - ldr r0, =gBattleAnimTarget - b _0810A64E - .pool -_0810A64C: - ldr r0, =gBattleAnimAttacker -_0810A64E: - ldrb r6, [r0] - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0810A666 - adds r0, r6, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810A66E -_0810A666: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - negs r0, r0 - strh r0, [r1] -_0810A66E: - adds r0, r6, 0 - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r3, [r4] - adds r0, r3 - strh r0, [r5, 0x20] - adds r0, r6, 0 - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r5, 0x22] - ldrh r1, [r4, 0xE] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r5, 0x36] - ldrh r0, [r4, 0x4] - strh r0, [r5, 0x38] - ldrh r0, [r4, 0xA] - strh r0, [r5, 0x3A] - ldrh r0, [r4, 0x8] - strh r0, [r5, 0x3C] - ldrh r2, [r5, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - movs r3, 0xC - ldrsh r0, [r4, r3] - lsls r0, 2 - adds r1, r0 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x4] - ldr r1, =sub_810A6EC - str r1, [r5, 0x1C] - adds r0, r5, 0 - bl _call_via_r1 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A628 - - thumb_func_start sub_810A6EC -sub_810A6EC: @ 810A6EC - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl __modsi3 - cmp r0, 0 - bne _0810A742 - 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] -_0810A742: - ldrh r0, [r4, 0x2E] - subs r1, r0, 0x1 - strh r1, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bgt _0810A754 - adds r0, r4, 0 - bl DestroyAnimSprite -_0810A754: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810A6EC - - thumb_func_start sub_810A75C -sub_810A75C: @ 810A75C - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0 - bl sub_80A6980 - ldrh r2, [r4, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - ldr r3, =gBattleAnimArgs - movs r5, 0x6 - ldrsh r0, [r3, r5] - lsls r0, 2 - adds r1, r0 - ldr r5, =0x000003ff - adds r0, r5, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r4, 0x4] - movs r1, 0x6 - ldrsh r0, [r3, r1] - cmp r0, 0x1 - bne _0810A7A4 - ldrb r0, [r4, 0x3] - movs r1, 0x3F - negs r1, r1 - ands r1, r0 - movs r0, 0x10 - b _0810A7B2 - .pool -_0810A7A4: - cmp r0, 0x2 - bne _0810A7B6 - ldrb r0, [r4, 0x3] - movs r1, 0x3F - negs r1, r1 - ands r1, r0 - movs r0, 0x20 -_0810A7B2: - orrs r1, r0 - strb r1, [r4, 0x3] -_0810A7B6: - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x4] - strh r0, [r4, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r4, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A75C - - thumb_func_start sub_810A7DC -sub_810A7DC: @ 810A7DC - push {r4-r6,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r6, =gBattleAnimTarget - ldrb r0, [r6] - movs r1, 0 - bl GetBattlerSpriteCoord - ldr r1, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r1 - lsls r0, 24 - ldr r5, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r5] - adds r0, r1 - strh r0, [r4, 0x8] - ldrb r0, [r6] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x2] - adds r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0xC] - ldr r0, =sub_810A834 - str r0, [r4] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810A7DC - - thumb_func_start sub_810A834 -sub_810A834: @ 810A834 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r5, 0 - movs r7, 0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - ldrb r2, [r0, 0xC] - str r2, [sp] - ldrh r4, [r0, 0x8] - ldrh r6, [r0, 0xA] - movs r3, 0xC - ldrsh r0, [r0, r3] - mov r10, r1 - cmp r0, 0 - bne _0810A878 - movs r0, 0 - mov r8, r0 - movs r2, 0x1 - movs r1, 0x10 - mov r12, r1 - b _0810A882 - .pool -_0810A878: - movs r2, 0x10 - mov r12, r2 - movs r3, 0x8 - mov r8, r3 - movs r2, 0x4 -_0810A882: - mov r0, r9 - lsls r1, r0, 2 - adds r0, r1, r0 - lsls r0, 3 - add r0, r10 - movs r3, 0x1C - ldrsh r0, [r0, r3] - mov r10, r1 - cmp r0, 0xA - bhi _0810A978 - lsls r0, 2 - ldr r1, =_0810A8A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0810A8A4: - .4byte _0810A8D0 - .4byte _0810A978 - .4byte _0810A8E4 - .4byte _0810A978 - .4byte _0810A904 - .4byte _0810A978 - .4byte _0810A91A - .4byte _0810A978 - .4byte _0810A93C - .4byte _0810A978 - .4byte _0810A970 -_0810A8D0: - ldr r0, =gUnknown_08595828 - lsls r1, r4, 16 - asrs r1, 16 - lsls r2, r6, 16 - asrs r2, 16 - mov r4, r12 - lsls r3, r4, 16 - b _0810A952 - .pool -_0810A8E4: - mov r0, r12 - lsls r3, r0, 17 - mov r1, r8 - adds r0, r1, r2 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =gUnknown_08595828 - lsls r1, r4, 16 - asrs r1, 16 - lsls r2, r6, 16 - asrs r2, 16 - b _0810A952 - .pool -_0810A904: - mov r3, r12 - lsls r0, r3, 16 - asrs r0, 16 - lsls r3, r0, 1 - adds r3, r0 - lsls r0, r2, 1 - add r0, r8 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - b _0810A946 -_0810A91A: - mov r0, r12 - lsls r3, r0, 18 - lsls r0, r2, 1 - adds r0, r2 - add r0, r8 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =gUnknown_08595828 - lsls r1, r4, 16 - asrs r1, 16 - lsls r2, r6, 16 - asrs r2, 16 - b _0810A952 - .pool -_0810A93C: - mov r1, r12 - lsls r0, r1, 16 - asrs r0, 16 - lsls r3, r0, 2 - adds r3, r0 -_0810A946: - ldr r0, =gUnknown_08595828 - lsls r1, r4, 16 - asrs r1, 16 - lsls r2, r6, 16 - asrs r2, 16 - lsls r3, 16 -_0810A952: - asrs r3, 16 - adds r2, r3 - lsls r2, 16 - asrs r2, 16 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - b _0810A978 - .pool -_0810A970: - mov r0, r9 - bl DestroyAnimVisualTask - b _0810A9BC -_0810A978: - cmp r7, 0 - beq _0810A9AC - ldr r4, =gSprites - lsls r3, r5, 4 - adds r3, r5 - lsls r3, 2 - adds r0, r3, r4 - ldrh r5, [r0, 0x4] - lsls r2, r5, 22 - lsrs r2, 22 - add r2, r8 - ldr r6, =0x000003ff - adds r1, r6, 0 - ands r2, r1 - ldr r1, =0xfffffc00 - ands r1, r5 - orrs r1, r2 - strh r1, [r0, 0x4] - mov r1, sp - ldrh r1, [r1] - strh r1, [r0, 0x2E] - adds r4, 0x1C - adds r3, r4 - ldr r1, [r3] - bl _call_via_r1 -_0810A9AC: - ldr r0, =gTasks - mov r1, r10 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] -_0810A9BC: - 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_810A834 - - thumb_func_start sub_810A9DC -sub_810A9DC: @ 810A9DC - push {lr} - adds r3, r0, 0 - movs r1, 0x2E - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _0810A9FE - ldrb r1, [r3, 0x1] - movs r2, 0x3F - adds r0, r2, 0 - ands r0, r1 - movs r1, 0x80 - orrs r0, r1 - strb r0, [r3, 0x1] - ldrb r0, [r3, 0x3] - ands r2, r0 - strb r2, [r3, 0x3] - b _0810AA12 -_0810A9FE: - ldrb r2, [r3, 0x1] - movs r1, 0x3F - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0x1] - ldrb r0, [r3, 0x3] - ands r1, r0 - movs r0, 0x40 - orrs r1, r0 - strb r1, [r3, 0x3] -_0810AA12: - ldrh r0, [r3, 0x30] - adds r0, 0x1 - strh r0, [r3, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xF - bne _0810AA26 - adds r0, r3, 0 - bl DestroySprite -_0810AA26: - pop {r0} - bx r0 - thumb_func_end sub_810A9DC - - thumb_func_start sub_810AA2C -sub_810AA2C: @ 810AA2C - push {r4-r7,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0] - ldrh r2, [r4, 0x20] - adds r1, r2 - strh r1, [r4, 0x20] - ldrh r0, [r0, 0x2] - ldrh r3, [r4, 0x22] - adds r0, r3 - strh r0, [r4, 0x22] - ldr r0, =gUnknown_08595840 - adds r1, 0x20 - lsls r1, 16 - asrs r1, 16 - movs r7, 0x22 - ldrsh r2, [r4, r7] - adds r3, r4, 0 - adds r3, 0x43 - ldrb r3, [r3] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r6, r2, r3 - ldrh r5, [r6, 0x4] - lsls r1, r5, 22 - lsrs r1, 22 - adds r1, 0x8 - ldr r7, =0x000003ff - adds r0, r7, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r5 - orrs r0, r1 - strh r0, [r6, 0x4] - ldr r1, =gAnimVisualTaskCount - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - adds r3, 0x1C - adds r2, r3 - ldr r0, =sub_810AAB0 - str r0, [r2] - str r0, [r4, 0x1C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810AA2C - - thumb_func_start sub_810AAB0 -sub_810AAB0: @ 810AAB0 - push {lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _0810AAE4 - movs r0, 0 - strh r0, [r3, 0x2E] - movs r0, 0x3E - adds r0, r3 - mov r12, r0 - ldrb r2, [r0] - 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 - mov r1, r12 - strb r0, [r1] -_0810AAE4: - ldrh r0, [r3, 0x30] - adds r0, 0x1 - strh r0, [r3, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x33 - bne _0810AAF8 - adds r0, r3, 0 - bl DestroyAnimSprite -_0810AAF8: - pop {r0} - bx r0 - thumb_func_end sub_810AAB0 - - thumb_func_start sub_810AAFC -sub_810AAFC: @ 810AAFC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r5, r1, r0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _0810AB28 - ldr r4, =gBattleAnimAttacker - b _0810AB2A - .pool -_0810AB28: - ldr r4, =gBattleAnimTarget -_0810AB2A: - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x24] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x26] - ldr r2, =gBattleAnimArgs - ldrh r0, [r2, 0x2] - movs r1, 0 - strh r0, [r5, 0x14] - strh r1, [r5, 0x16] - strh r1, [r5, 0x18] - strh r1, [r5, 0x1A] - strh r1, [r5, 0x1C] - ldrh r0, [r2, 0x6] - strh r0, [r5, 0x1E] - strh r1, [r5, 0x20] - ldrh r0, [r2, 0x4] - strh r0, [r5, 0x22] - ldr r0, =sub_810AB78 - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810AAFC - - thumb_func_start sub_810AB78 -sub_810AB78: @ 810AB78 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - adds r2, r6, 0 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - movs r1, 0x14 - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _0810AC78 - ldrh r0, [r5, 0x20] - adds r0, 0x1 - movs r7, 0 - strh r0, [r5, 0x20] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x22 - ldrsh r1, [r5, r2] - cmp r0, r1 - ble _0810AC86 - strh r7, [r5, 0x20] - ldr r0, =gUnknown_085958A8 - movs r3, 0x24 - ldrsh r1, [r5, r3] - movs r3, 0x26 - ldrsh r2, [r5, r3] - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0810AC86 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - ldr r1, =gUnknown_08595858 - movs r2, 0x1A - ldrsh r0, [r5, r2] - lsls r0, 1 - adds r0, r1 - movs r3, 0 - ldrsb r3, [r0, r3] - ldrh r0, [r4, 0x20] - adds r3, r0 - strh r3, [r4, 0x20] - movs r2, 0x1A - ldrsh r0, [r5, r2] - lsls r0, 1 - adds r1, 0x1 - adds r0, r1 - movs r2, 0 - ldrsb r2, [r0, r2] - ldrh r0, [r4, 0x22] - adds r2, r0 - strh r2, [r4, 0x22] - movs r1, 0x18 - ldrsh r0, [r5, r1] - lsls r1, r0, 2 - adds r1, r0 - movs r0, 0x28 - subs r0, r1 - strh r0, [r4, 0x2E] - strh r3, [r4, 0x30] - ldrh r0, [r5, 0x24] - strh r0, [r4, 0x32] - strh r2, [r4, 0x34] - ldrh r0, [r5, 0x26] - strh r0, [r4, 0x36] - strh r6, [r4, 0x38] - adds r0, r4, 0 - bl InitAnimLinearTranslation - ldr r1, =sub_810ACC0 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67D8 - str r0, [r4, 0x1C] - ldrh r0, [r5, 0x1A] - adds r0, 0x1 - strh r0, [r5, 0x1A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xF - ble _0810AC30 - strh r7, [r5, 0x1A] -_0810AC30: - ldrh r0, [r5, 0x1C] - adds r0, 0x1 - strh r0, [r5, 0x1C] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x1E - ldrsh r1, [r5, r2] - cmp r0, r1 - blt _0810AC52 - strh r7, [r5, 0x1C] - ldrh r1, [r5, 0x18] - movs r3, 0x18 - ldrsh r0, [r5, r3] - cmp r0, 0x5 - bgt _0810AC52 - adds r0, r1, 0x1 - strh r0, [r5, 0x18] -_0810AC52: - ldrh r0, [r5, 0x16] - adds r0, 0x1 - strh r0, [r5, 0x16] - ldrh r0, [r5, 0x14] - subs r0, 0x1 - strh r0, [r5, 0x14] - b _0810AC86 - .pool -_0810AC78: - movs r1, 0x16 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0810AC86 - adds r0, r2, 0 - bl DestroyAnimVisualTask -_0810AC86: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_810AB78 - - thumb_func_start sub_810AC8C -sub_810AC8C: @ 810AC8C - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - beq _0810ACB4 - ldr r2, =gTasks - movs r0, 0x38 - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x16] - subs r1, 0x1 - strh r1, [r0, 0x16] - adds r0, r4, 0 - bl DestroySprite -_0810ACB4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810AC8C - - thumb_func_start sub_810ACC0 -sub_810ACC0: @ 810ACC0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, =sub_810AC8C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810ACC0 - - thumb_func_start sub_810ACD8 -sub_810ACD8: @ 810ACD8 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _0810ACF4 - ldr r4, =gBattleAnimAttacker - b _0810ACF6 - .pool -_0810ACF4: - ldr r4, =gBattleAnimTarget -_0810ACF6: - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldr r1, =move_anim_8074EE0 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67BC - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810ACD8 - - thumb_func_start sub_810AD30 -sub_810AD30: @ 810AD30 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _0810AD4C - ldr r4, =gBattleAnimAttacker - b _0810AD4E - .pool -_0810AD4C: - ldr r4, =gBattleAnimTarget -_0810AD4E: - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - strh r0, [r5, 0x24] - ldrh r0, [r1, 0x4] - strh r0, [r5, 0x26] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67D8 - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810AD30 - - thumb_func_start sub_810AD98 -sub_810AD98: @ 810AD98 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - movs r0, 0 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x3A] - movs r0, 0x10 - strh r0, [r5, 0x3C] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0810ADE6 - movs r1, 0x3C - ldrsh r0, [r5, r1] - negs r0, r0 - strh r0, [r5, 0x3C] -_0810ADE6: - ldr r0, =sub_810ADF8 - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810AD98 - - thumb_func_start sub_810ADF8 -sub_810ADF8: @ 810ADF8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0810AE0A - cmp r0, 0x1 - beq _0810AE20 - b _0810AE50 -_0810AE0A: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x28 - ble _0810AE50 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _0810AE50 -_0810AE20: - ldrh r2, [r4, 0x3C] - ldrh r1, [r4, 0x20] - adds r0, r2, r1 - strh r0, [r4, 0x20] - ldr r3, =gSprites - movs r0, 0x3A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x24] - adds r2, r1 - strh r2, [r0, 0x24] - ldrh r0, [r4, 0x20] - adds r0, 0x50 - lsls r0, 16 - movs r1, 0xC8 - lsls r1, 17 - cmp r0, r1 - bls _0810AE50 - adds r0, r4, 0 - bl move_anim_8074EE0 -_0810AE50: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810ADF8 - - thumb_func_start sub_810AE5C -sub_810AE5C: @ 810AE5C - push {r4-r6,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _0810AEF0 - cmp r0, 0x1 - bgt _0810AE84 - cmp r0, 0 - beq _0810AE90 - b _0810AFC0 - .pool -_0810AE84: - cmp r0, 0x2 - beq _0810AF4C - cmp r0, 0x3 - bne _0810AE8E - b _0810AFA0 -_0810AE8E: - b _0810AFC0 -_0810AE90: - movs r0, 0 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - movs r6, 0 - strh r0, [r5, 0x26] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x24] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810AECC - ldr r0, =0x0000ffe0 - strh r0, [r5, 0x24] - movs r0, 0x2 - b _0810AED2 - .pool -_0810AECC: - movs r0, 0x20 - strh r0, [r5, 0x24] - ldr r0, =0x0000fffe -_0810AED2: - strh r0, [r5, 0x22] - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r5, 0x24] - strh r1, [r0, 0x24] - b _0810AF92 - .pool -_0810AEF0: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0810AFC0 - movs r0, 0 - strh r0, [r5, 0xA] - ldr r4, =gSprites - movs r1, 0x26 - ldrsh r0, [r5, r1] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - adds r2, 0x3E - ldrb r3, [r2] - lsls r0, r3, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrh r1, [r5, 0x24] - movs r2, 0x24 - ldrsh r0, [r5, r2] - cmp r0, 0 - beq _0810AF92 - ldrh r2, [r5, 0x22] - adds r2, r1, r2 - strh r2, [r5, 0x24] - movs r0, 0x26 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r2, [r0, 0x24] - b _0810AFC0 - .pool -_0810AF4C: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0810AFC0 - movs r0, 0 - strh r0, [r5, 0xA] - ldr r1, =gSprites - movs r2, 0x26 - ldrsh r0, [r5, r2] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r1 - adds r2, 0x3E - ldrb r3, [r2] - lsls r0, r3, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r5, 0xC] - adds r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - bne _0810AFC0 -_0810AF92: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _0810AFC0 - .pool -_0810AFA0: - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r5, 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] - adds r0, r3, 0 - bl DestroyAnimVisualTask -_0810AFC0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810AE5C - - thumb_func_start sub_810AFCC -sub_810AFCC: @ 810AFCC - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _0810AFE6 - b _0810B10C -_0810AFE6: - cmp r0, 0x1 - bgt _0810AFF4 - cmp r0, 0 - beq _0810AFFC - b _0810B14E - .pool -_0810AFF4: - cmp r0, 0x2 - bne _0810AFFA - b _0810B140 -_0810AFFA: - b _0810B14E -_0810AFFC: - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - movs r2, 0x1 - negs r2, r2 - adds r1, r2, 0 - cmp r0, 0 - bne _0810B012 - movs r1, 0x1 -_0810B012: - movs r6, 0 - strh r1, [r5, 0xA] - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r2, [r0, r1] - adds r3, r0, 0 - cmp r2, 0 - beq _0810B048 - cmp r2, 0x4 - beq _0810B070 - ldrh r1, [r3] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0810B0A8 - movs r0, 0x80 - lsls r0, 1 - strh r0, [r5, 0xE] - ldr r0, =0x0000fff0 - b _0810B0B0 - .pool -_0810B048: - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0xE] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x12] - movs r2, 0xA - ldrsh r0, [r5, r2] - lsls r0, 7 - adds r0, 0x78 - strh r0, [r5, 0x10] - b _0810B0E6 -_0810B070: - movs r0, 0xA - ldrsh r1, [r5, r0] - lsls r1, 7 - movs r0, 0x78 - subs r0, r1 - strh r0, [r5, 0xE] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x12] - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - movs r2, 0xA - ldrsh r1, [r5, r2] - lsls r1, 5 - subs r0, r1 - strh r0, [r5, 0x10] - b _0810B0E6 - .pool -_0810B0A8: - ldr r0, =0x0000fff0 - strh r0, [r5, 0xE] - movs r0, 0x80 - lsls r0, 1 -_0810B0B0: - strh r0, [r5, 0x10] - movs r1, 0xA - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _0810B0D0 - movs r2, 0 - ldrsh r0, [r3, r2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 1 - movs r0, 0x50 - subs r0, r1 - strh r0, [r5, 0x12] - b _0810B0E6 - .pool -_0810B0D0: - movs r0, 0 - ldrsh r1, [r3, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 1 - adds r0, 0x28 - strh r0, [r5, 0x12] - ldrh r1, [r5, 0xE] - ldrh r0, [r5, 0x10] - strh r0, [r5, 0xE] - strh r1, [r5, 0x10] -_0810B0E6: - movs r2, 0xE - ldrsh r1, [r5, r2] - movs r2, 0x10 - ldrsh r0, [r5, r2] - cmp r1, r0 - bge _0810B0FC - movs r1, 0 - movs r0, 0x1 - strh r0, [r5, 0xA] - strh r1, [r5, 0x14] - b _0810B138 -_0810B0FC: - ldr r0, =0x0000ffff - strh r0, [r5, 0xA] - movs r0, 0x3 - strh r0, [r5, 0x14] - b _0810B138 - .pool -_0810B10C: - ldrh r0, [r5, 0xC] - adds r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - ble _0810B14E - movs r0, 0 - strh r0, [r5, 0xC] - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_810B154 - lsls r0, 24 - cmp r0, 0 - bne _0810B138 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_810B154 - lsls r0, 24 - cmp r0, 0 - beq _0810B14E -_0810B138: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _0810B14E -_0810B140: - movs r1, 0x16 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0810B14E - adds r0, r4, 0 - bl DestroyAnimVisualTask -_0810B14E: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_810AFCC - - thumb_func_start sub_810B154 -sub_810B154: @ 810B154 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =gUnknown_08595A00 - movs r2, 0xE - ldrsh r1, [r4, r2] - movs r3, 0x12 - ldrsh r2, [r4, r3] - movs r3, 0x23 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _0810B18A - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strh r5, [r0, 0x3A] - movs r1, 0x7 - strh r1, [r0, 0x3C] - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] -_0810B18A: - ldrh r1, [r4, 0xA] - ldrh r5, [r4, 0x14] - adds r0, r1, r5 - strh r0, [r4, 0x14] - lsls r0, 16 - cmp r0, 0 - bge _0810B19C - movs r0, 0x3 - strh r0, [r4, 0x14] -_0810B19C: - movs r2, 0x14 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - ble _0810B1A8 - movs r0, 0 - strh r0, [r4, 0x14] -_0810B1A8: - movs r3, 0xA - ldrsh r0, [r4, r3] - lsls r0, 4 - ldrh r5, [r4, 0xE] - adds r2, r0, r5 - strh r2, [r4, 0xE] - lsls r0, r1, 16 - asrs r3, r0, 16 - cmp r3, 0x1 - bne _0810B1C8 - lsls r0, r2, 16 - asrs r0, 16 - movs r5, 0x10 - ldrsh r1, [r4, r5] - cmp r0, r1 - bge _0810B1DC -_0810B1C8: - movs r0, 0x1 - negs r0, r0 - cmp r3, r0 - bne _0810B1E8 - lsls r0, r2, 16 - asrs r0, 16 - movs r2, 0x10 - ldrsh r1, [r4, r2] - cmp r0, r1 - bgt _0810B1E8 -_0810B1DC: - movs r0, 0x1 - b _0810B1EA - .pool -_0810B1E8: - movs r0, 0 -_0810B1EA: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_810B154 - - thumb_func_start sub_810B1F0 -sub_810B1F0: @ 810B1F0 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xC - ble _0810B230 - ldr r3, =gTasks - movs r0, 0x3C - ldrsh r1, [r4, r0] - lsls r1, 1 - movs r0, 0x3A - ldrsh r2, [r4, r0] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - adds r3, 0x8 - adds r1, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - adds r0, r4, 0 - bl DestroySprite -_0810B230: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810B1F0 - - thumb_func_start sub_810B23C -sub_810B23C: @ 810B23C - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _0810B24E - cmp r0, 0x1 - beq _0810B280 - b _0810B294 -_0810B24E: - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - adds r0, r5, 0 - movs r1, 0x2 - bl StartSpriteAffineAnim - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - b _0810B294 - .pool -_0810B280: - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0810B294 - adds r0, r5, 0 - bl move_anim_8074EE0 -_0810B294: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_810B23C - - thumb_func_start sub_810B29C -sub_810B29C: @ 810B29C - push {r4,r5,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x4 - bls _0810B2B6 - b _0810B428 -_0810B2B6: - lsls r0, 2 - ldr r1, =_0810B2C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0810B2C8: - .4byte _0810B2DC - .4byte _0810B36C - .4byte _0810B3A8 - .4byte _0810B404 - .4byte _0810B414 -_0810B2DC: - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x14] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x16] - movs r0, 0x4 - strh r0, [r5, 0x18] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x1C] - movs r2, 0x1C - ldrsh r0, [r5, r2] - movs r2, 0x14 - ldrsh r1, [r5, r2] - subs r0, r1 - movs r1, 0x5 - bl __divsi3 - strh r0, [r5, 0x1A] - movs r0, 0x7 - strh r0, [r5, 0x10] - ldr r0, =0x0000ffff - strh r0, [r5, 0x12] - movs r0, 0xC - strh r0, [r5, 0x1E] - subs r0, 0x4C - bl BattleAnimAdjustPanning - lsls r0, 24 - asrs r0, 24 - strh r0, [r5, 0x20] - movs r0, 0x3F - bl BattleAnimAdjustPanning - lsls r0, 24 - asrs r0, 24 - strh r0, [r5, 0x22] - ldrh r0, [r5, 0x20] - strh r0, [r5, 0x24] - movs r1, 0x22 - ldrsh r0, [r5, r1] - movs r2, 0x20 - ldrsh r1, [r5, r2] - subs r0, r1 - movs r1, 0x3 - bl __divsi3 - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x8] - adds r0, 0x1 - b _0810B426 - .pool -_0810B36C: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - cmp r0, 0 - ble _0810B39C - movs r0, 0 - strh r0, [r5, 0xA] - adds r0, r5, 0 - adds r1, r2, 0 - bl sub_810B430 - lsls r0, 24 - cmp r0, 0 - beq _0810B39C - movs r1, 0xC - ldrsh r0, [r5, r1] - cmp r0, 0x5 - bne _0810B396 - movs r0, 0x3 - b _0810B39A -_0810B396: - ldrh r0, [r5, 0x8] - adds r0, 0x1 -_0810B39A: - strh r0, [r5, 0x8] -_0810B39C: - ldrh r1, [r5, 0x1E] - movs r2, 0x1E - ldrsh r0, [r5, r2] - cmp r0, 0 - beq _0810B428 - b _0810B41E -_0810B3A8: - ldrh r1, [r5, 0x1E] - movs r2, 0x1E - ldrsh r0, [r5, r2] - cmp r0, 0 - beq _0810B3B6 - subs r0, r1, 0x1 - strh r0, [r5, 0x1E] -_0810B3B6: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - movs r3, 0 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _0810B428 - strh r3, [r5, 0xA] - ldrh r1, [r5, 0xC] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0810B3E2 - movs r0, 0x4 - strh r0, [r5, 0x16] - movs r0, 0x44 - strh r0, [r5, 0x18] - strh r3, [r5, 0x10] - strh r2, [r5, 0x12] - b _0810B3F2 -_0810B3E2: - movs r0, 0x44 - strh r0, [r5, 0x16] - movs r0, 0x4 - strh r0, [r5, 0x18] - movs r0, 0x7 - strh r0, [r5, 0x10] - ldr r0, =0x0000ffff - strh r0, [r5, 0x12] -_0810B3F2: - movs r1, 0x1E - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _0810B424 - movs r0, 0x4 - b _0810B426 - .pool -_0810B404: - movs r1, 0xE - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0810B428 - adds r0, r2, 0 - bl DestroyAnimVisualTask - b _0810B428 -_0810B414: - ldrh r1, [r5, 0x1E] - movs r2, 0x1E - ldrsh r0, [r5, r2] - cmp r0, 0 - beq _0810B424 -_0810B41E: - subs r0, r1, 0x1 - strh r0, [r5, 0x1E] - b _0810B428 -_0810B424: - movs r0, 0x1 -_0810B426: - strh r0, [r5, 0x8] -_0810B428: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_810B29C - - thumb_func_start sub_810B430 -sub_810B430: @ 810B430 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =gUnknown_08595A30 - movs r2, 0x14 - ldrsh r1, [r4, r2] - movs r3, 0x16 - ldrsh r2, [r4, r3] - movs r3, 0x23 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _0810B49C - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r3, r0, r1 - ldrh r2, [r3, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - ldrh r6, [r4, 0x10] - adds r1, r6 - ldr r6, =0x000003ff - adds r0, r6, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - ldrh r0, [r4, 0x12] - ldrh r1, [r4, 0x10] - adds r0, r1 - strh r0, [r4, 0x10] - lsls r0, 16 - cmp r0, 0 - bge _0810B484 - movs r0, 0x7 - strh r0, [r4, 0x10] -_0810B484: - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r0, 0x7 - ble _0810B490 - movs r0, 0 - strh r0, [r4, 0x10] -_0810B490: - strh r5, [r3, 0x3A] - movs r0, 0x3 - strh r0, [r3, 0x3C] - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] -_0810B49C: - movs r3, 0x10 - ldrsh r0, [r4, r3] - cmp r0, 0 - bne _0810B4BE - movs r5, 0x12 - ldrsh r0, [r4, r5] - cmp r0, 0 - ble _0810B4BE - ldrh r1, [r4, 0x26] - ldrh r6, [r4, 0x24] - adds r1, r6 - strh r1, [r4, 0x24] - lsls r1, 24 - asrs r1, 24 - movs r0, 0x76 - bl PlaySE12WithPanning -_0810B4BE: - movs r0, 0x12 - ldrsh r3, [r4, r0] - ldrh r2, [r4, 0x16] - cmp r3, 0 - bge _0810B4D4 - lsls r0, r2, 16 - asrs r0, 16 - movs r5, 0x18 - ldrsh r1, [r4, r5] - cmp r0, r1 - ble _0810B4E4 -_0810B4D4: - cmp r3, 0 - ble _0810B508 - lsls r0, r2, 16 - asrs r0, 16 - movs r6, 0x18 - ldrsh r1, [r4, r6] - cmp r0, r1 - blt _0810B508 -_0810B4E4: - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - ldrh r0, [r4, 0x1A] - ldrh r1, [r4, 0x14] - adds r0, r1 - strh r0, [r4, 0x14] - movs r0, 0x1 - b _0810B514 - .pool -_0810B508: - movs r3, 0x12 - ldrsh r0, [r4, r3] - lsls r0, 3 - adds r0, r2, r0 - strh r0, [r4, 0x16] - movs r0, 0 -_0810B514: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_810B430 - - thumb_func_start sub_810B51C -sub_810B51C: @ 810B51C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xC - ble _0810B552 - ldr r3, =gTasks - movs r0, 0x3C - ldrsh r1, [r4, r0] - lsls r1, 1 - movs r0, 0x3A - ldrsh r2, [r4, r0] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - adds r3, 0x8 - adds r1, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - adds r0, r4, 0 - bl DestroySprite -_0810B552: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810B51C - - thumb_func_start sub_810B55C -sub_810B55C: @ 810B55C - push {r4,r5,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _0810B5D8 - cmp r0, 0x1 - bgt _0810B584 - cmp r0, 0 - beq _0810B58A - b _0810B60E - .pool -_0810B584: - cmp r0, 0x2 - beq _0810B600 - b _0810B60E -_0810B58A: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x20 - strh r0, [r5, 0x26] - strh r0, [r5, 0x24] - cmp r0, 0x10 - ble _0810B5B4 - adds r2, r0, 0 -_0810B5A4: - adds r1, r2, 0 - subs r1, 0x20 - adds r2, r1, 0 - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x10 - bgt _0810B5A4 - strh r1, [r5, 0x24] -_0810B5B4: - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldrb r0, [r4] - bl sub_80A82E4 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x2 - strh r0, [r5, 0x20] - b _0810B5F8 - .pool -_0810B5D8: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0810B60E - movs r0, 0 - strh r0, [r5, 0xA] - adds r0, r5, 0 - adds r1, r2, 0 - bl sub_810B614 - lsls r0, 24 - cmp r0, 0 - beq _0810B60E -_0810B5F8: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _0810B60E -_0810B600: - movs r1, 0x1C - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0810B60E - adds r0, r2, 0 - bl DestroyAnimVisualTask -_0810B60E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_810B55C - - .align 2, 0 diff --git a/asm/water.s b/asm/water.s index 6965d6371..ece2359cb 100644 --- a/asm/water.s +++ b/asm/water.s @@ -711,7 +711,7 @@ sub_8107730: @ 8107730 ldr r6, =0x0000fff6 strh r6, [r4, 0x26] ldrb r0, [r7] - bl sub_80A82E4 + bl GetBattlerSubpriority lsls r0, 24 lsrs r5, r0, 24 bl IsContest @@ -2286,7 +2286,7 @@ sub_8108408: @ 8108408 lsrs r6, r0, 24 movs r5, 0xAC ldrb r0, [r4] - bl sub_80A82E4 + bl GetBattlerSubpriority subs r0, 0x1 lsls r0, 24 lsrs r0, 24 @@ -3517,7 +3517,7 @@ _08108DE2: strh r0, [r4, 0x30] ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority subs r0, 0x1 adds r1, r4, 0 adds r1, 0x43 @@ -3572,7 +3572,7 @@ _08108E58: strh r0, [r4, 0x30] ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A82E4 + bl GetBattlerSubpriority subs r0, 0x1 adds r1, r4, 0 adds r1, 0x43 diff --git a/include/battle_anim.h b/include/battle_anim.h index e0c1b2b08..e6540630a 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -106,7 +106,7 @@ void sub_80A8048(s16 *bottom, s16 *top, const void *ptr); void sub_80A8278(void); void sub_80A6B30(struct UnknownAnimStruct2*); void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); -u8 sub_80A82E4(u8 battlerId); +u8 GetBattlerSubpriority(u8 battlerId); bool8 TranslateAnimArc(struct Sprite *sprite); void sub_80A6630(struct Sprite *sprite); void sub_80A6680(struct Sprite *sprite); @@ -159,7 +159,6 @@ u8 sub_80A8364(u8 battlerId); void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); void oamt_add_pos2_onto_pos1(struct Sprite *sprite); u8 GetBattlerSpriteDefault_Y(u8 battlerId); -u8 sub_80A82E4(u8 battlerId); u8 GetSubstituteSpriteDefault_Y(u8 battlerId); // battle_anim_80A9C70.s diff --git a/ld_script.txt b/ld_script.txt index 2f1f1369a..fcf362aa1 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -161,7 +161,7 @@ SECTIONS { asm/battle_anim_effects_2.o(.text); asm/water.o(.text); src/fire.o(.text); - asm/electric.o(.text); + src/electric.o(.text); asm/ice.o(.text); src/fight.o(.text); src/poison.o(.text); diff --git a/src/battle_anim.c b/src/battle_anim.c index 5e62c0957..c3fa2e2aa 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1656,7 +1656,7 @@ static void ScriptCmd_createsprite(void) else argVar *= -1; - subpriority = sub_80A82E4(gBattleAnimTarget) + (s8)(argVar); + subpriority = GetBattlerSubpriority(gBattleAnimTarget) + (s8)(argVar); } else { @@ -1665,7 +1665,7 @@ static void ScriptCmd_createsprite(void) else argVar *= -1; - subpriority = sub_80A82E4(gBattleAnimAttacker) + (s8)(argVar); + subpriority = GetBattlerSubpriority(gBattleAnimAttacker) + (s8)(argVar); } if (subpriority < 3) diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c index 9adbdd779..c4cf1600b 100644 --- a/src/battle_anim_80A5C6C.c +++ b/src/battle_anim_80A5C6C.c @@ -47,7 +47,7 @@ void sub_80A7AFC(u8 taskId); void sub_80A8CAC(u8 taskId); void AnimTask_BlendMonInAndOutStep(u8 taskId); bool8 sub_80A7238(void); -u8 sub_80A82E4(u8 battlerId); +u8 GetBattlerSubpriority(u8 battlerId); void sub_80A8D78(struct Task *task, u8 taskId); // EWRAM vars @@ -1968,13 +1968,13 @@ void sub_80A8278(void) { if (IsBattlerSpriteVisible(i)) { - gSprites[gBattlerSpriteIds[i]].subpriority = sub_80A82E4(i); + gSprites[gBattlerSpriteIds[i]].subpriority = GetBattlerSubpriority(i); gSprites[gBattlerSpriteIds[i]].oam.priority = 2; } } } -u8 sub_80A82E4(u8 battlerId) +u8 GetBattlerSubpriority(u8 battlerId) { u8 position; u8 ret; @@ -2339,7 +2339,7 @@ void sub_80A8BC4(u8 taskId) dest = (task->data[4] + 0x10) * 0x10; src = (gSprites[task->data[0]].oam.paletteNum + 0x10) * 0x10; - task->data[6] = sub_80A82E4(gBattleAnimAttacker); + task->data[6] = GetBattlerSubpriority(gBattleAnimAttacker); if (task->data[6] == 20 || task->data[6] == 40) task->data[6] = 2; else diff --git a/src/battle_anim_8170478.c b/src/battle_anim_8170478.c index 94f2c95b5..a570e1bfa 100755 --- a/src/battle_anim_8170478.c +++ b/src/battle_anim_8170478.c @@ -756,7 +756,7 @@ void sub_8170F2C(u8 taskId) } ballId = ItemIdToBallId(gLastUsedItem); - subpriority = sub_80A82E4(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) + 1; + subpriority = GetBattlerSubpriority(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) + 1; spriteId = CreateSprite(&gBallSpriteTemplates[ballId], x + 32, y | 80, subpriority); gSprites[spriteId].data[0] = 34; gSprites[spriteId].data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 0); diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 0f56c05d8..78e0608e1 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -2257,9 +2257,9 @@ static void sub_80FE9E4(struct Sprite* sprite) else { if (sprite->data[5] > 0x7F) - sprite->subpriority = sub_80A82E4(gBattleAnimTarget) + 1; + sprite->subpriority = GetBattlerSubpriority(gBattleAnimTarget) + 1; else - sprite->subpriority = sub_80A82E4(gBattleAnimTarget) + 6; + sprite->subpriority = GetBattlerSubpriority(gBattleAnimTarget) + 6; sprite->pos2.x += Sin(sprite->data[5], 5); sprite->pos2.y += Cos(sprite->data[5], 14); @@ -2278,7 +2278,7 @@ void sub_80FEA58(u8 taskId) gBattleAnimArgs[1] = 0; gBattleAnimArgs[2] = 80; gBattleAnimArgs[3] = 0; - CreateSpriteAndAnimate(&gUnknown_08592210, 0, 0, sub_80A82E4(gBattleAnimTarget) + 1); + CreateSpriteAndAnimate(&gUnknown_08592210, 0, 0, GetBattlerSubpriority(gBattleAnimTarget) + 1); } if (gTasks[taskId].data[1] == 15) @@ -2465,9 +2465,9 @@ static void sub_80FEECC(struct Sprite* sprite) sprite->pos2.x += Sin(sprite->data[5], 32); sprite->pos2.y += Cos(sprite->data[5], -5); if ((u16)(sprite->data[5] - 0x40) < 0x80) - sprite->subpriority = sub_80A82E4(gBattleAnimAttacker) - 1; + sprite->subpriority = GetBattlerSubpriority(gBattleAnimAttacker) - 1; else - sprite->subpriority = sub_80A82E4(gBattleAnimAttacker) + 1; + sprite->subpriority = GetBattlerSubpriority(gBattleAnimAttacker) + 1; sprite->data[5] = (sprite->data[5] + 5) & 0xFF; } @@ -3205,7 +3205,7 @@ void sub_80FFFC0(u8 taskId) { struct Task *task = &gTasks[taskId]; - task->data[4] = sub_80A82E4(gBattleAnimTarget) - 1; + task->data[4] = GetBattlerSubpriority(gBattleAnimTarget) - 1; task->data[6] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); task->data[7] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); task->data[10] = sub_80A861C(gBattleAnimTarget, 1); diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 8cbc62aab..32a9e926a 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -1136,7 +1136,7 @@ static void LinkOpponentHandleLoadMonSprite(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; @@ -1170,7 +1170,7 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) &gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; @@ -1302,7 +1302,7 @@ static void LinkOpponentHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 0cd15f39e..e4cc0ac34 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -1024,7 +1024,7 @@ static void LinkPartnerHandleLoadMonSprite(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; @@ -1055,7 +1055,7 @@ static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit) &gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; @@ -1143,7 +1143,7 @@ static void LinkPartnerHandleDrawTrainerPic(void) DecompressTrainerBackPic(trainerPicId, gActiveBattler); SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index c057e8575..516e7192a 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1128,7 +1128,7 @@ static void OpponentHandleLoadMonSprite(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; @@ -1163,7 +1163,7 @@ static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit) gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1293,7 +1293,7 @@ static void OpponentHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 2bd5ef365..e0e618918 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -2200,7 +2200,7 @@ static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit) &gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; @@ -2314,7 +2314,7 @@ static void PlayerHandleDrawTrainerPic(void) trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); DecompressTrainerFrontPic(trainerPicId, gActiveBattler); SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; @@ -2329,7 +2329,7 @@ static void PlayerHandleDrawTrainerPic(void) { DecompressTrainerBackPic(trainerPicId, gActiveBattler); SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 02dd1383b..2e8a4a079 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -1211,7 +1211,7 @@ static void PlayerPartnerHandleLoadMonSprite(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; @@ -1242,7 +1242,7 @@ static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit) &gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; @@ -1322,7 +1322,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void) { DecompressTrainerBackPic(trainerPicId, gActiveBattler); SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; @@ -1333,7 +1333,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void) { DecompressTrainerFrontPic(trainerPicId, gActiveBattler); SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 0cf3634dc..52c147c1f 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1119,7 +1119,7 @@ static void RecordedOpponentHandleLoadMonSprite(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); @@ -1154,7 +1154,7 @@ static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit) gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; @@ -1251,7 +1251,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 4d7fdc01e..b11be2e47 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1105,7 +1105,7 @@ static void RecordedPlayerHandleLoadMonSprite(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), - sub_80A82E4(gActiveBattler)); + GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; @@ -1136,7 +1136,7 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit) &gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; @@ -1236,7 +1236,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void) trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); DecompressTrainerFrontPic(trainerPicId, gActiveBattler); SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; @@ -1250,7 +1250,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void) { DecompressTrainerBackPic(trainerPicId, gActiveBattler); SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 5d87c4f90..2d5eb69fd 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -1464,7 +1464,7 @@ static void sub_816AA80(u8 battlerId) gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), - sub_80A82E4(battlerId)); + GetBattlerSubpriority(battlerId)); gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; diff --git a/src/contest.c b/src/contest.c index 0c4397f30..201a7472e 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2520,7 +2520,7 @@ u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index) spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, GetBattlerSpriteFinal_Y(2, species, FALSE), 30); gSprites[spriteId].oam.paletteNum = 2; gSprites[spriteId].oam.priority = 2; - gSprites[spriteId].subpriority = sub_80A82E4(2); + gSprites[spriteId].subpriority = GetBattlerSubpriority(2); gSprites[spriteId].callback = SpriteCallbackDummy; gSprites[spriteId].data[0] = gSprites[spriteId].oam.paletteNum; gSprites[spriteId].data[2] = species; diff --git a/src/electric.c b/src/electric.c index 5d65915b2..4a0c5525e 100644 --- a/src/electric.c +++ b/src/electric.c @@ -1,24 +1,44 @@ #include "global.h" #include "battle_anim.h" #include "constants/rgb.h" +#include "trig.h" +#include "constants/songs.h" +#include "sound.h" -extern void sub_810A1A8(struct Sprite *); -extern void sub_810A214(struct Sprite *); -extern void sub_810A274(struct Sprite *); -extern void sub_810A308(struct Sprite *); +extern void sub_80A62EC(struct Sprite *); +extern void sub_810E2C8(struct Sprite *); +extern bool8 sub_810B614(struct Task *task, u8 taskId); extern void TranslateAnimSpriteToTargetMonLocation(struct Sprite *); -extern void sub_810A46C(struct Sprite *); -extern void sub_810A5BC(struct Sprite *); -extern void sub_810A628(struct Sprite *); -extern void sub_810A75C(struct Sprite *); -extern void sub_810A9DC(struct Sprite *); -extern void sub_810AA2C(struct Sprite *); -extern void sub_810ACD8(struct Sprite *); -extern void sub_810AD30(struct Sprite *); -extern void sub_810AD98(struct Sprite *); -extern void sub_810B1F0(struct Sprite *); -extern void sub_810B23C(struct Sprite *); -extern void sub_810B51C(struct Sprite *); + +static void sub_810A1A8(struct Sprite *); +static void sub_810A1F8(struct Sprite *); +static void sub_810A214(struct Sprite *); +static void sub_810A258(struct Sprite *); +static void sub_810A274(struct Sprite *); +static void sub_810A308(struct Sprite *); +static void sub_810A46C(struct Sprite *); +static void sub_810A4F4(struct Sprite *); +static void sub_810A56C(struct Sprite *); +static void sub_810A5BC(struct Sprite *); +static void sub_810A628(struct Sprite *); +static void sub_810A6EC(struct Sprite *); +static void sub_810A75C(struct Sprite *); +static void sub_810A834(u8 taskId); +static void sub_810A9DC(struct Sprite *); +static void sub_810AA2C(struct Sprite *); +static void sub_810AAB0(struct Sprite *); +static void sub_810AB78(u8 taskId); +static void sub_810AC8C(struct Sprite *); +static void sub_810ACC0(struct Sprite *); +static void sub_810ACD8(struct Sprite *); +static void sub_810AD30(struct Sprite *); +static void sub_810AD98(struct Sprite *); +static void sub_810ADF8(struct Sprite *); +static bool8 sub_810B154(struct Task *task, u8 taskId); +static void sub_810B1F0(struct Sprite *); +static void sub_810B23C(struct Sprite *); +static bool8 sub_810B430(struct Task *task, u8 taskId); +static void sub_810B51C(struct Sprite *); const union AnimCmd gUnknown_085956A4[] = { @@ -436,3 +456,1051 @@ const struct SpriteTemplate gUnknown_08595A30 = .affineAnims = gDummySpriteAffineAnimTable, .callback = sub_810B51C, }; + +static void sub_810A1A8(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + sprite->pos1.x -= gBattleAnimArgs[0]; + else + sprite->pos1.x += gBattleAnimArgs[0]; + + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->callback = sub_810A1F8; +} + +static void sub_810A1F8(struct Sprite *sprite) +{ + if (sprite->animEnded) + DestroyAnimSprite(sprite); +} + +static void sub_810A214(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + sprite->pos1.x -= gBattleAnimArgs[0]; + else + sprite->pos1.x += gBattleAnimArgs[0]; + + sprite->callback = sub_810A258; +} + +static void sub_810A258(struct Sprite *sprite) +{ + if (sprite->affineAnimEnded) + move_anim_8074EE0(sprite); +} + +static void sub_810A274(struct Sprite *sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->pos1.y -= gBattleAnimArgs[1]; + } + else + { + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + } + sprite->data[0] = 0; + sprite->data[1] = gBattleAnimArgs[2]; + sprite->data[2] = gBattleAnimArgs[3]; + sprite->data[3] = gBattleAnimArgs[4]; + StoreSpriteCallbackInData6(sprite, move_anim_8074EE0); + sprite->callback = sub_80A62EC; +} + +static void sub_810A308(struct Sprite *sprite) +{ + u8 slot; + u32 matrixNum; + s16 sineVal; + + switch (gBattleAnimArgs[4]) + { + case 0: + slot = gBattleAnimAttacker; + break; + case 1: + default: + slot = gBattleAnimTarget; + break; + case 2: + if (!IsBattlerSpriteVisible(gBattleAnimAttacker ^ 2)) + { + slot = gBattleAnimAttacker; + } + else + { + slot = gBattleAnimAttacker ^ 2; + } + break; + case 3: + if (IsBattlerSpriteVisible(gBattleAnimAttacker ^ 2)) + { + slot = gBattleAnimTarget ^ 2; + } + else + { + slot = gBattleAnimTarget; + } + break; + } + + if (gBattleAnimArgs[5] == 0) + { + sprite->pos1.x = GetBattlerSpriteCoord(slot, 0); + sprite->pos1.y = GetBattlerSpriteCoord(slot, 1); + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord(slot, 2); + sprite->pos1.y = GetBattlerSpriteCoord(slot, 3); + } + + sprite->pos2.x = (gSineTable[gBattleAnimArgs[0]] * gBattleAnimArgs[1]) >> 8; + sprite->pos2.y = (gSineTable[gBattleAnimArgs[0] + 64] * gBattleAnimArgs[1]) >> 8; + + if (gBattleAnimArgs[6] & 1) + { + sprite->oam.priority = sub_80A8328(slot) + 1; + } + + matrixNum = sprite->oam.matrixNum; + sineVal = gSineTable[gBattleAnimArgs[2]]; + + gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[gBattleAnimArgs[2] + 64]; + gOamMatrices[matrixNum].b = sineVal; + gOamMatrices[matrixNum].c = -sineVal; + + sprite->data[0] = gBattleAnimArgs[3]; + sprite->callback = sub_810E2C8; +} + +static void sub_810A46C(struct Sprite *sprite) +{ + InitAnimSpritePos(sprite, 1); + sprite->data[0] = gBattleAnimArgs[3]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + InitAnimLinearTranslation(sprite); + sprite->data[5] = gBattleAnimArgs[2]; + sprite->data[6] = gBattleAnimArgs[5]; + sprite->data[7] = gBattleAnimArgs[4]; + sprite->oam.tileNum += gBattleAnimArgs[6] * 4; + sprite->callback = sub_810A4F4; + sub_810A4F4(sprite); +} + +static void sub_810A4F4(struct Sprite *sprite) +{ + if (!TranslateAnimLinear(sprite)) + { + sprite->pos2.x += Sin(sprite->data[7], sprite->data[5]); + sprite->pos2.y += Cos(sprite->data[7], sprite->data[5]); + sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF; + if(!(sprite->data[7] % 3)) + sprite->invisible ^= 1; + } + else + DestroyAnimSprite(sprite); +} + +static void sub_810A56C(struct Sprite *sprite) +{ + if (--sprite->data[5] == -1) + { + sprite->invisible ^= 1; + sprite->data[5] = sprite->data[4]; + } + if (sprite->data[3]-- <= 0) + DestroyAnimSprite(sprite); +} + +static void sub_810A5BC(struct Sprite *sprite) +{ + if (IsContest() || GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[1]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[2]; + sprite->data[3] = gBattleAnimArgs[0]; + sprite->data[4] = gBattleAnimArgs[3]; + sprite->data[5] = gBattleAnimArgs[3]; + sprite->callback = sub_810A56C; +} + +static void sub_810A628(struct Sprite *sprite) +{ + u8 bank; + + sprite->data[0] = gBattleAnimArgs[3]; + if (gBattleAnimArgs[7] & 0x8000) + bank = gBattleAnimTarget; + else + bank = gBattleAnimAttacker; + + if (IsContest() || GetBattlerSide(bank) == B_SIDE_PLAYER) + gBattleAnimArgs[0] = -gBattleAnimArgs[0]; + + sprite->pos1.x = GetBattlerSpriteCoord(bank, 2) + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord(bank, 3) + gBattleAnimArgs[1]; + + sprite->data[4] = gBattleAnimArgs[7] & 0x7FFF; + sprite->data[5] = gBattleAnimArgs[2]; + sprite->data[6] = gBattleAnimArgs[5]; + sprite->data[7] = gBattleAnimArgs[4]; + + sprite->oam.tileNum += gBattleAnimArgs[6] * 4; + sprite->callback = sub_810A6EC; + sub_810A6EC(sprite); +} + +static void sub_810A6EC(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[7], sprite->data[5]); + sprite->pos2.y = Cos(sprite->data[7], sprite->data[5]); + + sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF; + if (sprite->data[7] % sprite->data[4] == 0) + sprite->invisible ^= 1; + + if (sprite->data[0]-- <= 0) + DestroyAnimSprite(sprite); +} + +static void sub_810A75C(struct Sprite *sprite) +{ + sub_80A6980(sprite, FALSE); + sprite->oam.tileNum += gBattleAnimArgs[3] * 4; + + if (gBattleAnimArgs[3] == 1) + sprite->oam.matrixNum = 8; + else if (gBattleAnimArgs[3] == 2) + sprite->oam.matrixNum = 16; + + sprite->data[0] = gBattleAnimArgs[2]; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +void sub_810A7DC(u8 taskId) +{ + gTasks[taskId].data[0] = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[0]; + gTasks[taskId].data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[1]; + gTasks[taskId].data[2] = gBattleAnimArgs[2]; + gTasks[taskId].func = sub_810A834; +} + +#ifdef NONMATCHING // couldn't get the proper tail merging in the "CreateSprite" switch cases.(ported from ruby) +static void sub_810A834(u8 taskId) +{ + u16 r8; + s16 r12; + s16 r2; + u8 spriteId = 0; + u8 r7 = 0; + u8 sp = gTasks[taskId].data[2]; + s16 r4 = gTasks[taskId].data[0]; + s16 r6 = gTasks[taskId].data[1]; + + if (!gTasks[taskId].data[2]) + { + r8 = 0; + r2 = 1; + r12 = 16; + } + else + { + r12 = 16; + r8 = 8; + r2 = 4; + } + + switch (gTasks[taskId].data[10]) + { + case 0: + r8 += r2 * 0; + spriteId = CreateSprite(&gUnknown_08595828, r4, r6 + (r12 * 1), 2); + r7++; + break; + case 2: + r8 += r2; + spriteId = CreateSprite(&gUnknown_08595828, r4, r6 + (r12 * 2), 2); + r7++; + break; + case 4: + r8 += r2 * 2; + spriteId = CreateSprite(&gUnknown_08595828, r4, r6 + (r12 * 3), 2); + r7++; + break; + case 6: + r8 += r2 * 3; + spriteId = CreateSprite(&gUnknown_08595828, r4, r6 + (r12 * 4), 2); + r7++; + break; + case 8: + spriteId = CreateSprite(&gUnknown_08595828, r4, r6 + (r12 * 5), 2); + r7++; + break; + case 10: + DestroyAnimVisualTask(taskId); + return; + } + + if (r7) + { + gSprites[spriteId].oam.tileNum += r8; + gSprites[spriteId].data[0] = sp; + gSprites[spriteId].callback(&gSprites[spriteId]); + } + + gTasks[taskId].data[10]++; +} +#else +NAKED +static void sub_810A834(u8 taskId) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x4\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ + movs r5, 0\n\ + movs r7, 0\n\ + ldr r1, =gTasks\n\ + lsls r0, 2\n\ + add r0, r9\n\ + lsls r0, 3\n\ + adds r0, r1\n\ + ldrb r2, [r0, 0xC]\n\ + str r2, [sp]\n\ + ldrh r4, [r0, 0x8]\n\ + ldrh r6, [r0, 0xA]\n\ + movs r3, 0xC\n\ + ldrsh r0, [r0, r3]\n\ + mov r10, r1\n\ + cmp r0, 0\n\ + bne _0810A878\n\ + movs r0, 0\n\ + mov r8, r0\n\ + movs r2, 0x1\n\ + movs r1, 0x10\n\ + mov r12, r1\n\ + b _0810A882\n\ + .pool\n\ +_0810A878:\n\ + movs r2, 0x10\n\ + mov r12, r2\n\ + movs r3, 0x8\n\ + mov r8, r3\n\ + movs r2, 0x4\n\ +_0810A882:\n\ + mov r0, r9\n\ + lsls r1, r0, 2\n\ + adds r0, r1, r0\n\ + lsls r0, 3\n\ + add r0, r10\n\ + movs r3, 0x1C\n\ + ldrsh r0, [r0, r3]\n\ + mov r10, r1\n\ + cmp r0, 0xA\n\ + bhi _0810A978\n\ + lsls r0, 2\n\ + ldr r1, =_0810A8A4\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_0810A8A4:\n\ + .4byte _0810A8D0\n\ + .4byte _0810A978\n\ + .4byte _0810A8E4\n\ + .4byte _0810A978\n\ + .4byte _0810A904\n\ + .4byte _0810A978\n\ + .4byte _0810A91A\n\ + .4byte _0810A978\n\ + .4byte _0810A93C\n\ + .4byte _0810A978\n\ + .4byte _0810A970\n\ +_0810A8D0:\n\ + ldr r0, =gUnknown_08595828\n\ + lsls r1, r4, 16\n\ + asrs r1, 16\n\ + lsls r2, r6, 16\n\ + asrs r2, 16\n\ + mov r4, r12\n\ + lsls r3, r4, 16\n\ + b _0810A952\n\ + .pool\n\ +_0810A8E4:\n\ + mov r0, r12\n\ + lsls r3, r0, 17\n\ + mov r1, r8\n\ + adds r0, r1, r2\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r8, r0\n\ + ldr r0, =gUnknown_08595828\n\ + lsls r1, r4, 16\n\ + asrs r1, 16\n\ + lsls r2, r6, 16\n\ + asrs r2, 16\n\ + b _0810A952\n\ + .pool\n\ +_0810A904:\n\ + mov r3, r12\n\ + lsls r0, r3, 16\n\ + asrs r0, 16\n\ + lsls r3, r0, 1\n\ + adds r3, r0\n\ + lsls r0, r2, 1\n\ + add r0, r8\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r8, r0\n\ + b _0810A946\n\ +_0810A91A:\n\ + mov r0, r12\n\ + lsls r3, r0, 18\n\ + lsls r0, r2, 1\n\ + adds r0, r2\n\ + add r0, r8\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r8, r0\n\ + ldr r0, =gUnknown_08595828\n\ + lsls r1, r4, 16\n\ + asrs r1, 16\n\ + lsls r2, r6, 16\n\ + asrs r2, 16\n\ + b _0810A952\n\ + .pool\n\ +_0810A93C:\n\ + mov r1, r12\n\ + lsls r0, r1, 16\n\ + asrs r0, 16\n\ + lsls r3, r0, 2\n\ + adds r3, r0\n\ +_0810A946:\n\ + ldr r0, =gUnknown_08595828\n\ + lsls r1, r4, 16\n\ + asrs r1, 16\n\ + lsls r2, r6, 16\n\ + asrs r2, 16\n\ + lsls r3, 16\n\ +_0810A952:\n\ + asrs r3, 16\n\ + adds r2, r3\n\ + lsls r2, 16\n\ + asrs r2, 16\n\ + movs r3, 0x2\n\ + bl CreateSprite\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + adds r0, r7, 0x1\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + b _0810A978\n\ + .pool\n\ +_0810A970:\n\ + mov r0, r9\n\ + bl DestroyAnimVisualTask\n\ + b _0810A9BC\n\ +_0810A978:\n\ + cmp r7, 0\n\ + beq _0810A9AC\n\ + ldr r4, =gSprites\n\ + lsls r3, r5, 4\n\ + adds r3, r5\n\ + lsls r3, 2\n\ + adds r0, r3, r4\n\ + ldrh r5, [r0, 0x4]\n\ + lsls r2, r5, 22\n\ + lsrs r2, 22\n\ + add r2, r8\n\ + ldr r6, =0x000003ff\n\ + adds r1, r6, 0\n\ + ands r2, r1\n\ + ldr r1, =0xfffffc00\n\ + ands r1, r5\n\ + orrs r1, r2\n\ + strh r1, [r0, 0x4]\n\ + mov r1, sp\n\ + ldrh r1, [r1]\n\ + strh r1, [r0, 0x2E]\n\ + adds r4, 0x1C\n\ + adds r3, r4\n\ + ldr r1, [r3]\n\ + bl _call_via_r1\n\ +_0810A9AC:\n\ + ldr r0, =gTasks\n\ + mov r1, r10\n\ + add r1, r9\n\ + lsls r1, 3\n\ + adds r1, r0\n\ + ldrh r0, [r1, 0x1C]\n\ + adds r0, 0x1\n\ + strh r0, [r1, 0x1C]\n\ +_0810A9BC:\n\ + add sp, 0x4\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + "); +} +#endif + +static void sub_810A9DC(struct Sprite *sprite) +{ + if (!sprite->data[0]) + { + sprite->oam.shape = 2; + sprite->oam.size = 0; + } + else + { + sprite->oam.shape = 0; + sprite->oam.size = 1; + } + if (++sprite->data[1] == 15) + DestroySprite(sprite); +} + +static void sub_810AA2C(struct Sprite *sprite) +{ + u8 spriteId; + + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + spriteId = CreateSprite(&gUnknown_08595840, sprite->pos1.x + 32, sprite->pos1.y, sprite->subpriority); + gSprites[spriteId].oam.tileNum += 8; + gAnimVisualTaskCount++; + gSprites[spriteId].callback = sub_810AAB0; + sprite->callback = sub_810AAB0; +} + +static void sub_810AAB0(struct Sprite *sprite) +{ + if (++sprite->data[0] == 3) + { + sprite->data[0] = 0; + sprite->invisible ^= 1; + } + + if (++sprite->data[1] == 51) + DestroyAnimSprite(sprite); +} + +void sub_810AAFC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + if (!gBattleAnimArgs[0]) + { + task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + task->data[15] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + } + else + { + task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + task->data[15] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + } + + task->data[6] = gBattleAnimArgs[1]; + task->data[7] = 0; + task->data[8] = 0; + task->data[9] = 0; + task->data[10] = 0; + task->data[11] = gBattleAnimArgs[3]; + task->data[12] = 0; + task->data[13] = gBattleAnimArgs[2]; + task->func = sub_810AB78; +} + +void sub_810AB78(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + if (task->data[6]) + { + if (++task->data[12] > task->data[13]) + { + u8 spriteId; + task->data[12] = 0; + spriteId = CreateSprite(&gUnknown_085958A8, task->data[14], task->data[15], 2); + if (spriteId != MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[spriteId]; + sprite->pos1.x += gUnknown_08595858[task->data[9]][0]; + sprite->pos1.y += gUnknown_08595858[task->data[9]][1]; + + sprite->data[0] = 40 - task->data[8] * 5; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = task->data[14]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = task->data[15]; + sprite->data[5] = taskId; + + InitAnimLinearTranslation(sprite); + StoreSpriteCallbackInData6(sprite, sub_810ACC0); + sprite->callback = sub_80A67D8; + + if (++task->data[9] > 15) + task->data[9] = 0; + + if (++task->data[10] >= task->data[11]) + { + task->data[10] = 0; + if (task->data[8] <= 5) + task->data[8]++; + } + + task->data[7]++; + task->data[6]--; + } + } + } + else if(task->data[7] == 0) + DestroyAnimVisualTask(taskId); +} + +static void sub_810AC8C(struct Sprite *sprite) +{ + if (TranslateAnimLinear(sprite)) + { + gTasks[sprite->data[5]].data[7]--; + DestroySprite(sprite); + } +} + +static void sub_810ACC0(struct Sprite *sprite) +{ + StartSpriteAnim(sprite, 1); + sprite->callback = sub_810AC8C; +} + +static void sub_810ACD8(struct Sprite *sprite) +{ + if (!gBattleAnimArgs[0]) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + } + + StoreSpriteCallbackInData6(sprite, move_anim_8074EE0); + sprite->callback = sub_80A67BC; +} + +static void sub_810AD30(struct Sprite *sprite) +{ + if (!gBattleAnimArgs[0]) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + } + + sprite->pos2.x = gBattleAnimArgs[1]; + sprite->pos2.y = gBattleAnimArgs[2]; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->callback = sub_80A67D8; +} + +static void sub_810AD98(struct Sprite *sprite) +{ + StartSpriteAffineAnim(sprite, 1); + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->data[6] = GetAnimBattlerSpriteId(0); + sprite->data[7] = 16; + + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) + sprite->data[7] *= -1; + + sprite->callback = sub_810ADF8; +} + +static void sub_810ADF8(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + if (++sprite->data[1] > 40) + sprite->data[0]++; + break; + case 1: + sprite->pos1.x += sprite->data[7]; + gSprites[sprite->data[6]].pos2.x += sprite->data[7]; + if ((u16)(sprite->pos1.x + 80) > 400) + move_anim_8074EE0(sprite); + } +} + +void sub_810AE5C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + task->data[15] = GetAnimBattlerSpriteId(0); + task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + { + task->data[14] = -32; + task->data[13] = 2; + } + else + { + task->data[14] = 32; + task->data[13] = -2; + } + + gSprites[task->data[15]].pos2.x = task->data[14]; + task->data[0]++; + break; + case 1: + if (++task->data[1] > 1) + { + task->data[1] = 0; + gSprites[task->data[15]].invisible ^= 1; + + if (task->data[14]) + { + task->data[14] += task->data[13]; + gSprites[task->data[15]].pos2.x = task->data[14]; + } + else + task->data[0]++; + + } + break; + case 2: + if (++task->data[1] > 1) + { + task->data[1] = 0; + gSprites[task->data[15]].invisible ^= 1; + + if (++task->data[2] == 8) + task->data[0]++; + } + break; + case 3: + gSprites[task->data[15]].invisible = 0; + DestroyAnimVisualTask(taskId); + } +} + +void sub_810AFCC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch(task->data[0]) + { + case 0: + task->data[1] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1; + + switch (gBattleAnimArgs[0]) + { + case 0: + task->data[3] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + task->data[5] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + task->data[4] = (task->data[1] * 128) + 120; + break; + case 4: + task->data[3] = 120 - (task->data[1] * 128); + task->data[5] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + task->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) - (task->data[1] * 32); + break; + default: + if ((gBattleAnimArgs[0] & 1) != 0) + { + task->data[3] = 256; + task->data[4] = -16; + } + else + { + task->data[3] = -16; + task->data[4] = 256; + } + + if (task->data[1] == 1) + { + task->data[5] = 80 - gBattleAnimArgs[0] * 10; + } + else + { + u16 temp; + task->data[5] = gBattleAnimArgs[0] * 10 + 40; + temp = task->data[3]; + task->data[3] = task->data[4]; + task->data[4] = temp; + } + } + + if (task->data[3] < task->data[4]) + { + task->data[1] = 1; + task->data[6] = 0; + } + else + { + task->data[1] = -1; + task->data[6] = 3; + } + + task->data[0]++; + break; + case 1: + if (++task->data[2] > 0) + { + task->data[2] = 0; + if (sub_810B154(task, taskId) || sub_810B154(task, taskId)) + task->data[0]++; + } + break; + case 2: + if (task->data[7] == 0) + DestroyAnimVisualTask(taskId); + } +} + +static bool8 sub_810B154(struct Task *task, u8 taskId) +{ + u8 spriteId = CreateSprite(&gUnknown_08595A00, task->data[3], task->data[5], 35); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].data[6] = taskId; + gSprites[spriteId].data[7] = 7; + task->data[7]++; + } + + task->data[6] += task->data[1]; + if (task->data[6] < 0) + task->data[6] = 3; + + if (task->data[6] > 3) + task->data[6] = 0; + + task->data[3] += task->data[1] * 16; + + if ((task->data[1] == 1 && task->data[3] >= task->data[4]) + || (task->data[1] == -1 && task->data[3] <= task->data[4])) + { + return TRUE; + } + else + { + return FALSE; + } +} + +static void sub_810B1F0(struct Sprite *sprite) +{ + if (++sprite->data[0] > 12) + { + gTasks[sprite->data[6]].data[sprite->data[7]]--; + FreeOamMatrix(sprite->oam.matrixNum); + DestroySprite(sprite); + } +} + +static void sub_810B23C(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + StartSpriteAffineAnim(sprite, 2); + sprite->data[0]++; + break; + case 1: + if (sprite->affineAnimEnded) + move_anim_8074EE0(sprite); + } +} + +void sub_810B29C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + task->data[6] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + task->data[7] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + task->data[8] = 4; + task->data[10] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + task->data[9] = (task->data[10] - task->data[6]) / 5; + task->data[4] = 7; + task->data[5] = -1; + task->data[11] = 12; + task->data[12] = BattleAnimAdjustPanning(task->data[11] - 76); + task->data[13] = BattleAnimAdjustPanning(SOUND_PAN_TARGET); + task->data[14] = task->data[12]; + task->data[15] = (task->data[13] - task->data[12]) / 3; + task->data[0]++; + break; + case 1: + if (++task->data[1] > 0) + { + task->data[1] = 0; + if (sub_810B430(task, taskId)) + { + if (task->data[2] == 5) + task->data[0] = 3; + else + task->data[0]++; + } + } + + if (task->data[11]) + task->data[11]--; + break; + case 2: + if (task->data[11]) + task->data[11]--; + + if (++task->data[1] > 4) + { + task->data[1] = 0; + if (task->data[2] & 1) + { + task->data[7] = 4; + task->data[8] = 68; + task->data[4] = 0; + task->data[5] = 1; + } + else + { + task->data[7] = 68; + task->data[8] = 4; + task->data[4] = 7; + task->data[5] = -1; + } + + if (task->data[11]) + task->data[0] = 4; + else + task->data[0] = 1; + } + break; + case 3: + if (task->data[3] == 0) + DestroyAnimVisualTask(taskId); + break; + case 4: + if (task->data[11]) + task->data[11]--; + else + task->data[0] = 1; + break; + } +} + +static bool8 sub_810B430(struct Task *task, u8 taskId) +{ + u8 spriteId = CreateSprite(&gUnknown_08595A30, task->data[6], task->data[7], 35); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].oam.tileNum += task->data[4]; + task->data[4] += task->data[5]; + if (task->data[4] < 0) + task->data[4] = 7; + if (task->data[4] > 7) + task->data[4] = 0; + + gSprites[spriteId].data[6] = taskId; + gSprites[spriteId].data[7] = 3; + task->data[3]++; + } + + if (task->data[4] == 0 && task->data[5] > 0) + { + task->data[14] += task->data[15]; + PlaySE12WithPanning(SE_W085, task->data[14]); + } + + if ((task->data[5] < 0 && task->data[7] <= task->data[8]) + || (task->data[5] > 0 && task->data[7] >= task->data[8])) + { + task->data[2]++; + task->data[6] += task->data[9]; + return TRUE; + } + else + { + task->data[7] += task->data[5] * 8; + return FALSE; + } +} + +static void sub_810B51C(struct Sprite *sprite) +{ + if (++sprite->data[0] > 12) + { + gTasks[sprite->data[6]].data[sprite->data[7]]--; + DestroySprite(sprite); + } +} + +void sub_810B55C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + task->data[15] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 32; + task->data[14] = task->data[15]; + while (task->data[14] > 16) + { + task->data[14] -= 32; + } + + task->data[13] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + task->data[12] = GetBattlerSubpriority(gBattleAnimTarget) - 2; + task->data[0]++; + break; + case 1: + if (++task->data[1] > 1) + { + task->data[1] = 0; + if (sub_810B614(task, taskId)) + task->data[0]++; + } + break; + case 2: + if (task->data[10] == 0) + DestroyAnimVisualTask(taskId); + break; + } +} diff --git a/src/ghost.c b/src/ghost.c index 0464d1491..3135004da 100644 --- a/src/ghost.c +++ b/src/ghost.c @@ -1171,7 +1171,7 @@ void sub_8112C6C(u8 taskId) task->data[11] = (sub_80A861C(gBattleAnimAttacker, 1) / 2) + 8; task->data[7] = 0; task->data[5] = sub_80A8328(gBattleAnimAttacker); - task->data[6] = sub_80A82E4(gBattleAnimAttacker) - 2; + task->data[6] = GetBattlerSubpriority(gBattleAnimAttacker) - 2; task->data[3] = 0; task->data[4] = 16; SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 7f2eb3746..1a5221616 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -226,7 +226,7 @@ static void CreateBattlerSprite(u8 battler) return; SetMultiuseSpriteTemplateToPokemon(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler)); - gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler)); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, GetBattlerSubpriority(battler)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; gSprites[gBattlerSpriteIds[battler]].data[0] = battler; @@ -241,7 +241,7 @@ static void CreateBattlerSprite(u8 battler) SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT)); gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50, (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80, - sub_80A82E4(0)); + GetBattlerSubpriority(0)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; gSprites[gBattlerSpriteIds[battler]].data[0] = battler; @@ -251,7 +251,7 @@ static void CreateBattlerSprite(u8 battler) SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(0)); gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50, (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords) * 4 + 80, - sub_80A82E4(0)); + GetBattlerSubpriority(0)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; gSprites[gBattlerSpriteIds[battler]].data[0] = battler; @@ -262,7 +262,7 @@ static void CreateBattlerSprite(u8 battler) return; SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler)); - gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler)); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, GetBattlerSubpriority(battler)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; gSprites[gBattlerSpriteIds[battler]].data[0] = battler;