diff --git a/asm/battle_anim_80D51AC.s b/asm/battle_anim_80D51AC.s deleted file mode 100644 index 0b0378a99..000000000 --- a/asm/battle_anim_80D51AC.s +++ /dev/null @@ -1,2446 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start AnimTask_ShakeMon -AnimTask_ShakeMon: @ 80D51AC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _080D51D0 - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D520C - .pool -_080D51D0: - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r4, 0x2] - strh r1, [r0, 0x24] - ldrh r1, [r4, 0x4] - strh r1, [r0, 0x26] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0x8] - ldrh r1, [r4, 0x6] - strh r1, [r0, 0xA] - ldrh r1, [r4, 0x8] - strh r1, [r0, 0xC] - ldrh r1, [r4, 0x8] - strh r1, [r0, 0xE] - ldrh r1, [r4, 0x2] - strh r1, [r0, 0x10] - ldrh r1, [r4, 0x4] - strh r1, [r0, 0x12] - ldr r1, =sub_80D5220 - str r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 -_080D520C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeMon - - thumb_func_start sub_80D5220 -sub_80D5220: @ 80D5220 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r3, r0, r1 - ldrh r0, [r3, 0xE] - movs r2, 0xE - ldrsh r5, [r3, r2] - adds r7, r1, 0 - cmp r5, 0 - bne _080D52C6 - ldr r2, =gSprites - movs r6, 0x8 - ldrsh r1, [r3, r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - movs r6, 0x24 - ldrsh r0, [r1, r6] - adds r6, r2, 0 - cmp r0, 0 - bne _080D5264 - ldrh r0, [r3, 0x10] - strh r0, [r1, 0x24] - b _080D5266 - .pool -_080D5264: - strh r5, [r1, 0x24] -_080D5266: - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r7 - movs r0, 0x8 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r6 - movs r5, 0x26 - ldrsh r0, [r1, r5] - cmp r0, 0 - bne _080D5286 - ldrh r0, [r3, 0x12] - b _080D5288 -_080D5286: - movs r0, 0 -_080D5288: - strh r0, [r1, 0x26] - adds r0, r2, r4 - lsls r0, 3 - adds r2, r0, r7 - ldrh r0, [r2, 0xC] - strh r0, [r2, 0xE] - ldrh r0, [r2, 0xA] - subs r0, 0x1 - strh r0, [r2, 0xA] - lsls r0, 16 - asrs r3, r0, 16 - cmp r3, 0 - bne _080D52CA - movs r0, 0x8 - ldrsh r1, [r2, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r3, [r0, 0x24] - movs r5, 0x8 - ldrsh r1, [r2, r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r3, [r0, 0x26] - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _080D52CA -_080D52C6: - subs r0, 0x1 - strh r0, [r3, 0xE] -_080D52CA: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80D5220 - - thumb_func_start AnimTask_ShakeMon2 -AnimTask_ShakeMon2: @ 80D52D0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleAnimArgs - ldrh r0, [r2] - movs r3, 0 - ldrsh r1, [r2, r3] - cmp r1, 0x3 - bgt _080D52FC - lsls r0, 24 - lsrs r0, 24 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xFF - bne _080D5352 - b _080D5356 - .pool -_080D52FC: - cmp r1, 0x8 - beq _080D5348 - movs r1, 0 - ldrsh r0, [r2, r1] - cmp r0, 0x5 - beq _080D531C - cmp r0, 0x5 - bgt _080D5312 - cmp r0, 0x4 - beq _080D5318 - b _080D5324 -_080D5312: - cmp r0, 0x6 - beq _080D5320 - b _080D5324 -_080D5318: - movs r0, 0 - b _080D5326 -_080D531C: - movs r0, 0x2 - b _080D5326 -_080D5320: - movs r0, 0x1 - b _080D5326 -_080D5324: - movs r0, 0x3 -_080D5326: - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - bne _080D533C - movs r6, 0x1 -_080D533C: - ldr r0, =gBattlerSpriteIds - adds r0, r4, r0 - b _080D5350 - .pool -_080D5348: - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r0, r1 -_080D5350: - ldrb r3, [r0] -_080D5352: - cmp r6, 0 - beq _080D5368 -_080D5356: - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D53A6 - .pool -_080D5368: - ldr r1, =gSprites - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldr r2, =gBattleAnimArgs - ldrh r1, [r2, 0x2] - strh r1, [r0, 0x24] - ldrh r1, [r2, 0x4] - strh r1, [r0, 0x26] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r3, [r0, 0x8] - ldrh r1, [r2, 0x6] - strh r1, [r0, 0xA] - ldrh r1, [r2, 0x8] - strh r1, [r0, 0xC] - ldrh r1, [r2, 0x8] - strh r1, [r0, 0xE] - ldrh r1, [r2, 0x2] - strh r1, [r0, 0x10] - ldrh r1, [r2, 0x4] - strh r1, [r0, 0x12] - ldr r1, =sub_80D53BC - str r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 -_080D53A6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeMon2 - - thumb_func_start sub_80D53BC -sub_80D53BC: @ 80D53BC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r3, r0, r1 - ldrh r2, [r3, 0xE] - movs r4, 0xE - ldrsh r0, [r3, r4] - mov r12, r1 - cmp r0, 0 - bne _080D5474 - ldr r2, =gSprites - movs r7, 0x8 - ldrsh r1, [r3, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r0, 0x24 - ldrsh r1, [r4, r0] - ldrh r5, [r3, 0x10] - movs r7, 0x10 - ldrsh r0, [r3, r7] - adds r7, r2, 0 - cmp r1, r0 - bne _080D5408 - negs r0, r5 - strh r0, [r4, 0x24] - b _080D540A - .pool -_080D5408: - strh r5, [r4, 0x24] -_080D540A: - lsls r3, r6, 2 - adds r1, r3, r6 - lsls r1, 3 - add r1, r12 - movs r0, 0x8 - ldrsh r2, [r1, r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r7 - movs r0, 0x26 - ldrsh r2, [r4, r0] - mov r8, r2 - ldrh r5, [r1, 0x12] - movs r2, 0x12 - ldrsh r0, [r1, r2] - cmp r8, r0 - bne _080D5434 - negs r0, r5 - strh r0, [r4, 0x26] - b _080D5436 -_080D5434: - strh r5, [r4, 0x26] -_080D5436: - adds r0, r3, r6 - lsls r0, 3 - mov r4, r12 - adds r3, r0, r4 - ldrh r0, [r3, 0xC] - strh r0, [r3, 0xE] - ldrh r0, [r3, 0xA] - subs r0, 0x1 - strh r0, [r3, 0xA] - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0 - bne _080D5478 - movs r0, 0x8 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - strh r2, [r0, 0x24] - movs r4, 0x8 - ldrsh r1, [r3, r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - strh r2, [r0, 0x26] - adds r0, r6, 0 - bl DestroyAnimVisualTask - b _080D5478 -_080D5474: - subs r0, r2, 0x1 - strh r0, [r3, 0xE] -_080D5478: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80D53BC - - thumb_func_start AnimTask_ShakeMonInPlace -AnimTask_ShakeMonInPlace: @ 80D5484 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xFF - bne _080D54A8 - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D54F6 - .pool -_080D54A8: - ldr r0, =gSprites - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r4, 0x2] - ldrh r2, [r1, 0x24] - adds r0, r2 - movs r2, 0 - strh r0, [r1, 0x24] - ldrh r0, [r4, 0x4] - ldrh r6, [r1, 0x26] - adds r0, r6 - strh r0, [r1, 0x26] - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - strh r3, [r1, 0x8] - strh r2, [r1, 0xA] - ldrh r0, [r4, 0x6] - strh r0, [r1, 0xC] - strh r2, [r1, 0xE] - ldrh r0, [r4, 0x8] - strh r0, [r1, 0x10] - movs r2, 0x2 - ldrsh r0, [r4, r2] - lsls r0, 1 - strh r0, [r1, 0x12] - movs r6, 0x4 - ldrsh r0, [r4, r6] - lsls r0, 1 - strh r0, [r1, 0x14] - ldr r2, =sub_80D5508 - str r2, [r1] - adds r0, r5, 0 - bl _call_via_r2 -_080D54F6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeMonInPlace - - thumb_func_start sub_80D5508 -sub_80D5508: @ 80D5508 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r0, [r4, r3] - adds r6, r1, 0 - cmp r0, 0 - beq _080D5526 - b _080D5638 -_080D5526: - ldrh r1, [r4, 0xA] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D5568 - 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, [r4, 0x12] - ldrh r3, [r0, 0x24] - adds r1, r3 - strh r1, [r0, 0x24] - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0x14] - ldrh r3, [r0, 0x26] - adds r1, r3 - strh r1, [r0, 0x26] - adds r3, r2, 0 - b _080D5592 - .pool -_080D5568: - ldr r3, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x24] - ldrh r2, [r4, 0x12] - subs r1, r2 - strh r1, [r0, 0x24] - movs r2, 0x8 - ldrsh r1, [r4, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - ldrh r2, [r4, 0x14] - subs r1, r2 - strh r1, [r0, 0x26] -_080D5592: - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r6 - ldrh r0, [r4, 0x10] - strh r0, [r4, 0xE] - ldrh r0, [r4, 0xA] - adds r2, r0, 0x1 - strh r2, [r4, 0xA] - lsls r0, r2, 16 - asrs r0, 16 - movs r6, 0xC - ldrsh r1, [r4, r6] - cmp r0, r1 - blt _080D563C - movs r0, 0x1 - ands r2, r0 - cmp r2, 0 - beq _080D55F8 - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - movs r2, 0x12 - ldrsh r0, [r4, r2] - lsrs r2, r0, 31 - adds r0, r2 - asrs r0, 1 - ldrh r6, [r1, 0x24] - adds r0, r6 - strh r0, [r1, 0x24] - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - movs r2, 0x14 - ldrsh r0, [r4, r2] - lsrs r2, r0, 31 - adds r0, r2 - asrs r0, 1 - ldrh r3, [r1, 0x26] - adds r0, r3 - strh r0, [r1, 0x26] - b _080D5630 - .pool -_080D55F8: - movs r6, 0x8 - ldrsh r0, [r4, r6] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - movs r0, 0x12 - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - ldrh r0, [r2, 0x24] - subs r0, r1 - strh r0, [r2, 0x24] - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - movs r3, 0x14 - ldrsh r1, [r4, r3] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - ldrh r0, [r2, 0x26] - subs r0, r1 - strh r0, [r2, 0x26] -_080D5630: - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D563C -_080D5638: - subs r0, r2, 0x1 - strh r0, [r4, 0xE] -_080D563C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D5508 - - thumb_func_start AnimTask_ShakeAndSinkMon -AnimTask_ShakeAndSinkMon: @ 80D5644 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gBattleAnimArgs - ldrb r0, [r5] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrh r2, [r5, 0x2] - strh r2, [r1, 0x24] - ldr r2, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r2 - strh r0, [r1, 0x8] - ldrh r0, [r5, 0x2] - strh r0, [r1, 0xA] - ldrh r0, [r5, 0x4] - strh r0, [r1, 0xC] - ldrh r0, [r5, 0x6] - strh r0, [r1, 0xE] - ldrh r0, [r5, 0x8] - strh r0, [r1, 0x10] - ldr r2, =sub_80D56A4 - str r2, [r1] - adds r0, r4, 0 - bl _call_via_r2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeAndSinkMon - - thumb_func_start sub_80D56A4 -sub_80D56A4: @ 80D56A4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r2, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r3, r0, r2 - ldrb r5, [r3, 0x8] - ldrh r4, [r3, 0xA] - ldrh r1, [r3, 0x18] - adds r0, r1, 0x1 - strh r0, [r3, 0x18] - movs r7, 0xC - ldrsh r0, [r3, r7] - lsls r1, 16 - asrs r1, 16 - mov r12, r2 - ldr r7, =gSprites - cmp r0, r1 - bne _080D56F6 - movs r0, 0 - strh r0, [r3, 0x18] - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r1, r0, r7 - ldrh r3, [r1, 0x24] - movs r0, 0x24 - ldrsh r2, [r1, r0] - lsls r0, r4, 16 - asrs r0, 16 - cmp r2, r0 - bne _080D56EE - negs r0, r2 - lsls r0, 16 - lsrs r4, r0, 16 -_080D56EE: - lsls r0, r4, 16 - asrs r0, 16 - adds r0, r3 - strh r0, [r1, 0x24] -_080D56F6: - lsls r2, r6, 2 - adds r2, r6 - lsls r2, 3 - add r2, r12 - strh r4, [r2, 0xA] - ldrh r1, [r2, 0xE] - ldrh r0, [r2, 0x1A] - adds r1, r0 - strh r1, [r2, 0x1A] - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r0, r7 - lsls r1, 16 - asrs r1, 24 - strh r1, [r0, 0x26] - ldrh r0, [r2, 0x10] - subs r0, 0x1 - strh r0, [r2, 0x10] - lsls r0, 16 - cmp r0, 0 - bne _080D5728 - adds r0, r6, 0 - bl DestroyAnimVisualTask -_080D5728: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D56A4 - - thumb_func_start sub_80D5738 -sub_80D5738: @ 80D5738 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0x1 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r7, r0, 24 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x5 - ble _080D575C - movs r0, 0x5 - strh r0, [r4, 0x8] -_080D575C: - movs r1, 0 - movs r2, 0x8 - ldrsh r0, [r4, r2] - adds r3, r4, 0 - ldr r2, =gTasks - mov r12, r2 - lsls r4, r5, 2 - ldr r2, =sub_80D57B8 - mov r8, r2 - cmp r1, r0 - bge _080D5782 - adds r2, r0, 0 -_080D5774: - lsls r0, r6, 25 - lsrs r6, r0, 24 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - blt _080D5774 -_080D5782: - adds r0, r4, r5 - lsls r0, 3 - add r0, r12 - strh r7, [r0, 0x8] - ldrh r1, [r3, 0x2] - strh r1, [r0, 0xA] - ldrh r1, [r3, 0x4] - strh r1, [r0, 0xC] - ldrh r1, [r3, 0x6] - strh r1, [r0, 0xE] - strh r6, [r0, 0x10] - mov r1, r8 - str r1, [r0] - adds r0, r5, 0 - bl _call_via_r8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5738 - - thumb_func_start sub_80D57B8 -sub_80D57B8: @ 80D57B8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r5, r0, r1 - ldrb r4, [r5, 0x8] - movs r1, 0x12 - ldrsh r0, [r5, r1] - movs r2, 0xA - ldrsh r1, [r5, r2] - bl Sin - ldr r2, =gSprites - lsls r1, r4, 4 - adds r1, r4 - lsls r1, 2 - adds r4, r1, r2 - strh r0, [r4, 0x24] - movs r1, 0x12 - ldrsh r0, [r5, r1] - movs r2, 0xC - ldrsh r1, [r5, r2] - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r1, [r5, 0xC] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r5, 0x10] - ldrh r1, [r5, 0x12] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x12] - cmp r0, 0 - bne _080D5810 - ldrh r0, [r5, 0xE] - subs r0, 0x1 - strh r0, [r5, 0xE] -_080D5810: - movs r2, 0xE - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _080D5822 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - adds r0, r6, 0 - bl DestroyAnimVisualTask -_080D5822: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D57B8 - - thumb_func_start AnimTask_TranslateMonEllipticalRespectSide -AnimTask_TranslateMonEllipticalRespectSide: @ 80D5830 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D584C - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] -_080D584C: - adds r0, r4, 0 - bl sub_80D5738 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_TranslateMonEllipticalRespectSide - - thumb_func_start sub_80D5860 -sub_80D5860: @ 80D5860 - push {r4,lr} - adds r4, r0, 0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5890 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - b _080D5894 - .pool -_080D5890: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] -_080D5894: - strh r0, [r4, 0x30] - ldrh r2, [r1] - movs r0, 0 - strh r2, [r4, 0x2E] - strh r0, [r4, 0x32] - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r4, 0x34] - strh r2, [r4, 0x36] - ldr r1, =sub_80D58D4 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A6630 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5860 - - thumb_func_start sub_80D58D4 -sub_80D58D4: @ 80D58D4 - push {lr} - ldrh r1, [r0, 0x36] - strh r1, [r0, 0x2E] - ldrh r1, [r0, 0x30] - negs r1, r1 - strh r1, [r0, 0x30] - ldr r1, =sub_80A6630 - str r1, [r0, 0x1C] - ldr r1, =DestroyAnimSprite - bl StoreSpriteCallbackInData6 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D58D4 - - thumb_func_start sub_80D58F8 -sub_80D58F8: @ 80D58F8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r5, =gBattleAnimArgs - ldrb r0, [r5, 0x4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - ldrh r2, [r5] - movs r1, 0 - strh r2, [r4, 0x2E] - strh r1, [r4, 0x30] - ldrh r1, [r5, 0x2] - strh r1, [r4, 0x32] - strh r0, [r4, 0x34] - strh r2, [r4, 0x36] - ldr r1, =sub_80D5944 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A6630 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D58F8 - - thumb_func_start sub_80D5944 -sub_80D5944: @ 80D5944 - push {lr} - ldrh r1, [r0, 0x36] - strh r1, [r0, 0x2E] - ldrh r1, [r0, 0x32] - negs r1, r1 - strh r1, [r0, 0x32] - ldr r1, =sub_80A6630 - str r1, [r0, 0x1C] - ldr r1, =DestroyAnimSprite - bl StoreSpriteCallbackInData6 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5944 - - thumb_func_start sub_80D5968 -sub_80D5968: @ 80D5968 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080D598C - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - b _080D5990 - .pool -_080D598C: - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimTarget -_080D5990: - ldrb r0, [r0] - adds r0, r1 - ldrb r7, [r0] - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x4] - movs r3, 0 - strh r0, [r6, 0x2E] - ldr r0, =gSprites - lsls r4, r7, 4 - adds r4, r7 - lsls r4, 2 - adds r4, r0 - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r6, 0x30] - ldrh r0, [r4, 0x20] - strh r0, [r6, 0x32] - ldrh r0, [r4, 0x26] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r6, 0x34] - ldrh r0, [r4, 0x22] - strh r0, [r6, 0x36] - adds r0, r6, 0 - str r3, [sp] - bl sub_80A6E14 - ldr r3, [sp] - strh r3, [r6, 0x34] - strh r3, [r6, 0x36] - ldrh r0, [r4, 0x24] - strh r0, [r6, 0x38] - ldrh r0, [r4, 0x26] - strh r0, [r6, 0x3A] - adds r2, r6, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r1, 0x2 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _080D5A00 - strh r3, [r6, 0x32] - b _080D5A06 - .pool -_080D5A00: - cmp r0, 0x2 - bne _080D5A06 - strh r3, [r6, 0x30] -_080D5A06: - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0x2] - lsls r0, r7, 8 - orrs r0, r1 - strh r0, [r6, 0x3C] - ldr r0, =sub_80D5A24 - str r0, [r6, 0x1C] - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5968 - - thumb_func_start sub_80D5A24 -sub_80D5A24: @ 80D5A24 - push {r4-r6,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x3C] - lsls r1, r0, 24 - lsrs r4, r1, 24 - adds r5, r4, 0 - lsls r0, 16 - asrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r3, r1, r0 - ldrh r0, [r2, 0x2E] - movs r6, 0x2E - ldrsh r1, [r2, r6] - cmp r1, 0 - bne _080D5A64 - cmp r4, 0x1 - bhi _080D5A4E - strh r1, [r3, 0x24] -_080D5A4E: - cmp r5, 0x2 - beq _080D5A56 - cmp r5, 0 - bne _080D5A58 -_080D5A56: - strh r1, [r3, 0x26] -_080D5A58: - adds r0, r2, 0 - bl DestroyAnimSprite - b _080D5A8E - .pool -_080D5A64: - subs r0, 0x1 - strh r0, [r2, 0x2E] - ldrh r1, [r2, 0x30] - ldrh r0, [r2, 0x34] - adds r1, r0 - strh r1, [r2, 0x34] - ldrh r0, [r2, 0x32] - ldrh r4, [r2, 0x36] - adds r0, r4 - strh r0, [r2, 0x36] - lsls r1, 16 - asrs r1, 24 - ldrh r6, [r2, 0x38] - adds r1, r6 - strh r1, [r3, 0x24] - ldrh r0, [r2, 0x36] - lsls r0, 16 - asrs r0, 24 - ldrh r2, [r2, 0x3A] - adds r0, r2 - strh r0, [r3, 0x26] -_080D5A8E: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D5A24 - - thumb_func_start sub_80D5A94 -sub_80D5A94: @ 80D5A94 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080D5AB0 - ldr r0, =gBattleAnimAttacker - b _080D5AB2 - .pool -_080D5AB0: - ldr r0, =gBattleAnimTarget -_080D5AB2: - ldrb r2, [r0] - ldr r0, =gBattlerSpriteIds - adds r0, r2, r0 - ldrb r6, [r0] - adds r0, r2, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5ADC - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] - movs r2, 0x6 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _080D5ADC - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080D5ADC: - ldr r2, =gBattleAnimArgs - ldrh r0, [r2, 0x8] - movs r4, 0 - strh r0, [r5, 0x2E] - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x20] - strh r0, [r5, 0x30] - ldrh r0, [r2, 0x2] - ldrh r3, [r1, 0x20] - adds r0, r3 - strh r0, [r5, 0x32] - ldrh r0, [r1, 0x22] - strh r0, [r5, 0x34] - ldrh r0, [r2, 0x4] - ldrh r1, [r1, 0x22] - adds r0, r1 - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl sub_80A6E14 - strh r4, [r5, 0x34] - strh r4, [r5, 0x36] - strh r6, [r5, 0x38] - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A6680 - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5A94 - - thumb_func_start sub_80D5B48 -sub_80D5B48: @ 80D5B48 - push {r4-r7,lr} - adds r6, r0, 0 - adds r2, r6, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080D5B70 - ldr r0, =gBattleAnimAttacker - b _080D5B72 - .pool -_080D5B70: - ldr r0, =gBattleAnimTarget -_080D5B72: - ldrb r1, [r0] - ldr r0, =gBattlerSpriteIds - adds r0, r1, r0 - ldrb r7, [r0] - adds r0, r1, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5B9C - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] - movs r2, 0x6 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _080D5B9C - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080D5B9C: - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x8] - strh r0, [r6, 0x2E] - ldr r0, =gSprites - lsls r4, r7, 4 - adds r4, r7 - lsls r4, 2 - adds r4, r0 - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r6, 0x30] - ldrh r1, [r5, 0x2] - adds r0, r1 - strh r0, [r6, 0x32] - ldrh r0, [r4, 0x26] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r6, 0x34] - ldrh r1, [r5, 0x4] - adds r0, r1 - strh r0, [r6, 0x36] - adds r0, r6, 0 - bl sub_80A6E14 - ldrh r0, [r4, 0x24] - lsls r0, 8 - strh r0, [r6, 0x34] - ldrh r0, [r4, 0x26] - lsls r0, 8 - strh r0, [r6, 0x36] - strh r7, [r6, 0x38] - ldrh r0, [r5, 0xA] - strh r0, [r6, 0x3A] - lsls r0, 16 - cmp r0, 0 - bne _080D5C04 - ldr r1, =DestroyAnimSprite - adds r0, r6, 0 - bl StoreSpriteCallbackInData6 - b _080D5C0C - .pool -_080D5C04: - ldr r1, =sub_80D5C20 - adds r0, r6, 0 - bl StoreSpriteCallbackInData6 -_080D5C0C: - ldr r0, =sub_80A6680 - str r0, [r6, 0x1C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5B48 - - thumb_func_start sub_80D5C20 -sub_80D5C20: @ 80D5C20 - push {r4,lr} - ldr r4, =gSprites - movs r1, 0x38 - ldrsh r2, [r0, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - movs r3, 0 - strh r3, [r1, 0x24] - movs r1, 0x38 - ldrsh r2, [r0, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - strh r3, [r1, 0x26] - bl DestroyAnimSprite - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5C20 - - thumb_func_start AnimTask_WindUpLunge -AnimTask_WindUpLunge: @ 80D5C50 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r5, =gBattleAnimArgs - movs r0, 0x6 - ldrsh r1, [r5, r0] - movs r0, 0x80 - lsls r0, 8 - bl __divsi3 - lsls r0, 16 - lsrs r7, r0, 16 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5C82 - ldrh r0, [r5, 0x2] - negs r0, r0 - strh r0, [r5, 0x2] - ldrh r0, [r5, 0xA] - negs r0, r0 - strh r0, [r5, 0xA] -_080D5C82: - ldrb r0, [r5] - bl GetAnimBattlerSpriteId - ldr r1, =gTasks - lsls r4, r6, 2 - adds r4, r6 - lsls r4, 3 - adds r4, r1 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x8] - movs r1, 0x2 - ldrsh r0, [r5, r1] - lsls r0, 8 - movs r2, 0x6 - ldrsh r1, [r5, r2] - bl __divsi3 - strh r0, [r4, 0xA] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0xC] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0xE] - ldrh r0, [r5, 0x8] - strh r0, [r4, 0x10] - movs r1, 0xA - ldrsh r0, [r5, r1] - lsls r0, 8 - movs r2, 0xC - ldrsh r1, [r5, r2] - bl __divsi3 - strh r0, [r4, 0x12] - ldrh r0, [r5, 0xC] - strh r0, [r4, 0x14] - strh r7, [r4, 0x16] - ldr r0, =sub_80D5CE4 - str r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_WindUpLunge - - thumb_func_start sub_80D5CE4 -sub_80D5CE4: @ 80D5CE4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r5, r1, r2 - ldrb r1, [r5, 0x8] - ldrh r0, [r5, 0xA] - ldrh r2, [r5, 0x1E] - adds r0, r2 - strh r0, [r5, 0x1E] - ldr r2, =gSprites - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - adds r4, r2 - lsls r0, 16 - asrs r0, 24 - strh r0, [r4, 0x24] - ldrh r0, [r5, 0x1C] - lsrs r0, 8 - movs r2, 0xC - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r5, 0x16] - ldrh r1, [r5, 0x1C] - adds r0, r1 - strh r0, [r5, 0x1C] - ldrh r0, [r5, 0xE] - subs r0, 0x1 - strh r0, [r5, 0xE] - lsls r0, 16 - cmp r0, 0 - bne _080D5D34 - ldr r0, =sub_80D5D48 - str r0, [r5] -_080D5D34: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5CE4 - - thumb_func_start sub_80D5D48 -sub_80D5D48: @ 80D5D48 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0x10] - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _080D5D70 - subs r0, r1, 0x1 - strh r0, [r4, 0x10] - b _080D5DA4 - .pool -_080D5D70: - ldrb r0, [r4, 0x8] - ldrh r2, [r4, 0x12] - ldrh r1, [r4, 0x20] - adds r2, r1 - strh r2, [r4, 0x20] - ldr r3, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - lsls r2, 16 - asrs r2, 24 - ldrh r0, [r4, 0x1E] - lsls r0, 16 - asrs r0, 24 - adds r2, r0 - strh r2, [r1, 0x24] - ldrh r0, [r4, 0x14] - subs r0, 0x1 - strh r0, [r4, 0x14] - lsls r0, 16 - cmp r0, 0 - bne _080D5DA4 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080D5DA4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5D48 - - thumb_func_start sub_80D5DB0 -sub_80D5DB0: @ 80D5DB0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gBattleAnimArgs - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0x2 - beq _080D5DDE - cmp r0, 0x2 - bgt _080D5DD8 - cmp r0, 0 - blt _080D5E10 - ldrb r0, [r1] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r2, r0, 24 - b _080D5E18 - .pool -_080D5DD8: - cmp r0, 0x3 - beq _080D5DE8 - b _080D5E10 -_080D5DDE: - ldr r5, =gBattleAnimAttacker - b _080D5DEA - .pool -_080D5DE8: - ldr r5, =gBattleAnimTarget -_080D5DEA: - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080D5E10 - ldr r1, =gBattlerSpriteIds - ldrb r0, [r5] - eors r0, r4 - adds r0, r1 - ldrb r2, [r0] - b _080D5E18 - .pool -_080D5E10: - adds r0, r6, 0 - bl DestroyAnimVisualTask - b _080D5E58 -_080D5E18: - ldr r1, =gTasks - lsls r4, r6, 2 - adds r0, r4, r6 - lsls r0, 3 - adds r5, r0, r1 - strh r2, [r5, 0x8] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5E44 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x2] - b _080D5E4A - .pool -_080D5E44: - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x2] - negs r0, r0 -_080D5E4A: - strh r0, [r5, 0xA] - ldr r0, =gTasks - adds r1, r4, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D5E6C - str r0, [r1] -_080D5E58: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5DB0 - - thumb_func_start sub_80D5E6C -sub_80D5E6C: @ 80D5E6C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r2, [r1, 0x8] - ldr r3, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r1, 0xA] - ldrh r2, [r0, 0x24] - adds r1, r2 - strh r1, [r0, 0x24] - movs r2, 0x24 - ldrsh r1, [r0, r2] - movs r2, 0x20 - ldrsh r0, [r0, r2] - adds r1, r0 - adds r1, 0x20 - movs r0, 0x98 - lsls r0, 1 - cmp r1, r0 - bls _080D5EAA - adds r0, r4, 0 - bl DestroyAnimVisualTask -_080D5EAA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5E6C - - thumb_func_start AnimTask_SwayMon -AnimTask_SwayMon: @ 80D5EB8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gBattleAnimAttacker - ldrb r0, [r6] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5ED4 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] -_080D5ED4: - ldr r4, =gBattleAnimArgs - ldrb r0, [r4, 0x8] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r3, r5, 2 - adds r1, r3, r5 - lsls r1, 3 - adds r2, r1, r2 - ldrh r1, [r4] - strh r1, [r2, 0x8] - ldrh r1, [r4, 0x2] - strh r1, [r2, 0xA] - ldrh r1, [r4, 0x4] - strh r1, [r2, 0xC] - ldrh r1, [r4, 0x6] - strh r1, [r2, 0xE] - strh r0, [r2, 0x10] - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080D5F14 - ldrb r0, [r6] - b _080D5F18 - .pool -_080D5F14: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] -_080D5F18: - strh r0, [r2, 0x12] - ldr r1, =gTasks - adds r0, r3, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x20] - ldr r1, =sub_80D5F3C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_SwayMon - - thumb_func_start sub_80D5F3C -sub_80D5F3C: @ 80D5F3C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r4, r0, r1 - ldrb r7, [r4, 0x10] - ldrh r0, [r4, 0xC] - ldrh r1, [r4, 0x1C] - adds r0, r1 - lsls r1, r0, 16 - strh r0, [r4, 0x1C] - lsrs r1, 24 - mov r8, r1 - mov r0, r8 - movs r2, 0xA - ldrsh r1, [r4, r2] - bl Sin - lsls r0, 16 - lsrs r5, r0, 16 - mov r9, r5 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080D5F94 - ldr r0, =gSprites - lsls r2, r7, 4 - adds r1, r2, r7 - lsls r1, 2 - adds r1, r0 - strh r5, [r1, 0x24] - mov r9, r0 - adds r4, r2, 0 - b _080D5FDA - .pool -_080D5F94: - ldrb r0, [r4, 0x12] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080D5FBC - ldr r1, =gSprites - lsls r2, r7, 4 - adds r0, r2, r7 - lsls r0, 2 - adds r3, r0, r1 - lsls r0, r5, 16 - asrs r0, 16 - mov r9, r1 - adds r4, r2, 0 - cmp r0, 0 - bge _080D5FD8 - b _080D5FD6 - .pool -_080D5FBC: - ldr r1, =gSprites - lsls r2, r7, 4 - adds r0, r2, r7 - lsls r0, 2 - adds r3, r0, r1 - mov r4, r9 - lsls r0, r4, 16 - asrs r0, 16 - mov r9, r1 - adds r4, r2, 0 - cmp r0, 0 - bge _080D5FD6 - negs r0, r0 -_080D5FD6: - negs r0, r0 -_080D5FD8: - strh r0, [r3, 0x26] -_080D5FDA: - mov r5, r8 - cmp r5, 0x7F - bls _080D5FFC - ldr r1, =gTasks - lsls r2, r6, 2 - adds r0, r2, r6 - lsls r0, 3 - adds r3, r0, r1 - movs r5, 0x1E - ldrsh r0, [r3, r5] - adds r5, r1, 0 - cmp r0, 0 - bne _080D5FFC - movs r1, 0x20 - ldrsh r0, [r3, r1] - cmp r0, 0x1 - beq _080D601E -_080D5FFC: - mov r2, r8 - cmp r2, 0x7E - bhi _080D6050 - ldr r1, =gTasks - lsls r2, r6, 2 - adds r0, r2, r6 - lsls r0, 3 - adds r3, r0, r1 - movs r5, 0x1E - ldrsh r0, [r3, r5] - adds r5, r1, 0 - cmp r0, 0x1 - bne _080D6050 - movs r1, 0x20 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _080D6050 -_080D601E: - adds r1, r2, r6 - lsls r1, 3 - adds r1, r5 - ldrh r0, [r1, 0x1E] - movs r2, 0x1 - eors r0, r2 - strh r0, [r1, 0x1E] - ldrh r0, [r1, 0x20] - eors r0, r2 - strh r0, [r1, 0x20] - ldrh r0, [r1, 0xE] - subs r0, 0x1 - strh r0, [r1, 0xE] - lsls r0, 16 - asrs r3, r0, 16 - cmp r3, 0 - bne _080D6050 - adds r0, r4, r7 - lsls r0, 2 - add r0, r9 - strh r3, [r0, 0x24] - strh r3, [r0, 0x26] - adds r0, r6, 0 - bl DestroyAnimVisualTask -_080D6050: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5F3C - - thumb_func_start AnimTask_ScaleMonAndRestore -AnimTask_ScaleMonAndRestore: @ 80D6064 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gBattleAnimArgs - ldrb r0, [r6, 0x6] - bl GetAnimBattlerSpriteId - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r1, [r6, 0x8] - adds r0, r5, 0 - bl sub_80A7270 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r6] - strh r1, [r0, 0x8] - ldrh r1, [r6, 0x2] - strh r1, [r0, 0xA] - ldrh r1, [r6, 0x4] - strh r1, [r0, 0xC] - ldrh r1, [r6, 0x4] - strh r1, [r0, 0xE] - strh r5, [r0, 0x10] - movs r1, 0x80 - lsls r1, 1 - strh r1, [r0, 0x1C] - strh r1, [r0, 0x1E] - ldr r1, =sub_80D60BC - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ScaleMonAndRestore - - thumb_func_start sub_80D60BC -sub_80D60BC: @ 80D60BC - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x8] - ldrh r1, [r4, 0x1C] - adds r0, r1 - strh r0, [r4, 0x1C] - ldrh r0, [r4, 0xA] - ldrh r3, [r4, 0x1E] - adds r0, r3 - strh r0, [r4, 0x1E] - ldrb r0, [r4, 0x10] - adds r6, r0, 0 - movs r0, 0x1C - ldrsh r1, [r4, r0] - movs r3, 0x1E - ldrsh r2, [r4, r3] - adds r0, r6, 0 - movs r3, 0 - bl obj_id_set_rotscale - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - bne _080D612C - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r0, 0 - ble _080D6120 - ldrh r0, [r4, 0x8] - negs r0, r0 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xA] - negs r0, r0 - strh r0, [r4, 0xA] - strh r2, [r4, 0xC] - strh r1, [r4, 0xE] - b _080D612C - .pool -_080D6120: - adds r0, r6, 0 - bl sub_80A7344 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080D612C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D60BC - - thumb_func_start sub_80D6134 -sub_80D6134: @ 80D6134 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4, 0x4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r1, 0 - bl sub_80A7270 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r2, r0, r1 - movs r1, 0 - strh r1, [r2, 0xA] - ldrh r0, [r4] - strh r0, [r2, 0xC] - movs r3, 0x6 - ldrsh r0, [r4, r3] - cmp r0, 0x1 - beq _080D6178 - strh r1, [r2, 0xE] - b _080D6184 - .pool -_080D6178: - ldrh r0, [r4] - ldrh r1, [r4, 0x2] - adds r3, r0, 0 - muls r3, r1 - adds r0, r3, 0 - strh r0, [r2, 0xE] -_080D6184: - ldr r1, =gTasks - lsls r4, r7, 2 - adds r0, r4, r7 - lsls r0, 3 - adds r5, r0, r1 - ldr r6, =gBattleAnimArgs - ldrh r0, [r6, 0x2] - strh r0, [r5, 0x10] - mov r0, r8 - strh r0, [r5, 0x12] - ldrh r0, [r6, 0x6] - strh r0, [r5, 0x14] - bl IsContest - lsls r0, 24 - mov r8, r4 - cmp r0, 0 - beq _080D61B8 - movs r0, 0x1 - strh r0, [r5, 0x16] - b _080D61DC - .pool -_080D61B8: - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080D61C8 - ldr r0, =gBattleAnimAttacker - b _080D61CA - .pool -_080D61C8: - ldr r0, =gBattleAnimTarget -_080D61CA: - ldrb r0, [r0] - bl GetBattlerSide - movs r1, 0 - lsls r0, 24 - cmp r0, 0 - bne _080D61DA - movs r1, 0x1 -_080D61DA: - strh r1, [r5, 0x16] -_080D61DC: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r4, r1, r0 - movs r3, 0x16 - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _080D6208 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080D6208 - movs r1, 0xE - ldrsh r0, [r4, r1] - negs r0, r0 - strh r0, [r4, 0xE] - movs r2, 0x10 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x10] -_080D6208: - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D6308 - str r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D6134 - - thumb_func_start sub_80D622C -sub_80D622C: @ 80D622C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4, 0x4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r1, 0 - bl sub_80A7270 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xA] - ldrh r1, [r4] - strh r1, [r0, 0xC] - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080D6274 - ldr r0, =gBattleAnimAttacker - b _080D6276 - .pool -_080D6274: - ldr r0, =gBattleAnimTarget -_080D6276: - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D6288 - ldrh r0, [r4, 0x2] - negs r0, r0 - strh r0, [r4, 0x2] -_080D6288: - ldr r0, =gBattleAnimArgs - movs r2, 0x6 - ldrsh r1, [r0, r2] - adds r6, r0, 0 - cmp r1, 0x1 - beq _080D62B0 - ldr r2, =gTasks - lsls r3, r5, 2 - adds r0, r3, r5 - lsls r0, 3 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0xE] - b _080D62CA - .pool -_080D62B0: - ldr r3, =gTasks - lsls r4, r5, 2 - adds r0, r4, r5 - lsls r0, 3 - adds r0, r3 - ldrh r2, [r6] - ldrh r1, [r6, 0x2] - adds r7, r2, 0 - muls r7, r1 - adds r1, r7, 0 - strh r1, [r0, 0xE] - adds r2, r3, 0 - adds r3, r4, 0 -_080D62CA: - adds r1, r3, r5 - lsls r1, 3 - adds r1, r2 - ldrh r0, [r6, 0x2] - strh r0, [r1, 0x10] - mov r0, r8 - strh r0, [r1, 0x12] - ldrh r0, [r6, 0x6] - strh r0, [r1, 0x14] - movs r0, 0x1 - strh r0, [r1, 0x16] - movs r2, 0xE - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1, 0xE] - movs r7, 0x10 - ldrsh r0, [r1, r7] - negs r0, r0 - strh r0, [r1, 0x10] - ldr r0, =sub_80D6308 - str r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D622C - - thumb_func_start sub_80D6308 -sub_80D6308: @ 80D6308 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x10] - ldrh r1, [r4, 0xE] - adds r0, r1 - strh r0, [r4, 0xE] - ldrb r0, [r4, 0x12] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0xE] - adds r1, r2, 0 - bl obj_id_set_rotscale - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _080D633C - ldrb r0, [r4, 0x12] - bl sub_80A73A0 -_080D633C: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - movs r2, 0xC - ldrsh r1, [r4, r2] - cmp r0, r1 - blt _080D6382 - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080D6364 - cmp r0, 0x1 - ble _080D636A - cmp r0, 0x2 - beq _080D6372 - b _080D636A - .pool -_080D6364: - ldrb r0, [r4, 0x12] - bl sub_80A7344 -_080D636A: - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D6382 -_080D6372: - movs r0, 0 - strh r0, [r4, 0xA] - movs r2, 0x10 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x10] - movs r0, 0x1 - strh r0, [r4, 0x14] -_080D6382: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80D6308 - - thumb_func_start sub_80D6388 -sub_80D6388: @ 80D6388 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleAnimArgs - movs r2, 0 - ldrsh r1, [r0, r2] - mov r8, r0 - cmp r1, 0 - bne _080D63C0 - ldr r4, =gTasks - lsls r5, r7, 2 - adds r0, r5, r7 - lsls r0, 3 - adds r6, r0, r4 - ldr r0, =gAnimMovePower - ldrh r0, [r0] - movs r1, 0xC - bl __udivsi3 - b _080D63D4 - .pool -_080D63C0: - ldr r4, =gTasks - lsls r5, r7, 2 - adds r0, r5, r7 - lsls r0, 3 - adds r6, r0, r4 - ldr r0, =gAnimMoveDmg - ldr r0, [r0] - movs r1, 0xC - bl __divsi3 -_080D63D4: - strh r0, [r6, 0x26] - lsls r0, 16 - adds r1, r4, 0 - cmp r0, 0 - bgt _080D63E2 - movs r0, 0x1 - strh r0, [r6, 0x26] -_080D63E2: - movs r2, 0x26 - ldrsh r0, [r6, r2] - cmp r0, 0x10 - ble _080D63EE - movs r0, 0x10 - strh r0, [r6, 0x26] -_080D63EE: - adds r4, r5, r7 - lsls r4, 3 - adds r4, r1 - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - movs r5, 0 - strh r1, [r4, 0x24] - ldrh r2, [r4, 0x26] - movs r0, 0x1 - ands r0, r2 - adds r1, r0 - strh r1, [r4, 0x22] - strh r5, [r4, 0x20] - mov r1, r8 - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x1C] - ldrh r0, [r1, 0x8] - strh r0, [r4, 0x1E] - movs r0, 0x1 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x16] - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x24] - strh r0, [r4, 0x18] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x26] - strh r0, [r4, 0x1A] - strh r5, [r4, 0x8] - mov r1, r8 - ldrh r0, [r1, 0x2] - strh r0, [r4, 0xA] - ldrh r0, [r1, 0x4] - strh r0, [r4, 0xC] - ldr r0, =sub_80D646C - str r0, [r4] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D6388 - - thumb_func_start sub_80D646C -sub_80D646C: @ 80D646C - 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 r3, r0, r1 - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] - lsls r0, 16 - asrs r0, 16 - movs r2, 0xA - ldrsh r1, [r3, r2] - cmp r0, r1 - ble _080D654A - movs r0, 0 - strh r0, [r3, 0x8] - ldrh r0, [r3, 0x20] - adds r1, r0, 0x1 - movs r0, 0x1 - ands r1, r0 - strh r1, [r3, 0x20] - movs r2, 0x1C - ldrsh r0, [r3, r2] - cmp r0, 0 - beq _080D64DE - cmp r1, 0 - beq _080D64C8 - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x22] - ldrh r2, [r3, 0x18] - adds r1, r2 - b _080D64DC - .pool -_080D64C8: - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x18] - ldrh r2, [r3, 0x24] - subs r1, r2 -_080D64DC: - strh r1, [r0, 0x24] -_080D64DE: - movs r1, 0x1E - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _080D6518 - movs r2, 0x20 - ldrsh r4, [r3, r2] - cmp r4, 0 - beq _080D6508 - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x26] - strh r1, [r0, 0x26] - b _080D6518 - .pool -_080D6508: - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x26] -_080D6518: - ldrh r0, [r3, 0xC] - subs r0, 0x1 - strh r0, [r3, 0xC] - lsls r0, 16 - asrs r4, r0, 16 - cmp r4, 0 - bne _080D654A - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x24] - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x26] - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080D654A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D646C - - .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 3ae637c37..9af3ed7a9 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -6166,7 +6166,7 @@ Move_WING_ATTACK: monbgprio_28 ANIM_TARGET setalpha 12, 8 loopsewithpan SE_W017, -64, 20, 2 - createvisualtask sub_80D5738, 2, 0, 12, 4, 1, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 0, 12, 4, 1, 4 createvisualtask sub_810DED8, 5, 1, 70 createsprite gBattleAnimSpriteTemplate_85962A4, 2, -25, 0, 0, 0, 20 createsprite gBattleAnimSpriteTemplate_85962A4, 2, 25, 0, 0, 0, 20 @@ -6694,8 +6694,8 @@ Move_SUBMISSION: waitplaysewithpan SE_W004, +63, 70 waitplaysewithpan SE_W104, -64, 80 waitplaysewithpan SE_W004, +63, 0x5A - createvisualtask sub_80D5738, 2, 0, -18, 6, 6, 4 - createvisualtask sub_80D5738, 2, 1, 18, 6, 6, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 0, -18, 6, 6, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 1, 18, 6, 6, 4 call Submission1 call Submission1 call Submission1 @@ -7219,7 +7219,7 @@ Move_STEEL_WING: monbgprio_28 ANIM_TARGET setalpha 12, 8 loopsewithpan SE_W017, -64, 20, 2 - createvisualtask sub_80D5738, 2, 0, 12, 4, 1, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 0, 12, 4, 1, 4 createvisualtask sub_810DED8, 5, 1, 70 createsprite gBattleAnimSpriteTemplate_85962A4, 2, -25, 0, 0, 0, 20 createsprite gBattleAnimSpriteTemplate_85962A4, 2, 25, 0, 0, 0, 20 diff --git a/include/battle_anim.h b/include/battle_anim.h index 2b5b3e20c..200b9fdb1 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -39,7 +39,7 @@ extern bool8 gAnimScriptActive; extern u8 gAnimVisualTaskCount; extern u8 gAnimSoundTaskCount; extern struct DisableStruct *gAnimDisableStructPtr; -extern u32 gAnimMoveDmg; +extern s32 gAnimMoveDmg; extern u16 gAnimMovePower; extern u8 gAnimFriendship; extern u16 gWeatherMoveAnim; @@ -80,6 +80,13 @@ void sub_80A6B30(struct UnknownAnimStruct2*); void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); u8 sub_80A82E4(u8 battlerId); bool8 TranslateAnimArc(struct Sprite *sprite); +void sub_80A6630(struct Sprite *sprite); +void sub_80A6680(struct Sprite *sprite); +void sub_80A7344(u8 spriteId); +void obj_id_set_rotscale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation); +void sub_80A6E14(struct Sprite *sprite); +void sub_80A7270(u8 spriteId, u8 objMode); +void sub_80A73A0(u8 spriteId); enum { diff --git a/ld_script.txt b/ld_script.txt index 6221f0501..43a556034 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -134,7 +134,7 @@ SECTIONS { src/mail_data.o(.text); src/map_name_popup.o(.text); src/item_menu_icons.o(.text); - asm/battle_anim_80D51AC.o(.text); + src/battle_anim_80D51AC.o(.text); src/item.o(.text); src/contest.o(.text); asm/contest.o(.text); diff --git a/src/battle_anim.c b/src/battle_anim.c index 4989b0fb2..0a5395b02 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -107,7 +107,7 @@ EWRAM_DATA bool8 gAnimScriptActive = FALSE; EWRAM_DATA u8 gAnimVisualTaskCount = 0; EWRAM_DATA u8 gAnimSoundTaskCount = 0; EWRAM_DATA struct DisableStruct *gAnimDisableStructPtr = NULL; -EWRAM_DATA u32 gAnimMoveDmg = 0; +EWRAM_DATA s32 gAnimMoveDmg = 0; EWRAM_DATA u16 gAnimMovePower = 0; EWRAM_DATA static u16 sAnimSpriteIndexArray[ANIM_SPRITE_INDEX_COUNT] = {0}; EWRAM_DATA u8 gAnimFriendship = 0; diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c index f799b091b..f4a4946c3 100644 --- a/src/battle_anim_80A5C6C.c +++ b/src/battle_anim_80A5C6C.c @@ -38,7 +38,6 @@ extern const union AffineAnimCmd *gUnknown_082FF6C0[]; void sub_80A64EC(struct Sprite *sprite); void sub_80A653C(struct Sprite *sprite); void InitAnimLinearTranslation(struct Sprite *sprite); -void sub_80A6E14(struct Sprite *sprite); void sub_80A6FB4(struct Sprite *sprite); void sub_80A6F98(struct Sprite *sprite); void sub_80A7144(struct Sprite *sprite); diff --git a/src/battle_anim_80D51AC.c b/src/battle_anim_80D51AC.c new file mode 100644 index 000000000..fc0815a7d --- /dev/null +++ b/src/battle_anim_80D51AC.c @@ -0,0 +1,1007 @@ +#include "global.h" +#include "battle.h" +#include "battle_anim.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" + +#define TASK gTasks[taskId] +#define SPRITE gSprites[TASK.data[0]] + +// This file's functions. +void AnimTask_ShakeMonStep(u8 taskId); +void AnimTask_ShakeMon2Step(u8 taskId); +void AnimTask_ShakeMonInPlaceStep(u8 taskId); +void AnimTask_ShakeAndSinkMonStep(u8 taskId); +void sub_80D57B8(u8 taskId); +void DoHorizontalLunge(struct Sprite *sprite); +void ReverseHorizontalLungeDirection(struct Sprite *sprite); +void DoVerticalDip(struct Sprite *sprite); +void ReverseVerticalDipDirection(struct Sprite* sprite); +void SlideMonToOriginalPos(struct Sprite *sprite); +void SlideMonToOriginalPosStep(struct Sprite *sprite); +void SlideMonToOffset(struct Sprite *sprite); +void sub_80D5B48(struct Sprite *sprite); +void sub_80D5C20(struct Sprite *sprite); +void AnimTask_WindUpLungePart1(u8 taskId); +void AnimTask_WindUpLungePart2(u8 taskId); +void AnimTask_SwayMonStep(u8 taskId); +void AnimTask_ScaleMonAndRestoreStep(u8 taskId); +void sub_80D6308(u8 taskId); +void sub_80D646C(u8 taskId); +void sub_80A8B3C(u8 taskId); + +// Task to facilitate simple shaking of a pokemon's picture in battle. +// The shaking alternates between the original position and the target position. +// arg 0: anim battler +// arg 1: x pixel offset +// arg 2: y pixel offset +// arg 3: num times to shake +// arg 4: frame delay +void AnimTask_ShakeMon(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (spriteId == 0xff) + { + DestroyAnimVisualTask(taskId); + return; + } + gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; + gSprites[spriteId].pos2.y = gBattleAnimArgs[2]; + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[3]; + TASK.data[2] = gBattleAnimArgs[4]; + TASK.data[3] = gBattleAnimArgs[4]; + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = gBattleAnimArgs[2]; + TASK.func = AnimTask_ShakeMonStep; + AnimTask_ShakeMonStep(taskId); +} + +void AnimTask_ShakeMonStep(u8 taskId) +{ + if (TASK.data[3] == 0) + { + if (SPRITE.pos2.x == 0) + { + SPRITE.pos2.x = TASK.data[4]; + } + else + { + SPRITE.pos2.x = 0; + } + if (SPRITE.pos2.y == 0) + { + SPRITE.pos2.y = TASK.data[5]; + } + else + { + SPRITE.pos2.y = 0; + } + TASK.data[3] = TASK.data[2]; + if (--TASK.data[1] == 0) + { + SPRITE.pos2.x = 0; + SPRITE.pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } + else + { + TASK.data[3]--; + } +} + +// Task to facilitate simple shaking of a pokemon's picture in battle. +// The shaking alternates between the positive and negative versions of the specified pixel offsets. +// arg 0: anim battler +// arg 1: x pixel offset +// arg 2: y pixel offset +// arg 3: num times to shake +// arg 4: frame delay +void AnimTask_ShakeMon2(u8 taskId) +{ + u8 spriteId; + bool8 destroy = FALSE; + u8 battlerId; + + if (gBattleAnimArgs[0] < 4) + { + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (spriteId == 0xff) + { + DestroyAnimVisualTask(taskId); + return; + } + } + else if (gBattleAnimArgs[0] != 8) + { + switch (gBattleAnimArgs[0]) + { + case 4: + battlerId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + break; + case 5: + battlerId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + break; + case 6: + battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + break; + case 7: + default: + battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + break; + } + + if (IsBattlerSpriteVisible(battlerId) == FALSE) + destroy = TRUE; + + spriteId = gBattlerSpriteIds[battlerId]; + } + else + { + spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + } + + if (destroy) + { + DestroyAnimVisualTask(taskId); + return; + } + + gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; + gSprites[spriteId].pos2.y = gBattleAnimArgs[2]; + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[3]; + TASK.data[2] = gBattleAnimArgs[4]; + TASK.data[3] = gBattleAnimArgs[4]; + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = gBattleAnimArgs[2]; + TASK.func = AnimTask_ShakeMon2Step; + TASK.func(taskId); +} + +void AnimTask_ShakeMon2Step(u8 taskId) +{ + if (TASK.data[3] == 0) + { + if (SPRITE.pos2.x == TASK.data[4]) + SPRITE.pos2.x = -TASK.data[4]; + else + SPRITE.pos2.x = TASK.data[4]; + + if (SPRITE.pos2.y == TASK.data[5]) + SPRITE.pos2.y = -TASK.data[5]; + else + SPRITE.pos2.y = TASK.data[5]; + + TASK.data[3] = TASK.data[2]; + if (--TASK.data[1] == 0) + { + SPRITE.pos2.x = 0; + SPRITE.pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } + else + { + TASK.data[3]--; + } +} + +// Task to facilitate simple shaking of a pokemon's picture in battle. +// The shaking alternates between the positive and negative versions of the specified pixel offsets +// with respect to the current location of the mon's picture. +// arg 0: battler +// arg 1: x offset +// arg 2: y offset +// arg 3: num shakes +// arg 4: delay +void AnimTask_ShakeMonInPlace(u8 taskId) +{ + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (spriteId == 0xff) + { + DestroyAnimVisualTask(taskId); + return; + } + + gSprites[spriteId].pos2.x += gBattleAnimArgs[1]; + gSprites[spriteId].pos2.y += gBattleAnimArgs[2]; + TASK.data[0] = spriteId; + TASK.data[1] = 0; + TASK.data[2] = gBattleAnimArgs[3]; + TASK.data[3] = 0; + TASK.data[4] = gBattleAnimArgs[4]; + TASK.data[5] = gBattleAnimArgs[1] * 2; + TASK.data[6] = gBattleAnimArgs[2] * 2; + TASK.func = AnimTask_ShakeMonInPlaceStep; + TASK.func(taskId); +} + +void AnimTask_ShakeMonInPlaceStep(u8 taskId) +{ + if (TASK.data[3] == 0) + { + if (TASK.data[1] & 1) + { + SPRITE.pos2.x += TASK.data[5]; + SPRITE.pos2.y += TASK.data[6]; + } + else + { + SPRITE.pos2.x -= TASK.data[5]; + SPRITE.pos2.y -= TASK.data[6]; + } + TASK.data[3] = TASK.data[4]; + if (++TASK.data[1] >= TASK.data[2]) + { + if (TASK.data[1] & 1) + { + SPRITE.pos2.x += TASK.data[5] / 2; + SPRITE.pos2.y += TASK.data[6] / 2; + } + else + { + SPRITE.pos2.x -= TASK.data[5] / 2; + SPRITE.pos2.y -= TASK.data[6] / 2; + } + DestroyAnimVisualTask(taskId); + return; + } + } + else + { + TASK.data[3]--; + } +} + +// Shakes a mon bg horizontally and moves it downward linearly. +// arg 0: battler +// arg 1: x offset +// arg 2: frame delay between each movement +// arg 3: downward speed (subpixel) +// arg 4: duration +void AnimTask_ShakeAndSinkMon(u8 taskId) +{ + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = gBattleAnimArgs[4]; + TASK.func = AnimTask_ShakeAndSinkMonStep; + TASK.func(taskId); +} + +void AnimTask_ShakeAndSinkMonStep(u8 taskId) +{ + s16 x; + u8 spriteId; + spriteId = TASK.data[0]; + x = TASK.data[1]; + if (TASK.data[2] == TASK.data[8]++) + { + TASK.data[8] = 0; + if (gSprites[spriteId].pos2.x == x) + x = -x; + + gSprites[spriteId].pos2.x += x; + } + + TASK.data[1] = x; + TASK.data[9] += TASK.data[3]; + gSprites[spriteId].pos2.y = TASK.data[9] >> 8; + if (--TASK.data[4] == 0) + { + DestroyAnimVisualTask(taskId); + return; + } +} + +// Moves a mon bg picture along an elliptical path that begins +// and ends at the mon's origin location. +// arg 0: battler +// arg 1: ellipse width +// arg 2: ellipse height +// arg 3: num loops +// arg 4: speed (valid values are 0-5) +void AnimTask_TranslateMonElliptical(u8 taskId) +{ + u8 i; + u8 spriteId; + u8 wavePeriod; + + wavePeriod = 1; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (gBattleAnimArgs[4] > 5) + gBattleAnimArgs[4] = 5; + + for (i = 0; i < gBattleAnimArgs[4]; i++) + { + wavePeriod <<= 1; + } + + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = wavePeriod; + TASK.func = sub_80D57B8; + TASK.func(taskId); +} + +void sub_80D57B8(u8 taskId) +{ + u8 spriteId = TASK.data[0]; + gSprites[spriteId].pos2.x = Sin(TASK.data[5], TASK.data[1]); + gSprites[spriteId].pos2.y = -Cos(TASK.data[5], TASK.data[2]); + gSprites[spriteId].pos2.y += TASK.data[2]; + TASK.data[5] += TASK.data[4]; + TASK.data[5] &= 0xff; + + if (TASK.data[5] == 0) + TASK.data[3]--; + + if (TASK.data[3] == 0) + { + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } +} + +// Moves a mon bg picture along an elliptical path that begins +// and ends at the mon's origin location. Reverses the direction +// of the path if it's not on the player's side of the battle. +// arg 0: battler +// arg 1: ellipse width +// arg 2: ellipse height +// arg 3: num loops +// arg 4: speed (valid values are 0-5) +void AnimTask_TranslateMonEllipticalRespectSide(u8 taskId) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + + AnimTask_TranslateMonElliptical(taskId); +} + +// Performs a simple horizontal lunge, where the mon moves +// horizontally, and then moves back in the opposite direction. +// arg 0: duration of single lunge direction +// arg 1: x pixel delta that is applied each frame +void DoHorizontalLunge(struct Sprite *sprite) +{ + sprite->invisible = TRUE; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + sprite->data[1] = -gBattleAnimArgs[1]; + else + sprite->data[1] = gBattleAnimArgs[1]; + + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[2] = 0; + sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker]; + sprite->data[4] = gBattleAnimArgs[0]; + StoreSpriteCallbackInData6(sprite, ReverseHorizontalLungeDirection); + sprite->callback = sub_80A6630; +} + +void ReverseHorizontalLungeDirection(struct Sprite *sprite) +{ + sprite->data[0] = sprite->data[4]; + sprite->data[1] = -sprite->data[1]; + sprite->callback = sub_80A6630; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +// Performs a simple vertical dipping motion, where moves vertically, and then +// moves back in the opposite direction. +// arg 0: duration of single dip direction +// arg 1: y pixel delta that is applied each frame +// arg 2: battler +void DoVerticalDip(struct Sprite *sprite) +{ + u8 spriteId; + sprite->invisible = TRUE; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[1] = 0; + sprite->data[2] = gBattleAnimArgs[1]; + sprite->data[3] = spriteId; + sprite->data[4] = gBattleAnimArgs[0]; + StoreSpriteCallbackInData6(sprite, ReverseVerticalDipDirection); + sprite->callback = sub_80A6630; +} + +void ReverseVerticalDipDirection(struct Sprite *sprite) +{ + sprite->data[0] = sprite->data[4]; + sprite->data[2] = -sprite->data[2]; + sprite->callback = sub_80A6630; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +// Linearly slides a mon's bg picture back to its original sprite position. +// The sprite parameter is a dummy sprite used for facilitating the movement with its callback. +// arg 0: 1 = target or 0 = attacker +// arg 1: direction (0 = horizontal and vertical, 1 = horizontal only, 2 = vertical only) +// arg 2: duration +void SlideMonToOriginalPos(struct Sprite *sprite) +{ + u32 monSpriteId; + if (!gBattleAnimArgs[0]) + monSpriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + else + monSpriteId = gBattlerSpriteIds[gBattleAnimTarget]; + + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gSprites[monSpriteId].pos1.x + gSprites[monSpriteId].pos2.x; + sprite->data[2] = gSprites[monSpriteId].pos1.x; + sprite->data[3] = gSprites[monSpriteId].pos1.y + gSprites[monSpriteId].pos2.y; + sprite->data[4] = gSprites[monSpriteId].pos1.y; + sub_80A6E14(sprite); + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[5] = gSprites[monSpriteId].pos2.x; + sprite->data[6] = gSprites[monSpriteId].pos2.y; + sprite->invisible = TRUE; + + if (gBattleAnimArgs[1] == 1) + sprite->data[2] = 0; + else if (gBattleAnimArgs[1] == 2) + sprite->data[1] = 0; + + sprite->data[7] = gBattleAnimArgs[1]; + sprite->data[7] |= monSpriteId << 8; + sprite->callback = SlideMonToOriginalPosStep; +} + +void SlideMonToOriginalPosStep(struct Sprite *sprite) +{ + s8 monSpriteId; + u8 lo; + struct Sprite *monSprite; + + lo = sprite->data[7] & 0xff; + monSpriteId = sprite->data[7] >> 8; + monSprite = &gSprites[monSpriteId]; + if (sprite->data[0] == 0) + { + if (lo < 2) + monSprite->pos2.x = 0; + + if (lo == 2 || lo == 0) + monSprite->pos2.y = 0; + + DestroyAnimSprite(sprite); + } + else + { + sprite->data[0]--; + sprite->data[3] += sprite->data[1]; + sprite->data[4] += sprite->data[2]; + monSprite->pos2.x = (s8)(sprite->data[3] >> 8) + sprite->data[5]; + monSprite->pos2.y = (s8)(sprite->data[4] >> 8) + sprite->data[6]; + } +} + +// Linearly translates a mon to a target offset. The horizontal offset +// is mirrored for the opponent's pokemon, and the vertical offset +// is only mirrored if arg 3 is set to 1. +// arg 0: 0 = attacker, 1 = target +// arg 1: target x pixel offset +// arg 2: target y pixel offset +// arg 3: mirror vertical translation for opposite battle side +// arg 4: duration +void SlideMonToOffset(struct Sprite *sprite) +{ + u8 battler; + u8 monSpriteId; + if (!gBattleAnimArgs[0]) + battler = gBattleAnimAttacker; + else + battler = gBattleAnimTarget; + + monSpriteId = gBattlerSpriteIds[battler]; + if (GetBattlerSide(battler) != B_SIDE_PLAYER) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + if (gBattleAnimArgs[3] == 1) + { + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + } + } + + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[1] = gSprites[monSpriteId].pos1.x; + sprite->data[2] = gSprites[monSpriteId].pos1.x + gBattleAnimArgs[1]; + sprite->data[3] = gSprites[monSpriteId].pos1.y; + sprite->data[4] = gSprites[monSpriteId].pos1.y + gBattleAnimArgs[2]; + sub_80A6E14(sprite); + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[5] = monSpriteId; + sprite->invisible = TRUE; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->callback = sub_80A6680; +} + +void sub_80D5B48(struct Sprite *sprite) +{ + u8 spriteId; + u8 battlerId; + sprite->invisible = TRUE; + if (!gBattleAnimArgs[0]) + { + battlerId = gBattleAnimAttacker; + } + else + { + battlerId = gBattleAnimTarget; + } + spriteId = gBattlerSpriteIds[battlerId]; + if (GetBattlerSide(battlerId)) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + if (gBattleAnimArgs[3] == 1) + { + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + } + } + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[1] = gSprites[spriteId].pos1.x + gSprites[spriteId].pos2.x; + sprite->data[2] = sprite->data[1] + gBattleAnimArgs[1]; + sprite->data[3] = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y; + sprite->data[4] = sprite->data[3] + gBattleAnimArgs[2]; + sub_80A6E14(sprite); + sprite->data[3] = gSprites[spriteId].pos2.x << 8; + sprite->data[4] = gSprites[spriteId].pos2.y << 8; + sprite->data[5] = spriteId; + sprite->data[6] = gBattleAnimArgs[5]; + if (!gBattleAnimArgs[5]) + { + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + } + else + { + StoreSpriteCallbackInData6(sprite, sub_80D5C20); + } + sprite->callback = sub_80A6680; +} + + +void sub_80D5C20(struct Sprite *sprite) +{ + gSprites[sprite->data[5]].pos2.x = 0; + gSprites[sprite->data[5]].pos2.y = 0; + DestroyAnimSprite(sprite); +} + +// Task to facilitate a two-part translation animation, in which the sprite +// is first translated in an arc to one position. Then, it "lunges" to a target +// x offset. Used in TAKE_DOWN, for example. +// arg 0: anim bank +// arg 1: horizontal speed (subpixel) +// arg 2: wave amplitude +// arg 3: first duration +// arg 4: delay before starting lunge +// arg 5: target x offset for lunge +// arg 6: lunge duration +void AnimTask_WindUpLunge(u8 taskId) +{ + s16 wavePeriod = 0x8000 / gBattleAnimArgs[3]; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + gBattleAnimArgs[5] = -gBattleAnimArgs[5]; + } + TASK.data[0] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + TASK.data[1] = (gBattleAnimArgs[1] << 8) / gBattleAnimArgs[3]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = gBattleAnimArgs[4]; + TASK.data[5] = (gBattleAnimArgs[5] << 8) / gBattleAnimArgs[6]; + TASK.data[6] = gBattleAnimArgs[6]; + TASK.data[7] = wavePeriod; + TASK.func = AnimTask_WindUpLungePart1; +} + +void AnimTask_WindUpLungePart1(u8 taskId) +{ + u8 spriteId; + spriteId = TASK.data[0]; + TASK.data[11] += TASK.data[1]; + gSprites[spriteId].pos2.x = TASK.data[11] >> 8; + gSprites[spriteId].pos2.y = Sin((u8)(TASK.data[10] >> 8), TASK.data[2]); + TASK.data[10] += TASK.data[7]; + if (--TASK.data[3] == 0) + { + TASK.func = AnimTask_WindUpLungePart2; + } +} + +void AnimTask_WindUpLungePart2(u8 taskId) +{ + u8 spriteId; + if (TASK.data[4] > 0) + { + TASK.data[4]--; + } + else + { + spriteId = TASK.data[0]; + TASK.data[12] += TASK.data[5]; + gSprites[spriteId].pos2.x = (TASK.data[12] >> 8) + (TASK.data[11] >> 8); + if (--TASK.data[6] == 0) + { + DestroyAnimVisualTask(taskId); + return; + } + } +} + +void sub_80D5DB0(u8 taskId) +{ + u8 spriteId; + switch (gBattleAnimArgs[0]) + { + case 0: + case 1: + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + break; + case 2: + if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) + { + DestroyAnimVisualTask(taskId); + return; + } + spriteId = gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]; + break; + case 3: + if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget))) + { + DestroyAnimVisualTask(taskId); + return; + } + spriteId = gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)]; + break; + default: + DestroyAnimVisualTask(taskId); + return; + } + TASK.data[0] = spriteId; + if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER) + { + TASK.data[1] = gBattleAnimArgs[1]; + } + else + { + TASK.data[1] = -gBattleAnimArgs[1]; + } + TASK.func = sub_80A8B3C; +} + +void sub_80A8B3C(u8 taskId) +{ + u8 spriteId = TASK.data[0]; + gSprites[spriteId].pos2.x += TASK.data[1]; + if (gSprites[spriteId].pos2.x + gSprites[spriteId].pos1.x + 0x20 > 0x130u) + { + DestroyAnimVisualTask(taskId); + return; + } +} + +// Task that facilitates translating the mon bg picture back and forth +// in a swaying motion (uses Sine wave). It can sway either horizontally +// or vertically, but not both. +// arg 0: direction (0 = horizontal, 1 = vertical) +// arg 1: wave amplitude +// arg 2: wave period +// arg 3: num sways +// arg 4: which mon (0 = attacker, 1`= target) +void AnimTask_SwayMon(u8 taskId) +{ + u8 spriteId; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[4]); + TASK.data[0] = gBattleAnimArgs[0]; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = spriteId; + + if (gBattleAnimArgs[4] == 0) + TASK.data[5] = gBattleAnimAttacker; + else + TASK.data[5] = gBattleAnimTarget; + + TASK.data[12] = 1; + TASK.func = AnimTask_SwayMonStep; +} + +void AnimTask_SwayMonStep(u8 taskId) +{ + s16 sineValue; + u8 spriteId; + int waveIndex; + u16 sineIndex; + + spriteId = TASK.data[4]; + sineIndex = TASK.data[10] + TASK.data[2]; + TASK.data[10] = sineIndex; + waveIndex = sineIndex >> 8; + sineValue = Sin(waveIndex, TASK.data[1]); + + if (TASK.data[0] == 0) + { + gSprites[spriteId].pos2.x = sineValue; + } + else + { + if (GetBattlerSide(TASK.data[5]) == B_SIDE_PLAYER) + { + gSprites[spriteId].pos2.y = (sineValue >= 0) ? sineValue : -sineValue; + } + else + { + gSprites[spriteId].pos2.y = (sineValue >= 0) ? -sineValue : sineValue; + } + } + + if (((waveIndex >= 0x80u) && (TASK.data[11] == 0) && (TASK.data[12] == 1)) + || ((waveIndex < 0x7fu) && (TASK.data[11] == 1) && (TASK.data[12] == 0))) + { + TASK.data[11] ^= 1; + TASK.data[12] ^= 1; + if (--TASK.data[3] == 0) + { + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } +} + +// Scales a mon's sprite, and then scales back to its original dimensions. +// arg 0: x scale delta +// arg 1: y scale delta +// arg 2: duration +// arg 3: anim bank +// arg 4: sprite object mode +void AnimTask_ScaleMonAndRestore(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]); + sub_80A7270(spriteId, gBattleAnimArgs[4]); + TASK.data[0] = gBattleAnimArgs[0]; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[2]; + TASK.data[4] = spriteId; + TASK.data[10] = 0x100; + TASK.data[11] = 0x100; + TASK.func = AnimTask_ScaleMonAndRestoreStep; +} + +void AnimTask_ScaleMonAndRestoreStep(u8 taskId) +{ + u8 spriteId; + TASK.data[10] += TASK.data[0]; + TASK.data[11] += TASK.data[1]; + spriteId = TASK.data[4]; + obj_id_set_rotscale(spriteId, TASK.data[10], TASK.data[11], 0); + if (--TASK.data[2] == 0) + { + if (TASK.data[3] > 0) + { + TASK.data[0] = -TASK.data[0]; + TASK.data[1] = -TASK.data[1]; + TASK.data[2] = TASK.data[3]; + TASK.data[3] = 0; + } + else + { + sub_80A7344(spriteId); + DestroyAnimVisualTask(taskId); + return; + } + } +} + +void sub_80D6134(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); + sub_80A7270(spriteId, 0); + TASK.data[1] = 0; + TASK.data[2] = gBattleAnimArgs[0]; + if (gBattleAnimArgs[3] != 1) + { + TASK.data[3] = 0; + } + else + { + TASK.data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; + } + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = spriteId; + TASK.data[6] = gBattleAnimArgs[3]; + if (IsContest()) + { + TASK.data[7] = 1; + } + else + { + if (gBattleAnimArgs[2] == 0) + { + TASK.data[7] = !GetBattlerSide(gBattleAnimAttacker); + } + else + { + TASK.data[7] = !GetBattlerSide(gBattleAnimTarget); + } + } + if (TASK.data[7]) + { + if (!IsContest()) + { + TASK.data[3] *= -1; + TASK.data[4] *= -1; + } + } + TASK.func = sub_80D6308; +} + +void sub_80D622C(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); + sub_80A7270(spriteId, 0); + TASK.data[1] = 0; + TASK.data[2] = gBattleAnimArgs[0]; + if (gBattleAnimArgs[2] == 0) + { + if (GetBattlerSide(gBattleAnimAttacker)) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + } + } + else + { + if (GetBattlerSide(gBattleAnimTarget)) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + } + } + if (gBattleAnimArgs[3] != 1) + { + TASK.data[3] = 0; + } + else + { + TASK.data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; + } + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = spriteId; + TASK.data[6] = gBattleAnimArgs[3]; + TASK.data[7] = 1; + TASK.data[3] *= -1; + TASK.data[4] *= -1; + TASK.func = sub_80D6308; +} + +void sub_80D6308(u8 taskId) +{ + TASK.data[3] += TASK.data[4]; + obj_id_set_rotscale(TASK.data[5], 0x100, 0x100, TASK.data[3]); + if (TASK.data[7]) + { + sub_80A73A0(TASK.data[5]); + } + if (++TASK.data[1] >= TASK.data[2]) + { + switch (TASK.data[6]) + { + case 1: + sub_80A7344(TASK.data[5]); + case 0: + default: + DestroyAnimVisualTask(taskId); + return; + case 2: + TASK.data[1] = 0; + TASK.data[4] *= -1; + TASK.data[6] = 1; + break; + } + } +} + +void sub_80D6388(u8 taskId) +{ + if (!gBattleAnimArgs[0]) + { + TASK.data[15] = gAnimMovePower / 12; + if (TASK.data[15] < 1) + { + TASK.data[15] = 1; + } + if (TASK.data[15] > 16) + { + TASK.data[15] = 16; + } + } + else + { + TASK.data[15] = gAnimMoveDmg / 12; + if (TASK.data[15] < 1) + { + TASK.data[15] = 1; + } + if (TASK.data[15] > 16) + { + TASK.data[15] = 16; + } + } + TASK.data[14] = TASK.data[15] / 2; + TASK.data[13] = TASK.data[14] + (TASK.data[15] & 1); + TASK.data[12] = 0; + TASK.data[10] = gBattleAnimArgs[3]; + TASK.data[11] = gBattleAnimArgs[4]; + TASK.data[7] = GetAnimBattlerSpriteId(1); + TASK.data[8] = gSprites[TASK.data[7]].pos2.x; + TASK.data[9] = gSprites[TASK.data[7]].pos2.y; + TASK.data[0] = 0; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.func = sub_80D646C; +} + +void sub_80D646C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + if (++task->data[0] > task->data[1]) + { + task->data[0] = 0; + task->data[12] = (task->data[12] + 1) & 1; + if (task->data[10]) + { + if (task->data[12]) + { + gSprites[task->data[7]].pos2.x = task->data[8] + task->data[13]; + } + else + { + gSprites[task->data[7]].pos2.x = task->data[8] - task->data[14]; + } + } + if (task->data[11]) + { + if (task->data[12]) + { + gSprites[task->data[7]].pos2.y = task->data[15]; + } + else + { + gSprites[task->data[7]].pos2.y = 0; + } + } + if (!--task->data[2]) + { + gSprites[task->data[7]].pos2.x = 0; + gSprites[task->data[7]].pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } +} diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index 1684e9b3d..5dd5fd31d 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -19,10 +19,10 @@ struct CompressedTilesPal const u8 *pal; }; -extern void sub_80D5860(struct Sprite *sprite); -extern void sub_80D58F8(struct Sprite *sprite); -extern void sub_80D5968(struct Sprite *sprite); -extern void sub_80D5A94(struct Sprite *sprite); +extern void DoHorizontalLunge(struct Sprite *sprite); +extern void DoVerticalDip(struct Sprite *sprite); +extern void SlideMonToOriginalPos(struct Sprite *sprite); +extern void SlideMonToOffset(struct Sprite *sprite); extern void sub_80D5B48(struct Sprite *sprite); // this file's functions @@ -422,7 +422,7 @@ const struct SpriteTemplate gHorizontalLungeSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D5860, + .callback = DoHorizontalLunge, }; const struct SpriteTemplate gVerticalDipSpriteTemplate = @@ -433,7 +433,7 @@ const struct SpriteTemplate gVerticalDipSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D58F8, + .callback = DoVerticalDip, }; const struct SpriteTemplate gSlideMonToOriginalPosSpriteTemplate = @@ -444,7 +444,7 @@ const struct SpriteTemplate gSlideMonToOriginalPosSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D5968, + .callback = SlideMonToOriginalPos, }; const struct SpriteTemplate gSlideMonToOffsetSpriteTemplate = @@ -455,7 +455,7 @@ const struct SpriteTemplate gSlideMonToOffsetSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D5A94, + .callback = SlideMonToOffset, }; const struct SpriteTemplate gUnknown_0857FE88 =