diff --git a/asm/psychic.s b/asm/psychic.s deleted file mode 100644 index 1eb21f53c..000000000 --- a/asm/psychic.s +++ /dev/null @@ -1,2172 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_810F1EC -sub_810F1EC: @ 810F1EC - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - bl IsContest - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810F212 - mov r0, r8 - cmp r0, 0 - beq _0810F22E -_0810F212: - ldrb r1, [r5, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r5, 0x5] - adds r1, r5, 0 - adds r1, 0x43 - movs r0, 0xC8 - strb r0, [r1] - mov r1, r8 - cmp r1, 0 - bne _0810F2B8 -_0810F22E: - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r4, r0, 24 - adds r7, r4, 0 - adds r0, r4, 0 - bl GetBattlerSpriteBGPriorityRank - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - eors r0, r1 - negs r1, r0 - orrs r1, r0 - lsrs r6, r1, 31 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F264 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0 - bl MoveBattlerSpriteToBG -_0810F264: - movs r0, 0x2 - adds r4, r0, 0 - eors r4, r7 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F284 - movs r0, 0x1 - eors r6, r0 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0 - bl MoveBattlerSpriteToBG -_0810F284: - mov r0, r8 - cmp r0, 0 - bne _0810F2B8 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0810F2B8 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810F2B0 - movs r0, 0x48 - strh r0, [r5, 0x20] - movs r0, 0x50 - b _0810F2F2 - .pool -_0810F2B0: - movs r0, 0xB0 - strh r0, [r5, 0x20] - movs r0, 0x28 - b _0810F2F2 -_0810F2B8: - ldr r6, =gBattleAnimAttacker - ldrb r0, [r6] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810F2CE - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - negs r0, r0 - strh r0, [r1] -_0810F2CE: - ldrb r0, [r6] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r4] - adds r0, r1 - strh r0, [r5, 0x20] - ldrb r0, [r6] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r4, [r4, 0x2] - adds r0, r4 -_0810F2F2: - strh r0, [r5, 0x22] - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x4] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - strh r0, [r5, 0x2E] - mov r0, r8 - cmp r0, 0 - beq _0810F32C - ldrh r0, [r5, 0x22] - adds r0, 0x9 - strh r0, [r5, 0x22] - ldr r1, =sub_810F3C8 - str r1, [r5, 0x1C] - adds r0, r5, 0 - bl _call_via_r1 - b _0810F330 - .pool -_0810F32C: - ldr r0, =sub_810F340 - str r0, [r5, 0x1C] -_0810F330: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F1EC -@ - - thumb_func_start sub_810F340 -sub_810F340: @ 810F340 - push {r4,r5,lr} - adds r5, r0, 0 - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r4, r0, 24 - movs r1, 0x3C - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0810F35C - movs r0, 0x1 - strh r0, [r5, 0x3C] - b _0810F3B6 -_0810F35C: - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F382 - ldr r2, =gSprites - ldr r0, =gBattlerSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_0810F382: - movs r0, 0x2 - eors r4, r0 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F3AC - ldr r2, =gSprites - ldr r0, =gBattlerSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_0810F3AC: - ldr r1, =sub_810F3C8 - str r1, [r5, 0x1C] - adds r0, r5, 0 - bl _call_via_r1 -_0810F3B6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F340 - - thumb_func_start sub_810F3C8 -sub_810F3C8: @ 810F3C8 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x34] - movs r1, 0x10 - subs r1, r0 - lsls r1, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldrh r1, [r4, 0x34] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0xD - bne _0810F3F4 - ldr r0, =sub_810F400 - str r0, [r4, 0x1C] - b _0810F3F8 - .pool -_0810F3F4: - adds r0, r1, 0x1 - strh r0, [r4, 0x34] -_0810F3F8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810F3C8 - - thumb_func_start sub_810F400 -sub_810F400: @ 810F400 - push {r4-r7,lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x30] - adds r0, 0x1 - strh r0, [r3, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - bne _0810F45E - movs r0, 0 - strh r0, [r3, 0x30] - ldrh r4, [r3, 0x2E] - ldr r1, =gPlttBufferFaded - adds r0, r4, 0 - adds r0, 0x8 - lsls r0, 1 - adds r0, r1 - ldrh r7, [r0] - movs r5, 0x8 - adds r6, r1, 0 - adds r1, r4, 0x7 - lsls r0, r4, 1 - adds r0, r6 - adds r2, r0, 0 - adds r2, 0x10 - lsls r1, 1 - adds r1, r6 -_0810F436: - ldrh r0, [r1] - strh r0, [r2] - subs r1, 0x2 - subs r2, 0x2 - subs r5, 0x1 - cmp r5, 0 - bgt _0810F436 - adds r0, r4, 0x1 - lsls r0, 1 - adds r0, r6 - strh r7, [r0] - ldrh r0, [r3, 0x32] - adds r0, 0x1 - strh r0, [r3, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - bne _0810F45E - ldr r0, =sub_810F46C - str r0, [r3, 0x1C] -_0810F45E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F400 - - thumb_func_start sub_810F46C -sub_810F46C: @ 810F46C - push {r4-r6,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x34] - movs r1, 0x10 - subs r1, r0 - lsls r1, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldrh r0, [r5, 0x34] - subs r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _0810F512 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0810F502 - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F4D4 - ldr r2, =gSprites - ldr r0, =gBattlerSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] -_0810F4D4: - movs r0, 0x2 - adds r4, r0, 0 - eors r4, r6 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F502 - ldr r2, =gSprites - ldr r0, =gBattlerSpriteIds - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] -_0810F502: - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_810F524 - str r0, [r5, 0x1C] -_0810F512: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F46C - - thumb_func_start sub_810F524 -sub_810F524: @ 810F524 - push {r4-r6,lr} - adds r6, r0, 0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0810F57C - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - bl GetBattlerSpriteBGPriorityRank - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - eors r0, r1 - negs r1, r0 - orrs r1, r0 - lsrs r5, r1, 31 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F562 - adds r0, r5, 0 - bl sub_80A477C -_0810F562: - movs r0, 0x2 - eors r4, r0 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _0810F57C - movs r0, 0x1 - eors r5, r0 - adds r0, r5, 0 - bl sub_80A477C -_0810F57C: - ldr r0, =DestroyAnimSprite - str r0, [r6, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F524 - - thumb_func_start sub_810F58C -sub_810F58C: @ 810F58C - push {r4-r6,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0810F618 - ldr r5, =gBattleAnimArgs - movs r1, 0x6 - ldrsh r0, [r5, r1] - movs r6, 0 - cmp r0, 0 - bne _0810F5A6 - movs r6, 0x1 -_0810F5A6: - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0810F5EE - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _0810F5EE - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810F5E0 - ldrh r0, [r5] - movs r1, 0x48 - subs r1, r0 - strh r1, [r4, 0x20] - ldrh r0, [r5, 0x2] - adds r0, 0x50 - strh r0, [r4, 0x22] - b _0810F610 - .pool -_0810F5E0: - ldrh r0, [r5] - adds r0, 0xB0 - strh r0, [r4, 0x20] - ldrh r0, [r5, 0x2] - adds r0, 0x28 - strh r0, [r4, 0x22] - b _0810F610 -_0810F5EE: - ldr r0, =gBattleAnimArgs - movs r1, 0x4 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _0810F608 - adds r0, r4, 0 - adds r1, r6, 0 - bl InitSpritePosToAnimAttacker - b _0810F610 - .pool -_0810F608: - adds r0, r4, 0 - adds r1, r6, 0 - bl InitSpritePosToAnimTarget -_0810F610: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _0810F62C -_0810F618: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0 - beq _0810F62C - adds r0, r4, 0 - bl DestroySpriteAndMatrix -_0810F62C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_810F58C - - thumb_func_start sub_810F634 -sub_810F634: @ 810F634 - push {r4,r5,lr} - adds r5, r0, 0 - 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] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810F684 - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim - ldrh r0, [r5, 0x20] - subs r0, 0x28 - strh r0, [r5, 0x20] - ldrh r0, [r5, 0x22] - adds r0, 0xA - strh r0, [r5, 0x22] - ldr r0, =0x0000ffff - b _0810F692 - .pool -_0810F684: - ldrh r0, [r5, 0x20] - adds r0, 0x28 - strh r0, [r5, 0x20] - ldrh r0, [r5, 0x22] - subs r0, 0xA - strh r0, [r5, 0x22] - movs r0, 0x1 -_0810F692: - strh r0, [r5, 0x30] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =RunStoredCallbackWhenAnimEnds - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F634 - - thumb_func_start sub_810F6B0 -sub_810F6B0: @ 810F6B0 - push {r4-r7,lr} - adds r5, r0, 0 - ldr r6, =gBattleAnimAttacker - ldrb r0, [r6] - movs r1, 0x1 - bl sub_80A861C - lsls r0, 16 - asrs r1, r0, 16 - lsrs r0, 31 - adds r1, r0 - lsls r1, 15 - lsrs r4, r1, 16 - ldrb r0, [r6] - movs r1, 0 - bl sub_80A861C - lsls r0, 16 - asrs r1, r0, 16 - lsrs r0, 31 - adds r1, r0 - asrs r1, 1 - negs r1, r1 - lsls r1, 16 - lsrs r7, r1, 16 - ldrb r0, [r6] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0810F6F6 - lsls r0, r4, 16 - negs r0, r0 - lsrs r4, r0, 16 -_0810F6F6: - ldrb r0, [r6] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - strh r0, [r5, 0x20] - ldrb r0, [r6] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, r7 - strh r0, [r5, 0x22] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xF - bgt _0810F722 - movs r0, 0x10 - strh r0, [r5, 0x22] -_0810F722: - ldr r1, =sub_810F740 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =RunStoredCallbackWhenAnimEnds - str r0, [r5, 0x1C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F6B0 - - thumb_func_start sub_810F740 -sub_810F740: @ 810F740 - push {r4,lr} - adds r4, r0, 0 - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r4, 0x1] - ldr r0, =gUnknown_08596740 - str r0, [r4, 0x10] - movs r0, 0 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl InitSpriteAffineAnim - ldr r0, =sub_810F774 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F740 - - thumb_func_start sub_810F774 -sub_810F774: @ 810F774 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0810F786 - cmp r0, 0x1 - beq _0810F7B4 - b _0810F7CC -_0810F786: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0810F7CC - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x1] - movs r0, 0x12 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _0810F7CC -_0810F7B4: - ldrh r0, [r4, 0x30] - subs r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _0810F7CC - adds r0, r4, 0 - bl DestroyAnimSprite -_0810F7CC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F774 - - thumb_func_start sub_810F7D4 -sub_810F7D4: @ 810F7D4 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - movs r0, 0 - bl GetAnimBattlerSpriteId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - strh r1, [r4, 0x8] - ldr r2, =gUnknown_0859675C - adds r0, r4, 0 - bl PrepareAffineAnimInTaskData - ldr r0, =sub_810F810 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F7D4 - - thumb_func_start sub_810F810 -sub_810F810: @ 810F810 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r0, r1 - bl RunAffineAnimFromTaskData - lsls r0, 24 - cmp r0, 0 - bne _0810F830 - adds r0, r4, 0 - bl DestroyAnimVisualTask -_0810F830: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F810 - - thumb_func_start sub_810F83C -sub_810F83C: @ 810F83C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - movs r0, 0 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - strh r0, [r4, 0x8] - strh r1, [r4, 0xA] - strh r1, [r4, 0xC] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - movs r1, 0x8 - cmp r0, 0 - beq _0810F870 - movs r1, 0x4 -_0810F870: - strh r1, [r4, 0xE] - ldrb r1, [r4, 0x8] - ldr r2, =gUnknown_0859677C - adds r0, r4, 0 - bl PrepareAffineAnimInTaskData - ldr r0, =sub_810F898 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F83C - - thumb_func_start sub_810F898 -sub_810F898: @ 810F898 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0810F8BC - cmp r0, 0x1 - beq _0810F8D8 - b _0810F936 - .pool -_0810F8BC: - adds r0, r4, 0 - bl RunAffineAnimFromTaskData - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0810F936 - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - b _0810F936 -_0810F8D8: - movs r1, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0810F900 - ldr r2, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - subs r1, 0x8 - strh r1, [r0, 0x26] - ldrh r0, [r4, 0xE] - subs r0, 0x1 - strh r0, [r4, 0xE] - b _0810F936 - .pool -_0810F900: - ldr r3, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0x88 - lsls r1, 1 - strh r1, [r0, 0x20] - ldrb r0, [r4, 0x8] - bl ResetSpriteRotScale - adds r0, r5, 0 - bl DestroyAnimVisualTask -_0810F936: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F898 - - thumb_func_start sub_810F940 -sub_810F940: @ 810F940 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r5, r1, r0 - movs r1, 0 - movs r0, 0x10 - strh r0, [r5, 0xE] - strh r1, [r5, 0x10] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x24] - ldrb r0, [r4] - movs r1, 0x1 - bl sub_80A861C - lsls r0, 16 - asrs r0, 16 - movs r1, 0x3 - bl __divsi3 - lsls r0, 16 - lsrs r6, r0, 16 - ldrb r0, [r4] - movs r1, 0 - bl sub_80A861C - lsls r0, 16 - asrs r0, 16 - movs r1, 0x3 - bl __divsi3 - lsls r0, 16 - lsrs r0, 16 - adds r1, r0, 0 - cmp r0, r6 - bcs _0810F9AA - adds r1, r6, 0 -_0810F9AA: - strh r1, [r5, 0x20] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0x10 - bl SetGpuReg - ldr r0, =sub_810F9D4 - str r0, [r5] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810F940 - - thumb_func_start sub_810F9D4 -sub_810F9D4: @ 810F9D4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r0, 0x8 - ldrsh r1, [r4, r0] - cmp r1, 0x1 - beq _0810FAD4 - cmp r1, 0x1 - bgt _0810F9FC - cmp r1, 0 - beq _0810FA0A - b _0810FB5A - .pool -_0810F9FC: - cmp r1, 0x2 - bne _0810FA02 - b _0810FB36 -_0810FA02: - cmp r1, 0x3 - bne _0810FA08 - b _0810FB44 -_0810FA08: - b _0810FB5A -_0810FA0A: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - bgt _0810FA1A - b _0810FB5A -_0810FA1A: - strh r1, [r4, 0xA] - ldr r0, =gUnknown_08596794 - movs r2, 0x22 - ldrsh r1, [r4, r2] - movs r3, 0x24 - ldrsh r2, [r4, r3] - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - movs r0, 0xC - ldrsh r1, [r4, r0] - adds r1, 0x8 - lsls r1, 1 - adds r0, r4, 0 - adds r0, 0x8 - adds r0, r1 - strh r2, [r0] - cmp r2, 0x40 - beq _0810FABE - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0810FA78 - cmp r0, 0x1 - bgt _0810FA5C - cmp r0, 0 - beq _0810FA66 - b _0810FABE - .pool -_0810FA5C: - cmp r0, 0x2 - beq _0810FA90 - cmp r0, 0x3 - beq _0810FAA8 - b _0810FABE -_0810FA66: - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r4, 0x20] - b _0810FAB6 - .pool -_0810FA78: - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r4, 0x20] - negs r0, r0 - strh r0, [r1, 0x24] - ldrh r0, [r4, 0x20] - b _0810FABC - .pool -_0810FA90: - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r4, 0x20] - strh r1, [r0, 0x24] - ldrh r1, [r4, 0x20] - strh r1, [r0, 0x26] - b _0810FABE - .pool -_0810FAA8: - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r4, 0x20] - negs r0, r0 -_0810FAB6: - strh r0, [r1, 0x24] - ldrh r0, [r4, 0x20] - negs r0, r0 -_0810FABC: - strh r0, [r1, 0x26] -_0810FABE: - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _0810FB5A - b _0810FB36 - .pool -_0810FAD4: - ldrh r0, [r4, 0xA] - ands r1, r0 - cmp r1, 0 - beq _0810FAE4 - ldrh r0, [r4, 0xE] - subs r0, 0x1 - strh r0, [r4, 0xE] - b _0810FAEA -_0810FAE4: - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] -_0810FAEA: - ldrh r1, [r4, 0x10] - lsls r1, 8 - ldrh r0, [r4, 0xE] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x20 - bne _0810FB5A - movs r5, 0x8 - adds r6, r4, 0 - adds r6, 0x8 -_0810FB10: - lsls r0, r5, 1 - adds r1, r6, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0x40 - beq _0810FB2C - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite -_0810FB2C: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0xC - bls _0810FB10 -_0810FB36: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0810FB5A - .pool -_0810FB44: - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyAnimVisualTask -_0810FB5A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_810F9D4 - - - thumb_func_start sub_810FB60 -sub_810FB60: @ 810FB60 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x30 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - subs r0, 0xA - cmp r1, r0 - ble _0810FB8A - ldrh r0, [r4, 0x30] - movs r1, 0x1 - ands r1, r0 - adds r3, r4, 0 - adds r3, 0x3E - lsls r1, 2 - ldrb r2, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_0810FB8A: - movs r0, 0x30 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _0810FB9C - adds r0, r4, 0 - bl DestroyAnimSprite -_0810FB9C: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810FB60 - - thumb_func_start sub_810FBA8 -sub_810FBA8: @ 810FBA8 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r6, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0810FBD4 - 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] -_0810FBD4: - ldrh r0, [r6, 0x2] - strh r0, [r5, 0x2E] - ldr r0, =sub_810FB60 - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810FBA8 - - thumb_func_start sub_810FBF0 -sub_810FBF0: @ 810FBF0 - 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 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _0810FC94 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - bne _0810FC60 - ldr r0, =0x0000fff6 - strh r0, [r5, 0x1C] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x5 - bl sub_80A861C - subs r0, 0x8 - strh r0, [r5, 0x1E] - ldrb r0, [r4] - movs r1, 0x2 - bl sub_80A861C - adds r0, 0x8 - strh r0, [r5, 0x20] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x5 - bl sub_80A861C - subs r0, 0x8 - strh r0, [r5, 0x22] - ldrb r0, [r4] - movs r1, 0x2 - bl sub_80A861C - adds r0, 0x8 - b _0810FD1E - .pool -_0810FC60: - movs r0, 0xA - strh r0, [r5, 0x1C] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x4 - bl sub_80A861C - adds r0, 0x8 - strh r0, [r5, 0x1E] - ldrb r0, [r4] - movs r1, 0x3 - bl sub_80A861C - subs r0, 0x8 - strh r0, [r5, 0x20] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x4 - bl sub_80A861C - adds r0, 0x8 - b _0810FD12 - .pool -_0810FC94: - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - bne _0810FCE8 - ldr r0, =0x0000fff6 - strh r0, [r5, 0x1C] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x4 - bl sub_80A861C - adds r0, 0x8 - strh r0, [r5, 0x1E] - ldrb r0, [r4] - movs r1, 0x2 - bl sub_80A861C - adds r0, 0x8 - strh r0, [r5, 0x20] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x4 - bl sub_80A861C - adds r0, 0x8 - strh r0, [r5, 0x22] - ldrb r0, [r4] - movs r1, 0x2 - bl sub_80A861C - adds r0, 0x8 - b _0810FD1E - .pool -_0810FCE8: - movs r0, 0xA - strh r0, [r5, 0x1C] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x5 - bl sub_80A861C - subs r0, 0x8 - strh r0, [r5, 0x1E] - ldrb r0, [r4] - movs r1, 0x3 - bl sub_80A861C - subs r0, 0x8 - strh r0, [r5, 0x20] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x5 - bl sub_80A861C - subs r0, 0x8 -_0810FD12: - strh r0, [r5, 0x22] - ldrb r0, [r4] - movs r1, 0x3 - bl sub_80A861C - subs r0, 0x8 -_0810FD1E: - strh r0, [r5, 0x24] - movs r0, 0x6 - strh r0, [r5, 0xA] - ldr r0, =sub_810FD3C - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810FBF0 - - thumb_func_start sub_810FD3C -sub_810FD3C: @ 810FD3C - 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 r0, 0x8 - ldrsh r1, [r5, r0] - cmp r1, 0 - beq _0810FD60 - cmp r1, 0x1 - beq _0810FDD4 - b _0810FDE8 - .pool -_0810FD60: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - ble _0810FDE8 - strh r1, [r5, 0xA] - ldr r0, =gUnknown_08596864 - movs r2, 0x1E - ldrsh r1, [r5, r2] - movs r3, 0x20 - ldrsh r2, [r5, r3] - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _0810FDB4 - ldr r0, =gSprites - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - adds r4, r0 - movs r0, 0x10 - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x22] - strh r0, [r4, 0x32] - ldrh r0, [r5, 0x24] - strh r0, [r4, 0x36] - ldrh r0, [r5, 0x1C] - strh r0, [r4, 0x38] - adds r0, r4, 0 - bl InitAnimArcTranslation - ldrb r0, [r5, 0xC] - movs r1, 0x3 - ands r1, r0 - adds r0, r4, 0 - bl StartSpriteAffineAnim -_0810FDB4: - ldrh r0, [r5, 0xC] - adds r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xC - bne _0810FDE8 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _0810FDE8 - .pool -_0810FDD4: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x11 - ble _0810FDE8 - adds r0, r2, 0 - bl DestroyAnimVisualTask -_0810FDE8: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_810FD3C - - thumb_func_start sub_810FDF0 -sub_810FDF0: @ 810FDF0 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _0810FE0E - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - adds r0, r4, 0 - bl DestroySprite -_0810FE0E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810FDF0 - - thumb_func_start sub_810FE14 -sub_810FE14: @ 810FE14 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerYCoordWithElevation - lsls r0, 24 - lsrs r1, r0, 24 - adds r0, r1, 0 - subs r0, 0x20 - strh r0, [r4, 0x24] - ldr r0, =gBattleAnimArgs - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0x1 - beq _0810FE6A - cmp r0, 0x1 - bgt _0810FE58 - cmp r0, 0 - beq _0810FE5E - b _0810FE86 - .pool -_0810FE58: - cmp r0, 0x2 - beq _0810FE76 - b _0810FE86 -_0810FE5E: - movs r0, 0x2 - strh r0, [r4, 0x1E] - movs r0, 0x5 - strh r0, [r4, 0x20] - movs r0, 0x40 - b _0810FE7E -_0810FE6A: - movs r0, 0x2 - strh r0, [r4, 0x1E] - movs r0, 0x5 - strh r0, [r4, 0x20] - movs r0, 0xC0 - b _0810FE7E -_0810FE76: - movs r0, 0x4 - strh r0, [r4, 0x1E] - strh r0, [r4, 0x20] - movs r0, 0 -_0810FE7E: - strh r0, [r4, 0x22] - adds r0, r1, 0 - adds r0, 0x20 - strh r0, [r4, 0x26] -_0810FE86: - movs r1, 0x24 - ldrsh r0, [r4, r1] - cmp r0, 0 - bge _0810FE92 - movs r0, 0 - strh r0, [r4, 0x24] -_0810FE92: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSpriteBGPriorityRank - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0810FEB8 - ldr r0, =gBattle_BG1_X - ldrh r0, [r0] - strh r0, [r4, 0x1C] - ldr r0, =0x04000014 - b _0810FEC0 - .pool -_0810FEB8: - ldr r0, =gBattle_BG2_X - ldrh r0, [r0] - strh r0, [r4, 0x1C] - ldr r0, =0x04000018 -_0810FEC0: - str r0, [sp] - ldrh r1, [r4, 0x24] - lsls r3, r1, 16 - asrs r1, r3, 16 - movs r2, 0x24 - ldrsh r0, [r4, r2] - adds r0, 0x40 - cmp r1, r0 - bgt _0810FEFA - ldr r5, =gScanlineEffectRegBuffers - movs r0, 0xF0 - lsls r0, 3 - adds r6, r5, r0 -_0810FEDA: - asrs r3, 16 - lsls r1, r3, 1 - adds r2, r1, r5 - ldrh r0, [r4, 0x1C] - strh r0, [r2] - adds r1, r6 - ldrh r0, [r4, 0x1C] - strh r0, [r1] - adds r3, 0x1 - lsls r3, 16 - asrs r1, r3, 16 - movs r2, 0x24 - ldrsh r0, [r4, r2] - adds r0, 0x40 - cmp r1, r0 - ble _0810FEDA -_0810FEFA: - ldr r0, =0xa2600001 - str r0, [sp, 0x4] - mov r1, sp - movs r2, 0 - movs r0, 0x1 - strb r0, [r1, 0x8] - mov r0, sp - strb r2, [r0, 0x9] - ldr r0, [sp] - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - bl ScanlineEffect_SetParams - ldr r0, =sub_810FF34 - str r0, [r4] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810FE14 - - thumb_func_start sub_810FF34 -sub_810FF34: @ 810FF34 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - 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 _0811000E - cmp r0, 0x1 - bgt _0810FF60 - cmp r0, 0 - beq _0810FF66 - b _08110026 - .pool -_0810FF60: - cmp r0, 0x2 - beq _08110020 - b _08110026 -_0810FF66: - ldrh r3, [r5, 0x22] - ldrh r4, [r5, 0x24] - movs r2, 0x24 - ldrsh r1, [r5, r2] - movs r2, 0x26 - ldrsh r0, [r5, r2] - cmp r1, r0 - bgt _0810FFFE - ldr r0, =gSineTable - mov r9, r0 - movs r7, 0x3 - ldr r1, =gScanlineEffectRegBuffers - mov r12, r1 - movs r2, 0xF0 - lsls r2, 3 - add r2, r12 - mov r8, r2 -_0810FF88: - lsls r2, r3, 16 - asrs r0, r2, 15 - add r0, r9 - movs r3, 0 - ldrsh r0, [r0, r3] - movs r3, 0x20 - ldrsh r1, [r5, r3] - asrs r0, r1 - lsls r0, 16 - lsrs r1, r0, 16 - asrs r3, r0, 16 - adds r6, r2, 0 - cmp r3, 0 - ble _0810FFB8 - ldrh r1, [r5, 0xA] - adds r0, r7, 0 - ands r0, r1 - adds r0, r3, r0 - b _0810FFC4 - .pool -_0810FFB8: - cmp r3, 0 - bge _0810FFC8 - ldrh r1, [r5, 0xA] - adds r0, r7, 0 - ands r0, r1 - subs r0, r3, r0 -_0810FFC4: - lsls r0, 16 - lsrs r1, r0, 16 -_0810FFC8: - lsls r2, r4, 16 - asrs r2, 16 - lsls r3, r2, 1 - mov r0, r12 - adds r4, r3, r0 - ldrh r0, [r5, 0x1C] - lsls r1, 16 - asrs r1, 16 - adds r0, r1, r0 - strh r0, [r4] - add r3, r8 - ldrh r0, [r5, 0x1C] - adds r1, r0 - strh r1, [r3] - asrs r0, r6, 16 - ldrh r1, [r5, 0x1E] - adds r0, r1 - lsls r0, 16 - lsrs r3, r0, 16 - adds r2, 0x1 - lsls r2, 16 - lsrs r4, r2, 16 - asrs r2, 16 - movs r1, 0x26 - ldrsh r0, [r5, r1] - cmp r2, r0 - ble _0810FF88 -_0810FFFE: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x17 - ble _08110026 - b _08110014 -_0811000E: - ldr r1, =gScanlineEffect - movs r0, 0x3 - strb r0, [r1, 0x15] -_08110014: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _08110026 - .pool -_08110020: - adds r0, r2, 0 - bl DestroyAnimVisualTask -_08110026: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_810FF34 - - thumb_func_start sub_8110034 -sub_8110034: @ 8110034 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r4, r0, 24 - mov r8, r4 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r7, r0, r1 - bl AllocOamMatrix - lsls r0, 24 - lsrs r5, r0, 24 - mov r10, r5 - adds r6, r5, 0 - cmp r6, 0xFF - bne _0811006C - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _08110116 - .pool -_0811006C: - ldr r1, =gBattleAnimArgs - ldrb r0, [r1] - bl CloneBattlerSpriteWithBlend - lsls r0, 16 - lsrs r1, r0, 16 - mov r9, r1 - asrs r0, 16 - cmp r0, 0 - bge _08110094 - adds r0, r5, 0 - bl FreeOamMatrix - mov r0, r8 - bl DestroyAnimVisualTask - b _08110116 - .pool -_08110094: - ldr r2, =gSprites - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r0, r2, 0 - adds r0, 0x1C - adds r0, r4, r0 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - adds r4, r2 - ldrb r0, [r4, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r4, 0x1] - movs r0, 0x1F - ands r6, r0 - lsls r2, r6, 1 - ldrb r1, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x3] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - adds r1, r4, 0 - adds r1, 0x43 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - mov r1, r9 - lsls r0, r1, 24 - lsrs r0, 24 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - movs r3, 0 - bl SetSpriteRotScale - ldrb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl CalcCenterToCornerVec - ldr r1, =gBattleAnimArgs - ldrb r0, [r1] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r7, 0x22] - mov r0, r10 - strh r0, [r7, 0x24] - mov r1, r9 - strh r1, [r7, 0x26] - ldr r0, =sub_8110134 - str r0, [r7] -_08110116: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8110034 - - thumb_func_start sub_8110134 -sub_8110134: @ 8110134 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _081101B8 - cmp r0, 0x1 - bgt _0811015C - cmp r0, 0 - beq _08110166 - b _08110238 - .pool -_0811015C: - cmp r0, 0x2 - beq _08110208 - cmp r0, 0x3 - beq _08110228 - b _08110238 -_08110166: - ldrh r0, [r4, 0xA] - adds r0, 0x4 - strh r0, [r4, 0xA] - ldr r1, =gSineTable - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 16 - asrs r1, 17 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - subs r0, r1 - strh r0, [r4, 0xC] - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xC - ldrsh r2, [r4, r1] - adds r1, r2, 0 - movs r3, 0 - bl SetSpriteRotScale - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x22] - lsls r1, 24 - lsrs r1, 24 - bl SetBattlerSpriteYOffsetFromOtherYScale - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0x30 - bne _08110238 - b _0811021A - .pool -_081101B8: - ldrh r0, [r4, 0xA] - subs r0, 0x4 - strh r0, [r4, 0xA] - ldr r1, =gSineTable - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 16 - asrs r1, 17 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - subs r0, r1 - strh r0, [r4, 0xC] - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xC - ldrsh r2, [r4, r1] - adds r1, r2, 0 - movs r3, 0 - bl SetSpriteRotScale - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x22] - lsls r1, 24 - lsrs r1, 24 - bl SetBattlerSpriteYOffsetFromOtherYScale - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08110238 - b _0811021A - .pool -_08110208: - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl obj_delete_but_dont_free_vram -_0811021A: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08110238 - .pool -_08110228: - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - bl FreeOamMatrix - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08110238: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8110134 -@*/ - - thumb_func_start sub_8110240 -sub_8110240: @ 8110240 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _081102B8 - cmp r0, 0x1 - bgt _08110256 - cmp r0, 0 - beq _08110260 - b _08110360 -_08110256: - cmp r0, 0x2 - beq _081102EA - cmp r0, 0x3 - beq _0811034A - b _08110360 -_08110260: - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _0811028E - ldrh r0, [r5, 0x22] - adds r0, 0xC - strh r0, [r5, 0x22] -_0811028E: - movs r0, 0x8 - strh r0, [r5, 0x30] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldrh r0, [r5, 0x30] - movs r1, 0x10 - subs r1, r0 - lsls r1, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - b _081102E2 - .pool -_081102B8: - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08110360 - movs r0, 0x40 - negs r0, r0 - bl BattleAnimAdjustPanning - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 24 - movs r0, 0xCB - bl PlaySE12WithPanning - adds r0, r5, 0 - movs r1, 0x1 - bl ChangeSpriteAffineAnim -_081102E2: - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - b _08110360 -_081102EA: - ldrh r0, [r5, 0x32] - adds r1, r0, 0x1 - strh r1, [r5, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0811032E - movs r0, 0 - strh r0, [r5, 0x32] - ldrh r1, [r5, 0x30] - subs r1, 0x1 - strh r1, [r5, 0x30] - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0x30 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0811032E - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_0811032E: - movs r0, 0xE0 - lsls r0, 2 - adds r2, r0, 0 - ldrh r1, [r5, 0x34] - adds r2, r1 - lsls r1, r2, 16 - asrs r1, 24 - ldrh r0, [r5, 0x26] - subs r0, r1 - strh r0, [r5, 0x26] - movs r0, 0xFF - ands r2, r0 - strh r2, [r5, 0x34] - b _08110360 -_0811034A: - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyAnimSprite -_08110360: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8110240 - - .align 2, 0 diff --git a/include/battle_anim.h b/include/battle_anim.h index 56e8702b4..248e2a9f5 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -78,8 +78,8 @@ void sub_80A6450(struct Sprite *sprite); void SetAverageBattlerPositions(u8 battlerId, bool8 respectMonPicOffsets, s16 *x, s16 *y); void DestroySpriteAndMatrix(struct Sprite *sprite); void AnimTranslateLinearSimple(struct Sprite *sprite); -void InitSpritePosToAnimAttacker(struct Sprite *sprite, u8 a2); -void InitSpritePosToAnimTarget(struct Sprite *sprite, bool8 a2); +void InitSpritePosToAnimAttacker(struct Sprite *sprite, bool8 respectMonPicOffsets); +void InitSpritePosToAnimTarget(struct Sprite *sprite, bool8 respectMonPicOffsets); void StartAnimLinearTranslation(struct Sprite *sprite); void InitAnimArcTranslation(struct Sprite *sprite); bool8 AnimTranslateLinear(struct Sprite *sprite); @@ -149,6 +149,7 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority void sub_80A749C(struct Sprite *sprite); void sub_80A6814(u8 taskId); void sub_80A8610(struct Sprite *sprite); +void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId); enum { diff --git a/ld_script.txt b/ld_script.txt index df5c1c577..ddba6078b 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -165,7 +165,7 @@ SECTIONS { src/fight.o(.text); src/poison.o(.text); asm/flying.o(.text); - asm/psychic.o(.text); + src/psychic.o(.text); src/bug.o(.text); src/rock.o(.text); src/ghost.o(.text); diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c index e17dde078..7b9e975c4 100644 --- a/src/battle_anim_80A5C6C.c +++ b/src/battle_anim_80A5C6C.c @@ -788,7 +788,7 @@ void InitSpritePosToAnimTarget(struct Sprite *sprite, bool8 respectMonPicOffsets sprite->pos1.y += gBattleAnimArgs[1]; } -void InitSpritePosToAnimAttacker(struct Sprite *sprite, u8 respectMonPicOffsets) +void InitSpritePosToAnimAttacker(struct Sprite *sprite, bool8 respectMonPicOffsets) { if (!respectMonPicOffsets) { diff --git a/src/psychic.c b/src/psychic.c index efd15f746..371c24ce8 100644 --- a/src/psychic.c +++ b/src/psychic.c @@ -1,18 +1,33 @@ #include "global.h" #include "battle_anim.h" +#include "gpu_regs.h" +#include "palette.h" +#include "sound.h" +#include "scanline_effect.h" +#include "trig.h" #include "constants/rgb.h" +#include "constants/songs.h" -extern void sub_80A77C8(struct Sprite *); -extern void sub_810F1EC(struct Sprite *); -extern void sub_810F1EC(struct Sprite *); -extern void sub_810F58C(struct Sprite *); -extern void TranslateAnimSpriteToTargetMonLocation(struct Sprite *); -extern void sub_810F634(struct Sprite *); -extern void sub_810F6B0(struct Sprite *); -extern void sub_810FBA8(struct Sprite *); -extern void sub_810FDF0(struct Sprite *); -extern void sub_80A77C8(struct Sprite *); -extern void sub_8110240(struct Sprite *); +void sub_810F1EC(struct Sprite *); +void sub_810F58C(struct Sprite *); +void sub_810F634(struct Sprite *); +void sub_810F6B0(struct Sprite *); +void sub_810FBA8(struct Sprite *); +void sub_810FDF0(struct Sprite *); +void sub_8110240(struct Sprite *); +static void sub_810F340(struct Sprite *); +static void sub_810F3C8(struct Sprite *); +static void sub_810F400(struct Sprite *); +static void sub_810F46C(struct Sprite *); +static void sub_810F524(struct Sprite *); +static void sub_810F740(struct Sprite *); +static void sub_810F774(struct Sprite *); +static void sub_810F810(u8); +static void sub_810F898(u8); +static void sub_810F9D4(u8); +static void sub_810FD3C(u8); +static void sub_810FF34(u8); +static void sub_8110134(u8); const union AffineAnimCmd gUnknown_0859652C[] = { @@ -403,3 +418,744 @@ const struct SpriteTemplate gUnknown_08596920 = .affineAnims = gUnknown_08596918, .callback = sub_8110240, }; + +void sub_810F1EC(struct Sprite *sprite) +{ + u8 isContest = IsContest(); + + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER || isContest) + { + sprite->oam.priority = 2; + sprite->subpriority = 200; + } + + if (!isContest) + { + u8 battlerCopy; + u8 battler = battlerCopy = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + u8 rank = GetBattlerSpriteBGPriorityRank(battler); + int var0 = 1; + u8 toBG_2 = (rank ^ var0) != 0; + + if (IsBattlerSpriteVisible(battler)) + MoveBattlerSpriteToBG(battler, toBG_2, FALSE); + + battler = BATTLE_PARTNER(battlerCopy); + if (IsBattlerSpriteVisible(battler)) + MoveBattlerSpriteToBG(battler, toBG_2 ^ var0, FALSE); + } + + if (!isContest && IsDoubleBattle()) + { + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + { + sprite->pos1.x = 72; + sprite->pos1.y = 80; + } + else + { + sprite->pos1.x = 176; + sprite->pos1.y = 40; + } + } + else + { + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[0] = -gBattleAnimArgs[0]; + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X) + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1]; + } + + sprite->data[0] = 256 + IndexOfSpritePaletteTag(gBattleAnimArgs[2]) * 16; + + if (isContest) + { + sprite->pos1.y += 9; + sprite->callback = sub_810F3C8; + sprite->callback(sprite); + } + else + { + sprite->callback = sub_810F340; + } +} + +static void sub_810F340(struct Sprite *sprite) +{ + u8 battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + if (!sprite->data[7]) + { + sprite->data[7] = 1; + return; + } + + if (IsBattlerSpriteVisible(battler)) + gSprites[gBattlerSpriteIds[battler]].invisible = 1; + + battler = BATTLE_PARTNER(battler); + if (IsBattlerSpriteVisible(battler)) + gSprites[gBattlerSpriteIds[battler]].invisible = 1; + + sprite->callback = sub_810F3C8; + sprite->callback(sprite); +} + +static void sub_810F3C8(struct Sprite *sprite) +{ + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[3], 16 - sprite->data[3])); + if (sprite->data[3] == 13) + sprite->callback = sub_810F400; + else + sprite->data[3]++; +} + +static void sub_810F400(struct Sprite *sprite) +{ + u16 color; + u16 startOffset; + int i; + + if (++sprite->data[1] == 2) + { + sprite->data[1] = 0; + startOffset = sprite->data[0]; + color = gPlttBufferFaded[startOffset + 8]; + + for (i = 8; i > 0; i--) + gPlttBufferFaded[startOffset + i] = gPlttBufferFaded[startOffset + i - 1]; + + gPlttBufferFaded[startOffset + 1] = color; + + if (++sprite->data[2] == 16) + sprite->callback = sub_810F46C; + } +} + +static void sub_810F46C(struct Sprite *sprite) +{ + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[3], 16 - sprite->data[3])); + + if (--sprite->data[3] == -1) + { + if (!IsContest()) + { + u8 battlerCopy; + u8 battler = battlerCopy = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + + if (IsBattlerSpriteVisible(battler)) + gSprites[gBattlerSpriteIds[battler]].invisible = 0; + + battler = BATTLE_PARTNER(battlerCopy); + if (IsBattlerSpriteVisible(battler)) + gSprites[gBattlerSpriteIds[battler]].invisible = 0; + } + + sprite->invisible = 1; + sprite->callback = sub_810F524; + } +} + +static void sub_810F524(struct Sprite *sprite) +{ + if (!IsContest()) + { + u8 battlerCopy; + u8 battler = battlerCopy = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + u8 rank = GetBattlerSpriteBGPriorityRank(battler); + int var0 = 1; + u8 toBG_2 = (rank ^ var0) != 0; + + if (IsBattlerSpriteVisible(battler)) + sub_80A477C(toBG_2); + + battler = battlerCopy ^ 2; + if (IsBattlerSpriteVisible(battler)) + sub_80A477C(toBG_2 ^ var0); + } + + sprite->callback = DestroyAnimSprite; +} + +void sub_810F58C(struct Sprite *sprite) +{ + if (sprite->data[0] == 0) + { + int arg3 = gBattleAnimArgs[3]; + bool8 respectMonPicOffsets = FALSE; + if (arg3 == 0) + respectMonPicOffsets = TRUE; + + if (!IsContest() && IsDoubleBattle()) + { + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + { + sprite->pos1.x = 72 - gBattleAnimArgs[0]; + sprite->pos1.y = gBattleAnimArgs[1] + 80; + } + else + { + sprite->pos1.x = gBattleAnimArgs[0] + 176; + sprite->pos1.y = gBattleAnimArgs[1] + 40; + } + } + else + { + if (gBattleAnimArgs[2] == 0) + InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets); + else + InitSpritePosToAnimTarget(sprite, respectMonPicOffsets); + } + + sprite->data[0]++; + } + else + { + if (sprite->animEnded || sprite->affineAnimEnded) + DestroySpriteAndMatrix(sprite); + } +} + +void sub_810F634(struct Sprite *sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); + + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + StartSpriteAnim(sprite, 1); + sprite->pos1.x -= 40; + sprite->pos1.y += 10; + sprite->data[1] = -1; + } + else + { + sprite->pos1.x += 40; + sprite->pos1.y -= 10; + sprite->data[1] = 1; + } + + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->callback = RunStoredCallbackWhenAnimEnds; +} + +void sub_810F6B0(struct Sprite *sprite) +{ + s16 x = sub_80A861C(gBattleAnimAttacker, 1) / 2; + s16 y = sub_80A861C(gBattleAnimAttacker, 0) / -2; + + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) + x = -x; + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + x; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + y; + + if (sprite->pos1.y < 16) + sprite->pos1.y = 16; + + StoreSpriteCallbackInData6(sprite, sub_810F740); + sprite->callback = RunStoredCallbackWhenAnimEnds; +} + +static void sub_810F740(struct Sprite *sprite) +{ + sprite->oam.affineMode = 1; + sprite->affineAnims = gUnknown_08596740; + sprite->data[0] = 0; + InitSpriteAffineAnim(sprite); + sprite->callback = sub_810F774; +} + +static void sub_810F774(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + if (sprite->affineAnimEnded) + { + FreeOamMatrix(sprite->oam.matrixNum); + sprite->oam.affineMode = 0; + sprite->data[1] = 18; + sprite->data[0]++; + } + break; + case 1: + if (--sprite->data[1] == -1) + DestroyAnimSprite(sprite); + break; + } +} + +void sub_810F7D4(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); + task->data[0] = spriteId; + PrepareAffineAnimInTaskData(task, spriteId, gUnknown_0859675C); + task->func = sub_810F810; +} + +static void sub_810F810(u8 taskId) +{ + if (!RunAffineAnimFromTaskData(&gTasks[taskId])) + DestroyAnimVisualTask(taskId); +} + +void sub_810F83C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); + task->data[0] = spriteId; + task->data[1] = 0; + task->data[2] = 0; + task->data[3] = GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER ? 4 : 8; + + PrepareAffineAnimInTaskData(task, task->data[0], gUnknown_0859677C); + task->func = sub_810F898; +} + +static void sub_810F898(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[1]) + { + case 0: + RunAffineAnimFromTaskData(task); + if (++task->data[2] > 19) + task->data[1]++; + break; + case 1: + if (task->data[3] != 0) + { + gSprites[task->data[0]].pos2.y -= 8; + task->data[3]--; + } + else + { + gSprites[task->data[0]].invisible = 1; + gSprites[task->data[0]].pos1.x = 272; + ResetSpriteRotScale(task->data[0]); + DestroyAnimVisualTask(taskId); + } + break; + } +} + +void sub_810F940(u8 taskId) +{ + u16 var0, var1; + + struct Task *task = &gTasks[taskId]; + + task->data[3] = 16; + task->data[4] = 0; + task->data[13] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); + + var0 = sub_80A861C(gBattleAnimAttacker, 1) / 3; + var1 = sub_80A861C(gBattleAnimAttacker, 0) / 3; + task->data[12] = var0 > var1 ? var0 : var1; + + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0)); + + task->func = sub_810F9D4; +} + +static void sub_810F9D4(u8 taskId) +{ + u16 i; + u8 spriteId; + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + if (++task->data[1] > 8) + { + task->data[1] = 0; + spriteId = CreateSprite(&gUnknown_08596794, task->data[13], task->data[14], 0); + task->data[task->data[2] + 8] = spriteId; + if (spriteId != MAX_SPRITES) + { + switch (task->data[2]) + { + case 0: + gSprites[spriteId].pos2.x = task->data[12]; + gSprites[spriteId].pos2.y = -task->data[12]; + break; + case 1: + gSprites[spriteId].pos2.x = -task->data[12]; + gSprites[spriteId].pos2.y = task->data[12]; + break; + case 2: + gSprites[spriteId].pos2.x = task->data[12]; + gSprites[spriteId].pos2.y = task->data[12]; + break; + case 3: + gSprites[spriteId].pos2.x = -task->data[12]; + gSprites[spriteId].pos2.y = -task->data[12]; + break; + } + } + + if (++task->data[2] == 5) + task->data[0]++; + } + break; + case 1: + if (task->data[1] & 1) + task->data[3]--; + else + task->data[4]++; + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4])); + if (++task->data[1] == 32) + { + for (i = 8; i < 13; i++) + { + if (task->data[i] != 64) + DestroySprite(&gSprites[task->data[i]]); + } + + task->data[0]++; + } + break; + case 2: + task->data[0]++; + break; + case 3: + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + DestroyAnimVisualTask(taskId); + break; + } +} + +static void sub_810FB60(struct Sprite *sprite) +{ + if (sprite->data[1] > sprite->data[0] - 10) + sprite->invisible = sprite->data[1] & 1; + + if (sprite->data[1] == sprite->data[0]) + DestroyAnimSprite(sprite); + + sprite->data[1]++; +} + +void sub_810FBA8(struct Sprite *sprite) +{ + if (gBattleAnimArgs[0] == 0) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); + } + + sprite->data[0] = gBattleAnimArgs[1]; + sprite->callback = sub_810FB60; +} + +void sub_810FBF0(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + if (IsContest()) + { + if (gBattleAnimArgs[0] == 1) + { + task->data[10] = -10; + task->data[11] = sub_80A861C(gBattleAnimTarget, 5) - 8; + task->data[12] = sub_80A861C(gBattleAnimTarget, 2) + 8; + task->data[13] = sub_80A861C(gBattleAnimAttacker, 5) - 8; + task->data[14] = sub_80A861C(gBattleAnimAttacker, 2) + 8; + } + else + { + task->data[10] = 10; + task->data[11] = sub_80A861C(gBattleAnimAttacker, 4) + 8; + task->data[12] = sub_80A861C(gBattleAnimAttacker, 3) - 8; + task->data[13] = sub_80A861C(gBattleAnimTarget, 4) + 8; + task->data[14] = sub_80A861C(gBattleAnimTarget, 3) - 8; + } + } + else + { + if (gBattleAnimArgs[0] == 1) + { + task->data[10] = -10; + task->data[11] = sub_80A861C(gBattleAnimTarget, 4) + 8; + task->data[12] = sub_80A861C(gBattleAnimTarget, 2) + 8; + task->data[13] = sub_80A861C(gBattleAnimAttacker, 4) + 8; + task->data[14] = sub_80A861C(gBattleAnimAttacker, 2) + 8; + } + else + { + task->data[10] = 10; + task->data[11] = sub_80A861C(gBattleAnimAttacker, 5) - 8; + task->data[12] = sub_80A861C(gBattleAnimAttacker, 3) - 8; + task->data[13] = sub_80A861C(gBattleAnimTarget, 5) - 8; + task->data[14] = sub_80A861C(gBattleAnimTarget, 3) - 8; + } + } + + task->data[1] = 6; + task->func = sub_810FD3C; +} + +static void sub_810FD3C(u8 taskId) +{ + u8 spriteId; + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + if (++task->data[1] > 6) + { + task->data[1] = 0; + spriteId = CreateSprite(&gUnknown_08596864, task->data[11], task->data[12], 0); + if (spriteId != 64) + { + gSprites[spriteId].data[0] = 16; + gSprites[spriteId].data[2] = task->data[13]; + gSprites[spriteId].data[4] = task->data[14]; + gSprites[spriteId].data[5] = task->data[10]; + + InitAnimArcTranslation(&gSprites[spriteId]); + StartSpriteAffineAnim(&gSprites[spriteId], task->data[2] & 3); + } + + if (++task->data[2] == 12) + task->data[0]++; + } + break; + case 1: + if (++task->data[1] > 17) + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_810FDF0(struct Sprite *sprite) +{ + if (TranslateAnimArc(sprite)) + { + FreeOamMatrix(sprite->oam.matrixNum); + DestroySprite(sprite); + } +} + +void sub_810FE14(u8 taskId) +{ + s16 i; + u8 yOffset; + struct ScanlineEffectParams scanlineParams; + struct Task *task = &gTasks[taskId]; + + yOffset = GetBattlerYCoordWithElevation(gBattleAnimTarget); + task->data[14] = yOffset - 32; + + switch (gBattleAnimArgs[0]) + { + case 0: + task->data[11] = 2; + task->data[12] = 5; + task->data[13] = 64; + task->data[15] = yOffset + 32; + break; + case 1: + task->data[11] = 2; + task->data[12] = 5; + task->data[13] = 192; + task->data[15] = yOffset + 32; + break; + case 2: + task->data[11] = 4; + task->data[12] = 4; + task->data[13] = 0; + task->data[15] = yOffset + 32; + break; + } + + if (task->data[14] < 0) + task->data[14] = 0; + + if (GetBattlerSpriteBGPriorityRank(gBattleAnimTarget) == 1) + { + task->data[10] = gBattle_BG1_X; + scanlineParams.dmaDest = ®_BG1HOFS; + } + else + { + task->data[10] = gBattle_BG2_X; + scanlineParams.dmaDest = ®_BG2HOFS; + } + + i = task->data[14]; + while (i <= task->data[14] + 64) + { + gScanlineEffectRegBuffers[0][i] = task->data[10]; + gScanlineEffectRegBuffers[1][i] = task->data[10]; + i++; + } + + scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; + scanlineParams.initState = 1; + scanlineParams.unused9 = 0; + ScanlineEffect_SetParams(scanlineParams); + task->func = sub_810FF34; +} + +static void sub_810FF34(u8 taskId) +{ + s16 sineIndex, i; + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + sineIndex = task->data[13]; + i = task->data[14]; + while (i <= task->data[15]) + { + s16 var2 = (gSineTable[sineIndex] >> task->data[12]); + if (var2 > 0) + var2 += (task->data[1] & 3); + else if (var2 < 0) + var2 -= (task->data[1] & 3); + + gScanlineEffectRegBuffers[0][i] = task->data[10] + var2; + gScanlineEffectRegBuffers[1][i] = task->data[10] + var2; + sineIndex += task->data[11]; + i++; + } + + if (++task->data[1] > 23) + task->data[0]++; + break; + case 1: + gScanlineEffect.state = 3; + task->data[0]++; + break; + case 2: + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_8110034(u8 taskId) +{ + s16 spriteId; + s16 matrixNum; + struct Task *task = &gTasks[taskId]; + + matrixNum = AllocOamMatrix(); + if (matrixNum == 0xFF) + { + DestroyAnimVisualTask(taskId); + return; + } + + spriteId = CloneBattlerSpriteWithBlend(gBattleAnimArgs[0]); + if (spriteId < 0) + { + FreeOamMatrix(matrixNum); + DestroyAnimVisualTask(taskId); + return; + } + + gSprites[spriteId].callback = SpriteCallbackDummy; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_DOUBLE; + gSprites[spriteId].oam.matrixNum = matrixNum; + gSprites[spriteId].affineAnimPaused = 1; + gSprites[spriteId].subpriority++; + SetSpriteRotScale(spriteId, 256, 256, 0); + CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode); + task->data[13] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + task->data[14] = matrixNum; + task->data[15] = spriteId; + task->func = sub_8110134; +} + +static void sub_8110134(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + task->data[1] += 4; + task->data[2] = 256 - (gSineTable[task->data[1]] >> 1); + SetSpriteRotScale(task->data[15], task->data[2], task->data[2], 0); + SetBattlerSpriteYOffsetFromOtherYScale(task->data[15], task->data[13]); + if (task->data[1] == 48) + task->data[0]++; + break; + case 1: + task->data[1] -= 4; + task->data[2] = 256 - (gSineTable[task->data[1]] >> 1);; + SetSpriteRotScale(task->data[15], task->data[2], task->data[2], 0); + SetBattlerSpriteYOffsetFromOtherYScale(task->data[15], task->data[13]); + if (task->data[1] == 0) + task->data[0]++; + break; + case 2: + obj_delete_but_dont_free_vram(&gSprites[task->data[15]]); + task->data[0]++; + break; + case 3: + FreeOamMatrix(task->data[14]); + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_8110240(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y); + + if (IsContest()) + sprite->pos1.y += 12; + + sprite->data[1] = 8; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[1], 16 - sprite->data[1])); + sprite->data[0]++; + break; + case 1: + if (sprite->affineAnimEnded) + { + PlaySE12WithPanning(SE_W100, BattleAnimAdjustPanning(-64)); + ChangeSpriteAffineAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 2: + if (sprite->data[2]++ > 1) + { + sprite->data[2] = 0; + sprite->data[1]--; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[1], 16 - sprite->data[1])); + if (sprite->data[1] == 0) + { + sprite->data[0]++; + sprite->invisible = 1; + } + } + + sprite->data[3] += 0x380; + sprite->pos2.y -= sprite->data[3] >> 8; + sprite->data[3] &= 0xFF; + break; + case 3: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + DestroyAnimSprite(sprite); + break; + } +}