From 54fc92bc92e78d172be51f7d11b4d746e46f8a7e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 6 Oct 2018 23:04:53 +0200 Subject: [PATCH 1/5] Start porting ruby battle anim file --- asm/battle_anim_80A5C6C.s | 1732 +---------------- asm/battle_anim_80FE840.s | 172 +- asm/battle_anim_815A0D4.s | 14 +- asm/battle_anim_8170478.s | 6 +- data/rom_8525F58.s | 34 - include/battle_anim.h | 13 +- include/contest.h | 16 +- ld_script.txt | 3 +- src/battle_anim.c | 6 +- src/battle_anim_80A5C6C.c | 741 +++++++ src/battle_anim_sound_tasks.c | 6 +- src/battle_gfx_sfx_util.c | 8 +- src/contest.c | 2 +- .../pokemon_graphics/back_pic_coordinates.h | 2 +- src/pokeball.c | 14 +- 15 files changed, 905 insertions(+), 1864 deletions(-) delete mode 100644 data/rom_8525F58.s create mode 100644 src/battle_anim_80A5C6C.c diff --git a/asm/battle_anim_80A5C6C.s b/asm/battle_anim_80A5C6C.s index 320bbef20..1bb3c7d9b 100644 --- a/asm/battle_anim_80A5C6C.s +++ b/asm/battle_anim_80A5C6C.s @@ -5,1682 +5,12 @@ .text - thumb_func_start GetBattlerSpriteCoord -GetBattlerSpriteCoord: @ 80A5C6C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A5C8A - cmp r4, 0x3 - bne _080A5C8A - cmp r5, 0x3 - bne _080A5C8A - movs r4, 0x1 -_080A5C8A: - cmp r4, 0x4 - bhi _080A5D00 - lsls r0, r4, 2 - ldr r1, =_080A5C9C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080A5C9C: - .4byte _080A5CB0 - .4byte _080A5CD8 - .4byte _080A5CB0 - .4byte _080A5D00 - .4byte _080A5D00 -_080A5CB0: - ldr r4, =gUnknown_08525F58 - adds r0, r5, 0 - bl GetBattlerPosition - lsls r0, 24 - lsrs r0, 22 - ldr r1, =gBattleTypeFlags - ldr r1, [r1] - movs r2, 0x1 - ands r1, r2 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - b _080A5DB0 - .pool -_080A5CD8: - ldr r4, =gUnknown_08525F58 - adds r0, r5, 0 - bl GetBattlerPosition - lsls r0, 24 - lsrs r0, 22 - ldr r1, =gBattleTypeFlags - ldr r1, [r1] - movs r2, 0x1 - ands r1, r2 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0, 0x1] - b _080A5DB0 - .pool -_080A5D00: - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A5D28 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0x18] - ldrb r1, [r2, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080A5D24 - ldrh r1, [r2, 0x2] - b _080A5D9A - .pool -_080A5D24: - ldrh r1, [r2] - b _080A5D9A -_080A5D28: - adds r0, r5, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A5D60 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r5, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A5D98 - ldr r1, =gBattlerPartyIndexes - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - b _080A5D7E - .pool -_080A5D60: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r5, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A5D98 - ldr r1, =gBattlerPartyIndexes - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty -_080A5D7E: - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r1, r0, 16 - b _080A5D9A - .pool -_080A5D98: - ldrh r1, [r1, 0x2] -_080A5D9A: - cmp r4, 0x3 - bne _080A5DA4 - adds r0, r5, 0 - movs r2, 0x1 - b _080A5DA8 -_080A5DA4: - adds r0, r5, 0 - movs r2, 0 -_080A5DA8: - bl sub_80A600C - lsls r0, 24 - lsrs r0, 24 -_080A5DB0: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end GetBattlerSpriteCoord - - thumb_func_start sub_80A5DB8 -sub_80A5DB8: @ 80A5DB8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A5DDA - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A5DDA - b _080A5EC8 -_080A5DDA: - cmp r5, 0xC9 - bne _080A5E90 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A5E04 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0x18] - ldrb r1, [r2, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080A5E00 - ldr r2, [r2, 0x10] - b _080A5E42 - .pool -_080A5E00: - ldr r2, [r2, 0x8] - b _080A5E42 -_080A5E04: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - lsls r1, r4, 2 - adds r0, r1, r0 - ldrh r0, [r0, 0x2] - cmp r0, 0 - bne _080A5E3C - ldr r1, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - bl GetMonData - adds r2, r0, 0 - b _080A5E42 - .pool -_080A5E3C: - ldr r0, =gTransformedPersonalities - adds r0, r1, r0 - ldr r2, [r0] -_080A5E42: - movs r0, 0xC0 - lsls r0, 18 - ands r0, r2 - lsrs r0, 18 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r2 - lsrs r1, 12 - orrs r0, r1 - movs r1, 0xC0 - lsls r1, 2 - ands r1, r2 - lsrs r1, 6 - orrs r0, r1 - movs r1, 0x3 - ands r1, r2 - orrs r0, r1 - movs r1, 0x1C - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080A5E7C - adds r0, r5, 0 - b _080A5E86 - .pool -_080A5E7C: - movs r1, 0xCE - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 -_080A5E86: - ldr r1, =gUnknown_083021D8 - lsls r0, 2 - b _080A5F90 - .pool -_080A5E90: - ldr r0, =0x00000181 - cmp r5, r0 - bne _080A5EB0 - ldr r0, =gUnknown_08525F8C - ldr r1, =gBattleMonForms - adds r1, r4, r1 - ldrb r1, [r1] - adds r1, r0 - ldrb r0, [r1] - b _080A5F94 - .pool -_080A5EB0: - movs r0, 0xCE - lsls r0, 1 - cmp r5, r0 - bls _080A5EC0 - ldr r0, =gUnknown_083021D8 - b _080A5F92 - .pool -_080A5EC0: - ldr r1, =gUnknown_083021D8 - b _080A5F8E - .pool -_080A5EC8: - cmp r5, 0xC9 - bne _080A5F58 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - lsls r1, r4, 2 - adds r0, r1, r0 - ldrh r0, [r0, 0x2] - cmp r0, 0 - bne _080A5F04 - ldr r1, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0 - bl GetMonData - adds r2, r0, 0 - b _080A5F0A - .pool -_080A5F04: - ldr r0, =gTransformedPersonalities - adds r0, r1, r0 - ldr r2, [r0] -_080A5F0A: - movs r0, 0xC0 - lsls r0, 18 - ands r0, r2 - lsrs r0, 18 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r2 - lsrs r1, 12 - orrs r0, r1 - movs r1, 0xC0 - lsls r1, 2 - ands r1, r2 - lsrs r1, 6 - orrs r0, r1 - movs r1, 0x3 - ands r1, r2 - orrs r0, r1 - movs r1, 0x1C - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080A5F44 - adds r0, r5, 0 - b _080A5F4E - .pool -_080A5F44: - movs r1, 0xCE - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 -_080A5F4E: - ldr r1, =gMonFrontPicCoords - lsls r0, 2 - b _080A5F90 - .pool -_080A5F58: - ldr r0, =0x00000181 - cmp r5, r0 - bne _080A5F7C - ldr r0, =gCastformFrontSpriteCoords - ldr r1, =gBattleMonForms - adds r1, r4, r1 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x1] - b _080A5F94 - .pool -_080A5F7C: - movs r0, 0xCE - lsls r0, 1 - cmp r5, r0 - bls _080A5F8C - ldr r0, =gMonFrontPicCoords - b _080A5F92 - .pool -_080A5F8C: - ldr r1, =gMonFrontPicCoords -_080A5F8E: - lsls r0, r5, 2 -_080A5F90: - adds r0, r1 -_080A5F92: - ldrb r0, [r0, 0x1] -_080A5F94: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A5DB8 - - thumb_func_start sub_80A5FA0 -sub_80A5FA0: @ 80A5FA0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 16 - lsrs r4, r1, 16 - adds r7, r4, 0 - movs r5, 0 - adds r0, r6, 0 - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080A5FFE - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A5FFE - ldr r0, =0x00000181 - cmp r4, r0 - bne _080A5FE8 - ldr r0, =gUnknown_08525F88 - ldr r1, =gBattleMonForms - adds r1, r6, r1 - ldrb r1, [r1] - adds r1, r0 - ldrb r5, [r1] - b _080A5FFE - .pool -_080A5FE8: - movs r0, 0xCE - lsls r0, 1 - cmp r4, r0 - bls _080A5FF8 - ldr r0, =gEnemyMonElevation - b _080A5FFC - .pool -_080A5FF8: - ldr r0, =gEnemyMonElevation - adds r0, r7, r0 -_080A5FFC: - ldrb r5, [r0] -_080A5FFE: - adds r0, r5, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A5FA0 - - thumb_func_start sub_80A600C -sub_80A600C: @ 80A600C - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - lsls r2, 24 - lsrs r7, r2, 24 - adds r0, r6, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A6030 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A603E -_080A6030: - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_80A5DB8 - lsls r0, 24 - lsrs r4, r0, 24 - b _080A605C -_080A603E: - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_80A5DB8 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_80A5FA0 - lsls r0, 24 - lsrs r0, 24 - subs r0, r4, r0 - lsls r0, 16 - lsrs r4, r0, 16 -_080A605C: - adds r0, r6, 0 - bl GetBattlerPosition - ldr r3, =gUnknown_08525F58 - lsls r0, 24 - lsrs r0, 22 - ldr r1, =gBattleTypeFlags - ldr r1, [r1] - movs r2, 0x1 - ands r1, r2 - lsls r1, 4 - adds r0, r1 - adds r0, r3 - ldrb r0, [r0, 0x1] - adds r0, r4 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r7, 0 - beq _080A609C - adds r0, r6, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080A6096 - adds r0, r4, 0 - adds r0, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 -_080A6096: - cmp r4, 0x68 - bls _080A609C - movs r4, 0x68 -_080A609C: - adds r0, r4, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A600C - - thumb_func_start sub_80A60AC -sub_80A60AC: @ 80A60AC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - movs r0, 0xFD - lsls r0, 24 - adds r1, r0 - lsrs r1, 24 - cmp r1, 0x1 - bhi _080A6126 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A60E8 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0x18] - ldrb r1, [r2, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080A60E4 - ldrh r1, [r2, 0x2] - b _080A610E - .pool -_080A60E4: - ldrh r1, [r2] - b _080A610E -_080A60E8: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r4, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A610C - ldr r1, =gAnimBattlerSpecies - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - b _080A610E - .pool -_080A610C: - ldrh r1, [r1, 0x2] -_080A610E: - cmp r5, 0x3 - bne _080A611C - adds r0, r4, 0 - movs r2, 0x1 - bl sub_80A600C - b _080A612E -_080A611C: - adds r0, r4, 0 - movs r2, 0 - bl sub_80A600C - b _080A612E -_080A6126: - adds r0, r4, 0 - adds r1, r5, 0 - bl GetBattlerSpriteCoord -_080A612E: - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80A60AC - - thumb_func_start GetBattlerSpriteDefault_Y -GetBattlerSpriteDefault_Y: @ 80A6138 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x4 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end GetBattlerSpriteDefault_Y - - thumb_func_start GetSubstituteSpriteDefault_Y -GetSubstituteSpriteDefault_Y: @ 80A614C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A6170 - adds r0, r4, 0 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 8 - movs r1, 0x80 - lsls r1, 13 - b _080A6180 -_080A6170: - adds r0, r4, 0 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 8 - movs r1, 0x88 - lsls r1, 13 -_080A6180: - adds r0, r1 - lsrs r0, 16 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - thumb_func_end GetSubstituteSpriteDefault_Y - - thumb_func_start sub_80A6190 -sub_80A6190: @ 80A6190 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A6238 - adds r0, r5, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A61E4 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r5, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A621C - ldr r1, =gBattlerPartyIndexes - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - b _080A6202 - .pool -_080A61E4: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r5, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A621C - ldr r1, =gBattlerPartyIndexes - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty -_080A6202: - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - b _080A621E - .pool -_080A621C: - ldrh r4, [r1, 0x2] -_080A621E: - adds r0, r5, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A6238 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80A5FA0 - subs r0, r6, r0 - lsls r0, 24 - lsrs r6, r0, 24 -_080A6238: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80A6190 - - thumb_func_start GetAnimBattlerSpriteId -GetAnimBattlerSpriteId: @ 80A6240 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0 - bne _080A6268 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - bl IsBattlerSpritePresent - lsls r0, 24 - cmp r0, 0 - beq _080A62B6 - ldr r1, =gBattlerSpriteIds - ldrb r0, [r4] - b _080A62C6 - .pool -_080A6268: - cmp r0, 0x1 - bne _080A6288 - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - bl IsBattlerSpritePresent - lsls r0, 24 - cmp r0, 0 - beq _080A62B6 - ldr r1, =gBattlerSpriteIds - ldrb r0, [r4] - b _080A62C6 - .pool -_080A6288: - cmp r1, 0x2 - bne _080A62A4 - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A62B6 - b _080A62C0 - .pool -_080A62A4: - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - bne _080A62C0 -_080A62B6: - movs r0, 0xFF - b _080A62CA - .pool -_080A62C0: - ldr r1, =gBattlerSpriteIds - ldrb r0, [r5] - eors r0, r4 -_080A62C6: - adds r0, r1 - ldrb r0, [r0] -_080A62CA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end GetAnimBattlerSpriteId - - thumb_func_start StoreSpriteCallbackInData6 -StoreSpriteCallbackInData6: @ 80A62D4 - strh r1, [r0, 0x3A] - lsrs r1, 16 - strh r1, [r0, 0x3C] - bx lr - thumb_func_end StoreSpriteCallbackInData6 - - thumb_func_start sub_80A62DC -sub_80A62DC: @ 80A62DC - ldrh r2, [r0, 0x3A] - movs r3, 0x3C - ldrsh r1, [r0, r3] - lsls r1, 16 - orrs r2, r1 - str r2, [r0, 0x1C] - bx lr - thumb_func_end sub_80A62DC - - thumb_func_start sub_80A62EC -sub_80A62EC: @ 80A62EC - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080A6340 - movs r2, 0x2E - ldrsh r0, [r4, r2] - 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, 0x32] - ldrh r2, [r4, 0x2E] - adds r1, r0, r2 - strh r1, [r4, 0x2E] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080A632C - ldr r2, =0xffffff00 - b _080A6334 - .pool -_080A632C: - cmp r0, 0 - bge _080A6338 - movs r2, 0x80 - lsls r2, 1 -_080A6334: - adds r0, r1, r2 - strh r0, [r4, 0x2E] -_080A6338: - ldrh r0, [r4, 0x34] - subs r0, 0x1 - strh r0, [r4, 0x34] - b _080A6346 -_080A6340: - adds r0, r4, 0 - bl sub_80A62DC -_080A6346: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A62EC - - thumb_func_start sub_80A634C -sub_80A634C: @ 80A634C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080A63BC - movs r2, 0x2E - ldrsh r0, [r4, r2] - ldrh r1, [r4, 0x38] - lsls r1, 16 - asrs r1, 24 - ldrh r2, [r4, 0x30] - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x38] - lsls r1, 16 - asrs r1, 24 - ldrh r2, [r4, 0x30] - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x2E] - adds r1, r0, r2 - strh r1, [r4, 0x2E] - ldrh r0, [r4, 0x36] - ldrh r2, [r4, 0x38] - adds r0, r2 - strh r0, [r4, 0x38] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080A63A8 - ldr r2, =0xffffff00 - b _080A63B0 - .pool -_080A63A8: - cmp r0, 0 - bge _080A63B4 - movs r2, 0x80 - lsls r2, 1 -_080A63B0: - adds r0, r1, r2 - strh r0, [r4, 0x2E] -_080A63B4: - ldrh r0, [r4, 0x34] - subs r0, 0x1 - strh r0, [r4, 0x34] - b _080A63C2 -_080A63BC: - adds r0, r4, 0 - bl sub_80A62DC -_080A63C2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A634C - - thumb_func_start sub_80A63C8 -sub_80A63C8: @ 80A63C8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080A6444 - movs r2, 0x2E - ldrsh r0, [r4, r2] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x2E] - adds r1, r0, r2 - strh r1, [r4, 0x2E] - ldrh r0, [r4, 0x38] - ldrh r2, [r4, 0x36] - adds r0, r2 - strh r0, [r4, 0x36] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080A6410 - ldr r2, =0xffffff00 - b _080A6418 - .pool -_080A6410: - cmp r0, 0 - bge _080A641C - movs r2, 0x80 - lsls r2, 1 -_080A6418: - adds r0, r1, r2 - strh r0, [r4, 0x2E] -_080A641C: - ldrh r1, [r4, 0x36] - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r0, 0xFF - ble _080A6430 - ldr r2, =0xffffff00 - b _080A6438 - .pool -_080A6430: - cmp r0, 0 - bge _080A643C - movs r2, 0x80 - lsls r2, 1 -_080A6438: - adds r0, r1, r2 - strh r0, [r4, 0x36] -_080A643C: - ldrh r0, [r4, 0x34] - subs r0, 0x1 - strh r0, [r4, 0x34] - b _080A644A -_080A6444: - adds r0, r4, 0 - bl sub_80A62DC -_080A644A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A63C8 - - thumb_func_start sub_80A6450 -sub_80A6450: @ 80A6450 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080A64A4 - movs r2, 0x2E - ldrsh r0, [r4, r2] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x2E] - adds r1, r0, r2 - strh r1, [r4, 0x2E] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080A6490 - ldr r2, =0xffffff00 - b _080A6498 - .pool -_080A6490: - cmp r0, 0 - bge _080A649C - movs r2, 0x80 - lsls r2, 1 -_080A6498: - adds r0, r1, r2 - strh r0, [r4, 0x2E] -_080A649C: - ldrh r0, [r4, 0x34] - subs r0, 0x1 - strh r0, [r4, 0x34] - b _080A64AA -_080A64A4: - adds r0, r4, 0 - bl sub_80A62DC -_080A64AA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6450 - - thumb_func_start sub_80A64B0 -sub_80A64B0: @ 80A64B0 - push {lr} - adds r1, r0, 0 - ldrh r2, [r1, 0x2E] - movs r3, 0x2E - ldrsh r0, [r1, r3] - cmp r0, 0 - ble _080A64C4 - subs r0, r2, 0x1 - strh r0, [r1, 0x2E] - b _080A64CA -_080A64C4: - adds r0, r1, 0 - bl sub_80A62DC -_080A64CA: - pop {r0} - bx r0 - thumb_func_end sub_80A64B0 - - thumb_func_start sub_80A64D0 -sub_80A64D0: @ 80A64D0 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A64EC - ldr r1, =sub_80A653C - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A64D0 - - thumb_func_start sub_80A64EC -sub_80A64EC: @ 80A64EC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x30 - ldrsh r1, [r4, r0] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _080A6502 - ldrh r0, [r4, 0x2E] - negs r0, r0 - strh r0, [r4, 0x2E] -_080A6502: - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - subs r0, r1 - ldrh r5, [r4, 0x2E] - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - cmp r0, 0 - bge _080A651C - negs r0, r0 -_080A651C: - strh r0, [r4, 0x2E] - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r2, 0x34 - ldrsh r1, [r4, r2] - subs r0, r1 - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - strh r0, [r4, 0x32] - strh r5, [r4, 0x30] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A64EC - - thumb_func_start sub_80A653C -sub_80A653C: @ 80A653C - push {lr} - adds r1, r0, 0 - ldrh r2, [r1, 0x2E] - movs r3, 0x2E - ldrsh r0, [r1, r3] - cmp r0, 0 - ble _080A6560 - subs r0, r2, 0x1 - strh r0, [r1, 0x2E] - ldrh r0, [r1, 0x30] - ldrh r2, [r1, 0x24] - adds r0, r2 - strh r0, [r1, 0x24] - ldrh r0, [r1, 0x32] - ldrh r3, [r1, 0x26] - adds r0, r3 - strh r0, [r1, 0x26] - b _080A6566 -_080A6560: - adds r0, r1, 0 - bl sub_80A62DC -_080A6566: - pop {r0} - bx r0 - thumb_func_end sub_80A653C - - thumb_func_start sub_80A656C -sub_80A656C: @ 80A656C - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x2E] - movs r3, 0x2E - ldrsh r0, [r2, r3] - cmp r0, 0 - ble _080A659C - subs r0, r1, 0x1 - strh r0, [r2, 0x2E] - ldrh r0, [r2, 0x30] - ldrh r1, [r2, 0x34] - adds r0, r1 - strh r0, [r2, 0x34] - ldrh r1, [r2, 0x32] - ldrh r3, [r2, 0x36] - adds r1, r3 - strh r1, [r2, 0x36] - lsls r0, 16 - asrs r0, 24 - strh r0, [r2, 0x24] - lsls r1, 16 - asrs r1, 24 - strh r1, [r2, 0x26] - b _080A65A2 -_080A659C: - adds r0, r2, 0 - bl sub_80A62DC -_080A65A2: - pop {r0} - bx r0 - thumb_func_end sub_80A656C - - thumb_func_start sub_80A65A8 -sub_80A65A8: @ 80A65A8 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _080A65D8 - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x30] - ldrh r1, [r4, 0x34] - adds r0, r1 - strh r0, [r4, 0x34] - ldrh r1, [r4, 0x32] - ldrh r2, [r4, 0x36] - adds r1, r2 - strh r1, [r4, 0x36] - lsls r0, 16 - asrs r0, 24 - strh r0, [r4, 0x24] - lsls r1, 16 - asrs r1, 24 - strh r1, [r4, 0x26] - b _080A65DE -_080A65D8: - adds r0, r4, 0 - bl sub_80A62DC -_080A65DE: - adds r0, r4, 0 - bl UpdateMonIconFrame - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A65A8 - - thumb_func_start sub_80A65EC -sub_80A65EC: @ 80A65EC - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x26] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x34] - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x32] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x36] - ldr r0, =sub_80A64D0 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A65EC - - thumb_func_start sub_80A6630 -sub_80A6630: @ 80A6630 - push {r4,lr} - adds r3, r0, 0 - ldrh r1, [r3, 0x2E] - movs r2, 0x2E - ldrsh r0, [r3, r2] - cmp r0, 0 - ble _080A6674 - subs r0, r1, 0x1 - strh r0, [r3, 0x2E] - ldr r2, =gSprites - movs r4, 0x34 - ldrsh r1, [r3, r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x30] - ldrh r4, [r0, 0x24] - adds r1, r4 - strh r1, [r0, 0x24] - movs r0, 0x34 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x32] - ldrh r2, [r0, 0x26] - adds r1, r2 - strh r1, [r0, 0x26] - b _080A667A - .pool -_080A6674: - adds r0, r3, 0 - bl sub_80A62DC -_080A667A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6630 - - thumb_func_start sub_80A6680 -sub_80A6680: @ 80A6680 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _080A66D0 - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] - ldrh r1, [r4, 0x30] - ldrh r0, [r4, 0x34] - adds r1, r0 - strh r1, [r4, 0x34] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x36] - adds r0, r2 - strh r0, [r4, 0x36] - ldr r3, =gSprites - movs r0, 0x38 - ldrsh r2, [r4, r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - lsls r1, 16 - asrs r1, 24 - strh r1, [r0, 0x24] - movs r1, 0x38 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrh r0, [r4, 0x36] - lsls r0, 16 - asrs r0, 24 - strh r0, [r1, 0x26] - b _080A66D6 - .pool -_080A66D0: - adds r0, r4, 0 - bl sub_80A62DC -_080A66D6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6680 - - thumb_func_start sub_80A66DC -sub_80A66DC: @ 80A66DC - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _080A673E - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - lsls r0, r1, 16 - asrs r0, 24 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x30] - adds r1, r0 - strh r1, [r4, 0x32] - ldrh r1, [r4, 0x36] - lsls r0, r1, 16 - asrs r0, 24 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x34] - adds r1, r0 - strh r1, [r4, 0x36] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl __modsi3 - cmp r0, 0 - bne _080A6744 - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080A6744 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - b _080A6744 -_080A673E: - adds r0, r4, 0 - bl sub_80A62DC -_080A6744: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A66DC - - thumb_func_start move_anim_8074EE0 -move_anim_8074EE0: @ 80A674C - push {r4,lr} - adds r4, r0, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroyAnimSprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end move_anim_8074EE0 - - thumb_func_start sub_80A6760 -sub_80A6760: @ 80A6760 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x26] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x34] - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x32] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x36] - ldr r0, =sub_80A64D0 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6760 - - thumb_func_start sub_80A67A4 -sub_80A67A4: @ 80A67A4 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x38] - bl ResetPaletteStructByUid - adds r0, r4, 0 - bl move_anim_8074EE0 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A67A4 - - thumb_func_start sub_80A67BC -sub_80A67BC: @ 80A67BC - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080A67D2 - adds r0, r2, 0 - bl sub_80A62DC -_080A67D2: - pop {r0} - bx r0 - thumb_func_end sub_80A67BC - - thumb_func_start sub_80A67D8 -sub_80A67D8: @ 80A67D8 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080A67EE - adds r0, r2, 0 - bl sub_80A62DC -_080A67EE: - pop {r0} - bx r0 - thumb_func_end sub_80A67D8 - - thumb_func_start sub_80A67F4 -sub_80A67F4: @ 80A67F4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r4, 0 - bl DestroyAnimSprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A67F4 - - thumb_func_start sub_80A6814 -sub_80A6814: @ 80A6814 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6814 - - thumb_func_start sub_80A6838 -sub_80A6838: @ 80A6838 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6838 - - thumb_func_start sub_80A6864 -sub_80A6864: @ 80A6864 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - mov r8, r5 - ldr r7, =gBattleAnimAttacker - ldrb r0, [r7] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bhi _080A68B0 - cmp r6, r0 - bcs _080A68A4 - lsls r0, r5, 16 - b _080A68C0 - .pool -_080A68A4: - ldrb r0, [r7] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A68BC -_080A68B0: - ldrh r1, [r4, 0x20] - lsls r0, r5, 16 - asrs r0, 16 - subs r1, r0 - strh r1, [r4, 0x20] - b _080A68C8 -_080A68BC: - mov r1, r8 - lsls r0, r1, 16 -_080A68C0: - asrs r0, 16 - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] -_080A68C8: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80A6864 - - thumb_func_start sub_80A68D4 -sub_80A68D4: @ 80A68D4 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - movs r5, 0 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 - movs r0, 0x2E - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 8 - bl __divsi3 - strh r0, [r4, 0x3A] - strh r5, [r4, 0x3C] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A68D4 - - thumb_func_start AnimateBallThrow -AnimateBallThrow: @ 80A6900 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6F3C - lsls r0, 24 - cmp r0, 0 - bne _080A692C - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - lsls r0, 16 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - movs r0, 0 - b _080A692E -_080A692C: - movs r0, 0x1 -_080A692E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end AnimateBallThrow thumb_func_start sub_80A6934 sub_80A6934: @ 80A6934 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _080A6960 @@ -1732,13 +62,13 @@ sub_80A6980: @ 80A6980 ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -1768,7 +98,7 @@ sub_80A69CC: @ 80A69CC ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] @@ -1780,14 +110,14 @@ _080A69F0: ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 _080A6A04: - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -2344,8 +674,8 @@ sub_80A6E14: @ 80A6E14 bx r0 thumb_func_end sub_80A6E14 - thumb_func_start obj_translate_based_on_private_1_2_3_4 -obj_translate_based_on_private_1_2_3_4: @ 80A6E54 + thumb_func_start InitAnimLinearTranslation +InitAnimLinearTranslation: @ 80A6E54 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -2423,7 +753,7 @@ _080A6ED0: pop {r0} bx r0 .pool - thumb_func_end obj_translate_based_on_private_1_2_3_4 + thumb_func_end InitAnimLinearTranslation thumb_func_start sub_80A6EEC sub_80A6EEC: @ 80A6EEC @@ -2434,7 +764,7 @@ sub_80A6EEC: @ 80A6EEC ldrh r0, [r4, 0x22] strh r0, [r4, 0x34] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r1, =sub_80A6F98 str r1, [r4, 0x1C] adds r0, r4, 0 @@ -2454,7 +784,7 @@ sub_80A6F14: @ 80A6F14 ldrh r0, [r4, 0x22] strh r0, [r4, 0x34] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r1, =sub_80A6FB4 str r1, [r4, 0x1C] adds r0, r4, 0 @@ -2465,8 +795,8 @@ sub_80A6F14: @ 80A6F14 .pool thumb_func_end sub_80A6F14 - thumb_func_start sub_80A6F3C -sub_80A6F3C: @ 80A6F3C + thumb_func_start TranslateAnimLinear +TranslateAnimLinear: @ 80A6F3C push {r4-r6,lr} adds r2, r0, 0 movs r1, 0x2E @@ -2518,18 +848,18 @@ _080A6F90: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_80A6F3C + thumb_func_end TranslateAnimLinear thumb_func_start sub_80A6F98 sub_80A6F98: @ 80A6F98 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _080A6FAC adds r0, r4, 0 - bl sub_80A62DC + bl SetCallbackToStoredInData6 _080A6FAC: pop {r4} pop {r0} @@ -2542,12 +872,12 @@ sub_80A6FB4: @ 80A6FB4 adds r4, r0, 0 bl sub_8039E9C adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _080A6FCE adds r0, r4, 0 - bl sub_80A62DC + bl SetCallbackToStoredInData6 _080A6FCE: pop {r4} pop {r0} @@ -2573,7 +903,7 @@ _080A6FE8: bl __divsi3 strh r0, [r4, 0x2E] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation pop {r4} pop {r0} bx r0 @@ -2764,7 +1094,7 @@ sub_80A7144: @ 80A7144 cmp r0, 0 beq _080A7158 adds r0, r4, 0 - bl sub_80A62DC + bl SetCallbackToStoredInData6 _080A7158: pop {r4} pop {r0} @@ -3763,7 +2093,7 @@ _080A78CC: sub_80A791C: @ 80A791C push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _080A7930 @@ -4558,7 +2888,7 @@ _080A7F42: ldr r0, [r0] ldr r0, [r0, 0x18] ldrh r2, [r0] - ldr r1, =gUnknown_083021D8 + ldr r1, =gMonBackPicCoords lsls r0, r2, 2 adds r0, r1 ldrb r0, [r0, 0x1] @@ -4598,11 +2928,11 @@ _080A7FC0: _080A7FC2: cmp r2, r7 bne _080A7FD0 - ldr r0, =gUnknown_08525F8C + ldr r0, =gCastformBackSpriteYCoords b _080A8018 .pool _080A7FD0: - ldr r0, =gUnknown_083021D8 + ldr r0, =gMonBackPicCoords b _080A8026 .pool _080A7FD8: @@ -4633,7 +2963,7 @@ _080A8010: _080A8012: cmp r2, r7 bne _080A8024 - ldr r0, =gUnknown_08525F88 + ldr r0, =gCastformElevations _080A8018: ldrb r1, [r6] adds r1, r0 @@ -5350,7 +3680,7 @@ _080A85A0: mov r2, r10 lsls r1, r2, 16 asrs r1, 16 - ldr r3, =gUnknown_083021D8 + ldr r3, =gMonBackPicCoords _080A85B2: lsls r2, r6, 2 adds r2, r3 @@ -5467,7 +3797,7 @@ _080A8690: lsrs r0, 16 _080A869A: lsls r1, r0, 2 - ldr r0, =gUnknown_083021D8 + ldr r0, =gMonBackPicCoords b _080A8864 .pool _080A86A4: @@ -5481,7 +3811,7 @@ _080A86AC: cmp r7, r0 bhi _080A877C lsls r1, r7, 2 - ldr r0, =gUnknown_083021D8 + ldr r0, =gMonBackPicCoords b _080A8864 .pool _080A86C4: @@ -5562,7 +3892,7 @@ _080A8760: lsrs r0, 16 _080A876A: lsls r1, r0, 2 - ldr r0, =gUnknown_083021D8 + ldr r0, =gMonBackPicCoords b _080A8864 .pool _080A8774: @@ -5571,12 +3901,12 @@ _080A8774: cmp r7, r0 bls _080A8784 _080A877C: - ldr r4, =gUnknown_083021D8 + ldr r4, =gMonBackPicCoords b _080A8866 .pool _080A8784: lsls r1, r7, 2 - ldr r0, =gUnknown_083021D8 + ldr r0, =gMonBackPicCoords b _080A8864 .pool _080A8790: diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index 5b047a54d..df4f21408 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -183,7 +183,7 @@ sub_80FE988: @ 80FE988 lsrs r0, 24 strh r0, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldrh r0, [r6, 0x6] strh r0, [r4, 0x38] ldr r1, =sub_80FE9E4 @@ -200,7 +200,7 @@ sub_80FE988: @ 80FE988 sub_80FE9E4: @ 80FE9E4 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _080FE9FA @@ -350,7 +350,7 @@ sub_80FEAD8: @ 80FEAD8 sub_80FEB28: @ 80FEB28 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _080FEB3C @@ -541,7 +541,7 @@ _080FEC68: sub_80FECB8: @ 80FECB8 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _080FECE2 @@ -781,7 +781,7 @@ sub_80FEE78: @ 80FEE78 adds r0, r5 strh r0, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation movs r0, 0x40 strh r0, [r4, 0x38] ldr r1, =sub_80FEECC @@ -798,7 +798,7 @@ sub_80FEE78: @ 80FEE78 sub_80FEECC: @ 80FEECC push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _080FEF38 @@ -878,7 +878,7 @@ sub_80FEF44: @ 80FEF44 adds r0, r5 strh r0, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation movs r0, 0x40 strh r0, [r4, 0x38] ldr r1, =sub_80FEF98 @@ -895,7 +895,7 @@ sub_80FEF44: @ 80FEF44 sub_80FEF98: @ 80FEF98 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _080FEFF0 @@ -1175,7 +1175,7 @@ sub_80FF1C0: @ 80FF1C0 movs r0, 0x1 strh r0, [r6, 0x2E] adds r0, r6, 0 - bl AnimateBallThrow + bl TranslateAnimArc ldrh r0, [r6, 0x3C] strh r5, [r6, 0x2E] lsls r4, 16 @@ -3161,7 +3161,7 @@ _08100180: adds r1, r2, 0 bl sub_8100524 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 bne _08100196 @@ -3190,7 +3190,7 @@ _081001B4: adds r1, r2, 0 bl sub_8100524 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 bne _081001CA @@ -3219,7 +3219,7 @@ _081001E6: adds r1, r2, 0 bl sub_8100524 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 bne _081001FC @@ -3272,7 +3272,7 @@ _08100254: adds r1, r2, 0 bl sub_8100524 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 bne _0810026A @@ -3403,7 +3403,7 @@ _08100362: adds r1, r2, 0 bl sub_8100524 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 bne _08100378 @@ -3514,7 +3514,7 @@ _08100448: adds r1, r2, 0 bl sub_8100524 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _081004FC @@ -3566,7 +3566,7 @@ _081004B6: adds r1, r2, 0 bl sub_8100524 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _081004FC @@ -4869,7 +4869,7 @@ _08100F06: ldr r6, =gBattleAnimAttacker ldrb r0, [r6] movs r1, 0 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -4878,7 +4878,7 @@ _08100F06: strh r0, [r5, 0x20] ldrb r0, [r6] movs r1, 0x1 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x2] @@ -9082,7 +9082,7 @@ _08103074: subs r0, 0x28 strh r0, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldrh r0, [r5, 0x6] strh r0, [r4, 0x38] ldr r0, =sub_81030B0 @@ -9097,7 +9097,7 @@ _08103074: sub_81030B0: @ 81030B0 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _08103100 @@ -11528,7 +11528,7 @@ _08104448: adds r0, r6 strh r0, [r5, 0x36] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldrh r0, [r7] strh r0, [r5, 0x38] ldrh r0, [r5, 0x2E] @@ -11548,7 +11548,7 @@ _08104448: sub_81044BC: @ 81044BC push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _08104520 @@ -11659,7 +11659,7 @@ _0810458A: sub_8104594: @ 8104594 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _081045A8 @@ -12761,7 +12761,7 @@ sub_8104E74: @ 8104E74 adds r5, r1, r0 ldr r4, =gBattleAnimTarget ldrb r0, [r4] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 adds r0, 0x20 @@ -12969,7 +12969,7 @@ sub_810501C: @ 810501C movs r5, 0 strh r0, [r4, 0x20] ldrb r0, [r6] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 adds r0, 0x10 @@ -13271,7 +13271,7 @@ _0810526A: sub_8105284: @ 8105284 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _0810529E @@ -13526,7 +13526,7 @@ _0810549E: ldrh r0, [r2] strh r0, [r5, 0x2E] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r1, =sub_8105284 str r1, [r5, 0x1C] adds r0, r5, 0 @@ -15088,7 +15088,7 @@ sub_8106140: @ 8106140 lsrs r0, 24 strh r0, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r0, =sub_810618C str r0, [r4, 0x1C] pop {r4,r5} @@ -15101,7 +15101,7 @@ sub_8106140: @ 8106140 sub_810618C: @ 810618C push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _081061B6 @@ -17269,7 +17269,7 @@ _081072D8: lsrs r0, 24 strh r0, [r6, 0x36] adds r0, r6, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r0, =SpriteCallbackDummy bl CreateInvisibleSpriteWithCallback adds r4, r0, 0 @@ -17339,7 +17339,7 @@ sub_8107380: @ 8107380 movs r0, 0x1 strh r0, [r5, 0x2E] adds r0, r5, 0 - bl sub_80A6F3C + bl TranslateAnimLinear mov r1, r8 lsrs r6, r1, 8 movs r0, 0x2E @@ -17464,7 +17464,7 @@ _08107482: adds r0, r7 strh r0, [r5, 0x36] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r0, =sub_81074E4 str r0, [r5, 0x1C] adds r2, r5, 0 @@ -17502,7 +17502,7 @@ sub_81074E4: @ 81074E4 strb r0, [r2] _08107506: adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _08107518 @@ -17637,7 +17637,7 @@ sub_81075EC: @ 81075EC lsrs r0, 24 strh r0, [r5, 0x36] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation movs r0, 0x2E ldrsh r1, [r5, r0] movs r0, 0xD2 @@ -17678,7 +17678,7 @@ _08107660: sub_8107674: @ 8107674 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _08107688 @@ -20234,7 +20234,7 @@ _08108B1A: sub_8108B2C: @ 8108B2C push {r4-r6,lr} adds r6, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _08108B86 @@ -20283,7 +20283,7 @@ _08108B86: sub_8108B94: @ 8108B94 push {r4-r6,lr} adds r5, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _08108BD0 @@ -21144,7 +21144,7 @@ sub_8109244: @ 8109244 lsrs r0, 24 strh r0, [r5, 0x36] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r0, =sub_810929C str r0, [r5, 0x1C] _0810928E: @@ -21158,7 +21158,7 @@ _0810928E: sub_810929C: @ 810929C push {r4-r6,lr} adds r6, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _081092E4 @@ -22386,7 +22386,7 @@ _08109C3E: sub_8109C4C: @ 8109C4C push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _08109CA4 @@ -23433,7 +23433,7 @@ sub_810A46C: @ 810A46C lsrs r0, 24 strh r0, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldrh r0, [r5, 0x4] strh r0, [r4, 0x38] ldrh r0, [r5, 0xA] @@ -23468,7 +23468,7 @@ sub_810A46C: @ 810A46C sub_810A4F4: @ 810A4F4 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _0810A55E @@ -24336,7 +24336,7 @@ sub_810AB78: @ 810AB78 strh r0, [r4, 0x36] strh r6, [r4, 0x38] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r1, =sub_810ACC0 adds r0, r4, 0 bl StoreSpriteCallbackInData6 @@ -24394,7 +24394,7 @@ _0810AC86: sub_810AC8C: @ 810AC8C push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _0810ACB4 @@ -26828,7 +26828,7 @@ _0810BFCC: adds r0, r1 strh r0, [r5, 0x36] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation movs r0, 0x40 strh r0, [r5, 0x38] ldr r1, =sub_810C008 @@ -26845,7 +26845,7 @@ _0810BFCC: sub_810C008: @ 810C008 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _0810C092 @@ -27608,7 +27608,7 @@ _0810C684: strb r0, [r1] _0810C6B8: adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r0, =sub_810C6D4 str r0, [r5, 0x1C] pop {r3} @@ -27642,7 +27642,7 @@ _0810C6F4: b _0810C90C _0810C6F6: adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear ldr r1, =gSineTable movs r2, 0x38 ldrsh r0, [r4, r2] @@ -27731,12 +27731,12 @@ _0810C78E: ands r0, r1 strh r0, [r4, 0x38] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation b _0810C90C .pool _0810C7BC: adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear ldr r1, =gSineTable movs r2, 0x38 ldrsh r0, [r4, r2] @@ -27872,7 +27872,7 @@ _0810C8B6: .pool _0810C8D0: adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _0810C90C @@ -28414,7 +28414,7 @@ _0810CCCE: sub_810CD1C: @ 810CD1C push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0810CD3E @@ -29021,7 +29021,7 @@ _0810D1FE: strh r0, [r6, 0x34] strh r0, [r6, 0x36] adds r0, r6, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldrh r0, [r4, 0xA] strh r0, [r6, 0x38] ldrh r0, [r4, 0x8] @@ -29039,7 +29039,7 @@ _0810D1FE: sub_810D240: @ 810D240 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 bne _0810D26C @@ -29616,7 +29616,7 @@ sub_810D6A8: @ 810D6A8 lsrs r0, 24 strh r0, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r1, =move_anim_8074EE0 adds r0, r4, 0 bl StoreSpriteCallbackInData6 @@ -29892,7 +29892,7 @@ _0810D918: lsrs r0, 24 strh r0, [r5, 0x36] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r1, =DestroyAnimSprite adds r0, r5, 0 bl StoreSpriteCallbackInData6 @@ -30234,7 +30234,7 @@ _0810DBC2: sub_810DC10: @ 810DC10 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0810DC24 @@ -30309,7 +30309,7 @@ _0810DC72: sub_810DCB4: @ 810DCB4 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0810DCC8 @@ -30716,7 +30716,7 @@ _0810DFC8: adds r0, r4 strh r0, [r6, 0x36] adds r0, r6, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r0, =sub_80A67BC str r0, [r6, 0x1C] ldr r1, =sub_810E028 @@ -30732,7 +30732,7 @@ _0810DFC8: sub_810E028: @ 810E028 push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _0810E03C @@ -30971,7 +30971,7 @@ _0810E1FE: lsrs r0, 24 strh r0, [r5, 0x36] adds r0, r5, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation ldr r0, =sub_810E24C str r0, [r5, 0x1C] pop {r4,r5} @@ -30987,7 +30987,7 @@ sub_810E24C: @ 810E24C movs r0, 0x1 strh r0, [r4, 0x2E] adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear ldrh r1, [r4, 0x34] lsrs r0, r1, 8 cmp r0, 0xC8 @@ -34508,7 +34508,7 @@ _0810FDE8: sub_810FDF0: @ 810FDF0 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0810FE0E @@ -34537,7 +34537,7 @@ sub_810FE14: @ 810FE14 adds r4, r1, r0 ldr r0, =gBattleAnimTarget ldrb r0, [r0] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r1, r0, 24 adds r0, r1, 0 @@ -35235,7 +35235,7 @@ _081103C4: ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -35244,7 +35244,7 @@ _081103C4: strh r0, [r6, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x2] @@ -35314,7 +35314,7 @@ _08110478: ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -35323,7 +35323,7 @@ _08110478: strh r0, [r6, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x2] @@ -35426,7 +35426,7 @@ _0811055A: sub_811057C: @ 811057C push {r4,lr} adds r4, r0, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _08110592 @@ -35844,7 +35844,7 @@ sub_81108CC: @ 81108CC ands r1, r0 strb r1, [r2] adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _081108F8 @@ -35879,7 +35879,7 @@ _0811090E: lsls r0, 16 lsrs r6, r0, 16 adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 bne _08110988 @@ -37059,7 +37059,7 @@ _08111304: sub_811131C: @ 811131C push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0811134E @@ -37483,7 +37483,7 @@ sub_8111674: @ 8111674 adds r4, r0, 0 bl sub_8111764 adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _08111694 @@ -37541,7 +37541,7 @@ sub_81116E8: @ 81116E8 movs r0, 0x1 strh r0, [r4, 0x2E] adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear movs r1, 0x38 ldrsh r0, [r4, r1] movs r1, 0xA @@ -40203,7 +40203,7 @@ sub_8112C6C: @ 8112C6C lsrs r0, 24 strh r0, [r4, 0x1A] ldrb r0, [r5] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x1C] @@ -41135,7 +41135,7 @@ _0811342A: strb r5, [r0, 0x9] ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 adds r1, r0, 0 @@ -42031,7 +42031,7 @@ _08113B60: sub_8113B90: @ 8113B90 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _08113BA4 @@ -43699,7 +43699,7 @@ sub_8114994: @ 8114994 sub_81149FC: @ 81149FC push {r4,r5,lr} adds r5, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _08114A50 @@ -43746,7 +43746,7 @@ _08114A50: sub_8114A60: @ 8114A60 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _08114A74 @@ -43817,13 +43817,13 @@ sub_8114AF0: @ 8114AF0 ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r0, 24 mov r8, r0 ldrb r0, [r4] movs r1, 0x3 - bl sub_80A60AC + bl GetBattlerSpriteCoord2 lsls r0, 24 lsrs r7, r0, 24 bl Random2 @@ -44120,7 +44120,7 @@ _08114D78: strh r0, [r4, 0x22] ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 adds r1, r0, 0 @@ -44460,7 +44460,7 @@ _08115046: strh r0, [r4, 0x20] ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 adds r1, r0, 0 @@ -44663,7 +44663,7 @@ _081151DA: adds r0, r6 strh r0, [r5, 0x20] adds r0, r4, 0 - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 adds r0, 0x1E @@ -44693,7 +44693,7 @@ _081151DA: sub_8115228: @ 8115228 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0811523C @@ -44735,7 +44735,7 @@ _08115262: adds r0, r1 strh r0, [r6, 0x20] adds r0, r5, 0 - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 adds r0, 0x20 diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index 01ab7ed93..55d25cf31 100644 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -816,7 +816,7 @@ _0815A6F8: sub_815A73C: @ 815A73C push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0815A75E @@ -1625,7 +1625,7 @@ _0815ADDC: ldr r4, =gBattleAnimTarget _0815ADDE: ldrb r0, [r4] - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] @@ -6104,7 +6104,7 @@ _0815D26E: strh r0, [r4, 0x18] _0815D2A0: adds r0, r5, 0 - bl sub_80A6190 + bl GetBattlerYCoordWithElevation lsls r0, 24 lsrs r0, 24 subs r0, 0x22 @@ -8524,7 +8524,7 @@ _0815E5FE: lsls r0, 2 ldr r1, =gSprites adds r0, r1 - bl AnimateBallThrow + bl TranslateAnimArc ldrh r0, [r4, 0xC] adds r0, 0x1 strh r0, [r4, 0xC] @@ -8542,7 +8542,7 @@ _0815E634: lsls r0, 2 ldr r1, =gSprites adds r0, r1 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _0815E6D2 @@ -9804,11 +9804,11 @@ _0815F022: strh r0, [r4, 0x34] strh r1, [r4, 0x36] adds r0, r4, 0 - bl obj_translate_based_on_private_1_2_3_4 + bl InitAnimLinearTranslation b _0815F0F8 _0815F038: adds r0, r4, 0 - bl sub_80A6F3C + bl TranslateAnimLinear lsls r0, 24 cmp r0, 0 beq _0815F106 diff --git a/asm/battle_anim_8170478.s b/asm/battle_anim_8170478.s index e08568eba..ab3f27799 100644 --- a/asm/battle_anim_8170478.s +++ b/asm/battle_anim_8170478.s @@ -1487,7 +1487,7 @@ sub_8171134: @ 8171134 push {r4,r5,lr} sub sp, 0x4 adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _081711D2 @@ -2671,7 +2671,7 @@ sub_8171AAC: @ 8171AAC orrs r0, r1 strb r0, [r3] adds r0, r4, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _08171ADC @@ -5652,7 +5652,7 @@ _081733C0: sub_81733D4: @ 81733D4 push {r4,lr} adds r4, r0, 0 - bl AnimateBallThrow + bl TranslateAnimArc lsls r0, 24 cmp r0, 0 beq _081733F6 diff --git a/data/rom_8525F58.s b/data/rom_8525F58.s deleted file mode 100644 index d95af7e20..000000000 --- a/data/rom_8525F58.s +++ /dev/null @@ -1,34 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_08525F58:: @ 8525F58 - .byte 0x48, 0x50, 0x00, 0x00, 0xb0, 0x28, 0x00, 0x00 - .byte 0x30, 0x28, 0x00, 0x00, 0x70, 0x50, 0x00, 0x00 - .byte 0x20, 0x50, 0x00, 0x00, 0xc8, 0x28, 0x00, 0x00 - .byte 0x5a, 0x58, 0x00, 0x00, 0x98, 0x20, 0x00, 0x00 - - .align 2 -gCastformFrontSpriteCoords:: @ 8525F78 - .byte 0x44, 0x11, 0x00, 0x00, 0x66, 0x09, 0x00, 0x00 - .byte 0x46, 0x09, 0x00, 0x00, 0x86, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_08525F88:: @ 8525F88 - .byte 0x0d, 0x0e, 0x0d, 0x0d - - .align 2 -gUnknown_08525F8C:: @ 8525F8C - .byte 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_08525F90:: @ 8525F90 - spr_template 0xd755, 0xd755, gUnknown_0852497C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 0xd756, 0xd756, gUnknown_0852497C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_08525FC0:: @ 8525FC0 - obj_tiles gMiscBlank_Gfx, 0x0800, 0xd755 - obj_tiles gMiscBlank_Gfx, 0x0800, 0xd756 diff --git a/include/battle_anim.h b/include/battle_anim.h index f690cf10c..29de71077 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -72,17 +72,20 @@ void HandleIntroSlide(u8 terrainId); // battle_anim_80A5C6C.s void sub_80A6EEC(struct Sprite *sprite); void sub_80A68D4(struct Sprite *sprite); -void sub_80A6F3C(struct Sprite *sprite); +void TranslateAnimLinear(struct Sprite *sprite); void sub_80A8278(void); void sub_80A6B30(struct UnknownAnimStruct2*); void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); u8 sub_80A82E4(u8 battlerId); -bool8 AnimateBallThrow(struct Sprite *sprite); +bool8 TranslateAnimArc(struct Sprite *sprite); enum { - BANK_X_POS, - BANK_Y_POS, + BATTLER_COORD_X, + BATTLER_COORD_Y, + BATTLER_COORD_X_2, + BATTLER_COORD_3, + BATTLER_COORD_4, }; u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); @@ -107,6 +110,6 @@ u8 ItemIdToBallId(u16 itemId); u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId); u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 arg2, u8 ballId); -u8 sub_80A600C(u8, u16, u8); +u8 GetBattlerSpriteFinal_Y(u8, u16, u8); #endif // GUARD_BATTLE_ANIM_H diff --git a/include/contest.h b/include/contest.h index 0a8fa4436..d62d33ab7 100644 --- a/include/contest.h +++ b/include/contest.h @@ -239,14 +239,13 @@ struct Shared18000 struct ContestStruct_field_18 { - // unknown size - u16 field_0; - u16 field_2; - u16 field_4; - u16 field_6; - u32 field_8; - u32 field_C; - u32 field_10; + u16 unk0; + u16 unk2; + u8 unk4_0:1; + u8 unk5; + u32 unk8; + u32 unkC; + u32 unk10; }; struct Contest @@ -411,6 +410,7 @@ extern struct ContestResources *gContestResources; #define eContestAI (gContestResources->field_C) #define shared19328 (*gContestResources->field_10) #define shared19338 (*gContestResources->field_14) +#define shared19348 (*gContestResources->field_18) #define shared15800 (gHeap + 0x18000) #define shared18000 (*(struct Shared18000 *)(gHeap + 0x1a000)) diff --git a/ld_script.txt b/ld_script.txt index fc12789ce..8de971717 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -111,6 +111,7 @@ SECTIONS { src/palette.o(.text); src/sound.o(.text); src/battle_anim.o(.text); + src/battle_anim_80A5C6C.o(.text); asm/battle_anim_80A5C6C.o(.text); src/task.o(.text); src/reshow_battle_screen.o(.text); @@ -420,7 +421,7 @@ SECTIONS { data/fanfares.o(.rodata); data/battle_anims.o(.rodata); src/battle_anim.o(.rodata); - data/rom_8525F58.o(.rodata); + src/battle_anim_80A5C6C.o(.rodata); data/map_events.o(.rodata); data/battle_anim_80A9C70.o(.rodata); src/title_screen.o(.rodata); diff --git a/src/battle_anim.c b/src/battle_anim.c index ebaa8c6de..fa782d661 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -234,7 +234,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo else { for (i = 0; i < 4; i++) - gAnimBattlerSpecies[i] = gContestResources->field_18->field_0; + gAnimBattlerSpecies[i] = gContestResources->field_18->unk0; } if (!isMoveAnim) @@ -691,7 +691,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) battlerSpriteId = gBattlerSpriteIds[battlerId]; gBattle_BG1_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20; - if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->field_0)) + if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->unk0)) gBattle_BG1_X--; gBattle_BG1_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20; @@ -749,7 +749,7 @@ static void sub_80A46A0(void) struct UnknownAnimStruct2 unknownStruct; u16 *ptr; - if (IsSpeciesNotUnown(gContestResources->field_18->field_0)) + if (IsSpeciesNotUnown(gContestResources->field_18->unk0)) { sub_80A6B30(&unknownStruct); ptr = unknownStruct.unk4; diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c new file mode 100644 index 000000000..46e1e5b71 --- /dev/null +++ b/src/battle_anim_80A5C6C.c @@ -0,0 +1,741 @@ +#include "global.h" +#include "constants/battle_anim.h" +#include "constants/species.h" +#include "battle.h" +#include "battle_anim.h" +#include "blend_palette.h" +#include "contest.h" +#include "data2.h" +#include "decompress.h" +#include "palette.h" +#include "pokemon_icon.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "util.h" +#include "gpu_regs.h" + +#define GET_UNOWN_LETTER(personality) ((\ + (((personality & 0x03000000) >> 24) << 6) \ + | (((personality & 0x00030000) >> 16) << 4) \ + | (((personality & 0x00000300) >> 8) << 2) \ + | (((personality & 0x00000003) >> 0) << 0) \ +) % 28) + +#define IS_DOUBLE_BATTLE() ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + +extern const struct OamData gUnknown_0852497C; +extern const struct MonCoords gMonFrontPicCoords[]; +extern const struct MonCoords gMonBackPicCoords[]; +extern const u8 gEnemyMonElevation[]; + +// This file's functions. +void sub_80A64EC(struct Sprite *sprite); +void sub_80A653C(struct Sprite *sprite); +void InitAnimLinearTranslation(struct Sprite *sprite); +bool8 TranslateAnimLinear(struct Sprite *sprite); + +// Const rom data +const struct UCoords8 sBattlerCoords[][4] = +{ + { + { 72, 80 }, + { 176, 40 }, + { 48, 40 }, + { 112, 80 }, + }, + { + { 32, 80 }, + { 200, 40 }, + { 90, 88 }, + { 152, 32 }, + }, +}; + +// One entry for each of the four Castform forms. +const struct MonCoords gCastformFrontSpriteCoords[] = +{ + { 0x44, 17 }, // NORMAL + { 0x66, 9 }, // SUN + { 0x46, 9 }, // RAIN + { 0x86, 8 }, // HAIL +}; + +const u8 gCastformElevations[] = +{ + 13, // NORMAL + 14, // SUN + 13, // RAIN + 13, // HAIL +}; + +// Y position of the backsprite for each of the four Castform forms. +const u8 gCastformBackSpriteYCoords[] = +{ + 0, // NORMAL + 0, // SUN + 0, // RAIN + 0, // HAIL +}; + +const struct SpriteTemplate gUnknown_08525F90[] = +{ + { + .tileTag = 55125, + .paletteTag = 55125, + .oam = &gUnknown_0852497C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55126, + .paletteTag = 55126, + .oam = &gUnknown_0852497C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + } +}; + +const struct SpriteSheet gUnknown_08525FC0[] = +{ + { gMiscBlank_Gfx, 0x800, 55125, }, + { gMiscBlank_Gfx, 0x800, 55126, }, +}; + +// code +u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId) +{ + u8 retVal; + u16 species; + struct BattleSpriteInfo *spriteInfo; + + if (IsContest()) + { + if (attributeId == BATTLER_COORD_3 && battlerId == 3) + attributeId = BATTLER_COORD_Y; + } + + switch (attributeId) + { + case BATTLER_COORD_X: + case BATTLER_COORD_X_2: + retVal = sBattlerCoords[IS_DOUBLE_BATTLE()][GetBattlerPosition(battlerId)].x; + break; + case BATTLER_COORD_Y: + retVal = sBattlerCoords[IS_DOUBLE_BATTLE()][GetBattlerPosition(battlerId)].y; + break; + case BATTLER_COORD_3: + case BATTLER_COORD_4: + default: + if (IsContest()) + { + if (shared19348.unk4_0) + species = shared19348.unk2; + else + species = shared19348.unk0; + } + else + { + if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + else + species = spriteInfo[battlerId].transformSpecies; + } + else + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + else + species = spriteInfo[battlerId].transformSpecies; + } + } + if (attributeId == BATTLER_COORD_3) + retVal = GetBattlerSpriteFinal_Y(battlerId, species, TRUE); + else + retVal = GetBattlerSpriteFinal_Y(battlerId, species, FALSE); + break; + } + + return retVal; +} + +u8 GetBattlerYDelta(u8 battlerId, u16 species) +{ + u16 letter; + u32 personality; + struct BattleSpriteInfo *spriteInfo; + u8 ret; + u16 coordSpecies; + + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || IsContest()) + { + if (species == SPECIES_UNOWN) + { + if (IsContest()) + { + if (shared19348.unk4_0) + personality = shared19348.unk10; + else + personality = shared19348.unk8; + } + else + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY); + else + personality = gTransformedPersonalities[battlerId]; + } + letter = GET_UNOWN_LETTER(personality); + if (!letter) + coordSpecies = species; + else + coordSpecies = letter + SPECIES_UNOWN_B - 1; + ret = gMonBackPicCoords[coordSpecies].y_offset; + } + else if (species == SPECIES_CASTFORM) + { + ret = gCastformBackSpriteYCoords[gBattleMonForms[battlerId]]; + } + else if (species > NUM_SPECIES) + { + ret = gMonBackPicCoords[0].y_offset; + } + else + { + ret = gMonBackPicCoords[species].y_offset; + } + } + else + { + if (species == SPECIES_UNOWN) + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY); + else + personality = gTransformedPersonalities[battlerId]; + letter = GET_UNOWN_LETTER(personality); + if (!letter) + coordSpecies = species; + else + coordSpecies = letter + SPECIES_UNOWN_B - 1; + ret = gMonFrontPicCoords[coordSpecies].y_offset; + } + else if (species == SPECIES_CASTFORM) + { + ret = gCastformFrontSpriteCoords[gBattleMonForms[battlerId]].y_offset; + } + else if (species > NUM_SPECIES) + { + ret = gMonFrontPicCoords[0].y_offset; + } + else + { + ret = gMonFrontPicCoords[species].y_offset; + } + } + return ret; +} + +u8 GetBattlerElevation(u8 battlerId, u16 species) +{ + u8 ret = 0; + if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) + { + if (!IsContest()) + { + if (species == SPECIES_CASTFORM) + ret = gCastformElevations[gBattleMonForms[battlerId]]; + else if (species > NUM_SPECIES) + ret = gEnemyMonElevation[0]; + else + ret = gEnemyMonElevation[species]; + } + } + return ret; +} + +u8 GetBattlerSpriteFinal_Y(u8 battlerId, u16 species, bool8 a3) +{ + u16 offset; + u8 y; + + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || IsContest()) + { + offset = GetBattlerYDelta(battlerId, species); + } + else + { + offset = GetBattlerYDelta(battlerId, species); + offset -= GetBattlerElevation(battlerId, species); + } + y = offset + sBattlerCoords[IS_DOUBLE_BATTLE()][GetBattlerPosition(battlerId)].y; + if (a3) + { + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + y += 8; + if (y > 104) + y = 104; + } + return y; +} + +u8 GetBattlerSpriteCoord2(u8 battlerId, u8 attributeId) +{ + u16 species; + struct BattleSpriteInfo *spriteInfo; + + if (attributeId == BATTLER_COORD_3 || attributeId == BATTLER_COORD_4) + { + if (IsContest()) + { + if (shared19348.unk4_0) + species = shared19348.unk2; + else + species = shared19348.unk0; + } + else + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + species = gAnimBattlerSpecies[battlerId]; + else + species = spriteInfo[battlerId].transformSpecies; + } + if (attributeId == BATTLER_COORD_3) + return GetBattlerSpriteFinal_Y(battlerId, species, TRUE); + else + return GetBattlerSpriteFinal_Y(battlerId, species, FALSE); + } + else + { + return GetBattlerSpriteCoord(battlerId, attributeId); + } +} + +u8 GetBattlerSpriteDefault_Y(u8 battlerId) +{ + return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_4); +} + +u8 GetSubstituteSpriteDefault_Y(u8 battlerId) +{ + u16 y; + if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 16; + else + y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 17; + return y; +} + +u8 GetBattlerYCoordWithElevation(u8 battlerId) +{ + u16 species; + u8 y; + struct BattleSpriteInfo *spriteInfo; + + y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y); + if (!IsContest()) + { + if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + else + species = spriteInfo[battlerId].transformSpecies; + } + else + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + else + species = spriteInfo[battlerId].transformSpecies; + } + if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + y -= GetBattlerElevation(battlerId, species); + } + return y; +} + +u8 GetAnimBattlerSpriteId(u8 which) +{ + u8 *sprites; + + if (which == ANIM_ATTACKER) + { + if (IsBattlerSpritePresent(gBattleAnimAttacker)) + { + sprites = gBattlerSpriteIds; + return sprites[gBattleAnimAttacker]; + } + else + { + return 0xff; + } + } + else if (which == ANIM_TARGET) + { + if (IsBattlerSpritePresent(gBattleAnimTarget)) + { + sprites = gBattlerSpriteIds; + return sprites[gBattleAnimTarget]; + } + else + { + return 0xff; + } + } + else if (which == ANIM_ATK_PARTNER) + { + if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) + return 0xff; + else + return gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]; + } + else + { + if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget))) + return gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)]; + else + return 0xff; + } +} + +void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*callback)(struct Sprite*)) +{ + sprite->data[6] = (u32)(callback) & 0xffff; + sprite->data[7] = (u32)(callback) >> 16; +} + +void SetCallbackToStoredInData6(struct Sprite *sprite) +{ + u32 callback = (u16)sprite->data[6] | (sprite->data[7] << 16); + sprite->callback = (void (*)(struct Sprite *))callback; +} + +void sub_80A62EC(struct Sprite *sprite) +{ + if (sprite->data[3]) + { + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], sprite->data[1]); + sprite->data[0] += sprite->data[2]; + if (sprite->data[0] >= 0x100) + sprite->data[0] -= 0x100; + else if (sprite->data[0] < 0) + sprite->data[0] += 0x100; + sprite->data[3]--; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +void sub_80A634C(struct Sprite *sprite) +{ + if (sprite->data[3]) + { + sprite->pos2.x = Sin(sprite->data[0], (sprite->data[5] >> 8) + sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], (sprite->data[5] >> 8) + sprite->data[1]); + sprite->data[0] += sprite->data[2]; + sprite->data[5] += sprite->data[4]; + if (sprite->data[0] >= 0x100) + sprite->data[0] -= 0x100; + else if (sprite->data[0] < 0) + sprite->data[0] += 0x100; + sprite->data[3]--; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +void sub_80A63C8(struct Sprite *sprite) +{ + if (sprite->data[3]) + { + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[4], sprite->data[1]); + sprite->data[0] += sprite->data[2]; + sprite->data[4] += sprite->data[5]; + if (sprite->data[0] >= 0x100) + sprite->data[0] -= 0x100; + else if (sprite->data[0] < 0) + sprite->data[0] += 0x100; + if (sprite->data[4] >= 0x100) + sprite->data[4] -= 0x100; + else if (sprite->data[4] < 0) + sprite->data[4] += 0x100; + sprite->data[3]--; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +void sub_80A6450(struct Sprite *sprite) +{ + if (sprite->data[3]) + { + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], sprite->data[4]); + sprite->data[0] += sprite->data[2]; + if (sprite->data[0] >= 0x100) + sprite->data[0] -= 0x100; + else if (sprite->data[0] < 0) + sprite->data[0] += 0x100; + sprite->data[3]--; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +// Simply waits until the sprite's data[0] hits zero. +// This is used to let sprite anims or affine anims to run for a designated +// duration. +void sub_80A64B0(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + sprite->data[0]--; + else + SetCallbackToStoredInData6(sprite); +} + +void sub_80A64D0(struct Sprite *sprite) +{ + sub_80A64EC(sprite); + sprite->callback = sub_80A653C; + sprite->callback(sprite); +} + +void sub_80A64EC(struct Sprite *sprite) +{ + s16 old; + int v1; + + if (sprite->data[1] > sprite->data[2]) + sprite->data[0] = -sprite->data[0]; + v1 = sprite->data[2] - sprite->data[1]; + old = sprite->data[0]; + sprite->data[0] = abs(v1 / sprite->data[0]); + sprite->data[2] = (sprite->data[4] - sprite->data[3]) / sprite->data[0]; + sprite->data[1] = old; +} + +void sub_80A653C(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + sprite->pos2.x += sprite->data[1]; + sprite->pos2.y += sprite->data[2]; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +void sub_80A656C(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + sprite->data[3] += sprite->data[1]; + sprite->data[4] += sprite->data[2]; + sprite->pos2.x = sprite->data[3] >> 8; + sprite->pos2.y = sprite->data[4] >> 8; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +void sub_80A65A8(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + sprite->data[3] += sprite->data[1]; + sprite->data[4] += sprite->data[2]; + sprite->pos2.x = sprite->data[3] >> 8; + sprite->pos2.y = sprite->data[4] >> 8; + } + else + { + SetCallbackToStoredInData6(sprite); + } + UpdateMonIconFrame(sprite); +} + +void sub_80A65EC(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x + sprite->pos2.x; + sprite->data[3] = sprite->pos1.y + sprite->pos2.y; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->callback = sub_80A64D0; +} + +void sub_80A6630(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + gSprites[sprite->data[3]].pos2.x += sprite->data[1]; + gSprites[sprite->data[3]].pos2.y += sprite->data[2]; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +// Same as sub_80A6630, but it operates on sub-pixel values +// to handle slower translations. +void sub_80A6680(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + sprite->data[3] += sprite->data[1]; + sprite->data[4] += sprite->data[2]; + gSprites[sprite->data[5]].pos2.x = sprite->data[3] >> 8; + gSprites[sprite->data[5]].pos2.y = sprite->data[4] >> 8; + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +void sub_80A66DC(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + sprite->pos2.x = sprite->data[2] >> 8; + sprite->data[2] += sprite->data[1]; + sprite->pos2.y = sprite->data[4] >> 8; + sprite->data[4] += sprite->data[3]; + if (sprite->data[0] % sprite->data[5] == 0) + { + if (sprite->data[5]) + sprite->invisible ^= 1; + } + } + else + { + SetCallbackToStoredInData6(sprite); + } +} + +void move_anim_8074EE0(struct Sprite *sprite) +{ + FreeSpriteOamMatrix(sprite); + DestroyAnimSprite(sprite); +} + +void sub_80A6760(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x + sprite->pos2.x; + sprite->data[3] = sprite->pos1.y + sprite->pos2.y; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->callback = sub_80A64D0; +} + +void sub_80A67A4(struct Sprite *sprite) +{ + ResetPaletteStructByUid(sprite->data[5]); + move_anim_8074EE0(sprite); +} + +void sub_80A67BC(struct Sprite *sprite) +{ + if (sprite->affineAnimEnded) + SetCallbackToStoredInData6(sprite); +} + +void sub_80A67D8(struct Sprite *sprite) +{ + if (sprite->animEnded) + SetCallbackToStoredInData6(sprite); +} + +void sub_80A67F4(struct Sprite *sprite) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + DestroyAnimSprite(sprite); +} + +void sub_80A6814(u8 taskId) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + DestroyAnimVisualTask(taskId); +} + +void sub_80A6838(struct Sprite *sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); +} + +void sub_80A6864(struct Sprite *sprite, s16 a2) +{ + u16 v1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); + u16 v2 = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + + if (v1 > v2) + { + sprite->pos1.x -= a2; + } + else if (v1 < v2) + { + sprite->pos1.x += a2; + } + else + { + if (GetBattlerSide(gBattleAnimAttacker) != 0) + sprite->pos1.x -= a2; + else + sprite->pos1.x += a2; + } +} + +void sub_80A68D4(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + InitAnimLinearTranslation(sprite); + sprite->data[6] = 0x8000 / sprite->data[0]; + sprite->data[7] = 0; +} + +bool8 TranslateAnimArc(struct Sprite *sprite) +{ + if (TranslateAnimLinear(sprite)) + return TRUE; + sprite->data[7] += sprite->data[6]; + sprite->pos2.y += Sin((u8)(sprite->data[7] >> 8), sprite->data[5]); + return FALSE; +} diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index 5a829171e..6993bd2ee 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -131,7 +131,7 @@ void sub_8158D8C(u8 taskId) if (IsContest()) { if (gBattleAnimArgs[0] == ANIM_ATTACKER) - species = gContestResources->field_18->field_0; + species = gContestResources->field_18->unk0; else DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task. } @@ -177,7 +177,7 @@ void sub_8158E9C(u8 taskId) if (IsContest()) { if (gBattleAnimArgs[0] == ANIM_ATTACKER) - species = gContestResources->field_18->field_0; + species = gContestResources->field_18->unk0; else DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task. } @@ -281,7 +281,7 @@ void sub_81590B8(u8 taskId) pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER); if (IsContest()) - species = gContestResources->field_18->field_0; + species = gContestResources->field_18->unk0; else species = gAnimBattlerSpecies[gBattleAnimAttacker]; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index e5c8582a9..80e1574a4 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -899,14 +899,14 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform if (IsContest()) { position = 0; - targetSpecies = gContestResources->field_18->field_2; - personalityValue = gContestResources->field_18->field_8; - otId = gContestResources->field_18->field_C; + targetSpecies = gContestResources->field_18->unk2; + personalityValue = gContestResources->field_18->unk8; + otId = gContestResources->field_18->unkC; HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies], gMonSpritesGfxPtr->sprites[0], targetSpecies, - gContestResources->field_18->field_10); + gContestResources->field_18->unk10); } else { diff --git a/src/contest.c b/src/contest.c index 910637387..8eacc89c3 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2535,7 +2535,7 @@ u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index) LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20); SetMultiuseSpriteTemplateToPokemon(species, 0); - spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, sub_80A600C(2, species, 0), 30); + spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, GetBattlerSpriteFinal_Y(2, species, FALSE), 30); gSprites[spriteId].oam.paletteNum = 2; gSprites[spriteId].oam.priority = 2; gSprites[spriteId].subpriority = sub_80A82E4(2); diff --git a/src/data/pokemon_graphics/back_pic_coordinates.h b/src/data/pokemon_graphics/back_pic_coordinates.h index f54b409e4..877bf3475 100644 --- a/src/data/pokemon_graphics/back_pic_coordinates.h +++ b/src/data/pokemon_graphics/back_pic_coordinates.h @@ -1,4 +1,4 @@ -const struct MonCoords gUnknown_083021D8[] = +const struct MonCoords gMonBackPicCoords[] = { {0x88, 0x00}, // SPECIES_NONE {0x64, 0x10}, // SPECIES_BULBASAUR diff --git a/src/pokeball.c b/src/pokeball.c index 3dbbb2967..bb02a02ba 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -378,8 +378,8 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1; break; case POKEBALL_OPPONENT_SENDOUT: - gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(battlerId, BANK_X_POS); - gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(battlerId, BANK_Y_POS) + 24; + gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X); + gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 24; gBattlerTarget = battlerId; gSprites[ballSpriteId].data[0] = 0; gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut; @@ -399,8 +399,8 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) // this will perform an unused ball throw animation gSprites[ballSpriteId].data[0] = 0x22; - gSprites[ballSpriteId].data[2] = GetBattlerSpriteCoord(gBattlerTarget, BANK_X_POS); - gSprites[ballSpriteId].data[4] = GetBattlerSpriteCoord(gBattlerTarget, BANK_Y_POS) - 16; + gSprites[ballSpriteId].data[2] = GetBattlerSpriteCoord(gBattlerTarget, BATTLER_COORD_X); + gSprites[ballSpriteId].data[4] = GetBattlerSpriteCoord(gBattlerTarget, BATTLER_COORD_Y) - 16; gSprites[ballSpriteId].data[5] = -40; sub_80A68D4(&gSprites[ballSpriteId]); gSprites[ballSpriteId].oam.affineParam = taskId; @@ -411,7 +411,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) static void SpriteCB_TestBallThrow(struct Sprite *sprite) { - if (AnimateBallThrow(sprite)) + if (TranslateAnimArc(sprite)) { u16 ballId; u8 taskId = sprite->oam.affineParam; @@ -922,7 +922,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite) StartSpriteAffineAnim(sprite, 4); } r4 = sprite->data[0]; - sub_80A6F3C(sprite); + TranslateAnimLinear(sprite); sprite->data[7] += sprite->sBattler / 3; sprite->pos2.y += Sin(HIBYTE(sprite->data[7]), sprite->data[5]); sprite->oam.affineParam += 0x100; @@ -940,7 +940,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite) } else { - if (AnimateBallThrow(sprite)) + if (TranslateAnimArc(sprite)) { sprite->pos1.x += sprite->pos2.x; sprite->pos1.y += sprite->pos2.y; From 8c834b9ae8eccaf6a95583e632f2007715271cd9 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 7 Oct 2018 12:32:20 +0200 Subject: [PATCH 2/5] battle anim 80a5c6c decompiled --- asm/battle_anim_80A5C6C.s | 4856 ------------------------------------ asm/battle_anim_80FE840.s | 64 +- asm/battle_anim_815A0D4.s | 4 +- data/battle_anim_80FE840.s | 14 +- include/battle_anim.h | 16 +- ld_script.txt | 1 - src/battle_anim.c | 8 +- src/battle_anim_80A5C6C.c | 1742 ++++++++++++- sym_ewram.txt | 9 +- 9 files changed, 1788 insertions(+), 4926 deletions(-) delete mode 100644 asm/battle_anim_80A5C6C.s diff --git a/asm/battle_anim_80A5C6C.s b/asm/battle_anim_80A5C6C.s deleted file mode 100644 index 1bb3c7d9b..000000000 --- a/asm/battle_anim_80A5C6C.s +++ /dev/null @@ -1,4856 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start sub_80A6934 -sub_80A6934: @ 80A6934 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - bne _080A6960 - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - lsls r0, 16 - lsrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r0, 0 - b _080A6962 -_080A6960: - movs r0, 0x1 -_080A6962: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80A6934 - - thumb_func_start oamt_add_pos2_onto_pos1 -oamt_add_pos2_onto_pos1: @ 80A6968 - ldrh r1, [r0, 0x24] - ldrh r2, [r0, 0x20] - adds r1, r2 - movs r2, 0 - strh r1, [r0, 0x20] - ldrh r1, [r0, 0x26] - ldrh r3, [r0, 0x22] - adds r1, r3 - strh r1, [r0, 0x22] - strh r2, [r0, 0x24] - strh r2, [r0, 0x26] - bx lr - thumb_func_end oamt_add_pos2_onto_pos1 - - thumb_func_start sub_80A6980 -sub_80A6980: @ 80A6980 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 24 - cmp r1, 0 - bne _080A69A8 - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] -_080A69A8: - ldr r4, =gBattleAnimArgs - movs r0, 0 - ldrsh r1, [r4, r0] - adds r0, r5, 0 - bl sub_80A6864 - ldrh r0, [r4, 0x2] - ldrh r1, [r5, 0x22] - adds r0, r1 - strh r0, [r5, 0x22] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6980 - - thumb_func_start sub_80A69CC -sub_80A69CC: @ 80A69CC - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 24 - cmp r1, 0 - bne _080A69F0 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x1 - b _080A6A04 - .pool -_080A69F0: - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 -_080A6A04: - bl GetBattlerSpriteCoord2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldr r4, =gBattleAnimArgs - movs r0, 0 - ldrsh r1, [r4, r0] - adds r0, r5, 0 - bl sub_80A6864 - ldrh r0, [r4, 0x2] - ldrh r1, [r5, 0x22] - adds r0, r1 - strh r0, [r5, 0x22] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A69CC - - thumb_func_start GetBattlerSide -GetBattlerSide: @ 80A6A30 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gBattlerPositions - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end GetBattlerSide - - thumb_func_start GetBattlerPosition -GetBattlerPosition: @ 80A6A44 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gBattlerPositions - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetBattlerPosition - - thumb_func_start GetBattlerAtPosition -GetBattlerAtPosition: @ 80A6A54 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - movs r1, 0 - ldr r0, =gBattlersCount - ldrb r2, [r0] - cmp r1, r2 - bcs _080A6A7E - ldr r4, =gBattlerPositions - ldrb r0, [r4] - cmp r0, r3 - beq _080A6A7E -_080A6A6C: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - bcs _080A6A7E - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, r3 - bne _080A6A6C -_080A6A7E: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetBattlerAtPosition - - thumb_func_start IsBattlerSpritePresent -IsBattlerSpritePresent: @ 80A6A90 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A6ABC - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - cmp r0, r4 - beq _080A6B0A - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - cmp r0, r4 - beq _080A6B0A - b _080A6B18 - .pool -_080A6ABC: - ldr r0, =gBattlerPositions - adds r0, r4, r0 - ldrb r0, [r0] - cmp r0, 0xFF - beq _080A6B18 - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A6AF0 - ldr r1, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - b _080A6AFE - .pool -_080A6AF0: - ldr r1, =gBattlerPartyIndexes - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty -_080A6AFE: - adds r0, r1 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _080A6B18 -_080A6B0A: - movs r0, 0x1 - b _080A6B1A - .pool -_080A6B18: - movs r0, 0 -_080A6B1A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end IsBattlerSpritePresent - - thumb_func_start IsDoubleBattle -IsDoubleBattle: @ 80A6B20 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end IsDoubleBattle - - thumb_func_start sub_80A6B30 -sub_80A6B30: @ 80A6B30 - push {r4,lr} - adds r4, r0, 0 - bl IsContest - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _080A6B64 - ldr r0, =gUnknown_0202305C - ldr r0, [r0] - str r0, [r4] - ldr r0, =gUnknown_02023060 - ldr r0, [r0] - str r0, [r4, 0x4] - movs r1, 0 - movs r0, 0xE - strb r0, [r4, 0x8] - movs r0, 0x1 - strb r0, [r4, 0x9] - strh r1, [r4, 0xA] - b _080A6B7E - .pool -_080A6B64: - ldr r0, =gUnknown_0202305C - ldr r0, [r0] - str r0, [r4] - ldr r0, =gUnknown_02023060 - ldr r0, [r0] - str r0, [r4, 0x4] - movs r0, 0x8 - strb r0, [r4, 0x8] - movs r0, 0x1 - strb r0, [r4, 0x9] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0xA] -_080A6B7E: - strh r1, [r4, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6B30 - - thumb_func_start sub_80A6B90 -sub_80A6B90: @ 80A6B90 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl IsContest - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _080A6BC4 - ldr r0, =gUnknown_0202305C - ldr r0, [r0] - str r0, [r4] - ldr r0, =gUnknown_02023060 - ldr r0, [r0] - str r0, [r4, 0x4] - movs r1, 0 - movs r0, 0xE - strb r0, [r4, 0x8] - movs r0, 0x1 - strb r0, [r4, 0x9] - strh r1, [r4, 0xA] - b _080A6BEA - .pool -_080A6BC4: - cmp r5, 0x1 - bne _080A6BD0 - adds r0, r4, 0 - bl sub_80A6B30 - b _080A6BEC -_080A6BD0: - ldr r0, =gUnknown_0202305C - ldr r0, [r0] - str r0, [r4] - ldr r0, =gUnknown_02023060 - ldr r0, [r0] - str r0, [r4, 0x4] - movs r0, 0x9 - strb r0, [r4, 0x8] - movs r0, 0x2 - strb r0, [r4, 0x9] - movs r0, 0xC0 - lsls r0, 2 - strh r0, [r4, 0xA] -_080A6BEA: - strh r1, [r4, 0xC] -_080A6BEC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6B90 - - thumb_func_start sub_80A6BFC -sub_80A6BFC: @ 80A6BFC - push {r4,r5,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_0202305C - ldr r0, [r0] - str r0, [r4] - ldr r0, =gUnknown_02023060 - ldr r0, [r0] - str r0, [r4, 0x4] - bl IsContest - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _080A6C30 - movs r0, 0 - movs r1, 0xE - strb r1, [r4, 0x8] - movs r1, 0x1 - strb r1, [r4, 0x9] - strh r0, [r4, 0xA] - strh r0, [r4, 0xC] - b _080A6C60 - .pool -_080A6C30: - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl sub_80A8364 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x1 - bne _080A6C50 - movs r0, 0x8 - strb r0, [r4, 0x8] - strb r1, [r4, 0x9] - movs r0, 0x80 - lsls r0, 2 - b _080A6C5C - .pool -_080A6C50: - movs r0, 0x9 - strb r0, [r4, 0x8] - movs r0, 0x2 - strb r0, [r4, 0x9] - movs r0, 0xC0 - lsls r0, 2 -_080A6C5C: - strh r0, [r4, 0xA] - strh r5, [r4, 0xC] -_080A6C60: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A6BFC - - thumb_func_start sub_80A6C68 -sub_80A6C68: @ 80A6C68 - push {lr} - sub sp, 0x20 - adds r1, r0, 0 - add r0, sp, 0xC - bl sub_80A6B90 - movs r0, 0 - str r0, [sp, 0x1C] - add r0, sp, 0x1C - ldr r1, [sp, 0xC] - ldr r2, =0x05000800 - bl CpuSet - add r0, sp, 0xC - ldrb r0, [r0, 0x9] - ldr r1, [sp, 0xC] - movs r2, 0x80 - lsls r2, 6 - add r3, sp, 0xC - ldrh r3, [r3, 0xA] - bl LoadBgTiles - add r0, sp, 0xC - ldrb r0, [r0, 0x9] - movs r1, 0x20 - str r1, [sp] - movs r1, 0x40 - str r1, [sp, 0x4] - movs r1, 0x11 - str r1, [sp, 0x8] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - add r0, sp, 0xC - ldrb r0, [r0, 0x9] - bl CopyBgTilemapBufferToVram - add sp, 0x20 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6C68 - - thumb_func_start sub_80A6CC0 -sub_80A6CC0: @ 80A6CC0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - adds r5, r0, 0 - mov r8, r1 - adds r6, r2, 0 - movs r0, 0 - str r0, [sp] - ldr r4, =gUnknown_0202305C - ldr r1, [r4] - ldr r2, =0x05000800 - mov r0, sp - bl CpuSet - ldr r1, [r4] - mov r0, r8 - bl LZDecompressWram - lsls r5, 24 - lsrs r5, 24 - ldr r1, [r4] - movs r2, 0x80 - lsls r2, 6 - lsls r6, 16 - lsrs r6, 16 - adds r0, r5, 0 - adds r3, r6, 0 - bl LoadBgTiles - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6CC0 - - thumb_func_start sub_80A6D10 -sub_80A6D10: @ 80A6D10 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x20 - str r0, [sp] - movs r0, 0x40 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A6D10 - - thumb_func_start sub_80A6D48 -sub_80A6D48: @ 80A6D48 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6D10 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl CopyBgTilemapBufferToVram - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6D48 - - thumb_func_start sub_80A6D60 -sub_80A6D60: @ 80A6D60 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r2, 0 - ldrb r0, [r4, 0x9] - bl sub_80A6D10 - bl IsContest - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080A6D86 - ldrb r0, [r4, 0x8] - ldr r1, [r4, 0x4] - lsls r3, r5, 24 - lsrs r3, 24 - movs r2, 0 - bl sub_80A4720 -_080A6D86: - ldrb r0, [r4, 0x9] - bl CopyBgTilemapBufferToVram - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A6D60 - - thumb_func_start sub_80A6D94 -sub_80A6D94: @ 80A6D94 - push {lr} - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A6DA4 - movs r0, 0x2 - b _080A6DA6 -_080A6DA4: - movs r0, 0x1 -_080A6DA6: - pop {r1} - bx r1 - thumb_func_end sub_80A6D94 - - thumb_func_start sub_80A6DAC -sub_80A6DAC: @ 80A6DAC - push {lr} - lsls r0, 24 - cmp r0, 0 - beq _080A6DBE - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A6DD4 -_080A6DBE: - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl SetAnimBgAttribute - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0x1 - bl SetAnimBgAttribute - b _080A6DE8 -_080A6DD4: - movs r0, 0x3 - movs r1, 0 - movs r2, 0x1 - bl SetAnimBgAttribute - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0 - bl SetAnimBgAttribute -_080A6DE8: - pop {r0} - bx r0 - thumb_func_end sub_80A6DAC - - thumb_func_start sub_80A6DEC -sub_80A6DEC: @ 80A6DEC - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - adds r0, r4, 0 - bl sub_80A6E14 - ldr r1, =sub_80A65A8 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6DEC - - thumb_func_start sub_80A6E14 -sub_80A6E14: @ 80A6E14 - push {r4-r6,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x32] - ldrh r1, [r5, 0x30] - subs r0, r1 - ldrh r4, [r5, 0x36] - ldrh r1, [r5, 0x34] - subs r4, r1 - lsls r4, 24 - lsrs r4, 16 - lsls r0, 24 - asrs r0, 16 - movs r2, 0x2E - ldrsh r1, [r5, r2] - bl __divsi3 - movs r6, 0 - strh r0, [r5, 0x30] - lsls r4, 16 - asrs r4, 16 - movs r0, 0x2E - ldrsh r1, [r5, r0] - adds r0, r4, 0 - bl __divsi3 - strh r0, [r5, 0x32] - strh r6, [r5, 0x36] - strh r6, [r5, 0x34] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80A6E14 - - thumb_func_start InitAnimLinearTranslation -InitAnimLinearTranslation: @ 80A6E54 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - movs r0, 0x32 - ldrsh r1, [r7, r0] - movs r2, 0x30 - ldrsh r0, [r7, r2] - subs r1, r0 - movs r3, 0x36 - ldrsh r2, [r7, r3] - movs r3, 0x34 - ldrsh r0, [r7, r3] - subs r2, r0 - lsrs r0, r1, 31 - mov r8, r0 - lsrs r3, r2, 31 - mov r9, r3 - cmp r1, 0 - bge _080A6E80 - negs r1, r1 -_080A6E80: - lsls r0, r1, 24 - lsrs r6, r0, 16 - adds r0, r2, 0 - cmp r0, 0 - bge _080A6E8C - negs r0, r0 -_080A6E8C: - lsls r0, 24 - lsrs r5, r0, 16 - movs r0, 0x2E - ldrsh r4, [r7, r0] - adds r0, r6, 0 - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r6, r0, 16 - adds r0, r5, 0 - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r5, r0, 16 - mov r2, r8 - cmp r2, 0 - beq _080A6EB8 - movs r0, 0x1 - orrs r6, r0 - b _080A6EBC -_080A6EB8: - ldr r0, =0x0000fffe - ands r6, r0 -_080A6EBC: - mov r3, r9 - cmp r3, 0 - beq _080A6ECC - movs r0, 0x1 - orrs r5, r0 - b _080A6ED0 - .pool -_080A6ECC: - ldr r0, =0x0000fffe - ands r5, r0 -_080A6ED0: - movs r0, 0 - strh r6, [r7, 0x30] - strh r5, [r7, 0x32] - strh r0, [r7, 0x36] - strh r0, [r7, 0x34] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end InitAnimLinearTranslation - - thumb_func_start sub_80A6EEC -sub_80A6EEC: @ 80A6EEC - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - adds r0, r4, 0 - bl InitAnimLinearTranslation - ldr r1, =sub_80A6F98 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6EEC - - thumb_func_start sub_80A6F14 -sub_80A6F14: @ 80A6F14 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - adds r0, r4, 0 - bl InitAnimLinearTranslation - ldr r1, =sub_80A6FB4 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A6F14 - - thumb_func_start TranslateAnimLinear -TranslateAnimLinear: @ 80A6F3C - push {r4-r6,lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0 - bne _080A6F4C - movs r0, 0x1 - b _080A6F90 -_080A6F4C: - ldrh r1, [r2, 0x30] - ldrh r4, [r2, 0x32] - ldrh r6, [r2, 0x34] - ldrh r5, [r2, 0x36] - adds r0, r6, r1 - lsls r3, r0, 16 - lsrs r6, r3, 16 - adds r0, r5, r4 - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x1 - ands r1, r0 - cmp r1, 0 - beq _080A6F6E - lsrs r0, r3, 24 - negs r0, r0 - b _080A6F70 -_080A6F6E: - lsrs r0, r3, 24 -_080A6F70: - strh r0, [r2, 0x24] - movs r0, 0x1 - ands r4, r0 - cmp r4, 0 - beq _080A6F80 - lsrs r0, r5, 8 - negs r0, r0 - b _080A6F82 -_080A6F80: - lsrs r0, r5, 8 -_080A6F82: - strh r0, [r2, 0x26] - strh r6, [r2, 0x34] - strh r5, [r2, 0x36] - ldrh r0, [r2, 0x2E] - subs r0, 0x1 - strh r0, [r2, 0x2E] - movs r0, 0 -_080A6F90: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end TranslateAnimLinear - - thumb_func_start sub_80A6F98 -sub_80A6F98: @ 80A6F98 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - beq _080A6FAC - adds r0, r4, 0 - bl SetCallbackToStoredInData6 -_080A6FAC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6F98 - - thumb_func_start sub_80A6FB4 -sub_80A6FB4: @ 80A6FB4 - push {r4,lr} - adds r4, r0, 0 - bl sub_8039E9C - adds r0, r4, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - beq _080A6FCE - adds r0, r4, 0 - bl SetCallbackToStoredInData6 -_080A6FCE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6FB4 - - thumb_func_start sub_80A6FD4 -sub_80A6FD4: @ 80A6FD4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x30 - ldrsh r0, [r4, r2] - subs r0, r1, r0 - cmp r0, 0 - bge _080A6FE8 - negs r0, r0 -_080A6FE8: - lsls r0, 8 - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl InitAnimLinearTranslation - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A6FD4 - - thumb_func_start sub_80A7000 -sub_80A7000: @ 80A7000 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - adds r0, r4, 0 - bl sub_80A6FD4 - ldr r1, =sub_80A6F98 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7000 - - thumb_func_start sub_80A7028 -sub_80A7028: @ 80A7028 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - movs r0, 0x32 - ldrsh r1, [r7, r0] - movs r2, 0x30 - ldrsh r0, [r7, r2] - subs r1, r0 - movs r3, 0x36 - ldrsh r2, [r7, r3] - movs r3, 0x34 - ldrsh r0, [r7, r3] - subs r2, r0 - lsrs r0, r1, 31 - mov r8, r0 - lsrs r3, r2, 31 - mov r9, r3 - cmp r1, 0 - bge _080A7054 - negs r1, r1 -_080A7054: - lsls r0, r1, 20 - lsrs r6, r0, 16 - adds r0, r2, 0 - cmp r0, 0 - bge _080A7060 - negs r0, r0 -_080A7060: - lsls r0, 20 - lsrs r5, r0, 16 - movs r0, 0x2E - ldrsh r4, [r7, r0] - adds r0, r6, 0 - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r6, r0, 16 - adds r0, r5, 0 - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r5, r0, 16 - mov r2, r8 - cmp r2, 0 - beq _080A708C - movs r0, 0x1 - orrs r6, r0 - b _080A7090 -_080A708C: - ldr r0, =0x0000fffe - ands r6, r0 -_080A7090: - mov r3, r9 - cmp r3, 0 - beq _080A70A0 - movs r0, 0x1 - orrs r5, r0 - b _080A70A4 - .pool -_080A70A0: - ldr r0, =0x0000fffe - ands r5, r0 -_080A70A4: - movs r0, 0 - strh r6, [r7, 0x30] - strh r5, [r7, 0x32] - strh r0, [r7, 0x36] - strh r0, [r7, 0x34] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7028 - - thumb_func_start sub_80A70C0 -sub_80A70C0: @ 80A70C0 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - adds r0, r4, 0 - bl sub_80A7028 - ldr r1, =sub_80A7144 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A70C0 - - thumb_func_start sub_80A70E8 -sub_80A70E8: @ 80A70E8 - push {r4-r6,lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0 - bne _080A70F8 - movs r0, 0x1 - b _080A713C -_080A70F8: - ldrh r1, [r2, 0x30] - ldrh r4, [r2, 0x32] - ldrh r6, [r2, 0x34] - ldrh r5, [r2, 0x36] - adds r0, r6, r1 - lsls r3, r0, 16 - lsrs r6, r3, 16 - adds r0, r5, r4 - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x1 - ands r1, r0 - cmp r1, 0 - beq _080A711A - lsrs r0, r3, 20 - negs r0, r0 - b _080A711C -_080A711A: - lsrs r0, r3, 20 -_080A711C: - strh r0, [r2, 0x24] - movs r0, 0x1 - ands r4, r0 - cmp r4, 0 - beq _080A712C - lsrs r0, r5, 4 - negs r0, r0 - b _080A712E -_080A712C: - lsrs r0, r5, 4 -_080A712E: - strh r0, [r2, 0x26] - strh r6, [r2, 0x34] - strh r5, [r2, 0x36] - ldrh r0, [r2, 0x2E] - subs r0, 0x1 - strh r0, [r2, 0x2E] - movs r0, 0 -_080A713C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80A70E8 - - thumb_func_start sub_80A7144 -sub_80A7144: @ 80A7144 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A70E8 - lsls r0, 24 - cmp r0, 0 - beq _080A7158 - adds r0, r4, 0 - bl SetCallbackToStoredInData6 -_080A7158: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A7144 - - thumb_func_start sub_80A7160 -sub_80A7160: @ 80A7160 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x30 - ldrsh r0, [r4, r2] - subs r0, r1, r0 - cmp r0, 0 - bge _080A7174 - negs r0, r0 -_080A7174: - lsls r0, 4 - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_80A7028 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A7160 - - thumb_func_start sub_80A718C -sub_80A718C: @ 80A718C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - adds r0, r4, 0 - bl sub_80A7160 - ldr r1, =sub_80A7144 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A718C - - thumb_func_start obj_id_set_rotscale -obj_id_set_rotscale: @ 80A71B4 - push {r4,r5,lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsls r3, 16 - lsrs r3, 16 - ldr r5, =0xffff0000 - lsls r2, 16 - lsrs r1, 16 - orrs r1, r2 - str r1, [sp] - ldr r0, [sp, 0x4] - ands r0, r5 - orrs r0, r3 - str r0, [sp, 0x4] - bl sub_80A7238 - lsls r0, 24 - cmp r0, 0 - beq _080A71F0 - mov r0, sp - ldrh r0, [r0] - negs r0, r0 - lsls r0, 16 - lsrs r0, 16 - ldr r1, [sp] - ands r1, r5 - orrs r1, r0 - str r1, [sp] -_080A71F0: - ldr r1, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r4, [r0, 0x3] - lsls r4, 26 - lsrs r4, 27 - add r5, sp, 0x8 - mov r0, sp - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ObjAffineSet - ldr r0, =gOamMatrices - lsls r4, 3 - adds r4, r0 - ldrh r0, [r5] - strh r0, [r4] - ldrh r0, [r5, 0x2] - strh r0, [r4, 0x2] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x4] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x6] - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end obj_id_set_rotscale - - thumb_func_start sub_80A7238 -sub_80A7238: @ 80A7238 - push {r4,lr} - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A7268 - ldr r4, =gSprites - movs r0, 0 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - movs r2, 0x32 - ldrsh r0, [r1, r2] - cmp r0, 0xC9 - beq _080A7268 - movs r0, 0x1 - b _080A726A - .pool -_080A7268: - movs r0, 0 -_080A726A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80A7238 - - thumb_func_start sub_80A7270 -sub_80A7270: @ 80A7270 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - ldr r1, =gSprites - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r4, r0, r1 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r7, r0, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A72A6 - adds r0, r7, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A72B4 -_080A72A6: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_080A72B4: - ldr r1, =gSprites - lsls r4, r6, 4 - adds r0, r4, r6 - lsls r0, 2 - adds r5, r0, r1 - movs r0, 0x3 - mov r1, r8 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r5, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x1] - adds r2, r5, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A7312 - ldrb r0, [r5, 0x1] - lsls r0, 30 - cmp r0, 0 - bne _080A7312 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x6] - movs r0, 0x1F - ands r1, r0 - lsls r1, 1 - ldrb r2, [r5, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x3] -_080A7312: - ldr r1, =gSprites - adds r0, r4, r6 - lsls r0, 2 - adds r0, r1 - ldrb r3, [r0, 0x1] - movs r1, 0x3 - orrs r3, r1 - strb r3, [r0, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r0, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - bl CalcCenterToCornerVec - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7270 - - thumb_func_start sub_80A7344 -sub_80A7344: @ 80A7344 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl obj_id_set_rotscale - ldr r1, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrb r2, [r0, 0x1] - movs r1, 0x4 - negs r1, r1 - ands r1, r2 - movs r2, 0x1 - orrs r1, r2 - movs r2, 0xD - negs r2, r2 - ands r1, r2 - strb r1, [r0, 0x1] - adds r3, r0, 0 - adds r3, 0x2C - ldrb r2, [r3] - movs r1, 0x7F - ands r1, r2 - strb r1, [r3] - ldrb r3, [r0, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r0, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - bl CalcCenterToCornerVec - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7344 - - thumb_func_start sub_80A73A0 -sub_80A73A0: @ 80A73A0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r2, r1, r2 - ldrb r0, [r2, 0x3] - lsls r0, 26 - lsrs r0, 27 - ldr r1, =gOamMatrices - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x4] - movs r3, 0x4 - ldrsh r0, [r0, r3] - cmp r0, 0 - bge _080A73CC - negs r0, r0 - lsls r0, 16 - lsrs r1, r0, 16 -_080A73CC: - lsls r0, r1, 16 - asrs r0, 19 - strh r0, [r2, 0x26] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A73A0 - - thumb_func_start sub_80A73E0 -sub_80A73E0: @ 80A73E0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - adds r4, r0, 0 - ldr r0, [sp, 0x28] - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 16 - lsrs r5, r2, 16 - lsls r3, 16 - lsrs r7, r3, 16 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080A7486 - adds r0, r4, 0 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - cmp r6, 0 - beq _080A742E - ldrb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl CalcCenterToCornerVec -_080A742E: - ldr r6, =0xffff0000 - lsls r0, r7, 16 - orrs r5, r0 - str r5, [sp] - ldr r0, [sp, 0x4] - ands r0, r6 - mov r1, r8 - orrs r0, r1 - str r0, [sp, 0x4] - bl sub_80A7238 - lsls r0, 24 - cmp r0, 0 - beq _080A745C - mov r0, sp - ldrh r0, [r0] - negs r0, r0 - lsls r0, 16 - lsrs r0, 16 - ldr r1, [sp] - ands r1, r6 - orrs r1, r0 - str r1, [sp] -_080A745C: - ldrb r4, [r4, 0x3] - lsls r4, 26 - lsrs r4, 27 - add r5, sp, 0x8 - mov r0, sp - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ObjAffineSet - ldr r0, =gOamMatrices - lsls r4, 3 - adds r4, r0 - ldrh r0, [r5] - strh r0, [r4] - ldrh r0, [r5, 0x2] - strh r0, [r4, 0x2] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x4] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x6] -_080A7486: - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A73E0 - - thumb_func_start sub_80A749C -sub_80A749C: @ 80A749C - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r3, 0x80 - lsls r3, 1 - movs r0, 0 - str r0, [sp] - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r3, 0 - bl sub_80A73E0 - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldrb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl CalcCenterToCornerVec - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A749C - - thumb_func_start sub_80A74DC -sub_80A74DC: @ 80A74DC - push {lr} - lsls r0, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - bl ArcTan2 - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_80A74DC - - thumb_func_start sub_80A74F4 -sub_80A74F4: @ 80A74F4 - push {lr} - lsls r0, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - bl sub_80A74DC - lsls r0, 16 - negs r0, r0 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_80A74F4 - - thumb_func_start sub_80A750C -sub_80A750C: @ 80A750C - push {r4-r7,lr} - lsls r1, 24 - lsls r0, 20 - lsrs r0, 16 - cmp r1, 0 - bne _080A7588 - ldr r2, =gPlttBufferUnfaded - ldr r1, =gPlttBufferFaded - lsls r0, 1 - adds r4, r0, r1 - adds r5, r0, r2 - movs r6, 0xF -_080A7524: - ldr r0, [r5] - lsls r2, r0, 27 - lsrs r2, 27 - lsls r1, r0, 22 - lsrs r1, 27 - adds r2, r1 - lsls r0, 17 - lsrs r0, 27 - adds r0, r2 - movs r1, 0x3 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1F - ands r0, r1 - ldrb r1, [r4] - movs r3, 0x20 - negs r3, r3 - adds r2, r3, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r4] - lsls r3, r0, 5 - ldrh r1, [r4] - ldr r7, =0xfffffc1f - adds r2, r7, 0 - ands r1, r2 - orrs r1, r3 - strh r1, [r4] - lsls r0, 2 - ldrb r1, [r4, 0x1] - movs r3, 0x7D - negs r3, r3 - adds r2, r3, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r4, 0x1] - adds r4, 0x2 - adds r5, 0x2 - subs r6, 0x1 - cmp r6, 0 - bge _080A7524 - b _080A7598 - .pool -_080A7588: - lsls r1, r0, 1 - ldr r0, =gPlttBufferUnfaded - adds r0, r1, r0 - ldr r2, =gPlttBufferFaded - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet -_080A7598: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A750C - - thumb_func_start sub_80A75AC -sub_80A75AC: @ 80A75AC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r4, [sp, 0x28] - ldr r5, [sp, 0x2C] - ldr r6, [sp, 0x30] - lsls r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - lsls r4, 24 - lsrs r4, 24 - mov r10, r4 - lsls r5, 24 - lsrs r5, 24 - str r5, [sp] - lsls r6, 24 - lsrs r6, 24 - str r6, [sp, 0x4] - movs r4, 0 - cmp r0, 0 - beq _080A7602 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A75F6 - movs r4, 0xE - b _080A7602 -_080A75F6: - bl sub_80A6D94 - lsls r0, 24 - lsrs r0, 24 - movs r4, 0x1 - lsls r4, r0 -_080A7602: - cmp r7, 0 - beq _080A7614 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r1, r0, 0 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - orrs r4, r0 -_080A7614: - mov r0, r8 - cmp r0, 0 - beq _080A7628 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - adds r1, r0, 0 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - orrs r4, r0 -_080A7628: - mov r0, r9 - cmp r0, 0 - beq _080A764E - ldr r6, =gBattleAnimAttacker - ldrb r0, [r6] - movs r5, 0x2 - eors r0, r5 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A764E - ldrb r0, [r6] - eors r0, r5 - adds r1, r0, 0 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - orrs r4, r0 -_080A764E: - mov r0, r10 - cmp r0, 0 - beq _080A7674 - ldr r6, =gBattleAnimTarget - ldrb r0, [r6] - movs r5, 0x2 - eors r0, r5 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A7674 - ldrb r0, [r6] - eors r0, r5 - adds r1, r0, 0 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - orrs r4, r0 -_080A7674: - ldr r0, [sp] - cmp r0, 0 - beq _080A769A - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A7694 - movs r0, 0x80 - lsls r0, 1 - b _080A7698 - .pool -_080A7694: - movs r0, 0x80 - lsls r0, 7 -_080A7698: - orrs r4, r0 -_080A769A: - ldr r0, [sp, 0x4] - cmp r0, 0 - beq _080A76B0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A76B0 - movs r0, 0x80 - lsls r0, 2 - orrs r4, r0 -_080A76B0: - adds r0, r4, 0 - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A75AC - - thumb_func_start sub_80A76C4 -sub_80A76C4: @ 80A76C4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - movs r4, 0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A76F2 - cmp r5, 0 - beq _080A77A0 - movs r4, 0x80 - lsls r4, 11 - b _080A77A0 -_080A76F2: - cmp r5, 0 - beq _080A771A - movs r0, 0 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A771A - movs r0, 0 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x10 - movs r4, 0x1 - lsls r4, r0 -_080A771A: - cmp r6, 0 - beq _080A7746 - movs r0, 0x2 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A7746 - movs r0, 0x2 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - orrs r4, r0 -_080A7746: - cmp r7, 0 - beq _080A7772 - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A7772 - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - orrs r4, r0 -_080A7772: - mov r0, r8 - cmp r0, 0 - beq _080A77A0 - movs r0, 0x3 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A77A0 - movs r0, 0x3 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - orrs r4, r0 -_080A77A0: - adds r0, r4, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A76C4 - - thumb_func_start sub_80A77AC -sub_80A77AC: @ 80A77AC - lsls r0, 24 - lsrs r0, 24 - bx lr - thumb_func_end sub_80A77AC - - thumb_func_start sub_80A77B4 -sub_80A77B4: @ 80A77B4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80A77B4 - - thumb_func_start sub_80A77C8 -sub_80A77C8: @ 80A77C8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080A7806 - ldr r2, =gBattleAnimArgs - movs r3, 0x6 - ldrsh r0, [r2, r3] - movs r1, 0 - cmp r0, 0 - bne _080A77E2 - movs r1, 0x1 -_080A77E2: - movs r3, 0x4 - ldrsh r0, [r2, r3] - cmp r0, 0 - bne _080A77F8 - adds r0, r4, 0 - bl sub_80A69CC - b _080A77FE - .pool -_080A77F8: - adds r0, r4, 0 - bl sub_80A6980 -_080A77FE: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _080A781A -_080A7806: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0 - beq _080A781A - adds r0, r4, 0 - bl move_anim_8074EE0 -_080A781A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A77C8 - - thumb_func_start sub_80A7820 -sub_80A7820: @ 80A7820 - push {r4-r7,lr} - adds r5, r0, 0 - ldr r6, =gBattleAnimArgs - movs r1, 0xA - ldrsh r0, [r6, r1] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - movs r1, 0 - cmp r0, 0 - bne _080A7838 - movs r1, 0x1 -_080A7838: - ldrb r0, [r6, 0xA] - movs r7, 0x1 - cmp r0, 0 - bne _080A7842 - movs r7, 0x3 -_080A7842: - adds r0, r5, 0 - bl sub_80A69CC - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A785C - ldrh r0, [r6, 0x4] - negs r0, r0 - strh r0, [r6, 0x4] -_080A785C: - ldrh r0, [r6, 0x8] - strh r0, [r5, 0x2E] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r6, 0x4] - adds r0, r1 - strh r0, [r5, 0x32] - ldrb r0, [r4] - adds r1, r7, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r6, [r6, 0x6] - adds r0, r6 - strh r0, [r5, 0x36] - ldr r0, =sub_80A6EEC - str r0, [r5, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7820 - - thumb_func_start sub_80A78AC -sub_80A78AC: @ 80A78AC - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x1 - bl sub_80A69CC - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A78CC - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080A78CC: - ldr r4, =gBattleAnimArgs - ldrh r0, [r4, 0x8] - strh r0, [r6, 0x2E] - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x4] - adds r0, r1 - strh r0, [r6, 0x32] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x6] - adds r0, r1 - strh r0, [r6, 0x36] - ldrh r0, [r4, 0xA] - strh r0, [r6, 0x38] - adds r0, r6, 0 - bl sub_80A68D4 - ldr r0, =sub_80A791C - str r0, [r6, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A78AC - - thumb_func_start sub_80A791C -sub_80A791C: @ 80A791C - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _080A7930 - adds r0, r4, 0 - bl DestroyAnimSprite -_080A7930: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A791C - - thumb_func_start sub_80A7938 -sub_80A7938: @ 80A7938 - push {r4-r7,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r2, 0xC - ldrsh r1, [r0, r2] - cmp r1, 0 - bne _080A7950 - movs r4, 0x1 - movs r7, 0x3 - b _080A7954 - .pool -_080A7950: - movs r4, 0 - movs r7, 0x1 -_080A7954: - movs r1, 0xA - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080A796C - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80A69CC - ldr r0, =gBattleAnimAttacker - b _080A7976 - .pool -_080A796C: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80A6980 - ldr r0, =gBattleAnimTarget -_080A7976: - ldrb r6, [r0] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A798E - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080A798E: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80A6980 - ldr r4, =gBattleAnimArgs - ldrh r0, [r4, 0x8] - strh r0, [r5, 0x2E] - adds r0, r6, 0 - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r2, [r4, 0x4] - adds r0, r2 - strh r0, [r5, 0x32] - adds r0, r6, 0 - adds r1, r7, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r4, [r4, 0x6] - adds r0, r4 - strh r0, [r5, 0x36] - ldr r0, =sub_80A6EEC - str r0, [r5, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7938 - - thumb_func_start duplicate_obj_of_side_rel2move_in_transparent_mode -duplicate_obj_of_side_rel2move_in_transparent_mode: @ 80A79E8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _080A7A52 - movs r6, 0 - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r1, r0, 2 -_080A7A04: - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r4, r0, r2 - adds r5, r4, 0 - adds r5, 0x3E - ldrb r0, [r5] - lsls r0, 31 - cmp r0, 0 - bne _080A7A48 - adds r0, r4, 0 - adds r1, r2 - movs r2, 0x44 - bl memcpy - ldrb r1, [r4, 0x1] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r4, 0x1] - ldrb r0, [r5] - adds r2, 0x8 - adds r1, r2, 0 - ands r0, r1 - strb r0, [r5] - lsls r0, r6, 16 - asrs r0, 16 - b _080A7A56 - .pool -_080A7A48: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x3F - bls _080A7A04 -_080A7A52: - movs r0, 0x1 - negs r0, r0 -_080A7A56: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end duplicate_obj_of_side_rel2move_in_transparent_mode - - thumb_func_start obj_delete_but_dont_free_vram -obj_delete_but_dont_free_vram: @ 80A7A5C - push {lr} - adds r3, r0, 0 - adds r3, 0x3F - ldrb r1, [r3] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r3] - bl DestroySprite - pop {r0} - bx r0 - thumb_func_end obj_delete_but_dont_free_vram - - thumb_func_start sub_80A7A74 -sub_80A7A74: @ 80A7A74 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - movs r3, 0 - ldr r2, =gBattleAnimArgs - movs r0, 0x4 - ldrsh r1, [r2, r0] - movs r4, 0 - ldrsh r0, [r2, r4] - cmp r1, r0 - ble _080A7A8E - movs r3, 0x1 -_080A7A8E: - cmp r1, r0 - bge _080A7A94 - ldr r3, =0x0000ffff -_080A7A94: - movs r0, 0x6 - ldrsh r1, [r2, r0] - movs r4, 0x2 - ldrsh r0, [r2, r4] - cmp r1, r0 - ble _080A7AA2 - movs r6, 0x1 -_080A7AA2: - cmp r1, r0 - bge _080A7AA8 - ldr r6, =0x0000ffff -_080A7AA8: - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - movs r1, 0 - strh r1, [r4, 0x8] - ldrh r0, [r2, 0x8] - strh r0, [r4, 0xA] - strh r1, [r4, 0xC] - ldrh r0, [r2] - strh r0, [r4, 0xE] - ldrh r0, [r2, 0x2] - strh r0, [r4, 0x10] - strh r3, [r4, 0x12] - strh r6, [r4, 0x14] - ldrh r0, [r2, 0x4] - strh r0, [r4, 0x16] - ldrh r0, [r2, 0x6] - strh r0, [r4, 0x18] - ldrh r1, [r2, 0x2] - lsls r1, 8 - ldrh r0, [r2] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldr r0, =sub_80A7AFC - str r0, [r4] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7A74 - - thumb_func_start sub_80A7AFC -sub_80A7AFC: @ 80A7AFC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 16 - movs r2, 0xA - ldrsh r1, [r4, r2] - cmp r0, r1 - ble _080A7B90 - movs r0, 0 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080A7B4C - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r1, [r4, r3] - movs r3, 0x16 - ldrsh r0, [r4, r3] - cmp r1, r0 - beq _080A7B60 - ldrh r0, [r4, 0x12] - adds r0, r2, r0 - strh r0, [r4, 0xE] - b _080A7B60 - .pool -_080A7B4C: - ldrh r2, [r4, 0x10] - movs r0, 0x10 - ldrsh r1, [r4, r0] - movs r3, 0x18 - ldrsh r0, [r4, r3] - cmp r1, r0 - beq _080A7B60 - ldrh r0, [r4, 0x14] - adds r0, r2, r0 - strh r0, [r4, 0x10] -_080A7B60: - ldrh r1, [r4, 0x10] - lsls r1, 8 - ldrh r0, [r4, 0xE] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r0, 0xE - ldrsh r1, [r4, r0] - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _080A7B90 - movs r3, 0x10 - ldrsh r1, [r4, r3] - movs r2, 0x18 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _080A7B90 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080A7B90: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A7AFC - - thumb_func_start AnimTask_BlendMonInAndOut -AnimTask_BlendMonInAndOut: @ 80A7B98 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattleAnimArgs - ldrb r0, [r0] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xFF - bne _080A7BBC - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _080A7BE2 - .pool -_080A7BBC: - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r2, =gSprites - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x5] - lsrs r1, 4 - lsls r1, 4 - ldr r3, =0x00000101 - adds r2, r3, 0 - adds r1, r2 - strh r1, [r0, 0x8] - bl sub_80A7BF4 -_080A7BE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_BlendMonInAndOut - - thumb_func_start sub_80A7BF4 -sub_80A7BF4: @ 80A7BF4 - ldr r3, =gBattleAnimArgs - ldrh r1, [r3, 0x2] - movs r2, 0 - strh r1, [r0, 0xA] - strh r2, [r0, 0xC] - ldrh r1, [r3, 0x4] - strh r1, [r0, 0xE] - strh r2, [r0, 0x10] - ldrh r1, [r3, 0x6] - strh r1, [r0, 0x12] - strh r2, [r0, 0x14] - ldrh r1, [r3, 0x8] - strh r1, [r0, 0x16] - ldr r1, =sub_80A7C1C - str r1, [r0] - bx lr - .pool - thumb_func_end sub_80A7BF4 - - thumb_func_start sub_80A7C1C -sub_80A7C1C: @ 80A7C1C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x12 - ldrsh r1, [r4, r2] - cmp r0, r1 - blt _080A7CAC - movs r0, 0 - strh r0, [r4, 0x10] - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080A7C78 - ldrh r2, [r4, 0xC] - adds r2, 0x1 - strh r2, [r4, 0xC] - ldrh r0, [r4, 0x8] - lsls r2, 24 - lsrs r2, 24 - ldrh r3, [r4, 0xA] - movs r1, 0xF - bl BlendPalette - movs r2, 0xC - ldrsh r1, [r4, r2] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _080A7CAC - movs r0, 0x1 - strh r0, [r4, 0x14] - b _080A7CAC - .pool -_080A7C78: - ldrh r2, [r4, 0xC] - subs r2, 0x1 - strh r2, [r4, 0xC] - ldrh r0, [r4, 0x8] - lsls r2, 24 - lsrs r2, 24 - ldrh r3, [r4, 0xA] - movs r1, 0xF - bl BlendPalette - movs r0, 0xC - ldrsh r1, [r4, r0] - cmp r1, 0 - bne _080A7CAC - ldrh r0, [r4, 0x16] - subs r0, 0x1 - strh r0, [r4, 0x16] - lsls r0, 16 - cmp r0, 0 - beq _080A7CA6 - strh r1, [r4, 0x10] - strh r1, [r4, 0x14] - b _080A7CAC -_080A7CA6: - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080A7CAC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A7C1C - - thumb_func_start sub_80A7CB4 -sub_80A7CB4: @ 80A7CB4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _080A7CD8 - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _080A7CEE - .pool -_080A7CD8: - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - lsls r1, r2, 4 - ldr r2, =0x00000101 - adds r1, r2 - strh r1, [r0, 0x8] - bl sub_80A7BF4 -_080A7CEE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7CB4 - - thumb_func_start sub_80A7CFC -sub_80A7CFC: @ 80A7CFC - push {r4,lr} - adds r3, r0, 0 - adds r4, r1, 0 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - strh r1, [r3, 0x16] - strh r1, [r3, 0x18] - strh r1, [r3, 0x1A] - strh r4, [r3, 0x26] - movs r0, 0x80 - lsls r0, 1 - strh r0, [r3, 0x1C] - strh r0, [r3, 0x1E] - strh r1, [r3, 0x20] - adds r0, r3, 0 - adds r0, 0x22 - adds r3, 0x24 - adds r1, r3, 0 - bl sub_80A8048 - adds r0, r4, 0 - movs r1, 0 - bl sub_80A7270 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A7CFC - - thumb_func_start sub_80A7D34 -sub_80A7D34: @ 80A7D34 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_02038444 - movs r1, 0x22 - ldrsh r0, [r4, r1] - movs r2, 0x24 - ldrsh r1, [r4, r2] - bl sub_80A8050 - movs r3, 0x16 - ldrsh r1, [r4, r3] - lsls r1, 3 - adds r1, r0, r1 - str r1, [r5] - movs r6, 0 - ldrsh r2, [r1, r6] - ldr r0, =0x00007ffe - cmp r2, r0 - beq _080A7DDC - cmp r2, r0 - bgt _080A7E3C - subs r0, 0x1 - cmp r2, r0 - beq _080A7DE2 - ldrb r0, [r1, 0x5] - cmp r0, 0 - bne _080A7D82 - ldrh r0, [r1] - strh r0, [r4, 0x1C] - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x1E] - ldrb r0, [r1, 0x4] - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] - adds r0, r1, 0 - adds r0, 0x8 - str r0, [r5] -_080A7D82: - ldr r1, [r5] - ldrh r0, [r1] - ldrh r2, [r4, 0x1C] - adds r0, r2 - strh r0, [r4, 0x1C] - ldrh r0, [r1, 0x2] - ldrh r3, [r4, 0x1E] - adds r0, r3 - strh r0, [r4, 0x1E] - ldrh r0, [r4, 0x20] - ldrb r1, [r1, 0x4] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - movs r6, 0x1C - ldrsh r1, [r4, r6] - movs r3, 0x1E - ldrsh r2, [r4, r3] - ldrh r3, [r4, 0x20] - bl obj_id_set_rotscale - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7E6C - ldrh r0, [r4, 0x18] - adds r0, 0x1 - strh r0, [r4, 0x18] - lsls r0, 16 - asrs r0, 16 - ldr r1, [r5] - ldrb r1, [r1, 0x5] - cmp r0, r1 - blt _080A7E62 - movs r0, 0 - strh r0, [r4, 0x18] - b _080A7E34 - .pool -_080A7DDC: - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x16] - b _080A7E62 -_080A7DE2: - ldrh r2, [r1, 0x2] - movs r6, 0x2 - ldrsh r0, [r1, r6] - cmp r0, 0 - beq _080A7E34 - ldrh r1, [r4, 0x1A] - movs r3, 0x1A - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _080A7E02 - subs r0, r1, 0x1 - strh r0, [r4, 0x1A] - lsls r0, 16 - cmp r0, 0 - bne _080A7E04 - b _080A7E34 -_080A7E02: - strh r2, [r4, 0x1A] -_080A7E04: - movs r6, 0x16 - ldrsh r0, [r4, r6] - cmp r0, 0 - beq _080A7E62 - ldr r3, =gUnknown_02038444 - ldr r5, =0x00007ffd -_080A7E10: - ldrh r2, [r4, 0x16] - subs r1, r2, 0x1 - strh r1, [r4, 0x16] - ldr r0, [r3] - subs r0, 0x8 - str r0, [r3] - movs r6, 0 - ldrsh r0, [r0, r6] - cmp r0, r5 - beq _080A7E60 - lsls r0, r1, 16 - cmp r0, 0 - bne _080A7E10 - b _080A7E62 - .pool -_080A7E34: - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] - b _080A7E62 -_080A7E3C: - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x26] - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7344 - movs r0, 0 - b _080A7E64 - .pool -_080A7E60: - strh r2, [r4, 0x16] -_080A7E62: - movs r0, 0x1 -_080A7E64: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80A7D34 - - thumb_func_start sub_80A7E6C -sub_80A7E6C: @ 80A7E6C - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_80A7F18 - lsls r0, 16 - lsrs r0, 15 - movs r1, 0x40 - subs r5, r1, r0 - ldr r1, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r4, r0, r1 - ldrb r1, [r4, 0x3] - lsls r1, 26 - lsrs r1, 27 - lsls r0, r5, 8 - ldr r2, =gOamMatrices - lsls r1, 3 - adds r1, r2 - movs r2, 0x6 - ldrsh r1, [r1, r2] - bl __divsi3 - cmp r0, 0x80 - ble _080A7EA8 - movs r0, 0x80 -_080A7EA8: - subs r0, r5, r0 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - strh r0, [r4, 0x26] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7E6C - - thumb_func_start sub_80A7EC0 -sub_80A7EC0: @ 80A7EC0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r0, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7F18 - lsls r0, 16 - lsrs r0, 15 - movs r1, 0x40 - subs r5, r1, r0 - ldr r1, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r4, r0, r1 - ldrb r1, [r4, 0x3] - lsls r1, 26 - lsrs r1, 27 - lsls r0, r5, 8 - ldr r2, =gOamMatrices - lsls r1, 3 - adds r1, r2 - movs r2, 0x6 - ldrsh r1, [r1, r2] - bl __divsi3 - cmp r0, 0x80 - ble _080A7F00 - movs r0, 0x80 -_080A7F00: - subs r0, r5, r0 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - strh r0, [r4, 0x26] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A7EC0 - - thumb_func_start sub_80A7F18 -sub_80A7F18: @ 80A7F18 - push {r4-r7,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x2E] - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r1, =gBattlerSpriteIds - ldr r7, =0x00000181 - ldr r0, =gBattleMonForms - adds r6, r5, r0 -_080A7F38: - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, r2 - beq _080A7F42 - b _080A8034 -_080A7F42: - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A7F78 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x18] - ldrh r2, [r0] - ldr r1, =gMonBackPicCoords - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0, 0x1] - b _080A8042 - .pool -_080A7F78: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080A7FD8 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r5, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A7FC0 - ldr r1, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r2, r0, 16 - b _080A7FC2 - .pool -_080A7FC0: - ldrh r2, [r1, 0x2] -_080A7FC2: - cmp r2, r7 - bne _080A7FD0 - ldr r0, =gCastformBackSpriteYCoords - b _080A8018 - .pool -_080A7FD0: - ldr r0, =gMonBackPicCoords - b _080A8026 - .pool -_080A7FD8: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r5, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A8010 - ldr r1, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r2, r0, 16 - b _080A8012 - .pool -_080A8010: - ldrh r2, [r1, 0x2] -_080A8012: - cmp r2, r7 - bne _080A8024 - ldr r0, =gCastformElevations -_080A8018: - ldrb r1, [r6] - adds r1, r0 - ldrb r0, [r1] - b _080A8042 - .pool -_080A8024: - ldr r0, =gMonFrontPicCoords -_080A8026: - lsls r1, r2, 2 - adds r1, r0 - ldrb r0, [r1, 0x1] - b _080A8042 - .pool -_080A8034: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x3 - bhi _080A8040 - b _080A7F38 -_080A8040: - movs r0, 0x40 -_080A8042: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A7F18 - - thumb_func_start sub_80A8048 -sub_80A8048: @ 80A8048 - strh r2, [r0] - asrs r2, 16 - strh r2, [r1] - bx lr - thumb_func_end sub_80A8048 - - thumb_func_start sub_80A8050 -sub_80A8050: @ 80A8050 - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - orrs r0, r1 - bx lr - thumb_func_end sub_80A8050 - - thumb_func_start sub_80A805C -sub_80A805C: @ 80A805C - push {r4-r6,lr} - mov r6, r8 - push {r6} - mov r8, r0 - adds r5, r3, 0 - ldr r0, [sp, 0x14] - ldr r4, [sp, 0x18] - ldr r6, [sp, 0x1C] - lsls r1, 24 - lsrs r1, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r6, 16 - lsrs r6, 16 - mov r3, r8 - strh r6, [r3, 0x18] - strh r1, [r3, 0x26] - strh r2, [r3, 0x1A] - strh r5, [r3, 0x1C] - strh r0, [r3, 0x22] - strh r4, [r3, 0x24] - lsls r0, 16 - asrs r0, 16 - lsls r2, 16 - asrs r2, 16 - subs r0, r2 - adds r1, r6, 0 - bl __divsi3 - mov r1, r8 - strh r0, [r1, 0x1E] - lsls r4, 16 - asrs r4, 16 - lsls r5, 16 - asrs r5, 16 - subs r4, r5 - adds r0, r4, 0 - adds r1, r6, 0 - bl __divsi3 - mov r3, r8 - strh r0, [r3, 0x20] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80A805C - - thumb_func_start sub_80A80C8 -sub_80A80C8: @ 80A80C8 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x18] - movs r2, 0x18 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _080A80DA - movs r0, 0 - b _080A8136 -_080A80DA: - subs r0, r1, 0x1 - strh r0, [r4, 0x18] - lsls r0, 16 - cmp r0, 0 - beq _080A80F4 - ldrh r0, [r4, 0x1E] - ldrh r3, [r4, 0x1A] - adds r0, r3 - strh r0, [r4, 0x1A] - ldrh r0, [r4, 0x20] - ldrh r1, [r4, 0x1C] - adds r0, r1 - b _080A80FA -_080A80F4: - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x1A] - ldrh r0, [r4, 0x24] -_080A80FA: - strh r0, [r4, 0x1C] - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x1A - ldrsh r1, [r4, r2] - movs r3, 0x1C - ldrsh r2, [r4, r3] - movs r3, 0 - bl obj_id_set_rotscale - movs r0, 0x18 - ldrsh r3, [r4, r0] - cmp r3, 0 - beq _080A8124 - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7E6C - b _080A8134 -_080A8124: - ldr r2, =gSprites - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r3, [r0, 0x26] -_080A8134: - ldrb r0, [r4, 0x18] -_080A8136: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A80C8 - - thumb_func_start AnimTask_GetFrustrationPowerLevel -AnimTask_GetFrustrationPowerLevel: @ 80A8140 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gAnimFriendship - ldrb r0, [r0] - movs r1, 0 - cmp r0, 0x1E - bls _080A815E - movs r1, 0x1 - cmp r0, 0x64 - bls _080A815E - movs r1, 0x3 - cmp r0, 0xC8 - bhi _080A815E - movs r1, 0x2 -_080A815E: - ldr r0, =gBattleAnimArgs - strh r1, [r0, 0xE] - adds r0, r2, 0 - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_GetFrustrationPowerLevel - - thumb_func_start sub_80A8174 -sub_80A8174: @ 80A8174 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r4, r0, 24 - adds r7, r4, 0 - ldr r6, =gBattleAnimTarget - ldrb r0, [r6] - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A81B4 - ldr r2, =gSprites - ldr r1, =gBattlerSpriteIds - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3 - adds r2, r4, 0 - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] -_080A81B4: - ldr r0, =gBattleAnimAttacker - mov r8, r0 - ldrb r0, [r0] - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A81EC - ldr r2, =gSprites - ldr r1, =gBattlerSpriteIds - mov r3, r8 - ldrb r0, [r3] - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3 - adds r2, r4, 0 - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] -_080A81EC: - ldrb r0, [r6] - movs r5, 0x2 - eors r0, r5 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A8224 - ldr r2, =gSprites - ldr r1, =gBattlerSpriteIds - ldrb r0, [r6] - eors r0, r5 - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3 - adds r2, r4, 0 - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] -_080A8224: - mov r1, r8 - ldrb r0, [r1] - eors r0, r5 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A825C - ldr r2, =gSprites - ldr r1, =gBattlerSpriteIds - mov r3, r8 - ldrb r0, [r3] - eors r0, r5 - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3 - ands r7, r0 - lsls r3, r7, 2 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] -_080A825C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8174 - - thumb_func_start sub_80A8278 -sub_80A8278: @ 80A8278 - push {r4-r6,lr} - movs r5, 0 - ldr r0, =gBattlersCount - ldrb r0, [r0] - cmp r5, r0 - bge _080A82D2 - ldr r6, =gSprites -_080A8286: - lsls r0, r5, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080A82C8 - adds r0, r4, 0 - bl sub_80A82E4 - ldr r3, =gBattlerSpriteIds - adds r3, r5, r3 - ldrb r2, [r3] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r6 - adds r1, 0x43 - strb r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r2, [r0, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r2, r1 - movs r1, 0x8 - orrs r2, r1 - strb r2, [r0, 0x5] -_080A82C8: - adds r5, 0x1 - ldr r0, =gBattlersCount - ldrb r0, [r0] - cmp r5, r0 - blt _080A8286 -_080A82D2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8278 - - thumb_func_start sub_80A82E4 -sub_80A82E4: @ 80A82E4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A8300 - cmp r4, 0x2 - bne _080A82FC - movs r0, 0x1E - b _080A8320 -_080A82FC: - movs r0, 0x28 - b _080A8320 -_080A8300: - adds r0, r4, 0 - bl GetBattlerPosition - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1E - cmp r0, 0 - beq _080A831E - movs r1, 0x14 - cmp r0, 0x2 - beq _080A831E - movs r1, 0x32 - cmp r0, 0x1 - bne _080A831E - movs r1, 0x28 -_080A831E: - adds r0, r1, 0 -_080A8320: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80A82E4 - - thumb_func_start sub_80A8328 -sub_80A8328: @ 80A8328 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - bl GetBattlerPosition - lsls r0, 24 - lsrs r4, r0, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A8344 - movs r0, 0x2 - b _080A835C -_080A8344: - cmp r4, 0 - beq _080A834C - cmp r4, 0x3 - bne _080A8350 -_080A834C: - movs r0, 0x2 - b _080A8352 -_080A8350: - movs r0, 0x1 -_080A8352: - movs r1, 0x4 - bl sub_8118140 - lsls r0, 24 - lsrs r0, 24 -_080A835C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80A8328 - - thumb_func_start sub_80A8364 -sub_80A8364: @ 80A8364 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A838A - adds r0, r4, 0 - bl GetBattlerPosition - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080A8386 - cmp r0, 0x3 - bne _080A838A -_080A8386: - movs r0, 0x2 - b _080A838C -_080A838A: - movs r0, 0x1 -_080A838C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80A8364 - - thumb_func_start sub_80A8394 -sub_80A8394: @ 80A8394 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r4, [sp, 0x30] - ldr r5, [sp, 0x34] - ldr r6, [sp, 0x38] - mov r8, r6 - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 16 - lsrs r3, 16 - mov r10, r3 - lsls r4, 16 - lsrs r4, 16 - str r4, [sp, 0x4] - lsls r5, 24 - lsrs r5, 24 - str r5, [sp, 0x8] - lsls r0, r7, 3 - ldr r1, =gUnknown_08525FC0 - adds r0, r1 - bl LoadSpriteSheet - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - ldr r1, =gUnknown_08525F90 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x2] - bl AllocSpritePalette - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gMonSpritesGfxPtr - ldr r0, [r4] - cmp r0, 0 - beq _080A8412 - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bne _080A8412 - movs r0, 0x80 - lsls r0, 6 - bl AllocZeroed - ldr r1, [r4] - movs r2, 0xBE - lsls r2, 1 - adds r1, r2 - str r0, [r1] -_080A8412: - mov r3, r9 - cmp r3, 0 - bne _080A84B0 - adds r0, r6, 0 - ldr r1, [sp, 0x3C] - mov r2, r8 - bl GetFrontSpritePalFromSpeciesAndPersonality - lsls r1, r5, 20 - movs r2, 0x80 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r3, [sp, 0x44] - cmp r3, 0x1 - beq _080A845E - ldr r0, [sp, 0x40] - lsls r1, r0, 24 - lsrs r1, 24 - movs r0, 0x5 - bl sub_80688F8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080A845E - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - ldr r2, [sp, 0x40] - lsls r0, r2, 2 - adds r0, r1 - ldrh r0, [r0, 0x2] - cmp r0, 0 - beq _080A8488 -_080A845E: - lsls r0, r6, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - movs r3, 0xBE - lsls r3, 1 - adds r1, r3 - ldr r1, [r1] - movs r2, 0x1 - b _080A850A - .pool -_080A8488: - lsls r0, r6, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - movs r2, 0xBE - lsls r2, 1 - adds r1, r2 - ldr r1, [r1] - movs r2, 0x1 - str r2, [sp] - adds r2, r6, 0 - mov r3, r8 - bl LoadSpecialPokePic_2 - b _080A8540 - .pool -_080A84B0: - adds r0, r6, 0 - ldr r1, [sp, 0x3C] - mov r2, r8 - bl GetFrontSpritePalFromSpeciesAndPersonality - lsls r1, r5, 20 - movs r3, 0x80 - lsls r3, 17 - adds r1, r3 - lsrs r1, 16 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r0, [sp, 0x44] - cmp r0, 0x1 - beq _080A84F6 - ldr r2, [sp, 0x40] - lsls r1, r2, 24 - lsrs r1, 24 - movs r0, 0x5 - bl sub_80688F8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080A84F6 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0] - ldr r3, [sp, 0x40] - lsls r0, r3, 2 - adds r0, r1 - ldrh r2, [r0, 0x2] - cmp r2, 0 - beq _080A8524 -_080A84F6: - lsls r0, r6, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - movs r2, 0xBE - lsls r2, 1 - adds r1, r2 - ldr r1, [r1] - movs r2, 0 -_080A850A: - str r2, [sp] - adds r2, r6, 0 - mov r3, r8 - bl LoadSpecialPokePic_DontHandleDeoxys - b _080A8540 - .pool -_080A8524: - lsls r0, r6, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - movs r3, 0xBE - lsls r3, 1 - adds r1, r3 - ldr r1, [r1] - str r2, [sp] - adds r2, r6, 0 - mov r3, r8 - bl LoadSpecialPokePic_2 -_080A8540: - ldr r5, =gMonSpritesGfxPtr - ldr r0, [r5] - movs r4, 0xBE - lsls r4, 1 - adds r0, r4 - ldr r0, [r0] - ldr r2, [sp, 0xC] - lsls r1, r2, 5 - ldr r3, =0x06010000 - adds r1, r3 - movs r2, 0x80 - lsls r2, 4 - movs r3, 0x1 - bl RequestDma3Copy - ldr r0, [r5] - adds r0, r4 - ldr r0, [r0] - bl Free - ldr r0, [r5] - adds r0, r4 - movs r1, 0 - str r1, [r0] - mov r0, r9 - cmp r0, 0 - bne _080A85A0 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 3 - ldr r1, =gUnknown_08525F90 - adds r0, r1 - mov r2, r10 - lsls r1, r2, 16 - asrs r1, 16 - ldr r3, =gMonFrontPicCoords - b _080A85B2 - .pool -_080A85A0: - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 3 - ldr r1, =gUnknown_08525F90 - adds r0, r1 - mov r2, r10 - lsls r1, r2, 16 - asrs r1, 16 - ldr r3, =gMonBackPicCoords -_080A85B2: - lsls r2, r6, 2 - adds r2, r3 - ldrb r2, [r2, 0x1] - ldr r3, [sp, 0x4] - adds r2, r3 - lsls r2, 16 - asrs r2, 16 - ldr r3, [sp, 0x8] - bl CreateSprite - lsls r0, 24 - lsrs r4, r0, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A85EE - ldr r3, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r1, r3, 0 - adds r1, 0x10 - adds r1, r0, r1 - ldr r2, =gUnknown_082FF6C0 - str r2, [r1] - adds r0, r3 - movs r1, 0 - bl StartSpriteAffineAnim -_080A85EE: - adds r0, r4, 0 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A8394 - - thumb_func_start sub_80A8610 -sub_80A8610: @ 80A8610 - push {lr} - bl DestroySpriteAndFreeResources - pop {r0} - bx r0 - thumb_func_end sub_80A8610 - - thumb_func_start sub_80A861C -sub_80A861C: @ 80A861C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A86C4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0x18] - ldrb r1, [r2, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080A8654 - ldrh r7, [r2, 0x2] - ldr r2, [r2, 0x10] - b _080A8658 - .pool -_080A8654: - ldrh r7, [r2] - ldr r2, [r2, 0x8] -_080A8658: - cmp r7, 0xC9 - bne _080A86A4 - movs r0, 0xC0 - lsls r0, 18 - ands r0, r2 - lsrs r0, 18 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r2 - lsrs r1, 12 - orrs r0, r1 - movs r1, 0xC0 - lsls r1, 2 - ands r1, r2 - lsrs r1, 6 - orrs r0, r1 - movs r1, 0x3 - ands r1, r2 - orrs r0, r1 - movs r1, 0x1C - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080A8690 - movs r0, 0xC9 - b _080A869A -_080A8690: - movs r1, 0xCE - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 -_080A869A: - lsls r1, r0, 2 - ldr r0, =gMonBackPicCoords - b _080A8864 - .pool -_080A86A4: - ldr r0, =0x00000181 - cmp r7, r0 - bne _080A86AC - b _080A8834 -_080A86AC: - movs r0, 0xCE - lsls r0, 1 - cmp r7, r0 - bhi _080A877C - lsls r1, r7, 2 - ldr r0, =gMonBackPicCoords - b _080A8864 - .pool -_080A86C4: - mov r0, r8 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080A8790 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - mov r1, r8 - lsls r2, r1, 2 - adds r1, r2, r0 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A871C - ldr r0, =gBattlerPartyIndexes - mov r1, r8 - lsls r4, r1, 1 - adds r4, r0 - ldrh r0, [r4] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - ldrh r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0 - bl GetMonData - adds r2, r0, 0 - b _080A8724 - .pool -_080A871C: - ldrh r7, [r1, 0x2] - ldr r0, =gTransformedPersonalities - adds r0, r2, r0 - ldr r2, [r0] -_080A8724: - cmp r7, 0xC9 - bne _080A8774 - movs r0, 0xC0 - lsls r0, 18 - ands r0, r2 - lsrs r0, 18 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r2 - lsrs r1, 12 - orrs r0, r1 - movs r1, 0xC0 - lsls r1, 2 - ands r1, r2 - lsrs r1, 6 - orrs r0, r1 - movs r1, 0x3 - ands r1, r2 - orrs r0, r1 - movs r1, 0x1C - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080A8760 - movs r0, 0xC9 - b _080A876A - .pool -_080A8760: - movs r1, 0xCE - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 -_080A876A: - lsls r1, r0, 2 - ldr r0, =gMonBackPicCoords - b _080A8864 - .pool -_080A8774: - movs r0, 0xCE - lsls r0, 1 - cmp r7, r0 - bls _080A8784 -_080A877C: - ldr r4, =gMonBackPicCoords - b _080A8866 - .pool -_080A8784: - lsls r1, r7, 2 - ldr r0, =gMonBackPicCoords - b _080A8864 - .pool -_080A8790: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0] - mov r1, r8 - lsls r2, r1, 2 - adds r1, r2, r0 - ldrh r0, [r1, 0x2] - cmp r0, 0 - bne _080A87DC - ldr r0, =gBattlerPartyIndexes - mov r1, r8 - lsls r4, r1, 1 - adds r4, r0 - ldrh r0, [r4] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gEnemyParty - adds r0, r5 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - ldrh r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0 - bl GetMonData - adds r2, r0, 0 - b _080A87E4 - .pool -_080A87DC: - ldrh r7, [r1, 0x2] - ldr r0, =gTransformedPersonalities - adds r0, r2, r0 - ldr r2, [r0] -_080A87E4: - cmp r7, 0xC9 - bne _080A882E - movs r0, 0xC0 - lsls r0, 18 - ands r0, r2 - lsrs r0, 18 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r2 - lsrs r1, 12 - orrs r0, r1 - movs r1, 0xC0 - lsls r1, 2 - ands r1, r2 - lsrs r1, 6 - orrs r0, r1 - movs r1, 0x3 - ands r1, r2 - orrs r0, r1 - movs r1, 0x1C - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080A8820 - movs r0, 0xC9 - b _080A882A - .pool -_080A8820: - movs r1, 0xCE - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 -_080A882A: - lsls r1, r0, 2 - b _080A8862 -_080A882E: - ldr r0, =0x00000181 - cmp r7, r0 - bne _080A8850 -_080A8834: - ldr r0, =gBattleMonForms - add r0, r8 - ldrb r0, [r0] - lsls r0, 2 - ldr r1, =gCastformFrontSpriteCoords - adds r4, r0, r1 - b _080A8866 - .pool -_080A8850: - movs r0, 0xCE - lsls r0, 1 - cmp r7, r0 - bls _080A8860 - ldr r4, =gMonFrontPicCoords - b _080A8866 - .pool -_080A8860: - lsls r1, r7, 2 -_080A8862: - ldr r0, =gMonFrontPicCoords -_080A8864: - adds r4, r1, r0 -_080A8866: - mov r0, r9 - cmp r0, 0x6 - bhi _080A8916 - lsls r0, 2 - ldr r1, =_080A8880 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080A8880: - .4byte _080A889C - .4byte _080A88A6 - .4byte _080A88D2 - .4byte _080A88EA - .4byte _080A88AE - .4byte _080A88C0 - .4byte _080A8902 -_080A889C: - ldrb r1, [r4] - movs r0, 0xF - ands r0, r1 - lsls r0, 3 - b _080A8918 -_080A88A6: - ldrb r0, [r4] - lsrs r0, 4 - lsls r0, 3 - b _080A8918 -_080A88AE: - mov r0, r8 - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r4] - lsrs r1, 4 - b _080A88E4 -_080A88C0: - mov r0, r8 - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r4] - lsrs r1, 4 - b _080A88FC -_080A88D2: - mov r0, r8 - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrb r2, [r4] - movs r1, 0xF - ands r1, r2 -_080A88E4: - lsls r1, 2 - subs r0, r1 - b _080A8918 -_080A88EA: - mov r0, r8 - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrb r2, [r4] - movs r1, 0xF - ands r1, r2 -_080A88FC: - lsls r1, 2 - adds r0, r1 - b _080A8918 -_080A8902: - mov r0, r8 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1F - ldrb r1, [r4, 0x1] - subs r0, r1 - b _080A8918 -_080A8916: - movs r0, 0 -_080A8918: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A861C - - thumb_func_start sub_80A8924 -sub_80A8924: @ 80A8924 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r9, r2 - mov r10, r3 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - cmp r1, 0 - bne _080A8942 - movs r5, 0 - movs r6, 0x1 - b _080A8946 -_080A8942: - movs r5, 0x2 - movs r6, 0x3 -_080A8946: - adds r0, r4, 0 - adds r1, r5, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - adds r0, r4, 0 - adds r1, r6, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r7, r0, 24 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _080A8998 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080A8998 - movs r0, 0x2 - eors r4, r0 - adds r0, r4, 0 - adds r1, r5, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r4, 0 - adds r1, r6, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r3, r0, 24 - mov r0, r8 - lsls r1, r0, 16 - lsls r2, r7, 16 - b _080A89A4 -_080A8998: - mov r0, r8 - lsls r1, r0, 16 - lsrs r5, r1, 16 - lsls r0, r7, 16 - lsrs r3, r0, 16 - adds r2, r0, 0 -_080A89A4: - asrs r0, r1, 16 - adds r0, r5 - asrs r0, 1 - mov r1, r9 - strh r0, [r1] - asrs r0, r2, 16 - adds r0, r3 - asrs r0, 1 - mov r1, r10 - strh r0, [r1] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80A8924 - - thumb_func_start sub_80A89C8 -sub_80A89C8: @ 80A89C8 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0x4 - lsls r6, r1, 24 - lsrs r6, 24 - ldr r0, =SpriteCallbackDummy - mov r10, r0 - bl CreateInvisibleSpriteWithCallback - mov r8, r0 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gSprites - mov r9, r0 - mov r0, r8 - lsls r3, r0, 4 - add r3, r8 - lsls r3, 2 - mov r0, r9 - adds r5, r3, r0 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - add r4, r9 - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0x44 - str r3, [sp] - bl memcpy - adds r2, r5, 0 - adds r2, 0x3F - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - ldrb r2, [r5, 0x5] - movs r1, 0xD - negs r1, r1 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r5, 0x5] - ldrb r0, [r5, 0x1] - ands r1, r0 - movs r0, 0x8 - orrs r1, r0 - strb r1, [r5, 0x1] - ldrh r1, [r4, 0x4] - lsls r1, 22 - lsrs r1, 22 - ldrh r2, [r5, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x4] - movs r0, 0x1C - add r9, r0 - ldr r3, [sp] - add r3, r9 - mov r0, r10 - str r0, [r3] - mov r0, r8 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A89C8 - - thumb_func_start sub_80A8A6C -sub_80A8A6C: @ 80A8A6C - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6838 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A8AAC - ldr r2, =gBattleAnimArgs - ldrh r0, [r4, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x6] - negs r0, r0 - strh r0, [r2, 0x6] - adds r3, r4, 0 - adds r3, 0x3F - ldrb r0, [r3] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r3] - adds r1, r2, 0 - b _080A8AB6 - .pool -_080A8AAC: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] -_080A8AB6: - ldrh r0, [r1, 0x2] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x8] - strh r0, [r4, 0x34] - ldrh r0, [r1, 0xA] - strh r0, [r4, 0x38] - ldr r1, =move_anim_8074EE0 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A66DC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8A6C - - thumb_func_start sub_80A8AEC -sub_80A8AEC: @ 80A8AEC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A8B1C - ldr r2, =gBattleAnimArgs - ldrh r0, [r4, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r4, 0x20] - movs r1, 0x6 - ldrsh r0, [r2, r1] - negs r0, r0 - strh r0, [r2, 0x6] - adds r1, r2, 0 - b _080A8B26 - .pool -_080A8B1C: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] -_080A8B26: - ldrh r0, [r1, 0x2] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x8] - strh r0, [r4, 0x34] - ldrh r0, [r1, 0xA] - strh r0, [r4, 0x38] - ldrb r1, [r1, 0xC] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r1, =move_anim_8074EE0 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A66DC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8AEC - - thumb_func_start sub_80A8B64 -sub_80A8B64: @ 80A8B64 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6838 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080A8B90 - ldr r0, =gBattleAnimArgs - ldrh r1, [r4, 0x20] - ldrh r2, [r0] - subs r1, r2 - strh r1, [r4, 0x20] - b _080A8B9C - .pool -_080A8B90: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - adds r0, r1, 0 -_080A8B9C: - ldrh r0, [r0, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - ldr r0, =sub_80A67D8 - str r0, [r4, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8B64 - - thumb_func_start sub_80A8BC4 -sub_80A8BC4: @ 80A8BC4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r5, r1, r0 - movs r0, 0 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - movs r6, 0 - strh r0, [r5, 0x8] - ldr r7, =gBattleAnimAttacker - ldrb r0, [r7] - bl GetBattlerSide - lsls r0, 24 - movs r1, 0x8 - cmp r0, 0 - beq _080A8BF8 - movs r0, 0x8 - negs r0, r0 - adds r1, r0, 0 -_080A8BF8: - strh r1, [r5, 0xA] - strh r6, [r5, 0xC] - strh r6, [r5, 0xE] - ldr r4, =gSprites - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x24] - ldrh r2, [r5, 0x8] - subs r1, r2 - strh r1, [r0, 0x24] - ldr r0, =0x00002771 - bl AllocSpritePalette - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x10] - strh r6, [r5, 0x12] - movs r1, 0x10 - ldrsh r0, [r5, r1] - adds r0, 0x10 - lsls r0, 20 - lsrs r6, r0, 16 - movs r0, 0x8 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - adds r0, 0x10 - lsls r4, r0, 4 - ldrb r0, [r7] - bl sub_80A82E4 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x14] - cmp r0, 0x14 - beq _080A8C54 - cmp r0, 0x28 - bne _080A8C68 -_080A8C54: - movs r0, 0x2 - b _080A8C6A - .pool -_080A8C68: - movs r0, 0x3 -_080A8C6A: - strh r0, [r5, 0x14] - lsls r0, r4, 1 - ldr r1, =gPlttBufferUnfaded - adds r0, r1 - lsls r1, r6, 1 - ldr r2, =gPlttBufferFaded - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet - ldr r0, =gBattleAnimArgs - ldrb r2, [r0, 0x2] - ldrh r3, [r0] - adds r0, r6, 0 - movs r1, 0x10 - bl BlendPalette - ldr r0, =sub_80A8CAC - str r0, [r5] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8BC4 - - thumb_func_start sub_80A8CAC -sub_80A8CAC: @ 80A8CAC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080A8D10 - cmp r0, 0x1 - bgt _080A8CD4 - cmp r0, 0 - beq _080A8CDA - b _080A8D6C - .pool -_080A8CD4: - cmp r0, 0x2 - beq _080A8D58 - b _080A8D6C -_080A8CDA: - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80A8D78 - ldr r2, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0xA] - ldrh r2, [r0, 0x24] - adds r1, r2 - strh r1, [r0, 0x24] - ldrh r1, [r4, 0xE] - adds r0, r1, 0x1 - strh r0, [r4, 0xE] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _080A8D6C - strh r1, [r4, 0xE] - b _080A8D4A - .pool -_080A8D10: - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80A8D78 - ldr r3, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x24] - ldrh r2, [r4, 0xA] - subs r1, r2 - strh r1, [r0, 0x24] - ldrh r0, [r4, 0xE] - subs r0, 0x1 - strh r0, [r4, 0xE] - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0 - bne _080A8D6C - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - strh r2, [r1, 0x24] -_080A8D4A: - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - b _080A8D6C - .pool -_080A8D58: - movs r2, 0x12 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _080A8D6C - ldr r0, =0x00002771 - bl FreeSpritePaletteByTag - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080A8D6C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8CAC - - thumb_func_start sub_80A8D78 -sub_80A8D78: @ 80A8D78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r0, 0 - bl duplicate_obj_of_side_rel2move_in_transparent_mode - lsls r0, 16 - lsrs r7, r0, 16 - asrs r0, 16 - cmp r0, 0 - blt _080A8DE8 - ldr r5, =gSprites - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r3, r4, r5 - movs r0, 0x3 - ldrb r1, [r6, 0x14] - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - ldrb r1, [r6, 0x10] - lsls r1, 4 - movs r2, 0xF - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - movs r0, 0x8 - strh r0, [r3, 0x2E] - mov r0, r8 - strh r0, [r3, 0x30] - strh r7, [r3, 0x32] - movs r0, 0x8 - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r0, [r0, 0x24] - strh r0, [r3, 0x24] - adds r5, 0x1C - adds r4, r5 - ldr r0, =sub_80A8DFC - str r0, [r4] - ldrh r0, [r6, 0x12] - adds r0, 0x1 - strh r0, [r6, 0x12] -_080A8DE8: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8D78 - - thumb_func_start sub_80A8DFC -sub_80A8DFC: @ 80A8DFC - push {lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x2E] - subs r0, 0x1 - strh r0, [r3, 0x2E] - lsls r0, 16 - cmp r0, 0 - bne _080A8E26 - ldr r2, =gTasks - movs r0, 0x30 - ldrsh r1, [r3, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x12] - subs r1, 0x1 - strh r1, [r0, 0x12] - adds r0, r3, 0 - bl obj_delete_but_dont_free_vram -_080A8E26: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8DFC - - thumb_func_start sub_80A8E30 -sub_80A8E30: @ 80A8E30 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080A8E68 - movs r0, 0x5 - b _080A8E6A - .pool -_080A8E68: - ldr r0, =0x0000fff6 -_080A8E6A: - strh r0, [r5, 0x2E] - ldr r0, =0x0000ffd8 - strh r0, [r5, 0x30] - ldr r0, =sub_80A8E88 - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8E30 - - thumb_func_start sub_80A8E88 -sub_80A8E88: @ 80A8E88 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r5, [r4, 0x30] - ldrh r2, [r4, 0x34] - adds r0, r5, r2 - strh r0, [r4, 0x34] - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0xA - bl __divsi3 - strh r0, [r4, 0x24] - movs r2, 0x34 - ldrsh r0, [r4, r2] - movs r1, 0xA - bl __divsi3 - strh r0, [r4, 0x26] - lsls r0, r5, 16 - asrs r0, 16 - movs r1, 0x14 - negs r1, r1 - cmp r0, r1 - bge _080A8EC4 - adds r0, r5, 0x1 - strh r0, [r4, 0x30] -_080A8EC4: - movs r1, 0x22 - ldrsh r0, [r4, r1] - movs r2, 0x26 - ldrsh r1, [r4, r2] - adds r0, r1 - movs r1, 0x20 - negs r1, r1 - cmp r0, r1 - bge _080A8EDC - adds r0, r4, 0 - bl DestroyAnimSprite -_080A8EDC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A8E88 - - thumb_func_start sub_80A8EE4 -sub_80A8EE4: @ 80A8EE4 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x8] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r5, 0xA] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x36] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080A8F24 - ldrh r0, [r5, 0x8] - adds r0, 0x1E - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r5, 0xA] - subs r0, 0x14 - b _080A8F32 - .pool -_080A8F24: - ldrh r0, [r5, 0x8] - subs r0, 0x1E - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r5, 0xA] - subs r0, 0x50 -_080A8F32: - strh r0, [r4, 0x22] - ldr r0, =sub_80A6EEC - str r0, [r4, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A8EE4 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index df4f21408..620940730 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -1124,7 +1124,7 @@ _080FF154: adds r3, r5, 0 adds r3, 0x36 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions ldrh r0, [r6, 0x4] ldrh r1, [r5, 0x32] adds r0, r1 @@ -1272,7 +1272,7 @@ sub_80FF268: @ 80FF268 adds r3, r4, 0 adds r3, 0x22 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions _080FF28A: ldrh r0, [r4, 0x22] adds r0, 0x20 @@ -4152,7 +4152,7 @@ _08100918: subs r1, r5 lsls r1, 16 asrs r1, 16 - bl sub_80A74F4 + bl ArcTan2Neg lsls r0, 16 lsrs r4, r0, 16 bl IsContest @@ -5451,7 +5451,7 @@ _0810137A: adds r3, r5, 0 adds r3, 0x22 adds r0, r6, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions movs r2, 0 ldrsh r1, [r4, r2] adds r0, r5, 0 @@ -10172,7 +10172,7 @@ _0810390E: subs r1, r2 lsls r1, 16 asrs r1, 16 - bl sub_80A74F4 + bl ArcTan2Neg lsls r0, 16 movs r1, 0xF0 lsls r1, 24 @@ -10754,7 +10754,7 @@ _08103DB6: movs r1, 0 mov r2, sp mov r3, r10 - bl sub_80A8924 + bl SetAverageBattlerPositions b _08103E42 .pool _08103E20: @@ -11093,7 +11093,7 @@ _081040CC: subs r1, r2 lsls r1, 16 asrs r1, 16 - bl sub_80A74F4 + bl ArcTan2Neg lsls r0, 16 movs r1, 0xC0 lsls r1, 24 @@ -13220,7 +13220,7 @@ _081051F2: adds r1, r4, 0 mov r2, sp adds r3, r7, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions cmp r4, 0 bne _08105230 adds r0, r5, 0 @@ -13466,7 +13466,7 @@ _081053FA: mov r2, sp mov r3, sp adds r3, 0x2 - bl sub_80A8924 + bl SetAverageBattlerPositions b _0810546C .pool _0810544C: @@ -17006,7 +17006,7 @@ sub_81070AC: @ 81070AC adds r3, r5, 0 adds r3, 0x22 movs r1, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions ldrh r0, [r5, 0x22] adds r0, 0x28 strh r0, [r5, 0x22] @@ -26048,7 +26048,7 @@ _0810B990: adds r3, r4, 0 adds r3, 0x22 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide @@ -26155,7 +26155,7 @@ _0810BA74: adds r3, r5, 0 adds r3, 0x36 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions _0810BA86: ldr r0, =gBattleAnimAttacker ldrb r0, [r0] @@ -26454,7 +26454,7 @@ _0810BCE0: adds r3, r5, 0 adds r3, 0x36 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions _0810BCF2: ldr r0, =gBattleAnimAttacker ldrb r0, [r0] @@ -26652,7 +26652,7 @@ _0810BE6C: adds r3, r4, 0 adds r3, 0x22 movs r1, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide @@ -26719,7 +26719,7 @@ _0810BEF4: adds r3, r5, 0 adds r3, 0x22 movs r1, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -26762,7 +26762,7 @@ _0810BF52: adds r3, r5, 0 adds r3, 0x22 movs r1, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -27192,7 +27192,7 @@ sub_810C2F0: @ 810C2F0 lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] - ldr r0, =sub_80A7820 + ldr r0, =TranslateAnimSpriteToTargetMonLocation str r0, [r4, 0x1C] pop {r4,r5} pop {r0} @@ -30270,7 +30270,7 @@ _0810DC44: movs r1, 0x1 mov r2, sp adds r3, r6, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide @@ -30396,7 +30396,7 @@ sub_810DD50: @ 810DD50 adds r3, r4, 0 adds r3, 0x22 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide @@ -30457,7 +30457,7 @@ _0810DDE0: adds r3, r4, 0 adds r3, 0x22 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide @@ -30828,7 +30828,7 @@ _0810E0EC: adds r3, r5, 0 adds r3, 0x36 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions _0810E0FE: ldr r4, =gBattleAnimArgs ldrh r0, [r4, 0x4] @@ -32074,7 +32074,7 @@ sub_810EA4C: @ 810EA4C lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] - ldr r0, =sub_80A7820 + ldr r0, =TranslateAnimSpriteToTargetMonLocation str r0, [r4, 0x1C] pop {r4,r5} pop {r0} @@ -32913,7 +32913,7 @@ sub_810F084: @ 810F084 asrs r5, 16 adds r0, r4, 0 adds r1, r5, 0 - bl sub_80A74F4 + bl ArcTan2Neg lsls r0, 16 movs r1, 0xC0 lsls r1, 24 @@ -35407,7 +35407,7 @@ _08110548: adds r3, r5, 0 adds r3, 0x36 movs r1, 0x1 - bl sub_80A8924 + bl SetAverageBattlerPositions _0811055A: adds r0, r5, 0 bl sub_80A6FD4 @@ -35464,7 +35464,7 @@ sub_81105B4: @ 81105B4 adds r3, r4, 0 adds r3, 0x22 movs r1, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide @@ -35745,7 +35745,7 @@ _081107B2: subs r1, r2 lsls r1, 16 asrs r1, 16 - bl sub_80A74F4 + bl ArcTan2Neg lsls r0, 16 movs r1, 0xC0 lsls r1, 24 @@ -35899,7 +35899,7 @@ _0811090E: subs r1, r2 lsls r1, 16 asrs r1, 16 - bl sub_80A74F4 + bl ArcTan2Neg lsls r0, 16 movs r1, 0xC0 lsls r1, 24 @@ -35987,7 +35987,7 @@ sub_81109F0: @ 81109F0 adds r3, r5, 0 adds r3, 0x22 movs r1, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions _08110A10: ldrh r0, [r6] ldrh r1, [r5, 0x20] @@ -37205,7 +37205,7 @@ sub_8111418: @ 8111418 bl StartSpriteAffineAnim _08111434: adds r0, r4, 0 - bl sub_80A7820 + bl TranslateAnimSpriteToTargetMonLocation pop {r4} pop {r0} bx r0 @@ -50366,8 +50366,8 @@ _08118132: .pool thumb_func_end SetAnimBgAttribute - thumb_func_start sub_8118140 -sub_8118140: @ 8118140 + thumb_func_start GetAnimBgAttribute +GetAnimBgAttribute: @ 8118140 push {r4,lr} sub sp, 0x4 lsls r0, 24 @@ -50441,7 +50441,7 @@ _081181CA: pop {r4} pop {r1} bx r1 - thumb_func_end sub_8118140 + thumb_func_end GetAnimBgAttribute thumb_func_start HandleIntroSlide HandleIntroSlide: @ 81181D4 diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index 55d25cf31..b31af7d1e 100644 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -231,7 +231,7 @@ sub_815A254: @ 815A254 subs r1, r6 lsls r1, 16 asrs r1, 16 - bl sub_80A74F4 + bl ArcTan2Neg lsls r0, 16 movs r1, 0xC0 lsls r1, 23 @@ -775,7 +775,7 @@ sub_815A6C4: @ 815A6C4 movs r1, 0 mov r2, sp adds r3, r5, 0 - bl sub_80A8924 + bl SetAverageBattlerPositions ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide diff --git a/data/battle_anim_80FE840.s b/data/battle_anim_80FE840.s index bce7b3540..856f379d9 100644 --- a/data/battle_anim_80FE840.s +++ b/data/battle_anim_80FE840.s @@ -828,7 +828,7 @@ gUnknown_08592DE4:: @ 8592DE4 .align 2 gUnknown_08592DFC:: @ 8592DFC - spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A7820 + spr_template 0x2721, 0x2721, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, TranslateAnimSpriteToTargetMonLocation .align 2 gUnknown_08592E14:: @ 8592E14 @@ -1190,15 +1190,15 @@ gUnknown_08593424:: @ 8593424 .align 2 gSupersonicWaveSpriteTemplate:: @ 8593428 - spr_template 0x27b3, 0x27b3, gUnknown_08524A14, gDummySpriteAnimTable, NULL, gUnknown_08593420, sub_80A7820 + spr_template 0x27b3, 0x27b3, gUnknown_08524A14, gDummySpriteAnimTable, NULL, gUnknown_08593420, TranslateAnimSpriteToTargetMonLocation .align 2 gScreechWaveSpriteTemplate:: @ 8593440 - spr_template 0x27b4, 0x27b4, gUnknown_08524A14, gDummySpriteAnimTable, NULL, gUnknown_08593420, sub_80A7820 + spr_template 0x27b4, 0x27b4, gUnknown_08524A14, gDummySpriteAnimTable, NULL, gUnknown_08593420, TranslateAnimSpriteToTargetMonLocation .align 2 gUnknown_08593458:: @ 8593458 - spr_template 0x2814, 0x2814, gUnknown_08524A1C, gDummySpriteAnimTable, NULL, gUnknown_08593420, sub_80A7820 + spr_template 0x2814, 0x2814, gUnknown_08524A1C, gDummySpriteAnimTable, NULL, gUnknown_08593420, TranslateAnimSpriteToTargetMonLocation .align 2 gUnknown_08593470:: @ 8593470 @@ -1991,7 +1991,7 @@ gUnknown_085954D0:: @ 85954D0 .align 2 gEmberSpriteTemplate:: @ 85954D4 - spr_template 0x272d, 0x272d, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A7820 + spr_template 0x272d, 0x272d, gUnknown_08524914, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, TranslateAnimSpriteToTargetMonLocation .align 2 gEmberFlareSpriteTemplate:: @ 85954EC @@ -2143,7 +2143,7 @@ gBattleAnimSpriteTemplate_859574C:: @ 859574C .align 2 gUnknown_08595764:: @ 8595764 - spr_template 0x27bb, 0x27bb, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A7820 + spr_template 0x27bb, 0x27bb, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, TranslateAnimSpriteToTargetMonLocation .align 2 gUnknown_0859577C:: @ 859577C @@ -3067,7 +3067,7 @@ gUnknown_08596624:: @ 8596624 .align 2 gUnknown_0859663C:: @ 859663C - spr_template 0x27b3, 0x27b3, gUnknown_08524954, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A7820 + spr_template 0x27b3, 0x27b3, gUnknown_08524954, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, TranslateAnimSpriteToTargetMonLocation .align 2 gUnknown_08596654:: @ 8596654 diff --git a/include/battle_anim.h b/include/battle_anim.h index 29de71077..c8a2779d8 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -14,11 +14,11 @@ enum struct UnknownAnimStruct2 { - void *unk0; + u8 *bgTiles; u16 *unk4; u8 unk8; - u8 unk9; - u16 unkA; + u8 bgId; + u16 tilesOffset; u16 unkC; }; @@ -63,16 +63,18 @@ s8 BattleAnimAdjustPanning(s8 pan); s8 BattleAnimAdjustPanning2(s8 pan); s16 KeepPanInRange(s16 a); s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); +void sub_80A4720(u16 a, u16 *b, u32 c, u8 d); // battle_anim_80FE840.s void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value); -void sub_8118FBC(u8 arg0, u8 arg1, u8 arg2, u8 bankIdentity, u8 arg4, void *arg5, u16 *arg6, u16 arg7); +void sub_8118FBC(u8 arg0, u8 arg1, u8 arg2, u8 battlerPosition, u8 arg4, void *arg5, u16 *arg6, u16 arg7); void HandleIntroSlide(u8 terrainId); +u32 GetAnimBgAttribute(u8 bgId, u8 attributeId); // battle_anim_80A5C6C.s void sub_80A6EEC(struct Sprite *sprite); void sub_80A68D4(struct Sprite *sprite); -void TranslateAnimLinear(struct Sprite *sprite); +bool8 TranslateAnimLinear(struct Sprite *sprite); void sub_80A8278(void); void sub_80A6B30(struct UnknownAnimStruct2*); void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); @@ -91,11 +93,11 @@ enum u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); bool8 IsBattlerSpritePresent(u8 battlerId); -void sub_80A6C68(u8 arg0); +void sub_80A6C68(u32 arg0); u8 GetAnimBattlerSpriteId(u8 wantedBattler); bool8 IsDoubleBattle(void); u8 sub_80A6D94(void); -u8 sub_80A8364(u8); +u8 sub_80A8364(u8 battlerId); void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); void oamt_add_pos2_onto_pos1(struct Sprite *sprite); u8 GetBattlerSpriteDefault_Y(u8 battlerId); diff --git a/ld_script.txt b/ld_script.txt index 8de971717..1896b4fc9 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -112,7 +112,6 @@ SECTIONS { src/sound.o(.text); src/battle_anim.o(.text); src/battle_anim_80A5C6C.o(.text); - asm/battle_anim_80A5C6C.o(.text); src/task.o(.text); src/reshow_battle_screen.o(.text); asm/battle_anim_80A9C70.o(.text); diff --git a/src/battle_anim.c b/src/battle_anim.c index fa782d661..4989b0fb2 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -681,7 +681,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) } sub_80A6B30(&unknownStruct); - CpuFill16(0, unknownStruct.unk0, 0x1000); + CpuFill16(0, unknownStruct.bgTiles, 0x1000); CpuFill16(0xFF, unknownStruct.unk4, 0x800); SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 2); @@ -709,7 +709,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) else battlerPosition = GetBattlerPosition(battlerId); - sub_8118FBC(1, 0, 0, battlerPosition, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA); + sub_8118FBC(1, 0, 0, battlerPosition, unknownStruct.unk8, unknownStruct.bgTiles, unknownStruct.unk4, unknownStruct.tilesOffset); if (IsContest()) sub_80A46A0(); @@ -719,7 +719,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) RequestDma3Fill(0, (void*)(VRAM + 0x6000), 0x2000, 1); RequestDma3Fill(0, (void*)(VRAM + 0xF000), 0x1000, 1); sub_80A6B90(&unknownStruct, 2); - CpuFill16(0, unknownStruct.unk0 + 0x1000, 0x1000); + CpuFill16(0, unknownStruct.bgTiles + 0x1000, 0x1000); CpuFill16(0, unknownStruct.unk4 + 0x400, 0x800); SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2); SetAnimBgAttribute(2, BG_ANIM_SCREEN_SIZE, 1); @@ -739,7 +739,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], 0x90, 0x20); CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void*)(BG_PLTT + 0x120), 0x20); - sub_8118FBC(2, 0, 0, GetBattlerPosition(battlerId), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA); + sub_8118FBC(2, 0, 0, GetBattlerPosition(battlerId), unknownStruct.unk8, unknownStruct.bgTiles + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.tilesOffset); } } diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c index 46e1e5b71..f799b091b 100644 --- a/src/battle_anim_80A5C6C.c +++ b/src/battle_anim_80A5C6C.c @@ -14,12 +14,15 @@ #include "trig.h" #include "util.h" #include "gpu_regs.h" +#include "bg.h" +#include "malloc.h" +#include "dma3.h" -#define GET_UNOWN_LETTER(personality) ((\ +#define GET_UNOWN_LETTER(personality) (( \ (((personality & 0x03000000) >> 24) << 6) \ | (((personality & 0x00030000) >> 16) << 4) \ - | (((personality & 0x00000300) >> 8) << 2) \ - | (((personality & 0x00000003) >> 0) << 0) \ + | (((personality & 0x00000300) >> 8) << 2) \ + | (((personality & 0x00000003) >> 0) << 0) \ ) % 28) #define IS_DOUBLE_BATTLE() ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) @@ -28,15 +31,37 @@ extern const struct OamData gUnknown_0852497C; extern const struct MonCoords gMonFrontPicCoords[]; extern const struct MonCoords gMonBackPicCoords[]; extern const u8 gEnemyMonElevation[]; +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const union AffineAnimCmd *gUnknown_082FF6C0[]; // This file's functions. void sub_80A64EC(struct Sprite *sprite); void sub_80A653C(struct Sprite *sprite); void InitAnimLinearTranslation(struct Sprite *sprite); -bool8 TranslateAnimLinear(struct Sprite *sprite); +void sub_80A6E14(struct Sprite *sprite); +void sub_80A6FB4(struct Sprite *sprite); +void sub_80A6F98(struct Sprite *sprite); +void sub_80A7144(struct Sprite *sprite); +void sub_80A791C(struct Sprite *sprite); +void sub_80A8DFC(struct Sprite *sprite); +void sub_80A8E88(struct Sprite *sprite); +void sub_80A7E6C(u8 spriteId); +u16 sub_80A7F18(u8 spriteId); +void AnimTask_BlendMonInAndOutSetup(struct Task *task); +void sub_80A7AFC(u8 taskId); +void sub_80A8CAC(u8 taskId); +void AnimTask_BlendMonInAndOutStep(u8 taskId); +bool8 sub_80A7238(void); +void sub_80A8048(s16 *bottom, s16 *top, const void *ptr); +void *sub_80A8050(s16 bottom, s16 top); +u8 sub_80A82E4(u8 battlerId); +void sub_80A8D78(struct Task *task, u8 taskId); + +// EWRAM vars +EWRAM_DATA static union AffineAnimCmd *gUnknown_02038444 = NULL; // Const rom data -const struct UCoords8 sBattlerCoords[][4] = +static const struct UCoords8 sBattlerCoords[][4] = { { { 72, 80 }, @@ -61,7 +86,7 @@ const struct MonCoords gCastformFrontSpriteCoords[] = { 0x86, 8 }, // HAIL }; -const u8 gCastformElevations[] = +static const u8 sCastformElevations[] = { 13, // NORMAL 14, // SUN @@ -70,7 +95,7 @@ const u8 gCastformElevations[] = }; // Y position of the backsprite for each of the four Castform forms. -const u8 gCastformBackSpriteYCoords[] = +static const u8 sCastformBackSpriteYCoords[] = { 0, // NORMAL 0, // SUN @@ -78,7 +103,7 @@ const u8 gCastformBackSpriteYCoords[] = 0, // HAIL }; -const struct SpriteTemplate gUnknown_08525F90[] = +static const struct SpriteTemplate sUnknown_08525F90[] = { { .tileTag = 55125, @@ -100,7 +125,7 @@ const struct SpriteTemplate gUnknown_08525F90[] = } }; -const struct SpriteSheet gUnknown_08525FC0[] = +static const struct SpriteSheet sUnknown_08525FC0[] = { { gMiscBlank_Gfx, 0x800, 55125, }, { gMiscBlank_Gfx, 0x800, 55126, }, @@ -203,7 +228,7 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) } else if (species == SPECIES_CASTFORM) { - ret = gCastformBackSpriteYCoords[gBattleMonForms[battlerId]]; + ret = sCastformBackSpriteYCoords[gBattleMonForms[battlerId]]; } else if (species > NUM_SPECIES) { @@ -254,7 +279,7 @@ u8 GetBattlerElevation(u8 battlerId, u16 species) if (!IsContest()) { if (species == SPECIES_CASTFORM) - ret = gCastformElevations[gBattleMonForms[battlerId]]; + ret = sCastformElevations[gBattleMonForms[battlerId]]; else if (species > NUM_SPECIES) ret = gEnemyMonElevation[0]; else @@ -739,3 +764,1698 @@ bool8 TranslateAnimArc(struct Sprite *sprite) sprite->pos2.y += Sin((u8)(sprite->data[7] >> 8), sprite->data[5]); return FALSE; } + +bool8 sub_80A6934(struct Sprite *sprite) +{ + if (TranslateAnimLinear(sprite)) + return TRUE; + sprite->data[7] += sprite->data[6]; + sprite->pos2.x += Sin((u8)(sprite->data[7] >> 8), sprite->data[5]); + return FALSE; +} + +void oamt_add_pos2_onto_pos1(struct Sprite *sprite) +{ + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; +} + +void sub_80A6980(struct Sprite *sprite, bool8 a2) +{ + if (!a2) + { + sprite->pos1.x = GetBattlerSpriteCoord2(gBattleAnimTarget, 0); + sprite->pos1.y = GetBattlerSpriteCoord2(gBattleAnimTarget, 1); + } + sub_80A6864(sprite, gBattleAnimArgs[0]); + sprite->pos1.y += gBattleAnimArgs[1]; +} + +void sub_80A69CC(struct Sprite *sprite, u8 a2) +{ + if (!a2) + { + sprite->pos1.x = GetBattlerSpriteCoord2(gBattleAnimAttacker, 0); + sprite->pos1.y = GetBattlerSpriteCoord2(gBattleAnimAttacker, 1); + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord2(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord2(gBattleAnimAttacker, 3); + } + sub_80A6864(sprite, gBattleAnimArgs[0]); + sprite->pos1.y += gBattleAnimArgs[1]; +} + +u8 GetBattlerSide(u8 battlerId) +{ + return GET_BATTLER_SIDE2(battlerId); +} + +u8 GetBattlerPosition(u8 battlerId) +{ + return GET_BATTLER_POSITION(battlerId); +} + +u8 GetBattlerAtPosition(u8 position) +{ + u8 i; + + for (i = 0; i < gBattlersCount; i++) + { + if (gBattlerPositions[i] == position) + break; + } + return i; +} + +bool8 IsBattlerSpritePresent(u8 battlerId) +{ + if (IsContest()) + { + if (gBattleAnimAttacker == battlerId) + return TRUE; + else if (gBattleAnimTarget == battlerId) + return TRUE; + else + return FALSE; + } + else + { + if (gBattlerPositions[battlerId] == 0xff) + { + return FALSE; + } + else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + { + if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_HP) != 0) + return TRUE; + } + else + { + if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_HP) != 0) + return TRUE; + } + } + return FALSE; +} + +bool8 IsDoubleBattle() +{ + return IS_DOUBLE_BATTLE(); +} + +void sub_80A6B30(struct UnknownAnimStruct2 *unk) +{ + if (IsContest()) + { + unk->bgTiles = gUnknown_0202305C; + unk->unk4 = (u16 *)gUnknown_02023060; + unk->unk8 = 0xe; + unk->bgId = 1; + unk->tilesOffset = 0; + unk->unkC = 0; + } + else + { + unk->bgTiles = gUnknown_0202305C; + unk->unk4 = (u16 *)gUnknown_02023060; + unk->unk8 = 0x8; + unk->bgId = 1; + unk->tilesOffset = 0x200; + unk->unkC = 0; + } +} + +void sub_80A6B90(struct UnknownAnimStruct2 *unk, u32 arg1) +{ + if (IsContest()) + { + unk->bgTiles = gUnknown_0202305C; + unk->unk4 = (u16 *)gUnknown_02023060; + unk->unk8 = 0xe; + unk->bgId = 1; + unk->tilesOffset = 0; + unk->unkC = 0; + } + else if (arg1 == 1) + { + sub_80A6B30(unk); + } + else + { + unk->bgTiles = gUnknown_0202305C; + unk->unk4 = (u16 *)gUnknown_02023060; + unk->unk8 = 0x9; + unk->bgId = 2; + unk->tilesOffset = 0x300; + unk->unkC = 0; + } +} + +void sub_80A6BFC(struct UnknownAnimStruct2 *unk) +{ + unk->bgTiles = gUnknown_0202305C; + unk->unk4 = (u16 *)gUnknown_02023060; + if (IsContest()) + { + unk->unk8 = 0xe; + unk->bgId = 1; + unk->tilesOffset = 0; + unk->unkC = 0; + } + else if (sub_80A8364(gBattleAnimAttacker) == 1) + { + unk->unk8 = 8; + unk->bgId = 1; + unk->tilesOffset = 0x200; + unk->unkC = 0; + } + else + { + unk->unk8 = 0x9; + unk->bgId = 2; + unk->tilesOffset = 0x300; + unk->unkC = 0; + } +} + +void sub_80A6C68(u32 arg0) +{ + struct UnknownAnimStruct2 unkStruct; + + sub_80A6B90(&unkStruct, arg0); + CpuFill32(0, unkStruct.bgTiles, 0x2000); + LoadBgTiles(unkStruct.bgId, unkStruct.bgTiles, 0x2000, unkStruct.tilesOffset); + FillBgTilemapBufferRect(unkStruct.bgId, 0, 0, 0, 0x20, 0x40, 0x11); + CopyBgTilemapBufferToVram(unkStruct.bgId); +} + +void sub_80A6CC0(u32 bgId, void *src, u32 tilesOffset) +{ + CpuFill32(0, gUnknown_0202305C, 0x2000); + LZDecompressWram(src, gUnknown_0202305C); + LoadBgTiles(bgId, gUnknown_0202305C, 0x2000, tilesOffset); +} + +void sub_80A6D10(u32 bgId, const void *src) +{ + FillBgTilemapBufferRect(bgId, 0, 0, 0, 0x20, 0x40, 0x11); + CopyToBgTilemapBuffer(bgId, src, 0, 0); +} + +void sub_80A6D48(u32 bgId, const void *src) +{ + sub_80A6D10(bgId, src); + CopyBgTilemapBufferToVram(bgId); +} + +void sub_80A6D60(struct UnknownAnimStruct2 *unk, const void *src, u32 arg2) +{ + sub_80A6D10(unk->bgId, src); + if (IsContest() == TRUE) + sub_80A4720(unk->unk8, unk->unk4, 0, arg2); + CopyBgTilemapBufferToVram(unk->bgId); +} + +u8 sub_80A6D94(void) +{ + if (IsContest()) + return 1; + else + return 2; +} + +void sub_80A6DAC(bool8 arg0) +{ + if (!arg0 || IsContest()) + { + SetAnimBgAttribute(3, BG_ANIM_SCREEN_SIZE, 0); + SetAnimBgAttribute(3, BG_ANIM_AREA_OVERFLOW_MODE, 1); + } + else + { + SetAnimBgAttribute(3, BG_ANIM_SCREEN_SIZE, 1); + SetAnimBgAttribute(3, BG_ANIM_AREA_OVERFLOW_MODE, 0); + } +} + +void sub_80A6DEC(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + sub_80A6E14(sprite); + sprite->callback = sub_80A65A8; + sprite->callback(sprite); +} + +void sub_80A6E14(struct Sprite *sprite) +{ + s16 x = (sprite->data[2] - sprite->data[1]) << 8; + s16 y = (sprite->data[4] - sprite->data[3]) << 8; + sprite->data[1] = x / sprite->data[0]; + sprite->data[2] = y / sprite->data[0]; + sprite->data[4] = 0; + sprite->data[3] = 0; +} + +void InitAnimLinearTranslation(struct Sprite *sprite) +{ + int x = sprite->data[2] - sprite->data[1]; + int y = sprite->data[4] - sprite->data[3]; + bool8 movingLeft = x < 0; + bool8 movingUp = y < 0; + u16 xDelta = abs(x) << 8; + u16 yDelta = abs(y) << 8; + + xDelta = xDelta / sprite->data[0]; + yDelta = yDelta / sprite->data[0]; + + if (movingLeft) + xDelta |= 1; + else + xDelta &= ~1; + + if (movingUp) + yDelta |= 1; + else + yDelta &= ~1; + + sprite->data[1] = xDelta; + sprite->data[2] = yDelta; + sprite->data[4] = 0; + sprite->data[3] = 0; +} + +void sub_80A6EEC(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + InitAnimLinearTranslation(sprite); + sprite->callback = sub_80A6F98; + sprite->callback(sprite); +} + +void sub_80A6F14(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + InitAnimLinearTranslation(sprite); + sprite->callback = sub_80A6FB4; + sprite->callback(sprite); +} + +bool8 TranslateAnimLinear(struct Sprite *sprite) +{ + u16 v1, v2, x, y; + + if (!sprite->data[0]) + return TRUE; + + v1 = sprite->data[1]; + v2 = sprite->data[2]; + x = sprite->data[3]; + y = sprite->data[4]; + x += v1; + y += v2; + + if (v1 & 1) + sprite->pos2.x = -(x >> 8); + else + sprite->pos2.x = x >> 8; + + if (v2 & 1) + sprite->pos2.y = -(y >> 8); + else + sprite->pos2.y = y >> 8; + + sprite->data[3] = x; + sprite->data[4] = y; + sprite->data[0]--; + return FALSE; +} + +void sub_80A6F98(struct Sprite *sprite) +{ + if (TranslateAnimLinear(sprite)) + SetCallbackToStoredInData6(sprite); +} + +void sub_80A6FB4(struct Sprite *sprite) +{ + sub_8039E9C(sprite); + if (TranslateAnimLinear(sprite)) + SetCallbackToStoredInData6(sprite); +} + +void sub_80A6FD4(struct Sprite *sprite) +{ + int v1 = abs(sprite->data[2] - sprite->data[1]) << 8; + sprite->data[0] = v1 / sprite->data[0]; + InitAnimLinearTranslation(sprite); +} + +void sub_80A7000(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + sub_80A6FD4(sprite); + sprite->callback = sub_80A6F98; + sprite->callback(sprite); +} + +void sub_80A7028(struct Sprite *sprite) +{ + int x = sprite->data[2] - sprite->data[1]; + int y = sprite->data[4] - sprite->data[3]; + bool8 x_sign = x < 0; + bool8 y_sign = y < 0; + u16 x2 = abs(x) << 4; + u16 y2 = abs(y) << 4; + + x2 /= sprite->data[0]; + y2 /= sprite->data[0]; + + if (x_sign) + x2 |= 1; + else + x2 &= ~1; + + if (y_sign) + y2 |= 1; + else + y2 &= ~1; + + sprite->data[1] = x2; + sprite->data[2] = y2; + sprite->data[4] = 0; + sprite->data[3] = 0; +} + +void sub_80A70C0(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + sub_80A7028(sprite); + sprite->callback = sub_80A7144; + sprite->callback(sprite); +} + +bool8 sub_80A70E8(struct Sprite *sprite) +{ + u16 v1, v2, x, y; + + if (!sprite->data[0]) + return TRUE; + + v1 = sprite->data[1]; + v2 = sprite->data[2]; + x = sprite->data[3]; + y = sprite->data[4]; + x += v1; + y += v2; + + if (v1 & 1) + sprite->pos2.x = -(x >> 4); + else + sprite->pos2.x = x >> 4; + + if (v2 & 1) + sprite->pos2.y = -(y >> 4); + else + sprite->pos2.y = y >> 4; + + sprite->data[3] = x; + sprite->data[4] = y; + sprite->data[0]--; + return FALSE; +} + +void sub_80A7144(struct Sprite *sprite) +{ + if (sub_80A70E8(sprite)) + SetCallbackToStoredInData6(sprite); +} + +void sub_80A7160(struct Sprite *sprite) +{ + int v1 = abs(sprite->data[2] - sprite->data[1]) << 4; + sprite->data[0] = v1 / sprite->data[0]; + sub_80A7028(sprite); +} + +void sub_80A718C(struct Sprite *sprite) +{ + sprite->data[1] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + sub_80A7160(sprite); + sprite->callback = sub_80A7144; + sprite->callback(sprite); +} + +void obj_id_set_rotscale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation) +{ + int i; + struct ObjAffineSrcData src; + struct OamMatrix matrix; + + src.xScale = xScale; + src.yScale = yScale; + src.rotation = rotation; + if (sub_80A7238()) + src.xScale = -src.xScale; + i = gSprites[spriteId].oam.matrixNum; + ObjAffineSet(&src, &matrix, 1, 2); + gOamMatrices[i].a = matrix.a; + gOamMatrices[i].b = matrix.b; + gOamMatrices[i].c = matrix.c; + gOamMatrices[i].d = matrix.d; +} + +bool8 sub_80A7238(void) +{ + if (IsContest()) + { + if (gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].data[2] == SPECIES_UNOWN) + return FALSE; + else + return TRUE; + } + else + { + return FALSE; + } +} + +void sub_80A7270(u8 spriteId, u8 objMode) +{ + u8 battlerId = gSprites[spriteId].data[0]; + + if (IsContest() || IsBattlerSpriteVisible(battlerId)) + gSprites[spriteId].invisible = FALSE; + gSprites[spriteId].oam.objMode = objMode; + gSprites[spriteId].affineAnimPaused = TRUE; + if (!IsContest() && !gSprites[spriteId].oam.affineMode) + gSprites[spriteId].oam.matrixNum = gBattleSpritesDataPtr->healthBoxesData[battlerId].field_6; + gSprites[spriteId].oam.affineMode = 3; + CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode); +} + +void sub_80A7344(u8 spriteId) +{ + obj_id_set_rotscale(spriteId, 0x100, 0x100, 0); + gSprites[spriteId].oam.affineMode = 1; + gSprites[spriteId].oam.objMode = 0; + gSprites[spriteId].affineAnimPaused = FALSE; + CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode); +} + +void sub_80A73A0(u8 spriteId) +{ + u16 matrix = gSprites[spriteId].oam.matrixNum; + s16 c = gOamMatrices[matrix].c; + + if (c < 0) + c = -c; + gSprites[spriteId].pos2.y = c >> 3; +} + +// related to obj_id_set_rotscale +void sub_80A73E0(struct Sprite *sprite, bool8 a2, s16 xScale, s16 yScale, u16 rotation) +{ + int i; + struct ObjAffineSrcData src; + struct OamMatrix matrix; + + if (sprite->oam.affineMode & 1) + { + sprite->affineAnimPaused = TRUE; + if (a2) + CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); + src.xScale = xScale; + src.yScale = yScale; + src.rotation = rotation; + if (sub_80A7238()) + src.xScale = -src.xScale; + i = sprite->oam.matrixNum; + ObjAffineSet(&src, &matrix, 1, 2); + gOamMatrices[i].a = matrix.a; + gOamMatrices[i].b = matrix.b; + gOamMatrices[i].c = matrix.c; + gOamMatrices[i].d = matrix.d; + } +} + +void sub_80A749C(struct Sprite *sprite) +{ + sub_80A73E0(sprite, TRUE, 0x100, 0x100, 0); + sprite->affineAnimPaused = FALSE; + CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); +} + +static u16 ArcTan2_(s16 a, s16 b) +{ + return ArcTan2(a, b); +} + +u16 ArcTan2Neg(s16 a, s16 b) +{ + u16 var = ArcTan2_(a, b); + return -var; +} + +void sub_80A750C(u16 a1, bool8 a2) +{ + int i; + struct PlttData *c; + struct PlttData *c2; + u16 average; + + a1 *= 0x10; + + if (!a2) + { + for (i = 0; i < 0x10; i++) + { + c = (struct PlttData *)&gPlttBufferUnfaded[a1 + i]; + average = c->r + c->g + c->b; + average /= 3; + + c2 = (struct PlttData *)&gPlttBufferFaded[a1 + i]; + c2->r = average; + c2->g = average; + c2->b = average; + } + } + else + { + CpuCopy32(&gPlttBufferUnfaded[a1], &gPlttBufferFaded[a1], 0x20); + } +} + +u32 sub_80A75AC(u8 a1, u8 a2, u8 a3, u8 a4, u8 a5, u8 a6, u8 a7) +{ + u32 var = 0; + u32 shift; + + if (a1) + { + if (!IsContest()) + var = 0xe; + else + var = 1 << sub_80A6D94(); + } + if (a2) + { + shift = gBattleAnimAttacker + 16; + var |= 1 << shift; + } + if (a3) { + shift = gBattleAnimTarget + 16; + var |= 1 << shift; + } + if (a4) + { + if (IsBattlerSpriteVisible(gBattleAnimAttacker ^ 2)) + { + shift = (gBattleAnimAttacker ^ 2) + 16; + var |= 1 << shift; + } + } + if (a5) + { + if (IsBattlerSpriteVisible(gBattleAnimTarget ^ 2)) + { + shift = (gBattleAnimTarget ^ 2) + 16; + var |= 1 << shift; + } + } + if (a6) + { + if (!IsContest()) + var |= 0x100; + else + var |= 0x4000; + } + if (a7) + { + if (!IsContest()) + var |= 0x200; + } + return var; +} + +u32 sub_80A76C4(u8 a1, u8 a2, u8 a3, u8 a4) +{ + u32 var = 0; + u32 shift; + + if (IsContest()) + { + if (a1) + { + var |= 1 << 18; + return var; + } + } + else + { + if (a1) + { + if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) + { + var |= 1 << (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) + 16); + } + } + if (a2) + { + if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))) + { + shift = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) + 16; + var |= 1 << shift; + } + } + if (a3) + { + if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))) + { + shift = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT) + 16; + var |= 1 << shift; + } + } + if (a4) + { + if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) + { + shift = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT) + 16; + var |= 1 << shift; + } + } + } + return var; +} + +u8 sub_80A77AC(u8 a1) +{ + return a1; +} + +u8 sub_80A77B4(u8 position) +{ + return GetBattlerAtPosition(position); +} + +void sub_80A77C8(struct Sprite *sprite) +{ + bool8 var; + + if (!sprite->data[0]) + { + if (!gBattleAnimArgs[3]) + var = TRUE; + else + var = FALSE; + if (!gBattleAnimArgs[2]) + sub_80A69CC(sprite, var); + else + sub_80A6980(sprite, var); + sprite->data[0]++; + + } + else if (sprite->animEnded || sprite->affineAnimEnded) + { + move_anim_8074EE0(sprite); + } +} + +// Linearly translates a sprite to a target position on the +// other mon's sprite. +// arg 0: initial x offset +// arg 1: initial y offset +// arg 2: target x offset +// arg 3: target y offset +// arg 4: duration +// arg 5: lower 8 bits = location on attacking mon, upper 8 bits = location on target mon pick to target +void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite) +{ + bool8 v1; + u8 attributeId; + + if (!(gBattleAnimArgs[5] & 0xff00)) + v1 = TRUE; + else + v1 = FALSE; + + if (!(gBattleAnimArgs[5] & 0xff)) + attributeId = BATTLER_COORD_3; + else + attributeId = BATTLER_COORD_Y; + + sub_80A69CC(sprite, v1); + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, attributeId) + gBattleAnimArgs[3]; + sprite->callback = sub_80A6EEC; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +void sub_80A78AC(struct Sprite *sprite) +{ + sub_80A69CC(sprite, 1); + if (GetBattlerSide(gBattleAnimAttacker)) + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3]; + sprite->data[5] = gBattleAnimArgs[5]; + sub_80A68D4(sprite); + sprite->callback = sub_80A791C; +} + +void sub_80A791C(struct Sprite *sprite) +{ + if (TranslateAnimArc(sprite)) + DestroyAnimSprite(sprite); +} + +void sub_80A7938(struct Sprite *sprite) +{ + bool8 r4; + u8 battlerId, attributeId; + + if (!gBattleAnimArgs[6]) + { + r4 = TRUE; + attributeId = BATTLER_COORD_3; + } + else + { + r4 = FALSE; + attributeId = BATTLER_COORD_Y; + } + if (!gBattleAnimArgs[5]) + { + sub_80A69CC(sprite, r4); + battlerId = gBattleAnimAttacker; + } + else + { + sub_80A6980(sprite, r4); + battlerId = gBattleAnimTarget; + } + if (GetBattlerSide(gBattleAnimAttacker)) + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + sub_80A6980(sprite, r4); + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[2] = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(battlerId, attributeId) + gBattleAnimArgs[3]; + sprite->callback = sub_80A6EEC; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +s16 duplicate_obj_of_side_rel2move_in_transparent_mode(u8 whichBattler) +{ + u16 i; + u8 spriteId = GetAnimBattlerSpriteId(whichBattler); + + if (spriteId != 0xff) + { + for (i = 0; i < MAX_SPRITES; i++) + { + if (!gSprites[i].inUse) + { + gSprites[i] = gSprites[spriteId]; + gSprites[i].oam.objMode = 1; + gSprites[i].invisible = FALSE; + return i; + } + } + } + return -1; +} + +void obj_delete_but_dont_free_vram(struct Sprite *sprite) +{ + sprite->usingSheet = TRUE; + DestroySprite(sprite); +} + +void sub_80A7A74(u8 taskId) +{ + s16 v1 = 0; + s16 v2 = 0; + + if (gBattleAnimArgs[2] > gBattleAnimArgs[0]) + v2 = 1; + if (gBattleAnimArgs[2] < gBattleAnimArgs[0]) + v2 = -1; + if (gBattleAnimArgs[3] > gBattleAnimArgs[1]) + v1 = 1; + if (gBattleAnimArgs[3] < gBattleAnimArgs[1]) + v1 = -1; + + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = gBattleAnimArgs[4]; + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = gBattleAnimArgs[0]; + gTasks[taskId].data[4] = gBattleAnimArgs[1]; + gTasks[taskId].data[5] = v2; + gTasks[taskId].data[6] = v1; + gTasks[taskId].data[7] = gBattleAnimArgs[2]; + gTasks[taskId].data[8] = gBattleAnimArgs[3]; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gBattleAnimArgs[0], gBattleAnimArgs[1])); + gTasks[taskId].func = sub_80A7AFC; +} + +void sub_80A7AFC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + if (++task->data[0] > task->data[1]) + { + task->data[0] = 0; + if (++task->data[2] & 1) + { + if (task->data[3] != task->data[7]) + task->data[3] += task->data[5]; + } + else + { + if (task->data[4] != task->data[8]) + task->data[4] += task->data[6]; + } + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4])); + if (task->data[3] == task->data[7] && task->data[4] == task->data[8]) + { + DestroyAnimVisualTask(taskId); + return; + } + } +} + +// Linearly blends a mon's sprite colors with a target color with increasing +// strength, and then blends out to the original color. +// arg 0: anim bank +// arg 1: blend color +// arg 2: target blend coefficient +// arg 3: initial delay +// arg 4: number of times to blend in and out +void AnimTask_BlendMonInAndOut(u8 task) +{ + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (spriteId == 0xff) + { + DestroyAnimVisualTask(task); + return; + } + gTasks[task].data[0] = (gSprites[spriteId].oam.paletteNum * 0x10) + 0x101; + AnimTask_BlendMonInAndOutSetup(&gTasks[task]); +} + +void AnimTask_BlendMonInAndOutSetup(struct Task *task) +{ + task->data[1] = gBattleAnimArgs[1]; + task->data[2] = 0; + task->data[3] = gBattleAnimArgs[2]; + task->data[4] = 0; + task->data[5] = gBattleAnimArgs[3]; + task->data[6] = 0; + task->data[7] = gBattleAnimArgs[4]; + task->func = AnimTask_BlendMonInAndOutStep; +} + +void AnimTask_BlendMonInAndOutStep(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + if (++task->data[4] >= task->data[5]) + { + task->data[4] = 0; + if (!task->data[6]) + { + task->data[2]++; + BlendPalette(task->data[0], 15, task->data[2], task->data[1]); + if (task->data[2] == task->data[3]) + task->data[6] = 1; + } + else + { + task->data[2]--; + BlendPalette(task->data[0], 15, task->data[2], task->data[1]); + if (!task->data[2]) + { + if (--task->data[7]) + { + task->data[4] = 0; + task->data[6] = 0; + } + else + { + DestroyAnimVisualTask(taskId); + return; + } + } + } + } +} + +void sub_80A7CB4(u8 task) +{ + u8 palette = IndexOfSpritePaletteTag(gBattleAnimArgs[0]); + + if (palette == 0xff) + { + DestroyAnimVisualTask(task); + return; + } + gTasks[task].data[0] = (palette * 0x10) + 0x101; + AnimTask_BlendMonInAndOutSetup(&gTasks[task]); +} + +void sub_80A7CFC(struct Task *task, u8 a2, const void *a3) +{ + task->data[7] = 0; + task->data[8] = 0; + task->data[9] = 0; + task->data[15] = a2; + task->data[10] = 0x100; + task->data[11] = 0x100; + task->data[12] = 0; + sub_80A8048(&task->data[13], &task->data[14], a3); + sub_80A7270(a2, 0); +} + +bool8 sub_80A7D34(struct Task *task) +{ + gUnknown_02038444 = sub_80A8050(task->data[13], task->data[14]) + (task->data[7] << 3); + switch (gUnknown_02038444->type) + { + default: + if (!gUnknown_02038444->frame.duration) + { + task->data[10] = gUnknown_02038444->frame.xScale; + task->data[11] = gUnknown_02038444->frame.yScale; + task->data[12] = gUnknown_02038444->frame.rotation; + task->data[7]++; + gUnknown_02038444++; + } + task->data[10] += gUnknown_02038444->frame.xScale; + task->data[11] += gUnknown_02038444->frame.yScale; + task->data[12] += gUnknown_02038444->frame.rotation; + obj_id_set_rotscale(task->data[15], task->data[10], task->data[11], task->data[12]); + sub_80A7E6C(task->data[15]); + if (++task->data[8] >= gUnknown_02038444->frame.duration) + { + task->data[8] = 0; + task->data[7]++; + } + break; + case AFFINEANIMCMDTYPE_JUMP: + task->data[7] = gUnknown_02038444->jump.target; + break; + case AFFINEANIMCMDTYPE_LOOP: + if (gUnknown_02038444->loop.count) + { + if (task->data[9]) + { + if (!--task->data[9]) + { + task->data[7]++; + break; + } + } + else + { + task->data[9] = gUnknown_02038444->loop.count; + } + if (!task->data[7]) + { + break; + } + for (;;) + { + task->data[7]--; + gUnknown_02038444--; + if (gUnknown_02038444->type == AFFINEANIMCMDTYPE_LOOP) + { + task->data[7]++; + return TRUE; + } + if (!task->data[7]) + return TRUE; + } + } + task->data[7]++; + break; + case AFFINEANIMCMDTYPE_END: + gSprites[task->data[15]].pos2.y = 0; + sub_80A7344(task->data[15]); + return FALSE; + } + + return TRUE; +} + +void sub_80A7E6C(u8 spriteId) +{ + int var = 0x40 - sub_80A7F18(spriteId) * 2; + u16 matrix = gSprites[spriteId].oam.matrixNum; + int var2 = (var << 8) / gOamMatrices[matrix].d; + + if (var2 > 0x80) + var2 = 0x80; + gSprites[spriteId].pos2.y = (var - var2) / 2; +} + +void sub_80A7EC0(u8 spriteId, u8 spriteId2) +{ + int var = 0x40 - sub_80A7F18(spriteId2) * 2; + u16 matrix = gSprites[spriteId].oam.matrixNum; + int var2 = (var << 8) / gOamMatrices[matrix].d; + + if (var2 > 0x80) + var2 = 0x80; + gSprites[spriteId].pos2.y = (var - var2) / 2; +} + +u16 sub_80A7F18(u8 spriteId) +{ + struct BattleSpriteInfo *spriteInfo; + u8 battlerId = gSprites[spriteId].data[0]; + u16 species; + u16 i; + + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + if (gBattlerSpriteIds[i] == spriteId) + { + if (IsContest()) + { + species = shared19348.unk0; + return gMonBackPicCoords[species].y_offset; + } + else + { + if (GetBattlerSide(i) == B_SIDE_PLAYER) + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES); + else + species = spriteInfo[battlerId].transformSpecies; + + if (species == SPECIES_CASTFORM) + return sCastformBackSpriteYCoords[gBattleMonForms[battlerId]]; + else + return gMonBackPicCoords[species].y_offset; + } + else + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES); + else + species = spriteInfo[battlerId].transformSpecies; + + if (species == SPECIES_CASTFORM) + return sCastformElevations[gBattleMonForms[battlerId]]; + else + return gMonFrontPicCoords[species].y_offset; + } + } + } + } + return 0x40; +} + +void sub_80A8048(s16 *bottom, s16 *top, const void *ptr) +{ + *bottom = ((intptr_t) ptr) & 0xffff; + *top = (((intptr_t) ptr) >> 16) & 0xffff; +} + +void *sub_80A8050(s16 bottom, s16 top) +{ + return (void *)((u16)bottom | ((u16)top << 16)); +} + +void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7) +{ + task->data[8] = a7; + task->data[15] = a2; // spriteId + task->data[9] = a3; + task->data[10] = a4; + task->data[13] = a5; + task->data[14] = a6; + task->data[11] = (a5 - a3) / a7; + task->data[12] = (a6 - a4) / a7; +} + +u8 sub_80A80C8(struct Task *task) +{ + if (!task->data[8]) + return 0; + + if (--task->data[8] != 0) + { + task->data[9] += task->data[11]; + task->data[10] += task->data[12]; + } + else + { + task->data[9] = task->data[13]; + task->data[10] = task->data[14]; + } + obj_id_set_rotscale(task->data[15], task->data[9], task->data[10], 0); + if (task->data[8]) + sub_80A7E6C(task->data[15]); + else + gSprites[task->data[15]].pos2.y = 0; + return task->data[8]; +} + +void AnimTask_GetFrustrationPowerLevel(u8 taskId) +{ + u16 powerLevel; + + if (gAnimFriendship <= 30) + powerLevel = 0; + else if (gAnimFriendship <= 100) + powerLevel = 1; + else if (gAnimFriendship <= 200) + powerLevel = 2; + else + powerLevel = 3; + gBattleAnimArgs[7] = powerLevel; + DestroyAnimVisualTask(taskId); +} + +void sub_80A8174(u8 priority) +{ + if (IsBattlerSpriteVisible(gBattleAnimTarget)) + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].oam.priority = priority; + if (IsBattlerSpriteVisible(gBattleAnimAttacker)) + gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].oam.priority = priority; + if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget))) + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)]].oam.priority = priority; + if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) + gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority = priority; +} + +void sub_80A8278(void) +{ + int i; + + for (i = 0; i < gBattlersCount; i++) + { + if (IsBattlerSpriteVisible(i)) + { + gSprites[gBattlerSpriteIds[i]].subpriority = sub_80A82E4(i); + gSprites[gBattlerSpriteIds[i]].oam.priority = 2; + } + } +} + +u8 sub_80A82E4(u8 battlerId) +{ + u8 position; + u8 ret; + + if (IsContest()) + { + if (battlerId == 2) + return 30; + else + return 40; + } + else + { + position = GetBattlerPosition(battlerId); + if (position == B_POSITION_PLAYER_LEFT) + ret = 30; + else if (position == B_POSITION_PLAYER_RIGHT) + ret = 20; + else if (position == B_POSITION_OPPONENT_LEFT) + ret = 40; + else + ret = 50; + } + return ret; +} + +u8 sub_80A8328(u8 battlerId) +{ + u8 position = GetBattlerPosition(battlerId); + + if (IsContest()) + return 2; + else if (position == B_POSITION_PLAYER_LEFT || position == B_POSITION_OPPONENT_RIGHT) + return GetAnimBgAttribute(2, BG_ANIM_PRIORITY); + else + return GetAnimBgAttribute(1, BG_ANIM_PRIORITY); +} + +u8 sub_80A8364(u8 battlerId) +{ + if (!IsContest()) + { + u8 position = GetBattlerPosition(battlerId); + if (position == B_POSITION_PLAYER_LEFT || position == B_POSITION_OPPONENT_RIGHT) + return 2; + else + return 1; + } + return 1; +} + +u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10) +{ + u8 spriteId; + u16 sheet = LoadSpriteSheet(&sUnknown_08525FC0[a3]); + u16 palette = AllocSpritePalette(sUnknown_08525F90[a3].paletteTag); + + if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->field_17C == NULL) + gMonSpritesGfxPtr->field_17C = AllocZeroed(0x2000); + if (!isBackpic) + { + LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); + if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) + LoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], + gMonSpritesGfxPtr->field_17C, + species, + personality, + TRUE); + else + LoadSpecialPokePic_2(&gMonFrontPicTable[species], + gMonSpritesGfxPtr->field_17C, + species, + personality, + TRUE); + } + else + { + LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); + if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) + LoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], + gMonSpritesGfxPtr->field_17C, + species, + personality, + FALSE); + else + LoadSpecialPokePic_2(&gMonBackPicTable[species], + gMonSpritesGfxPtr->field_17C, + species, + personality, + FALSE); + } + + RequestDma3Copy(gMonSpritesGfxPtr->field_17C, (void *)(OBJ_VRAM0 + (sheet * 0x20)), 0x800, 1); + FREE_AND_SET_NULL(gMonSpritesGfxPtr->field_17C); + + if (!isBackpic) + spriteId = CreateSprite(&sUnknown_08525F90[a3], x, y + gMonFrontPicCoords[species].y_offset, subpriority); + else + spriteId = CreateSprite(&sUnknown_08525F90[a3], x, y + gMonBackPicCoords[species].y_offset, subpriority); + + if (IsContest()) + { + gSprites[spriteId].affineAnims = gUnknown_082FF6C0; + StartSpriteAffineAnim(&gSprites[spriteId], 0); + } + return spriteId; +} + +void sub_80A8610(struct Sprite *sprite) +{ + DestroySpriteAndFreeResources(sprite); +} + +s16 sub_80A861C(u8 battlerId, u8 a2) +{ + u16 species; + u32 personality; + u16 letter; + u16 var; + int ret; + const struct MonCoords *coords; + struct BattleSpriteInfo *spriteInfo; + + if (IsContest()) + { + if (shared19348.unk4_0) + { + species = shared19348.unk2; + personality = shared19348.unk10; + } + else + { + species = shared19348.unk0; + personality = shared19348.unk8; + } + if (species == SPECIES_UNOWN) + { + letter = GET_UNOWN_LETTER(personality); + if (!letter) + var = SPECIES_UNOWN; + else + var = letter + SPECIES_UNOWN_B - 1; + coords = &gMonBackPicCoords[var]; + } + else if (species == SPECIES_CASTFORM) + { + coords = &gCastformFrontSpriteCoords[gBattleMonForms[battlerId]]; + } + else if (species <= SPECIES_EGG) + { + coords = &gMonBackPicCoords[species]; + } + else + { + coords = &gMonBackPicCoords[0]; + } + } + else + { + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + { + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY); + } + else + { + species = spriteInfo[battlerId].transformSpecies; + personality = gTransformedPersonalities[battlerId]; + } + if (species == SPECIES_UNOWN) + { + letter = GET_UNOWN_LETTER(personality); + if (!letter) + var = SPECIES_UNOWN; + else + var = letter + SPECIES_UNOWN_B - 1; + coords = &gMonBackPicCoords[var]; + } + else if (species > SPECIES_EGG) + { + coords = &gMonBackPicCoords[0]; + } + else + { + coords = &gMonBackPicCoords[species]; + } + } + else + { + spriteInfo = gBattleSpritesDataPtr->battlerData; + if (!spriteInfo[battlerId].transformSpecies) + { + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY); + } + else + { + species = spriteInfo[battlerId].transformSpecies; + personality = gTransformedPersonalities[battlerId]; + } + if (species == SPECIES_UNOWN) + { + letter = GET_UNOWN_LETTER(personality); + if (!letter) + var = SPECIES_UNOWN; + else + var = letter + SPECIES_UNOWN_B - 1; + coords = &gMonFrontPicCoords[var]; + } + else if (species == SPECIES_CASTFORM) + { + coords = &gCastformFrontSpriteCoords[gBattleMonForms[battlerId]]; + } + else if (species > SPECIES_EGG) + { + coords = &gMonFrontPicCoords[0]; + } + else + { + coords = &gMonFrontPicCoords[species]; + } + } + } + + switch (a2) + { + case 0: + return (coords->coords & 0xf) * 8; + case 1: + return (coords->coords >> 4) * 8; + case 4: + return GetBattlerSpriteCoord(battlerId, 2) - ((coords->coords >> 4) * 4); + case 5: + return GetBattlerSpriteCoord(battlerId, 2) + ((coords->coords >> 4) * 4); + case 2: + return GetBattlerSpriteCoord(battlerId, 3) - ((coords->coords & 0xf) * 4); + case 3: + return GetBattlerSpriteCoord(battlerId, 3) + ((coords->coords & 0xf) * 4); + case 6: + ret = GetBattlerSpriteCoord(battlerId, 1) + 0x1f; + return ret - coords->y_offset; + default: + return 0; + } +} + +void SetAverageBattlerPositions(u8 battlerId, bool8 a2, s16 *x, s16 *y) +{ + u8 v1, v2; + s16 v3, v4; + s16 v5, v6; + + if (!a2) + { + v1 = 0; + v2 = 1; + } + else + { + v1 = 2; + v2 = 3; + } + v3 = GetBattlerSpriteCoord(battlerId, v1); + v4 = GetBattlerSpriteCoord(battlerId, v2); + if (IsDoubleBattle() && !IsContest()) + { + v5 = GetBattlerSpriteCoord(BATTLE_PARTNER(battlerId), v1); + v6 = GetBattlerSpriteCoord(BATTLE_PARTNER(battlerId), v2); + } + else + { + v5 = v3; + v6 = v4; + } + *x = (v3 + v5) / 2; + *y = (v4 + v6) / 2; +} + +u8 sub_80A89C8(int battlerId, u8 spriteId, int species) +{ + u8 newSpriteId = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); + gSprites[newSpriteId] = gSprites[spriteId]; + gSprites[newSpriteId].usingSheet = TRUE; + gSprites[newSpriteId].oam.priority = 0; + gSprites[newSpriteId].oam.objMode = 2; + gSprites[newSpriteId].oam.tileNum = gSprites[spriteId].oam.tileNum; + gSprites[newSpriteId].callback = SpriteCallbackDummy; + return newSpriteId; +} + +void sub_80A8A6C(struct Sprite *sprite) +{ + sub_80A6838(sprite); + if (GetBattlerSide(gBattleAnimAttacker)) + { + sprite->pos1.x -= gBattleAnimArgs[0]; + gBattleAnimArgs[3] = -gBattleAnimArgs[3]; + sprite->hFlip = TRUE; + } + else + { + sprite->pos1.x += gBattleAnimArgs[0]; + } + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->data[3] = gBattleAnimArgs[4]; + sprite->data[5] = gBattleAnimArgs[5]; + StoreSpriteCallbackInData6(sprite, move_anim_8074EE0); + sprite->callback = sub_80A66DC; +} + +void sub_80A8AEC(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + sprite->pos1.x -= gBattleAnimArgs[0]; + gBattleAnimArgs[3] *= -1; + } + else + { + sprite->pos1.x += gBattleAnimArgs[0]; + } + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->data[3] = gBattleAnimArgs[4]; + sprite->data[5] = gBattleAnimArgs[5]; + StartSpriteAnim(sprite, gBattleAnimArgs[6]); + StoreSpriteCallbackInData6(sprite, move_anim_8074EE0); + sprite->callback = sub_80A66DC; +} + +void sub_80A8B64(struct Sprite *sprite) +{ + sub_80A6838(sprite); + if (GetBattlerSide(gBattleAnimAttacker)) + sprite->pos1.x -= gBattleAnimArgs[0]; + else + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->callback = sub_80A67D8; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +void sub_80A8BC4(u8 taskId) +{ + u16 src; + u16 dest; + struct Task *task = &gTasks[taskId]; + + task->data[0] = GetAnimBattlerSpriteId(ANIM_ATTACKER); + task->data[1] = ((GetBattlerSide(gBattleAnimAttacker)) != B_SIDE_PLAYER) ? -8 : 8; + task->data[2] = 0; + task->data[3] = 0; + gSprites[task->data[0]].pos2.x -= task->data[0]; + task->data[4] = AllocSpritePalette(10097); + task->data[5] = 0; + + dest = (task->data[4] + 0x10) * 0x10; + src = (gSprites[task->data[0]].oam.paletteNum + 0x10) * 0x10; + task->data[6] = sub_80A82E4(gBattleAnimAttacker); + if (task->data[6] == 20 || task->data[6] == 40) + task->data[6] = 2; + else + task->data[6] = 3; + CpuCopy32(&gPlttBufferUnfaded[src], &gPlttBufferFaded[dest], 0x20); + BlendPalette(dest, 16, gBattleAnimArgs[1], gBattleAnimArgs[0]); + task->func = sub_80A8CAC; +} + +void sub_80A8CAC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + switch (task->data[2]) + { + case 0: + sub_80A8D78(task, taskId); + gSprites[task->data[0]].pos2.x += task->data[1]; + if (++task->data[3] == 5) + { + task->data[3]--; + task->data[2]++; + } + break; + case 1: + sub_80A8D78(task, taskId); + gSprites[task->data[0]].pos2.x -= task->data[1]; + if (--task->data[3] == 0) + { + gSprites[task->data[0]].pos2.x = 0; + task->data[2]++; + } + break; + case 2: + if (!task->data[5]) + { + FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON); + DestroyAnimVisualTask(taskId); + } + break; + } +} + +void sub_80A8D78(struct Task *task, u8 taskId) +{ + s16 spriteId = duplicate_obj_of_side_rel2move_in_transparent_mode(0); + if (spriteId >= 0) + { + gSprites[spriteId].oam.priority = task->data[6]; + gSprites[spriteId].oam.paletteNum = task->data[4]; + gSprites[spriteId].data[0] = 8; + gSprites[spriteId].data[1] = taskId; + gSprites[spriteId].data[2] = spriteId; + gSprites[spriteId].pos2.x = gSprites[task->data[0]].pos2.x; + gSprites[spriteId].callback = sub_80A8DFC; + task->data[5]++; + } +} + +void sub_80A8DFC(struct Sprite *sprite) +{ + if (--sprite->data[0] == 0) + { + gTasks[sprite->data[1]].data[5]--; + obj_delete_but_dont_free_vram(sprite); + } +} + +void sub_80A8E30(struct Sprite *sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_3); + if (!GetBattlerSide(gBattleAnimAttacker)) + sprite->data[0] = 5; + else + sprite->data[0] = -10; + sprite->data[1] = -40; + sprite->callback = sub_80A8E88; +} + +void sub_80A8E88(struct Sprite *sprite) +{ + sprite->data[2] += sprite->data[0]; + sprite->data[3] += sprite->data[1]; + sprite->pos2.x = sprite->data[2] / 10; + sprite->pos2.y = sprite->data[3] / 10; + if (sprite->data[1] < -20) + sprite->data[1]++; + if (sprite->pos1.y + sprite->pos2.y < -32) + DestroyAnimSprite(sprite); +} + +void sub_80A8EE4(struct Sprite *sprite) +{ + int x; + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[4]; + sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[5]; + if (!GetBattlerSide(gBattleAnimTarget)) + { + x = (u16)gBattleAnimArgs[4] + 30; + sprite->pos1.x += x; + sprite->pos1.y = gBattleAnimArgs[5] - 20; + } + else + { + x = (u16)gBattleAnimArgs[4] - 30; + sprite->pos1.x += x; + sprite->pos1.y = gBattleAnimArgs[5] - 80; + } + sprite->callback = sub_80A6EEC; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} diff --git a/sym_ewram.txt b/sym_ewram.txt index 4b3f9d10c..08a834057 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -248,12 +248,9 @@ gUnknown_020375D6: @ 20375D6 .include "src/palette.o" .include "src/sound.o" .include "src/battle_anim.o" - -.align 2 - -gUnknown_02038444: @ 2038444 - .space 0x10 - + .include "src/battle_anim_80A5C6C.o" + + .space 0xC gUnknown_02038454: @ 2038454 .space 0x200 From 61343d50698e035834eb276b48189d4db0a4b9b8 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 7 Oct 2018 15:39:46 +0200 Subject: [PATCH 3/5] Decompile battle_anim_80A9C70 --- asm/battle_anim_80A9C70.s | 930 ----------------------------------- data/battle_anim_80A9C70.s | 17 - include/battle_anim.h | 8 + ld_script.txt | 3 +- src/battle_anim_80A9C70.c | 360 ++++++++++++++ src/battle_script_commands.c | 25 +- 6 files changed, 383 insertions(+), 960 deletions(-) delete mode 100644 asm/battle_anim_80A9C70.s create mode 100644 src/battle_anim_80A9C70.c diff --git a/asm/battle_anim_80A9C70.s b/asm/battle_anim_80A9C70.s deleted file mode 100644 index f43b36452..000000000 --- a/asm/battle_anim_80A9C70.s +++ /dev/null @@ -1,930 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start sub_80A9C70 -sub_80A9C70: @ 80A9C70 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gBattlerSpriteIds - adds r0, r4, r0 - ldrb r6, [r0] - ldr r0, =sub_80A9DB4 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gBattleAnimPicTable + 0x440 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gBattleAnimPaletteTable + 0x440 - bl LoadCompressedObjectPaletteUsingHeap - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - strh r4, [r1, 0x8] - cmp r5, 0 - beq _080A9D30 - movs r0, 0x1F - strh r0, [r1, 0xA] - movs r5, 0 - lsls r0, r6, 4 - ldr r7, =gSprites - adds r0, r6 - lsls r0, 2 - adds r6, r0, r7 -_080A9CC4: - movs r0, 0x20 - ldrsh r1, [r6, r0] - ldrh r2, [r6, 0x22] - adds r2, 0x20 - lsls r2, 16 - asrs r2, 16 - ldr r0, =gUnknown_0853EF60 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r3, r0, r7 - lsls r0, r5, 1 - adds r0, r5 - lsls r1, r0, 4 - adds r0, r1 - strh r0, [r3, 0x2E] - movs r0, 0xFF - lsls r0, 8 - strh r0, [r3, 0x30] - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - cmp r5, 0x4 - bls _080A9D08 - movs r0, 0x15 - strh r0, [r3, 0x3A] -_080A9D08: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x9 - bls _080A9CC4 - b _080A9D90 - .pool -_080A9D30: - movs r0, 0xF8 - lsls r0, 7 - strh r0, [r1, 0xA] - movs r5, 0 - lsls r0, r6, 4 - ldr r7, =gSprites - adds r0, r6 - lsls r0, 2 - adds r6, r0, r7 -_080A9D42: - movs r2, 0x20 - ldrsh r1, [r6, r2] - ldrh r2, [r6, 0x22] - subs r2, 0x20 - lsls r2, 16 - asrs r2, 16 - ldr r0, =gUnknown_0853EF60 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r3, r0, r7 - lsls r0, r5, 1 - adds r0, r5 - lsls r1, r0, 4 - adds r0, r1 - strh r0, [r3, 0x2E] - movs r0, 0x80 - lsls r0, 1 - strh r0, [r3, 0x30] - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - cmp r5, 0x4 - bls _080A9D86 - movs r0, 0x15 - strh r0, [r3, 0x3A] -_080A9D86: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x9 - bls _080A9D42 -_080A9D90: - ldr r0, =gSprites - lsls r1, r4, 4 - adds r1, r4 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] - mov r0, r8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A9C70 - - thumb_func_start sub_80A9DB4 -sub_80A9DB4: @ 80A9DB4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0xC] - movs r2, 0xC - ldrsh r0, [r4, r2] - cmp r0, 0x2 - bne _080A9E3A - movs r0, 0 - strh r0, [r4, 0xC] - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 20 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r0, 16 - ldrb r2, [r4, 0x10] - ldrh r3, [r4, 0xA] - movs r1, 0x10 - bl BlendPalette - ldrh r2, [r4, 0x12] - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080A9E10 - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _080A9E3E - movs r0, 0x1 - eors r0, r2 - strh r0, [r4, 0x12] - b _080A9E3E - .pool -_080A9E10: - ldrh r1, [r4, 0x10] - subs r0, r1, 0x1 - strh r0, [r4, 0x10] - lsls r0, 16 - cmp r0, 0 - bge _080A9E3E - strh r1, [r4, 0x10] - movs r0, 0x1 - eors r0, r2 - strh r0, [r4, 0x12] - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - bne _080A9E3E - adds r0, r5, 0 - bl DestroyTask - b _080A9E3E -_080A9E3A: - adds r0, r1, 0x1 - strh r0, [r4, 0xC] -_080A9E3E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80A9DB4 - - thumb_func_start sub_80A9E44 -sub_80A9E44: @ 80A9E44 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x3A] - movs r3, 0x3A - ldrsh r0, [r2, r3] - cmp r0, 0 - bne _080A9E70 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r3] - ldr r1, =sub_80A9E78 - str r1, [r2, 0x1C] - adds r0, r2, 0 - bl _call_via_r1 - b _080A9E74 - .pool -_080A9E70: - subs r0, r1, 0x1 - strh r0, [r2, 0x3A] -_080A9E74: - pop {r0} - bx r0 - thumb_func_end sub_80A9E44 - - thumb_func_start sub_80A9E78 -sub_80A9E78: @ 80A9E78 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Cos - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x26] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x7F - bgt _080A9EA4 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1D - b _080A9EAA -_080A9EA4: - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1F -_080A9EAA: - strb r0, [r1] - ldrh r0, [r4, 0x2E] - adds r0, 0x8 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x30] - ldrh r1, [r4, 0x38] - adds r0, r1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 24 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x34 - bne _080A9EEC - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080A9EE6 - adds r0, r4, 0 - bl DestroySpriteAndFreeResources - b _080A9EEC -_080A9EE6: - adds r0, r4, 0 - bl DestroySprite -_080A9EEC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80A9E78 - - thumb_func_start sub_80A9EF4 -sub_80A9EF4: @ 80A9EF4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 8 - ldr r1, =0xffe00000 - adds r0, r1 - lsrs r5, r0, 16 - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 8 - ldr r1, =0xffdc0000 - adds r0, r1 - lsrs r4, r0, 16 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080A9F32 - lsls r0, r5, 16 - ldr r1, =0xfffa0000 - adds r0, r1 - lsrs r5, r0, 16 -_080A9F32: - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - movs r1, 0x80 - lsls r1, 5 - movs r0, 0x52 - bl SetGpuReg - ldr r0, =gUnknown_0853EF48 - lsls r1, r5, 16 - asrs r1, 16 - lsls r2, r4, 16 - asrs r2, 16 - movs r3, 0x4 - bl CreateSprite - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =0x0000271a - bl GetSpriteTileStartByTag - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - bne _080A9F7C - ldr r1, =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] -_080A9F7C: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - ldr r1, =gUnknown_0853EF40 - bl SetSubspriteTables - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x26] - ldr r1, =sub_80A9FD0 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A9EF4 - - thumb_func_start sub_80A9FD0 -sub_80A9FD0: @ 80A9FD0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrh r0, [r1, 0xA] - adds r0, 0x1 - adds r2, r0, 0 - strh r0, [r1, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _080AA004 - ldr r0, =sub_80AA020 - str r0, [r1] - movs r0, 0 - strh r0, [r1, 0xA] - b _080AA01A - .pool -_080AA004: - lsls r0, r2, 24 - lsrs r0, 24 - movs r1, 0x10 - subs r1, r0 - lsls r1, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg -_080AA01A: - pop {r0} - bx r0 - thumb_func_end sub_80A9FD0 - - thumb_func_start sub_80AA020 -sub_80AA020: @ 80AA020 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =0x0000271a - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r5, r0, r1 - ldrh r0, [r5, 0xA] - adds r1, r0, 0x1 - strh r1, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xD - ble _080AA0B0 - ldrh r0, [r5, 0xC] - adds r0, 0x1 - movs r6, 0 - strh r0, [r5, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _080AA0B0 - ldr r3, =gPlttBufferFaded - lsls r2, 4 - mov r12, r2 - ldr r1, =0x0000010d - add r1, r12 - lsls r1, 1 - adds r1, r3 - ldrh r4, [r1] - movs r2, 0x87 - lsls r2, 1 - add r2, r12 - lsls r2, 1 - adds r2, r3 - ldrh r0, [r2] - strh r0, [r1] - ldr r0, =0x0000010f - add r0, r12 - lsls r0, 1 - adds r0, r3 - ldrh r1, [r0] - strh r1, [r2] - strh r4, [r0] - strh r6, [r5, 0xC] - ldrh r0, [r5, 0xE] - adds r0, 0x1 - strh r0, [r5, 0xE] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _080AA0B0 - strh r6, [r5, 0xE] - strh r6, [r5, 0xA] - ldrh r0, [r5, 0x10] - adds r0, 0x1 - strh r0, [r5, 0x10] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - bne _080AA0B0 - movs r0, 0x9 - strh r0, [r5, 0xA] - ldr r0, =sub_80AA0D0 - str r0, [r5] -_080AA0B0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80AA020 - - thumb_func_start sub_80AA0D0 -sub_80AA0D0: @ 80AA0D0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r2, r1, r2 - ldrh r0, [r2, 0xA] - subs r0, 0x1 - adds r3, r0, 0 - strh r0, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080AA108 - ldr r0, =sub_80AA124 - str r0, [r2] - movs r0, 0 - strh r0, [r2, 0xA] - b _080AA11E - .pool -_080AA108: - lsls r0, r3, 24 - lsrs r0, 24 - movs r1, 0x10 - subs r1, r0 - lsls r1, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg -_080AA11E: - pop {r0} - bx r0 - thumb_func_end sub_80AA0D0 - - thumb_func_start sub_80AA124 -sub_80AA124: @ 80AA124 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r1, r0, r1 - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x25 - bne _080AA16C - ldrh r0, [r1, 0x26] - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - b _080AA186 - .pool -_080AA16C: - cmp r0, 0x27 - bne _080AA186 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r4, 0 - bl DestroyAnimVisualTask -_080AA186: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80AA124 - - thumb_func_start AnimTask_StatsChange -AnimTask_StatsChange: @ 80AA18C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r3, 0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrh r0, [r0] - subs r0, 0xF - cmp r0, 0x2B - bls _080AA1A4 - b _080AA328 -_080AA1A4: - lsls r0, 2 - ldr r1, =_080AA1B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080AA1B8: - .4byte _080AA268 - .4byte _080AA26E - .4byte _080AA274 - .4byte _080AA27A - .4byte _080AA280 - .4byte _080AA286 - .4byte _080AA28C - .4byte _080AA292 - .4byte _080AA298 - .4byte _080AA29E - .4byte _080AA2A4 - .4byte _080AA2AA - .4byte _080AA2B0 - .4byte _080AA2B6 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA2BC - .4byte _080AA2C0 - .4byte _080AA2C4 - .4byte _080AA2C8 - .4byte _080AA2CC - .4byte _080AA2D0 - .4byte _080AA2D4 - .4byte _080AA2D8 - .4byte _080AA2E0 - .4byte _080AA2E8 - .4byte _080AA2F0 - .4byte _080AA2F8 - .4byte _080AA300 - .4byte _080AA308 - .4byte _080AA328 - .4byte _080AA328 - .4byte _080AA310 - .4byte _080AA314 - .4byte _080AA318 - .4byte _080AA320 -_080AA268: - movs r5, 0 - movs r2, 0 - b _080AA330 -_080AA26E: - movs r5, 0 - movs r2, 0x1 - b _080AA330 -_080AA274: - movs r5, 0 - movs r2, 0x3 - b _080AA330 -_080AA27A: - movs r5, 0 - movs r2, 0x5 - b _080AA330 -_080AA280: - movs r5, 0 - movs r2, 0x6 - b _080AA330 -_080AA286: - movs r5, 0 - movs r2, 0x2 - b _080AA330 -_080AA28C: - movs r5, 0 - movs r2, 0x4 - b _080AA330 -_080AA292: - movs r5, 0x1 - movs r2, 0 - b _080AA330 -_080AA298: - movs r5, 0x1 - movs r2, 0x1 - b _080AA330 -_080AA29E: - movs r5, 0x1 - movs r2, 0x3 - b _080AA330 -_080AA2A4: - movs r5, 0x1 - movs r2, 0x5 - b _080AA330 -_080AA2AA: - movs r5, 0x1 - movs r2, 0x6 - b _080AA330 -_080AA2B0: - movs r5, 0x1 - movs r2, 0x2 - b _080AA330 -_080AA2B6: - movs r5, 0x1 - movs r2, 0x4 - b _080AA330 -_080AA2BC: - movs r5, 0 - b _080AA2DA -_080AA2C0: - movs r5, 0 - b _080AA2E2 -_080AA2C4: - movs r5, 0 - b _080AA2EA -_080AA2C8: - movs r5, 0 - b _080AA2F2 -_080AA2CC: - movs r5, 0 - b _080AA2FA -_080AA2D0: - movs r5, 0 - b _080AA302 -_080AA2D4: - movs r5, 0 - b _080AA30A -_080AA2D8: - movs r5, 0x1 -_080AA2DA: - movs r2, 0 - movs r3, 0x1 - b _080AA330 -_080AA2E0: - movs r5, 0x1 -_080AA2E2: - movs r2, 0x1 - movs r3, 0x1 - b _080AA330 -_080AA2E8: - movs r5, 0x1 -_080AA2EA: - movs r2, 0x3 - movs r3, 0x1 - b _080AA330 -_080AA2F0: - movs r5, 0x1 -_080AA2F2: - movs r2, 0x5 - movs r3, 0x1 - b _080AA330 -_080AA2F8: - movs r5, 0x1 -_080AA2FA: - movs r2, 0x6 - movs r3, 0x1 - b _080AA330 -_080AA300: - movs r5, 0x1 -_080AA302: - movs r2, 0x2 - movs r3, 0x1 - b _080AA330 -_080AA308: - movs r5, 0x1 -_080AA30A: - movs r2, 0x4 - movs r3, 0x1 - b _080AA330 -_080AA310: - movs r5, 0 - b _080AA31A -_080AA314: - movs r5, 0 - b _080AA322 -_080AA318: - movs r5, 0x1 -_080AA31A: - movs r2, 0xFF - movs r3, 0 - b _080AA330 -_080AA320: - movs r5, 0x1 -_080AA322: - movs r2, 0xFF - movs r3, 0x1 - b _080AA330 -_080AA328: - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _080AA352 -_080AA330: - ldr r0, =gBattleAnimArgs - movs r1, 0 - strh r5, [r0] - strh r2, [r0, 0x2] - strh r1, [r0, 0x4] - strh r1, [r0, 0x6] - strh r3, [r0, 0x8] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8116EB4 - str r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 -_080AA352: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_StatsChange - - thumb_func_start LaunchStatusAnimation -LaunchStatusAnimation: @ 80AA364 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gBattleAnimAttacker - strb r4, [r0] - ldr r0, =gBattleAnimTarget - strb r4, [r0] - ldr r0, =gBattleAnims_StatusConditions - movs r2, 0 - bl LaunchBattleAnimation - ldr r0, =task0A_80788BC - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LaunchStatusAnimation - - thumb_func_start task0A_80788BC -task0A_80788BC: @ 80AA3B4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r0, [r0] - cmp r0, 0 - bne _080AA3F6 - ldr r0, =gBattleSpritesDataPtr - ldr r2, [r0] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - ldrsh r0, [r0, r1] - ldr r2, [r2, 0x4] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - adds r0, r4, 0 - bl DestroyTask -_080AA3F6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task0A_80788BC - - .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_anim_80A9C70.s b/data/battle_anim_80A9C70.s index 56486b8b7..892984c64 100644 --- a/data/battle_anim_80A9C70.s +++ b/data/battle_anim_80A9C70.s @@ -86,20 +86,3 @@ gUnknown_0853EF14:: @ 853EF14 .align 2 gUnknown_0853EF18:: @ 853EF18 spr_template 0x2714, 0x2714, gUnknown_085249CC, gUnknown_0853EEF8, NULL, gUnknown_0853EF14, sub_80A8A6C - - .align 2 -gUnknown_0853EF30:: @ 853EF30 - .byte 0xf0, 0xf0, 0x0c, 0x80, 0xf0, 0x30, 0x0d, 0x84, 0x30, 0xf0, 0x0e, 0x86, 0x30, 0x30, 0x08, 0x88 - - .align 2 -gUnknown_0853EF40:: @ 853EF40 - .4byte 0x00000004, gUnknown_0853EF30 - - .align 2 -gUnknown_0853EF48:: @ 853EF48 - spr_template 0x271a, 0x271a, gUnknown_08524A3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0853EF60:: @ 853EF60 - spr_template 0x2798, 0x2798, gUnknown_08524904, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80A9E44 - diff --git a/include/battle_anim.h b/include/battle_anim.h index c8a2779d8..2b5b3e20c 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -105,6 +105,14 @@ u8 sub_80A82E4(u8 battlerId); u8 GetSubstituteSpriteDefault_Y(u8 battlerId); // battle_anim_80A9C70.s +#define STAT_ANIM_PLUS1 15 +#define STAT_ANIM_PLUS2 39 +#define STAT_ANIM_MINUS1 22 +#define STAT_ANIM_MINUS2 46 +#define STAT_ANIM_MULTIPLE_PLUS1 55 +#define STAT_ANIM_MULTIPLE_PLUS2 56 +#define STAT_ANIM_MULTIPLE_MINUS1 57 +#define STAT_ANIM_MULTIPLE_MINUS2 58 void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId); // battle_anim_8170478.s diff --git a/ld_script.txt b/ld_script.txt index 1896b4fc9..6221f0501 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -114,7 +114,7 @@ SECTIONS { src/battle_anim_80A5C6C.o(.text); src/task.o(.text); src/reshow_battle_screen.o(.text); - asm/battle_anim_80A9C70.o(.text); + src/battle_anim_80A9C70.o(.text); src/title_screen.o(.text); asm/field_screen.o(.text); src/battle_setup.o(.text); @@ -423,6 +423,7 @@ SECTIONS { src/battle_anim_80A5C6C.o(.rodata); data/map_events.o(.rodata); data/battle_anim_80A9C70.o(.rodata); + src/battle_anim_80A9C70.o(.rodata); src/title_screen.o(.rodata); data/field_screen.o(.rodata); src/battle_setup.o(.rodata); diff --git a/src/battle_anim_80A9C70.c b/src/battle_anim_80A9C70.c new file mode 100644 index 000000000..1f8a53993 --- /dev/null +++ b/src/battle_anim_80A9C70.c @@ -0,0 +1,360 @@ +#include "global.h" +#include "battle.h" +#include "battle_anim.h" +#include "constants/battle_anim.h" +#include "constants/rgb.h" +#include "blend_palette.h" +#include "decompress.h" +#include "palette.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "gpu_regs.h" + +extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; +extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; +extern const u8 *const gBattleAnims_StatusConditions[]; +extern const struct OamData gUnknown_08524904; +extern const struct OamData gUnknown_08524A3C; + +extern void sub_8116EB4(u8 taskId); + +// This file's functions. +static void sub_80A9DB4(u8 taskId); +static void sub_80A9FD0(u8 taskId); +static void sub_80AA020(u8 taskId); +static void sub_80AA0D0(u8 taskId); +static void sub_80AA124(u8 taskId); +static void Task_DoStatusAnimation(u8 taskId); +static void sub_80A9E44(struct Sprite *sprite); +static void sub_80A9E78(struct Sprite *sprite); + +// const rom data +static const struct Subsprite gUnknown_0853EF30[] = +{ + {.x = -16, .y = -16, .shape = ST_OAM_SQUARE, .size = 3, .tileOffset = 0, .priority = 2}, + {.x = -16, .y = 48, .shape = ST_OAM_H_RECTANGLE, .size = 3, .tileOffset = 64, .priority = 2}, + {.x = 48, .y = -16, .shape = ST_OAM_V_RECTANGLE, .size = 3, .tileOffset = 96, .priority = 2}, + {.x = 48, .y = 48, .shape = ST_OAM_SQUARE, .size = 2, .tileOffset = 128, .priority = 2}, +}; + +static const struct SubspriteTable gUnknown_0853EF40[] = +{ + {ARRAY_COUNT(gUnknown_0853EF30), gUnknown_0853EF30}, +}; + +static const struct SpriteTemplate gUnknown_0853EF48 = +{ + .tileTag = ANIM_TAG_ICE_CUBE, + .paletteTag = ANIM_TAG_ICE_CUBE, + .oam = &gUnknown_08524A3C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct SpriteTemplate gUnknown_0853EF60 = +{ + .tileTag = ANIM_TAG_136, + .paletteTag = ANIM_TAG_136, + .oam = &gUnknown_08524904, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80A9E44, +}; + +// code +u8 sub_80A9C70(u8 battlerId, bool8 b) +{ + u8 battlerSpriteId = gBattlerSpriteIds[battlerId]; + u8 taskId = CreateTask(sub_80A9DB4, 10); + u8 spriteId2; + u8 i; + + LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_136)]); + LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_136)]); + gTasks[taskId].data[0] = battlerId; + if (b) + { + gTasks[taskId].data[1] = RGB_RED; + for (i = 0; i < 10; i++) + { + spriteId2 = CreateSprite(&gUnknown_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y + 32, 0); + gSprites[spriteId2].data[0] = i * 51; + gSprites[spriteId2].data[1] = -256; + gSprites[spriteId2].invisible = TRUE; + if (i > 4) + gSprites[spriteId2].data[6] = 21; + } + } + else + { + gTasks[taskId].data[1] = RGB_BLUE; + for (i = 0; i < 10; i++) + { + spriteId2 = CreateSprite(&gUnknown_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y - 32, 0); + gSprites[spriteId2].data[0] = i * 51; + gSprites[spriteId2].data[1] = 256; + gSprites[spriteId2].invisible = TRUE; + if (i > 4) + gSprites[spriteId2].data[6] = 21; + } + } + gSprites[spriteId2].data[7] = 1; + return taskId; +} + +static void sub_80A9DB4(u8 taskId) +{ + if (gTasks[taskId].data[2] == 2) + { + gTasks[taskId].data[2] = 0; + BlendPalette(0x100 + gTasks[taskId].data[0] * 16, 16, gTasks[taskId].data[4], gTasks[taskId].data[1]); + if (gTasks[taskId].data[5] == 0) + { + gTasks[taskId].data[4]++; + if (gTasks[taskId].data[4] > 8) + gTasks[taskId].data[5] ^= 1; + } + else + { + u16 var = gTasks[taskId].data[4]; + + gTasks[taskId].data[4]--; + if (gTasks[taskId].data[4] < 0) + { + gTasks[taskId].data[4] = var; + gTasks[taskId].data[5] ^= 1; + gTasks[taskId].data[3]++; + if (gTasks[taskId].data[3] == 2) + DestroyTask(taskId); + } + } + } + else + { + gTasks[taskId].data[2]++; + } +} + +static void sub_80A9E44(struct Sprite *sprite) +{ + if (sprite->data[6] == 0) + { + sprite->invisible = FALSE; + sprite->callback = sub_80A9E78; + sub_80A9E78(sprite); + } + else + { + sprite->data[6]--; + } +} + +static void sub_80A9E78(struct Sprite *sprite) +{ + sprite->pos2.x = Cos(sprite->data[0], 32); + sprite->pos2.y = Sin(sprite->data[0], 8); + if (sprite->data[0] < 128) + sprite->subpriority = 29; + else + sprite->subpriority = 31; + sprite->data[0] = (sprite->data[0] + 8) & 0xFF; + sprite->data[5] += sprite->data[1]; + sprite->pos2.y += sprite->data[5] >> 8; + sprite->data[2]++; + if (sprite->data[2] == 52) + { + if (sprite->data[7]) + DestroySpriteAndFreeResources(sprite); + else + DestroySprite(sprite); + } +} + +void sub_80A9EF4(u8 taskId) +{ + s16 x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) - 32; + s16 y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_3) - 36; + u8 spriteId; + + if (IsContest()) + x -= 6; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); + spriteId = CreateSprite(&gUnknown_0853EF48, x, y, 4); + if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF) + gSprites[spriteId].invisible = TRUE; + SetSubspriteTables(&gSprites[spriteId], gUnknown_0853EF40); + gTasks[taskId].data[15] = spriteId; + gTasks[taskId].func = sub_80A9FD0; +} + +static void sub_80A9FD0(u8 taskId) +{ + gTasks[taskId].data[1]++; + if (gTasks[taskId].data[1] == 10) + { + gTasks[taskId].func = sub_80AA020; + gTasks[taskId].data[1] = 0; + } + else + { + u8 var = gTasks[taskId].data[1]; + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(var, 16 - var)); + } +} + +static void sub_80AA020(u8 taskId) +{ + u8 palIndex = IndexOfSpritePaletteTag(ANIM_TAG_ICE_CUBE); + + if (gTasks[taskId].data[1]++ > 13) + { + gTasks[taskId].data[2]++; + if (gTasks[taskId].data[2] == 3) + { + u16 temp; + + temp = gPlttBufferFaded[0x100 + palIndex * 16 + 13]; + gPlttBufferFaded[0x100 + palIndex * 16 + 13] = gPlttBufferFaded[0x100 + palIndex * 16 + 14]; + gPlttBufferFaded[0x100 + palIndex * 16 + 14] = gPlttBufferFaded[0x100 + palIndex * 16 + 15]; + gPlttBufferFaded[0x100 + palIndex * 16 + 15] = temp; + + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3]++; + if (gTasks[taskId].data[3] == 3) + { + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[4]++; + if (gTasks[taskId].data[4] == 2) + { + gTasks[taskId].data[1] = 9; + gTasks[taskId].func = sub_80AA0D0; + } + } + } + } +} + +static void sub_80AA0D0(u8 taskId) +{ + gTasks[taskId].data[1]--; + if (gTasks[taskId].data[1] == -1) + { + gTasks[taskId].func = sub_80AA124; + gTasks[taskId].data[1] = 0; + } + else + { + u8 var = gTasks[taskId].data[1]; + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(var, 16 - var)); + } +} + +static void sub_80AA124(u8 taskId) +{ + gTasks[taskId].data[1]++; + if (gTasks[taskId].data[1] == 37) + { + u8 spriteId = gTasks[taskId].data[15]; + + FreeSpriteOamMatrix(&gSprites[spriteId]); + DestroySprite(&gSprites[spriteId]); + } + else if (gTasks[taskId].data[1] == 39) + { + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + DestroyAnimVisualTask(taskId); + } +} + +#define CASE(by, stat) case (STAT_ANIM_##by + stat - 1) + +void AnimTask_StatsChange(u8 taskId) +{ + bool16 goesDown = FALSE; + s16 animStatId = 0; + bool16 sharply = FALSE; + + switch (gBattleSpritesDataPtr->animationData->animArg) + { + CASE(PLUS1, STAT_ATK): goesDown = FALSE; animStatId = 0; break; + CASE(PLUS1, STAT_DEF): goesDown = FALSE; animStatId = 1; break; + CASE(PLUS1, STAT_SPEED): goesDown = FALSE; animStatId = 3; break; + CASE(PLUS1, STAT_SPATK): goesDown = FALSE; animStatId = 5; break; + CASE(PLUS1, STAT_SPDEF): goesDown = FALSE; animStatId = 6; break; + CASE(PLUS1, STAT_ACC): goesDown = FALSE; animStatId = 2; break; + CASE(PLUS1, STAT_EVASION): goesDown = FALSE; animStatId = 4; break; + + CASE(MINUS1, STAT_ATK): goesDown = TRUE; animStatId = 0; break; + CASE(MINUS1, STAT_DEF): goesDown = TRUE; animStatId = 1; break; + CASE(MINUS1, STAT_SPEED): goesDown = TRUE; animStatId = 3; break; + CASE(MINUS1, STAT_SPATK): goesDown = TRUE; animStatId = 5; break; + CASE(MINUS1, STAT_SPDEF): goesDown = TRUE; animStatId = 6; break; + CASE(MINUS1, STAT_ACC): goesDown = TRUE; animStatId = 2; break; + CASE(MINUS1, STAT_EVASION): goesDown = TRUE; animStatId = 4; break; + + CASE(PLUS2, STAT_ATK): goesDown = FALSE; animStatId = 0; sharply = TRUE; break; + CASE(PLUS2, STAT_DEF): goesDown = FALSE; animStatId = 1; sharply = TRUE; break; + CASE(PLUS2, STAT_SPEED): goesDown = FALSE; animStatId = 3; sharply = TRUE; break; + CASE(PLUS2, STAT_SPATK): goesDown = FALSE; animStatId = 5; sharply = TRUE; break; + CASE(PLUS2, STAT_SPDEF): goesDown = FALSE; animStatId = 6; sharply = TRUE; break; + CASE(PLUS2, STAT_ACC): goesDown = FALSE; animStatId = 2; sharply = TRUE; break; + CASE(PLUS2, STAT_EVASION): goesDown = FALSE; animStatId = 4; sharply = TRUE; break; + + CASE(MINUS2, STAT_ATK): goesDown = TRUE; animStatId = 0; sharply = TRUE; break; + CASE(MINUS2, STAT_DEF): goesDown = TRUE; animStatId = 1; sharply = TRUE; break; + CASE(MINUS2, STAT_SPEED): goesDown = TRUE; animStatId = 3; sharply = TRUE; break; + CASE(MINUS2, STAT_SPATK): goesDown = TRUE; animStatId = 5; sharply = TRUE; break; + CASE(MINUS2, STAT_SPDEF): goesDown = TRUE; animStatId = 6; sharply = TRUE; break; + CASE(MINUS2, STAT_ACC): goesDown = TRUE; animStatId = 2; sharply = TRUE; break; + CASE(MINUS2, STAT_EVASION): goesDown = TRUE; animStatId = 4; sharply = TRUE; break; + + case STAT_ANIM_MULTIPLE_PLUS1: goesDown = FALSE; animStatId = 0xFF; sharply = FALSE; break; + case STAT_ANIM_MULTIPLE_PLUS2: goesDown = FALSE; animStatId = 0xFF; sharply = TRUE; break; + case STAT_ANIM_MULTIPLE_MINUS1: goesDown = TRUE; animStatId = 0xFF; sharply = FALSE; break; + case STAT_ANIM_MULTIPLE_MINUS2: goesDown = TRUE; animStatId = 0xFF; sharply = TRUE; break; + + default: + DestroyAnimVisualTask(taskId); + return; + } + + gBattleAnimArgs[0] = goesDown; + gBattleAnimArgs[1] = animStatId; + gBattleAnimArgs[2] = 0; + gBattleAnimArgs[3] = 0; + gBattleAnimArgs[4] = sharply; + gTasks[taskId].func = sub_8116EB4; + sub_8116EB4(taskId); +} + +#undef CASE + +void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId) +{ + u8 taskId; + + gBattleAnimAttacker = battlerId; + gBattleAnimTarget = battlerId; + LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, 0); + taskId = CreateTask(Task_DoStatusAnimation, 10); + gTasks[taskId].data[0] = battlerId; +} + +static void Task_DoStatusAnimation(u8 taskId) +{ + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].data[0]].statusAnimActive = FALSE; + DestroyTask(taskId); + } +} diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 10b432d8e..0422c11e3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3,6 +3,7 @@ #include "constants/battle_move_effects.h" #include "constants/battle_script_commands.h" #include "battle_message.h" +#include "battle_anim.h" #include "battle_ai_script_commands.h" #include "battle_scripts.h" #include "constants/moves.h" @@ -4381,16 +4382,16 @@ static void atk47_setgraphicalstatchangevalues(void) switch (GET_STAT_BUFF_VALUE2(gBattleScripting.statChanger)) { case SET_STAT_BUFF_VALUE(1): // +1 - value = 0xF; + value = STAT_ANIM_PLUS1; break; case SET_STAT_BUFF_VALUE(2): // +2 - value = 0x27; + value = STAT_ANIM_PLUS2; break; case SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE: // -1 - value = 0x16; + value = STAT_ANIM_MINUS1; break; case SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE: // -2 - value = 0x2E; + value = STAT_ANIM_MINUS2; break; } gBattleScripting.animArg1 = GET_STAT_BUFF_ID(gBattleScripting.statChanger) + value - 1; @@ -4412,9 +4413,9 @@ static void atk48_playstatchangeanimation(void) { s16 startingStatAnimId; if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) - startingStatAnimId = 0x2D; + startingStatAnimId = STAT_ANIM_MINUS2 - 1; else - startingStatAnimId = 0x15; + startingStatAnimId = STAT_ANIM_MINUS1 - 1; while (statsToCheck != 0) { @@ -4447,18 +4448,18 @@ static void atk48_playstatchangeanimation(void) if (changeableStatsCount > 1) // more than one stat, so the color is gray { if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) - statAnimId = 0x3A; + statAnimId = STAT_ANIM_MULTIPLE_MINUS2; else - statAnimId = 0x39; + statAnimId = STAT_ANIM_MULTIPLE_MINUS1; } } else // goes up { s16 startingStatAnimId; if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) - startingStatAnimId = 0x26; + startingStatAnimId = STAT_ANIM_PLUS2 - 1; else - startingStatAnimId = 0xE; + startingStatAnimId = STAT_ANIM_PLUS1 - 1; while (statsToCheck != 0) { @@ -4473,9 +4474,9 @@ static void atk48_playstatchangeanimation(void) if (changeableStatsCount > 1) // more than one stat, so the color is gray { if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) - statAnimId = 0x38; + statAnimId = STAT_ANIM_MULTIPLE_PLUS2; else - statAnimId = 0x37; + statAnimId = STAT_ANIM_MULTIPLE_PLUS1; } } From 413e26e83ddecca2e8a48ae8337f3309b29a9903 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 7 Oct 2018 17:45:37 +0200 Subject: [PATCH 4/5] port 80d51ac --- asm/battle_anim_80D51AC.s | 2446 ------------------------------------ data/battle_anim_scripts.s | 8 +- include/battle_anim.h | 9 +- ld_script.txt | 2 +- src/battle_anim.c | 2 +- src/battle_anim_80A5C6C.c | 1 - src/battle_anim_80D51AC.c | 1007 +++++++++++++++ src/item_menu_icons.c | 16 +- 8 files changed, 1029 insertions(+), 2462 deletions(-) delete mode 100644 asm/battle_anim_80D51AC.s create mode 100644 src/battle_anim_80D51AC.c diff --git a/asm/battle_anim_80D51AC.s b/asm/battle_anim_80D51AC.s deleted file mode 100644 index 0b0378a99..000000000 --- a/asm/battle_anim_80D51AC.s +++ /dev/null @@ -1,2446 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start AnimTask_ShakeMon -AnimTask_ShakeMon: @ 80D51AC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _080D51D0 - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D520C - .pool -_080D51D0: - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r4, 0x2] - strh r1, [r0, 0x24] - ldrh r1, [r4, 0x4] - strh r1, [r0, 0x26] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0x8] - ldrh r1, [r4, 0x6] - strh r1, [r0, 0xA] - ldrh r1, [r4, 0x8] - strh r1, [r0, 0xC] - ldrh r1, [r4, 0x8] - strh r1, [r0, 0xE] - ldrh r1, [r4, 0x2] - strh r1, [r0, 0x10] - ldrh r1, [r4, 0x4] - strh r1, [r0, 0x12] - ldr r1, =sub_80D5220 - str r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 -_080D520C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeMon - - thumb_func_start sub_80D5220 -sub_80D5220: @ 80D5220 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r3, r0, r1 - ldrh r0, [r3, 0xE] - movs r2, 0xE - ldrsh r5, [r3, r2] - adds r7, r1, 0 - cmp r5, 0 - bne _080D52C6 - ldr r2, =gSprites - movs r6, 0x8 - ldrsh r1, [r3, r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - movs r6, 0x24 - ldrsh r0, [r1, r6] - adds r6, r2, 0 - cmp r0, 0 - bne _080D5264 - ldrh r0, [r3, 0x10] - strh r0, [r1, 0x24] - b _080D5266 - .pool -_080D5264: - strh r5, [r1, 0x24] -_080D5266: - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r7 - movs r0, 0x8 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r6 - movs r5, 0x26 - ldrsh r0, [r1, r5] - cmp r0, 0 - bne _080D5286 - ldrh r0, [r3, 0x12] - b _080D5288 -_080D5286: - movs r0, 0 -_080D5288: - strh r0, [r1, 0x26] - adds r0, r2, r4 - lsls r0, 3 - adds r2, r0, r7 - ldrh r0, [r2, 0xC] - strh r0, [r2, 0xE] - ldrh r0, [r2, 0xA] - subs r0, 0x1 - strh r0, [r2, 0xA] - lsls r0, 16 - asrs r3, r0, 16 - cmp r3, 0 - bne _080D52CA - movs r0, 0x8 - ldrsh r1, [r2, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r3, [r0, 0x24] - movs r5, 0x8 - ldrsh r1, [r2, r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - strh r3, [r0, 0x26] - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _080D52CA -_080D52C6: - subs r0, 0x1 - strh r0, [r3, 0xE] -_080D52CA: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80D5220 - - thumb_func_start AnimTask_ShakeMon2 -AnimTask_ShakeMon2: @ 80D52D0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r2, =gBattleAnimArgs - ldrh r0, [r2] - movs r3, 0 - ldrsh r1, [r2, r3] - cmp r1, 0x3 - bgt _080D52FC - lsls r0, 24 - lsrs r0, 24 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xFF - bne _080D5352 - b _080D5356 - .pool -_080D52FC: - cmp r1, 0x8 - beq _080D5348 - movs r1, 0 - ldrsh r0, [r2, r1] - cmp r0, 0x5 - beq _080D531C - cmp r0, 0x5 - bgt _080D5312 - cmp r0, 0x4 - beq _080D5318 - b _080D5324 -_080D5312: - cmp r0, 0x6 - beq _080D5320 - b _080D5324 -_080D5318: - movs r0, 0 - b _080D5326 -_080D531C: - movs r0, 0x2 - b _080D5326 -_080D5320: - movs r0, 0x1 - b _080D5326 -_080D5324: - movs r0, 0x3 -_080D5326: - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - bne _080D533C - movs r6, 0x1 -_080D533C: - ldr r0, =gBattlerSpriteIds - adds r0, r4, r0 - b _080D5350 - .pool -_080D5348: - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r0, r1 -_080D5350: - ldrb r3, [r0] -_080D5352: - cmp r6, 0 - beq _080D5368 -_080D5356: - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D53A6 - .pool -_080D5368: - ldr r1, =gSprites - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - ldr r2, =gBattleAnimArgs - ldrh r1, [r2, 0x2] - strh r1, [r0, 0x24] - ldrh r1, [r2, 0x4] - strh r1, [r0, 0x26] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r3, [r0, 0x8] - ldrh r1, [r2, 0x6] - strh r1, [r0, 0xA] - ldrh r1, [r2, 0x8] - strh r1, [r0, 0xC] - ldrh r1, [r2, 0x8] - strh r1, [r0, 0xE] - ldrh r1, [r2, 0x2] - strh r1, [r0, 0x10] - ldrh r1, [r2, 0x4] - strh r1, [r0, 0x12] - ldr r1, =sub_80D53BC - str r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 -_080D53A6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeMon2 - - thumb_func_start sub_80D53BC -sub_80D53BC: @ 80D53BC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r3, r0, r1 - ldrh r2, [r3, 0xE] - movs r4, 0xE - ldrsh r0, [r3, r4] - mov r12, r1 - cmp r0, 0 - bne _080D5474 - ldr r2, =gSprites - movs r7, 0x8 - ldrsh r1, [r3, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r2 - movs r0, 0x24 - ldrsh r1, [r4, r0] - ldrh r5, [r3, 0x10] - movs r7, 0x10 - ldrsh r0, [r3, r7] - adds r7, r2, 0 - cmp r1, r0 - bne _080D5408 - negs r0, r5 - strh r0, [r4, 0x24] - b _080D540A - .pool -_080D5408: - strh r5, [r4, 0x24] -_080D540A: - lsls r3, r6, 2 - adds r1, r3, r6 - lsls r1, 3 - add r1, r12 - movs r0, 0x8 - ldrsh r2, [r1, r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r4, r0, r7 - movs r0, 0x26 - ldrsh r2, [r4, r0] - mov r8, r2 - ldrh r5, [r1, 0x12] - movs r2, 0x12 - ldrsh r0, [r1, r2] - cmp r8, r0 - bne _080D5434 - negs r0, r5 - strh r0, [r4, 0x26] - b _080D5436 -_080D5434: - strh r5, [r4, 0x26] -_080D5436: - adds r0, r3, r6 - lsls r0, 3 - mov r4, r12 - adds r3, r0, r4 - ldrh r0, [r3, 0xC] - strh r0, [r3, 0xE] - ldrh r0, [r3, 0xA] - subs r0, 0x1 - strh r0, [r3, 0xA] - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0 - bne _080D5478 - movs r0, 0x8 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - strh r2, [r0, 0x24] - movs r4, 0x8 - ldrsh r1, [r3, r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - strh r2, [r0, 0x26] - adds r0, r6, 0 - bl DestroyAnimVisualTask - b _080D5478 -_080D5474: - subs r0, r2, 0x1 - strh r0, [r3, 0xE] -_080D5478: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80D53BC - - thumb_func_start AnimTask_ShakeMonInPlace -AnimTask_ShakeMonInPlace: @ 80D5484 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xFF - bne _080D54A8 - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D54F6 - .pool -_080D54A8: - ldr r0, =gSprites - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r4, 0x2] - ldrh r2, [r1, 0x24] - adds r0, r2 - movs r2, 0 - strh r0, [r1, 0x24] - ldrh r0, [r4, 0x4] - ldrh r6, [r1, 0x26] - adds r0, r6 - strh r0, [r1, 0x26] - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - strh r3, [r1, 0x8] - strh r2, [r1, 0xA] - ldrh r0, [r4, 0x6] - strh r0, [r1, 0xC] - strh r2, [r1, 0xE] - ldrh r0, [r4, 0x8] - strh r0, [r1, 0x10] - movs r2, 0x2 - ldrsh r0, [r4, r2] - lsls r0, 1 - strh r0, [r1, 0x12] - movs r6, 0x4 - ldrsh r0, [r4, r6] - lsls r0, 1 - strh r0, [r1, 0x14] - ldr r2, =sub_80D5508 - str r2, [r1] - adds r0, r5, 0 - bl _call_via_r2 -_080D54F6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeMonInPlace - - thumb_func_start sub_80D5508 -sub_80D5508: @ 80D5508 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r0, [r4, r3] - adds r6, r1, 0 - cmp r0, 0 - beq _080D5526 - b _080D5638 -_080D5526: - ldrh r1, [r4, 0xA] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D5568 - ldr r2, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0x12] - ldrh r3, [r0, 0x24] - adds r1, r3 - strh r1, [r0, 0x24] - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0x14] - ldrh r3, [r0, 0x26] - adds r1, r3 - strh r1, [r0, 0x26] - adds r3, r2, 0 - b _080D5592 - .pool -_080D5568: - ldr r3, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x24] - ldrh r2, [r4, 0x12] - subs r1, r2 - strh r1, [r0, 0x24] - movs r2, 0x8 - ldrsh r1, [r4, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - ldrh r2, [r4, 0x14] - subs r1, r2 - strh r1, [r0, 0x26] -_080D5592: - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r6 - ldrh r0, [r4, 0x10] - strh r0, [r4, 0xE] - ldrh r0, [r4, 0xA] - adds r2, r0, 0x1 - strh r2, [r4, 0xA] - lsls r0, r2, 16 - asrs r0, 16 - movs r6, 0xC - ldrsh r1, [r4, r6] - cmp r0, r1 - blt _080D563C - movs r0, 0x1 - ands r2, r0 - cmp r2, 0 - beq _080D55F8 - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - movs r2, 0x12 - ldrsh r0, [r4, r2] - lsrs r2, r0, 31 - adds r0, r2 - asrs r0, 1 - ldrh r6, [r1, 0x24] - adds r0, r6 - strh r0, [r1, 0x24] - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - movs r2, 0x14 - ldrsh r0, [r4, r2] - lsrs r2, r0, 31 - adds r0, r2 - asrs r0, 1 - ldrh r3, [r1, 0x26] - adds r0, r3 - strh r0, [r1, 0x26] - b _080D5630 - .pool -_080D55F8: - movs r6, 0x8 - ldrsh r0, [r4, r6] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - movs r0, 0x12 - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - ldrh r0, [r2, 0x24] - subs r0, r1 - strh r0, [r2, 0x24] - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - movs r3, 0x14 - ldrsh r1, [r4, r3] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - ldrh r0, [r2, 0x26] - subs r0, r1 - strh r0, [r2, 0x26] -_080D5630: - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D563C -_080D5638: - subs r0, r2, 0x1 - strh r0, [r4, 0xE] -_080D563C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D5508 - - thumb_func_start AnimTask_ShakeAndSinkMon -AnimTask_ShakeAndSinkMon: @ 80D5644 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gBattleAnimArgs - ldrb r0, [r5] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrh r2, [r5, 0x2] - strh r2, [r1, 0x24] - ldr r2, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r2 - strh r0, [r1, 0x8] - ldrh r0, [r5, 0x2] - strh r0, [r1, 0xA] - ldrh r0, [r5, 0x4] - strh r0, [r1, 0xC] - ldrh r0, [r5, 0x6] - strh r0, [r1, 0xE] - ldrh r0, [r5, 0x8] - strh r0, [r1, 0x10] - ldr r2, =sub_80D56A4 - str r2, [r1] - adds r0, r4, 0 - bl _call_via_r2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ShakeAndSinkMon - - thumb_func_start sub_80D56A4 -sub_80D56A4: @ 80D56A4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r2, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r3, r0, r2 - ldrb r5, [r3, 0x8] - ldrh r4, [r3, 0xA] - ldrh r1, [r3, 0x18] - adds r0, r1, 0x1 - strh r0, [r3, 0x18] - movs r7, 0xC - ldrsh r0, [r3, r7] - lsls r1, 16 - asrs r1, 16 - mov r12, r2 - ldr r7, =gSprites - cmp r0, r1 - bne _080D56F6 - movs r0, 0 - strh r0, [r3, 0x18] - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r1, r0, r7 - ldrh r3, [r1, 0x24] - movs r0, 0x24 - ldrsh r2, [r1, r0] - lsls r0, r4, 16 - asrs r0, 16 - cmp r2, r0 - bne _080D56EE - negs r0, r2 - lsls r0, 16 - lsrs r4, r0, 16 -_080D56EE: - lsls r0, r4, 16 - asrs r0, 16 - adds r0, r3 - strh r0, [r1, 0x24] -_080D56F6: - lsls r2, r6, 2 - adds r2, r6 - lsls r2, 3 - add r2, r12 - strh r4, [r2, 0xA] - ldrh r1, [r2, 0xE] - ldrh r0, [r2, 0x1A] - adds r1, r0 - strh r1, [r2, 0x1A] - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r0, r7 - lsls r1, 16 - asrs r1, 24 - strh r1, [r0, 0x26] - ldrh r0, [r2, 0x10] - subs r0, 0x1 - strh r0, [r2, 0x10] - lsls r0, 16 - cmp r0, 0 - bne _080D5728 - adds r0, r6, 0 - bl DestroyAnimVisualTask -_080D5728: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D56A4 - - thumb_func_start sub_80D5738 -sub_80D5738: @ 80D5738 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0x1 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r7, r0, 24 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x5 - ble _080D575C - movs r0, 0x5 - strh r0, [r4, 0x8] -_080D575C: - movs r1, 0 - movs r2, 0x8 - ldrsh r0, [r4, r2] - adds r3, r4, 0 - ldr r2, =gTasks - mov r12, r2 - lsls r4, r5, 2 - ldr r2, =sub_80D57B8 - mov r8, r2 - cmp r1, r0 - bge _080D5782 - adds r2, r0, 0 -_080D5774: - lsls r0, r6, 25 - lsrs r6, r0, 24 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r2 - blt _080D5774 -_080D5782: - adds r0, r4, r5 - lsls r0, 3 - add r0, r12 - strh r7, [r0, 0x8] - ldrh r1, [r3, 0x2] - strh r1, [r0, 0xA] - ldrh r1, [r3, 0x4] - strh r1, [r0, 0xC] - ldrh r1, [r3, 0x6] - strh r1, [r0, 0xE] - strh r6, [r0, 0x10] - mov r1, r8 - str r1, [r0] - adds r0, r5, 0 - bl _call_via_r8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5738 - - thumb_func_start sub_80D57B8 -sub_80D57B8: @ 80D57B8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r5, r0, r1 - ldrb r4, [r5, 0x8] - movs r1, 0x12 - ldrsh r0, [r5, r1] - movs r2, 0xA - ldrsh r1, [r5, r2] - bl Sin - ldr r2, =gSprites - lsls r1, r4, 4 - adds r1, r4 - lsls r1, 2 - adds r4, r1, r2 - strh r0, [r4, 0x24] - movs r1, 0x12 - ldrsh r0, [r5, r1] - movs r2, 0xC - ldrsh r1, [r5, r2] - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r1, [r5, 0xC] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r5, 0x10] - ldrh r1, [r5, 0x12] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x12] - cmp r0, 0 - bne _080D5810 - ldrh r0, [r5, 0xE] - subs r0, 0x1 - strh r0, [r5, 0xE] -_080D5810: - movs r2, 0xE - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _080D5822 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - adds r0, r6, 0 - bl DestroyAnimVisualTask -_080D5822: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D57B8 - - thumb_func_start AnimTask_TranslateMonEllipticalRespectSide -AnimTask_TranslateMonEllipticalRespectSide: @ 80D5830 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D584C - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] -_080D584C: - adds r0, r4, 0 - bl sub_80D5738 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_TranslateMonEllipticalRespectSide - - thumb_func_start sub_80D5860 -sub_80D5860: @ 80D5860 - push {r4,lr} - adds r4, r0, 0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5890 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - b _080D5894 - .pool -_080D5890: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] -_080D5894: - strh r0, [r4, 0x30] - ldrh r2, [r1] - movs r0, 0 - strh r2, [r4, 0x2E] - strh r0, [r4, 0x32] - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r4, 0x34] - strh r2, [r4, 0x36] - ldr r1, =sub_80D58D4 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A6630 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5860 - - thumb_func_start sub_80D58D4 -sub_80D58D4: @ 80D58D4 - push {lr} - ldrh r1, [r0, 0x36] - strh r1, [r0, 0x2E] - ldrh r1, [r0, 0x30] - negs r1, r1 - strh r1, [r0, 0x30] - ldr r1, =sub_80A6630 - str r1, [r0, 0x1C] - ldr r1, =DestroyAnimSprite - bl StoreSpriteCallbackInData6 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D58D4 - - thumb_func_start sub_80D58F8 -sub_80D58F8: @ 80D58F8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r5, =gBattleAnimArgs - ldrb r0, [r5, 0x4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - ldrh r2, [r5] - movs r1, 0 - strh r2, [r4, 0x2E] - strh r1, [r4, 0x30] - ldrh r1, [r5, 0x2] - strh r1, [r4, 0x32] - strh r0, [r4, 0x34] - strh r2, [r4, 0x36] - ldr r1, =sub_80D5944 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A6630 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D58F8 - - thumb_func_start sub_80D5944 -sub_80D5944: @ 80D5944 - push {lr} - ldrh r1, [r0, 0x36] - strh r1, [r0, 0x2E] - ldrh r1, [r0, 0x32] - negs r1, r1 - strh r1, [r0, 0x32] - ldr r1, =sub_80A6630 - str r1, [r0, 0x1C] - ldr r1, =DestroyAnimSprite - bl StoreSpriteCallbackInData6 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5944 - - thumb_func_start sub_80D5968 -sub_80D5968: @ 80D5968 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080D598C - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - b _080D5990 - .pool -_080D598C: - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimTarget -_080D5990: - ldrb r0, [r0] - adds r0, r1 - ldrb r7, [r0] - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x4] - movs r3, 0 - strh r0, [r6, 0x2E] - ldr r0, =gSprites - lsls r4, r7, 4 - adds r4, r7 - lsls r4, 2 - adds r4, r0 - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r6, 0x30] - ldrh r0, [r4, 0x20] - strh r0, [r6, 0x32] - ldrh r0, [r4, 0x26] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r6, 0x34] - ldrh r0, [r4, 0x22] - strh r0, [r6, 0x36] - adds r0, r6, 0 - str r3, [sp] - bl sub_80A6E14 - ldr r3, [sp] - strh r3, [r6, 0x34] - strh r3, [r6, 0x36] - ldrh r0, [r4, 0x24] - strh r0, [r6, 0x38] - ldrh r0, [r4, 0x26] - strh r0, [r6, 0x3A] - adds r2, r6, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r1, 0x2 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _080D5A00 - strh r3, [r6, 0x32] - b _080D5A06 - .pool -_080D5A00: - cmp r0, 0x2 - bne _080D5A06 - strh r3, [r6, 0x30] -_080D5A06: - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0x2] - lsls r0, r7, 8 - orrs r0, r1 - strh r0, [r6, 0x3C] - ldr r0, =sub_80D5A24 - str r0, [r6, 0x1C] - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5968 - - thumb_func_start sub_80D5A24 -sub_80D5A24: @ 80D5A24 - push {r4-r6,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x3C] - lsls r1, r0, 24 - lsrs r4, r1, 24 - adds r5, r4, 0 - lsls r0, 16 - asrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r3, r1, r0 - ldrh r0, [r2, 0x2E] - movs r6, 0x2E - ldrsh r1, [r2, r6] - cmp r1, 0 - bne _080D5A64 - cmp r4, 0x1 - bhi _080D5A4E - strh r1, [r3, 0x24] -_080D5A4E: - cmp r5, 0x2 - beq _080D5A56 - cmp r5, 0 - bne _080D5A58 -_080D5A56: - strh r1, [r3, 0x26] -_080D5A58: - adds r0, r2, 0 - bl DestroyAnimSprite - b _080D5A8E - .pool -_080D5A64: - subs r0, 0x1 - strh r0, [r2, 0x2E] - ldrh r1, [r2, 0x30] - ldrh r0, [r2, 0x34] - adds r1, r0 - strh r1, [r2, 0x34] - ldrh r0, [r2, 0x32] - ldrh r4, [r2, 0x36] - adds r0, r4 - strh r0, [r2, 0x36] - lsls r1, 16 - asrs r1, 24 - ldrh r6, [r2, 0x38] - adds r1, r6 - strh r1, [r3, 0x24] - ldrh r0, [r2, 0x36] - lsls r0, 16 - asrs r0, 24 - ldrh r2, [r2, 0x3A] - adds r0, r2 - strh r0, [r3, 0x26] -_080D5A8E: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D5A24 - - thumb_func_start sub_80D5A94 -sub_80D5A94: @ 80D5A94 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080D5AB0 - ldr r0, =gBattleAnimAttacker - b _080D5AB2 - .pool -_080D5AB0: - ldr r0, =gBattleAnimTarget -_080D5AB2: - ldrb r2, [r0] - ldr r0, =gBattlerSpriteIds - adds r0, r2, r0 - ldrb r6, [r0] - adds r0, r2, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5ADC - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] - movs r2, 0x6 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _080D5ADC - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080D5ADC: - ldr r2, =gBattleAnimArgs - ldrh r0, [r2, 0x8] - movs r4, 0 - strh r0, [r5, 0x2E] - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x20] - strh r0, [r5, 0x30] - ldrh r0, [r2, 0x2] - ldrh r3, [r1, 0x20] - adds r0, r3 - strh r0, [r5, 0x32] - ldrh r0, [r1, 0x22] - strh r0, [r5, 0x34] - ldrh r0, [r2, 0x4] - ldrh r1, [r1, 0x22] - adds r0, r1 - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl sub_80A6E14 - strh r4, [r5, 0x34] - strh r4, [r5, 0x36] - strh r6, [r5, 0x38] - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A6680 - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5A94 - - thumb_func_start sub_80D5B48 -sub_80D5B48: @ 80D5B48 - push {r4-r7,lr} - adds r6, r0, 0 - adds r2, r6, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080D5B70 - ldr r0, =gBattleAnimAttacker - b _080D5B72 - .pool -_080D5B70: - ldr r0, =gBattleAnimTarget -_080D5B72: - ldrb r1, [r0] - ldr r0, =gBattlerSpriteIds - adds r0, r1, r0 - ldrb r7, [r0] - adds r0, r1, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5B9C - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] - movs r2, 0x6 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _080D5B9C - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080D5B9C: - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x8] - strh r0, [r6, 0x2E] - ldr r0, =gSprites - lsls r4, r7, 4 - adds r4, r7 - lsls r4, 2 - adds r4, r0 - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r6, 0x30] - ldrh r1, [r5, 0x2] - adds r0, r1 - strh r0, [r6, 0x32] - ldrh r0, [r4, 0x26] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r6, 0x34] - ldrh r1, [r5, 0x4] - adds r0, r1 - strh r0, [r6, 0x36] - adds r0, r6, 0 - bl sub_80A6E14 - ldrh r0, [r4, 0x24] - lsls r0, 8 - strh r0, [r6, 0x34] - ldrh r0, [r4, 0x26] - lsls r0, 8 - strh r0, [r6, 0x36] - strh r7, [r6, 0x38] - ldrh r0, [r5, 0xA] - strh r0, [r6, 0x3A] - lsls r0, 16 - cmp r0, 0 - bne _080D5C04 - ldr r1, =DestroyAnimSprite - adds r0, r6, 0 - bl StoreSpriteCallbackInData6 - b _080D5C0C - .pool -_080D5C04: - ldr r1, =sub_80D5C20 - adds r0, r6, 0 - bl StoreSpriteCallbackInData6 -_080D5C0C: - ldr r0, =sub_80A6680 - str r0, [r6, 0x1C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5B48 - - thumb_func_start sub_80D5C20 -sub_80D5C20: @ 80D5C20 - push {r4,lr} - ldr r4, =gSprites - movs r1, 0x38 - ldrsh r2, [r0, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - movs r3, 0 - strh r3, [r1, 0x24] - movs r1, 0x38 - ldrsh r2, [r0, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - strh r3, [r1, 0x26] - bl DestroyAnimSprite - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5C20 - - thumb_func_start AnimTask_WindUpLunge -AnimTask_WindUpLunge: @ 80D5C50 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r5, =gBattleAnimArgs - movs r0, 0x6 - ldrsh r1, [r5, r0] - movs r0, 0x80 - lsls r0, 8 - bl __divsi3 - lsls r0, 16 - lsrs r7, r0, 16 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5C82 - ldrh r0, [r5, 0x2] - negs r0, r0 - strh r0, [r5, 0x2] - ldrh r0, [r5, 0xA] - negs r0, r0 - strh r0, [r5, 0xA] -_080D5C82: - ldrb r0, [r5] - bl GetAnimBattlerSpriteId - ldr r1, =gTasks - lsls r4, r6, 2 - adds r4, r6 - lsls r4, 3 - adds r4, r1 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x8] - movs r1, 0x2 - ldrsh r0, [r5, r1] - lsls r0, 8 - movs r2, 0x6 - ldrsh r1, [r5, r2] - bl __divsi3 - strh r0, [r4, 0xA] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0xC] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0xE] - ldrh r0, [r5, 0x8] - strh r0, [r4, 0x10] - movs r1, 0xA - ldrsh r0, [r5, r1] - lsls r0, 8 - movs r2, 0xC - ldrsh r1, [r5, r2] - bl __divsi3 - strh r0, [r4, 0x12] - ldrh r0, [r5, 0xC] - strh r0, [r4, 0x14] - strh r7, [r4, 0x16] - ldr r0, =sub_80D5CE4 - str r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_WindUpLunge - - thumb_func_start sub_80D5CE4 -sub_80D5CE4: @ 80D5CE4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r5, r1, r2 - ldrb r1, [r5, 0x8] - ldrh r0, [r5, 0xA] - ldrh r2, [r5, 0x1E] - adds r0, r2 - strh r0, [r5, 0x1E] - ldr r2, =gSprites - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - adds r4, r2 - lsls r0, 16 - asrs r0, 24 - strh r0, [r4, 0x24] - ldrh r0, [r5, 0x1C] - lsrs r0, 8 - movs r2, 0xC - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r5, 0x16] - ldrh r1, [r5, 0x1C] - adds r0, r1 - strh r0, [r5, 0x1C] - ldrh r0, [r5, 0xE] - subs r0, 0x1 - strh r0, [r5, 0xE] - lsls r0, 16 - cmp r0, 0 - bne _080D5D34 - ldr r0, =sub_80D5D48 - str r0, [r5] -_080D5D34: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5CE4 - - thumb_func_start sub_80D5D48 -sub_80D5D48: @ 80D5D48 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0x10] - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _080D5D70 - subs r0, r1, 0x1 - strh r0, [r4, 0x10] - b _080D5DA4 - .pool -_080D5D70: - ldrb r0, [r4, 0x8] - ldrh r2, [r4, 0x12] - ldrh r1, [r4, 0x20] - adds r2, r1 - strh r2, [r4, 0x20] - ldr r3, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - lsls r2, 16 - asrs r2, 24 - ldrh r0, [r4, 0x1E] - lsls r0, 16 - asrs r0, 24 - adds r2, r0 - strh r2, [r1, 0x24] - ldrh r0, [r4, 0x14] - subs r0, 0x1 - strh r0, [r4, 0x14] - lsls r0, 16 - cmp r0, 0 - bne _080D5DA4 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080D5DA4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5D48 - - thumb_func_start sub_80D5DB0 -sub_80D5DB0: @ 80D5DB0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gBattleAnimArgs - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0x2 - beq _080D5DDE - cmp r0, 0x2 - bgt _080D5DD8 - cmp r0, 0 - blt _080D5E10 - ldrb r0, [r1] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r2, r0, 24 - b _080D5E18 - .pool -_080D5DD8: - cmp r0, 0x3 - beq _080D5DE8 - b _080D5E10 -_080D5DDE: - ldr r5, =gBattleAnimAttacker - b _080D5DEA - .pool -_080D5DE8: - ldr r5, =gBattleAnimTarget -_080D5DEA: - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _080D5E10 - ldr r1, =gBattlerSpriteIds - ldrb r0, [r5] - eors r0, r4 - adds r0, r1 - ldrb r2, [r0] - b _080D5E18 - .pool -_080D5E10: - adds r0, r6, 0 - bl DestroyAnimVisualTask - b _080D5E58 -_080D5E18: - ldr r1, =gTasks - lsls r4, r6, 2 - adds r0, r4, r6 - lsls r0, 3 - adds r5, r0, r1 - strh r2, [r5, 0x8] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5E44 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x2] - b _080D5E4A - .pool -_080D5E44: - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x2] - negs r0, r0 -_080D5E4A: - strh r0, [r5, 0xA] - ldr r0, =gTasks - adds r1, r4, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D5E6C - str r0, [r1] -_080D5E58: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5DB0 - - thumb_func_start sub_80D5E6C -sub_80D5E6C: @ 80D5E6C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r2, [r1, 0x8] - ldr r3, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r1, 0xA] - ldrh r2, [r0, 0x24] - adds r1, r2 - strh r1, [r0, 0x24] - movs r2, 0x24 - ldrsh r1, [r0, r2] - movs r2, 0x20 - ldrsh r0, [r0, r2] - adds r1, r0 - adds r1, 0x20 - movs r0, 0x98 - lsls r0, 1 - cmp r1, r0 - bls _080D5EAA - adds r0, r4, 0 - bl DestroyAnimVisualTask -_080D5EAA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5E6C - - thumb_func_start AnimTask_SwayMon -AnimTask_SwayMon: @ 80D5EB8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gBattleAnimAttacker - ldrb r0, [r6] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D5ED4 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] -_080D5ED4: - ldr r4, =gBattleAnimArgs - ldrb r0, [r4, 0x8] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r3, r5, 2 - adds r1, r3, r5 - lsls r1, 3 - adds r2, r1, r2 - ldrh r1, [r4] - strh r1, [r2, 0x8] - ldrh r1, [r4, 0x2] - strh r1, [r2, 0xA] - ldrh r1, [r4, 0x4] - strh r1, [r2, 0xC] - ldrh r1, [r4, 0x6] - strh r1, [r2, 0xE] - strh r0, [r2, 0x10] - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080D5F14 - ldrb r0, [r6] - b _080D5F18 - .pool -_080D5F14: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] -_080D5F18: - strh r0, [r2, 0x12] - ldr r1, =gTasks - adds r0, r3, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x20] - ldr r1, =sub_80D5F3C - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_SwayMon - - thumb_func_start sub_80D5F3C -sub_80D5F3C: @ 80D5F3C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r4, r0, r1 - ldrb r7, [r4, 0x10] - ldrh r0, [r4, 0xC] - ldrh r1, [r4, 0x1C] - adds r0, r1 - lsls r1, r0, 16 - strh r0, [r4, 0x1C] - lsrs r1, 24 - mov r8, r1 - mov r0, r8 - movs r2, 0xA - ldrsh r1, [r4, r2] - bl Sin - lsls r0, 16 - lsrs r5, r0, 16 - mov r9, r5 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080D5F94 - ldr r0, =gSprites - lsls r2, r7, 4 - adds r1, r2, r7 - lsls r1, 2 - adds r1, r0 - strh r5, [r1, 0x24] - mov r9, r0 - adds r4, r2, 0 - b _080D5FDA - .pool -_080D5F94: - ldrb r0, [r4, 0x12] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080D5FBC - ldr r1, =gSprites - lsls r2, r7, 4 - adds r0, r2, r7 - lsls r0, 2 - adds r3, r0, r1 - lsls r0, r5, 16 - asrs r0, 16 - mov r9, r1 - adds r4, r2, 0 - cmp r0, 0 - bge _080D5FD8 - b _080D5FD6 - .pool -_080D5FBC: - ldr r1, =gSprites - lsls r2, r7, 4 - adds r0, r2, r7 - lsls r0, 2 - adds r3, r0, r1 - mov r4, r9 - lsls r0, r4, 16 - asrs r0, 16 - mov r9, r1 - adds r4, r2, 0 - cmp r0, 0 - bge _080D5FD6 - negs r0, r0 -_080D5FD6: - negs r0, r0 -_080D5FD8: - strh r0, [r3, 0x26] -_080D5FDA: - mov r5, r8 - cmp r5, 0x7F - bls _080D5FFC - ldr r1, =gTasks - lsls r2, r6, 2 - adds r0, r2, r6 - lsls r0, 3 - adds r3, r0, r1 - movs r5, 0x1E - ldrsh r0, [r3, r5] - adds r5, r1, 0 - cmp r0, 0 - bne _080D5FFC - movs r1, 0x20 - ldrsh r0, [r3, r1] - cmp r0, 0x1 - beq _080D601E -_080D5FFC: - mov r2, r8 - cmp r2, 0x7E - bhi _080D6050 - ldr r1, =gTasks - lsls r2, r6, 2 - adds r0, r2, r6 - lsls r0, 3 - adds r3, r0, r1 - movs r5, 0x1E - ldrsh r0, [r3, r5] - adds r5, r1, 0 - cmp r0, 0x1 - bne _080D6050 - movs r1, 0x20 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _080D6050 -_080D601E: - adds r1, r2, r6 - lsls r1, 3 - adds r1, r5 - ldrh r0, [r1, 0x1E] - movs r2, 0x1 - eors r0, r2 - strh r0, [r1, 0x1E] - ldrh r0, [r1, 0x20] - eors r0, r2 - strh r0, [r1, 0x20] - ldrh r0, [r1, 0xE] - subs r0, 0x1 - strh r0, [r1, 0xE] - lsls r0, 16 - asrs r3, r0, 16 - cmp r3, 0 - bne _080D6050 - adds r0, r4, r7 - lsls r0, 2 - add r0, r9 - strh r3, [r0, 0x24] - strh r3, [r0, 0x26] - adds r0, r6, 0 - bl DestroyAnimVisualTask -_080D6050: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D5F3C - - thumb_func_start AnimTask_ScaleMonAndRestore -AnimTask_ScaleMonAndRestore: @ 80D6064 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gBattleAnimArgs - ldrb r0, [r6, 0x6] - bl GetAnimBattlerSpriteId - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r1, [r6, 0x8] - adds r0, r5, 0 - bl sub_80A7270 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r6] - strh r1, [r0, 0x8] - ldrh r1, [r6, 0x2] - strh r1, [r0, 0xA] - ldrh r1, [r6, 0x4] - strh r1, [r0, 0xC] - ldrh r1, [r6, 0x4] - strh r1, [r0, 0xE] - strh r5, [r0, 0x10] - movs r1, 0x80 - lsls r1, 1 - strh r1, [r0, 0x1C] - strh r1, [r0, 0x1E] - ldr r1, =sub_80D60BC - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_ScaleMonAndRestore - - thumb_func_start sub_80D60BC -sub_80D60BC: @ 80D60BC - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x8] - ldrh r1, [r4, 0x1C] - adds r0, r1 - strh r0, [r4, 0x1C] - ldrh r0, [r4, 0xA] - ldrh r3, [r4, 0x1E] - adds r0, r3 - strh r0, [r4, 0x1E] - ldrb r0, [r4, 0x10] - adds r6, r0, 0 - movs r0, 0x1C - ldrsh r1, [r4, r0] - movs r3, 0x1E - ldrsh r2, [r4, r3] - adds r0, r6, 0 - movs r3, 0 - bl obj_id_set_rotscale - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - bne _080D612C - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r0, 0 - ble _080D6120 - ldrh r0, [r4, 0x8] - negs r0, r0 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xA] - negs r0, r0 - strh r0, [r4, 0xA] - strh r2, [r4, 0xC] - strh r1, [r4, 0xE] - b _080D612C - .pool -_080D6120: - adds r0, r6, 0 - bl sub_80A7344 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080D612C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D60BC - - thumb_func_start sub_80D6134 -sub_80D6134: @ 80D6134 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4, 0x4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r1, 0 - bl sub_80A7270 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r2, r0, r1 - movs r1, 0 - strh r1, [r2, 0xA] - ldrh r0, [r4] - strh r0, [r2, 0xC] - movs r3, 0x6 - ldrsh r0, [r4, r3] - cmp r0, 0x1 - beq _080D6178 - strh r1, [r2, 0xE] - b _080D6184 - .pool -_080D6178: - ldrh r0, [r4] - ldrh r1, [r4, 0x2] - adds r3, r0, 0 - muls r3, r1 - adds r0, r3, 0 - strh r0, [r2, 0xE] -_080D6184: - ldr r1, =gTasks - lsls r4, r7, 2 - adds r0, r4, r7 - lsls r0, 3 - adds r5, r0, r1 - ldr r6, =gBattleAnimArgs - ldrh r0, [r6, 0x2] - strh r0, [r5, 0x10] - mov r0, r8 - strh r0, [r5, 0x12] - ldrh r0, [r6, 0x6] - strh r0, [r5, 0x14] - bl IsContest - lsls r0, 24 - mov r8, r4 - cmp r0, 0 - beq _080D61B8 - movs r0, 0x1 - strh r0, [r5, 0x16] - b _080D61DC - .pool -_080D61B8: - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080D61C8 - ldr r0, =gBattleAnimAttacker - b _080D61CA - .pool -_080D61C8: - ldr r0, =gBattleAnimTarget -_080D61CA: - ldrb r0, [r0] - bl GetBattlerSide - movs r1, 0 - lsls r0, 24 - cmp r0, 0 - bne _080D61DA - movs r1, 0x1 -_080D61DA: - strh r1, [r5, 0x16] -_080D61DC: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r4, r1, r0 - movs r3, 0x16 - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _080D6208 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080D6208 - movs r1, 0xE - ldrsh r0, [r4, r1] - negs r0, r0 - strh r0, [r4, 0xE] - movs r2, 0x10 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x10] -_080D6208: - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D6308 - str r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D6134 - - thumb_func_start sub_80D622C -sub_80D622C: @ 80D622C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gBattleAnimArgs - ldrb r0, [r4, 0x4] - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r1, 0 - bl sub_80A7270 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xA] - ldrh r1, [r4] - strh r1, [r0, 0xC] - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080D6274 - ldr r0, =gBattleAnimAttacker - b _080D6276 - .pool -_080D6274: - ldr r0, =gBattleAnimTarget -_080D6276: - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080D6288 - ldrh r0, [r4, 0x2] - negs r0, r0 - strh r0, [r4, 0x2] -_080D6288: - ldr r0, =gBattleAnimArgs - movs r2, 0x6 - ldrsh r1, [r0, r2] - adds r6, r0, 0 - cmp r1, 0x1 - beq _080D62B0 - ldr r2, =gTasks - lsls r3, r5, 2 - adds r0, r3, r5 - lsls r0, 3 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0xE] - b _080D62CA - .pool -_080D62B0: - ldr r3, =gTasks - lsls r4, r5, 2 - adds r0, r4, r5 - lsls r0, 3 - adds r0, r3 - ldrh r2, [r6] - ldrh r1, [r6, 0x2] - adds r7, r2, 0 - muls r7, r1 - adds r1, r7, 0 - strh r1, [r0, 0xE] - adds r2, r3, 0 - adds r3, r4, 0 -_080D62CA: - adds r1, r3, r5 - lsls r1, 3 - adds r1, r2 - ldrh r0, [r6, 0x2] - strh r0, [r1, 0x10] - mov r0, r8 - strh r0, [r1, 0x12] - ldrh r0, [r6, 0x6] - strh r0, [r1, 0x14] - movs r0, 0x1 - strh r0, [r1, 0x16] - movs r2, 0xE - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1, 0xE] - movs r7, 0x10 - ldrsh r0, [r1, r7] - negs r0, r0 - strh r0, [r1, 0x10] - ldr r0, =sub_80D6308 - str r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D622C - - thumb_func_start sub_80D6308 -sub_80D6308: @ 80D6308 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x10] - ldrh r1, [r4, 0xE] - adds r0, r1 - strh r0, [r4, 0xE] - ldrb r0, [r4, 0x12] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0xE] - adds r1, r2, 0 - bl obj_id_set_rotscale - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _080D633C - ldrb r0, [r4, 0x12] - bl sub_80A73A0 -_080D633C: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - movs r2, 0xC - ldrsh r1, [r4, r2] - cmp r0, r1 - blt _080D6382 - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080D6364 - cmp r0, 0x1 - ble _080D636A - cmp r0, 0x2 - beq _080D6372 - b _080D636A - .pool -_080D6364: - ldrb r0, [r4, 0x12] - bl sub_80A7344 -_080D636A: - adds r0, r5, 0 - bl DestroyAnimVisualTask - b _080D6382 -_080D6372: - movs r0, 0 - strh r0, [r4, 0xA] - movs r2, 0x10 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x10] - movs r0, 0x1 - strh r0, [r4, 0x14] -_080D6382: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80D6308 - - thumb_func_start sub_80D6388 -sub_80D6388: @ 80D6388 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleAnimArgs - movs r2, 0 - ldrsh r1, [r0, r2] - mov r8, r0 - cmp r1, 0 - bne _080D63C0 - ldr r4, =gTasks - lsls r5, r7, 2 - adds r0, r5, r7 - lsls r0, 3 - adds r6, r0, r4 - ldr r0, =gAnimMovePower - ldrh r0, [r0] - movs r1, 0xC - bl __udivsi3 - b _080D63D4 - .pool -_080D63C0: - ldr r4, =gTasks - lsls r5, r7, 2 - adds r0, r5, r7 - lsls r0, 3 - adds r6, r0, r4 - ldr r0, =gAnimMoveDmg - ldr r0, [r0] - movs r1, 0xC - bl __divsi3 -_080D63D4: - strh r0, [r6, 0x26] - lsls r0, 16 - adds r1, r4, 0 - cmp r0, 0 - bgt _080D63E2 - movs r0, 0x1 - strh r0, [r6, 0x26] -_080D63E2: - movs r2, 0x26 - ldrsh r0, [r6, r2] - cmp r0, 0x10 - ble _080D63EE - movs r0, 0x10 - strh r0, [r6, 0x26] -_080D63EE: - adds r4, r5, r7 - lsls r4, 3 - adds r4, r1 - movs r0, 0x26 - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - movs r5, 0 - strh r1, [r4, 0x24] - ldrh r2, [r4, 0x26] - movs r0, 0x1 - ands r0, r2 - adds r1, r0 - strh r1, [r4, 0x22] - strh r5, [r4, 0x20] - mov r1, r8 - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x1C] - ldrh r0, [r1, 0x8] - strh r0, [r4, 0x1E] - movs r0, 0x1 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x16] - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x24] - strh r0, [r4, 0x18] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x26] - strh r0, [r4, 0x1A] - strh r5, [r4, 0x8] - mov r1, r8 - ldrh r0, [r1, 0x2] - strh r0, [r4, 0xA] - ldrh r0, [r1, 0x4] - strh r0, [r4, 0xC] - ldr r0, =sub_80D646C - str r0, [r4] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D6388 - - thumb_func_start sub_80D646C -sub_80D646C: @ 80D646C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r3, r0, r1 - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] - lsls r0, 16 - asrs r0, 16 - movs r2, 0xA - ldrsh r1, [r3, r2] - cmp r0, r1 - ble _080D654A - movs r0, 0 - strh r0, [r3, 0x8] - ldrh r0, [r3, 0x20] - adds r1, r0, 0x1 - movs r0, 0x1 - ands r1, r0 - strh r1, [r3, 0x20] - movs r2, 0x1C - ldrsh r0, [r3, r2] - cmp r0, 0 - beq _080D64DE - cmp r1, 0 - beq _080D64C8 - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x22] - ldrh r2, [r3, 0x18] - adds r1, r2 - b _080D64DC - .pool -_080D64C8: - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x18] - ldrh r2, [r3, 0x24] - subs r1, r2 -_080D64DC: - strh r1, [r0, 0x24] -_080D64DE: - movs r1, 0x1E - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _080D6518 - movs r2, 0x20 - ldrsh r4, [r3, r2] - cmp r4, 0 - beq _080D6508 - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r3, 0x26] - strh r1, [r0, 0x26] - b _080D6518 - .pool -_080D6508: - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x26] -_080D6518: - ldrh r0, [r3, 0xC] - subs r0, 0x1 - strh r0, [r3, 0xC] - lsls r0, 16 - asrs r4, r0, 16 - cmp r4, 0 - bne _080D654A - ldr r2, =gSprites - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x24] - movs r0, 0x16 - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r4, [r0, 0x26] - adds r0, r5, 0 - bl DestroyAnimVisualTask -_080D654A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D646C - - .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 3ae637c37..9af3ed7a9 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -6166,7 +6166,7 @@ Move_WING_ATTACK: monbgprio_28 ANIM_TARGET setalpha 12, 8 loopsewithpan SE_W017, -64, 20, 2 - createvisualtask sub_80D5738, 2, 0, 12, 4, 1, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 0, 12, 4, 1, 4 createvisualtask sub_810DED8, 5, 1, 70 createsprite gBattleAnimSpriteTemplate_85962A4, 2, -25, 0, 0, 0, 20 createsprite gBattleAnimSpriteTemplate_85962A4, 2, 25, 0, 0, 0, 20 @@ -6694,8 +6694,8 @@ Move_SUBMISSION: waitplaysewithpan SE_W004, +63, 70 waitplaysewithpan SE_W104, -64, 80 waitplaysewithpan SE_W004, +63, 0x5A - createvisualtask sub_80D5738, 2, 0, -18, 6, 6, 4 - createvisualtask sub_80D5738, 2, 1, 18, 6, 6, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 0, -18, 6, 6, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 1, 18, 6, 6, 4 call Submission1 call Submission1 call Submission1 @@ -7219,7 +7219,7 @@ Move_STEEL_WING: monbgprio_28 ANIM_TARGET setalpha 12, 8 loopsewithpan SE_W017, -64, 20, 2 - createvisualtask sub_80D5738, 2, 0, 12, 4, 1, 4 + createvisualtask AnimTask_TranslateMonElliptical, 2, 0, 12, 4, 1, 4 createvisualtask sub_810DED8, 5, 1, 70 createsprite gBattleAnimSpriteTemplate_85962A4, 2, -25, 0, 0, 0, 20 createsprite gBattleAnimSpriteTemplate_85962A4, 2, 25, 0, 0, 0, 20 diff --git a/include/battle_anim.h b/include/battle_anim.h index 2b5b3e20c..200b9fdb1 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -39,7 +39,7 @@ extern bool8 gAnimScriptActive; extern u8 gAnimVisualTaskCount; extern u8 gAnimSoundTaskCount; extern struct DisableStruct *gAnimDisableStructPtr; -extern u32 gAnimMoveDmg; +extern s32 gAnimMoveDmg; extern u16 gAnimMovePower; extern u8 gAnimFriendship; extern u16 gWeatherMoveAnim; @@ -80,6 +80,13 @@ void sub_80A6B30(struct UnknownAnimStruct2*); void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); u8 sub_80A82E4(u8 battlerId); bool8 TranslateAnimArc(struct Sprite *sprite); +void sub_80A6630(struct Sprite *sprite); +void sub_80A6680(struct Sprite *sprite); +void sub_80A7344(u8 spriteId); +void obj_id_set_rotscale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation); +void sub_80A6E14(struct Sprite *sprite); +void sub_80A7270(u8 spriteId, u8 objMode); +void sub_80A73A0(u8 spriteId); enum { diff --git a/ld_script.txt b/ld_script.txt index 6221f0501..43a556034 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -134,7 +134,7 @@ SECTIONS { src/mail_data.o(.text); src/map_name_popup.o(.text); src/item_menu_icons.o(.text); - asm/battle_anim_80D51AC.o(.text); + src/battle_anim_80D51AC.o(.text); src/item.o(.text); src/contest.o(.text); asm/contest.o(.text); diff --git a/src/battle_anim.c b/src/battle_anim.c index 4989b0fb2..0a5395b02 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -107,7 +107,7 @@ EWRAM_DATA bool8 gAnimScriptActive = FALSE; EWRAM_DATA u8 gAnimVisualTaskCount = 0; EWRAM_DATA u8 gAnimSoundTaskCount = 0; EWRAM_DATA struct DisableStruct *gAnimDisableStructPtr = NULL; -EWRAM_DATA u32 gAnimMoveDmg = 0; +EWRAM_DATA s32 gAnimMoveDmg = 0; EWRAM_DATA u16 gAnimMovePower = 0; EWRAM_DATA static u16 sAnimSpriteIndexArray[ANIM_SPRITE_INDEX_COUNT] = {0}; EWRAM_DATA u8 gAnimFriendship = 0; diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c index f799b091b..f4a4946c3 100644 --- a/src/battle_anim_80A5C6C.c +++ b/src/battle_anim_80A5C6C.c @@ -38,7 +38,6 @@ extern const union AffineAnimCmd *gUnknown_082FF6C0[]; void sub_80A64EC(struct Sprite *sprite); void sub_80A653C(struct Sprite *sprite); void InitAnimLinearTranslation(struct Sprite *sprite); -void sub_80A6E14(struct Sprite *sprite); void sub_80A6FB4(struct Sprite *sprite); void sub_80A6F98(struct Sprite *sprite); void sub_80A7144(struct Sprite *sprite); diff --git a/src/battle_anim_80D51AC.c b/src/battle_anim_80D51AC.c new file mode 100644 index 000000000..fc0815a7d --- /dev/null +++ b/src/battle_anim_80D51AC.c @@ -0,0 +1,1007 @@ +#include "global.h" +#include "battle.h" +#include "battle_anim.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" + +#define TASK gTasks[taskId] +#define SPRITE gSprites[TASK.data[0]] + +// This file's functions. +void AnimTask_ShakeMonStep(u8 taskId); +void AnimTask_ShakeMon2Step(u8 taskId); +void AnimTask_ShakeMonInPlaceStep(u8 taskId); +void AnimTask_ShakeAndSinkMonStep(u8 taskId); +void sub_80D57B8(u8 taskId); +void DoHorizontalLunge(struct Sprite *sprite); +void ReverseHorizontalLungeDirection(struct Sprite *sprite); +void DoVerticalDip(struct Sprite *sprite); +void ReverseVerticalDipDirection(struct Sprite* sprite); +void SlideMonToOriginalPos(struct Sprite *sprite); +void SlideMonToOriginalPosStep(struct Sprite *sprite); +void SlideMonToOffset(struct Sprite *sprite); +void sub_80D5B48(struct Sprite *sprite); +void sub_80D5C20(struct Sprite *sprite); +void AnimTask_WindUpLungePart1(u8 taskId); +void AnimTask_WindUpLungePart2(u8 taskId); +void AnimTask_SwayMonStep(u8 taskId); +void AnimTask_ScaleMonAndRestoreStep(u8 taskId); +void sub_80D6308(u8 taskId); +void sub_80D646C(u8 taskId); +void sub_80A8B3C(u8 taskId); + +// Task to facilitate simple shaking of a pokemon's picture in battle. +// The shaking alternates between the original position and the target position. +// arg 0: anim battler +// arg 1: x pixel offset +// arg 2: y pixel offset +// arg 3: num times to shake +// arg 4: frame delay +void AnimTask_ShakeMon(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (spriteId == 0xff) + { + DestroyAnimVisualTask(taskId); + return; + } + gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; + gSprites[spriteId].pos2.y = gBattleAnimArgs[2]; + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[3]; + TASK.data[2] = gBattleAnimArgs[4]; + TASK.data[3] = gBattleAnimArgs[4]; + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = gBattleAnimArgs[2]; + TASK.func = AnimTask_ShakeMonStep; + AnimTask_ShakeMonStep(taskId); +} + +void AnimTask_ShakeMonStep(u8 taskId) +{ + if (TASK.data[3] == 0) + { + if (SPRITE.pos2.x == 0) + { + SPRITE.pos2.x = TASK.data[4]; + } + else + { + SPRITE.pos2.x = 0; + } + if (SPRITE.pos2.y == 0) + { + SPRITE.pos2.y = TASK.data[5]; + } + else + { + SPRITE.pos2.y = 0; + } + TASK.data[3] = TASK.data[2]; + if (--TASK.data[1] == 0) + { + SPRITE.pos2.x = 0; + SPRITE.pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } + else + { + TASK.data[3]--; + } +} + +// Task to facilitate simple shaking of a pokemon's picture in battle. +// The shaking alternates between the positive and negative versions of the specified pixel offsets. +// arg 0: anim battler +// arg 1: x pixel offset +// arg 2: y pixel offset +// arg 3: num times to shake +// arg 4: frame delay +void AnimTask_ShakeMon2(u8 taskId) +{ + u8 spriteId; + bool8 destroy = FALSE; + u8 battlerId; + + if (gBattleAnimArgs[0] < 4) + { + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (spriteId == 0xff) + { + DestroyAnimVisualTask(taskId); + return; + } + } + else if (gBattleAnimArgs[0] != 8) + { + switch (gBattleAnimArgs[0]) + { + case 4: + battlerId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + break; + case 5: + battlerId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + break; + case 6: + battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + break; + case 7: + default: + battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + break; + } + + if (IsBattlerSpriteVisible(battlerId) == FALSE) + destroy = TRUE; + + spriteId = gBattlerSpriteIds[battlerId]; + } + else + { + spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + } + + if (destroy) + { + DestroyAnimVisualTask(taskId); + return; + } + + gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; + gSprites[spriteId].pos2.y = gBattleAnimArgs[2]; + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[3]; + TASK.data[2] = gBattleAnimArgs[4]; + TASK.data[3] = gBattleAnimArgs[4]; + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = gBattleAnimArgs[2]; + TASK.func = AnimTask_ShakeMon2Step; + TASK.func(taskId); +} + +void AnimTask_ShakeMon2Step(u8 taskId) +{ + if (TASK.data[3] == 0) + { + if (SPRITE.pos2.x == TASK.data[4]) + SPRITE.pos2.x = -TASK.data[4]; + else + SPRITE.pos2.x = TASK.data[4]; + + if (SPRITE.pos2.y == TASK.data[5]) + SPRITE.pos2.y = -TASK.data[5]; + else + SPRITE.pos2.y = TASK.data[5]; + + TASK.data[3] = TASK.data[2]; + if (--TASK.data[1] == 0) + { + SPRITE.pos2.x = 0; + SPRITE.pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } + else + { + TASK.data[3]--; + } +} + +// Task to facilitate simple shaking of a pokemon's picture in battle. +// The shaking alternates between the positive and negative versions of the specified pixel offsets +// with respect to the current location of the mon's picture. +// arg 0: battler +// arg 1: x offset +// arg 2: y offset +// arg 3: num shakes +// arg 4: delay +void AnimTask_ShakeMonInPlace(u8 taskId) +{ + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (spriteId == 0xff) + { + DestroyAnimVisualTask(taskId); + return; + } + + gSprites[spriteId].pos2.x += gBattleAnimArgs[1]; + gSprites[spriteId].pos2.y += gBattleAnimArgs[2]; + TASK.data[0] = spriteId; + TASK.data[1] = 0; + TASK.data[2] = gBattleAnimArgs[3]; + TASK.data[3] = 0; + TASK.data[4] = gBattleAnimArgs[4]; + TASK.data[5] = gBattleAnimArgs[1] * 2; + TASK.data[6] = gBattleAnimArgs[2] * 2; + TASK.func = AnimTask_ShakeMonInPlaceStep; + TASK.func(taskId); +} + +void AnimTask_ShakeMonInPlaceStep(u8 taskId) +{ + if (TASK.data[3] == 0) + { + if (TASK.data[1] & 1) + { + SPRITE.pos2.x += TASK.data[5]; + SPRITE.pos2.y += TASK.data[6]; + } + else + { + SPRITE.pos2.x -= TASK.data[5]; + SPRITE.pos2.y -= TASK.data[6]; + } + TASK.data[3] = TASK.data[4]; + if (++TASK.data[1] >= TASK.data[2]) + { + if (TASK.data[1] & 1) + { + SPRITE.pos2.x += TASK.data[5] / 2; + SPRITE.pos2.y += TASK.data[6] / 2; + } + else + { + SPRITE.pos2.x -= TASK.data[5] / 2; + SPRITE.pos2.y -= TASK.data[6] / 2; + } + DestroyAnimVisualTask(taskId); + return; + } + } + else + { + TASK.data[3]--; + } +} + +// Shakes a mon bg horizontally and moves it downward linearly. +// arg 0: battler +// arg 1: x offset +// arg 2: frame delay between each movement +// arg 3: downward speed (subpixel) +// arg 4: duration +void AnimTask_ShakeAndSinkMon(u8 taskId) +{ + u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = gBattleAnimArgs[4]; + TASK.func = AnimTask_ShakeAndSinkMonStep; + TASK.func(taskId); +} + +void AnimTask_ShakeAndSinkMonStep(u8 taskId) +{ + s16 x; + u8 spriteId; + spriteId = TASK.data[0]; + x = TASK.data[1]; + if (TASK.data[2] == TASK.data[8]++) + { + TASK.data[8] = 0; + if (gSprites[spriteId].pos2.x == x) + x = -x; + + gSprites[spriteId].pos2.x += x; + } + + TASK.data[1] = x; + TASK.data[9] += TASK.data[3]; + gSprites[spriteId].pos2.y = TASK.data[9] >> 8; + if (--TASK.data[4] == 0) + { + DestroyAnimVisualTask(taskId); + return; + } +} + +// Moves a mon bg picture along an elliptical path that begins +// and ends at the mon's origin location. +// arg 0: battler +// arg 1: ellipse width +// arg 2: ellipse height +// arg 3: num loops +// arg 4: speed (valid values are 0-5) +void AnimTask_TranslateMonElliptical(u8 taskId) +{ + u8 i; + u8 spriteId; + u8 wavePeriod; + + wavePeriod = 1; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + if (gBattleAnimArgs[4] > 5) + gBattleAnimArgs[4] = 5; + + for (i = 0; i < gBattleAnimArgs[4]; i++) + { + wavePeriod <<= 1; + } + + TASK.data[0] = spriteId; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = wavePeriod; + TASK.func = sub_80D57B8; + TASK.func(taskId); +} + +void sub_80D57B8(u8 taskId) +{ + u8 spriteId = TASK.data[0]; + gSprites[spriteId].pos2.x = Sin(TASK.data[5], TASK.data[1]); + gSprites[spriteId].pos2.y = -Cos(TASK.data[5], TASK.data[2]); + gSprites[spriteId].pos2.y += TASK.data[2]; + TASK.data[5] += TASK.data[4]; + TASK.data[5] &= 0xff; + + if (TASK.data[5] == 0) + TASK.data[3]--; + + if (TASK.data[3] == 0) + { + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } +} + +// Moves a mon bg picture along an elliptical path that begins +// and ends at the mon's origin location. Reverses the direction +// of the path if it's not on the player's side of the battle. +// arg 0: battler +// arg 1: ellipse width +// arg 2: ellipse height +// arg 3: num loops +// arg 4: speed (valid values are 0-5) +void AnimTask_TranslateMonEllipticalRespectSide(u8 taskId) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + + AnimTask_TranslateMonElliptical(taskId); +} + +// Performs a simple horizontal lunge, where the mon moves +// horizontally, and then moves back in the opposite direction. +// arg 0: duration of single lunge direction +// arg 1: x pixel delta that is applied each frame +void DoHorizontalLunge(struct Sprite *sprite) +{ + sprite->invisible = TRUE; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + sprite->data[1] = -gBattleAnimArgs[1]; + else + sprite->data[1] = gBattleAnimArgs[1]; + + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[2] = 0; + sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker]; + sprite->data[4] = gBattleAnimArgs[0]; + StoreSpriteCallbackInData6(sprite, ReverseHorizontalLungeDirection); + sprite->callback = sub_80A6630; +} + +void ReverseHorizontalLungeDirection(struct Sprite *sprite) +{ + sprite->data[0] = sprite->data[4]; + sprite->data[1] = -sprite->data[1]; + sprite->callback = sub_80A6630; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +// Performs a simple vertical dipping motion, where moves vertically, and then +// moves back in the opposite direction. +// arg 0: duration of single dip direction +// arg 1: y pixel delta that is applied each frame +// arg 2: battler +void DoVerticalDip(struct Sprite *sprite) +{ + u8 spriteId; + sprite->invisible = TRUE; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[1] = 0; + sprite->data[2] = gBattleAnimArgs[1]; + sprite->data[3] = spriteId; + sprite->data[4] = gBattleAnimArgs[0]; + StoreSpriteCallbackInData6(sprite, ReverseVerticalDipDirection); + sprite->callback = sub_80A6630; +} + +void ReverseVerticalDipDirection(struct Sprite *sprite) +{ + sprite->data[0] = sprite->data[4]; + sprite->data[2] = -sprite->data[2]; + sprite->callback = sub_80A6630; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +// Linearly slides a mon's bg picture back to its original sprite position. +// The sprite parameter is a dummy sprite used for facilitating the movement with its callback. +// arg 0: 1 = target or 0 = attacker +// arg 1: direction (0 = horizontal and vertical, 1 = horizontal only, 2 = vertical only) +// arg 2: duration +void SlideMonToOriginalPos(struct Sprite *sprite) +{ + u32 monSpriteId; + if (!gBattleAnimArgs[0]) + monSpriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + else + monSpriteId = gBattlerSpriteIds[gBattleAnimTarget]; + + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gSprites[monSpriteId].pos1.x + gSprites[monSpriteId].pos2.x; + sprite->data[2] = gSprites[monSpriteId].pos1.x; + sprite->data[3] = gSprites[monSpriteId].pos1.y + gSprites[monSpriteId].pos2.y; + sprite->data[4] = gSprites[monSpriteId].pos1.y; + sub_80A6E14(sprite); + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[5] = gSprites[monSpriteId].pos2.x; + sprite->data[6] = gSprites[monSpriteId].pos2.y; + sprite->invisible = TRUE; + + if (gBattleAnimArgs[1] == 1) + sprite->data[2] = 0; + else if (gBattleAnimArgs[1] == 2) + sprite->data[1] = 0; + + sprite->data[7] = gBattleAnimArgs[1]; + sprite->data[7] |= monSpriteId << 8; + sprite->callback = SlideMonToOriginalPosStep; +} + +void SlideMonToOriginalPosStep(struct Sprite *sprite) +{ + s8 monSpriteId; + u8 lo; + struct Sprite *monSprite; + + lo = sprite->data[7] & 0xff; + monSpriteId = sprite->data[7] >> 8; + monSprite = &gSprites[monSpriteId]; + if (sprite->data[0] == 0) + { + if (lo < 2) + monSprite->pos2.x = 0; + + if (lo == 2 || lo == 0) + monSprite->pos2.y = 0; + + DestroyAnimSprite(sprite); + } + else + { + sprite->data[0]--; + sprite->data[3] += sprite->data[1]; + sprite->data[4] += sprite->data[2]; + monSprite->pos2.x = (s8)(sprite->data[3] >> 8) + sprite->data[5]; + monSprite->pos2.y = (s8)(sprite->data[4] >> 8) + sprite->data[6]; + } +} + +// Linearly translates a mon to a target offset. The horizontal offset +// is mirrored for the opponent's pokemon, and the vertical offset +// is only mirrored if arg 3 is set to 1. +// arg 0: 0 = attacker, 1 = target +// arg 1: target x pixel offset +// arg 2: target y pixel offset +// arg 3: mirror vertical translation for opposite battle side +// arg 4: duration +void SlideMonToOffset(struct Sprite *sprite) +{ + u8 battler; + u8 monSpriteId; + if (!gBattleAnimArgs[0]) + battler = gBattleAnimAttacker; + else + battler = gBattleAnimTarget; + + monSpriteId = gBattlerSpriteIds[battler]; + if (GetBattlerSide(battler) != B_SIDE_PLAYER) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + if (gBattleAnimArgs[3] == 1) + { + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + } + } + + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[1] = gSprites[monSpriteId].pos1.x; + sprite->data[2] = gSprites[monSpriteId].pos1.x + gBattleAnimArgs[1]; + sprite->data[3] = gSprites[monSpriteId].pos1.y; + sprite->data[4] = gSprites[monSpriteId].pos1.y + gBattleAnimArgs[2]; + sub_80A6E14(sprite); + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[5] = monSpriteId; + sprite->invisible = TRUE; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->callback = sub_80A6680; +} + +void sub_80D5B48(struct Sprite *sprite) +{ + u8 spriteId; + u8 battlerId; + sprite->invisible = TRUE; + if (!gBattleAnimArgs[0]) + { + battlerId = gBattleAnimAttacker; + } + else + { + battlerId = gBattleAnimTarget; + } + spriteId = gBattlerSpriteIds[battlerId]; + if (GetBattlerSide(battlerId)) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + if (gBattleAnimArgs[3] == 1) + { + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + } + } + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[1] = gSprites[spriteId].pos1.x + gSprites[spriteId].pos2.x; + sprite->data[2] = sprite->data[1] + gBattleAnimArgs[1]; + sprite->data[3] = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y; + sprite->data[4] = sprite->data[3] + gBattleAnimArgs[2]; + sub_80A6E14(sprite); + sprite->data[3] = gSprites[spriteId].pos2.x << 8; + sprite->data[4] = gSprites[spriteId].pos2.y << 8; + sprite->data[5] = spriteId; + sprite->data[6] = gBattleAnimArgs[5]; + if (!gBattleAnimArgs[5]) + { + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + } + else + { + StoreSpriteCallbackInData6(sprite, sub_80D5C20); + } + sprite->callback = sub_80A6680; +} + + +void sub_80D5C20(struct Sprite *sprite) +{ + gSprites[sprite->data[5]].pos2.x = 0; + gSprites[sprite->data[5]].pos2.y = 0; + DestroyAnimSprite(sprite); +} + +// Task to facilitate a two-part translation animation, in which the sprite +// is first translated in an arc to one position. Then, it "lunges" to a target +// x offset. Used in TAKE_DOWN, for example. +// arg 0: anim bank +// arg 1: horizontal speed (subpixel) +// arg 2: wave amplitude +// arg 3: first duration +// arg 4: delay before starting lunge +// arg 5: target x offset for lunge +// arg 6: lunge duration +void AnimTask_WindUpLunge(u8 taskId) +{ + s16 wavePeriod = 0x8000 / gBattleAnimArgs[3]; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + gBattleAnimArgs[5] = -gBattleAnimArgs[5]; + } + TASK.data[0] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + TASK.data[1] = (gBattleAnimArgs[1] << 8) / gBattleAnimArgs[3]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = gBattleAnimArgs[4]; + TASK.data[5] = (gBattleAnimArgs[5] << 8) / gBattleAnimArgs[6]; + TASK.data[6] = gBattleAnimArgs[6]; + TASK.data[7] = wavePeriod; + TASK.func = AnimTask_WindUpLungePart1; +} + +void AnimTask_WindUpLungePart1(u8 taskId) +{ + u8 spriteId; + spriteId = TASK.data[0]; + TASK.data[11] += TASK.data[1]; + gSprites[spriteId].pos2.x = TASK.data[11] >> 8; + gSprites[spriteId].pos2.y = Sin((u8)(TASK.data[10] >> 8), TASK.data[2]); + TASK.data[10] += TASK.data[7]; + if (--TASK.data[3] == 0) + { + TASK.func = AnimTask_WindUpLungePart2; + } +} + +void AnimTask_WindUpLungePart2(u8 taskId) +{ + u8 spriteId; + if (TASK.data[4] > 0) + { + TASK.data[4]--; + } + else + { + spriteId = TASK.data[0]; + TASK.data[12] += TASK.data[5]; + gSprites[spriteId].pos2.x = (TASK.data[12] >> 8) + (TASK.data[11] >> 8); + if (--TASK.data[6] == 0) + { + DestroyAnimVisualTask(taskId); + return; + } + } +} + +void sub_80D5DB0(u8 taskId) +{ + u8 spriteId; + switch (gBattleAnimArgs[0]) + { + case 0: + case 1: + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + break; + case 2: + if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) + { + DestroyAnimVisualTask(taskId); + return; + } + spriteId = gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]; + break; + case 3: + if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget))) + { + DestroyAnimVisualTask(taskId); + return; + } + spriteId = gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)]; + break; + default: + DestroyAnimVisualTask(taskId); + return; + } + TASK.data[0] = spriteId; + if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER) + { + TASK.data[1] = gBattleAnimArgs[1]; + } + else + { + TASK.data[1] = -gBattleAnimArgs[1]; + } + TASK.func = sub_80A8B3C; +} + +void sub_80A8B3C(u8 taskId) +{ + u8 spriteId = TASK.data[0]; + gSprites[spriteId].pos2.x += TASK.data[1]; + if (gSprites[spriteId].pos2.x + gSprites[spriteId].pos1.x + 0x20 > 0x130u) + { + DestroyAnimVisualTask(taskId); + return; + } +} + +// Task that facilitates translating the mon bg picture back and forth +// in a swaying motion (uses Sine wave). It can sway either horizontally +// or vertically, but not both. +// arg 0: direction (0 = horizontal, 1 = vertical) +// arg 1: wave amplitude +// arg 2: wave period +// arg 3: num sways +// arg 4: which mon (0 = attacker, 1`= target) +void AnimTask_SwayMon(u8 taskId) +{ + u8 spriteId; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[4]); + TASK.data[0] = gBattleAnimArgs[0]; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[3]; + TASK.data[4] = spriteId; + + if (gBattleAnimArgs[4] == 0) + TASK.data[5] = gBattleAnimAttacker; + else + TASK.data[5] = gBattleAnimTarget; + + TASK.data[12] = 1; + TASK.func = AnimTask_SwayMonStep; +} + +void AnimTask_SwayMonStep(u8 taskId) +{ + s16 sineValue; + u8 spriteId; + int waveIndex; + u16 sineIndex; + + spriteId = TASK.data[4]; + sineIndex = TASK.data[10] + TASK.data[2]; + TASK.data[10] = sineIndex; + waveIndex = sineIndex >> 8; + sineValue = Sin(waveIndex, TASK.data[1]); + + if (TASK.data[0] == 0) + { + gSprites[spriteId].pos2.x = sineValue; + } + else + { + if (GetBattlerSide(TASK.data[5]) == B_SIDE_PLAYER) + { + gSprites[spriteId].pos2.y = (sineValue >= 0) ? sineValue : -sineValue; + } + else + { + gSprites[spriteId].pos2.y = (sineValue >= 0) ? -sineValue : sineValue; + } + } + + if (((waveIndex >= 0x80u) && (TASK.data[11] == 0) && (TASK.data[12] == 1)) + || ((waveIndex < 0x7fu) && (TASK.data[11] == 1) && (TASK.data[12] == 0))) + { + TASK.data[11] ^= 1; + TASK.data[12] ^= 1; + if (--TASK.data[3] == 0) + { + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } +} + +// Scales a mon's sprite, and then scales back to its original dimensions. +// arg 0: x scale delta +// arg 1: y scale delta +// arg 2: duration +// arg 3: anim bank +// arg 4: sprite object mode +void AnimTask_ScaleMonAndRestore(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]); + sub_80A7270(spriteId, gBattleAnimArgs[4]); + TASK.data[0] = gBattleAnimArgs[0]; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.data[3] = gBattleAnimArgs[2]; + TASK.data[4] = spriteId; + TASK.data[10] = 0x100; + TASK.data[11] = 0x100; + TASK.func = AnimTask_ScaleMonAndRestoreStep; +} + +void AnimTask_ScaleMonAndRestoreStep(u8 taskId) +{ + u8 spriteId; + TASK.data[10] += TASK.data[0]; + TASK.data[11] += TASK.data[1]; + spriteId = TASK.data[4]; + obj_id_set_rotscale(spriteId, TASK.data[10], TASK.data[11], 0); + if (--TASK.data[2] == 0) + { + if (TASK.data[3] > 0) + { + TASK.data[0] = -TASK.data[0]; + TASK.data[1] = -TASK.data[1]; + TASK.data[2] = TASK.data[3]; + TASK.data[3] = 0; + } + else + { + sub_80A7344(spriteId); + DestroyAnimVisualTask(taskId); + return; + } + } +} + +void sub_80D6134(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); + sub_80A7270(spriteId, 0); + TASK.data[1] = 0; + TASK.data[2] = gBattleAnimArgs[0]; + if (gBattleAnimArgs[3] != 1) + { + TASK.data[3] = 0; + } + else + { + TASK.data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; + } + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = spriteId; + TASK.data[6] = gBattleAnimArgs[3]; + if (IsContest()) + { + TASK.data[7] = 1; + } + else + { + if (gBattleAnimArgs[2] == 0) + { + TASK.data[7] = !GetBattlerSide(gBattleAnimAttacker); + } + else + { + TASK.data[7] = !GetBattlerSide(gBattleAnimTarget); + } + } + if (TASK.data[7]) + { + if (!IsContest()) + { + TASK.data[3] *= -1; + TASK.data[4] *= -1; + } + } + TASK.func = sub_80D6308; +} + +void sub_80D622C(u8 taskId) +{ + u8 spriteId; + spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); + sub_80A7270(spriteId, 0); + TASK.data[1] = 0; + TASK.data[2] = gBattleAnimArgs[0]; + if (gBattleAnimArgs[2] == 0) + { + if (GetBattlerSide(gBattleAnimAttacker)) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + } + } + else + { + if (GetBattlerSide(gBattleAnimTarget)) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + } + } + if (gBattleAnimArgs[3] != 1) + { + TASK.data[3] = 0; + } + else + { + TASK.data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; + } + TASK.data[4] = gBattleAnimArgs[1]; + TASK.data[5] = spriteId; + TASK.data[6] = gBattleAnimArgs[3]; + TASK.data[7] = 1; + TASK.data[3] *= -1; + TASK.data[4] *= -1; + TASK.func = sub_80D6308; +} + +void sub_80D6308(u8 taskId) +{ + TASK.data[3] += TASK.data[4]; + obj_id_set_rotscale(TASK.data[5], 0x100, 0x100, TASK.data[3]); + if (TASK.data[7]) + { + sub_80A73A0(TASK.data[5]); + } + if (++TASK.data[1] >= TASK.data[2]) + { + switch (TASK.data[6]) + { + case 1: + sub_80A7344(TASK.data[5]); + case 0: + default: + DestroyAnimVisualTask(taskId); + return; + case 2: + TASK.data[1] = 0; + TASK.data[4] *= -1; + TASK.data[6] = 1; + break; + } + } +} + +void sub_80D6388(u8 taskId) +{ + if (!gBattleAnimArgs[0]) + { + TASK.data[15] = gAnimMovePower / 12; + if (TASK.data[15] < 1) + { + TASK.data[15] = 1; + } + if (TASK.data[15] > 16) + { + TASK.data[15] = 16; + } + } + else + { + TASK.data[15] = gAnimMoveDmg / 12; + if (TASK.data[15] < 1) + { + TASK.data[15] = 1; + } + if (TASK.data[15] > 16) + { + TASK.data[15] = 16; + } + } + TASK.data[14] = TASK.data[15] / 2; + TASK.data[13] = TASK.data[14] + (TASK.data[15] & 1); + TASK.data[12] = 0; + TASK.data[10] = gBattleAnimArgs[3]; + TASK.data[11] = gBattleAnimArgs[4]; + TASK.data[7] = GetAnimBattlerSpriteId(1); + TASK.data[8] = gSprites[TASK.data[7]].pos2.x; + TASK.data[9] = gSprites[TASK.data[7]].pos2.y; + TASK.data[0] = 0; + TASK.data[1] = gBattleAnimArgs[1]; + TASK.data[2] = gBattleAnimArgs[2]; + TASK.func = sub_80D646C; +} + +void sub_80D646C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + if (++task->data[0] > task->data[1]) + { + task->data[0] = 0; + task->data[12] = (task->data[12] + 1) & 1; + if (task->data[10]) + { + if (task->data[12]) + { + gSprites[task->data[7]].pos2.x = task->data[8] + task->data[13]; + } + else + { + gSprites[task->data[7]].pos2.x = task->data[8] - task->data[14]; + } + } + if (task->data[11]) + { + if (task->data[12]) + { + gSprites[task->data[7]].pos2.y = task->data[15]; + } + else + { + gSprites[task->data[7]].pos2.y = 0; + } + } + if (!--task->data[2]) + { + gSprites[task->data[7]].pos2.x = 0; + gSprites[task->data[7]].pos2.y = 0; + DestroyAnimVisualTask(taskId); + return; + } + } +} diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index 1684e9b3d..5dd5fd31d 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -19,10 +19,10 @@ struct CompressedTilesPal const u8 *pal; }; -extern void sub_80D5860(struct Sprite *sprite); -extern void sub_80D58F8(struct Sprite *sprite); -extern void sub_80D5968(struct Sprite *sprite); -extern void sub_80D5A94(struct Sprite *sprite); +extern void DoHorizontalLunge(struct Sprite *sprite); +extern void DoVerticalDip(struct Sprite *sprite); +extern void SlideMonToOriginalPos(struct Sprite *sprite); +extern void SlideMonToOffset(struct Sprite *sprite); extern void sub_80D5B48(struct Sprite *sprite); // this file's functions @@ -422,7 +422,7 @@ const struct SpriteTemplate gHorizontalLungeSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D5860, + .callback = DoHorizontalLunge, }; const struct SpriteTemplate gVerticalDipSpriteTemplate = @@ -433,7 +433,7 @@ const struct SpriteTemplate gVerticalDipSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D58F8, + .callback = DoVerticalDip, }; const struct SpriteTemplate gSlideMonToOriginalPosSpriteTemplate = @@ -444,7 +444,7 @@ const struct SpriteTemplate gSlideMonToOriginalPosSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D5968, + .callback = SlideMonToOriginalPos, }; const struct SpriteTemplate gSlideMonToOffsetSpriteTemplate = @@ -455,7 +455,7 @@ const struct SpriteTemplate gSlideMonToOffsetSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80D5A94, + .callback = SlideMonToOffset, }; const struct SpriteTemplate gUnknown_0857FE88 = From dbb09aa4453d7afbc3b6f777554a32d39ad27e5e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 7 Oct 2018 19:19:13 +0200 Subject: [PATCH 5/5] get rid of SPRITE and TASK --- src/battle_anim_80D51AC.c | 435 +++++++++++++++++++------------------- 1 file changed, 216 insertions(+), 219 deletions(-) diff --git a/src/battle_anim_80D51AC.c b/src/battle_anim_80D51AC.c index fc0815a7d..1864a1a7a 100644 --- a/src/battle_anim_80D51AC.c +++ b/src/battle_anim_80D51AC.c @@ -5,9 +5,6 @@ #include "task.h" #include "trig.h" -#define TASK gTasks[taskId] -#define SPRITE gSprites[TASK.data[0]] - // This file's functions. void AnimTask_ShakeMonStep(u8 taskId); void AnimTask_ShakeMon2Step(u8 taskId); @@ -49,48 +46,48 @@ void AnimTask_ShakeMon(u8 taskId) } gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; gSprites[spriteId].pos2.y = gBattleAnimArgs[2]; - TASK.data[0] = spriteId; - TASK.data[1] = gBattleAnimArgs[3]; - TASK.data[2] = gBattleAnimArgs[4]; - TASK.data[3] = gBattleAnimArgs[4]; - TASK.data[4] = gBattleAnimArgs[1]; - TASK.data[5] = gBattleAnimArgs[2]; - TASK.func = AnimTask_ShakeMonStep; + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].data[1] = gBattleAnimArgs[3]; + gTasks[taskId].data[2] = gBattleAnimArgs[4]; + gTasks[taskId].data[3] = gBattleAnimArgs[4]; + gTasks[taskId].data[4] = gBattleAnimArgs[1]; + gTasks[taskId].data[5] = gBattleAnimArgs[2]; + gTasks[taskId].func = AnimTask_ShakeMonStep; AnimTask_ShakeMonStep(taskId); } void AnimTask_ShakeMonStep(u8 taskId) { - if (TASK.data[3] == 0) + if (gTasks[taskId].data[3] == 0) { - if (SPRITE.pos2.x == 0) + if (gSprites[gTasks[taskId].data[0]].pos2.x == 0) { - SPRITE.pos2.x = TASK.data[4]; + gSprites[gTasks[taskId].data[0]].pos2.x = gTasks[taskId].data[4]; } else { - SPRITE.pos2.x = 0; + gSprites[gTasks[taskId].data[0]].pos2.x = 0; } - if (SPRITE.pos2.y == 0) + if (gSprites[gTasks[taskId].data[0]].pos2.y == 0) { - SPRITE.pos2.y = TASK.data[5]; + gSprites[gTasks[taskId].data[0]].pos2.y = gTasks[taskId].data[5]; } else { - SPRITE.pos2.y = 0; + gSprites[gTasks[taskId].data[0]].pos2.y = 0; } - TASK.data[3] = TASK.data[2]; - if (--TASK.data[1] == 0) + gTasks[taskId].data[3] = gTasks[taskId].data[2]; + if (--gTasks[taskId].data[1] == 0) { - SPRITE.pos2.x = 0; - SPRITE.pos2.y = 0; + gSprites[gTasks[taskId].data[0]].pos2.x = 0; + gSprites[gTasks[taskId].data[0]].pos2.y = 0; DestroyAnimVisualTask(taskId); return; } } else { - TASK.data[3]--; + gTasks[taskId].data[3]--; } } @@ -153,42 +150,42 @@ void AnimTask_ShakeMon2(u8 taskId) gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; gSprites[spriteId].pos2.y = gBattleAnimArgs[2]; - TASK.data[0] = spriteId; - TASK.data[1] = gBattleAnimArgs[3]; - TASK.data[2] = gBattleAnimArgs[4]; - TASK.data[3] = gBattleAnimArgs[4]; - TASK.data[4] = gBattleAnimArgs[1]; - TASK.data[5] = gBattleAnimArgs[2]; - TASK.func = AnimTask_ShakeMon2Step; - TASK.func(taskId); + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].data[1] = gBattleAnimArgs[3]; + gTasks[taskId].data[2] = gBattleAnimArgs[4]; + gTasks[taskId].data[3] = gBattleAnimArgs[4]; + gTasks[taskId].data[4] = gBattleAnimArgs[1]; + gTasks[taskId].data[5] = gBattleAnimArgs[2]; + gTasks[taskId].func = AnimTask_ShakeMon2Step; + gTasks[taskId].func(taskId); } void AnimTask_ShakeMon2Step(u8 taskId) { - if (TASK.data[3] == 0) + if (gTasks[taskId].data[3] == 0) { - if (SPRITE.pos2.x == TASK.data[4]) - SPRITE.pos2.x = -TASK.data[4]; + if (gSprites[gTasks[taskId].data[0]].pos2.x == gTasks[taskId].data[4]) + gSprites[gTasks[taskId].data[0]].pos2.x = -gTasks[taskId].data[4]; else - SPRITE.pos2.x = TASK.data[4]; + gSprites[gTasks[taskId].data[0]].pos2.x = gTasks[taskId].data[4]; - if (SPRITE.pos2.y == TASK.data[5]) - SPRITE.pos2.y = -TASK.data[5]; + if (gSprites[gTasks[taskId].data[0]].pos2.y == gTasks[taskId].data[5]) + gSprites[gTasks[taskId].data[0]].pos2.y = -gTasks[taskId].data[5]; else - SPRITE.pos2.y = TASK.data[5]; + gSprites[gTasks[taskId].data[0]].pos2.y = gTasks[taskId].data[5]; - TASK.data[3] = TASK.data[2]; - if (--TASK.data[1] == 0) + gTasks[taskId].data[3] = gTasks[taskId].data[2]; + if (--gTasks[taskId].data[1] == 0) { - SPRITE.pos2.x = 0; - SPRITE.pos2.y = 0; + gSprites[gTasks[taskId].data[0]].pos2.x = 0; + gSprites[gTasks[taskId].data[0]].pos2.y = 0; DestroyAnimVisualTask(taskId); return; } } else { - TASK.data[3]--; + gTasks[taskId].data[3]--; } } @@ -211,43 +208,43 @@ void AnimTask_ShakeMonInPlace(u8 taskId) gSprites[spriteId].pos2.x += gBattleAnimArgs[1]; gSprites[spriteId].pos2.y += gBattleAnimArgs[2]; - TASK.data[0] = spriteId; - TASK.data[1] = 0; - TASK.data[2] = gBattleAnimArgs[3]; - TASK.data[3] = 0; - TASK.data[4] = gBattleAnimArgs[4]; - TASK.data[5] = gBattleAnimArgs[1] * 2; - TASK.data[6] = gBattleAnimArgs[2] * 2; - TASK.func = AnimTask_ShakeMonInPlaceStep; - TASK.func(taskId); + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = gBattleAnimArgs[3]; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = gBattleAnimArgs[4]; + gTasks[taskId].data[5] = gBattleAnimArgs[1] * 2; + gTasks[taskId].data[6] = gBattleAnimArgs[2] * 2; + gTasks[taskId].func = AnimTask_ShakeMonInPlaceStep; + gTasks[taskId].func(taskId); } void AnimTask_ShakeMonInPlaceStep(u8 taskId) { - if (TASK.data[3] == 0) + if (gTasks[taskId].data[3] == 0) { - if (TASK.data[1] & 1) + if (gTasks[taskId].data[1] & 1) { - SPRITE.pos2.x += TASK.data[5]; - SPRITE.pos2.y += TASK.data[6]; + gSprites[gTasks[taskId].data[0]].pos2.x += gTasks[taskId].data[5]; + gSprites[gTasks[taskId].data[0]].pos2.y += gTasks[taskId].data[6]; } else { - SPRITE.pos2.x -= TASK.data[5]; - SPRITE.pos2.y -= TASK.data[6]; + gSprites[gTasks[taskId].data[0]].pos2.x -= gTasks[taskId].data[5]; + gSprites[gTasks[taskId].data[0]].pos2.y -= gTasks[taskId].data[6]; } - TASK.data[3] = TASK.data[4]; - if (++TASK.data[1] >= TASK.data[2]) + gTasks[taskId].data[3] = gTasks[taskId].data[4]; + if (++gTasks[taskId].data[1] >= gTasks[taskId].data[2]) { - if (TASK.data[1] & 1) + if (gTasks[taskId].data[1] & 1) { - SPRITE.pos2.x += TASK.data[5] / 2; - SPRITE.pos2.y += TASK.data[6] / 2; + gSprites[gTasks[taskId].data[0]].pos2.x += gTasks[taskId].data[5] / 2; + gSprites[gTasks[taskId].data[0]].pos2.y += gTasks[taskId].data[6] / 2; } else { - SPRITE.pos2.x -= TASK.data[5] / 2; - SPRITE.pos2.y -= TASK.data[6] / 2; + gSprites[gTasks[taskId].data[0]].pos2.x -= gTasks[taskId].data[5] / 2; + gSprites[gTasks[taskId].data[0]].pos2.y -= gTasks[taskId].data[6] / 2; } DestroyAnimVisualTask(taskId); return; @@ -255,7 +252,7 @@ void AnimTask_ShakeMonInPlaceStep(u8 taskId) } else { - TASK.data[3]--; + gTasks[taskId].data[3]--; } } @@ -269,34 +266,34 @@ void AnimTask_ShakeAndSinkMon(u8 taskId) { u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); gSprites[spriteId].pos2.x = gBattleAnimArgs[1]; - TASK.data[0] = spriteId; - TASK.data[1] = gBattleAnimArgs[1]; - TASK.data[2] = gBattleAnimArgs[2]; - TASK.data[3] = gBattleAnimArgs[3]; - TASK.data[4] = gBattleAnimArgs[4]; - TASK.func = AnimTask_ShakeAndSinkMonStep; - TASK.func(taskId); + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].data[1] = gBattleAnimArgs[1]; + gTasks[taskId].data[2] = gBattleAnimArgs[2]; + gTasks[taskId].data[3] = gBattleAnimArgs[3]; + gTasks[taskId].data[4] = gBattleAnimArgs[4]; + gTasks[taskId].func = AnimTask_ShakeAndSinkMonStep; + gTasks[taskId].func(taskId); } void AnimTask_ShakeAndSinkMonStep(u8 taskId) { s16 x; u8 spriteId; - spriteId = TASK.data[0]; - x = TASK.data[1]; - if (TASK.data[2] == TASK.data[8]++) + spriteId = gTasks[taskId].data[0]; + x = gTasks[taskId].data[1]; + if (gTasks[taskId].data[2] == gTasks[taskId].data[8]++) { - TASK.data[8] = 0; + gTasks[taskId].data[8] = 0; if (gSprites[spriteId].pos2.x == x) x = -x; gSprites[spriteId].pos2.x += x; } - TASK.data[1] = x; - TASK.data[9] += TASK.data[3]; - gSprites[spriteId].pos2.y = TASK.data[9] >> 8; - if (--TASK.data[4] == 0) + gTasks[taskId].data[1] = x; + gTasks[taskId].data[9] += gTasks[taskId].data[3]; + gSprites[spriteId].pos2.y = gTasks[taskId].data[9] >> 8; + if (--gTasks[taskId].data[4] == 0) { DestroyAnimVisualTask(taskId); return; @@ -326,28 +323,28 @@ void AnimTask_TranslateMonElliptical(u8 taskId) wavePeriod <<= 1; } - TASK.data[0] = spriteId; - TASK.data[1] = gBattleAnimArgs[1]; - TASK.data[2] = gBattleAnimArgs[2]; - TASK.data[3] = gBattleAnimArgs[3]; - TASK.data[4] = wavePeriod; - TASK.func = sub_80D57B8; - TASK.func(taskId); + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].data[1] = gBattleAnimArgs[1]; + gTasks[taskId].data[2] = gBattleAnimArgs[2]; + gTasks[taskId].data[3] = gBattleAnimArgs[3]; + gTasks[taskId].data[4] = wavePeriod; + gTasks[taskId].func = sub_80D57B8; + gTasks[taskId].func(taskId); } void sub_80D57B8(u8 taskId) { - u8 spriteId = TASK.data[0]; - gSprites[spriteId].pos2.x = Sin(TASK.data[5], TASK.data[1]); - gSprites[spriteId].pos2.y = -Cos(TASK.data[5], TASK.data[2]); - gSprites[spriteId].pos2.y += TASK.data[2]; - TASK.data[5] += TASK.data[4]; - TASK.data[5] &= 0xff; + u8 spriteId = gTasks[taskId].data[0]; + gSprites[spriteId].pos2.x = Sin(gTasks[taskId].data[5], gTasks[taskId].data[1]); + gSprites[spriteId].pos2.y = -Cos(gTasks[taskId].data[5], gTasks[taskId].data[2]); + gSprites[spriteId].pos2.y += gTasks[taskId].data[2]; + gTasks[taskId].data[5] += gTasks[taskId].data[4]; + gTasks[taskId].data[5] &= 0xff; - if (TASK.data[5] == 0) - TASK.data[3]--; + if (gTasks[taskId].data[5] == 0) + gTasks[taskId].data[3]--; - if (TASK.data[3] == 0) + if (gTasks[taskId].data[3] == 0) { gSprites[spriteId].pos2.x = 0; gSprites[spriteId].pos2.y = 0; @@ -601,44 +598,44 @@ void AnimTask_WindUpLunge(u8 taskId) gBattleAnimArgs[1] = -gBattleAnimArgs[1]; gBattleAnimArgs[5] = -gBattleAnimArgs[5]; } - TASK.data[0] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - TASK.data[1] = (gBattleAnimArgs[1] << 8) / gBattleAnimArgs[3]; - TASK.data[2] = gBattleAnimArgs[2]; - TASK.data[3] = gBattleAnimArgs[3]; - TASK.data[4] = gBattleAnimArgs[4]; - TASK.data[5] = (gBattleAnimArgs[5] << 8) / gBattleAnimArgs[6]; - TASK.data[6] = gBattleAnimArgs[6]; - TASK.data[7] = wavePeriod; - TASK.func = AnimTask_WindUpLungePart1; + gTasks[taskId].data[0] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + gTasks[taskId].data[1] = (gBattleAnimArgs[1] << 8) / gBattleAnimArgs[3]; + gTasks[taskId].data[2] = gBattleAnimArgs[2]; + gTasks[taskId].data[3] = gBattleAnimArgs[3]; + gTasks[taskId].data[4] = gBattleAnimArgs[4]; + gTasks[taskId].data[5] = (gBattleAnimArgs[5] << 8) / gBattleAnimArgs[6]; + gTasks[taskId].data[6] = gBattleAnimArgs[6]; + gTasks[taskId].data[7] = wavePeriod; + gTasks[taskId].func = AnimTask_WindUpLungePart1; } void AnimTask_WindUpLungePart1(u8 taskId) { u8 spriteId; - spriteId = TASK.data[0]; - TASK.data[11] += TASK.data[1]; - gSprites[spriteId].pos2.x = TASK.data[11] >> 8; - gSprites[spriteId].pos2.y = Sin((u8)(TASK.data[10] >> 8), TASK.data[2]); - TASK.data[10] += TASK.data[7]; - if (--TASK.data[3] == 0) + spriteId = gTasks[taskId].data[0]; + gTasks[taskId].data[11] += gTasks[taskId].data[1]; + gSprites[spriteId].pos2.x = gTasks[taskId].data[11] >> 8; + gSprites[spriteId].pos2.y = Sin((u8)(gTasks[taskId].data[10] >> 8), gTasks[taskId].data[2]); + gTasks[taskId].data[10] += gTasks[taskId].data[7]; + if (--gTasks[taskId].data[3] == 0) { - TASK.func = AnimTask_WindUpLungePart2; + gTasks[taskId].func = AnimTask_WindUpLungePart2; } } void AnimTask_WindUpLungePart2(u8 taskId) { u8 spriteId; - if (TASK.data[4] > 0) + if (gTasks[taskId].data[4] > 0) { - TASK.data[4]--; + gTasks[taskId].data[4]--; } else { - spriteId = TASK.data[0]; - TASK.data[12] += TASK.data[5]; - gSprites[spriteId].pos2.x = (TASK.data[12] >> 8) + (TASK.data[11] >> 8); - if (--TASK.data[6] == 0) + spriteId = gTasks[taskId].data[0]; + gTasks[taskId].data[12] += gTasks[taskId].data[5]; + gSprites[spriteId].pos2.x = (gTasks[taskId].data[12] >> 8) + (gTasks[taskId].data[11] >> 8); + if (--gTasks[taskId].data[6] == 0) { DestroyAnimVisualTask(taskId); return; @@ -675,22 +672,22 @@ void sub_80D5DB0(u8 taskId) DestroyAnimVisualTask(taskId); return; } - TASK.data[0] = spriteId; + gTasks[taskId].data[0] = spriteId; if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER) { - TASK.data[1] = gBattleAnimArgs[1]; + gTasks[taskId].data[1] = gBattleAnimArgs[1]; } else { - TASK.data[1] = -gBattleAnimArgs[1]; + gTasks[taskId].data[1] = -gBattleAnimArgs[1]; } - TASK.func = sub_80A8B3C; + gTasks[taskId].func = sub_80A8B3C; } void sub_80A8B3C(u8 taskId) { - u8 spriteId = TASK.data[0]; - gSprites[spriteId].pos2.x += TASK.data[1]; + u8 spriteId = gTasks[taskId].data[0]; + gSprites[spriteId].pos2.x += gTasks[taskId].data[1]; if (gSprites[spriteId].pos2.x + gSprites[spriteId].pos1.x + 0x20 > 0x130u) { DestroyAnimVisualTask(taskId); @@ -713,19 +710,19 @@ void AnimTask_SwayMon(u8 taskId) gBattleAnimArgs[1] = -gBattleAnimArgs[1]; spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[4]); - TASK.data[0] = gBattleAnimArgs[0]; - TASK.data[1] = gBattleAnimArgs[1]; - TASK.data[2] = gBattleAnimArgs[2]; - TASK.data[3] = gBattleAnimArgs[3]; - TASK.data[4] = spriteId; + gTasks[taskId].data[0] = gBattleAnimArgs[0]; + gTasks[taskId].data[1] = gBattleAnimArgs[1]; + gTasks[taskId].data[2] = gBattleAnimArgs[2]; + gTasks[taskId].data[3] = gBattleAnimArgs[3]; + gTasks[taskId].data[4] = spriteId; if (gBattleAnimArgs[4] == 0) - TASK.data[5] = gBattleAnimAttacker; + gTasks[taskId].data[5] = gBattleAnimAttacker; else - TASK.data[5] = gBattleAnimTarget; + gTasks[taskId].data[5] = gBattleAnimTarget; - TASK.data[12] = 1; - TASK.func = AnimTask_SwayMonStep; + gTasks[taskId].data[12] = 1; + gTasks[taskId].func = AnimTask_SwayMonStep; } void AnimTask_SwayMonStep(u8 taskId) @@ -735,19 +732,19 @@ void AnimTask_SwayMonStep(u8 taskId) int waveIndex; u16 sineIndex; - spriteId = TASK.data[4]; - sineIndex = TASK.data[10] + TASK.data[2]; - TASK.data[10] = sineIndex; + spriteId = gTasks[taskId].data[4]; + sineIndex = gTasks[taskId].data[10] + gTasks[taskId].data[2]; + gTasks[taskId].data[10] = sineIndex; waveIndex = sineIndex >> 8; - sineValue = Sin(waveIndex, TASK.data[1]); + sineValue = Sin(waveIndex, gTasks[taskId].data[1]); - if (TASK.data[0] == 0) + if (gTasks[taskId].data[0] == 0) { gSprites[spriteId].pos2.x = sineValue; } else { - if (GetBattlerSide(TASK.data[5]) == B_SIDE_PLAYER) + if (GetBattlerSide(gTasks[taskId].data[5]) == B_SIDE_PLAYER) { gSprites[spriteId].pos2.y = (sineValue >= 0) ? sineValue : -sineValue; } @@ -757,12 +754,12 @@ void AnimTask_SwayMonStep(u8 taskId) } } - if (((waveIndex >= 0x80u) && (TASK.data[11] == 0) && (TASK.data[12] == 1)) - || ((waveIndex < 0x7fu) && (TASK.data[11] == 1) && (TASK.data[12] == 0))) + if (((waveIndex >= 0x80u) && (gTasks[taskId].data[11] == 0) && (gTasks[taskId].data[12] == 1)) + || ((waveIndex < 0x7fu) && (gTasks[taskId].data[11] == 1) && (gTasks[taskId].data[12] == 0))) { - TASK.data[11] ^= 1; - TASK.data[12] ^= 1; - if (--TASK.data[3] == 0) + gTasks[taskId].data[11] ^= 1; + gTasks[taskId].data[12] ^= 1; + if (--gTasks[taskId].data[3] == 0) { gSprites[spriteId].pos2.x = 0; gSprites[spriteId].pos2.y = 0; @@ -783,31 +780,31 @@ void AnimTask_ScaleMonAndRestore(u8 taskId) u8 spriteId; spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]); sub_80A7270(spriteId, gBattleAnimArgs[4]); - TASK.data[0] = gBattleAnimArgs[0]; - TASK.data[1] = gBattleAnimArgs[1]; - TASK.data[2] = gBattleAnimArgs[2]; - TASK.data[3] = gBattleAnimArgs[2]; - TASK.data[4] = spriteId; - TASK.data[10] = 0x100; - TASK.data[11] = 0x100; - TASK.func = AnimTask_ScaleMonAndRestoreStep; + gTasks[taskId].data[0] = gBattleAnimArgs[0]; + gTasks[taskId].data[1] = gBattleAnimArgs[1]; + gTasks[taskId].data[2] = gBattleAnimArgs[2]; + gTasks[taskId].data[3] = gBattleAnimArgs[2]; + gTasks[taskId].data[4] = spriteId; + gTasks[taskId].data[10] = 0x100; + gTasks[taskId].data[11] = 0x100; + gTasks[taskId].func = AnimTask_ScaleMonAndRestoreStep; } void AnimTask_ScaleMonAndRestoreStep(u8 taskId) { u8 spriteId; - TASK.data[10] += TASK.data[0]; - TASK.data[11] += TASK.data[1]; - spriteId = TASK.data[4]; - obj_id_set_rotscale(spriteId, TASK.data[10], TASK.data[11], 0); - if (--TASK.data[2] == 0) + gTasks[taskId].data[10] += gTasks[taskId].data[0]; + gTasks[taskId].data[11] += gTasks[taskId].data[1]; + spriteId = gTasks[taskId].data[4]; + obj_id_set_rotscale(spriteId, gTasks[taskId].data[10], gTasks[taskId].data[11], 0); + if (--gTasks[taskId].data[2] == 0) { - if (TASK.data[3] > 0) + if (gTasks[taskId].data[3] > 0) { - TASK.data[0] = -TASK.data[0]; - TASK.data[1] = -TASK.data[1]; - TASK.data[2] = TASK.data[3]; - TASK.data[3] = 0; + gTasks[taskId].data[0] = -gTasks[taskId].data[0]; + gTasks[taskId].data[1] = -gTasks[taskId].data[1]; + gTasks[taskId].data[2] = gTasks[taskId].data[3]; + gTasks[taskId].data[3] = 0; } else { @@ -823,43 +820,43 @@ void sub_80D6134(u8 taskId) u8 spriteId; spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); sub_80A7270(spriteId, 0); - TASK.data[1] = 0; - TASK.data[2] = gBattleAnimArgs[0]; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = gBattleAnimArgs[0]; if (gBattleAnimArgs[3] != 1) { - TASK.data[3] = 0; + gTasks[taskId].data[3] = 0; } else { - TASK.data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; + gTasks[taskId].data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; } - TASK.data[4] = gBattleAnimArgs[1]; - TASK.data[5] = spriteId; - TASK.data[6] = gBattleAnimArgs[3]; + gTasks[taskId].data[4] = gBattleAnimArgs[1]; + gTasks[taskId].data[5] = spriteId; + gTasks[taskId].data[6] = gBattleAnimArgs[3]; if (IsContest()) { - TASK.data[7] = 1; + gTasks[taskId].data[7] = 1; } else { if (gBattleAnimArgs[2] == 0) { - TASK.data[7] = !GetBattlerSide(gBattleAnimAttacker); + gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker); } else { - TASK.data[7] = !GetBattlerSide(gBattleAnimTarget); + gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimTarget); } } - if (TASK.data[7]) + if (gTasks[taskId].data[7]) { if (!IsContest()) { - TASK.data[3] *= -1; - TASK.data[4] *= -1; + gTasks[taskId].data[3] *= -1; + gTasks[taskId].data[4] *= -1; } } - TASK.func = sub_80D6308; + gTasks[taskId].func = sub_80D6308; } void sub_80D622C(u8 taskId) @@ -867,8 +864,8 @@ void sub_80D622C(u8 taskId) u8 spriteId; spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]); sub_80A7270(spriteId, 0); - TASK.data[1] = 0; - TASK.data[2] = gBattleAnimArgs[0]; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = gBattleAnimArgs[0]; if (gBattleAnimArgs[2] == 0) { if (GetBattlerSide(gBattleAnimAttacker)) @@ -885,43 +882,43 @@ void sub_80D622C(u8 taskId) } if (gBattleAnimArgs[3] != 1) { - TASK.data[3] = 0; + gTasks[taskId].data[3] = 0; } else { - TASK.data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; + gTasks[taskId].data[3] = gBattleAnimArgs[0] * gBattleAnimArgs[1]; } - TASK.data[4] = gBattleAnimArgs[1]; - TASK.data[5] = spriteId; - TASK.data[6] = gBattleAnimArgs[3]; - TASK.data[7] = 1; - TASK.data[3] *= -1; - TASK.data[4] *= -1; - TASK.func = sub_80D6308; + gTasks[taskId].data[4] = gBattleAnimArgs[1]; + gTasks[taskId].data[5] = spriteId; + gTasks[taskId].data[6] = gBattleAnimArgs[3]; + gTasks[taskId].data[7] = 1; + gTasks[taskId].data[3] *= -1; + gTasks[taskId].data[4] *= -1; + gTasks[taskId].func = sub_80D6308; } void sub_80D6308(u8 taskId) { - TASK.data[3] += TASK.data[4]; - obj_id_set_rotscale(TASK.data[5], 0x100, 0x100, TASK.data[3]); - if (TASK.data[7]) + gTasks[taskId].data[3] += gTasks[taskId].data[4]; + obj_id_set_rotscale(gTasks[taskId].data[5], 0x100, 0x100, gTasks[taskId].data[3]); + if (gTasks[taskId].data[7]) { - sub_80A73A0(TASK.data[5]); + sub_80A73A0(gTasks[taskId].data[5]); } - if (++TASK.data[1] >= TASK.data[2]) + if (++gTasks[taskId].data[1] >= gTasks[taskId].data[2]) { - switch (TASK.data[6]) + switch (gTasks[taskId].data[6]) { case 1: - sub_80A7344(TASK.data[5]); + sub_80A7344(gTasks[taskId].data[5]); case 0: default: DestroyAnimVisualTask(taskId); return; case 2: - TASK.data[1] = 0; - TASK.data[4] *= -1; - TASK.data[6] = 1; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[4] *= -1; + gTasks[taskId].data[6] = 1; break; } } @@ -931,40 +928,40 @@ void sub_80D6388(u8 taskId) { if (!gBattleAnimArgs[0]) { - TASK.data[15] = gAnimMovePower / 12; - if (TASK.data[15] < 1) + gTasks[taskId].data[15] = gAnimMovePower / 12; + if (gTasks[taskId].data[15] < 1) { - TASK.data[15] = 1; + gTasks[taskId].data[15] = 1; } - if (TASK.data[15] > 16) + if (gTasks[taskId].data[15] > 16) { - TASK.data[15] = 16; + gTasks[taskId].data[15] = 16; } } else { - TASK.data[15] = gAnimMoveDmg / 12; - if (TASK.data[15] < 1) + gTasks[taskId].data[15] = gAnimMoveDmg / 12; + if (gTasks[taskId].data[15] < 1) { - TASK.data[15] = 1; + gTasks[taskId].data[15] = 1; } - if (TASK.data[15] > 16) + if (gTasks[taskId].data[15] > 16) { - TASK.data[15] = 16; + gTasks[taskId].data[15] = 16; } } - TASK.data[14] = TASK.data[15] / 2; - TASK.data[13] = TASK.data[14] + (TASK.data[15] & 1); - TASK.data[12] = 0; - TASK.data[10] = gBattleAnimArgs[3]; - TASK.data[11] = gBattleAnimArgs[4]; - TASK.data[7] = GetAnimBattlerSpriteId(1); - TASK.data[8] = gSprites[TASK.data[7]].pos2.x; - TASK.data[9] = gSprites[TASK.data[7]].pos2.y; - TASK.data[0] = 0; - TASK.data[1] = gBattleAnimArgs[1]; - TASK.data[2] = gBattleAnimArgs[2]; - TASK.func = sub_80D646C; + gTasks[taskId].data[14] = gTasks[taskId].data[15] / 2; + gTasks[taskId].data[13] = gTasks[taskId].data[14] + (gTasks[taskId].data[15] & 1); + gTasks[taskId].data[12] = 0; + gTasks[taskId].data[10] = gBattleAnimArgs[3]; + gTasks[taskId].data[11] = gBattleAnimArgs[4]; + gTasks[taskId].data[7] = GetAnimBattlerSpriteId(1); + gTasks[taskId].data[8] = gSprites[gTasks[taskId].data[7]].pos2.x; + gTasks[taskId].data[9] = gSprites[gTasks[taskId].data[7]].pos2.y; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = gBattleAnimArgs[1]; + gTasks[taskId].data[2] = gBattleAnimArgs[2]; + gTasks[taskId].func = sub_80D646C; } void sub_80D646C(u8 taskId)