diff options
87 files changed, 2478 insertions, 6470 deletions
diff --git a/asm/battle_anim_812C144.s b/asm/battle_anim_812C144.s index a72117c08..4fea7049b 100644 --- a/asm/battle_anim_812C144.s +++ b/asm/battle_anim_812C144.s @@ -2340,7 +2340,7 @@ _081305C6: adds r0, r1 lsls r0, 2 adds r0, r4 - bl InitAnimSpriteTranslationOverDuration + bl InitAnimArcTranslation mov r1, r10 ldrb r0, [r1] bl GetBattlerSide @@ -2424,7 +2424,7 @@ _081306D6: lsls r0, 2 ldr r1, _08130708 @ =gSprites adds r0, r1 - bl TranslateAnimSpriteLinearAndSine + bl TranslateAnimArc ldrh r0, [r4, 0xC] adds r0, 0x1 strh r0, [r4, 0xC] @@ -2443,7 +2443,7 @@ _0813070C: lsls r0, 2 ldr r1, _0813072C @ =gSprites adds r0, r1 - bl TranslateAnimSpriteLinearAndSine + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _081307AA @@ -3757,11 +3757,11 @@ _081310FA: strh r0, [r4, 0x34] strh r1, [r4, 0x36] adds r0, r4, 0 - bl InitAnimSpriteTranslationDeltas + bl InitAnimLinearTranslation b _081311CA _08131110: adds r0, r4, 0 - bl TranslateAnimSpriteByDeltas + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _081311DE diff --git a/asm/battle_anim_813F0F4.s b/asm/battle_anim_813F0F4.s deleted file mode 100644 index df39aef31..000000000 --- a/asm/battle_anim_813F0F4.s +++ /dev/null @@ -1,5739 +0,0 @@ - .include "constants/gba_constants.inc" - .include "include/macros.inc" - - .syntax unified - - .text - - thumb_func_start unref_sub_813F0F4 -unref_sub_813F0F4: @ 813F0F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x10] - ldr r0, _0813F2AC @ =gAnimBankAttacker - ldrb r3, [r0] - ldr r0, _0813F2B0 @ =gBattle_WIN0H - movs r1, 0 - strh r1, [r0] - ldr r0, _0813F2B4 @ =gBattle_WIN0V - strh r1, [r0] - ldr r1, _0813F2B8 @ =REG_WININ - ldr r2, _0813F2BC @ =0x00003f3f - adds r0, r2, 0 - strh r0, [r1] - adds r1, 0x2 - ldr r4, _0813F2C0 @ =0x00003f3d - adds r0, r4, 0 - strh r0, [r1] - movs r2, 0x80 - lsls r2, 19 - ldrh r0, [r2] - movs r4, 0x80 - lsls r4, 8 - adds r1, r4, 0 - orrs r0, r1 - strh r0, [r2] - ldr r1, _0813F2C4 @ =REG_BLDCNT - ldr r2, _0813F2C8 @ =0x00003f42 - adds r0, r2, 0 - strh r0, [r1] - adds r1, 0x2 - movs r4, 0x80 - lsls r4, 5 - adds r0, r4, 0 - strh r0, [r1] - ldr r2, _0813F2CC @ =REG_BG1CNT - ldrb r1, [r2] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldrb r1, [r2, 0x1] - movs r0, 0x3F - ands r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r2, 0x1] - movs r1, 0x20 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r1, [r2] - movs r0, 0xD - negs r0, r0 - mov r9, r0 - ands r0, r1 - movs r1, 0x4 - mov r8, r1 - mov r4, r8 - orrs r0, r4 - strb r0, [r2] - ldr r0, _0813F2D0 @ =gHealthboxIDs - adds r3, r0 - ldrb r0, [r3] - ldr r1, _0813F2D4 @ =gSprites - mov r10, r1 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - add r4, r10 - ldrb r7, [r4, 0x6] - ldrh r6, [r4, 0x38] - lsls r6, 24 - lsrs r6, 24 - ldr r0, _0813F2D8 @ =SpriteCallbackDummy - bl CreateInvisibleSpriteWithCallback - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - ldr r0, _0813F2D8 @ =SpriteCallbackDummy - bl CreateInvisibleSpriteWithCallback - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x18] - ldrb r1, [r4, 0x5] - mov r0, r9 - ands r0, r1 - mov r2, r8 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r5, r7, 4 - adds r5, r7 - lsls r5, 2 - add r5, r10 - ldrb r1, [r5, 0x5] - mov r0, r9 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - add r1, r10 - ldrb r2, [r1, 0x5] - mov r0, r9 - ands r0, r2 - mov r2, r8 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r0, [sp, 0x14] - lsls r6, r0, 4 - adds r6, r0 - lsls r6, 2 - mov r1, r10 - adds r7, r6, r1 - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0x44 - bl memcpy - ldr r2, [sp, 0x18] - lsls r4, r2, 4 - adds r4, r2 - lsls r4, 2 - adds r0, r4, 0 - add r0, r10 - mov r8, r0 - adds r1, r5, 0 - movs r2, 0x44 - bl memcpy - ldrb r1, [r7, 0x1] - mov r0, r9 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r7, 0x1] - mov r2, r8 - ldrb r0, [r2, 0x1] - mov r2, r9 - ands r2, r0 - orrs r2, r1 - mov r0, r8 - strb r2, [r0, 0x1] - movs r1, 0x1C - add r10, r1 - add r6, r10 - ldr r2, _0813F2D8 @ =SpriteCallbackDummy - str r2, [r6] - add r4, r10 - str r2, [r4] - mov r0, sp - bl sub_8078914 - ldr r1, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0xC] - ldr r2, _0813F2DC @ =0x040000d4 - add r0, sp, 0xC - str r0, [r2] - str r1, [r2, 0x4] - ldr r0, _0813F2E0 @ =0x85000400 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - ldr r0, _0813F2E4 @ =gUnknown_08D2EE48 - bl LZDecompressVram - ldr r0, _0813F2E8 @ =gUnknown_08D2EDFC - ldr r1, [sp] - bl LZDecompressVram - ldr r0, _0813F2EC @ =gUnknown_08D2E150 - mov r1, sp - ldrb r1, [r1, 0x8] - lsls r1, 4 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r1, _0813F2F0 @ =gBattle_BG1_X - ldrh r0, [r7, 0x20] - negs r0, r0 - adds r0, 0x20 - strh r0, [r1] - ldr r1, _0813F2F4 @ =gBattle_BG1_Y - ldrh r0, [r7, 0x22] - negs r0, r0 - subs r0, 0x20 - strh r0, [r1] - ldr r1, _0813F2F8 @ =gTasks - ldr r4, [sp, 0x10] - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0xA0 - lsls r1, 2 - strh r1, [r0, 0xA] - mov r1, sp - ldrh r1, [r1, 0x14] - strh r1, [r0, 0x8] - mov r2, sp - ldrh r2, [r2, 0x18] - strh r2, [r0, 0xC] - ldr r1, _0813F2FC @ =sub_813F300 - str r1, [r0] - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0813F2AC: .4byte gAnimBankAttacker -_0813F2B0: .4byte gBattle_WIN0H -_0813F2B4: .4byte gBattle_WIN0V -_0813F2B8: .4byte REG_WININ -_0813F2BC: .4byte 0x00003f3f -_0813F2C0: .4byte 0x00003f3d -_0813F2C4: .4byte REG_BLDCNT -_0813F2C8: .4byte 0x00003f42 -_0813F2CC: .4byte REG_BG1CNT -_0813F2D0: .4byte gHealthboxIDs -_0813F2D4: .4byte gSprites -_0813F2D8: .4byte SpriteCallbackDummy -_0813F2DC: .4byte 0x040000d4 -_0813F2E0: .4byte 0x85000400 -_0813F2E4: .4byte gUnknown_08D2EE48 -_0813F2E8: .4byte gUnknown_08D2EDFC -_0813F2EC: .4byte gUnknown_08D2E150 -_0813F2F0: .4byte gBattle_BG1_X -_0813F2F4: .4byte gBattle_BG1_Y -_0813F2F8: .4byte gTasks -_0813F2FC: .4byte sub_813F300 - thumb_func_end unref_sub_813F0F4 - - thumb_func_start sub_813F300 -sub_813F300: @ 813F300 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, _0813F34C @ =gAnimBankAttacker - ldrb r0, [r0] - mov r9, r0 - ldr r1, _0813F350 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0xA] - ldrh r0, [r4, 0x22] - adds r1, r0 - movs r3, 0 - strh r1, [r4, 0x22] - ldr r2, _0813F354 @ =gBattle_BG1_Y - lsls r0, r1, 16 - lsrs r0, 24 - ldrh r5, [r2] - adds r0, r5 - strh r0, [r2] - movs r0, 0xFF - ands r1, r0 - strh r1, [r4, 0x22] - movs r1, 0x26 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0813F394 - cmp r0, 0x1 - bgt _0813F358 - cmp r0, 0 - beq _0813F35E - b _0813F4B2 - .align 2, 0 -_0813F34C: .4byte gAnimBankAttacker -_0813F350: .4byte gTasks -_0813F354: .4byte gBattle_BG1_Y -_0813F358: - cmp r0, 0x2 - beq _0813F3AC - b _0813F4B2 -_0813F35E: - ldrh r0, [r4, 0x1E] - adds r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bgt _0813F36E - b _0813F4B2 -_0813F36E: - strh r3, [r4, 0x1E] - ldrh r1, [r4, 0x20] - adds r1, 0x1 - strh r1, [r4, 0x20] - ldr r2, _0813F390 @ =REG_BLDALPHA - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - strh r1, [r2] - movs r2, 0x20 - ldrsh r0, [r4, r2] - cmp r0, 0x8 - beq _0813F38C - b _0813F4B2 -_0813F38C: - b _0813F3A4 - .align 2, 0 -_0813F390: .4byte REG_BLDALPHA -_0813F394: - ldrh r0, [r4, 0x1C] - adds r0, 0x1 - strh r0, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - beq _0813F3A4 - b _0813F4B2 -_0813F3A4: - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - b _0813F4B2 -_0813F3AC: - ldrh r0, [r4, 0x1E] - adds r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0813F4B2 - strh r3, [r4, 0x1E] - ldrh r1, [r4, 0x20] - subs r1, 0x1 - strh r1, [r4, 0x20] - ldr r6, _0813F4C0 @ =REG_BLDALPHA - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - strh r1, [r6] - movs r3, 0x20 - ldrsh r5, [r4, r3] - cmp r5, 0 - bne _0813F4B2 - movs r0, 0 - bl sub_8076464 - ldr r0, _0813F4C4 @ =gBattle_WIN0H - strh r5, [r0] - ldr r0, _0813F4C8 @ =gBattle_WIN0V - strh r5, [r0] - ldr r0, _0813F4CC @ =REG_WININ - ldr r2, _0813F4D0 @ =0x00003f3f - adds r1, r2, 0 - strh r1, [r0] - adds r0, 0x2 - strh r1, [r0] - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0813F406 - ldr r2, _0813F4D4 @ =REG_BG1CNT - ldrb r1, [r2] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_0813F406: - movs r2, 0x80 - lsls r2, 19 - ldrh r0, [r2] - movs r3, 0x80 - lsls r3, 8 - adds r1, r3, 0 - eors r0, r1 - strh r0, [r2] - ldr r0, _0813F4D8 @ =REG_BLDCNT - strh r5, [r0] - strh r5, [r6] - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, _0813F4DC @ =gSprites - mov r8, r1 - add r0, r8 - bl DestroySprite - movs r2, 0xC - ldrsh r1, [r4, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - bl DestroySprite - mov r0, sp - bl sub_8078914 - ldr r2, [sp, 0x4] - str r5, [sp, 0xC] - ldr r1, _0813F4E0 @ =0x040000d4 - add r0, sp, 0xC - str r0, [r1] - str r2, [r1, 0x4] - ldr r0, _0813F4E4 @ =0x85000200 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldr r2, _0813F4D4 @ =REG_BG1CNT - ldrb r1, [r2, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x1] - ldr r0, _0813F4E8 @ =gHealthboxIDs - add r0, r9 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r8 - ldrb r6, [r1, 0x6] - ldrh r4, [r1, 0x38] - lsls r4, 24 - lsrs r4, 24 - ldrb r3, [r1, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - movs r5, 0x4 - orrs r0, r5 - strb r0, [r1, 0x5] - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - add r1, r8 - ldrb r3, [r1, 0x5] - adds r0, r2, 0 - ands r0, r3 - orrs r0, r5 - strb r0, [r1, 0x5] - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - add r0, r8 - ldrb r1, [r0, 0x5] - ands r2, r1 - orrs r2, r5 - strb r2, [r0, 0x5] - adds r0, r7, 0 - bl DestroyAnimVisualTask -_0813F4B2: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0813F4C0: .4byte REG_BLDALPHA -_0813F4C4: .4byte gBattle_WIN0H -_0813F4C8: .4byte gBattle_WIN0V -_0813F4CC: .4byte REG_WININ -_0813F4D0: .4byte 0x00003f3f -_0813F4D4: .4byte REG_BG1CNT -_0813F4D8: .4byte REG_BLDCNT -_0813F4DC: .4byte gSprites -_0813F4E0: .4byte 0x040000d4 -_0813F4E4: .4byte 0x85000200 -_0813F4E8: .4byte gHealthboxIDs - thumb_func_end sub_813F300 - - thumb_func_start sub_813F4EC -sub_813F4EC: @ 813F4EC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - ldr r1, _0813F5D0 @ =gHealthboxIDs - ldr r0, _0813F5D4 @ =gAnimBankAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - ldr r7, _0813F5D8 @ =gSprites - lsls r6, r0, 4 - adds r6, r0 - lsls r6, 2 - adds r6, r7 - ldrb r0, [r6, 0x6] - str r0, [sp, 0x4] - ldrh r4, [r6, 0x38] - lsls r4, 24 - lsrs r4, 24 - ldr r0, _0813F5DC @ =0x0000d709 - bl AllocSpritePalette - mov r8, r0 - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - ldr r0, _0813F5E0 @ =0x0000d70a - bl AllocSpritePalette - mov r9, r0 - mov r2, r9 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - ldrb r0, [r6, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r1, 0x80 - lsls r1, 1 - adds r3, r1, 0 - orrs r0, r3 - lsls r5, r4, 4 - adds r5, r4 - lsls r5, 2 - adds r5, r7 - ldrb r4, [r5, 0x5] - lsrs r4, 4 - lsls r4, 4 - orrs r4, r3 - lsls r0, 1 - ldr r2, _0813F5E4 @ =gPlttBufferUnfaded - mov r10, r2 - add r0, r10 - mov r1, r8 - lsls r1, 4 - mov r8, r1 - adds r1, r3, r1 - movs r2, 0x20 - str r3, [sp, 0x8] - bl LoadPalette - lsls r4, 1 - add r4, r10 - mov r2, r9 - lsls r2, 4 - mov r9, r2 - ldr r3, [sp, 0x8] - add r3, r9 - adds r0, r4, 0 - adds r1, r3, 0 - movs r2, 0x20 - bl LoadPalette - ldrb r1, [r6, 0x5] - movs r2, 0xF - adds r0, r2, 0 - ands r0, r1 - mov r3, r8 - orrs r0, r3 - strb r0, [r6, 0x5] - ldr r0, [sp, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r3, [r1, 0x5] - adds r0, r2, 0 - ands r0, r3 - mov r3, r8 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r0, [r5, 0x5] - ands r2, r0 - mov r0, r9 - orrs r2, r0 - strb r2, [r5, 0x5] - ldr r0, [sp] - bl DestroyAnimVisualTask - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0813F5D0: .4byte gHealthboxIDs -_0813F5D4: .4byte gAnimBankAttacker -_0813F5D8: .4byte gSprites -_0813F5DC: .4byte 0x0000d709 -_0813F5E0: .4byte 0x0000d70a -_0813F5E4: .4byte gPlttBufferUnfaded - thumb_func_end sub_813F4EC - - thumb_func_start sub_813F5E8 -sub_813F5E8: @ 813F5E8 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - mov r8, r0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, _0813F684 @ =gHealthboxIDs - ldr r0, _0813F688 @ =gAnimBankAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - ldr r1, _0813F68C @ =gSprites - mov r9, r1 - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - add r5, r9 - ldrb r0, [r5, 0x6] - mov r10, r0 - ldrh r6, [r5, 0x38] - lsls r6, 24 - lsrs r6, 24 - ldr r0, _0813F690 @ =0x0000d709 - bl FreeSpritePaletteByTag - ldr r0, _0813F694 @ =0x0000d70a - bl FreeSpritePaletteByTag - ldr r0, _0813F698 @ =0x0000d6ff - bl IndexOfSpritePaletteTag - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, _0813F69C @ =0x0000d704 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsls r4, 4 - ldrb r2, [r5, 0x5] - movs r3, 0xF - adds r1, r3, 0 - ands r1, r2 - orrs r1, r4 - strb r1, [r5, 0x5] - mov r1, r10 - lsls r2, r1, 4 - add r2, r10 - lsls r2, 2 - add r2, r9 - ldrb r5, [r2, 0x5] - adds r1, r3, 0 - ands r1, r5 - orrs r1, r4 - strb r1, [r2, 0x5] - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - add r1, r9 - lsrs r0, 20 - ldrb r2, [r1, 0x5] - ands r3, r2 - orrs r3, r0 - strb r3, [r1, 0x5] - mov r0, r8 - bl DestroyAnimVisualTask - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_0813F684: .4byte gHealthboxIDs -_0813F688: .4byte gAnimBankAttacker -_0813F68C: .4byte gSprites -_0813F690: .4byte 0x0000d709 -_0813F694: .4byte 0x0000d70a -_0813F698: .4byte 0x0000d6ff -_0813F69C: .4byte 0x0000d704 - thumb_func_end sub_813F5E8 - - thumb_func_start sub_813F6A0 -sub_813F6A0: @ 813F6A0 - lsls r0, 24 - lsrs r0, 24 - ldr r2, _0813F6C0 @ =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r2, _0813F6C4 @ =gBattleAnimArgs - ldrh r0, [r2] - strh r0, [r1, 0x1C] - ldrh r0, [r2, 0x2] - strh r0, [r1, 0x1E] - ldr r0, _0813F6C8 @ =sub_813F6CC - str r0, [r1] - bx lr - .align 2, 0 -_0813F6C0: .4byte gTasks -_0813F6C4: .4byte gBattleAnimArgs -_0813F6C8: .4byte sub_813F6CC - thumb_func_end sub_813F6A0 - - thumb_func_start sub_813F6CC -sub_813F6CC: @ 813F6CC - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, _0813F718 @ =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - movs r6, 0 - adds r1, r0, 0x1 - strh r1, [r4, 0x8] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x1E - ldrsh r1, [r4, r2] - cmp r0, r1 - blt _0813F78C - strh r6, [r4, 0x8] - ldr r0, _0813F71C @ =0x0000d709 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r2, r0, 24 - movs r3, 0x1C - ldrsh r0, [r4, r3] - movs r1, 0x2 - cmp r0, 0 - bne _0813F70A - movs r1, 0x6 -_0813F70A: - movs r3, 0xA - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _0813F720 - cmp r0, 0x1 - beq _0813F75C - b _0813F78C - .align 2, 0 -_0813F718: .4byte gTasks -_0813F71C: .4byte 0x0000d709 -_0813F720: - ldrh r0, [r4, 0xC] - adds r0, 0x2 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _0813F732 - movs r0, 0x10 - strh r0, [r4, 0xC] -_0813F732: - lsls r0, r2, 4 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - orrs r0, r1 - ldrb r2, [r4, 0xC] - ldr r3, _0813F758 @ =0x00007f74 - movs r1, 0x1 - bl BlendPalette - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0x10 - bne _0813F78C - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - b _0813F78C - .align 2, 0 -_0813F758: .4byte 0x00007f74 -_0813F75C: - ldrh r0, [r4, 0xC] - subs r0, 0x2 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - bge _0813F76A - strh r6, [r4, 0xC] -_0813F76A: - lsls r0, r2, 4 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - orrs r0, r1 - ldrb r2, [r4, 0xC] - ldr r3, _0813F794 @ =0x00007f74 - movs r1, 0x1 - bl BlendPalette - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0 - bne _0813F78C - adds r0, r5, 0 - bl DestroyAnimVisualTask -_0813F78C: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_0813F794: .4byte 0x00007f74 - thumb_func_end sub_813F6CC - - thumb_func_start sub_813F798 -sub_813F798: @ 813F798 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, _0813F7C4 @ =gBankSpriteIds - ldr r0, _0813F7C8 @ =gAnimBankAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r5, [r0] - ldr r1, _0813F7CC @ =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0813F7E6 - cmp r0, 0x1 - bgt _0813F7D0 - cmp r0, 0 - beq _0813F7D6 - b _0813F838 - .align 2, 0 -_0813F7C4: .4byte gBankSpriteIds -_0813F7C8: .4byte gAnimBankAttacker -_0813F7CC: .4byte gTasks -_0813F7D0: - cmp r0, 0x2 - beq _0813F818 - b _0813F838 -_0813F7D6: - adds r0, r5, 0 - movs r1, 0 - bl sub_8078E70 - movs r0, 0x80 - lsls r0, 1 - strh r0, [r4, 0x1C] - b _0813F80A -_0813F7E6: - ldrh r0, [r4, 0x1C] - adds r0, 0x30 - strh r0, [r4, 0x1C] - movs r0, 0x1C - ldrsh r2, [r4, r0] - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl obj_id_set_rotscale - adds r0, r5, 0 - bl sub_8079A64 - movs r0, 0x1C - ldrsh r1, [r4, r0] - ldr r0, _0813F814 @ =0x000002cf - cmp r1, r0 - ble _0813F838 -_0813F80A: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0813F838 - .align 2, 0 -_0813F814: .4byte 0x000002cf -_0813F818: - adds r0, r5, 0 - bl sub_8078F40 - ldr r1, _0813F840 @ =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - adds r0, r6, 0 - bl DestroyAnimVisualTask -_0813F838: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_0813F840: .4byte gSprites - thumb_func_end sub_813F798 - - thumb_func_start sub_813F844 -sub_813F844: @ 813F844 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, _0813F87C @ =gBankSpriteIds - ldr r4, _0813F880 @ =gAnimBankAttacker - ldrb r0, [r4] - adds r1, r0, r1 - ldrb r1, [r1] - mov r9, r1 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0813F88C - ldr r1, _0813F884 @ =gBattlerPartyIndexes - ldrb r0, [r4] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, _0813F888 @ =gPlayerParty - b _0813F89C - .align 2, 0 -_0813F87C: .4byte gBankSpriteIds -_0813F880: .4byte gAnimBankAttacker -_0813F884: .4byte gBattlerPartyIndexes -_0813F888: .4byte gPlayerParty -_0813F88C: - ldr r1, _0813F8CC @ =gBattlerPartyIndexes - ldrb r0, [r4] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, _0813F8D0 @ =gEnemyParty -_0813F89C: - adds r0, r1 - movs r1, 0x26 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl ball_number_to_ball_processing_index - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r2, _0813F8D4 @ =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r6, r0, r2 - movs r0, 0x8 - ldrsh r7, [r6, r0] - cmp r7, 0 - beq _0813F8D8 - cmp r7, 0x1 - beq _0813F958 - b _0813F982 - .align 2, 0 -_0813F8CC: .4byte gBattlerPartyIndexes -_0813F8D0: .4byte gEnemyParty -_0813F8D4: .4byte gTasks -_0813F8D8: - ldr r5, _0813F950 @ =gAnimBankAttacker - ldrb r0, [r5] - movs r1, 0 - bl GetBattlerSpriteCoord - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r5] - movs r1, 0x1 - bl GetBattlerSpriteCoord - adds r1, r0, 0 - lsls r1, 24 - ldr r2, _0813F954 @ =gSprites - mov r3, r9 - lsls r0, r3, 4 - add r0, r9 - lsls r0, 2 - adds r0, r2 - ldrb r2, [r0, 0x5] - lsls r2, 28 - lsrs r2, 30 - adds r0, 0x43 - ldrb r3, [r0] - movs r0, 0x80 - lsls r0, 22 - adds r1, r0 - lsrs r1, 24 - mov r0, r8 - str r0, [sp] - adds r0, r4, 0 - bl sub_814086C - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x1C] - str r7, [sp] - str r7, [sp, 0x4] - str r7, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_80791A8 - adds r2, r0, 0 - ldrb r1, [r5] - movs r0, 0 - mov r3, r8 - bl sub_8141314 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x1E] - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - b _0813F982 - .align 2, 0 -_0813F950: .4byte gAnimBankAttacker -_0813F954: .4byte gSprites -_0813F958: - movs r1, 0x1C - ldrsh r0, [r6, r1] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r0, [r1, 0x4] - cmp r0, 0 - bne _0813F982 - movs r3, 0x1E - ldrsh r0, [r6, r3] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r0, [r1, 0x4] - cmp r0, 0 - bne _0813F982 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_0813F982: - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_813F844 - - thumb_func_start sub_813F990 -sub_813F990: @ 813F990 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, _0813F9B4 @ =gLastUsedItem - ldrh r0, [r0] - bl ball_number_to_ball_processing_index - lsls r0, 24 - lsrs r0, 24 - bl sub_80478DC - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_0813F9B4: .4byte gLastUsedItem - thumb_func_end sub_813F990 - - thumb_func_start sub_813F9B8 -sub_813F9B8: @ 813F9B8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, _0813F9DC @ =gLastUsedItem - ldrh r0, [r0] - bl ball_number_to_ball_processing_index - lsls r0, 24 - lsrs r0, 24 - bl sub_804794C - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_0813F9DC: .4byte gLastUsedItem - thumb_func_end sub_813F9B8 - - thumb_func_start sub_813F9E0 -sub_813F9E0: @ 813F9E0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, _0813F9F4 @ =gSharedMem + 0x17840 - ldrb r0, [r0, 0x8] - cmp r0, 0x5 - bne _0813FA00 - ldr r1, _0813F9F8 @ =gBattleAnimArgs - ldr r0, _0813F9FC @ =0x0000ffff - b _0813FA04 - .align 2, 0 -_0813F9F4: .4byte gSharedMem + 0x17840 -_0813F9F8: .4byte gBattleAnimArgs -_0813F9FC: .4byte 0x0000ffff -_0813FA00: - ldr r1, _0813FA10 @ =gBattleAnimArgs - movs r0, 0 -_0813FA04: - strh r0, [r1, 0xE] - adds r0, r2, 0 - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .align 2, 0 -_0813FA10: .4byte gBattleAnimArgs - thumb_func_end sub_813F9E0 - - thumb_func_start ball_number_to_ball_processing_index -ball_number_to_ball_processing_index: @ 813FA14 - push {lr} - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x1 - cmp r0, 0xB - bhi _0813FA8C - lsls r0, 2 - ldr r1, _0813FA2C @ =_0813FA30 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0813FA2C: .4byte _0813FA30 - .align 2, 0 -_0813FA30: - .4byte _0813FA60 - .4byte _0813FA64 - .4byte _0813FA68 - .4byte _0813FA8C - .4byte _0813FA6C - .4byte _0813FA70 - .4byte _0813FA74 - .4byte _0813FA78 - .4byte _0813FA7C - .4byte _0813FA80 - .4byte _0813FA84 - .4byte _0813FA88 -_0813FA60: - movs r0, 0x4 - b _0813FA8E -_0813FA64: - movs r0, 0x3 - b _0813FA8E -_0813FA68: - movs r0, 0x1 - b _0813FA8E -_0813FA6C: - movs r0, 0x2 - b _0813FA8E -_0813FA70: - movs r0, 0x5 - b _0813FA8E -_0813FA74: - movs r0, 0x6 - b _0813FA8E -_0813FA78: - movs r0, 0x7 - b _0813FA8E -_0813FA7C: - movs r0, 0x8 - b _0813FA8E -_0813FA80: - movs r0, 0x9 - b _0813FA8E -_0813FA84: - movs r0, 0xA - b _0813FA8E -_0813FA88: - movs r0, 0xB - b _0813FA8E -_0813FA8C: - movs r0, 0 -_0813FA8E: - pop {r1} - bx r1 - thumb_func_end ball_number_to_ball_processing_index - - thumb_func_start sub_813FA94 -sub_813FA94: @ 813FA94 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - mov r10, r0 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, _0813FB58 @ =gLastUsedItem - ldrh r0, [r0] - bl ball_number_to_ball_processing_index - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - ldr r1, _0813FB5C @ =gBallSpriteTemplates - adds r0, r1 - movs r1, 0x20 - movs r2, 0x50 - movs r3, 0x1D - bl CreateSprite - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r1, _0813FB60 @ =gSprites - mov r9, r1 - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - adds r6, r4, r1 - movs r0, 0x22 - strh r0, [r6, 0x2E] - ldr r2, _0813FB64 @ =gAnimBankTarget - mov r8, r2 - ldrb r0, [r2] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x30] - mov r1, r8 - ldrb r0, [r1] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x10 - strh r0, [r6, 0x32] - mov r0, r9 - adds r0, 0x1C - adds r4, r0 - ldr r0, _0813FB68 @ =sub_813FD90 - str r0, [r4] - ldr r3, _0813FB6C @ =gSharedMem + 0x17840 - ldr r1, _0813FB70 @ =gBankSpriteIds - mov r2, r8 - ldrb r0, [r2] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - adds r0, 0x3E - ldrb r1, [r0] - lsls r1, 29 - lsrs r1, 31 - lsls r1, 1 - ldrb r2, [r3, 0x9] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x9] - ldr r1, _0813FB74 @ =gTasks - mov r2, r10 - lsls r0, r2, 2 - add r0, r10 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x8] - ldr r1, _0813FB78 @ =sub_813FB7C - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_0813FB58: .4byte gLastUsedItem -_0813FB5C: .4byte gBallSpriteTemplates -_0813FB60: .4byte gSprites -_0813FB64: .4byte gAnimBankTarget -_0813FB68: .4byte sub_813FD90 -_0813FB6C: .4byte gSharedMem + 0x17840 -_0813FB70: .4byte gBankSpriteIds -_0813FB74: .4byte gTasks -_0813FB78: .4byte sub_813FB7C - thumb_func_end sub_813FA94 - - thumb_func_start sub_813FB7C -sub_813FB7C: @ 813FB7C - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, _0813FBAC @ =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - ldrb r1, [r0, 0x8] - ldr r2, _0813FBB0 @ =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x2E] - ldr r0, _0813FBB4 @ =0x0000ffff - cmp r1, r0 - bne _0813FBA6 - adds r0, r3, 0 - bl DestroyAnimVisualTask -_0813FBA6: - pop {r0} - bx r0 - .align 2, 0 -_0813FBAC: .4byte gTasks -_0813FBB0: .4byte gSprites -_0813FBB4: .4byte 0x0000ffff - thumb_func_end sub_813FB7C - - thumb_func_start sub_813FBB8 -sub_813FBB8: @ 813FBB8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, _0813FBD8 @ =gBattleTypeFlags - ldrh r1, [r0] - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - cmp r0, 0 - beq _0813FBDC - movs r6, 0x20 - movs r5, 0xB - b _0813FBE0 - .align 2, 0 -_0813FBD8: .4byte gBattleTypeFlags -_0813FBDC: - movs r6, 0x17 - movs r5, 0x5 -_0813FBE0: - ldr r0, _0813FC9C @ =gLastUsedItem - ldrh r0, [r0] - bl ball_number_to_ball_processing_index - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - bl sub_8079E90 - adds r3, r0, 0 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - ldr r1, _0813FCA0 @ =gBallSpriteTemplates - adds r0, r1 - adds r1, r6, 0 - adds r1, 0x20 - movs r2, 0x50 - orrs r5, r2 - adds r2, r5, 0 - bl CreateSprite - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, _0813FCA4 @ =gSprites - mov r9, r0 - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - adds r6, r4, r0 - movs r0, 0x22 - strh r0, [r6, 0x2E] - ldr r1, _0813FCA8 @ =gAnimBankTarget - mov r8, r1 - ldrb r0, [r1] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x30] - mov r1, r8 - ldrb r0, [r1] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x10 - strh r0, [r6, 0x32] - mov r0, r9 - adds r0, 0x1C - adds r4, r0 - ldr r0, _0813FCAC @ =SpriteCallbackDummy - str r0, [r4] - movs r0, 0 - bl GetBattlerAtPosition - ldr r1, _0813FCB0 @ =gBankSpriteIds - lsls r0, 24 - lsrs r0, 24 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - movs r1, 0x1 - bl StartSpriteAnim - ldr r1, _0813FCB4 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x8] - ldr r1, _0813FCB8 @ =sub_813FCBC - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0813FC9C: .4byte gLastUsedItem -_0813FCA0: .4byte gBallSpriteTemplates -_0813FCA4: .4byte gSprites -_0813FCA8: .4byte gAnimBankTarget -_0813FCAC: .4byte SpriteCallbackDummy -_0813FCB0: .4byte gBankSpriteIds -_0813FCB4: .4byte gTasks -_0813FCB8: .4byte sub_813FCBC - thumb_func_end sub_813FBB8 - - thumb_func_start sub_813FCBC -sub_813FCBC: @ 813FCBC - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, _0813FD1C @ =gSprites - movs r0, 0 - bl GetBattlerAtPosition - ldr r1, _0813FD20 @ =gBankSpriteIds - lsls r0, 24 - lsrs r0, 24 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _0813FD16 - movs r0, 0x3D - movs r1, 0 - bl PlaySE12WithPanning - ldr r0, _0813FD24 @ =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, _0813FD28 @ =sub_813FD90 - str r1, [r0] - ldr r0, _0813FD2C @ =sub_813FD34 - movs r1, 0xA - bl CreateTask - ldr r0, _0813FD30 @ =sub_813FB7C - str r0, [r4] -_0813FD16: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_0813FD1C: .4byte gSprites -_0813FD20: .4byte gBankSpriteIds -_0813FD24: .4byte gTasks -_0813FD28: .4byte sub_813FD90 -_0813FD2C: .4byte sub_813FD34 -_0813FD30: .4byte sub_813FB7C - thumb_func_end sub_813FCBC - - thumb_func_start sub_813FD34 -sub_813FD34: @ 813FD34 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, _0813FD88 @ =gSprites - movs r0, 0 - bl GetBattlerAtPosition - ldr r4, _0813FD8C @ =gBankSpriteIds - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _0813FD80 - movs r0, 0 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0 - bl StartSpriteAnim - adds r0, r5, 0 - bl DestroyTask -_0813FD80: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_0813FD88: .4byte gSprites -_0813FD8C: .4byte gBankSpriteIds - thumb_func_end sub_813FD34 - - thumb_func_start sub_813FD90 -sub_813FD90: @ 813FD90 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - ldrh r2, [r4, 0x32] - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - strh r1, [r4, 0x32] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - strh r2, [r4, 0x36] - ldr r0, _0813FDB8 @ =0x0000ffd8 - strh r0, [r4, 0x38] - adds r0, r4, 0 - bl InitAnimSpriteTranslationOverDuration - ldr r0, _0813FDBC @ =sub_813FDC0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_0813FDB8: .4byte 0x0000ffd8 -_0813FDBC: .4byte sub_813FDC0 - thumb_func_end sub_813FD90 - - thumb_func_start sub_813FDC0 -sub_813FDC0: @ 813FDC0 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - bl TranslateAnimSpriteLinearAndSine - lsls r0, 24 - cmp r0, 0 - beq _0813FE5A - ldr r0, _0813FDE0 @ =gSharedMem + 0x17840 - ldrb r0, [r0, 0x8] - cmp r0, 0x5 - bne _0813FDE8 - ldr r0, _0813FDE4 @ =sub_81407B8 - str r0, [r4, 0x1C] - b _0813FE5A - .align 2, 0 -_0813FDE0: .4byte gSharedMem + 0x17840 -_0813FDE4: .4byte sub_81407B8 -_0813FDE8: - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - movs r1, 0 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x26] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - strh r1, [r4, 0x24] - strh r1, [r4, 0x26] - adds r1, r4, 0 - adds r1, 0x2E - movs r2, 0 - adds r0, r4, 0 - adds r0, 0x3C -_0813FE10: - strh r2, [r0] - subs r0, 0x2 - cmp r0, r1 - bge _0813FE10 - movs r0, 0 - strh r0, [r4, 0x38] - ldr r0, _0813FE64 @ =sub_813FE70 - str r0, [r4, 0x1C] - ldr r0, _0813FE68 @ =gLastUsedItem - ldrh r0, [r0] - bl ball_number_to_ball_processing_index - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xB - bgt _0813FE5A - cmp r5, 0 - blt _0813FE5A - ldrh r0, [r4, 0x20] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x22] - subs r1, 0x5 - lsls r1, 24 - lsrs r1, 24 - str r5, [sp] - movs r2, 0x1 - movs r3, 0x1C - bl sub_814086C - ldr r0, _0813FE6C @ =gAnimBankTarget - ldrb r1, [r0] - movs r0, 0 - movs r2, 0xE - adds r3, r5, 0 - bl sub_8141314 -_0813FE5A: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_0813FE64: .4byte sub_813FE70 -_0813FE68: .4byte gLastUsedItem -_0813FE6C: .4byte gAnimBankTarget - thumb_func_end sub_813FDC0 - - thumb_func_start sub_813FE70 -sub_813FE70: @ 813FE70 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _0813FEAC - ldr r0, _0813FEB4 @ =TaskDummy - movs r1, 0x32 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x38] - ldr r0, _0813FEB8 @ =sub_813FEC8 - str r0, [r4, 0x1C] - ldr r2, _0813FEBC @ =gSprites - ldr r1, _0813FEC0 @ =gBankSpriteIds - ldr r0, _0813FEC4 @ =gAnimBankTarget - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x30] -_0813FEAC: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_0813FEB4: .4byte TaskDummy -_0813FEB8: .4byte sub_813FEC8 -_0813FEBC: .4byte gSprites -_0813FEC0: .4byte gBankSpriteIds -_0813FEC4: .4byte gAnimBankTarget - thumb_func_end sub_813FE70 - - thumb_func_start sub_813FEC8 -sub_813FEC8: @ 813FEC8 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r1, _0813FF0C @ =gBankSpriteIds - ldr r0, _0813FF10 @ =gAnimBankTarget - ldrb r0, [r0] - adds r0, r1 - ldrb r4, [r0] - ldrh r0, [r7, 0x38] - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, _0813FF14 @ =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r5, r0, r1 - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB - bne _0813FEFA - movs r0, 0x3C - bl PlaySE -_0813FEFA: - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _0813FF70 - cmp r0, 0x1 - bgt _0813FF18 - cmp r0, 0 - beq _0813FF1E - b _0813FFDC - .align 2, 0 -_0813FF0C: .4byte gBankSpriteIds -_0813FF10: .4byte gAnimBankTarget -_0813FF14: .4byte gTasks -_0813FF18: - cmp r0, 0x2 - beq _0813FFB4 - b _0813FFDC -_0813FF1E: - adds r0, r4, 0 - movs r1, 0 - bl sub_8078E70 - movs r0, 0x80 - lsls r0, 1 - strh r0, [r5, 0x1C] - ldr r1, _0813FF60 @ =gUnknown_03005F0C - movs r0, 0x1C - str r0, [r1] - ldr r2, _0813FF64 @ =gUnknown_03005F14 - ldr r1, _0813FF68 @ =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0, 0x26] - ldrh r0, [r0, 0x22] - adds r1, r0 - ldrh r0, [r7, 0x26] - ldrh r7, [r7, 0x22] - adds r0, r7 - subs r1, r0 - strh r1, [r2] - ldr r4, _0813FF6C @ =gUnknown_03005F10 - ldrh r0, [r2] - lsls r0, 8 - movs r1, 0x1C - bl __udivsi3 - strh r0, [r4] - strh r0, [r5, 0xC] - b _0813FFCE - .align 2, 0 -_0813FF60: .4byte gUnknown_03005F0C -_0813FF64: .4byte gUnknown_03005F14 -_0813FF68: .4byte gSprites -_0813FF6C: .4byte gUnknown_03005F10 -_0813FF70: - ldrh r0, [r5, 0x1C] - adds r0, 0x20 - strh r0, [r5, 0x1C] - movs r0, 0x1C - ldrsh r2, [r5, r0] - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl obj_id_set_rotscale - ldrh r0, [r5, 0xC] - ldrh r1, [r5, 0xE] - adds r0, r1 - strh r0, [r5, 0xE] - ldr r0, _0813FFAC @ =gSprites - lsls r1, r4, 4 - adds r1, r4 - lsls r1, 2 - adds r1, r0 - movs r2, 0xE - ldrsh r0, [r5, r2] - negs r0, r0 - asrs r0, 8 - strh r0, [r1, 0x26] - movs r0, 0x1C - ldrsh r1, [r5, r0] - ldr r0, _0813FFB0 @ =0x0000047f - cmp r1, r0 - ble _08140004 - b _0813FFCE - .align 2, 0 -_0813FFAC: .4byte gSprites -_0813FFB0: .4byte 0x0000047f -_0813FFB4: - adds r0, r4, 0 - bl sub_8078F40 - ldr r1, _0813FFD8 @ =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_0813FFCE: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _08140004 - .align 2, 0 -_0813FFD8: .4byte gSprites -_0813FFDC: - ldr r0, _0814000C @ =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r2, 0xA - ldrsh r0, [r1, r2] - cmp r0, 0xA - ble _08140004 - adds r0, r6, 0 - bl DestroyTask - adds r0, r7, 0 - movs r1, 0x2 - bl StartSpriteAnim - movs r0, 0 - strh r0, [r7, 0x38] - ldr r0, _08140010 @ =sub_8140014 - str r0, [r7, 0x1C] -_08140004: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0814000C: .4byte gTasks -_08140010: .4byte sub_8140014 - thumb_func_end sub_813FEC8 - - thumb_func_start sub_8140014 -sub_8140014: @ 8140014 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0814004E - movs r1, 0 - strh r1, [r4, 0x34] - movs r0, 0x20 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - movs r0, 0 - movs r1, 0x20 - bl Cos - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - movs r0, 0x36 - ldrsh r1, [r4, r0] - movs r0, 0 - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldr r0, _08140054 @ =sub_8140058 - str r0, [r4, 0x1C] -_0814004E: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08140054: .4byte sub_8140058 - thumb_func_end sub_8140014 - - thumb_func_start sub_8140058 -sub_8140058: @ 8140058 - push {r4,r5,lr} - adds r4, r0, 0 - movs r5, 0 - ldrh r0, [r4, 0x34] - movs r1, 0xFF - ands r1, r0 - cmp r1, 0 - beq _0814006E - cmp r1, 0x1 - beq _081400E2 - b _0814010E -_0814006E: - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r1, [r4, 0x38] - adds r1, 0x4 - ldrh r2, [r4, 0x34] - lsls r0, r2, 16 - asrs r0, 24 - adds r1, r0 - strh r1, [r4, 0x38] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x3F - ble _0814010E - ldrh r0, [r4, 0x36] - subs r0, 0xA - strh r0, [r4, 0x36] - ldr r1, _081400B8 @ =0x00000101 - adds r0, r2, r1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 24 - cmp r0, 0x4 - bne _081400AA - movs r5, 0x1 -_081400AA: - cmp r0, 0x2 - beq _081400CA - cmp r0, 0x2 - bgt _081400BC - cmp r0, 0x1 - beq _081400C2 - b _081400DA - .align 2, 0 -_081400B8: .4byte 0x00000101 -_081400BC: - cmp r0, 0x3 - beq _081400D2 - b _081400DA -_081400C2: - movs r0, 0x38 - bl PlaySE - b _0814010E -_081400CA: - movs r0, 0x39 - bl PlaySE - b _0814010E -_081400D2: - movs r0, 0x3A - bl PlaySE - b _0814010E -_081400DA: - movs r0, 0x3B - bl PlaySE - b _0814010E -_081400E2: - movs r2, 0x38 - ldrsh r0, [r4, r2] - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r1, [r4, 0x38] - subs r1, 0x4 - ldrh r2, [r4, 0x34] - lsls r0, r2, 16 - asrs r0, 24 - subs r1, r0 - strh r1, [r4, 0x38] - lsls r1, 16 - cmp r1, 0 - bgt _0814010E - strh r5, [r4, 0x38] - ldr r0, _08140138 @ =0xffffff00 - ands r0, r2 - strh r0, [r4, 0x34] -_0814010E: - cmp r5, 0 - beq _0814014E - movs r5, 0 - strh r5, [r4, 0x34] - movs r0, 0x40 - movs r1, 0x20 - bl Cos - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - strh r5, [r4, 0x26] - ldr r0, _0814013C @ =gSharedMem + 0x17840 - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _08140144 - strh r5, [r4, 0x38] - ldr r0, _08140140 @ =sub_8140410 - str r0, [r4, 0x1C] - b _0814014E - .align 2, 0 -_08140138: .4byte 0xffffff00 -_0814013C: .4byte gSharedMem + 0x17840 -_08140140: .4byte sub_8140410 -_08140144: - ldr r0, _08140154 @ =sub_8140158 - str r0, [r4, 0x1C] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r5, [r4, 0x38] -_0814014E: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08140154: .4byte sub_8140158 - thumb_func_end sub_8140058 - - thumb_func_start sub_8140158 -sub_8140158: @ 8140158 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r5, 0 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _08140190 - strh r5, [r4, 0x34] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - ldr r0, _08140198 @ =gSharedMem + 0x17840 - strh r5, [r0, 0xC] - ldr r0, _0814019C @ =sub_81401A0 - str r0, [r4, 0x1C] - movs r0, 0x17 - bl PlaySE -_08140190: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08140198: .4byte gSharedMem + 0x17840 -_0814019C: .4byte sub_81401A0 - thumb_func_end sub_8140158 - - thumb_func_start sub_81401A0 -sub_81401A0: @ 81401A0 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x34] - movs r1, 0xFF - ands r1, r0 - cmp r1, 0x6 - bls _081401B0 - b _081403C4 -_081401B0: - lsls r0, r1, 2 - ldr r1, _081401BC @ =_081401C0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_081401BC: .4byte _081401C0 - .align 2, 0 -_081401C0: - .4byte _081401DC - .4byte _08140226 - .4byte _0814026C - .4byte _081402C0 - .4byte _08140310 - .4byte _08140368 - .4byte _081403C4 -_081401DC: - ldr r0, _081401F8 @ =gSharedMem + 0x17840 - ldrh r2, [r0, 0xC] - movs r3, 0xC - ldrsh r1, [r0, r3] - adds r5, r0, 0 - cmp r1, 0xFF - ble _081401FC - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r0, 0xFF - ands r0, r2 - b _08140200 - .align 2, 0 -_081401F8: .4byte gSharedMem + 0x17840 -_081401FC: - adds r0, r2, 0 - adds r0, 0xB0 -_08140200: - strh r0, [r5, 0xC] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - movs r3, 0 - strh r0, [r4, 0x38] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x38] - adds r0, 0x7 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xE - bhi _08140224 - b _0814040A -_08140224: - b _081402B4 -_08140226: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _081402CC - movs r0, 0 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x36] - negs r0, r0 - strh r0, [r4, 0x36] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - movs r3, 0x36 - ldrsh r0, [r4, r3] - cmp r0, 0 - bge _08140262 - adds r0, r4, 0 - movs r1, 0x2 - bl ChangeSpriteAffineAnim - b _0814040A -_08140262: - adds r0, r4, 0 - movs r1, 0x1 - bl ChangeSpriteAffineAnim - b _0814040A -_0814026C: - ldr r0, _08140288 @ =gSharedMem + 0x17840 - ldrh r2, [r0, 0xC] - movs r3, 0xC - ldrsh r1, [r0, r3] - adds r5, r0, 0 - cmp r1, 0xFF - ble _0814028C - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r0, 0xFF - ands r0, r2 - b _08140290 - .align 2, 0 -_08140288: .4byte gSharedMem + 0x17840 -_0814028C: - adds r0, r2, 0 - adds r0, 0xB0 -_08140290: - strh r0, [r5, 0xC] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - movs r3, 0 - strh r0, [r4, 0x38] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x38] - adds r0, 0xC - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x18 - bhi _081402B4 - b _0814040A -_081402B4: - strh r3, [r5, 0xC] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - strh r3, [r4, 0x38] - b _0814040A -_081402C0: - ldrh r0, [r4, 0x38] - adds r1, r0, 0x1 - strh r1, [r4, 0x38] - lsls r0, 16 - cmp r0, 0 - bge _081402DA -_081402CC: - adds r0, r4, 0 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - b _0814040A -_081402DA: - movs r0, 0 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x36] - negs r0, r0 - strh r0, [r4, 0x36] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - movs r3, 0x36 - ldrsh r0, [r4, r3] - cmp r0, 0 - bge _08140308 - adds r0, r4, 0 - movs r1, 0x2 - bl ChangeSpriteAffineAnim - b _08140310 -_08140308: - adds r0, r4, 0 - movs r1, 0x1 - bl ChangeSpriteAffineAnim -_08140310: - ldr r0, _0814032C @ =gSharedMem + 0x17840 - ldrh r2, [r0, 0xC] - movs r3, 0xC - ldrsh r1, [r0, r3] - adds r5, r0, 0 - cmp r1, 0xFF - ble _08140330 - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r0, 0xFF - ands r0, r2 - b _08140334 - .align 2, 0 -_0814032C: .4byte gSharedMem + 0x17840 -_08140330: - adds r0, r2, 0 - adds r0, 0xB0 -_08140334: - strh r0, [r5, 0xC] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - movs r3, 0 - strh r0, [r4, 0x38] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x38] - adds r0, 0x4 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x8 - bls _0814040A - strh r3, [r5, 0xC] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - strh r3, [r4, 0x38] - ldrh r0, [r4, 0x36] - negs r0, r0 - strh r0, [r4, 0x36] - b _0814040A -_08140368: - movs r3, 0x80 - lsls r3, 1 - adds r0, r3, 0 - ldrh r1, [r4, 0x34] - adds r0, r1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r1, r0, 24 - ldr r0, _08140394 @ =gSharedMem + 0x17840 - ldrb r0, [r0, 0x8] - cmp r1, r0 - bne _0814039C - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - ldr r0, _08140398 @ =sub_8140410 - str r0, [r4, 0x1C] - b _0814040A - .align 2, 0 -_08140394: .4byte gSharedMem + 0x17840 -_08140398: .4byte sub_8140410 -_0814039C: - cmp r0, 0x4 - bne _081403B0 - cmp r1, 0x3 - bne _081403B0 - ldr r0, _081403AC @ =sub_8140434 - str r0, [r4, 0x1C] - b _081403B6 - .align 2, 0 -_081403AC: .4byte sub_8140434 -_081403B0: - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] -_081403B6: - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - b _0814040A -_081403C4: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _0814040A - movs r0, 0 - strh r0, [r4, 0x38] - ldrh r1, [r4, 0x34] - ldr r0, _081403F8 @ =0xffffff00 - ands r0, r1 - strh r0, [r4, 0x34] - adds r0, r4, 0 - movs r1, 0x3 - bl StartSpriteAffineAnim - movs r3, 0x36 - ldrsh r0, [r4, r3] - cmp r0, 0 - bge _081403FC - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAffineAnim - b _08140404 - .align 2, 0 -_081403F8: .4byte 0xffffff00 -_081403FC: - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim -_08140404: - movs r0, 0x17 - bl PlaySE -_0814040A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81401A0 - - thumb_func_start sub_8140410 -sub_8140410: @ 8140410 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x38] - adds r0, 0x1 - strh r0, [r1, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _0814042A - movs r0, 0 - strh r0, [r1, 0x38] - ldr r0, _08140430 @ =sub_81405F4 - str r0, [r1, 0x1C] -_0814042A: - pop {r0} - bx r0 - .align 2, 0 -_08140430: .4byte sub_81405F4 - thumb_func_end sub_8140410 - - thumb_func_start sub_8140434 -sub_8140434: @ 8140434 - adds r3, r0, 0 - adds r3, 0x2C - ldrb r1, [r3] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r3] - ldr r1, _08140450 @ =sub_8140454 - str r1, [r0, 0x1C] - movs r1, 0 - strh r1, [r0, 0x34] - strh r1, [r0, 0x36] - strh r1, [r0, 0x38] - bx lr - .align 2, 0 -_08140450: .4byte sub_8140454 - thumb_func_end sub_8140434 - - thumb_func_start sub_8140454 -sub_8140454: @ 8140454 - push {r4-r7,lr} - adds r6, r0, 0 - ldr r7, _08140484 @ =gAnimBankTarget - ldrh r0, [r6, 0x36] - adds r0, 0x1 - strh r0, [r6, 0x36] - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0x28 - beq _081404CC - cmp r1, 0x5F - bne _08140490 - ldr r0, _08140488 @ =gDoingBattleAnim - movs r1, 0 - strb r1, [r0] - movs r0, 0x1 - bl UpdateOamPriorityInAllHealthboxes - bl m4aMPlayAllStop - ldr r0, _0814048C @ =0x00000173 - bl PlaySE - b _081404CC - .align 2, 0 -_08140484: .4byte gAnimBankTarget -_08140488: .4byte gDoingBattleAnim -_0814048C: .4byte 0x00000173 -_08140490: - ldr r0, _081404D4 @ =0x0000013b - cmp r1, r0 - bne _081404CC - ldr r5, _081404D8 @ =gSprites - ldr r4, _081404DC @ =gBankSpriteIds - ldrb r0, [r7] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r7] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - movs r0, 0 - strh r0, [r6, 0x2E] - ldr r0, _081404E0 @ =sub_81404E4 - str r0, [r6, 0x1C] -_081404CC: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_081404D4: .4byte 0x0000013b -_081404D8: .4byte gSprites -_081404DC: .4byte gBankSpriteIds -_081404E0: .4byte sub_81404E4 - thumb_func_end sub_8140454 - - thumb_func_start sub_81404E4 -sub_81404E4: @ 81404E4 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08140550 - cmp r0, 0x1 - bgt _081404FC - cmp r0, 0 - beq _08140502 - b _08140594 -_081404FC: - cmp r0, 0x2 - beq _08140580 - b _08140594 -_08140502: - strh r0, [r4, 0x30] - strh r0, [r4, 0x32] - ldrb r1, [r4, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4, 0x1] - ldr r1, _08140548 @ =REG_BLDCNT - movs r2, 0xFD - lsls r2, 6 - adds r0, r2, 0 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x10 - strh r0, [r1] - ldr r0, [r4, 0x14] - ldrh r0, [r0, 0x2] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x10 - movs r1, 0x1 - lsls r1, r0 - ldr r0, _0814054C @ =0x00007fff - str r0, [sp] - adds r0, r1, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0814058C - .align 2, 0 -_08140548: .4byte REG_BLDCNT -_0814054C: .4byte 0x00007fff -_08140550: - ldrh r0, [r4, 0x30] - adds r1, r0, 0x1 - strh r1, [r4, 0x30] - lsls r0, 16 - cmp r0, 0 - ble _081405B2 - movs r0, 0 - strh r0, [r4, 0x30] - ldrh r1, [r4, 0x32] - adds r1, 0x1 - strh r1, [r4, 0x32] - ldr r3, _0814057C @ =REG_BLDALPHA - lsls r2, r1, 8 - movs r0, 0x10 - subs r0, r1 - orrs r2, r0 - strh r2, [r3] - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _081405B2 - b _0814058C - .align 2, 0 -_0814057C: .4byte REG_BLDALPHA -_08140580: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_0814058C: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _081405B2 -_08140594: - ldr r0, _081405BC @ =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _081405B2 - ldr r0, _081405C0 @ =REG_BLDCNT - strh r1, [r0] - adds r0, 0x2 - strh r1, [r0] - strh r1, [r4, 0x2E] - ldr r0, _081405C4 @ =sub_81405C8 - str r0, [r4, 0x1C] -_081405B2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_081405BC: .4byte gPaletteFade -_081405C0: .4byte REG_BLDCNT -_081405C4: .4byte sub_81405C8 - thumb_func_end sub_81404E4 - - thumb_func_start sub_81405C8 -sub_81405C8: @ 81405C8 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _081405E0 - ldr r0, _081405DC @ =0x0000ffff - strh r0, [r4, 0x2E] - b _081405EC - .align 2, 0 -_081405DC: .4byte 0x0000ffff -_081405E0: - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite -_081405EC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81405C8 - - thumb_func_start sub_81405F4 -sub_81405F4: @ 81405F4 - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAffineAnim - ldr r0, _081406A8 @ =sub_81406BC - str r0, [r4, 0x1C] - ldr r0, _081406AC @ =gLastUsedItem - ldrh r0, [r0] - bl ball_number_to_ball_processing_index - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xB - bgt _08140646 - cmp r5, 0 - blt _08140646 - ldrh r0, [r4, 0x20] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x22] - subs r1, 0x5 - lsls r1, 24 - lsrs r1, 24 - str r5, [sp] - movs r2, 0x1 - movs r3, 0x1C - bl sub_814086C - ldr r0, _081406B0 @ =gAnimBankTarget - ldrb r1, [r0] - movs r0, 0x1 - movs r2, 0xE - adds r3, r5, 0 - bl sub_8141314 -_08140646: - ldr r6, _081406B4 @ =gSprites - ldr r5, _081406B8 @ =gBankSpriteIds - ldr r4, _081406B0 @ =gAnimBankTarget - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x1 - bl StartSpriteAffineAnim - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl AnimateSprite - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x80 - lsls r1, 5 - strh r1, [r0, 0x30] - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_081406A8: .4byte sub_81406BC -_081406AC: .4byte gLastUsedItem -_081406B0: .4byte gAnimBankTarget -_081406B4: .4byte gSprites -_081406B8: .4byte gBankSpriteIds - thumb_func_end sub_81405F4 - - thumb_func_start sub_81406BC -sub_81406BC: @ 81406BC - push {r4-r7,lr} - adds r7, r0, 0 - movs r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081406DA - adds r2, r7, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_081406DA: - ldr r4, _08140708 @ =gSprites - ldr r3, _0814070C @ =gBankSpriteIds - ldr r2, _08140710 @ =gAnimBankTarget - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 26 - cmp r0, 0 - bge _08140714 - adds r0, r1, 0 - movs r1, 0 - bl StartSpriteAffineAnim - movs r5, 0x1 - b _08140734 - .align 2, 0 -_08140708: .4byte gSprites -_0814070C: .4byte gBankSpriteIds -_08140710: .4byte gAnimBankTarget -_08140714: - ldr r6, _0814079C @ =0xfffffee0 - adds r0, r6, 0 - ldrh r6, [r1, 0x30] - adds r0, r6 - strh r0, [r1, 0x30] - ldrb r0, [r2] - adds r0, r3 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 24 - strh r0, [r1, 0x26] -_08140734: - adds r0, r7, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08140796 - cmp r5, 0 - beq _08140796 - ldr r4, _081407A0 @ =gSprites - ldr r3, _081407A4 @ =gBankSpriteIds - ldr r2, _081407A8 @ =gAnimBankTarget - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r6, 0 - movs r5, 0 - strh r5, [r0, 0x26] - ldrb r0, [r2] - adds r0, r3 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - ldr r0, _081407AC @ =gSharedMem + 0x17840 - ldrb r1, [r0, 0x9] - lsls r1, 30 - adds r2, 0x3E - lsrs r1, 31 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - strh r5, [r7, 0x2E] - ldr r0, _081407B0 @ =sub_81405C8 - str r0, [r7, 0x1C] - ldr r0, _081407B4 @ =gDoingBattleAnim - strb r6, [r0] - movs r0, 0x1 - bl UpdateOamPriorityInAllHealthboxes -_08140796: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0814079C: .4byte 0xfffffee0 -_081407A0: .4byte gSprites -_081407A4: .4byte gBankSpriteIds -_081407A8: .4byte gAnimBankTarget -_081407AC: .4byte gSharedMem + 0x17840 -_081407B0: .4byte sub_81405C8 -_081407B4: .4byte gDoingBattleAnim - thumb_func_end sub_81406BC - - thumb_func_start sub_81407B8 -sub_81407B8: @ 81407B8 - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x24] - ldrh r1, [r2, 0x20] - adds r0, r1 - movs r1, 0 - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x26] - ldrh r3, [r2, 0x22] - adds r0, r3 - strh r0, [r2, 0x22] - strh r1, [r2, 0x26] - strh r1, [r2, 0x24] - ldr r4, _081407F0 @ =sub_81407F4 - movs r3, 0 - movs r1, 0x5 - adds r0, r2, 0 - adds r0, 0x38 -_081407DC: - strh r3, [r0] - subs r0, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _081407DC - str r4, [r2, 0x1C] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_081407F0: .4byte sub_81407F4 - thumb_func_end sub_81407B8 - - thumb_func_start sub_81407F4 -sub_81407F4: @ 81407F4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 4 - adds r2, r0, 0 - ldrh r1, [r4, 0x2E] - adds r2, r1 - movs r0, 0xD0 - lsls r0, 3 - adds r3, r0, 0 - ldrh r1, [r4, 0x30] - adds r3, r1 - lsls r1, r3, 16 - asrs r1, 24 - ldrh r0, [r4, 0x24] - subs r0, r1 - strh r0, [r4, 0x24] - lsls r0, r2, 16 - asrs r0, 24 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - movs r0, 0xFF - ands r2, r0 - strh r2, [r4, 0x2E] - ands r3, r0 - strh r3, [r4, 0x30] - movs r2, 0x22 - ldrsh r0, [r4, r2] - movs r2, 0x26 - ldrsh r1, [r4, r2] - adds r0, r1 - cmp r0, 0xA0 - bgt _0814084A - movs r1, 0x20 - ldrsh r0, [r4, r1] - movs r2, 0x24 - ldrsh r1, [r4, r2] - adds r0, r1 - movs r1, 0x8 - negs r1, r1 - cmp r0, r1 - bge _0814085E -_0814084A: - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, _08140864 @ =sub_81405C8 - str r0, [r4, 0x1C] - ldr r1, _08140868 @ =gDoingBattleAnim - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - bl UpdateOamPriorityInAllHealthboxes -_0814085E: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08140864: .4byte sub_81405C8 -_08140868: .4byte gDoingBattleAnim - thumb_func_end sub_81407F4 - - thumb_func_start sub_814086C -sub_814086C: @ 814086C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r4, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r7, r3, 24 - lsls r4, 24 - lsrs r4, 24 - adds r5, r4, 0 - ldr r0, _08140910 @ =gUnknown_0840B258 - lsls r6, r5, 3 - adds r4, r6, r0 - ldrh r0, [r4, 0x6] - bl GetSpriteTileStartByTag - lsls r0, 16 - ldr r1, _08140914 @ =0xffff0000 - cmp r0, r1 - bne _081408B6 - adds r0, r4, 0 - bl LoadCompressedObjectPic - ldr r0, _08140918 @ =gUnknown_0840B2B8 - adds r0, r6, r0 - bl LoadCompressedObjectPalette -_081408B6: - ldr r1, _0814091C @ =gUnknown_0840B384 - lsls r0, r5, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, _08140920 @ =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - mov r1, r10 - strh r1, [r0, 0xA] - mov r1, r9 - strh r1, [r0, 0xC] - mov r1, r8 - strh r1, [r0, 0xE] - strh r7, [r0, 0x10] - strh r5, [r0, 0x26] - movs r0, 0xF - bl PlaySE - ldr r0, _08140924 @ =gMain - ldr r1, _08140928 @ =0x0000043d - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08140900 - ldr r1, _0814092C @ =gSharedMem + 0x17840 - ldrb r0, [r1, 0xA] - adds r0, 0x1 - strb r0, [r1, 0xA] -_08140900: - adds r0, r4, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_08140910: .4byte gUnknown_0840B258 -_08140914: .4byte 0xffff0000 -_08140918: .4byte gUnknown_0840B2B8 -_0814091C: .4byte gUnknown_0840B384 -_08140920: .4byte gTasks -_08140924: .4byte gMain -_08140928: .4byte 0x0000043d -_0814092C: .4byte gSharedMem + 0x17840 - thumb_func_end sub_814086C - - thumb_func_start sub_8140930 -sub_8140930: @ 8140930 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r1, _081409D0 @ =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r7, r0, r1 - ldrh r0, [r7, 0x26] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r1, 0x8 - ldrsh r0, [r7, r1] - cmp r0, 0xF - bgt _081409E4 - ldrb r1, [r7, 0xA] - ldrb r2, [r7, 0xC] - ldrb r6, [r7, 0xE] - ldrb r3, [r7, 0x10] - mov r4, r8 - lsls r0, r4, 1 - add r0, r8 - lsls r0, 3 - ldr r4, _081409D4 @ =gSpriteTemplate_840B3B4 - adds r0, r4 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r5, _081409D8 @ =gSprites - adds r2, r4, r5 - ldr r0, _081409DC @ =gUnknown_0840B378 - add r0, r8 - ldrb r1, [r0] - adds r0, r2, 0 - str r2, [sp] - bl StartSpriteAnim - adds r5, 0x1C - adds r4, r5 - ldr r0, _081409E0 @ =sub_8140A08 - str r0, [r4] - movs r0, 0x3 - ands r6, r0 - lsls r6, 2 - ldr r2, [sp] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - orrs r0, r6 - strb r0, [r2, 0x5] - ldrb r0, [r7, 0x8] - cmp r0, 0x7 - bls _081409B6 - subs r0, 0x8 - lsls r0, 24 - lsrs r0, 24 -_081409B6: - lsls r0, 5 - strh r0, [r2, 0x2E] - movs r1, 0x8 - ldrsh r0, [r7, r1] - cmp r0, 0xF - bne _081409E4 - movs r0, 0x1 - strh r0, [r2, 0x3C] - mov r0, r9 - bl DestroyTask - b _081409F6 - .align 2, 0 -_081409D0: .4byte gTasks -_081409D4: .4byte gSpriteTemplate_840B3B4 -_081409D8: .4byte gSprites -_081409DC: .4byte gUnknown_0840B378 -_081409E0: .4byte sub_8140A08 -_081409E4: - ldr r0, _08140A04 @ =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_081409F6: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08140A04: .4byte gTasks - thumb_func_end sub_8140930 - - thumb_func_start sub_8140A08 -sub_8140A08: @ 8140A08 - push {lr} - adds r1, r0, 0 - ldrh r2, [r1, 0x30] - movs r3, 0x30 - ldrsh r0, [r1, r3] - cmp r0, 0 - bne _08140A20 - ldr r0, _08140A1C @ =sub_8140A28 - str r0, [r1, 0x1C] - b _08140A24 - .align 2, 0 -_08140A1C: .4byte sub_8140A28 -_08140A20: - subs r0, r2, 0x1 - strh r0, [r1, 0x30] -_08140A24: - pop {r0} - bx r0 - thumb_func_end sub_8140A08 - - thumb_func_start sub_8140A28 -sub_8140A28: @ 8140A28 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0x2 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x32 - bne _08140A5C - adds r0, r4, 0 - bl sub_8141294 -_08140A5C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8140A28 - - thumb_func_start sub_8140A64 -sub_8140A64: @ 8140A64 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08140B24 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r6, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - mov r10, r0 - ldr r3, _08140B28 @ =gSprites - mov r8, r3 - ldr r0, _08140B2C @ =gUnknown_0840B378 - adds r1, r0 - mov r9, r1 -_08140AA8: - ldr r0, _08140B30 @ =gSpriteTemplate_840B3B4 - add r0, r10 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r5, r1, 2 - mov r0, r8 - adds r4, r5, r0 - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r3, _08140B34 @ =gSprites + 0x1C - adds r1, r5, r3 - ldr r0, _08140B38 @ =sub_8140ECC - str r0, [r1] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r0, r6, 5 - strh r0, [r4, 0x2E] - movs r0, 0xA - strh r0, [r4, 0x36] - movs r0, 0x2 - strh r0, [r4, 0x38] - movs r2, 0x1 - strh r2, [r4, 0x3A] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x7 - bls _08140AA8 - ldr r0, _08140B28 @ =gSprites - adds r0, r5, r0 - strh r2, [r0, 0x3C] - adds r0, r7, 0 - bl DestroyTask - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08140B24: .4byte gTasks -_08140B28: .4byte gSprites -_08140B2C: .4byte gUnknown_0840B378 -_08140B30: .4byte gSpriteTemplate_840B3B4 -_08140B34: .4byte gSprites + 0x1C -_08140B38: .4byte sub_8140ECC - thumb_func_end sub_8140A64 - - thumb_func_start sub_8140B3C -sub_8140B3C: @ 8140B3C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08140BFC @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r6, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - mov r10, r0 - ldr r3, _08140C00 @ =gSprites - mov r8, r3 - ldr r0, _08140C04 @ =gUnknown_0840B378 - adds r1, r0 - mov r9, r1 -_08140B80: - ldr r0, _08140C08 @ =gSpriteTemplate_840B3B4 - add r0, r10 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r5, r1, 2 - mov r0, r8 - adds r4, r5, r0 - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r3, _08140C0C @ =gSprites + 0x1C - adds r1, r5, r3 - ldr r0, _08140C10 @ =sub_8140ECC - str r0, [r1] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r0, r6, 5 - strh r0, [r4, 0x2E] - movs r0, 0xA - strh r0, [r4, 0x36] - movs r1, 0x1 - strh r1, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x3A] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x7 - bls _08140B80 - ldr r0, _08140C00 @ =gSprites - adds r0, r5, r0 - strh r1, [r0, 0x3C] - adds r0, r7, 0 - bl DestroyTask - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08140BFC: .4byte gTasks -_08140C00: .4byte gSprites -_08140C04: .4byte gUnknown_0840B378 -_08140C08: .4byte gSpriteTemplate_840B3B4 -_08140C0C: .4byte gSprites + 0x1C -_08140C10: .4byte sub_8140ECC - thumb_func_end sub_8140B3C - - thumb_func_start sub_8140C14 -sub_8140C14: @ 8140C14 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08140CD0 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r6, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - mov r10, r0 - ldr r3, _08140CD4 @ =gSprites - mov r8, r3 - ldr r0, _08140CD8 @ =gUnknown_0840B378 - adds r1, r0 - mov r9, r1 -_08140C58: - ldr r0, _08140CDC @ =gSpriteTemplate_840B3B4 - add r0, r10 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r5, r1, 2 - mov r0, r8 - adds r4, r5, r0 - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r3, _08140CE0 @ =gSprites + 0x1C - adds r1, r5, r3 - ldr r0, _08140CE4 @ =sub_8140ECC - str r0, [r1] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r0, r6, 5 - strh r0, [r4, 0x2E] - movs r0, 0x4 - strh r0, [r4, 0x36] - movs r2, 0x1 - strh r2, [r4, 0x38] - strh r2, [r4, 0x3A] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x7 - bls _08140C58 - ldr r0, _08140CD4 @ =gSprites - adds r0, r5, r0 - strh r2, [r0, 0x3C] - adds r0, r7, 0 - bl DestroyTask - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08140CD0: .4byte gTasks -_08140CD4: .4byte gSprites -_08140CD8: .4byte gUnknown_0840B378 -_08140CDC: .4byte gSpriteTemplate_840B3B4 -_08140CE0: .4byte gSprites + 0x1C -_08140CE4: .4byte sub_8140ECC - thumb_func_end sub_8140C14 - - thumb_func_start sub_8140CE8 -sub_8140CE8: @ 8140CE8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08140DAC @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r6, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - mov r10, r0 - ldr r3, _08140DB0 @ =gSprites - mov r8, r3 - ldr r0, _08140DB4 @ =gUnknown_0840B378 - adds r1, r0 - mov r9, r1 -_08140D2C: - ldr r0, _08140DB8 @ =gSpriteTemplate_840B3B4 - add r0, r10 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r5, r1, 2 - mov r0, r8 - adds r4, r5, r0 - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r3, _08140DBC @ =gSprites + 0x1C - adds r1, r5, r3 - ldr r0, _08140DC0 @ =sub_8140ECC - str r0, [r1] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 3 - adds r0, r6 - strh r0, [r4, 0x2E] - movs r0, 0x5 - strh r0, [r4, 0x36] - movs r2, 0x1 - strh r2, [r4, 0x38] - strh r2, [r4, 0x3A] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x9 - bls _08140D2C - ldr r0, _08140DB0 @ =gSprites - adds r0, r5, r0 - strh r2, [r0, 0x3C] - adds r0, r7, 0 - bl DestroyTask - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08140DAC: .4byte gTasks -_08140DB0: .4byte gSprites -_08140DB4: .4byte gUnknown_0840B378 -_08140DB8: .4byte gSpriteTemplate_840B3B4 -_08140DBC: .4byte gSprites + 0x1C -_08140DC0: .4byte sub_8140ECC - thumb_func_end sub_8140CE8 - - thumb_func_start sub_8140DC4 -sub_8140DC4: @ 8140DC4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08140DF0 @ =gTasks - lsls r2, r7, 2 - adds r0, r2, r7 - lsls r0, 3 - adds r3, r0, r1 - ldrh r1, [r3, 0x16] - movs r4, 0x16 - ldrsh r0, [r3, r4] - cmp r0, 0 - beq _08140DF4 - subs r0, r1, 0x1 - strh r0, [r3, 0x16] - b _08140EA4 - .align 2, 0 -_08140DF0: .4byte gTasks -_08140DF4: - ldrh r0, [r3, 0x26] - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r3, 0xA] - str r1, [sp] - ldrb r4, [r3, 0xC] - str r4, [sp, 0x4] - ldrb r1, [r3, 0xE] - str r1, [sp, 0x8] - ldrb r3, [r3, 0x10] - str r3, [sp, 0xC] - movs r6, 0 - str r2, [sp, 0x10] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - mov r10, r1 - ldr r3, _08140EB4 @ =gSprites - mov r8, r3 - ldr r1, _08140EB8 @ =gUnknown_0840B378 - adds r0, r1 - mov r9, r0 -_08140E20: - ldr r0, _08140EBC @ =gSpriteTemplate_840B3B4 - add r0, r10 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r5, r1, 2 - mov r0, r8 - adds r4, r5, r0 - mov r3, r9 - ldrb r1, [r3] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r0, _08140EC0 @ =gSprites + 0x1C - adds r1, r5, r0 - ldr r0, _08140EC4 @ =sub_8140ECC - str r0, [r1] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r0, r6, 5 - strh r0, [r4, 0x2E] - movs r2, 0x8 - strh r2, [r4, 0x36] - movs r0, 0x2 - strh r0, [r4, 0x38] - strh r0, [r4, 0x3A] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x7 - bls _08140E20 - ldr r0, _08140EC8 @ =gTasks - ldr r4, [sp, 0x10] - adds r1, r4, r7 - lsls r1, 3 - adds r1, r0 - strh r2, [r1, 0x16] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - bne _08140EA4 - ldr r0, _08140EB4 @ =gSprites - adds r0, r5, r0 - movs r1, 0x1 - strh r1, [r0, 0x3C] - adds r0, r7, 0 - bl DestroyTask -_08140EA4: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08140EB4: .4byte gSprites -_08140EB8: .4byte gUnknown_0840B378 -_08140EBC: .4byte gSpriteTemplate_840B3B4 -_08140EC0: .4byte gSprites + 0x1C -_08140EC4: .4byte sub_8140ECC -_08140EC8: .4byte gTasks - thumb_func_end sub_8140DC4 - - thumb_func_start sub_8140ECC -sub_8140ECC: @ 8140ECC - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x32 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x2E] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x38] - ldrh r2, [r4, 0x30] - adds r0, r2 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x33 - bne _08140F1C - adds r0, r4, 0 - bl sub_8141294 -_08140F1C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8140ECC - - thumb_func_start sub_8140F24 -sub_8140F24: @ 8140F24 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08140FE0 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r6, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - mov r10, r0 - ldr r3, _08140FE4 @ =gSprites - mov r8, r3 - ldr r0, _08140FE8 @ =gUnknown_0840B378 - adds r1, r0 - mov r9, r1 -_08140F68: - ldr r0, _08140FEC @ =gSpriteTemplate_840B3B4 - add r0, r10 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r5, r1, 2 - mov r0, r8 - adds r4, r5, r0 - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r3, _08140FF0 @ =gSprites + 0x1C - adds r1, r5, r3 - ldr r0, _08140FF4 @ =sub_8140FF8 - str r0, [r1] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 2 - adds r0, r6 - strh r0, [r4, 0x2E] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0xB - bls _08140F68 - ldr r0, _08140FE4 @ =gSprites - adds r0, r5, r0 - movs r1, 0x1 - strh r1, [r0, 0x3C] - adds r0, r7, 0 - bl DestroyTask - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08140FE0: .4byte gTasks -_08140FE4: .4byte gSprites -_08140FE8: .4byte gUnknown_0840B378 -_08140FEC: .4byte gSpriteTemplate_840B3B4 -_08140FF0: .4byte gSprites + 0x1C -_08140FF4: .4byte sub_8140FF8 - thumb_func_end sub_8140F24 - - thumb_func_start sub_8140FF8 -sub_8140FF8: @ 8140FF8 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - movs r2, 0x30 - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r5, 0x24] - movs r0, 0x2E - ldrsh r4, [r5, r0] - movs r2, 0x32 - ldrsh r1, [r5, r2] - adds r0, r4, 0 - bl Sin - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl Cos - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x2E] - adds r0, 0x6 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x33 - bne _08141050 - adds r0, r5, 0 - bl sub_8141294 -_08141050: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8140FF8 - - thumb_func_start sub_8141058 -sub_8141058: @ 8141058 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - ldr r1, _08141104 @ =gTasks - lsls r0, 2 - ldr r2, [sp] - adds r0, r2 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r3, [r0, 0xA] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xC] - str r2, [sp, 0x8] - ldrb r3, [r0, 0xE] - str r3, [sp, 0xC] - ldrb r0, [r0, 0x10] - str r0, [sp, 0x10] - movs r0, 0 - mov r8, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - str r0, [sp, 0x14] - ldr r0, _08141108 @ =gUnknown_0840B378 - adds r1, r0 - mov r10, r1 -_0814109E: - movs r7, 0 - movs r1, 0x1 - add r1, r8 - mov r9, r1 -_081410A6: - ldr r0, _0814110C @ =gSpriteTemplate_840B3B4 - ldr r2, [sp, 0x14] - adds r0, r2, r0 - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - ldr r3, [sp, 0x10] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - ldr r3, _08141110 @ =gSprites - adds r5, r4, r3 - mov r0, r10 - ldrb r1, [r0] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r1, _08141114 @ =gSprites + 0x1C - adds r4, r1 - ldr r0, _08141118 @ =sub_8140ECC - str r0, [r4] - movs r0, 0x3 - ldr r1, [sp, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r2, r3, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x5] - lsls r0, r7, 5 - strh r0, [r5, 0x2E] - movs r0, 0x8 - strh r0, [r5, 0x36] - mov r0, r8 - cmp r0, 0 - bne _0814111C - movs r0, 0x2 - strh r0, [r5, 0x38] - movs r0, 0x1 - b _08141122 - .align 2, 0 -_08141104: .4byte gTasks -_08141108: .4byte gUnknown_0840B378 -_0814110C: .4byte gSpriteTemplate_840B3B4 -_08141110: .4byte gSprites -_08141114: .4byte gSprites + 0x1C -_08141118: .4byte sub_8140ECC -_0814111C: - movs r0, 0x1 - strh r0, [r5, 0x38] - movs r0, 0x2 -_08141122: - strh r0, [r5, 0x3A] - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x7 - bls _081410A6 - mov r1, r9 - lsls r0, r1, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x1 - bls _0814109E - ldr r0, _08141160 @ =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] - ldr r0, [sp] - bl DestroyTask - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08141160: .4byte gSprites - thumb_func_end sub_8141058 - - thumb_func_start sub_8141164 -sub_8141164: @ 8141164 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08141218 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r6, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - mov r10, r0 - ldr r3, _0814121C @ =gSprites - mov r8, r3 - ldr r0, _08141220 @ =gUnknown_0840B378 - adds r1, r0 - mov r9, r1 -_081411A8: - ldr r0, _08141224 @ =gSpriteTemplate_840B3B4 - add r0, r10 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r5, r1, 2 - mov r0, r8 - adds r4, r5, r0 - mov r2, r9 - ldrb r1, [r2] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r3, _08141228 @ =gSprites + 0x1C - adds r1, r5, r3 - ldr r0, _0814122C @ =sub_8141230 - str r0, [r1] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r0, r6, 5 - strh r0, [r4, 0x2E] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x7 - bls _081411A8 - ldr r0, _0814121C @ =gSprites - adds r0, r5, r0 - movs r1, 0x1 - strh r1, [r0, 0x3C] - adds r0, r7, 0 - bl DestroyTask - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08141218: .4byte gTasks -_0814121C: .4byte gSprites -_08141220: .4byte gUnknown_0840B378 -_08141224: .4byte gSpriteTemplate_840B3B4 -_08141228: .4byte gSprites + 0x1C -_0814122C: .4byte sub_8141230 - thumb_func_end sub_8141164 - - thumb_func_start sub_8141230 -sub_8141230: @ 8141230 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - movs r2, 0x30 - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r5, 0x24] - movs r0, 0x2E - ldrsh r4, [r5, r0] - ldrh r1, [r5, 0x2E] - movs r0, 0x3F - ands r0, r1 - movs r2, 0x32 - ldrsh r1, [r5, r2] - bl Sin - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl Cos - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x2E] - adds r0, 0xA - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x33 - bne _0814128C - adds r0, r5, 0 - bl sub_8141294 -_0814128C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8141230 - - thumb_func_start sub_8141294 -sub_8141294: @ 8141294 - push {r4-r7,lr} - adds r5, r0, 0 - ldr r0, _081412B8 @ =gMain - ldr r1, _081412BC @ =0x0000043d - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _081412C0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _081412F2 - adds r0, r5, 0 - bl DestroySpriteAndFreeResources - b _0814130E - .align 2, 0 -_081412B8: .4byte gMain -_081412BC: .4byte 0x0000043d -_081412C0: - movs r1, 0x3C - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _08141308 - ldr r1, _081412FC @ =gSharedMem + 0x17840 - ldrb r0, [r1, 0xA] - subs r0, 0x1 - strb r0, [r1, 0xA] - lsls r0, 24 - cmp r0, 0 - bne _081412F2 - movs r7, 0 - ldr r6, _08141300 @ =gUnknown_0840B258 - ldr r4, _08141304 @ =gUnknown_0840B2B8 -_081412DC: - ldrh r0, [r6, 0x6] - bl FreeSpriteTilesByTag - ldrh r0, [r4, 0x4] - bl FreeSpritePaletteByTag - adds r6, 0x8 - adds r4, 0x8 - adds r7, 0x1 - cmp r7, 0xB - ble _081412DC -_081412F2: - adds r0, r5, 0 - bl DestroySprite - b _0814130E - .align 2, 0 -_081412FC: .4byte gSharedMem + 0x17840 -_08141300: .4byte gUnknown_0840B258 -_08141304: .4byte gUnknown_0840B2B8 -_08141308: - adds r0, r5, 0 - bl DestroySprite -_0814130E: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8141294 - - thumb_func_start sub_8141314 -sub_8141314: @ 8141314 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r4, r0, 0 - mov r9, r2 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r3, 24 - lsrs r7, r3, 24 - ldr r0, _08141378 @ =sub_81413DC - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, _0814137C @ =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r5, r0, r1 - strh r7, [r5, 0x26] - strh r6, [r5, 0xE] - mov r0, r9 - strh r0, [r5, 0x1C] - mov r1, r9 - lsrs r0, r1, 16 - strh r0, [r5, 0x1E] - cmp r4, 0 - bne _08141384 - lsls r0, r6, 20 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r0, 16 - ldr r2, _08141380 @ =gUnknown_0840B4D4 - lsls r1, r7, 1 - adds r1, r2 - ldrh r3, [r1] - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - movs r0, 0x1 - strh r0, [r5, 0xA] - b _081413AA - .align 2, 0 -_08141378: .4byte sub_81413DC -_0814137C: .4byte gTasks -_08141380: .4byte gUnknown_0840B4D4 -_08141384: - lsls r0, r6, 20 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r0, 16 - ldr r2, _081413CC @ =gUnknown_0840B4D4 - lsls r1, r7, 1 - adds r1, r2 - ldrh r3, [r1] - movs r1, 0x10 - movs r2, 0x10 - bl BlendPalette - movs r0, 0x10 - strh r0, [r5, 0x8] - ldr r0, _081413D0 @ =0x0000ffff - strh r0, [r5, 0xA] - ldr r0, _081413D4 @ =sub_814146C - str r0, [r5] -_081413AA: - ldr r0, _081413D8 @ =0x00007fff - str r0, [sp] - mov r0, r9 - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_081413CC: .4byte gUnknown_0840B4D4 -_081413D0: .4byte 0x0000ffff -_081413D4: .4byte sub_814146C -_081413D8: .4byte 0x00007fff - thumb_func_end sub_8141314 - - thumb_func_start sub_81413DC -sub_81413DC: @ 81413DC - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r1, _0814142C @ =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0xC - ldrsh r0, [r4, r2] - cmp r0, 0x10 - bgt _08141434 - movs r2, 0xE - ldrsh r0, [r4, r2] - lsls r0, 20 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r0, 16 - ldrb r2, [r4, 0x8] - ldr r3, _08141430 @ =gUnknown_0840B4D4 - lsls r1, 1 - adds r1, r3 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r0, r1 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - b _0814145C - .align 2, 0 -_0814142C: .4byte gTasks -_08141430: .4byte gUnknown_0840B4D4 -_08141434: - ldr r0, _08141464 @ =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0814145C - ldrh r0, [r4, 0x1C] - ldrh r1, [r4, 0x1E] - lsls r1, 16 - orrs r0, r1 - ldr r1, _08141468 @ =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - adds r0, r5, 0 - bl DestroyTask -_0814145C: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08141464: .4byte gPaletteFade -_08141468: .4byte 0x00007fff - thumb_func_end sub_81413DC - - thumb_func_start sub_814146C -sub_814146C: @ 814146C - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, _081414AC @ =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081414A4 - ldr r0, _081414B0 @ =gTasks - lsls r4, r2, 2 - adds r4, r2 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0x1C] - ldrh r1, [r4, 0x1E] - lsls r1, 16 - orrs r0, r1 - ldr r1, _081414B4 @ =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, _081414B8 @ =sub_81414BC - str r0, [r4] -_081414A4: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_081414AC: .4byte gPaletteFade -_081414B0: .4byte gTasks -_081414B4: .4byte 0x00007fff -_081414B8: .4byte sub_81414BC - thumb_func_end sub_814146C - - thumb_func_start sub_81414BC -sub_81414BC: @ 81414BC - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, _08141508 @ =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r1, r0, 24 - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0x10 - bgt _08141510 - movs r2, 0xE - ldrsh r0, [r4, r2] - lsls r0, 20 - movs r3, 0x80 - lsls r3, 17 - adds r0, r3 - lsrs r0, 16 - ldrb r2, [r4, 0x8] - ldr r3, _0814150C @ =gUnknown_0840B4D4 - lsls r1, 1 - adds r1, r3 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r0, r1 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - b _08141516 - .align 2, 0 -_08141508: .4byte gTasks -_0814150C: .4byte gUnknown_0840B4D4 -_08141510: - adds r0, r2, 0 - bl DestroyTask -_08141516: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81414BC - - thumb_func_start sub_814151C -sub_814151C: @ 814151C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0 - mov r8, r0 - ldr r0, _08141550 @ =gBankSpriteIds - ldr r3, _08141554 @ =gAnimBankAttacker - ldrb r2, [r3] - adds r0, r2, r0 - ldrb r6, [r0] - ldr r1, _08141558 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r5, r0, r1 - movs r1, 0x1C - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _081415F4 - cmp r0, 0x1 - bgt _0814155C - cmp r0, 0 - beq _08141562 - b _081416B6 - .align 2, 0 -_08141550: .4byte gBankSpriteIds -_08141554: .4byte gAnimBankAttacker -_08141558: .4byte gTasks -_0814155C: - cmp r0, 0x2 - beq _08141606 - b _081416B6 -_08141562: - ldr r0, _0814159C @ =gBattleAnimArgs - ldrh r0, [r0] - strh r0, [r5, 0x1E] - movs r2, 0xA0 - lsls r2, 3 - adds r0, r2, 0 - ldrh r4, [r5, 0x8] - adds r0, r4 - strh r0, [r5, 0x8] - ldrb r0, [r3] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _081415A4 - ldr r2, _081415A0 @ =gSprites - lsls r3, r6, 4 - adds r1, r3, r6 - lsls r1, 2 - adds r1, r2 - ldrh r0, [r5, 0x8] - lsls r0, 16 - asrs r0, 24 - ldrh r4, [r1, 0x24] - adds r0, r4 - strh r0, [r1, 0x24] - adds r4, r3, 0 - b _081415BC - .align 2, 0 -_0814159C: .4byte gBattleAnimArgs -_081415A0: .4byte gSprites -_081415A4: - ldr r3, _081415EC @ =gSprites - lsls r4, r6, 4 - adds r2, r4, r6 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r5, 0x8] - lsls r1, 16 - asrs r1, 24 - ldrh r0, [r2, 0x24] - subs r0, r1 - strh r0, [r2, 0x24] - adds r2, r3, 0 -_081415BC: - ldr r1, _081415F0 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r3, r0, r1 - ldrb r0, [r3, 0x8] - strh r0, [r3, 0x8] - adds r0, r4, r6 - lsls r0, 2 - adds r0, r2 - movs r2, 0x20 - ldrsh r1, [r0, r2] - movs r4, 0x24 - ldrsh r0, [r0, r4] - adds r1, r0 - adds r1, 0x20 - movs r0, 0x98 - lsls r0, 1 - cmp r1, r0 - bls _081416B6 - ldrh r0, [r3, 0x1C] - adds r0, 0x1 - strh r0, [r3, 0x1C] - b _081416B6 - .align 2, 0 -_081415EC: .4byte gSprites -_081415F0: .4byte gTasks -_081415F4: - ldrb r1, [r5, 0x1E] - adds r0, r2, 0 - adds r2, r6, 0 - bl refresh_graphics_maybe - ldrh r0, [r5, 0x1C] - adds r0, 0x1 - strh r0, [r5, 0x1C] - b _081416B6 -_08141606: - movs r1, 0xA0 - lsls r1, 3 - adds r0, r1, 0 - ldrh r2, [r5, 0x8] - adds r0, r2 - strh r0, [r5, 0x8] - ldrb r0, [r3] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0814163C - ldr r0, _08141638 @ =gSprites - lsls r3, r6, 4 - adds r2, r3, r6 - lsls r2, 2 - adds r2, r0 - ldrh r1, [r5, 0x8] - lsls r1, 16 - asrs r1, 24 - ldrh r0, [r2, 0x24] - subs r0, r1 - strh r0, [r2, 0x24] - adds r4, r3, 0 - b _08141654 - .align 2, 0 -_08141638: .4byte gSprites -_0814163C: - ldr r0, _08141688 @ =gSprites - lsls r2, r6, 4 - adds r1, r2, r6 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r5, 0x8] - lsls r0, 16 - asrs r0, 24 - ldrh r3, [r1, 0x24] - adds r0, r3 - strh r0, [r1, 0x24] - adds r4, r2, 0 -_08141654: - ldr r1, _0814168C @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrb r1, [r0, 0x8] - strh r1, [r0, 0x8] - ldr r0, _08141690 @ =gAnimBankAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _08141694 - ldr r0, _08141688 @ =gSprites - adds r1, r4, r6 - lsls r1, 2 - adds r1, r0 - movs r4, 0x24 - ldrsh r0, [r1, r4] - cmp r0, 0 - bgt _081416AA - movs r0, 0 - strh r0, [r1, 0x24] - b _081416B0 - .align 2, 0 -_08141688: .4byte gSprites -_0814168C: .4byte gTasks -_08141690: .4byte gAnimBankAttacker -_08141694: - ldr r0, _081416C0 @ =gSprites - adds r1, r4, r6 - lsls r1, 2 - adds r1, r0 - movs r3, 0x24 - ldrsh r0, [r1, r3] - cmp r0, 0 - blt _081416AA - strh r2, [r1, 0x24] - movs r4, 0x1 - mov r8, r4 -_081416AA: - mov r0, r8 - cmp r0, 0 - beq _081416B6 -_081416B0: - adds r0, r7, 0 - bl DestroyAnimVisualTask -_081416B6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_081416C0: .4byte gSprites - thumb_func_end sub_814151C - - thumb_func_start sub_81416C4 -sub_81416C4: @ 81416C4 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, _081416E8 @ =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x26 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08141744 - cmp r0, 0x1 - bgt _081416EC - cmp r0, 0 - beq _081416F2 - b _081417B8 - .align 2, 0 -_081416E8: .4byte gTasks -_081416EC: - cmp r0, 0x2 - beq _0814177C - b _081417B8 -_081416F2: - ldr r0, _08141708 @ =gAnimBankAttacker - ldrb r0, [r0] - bl GetBattlerPosition_permutated - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08141714 - ldr r1, _0814170C @ =REG_BLDCNT - ldr r2, _08141710 @ =0x00003f42 - b _08141718 - .align 2, 0 -_08141708: .4byte gAnimBankAttacker -_0814170C: .4byte REG_BLDCNT -_08141710: .4byte 0x00003f42 -_08141714: - ldr r1, _08141734 @ =REG_BLDCNT - ldr r2, _08141738 @ =0x00003f44 -_08141718: - adds r0, r2, 0 - strh r0, [r1] - ldr r1, _0814173C @ =REG_BLDALPHA - movs r0, 0x10 - strh r0, [r1] - ldr r1, _08141740 @ =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - adds r1, 0x1 - strh r1, [r0, 0x26] - b _081417B8 - .align 2, 0 -_08141734: .4byte REG_BLDCNT -_08141738: .4byte 0x00003f44 -_0814173C: .4byte REG_BLDALPHA -_08141740: .4byte gTasks -_08141744: - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _081417B8 - movs r0, 0 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r1, 0x1 - strh r1, [r4, 0x8] - ldr r3, _08141778 @ =REG_BLDALPHA - lsls r2, r1, 8 - movs r0, 0x10 - subs r0, r1 - orrs r2, r0 - strh r2, [r3] - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _081417B8 - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - b _081417B8 - .align 2, 0 -_08141778: .4byte REG_BLDALPHA -_0814177C: - ldr r1, _081417C0 @ =gBankSpriteIds - ldr r3, _081417C4 @ =gAnimBankAttacker - ldrb r0, [r3] - adds r0, r1 - ldrb r1, [r0] - ldr r2, _081417C8 @ =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x4] - lsls r0, 22 - lsrs r0, 17 - ldr r1, _081417CC @ =0x06010000 - adds r0, r1 - movs r1, 0 - str r1, [sp] - ldr r1, _081417D0 @ =0x040000d4 - mov r2, sp - str r2, [r1] - str r0, [r1, 0x4] - ldr r0, _081417D4 @ =0x85000200 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldrb r0, [r3] - bl sub_80324E0 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_081417B8: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_081417C0: .4byte gBankSpriteIds -_081417C4: .4byte gAnimBankAttacker -_081417C8: .4byte gSprites -_081417CC: .4byte 0x06010000 -_081417D0: .4byte 0x040000d4 -_081417D4: .4byte 0x85000200 - thumb_func_end sub_81416C4 - - thumb_func_start sub_81417D8 -sub_81417D8: @ 81417D8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, _081417FC @ =gBattleAnimArgs - ldr r1, _08141800 @ =gAnimBankAttacker - ldrb r1, [r1] - lsls r1, 2 - ldr r2, _08141804 @ =gSharedMem + 0x17800 - adds r1, r2 - ldr r1, [r1] - lsls r1, 29 - lsrs r1, 31 - strh r1, [r3, 0xE] - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .align 2, 0 -_081417FC: .4byte gBattleAnimArgs -_08141800: .4byte gAnimBankAttacker -_08141804: .4byte gSharedMem + 0x17800 - thumb_func_end sub_81417D8 - - thumb_func_start sub_8141808 -sub_8141808: @ 8141808 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, _08141820 @ =gAnimBankTarget - ldr r1, _08141824 @ =gEffectBank - ldrb r1, [r1] - strb r1, [r2] - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .align 2, 0 -_08141820: .4byte gAnimBankTarget -_08141824: .4byte gEffectBank - thumb_func_end sub_8141808 - - thumb_func_start sub_8141828 -sub_8141828: @ 8141828 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r1, 0 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0 - mov r8, r0 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - ldr r1, _081418E0 @ =gSharedMem + 0x17810 - adds r0, r1 - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - adds r5, r0, 0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r4, r0, 0 - adds r0, r6, 0 - bl IsAnimBankSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _081418FC - lsrs r0, r5, 16 - ldr r7, _081418E4 @ =0x0000ffff - ands r5, r7 - eors r0, r5 - lsrs r1, r4, 16 - eors r0, r1 - ands r4, r7 - eors r0, r4 - cmp r0, 0x7 - bhi _08141882 - movs r0, 0x1 - mov r8, r0 -_08141882: - mov r0, r8 - cmp r0, 0 - beq _081418FC - ldr r0, _081418E8 @ =0x000027f9 - bl GetSpriteTileStartByTag - lsls r0, 16 - lsrs r0, 16 - cmp r0, r7 - bne _081418A2 - ldr r0, _081418EC @ =gBattleAnimPicTable + (233 * 8) - bl LoadCompressedObjectPic - ldr r0, _081418F0 @ =gBattleAnimPaletteTable + (233 * 8) - bl LoadCompressedObjectPalette -_081418A2: - ldr r5, _081418F4 @ =sub_814191C - adds r0, r5, 0 - movs r1, 0xA - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r3, _081418F8 @ =gTasks - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 3 - adds r2, r3 - movs r4, 0 - strh r6, [r2, 0x8] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r3 - strh r6, [r1, 0x8] - strh r4, [r2, 0xA] - movs r0, 0x1 - strh r0, [r1, 0xA] - b _0814190E - .align 2, 0 -_081418E0: .4byte gSharedMem + 0x17810 -_081418E4: .4byte 0x0000ffff -_081418E8: .4byte 0x000027f9 -_081418EC: .4byte gBattleAnimPicTable + (233 * 8) -_081418F0: .4byte gBattleAnimPaletteTable + (233 * 8) -_081418F4: .4byte sub_814191C -_081418F8: .4byte gTasks -_081418FC: - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - ldr r1, _08141918 @ =gSharedMem + 0x17810 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0, 0x1] -_0814190E: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08141918: .4byte gSharedMem + 0x17810 - thumb_func_end sub_8141828 - - thumb_func_start sub_814191C -sub_814191C: @ 814191C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, _08141944 @ =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0x22] - movs r2, 0x22 - ldrsh r0, [r4, r2] - cmp r0, 0x3B - bgt _08141948 - adds r0, r1, 0x1 - strh r0, [r4, 0x22] - b _08141AB8 - .align 2, 0 -_08141944: .4byte gTasks -_08141948: - ldr r0, _08141998 @ =gSharedMem + 0x17840 - ldrb r0, [r0, 0xA] - cmp r0, 0 - beq _08141952 - b _08141AB8 -_08141952: - ldrh r0, [r4, 0x1C] - adds r1, r0, 0x1 - strh r1, [r4, 0x1C] - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - cmp r1, 0 - beq _08141966 - b _08141AB8 -_08141966: - ldrb r0, [r4, 0x8] - mov r8, r0 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0x1E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081419A0 - ldr r0, _0814199C @ =gBattleAnimSpriteTemplate_84024E8 - adds r1, r5, 0 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - b _08141A02 - .align 2, 0 -_08141998: .4byte gSharedMem + 0x17840 -_0814199C: .4byte gBattleAnimSpriteTemplate_84024E8 -_081419A0: - cmp r0, 0 - blt _081419D4 - cmp r0, 0x3 - bgt _081419D4 - ldr r0, _081419CC @ =gSpriteTemplate_8402500 - adds r1, r5, 0 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, _081419D0 @ =gSprites - lsls r2, r5, 4 - adds r2, r5 - lsls r2, 2 - adds r2, r0 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x4 - b _081419F4 - .align 2, 0 -_081419CC: .4byte gSpriteTemplate_8402500 -_081419D0: .4byte gSprites -_081419D4: - ldr r0, _08141A2C @ =gSpriteTemplate_8402500 - adds r1, r5, 0 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, _08141A30 @ =gSprites - lsls r2, r5, 4 - adds r2, r5 - lsls r2, 2 - adds r2, r0 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x5 -_081419F4: - ldr r4, _08141A34 @ =0x000003ff - adds r0, r4, 0 - ands r1, r0 - ldr r0, _08141A38 @ =0xfffffc00 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] -_08141A02: - ldr r2, _08141A3C @ =gTasks - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r6, r0, r2 - movs r2, 0xA - ldrsh r0, [r6, r2] - mov r9, r1 - cmp r0, 0 - bne _08141A44 - ldr r1, _08141A30 @ =gSprites - lsls r2, r5, 4 - adds r0, r2, r5 - lsls r0, 2 - adds r1, 0x1C - adds r0, r1 - ldr r1, _08141A40 @ =sub_8141B20 - str r1, [r0] - adds r4, r2, 0 - b _08141A8C - .align 2, 0 -_08141A2C: .4byte gSpriteTemplate_8402500 -_08141A30: .4byte gSprites -_08141A34: .4byte 0x000003ff -_08141A38: .4byte 0xfffffc00 -_08141A3C: .4byte gTasks -_08141A40: .4byte sub_8141B20 -_08141A44: - ldr r3, _08141AC4 @ =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, _08141AC8 @ =sub_8141B74 - str r2, [r0] - adds r1, r3 - ldr r0, _08141ACC @ =0x0000ffe0 - strh r0, [r1, 0x24] - movs r0, 0x20 - strh r0, [r1, 0x26] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - movs r1, 0x1E - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08141A8C - mov r0, r8 - bl GetBattlerSide - lsls r0, 24 - movs r1, 0x3F - cmp r0, 0 - bne _08141A82 - movs r1, 0xC0 -_08141A82: - lsls r1, 24 - asrs r1, 24 - movs r0, 0x66 - bl PlaySE12WithPanning -_08141A8C: - ldr r1, _08141AC4 @ =gSprites - adds r0, r4, r5 - lsls r0, 2 - adds r0, r1 - strh r7, [r0, 0x2E] - ldr r1, _08141AD0 @ =gTasks - mov r2, r9 - adds r0, r2, r7 - lsls r0, 3 - adds r2, r0, r1 - ldrh r1, [r2, 0x1E] - adds r1, 0x1 - strh r1, [r2, 0x1E] - ldrh r0, [r2, 0x20] - adds r0, 0x1 - strh r0, [r2, 0x20] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x5 - bne _08141AB8 - ldr r0, _08141AD4 @ =sub_8141AD8 - str r0, [r2] -_08141AB8: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08141AC4: .4byte gSprites -_08141AC8: .4byte sub_8141B74 -_08141ACC: .4byte 0x0000ffe0 -_08141AD0: .4byte gTasks -_08141AD4: .4byte sub_8141AD8 - thumb_func_end sub_814191C - - thumb_func_start sub_8141AD8 -sub_8141AD8: @ 8141AD8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r3, r0, 0 - ldr r1, _08141B18 @ =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r1, r0, r1 - movs r2, 0x20 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08141B14 - movs r2, 0xA - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _08141B0E - ldrb r1, [r1, 0x8] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, _08141B1C @ =gSharedMem + 0x17810 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0, 0x1] -_08141B0E: - adds r0, r3, 0 - bl DestroyTask -_08141B14: - pop {r0} - bx r0 - .align 2, 0 -_08141B18: .4byte gTasks -_08141B1C: .4byte gSharedMem + 0x17810 - thumb_func_end sub_8141AD8 - - thumb_func_start sub_8141B20 -sub_8141B20: @ 8141B20 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x18 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x18 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0xC - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _08141B6A - ldr r2, _08141B70 @ =gTasks - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x20] - subs r1, 0x1 - strh r1, [r0, 0x20] - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite -_08141B6A: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08141B70: .4byte gTasks - thumb_func_end sub_8141B20 - - thumb_func_start sub_8141B74 -sub_8141B74: @ 8141B74 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - bgt _08141B88 - adds r0, r1, 0x1 - strh r0, [r4, 0x30] - b _08141BCA -_08141B88: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldrh r1, [r4, 0x24] - adds r1, 0x5 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x5 - strh r0, [r4, 0x26] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x20 - ble _08141BCA - ldr r2, _08141BD0 @ =gTasks - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x20] - subs r1, 0x1 - strh r1, [r0, 0x20] - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite -_08141BCA: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08141BD0: .4byte gTasks - thumb_func_end sub_8141B74 - - thumb_func_start sub_8141BD4 -sub_8141BD4: @ 8141BD4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, _08141BFC @ =gBattleAnimPicTable + (269 * 8) - bl LoadCompressedObjectPic - ldr r0, _08141C00 @ =gBattleAnimPaletteTable + (269 * 8) - bl LoadCompressedObjectPalette - ldr r0, _08141C04 @ =0x0000281d - bl IndexOfSpritePaletteTag - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08141BFC: .4byte gBattleAnimPicTable + (269 * 8) -_08141C00: .4byte gBattleAnimPaletteTable + (269 * 8) -_08141C04: .4byte 0x0000281d - thumb_func_end sub_8141BD4 - - thumb_func_start sub_8141C08 -sub_8141C08: @ 8141C08 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, _08141C2C @ =0x0000281d - adds r0, r5, 0 - bl FreeSpriteTilesByTag - adds r0, r5, 0 - bl FreeSpritePaletteByTag - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08141C2C: .4byte 0x0000281d - thumb_func_end sub_8141C08 - - thumb_func_start sub_8141C30 -sub_8141C30: @ 8141C30 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0 - bl InitAnimSpritePos - movs r0, 0x1E - strh r0, [r4, 0x2E] - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r5, _08141CA4 @ =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r5, 0x4] - adds r0, r1 - strh r0, [r4, 0x32] - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r5, [r5, 0x6] - adds r0, r5 - strh r0, [r4, 0x36] - ldr r0, _08141CA8 @ =0x0000ffe0 - strh r0, [r4, 0x38] - adds r0, r4, 0 - bl InitAnimSpriteTranslationOverDuration - ldr r1, _08141CAC @ =gBankSpriteIds - ldr r0, _08141CB0 @ =gAnimBankAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, _08141CB4 @ =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, _08141CB8 @ =sub_8141CBC - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08141CA4: .4byte gBattleAnimArgs -_08141CA8: .4byte 0x0000ffe0 -_08141CAC: .4byte gBankSpriteIds -_08141CB0: .4byte gAnimBankAttacker -_08141CB4: .4byte gSprites -_08141CB8: .4byte sub_8141CBC - thumb_func_end sub_8141C30 - - thumb_func_start sub_8141CBC -sub_8141CBC: @ 8141CBC - push {lr} - adds r3, r0, 0 - ldr r2, _08141CE4 @ =gSprites - ldr r1, _08141CE8 @ =gBankSpriteIds - ldr r0, _08141CEC @ =gAnimBankAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _08141CE0 - ldr r0, _08141CF0 @ =sub_8141CF4 - str r0, [r3, 0x1C] -_08141CE0: - pop {r0} - bx r0 - .align 2, 0 -_08141CE4: .4byte gSprites -_08141CE8: .4byte gBankSpriteIds -_08141CEC: .4byte gAnimBankAttacker -_08141CF0: .4byte sub_8141CF4 - thumb_func_end sub_8141CBC - - thumb_func_start sub_8141CF4 -sub_8141CF4: @ 8141CF4 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimSpriteLinearAndSine - lsls r0, 24 - cmp r0, 0 - beq _08141D16 - movs r0, 0 - strh r0, [r4, 0x2E] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, _08141D1C @ =sub_8141D20 - str r0, [r4, 0x1C] -_08141D16: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08141D1C: .4byte sub_8141D20 - thumb_func_end sub_8141CF4 - - thumb_func_start sub_8141D20 -sub_8141D20: @ 8141D20 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, _08141D70 @ =gSprites - ldr r3, _08141D74 @ =gBankSpriteIds - ldr r2, _08141D78 @ =gAnimBankAttacker - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08141D68 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - ble _08141D68 - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl DestroyAnimSprite -_08141D68: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08141D70: .4byte gSprites -_08141D74: .4byte gBankSpriteIds -_08141D78: .4byte gAnimBankAttacker - thumb_func_end sub_8141D20 - - thumb_func_start sub_8141D7C -sub_8141D7C: @ 8141D7C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - bl GetBattlerAtPosition - ldr r1, _08141DA4 @ =gAnimBankAttacker - strb r0, [r1] - movs r0, 0x1 - bl GetBattlerAtPosition - ldr r1, _08141DA8 @ =gAnimBankTarget - strb r0, [r1] - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08141DA4: .4byte gAnimBankAttacker -_08141DA8: .4byte gAnimBankTarget - thumb_func_end sub_8141D7C - - thumb_func_start sub_8141DAC -sub_8141DAC: @ 8141DAC - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, _08141DC0 @ =gSharedMem + 0x17840 - ldrh r1, [r0] - cmp r1, 0x53 - bne _08141DC8 - ldr r1, _08141DC4 @ =gBattleAnimArgs - movs r0, 0x1 - b _08141E00 - .align 2, 0 -_08141DC0: .4byte gSharedMem + 0x17840 -_08141DC4: .4byte gBattleAnimArgs -_08141DC8: - cmp r1, 0xFA - bne _08141DD8 - ldr r1, _08141DD4 @ =gBattleAnimArgs - movs r0, 0x2 - b _08141E00 - .align 2, 0 -_08141DD4: .4byte gBattleAnimArgs -_08141DD8: - cmp r1, 0x80 - bne _08141DE8 - ldr r1, _08141DE4 @ =gBattleAnimArgs - movs r0, 0x3 - b _08141E00 - .align 2, 0 -_08141DE4: .4byte gBattleAnimArgs -_08141DE8: - movs r0, 0xA4 - lsls r0, 1 - cmp r1, r0 - bne _08141DFC - ldr r1, _08141DF8 @ =gBattleAnimArgs - movs r0, 0x4 - b _08141E00 - .align 2, 0 -_08141DF8: .4byte gBattleAnimArgs -_08141DFC: - ldr r1, _08141E0C @ =gBattleAnimArgs - movs r0, 0 -_08141E00: - strh r0, [r1] - adds r0, r2, 0 - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .align 2, 0 -_08141E0C: .4byte gBattleAnimArgs - thumb_func_end sub_8141DAC - - thumb_func_start sub_8141E10 -sub_8141E10: @ 8141E10 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, _08141E2C @ =gAnimBankAttacker - ldr r1, _08141E30 @ =gSharedMem + 0x17840 - ldrh r1, [r1] - strb r1, [r2] - ldr r2, _08141E34 @ =gAnimBankTarget - lsrs r1, 8 - strb r1, [r2] - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .align 2, 0 -_08141E2C: .4byte gAnimBankAttacker -_08141E30: .4byte gSharedMem + 0x17840 -_08141E34: .4byte gAnimBankTarget - thumb_func_end sub_8141E10 - - .align 2, 0 @ Don't pad with nop. @@ -336,7 +336,7 @@ _080D7976: ldr r1, _080D79AC @ =DestroyAnimSprite adds r0, r4, 0 bl StoreSpriteCallbackInData - ldr r0, _080D79B0 @ =StartTranslateAnimSpriteByDeltas + ldr r0, _080D79B0 @ =StartAnimLinearTranslation str r0, [r4, 0x1C] pop {r4} pop {r0} @@ -345,7 +345,7 @@ _080D7976: _080D79A4: .4byte gBattleAnimArgs _080D79A8: .4byte gAnimBankTarget _080D79AC: .4byte DestroyAnimSprite -_080D79B0: .4byte StartTranslateAnimSpriteByDeltas +_080D79B0: .4byte StartAnimLinearTranslation thumb_func_end sub_80D792C thumb_func_start sub_80D79B4 @@ -1186,7 +1186,7 @@ _080D800C: adds r0, r1 strh r0, [r5, 0x36] adds r0, r5, 0 - bl InitAnimSpriteTranslationDeltas + bl InitAnimLinearTranslation movs r0, 0x40 strh r0, [r5, 0x38] ldr r1, _080D8044 @ =sub_80D8048 @@ -1206,7 +1206,7 @@ _080D8044: .4byte sub_80D8048 sub_80D8048: @ 80D8048 push {r4,lr} adds r4, r0, 0 - bl TranslateAnimSpriteByDeltas + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _080D80D2 @@ -2192,7 +2192,7 @@ _080D8824: strb r0, [r1] _080D8858: adds r0, r5, 0 - bl InitAnimSpriteTranslationDeltas + bl InitAnimLinearTranslation ldr r0, _080D8870 @ =sub_80D8874 str r0, [r5, 0x1C] pop {r3} @@ -2228,7 +2228,7 @@ _080D8894: b _080D8AD0 _080D8896: adds r0, r4, 0 - bl TranslateAnimSpriteByDeltas + bl TranslateAnimLinear ldr r1, _080D88C0 @ =gSineTable movs r2, 0x38 ldrsh r0, [r4, r2] @@ -2326,13 +2326,13 @@ _080D893A: ands r0, r1 strh r0, [r4, 0x38] adds r0, r4, 0 - bl InitAnimSpriteTranslationDeltas + bl InitAnimLinearTranslation b _080D8AD0 .align 2, 0 _080D8964: .4byte gSineTable _080D8968: adds r0, r4, 0 - bl TranslateAnimSpriteByDeltas + bl TranslateAnimLinear ldr r1, _080D89C8 @ =gSineTable movs r2, 0x38 ldrsh r0, [r4, r2] @@ -2484,7 +2484,7 @@ _080D8A7A: _080D8A90: .4byte 0x0000fff0 _080D8A94: adds r0, r4, 0 - bl TranslateAnimSpriteByDeltas + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _080D8AD0 @@ -3025,7 +3025,7 @@ _080D8E92: ldrh r0, [r6, 0xA] strh r0, [r5, 0x38] adds r0, r5, 0 - bl InitAnimSpriteTranslationOverDuration + bl InitAnimArcTranslation ldr r0, _080D8EDC @ =sub_80D8EE0 str r0, [r5, 0x1C] pop {r4-r6} @@ -3043,7 +3043,7 @@ _080D8EDC: .4byte sub_80D8EE0 sub_80D8EE0: @ 80D8EE0 push {r4,lr} adds r4, r0, 0 - bl TranslateAnimSpriteLinearAndSine + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _080D8F02 diff --git a/asm/water.s b/asm/water.s index 6f9c5cb9d..20bba76c6 100644 --- a/asm/water.s +++ b/asm/water.s @@ -2053,7 +2053,7 @@ sub_80D4AD0: @ 80D4AD0 strh r1, [r0, 0x36] ldrh r1, [r6, 0x1A] strh r1, [r0, 0x38] - bl InitAnimSpriteTranslationOverDuration + bl InitAnimArcTranslation adds r5, 0x1C adds r4, r5 ldr r0, _080D4B38 @ =sub_80D4B3C @@ -2075,7 +2075,7 @@ _080D4B38: .4byte sub_80D4B3C sub_80D4B3C: @ 80D4B3C push {r4-r6,lr} adds r6, r0, 0 - bl TranslateAnimSpriteLinearAndSine + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _080D4B96 @@ -2110,7 +2110,7 @@ sub_80D4B3C: @ 80D4B3C mvns r1, r1 strh r1, [r6, 0x38] adds r0, r6, 0 - bl InitAnimSpriteTranslationOverDuration + bl InitAnimArcTranslation ldr r0, _080D4BA0 @ =sub_80D4BA4 str r0, [r6, 0x1C] _080D4B96: @@ -2126,7 +2126,7 @@ _080D4BA0: .4byte sub_80D4BA4 sub_80D4BA4: @ 80D4BA4 push {r4-r6,lr} adds r5, r0, 0 - bl TranslateAnimSpriteLinearAndSine + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _080D4BE0 diff --git a/include/battle.h b/include/battle.h index c9bbb56eb..06a390cdf 100644 --- a/include/battle.h +++ b/include/battle.h @@ -458,6 +458,9 @@ struct Struct2017840 u8 filler2[6]; u8 unk8; u8 unk9_0:1; + u8 unk9_1:1; + u8 unkA; + u16 unkC; }; struct Struct20238C8 @@ -840,6 +843,8 @@ void SetBankFuncToOpponentBufferRunCommand(void); void BattleStopLowHpSound(void); void sub_8031FC4(u8, u8, bool8); void sub_8032984(u8, u16); +void refresh_graphics_maybe(u8, u8, u8); +void sub_80324E0(u8 a); void SetBankFuncToLinkOpponentBufferRunCommand(void); diff --git a/include/battle_anim_813F0F4.h b/include/battle_anim_813F0F4.h index 230a04dbb..9916f2fe6 100644 --- a/include/battle_anim_813F0F4.h +++ b/include/battle_anim_813F0F4.h @@ -1,6 +1,9 @@ #ifndef GUARD_BATTLE_ANIM_813F0F4_H #define GUARD_BATTLE_ANIM_813F0F4_H -void sub_8141828(); +void sub_8141828(u8, struct Pokemon *); +u8 ball_number_to_ball_processing_index(u16); +u8 sub_814086C(u8, u8, u8, u8, u8); +u8 sub_8141314(u8, u8, u32, u8); #endif // GUARD_BATTLE_ANIM_813F0F4_H diff --git a/include/decompress.h b/include/decompress.h index 01f66971c..a97dd78f1 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -5,13 +5,13 @@ void LZDecompressWram(const void *src, void *dest); void LZDecompressVram(const void *src, void *dest); -void LoadCompressedObjectPic(const struct CompressedSpriteSheet *a); -void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *a, void *buffer); -void LoadCompressedObjectPalette(const struct CompressedSpritePalette *a); -void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); -void DecompressPicFromTable_2(const struct CompressedSpriteSheet *a, u8 b, u8 c, void *d, void *e, s32 f); -void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 b, u32 c, u32 d, void *dest, s32 species, u32 pid); -void LoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g, u32 h); +void LoadCompressedObjectPic(const struct CompressedSpriteSheet *src); +void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); +void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src); +void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer); +void DecompressPicFromTable_2(const struct CompressedSpriteSheet *a, u8 coords, u8 y_offset, void *d, void *dest, s32 species); +void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 coords, u32 y_offset, u32 d, void *dest, s32 species, u32 pid); +void LoadSpecialPokePic(const struct CompressedSpriteSheet *spriteSheet, u32 coords, u32 y_offset, u32 d, void *dest, s32 species, u32 pid, u32 frontOrBack); void Unused_LZDecompressWramIndirect(const void **src, void *dest); #endif // GUARD_DECOMPRESS_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index f15348689..15766a350 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -90,10 +90,10 @@ struct EventObjectTemplate struct WarpEvent { s16 x, y; - s8 warpId; - u8 mapGroup; + u8 elevation; + u8 warpId; u8 mapNum; - u8 unk7; + u8 mapGroup; }; struct CoordEvent diff --git a/include/macros/map.inc b/include/macros/map.inc index 80257fd23..bc54271d4 100644 --- a/include/macros/map.inc +++ b/include/macros/map.inc @@ -26,9 +26,9 @@ inc _num_npcs .endm - .macro warp_def x, y, byte, warp, map_id + .macro warp_def x, y, elevation, warp, map_id .2byte \x, \y - .byte \byte, \warp + .byte \elevation, \warp .byte \map_id & 0xFF @ map num .byte \map_id >> 8 @ map group inc _num_warps diff --git a/include/menu.h b/include/menu.h index 8741649c8..921a05eca 100644 --- a/include/menu.h +++ b/include/menu.h @@ -70,7 +70,7 @@ u8 unref_sub_8072A5C(u8 *, u8 *, u8, u16, u8, u32); int sub_8072AB0(const u8 *, u8, u16, u8, u8, u32); void MenuPrint_RightAligned(const u8 *, u8, u8); void sub_8072B80(const u8 *, u8, u8, const u8 *); -void sub_8072BD8(const u8 *, u8, u8, u16); +void MenuPrint_Centered(const u8 *, u8, u8, u16); u8 *AlignInt1InMenuWindow(u8 *, s32, u8, u8); u8 *AlignInt2InMenuWindow(u8 *, s32, u8, u8); u8 *AlignStringInMenuWindow(u8 *, const u8 *, u8, u8); diff --git a/include/money.h b/include/money.h index e3a3f898d..43579910c 100644 --- a/include/money.h +++ b/include/money.h @@ -6,7 +6,7 @@ void AddMoney(u32 *, u32); void RemoveMoney(u32 *, u32); void GetMoneyAmountText(u8 *buffer, u32 arg1, u8 arg2); void PrintMoneyAmount(u32 arg0, u8 arg1, u8 x, u8 y); -void sub_80B7AEC(u32, u8 left, u8 top); +void sub_80B7AEC(u32, u8 right, u8 top); void Draw10000Sprite(u8, u8, int); void UpdateMoneyWindow(u32, u8, u8); void OpenMoneyWindow(u32, u8, u8); diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index f1dbe0089..29bdd332e 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -63,7 +63,6 @@ void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u8 sub_809FA30(void); u8 GetPrimaryStatus(u32); u8 GetMonStatusAndPokerus(); -u8 *sub_80A1E9C(u8 *dest, const u8 *src, u8); u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon); bool8 CheckPartyPokerus(struct Pokemon *, u8); diff --git a/include/rom_8077ABC.h b/include/rom_8077ABC.h index 7cfdff2d4..5be158c54 100644 --- a/include/rom_8077ABC.h +++ b/include/rom_8077ABC.h @@ -41,9 +41,9 @@ bool8 IsDoubleBattle(void); void sub_8078914(); u8 sub_80789BC(); void InitSpriteDataForLinearTranslation(struct Sprite *sprite); -void InitAnimSpriteTranslationDeltas(struct Sprite *sprite); -bool8 TranslateAnimSpriteByDeltas(struct Sprite *sprite); -void TranslateAnimSpriteByDeltasUntil(struct Sprite *sprite); +void InitAnimLinearTranslation(struct Sprite *sprite); +bool8 TranslateAnimLinear(struct Sprite *sprite); +void TranslateAnimLinearUntil(struct Sprite *sprite); void sub_8078D44(struct Sprite *sprite); void obj_id_set_rotscale(u8 sprite, s16, s16, u16); bool8 sub_8078E38(); @@ -72,9 +72,9 @@ void sub_807A960(struct Sprite *sprite); void sub_8078A34(struct Sprite *sprite); void InitAnimSpritePos(struct Sprite *sprite, u8); void sub_8078764(struct Sprite *sprite, u8); -void StartTranslateAnimSpriteByDeltas(struct Sprite *sprite); +void StartAnimLinearTranslation(struct Sprite *sprite); void sub_8078D60(struct Sprite *sprite); -void InitAnimSpriteTranslationOverDuration(struct Sprite *sprite); +void InitAnimArcTranslation(struct Sprite *sprite); void WaitAnimForDuration(struct Sprite *sprite); void sub_8078CC0(struct Sprite *sprite); void sub_8078600(struct Sprite *sprite); @@ -104,7 +104,7 @@ void sub_80798F4(struct Task *task, u8 a2, const void *a3); bool8 sub_807992C(struct Task *task); u8 sub_8077FC0(u8 slot); void move_anim_8074EE0(struct Sprite *sprite); -bool8 TranslateAnimSpriteLinearAndSine(struct Sprite *sprite); +bool8 TranslateAnimArc(struct Sprite *sprite); bool8 sub_8078CE8(struct Sprite *sprite); void oamt_add_pos2_onto_pos1(struct Sprite *sprite); void sub_8078BD4(struct Sprite *sprite); diff --git a/include/strings.h b/include/strings.h index 0232b03f4..2ce8ac977 100644 --- a/include/strings.h +++ b/include/strings.h @@ -171,7 +171,8 @@ extern const u8 gOtherText_OneDash[]; extern const u8 gOtherText_TwoDashes[]; extern const u8 gOtherText_ThreeDashes2[]; extern const u8 gOtherText_MaleSymbol2[]; -extern const u8 gOtherText_FemaleSymbolAndLv[]; +extern const u8 gOtherText_FemaleSymbol2[]; +extern const u8 gOtherText_Lv[]; extern const u8 gOtherText_TallPlusAndRightArrow[]; extern const u8 gMenuText_GoBackToPrev[]; extern const u8 gOtherText_WhatWillYouDo[]; diff --git a/include/text.h b/include/text.h index ce63a2542..8b5df9280 100644 --- a/include/text.h +++ b/include/text.h @@ -2,6 +2,7 @@ #define GUARD_TEXT_H #define CHAR_SPACE 0x00 +#define CHAR_LV 0x34 #define CHAR_SONG_WORD_SEPARATOR 0x37 // separates words in the bard song. Not sure if it's used for anything else #define CHAR_0 0xA1 #define CHAR_QUESTION_MARK 0xAC @@ -74,6 +75,27 @@ #define CHAR_NEWLINE 0xFE #define EOS 0xFF // end of string +#define EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW 4 +#define TEXT_COLOR_TRANSPARENT 0x00 +#define TEXT_COLOR_DARK_GREY 0x01 +#define TEXT_COLOR_RED 0x02 +#define TEXT_COLOR_GREEN 0x03 +#define TEXT_COLOR_BLUE 0x04 +#define TEXT_COLOR_YELLOW 0x05 +#define TEXT_COLOR_CYAN 0x06 +#define TEXT_COLOR_MAGENTA 0x07 +#define TEXT_COLOR_LIGHT_GREY 0x08 +#define TEXT_COLOR_BLACK 0x09 +#define TEXT_COLOR_BLACK2 0x0A +#define TEXT_COLOR_SILVER 0x0B +#define TEXT_COLOR_WHITE 0x0C +#define TEXT_COLOR_SKY_BLUE 0x0D +#define TEXT_COLOR_LIGHT_BLUE 0x0E +#define TEXT_COLOR_WHITE2 0x0F + +#define EXT_CTRL_CODE_CLEAR 17 + + struct WindowTemplate { u8 bgNum; @@ -242,8 +264,8 @@ u8 *AlignInt2(struct Window *win, u8 *dest, s32 value, u8 alignAmount, u8 alignT u8 *AlignString(struct Window *win, u8 *dest, const u8 *src, u8 alignAmount, u8 alignType); u8 GetStringWidth(struct Window *win, const u8 *s); u8 Text_InitWindow8004D04(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u16 top, u32 a6); -u8 Text_InitWindow8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top); -u8 Text_InitWindow8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6); +u8 Text_InitWindow_RightAligned(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 right, u8 top); +u8 Text_InitWindow_Centered(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6); u8 Text_GetWindowPaletteNum(struct Window *win); void Text_GetTextColors(struct Window *win, u8 *foreground, u8 *background, u8 *shadow); void Text_InitWindow8004E3C(const struct WindowTemplate *winConfig, u8 *tileData, const u8 *text); diff --git a/include/util.h b/include/util.h index 02c503f75..1a3bd5f1a 100644 --- a/include/util.h +++ b/include/util.h @@ -3,6 +3,12 @@ #include "sprite.h" +//Extracts the upper 16 bits of a 32-bit number +#define HIHALF(n) (((n) & 0xFFFF0000) >> 16) + +//Extracts the lower 16 bits of a 32-bit number +#define LOHALF(n) ((n) & 0xFFFF) + extern const u8 gMiscBlank_Gfx[]; extern const u32 gBitTable[]; diff --git a/ld_script.txt b/ld_script.txt index 189184da1..cf238d12c 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -364,7 +364,7 @@ SECTIONS { src/player_pc.o(.text); src/intro.o(.text); src/field_region_map.o(.text); - asm/battle_anim_813F0F4.o(.text); + src/battle/battle_anim_813F0F4.o(.text); src/hall_of_fame.o(.text); src/credits.o(.text); src/lottery_corner.o(.text); diff --git a/src/battle/anim/aurora.c b/src/battle/anim/aurora.c index 5aff17f48..c17748440 100644 --- a/src/battle/anim/aurora.c +++ b/src/battle/anim/aurora.c @@ -68,7 +68,7 @@ void sub_80D33B4(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + r6; sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + gBattleAnimArgs[3]; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->callback = sub_80D344C; sprite->affineAnimPaused = TRUE; sprite->callback(sprite); @@ -81,7 +81,7 @@ static void sub_80D344C(struct Sprite *sprite) StartSpriteAnim(sprite, 1); sprite->affineAnimPaused = FALSE; } - if (TranslateAnimSpriteByDeltas(sprite) != 0) + if (TranslateAnimLinear(sprite) != 0) DestroyAnimSprite(sprite); } diff --git a/src/battle/anim/blow_kiss.c b/src/battle/anim/blow_kiss.c index 0235794c2..80056614f 100644 --- a/src/battle/anim/blow_kiss.c +++ b/src/battle/anim/blow_kiss.c @@ -33,13 +33,13 @@ void sub_80D1F58(struct Sprite* sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->callback = sub_80D1FA4; } static void sub_80D1FA4(struct Sprite* sprite) { - if (TranslateAnimSpriteByDeltas(sprite) == 0) + if (TranslateAnimLinear(sprite) == 0) { sprite->pos2.y += Sin(sprite->data[5], 14); sprite->data[5] = (sprite->data[5] + 4) & 0xFF; diff --git a/src/battle/anim/bubble.c b/src/battle/anim/bubble.c index e024091d7..ceefd82cf 100644 --- a/src/battle/anim/bubble.c +++ b/src/battle/anim/bubble.c @@ -80,7 +80,7 @@ void sub_80D31C8(struct Sprite* sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); newSpriteId = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); sprite->data[5] = newSpriteId; @@ -106,7 +106,7 @@ static void sub_80D32E8(struct Sprite *sprite) u16 index = gSprites[spriteId].data[3]; sprite->data[0] = 1; - TranslateAnimSpriteByDeltas(sprite); + TranslateAnimLinear(sprite); sprite->pos2.x += Sin(index / 256, gSprites[spriteId].data[0]); sprite->pos2.y += Cos(index / 256, gSprites[spriteId].data[1]); diff --git a/src/battle/anim/bug.c b/src/battle/anim/bug.c index c4c7fe937..e4ea01f5c 100644 --- a/src/battle/anim/bug.c +++ b/src/battle/anim/bug.c @@ -224,7 +224,7 @@ void sub_80DC824(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + gBattleAnimArgs[3]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -249,7 +249,7 @@ void sub_80DC8F4(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -282,7 +282,7 @@ void sub_80DC9A0(struct Sprite *sprite) static void sub_80DCA38(struct Sprite *sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) { DestroyAnimSprite(sprite); return; @@ -414,7 +414,7 @@ void AnimTranslateStinger(struct Sprite *sprite) sprite->data[2] = lVarX; sprite->data[4] = lVarY; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -438,7 +438,7 @@ void AnimMissileArc(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + gBattleAnimArgs[3]; sprite->data[5] = gBattleAnimArgs[5]; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = AnimMissileArcStep; sprite->invisible = TRUE; @@ -448,7 +448,7 @@ static void AnimMissileArcStep(struct Sprite *sprite) { sprite->invisible = FALSE; - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { DestroyAnimSprite(sprite); } @@ -468,7 +468,7 @@ static void AnimMissileArcStep(struct Sprite *sprite) x2 += x1; y2 += y1; - if (!TranslateAnimSpriteLinearAndSine(sprite)) + if (!TranslateAnimArc(sprite)) { u16 rotation = ArcTan2Neg(sprite->pos1.x + sprite->pos2.x - x2, sprite->pos1.y + sprite->pos2.y - y2); diff --git a/src/battle/anim/bullet.c b/src/battle/anim/bullet.c index 764903247..60c001853 100644 --- a/src/battle/anim/bullet.c +++ b/src/battle/anim/bullet.c @@ -44,7 +44,7 @@ void sub_80CFFD8(struct Sprite* sprite) sprite->data[0] = 20; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; sprite->affineAnimPaused = 1; StoreSpriteCallbackInData(sprite, sub_80D0030); } diff --git a/src/battle/anim/current.c b/src/battle/anim/current.c index af72edef0..fb7bc4e1c 100644 --- a/src/battle/anim/current.c +++ b/src/battle/anim/current.c @@ -366,7 +366,7 @@ void sub_80D648C(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = gBattleAnimArgs[2]; sprite->data[6] = gBattleAnimArgs[5]; sprite->data[7] = gBattleAnimArgs[4]; @@ -378,7 +378,7 @@ void sub_80D648C(struct Sprite *sprite) static void sub_80D6514(struct Sprite *sprite) { - if (!TranslateAnimSpriteByDeltas(sprite)) + if (!TranslateAnimLinear(sprite)) { sprite->pos2.x += Sin(sprite->data[7], sprite->data[5]); sprite->pos2.y += Cos(sprite->data[7], sprite->data[5]); @@ -857,7 +857,7 @@ static void sub_80D6BB8(u8 taskId) sprite->data[4] = task->data[15]; sprite->data[5] = taskId; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData(sprite, sub_80D6D00); sprite->callback = sub_8078600; @@ -887,7 +887,7 @@ static void sub_80D6BB8(u8 taskId) static void sub_80D6CCC(struct Sprite *sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) { gTasks[sprite->data[5]].data[7]--; DestroySprite(sprite); diff --git a/src/battle/anim/dark.c b/src/battle/anim/dark.c index 59db85342..09e16b8fe 100644 --- a/src/battle/anim/dark.c +++ b/src/battle/anim/dark.c @@ -402,13 +402,13 @@ void sub_80DFFD0(struct Sprite *sprite) sprite->data[4] = sprite->pos1.y + 12; sprite->data[5] = -12; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = sub_80E00D0; } static void sub_80E00D0(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) move_anim_8074EE0(sprite); } diff --git a/src/battle/anim/dragon.c b/src/battle/anim/dragon.c index 163529ecb..0b5b1b88b 100644 --- a/src/battle/anim/dragon.c +++ b/src/battle/anim/dragon.c @@ -242,7 +242,7 @@ void sub_80DF63C(struct Sprite *sprite) StartSpriteAnim(sprite, 1); } sprite->data[0] = gBattleAnimArgs[4]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, move_anim_8074EE0); } diff --git a/src/battle/anim/energy_wave.c b/src/battle/anim/energy_wave.c index 9ac362b57..cbca5338c 100644 --- a/src/battle/anim/energy_wave.c +++ b/src/battle/anim/energy_wave.c @@ -170,7 +170,7 @@ void sub_80D3554(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = 0xD200 / sprite->data[0]; sprite->data[7] = gBattleAnimArgs[3]; @@ -191,7 +191,7 @@ void sub_80D3554(struct Sprite *sprite) static void sub_80D35DC(struct Sprite *sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) { DestroyAnimSprite(sprite); } @@ -299,6 +299,6 @@ void sub_80D3728(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, var2) + gBattleAnimArgs[3]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/battle/anim/fight.c b/src/battle/anim/fight.c index af2af1981..1a534aec7 100644 --- a/src/battle/anim/fight.c +++ b/src/battle/anim/fight.c @@ -567,7 +567,7 @@ void sub_80D92D0(struct Sprite *sprite) } sprite->data[4] = sprite->pos1.y - 20; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, sub_80D9328); } @@ -583,7 +583,7 @@ static void sub_80D9328(struct Sprite *sprite) sprite->pos2.y = 0; sprite->pos2.x = 0; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } } @@ -604,7 +604,7 @@ void sub_80D9378(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = sprite->pos1.y; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = gBattleAnimArgs[5]; sprite->data[6] = gBattleAnimArgs[4]; @@ -615,7 +615,7 @@ void sub_80D9378(struct Sprite *sprite) static void sub_80D9404(struct Sprite *sprite) { - if (!TranslateAnimSpriteByDeltas(sprite)) + if (!TranslateAnimLinear(sprite)) { sprite->pos2.y += Sin(sprite->data[7] >> 8, sprite->data[5]); sprite->data[7] += sprite->data[6]; @@ -672,7 +672,7 @@ static void AnimStompFootStep(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, AnimStompFootEnd); } } @@ -846,9 +846,9 @@ static void sub_80D986C(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(sprite->data[7], 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData(sprite, move_anim_8074EE0); - sprite->callback = TranslateAnimSpriteByDeltasUntil; + sprite->callback = TranslateAnimLinearUntil; } } @@ -941,9 +941,9 @@ void sub_80D9A38(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(bank, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData(sprite, DestroyAnimSprite); - sprite->callback = TranslateAnimSpriteByDeltasUntil; + sprite->callback = TranslateAnimLinearUntil; } static void sub_80D9B24(struct Sprite *sprite) diff --git a/src/battle/anim/fire_2.c b/src/battle/anim/fire_2.c index b055d7c80..68e13e1c1 100644 --- a/src/battle/anim/fire_2.c +++ b/src/battle/anim/fire_2.c @@ -241,7 +241,7 @@ static void AnimFireRingStep1(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->callback = AnimFireRingStep2; } @@ -249,7 +249,7 @@ static void AnimFireRingStep1(struct Sprite *sprite) static void AnimFireRingStep2(struct Sprite *sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) { sprite->data[0] = 0; diff --git a/src/battle/anim/flying.c b/src/battle/anim/flying.c index e8c50816c..35022db1f 100644 --- a/src/battle/anim/flying.c +++ b/src/battle/anim/flying.c @@ -496,14 +496,14 @@ void sub_80DA16C(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + gBattleAnimArgs[2]; sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + gBattleAnimArgs[3]; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->callback = sub_80785E4; StoreSpriteCallbackInData(sprite, sub_80DA1EC); } void sub_80DA1EC(struct Sprite *sprite) { - if (TranslateAnimSpriteByDeltas(sprite) != 0) + if (TranslateAnimLinear(sprite) != 0) { DestroyAnimSprite(sprite); } @@ -543,7 +543,7 @@ void sub_80DA208(struct Sprite *sprite) sprite->data[2] = sprite->data[2] + gBattleAnimArgs[2]; sprite->data[4] = sprite->data[4] + gBattleAnimArgs[3]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); SeekSpriteAnim(sprite, gBattleAnimArgs[5]); @@ -596,14 +596,14 @@ void sub_80DA38C(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->callback = sub_80DA410; } void sub_80DA410(struct Sprite *sprite) { sprite->data[0] = 1; - TranslateAnimSpriteByDeltas(sprite); + TranslateAnimLinear(sprite); if (((u16)sprite->data[3] >> 8) > 200) { diff --git a/src/battle/anim/flying_path.c b/src/battle/anim/flying_path.c index b190e9e8c..d2f85ad35 100644 --- a/src/battle/anim/flying_path.c +++ b/src/battle/anim/flying_path.c @@ -102,7 +102,7 @@ void sub_80CBDF4(u8 taskId) gSprites[task->data[2]].data[3] = task->data[9]; gSprites[task->data[2]].data[4] = task->data[7] + (task->data[11] / 2 + 10) * task->data[5]; gSprites[task->data[2]].data[5] = sub_80CC338(&gSprites[task->data[2]]); - InitAnimSpriteTranslationOverDuration(&gSprites[task->data[2]]); + InitAnimArcTranslation(&gSprites[task->data[2]]); task->func = sub_80CBF5C; } @@ -115,7 +115,7 @@ static void sub_80CBF5C(u8 taskId) { case 4: sub_80CC358(task, taskId); - if (TranslateAnimSpriteLinearAndSine(sprite) == 0) + if (TranslateAnimArc(sprite) == 0) { break; } @@ -127,7 +127,7 @@ static void sub_80CBF5C(u8 taskId) break; case 8: sub_80CC358(task, taskId); - if (TranslateAnimSpriteLinearAndSine(sprite) == 0) + if (TranslateAnimArc(sprite) == 0) { break; } @@ -139,7 +139,7 @@ static void sub_80CBF5C(u8 taskId) break; case 0: sub_80CC358(task, taskId); - if (TranslateAnimSpriteLinearAndSine(sprite) == 0) + if (TranslateAnimArc(sprite) == 0) break; task->data[15] = 1; @@ -160,12 +160,12 @@ static void sub_80CBF5C(u8 taskId) task->data[3] = a; sprite->subpriority = task->data[4]; StartSpriteAnim(sprite, task->data[3]); - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); task->data[0]++; break; case 2: sub_80CC358(task, taskId); - if (TranslateAnimSpriteLinearAndSine(sprite) == 0) + if (TranslateAnimArc(sprite) == 0) break; task->data[15] = 3; @@ -185,7 +185,7 @@ static void sub_80CBF5C(u8 taskId) task->data[3] = 2; sprite->subpriority = task->data[4]; StartSpriteAnim(sprite, task->data[3]); - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); task->data[0]++; break; case 5: @@ -203,12 +203,12 @@ static void sub_80CBF5C(u8 taskId) task->data[3] = 3; sprite->subpriority = task->data[4]; StartSpriteAnim(sprite, task->data[3]); - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); task->data[0]++; break; case 6: sub_80CC358(task, taskId); - if (TranslateAnimSpriteLinearAndSine(sprite) == 0) + if (TranslateAnimArc(sprite) == 0) break; task->data[15] = 7; @@ -229,7 +229,7 @@ static void sub_80CBF5C(u8 taskId) task->data[3] = 4; sprite->subpriority = task->data[4]; StartSpriteAnim(sprite, task->data[3]); - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); task->data[0]++; break; case 9: @@ -246,12 +246,12 @@ static void sub_80CBF5C(u8 taskId) task->data[3] = 5; sprite->subpriority = task->data[4]; StartSpriteAnim(sprite, task->data[3]); - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); task->data[0]++; break; case 10: sub_80CC358(task, taskId); - if (TranslateAnimSpriteLinearAndSine(sprite) == 0) + if (TranslateAnimArc(sprite) == 0) { break; } @@ -277,13 +277,13 @@ static void sub_80CBF5C(u8 taskId) task->data[3] = 6; sprite->subpriority = task->data[4]; StartSpriteAnim(sprite, task->data[3]); - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); task->data[0]++; break; } case 12: sub_80CC358(task, taskId); - if (TranslateAnimSpriteLinearAndSine(sprite) != 0) + if (TranslateAnimArc(sprite) != 0) { DestroySprite(sprite); task->data[0]++; diff --git a/src/battle/anim/ghost.c b/src/battle/anim/ghost.c index 52d9c7e72..c11cea5a0 100644 --- a/src/battle/anim/ghost.c +++ b/src/battle/anim/ghost.c @@ -242,7 +242,7 @@ static void sub_80DDBD8(struct Sprite *sprite) s16 r0; s16 r2; sub_80DDCC8(sprite); - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) { sprite->callback = sub_80DDC4C; return; @@ -265,7 +265,7 @@ static void sub_80DDC4C(struct Sprite *sprite) s16 r2; s16 r0; sprite->data[0] = 1; - TranslateAnimSpriteByDeltas(sprite); + TranslateAnimLinear(sprite); sprite->pos2.x += Sin(sprite->data[5], 10); sprite->pos2.y += Cos(sprite->data[5], 15); diff --git a/src/battle/anim/grip.c b/src/battle/anim/grip.c index 1ec779c09..b5c191449 100644 --- a/src/battle/anim/grip.c +++ b/src/battle/anim/grip.c @@ -67,7 +67,7 @@ void sub_80D0178(struct Sprite* sprite) sprite->data[0] = 6; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + r8; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + r6; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, sub_80D020C); } diff --git a/src/battle/anim/ground.c b/src/battle/anim/ground.c index 67b4c9c9c..cf73ead2f 100644 --- a/src/battle/anim/ground.c +++ b/src/battle/anim/ground.c @@ -160,13 +160,13 @@ static void AnimBonemerangProjectile(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); sprite->data[5] = -40; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = AnimBonemerangProjectileStep; } static void AnimBonemerangProjectileStep(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { sprite->pos1.x += sprite->pos2.x; sprite->pos1.y += sprite->pos2.y; @@ -176,14 +176,14 @@ static void AnimBonemerangProjectileStep(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankAttacker, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 3); sprite->data[5] = 40; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = AnimBonemerangProjectileEnd; } } static void AnimBonemerangProjectileEnd(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) DestroyAnimSprite(sprite); } @@ -203,7 +203,7 @@ static void AnimBoneHitProjectile(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + gBattleAnimArgs[3]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -233,7 +233,7 @@ static void AnimDirtScatter(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[2]; sprite->data[2] = targetXPos + xOffset; sprite->data[4] = targetYPos + yOffset; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, move_anim_8074EE0); } @@ -537,13 +537,13 @@ static void AnimFissureDirtPlumeParticle(struct Sprite *sprite) sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2]; sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[3]; sprite->data[5] = gBattleAnimArgs[4]; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = AnimFissureDirtPlumeParticleStep; } static void AnimFissureDirtPlumeParticleStep(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) DestroyAnimSprite(sprite); } diff --git a/src/battle/anim/guard.c b/src/battle/anim/guard.c index 341f74372..b1f194ef5 100644 --- a/src/battle/anim/guard.c +++ b/src/battle/anim/guard.c @@ -61,6 +61,6 @@ void sub_80D3014(struct Sprite *sprite) sprite->data[2] = sprite->pos1.x; sprite->data[4] = sprite->pos1.y - 72; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/battle/anim/guillotine.c b/src/battle/anim/guillotine.c index eb1bc7733..bc0fce4dd 100644 --- a/src/battle/anim/guillotine.c +++ b/src/battle/anim/guillotine.c @@ -71,7 +71,7 @@ void sub_80D0228(struct Sprite* sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + r9; sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + r6; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = gBattleAnimArgs[0]; sprite->data[6] = sprite->data[0]; sprite->callback = sub_80D02D0; @@ -79,7 +79,7 @@ void sub_80D0228(struct Sprite* sprite) static void sub_80D02D0(struct Sprite* sprite) { - if (TranslateAnimSpriteByDeltas(sprite) && sprite->animEnded == 1) + if (TranslateAnimLinear(sprite) && sprite->animEnded == 1) { SeekSpriteAnim(sprite, 0); sprite->animPaused = 1; @@ -119,6 +119,6 @@ static void sub_80D0344(struct Sprite* sprite) static void sub_80D03A8(struct Sprite* sprite) { - if (TranslateAnimSpriteByDeltas(sprite) != 0) + if (TranslateAnimLinear(sprite) != 0) DestroyAnimSprite(sprite); } diff --git a/src/battle/anim/heal_bell.c b/src/battle/anim/heal_bell.c index 09029c9ff..c9f26b093 100644 --- a/src/battle/anim/heal_bell.c +++ b/src/battle/anim/heal_bell.c @@ -126,7 +126,7 @@ void sub_80D1C08(struct Sprite* sprite) sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankAttacker, 0) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 1) + gBattleAnimArgs[3]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); sub_80D1BA8(sprite, gBattleAnimArgs[5], gBattleAnimArgs[6]); } diff --git a/src/battle/anim/leaf.c b/src/battle/anim/leaf.c index d31e4dbd6..2d36d7360 100644 --- a/src/battle/anim/leaf.c +++ b/src/battle/anim/leaf.c @@ -207,7 +207,7 @@ void AnimTranslateLinearSingleSineWave(struct Sprite* sprite) } sprite->data[5] = gBattleAnimArgs[5]; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); if (GetBattlerSide(gAnimBankAttacker) == GetBattlerSide(gAnimBankTarget)) { sprite->data[0] = 1; @@ -228,7 +228,7 @@ static void AnimTranslateLinearSingleSineWaveStep(struct Sprite* sprite) s16 r0; sprite->data[0] = 1; - TranslateAnimSpriteLinearAndSine(sprite); + TranslateAnimArc(sprite); r0 = sprite->data[7]; sprite->data[0] = a; if (b > 0xC8 && r0 <= 0x37 && sprite->oam.affineParam == 0) diff --git a/src/battle/anim/musical.c b/src/battle/anim/musical.c index 17836ace7..b67cd17b8 100644 --- a/src/battle/anim/musical.c +++ b/src/battle/anim/musical.c @@ -368,14 +368,14 @@ void sub_80CEE60(struct Sprite* sprite) sprite->data[2] = a + sprite->data[1]; sprite->data[3] = sprite->pos1.y; sprite->data[4] = sprite->data[3] - 40; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = gBattleAnimArgs[3]; sprite->callback = sub_80CEEE8; } static void sub_80CEEE8(struct Sprite* sprite) { - if (TranslateAnimSpriteByDeltas(sprite) == 0) + if (TranslateAnimLinear(sprite) == 0) { s16 a; a = Sin(sprite->data[5], 8); diff --git a/src/battle/anim/orbit.c b/src/battle/anim/orbit.c index e76e0923e..f938a2707 100644 --- a/src/battle/anim/orbit.c +++ b/src/battle/anim/orbit.c @@ -158,7 +158,7 @@ void sub_80CAD54(struct Sprite* sprite) sprite->data[2] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 3) + gBattleAnimArgs[2]; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = 0x40; sprite->callback = sub_80CADA8; sub_80CADA8(sprite); @@ -166,7 +166,7 @@ void sub_80CAD54(struct Sprite* sprite) static void sub_80CADA8(struct Sprite* sprite) { - if (!TranslateAnimSpriteByDeltas(sprite)) + if (!TranslateAnimLinear(sprite)) { sprite->pos2.x += Sin(sprite->data[5], 32); sprite->pos2.y += Cos(sprite->data[5], -5); @@ -195,7 +195,7 @@ void sub_80CAE20(struct Sprite* sprite) sprite->data[2] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 3) + gBattleAnimArgs[2]; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = 0x40; sprite->callback = sub_80CAE74; sub_80CAE74(sprite); @@ -203,7 +203,7 @@ void sub_80CAE20(struct Sprite* sprite) static void sub_80CAE74(struct Sprite* sprite) { - if (!TranslateAnimSpriteByDeltas(sprite)) + if (!TranslateAnimLinear(sprite)) { sprite->pos2.x += Sin(sprite->data[5], 8); if ((u16)(sprite->data[5] - 0x3B) < 5 || (u16)(sprite->data[5] - 0xBB) < 5) diff --git a/src/battle/anim/orbs.c b/src/battle/anim/orbs.c index af6568bd8..b97f0c246 100644 --- a/src/battle/anim/orbs.c +++ b/src/battle/anim/orbs.c @@ -196,7 +196,7 @@ void sub_80CA7B0(struct Sprite* sprite) sprite->data[0] = gBattleAnimArgs[2]; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankAttacker, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 3); - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, move_anim_8074EE0); } @@ -207,7 +207,7 @@ void sub_80CA800(struct Sprite* sprite) sprite->data[0] = gBattleAnimArgs[2]; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -219,7 +219,7 @@ void sub_80CA858(struct Sprite* sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[5] = gBattleAnimArgs[3]; sprite->callback = sub_80CA8B4; sub_80CA8B4(sprite); @@ -227,7 +227,7 @@ void sub_80CA858(struct Sprite* sprite) static void sub_80CA8B4(struct Sprite* sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) { DestroySprite(sprite); } @@ -272,13 +272,13 @@ void sub_80CA9A8(struct Sprite* sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankAttacker, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 3); sprite->data[5] = gBattleAnimArgs[2]; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = sub_80CA9F8; } static void sub_80CA9F8(struct Sprite* sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) DestroyAnimSprite(sprite); } diff --git a/src/battle/anim/poison.c b/src/battle/anim/poison.c index 4d6673adf..99f534e1c 100644 --- a/src/battle/anim/poison.c +++ b/src/battle/anim/poison.c @@ -204,14 +204,14 @@ void sub_80D9D70(struct Sprite *sprite) sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); sprite->data[5] = -30; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = sub_80D9DD4; } static void sub_80D9DD4(struct Sprite *sprite) // same as sub_80D9E78 { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) DestroyAnimSprite(sprite); } @@ -232,14 +232,14 @@ void sub_80D9DF0(struct Sprite *sprite) sprite->data[4] = l2 + gBattleAnimArgs[5]; sprite->data[5] = -30; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = sub_80D9E78; } static void sub_80D9E78(struct Sprite *sprite) // same as sub_80D9DD4 { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) DestroyAnimSprite(sprite); } @@ -284,7 +284,7 @@ void sub_80D9F14(struct Sprite *sprite) sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2]; sprite->data[4] = sprite->pos1.y + sprite->data[0]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/battle/anim/psychic.c b/src/battle/anim/psychic.c index a63652646..704fa0306 100644 --- a/src/battle/anim/psychic.c +++ b/src/battle/anim/psychic.c @@ -912,7 +912,7 @@ static void sub_80DC1FC(u8 taskId) gSprites[spriteId].data[4] = task->data[14]; gSprites[spriteId].data[5] = task->data[10]; - InitAnimSpriteTranslationOverDuration(&gSprites[spriteId]); + InitAnimArcTranslation(&gSprites[spriteId]); StartSpriteAffineAnim(&gSprites[spriteId], task->data[2] & 3); } @@ -929,7 +929,7 @@ static void sub_80DC1FC(u8 taskId) void sub_80DC2B0(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { FreeOamMatrix(sprite->oam.matrixNum); DestroySprite(sprite); diff --git a/src/battle/anim/ring.c b/src/battle/anim/ring.c index 024728ecc..a2cf618a6 100644 --- a/src/battle/anim/ring.c +++ b/src/battle/anim/ring.c @@ -240,7 +240,7 @@ void sub_80D0FD8(struct Sprite* sprite) void sub_80D1098(struct Sprite* sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) { FreeSpriteOamMatrix(sprite); DestroyAnimSprite(sprite); @@ -327,7 +327,7 @@ void sub_80D10B8(struct Sprite* sprite) sprite->data[2] = sp0; sprite->data[4] = sp1; sprite->data[0] = gBattleAnimArgs[0]; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->callback = sub_80D1098; sub_80D1098(sprite); } diff --git a/src/battle/anim/rock.c b/src/battle/anim/rock.c index 4e839d3e8..7738e4d0c 100644 --- a/src/battle/anim/rock.c +++ b/src/battle/anim/rock.c @@ -564,7 +564,7 @@ void sub_80DD490(struct Sprite *sprite) sprite->data[2] = sprite->pos1.x; sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[2]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -729,7 +729,7 @@ static void sub_80DD774(struct Task *task) gSprites[spriteId].data[5] = -16 - (task->data[1] * 2); gSprites[spriteId].oam.tileNum += var0; - InitAnimSpriteTranslationOverDuration(&gSprites[spriteId]); + InitAnimArcTranslation(&gSprites[spriteId]); task->data[11]++; } @@ -738,7 +738,7 @@ static void sub_80DD774(struct Task *task) void sub_80DD87C(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { u8 taskId = FindTaskIdByFunc(sub_80DD604); if (taskId != 0xFF) diff --git a/src/battle/anim/scan.c b/src/battle/anim/scan.c index 9f427a9c4..409acf549 100644 --- a/src/battle/anim/scan.c +++ b/src/battle/anim/scan.c @@ -77,7 +77,7 @@ static void sub_80CD408(struct Sprite* sprite) sprite->data[0] = 8; sprite->data[2] = sprite->pos1.x + gUnknown_083D6DDC[sprite->data[5] >> 8][0]; sprite->data[4] = sprite->pos1.y + gUnknown_083D6DDC[sprite->data[5] >> 8][1]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, sub_80CD4B8); sprite->data[5] += 0x100; PlaySE12WithPanning(0xD2, BattleAnimAdjustPanning(0x3F)); @@ -142,7 +142,7 @@ static void sub_80CD4EC(struct Sprite* sprite) sprite->data[0] = 6; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + a; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + b; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, sub_80CD654); } } diff --git a/src/battle/anim/seed.c b/src/battle/anim/seed.c index 11eebada0..bf8142a49 100644 --- a/src/battle/anim/seed.c +++ b/src/battle/anim/seed.c @@ -61,13 +61,13 @@ void AnimLeechSeed(struct Sprite* sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 0) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 1) + gBattleAnimArgs[3]; sprite->data[5] = gBattleAnimArgs[5]; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = AnimLeechSeedStep; } static void AnimLeechSeedStep(struct Sprite* sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { sprite->invisible = 1; sprite->data[0] = 10; diff --git a/src/battle/anim/sonic.c b/src/battle/anim/sonic.c index 0494c42ed..4a9ade286 100644 --- a/src/battle/anim/sonic.c +++ b/src/battle/anim/sonic.c @@ -148,7 +148,7 @@ void AnimSonicBoomProjectile(struct Sprite* sprite) sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = targetXPos; sprite->data[4] = targetYPos; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/battle/anim/sunlight.c b/src/battle/anim/sunlight.c index 7efc85b37..5edb9afea 100644 --- a/src/battle/anim/sunlight.c +++ b/src/battle/anim/sunlight.c @@ -37,6 +37,6 @@ void sub_80D517C(struct Sprite *sprite) sprite->data[0] = 60; sprite->data[2] = 140; sprite->data[4] = 80; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/battle/anim/sword.c b/src/battle/anim/sword.c index 7fb410224..fcb85a794 100644 --- a/src/battle/anim/sword.c +++ b/src/battle/anim/sword.c @@ -50,6 +50,6 @@ static void sub_80CF6B4(struct Sprite* sprite) sprite->data[0] = 6; sprite->data[2] = sprite->pos1.x; sprite->data[4] = sprite->pos1.y - 32; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/battle/anim/tile.c b/src/battle/anim/tile.c index a10850808..12cfd53b3 100644 --- a/src/battle/anim/tile.c +++ b/src/battle/anim/tile.c @@ -175,7 +175,7 @@ static void sub_80CE1AC(struct Sprite* sprite) sprite->data[0] = 30; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankAttacker, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 3); - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } } diff --git a/src/battle/anim/unused_8.c b/src/battle/anim/unused_8.c index a005bee1c..92f5973db 100644 --- a/src/battle/anim/unused_8.c +++ b/src/battle/anim/unused_8.c @@ -78,7 +78,7 @@ static void sub_80CF490(struct Sprite* sprite) sprite->data[0] = sprite->data[1]; sprite->data[2] = sprite->pos1.x; sprite->data[4] = sprite->pos1.y + 15; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, sub_80CF4B8); } diff --git a/src/battle/anim/water.c b/src/battle/anim/water.c index 0afe133f0..1c354d916 100644 --- a/src/battle/anim/water.c +++ b/src/battle/anim/water.c @@ -198,7 +198,7 @@ void sub_80D37FC(struct Sprite *sprite) sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2]; sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[4]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/battle/anim/wisp_orb.c b/src/battle/anim/wisp_orb.c index 32373ca2a..f9e21d704 100644 --- a/src/battle/anim/wisp_orb.c +++ b/src/battle/anim/wisp_orb.c @@ -133,7 +133,7 @@ static void sub_80D5C5C(struct Sprite *sprite) s16 initialData5; s16 newData5; - if (!TranslateAnimSpriteByDeltas(sprite)) + if (!TranslateAnimLinear(sprite)) { sprite->pos2.x += Sin(sprite->data[5], 16); initialData5 = sprite->data[5]; diff --git a/src/battle/battle_7.c b/src/battle/battle_7.c index 75afc2739..87a0f0309 100644 --- a/src/battle/battle_7.c +++ b/src/battle/battle_7.c @@ -1,6 +1,7 @@ #include "global.h" #include "battle.h" #include "battle_anim.h" +#include "battle_anim_813F0F4.h" #include "battle_interface.h" #include "blend_palette.h" #include "contest.h" @@ -95,7 +96,6 @@ const struct SpritePalette gUnknown_0820A4D4[] = extern void c3_0802FDF4(u8); extern void sub_80440EC(); extern void sub_804777C(); -extern void sub_8141828(); extern u8 GetBattlerSpriteCoord(); extern u8 IsBankSpritePresent(u8); extern u8 sub_8077F68(u8); diff --git a/src/battle/battle_anim_812C144.c b/src/battle/battle_anim_812C144.c index bcdd2b693..0e9c45023 100644 --- a/src/battle/battle_anim_812C144.c +++ b/src/battle/battle_anim_812C144.c @@ -169,7 +169,7 @@ void sub_812C2BC(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[2]; sprite->data[2] = x; sprite->data[4] = y; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -349,13 +349,13 @@ void sub_812C720(struct Sprite *sprite) sprite->data[4] = y + gBattleAnimArgs[3]; sprite->data[5] = -50; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = sub_812C798; } static void sub_812C798(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { sprite->data[0] = 30; sprite->data[1] = 0; @@ -950,7 +950,7 @@ void sub_812D294(struct Sprite *sprite) sprite->data[0] = 20; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3); - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; } } diff --git a/src/battle/battle_anim_813F0F4.c b/src/battle/battle_anim_813F0F4.c new file mode 100755 index 000000000..219395baf --- /dev/null +++ b/src/battle/battle_anim_813F0F4.c @@ -0,0 +1,1897 @@ +#include "global.h" +#include "battle.h" +#include "battle_anim.h" +#include "battle_anim_813F0F4.h" +#include "battle_interface.h" +#include "blend_palette.h" +#include "decompress.h" +#include "ewram.h" +#include "m4a.h" +#include "main.h" +#include "palette.h" +#include "pokeball.h" +#include "rom_8077ABC.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "util.h" +#include "constants/items.h" +#include "constants/songs.h" + +extern int gUnknown_03005F0C; +extern u16 gUnknown_03005F10; +extern u16 gUnknown_03005F14; + +extern s16 gBattleAnimArgs[]; +extern u8 gAnimBankAttacker; +extern u8 gAnimBankTarget; +extern u8 gHealthboxIDs[]; +extern u8 gBankSpriteIds[]; +extern u16 gBattlerPartyIndexes[]; +extern u16 gLastUsedItem; +extern u8 gDoingBattleAnim; +extern u8 gEffectBank; + +extern const u8 gUnknown_08D2EE48[]; +extern const u8 gUnknown_08D2EDFC[]; +extern const u16 gUnknown_08D2E150[]; +extern const struct CompressedSpritePalette gUnknown_0840B2B8[]; +extern const struct SpriteTemplate gSpriteTemplate_840B3B4[]; +extern const struct SpriteTemplate gSpriteTemplate_8402500; +extern const struct SpriteTemplate gBattleAnimSpriteTemplate_84024E8; +extern const u8 gUnknown_0840B378[]; +extern const struct CompressedSpriteSheet gUnknown_0840B258[]; +extern const TaskFunc gUnknown_0840B384[]; +extern const u16 gUnknown_0840B4D4[]; +extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; +extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; + +static void sub_813F300(u8 taskId); +static void sub_813F6CC(u8 taskId); +static void sub_813FD34(u8 taskId); +static void sub_813FD90(struct Sprite *sprite); +static void sub_813FB7C(u8 taskId); +static void sub_813FCBC(u8 taskId); +static void sub_813FDC0(struct Sprite *sprite); +static void sub_813FE70(struct Sprite *sprite); +static void sub_81407B8(struct Sprite *sprite); +static void sub_813FEC8(struct Sprite *sprite); +static void sub_8140014(struct Sprite *sprite); +static void sub_8140058(struct Sprite *sprite); +static void sub_8140410(struct Sprite *sprite); +static void sub_8140158(struct Sprite *sprite); +static void sub_81401A0(struct Sprite *sprite); +static void sub_8140434(struct Sprite *sprite); +static void sub_81405F4(struct Sprite *sprite); +static void sub_8140454(struct Sprite *sprite); +static void sub_81404E4(struct Sprite *sprite); +static void sub_81405C8(struct Sprite *sprite); +static void sub_81406BC(struct Sprite *sprite); +static void sub_81407F4(struct Sprite *sprite); +static void sub_8140A08(struct Sprite *sprite); +static void sub_8140A28(struct Sprite *sprite); +static void sub_8141294(struct Sprite *sprite); +static void sub_8140ECC(struct Sprite *sprite); +static void sub_8140FF8(struct Sprite *sprite); +static void sub_8141230(struct Sprite *sprite); +static void sub_81413DC(u8 taskId); +static void sub_814146C(u8 taskId); +static void sub_81414BC(u8 taskId); +static void sub_814191C(u8 taskId); +static void sub_8141B20(struct Sprite *sprite); +static void sub_8141B74(struct Sprite *sprite); +static void sub_8141AD8(u8 taskId); +static void sub_8141CBC(struct Sprite *sprite); +static void sub_8141CF4(struct Sprite *sprite); +static void sub_8141D20(struct Sprite *sprite); + + +void unref_sub_813F0F4(u8 taskId) +{ + struct Struct_sub_8078914 subStruct; + u8 healthBoxSpriteId; + u8 battler; + u8 spriteId1, spriteId2, spriteId3, spriteId4; + + battler = gAnimBankAttacker; + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; + REG_WININ = 0x3F3F; + REG_WINOUT = 0x3F3D; + REG_DISPCNT |= DISPCNT_OBJWIN_ON; + REG_BLDCNT = 0x3F42; + REG_BLDALPHA = 0x1000; + REG_BG1CNT_BITFIELD.priority = 0; + REG_BG1CNT_BITFIELD.screenSize = 0; + REG_BG1CNT_BITFIELD.areaOverflowMode = 1; + REG_BG1CNT_BITFIELD.charBaseBlock = 1; + + healthBoxSpriteId = gHealthboxIDs[battler]; + spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; + spriteId2 = gSprites[healthBoxSpriteId].data[5]; + spriteId3 = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); + spriteId4 = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); + gSprites[healthBoxSpriteId].oam.priority = 1; + gSprites[spriteId1].oam.priority = 1; + gSprites[spriteId2].oam.priority = 1; + gSprites[spriteId3] = gSprites[healthBoxSpriteId]; + gSprites[spriteId4] = gSprites[spriteId1]; + gSprites[spriteId3].oam.objMode = ST_OAM_OBJ_WINDOW; + gSprites[spriteId4].oam.objMode = ST_OAM_OBJ_WINDOW; + gSprites[spriteId3].callback = SpriteCallbackDummy; + gSprites[spriteId4].callback = SpriteCallbackDummy; + + sub_8078914(&subStruct); + DmaFill32Defvars(3, 0, subStruct.field_4, 0x1000); + LZDecompressVram(&gUnknown_08D2EE48, subStruct.field_4); + LZDecompressVram(&gUnknown_08D2EDFC, subStruct.field_0); + LoadCompressedPalette(gUnknown_08D2E150, subStruct.field_8 << 4, 32); + + gBattle_BG1_X = -gSprites[spriteId3].pos1.x + 32; + gBattle_BG1_Y = -gSprites[spriteId3].pos1.y - 32; + gTasks[taskId].data[1] = 640; + gTasks[taskId].data[0] = spriteId3; + gTasks[taskId].data[2] = spriteId4; + gTasks[taskId].func = sub_813F300; +} + +static void sub_813F300(u8 taskId) +{ + struct Struct_sub_8078914 subStruct; + u8 spriteId1, spriteId2; + u8 battler; + + battler = gAnimBankAttacker; + gTasks[taskId].data[13] += gTasks[taskId].data[1]; + gBattle_BG1_Y += (u16)gTasks[taskId].data[13] >> 8; + gTasks[taskId].data[13] &= 0xFF; + + switch (gTasks[taskId].data[15]) + { + case 0: + if (gTasks[taskId].data[11]++ > 1) + { + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[12]++; + REG_BLDALPHA = ((16 - gTasks[taskId].data[12]) << 8) | gTasks[taskId].data[12]; + if (gTasks[taskId].data[12] == 8) + gTasks[taskId].data[15]++; + } + break; + case 1: + if (++gTasks[taskId].data[10] == 30) + gTasks[taskId].data[15]++; + break; + case 2: + if (gTasks[taskId].data[11]++ > 1) + { + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[12]--; + REG_BLDALPHA = ((16 - gTasks[taskId].data[12]) << 8) | gTasks[taskId].data[12]; + if (gTasks[taskId].data[12] == 0) + { + sub_8076464(0); + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; + REG_WININ = 0x3F3F; + REG_WINOUT = 0x3F3F; + if (!IsContest()) + REG_BG1CNT_BITFIELD.charBaseBlock = 0; + + REG_DISPCNT ^= DISPCNT_OBJWIN_ON; + REG_BLDCNT = 0; + REG_BLDALPHA = 0; + DestroySprite(&gSprites[gTasks[taskId].data[0]]); + DestroySprite(&gSprites[gTasks[taskId].data[2]]); + sub_8078914(&subStruct); + DmaFill32Defvars(3, 0, subStruct.field_4, 0x800); + REG_BG1CNT_BITFIELD.areaOverflowMode = 0; + spriteId1 = gSprites[gHealthboxIDs[battler]].oam.affineParam; + spriteId2 = gSprites[gHealthboxIDs[battler]].data[5]; + gSprites[gHealthboxIDs[battler]].oam.priority = 1; + gSprites[spriteId1].oam.priority = 1; + gSprites[spriteId2].oam.priority = 1; + DestroyAnimVisualTask(taskId); + } + } + break; + } +} + +void sub_813F4EC(u8 taskId) +{ + u8 healthBoxSpriteId; + u8 spriteId1, spriteId2; + u8 paletteNum1, paletteNum2; + u16 offset1, offset2; + + healthBoxSpriteId = gHealthboxIDs[gAnimBankAttacker]; + spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; + spriteId2 = gSprites[healthBoxSpriteId].data[5]; + paletteNum1 = AllocSpritePalette(0xD709); + paletteNum2 = AllocSpritePalette(0xD70A); + + offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100; + offset2 = (gSprites[spriteId2].oam.paletteNum * 16) + 0x100; + LoadPalette(&gPlttBufferUnfaded[offset1], paletteNum1 * 16 + 0x100, 0x20); + LoadPalette(&gPlttBufferUnfaded[offset2], paletteNum2 * 16 + 0x100, 0x20); + + gSprites[healthBoxSpriteId].oam.paletteNum = paletteNum1; + gSprites[spriteId1].oam.paletteNum = paletteNum1; + gSprites[spriteId2].oam.paletteNum = paletteNum2; + DestroyAnimVisualTask(taskId); +} + +void sub_813F5E8(u8 taskId) +{ + u8 healthBoxSpriteId; + u8 spriteId1, spriteId2; + u8 paletteIndex1, paletteIndex2; + + healthBoxSpriteId = gHealthboxIDs[gAnimBankAttacker]; + spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; + spriteId2 = gSprites[healthBoxSpriteId].data[5]; + + FreeSpritePaletteByTag(0xD709); + FreeSpritePaletteByTag(0xD70A); + paletteIndex1 = IndexOfSpritePaletteTag(0xD6FF); + paletteIndex2 = IndexOfSpritePaletteTag(0xD704); + gSprites[healthBoxSpriteId].oam.paletteNum = paletteIndex1; + gSprites[spriteId1].oam.paletteNum = paletteIndex1; + gSprites[spriteId2].oam.paletteNum = paletteIndex2; + + DestroyAnimVisualTask(taskId); +} + +void sub_813F6A0(u8 taskId) +{ + gTasks[taskId].data[10] = gBattleAnimArgs[0]; + gTasks[taskId].data[11] = gBattleAnimArgs[1]; + gTasks[taskId].func = sub_813F6CC; +} + +static void sub_813F6CC(u8 taskId) +{ + u8 paletteNum; + int paletteOffset, colorOffset; + + gTasks[taskId].data[0]++; + if (gTasks[taskId].data[0]++ >= gTasks[taskId].data[11]) + { + gTasks[taskId].data[0] = 0; + paletteNum = IndexOfSpritePaletteTag(0xD709); + colorOffset = gTasks[taskId].data[10] == 0 ? 6 : 2; + switch (gTasks[taskId].data[1]) + { + case 0: + gTasks[taskId].data[2] += 2; + if (gTasks[taskId].data[2] > 16) + gTasks[taskId].data[2] = 16; + + paletteOffset = paletteNum * 16 + 0x100; + BlendPalette(paletteOffset + colorOffset, 1, gTasks[taskId].data[2], RGB(20, 27, 31)); + if (gTasks[taskId].data[2] == 16) + gTasks[taskId].data[1]++; + break; + case 1: + gTasks[taskId].data[2] -= 2; + if (gTasks[taskId].data[2] < 0) + gTasks[taskId].data[2] = 0; + + paletteOffset = paletteNum * 16 + 0x100; + BlendPalette(paletteOffset + colorOffset, 1, gTasks[taskId].data[2], RGB(20, 27, 31)); + if (gTasks[taskId].data[2] == 0) + DestroyAnimVisualTask(taskId); + break; + } + } +} + +void sub_813F798(u8 taskId) +{ + u8 spriteId; + + spriteId = gBankSpriteIds[gAnimBankAttacker]; + switch (gTasks[taskId].data[0]) + { + case 0: + sub_8078E70(spriteId, 0); + gTasks[taskId].data[10] = 0x100; + gTasks[taskId].data[0]++; + break; + case 1: + gTasks[taskId].data[10] += 0x30; + obj_id_set_rotscale(spriteId, gTasks[taskId].data[10], gTasks[taskId].data[10], 0); + sub_8079A64(spriteId); + if (gTasks[taskId].data[10] >= 0x2D0) + gTasks[taskId].data[0]++; + break; + case 2: + sub_8078F40(spriteId); + gSprites[spriteId].invisible = 1; + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_813F844(u8 taskId) +{ + u8 spriteId; + u16 ball; + u8 ballIndex; + u8 x, y; + u8 priority, subpriority; + u32 selectedPalettes; + + spriteId = gBankSpriteIds[gAnimBankAttacker]; + if (GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER) + ball = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gAnimBankAttacker]], MON_DATA_POKEBALL); + else + ball = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gAnimBankAttacker]], MON_DATA_POKEBALL); + + ballIndex = ball_number_to_ball_processing_index(ball); + switch (gTasks[taskId].data[0]) + { + case 0: + x = GetBattlerSpriteCoord(gAnimBankAttacker, 0); + y = GetBattlerSpriteCoord(gAnimBankAttacker, 1); + priority = gSprites[spriteId].oam.priority; + subpriority = gSprites[spriteId].subpriority; + gTasks[taskId].data[10] = sub_814086C(x, y + 32, priority, subpriority, ballIndex); + selectedPalettes = sub_80791A8(1, 0, 0, 0, 0, 0, 0); + gTasks[taskId].data[11] = sub_8141314(0, gAnimBankAttacker, selectedPalettes, ballIndex); + gTasks[taskId].data[0]++; + break; + case 1: + if (!gTasks[gTasks[taskId].data[10]].isActive && !gTasks[gTasks[taskId].data[11]].isActive) + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_813F990(u8 taskId) +{ + u8 ballIndex = ball_number_to_ball_processing_index(gLastUsedItem); + sub_80478DC(ballIndex); + DestroyAnimVisualTask(taskId); +} + +void sub_813F9B8(u8 taskId) +{ + u8 ballIndex = ball_number_to_ball_processing_index(gLastUsedItem); + sub_804794C(ballIndex); + DestroyAnimVisualTask(taskId); +} + +void sub_813F9E0(u8 taskId) +{ + if (ewram17840.unk8 == 5) + gBattleAnimArgs[7] = -1; + else + gBattleAnimArgs[7] = 0; + + DestroyAnimVisualTask(taskId); +} + +u8 ball_number_to_ball_processing_index(u16 ballItem) +{ + switch (ballItem) + { + case ITEM_MASTER_BALL: + return 4; + case ITEM_ULTRA_BALL: + return 3; + case ITEM_GREAT_BALL: + return 1; + case ITEM_SAFARI_BALL: + return 2; + case ITEM_NET_BALL: + return 5; + case ITEM_DIVE_BALL: + return 6; + case ITEM_NEST_BALL: + return 7; + case ITEM_REPEAT_BALL: + return 8; + case ITEM_TIMER_BALL: + return 9; + case ITEM_LUXURY_BALL: + return 10; + case ITEM_PREMIER_BALL: + return 11; + case ITEM_POKE_BALL: + default: + return 0; + } +} + +void sub_813FA94(u8 taskId) +{ + u8 ballIndex; + u8 spriteId; + + ballIndex = ball_number_to_ball_processing_index(gLastUsedItem); + spriteId = CreateSprite(&gBallSpriteTemplates[ballIndex], 32, 80, 29); + gSprites[spriteId].data[0] = 34; + gSprites[spriteId].data[1] = GetBattlerSpriteCoord(gAnimBankTarget, 0); + gSprites[spriteId].data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 1) - 16; + gSprites[spriteId].callback = sub_813FD90; + ewram17840.unk9_1 = gSprites[gBankSpriteIds[gAnimBankTarget]].invisible; + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].func = sub_813FB7C; +} + +static void sub_813FB7C(u8 taskId) +{ + u8 spriteId = gTasks[taskId].data[0]; + if ((u16)gSprites[spriteId].data[0] == 0xFFFF) + DestroyAnimVisualTask(taskId); +} + +void sub_813FBB8(u8 taskId) +{ + int x, y; + u8 ballIndex; + u8 subpriority; + u8 spriteId; + + if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) + { + x = 32; + y = 11; + } + else + { + x = 23; + y = 5; + } + + ballIndex = ball_number_to_ball_processing_index(gLastUsedItem); + subpriority = sub_8079E90(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) + 1; + spriteId = CreateSprite(&gBallSpriteTemplates[ballIndex], x + 32, y | 80, subpriority); + gSprites[spriteId].data[0] = 34; + gSprites[spriteId].data[1] = GetBattlerSpriteCoord(gAnimBankTarget, 0); + gSprites[spriteId].data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 1) - 16; + gSprites[spriteId].callback = SpriteCallbackDummy; + StartSpriteAnim(&gSprites[gBankSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]], 1); + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].func = sub_813FCBC; +} + +static void sub_813FCBC(u8 taskId) +{ + if (gSprites[gBankSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]].animCmdIndex == 1) + { + PlaySE12WithPanning(SE_NAGERU, 0); + gSprites[gTasks[taskId].data[0]].callback = sub_813FD90; + CreateTask(sub_813FD34, 10); + gTasks[taskId].func = sub_813FB7C; + } +} + +static void sub_813FD34(u8 taskId) +{ + if (gSprites[gBankSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]].animEnded) + { + StartSpriteAnim(&gSprites[gBankSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]], 0); + DestroyTask(taskId); + } +} + +static void sub_813FD90(struct Sprite *sprite) +{ + u16 temp = sprite->data[1]; + u16 temp2 = sprite->data[2]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = temp; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = temp2; + sprite->data[5] = -40; + InitAnimArcTranslation(sprite); + sprite->callback = sub_813FDC0; +} + +static void sub_813FDC0(struct Sprite *sprite) +{ + int i; + u8 ballIndex; + int ballIndex2; // extra var needed to match + + if (TranslateAnimArc(sprite)) + { + if (ewram17840.unk8 == 5) + { + sprite->callback = sub_81407B8; + } + else + { + StartSpriteAnim(sprite, 1); + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + + for (i = 0; i < 8; i++) + { + sprite->data[i] = 0; + } + + sprite->data[5] = 0; + sprite->callback = sub_813FE70; + ballIndex = ball_number_to_ball_processing_index(gLastUsedItem); + ballIndex2 = ballIndex; + if (ballIndex2 > 11) + return; + if (ballIndex2 < 0) + return; + + sub_814086C(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballIndex); + sub_8141314(0, gAnimBankTarget, 14, ballIndex); + } + } +} + +static void sub_813FE70(struct Sprite *sprite) +{ + if (++sprite->data[5] == 10) + { + sprite->data[5] = CreateTask(TaskDummy, 50); + sprite->callback = sub_813FEC8; + gSprites[gBankSpriteIds[gAnimBankTarget]].data[1] = 0; + } +} + +static void sub_813FEC8(struct Sprite *sprite) +{ + u8 spriteId; + u8 taskId; + + spriteId = gBankSpriteIds[gAnimBankTarget]; + taskId = sprite->data[5]; + + if (++gTasks[taskId].data[1] == 11) + PlaySE(SE_SUIKOMU); + + switch (gTasks[taskId].data[0]) + { + case 0: + sub_8078E70(spriteId, 0); + gTasks[taskId].data[10] = 256; + gUnknown_03005F0C = 28; + gUnknown_03005F14 = (gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y) - (sprite->pos1.y + sprite->pos2.y); + gUnknown_03005F10 = (u32)(gUnknown_03005F14 * 256) / 28; + gTasks[taskId].data[2] = gUnknown_03005F10; + gTasks[taskId].data[0]++; + break; + case 1: + gTasks[taskId].data[10] += 0x20; + obj_id_set_rotscale(spriteId, gTasks[taskId].data[10], gTasks[taskId].data[10], 0); + gTasks[taskId].data[3] += gTasks[taskId].data[2]; + gSprites[spriteId].pos2.y = -gTasks[taskId].data[3] >> 8; + if (gTasks[taskId].data[10] >= 0x480) + gTasks[taskId].data[0]++; + break; + case 2: + sub_8078F40(spriteId); + gSprites[spriteId].invisible = 1; + gTasks[taskId].data[0]++; + break; + default: + if (gTasks[taskId].data[1] > 10) + { + DestroyTask(taskId); + StartSpriteAnim(sprite, 2); + sprite->data[5] = 0; + sprite->callback = sub_8140014; + } + break; + } +} + +static void sub_8140014(struct Sprite *sprite) +{ + int angle; + + if (sprite->animEnded) + { + sprite->data[3] = 0; + sprite->data[4] = 32; + sprite->data[5] = 0; + angle = 0; + sprite->pos1.y += Cos(angle, 32); + sprite->pos2.y = -Cos(angle, sprite->data[4]); + sprite->callback = sub_8140058; + } +} + +static void sub_8140058(struct Sprite *sprite) +{ + bool8 lastBounce; + int bounceCount; + + lastBounce = 0; + + switch (sprite->data[3] & 0xFF) + { + case 0: + sprite->pos2.y = -Cos(sprite->data[5], sprite->data[4]); + sprite->data[5] += (sprite->data[3] >> 8) + 4; + if (sprite->data[5] >= 64) + { + sprite->data[4] -= 10; + sprite->data[3] += 257; + + bounceCount = sprite->data[3] >> 8; + if (bounceCount == 4) + lastBounce = 1; + + // Play a different sound effect for each pokeball bounce. + switch (bounceCount) + { + case 1: + PlaySE(SE_KON); + break; + case 2: + PlaySE(SE_KON2); + break; + case 3: + PlaySE(SE_KON3); + break; + default: + PlaySE(SE_KON4); + break; + } + } + break; + case 1: + sprite->pos2.y = -Cos(sprite->data[5], sprite->data[4]); + sprite->data[5] -= (sprite->data[3] >> 8) + 4; + if (sprite->data[5] <= 0) + { + sprite->data[5] = 0; + sprite->data[3] &= -0x100; + } + break; + } + + if (lastBounce) + { + sprite->data[3] = 0; + sprite->pos1.y += Cos(64, 32); + sprite->pos2.y = 0; + if (ewram17840.unk8 == 0) + { + sprite->data[5] = 0; + sprite->callback = sub_8140410; + } + else + { + sprite->callback = sub_8140158; + sprite->data[4] = 1; + sprite->data[5] = 0; + } + } +} + +static void sub_8140158(struct Sprite *sprite) +{ + if (++sprite->data[3] == 31) + { + sprite->data[3] = 0; + sprite->affineAnimPaused = 1; + StartSpriteAffineAnim(sprite, 1); + ewram17840.unkC = 0; + sprite->callback = sub_81401A0; + PlaySE(SE_BOWA); + } +} + +static void sub_81401A0(struct Sprite *sprite) +{ + s8 state; + u16 var0; + + switch (sprite->data[3] & 0xFF) + { + case 0: + if ((s16)ewram17840.unkC > 0xFF) + { + sprite->pos2.x += sprite->data[4]; + ewram17840.unkC &= 0xFF; + } + else + { + ewram17840.unkC += 0xB0; + } + + sprite->data[5]++; + sprite->affineAnimPaused = 0; + var0 = sprite->data[5] + 7; + if (var0 > 14) + { + ewram17840.unkC = 0; + sprite->data[3]++; + sprite->data[5] = 0; + } + break; + case 1: + if (++sprite->data[5] == 1) + { + sprite->data[5] = 0; + sprite->data[4] = -sprite->data[4]; + sprite->data[3]++; + sprite->affineAnimPaused = 0; + if (sprite->data[4] < 0) + ChangeSpriteAffineAnim(sprite, 2); + else + ChangeSpriteAffineAnim(sprite, 1); + } + else + { + sprite->affineAnimPaused = 1; + } + break; + case 2: + if ((s16)ewram17840.unkC > 0xFF) + { + sprite->pos2.x += sprite->data[4]; + ewram17840.unkC &= 0xFF; + } + else + { + ewram17840.unkC += 0xB0; + } + + sprite->data[5]++; + sprite->affineAnimPaused = 0; + var0 = sprite->data[5] + 12; + if (var0 > 24) + { + ewram17840.unkC = 0; + sprite->data[3]++; + sprite->data[5] = 0; + } + break; + case 3: + if (sprite->data[5]++ < 0) + { + sprite->affineAnimPaused = 1; + break; + } + + sprite->data[5] = 0; + sprite->data[4] = -sprite->data[4]; + sprite->data[3]++; + sprite->affineAnimPaused = 0; + if (sprite->data[4] < 0) + ChangeSpriteAffineAnim(sprite, 2); + else + ChangeSpriteAffineAnim(sprite, 1); + // fall through + case 4: + if ((s16)ewram17840.unkC > 0xFF) + { + sprite->pos2.x += sprite->data[4]; + ewram17840.unkC &= 0xFF; + } + else + { + ewram17840.unkC += 0xB0; + } + + sprite->data[5]++; + sprite->affineAnimPaused = 0; + var0 = sprite->data[5] + 4; + if (var0 > 8) + { + ewram17840.unkC = 0; + sprite->data[3]++; + sprite->data[5] = 0; + sprite->data[4] = -sprite->data[4]; + } + break; + case 5: + sprite->data[3] += 0x100; + state = sprite->data[3] >> 8; + if (state == ewram17840.unk8) + { + sprite->affineAnimPaused = 1; + sprite->callback = sub_8140410; + } + else + { + if (ewram17840.unk8 == 4 && state == 3) + { + sprite->callback = sub_8140434; + sprite->affineAnimPaused = 1; + } + else + { + sprite->data[3]++; + sprite->affineAnimPaused = 1; + } + } + break; + case 6: + default: + if (++sprite->data[5] == 31) + { + sprite->data[5] = 0; + sprite->data[3] &= -0x100; + StartSpriteAffineAnim(sprite, 3); + if (sprite->data[4] < 0) + StartSpriteAffineAnim(sprite, 2); + else + StartSpriteAffineAnim(sprite, 1); + + PlaySE(SE_BOWA); + } + break; + } +} + +static void sub_8140410(struct Sprite *sprite) +{ + if (++sprite->data[5] == 31) + { + sprite->data[5] = 0; + sprite->callback = sub_81405F4; + } +} + +static void sub_8140434(struct Sprite *sprite) +{ + sprite->animPaused = 1; + sprite->callback = sub_8140454; + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[5] = 0; +} + +static void sub_8140454(struct Sprite *sprite) +{ + u8 *battler = &gAnimBankTarget; + + sprite->data[4]++; + if (sprite->data[4] == 40) + return; + + if (sprite->data[4] == 95) + { + gDoingBattleAnim = 0; + UpdateOamPriorityInAllHealthboxes(1); + m4aMPlayAllStop(); + PlaySE(MUS_FANFA5); + } + else if (sprite->data[4] == 315) + { + FreeOamMatrix(gSprites[gBankSpriteIds[*battler]].oam.matrixNum); + DestroySprite(&gSprites[gBankSpriteIds[*battler]]); + sprite->data[0] = 0; + sprite->callback = sub_81404E4; + } +} + +static void sub_81404E4(struct Sprite *sprite) +{ + u8 paletteIndex; + + switch (sprite->data[0]) + { + case 0: + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->oam.objMode = ST_OAM_OBJ_BLEND; + REG_BLDCNT = 0x3F40; + REG_BLDALPHA = 0x0010; + paletteIndex = IndexOfSpritePaletteTag(sprite->template->paletteTag); + BeginNormalPaletteFade(1 << (paletteIndex + 0x10), 0, 0, 16, RGB(31, 31, 31)); + sprite->data[0]++; + break; + case 1: + if (sprite->data[1]++ > 0) + { + sprite->data[1] = 0; + sprite->data[2]++; + REG_BLDALPHA = (sprite->data[2] << 8) | (16 - sprite->data[2]); + if (sprite->data[2] == 16) + sprite->data[0]++; + } + break; + case 2: + sprite->invisible = 1; + sprite->data[0]++; + break; + default: + if (!gPaletteFade.active) + { + REG_BLDCNT = 0; + REG_BLDALPHA = 0; + sprite->data[0] = 0; + sprite->callback = sub_81405C8; + } + break; + } +} + +static void sub_81405C8(struct Sprite *sprite) +{ + if (sprite->data[0] == 0) + { + sprite->data[0] = -1; + } + else + { + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); + } +} + +// fakematching. I think the return type of ball_number_to_ball_processing_index() +// is wrong because of the weird required casting. +static void sub_81405F4(struct Sprite *sprite) +{ + u8 ballIndex; + int ballIndex2; // extra var needed to match + + StartSpriteAnim(sprite, 1); + StartSpriteAffineAnim(sprite, 0); + sprite->callback = sub_81406BC; + + ballIndex = ball_number_to_ball_processing_index(gLastUsedItem); + ballIndex2 = ballIndex; + if (ballIndex2 > 11) + goto LABEL; + if (ballIndex2 < 0) + goto LABEL; + + sub_814086C(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballIndex); + sub_8141314(1, gAnimBankTarget, 14, ballIndex); + + LABEL: + gSprites[gBankSpriteIds[gAnimBankTarget]].invisible = 0; + StartSpriteAffineAnim(&gSprites[gBankSpriteIds[gAnimBankTarget]], 1); + AnimateSprite(&gSprites[gBankSpriteIds[gAnimBankTarget]]); + gSprites[gBankSpriteIds[gAnimBankTarget]].data[1] = 0x1000; +} + +static void sub_81406BC(struct Sprite *sprite) +{ + int next = FALSE; + + if (sprite->animEnded) + sprite->invisible = 1; + + if (gSprites[gBankSpriteIds[gAnimBankTarget]].affineAnimEnded) + { + StartSpriteAffineAnim(&gSprites[gBankSpriteIds[gAnimBankTarget]], 0); + next = TRUE; + } + else + { + gSprites[gBankSpriteIds[gAnimBankTarget]].data[1] -= 288; + gSprites[gBankSpriteIds[gAnimBankTarget]].pos2.y = gSprites[gBankSpriteIds[gAnimBankTarget]].data[1] >> 8; + } + + if (sprite->animEnded && next) + { + gSprites[gBankSpriteIds[gAnimBankTarget]].pos2.y = 0; + gSprites[gBankSpriteIds[gAnimBankTarget]].invisible = ewram17840.unk9_1; + sprite->data[0] = 0; + sprite->callback = sub_81405C8; + gDoingBattleAnim = 0; + UpdateOamPriorityInAllHealthboxes(1); + } +} + +static void sub_81407B8(struct Sprite *sprite) +{ + int i; + + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.y = 0; + sprite->pos2.x = 0; + for (i = 0; i < 6; i++) + sprite->data[i] = 0; + + sprite->callback = sub_81407F4; +} + +#ifdef NONMATCHING +// there is some weird typing going on with var0 and var1. +static void sub_81407F4(struct Sprite *sprite) +{ + s16 var0, var1; + + var0 = sprite->data[0] + 0x800; + var1 = sprite->data[1] + 0x680; + sprite->pos2.x -= var1 >> 8; + sprite->pos2.y += var0 >> 8; + sprite->data[0] = var0 & 0xFF; + sprite->data[1] = var1 & 0xFF; + + if (sprite->pos1.y + sprite->pos2.y > 160 + || sprite->pos1.x + sprite->pos2.x < -8) + { + sprite->data[0] = 0; + sprite->callback = sub_81405C8; + gDoingBattleAnim = 0; + UpdateOamPriorityInAllHealthboxes(1); + } +} +#else +NAKED +static void sub_81407F4(struct Sprite *sprite) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + adds r4, r0, 0\n\ + movs r0, 0x80\n\ + lsls r0, 4\n\ + adds r2, r0, 0\n\ + ldrh r1, [r4, 0x2E]\n\ + adds r2, r1\n\ + movs r0, 0xD0\n\ + lsls r0, 3\n\ + adds r3, r0, 0\n\ + ldrh r1, [r4, 0x30]\n\ + adds r3, r1\n\ + lsls r1, r3, 16\n\ + asrs r1, 24\n\ + ldrh r0, [r4, 0x24]\n\ + subs r0, r1\n\ + strh r0, [r4, 0x24]\n\ + lsls r0, r2, 16\n\ + asrs r0, 24\n\ + ldrh r1, [r4, 0x26]\n\ + adds r0, r1\n\ + strh r0, [r4, 0x26]\n\ + movs r0, 0xFF\n\ + ands r2, r0\n\ + strh r2, [r4, 0x2E]\n\ + ands r3, r0\n\ + strh r3, [r4, 0x30]\n\ + movs r2, 0x22\n\ + ldrsh r0, [r4, r2]\n\ + movs r2, 0x26\n\ + ldrsh r1, [r4, r2]\n\ + adds r0, r1\n\ + cmp r0, 0xA0\n\ + bgt _0814084A\n\ + movs r1, 0x20\n\ + ldrsh r0, [r4, r1]\n\ + movs r2, 0x24\n\ + ldrsh r1, [r4, r2]\n\ + adds r0, r1\n\ + movs r1, 0x8\n\ + negs r1, r1\n\ + cmp r0, r1\n\ + bge _0814085E\n\ +_0814084A:\n\ + movs r0, 0\n\ + strh r0, [r4, 0x2E]\n\ + ldr r0, _08140864 @ =sub_81405C8\n\ + str r0, [r4, 0x1C]\n\ + ldr r1, _08140868 @ =gDoingBattleAnim\n\ + movs r0, 0\n\ + strb r0, [r1]\n\ + movs r0, 0x1\n\ + bl UpdateOamPriorityInAllHealthboxes\n\ +_0814085E:\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .align 2, 0\n\ +_08140864: .4byte sub_81405C8\n\ +_08140868: .4byte gDoingBattleAnim\n\ + .syntax divided\n"); +} +#endif // NONMATCHING + +u8 sub_814086C(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballIndex) +{ + u8 taskId; + + if (GetSpriteTileStartByTag(gUnknown_0840B258[ballIndex].tag) == 0xFFFF) + { + LoadCompressedObjectPic(&gUnknown_0840B258[ballIndex]); + LoadCompressedObjectPalette(&gUnknown_0840B2B8[ballIndex]); + } + + taskId = CreateTask(gUnknown_0840B384[ballIndex], 5); + gTasks[taskId].data[1] = x; + gTasks[taskId].data[2] = y; + gTasks[taskId].data[3] = priority; + gTasks[taskId].data[4] = subpriority; + gTasks[taskId].data[15] = ballIndex; + PlaySE(SE_BOWA2); + if (gMain.inBattle) + ewram17840.unkA++; + + return taskId; +} + +void sub_8140930(u8 taskId) +{ + u8 spriteId; + u8 x, y; + u8 priority, subpriority; + u8 ballIndex; + u8 var0; + + ballIndex = gTasks[taskId].data[15]; + if (gTasks[taskId].data[0] < 16) + { + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140A08; + gSprites[spriteId].oam.priority = priority; + + var0 = (u8)gTasks[taskId].data[0]; + if (var0 >= 8) + var0 -= 8; + + gSprites[spriteId].data[0] = var0 * 32; + if (gTasks[taskId].data[0] == 15) + { + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); + return; + } + } + + gTasks[taskId].data[0]++; +} + +static void sub_8140A08(struct Sprite *sprite) +{ + if (sprite->data[1] == 0) + sprite->callback = sub_8140A28; + else + sprite->data[1]--; +} + +static void sub_8140A28(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], sprite->data[1]); + sprite->data[1] += 2; + if (sprite->data[1] == 50) + sub_8141294(sprite); +} + +void sub_8140A64(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140ECC; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 10; + gSprites[spriteId].data[5] = 2; + gSprites[spriteId].data[6] = 1; + } + + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); +} + +void sub_8140B3C(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140ECC; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 10; + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 2; + } + + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); +} + +void sub_8140C14(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140ECC; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 4; + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 1; + } + + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); +} + +void sub_8140CE8(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 10; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140ECC; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 25; + gSprites[spriteId].data[4] = 5; + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 1; + } + + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); +} + +void sub_8140DC4(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + if (gTasks[taskId].data[7]) + { + gTasks[taskId].data[7]--; + } + else + { + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140ECC; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 8; + gSprites[spriteId].data[5] = 2; + gSprites[spriteId].data[6] = 2; + } + + gTasks[taskId].data[7] = 8; + if (++gTasks[taskId].data[0] == 2) + { + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); + } + } +} + +static void sub_8140ECC(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], sprite->data[2]); + sprite->data[0] = (sprite->data[0] + sprite->data[4]) & 0xFF; + sprite->data[1] += sprite->data[5]; + sprite->data[2] += sprite->data[6]; + if (++sprite->data[3] == 51) + sub_8141294(sprite); +} + +void sub_8140F24(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 12; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140FF8; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 21; + } + + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); +} + +static void sub_8140FF8(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], Sin(sprite->data[0], sprite->data[2])); + sprite->data[0] = (sprite->data[0] + 6) & 0xFF; + sprite->data[1]++; + sprite->data[2]++; + if (++sprite->data[3] == 51) + sub_8141294(sprite); +} + +void sub_8141058(u8 taskId) +{ + u8 i, j; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (j = 0; j < 2; j++) + { + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8140ECC; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 8; + + if (j == 0) + { + gSprites[spriteId].data[5] = 2; + gSprites[spriteId].data[6] = 1; + } + else + { + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 2; + } + } + } + + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); +} + +void sub_8141164(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballIndex; + u8 spriteId; + + ballIndex = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gSpriteTemplate_840B3B4[ballIndex], x, y, subpriority); + StartSpriteAnim(&gSprites[spriteId], gUnknown_0840B378[ballIndex]); + gSprites[spriteId].callback = sub_8141230; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + } + + gSprites[spriteId].data[7] = 1; + DestroyTask(taskId); +} + +static void sub_8141230(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], Sin(sprite->data[0] & 0x3F, sprite->data[2])); + sprite->data[0] = (sprite->data[0] + 10) & 0xFF; + sprite->data[1]++; + sprite->data[2]++; + if (++sprite->data[3] == 51) + sub_8141294(sprite); +} + +static void sub_8141294(struct Sprite *sprite) +{ + int i; + int temp; + + if (!gMain.inBattle) + { + temp = sprite->data[7]; // temp var needed to match + if (temp == 1) + DestroySpriteAndFreeResources(sprite); + else + DestroySprite(sprite); + } + else if (sprite->data[7] == 1) + { + if (--ewram17840.unkA == 0) + { + for (i = 0; i < 12; i++) + { + FreeSpriteTilesByTag(gUnknown_0840B258[i].tag); + FreeSpritePaletteByTag(gUnknown_0840B2B8[i].tag); + } + + DestroySprite(sprite); + } + else + DestroySprite(sprite); + } + else + DestroySprite(sprite); +} + +u8 sub_8141314(u8 arg0, u8 battler, u32 selectedPalettes, u8 ballIndex) +{ + u8 taskId; + + taskId = CreateTask(sub_81413DC, 5); + gTasks[taskId].data[15] = ballIndex; + gTasks[taskId].data[3] = battler; + gTasks[taskId].data[10] = selectedPalettes; + gTasks[taskId].data[11] = selectedPalettes >> 16; + + if (!arg0) + { + BlendPalette(battler * 16 + 0x100, 16, 0, gUnknown_0840B4D4[ballIndex]); + gTasks[taskId].data[1] = 1; + } + else + { + BlendPalette(battler * 16 + 0x100, 16, 16, gUnknown_0840B4D4[ballIndex]); + gTasks[taskId].data[0] = 16; + gTasks[taskId].data[1] = -1; + gTasks[taskId].func = sub_814146C; + } + + BeginNormalPaletteFade(selectedPalettes, 0, 0, 16, RGB(31, 31, 31)); + return taskId; +} + +static void sub_81413DC(u8 taskId) +{ + u8 ballIndex = gTasks[taskId].data[15]; + + if (gTasks[taskId].data[2] <= 16) + { + BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gUnknown_0840B4D4[ballIndex]); + gTasks[taskId].data[0] += gTasks[taskId].data[1]; + gTasks[taskId].data[2]++; + } + else if (!gPaletteFade.active) + { + u32 selectedPalettes = (u16)gTasks[taskId].data[10] | ((u16)gTasks[taskId].data[11] << 16); + BeginNormalPaletteFade(selectedPalettes, 0, 16, 0, RGB(31, 31, 31)); + DestroyTask(taskId); + } +} + +static void sub_814146C(u8 taskId) +{ + if (!gPaletteFade.active) + { + u32 selectedPalettes = (u16)gTasks[taskId].data[10] | ((u16)gTasks[taskId].data[11] << 16); + BeginNormalPaletteFade(selectedPalettes, 0, 16, 0, RGB(31, 31, 31)); + gTasks[taskId].func = sub_81414BC; + } +} + +static void sub_81414BC(u8 taskId) +{ + u8 ballIndex = gTasks[taskId].data[15]; + + if (gTasks[taskId].data[2] <= 16) + { + BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gUnknown_0840B4D4[ballIndex]); + gTasks[taskId].data[0] += gTasks[taskId].data[1]; + gTasks[taskId].data[2]++; + } + else + { + DestroyTask(taskId); + } +} + +void sub_814151C(u8 taskId) +{ + u8 spriteId; + u32 x; + u32 done; + + done = FALSE; + spriteId = gBankSpriteIds[gAnimBankAttacker]; + switch (gTasks[taskId].data[10]) + { + case 0: + gTasks[taskId].data[11] = gBattleAnimArgs[0]; + gTasks[taskId].data[0] += 0x500; + if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) + gSprites[spriteId].pos2.x += gTasks[taskId].data[0] >> 8; + else + gSprites[spriteId].pos2.x -= gTasks[taskId].data[0] >> 8; + + gTasks[taskId].data[0] &= 0xFF; + x = gSprites[spriteId].pos1.x + gSprites[spriteId].pos2.x + 32; + if (x > 304) + gTasks[taskId].data[10]++; + break; + case 1: + refresh_graphics_maybe(gAnimBankAttacker, gTasks[taskId].data[11], spriteId); + gTasks[taskId].data[10]++; + break; + case 2: + gTasks[taskId].data[0] += 0x500; + if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) + gSprites[spriteId].pos2.x -= gTasks[taskId].data[0] >> 8; + else + gSprites[spriteId].pos2.x += gTasks[taskId].data[0] >> 8; + + gTasks[taskId].data[0] &= 0xFF; + if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) + { + if (gSprites[spriteId].pos2.x <= 0) + { + gSprites[spriteId].pos2.x = 0; + // done = FALSE; // fakematching--can't get the tail merge correct + goto DONE; + } + } + else + { + if (gSprites[spriteId].pos2.x >= 0) + { + gSprites[spriteId].pos2.x = 0; + done = TRUE; + } + } + + if (done) + { + DONE: + DestroyAnimVisualTask(taskId); + } + break; + } +} + +void sub_81416C4(u8 taskId) +{ + u8 spriteId; + + switch (gTasks[taskId].data[15]) + { + case 0: + if (GetBattlerPosition_permutated(gAnimBankAttacker) == 1) + REG_BLDCNT = 0x3F42; + else + REG_BLDCNT = 0x3F44; + + REG_BLDALPHA = 0x0010; + gTasks[taskId].data[15]++; + break; + case 1: + if (gTasks[taskId].data[1]++ > 1) + { + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[0]++; + REG_BLDALPHA = (gTasks[taskId].data[0] << 8) | (16 - gTasks[taskId].data[0]); + if (gTasks[taskId].data[0] == 16) + gTasks[taskId].data[15]++; + } + break; + case 2: + spriteId = gBankSpriteIds[gAnimBankAttacker]; + DmaClear32(3, (void *)OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * TILE_SIZE_4BPP, 0x800); + sub_80324E0(gAnimBankAttacker); + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_81417D8(u8 taskId) +{ + gBattleAnimArgs[7] = ewram17800[gAnimBankAttacker].substituteSprite; + DestroyAnimVisualTask(taskId); +} + +void sub_8141808(u8 taskId) +{ + gAnimBankTarget = gEffectBank; + DestroyAnimVisualTask(taskId); +} + +void sub_8141828(u8 battler, struct Pokemon *mon) +{ + int isShiny; + u32 otId, personality; + u32 shinyValue; + u8 taskId1, taskId2; + + isShiny = 0; + ewram17810[battler].unk0_7 = 1; + otId = GetMonData(mon, MON_DATA_OT_ID); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + + if (IsAnimBankSpriteVisible(battler)) + { + shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); + if (shinyValue < 8) + isShiny = TRUE; + + if (isShiny) + { + if (GetSpriteTileStartByTag(0x27F9) == 0xFFFF) + { + LoadCompressedObjectPic(&gBattleAnimPicTable[233]); + LoadCompressedObjectPalette(&gBattleAnimPaletteTable[233]); + } + + taskId1 = CreateTask(sub_814191C, 10); + taskId2 = CreateTask(sub_814191C, 10); + gTasks[taskId1].data[0] = battler; + gTasks[taskId2].data[0] = battler; + gTasks[taskId1].data[1] = 0; + gTasks[taskId2].data[1] = 1; + return; + } + } + + ewram17810[battler].unk1_0 = 1; +} + +static void sub_814191C(u8 taskId) +{ + u8 battler; + u8 x, y; + u8 spriteId; + u16 counter; + s16 state; + u8 pan; + + if (gTasks[taskId].data[13] < 60) + { + gTasks[taskId].data[13]++; + return; + } + + if (ewram17840.unkA) + return; + + counter = gTasks[taskId].data[10]++; + if (counter & 3) + return; + + battler = gTasks[taskId].data[0]; + x = GetBattlerSpriteCoord(battler, 0); + y = GetBattlerSpriteCoord(battler, 1); + state = gTasks[taskId].data[11]; + if (state == 0) + { + spriteId = CreateSprite(&gBattleAnimSpriteTemplate_84024E8, x, y, 5); + } + else if (state >= 0 && gTasks[taskId].data[11] < 4) + { + spriteId = CreateSprite(&gSpriteTemplate_8402500, x, y, 5); + gSprites[spriteId].oam.tileNum += 4; + } + else + { + spriteId = CreateSprite(&gSpriteTemplate_8402500, x, y, 5); + gSprites[spriteId].oam.tileNum += 5; + } + + if (gTasks[taskId].data[1] == 0) + { + gSprites[spriteId].callback = sub_8141B20; + } + else + { + gSprites[spriteId].callback = sub_8141B74; + gSprites[spriteId].pos2.x = -32; + gSprites[spriteId].pos2.y = 32; + gSprites[spriteId].invisible = 1; + if (gTasks[taskId].data[11] == 0) + { + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + pan = 192; + else + pan = 63; + + PlaySE12WithPanning(SE_REAPOKE, pan); + } + } + + gSprites[spriteId].data[0] = taskId; + gTasks[taskId].data[11]++; + gTasks[taskId].data[12]++; + if (gTasks[taskId].data[11] == 5) + gTasks[taskId].func = sub_8141AD8; +} + +static void sub_8141AD8(u8 taskId) +{ + u8 battler; + + if (gTasks[taskId].data[12] == 0) + { + if (gTasks[taskId].data[1] == 1) + { + battler = gTasks[taskId].data[0]; + ewram17810[battler].unk1_0 = 1; + } + + DestroyTask(taskId); + } +} + +static void sub_8141B20(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[1], 24); + sprite->pos2.y = Cos(sprite->data[1], 24); + sprite->data[1] += 12; + if (sprite->data[1] > 0xFF) + { + gTasks[sprite->data[0]].data[12]--; + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); + } +} + +static void sub_8141B74(struct Sprite *sprite) +{ + if (sprite->data[1] < 4) + { + sprite->data[1]++; + } + else + { + sprite->invisible = 0; + sprite->pos2.x += 5; + sprite->pos2.y -= 5; + if (sprite->pos2.x > 32) + { + gTasks[sprite->data[0]].data[12]--; + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); + } + } +} + +void sub_8141BD4(u8 taskId) +{ + u8 paletteIndex; + + LoadCompressedObjectPic(&gBattleAnimPicTable[269]); + LoadCompressedObjectPalette(&gBattleAnimPaletteTable[269]); + paletteIndex = IndexOfSpritePaletteTag(0x281D); // unused + DestroyAnimVisualTask(taskId); +} + +void sub_8141C08(u8 taskId) +{ + FreeSpriteTilesByTag(0x281D); + FreeSpritePaletteByTag(0x281D); + DestroyAnimVisualTask(taskId); +} + +void sub_8141C30(struct Sprite *sprite) +{ + InitAnimSpritePos(sprite, 0); + sprite->data[0] = 30; + sprite->data[2] = GetBattlerSpriteCoord(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), 0) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), 1) + gBattleAnimArgs[3]; + sprite->data[5] = -32; + InitAnimArcTranslation(sprite); + StartSpriteAnim(&gSprites[gBankSpriteIds[gAnimBankAttacker]], 1); + sprite->callback = sub_8141CBC; +} + +static void sub_8141CBC(struct Sprite *sprite) +{ + if (gSprites[gBankSpriteIds[gAnimBankAttacker]].animCmdIndex == 1) + sprite->callback = sub_8141CF4; +} + +static void sub_8141CF4(struct Sprite *sprite) +{ + if (TranslateAnimArc(sprite)) + { + sprite->data[0] = 0; + sprite->invisible = 1; + sprite->callback = sub_8141D20; + } +} + +static void sub_8141D20(struct Sprite *sprite) +{ + if (gSprites[gBankSpriteIds[gAnimBankAttacker]].animEnded) + { + if (++sprite->data[0] > 0) + { + StartSpriteAnim(&gSprites[gBankSpriteIds[gAnimBankAttacker]], 0); + DestroyAnimSprite(sprite); + } + } +} + +void sub_8141D7C(u8 taskId) +{ + gAnimBankAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gAnimBankTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + DestroyAnimVisualTask(taskId); +} + +void sub_8141DAC(u8 taskId) +{ + if (ewram17840.unk0 == 83) + gBattleAnimArgs[0] = 1; + else if (ewram17840.unk0 == 250) + gBattleAnimArgs[0] = 2; + else if (ewram17840.unk0 == 128) + gBattleAnimArgs[0] = 3; + else if (ewram17840.unk0 == 328) + gBattleAnimArgs[0] = 4; + else + gBattleAnimArgs[0] = 0; + + DestroyAnimVisualTask(taskId); +} + +void sub_8141E10(u8 taskId) +{ + gAnimBankAttacker = ewram17840.unk0; + gAnimBankTarget = ewram17840.unk0 >> 8; + DestroyAnimVisualTask(taskId); +} diff --git a/src/battle/battle_controller_linkopponent.c b/src/battle/battle_controller_linkopponent.c index a759822cd..8ca3d160a 100644 --- a/src/battle/battle_controller_linkopponent.c +++ b/src/battle/battle_controller_linkopponent.c @@ -1,6 +1,7 @@ #include "global.h" #include "battle.h" #include "battle_anim.h" +#include "battle_anim_813F0F4.h" #include "battle_interface.h" #include "data2.h" #include "link.h" @@ -71,7 +72,7 @@ extern void sub_80313A0(struct Sprite *); extern void sub_803757C(void); extern void oamt_add_pos2_onto_pos1(); extern void StoreSpriteCallbackInData(); -extern void StartTranslateAnimSpriteByDeltas(struct Sprite *); +extern void StartAnimLinearTranslation(struct Sprite *); extern void sub_80375B4(void); extern void sub_8010384(struct Sprite *); extern void sub_8037B78(void); @@ -103,7 +104,6 @@ extern u8 move_anim_start_t3(); extern void sub_8037FD8(void); extern void sub_8037F34(void); extern void LinkOpponentBufferExecCompleted(void); -extern void sub_8141828(); extern void sub_804777C(); // this file's functions @@ -1280,7 +1280,7 @@ void LinkOpponentHandleTrainerSlideBack(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); gBattleBankFunc[gActiveBattler] = sub_80375B4; } @@ -1631,7 +1631,7 @@ void LinkOpponentHandleTrainerBallThrow(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], sub_803A3A8); taskId = CreateTask(sub_803A2C4, 5); gTasks[taskId].data[0] = gActiveBattler; diff --git a/src/battle/battle_controller_linkpartner.c b/src/battle/battle_controller_linkpartner.c index 16aef5791..dff4edfc1 100644 --- a/src/battle/battle_controller_linkpartner.c +++ b/src/battle/battle_controller_linkpartner.c @@ -1,6 +1,7 @@ #include "global.h" #include "battle.h" #include "battle_anim.h" +#include "battle_anim_813F0F4.h" #include "battle_interface.h" #include "data2.h" #include "battle_811DA74.h" @@ -73,7 +74,7 @@ extern u8 sub_8031720(); extern u8 mplay_80342A4(); extern void oamt_add_pos2_onto_pos1(); extern void StoreSpriteCallbackInData(); -extern void StartTranslateAnimSpriteByDeltas(struct Sprite *); +extern void StartAnimLinearTranslation(struct Sprite *); extern void sub_80105EC(struct Sprite *); extern s32 sub_803FC34(u16); extern void LoadPlayerTrainerBankSprite(); @@ -97,7 +98,6 @@ extern void sub_8043DB0(); extern void move_anim_start_t4(); extern void c3_0802FDF4(u8); extern void sub_8031F88(); -extern void sub_8141828(); extern void c2_8011A1C(void); // this file's functions @@ -1224,7 +1224,7 @@ void LinkPartnerHandleTrainerSlideBack(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); gBattleBankFunc[gActiveBattler] = sub_811DB1C; } @@ -1576,7 +1576,7 @@ void LinkPartnerHandleTrainerBallThrow(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], sub_8030E38); StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); diff --git a/src/battle/battle_controller_opponent.c b/src/battle/battle_controller_opponent.c index d8760e21f..ee313c098 100644 --- a/src/battle/battle_controller_opponent.c +++ b/src/battle/battle_controller_opponent.c @@ -83,7 +83,7 @@ extern void sub_80313A0(struct Sprite *); extern void sub_8032B4C(void); extern void sub_8031A6C(u16, u8); extern void sub_8032B84(void); -extern void StartTranslateAnimSpriteByDeltas(struct Sprite *); +extern void StartAnimLinearTranslation(struct Sprite *); extern void sub_8032BBC(void); extern void oamt_add_pos2_onto_pos1(); extern void StoreSpriteCallbackInData(); @@ -1284,7 +1284,7 @@ void OpponentHandleTrainerSlideBack(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); gBattleBankFunc[gActiveBattler] = sub_8032BBC; } @@ -2223,7 +2223,7 @@ void OpponentHandleTrainerBallThrow(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], sub_8035C10); taskId = CreateTask(sub_8035C44, 5); gTasks[taskId].data[0] = gActiveBattler; diff --git a/src/battle/battle_controller_player.c b/src/battle/battle_controller_player.c index a83946554..654a2c195 100644 --- a/src/battle/battle_controller_player.c +++ b/src/battle/battle_controller_player.c @@ -2,6 +2,7 @@ #include "data2.h" #include "battle.h" #include "battle_anim.h" +#include "battle_anim_813F0F4.h" #include "battle_interface.h" #include "battle_message.h" #include "item.h" @@ -94,7 +95,7 @@ extern void sub_8047858(); extern u8 GetBattlerSide(u8); extern void StartBattleIntroAnim(); extern void oamt_add_pos2_onto_pos1(); -extern void StartTranslateAnimSpriteByDeltas(struct Sprite *); +extern void StartAnimLinearTranslation(struct Sprite *); extern void StoreSpriteCallbackInData(); extern void BattleLoadPlayerMonSprite(); extern bool8 IsDoubleBattle(void); @@ -164,7 +165,6 @@ extern void sub_8010520(struct Sprite *); extern void sub_8010574(struct Sprite *); extern bool8 IsDoubleBattle(); extern void sub_804777C(); -extern void sub_8141828(); extern void sub_8094E20(u8); extern void nullsub_14(void); extern void sub_80A6DCC(void); @@ -2612,7 +2612,7 @@ void PlayerHandleTrainerSlideBack(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); gBattleBankFunc[gActiveBattler] = sub_802D274; @@ -3067,7 +3067,7 @@ void PlayerHandleTrainerBallThrow(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], sub_8030E38); StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); diff --git a/src/battle/battle_controller_wally.c b/src/battle/battle_controller_wally.c index ed4eadee6..312ef9d12 100644 --- a/src/battle/battle_controller_wally.c +++ b/src/battle/battle_controller_wally.c @@ -1,6 +1,7 @@ #include "global.h" #include "battle.h" #include "battle_anim.h" +#include "battle_anim_813F0F4.h" #include "battle_interface.h" #include "battle_message.h" #include "data2.h" @@ -63,7 +64,6 @@ extern void Emitcmd35(u8, u16); extern void nullsub_14(void); extern void PrepareBagForWallyTutorial(void); -extern void sub_8141828(); extern void sub_8045A5C(); extern void sub_804777C(); extern void sub_8043DFC(); @@ -85,7 +85,7 @@ extern void sub_80304A8(void); extern void sub_8047858(); extern void StartBattleIntroAnim(); extern void oamt_add_pos2_onto_pos1(); -extern void StartTranslateAnimSpriteByDeltas(struct Sprite *); +extern void StartAnimLinearTranslation(struct Sprite *); extern void sub_8030E38(struct Sprite *); extern void StoreSpriteCallbackInData(); extern u8 sub_8046400(); @@ -1482,7 +1482,7 @@ void WallyHandleTrainerBallThrow(void) gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = StartTranslateAnimSpriteByDeltas; + gSprites[gBankSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; StoreSpriteCallbackInData(&gSprites[gBankSpriteIds[gActiveBattler]], sub_8030E38); StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); diff --git a/src/battle/battle_records.c b/src/battle/battle_records.c index fed8d6575..d94d88032 100644 --- a/src/battle/battle_records.c +++ b/src/battle/battle_records.c @@ -290,7 +290,7 @@ void ShowLinkBattleRecords(void) { s32 i; Menu_DrawStdWindowFrame(1, 0, 28, 18); - sub_8072BD8(gOtherText_BattleResults, 0, 1, 240); + MenuPrint_Centered(gOtherText_BattleResults, 0, 1, 240); PrintLinkBattleWinsLossesDraws(gSaveBlock1.linkBattleRecords); #if ENGLISH @@ -368,7 +368,7 @@ void ShowBattleTowerRecords(void) { u16 i; Menu_DrawStdWindowFrame(3, 1, 27, 17); - sub_8072BD8(gOtherText_BattleTowerResults, 3, 2, 0xC8); + MenuPrint_Centered(gOtherText_BattleTowerResults, 3, 2, 0xC8); Menu_PrintText(gOtherText_Lv50, 5, 6); Menu_PrintText(gOtherText_Lv100, 5, 12); for (i = 5; i < 26; i++) diff --git a/src/battle/calculate_base_damage.c b/src/battle/calculate_base_damage.c index d983e47a4..0022cf9fe 100644 --- a/src/battle/calculate_base_damage.c +++ b/src/battle/calculate_base_damage.c @@ -23,13 +23,13 @@ extern u16 gBattleMovePower; extern u16 gTrainerBattleOpponent; // Masks for getting PP Up count, also PP Max values -const u8 gUnknown_08208238[] = {0x03, 0x0c, 0x30, 0xc0}; +const u8 gPPUpReadMasks[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for setting PP Up count -const u8 gUnknown_0820823C[] = {0xFC, 0xF3, 0xCF, 0x3F}; +const u8 gPPUpWriteMasks[] = {0xFC, 0xF3, 0xCF, 0x3F}; // Values added to PP Up count -const u8 gUnknown_08208240[] = {0x01, 0x04, 0x10, 0x40}; +const u8 gPPUpValues[] = {0x01, 0x04, 0x10, 0x40}; const u8 gStatStageRatios[][2] = { diff --git a/src/battle/pokeball.c b/src/battle/pokeball.c index c619141a1..ac15246d6 100644 --- a/src/battle/pokeball.c +++ b/src/battle/pokeball.c @@ -1,6 +1,7 @@ #include "global.h" #include "gba/m4a_internal.h" #include "battle.h" +#include "battle_anim_813F0F4.h" #include "decompress.h" #include "graphics.h" #include "m4a.h" @@ -296,11 +297,8 @@ const struct SpriteTemplate gBallSpriteTemplates[] = }, }; -extern u32 ball_number_to_ball_processing_index(u16); // not sure of return type -extern void InitAnimSpriteTranslationOverDuration(); -extern bool8 TranslateAnimSpriteLinearAndSine(struct Sprite *); -extern u8 sub_814086C(u8, u8, int, int, u8); -extern u8 sub_8141314(u8, u8, int, u8); +extern void InitAnimArcTranslation(); +extern bool8 TranslateAnimArc(struct Sprite *); static void sub_8046464(u8); static void sub_80466E8(struct Sprite *); @@ -397,7 +395,7 @@ static void sub_8046464(u8 taskId) gSprites[spriteId].data[2] = GetBattlerSpriteCoord(gBankTarget, 0); gSprites[spriteId].data[4] = GetBattlerSpriteCoord(gBankTarget, 1) - 16; gSprites[spriteId].data[5] = -40; - InitAnimSpriteTranslationOverDuration(&gSprites[spriteId]); + InitAnimArcTranslation(&gSprites[spriteId]); gSprites[spriteId].oam.affineParam = taskId; gTasks[taskId].data[4] = gBankTarget; gTasks[taskId].func = TaskDummy; @@ -406,7 +404,7 @@ static void sub_8046464(u8 taskId) static void objc_0804ABD4(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { u8 taskId = sprite->oam.affineParam; u8 r5 = gTasks[taskId].data[4]; @@ -834,7 +832,7 @@ static void sub_8047074(struct Sprite *sprite) sprite->data[4] = GetBattlerSpriteCoord(sprite->data[6], 3) + 24; sprite->data[5] = -30; sprite->oam.affineParam = sprite->data[6]; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = sub_80470C4; } @@ -858,7 +856,7 @@ static void sub_80470C4(struct Sprite *sprite) StartSpriteAffineAnim(sprite, 4); } r4 = sprite->data[0]; - TranslateAnimSpriteByDeltas(sprite); + TranslateAnimLinear(sprite); sprite->data[7] += sprite->data[6] / 3; sprite->pos2.y += Sin(HIBYTE(sprite->data[7]), sprite->data[5]); sprite->oam.affineParam += 0x100; @@ -876,7 +874,7 @@ static void sub_80470C4(struct Sprite *sprite) } else { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) { sprite->pos1.x += sprite->pos2.x; sprite->pos1.y += sprite->pos2.y; diff --git a/src/berry_blender.c b/src/berry_blender.c index 8bf669a92..85c992d8d 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1784,6 +1784,7 @@ static void sub_804FE70(void) { sub_804FC48(0x2345, var); sub_804FD30(0x2345); + // looks like a bug if (gBerryBlenderData->field_4.win_field_F > 1000) gBerryBlenderData->field_13E = 1000; if (gBerryBlenderData->scores[i][BLENDER_SCORE_MISS] < 999) @@ -2995,7 +2996,7 @@ bool8 Blender_PrintBlendingResults(void) u16 secondsPassed, minutes, seconds; Menu_DrawStdWindowFrame(4, 2, 25, 17); - sub_8072BD8(gOtherText_ResultsOfBlending, 5, 3, 160); + MenuPrint_Centered(gOtherText_ResultsOfBlending, 5, 3, 160); for (i = 0; i < gBerryBlenderData->playersNo; i++) { u8 place = gBerryBlenderData->playerPlaces[i]; @@ -3188,7 +3189,7 @@ static bool8 Blender_PrintBlendingRanking(void) break; case 3: Menu_DrawStdWindowFrame(4, 2, 25, 17); - sub_8072BD8(gOtherText_Ranking, 5, 3, 160); + MenuPrint_Centered(gOtherText_Ranking, 5, 3, 160); gBerryBlenderData->scoreIconIDs[BLENDER_SCORE_BEST] = CreateSprite(&sSpriteTemplate_821645C, 140, 52, 0); gSprites[gBerryBlenderData->scoreIconIDs[BLENDER_SCORE_BEST]].callback = SpriteCallbackDummy; diff --git a/src/cable_club.c b/src/cable_club.c index 1e1f0af07..39027fc08 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -172,7 +172,7 @@ static void sub_8082D18(u32 value) { ConvertIntToDecimalStringN(gStringVar1, value, STR_CONV_MODE_LEFT_ALIGN, 1); Menu_DrawStdWindowFrame(18, 10, 28, 13); - sub_8072BD8(gOtherText_PLink, 19, 11, 72); + MenuPrint_Centered(gOtherText_PLink, 19, 11, 72); } static void sub_8082D4C() diff --git a/src/credits.c b/src/credits.c index 1a810492b..c0c53505d 100644 --- a/src/credits.c +++ b/src/credits.c @@ -810,7 +810,7 @@ static void task_b_81441B8(u8 taskIdB) if (gTasks[taskIdB].data[TDB_CURRENT_PAGE] < PAGE_COUNT) { for (i = 0; i < 5; i++) - sub_8072BD8(gCreditsEntryPointerTable[gTasks[taskIdB].data[TDB_CURRENT_PAGE]][i]->text, 0, 9 + i * 2, 240); + MenuPrint_Centered(gCreditsEntryPointerTable[gTasks[taskIdB].data[TDB_CURRENT_PAGE]][i]->text, 0, 9 + i * 2, 240); gTasks[taskIdB].data[TDB_CURRENT_PAGE] += 1; gTasks[taskIdB].data[TDB_0] += 1; diff --git a/src/debug/nakamura_debug_menu.c b/src/debug/nakamura_debug_menu.c index 508dc048e..e6af3c58d 100644 --- a/src/debug/nakamura_debug_menu.c +++ b/src/debug/nakamura_debug_menu.c @@ -921,7 +921,7 @@ static void NakaGenderTest_PrintSpeciesGender(u8 i) if (gender == MON_MALE) Menu_PrintText(gOtherText_MaleSymbol2, 23, 2 * i + 1); else if (gender == MON_FEMALE) - Menu_PrintText(gOtherText_FemaleSymbolAndLv, 23, 2 * i + 1); + Menu_PrintText(gOtherText_FemaleSymbol2, 23, 2 * i + 1); else Menu_PrintText(sp0, 23, 2 * i + 1); } diff --git a/src/decompress.c b/src/decompress.c index 69edf01aa..d6c52439f 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -49,25 +49,25 @@ void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src) LoadSpritePalette(&dest); } -void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer) +void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer) { struct SpritePalette dest; - LZ77UnCompWram(a->data, buffer); + LZ77UnCompWram(src->data, buffer); dest.data = buffer; - dest.tag = a->tag; + dest.tag = src->tag; LoadSpritePalette(&dest); } -void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, u8 b, u8 c, void *d, void *buffer, s32 species) +void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, u8 coords, u8 y_offset, void *d, void *dest, s32 species) { if (species > SPECIES_EGG) - LZ77UnCompWram(gMonFrontPicTable[0].data, buffer); + LZ77UnCompWram(gMonFrontPicTable[0].data, dest); else - LZ77UnCompWram(src->data, buffer); + LZ77UnCompWram(src->data, dest); } -void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g) +void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 coords, u32 y_offset, u32 d, void *dest, s32 species, u32 pid) { u32 frontOrBack; @@ -77,16 +77,16 @@ void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u3 else frontOrBack = 1; // frontPic - LoadSpecialPokePic(src, b, c, d, dest, species, g, frontOrBack); + LoadSpecialPokePic(src, coords, y_offset, d, dest, species, pid, frontOrBack); } -void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g, u32 frontOrBack) +void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u32 d, void *dest, s32 species, u32 pid, u32 frontOrBack) { u8 frontOrBack8 = frontOrBack; if (species == SPECIES_UNOWN) { - u16 i = (((g & 0x3000000) >> 18) | ((g & 0x30000) >> 12) | ((g & 0x300) >> 6) | (g & 3)) % 0x1C; + u16 i = (((pid & 0x3000000) >> 18) | ((pid & 0x30000) >> 12) | ((pid & 0x300) >> 6) | (pid & 3)) % 0x1C; // The other Unowns are separate from Unown A. if (i == 0) @@ -104,7 +104,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, u32 b, u32 c, u else LZ77UnCompWram(src->data, dest); - DrawSpindaSpots(species, g, dest, frontOrBack8); + DrawSpindaSpots(species, pid, dest, frontOrBack8); } void Unused_LZDecompressWramIndirect(const void **src, void *dest) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index a973b80ca..ffdf926f5 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -100,12 +100,12 @@ static bool8 CheckStandardWildEncounter(u16); static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct MapPosition *, u16, u8); static bool8 IsWarpMetatileBehavior(u16); static bool8 IsArrowWarpMetatileBehavior(u16, u8); -static s8 FindWarpEventByPosition(struct MapHeader *, struct MapPosition *); +static s8 GetWarpEventAtMapPosition(struct MapHeader *, struct MapPosition *); static void sub_8068C30(struct MapHeader *, s8, struct MapPosition *); static bool8 map_warp_consider_2_to_inside(struct MapPosition *, u16, u8); -static s8 FindWarpEventByCoordsAndId(struct MapHeader *, u16, u16, u8); +static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8); static u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8); -static struct BgEvent *FindBackgroundEventByPosition(struct MapHeader *, u16, u16, u8); +static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8); static bool8 TryStartCoordEventScript(struct MapPosition *); static bool8 TryStartWarpEventScript(struct MapPosition *, u16); static bool8 TryStartCrackedFloorHoleScript(u16); @@ -400,7 +400,7 @@ static u8 *GetInteractedEventObjectScript(struct MapPosition *position, u8 metat static u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) { - struct BgEvent *bgEvent = FindBackgroundEventByPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); + struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); if (bgEvent == NULL) return NULL; @@ -676,7 +676,7 @@ static bool8 CheckStandardWildEncounter(u16 metatileBehavior) static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct MapPosition *position, u16 metatileBehavior, u8 direction) { - s8 warpEventId = FindWarpEventByPosition(&gMapHeader, position); + s8 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (IsArrowWarpMetatileBehavior(metatileBehavior, direction) == TRUE && warpEventId != -1) { @@ -690,7 +690,7 @@ static bool8 mapheader_run_first_tag2_script_list_match_conditionally(struct Map bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileBehavior) { - s8 warpEventId = FindWarpEventByPosition(&gMapHeader, position); + s8 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE) { @@ -757,9 +757,9 @@ static bool8 IsArrowWarpMetatileBehavior(u16 metatileBehavior, u8 direction) return FALSE; } -static s8 FindWarpEventByPosition(struct MapHeader *mapHeader, struct MapPosition *position) +static s8 GetWarpEventAtMapPosition(struct MapHeader *mapHeader, struct MapPosition *position) { - return FindWarpEventByCoordsAndId(mapHeader, position->x - 7, position->y - 7, position->height); + return GetWarpEventAtPosition(mapHeader, position->x - 7, position->y - 7, position->height); } static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosition *position) @@ -768,17 +768,17 @@ static void sub_8068C30(struct MapHeader *unused, s8 warpEventId, struct MapPosi if (warpEvent->mapNum == 0x7F) { - copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->mapGroup); + copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->warpId); } else { struct MapHeader *mapHeader; - warp1_set_2(warpEvent->unk7, warpEvent->mapNum, warpEvent->mapGroup); + warp1_set_2(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId); sub_80535C4(position->x, position->y); - mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->unk7, warpEvent->mapNum); - if (mapHeader->events->warps[warpEvent->mapGroup].mapNum == 0x7F) - saved_warp2_set(mapHeader->events->warps[warpEventId].mapGroup, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, warpEventId); + mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum); + if (mapHeader->events->warps[warpEvent->warpId].mapNum == 0x7F) + saved_warp2_set(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum, warpEventId); } } @@ -795,7 +795,7 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met } if (MetatileBehavior_IsWarpDoor(metatileBehavior) == TRUE) { - warpEventId = FindWarpEventByPosition(&gMapHeader, position); + warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position); if (warpEventId != -1 && IsWarpMetatileBehavior(metatileBehavior) == TRUE) { StoreInitialPlayerAvatarState(); @@ -808,7 +808,7 @@ static bool8 map_warp_consider_2_to_inside(struct MapPosition *position, u16 met return FALSE; } -static s8 FindWarpEventByCoordsAndId(struct MapHeader *mapHeader, u16 x, u16 y, u8 warpId) +static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) { s32 i; struct WarpEvent *warpEvent = mapHeader->events->warps; @@ -818,7 +818,7 @@ static s8 FindWarpEventByCoordsAndId(struct MapHeader *mapHeader, u16 x, u16 y, { if ((u16)warpEvent->x == x && (u16)warpEvent->y == y) { - if ((u8)warpEvent->warpId == warpId || (u8)warpEvent->warpId == 0) + if (warpEvent->elevation == elevation || warpEvent->elevation == 0) return i; } } @@ -871,7 +871,7 @@ u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position) return GetCoordEventScriptAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height); } -static struct BgEvent *FindBackgroundEventByPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) +static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation) { u8 i; struct BgEvent *bgEvents = mapHeader->events->bgEvents; @@ -950,6 +950,6 @@ int SetCableClubWarp(void) GetPlayerMovementDirection(); //unnecessary GetPlayerPosition(&position); MapGridGetMetatileBehaviorAt(position.x, position.y); //unnecessary - sub_8068C30(&gMapHeader, FindWarpEventByPosition(&gMapHeader, &position), &position); + sub_8068C30(&gMapHeader, GetWarpEventAtMapPosition(&gMapHeader, &position), &position); return 0; } diff --git a/src/field_region_map.c b/src/field_region_map.c index a90b8ed6a..10d5a4a5e 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -55,7 +55,7 @@ void CB2_FieldInitRegionMap(void) Menu_EraseScreen(); REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256; Menu_DrawStdWindowFrame(21, 0, 29, 3); - sub_8072BD8(gOtherText_Hoenn, 0x16, 1, 0x38); + MenuPrint_Centered(gOtherText_Hoenn, 0x16, 1, 0x38); Menu_DrawStdWindowFrame(16, 16, 29, 19); sub_813F0C8(); SetMainCallback2(CB2_FieldRegionMap); diff --git a/src/field_specials.c b/src/field_specials.c index f7b14dad8..e8c83b376 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1089,8 +1089,8 @@ static void sub_810E874(void) void DisplayCurrentElevatorFloor(void) { Menu_DrawStdWindowFrame(20, 0, 29, 5); - sub_8072BD8(gOtherText_NowOn, 21, 1, 64); - sub_8072BD8(gUnknown_083F8380[gSpecialVar_0x8005], 21, 3, 64); + MenuPrint_Centered(gOtherText_NowOn, 21, 1, 64); + MenuPrint_Centered(gUnknown_083F8380[gSpecialVar_0x8005], 21, 3, 64); } void sub_810E984(u8 taskId) diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 2536f4898..5ee025eeb 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -1047,7 +1047,7 @@ static void sub_814302C(u8 taskID) static void sub_8143068(u8 a0, u8 a1) { - sub_8072BD8(gMenuText_WelcomeToHOFAndDexRating, 0, a1 + 1, 0xF0); + MenuPrint_Centered(gMenuText_WelcomeToHOFAndDexRating, 0, a1 + 1, 0xF0); } static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 a1, u8 a2) diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 49a470cc1..102254f22 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -103,5 +103,5 @@ void DrawMapNamePopup(void) Menu_LoadStdFrameGraphicsOverrideStyle(0); GetMapSectionName(name, gMapHeader.regionMapSectionId, 0); Menu_DrawStdWindowFrame(0, 0, 13, 3); - sub_8072BD8(name, 1, 1, 0x60); + MenuPrint_Centered(name, 1, 1, 0x60); } diff --git a/src/menu.c b/src/menu.c index 891644750..d50fb4f22 100644 --- a/src/menu.c +++ b/src/menu.c @@ -728,22 +728,22 @@ _08072B3E:\n\ } #endif -void MenuPrint_RightAligned(const u8 *str, u8 left, u8 top) +void MenuPrint_RightAligned(const u8 *str, u8 right, u8 top) { - Text_InitWindow8004D38(gMenuWindowPtr, str, gMenuTextTileOffset, left, top); + Text_InitWindow_RightAligned(gMenuWindowPtr, str, gMenuTextTileOffset, right, top); } -void sub_8072B80(const u8 *src, u8 a2, u8 a3, const u8 *a4) +void sub_8072B80(const u8 *src, u8 a2, u8 a3, const u8 *text) { u8 buffer[64]; - u8 width = GetStringWidth(gMenuWindowPtr, a4); + u8 width = GetStringWidth(gMenuWindowPtr, text); AlignString(gMenuWindowPtr, buffer, src, width, 1); Text_InitWindowAndPrintText(gMenuWindowPtr, buffer, gMenuTextTileOffset, a2, a3); } -void sub_8072BD8(const u8 *a1, u8 a2, u8 a3, u16 a4) +void MenuPrint_Centered(const u8 *text, u8 left, u8 top, u16 width) { - Text_InitWindow8004DB0(gMenuWindowPtr, a1, gMenuTextTileOffset, a2, a3, a4); + Text_InitWindow_Centered(gMenuWindowPtr, text, gMenuTextTileOffset, left, top, width); } u8 *AlignInt1InMenuWindow(u8 *dest, s32 value, u8 alignAmount, u8 alignType) diff --git a/src/money.c b/src/money.c index 12a8b71ff..53800f854 100644 --- a/src/money.c +++ b/src/money.c @@ -154,7 +154,7 @@ void PrintMoneyAmount(u32 amount, u8 size, u8 x, u8 y) } } -void sub_80B7AEC(u32 arg0, u8 left, u8 top) +void sub_80B7AEC(u32 arg0, u8 right, u8 top) { u8 buffer[32]; u8 *ptr; @@ -166,7 +166,7 @@ void sub_80B7AEC(u32 arg0, u8 left, u8 top) ptr = ConvertIntToDecimalString(ptr, arg0); - MenuPrint_RightAligned(buffer, left, top); + MenuPrint_RightAligned(buffer, right, top); #ifdef ENGLISH ptr[0] = 0xFC; diff --git a/src/pokeblock.c b/src/pokeblock.c index a24cb32cf..03939556c 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -462,7 +462,7 @@ void debug_sub_8120F98(void) static void sub_810BB0C(void) { BasicInitMenuWindow(&gWindowTemplate_81E6E34); - sub_8072BD8(ItemId_GetName(ITEM_POKEBLOCK_CASE), 2, 1, 0x48); + MenuPrint_Centered(ItemId_GetName(ITEM_POKEBLOCK_CASE), 2, 1, 0x48); } static void sub_810BB30(void) diff --git a/src/pokedex.c b/src/pokedex.c index 729f72a7c..eb4d1d918 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -3367,7 +3367,7 @@ static void Task_InitSizeScreenMultistep(u8 taskId) string[0] = EOS; StringAppend(string, gDexText_SizeComparedTo); StringAppend(string, gSaveBlock2.playerName); - sub_8072BD8(string, 3, 15, 0xC0); + MenuPrint_Centered(string, 3, 15, 0xC0); gMain.state++; } break; @@ -3815,7 +3815,7 @@ static void sub_8090750(u8 taskId) gTasks[taskId].data[0]++; break; case 3: - sub_8072BD8(gDexText_RegisterComplete, 2, 0, 0xD0); + MenuPrint_Centered(gDexText_RegisterComplete, 2, 0, 0xD0); if (!IsNationalPokedexEnabled()) sub_8091154(NationalToHoennOrder(dexNum), 13, 3); else diff --git a/src/pokemon_1.c b/src/pokemon_1.c index 0622ec614..4f5094024 100644 --- a/src/pokemon_1.c +++ b/src/pokemon_1.c @@ -13,12 +13,7 @@ #include "trainer.h" #include "text.h" #include "ewram.h" - -//Extracts the upper 16 bits of a 32-bit number -#define HIHALF(n) (((n) & 0xFFFF0000) >> 16) - -//Extracts the lower 16 bits of a 32-bit number -#define LOHALF(n) ((n) & 0xFFFF) +#include "util.h" extern u16 gMoveToLearn; diff --git a/src/pokemon_2.c b/src/pokemon_2.c index 9c60ea108..1720159a2 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -44,8 +44,8 @@ extern const struct SpriteTemplate gSpriteTemplate_8208288[]; extern u8 gTrainerClassToPicIndex[]; extern u8 gTrainerClassToNameIndex[]; -extern const u8 gUnknown_08208238[]; -extern const u8 gUnknown_0820823C[]; +extern const u8 gPPUpReadMasks[]; +extern const u8 gPPUpWriteMasks[]; extern void sub_80105A0(struct Sprite *); extern void oac_poke_opponent(struct Sprite *); @@ -1169,19 +1169,19 @@ void GetSpeciesName(u8 *name, u16 species) u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex) { u8 basePP = gBattleMoves[move].pp; - return basePP + ((basePP * 20 * ((gUnknown_08208238[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); + return basePP + ((basePP * 20 * ((gPPUpReadMasks[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); } void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex) { u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); - ppBonuses &= gUnknown_0820823C[moveIndex]; + ppBonuses &= gPPUpWriteMasks[moveIndex]; SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); } void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) { - mon->ppBonuses &= gUnknown_0820823C[moveIndex]; + mon->ppBonuses &= gPPUpWriteMasks[moveIndex]; } void CopyPlayerPartyMonToBattleData(u8 battleIndex, u8 partyIndex) diff --git a/src/pokemon_item_effect.c b/src/pokemon_item_effect.c index d26546f02..59b216af0 100644 --- a/src/pokemon_item_effect.c +++ b/src/pokemon_item_effect.c @@ -35,9 +35,9 @@ static const u8 sGetMonDataEVConstants[] = MON_DATA_SPATK_EV }; -extern u8 gUnknown_08208238[]; -extern u8 gUnknown_0820823C[]; -extern u8 gUnknown_08208240[]; +extern u8 gPPUpReadMasks[]; +extern u8 gPPUpWriteMasks[]; +extern u8 gPPUpValues[]; bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 moveIndex, u8 e); @@ -221,11 +221,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 mo if (r10 & 0x20) { r10 &= ~0x20; - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_08208238[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpReadMasks[moveIndex]) >> (moveIndex * 2); sp28 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); - if (data <= 2 && sp28 > 4) + if (data < 3 && sp28 > 4) { - data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gUnknown_08208240[moveIndex]; + data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gPPUpValues[moveIndex]; SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - sp28; @@ -450,13 +450,13 @@ bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 mo } break; case 4: - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_08208238[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpReadMasks[moveIndex]) >> (moveIndex * 2); if (data < 3) { r4 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL); - data &= gUnknown_0820823C[moveIndex]; - data += gUnknown_08208240[moveIndex] * 3; + data &= gPPUpWriteMasks[moveIndex]; + data += gPPUpValues[moveIndex] * 3; SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - r4; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 770b69813..971d7daf7 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -734,7 +734,7 @@ void sub_809665C(void) u8 *stringVar = gStringVar1; stringVar[0] = EXT_CTRL_CODE_BEGIN; - stringVar[1] = 0x04; // EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW + stringVar[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW; stringVar[2] = 0x0F; // TEXT_COLOR_WHITE2 stringVar[3] = 0x01; // TEXT_COLOR_DARK_GREY stringVar[4] = 0x0E; // TEXT_COLOR_LIGHT_BLUE @@ -744,7 +744,7 @@ void sub_809665C(void) stringVar[0] = CHAR_NEWLINE; stringVar[1] = EXT_CTRL_CODE_BEGIN; - stringVar[2] = 0x11; // EXT_CTRL_CODE_CLEAR + stringVar[2] = EXT_CTRL_CODE_CLEAR; if (nPokemonInBox < 10) stringVar[3] = 0x28; else diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index aabacbe2f..2fd7cb1ca 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3,6 +3,7 @@ #include "constants/songs.h" #include "constants/species.h" #include "battle.h" +#include "battle_anim_813F0F4.h" #include "contest.h" #include "data2.h" #include "decompress.h" @@ -32,8 +33,8 @@ #include "scanline_effect.h" #include "daycare.h" -static void sub_809FC0C(void); -static void sub_809FEB8(void); +static void SummaryScreen_PrintPokemonInfoLabels(void); +static void SummaryScreen_PrintPokemonSkillsLabels(void); static void sub_809F63C(struct Pokemon *); static void sub_809F650(struct Pokemon *); static void sub_809F664(struct Pokemon *); @@ -43,7 +44,7 @@ static void sub_80A015C(struct Pokemon *); static void sub_809DE44(void); static void sub_809EB40(u8); static void sub_809EBC4(void); -static void sub_809E044(void); +static void SummaryScreen_LoadPalettes(void); static void sub_80A1D84(struct Pokemon *); static void sub_80A18C4(void); static bool8 LoadPokemonSummaryScreenGraphics(void); @@ -53,29 +54,29 @@ static void sub_80A1DCC(struct Pokemon *); static void sub_809FE80(void); static void sub_80A00A4(void); static void sub_80A0390(void); -extern u8 sub_80A1808(struct Pokemon *); -static void sub_80A1F98(s32, u8, u8, u8, u8, u16, s32); +extern u8 SummaryScreen_CreatePokemonSprite(struct Pokemon *); +static void SummaryScreen_PrintColoredIntPixelCoords(s32, u8, u8, u8, u8, u16, s32); static void sub_80A0958(struct Pokemon *); static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *, u8, u8); static void PokemonSummaryScreen_PrintEggTrainerMemo(struct Pokemon *, u8, u8); -static void sub_80A1EF8(const u8 *, u8, u8, u16, s32); -static void sub_80A1F48(const u8 *, u8, u8, u8, u16); +static void SummaryScreen_PrintColoredTextPixelCoords(const u8 *, u8, u8, u16, s32); +static void SummaryScreen_PrintColoredTextCentered(const u8 *, u8, u8, u8, u16); static void PrintHeldItemName(u16, u8, u8); static void PrintNumRibbons(struct Pokemon *); static void DrawExperienceProgressBar(struct Pokemon *, u8, u8); -static void sub_809E13C(u8 taskId); +static void SummaryScreen_DestroyTask(u8 taskId); static void sub_80A1950(void); static void sub_809DE64(void); static void SummaryScreenHandleAButton(u8); static void SummaryScreenHandleUpDownInput(u8, s8); -static bool8 sub_809F7D0(u8); +static bool8 SummaryScreen_CanForgetSelectedMove(u8); static void sub_809F9D0(u8, u8); -static void sub_809EAC8(u8); +static void SummaryScreen_MoveSelect_Cancel(u8); static void sub_809E534(u8); static void sub_809E83C(u8, s8); static void sub_80A1B40(u8); static void sub_80A2078(int); -static void sub_809E3FC(u8); +static void SummaryScreen_MoveSelect_HandleInput(u8); static void SummaryScreenHandleKeyInput(u8); static void sub_80A1B1C(u8); static void sub_80A16CC(u8); @@ -91,7 +92,7 @@ extern s8 sub_809F284(s8); extern s8 sub_809F3CC(s8); static bool8 sub_809F5F8(void); static void sub_80A1DE8(struct Pokemon *); -static u8 sub_809F6B4(struct Pokemon *, u8 *); +static u8 SummaryScreen_LoadPokemonSprite(struct Pokemon *, u8 *); static void DrawPokerusSurvivorDot(struct Pokemon *); static void sub_80A12D0(s8); static void sub_809FAC8(struct Pokemon *); @@ -99,30 +100,30 @@ static void SummaryScreenHandleLeftRightInput(u8, s8); static void sub_809E8F0(); static void sub_80A1654(s8, u8); static void sub_80A1488(s8, u8); -static void sub_809FC34(struct Pokemon *); -static void sub_809FF64(struct Pokemon *); +static void SummaryScreen_PrintPokemonInfo(struct Pokemon *); +static void SummaryScreen_PrintPokemonSkills(struct Pokemon *); static void sub_80A1918(u8, u8); -static void sub_80A198C(u8, u8, u8, u8); +static void SummaryScreen_DrawTypeIcon(u8, u8, u8, u8); static u16 GetMonMove(struct Pokemon *, u8); static void sub_80A04CC(u16); static void sub_80A057C(u16); static void sub_80A0498(u16); static void sub_80A046C(u16); static void sub_80A20A8(u8); -static void sub_809F678(struct Pokemon *); +static void SummaryScreen_GetPokemon(struct Pokemon *); static void sub_80A1BC0(struct Sprite *sprite); -static void sub_80A1888(struct Sprite *); +static void SummaryScreen_SpritePlayCry(struct Sprite *); static void sub_80A0428(struct Pokemon *, u8 *); static void sub_80A18E4(u8); -static u8 *sub_80A1E58(u8 *, u8); +static u8 *SummaryScreen_SetTextColor(u8 *, u8); +static u8 *SummaryScreen_CopyColoredString(u8 *, const u8 *, u8); static void sub_80A0A2C(struct Pokemon *, u8, u8); -static void sub_80A1FF8(const u8 *, u8, u8, u8); +static void SummaryScreen_PrintColoredText(const u8 *, u8, u8, u8); -extern u8 ball_number_to_ball_processing_index(u16); extern u8 StorageSystemGetNextMonIndex(struct BoxPokemon *, u8, u8, u8); extern struct MusicPlayerInfo gMPlay_BGM; -extern u8 gUnknown_08208238[]; +extern u8 gPPUpReadMasks[]; extern TaskFunc gUnknown_03005CF0; extern struct SpriteTemplate gUnknown_02024E8C; @@ -196,120 +197,29 @@ static const struct OamData sOamData_83C109C = { .affineParam = 0, }; -static const union AnimCmd sSpriteAnim_83C10A4[] = { - ANIMCMD_FRAME(0, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10AC[] = { - ANIMCMD_FRAME(8, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10B4[] = { - ANIMCMD_FRAME(16, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10BC[] = { - ANIMCMD_FRAME(24, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10C4[] = { - ANIMCMD_FRAME(32, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10CC[] = { - ANIMCMD_FRAME(40, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10D4[] = { - ANIMCMD_FRAME(48, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10DC[] = { - ANIMCMD_FRAME(56, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10E4[] = { - ANIMCMD_FRAME(64, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10EC[] = { - ANIMCMD_FRAME(72, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10F4[] = { - ANIMCMD_FRAME(80, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C10FC[] = { - ANIMCMD_FRAME(88, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1104[] = { - ANIMCMD_FRAME(96, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C110C[] = { - ANIMCMD_FRAME(104, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1114[] = { - ANIMCMD_FRAME(112, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C111C[] = { - ANIMCMD_FRAME(120, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1124[] = { - ANIMCMD_FRAME(128, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C112C[] = { - ANIMCMD_FRAME(136, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1134[] = { - ANIMCMD_FRAME(144, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C113C[] = { - ANIMCMD_FRAME(152, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1144[] = { - ANIMCMD_FRAME(160, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C114C[] = { - ANIMCMD_FRAME(168, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1154[] = { - ANIMCMD_FRAME(176, 0), - ANIMCMD_END, -}; +static const union AnimCmd sSpriteAnim_83C10A4[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10AC[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10B4[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10BC[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10C4[] = { ANIMCMD_FRAME(32, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10CC[] = { ANIMCMD_FRAME(40, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10D4[] = { ANIMCMD_FRAME(48, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10DC[] = { ANIMCMD_FRAME(56, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10E4[] = { ANIMCMD_FRAME(64, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10EC[] = { ANIMCMD_FRAME(72, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10F4[] = { ANIMCMD_FRAME(80, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C10FC[] = { ANIMCMD_FRAME(88, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1104[] = { ANIMCMD_FRAME(96, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C110C[] = { ANIMCMD_FRAME(104, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1114[] = { ANIMCMD_FRAME(112, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C111C[] = { ANIMCMD_FRAME(120, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1124[] = { ANIMCMD_FRAME(128, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C112C[] = { ANIMCMD_FRAME(136, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1134[] = { ANIMCMD_FRAME(144, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C113C[] = { ANIMCMD_FRAME(152, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1144[] = { ANIMCMD_FRAME(160, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C114C[] = { ANIMCMD_FRAME(168, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1154[] = { ANIMCMD_FRAME(176, 0), ANIMCMD_END, }; static const union AnimCmd *const sSpriteAnimTable_83C115C[] = { sSpriteAnim_83C10A4, @@ -367,55 +277,16 @@ static const struct OamData sOamData_83C11F0 = { .affineParam = 0, }; -static const union AnimCmd sSpriteAnim_83C11F8[] = { - ANIMCMD_FRAME(0, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1200[] = { - ANIMCMD_FRAME(4, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1208[] = { - ANIMCMD_FRAME(8, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1210[] = { - ANIMCMD_FRAME(12, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1218[] = { - ANIMCMD_FRAME(16, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1220[] = { - ANIMCMD_FRAME(16, 0, .hFlip = TRUE), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1228[] = { - ANIMCMD_FRAME(20, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1230[] = { - ANIMCMD_FRAME(24, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1238[] = { - ANIMCMD_FRAME(24, 0, .hFlip = TRUE), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C1240[] = { - ANIMCMD_FRAME(28, 0), - ANIMCMD_END, -}; +static const union AnimCmd sSpriteAnim_83C11F8[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1200[] = { ANIMCMD_FRAME(4, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1208[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1210[] = { ANIMCMD_FRAME(12, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1218[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1220[] = { ANIMCMD_FRAME(16, 0, .hFlip = TRUE), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1228[] = { ANIMCMD_FRAME(20, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1230[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1238[] = { ANIMCMD_FRAME(24, 0, .hFlip = TRUE), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C1240[] = { ANIMCMD_FRAME(28, 0), ANIMCMD_END, }; static const union AnimCmd *const sSpriteAnimTable_83C1248[] = { sSpriteAnim_83C11F8, @@ -459,40 +330,13 @@ static const struct OamData sOamData_83C1298 = { .affineParam = 0, }; -static const union AnimCmd sSpriteAnim_83C12A0[] = { - ANIMCMD_FRAME(0, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12A8[] = { - ANIMCMD_FRAME(4, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12B0[] = { - ANIMCMD_FRAME(8, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12B8[] = { - ANIMCMD_FRAME(12, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12C0[] = { - ANIMCMD_FRAME(16, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12C8[] = { - ANIMCMD_FRAME(20, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sSpriteAnim_83C12D0[] = { - ANIMCMD_FRAME(24, 0), - ANIMCMD_END, -}; +static const union AnimCmd sSpriteAnim_83C12A0[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12A8[] = { ANIMCMD_FRAME(4, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12B0[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12B8[] = { ANIMCMD_FRAME(12, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12C0[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12C8[] = { ANIMCMD_FRAME(20, 0), ANIMCMD_END, }; +static const union AnimCmd sSpriteAnim_83C12D0[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, }; static const union AnimCmd *const sSpriteAnimTable_83C12D8[] = { sSpriteAnim_83C12A0, @@ -531,8 +375,8 @@ static const u16 sUnknown_083C157C[] = { RGB(26, 26, 23) }; static const u16 sUnknown_083C157E[] = { RGB(30, 30, 27) }; static void (*const sUnknown_083C1580[])(void) = { - sub_809FC0C, - sub_809FEB8, + SummaryScreen_PrintPokemonInfoLabels, + SummaryScreen_PrintPokemonSkillsLabels, }; static void (*const sUnknown_083C1588[])(struct Pokemon *) = { @@ -554,16 +398,23 @@ static const u8 sDoubleBattlePartyOrder[] = { 0, 2, 3, 1, 4, 5 }; static const u8 sUnknown_083C15AE[] = _("{STR_VAR_1}{CLEAR_TO 64}"); static const u8 sUnknown_083C15B4[] = _("{STR_VAR_1}{CLEAR_TO 72}"); -asm(".align 2"); // TODO: this array is probably not correctly-typed -static const u8 sUnknown_083C15BC[] = { - 9, 1, 0, 2, - 10, 3, 0, 4, - 8, 5, 0, 6, - 11, 7, 0, 8, - 14, 9, 0, 10, - 12, 11, 0, 12, - 13, 13, 0, 14, - -1, 15, 0, 10, +struct TextColors { + u8 id; + u8 color; + u8 background; + u8 shadow; +}; + +// The TEXT_COLOR constants don't apply. Refer to the palette for this screen. +static const struct TextColors sSummaryScreenTextColors[] = { + { 9, 1, 0, 2 }, // blue + { 10, 3, 0, 4 }, // pink + { 8, 5, 0, 6 }, // yellow + { 11, 7, 0, 8 }, // blue2 + { 14, 9, 0, 10 }, // red + { 12, 11, 0, 12 }, // pink2 + { 13, 13, 0, 14 }, // white + { -1, 15, 0, 10 }, // black }; void sub_809D844(void) @@ -677,7 +528,7 @@ void sub_809DA1C(void) break; case PSS_MODE_MOVES_ONLY: case PSS_MODE_PC_MOVES_ONLY: - pssData.inputHandlingTaskId = CreateTask(sub_809E3FC, 0); + pssData.inputHandlingTaskId = CreateTask(SummaryScreen_MoveSelect_HandleInput, 0); break; } } @@ -741,7 +592,7 @@ bool8 sub_809DA84(void) gMain.state++; break; case 12: - sub_809F678(&pssData.loadedMon); + SummaryScreen_GetPokemon(&pssData.loadedMon); if (!GetMonStatusAndPokerus(&pssData.loadedMon)) sub_80A12D0(0); else @@ -760,14 +611,14 @@ bool8 sub_809DA84(void) gMain.state++; break; case 15: - if ((pssData.monSpriteId = sub_809F6B4(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) + if ((pssData.monSpriteId = SummaryScreen_LoadPokemonSprite(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) { pssData.loadGfxState = 0; gMain.state++; } break; case 16: - sub_809E044(); + SummaryScreen_LoadPalettes(); DrawSummaryScreenNavigationDots(); gMain.state++; break; @@ -908,7 +759,7 @@ static bool8 LoadPokemonSummaryScreenGraphics(void) return FALSE; } -static void sub_809E044(void) +static void SummaryScreen_LoadPalettes(void) { LoadPalette(gUnknownPalette_81E6692 + 14, 129, 2); LoadPalette(gUnknownPalette_81E6692 + 15, 136, 2); @@ -931,10 +782,10 @@ static void SummaryScreenExit(u8 taskId) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); - gTasks[taskId].func = sub_809E13C; + gTasks[taskId].func = SummaryScreen_DestroyTask; } -static void sub_809E13C(u8 taskId) +static void SummaryScreen_DestroyTask(u8 taskId) { if (sub_8055870() != TRUE && !gPaletteFade.active) { @@ -1015,7 +866,7 @@ static void sub_809E260(u8 taskId) } else if (gMain.newKeys & A_BUTTON) { - if (sub_809F7D0(taskId) == TRUE || pssData.selectedMoveIndex == 4) + if (SummaryScreen_CanForgetSelectedMove(taskId) == TRUE || pssData.selectedMoveIndex == 4) { pssData.switchMoveIndex = pssData.selectedMoveIndex; gSpecialVar_0x8005 = pssData.switchMoveIndex; @@ -1030,12 +881,12 @@ static void sub_809E260(u8 taskId) else if (gMain.newKeys & B_BUTTON) { pssData.switchMoveIndex = 4; - gSpecialVar_0x8005 = 4; + gSpecialVar_0x8005 = pssData.switchMoveIndex; SummaryScreenExit(taskId); } } -static void sub_809E3FC(u8 taskId) +static void SummaryScreen_MoveSelect_HandleInput(u8 taskId) { if (gPaletteFade.active) return; @@ -1072,13 +923,13 @@ static void sub_809E3FC(u8 taskId) else { PlaySE(SE_SELECT); - sub_809EAC8(taskId); + SummaryScreen_MoveSelect_Cancel(taskId); } } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); - sub_809EAC8(taskId); + SummaryScreen_MoveSelect_Cancel(taskId); } } @@ -1118,7 +969,7 @@ static void sub_809E534(u8 taskId) } } -static void sub_809E5C4(void) +static void SummaryScreen_SwapMoves_Party(void) { struct Pokemon *party = pssData.monList.partyMons; struct Pokemon *pkmn = &party[pssData.monIndex]; @@ -1131,10 +982,10 @@ static void sub_809E5C4(void) u8 move2pp = GetMonData(pkmn, MON_DATA_PP1 + moveIndex2); u8 ppBonuses = GetMonData(pkmn, MON_DATA_PP_BONUSES); - // Calculate PP bonuses - u8 r9 = gUnknown_08208238[moveIndex1]; + // Swap PP bonuses + u8 r9 = gPPUpReadMasks[moveIndex1]; u8 r2 = (ppBonuses & r9) >> (moveIndex1 * 2); - u8 r3 = gUnknown_08208238[moveIndex2]; + u8 r3 = gPPUpReadMasks[moveIndex2]; u8 r1 = (ppBonuses & r3) >> (moveIndex2 * 2); ppBonuses &= ~r9; ppBonuses &= ~r3; @@ -1148,7 +999,7 @@ static void sub_809E5C4(void) SetMonData(pkmn, MON_DATA_PP_BONUSES, &ppBonuses); } -static void sub_809E6D8(void) +static void SummaryScreen_SwapMoves_Box(void) { struct BoxPokemon *boxMons = pssData.monList.boxMons; struct BoxPokemon *pkmn = &boxMons[pssData.monIndex]; @@ -1161,10 +1012,10 @@ static void sub_809E6D8(void) u8 move2pp = GetBoxMonData(pkmn, MON_DATA_PP1 + moveIndex2); u8 ppBonuses = GetBoxMonData(pkmn, MON_DATA_PP_BONUSES); - // Calculate PP bonuses - u8 r9 = gUnknown_08208238[moveIndex1]; + // Swap PP bonuses + u8 r9 = gPPUpReadMasks[moveIndex1]; u8 r2 = (ppBonuses & r9) >> (moveIndex1 * 2); - u8 r3 = gUnknown_08208238[moveIndex2]; + u8 r3 = gPPUpReadMasks[moveIndex2]; u8 r1 = (ppBonuses & r3) >> (moveIndex2 * 2); ppBonuses &= ~r9; ppBonuses &= ~r3; @@ -1184,7 +1035,7 @@ void sub_809E7F0(u8 taskId) { pssData.loadGfxState = 0; sub_80A0428(&pssData.loadedMon, &pssData.selectedMoveIndex); - gTasks[taskId].func = sub_809E3FC; + gTasks[taskId].func = SummaryScreen_MoveSelect_HandleInput; sub_80A2078(taskId); } } @@ -1201,12 +1052,12 @@ static void sub_809E83C(u8 taskId, s8 b) if (pssData.selectedMoveIndex != pssData.switchMoveIndex) { if (pssData.usingPC == FALSE) - sub_809E5C4(); + SummaryScreen_SwapMoves_Party(); else - sub_809E6D8(); + SummaryScreen_SwapMoves_Box(); pssData.selectedMoveIndex = pssData.switchMoveIndex; - sub_809F678(&pssData.loadedMon); + SummaryScreen_GetPokemon(&pssData.loadedMon); pssData.loadGfxState = 1; gTasks[taskId].func = sub_809E7F0; @@ -1218,7 +1069,7 @@ static void sub_809E83C(u8 taskId, s8 b) sub_80A0428(&pssData.loadedMon, &pssData.selectedMoveIndex); } - gTasks[taskId].func = sub_809E3FC; + gTasks[taskId].func = SummaryScreen_MoveSelect_HandleInput; sub_80A2078(taskId); } @@ -1420,11 +1271,11 @@ static void SummaryScreenHandleAButton(u8 taskId) sub_80A029C(&pssData.loadedMon); sub_80A1A30(9); - gTasks[taskId].func = sub_809E3FC; + gTasks[taskId].func = SummaryScreen_MoveSelect_HandleInput; sub_80A2078(taskId); } -static void sub_809EAC8(u8 taskId) +static void SummaryScreen_MoveSelect_Cancel(u8 taskId) { if (pssData.selectedMoveIndex != 4) { @@ -2055,14 +1906,14 @@ void sub_809F43C(u8 taskId) gMain.state++; break; case 4: - sub_809F678(&pssData.loadedMon); + SummaryScreen_GetPokemon(&pssData.loadedMon); if (GetMonStatusAndPokerus(&pssData.loadedMon)) sub_80A12D0(2); DrawPokerusSurvivorDot(&pssData.loadedMon); gMain.state++; break; case 5: - if ((pssData.monSpriteId = sub_809F6B4(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) + if ((pssData.monSpriteId = SummaryScreen_LoadPokemonSprite(&pssData.loadedMon, &pssData.loadGfxState)) != 0xFF) { pssData.loadGfxState = 0; if (GetMonData(&pssData.loadedMon, MON_DATA_IS_EGG)) @@ -2115,13 +1966,13 @@ static bool8 sub_809F5F8(void) static void sub_809F63C(struct Pokemon *mon) { sub_809FE80(); - sub_809FC34(mon); + SummaryScreen_PrintPokemonInfo(mon); } static void sub_809F650(struct Pokemon *mon) { sub_80A00A4(); - sub_809FF64(mon); + SummaryScreen_PrintPokemonSkills(mon); } static void sub_809F664(struct Pokemon *mon) @@ -2130,9 +1981,9 @@ static void sub_809F664(struct Pokemon *mon) sub_80A015C(mon); } -static void sub_809F678(struct Pokemon *mon) +static void SummaryScreen_GetPokemon(struct Pokemon *mon) { - if (pssData.usingPC == FALSE) + if (!pssData.usingPC) { struct Pokemon *mons = pssData.monList.partyMons; *mon = mons[pssData.monIndex]; @@ -2144,17 +1995,17 @@ static void sub_809F678(struct Pokemon *mon) } } -static u8 sub_809F6B4(struct Pokemon *mon, u8 *b) +static u8 SummaryScreen_LoadPokemonSprite(struct Pokemon *mon, u8 *state) { u16 species; u32 personality; u32 otId; const struct CompressedSpritePalette *palette; - switch (*b) + switch (*state) { default: - return sub_80A1808(mon); + return SummaryScreen_CreatePokemonSprite(mon); case 0: species = GetMonData(mon, MON_DATA_SPECIES2); personality = GetMonData(mon, MON_DATA_PERSONALITY); @@ -2167,7 +2018,7 @@ static u8 sub_809F6B4(struct Pokemon *mon, u8 *b) gUnknown_081FAF4C[1], species, personality); - *b += 1; + *state += 1; return 0xFF; case 1: species = GetMonData(mon, MON_DATA_SPECIES2); @@ -2177,7 +2028,7 @@ static u8 sub_809F6B4(struct Pokemon *mon, u8 *b) palette = GetMonSpritePalStructFromOtIdPersonality(species, otId, personality); LoadCompressedObjectPalette(palette); GetMonSpriteTemplate_803C56C(palette->tag, 1); - *b += 1; + *state += 1; return 0xFF; } } @@ -2212,12 +2063,12 @@ static u16 GetMonMovePP(struct Pokemon *mon, u8 moveId) } } -static bool8 sub_809F7D0(u8 taskId) +static bool8 SummaryScreen_CanForgetSelectedMove(u8 taskId) { struct Pokemon mon; u16 move; - sub_809F678(&mon); + SummaryScreen_GetPokemon(&mon); move = GetMonMove(&mon, pssData.selectedMoveIndex); if (IsHMMove(move) == TRUE && pssData.mode != PSS_MODE_UNKNOWN) return FALSE; @@ -2285,11 +2136,11 @@ void sub_809F814(u8 taskId) } } -static void sub_809F9D0(u8 taskId, u8 b) +static void sub_809F9D0(u8 taskId, u8 moveIndex) { s16 *taskData = gTasks[taskId].data; taskData[14] = 0; - taskData[15] = b; + taskData[15] = moveIndex; sub_80A1488(-2, 4); sub_80A1654(-2, 4); @@ -2304,51 +2155,16 @@ u8 sub_809FA30(void) return pssData.switchMoveIndex; } -// void GetStringCenterAlignXOffsetWithLetterSpacing(u8 a, u8 b, u8 c, u8 d) -// { -// u16 *vramAddr = (u16 *)(VRAM + 0xF000); - -// vramAddr[(d * 32) + c] = (b * 0x1000) + (a * 2) + 0x200 + 0x80; -// vramAddr[(d * 32) + c + 32] = (b * 0x1000) + (a * 2) + 0x200 + 0x81; -// } -NAKED -void GetStringCenterAlignXOffsetWithLetterSpacing(u8 a, u8 b, u8 c, u8 d) +static void SummaryScreen_PlaceTextTile(u8 tile, u8 palette, u8 x, u8 y) { - asm(".syntax unified\n\ - push {r4,lr}\n\ - lsls r0, 24\n\ - lsls r1, 24\n\ - lsls r2, 24\n\ - lsls r3, 24\n\ - lsrs r2, 23\n\ - lsrs r3, 18\n\ - ldr r4, _0809FA70 @ =0x0600f000\n\ - adds r3, r4\n\ - adds r2, r3\n\ - lsrs r1, 12\n\ - lsrs r0, 23\n\ - movs r4, 0x80\n\ - lsls r4, 2\n\ - adds r3, r4, 0\n\ - adds r0, r3\n\ - adds r1, r0\n\ - adds r0, r1, 0\n\ - adds r0, 0x80\n\ - strh r0, [r2]\n\ - adds r2, 0x40\n\ - adds r1, 0x81\n\ - strh r1, [r2]\n\ - pop {r4}\n\ - pop {r0}\n\ - bx r0\n\ - .align 2, 0\n\ -_0809FA70: .4byte 0x0600f000\n\ - .syntax divided\n"); + u16 *vramAddr = (u16 *)(VRAM + 0xF000) + x + y * 32; + vramAddr[0] = (palette << 12) + 0x200 + tile * 2 + 0x80; + vramAddr[32] = (palette << 12) + 0x200 + tile * 2 + 0x81; } -void GetStringCenterAlignXOffset(u8 a, u8 b, u8 c) +static void SummaryScreen_PlaceTextTile_White(u8 tile, u8 x, u8 y) { - GetStringCenterAlignXOffsetWithLetterSpacing(a, 15, b, c); + SummaryScreen_PlaceTextTile(tile, 15, x, y); } bool8 sub_809FA94(struct Pokemon *mon) @@ -2367,7 +2183,7 @@ bool8 sub_809FA94(struct Pokemon *mon) static void sub_809FAC8(struct Pokemon *mon) { - bool8 shinyDexNum; + bool8 shiny; u16 dexNum; u8 *buffer; @@ -2377,24 +2193,24 @@ static void sub_809FAC8(struct Pokemon *mon) Menu_EraseWindowRect(3, 16, 9, 17); Menu_EraseWindowRect(0, 12, 11, 15); GetMonNickname(mon, gStringVar1); - sub_80A1FF8(gStringVar1, 13, 3, 16); + SummaryScreen_PrintColoredText(gStringVar1, 13, 3, 16); LoadPalette(sUnknown_083C157C, 4, 2); } else { - shinyDexNum = sub_809FA94(mon); + shiny = sub_809FA94(mon); dexNum = SpeciesToPokedexNum(GetMonData(mon, MON_DATA_SPECIES)); if (dexNum != 0xFFFF) { - if (!shinyDexNum) + if (!shiny) { - GetStringCenterAlignXOffset(2, 1, 2); - sub_80A1F98(dexNum, 13, 3, 2, 17, 16, 1); + SummaryScreen_PlaceTextTile_White(2, 1, 2); + SummaryScreen_PrintColoredIntPixelCoords(dexNum, 13, 3, 2, 17, 16, 1); } else { - GetStringCenterAlignXOffsetWithLetterSpacing(2, 8, 1, 2); - sub_80A1F98(dexNum, 8, 3, 2, 17, 16, 1); + SummaryScreen_PlaceTextTile(2, 8, 1, 2); + SummaryScreen_PrintColoredIntPixelCoords(dexNum, 8, 3, 2, 17, 16, 1); } } else @@ -2403,7 +2219,7 @@ static void sub_809FAC8(struct Pokemon *mon) } buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = GetMonNickname(mon, buffer); buffer[0] = EXT_CTRL_CODE_BEGIN; buffer[1] = 0x13; @@ -2425,14 +2241,14 @@ static void sub_809FBE4(void) Menu_EraseWindowRect(11, 4, 29, 18); } -static void sub_809FC0C(void) +static void SummaryScreen_PrintPokemonInfoLabels(void) { Menu_PrintText(gOtherText_Type2, 11, 6); - GetStringCenterAlignXOffset(0, 22, 4); - GetStringCenterAlignXOffset(2, 23, 4); + SummaryScreen_PlaceTextTile_White(0, 22, 4); + SummaryScreen_PlaceTextTile_White(2, 23, 4); } -static void sub_809FC34(struct Pokemon *mon) +static void SummaryScreen_PrintPokemonInfo(struct Pokemon *mon) { u8 i; u8 *buffer; @@ -2448,7 +2264,7 @@ static void sub_809FC34(struct Pokemon *mon) if (GetMonData(mon, MON_DATA_IS_EGG)) { buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, gOtherText_OriginalTrainer); buffer = StringCopy(buffer, gOtherText_FiveQuestions); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -2457,15 +2273,15 @@ static void sub_809FC34(struct Pokemon *mon) buffer[3] = EOS; Menu_PrintText(gStringVar1, 11, 4); - sub_80A1EF8(gOtherText_FiveQuestions, 13, 193, 32, 1); - sub_80A198C(9, 120, 48, 0); + SummaryScreen_PrintColoredTextPixelCoords(gOtherText_FiveQuestions, 13, 193, 32, 1); + SummaryScreen_DrawTypeIcon(TYPE_MYSTERY, 120, 48, 0); friendship = GetMonData(mon, MON_DATA_FRIENDSHIP); - if (friendship < 6) + if (friendship <= 5) Menu_PrintText(gOtherText_EggAbout, 11, 9); - else if (friendship < 11) + else if (friendship <= 10) Menu_PrintText(gOtherText_EggSoon, 11, 9); - else if (friendship < 41) + else if (friendship <= 40) Menu_PrintText(gOtherText_EggSomeTime, 11, 9); else Menu_PrintText(gOtherText_EggLongTime, 11, 9); @@ -2479,13 +2295,13 @@ static void sub_809FC34(struct Pokemon *mon) ConvertInternationalString(gStringVar2, language); buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, gOtherText_OriginalTrainer); if (GetMonData(mon, MON_DATA_OT_GENDER) == MALE) - buffer = sub_80A1E58(buffer, 9); + buffer = SummaryScreen_SetTextColor(buffer, 9); else - buffer = sub_80A1E58(buffer, 10); + buffer = SummaryScreen_SetTextColor(buffer, 10); buffer = StringCopy(buffer, gStringVar2); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -2494,15 +2310,15 @@ static void sub_809FC34(struct Pokemon *mon) buffer[3] = EOS; Menu_PrintText(gStringVar1, 11, 4); - sub_80A1F98(GetMonData(mon, MON_DATA_OT_ID) & 0xFFFF, 13, 5, 2, 193, 32, 1); + SummaryScreen_PrintColoredIntPixelCoords(GetMonData(mon, MON_DATA_OT_ID) & 0xFFFF, 13, 5, 2, 193, 32, 1); species = GetMonData(mon, MON_DATA_SPECIES); - sub_80A198C(gBaseStats[species].type1, 120, 48, 0); + SummaryScreen_DrawTypeIcon(gBaseStats[species].type1, 120, 48, 0); if (gBaseStats[species].type1 != gBaseStats[species].type2) - sub_80A198C(gBaseStats[species].type2, 160, 48, 1); + SummaryScreen_DrawTypeIcon(gBaseStats[species].type2, 160, 48, 1); ability = GetAbilityBySpecies(GetMonData(mon, MON_DATA_SPECIES), GetMonData(mon, MON_DATA_ALT_ABILITY)); - sub_80A1FF8(gAbilityNames[ability], 13, 11, 9); + SummaryScreen_PrintColoredText(gAbilityNames[ability], 13, 11, 9); Menu_PrintText(gAbilityDescriptions[ability], 11, 11); PokemonSummaryScreen_PrintTrainerMemo(mon, 11, 14); @@ -2511,8 +2327,8 @@ static void sub_809FC34(struct Pokemon *mon) static void sub_809FE6C(struct Pokemon *mon) { - sub_809FC0C(); - sub_809FC34(mon); + SummaryScreen_PrintPokemonInfoLabels(); + SummaryScreen_PrintPokemonInfo(mon); } static void sub_809FE80(void) @@ -2523,21 +2339,21 @@ static void sub_809FE80(void) Menu_EraseWindowRect(11, 14, 28, 17); } -static void sub_809FEB8(void) +static void SummaryScreen_PrintPokemonSkillsLabels(void) { - sub_80A1FF8(gOtherText_ExpPoints, 13, 11, 14); - sub_80A1FF8(gOtherText_NextLv, 13, 11, 16); + SummaryScreen_PrintColoredText(gOtherText_ExpPoints, 13, 11, 14); + SummaryScreen_PrintColoredText(gOtherText_NextLv, 13, 11, 16); Menu_PrintText(gOtherText_Terminator18, 21, 16); - sub_80A1F48(gOtherText_HP, 13, 11, 7, 42); - sub_80A1F48(gOtherText_Attack, 13, 11, 9, 42); - sub_80A1F48(gOtherText_Defense, 13, 11, 11, 42); - sub_80A1F48(gOtherText_SpAtk, 13, 22, 7, 36); - sub_80A1F48(gOtherText_SpDef, 13, 22, 9, 36); - sub_80A1F48(gOtherText_Speed, 13, 22, 11, 36); + SummaryScreen_PrintColoredTextCentered(gOtherText_HP, 13, 11, 7, 42); + SummaryScreen_PrintColoredTextCentered(gOtherText_Attack, 13, 11, 9, 42); + SummaryScreen_PrintColoredTextCentered(gOtherText_Defense, 13, 11, 11, 42); + SummaryScreen_PrintColoredTextCentered(gOtherText_SpAtk, 13, 22, 7, 36); + SummaryScreen_PrintColoredTextCentered(gOtherText_SpDef, 13, 22, 9, 36); + SummaryScreen_PrintColoredTextCentered(gOtherText_Speed, 13, 22, 11, 36); } -static void sub_809FF64(struct Pokemon *mon) +static void SummaryScreen_PrintPokemonSkills(struct Pokemon *mon) { u8 i; u16 heldItem; @@ -2557,19 +2373,19 @@ static void sub_809FF64(struct Pokemon *mon) DrawExperienceProgressBar(mon, 23, 16); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_ATK)); - sub_8072BD8(buffer, 16, 9, 50); + MenuPrint_Centered(buffer, 16, 9, 50); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_DEF)); - sub_8072BD8(buffer, 16, 11, 50); + MenuPrint_Centered(buffer, 16, 11, 50); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_SPATK)); - sub_8072BD8(buffer, 27, 7, 18); + MenuPrint_Centered(buffer, 27, 7, 18); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_SPDEF)); - sub_8072BD8(buffer, 27, 9, 18); + MenuPrint_Centered(buffer, 27, 9, 18); ConvertIntToDecimalString(buffer, GetMonData(mon, MON_DATA_SPEED)); - sub_8072BD8(buffer, 27, 11, 18); + MenuPrint_Centered(buffer, 27, 11, 18); buffer = AlignInt1InMenuWindow(buffer, GetMonData(mon, MON_DATA_HP), 24, 1); *buffer++ = CHAR_SLASH; @@ -2580,8 +2396,8 @@ static void sub_809FF64(struct Pokemon *mon) static void sub_80A0090(struct Pokemon *mon) { - sub_809FEB8(); - sub_809FF64(mon); + SummaryScreen_PrintPokemonSkillsLabels(); + SummaryScreen_PrintPokemonSkills(mon); } static void sub_80A00A4(void) @@ -2600,13 +2416,13 @@ static void sub_80A00F4(u8 a) { if (pssData.page == PSS_PAGE_BATTLE_MOVES) { - sub_80A1FF8(gOtherText_Power2, 13, 1, 15); - sub_80A1FF8(gOtherText_Accuracy2, 13, 1, 17); + SummaryScreen_PrintColoredText(gOtherText_Power2, 13, 1, 15); + SummaryScreen_PrintColoredText(gOtherText_Accuracy2, 13, 1, 17); } else { - sub_80A1FF8(gOtherText_Appeal2, 13, 1, 15); - sub_80A1FF8(gOtherText_Jam2, 13, 1, 17); + SummaryScreen_PrintColoredText(gOtherText_Appeal2, 13, 1, 15); + SummaryScreen_PrintColoredText(gOtherText_Jam2, 13, 1, 17); } } } @@ -2628,18 +2444,18 @@ static void sub_80A015C(struct Pokemon *mon) if (move == 0) { sub_80A1918(i, 1); - sub_80A1FF8(gOtherText_OneDash, 13, 15, (2 * i) + 4); + SummaryScreen_PrintColoredText(gOtherText_OneDash, 13, 15, (2 * i) + 4); Menu_PrintText(gOtherText_TwoDashes, 26, (2 * i) + 4); } else { if (pssData.page == PSS_PAGE_BATTLE_MOVES) - sub_80A198C(gBattleMoves[move].type, 87, ((2 * i) + 4) * 8, i); + SummaryScreen_DrawTypeIcon(gBattleMoves[move].type, 87, ((2 * i) + 4) * 8, i); else - sub_80A198C(gContestMoves[move].contestCategory + 18, 87, ((2 * i) + 4) * 8, i); + SummaryScreen_DrawTypeIcon(gContestMoves[move].contestCategory + 18, 87, ((2 * i) + 4) * 8, i); - sub_80A1FF8(gMoveNames[move], 13, 15, (2 * i) + 4); - GetStringCenterAlignXOffset(1, 24, (2 * i) + 4); + SummaryScreen_PrintColoredText(gMoveNames[move], 13, 15, (2 * i) + 4); + SummaryScreen_PlaceTextTile_White(1, 24, (2 * i) + 4); ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES); maxPP = CalculatePPWithBonus(move, ppBonuses, i); @@ -2661,23 +2477,23 @@ static void sub_80A029C(struct Pokemon *mon) if (pssData.moveToLearn == 0) { - sub_80A1FF8(gOtherText_CancelNoTerminator, 13, 15, 12); + SummaryScreen_PrintColoredText(gOtherText_CancelNoTerminator, 13, 15, 12); return; } move = pssData.moveToLearn; if (pssData.page == PSS_PAGE_BATTLE_MOVES) - sub_80A198C(gBattleMoves[move].type, 87, 96, 4); + SummaryScreen_DrawTypeIcon(gBattleMoves[move].type, 87, 96, 4); else - sub_80A198C(gContestMoves[move].contestCategory + 18, 87, 96, 4); + SummaryScreen_DrawTypeIcon(gContestMoves[move].contestCategory + 18, 87, 96, 4); if (pssData.page == PSS_PAGE_BATTLE_MOVES) - sub_80A1FF8(gMoveNames[move], 10, 15, 12); + SummaryScreen_PrintColoredText(gMoveNames[move], 10, 15, 12); else - sub_80A1FF8(gMoveNames[move], 9, 15, 12); + SummaryScreen_PrintColoredText(gMoveNames[move], 9, 15, 12); - GetStringCenterAlignXOffset(1, 24, 12); + SummaryScreen_PlaceTextTile_White(1, 24, 12); buffer = gStringVar1; pp = gBattleMoves[move].pp; @@ -3031,13 +2847,13 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, u8 nature = GetNature(mon); #if ENGLISH - ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); + ptr = SummaryScreen_CopyColoredString(ptr, gNatureNames[nature], 14); if (nature != NATURE_BOLD && nature != NATURE_GENTLE) ptr = StringCopy(ptr, gOtherText_Terminator4); ptr = StringCopy(ptr, gOtherText_Nature); #elif GERMAN ptr = StringCopy(gStringVar4, gOtherText_Nature); - ptr = sub_80A1E9C(ptr, gNatureNames[nature], 14); + ptr = SummaryScreen_CopyColoredString(ptr, gNatureNames[nature], 14); ptr = StringCopy(ptr, gOtherText_Terminator4); #endif @@ -3052,7 +2868,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, ptr++; CopyLocationName(gStringVar1, locationMet); - ptr = sub_80A1E9C(ptr, gStringVar1, 14); + ptr = SummaryScreen_CopyColoredString(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Egg2); } else if (locationMet >= 88) @@ -3071,7 +2887,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, ptr++; CopyLocationName(gStringVar1, locationMet); - ptr = sub_80A1E9C(ptr, gStringVar1, 14); + ptr = SummaryScreen_CopyColoredString(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Met); } } @@ -3115,7 +2931,7 @@ static void PokemonSummaryScreen_PrintTrainerMemo(struct Pokemon *mon, u8 left, ptr++; CopyLocationName(gStringVar1, locationMet); - ptr = sub_80A1E9C(ptr, gStringVar1, 14); + ptr = SummaryScreen_CopyColoredString(ptr, gStringVar1, 14); StringCopy(ptr, gOtherText_Met2); } } @@ -3133,7 +2949,7 @@ static void sub_80A0958(struct Pokemon *mon) species = GetMonData(mon, MON_DATA_SPECIES); buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer[0] = EXT_CTRL_CODE_BEGIN; buffer[1] = 0x11; buffer[2] = 0x7; @@ -3151,8 +2967,8 @@ static void sub_80A0958(struct Pokemon *mon) level = GetMonData(mon, MON_DATA_LEVEL); - buffer = sub_80A1E58(gStringVar1, 13); - buffer[0] = 0x34; + buffer = SummaryScreen_SetTextColor(gStringVar1, 13); + buffer[0] = CHAR_LV; buffer += 1; buffer = ConvertIntToDecimalString(buffer, level); @@ -3168,7 +2984,7 @@ static void sub_80A0958(struct Pokemon *mon) static void sub_80A0A2C(struct Pokemon *mon, u8 left, u8 top) { const u8 *genderSymbol; - u8 var1; + u8 color; u8 bottom; u16 species = GetMonData(mon, MON_DATA_SPECIES2); @@ -3183,21 +2999,22 @@ static void sub_80A0A2C(struct Pokemon *mon, u8 left, u8 top) return; case MON_MALE: genderSymbol = gOtherText_MaleSymbol2; - var1 = 11; + color = 11; break; case MON_FEMALE: - genderSymbol = gOtherText_FemaleSymbolAndLv; - var1 = 12; + genderSymbol = gOtherText_FemaleSymbol2; + color = 12; break; } - sub_80A1FF8(genderSymbol, var1, left, top); + SummaryScreen_PrintColoredText(genderSymbol, color, left, top); } } u8 GetNumRibbons(struct Pokemon *mon) { - u8 numRibbons = GetMonData(mon, MON_DATA_COOL_RIBBON); + u8 numRibbons = 0; + numRibbons += GetMonData(mon, MON_DATA_COOL_RIBBON); numRibbons += GetMonData(mon, MON_DATA_BEAUTY_RIBBON); numRibbons += GetMonData(mon, MON_DATA_CUTE_RIBBON); numRibbons += GetMonData(mon, MON_DATA_SMART_RIBBON); @@ -3308,12 +3125,11 @@ static void DrawExperienceProgressBar(struct Pokemon *mon, u8 left, u8 top) for (i = 0; i < 8; i++) { u16 tile; - u16 baseTile = 0x2062; - if (numExpProgressBarTicks > 7) - tile = 0x206A; // full exp. bar block + if (numExpProgressBarTicks >= 8) + tile = 0x2062 + 8; // full exp. bar block else - tile = (numExpProgressBarTicks % 8) + baseTile; + tile = 0x2062 + (numExpProgressBarTicks % 8); vramAddr[i] = tile; @@ -3336,7 +3152,7 @@ static void PrintSummaryWindowHeaderText(void) buffer[2] = 0x2; buffer += 3; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, sPageHeaderTexts[pssData.headerTextId]); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -3348,8 +3164,8 @@ static void PrintSummaryWindowHeaderText(void) if (pssData.headerActionTextId != 0) { - GetStringCenterAlignXOffset(5, 23, 0); - GetStringCenterAlignXOffset(6, 24, 0); + SummaryScreen_PlaceTextTile_White(5, 23, 0); + SummaryScreen_PlaceTextTile_White(6, 24, 0); } else { @@ -3357,7 +3173,7 @@ static void PrintSummaryWindowHeaderText(void) } buffer = gStringVar1; - buffer = sub_80A1E58(buffer, 13); + buffer = SummaryScreen_SetTextColor(buffer, 13); buffer = StringCopy(buffer, sPageHeaderTexts[pssData.headerActionTextId]); buffer[0] = EXT_CTRL_CODE_BEGIN; @@ -3935,7 +3751,7 @@ _080A1286:\n\ movs r1, 0xD\n\ movs r2, 0x1\n\ movs r3, 0x12\n\ - bl sub_80A1FF8\n\ + bl SummaryScreen_PrintColoredText\n\ _080A129A:\n\ bl sub_80A1D18\n\ mov r0, r8\n\ @@ -4026,7 +3842,7 @@ static void sub_80A12D0(s8 a) // if (GetMonStatusAndPokerus(pssData.loadedMon)) // { -// sub_80A1FF8(gOtherText_Status, 13, 1, 18); +// SummaryScreen_PrintColoredText(gOtherText_Status, 13, 1, 18); // } // DestroyTask(taskId); @@ -4179,7 +3995,7 @@ _080A1410:\n\ movs r1, 0xD\n\ movs r2, 0x1\n\ movs r3, 0x12\n\ - bl sub_80A1FF8\n\ + bl SummaryScreen_PrintColoredText\n\ _080A1444:\n\ mov r0, r10\n\ bl DestroyTask\n\ @@ -4375,7 +4191,7 @@ _080A15DC:\n\ movs r1, 0xD\n\ movs r2, 0x1\n\ movs r3, 0x12\n\ - bl sub_80A1FF8\n\ + bl SummaryScreen_PrintColoredText\n\ _080A1610:\n\ mov r0, r10\n\ bl DestroyTask\n\ @@ -4652,7 +4468,7 @@ _080A1804: .4byte gUnknown_08E94550\n\ } #endif // NONMATCHING -u8 sub_80A1808(struct Pokemon *mon) +u8 SummaryScreen_CreatePokemonSprite(struct Pokemon *mon) { u16 species; u8 spriteId; @@ -4663,7 +4479,7 @@ u8 sub_80A1808(struct Pokemon *mon) FreeSpriteOamMatrix(&gSprites[spriteId]); gSprites[spriteId].data[0] = species; - gSprites[spriteId].callback = sub_80A1888; + gSprites[spriteId].callback = SummaryScreen_SpritePlayCry; if (!IsPokeSpriteNotFlipped(species)) gSprites[spriteId].hFlip = TRUE; @@ -4673,7 +4489,7 @@ u8 sub_80A1808(struct Pokemon *mon) return spriteId; } -static void sub_80A1888(struct Sprite *sprite) +static void SummaryScreen_SpritePlayCry(struct Sprite *sprite) { if (!gPaletteFade.active) { @@ -4719,7 +4535,7 @@ static void sub_80A1950(void) } } -static void sub_80A198C(u8 animNum, u8 x, u8 y, u8 d) +static void SummaryScreen_DrawTypeIcon(u8 animNum, u8 x, u8 y, u8 d) { StartSpriteAnim(&gSprites[ewram1A000[d]], animNum); @@ -4860,7 +4676,7 @@ void sub_80A1D18(void) u8 statusAndPkrs; u8 statusAndPkrs2; - sub_809F678(&mon); + SummaryScreen_GetPokemon(&mon); statusAndPkrs = GetMonStatusAndPokerus(&mon); if (statusAndPkrs) @@ -4886,7 +4702,7 @@ void sub_80A1D18(void) push {r4,r5,lr}\n\ sub sp, 0x64\n\ mov r0, sp\n\ - bl sub_809F678\n\ + bl SummaryScreen_GetPokemon\n\ mov r0, sp\n\ bl GetMonStatusAndPokerus\n\ lsls r0, 24\n\ @@ -4940,7 +4756,7 @@ static void sub_80A1D84(struct Pokemon *mon) { struct Sprite *sprite; - sprite = sub_80F7920(0x7533, 0x7533, sSummaryScreenMonMarkingsPalette); + sprite = sub_80F7920(30003, 30003, sSummaryScreenMonMarkingsPalette); gUnknown_020384F4 = sprite; if (sprite != NULL) @@ -4969,20 +4785,20 @@ static void sub_80A1DE8(struct Pokemon *mon) gSprites[pssData.ballSpriteId].oam.priority = 3; } -static u8 *sub_80A1E58(u8 *text, u8 id) +static u8 *SummaryScreen_SetTextColor(u8 *text, u8 id) { if (id != 0xFF) { - const u8 *ptr = sUnknown_083C15BC; + const struct TextColors *colors = sSummaryScreenTextColors; - while (*ptr != 0xFF && *ptr != id) - ptr += 4; + while (colors->id != 0xFF && colors->id != id) + colors++; text[0] = EXT_CTRL_CODE_BEGIN; - text[1] = 4; - text[2] = ptr[1]; - text[3] = ptr[2]; - text[4] = ptr[3]; + text[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW; + text[2] = colors->color; + text[3] = colors->background; + text[4] = colors->shadow; text += 5; } @@ -4990,22 +4806,22 @@ static u8 *sub_80A1E58(u8 *text, u8 id) return text; } -u8 *sub_80A1E9C(u8 *dest, const u8 *src, u8 id) +static u8 *SummaryScreen_CopyColoredString(u8 *dest, const u8 *src, u8 id) { - u8 arr[3]; + u8 colors[3]; - Menu_GetTextColors(&arr[0], &arr[1], &arr[2]); + Menu_GetTextColors(&colors[0], &colors[1], &colors[2]); - dest = sub_80A1E58(dest, id); + dest = SummaryScreen_SetTextColor(dest, id); dest = StringCopy(dest, src); if (id != 0xFF) { dest[0] = EXT_CTRL_CODE_BEGIN; - dest[1] = 4; - dest[2] = arr[0]; - dest[3] = arr[1]; - dest[4] = arr[2]; + dest[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW; + dest[2] = colors[0]; + dest[3] = colors[1]; + dest[4] = colors[2]; dest[5] = 0xFF; dest += 5; @@ -5014,27 +4830,27 @@ u8 *sub_80A1E9C(u8 *dest, const u8 *src, u8 id) return dest; } -static void sub_80A1EF8(const u8 *text, u8 id, u8 left, u16 top, s32 e) +static void SummaryScreen_PrintColoredTextPixelCoords(const u8 *text, u8 id, u8 left, u16 top, s32 e) { - sub_80A1E9C(gStringVar4, text, id); + SummaryScreen_CopyColoredString(gStringVar4, text, id); Menu_PrintTextPixelCoords(gStringVar4, left, top, (bool8)e); } -static void sub_80A1F48(const u8 *text, u8 id, u8 c, u8 d, u16 e) +static void SummaryScreen_PrintColoredTextCentered(const u8 *text, u8 id, u8 left, u8 top, u16 width) { - sub_80A1E9C(gStringVar4, text, id); - sub_8072BD8(gStringVar4, c, d, e); + SummaryScreen_CopyColoredString(gStringVar4, text, id); + MenuPrint_Centered(gStringVar4, left, top, width); } -static void sub_80A1F98(s32 value, u8 id, u8 n, u8 mode, u8 left, u16 top, s32 e) +static void SummaryScreen_PrintColoredIntPixelCoords(s32 value, u8 id, u8 n, u8 mode, u8 left, u16 top, s32 e) { ConvertIntToDecimalStringN(gStringVar1, value, mode, n); - sub_80A1EF8(gStringVar1, id, left, top, e); + SummaryScreen_PrintColoredTextPixelCoords(gStringVar1, id, left, top, e); } -static void sub_80A1FF8(const u8 *text, u8 id, u8 left, u8 top) +static void SummaryScreen_PrintColoredText(const u8 *text, u8 id, u8 left, u8 top) { - sub_80A1E9C(gStringVar4, text, id); + SummaryScreen_CopyColoredString(gStringVar4, text, id); Menu_PrintText(gStringVar4, left, top); } @@ -5042,14 +4858,13 @@ u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level) { u8 buffer[12]; - dest[0] = 0x34; - dest++; + *dest++ = CHAR_LV; if (level == 0) level = 5; ConvertIntToDecimalString(buffer, level); - dest = sub_80A1E9C(dest, buffer, 14); + dest = SummaryScreen_CopyColoredString(dest, buffer, 14); dest = StringCopy(dest, gOtherText_Comma); return dest; diff --git a/src/rom_8077ABC.c b/src/rom_8077ABC.c index 00ce3d8df..e81d02251 100644 --- a/src/rom_8077ABC.c +++ b/src/rom_8077ABC.c @@ -760,18 +760,18 @@ void sub_807867C(struct Sprite *sprite, s16 a2) } } -void InitAnimSpriteTranslationOverDuration(struct Sprite *sprite) +void InitAnimArcTranslation(struct Sprite *sprite) { sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); sprite->data[6] = 0x8000 / sprite->data[0]; sprite->data[7] = 0; } -bool8 TranslateAnimSpriteLinearAndSine(struct Sprite *sprite) +bool8 TranslateAnimArc(struct Sprite *sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) return TRUE; sprite->data[7] += sprite->data[6]; sprite->pos2.y += Sin((u8)(sprite->data[7] >> 8), sprite->data[5]); @@ -951,7 +951,7 @@ void InitSpriteDataForLinearTranslation(struct Sprite *sprite) sprite->data[3] = 0; } -void InitAnimSpriteTranslationDeltas(struct Sprite *sprite) +void InitAnimLinearTranslation(struct Sprite *sprite) { int x = sprite->data[2] - sprite->data[1]; int y = sprite->data[4] - sprite->data[3]; @@ -979,16 +979,16 @@ void InitAnimSpriteTranslationDeltas(struct Sprite *sprite) sprite->data[3] = 0; } -void StartTranslateAnimSpriteByDeltas(struct Sprite *sprite) +void StartAnimLinearTranslation(struct Sprite *sprite) { sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; - InitAnimSpriteTranslationDeltas(sprite); - sprite->callback = TranslateAnimSpriteByDeltasUntil; + InitAnimLinearTranslation(sprite); + sprite->callback = TranslateAnimLinearUntil; sprite->callback(sprite); } -bool8 TranslateAnimSpriteByDeltas(struct Sprite *sprite) +bool8 TranslateAnimLinear(struct Sprite *sprite) { u16 v1, v2, x, y; @@ -1018,9 +1018,9 @@ bool8 TranslateAnimSpriteByDeltas(struct Sprite *sprite) return FALSE; } -void TranslateAnimSpriteByDeltasUntil(struct Sprite *sprite) +void TranslateAnimLinearUntil(struct Sprite *sprite) { - if (TranslateAnimSpriteByDeltas(sprite)) + if (TranslateAnimLinear(sprite)) SetCallbackToStoredInData(sprite); } @@ -1028,7 +1028,7 @@ void sub_8078BD4(struct Sprite *sprite) { int v1 = abs(sprite->data[2] - sprite->data[1]) << 8; sprite->data[0] = v1 / sprite->data[0]; - InitAnimSpriteTranslationDeltas(sprite); + InitAnimLinearTranslation(sprite); } void sub_8078C00(struct Sprite *sprite) @@ -1036,7 +1036,7 @@ void sub_8078C00(struct Sprite *sprite) sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; sub_8078BD4(sprite); - sprite->callback = TranslateAnimSpriteByDeltasUntil; + sprite->callback = TranslateAnimLinearUntil; sprite->callback(sprite); } @@ -1420,7 +1420,7 @@ void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, v2) + gBattleAnimArgs[3]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -1433,13 +1433,13 @@ void sub_80794A8(struct Sprite *sprite) sprite->data[2] = GetBattlerSpriteCoord(gAnimBankTarget, 2) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(gAnimBankTarget, 3) + gBattleAnimArgs[3]; sprite->data[5] = gBattleAnimArgs[5]; - InitAnimSpriteTranslationOverDuration(sprite); + InitAnimArcTranslation(sprite); sprite->callback = sub_8079518; } void sub_8079518(struct Sprite *sprite) { - if (TranslateAnimSpriteLinearAndSine(sprite)) + if (TranslateAnimArc(sprite)) DestroyAnimSprite(sprite); } @@ -1473,7 +1473,7 @@ void sub_8079534(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = GetBattlerSpriteCoord(slot, 2) + gBattleAnimArgs[2]; sprite->data[4] = GetBattlerSpriteCoord(slot, r7) + gBattleAnimArgs[3]; - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } @@ -2351,6 +2351,6 @@ void sub_807A9BC(struct Sprite *sprite) sprite->pos1.x += x; sprite->pos1.y = gBattleAnimArgs[5] - 80; } - sprite->callback = StartTranslateAnimSpriteByDeltas; + sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index b292265a6..87ef2517b 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -19,7 +19,7 @@ #include "text.h" #include "ewram.h" -extern const u8 gUnknown_08208238[]; +extern const u8 gPPUpReadMasks[]; extern u8 gPlayerPartyCount; extern u16 gSpecialVar_0x8004; @@ -307,11 +307,11 @@ void sub_80F9FDC(struct Pokemon *pkmn, u8 moveIndex1, u8 moveIndex2) u8 pp2 = GetMonData(pkmn, MON_DATA_PP1 + moveIndex2); u8 bonuses = GetMonData(pkmn, MON_DATA_PP_BONUSES); - u8 r2 = (bonuses & gUnknown_08208238[moveIndex1]) >> (moveIndex1 * 2); - u8 r1 = (bonuses & gUnknown_08208238[moveIndex2]) >> (moveIndex2 * 2); + u8 r2 = (bonuses & gPPUpReadMasks[moveIndex1]) >> (moveIndex1 * 2); + u8 r1 = (bonuses & gPPUpReadMasks[moveIndex2]) >> (moveIndex2 * 2); - bonuses &= ~gUnknown_08208238[moveIndex1]; - bonuses &= ~gUnknown_08208238[moveIndex2]; + bonuses &= ~gPPUpReadMasks[moveIndex1]; + bonuses &= ~gPPUpReadMasks[moveIndex2]; bonuses |= (r2 << (moveIndex2 * 2)) + (r1 << (moveIndex1 * 2)); SetMonData(pkmn, MON_DATA_MOVE1 + moveIndex1, &move2); diff --git a/src/strings.c b/src/strings.c index cded04f96..e9d9ea87e 100644 --- a/src/strings.c +++ b/src/strings.c @@ -2,6 +2,7 @@ #include "strings.h" #if ENGLISH + // placeholder strings const u8 gExpandedPlaceholder_Empty[] = _(""); const u8 gExpandedPlaceholder_Kun[] = _(""); @@ -180,7 +181,8 @@ const u8 gOtherText_OneDash[] = _("-"); const u8 gOtherText_TwoDashes[] = _("--"); const u8 gOtherText_ThreeDashes2[] = _("---"); const u8 gOtherText_MaleSymbol2[] = _("♂"); -const u8 gOtherText_FemaleSymbolAndLv[] = _("♀$Lv."); +const u8 gOtherText_FemaleSymbol2[] = _("♀"); +const u8 gOtherText_Lv[] = _("Lv."); const u8 gOtherText_TallPlusAndRightArrow[] = _("{TALL_PLUS}${RIGHT_ARROW}"); const u8 gMenuText_GoBackToPrev[] = _("Go back to the\nprevious menu."); const u8 gOtherText_WhatWillYouDo[] = _("What would you like to do?"); @@ -926,6 +928,7 @@ const u8 gSystemText_SaveFailed[] = _("Save failed..."); const u8 gSystemText_NoSaveFileNoTime[] = _("There is no save file, so the time\ncan’t be set."); const u8 gSystemText_ClockAdjustmentUsable[] = _("The in-game clock adjustment system\nis now useable."); const u8 gSystemText_Saving[] = _("SAVING...\nDON’T TURN OFF THE POWER."); + #elif GERMAN // placeholder strings @@ -1106,7 +1109,8 @@ const u8 gOtherText_OneDash[] = _("-"); const u8 gOtherText_TwoDashes[] = _("--"); const u8 gOtherText_ThreeDashes2[] = _("---"); const u8 gOtherText_MaleSymbol2[] = _("♂"); -const u8 gOtherText_FemaleSymbolAndLv[] = _("♀$Lv."); +const u8 gOtherText_FemaleSymbol2[] = _("♀"); +const u8 gOtherText_Lv[] = _("Lv."); const u8 gOtherText_TallPlusAndRightArrow[] = _("{TALL_PLUS}${RIGHT_ARROW}"); const u8 gMenuText_GoBackToPrev[] = _("Kehre zurück zum\nvorherigen Menü."); const u8 gOtherText_WhatWillYouDo[] = _("Was möchtest du tun?"); diff --git a/src/text.c b/src/text.c index c2f78276b..dbf74ab61 100644 --- a/src/text.c +++ b/src/text.c @@ -2003,7 +2003,7 @@ void Text_InitWindow8002E4C(struct Window *win, const u8 *text, u16 tileDataStar if (a6) val = 255; win->win_field_F = val; - if (val) + if (win->win_field_F) ClipLeft(win); } @@ -3394,7 +3394,7 @@ static u16 GetBlankTileNum(struct Window *win) return retVal; } -static s32 sub_80048D8(struct Window *win, u8 x, u8 y) +static s32 Window_MoveCursor(struct Window *win, u8 x, u8 y) { win->cursorX = x; win->cursorY = y & 0xF8; @@ -3672,25 +3672,26 @@ u8 Text_InitWindow8004D04(struct Window *win, const u8 *text, u16 tileDataStartO return Text_PrintWindow8002F44(win); } -u8 Text_InitWindow8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top) +u8 Text_InitWindow_RightAligned(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 right, u8 top) { u8 width = GetStringWidth(win, text); - Text_InitWindow(win, text, tileDataStartOffset, left - ((u32)(width + 7) >> 3), top); + Text_InitWindow(win, text, tileDataStartOffset, right - ((u32)(width + 7) >> 3), top); EraseAtCursor(win); width &= 7; if (width) width = 8 - width; - sub_80048D8(win, width, 0); + Window_MoveCursor(win, width, 0); return Text_PrintWindow8002F44(win); } -u8 Text_InitWindow8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6) +u8 Text_InitWindow_Centered(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 width) { - register u32 val asm("r5") = (u8)((a6 >> 1) - (GetStringWidth(win, text) >> 1)); - left += (val >> 3); + width = (u8)(width / 2 - GetStringWidth(win, text) / 2); + left += (u8)width / 8; Text_InitWindow(win, text, tileDataStartOffset, left, top); EraseAtCursor(win); - sub_80048D8(win, val & 7, 0); + width &= 7; + Window_MoveCursor(win, width, 0); return Text_PrintWindow8002F44(win); } |