From 68017b531a47bce7c125eea617a701a89013c983 Mon Sep 17 00:00:00 2001 From: Meowsy Date: Mon, 10 Dec 2018 15:49:33 -0500 Subject: [PATCH 01/13] Rename UnknownPokemonStruct to BattleTowerPokemon. --- include/battle_tower.h | 2 +- include/global.h | 6 +++--- include/pokemon.h | 6 +++--- src/battle_tower.c | 2 +- src/pokemon.c | 6 +++--- src/record_mixing.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/battle_tower.h b/include/battle_tower.h index e361b9742..bd8e80fc1 100644 --- a/include/battle_tower.h +++ b/include/battle_tower.h @@ -9,7 +9,7 @@ struct RSBattleTowerRecord /*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1]; /*0x0C*/ u8 trainerId[4]; /*0x10*/ u16 greeting[6]; - /*0x1C*/ struct UnknownPokemonStruct party[3]; + /*0x1C*/ struct BattleTowerPokemon party[3]; /*0xA0*/ u32 checksum; }; diff --git a/include/global.h b/include/global.h index 33a31bf4d..97625c890 100644 --- a/include/global.h +++ b/include/global.h @@ -301,7 +301,7 @@ struct Apprentice u32 checksum; }; -struct UnknownPokemonStruct +struct BattleTowerPokemon { u16 species; u16 heldItem; @@ -338,7 +338,7 @@ struct EmeraldBattleTowerRecord /*0x10*/ u16 greeting[6]; /*0x1C*/ u16 speechWon[6]; /*0x28*/ u16 speechLost[6]; - /*0x34*/ struct UnknownPokemonStruct party[4]; + /*0x34*/ struct BattleTowerPokemon party[4]; /*0xE4*/ u8 language; /*0xE8*/ u32 checksum; }; @@ -353,7 +353,7 @@ struct BattleTowerEReaderTrainer /*0x10*/ u16 greeting[6]; /*0x1C*/ u16 farewellPlayerLost[6]; /*0x28*/ u16 farewellPlayerWon[6]; - /*0x34*/ struct UnknownPokemonStruct party[3]; + /*0x34*/ struct BattleTowerPokemon party[3]; /*0xB8*/ u32 checksum; }; diff --git a/include/pokemon.h b/include/pokemon.h index 5d7f7f2ae..1d9fbf0ee 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -460,11 +460,11 @@ void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level); void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality); void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId); void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread); -void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src); -void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lvl50); +void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src); +void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50); void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId); void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); -void sub_80686FC(struct Pokemon *mon, struct UnknownPokemonStruct *dest); +void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest); void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); bool8 sub_80688F8(u8 caseId, u8 battlerId); void SetDeoxysStats(void); diff --git a/src/battle_tower.c b/src/battle_tower.c index cb128b532..4a9e0dbc4 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -3245,7 +3245,7 @@ static void FillPartnerParty(u16 trainerId) for (i = 0; i < 2; i++) { struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId]; - struct UnknownPokemonStruct monData = record->party[gSaveBlock2Ptr->frontier.field_CB4[18 + i]]; + struct BattleTowerPokemon monData = record->party[gSaveBlock2Ptr->frontier.field_CB4[18 + i]]; StringCopy(trainerName, record->name); if (record->language == LANGUAGE_JAPANESE) { diff --git a/src/pokemon.c b/src/pokemon.c index eec995050..46fe7b0d0 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2755,7 +2755,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI CalculateMonStats(mon); } -void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src) +void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src) { s32 i; u8 nickname[30]; @@ -2809,7 +2809,7 @@ void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src) CalculateMonStats(mon); } -void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lvl50) +void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50) { s32 i; u8 nickname[30]; @@ -2937,7 +2937,7 @@ void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, CalculateMonStats(mon); } -void sub_80686FC(struct Pokemon *mon, struct UnknownPokemonStruct *dest) +void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest) { s32 i; u16 heldItem; diff --git a/src/record_mixing.c b/src/record_mixing.c index d37883e4d..6d5d49265 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -647,7 +647,7 @@ static void ReceiveOldManData(OldMan *oldMan, size_t recordSize, u8 which) static void ReceiveBattleTowerData(void *battleTowerRecord, size_t recordSize, u8 which) { struct EmeraldBattleTowerRecord *dest; - struct UnknownPokemonStruct *btPokemon; + struct BattleTowerPokemon *btPokemon; u32 mixIndices[4]; s32 i; @@ -1866,7 +1866,7 @@ static void SanitizeEmeraldBattleTowerRecord(struct EmeraldBattleTowerRecord *ds for (i = 0; i < 4; i++) { - struct UnknownPokemonStruct *towerMon = &dst->party[i]; + struct BattleTowerPokemon *towerMon = &dst->party[i]; if (towerMon->species != 0) StripExtCtrlCodes(towerMon->nickname); } From d3e32ab287edbfb5575e4821a8f75a7de891867b Mon Sep 17 00:00:00 2001 From: Meowsy Date: Mon, 10 Dec 2018 15:50:10 -0500 Subject: [PATCH 02/13] Rename Mauville Man text. --- data/event_scripts.s | 16 ++++++++-------- include/event_scripts.h | 16 ++++++++-------- src/mauville_old_man.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/data/event_scripts.s b/data/event_scripts.s index d90dbf584..5bd8825ad 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -4651,35 +4651,35 @@ gOtherText_DontYouAgree:: @ 8294301 .string "\n" .string "Don't you agree?$" -gUnknown_08294313:: @ 8294313 +gMauvilleManText_ISoWantToGoOnAVacation:: @ 8294313 .string "I so want to go on a vacation.\n" .string "Would you happen to know a nice place?$" -gUnknown_08294359:: @ 8294359 +gMauvilleManText_IBoughtCrayonsWith120Colors:: @ 8294359 .string "I bought crayons with 120 colors!\n" .string "Don't you think that's nice?$" -gUnknown_08294398:: @ 8294398 +gMauvilleManText_WouldntItBeNiceIfWeCouldFloat:: @ 8294398 .string "Wouldn't it be nice if we could float\n" .string "away on a cloud of bubbles?$" -gUnknown_082943DA:: @ 82943DA +gMauvilleManText_WhenYouWriteOnASandyBeach:: @ 82943DA .string "When you write on a sandy beach,\n" .string "they wash away. It makes me sad.$" -gUnknown_0829441C:: @ 829441C +gMauvilleManText_WhatsTheBottomOfTheSeaLike:: @ 829441C .string "What's the bottom of the sea like?\n" .string "Just once I would so love to go!$" -gUnknown_08294460:: @ 8294460 +gMauvilleManText_WhenYouSeeTheSettingSunDoesIt:: @ 8294460 .string "When you see the setting sun, does it\n" .string "make you want to go home?$" -gUnknown_082944A0:: @ 82944A0 +gMauvilleManText_LyingBackInTheGreenGrass:: @ 82944A0 .string "Lying back in the green grass…\n" .string "Oh, it's so, so nice!$" -gUnknown_082944D5:: @ 82944D5 +gMauvilleManText_SecretBasesAreSoWonderful:: @ 82944D5 .string "SECRET BASES are so wonderful!\n" .string "Can't you feel the excitement?$" diff --git a/include/event_scripts.h b/include/event_scripts.h index 7f69ef3ae..2661494d3 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -405,14 +405,14 @@ extern const u8 gText_SoDesirable[]; extern const u8 gText_SoExciting[]; extern const u8 gText_SoAmusing[]; extern const u8 gText_SoMagical[]; -extern const u8 gUnknown_08294313[]; -extern const u8 gUnknown_08294359[]; -extern const u8 gUnknown_08294398[]; -extern const u8 gUnknown_082943DA[]; -extern const u8 gUnknown_0829441C[]; -extern const u8 gUnknown_08294460[]; -extern const u8 gUnknown_082944A0[]; -extern const u8 gUnknown_082944D5[]; +extern const u8 gMauvilleManText_ISoWantToGoOnAVacation[]; +extern const u8 gMauvilleManText_IBoughtCrayonsWith120Colors[]; +extern const u8 gMauvilleManText_WouldntItBeNiceIfWeCouldFloat[]; +extern const u8 gMauvilleManText_WhenYouWriteOnASandyBeach[]; +extern const u8 gMauvilleManText_WhatsTheBottomOfTheSeaLike[]; +extern const u8 gMauvilleManText_WhenYouSeeTheSettingSunDoesIt[]; +extern const u8 gMauvilleManText_LyingBackInTheGreenGrass[]; +extern const u8 gMauvilleManText_SecretBasesAreSoWonderful[]; extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E930[]; diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 110ec068e..930f1f35b 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -62,14 +62,14 @@ static const u8 * const sGiddyAdjectives[] = { }; static const u8 * const sGiddyQuestions[] = { - gUnknown_08294313, - gUnknown_08294359, - gUnknown_08294398, - gUnknown_082943DA, - gUnknown_0829441C, - gUnknown_08294460, - gUnknown_082944A0, - gUnknown_082944D5 + gMauvilleManText_ISoWantToGoOnAVacation, + gMauvilleManText_IBoughtCrayonsWith120Colors, + gMauvilleManText_WouldntItBeNiceIfWeCouldFloat, + gMauvilleManText_WhenYouWriteOnASandyBeach, + gMauvilleManText_WhatsTheBottomOfTheSeaLike, + gMauvilleManText_WhenYouSeeTheSettingSunDoesIt, + gMauvilleManText_LyingBackInTheGreenGrass, + gMauvilleManText_SecretBasesAreSoWonderful }; static void SetupBard(void) From 2c6849bee81f2c05cbf0df1f88c6d5460e7b1e2d Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Thu, 13 Dec 2018 21:33:54 -0600 Subject: [PATCH 03/13] Decompile battle_anim_8170478.c (#445) --- asm/battle_anim_8170478.s | 5832 --------------------------- common_syms/battle_anim_8170478.txt | 3 + data/battle_anim_8170478.s | 157 - include/battle.h | 3 +- include/battle_anim.h | 8 +- include/global.h | 6 + include/graphics.h | 6 + ld_script.txt | 4 +- src/battle_anim.c | 2 - src/battle_anim_8170478.c | 2267 +++++++++++ src/battle_intro.c | 7 +- src/pokeball.c | 12 +- src/pokemon.c | 12 - sym_common.txt | 11 +- 14 files changed, 2299 insertions(+), 6031 deletions(-) delete mode 100644 asm/battle_anim_8170478.s create mode 100755 common_syms/battle_anim_8170478.txt delete mode 100644 data/battle_anim_8170478.s create mode 100755 src/battle_anim_8170478.c diff --git a/asm/battle_anim_8170478.s b/asm/battle_anim_8170478.s deleted file mode 100644 index c0881e682..000000000 --- a/asm/battle_anim_8170478.s +++ /dev/null @@ -1,5832 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8170478 -sub_8170478: @ 8170478 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x10] - ldr r0, =gBattleAnimAttacker - ldrb r4, [r0] - ldr r0, =gBattle_WIN0H - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_WIN0V - strh r1, [r0] - ldr r1, =0x00003f3f - movs r0, 0x48 - bl SetGpuReg - ldr r1, =0x00003f3d - movs r0, 0x4A - bl SetGpuReg - movs r1, 0x80 - lsls r1, 8 - movs r0, 0 - bl SetGpuRegBits - ldr r1, =0x00003f42 - movs r0, 0x50 - bl SetGpuReg - movs r1, 0x80 - lsls r1, 5 - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x1 - movs r1, 0x4 - movs r2, 0 - bl SetAnimBgAttribute - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl SetAnimBgAttribute - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x1 - bl SetAnimBgAttribute - movs r0, 0x1 - movs r1, 0x3 - movs r2, 0x1 - bl SetAnimBgAttribute - ldr r0, =gHealthboxSpriteIds - adds r4, r0 - ldrb r0, [r4] - ldr r1, =gSprites - mov r9, r1 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - add r4, r9 - ldrb r7, [r4, 0x6] - ldrh r6, [r4, 0x38] - lsls r6, 24 - lsrs r6, 24 - ldr r0, =SpriteCallbackDummy - bl CreateInvisibleSpriteWithCallback - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - ldr r0, =SpriteCallbackDummy - bl CreateInvisibleSpriteWithCallback - mov r10, r0 - mov r2, r10 - lsls r2, 24 - lsrs r2, 24 - mov r10, r2 - ldrb r1, [r4, 0x5] - movs r3, 0xD - negs r3, r3 - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x4 - mov r8, r1 - mov r2, r8 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r5, r7, 4 - adds r5, r7 - lsls r5, 2 - add r5, r9 - ldrb r1, [r5, 0x5] - adds r0, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - add r1, r9 - ldrb r2, [r1, 0x5] - adds r0, r3, 0 - ands r0, r2 - mov r2, r8 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r0, [sp, 0x14] - lsls r6, r0, 4 - adds r6, r0 - lsls r6, 2 - mov r1, r9 - adds r7, r6, r1 - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0x44 - str r3, [sp, 0x18] - bl memcpy - mov r2, r10 - lsls r4, r2, 4 - add r4, r10 - lsls r4, 2 - adds r0, r4, 0 - add r0, r9 - mov r8, r0 - adds r1, r5, 0 - movs r2, 0x44 - bl memcpy - ldrb r1, [r7, 0x1] - ldr r3, [sp, 0x18] - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r7, 0x1] - mov r2, r8 - ldrb r0, [r2, 0x1] - ands r3, r0 - orrs r3, r1 - strb r3, [r2, 0x1] - movs r0, 0x1C - add r9, r0 - add r6, r9 - ldr r1, =SpriteCallbackDummy - str r1, [r6] - add r4, r9 - str r1, [r4] - mov r0, sp - bl sub_80A6B30 - mov r0, sp - ldrb r0, [r0, 0x9] - ldr r1, =gUnknown_08C2EA9C - bl sub_80A6D48 - mov r0, sp - ldrb r0, [r0, 0x9] - ldr r1, =gUnknown_08C2EA50 - mov r2, sp - ldrh r2, [r2, 0xA] - bl sub_80A6CC0 - ldr r0, =gUnknown_08C2DDA4 - mov r1, sp - ldrb r1, [r1, 0x8] - lsls r1, 4 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r1, =gBattle_BG1_X - ldrh r0, [r7, 0x20] - negs r0, r0 - adds r0, 0x20 - strh r0, [r1] - ldr r1, =gBattle_BG1_Y - ldrh r0, [r7, 0x22] - negs r0, r0 - subs r0, 0x20 - strh r0, [r1] - ldr r1, =gTasks - ldr r2, [sp, 0x10] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - movs r1, 0xA0 - lsls r1, 2 - strh r1, [r0, 0xA] - mov r1, sp - ldrh r1, [r1, 0x14] - strh r1, [r0, 0x8] - mov r2, r10 - strh r2, [r0, 0xC] - ldr r1, =sub_8170660 - str r1, [r0] - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170478 - - thumb_func_start sub_8170660 -sub_8170660: @ 8170660 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - mov r8, r0 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r5, r0, r1 - ldrh r1, [r5, 0xA] - ldrh r0, [r5, 0x22] - adds r1, r0 - movs r3, 0 - strh r1, [r5, 0x22] - ldr r2, =gBattle_BG1_Y - lsls r0, r1, 16 - lsrs r0, 24 - ldrh r4, [r2] - adds r0, r4 - strh r0, [r2] - movs r0, 0xFF - ands r1, r0 - strh r1, [r5, 0x22] - movs r1, 0x26 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _081706F0 - cmp r0, 0x1 - bgt _081706B4 - cmp r0, 0 - beq _081706BA - b _08170814 - .pool -_081706B4: - cmp r0, 0x2 - beq _08170708 - b _08170814 -_081706BA: - ldrh r0, [r5, 0x1E] - adds r1, r0, 0x1 - strh r1, [r5, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bgt _081706CA - b _08170814 -_081706CA: - strh r3, [r5, 0x1E] - ldrh r1, [r5, 0x20] - adds r1, 0x1 - strh r1, [r5, 0x20] - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r2, 0x20 - ldrsh r0, [r5, r2] - cmp r0, 0x8 - beq _081706EE - b _08170814 -_081706EE: - b _08170700 -_081706F0: - ldrh r0, [r5, 0x1C] - adds r0, 0x1 - strh r0, [r5, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - beq _08170700 - b _08170814 -_08170700: - ldrh r0, [r5, 0x26] - adds r0, 0x1 - strh r0, [r5, 0x26] - b _08170814 -_08170708: - ldrh r0, [r5, 0x1E] - adds r1, r0, 0x1 - strh r1, [r5, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08170814 - strh r3, [r5, 0x1E] - ldrh r1, [r5, 0x20] - subs r1, 0x1 - strh r1, [r5, 0x20] - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x20 - ldrsh r4, [r5, r0] - cmp r4, 0 - bne _08170814 - movs r0, 0 - bl sub_80A477C - ldr r0, =gBattle_WIN0H - strh r4, [r0] - ldr r0, =gBattle_WIN0V - strh r4, [r0] - ldr r4, =0x00003f3f - movs r0, 0x48 - adds r1, r4, 0 - bl SetGpuReg - movs r0, 0x4A - adds r1, r4, 0 - bl SetGpuReg - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0817076C - movs r0, 0x1 - movs r1, 0x3 - movs r2, 0 - bl SetAnimBgAttribute -_0817076C: - movs r0, 0 - bl GetGpuReg - adds r1, r0, 0 - movs r2, 0x80 - lsls r2, 8 - adds r0, r2, 0 - eors r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r4, 0x8 - ldrsh r1, [r5, r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r6, =gSprites - adds r0, r6 - bl DestroySprite - movs r0, 0xC - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl SetAnimBgAttribute - ldr r0, =gHealthboxSpriteIds - add r0, r8 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r2, [r1, 0x6] - mov r8, r2 - ldrh r4, [r1, 0x38] - lsls r4, 24 - lsrs r4, 24 - ldrb r3, [r1, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - movs r5, 0x4 - orrs r0, r5 - strb r0, [r1, 0x5] - mov r0, r8 - lsls r1, r0, 4 - add r1, r8 - lsls r1, 2 - adds r1, r6 - ldrb r3, [r1, 0x5] - adds r0, r2, 0 - ands r0, r3 - orrs r0, r5 - strb r0, [r1, 0x5] - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0, 0x5] - ands r2, r1 - orrs r2, r5 - strb r2, [r0, 0x5] - adds r0, r7, 0 - bl DestroyAnimVisualTask -_08170814: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170660 - - thumb_func_start sub_8170834 -sub_8170834: @ 8170834 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r9, r0 - adds r7, r1, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gHealthboxSpriteIds - adds r2, r0 - ldrb r0, [r2] - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r0, =gSprites - adds r5, r0 - ldrb r1, [r5, 0x6] - mov r10, r1 - ldrh r4, [r5, 0x38] - lsls r4, 24 - lsrs r4, 24 - ldr r0, =0x0000d709 - bl AllocSpritePalette - mov r2, r9 - strb r0, [r2] - ldr r0, =0x0000d70a - bl AllocSpritePalette - strb r0, [r7] - ldrb r0, [r5, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r1, 0x80 - lsls r1, 1 - adds r3, r1, 0 - orrs r0, r3 - lsls r6, r4, 4 - adds r6, r4 - lsls r6, 2 - ldr r2, =gSprites - adds r6, r2 - ldrb r4, [r6, 0x5] - lsrs r4, 4 - lsls r4, 4 - orrs r4, r3 - lsls r0, 1 - ldr r1, =gPlttBufferUnfaded - mov r8, r1 - add r0, r8 - mov r2, r9 - ldrb r1, [r2] - lsls r1, 4 - adds r1, r3, r1 - movs r2, 0x20 - str r3, [sp] - bl LoadPalette - lsls r4, 1 - add r4, r8 - ldrb r0, [r7] - lsls r0, 4 - ldr r3, [sp] - adds r3, r0 - adds r0, r4, 0 - adds r1, r3, 0 - movs r2, 0x20 - bl LoadPalette - mov r0, r9 - ldrb r1, [r0] - lsls r1, 4 - ldrb r2, [r5, 0x5] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x5] - mov r2, r10 - lsls r1, r2, 4 - add r1, r10 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - mov r0, r9 - ldrb r2, [r0] - lsls r2, 4 - ldrb r4, [r1, 0x5] - adds r0, r3, 0 - ands r0, r4 - orrs r0, r2 - strb r0, [r1, 0x5] - ldrb r0, [r7] - lsls r0, 4 - ldrb r1, [r6, 0x5] - ands r3, r1 - orrs r3, r0 - strb r3, [r6, 0x5] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170834 - - thumb_func_start sub_8170920 -sub_8170920: @ 8170920 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - mov r1, sp - adds r1, 0x1 - ldr r0, =gBattleAnimAttacker - ldrb r2, [r0] - mov r0, sp - bl sub_8170834 - adds r0, r4, 0 - bl DestroyAnimVisualTask - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170920 - - thumb_func_start sub_817094C -sub_817094C: @ 817094C - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gHealthboxSpriteIds - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSprites - mov r8, r1 - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - add r5, r8 - ldrb r0, [r5, 0x6] - mov r9, r0 - ldrh r6, [r5, 0x38] - lsls r6, 24 - lsrs r6, 24 - ldr r0, =0x0000d709 - bl FreeSpritePaletteByTag - ldr r0, =0x0000d70a - bl FreeSpritePaletteByTag - ldr r0, =0x0000d6ff - bl IndexOfSpritePaletteTag - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =0x0000d704 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsls r4, 4 - ldrb r2, [r5, 0x5] - movs r3, 0xF - adds r1, r3, 0 - ands r1, r2 - orrs r1, r4 - strb r1, [r5, 0x5] - mov r1, r9 - lsls r2, r1, 4 - add r2, r9 - lsls r2, 2 - add r2, r8 - ldrb r5, [r2, 0x5] - adds r1, r3, 0 - ands r1, r5 - orrs r1, r4 - strb r1, [r2, 0x5] - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - add r1, r8 - lsrs r0, 20 - ldrb r2, [r1, 0x5] - ands r3, r2 - orrs r3, r0 - strb r3, [r1, 0x5] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817094C - - thumb_func_start sub_81709EC -sub_81709EC: @ 81709EC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl sub_817094C - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81709EC - - thumb_func_start sub_8170A0C -sub_8170A0C: @ 8170A0C - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r2, =gBattleAnimArgs - ldrh r0, [r2] - strh r0, [r1, 0x1C] - ldrh r0, [r2, 0x2] - strh r0, [r1, 0x1E] - ldr r0, =sub_8170A38 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8170A0C - - thumb_func_start sub_8170A38 -sub_8170A38: @ 8170A38 - 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 r0, [r4, 0x8] - adds r0, 0x1 - movs r6, 0 - adds r1, r0, 0x1 - strh r1, [r4, 0x8] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x1E - ldrsh r1, [r4, r2] - cmp r0, r1 - blt _08170AF8 - strh r6, [r4, 0x8] - ldr r0, =0x0000d709 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r2, r0, 24 - movs r3, 0x1C - ldrsh r0, [r4, r3] - movs r1, 0x2 - cmp r0, 0 - bne _08170A76 - movs r1, 0x6 -_08170A76: - movs r3, 0xA - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _08170A8C - cmp r0, 0x1 - beq _08170AC8 - b _08170AF8 - .pool -_08170A8C: - ldrh r0, [r4, 0xC] - adds r0, 0x2 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _08170A9E - movs r0, 0x10 - strh r0, [r4, 0xC] -_08170A9E: - lsls r0, r2, 4 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - orrs r0, r1 - ldrb r2, [r4, 0xC] - ldr r3, =0x00007f74 - movs r1, 0x1 - bl BlendPalette - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0x10 - bne _08170AF8 - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - b _08170AF8 - .pool -_08170AC8: - ldrh r0, [r4, 0xC] - subs r0, 0x2 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - bge _08170AD6 - strh r6, [r4, 0xC] -_08170AD6: - lsls r0, r2, 4 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - orrs r0, r1 - ldrb r2, [r4, 0xC] - ldr r3, =0x00007f74 - movs r1, 0x1 - bl BlendPalette - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0 - bne _08170AF8 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08170AF8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170A38 - - thumb_func_start sub_8170B04 -sub_8170B04: @ 8170B04 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r5, [r0] - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08170B52 - cmp r0, 0x1 - bgt _08170B3C - cmp r0, 0 - beq _08170B42 - b _08170BA4 - .pool -_08170B3C: - cmp r0, 0x2 - beq _08170B84 - b _08170BA4 -_08170B42: - adds r0, r5, 0 - movs r1, 0 - bl sub_80A7270 - movs r0, 0x80 - lsls r0, 1 - strh r0, [r4, 0x1C] - b _08170B76 -_08170B52: - ldrh r0, [r4, 0x1C] - adds r0, 0x30 - strh r0, [r4, 0x1C] - movs r0, 0x1C - ldrsh r2, [r4, r0] - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl obj_id_set_rotscale - adds r0, r5, 0 - bl sub_80A7E6C - movs r0, 0x1C - ldrsh r1, [r4, r0] - ldr r0, =0x000002cf - cmp r1, r0 - ble _08170BA4 -_08170B76: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08170BA4 - .pool -_08170B84: - adds r0, r5, 0 - bl sub_80A7344 - ldr r1, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - adds r0, r6, 0 - bl DestroyAnimVisualTask -_08170BA4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170B04 - - thumb_func_start sub_8170BB0 -sub_8170BB0: @ 8170BB0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gBattlerSpriteIds - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - adds r1, r0, r1 - ldrb r1, [r1] - mov r9, r1 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08170BF8 - ldr r1, =gBattlerPartyIndexes - ldrb r0, [r4] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - b _08170C08 - .pool -_08170BF8: - ldr r1, =gBattlerPartyIndexes - ldrb r0, [r4] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty -_08170C08: - adds r0, r1 - movs r1, 0x26 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl ItemIdToBallId - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r2, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r6, r0, r2 - movs r0, 0x8 - ldrsh r7, [r6, r0] - cmp r7, 0 - beq _08170C44 - cmp r7, 0x1 - beq _08170CC4 - b _08170CEE - .pool -_08170C44: - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - movs r1, 0 - bl GetBattlerSpriteCoord - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r5] - movs r1, 0x1 - bl GetBattlerSpriteCoord - adds r1, r0, 0 - lsls r1, 24 - ldr r2, =gSprites - mov r3, r9 - lsls r0, r3, 4 - add r0, r9 - lsls r0, 2 - adds r0, r2 - ldrb r2, [r0, 0x5] - lsls r2, 28 - lsrs r2, 30 - adds r0, 0x43 - ldrb r3, [r0] - movs r0, 0x80 - lsls r0, 22 - adds r1, r0 - lsrs r1, 24 - mov r0, r8 - str r0, [sp] - adds r0, r4, 0 - bl LaunchBallStarsTask - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x1C] - str r7, [sp] - str r7, [sp, 0x4] - str r7, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_80A75AC - adds r2, r0, 0 - ldrb r1, [r5] - movs r0, 0 - mov r3, r8 - bl LaunchBallFadeMonTask - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x1E] - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - b _08170CEE - .pool -_08170CC4: - movs r1, 0x1C - ldrsh r0, [r6, r1] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r0, [r1, 0x4] - cmp r0, 0 - bne _08170CEE - movs r3, 0x1E - ldrsh r0, [r6, r3] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r0, [r1, 0x4] - cmp r0, 0 - bne _08170CEE - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08170CEE: - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8170BB0 - - thumb_func_start sub_8170CFC -sub_8170CFC: @ 8170CFC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gLastUsedItem - ldrh r0, [r0] - bl ItemIdToBallId - lsls r0, 24 - lsrs r0, 24 - bl LoadBallGfx - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170CFC - - thumb_func_start sub_8170D24 -sub_8170D24: @ 8170D24 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gLastUsedItem - ldrh r0, [r0] - bl ItemIdToBallId - lsls r0, 24 - lsrs r0, 24 - bl FreeBallGfx - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170D24 - - thumb_func_start AnimTask_IsBallBlockedByTrainer -AnimTask_IsBallBlockedByTrainer: @ 8170D4C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrb r0, [r0, 0x8] - cmp r0, 0x5 - bne _08170D70 - ldr r1, =gBattleAnimArgs - ldr r0, =0x0000ffff - b _08170D74 - .pool -_08170D70: - ldr r1, =gBattleAnimArgs - movs r0, 0 -_08170D74: - strh r0, [r1, 0xE] - adds r0, r2, 0 - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_IsBallBlockedByTrainer - - thumb_func_start ItemIdToBallId -ItemIdToBallId: @ 8170D84 - push {lr} - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x1 - cmp r0, 0xB - bhi _08170DFC - lsls r0, 2 - ldr r1, =_08170DA0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08170DA0: - .4byte _08170DD0 - .4byte _08170DD4 - .4byte _08170DD8 - .4byte _08170DFC - .4byte _08170DDC - .4byte _08170DE0 - .4byte _08170DE4 - .4byte _08170DE8 - .4byte _08170DEC - .4byte _08170DF0 - .4byte _08170DF4 - .4byte _08170DF8 -_08170DD0: - movs r0, 0x4 - b _08170DFE -_08170DD4: - movs r0, 0x3 - b _08170DFE -_08170DD8: - movs r0, 0x1 - b _08170DFE -_08170DDC: - movs r0, 0x2 - b _08170DFE -_08170DE0: - movs r0, 0x5 - b _08170DFE -_08170DE4: - movs r0, 0x6 - b _08170DFE -_08170DE8: - movs r0, 0x7 - b _08170DFE -_08170DEC: - movs r0, 0x8 - b _08170DFE -_08170DF0: - movs r0, 0x9 - b _08170DFE -_08170DF4: - movs r0, 0xA - b _08170DFE -_08170DF8: - movs r0, 0xB - b _08170DFE -_08170DFC: - movs r0, 0 -_08170DFE: - pop {r1} - bx r1 - thumb_func_end ItemIdToBallId - - thumb_func_start sub_8170E04 -sub_8170E04: @ 8170E04 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - mov r10, r0 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, =gLastUsedItem - ldrh r0, [r0] - bl ItemIdToBallId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - ldr r1, =gBallSpriteTemplates - adds r0, r1 - movs r1, 0x20 - movs r2, 0x50 - movs r3, 0x1D - bl CreateSprite - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gSprites - mov r9, r1 - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - adds r6, r4, r1 - movs r0, 0x22 - strh r0, [r6, 0x2E] - ldr r2, =gBattleAnimTarget - mov r8, r2 - ldrb r0, [r2] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x30] - mov r1, r8 - ldrb r0, [r1] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x10 - strh r0, [r6, 0x32] - mov r0, r9 - adds r0, 0x1C - adds r4, r0 - ldr r0, =sub_8171104 - str r0, [r4] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r3, [r0, 0x8] - ldr r1, =gBattlerSpriteIds - mov r2, r8 - ldrb r0, [r2] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - adds r0, 0x3E - ldrb r1, [r0] - lsls r1, 29 - lsrs r1, 31 - lsls r1, 1 - ldrb r2, [r3, 0x9] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x9] - ldr r1, =gTasks - mov r2, r10 - lsls r0, r2, 2 - add r0, r10 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x8] - ldr r1, =sub_8170EF0 - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170E04 - - thumb_func_start sub_8170EF0 -sub_8170EF0: @ 8170EF0 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r0, r1 - ldrb r1, [r0, 0x8] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x2E] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _08170F1A - adds r0, r3, 0 - bl DestroyAnimVisualTask -_08170F1A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170EF0 - - thumb_func_start sub_8170F2C -sub_8170F2C: @ 8170F2C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 2 - ands r0, r1 - cmp r0, 0 - beq _08170F50 - movs r6, 0x20 - movs r5, 0xB - b _08170F54 - .pool -_08170F50: - movs r6, 0x17 - movs r5, 0x5 -_08170F54: - ldr r0, =gLastUsedItem - ldrh r0, [r0] - bl ItemIdToBallId - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - bl sub_80A82E4 - adds r3, r0, 0 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - ldr r1, =gBallSpriteTemplates - adds r0, r1 - adds r1, r6, 0 - adds r1, 0x20 - movs r2, 0x50 - orrs r5, r2 - adds r2, r5, 0 - bl CreateSprite - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gSprites - mov r9, r0 - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - adds r6, r4, r0 - movs r0, 0x22 - strh r0, [r6, 0x2E] - ldr r1, =gBattleAnimTarget - mov r8, r1 - ldrb r0, [r1] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x30] - mov r1, r8 - ldrb r0, [r1] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x10 - strh r0, [r6, 0x32] - movs r0, 0x1C - add r9, r0 - add r4, r9 - ldr r0, =SpriteCallbackDummy - str r0, [r4] - movs r0, 0 - bl GetBattlerAtPosition - ldr r1, =gBattlerSpriteIds - lsls r0, 24 - lsrs r0, 24 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - ldr r1, =sub_8039E84 - str r1, [r0] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x8] - ldr r1, =sub_8171030 - str r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170F2C - - thumb_func_start sub_8171030 -sub_8171030: @ 8171030 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gSprites - movs r0, 0 - bl GetBattlerAtPosition - ldr r1, =gBattlerSpriteIds - lsls r0, 24 - lsrs r0, 24 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _0817108A - movs r0, 0x3D - movs r1, 0 - bl PlaySE12WithPanning - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_8171104 - str r1, [r0] - ldr r0, =sub_81710A8 - movs r1, 0xA - bl CreateTask - ldr r0, =sub_8170EF0 - str r0, [r4] -_0817108A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171030 - - thumb_func_start sub_81710A8 -sub_81710A8: @ 81710A8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gSprites - movs r0, 0 - bl GetBattlerAtPosition - ldr r4, =gBattlerSpriteIds - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _081710F4 - movs r0, 0 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0 - bl StartSpriteAnim - adds r0, r5, 0 - bl DestroyTask -_081710F4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81710A8 - - thumb_func_start sub_8171104 -sub_8171104: @ 8171104 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - ldrh r2, [r4, 0x32] - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - strh r1, [r4, 0x32] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - strh r2, [r4, 0x36] - ldr r0, =0x0000ffd8 - strh r0, [r4, 0x38] - adds r0, r4, 0 - bl InitAnimArcTranslation - ldr r0, =sub_8171134 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171104 - - thumb_func_start sub_8171134 -sub_8171134: @ 8171134 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _081711D2 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrb r0, [r0, 0x8] - cmp r0, 0x5 - bne _08171160 - ldr r0, =sub_8171CAC - str r0, [r4, 0x1C] - b _081711D2 - .pool -_08171160: - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - movs r1, 0 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x26] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - strh r1, [r4, 0x24] - strh r1, [r4, 0x26] - adds r1, r4, 0 - adds r1, 0x2E - movs r2, 0 - adds r0, r4, 0 - adds r0, 0x3C -_08171188: - strh r2, [r0] - subs r0, 0x2 - cmp r0, r1 - bge _08171188 - movs r0, 0 - strh r0, [r4, 0x38] - ldr r0, =sub_81711E8 - str r0, [r4, 0x1C] - ldr r0, =gLastUsedItem - ldrh r0, [r0] - bl ItemIdToBallId - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xB - bgt _081711D2 - cmp r5, 0 - blt _081711D2 - ldrh r0, [r4, 0x20] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x22] - subs r1, 0x5 - lsls r1, 24 - lsrs r1, 24 - str r5, [sp] - movs r2, 0x1 - movs r3, 0x1C - bl LaunchBallStarsTask - ldr r0, =gBattleAnimTarget - ldrb r1, [r0] - movs r0, 0 - movs r2, 0xE - adds r3, r5, 0 - bl LaunchBallFadeMonTask -_081711D2: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171134 - - thumb_func_start sub_81711E8 -sub_81711E8: @ 81711E8 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _08171224 - ldr r0, =TaskDummy - movs r1, 0x32 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x38] - ldr r0, =sub_8171240 - str r0, [r4, 0x1C] - ldr r2, =gSprites - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x30] -_08171224: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81711E8 - - thumb_func_start sub_8171240 -sub_8171240: @ 8171240 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - adds r0, r1 - ldrb r4, [r0] - ldrh r0, [r7, 0x38] - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r5, r0, r1 - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB - bne _08171272 - movs r0, 0x3C - bl PlaySE -_08171272: - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _081712E8 - cmp r0, 0x1 - bgt _08171290 - cmp r0, 0 - beq _08171296 - b _08171354 - .pool -_08171290: - cmp r0, 0x2 - beq _0817132C - b _08171354 -_08171296: - adds r0, r4, 0 - movs r1, 0 - bl sub_80A7270 - movs r0, 0x80 - lsls r0, 1 - strh r0, [r5, 0x1C] - ldr r1, =gUnknown_030062DC - movs r0, 0x1C - str r0, [r1] - ldr r2, =gUnknown_030062E4 - ldr r1, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0, 0x26] - ldrh r0, [r0, 0x22] - adds r1, r0 - ldrh r0, [r7, 0x26] - ldrh r7, [r7, 0x22] - adds r0, r7 - subs r1, r0 - strh r1, [r2] - ldr r4, =gUnknown_030062E0 - ldrh r0, [r2] - lsls r0, 8 - movs r1, 0x1C - bl __udivsi3 - strh r0, [r4] - strh r0, [r5, 0xC] - b _08171346 - .pool -_081712E8: - ldrh r0, [r5, 0x1C] - adds r0, 0x20 - strh r0, [r5, 0x1C] - movs r0, 0x1C - ldrsh r2, [r5, r0] - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl obj_id_set_rotscale - ldrh r0, [r5, 0xC] - ldrh r1, [r5, 0xE] - adds r0, r1 - strh r0, [r5, 0xE] - ldr r0, =gSprites - lsls r1, r4, 4 - adds r1, r4 - lsls r1, 2 - adds r1, r0 - movs r2, 0xE - ldrsh r0, [r5, r2] - negs r0, r0 - asrs r0, 8 - strh r0, [r1, 0x26] - movs r0, 0x1C - ldrsh r1, [r5, r0] - ldr r0, =0x0000047f - cmp r1, r0 - ble _0817137C - b _08171346 - .pool -_0817132C: - adds r0, r4, 0 - bl sub_80A7344 - 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] -_08171346: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _0817137C - .pool -_08171354: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r2, 0xA - ldrsh r0, [r1, r2] - cmp r0, 0xA - ble _0817137C - adds r0, r6, 0 - bl DestroyTask - adds r0, r7, 0 - movs r1, 0x2 - bl StartSpriteAnim - movs r0, 0 - strh r0, [r7, 0x38] - ldr r0, =sub_817138C - str r0, [r7, 0x1C] -_0817137C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171240 - - thumb_func_start sub_817138C -sub_817138C: @ 817138C - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081713C6 - movs r1, 0 - strh r1, [r4, 0x34] - movs r0, 0x28 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - movs r0, 0 - movs r1, 0x28 - bl Cos - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - movs r0, 0x36 - ldrsh r1, [r4, r0] - movs r0, 0 - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldr r0, =sub_81713D0 - str r0, [r4, 0x1C] -_081713C6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817138C - - thumb_func_start sub_81713D0 -sub_81713D0: @ 81713D0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r5, 0 - ldrh r0, [r4, 0x34] - movs r1, 0xFF - ands r1, r0 - cmp r1, 0 - beq _081713E6 - cmp r1, 0x1 - beq _0817145A - b _08171486 -_081713E6: - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r1, [r4, 0x38] - adds r1, 0x4 - ldrh r2, [r4, 0x34] - lsls r0, r2, 16 - asrs r0, 24 - adds r1, r0 - strh r1, [r4, 0x38] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x3F - ble _08171486 - ldrh r0, [r4, 0x36] - subs r0, 0xA - strh r0, [r4, 0x36] - ldr r1, =0x00000101 - adds r0, r2, r1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 24 - cmp r0, 0x4 - bne _08171422 - movs r5, 0x1 -_08171422: - cmp r0, 0x2 - beq _08171442 - cmp r0, 0x2 - bgt _08171434 - cmp r0, 0x1 - beq _0817143A - b _08171452 - .pool -_08171434: - cmp r0, 0x3 - beq _0817144A - b _08171452 -_0817143A: - movs r0, 0x38 - bl PlaySE - b _08171486 -_08171442: - movs r0, 0x39 - bl PlaySE - b _08171486 -_0817144A: - movs r0, 0x3A - bl PlaySE - b _08171486 -_08171452: - movs r0, 0x3B - bl PlaySE - b _08171486 -_0817145A: - movs r2, 0x38 - ldrsh r0, [r4, r2] - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r1, [r4, 0x38] - subs r1, 0x4 - ldrh r2, [r4, 0x34] - lsls r0, r2, 16 - asrs r0, 24 - subs r1, r0 - strh r1, [r4, 0x38] - lsls r1, 16 - cmp r1, 0 - bgt _08171486 - strh r5, [r4, 0x38] - ldr r0, =0xffffff00 - ands r0, r2 - strh r0, [r4, 0x34] -_08171486: - cmp r5, 0 - beq _081714CA - movs r5, 0 - strh r5, [r4, 0x34] - movs r0, 0x40 - movs r1, 0x28 - bl Cos - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - strh r5, [r4, 0x26] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _081714C0 - strh r5, [r4, 0x38] - ldr r0, =sub_81717B4 - str r0, [r4, 0x1C] - b _081714CA - .pool -_081714C0: - ldr r0, =sub_81714D4 - str r0, [r4, 0x1C] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r5, [r4, 0x38] -_081714CA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81713D0 - - thumb_func_start sub_81714D4 -sub_81714D4: @ 81714D4 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r5, 0 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _08171510 - strh r5, [r4, 0x34] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - strh r5, [r0, 0xC] - ldr r0, =sub_8171520 - str r0, [r4, 0x1C] - movs r0, 0x17 - bl PlaySE -_08171510: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81714D4 - - thumb_func_start sub_8171520 -sub_8171520: @ 8171520 - push {r4-r6,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x34] - movs r1, 0xFF - ands r1, r0 - cmp r1, 0x6 - bls _08171530 - b _08171768 -_08171530: - lsls r0, r1, 2 - ldr r1, =_08171540 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08171540: - .4byte _0817155C - .4byte _081715AE - .4byte _081715F4 - .4byte _08171654 - .4byte _081716A4 - .4byte _08171708 - .4byte _08171768 -_0817155C: - ldr r1, =gBattleSpritesDataPtr - ldr r5, [r1] - ldr r2, [r5, 0x8] - ldrh r3, [r2, 0xC] - movs r6, 0xC - ldrsh r0, [r2, r6] - adds r6, r1, 0 - cmp r0, 0xFF - ble _08171584 - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - ldr r1, [r5, 0x8] - ldrb r0, [r1, 0xC] - strh r0, [r1, 0xC] - b _0817158A - .pool -_08171584: - adds r0, r3, 0 - adds r0, 0xB0 - strh r0, [r2, 0xC] -_0817158A: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - movs r3, 0 - strh r0, [r4, 0x38] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x38] - adds r0, 0x7 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xE - bhi _081715AC - b _081717AE -_081715AC: - b _08171644 -_081715AE: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08171660 - movs r0, 0 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x36] - negs r0, r0 - strh r0, [r4, 0x36] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - movs r6, 0x36 - ldrsh r0, [r4, r6] - cmp r0, 0 - bge _081715EA - adds r0, r4, 0 - movs r1, 0x2 - bl ChangeSpriteAffineAnim - b _081717AE -_081715EA: - adds r0, r4, 0 - movs r1, 0x1 - bl ChangeSpriteAffineAnim - b _081717AE -_081715F4: - ldr r1, =gBattleSpritesDataPtr - ldr r5, [r1] - ldr r2, [r5, 0x8] - ldrh r3, [r2, 0xC] - movs r6, 0xC - ldrsh r0, [r2, r6] - adds r6, r1, 0 - cmp r0, 0xFF - ble _0817161C - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - ldr r1, [r5, 0x8] - ldrb r0, [r1, 0xC] - strh r0, [r1, 0xC] - b _08171622 - .pool -_0817161C: - adds r0, r3, 0 - adds r0, 0xB0 - strh r0, [r2, 0xC] -_08171622: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - movs r3, 0 - strh r0, [r4, 0x38] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x38] - adds r0, 0xC - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x18 - bhi _08171644 - b _081717AE -_08171644: - ldr r0, [r6] - ldr r0, [r0, 0x8] - strh r3, [r0, 0xC] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - strh r3, [r4, 0x38] - b _081717AE -_08171654: - ldrh r0, [r4, 0x38] - adds r1, r0, 0x1 - strh r1, [r4, 0x38] - lsls r0, 16 - cmp r0, 0 - bge _0817166E -_08171660: - adds r0, r4, 0 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - b _081717AE -_0817166E: - movs r0, 0 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x36] - negs r0, r0 - strh r0, [r4, 0x36] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - movs r6, 0x36 - ldrsh r0, [r4, r6] - cmp r0, 0 - bge _0817169C - adds r0, r4, 0 - movs r1, 0x2 - bl ChangeSpriteAffineAnim - b _081716A4 -_0817169C: - adds r0, r4, 0 - movs r1, 0x1 - bl ChangeSpriteAffineAnim -_081716A4: - ldr r1, =gBattleSpritesDataPtr - ldr r5, [r1] - ldr r2, [r5, 0x8] - ldrh r3, [r2, 0xC] - movs r6, 0xC - ldrsh r0, [r2, r6] - adds r6, r1, 0 - cmp r0, 0xFF - ble _081716CC - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - ldr r1, [r5, 0x8] - ldrb r0, [r1, 0xC] - strh r0, [r1, 0xC] - b _081716D2 - .pool -_081716CC: - adds r0, r3, 0 - adds r0, 0xB0 - strh r0, [r2, 0xC] -_081716D2: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - movs r3, 0 - strh r0, [r4, 0x38] - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x38] - adds r0, 0x4 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x8 - bls _081717AE - ldr r0, [r6] - ldr r0, [r0, 0x8] - strh r3, [r0, 0xC] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - strh r3, [r4, 0x38] - ldrh r0, [r4, 0x36] - negs r0, r0 - strh r0, [r4, 0x36] - b _081717AE -_08171708: - movs r6, 0x80 - lsls r6, 1 - adds r0, r6, 0 - ldrh r1, [r4, 0x34] - adds r0, r1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r1, r0, 24 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrb r0, [r0, 0x8] - cmp r1, r0 - bne _08171740 - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_81717B4 - str r0, [r4, 0x1C] - b _081717AE - .pool -_08171740: - cmp r0, 0x4 - bne _08171754 - cmp r1, 0x3 - bne _08171754 - ldr r0, =sub_81717D8 - str r0, [r4, 0x1C] - b _0817175A - .pool -_08171754: - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] -_0817175A: - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - b _081717AE -_08171768: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _081717AE - movs r0, 0 - strh r0, [r4, 0x38] - ldrh r1, [r4, 0x34] - ldr r0, =0xffffff00 - ands r0, r1 - strh r0, [r4, 0x34] - adds r0, r4, 0 - movs r1, 0x3 - bl StartSpriteAffineAnim - movs r6, 0x36 - ldrsh r0, [r4, r6] - cmp r0, 0 - bge _081717A0 - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAffineAnim - b _081717A8 - .pool -_081717A0: - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim -_081717A8: - movs r0, 0x17 - bl PlaySE -_081717AE: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8171520 - - thumb_func_start sub_81717B4 -sub_81717B4: @ 81717B4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x38] - adds r0, 0x1 - strh r0, [r1, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1F - bne _081717CE - movs r0, 0 - strh r0, [r1, 0x38] - ldr r0, =sub_8171AE4 - str r0, [r1, 0x1C] -_081717CE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81717B4 - - thumb_func_start sub_81717D8 -sub_81717D8: @ 81717D8 - adds r3, r0, 0 - adds r3, 0x2C - ldrb r1, [r3] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r3] - ldr r1, =sub_81717F8 - str r1, [r0, 0x1C] - movs r1, 0 - strh r1, [r0, 0x34] - strh r1, [r0, 0x36] - strh r1, [r0, 0x38] - bx lr - .pool - thumb_func_end sub_81717D8 - - thumb_func_start sub_81717F8 -sub_81717F8: @ 81717F8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r6, r0, 0 - ldr r7, =gBattleAnimTarget - ldrh r0, [r6, 0x36] - adds r0, 0x1 - movs r1, 0 - mov r8, r1 - strh r0, [r6, 0x36] - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0x28 - bne _0817183C - movs r0, 0xFE - bl PlaySE - ldrb r1, [r6, 0x5] - lsrs r1, 4 - movs r0, 0x80 - lsls r0, 9 - lsls r0, r1 - movs r1, 0x6 - movs r2, 0 - bl BlendPalettes - adds r0, r6, 0 - bl sub_81719EC - b _081718BC - .pool -_0817183C: - cmp r1, 0x3C - bne _0817185A - ldrb r1, [r6, 0x5] - lsrs r1, 4 - movs r0, 0x80 - lsls r0, 9 - lsls r0, r1 - mov r1, r8 - str r1, [sp] - movs r1, 0x2 - movs r2, 0x6 - movs r3, 0 - bl BeginNormalPaletteFade - b _081718BC -_0817185A: - cmp r1, 0x5F - bne _08171880 - ldr r0, =gDoingBattleAnim - movs r1, 0 - strb r1, [r0] - movs r0, 0x1 - bl UpdateOamPriorityInAllHealthboxes - bl m4aMPlayAllStop - ldr r0, =0x00000213 - bl PlaySE - b _081718BC - .pool -_08171880: - ldr r0, =0x0000013b - cmp r1, r0 - bne _081718BC - ldr r5, =gSprites - ldr r4, =gBattlerSpriteIds - ldrb r0, [r7] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r7] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - mov r0, r8 - strh r0, [r6, 0x2E] - ldr r0, =sub_81718D8 - str r0, [r6, 0x1C] -_081718BC: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81717F8 - - thumb_func_start sub_81718D8 -sub_81718D8: @ 81718D8 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08171944 - cmp r0, 0x1 - bgt _081718F0 - cmp r0, 0 - beq _081718F6 - b _0817198A -_081718F0: - cmp r0, 0x2 - beq _08171976 - b _0817198A -_081718F6: - strh r0, [r4, 0x30] - strh r0, [r4, 0x32] - ldrb r1, [r4, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4, 0x1] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0x10 - bl SetGpuReg - ldr r0, [r4, 0x14] - ldrh r0, [r0, 0x2] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x10 - movs r1, 0x1 - lsls r1, r0 - ldr r0, =0x00007fff - str r0, [sp] - adds r0, r1, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _08171982 - .pool -_08171944: - ldrh r0, [r4, 0x30] - adds r1, r0, 0x1 - strh r1, [r4, 0x30] - lsls r0, 16 - cmp r0, 0 - ble _081719B0 - movs r0, 0 - strh r0, [r4, 0x30] - ldrh r2, [r4, 0x32] - adds r2, 0x1 - strh r2, [r4, 0x32] - lsls r1, r2, 8 - movs r0, 0x10 - subs r0, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _081719B0 - b _08171982 -_08171976: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_08171982: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _081719B0 -_0817198A: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _081719B0 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - strh r5, [r4, 0x2E] - ldr r0, =sub_81719C0 - str r0, [r4, 0x1C] -_081719B0: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81718D8 - - thumb_func_start sub_81719C0 -sub_81719C0: @ 81719C0 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _081719D8 - ldr r0, =0x0000ffff - strh r0, [r4, 0x2E] - b _081719E4 - .pool -_081719D8: - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite -_081719E4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81719C0 - - thumb_func_start sub_81719EC -sub_81719EC: @ 81719EC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r6, r0, 0 - adds r1, r6, 0 - adds r1, 0x43 - ldrb r0, [r1] - cmp r0, 0 - beq _08171A0C - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - b _08171A14 -_08171A0C: - movs r0, 0 - mov r8, r0 - movs r0, 0x1 - strb r0, [r1] -_08171A14: - movs r0, 0x4 - bl sub_8171D60 - movs r7, 0 - ldr r2, =gSprites - mov r9, r2 - movs r0, 0x1C - add r0, r9 - mov r10, r0 -_08171A26: - movs r2, 0x20 - ldrsh r1, [r6, r2] - movs r0, 0x22 - ldrsh r2, [r6, r0] - ldr r0, =gUnknown_085E5250 - mov r3, r8 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08171A82 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - mov r2, r9 - adds r5, r4, r2 - movs r0, 0x18 - strh r0, [r5, 0x2E] - ldr r0, =gUnknown_085E5088 - lsls r1, r7, 2 - adds r1, r0 - movs r0, 0 - ldrsb r0, [r1, r0] - ldrh r2, [r6, 0x20] - adds r0, r2 - strh r0, [r5, 0x32] - movs r0, 0x1 - ldrsb r0, [r1, r0] - ldrh r2, [r6, 0x22] - adds r0, r2 - strh r0, [r5, 0x36] - movs r0, 0x2 - ldrsb r0, [r1, r0] - strh r0, [r5, 0x38] - adds r0, r5, 0 - bl InitAnimArcTranslation - add r4, r10 - ldr r0, =sub_8171AAC - str r0, [r4] - ldr r0, =gUnknown_085E51B4 - ldrb r1, [r0, 0x4] - adds r0, r5, 0 - bl StartSpriteAnim -_08171A82: - adds r7, 0x1 - cmp r7, 0x2 - bls _08171A26 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81719EC - - thumb_func_start sub_8171AAC -sub_8171AAC: @ 8171AAC - push {r4,lr} - adds r4, r0, 0 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsrs r1, r2, 2 - movs r0, 0x1 - eors r1, r0 - ands r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _08171ADC - adds r0, r4, 0 - bl DestroySprite -_08171ADC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8171AAC - - thumb_func_start sub_8171AE4 -sub_8171AE4: @ 8171AE4 - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAffineAnim - ldr r0, =sub_8171BAC - str r0, [r4, 0x1C] - ldr r0, =gLastUsedItem - ldrh r0, [r0] - bl ItemIdToBallId - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xB - bgt _08171B36 - cmp r5, 0 - blt _08171B36 - ldrh r0, [r4, 0x20] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x22] - subs r1, 0x5 - lsls r1, 24 - lsrs r1, 24 - str r5, [sp] - movs r2, 0x1 - movs r3, 0x1C - bl LaunchBallStarsTask - ldr r0, =gBattleAnimTarget - ldrb r1, [r0] - movs r0, 0x1 - movs r2, 0xE - adds r3, r5, 0 - bl LaunchBallFadeMonTask -_08171B36: - ldr r6, =gSprites - ldr r5, =gBattlerSpriteIds - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x1 - bl StartSpriteAffineAnim - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl AnimateSprite - ldrb r0, [r4] - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x80 - lsls r1, 5 - strh r1, [r0, 0x30] - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171AE4 - - thumb_func_start sub_8171BAC -sub_8171BAC: @ 8171BAC - push {r4-r7,lr} - adds r7, r0, 0 - movs r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08171BCA - adds r2, r7, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_08171BCA: - ldr r4, =gSprites - ldr r3, =gBattlerSpriteIds - ldr r2, =gBattleAnimTarget - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 26 - cmp r0, 0 - bge _08171C04 - adds r0, r1, 0 - movs r1, 0 - bl StartSpriteAffineAnim - movs r5, 0x1 - b _08171C24 - .pool -_08171C04: - ldr r6, =0xfffffee0 - adds r0, r6, 0 - ldrh r6, [r1, 0x30] - adds r0, r6 - strh r0, [r1, 0x30] - ldrb r0, [r2] - adds r0, r3 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 24 - strh r0, [r1, 0x26] -_08171C24: - adds r0, r7, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08171C8A - cmp r5, 0 - beq _08171C8A - ldr r4, =gSprites - ldr r3, =gBattlerSpriteIds - ldr r2, =gBattleAnimTarget - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r6, 0 - movs r5, 0 - strh r5, [r0, 0x26] - ldrb r0, [r2] - adds r0, r3 - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrb r1, [r0, 0x9] - lsls r1, 30 - adds r2, 0x3E - lsrs r1, 31 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - strh r5, [r7, 0x2E] - ldr r0, =sub_81719C0 - str r0, [r7, 0x1C] - ldr r0, =gDoingBattleAnim - strb r6, [r0] - movs r0, 0x1 - bl UpdateOamPriorityInAllHealthboxes -_08171C8A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171BAC - - thumb_func_start sub_8171CAC -sub_8171CAC: @ 8171CAC - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x24] - ldrh r1, [r2, 0x20] - adds r0, r1 - movs r1, 0 - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x26] - ldrh r3, [r2, 0x22] - adds r0, r3 - strh r0, [r2, 0x22] - strh r1, [r2, 0x26] - strh r1, [r2, 0x24] - ldr r4, =sub_8171CE8 - movs r3, 0 - movs r1, 0x5 - adds r0, r2, 0 - adds r0, 0x38 -_08171CD0: - strh r3, [r0] - subs r0, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _08171CD0 - str r4, [r2, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171CAC - - thumb_func_start sub_8171CE8 -sub_8171CE8: @ 8171CE8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 4 - adds r2, r0, 0 - ldrh r1, [r4, 0x2E] - adds r2, r1 - movs r0, 0xD0 - lsls r0, 3 - adds r3, r0, 0 - ldrh r1, [r4, 0x30] - adds r3, r1 - lsls r1, r3, 16 - asrs r1, 24 - ldrh r0, [r4, 0x24] - subs r0, r1 - strh r0, [r4, 0x24] - lsls r0, r2, 16 - asrs r0, 24 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - movs r0, 0xFF - ands r2, r0 - strh r2, [r4, 0x2E] - ands r3, r0 - strh r3, [r4, 0x30] - movs r2, 0x22 - ldrsh r0, [r4, r2] - movs r2, 0x26 - ldrsh r1, [r4, r2] - adds r0, r1 - cmp r0, 0xA0 - bgt _08171D3E - movs r1, 0x20 - ldrsh r0, [r4, r1] - movs r2, 0x24 - ldrsh r1, [r4, r2] - adds r0, r1 - movs r1, 0x8 - negs r1, r1 - cmp r0, r1 - bge _08171D52 -_08171D3E: - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, =sub_81719C0 - str r0, [r4, 0x1C] - ldr r1, =gDoingBattleAnim - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - bl UpdateOamPriorityInAllHealthboxes -_08171D52: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171CE8 - - thumb_func_start sub_8171D60 -sub_8171D60: @ 8171D60 - push {r4,r5,lr} - lsls r0, 24 - ldr r1, =gUnknown_085E5094 - lsrs r5, r0, 21 - adds r4, r5, r1 - ldrh r0, [r4, 0x6] - bl GetSpriteTileStartByTag - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - bne _08171D86 - adds r0, r4, 0 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gUnknown_085E50F4 - adds r0, r5, r0 - bl LoadCompressedObjectPaletteUsingHeap -_08171D86: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171D60 - - thumb_func_start LaunchBallStarsTask -LaunchBallStarsTask: @ 8171D98 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r6, r0, 0 - mov r8, r1 - mov r9, r2 - mov r10, r3 - ldr r5, [sp, 0x1C] - lsls r6, 24 - lsrs r6, 24 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r1, r9 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - mov r0, r10 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r5, 0 - bl sub_8171D60 - ldr r1, =gUnknown_085E51C0 - lsls r0, r5, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x5 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - strh r6, [r0, 0xA] - mov r1, r8 - strh r1, [r0, 0xC] - mov r1, r9 - strh r1, [r0, 0xE] - mov r1, r10 - strh r1, [r0, 0x10] - strh r5, [r0, 0x26] - movs r0, 0xF - bl PlaySE - adds r0, r4, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end LaunchBallStarsTask - - thumb_func_start sub_8171E20 -sub_8171E20: @ 8171E20 - push {lr} - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08171E3E - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x8] - ldrb r0, [r1, 0xA] - adds r0, 0x1 - strb r0, [r1, 0xA] -_08171E3E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171E20 - - thumb_func_start sub_8171E50 -sub_8171E50: @ 8171E50 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r6, r0, r1 - ldrh r0, [r6, 0x26] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r2, 0x8 - ldrsh r0, [r6, r2] - adds r2, r1, 0 - cmp r0, 0xF - bgt _08171F48 - ldrb r1, [r6, 0xA] - ldrb r2, [r6, 0xC] - ldrb r4, [r6, 0xE] - mov r9, r4 - ldrb r3, [r6, 0x10] - ldr r4, [sp] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - ldr r4, =gUnknown_085E51F0 - adds r0, r4 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0x40 - beq _08171EEC - bl sub_8171E20 - mov r0, r10 - lsls r4, r0, 4 - add r4, r10 - lsls r4, 2 - ldr r5, =gSprites - adds r7, r4, r5 - ldr r0, =gUnknown_085E51B4 - ldr r1, [sp] - adds r0, r1, r0 - ldrb r1, [r0] - adds r0, r7, 0 - bl StartSpriteAnim - adds r5, 0x1C - adds r4, r5 - ldr r0, =sub_8171F68 - str r0, [r4] - movs r0, 0x3 - mov r2, r9 - ands r2, r0 - lsls r2, 2 - ldrb r1, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - orrs r0, r2 - strb r0, [r7, 0x5] - ldrb r0, [r6, 0x8] - cmp r0, 0x7 - bls _08171EE8 - subs r0, 0x8 - lsls r0, 24 - lsrs r0, 24 -_08171EE8: - lsls r0, 5 - strh r0, [r7, 0x2E] -_08171EEC: - ldr r0, =gTasks - mov r4, r8 - lsls r1, r4, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r2, 0x8 - ldrsh r1, [r1, r2] - adds r2, r0, 0 - cmp r1, 0xF - bne _08171F48 - ldr r0, =gMain - ldr r4, =0x00000439 - adds r0, r4 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08171F22 - ldr r0, =gSprites - mov r2, r10 - lsls r1, r2, 4 - add r1, r10 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_08171F22: - mov r0, r8 - bl DestroyTask - b _08171F58 - .pool -_08171F48: - mov r4, r8 - lsls r0, r4, 2 - add r0, r8 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] -_08171F58: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8171E50 - - thumb_func_start sub_8171F68 -sub_8171F68: @ 8171F68 - push {lr} - adds r1, r0, 0 - ldrh r2, [r1, 0x30] - movs r3, 0x30 - ldrsh r0, [r1, r3] - cmp r0, 0 - bne _08171F80 - ldr r0, =sub_8171F88 - str r0, [r1, 0x1C] - b _08171F84 - .pool -_08171F80: - subs r0, r2, 0x1 - strh r0, [r1, 0x30] -_08171F84: - pop {r0} - bx r0 - thumb_func_end sub_8171F68 - - thumb_func_start sub_8171F88 -sub_8171F88: @ 8171F88 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0x2 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x32 - bne _08171FBC - adds r0, r4, 0 - bl sub_8172944 -_08171FBC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8171F88 - - thumb_func_start sub_8171FC4 -sub_8171FC4: @ 8171FC4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r0, =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrb r3, [r1, 0xA] - str r3, [sp] - ldrb r0, [r1, 0xC] - str r0, [sp, 0x4] - ldrb r2, [r1, 0xE] - str r2, [sp, 0x8] - ldrb r1, [r1, 0x10] - str r1, [sp, 0xC] - movs r7, 0 - ldr r3, =gSprites - mov r10, r3 - mov r1, r8 - lsls r0, r1, 1 - add r0, r8 - lsls r0, 3 - str r0, [sp, 0x10] -_0817200A: - ldr r0, =gUnknown_085E51F0 - ldr r2, [sp, 0x10] - adds r0, r2, r0 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _0817206A - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - mov r3, r10 - adds r5, r4, r3 - ldr r0, =gUnknown_085E51B4 - add r0, r8 - ldrb r1, [r0] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r0, =sub_8172508 - str r0, [r4] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r0, r7, 5 - strh r0, [r5, 0x2E] - movs r0, 0xA - strh r0, [r5, 0x36] - movs r0, 0x2 - strh r0, [r5, 0x38] - movs r0, 0x1 - strh r0, [r5, 0x3A] -_0817206A: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x7 - bls _0817200A - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08172092 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_08172092: - mov r0, r9 - bl DestroyTask - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8171FC4 - - thumb_func_start sub_81720C8 -sub_81720C8: @ 81720C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r0, =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrb r3, [r1, 0xA] - str r3, [sp] - ldrb r0, [r1, 0xC] - str r0, [sp, 0x4] - ldrb r2, [r1, 0xE] - str r2, [sp, 0x8] - ldrb r1, [r1, 0x10] - str r1, [sp, 0xC] - movs r7, 0 - ldr r3, =gSprites - mov r10, r3 - mov r1, r8 - lsls r0, r1, 1 - add r0, r8 - lsls r0, 3 - str r0, [sp, 0x10] -_0817210E: - ldr r0, =gUnknown_085E51F0 - ldr r2, [sp, 0x10] - adds r0, r2, r0 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _0817216E - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - mov r3, r10 - adds r5, r4, r3 - ldr r0, =gUnknown_085E51B4 - add r0, r8 - ldrb r1, [r0] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r0, =sub_8172508 - str r0, [r4] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r0, r7, 5 - strh r0, [r5, 0x2E] - movs r0, 0xA - strh r0, [r5, 0x36] - movs r0, 0x1 - strh r0, [r5, 0x38] - movs r0, 0x2 - strh r0, [r5, 0x3A] -_0817216E: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x7 - bls _0817210E - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08172196 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_08172196: - mov r0, r9 - bl DestroyTask - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81720C8 - - thumb_func_start sub_81721CC -sub_81721CC: @ 81721CC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r7, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - str r0, [sp, 0x10] - ldr r3, =gSprites - mov r8, r3 - ldr r0, =gUnknown_085E51B4 - adds r1, r0 - mov r10, r1 -_08172212: - ldr r0, =gUnknown_085E51F0 - ldr r1, [sp, 0x10] - adds r0, r1, r0 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _0817226E - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - mov r2, r8 - adds r5, r4, r2 - mov r3, r10 - ldrb r1, [r3] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r0, =sub_8172508 - str r0, [r4] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r0, r7, 5 - strh r0, [r5, 0x2E] - movs r0, 0x4 - strh r0, [r5, 0x36] - movs r0, 0x1 - strh r0, [r5, 0x38] - strh r0, [r5, 0x3A] -_0817226E: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x7 - bls _08172212 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08172296 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_08172296: - mov r0, r9 - bl DestroyTask - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81721CC - - thumb_func_start sub_81722CC -sub_81722CC: @ 81722CC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r0, =gTasks - mov r2, r9 - lsls r1, r2, 2 - add r1, r9 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrb r3, [r1, 0xA] - str r3, [sp] - ldrb r0, [r1, 0xC] - str r0, [sp, 0x4] - ldrb r2, [r1, 0xE] - str r2, [sp, 0x8] - ldrb r1, [r1, 0x10] - str r1, [sp, 0xC] - movs r7, 0 - ldr r3, =gSprites - mov r10, r3 - mov r1, r8 - lsls r0, r1, 1 - add r0, r8 - lsls r0, 3 - str r0, [sp, 0x10] -_08172312: - ldr r0, =gUnknown_085E51F0 - ldr r2, [sp, 0x10] - adds r0, r2, r0 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _08172376 - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - mov r3, r10 - adds r5, r4, r3 - ldr r0, =gUnknown_085E51B4 - add r0, r8 - ldrb r1, [r0] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r0, =sub_8172508 - str r0, [r4] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 3 - adds r0, r7 - strh r0, [r5, 0x2E] - movs r0, 0x5 - strh r0, [r5, 0x36] - movs r0, 0x1 - strh r0, [r5, 0x38] - strh r0, [r5, 0x3A] -_08172376: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x9 - bls _08172312 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0817239E - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_0817239E: - mov r0, r9 - bl DestroyTask - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81722CC - - thumb_func_start sub_81723D4 -sub_81723D4: @ 81723D4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r2, r0, 2 - adds r0, r2, r0 - lsls r0, 3 - adds r3, r0, r1 - ldrh r1, [r3, 0x16] - movs r4, 0x16 - ldrsh r0, [r3, r4] - cmp r0, 0 - beq _08172404 - subs r0, r1, 0x1 - strh r0, [r3, 0x16] - b _081724D6 - .pool -_08172404: - ldrh r0, [r3, 0x26] - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r3, 0xA] - str r1, [sp] - ldrb r4, [r3, 0xC] - str r4, [sp, 0x4] - ldrb r1, [r3, 0xE] - str r1, [sp, 0x8] - ldrb r3, [r3, 0x10] - str r3, [sp, 0xC] - movs r7, 0 - str r2, [sp, 0x14] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - str r1, [sp, 0x10] - ldr r3, =gSprites - mov r9, r3 - ldr r1, =gUnknown_085E51B4 - adds r0, r1 - mov r10, r0 -_08172430: - ldr r0, =gUnknown_085E51F0 - ldr r4, [sp, 0x10] - adds r0, r4, r0 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _0817248C - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - mov r0, r9 - adds r5, r4, r0 - mov r3, r10 - ldrb r1, [r3] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r0, =sub_8172508 - str r0, [r4] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r0, r7, 5 - strh r0, [r5, 0x2E] - movs r0, 0x8 - strh r0, [r5, 0x36] - movs r0, 0x2 - strh r0, [r5, 0x38] - strh r0, [r5, 0x3A] -_0817248C: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x7 - bls _08172430 - ldr r0, =gTasks - ldr r1, [sp, 0x14] - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x8 - strh r0, [r1, 0x16] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0x2 - bne _081724D6 - ldr r0, =gMain - ldr r4, =0x00000439 - adds r0, r4 - ldrb r1, [r0] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _081724D0 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_081724D0: - mov r0, r8 - bl DestroyTask -_081724D6: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81723D4 - - thumb_func_start sub_8172508 -sub_8172508: @ 8172508 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r2, 0x32 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x2E] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x38] - ldrh r2, [r4, 0x30] - adds r0, r2 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x34] - adds r0, 0x1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x33 - bne _08172558 - adds r0, r4, 0 - bl sub_8172944 -_08172558: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8172508 - - thumb_func_start sub_8172560 -sub_8172560: @ 8172560 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r7, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - str r0, [sp, 0x10] - ldr r3, =gSprites - mov r8, r3 - ldr r0, =gUnknown_085E51B4 - adds r1, r0 - mov r10, r1 -_081725A6: - ldr r0, =gUnknown_085E51F0 - ldr r1, [sp, 0x10] - adds r0, r1, r0 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _081725FE - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - mov r2, r8 - adds r5, r4, r2 - mov r3, r10 - ldrb r1, [r3] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r0, =sub_817265C - str r0, [r4] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 2 - adds r0, r7 - strh r0, [r5, 0x2E] -_081725FE: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0xB - bls _081725A6 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08172626 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_08172626: - mov r0, r9 - bl DestroyTask - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172560 - - thumb_func_start sub_817265C -sub_817265C: @ 817265C - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - movs r2, 0x30 - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r5, 0x24] - movs r0, 0x2E - ldrsh r4, [r5, r0] - movs r2, 0x32 - ldrsh r1, [r5, r2] - adds r0, r4, 0 - bl Sin - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl Cos - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x2E] - adds r0, 0x6 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x33 - bne _081726B4 - adds r0, r5, 0 - bl sub_8172944 -_081726B4: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817265C - - thumb_func_start sub_81726BC -sub_81726BC: @ 81726BC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - ldr r0, =gTasks - ldr r2, [sp] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldrb r3, [r1, 0xA] - str r3, [sp, 0x4] - ldrb r0, [r1, 0xC] - str r0, [sp, 0x8] - ldrb r2, [r1, 0xE] - str r2, [sp, 0xC] - ldrb r1, [r1, 0x10] - str r1, [sp, 0x10] - movs r3, 0 - mov r8, r3 - mov r1, r9 - lsls r0, r1, 1 - add r0, r9 - lsls r0, 3 - str r0, [sp, 0x14] -_08172700: - movs r7, 0 - movs r2, 0x1 - add r2, r8 - mov r10, r2 -_08172708: - ldr r0, =gUnknown_085E51F0 - ldr r3, [sp, 0x14] - adds r0, r3, r0 - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - ldr r3, [sp, 0x10] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _08172790 - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - ldr r0, =gSprites - adds r5, r4, r0 - ldr r0, =gUnknown_085E51B4 - add r0, r9 - ldrb r1, [r0] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r1, =gSprites + 0x1C - adds r4, r1 - ldr r0, =sub_8172508 - str r0, [r4] - movs r0, 0x3 - ldr r1, [sp, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r2, r3, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x5] - lsls r0, r7, 5 - strh r0, [r5, 0x2E] - movs r0, 0x8 - strh r0, [r5, 0x36] - mov r0, r8 - cmp r0, 0 - bne _08172788 - movs r0, 0x2 - strh r0, [r5, 0x38] - movs r0, 0x1 - b _0817278E - .pool -_08172788: - movs r0, 0x1 - strh r0, [r5, 0x38] - movs r0, 0x2 -_0817278E: - strh r0, [r5, 0x3A] -_08172790: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x7 - bls _08172708 - mov r1, r10 - lsls r0, r1, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x1 - bls _08172700 - ldr r0, =gMain - ldr r2, =0x00000439 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _081727C4 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_081727C4: - ldr r0, [sp] - bl DestroyTask - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81726BC - - thumb_func_start sub_81727E8 -sub_81727E8: @ 81727E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x26] - lsls r1, 24 - lsrs r1, 24 - ldrb r2, [r0, 0xA] - str r2, [sp] - ldrb r3, [r0, 0xC] - str r3, [sp, 0x4] - ldrb r2, [r0, 0xE] - str r2, [sp, 0x8] - ldrb r0, [r0, 0x10] - str r0, [sp, 0xC] - movs r7, 0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - str r0, [sp, 0x10] - ldr r3, =gSprites - mov r8, r3 - ldr r0, =gUnknown_085E51B4 - adds r1, r0 - mov r10, r1 -_0817282E: - ldr r0, =gUnknown_085E51F0 - ldr r1, [sp, 0x10] - adds r0, r1, r0 - ldr r1, [sp] - ldr r2, [sp, 0x4] - ldr r3, [sp, 0xC] - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x40 - beq _08172880 - bl sub_8171E20 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - mov r2, r8 - adds r5, r4, r2 - mov r3, r10 - ldrb r1, [r3] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r0, =sub_81728E0 - str r0, [r4] - movs r0, 0x3 - ldr r2, [sp, 0x8] - ands r2, r0 - lsls r2, 2 - ldrb r0, [r5, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] - lsls r0, r7, 5 - strh r0, [r5, 0x2E] -_08172880: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x7 - bls _0817282E - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _081728A8 - ldr r0, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x3C] -_081728A8: - mov r0, r9 - bl DestroyTask - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81727E8 - - thumb_func_start sub_81728E0 -sub_81728E0: @ 81728E0 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - movs r2, 0x30 - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r5, 0x24] - movs r0, 0x2E - ldrsh r4, [r5, r0] - ldrh r1, [r5, 0x2E] - movs r0, 0x3F - ands r0, r1 - movs r2, 0x32 - ldrsh r1, [r5, r2] - bl Sin - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl Cos - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x2E] - adds r0, 0xA - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x33 - bne _0817293C - adds r0, r5, 0 - bl sub_8172944 -_0817293C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81728E0 - - thumb_func_start sub_8172944 -sub_8172944: @ 8172944 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08172970 - movs r1, 0x3C - ldrsh r0, [r7, r1] - cmp r0, 0x1 - bne _081729CA - adds r0, r7, 0 - bl DestroySpriteAndFreeResources - b _081729E2 - .pool -_08172970: - ldr r2, =gBattleSpritesDataPtr - ldr r0, [r2] - ldr r1, [r0, 0x8] - ldrb r0, [r1, 0xA] - subs r0, 0x1 - strb r0, [r1, 0xA] - ldr r0, [r2] - ldr r0, [r0, 0x8] - ldrb r0, [r0, 0xA] - cmp r0, 0 - bne _081729DC - movs r4, 0 - ldr r5, =gUnknown_085E51C0 - b _08172998 - .pool -_08172994: - adds r5, 0x4 - adds r4, 0x1 -_08172998: - cmp r4, 0xB - bgt _081729AA - ldr r0, [r5] - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08172994 -_081729AA: - cmp r4, 0xC - bne _081729CA - movs r6, 0 - ldr r5, =gUnknown_085E5094 - ldr r4, =gUnknown_085E50F4 -_081729B4: - ldrh r0, [r5, 0x6] - bl FreeSpriteTilesByTag - ldrh r0, [r4, 0x4] - bl FreeSpritePaletteByTag - adds r5, 0x8 - adds r4, 0x8 - adds r6, 0x1 - cmp r6, 0xB - ble _081729B4 -_081729CA: - adds r0, r7, 0 - bl DestroySprite - b _081729E2 - .pool -_081729DC: - adds r0, r7, 0 - bl DestroySprite -_081729E2: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8172944 - - thumb_func_start LaunchBallFadeMonTask -LaunchBallFadeMonTask: @ 81729E8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r4, r0, 0 - mov r9, r2 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r3, 24 - lsrs r7, r3, 24 - ldr r0, =sub_8172AB0 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r5, r0, r1 - strh r7, [r5, 0x26] - strh r6, [r5, 0xE] - mov r0, r9 - strh r0, [r5, 0x1C] - mov r1, r9 - lsrs r0, r1, 16 - strh r0, [r5, 0x1E] - cmp r4, 0 - bne _08172A58 - lsls r0, r6, 20 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r0, 16 - ldr r2, =gUnknown_085E5310 - lsls r1, r7, 1 - adds r1, r2 - ldrh r3, [r1] - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - movs r0, 0x1 - strh r0, [r5, 0xA] - b _08172A7E - .pool -_08172A58: - lsls r0, r6, 20 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r0, 16 - ldr r2, =gUnknown_085E5310 - lsls r1, r7, 1 - adds r1, r2 - ldrh r3, [r1] - movs r1, 0x10 - movs r2, 0x10 - bl BlendPalette - movs r0, 0x10 - strh r0, [r5, 0x8] - ldr r0, =0x0000ffff - strh r0, [r5, 0xA] - ldr r0, =sub_8172B40 - str r0, [r5] -_08172A7E: - ldr r0, =0x00007fff - str r0, [sp] - mov r0, r9 - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - mov r0, r8 - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end LaunchBallFadeMonTask - - thumb_func_start sub_8172AB0 -sub_8172AB0: @ 8172AB0 - push {r4,r5,lr} - sub sp, 0x4 - 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, 0x26] - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0xC - ldrsh r0, [r4, r2] - cmp r0, 0x10 - bgt _08172B08 - movs r2, 0xE - ldrsh r0, [r4, r2] - lsls r0, 20 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r0, 16 - ldrb r2, [r4, 0x8] - ldr r3, =gUnknown_085E5310 - lsls r1, 1 - adds r1, r3 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r0, r1 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - b _08172B30 - .pool -_08172B08: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08172B30 - ldrh r0, [r4, 0x1C] - ldrh r1, [r4, 0x1E] - lsls r1, 16 - orrs r0, r1 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - adds r0, r5, 0 - bl DestroyTask -_08172B30: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172AB0 - - thumb_func_start sub_8172B40 -sub_8172B40: @ 8172B40 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08172B78 - ldr r0, =gTasks - lsls r4, r2, 2 - adds r4, r2 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0x1C] - ldrh r1, [r4, 0x1E] - lsls r1, 16 - orrs r0, r1 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_8172B90 - str r0, [r4] -_08172B78: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172B40 - - thumb_func_start sub_8172B90 -sub_8172B90: @ 8172B90 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x26] - lsls r0, 24 - lsrs r1, r0, 24 - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0x10 - bgt _08172BE4 - movs r2, 0xE - ldrsh r0, [r4, r2] - lsls r0, 20 - movs r3, 0x80 - lsls r3, 17 - adds r0, r3 - lsrs r0, 16 - ldrb r2, [r4, 0x8] - ldr r3, =gUnknown_085E5310 - lsls r1, 1 - adds r1, r3 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - adds r0, r1 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - b _08172BEA - .pool -_08172BE4: - adds r0, r2, 0 - bl DestroyTask -_08172BEA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8172B90 - - thumb_func_start sub_8172BF0 -sub_8172BF0: @ 8172BF0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0 - mov r8, r0 - ldr r0, =gBattlerSpriteIds - ldr r3, =gBattleAnimAttacker - ldrb r2, [r3] - adds r0, r2, r0 - ldrb r6, [r0] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r5, r0, r1 - movs r1, 0x1C - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _08172CC8 - cmp r0, 0x1 - bgt _08172C30 - cmp r0, 0 - beq _08172C36 - b _08172D8A - .pool -_08172C30: - cmp r0, 0x2 - beq _08172CDA - b _08172D8A -_08172C36: - ldr r0, =gBattleAnimArgs - ldrh r0, [r0] - strh r0, [r5, 0x1E] - movs r2, 0xA0 - lsls r2, 3 - adds r0, r2, 0 - ldrh r4, [r5, 0x8] - adds r0, r4 - strh r0, [r5, 0x8] - ldrb r0, [r3] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08172C78 - ldr r2, =gSprites - lsls r3, r6, 4 - adds r1, r3, r6 - lsls r1, 2 - adds r1, r2 - ldrh r0, [r5, 0x8] - lsls r0, 16 - asrs r0, 24 - ldrh r4, [r1, 0x24] - adds r0, r4 - strh r0, [r1, 0x24] - adds r4, r3, 0 - b _08172C90 - .pool -_08172C78: - ldr r3, =gSprites - lsls r4, r6, 4 - adds r2, r4, r6 - lsls r2, 2 - adds r2, r3 - ldrh r1, [r5, 0x8] - lsls r1, 16 - asrs r1, 24 - ldrh r0, [r2, 0x24] - subs r0, r1 - strh r0, [r2, 0x24] - adds r2, r3, 0 -_08172C90: - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r3, r0, r1 - ldrb r0, [r3, 0x8] - strh r0, [r3, 0x8] - adds r0, r4, r6 - lsls r0, 2 - adds r0, r2 - movs r2, 0x20 - ldrsh r1, [r0, r2] - movs r4, 0x24 - ldrsh r0, [r0, r4] - adds r1, r0 - adds r1, 0x20 - movs r0, 0x98 - lsls r0, 1 - cmp r1, r0 - bls _08172D8A - ldrh r0, [r3, 0x1C] - adds r0, 0x1 - strh r0, [r3, 0x1C] - b _08172D8A - .pool -_08172CC8: - ldrb r1, [r5, 0x1E] - adds r0, r2, 0 - adds r2, r6, 0 - bl LoadBattleMonGfxAndAnimate - ldrh r0, [r5, 0x1C] - adds r0, 0x1 - strh r0, [r5, 0x1C] - b _08172D8A -_08172CDA: - movs r1, 0xA0 - lsls r1, 3 - adds r0, r1, 0 - ldrh r2, [r5, 0x8] - adds r0, r2 - strh r0, [r5, 0x8] - ldrb r0, [r3] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08172D10 - ldr r0, =gSprites - lsls r3, r6, 4 - adds r2, r3, r6 - lsls r2, 2 - adds r2, r0 - ldrh r1, [r5, 0x8] - lsls r1, 16 - asrs r1, 24 - ldrh r0, [r2, 0x24] - subs r0, r1 - strh r0, [r2, 0x24] - adds r4, r3, 0 - b _08172D28 - .pool -_08172D10: - ldr r0, =gSprites - lsls r2, r6, 4 - adds r1, r2, r6 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r5, 0x8] - lsls r0, 16 - asrs r0, 24 - ldrh r3, [r1, 0x24] - adds r0, r3 - strh r0, [r1, 0x24] - adds r4, r2, 0 -_08172D28: - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrb r1, [r0, 0x8] - strh r1, [r0, 0x8] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _08172D68 - ldr r0, =gSprites - adds r1, r4, r6 - lsls r1, 2 - adds r1, r0 - movs r4, 0x24 - ldrsh r0, [r1, r4] - cmp r0, 0 - bgt _08172D7E - movs r0, 0 - strh r0, [r1, 0x24] - b _08172D84 - .pool -_08172D68: - ldr r0, =gSprites - adds r1, r4, r6 - lsls r1, 2 - adds r1, r0 - movs r3, 0x24 - ldrsh r0, [r1, r3] - cmp r0, 0 - blt _08172D7E - strh r2, [r1, 0x24] - movs r4, 0x1 - mov r8, r4 -_08172D7E: - mov r0, r8 - cmp r0, 0 - beq _08172D8A -_08172D84: - adds r0, r7, 0 - bl DestroyAnimVisualTask -_08172D8A: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172BF0 - - thumb_func_start sub_8172D98 -sub_8172D98: @ 8172D98 - 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 - movs r1, 0x26 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08172E14 - cmp r0, 0x1 - bgt _08172DC0 - cmp r0, 0 - beq _08172DC6 - b _08172E84 - .pool -_08172DC0: - cmp r0, 0x2 - beq _08172E4E - b _08172E84 -_08172DC6: - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl sub_80A8364 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08172DE8 - ldr r1, =0x00003f42 - movs r0, 0x50 - bl SetGpuReg - b _08172DF0 - .pool -_08172DE8: - ldr r1, =0x00003f44 - movs r0, 0x50 - bl SetGpuReg -_08172DF0: - movs r0, 0x52 - movs r1, 0x10 - bl SetGpuReg - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _08172E84 - .pool -_08172E14: - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08172E84 - movs r0, 0 - strh r0, [r4, 0xA] - ldrh r2, [r4, 0x8] - adds r2, 0x1 - strh r2, [r4, 0x8] - lsls r1, r2, 8 - movs r0, 0x10 - subs r0, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _08172E84 - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - b _08172E84 -_08172E4E: - ldr r1, =gBattlerSpriteIds - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - adds r0, r1 - ldrb r1, [r0] - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x4] - lsls r1, 22 - lsrs r1, 17 - ldr r0, =0x06010000 - adds r1, r0 - movs r2, 0x80 - lsls r2, 4 - movs r0, 0 - movs r3, 0x1 - bl RequestDma3Fill - ldrb r0, [r4] - bl ClearBehindSubstituteBit - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08172E84: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172D98 - - thumb_func_start sub_8172E9C -sub_8172E9C: @ 8172E9C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gBattleAnimArgs - ldr r1, =gBattleSpritesDataPtr - ldr r2, [r1] - ldr r1, =gBattleAnimAttacker - ldrb r1, [r1] - ldr r2, [r2] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - lsls r1, 29 - lsrs r1, 31 - strh r1, [r3, 0xE] - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172E9C - - thumb_func_start sub_8172ED0 -sub_8172ED0: @ 8172ED0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gBattleAnimTarget - ldr r1, =gEffectBattler - ldrb r1, [r1] - strb r1, [r2] - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172ED0 - - thumb_func_start sub_8172EF0 -sub_8172EF0: @ 8172EF0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r1, 0 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0 - mov r8, r0 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - adds r5, r0, 0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r4, r0, 0 - adds r0, r6, 0 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _08172FC8 - lsrs r0, r5, 16 - ldr r7, =0x0000ffff - ands r5, r7 - eors r0, r5 - lsrs r1, r4, 16 - eors r0, r1 - ands r4, r7 - eors r0, r4 - cmp r0, 0x7 - bhi _08172F4E - movs r0, 0x1 - mov r8, r0 -_08172F4E: - mov r0, r8 - cmp r0, 0 - beq _08172FC8 - ldr r0, =0x000027f9 - bl GetSpriteTileStartByTag - lsls r0, 16 - lsrs r0, 16 - cmp r0, r7 - bne _08172F6E - ldr r0, =gBattleAnimPicTable + 0x748 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gBattleAnimPaletteTable + 0x748 - bl LoadCompressedObjectPaletteUsingHeap -_08172F6E: - ldr r5, =sub_8172FEC - adds r0, r5, 0 - movs r1, 0xA - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gTasks - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 3 - adds r2, r3 - movs r4, 0 - strh r6, [r2, 0x8] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r3 - strh r6, [r1, 0x8] - strh r4, [r2, 0xA] - movs r0, 0x1 - strh r0, [r1, 0xA] - b _08172FDE - .pool -_08172FC8: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x1] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0, 0x1] -_08172FDE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172EF0 - - thumb_func_start sub_8172FEC -sub_8172FEC: @ 8172FEC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0x22] - movs r2, 0x22 - ldrsh r0, [r4, r2] - cmp r0, 0x3B - bgt _08173018 - adds r0, r1, 0x1 - strh r0, [r4, 0x22] - b _08173190 - .pool -_08173018: - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrb r0, [r0, 0xA] - cmp r0, 0 - beq _08173026 - b _08173190 -_08173026: - ldrh r0, [r4, 0x1C] - adds r1, r0, 0x1 - strh r1, [r4, 0x1C] - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - cmp r1, 0 - beq _0817303A - b _08173190 -_0817303A: - ldrb r0, [r4, 0x8] - mov r8, r0 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0x1E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08173074 - ldr r0, =gUnknown_085CE388 - adds r1, r5, 0 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - b _081730D6 - .pool -_08173074: - cmp r0, 0 - blt _081730A8 - cmp r0, 0x3 - bgt _081730A8 - ldr r0, =gUnknown_085CE3A0 - adds r1, r5, 0 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gSprites - lsls r2, r5, 4 - adds r2, r5 - lsls r2, 2 - adds r2, r0 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x4 - b _081730C8 - .pool -_081730A8: - ldr r0, =gUnknown_085CE3A0 - adds r1, r5, 0 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gSprites - lsls r2, r5, 4 - adds r2, r5 - lsls r2, 2 - adds r2, r0 - ldrh r3, [r2, 0x4] - lsls r1, r3, 22 - lsrs r1, 22 - adds r1, 0x5 -_081730C8: - ldr r4, =0x000003ff - adds r0, r4, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r1 - strh r0, [r2, 0x4] -_081730D6: - ldr r2, =gTasks - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r6, r0, r2 - movs r2, 0xA - ldrsh r0, [r6, r2] - mov r9, r1 - cmp r0, 0 - bne _08173118 - ldr r1, =gSprites - lsls r2, r5, 4 - adds r0, r2, r5 - lsls r0, 2 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_81731FC - str r1, [r0] - adds r4, r2, 0 - b _08173160 - .pool -_08173118: - ldr r3, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =sub_8173250 - str r2, [r0] - adds r1, r3 - ldr r0, =0x0000ffe0 - strh r0, [r1, 0x24] - movs r0, 0x20 - strh r0, [r1, 0x26] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - movs r1, 0x1E - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08173160 - mov r0, r8 - bl GetBattlerSide - lsls r0, 24 - movs r1, 0x3F - cmp r0, 0 - bne _08173156 - movs r1, 0xC0 -_08173156: - lsls r1, 24 - asrs r1, 24 - movs r0, 0x66 - bl PlaySE12WithPanning -_08173160: - ldr r1, =gSprites - adds r0, r4, r5 - lsls r0, 2 - adds r0, r1 - strh r7, [r0, 0x2E] - ldr r1, =gTasks - mov r2, r9 - adds r0, r2, r7 - lsls r0, 3 - adds r1, r0, r1 - ldrh r0, [r1, 0x1E] - adds r0, 0x1 - strh r0, [r1, 0x1E] - cmp r5, 0x40 - beq _08173184 - ldrh r0, [r1, 0x20] - adds r0, 0x1 - strh r0, [r1, 0x20] -_08173184: - movs r4, 0x1E - ldrsh r0, [r1, r4] - cmp r0, 0x5 - bne _08173190 - ldr r0, =sub_81731B0 - str r0, [r1] -_08173190: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8172FEC - - thumb_func_start sub_81731B0 -sub_81731B0: @ 81731B0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r3, r0, 0 - ldr r1, =gTasks - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - adds r1, r0, r1 - movs r2, 0x20 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _081731F0 - movs r2, 0xA - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _081731EA - ldrb r1, [r1, 0x8] - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r2, [r0, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0, 0x1] -_081731EA: - adds r0, r3, 0 - bl DestroyTask -_081731F0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81731B0 - - thumb_func_start sub_81731FC -sub_81731FC: @ 81731FC - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x18 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x18 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0xC - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _08173246 - ldr r2, =gTasks - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x20] - subs r1, 0x1 - strh r1, [r0, 0x20] - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite -_08173246: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81731FC - - thumb_func_start sub_8173250 -sub_8173250: @ 8173250 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - bgt _08173264 - adds r0, r1, 0x1 - strh r0, [r4, 0x30] - b _081732A6 -_08173264: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldrh r1, [r4, 0x24] - adds r1, 0x5 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x5 - strh r0, [r4, 0x26] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x20 - ble _081732A6 - ldr r2, =gTasks - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0x20] - subs r1, 0x1 - strh r1, [r0, 0x20] - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite -_081732A6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8173250 - - thumb_func_start sub_81732B0 -sub_81732B0: @ 81732B0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gBattleAnimPicTable + 0x868 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gBattleAnimPaletteTable + 0x868 - bl LoadCompressedObjectPaletteUsingHeap - ldr r0, =0x0000281d - bl IndexOfSpritePaletteTag - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81732B0 - - thumb_func_start sub_81732E4 -sub_81732E4: @ 81732E4 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =0x0000281d - adds r0, r5, 0 - bl FreeSpriteTilesByTag - adds r0, r5, 0 - bl FreeSpritePaletteByTag - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81732E4 - - thumb_func_start sub_817330C -sub_817330C: @ 817330C - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0 - bl InitAnimSpritePos - movs r0, 0x1E - strh r0, [r4, 0x2E] - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r5, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r5, 0x4] - adds r0, r1 - strh r0, [r4, 0x32] - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r5, [r5, 0x6] - adds r0, r5 - strh r0, [r4, 0x36] - ldr r0, =0x0000ffe0 - strh r0, [r4, 0x38] - adds r0, r4, 0 - bl InitAnimArcTranslation - ldr r2, =gSprites - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8039E84 - str r1, [r0] - ldr r0, =sub_817339C - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817330C - - thumb_func_start sub_817339C -sub_817339C: @ 817339C - push {lr} - adds r3, r0, 0 - ldr r2, =gSprites - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _081733C0 - ldr r0, =sub_81733D4 - str r0, [r3, 0x1C] -_081733C0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_817339C - - thumb_func_start sub_81733D4 -sub_81733D4: @ 81733D4 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _081733F6 - movs r0, 0 - strh r0, [r4, 0x2E] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_8173400 - str r0, [r4, 0x1C] -_081733F6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81733D4 - - thumb_func_start sub_8173400 -sub_8173400: @ 8173400 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gSprites - ldr r3, =gBattlerSpriteIds - ldr r2, =gBattleAnimAttacker - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - bge _08173448 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - ble _08173448 - ldrb r0, [r2] - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl DestroyAnimSprite -_08173448: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8173400 - - thumb_func_start sub_817345C -sub_817345C: @ 817345C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08173478 - cmp r0, 0x1 - beq _0817348C - b _081734A0 - .pool -_08173478: - movs r0, 0 - bl GetBattlerAtPosition - ldr r1, =gBattleAnimAttacker - strb r0, [r1] - movs r0, 0x1 - b _08173498 - .pool -_0817348C: - movs r0, 0x1 - bl GetBattlerAtPosition - ldr r1, =gBattleAnimAttacker - strb r0, [r1] - movs r0, 0 -_08173498: - bl GetBattlerAtPosition - ldr r1, =gBattleAnimTarget - strb r0, [r1] -_081734A0: - adds r0, r4, 0 - bl DestroyAnimVisualTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817345C - - thumb_func_start AnimTask_GetTrappedMoveAnimId -AnimTask_GetTrappedMoveAnimId: @ 81734B4 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gBattleSpritesDataPtr - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldrh r1, [r0] - cmp r1, 0x53 - bne _081734D4 - ldr r1, =gBattleAnimArgs - movs r0, 0x1 - b _0817350C - .pool -_081734D4: - cmp r1, 0xFA - bne _081734E4 - ldr r1, =gBattleAnimArgs - movs r0, 0x2 - b _0817350C - .pool -_081734E4: - cmp r1, 0x80 - bne _081734F4 - ldr r1, =gBattleAnimArgs - movs r0, 0x3 - b _0817350C - .pool -_081734F4: - movs r0, 0xA4 - lsls r0, 1 - cmp r1, r0 - bne _08173508 - ldr r1, =gBattleAnimArgs - movs r0, 0x4 - b _0817350C - .pool -_08173508: - ldr r1, =gBattleAnimArgs - movs r0, 0 -_0817350C: - strh r0, [r1] - adds r0, r2, 0 - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .pool - thumb_func_end AnimTask_GetTrappedMoveAnimId - - thumb_func_start sub_817351C -sub_817351C: @ 817351C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gBattleAnimAttacker - ldr r1, =gBattleSpritesDataPtr - ldr r2, [r1] - ldr r1, [r2, 0x8] - ldrh r1, [r1] - strb r1, [r3] - ldr r3, =gBattleAnimTarget - ldr r1, [r2, 0x8] - ldrh r1, [r1] - lsrs r1, 8 - strb r1, [r3] - bl DestroyAnimVisualTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_817351C - - .align 2, 0 @ Don't pad with nop. diff --git a/common_syms/battle_anim_8170478.txt b/common_syms/battle_anim_8170478.txt new file mode 100755 index 000000000..2fc194df7 --- /dev/null +++ b/common_syms/battle_anim_8170478.txt @@ -0,0 +1,3 @@ +gUnknown_030062DC +gUnknown_030062E0 +gUnknown_030062E4 diff --git a/data/battle_anim_8170478.s b/data/battle_anim_8170478.s deleted file mode 100644 index 74bdce846..000000000 --- a/data/battle_anim_8170478.s +++ /dev/null @@ -1,157 +0,0 @@ -#include "constants/battle_anim.h" - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_085E5088:: @ 85E5088 - .byte 0x0a, 0x02, 0xfd, 0x00, 0x0f, 0x00, 0xfc, 0x00 - .byte 0xf6, 0x02, 0xfc, 0x00 - - .align 2 -gUnknown_085E5094:: @ 85E5094 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ec - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ed - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ee - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ef - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f0 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f1 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f2 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f3 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f4 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f5 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f6 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f7 - - .align 2 -gUnknown_085E50F4:: @ 85E50F4 - obj_pal gBattleAnimSpritePalette_136, 0xd6ec - obj_pal gBattleAnimSpritePalette_136, 0xd6ed - obj_pal gBattleAnimSpritePalette_136, 0xd6ee - obj_pal gBattleAnimSpritePalette_136, 0xd6ef - obj_pal gBattleAnimSpritePalette_136, 0xd6f0 - obj_pal gBattleAnimSpritePalette_136, 0xd6f1 - obj_pal gBattleAnimSpritePalette_136, 0xd6f2 - obj_pal gBattleAnimSpritePalette_136, 0xd6f3 - obj_pal gBattleAnimSpritePalette_136, 0xd6f4 - obj_pal gBattleAnimSpritePalette_136, 0xd6f5 - obj_pal gBattleAnimSpritePalette_136, 0xd6f6 - obj_pal gBattleAnimSpritePalette_136, 0xd6f7 - - .align 2 -gUnknown_085E5154:: @ 85E5154 - .2byte 0x0000, 0x0001, 0x0001, 0x0001 - .2byte 0x0002, 0x0001, 0x0000, 0x0041 - .2byte 0x0002, 0x0001, 0x0001, 0x0001 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_085E5170:: @ 85E5170 - .2byte 0x0003, 0x0001, 0xffff, 0x0000 - - .align 2 -gUnknown_085E5178:: @ 85E5178 - .2byte 0x0004, 0x0001, 0xffff, 0x0000 - - .align 2 -gUnknown_085E5180:: @ 85E5180 - .2byte 0x0005, 0x0001, 0xffff, 0x0000 - - .align 2 -gUnknown_085E5188:: @ 85E5188 - .2byte 0x0006, 0x0004, 0x0007, 0x0004 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_085E5194:: @ 85E5194 - .2byte 0x0007, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085E519C:: @ 85E519C - .4byte gUnknown_085E5154 - .4byte gUnknown_085E5170 - .4byte gUnknown_085E5178 - .4byte gUnknown_085E5180 - .4byte gUnknown_085E5188 - .4byte gUnknown_085E5194 - - .align 2 -gUnknown_085E51B4:: @ 85E51B4 - .byte 0x00, 0x00, 0x00, 0x05, 0x01, 0x02, 0x02, 0x03 - .byte 0x05, 0x05, 0x04, 0x04 - - .align 2 -gUnknown_085E51C0:: @ 85E51C0 - .4byte sub_8171E50 - .4byte sub_81723D4 - .4byte sub_81721CC - .4byte sub_81722CC - .4byte sub_81726BC - .4byte sub_81721CC - .4byte sub_81720C8 - .4byte sub_81722CC - .4byte sub_8172560 - .4byte sub_8171FC4 - .4byte sub_81723D4 - .4byte sub_81727E8 - - .align 2 -gUnknown_085E51F0:: @ 85E51F0 - spr_template 0xd6ec, 0xd6ec, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6ed, 0xd6ed, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6ee, 0xd6ee, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6ef, 0xd6ef, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_085E5250:: @ 85E5250 - spr_template 0xd6f0, 0xd6f0, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6f1, 0xd6f1, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6f2, 0xd6f2, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6f3, 0xd6f3, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6f4, 0xd6f4, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6f5, 0xd6f5, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6f6, 0xd6f6, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 - spr_template 0xd6f7, 0xd6f7, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_085E5310:: @ 85E5310 - .2byte 0x7adf, 0x7af0, 0x53d7, 0x3fff, 0x7297, 0x67f5, 0x7b2c, 0x2b7e - .2byte 0x431f, 0x7bdd, 0x2a3f, 0x293f, 0x0000, 0x0201, 0x0403, 0x0101 - .2byte 0x0100, 0x0503, 0x0506, 0x0004 - - .align 2 -gBattleAnimSpriteTemplate_85E5338:: @ 85E5338 - spr_template ANIM_TAG_UNUSED_RED_BRICK, ANIM_TAG_UNUSED_RED_BRICK, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_817330C - - .align 2 -gUnknown_085E5350:: @ 8535350 - .2byte 0x0040, 0x0001, 0xffff, 0x0000 - - .align 2 -gUnknown_085E5358:: @ 8535358 - .4byte gUnknown_085E5350 - - .align 2 - spr_template ANIM_TAG_ROCKS, ANIM_TAG_ROCKS, gUnknown_08524914, gUnknown_085E5358, NULL, gDummySpriteAffineAnimTable, sub_817330C - diff --git a/include/battle.h b/include/battle.h index 9e67e8ec5..c06bdaad5 100644 --- a/include/battle.h +++ b/include/battle.h @@ -599,8 +599,7 @@ struct BattleAnimationInfo u8 field_9_x80:1; u8 field_A; u8 field_B; - u8 field_C; - u8 field_D; + s16 field_C; u8 field_E; u8 field_F; }; diff --git a/include/battle_anim.h b/include/battle_anim.h index 541c165e7..fffdabe06 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -131,6 +131,7 @@ void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a u8 sub_80A80C8(struct Task *task); void sub_80A8EE4(struct Sprite *); void sub_80A67F4(struct Sprite *); +void sub_80A6D48(u32 bgId, const void *src); enum { @@ -168,8 +169,8 @@ void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId); // battle_anim_8170478.s 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 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId); +u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, u8 ballId); // battle_anim_utility_funcs.s void sub_8116EB4(u8); @@ -223,4 +224,7 @@ extern const struct OamData gUnknown_0852493C; extern const struct OamData gUnknown_08524A5C; extern const struct OamData gUnknown_08524A74; +extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; +extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; + #endif // GUARD_BATTLE_ANIM_H diff --git a/include/global.h b/include/global.h index 33a31bf4d..58b338f9e 100644 --- a/include/global.h +++ b/include/global.h @@ -61,6 +61,12 @@ #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) >= (b) ? (a) : (b)) +// Extracts the upper 16 bits of a 32-bit number +#define HIHALF(n) (((n) & 0xFFFF0000) >> 16) + +// Extracts the lower 16 bits of a 32-bit number +#define LOHALF(n) ((n) & 0xFFFF) + // There are many quirks in the source code which have overarching behavioral differences from // a number of other files. For example, diploma.c seems to declare rodata before each use while // other files declare out of order and must be at the beginning. There are also a number of diff --git a/include/graphics.h b/include/graphics.h index e2889ed86..33a26068b 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4233,6 +4233,7 @@ extern const u32 gBattleAnimSpriteSheet_132[]; extern const u32 gBattleAnimSpriteSheet_133[]; extern const u32 gBattleAnimSpriteSheet_134[]; extern const u32 gBattleAnimSpriteSheet_135[]; +extern const u32 gBattleAnimSpriteSheet_Particles[]; extern const u32 gBattleAnimSpriteSheet_136[]; extern const u32 gBattleAnimSpriteSheet_137[]; extern const u32 gBattleAnimSpriteSheet_138[]; @@ -4748,4 +4749,9 @@ extern const u32 gCableCarDoor_Gfx[]; extern const u32 gCableCarCord_Gfx[]; extern const u16 gCableCar_Pal[]; +// Battle Anim +extern const u32 gUnknown_08C2DDA4[]; +extern const u32 gUnknown_08C2EA50[]; +extern const u32 gUnknown_08C2EA9C[]; + #endif //GUARD_GRAPHICS_H diff --git a/ld_script.txt b/ld_script.txt index 80c614471..1413941f1 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -238,7 +238,7 @@ SECTIONS { src/intro.o(.text); src/reset_save_heap.o(.text); src/field_region_map.o(.text); - asm/battle_anim_8170478.o(.text); + src/battle_anim_8170478.o(.text); src/hall_of_fame.o(.text); src/credits.o(.text); src/lottery_corner.o(.text); @@ -549,7 +549,7 @@ SECTIONS { src/player_pc.o(.rodata); src/intro.o(.rodata); src/field_region_map.o(.rodata); - data/battle_anim_8170478.o(.rodata); + src/battle_anim_8170478.o(.rodata); src/hall_of_fame.o(.rodata); src/credits.o(.rodata); src/lottery_corner.o(.rodata); diff --git a/src/battle_anim.c b/src/battle_anim.c index 95c6f7b3c..5e62c0957 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -26,8 +26,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE2; extern const u16 gMovesWithQuietBGM[]; extern const u8 *const gBattleAnims_Moves[]; -extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; -extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; extern const struct BattleAnimBackground gBattleAnimBackgroundTable[]; // this file's functions diff --git a/src/battle_anim_8170478.c b/src/battle_anim_8170478.c new file mode 100755 index 000000000..6c91ff934 --- /dev/null +++ b/src/battle_anim_8170478.c @@ -0,0 +1,2267 @@ +#include "global.h" +#include "battle.h" +#include "battle_anim.h" +#include "battle_controllers.h" +#include "battle_interface.h" +#include "decompress.h" +#include "dma3.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "m4a.h" +#include "main.h" +#include "palette.h" +#include "pokeball.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "util.h" +#include "constants/rgb.h" +#include "constants/items.h" +#include "constants/songs.h" + +// iwram +int gUnknown_030062DC; +u16 gUnknown_030062E0; +u16 gUnknown_030062E4; + +static void sub_8170660(u8); +static void sub_8170A38(u8); +static void sub_8170EF0(u8); +static void sub_8171104(struct Sprite *); +static void sub_8171030(u8); +static void sub_81710A8(u8); +static void sub_8171134(struct Sprite *); +static void sub_8171CAC(struct Sprite *); +static void sub_81711E8(struct Sprite *); +static void sub_8171240(struct Sprite *); +static void sub_817138C(struct Sprite *); +static void sub_81713D0(struct Sprite *); +static void sub_81717B4(struct Sprite *); +static void sub_81714D4(struct Sprite *); +static void sub_8171520(struct Sprite *); +static void sub_81717D8(struct Sprite *); +static void sub_8171AE4(struct Sprite *); +static void sub_81717F8(struct Sprite *); +static void sub_81719EC(struct Sprite *); +static void sub_81718D8(struct Sprite *); +static void sub_81719C0(struct Sprite *); +static void sub_8171D60(u8); +static void sub_8171AAC(struct Sprite *); +static void sub_8171BAC(struct Sprite *); +static void sub_8171CE8(struct Sprite *); +static void PokeBallOpenParticleAnimation_Step1(struct Sprite *); +static void PokeBallOpenParticleAnimation_Step2(struct Sprite *); +static void DestroyBallOpenAnimationParticle(struct Sprite *); +static void FanOutBallOpenParticles_Step1(struct Sprite *); +static void RepeatBallOpenParticleAnimation_Step1(struct Sprite *); +static void PremierBallOpenParticleAnimation_Step1(struct Sprite *); +static void sub_8172AB0(u8); +static void sub_8172B40(u8); +static void sub_8172B90(u8); +static void sub_8172FEC(u8); +static void sub_81731FC(struct Sprite *); +static void sub_8173250(struct Sprite *); +static void sub_81731B0(u8); +static void sub_817339C(struct Sprite *); +static void sub_81733D4(struct Sprite *); +static void sub_8173400(struct Sprite *); +static void PokeBallOpenParticleAnimation(u8); +static void GreatBallOpenParticleAnimation(u8); +static void SafariBallOpenParticleAnimation(u8); +static void UltraBallOpenParticleAnimation(u8); +static void MasterBallOpenParticleAnimation(u8); +static void DiveBallOpenParticleAnimation(u8); +static void RepeatBallOpenParticleAnimation(u8); +static void TimerBallOpenParticleAnimation(u8); +static void PremierBallOpenParticleAnimation(u8); +static void sub_817330C(struct Sprite *); + +struct BallCaptureSuccessStarData +{ + s8 xOffset; + s8 yOffset; + s8 unk2; +}; + +static const struct BallCaptureSuccessStarData sBallCaptureSuccessStarData[] = +{ + { + .xOffset = 10, + .yOffset = 2, + .unk2 = -3, + }, + { + .xOffset = 15, + .yOffset = 0, + .unk2 = -4, + }, + { + .xOffset = -10, + .yOffset = 2, + .unk2 = -4, + }, +}; + +const struct CompressedSpriteSheet gBallOpenParticleSpritesheets[] = +{ + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6EC}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6ED}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6EE}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6EF}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F0}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F1}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F2}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F3}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F4}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F5}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F6}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F7}, +}; + +const struct CompressedSpritePalette gBallOpenParticlePalettes[] = +{ + {gBattleAnimSpritePalette_136, 0xD6EC}, + {gBattleAnimSpritePalette_136, 0xD6ED}, + {gBattleAnimSpritePalette_136, 0xD6EE}, + {gBattleAnimSpritePalette_136, 0xD6EF}, + {gBattleAnimSpritePalette_136, 0xD6F0}, + {gBattleAnimSpritePalette_136, 0xD6F1}, + {gBattleAnimSpritePalette_136, 0xD6F2}, + {gBattleAnimSpritePalette_136, 0xD6F3}, + {gBattleAnimSpritePalette_136, 0xD6F4}, + {gBattleAnimSpritePalette_136, 0xD6F5}, + {gBattleAnimSpritePalette_136, 0xD6F6}, + {gBattleAnimSpritePalette_136, 0xD6F7}, +}; + +const union AnimCmd gUnknown_085E5154[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 1), + ANIMCMD_FRAME(2, 1), + ANIMCMD_FRAME(0, 1, .hFlip = TRUE), + ANIMCMD_FRAME(2, 1), + ANIMCMD_FRAME(1, 1), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gUnknown_085E5170[] = +{ + ANIMCMD_FRAME(3, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085E5178[] = +{ + ANIMCMD_FRAME(4, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085E5180[] = +{ + ANIMCMD_FRAME(5, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085E5188[] = +{ + ANIMCMD_FRAME(6, 4), + ANIMCMD_FRAME(7, 4), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gUnknown_085E5194[] = +{ + ANIMCMD_FRAME(7, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_085E519C[] = +{ + gUnknown_085E5154, + gUnknown_085E5170, + gUnknown_085E5178, + gUnknown_085E5180, + gUnknown_085E5188, + gUnknown_085E5194, +}; + +const u8 gBallOpenParticleAnimNums[] = +{ + 0, + 0, + 0, + 5, + 1, + 2, + 2, + 3, + 5, + 5, + 4, + 4, +}; + +const TaskFunc gBallOpenParticleAnimationFuncs[] = +{ + PokeBallOpenParticleAnimation, + GreatBallOpenParticleAnimation, + SafariBallOpenParticleAnimation, + UltraBallOpenParticleAnimation, + MasterBallOpenParticleAnimation, + SafariBallOpenParticleAnimation, + DiveBallOpenParticleAnimation, + UltraBallOpenParticleAnimation, + RepeatBallOpenParticleAnimation, + TimerBallOpenParticleAnimation, + GreatBallOpenParticleAnimation, + PremierBallOpenParticleAnimation, +}; + +const struct SpriteTemplate gUnknown_085E51F0[] = +{ + { + .tileTag = 55020, + .paletteTag = 55020, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55021, + .paletteTag = 55021, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55022, + .paletteTag = 55022, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55023, + .paletteTag = 55023, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55024, + .paletteTag = 55024, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55025, + .paletteTag = 55025, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55026, + .paletteTag = 55026, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55027, + .paletteTag = 55027, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55028, + .paletteTag = 55028, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55029, + .paletteTag = 55029, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55030, + .paletteTag = 55030, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55031, + .paletteTag = 55031, + .oam = &gUnknown_08524904, + .anims = gUnknown_085E519C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, +}; + +const u16 gUnknown_085E5310[] = +{ + RGB(31, 22, 30), + RGB(16, 23, 30), + RGB(23, 30, 20), + RGB(31, 31, 15), + RGB(23, 20, 28), + RGB(21, 31, 25), + RGB(12, 25, 30), + RGB(30, 27, 10), + RGB(31, 24, 16), + RGB(29, 30, 30), + RGB(31, 17, 10), + RGB(31, 9, 10), + RGB(0, 0, 0), + RGB(1, 16, 0), + RGB(3, 0, 1), + RGB(1, 8, 0), + RGB(0, 8, 0), + RGB(3, 8, 1), + RGB(6, 8, 1), + RGB(4, 0, 0), +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_85E5338 = +{ + .tileTag = ANIM_TAG_UNUSED_RED_BRICK, + .paletteTag = ANIM_TAG_UNUSED_RED_BRICK, + .oam = &gUnknown_0852490C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_817330C, +}; + +const union AnimCmd gUnknown_085E5350[] = +{ + ANIMCMD_FRAME(64, 1), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_085E5358[] = { + gUnknown_085E5350, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_085E535C = +{ + .tileTag = ANIM_TAG_ROCKS, + .paletteTag = ANIM_TAG_ROCKS, + .oam = &gUnknown_08524914, + .anims = gUnknown_085E5358, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_817330C, +}; + +extern const struct SpriteTemplate gUnknown_085CE388; +extern const struct SpriteTemplate gUnknown_085CE3A0; + +void unref_sub_8170478(u8 taskId) +{ + struct UnknownAnimStruct2 unknownStruct; + u8 healthBoxSpriteId; + u8 battler; + u8 spriteId1, spriteId2, spriteId3, spriteId4; + + battler = gBattleAnimAttacker; + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 0); + SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0); + SetAnimBgAttribute(1, BG_ANIM_AREA_OVERFLOW_MODE, 1); + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); + + healthBoxSpriteId = gHealthboxSpriteIds[battler]; + spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; + spriteId2 = gSprites[healthBoxSpriteId].data[5]; + spriteId3 = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); + spriteId4 = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); + gSprites[healthBoxSpriteId].oam.priority = 1; + gSprites[spriteId1].oam.priority = 1; + gSprites[spriteId2].oam.priority = 1; + gSprites[spriteId3] = gSprites[healthBoxSpriteId]; + gSprites[spriteId4] = gSprites[spriteId1]; + gSprites[spriteId3].oam.objMode = ST_OAM_OBJ_WINDOW; + gSprites[spriteId4].oam.objMode = ST_OAM_OBJ_WINDOW; + gSprites[spriteId3].callback = SpriteCallbackDummy; + gSprites[spriteId4].callback = SpriteCallbackDummy; + + sub_80A6B30(&unknownStruct); + sub_80A6D48(unknownStruct.bgId, gUnknown_08C2EA9C); + sub_80A6CC0(unknownStruct.bgId, gUnknown_08C2EA50, unknownStruct.tilesOffset); + LoadCompressedPalette(gUnknown_08C2DDA4, unknownStruct.unk8 << 4, 32); + + gBattle_BG1_X = -gSprites[spriteId3].pos1.x + 32; + gBattle_BG1_Y = -gSprites[spriteId3].pos1.y - 32; + gTasks[taskId].data[1] = 640; + gTasks[taskId].data[0] = spriteId3; + gTasks[taskId].data[2] = spriteId4; + gTasks[taskId].func = sub_8170660; +} + +static void sub_8170660(u8 taskId) +{ + u8 spriteId1, spriteId2; + u8 battler; + + battler = gBattleAnimAttacker; + gTasks[taskId].data[13] += gTasks[taskId].data[1]; + gBattle_BG1_Y += (u16)gTasks[taskId].data[13] >> 8; + gTasks[taskId].data[13] &= 0xFF; + + switch (gTasks[taskId].data[15]) + { + case 0: + if (gTasks[taskId].data[11]++ > 1) + { + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[12]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12])); + if (gTasks[taskId].data[12] == 8) + gTasks[taskId].data[15]++; + } + break; + case 1: + if (++gTasks[taskId].data[10] == 30) + gTasks[taskId].data[15]++; + break; + case 2: + if (gTasks[taskId].data[11]++ > 1) + { + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[12]--; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12])); + if (gTasks[taskId].data[12] == 0) + { + sub_80A477C(0); + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR); + if (!IsContest()) + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); + + SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0)); + DestroySprite(&gSprites[gTasks[taskId].data[0]]); + DestroySprite(&gSprites[gTasks[taskId].data[2]]); + SetAnimBgAttribute(1, BG_ANIM_AREA_OVERFLOW_MODE, 0); + spriteId1 = gSprites[gHealthboxSpriteIds[battler]].oam.affineParam; + spriteId2 = gSprites[gHealthboxSpriteIds[battler]].data[5]; + gSprites[gHealthboxSpriteIds[battler]].oam.priority = 1; + gSprites[spriteId1].oam.priority = 1; + gSprites[spriteId2].oam.priority = 1; + DestroyAnimVisualTask(taskId); + } + } + break; + } +} + +static void sub_8170834(u8 *paletteId1, u8 *paletteId2, u8 battler) +{ + u8 healthBoxSpriteId; + u8 spriteId1, spriteId2; + u16 offset1, offset2; + + healthBoxSpriteId = gHealthboxSpriteIds[battler]; + spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; + spriteId2 = gSprites[healthBoxSpriteId].data[5]; + *paletteId1 = AllocSpritePalette(0xD709); + *paletteId2 = AllocSpritePalette(0xD70A); + + offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100; + offset2 = (gSprites[spriteId2].oam.paletteNum * 16) + 0x100; + LoadPalette(&gPlttBufferUnfaded[offset1], *paletteId1 * 16 + 0x100, 0x20); + LoadPalette(&gPlttBufferUnfaded[offset2], *paletteId2 * 16 + 0x100, 0x20); + + gSprites[healthBoxSpriteId].oam.paletteNum = *paletteId1; + gSprites[spriteId1].oam.paletteNum = *paletteId1; + gSprites[spriteId2].oam.paletteNum = *paletteId2; +} + +void sub_8170920(u8 taskId) +{ + u8 paletteId1, paletteId2; + sub_8170834(&paletteId1, &paletteId2, gBattleAnimAttacker); + DestroyAnimVisualTask(taskId); +} + +static void sub_817094C(u8 battler) +{ + u8 healthBoxSpriteId; + u8 spriteId1, spriteId2; + u8 paletteId1, paletteId2; + + healthBoxSpriteId = gHealthboxSpriteIds[battler]; + spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam; + spriteId2 = gSprites[healthBoxSpriteId].data[5]; + + FreeSpritePaletteByTag(0xD709); + FreeSpritePaletteByTag(0xD70A); + paletteId1 = IndexOfSpritePaletteTag(0xD6FF); + paletteId2 = IndexOfSpritePaletteTag(0xD704); + gSprites[healthBoxSpriteId].oam.paletteNum = paletteId1; + gSprites[spriteId1].oam.paletteNum = paletteId1; + gSprites[spriteId2].oam.paletteNum = paletteId2; +} + +void sub_81709EC(u8 taskId) +{ + sub_817094C(gBattleAnimAttacker); + DestroyAnimVisualTask(taskId); +} + +void sub_8170A0C(u8 taskId) +{ + gTasks[taskId].data[10] = gBattleAnimArgs[0]; + gTasks[taskId].data[11] = gBattleAnimArgs[1]; + gTasks[taskId].func = sub_8170A38; +} + +static void sub_8170A38(u8 taskId) +{ + u8 paletteNum; + int paletteOffset, colorOffset; + + gTasks[taskId].data[0]++; + if (gTasks[taskId].data[0]++ >= gTasks[taskId].data[11]) + { + gTasks[taskId].data[0] = 0; + paletteNum = IndexOfSpritePaletteTag(0xD709); + colorOffset = gTasks[taskId].data[10] == 0 ? 6 : 2; + switch (gTasks[taskId].data[1]) + { + case 0: + gTasks[taskId].data[2] += 2; + if (gTasks[taskId].data[2] > 16) + gTasks[taskId].data[2] = 16; + + paletteOffset = paletteNum * 16 + 0x100; + BlendPalette(paletteOffset + colorOffset, 1, gTasks[taskId].data[2], RGB(20, 27, 31)); + if (gTasks[taskId].data[2] == 16) + gTasks[taskId].data[1]++; + break; + case 1: + gTasks[taskId].data[2] -= 2; + if (gTasks[taskId].data[2] < 0) + gTasks[taskId].data[2] = 0; + + paletteOffset = paletteNum * 16 + 0x100; + BlendPalette(paletteOffset + colorOffset, 1, gTasks[taskId].data[2], RGB(20, 27, 31)); + if (gTasks[taskId].data[2] == 0) + DestroyAnimVisualTask(taskId); + break; + } + } +} + +void sub_8170B04(u8 taskId) +{ + u8 spriteId; + + spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + switch (gTasks[taskId].data[0]) + { + case 0: + sub_80A7270(spriteId, 0); + gTasks[taskId].data[10] = 0x100; + gTasks[taskId].data[0]++; + break; + case 1: + gTasks[taskId].data[10] += 0x30; + obj_id_set_rotscale(spriteId, gTasks[taskId].data[10], gTasks[taskId].data[10], 0); + sub_80A7E6C(spriteId); + if (gTasks[taskId].data[10] >= 0x2D0) + gTasks[taskId].data[0]++; + break; + case 2: + sub_80A7344(spriteId); + gSprites[spriteId].invisible = 1; + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_8170BB0(u8 taskId) +{ + u8 spriteId; + u16 ball; + u8 ballId; + u8 x, y; + u8 priority, subpriority; + u32 selectedPalettes; + + spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + ball = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_POKEBALL); + else + ball = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_POKEBALL); + + ballId = ItemIdToBallId(ball); + switch (gTasks[taskId].data[0]) + { + case 0: + x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); + y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1); + priority = gSprites[spriteId].oam.priority; + subpriority = gSprites[spriteId].subpriority; + gTasks[taskId].data[10] = AnimateBallOpenParticles(x, y + 32, priority, subpriority, ballId); + selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); + gTasks[taskId].data[11] = LaunchBallFadeMonTask(0, gBattleAnimAttacker, selectedPalettes, ballId); + gTasks[taskId].data[0]++; + break; + case 1: + if (!gTasks[gTasks[taskId].data[10]].isActive && !gTasks[gTasks[taskId].data[11]].isActive) + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_8170CFC(u8 taskId) +{ + u8 ballId = ItemIdToBallId(gLastUsedItem); + LoadBallGfx(ballId); + DestroyAnimVisualTask(taskId); +} + +void sub_8170D24(u8 taskId) +{ + u8 ballId = ItemIdToBallId(gLastUsedItem); + FreeBallGfx(ballId); + DestroyAnimVisualTask(taskId); +} + +void AnimTask_IsBallBlockedByTrainer(u8 taskId) +{ + if (gBattleSpritesDataPtr->animationData->ballThrowCaseId == BALL_TRAINER_BLOCK) + gBattleAnimArgs[7] = -1; + else + gBattleAnimArgs[7] = 0; + + DestroyAnimVisualTask(taskId); +} + +u8 ItemIdToBallId(u16 ballItem) +{ + switch (ballItem) + { + case ITEM_MASTER_BALL: + return 4; + case ITEM_ULTRA_BALL: + return 3; + case ITEM_GREAT_BALL: + return 1; + case ITEM_SAFARI_BALL: + return 2; + case ITEM_NET_BALL: + return 5; + case ITEM_DIVE_BALL: + return 6; + case ITEM_NEST_BALL: + return 7; + case ITEM_REPEAT_BALL: + return 8; + case ITEM_TIMER_BALL: + return 9; + case ITEM_LUXURY_BALL: + return 10; + case ITEM_PREMIER_BALL: + return 11; + case ITEM_POKE_BALL: + default: + return 0; + } +} + +void sub_8170E04(u8 taskId) +{ + u8 ballId; + u8 spriteId; + + ballId = ItemIdToBallId(gLastUsedItem); + spriteId = CreateSprite(&gBallSpriteTemplates[ballId], 32, 80, 29); + gSprites[spriteId].data[0] = 34; + gSprites[spriteId].data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + gSprites[spriteId].data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) - 16; + gSprites[spriteId].callback = sub_8171104; + gBattleSpritesDataPtr->animationData->field_9_x2 = gSprites[gBattlerSpriteIds[gBattleAnimTarget]].invisible; + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].func = sub_8170EF0; +} + +static void sub_8170EF0(u8 taskId) +{ + u8 spriteId = gTasks[taskId].data[0]; + if ((u16)gSprites[spriteId].data[0] == 0xFFFF) + DestroyAnimVisualTask(taskId); +} + +void sub_8170F2C(u8 taskId) +{ + int x, y; + u8 ballId; + u8 subpriority; + u8 spriteId; + + if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) + { + x = 32; + y = 11; + } + else + { + x = 23; + y = 5; + } + + ballId = ItemIdToBallId(gLastUsedItem); + subpriority = sub_80A82E4(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) + 1; + spriteId = CreateSprite(&gBallSpriteTemplates[ballId], x + 32, y | 80, subpriority); + gSprites[spriteId].data[0] = 34; + gSprites[spriteId].data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + gSprites[spriteId].data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) - 16; + gSprites[spriteId].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]].callback = sub_8039E84; + gTasks[taskId].data[0] = spriteId; + gTasks[taskId].func = sub_8171030; +} + +static void sub_8171030(u8 taskId) +{ + if (gSprites[gBattlerSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]].animCmdIndex == 1) + { + PlaySE12WithPanning(SE_NAGERU, 0); + gSprites[gTasks[taskId].data[0]].callback = sub_8171104; + CreateTask(sub_81710A8, 10); + gTasks[taskId].func = sub_8170EF0; + } +} + +static void sub_81710A8(u8 taskId) +{ + if (gSprites[gBattlerSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]].animEnded) + { + StartSpriteAnim(&gSprites[gBattlerSpriteIds[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]], 0); + DestroyTask(taskId); + } +} + +static void sub_8171104(struct Sprite *sprite) +{ + u16 temp = sprite->data[1]; + u16 temp2 = sprite->data[2]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = temp; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = temp2; + sprite->data[5] = -40; + InitAnimArcTranslation(sprite); + sprite->callback = sub_8171134; +} + +static void sub_8171134(struct Sprite *sprite) +{ + int i; + u8 ballId; + int ballId2; // extra var needed to match + + if (TranslateAnimArc(sprite)) + { + if (gBattleSpritesDataPtr->animationData->ballThrowCaseId == BALL_TRAINER_BLOCK) + { + sprite->callback = sub_8171CAC; + } + else + { + StartSpriteAnim(sprite, 1); + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + + for (i = 0; i < 8; i++) + sprite->data[i] = 0; + + sprite->data[5] = 0; + sprite->callback = sub_81711E8; + ballId = ItemIdToBallId(gLastUsedItem); + ballId2 = ballId; + if (ballId2 > 11) + return; + if (ballId2 < 0) + return; + + AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballId); + LaunchBallFadeMonTask(0, gBattleAnimTarget, 14, ballId); + } + } +} + +static void sub_81711E8(struct Sprite *sprite) +{ + if (++sprite->data[5] == 10) + { + sprite->data[5] = CreateTask(TaskDummy, 50); + sprite->callback = sub_8171240; + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].data[1] = 0; + } +} + +static void sub_8171240(struct Sprite *sprite) +{ + u8 spriteId; + u8 taskId; + + spriteId = gBattlerSpriteIds[gBattleAnimTarget]; + taskId = sprite->data[5]; + + if (++gTasks[taskId].data[1] == 11) + PlaySE(SE_SUIKOMU); + + switch (gTasks[taskId].data[0]) + { + case 0: + sub_80A7270(spriteId, 0); + gTasks[taskId].data[10] = 256; + gUnknown_030062DC = 28; + gUnknown_030062E4 = (gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y) - (sprite->pos1.y + sprite->pos2.y); + gUnknown_030062E0 = (u32)(gUnknown_030062E4 * 256) / 28; + gTasks[taskId].data[2] = gUnknown_030062E0; + gTasks[taskId].data[0]++; + break; + case 1: + gTasks[taskId].data[10] += 0x20; + obj_id_set_rotscale(spriteId, gTasks[taskId].data[10], gTasks[taskId].data[10], 0); + gTasks[taskId].data[3] += gTasks[taskId].data[2]; + gSprites[spriteId].pos2.y = -gTasks[taskId].data[3] >> 8; + if (gTasks[taskId].data[10] >= 0x480) + gTasks[taskId].data[0]++; + break; + case 2: + sub_80A7344(spriteId); + gSprites[spriteId].invisible = 1; + gTasks[taskId].data[0]++; + break; + default: + if (gTasks[taskId].data[1] > 10) + { + DestroyTask(taskId); + StartSpriteAnim(sprite, 2); + sprite->data[5] = 0; + sprite->callback = sub_817138C; + } + break; + } +} + +static void sub_817138C(struct Sprite *sprite) +{ + int angle; + + if (sprite->animEnded) + { + sprite->data[3] = 0; + sprite->data[4] = 40; + sprite->data[5] = 0; + angle = 0; + sprite->pos1.y += Cos(angle, 40); + sprite->pos2.y = -Cos(angle, sprite->data[4]); + sprite->callback = sub_81713D0; + } +} + +static void sub_81713D0(struct Sprite *sprite) +{ + bool8 lastBounce; + int bounceCount; + + lastBounce = 0; + + switch (sprite->data[3] & 0xFF) + { + case 0: + sprite->pos2.y = -Cos(sprite->data[5], sprite->data[4]); + sprite->data[5] += (sprite->data[3] >> 8) + 4; + if (sprite->data[5] >= 64) + { + sprite->data[4] -= 10; + sprite->data[3] += 257; + + bounceCount = sprite->data[3] >> 8; + if (bounceCount == 4) + lastBounce = 1; + + // Play a different sound effect for each pokeball bounce. + switch (bounceCount) + { + case 1: + PlaySE(SE_KON); + break; + case 2: + PlaySE(SE_KON2); + break; + case 3: + PlaySE(SE_KON3); + break; + default: + PlaySE(SE_KON4); + break; + } + } + break; + case 1: + sprite->pos2.y = -Cos(sprite->data[5], sprite->data[4]); + sprite->data[5] -= (sprite->data[3] >> 8) + 4; + if (sprite->data[5] <= 0) + { + sprite->data[5] = 0; + sprite->data[3] &= -0x100; + } + break; + } + + if (lastBounce) + { + sprite->data[3] = 0; + sprite->pos1.y += Cos(64, 40); + sprite->pos2.y = 0; + if (gBattleSpritesDataPtr->animationData->ballThrowCaseId == BALL_NO_SHAKES) + { + sprite->data[5] = 0; + sprite->callback = sub_81717B4; + } + else + { + sprite->callback = sub_81714D4; + sprite->data[4] = 1; + sprite->data[5] = 0; + } + } +} + +static void sub_81714D4(struct Sprite *sprite) +{ + if (++sprite->data[3] == 31) + { + sprite->data[3] = 0; + sprite->affineAnimPaused = 1; + StartSpriteAffineAnim(sprite, 1); + gBattleSpritesDataPtr->animationData->field_C = 0; + sprite->callback = sub_8171520; + PlaySE(SE_BOWA); + } +} + +static void sub_8171520(struct Sprite *sprite) +{ + s8 state; + u16 var0; + + switch (sprite->data[3] & 0xFF) + { + case 0: + if (gBattleSpritesDataPtr->animationData->field_C > 0xFF) + { + sprite->pos2.x += sprite->data[4]; + gBattleSpritesDataPtr->animationData->field_C &= 0xFF; + } + else + { + gBattleSpritesDataPtr->animationData->field_C += 0xB0; + } + + sprite->data[5]++; + sprite->affineAnimPaused = 0; + var0 = sprite->data[5] + 7; + if (var0 > 14) + { + gBattleSpritesDataPtr->animationData->field_C = 0; + sprite->data[3]++; + sprite->data[5] = 0; + } + break; + case 1: + if (++sprite->data[5] == 1) + { + sprite->data[5] = 0; + sprite->data[4] = -sprite->data[4]; + sprite->data[3]++; + sprite->affineAnimPaused = 0; + if (sprite->data[4] < 0) + ChangeSpriteAffineAnim(sprite, 2); + else + ChangeSpriteAffineAnim(sprite, 1); + } + else + { + sprite->affineAnimPaused = 1; + } + break; + case 2: + if (gBattleSpritesDataPtr->animationData->field_C > 0xFF) + { + sprite->pos2.x += sprite->data[4]; + gBattleSpritesDataPtr->animationData->field_C &= 0xFF; + } + else + { + gBattleSpritesDataPtr->animationData->field_C += 0xB0; + } + + sprite->data[5]++; + sprite->affineAnimPaused = 0; + var0 = sprite->data[5] + 12; + if (var0 > 24) + { + gBattleSpritesDataPtr->animationData->field_C = 0; + sprite->data[3]++; + sprite->data[5] = 0; + } + break; + case 3: + if (sprite->data[5]++ < 0) + { + sprite->affineAnimPaused = 1; + break; + } + + sprite->data[5] = 0; + sprite->data[4] = -sprite->data[4]; + sprite->data[3]++; + sprite->affineAnimPaused = 0; + if (sprite->data[4] < 0) + ChangeSpriteAffineAnim(sprite, 2); + else + ChangeSpriteAffineAnim(sprite, 1); + // fall through + case 4: + if (gBattleSpritesDataPtr->animationData->field_C > 0xFF) + { + sprite->pos2.x += sprite->data[4]; + gBattleSpritesDataPtr->animationData->field_C &= 0xFF; + } + else + { + gBattleSpritesDataPtr->animationData->field_C += 0xB0; + } + + sprite->data[5]++; + sprite->affineAnimPaused = 0; + var0 = sprite->data[5] + 4; + if (var0 > 8) + { + gBattleSpritesDataPtr->animationData->field_C = 0; + sprite->data[3]++; + sprite->data[5] = 0; + sprite->data[4] = -sprite->data[4]; + } + break; + case 5: + sprite->data[3] += 0x100; + state = sprite->data[3] >> 8; + if (state == gBattleSpritesDataPtr->animationData->ballThrowCaseId) + { + sprite->affineAnimPaused = 1; + sprite->callback = sub_81717B4; + } + else + { + if (gBattleSpritesDataPtr->animationData->ballThrowCaseId == BALL_3_SHAKES_SUCCESS && state == 3) + { + sprite->callback = sub_81717D8; + sprite->affineAnimPaused = 1; + } + else + { + sprite->data[3]++; + sprite->affineAnimPaused = 1; + } + } + break; + case 6: + default: + if (++sprite->data[5] == 31) + { + sprite->data[5] = 0; + sprite->data[3] &= -0x100; + StartSpriteAffineAnim(sprite, 3); + if (sprite->data[4] < 0) + StartSpriteAffineAnim(sprite, 2); + else + StartSpriteAffineAnim(sprite, 1); + + PlaySE(SE_BOWA); + } + break; + } +} + +static void sub_81717B4(struct Sprite *sprite) +{ + if (++sprite->data[5] == 31) + { + sprite->data[5] = 0; + sprite->callback = sub_8171AE4; + } +} + +static void sub_81717D8(struct Sprite *sprite) +{ + sprite->animPaused = 1; + sprite->callback = sub_81717F8; + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[5] = 0; +} + +static void sub_81717F8(struct Sprite *sprite) +{ + u8 *battler = &gBattleAnimTarget; + + sprite->data[4]++; + if (sprite->data[4] == 40) + { + PlaySE(SE_RG_GETTING); + BlendPalettes(0x10000 << sprite->oam.paletteNum, 6, RGB(0, 0, 0)); + sub_81719EC(sprite); + } + else if (sprite->data[4] == 60) + { + BeginNormalPaletteFade(0x10000 << sprite->oam.paletteNum, 2, 6, 0, RGB(0, 0, 0)); + } + else if (sprite->data[4] == 95) + { + gDoingBattleAnim = 0; + UpdateOamPriorityInAllHealthboxes(1); + m4aMPlayAllStop(); + PlaySE(MUS_RG_FAN6); + } + else if (sprite->data[4] == 315) + { + FreeOamMatrix(gSprites[gBattlerSpriteIds[*battler]].oam.matrixNum); + DestroySprite(&gSprites[gBattlerSpriteIds[*battler]]); + sprite->data[0] = 0; + sprite->callback = sub_81718D8; + } +} + +static void sub_81718D8(struct Sprite *sprite) +{ + u8 paletteIndex; + + switch (sprite->data[0]) + { + case 0: + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->oam.objMode = ST_OAM_OBJ_BLEND; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0)); + paletteIndex = IndexOfSpritePaletteTag(sprite->template->paletteTag); + BeginNormalPaletteFade(1 << (paletteIndex + 0x10), 0, 0, 16, RGB(31, 31, 31)); + sprite->data[0]++; + break; + case 1: + if (sprite->data[1]++ > 0) + { + sprite->data[1] = 0; + sprite->data[2]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[2], sprite->data[2])); + if (sprite->data[2] == 16) + sprite->data[0]++; + } + break; + case 2: + sprite->invisible = 1; + sprite->data[0]++; + break; + default: + if (!gPaletteFade.active) + { + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + sprite->data[0] = 0; + sprite->callback = sub_81719C0; + } + break; + } +} + +static void sub_81719C0(struct Sprite *sprite) +{ + if (sprite->data[0] == 0) + { + sprite->data[0] = -1; + } + else + { + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); + } +} + +static void sub_81719EC(struct Sprite *sprite) +{ + u32 i; + u8 subpriority; + + if (sprite->subpriority) + { + subpriority = sprite->subpriority - 1; + } + else + { + subpriority = 0; + sprite->subpriority = 1; + } + + sub_8171D60(4); + for (i = 0; i < 3; i++) + { + u8 spriteId = CreateSprite(&gUnknown_085E51F0[4], sprite->pos1.x, sprite->pos1.y, subpriority); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].data[0] = 24; + gSprites[spriteId].data[2] = sprite->pos1.x + sBallCaptureSuccessStarData[i].xOffset; + gSprites[spriteId].data[4] = sprite->pos1.y + sBallCaptureSuccessStarData[i].yOffset; + gSprites[spriteId].data[5] = sBallCaptureSuccessStarData[i].unk2; + InitAnimArcTranslation(&gSprites[spriteId]); + gSprites[spriteId].callback = sub_8171AAC; + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[4]); + } + } +} + +static void sub_8171AAC(struct Sprite *sprite) +{ + sprite->invisible = !sprite->invisible; + if (TranslateAnimArc(sprite)) + DestroySprite(sprite); +} + +// fakematching. I think the return type of ItemIdToBallId() +// is wrong because of the weird required casting. +static void sub_8171AE4(struct Sprite *sprite) +{ + u8 ballId; + int ballId2; // extra var needed to match + + StartSpriteAnim(sprite, 1); + StartSpriteAffineAnim(sprite, 0); + sprite->callback = sub_8171BAC; + + ballId = ItemIdToBallId(gLastUsedItem); + ballId2 = ballId; + if (ballId2 > 11) + goto LABEL; + if (ballId2 < 0) + goto LABEL; + + AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballId); + LaunchBallFadeMonTask(1, gBattleAnimTarget, 14, ballId); + + LABEL: + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].invisible = 0; + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]], 1); + AnimateSprite(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]]); + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].data[1] = 0x1000; +} + +static void sub_8171BAC(struct Sprite *sprite) +{ + int next = FALSE; + + if (sprite->animEnded) + sprite->invisible = 1; + + if (gSprites[gBattlerSpriteIds[gBattleAnimTarget]].affineAnimEnded) + { + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]], 0); + next = TRUE; + } + else + { + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].data[1] -= 288; + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].pos2.y = gSprites[gBattlerSpriteIds[gBattleAnimTarget]].data[1] >> 8; + } + + if (sprite->animEnded && next) + { + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].pos2.y = 0; + gSprites[gBattlerSpriteIds[gBattleAnimTarget]].invisible = gBattleSpritesDataPtr->animationData->field_9_x2; + sprite->data[0] = 0; + sprite->callback = sub_81719C0; + gDoingBattleAnim = 0; + UpdateOamPriorityInAllHealthboxes(1); + } +} + +static void sub_8171CAC(struct Sprite *sprite) +{ + int i; + + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.y = 0; + sprite->pos2.x = 0; + for (i = 0; i < 6; i++) + sprite->data[i] = 0; + + sprite->callback = sub_8171CE8; +} + +static void sub_8171CE8(struct Sprite *sprite) +{ + s16 var0 = sprite->data[0] + 0x800; + s16 var1 = sprite->data[1] + 0x680; + sprite->pos2.x -= var1 >> 8; + sprite->pos2.y += var0 >> 8; + sprite->data[0] = (sprite->data[0] + 0x800) & 0xFF; + sprite->data[1] = (sprite->data[1] + 0x680) & 0xFF; + + if (sprite->pos1.y + sprite->pos2.y > 160 + || sprite->pos1.x + sprite->pos2.x < -8) + { + sprite->data[0] = 0; + sprite->callback = sub_81719C0; + gDoingBattleAnim = 0; + UpdateOamPriorityInAllHealthboxes(1); + } +} + +static void sub_8171D60(u8 ballId) +{ + u8 taskId; + + if (GetSpriteTileStartByTag(gBallOpenParticleSpritesheets[ballId].tag) == 0xFFFF) + { + LoadCompressedObjectPicUsingHeap(&gBallOpenParticleSpritesheets[ballId]); + LoadCompressedObjectPaletteUsingHeap(&gBallOpenParticlePalettes[ballId]); + } +} + +u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId) +{ + u8 taskId; + + sub_8171D60(ballId); + taskId = CreateTask(gBallOpenParticleAnimationFuncs[ballId], 5); + gTasks[taskId].data[1] = x; + gTasks[taskId].data[2] = y; + gTasks[taskId].data[3] = priority; + gTasks[taskId].data[4] = subpriority; + gTasks[taskId].data[15] = ballId; + PlaySE(SE_BOWA2); + + return taskId; +} + +void sub_8171E20(void) +{ + if (gMain.inBattle) + gBattleSpritesDataPtr->animationData->field_A++; +} + +static void PokeBallOpenParticleAnimation(u8 taskId) +{ + u8 spriteId; + u8 x, y; + u8 priority, subpriority; + u8 ballId; + u8 var0; + + ballId = gTasks[taskId].data[15]; + if (gTasks[taskId].data[0] < 16) + { + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = PokeBallOpenParticleAnimation_Step1; + gSprites[spriteId].oam.priority = priority; + + var0 = (u8)gTasks[taskId].data[0]; + if (var0 >= 8) + var0 -= 8; + + gSprites[spriteId].data[0] = var0 * 32; + } + + if (gTasks[taskId].data[0] == 15) + { + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); + return; + } + } + + gTasks[taskId].data[0]++; +} + +static void PokeBallOpenParticleAnimation_Step1(struct Sprite *sprite) +{ + if (sprite->data[1] == 0) + sprite->callback = PokeBallOpenParticleAnimation_Step2; + else + sprite->data[1]--; +} + +static void PokeBallOpenParticleAnimation_Step2(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], sprite->data[1]); + sprite->data[1] += 2; + if (sprite->data[1] == 50) + DestroyBallOpenAnimationParticle(sprite); +} + +static void TimerBallOpenParticleAnimation(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = FanOutBallOpenParticles_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 10; + gSprites[spriteId].data[5] = 2; + gSprites[spriteId].data[6] = 1; + } + } + + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); +} + +static void DiveBallOpenParticleAnimation(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = FanOutBallOpenParticles_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 10; + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 2; + } + } + + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); +} + +// Also used for Net Ball +static void SafariBallOpenParticleAnimation(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = FanOutBallOpenParticles_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 4; + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 1; + } + } + + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); +} + +// Also used for Nest Ball +static void UltraBallOpenParticleAnimation(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 10; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = FanOutBallOpenParticles_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 25; + gSprites[spriteId].data[4] = 5; + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 1; + } + } + + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); +} + +// Also used for Luxury Ball +static void GreatBallOpenParticleAnimation(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + if (gTasks[taskId].data[7]) + { + gTasks[taskId].data[7]--; + } + else + { + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = FanOutBallOpenParticles_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 8; + gSprites[spriteId].data[5] = 2; + gSprites[spriteId].data[6] = 2; + } + } + + gTasks[taskId].data[7] = 8; + if (++gTasks[taskId].data[0] == 2) + { + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); + } + } +} + +static void FanOutBallOpenParticles_Step1(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], sprite->data[2]); + sprite->data[0] = (sprite->data[0] + sprite->data[4]) & 0xFF; + sprite->data[1] += sprite->data[5]; + sprite->data[2] += sprite->data[6]; + if (++sprite->data[3] == 51) + DestroyBallOpenAnimationParticle(sprite); +} + +static void RepeatBallOpenParticleAnimation(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 12; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = RepeatBallOpenParticleAnimation_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 21; + } + } + + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); +} + +static void RepeatBallOpenParticleAnimation_Step1(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], Sin(sprite->data[0], sprite->data[2])); + sprite->data[0] = (sprite->data[0] + 6) & 0xFF; + sprite->data[1]++; + sprite->data[2]++; + if (++sprite->data[3] == 51) + DestroyBallOpenAnimationParticle(sprite); +} + +static void MasterBallOpenParticleAnimation(u8 taskId) +{ + u8 i, j; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (j = 0; j < 2; j++) + { + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = FanOutBallOpenParticles_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + gSprites[spriteId].data[4] = 8; + + if (j == 0) + { + gSprites[spriteId].data[5] = 2; + gSprites[spriteId].data[6] = 1; + } + else + { + gSprites[spriteId].data[5] = 1; + gSprites[spriteId].data[6] = 2; + } + } + } + } + + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); +} + +static void PremierBallOpenParticleAnimation(u8 taskId) +{ + u8 i; + u8 x, y, priority, subpriority, ballId; + u8 spriteId; + + ballId = gTasks[taskId].data[15]; + x = gTasks[taskId].data[1]; + y = gTasks[taskId].data[2]; + priority = gTasks[taskId].data[3]; + subpriority = gTasks[taskId].data[4]; + + for (i = 0; i < 8; i++) + { + spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority); + if (spriteId != MAX_SPRITES) + { + sub_8171E20(); + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]); + gSprites[spriteId].callback = PremierBallOpenParticleAnimation_Step1; + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].data[0] = i * 32; + } + } + + if (!gMain.inBattle) + gSprites[spriteId].data[7] = 1; + + DestroyTask(taskId); +} + +static void PremierBallOpenParticleAnimation_Step1(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[0], sprite->data[1]); + sprite->pos2.y = Cos(sprite->data[0], Sin(sprite->data[0] & 0x3F, sprite->data[2])); + sprite->data[0] = (sprite->data[0] + 10) & 0xFF; + sprite->data[1]++; + sprite->data[2]++; + if (++sprite->data[3] == 51) + DestroyBallOpenAnimationParticle(sprite); +} + +static void DestroyBallOpenAnimationParticle(struct Sprite *sprite) +{ + int i, j; + int temp; + + if (!gMain.inBattle) + { + temp = sprite->data[7]; // temp var needed to match + if (temp == 1) + DestroySpriteAndFreeResources(sprite); + else + DestroySprite(sprite); + } + else + { + gBattleSpritesDataPtr->animationData->field_A--; + if (gBattleSpritesDataPtr->animationData->field_A == 0) + { + for (i = 0; i < 12; i++) + { + if (FuncIsActiveTask(gBallOpenParticleAnimationFuncs[i]) == TRUE) + break; + } + + if (i == 12) + { + for (j = 0; j < 12; j++) + { + FreeSpriteTilesByTag(gBallOpenParticleSpritesheets[j].tag); + FreeSpritePaletteByTag(gBallOpenParticlePalettes[j].tag); + } + } + + DestroySprite(sprite); + } + else + { + DestroySprite(sprite); + } + } +} + +u8 LaunchBallFadeMonTask(u8 unfadeLater, u8 battler, u32 selectedPalettes, u8 ballId) +{ + u8 taskId; + + taskId = CreateTask(sub_8172AB0, 5); + gTasks[taskId].data[15] = ballId; + gTasks[taskId].data[3] = battler; + gTasks[taskId].data[10] = selectedPalettes; + gTasks[taskId].data[11] = selectedPalettes >> 16; + + if (!unfadeLater) + { + BlendPalette(battler * 16 + 0x100, 16, 0, gUnknown_085E5310[ballId]); + gTasks[taskId].data[1] = 1; + } + else + { + BlendPalette(battler * 16 + 0x100, 16, 16, gUnknown_085E5310[ballId]); + gTasks[taskId].data[0] = 16; + gTasks[taskId].data[1] = -1; + gTasks[taskId].func = sub_8172B40; + } + + BeginNormalPaletteFade(selectedPalettes, 0, 0, 16, RGB(31, 31, 31)); + return taskId; +} + +static void sub_8172AB0(u8 taskId) +{ + u8 ballId = gTasks[taskId].data[15]; + + if (gTasks[taskId].data[2] <= 16) + { + BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gUnknown_085E5310[ballId]); + gTasks[taskId].data[0] += gTasks[taskId].data[1]; + gTasks[taskId].data[2]++; + } + else if (!gPaletteFade.active) + { + u32 selectedPalettes = (u16)gTasks[taskId].data[10] | ((u16)gTasks[taskId].data[11] << 16); + BeginNormalPaletteFade(selectedPalettes, 0, 16, 0, RGB(31, 31, 31)); + DestroyTask(taskId); + } +} + +static void sub_8172B40(u8 taskId) +{ + if (!gPaletteFade.active) + { + u32 selectedPalettes = (u16)gTasks[taskId].data[10] | ((u16)gTasks[taskId].data[11] << 16); + BeginNormalPaletteFade(selectedPalettes, 0, 16, 0, RGB(31, 31, 31)); + gTasks[taskId].func = sub_8172B90; + } +} + +static void sub_8172B90(u8 taskId) +{ + u8 ballId = gTasks[taskId].data[15]; + + if (gTasks[taskId].data[2] <= 16) + { + BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gUnknown_085E5310[ballId]); + gTasks[taskId].data[0] += gTasks[taskId].data[1]; + gTasks[taskId].data[2]++; + } + else + { + DestroyTask(taskId); + } +} + +void sub_8172BF0(u8 taskId) +{ + u8 spriteId; + u32 x; + u32 done; + + done = FALSE; + spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + switch (gTasks[taskId].data[10]) + { + case 0: + gTasks[taskId].data[11] = gBattleAnimArgs[0]; + gTasks[taskId].data[0] += 0x500; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gSprites[spriteId].pos2.x += gTasks[taskId].data[0] >> 8; + else + gSprites[spriteId].pos2.x -= gTasks[taskId].data[0] >> 8; + + gTasks[taskId].data[0] &= 0xFF; + x = gSprites[spriteId].pos1.x + gSprites[spriteId].pos2.x + 32; + if (x > 304) + gTasks[taskId].data[10]++; + break; + case 1: + LoadBattleMonGfxAndAnimate(gBattleAnimAttacker, gTasks[taskId].data[11], spriteId); + gTasks[taskId].data[10]++; + break; + case 2: + gTasks[taskId].data[0] += 0x500; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gSprites[spriteId].pos2.x -= gTasks[taskId].data[0] >> 8; + else + gSprites[spriteId].pos2.x += gTasks[taskId].data[0] >> 8; + + gTasks[taskId].data[0] &= 0xFF; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + if (gSprites[spriteId].pos2.x <= 0) + { + gSprites[spriteId].pos2.x = 0; + // done = FALSE; // fakematching--can't get the tail merge correct + goto DONE; + } + } + else + { + if (gSprites[spriteId].pos2.x >= 0) + { + gSprites[spriteId].pos2.x = 0; + done = TRUE; + } + } + + if (done) + { + DONE: + DestroyAnimVisualTask(taskId); + } + break; + } +} + +void sub_8172D98(u8 taskId) +{ + u8 spriteId; + + switch (gTasks[taskId].data[15]) + { + case 0: + if (sub_80A8364(gBattleAnimAttacker) == B_POSITION_OPPONENT_LEFT) + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); + else + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0)); + gTasks[taskId].data[15]++; + break; + case 1: + if (gTasks[taskId].data[1]++ > 1) + { + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[0]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - gTasks[taskId].data[0], gTasks[taskId].data[0])); + if (gTasks[taskId].data[0] == 16) + gTasks[taskId].data[15]++; + } + break; + case 2: + spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; + RequestDma3Fill(0, (void *)OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * TILE_SIZE_4BPP, 0x800, 1); + ClearBehindSubstituteBit(gBattleAnimAttacker); + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_8172E9C(u8 taskId) +{ + gBattleAnimArgs[7] = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].behindSubstitute; + DestroyAnimVisualTask(taskId); +} + +void sub_8172ED0(u8 taskId) +{ + gBattleAnimTarget = gEffectBattler; + DestroyAnimVisualTask(taskId); +} + +void sub_8172EF0(u8 battler, struct Pokemon *mon) +{ + int isShiny; + u32 otId, personality; + u32 shinyValue; + u8 taskId1, taskId2; + + isShiny = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].flag_x80 = 1; + otId = GetMonData(mon, MON_DATA_OT_ID); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + + if (IsBattlerSpriteVisible(battler)) + { + shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); + if (shinyValue < 8) + isShiny = TRUE; + + if (isShiny) + { + if (GetSpriteTileStartByTag(0x27F9) == 0xFFFF) + { + LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[233]); + LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[233]); + } + + taskId1 = CreateTask(sub_8172FEC, 10); + taskId2 = CreateTask(sub_8172FEC, 10); + gTasks[taskId1].data[0] = battler; + gTasks[taskId2].data[0] = battler; + gTasks[taskId1].data[1] = 0; + gTasks[taskId2].data[1] = 1; + return; + } + } + + gBattleSpritesDataPtr->healthBoxesData[battler].field_1_x1 = 1; +} + +static void sub_8172FEC(u8 taskId) +{ + u8 battler; + u8 x, y; + u8 spriteId; + u16 counter; + s16 state; + u8 pan; + + if (gTasks[taskId].data[13] < 60) + { + gTasks[taskId].data[13]++; + return; + } + + if (gBattleSpritesDataPtr->animationData->field_A) + return; + + counter = gTasks[taskId].data[10]++; + if (counter & 3) + return; + + battler = gTasks[taskId].data[0]; + x = GetBattlerSpriteCoord(battler, 0); + y = GetBattlerSpriteCoord(battler, 1); + state = gTasks[taskId].data[11]; + if (state == 0) + { + spriteId = CreateSprite(&gUnknown_085CE388, x, y, 5); + } + else if (state >= 0 && gTasks[taskId].data[11] < 4) + { + spriteId = CreateSprite(&gUnknown_085CE3A0, x, y, 5); + gSprites[spriteId].oam.tileNum += 4; + } + else + { + spriteId = CreateSprite(&gUnknown_085CE3A0, x, y, 5); + gSprites[spriteId].oam.tileNum += 5; + } + + if (gTasks[taskId].data[1] == 0) + { + gSprites[spriteId].callback = sub_81731FC; + } + else + { + gSprites[spriteId].callback = sub_8173250; + gSprites[spriteId].pos2.x = -32; + gSprites[spriteId].pos2.y = 32; + gSprites[spriteId].invisible = 1; + if (gTasks[taskId].data[11] == 0) + { + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + pan = 192; + else + pan = 63; + + PlaySE12WithPanning(SE_REAPOKE, pan); + } + } + + gSprites[spriteId].data[0] = taskId; + gTasks[taskId].data[11]++; + if (spriteId != MAX_SPRITES) + gTasks[taskId].data[12]++; + + if (gTasks[taskId].data[11] == 5) + gTasks[taskId].func = sub_81731B0; +} + +static void sub_81731B0(u8 taskId) +{ + u8 battler; + + if (gTasks[taskId].data[12] == 0) + { + if (gTasks[taskId].data[1] == 1) + { + battler = gTasks[taskId].data[0]; + gBattleSpritesDataPtr->healthBoxesData[battler].field_1_x1 = 1; + } + + DestroyTask(taskId); + } +} + +static void sub_81731FC(struct Sprite *sprite) +{ + sprite->pos2.x = Sin(sprite->data[1], 24); + sprite->pos2.y = Cos(sprite->data[1], 24); + sprite->data[1] += 12; + if (sprite->data[1] > 0xFF) + { + gTasks[sprite->data[0]].data[12]--; + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); + } +} + +static void sub_8173250(struct Sprite *sprite) +{ + if (sprite->data[1] < 4) + { + sprite->data[1]++; + } + else + { + sprite->invisible = 0; + sprite->pos2.x += 5; + sprite->pos2.y -= 5; + if (sprite->pos2.x > 32) + { + gTasks[sprite->data[0]].data[12]--; + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); + } + } +} + +void sub_81732B0(u8 taskId) +{ + u8 paletteIndex; + + LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[269]); + LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[269]); + paletteIndex = IndexOfSpritePaletteTag(0x281D); // unused + DestroyAnimVisualTask(taskId); +} + +void sub_81732E4(u8 taskId) +{ + FreeSpriteTilesByTag(0x281D); + FreeSpritePaletteByTag(0x281D); + DestroyAnimVisualTask(taskId); +} + +static void sub_817330C(struct Sprite *sprite) +{ + InitAnimSpritePos(sprite, 0); + sprite->data[0] = 30; + sprite->data[2] = GetBattlerSpriteCoord(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), 0) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), 1) + gBattleAnimArgs[3]; + sprite->data[5] = -32; + InitAnimArcTranslation(sprite); + gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].callback = sub_8039E84; + sprite->callback = sub_817339C; +} + +static void sub_817339C(struct Sprite *sprite) +{ + if (gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].animCmdIndex == 1) + sprite->callback = sub_81733D4; +} + +static void sub_81733D4(struct Sprite *sprite) +{ + if (TranslateAnimArc(sprite)) + { + sprite->data[0] = 0; + sprite->invisible = 1; + sprite->callback = sub_8173400; + } +} + +static void sub_8173400(struct Sprite *sprite) +{ + if (gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].animEnded) + { + if (++sprite->data[0] > 0) + { + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], 0); + DestroyAnimSprite(sprite); + } + } +} + +void sub_817345C(u8 taskId) +{ + switch (gBattleAnimArgs[0]) + { + case 0: + gBattleAnimAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gBattleAnimTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + break; + case 1: + gBattleAnimAttacker = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + gBattleAnimTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + break; + } + + DestroyAnimVisualTask(taskId); +} + +void AnimTask_GetTrappedMoveAnimId(u8 taskId) +{ + if (gBattleSpritesDataPtr->animationData->animArg == 83) + gBattleAnimArgs[0] = 1; + else if (gBattleSpritesDataPtr->animationData->animArg == 250) + gBattleAnimArgs[0] = 2; + else if (gBattleSpritesDataPtr->animationData->animArg == 128) + gBattleAnimArgs[0] = 3; + else if (gBattleSpritesDataPtr->animationData->animArg == 328) + gBattleAnimArgs[0] = 4; + else + gBattleAnimArgs[0] = 0; + + DestroyAnimVisualTask(taskId); +} + +void sub_817351C(u8 taskId) +{ + gBattleAnimAttacker = gBattleSpritesDataPtr->animationData->animArg; + gBattleAnimTarget = gBattleSpritesDataPtr->animationData->animArg >> 8; + DestroyAnimVisualTask(taskId); +} diff --git a/src/battle_intro.c b/src/battle_intro.c index 91e7c8ea0..736e35a87 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -250,12 +250,7 @@ static void BattleIntroSlide2(u8 taskId) if (gTasks[taskId].data[1] == 4) { - u16 *bg1Y = &gBattle_BG1_Y; - int cos = Cos2(gTasks[taskId].data[6]); - if (cos < 0) - cos += 0x1FF; - *bg1Y = (cos >> 9) - 8; - + gBattle_BG1_Y = Cos2(gTasks[taskId].data[6]) / 512 - 8; if (gTasks[taskId].data[6] < 180) gTasks[taskId].data[6] += 4; else diff --git a/src/pokeball.c b/src/pokeball.c index ad839e6af..82d2f2cea 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -426,7 +426,7 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite) sprite->pos2.y = 0; sprite->data[5] = 0; ballId = ItemIdToBallId(GetBattlerPokeballItemId(opponentBattler)); - LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId); + AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId); sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBattler, 14, ballId); sprite->sBattler = opponentBattler; sprite->data[7] = noOfShakes; @@ -737,7 +737,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) StartSpriteAnim(sprite, 1); ballId = ItemIdToBallId(GetBattlerPokeballItemId(battlerId)); - LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId); + AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId); sprite->data[0] = LaunchBallFadeMonTask(1, sprite->sBattler, 14, ballId); sprite->callback = HandleBallAnimEnd; @@ -985,9 +985,9 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite) #undef sBattler -static u8 LaunchBallStarsTaskForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d) +static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d) { - return LaunchBallStarsTask(x, y, kindOfStars, d, BALL_POKE); + return AnimateBallOpenParticles(x, y, kindOfStars, d, BALL_POKE); } static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 arg2) @@ -1036,7 +1036,7 @@ static void sub_8076524(struct Sprite *sprite) r5 = 0; StartSpriteAnim(sprite, 1); - LaunchBallStarsTaskForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5); + AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5); sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4); sprite->callback = sub_80765E0; gSprites[r7].invisible = FALSE; @@ -1129,7 +1129,7 @@ static void sub_80767D4(struct Sprite *sprite) r6 = 0; StartSpriteAnim(sprite, 1); - LaunchBallStarsTaskForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r6); + AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r6); sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, r8, r5); sprite->callback = sub_807687C; StartSpriteAffineAnim(&gSprites[r7], 2); diff --git a/src/pokemon.c b/src/pokemon.c index eec995050..22b92870c 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -45,12 +45,6 @@ struct SpeciesItem u16 item; }; -// Extracts the upper 16 bits of a 32-bit number -#define HIHALF(n) (((n) & 0xFFFF0000) >> 16) - -// Extracts the lower 16 bits of a 32-bit number -#define LOHALF(n) ((n) & 0xFFFF) - extern const struct OamData gUnknown_0831ACB0; extern const struct OamData gUnknown_0831ACA8; extern const struct SpriteFrameImage gUnknown_082FF3A8[]; @@ -6707,12 +6701,6 @@ const u32 *GetMonFrontSpritePal(struct Pokemon *mon) return GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality); } -// Extracts the upper 16 bits of a 32-bit number -#define HIHALF(n) (((n) & 0xFFFF0000) >> 16) - -// Extracts the lower 16 bits of a 32-bit number -#define LOHALF(n) ((n) & 0xFFFF) - const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality) { u32 shinyValue; diff --git a/sym_common.txt b/sym_common.txt index e8d1654c0..bb84ec06e 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -77,16 +77,7 @@ gDexCryScreenState: @ 30061EC .include "save.o" .include "battle_tower.o" .include "intro.o" - -gUnknown_030062DC: @ 30062DC - .space 0x4 - -gUnknown_030062E0: @ 30062E0 - .space 0x4 - -gUnknown_030062E4: @ 30062E4 - .space 0x4 - + .include "battle_anim_8170478.o" .include "battle_factory_screen.o" .include "apprentice.o" From 2fa0555ed582a108e628da7a787de346a614c15c Mon Sep 17 00:00:00 2001 From: Slawter666 <38655737+Slawter666@users.noreply.github.com> Date: Sat, 15 Dec 2018 18:08:13 +0000 Subject: [PATCH 04/13] Document some of item_menu.c --- include/item_menu.h | 19 ++--- src/item.c | 2 +- src/item_menu.c | 172 +++++++++++++++++++++--------------------- src/item_menu_icons.c | 32 ++++---- src/item_use.c | 13 ++-- 5 files changed, 119 insertions(+), 119 deletions(-) diff --git a/include/item_menu.h b/include/item_menu.h index 4631382cb..ce439e282 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -32,10 +32,10 @@ extern struct BagStruct gUnknown_0203CE58; struct UnkBagStruct { - void (*unk0)(void); - u8 unk4[0x800]; - u8 unk804[12]; - u8 unk810[7]; + void (*mainCallback2)(void); + u8 tilemapBuffer[0x800]; + u8 spriteId[12]; + u8 windowPointers[7]; u8 unk817; u8 unk818; u8 unk819; @@ -43,7 +43,7 @@ struct UnkBagStruct u8 unk81B:4; u8 unk81B_1:2; u8 unk81B_3:1; - u8 unk81B_2:1; + u8 hideCloseBagText:1; u8 filler3[2]; u8 unk81E; u8 unk81F; @@ -52,11 +52,11 @@ struct UnkBagStruct u8 unk825; u8 filler[2]; u8 unk828; - u8 unk829[POCKETS_COUNT]; - u8 unk82E[6]; + u8 numItemStacks[POCKETS_COUNT]; + u8 numShownItems[6]; s16 unk834; u8 filler4[0xE]; - u8 unk844[32][32]; + u8 pocketNameBuffer[32][32]; u8 filler2[4]; }; @@ -71,9 +71,10 @@ void sub_81AAC14(void); void sub_81AAC50(void); void sub_81AAC70(void); void sub_81AAC28(void); +void SetInitialScrollAndCursorPositions(u8 pocketId); void bag_menu_mail_related(void); void CB2_BagMenuFromStartMenu(void); -u8 sub_81ABB2C(u8 pocketId); +u8 GetItemListPosition(u8 pocketId); bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); diff --git a/src/item.c b/src/item.c index 6a1f1955a..71c2dc0f7 100644 --- a/src/item.c +++ b/src/item.c @@ -543,7 +543,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count) VarSet(VAR_0x40ED, itemId); } - var = sub_81ABB2C(pocket); + var = GetItemListPosition(pocket); if (itemPocket->capacity > var && itemPocket->itemSlots[var].itemId == itemId) { diff --git a/src/item_menu.c b/src/item_menu.c index 40d09a8a1..32c42ac31 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -57,7 +57,7 @@ bool8 load_bag_menu_graphics(void); void setup_bag_menu_textboxes(void); void allocate_bag_item_list_buffers(void); void load_bag_item_list_buffers(u8); -void bag_menu_print_pocket_names(u8*, u8*); +void bag_menu_print_pocket_names(const u8*, const u8*); void bag_menu_copy_pocket_name_to_window(u32); void bag_menu_draw_pocket_indicator_square(u8, u8); void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void); @@ -69,7 +69,6 @@ void Task_BagMenu(u8); void get_name(s8*, u16); u16 ItemIdToBattleMoveId(u16); u16 BagGetItemIdByPocketPosition(u8, u16); -void AddBagItemIconSprite(u16, u8); void bag_menu_print_description_box_text(int); void bag_menu_print_cursor(u8, u8); void bag_menu_print(u8, u8, const u8*, u8, u8, u8, u8, u8, u8); @@ -121,7 +120,7 @@ void bag_menu_leave_maybe_3(void); void bag_menu_leave_maybe_2(void); void bag_menu_leave_maybe(void); void sub_81ABA6C(void); -void sub_81ABAC4(void); +static void SetPocketListPositions(void); void sub_81ABAE0(void); u8 sub_81AB1F0(u8); void sub_81AC23C(u8); @@ -151,7 +150,7 @@ void sub_81AD6FC(u8 taskId); // .rodata -const struct BgTemplate gUnknown_08613F90[3] = +static const struct BgTemplate sBgTemplates_ItemMenu[3] = { { .bg = 0, @@ -182,7 +181,7 @@ const struct BgTemplate gUnknown_08613F90[3] = }, }; -const struct ListMenuTemplate gUnknown_08613F9C = +static const struct ListMenuTemplate sItemListMenu = { .items = NULL, .moveCursorFunc = bag_menu_change_item_callback, @@ -258,7 +257,8 @@ const struct ScrollArrowsTemplate gUnknown_08614094 = {SCROLL_ARROW_LEFT, 0x1C, const u8 gUnknown_086140A4[] = INCBIN_U8("graphics/interface/select_button.4bpp"); -const u8 gUnknown_08614164[][3] = { +static const u8 sFontColorTable[][3] = { +// bgColor, textColor, shadowColor {0, 1, 3}, {0, 1, 4}, {0, 3, 6}, @@ -268,7 +268,7 @@ const u8 gUnknown_08614164[][3] = { const struct WindowTemplate gUnknown_08614174[] = { - { + { // Item names .bg = 0, .tilemapLeft = 14, .tilemapTop = 2, @@ -277,7 +277,7 @@ const struct WindowTemplate gUnknown_08614174[] = .paletteNum = 1, .baseBlock = 0x27, }, - { + { // Description .bg = 0, .tilemapLeft = 0, .tilemapTop = 13, @@ -286,7 +286,7 @@ const struct WindowTemplate gUnknown_08614174[] = .paletteNum = 1, .baseBlock = 0x117, }, - { + { // Pocket name .bg = 0, .tilemapLeft = 4, .tilemapTop = 1, @@ -295,7 +295,7 @@ const struct WindowTemplate gUnknown_08614174[] = .paletteNum = 1, .baseBlock = 0x1A1, }, - { + { // TM/HM info icons .bg = 0, .tilemapLeft = 1, .tilemapTop = 13, @@ -304,7 +304,7 @@ const struct WindowTemplate gUnknown_08614174[] = .paletteNum = 12, .baseBlock = 0x16B, }, - { + {// TM/HM info .bg = 0, .tilemapLeft = 7, .tilemapTop = 13, @@ -313,7 +313,7 @@ const struct WindowTemplate gUnknown_08614174[] = .paletteNum = 12, .baseBlock = 0x189, }, - { + { // Field message box .bg = 1, .tilemapLeft = 2, .tilemapTop = 15, @@ -440,16 +440,14 @@ struct TempWallyStruct { EWRAM_DATA struct UnkBagStruct *gUnknown_0203CE54 = 0; EWRAM_DATA struct BagStruct gUnknown_0203CE58 = {0}; -EWRAM_DATA struct ListBuffer1 *gUnknown_0203CE74 = 0; -EWRAM_DATA struct ListBuffer2 *gUnknown_0203CE78 = 0; +static EWRAM_DATA struct ListBuffer1 *sListBuffer1 = 0; +static EWRAM_DATA struct ListBuffer2 *sListBuffer2 = 0; EWRAM_DATA u16 gSpecialVar_ItemId = 0; -EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0; +static EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0; -extern u8 *gPocketNamesStringsTable[]; -extern struct ListMenuTemplate gUnknown_08613F9C; +extern u8 *const gPocketNamesStringsTable[]; extern const u8 gMoveNames[][0xD]; extern u8* gReturnToXStringsTable[]; -extern u32 gUnknown_0203CE5E[]; extern const u8 EventScript_2736B3[]; extern const u16 gUnknown_0860F074[]; @@ -531,12 +529,12 @@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2) temp = gUnknown_0203CE58.location - (POCKETS_COUNT - 1); if (temp <= 1) gUnknown_0203CE54->unk81B = 1; - gUnknown_0203CE54->unk0 = 0; + gUnknown_0203CE54->mainCallback2 = 0; gUnknown_0203CE54->unk81A = 0xFF; gUnknown_0203CE54->unk81E = -1; gUnknown_0203CE54->unk81F = -1; - memset(gUnknown_0203CE54->unk804, 0xFF, sizeof(gUnknown_0203CE54->unk804)); - memset(gUnknown_0203CE54->unk810, 0xFF, 10); + memset(gUnknown_0203CE54->spriteId, 0xFF, sizeof(gUnknown_0203CE54->spriteId)); + memset(gUnknown_0203CE54->windowPointers, 0xFF, 10); SetMainCallback2(CB2_Bag); } } @@ -615,7 +613,7 @@ bool8 setup_bag_menu(void) break; case 10: sub_81ABA6C(); - sub_81ABAC4(); + SetPocketListPositions(); sub_81ABAE0(); gMain.state++; break; @@ -677,10 +675,10 @@ bool8 setup_bag_menu(void) void bag_menu_init_bgs(void) { ResetVramOamAndBgCntRegs(); - memset(gUnknown_0203CE54->unk4, 0, 0x800); + memset(gUnknown_0203CE54->tilemapBuffer, 0, 0x800); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, gUnknown_08613F90, 3); - SetBgTilemapBuffer(2, gUnknown_0203CE54->unk4); + InitBgsFromTemplates(0, sBgTemplates_ItemMenu, 3); + SetBgTilemapBuffer(2, gUnknown_0203CE54->tilemapBuffer); ResetAllBgsCoordinates(); schedule_bg_copy_tilemap_to_vram(2); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); @@ -702,7 +700,7 @@ bool8 load_bag_menu_graphics(void) case 1: if (free_temp_tile_data_buffers_if_possible() != TRUE) { - LZDecompressWram(gUnknown_08D9A88C, gUnknown_0203CE54->unk4); + LZDecompressWram(gUnknown_08D9A88C, gUnknown_0203CE54->tilemapBuffer); gUnknown_0203CE54->unk834++; } break; @@ -744,8 +742,8 @@ u8 sub_81AB1F0(u8 a) void allocate_bag_item_list_buffers(void) { - gUnknown_0203CE74 = Alloc(sizeof(struct ListBuffer1)); - gUnknown_0203CE78 = Alloc(sizeof(struct ListBuffer2)); + sListBuffer1 = Alloc(sizeof(struct ListBuffer1)); + sListBuffer2 = Alloc(sizeof(struct ListBuffer2)); } void load_bag_item_list_buffers(u8 pocketId) @@ -754,34 +752,34 @@ void load_bag_item_list_buffers(u8 pocketId) struct BagPocket *pocket = &gBagPockets[pocketId]; struct ListMenuItem *subBuffer; - if (!gUnknown_0203CE54->unk81B_2) + if (!gUnknown_0203CE54->hideCloseBagText) { - for (i = 0; i < gUnknown_0203CE54->unk829[pocketId] - 1; i++) + for (i = 0; i < gUnknown_0203CE54->numItemStacks[pocketId] - 1; i++) { - get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId); - subBuffer = gUnknown_0203CE74->subBuffers; - subBuffer[i].name = gUnknown_0203CE78->name[i]; + get_name(sListBuffer2->name[i], pocket->itemSlots[i].itemId); + subBuffer = sListBuffer1->subBuffers; + subBuffer[i].name = sListBuffer2->name[i]; subBuffer[i].id = i; } - StringCopy(gUnknown_0203CE78->name[i], gText_CloseBag); - subBuffer = gUnknown_0203CE74->subBuffers; - subBuffer[i].name = gUnknown_0203CE78->name[i]; + StringCopy(sListBuffer2->name[i], gText_CloseBag); + subBuffer = sListBuffer1->subBuffers; + subBuffer[i].name = sListBuffer2->name[i]; subBuffer[i].id = -2; } else { - for (i = 0; i < gUnknown_0203CE54->unk829[pocketId]; i++) + for (i = 0; i < gUnknown_0203CE54->numItemStacks[pocketId]; i++) { - get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId); - subBuffer = gUnknown_0203CE74->subBuffers; - subBuffer[i].name = gUnknown_0203CE78->name[i]; + get_name(sListBuffer2->name[i], pocket->itemSlots[i].itemId); + subBuffer = sListBuffer1->subBuffers; + subBuffer[i].name = sListBuffer2->name[i]; subBuffer[i].id = i; } } - gMultiuseListMenuTemplate = gUnknown_08613F9C; - gMultiuseListMenuTemplate.totalItems = gUnknown_0203CE54->unk829[pocketId]; - gMultiuseListMenuTemplate.items = gUnknown_0203CE74->subBuffers; - gMultiuseListMenuTemplate.maxShowed = gUnknown_0203CE54->unk82E[pocketId]; + gMultiuseListMenuTemplate = sItemListMenu; + gMultiuseListMenuTemplate.totalItems = gUnknown_0203CE54->numItemStacks[pocketId]; + gMultiuseListMenuTemplate.items = sListBuffer1->subBuffers; + gMultiuseListMenuTemplate.maxShowed = gUnknown_0203CE54->numShownItems[pocketId]; } void get_name(s8 *dest, u16 itemId) @@ -907,7 +905,7 @@ void bag_menu_print_cursor(u8 a, u8 b) void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void) { if (gUnknown_0203CE54->unk81E == 0xFF) - gUnknown_0203CE54->unk81E = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xAC, 12, 0x94, gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - gUnknown_0203CE54->unk82E[gUnknown_0203CE58.pocket], 0x6E, 0x6E, &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]); + gUnknown_0203CE54->unk81E = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xAC, 12, 0x94, gUnknown_0203CE54->numItemStacks[gUnknown_0203CE58.pocket] - gUnknown_0203CE54->numShownItems[gUnknown_0203CE58.pocket], 0x6E, 0x6E, &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]); } void sub_81AB824(void) @@ -937,8 +935,8 @@ void sub_81AB89C(void) void free_bag_item_list_buffers(void) { - Free(gUnknown_0203CE78); - Free(gUnknown_0203CE74); + Free(sListBuffer2); + Free(sListBuffer1); FreeAllWindowBuffers(); Free(gUnknown_0203CE54); } @@ -955,8 +953,8 @@ void task_close_bag_menu_2(u8 taskId) if (!gPaletteFade.active) { DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); - if (gUnknown_0203CE54->unk0 != 0) - SetMainCallback2(gUnknown_0203CE54->unk0); + if (gUnknown_0203CE54->mainCallback2 != 0) + SetMainCallback2(gUnknown_0203CE54->mainCallback2); else SetMainCallback2(gUnknown_0203CE58.bagCallback); sub_81AB824(); @@ -981,15 +979,17 @@ void sub_81AB9A8(u8 pocketId) CompactItemsInBagPocket(pocket); break; } - gUnknown_0203CE54->unk829[pocketId] = 0; + gUnknown_0203CE54->numItemStacks[pocketId] = 0; for (i = 0; i < pocket->capacity && pocket->itemSlots[i].itemId; i++) - gUnknown_0203CE54->unk829[pocketId]++; - if (!gUnknown_0203CE54->unk81B_2) - gUnknown_0203CE54->unk829[pocketId]++; - if (gUnknown_0203CE54->unk829[pocketId] > 8) - gUnknown_0203CE54->unk82E[pocketId] = 8; + gUnknown_0203CE54->numItemStacks[pocketId]++; + + if (!gUnknown_0203CE54->hideCloseBagText) + gUnknown_0203CE54->numItemStacks[pocketId]++; + + if (gUnknown_0203CE54->numItemStacks[pocketId] > 8) + gUnknown_0203CE54->numShownItems[pocketId] = 8; else - gUnknown_0203CE54->unk82E[pocketId] = gUnknown_0203CE54->unk829[pocketId]; + gUnknown_0203CE54->numShownItems[pocketId] = gUnknown_0203CE54->numItemStacks[pocketId]; } void sub_81ABA6C(void) @@ -999,26 +999,26 @@ void sub_81ABA6C(void) sub_81AB9A8(i); } -void sub_81ABA88(u8 a) +void SetInitialScrollAndCursorPositions(u8 pocketId) { - sub_812225C(&gUnknown_0203CE58.scrollPosition[a], &gUnknown_0203CE58.cursorPosition[a], gUnknown_0203CE54->unk82E[a], gUnknown_0203CE54->unk829[a]); + sub_812225C(&gUnknown_0203CE58.scrollPosition[pocketId], &gUnknown_0203CE58.cursorPosition[pocketId], gUnknown_0203CE54->numShownItems[pocketId], gUnknown_0203CE54->numItemStacks[pocketId]); } -void sub_81ABAC4(void) +static void SetPocketListPositions(void) { u8 i; for (i = 0; i < POCKETS_COUNT; i++) - sub_81ABA88(i); + SetInitialScrollAndCursorPositions(i); } void sub_81ABAE0(void) { u8 i; for (i = 0; i < POCKETS_COUNT; i++) - sub_8122298(&gUnknown_0203CE58.scrollPosition[i], &gUnknown_0203CE58.cursorPosition[i], gUnknown_0203CE54->unk82E[i], gUnknown_0203CE54->unk829[i], 8); + sub_8122298(&gUnknown_0203CE58.scrollPosition[i], &gUnknown_0203CE58.cursorPosition[i], gUnknown_0203CE54->numShownItems[i], gUnknown_0203CE54->numItemStacks[i], 8); } -u8 sub_81ABB2C(u8 pocketId) +u8 GetItemListPosition(u8 pocketId) { return gUnknown_0203CE58.scrollPosition[pocketId] + gUnknown_0203CE58.cursorPosition[pocketId]; } @@ -1041,7 +1041,7 @@ void bag_menu_inits_lists_menu(u8 taskId) bag_menu_RemoveBagItem_message_window(4); DestroyListMenuTask(data[0], scrollPos, cursorPos); sub_81AB9A8(gUnknown_0203CE58.pocket); - sub_81ABA88(gUnknown_0203CE58.pocket); + SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket); load_bag_item_list_buffers(gUnknown_0203CE58.pocket); data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); schedule_bg_copy_tilemap_to_vram(0); @@ -1092,7 +1092,7 @@ void Task_BagMenu(u8 taskId) if (sub_81AC2C0() == 1) { ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos); - if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 1) + if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->numItemStacks[gUnknown_0203CE58.pocket] - 1) { PlaySE(SE_SELECT); bag_menu_swap_items(taskId); @@ -1102,13 +1102,13 @@ void Task_BagMenu(u8 taskId) } else { - int r4 = ListMenuHandleInputGetItemId(data[0]); + int listPosition = ListMenuHandleInputGetItemId(data[0]); ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos); - switch (r4) + switch (listPosition) { - case -1: + case LIST_NOTHING_CHOSEN: break; - case -2: + case LIST_B_PRESSED: if (gUnknown_0203CE58.location == 5) { PlaySE(SE_HAZURE); @@ -1118,13 +1118,13 @@ void Task_BagMenu(u8 taskId) gSpecialVar_ItemId = select; gTasks[taskId].func = unknown_ItemMenu_Confirm; break; - default: + default: // A_BUTTON PlaySE(SE_SELECT); sub_81AB824(); bag_menu_print_cursor_(data[0], 2); - data[1] = r4; - data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); - gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); + data[1] = listPosition; + data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, listPosition); + gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, listPosition); gUnknown_08614054[gUnknown_0203CE58.location](taskId); break; } @@ -1186,7 +1186,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3) ClearWindowTilemap(1); DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); schedule_bg_copy_tilemap_to_vram(0); - gSprites[gUnknown_0203CE54->unk804[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = TRUE; + gSprites[gUnknown_0203CE54->spriteId[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = TRUE; sub_81AB824(); } pocketId = gUnknown_0203CE58.pocket; @@ -1744,7 +1744,7 @@ void Task_ActuallyToss(u8 taskId) RemoveBagItem(gSpecialVar_ItemId, data[8]); DestroyListMenuTask(data[0], scrollPos, cursorPos); sub_81AB9A8(gUnknown_0203CE58.pocket); - sub_81ABA88(gUnknown_0203CE58.pocket); + SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket); load_bag_item_list_buffers(gUnknown_0203CE58.pocket); data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); schedule_bg_copy_tilemap_to_vram(0); @@ -1782,7 +1782,7 @@ void ItemMenu_Give(u8 taskId) bag_menu_print_there_is_no_pokemon(taskId); else { - gUnknown_0203CE54->unk0 = sub_81B7F60; + gUnknown_0203CE54->mainCallback2 = sub_81B7F60; unknown_ItemMenu_Confirm(taskId); } } @@ -1815,7 +1815,7 @@ void sub_81AD350(u8 taskId) void ItemMenu_CheckTag(u8 taskId) { - gUnknown_0203CE54->unk0 = DoBerryTagScreen; + gUnknown_0203CE54->mainCallback2 = DoBerryTagScreen; unknown_ItemMenu_Confirm(taskId); } @@ -2012,7 +2012,7 @@ void sub_81AD8C8(u8 taskId) AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]); DestroyListMenuTask(data[0], scrollPos, cursorPos); sub_81AB9A8(gUnknown_0203CE58.pocket); - sub_81ABA88(gUnknown_0203CE58.pocket); + SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket); load_bag_item_list_buffers(gUnknown_0203CE58.pocket); data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); bag_menu_print_cursor_(data[0], 2); @@ -2235,7 +2235,7 @@ void bag_menu_leave_maybe(void) SetMainCallback2(CB2_ReturnToField); } -void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2) +void bag_menu_print_pocket_names(const u8 *pocketName1, const u8 *pocketName2) { struct WindowTemplate window = {0, 0, 0, 0, 0, 0, 0}; u16 windowId; @@ -2252,7 +2252,7 @@ void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2) offset = GetStringCenterAlignXOffset(1, pocketName2, 0x40); bag_menu_print(windowId, 1, pocketName2, offset + 0x40, 1, 0, 0, -1, 1); } - CpuCopy32((u8*)GetWindowAttribute(windowId, WINDOW_TILE_DATA), gUnknown_0203CE54->unk844, 0x400); + CpuCopy32((u8*)GetWindowAttribute(windowId, WINDOW_TILE_DATA), gUnknown_0203CE54->pocketNameBuffer, 0x400); RemoveWindow(windowId); } @@ -2263,7 +2263,7 @@ void bag_menu_copy_pocket_name_to_window(u32 a) int b; if (a > 8) a = 8; - r4 = &gUnknown_0203CE54->unk844; + r4 = &gUnknown_0203CE54->pocketNameBuffer; windowAttribute = (u8*)GetWindowAttribute(2, WINDOW_TILE_DATA); CpuCopy32(r4[0][a], windowAttribute, 0x100); b = a + 16; @@ -2292,17 +2292,17 @@ void setup_bag_menu_textboxes(void) void bag_menu_print(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 h) { - AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, gUnknown_08614164[h], speed, str); + AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, sFontColorTable[h], speed, str); } u8 sub_81AE124(u8 a) { - return gUnknown_0203CE54->unk810[a]; + return gUnknown_0203CE54->windowPointers[a]; } u8 bag_menu_add_window(u8 a) { - u8 *ptr = &gUnknown_0203CE54->unk810[a]; + u8 *ptr = &gUnknown_0203CE54->windowPointers[a]; if (*ptr == 0xFF) { *ptr = AddWindow(&gUnknown_086141AC[a]); @@ -2314,7 +2314,7 @@ u8 bag_menu_add_window(u8 a) void bag_menu_remove_window(u8 a) { - u8 *ptr = &gUnknown_0203CE54->unk810[a]; + u8 *ptr = &gUnknown_0203CE54->windowPointers[a]; if (*ptr != 0xFF) { sub_8198070(*ptr, 0); @@ -2327,7 +2327,7 @@ void bag_menu_remove_window(u8 a) u8 AddItemMessageWindow(u8 a) { - u8 *ptr = &gUnknown_0203CE54->unk810[a]; + u8 *ptr = &gUnknown_0203CE54->windowPointers[a]; if (*ptr == 0xFF) *ptr = AddWindow(&gUnknown_086141AC[a]); return *ptr; @@ -2335,7 +2335,7 @@ u8 AddItemMessageWindow(u8 a) void bag_menu_RemoveBagItem_message_window(u8 a) { - u8 *ptr = &gUnknown_0203CE54->unk810[a]; + u8 *ptr = &gUnknown_0203CE54->windowPointers[a]; if (*ptr != 0xFF) { sub_8197DF8(*ptr, 0); diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index 85b42b9b3..894574ec9 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -1,14 +1,14 @@ #include "global.h" -#include "sprite.h" +#include "berry.h" #include "decompress.h" +#include "graphics.h" +#include "item.h" #include "item_menu.h" #include "item_icon.h" #include "item_menu_icons.h" -#include "window.h" #include "menu_helpers.h" -#include "berry.h" -#include "graphics.h" -#include "item.h" +#include "sprite.h" +#include "window.h" #include "constants/items.h" struct CompressedTilesPal @@ -199,7 +199,7 @@ static const struct SpritePalette gUnknown_0857FBA8 = gUnknown_0857F564, 101 }; -static const struct SpriteTemplate gUnknown_0857FBB0 = +static const struct SpriteTemplate gSpriteTemplate_RotatingBall = { .tileTag = 101, .paletteTag = 101, @@ -409,7 +409,7 @@ static const struct SpriteTemplate gUnknown_0857FE10 = // code void RemoveBagSprite(u8 id) { - u8 *spriteId = &gUnknown_0203CE54->unk804[id]; + u8 *spriteId = &gUnknown_0203CE54->spriteId[id]; if (*spriteId != 0xFF) { FreeSpriteTilesByTag(id + 100); @@ -422,14 +422,14 @@ void RemoveBagSprite(u8 id) void AddBagVisualSprite(u8 bagPocketId) { - u8 *spriteId = &gUnknown_0203CE54->unk804[0]; + u8 *spriteId = &gUnknown_0203CE54->spriteId[0]; *spriteId = CreateSprite(&gUnknown_0857FB4C, 68, 66, 0); SetBagVisualPocketId(bagPocketId, FALSE); } void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets) { - struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]]; + struct Sprite *sprite = &gSprites[gUnknown_0203CE54->spriteId[0]]; if (isSwitchingPockets) { sprite->pos2.y = -5; @@ -458,7 +458,7 @@ static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite) void ShakeBagVisual(void) { - struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]]; + struct Sprite *sprite = &gSprites[gUnknown_0203CE54->spriteId[0]]; if (sprite->affineAnimEnded) { StartSpriteAffineAnim(sprite, 1); @@ -477,10 +477,10 @@ static void SpriteCB_ShakeBagVisual(struct Sprite *sprite) void AddSwitchPocketRotatingBallSprite(s16 rotationDirection) { - u8 *spriteId = &gUnknown_0203CE54->unk804[1]; + u8 *spriteId = &gUnknown_0203CE54->spriteId[1]; LoadSpriteSheet(&gUnknown_0857FBA0); LoadSpritePalette(&gUnknown_0857FBA8); - *spriteId = CreateSprite(&gUnknown_0857FBB0, 16, 16, 0); + *spriteId = CreateSprite(&gSpriteTemplate_RotatingBall, 16, 16, 0); gSprites[*spriteId].data[0] = rotationDirection; } @@ -515,7 +515,7 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite) void AddBagItemIconSprite(u16 itemId, u8 id) { - u8 *spriteId = &gUnknown_0203CE54->unk804[id + 2]; + u8 *spriteId = &gUnknown_0203CE54->spriteId[id + 2]; if (*spriteId == 0xFF) { u8 iconSpriteId; @@ -539,17 +539,17 @@ void RemoveBagItemIconSprite(u8 id) void sub_80D4FAC(void) { - sub_8122344(&gUnknown_0203CE54->unk804[4], 8); + sub_8122344(&gUnknown_0203CE54->spriteId[4], 8); } void sub_80D4FC8(u8 arg0) { - sub_81223FC(&gUnknown_0203CE54->unk804[4], 8, arg0); + sub_81223FC(&gUnknown_0203CE54->spriteId[4], 8, arg0); } void sub_80D4FEC(u8 arg0) { - sub_8122448(&gUnknown_0203CE54->unk804[4], 136, 120, (arg0 + 1) * 16); + sub_8122448(&gUnknown_0203CE54->spriteId[4], 136, 120, (arg0 + 1) * 16); } static void sub_80D5018(void *mem0, void *mem1) diff --git a/src/item_use.c b/src/item_use.c index 8399a1861..474b16ae1 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -57,7 +57,6 @@ extern void bag_menu_yes_no(u8, u8, const struct YesNoFuncTable*); extern void sub_81C5924(void); extern void sub_81C59BC(void); extern void sub_81AB9A8(u8); -extern void sub_81ABA88(u8); extern void StartEscapeRopeFieldEffect(void); extern u8* sub_806CF78(u16); extern void sub_81B89F0(void); @@ -128,7 +127,7 @@ void SetUpItemUseCallback(u8 taskId) type = ItemId_GetType(gSpecialVar_ItemId) - 1; if (!InBattlePyramid()) { - gUnknown_0203CE54->unk0 = gUnknown_085920D8[type]; + gUnknown_0203CE54->mainCallback2 = gUnknown_085920D8[type]; unknown_ItemMenu_Confirm(taskId); } else @@ -212,7 +211,7 @@ void sub_80FD254(void) void ItemUseOutOfBattle_Mail(u8 taskId) { - gUnknown_0203CE54->unk0 = sub_80FD254; + gUnknown_0203CE54->mainCallback2 = sub_80FD254; unknown_ItemMenu_Confirm(taskId); } @@ -608,7 +607,7 @@ void ItemUseOutOfBattle_PokeblockCase(u8 taskId) } else if (gTasks[taskId].data[3] != TRUE) { - gUnknown_0203CE54->unk0 = sub_80FDBEC; + gUnknown_0203CE54->mainCallback2 = sub_80FDBEC; unknown_ItemMenu_Confirm(taskId); } else @@ -670,7 +669,7 @@ void sub_80FDD10(u8 taskId) { gUnknown_0203A0F4 = sub_80FDD74; gFieldCallback = MapPostLoadHook_UseItem; - gUnknown_0203CE54->unk0 = CB2_ReturnToField; + gUnknown_0203CE54->mainCallback2 = CB2_ReturnToField; unknown_ItemMenu_Confirm(taskId); } else @@ -812,7 +811,7 @@ void sub_80FE058(void) if (!InBattlePyramid()) { sub_81AB9A8(ItemId_GetPocket(gSpecialVar_ItemId)); - sub_81ABA88(ItemId_GetPocket(gSpecialVar_ItemId)); + SetInitialScrollAndCursorPositions(ItemId_GetPocket(gSpecialVar_ItemId)); } else { @@ -993,7 +992,7 @@ void sub_80FE54C(u8 taskId) { if (!InBattlePyramid()) { - gUnknown_0203CE54->unk0 = sub_81B89F0; + gUnknown_0203CE54->mainCallback2 = sub_81B89F0; unknown_ItemMenu_Confirm(taskId); } else From 1ca3656d74faf8565e0f61b31a1cd3ab22a44706 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 15 Dec 2018 13:07:07 -0600 Subject: [PATCH 05/13] Decompile contest_painting.c (#447) --- asm/contest_painting.s | 1197 ----------------- ...te_sketch.s => contest_painting_effects.s} | 0 data/contest_painting.s | 106 -- ...te_sketch.s => contest_painting_effects.s} | 0 include/contest.h | 1 + include/contest_painting.h | 13 +- include/contest_painting_effects.h | 28 + include/strings.h | 1 + ld_script.txt | 7 +- src/battle_anim_8170478.c | 64 +- src/contest_painting.c | 711 +++++++++- src/script_pokemon_util_80F87D8.c | 2 +- sym_common.txt | 2 +- 13 files changed, 784 insertions(+), 1348 deletions(-) delete mode 100644 asm/contest_painting.s rename asm/{cute_sketch.s => contest_painting_effects.s} (100%) delete mode 100644 data/contest_painting.s rename data/{cute_sketch.s => contest_painting_effects.s} (100%) create mode 100755 include/contest_painting_effects.h diff --git a/asm/contest_painting.s b/asm/contest_painting.s deleted file mode 100644 index f7c146e3e..000000000 --- a/asm/contest_painting.s +++ /dev/null @@ -1,1197 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_812FDA8 -sub_812FDA8: @ 812FDA8 - push {r4-r7,lr} - ldr r3, =gUnknown_02039F5D - ldr r4, =gUnknown_02039F5C - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - subs r0, 0x1 - lsls r1, r0, 5 - adds r2, r1 - ldr r1, =gUnknown_02039F3C - ldr r5, =0x00002e90 - adds r2, r5 - ldm r2!, {r5-r7} - stm r1!, {r5-r7} - ldm r2!, {r5-r7} - stm r1!, {r5-r7} - ldm r2!, {r6,r7} - stm r1!, {r6,r7} - strb r0, [r3] - movs r0, 0 - strb r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812FDA8 - - thumb_func_start sub_812FDEC -sub_812FDEC: @ 812FDEC - push {lr} - bl sub_812FE58 - pop {r0} - bx r0 - thumb_func_end sub_812FDEC - - thumb_func_start sub_812FDF8 -sub_812FDF8: @ 812FDF8 - push {lr} - bl sub_812FFC8 - bl RunTextPrinters - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_812FDF8 - - thumb_func_start sub_812FE0C -sub_812FE0C: @ 812FE0C - push {r4,r5,lr} - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 - ldr r4, =gUnknown_030061C4 - ldr r0, [r4] - bl Free - movs r5, 0 - str r5, [r4] - ldr r4, =gUnknown_03006190 - ldr r0, [r4] - bl Free - str r5, [r4] - ldr r0, =gUnknown_030011F7 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - bl FreeMonSpritesGfx - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812FE0C - - thumb_func_start sub_812FE58 -sub_812FE58: @ 812FE58 - push {r4-r7,lr} - sub sp, 0x4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x4 - bls _0812FE6E - b _0812FFA0 -_0812FE6E: - lsls r0, 2 - ldr r1, =_0812FE80 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0812FE80: - .4byte _0812FE94 - .4byte _0812FEC8 - .4byte _0812FF14 - .4byte _0812FF2A - .4byte _0812FF54 -_0812FE94: - bl ScanlineEffect_Stop - movs r0, 0 - bl SetVBlankCallback - bl AllocateMonSpritesGfx - ldr r1, =gUnknown_030061C0 - ldr r0, =gUnknown_02039F3C - str r0, [r1] - movs r0, 0x1 - bl sub_8130238 - bl sub_81301EC - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _0812FF3E - .pool -_0812FEC8: - bl ResetPaletteFade - movs r2, 0xC0 - lsls r2, 19 - movs r3, 0xC0 - lsls r3, 9 - movs r5, 0 - ldr r1, =0x040000d4 - movs r4, 0x80 - lsls r4, 5 - ldr r6, =0x85000400 - movs r7, 0x85 - lsls r7, 24 -_0812FEE2: - str r5, [sp] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r2, r4 - subs r3, r4 - cmp r3, r4 - bhi _0812FEE2 - str r5, [sp] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - lsrs r0, r3, 2 - orrs r0, r7 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - bl ResetSpriteData - b _0812FF36 - .pool -_0812FF14: - ldrh r0, [r4, 0x20] - bl SeedRng - bl InitKeys - bl sub_8130098 - movs r0, 0x87 - lsls r0, 3 - adds r1, r4, r0 - b _0812FF3E -_0812FF2A: - ldr r0, =gUnknown_02039F5D - ldrb r0, [r0] - ldr r1, =gUnknown_02039F5C - ldrb r1, [r1] - bl sub_8130884 -_0812FF36: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_0812FF3E: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0812FFA0 - .pool -_0812FF54: - ldr r0, =gUnknown_02039F5D - ldrb r0, [r0] - ldr r1, =gUnknown_02039F5C - ldrb r1, [r1] - bl sub_813010C - ldr r0, =gUnknown_085B0838 - movs r1, 0 - movs r2, 0x2 - bl LoadPalette - movs r1, 0xA0 - lsls r1, 19 - movs r4, 0 - str r4, [sp] - ldr r0, =0x040000d4 - mov r2, sp - str r2, [r0] - str r1, [r0, 0x4] - ldr r1, =0x85000100 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - movs r0, 0x2 - bl BeginFastPaletteFade - ldr r0, =sub_81302D0 - bl SetVBlankCallback - ldr r0, =gUnknown_030011F0 - strb r4, [r0] - movs r1, 0x9A - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =sub_812FDF8 - bl SetMainCallback2 -_0812FFA0: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812FE58 - - thumb_func_start sub_812FFC8 -sub_812FFC8: @ 812FFC8 - push {lr} - sub sp, 0x4 - ldr r3, =gUnknown_030011F0 - ldrb r1, [r3] - cmp r1, 0x1 - beq _0813001C - cmp r1, 0x1 - bgt _0812FFE4 - cmp r1, 0 - beq _0812FFEA - b _08130082 - .pool -_0812FFE4: - cmp r1, 0x2 - beq _0813005C - b _08130082 -_0812FFEA: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0812FFFA - movs r0, 0x1 - strb r0, [r3] -_0812FFFA: - ldr r0, =gUnknown_030011F6 - ldrb r0, [r0] - cmp r0, 0 - beq _08130082 - ldr r1, =gUnknown_030011F4 - ldrh r0, [r1] - cmp r0, 0 - beq _08130082 - subs r0, 0x1 - b _08130080 - .pool -_0813001C: - ldr r0, =gMain - ldrh r2, [r0, 0x2E] - ands r1, r2 - cmp r1, 0 - bne _0813002E - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - beq _08130040 -_0813002E: - movs r0, 0x2 - strb r0, [r3] - subs r0, 0x3 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_08130040: - ldr r0, =gUnknown_030011F6 - ldrb r0, [r0] - cmp r0, 0 - beq _08130082 - ldr r1, =gUnknown_030011F4 - movs r0, 0 - b _08130080 - .pool -_0813005C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0813006E - ldr r0, =sub_812FE0C - bl SetMainCallback2 -_0813006E: - ldr r0, =gUnknown_030011F6 - ldrb r0, [r0] - cmp r0, 0 - beq _08130082 - ldr r1, =gUnknown_030011F4 - ldrh r0, [r1] - cmp r0, 0x1D - bhi _08130082 - adds r0, 0x1 -_08130080: - strh r0, [r1] -_08130082: - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_812FFC8 - - thumb_func_start sub_8130098 -sub_8130098: @ 8130098 - push {r4,lr} - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085B07E8 - movs r0, 0 - movs r2, 0x1 - bl InitBgsFromTemplates - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x80 - lsls r0, 4 - bl AllocZeroed - adds r1, r0, 0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r4, =gUnknown_030011F7 - ldr r0, =gUnknown_085B07EC - bl AddWindow - strb r0, [r4] - bl DeactivateAllTextPrinters - ldrb r0, [r4] - movs r1, 0 - bl FillWindowPixelBuffer - ldrb r0, [r4] - bl PutWindowTilemap - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - movs r0, 0x1 - bl ShowBg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130098 - - thumb_func_start sub_813010C -sub_813010C: @ 813010C - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x1 - beq _081301D4 - ldr r6, =gUnknown_030061C0 - ldr r1, [r6] - ldrb r5, [r1, 0xA] - cmp r0, 0x7 - bhi _08130190 - ldr r4, =gStringVar1 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_818E868 - ldr r1, =gText_Space - adds r0, r4, 0 - bl StringAppend - ldr r1, =gContestRankTextPointers - ldr r0, [r6] - ldrb r0, [r0, 0x1E] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringAppend - ldr r4, =gStringVar2 - ldr r1, [r6] - adds r1, 0x16 - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - bl sub_81DB5AC - ldr r0, =gStringVar3 - ldr r1, [r6] - adds r1, 0xB - bl StringCopy - ldr r0, =gStringVar4 - ldr r1, =gUnknown_0827EA0C - bl StringExpandPlaceholders - b _081301A6 - .pool -_08130190: - ldr r0, =gStringVar1 - adds r1, 0xB - bl StringCopy - ldr r0, =gStringVar4 - ldr r2, =gContestPaintingDescriptionPointers - lsls r1, r5, 2 - adds r1, r2 - ldr r1, [r1] - bl StringExpandPlaceholders -_081301A6: - ldr r4, =gStringVar4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xD0 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - ldr r0, =gUnknown_030011F7 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - bl AddTextPrinterParameterized - movs r0, 0x1 - bl CopyBgTilemapBufferToVram -_081301D4: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813010C - - thumb_func_start sub_81301EC -sub_81301EC: @ 81301EC - push {lr} - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r2, =0x04000200 - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - ldr r1, =0x00000c42 - movs r0, 0x8 - bl SetGpuReg - ldr r1, =0x00000a45 - movs r0, 0xA - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_81301EC - - thumb_func_start sub_8130238 -sub_8130238: @ 8130238 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0813025C - ldr r0, =gUnknown_030011F6 - strb r1, [r0] - ldr r0, =gUnknown_030011F2 - strh r1, [r0] - ldr r0, =gUnknown_030011F4 - strh r1, [r0] - b _0813026E - .pool -_0813025C: - ldr r1, =gUnknown_030011F6 - movs r0, 0x1 - strb r0, [r1] - ldr r1, =gUnknown_030011F2 - movs r0, 0xF - strh r0, [r1] - ldr r1, =gUnknown_030011F4 - movs r0, 0x1E - strh r0, [r1] -_0813026E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130238 - - thumb_func_start sub_8130280 -sub_8130280: @ 8130280 - push {lr} - ldr r0, =gUnknown_030011F6 - ldrb r0, [r0] - cmp r0, 0 - bne _08130298 - movs r0, 0x4C - movs r1, 0 - bl SetGpuReg - b _081302C0 - .pool -_08130298: - ldr r1, =0x00000a45 - movs r0, 0xA - bl SetGpuReg - ldr r1, =gUnknown_030011F2 - ldr r0, =gUnknown_030011F4 - ldrh r0, [r0] - lsrs r0, 1 - strh r0, [r1] - lsls r1, r0, 12 - lsls r2, r0, 8 - orrs r1, r2 - lsls r2, r0, 4 - orrs r1, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x4C - bl SetGpuReg -_081302C0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130280 - - thumb_func_start sub_81302D0 -sub_81302D0: @ 81302D0 - push {lr} - bl sub_8130280 - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_81302D0 - - thumb_func_start sub_81302E8 -sub_81302E8: @ 81302E8 - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 16 - lsrs r5, r0, 16 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gUnknown_030061C0 - ldr r0, [r6] - ldr r1, [r0, 0x4] - ldr r2, [r0] - adds r0, r5, 0 - bl GetFrontSpritePalFromSpeciesAndPersonality - ldr r7, =gUnknown_030061C4 - ldr r1, [r7] - bl LZDecompressVram - cmp r4, 0 - bne _08130348 - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r4, =gMonSpritesGfxPtr - ldr r1, [r4] - ldr r1, [r1, 0x8] - ldr r2, [r6] - ldr r3, [r2] - adds r2, r5, 0 - bl HandleLoadSpecialPokePic_DontHandleDeoxys - ldr r0, [r4] - ldr r0, [r0, 0x8] - ldr r1, [r7] - ldr r2, =gUnknown_03006190 - ldr r2, [r2] - bl sub_8130380 - b _0813036C - .pool -_08130348: - lsls r0, r5, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r4, =gMonSpritesGfxPtr - ldr r1, [r4] - ldr r1, [r1, 0x4] - ldr r2, [r6] - ldr r3, [r2] - adds r2, r5, 0 - bl HandleLoadSpecialPokePic_DontHandleDeoxys - ldr r0, [r4] - ldr r0, [r0, 0x4] - ldr r1, [r7] - ldr r2, =gUnknown_03006190 - ldr r2, [r2] - bl sub_8130380 -_0813036C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81302E8 - - thumb_func_start sub_8130380 -sub_8130380: @ 8130380 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - mov r10, r0 - mov r9, r1 - str r2, [sp] - movs r0, 0 -_08130394: - movs r3, 0 - adds r1, r0, 0x1 - str r1, [sp, 0x4] - lsls r0, 3 - str r0, [sp, 0x8] -_0813039E: - movs r1, 0 - adds r2, r3, 0x1 - mov r8, r2 - ldr r7, [sp, 0x8] - adds r0, r7, r3 - lsls r0, 5 - mov r12, r0 - lsls r4, r3, 3 -_081303AE: - movs r3, 0 - lsls r0, r1, 2 - adds r6, r1, 0x1 - mov r2, r12 - adds r5, r2, r0 - ldr r7, [sp, 0x8] - adds r0, r7, r1 - lsls r0, 7 - ldr r1, [sp] - adds r2, r0, r1 -_081303C2: - lsrs r0, r3, 1 - adds r0, r5, r0 - add r0, r10 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _081303D6 - lsrs r1, 4 - b _081303DA -_081303D6: - movs r0, 0xF - ands r1, r0 -_081303DA: - cmp r1, 0 - bne _081303EC - adds r0, r4, r3 - lsls r0, 1 - adds r0, r2 - movs r7, 0x80 - lsls r7, 8 - adds r1, r7, 0 - b _081303F8 -_081303EC: - adds r0, r4, r3 - lsls r0, 1 - adds r0, r2 - lsls r1, 1 - add r1, r9 - ldrh r1, [r1] -_081303F8: - strh r1, [r0] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x7 - bls _081303C2 - lsls r0, r6, 16 - lsrs r1, r0, 16 - cmp r1, 0x7 - bls _081303AE - mov r1, r8 - lsls r0, r1, 16 - lsrs r3, r0, 16 - cmp r3, 0x7 - bls _0813039E - ldr r2, [sp, 0x4] - lsls r0, r2, 16 - lsrs r0, 16 - cmp r0, 0x7 - bls _08130394 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8130380 - - thumb_func_start sub_8130430 -sub_8130430: @ 8130430 - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_085A989C - movs r2, 0x80 - lsls r2, 1 - movs r1, 0 - bl LoadPalette - cmp r4, 0x1 - beq _0813044E - b _081305A4 -_0813044E: - ldr r0, =gUnknown_030061C0 - ldr r0, [r0] - ldrb r0, [r0, 0xA] - movs r1, 0x3 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bhi _0813050C - lsls r0, 2 - ldr r1, =_08130478 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08130478: - .4byte _0813048C - .4byte _081304A4 - .4byte _081304BC - .4byte _081304D4 - .4byte _081304F8 -_0813048C: - ldr r0, =gUnknown_085A9A9C - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AE974 - b _081304E0 - .pool -_081304A4: - ldr r0, =gUnknown_085AAB20 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AEE80 - b _081304E0 - .pool -_081304BC: - ldr r0, =gUnknown_085AB750 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AF38C - b _081304E0 - .pool -_081304D4: - ldr r0, =gUnknown_085AC288 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AF898 -_081304E0: - ldr r1, =gUnknown_03006190 - ldr r1, [r1] - bl RLUnCompWram - b _0813050C - .pool -_081304F8: - ldr r0, =gUnknown_085AD240 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AFDA4 - ldr r1, =gUnknown_03006190 - ldr r1, [r1] - bl RLUnCompWram -_0813050C: - movs r1, 0 - ldr r5, =0x06006000 - ldr r0, =0x00001015 - adds r4, r0, 0 -_08130514: - movs r3, 0 - lsls r2, r1, 5 -_08130518: - adds r0, r2, r3 - lsls r0, 1 - adds r0, r5 - strh r4, [r0] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1F - bls _08130518 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x13 - bls _08130514 - movs r1, 0 - ldr r0, =0x0600608c - mov r12, r0 - ldr r7, =gUnknown_03006190 -_0813053C: - movs r3, 0 - adds r6, r1, 0x1 - lsls r5, r1, 5 - lsls r4, r1, 6 -_08130544: - adds r2, r5, r3 - lsls r2, 1 - add r2, r12 - ldr r0, [r7] - adds r0, r4, r0 - lsls r1, r3, 1 - adds r0, r1 - adds r0, 0x8C - ldrh r0, [r0] - strh r0, [r2] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x11 - bls _08130544 - lsls r0, r6, 24 - lsrs r1, r0, 24 - cmp r1, 0x9 - bls _0813053C - movs r3, 0 - ldr r4, =0x0600608e - ldr r2, =gUnknown_03006190 -_08130570: - lsls r1, r3, 1 - adds r1, r4 - ldr r0, [r2] - adds r0, 0x8E - ldrh r0, [r0] - strh r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xF - bls _08130570 - b _08130676 - .pool -_081305A4: - cmp r5, 0x7 - bhi _081305C0 - ldr r0, =gUnknown_085AE370 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085B02B0 - b _08130650 - .pool -_081305C0: - ldr r0, =gUnknown_030061C0 - ldr r0, [r0] - ldrb r0, [r0, 0xA] - movs r1, 0x3 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bhi _08130676 - lsls r0, 2 - ldr r1, =_081305E8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081305E8: - .4byte _081305FC - .4byte _08130614 - .4byte _0813062C - .4byte _08130644 - .4byte _08130664 -_081305FC: - ldr r0, =gUnknown_085A9A9C - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AE974 - b _08130650 - .pool -_08130614: - ldr r0, =gUnknown_085AAB20 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AEE80 - b _08130650 - .pool -_0813062C: - ldr r0, =gUnknown_085AB750 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AF38C - b _08130650 - .pool -_08130644: - ldr r0, =gUnknown_085AC288 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AF898 -_08130650: - ldr r1, =0x06006000 - bl RLUnCompVram - b _08130676 - .pool -_08130664: - ldr r0, =gUnknown_085AD240 - movs r1, 0xC0 - lsls r1, 19 - bl RLUnCompVram - ldr r0, =gUnknown_085AFDA4 - ldr r1, =0x06006000 - bl RLUnCompVram -_08130676: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130430 - - thumb_func_start sub_8130688 -sub_8130688: @ 8130688 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gMain - ldr r1, =gUnknown_085B0830 - ldr r2, [r1, 0x4] - ldr r1, [r1] - str r1, [r3, 0x38] - str r2, [r3, 0x3C] - ldrh r2, [r3, 0x3C] - ldr r1, =0xfffffc00 - ands r1, r2 - strh r1, [r3, 0x3C] - ldrh r1, [r3, 0x3A] - ldr r0, =0xfffffe00 - ands r0, r1 - movs r1, 0x58 - orrs r0, r1 - strh r0, [r3, 0x3A] - adds r1, r3, 0 - adds r1, 0x38 - movs r0, 0x18 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130688 - - thumb_func_start sub_81306CC -sub_81306CC: @ 81306CC - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x7 - bhi _081306E4 - ldr r0, =gUnknown_030061C0 - ldr r0, [r0] - ldrb r0, [r0, 0xA] - b _081306F4 - .pool -_081306E4: - ldr r0, =gUnknown_030061C0 - ldr r0, [r0] - ldrb r0, [r0, 0xA] - movs r1, 0x3 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 -_081306F4: - cmp r0, 0x4 - bhi _08130732 - lsls r0, 2 - ldr r1, =_0813070C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813070C: - .4byte _08130720 - .4byte _08130724 - .4byte _08130728 - .4byte _0813072C - .4byte _08130730 -_08130720: - movs r0, 0x9 - b _08130732 -_08130724: - movs r0, 0xD - b _08130732 -_08130728: - movs r0, 0x2 - b _08130732 -_0813072C: - movs r0, 0x24 - b _08130732 -_08130730: - movs r0, 0x6 -_08130732: - pop {r1} - bx r1 - thumb_func_end sub_81306CC - - thumb_func_start sub_8130738 -sub_8130738: @ 8130738 - push {r4,lr} - ldr r4, =gUnknown_030061C4 - movs r0, 0x80 - lsls r0, 2 - bl AllocZeroed - str r0, [r4] - ldr r4, =gUnknown_03006190 - movs r0, 0x80 - lsls r0, 6 - bl AllocZeroed - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130738 - - thumb_func_start sub_8130760 -sub_8130760: @ 8130760 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gUnknown_030061A0 - ldr r0, =gUnknown_03006190 - ldr r0, [r0] - str r0, [r1, 0x4] - ldr r0, =gUnknown_030061C4 - ldr r0, [r0] - str r0, [r1, 0x8] - movs r2, 0 - strb r2, [r1, 0x18] - ldr r0, =gUnknown_030061C0 - ldr r0, [r0] - ldrb r0, [r0] - strb r0, [r1, 0x1F] - strb r2, [r1, 0x19] - strb r2, [r1, 0x1A] - movs r0, 0x40 - strb r0, [r1, 0x1B] - strb r0, [r1, 0x1C] - strb r0, [r1, 0x1D] - strb r0, [r1, 0x1E] - subs r0, r3, 0x2 - adds r4, r1, 0 - cmp r0, 0x22 - bhi _08130844 - lsls r0, 2 - ldr r1, =_081307B4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081307B4: - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130840 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130844 - .4byte _08130840 -_08130840: - movs r0, 0x3 - b _08130846 -_08130844: - movs r0, 0x1 -_08130846: - strh r0, [r4, 0x14] - movs r0, 0x2 - strh r0, [r4, 0x16] - strb r3, [r4] - ldr r0, =0x06010000 - str r0, [r4, 0x10] - adds r0, r4, 0 - bl sub_8124F2C - adds r0, r4, 0 - bl sub_81261A4 - adds r0, r4, 0 - bl sub_8126058 - ldr r0, =gUnknown_030061C4 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 1 - movs r2, 0x80 - lsls r2, 2 - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130760 - - thumb_func_start sub_8130884 -sub_8130884: @ 8130884 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - bl sub_8130738 - ldr r0, =gUnknown_030061C0 - ldr r0, [r0] - ldrh r0, [r0, 0x8] - movs r1, 0 - bl sub_81302E8 - adds r0, r4, 0 - bl sub_81306CC - lsls r0, 24 - lsrs r0, 24 - bl sub_8130760 - adds r0, r4, 0 - bl sub_8130688 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_8130430 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8130884 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/cute_sketch.s b/asm/contest_painting_effects.s similarity index 100% rename from asm/cute_sketch.s rename to asm/contest_painting_effects.s diff --git a/data/contest_painting.s b/data/contest_painting.s deleted file mode 100644 index 42d76f9bc..000000000 --- a/data/contest_painting.s +++ /dev/null @@ -1,106 +0,0 @@ -@ the third big chunk of data - - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_085A989C:: @ 85A989C - .incbin "graphics/picture_frame/bg.gbapal" - - .align 2 -gUnknown_085A9A9C:: @ 85A9A9C - .incbin "graphics/picture_frame/frame0.4bpp.rl" - - .align 2 -gUnknown_085AAB20:: @ 85AAB20 - .incbin "graphics/picture_frame/frame1.4bpp.rl" - - .align 2 -gUnknown_085AB750:: @ 85AB750 - .incbin "graphics/picture_frame/frame2.4bpp.rl" - - .align 2 -gUnknown_085AC288:: @ 85AC288 - .incbin "graphics/picture_frame/frame3.4bpp.rl" - - .align 2 -gUnknown_085AD240:: @ 85AD240 - .incbin "graphics/picture_frame/frame4.4bpp.rl" - - .align 2 -gUnknown_085AE370:: @ 85AE370 - .incbin "graphics/picture_frame/frame5.4bpp.rl" - - .align 2 -gUnknown_085AE974:: @ 85AE974 - .incbin "graphics/picture_frame/frame0_map.bin.rl" - - .align 2 -gUnknown_085AEE80:: @ 85AEE80 - .incbin "graphics/picture_frame/frame1_map.bin.rl" - - .align 2 -gUnknown_085AF38C:: @ 85AF38C - .incbin "graphics/picture_frame/frame2_map.bin.rl" - - .align 2 -gUnknown_085AF898:: @ 85AF898 - .incbin "graphics/picture_frame/frame3_map.bin.rl" - - .align 2 -gUnknown_085AFDA4:: @ 85AFDA4 - .incbin "graphics/picture_frame/frame4_map.bin.rl" - - .align 2 -gUnknown_085B02B0:: @ 85B02B0 - .incbin "graphics/picture_frame/frame5_map.bin.rl" - - .align 2 -gUnknown_085B07C0:: @ 85B07C0 - .4byte gContestCoolness - .4byte gContestBeauty - .4byte gContestCuteness - .4byte gContestSmartness - .4byte gContestToughness - - .align 2 -gContestRankTextPointers:: @ 85B07D4 - .4byte gContestRankNormal - .4byte gContestRankSuper - .4byte gContestRankHyper - .4byte gContestRankMaster - .4byte gContestLink - - .align 2 -gUnknown_085B07E8:: @ 85B07E8 - .4byte 0x000010a5 - - .align 2 -gUnknown_085B07EC:: @ 85B07EC - window_template 0x01, 0x02, 0x0e, 0x1a, 0x04, 0x0f, 0x0001 - - .align 2 -gContestPaintingDescriptionPointers:: @ 85B07F4 - .4byte gContestPaintingCool1 - .4byte gContestPaintingCool2 - .4byte gContestPaintingCool3 - .4byte gContestPaintingBeauty1 - .4byte gContestPaintingBeauty2 - .4byte gContestPaintingBeauty3 - .4byte gContestPaintingCute1 - .4byte gContestPaintingCute2 - .4byte gContestPaintingCute3 - .4byte gContestPaintingSmart1 - .4byte gContestPaintingSmart2 - .4byte gContestPaintingSmart3 - .4byte gContestPaintingTough1 - .4byte gContestPaintingTough2 - .4byte gContestPaintingTough3 - -gUnknown_085B0830:: @ 85B0830 - .4byte 0xc0003000, 0x00000000 - -gUnknown_085B0838:: @ 85B0838 - .2byte 0x0000, 0x0000 diff --git a/data/cute_sketch.s b/data/contest_painting_effects.s similarity index 100% rename from data/cute_sketch.s rename to data/contest_painting_effects.s diff --git a/include/contest.h b/include/contest.h index 8790d7371..c205737ee 100644 --- a/include/contest.h +++ b/include/contest.h @@ -231,6 +231,7 @@ extern u8 gContestPlayerMonIndex; extern s16 gUnknown_02039F08[4]; extern s16 gContestMonConditions[4]; extern u8 gIsLinkContest; +extern struct ContestWinner gUnknown_02039F3C; struct Shared18000 { diff --git a/include/contest_painting.h b/include/contest_painting.h index 67a845d62..c633c50cc 100644 --- a/include/contest_painting.h +++ b/include/contest_painting.h @@ -1,7 +1,16 @@ #ifndef GUARD_CONTESTPAINTING_H #define GUARD_CONTESTPAINTING_H -void sub_812FDA8(u32); -void sub_812FDEC(void); +enum +{ + CONTESTRESULT_COOL = 9, + CONTESTRESULT_BEAUTY = 13, + CONTESTRESULT_CUTE = 2, + CONTESTRESULT_SMART = 36, + CONTESTRESULT_TOUGH = 6, +}; + +void sub_812FDA8(int); +void CB2_ContestPainting(void); #endif diff --git a/include/contest_painting_effects.h b/include/contest_painting_effects.h new file mode 100755 index 000000000..3b6964666 --- /dev/null +++ b/include/contest_painting_effects.h @@ -0,0 +1,28 @@ +#ifndef GUARD_CONTEST_PAINTING_EFFECTS_H +#define GUARD_CONTEST_PAINTING_EFFECTS_H + +struct Unk030061A0 +{ + u8 var_0; + u8 pad1[3]; + u16 (*var_4)[][32]; + u16 *var_8; + u8 pad0C[4]; + u32 var_10; + u16 var_14; + u16 var_16; + u8 var_18; + u8 var_19; + u8 var_1A; + u8 var_1B; + u8 var_1C; + u8 var_1D; + u8 var_1E; + u8 var_1F; +}; + +void sub_8124F2C(struct Unk030061A0 *); +void sub_81261A4(struct Unk030061A0 *); +void sub_8126058(struct Unk030061A0 *); + +#endif diff --git a/include/strings.h b/include/strings.h index f0df4bdec..c780a80b4 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1226,6 +1226,7 @@ extern const u8 gText_SpaceAndSpace[]; extern const u8 gText_CommaSpace[]; extern const u8 gText_NewLine[]; extern const u8 gText_ScrollTextUp[]; +extern const u8 gText_Space[]; extern const u8 gText_Space2[]; extern const u8 gText_Are[]; extern const u8 gText_Are2[]; diff --git a/ld_script.txt b/ld_script.txt index 1413941f1..68aa8463c 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -186,11 +186,10 @@ SECTIONS { src/dewford_trend.o(.text); src/heal_location.o(.text); src/region_map.o(.text); - asm/cute_sketch.o(.text); + asm/contest_painting_effects.o(.text); src/decoration.o(.text); src/slot_machine.o(.text); src/contest_painting.o(.text); - asm/contest_painting.o(.text); src/battle_ai_script_commands.o(.text); src/trader.o(.text); src/starter_choose.o(.text); @@ -511,11 +510,11 @@ SECTIONS { src/menu_helpers.o(.rodata); src/heal_location.o(.rodata); src/region_map.o(.rodata); - data/cute_sketch.o(.rodata); + data/contest_painting_effects.o(.rodata); src/decoration.o(.rodata); src/slot_machine.o(.rodata); data/slot_machine.o(.rodata); - data/contest_painting.o(.rodata); + src/contest_painting.o(.rodata); src/battle_ai_script_commands.o(.rodata); src/trader.o(.rodata); src/starter_choose.o(.rodata); diff --git a/src/battle_anim_8170478.c b/src/battle_anim_8170478.c index 6c91ff934..94f2c95b5 100755 --- a/src/battle_anim_8170478.c +++ b/src/battle_anim_8170478.c @@ -79,9 +79,9 @@ static void sub_817330C(struct Sprite *); struct BallCaptureSuccessStarData { - s8 xOffset; - s8 yOffset; - s8 unk2; + s8 xOffset; + s8 yOffset; + s8 unk2; }; static const struct BallCaptureSuccessStarData sBallCaptureSuccessStarData[] = @@ -478,7 +478,7 @@ static void sub_8170660(u8 taskId) SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR); if (!IsContest()) - SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON); SetGpuReg(REG_OFFSET_BLDCNT, 0); @@ -522,9 +522,9 @@ static void sub_8170834(u8 *paletteId1, u8 *paletteId2, u8 battler) void sub_8170920(u8 taskId) { - u8 paletteId1, paletteId2; - sub_8170834(&paletteId1, &paletteId2, gBattleAnimAttacker); - DestroyAnimVisualTask(taskId); + u8 paletteId1, paletteId2; + sub_8170834(&paletteId1, &paletteId2, gBattleAnimAttacker); + DestroyAnimVisualTask(taskId); } static void sub_817094C(u8 battler) @@ -548,8 +548,8 @@ static void sub_817094C(u8 battler) void sub_81709EC(u8 taskId) { - sub_817094C(gBattleAnimAttacker); - DestroyAnimVisualTask(taskId); + sub_817094C(gBattleAnimAttacker); + DestroyAnimVisualTask(taskId); } void sub_8170A0C(u8 taskId) @@ -1162,13 +1162,13 @@ static void sub_81717F8(struct Sprite *sprite) sprite->data[4]++; if (sprite->data[4] == 40) { - PlaySE(SE_RG_GETTING); - BlendPalettes(0x10000 << sprite->oam.paletteNum, 6, RGB(0, 0, 0)); - sub_81719EC(sprite); + PlaySE(SE_RG_GETTING); + BlendPalettes(0x10000 << sprite->oam.paletteNum, 6, RGB(0, 0, 0)); + sub_81719EC(sprite); } else if (sprite->data[4] == 60) { - BeginNormalPaletteFade(0x10000 << sprite->oam.paletteNum, 2, 6, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(0x10000 << sprite->oam.paletteNum, 2, 6, 0, RGB(0, 0, 0)); } else if (sprite->data[4] == 95) { @@ -1243,41 +1243,41 @@ static void sub_81719C0(struct Sprite *sprite) static void sub_81719EC(struct Sprite *sprite) { - u32 i; - u8 subpriority; + u32 i; + u8 subpriority; if (sprite->subpriority) { - subpriority = sprite->subpriority - 1; + subpriority = sprite->subpriority - 1; } else { - subpriority = 0; - sprite->subpriority = 1; + subpriority = 0; + sprite->subpriority = 1; } sub_8171D60(4); for (i = 0; i < 3; i++) { - u8 spriteId = CreateSprite(&gUnknown_085E51F0[4], sprite->pos1.x, sprite->pos1.y, subpriority); - if (spriteId != MAX_SPRITES) - { - gSprites[spriteId].data[0] = 24; - gSprites[spriteId].data[2] = sprite->pos1.x + sBallCaptureSuccessStarData[i].xOffset; - gSprites[spriteId].data[4] = sprite->pos1.y + sBallCaptureSuccessStarData[i].yOffset; - gSprites[spriteId].data[5] = sBallCaptureSuccessStarData[i].unk2; - InitAnimArcTranslation(&gSprites[spriteId]); - gSprites[spriteId].callback = sub_8171AAC; - StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[4]); - } + u8 spriteId = CreateSprite(&gUnknown_085E51F0[4], sprite->pos1.x, sprite->pos1.y, subpriority); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].data[0] = 24; + gSprites[spriteId].data[2] = sprite->pos1.x + sBallCaptureSuccessStarData[i].xOffset; + gSprites[spriteId].data[4] = sprite->pos1.y + sBallCaptureSuccessStarData[i].yOffset; + gSprites[spriteId].data[5] = sBallCaptureSuccessStarData[i].unk2; + InitAnimArcTranslation(&gSprites[spriteId]); + gSprites[spriteId].callback = sub_8171AAC; + StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[4]); + } } } static void sub_8171AAC(struct Sprite *sprite) { - sprite->invisible = !sprite->invisible; - if (TranslateAnimArc(sprite)) - DestroySprite(sprite); + sprite->invisible = !sprite->invisible; + if (TranslateAnimArc(sprite)) + DestroySprite(sprite); } // fakematching. I think the return type of ItemIdToBallId() diff --git a/src/contest_painting.c b/src/contest_painting.c index 7950b7cac..b1b189c09 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -1,8 +1,709 @@ #include "global.h" +#include "alloc.h" +#include "battle.h" +#include "bg.h" +#include "contest.h" +#include "contest_painting.h" +#include "contest_painting_effects.h" +#include "battle_gfx_sfx_util.h" +#include "decompress.h" +#include "gpu_regs.h" +#include "international_string_util.h" +#include "main.h" +#include "lilycove_lady.h" +#include "palette.h" +#include "random.h" +#include "scanline_effect.h" +#include "string_util.h" +#include "strings.h" +#include "text.h" +#include "window.h" +#include "constants/rgb.h" + +extern u8 gUnknown_02039F5C; +extern u8 gUnknown_02039F5D; + +extern u16 (*gUnknown_03006190)[][32]; +extern struct ContestWinner *gUnknown_030061C0; +extern u16 *gContestPaintingMonPalette; +extern struct Unk030061A0 gUnknown_030061A0; // IWRAM bss -IWRAM_DATA u8 gUnknown_030011F0; -IWRAM_DATA u16 gUnknown_030011F2; -IWRAM_DATA u16 gUnknown_030011F4; -IWRAM_DATA u8 gUnknown_030011F6; -IWRAM_DATA u8 gUnknown_030011F7; +IWRAM_DATA u8 gContestPaintingState; +IWRAM_DATA u16 gContestPaintingMosaicVal; +IWRAM_DATA u16 gContestPaintingFadeCounter; +IWRAM_DATA bool8 gUnknown_030011F6; +IWRAM_DATA u8 gContestPaintingWindowId; + +static void ShowContestPainting(void); +static void HoldContestPainting(void); +static void InitContestPaintingWindow(void); +static void InitContestPaintingBg(void); +static void InitContestPaintingVars(bool8); +static void sub_8130884(u8, u8); +static void PrintContestPaintingCaption(u8, u8); +static void VBlankCB_ContestPainting(void); +static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64]); + +extern const u8 gUnknown_0827EA0C[]; +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const struct CompressedSpriteSheet gMonBackPicTable[]; +extern const u8 gContestCoolness[]; +extern const u8 gContestBeauty[]; +extern const u8 gContestCuteness[]; +extern const u8 gContestSmartness[]; +extern const u8 gContestToughness[]; +extern const u8 gContestRankNormal[]; +extern const u8 gContestRankSuper[]; +extern const u8 gContestRankHyper[]; +extern const u8 gContestRankMaster[]; +extern const u8 gContestLink[]; +extern const u8 gContestPaintingCool1[]; +extern const u8 gContestPaintingCool2[]; +extern const u8 gContestPaintingCool3[]; +extern const u8 gContestPaintingBeauty1[]; +extern const u8 gContestPaintingBeauty2[]; +extern const u8 gContestPaintingBeauty3[]; +extern const u8 gContestPaintingCute1[]; +extern const u8 gContestPaintingCute2[]; +extern const u8 gContestPaintingCute3[]; +extern const u8 gContestPaintingSmart1[]; +extern const u8 gContestPaintingSmart2[]; +extern const u8 gContestPaintingSmart3[]; +extern const u8 gContestPaintingTough1[]; +extern const u8 gContestPaintingTough2[]; +extern const u8 gContestPaintingTough3[]; + +const u16 gPictureFramePalettes[] = INCBIN_U16("graphics/picture_frame/bg.gbapal"); +const u8 gPictureFrameTiles_0[] = INCBIN_U8("graphics/picture_frame/frame0.4bpp.rl"); +const u8 gPictureFrameTiles_1[] = INCBIN_U8("graphics/picture_frame/frame1.4bpp.rl"); +const u8 gPictureFrameTiles_2[] = INCBIN_U8("graphics/picture_frame/frame2.4bpp.rl"); +const u8 gPictureFrameTiles_3[] = INCBIN_U8("graphics/picture_frame/frame3.4bpp.rl"); +const u8 gPictureFrameTiles_4[] = INCBIN_U8("graphics/picture_frame/frame4.4bpp.rl"); +const u8 gPictureFrameTiles_5[] = INCBIN_U8("graphics/picture_frame/frame5.4bpp.rl"); +const u8 gPictureFrameTilemap_0[] = INCBIN_U8("graphics/picture_frame/frame0_map.bin.rl"); +const u8 gPictureFrameTilemap_1[] = INCBIN_U8("graphics/picture_frame/frame1_map.bin.rl"); +const u8 gPictureFrameTilemap_2[] = INCBIN_U8("graphics/picture_frame/frame2_map.bin.rl"); +const u8 gPictureFrameTilemap_3[] = INCBIN_U8("graphics/picture_frame/frame3_map.bin.rl"); +const u8 gPictureFrameTilemap_4[] = INCBIN_U8("graphics/picture_frame/frame4_map.bin.rl"); +const u8 gPictureFrameTilemap_5[] = INCBIN_U8("graphics/picture_frame/frame5_map.bin.rl"); + +const u8 *const gUnknown_085B07C0[] = +{ + gContestCoolness, + gContestBeauty, + gContestCuteness, + gContestSmartness, + gContestToughness, +}; + +const u8 *const gContestRankTextPointers[] = +{ + gContestRankNormal, + gContestRankSuper, + gContestRankHyper, + gContestRankMaster, + gContestLink, +}; + +const struct BgTemplate gUnknown_085B07E8[] = +{ + { + .bg = 1, + .charBaseIndex = 1, + .mapBaseIndex = 10, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0, + }, +}; + +const struct WindowTemplate gUnknown_085B07EC = +{ + .bg = 1, + .tilemapLeft = 2, + .tilemapTop = 14, + .width = 26, + .height = 4, + .paletteNum = 15, + .baseBlock = 1, +}; + +const u8 *const gContestPaintingDescriptionPointers[] = +{ + gContestPaintingCool1, + gContestPaintingCool2, + gContestPaintingCool3, + gContestPaintingBeauty1, + gContestPaintingBeauty2, + gContestPaintingBeauty3, + gContestPaintingCute1, + gContestPaintingCute2, + gContestPaintingCute3, + gContestPaintingSmart1, + gContestPaintingSmart2, + gContestPaintingSmart3, + gContestPaintingTough1, + gContestPaintingTough2, + gContestPaintingTough3, +}; + +const struct OamData gUnknown_085B0830 = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 1, + .bpp = ST_OAM_8BPP, + .shape = ST_OAM_SQUARE, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)}; + +void sub_812FDA8(int contestWinner) +{ + // probably fakematching + u8 *ptr1 = &gUnknown_02039F5D; + u8 *ptr2 = &gUnknown_02039F5C; + gUnknown_02039F3C = gSaveBlock1Ptr->contestWinners[contestWinner - 1]; + *ptr1 = contestWinner - 1; + *ptr2 = 0; +} + +void CB2_ContestPainting(void) +{ + ShowContestPainting(); +} + +static void CB2_HoldContestPainting(void) +{ + HoldContestPainting(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +static void CB2_QuitContestPainting(void) +{ + SetMainCallback2(gMain.savedCallback); + FREE_AND_SET_NULL(gContestPaintingMonPalette); + FREE_AND_SET_NULL(gUnknown_03006190); + RemoveWindow(gContestPaintingWindowId); + Free(GetBgTilemapBuffer(1)); + FreeMonSpritesGfx(); +} + +static void ShowContestPainting(void) +{ + switch (gMain.state) + { + case 0: + ScanlineEffect_Stop(); + SetVBlankCallback(NULL); + AllocateMonSpritesGfx(); + gUnknown_030061C0 = &gUnknown_02039F3C; + InitContestPaintingVars(1); + InitContestPaintingBg(); + gMain.state++; + break; + case 1: + ResetPaletteFade(); + DmaFillLarge32(3, 0, (void *)BG_VRAM, 0x18000, 0x1000); + ResetSpriteData(); + gMain.state++; + break; + case 2: + SeedRng(gMain.vblankCounter1); + InitKeys(); + InitContestPaintingWindow(); + gMain.state++; + break; + case 3: + sub_8130884(gUnknown_02039F5D, gUnknown_02039F5C); + gMain.state++; + break; + case 4: + PrintContestPaintingCaption(gUnknown_02039F5D, gUnknown_02039F5C); + LoadPalette(gUnknown_085B0838, 0, 1 * 2); + DmaClear32(3, PLTT, PLTT_SIZE); + BeginFastPaletteFade(2); + SetVBlankCallback(VBlankCB_ContestPainting); + gContestPaintingState = 0; + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON); + SetMainCallback2(CB2_HoldContestPainting); + break; + } +} + +static void HoldContestPainting(void) +{ + switch (gContestPaintingState) + { + case 0: + if (!gPaletteFade.active) + gContestPaintingState = 1; + if (gUnknown_030011F6 && gContestPaintingFadeCounter) + gContestPaintingFadeCounter--; + break; + case 1: + if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + { + u8 two = 2; //needed to make the asm match + gContestPaintingState = two; + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); + } + + if (gUnknown_030011F6) + gContestPaintingFadeCounter = 0; + break; + case 2: + if (!gPaletteFade.active) + SetMainCallback2(CB2_QuitContestPainting); + if (gUnknown_030011F6 && gContestPaintingFadeCounter < 30) + gContestPaintingFadeCounter++; + break; + } +} + +static void InitContestPaintingWindow(void) +{ + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_085B07E8, ARRAY_COUNT(gUnknown_085B07E8)); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE)); + gContestPaintingWindowId = AddWindow(&gUnknown_085B07EC); + DeactivateAllTextPrinters(); + FillWindowPixelBuffer(gContestPaintingWindowId, 0); + PutWindowTilemap(gContestPaintingWindowId); + CopyWindowToVram(gContestPaintingWindowId, 3); + ShowBg(1); +} + +static void PrintContestPaintingCaption(u8 contestType, u8 arg1) +{ + int x; + u8 category; + + if (arg1 == TRUE) + return; + + category = gUnknown_030061C0->contestCategory; + if (contestType < 8) + { + sub_818E868(gStringVar1, category); + StringAppend(gStringVar1, gText_Space); + StringAppend(gStringVar1, gContestRankTextPointers[gUnknown_030061C0->contestRank]); + StringCopy(gStringVar2, gUnknown_030061C0->trainerName); + sub_81DB5AC(gStringVar2); + StringCopy(gStringVar3, gUnknown_030061C0->monName); + StringExpandPlaceholders(gStringVar4, gUnknown_0827EA0C); + } + else + { + StringCopy(gStringVar1, gUnknown_030061C0->monName); + StringExpandPlaceholders(gStringVar4, gContestPaintingDescriptionPointers[category]); + } + + x = GetStringCenterAlignXOffset(1, gStringVar4, 208); + AddTextPrinterParameterized(gContestPaintingWindowId, 1, gStringVar4, x, 1, 0, 0); + CopyBgTilemapBufferToVram(1); +} + +static void InitContestPaintingBg(void) +{ + SetGpuReg(REG_OFFSET_DISPCNT, 0); + REG_IE |= INTR_FLAG_VBLANK; + SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(12) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256); + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(10) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); +} + +static void InitContestPaintingVars(bool8 arg0) +{ + if (arg0 == FALSE) + { + gUnknown_030011F6 = FALSE; + gContestPaintingMosaicVal = 0; + gContestPaintingFadeCounter = 0; + } + else + { + gUnknown_030011F6 = TRUE; + gContestPaintingMosaicVal = 15; + gContestPaintingFadeCounter = 30; + } +} + +static void UpdateContestPaitingMosaicEffect(void) +{ + if (!gUnknown_030011F6) + { + SetGpuReg(REG_OFFSET_MOSAIC, 0); + } + else + { + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(10) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256); + gContestPaintingMosaicVal = gContestPaintingFadeCounter / 2; + SetGpuReg(REG_OFFSET_MOSAIC, (gContestPaintingMosaicVal << 12) | (gContestPaintingMosaicVal << 8) | (gContestPaintingMosaicVal << 4) | (gContestPaintingMosaicVal << 0)); + } +} + +static void VBlankCB_ContestPainting(void) +{ + UpdateContestPaitingMosaicEffect(); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_81302E8(u16 species, u8 arg1) +{ + const void *pal = GetFrontSpritePalFromSpeciesAndPersonality(species, gUnknown_030061C0->trainerId, gUnknown_030061C0->personality); + LZDecompressVram(pal, gContestPaintingMonPalette); + if (!arg1) + { + HandleLoadSpecialPokePic_DontHandleDeoxys( + &gMonFrontPicTable[species], + gMonSpritesGfxPtr->sprites[1], + species, + gUnknown_030061C0->personality); + sub_8130380(gMonSpritesGfxPtr->sprites[1], gContestPaintingMonPalette, (void *)gUnknown_03006190); + } + else + { + HandleLoadSpecialPokePic_DontHandleDeoxys( + &gMonBackPicTable[species], + gMonSpritesGfxPtr->sprites[0], + species, + gUnknown_030061C0->personality); + sub_8130380(gMonSpritesGfxPtr->sprites[0], gContestPaintingMonPalette, (void *)gUnknown_03006190); + } +} + +#ifdef NONMATCHING +// functionally equivalent. +static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64]) +{ + u16 tileY, tileX, pixelY, pixelX; + u8 colorIndex; + + for (tileY = 0; tileY < 8; tileY++) + { + for (tileX = 0; tileX < 8; tileX++) + { + for (pixelY = 0; pixelY < 8; pixelY++) + { + for (pixelX = 0; pixelX < 8; pixelX++) + { + int offset = 32 * (8 * tileY + tileX) + (pixelY * 4 + pixelX / 2); + colorIndex = spritePixels[offset]; + if (pixelX & 1) + colorIndex >>= 4; + else + colorIndex &= 0xF; + + if (colorIndex == 0) // transparent pixel + (*destColorBuffer)[8 * tileY + pixelY][tileX * 8 + pixelX] = 0x8000; + else + (*destColorBuffer)[8 * tileY + pixelY][tileX * 8 + pixelX] = palette[colorIndex]; + } + } + } + } +} +#else +NAKED +static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64]) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0xC\n\ + mov r10, r0\n\ + mov r9, r1\n\ + str r2, [sp]\n\ + movs r0, 0\n\ +_08130394:\n\ + movs r3, 0\n\ + adds r1, r0, 0x1\n\ + str r1, [sp, 0x4]\n\ + lsls r0, 3\n\ + str r0, [sp, 0x8]\n\ +_0813039E:\n\ + movs r1, 0\n\ + adds r2, r3, 0x1\n\ + mov r8, r2\n\ + ldr r7, [sp, 0x8]\n\ + adds r0, r7, r3\n\ + lsls r0, 5\n\ + mov r12, r0\n\ + lsls r4, r3, 3\n\ +_081303AE:\n\ + movs r3, 0\n\ + lsls r0, r1, 2\n\ + adds r6, r1, 0x1\n\ + mov r2, r12\n\ + adds r5, r2, r0\n\ + ldr r7, [sp, 0x8]\n\ + adds r0, r7, r1\n\ + lsls r0, 7\n\ + ldr r1, [sp]\n\ + adds r2, r0, r1\n\ +_081303C2:\n\ + lsrs r0, r3, 1\n\ + adds r0, r5, r0\n\ + add r0, r10\n\ + ldrb r1, [r0]\n\ + movs r0, 0x1\n\ + ands r0, r3\n\ + cmp r0, 0\n\ + beq _081303D6\n\ + lsrs r1, 4\n\ + b _081303DA\n\ +_081303D6:\n\ + movs r0, 0xF\n\ + ands r1, r0\n\ +_081303DA:\n\ + cmp r1, 0\n\ + bne _081303EC\n\ + adds r0, r4, r3\n\ + lsls r0, 1\n\ + adds r0, r2\n\ + movs r7, 0x80\n\ + lsls r7, 8\n\ + adds r1, r7, 0\n\ + b _081303F8\n\ +_081303EC:\n\ + adds r0, r4, r3\n\ + lsls r0, 1\n\ + adds r0, r2\n\ + lsls r1, 1\n\ + add r1, r9\n\ + ldrh r1, [r1]\n\ +_081303F8:\n\ + strh r1, [r0]\n\ + adds r0, r3, 0x1\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + cmp r3, 0x7\n\ + bls _081303C2\n\ + lsls r0, r6, 16\n\ + lsrs r1, r0, 16\n\ + cmp r1, 0x7\n\ + bls _081303AE\n\ + mov r1, r8\n\ + lsls r0, r1, 16\n\ + lsrs r3, r0, 16\n\ + cmp r3, 0x7\n\ + bls _0813039E\n\ + ldr r2, [sp, 0x4]\n\ + lsls r0, r2, 16\n\ + lsrs r0, 16\n\ + cmp r0, 0x7\n\ + bls _08130394\n\ + add sp, 0xC\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0"); +} +#endif + +static void sub_8130430(u8 arg0, u8 arg1) +{ + u8 x, y; + + LoadPalette(gPictureFramePalettes, 0, 0x100); + if (arg1 == 1) + { + switch (gUnknown_030061C0->contestCategory / 3) + { + case CONTEST_CATEGORY_COOL: + RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM); + RLUnCompWram(gPictureFrameTilemap_0, gUnknown_03006190); + break; + case CONTEST_CATEGORY_BEAUTY: + RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM); + RLUnCompWram(gPictureFrameTilemap_1, gUnknown_03006190); + break; + case CONTEST_CATEGORY_CUTE: + RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM); + RLUnCompWram(gPictureFrameTilemap_2, gUnknown_03006190); + break; + case CONTEST_CATEGORY_SMART: + RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM); + RLUnCompWram(gPictureFrameTilemap_3, gUnknown_03006190); + break; + case CONTEST_CATEGORY_TOUGH: + RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM); + RLUnCompWram(gPictureFrameTilemap_4, gUnknown_03006190); + break; + } + +#define VRAM_PICTURE_DATA(x, y) (((u16 *)(VRAM + 0x6000))[(y) * 32 + (x)]) + + // Set the background + for (y = 0; y < 20; y++) + { + for (x = 0; x < 32; x++) + VRAM_PICTURE_DATA(x, y) = 0x1015; + } + + // Copy the image frame + for (y = 0; y < 10; y++) + { + for (x = 0; x < 18; x++) + VRAM_PICTURE_DATA(x + 6, y + 2) = (*gUnknown_03006190)[y + 2][x + 6]; + } + + // Re-set the entire top row to the first top frame part + for (x = 0; x < 16; x++) + VRAM_PICTURE_DATA(x + 7, 2) = (*gUnknown_03006190)[2][7]; + +#undef VRAM_PICTURE_DATA + } + else if (arg0 < 8) + { + RLUnCompVram(gPictureFrameTiles_5, (void *)VRAM); + RLUnCompVram(gPictureFrameTilemap_5, (void *)(VRAM + 0x6000)); + } + else + { + switch (gUnknown_030061C0->contestCategory / 3) + { + case CONTEST_CATEGORY_COOL: + RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM); + RLUnCompVram(gPictureFrameTilemap_0, (void *)(VRAM + 0x6000)); + break; + case CONTEST_CATEGORY_BEAUTY: + RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM); + RLUnCompVram(gPictureFrameTilemap_1, (void *)(VRAM + 0x6000)); + break; + case CONTEST_CATEGORY_CUTE: + RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM); + RLUnCompVram(gPictureFrameTilemap_2, (void *)(VRAM + 0x6000)); + break; + case CONTEST_CATEGORY_SMART: + RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM); + RLUnCompVram(gPictureFrameTilemap_3, (void *)(VRAM + 0x6000)); + break; + case CONTEST_CATEGORY_TOUGH: + RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM); + RLUnCompVram(gPictureFrameTilemap_4, (void *)(VRAM + 0x6000)); + break; + } + } +} + +static void sub_8130688(u8 arg0) +{ + //Some hacks just to get the asm to match +#ifndef NONMATCHING + asm(""::"r"(arg0)); +#endif + + gMain.oamBuffer[0] = gUnknown_085B0830; + gMain.oamBuffer[0].tileNum = 0; + +#ifndef NONMATCHING + if (arg0) arg0 = gMain.oamBuffer[0].tileNum; +#endif + + gMain.oamBuffer[0].x = 88; + gMain.oamBuffer[0].y = 24; +} + +static u8 sub_81306CC(u8 arg0) +{ + u8 contestCategory; + + if (arg0 < 8) + contestCategory = gUnknown_030061C0->contestCategory; + else + contestCategory = gUnknown_030061C0->contestCategory / 3; + + switch (contestCategory) + { + case CONTEST_CATEGORY_COOL: + return CONTESTRESULT_COOL; + case CONTEST_CATEGORY_BEAUTY: + return CONTESTRESULT_BEAUTY; + case CONTEST_CATEGORY_CUTE: + return CONTESTRESULT_CUTE; + case CONTEST_CATEGORY_SMART: + return CONTESTRESULT_SMART; + case CONTEST_CATEGORY_TOUGH: + return CONTESTRESULT_TOUGH; + } + + return contestCategory; +} + +static void sub_8130738(void) +{ + gContestPaintingMonPalette = AllocZeroed(0x200); + gUnknown_03006190 = AllocZeroed(0x2000); +} + +static void sub_8130760(u8 contestResult) +{ + gUnknown_030061A0.var_4 = gUnknown_03006190; + gUnknown_030061A0.var_8 = gContestPaintingMonPalette; + gUnknown_030061A0.var_18 = 0; + gUnknown_030061A0.var_1F = gUnknown_030061C0->personality % 256; + gUnknown_030061A0.var_19 = 0; + gUnknown_030061A0.var_1A = 0; + gUnknown_030061A0.var_1B = 64; + gUnknown_030061A0.var_1C = 64; + gUnknown_030061A0.var_1D = 64; + gUnknown_030061A0.var_1E = 64; + + switch (contestResult) + { + case CONTESTRESULT_SMART: + case CONTESTRESULT_TOUGH: + gUnknown_030061A0.var_14 = 3; + break; + case CONTESTRESULT_COOL: + case CONTESTRESULT_BEAUTY: + case CONTESTRESULT_CUTE: + default: + gUnknown_030061A0.var_14 = 1; + break; + } + + gUnknown_030061A0.var_16 = 2; + gUnknown_030061A0.var_0 = contestResult; + gUnknown_030061A0.var_10 = 0x6010000; + + sub_8124F2C(&gUnknown_030061A0); + sub_81261A4(&gUnknown_030061A0); + sub_8126058(&gUnknown_030061A0); + + LoadPalette(gContestPaintingMonPalette, 0x100, 0x200); +} + +static void sub_8130884(u8 arg0, u8 arg1) +{ + sub_8130738(); + sub_81302E8(gUnknown_030061C0->species, 0); + sub_8130760(sub_81306CC(arg0)); + sub_8130688(arg0); + sub_8130430(arg0, arg1); +} diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 7fc61f953..f2d5b5cb6 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -220,7 +220,7 @@ static void ShowContestWinnerCleanup(void) void ShowContestWinner(void) { - SetMainCallback2(sub_812FDEC); + SetMainCallback2(CB2_ContestPainting); gMain.savedCallback = ShowContestWinnerCleanup; } diff --git a/sym_common.txt b/sym_common.txt index bb84ec06e..3a7d698fd 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -63,7 +63,7 @@ gUnknown_030061A0: @ 30061A0 gUnknown_030061C0: @ 30061C0 .space 0x4 -gUnknown_030061C4: @ 30061C4 +gContestPaintingMonPalette: @ 30061C4 .space 0xC .include "field_specials.o" From bc11a4a9f4233ce5795f5181729862b26d899f60 Mon Sep 17 00:00:00 2001 From: Meowsy Date: Sat, 15 Dec 2018 15:12:28 -0500 Subject: [PATCH 06/13] Document various things relating to the Pokedex. --- asm/trade.s | 16 +-- include/global.h | 2 +- include/pokedex.h | 11 +- include/pokemon.h | 2 +- src/birch_pc.c | 12 +-- src/credits.c | 10 +- src/event_data.c | 3 +- src/pokedex.c | 164 ++++++++++++++---------------- src/pokemon.c | 18 ++-- src/script_pokemon_util_80F87D8.c | 4 +- src/tv.c | 4 +- 11 files changed, 125 insertions(+), 121 deletions(-) diff --git a/asm/trade.s b/asm/trade.s index 341aa0869..a583e4319 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -3590,7 +3590,7 @@ _08079138: cmp r0, 0 bne _08079158 adds r0, r4, 0 - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 bne _08079164 _08079158: @@ -6160,7 +6160,7 @@ _0807A62E: _0807A64C: lsls r0, r1, 16 lsrs r0, 16 - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 bne _0807A65C movs r0, 0x2 @@ -6200,7 +6200,7 @@ _0807A65C: _0807A6A0: lsls r0, r1, 16 lsrs r0, 16 - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 beq _0807A6D2 _0807A6AC: @@ -6471,7 +6471,7 @@ _0807A87C: b _0807A8C0 _0807A88E: adds r0, r7, 0 - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 bne _0807A89C _0807A898: @@ -6479,7 +6479,7 @@ _0807A898: b _0807A8C0 _0807A89C: mov r0, r8 - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 bne _0807A8AA movs r0, 0x5 @@ -6489,7 +6489,7 @@ _0807A8AA: cmp r0, 0 bne _0807A8BE adds r0, r7, 0 - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 bne _0807A8BE movs r0, 0x7 @@ -6533,7 +6533,7 @@ sub_807A8D0: @ 807A8D0 b _0807A910 _0807A900: adds r0, r6, 0 - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 bne _0807A90E _0807A90A: @@ -6645,7 +6645,7 @@ _0807A9B4: mov r1, sp adds r4, r1, r0 ldrh r0, [r4] - bl sub_806E3F8 + bl IsSpeciesInHoennDex cmp r0, 0 bne _0807A9E0 movs r0, 0x2 diff --git a/include/global.h b/include/global.h index 33a31bf4d..8395d5943 100644 --- a/include/global.h +++ b/include/global.h @@ -230,7 +230,7 @@ struct Time struct Pokedex { /*0x00*/ u8 order; - /*0x01*/ u8 unknown1; + /*0x01*/ u8 mode; /*0x02*/ u8 nationalMagic; // must equal 0xDA in order to have National mode /*0x03*/ u8 unknown2; /*0x04*/ u32 unownPersonality; // set when you first see Unown diff --git a/include/pokedex.h b/include/pokedex.h index 3f90e9508..b6d323fd3 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -4,6 +4,15 @@ extern u8 gUnknown_030060B0; extern void (*gUnknown_030060B4)(void); +#define HOENN_DEX_COUNT 202 +#define NATIONAL_DEX_COUNT 386 + +enum +{ + DEX_MODE_HOENN, + DEX_MODE_NATIONAL +}; + enum { FLAG_GET_SEEN, @@ -31,6 +40,6 @@ u16 GetNationalPokedexCount(u8); u16 GetHoennPokedexCount(u8); u8 CreateDexDisplayMonDataTask(u16 dexNum, u32 trainerId, u32 personality); s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); -u16 sub_80C0E9C(u16, s16, s16, u16); +u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16); #endif // GUARD_POKEDEX_H diff --git a/include/pokemon.h b/include/pokemon.h index 5d7f7f2ae..9b8f1d03f 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -566,7 +566,7 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves); u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves); u8 GetNumberOfRelearnableMoves(struct Pokemon *mon); u16 SpeciesToPokedexNum(u16 species); -bool32 sub_806E3F8(u16 species); +bool32 IsSpeciesInHoennDex(u16 species); void ClearBattleMonForms(void); u16 GetBattleBGM(void); void PlayBattleBGM(void); diff --git a/src/birch_pc.c b/src/birch_pc.c index 3148832be..5080de410 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -66,19 +66,19 @@ const u8 *GetPokedexRatingText(u16 count) return gBirchDexRatingText_LessThan200; if (count == 200) { - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) - || GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200. + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT) + || GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200. return gBirchDexRatingText_LessThan200; return gBirchDexRatingText_DexCompleted; } - if (count == 201) + if (count == HOENN_DEX_COUNT - 1) { - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) - && GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200. + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT) + && GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT)) // If both of these flags are enabled, it means the actual count is less than 200. return gBirchDexRatingText_LessThan200; return gBirchDexRatingText_DexCompleted; } - if (count == 202) + if (count == HOENN_DEX_COUNT) return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210. return gBirchDexRatingText_LessThan10; } diff --git a/src/credits.c b/src/credits.c index 02b01c072..c8a097e49 100644 --- a/src/credits.c +++ b/src/credits.c @@ -135,7 +135,7 @@ struct Unk201C000 u16 unk90; u16 unk92; u16 unk94; - u16 unk96[386]; + u16 unk96[NATIONAL_DEX_COUNT]; u16 unk39A; u16 unk39C[7]; }; @@ -2259,7 +2259,7 @@ static u8 sub_8177224(u16 species, s16 x, s16 y, u16 position) u8 spriteId; u8 spriteId2; - spriteId = sub_80C0E9C(species, x, y, position); + spriteId = CreateMonSpriteFromNationalDexNumber(species, x, y, position); gSprites[spriteId].oam.priority = 1; gSprites[spriteId].data[1] = position + 1; gSprites[spriteId].invisible = TRUE; @@ -2297,16 +2297,16 @@ static void sub_8177388(void) u16 dexNum; u16 j; - for (dexNum = 1, j = 0; dexNum < 386; dexNum++) + for (dexNum = 1, j = 0; dexNum < NATIONAL_DEX_COUNT; dexNum++) { - if (GetSetPokedexFlag(dexNum, 1)) + if (GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT)) { gUnknown_0203BCE8->unk96[j] = dexNum; j++; } } - for (dexNum = j; dexNum < 386; dexNum++) + for (dexNum = j; dexNum < NATIONAL_DEX_COUNT; dexNum++) gUnknown_0203BCE8->unk96[dexNum] = 0; gUnknown_0203BCE8->unk39A = j; diff --git a/src/event_data.c b/src/event_data.c index 8a998fe26..f6a1cde78 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -1,5 +1,6 @@ #include "global.h" #include "event_data.h" +#include "pokedex.h" #define TEMP_FLAGS_SIZE 0x4 #define TEMP_UPPER_FLAGS_SIZE 0x8 @@ -67,7 +68,7 @@ void EnableNationalPokedex(void) gSaveBlock2Ptr->pokedex.nationalMagic = 0xDA; *nationalDexVar = 0x302; FlagSet(FLAG_SYS_NATIONAL_DEX); - gSaveBlock2Ptr->pokedex.unknown1 = 1; + gSaveBlock2Ptr->pokedex.mode = DEX_MODE_NATIONAL; gSaveBlock2Ptr->pokedex.order = 0; sub_80BB358(); } diff --git a/src/pokedex.c b/src/pokedex.c index e6198fd4f..fe9066e4c 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -75,9 +75,6 @@ struct UnknownStruct4 u8 unk9; }; -#define HOENN_DEX_COUNT 202 -#define NATIONAL_DEX_COUNT 386 - extern struct MusicPlayerInfo gMPlayInfo_BGM; struct PokedexListItem @@ -130,12 +127,6 @@ struct PokedexView u8 unk65C[8]; }; -enum -{ - DEX_MODE_HOENN, - DEX_MODE_NATIONAL -}; - enum { AREA_SCREEN, @@ -176,7 +167,7 @@ u16 sub_80BD69C(u16, u16); void sub_80BD8D0(void); bool8 sub_80BD930(void); u8 sub_80BDA40(void); -u16 sub_80BDA8C(u16); +u16 GetPokemonSpriteToDisplay(u16); u32 sub_80BDACC(u16, s16, s16); static void CreateInterfaceSprites(u8); void sub_80BE470(struct Sprite *sprite); @@ -1237,7 +1228,7 @@ void ResetPokedex(void) gUnknown_02039B50 = 0; gUnknown_02039B52 = 64; gUnknown_030060B0 = 0; - gSaveBlock2Ptr->pokedex.unknown1 = 0; + gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN; gSaveBlock2Ptr->pokedex.order = 0; gSaveBlock2Ptr->pokedex.nationalMagic = 0; gSaveBlock2Ptr->pokedex.unknown2 = 0; @@ -1289,7 +1280,7 @@ static void ResetPokedexView(struct PokedexView *pokedexView) pokedexView->unk618 = 0; pokedexView->seenCount = 0; pokedexView->ownCount = 0; - for (i = 0; i <= 3; i++) + for (i = 0; i < 4; i++) pokedexView->unk61E[i] |= 0xFFFF; pokedexView->unk628 = 0; pokedexView->unk62A = 0; @@ -1348,7 +1339,7 @@ void CB2_Pokedex(void) sPokedexView = AllocZeroed(sizeof(struct PokedexView)); ResetPokedexView(sPokedexView); CreateTask(sub_80BB78C, 0); - sPokedexView->dexMode = gSaveBlock2Ptr->pokedex.unknown1; + sPokedexView->dexMode = gSaveBlock2Ptr->pokedex.mode; if (!IsNationalPokedexEnabled()) sPokedexView->dexMode = DEX_MODE_HOENN; sPokedexView->dexOrder = gSaveBlock2Ptr->pokedex.order; @@ -1571,9 +1562,9 @@ void sub_80BBDE8(u8 taskId) { if (!gPaletteFade.active) { - gSaveBlock2Ptr->pokedex.unknown1 = sPokedexView->dexMode; + gSaveBlock2Ptr->pokedex.mode = sPokedexView->dexMode; if (!IsNationalPokedexEnabled()) - gSaveBlock2Ptr->pokedex.unknown1 = DEX_MODE_HOENN; + gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN; gSaveBlock2Ptr->pokedex.order = sPokedexView->dexOrder; sub_80BDA40(); sub_80BC890(); @@ -1898,6 +1889,9 @@ void sub_80BC890(void) void sub_80BC8D4(u8 dexMode, u8 sortMode) { u16 vars[3]; //I have no idea why three regular variables are stored in an array, but whatever. +#define temp_dexCount vars[0] +#define temp_notNationalDex vars[1] +#define temp_dexNum vars[2] s16 i; sPokedexView->pokemonListCount = 0; @@ -1906,19 +1900,19 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) { default: case DEX_MODE_HOENN: - vars[0] = HOENN_DEX_COUNT; - vars[1] = 1; + temp_dexCount = HOENN_DEX_COUNT; + temp_notNationalDex = TRUE; break; case DEX_MODE_NATIONAL: if (IsNationalPokedexEnabled()) { - vars[0] = NATIONAL_DEX_COUNT; - vars[1] = 0; + temp_dexCount = NATIONAL_DEX_COUNT; + temp_notNationalDex = FALSE; } else { - vars[0] = HOENN_DEX_COUNT; - vars[1] = 1; + temp_dexCount = HOENN_DEX_COUNT; + temp_notNationalDex = TRUE; } break; } @@ -1926,14 +1920,14 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) switch (sortMode) { case 0: - if (vars[1]) + if (temp_notNationalDex) { - for (i = 0; i < vars[0]; i++) + for (i = 0; i < temp_dexCount; i++) { - vars[2] = HoennToNationalOrder(i + 1); - sPokedexView->pokedexList[i].dexNum = vars[2]; - sPokedexView->pokedexList[i].seen = GetSetPokedexFlag(vars[2], 0); - sPokedexView->pokedexList[i].owned = GetSetPokedexFlag(vars[2], 1); + temp_dexNum = HoennToNationalOrder(i + 1); + sPokedexView->pokedexList[i].dexNum = temp_dexNum; + sPokedexView->pokedexList[i].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN); + sPokedexView->pokedexList[i].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT); if (sPokedexView->pokedexList[i].seen) sPokedexView->pokemonListCount = i + 1; } @@ -1944,17 +1938,17 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) s16 r5; r10 = r5 = i = 0; - for (i = 0; i < vars[0]; i++) + for (i = 0; i < temp_dexCount; i++) { - vars[2] = i + 1; - if (GetSetPokedexFlag(vars[2], 0)) + temp_dexNum = i + 1; + if (GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN)) r10 = 1; if (r10) { asm(""); //Needed to match for some reason - sPokedexView->pokedexList[r5].dexNum = vars[2]; - sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(vars[2], 0); - sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(vars[2], 1); + sPokedexView->pokedexList[r5].dexNum = temp_dexNum; + sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN); + sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT); if (sPokedexView->pokedexList[r5].seen) sPokedexView->pokemonListCount = r5 + 1; r5++; @@ -1965,13 +1959,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) case 1: for (i = 0; i < POKEMON_SLOTS_NUMBER - 1; i++) { - vars[2] = gPokedexOrder_Alphabetical[i]; + temp_dexNum = gPokedexOrder_Alphabetical[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 0)) + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN)) { - sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2]; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = GetSetPokedexFlag(vars[2], 1); + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT); sPokedexView->pokemonListCount++; } } @@ -1979,13 +1973,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) case 2: for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--) { - vars[2] = gPokedexOrder_Weight[i]; + temp_dexNum = gPokedexOrder_Weight[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) { - sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2]; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; sPokedexView->pokemonListCount++; } } @@ -1993,27 +1987,27 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) case 3: for (i = 0; i < NATIONAL_DEX_COUNT; i++) { - vars[2] = gPokedexOrder_Weight[i]; + temp_dexNum = gPokedexOrder_Weight[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) { - sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2]; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; sPokedexView->pokemonListCount++; } } break; case 4: - for (i = NATIONAL_DEX_COUNT - 1; i >=0; i--) + for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--) { - vars[2] = gPokedexOrder_Height[i]; + temp_dexNum = gPokedexOrder_Height[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) { - sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2]; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; sPokedexView->pokemonListCount++; } } @@ -2021,13 +2015,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) case 5: for (i = 0; i < NATIONAL_DEX_COUNT; i++) { - vars[2] = gPokedexOrder_Height[i]; + temp_dexNum = gPokedexOrder_Height[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT)) { - sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2]; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1; - sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE; + sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE; sPokedexView->pokemonListCount++; } } @@ -2037,8 +2031,8 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++) { sPokedexView->pokedexList[i].dexNum |= 0xFFFF; - sPokedexView->pokedexList[i].seen = 0; - sPokedexView->pokedexList[i].owned = 0; + sPokedexView->pokedexList[i].seen = FALSE; + sPokedexView->pokedexList[i].owned = FALSE; } } @@ -2192,7 +2186,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b) sPokedexView->unk61E[i] = 0xFFFF; sPokedexView->selectedMonSpriteId = 0xFFFF; - unk = sub_80BDA8C(selectedMon - 1); + unk = GetPokemonSpriteToDisplay(selectedMon - 1); if (unk != 0xFFFF) { spriteId = sub_80BDACC(unk, 0x60, 0x50); @@ -2200,7 +2194,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b) gSprites[spriteId].data[5] = -32; } - unk = sub_80BDA8C(selectedMon); + unk = GetPokemonSpriteToDisplay(selectedMon); if (unk != 0xFFFF) { spriteId = sub_80BDACC(unk, 0x60, 0x50); @@ -2208,7 +2202,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b) gSprites[spriteId].data[5] = 0; } - unk = sub_80BDA8C(selectedMon + 1); + unk = GetPokemonSpriteToDisplay(selectedMon + 1); if (unk != 0xFFFF) { spriteId = sub_80BDACC(unk, 0x60, 0x50); @@ -2274,7 +2268,7 @@ static void CreateNewPokemonSprite(u8 direction, u16 selectedMon) switch (direction) { case 1: // up - unk = sub_80BDA8C(selectedMon - 1); + unk = GetPokemonSpriteToDisplay(selectedMon - 1); if (unk != 0xFFFF) { spriteId = sub_80BDACC(unk, 0x60, 0x50); @@ -2287,7 +2281,7 @@ static void CreateNewPokemonSprite(u8 direction, u16 selectedMon) sPokedexView->unk630 = 15; break; case 2: // down - unk = sub_80BDA8C(selectedMon + 1); + unk = GetPokemonSpriteToDisplay(selectedMon + 1); if (unk != 0xFFFF) { spriteId = sub_80BDACC(unk, 0x60, 0x50); @@ -2449,12 +2443,12 @@ u8 sub_80BDA40(void) return FALSE; } -u16 sub_80BDA8C(u16 a1) +u16 GetPokemonSpriteToDisplay(u16 species) { - if (a1 >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[a1].dexNum == 0xFFFF) + if (species >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[species].dexNum == 0xFFFF) return 0xFFFF; - else if (sPokedexView->pokedexList[a1].seen) - return sPokedexView->pokedexList[a1].dexNum; + else if (sPokedexView->pokedexList[species].seen) + return sPokedexView->pokedexList[species].dexNum; else return 0; } @@ -2467,7 +2461,7 @@ u32 sub_80BDACC(u16 num, s16 x, s16 y) { if (sPokedexView->unk61E[i] == 0xFFFF) { - u8 spriteId = sub_80C0E9C(num, x, y, i); + u8 spriteId = CreateMonSpriteFromNationalDexNumber(num, x, y, i); gSprites[spriteId].oam.affineMode = 1; gSprites[spriteId].oam.priority = 3; @@ -2963,7 +2957,7 @@ void sub_80BEA24(u8 taskId) case 5: if (gTasks[taskId].data[1] == 0) { - gTasks[taskId].data[4] = (u16)sub_80C0E9C(sPokedexListItem->dexNum, 0x30, 0x38, 0); + gTasks[taskId].data[4] = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 0x30, 0x38, 0); gSprites[gTasks[taskId].data[4]].oam.priority = 0; } gMain.state++; @@ -3251,7 +3245,7 @@ void sub_80BF250(u8 taskId) gMain.state++; break; case 5: - gTasks[taskId].data[4] = sub_80C0E9C(sPokedexListItem->dexNum, 48, 56, 0); + gTasks[taskId].data[4] = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 48, 56, 0); gSprites[gTasks[taskId].data[4]].oam.priority = 0; gDexCryScreenState = 0; gMain.state++; @@ -3459,7 +3453,7 @@ void sub_80BF82C(u8 taskId) gMain.state++; break; case 6: - spriteId = sub_80C0E9C(sPokedexListItem->dexNum, 88, 56, 1); + spriteId = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 88, 56, 1); gSprites[spriteId].oam.affineMode = 1; gSprites[spriteId].oam.matrixNum = 2; gSprites[spriteId].oam.priority = 0; @@ -3790,7 +3784,7 @@ void sub_80BFE38(u8 taskId) gTasks[taskId].data[0]++; break; case 4: - spriteId = sub_80C0E9C(dexNum, 0x30, 0x38, 0); + spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, 0x30, 0x38, 0); gSprites[spriteId].oam.priority = 0; BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gUnknown_030060B4); @@ -4348,7 +4342,7 @@ u16 GetHoennPokedexCount(u8 caseID) u16 count = 0; u16 i; - for (i = 0; i < 202; i++) + for (i = 0; i < HOENN_DEX_COUNT; i++) { switch (caseID) { @@ -4417,17 +4411,17 @@ u16 sub_80C0944(void) for (i = 0; i < 150; i++) { - if (GetSetPokedexFlag(i + 1, 1) == 0) + if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE) return 0; } for (i = 151; i < 248; i++) { - if (GetSetPokedexFlag(i + 1, 1) == 0) + if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE) return 0; } for (i = 251; i < 384; i++) { - if (GetSetPokedexFlag(i + 1, 1) == 0) + if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE) return 0; } return 1; @@ -4643,10 +4637,10 @@ u32 sub_80C0E68(u16 a) } } -u16 sub_80C0E9C(u16 num, s16 x, s16 y, u16 paletteSlot) +u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot) { - num = NationalPokedexNumToSpecies(num); - return CreateMonPicSprite_HandleDeoxys(num, 8, sub_80C0E68(num), TRUE, x, y, paletteSlot, 0xFFFF); + nationalNum = NationalPokedexNumToSpecies(nationalNum); + return CreateMonPicSprite_HandleDeoxys(nationalNum, 8, sub_80C0E68(nationalNum), TRUE, x, y, paletteSlot, 0xFFFF); } u16 sub_80C0EF8(u16 species, s16 x, s16 y, s8 paletteSlot) @@ -4980,10 +4974,10 @@ void sub_80C170C(u8 taskId) sPokedexView->unk62A = 0x40; gUnknown_02039B50 = 0; sPokedexView->unk610 = 0; - gSaveBlock2Ptr->pokedex.unknown1 = sub_80C2318(taskId, 5); + gSaveBlock2Ptr->pokedex.mode = sub_80C2318(taskId, 5); if (!IsNationalPokedexEnabled()) - gSaveBlock2Ptr->pokedex.unknown1 = 0; - sPokedexView->unk614 = gSaveBlock2Ptr->pokedex.unknown1; + gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN; + sPokedexView->unk614 = gSaveBlock2Ptr->pokedex.mode; gSaveBlock2Ptr->pokedex.order = sub_80C2318(taskId, 4); sPokedexView->unk618 = gSaveBlock2Ptr->pokedex.order; PlaySE(SE_PC_OFF); diff --git a/src/pokemon.c b/src/pokemon.c index eec995050..8e32479a1 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5864,10 +5864,10 @@ u16 HoennPokedexNumToSpecies(u16 hoennNum) species = 0; - while (species < 411 && gSpeciesToHoennPokedexNum[species] != hoennNum) + while (species < (NUM_SPECIES - 1) && gSpeciesToHoennPokedexNum[species] != hoennNum) species++; - if (species == 411) + if (species == NUM_SPECIES - 1) return 0; return species + 1; @@ -5882,10 +5882,10 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum) species = 0; - while (species < 411 && gSpeciesToNationalPokedexNum[species] != nationalNum) + while (species < (NUM_SPECIES - 1) && gSpeciesToNationalPokedexNum[species] != nationalNum) species++; - if (species == 411) + if (species == NUM_SPECIES - 1) return 0; return species + 1; @@ -5900,10 +5900,10 @@ u16 NationalToHoennOrder(u16 nationalNum) hoennNum = 0; - while (hoennNum < 411 && gHoennToNationalOrder[hoennNum] != nationalNum) + while (hoennNum < (NUM_SPECIES - 1) && gHoennToNationalOrder[hoennNum] != nationalNum) hoennNum++; - if (hoennNum == 411) + if (hoennNum == NUM_SPECIES - 1) return 0; return hoennNum + 1; @@ -6584,15 +6584,15 @@ u16 SpeciesToPokedexNum(u16 species) else { species = SpeciesToHoennPokedexNum(species); - if (species <= 202) + if (species <= HOENN_DEX_COUNT) return species; return 0xFFFF; } } -bool32 sub_806E3F8(u16 species) +bool32 IsSpeciesInHoennDex(u16 species) { - if (SpeciesToHoennPokedexNum(species) > 202) + if (SpeciesToHoennPokedexNum(species) > HOENN_DEX_COUNT) return FALSE; else return TRUE; diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 7fc61f953..9b7269f00 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -563,8 +563,8 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u { case 0: case 1: - GetSetPokedexFlag(nationalDexNum, 2); - GetSetPokedexFlag(nationalDexNum, 3); + GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN); + GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT); break; } return sentToPc; diff --git a/src/tv.c b/src/tv.c index f77e93cb7..1072ba049 100644 --- a/src/tv.c +++ b/src/tv.c @@ -3229,7 +3229,7 @@ u16 TV_GetSomeOtherSpeciesAlreadySeenByPlayer(u16 passedSpecies) species = (Random() % (NUM_SPECIES - 1)) + 1; initSpecies = species; - while (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), 0) != 1 || species == passedSpecies) + while (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN) != TRUE || species == passedSpecies) { if (species == 1) { @@ -4376,7 +4376,7 @@ void SetTvShowInactive(u8 showIdx) static void sub_80F0B24(u16 species, u8 showIdx) { - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), 0) == 0) + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN) == FALSE) { gSaveBlock1Ptr->tvShows[showIdx].common.active = FALSE; } From 8f168add219e5bd86c6115c79c41e8ac973c61ac Mon Sep 17 00:00:00 2001 From: Meowsy Date: Sat, 15 Dec 2018 15:25:45 -0500 Subject: [PATCH 07/13] Remove incorrect comment. --- src/birch_pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/birch_pc.c b/src/birch_pc.c index 5080de410..5179b1920 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -79,7 +79,7 @@ const u8 *GetPokedexRatingText(u16 count) return gBirchDexRatingText_DexCompleted; } if (count == HOENN_DEX_COUNT) - return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210. + return gBirchDexRatingText_DexCompleted; return gBirchDexRatingText_LessThan10; } From 83c3f136551bc79bfffb4630469cc79c9f06951c Mon Sep 17 00:00:00 2001 From: Meowsy Date: Sat, 15 Dec 2018 15:26:07 -0500 Subject: [PATCH 08/13] Prettify line. --- src/tv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tv.c b/src/tv.c index 1072ba049..0d6e12279 100644 --- a/src/tv.c +++ b/src/tv.c @@ -4376,7 +4376,7 @@ void SetTvShowInactive(u8 showIdx) static void sub_80F0B24(u16 species, u8 showIdx) { - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN) == FALSE) + if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN)) { gSaveBlock1Ptr->tvShows[showIdx].common.active = FALSE; } From 3d8cecb66238a5597e3675f81ec072e650afdf5c Mon Sep 17 00:00:00 2001 From: Meowsy Date: Sat, 15 Dec 2018 18:32:50 -0500 Subject: [PATCH 09/13] Use correct term. --- src/credits.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/credits.c b/src/credits.c index c8a097e49..67ab97481 100644 --- a/src/credits.c +++ b/src/credits.c @@ -2254,12 +2254,12 @@ static void sub_8177050(struct Sprite *sprite) } } -static u8 sub_8177224(u16 species, s16 x, s16 y, u16 position) +static u8 sub_8177224(u16 nationalDexNum, s16 x, s16 y, u16 position) { u8 spriteId; u8 spriteId2; - spriteId = CreateMonSpriteFromNationalDexNumber(species, x, y, position); + spriteId = CreateMonSpriteFromNationalDexNumber(nationalDexNum, x, y, position); gSprites[spriteId].oam.priority = 1; gSprites[spriteId].data[1] = position + 1; gSprites[spriteId].invisible = TRUE; From 6ed8e4d6eda271653daa7e2ab13ccf0ae752c9cd Mon Sep 17 00:00:00 2001 From: Meowsy Date: Sat, 15 Dec 2018 18:34:06 -0500 Subject: [PATCH 10/13] Rename temp_notNationalDex to temp_isHoennDex. Don't use hexadecimal format for x and y args. --- src/pokedex.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index fe9066e4c..f6d46f5d3 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1889,9 +1889,9 @@ void sub_80BC890(void) void sub_80BC8D4(u8 dexMode, u8 sortMode) { u16 vars[3]; //I have no idea why three regular variables are stored in an array, but whatever. -#define temp_dexCount vars[0] -#define temp_notNationalDex vars[1] -#define temp_dexNum vars[2] +#define temp_dexCount vars[0] +#define temp_isHoennDex vars[1] +#define temp_dexNum vars[2] s16 i; sPokedexView->pokemonListCount = 0; @@ -1901,18 +1901,18 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) default: case DEX_MODE_HOENN: temp_dexCount = HOENN_DEX_COUNT; - temp_notNationalDex = TRUE; + temp_isHoennDex = TRUE; break; case DEX_MODE_NATIONAL: if (IsNationalPokedexEnabled()) { temp_dexCount = NATIONAL_DEX_COUNT; - temp_notNationalDex = FALSE; + temp_isHoennDex = FALSE; } else { temp_dexCount = HOENN_DEX_COUNT; - temp_notNationalDex = TRUE; + temp_isHoennDex = TRUE; } break; } @@ -1920,7 +1920,7 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) switch (sortMode) { case 0: - if (temp_notNationalDex) + if (temp_isHoennDex) { for (i = 0; i < temp_dexCount; i++) { @@ -2957,7 +2957,7 @@ void sub_80BEA24(u8 taskId) case 5: if (gTasks[taskId].data[1] == 0) { - gTasks[taskId].data[4] = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 0x30, 0x38, 0); + gTasks[taskId].data[4] = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 48, 56, 0); gSprites[gTasks[taskId].data[4]].oam.priority = 0; } gMain.state++; @@ -3784,7 +3784,7 @@ void sub_80BFE38(u8 taskId) gTasks[taskId].data[0]++; break; case 4: - spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, 0x30, 0x38, 0); + spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, 48, 56, 0); gSprites[spriteId].oam.priority = 0; BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gUnknown_030060B4); From 1d09216e4b776ed03daa83c66fd6600bc43f8d25 Mon Sep 17 00:00:00 2001 From: Meowsy Date: Sat, 15 Dec 2018 18:39:48 -0500 Subject: [PATCH 11/13] Simplify comparisons. --- src/pokedex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pokedex.c b/src/pokedex.c index f6d46f5d3..ef8905bb6 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4411,17 +4411,17 @@ u16 sub_80C0944(void) for (i = 0; i < 150; i++) { - if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE) + if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) return 0; } for (i = 151; i < 248; i++) { - if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE) + if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) return 0; } for (i = 251; i < 384; i++) { - if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE) + if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) return 0; } return 1; From 9c5fa4a787daa8200e32c69c207fedaa0bc58c76 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 16 Dec 2018 08:28:09 -0600 Subject: [PATCH 12/13] Fix typo in UpdateContestPaintingMosaicEffect() --- src/contest_painting.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/contest_painting.c b/src/contest_painting.c index b1b189c09..9de3d733d 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -344,7 +344,7 @@ static void InitContestPaintingVars(bool8 arg0) } } -static void UpdateContestPaitingMosaicEffect(void) +static void UpdateContestPaintingMosaicEffect(void) { if (!gUnknown_030011F6) { @@ -360,7 +360,7 @@ static void UpdateContestPaitingMosaicEffect(void) static void VBlankCB_ContestPainting(void) { - UpdateContestPaitingMosaicEffect(); + UpdateContestPaintingMosaicEffect(); LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); From d1e6e705ccf05f93933ae4494b1d388550d81d26 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 16 Dec 2018 11:35:10 -0600 Subject: [PATCH 13/13] Decompile battle_anim_effects_1.c --- asm/battle_anim_effects_1.s | 9550 ----------------------------------- include/battle_anim.h | 6 + include/battle_interface.h | 2 + ld_script.txt | 4 +- src/battle_anim_80A5C6C.c | 9 +- src/battle_anim_80D51AC.c | 8 +- src/battle_anim_effects_1.c | 5520 ++++++++++++++++++++ src/effects_1.c | 2093 -------- src/fire.c | 2 +- sym_ewram.txt | 3 +- 10 files changed, 5540 insertions(+), 11657 deletions(-) delete mode 100644 asm/battle_anim_effects_1.s create mode 100644 src/battle_anim_effects_1.c delete mode 100644 src/effects_1.c diff --git a/asm/battle_anim_effects_1.s b/asm/battle_anim_effects_1.s deleted file mode 100644 index 910b09b8c..000000000 --- a/asm/battle_anim_effects_1.s +++ /dev/null @@ -1,9550 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_80FE840 -sub_80FE840: @ 80FE840 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gBattleAnimArgs - ldrh r0, [r5] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r5, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x30] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080FE87C - ldrh r0, [r5, 0x8] - negs r0, r0 - b _080FE87E - .pool -_080FE87C: - ldrh r0, [r5, 0x8] -_080FE87E: - strh r0, [r4, 0x34] - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0xA] - strh r0, [r4, 0x36] - ldr r0, =sub_80FE898 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE840 - - thumb_func_start sub_80FE898 -sub_80FE898: @ 80FE898 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _080FE8D4 - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - lsls r0, r1, 16 - asrs r0, 24 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r1, r0 - strh r1, [r4, 0x32] - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r2, 0x34 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x38] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] - b _080FE8DA -_080FE8D4: - adds r0, r4, 0 - bl DestroyAnimSprite -_080FE8DA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FE898 - - thumb_func_start sub_80FE8E0 -sub_80FE8E0: @ 80FE8E0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x4] - strh r0, [r4, 0x2E] - 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, =StartAnimLinearTranslation - str r0, [r4, 0x1C] - ldr r1, =move_anim_8074EE0 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE8E0 - - thumb_func_start sub_80FE930 -sub_80FE930: @ 80FE930 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r5, =gBattleAnimArgs - ldrb r1, [r5, 0x6] - adds r0, r4, 0 - bl StartSpriteAnim - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x2E] - 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, =StartAnimLinearTranslation - 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_80FE930 - - thumb_func_start sub_80FE988 -sub_80FE988: @ 80FE988 - push {r4-r6,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r6, =gBattleAnimArgs - ldrh r0, [r6, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl InitAnimLinearTranslation - ldrh r0, [r6, 0x6] - strh r0, [r4, 0x38] - ldr r1, =sub_80FE9E4 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE988 - - thumb_func_start sub_80FE9E4 -sub_80FE9E4: @ 80FE9E4 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - beq _080FE9FA - adds r0, r4, 0 - bl DestroySprite - b _080FEA4E -_080FE9FA: - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x7F - ble _080FEA14 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A82E4 - adds r0, 0x1 - b _080FEA1E - .pool -_080FEA14: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A82E4 - adds r0, 0x6 -_080FEA1E: - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0x5 - bl Sin - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0xE - bl Cos - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x38] - adds r0, 0xF - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] -_080FEA4E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE9E4 - - thumb_func_start sub_80FEA58 -sub_80FEA58: @ 80FEA58 - 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 - ldrh r0, [r5, 0x8] - subs r0, 0x1 - movs r2, 0 - strh r0, [r5, 0x8] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080FEAB2 - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - movs r0, 0x6 - strh r0, [r5, 0x8] - ldr r1, =gBattleAnimArgs - movs r0, 0xF - strh r0, [r1] - strh r2, [r1, 0x2] - movs r0, 0x50 - strh r0, [r1, 0x4] - strh r2, [r1, 0x6] - ldr r4, =gUnknown_08592210 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A82E4 - adds r3, r0, 0 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - bl CreateSpriteAndAnimate -_080FEAB2: - movs r1, 0xA - ldrsh r0, [r5, r1] - cmp r0, 0xF - bne _080FEAC0 - adds r0, r6, 0 - bl DestroyAnimVisualTask -_080FEAC0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FEA58 - - thumb_func_start sub_80FEAD8 -sub_80FEAD8: @ 80FEAD8 - push {r4-r6,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl sub_80A6980 - ldr r6, =gBattleAnimArgs - ldrh r0, [r6, 0x6] - strh r0, [r4, 0x2E] - 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] - ldrh r0, [r6, 0x4] - strh r0, [r4, 0x38] - adds r0, r4, 0 - bl InitAnimArcTranslation - ldr r0, =sub_80FEB28 - str r0, [r4, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FEAD8 - - thumb_func_start sub_80FEB28 -sub_80FEB28: @ 80FEB28 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _080FEB3C - adds r0, r4, 0 - bl DestroyAnimSprite -_080FEB3C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FEB28 - - thumb_func_start sub_80FEB44 -sub_80FEB44: @ 80FEB44 - push {r4,r5,lr} - adds r5, r0, 0 - bl Random2 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x7 - ands r1, r0 - adds r0, r5, 0 - bl StartSpriteAnim - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080FEB90 - ldrh r0, [r5, 0x20] - subs r0, 0x14 - b _080FEB94 - .pool -_080FEB90: - ldrh r0, [r5, 0x20] - adds r0, 0x14 -_080FEB94: - strh r0, [r5, 0x20] - bl Random2 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1F - ands r0, r1 - adds r0, 0x40 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x20] - strh r0, [r5, 0x30] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x22] - strh r0, [r5, 0x34] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl sub_80A7160 - bl Random2 - movs r1, 0xFF - ands r1, r0 - strh r1, [r5, 0x38] - adds r0, r5, 0 - adds r0, 0x43 - ldrb r0, [r0] - strh r0, [r5, 0x3A] - ldr r1, =sub_80FEBFC - str r1, [r5, 0x1C] - adds r0, r5, 0 - bl _call_via_r1 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FEB44 - - thumb_func_start sub_80FEBFC -sub_80FEBFC: @ 80FEBFC - push {r4,lr} - adds r4, r0, 0 - bl sub_80A70E8 - lsls r0, 24 - cmp r0, 0 - beq _080FEC12 - adds r0, r4, 0 - bl DestroyAnimSprite - b _080FEC42 -_080FEC12: - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0xC - bl Cos - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x7E - bgt _080FEC2E - ldrh r0, [r4, 0x3A] - b _080FEC32 -_080FEC2E: - ldrh r0, [r4, 0x3A] - adds r0, 0x1 -_080FEC32: - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - ldrh r0, [r4, 0x38] - adds r0, 0x18 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] -_080FEC42: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FEBFC - - thumb_func_start sub_80FEC48 -sub_80FEC48: @ 80FEC48 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080FEC68 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080FEC68: - ldr r4, =gBattleAnimArgs - ldrh r0, [r4, 0x8] - strh r0, [r6, 0x2E] - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x4] - adds r0, r1 - strh r0, [r6, 0x32] - ldrb r0, [r5] - movs r1, 0x1 - 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 InitAnimArcTranslation - ldr r0, =sub_80FECB8 - str r0, [r6, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FEC48 - - thumb_func_start sub_80FECB8 -sub_80FECB8: @ 80FECB8 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _080FECE2 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r0, 0xA - strh r0, [r4, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r4, 0x1C] - ldr r1, =sub_80FECF0 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 -_080FECE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FECB8 - - thumb_func_start sub_80FECF0 -sub_80FECF0: @ 80FECF0 - push {r4,lr} - adds r4, r0, 0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim - movs r0, 0x3C - strh r0, [r4, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r4, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FECF0 - - thumb_func_start sub_80FED28 -sub_80FED28: @ 80FED28 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl sub_80A6980 - ldr r5, =gBattleAnimArgs - ldrb r1, [r5, 0x8] - adds r0, r4, 0 - bl StartSpriteAnim - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _080FED52 - ldrb r0, [r4, 0x1] - movs r1, 0xD - negs r1, r1 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r4, 0x1] -_080FED52: - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x30] - ldr r1, =sub_80FED74 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FED28 - - thumb_func_start sub_80FED74 -sub_80FED74: @ 80FED74 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x3 - negs r1, r1 - bl Cos - ldrh r1, [r4, 0x32] - adds r1, 0x18 - strh r1, [r4, 0x32] - lsls r1, 16 - asrs r1, 24 - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x7F - bhi _080FEDC8 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8328 - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - b _080FEDEC - .pool -_080FEDC8: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8328 - adds r0, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _080FEDDC - movs r2, 0x3 -_080FEDDC: - movs r0, 0x3 - ands r2, r0 - lsls r2, 2 - ldrb r1, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - orrs r0, r2 -_080FEDEC: - strb r0, [r4, 0x5] - ldrh r0, [r4, 0x30] - adds r0, 0x2 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x2E] - subs r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080FEE10 - adds r0, r4, 0 - bl DestroyAnimSprite -_080FEE10: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FED74 - - thumb_func_start sub_80FEE1C -sub_80FEE1C: @ 80FEE1C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080FEE36 - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _080FEE3E -_080FEE36: - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _080FEE70 -_080FEE3E: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8364 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FEE60 - movs r0, 0x2 - movs r1, 0x4 - movs r2, 0x3 - bl SetAnimBgAttribute - b _080FEE6A - .pool -_080FEE60: - movs r0, 0x1 - movs r1, 0x4 - movs r2, 0x1 - bl SetAnimBgAttribute -_080FEE6A: - adds r0, r4, 0 - bl DestroyAnimVisualTask -_080FEE70: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FEE1C - - thumb_func_start sub_80FEE78 -sub_80FEE78: @ 80FEE78 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0 - bl InitAnimSpritePos - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r5, [r5, 0x4] - adds r0, r5 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl InitAnimLinearTranslation - movs r0, 0x40 - strh r0, [r4, 0x38] - ldr r1, =sub_80FEECC - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FEE78 - - thumb_func_start sub_80FEECC -sub_80FEECC: @ 80FEECC - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - bne _080FEF38 - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0x5 - negs r1, r1 - bl Cos - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x38] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x7F - bhi _080FEF18 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl sub_80A82E4 - subs r0, 0x1 - b _080FEF22 - .pool -_080FEF18: - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl sub_80A82E4 - adds r0, 0x1 -_080FEF22: - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - ldrh r0, [r4, 0x38] - adds r0, 0x5 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] - b _080FEF3E - .pool -_080FEF38: - adds r0, r4, 0 - bl DestroyAnimSprite -_080FEF3E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FEECC - - thumb_func_start sub_80FEF44 -sub_80FEF44: @ 80FEF44 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r5, =gBattleAnimArgs - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x20] - strh r0, [r4, 0x30] - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r5, [r5, 0x4] - adds r0, r5 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl InitAnimLinearTranslation - movs r0, 0x40 - strh r0, [r4, 0x38] - ldr r1, =sub_80FEF98 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FEF44 - - thumb_func_start sub_80FEF98 -sub_80FEF98: @ 80FEF98 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - bne _080FEFF0 - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - ldrh r1, [r4, 0x38] - adds r0, r1, 0 - subs r0, 0x3B - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x4 - bls _080FEFD0 - adds r0, r1, 0 - subs r0, 0xBB - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x4 - bhi _080FEFE4 -_080FEFD0: - ldrb r2, [r4, 0x3] - lsls r1, r2, 26 - lsrs r1, 27 - movs r0, 0x8 - eors r1, r0 - lsls r1, 1 - subs r0, 0x47 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x3] -_080FEFE4: - ldrh r0, [r4, 0x38] - adds r0, 0x5 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] - b _080FEFF6 -_080FEFF0: - adds r0, r4, 0 - bl DestroyAnimSprite -_080FEFF6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FEF98 - - thumb_func_start sub_80FEFFC -sub_80FEFFC: @ 80FEFFC - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x20] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x22] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - strh r0, [r4, 0x2E] - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x32] - ldr r0, =sub_80FF044 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FEFFC - - thumb_func_start sub_80FF044 -sub_80FF044: @ 80FF044 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x32] - movs r2, 0x32 - ldrsh r3, [r1, r2] - cmp r3, 0 - bne _080FF078 - ldrh r0, [r1, 0x30] - movs r2, 0x1 - ands r2, r0 - cmp r2, 0 - beq _080FF066 - movs r0, 0x80 - strh r0, [r1, 0x2E] - strh r3, [r1, 0x30] - strh r3, [r1, 0x32] - b _080FF06C -_080FF066: - strh r2, [r1, 0x2E] - strh r2, [r1, 0x30] - strh r2, [r1, 0x32] -_080FF06C: - ldr r0, =sub_80FF090 - str r0, [r1, 0x1C] - b _080FF08C - .pool -_080FF078: - subs r0, 0x1 - strh r0, [r1, 0x32] - ldrh r0, [r1, 0x2E] - ldrh r2, [r1, 0x20] - adds r0, r2 - strh r0, [r1, 0x20] - ldrh r0, [r1, 0x30] - ldrh r2, [r1, 0x22] - adds r0, r2 - strh r0, [r1, 0x22] -_080FF08C: - pop {r0} - bx r0 - thumb_func_end sub_80FF044 - - thumb_func_start sub_80FF090 -sub_80FF090: @ 80FF090 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080FF0B4 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x19 - bl Sin - negs r0, r0 - b _080FF0BE - .pool -_080FF0B4: - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x19 - bl Sin -_080FF0BE: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x2E] - adds r0, 0x2 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080FF0DE - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] -_080FF0DE: - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x50 - ble _080FF0EC - adds r0, r4, 0 - bl DestroyAnimSprite -_080FF0EC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FF090 - - thumb_func_start sub_80FF0F4 -sub_80FF0F4: @ 80FF0F4 - push {r4-r6,lr} - adds r5, r0, 0 - movs r1, 0x1 - bl InitAnimSpritePos - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080FF114 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_080FF114: - ldr r6, =gBattleAnimArgs - ldrh r0, [r6, 0x8] - strh r0, [r5, 0x2E] - movs r1, 0xC - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080FF154 - 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] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r6, [r6, 0x6] - adds r0, r6 - b _080FF174 - .pool -_080FF154: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - adds r2, r5, 0 - adds r2, 0x32 - adds r3, r5, 0 - adds r3, 0x36 - movs r1, 0x1 - bl SetAverageBattlerPositions - ldrh r0, [r6, 0x4] - ldrh r1, [r5, 0x32] - adds r0, r1 - strh r0, [r5, 0x32] - ldrh r0, [r6, 0x6] - ldrh r1, [r5, 0x36] - adds r0, r1 -_080FF174: - strh r0, [r5, 0x36] - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0xA] - strh r0, [r5, 0x38] - adds r0, r5, 0 - bl InitAnimArcTranslation - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - adds r4, r0, 0 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bne _080FF1AC - movs r0, 0x1 - b _080FF1AE - .pool -_080FF1AC: - movs r0, 0 -_080FF1AE: - strh r0, [r5, 0x2E] - ldr r0, =sub_80FF1C0 - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF0F4 - - thumb_func_start sub_80FF1C0 -sub_80FF1C0: @ 80FF1C0 - push {r4-r7,lr} - adds r6, r0, 0 - movs r7, 0 - ldrh r5, [r6, 0x2E] - ldrh r4, [r6, 0x3C] - movs r0, 0x1 - strh r0, [r6, 0x2E] - adds r0, r6, 0 - bl TranslateAnimArc - ldrh r0, [r6, 0x3C] - strh r5, [r6, 0x2E] - lsls r4, 16 - asrs r4, 16 - cmp r4, 0xC8 - ble _080FF1F2 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x37 - bgt _080FF1F2 - ldrh r0, [r6, 0x6] - cmp r0, 0 - bne _080FF1F8 - adds r0, 0x1 - strh r0, [r6, 0x6] -_080FF1F2: - ldrh r0, [r6, 0x6] - cmp r0, 0 - beq _080FF22A -_080FF1F8: - movs r1, 0x2E - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _080FF22A - adds r3, r6, 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] - ldrh r0, [r6, 0x6] - adds r0, 0x1 - strh r0, [r6, 0x6] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1E - bne _080FF22A - movs r7, 0x1 -_080FF22A: - movs r2, 0x20 - ldrsh r0, [r6, r2] - movs r2, 0x24 - ldrsh r1, [r6, r2] - adds r0, r1 - adds r0, 0x10 - movs r1, 0x88 - lsls r1, 1 - cmp r0, r1 - bhi _080FF254 - movs r0, 0x22 - ldrsh r1, [r6, r0] - movs r2, 0x26 - ldrsh r0, [r6, r2] - adds r1, r0 - cmp r1, 0xA0 - bgt _080FF254 - movs r0, 0x10 - negs r0, r0 - cmp r1, r0 - bge _080FF256 -_080FF254: - movs r7, 0x1 -_080FF256: - cmp r7, 0 - beq _080FF260 - adds r0, r6, 0 - bl DestroyAnimSprite -_080FF260: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80FF1C0 - - thumb_func_start AnimMoveTwisterParticle -AnimMoveTwisterParticle: @ 80FF268 - push {r4,lr} - adds r4, r0, 0 - bl IsDoubleBattle - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FF28A - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - adds r2, r4, 0 - adds r2, 0x20 - adds r3, r4, 0 - adds r3, 0x22 - movs r1, 0x1 - bl SetAverageBattlerPositions -_080FF28A: - ldrh r0, [r4, 0x22] - adds r0, 0x20 - strh r0, [r4, 0x22] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - strh r0, [r4, 0x2E] - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x30] - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x32] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x34] - ldrh r0, [r1, 0x8] - strh r0, [r4, 0x36] - ldr r0, =sub_80FF2BC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end AnimMoveTwisterParticle - - thumb_func_start sub_80FF2BC -sub_80FF2BC: @ 80FF2BC - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0xFF - bne _080FF2D2 - ldrh r0, [r4, 0x22] - subs r0, 0x2 - strh r0, [r4, 0x22] - b _080FF2E0 -_080FF2D2: - cmp r0, 0 - ble _080FF2E0 - ldrh r0, [r4, 0x22] - subs r0, 0x2 - strh r0, [r4, 0x22] - subs r0, r1, 0x2 - strh r0, [r4, 0x30] -_080FF2E0: - ldrh r3, [r4, 0x32] - ldrh r5, [r4, 0x38] - adds r2, r3, r5 - strh r2, [r4, 0x38] - movs r0, 0x2E - ldrsh r1, [r4, r0] - movs r5, 0x36 - ldrsh r0, [r4, r5] - cmp r1, r0 - bge _080FF2F8 - adds r0, r2, r3 - strh r0, [r4, 0x38] -_080FF2F8: - ldrh r1, [r4, 0x38] - movs r0, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r2, 0x34 - ldrsh r1, [r4, r2] - bl Cos - strh r0, [r4, 0x24] - movs r5, 0x38 - ldrsh r0, [r4, r5] - movs r1, 0x5 - bl Sin - strh r0, [r4, 0x26] - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x7F - bgt _080FF338 - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8328 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - b _080FF346 - .pool -_080FF338: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl sub_80A8328 - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 -_080FF346: - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r4, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r4, 0x5] - ldrh r0, [r4, 0x2E] - subs r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bne _080FF36A - adds r0, r4, 0 - bl DestroyAnimSprite -_080FF36A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF2BC - - thumb_func_start sub_80FF374 -sub_80FF374: @ 80FF374 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0 - bl sub_80A6980 - adds r2, r5, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - ldr r4, =gBattleAnimArgs - ldrb r1, [r4, 0x4] - adds r0, r5, 0 - bl StartSpriteAffineAnim - ldrh r0, [r4, 0x4] - strh r0, [r5, 0x3A] - ldrh r0, [r4, 0x6] - strh r0, [r5, 0x3C] - ldr r0, =sub_80FF3B0 - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF374 - - thumb_func_start sub_80FF3B0 -sub_80FF3B0: @ 80FF3B0 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0xE] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _080FF3DA - adds r2, r4, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2] - movs r0, 0x1 - bl GetAnimBattlerSpriteId - movs r0, 0x80 - lsls r0, 1 - strh r0, [r4, 0x2E] - ldr r0, =sub_80FF3EC - str r0, [r4, 0x1C] -_080FF3DA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF3B0 - - thumb_func_start sub_80FF3EC -sub_80FF3EC: @ 80FF3EC - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - bl GetAnimBattlerSpriteId - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080FF404 - ldrh r0, [r4, 0x2E] - adds r0, 0xB - b _080FF408 -_080FF404: - ldrh r0, [r4, 0x2E] - subs r0, 0xB -_080FF408: - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - bne _080FF424 - movs r0, 0 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x32] - movs r1, 0x1 - eors r0, r1 - strh r0, [r4, 0x32] -_080FF424: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080FF452 - ldrh r0, [r4, 0x3C] - subs r0, 0x1 - strh r0, [r4, 0x3C] - lsls r0, 16 - cmp r0, 0 - ble _080FF44C - ldrh r1, [r4, 0x3A] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAffineAnim - b _080FF452 -_080FF44C: - adds r0, r4, 0 - bl DestroyAnimSprite -_080FF452: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FF3EC - - thumb_func_start sub_80FF458 -sub_80FF458: @ 80FF458 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x1 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gSprites - mov r10, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r2, r10 - adds r7, r0, r2 - adds r0, r7, 0 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080FF498 - adds r0, r4, 0 - bl DestroyAnimVisualTask - b _080FF51C - .pool -_080FF498: - adds r0, r1, 0 - movs r1, 0x1 - bl sub_80A7270 - ldr r0, =gTasks - lsls r6, r4, 2 - adds r6, r4 - lsls r6, 3 - adds r6, r0 - ldrb r0, [r7, 0x5] - lsls r0, 28 - lsrs r0, 30 - strh r0, [r6, 0x24] - ldr r0, =gBattleAnimTarget - mov r9, r0 - ldrb r0, [r0] - bl sub_80A8328 - movs r1, 0x3 - mov r8, r1 - mov r1, r8 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r7, 0x5] - movs r5, 0xD - negs r5, r5 - adds r0, r5, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r7, 0x5] - movs r0, 0x3 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r1, r0, 24 - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - add r4, r10 - ldrb r0, [r4, 0x5] - lsls r0, 28 - lsrs r0, 30 - strh r0, [r6, 0x26] - mov r2, r9 - ldrb r1, [r2] - movs r0, 0x2 - eors r0, r1 - bl sub_80A8328 - mov r1, r8 - ands r1, r0 - lsls r1, 2 - ldrb r0, [r4, 0x5] - ands r5, r0 - orrs r5, r1 - strb r5, [r4, 0x5] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - strh r0, [r6, 0x8] - ldrh r0, [r1, 0x2] - strh r0, [r6, 0xA] - movs r0, 0x80 - lsls r0, 1 - strh r0, [r6, 0x1E] - ldr r0, =sub_80FF53C - str r0, [r6] -_080FF51C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF458 - - thumb_func_start sub_80FF53C -sub_80FF53C: @ 80FF53C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0x8] - ldrh r0, [r4, 0x1C] - adds r1, r0 - strh r1, [r4, 0x1C] - ldr r2, =gSprites - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r5, r0, r2 - lsls r1, 16 - asrs r1, 24 - strh r1, [r5, 0x24] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _080FF586 - ldrh r0, [r5, 0x24] - negs r0, r0 - strh r0, [r5, 0x24] -_080FF586: - ldrh r0, [r4, 0x1E] - adds r0, 0x10 - strh r0, [r4, 0x1E] - movs r0, 0x1E - ldrsh r2, [r4, r0] - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl obj_id_set_rotscale - adds r0, r6, 0 - bl sub_80A7E6C - ldrh r0, [r4, 0xA] - subs r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _080FF5B4 - strh r0, [r4, 0x8] - ldr r0, =sub_80FF5CC - str r0, [r4] -_080FF5B4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF53C - - thumb_func_start sub_80FF5CC -sub_80FF5CC: @ 80FF5CC - push {r4-r7,lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0xE] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _080FF660 - ldr r0, =gTasks - lsls r2, r3, 2 - adds r1, r2, r3 - lsls r1, 3 - adds r7, r1, r0 - movs r1, 0x8 - ldrsh r5, [r7, r1] - adds r4, r0, 0 - cmp r5, 0 - bne _080FF674 - movs r0, 0x1 - bl GetAnimBattlerSpriteId - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_80A7344 - ldr r6, =gSprites - lsls r1, r4, 4 - adds r1, r4 - lsls r1, 2 - adds r1, r6 - strh r5, [r1, 0x24] - strh r5, [r1, 0x26] - movs r5, 0x3 - ldrh r2, [r7, 0x24] - ands r2, r5 - lsls r2, 2 - ldrb r3, [r1, 0x5] - movs r4, 0xD - negs r4, r4 - adds r0, r4, 0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] - movs r0, 0x3 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r7, 0x26] - ands r0, r5 - lsls r0, 2 - ldrb r2, [r1, 0x5] - ands r4, r2 - orrs r4, r0 - strb r4, [r1, 0x5] - ldrh r0, [r7, 0x8] - adds r0, 0x1 - strh r0, [r7, 0x8] - b _080FF68E - .pool -_080FF660: - ldr r1, =gTasks - lsls r2, r3, 2 - adds r0, r2, r3 - lsls r0, 3 - adds r0, r1 - movs r4, 0x8 - ldrsh r0, [r0, r4] - adds r4, r1, 0 - cmp r0, 0 - beq _080FF68E -_080FF674: - adds r1, r2, r3 - lsls r1, 3 - adds r1, r4 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _080FF68E - adds r0, r3, 0 - bl DestroyAnimVisualTask -_080FF68E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF5CC - - thumb_func_start sub_80FF698 -sub_80FF698: @ 80FF698 - push {r4-r6,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _080FF6AA - cmp r0, 0x1 - beq _080FF704 - b _080FF756 -_080FF6AA: - ldr r6, =gBattleAnimTarget - ldrb r0, [r6] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _080FF6C2 - ldr r1, =gBattleAnimArgs - movs r2, 0 - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1] -_080FF6C2: - ldrb r0, [r6] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r4] - adds r0, r1 - strh r0, [r5, 0x20] - ldrb r0, [r6] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r4, [r4, 0x2] - adds r0, r4 - strh r0, [r5, 0x22] - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - b _080FF756 - .pool -_080FF704: - adds r2, r5, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - adds r0, r5, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080FF756 - adds r0, r5, 0 - movs r1, 0x1 - bl ChangeSpriteAffineAnim - movs r0, 0x19 - strh r0, [r5, 0x2E] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x32] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x36] - ldr r0, =sub_80A70C0 - str r0, [r5, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 -_080FF756: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF698 - - thumb_func_start sub_80FF768 -sub_80FF768: @ 80FF768 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _080FF7D4 - 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, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldr r4, =gBattleAnimArgs - ldrh r0, [r4] - strh r0, [r5, 0x24] - ldrh r0, [r4, 0x2] - strh r0, [r5, 0x26] - ldrb r0, [r4, 0x4] - adds r0, 0x1E - adds r1, r5, 0 - adds r1, 0x43 - strb r0, [r1] - ldrb r1, [r4, 0x6] - adds r0, r5, 0 - bl StartSpriteAnim - ldrh r0, [r4, 0x8] - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - movs r2, 0x22 - ldrsh r0, [r5, r2] - movs r2, 0x26 - ldrsh r1, [r5, r2] - adds r0, r1 - cmp r0, 0x78 - ble _080FF7D4 - ldrh r0, [r5, 0x22] - adds r1, r0, 0 - subs r1, 0x78 - ldrh r2, [r5, 0x26] - adds r0, r2 - adds r1, r0 - strh r1, [r5, 0x22] -_080FF7D4: - ldr r0, =sub_80FF8DC - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF768 - - thumb_func_start sub_80FF7EC -sub_80FF7EC: @ 80FF7EC - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0x4 - mov r9, r0 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - mov r8, r0 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r6, =gBattleAnimTarget - ldrb r0, [r6] - movs r1, 0x2 - bl GetBattlerSpriteCoord - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r6] - movs r1, 0x3 - bl GetBattlerSpriteCoord - adds r2, r0, 0 - lsls r2, 24 - subs r4, r5 - lsls r4, 16 - lsrs r2, 24 - mov r1, r8 - subs r2, r1 - lsls r2, 16 - lsrs r2, 16 - lsrs r3, r4, 16 - mov r10, r3 - asrs r4, 16 - ldr r6, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r6, r1] - muls r0, r4 - movs r1, 0x64 - str r2, [sp] - bl __divsi3 - adds r5, r0 - mov r3, r9 - strh r5, [r3, 0x20] - ldr r2, [sp] - lsls r0, r2, 16 - asrs r0, 16 - movs r3, 0 - ldrsh r1, [r6, r3] - muls r0, r1 - movs r1, 0x64 - bl __divsi3 - add r8, r0 - mov r1, r8 - mov r0, r9 - strh r1, [r0, 0x22] - ldrh r0, [r6, 0x2] - mov r3, r9 - strh r0, [r3, 0x24] - ldrh r0, [r6, 0x4] - strh r0, [r3, 0x26] - ldrb r0, [r6, 0x6] - adds r0, 0x1E - mov r1, r9 - adds r1, 0x43 - strb r0, [r1] - ldrb r1, [r6, 0x8] - mov r0, r9 - bl StartSpriteAnim - ldrh r0, [r6, 0xA] - mov r1, r9 - strh r0, [r1, 0x32] - ldr r0, =sub_80FF8DC - str r0, [r1, 0x1C] - ldr r1, =gUnknown_0203A0F8 - mov r3, r9 - ldrh r0, [r3, 0x20] - strh r0, [r1] - ldrh r0, [r3, 0x22] - strh r0, [r1, 0x2] - mov r0, r10 - strh r0, [r1, 0x4] - ldr r2, [sp] - strh r2, [r1, 0x6] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF7EC - - thumb_func_start sub_80FF8DC -sub_80FF8DC: @ 80FF8DC - push {lr} - adds r3, r0, 0 - ldrh r1, [r3, 0x2E] - adds r1, 0x1 - strh r1, [r3, 0x2E] - lsls r1, 16 - asrs r1, 16 - movs r2, 0x32 - ldrsh r0, [r3, r2] - subs r0, 0xA - cmp r1, r0 - ble _080FF91C - movs r0, 0x2E - ldrsh r1, [r3, r0] - lsrs r0, r1, 31 - adds r0, r1, r0 - asrs r0, 1 - lsls r0, 1 - subs r1, r0 - movs r2, 0x3E - adds r2, r3 - mov r12, r2 - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - mov r1, r12 - strb r0, [r1] -_080FF91C: - movs r2, 0x2E - ldrsh r1, [r3, r2] - movs r2, 0x32 - ldrsh r0, [r3, r2] - cmp r1, r0 - ble _080FF92E - adds r0, r3, 0 - bl DestroyAnimSprite -_080FF92E: - pop {r0} - bx r0 - thumb_func_end sub_80FF8DC - - thumb_func_start sub_80FF934 -sub_80FF934: @ 80FF934 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x2E - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080FF974 - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r2, [r4] - adds r0, r2 - strh r0, [r6, 0x20] - ldrb r0, [r5] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r6, 0x22] - ldrh r0, [r4, 0x4] - strh r0, [r6, 0x30] - ldrh r0, [r4, 0x6] - strh r0, [r6, 0x32] - ldrh r0, [r4, 0x8] - strh r0, [r6, 0x34] -_080FF974: - ldrh r0, [r6, 0x2E] - adds r0, 0x1 - strh r0, [r6, 0x2E] - ldrh r1, [r6, 0x30] - muls r0, r1 - strh r0, [r6, 0x24] - movs r2, 0x2E - ldrsh r1, [r6, r2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - movs r1, 0xFF - ands r0, r1 - movs r2, 0x32 - ldrsh r1, [r6, r2] - bl Sin - strh r0, [r6, 0x26] - movs r0, 0x2E - ldrsh r1, [r6, r0] - movs r2, 0x34 - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _080FF9AA - adds r0, r6, 0 - bl DestroyAnimSprite -_080FF9AA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FF934 - - thumb_func_start sub_80FF9B8 -sub_80FF9B8: @ 80FF9B8 - push {r4,r5,lr} - movs r2, 0x20 - ldrsh r4, [r0, r2] - lsls r4, 8 - movs r3, 0x22 - ldrsh r2, [r0, r3] - orrs r4, r2 - movs r5, 0x3A - ldrsh r2, [r0, r5] - lsls r2, 8 - movs r5, 0x3C - ldrsh r3, [r0, r5] - orrs r2, r3 - lsls r1, 8 - strh r4, [r0, 0x38] - strh r2, [r0, 0x3A] - strh r1, [r0, 0x3C] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80FF9B8 - - thumb_func_start sub_80FF9E0 -sub_80FF9E0: @ 80FF9E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - ldrh r0, [r0, 0x38] - lsrs r1, r0, 8 - mov r10, r1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - mov r1, r8 - ldrh r0, [r1, 0x3A] - lsrs r2, r0, 8 - lsls r0, 24 - lsrs r4, r0, 24 - ldrh r1, [r1, 0x3C] - lsls r0, r1, 16 - asrs r0, 24 - lsls r0, 16 - lsrs r6, r0, 16 - movs r3, 0xFF - ands r3, r1 - cmp r2, 0 - bne _080FFA1A - movs r2, 0x20 - negs r2, r2 - b _080FFA22 -_080FFA1A: - cmp r2, 0xFF - bne _080FFA22 - movs r2, 0x88 - lsls r2, 1 -_080FFA22: - mov r0, r9 - subs r4, r0 - lsls r4, 16 - lsrs r4, 16 - mov r1, r10 - subs r0, r2, r1 - lsls r5, r3, 16 - asrs r5, 16 - muls r0, r5 - lsls r1, r6, 16 - asrs r7, r1, 16 - adds r1, r7, 0 - bl __divsi3 - adds r6, r0, 0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - muls r0, r5 - adds r1, r7, 0 - bl __divsi3 - add r6, r10 - mov r1, r8 - strh r6, [r1, 0x20] - add r0, r9 - strh r0, [r1, 0x22] - adds r5, 0x1 - lsls r5, 16 - lsrs r3, r5, 16 - asrs r5, 16 - cmp r5, r7 - beq _080FFA74 - lsls r1, r7, 8 - lsls r0, r3, 16 - asrs r0, 16 - orrs r0, r1 - mov r1, r8 - strh r0, [r1, 0x3C] - movs r0, 0 - b _080FFA76 -_080FFA74: - movs r0, 0x1 -_080FFA76: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80FF9E0 - - thumb_func_start sub_80FFA84 -sub_80FFA84: @ 80FFA84 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0xA - bne _080FFA98 - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim -_080FFA98: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x32 - ble _080FFAAC - adds r0, r4, 0 - bl DestroyAnimSprite -_080FFAAC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FFA84 - - thumb_func_start sub_80FFAB4 -sub_80FFAB4: @ 80FFAB4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl __divsi3 - ldrh r1, [r4, 0x2E] - adds r1, r0 - movs r5, 0 - strh r1, [r4, 0x2E] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x7F - ble _080FFADE - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - strh r5, [r4, 0x2E] -_080FFADE: - ldrh r0, [r4, 0x2E] - adds r0, 0x80 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x30 - ldrsh r2, [r4, r1] - lsls r2, 3 - movs r1, 0x1E - subs r1, r2 - lsls r1, 16 - asrs r1, 16 - bl Sin - strh r0, [r4, 0x26] - adds r0, r4, 0 - bl sub_80FF9E0 - lsls r0, 24 - cmp r0, 0 - beq _080FFB0E - strh r5, [r4, 0x26] - strh r5, [r4, 0x2E] - ldr r0, =sub_80FFA84 - str r0, [r4, 0x1C] -_080FFB0E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFAB4 - - thumb_func_start sub_80FFB18 -sub_80FFB18: @ 80FFB18 - push {r4-r6,lr} - adds r5, r0, 0 - movs r1, 0 - bl InitAnimSpritePos - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gBattleAnimAttacker - ldrb r1, [r0] - movs r0, 0x2 - eors r0, r1 - ldrb r4, [r4] - cmp r0, r4 - bne _080FFB68 - strh r6, [r5, 0x3A] - adds r0, r2, 0 - adds r0, 0xA - strh r0, [r5, 0x3C] - adds r0, r5, 0 - movs r1, 0x3C - bl sub_80FF9B8 - movs r0, 0x1 - b _080FFB7A - .pool -_080FFB68: - strh r6, [r5, 0x3A] - adds r0, r2, 0 - adds r0, 0xA - strh r0, [r5, 0x3C] - adds r0, r5, 0 - movs r1, 0x3C - bl sub_80FF9B8 - movs r0, 0x3 -_080FFB7A: - strh r0, [r5, 0x34] - movs r0, 0x3C - strh r0, [r5, 0x36] - ldr r0, =sub_80FFAB4 - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFB18 - - thumb_func_start sub_80FFB90 -sub_80FFB90: @ 80FFB90 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl __divsi3 - ldrh r1, [r4, 0x2E] - adds r1, r0 - movs r5, 0 - strh r1, [r4, 0x2E] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x7F - ble _080FFBBA - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - strh r5, [r4, 0x2E] -_080FFBBA: - ldrh r0, [r4, 0x2E] - adds r0, 0x80 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x30 - ldrsh r2, [r4, r1] - lsls r2, 3 - movs r1, 0x1E - subs r1, r2 - lsls r1, 16 - asrs r1, 16 - bl Sin - strh r0, [r4, 0x26] - adds r0, r4, 0 - bl sub_80FF9E0 - lsls r0, 24 - cmp r0, 0 - beq _080FFBEC - strh r5, [r4, 0x26] - strh r5, [r4, 0x2E] - adds r0, r4, 0 - bl DestroyAnimSprite -_080FFBEC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80FFB90 - - thumb_func_start sub_80FFBF4 -sub_80FFBF4: @ 80FFBF4 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _080FFC38 - strh r0, [r5, 0x3A] - adds r0, r6, 0 - adds r0, 0xA - strh r0, [r5, 0x3C] - adds r0, r5, 0 - movs r1, 0x28 - bl sub_80FF9B8 - movs r0, 0x3 - strh r0, [r5, 0x34] - movs r0, 0x3C - strh r0, [r5, 0x36] - ldr r0, =sub_80FFAB4 - b _080FFC62 - .pool -_080FFC38: - movs r0, 0xFF - strh r0, [r5, 0x3A] - adds r0, r6, 0 - adds r0, 0xA - strh r0, [r5, 0x3C] - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _080FFC50 - movs r0, 0 - strh r0, [r5, 0x3A] -_080FFC50: - adds r0, r5, 0 - movs r1, 0x28 - bl sub_80FF9B8 - movs r0, 0x3 - strh r0, [r5, 0x34] - movs r0, 0x3C - strh r0, [r5, 0x36] - ldr r0, =sub_80FFB90 -_080FFC62: - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFBF4 - - thumb_func_start sub_80FFC70 -sub_80FFC70: @ 80FFC70 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080FFC8A - adds r0, r4, 0 - movs r1, 0 - bl sub_80A6980 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x4] - strh r0, [r4, 0x30] -_080FFC8A: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - ldrh r1, [r4, 0x30] - muls r0, r1 - strh r0, [r4, 0x26] - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080FFCAA - adds r0, r4, 0 - bl DestroyAnimSprite -_080FFCAA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFC70 - - thumb_func_start sub_80FFCB4 -sub_80FFCB4: @ 80FFCB4 - push {r4-r6,lr} - adds r5, r0, 0 - movs r1, 0 - bl sub_80A6980 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gBattleAnimTarget - ldrb r1, [r0] - movs r0, 0x2 - eors r0, r1 - ldrb r4, [r4] - cmp r0, r4 - bne _080FFD04 - strh r6, [r5, 0x3A] - adds r0, r2, 0 - adds r0, 0xA - strh r0, [r5, 0x3C] - adds r0, r5, 0 - movs r1, 0x3C - bl sub_80FF9B8 - movs r0, 0x1 - b _080FFD16 - .pool -_080FFD04: - strh r6, [r5, 0x3A] - adds r0, r2, 0 - adds r0, 0xA - strh r0, [r5, 0x3C] - adds r0, r5, 0 - movs r1, 0x3C - bl sub_80FF9B8 - movs r0, 0x3 -_080FFD16: - strh r0, [r5, 0x34] - movs r0, 0x3C - strh r0, [r5, 0x36] - ldr r0, =sub_80FFD2C - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFCB4 - - thumb_func_start sub_80FFD2C -sub_80FFD2C: @ 80FFD2C - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl __divsi3 - ldrh r1, [r4, 0x2E] - adds r1, r0 - movs r5, 0 - strh r1, [r4, 0x2E] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x7F - ble _080FFD56 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - strh r5, [r4, 0x2E] -_080FFD56: - ldrh r0, [r4, 0x2E] - adds r0, 0x80 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x30 - ldrsh r2, [r4, r1] - lsls r2, 3 - movs r1, 0x1E - subs r1, r2 - lsls r1, 16 - asrs r1, 16 - bl Sin - strh r0, [r4, 0x26] - lsls r0, 16 - cmp r0, 0 - bne _080FFD8A - movs r0, 0x3F - bl BattleAnimAdjustPanning - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 24 - movs r0, 0x7D - bl PlaySE12WithPanning -_080FFD8A: - adds r0, r4, 0 - bl sub_80FF9E0 - lsls r0, 24 - cmp r0, 0 - beq _080FFDB2 - strh r5, [r4, 0x26] - strh r5, [r4, 0x2E] - ldr r0, =sub_80FFA84 - str r0, [r4, 0x1C] - movs r0, 0x40 - negs r0, r0 - bl BattleAnimAdjustPanning - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 24 - movs r0, 0x7D - bl PlaySE12WithPanning -_080FFDB2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFD2C - - thumb_func_start sub_80FFDBC -sub_80FFDBC: @ 80FFDBC - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080FFE50 - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080FFDE4 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0x2] - strh r1, [r4, 0x30] - movs r1, 0x78 - strh r1, [r4, 0x20] - adds r5, r0, 0 - b _080FFE06 - .pool -_080FFDE4: - ldr r0, =gBattleAnimArgs - movs r1, 0x2 - ldrsh r3, [r0, r1] - adds r1, r3, 0 - subs r1, 0x20 - adds r2, r1, 0 - adds r5, r0, 0 - cmp r1, 0 - bge _080FFDFA - adds r2, r3, 0 - adds r2, 0xDF -_080FFDFA: - asrs r0, r2, 8 - lsls r0, 8 - subs r0, r1, r0 - strh r0, [r4, 0x30] - movs r0, 0x46 - strh r0, [r4, 0x20] -_080FFE06: - ldrh r0, [r5] - strh r0, [r4, 0x22] - strh r0, [r4, 0x32] - movs r0, 0x14 - strh r0, [r4, 0x36] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x3C - bl Cos - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x14 - bl Sin - strh r0, [r4, 0x26] - ldr r0, =sub_80FFE58 - str r0, [r4, 0x1C] - ldrh r0, [r4, 0x30] - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xBE - bhi _080FFE48 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1F - b _080FFE4E - .pool -_080FFE48: - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1D -_080FFE4E: - strb r0, [r1] -_080FFE50: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80FFDBC - - thumb_func_start sub_80FFE58 -sub_80FFE58: @ 80FFE58 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080FFE6A - cmp r0, 0x1 - beq _080FFE9A - b _080FFEBA -_080FFE6A: - ldrh r5, [r4, 0x32] - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x4E - ble _080FFE82 - movs r0, 0x1 - strh r0, [r4, 0x34] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - b _080FFEBA -_080FFE82: - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0xA - bl __divsi3 - adds r0, r5, r0 - strh r0, [r4, 0x32] - ldrh r1, [r4, 0x36] - adds r1, 0x3 - strh r1, [r4, 0x36] - strh r0, [r4, 0x22] - b _080FFEBA -_080FFE9A: - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080FFEBA - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080FFEBA - movs r0, 0 - strh r0, [r4, 0x2E] - strh r0, [r4, 0x32] - ldr r0, =sub_80FFEC4 - str r0, [r4, 0x1C] -_080FFEBA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFE58 - - thumb_func_start sub_80FFEC4 -sub_80FFEC4: @ 80FFEC4 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_08592700 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r3, r0, r1 - adds r0, r5, 0x1 - adds r0, r3, r0 - ldrh r2, [r4, 0x32] - movs r6, 0x32 - ldrsh r1, [r4, r6] - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r1, r0 - bne _080FFF10 - adds r0, r5, 0x2 - adds r0, r3, r0 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x7F - bne _080FFEFC - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, =sub_80FFF7C - str r0, [r4, 0x1C] -_080FFEFC: - movs r0, 0 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _080FFF76 - .pool -_080FFF10: - adds r0, r2, 0x1 - strh r0, [r4, 0x32] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - adds r1, r0, r5 - movs r2, 0 - ldrsb r2, [r1, r2] - adds r1, r5, 0x2 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - muls r0, r2 - ldrh r1, [r4, 0x30] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _080FFF5E - ldrh r0, [r4, 0x30] - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xBE - bhi _080FFF56 - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1F - b _080FFF5C -_080FFF56: - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0x1D -_080FFF5C: - strb r0, [r1] -_080FFF5E: - movs r6, 0x30 - ldrsh r0, [r4, r6] - movs r1, 0x3C - bl Cos - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x14 - bl Sin - strh r0, [r4, 0x26] -_080FFF76: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80FFEC4 - - thumb_func_start sub_80FFF7C -sub_80FFF7C: @ 80FFF7C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x14 - ble _080FFF8E - adds r0, r4, 0 - bl DestroyAnimSprite -_080FFF8E: - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r0, r1, r0 - asrs r0, 1 - lsls r0, 1 - subs r1, r0 - adds r3, r4, 0 - adds r3, 0x3E - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FFF7C - - thumb_func_start sub_80FFFC0 -sub_80FFFC0: @ 80FFFC0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - bl sub_80A82E4 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - strh r0, [r5, 0x10] - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x14] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x16] - ldrb r0, [r4] - movs r1, 0x1 - bl sub_80A861C - strh r0, [r5, 0x1C] - ldrb r0, [r4] - movs r1, 0 - bl sub_80A861C - strh r0, [r5, 0x1E] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x1 - negs r2, r2 - adds r1, r2, 0 - cmp r0, 0x1 - bne _08100028 - movs r1, 0x1 -_08100028: - strh r1, [r5, 0x12] - movs r3, 0x12 - ldrsh r0, [r5, r3] - lsls r0, 6 - movs r1, 0x38 - subs r1, r0 - strh r1, [r5, 0x1A] - ldrh r0, [r5, 0x16] - subs r0, r1 - ldrh r1, [r5, 0x14] - adds r0, r1 - strh r0, [r5, 0x18] - ldr r0, =gUnknown_08592778 - movs r2, 0x18 - ldrsh r1, [r5, r2] - movs r3, 0x1A - ldrsh r2, [r5, r3] - ldrb r3, [r5, 0x10] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0xC] - cmp r0, 0x40 - bne _08100060 - adds r0, r6, 0 - bl DestroyAnimVisualTask -_08100060: - ldr r4, =gSprites - movs r0, 0xC - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xA - strh r1, [r0, 0x2E] - movs r2, 0xC - ldrsh r1, [r5, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r5, 0x18] - strh r1, [r0, 0x30] - movs r3, 0xC - ldrsh r0, [r5, r3] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - movs r1, 0x1C - ldrsh r0, [r5, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r0, 0xA - movs r3, 0x12 - ldrsh r1, [r5, r3] - muls r1, r0 - ldrh r0, [r5, 0x14] - subs r0, r1 - strh r0, [r2, 0x32] - movs r0, 0xC - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r5, 0x1A] - strh r1, [r0, 0x34] - movs r1, 0xC - ldrsh r0, [r5, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - movs r2, 0x1E - ldrsh r0, [r5, r2] - lsrs r2, r0, 31 - adds r0, r2 - asrs r0, 1 - adds r0, 0xA - movs r3, 0x12 - ldrsh r2, [r5, r3] - muls r0, r2 - ldrh r2, [r5, 0x16] - adds r0, r2 - strh r0, [r1, 0x36] - movs r3, 0xC - ldrsh r1, [r5, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl sub_8100504 - movs r1, 0xC - ldrsh r2, [r5, r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r4 - strh r0, [r1, 0x38] - movs r2, 0xC - ldrsh r1, [r5, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl InitAnimArcTranslation - ldr r0, =sub_8100128 - str r0, [r5] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FFFC0 - - thumb_func_start sub_8100128 -sub_8100128: @ 8100128 - push {r4-r6,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r6, r0, r1 - movs r0, 0xC - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r5, [r6, r1] - cmp r5, 0x7 - bne _08100150 - b _08100380 -_08100150: - cmp r5, 0x7 - bgt _0810019E - cmp r5, 0x3 - bne _0810015A - b _08100272 -_0810015A: - cmp r5, 0x3 - bgt _08100174 - cmp r5, 0x1 - beq _08100204 - cmp r5, 0x1 - bgt _08100254 - cmp r5, 0 - beq _081001E6 - b _081004FC - .pool -_08100174: - cmp r5, 0x5 - bne _0810017A - b _081002E8 -_0810017A: - cmp r5, 0x5 - ble _08100180 - b _08100362 -_08100180: - adds r0, r6, 0 - adds r1, r2, 0 - bl sub_8100524 - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - bne _08100196 - b _081004FC -_08100196: - movs r0, 0x5 - strh r0, [r6, 0x26] - movs r0, 0xFF - b _081004FA -_0810019E: - cmp r5, 0xB - bne _081001A4 - b _08100464 -_081001A4: - cmp r5, 0xB - bgt _081001D2 - cmp r5, 0x9 - bne _081001AE - b _081003D2 -_081001AE: - cmp r5, 0x9 - ble _081001B4 - b _08100448 -_081001B4: - adds r0, r6, 0 - adds r1, r2, 0 - bl sub_8100524 - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - bne _081001CA - b _081004FC -_081001CA: - movs r0, 0x9 - strh r0, [r6, 0x26] - movs r0, 0xFF - b _081004FA -_081001D2: - cmp r5, 0xD - bne _081001D8 - b _081004D6 -_081001D8: - cmp r5, 0xD - bge _081001DE - b _081004B6 -_081001DE: - cmp r5, 0xFF - bne _081001E4 - b _081004E6 -_081001E4: - b _081004FC -_081001E6: - adds r0, r6, 0 - adds r1, r2, 0 - bl sub_8100524 - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - bne _081001FC - b _081004FC -_081001FC: - movs r0, 0x1 - strh r0, [r6, 0x26] - movs r0, 0xFF - b _081004FA -_08100204: - ldrh r2, [r4, 0x24] - ldrh r3, [r4, 0x20] - adds r2, r3 - movs r0, 0 - strh r2, [r4, 0x20] - ldrh r1, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r1, r3 - strh r1, [r4, 0x22] - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x30] - ldrh r0, [r6, 0x14] - strh r0, [r4, 0x32] - strh r1, [r4, 0x34] - ldrh r0, [r6, 0x16] - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl sub_8100504 - strh r0, [r4, 0x38] - ldrh r0, [r6, 0x10] - adds r0, 0x2 - strh r0, [r6, 0x10] - strh r5, [r6, 0xE] - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - ldrb r1, [r6, 0xE] - adds r0, r4, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl InitAnimArcTranslation - ldrh r0, [r6, 0x8] - adds r0, 0x1 - b _081004FA -_08100254: - adds r0, r6, 0 - adds r1, r2, 0 - bl sub_8100524 - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - bne _0810026A - b _081004FC -_0810026A: - movs r0, 0x3 - strh r0, [r6, 0x26] - movs r0, 0xFF - b _081004FA -_08100272: - ldrh r1, [r4, 0x24] - ldrh r0, [r4, 0x20] - adds r1, r0 - movs r0, 0 - strh r1, [r4, 0x20] - ldrh r2, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r2, r3 - strh r2, [r4, 0x22] - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r1, [r4, 0x30] - movs r1, 0x1C - ldrsh r0, [r6, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r0, 0xA - movs r3, 0x12 - ldrsh r1, [r6, r3] - muls r1, r0 - ldrh r0, [r6, 0x14] - subs r0, r1 - strh r0, [r4, 0x32] - strh r2, [r4, 0x34] - movs r1, 0x1E - ldrsh r0, [r6, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r0, 0xA - movs r2, 0x12 - ldrsh r1, [r6, r2] - muls r1, r0 - ldrh r0, [r6, 0x16] - subs r0, r1 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl sub_8100504 - strh r0, [r4, 0x38] - movs r0, 0x2 - strh r0, [r6, 0xE] - ldrh r0, [r6, 0x10] - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - ldrb r1, [r6, 0xE] - adds r0, r4, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl InitAnimArcTranslation - ldrh r0, [r6, 0x8] - adds r0, 0x1 - b _081004FA -_081002E8: - ldrh r1, [r4, 0x24] - ldrh r3, [r4, 0x20] - adds r1, r3 - movs r0, 0 - strh r1, [r4, 0x20] - ldrh r2, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r2, r3 - strh r2, [r4, 0x22] - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r1, [r4, 0x30] - movs r1, 0x1C - ldrsh r0, [r6, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r0, 0xA - movs r3, 0x12 - ldrsh r1, [r6, r3] - muls r0, r1 - ldrh r1, [r6, 0x14] - adds r0, r1 - strh r0, [r4, 0x32] - strh r2, [r4, 0x34] - movs r2, 0x1E - ldrsh r0, [r6, r2] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r0, 0xA - movs r3, 0x12 - ldrsh r1, [r6, r3] - muls r0, r1 - ldrh r1, [r6, 0x16] - adds r0, r1 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl sub_8100504 - strh r0, [r4, 0x38] - ldrh r1, [r6, 0x10] - subs r1, 0x2 - strh r1, [r6, 0x10] - movs r0, 0x3 - strh r0, [r6, 0xE] - adds r0, r4, 0 - adds r0, 0x43 - strb r1, [r0] - ldrb r1, [r6, 0xE] - adds r0, r4, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl InitAnimArcTranslation - ldrh r0, [r6, 0x8] - adds r0, 0x1 - b _081004FA -_08100362: - adds r0, r6, 0 - adds r1, r2, 0 - bl sub_8100524 - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - bne _08100378 - b _081004FC -_08100378: - movs r0, 0x7 - strh r0, [r6, 0x26] - movs r0, 0xFF - b _081004FA -_08100380: - ldrh r2, [r4, 0x24] - ldrh r3, [r4, 0x20] - adds r2, r3 - movs r0, 0 - strh r2, [r4, 0x20] - ldrh r1, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r1, r3 - strh r1, [r4, 0x22] - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x30] - ldrh r0, [r6, 0x14] - strh r0, [r4, 0x32] - strh r1, [r4, 0x34] - ldrh r0, [r6, 0x16] - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl sub_8100504 - strh r0, [r4, 0x38] - ldrh r1, [r6, 0x10] - adds r1, 0x2 - strh r1, [r6, 0x10] - movs r0, 0x4 - strh r0, [r6, 0xE] - adds r0, r4, 0 - adds r0, 0x43 - strb r1, [r0] - ldrb r1, [r6, 0xE] - adds r0, r4, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl InitAnimArcTranslation - ldrh r0, [r6, 0x8] - adds r0, 0x1 - b _081004FA -_081003D2: - ldrh r1, [r4, 0x24] - ldrh r0, [r4, 0x20] - adds r1, r0 - movs r0, 0 - strh r1, [r4, 0x20] - ldrh r2, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r2, r3 - strh r2, [r4, 0x22] - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r1, [r4, 0x30] - movs r1, 0x1C - ldrsh r0, [r6, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r0, 0xA - movs r3, 0x12 - ldrsh r1, [r6, r3] - muls r1, r0 - ldrh r0, [r6, 0x14] - subs r0, r1 - strh r0, [r4, 0x32] - strh r2, [r4, 0x34] - movs r1, 0x1E - ldrsh r0, [r6, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - adds r0, 0xA - movs r2, 0x12 - ldrsh r1, [r6, r2] - muls r0, r1 - ldrh r3, [r6, 0x16] - adds r0, r3 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl sub_8100504 - strh r0, [r4, 0x38] - movs r0, 0x5 - strh r0, [r6, 0xE] - ldrh r0, [r6, 0x10] - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - ldrb r1, [r6, 0xE] - adds r0, r4, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl InitAnimArcTranslation - ldrh r0, [r6, 0x8] - adds r0, 0x1 - b _081004FA -_08100448: - adds r0, r6, 0 - adds r1, r2, 0 - bl sub_8100524 - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _081004FC - movs r0, 0xB - strh r0, [r6, 0x26] - movs r0, 0xFF - b _081004FA -_08100464: - ldrh r2, [r4, 0x24] - ldrh r0, [r4, 0x20] - adds r2, r0 - movs r0, 0 - strh r2, [r4, 0x20] - ldrh r1, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r1, r3 - strh r1, [r4, 0x22] - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x30] - ldrh r0, [r6, 0x18] - strh r0, [r4, 0x32] - strh r1, [r4, 0x34] - ldrh r0, [r6, 0x1A] - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl sub_8100504 - strh r0, [r4, 0x38] - ldrh r1, [r6, 0x10] - subs r1, 0x2 - strh r1, [r6, 0x10] - movs r0, 0x6 - strh r0, [r6, 0xE] - adds r0, r4, 0 - adds r0, 0x43 - strb r1, [r0] - ldrb r1, [r6, 0xE] - adds r0, r4, 0 - bl StartSpriteAnim - adds r0, r4, 0 - bl InitAnimArcTranslation - ldrh r0, [r6, 0x8] - adds r0, 0x1 - b _081004FA -_081004B6: - adds r0, r6, 0 - adds r1, r2, 0 - bl sub_8100524 - adds r0, r4, 0 - bl TranslateAnimArc - lsls r0, 24 - cmp r0, 0 - beq _081004FC - adds r0, r4, 0 - bl DestroySprite - ldrh r0, [r6, 0x8] - adds r0, 0x1 - b _081004FA -_081004D6: - movs r1, 0x20 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081004FC - adds r0, r2, 0 - bl DestroyAnimVisualTask - b _081004FC -_081004E6: - ldrh r0, [r6, 0xA] - adds r0, 0x1 - strh r0, [r6, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _081004FC - movs r0, 0 - strh r0, [r6, 0xA] - ldrh r0, [r6, 0x26] -_081004FA: - strh r0, [r6, 0x8] -_081004FC: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8100128 - - thumb_func_start sub_8100504 -sub_8100504: @ 8100504 - push {lr} - movs r2, 0x8 - movs r3, 0x36 - ldrsh r1, [r0, r3] - movs r3, 0x22 - ldrsh r0, [r0, r3] - cmp r1, r0 - bge _0810051A - negs r0, r2 - lsls r0, 16 - lsrs r2, r0, 16 -_0810051A: - lsls r0, r2, 16 - asrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_8100504 - - thumb_func_start sub_8100524 -sub_8100524: @ 8100524 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - lsls r1, 24 - lsrs r7, r1, 24 - ldrh r0, [r6, 0x24] - adds r0, 0x1 - strh r0, [r6, 0x24] - lsls r0, 16 - cmp r0, 0 - ble _081005BA - movs r0, 0 - strh r0, [r6, 0x24] - ldr r0, =gSprites - mov r8, r0 - movs r2, 0xC - ldrsh r1, [r6, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - ldrh r1, [r0, 0x24] - ldrh r2, [r0, 0x20] - adds r1, r2 - ldrh r2, [r0, 0x26] - ldrh r0, [r0, 0x22] - adds r2, r0 - ldr r0, =gUnknown_08592778 - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - ldrb r3, [r6, 0x10] - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _081005BA - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - mov r0, r8 - adds r4, r5, r0 - strh r7, [r4, 0x3A] - movs r0, 0xC - strh r0, [r4, 0x3C] - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x20] - adds r0, 0x1 - strh r0, [r1, 0x20] - ldrh r2, [r6, 0x22] - movs r0, 0x1 - ands r0, r2 - strh r0, [r4, 0x2E] - ldrh r0, [r1, 0x22] - adds r0, 0x1 - strh r0, [r1, 0x22] - ldrb r1, [r6, 0xE] - adds r0, r4, 0 - bl StartSpriteAnim - ldrh r0, [r6, 0x10] - adds r4, 0x43 - strb r0, [r4] - mov r0, r8 - adds r0, 0x1C - adds r5, r0 - ldr r0, =sub_81005D4 - str r0, [r5] -_081005BA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100524 - - thumb_func_start sub_81005D4 -sub_81005D4: @ 81005D4 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08100636 - movs r0, 0 - strh r0, [r4, 0x2E] - 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] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _08100636 - ldr r3, =gTasks - movs r0, 0x3C - ldrsh r1, [r4, r0] - lsls r1, 1 - movs r0, 0x3A - ldrsh r2, [r4, r0] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - adds r3, 0x8 - adds r1, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - adds r0, r4, 0 - bl DestroySprite -_08100636: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81005D4 - - thumb_func_start sub_8100640 -sub_8100640: @ 8100640 - push {r4-r7,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0xC - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _0810065C - ldr r0, =gBattleAnimAttacker - b _0810065E - .pool -_0810065C: - ldr r0, =gBattleAnimTarget -_0810065E: - ldrb r6, [r0] - adds r0, r6, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08100688 - movs r0, 0 - strh r0, [r4, 0x36] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x32] - ldr r0, =0x0000fff0 - b _08100698 - .pool -_08100688: - movs r0, 0x1 - strh r0, [r4, 0x36] - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x6] - negs r0, r0 - strh r0, [r4, 0x32] - movs r0, 0x80 - lsls r0, 1 -_08100698: - strh r0, [r4, 0x20] - adds r7, r1, 0 - adds r5, r7, 0 - ldrh r0, [r5, 0x2] - strh r0, [r4, 0x30] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x8] - strh r0, [r4, 0x34] - movs r1, 0xA - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _081006CE - cmp r0, 0x1 - bgt _081006C0 - cmp r0, 0 - beq _081006CA - b _08100738 - .pool -_081006C0: - cmp r0, 0x2 - beq _081006D4 - cmp r0, 0x3 - beq _08100700 - b _08100738 -_081006CA: - ldrh r0, [r5] - b _081006E4 -_081006CE: - ldrh r0, [r5] - strh r0, [r4, 0x22] - b _0810071A -_081006D4: - adds r0, r6, 0 - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r5, [r5] - adds r0, r5 -_081006E4: - strh r0, [r4, 0x22] - adds r0, r6, 0 - bl sub_80A8328 - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x5] - b _08100738 -_08100700: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r7, [r7] - adds r0, r7 - strh r0, [r4, 0x22] - movs r0, 0x1 - bl GetAnimBattlerSpriteId -_0810071A: - adds r0, r6, 0 - bl sub_80A8328 - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r4, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r4, 0x5] -_08100738: - ldr r0, =sub_810074C - str r0, [r4, 0x1C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100640 - - thumb_func_start sub_810074C -sub_810074C: @ 810074C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x3C - ldrsh r3, [r4, r0] - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - movs r1, 0x30 - ldrsh r2, [r4, r1] - ldr r1, =gSineTable - movs r5, 0x2E - ldrsh r0, [r4, r5] - lsls r0, 1 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - muls r0, r2 - asrs r0, 8 - strh r0, [r4, 0x26] - movs r2, 0x32 - ldrsh r0, [r4, r2] - muls r0, r3 - strh r0, [r4, 0x24] - movs r5, 0x34 - ldrsh r0, [r4, r5] - muls r0, r3 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x2E] - movs r1, 0x36 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081007A4 - movs r2, 0x24 - ldrsh r0, [r4, r2] - movs r5, 0x20 - ldrsh r1, [r4, r5] - adds r0, r1 - cmp r0, 0xF7 - ble _081007BC - b _081007B6 - .pool -_081007A4: - movs r1, 0x24 - ldrsh r0, [r4, r1] - movs r2, 0x20 - ldrsh r1, [r4, r2] - adds r0, r1 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bgt _081007BC -_081007B6: - adds r0, r4, 0 - bl move_anim_8074EE0 -_081007BC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_810074C - - thumb_func_start sub_81007C4 -sub_81007C4: @ 81007C4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _081007E8 - cmp r0, 0x1 - beq _0810081C - b _08100876 - .pool -_081007E8: - ldr r0, =0x0000274f - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - movs r2, 0x80 - lsls r2, 1 - adds r4, r2, 0 - adds r0, r4 - strh r0, [r5, 0x18] - ldr r0, =0x000027b0 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - adds r0, r4 - strh r0, [r5, 0x20] - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - b _08100876 - .pool -_0810081C: - ldrh r0, [r5, 0x1A] - adds r0, 0x1 - movs r7, 0 - strh r0, [r5, 0x1A] - lsls r0, 16 - cmp r0, 0 - blt _08100876 - strh r7, [r5, 0x1A] - ldrh r0, [r5, 0x18] - ldrb r2, [r5, 0x1C] - ldr r4, =gUnknown_08592878 - movs r3, 0x1E - ldrsh r1, [r5, r3] - lsls r1, 1 - adds r1, r4 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette - ldrh r0, [r5, 0x20] - ldrb r2, [r5, 0x1C] - movs r3, 0x1E - ldrsh r1, [r5, r3] - lsls r1, 1 - adds r1, r4 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette - ldrh r0, [r5, 0x1C] - adds r0, 0x1 - strh r0, [r5, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x11 - bne _08100876 - strh r7, [r5, 0x1C] - ldrh r0, [r5, 0x1E] - adds r0, 0x1 - strh r0, [r5, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - bne _08100876 - strh r7, [r5, 0x1E] -_08100876: - ldr r0, =gBattleAnimArgs - movs r2, 0xE - ldrsh r1, [r0, r2] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _0810088A - adds r0, r6, 0 - bl DestroyAnimVisualTask -_0810088A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81007C4 - - thumb_func_start sub_8100898 -sub_8100898: @ 8100898 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldr r1, =gBattleAnimArgs - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _081008B4 - adds r0, r6, 0 - bl DestroyAnimSprite - b _0810098E - .pool -_081008B4: - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0 - bne _081008C4 - ldr r4, =gBattleAnimAttacker - b _081008C6 - .pool -_081008C4: - ldr r4, =gBattleAnimTarget -_081008C6: - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0x8] - strh r1, [r6, 0x2E] - movs r3, 0x2 - ldrsh r1, [r0, r3] - adds r7, r0, 0 - cmp r1, 0 - bne _08100908 - ldrh r0, [r7, 0x4] - adds r0, r5 - strh r0, [r6, 0x20] - ldrh r0, [r7, 0x6] - adds r0, r2 - strh r0, [r6, 0x22] - strh r5, [r6, 0x38] - strh r2, [r6, 0x3A] - b _08100918 - .pool -_08100908: - strh r5, [r6, 0x20] - strh r2, [r6, 0x22] - ldrh r0, [r7, 0x4] - adds r0, r5 - strh r0, [r6, 0x38] - ldrh r0, [r7, 0x6] - adds r0, r2 - strh r0, [r6, 0x3A] -_08100918: - ldrh r4, [r6, 0x20] - lsls r0, r4, 4 - strh r0, [r6, 0x30] - ldrh r5, [r6, 0x22] - lsls r0, r5, 4 - strh r0, [r6, 0x32] - movs r1, 0x38 - ldrsh r0, [r6, r1] - movs r2, 0x20 - ldrsh r1, [r6, r2] - subs r0, r1 - lsls r0, 4 - movs r3, 0x8 - ldrsh r1, [r7, r3] - bl __divsi3 - strh r0, [r6, 0x34] - movs r1, 0x3A - ldrsh r0, [r6, r1] - movs r2, 0x22 - ldrsh r1, [r6, r2] - subs r0, r1 - lsls r0, 4 - movs r3, 0x8 - ldrsh r1, [r7, r3] - bl __divsi3 - strh r0, [r6, 0x36] - ldrh r0, [r6, 0x38] - subs r0, r4 - lsls r0, 16 - asrs r0, 16 - ldrh r1, [r6, 0x3A] - subs r1, r5 - lsls r1, 16 - asrs r1, 16 - bl ArcTan2Neg - lsls r0, 16 - lsrs r4, r0, 16 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _0810097A - ldr r1, =0xffff8000 - adds r0, r4, r1 - lsls r0, 16 - lsrs r4, r0, 16 -_0810097A: - movs r3, 0x80 - lsls r3, 1 - str r4, [sp] - adds r0, r6, 0 - movs r1, 0 - adds r2, r3, 0 - bl sub_80A73E0 - ldr r0, =sub_81009A0 - str r0, [r6, 0x1C] -_0810098E: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100898 - - thumb_func_start sub_81009A0 -sub_81009A0: @ 81009A0 - push {r4,lr} - adds r2, r0, 0 - ldrh r3, [r2, 0x2E] - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0 - beq _081009D0 - ldrh r0, [r2, 0x34] - ldrh r4, [r2, 0x30] - adds r0, r4 - strh r0, [r2, 0x30] - ldrh r1, [r2, 0x36] - ldrh r4, [r2, 0x32] - adds r1, r4 - strh r1, [r2, 0x32] - lsls r0, 16 - asrs r0, 20 - strh r0, [r2, 0x20] - lsls r1, 16 - asrs r1, 20 - strh r1, [r2, 0x22] - subs r0, r3, 0x1 - strh r0, [r2, 0x2E] - b _081009D6 -_081009D0: - adds r0, r2, 0 - bl move_anim_8074EE0 -_081009D6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81009A0 - - thumb_func_start sub_81009DC -sub_81009DC: @ 81009DC - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081009F2 - adds r0, r2, 0 - bl DestroyAnimSprite -_081009F2: - pop {r0} - bx r0 - thumb_func_end sub_81009DC - - thumb_func_start sub_81009F8 -sub_81009F8: @ 81009F8 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08100A20 - ldr r2, =gBattleAnimArgs - ldrh r0, [r4, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x2] - b _08100A2C - .pool -_08100A20: - ldr r0, =gBattleAnimArgs - ldrh r1, [r0] - ldrh r2, [r4, 0x20] - adds r1, r2 - strh r1, [r4, 0x20] - ldrh r0, [r0, 0x2] -_08100A2C: - 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_81009F8 - - thumb_func_start sub_8100A50 -sub_8100A50: @ 8100A50 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08100A6A - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim -_08100A6A: - ldr r0, =sub_81009DC - str r0, [r5, 0x1C] - 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_8100A50 - - thumb_func_start sub_8100A94 -sub_8100A94: @ 8100A94 - push {r4,lr} - adds r4, r0, 0 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - 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 StartSpriteAffineAnim - 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_8100A94 - - thumb_func_start sub_8100AE0 -sub_8100AE0: @ 8100AE0 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x22] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08100B14 - ldrh r0, [r5, 0x22] - adds r0, 0x8 - strh r0, [r5, 0x22] -_08100B14: - ldr r0, =sub_8100CCC - str r0, [r5, 0x1C] - ldr r0, =gBattleAnimArgs - movs r2, 0x4 - ldrsh r1, [r0, r2] - adds r3, r0, 0 - cmp r1, 0 - bne _08100B3C - ldrh r0, [r3] - ldrh r1, [r5, 0x20] - adds r0, r1 - strh r0, [r5, 0x20] - b _08100B50 - .pool -_08100B3C: - ldrh r0, [r5, 0x20] - ldrh r1, [r3] - subs r0, r1 - strh r0, [r5, 0x20] - adds r2, r5, 0 - adds r2, 0x3F - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] -_08100B50: - ldrh r0, [r3, 0x2] - ldrh r2, [r5, 0x22] - adds r0, r2 - strh r0, [r5, 0x22] - ldr r1, =0xfffffc00 - adds r0, r1, 0 - ldrh r2, [r5, 0x30] - adds r1, r0, r2 - strh r1, [r5, 0x30] - movs r2, 0x80 - lsls r2, 3 - adds r0, r2, 0 - ldrh r2, [r5, 0x32] - adds r0, r2 - strh r0, [r5, 0x32] - ldrh r0, [r3, 0x4] - strh r0, [r5, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08100B7E - negs r0, r1 - strh r0, [r5, 0x30] -_08100B7E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100AE0 - - thumb_func_start sub_8100B88 -sub_8100B88: @ 8100B88 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0x6 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - beq _08100BA8 - cmp r0, 0x1 - ble _08100C24 - cmp r0, 0x2 - beq _08100BC8 - b _08100C24 - .pool -_08100BA8: - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r4, 0x2 - eors r0, r4 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r5] - eors r4, r0 - adds r0, r4, 0 - b _08100C34 - .pool -_08100BC8: - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r5] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r4, r0, 24 - ldrb r0, [r5] - movs r2, 0x2 - mov r8, r2 - mov r1, r8 - eors r0, r1 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _08100C3E - ldrb r0, [r5] - mov r2, r8 - eors r0, r2 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, r7 - lsrs r7, r0, 1 - ldrb r0, [r5] - mov r1, r8 - eors r0, r1 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - lsrs r4, r0, 1 - b _08100C3E - .pool -_08100C24: - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r4] -_08100C34: - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r4, r0, 24 -_08100C3E: - strh r7, [r6, 0x20] - strh r4, [r6, 0x22] - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08100C56 - ldrh r0, [r6, 0x22] - adds r0, 0x8 - strh r0, [r6, 0x22] -_08100C56: - ldr r0, =sub_8100CCC - str r0, [r6, 0x1C] - ldr r0, =gBattleAnimArgs - movs r2, 0x4 - ldrsh r1, [r0, r2] - adds r3, r0, 0 - cmp r1, 0 - bne _08100C7C - ldrh r0, [r3] - ldrh r1, [r6, 0x20] - adds r0, r1 - strh r0, [r6, 0x20] - b _08100C90 - .pool -_08100C7C: - ldrh r0, [r6, 0x20] - ldrh r1, [r3] - subs r0, r1 - strh r0, [r6, 0x20] - adds r2, r6, 0 - adds r2, 0x3F - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] -_08100C90: - ldrh r0, [r3, 0x2] - ldrh r2, [r6, 0x22] - adds r0, r2 - strh r0, [r6, 0x22] - ldr r1, =0xfffffc00 - adds r0, r1, 0 - ldrh r2, [r6, 0x30] - adds r1, r0, r2 - strh r1, [r6, 0x30] - movs r2, 0x80 - lsls r2, 3 - adds r0, r2, 0 - ldrh r2, [r6, 0x32] - adds r0, r2 - strh r0, [r6, 0x32] - ldrh r0, [r3, 0x4] - strh r0, [r6, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08100CBE - negs r0, r1 - strh r0, [r6, 0x30] -_08100CBE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100B88 - - thumb_func_start sub_8100CCC -sub_8100CCC: @ 8100CCC - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - ldrh r2, [r4, 0x34] - adds r0, r1, r2 - strh r0, [r4, 0x34] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x36] - adds r0, r2 - strh r0, [r4, 0x36] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08100CEE - adds r0, r1, 0 - adds r0, 0x18 - b _08100CF2 -_08100CEE: - adds r0, r1, 0 - subs r0, 0x18 -_08100CF2: - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x32] - subs r0, 0x18 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 24 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x36] - lsls r0, 16 - asrs r0, 24 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - bne _08100D28 - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - movs r0, 0x3 - strh r0, [r4, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r4, 0x1C] -_08100D28: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100CCC - - thumb_func_start sub_8100D38 -sub_8100D38: @ 8100D38 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r1, [r5, 0x32] - movs r2, 0x32 - ldrsh r0, [r5, r2] - cmp r0, 0x1 - ble _08100DDC - ldrh r1, [r5, 0x34] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08100D94 - adds r3, r5, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x5 - negs r2, r2 - adds r0, r2, 0 - ands r0, r1 - strb r0, [r3] - ldr r4, =gSprites - movs r0, 0x2E - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r3, [r0] - adds r1, r2, 0 - ands r1, r3 - strb r1, [r0] - movs r0, 0x30 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - ands r2, r1 - strb r2, [r0] - b _08100DCA - .pool -_08100D94: - adds r1, r5, 0 - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - ldr r3, =gSprites - movs r0, 0x2E - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - movs r0, 0x30 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] -_08100DCA: - movs r0, 0 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - b _08100DE0 - .pool -_08100DDC: - adds r0, r1, 0x1 - strh r0, [r5, 0x32] -_08100DE0: - movs r1, 0x34 - ldrsh r0, [r5, r1] - cmp r0, 0xA - bne _08100E10 - movs r2, 0x2E - ldrsh r1, [r5, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - movs r0, 0x30 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - adds r0, r5, 0 - bl DestroyAnimSprite -_08100E10: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100D38 - - thumb_func_start sub_8100E1C -sub_8100E1C: @ 8100E1C - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gBattleAnimArgs - ldrh r0, [r4, 0x4] - strh r0, [r5, 0x2E] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08100E44 - ldrh r0, [r5, 0x20] - ldrh r1, [r4] - subs r0, r1 - b _08100E4A - .pool -_08100E44: - ldrh r0, [r4] - ldrh r1, [r5, 0x20] - adds r0, r1 -_08100E4A: - strh r0, [r5, 0x20] - ldr r4, =gBattleAnimArgs - ldrb r1, [r4, 0xA] - adds r0, r5, 0 - bl StartSpriteAnim - ldrh r0, [r4, 0x6] - negs r0, r0 - strh r0, [r5, 0x30] - ldrh r0, [r4, 0x2] - ldrh r1, [r5, 0x22] - adds r0, r1 - strh r0, [r5, 0x22] - ldrh r0, [r4, 0x8] - strh r0, [r5, 0x34] - ldr r1, =sub_8100E80 - str r1, [r5, 0x1C] - adds r0, r5, 0 - bl _call_via_r1 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100E1C - - thumb_func_start sub_8100E80 -sub_8100E80: @ 8100E80 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x64 - bl Cos - strh r0, [r4, 0x24] - movs r2, 0x2E - ldrsh r0, [r4, r2] - movs r1, 0x14 - bl Sin - strh r0, [r4, 0x26] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x7F - bgt _08100EAC - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0 - b _08100EB2 -_08100EAC: - adds r1, r4, 0 - adds r1, 0x43 - movs r0, 0xE -_08100EB2: - strb r0, [r1] - ldrh r0, [r4, 0x30] - ldrh r2, [r4, 0x2E] - adds r0, r2 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x38] - adds r0, 0x82 - 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 - movs r2, 0x34 - ldrsh r1, [r4, r2] - cmp r0, r1 - bne _08100EE8 - adds r0, r4, 0 - bl DestroyAnimSprite -_08100EE8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8100E80 - - thumb_func_start sub_8100EF0 -sub_8100EF0: @ 8100EF0 - push {r4-r6,lr} - adds r5, r0, 0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _08100F06 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - adds r0, 0x8 - strh r0, [r1, 0x2] -_08100F06: - ldr r6, =gBattleAnimAttacker - ldrb r0, [r6] - movs r1, 0 - bl GetBattlerSpriteCoord2 - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r4] - adds r0, r1 - strh r0, [r5, 0x20] - ldrb r0, [r6] - movs r1, 0x1 - bl GetBattlerSpriteCoord2 - lsls r0, 24 - lsrs r0, 24 - ldrh r4, [r4, 0x2] - adds r0, r4 - strh r0, [r5, 0x22] - ldrb r0, [r6] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08100F44 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _08100F6C -_08100F44: - ldrb r0, [r6] - bl sub_80A8328 - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r5, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0x5] - b _08100F84 - .pool -_08100F6C: - ldrb r0, [r6] - bl sub_80A8328 - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r5, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x5] -_08100F84: - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x4] - strh r0, [r5, 0x2E] - ldr r0, =0x00002828 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - strh r0, [r5, 0x32] - movs r4, 0x10 - movs r0, 0x10 - strh r0, [r5, 0x3C] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldrh r0, [r5, 0x3C] - lsls r1, r0, 8 - subs r4, r0 - orrs r1, r4 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldr r0, =sub_8100FD4 - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100EF0 - - thumb_func_start sub_8100FD4 -sub_8100FD4: @ 8100FD4 - push {r4-r6,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x38] - adds r0, 0x60 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 24 - negs r0, r0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08101032 - movs r0, 0 - strh r0, [r4, 0x30] - ldr r1, =gPlttBufferFaded - movs r2, 0x32 - ldrsh r0, [r4, r2] - adds r0, 0x1 - lsls r0, 1 - adds r0, r1 - ldrh r5, [r0] - movs r2, 0 - adds r6, r1, 0 - adds r3, r6, 0 -_0810100C: - movs r1, 0x32 - ldrsh r0, [r4, r1] - adds r2, 0x1 - adds r0, r2 - lsls r1, r0, 1 - adds r1, r3 - adds r0, 0x1 - lsls r0, 1 - adds r0, r3 - ldrh r0, [r0] - strh r0, [r1] - cmp r2, 0x5 - ble _0810100C - movs r2, 0x32 - ldrsh r0, [r4, r2] - adds r0, 0x7 - lsls r0, 1 - adds r0, r6 - strh r5, [r0] -_08101032: - ldrh r2, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x6 - ble _0810106C - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - ble _08101080 - ldrh r0, [r4, 0x3A] - adds r0, 0x1 - strh r0, [r4, 0x3A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0810106C - movs r0, 0 - strh r0, [r4, 0x3A] - subs r2, 0x1 - strh r2, [r4, 0x3C] - lsls r1, r2, 8 - movs r0, 0x10 - subs r0, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg -_0810106C: - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _08101080 - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] - b _081010C2 - .pool -_08101080: - ldrh r0, [r4, 0x3A] - adds r0, 0x1 - strh r0, [r4, 0x3A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _081010C2 - movs r0, 0 - strh r0, [r4, 0x3A] - ldrh r2, [r4, 0x3C] - adds r2, 0x1 - strh r2, [r4, 0x3C] - lsls r1, r2, 8 - movs r0, 0x10 - subs r0, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _081010C2 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_80A67F4 - str r0, [r4, 0x1C] -_081010C2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8100FD4 - - thumb_func_start sub_81010CC -sub_81010CC: @ 81010CC - push {r4-r6,lr} - adds r4, r0, 0 - ldr r6, =gBattleAnimTarget - ldrb r0, [r6] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - strh r0, [r4, 0x20] - ldrb r0, [r6] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldr r1, =0x0000ffe8 - adds r0, r1 - strh r0, [r4, 0x22] - strh r5, [r4, 0x2E] - strh r5, [r4, 0x30] - strh r5, [r4, 0x32] - strh r5, [r4, 0x34] - strh r5, [r4, 0x36] - strh r5, [r4, 0x3A] - movs r0, 0x10 - strh r0, [r4, 0x3C] - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldrh r1, [r4, 0x3C] - lsls r1, 8 - ldrh r0, [r4, 0x3A] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - ldr r0, =sub_8101138 - str r0, [r4, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81010CC - - thumb_func_start sub_8101138 -sub_8101138: @ 8101138 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bls _08101146 - b _08101290 -_08101146: - lsls r0, 2 - ldr r1, =_08101154 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08101154: - .4byte _08101168 - .4byte _081011CC - .4byte _081011E8 - .4byte _08101266 - .4byte _0810127A -_08101168: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - cmp r0, 0 - bgt _08101176 - b _08101290 -_08101176: - movs r0, 0 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08101198 - ldrh r1, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmp r0, 0xF - bgt _081011A6 - adds r0, r1, 0x1 - strh r0, [r4, 0x3A] - b _081011A6 -_08101198: - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _081011A6 - subs r0, r1, 0x1 - strh r0, [r4, 0x3C] -_081011A6: - ldrh r1, [r4, 0x3C] - lsls r1, 8 - ldrh r0, [r4, 0x3A] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _08101290 - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08101290 - strh r0, [r4, 0x30] - b _08101272 -_081011CC: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _08101290 - movs r0, 0 - strh r0, [r4, 0x30] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - b _08101272 -_081011E8: - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0x4 - bl sub_8101298 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - ble _0810120A - movs r0, 0 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - adds r0, 0x1 - strh r0, [r4, 0x22] -_0810120A: - ldrh r0, [r4, 0x32] - adds r1, r0, 0x1 - strh r1, [r4, 0x32] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x1D - ble _08101290 - movs r0, 0x1 - ands r1, r0 - cmp r1, 0 - beq _08101230 - ldrh r1, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _0810123E - subs r0, r1, 0x1 - strh r0, [r4, 0x3A] - b _0810123E -_08101230: - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0xF - bgt _0810123E - adds r0, r1, 0x1 - strh r0, [r4, 0x3C] -_0810123E: - ldrh r1, [r4, 0x3C] - lsls r1, 8 - ldrh r0, [r4, 0x3A] - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x3A - ldrsh r1, [r4, r0] - cmp r1, 0 - bne _08101290 - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x10 - bne _08101290 - strh r1, [r4, 0x30] - strh r1, [r4, 0x32] - b _08101272 -_08101266: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_08101272: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _08101290 -_0810127A: - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - adds r0, r4, 0 - bl DestroyAnimSprite -_08101290: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8101138 - - thumb_func_start sub_8101298 -sub_8101298: @ 8101298 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0xB - bgt _081012AA - ldrh r0, [r4, 0x36] - adds r0, 0x2 - strh r0, [r4, 0x36] -_081012AA: - ldrh r5, [r4, 0x34] - adds r0, r5, 0 - subs r0, 0x12 - lsls r0, 16 - lsrs r0, 16 - adds r1, r5, 0 - cmp r0, 0x17 - bhi _081012C0 - ldrh r0, [r4, 0x36] - subs r0, 0x2 - strh r0, [r4, 0x36] -_081012C0: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x2F - ble _081012CE - ldrh r0, [r4, 0x36] - adds r0, 0x2 - strh r0, [r4, 0x36] -_081012CE: - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0x9 - bl __divsi3 - strh r0, [r4, 0x24] - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0xE - bl __divsi3 - strh r0, [r4, 0x26] - lsls r0, 16 - cmp r0, 0 - bge _081012F4 - movs r1, 0x26 - ldrsh r0, [r4, r1] - negs r0, r0 - strh r0, [r4, 0x26] -_081012F4: - adds r0, r5, 0x1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3B - ble _08101304 - movs r0, 0 - strh r0, [r4, 0x34] -_08101304: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8101298 - - thumb_func_start sub_810130C -sub_810130C: @ 810130C - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gBattleAnimArgs - movs r1, 0x4 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _08101320 - adds r0, r4, 0 - bl sub_80A6838 -_08101320: - movs r0, 0 - ldrsh r1, [r5, r0] - adds r0, r4, 0 - bl sub_80A6864 - ldrh r0, [r5, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - ldrh r0, [r5, 0xA] - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x30] - ldrh r0, [r5, 0x8] - strh r0, [r4, 0x32] - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A656C - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810130C - - thumb_func_start sub_810135C -sub_810135C: @ 810135C - push {r4-r6,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0x4 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08101378 - ldr r0, =gBattleAnimAttacker - b _0810137A - .pool -_08101378: - ldr r0, =gBattleAnimTarget -_0810137A: - ldrb r6, [r0] - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - beq _081013C4 - movs r1, 0x2 - adds r0, r6, 0 - eors r0, r1 - bl IsBattlerSpriteVisible - lsls r0, 24 - cmp r0, 0 - beq _081013C4 - ldr r4, =gBattleAnimArgs - ldrb r1, [r4, 0xC] - adds r2, r5, 0 - adds r2, 0x20 - adds r3, r5, 0 - adds r3, 0x22 - adds r0, r6, 0 - bl SetAverageBattlerPositions - movs r2, 0 - ldrsh r1, [r4, r2] - adds r0, r5, 0 - bl sub_80A6864 - ldrh r0, [r4, 0x2] - ldrh r1, [r5, 0x22] - adds r0, r1 - strh r0, [r5, 0x22] - b _08101414 - .pool -_081013C4: - ldr r4, =gBattleAnimArgs - movs r2, 0xC - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _081013E8 - adds r0, r6, 0 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - adds r0, r6, 0 - movs r1, 0x1 - b _081013FA - .pool -_081013E8: - adds r0, r6, 0 - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - adds r0, r6, 0 - movs r1, 0x3 -_081013FA: - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r4, [r4, 0x2] - adds r0, r4 - strh r0, [r5, 0x22] - ldr r0, =gBattleAnimArgs - movs r2, 0 - ldrsh r1, [r0, r2] - adds r0, r5, 0 - bl sub_80A6864 -_08101414: - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0xA] - strh r0, [r5, 0x2E] - ldrh r0, [r1, 0x6] - strh r0, [r5, 0x30] - ldrh r0, [r1, 0x8] - strh r0, [r5, 0x32] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A656C - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810135C - - thumb_func_start sub_8101440 -sub_8101440: @ 8101440 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6838 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08101474 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0] - ldrh r2, [r4, 0x20] - adds r1, r2 - strh r1, [r4, 0x20] - ldrh r0, [r0, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - b _0810148E - .pool -_08101474: - ldr r2, =gBattleAnimArgs - ldrh r0, [r4, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x2] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim -_0810148E: - ldr r0, =sub_81014A0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101440 - - thumb_func_start sub_81014A0 -sub_81014A0: @ 81014A0 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - ble _081014D8 - movs r0, 0x2E - ldrsh r1, [r4, r0] - movs r0, 0x1E - subs r0, r1 - movs r1, 0x3 - bl __divsi3 - strh r0, [r4, 0x26] - movs r1, 0x30 - ldrsh r0, [r4, r1] - lsls r0, 18 - asrs r0, 16 - movs r1, 0x3 - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_081014D8: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081014EC - adds r0, r4, 0 - bl DestroyAnimSprite -_081014EC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81014A0 - - thumb_func_start sub_81014F4 -sub_81014F4: @ 81014F4 - push {r4,lr} - adds r4, r0, 0 - bl sub_80A6838 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810152C - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - ldrh r0, [r1, 0x2] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - movs r0, 0x1 - strh r0, [r4, 0x34] - b _0810154A - .pool -_0810152C: - ldr r2, =gBattleAnimArgs - ldrh r0, [r4, 0x20] - ldrh r1, [r2] - subs r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x2] - ldrh r2, [r4, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] - ldr r0, =0x0000ffff - strh r0, [r4, 0x34] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim -_0810154A: - ldr r0, =sub_8101560 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81014F4 - - thumb_func_start sub_8101560 -sub_8101560: @ 8101560 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x28 - bl __divsi3 - negs r0, r0 - strh r0, [r4, 0x26] - movs r2, 0x36 - ldrsh r0, [r4, r2] - movs r1, 0xA - bl __divsi3 - strh r0, [r4, 0x24] - movs r1, 0x34 - ldrsh r0, [r4, r1] - lsls r0, 1 - ldrh r2, [r4, 0x36] - adds r0, r2 - strh r0, [r4, 0x36] - ldrh r0, [r4, 0x30] - ldrh r2, [r4, 0x2E] - adds r1, r0, r2 - strh r1, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - ble _081015A4 - adds r0, r4, 0 - bl move_anim_8074EE0 -_081015A4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8101560 - - thumb_func_start sub_81015AC -sub_81015AC: @ 81015AC - push {lr} - ldrh r1, [r0, 0x20] - subs r1, 0x20 - strh r1, [r0, 0x20] - ldrh r1, [r0, 0x22] - subs r1, 0x20 - strh r1, [r0, 0x22] - movs r1, 0x14 - strh r1, [r0, 0x2E] - ldr r1, =WaitAnimForDuration - str r1, [r0, 0x1C] - ldr r1, =sub_81015D4 - bl StoreSpriteCallbackInData6 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81015AC - - thumb_func_start sub_81015D4 -sub_81015D4: @ 81015D4 - push {r4-r6,lr} - adds r5, r0, 0 - ldrh r6, [r5, 0x38] - movs r1, 0x1 - adds r0, r1, 0 - ands r0, r6 - cmp r0, 0 - beq _081015EA - cmp r0, 0x1 - beq _08101604 - b _0810166A -_081015EA: - strh r1, [r5, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r5, 0x1C] - ldr r1, =sub_81015D4 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - b _0810166A - .pool -_08101604: - ldrh r3, [r5, 0x24] - ldrh r0, [r5, 0x20] - adds r3, r0 - movs r0, 0 - strh r3, [r5, 0x20] - ldrh r4, [r5, 0x26] - ldrh r1, [r5, 0x22] - adds r4, r1 - strh r4, [r5, 0x22] - strh r0, [r5, 0x26] - strh r0, [r5, 0x24] - movs r0, 0x8 - strh r0, [r5, 0x2E] - ldr r2, =gUnknown_08592CD0 - lsls r0, r6, 16 - asrs r0, 24 - lsls r0, 1 - adds r1, r0, r2 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - adds r3, r1 - strh r3, [r5, 0x32] - adds r2, 0x1 - adds r0, r2 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r4, r0 - strh r4, [r5, 0x36] - ldr r0, =StartAnimLinearTranslation - str r0, [r5, 0x1C] - ldr r1, =sub_8101684 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1, 0 - ldrh r1, [r5, 0x38] - adds r0, r1 - strh r0, [r5, 0x38] - movs r0, 0x3F - bl BattleAnimAdjustPanning - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 24 - movs r0, 0xD2 - bl PlaySE12WithPanning -_0810166A: - ldrh r0, [r5, 0x38] - movs r1, 0x1 - eors r0, r1 - strh r0, [r5, 0x38] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81015D4 - - thumb_func_start sub_8101684 -sub_8101684: @ 8101684 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x38] - lsls r0, 16 - asrs r0, 24 - cmp r0, 0x4 - bne _081016AC - movs r0, 0xA - strh r0, [r2, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r2, 0x1C] - ldr r1, =sub_81016B8 - adds r0, r2, 0 - bl StoreSpriteCallbackInData6 - b _081016B0 - .pool -_081016AC: - ldr r0, =sub_81015D4 - str r0, [r2, 0x1C] -_081016B0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101684 - - thumb_func_start sub_81016B8 -sub_81016B8: @ 81016B8 - push {r4-r7,lr} - adds r5, r0, 0 - ldrh r1, [r5, 0x6] - cmp r1, 0 - bne _081016E0 - movs r0, 0x3 - strh r0, [r5, 0x2E] - strh r1, [r5, 0x30] - strh r1, [r5, 0x32] - ldr r0, =WaitAnimForDuration - str r0, [r5, 0x1C] - ldr r1, =sub_8101774 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - b _08101760 - .pool -_081016E0: - ldrh r0, [r5, 0x6] - cmp r0, 0x2 - beq _08101700 - cmp r0, 0x2 - bgt _081016F0 - cmp r0, 0x1 - beq _081016F6 - b _08101714 -_081016F0: - cmp r0, 0x3 - beq _08101708 - b _08101714 -_081016F6: - ldr r6, =0x0000fff8 - adds r7, r6, 0 - b _08101718 - .pool -_08101700: - ldr r7, =0x0000fff8 - b _08101716 - .pool -_08101708: - movs r7, 0x8 - ldr r6, =0x0000fff8 - b _08101718 - .pool -_08101714: - movs r7, 0x8 -_08101716: - movs r6, 0x8 -_08101718: - ldrh r0, [r5, 0x24] - ldrh r1, [r5, 0x20] - adds r0, r1 - movs r1, 0 - strh r0, [r5, 0x20] - ldrh r0, [r5, 0x26] - ldrh r2, [r5, 0x22] - adds r0, r2 - strh r0, [r5, 0x22] - strh r1, [r5, 0x26] - strh r1, [r5, 0x24] - movs r0, 0x6 - strh r0, [r5, 0x2E] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, r7 - strh r0, [r5, 0x32] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, r6 - strh r0, [r5, 0x36] - ldr r0, =StartAnimLinearTranslation - str r0, [r5, 0x1C] - ldr r1, =sub_8101820 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 -_08101760: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81016B8 - - thumb_func_start sub_8101774 -sub_8101774: @ 8101774 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08101794 - ldrh r0, [r4, 0x30] - adds r0, 0x3 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _081017A4 - movs r0, 0x10 - b _081017A2 -_08101794: - ldrh r0, [r4, 0x30] - subs r0, 0x3 - strh r0, [r4, 0x30] - lsls r0, 16 - cmp r0, 0 - bge _081017A4 - movs r0, 0 -_081017A2: - strh r0, [r4, 0x30] -_081017A4: - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x1 - movs r3, 0x1 - bl sub_80A75AC - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - ldr r2, =0x00007fff - bl BlendPalettes - movs r3, 0x30 - ldrsh r0, [r4, r3] - cmp r0, 0x10 - bne _0810180C - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - ldrb r1, [r4, 0x5] - lsrs r1, 4 - lsls r0, r1, 5 - ldr r2, =gPlttBufferUnfaded + 0x210 - adds r0, r2 - lsls r1, 4 - ldr r3, =0x00000101 - adds r2, r3, 0 - orrs r1, r2 - movs r2, 0x4 - bl LoadPalette - movs r0, 0x3F - bl BattleAnimAdjustPanning - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 24 - movs r0, 0xC0 - bl PlaySE12WithPanning - b _08101814 - .pool -_0810180C: - cmp r0, 0 - bne _08101814 - ldr r0, =sub_8101820 - str r0, [r4, 0x1C] -_08101814: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101774 - - thumb_func_start sub_8101820 -sub_8101820: @ 8101820 - push {lr} - adds r2, r0, 0 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0xE] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _08101838 - movs r0, 0 - strh r0, [r2, 0x30] - strh r0, [r2, 0x2E] - ldr r0, =sub_8101848 - str r0, [r2, 0x1C] -_08101838: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101820 - - thumb_func_start sub_8101848 -sub_8101848: @ 8101848 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _0810187C - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - 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] -_0810187C: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x8 - bne _08101890 - adds r0, r4, 0 - bl DestroyAnimSprite -_08101890: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8101848 - - thumb_func_start sub_8101898 -sub_8101898: @ 8101898 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0] - strh r0, [r3, 0x6] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _081018BC - ldrh r0, [r3, 0x20] - subs r0, 0x18 - strh r0, [r3, 0x20] - ldrh r0, [r3, 0x22] - subs r0, 0x18 - strh r0, [r3, 0x22] - b _0810190E - .pool -_081018BC: - cmp r0, 0x2 - bne _081018D8 - ldrh r0, [r3, 0x20] - subs r0, 0x18 - strh r0, [r3, 0x20] - ldrh r0, [r3, 0x22] - adds r0, 0x18 - strh r0, [r3, 0x22] - ldrb r1, [r3, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x20 - b _0810190A -_081018D8: - cmp r0, 0x3 - bne _081018F4 - ldrh r0, [r3, 0x20] - adds r0, 0x18 - strh r0, [r3, 0x20] - ldrh r0, [r3, 0x22] - subs r0, 0x18 - strh r0, [r3, 0x22] - ldrb r1, [r3, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x10 - b _0810190A -_081018F4: - ldrh r0, [r3, 0x20] - adds r0, 0x18 - strh r0, [r3, 0x20] - ldrh r0, [r3, 0x22] - adds r0, 0x18 - strh r0, [r3, 0x22] - ldrb r1, [r3, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x30 -_0810190A: - orrs r0, r1 - strb r0, [r3, 0x3] -_0810190E: - ldrh r2, [r3, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - adds r1, 0x10 - ldr r4, =0x000003ff - adds r0, r4, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - ldr r1, =sub_81015AC - str r1, [r3, 0x1C] - adds r0, r3, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101898 - - thumb_func_start sub_8101940 -sub_8101940: @ 8101940 - push {lr} - adds r3, r0, 0 - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r0, 0 - strh r0, [r3, 0x2E] - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - beq _0810197C - cmp r0, 0x1 - bgt _0810196C - cmp r0, 0 - beq _08101972 - b _0810198C - .pool -_0810196C: - cmp r0, 0x2 - beq _08101984 - b _0810198C -_08101972: - ldr r0, =sub_8101998 - b _0810198E - .pool -_0810197C: - ldr r0, =sub_8101A74 - b _0810198E - .pool -_08101984: - ldr r0, =sub_8101AC4 - b _0810198E - .pool -_0810198C: - ldr r0, =sub_8101B84 -_0810198E: - str r0, [r3, 0x1C] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101940 - - thumb_func_start sub_8101998 -sub_8101998: @ 8101998 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x6 - strh r0, [r4, 0x2E] - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - bl GetBattlerSide - lsls r0, 24 - movs r2, 0x2 - negs r2, r2 - adds r1, r2, 0 - cmp r0, 0 - beq _081019B6 - movs r1, 0x2 -_081019B6: - strh r1, [r4, 0x30] - movs r0, 0 - strh r0, [r4, 0x32] - ldr r1, =gBattlerSpriteIds - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r4, 0x34] - ldr r1, =sub_81019E8 - 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_8101998 - - thumb_func_start sub_81019E8 -sub_81019E8: @ 81019E8 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x2E - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08101A24 - ldr r1, =gBattlerSpriteIds - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r5, 0x34] - movs r1, 0 - bl sub_80A7270 - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x3A] - ldr r2, =0xfffffd00 - adds r1, r2, 0 - cmp r0, 0 - beq _08101A20 - movs r0, 0xC0 - lsls r0, 2 - adds r1, r0, 0 -_08101A20: - strh r1, [r5, 0x36] - strh r6, [r5, 0x38] -_08101A24: - ldrh r0, [r5, 0x36] - ldrh r1, [r5, 0x38] - adds r0, r1 - strh r0, [r5, 0x38] - ldrh r0, [r5, 0x34] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r5, 0x38] - adds r1, r2, 0 - bl obj_id_set_rotscale - ldrh r0, [r5, 0x34] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A73A0 - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _08101A5E - movs r0, 0 - strh r0, [r5, 0x2E] - ldr r0, =sub_8101B84 - str r0, [r5, 0x1C] -_08101A5E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81019E8 - - thumb_func_start sub_8101A74 -sub_8101A74: @ 8101A74 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x4 - strh r0, [r4, 0x2E] - ldr r5, =gBattleAnimAttacker - ldrb r0, [r5] - bl GetBattlerSide - lsls r0, 24 - movs r1, 0x3 - cmp r0, 0 - beq _08101A92 - movs r0, 0x3 - negs r0, r0 - adds r1, r0, 0 -_08101A92: - strh r1, [r4, 0x30] - movs r0, 0 - strh r0, [r4, 0x32] - ldr r1, =gBattlerSpriteIds - ldrb r0, [r5] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r4, 0x34] - ldr r1, =sub_8101B84 - 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_8101A74 - - thumb_func_start sub_8101AC4 -sub_8101AC4: @ 8101AC4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _08101ADE - movs r0, 0 - strh r0, [r1, 0x2E] - ldr r0, =sub_8101AE8 - str r0, [r1, 0x1C] -_08101ADE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101AC4 - - thumb_func_start sub_8101AE8 -sub_8101AE8: @ 8101AE8 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _08101B38 - ldr r1, =gBattlerSpriteIds - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r5, 0x34] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x3A] - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _08101B2C - movs r0, 0xFC - lsls r0, 8 - strh r0, [r5, 0x36] - movs r0, 0xC0 - lsls r0, 4 - b _08101B36 - .pool -_08101B2C: - movs r0, 0x80 - lsls r0, 3 - strh r0, [r5, 0x36] - movs r0, 0xF4 - lsls r0, 8 -_08101B36: - strh r0, [r5, 0x38] -_08101B38: - ldrh r0, [r5, 0x36] - ldrh r1, [r5, 0x38] - adds r0, r1 - strh r0, [r5, 0x38] - ldrh r0, [r5, 0x34] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r5, 0x38] - adds r1, r2, 0 - bl obj_id_set_rotscale - ldrh r0, [r5, 0x34] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A73A0 - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - ble _08101B78 - ldrh r0, [r5, 0x34] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7344 - ldr r0, =sub_8101B84 - str r0, [r5, 0x1C] -_08101B78: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101AE8 - - thumb_func_start sub_8101B84 -sub_8101B84: @ 8101B84 - push {lr} - bl DestroyAnimSprite - pop {r0} - bx r0 - thumb_func_end sub_8101B84 - - thumb_func_start sub_8101B90 -sub_8101B90: @ 8101B90 - movs r1, 0 - strh r1, [r0, 0x2E] - ldr r1, =sub_8101BA0 - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_8101B90 - - thumb_func_start sub_8101BA0 -sub_8101BA0: @ 8101BA0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x2E - ldrsh r5, [r4, r0] - cmp r5, 0x1 - beq _08101BFA - cmp r5, 0x1 - bgt _08101BB6 - cmp r5, 0 - beq _08101BBC - b _08101C8E -_08101BB6: - cmp r5, 0x2 - beq _08101C4C - b _08101C8E -_08101BBC: - strh r5, [r4, 0x30] - ldr r1, =gBattlerSpriteIds - ldr r2, =gBattleAnimAttacker - ldrb r0, [r2] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r4, 0x32] - ldrb r0, [r2] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x34] - ldr r2, =0xfffffe00 - adds r1, r2, 0 - cmp r0, 0 - beq _08101BE4 - movs r0, 0x80 - lsls r0, 2 - adds r1, r0, 0 -_08101BE4: - strh r1, [r4, 0x36] - strh r5, [r4, 0x38] - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80A7270 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_08101BFA: - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x38] - adds r0, r1 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x38] - adds r1, r2, 0 - bl obj_id_set_rotscale - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A73A0 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _08101C8E - movs r0, 0 - strh r0, [r4, 0x30] - movs r2, 0x36 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x36] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _08101C8E - .pool -_08101C4C: - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x38] - adds r0, r1 - strh r0, [r4, 0x38] - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x38] - adds r1, r2, 0 - bl obj_id_set_rotscale - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A73A0 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _08101C8E - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - bl sub_80A7344 - adds r0, r4, 0 - bl DestroyAnimSprite -_08101C8E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8101BA0 - - thumb_func_start sub_8101C94 -sub_8101C94: @ 8101C94 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r5, r0, r1 - ldr r1, =gBattlerSpriteIds - ldr r2, =gBattleAnimAttacker - ldrb r0, [r2] - adds r0, r1 - ldrb r0, [r0] - movs r4, 0 - strh r0, [r5, 0x8] - ldrb r0, [r2] - bl GetBattlerSide - lsls r0, 24 - lsrs r2, r0, 24 - strh r2, [r5, 0xA] - strh r4, [r5, 0xC] - ldr r0, =gBattleAnimArgs - movs r3, 0 - ldrsh r1, [r0, r3] - cmp r1, 0 - beq _08101CE8 - cmp r1, 0x1 - beq _08101D04 - adds r0, r6, 0 - bl DestroyAnimVisualTask - b _08101D22 - .pool -_08101CE8: - strh r1, [r5, 0xC] - movs r0, 0x8 - strh r0, [r5, 0xE] - strh r1, [r5, 0x10] - movs r0, 0x3 - strh r0, [r5, 0x12] - cmp r2, 0 - bne _08101CFC - negs r0, r0 - strh r0, [r5, 0x12] -_08101CFC: - ldr r0, =sub_8101D2C - b _08101D20 - .pool -_08101D04: - movs r0, 0x8 - strh r0, [r5, 0xE] - movs r0, 0xC0 - lsls r0, 3 - strh r0, [r5, 0x10] - movs r1, 0xC0 - strh r1, [r5, 0x12] - cmp r2, 0 - bne _08101D1E - negs r0, r0 - strh r0, [r5, 0x10] - negs r0, r1 - strh r0, [r5, 0x12] -_08101D1E: - ldr r0, =sub_8101EEC -_08101D20: - str r0, [r5] -_08101D22: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101C94 - - thumb_func_start sub_8101D2C -sub_8101D2C: @ 8101D2C - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bls _08101D46 - b _08101EE6 -_08101D46: - lsls r0, 2 - ldr r1, =_08101D58 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08101D58: - .4byte _08101D6C - .4byte _08101D9E - .4byte _08101DF8 - .4byte _08101E70 - .4byte _08101EB4 -_08101D6C: - movs r2, 0xE - ldrsh r1, [r4, r2] - cmp r1, 0 - beq _08101D7C - ldrh r2, [r4, 0x12] - ldrh r3, [r4, 0x10] - adds r2, r3 - b _08101EC2 -_08101D7C: - movs r0, 0x8 - strh r0, [r4, 0xE] - strh r1, [r4, 0x10] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r1, 0xC0 - cmp r0, 0 - bne _08101D92 - movs r2, 0xC0 - negs r2, r2 - adds r1, r2, 0 -_08101D92: - strh r1, [r4, 0x12] - ldrb r0, [r4, 0x8] - movs r1, 0 - bl sub_80A7270 - b _08101EA8 -_08101D9E: - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _08101DC4 - ldrh r0, [r4, 0x12] - ldrh r1, [r4, 0x10] - adds r0, r1 - strh r0, [r4, 0x10] - ldrb r0, [r4, 0x8] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x10] - adds r1, r2, 0 - bl obj_id_set_rotscale - ldrb r0, [r4, 0x8] - bl sub_80A73A0 - b _08101ED4 -_08101DC4: - movs r0, 0x8 - strh r0, [r4, 0xE] - ldr r2, =gSprites - movs r3, 0x8 - ldrsh r1, [r4, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x24] - strh r0, [r4, 0x10] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r2, 0x2 - negs r2, r2 - adds r1, r2, 0 - cmp r0, 0 - bne _08101DEA - movs r1, 0x2 -_08101DEA: - strh r1, [r4, 0x12] - movs r0, 0x1 - strh r0, [r4, 0x14] - b _08101EA8 - .pool -_08101DF8: - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _08101E54 - ldrh r1, [r4, 0x14] - movs r3, 0x14 - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _08101E12 - subs r0, r1, 0x1 - strh r0, [r4, 0x14] - b _08101EE6 -_08101E12: - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _08101E34 - 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 r2, [r4, 0x10] - adds r1, r2 - b _08101E48 - .pool -_08101E34: - ldr r2, =gSprites - movs r3, 0x8 - ldrsh r1, [r4, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0x10] - ldrh r2, [r4, 0x12] - subs r1, r2 -_08101E48: - strh r1, [r0, 0x24] - movs r0, 0x1 - strh r0, [r4, 0x14] - b _08101ED4 - .pool -_08101E54: - 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, 0x10] - strh r1, [r0, 0x24] - movs r0, 0xC - strh r0, [r4, 0xE] - b _08101EA8 - .pool -_08101E70: - ldrh r1, [r4, 0xE] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _08101E80 - subs r0, r1, 0x1 - strh r0, [r4, 0xE] - b _08101EE6 -_08101E80: - movs r0, 0x3 - strh r0, [r4, 0xE] - ldr r2, =gSprites - movs r3, 0x8 - ldrsh r1, [r4, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x24] - strh r0, [r4, 0x10] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r2, 0x8 - negs r2, r2 - adds r1, r2, 0 - cmp r0, 0 - bne _08101EA6 - movs r1, 0x8 -_08101EA6: - strh r1, [r4, 0x12] -_08101EA8: - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - b _08101EE6 - .pool -_08101EB4: - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _08101EE0 - ldrh r2, [r4, 0x12] - ldrh r0, [r4, 0x10] - adds r2, r0 -_08101EC2: - strh r2, [r4, 0x10] - ldr r3, =gSprites - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - strh r2, [r0, 0x24] -_08101ED4: - ldrh r0, [r4, 0xE] - subs r0, 0x1 - strh r0, [r4, 0xE] - b _08101EE6 - .pool -_08101EE0: - adds r0, r2, 0 - bl DestroyAnimVisualTask -_08101EE6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8101D2C - - thumb_func_start sub_8101EEC -sub_8101EEC: @ 8101EEC - 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, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08101F2C - ldrh r0, [r4, 0x10] - ldrh r1, [r4, 0x12] - subs r0, r1 - strh r0, [r4, 0x10] - ldrb r0, [r4, 0x8] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x10] - adds r1, r2, 0 - bl obj_id_set_rotscale - ldrb r0, [r4, 0x8] - bl sub_80A73A0 - ldrh r0, [r4, 0xE] - subs r0, 0x1 - strh r0, [r4, 0xE] - b _08101F38 - .pool -_08101F2C: - ldrb r0, [r4, 0x8] - bl sub_80A7344 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08101F38: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8101EEC - - thumb_func_start sub_8101F40 -sub_8101F40: @ 8101F40 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r6, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08101F5C - ldr r4, =gBattleAnimAttacker - b _08101F5E - .pool -_08101F5C: - ldr r4, =gBattleAnimTarget -_08101F5E: - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r6, 0x2] - adds r0, r1 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r6, [r6, 0x4] - adds r0, r6 - strh r0, [r5, 0x22] - movs r0, 0 - strh r0, [r5, 0x2E] - strh r0, [r5, 0x30] - ldr r1, =sub_810208C - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67D8 - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101F40 - - thumb_func_start sub_8101FA8 -sub_8101FA8: @ 8101FA8 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldr r1, =0x0000ffd0 - adds r0, r1 - strh r0, [r4, 0x20] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x22] - ldr r1, =sub_8102044 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67D8 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101FA8 - - thumb_func_start sub_8101FF0 -sub_8101FF0: @ 8101FF0 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gBattleAnimArgs - ldr r2, =0x0000ffd0 - adds r0, r2 - ldrh r1, [r1] - adds r0, r1 - movs r6, 0 - strh r0, [r4, 0x20] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x22] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim - strh r6, [r4, 0x2E] - strh r6, [r4, 0x30] - ldr r0, =sub_810208C - str r0, [r4, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8101FF0 - - thumb_func_start sub_8102044 -sub_8102044: @ 8102044 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _0810206E - movs r0, 0xC - strh r0, [r4, 0x2E] - movs r0, 0x8 - strh r0, [r4, 0x30] - movs r0, 0 - strh r0, [r4, 0x32] - ldr r1, =sub_810207C - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A653C - str r0, [r4, 0x1C] -_0810206E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102044 - - thumb_func_start sub_810207C -sub_810207C: @ 810207C - movs r1, 0 - strh r1, [r0, 0x2E] - strh r1, [r0, 0x30] - ldr r1, =sub_810208C - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_810207C - - thumb_func_start sub_810208C -sub_810208C: @ 810208C - push {lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _081020D4 - movs r0, 0 - strh r0, [r3, 0x2E] - movs r0, 0x3E - adds r0, r3 - mov r12, r0 - ldrb r2, [r0] - lsrs r1, r2, 2 - movs r0, 0x1 - eors r1, r0 - ands r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - mov r1, r12 - strb r0, [r1] - ldrh r0, [r3, 0x30] - adds r0, 0x1 - strh r0, [r3, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _081020D4 - adds r0, r3, 0 - bl DestroyAnimSprite -_081020D4: - pop {r0} - bx r0 - thumb_func_end sub_810208C - - thumb_func_start sub_81020D8 -sub_81020D8: @ 81020D8 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r6, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081020F4 - ldr r4, =gBattleAnimAttacker - b _081020F6 - .pool -_081020F4: - ldr r4, =gBattleAnimTarget -_081020F6: - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r6, 0x2] - adds r0, r1 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r6, [r6, 0x4] - adds r0, r6 - strh r0, [r5, 0x22] - movs r0, 0 - strh r0, [r5, 0x2E] - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x6] - strh r0, [r5, 0x30] - ldr r0, =sub_810213C - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81020D8 - - thumb_func_start sub_810213C -sub_810213C: @ 810213C - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x30 - ldrsh r1, [r2, r3] - cmp r0, r1 - ble _0810215C - movs r0, 0 - strh r0, [r2, 0x2E] - ldrh r0, [r2, 0x22] - subs r0, 0x1 - strh r0, [r2, 0x22] -_0810215C: - ldrh r0, [r2, 0x22] - ldrh r1, [r2, 0x2E] - subs r0, r1 - strh r0, [r2, 0x22] - adds r0, r2, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08102178 - adds r0, r2, 0 - bl DestroyAnimSprite -_08102178: - pop {r0} - bx r0 - thumb_func_end sub_810213C - - thumb_func_start sub_810217C -sub_810217C: @ 810217C - push {r4-r6,lr} - adds r4, r0, 0 - ldr r6, =gBattleAnimAttacker - ldrb r0, [r6] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - strh r0, [r4, 0x20] - ldrb r0, [r6] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - subs r0, 0xC - strh r0, [r4, 0x22] - strh r5, [r4, 0x2E] - movs r0, 0x2 - strh r0, [r4, 0x30] - strh r5, [r4, 0x32] - strh r5, [r4, 0x34] - strh r5, [r4, 0x36] - subs r0, 0x42 - bl BattleAnimAdjustPanning - lsls r0, 24 - asrs r0, 24 - strh r0, [r4, 0x38] - ldr r0, =sub_81021CC - str r0, [r4, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810217C - - thumb_func_start sub_81021CC -sub_81021CC: @ 81021CC - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x30 - ldrsh r1, [r4, r2] - cmp r0, r1 - blt _08102238 - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsrs r1, r2, 2 - movs r0, 0x1 - eors r1, r0 - ands r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r1, 0x4 - ands r0, r1 - cmp r0, 0 - bne _0810221E - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0810221E - ldrh r1, [r4, 0x38] - lsls r1, 24 - asrs r1, 24 - movs r0, 0xC2 - bl PlaySE12WithPanning -_0810221E: - movs r1, 0 - strh r1, [r4, 0x2E] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08102238 - strh r1, [r4, 0x32] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] -_08102238: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08102262 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x10 - ble _08102262 - adds r0, r4, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08102262 - adds r0, r4, 0 - bl DestroyAnimSprite -_08102262: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81021CC - - thumb_func_start sub_8102268 -sub_8102268: @ 8102268 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x2E - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081022B2 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r5, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r5] - adds r0, r1 - strh r0, [r6, 0x20] - ldrb r0, [r4] - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r5, [r5, 0x2] - adds r0, r5 - strh r0, [r6, 0x22] - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _081022AC - ldrh r0, [r6, 0x22] - adds r0, 0xA - strh r0, [r6, 0x22] -_081022AC: - ldrh r0, [r6, 0x2E] - adds r0, 0x1 - strh r0, [r6, 0x2E] -_081022B2: - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0xE] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _081022C2 - adds r0, r6, 0 - bl DestroyAnimSprite -_081022C2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102268 - - thumb_func_start sub_81022D4 -sub_81022D4: @ 81022D4 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _08102300 - ldr r1, =gBattleAnimArgs - ldr r0, =0x0000ffff - strh r0, [r1, 0xE] - b _0810233E - .pool -_08102300: - cmp r0, 0x2 - bne _0810230C - adds r0, r2, 0 - bl DestroyAnimVisualTask - b _08102344 -_0810230C: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - bne _08102344 - movs r0, 0 - strh r0, [r4, 0x8] - ldrh r2, [r4, 0xA] - adds r2, 0x1 - strh r2, [r4, 0xA] - lsls r1, r2, 8 - movs r0, 0x10 - subs r0, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _08102344 -_0810233E: - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] -_08102344: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81022D4 - - thumb_func_start sub_810234C -sub_810234C: @ 810234C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - bl sub_80A6980 - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x4] - strh r0, [r4, 0x2E] - ldr r0, =sub_810237C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810234C - - thumb_func_start sub_810237C -sub_810237C: @ 810237C - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r1, [r5, 0x2E] - movs r2, 0x2E - ldrsh r0, [r5, r2] - cmp r0, 0 - beq _08102390 - subs r0, r1, 0x1 - strh r0, [r5, 0x2E] - b _081023CC -_08102390: - adds r2, r5, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - movs r0, 0x1E - strh r0, [r5, 0x2E] - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x32] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x36] - ldr r0, =StartAnimLinearTranslation - str r0, [r5, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 -_081023CC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810237C - - thumb_func_start sub_81023E0 -sub_81023E0: @ 81023E0 - 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, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - bne _08102428 - movs r0, 0 - strh r0, [r4, 0x8] - ldrh r1, [r4, 0xA] - adds r1, 0x1 - strh r1, [r4, 0xA] - movs r0, 0x10 - subs r0, r1 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x10 - bne _08102428 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_08102428: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81023E0 - - thumb_func_start sub_8102434 -sub_8102434: @ 8102434 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - movs r4, 0 - ldr r0, =gBattlersCount - ldrb r0, [r0] - cmp r4, r0 - bcs _08102490 - ldr r6, =gBattleAnimArgs - ldr r5, =gHealthboxSpriteIds -_08102448: - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0x1 - bne _08102464 - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _08102464 - adds r0, r4, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible -_08102464: - movs r1, 0x2 - ldrsh r0, [r6, r1] - cmp r0, 0x1 - bne _08102482 - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08102482 - adds r0, r4, r5 - ldrb r0, [r0] - bl SetHealthboxSpriteInvisible -_08102482: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattlersCount - ldrb r0, [r0] - cmp r4, r0 - bcc _08102448 -_08102490: - adds r0, r7, 0 - bl DestroyAnimVisualTask - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102434 - - thumb_func_start sub_81024A8 -sub_81024A8: @ 81024A8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - b _081024C2 -_081024B2: - ldr r0, =gHealthboxSpriteIds - adds r0, r4, r0 - ldrb r0, [r0] - bl SetHealthboxSpriteVisible - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_081024C2: - ldr r0, =gBattlersCount - ldrb r0, [r0] - cmp r4, r0 - bcc _081024B2 - adds r0, r5, 0 - bl DestroyAnimVisualTask - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81024A8 - - thumb_func_start sub_81024E0 -sub_81024E0: @ 81024E0 - push {r4,lr} - adds r4, r0, 0 - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _081024F6 - movs r0, 0x30 - strh r0, [r4, 0x20] - movs r0, 0x28 - b _081024FE -_081024F6: - ldr r0, =gBattleAnimArgs - ldrh r1, [r0] - strh r1, [r4, 0x20] - ldrh r0, [r0, 0x2] -_081024FE: - strh r0, [r4, 0x22] - ldrb r1, [r4, 0x1] - movs r0, 0x3F - ands r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r4, 0x3] - movs r1, 0xC0 - orrs r0, r1 - strb r0, [r4, 0x3] - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, =sub_8102528 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81024E0 - - thumb_func_start sub_8102528 -sub_8102528: @ 8102528 - push {lr} - adds r1, r0, 0 - movs r2, 0x2E - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _0810253A - adds r0, r1, 0 - bl DestroyAnimSprite -_0810253A: - pop {r0} - bx r0 - thumb_func_end sub_8102528 - - thumb_func_start sub_8102540 -sub_8102540: @ 8102540 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r2, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r2] - adds r0, r1 - movs r1, 0 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x2] - strh r0, [r4, 0x22] - strh r1, [r4, 0x2E] - strh r1, [r4, 0x30] - strh r1, [r4, 0x32] - strh r1, [r4, 0x34] - movs r0, 0x1 - strh r0, [r4, 0x36] - ldr r0, =sub_8102584 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102540 - - thumb_func_start sub_8102584 -sub_8102584: @ 8102584 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - adds r0, 0x1 - strh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _081025AE - movs r0, 0 - strh r0, [r1, 0x30] - ldrh r2, [r1, 0x32] - movs r3, 0x32 - ldrsh r0, [r1, r3] - cmp r0, 0x77 - bgt _081025AE - ldrh r0, [r1, 0x22] - adds r0, 0x1 - strh r0, [r1, 0x22] - adds r0, r2, 0x1 - strh r0, [r1, 0x32] -_081025AE: - movs r2, 0x2E - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _081025BC - adds r0, r1, 0 - bl DestroyAnimSprite -_081025BC: - pop {r0} - bx r0 - thumb_func_end sub_8102584 - - thumb_func_start sub_81025C0 -sub_81025C0: @ 81025C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - movs r4, 0 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_80A75AC - mov r8, r0 - ldr r0, =0x0000ffff - mov r1, r8 - ands r1, r0 - mov r8, r1 - ldr r0, =gTasks - mov r9, r0 - lsls r5, r7, 2 - adds r5, r7 - lsls r5, 3 - adds r6, r5, r0 - strh r4, [r6, 0x8] - strh r4, [r6, 0xA] - strh r4, [r6, 0xC] - strh r1, [r6, 0xE] - strh r4, [r6, 0x10] - strh r4, [r6, 0x12] - strh r4, [r6, 0x14] - movs r0, 0xD - strh r0, [r6, 0x16] - movs r0, 0xE - strh r0, [r6, 0x18] - movs r0, 0xF - strh r0, [r6, 0x1A] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x1 - movs r3, 0x1 - bl sub_80A76C4 - mov r10, r0 - mov r1, r8 - orrs r1, r0 - mov r8, r1 - movs r0, 0x8 - add r9, r0 - add r5, r9 - adds r0, r5, 0 - adds r0, 0x1C - adds r5, 0x1E - adds r1, r5, 0 - mov r2, r8 - bl sub_80A8048 - ldr r0, =0x000027d2 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - movs r4, 0x80 - lsls r4, 9 - adds r1, r4, 0 - lsls r1, r0 - mov r0, r10 - orrs r0, r1 - mov r10, r0 - ldr r0, =0x000027d3 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0 - mov r1, r10 - orrs r4, r1 - ldr r0, =0x00007fbb - str r0, [sp] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =sub_81026A8 - str r1, [r6] - adds r0, r7, 0 - bl _call_via_r1 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81025C0 - - thumb_func_start sub_81026A8 -sub_81026A8: @ 81026A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r0, 0x8 - ldrsh r1, [r4, r0] - cmp r1, 0x1 - beq _08102794 - cmp r1, 0x1 - bgt _081026D4 - cmp r1, 0 - beq _081026E2 - b _08102832 - .pool -_081026D4: - cmp r1, 0x2 - bne _081026DA - b _081027EC -_081026DA: - cmp r1, 0x3 - bne _081026E0 - b _08102820 -_081026E0: - b _08102832 -_081026E2: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - cmp r0, 0 - bgt _081026F0 - b _08102832 -_081026F0: - strh r1, [r4, 0xA] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xF - bgt _0810273C - ldrh r0, [r4, 0x16] - ldrh r1, [r4, 0x10] - adds r0, r1 - strh r0, [r4, 0x10] - ldrh r2, [r4, 0x18] - ldrh r3, [r4, 0x12] - adds r2, r3 - strh r2, [r4, 0x12] - ldrh r1, [r4, 0x1A] - ldrh r5, [r4, 0x14] - adds r1, r5 - strh r1, [r4, 0x14] - lsls r0, 16 - asrs r0, 19 - lsls r0, 16 - lsrs r0, 16 - lsls r2, 16 - asrs r2, 19 - lsls r2, 16 - lsls r1, 16 - asrs r1, 19 - lsls r1, 16 - lsrs r2, 11 - orrs r0, r2 - lsrs r1, 6 - orrs r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r12, r0 - b _08102746 -_0810273C: - ldr r7, =0x00007fbb - mov r12, r7 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_08102746: - movs r2, 0x1 - movs r3, 0 - movs r1, 0 -_0810274C: - movs r5, 0xE - ldrsh r0, [r4, r5] - ands r0, r2 - lsls r5, r2, 17 - adds r6, r3, 0 - adds r6, 0x10 - adds r1, 0x1 - mov r8, r1 - cmp r0, 0 - beq _08102778 - movs r1, 0x1 - ldr r2, =gPlttBufferFaded -_08102764: - adds r0, r3, r1 - lsls r0, 1 - adds r0, r2 - mov r7, r12 - strh r7, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xF - bls _08102764 -_08102778: - lsrs r2, r5, 16 - lsls r0, r6, 16 - lsrs r3, r0, 16 - mov r1, r8 - lsls r0, r1, 16 - lsrs r1, r0, 16 - cmp r1, 0xF - bls _0810274C - b _08102832 - .pool -_08102794: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08102832 - movs r2, 0 - ldr r3, =gSprites - movs r5, 0x14 - adds r5, r3 - mov r12, r5 - ldr r7, =gUnknown_08592EBC - mov r8, r7 - ldr r6, =gBattleAnimSpriteTemplate_8592EEC - movs r5, 0x1 -_081027B2: - lsls r0, r2, 4 - adds r0, r2 - lsls r1, r0, 2 - mov r7, r12 - adds r0, r1, r7 - ldr r0, [r0] - cmp r0, r8 - beq _081027C6 - cmp r0, r6 - bne _081027CA -_081027C6: - adds r0, r1, r3 - strh r5, [r0, 0x2E] -_081027CA: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3F - bls _081027B2 - movs r0, 0 - strh r0, [r4, 0xA] - b _08102814 - .pool -_081027EC: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - ble _08102832 - movs r1, 0x24 - ldrsh r0, [r4, r1] - movs r2, 0x26 - ldrsh r1, [r4, r2] - bl sub_80A8050 - ldr r1, =0x00007fbb - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_08102814: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08102832 - .pool -_08102820: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08102832 - adds r0, r2, 0 - bl DestroyAnimVisualTask -_08102832: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81026A8 - - thumb_func_start sub_8102844 -sub_8102844: @ 8102844 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r6, =gBattleAnimArgs - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, 0x1 - bgt _08102856 - movs r0, 0x2 - strh r0, [r6, 0x4] -_08102856: - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, 0x7F - ble _08102862 - movs r0, 0x7F - strh r0, [r6, 0x4] -_08102862: - movs r0, 0 - strh r0, [r5, 0x2E] - ldrh r0, [r6, 0x4] - strh r0, [r5, 0x30] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r6] - adds r0, r1 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r6, [r6, 0x2] - adds r0, r6 - strh r0, [r5, 0x22] - ldrh r1, [r5, 0x20] - strh r1, [r5, 0x3A] - strh r0, [r5, 0x3C] - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _081028D4 - ldrb r1, [r5, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r5, 0x3] - ldrh r0, [r5, 0x20] - adds r0, 0x28 - strh r0, [r5, 0x20] - ldrh r4, [r5, 0x22] - adds r4, 0x14 - strh r4, [r5, 0x22] - lsls r0, 7 - strh r0, [r5, 0x32] - movs r0, 0x30 - ldrsh r1, [r5, r0] - ldr r0, =0xffffec00 - b _081028FA - .pool -_081028D4: - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810291C - ldrh r0, [r5, 0x20] - subs r0, 0x28 - strh r0, [r5, 0x20] - ldrh r4, [r5, 0x22] - adds r4, 0x14 - strh r4, [r5, 0x22] - lsls r0, 7 - strh r0, [r5, 0x32] - movs r0, 0x30 - ldrsh r1, [r5, r0] - movs r0, 0xA0 - lsls r0, 5 -_081028FA: - bl __divsi3 - strh r0, [r5, 0x34] - lsls r4, 7 - strh r4, [r5, 0x36] - movs r0, 0x30 - ldrsh r1, [r5, r0] - ldr r0, =0xfffff600 - bl __divsi3 - strh r0, [r5, 0x38] - b _08102958 - .pool -_0810291C: - ldrh r0, [r5, 0x20] - adds r0, 0x28 - strh r0, [r5, 0x20] - ldrh r4, [r5, 0x22] - subs r4, 0x14 - strh r4, [r5, 0x22] - lsls r0, 7 - strh r0, [r5, 0x32] - movs r0, 0x30 - ldrsh r1, [r5, r0] - ldr r0, =0xffffec00 - bl __divsi3 - strh r0, [r5, 0x34] - lsls r4, 7 - strh r4, [r5, 0x36] - movs r0, 0x30 - ldrsh r1, [r5, r0] - movs r0, 0xA0 - lsls r0, 4 - bl __divsi3 - strh r0, [r5, 0x38] - ldrb r1, [r5, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x30 - orrs r0, r1 - strb r0, [r5, 0x3] -_08102958: - ldr r0, =sub_810296C - str r0, [r5, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102844 - - thumb_func_start sub_810296C -sub_810296C: @ 810296C - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x34] - ldrh r1, [r2, 0x32] - adds r0, r1 - strh r0, [r2, 0x32] - ldrh r1, [r2, 0x38] - ldrh r3, [r2, 0x36] - adds r1, r3 - strh r1, [r2, 0x36] - lsls r0, 16 - asrs r0, 23 - strh r0, [r2, 0x20] - lsls r1, 16 - asrs r1, 23 - strh r1, [r2, 0x22] - ldrh r0, [r2, 0x30] - subs r0, 0x1 - strh r0, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _081029A2 - ldrh r0, [r2, 0x3A] - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x3C] - strh r0, [r2, 0x22] -_081029A2: - movs r1, 0x30 - ldrsh r0, [r2, r1] - cmp r0, 0 - bne _081029B0 - adds r0, r2, 0 - bl DestroyAnimSprite -_081029B0: - pop {r0} - bx r0 - thumb_func_end sub_810296C - - thumb_func_start sub_81029B4 -sub_81029B4: @ 81029B4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r0, 2 - add r0, r8 - lsls r0, 3 - ldr r1, =gTasks - adds r6, r0, r1 - movs r0, 0 - bl GetAnimBattlerSpriteId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x8] - ldr r0, =0x00002771 - bl AllocSpritePalette - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0xA] - movs r1, 0xA - ldrsh r0, [r6, r1] - lsls r0, 20 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r3, r0, 16 - ldr r2, =gSprites - movs r0, 0x8 - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - adds r0, 0x10 - lsls r4, r0, 4 - movs r5, 0x1 - ldr r2, =gPlttBufferUnfaded -_08102A0C: - adds r1, r3, r5 - lsls r1, 1 - adds r1, r2 - adds r0, r4, r5 - lsls r0, 1 - adds r0, r2 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0xF - bls _08102A0C - adds r0, r3, 0 - movs r1, 0x10 - movs r2, 0xB - movs r3, 0 - bl BlendPalette - movs r0, 0 - strh r0, [r6, 0xE] - movs r5, 0 - ldr r7, =gSprites - movs r1, 0x1C - adds r1, r7 - mov r9, r1 - b _08102A88 - .pool -_08102A54: - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r4, r2, r7 - ldrb r1, [r6, 0xA] - lsls r1, 4 - ldrb r3, [r4, 0x5] - movs r0, 0xF - ands r0, r3 - orrs r0, r1 - strb r0, [r4, 0x5] - movs r0, 0 - strh r0, [r4, 0x2E] - lsls r0, r5, 7 - strh r0, [r4, 0x30] - mov r0, r8 - strh r0, [r4, 0x32] - add r2, r9 - ldr r0, =sub_8102B3C - str r0, [r2] - ldrh r0, [r6, 0xE] - adds r0, 0x1 - strh r0, [r6, 0xE] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_08102A88: - cmp r5, 0x1 - bhi _08102A9A - movs r0, 0 - bl duplicate_obj_of_side_rel2move_in_transparent_mode - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08102A54 -_08102A9A: - ldr r0, =sub_8102AE0 - str r0, [r6] - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl sub_80A8364 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08102AC8 - movs r1, 0x80 - lsls r1, 2 - movs r0, 0 - bl ClearGpuRegBits - b _08102AD2 - .pool -_08102AC8: - movs r1, 0x80 - lsls r1, 3 - movs r0, 0 - bl ClearGpuRegBits -_08102AD2: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81029B4 - - thumb_func_start sub_8102AE0 -sub_8102AE0: @ 8102AE0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r0, r1 - movs r1, 0xE - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08102B32 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl sub_80A8364 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08102B1C - movs r1, 0x80 - lsls r1, 2 - movs r0, 0 - bl SetGpuRegBits - b _08102B26 - .pool -_08102B1C: - movs r1, 0x80 - lsls r1, 3 - movs r0, 0 - bl SetGpuRegBits -_08102B26: - ldr r0, =0x00002771 - bl FreeSpritePaletteByTag - adds r0, r4, 0 - bl DestroyAnimVisualTask -_08102B32: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102AE0 - - thumb_func_start sub_8102B3C -sub_8102B3C: @ 8102B3C - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _08102B58 - movs r0, 0 - strh r0, [r5, 0x34] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] -_08102B58: - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0x40 - ble _08102B80 - ldr r2, =gTasks - movs r0, 0x32 - ldrsh r1, [r5, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrh r1, [r0, 0xE] - subs r1, 0x1 - strh r1, [r0, 0xE] - adds r0, r5, 0 - bl obj_delete_but_dont_free_vram - b _08102BC2 - .pool -_08102B80: - ldr r4, =gSineTable - movs r1, 0x2E - ldrsh r0, [r5, r1] - lsls r0, 1 - adds r0, r4 - movs r2, 0 - ldrsh r0, [r0, r2] - movs r1, 0x6 - bl __divsi3 - strh r0, [r5, 0x36] - movs r1, 0x2E - ldrsh r0, [r5, r1] - lsls r0, 1 - adds r0, r4 - movs r2, 0 - ldrsh r0, [r0, r2] - movs r1, 0xD - bl __divsi3 - strh r0, [r5, 0x38] - ldrh r1, [r5, 0x30] - adds r1, r0 - movs r0, 0xFF - ands r1, r0 - strh r1, [r5, 0x30] - movs r1, 0x30 - ldrsh r0, [r5, r1] - movs r2, 0x36 - ldrsh r1, [r5, r2] - bl Sin - strh r0, [r5, 0x24] -_08102BC2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102B3C - - thumb_func_start sub_8102BCC -sub_8102BCC: @ 8102BCC - push {r4,lr} - adds r4, r0, 0 - ldr r1, =DestroyAnimSprite - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67D8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102BCC - - thumb_func_start sub_8102BE8 -sub_8102BE8: @ 8102BE8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r4, =gUnknown_08593020 - ldrh r0, [r4] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xFF - beq _08102C2C - lsls r0, r3, 20 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r3, r0, 16 - movs r2, 0x1 - ldr r5, =gPlttBufferFaded -_08102C14: - adds r1, r3, r2 - lsls r1, 1 - adds r1, r5 - lsls r0, r2, 1 - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x5 - bls _08102C14 -_08102C2C: - movs r4, 0x1 - ldr r0, =gUnknown_08593020 - mov r8, r0 -_08102C32: - lsls r0, r4, 1 - adds r0, r4 - lsls r5, r0, 2 - mov r1, r8 - adds r0, r5, r1 - ldrh r0, [r0] - bl AllocSpritePalette - lsls r0, 24 - lsrs r3, r0, 24 - adds r4, 0x1 - mov r12, r4 - cmp r3, 0xFF - beq _08102C7A - lsls r0, r3, 20 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r3, r0, 16 - movs r2, 0x1 - ldr r7, =gPlttBufferFaded - ldr r6, =gUnknown_08593020 - adds r4, r5, 0 -_08102C60: - adds r1, r3, r2 - lsls r1, 1 - adds r1, r7 - lsls r0, r2, 1 - adds r0, r4 - adds r0, r6 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x5 - bls _08102C60 -_08102C7A: - mov r1, r12 - lsls r0, r1, 16 - lsrs r4, r0, 16 - cmp r4, 0x3 - bls _08102C32 - mov r0, r9 - bl DestroyAnimVisualTask - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102BE8 - - thumb_func_start sub_8102CA0 -sub_8102CA0: @ 8102CA0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0x1 - ldr r6, =gUnknown_08593020 -_08102CAA: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r6 - ldrh r0, [r0] - bl FreeSpritePaletteByTag - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x3 - bls _08102CAA - adds r0, r5, 0 - bl DestroyAnimVisualTask - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102CA0 - - thumb_func_start sub_8102CD4 -sub_8102CD4: @ 8102CD4 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - bl sub_80A6838 - ldr r4, =gBattleAnimArgs - ldrb r1, [r4] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r2, =gUnknown_08593020 - movs r0, 0x2 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08102D10 - lsls r2, r0, 4 - ldrb r1, [r5, 0x5] - movs r0, 0xF - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0x5] -_08102D10: - ldrh r0, [r4, 0x2] - movs r1, 0 - strh r0, [r5, 0x30] - strh r1, [r5, 0x32] - ldrh r0, [r4, 0x4] - strh r0, [r5, 0x34] - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _08102D34 - movs r6, 0x30 - movs r3, 0x28 - b _08102D4E - .pool -_08102D34: - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r3, r0, 24 -_08102D4E: - ldrh r0, [r5, 0x20] - lsls r1, r0, 4 - strh r1, [r5, 0x36] - ldrh r1, [r5, 0x22] - lsls r2, r1, 4 - strh r2, [r5, 0x38] - subs r0, r6, r0 - lsls r0, 16 - asrs r0, 16 - subs r1, r3, r1 - lsls r1, 16 - asrs r1, 16 - adds r2, r5, 0 - adds r2, 0x3A - adds r3, r5, 0 - adds r3, 0x3C - movs r4, 0x28 - str r4, [sp] - bl sub_8102D8C - ldr r0, =sub_8102DE4 - str r0, [r5, 0x1C] - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102CD4 - - thumb_func_start sub_8102D8C -sub_8102D8C: @ 8102D8C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r2, 0 - mov r8, r3 - ldr r2, [sp, 0x18] - lsls r1, 16 - lsrs r6, r1, 16 - lsls r2, 24 - lsrs r1, r2, 24 - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0 - bge _08102DAE - lsls r0, r1, 24 - negs r0, r0 - lsrs r1, r0, 24 -_08102DAE: - lsls r5, r2, 8 - lsls r1, 24 - asrs r1, 24 - adds r0, r5, 0 - bl __divsi3 - adds r4, r0, 0 - cmp r4, 0 - bne _08102DC2 - movs r4, 0x1 -_08102DC2: - adds r0, r5, 0 - adds r1, r4, 0 - bl __divsi3 - strh r0, [r7] - lsls r0, r6, 16 - asrs r0, 8 - adds r1, r4, 0 - bl __divsi3 - mov r1, r8 - strh r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8102D8C - - thumb_func_start sub_8102DE4 -sub_8102DE4: @ 8102DE4 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - movs r5, 0 - strh r0, [r4, 0x2E] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r1, r0, r1 - adds r0, r1, 0 - cmp r1, 0 - bge _08102E00 - adds r0, 0xFF -_08102E00: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - ldrh r1, [r4, 0x3A] - ldrh r2, [r4, 0x36] - adds r1, r2 - strh r1, [r4, 0x36] - ldrh r2, [r4, 0x3C] - ldrh r3, [r4, 0x38] - adds r2, r3 - strh r2, [r4, 0x38] - lsls r1, 16 - asrs r1, 20 - strh r1, [r4, 0x20] - lsls r2, 16 - asrs r2, 20 - strh r2, [r4, 0x22] - lsls r0, 16 - asrs r0, 16 - movs r1, 0xF - bl Sin - strh r0, [r4, 0x26] - ldrh r2, [r4, 0x22] - ldrh r0, [r4, 0x20] - adds r0, 0x10 - lsls r0, 16 - movs r1, 0x88 - lsls r1, 17 - cmp r0, r1 - bhi _08102E4E - lsls r0, r2, 16 - asrs r1, r0, 16 - movs r0, 0x10 - negs r0, r0 - cmp r1, r0 - blt _08102E4E - cmp r1, 0x80 - ble _08102E56 -_08102E4E: - adds r0, r4, 0 - bl move_anim_8074EE0 - b _08102EA6 -_08102E56: - movs r0, 0x34 - ldrsh r1, [r4, r0] - cmp r1, 0 - beq _08102EA6 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, r1 - ble _08102EA6 - strh r5, [r4, 0x32] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _08102E7E - strh r5, [r4, 0x30] -_08102E7E: - ldr r2, =gUnknown_08593020 - movs r3, 0x30 - ldrsh r1, [r4, r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08102EA6 - lsls r2, r0, 4 - ldrb r1, [r4, 0x5] - movs r0, 0xF - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] -_08102EA6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102DE4 - - thumb_func_start sub_8102EB0 -sub_8102EB0: @ 8102EB0 - push {r4-r7,lr} - adds r6, r0, 0 - ldr r7, =gBattleAnimAttacker - ldrb r0, [r7] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08102ECE - ldr r1, =gBattleAnimArgs - movs r2, 0x2 - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1, 0x2] -_08102ECE: - ldrb r0, [r7] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r4, 0x2] - adds r0, r1 - movs r5, 0 - strh r0, [r6, 0x20] - ldrb r0, [r7] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r2, [r4, 0x4] - adds r0, r2 - strh r0, [r6, 0x22] - ldrb r1, [r4] - adds r0, r6, 0 - bl StartSpriteAnim - strh r5, [r6, 0x32] - strh r5, [r6, 0x34] - ldrh r0, [r6, 0x20] - lsls r0, 4 - strh r0, [r6, 0x36] - ldrh r0, [r6, 0x22] - lsls r0, 4 - strh r0, [r6, 0x38] - movs r1, 0x2 - ldrsh r0, [r4, r1] - lsls r0, 4 - movs r1, 0x5 - bl __divsi3 - strh r0, [r6, 0x3A] - movs r2, 0x4 - ldrsh r0, [r4, r2] - lsls r0, 7 - movs r1, 0x5 - bl __divsi3 - strh r0, [r6, 0x3C] - ldr r0, =sub_8102F40 - str r0, [r6, 0x1C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102EB0 - - thumb_func_start sub_8102F40 -sub_8102F40: @ 8102F40 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x36] - adds r0, r1 - strh r0, [r4, 0x36] - ldrh r1, [r4, 0x3C] - ldrh r2, [r4, 0x38] - adds r1, r2 - strh r1, [r4, 0x38] - lsls r0, 16 - asrs r0, 20 - strh r0, [r4, 0x20] - lsls r1, 16 - asrs r1, 20 - strh r1, [r4, 0x22] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x5 - ble _08102F9E - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08102F9E - ldrh r0, [r4, 0x32] - adds r0, 0x10 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x32] - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x12 - bl Cos - strh r0, [r4, 0x24] - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0x12 - bl Sin - strh r0, [r4, 0x26] - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08102F9E - movs r0, 0x1 - strh r0, [r4, 0x34] -_08102F9E: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x30 - bne _08102FB2 - adds r0, r4, 0 - bl move_anim_8074EE0 -_08102FB2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8102F40 - - thumb_func_start sub_8102FB8 -sub_8102FB8: @ 8102FB8 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - bne _08102FDC - ldrb r0, [r5, 0x3] - movs r1, 0x3F - negs r1, r1 - ands r1, r0 - movs r0, 0x10 - orrs r1, r0 - strb r1, [r5, 0x3] - movs r6, 0x10 - b _08102FDE - .pool -_08102FDC: - ldr r6, =0x0000fff0 -_08102FDE: - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, r6 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x8 - strh r0, [r5, 0x22] - movs r0, 0x8 - strh r0, [r5, 0x2E] - ldr r0, =WaitAnimForDuration - str r0, [r5, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8102FB8 - - thumb_func_start sub_8103028 -sub_8103028: @ 8103028 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_80A6838 - ldrh r0, [r4, 0x22] - adds r0, 0x8 - strh r0, [r4, 0x22] - ldr r5, =gBattleAnimArgs - ldrb r1, [r5, 0x2] - adds r0, r4, 0 - bl StartSpriteAnim - ldr r2, =gUnknown_08593020 - movs r0, 0x4 - ldrsh r1, [r5, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08103068 - lsls r2, r0, 4 - ldrb r1, [r4, 0x5] - movs r0, 0xF - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] -_08103068: - movs r1, 0 - ldrsh r0, [r5, r1] - movs r2, 0x20 - cmp r0, 0 - bne _08103074 - ldr r2, =0x0000ffe0 -_08103074: - movs r0, 0x28 - strh r0, [r4, 0x2E] - ldrh r1, [r4, 0x20] - strh r1, [r4, 0x30] - lsls r0, r2, 16 - asrs r0, 16 - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x22] - strh r0, [r4, 0x34] - subs r0, 0x28 - strh r0, [r4, 0x36] - adds r0, r4, 0 - bl InitAnimLinearTranslation - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x38] - ldr r0, =sub_81030B0 - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103028 - - thumb_func_start sub_81030B0 -sub_81030B0: @ 81030B0 - push {r4,lr} - adds r4, r0, 0 - bl TranslateAnimLinear - lsls r0, 24 - cmp r0, 0 - bne _08103100 - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - lsls r0, 16 - lsrs r1, r0, 16 - ldrh r2, [r4, 0x24] - movs r3, 0x24 - ldrsh r0, [r4, r3] - cmp r0, 0 - bge _081030DC - lsls r0, r1, 16 - negs r0, r0 - lsrs r1, r0, 16 -_081030DC: - lsls r0, r1, 16 - asrs r0, 16 - adds r0, r2 - strh r0, [r4, 0x24] - movs r1, 0x38 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Sin - ldrh r3, [r4, 0x26] - adds r0, r3 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x38] - adds r0, 0x8 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x38] - b _08103106 -_08103100: - adds r0, r4, 0 - bl DestroyAnimSprite -_08103106: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81030B0 - - thumb_func_start sub_810310C -sub_810310C: @ 810310C - push {r4-r6,lr} - adds r6, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810312C - adds r0, r5, 0 - movs r1, 0x5 - bl sub_80A861C - adds r0, 0x8 - b _08103136 -_0810312C: - adds r0, r5, 0 - movs r1, 0x4 - bl sub_80A861C - subs r0, 0x8 -_08103136: - strh r0, [r6, 0x20] - adds r0, r5, 0 - movs r1, 0x3 - bl GetBattlerSpriteCoord - adds r4, r0, 0 - adds r0, r5, 0 - movs r1, 0 - bl sub_80A861C - lsls r4, 24 - lsrs r4, 24 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08103158 - adds r0, 0x3 -_08103158: - asrs r0, 2 - subs r0, r4, r0 - strh r0, [r6, 0x22] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_810310C - - thumb_func_start sub_8103164 -sub_8103164: @ 8103164 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08103180 - ldr r0, =gBattleAnimAttacker - b _08103182 - .pool -_08103180: - ldr r0, =gBattleAnimTarget -_08103182: - ldrb r4, [r0] - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_810310C - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - negs r1, r0 - orrs r1, r0 - lsrs r1, 31 - ldr r0, =gBattleAnimArgs - ldrh r0, [r0, 0x2] - strh r0, [r5, 0x2E] - adds r0, r1, 0x2 - strh r0, [r5, 0x30] - adds r0, r5, 0 - bl StartSpriteAnim - ldr r1, =sub_81031D0 - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67D8 - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103164 - - thumb_func_start sub_81031D0 -sub_81031D0: @ 81031D0 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - subs r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bne _081031F8 - ldr r1, =DestroyAnimSprite - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - ldr r0, =sub_80A67D8 - str r0, [r4, 0x1C] -_081031F8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81031D0 - - thumb_func_start sub_8103208 -sub_8103208: @ 8103208 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08103224 - ldr r0, =gBattleAnimAttacker - b _08103226 - .pool -_08103224: - ldr r0, =gBattleAnimTarget -_08103226: - ldrb r0, [r0] - adds r1, r4, 0 - bl sub_810310C - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r1, =sub_8103250 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67BC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103208 - - thumb_func_start sub_8103250 -sub_8103250: @ 8103250 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _08103276 - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - ldr r1, =move_anim_8074EE0 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67BC - str r0, [r4, 0x1C] -_08103276: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103250 - - thumb_func_start sub_8103284 -sub_8103284: @ 8103284 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _081032A0 - ldr r0, =gBattleAnimAttacker - b _081032A2 - .pool -_081032A0: - ldr r0, =gBattleAnimTarget -_081032A2: - ldrb r5, [r0] - adds r0, r5, 0 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - movs r6, 0 - strh r0, [r4, 0x20] - adds r0, r5, 0 - movs r1, 0x2 - bl sub_80A861C - strh r0, [r4, 0x22] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x9 - bgt _081032CA - movs r0, 0xA - strh r0, [r4, 0x22] -_081032CA: - movs r0, 0x1 - strh r0, [r4, 0x2E] - strh r6, [r4, 0x30] - adds r1, r4, 0 - adds r1, 0x43 - ldrb r0, [r1] - strh r0, [r4, 0x32] - ldrb r0, [r1] - adds r0, 0x4 - strh r0, [r4, 0x34] - strh r6, [r4, 0x36] - ldr r1, =sub_8103300 - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67BC - str r0, [r4, 0x1C] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103284 - - thumb_func_start sub_8103300 -sub_8103300: @ 8103300 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x36] - adds r0, 0x1 - strh r0, [r1, 0x36] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xC - ble _08103316 - ldr r0, =sub_8103320 - str r0, [r1, 0x1C] -_08103316: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103300 - - thumb_func_start sub_8103320 -sub_8103320: @ 8103320 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x30] - adds r1, r0, 0x4 - strh r1, [r2, 0x30] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xFE - ble _08103352 - ldrh r0, [r2, 0x2E] - subs r0, 0x1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _0810334C - strh r0, [r2, 0x24] - ldr r0, =sub_8103250 - str r0, [r2, 0x1C] - b _08103388 - .pool -_0810334C: - movs r0, 0xFF - ands r1, r0 - strh r1, [r2, 0x30] -_08103352: - movs r1, 0x30 - ldrsh r0, [r2, r1] - cmp r0, 0x4F - ble _08103362 - ldrh r0, [r2, 0x34] - adds r1, r2, 0 - adds r1, 0x43 - strb r0, [r1] -_08103362: - movs r3, 0x30 - ldrsh r0, [r2, r3] - cmp r0, 0x9F - ble _08103372 - ldrh r0, [r2, 0x32] - adds r1, r2, 0 - adds r1, 0x43 - strb r0, [r1] -_08103372: - ldr r1, =gSineTable - movs r3, 0x30 - ldrsh r0, [r2, r3] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 16 - asrs r0, 19 - asrs r1, r0, 1 - adds r0, r1 - strh r0, [r2, 0x24] -_08103388: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103320 - - thumb_func_start sub_8103390 -sub_8103390: @ 8103390 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimArgs - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _081033AC - ldr r0, =gBattleAnimAttacker - b _081033AE - .pool -_081033AC: - ldr r0, =gBattleAnimTarget -_081033AE: - ldrb r4, [r0] - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_810310C - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _081033D4 - adds r0, r5, 0 - movs r1, 0 - bl StartSpriteAnim - movs r0, 0x2 - b _081033DE - .pool -_081033D4: - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim - movs r0, 0x3 -_081033DE: - strh r0, [r5, 0x2E] - ldr r0, =sub_81033F0 - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8103390 - - thumb_func_start sub_81033F0 -sub_81033F0: @ 81033F0 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - ble _0810341E - movs r0, 0 - strh r0, [r4, 0x30] - ldrh r1, [r4, 0x2E] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - ldr r1, =sub_810342C - adds r0, r4, 0 - bl StoreSpriteCallbackInData6 - ldr r0, =sub_80A67D8 - str r0, [r4, 0x1C] -_0810341E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81033F0 - - thumb_func_start sub_810342C -sub_810342C: @ 810342C - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - adds r0, 0x1 - strh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _08103444 - adds r0, r1, 0 - bl DestroyAnimSprite -_08103444: - pop {r0} - bx r0 - thumb_func_end sub_810342C - - .align 2, 0 diff --git a/include/battle_anim.h b/include/battle_anim.h index fffdabe06..e0c1b2b08 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -132,6 +132,12 @@ u8 sub_80A80C8(struct Task *task); void sub_80A8EE4(struct Sprite *); void sub_80A67F4(struct Sprite *); void sub_80A6D48(u32 bgId, const void *src); +void sub_80A7160(struct Sprite *sprite); +bool8 sub_80A70E8(struct Sprite *sprite); +void sub_80A70C0(struct Sprite *sprite); +void TranslateMonBGUntil(struct Sprite *sprite); +void TranslateSpriteOverDuration(struct Sprite *sprite); +void sub_80A77C8(struct Sprite *sprite); enum { diff --git a/include/battle_interface.h b/include/battle_interface.h index 66a7f9828..3145939d0 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -1,6 +1,8 @@ #ifndef GUARD_BATTLE_INTERFACE_H #define GUARD_BATTLE_INTERFACE_H +#include "battle_controllers.h" + enum { HP_CURRENT, diff --git a/ld_script.txt b/ld_script.txt index 68aa8463c..2f1f1369a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -157,7 +157,7 @@ SECTIONS { src/safari_zone.o(.text); asm/contest_link_80FC4F4.o(.text); src/item_use.o(.text); - asm/battle_anim_effects_1.o(.text); + src/battle_anim_effects_1.o(.text); asm/battle_anim_effects_2.o(.text); asm/water.o(.text); src/fire.o(.text); @@ -483,7 +483,7 @@ SECTIONS { src/field_special_scene.o(.rodata); src/rotating_gate.o(.rodata); src/item_use.o(.rodata); - src/effects_1.o(.rodata); + src/battle_anim_effects_1.o(.rodata); src/effects_2.o(.rodata); src/water.o(.rodata); src/fire.o(.rodata); diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c index 8ba1a8222..9adbdd779 100644 --- a/src/battle_anim_80A5C6C.c +++ b/src/battle_anim_80A5C6C.c @@ -35,7 +35,6 @@ extern const union AffineAnimCmd *gUnknown_082FF6C0[]; // This file's functions. void sub_80A64EC(struct Sprite *sprite); -void sub_80A653C(struct Sprite *sprite); void sub_80A6FB4(struct Sprite *sprite); void sub_80A7144(struct Sprite *sprite); void sub_80A791C(struct Sprite *sprite); @@ -539,7 +538,7 @@ void WaitAnimForDuration(struct Sprite *sprite) void sub_80A64D0(struct Sprite *sprite) { sub_80A64EC(sprite); - sprite->callback = sub_80A653C; + sprite->callback = TranslateSpriteOverDuration; sprite->callback(sprite); } @@ -557,7 +556,7 @@ void sub_80A64EC(struct Sprite *sprite) sprite->data[1] = old; } -void sub_80A653C(struct Sprite *sprite) +void TranslateSpriteOverDuration(struct Sprite *sprite) { if (sprite->data[0] > 0) { @@ -613,7 +612,7 @@ void sub_80A65EC(struct Sprite *sprite) sprite->callback = sub_80A64D0; } -void sub_80A6630(struct Sprite *sprite) +void TranslateMonBGUntil(struct Sprite *sprite) { if (sprite->data[0] > 0) { @@ -627,7 +626,7 @@ void sub_80A6630(struct Sprite *sprite) } } -// Same as sub_80A6630, but it operates on sub-pixel values +// Same as TranslateMonBGUntil, but it operates on sub-pixel values // to handle slower translations. void sub_80A6680(struct Sprite *sprite) { diff --git a/src/battle_anim_80D51AC.c b/src/battle_anim_80D51AC.c index bfd0635f6..51be7bbe9 100644 --- a/src/battle_anim_80D51AC.c +++ b/src/battle_anim_80D51AC.c @@ -441,14 +441,14 @@ static void DoHorizontalLunge(struct Sprite *sprite) sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker]; sprite->data[4] = gBattleAnimArgs[0]; StoreSpriteCallbackInData6(sprite, ReverseHorizontalLungeDirection); - sprite->callback = sub_80A6630; + sprite->callback = TranslateMonBGUntil; } static void ReverseHorizontalLungeDirection(struct Sprite *sprite) { sprite->data[0] = sprite->data[4]; sprite->data[1] = -sprite->data[1]; - sprite->callback = sub_80A6630; + sprite->callback = TranslateMonBGUntil; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } @@ -468,14 +468,14 @@ static void DoVerticalDip(struct Sprite *sprite) sprite->data[3] = spriteId; sprite->data[4] = gBattleAnimArgs[0]; StoreSpriteCallbackInData6(sprite, ReverseVerticalDipDirection); - sprite->callback = sub_80A6630; + sprite->callback = TranslateMonBGUntil; } static void ReverseVerticalDipDirection(struct Sprite *sprite) { sprite->data[0] = sprite->data[4]; sprite->data[2] = -sprite->data[2]; - sprite->callback = sub_80A6630; + sprite->callback = TranslateMonBGUntil; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c new file mode 100644 index 000000000..0f56c05d8 --- /dev/null +++ b/src/battle_anim_effects_1.c @@ -0,0 +1,5520 @@ +#include "global.h" +#include "battle_anim.h" +#include "battle_interface.h" +#include "gpu_regs.h" +#include "palette.h" +#include "random.h" +#include "sound.h" +#include "trig.h" +#include "util.h" +#include "constants/rgb.h" +#include "constants/songs.h" + +EWRAM_DATA s16 gUnknown_0203A0F8[4] = {0}; + +void AnimMovePowderParticle(struct Sprite *); +void sub_80FE8E0(struct Sprite *); +void sub_80FE930(struct Sprite *); +void sub_80FE988(struct Sprite *); +void sub_80FEAD8(struct Sprite *); +void sub_80FEB44(struct Sprite *); +void sub_80FED28(struct Sprite *); +void sub_80FEE78(struct Sprite *); +void sub_80FEF44(struct Sprite *); +void sub_80FEFFC(struct Sprite *); +void AnimLeechSeed(struct Sprite *); +void AnimTranslateLinearSingleSineWave(struct Sprite *); +void AnimMoveTwisterParticle(struct Sprite *); +void sub_80FF374(struct Sprite *); +void sub_80FF698(struct Sprite *); +void sub_80FF768(struct Sprite *); +void sub_80FF7EC(struct Sprite *); +void sub_80FF934(struct Sprite *); +void sub_80FFB18(struct Sprite *); +void sub_80FFBF4(struct Sprite *); +void sub_80FFC70(struct Sprite *); +void sub_80FFCB4(struct Sprite *); +void sub_80FFDBC(struct Sprite *); +void sub_8100640(struct Sprite *); +void sub_8100898(struct Sprite *); +void sub_81009F8(struct Sprite *); +void sub_8100A50(struct Sprite *); +void sub_8100A94(struct Sprite *); +void AnimCuttingSlice(struct Sprite *); +void sub_8100B88(struct Sprite *); +void sub_8100E1C(struct Sprite *); +void sub_8100EF0(struct Sprite *); +void sub_81010CC(struct Sprite *); +void sub_810130C(struct Sprite *); +void sub_810135C(struct Sprite *); +void sub_8101440(struct Sprite *); +void sub_81014F4(struct Sprite *); +void sub_81015AC(struct Sprite *); +void sub_8101898(struct Sprite *); +void sub_8101940(struct Sprite *); +void sub_8101B90(struct Sprite *); +void sub_8101F40(struct Sprite *); +void sub_8101FA8(struct Sprite *); +void sub_8101FF0(struct Sprite *); +void sub_81020D8(struct Sprite *); +void sub_810217C(struct Sprite *); +void sub_8102268(struct Sprite *); +void sub_810234C(struct Sprite *); +void sub_81024E0(struct Sprite *); +void sub_8102540(struct Sprite *); +void sub_8102844(struct Sprite *); +void sub_8102BCC(struct Sprite *); +void sub_8102CD4(struct Sprite *); +void sub_8102EB0(struct Sprite *); +void sub_8102FB8(struct Sprite *); +void sub_8103028(struct Sprite *); +void sub_8103164(struct Sprite *); +void sub_8103208(struct Sprite *); +void sub_8103284(struct Sprite *); +void sub_8103390(struct Sprite *); +static void AnimMovePowderParticleStep(struct Sprite *); +static void sub_80FE9E4(struct Sprite *); +static void sub_80FEB28(struct Sprite *); +static void sub_80FEBFC(struct Sprite *); +static void AnimLeechSeedStep(struct Sprite *); +static void AnimLeechSeedSprouts(struct Sprite *); +static void sub_80FED74(struct Sprite *); +static void sub_80FEECC(struct Sprite *); +static void sub_80FEF98(struct Sprite *); +static void sub_80FF044(struct Sprite *); +static void sub_80FF090(struct Sprite *); +static void AnimTranslateLinearSingleSineWaveStep(struct Sprite *); +static void AnimMoveTwisterParticleStep(struct Sprite *); +static void sub_80FF3B0(struct Sprite *); +static void sub_80FF3EC(struct Sprite *); +static void sub_80FF53C(u8); +static void sub_80FF5CC(u8); +static void sub_80FFD2C(struct Sprite *); +static void sub_80FF8DC(struct Sprite *); +static void sub_80FFE58(struct Sprite *); +static void sub_80FFEC4(struct Sprite *); +static void sub_80FFF7C(struct Sprite *); +static void sub_8100128(u8); +static s16 sub_8100504(struct Sprite *); +static void sub_8100524(struct Task *, u8); +static void sub_80CC408(struct Sprite *); +static void sub_810074C(struct Sprite *); +static void sub_81009A0(struct Sprite *); +static void AnimSliceStep(struct Sprite *); +static void sub_8100E80(struct Sprite *); +static void sub_8100FD4(struct Sprite *); +static void sub_8101138(struct Sprite *); +static void sub_8101298(struct Sprite *, int, int); +static void sub_81014A0(struct Sprite *); +static void sub_8101560(struct Sprite *); +static void sub_81015D4(struct Sprite *); +static void sub_8101684(struct Sprite *); +static void sub_81016B8(struct Sprite *); +static void sub_8101774(struct Sprite *); +static void sub_8101820(struct Sprite *); +static void sub_8101848(struct Sprite *); +static void sub_8101998(struct Sprite *); +static void sub_81019E8(struct Sprite *); +static void sub_8101A74(struct Sprite *); +static void sub_8101AC4(struct Sprite *); +static void sub_8101B84(struct Sprite *); +static void sub_8101AE8(struct Sprite *); +static void sub_8101BA0(struct Sprite *); +static void sub_8101D2C(u8); +static void sub_8101EEC(u8); +static void sub_8102044(struct Sprite *); +static void sub_810207C(struct Sprite *); +static void sub_810208C(struct Sprite *); +static void sub_810213C(struct Sprite *); +static void sub_81021CC(struct Sprite *); +static void sub_810237C(struct Sprite *); +static void sub_8102528(struct Sprite *); +static void sub_8102584(struct Sprite *); +static void sub_810296C(struct Sprite *); +static void sub_8102AE0(u8); +static void sub_8102B3C(struct Sprite *); +static void sub_8102D8C(s16, s16, s16 *, s16 *, s8); +static void sub_8102DE4(struct Sprite *); +static void sub_8102F40(struct Sprite *); +static void sub_81030B0(struct Sprite *); +static void sub_81031D0(struct Sprite *); +static void sub_8103250(struct Sprite *); +static void sub_8103300(struct Sprite *); +static void sub_8103320(struct Sprite *); +static void sub_81033F0(struct Sprite *); +static void sub_810342C(struct Sprite *); + +const union AnimCmd gUnknown_085920F0[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(2, 5), + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(6, 5), + ANIMCMD_FRAME(8, 5), + ANIMCMD_FRAME(10, 5), + ANIMCMD_FRAME(12, 5), + ANIMCMD_FRAME(14, 5), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gUnknown_08592114[] = +{ + gUnknown_085920F0, +}; + +const struct SpriteTemplate gSleepPowderParticleSpriteTemplate = +{ + .tileTag = ANIM_TAG_SLEEP_POWDER, + .paletteTag = ANIM_TAG_SLEEP_POWDER, + .oam = &gUnknown_08524944, + .anims = gUnknown_08592114, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMovePowderParticle, +}; + +const struct SpriteTemplate gStunSporeParticleSpriteTemplate = +{ + .tileTag = ANIM_TAG_STUN_SPORE, + .paletteTag = ANIM_TAG_STUN_SPORE, + .oam = &gUnknown_08524944, + .anims = gUnknown_08592114, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMovePowderParticle, +}; + +const struct SpriteTemplate gPoisonPowderParticleSpriteTemplate = +{ + .tileTag = ANIM_TAG_POISON_POWDER, + .paletteTag = ANIM_TAG_POISON_POWDER, + .oam = &gUnknown_08524944, + .anims = gUnknown_08592114, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMovePowderParticle, +}; + +const union AnimCmd gUnknown_08592160[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592168[] = +{ + ANIMCMD_FRAME(1, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592170[] = +{ + ANIMCMD_FRAME(2, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592178[] = +{ + ANIMCMD_FRAME(3, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592180[] = +{ + ANIMCMD_FRAME(4, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592188[] = +{ + ANIMCMD_FRAME(5, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592190[] = +{ + ANIMCMD_FRAME(6, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592198[] = +{ + ANIMCMD_FRAME(7, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085921A0[] = +{ + ANIMCMD_FRAME(8, 1), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_085921A8[] = +{ + gUnknown_08592160, + gUnknown_08592168, + gUnknown_08592170, + gUnknown_08592178, + gUnknown_08592180, + gUnknown_08592188, + gUnknown_08592190, +}; + +const union AnimCmd *const gUnknown_085921C4[] = +{ + gUnknown_08592198, +}; + +const union AnimCmd *const gUnknown_085921C8[] = +{ + gUnknown_085921A0, +}; + +const union AffineAnimCmd gUnknown_085921CC[] = { + AFFINEANIMCMD_FRAME(-5, -5, 0, 1), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gUnknown_085921DC[] = { + gUnknown_085921CC, +}; + +const struct SpriteTemplate gUnknown_085921E0 = +{ + .tileTag = ANIM_TAG_ORBS, + .paletteTag = ANIM_TAG_ORBS, + .oam = &gUnknown_08524A8C, + .anims = gUnknown_085921C8, + .images = NULL, + .affineAnims = gUnknown_085921DC, + .callback = sub_80FE8E0, +}; + +const struct SpriteTemplate gUnknown_085921F8 = +{ + .tileTag = ANIM_TAG_ORBS, + .paletteTag = ANIM_TAG_ORBS, + .oam = &gUnknown_08524904, + .anims = gUnknown_085921A8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FE930, +}; + +const struct SpriteTemplate gUnknown_08592210 = +{ + .tileTag = ANIM_TAG_ORBS, + .paletteTag = ANIM_TAG_ORBS, + .oam = &gUnknown_08524904, + .anims = gUnknown_085921C4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FE988, +}; + +const union AffineAnimCmd gUnknown_08592228[] = { + AFFINEANIMCMD_FRAME(320, 320, 0, 0), + AFFINEANIMCMD_FRAME(-14, -14, 0, 1), + AFFINEANIMCMD_JUMP(1), +}; + +const union AffineAnimCmd *const gUnknown_08592240[] = { + gUnknown_08592228, +}; + +const struct SpriteTemplate gUnknown_08592244 = +{ + .tileTag = ANIM_TAG_GRAY_ORB, + .paletteTag = ANIM_TAG_GRAY_ORB, + .oam = &gUnknown_085249C4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_08592240, + .callback = sub_80FE8E0, +}; + +const union AffineAnimCmd gUnknown_0859225C[] = { + AFFINEANIMCMD_FRAME(-5, -5, 0, 1), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gUnknown_0859226C[] = { + gUnknown_0859225C, +}; + +const struct SpriteTemplate gUnknown_08592270 = +{ + .tileTag = ANIM_TAG_ORBS, + .paletteTag = ANIM_TAG_ORBS, + .oam = &gUnknown_08524A8C, + .anims = gUnknown_085921C8, + .images = NULL, + .affineAnims = gUnknown_0859226C, + .callback = sub_80FEAD8, +}; + +const struct SpriteTemplate gUnknown_08592288 = +{ + .tileTag = ANIM_TAG_ORBS, + .paletteTag = ANIM_TAG_ORBS, + .oam = &gUnknown_08524904, + .anims = gUnknown_085921A8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FEB44, +}; + +const union AnimCmd gUnknown_085922A0[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085922A8[] = +{ + ANIMCMD_FRAME(4, 7), + ANIMCMD_FRAME(8, 7), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gUnknown_085922B4[] = +{ + gUnknown_085922A0, + gUnknown_085922A8, +}; + +const struct SpriteTemplate gLeechSeedSpriteTemplate = +{ + .tileTag = ANIM_TAG_SEED, + .paletteTag = ANIM_TAG_SEED, + .oam = &gUnknown_0852490C, + .anims = gUnknown_085922B4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimLeechSeed, +}; + +const union AnimCmd gUnknown_085922D4[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085922DC[] = +{ + ANIMCMD_FRAME(4, 7), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_085922E4[] = +{ + gUnknown_085922D4, + gUnknown_085922DC, +}; + +const struct SpriteTemplate gUnknown_085922EC = +{ + .tileTag = ANIM_TAG_SPORE, + .paletteTag = ANIM_TAG_SPORE, + .oam = &gUnknown_0852490C, + .anims = gUnknown_085922E4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FED28, +}; + +const union AnimCmd gUnknown_08592304[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_0859230C[] = +{ + ANIMCMD_FRAME(4, 1), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592314[] = +{ + gUnknown_08592304, +}; + +const union AnimCmd *const gUnknown_08592318[] = +{ + gUnknown_0859230C, +}; + +const struct SpriteTemplate gUnknown_0859231C = +{ + .tileTag = ANIM_TAG_FLOWER, + .paletteTag = ANIM_TAG_FLOWER, + .oam = &gUnknown_0852490C, + .anims = gUnknown_08592314, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FEE78, +}; + +const struct SpriteTemplate gUnknown_08592334 = +{ + .tileTag = ANIM_TAG_FLOWER, + .paletteTag = ANIM_TAG_FLOWER, + .oam = &gUnknown_08524904, + .anims = gUnknown_08592318, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FEF44, +}; + +const union AnimCmd gUnknown_0859234C[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(8, 5), + ANIMCMD_FRAME(12, 5), + ANIMCMD_FRAME(16, 5), + ANIMCMD_FRAME(20, 5), + ANIMCMD_FRAME(16, 5), + ANIMCMD_FRAME(12, 5), + ANIMCMD_FRAME(8, 5), + ANIMCMD_FRAME(4, 5), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gUnknown_08592378[] = +{ + ANIMCMD_FRAME(24, 5), + ANIMCMD_FRAME(28, 5), + ANIMCMD_FRAME(32, 5), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592388[] = +{ + gUnknown_0859234C, + gUnknown_08592378, +}; + +const struct SpriteTemplate gUnknown_08592390 = +{ + .tileTag = ANIM_TAG_LEAF, + .paletteTag = ANIM_TAG_LEAF, + .oam = &gUnknown_0852490C, + .anims = gUnknown_08592388, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FEFFC, +}; + +const struct SpriteTemplate gUnknown_085923A8 = +{ + .tileTag = ANIM_TAG_LEAF, + .paletteTag = ANIM_TAG_LEAF, + .oam = &gUnknown_0852490C, + .anims = gUnknown_08592388, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMoveTwisterParticle, +}; + +const union AnimCmd gUnknown_085923C0[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(0, 3, .hFlip = TRUE), + ANIMCMD_FRAME(0, 3, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(0, 3, .vFlip = TRUE), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gUnknown_085923D4[] = +{ + gUnknown_085923C0, +}; + +const struct SpriteTemplate gUnknown_085923D8 = +{ + .tileTag = ANIM_TAG_RAZOR_LEAF, + .paletteTag = ANIM_TAG_RAZOR_LEAF, + .oam = &gUnknown_08524934, + .anims = gUnknown_085923D4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimTranslateLinearSingleSineWave, +}; + +const union AffineAnimCmd gUnknown_085923F0[] = { + AFFINEANIMCMD_FRAME(0, 0, 0, 1), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gUnknown_08592400[] = { + gUnknown_085923F0, +}; + +const struct SpriteTemplate gSwiftStarSpriteTemplate = +{ + .tileTag = ANIM_TAG_YELLOW_STAR, + .paletteTag = ANIM_TAG_YELLOW_STAR, + .oam = &gUnknown_08524974, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_08592400, + .callback = AnimTranslateLinearSingleSineWave, +}; + +const union AnimCmd gUnknown_0859241C[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_FRAME(64, 4), + ANIMCMD_FRAME(96, 4), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592430[] = +{ + ANIMCMD_FRAME(0, 4, .hFlip = TRUE), + ANIMCMD_FRAME(32, 4, .hFlip = TRUE), + ANIMCMD_FRAME(64, 4, .hFlip = TRUE), + ANIMCMD_FRAME(96, 4, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592444[] = +{ + gUnknown_0859241C, + gUnknown_08592430, +}; + +const union AffineAnimCmd gUnknown_0859244C[] = { + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(-11, 0, 0, 6), + AFFINEANIMCMD_FRAME(11, 0, 0, 6), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_0859246C[] = { + AFFINEANIMCMD_FRAME(-256, 256, 0, 0), + AFFINEANIMCMD_FRAME(11, 0, 0, 6), + AFFINEANIMCMD_FRAME(-11, 0, 0, 6), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gUnknown_0859248C[] = { + gUnknown_0859244C, + gUnknown_0859246C, +}; + +const struct SpriteTemplate gUnknown_08592494 = +{ + .tileTag = ANIM_TAG_TENDRILS, + .paletteTag = ANIM_TAG_TENDRILS, + .oam = &gUnknown_0852499C, + .anims = gUnknown_08592444, + .images = NULL, + .affineAnims = gUnknown_0859248C, + .callback = sub_80FF374, +}; + +const union AffineAnimCmd gUnknown_085924AC[] = { + AFFINEANIMCMD_FRAME(0, 0, 0, 0), + AFFINEANIMCMD_FRAME(48, 48, 0, 14), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_085924C4[] = { + AFFINEANIMCMD_FRAME(-16, -16, 0, 1), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gUnknown_085924D4[] = { + gUnknown_085924AC, + gUnknown_085924C4, +}; + +const struct SpriteTemplate gUnknown_085924DC = +{ + .tileTag = ANIM_TAG_ORBS, + .paletteTag = ANIM_TAG_ORBS, + .oam = &gUnknown_085249CC, + .anims = gUnknown_085921C8, + .images = NULL, + .affineAnims = gUnknown_085924D4, + .callback = sub_80FF698, +}; + +const union AnimCmd gUnknown_085924F4[] = +{ + ANIMCMD_FRAME(0, 7), + ANIMCMD_FRAME(16, 7), + ANIMCMD_FRAME(32, 7), + ANIMCMD_FRAME(48, 7), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592508[] = +{ + ANIMCMD_FRAME(0, 7, .hFlip = TRUE), + ANIMCMD_FRAME(16, 7, .hFlip = TRUE), + ANIMCMD_FRAME(32, 7, .hFlip = TRUE), + ANIMCMD_FRAME(48, 7, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_0859251C[] = +{ + ANIMCMD_FRAME(0, 7), + ANIMCMD_FRAME(16, 7), + ANIMCMD_FRAME(32, 7), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_0859252C[] = +{ + ANIMCMD_FRAME(0, 7, .hFlip = TRUE), + ANIMCMD_FRAME(16, 7, .hFlip = TRUE), + ANIMCMD_FRAME(32, 7, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_0859253C[] = +{ + gUnknown_085924F4, + gUnknown_08592508, + gUnknown_0859251C, + gUnknown_0859252C, +}; + +const struct SpriteTemplate gUnknown_0859254C = +{ + .tileTag = ANIM_TAG_ROOTS, + .paletteTag = ANIM_TAG_ROOTS, + .oam = &gUnknown_08524914, + .anims = gUnknown_0859253C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FF768, +}; + +const struct SpriteTemplate gUnknown_08592564 = +{ + .tileTag = ANIM_TAG_ROOTS, + .paletteTag = ANIM_TAG_ROOTS, + .oam = &gUnknown_08524914, + .anims = gUnknown_0859253C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FF7EC, +}; + +const union AnimCmd gUnknown_0859257C[] = +{ + ANIMCMD_FRAME(3, 3), + ANIMCMD_FRAME(0, 5), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gUnknown_08592588[] = +{ + gUnknown_0859257C, +}; + +const struct SpriteTemplate gUnknown_0859258C = +{ + .tileTag = ANIM_TAG_ORBS, + .paletteTag = ANIM_TAG_ORBS, + .oam = &gUnknown_08524904, + .anims = gUnknown_08592588, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FF934, +}; + +const union AnimCmd gUnknown_085925A4[] = +{ + ANIMCMD_FRAME(0, 30), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_085925AC[] = +{ + gUnknown_085925A4, +}; + +const union AffineAnimCmd gUnknown_085925B0[] = { + AFFINEANIMCMD_FRAME(0, 0, -4, 10), + AFFINEANIMCMD_FRAME(0, 0, 4, 20), + AFFINEANIMCMD_FRAME(0, 0, -4, 10), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_085925D0[] = { + AFFINEANIMCMD_FRAME(0, 0, -1, 2), + AFFINEANIMCMD_FRAME(0, 0, 1, 4), + AFFINEANIMCMD_FRAME(0, 0, -1, 4), + AFFINEANIMCMD_FRAME(0, 0, 1, 4), + AFFINEANIMCMD_FRAME(0, 0, -1, 4), + AFFINEANIMCMD_FRAME(0, 0, 1, 2), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gUnknown_08592608[] = { + gUnknown_085925B0, + gUnknown_085925D0, +}; + +const struct SpriteTemplate gUnknown_08592610 = +{ + .tileTag = ANIM_TAG_ITEM_BAG, + .paletteTag = ANIM_TAG_ITEM_BAG, + .oam = &gUnknown_08524974, + .anims = gUnknown_085925AC, + .images = NULL, + .affineAnims = gUnknown_08592608, + .callback = sub_80FFB18, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8592628 = +{ + .tileTag = ANIM_TAG_ITEM_BAG, + .paletteTag = ANIM_TAG_ITEM_BAG, + .oam = &gUnknown_08524974, + .anims = gUnknown_085925AC, + .images = NULL, + .affineAnims = gUnknown_08592608, + .callback = sub_80FFBF4, +}; + +const union AnimCmd gUnknown_08592640[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(4, 4), + ANIMCMD_FRAME(8, 4), + ANIMCMD_FRAME(12, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592654[] = +{ + gUnknown_08592640, +}; + +const struct SpriteTemplate gUnknown_08592658 = +{ + .tileTag = ANIM_TAG_GREEN_SPARKLE, + .paletteTag = ANIM_TAG_GREEN_SPARKLE, + .oam = &gUnknown_0852490C, + .anims = gUnknown_08592654, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80FFC70, +}; + +const struct SpriteTemplate gUnknown_08592670 = +{ + .tileTag = ANIM_TAG_ITEM_BAG, + .paletteTag = ANIM_TAG_ITEM_BAG, + .oam = &gUnknown_08524974, + .anims = gUnknown_085925AC, + .images = NULL, + .affineAnims = gUnknown_08592608, + .callback = sub_80FFCB4, +}; + +const union AffineAnimCmd gUnknown_08592688[] = { + AFFINEANIMCMD_FRAME(0, 0, 0, 3), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_08592698[] = { + AFFINEANIMCMD_FRAME(0, -10, 0, 3), + AFFINEANIMCMD_FRAME(0, -6, 0, 3), + AFFINEANIMCMD_FRAME(0, -2, 0, 3), + AFFINEANIMCMD_FRAME(0, 0, 0, 3), + AFFINEANIMCMD_FRAME(0, 2, 0, 3), + AFFINEANIMCMD_FRAME(0, 6, 0, 3), + AFFINEANIMCMD_FRAME(0, 10, 0, 3), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gUnknown_085926D8[] = { + gUnknown_08592688, + gUnknown_08592698, + gUnknown_085925B0, + gUnknown_085925D0, +}; + +const struct SpriteTemplate gUnknown_085926E8 = +{ + .tileTag = ANIM_TAG_ITEM_BAG, + .paletteTag = ANIM_TAG_ITEM_BAG, + .oam = &gUnknown_08524974, + .anims = gUnknown_085925AC, + .images = NULL, + .affineAnims = gUnknown_085926D8, + .callback = sub_80FFDBC, +}; + +const s8 gUnknown_08592700[][3] = +{ + {5, 24, 1}, + {0, 4, 0}, + {8, 16, -1}, + {0, 2, 0}, + {8, 16, 1}, + {0, 2, 0}, + {8, 16, 1}, + {0, 2, 0}, + {8, 16, 1}, + {0, 16, 0}, + {0, 0, 127}, +}; + +const union AnimCmd gUnknown_08592724[] = +{ + ANIMCMD_FRAME(28, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_0859272C[] = +{ + ANIMCMD_FRAME(32, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592734[] = +{ + ANIMCMD_FRAME(20, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_0859273C[] = +{ + ANIMCMD_FRAME(28, 1, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592744[] = +{ + ANIMCMD_FRAME(16, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_0859274C[] = +{ + ANIMCMD_FRAME(16, 1, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592754[] = +{ + ANIMCMD_FRAME(28, 1), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_0859275C[] = +{ + gUnknown_08592724, + gUnknown_0859272C, + gUnknown_08592734, + gUnknown_0859273C, + gUnknown_08592744, + gUnknown_0859274C, + gUnknown_08592754, +}; + +const struct SpriteTemplate gUnknown_08592778 = +{ + .tileTag = ANIM_TAG_LEAF, + .paletteTag = ANIM_TAG_LEAF, + .oam = &gUnknown_0852490C, + .anims = gUnknown_0859275C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +const union AffineAnimCmd gUnknown_08592790[] = { + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(0, 0, 4, 1), + AFFINEANIMCMD_JUMP(1), +}; + +const union AffineAnimCmd *const gUnknown_085927A8[] = { + gUnknown_08592790, +}; + +const struct SpriteTemplate gUnknown_085927AC = +{ + .tileTag = ANIM_TAG_FLOWER, + .paletteTag = ANIM_TAG_FLOWER, + .oam = &gUnknown_08524904, + .anims = gUnknown_08592318, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8100640, +}; + +const struct SpriteTemplate gUnknown_085927C4 = +{ + .tileTag = ANIM_TAG_FLOWER, + .paletteTag = ANIM_TAG_FLOWER, + .oam = &gUnknown_0852496C, + .anims = gUnknown_08592314, + .images = NULL, + .affineAnims = gUnknown_085927A8, + .callback = sub_8100640, +}; + +const union AffineAnimCmd gUnknown_085927DC[] = { + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(0, 0, -10, 1), + AFFINEANIMCMD_JUMP(1), +}; + +const union AffineAnimCmd gUnknown_085927F4[] = { + AFFINEANIMCMD_FRAME(192, 192, 0, 0), + AFFINEANIMCMD_FRAME(0, 0, -12, 1), + AFFINEANIMCMD_JUMP(1), +}; + +const union AffineAnimCmd gUnknown_0859280C[] = { + AFFINEANIMCMD_FRAME(143, 143, 0, 0), + AFFINEANIMCMD_FRAME(0, 0, -15, 1), + AFFINEANIMCMD_JUMP(1), +}; + +const union AffineAnimCmd *const gUnknown_08592824[] = { + gUnknown_085927DC, +}; + +const union AffineAnimCmd *const gUnknown_08592828[] = { + gUnknown_085927F4, +}; + +const union AffineAnimCmd *const gUnknown_0859282C[] = { + gUnknown_0859280C, +}; + +const struct SpriteTemplate gUnknown_08592830 = +{ + .tileTag = ANIM_TAG_SPARKLE_6, + .paletteTag = ANIM_TAG_SPARKLE_6, + .oam = &gUnknown_0852496C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_08592824, + .callback = sub_8100640, +}; + +const struct SpriteTemplate gUnknown_08592848 = +{ + .tileTag = ANIM_TAG_SPARKLE_6, + .paletteTag = ANIM_TAG_SPARKLE_6, + .oam = &gUnknown_0852496C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_08592828, + .callback = sub_8100640, +}; + +const struct SpriteTemplate gUnknown_08592860 = +{ + .tileTag = ANIM_TAG_SPARKLE_6, + .paletteTag = ANIM_TAG_SPARKLE_6, + .oam = &gUnknown_0852496C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_0859282C, + .callback = sub_8100640, +}; + +const u16 gMagicalLeafBlendColors[] = +{ + RGB(31, 0, 0), + RGB(31, 19, 0), + RGB(31, 31, 0), + RGB(0, 31, 0), + RGB(5, 14, 31), + RGB(22, 10, 31), + RGB(22, 21, 31), +}; + +const struct SpriteTemplate gUnknown_08592888 = +{ + .tileTag = ANIM_TAG_GREEN_SPIKE, + .paletteTag = ANIM_TAG_GREEN_SPIKE, + .oam = &gUnknown_0852496C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8100898, +}; + +const union AnimCmd gUnknown_085928A0[] = +{ + ANIMCMD_FRAME(64, 3), + ANIMCMD_FRAME(80, 3), + ANIMCMD_FRAME(96, 3), + ANIMCMD_FRAME(112, 6), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085928B4[] = +{ + ANIMCMD_FRAME(64, 3, .hFlip = TRUE), + ANIMCMD_FRAME(80, 3, .hFlip = TRUE), + ANIMCMD_FRAME(96, 3, .hFlip = TRUE), + ANIMCMD_FRAME(112, 6, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_085928C8[] = +{ + gUnknown_085928A0, + gUnknown_085928B4, +}; + +const struct SpriteTemplate gUnknown_085928D0 = +{ + .tileTag = ANIM_TAG_SLAM_HIT, + .paletteTag = ANIM_TAG_SLAM_HIT, + .oam = &gUnknown_08524914, + .anims = gUnknown_085928C8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8100A50, +}; + +const struct SpriteTemplate gUnknown_085928E8 = +{ + .tileTag = ANIM_TAG_WHIP_HIT, + .paletteTag = ANIM_TAG_WHIP_HIT, + .oam = &gUnknown_08524914, + .anims = gUnknown_085928C8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8100A50, +}; + +const union AnimCmd gUnknown_08592900[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_FRAME(48, 4), + ANIMCMD_FRAME(64, 5), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592918[] = +{ + gUnknown_08592900, +}; + +const struct SpriteTemplate gUnknown_0859291C = +{ + .tileTag = ANIM_TAG_UNUSED_HIT, + .paletteTag = ANIM_TAG_UNUSED_HIT, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592918, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81009F8, +}; + +const struct SpriteTemplate gUnknown_08592934 = +{ + .tileTag = ANIM_TAG_UNUSED_HIT_2, + .paletteTag = ANIM_TAG_UNUSED_HIT_2, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592918, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81009F8, +}; + +const union AffineAnimCmd gUnknown_0859294C[] = { + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_0859295C[] = { + AFFINEANIMCMD_FRAME(256, 256, 32, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_0859296C[] = { + AFFINEANIMCMD_FRAME(256, 256, 64, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_0859297C[] = { + AFFINEANIMCMD_FRAME(256, 256, 96, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_0859298C[] = { + AFFINEANIMCMD_FRAME(256, 256, -128, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_0859299C[] = { + AFFINEANIMCMD_FRAME(256, 256, -96, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_085929AC[] = { + AFFINEANIMCMD_FRAME(256, 256, -64, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_085929BC[] = { + AFFINEANIMCMD_FRAME(256, 256, -32, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gUnknown_085929CC[] = { + gUnknown_0859294C, + gUnknown_0859295C, + gUnknown_0859296C, + gUnknown_0859297C, + gUnknown_0859298C, + gUnknown_0859299C, + gUnknown_085929AC, + gUnknown_085929BC, +}; + +const struct SpriteTemplate gUnknown_085929EC = +{ + .tileTag = ANIM_TAG_HANDS_AND_FEET, + .paletteTag = ANIM_TAG_HANDS_AND_FEET, + .oam = &gUnknown_08524974, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_085929CC, + .callback = sub_8100A94, +}; + +const union AnimCmd gUnknown_08592A04[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(16, 5), + ANIMCMD_FRAME(32, 5), + ANIMCMD_FRAME(48, 5), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592A18[] = +{ + gUnknown_08592A04, +}; + +const struct SpriteTemplate gCuttingSliceSpriteTemplate = +{ + .tileTag = ANIM_TAG_CUT, + .paletteTag = ANIM_TAG_CUT, + .oam = &gUnknown_08524A34, + .anims = gUnknown_08592A18, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimCuttingSlice, +}; + +const struct SpriteTemplate gUnknown_08592A34 = +{ + .tileTag = ANIM_TAG_CUT, + .paletteTag = ANIM_TAG_CUT, + .oam = &gUnknown_08524A34, + .anims = gUnknown_08592A18, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8100B88, +}; + +const union AnimCmd gUnknown_08592A4C[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A54[] = +{ + ANIMCMD_FRAME(4, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A5C[] = +{ + ANIMCMD_FRAME(8, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A64[] = +{ + ANIMCMD_FRAME(12, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A6C[] = +{ + ANIMCMD_FRAME(16, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A74[] = +{ + ANIMCMD_FRAME(20, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A7C[] = +{ + ANIMCMD_FRAME(0, 1, .vFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A84[] = +{ + ANIMCMD_FRAME(4, 1, .vFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A8C[] = +{ + ANIMCMD_FRAME(8, 1, .vFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592A94[] = +{ + ANIMCMD_FRAME(12, 1, .vFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592A9C[] = +{ + gUnknown_08592A4C, + gUnknown_08592A54, + gUnknown_08592A5C, + gUnknown_08592A64, + gUnknown_08592A6C, + gUnknown_08592A74, + gUnknown_08592A7C, + gUnknown_08592A84, + gUnknown_08592A8C, + gUnknown_08592A94, +}; + +const struct SpriteTemplate gUnknown_08592AC4 = +{ + .tileTag = ANIM_TAG_MUSIC_NOTES, + .paletteTag = ANIM_TAG_MUSIC_NOTES, + .oam = &gUnknown_0852490C, + .anims = gUnknown_08592A9C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8100E1C, +}; + +const struct SpriteTemplate gUnknown_08592ADC = +{ + .tileTag = ANIM_TAG_PROTECT, + .paletteTag = ANIM_TAG_PROTECT, + .oam = &gUnknown_08524A3C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8100EF0, +}; + +const union AffineAnimCmd gUnknown_08592AF4[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_08592B04[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, 2, 12), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 6), + AFFINEANIMCMD_FRAME(0x0, 0x0, -2, 24), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 6), + AFFINEANIMCMD_FRAME(0x0, 0x0, 2, 12), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gUnknown_08592B34[] = +{ + gUnknown_08592AF4, + gUnknown_08592B04, +}; + +const struct SpriteTemplate gUnknown_08592B3C = +{ + .tileTag = ANIM_TAG_MILK_BOTTLE, + .paletteTag = ANIM_TAG_MILK_BOTTLE, + .oam = &gUnknown_08524A94, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_08592B34, + .callback = sub_81010CC, +}; + +const union AnimCmd gUnknown_08592B54[] = +{ + ANIMCMD_FRAME(0, 7), + ANIMCMD_FRAME(16, 7), + ANIMCMD_FRAME(32, 7), + ANIMCMD_FRAME(48, 7), + ANIMCMD_FRAME(64, 7), + ANIMCMD_FRAME(80, 7), + ANIMCMD_FRAME(96, 7), + ANIMCMD_FRAME(112, 7), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gUnknown_08592B78[] = +{ + gUnknown_08592B54, +}; + +const struct SpriteTemplate gUnknown_08592B7C = +{ + .tileTag = ANIM_TAG_SPARKLE_2, + .paletteTag = ANIM_TAG_SPARKLE_2, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592B78, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_810130C, +}; + +const struct SpriteTemplate gUnknown_08592B94 = +{ + .tileTag = ANIM_TAG_SPARKLE_2, + .paletteTag = ANIM_TAG_SPARKLE_2, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592B78, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_810135C, +}; + +const union AnimCmd gUnknown_08592BAC[] = +{ + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(4, 10), + ANIMCMD_FRAME(8, 10), + ANIMCMD_FRAME(12, 10), + ANIMCMD_FRAME(16, 26), + ANIMCMD_FRAME(16, 5), + ANIMCMD_FRAME(20, 5), + ANIMCMD_FRAME(24, 15), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592BD0[] = +{ + ANIMCMD_FRAME(0, 10, .hFlip = TRUE), + ANIMCMD_FRAME(4, 10, .hFlip = TRUE), + ANIMCMD_FRAME(8, 10, .hFlip = TRUE), + ANIMCMD_FRAME(12, 10, .hFlip = TRUE), + ANIMCMD_FRAME(16, 26, .hFlip = TRUE), + ANIMCMD_FRAME(16, 5, .hFlip = TRUE), + ANIMCMD_FRAME(20, 5, .hFlip = TRUE), + ANIMCMD_FRAME(24, 15, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592BF4[] = +{ + gUnknown_08592BAC, + gUnknown_08592BD0, +}; + +const struct SpriteTemplate gUnknown_08592BFC = +{ + .tileTag = ANIM_TAG_UNUSED_BUBBLE_BURST, + .paletteTag = ANIM_TAG_UNUSED_BUBBLE_BURST, + .oam = &gUnknown_0852490C, + .anims = gUnknown_08592BF4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8101440, +}; + +const union AnimCmd gUnknown_08592C14[] = +{ + ANIMCMD_FRAME(0, 40), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592C1C[] = +{ + gUnknown_08592C14, +}; + +const union AffineAnimCmd gUnknown_08592C20[] = +{ + AFFINEANIMCMD_FRAME(0x14, 0x14, -30, 0), + AFFINEANIMCMD_FRAME(0x8, 0x8, 1, 24), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_08592C20_2[] = +{ + AFFINEANIMCMD_LOOP(0), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 24), + AFFINEANIMCMD_LOOP(10), +}; + +const union AffineAnimCmd gUnknown_08592C50[] = +{ + AFFINEANIMCMD_FRAME(0x14, 0x14, 30, 0), + AFFINEANIMCMD_FRAME(0x8, 0x8, -1, 24), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_08592C50_2[] = +{ + AFFINEANIMCMD_LOOP(0), + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 24), + AFFINEANIMCMD_LOOP(10), +}; + +const union AffineAnimCmd *const gUnknown_08592C80[] = +{ + gUnknown_08592C20, + gUnknown_08592C50, +}; + +const struct SpriteTemplate gUnknown_08592C88 = +{ + .tileTag = ANIM_TAG_LETTER_Z, + .paletteTag = ANIM_TAG_LETTER_Z, + .oam = &gUnknown_08524974, + .anims = gUnknown_08592C1C, + .images = NULL, + .affineAnims = gUnknown_08592C80, + .callback = sub_81014F4, +}; + +const struct SpriteTemplate gUnknown_08592CA0 = +{ + .tileTag = ANIM_TAG_LOCK_ON, + .paletteTag = ANIM_TAG_LOCK_ON, + .oam = &gUnknown_08524914, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81015AC, +}; + +const struct SpriteTemplate gUnknown_08592CB8 = +{ + .tileTag = ANIM_TAG_LOCK_ON, + .paletteTag = ANIM_TAG_LOCK_ON, + .oam = &gUnknown_0852490C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8101898, +}; + +const s8 gUnknown_08592CD0[][2] = +{ + { 64, 64}, + { 0, -64}, + {-64, 64}, + { 32, -32}, +}; + +const struct SpriteTemplate gUnknown_08592CD8 = +{ + .tileTag = 0, + .paletteTag = 0, + .oam = &gDummyOamData, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8101940, +}; + +const struct SpriteTemplate gUnknown_08592CF0 = +{ + .tileTag = 0, + .paletteTag = 0, + .oam = &gDummyOamData, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8101B90, +}; + +const union AnimCmd gUnknown_08592D08[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_FRAME(48, 4), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592D1C[] = +{ + ANIMCMD_FRAME(48, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592D24[] = +{ + gUnknown_08592D08, + gUnknown_08592D1C, +}; + +const struct SpriteTemplate gUnknown_08592D2C = +{ + .tileTag = ANIM_TAG_SLASH, + .paletteTag = ANIM_TAG_SLASH, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592D24, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8101F40, +}; + +const struct SpriteTemplate gUnknown_08592D44 = +{ + .tileTag = ANIM_TAG_SLASH_2, + .paletteTag = ANIM_TAG_SLASH_2, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592D24, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8101FA8, +}; + +const struct SpriteTemplate gUnknown_08592D5C = +{ + .tileTag = ANIM_TAG_SLASH_2, + .paletteTag = ANIM_TAG_SLASH_2, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592D24, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8101FF0, +}; + +const union AnimCmd gUnknown_08592D74[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(8, 12), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(24, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592D88[] = +{ + gUnknown_08592D74, +}; + +const struct SpriteTemplate gUnknown_08592D8C = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_FOCUS_ENERGY, + .oam = &gUnknown_08524954, + .anims = gUnknown_08592D88, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81020D8, +}; + +const union AnimCmd gUnknown_08592DA4[] = +{ + ANIMCMD_FRAME(0, 18), + ANIMCMD_FRAME(0, 6), + ANIMCMD_FRAME(16, 18), + ANIMCMD_FRAME(0, 6), + ANIMCMD_FRAME(16, 6), + ANIMCMD_FRAME(32, 18), + ANIMCMD_FRAME(16, 6), + ANIMCMD_FRAME(32, 6), + ANIMCMD_FRAME(48, 18), + ANIMCMD_FRAME(32, 6), + ANIMCMD_FRAME(48, 6), + ANIMCMD_FRAME(64, 18), + ANIMCMD_FRAME(48, 6), + ANIMCMD_FRAME(64, 54), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592DE0[] = +{ + gUnknown_08592DA4, +}; + +const struct SpriteTemplate gUnknown_08592DE4 = +{ + .tileTag = ANIM_TAG_SPHERE_TO_CUBE, + .paletteTag = ANIM_TAG_SPHERE_TO_CUBE, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592DE0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_810217C, +}; + +const struct SpriteTemplate gUnknown_08592DFC = +{ + .tileTag = ANIM_TAG_BLACK_BALL, + .paletteTag = ANIM_TAG_BLACK_BALL, + .oam = &gUnknown_08524904, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = TranslateAnimSpriteToTargetMonLocation, +}; + +const union AnimCmd gUnknown_08592E14[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_FRAME(32, 3), + ANIMCMD_FRAME(48, 3), + ANIMCMD_FRAME(64, 3), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592E2C[] = +{ + gUnknown_08592E14, +}; + +const struct SpriteTemplate gUnknown_08592E30 = +{ + .tileTag = ANIM_TAG_GRAY_SMOKE, + .paletteTag = ANIM_TAG_GRAY_SMOKE, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592E2C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80A77C8, +}; + +const union AnimCmd gUnknown_08592E48[] = +{ + ANIMCMD_FRAME(3, 5), + ANIMCMD_FRAME(2, 5), + ANIMCMD_FRAME(1, 5), + ANIMCMD_FRAME(0, 5), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592E5C[] = +{ + gUnknown_08592E48, +}; + +const union AffineAnimCmd gUnknown_08592E60[] = +{ + AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gUnknown_08592E70[] = +{ + gUnknown_08592E60, +}; + +const struct SpriteTemplate gUnknown_08592E74 = +{ + .tileTag = ANIM_TAG_CONVERSION, + .paletteTag = ANIM_TAG_CONVERSION, + .oam = &gUnknown_08524AE4, + .anims = gUnknown_08592E5C, + .images = NULL, + .affineAnims = gUnknown_08592E70, + .callback = sub_8102268, +}; + +const union AnimCmd gUnknown_08592E8C[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(1, 5), + ANIMCMD_FRAME(2, 5), + ANIMCMD_FRAME(3, 5), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592EA0[] = +{ + gUnknown_08592E8C, +}; + +const struct SpriteTemplate gUnknown_08592EA4 = +{ + .tileTag = ANIM_TAG_CONVERSION, + .paletteTag = ANIM_TAG_CONVERSION, + .oam = &gUnknown_08524AE4, + .anims = gUnknown_08592EA0, + .images = NULL, + .affineAnims = gUnknown_08592E70, + .callback = sub_810234C, +}; + +const struct SpriteTemplate gUnknown_08592EBC = +{ + .tileTag = ANIM_TAG_MOON, + .paletteTag = ANIM_TAG_MOON, + .oam = &gUnknown_08524A3C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81024E0, +}; + +const union AnimCmd gUnknown_08592ED4[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(8, 8), + ANIMCMD_FRAME(12, 8), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gUnknown_08592EE8[] = +{ + gUnknown_08592ED4, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8592EEC = +{ + .tileTag = ANIM_TAG_GREEN_SPARKLE, + .paletteTag = ANIM_TAG_GREEN_SPARKLE, + .oam = &gUnknown_0852490C, + .anims = gUnknown_08592EE8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8102540, +}; + +const union AnimCmd gUnknown_08592F04[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(16, 2), + ANIMCMD_FRAME(32, 2), + ANIMCMD_FRAME(48, 3), + ANIMCMD_FRAME(64, 5), + ANIMCMD_FRAME(80, 3), + ANIMCMD_FRAME(96, 2), + ANIMCMD_FRAME(0, 2), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592F28[] = +{ + gUnknown_08592F04, +}; + +const struct SpriteTemplate gUnknown_08592F2C = +{ + .tileTag = ANIM_TAG_BLUE_STAR, + .paletteTag = ANIM_TAG_BLUE_STAR, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592F28, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80A77C8, +}; + +const struct SpriteTemplate gUnknown_08592F44 = +{ + .tileTag = ANIM_TAG_HORN_HIT, + .paletteTag = ANIM_TAG_HORN_HIT, + .oam = &gUnknown_08524914, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8102844, +}; + +const union AnimCmd gUnknown_08592F5C[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(16, 2), + ANIMCMD_FRAME(32, 2), + ANIMCMD_FRAME(48, 2), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592F70[] = +{ + gUnknown_08592F5C, +}; + +const struct SpriteTemplate gUnknown_08592F74 = +{ + .tileTag = ANIM_TAG_FANG_ATTACK, + .paletteTag = ANIM_TAG_FANG_ATTACK, + .oam = &gUnknown_08524914, + .anims = gUnknown_08592F70, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8102BCC, +}; + +const union AnimCmd gUnknown_08592F8C[] = +{ + ANIMCMD_FRAME(0, 10), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592F94[] = +{ + ANIMCMD_FRAME(4, 10), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592F9C[] = +{ + ANIMCMD_FRAME(8, 41), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592FA4[] = +{ + ANIMCMD_FRAME(12, 10), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592FAC[] = +{ + ANIMCMD_FRAME(16, 10), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592FB4[] = +{ + ANIMCMD_FRAME(20, 10), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592FBC[] = +{ + ANIMCMD_FRAME(0, 10, .vFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_08592FC4[] = +{ + ANIMCMD_FRAME(4, 10, .vFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08592FCC[] = +{ + gUnknown_08592F8C, + gUnknown_08592F94, + gUnknown_08592F9C, + gUnknown_08592FA4, + gUnknown_08592FAC, + gUnknown_08592FB4, + gUnknown_08592FBC, + gUnknown_08592FC4, +}; + +const union AffineAnimCmd gUnknown_08592FEC[] = +{ + AFFINEANIMCMD_FRAME(0xC, 0xC, 0, 16), + AFFINEANIMCMD_FRAME(0xFFF4, 0xFFF4, 0, 16), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gUnknown_08593004[] = +{ + gUnknown_08592FEC, +}; + +const struct SpriteTemplate gUnknown_08593008 = +{ + .tileTag = ANIM_TAG_MUSIC_NOTES, + .paletteTag = ANIM_TAG_MUSIC_NOTES, + .oam = &gUnknown_085249CC, + .anims = gUnknown_08592FCC, + .images = NULL, + .affineAnims = gUnknown_08593004, + .callback = sub_8102CD4, +}; + +const u16 gUnknown_08593020[][6] = +{ + {ANIM_TAG_MUSIC_NOTES, RGB(31, 31, 31), RGB(31, 26, 28), RGB(31, 22, 26), RGB(31, 17, 24), RGB(31, 13, 22)}, + {ANIM_TAG_BENT_SPOON, RGB(31, 31, 31), RGB(25, 31, 26), RGB(20, 31, 21), RGB(15, 31, 16), RGB(10, 31, 12)}, + {ANIM_TAG_SPHERE_TO_CUBE, RGB(31, 31, 31), RGB(31, 31, 24), RGB(31, 31, 17), RGB(31, 31, 10), RGB(31, 31, 3)}, + {ANIM_TAG_LARGE_FRESH_EGG, RGB(31, 31, 31), RGB(26, 28, 31), RGB(21, 26, 31), RGB(16, 24, 31), RGB(12, 22, 31)}, +}; + +const struct SpriteTemplate gUnknown_08593050 = +{ + .tileTag = ANIM_TAG_MUSIC_NOTES, + .paletteTag = ANIM_TAG_MUSIC_NOTES, + .oam = &gUnknown_085249CC, + .anims = gUnknown_08592FCC, + .images = NULL, + .affineAnims = gUnknown_08593004, + .callback = sub_8102EB0, +}; + +const struct SpriteTemplate gUnknown_08593068 = +{ + .tileTag = ANIM_TAG_PURPLE_HAND_OUTLINE, + .paletteTag = ANIM_TAG_PURPLE_HAND_OUTLINE, + .oam = &gUnknown_08524914, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8102FB8, +}; + +const union AffineAnimCmd gUnknown_08593080[] = +{ + AFFINEANIMCMD_FRAME(0xA0, 0xA0, 0, 0), + AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 1), + AFFINEANIMCMD_JUMP(1), +}; + +const union AffineAnimCmd *const gUnknown_08593098[] = +{ + gUnknown_08593080, +}; + +const struct SpriteTemplate gUnknown_0859309C = +{ + .tileTag = ANIM_TAG_MUSIC_NOTES, + .paletteTag = ANIM_TAG_MUSIC_NOTES, + .oam = &gUnknown_085249CC, + .anims = gUnknown_08592FCC, + .images = NULL, + .affineAnims = gUnknown_08593098, + .callback = sub_8103028, +}; + +const union AnimCmd gUnknown_085930B4[] = +{ + ANIMCMD_FRAME(0, 2, .hFlip = TRUE), + ANIMCMD_FRAME(16, 2, .hFlip = TRUE), + ANIMCMD_FRAME(32, 2, .hFlip = TRUE), + ANIMCMD_FRAME(48, 2, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085930C8[] = +{ + ANIMCMD_FRAME(48, 2, .hFlip = TRUE), + ANIMCMD_FRAME(32, 2, .hFlip = TRUE), + ANIMCMD_FRAME(16, 2, .hFlip = TRUE), + ANIMCMD_FRAME(0, 2, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085930DC[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(16, 2), + ANIMCMD_FRAME(32, 2), + ANIMCMD_FRAME(48, 2), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085930F0[] = +{ + ANIMCMD_FRAME(48, 2), + ANIMCMD_FRAME(32, 2), + ANIMCMD_FRAME(16, 2), + ANIMCMD_FRAME(0, 2), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_08593104[] = +{ + gUnknown_085930B4, + gUnknown_085930DC, + gUnknown_085930C8, + gUnknown_085930F0, +}; + +const struct SpriteTemplate gUnknown_08593114 = +{ + .tileTag = ANIM_TAG_THOUGHT_BUBBLE, + .paletteTag = ANIM_TAG_THOUGHT_BUBBLE, + .oam = &gUnknown_08524914, + .anims = gUnknown_08593104, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8103164, +}; + +const union AffineAnimCmd gUnknown_0859312C[] = +{ + AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0), + AFFINEANIMCMD_FRAME(0x1E, 0x1E, 0, 8), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_08593144[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, 4, 11), + AFFINEANIMCMD_FRAME(0x0, 0x0, -4, 11), + AFFINEANIMCMD_LOOP(2), + AFFINEANIMCMD_FRAME(0xFFE2, 0xFFE2, 0, 8), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_08593144_2[] = +{ + AFFINEANIMCMD_FRAME(16, 16, 0, 0), + AFFINEANIMCMD_FRAME(30, 30, 0, 8), + AFFINEANIMCMD_FRAME(0, 0, 0, 16), + AFFINEANIMCMD_LOOP(0), + AFFINEANIMCMD_FRAME(0, 0, 4, 11), + AFFINEANIMCMD_FRAME(0, 0, -4, 11), + AFFINEANIMCMD_LOOP(2), + AFFINEANIMCMD_FRAME(-30, -30, 0, 8), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gUnknown_085931B4[] = +{ + gUnknown_0859312C, + gUnknown_08593144, +}; + +const struct SpriteTemplate gUnknown_085931BC = +{ + .tileTag = ANIM_TAG_FINGER, + .paletteTag = ANIM_TAG_FINGER, + .oam = &gUnknown_085249D4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_085931B4, + .callback = sub_8103208, +}; + +const struct SpriteTemplate gUnknown_085931D4 = +{ + .tileTag = ANIM_TAG_FINGER, + .paletteTag = ANIM_TAG_FINGER, + .oam = &gUnknown_08524974, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_085931B4, + .callback = sub_8103284, +}; + +const union AnimCmd gUnknown_085931EC[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085931F4[] = +{ + ANIMCMD_FRAME(0, 1, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_085931FC[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_END, +}; + +const union AnimCmd gUnknown_0859321C[] = +{ + ANIMCMD_FRAME(0, 4, .hFlip = TRUE), + ANIMCMD_FRAME(16, 4, .hFlip = TRUE), + ANIMCMD_FRAME(32, 4, .hFlip = TRUE), + ANIMCMD_FRAME(16, 4, .hFlip = TRUE), + ANIMCMD_FRAME(0, 4, .hFlip = TRUE), + ANIMCMD_FRAME(16, 4, .hFlip = TRUE), + ANIMCMD_FRAME(32, 4, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gUnknown_0859323C[] = +{ + gUnknown_085931EC, + gUnknown_085931F4, + gUnknown_085931FC, + gUnknown_0859321C, +}; + +const struct SpriteTemplate gUnknown_0859324C = +{ + .tileTag = ANIM_TAG_FINGER_2, + .paletteTag = ANIM_TAG_FINGER_2, + .oam = &gUnknown_08524914, + .anims = gUnknown_0859323C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8103390, +}; + +// Animates the falling particles that horizontally wave back and forth. +// Used by Sleep Powder, Stun Spore, and Poison Powder. +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: total duration in frames +// arg 3: vertical movement speed (sub-pixel value) +// arg 4: wave amplitude +// arg 5: wave speed +void AnimMovePowderParticle(struct Sprite* sprite) +{ + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gBattleAnimArgs[3]; + + if (GetBattlerSide(gBattleAnimAttacker)) + { + sprite->data[3] = -gBattleAnimArgs[4]; + } + else + { + sprite->data[3] = gBattleAnimArgs[4]; + } + + sprite->data[4] = gBattleAnimArgs[5]; + sprite->callback = AnimMovePowderParticleStep; +} + +static void AnimMovePowderParticleStep(struct Sprite* sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + sprite->pos2.y = sprite->data[2] >> 8; + sprite->data[2] += sprite->data[1]; + sprite->pos2.x = Sin(sprite->data[5], sprite->data[3]); + sprite->data[5] = (sprite->data[5] + sprite->data[4]) & 0xFF; + } + else + { + DestroyAnimSprite(sprite); + } +} + +void sub_80FE8E0(struct Sprite* sprite) +{ + InitAnimSpritePos(sprite, 1); + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, move_anim_8074EE0); +} + +void sub_80FE930(struct Sprite* sprite) +{ + InitAnimSpritePos(sprite, 1); + StartSpriteAnim(sprite, gBattleAnimArgs[3]); + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +void sub_80FE988(struct Sprite* sprite) +{ + InitAnimSpritePos(sprite, 1); + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + InitAnimLinearTranslation(sprite); + sprite->data[5] = gBattleAnimArgs[3]; + sprite->callback = sub_80FE9E4; + sprite->callback(sprite); +} + +static void sub_80FE9E4(struct Sprite* sprite) +{ + if (TranslateAnimLinear(sprite)) + { + DestroySprite(sprite); + } + else + { + if (sprite->data[5] > 0x7F) + sprite->subpriority = sub_80A82E4(gBattleAnimTarget) + 1; + else + sprite->subpriority = sub_80A82E4(gBattleAnimTarget) + 6; + + sprite->pos2.x += Sin(sprite->data[5], 5); + sprite->pos2.y += Cos(sprite->data[5], 14); + sprite->data[5] = (sprite->data[5] + 15) & 0xFF; + } +} + +void sub_80FEA58(u8 taskId) +{ + gTasks[taskId].data[0]--; + if (gTasks[taskId].data[0] == -1) + { + gTasks[taskId].data[1]++; + gTasks[taskId].data[0] = 6; + gBattleAnimArgs[0] = 15; + gBattleAnimArgs[1] = 0; + gBattleAnimArgs[2] = 80; + gBattleAnimArgs[3] = 0; + CreateSpriteAndAnimate(&gUnknown_08592210, 0, 0, sub_80A82E4(gBattleAnimTarget) + 1); + } + + if (gTasks[taskId].data[1] == 15) + DestroyAnimVisualTask(taskId); +} + +void sub_80FEAD8(struct Sprite* sprite) +{ + sub_80A6980(sprite, TRUE); + sprite->data[0] = gBattleAnimArgs[3]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->data[5] = gBattleAnimArgs[2]; + InitAnimArcTranslation(sprite); + sprite->callback = sub_80FEB28; +} + +static void sub_80FEB28(struct Sprite* sprite) +{ + if (TranslateAnimArc(sprite)) + DestroyAnimSprite(sprite); +} + +void sub_80FEB44(struct Sprite* sprite) +{ + u16 a = Random2(); + u16 b; + + StartSpriteAnim(sprite, a & 7); + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + if (GetBattlerSide(gBattleAnimAttacker)) + { + sprite->pos1.x -= 20; + } + else + { + sprite->pos1.x += 20; + } + + b = Random2(); + sprite->data[0] = (b & 31) + 64; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + sub_80A7160(sprite); + sprite->data[5] = Random2() & 0xFF; + sprite->data[6] = sprite->subpriority; + sprite->callback = sub_80FEBFC; + sprite->callback(sprite); +} + +static void sub_80FEBFC(struct Sprite* sprite) +{ + if (sub_80A70E8(sprite)) + { + DestroyAnimSprite(sprite); + } + else + { + sprite->pos2.y += Cos(sprite->data[5], 12); + if (sprite->data[5] < 0x7F) + sprite->subpriority = sprite->data[6]; + else + sprite->subpriority = sprite->data[6] + 1; + + sprite->data[5] = (sprite->data[5] + 24) & 0xFF; + } +} + +// seed (sprouts a sapling from a seed.) +// Used by Leech Seed. +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: target x pixel offset +// arg 3: target y pixel offset +// arg 4: duration +// arg 5: wave amplitude +void AnimLeechSeed(struct Sprite* sprite) +{ + InitAnimSpritePos(sprite, 1); + if (GetBattlerSide(gBattleAnimAttacker)) + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[3]; + sprite->data[5] = gBattleAnimArgs[5]; + InitAnimArcTranslation(sprite); + sprite->callback = AnimLeechSeedStep; +} + +static void AnimLeechSeedStep(struct Sprite* sprite) +{ + if (TranslateAnimArc(sprite)) + { + sprite->invisible = 1; + sprite->data[0] = 10; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, AnimLeechSeedSprouts); + } +} + +static void AnimLeechSeedSprouts(struct Sprite* sprite) +{ + sprite->invisible = 0; + StartSpriteAnim(sprite, 1); + sprite->data[0] = 60; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +void sub_80FED28(struct Sprite* sprite) +{ + sub_80A6980(sprite, TRUE); + StartSpriteAnim(sprite, gBattleAnimArgs[4]); + if (gBattleAnimArgs[4] == 1) + sprite->oam.objMode = ST_OAM_OBJ_BLEND; + + sprite->data[0] = gBattleAnimArgs[3]; + sprite->data[1] = gBattleAnimArgs[2]; + sprite->callback = sub_80FED74; + sprite->callback(sprite); +} + +static void sub_80FED74(struct Sprite* sprite) +{ + sprite->pos2.x = Sin(sprite->data[1], 32); + sprite->pos2.y = Cos(sprite->data[1], -3) + ((sprite->data[2] += 24) >> 8); + if ((u16)(sprite->data[1] - 0x40) < 0x80) + { + sprite->oam.priority = (sub_80A8328(gBattleAnimTarget) & 3); + } + else + { + u8 priority = sub_80A8328(gBattleAnimTarget) + 1; + if (priority > 3) + priority = 3; + + sprite->oam.priority = priority; + } + + sprite->data[1] = (sprite->data[1] + 2) & 0xFF; + if (--sprite->data[0] == -1) + DestroyAnimSprite(sprite); +} + +void sub_80FEE1C(u8 taskId) +{ + if (IsContest() || !IsDoubleBattle()) + { + DestroyAnimVisualTask(taskId); + } + else + { + if (sub_80A8364(gBattleAnimTarget) == 1) + SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 3); + else + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); + + DestroyAnimVisualTask(taskId); + } +} + +void sub_80FEE78(struct Sprite* sprite) +{ + InitAnimSpritePos(sprite, 0); + sprite->data[0] = gBattleAnimArgs[3]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2]; + InitAnimLinearTranslation(sprite); + sprite->data[5] = 0x40; + sprite->callback = sub_80FEECC; + sprite->callback(sprite); +} + +static void sub_80FEECC(struct Sprite* sprite) +{ + if (!TranslateAnimLinear(sprite)) + { + sprite->pos2.x += Sin(sprite->data[5], 32); + sprite->pos2.y += Cos(sprite->data[5], -5); + if ((u16)(sprite->data[5] - 0x40) < 0x80) + sprite->subpriority = sub_80A82E4(gBattleAnimAttacker) - 1; + else + sprite->subpriority = sub_80A82E4(gBattleAnimAttacker) + 1; + + sprite->data[5] = (sprite->data[5] + 5) & 0xFF; + } + else + { + DestroyAnimSprite(sprite); + } +} + +void sub_80FEF44(struct Sprite* sprite) +{ + InitAnimSpritePos(sprite, 1); + sprite->data[0] = gBattleAnimArgs[3]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = sprite->pos1.x; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2]; + InitAnimLinearTranslation(sprite); + sprite->data[5] = 0x40; + sprite->callback = sub_80FEF98; + sprite->callback(sprite); +} + +static void sub_80FEF98(struct Sprite* sprite) +{ + if (!TranslateAnimLinear(sprite)) + { + sprite->pos2.x += Sin(sprite->data[5], 8); + if ((u16)(sprite->data[5] - 59) < 5 || (u16)(sprite->data[5] - 187) < 5) + sprite->oam.matrixNum ^= 0x8; + + sprite->data[5] = (sprite->data[5] + 5) & 0xFF; + } + else + { + DestroyAnimSprite(sprite); + } +} + +void sub_80FEFFC(struct Sprite* sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[1] = gBattleAnimArgs[1]; + sprite->data[2] = gBattleAnimArgs[2]; + sprite->callback = sub_80FF044; +} + +static void sub_80FF044(struct Sprite* sprite) +{ + if (!sprite->data[2]) + { + if (sprite->data[1] & 1) + { + sprite->data[0] = 0x80; + sprite->data[1] = 0; + sprite->data[2] = 0; + } + else + { + sprite->data[0] = sprite->data[1] & 1; + sprite->data[1] = sprite->data[1] & 1; + sprite->data[2] = sprite->data[1] & 1; + } + sprite->callback = sub_80FF090; + } + else + { + sprite->data[2]--; + sprite->pos1.x += sprite->data[0]; + sprite->pos1.y += sprite->data[1]; + } +} + +static void sub_80FF090(struct Sprite* sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker)) + sprite->pos2.x = -Sin(sprite->data[0], 25); + else + sprite->pos2.x = Sin(sprite->data[0], 25); + + sprite->data[0] = (sprite->data[0] + 2) & 0xFF; + sprite->data[1]++; + if (!(sprite->data[1] & 1)) + sprite->pos2.y++; + + if (sprite->data[1] > 80) + DestroyAnimSprite(sprite); +} + +// Animates a sprite that moves linearly from one location to another, with a +// single-cycle sine wave added to the y position along the way. +// Used by Razor Leaf and Magical Leaf. +// arg 0: initial x offset +// arg 1: initial y offset +// arg 2: target x offset +// arg 3: target y offset +// arg 4: translation duration +// arg 5: wave amplitude +// arg 6: target between double battle opponents (boolean) +void AnimTranslateLinearSingleSineWave(struct Sprite* sprite) +{ + InitAnimSpritePos(sprite, 1); + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + + sprite->data[0] = gBattleAnimArgs[4]; + if (!gBattleAnimArgs[6]) + { + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2]; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3]; + } + else + { + SetAverageBattlerPositions(gBattleAnimTarget, 1, &sprite->data[2], &sprite->data[4]); + sprite->data[2] += gBattleAnimArgs[2]; + sprite->data[4] += gBattleAnimArgs[3]; + } + + sprite->data[5] = gBattleAnimArgs[5]; + InitAnimArcTranslation(sprite); + if (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget)) + sprite->data[0] = 1; + else + sprite->data[0] = 0; + + sprite->callback = AnimTranslateLinearSingleSineWaveStep; +} + +static void AnimTranslateLinearSingleSineWaveStep(struct Sprite* sprite) +{ + bool8 destroy = FALSE; + s16 a = sprite->data[0]; + s16 b = sprite->data[7]; + s16 r0; + + sprite->data[0] = 1; + TranslateAnimArc(sprite); + r0 = sprite->data[7]; + sprite->data[0] = a; + if (b > 200 && r0 < 56 && sprite->oam.affineParam == 0) + sprite->oam.affineParam++; + + if (sprite->oam.affineParam && sprite->data[0]) + { + sprite->invisible ^= 1; + sprite->oam.affineParam++; + if (sprite->oam.affineParam == 30) + destroy = TRUE; + } + + if (sprite->pos1.x + sprite->pos2.x > 256 + || sprite->pos1.x + sprite->pos2.x < -16 + || sprite->pos1.y + sprite->pos2.y > 160 + || sprite->pos1.y + sprite->pos2.y < -16) + destroy = TRUE; + + if (destroy) + DestroyAnimSprite(sprite); +} + +// Animates particles in the Twister move animation. +// arg 0: duration +// arg 1: total y delta (the particles rise upward) +// arg 2: wave period (higher means faster wave) +// arg 3: wave amplitude +// arg 4: speedup frame (particles move faster at the end of the animation) +void AnimMoveTwisterParticle(struct Sprite* sprite) +{ + if (IsDoubleBattle() == TRUE) + SetAverageBattlerPositions(gBattleAnimTarget, 1, &sprite->pos1.x, &sprite->pos1.y); + + sprite->pos1.y += 32; + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[1] = gBattleAnimArgs[1]; + sprite->data[2] = gBattleAnimArgs[2]; + sprite->data[3] = gBattleAnimArgs[3]; + sprite->data[4] = gBattleAnimArgs[4]; + sprite->callback = AnimMoveTwisterParticleStep; +} + +static void AnimMoveTwisterParticleStep(struct Sprite* sprite) +{ + if (sprite->data[1] == 0xFF) + { + sprite->pos1.y -= 2; + } + else if (sprite->data[1] > 0) + { + sprite->pos1.y -= 2; + sprite->data[1] -= 2; + } + + sprite->data[5] += sprite->data[2]; + if (sprite->data[0] < sprite->data[4]) + sprite->data[5] += sprite->data[2]; + + sprite->data[5] &= 0xFF; + sprite->pos2.x = Cos(sprite->data[5], sprite->data[3]); + sprite->pos2.y = Sin(sprite->data[5], 5); + if (sprite->data[5] < 0x80) + sprite->oam.priority = sub_80A8328(gBattleAnimTarget) - 1; + else + sprite->oam.priority = sub_80A8328(gBattleAnimTarget) + 1; + + if (--sprite->data[0] == 0) + DestroyAnimSprite(sprite); +} + +void sub_80FF374(struct Sprite* sprite) +{ + sub_80A6980(sprite, FALSE); + sprite->affineAnimPaused = 1; + StartSpriteAffineAnim(sprite, gBattleAnimArgs[2]); + sprite->data[6] = gBattleAnimArgs[2]; + sprite->data[7] = gBattleAnimArgs[3]; + sprite->callback = sub_80FF3B0; +} + +static void sub_80FF3B0(struct Sprite* sprite) +{ + if ((u16)gBattleAnimArgs[7] == 0xFFFF) + { + sprite->affineAnimPaused = 0; + GetAnimBattlerSpriteId(1); + sprite->data[0] = 0x100; + sprite->callback = sub_80FF3EC; + } +} + +static void sub_80FF3EC(struct Sprite* sprite) +{ + GetAnimBattlerSpriteId(1); + if (!sprite->data[2]) + sprite->data[0] += 11; + else + sprite->data[0] -= 11; + + if (++sprite->data[1] == 6) + { + sprite->data[1] = 0; + sprite->data[2] ^= 1; + } + + if (sprite->affineAnimEnded) + { + if (--sprite->data[7] > 0) + StartSpriteAffineAnim(sprite, sprite->data[6]); + else + DestroyAnimSprite(sprite); + } +} + +void sub_80FF458(u8 taskId) +{ + u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); + if (gSprites[spriteId].invisible) + { + DestroyAnimVisualTask(taskId); + } + else + { + sub_80A7270(spriteId, 1); + gTasks[taskId].data[14] = gSprites[spriteId].oam.priority; + gSprites[spriteId].oam.priority = sub_80A8328(gBattleAnimTarget); + spriteId = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER); + gTasks[taskId].data[15] = gSprites[spriteId].oam.priority; + gSprites[spriteId].oam.priority = sub_80A8328(BATTLE_PARTNER(gBattleAnimTarget)); + gTasks[taskId].data[0] = gBattleAnimArgs[0]; + gTasks[taskId].data[1] = gBattleAnimArgs[1]; + gTasks[taskId].data[11] = 256; + gTasks[taskId].func = sub_80FF53C; + } +} + +static void sub_80FF53C(u8 taskId) +{ + u8 spriteId = GetAnimBattlerSpriteId(1); + gTasks[taskId].data[10] += gTasks[taskId].data[0]; + gSprites[spriteId].pos2.x = gTasks[taskId].data[10] >> 8; + if (GetBattlerSide(gBattleAnimTarget)) + gSprites[spriteId].pos2.x = -gSprites[spriteId].pos2.x; + + gTasks[taskId].data[11] += 16; + obj_id_set_rotscale(spriteId, gTasks[taskId].data[11], gTasks[taskId].data[11], 0); + sub_80A7E6C(spriteId); + if (--gTasks[taskId].data[1] == 0) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = sub_80FF5CC; + } +} + +static void sub_80FF5CC(u8 taskId) +{ + if ((u16)gBattleAnimArgs[7] == 0xFFFF) + { + if (gTasks[taskId].data[0] == 0) + { + u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); + sub_80A7344(spriteId); + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = 0; + gSprites[spriteId].oam.priority = gTasks[taskId].data[14]; + spriteId = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER); + gSprites[spriteId].oam.priority = gTasks[taskId].data[15]; + gTasks[taskId].data[0]++; + return; + } + } + else + { + if (gTasks[taskId].data[0] == 0) + return; + } + + gTasks[taskId].data[0]++; + if (gTasks[taskId].data[0] == 3) + DestroyAnimVisualTask(taskId); +} + +void sub_80FF698(struct Sprite* sprite) +{ + switch (sprite->data[0]) + { + case 0: + { + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) + gBattleAnimArgs[0] *= -1; + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[1]; + sprite->invisible = 1; + sprite->data[0]++; + break; + } + case 1: + { + sprite->invisible = 0; + if (sprite->affineAnimEnded) + { + ChangeSpriteAffineAnim(sprite, 1); + sprite->data[0] = 25; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->callback = sub_80A70C0; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + break; + } + } + } +} + +void sub_80FF768(struct Sprite* sprite) +{ + if (!sprite->data[0]) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1); + sprite->pos2.x = gBattleAnimArgs[0]; + sprite->pos2.y = gBattleAnimArgs[1]; + sprite->subpriority = gBattleAnimArgs[2] + 30; + StartSpriteAnim(sprite, gBattleAnimArgs[3]); + sprite->data[2] = gBattleAnimArgs[4]; + sprite->data[0]++; + if (sprite->pos1.y + sprite->pos2.y > 120) + sprite->pos1.y += sprite->pos2.y + sprite->pos1.y - 120; + } + sprite->callback = sub_80FF8DC; +} + +void sub_80FF7EC(struct Sprite *sprite) +{ + s16 p1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + s16 p2 = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + s16 e1 = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + s16 e2 = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + + e1 -= p1; + e2 -= p2; + sprite->pos1.x = p1 + e1 * gBattleAnimArgs[0] / 100; + sprite->pos1.y = p2 + e2 * gBattleAnimArgs[0] / 100; + sprite->pos2.x = gBattleAnimArgs[1]; + sprite->pos2.y = gBattleAnimArgs[2]; + sprite->subpriority = gBattleAnimArgs[3] + 30; + StartSpriteAnim(sprite, gBattleAnimArgs[4]); + sprite->data[2] = gBattleAnimArgs[5]; + sprite->callback = sub_80FF8DC; + gUnknown_0203A0F8[0] = sprite->pos1.x; + gUnknown_0203A0F8[1] = sprite->pos1.y; + gUnknown_0203A0F8[2] = e1; + gUnknown_0203A0F8[3] = e2; +} + +static void sub_80FF8DC(struct Sprite* sprite) +{ + if (++sprite->data[0] > (sprite->data[2] - 10)) + sprite->invisible = sprite->data[0] % 2; + + if (sprite->data[0] > sprite->data[2]) + DestroyAnimSprite(sprite); +} + +void sub_80FF934(struct Sprite* sprite) +{ + if (!sprite->data[0]) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[1]; + sprite->data[1] = gBattleAnimArgs[2]; + sprite->data[2] = gBattleAnimArgs[3]; + sprite->data[3] = gBattleAnimArgs[4]; + } + + sprite->data[0]++; + sprite->pos2.x = sprite->data[1] * sprite->data[0]; + sprite->pos2.y = Sin((sprite->data[0] * 20) & 0xFF, sprite->data[2]); + if (sprite->data[0] > sprite->data[3]) + DestroyAnimSprite(sprite); +} + +void sub_80FF9B8(struct Sprite* sprite, s16 c) +{ + s32 a = (sprite->pos1.x * 256) | sprite->pos1.y; + s32 b = (sprite->data[6] * 256) | sprite->data[7]; + c *= 256; + sprite->data[5] = a; + sprite->data[6] = b; + sprite->data[7] = c; +} + +bool8 sub_80FF9E0(struct Sprite* sprite) +{ + u16 r10 = (u8)(sprite->data[5] >> 8); + u16 r9 = (u8)sprite->data[5]; + s32 r2 = (u8)(sprite->data[6] >> 8); + s32 r4 = (u8)sprite->data[6]; + s16 r6 = sprite->data[7] >> 8; + s16 r3 = sprite->data[7] & 0xFF; + s16 r4_2; + s16 r0; + s32 var1; + s32 var2; + + if (r2 == 0) + r2 = -32; + else if (r2 == 255) + r2 = 272; + + r4_2 = r4 - r9; + r0 = r2 - r10; + var1 = r0 * r3 / r6; + var2 = r4_2 * r3 / r6; + sprite->pos1.x = var1 + r10; + sprite->pos1.y = var2 + r9; + if (++r3 == r6) + return TRUE; + + sprite->data[7] = (r6 << 8) | r3; + return FALSE; +} + +void sub_80FFA84(struct Sprite* sprite) +{ + if (sprite->data[0] == 10) + StartSpriteAffineAnim(sprite, 1); + + sprite->data[0]++; + if (sprite->data[0] > 50) + DestroyAnimSprite(sprite); +} + +static void sub_80FFAB4(struct Sprite* sprite) +{ + sprite->data[0] += sprite->data[3] * 128 / sprite->data[4]; + if (sprite->data[0] >= 128) + { + sprite->data[1]++; + sprite->data[0] = 0; + } + + sprite->pos2.y = Sin(sprite->data[0] + 128, 30 - sprite->data[1] * 8); + if (sub_80FF9E0(sprite)) + { + sprite->pos2.y = 0; + sprite->data[0] = 0; + sprite->callback = sub_80FFA84; + } +} + +void sub_80FFB18(struct Sprite* sprite) +{ + s16 e1; + s16 e2; + InitAnimSpritePos(sprite, 0); + e1 = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + e2 = GetBattlerSpriteCoord(gBattleAnimTarget, 1); + if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget) + { + sprite->data[6] = e1; + sprite->data[7] = e2 + 10; + sub_80FF9B8(sprite, 60); + sprite->data[3] = 1; + } + else + { + sprite->data[6] = e1; + sprite->data[7] = e2 + 10; + sub_80FF9B8(sprite, 60); + sprite->data[3] = 3; + } + + sprite->data[4] = 60; + sprite->callback = sub_80FFAB4; +} + +static void sub_80FFB90(struct Sprite* sprite) +{ + int zero; + sprite->data[0] += ((sprite->data[3] * 128) / sprite->data[4]); + zero = 0; + if (sprite->data[0] > 0x7F) + { + sprite->data[1]++; + sprite->data[0] = zero; + } + + sprite->pos2.y = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8); + if (sub_80FF9E0(sprite)) + { + sprite->pos2.y = zero; + sprite->data[0] = zero; + DestroyAnimSprite(sprite); + } +} + +void sub_80FFBF4(struct Sprite* sprite) +{ + s16 e = GetBattlerSpriteCoord(gBattleAnimTarget, 1); + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) + { + sprite->data[6] = 0; + sprite->data[7] = e + 10; + sub_80FF9B8(sprite, 40); + sprite->data[3] = 3; + sprite->data[4] = 0x3C; + sprite->callback = sub_80FFAB4; + } + else + { + sprite->data[6] = 255; + sprite->data[7] = e + 10; + if (IsContest()) + sprite->data[6] = 0; + + sub_80FF9B8(sprite, 40); + sprite->data[3] = 3; + sprite->data[4] = 0x3C; + sprite->callback = sub_80FFB90; + } +} + +void sub_80FFC70(struct Sprite* sprite) +{ + if (sprite->data[0] == 0) + { + sub_80A6980(sprite, FALSE); + sprite->data[1] = gBattleAnimArgs[2]; + } + + sprite->data[0]++; + sprite->pos2.y = sprite->data[1] * sprite->data[0]; + if (sprite->animEnded) + DestroyAnimSprite(sprite); +} + +void sub_80FFCB4(struct Sprite* sprite) +{ + s16 p1; + s16 p2; + sub_80A6980(sprite, FALSE); + p1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); + p2 = GetBattlerSpriteCoord(gBattleAnimAttacker, 1); + if (BATTLE_PARTNER(gBattleAnimTarget) == gBattleAnimAttacker) + { + sprite->data[6] = p1; + sprite->data[7] = p2 + 10; + sub_80FF9B8(sprite, 60); + sprite->data[3] = 1; + } + else + { + sprite->data[6] = p1; + sprite->data[7] = p2 + 10; + sub_80FF9B8(sprite, 60); + sprite->data[3] = 3; + } + + sprite->data[4] = 60; + sprite->callback = sub_80FFD2C; +} + +static void sub_80FFD2C(struct Sprite* sprite) +{ + int zero; + sprite->data[0] += ((sprite->data[3] * 128) / sprite->data[4]); + zero = 0; + if (sprite->data[0] > 127) + { + sprite->data[1]++; + sprite->data[0] = zero; + } + + sprite->pos2.y = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8); + if (sprite->pos2.y == 0) + PlaySE12WithPanning(SE_W145B, BattleAnimAdjustPanning(63)); + + if (sub_80FF9E0(sprite)) + { + sprite->pos2.y = 0; + sprite->data[0] = 0; + sprite->callback = sub_80FFA84; + PlaySE12WithPanning(SE_W145B, BattleAnimAdjustPanning(-64)); + } +} + +void sub_80FFDBC(struct Sprite* sprite) +{ + int a; + int b; + + if (!sprite->data[0]) + { + if (!IsContest()) + { + sprite->data[1] = gBattleAnimArgs[1]; + sprite->pos1.x = 120; + } + else + { + a = gBattleAnimArgs[1] - 32; + if (a < 0) + b = gBattleAnimArgs[1] + 0xDF; + else + b = a; + + sprite->data[1] = a - ((b >> 8) << 8); + sprite->pos1.x = 70; + } + + sprite->pos1.y = gBattleAnimArgs[0]; + sprite->data[2] = gBattleAnimArgs[0]; + sprite->data[4] = 20; + sprite->pos2.x = Cos(sprite->data[1], 60); + sprite->pos2.y = Sin(sprite->data[1], 20); + sprite->callback = sub_80FFE58; + if (sprite->data[1] > 0 && sprite->data[1] < 192) + sprite->subpriority = 31; + else + sprite->subpriority = 29; + } +} + +static void sub_80FFE58(struct Sprite* sprite) +{ + switch (sprite->data[3]) + { + case 0: + if (sprite->data[2] > 78) + { + sprite->data[3] = 1; + StartSpriteAffineAnim(sprite, 1); + break; + } + else + { + sprite->data[2] += sprite->data[4] / 10; + sprite->data[4] += 3; + sprite->pos1.y = sprite->data[2]; + break; + } + break; + case 1: + if (sprite->data[3] && sprite->affineAnimEnded) + { + sprite->data[0] = 0; + sprite->data[2] = 0; + sprite->callback = sub_80FFEC4; + } + break; + } +} + +static void sub_80FFEC4(struct Sprite* sprite) +{ + if (sprite->data[2] == gUnknown_08592700[sprite->data[0]][1]) + { + if (gUnknown_08592700[sprite->data[0]][2] == 127) + { + sprite->data[0] = 0; + sprite->callback = sub_80FFF7C; + } + + sprite->data[2] = 0; + sprite->data[0]++; + } + else + { + sprite->data[2]++; + sprite->data[1] = (gUnknown_08592700[sprite->data[0]][0] * gUnknown_08592700[sprite->data[0]][2] + sprite->data[1]) & 0xFF; + if (!IsContest()) + { + if ((u16)(sprite->data[1] - 1) < 191) + sprite->subpriority = 31; + else + sprite->subpriority = 29; + } + + sprite->pos2.x = Cos(sprite->data[1], 60); + sprite->pos2.y = Sin(sprite->data[1], 20); + } +} + +static void sub_80FFF7C(struct Sprite* sprite) +{ + if (sprite->data[0] > 20) + DestroyAnimSprite(sprite); + + sprite->invisible = sprite->data[0] % 2; + sprite->data[0]++; +} + +void sub_80FFFC0(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + task->data[4] = sub_80A82E4(gBattleAnimTarget) - 1; + task->data[6] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + task->data[7] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + task->data[10] = sub_80A861C(gBattleAnimTarget, 1); + task->data[11] = sub_80A861C(gBattleAnimTarget, 0); + task->data[5] = (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) ? 1 : -1; + task->data[9] = 56 - (task->data[5] * 64); + task->data[8] = task->data[7] - task->data[9] + task->data[6]; + task->data[2] = CreateSprite(&gUnknown_08592778, task->data[8], task->data[9], task->data[4]); + if (task->data[2] == MAX_SPRITES) + DestroyAnimVisualTask(taskId); + + gSprites[task->data[2]].data[0] = 10; + gSprites[task->data[2]].data[1] = task->data[8]; + gSprites[task->data[2]].data[2] = task->data[6] - (task->data[10] / 2 + 10) * task->data[5]; + gSprites[task->data[2]].data[3] = task->data[9]; + gSprites[task->data[2]].data[4] = task->data[7] + (task->data[11] / 2 + 10) * task->data[5]; + gSprites[task->data[2]].data[5] = sub_8100504(&gSprites[task->data[2]]); + InitAnimArcTranslation(&gSprites[task->data[2]]); + task->func = sub_8100128; +} + +static void sub_8100128(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + struct Sprite* sprite = &gSprites[task->data[2]]; + int a = task->data[0]; + switch (a) + { + case 4: + sub_8100524(task, taskId); + if (TranslateAnimArc(sprite)) + { + task->data[15] = 5; + task->data[0] = 0xFF; + } + break; + case 8: + sub_8100524(task, taskId); + if (TranslateAnimArc(sprite)) + { + task->data[15] = 9; + task->data[0] = 0xFF; + } + break; + case 0: + sub_8100524(task, taskId); + if (TranslateAnimArc(sprite)) + { + task->data[15] = 1; + task->data[0] = 0xFF; + } + break; + case 1: + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0] = 10; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = task->data[6]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = task->data[7]; + sprite->data[5] = sub_8100504(sprite); + task->data[4] += 2; + task->data[3] = a; + sprite->subpriority = task->data[4]; + StartSpriteAnim(sprite, task->data[3]); + InitAnimArcTranslation(sprite); + task->data[0]++; + break; + case 2: + sub_8100524(task, taskId); + if (TranslateAnimArc(sprite)) + { + task->data[15] = 3; + task->data[0] = 0xFF; + } + break; + case 3: + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0] = 10; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = task->data[6] - ((task->data[10] / 2) + 10) * task->data[5]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = task->data[7] - ((task->data[11] / 2) + 10) * task->data[5]; + sprite->data[5] = sub_8100504(sprite); + task->data[3] = 2; + sprite->subpriority = task->data[4]; + StartSpriteAnim(sprite, task->data[3]); + InitAnimArcTranslation(sprite); + task->data[0]++; + break; + case 5: + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0] = 10; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = task->data[6] + ((task->data[10] / 2) + 10) * task->data[5]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = task->data[7] + ((task->data[11] / 2) + 10) * task->data[5]; + sprite->data[5] = sub_8100504(sprite); + task->data[4] -= 2; + task->data[3] = 3; + sprite->subpriority = task->data[4]; + StartSpriteAnim(sprite, task->data[3]); + InitAnimArcTranslation(sprite); + task->data[0]++; + break; + case 6: + sub_8100524(task, taskId); + if (TranslateAnimArc(sprite)) + { + task->data[15] = 7; + task->data[0] = 0xFF; + } + break; + case 7: + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0] = 10; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = task->data[6]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = task->data[7]; + sprite->data[5] = sub_8100504(sprite); + task->data[4] += 2; + task->data[3] = 4; + sprite->subpriority = task->data[4]; + StartSpriteAnim(sprite, task->data[3]); + InitAnimArcTranslation(sprite); + task->data[0]++; + break; + case 9: + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0] = 10; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = task->data[6] - ((task->data[10] / 2) + 10) * task->data[5]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = task->data[7] + ((task->data[11] / 2) + 10) * task->data[5]; + sprite->data[5] = sub_8100504(sprite); + task->data[3] = 5; + sprite->subpriority = task->data[4]; + StartSpriteAnim(sprite, task->data[3]); + InitAnimArcTranslation(sprite); + task->data[0]++; + break; + case 10: + sub_8100524(task, taskId); + if (TranslateAnimArc(sprite)) + { + task->data[15] = 11; + task->data[0] = 0xFF; + } + break; + case 11: + { + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0] = 10; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = task->data[8]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = task->data[9]; + sprite->data[5] = sub_8100504(sprite); + task->data[4] -= 2; + task->data[3] = 6; + sprite->subpriority = task->data[4]; + StartSpriteAnim(sprite, task->data[3]); + InitAnimArcTranslation(sprite); + task->data[0]++; + break; + } + case 12: + sub_8100524(task, taskId); + if (TranslateAnimArc(sprite)) + { + DestroySprite(sprite); + task->data[0]++; + } + break; + case 13: + if (task->data[12] == 0) + DestroyAnimVisualTask(taskId); + break; + case 0xFF: + if (++task->data[1] > 5) + { + task->data[1] = 0; + task->data[0] = task->data[15]; + } + break; + } +} + +static s16 sub_8100504(struct Sprite* sprite) +{ + s16 var = 8; + if (sprite->data[4] < sprite->pos1.y) + var = -var; + + return var; +} + +static void sub_8100524(struct Task* task, u8 taskId) +{ + task->data[14]++; + if (task->data[14] > 0) + { + u8 spriteId; + s16 spriteX; + s16 spriteY; + task->data[14] = 0; + spriteX = gSprites[task->data[2]].pos1.x + gSprites[task->data[2]].pos2.x; + spriteY = gSprites[task->data[2]].pos1.y + gSprites[task->data[2]].pos2.y; + spriteId = CreateSprite(&gUnknown_08592778, spriteX, spriteY, task->data[4]); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].data[6] = taskId; + gSprites[spriteId].data[7] = 12; + gTasks[taskId].data[12]++; + gSprites[spriteId].data[0] = task->data[13] & 1; + gTasks[taskId].data[13]++; + StartSpriteAnim(&gSprites[spriteId], task->data[3]); + gSprites[spriteId].subpriority = task->data[4]; + gSprites[spriteId].callback = sub_80CC408; + } + } +} + +static void sub_80CC408(struct Sprite* sprite) +{ + sprite->data[0]++; + if (sprite->data[0] > 1) + { + sprite->data[0] = 0; + sprite->invisible ^= 1; + sprite->data[1]++; + if (sprite->data[1] > 8) + { + gTasks[sprite->data[6]].data[sprite->data[7]]--; + DestroySprite(sprite); + } + } +} + +void sub_8100640(struct Sprite* sprite) +{ + u8 battler; + if (!gBattleAnimArgs[6]) + battler = gBattleAnimAttacker; + else + battler = gBattleAnimTarget; + + if (GetBattlerSide(battler) != 0) + { + sprite->data[4] = 0; + sprite->data[2] = gBattleAnimArgs[3]; + sprite->pos1.x = 0xFFF0; + } + else + { + sprite->data[4] = 1; + sprite->data[2] = -gBattleAnimArgs[3]; + sprite->pos1.x = 0x100; + } + + sprite->data[1] = gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[3] = gBattleAnimArgs[4]; + switch (gBattleAnimArgs[5]) + { + case 0: + sprite->pos1.y = gBattleAnimArgs[0]; + sprite->oam.priority = sub_80A8328(battler); + break; + case 1: + sprite->pos1.y = gBattleAnimArgs[0]; + sprite->oam.priority = sub_80A8328(battler) + 1; + break; + case 2: + sprite->pos1.y = GetBattlerSpriteCoord(battler, 3) + gBattleAnimArgs[0]; + sprite->oam.priority = sub_80A8328(battler); + break; + case 3: + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[0]; + GetAnimBattlerSpriteId(ANIM_TARGET); + sprite->oam.priority = sub_80A8328(battler) + 1; + break; + } + + sprite->callback = sub_810074C; +} + +static void sub_810074C(struct Sprite* sprite) +{ + int a = sprite->data[7]; + sprite->data[7]++; + sprite->pos2.y = (sprite->data[1] * gSineTable[sprite->data[0]]) >> 8; + sprite->pos2.x = sprite->data[2] * a; + sprite->data[0] = (sprite->data[3] * a) & 0xFF; + if (!sprite->data[4]) + { + if (sprite->pos2.x + sprite->pos1.x <= 0xF7) + return; + } + else + { + if (sprite->pos2.x + sprite->pos1.x > -16) + return; + } + + move_anim_8074EE0(sprite); +} + +void sub_81007C4(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + switch (task->data[0]) + { + case 0: + task->data[8] = IndexOfSpritePaletteTag(ANIM_TAG_LEAF) * 16 + 256; + task->data[12] = IndexOfSpritePaletteTag(ANIM_TAG_RAZOR_LEAF) * 16 + 256; + task->data[0]++; + break; + case 1: + if (++task->data[9] >= 0) + { + task->data[9] = 0; + BlendPalette(task->data[8], 16, task->data[10], gMagicalLeafBlendColors[task->data[11]]); + BlendPalette(task->data[12], 16, task->data[10], gMagicalLeafBlendColors[task->data[11]]); + if (++task->data[10] == 17) + { + task->data[10] = 0; + if (++task->data[11] == 7) + task->data[11] = 0; + } + } + break; + } + + if (gBattleAnimArgs[7] == -1) + DestroyAnimVisualTask(taskId); +} + +void sub_8100898(struct Sprite* sprite) +{ + u8 a; + u8 b; + u16 c; + u16 x; + u16 y; + + if (gBattleAnimArgs[4] == 0) + { + DestroyAnimSprite(sprite); + } + else + { + if (gBattleAnimArgs[0] == 0) + { + a = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + b = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + } + else + { + a = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + b = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + } + + sprite->data[0] = gBattleAnimArgs[4]; + if (gBattleAnimArgs[1] == 0) + { + sprite->pos1.x = gBattleAnimArgs[2] + a; + sprite->pos1.y = gBattleAnimArgs[3] + b; + sprite->data[5] = a; + sprite->data[6] = b; + } + else + { + sprite->pos1.x = a; + sprite->pos1.y = b; + sprite->data[5] = gBattleAnimArgs[2] + a; + sprite->data[6] = gBattleAnimArgs[3] + b; + } + + x = sprite->pos1.x; + sprite->data[1] = x * 16; + y = sprite->pos1.y; + sprite->data[2] = y * 16; + sprite->data[3] = (sprite->data[5] - sprite->pos1.x) * 16 / gBattleAnimArgs[4]; + sprite->data[4] = (sprite->data[6] - sprite->pos1.y) * 16 / gBattleAnimArgs[4]; + c = ArcTan2Neg(sprite->data[5] - x, sprite->data[6] - y); + if (IsContest()) + c -= 0x8000; + + sub_80A73E0(sprite, 0, 0x100, 0x100, c); + sprite->callback = sub_81009A0; + } +} + +static void sub_81009A0(struct Sprite* sprite) +{ + if (sprite->data[0]) + { + sprite->data[1] += sprite->data[3]; + sprite->data[2] += sprite->data[4]; + sprite->pos1.x = sprite->data[1] >> 4 ; + sprite->pos1.y = sprite->data[2] >> 4 ; + sprite->data[0]--; + } + else + { + move_anim_8074EE0(sprite); + } +} + +static void sub_81009DC(struct Sprite* sprite) +{ + if (sprite->animEnded) + DestroyAnimSprite(sprite); +} + +void sub_81009F8(struct Sprite* sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != 0) + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + } + else + { + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + } + + sprite->callback = sub_80A67D8; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +void sub_8100A50(struct Sprite* sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) == 0) + StartSpriteAnim(sprite, 1); + + sprite->callback = sub_81009DC; + sub_80A6864(sprite, gBattleAnimArgs[0]); + sprite->pos1.y += gBattleAnimArgs[1]; +} + +void sub_8100A94(struct Sprite* sprite) +{ + 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]; + StartSpriteAffineAnim(sprite, gBattleAnimArgs[6]); + StoreSpriteCallbackInData6(sprite, move_anim_8074EE0); + sprite->callback = sub_80A66DC; +} + +// Moves the sprite in a diagonally slashing motion across the target mon. +// Used by moves such as MOVE_CUT and MOVE_AERIAL_ACE. +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: slice direction; 0 = right-to-left, 1 = left-to-right +void AnimCuttingSlice(struct Sprite* sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1); + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) + sprite->pos1.y += 8; + + sprite->callback = AnimSliceStep; + if (gBattleAnimArgs[2] == 0) + { + sprite->pos1.x += gBattleAnimArgs[0]; + } + else + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->hFlip = 1; + } + + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[1] -= 0x400; + sprite->data[2] += 0x400; + sprite->data[5] = gBattleAnimArgs[2]; + if (sprite->data[5] == 1) + sprite->data[1] = -sprite->data[1]; +} + +void sub_8100B88(struct Sprite* sprite) +{ + u8 a; + u8 b; + switch (gBattleAnimArgs[3]) + { + case 1: + a = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 0); + b = GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 1); + break; + case 2: + a = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + b = GetBattlerSpriteCoord(gBattleAnimTarget, 1); + if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget))) + { + a = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 0) + a) / 2; + b = (GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), 1) + b) / 2; + } + break; + case 0: + default: + a = GetBattlerSpriteCoord(gBattleAnimTarget, 0); + b = GetBattlerSpriteCoord(gBattleAnimTarget, 1); + break; + } + + sprite->pos1.x = a; + sprite->pos1.y = b; + if (GetBattlerSide(gBattleAnimTarget) == 0) + sprite->pos1.y += 8; + + sprite->callback = AnimSliceStep; + if (gBattleAnimArgs[2] == 0) + { + sprite->pos1.x += gBattleAnimArgs[0]; + } + else + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->hFlip = 1; + } + + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[1] -= 0x400; + sprite->data[2] += 0x400; + sprite->data[5] = gBattleAnimArgs[2]; + if (sprite->data[5] == 1) + sprite->data[1] = -sprite->data[1]; +} + +static void AnimSliceStep(struct Sprite* sprite) +{ + sprite->data[3] += sprite->data[1]; + sprite->data[4] += sprite->data[2]; + if (sprite->data[5] == 0) + sprite->data[1] += 0x18; + else + sprite->data[1] -= 0x18; + + sprite->data[2] -= 0x18; + sprite->pos2.x = sprite->data[3] >> 8; + sprite->pos2.y = sprite->data[4] >> 8; + sprite->data[0]++; + if (sprite->data[0] == 20) + { + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->data[0] = 3; + sprite->callback = WaitAnimForDuration; + } +} + +void unref_sub_8100D38(struct Sprite* sprite) +{ + if (sprite->data[2] > 1) + { + if (sprite->data[3] & 1) + { + sprite->invisible = 0; + gSprites[sprite->data[0]].invisible = 0; + gSprites[sprite->data[1]].invisible = 0; + } + else + { + sprite->invisible = 1; + gSprites[sprite->data[0]].invisible = 1; + gSprites[sprite->data[1]].invisible = 1; + } + + sprite->data[2] = 0; + sprite->data[3]++; + } + else + { + sprite->data[2]++; + } + + if (sprite->data[3] == 10) + { + DestroySprite(&gSprites[sprite->data[0]]); + DestroySprite(&gSprites[sprite->data[1]]); + DestroyAnimSprite(sprite); + } +} + +void sub_8100E1C(struct Sprite* sprite) +{ + sprite->data[0] = gBattleAnimArgs[2]; + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + sprite->pos1.x -= gBattleAnimArgs[0]; + else + sprite->pos1.x += gBattleAnimArgs[0]; + + StartSpriteAnim(sprite, gBattleAnimArgs[5]); + sprite->data[1] = -gBattleAnimArgs[3]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[3] = gBattleAnimArgs[4]; + sprite->callback = sub_8100E80; + sprite->callback(sprite); +} + +static void sub_8100E80(struct Sprite* sprite) +{ + sprite->pos2.x = Cos(sprite->data[0], 100); + sprite->pos2.y = Sin(sprite->data[0], 20); + if (sprite->data[0] < 128) + sprite->subpriority = 0; + else + sprite->subpriority = 14; + + sprite->data[0] = (sprite->data[0] + sprite->data[1]) & 0xFF; + sprite->data[5] += 0x82; + sprite->pos2.y += sprite->data[5] >> 8; + sprite->data[2]++; + if (sprite->data[2] == sprite->data[3]) + DestroyAnimSprite(sprite); +} + +void sub_8100EF0(struct Sprite* sprite) +{ + if (IsContest()) + gBattleAnimArgs[1] += 8; + + sprite->pos1.x = GetBattlerSpriteCoord2(gBattleAnimAttacker, 0) + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord2(gBattleAnimAttacker, 1) + gBattleAnimArgs[1]; + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER || IsContest()) + sprite->oam.priority = sub_80A8328(gBattleAnimAttacker) + 1; + else + sprite->oam.priority = sub_80A8328(gBattleAnimAttacker); + + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[2] = (IndexOfSpritePaletteTag(ANIM_TAG_PROTECT) << 4) + 0x100; + sprite->data[7] = 16; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[7], sprite->data[7])); + sprite->callback = sub_8100FD4; +} + +static void sub_8100FD4(struct Sprite *sprite) +{ + int a; + int i; + sprite->data[5] += 96; + sprite->pos2.x = -(sprite->data[5] >> 8); + if (++sprite->data[1] > 1) + { + sprite->data[1] = 0; + a = gPlttBufferFaded[sprite->data[2] + 1]; + i = 0; + do + { + gPlttBufferFaded[sprite->data[2] + ++i] = gPlttBufferFaded[sprite->data[2] + i + 1]; + } while (i < 6); + + gPlttBufferFaded[sprite->data[2] + 7] = a; + } + + if (sprite->data[7] > 6 && sprite->data[0] >0 && ++sprite->data[6] > 1) + { + sprite->data[6] = 0; + sprite->data[7] -= 1; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[7], sprite->data[7])); + } + + if (sprite->data[0] > 0) + { + sprite->data[0] -= 1; + } + else if (++sprite->data[6] > 1) + { + sprite->data[6] = 0; + sprite->data[7]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[7], sprite->data[7])); + if (sprite->data[7] == 16) + { + sprite->invisible = 1; + sprite->callback = sub_80A67F4; + } + } +} + +void sub_81010CC(struct Sprite* sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + 0xFFE8; + sprite->data[0] = 0; + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[6] = 0; + sprite->data[7] = 16; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7])); + sprite->callback = sub_8101138; +} + +static void sub_8101138(struct Sprite* sprite) +{ + switch (sprite->data[0]) + { + case 0: + if (++sprite->data[2] > 0) + { + sprite->data[2] = 0; + if (((++sprite->data[1]) & 1) != 0) + { + if (sprite->data[6] <= 15) + sprite->data[6]++; + } + else if (sprite->data[7] > 0) + sprite->data[7]--; + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7])); + if (sprite->data[6] == 16 && sprite->data[7] == 0) + { + sprite->data[1] = 0; + sprite->data[0]++; + } + } + break; + case 1: + if (++sprite->data[1] > 8) + { + sprite->data[1] = 0; + StartSpriteAffineAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 2: + sub_8101298(sprite, 16, 4); + if (++sprite->data[1] > 2) + { + sprite->data[1] = 0; + sprite->pos1.y++; + } + + if (++sprite->data[2] <= 29) + break; + + if (sprite->data[2] & 1) + { + if (sprite->data[6] > 0) + sprite->data[6]--; + } + else if (sprite->data[7] <= 15) + { + sprite->data[7]++; + } + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7])); + if (sprite->data[6] == 0 && sprite->data[7] == 16) + { + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->data[0]++; + } + break; + case 3: + sprite->invisible = 1; + sprite->data[0]++; + break; + case 4: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0)); + DestroyAnimSprite(sprite); + break; + } +} + +static void sub_8101298(struct Sprite* sprite, int unk1, int unk2) +{ + if (sprite->data[3] <= 11) + sprite->data[4] += 2; + + if ((u16)(sprite->data[3] - 0x12) <= 0x17) + sprite->data[4] -= 2; + + if ((sprite->data[3]) > 0x2F) + sprite->data[4] += 2; + + sprite->pos2.x = sprite->data[4] / 9; + sprite->pos2.y = sprite->data[4] / 14; + if (sprite->pos2.y < 0) + sprite->pos2.y *= -1; + + sprite->data[3]++; + if (sprite->data[3] > 0x3B) + sprite->data[3] = 0; +} + +void sub_810130C(struct Sprite* sprite) +{ + if (!gBattleAnimArgs[2]) + sub_80A6838(sprite); + + sub_80A6864(sprite, gBattleAnimArgs[0]); + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[5]; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->data[2] = gBattleAnimArgs[4]; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->callback = sub_80A656C; +} + +void sub_810135C(struct Sprite* sprite) +{ + u8 battler; + if (!gBattleAnimArgs[2]) + battler = gBattleAnimAttacker; + else + battler = gBattleAnimTarget; + + if (IsDoubleBattle() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler))) + { + SetAverageBattlerPositions(battler, gBattleAnimArgs[6], &sprite->pos1.x, &sprite->pos1.y); + sub_80A6864(sprite, gBattleAnimArgs[0]); + sprite->pos1.y += gBattleAnimArgs[1]; + } + else + { + if (!gBattleAnimArgs[6]) + { + sprite->pos1.x = GetBattlerSpriteCoord(battler, 0); + sprite->pos1.y = GetBattlerSpriteCoord(battler, 1) + gBattleAnimArgs[1]; + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord(battler, 2); + sprite->pos1.y = GetBattlerSpriteCoord(battler, 3) + gBattleAnimArgs[1]; + } + + sub_80A6864(sprite, gBattleAnimArgs[0]); + } + + sprite->data[0] = gBattleAnimArgs[5]; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->data[2] = gBattleAnimArgs[4]; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->callback = sub_80A656C; +} + +void sub_8101440(struct Sprite* sprite) +{ + sub_80A6838(sprite); + if (GetBattlerSide(gBattleAnimAttacker) == 0) + { + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + } + else + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + StartSpriteAnim(sprite, 1); + } + + sprite->callback = sub_81014A0; +} + +static void sub_81014A0(struct Sprite* sprite) +{ + if (++sprite->data[0] > 30) + { + sprite->pos2.y = (30 - sprite->data[0]) / 3; + sprite->pos2.x = Sin(sprite->data[1] * 4, 3); + sprite->data[1]++; + } + + if (sprite->animEnded) + DestroyAnimSprite(sprite); +} + +void sub_81014F4(struct Sprite* sprite) +{ + sub_80A6838(sprite); + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + { + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[3] = 1; + } + else + { + sprite->pos1.x -= gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[3] = 0xFFFF; + StartSpriteAffineAnim(sprite, 1); + } + + sprite->callback = sub_8101560; +} + +static void sub_8101560(struct Sprite* sprite) +{ + sprite->pos2.y = -(sprite->data[0] / 0x28); + sprite->pos2.x = sprite->data[4] / 10; + sprite->data[4] += sprite->data[3] * 2; + sprite->data[0] += sprite->data[1]; + if (++sprite->data[1] > 60) + move_anim_8074EE0(sprite); +} + +void sub_81015AC(struct Sprite* sprite) +{ + sprite->pos1.x -= 32; + sprite->pos1.y -= 32; + sprite->data[0] = 20; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, sub_81015D4); +} + +static void sub_81015D4(struct Sprite* sprite) +{ + switch (sprite->data[5] & 1) + { + case 0: + sprite->data[0] = 1; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, sub_81015D4); + break; + case 1: + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.y = 0; + sprite->pos2.x = 0; + sprite->data[0] = 8; + sprite->data[2] = sprite->pos1.x + gUnknown_08592CD0[sprite->data[5] >> 8][0]; + sprite->data[4] = sprite->pos1.y + gUnknown_08592CD0[sprite->data[5] >> 8][1]; + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, sub_8101684); + sprite->data[5] += 0x100; + PlaySE12WithPanning(SE_W199, BattleAnimAdjustPanning(63)); + break; + } + + sprite->data[5] ^= 1; +} + +static void sub_8101684(struct Sprite* sprite) +{ + if ((sprite->data[5] >> 8) == 4) + { + sprite->data[0] = 10; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, sub_81016B8); + } + else + { + sprite->callback = sub_81015D4; + } +} + +static void sub_81016B8(struct Sprite* sprite) +{ + s16 a; + s16 b; + if (sprite->oam.affineParam == 0) + { + sprite->data[0] = 3; + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, sub_8101774); + } + else + { + switch (sprite->oam.affineParam) + { + case 1: + a = -8; + b = -8; + break; + case 2: + a = -8; + b = 8; + break; + case 3: + a = 8; + b = -8; + break; + default: + a = 8; + b = 8; + break; + } + + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.y = 0; + sprite->pos2.x = 0; + sprite->data[0] = 6; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + a; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + b; + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, sub_8101820); + } +} + +static void sub_8101774(struct Sprite* sprite) +{ + if (sprite->data[2] == 0) + { + if ((sprite->data[1] += 3) > 16) + sprite->data[1] = 16; + } + else if ((sprite->data[1] -= 3) < 0) + { + sprite->data[1] = 0; + } + + BlendPalettes(sub_80A75AC(1, 1, 1, 1, 1, 0, 0), sprite->data[1], RGB(31, 31, 31)); + if (sprite->data[1] == 16) + { + int pal; + sprite->data[2]++; + pal = sprite->oam.paletteNum; + LoadPalette(&gPlttBufferUnfaded[0x108 + pal * 16], pal * 16 | 0x101, 4); + PlaySE12WithPanning(SE_W043, BattleAnimAdjustPanning(63)); + } + else if (sprite->data[1] == 0) + { + sprite->callback = sub_8101820; + } +} + +static void sub_8101820(struct Sprite* sprite) +{ + if ((u16)gBattleAnimArgs[7] == 0xFFFF) + { + sprite->data[1] = 0; + sprite->data[0] = 0; + sprite->callback = sub_8101848; + } +} + +static void sub_8101848(struct Sprite* sprite) +{ + if (sprite->data[0] % 3 == 0) + { + sprite->data[1]++; + sprite->invisible ^= 1; + } + + sprite->data[0]++; + if (sprite->data[1] == 8) + DestroyAnimSprite(sprite); +} + +void sub_8101898(struct Sprite* sprite) +{ + sprite->oam.affineParam = gBattleAnimArgs[0]; + if ((s16)sprite->oam.affineParam == 1) + { + sprite->pos1.x -= 0x18; + sprite->pos1.y -= 0x18; + } + else if ((s16)sprite->oam.affineParam == 2) + { + sprite->pos1.x -= 0x18; + sprite->pos1.y += 0x18; + sprite->oam.matrixNum = 16; + } + else if ((s16)sprite->oam.affineParam == 3) + { + sprite->pos1.x += 0x18; + sprite->pos1.y -= 0x18; + sprite->oam.matrixNum = 8; + } + else + { + sprite->pos1.x += 0x18; + sprite->pos1.y += 0x18; + sprite->oam.matrixNum = 24; + } + + sprite->oam.tileNum = (sprite->oam.tileNum + 16); + sprite->callback = sub_81015AC; + sprite->callback(sprite); +} + +void sub_8101940(struct Sprite* sprite) +{ + sprite->invisible = 1; + sprite->data[0] = 0; + switch (gBattleAnimArgs[0]) + { + case 0: + sprite->callback = sub_8101998; + break; + case 1: + sprite->callback = sub_8101A74; + break; + case 2: + sprite->callback = sub_8101AC4; + break; + default: + sprite->callback = sub_8101B84; + break; + } +} + +static void sub_8101998(struct Sprite* sprite) +{ + sprite->data[0] = 6; + sprite->data[1] = (GetBattlerSide(gBattleAnimAttacker)) ? 2 : -2; + sprite->data[2] = 0; + sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker]; + StoreSpriteCallbackInData6(sprite, sub_81019E8); + sprite->callback = TranslateMonBGUntil; +} + +static void sub_81019E8(struct Sprite* sprite) +{ + if (sprite->data[0] == 0) + { + sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker]; + sub_80A7270(sprite->data[3], 0); + sprite->data[4] = (sprite->data[6] = GetBattlerSide(gBattleAnimAttacker)) ? 0x300 : 0xFFFFFD00; + sprite->data[5] = 0; + } + + sprite->data[5] += sprite->data[4]; + obj_id_set_rotscale(sprite->data[3], 0x100, 0x100, sprite->data[5]); + sub_80A73A0(sprite->data[3]); + if (++sprite->data[0] > 3) + { + sprite->data[0] = 0; + sprite->callback = sub_8101B84; + } +} + +static void sub_8101A74(struct Sprite* sprite) +{ + sprite->data[0] = 4; + sprite->data[1] = (GetBattlerSide(gBattleAnimAttacker)) ? -3 : 3; + sprite->data[2] = 0; + sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker]; + StoreSpriteCallbackInData6(sprite, sub_8101B84); + sprite->callback = TranslateMonBGUntil; +} + +static void sub_8101AC4(struct Sprite* sprite) +{ + if (++sprite->data[0] > 8) + { + sprite->data[0] = 0; + sprite->callback = sub_8101AE8; + } +} + +static void sub_8101AE8(struct Sprite* sprite) +{ + if (sprite->data[0] == 0) + { + sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker]; + sprite->data[6] = GetBattlerSide(gBattleAnimAttacker); + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + sprite->data[4] = 0xFC00; + sprite->data[5] = 0xC00; + } + else + { + sprite->data[4] = 0x400; + sprite->data[5] = 0xF400; + } + } + + sprite->data[5] += sprite->data[4]; + obj_id_set_rotscale(sprite->data[3], 0x100, 0x100, sprite->data[5]); + sub_80A73A0(sprite->data[3]); + if (++sprite->data[0] > 2) + { + sub_80A7344(sprite->data[3]); + sprite->callback = sub_8101B84; + } +} + +static void sub_8101B84(struct Sprite* sprite) +{ + DestroyAnimSprite(sprite); +} + +void sub_8101B90(struct Sprite *sprite) +{ + sprite->data[0] = 0; + sprite->callback = sub_8101BA0; +} + +static void sub_8101BA0(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->data[1] = 0; + sprite->data[2] = gBattlerSpriteIds[gBattleAnimAttacker]; + sprite->data[3] = GetBattlerSide(gBattleAnimAttacker); + sprite->data[4] = (sprite->data[3] != B_SIDE_PLAYER) ? 0x200 : -0x200; + sprite->data[5] = 0; + sub_80A7270(sprite->data[2], 0); + sprite->data[0]++; + // fall through + case 1: + sprite->data[5] += sprite->data[4]; + obj_id_set_rotscale(sprite->data[2], 0x100, 0x100, sprite->data[5]); + sub_80A73A0(sprite->data[2]); + if (++sprite->data[1] > 3) + { + sprite->data[1] = 0; + sprite->data[4] *= -1; + sprite->data[0]++; + } + break; + case 2: + sprite->data[5] += sprite->data[4]; + obj_id_set_rotscale(sprite->data[2], 0x100, 0x100, sprite->data[5]); + sub_80A73A0(sprite->data[2]); + if (++sprite->data[1] > 3) + { + sub_80A7344(sprite->data[2]); + DestroyAnimSprite(sprite); + } + break; + } +} + +void sub_8101C94(u8 taskId) +{ + u8 a; + + gTasks[taskId].data[0] = gBattlerSpriteIds[gBattleAnimAttacker]; + a = GetBattlerSide(gBattleAnimAttacker); + gTasks[taskId].data[1] = a; + gTasks[taskId].data[2] = 0; + switch (gBattleAnimArgs[0]) + { + default: + DestroyAnimVisualTask(taskId); + break; + case 0: + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = 8; + gTasks[taskId].data[4] = 0; + gTasks[taskId].data[5] = 3; + if (a == 0) + gTasks[taskId].data[5] *= -1; + + gTasks[taskId].func = sub_8101D2C; + break; + case 1: + gTasks[taskId].data[3] = 8; + gTasks[taskId].data[4] = 0x600; + gTasks[taskId].data[5] = 0xC0; + if (a == 0) + { + gTasks[taskId].data[4] = -gTasks[taskId].data[4]; + gTasks[taskId].data[5] = -gTasks[taskId].data[5]; + } + + gTasks[taskId].func = sub_8101EEC; + break; + } +} + +static void sub_8101D2C(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + switch (task->data[2]) + { + case 0: + if (task->data[3]) + { + task->data[4] += task->data[5]; + gSprites[task->data[0]].pos2.x = task->data[4]; + task->data[3]--; + } + else + { + task->data[3] = 8; + task->data[4] = 0; + task->data[5] = (task->data[1] == 0) ? -0xC0 : 0xC0; + sub_80A7270(task->data[0], 0); + task->data[2]++; + } + break; + case 1: + if (task->data[3]) + { + task->data[4] += task->data[5]; + obj_id_set_rotscale(task->data[0], 0x100, 0x100, task->data[4]); + sub_80A73A0(task->data[0]); + task->data[3]--; + } + else + { + task->data[3] = 8; + task->data[4] = gSprites[task->data[0]].pos2.x; + task->data[5] = (task->data[1] == 0) ? 0x2 : -0x2; + task->data[6] = 1; + task->data[2]++; + } + break; + case 2: + if (task->data[3]) + { + if (task->data[6]) + { + task->data[6]--; + } + else + { + if (task->data[3] & 1) + gSprites[task->data[0]].pos2.x = task->data[4] + task->data[5]; + else + gSprites[task->data[0]].pos2.x = task->data[4] - task->data[5]; + + task->data[6] = 1; + task->data[3]--; + } + } + else + { + gSprites[task->data[0]].pos2.x = task->data[4]; + task->data[3] = 12; + task->data[2]++; + } + break; + case 3: + if (task->data[3]) + { + task->data[3]--; + } + else + { + task->data[3] = 3; + task->data[4] = gSprites[task->data[0]].pos2.x; + task->data[5] = (task->data[1] == 0) ? 8 : -8; + task->data[2]++; + } + break; + case 4: + if (task->data[3]) + { + task->data[4] += task->data[5]; + gSprites[task->data[0]].pos2.x = task->data[4]; + task->data[3]--; + } + else + { + DestroyAnimVisualTask(taskId); + } + break; + } +} + +static void sub_8101EEC(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + if (task->data[3]) + { + task->data[4] -= task->data[5]; + obj_id_set_rotscale(task->data[0], 0x100, 0x100, task->data[4]); + sub_80A73A0(task->data[0]); + task->data[3]--; + } + else + { + sub_80A7344(task->data[0]); + DestroyAnimVisualTask(taskId); + } +} + +void sub_8101F40(struct Sprite* sprite) +{ + if (gBattleAnimArgs[0] == 0) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[1]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2]; + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[1]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[2]; + } + + sprite->data[0] = 0; + sprite->data[1] = 0; + StoreSpriteCallbackInData6(sprite, sub_810208C); + sprite->callback = sub_80A67D8; +} + +void sub_8101FA8(struct Sprite* sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + 0xFFD0; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + StoreSpriteCallbackInData6(sprite, sub_8102044); + sprite->callback = sub_80A67D8; +} + +void sub_8101FF0(struct Sprite* sprite) +{ + sprite->pos1.x = sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + 0xFFD0 + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + StartSpriteAnim(sprite, 1); + sprite->data[0] = 0; + sprite->data[1] = 0; + sprite->callback = sub_810208C; +} + +static void sub_8102044(struct Sprite* sprite) +{ + if (++sprite->data[0] > 8) + { + sprite->data[0] = 12; + sprite->data[1] = 8; + sprite->data[2] = 0; + StoreSpriteCallbackInData6(sprite, sub_810207C); + sprite->callback = TranslateSpriteOverDuration; + } +} + +static void sub_810207C(struct Sprite* sprite) +{ + sprite->data[0] = 0; + sprite->data[1] = 0; + sprite->callback = sub_810208C; +} + +static void sub_810208C(struct Sprite* sprite) +{ + if (++sprite->data[0] > 1) + { + sprite->data[0] = 0; + sprite->invisible = !sprite->invisible; + if (++sprite->data[1] > 8) + DestroyAnimSprite(sprite); + } +} + +void sub_81020D8(struct Sprite* sprite) +{ + if (gBattleAnimArgs[0] == 0) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[1]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[2]; + } + else + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[1]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[2]; + } + + sprite->data[0] = 0; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->callback = sub_810213C; +} + +static void sub_810213C(struct Sprite* sprite) +{ + if (++sprite->data[0] > sprite->data[1]) + { + sprite->data[0] = 0; + sprite->pos1.y--; + } + + sprite->pos1.y -= sprite->data[0]; + if (sprite->animEnded) + DestroyAnimSprite(sprite); +} + +void sub_810217C(struct Sprite* sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) - 12; + sprite->data[0] = 0; + sprite->data[1] = 2; + sprite->data[2] = 0; + sprite->data[3] = 0; + sprite->data[4] = 0; + sprite->data[5] = BattleAnimAdjustPanning(-64); + sprite->callback = sub_81021CC; +} + +static void sub_81021CC(struct Sprite* sprite) +{ + if (++sprite->data[0] >= sprite->data[1]) + { + sprite->invisible = !sprite->invisible; + if (!sprite->invisible) + { + sprite->data[4]++; + if (!(sprite->data[4] & 1)) + PlaySE12WithPanning(SE_W207B, sprite->data[5]); + } + + sprite->data[0] = 0; + if (++sprite->data[2] > 1) + { + sprite->data[2] = 0; + sprite->data[1]++; + } + } + + if (sprite->animEnded && sprite->data[1] > 16 && sprite->invisible) + DestroyAnimSprite(sprite); +} + +void sub_8102268(struct Sprite* sprite) +{ + if (sprite->data[0] == 0) + { + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[1]; + if (IsContest()) + sprite->pos1.y += 10; + + sprite->data[0]++; + } + + if ((u16)gBattleAnimArgs[7] == 0xFFFF) + DestroyAnimSprite(sprite); +} + +void sub_81022D4(u8 taskId) +{ + if (gTasks[taskId].data[2] == 1) + { + gBattleAnimArgs[7] = 0xFFFF; + gTasks[taskId].data[2]++; + } + else if (gTasks[taskId].data[2] == 2) + { + DestroyAnimVisualTask(taskId); + } + else + { + if (++gTasks[taskId].data[0] == 4) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - gTasks[taskId].data[1], gTasks[taskId].data[1])); + if (gTasks[taskId].data[1] == 16) + gTasks[taskId].data[2]++; + } + } +} + +void sub_810234C(struct Sprite* sprite) +{ + sub_80A6980(sprite, FALSE); + sprite->animPaused = 1; + sprite->data[0] = gBattleAnimArgs[2]; + sprite->callback = sub_810237C; +} + +static void sub_810237C(struct Sprite* sprite) +{ + if (sprite->data[0]) + { + sprite->data[0]--; + } + else + { + sprite->animPaused = 0; + sprite->data[0] = 30; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + } +} + +void sub_81023E0(u8 taskId) +{ + if (++gTasks[taskId].data[0] == 4) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[1], 16 - gTasks[taskId].data[1])); + if (gTasks[taskId].data[1] == 16) + DestroyAnimVisualTask(taskId); + } +} + +void unref_sub_8102434(u8 taskId) +{ + u8 i; + for (i = 0; i < gBattlersCount; i++) + { + if (gBattleAnimArgs[0] == 1 && GetBattlerSide(i) == B_SIDE_PLAYER) + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[i]); + + if (gBattleAnimArgs[1] == 1 && GetBattlerSide(i) == B_SIDE_OPPONENT) + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[i]); + } + + DestroyAnimVisualTask(taskId); +} + +void unref_sub_81024A8(u8 taskId) +{ + u8 i; + for (i = 0; i < gBattlersCount; i++) + SetHealthboxSpriteVisible(gHealthboxSpriteIds[i]); + + DestroyAnimVisualTask(taskId); +} + +void sub_81024E0(struct Sprite* sprite) +{ + if (IsContest()) + { + sprite->pos1.x = 48; + sprite->pos1.y = 40; + } + else + { + sprite->pos1.x = gBattleAnimArgs[0]; + sprite->pos1.y = gBattleAnimArgs[1]; + } + + sprite->oam.shape = 0; + sprite->oam.size = 3; + sprite->data[0] = 0; + sprite->callback = sub_8102528; +} + +static void sub_8102528(struct Sprite* sprite) +{ + if (sprite->data[0]) + DestroyAnimSprite(sprite); +} + +void sub_8102540(struct Sprite* sprite) +{ + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[0]; + sprite->pos1.y = gBattleAnimArgs[1]; + sprite->data[0] = 0; + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->data[3] = 0; + sprite->data[4] = 1; + sprite->callback = sub_8102584; +} + +static void sub_8102584(struct Sprite* sprite) +{ + if (++sprite->data[1] > 1) + { + sprite->data[1] = 0; + if (sprite->data[2] < 120) + { + sprite->pos1.y++; + sprite->data[2]++; + } + } + + if (sprite->data[0]) + DestroyAnimSprite(sprite); +} + +void sub_81026A8(u8); + + +void sub_81025C0(u8 taskId) +{ + int a = sub_80A75AC(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; + int b; + int c; + int d; + + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = a; + gTasks[taskId].data[4] = 0; + gTasks[taskId].data[5] = 0; + gTasks[taskId].data[6] = 0; + gTasks[taskId].data[7] = 13; + gTasks[taskId].data[8] = 14; + gTasks[taskId].data[9] = 15; + b = sub_80A76C4(1, 1, 1, 1); + c = a | b; + sub_80A8048(&gTasks[taskId].data[14], &gTasks[taskId].data[15], (void*)c); + b = b | (0x10000 << IndexOfSpritePaletteTag(ANIM_TAG_MOON)); + d = IndexOfSpritePaletteTag(ANIM_TAG_GREEN_SPARKLE); + BeginNormalPaletteFade((0x10000 << d) | b, 0, 0, 16, RGB(27, 29, 31)); + gTasks[taskId].func = sub_81026A8; + gTasks[taskId].func(taskId); +} + +void sub_81026A8(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + switch (task->data[0]) + { + case 0: + if (++task->data[1] > 0) + { + u16 color; + u16 bitmask; + u16 r3; + u16 i; + u16 j; + task->data[1] = 0; + if (++task->data[2] <= 15) + { + u16 red; + u16 green; + u16 blue; + task->data[4] += task->data[7]; + task->data[5] += task->data[8]; + task->data[6] += task->data[9]; + red = task->data[4] >> 3; + green = task->data[5] >> 3; + blue = task->data[6] >> 3; + color = RGB(red, green, blue); + } + else + { + color = RGB(27, 29, 31); + task->data[0]++; + } + + bitmask = 1; + r3 = 0; + for (i = 0; i <= 15; i++) + { + if (task->data[3] & bitmask) + { + for (j = 1; j <= 15; j++) + { + gPlttBufferFaded[r3 + j] = color; + } + } + + bitmask <<= 1; + r3 += 16; + } + } + break; + case 1: + if (!gPaletteFade.active) + { + u8 spriteId; + for (spriteId = 0; spriteId < MAX_SPRITES; spriteId++) + { + if (gSprites[spriteId].template == &gUnknown_08592EBC || gSprites[spriteId].template == &gBattleAnimSpriteTemplate_8592EEC) + gSprites[spriteId].data[0] = 1; + } + + task->data[1] = 0; + task->data[0]++; + } + break; + case 2: + if (++task->data[1] > 30) + { + BeginNormalPaletteFade((u32)sub_80A8050(task->data[14], task->data[15]), 0, 16, 0, RGB(27, 29, 31)); + task->data[0]++; + } + break; + case 3: + if (!gPaletteFade.active) + DestroyAnimVisualTask(taskId); + break; + } +} + +void sub_8102844(struct Sprite* sprite) +{ + if (gBattleAnimArgs[2] < 2) + gBattleAnimArgs[2] = 2; + + if (gBattleAnimArgs[2] > 0x7F) + gBattleAnimArgs[2] = 0x7F; + + sprite->data[0] = 0; + sprite->data[1] = gBattleAnimArgs[2]; + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[0]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[1]; + sprite->data[6] = sprite->pos1.x; + sprite->data[7] = sprite->pos1.y; + if (IsContest()) + { + sprite->oam.matrixNum = 8; + sprite->pos1.x += 40; + sprite->pos1.y += 20; + sprite->data[2] = sprite->pos1.x << 7; + sprite->data[3] = -0x1400 / sprite->data[1]; + sprite->data[4] = sprite->pos1.y << 7; + sprite->data[5] = -0xA00 / sprite->data[1]; + } + else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) + { + sprite->pos1.x -= 40; + sprite->pos1.y += 20; + sprite->data[2] = sprite->pos1.x << 7; + sprite->data[3] = 0x1400 / sprite->data[1]; + sprite->data[4] = sprite->pos1.y << 7; + sprite->data[5] = -0xA00 / sprite->data[1]; + } + else + { + sprite->pos1.x += 40; + sprite->pos1.y -= 20; + sprite->data[2] = sprite->pos1.x << 7; + sprite->data[3] = -0x1400 / sprite->data[1]; + sprite->data[4] = sprite->pos1.y << 7; + sprite->data[5] = 0xA00 / sprite->data[1]; + sprite->oam.matrixNum = 24; + } + + sprite->callback = sub_810296C; +} + +static void sub_810296C(struct Sprite* sprite) +{ + sprite->data[2] += sprite->data[3]; + sprite->data[4] += sprite->data[5]; + sprite->pos1.x = sprite->data[2] >> 7; + sprite->pos1.y = sprite->data[4] >> 7; + if (--sprite->data[1] == 1) + { + sprite->pos1.x = sprite->data[6]; + sprite->pos1.y = sprite->data[7]; + } + + if (sprite->data[1] == 0) + DestroyAnimSprite(sprite); +} + +void sub_81029B4(u8 taskId) +{ + u16 i; + int obj; + u16 r3; + u16 r4; + struct Task* task = &gTasks[taskId]; + task->data[0] = GetAnimBattlerSpriteId(ANIM_ATTACKER); + task->data[1] = AllocSpritePalette(ANIM_TAG_BENT_SPOON); + r3 = (task->data[1] * 16) + 0x100; + r4 = (gSprites[task->data[0]].oam.paletteNum + 16) << 4; + for (i = 1; i < 16; i++) + gPlttBufferUnfaded[r3 + i] = gPlttBufferUnfaded[r4 + i]; + + BlendPalette(r3, 16, 11, RGB(0, 0, 0)); + task->data[3] = 0; + i = 0; + while (i < 2 && (obj = duplicate_obj_of_side_rel2move_in_transparent_mode(0)) >= 0) + { + gSprites[obj].oam.paletteNum = task->data[1]; + gSprites[obj].data[0] = 0; + gSprites[obj].data[1] = i << 7; + gSprites[obj].data[2] = taskId; + gSprites[obj].callback = sub_8102B3C; + task->data[3]++; + i++; + } + + task->func = sub_8102AE0; + if (sub_80A8364(gBattleAnimAttacker) == 1) + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); + else + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); +} + +static void sub_8102AE0(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + if (!task->data[3]) + { + if (sub_80A8364(gBattleAnimAttacker) == 1) + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); + else + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); + + FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON); + DestroyAnimVisualTask(taskId); + } +} + +static void sub_8102B3C(struct Sprite* sprite) +{ + if (++sprite->data[3] > 1) + { + sprite->data[3] = 0; + sprite->data[0]++; + } + + if (sprite->data[0] > 64) + { + gTasks[sprite->data[2]].data[3]--; + obj_delete_but_dont_free_vram(sprite); + } + else + { + sprite->data[4] = gSineTable[sprite->data[0]] / 6; + sprite->data[5] = gSineTable[sprite->data[0]] / 13; + sprite->data[1] = (sprite->data[1] + sprite->data[5]) & 0xFF; + sprite->pos2.x = Sin(sprite->data[1], sprite->data[4]); + } +} + +void sub_8102BCC(struct Sprite* sprite) +{ + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + sprite->callback = sub_80A67D8; +} + +void sub_8102BE8(u8 taskId) +{ + u16 i; + u16 j; + u16 index; + + index = IndexOfSpritePaletteTag(gUnknown_08593020[0][0]); + if (index != 0xFF) + { + index = (index << 4) + 0x100; + for (i = 1; i < ARRAY_COUNT(gUnknown_08593020[0]); i++) + gPlttBufferFaded[index + i] = gUnknown_08593020[0][i]; + } + + for (j = 1; j < ARRAY_COUNT(gUnknown_08593020); j++) + { + index = AllocSpritePalette(gUnknown_08593020[j][0]); + if (index != 0xFF) + { + index = (index << 4) + 0x100; + for (i = 1; i < ARRAY_COUNT(gUnknown_08593020[0]); i++) + gPlttBufferFaded[index + i] = gUnknown_08593020[j][i]; + } + } + DestroyAnimVisualTask(taskId); +} + +// clears the rainbow effect for musical notes. +void sub_8102CA0(u8 taskId) +{ + u16 i; + for (i = 1; i < ARRAY_COUNT(gUnknown_08593020); i++) + FreeSpritePaletteByTag(gUnknown_08593020[i][0]); + + DestroyAnimVisualTask(taskId); +} + +void sub_8102CD4(struct Sprite* sprite) +{ + u8 index; + u8 a; + u8 b; + sub_80A6838(sprite); + StartSpriteAnim(sprite, gBattleAnimArgs[0]); + if ((index = IndexOfSpritePaletteTag(gUnknown_08593020[gBattleAnimArgs[1]][0])) != 0xFF) + sprite->oam.paletteNum = index; + + sprite->data[1] = gBattleAnimArgs[1]; + sprite->data[2] = 0; + sprite->data[3] = gBattleAnimArgs[2]; + if (IsContest()) + { + a = 48; + b = 40; + } + else + { + a = GetBattlerSpriteCoord(gBattleAnimTarget, 2); + b = GetBattlerSpriteCoord(gBattleAnimTarget, 3); + } + + sprite->data[4] = sprite->pos1.x << 4; + sprite->data[5] = sprite->pos1.y << 4; + sub_8102D8C(a - sprite->pos1.x, b - sprite->pos1.y, &sprite->data[6], &sprite->data[7], 40); + sprite->callback = sub_8102DE4; +} + +static void sub_8102D8C(s16 a, s16 b, s16* c, s16* d, s8 e) +{ + int f; + int g; + if (a < 0) + e = -e; + + f = a << 8; + g = f / e; + if (g == 0) + g = 1; + + *c = f / g; + *d = (b << 8) / g; +} + +static void sub_8102DE4(struct Sprite* sprite) +{ + int b; + s16 a; + int c; + u8 index; + sprite->data[0]++; + b = sprite->data[0] * 5 - ((sprite->data[0] * 5 / 256) << 8); + sprite->data[4] += sprite->data[6]; + sprite->data[5] += sprite->data[7]; + sprite->pos1.x = sprite->data[4] >> 4; + sprite->pos1.y = sprite->data[5] >> 4; + sprite->pos2.y = Sin(b, 15); + a = (u16)sprite->pos1.y; + c = (u16)sprite->pos1.x; + + if ((u32)((c + 16) << 16) > (0x110) << 16 || a < -16 || a > 0x80) + { + move_anim_8074EE0(sprite); + } + else + { + if (sprite->data[3] && ++sprite->data[2] > sprite->data[3]) + { + sprite->data[2] = 0; + if (++sprite->data[1] > 3) + sprite->data[1] = 0; + + index = IndexOfSpritePaletteTag(gUnknown_08593020[sprite->data[1]][0]); + if (index != 0xFF) + sprite->oam.paletteNum = index; + } + } +} + +void sub_8102EB0(struct Sprite* sprite) +{ + int a; + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) + { + a = gBattleAnimArgs[1]; + (u16)gBattleAnimArgs[1] = -a; + } + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[1]; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2]; + StartSpriteAnim(sprite, gBattleAnimArgs[0]); + sprite->data[2] = 0; + sprite->data[3] = 0; + sprite->data[4] = sprite->pos1.x << 4; + sprite->data[5] = sprite->pos1.y << 4; + sprite->data[6] = (gBattleAnimArgs[1] << 4) / 5; + sprite->data[7] = (gBattleAnimArgs[2] << 7) / 5; + sprite->callback = sub_8102F40; +} + +static void sub_8102F40(struct Sprite* sprite) +{ + sprite->data[4] += sprite->data[6]; + sprite->data[5] += sprite->data[7]; + sprite->pos1.x = sprite->data[4] >> 4; + sprite->pos1.y = sprite->data[5] >> 4; + if (sprite->data[0] > 5 && sprite->data[3] == 0) + { + sprite->data[2] = (sprite->data[2] + 16) & 0xFF; + sprite->pos2.x = Cos(sprite->data[2], 18); + sprite->pos2.y = Sin(sprite->data[2], 18); + if (sprite->data[2] == 0) + sprite->data[3] = 1; + } + + if (++sprite->data[0] == 48) + move_anim_8074EE0(sprite); +} + +void sub_8102FB8(struct Sprite* sprite) +{ + s16 a; + if (gBattleAnimArgs[0] == 1) + { + sprite->oam.matrixNum = 8; + a = 16; + } + else + { + a = -16; + } + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + a; + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + 8; + sprite->data[0] = 8; + sprite->callback = WaitAnimForDuration; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); +} + +void sub_8103028(struct Sprite* sprite) +{ + s16 xDiff; + u8 index; + sub_80A6838(sprite); + sprite->pos1.y += 8; + StartSpriteAnim(sprite, gBattleAnimArgs[1]); + index = IndexOfSpritePaletteTag(gUnknown_08593020[gBattleAnimArgs[2]][0]); + if (index != 0xFF) + sprite->oam.paletteNum = index; + + xDiff = (gBattleAnimArgs[0] == 0) ? -32 : 32; + sprite->data[0] = 40; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = xDiff + sprite->data[1]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = sprite->data[3] - 40; + InitAnimLinearTranslation(sprite); + sprite->data[5] = gBattleAnimArgs[3]; + sprite->callback = sub_81030B0; +} + +static void sub_81030B0(struct Sprite* sprite) +{ + if (TranslateAnimLinear(sprite) == 0) + { + s16 xDiff; + xDiff = Sin(sprite->data[5], 8); + if (sprite->pos2.x < 0) + xDiff = -xDiff; + + sprite->pos2.x += xDiff; + sprite->pos2.y += Sin(sprite->data[5], 4); + sprite->data[5] = (sprite->data[5] + 8) & 0xFF; + } + else + { + DestroyAnimSprite(sprite); + } +} + +void sub_810310C(u8 battler, struct Sprite* sprite) +{ + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + sprite->pos1.x = sub_80A861C(battler, 5) + 8; + else + sprite->pos1.x = sub_80A861C(battler, 4) - 8; + + sprite->pos1.y = GetBattlerSpriteCoord(battler, 3) - (s16)sub_80A861C(battler, 0) / 4; +} + +void sub_8103164(struct Sprite* sprite) +{ + u8 a; + u8 battler; + if (gBattleAnimArgs[0] == 0) + battler = gBattleAnimAttacker; + else + battler = gBattleAnimTarget; + + sub_810310C(battler, sprite); + a = (GetBattlerSide(battler) == B_SIDE_PLAYER) ? 0 : 1; + sprite->data[0] = gBattleAnimArgs[1]; + sprite->data[1] = a + 2; + StartSpriteAnim(sprite, a); + StoreSpriteCallbackInData6(sprite, sub_81031D0); + sprite->callback = sub_80A67D8; +} + +static void sub_81031D0(struct Sprite* sprite) +{ + if (--sprite->data[0] == 0) + { + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + StartSpriteAnim(sprite, sprite->data[1]); + sprite->callback = sub_80A67D8; + } +} + +void sub_8103208(struct Sprite* sprite) +{ + u8 battler; + if (gBattleAnimArgs[0] == 0) + battler = gBattleAnimAttacker; + else + battler = gBattleAnimTarget; + + sub_810310C(battler, sprite); + sprite->data[0] = 0; + StoreSpriteCallbackInData6(sprite, sub_8103250); + sprite->callback = sub_80A67BC; +} + +static void sub_8103250(struct Sprite* sprite) +{ + if (++sprite->data[0] > 16) + { + StartSpriteAffineAnim(sprite, 1); + StoreSpriteCallbackInData6(sprite, move_anim_8074EE0); + sprite->callback = sub_80A67BC; + } +} + +void sub_8103284(struct Sprite* sprite) +{ + u8 battler; + if (gBattleAnimArgs[0] == 0) + battler = gBattleAnimAttacker; + else + battler = gBattleAnimTarget; + + sprite->pos1.x = GetBattlerSpriteCoord(battler, 0); + sprite->pos1.y = sub_80A861C(battler, 2); + if (sprite->pos1.y <= 9) + sprite->pos1.y = 10; + + sprite->data[0] = 1; + sprite->data[1] = 0; + sprite->data[2] = sprite->subpriority; + sprite->data[3] = sprite->subpriority + 4; + sprite->data[4] = 0; + StoreSpriteCallbackInData6(sprite, sub_8103300); + sprite->callback = sub_80A67BC; +} + +static void sub_8103300(struct Sprite* sprite) +{ + if (++sprite->data[4] > 12) + sprite->callback = sub_8103320; +} + +static void sub_8103320(struct Sprite* sprite) +{ + s16 temp; + s16 temp2; + sprite->data[1] += 4; + if (sprite->data[1] > 254) + { + if (--sprite->data[0] == 0) + { + sprite->pos2.x = 0; + sprite->callback = sub_8103250; + return; + } + else + { + sprite->data[1] &= 0xFF; + } + } + + if (sprite->data[1] > 0x4F) + sprite->subpriority = sprite->data[3]; + + if (sprite->data[1] > 0x9F) + sprite->subpriority = sprite->data[2]; + + temp = gSineTable[sprite->data[1]]; + sprite->pos2.x = (temp2 = temp >> 3) + (temp2 >> 1); +} + +void sub_8103390(struct Sprite* sprite) +{ + u8 bank; + if (gBattleAnimArgs[0] == 0) + bank = gBattleAnimAttacker; + else + bank = gBattleAnimTarget; + + sub_810310C(bank, sprite); + if (GetBattlerSide(bank) == B_SIDE_PLAYER) + { + StartSpriteAnim(sprite, 0); + sprite->data[0] = 2; + } + else + { + StartSpriteAnim(sprite, 1); + sprite->data[0] = 3; + } + + sprite->callback = sub_81033F0; +} + +static void sub_81033F0(struct Sprite* sprite) +{ + if (++sprite->data[1] > 10) + { + sprite->data[1] = 0; + StartSpriteAnim(sprite, sprite->data[0]); + StoreSpriteCallbackInData6(sprite, sub_810342C); + sprite->callback = sub_80A67D8; + } +} + +static void sub_810342C(struct Sprite* sprite) +{ + if (++sprite->data[1] > 5) + DestroyAnimSprite(sprite); +} diff --git a/src/effects_1.c b/src/effects_1.c deleted file mode 100644 index a8687bc38..000000000 --- a/src/effects_1.c +++ /dev/null @@ -1,2093 +0,0 @@ -#include "global.h" -#include "battle_anim.h" -#include "constants/rgb.h" - -extern void sub_80FE840(struct Sprite *); -extern void sub_80FE8E0(struct Sprite *); -extern void sub_80FE930(struct Sprite *); -extern void sub_80FE988(struct Sprite *); -extern void sub_80FEAD8(struct Sprite *); -extern void sub_80FEB44(struct Sprite *); -extern void sub_80FEC48(struct Sprite *); -extern void sub_80FED28(struct Sprite *); -extern void sub_80FEE78(struct Sprite *); -extern void sub_80FEF44(struct Sprite *); -extern void sub_80FEFFC(struct Sprite *); -extern void AnimMoveTwisterParticle(struct Sprite *); -extern void sub_80FF0F4(struct Sprite *); -extern void sub_80FF374(struct Sprite *); -extern void sub_80FF698(struct Sprite *); -extern void sub_80FF768(struct Sprite *); -extern void sub_80FF7EC(struct Sprite *); -extern void sub_80FF934(struct Sprite *); -extern void sub_80FFB18(struct Sprite *); -extern void sub_80FFBF4(struct Sprite *); -extern void sub_80FFC70(struct Sprite *); -extern void sub_80FFCB4(struct Sprite *); -extern void sub_80FFDBC(struct Sprite *); -extern void sub_8100640(struct Sprite *); -extern void sub_8100898(struct Sprite *); -extern void sub_8100A50(struct Sprite *); -extern void sub_81009F8(struct Sprite *); -extern void sub_8100A94(struct Sprite *); -extern void sub_8100AE0(struct Sprite *); -extern void sub_8100B88(struct Sprite *); -extern void sub_8100E1C(struct Sprite *); -extern void sub_8100EF0(struct Sprite *); -extern void sub_81010CC(struct Sprite *); -extern void sub_810130C(struct Sprite *); -extern void sub_810135C(struct Sprite *); -extern void sub_8101440(struct Sprite *); -extern void sub_81014F4(struct Sprite *); -extern void sub_81015AC(struct Sprite *); -extern void sub_8101898(struct Sprite *); -extern void sub_8101940(struct Sprite *); -extern void sub_8101B90(struct Sprite *); -extern void sub_8101F40(struct Sprite *); -extern void sub_8101FA8(struct Sprite *); -extern void sub_8101FF0(struct Sprite *); -extern void sub_81020D8(struct Sprite *); -extern void sub_810217C(struct Sprite *); -extern void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite); -extern void sub_80A77C8(struct Sprite *); -extern void sub_8102268(struct Sprite *); -extern void sub_810234C(struct Sprite *); -extern void sub_81024E0(struct Sprite *); -extern void sub_8102540(struct Sprite *); -extern void sub_80A77C8(struct Sprite *); -extern void sub_8102844(struct Sprite *); -extern void sub_8102BCC(struct Sprite *); -extern void sub_8102CD4(struct Sprite *); -extern void sub_8102EB0(struct Sprite *); -extern void sub_8102FB8(struct Sprite *); -extern void sub_8103028(struct Sprite *); -extern void sub_8103164(struct Sprite *); -extern void sub_8103208(struct Sprite *); -extern void sub_8103284(struct Sprite *); -extern void sub_8103390(struct Sprite *); - -const union AnimCmd gUnknown_085920F0[] = -{ - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(2, 5), - ANIMCMD_FRAME(4, 5), - ANIMCMD_FRAME(6, 5), - ANIMCMD_FRAME(8, 5), - ANIMCMD_FRAME(10, 5), - ANIMCMD_FRAME(12, 5), - ANIMCMD_FRAME(14, 5), - ANIMCMD_JUMP(0), -}; - -const union AnimCmd *const gUnknown_08592114[] = -{ - gUnknown_085920F0, -}; - -const struct SpriteTemplate gSleepPowderParticleSpriteTemplate = -{ - .tileTag = ANIM_TAG_SLEEP_POWDER, - .paletteTag = ANIM_TAG_SLEEP_POWDER, - .oam = &gUnknown_08524944, - .anims = gUnknown_08592114, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FE840, -}; - -const struct SpriteTemplate gStunSporeParticleSpriteTemplate = -{ - .tileTag = ANIM_TAG_STUN_SPORE, - .paletteTag = ANIM_TAG_STUN_SPORE, - .oam = &gUnknown_08524944, - .anims = gUnknown_08592114, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FE840, -}; - -const struct SpriteTemplate gPoisonPowderParticleSpriteTemplate = -{ - .tileTag = ANIM_TAG_POISON_POWDER, - .paletteTag = ANIM_TAG_POISON_POWDER, - .oam = &gUnknown_08524944, - .anims = gUnknown_08592114, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FE840, -}; - -const union AnimCmd gUnknown_08592160[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592168[] = -{ - ANIMCMD_FRAME(1, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592170[] = -{ - ANIMCMD_FRAME(2, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592178[] = -{ - ANIMCMD_FRAME(3, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592180[] = -{ - ANIMCMD_FRAME(4, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592188[] = -{ - ANIMCMD_FRAME(5, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592190[] = -{ - ANIMCMD_FRAME(6, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592198[] = -{ - ANIMCMD_FRAME(7, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085921A0[] = -{ - ANIMCMD_FRAME(8, 1), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_085921A8[] = -{ - gUnknown_08592160, - gUnknown_08592168, - gUnknown_08592170, - gUnknown_08592178, - gUnknown_08592180, - gUnknown_08592188, - gUnknown_08592190, -}; - -const union AnimCmd *const gUnknown_085921C4[] = -{ - gUnknown_08592198, -}; - -const union AnimCmd *const gUnknown_085921C8[] = -{ - gUnknown_085921A0, -}; - -const union AffineAnimCmd gUnknown_085921CC[] = { - AFFINEANIMCMD_FRAME(-5, -5, 0, 1), - AFFINEANIMCMD_JUMP(0), -}; - -const union AffineAnimCmd *const gUnknown_085921DC[] = { - gUnknown_085921CC, -}; - -const struct SpriteTemplate gUnknown_085921E0 = -{ - .tileTag = ANIM_TAG_ORBS, - .paletteTag = ANIM_TAG_ORBS, - .oam = &gUnknown_08524A8C, - .anims = gUnknown_085921C8, - .images = NULL, - .affineAnims = gUnknown_085921DC, - .callback = sub_80FE8E0, -}; - -const struct SpriteTemplate gUnknown_085921F8 = -{ - .tileTag = ANIM_TAG_ORBS, - .paletteTag = ANIM_TAG_ORBS, - .oam = &gUnknown_08524904, - .anims = gUnknown_085921A8, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FE930, -}; - -const struct SpriteTemplate gUnknown_08592210 = -{ - .tileTag = ANIM_TAG_ORBS, - .paletteTag = ANIM_TAG_ORBS, - .oam = &gUnknown_08524904, - .anims = gUnknown_085921C4, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FE988, -}; - -const union AffineAnimCmd gUnknown_08592228[] = { - AFFINEANIMCMD_FRAME(320, 320, 0, 0), - AFFINEANIMCMD_FRAME(-14, -14, 0, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd *const gUnknown_08592240[] = { - gUnknown_08592228, -}; - -const struct SpriteTemplate gUnknown_08592244 = -{ - .tileTag = ANIM_TAG_GRAY_ORB, - .paletteTag = ANIM_TAG_GRAY_ORB, - .oam = &gUnknown_085249C4, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_08592240, - .callback = sub_80FE8E0, -}; - -const union AffineAnimCmd gUnknown_0859225C[] = { - AFFINEANIMCMD_FRAME(-5, -5, 0, 1), - AFFINEANIMCMD_JUMP(0), -}; - -const union AffineAnimCmd *const gUnknown_0859226C[] = { - gUnknown_0859225C, -}; - -const struct SpriteTemplate gUnknown_08592270 = -{ - .tileTag = ANIM_TAG_ORBS, - .paletteTag = ANIM_TAG_ORBS, - .oam = &gUnknown_08524A8C, - .anims = gUnknown_085921C8, - .images = NULL, - .affineAnims = gUnknown_0859226C, - .callback = sub_80FEAD8, -}; - -const struct SpriteTemplate gUnknown_08592288 = -{ - .tileTag = ANIM_TAG_ORBS, - .paletteTag = ANIM_TAG_ORBS, - .oam = &gUnknown_08524904, - .anims = gUnknown_085921A8, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FEB44, -}; - -const union AnimCmd gUnknown_085922A0[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085922A8[] = -{ - ANIMCMD_FRAME(4, 7), - ANIMCMD_FRAME(8, 7), - ANIMCMD_JUMP(0), -}; - -const union AnimCmd *const gUnknown_085922B4[] = -{ - gUnknown_085922A0, - gUnknown_085922A8, -}; - -const struct SpriteTemplate gLeechSeedSpriteTemplate = -{ - .tileTag = ANIM_TAG_SEED, - .paletteTag = ANIM_TAG_SEED, - .oam = &gUnknown_0852490C, - .anims = gUnknown_085922B4, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FEC48, -}; - -const union AnimCmd gUnknown_085922D4[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085922DC[] = -{ - ANIMCMD_FRAME(4, 7), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_085922E4[] = -{ - gUnknown_085922D4, - gUnknown_085922DC, -}; - -const struct SpriteTemplate gUnknown_085922EC = -{ - .tileTag = ANIM_TAG_SPORE, - .paletteTag = ANIM_TAG_SPORE, - .oam = &gUnknown_0852490C, - .anims = gUnknown_085922E4, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FED28, -}; - -const union AnimCmd gUnknown_08592304[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_0859230C[] = -{ - ANIMCMD_FRAME(4, 1), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592314[] = -{ - gUnknown_08592304, -}; - -const union AnimCmd *const gUnknown_08592318[] = -{ - gUnknown_0859230C, -}; - -const struct SpriteTemplate gUnknown_0859231C = -{ - .tileTag = ANIM_TAG_FLOWER, - .paletteTag = ANIM_TAG_FLOWER, - .oam = &gUnknown_0852490C, - .anims = gUnknown_08592314, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FEE78, -}; - -const struct SpriteTemplate gUnknown_08592334 = -{ - .tileTag = ANIM_TAG_FLOWER, - .paletteTag = ANIM_TAG_FLOWER, - .oam = &gUnknown_08524904, - .anims = gUnknown_08592318, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FEF44, -}; - -const union AnimCmd gUnknown_0859234C[] = -{ - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(4, 5), - ANIMCMD_FRAME(8, 5), - ANIMCMD_FRAME(12, 5), - ANIMCMD_FRAME(16, 5), - ANIMCMD_FRAME(20, 5), - ANIMCMD_FRAME(16, 5), - ANIMCMD_FRAME(12, 5), - ANIMCMD_FRAME(8, 5), - ANIMCMD_FRAME(4, 5), - ANIMCMD_JUMP(0), -}; - -const union AnimCmd gUnknown_08592378[] = -{ - ANIMCMD_FRAME(24, 5), - ANIMCMD_FRAME(28, 5), - ANIMCMD_FRAME(32, 5), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592388[] = -{ - gUnknown_0859234C, - gUnknown_08592378, -}; - -const struct SpriteTemplate gUnknown_08592390 = -{ - .tileTag = ANIM_TAG_LEAF, - .paletteTag = ANIM_TAG_LEAF, - .oam = &gUnknown_0852490C, - .anims = gUnknown_08592388, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FEFFC, -}; - -const struct SpriteTemplate gUnknown_085923A8 = -{ - .tileTag = ANIM_TAG_LEAF, - .paletteTag = ANIM_TAG_LEAF, - .oam = &gUnknown_0852490C, - .anims = gUnknown_08592388, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimMoveTwisterParticle, -}; - -const union AnimCmd gUnknown_085923C0[] = -{ - ANIMCMD_FRAME(0, 3), - ANIMCMD_FRAME(0, 3, .hFlip = TRUE), - ANIMCMD_FRAME(0, 3, .vFlip = TRUE, .hFlip = TRUE), - ANIMCMD_FRAME(0, 3, .vFlip = TRUE), - ANIMCMD_JUMP(0), -}; - -const union AnimCmd *const gUnknown_085923D4[] = -{ - gUnknown_085923C0, -}; - -const struct SpriteTemplate gUnknown_085923D8 = -{ - .tileTag = ANIM_TAG_RAZOR_LEAF, - .paletteTag = ANIM_TAG_RAZOR_LEAF, - .oam = &gUnknown_08524934, - .anims = gUnknown_085923D4, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FF0F4, -}; - -const union AffineAnimCmd gUnknown_085923F0[] = { - AFFINEANIMCMD_FRAME(0, 0, 0, 1), - AFFINEANIMCMD_JUMP(0), -}; - -const union AffineAnimCmd *const gUnknown_08592400[] = { - gUnknown_085923F0, -}; - -const struct SpriteTemplate gSwiftStarSpriteTemplate = -{ - .tileTag = ANIM_TAG_YELLOW_STAR, - .paletteTag = ANIM_TAG_YELLOW_STAR, - .oam = &gUnknown_08524974, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_08592400, - .callback = sub_80FF0F4, -}; - -const union AnimCmd gUnknown_0859241C[] = -{ - ANIMCMD_FRAME(0, 4), - ANIMCMD_FRAME(32, 4), - ANIMCMD_FRAME(64, 4), - ANIMCMD_FRAME(96, 4), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592430[] = -{ - ANIMCMD_FRAME(0, 4, .hFlip = TRUE), - ANIMCMD_FRAME(32, 4, .hFlip = TRUE), - ANIMCMD_FRAME(64, 4, .hFlip = TRUE), - ANIMCMD_FRAME(96, 4, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592444[] = -{ - gUnknown_0859241C, - gUnknown_08592430, -}; - -const union AffineAnimCmd gUnknown_0859244C[] = { - AFFINEANIMCMD_FRAME(256, 256, 0, 0), - AFFINEANIMCMD_FRAME(-11, 0, 0, 6), - AFFINEANIMCMD_FRAME(11, 0, 0, 6), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_0859246C[] = { - AFFINEANIMCMD_FRAME(-256, 256, 0, 0), - AFFINEANIMCMD_FRAME(11, 0, 0, 6), - AFFINEANIMCMD_FRAME(-11, 0, 0, 6), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd *const gUnknown_0859248C[] = { - gUnknown_0859244C, - gUnknown_0859246C, -}; - -const struct SpriteTemplate gUnknown_08592494 = -{ - .tileTag = ANIM_TAG_TENDRILS, - .paletteTag = ANIM_TAG_TENDRILS, - .oam = &gUnknown_0852499C, - .anims = gUnknown_08592444, - .images = NULL, - .affineAnims = gUnknown_0859248C, - .callback = sub_80FF374, -}; - -const union AffineAnimCmd gUnknown_085924AC[] = { - AFFINEANIMCMD_FRAME(0, 0, 0, 0), - AFFINEANIMCMD_FRAME(48, 48, 0, 14), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_085924C4[] = { - AFFINEANIMCMD_FRAME(-16, -16, 0, 1), - AFFINEANIMCMD_JUMP(0), -}; - -const union AffineAnimCmd *const gUnknown_085924D4[] = { - gUnknown_085924AC, - gUnknown_085924C4, -}; - -const struct SpriteTemplate gUnknown_085924DC = -{ - .tileTag = ANIM_TAG_ORBS, - .paletteTag = ANIM_TAG_ORBS, - .oam = &gUnknown_085249CC, - .anims = gUnknown_085921C8, - .images = NULL, - .affineAnims = gUnknown_085924D4, - .callback = sub_80FF698, -}; - -const union AnimCmd gUnknown_085924F4[] = -{ - ANIMCMD_FRAME(0, 7), - ANIMCMD_FRAME(16, 7), - ANIMCMD_FRAME(32, 7), - ANIMCMD_FRAME(48, 7), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592508[] = -{ - ANIMCMD_FRAME(0, 7, .hFlip = TRUE), - ANIMCMD_FRAME(16, 7, .hFlip = TRUE), - ANIMCMD_FRAME(32, 7, .hFlip = TRUE), - ANIMCMD_FRAME(48, 7, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_0859251C[] = -{ - ANIMCMD_FRAME(0, 7), - ANIMCMD_FRAME(16, 7), - ANIMCMD_FRAME(32, 7), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_0859252C[] = -{ - ANIMCMD_FRAME(0, 7, .hFlip = TRUE), - ANIMCMD_FRAME(16, 7, .hFlip = TRUE), - ANIMCMD_FRAME(32, 7, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_0859253C[] = -{ - gUnknown_085924F4, - gUnknown_08592508, - gUnknown_0859251C, - gUnknown_0859252C, -}; - -const struct SpriteTemplate gUnknown_0859254C = -{ - .tileTag = ANIM_TAG_ROOTS, - .paletteTag = ANIM_TAG_ROOTS, - .oam = &gUnknown_08524914, - .anims = gUnknown_0859253C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FF768, -}; - -const struct SpriteTemplate gUnknown_08592564 = -{ - .tileTag = ANIM_TAG_ROOTS, - .paletteTag = ANIM_TAG_ROOTS, - .oam = &gUnknown_08524914, - .anims = gUnknown_0859253C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FF7EC, -}; - -const union AnimCmd gUnknown_0859257C[] = -{ - ANIMCMD_FRAME(3, 3), - ANIMCMD_FRAME(0, 5), - ANIMCMD_JUMP(0), -}; - -const union AnimCmd *const gUnknown_08592588[] = -{ - gUnknown_0859257C, -}; - -const struct SpriteTemplate gUnknown_0859258C = -{ - .tileTag = ANIM_TAG_ORBS, - .paletteTag = ANIM_TAG_ORBS, - .oam = &gUnknown_08524904, - .anims = gUnknown_08592588, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FF934, -}; - -const union AnimCmd gUnknown_085925A4[] = -{ - ANIMCMD_FRAME(0, 30), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_085925AC[] = -{ - gUnknown_085925A4, -}; - -const union AffineAnimCmd gUnknown_085925B0[] = { - AFFINEANIMCMD_FRAME(0, 0, -4, 10), - AFFINEANIMCMD_FRAME(0, 0, 4, 20), - AFFINEANIMCMD_FRAME(0, 0, -4, 10), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_085925D0[] = { - AFFINEANIMCMD_FRAME(0, 0, -1, 2), - AFFINEANIMCMD_FRAME(0, 0, 1, 4), - AFFINEANIMCMD_FRAME(0, 0, -1, 4), - AFFINEANIMCMD_FRAME(0, 0, 1, 4), - AFFINEANIMCMD_FRAME(0, 0, -1, 4), - AFFINEANIMCMD_FRAME(0, 0, 1, 2), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd *const gUnknown_08592608[] = { - gUnknown_085925B0, - gUnknown_085925D0, -}; - -const struct SpriteTemplate gUnknown_08592610 = -{ - .tileTag = ANIM_TAG_ITEM_BAG, - .paletteTag = ANIM_TAG_ITEM_BAG, - .oam = &gUnknown_08524974, - .anims = gUnknown_085925AC, - .images = NULL, - .affineAnims = gUnknown_08592608, - .callback = sub_80FFB18, -}; - -const struct SpriteTemplate gBattleAnimSpriteTemplate_8592628 = -{ - .tileTag = ANIM_TAG_ITEM_BAG, - .paletteTag = ANIM_TAG_ITEM_BAG, - .oam = &gUnknown_08524974, - .anims = gUnknown_085925AC, - .images = NULL, - .affineAnims = gUnknown_08592608, - .callback = sub_80FFBF4, -}; - -const union AnimCmd gUnknown_08592640[] = -{ - ANIMCMD_FRAME(0, 4), - ANIMCMD_FRAME(4, 4), - ANIMCMD_FRAME(8, 4), - ANIMCMD_FRAME(12, 4), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592654[] = -{ - gUnknown_08592640, -}; - -const struct SpriteTemplate gUnknown_08592658 = -{ - .tileTag = ANIM_TAG_GREEN_SPARKLE, - .paletteTag = ANIM_TAG_GREEN_SPARKLE, - .oam = &gUnknown_0852490C, - .anims = gUnknown_08592654, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80FFC70, -}; - -const struct SpriteTemplate gUnknown_08592670 = -{ - .tileTag = ANIM_TAG_ITEM_BAG, - .paletteTag = ANIM_TAG_ITEM_BAG, - .oam = &gUnknown_08524974, - .anims = gUnknown_085925AC, - .images = NULL, - .affineAnims = gUnknown_08592608, - .callback = sub_80FFCB4, -}; - -const union AffineAnimCmd gUnknown_08592688[] = { - AFFINEANIMCMD_FRAME(0, 0, 0, 3), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_08592698[] = { - AFFINEANIMCMD_FRAME(0, -10, 0, 3), - AFFINEANIMCMD_FRAME(0, -6, 0, 3), - AFFINEANIMCMD_FRAME(0, -2, 0, 3), - AFFINEANIMCMD_FRAME(0, 0, 0, 3), - AFFINEANIMCMD_FRAME(0, 2, 0, 3), - AFFINEANIMCMD_FRAME(0, 6, 0, 3), - AFFINEANIMCMD_FRAME(0, 10, 0, 3), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd *const gUnknown_085926D8[] = { - gUnknown_08592688, - gUnknown_08592698, - gUnknown_085925B0, - gUnknown_085925D0, -}; - -const struct SpriteTemplate gUnknown_085926E8 = -{ - .tileTag = ANIM_TAG_ITEM_BAG, - .paletteTag = ANIM_TAG_ITEM_BAG, - .oam = &gUnknown_08524974, - .anims = gUnknown_085925AC, - .images = NULL, - .affineAnims = gUnknown_085926D8, - .callback = sub_80FFDBC, -}; - -const s8 gUnknown_08592700[][3] = -{ - {5, 24, 1}, - {0, 4, 0}, - {8, 16, -1}, - {0, 2, 0}, - {8, 16, 1}, - {0, 2, 0}, - {8, 16, 1}, - {0, 2, 0}, - {8, 16, 1}, - {0, 16, 0}, - {0, 0, 127}, -}; - -const union AnimCmd gUnknown_08592724[] = -{ - ANIMCMD_FRAME(28, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_0859272C[] = -{ - ANIMCMD_FRAME(32, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592734[] = -{ - ANIMCMD_FRAME(20, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_0859273C[] = -{ - ANIMCMD_FRAME(28, 1, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592744[] = -{ - ANIMCMD_FRAME(16, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_0859274C[] = -{ - ANIMCMD_FRAME(16, 1, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592754[] = -{ - ANIMCMD_FRAME(28, 1), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_0859275C[] = -{ - gUnknown_08592724, - gUnknown_0859272C, - gUnknown_08592734, - gUnknown_0859273C, - gUnknown_08592744, - gUnknown_0859274C, - gUnknown_08592754, -}; - -const struct SpriteTemplate gUnknown_08592778 = -{ - .tileTag = ANIM_TAG_LEAF, - .paletteTag = ANIM_TAG_LEAF, - .oam = &gUnknown_0852490C, - .anims = gUnknown_0859275C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCallbackDummy, -}; - -const union AffineAnimCmd gUnknown_08592790[] = { - AFFINEANIMCMD_FRAME(256, 256, 0, 0), - AFFINEANIMCMD_FRAME(0, 0, 4, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd *const gUnknown_085927A8[] = { - gUnknown_08592790, -}; - -const struct SpriteTemplate gUnknown_085927AC = -{ - .tileTag = ANIM_TAG_FLOWER, - .paletteTag = ANIM_TAG_FLOWER, - .oam = &gUnknown_08524904, - .anims = gUnknown_08592318, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100640, -}; - -const struct SpriteTemplate gUnknown_085927C4 = -{ - .tileTag = ANIM_TAG_FLOWER, - .paletteTag = ANIM_TAG_FLOWER, - .oam = &gUnknown_0852496C, - .anims = gUnknown_08592314, - .images = NULL, - .affineAnims = gUnknown_085927A8, - .callback = sub_8100640, -}; - -const union AffineAnimCmd gUnknown_085927DC[] = { - AFFINEANIMCMD_FRAME(256, 256, 0, 0), - AFFINEANIMCMD_FRAME(0, 0, -10, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd gUnknown_085927F4[] = { - AFFINEANIMCMD_FRAME(192, 192, 0, 0), - AFFINEANIMCMD_FRAME(0, 0, -12, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd gUnknown_0859280C[] = { - AFFINEANIMCMD_FRAME(143, 143, 0, 0), - AFFINEANIMCMD_FRAME(0, 0, -15, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd *const gUnknown_08592824[] = { - gUnknown_085927DC, -}; - -const union AffineAnimCmd *const gUnknown_08592828[] = { - gUnknown_085927F4, -}; - -const union AffineAnimCmd *const gUnknown_0859282C[] = { - gUnknown_0859280C, -}; - -const struct SpriteTemplate gUnknown_08592830 = -{ - .tileTag = ANIM_TAG_SPARKLE_6, - .paletteTag = ANIM_TAG_SPARKLE_6, - .oam = &gUnknown_0852496C, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_08592824, - .callback = sub_8100640, -}; - -const struct SpriteTemplate gUnknown_08592848 = -{ - .tileTag = ANIM_TAG_SPARKLE_6, - .paletteTag = ANIM_TAG_SPARKLE_6, - .oam = &gUnknown_0852496C, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_08592828, - .callback = sub_8100640, -}; - -const struct SpriteTemplate gUnknown_08592860 = -{ - .tileTag = ANIM_TAG_SPARKLE_6, - .paletteTag = ANIM_TAG_SPARKLE_6, - .oam = &gUnknown_0852496C, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_0859282C, - .callback = sub_8100640, -}; - -// sMagicalLeafBlendColors -const u16 gUnknown_08592878[] = -{ - RGB(31, 0, 0), - RGB(31, 19, 0), - RGB(31, 31, 0), - RGB(0, 31, 0), - RGB(5, 14, 31), - RGB(22, 10, 31), - RGB(22, 21, 31), -}; - -const struct SpriteTemplate gUnknown_08592888 = -{ - .tileTag = ANIM_TAG_GREEN_SPIKE, - .paletteTag = ANIM_TAG_GREEN_SPIKE, - .oam = &gUnknown_0852496C, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100898, -}; - -const union AnimCmd gUnknown_085928A0[] = -{ - ANIMCMD_FRAME(64, 3), - ANIMCMD_FRAME(80, 3), - ANIMCMD_FRAME(96, 3), - ANIMCMD_FRAME(112, 6), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085928B4[] = -{ - ANIMCMD_FRAME(64, 3, .hFlip = TRUE), - ANIMCMD_FRAME(80, 3, .hFlip = TRUE), - ANIMCMD_FRAME(96, 3, .hFlip = TRUE), - ANIMCMD_FRAME(112, 6, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_085928C8[] = -{ - gUnknown_085928A0, - gUnknown_085928B4, -}; - -const struct SpriteTemplate gUnknown_085928D0 = -{ - .tileTag = ANIM_TAG_SLAM_HIT, - .paletteTag = ANIM_TAG_SLAM_HIT, - .oam = &gUnknown_08524914, - .anims = gUnknown_085928C8, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100A50, -}; - -const struct SpriteTemplate gUnknown_085928E8 = -{ - .tileTag = ANIM_TAG_WHIP_HIT, - .paletteTag = ANIM_TAG_WHIP_HIT, - .oam = &gUnknown_08524914, - .anims = gUnknown_085928C8, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100A50, -}; - -const union AnimCmd gUnknown_08592900[] = -{ - ANIMCMD_FRAME(0, 4), - ANIMCMD_FRAME(16, 4), - ANIMCMD_FRAME(32, 4), - ANIMCMD_FRAME(48, 4), - ANIMCMD_FRAME(64, 5), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592918[] = -{ - gUnknown_08592900, -}; - -const struct SpriteTemplate gUnknown_0859291C = -{ - .tileTag = ANIM_TAG_UNUSED_HIT, - .paletteTag = ANIM_TAG_UNUSED_HIT, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592918, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81009F8, -}; - -const struct SpriteTemplate gUnknown_08592934 = -{ - .tileTag = ANIM_TAG_UNUSED_HIT_2, - .paletteTag = ANIM_TAG_UNUSED_HIT_2, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592918, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81009F8, -}; - -const union AffineAnimCmd gUnknown_0859294C[] = { - AFFINEANIMCMD_FRAME(256, 256, 0, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_0859295C[] = { - AFFINEANIMCMD_FRAME(256, 256, 32, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_0859296C[] = { - AFFINEANIMCMD_FRAME(256, 256, 64, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_0859297C[] = { - AFFINEANIMCMD_FRAME(256, 256, 96, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_0859298C[] = { - AFFINEANIMCMD_FRAME(256, 256, -128, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_0859299C[] = { - AFFINEANIMCMD_FRAME(256, 256, -96, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_085929AC[] = { - AFFINEANIMCMD_FRAME(256, 256, -64, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_085929BC[] = { - AFFINEANIMCMD_FRAME(256, 256, -32, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd *const gUnknown_085929CC[] = { - gUnknown_0859294C, - gUnknown_0859295C, - gUnknown_0859296C, - gUnknown_0859297C, - gUnknown_0859298C, - gUnknown_0859299C, - gUnknown_085929AC, - gUnknown_085929BC, -}; - -const struct SpriteTemplate gUnknown_085929EC = -{ - .tileTag = ANIM_TAG_HANDS_AND_FEET, - .paletteTag = ANIM_TAG_HANDS_AND_FEET, - .oam = &gUnknown_08524974, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_085929CC, - .callback = sub_8100A94, -}; - -const union AnimCmd gUnknown_08592A04[] = -{ - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(16, 5), - ANIMCMD_FRAME(32, 5), - ANIMCMD_FRAME(48, 5), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592A18[] = -{ - gUnknown_08592A04, -}; - -const struct SpriteTemplate gCuttingSliceSpriteTemplate = -{ - .tileTag = ANIM_TAG_CUT, - .paletteTag = ANIM_TAG_CUT, - .oam = &gUnknown_08524A34, - .anims = gUnknown_08592A18, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100AE0, -}; - -const struct SpriteTemplate gUnknown_08592A34 = -{ - .tileTag = ANIM_TAG_CUT, - .paletteTag = ANIM_TAG_CUT, - .oam = &gUnknown_08524A34, - .anims = gUnknown_08592A18, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100B88, -}; - -const union AnimCmd gUnknown_08592A4C[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A54[] = -{ - ANIMCMD_FRAME(4, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A5C[] = -{ - ANIMCMD_FRAME(8, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A64[] = -{ - ANIMCMD_FRAME(12, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A6C[] = -{ - ANIMCMD_FRAME(16, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A74[] = -{ - ANIMCMD_FRAME(20, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A7C[] = -{ - ANIMCMD_FRAME(0, 1, .vFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A84[] = -{ - ANIMCMD_FRAME(4, 1, .vFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A8C[] = -{ - ANIMCMD_FRAME(8, 1, .vFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592A94[] = -{ - ANIMCMD_FRAME(12, 1, .vFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592A9C[] = -{ - gUnknown_08592A4C, - gUnknown_08592A54, - gUnknown_08592A5C, - gUnknown_08592A64, - gUnknown_08592A6C, - gUnknown_08592A74, - gUnknown_08592A7C, - gUnknown_08592A84, - gUnknown_08592A8C, - gUnknown_08592A94, -}; - -const struct SpriteTemplate gUnknown_08592AC4 = -{ - .tileTag = ANIM_TAG_MUSIC_NOTES, - .paletteTag = ANIM_TAG_MUSIC_NOTES, - .oam = &gUnknown_0852490C, - .anims = gUnknown_08592A9C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100E1C, -}; - -const struct SpriteTemplate gUnknown_08592ADC = -{ - .tileTag = ANIM_TAG_PROTECT, - .paletteTag = ANIM_TAG_PROTECT, - .oam = &gUnknown_08524A3C, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8100EF0, -}; - -const union AffineAnimCmd gUnknown_08592AF4[] = -{ - AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_08592B04[] = -{ - AFFINEANIMCMD_FRAME(0x0, 0x0, 2, 12), - AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 6), - AFFINEANIMCMD_FRAME(0x0, 0x0, -2, 24), - AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 6), - AFFINEANIMCMD_FRAME(0x0, 0x0, 2, 12), - AFFINEANIMCMD_JUMP(0), -}; - -const union AffineAnimCmd *const gUnknown_08592B34[] = -{ - gUnknown_08592AF4, - gUnknown_08592B04, -}; - -const struct SpriteTemplate gUnknown_08592B3C = -{ - .tileTag = ANIM_TAG_MILK_BOTTLE, - .paletteTag = ANIM_TAG_MILK_BOTTLE, - .oam = &gUnknown_08524A94, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_08592B34, - .callback = sub_81010CC, -}; - -const union AnimCmd gUnknown_08592B54[] = -{ - ANIMCMD_FRAME(0, 7), - ANIMCMD_FRAME(16, 7), - ANIMCMD_FRAME(32, 7), - ANIMCMD_FRAME(48, 7), - ANIMCMD_FRAME(64, 7), - ANIMCMD_FRAME(80, 7), - ANIMCMD_FRAME(96, 7), - ANIMCMD_FRAME(112, 7), - ANIMCMD_JUMP(0), -}; - -const union AnimCmd *const gUnknown_08592B78[] = -{ - gUnknown_08592B54, -}; - -const struct SpriteTemplate gUnknown_08592B7C = -{ - .tileTag = ANIM_TAG_SPARKLE_2, - .paletteTag = ANIM_TAG_SPARKLE_2, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592B78, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810130C, -}; - -const struct SpriteTemplate gUnknown_08592B94 = -{ - .tileTag = ANIM_TAG_SPARKLE_2, - .paletteTag = ANIM_TAG_SPARKLE_2, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592B78, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810135C, -}; - -const union AnimCmd gUnknown_08592BAC[] = -{ - ANIMCMD_FRAME(0, 10), - ANIMCMD_FRAME(4, 10), - ANIMCMD_FRAME(8, 10), - ANIMCMD_FRAME(12, 10), - ANIMCMD_FRAME(16, 26), - ANIMCMD_FRAME(16, 5), - ANIMCMD_FRAME(20, 5), - ANIMCMD_FRAME(24, 15), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592BD0[] = -{ - ANIMCMD_FRAME(0, 10, .hFlip = TRUE), - ANIMCMD_FRAME(4, 10, .hFlip = TRUE), - ANIMCMD_FRAME(8, 10, .hFlip = TRUE), - ANIMCMD_FRAME(12, 10, .hFlip = TRUE), - ANIMCMD_FRAME(16, 26, .hFlip = TRUE), - ANIMCMD_FRAME(16, 5, .hFlip = TRUE), - ANIMCMD_FRAME(20, 5, .hFlip = TRUE), - ANIMCMD_FRAME(24, 15, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592BF4[] = -{ - gUnknown_08592BAC, - gUnknown_08592BD0, -}; - -const struct SpriteTemplate gUnknown_08592BFC = -{ - .tileTag = ANIM_TAG_UNUSED_BUBBLE_BURST, - .paletteTag = ANIM_TAG_UNUSED_BUBBLE_BURST, - .oam = &gUnknown_0852490C, - .anims = gUnknown_08592BF4, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8101440, -}; - -const union AnimCmd gUnknown_08592C14[] = -{ - ANIMCMD_FRAME(0, 40), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592C1C[] = -{ - gUnknown_08592C14, -}; - -const union AffineAnimCmd gUnknown_08592C20[] = -{ - AFFINEANIMCMD_FRAME(0x14, 0x14, -30, 0), - AFFINEANIMCMD_FRAME(0x8, 0x8, 1, 24), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_08592C20_2[] = -{ - AFFINEANIMCMD_LOOP(0), - AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 24), - AFFINEANIMCMD_LOOP(10), -}; - -const union AffineAnimCmd gUnknown_08592C50[] = -{ - AFFINEANIMCMD_FRAME(0x14, 0x14, 30, 0), - AFFINEANIMCMD_FRAME(0x8, 0x8, -1, 24), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_08592C50_2[] = -{ - AFFINEANIMCMD_LOOP(0), - AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 24), - AFFINEANIMCMD_LOOP(10), -}; - -const union AffineAnimCmd *const gUnknown_08592C80[] = -{ - gUnknown_08592C20, - gUnknown_08592C50, -}; - -const struct SpriteTemplate gUnknown_08592C88 = -{ - .tileTag = ANIM_TAG_LETTER_Z, - .paletteTag = ANIM_TAG_LETTER_Z, - .oam = &gUnknown_08524974, - .anims = gUnknown_08592C1C, - .images = NULL, - .affineAnims = gUnknown_08592C80, - .callback = sub_81014F4, -}; - -const struct SpriteTemplate gUnknown_08592CA0 = -{ - .tileTag = ANIM_TAG_LOCK_ON, - .paletteTag = ANIM_TAG_LOCK_ON, - .oam = &gUnknown_08524914, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81015AC, -}; - -const struct SpriteTemplate gUnknown_08592CB8 = -{ - .tileTag = ANIM_TAG_LOCK_ON, - .paletteTag = ANIM_TAG_LOCK_ON, - .oam = &gUnknown_0852490C, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8101898, -}; - -const s8 gUnknown_08592CD0[][2] = -{ - { 64, 64}, - { 0, -64}, - {-64, 64}, - { 32, -32}, -}; - -const struct SpriteTemplate gUnknown_08592CD8 = -{ - .tileTag = 0, - .paletteTag = 0, - .oam = &gDummyOamData, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8101940, -}; - -const struct SpriteTemplate gUnknown_08592CF0 = -{ - .tileTag = 0, - .paletteTag = 0, - .oam = &gDummyOamData, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8101B90, -}; - -const union AnimCmd gUnknown_08592D08[] = -{ - ANIMCMD_FRAME(0, 4), - ANIMCMD_FRAME(16, 4), - ANIMCMD_FRAME(32, 4), - ANIMCMD_FRAME(48, 4), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592D1C[] = -{ - ANIMCMD_FRAME(48, 4), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592D24[] = -{ - gUnknown_08592D08, - gUnknown_08592D1C, -}; - -const struct SpriteTemplate gUnknown_08592D2C = -{ - .tileTag = ANIM_TAG_SLASH, - .paletteTag = ANIM_TAG_SLASH, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592D24, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8101F40, -}; - -const struct SpriteTemplate gUnknown_08592D44 = -{ - .tileTag = ANIM_TAG_SLASH_2, - .paletteTag = ANIM_TAG_SLASH_2, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592D24, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8101FA8, -}; - -const struct SpriteTemplate gUnknown_08592D5C = -{ - .tileTag = ANIM_TAG_SLASH_2, - .paletteTag = ANIM_TAG_SLASH_2, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592D24, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8101FF0, -}; - -const union AnimCmd gUnknown_08592D74[] = -{ - ANIMCMD_FRAME(0, 4), - ANIMCMD_FRAME(8, 12), - ANIMCMD_FRAME(16, 4), - ANIMCMD_FRAME(24, 4), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592D88[] = -{ - gUnknown_08592D74, -}; - -const struct SpriteTemplate gUnknown_08592D8C = -{ - .tileTag = ANIM_TAG_FOCUS_ENERGY, - .paletteTag = ANIM_TAG_FOCUS_ENERGY, - .oam = &gUnknown_08524954, - .anims = gUnknown_08592D88, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81020D8, -}; - -const union AnimCmd gUnknown_08592DA4[] = -{ - ANIMCMD_FRAME(0, 18), - ANIMCMD_FRAME(0, 6), - ANIMCMD_FRAME(16, 18), - ANIMCMD_FRAME(0, 6), - ANIMCMD_FRAME(16, 6), - ANIMCMD_FRAME(32, 18), - ANIMCMD_FRAME(16, 6), - ANIMCMD_FRAME(32, 6), - ANIMCMD_FRAME(48, 18), - ANIMCMD_FRAME(32, 6), - ANIMCMD_FRAME(48, 6), - ANIMCMD_FRAME(64, 18), - ANIMCMD_FRAME(48, 6), - ANIMCMD_FRAME(64, 54), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592DE0[] = -{ - gUnknown_08592DA4, -}; - -const struct SpriteTemplate gUnknown_08592DE4 = -{ - .tileTag = ANIM_TAG_SPHERE_TO_CUBE, - .paletteTag = ANIM_TAG_SPHERE_TO_CUBE, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592DE0, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810217C, -}; - -const struct SpriteTemplate gUnknown_08592DFC = -{ - .tileTag = ANIM_TAG_BLACK_BALL, - .paletteTag = ANIM_TAG_BLACK_BALL, - .oam = &gUnknown_08524904, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = TranslateAnimSpriteToTargetMonLocation, -}; - -const union AnimCmd gUnknown_08592E14[] = -{ - ANIMCMD_FRAME(0, 3), - ANIMCMD_FRAME(16, 3), - ANIMCMD_FRAME(32, 3), - ANIMCMD_FRAME(48, 3), - ANIMCMD_FRAME(64, 3), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592E2C[] = -{ - gUnknown_08592E14, -}; - -const struct SpriteTemplate gUnknown_08592E30 = -{ - .tileTag = ANIM_TAG_GRAY_SMOKE, - .paletteTag = ANIM_TAG_GRAY_SMOKE, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592E2C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80A77C8, -}; - -const union AnimCmd gUnknown_08592E48[] = -{ - ANIMCMD_FRAME(3, 5), - ANIMCMD_FRAME(2, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592E5C[] = -{ - gUnknown_08592E48, -}; - -const union AffineAnimCmd gUnknown_08592E60[] = -{ - AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd *const gUnknown_08592E70[] = -{ - gUnknown_08592E60, -}; - -const struct SpriteTemplate gUnknown_08592E74 = -{ - .tileTag = ANIM_TAG_CONVERSION, - .paletteTag = ANIM_TAG_CONVERSION, - .oam = &gUnknown_08524AE4, - .anims = gUnknown_08592E5C, - .images = NULL, - .affineAnims = gUnknown_08592E70, - .callback = sub_8102268, -}; - -const union AnimCmd gUnknown_08592E8C[] = -{ - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(2, 5), - ANIMCMD_FRAME(3, 5), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592EA0[] = -{ - gUnknown_08592E8C, -}; - -const struct SpriteTemplate gUnknown_08592EA4 = -{ - .tileTag = ANIM_TAG_CONVERSION, - .paletteTag = ANIM_TAG_CONVERSION, - .oam = &gUnknown_08524AE4, - .anims = gUnknown_08592EA0, - .images = NULL, - .affineAnims = gUnknown_08592E70, - .callback = sub_810234C, -}; - -const struct SpriteTemplate gUnknown_08592EBC = -{ - .tileTag = ANIM_TAG_MOON, - .paletteTag = ANIM_TAG_MOON, - .oam = &gUnknown_08524A3C, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81024E0, -}; - -const union AnimCmd gUnknown_08592ED4[] = -{ - ANIMCMD_FRAME(0, 8), - ANIMCMD_FRAME(4, 8), - ANIMCMD_FRAME(8, 8), - ANIMCMD_FRAME(12, 8), - ANIMCMD_JUMP(0), -}; - -const union AnimCmd *const gUnknown_08592EE8[] = -{ - gUnknown_08592ED4, -}; - -const struct SpriteTemplate gBattleAnimSpriteTemplate_8592EEC = -{ - .tileTag = ANIM_TAG_GREEN_SPARKLE, - .paletteTag = ANIM_TAG_GREEN_SPARKLE, - .oam = &gUnknown_0852490C, - .anims = gUnknown_08592EE8, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8102540, -}; - -const union AnimCmd gUnknown_08592F04[] = -{ - ANIMCMD_FRAME(0, 2), - ANIMCMD_FRAME(16, 2), - ANIMCMD_FRAME(32, 2), - ANIMCMD_FRAME(48, 3), - ANIMCMD_FRAME(64, 5), - ANIMCMD_FRAME(80, 3), - ANIMCMD_FRAME(96, 2), - ANIMCMD_FRAME(0, 2), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592F28[] = -{ - gUnknown_08592F04, -}; - -const struct SpriteTemplate gUnknown_08592F2C = -{ - .tileTag = ANIM_TAG_BLUE_STAR, - .paletteTag = ANIM_TAG_BLUE_STAR, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592F28, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80A77C8, -}; - -const struct SpriteTemplate gUnknown_08592F44 = -{ - .tileTag = ANIM_TAG_HORN_HIT, - .paletteTag = ANIM_TAG_HORN_HIT, - .oam = &gUnknown_08524914, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8102844, -}; - -const union AnimCmd gUnknown_08592F5C[] = -{ - ANIMCMD_FRAME(0, 2), - ANIMCMD_FRAME(16, 2), - ANIMCMD_FRAME(32, 2), - ANIMCMD_FRAME(48, 2), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592F70[] = -{ - gUnknown_08592F5C, -}; - -const struct SpriteTemplate gUnknown_08592F74 = -{ - .tileTag = ANIM_TAG_FANG_ATTACK, - .paletteTag = ANIM_TAG_FANG_ATTACK, - .oam = &gUnknown_08524914, - .anims = gUnknown_08592F70, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8102BCC, -}; - -const union AnimCmd gUnknown_08592F8C[] = -{ - ANIMCMD_FRAME(0, 10), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592F94[] = -{ - ANIMCMD_FRAME(4, 10), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592F9C[] = -{ - ANIMCMD_FRAME(8, 41), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592FA4[] = -{ - ANIMCMD_FRAME(12, 10), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592FAC[] = -{ - ANIMCMD_FRAME(16, 10), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592FB4[] = -{ - ANIMCMD_FRAME(20, 10), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592FBC[] = -{ - ANIMCMD_FRAME(0, 10, .vFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_08592FC4[] = -{ - ANIMCMD_FRAME(4, 10, .vFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08592FCC[] = -{ - gUnknown_08592F8C, - gUnknown_08592F94, - gUnknown_08592F9C, - gUnknown_08592FA4, - gUnknown_08592FAC, - gUnknown_08592FB4, - gUnknown_08592FBC, - gUnknown_08592FC4, -}; - -const union AffineAnimCmd gUnknown_08592FEC[] = -{ - AFFINEANIMCMD_FRAME(0xC, 0xC, 0, 16), - AFFINEANIMCMD_FRAME(0xFFF4, 0xFFF4, 0, 16), - AFFINEANIMCMD_JUMP(0), -}; - -const union AffineAnimCmd *const gUnknown_08593004[] = -{ - gUnknown_08592FEC, -}; - -const struct SpriteTemplate gUnknown_08593008 = -{ - .tileTag = ANIM_TAG_MUSIC_NOTES, - .paletteTag = ANIM_TAG_MUSIC_NOTES, - .oam = &gUnknown_085249CC, - .anims = gUnknown_08592FCC, - .images = NULL, - .affineAnims = gUnknown_08593004, - .callback = sub_8102CD4, -}; - -const u16 gUnknown_08593020[][6] = -{ - {10072, RGB(31, 31, 31), RGB(31, 26, 28), RGB(31, 22, 26), RGB(31, 17, 24), RGB(31, 13, 22)}, - {10097, RGB(31, 31, 31), RGB(25, 31, 26), RGB(20, 31, 21), RGB(15, 31, 16), RGB(10, 31, 12)}, - {10185, RGB(31, 31, 31), RGB(31, 31, 24), RGB(31, 31, 17), RGB(31, 31, 10), RGB(31, 31, 3)}, - {10175, RGB(31, 31, 31), RGB(26, 28, 31), RGB(21, 26, 31), RGB(16, 24, 31), RGB(12, 22, 31)}, -}; - -const struct SpriteTemplate gUnknown_08593050 = -{ - .tileTag = ANIM_TAG_MUSIC_NOTES, - .paletteTag = ANIM_TAG_MUSIC_NOTES, - .oam = &gUnknown_085249CC, - .anims = gUnknown_08592FCC, - .images = NULL, - .affineAnims = gUnknown_08593004, - .callback = sub_8102EB0, -}; - -const struct SpriteTemplate gUnknown_08593068 = -{ - .tileTag = ANIM_TAG_PURPLE_HAND_OUTLINE, - .paletteTag = ANIM_TAG_PURPLE_HAND_OUTLINE, - .oam = &gUnknown_08524914, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8102FB8, -}; - -const union AffineAnimCmd gUnknown_08593080[] = -{ - AFFINEANIMCMD_FRAME(0xA0, 0xA0, 0, 0), - AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 1), - AFFINEANIMCMD_JUMP(1), -}; - -const union AffineAnimCmd *const gUnknown_08593098[] = -{ - gUnknown_08593080, -}; - -const struct SpriteTemplate gUnknown_0859309C = -{ - .tileTag = ANIM_TAG_MUSIC_NOTES, - .paletteTag = ANIM_TAG_MUSIC_NOTES, - .oam = &gUnknown_085249CC, - .anims = gUnknown_08592FCC, - .images = NULL, - .affineAnims = gUnknown_08593098, - .callback = sub_8103028, -}; - -const union AnimCmd gUnknown_085930B4[] = -{ - ANIMCMD_FRAME(0, 2, .hFlip = TRUE), - ANIMCMD_FRAME(16, 2, .hFlip = TRUE), - ANIMCMD_FRAME(32, 2, .hFlip = TRUE), - ANIMCMD_FRAME(48, 2, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085930C8[] = -{ - ANIMCMD_FRAME(48, 2, .hFlip = TRUE), - ANIMCMD_FRAME(32, 2, .hFlip = TRUE), - ANIMCMD_FRAME(16, 2, .hFlip = TRUE), - ANIMCMD_FRAME(0, 2, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085930DC[] = -{ - ANIMCMD_FRAME(0, 2), - ANIMCMD_FRAME(16, 2), - ANIMCMD_FRAME(32, 2), - ANIMCMD_FRAME(48, 2), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085930F0[] = -{ - ANIMCMD_FRAME(48, 2), - ANIMCMD_FRAME(32, 2), - ANIMCMD_FRAME(16, 2), - ANIMCMD_FRAME(0, 2), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_08593104[] = -{ - gUnknown_085930B4, - gUnknown_085930DC, - gUnknown_085930C8, - gUnknown_085930F0, -}; - -const struct SpriteTemplate gUnknown_08593114 = -{ - .tileTag = ANIM_TAG_THOUGHT_BUBBLE, - .paletteTag = ANIM_TAG_THOUGHT_BUBBLE, - .oam = &gUnknown_08524914, - .anims = gUnknown_08593104, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8103164, -}; - -const union AffineAnimCmd gUnknown_0859312C[] = -{ - AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0), - AFFINEANIMCMD_FRAME(0x1E, 0x1E, 0, 8), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_08593144[] = -{ - AFFINEANIMCMD_FRAME(0x0, 0x0, 4, 11), - AFFINEANIMCMD_FRAME(0x0, 0x0, -4, 11), - AFFINEANIMCMD_LOOP(2), - AFFINEANIMCMD_FRAME(0xFFE2, 0xFFE2, 0, 8), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd gUnknown_08593144_2[] = -{ - AFFINEANIMCMD_FRAME(16, 16, 0, 0), - AFFINEANIMCMD_FRAME(30, 30, 0, 8), - AFFINEANIMCMD_FRAME(0, 0, 0, 16), - AFFINEANIMCMD_LOOP(0), - AFFINEANIMCMD_FRAME(0, 0, 4, 11), - AFFINEANIMCMD_FRAME(0, 0, -4, 11), - AFFINEANIMCMD_LOOP(2), - AFFINEANIMCMD_FRAME(-30, -30, 0, 8), - AFFINEANIMCMD_END, -}; - -const union AffineAnimCmd *const gUnknown_085931B4[] = -{ - gUnknown_0859312C, - gUnknown_08593144, -}; - -const struct SpriteTemplate gUnknown_085931BC = -{ - .tileTag = ANIM_TAG_FINGER, - .paletteTag = ANIM_TAG_FINGER, - .oam = &gUnknown_085249D4, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_085931B4, - .callback = sub_8103208, -}; - -const struct SpriteTemplate gUnknown_085931D4 = -{ - .tileTag = ANIM_TAG_FINGER, - .paletteTag = ANIM_TAG_FINGER, - .oam = &gUnknown_08524974, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gUnknown_085931B4, - .callback = sub_8103284, -}; - -const union AnimCmd gUnknown_085931EC[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085931F4[] = -{ - ANIMCMD_FRAME(0, 1, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_085931FC[] = -{ - ANIMCMD_FRAME(0, 4), - ANIMCMD_FRAME(16, 4), - ANIMCMD_FRAME(32, 4), - ANIMCMD_FRAME(16, 4), - ANIMCMD_FRAME(0, 4), - ANIMCMD_FRAME(16, 4), - ANIMCMD_FRAME(32, 4), - ANIMCMD_END, -}; - -const union AnimCmd gUnknown_0859321C[] = -{ - ANIMCMD_FRAME(0, 4, .hFlip = TRUE), - ANIMCMD_FRAME(16, 4, .hFlip = TRUE), - ANIMCMD_FRAME(32, 4, .hFlip = TRUE), - ANIMCMD_FRAME(16, 4, .hFlip = TRUE), - ANIMCMD_FRAME(0, 4, .hFlip = TRUE), - ANIMCMD_FRAME(16, 4, .hFlip = TRUE), - ANIMCMD_FRAME(32, 4, .hFlip = TRUE), - ANIMCMD_END, -}; - -const union AnimCmd *const gUnknown_0859323C[] = -{ - gUnknown_085931EC, - gUnknown_085931F4, - gUnknown_085931FC, - gUnknown_0859321C, -}; - -const struct SpriteTemplate gUnknown_0859324C = -{ - .tileTag = ANIM_TAG_FINGER_2, - .paletteTag = ANIM_TAG_FINGER_2, - .oam = &gUnknown_08524914, - .anims = gUnknown_0859323C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8103390, -}; diff --git a/src/fire.c b/src/fire.c index c054f154e..44ae9d320 100644 --- a/src/fire.c +++ b/src/fire.c @@ -726,7 +726,7 @@ static void AnimFireCross(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); - sprite->callback = sub_80A653C; //TranslateSpriteOverDuration + sprite->callback = TranslateSpriteOverDuration; } static void sub_81093A4(struct Sprite *sprite) diff --git a/sym_ewram.txt b/sym_ewram.txt index 4f77532b2..f386e9da1 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -285,8 +285,7 @@ gUnknown_0203A034: @ 203A034 gUnknown_0203A0F4: @ 203A0F4 .space 0x4 -gUnknown_0203A0F8: @ 203A0F8 - .space 0x8 + .include "src/battle_anim_effects_1.o" gUnknown_0203A100: @ 203A100 .space 0x10