From c323e7f061152a732fba39cb4a7c05ffb121d63b Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 27 Feb 2021 11:04:45 -0600 Subject: [PATCH] Document some battle anim funcs and data --- data/battle_anim_scripts.s | 2 +- include/battle_anim.h | 10 ++-- src/battle_anim.c | 8 +-- src/battle_anim_dark.c | 8 +-- src/battle_anim_dragon.c | 60 +++++++++++----------- src/battle_anim_effects_2.c | 8 +-- src/battle_anim_effects_3.c | 10 ++-- src/battle_anim_electric.c | 62 +++++++++++------------ src/battle_anim_fight.c | 12 ++--- src/battle_anim_fire.c | 90 +++++++++++++++------------------ src/battle_anim_flying.c | 62 ++++++++++++----------- src/battle_anim_ice.c | 8 +-- src/battle_anim_mons.c | 54 ++++++++++---------- src/battle_anim_rock.c | 12 ++--- src/battle_anim_sound_tasks.c | 33 +++++------- src/battle_anim_throw.c | 2 +- src/battle_anim_utility_funcs.c | 12 ++--- src/battle_anim_water.c | 16 +++--- 18 files changed, 228 insertions(+), 241 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 2344007a5..2e42848ab 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -854,7 +854,7 @@ Move_TWINEEDLE: Move_FIRE_BLAST: loadspritegfx ANIM_TAG_SMALL_EMBER - createsoundtask sub_8158B30, SE_M_FLAME_WHEEL, SE_M_FLAME_WHEEL2 + createsoundtask SoundTask_FireBlast, SE_M_FLAME_WHEEL, SE_M_FLAME_WHEEL2 call FireBlastRing call FireBlastRing call FireBlastRing diff --git a/include/battle_anim.h b/include/battle_anim.h index 046ddb08c..c1231c2de 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -108,7 +108,7 @@ u8 GetBattlerSpriteBGPriority(u8 battlerId); void *LoadPointerFromVars(s16 bottom, s16 top); void StorePointerInVars(s16 *bottom, s16 *top, const void *ptr); void sub_80A8278(void); -void sub_80A6B30(struct BattleAnimBgData*); +void GetDefaultBattleAnimBgData(struct BattleAnimBgData*); void sub_80A6B90(struct BattleAnimBgData*, u32 arg1); u8 GetBattlerSpriteSubpriority(u8 battlerId); bool8 TranslateAnimHorizontalArc(struct Sprite *sprite); @@ -127,12 +127,12 @@ void obj_delete_but_dont_free_vram(struct Sprite*); u8 sub_80A89C8(int, u8, int); void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData*, const void*, u32); void AnimLoadCompressedBgGfx(u32, const u32*, u32); -void sub_80A6DAC(bool8); +void UpdateAnimBg3ScreenSize(bool8); void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *); void sub_80A653C(struct Sprite *); void SetBattlerSpriteYOffsetFromYScale(u8 spriteId); -void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); -u8 sub_80A80C8(struct Task *task); +void PrepareEruptAnimTaskData(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); +u8 UpdateEruptAnimTask(struct Task *task); void DestroyAnimSpriteAndDisableBlend(struct Sprite *); void AnimLoadCompressedBgTilemap(u32 bgId, const void *src); void InitAnimFastLinearTranslationWithSpeed(struct Sprite *sprite); @@ -149,7 +149,7 @@ bool8 RunAffineAnimFromTaskData(struct Task *task); void AnimThrowProjectile(struct Sprite *sprite); void sub_80A6BFC(struct BattleAnimBgData *unk, u8 unused); u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); -void sub_80A749C(struct Sprite *sprite); +void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite); void TradeMenuBouncePartySprites(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); void DestroySpriteAndFreeResources_(struct Sprite *sprite); diff --git a/src/battle_anim.c b/src/battle_anim.c index 874ac935b..d242ee94a 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -2300,7 +2300,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) RequestDma3Fill(0xFF, (void*)(BG_SCREEN_ADDR(28)), 0x1000, 0); } - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); CpuFill16(0, animBg.bgTiles, 0x1000); CpuFill16(0xFF, animBg.bgTilemap, 0x800); @@ -2371,7 +2371,7 @@ static void sub_80A46A0(void) if (IsSpeciesNotUnown(gContestResources->moveAnim->species)) { - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); ptr = animBg.bgTilemap; for (i = 0; i < 8; i++) { @@ -2411,7 +2411,7 @@ void sub_80A4720(u16 a, u16 *b, u32 c, u8 d) void sub_80A477C(bool8 to_BG2) { struct BattleAnimBgData animBg; - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); if (!to_BG2 || IsContest()) { @@ -2435,7 +2435,7 @@ static void task_pA_ma0A_obj_to_bg_pal(u8 taskId) spriteId = gTasks[taskId].data[0]; palIndex = gTasks[taskId].data[6]; - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); x = gTasks[taskId].data[1] - (gSprites[spriteId].pos1.x + gSprites[spriteId].pos2.x); y = gTasks[taskId].data[2] - (gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y); diff --git a/src/battle_anim_dark.c b/src/battle_anim_dark.c index 7253b5247..d70d70d44 100644 --- a/src/battle_anim_dark.c +++ b/src/battle_anim_dark.c @@ -423,7 +423,7 @@ void AnimTask_MoveAttackerMementoShadow(u8 taskId) task->data[3] = GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker); if (task->data[3] == 1) { - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); task->data[10] = gBattle_BG1_Y; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG1); FillPalette(0, animBg.paletteId * 16, 32); @@ -564,7 +564,7 @@ void AnimTask_MoveTargetMementoShadow(u8 taskId) case 1: if (task->data[3] == 1) { - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); task->data[10] = gBattle_BG1_Y; FillPalette(0, animBg.paletteId * 16, 32); } @@ -860,7 +860,7 @@ void AnimTask_MetallicShine(u8 taskId) spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); newSpriteId = sub_80A89C8(gBattleAnimAttacker, spriteId, species); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); AnimLoadCompressedBgTilemap(animBg.bgId, gMetalShineTilemap); AnimLoadCompressedBgGfx(animBg.bgId, gMetalShineGfx, animBg.tilesOffset); LoadCompressedPalette(gMetalShinePalette, animBg.paletteId * 16, 32); @@ -903,7 +903,7 @@ static void AnimTask_MetallicShine_Step(u8 taskId) SetGreyscaleOrOriginalPalette(paletteNum, TRUE); DestroySprite(&gSprites[gTasks[taskId].data[0]]); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(animBg.bgId); if (gTasks[taskId].data[6] == 1) gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++; diff --git a/src/battle_anim_dragon.c b/src/battle_anim_dragon.c index 1d426cac7..caafdf3b8 100644 --- a/src/battle_anim_dragon.c +++ b/src/battle_anim_dragon.c @@ -13,11 +13,11 @@ static void AnimDragonDanceOrb_Step(struct Sprite *); static void AnimOverheatFlame(struct Sprite *); static void AnimOverheatFlame_Step(struct Sprite *); static void AnimTask_DragonDanceWaver_Step(u8); -static void sub_8113574(struct Task *); +static void UpdateDragonDanceScanlineEffect(struct Task *); -EWRAM_DATA static u16 gUnknown_0203A100[7] = {0}; +EWRAM_DATA static u16 gUnusedOverheatData[7] = {0}; -static const union AnimCmd gUnknown_08596E60[] = +static const union AnimCmd sAnim_OutrageOverheatFire_0[] = { ANIMCMD_FRAME(0, 4), ANIMCMD_FRAME(16, 4), @@ -27,9 +27,9 @@ static const union AnimCmd gUnknown_08596E60[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_08596E78[] = +static const union AnimCmd *const sAnims_OutrageOverheatFire[] = { - gUnknown_08596E60, + sAnim_OutrageOverheatFire_0, }; const struct SpriteTemplate gOutrageFlameSpriteTemplate = @@ -37,7 +37,7 @@ const struct SpriteTemplate gOutrageFlameSpriteTemplate = .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08596E78, + .anims = sAnims_OutrageOverheatFire, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimOutrageFlame, @@ -181,7 +181,7 @@ const struct SpriteTemplate gOverheatFlameSpriteTemplate = .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08596E78, + .anims = sAnims_OutrageOverheatFire, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimOverheatFlame, @@ -212,7 +212,7 @@ static void AnimOutrageFlame(struct Sprite *sprite) sprite->callback = TranslateSpriteLinearAndFlicker; } -static void sub_8113100(struct Sprite *sprite) +static void StartDragonFireTranslation(struct Sprite *sprite) { SetSpriteCoordsToAnimAttackerCoords(sprite); sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); @@ -263,7 +263,7 @@ static void AnimDragonFireToTarget(struct Sprite *sprite) if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) StartSpriteAffineAnim(sprite, 1); - sub_8113100(sprite); + StartDragonFireTranslation(sprite); } static void AnimDragonDanceOrb(struct Sprite *sprite) @@ -328,27 +328,27 @@ static void AnimDragonDanceOrb_Step(struct Sprite *sprite) // Used by Dragon Dance void AnimTask_DragonDanceWaver(u8 taskId) { - struct ScanlineEffectParams sp; + struct ScanlineEffectParams scanlineParams; struct Task *task = &gTasks[taskId]; u16 i; - u8 r1; + u8 y; if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1) { - sp.dmaDest = ®_BG1HOFS; + scanlineParams.dmaDest = ®_BG1HOFS; task->data[2] = gBattle_BG1_X; } else { - sp.dmaDest = ®_BG2HOFS; + scanlineParams.dmaDest = ®_BG2HOFS; task->data[2] = gBattle_BG2_X; } - sp.dmaControl = 0xA2600001; - sp.initState = 1; - sp.unused9 = 0; - r1 = GetBattlerYCoordWithElevation(gBattleAnimAttacker); - task->data[3] = r1 - 32; - task->data[4] = r1 + 32; + scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; + scanlineParams.initState = 1; + scanlineParams.unused9 = 0; + y = GetBattlerYCoordWithElevation(gBattleAnimAttacker); + task->data[3] = y - 32; + task->data[4] = y + 32; if (task->data[3] < 0) task->data[3] = 0; @@ -358,7 +358,7 @@ void AnimTask_DragonDanceWaver(u8 taskId) gScanlineEffectRegBuffers[1][i] = task->data[2]; } - ScanlineEffect_SetParams(sp); + ScanlineEffect_SetParams(scanlineParams); task->func = AnimTask_DragonDanceWaver_Step; } @@ -374,12 +374,12 @@ static void AnimTask_DragonDanceWaver_Step(u8 taskId) if (++task->data[6] == 3) task->data[0]++; } - sub_8113574(task); + UpdateDragonDanceScanlineEffect(task); break; case 1: if (++task->data[1] > 0x3C) task->data[0]++; - sub_8113574(task); + UpdateDragonDanceScanlineEffect(task); break; case 2: if (++task->data[7] > 1) @@ -388,7 +388,7 @@ static void AnimTask_DragonDanceWaver_Step(u8 taskId) if (--task->data[6] == 0) task->data[0]++; } - sub_8113574(task); + UpdateDragonDanceScanlineEffect(task); break; case 3: gScanlineEffect.state = 3; @@ -400,14 +400,14 @@ static void AnimTask_DragonDanceWaver_Step(u8 taskId) } } -static void sub_8113574(struct Task *task) +static void UpdateDragonDanceScanlineEffect(struct Task *task) { - u16 r3 = task->data[5]; + u16 sineIndex = task->data[5]; u16 i; for (i = task->data[3]; i <= task->data[4]; i++) { - gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = ((gSineTable[r3] * task->data[6]) >> 7) + task->data[2]; - r3 = (r3 + 8) & 0xFF; + gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = ((gSineTable[sineIndex] * task->data[6]) >> 7) + task->data[2]; + sineIndex = (sineIndex + 8) & 0xFF; } task->data[5] = (task->data[5] + 9) & 0xFF; @@ -415,18 +415,18 @@ static void sub_8113574(struct Task *task) static void AnimOverheatFlame(struct Sprite *sprite) { - int r6 = (gBattleAnimArgs[2] * 3) / 5; int i; + int yAmplitude = (gBattleAnimArgs[2] * 3) / 5; sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[4]; sprite->data[1] = Cos(gBattleAnimArgs[1], gBattleAnimArgs[2]); - sprite->data[2] = Sin(gBattleAnimArgs[1], r6); + sprite->data[2] = Sin(gBattleAnimArgs[1], yAmplitude); sprite->pos1.x += sprite->data[1] * gBattleAnimArgs[0]; sprite->pos1.y += sprite->data[2] * gBattleAnimArgs[0]; sprite->data[3] = gBattleAnimArgs[3]; sprite->callback = AnimOverheatFlame_Step; for (i = 0; i < 7; i++) - gUnknown_0203A100[i] = sprite->data[i]; + gUnusedOverheatData[i] = sprite->data[i]; } static void AnimOverheatFlame_Step(struct Sprite *sprite) diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index f8d46af3f..154c8629b 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -3248,7 +3248,7 @@ void AnimTask_HeartsBackground(u8 taskId) gBattle_BG1_Y = 0; SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); AnimLoadCompressedBgGfx(animBg.bgId, &gBattleAnimBgImage_Attract, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_Attract, 0); LoadCompressedPalette(&gBattleAnimBgPalette_Attract, animBg.paletteId * 16, 32); @@ -3295,7 +3295,7 @@ static void AnimTask_HeartsBackground_Step(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(animBg.bgId); gTasks[taskId].data[12]++; break; @@ -3326,7 +3326,7 @@ void AnimTask_ScaryFace(u8 taskId) gBattle_BG1_Y = 0; SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); if (IsContest()) AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFaceContest, 0); else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) @@ -3379,7 +3379,7 @@ static void AnimTask_ScaryFace_Step(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(1); sub_80A6C68(2); gTasks[taskId].data[12]++; diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 7be5fa31c..eee2354b3 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2387,7 +2387,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId) if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimMaskTilemap_LightBeam, 0); if (IsContest()) { @@ -2450,7 +2450,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId) } break; case 4: - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(animBg.bgId); if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); @@ -2568,7 +2568,7 @@ void AnimTask_DoomDesireLightBeam(u8 taskId) if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimMaskTilemap_LightBeam, 0); if (IsContest()) { @@ -2639,7 +2639,7 @@ void AnimTask_DoomDesireLightBeam(u8 taskId) gTasks[taskId].data[0] = 1; break; case 5: - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(animBg.bgId); if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); @@ -3286,7 +3286,7 @@ static void AnimTask_RolePlaySilhouette_Step2(u8 taskId) TrySetSpriteRotScale(&gSprites[spriteId], TRUE, gTasks[taskId].data[10], gTasks[taskId].data[11], 0); if (++gTasks[taskId].data[12] == 9) { - sub_80A749C(&gSprites[spriteId]); + ResetSpriteRotScale_PreserveAffine(&gSprites[spriteId]); DestroySpriteAndFreeResources_(&gSprites[spriteId]); gTasks[taskId].func = DestroyAnimVisualTaskAndDisableBlend; } diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index a57e88b03..1e24f8a16 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -7,9 +7,9 @@ static void AnimLightning(struct Sprite *); static void AnimLightning_Step(struct Sprite *); -static void sub_810A214(struct Sprite *); -static void sub_810A258(struct Sprite *); -static void sub_810A274(struct Sprite *); +static void AnimUnused_0810A214(struct Sprite *); +static void AnimUnused_0810A214_Step(struct Sprite *); +static void AnimUnused_0810A274(struct Sprite *); static void AnimSparkElectricity(struct Sprite *); static void AnimZapCannonSpark(struct Sprite *); static void AnimZapCannonSpark_Step(struct Sprite *); @@ -29,13 +29,13 @@ static void AnimGrowingChargeOrb(struct Sprite *); static void AnimElectricPuff(struct Sprite *); static void AnimVoltTackleOrbSlide(struct Sprite *); static void AnimVoltTackleOrbSlide_Step(struct Sprite *); -static bool8 sub_810B154(struct Task *task, u8 taskId); +static bool8 CreateVoltTackleBolt(struct Task *task, u8 taskId); static void AnimVoltTackleBolt(struct Sprite *); static void AnimGrowingShockWaveOrb(struct Sprite *); -static bool8 sub_810B430(struct Task *task, u8 taskId); +static bool8 CreateShockWaveBoltSprite(struct Task *task, u8 taskId); static void AnimShockWaveProgressingBolt(struct Sprite *); -static bool8 sub_810B614(struct Task *task, u8 taskId); -static void sub_810B684(struct Sprite *sprite); +static bool8 CreateShockWaveLightningSprite(struct Task *task, u8 taskId); +static void AnimShockWaveLightning(struct Sprite *sprite); static const union AnimCmd sAnim_Lightning[] = { @@ -63,7 +63,7 @@ const struct SpriteTemplate gLightningSpriteTemplate = .callback = AnimLightning, }; -static const union AffineAnimCmd gUnknown_085956D8[] = +static const union AffineAnimCmd sAnim_Unused_085956D8[] = { AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 20), @@ -71,24 +71,24 @@ static const union AffineAnimCmd gUnknown_085956D8[] = AFFINEANIMCMD_END, }; -static const union AffineAnimCmd *const gUnknown_085956F8[] = +static const union AffineAnimCmd *const sAnims_Unused_085956F8[] = { - gUnknown_085956D8, + sAnim_Unused_085956D8, }; // Unused -const struct SpriteTemplate gUnknown_085956FC = +const struct SpriteTemplate gUnusedSpriteTemplate_085956FC = { .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineNormal_ObjNormal_32x32, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gUnknown_085956F8, - .callback = sub_810A214, + .affineAnims = sAnims_Unused_085956F8, + .callback = AnimUnused_0810A214, }; -static const union AnimCmd gUnknown_08595714[] = +static const union AnimCmd sAnim_Unused_08595714[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_FRAME(16, 5), @@ -99,21 +99,21 @@ static const union AnimCmd gUnknown_08595714[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_08595730[] = +static const union AnimCmd *const sAnims_Unused_08595730[] = { - gUnknown_08595714, + sAnim_Unused_08595714, }; // Unused -const struct SpriteTemplate gUnknown_08595734 = +const struct SpriteTemplate gUnusedSpriteTemplate_08595734 = { .tileTag = ANIM_TAG_SHOCK, .paletteTag = ANIM_TAG_SHOCK, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08595730, + .anims = sAnims_Unused_08595730, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810A274, + .callback = AnimUnused_0810A274, }; const struct SpriteTemplate gSparkElectricitySpriteTemplate = @@ -473,23 +473,23 @@ static void AnimLightning_Step(struct Sprite *sprite) DestroyAnimSprite(sprite); } -static void sub_810A214(struct Sprite *sprite) +static void AnimUnused_0810A214(struct Sprite *sprite) { if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) sprite->pos1.x -= gBattleAnimArgs[0]; else sprite->pos1.x += gBattleAnimArgs[0]; - sprite->callback = sub_810A258; + sprite->callback = AnimUnused_0810A214_Step; } -static void sub_810A258(struct Sprite *sprite) +static void AnimUnused_0810A214_Step(struct Sprite *sprite) { if (sprite->affineAnimEnded) DestroySpriteAndMatrix(sprite); } -static void sub_810A274(struct Sprite *sprite) +static void AnimUnused_0810A274(struct Sprite *sprite) { sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); @@ -1076,7 +1076,7 @@ void AnimTask_VoltTackleBolt(u8 taskId) if (++task->data[2] > 0) { task->data[2] = 0; - if (sub_810B154(task, taskId) || sub_810B154(task, taskId)) + if (CreateVoltTackleBolt(task, taskId) || CreateVoltTackleBolt(task, taskId)) task->data[0]++; } break; @@ -1086,7 +1086,7 @@ void AnimTask_VoltTackleBolt(u8 taskId) } } -static bool8 sub_810B154(struct Task *task, u8 taskId) +static bool8 CreateVoltTackleBolt(struct Task *task, u8 taskId) { u8 spriteId = CreateSprite(&gVoltTackleBoltSpriteTemplate, task->data[3], task->data[5], 35); if (spriteId != MAX_SPRITES) @@ -1169,7 +1169,7 @@ void AnimTask_ShockWaveProgressingBolt(u8 taskId) if (++task->data[1] > 0) { task->data[1] = 0; - if (sub_810B430(task, taskId)) + if (CreateShockWaveBoltSprite(task, taskId)) { if (task->data[2] == 5) task->data[0] = 3; @@ -1222,7 +1222,7 @@ void AnimTask_ShockWaveProgressingBolt(u8 taskId) } } -static bool8 sub_810B430(struct Task *task, u8 taskId) +static bool8 CreateShockWaveBoltSprite(struct Task *task, u8 taskId) { u8 spriteId = CreateSprite(&gShockWaveProgressingBoltSpriteTemplate, task->data[6], task->data[7], 35); if (spriteId != MAX_SPRITES) @@ -1291,7 +1291,7 @@ void AnimTask_ShockWaveLightning(u8 taskId) if (++task->data[1] > 1) { task->data[1] = 0; - if (sub_810B614(task, taskId)) + if (CreateShockWaveLightningSprite(task, taskId)) task->data[0]++; } break; @@ -1302,13 +1302,13 @@ void AnimTask_ShockWaveLightning(u8 taskId) } } -bool8 sub_810B614(struct Task *task, u8 taskId) +static bool8 CreateShockWaveLightningSprite(struct Task *task, u8 taskId) { u8 spriteId = CreateSprite(&gLightningSpriteTemplate, task->data[13], task->data[14], task->data[12]); if (spriteId != MAX_SPRITES) { - gSprites[spriteId].callback = sub_810B684; + gSprites[spriteId].callback = AnimShockWaveLightning; gSprites[spriteId].data[6] = taskId; gSprites[spriteId].data[7] = 10; task->data[10]++; @@ -1319,7 +1319,7 @@ bool8 sub_810B614(struct Task *task, u8 taskId) return FALSE; } -static void sub_810B684(struct Sprite *sprite) +static void AnimShockWaveLightning(struct Sprite *sprite) { if (sprite->animEnded) { diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index 344ea7c1f..05138111b 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -6,7 +6,7 @@ #include "trig.h" #include "constants/rgb.h" -static void unc_080B08A0(struct Sprite *); +static void AnimUnused_080B08A0(struct Sprite *); static void AnimSlideHandOrFootToTarget(struct Sprite *); static void AnimJumpKick(struct Sprite *); static void AnimBasicFistOrFoot(struct Sprite *); @@ -40,7 +40,7 @@ static void AnimSpinningKickOrPunchFinish(struct Sprite *); extern struct SpriteTemplate gBasicHitSplatSpriteTemplate; // Unused -const struct SpriteTemplate gUnknown_08595E14 = +const struct SpriteTemplate gUnusedSpriteTemplate_08595E14 = { .tileTag = ANIM_TAG_HUMANOID_FOOT, .paletteTag = ANIM_TAG_HUMANOID_FOOT, @@ -48,7 +48,7 @@ const struct SpriteTemplate gUnknown_08595E14 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = unc_080B08A0, + .callback = AnimUnused_080B08A0, }; static const union AnimCmd sAnim_HandOrFoot[] = @@ -417,7 +417,7 @@ const struct SpriteTemplate gFocusPunchFistSpriteTemplate = .callback = AnimFocusPunchFist, }; -static void unc_080B08A0(struct Sprite *sprite) +static void AnimUnused_080B08A0(struct Sprite *sprite) { SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]); sprite->pos1.y += gBattleAnimArgs[1]; @@ -1008,7 +1008,7 @@ void AnimTask_MoveSkyUppercutBg(u8 taskId) switch (task->data[0]) { case 0: - sub_80A6DAC(0); + UpdateAnimBg3ScreenSize(FALSE); task->data[8] = gBattleAnimArgs[0]; task->data[0]++; break; @@ -1037,7 +1037,7 @@ void AnimTask_MoveSkyUppercutBg(u8 taskId) { gBattle_BG3_X = 0; gBattle_BG3_Y = 0; - sub_80A6DAC(1); + UpdateAnimBg3ScreenSize(TRUE); DestroyAnimVisualTask(taskId); } } diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index 1073f10fa..c90d7f4f1 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -11,9 +11,9 @@ static void AnimFireSpiralInward(struct Sprite *); static void AnimFireSpread(struct Sprite *); static void AnimFirePlume(struct Sprite *); static void AnimLargeFlame(struct Sprite *); -static void sub_8109028(struct Sprite *); -static void sub_8109064(struct Sprite *); -static void sub_81090D8(struct Sprite *); +static void AnimLargeFlame_Step(struct Sprite *); +static void AnimUnused_8109064(struct Sprite *); +static void AnimUnused_8109064_Step(struct Sprite *); static void AnimSunlight(struct Sprite *); static void AnimEmberFlare(struct Sprite *); static void AnimBurnFlame(struct Sprite *); @@ -162,7 +162,7 @@ const struct SpriteTemplate gFirePlumeSpriteTemplate = }; // Unused -const struct SpriteTemplate gUnknown_08595440 = +const struct SpriteTemplate gUnusedSpriteTemplate_08595440 = { .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, @@ -173,7 +173,7 @@ const struct SpriteTemplate gUnknown_08595440 = .callback = AnimFirePlume, }; -static const union AnimCmd gUnknown_08595458[] = +static const union AnimCmd sAnim_Unused_08595458[] = { ANIMCMD_FRAME(16, 6), ANIMCMD_FRAME(32, 6), @@ -181,21 +181,21 @@ static const union AnimCmd gUnknown_08595458[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_08595468[] = +static const union AnimCmd *const sAnims_Unused_08595468[] = { - gUnknown_08595458, + sAnim_Unused_08595458, }; // Unused -const struct SpriteTemplate gUnknown_0859546C = +const struct SpriteTemplate gUnusedSpriteTemplate_0859546C = { .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08595468, + .anims = sAnims_Unused_08595468, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8109064, + .callback = AnimUnused_8109064, }; static const union AffineAnimCmd sAffineAnim_SunlightRay[] = @@ -292,23 +292,23 @@ static const union AnimCmd *const sAnims_FireBlastCross[] = sAnim_FireBlastCross, }; -static const union AffineAnimCmd gUnknown_08595544[] = +static const union AffineAnimCmd sAnim_Unused_08595544[] = { AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 1), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_08595554[] = +static const union AffineAnimCmd sAnim_Unused_08595554[] = { AFFINEANIMCMD_FRAME(0xA0, 0xA0, 0, 0), AFFINEANIMCMD_END, }; // Unused -static const union AffineAnimCmd *const gUnknown_08595564[] = +static const union AffineAnimCmd *const sAnims_Unused_08595564[] = { - gUnknown_08595544, - gUnknown_08595554, + sAnim_Unused_08595544, + sAnim_Unused_08595554, }; const struct SpriteTemplate gFireBlastCrossSpriteTemplate = @@ -511,7 +511,7 @@ static void AnimFirePlume(struct Sprite *sprite) sprite->data[4] = gBattleAnimArgs[3]; sprite->data[3] = gBattleAnimArgs[5]; - sprite->callback = sub_8109028; + sprite->callback = AnimLargeFlame_Step; } static void AnimLargeFlame(struct Sprite *sprite) @@ -533,10 +533,10 @@ static void AnimLargeFlame(struct Sprite *sprite) sprite->data[4] = gBattleAnimArgs[3]; sprite->data[3] = gBattleAnimArgs[5]; - sprite->callback = sub_8109028; + sprite->callback = AnimLargeFlame_Step; } -static void sub_8109028(struct Sprite *sprite) +static void AnimLargeFlame_Step(struct Sprite *sprite) { if (++sprite->data[0] < sprite->data[4]) { @@ -548,7 +548,7 @@ static void sub_8109028(struct Sprite *sprite) DestroySpriteAndMatrix(sprite); } -static void sub_8109064(struct Sprite *sprite) +static void AnimUnused_8109064(struct Sprite *sprite) { SetSpriteCoordsToAnimAttackerCoords(sprite); @@ -570,10 +570,10 @@ static void sub_8109064(struct Sprite *sprite) sprite->data[4] = gBattleAnimArgs[6]; sprite->data[5] = 0; - sprite->callback = sub_81090D8; + sprite->callback = AnimUnused_8109064_Step; } -static void sub_81090D8(struct Sprite *sprite) +static void AnimUnused_8109064_Step(struct Sprite *sprite) { if (sprite->data[3]) { @@ -611,8 +611,6 @@ static void AnimSunlight(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -//fire 2 - // Animates the secondary effect of MOVE_EMBER, where the flames grow and slide // horizontally a bit. // arg 0: initial x pixel offset @@ -792,15 +790,14 @@ void AnimTask_EruptionLaunchRocks(u8 taskId) task->func = AnimTask_EruptionLaunchRocks_Step; } -static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTION? +static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; switch (task->data[0]) { case 0: - sub_80A805C(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 0x20); - + PrepareEruptAnimTaskData(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 32); task->data[0]++; case 1: if (++task->data[1] > 1) @@ -813,7 +810,7 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO gSprites[task->data[15]].pos2.x = -3; } - if (task->data[5]) + if (task->data[5] != B_SIDE_PLAYER) { if (++task->data[3] > 4) { @@ -822,7 +819,7 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO } } - if(!sub_80A80C8(task)) + if(!UpdateEruptAnimTask(task)) { SetBattlerSpriteYOffsetFromYScale(task->data[15]); gSprites[task->data[15]].pos2.x = 0; @@ -836,20 +833,19 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO case 2: if (++task->data[1] > 4) { - if (task->data[5]) - sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 0x6); + if (task->data[5] != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 6); else - sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 0x6); + PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 6); task->data[1] = 0; task->data[0]++; } break; case 3: - if (!sub_80A80C8(task)) + if (!UpdateEruptAnimTask(task)) { CreateEruptionLaunchRocks(task->data[15], taskId, 6); - task->data[0]++; } break; @@ -866,10 +862,10 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO if (++task->data[3] > 0x18) { - if (task->data[5]) - sub_80A805C(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 0x8); + if (task->data[5] != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 8); else - sub_80A805C(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 0x8); + PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 8); if (task->data[2] & 1) gSprites[task->data[15]].pos2.y -= 3; @@ -881,14 +877,13 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO } break; case 5: - if (task->data[5]) + if (task->data[5] != B_SIDE_PLAYER) gSprites[task->data[15]].pos1.y--; - if (!sub_80A80C8(task)) + if (!UpdateEruptAnimTask(task)) { gSprites[task->data[15]].pos1.y = task->data[4]; ResetSpriteRotScale(task->data[15]); - task->data[2] = 0; task->data[0]++; } @@ -896,7 +891,6 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO case 6: if (!task->data[6]) DestroyAnimVisualTask(taskId); - break; default: break; @@ -955,16 +949,12 @@ static void AnimEruptionLaunchRock(struct Sprite *sprite) static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId) { - u16 y = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y + gSprites[spriteId].centerToCornerVecY; + s16 y = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y + gSprites[spriteId].centerToCornerVecY; if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) - { - y = ((y << 16) + 0x4A0000) >> 16; - } + y += 74; else - { - y = ((y << 16) + 0x2C0000) >> 16; - } + y += 44; return y; } @@ -1282,14 +1272,14 @@ static void AnimTask_MoveHeatWaveTargets_Step(u8 taskId) } } -// Used to add a color mask to the battle interface / HUD in Heat Wave. +// Used to add a color mask to the battle background. // arg 0: opacity // arg 1: color code void AnimTask_BlendBackground(u8 taskId) { struct BattleAnimBgData animBg; - sub_80A6B30(&animBg); - BlendPalette(animBg.paletteId * 16, 16, gBattleAnimArgs[0], gBattleAnimArgs[1]); // u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor + GetDefaultBattleAnimBgData(&animBg); + BlendPalette(animBg.paletteId * 16, 16, gBattleAnimArgs[0], gBattleAnimArgs[1]); DestroyAnimVisualTask(taskId); } diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 7d96fed8c..060149a9e 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -18,9 +18,9 @@ static void AnimFlyBallUp_Step(struct Sprite *); static void AnimFlyBallAttack(struct Sprite *); static void AnimFlyBallAttack_Step(struct Sprite *); static void AnimFallingFeather(struct Sprite *); -static void sub_810E520(struct Sprite *); -static void sub_810EB40(struct Sprite *); -static void sub_810EA4C(struct Sprite *); +static void AnimFallingFeather_Step(struct Sprite *); +static void AnimWhirlwindLine_Step(struct Sprite *); +static void AnimUnused_810EA4C(struct Sprite *); static void AnimWhirlwindLine(struct Sprite *); static void AnimBounceBallShrink(struct Sprite *); static void AnimBounceBallLand(struct Sprite *); @@ -30,8 +30,8 @@ static void AnimDiveBall_Step2(struct Sprite *); static void AnimDiveWaterSplash(struct Sprite *); static void AnimSprayWaterDroplet(struct Sprite *); static void AnimSprayWaterDroplet_Step(struct Sprite *); -static void sub_810F004(struct Sprite *); -static void sub_810F018(struct Sprite *); +static void AnimUnused_810F004(struct Sprite *); +static void AnimUnused_810F004_Step(struct Sprite *); static void AnimSkyAttackBird(struct Sprite *); static void AnimSkyAttackBird_Step(struct Sprite *); static void AnimTask_AnimateGustTornadoPalette_Step(u8); @@ -179,7 +179,8 @@ const struct SpriteTemplate gFallingFeatherSpriteTemplate = .callback = AnimFallingFeather, }; -const struct SpriteTemplate gUnknown_085963A0 = +// Unused +const struct SpriteTemplate gUnusedSpriteTemplate_085963A0 = { .tileTag = ANIM_TAG_SMALL_BUBBLES, .paletteTag = ANIM_TAG_SMALL_BUBBLES, @@ -187,7 +188,7 @@ const struct SpriteTemplate gUnknown_085963A0 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810EA4C, + .callback = AnimUnused_810EA4C, }; static const union AnimCmd sAnim_WhirlwindLines[] = @@ -289,7 +290,7 @@ const struct SpriteTemplate gDiveBallSpriteTemplate = .callback = AnimDiveBall, }; -static const union AffineAnimCmd gUnknown_085964A8[] = +static const union AffineAnimCmd sAnim_Unused_085964A8[] = { AFFINEANIMCMD_FRAME(0x100, 0x0, 0, 0), AFFINEANIMCMD_FRAME(0x0, 0x20, 0, 12), @@ -298,9 +299,9 @@ static const union AffineAnimCmd gUnknown_085964A8[] = }; // Unused -static const union AffineAnimCmd *const gUnknown_085964C8[] = +static const union AffineAnimCmd *const sAnims_Unused_085964C8[] = { - gUnknown_085964A8, + sAnim_Unused_085964A8, }; const struct SpriteTemplate gDiveWaterSplashSpriteTemplate = @@ -325,7 +326,8 @@ const struct SpriteTemplate gSprayWaterDropletSpriteTemplate = .callback = AnimSprayWaterDroplet, }; -const struct SpriteTemplate gUnknown_085964FC = +// Unused +const struct SpriteTemplate gUnusedSpriteTemplate_085964FC = { .tileTag = ANIM_TAG_CIRCLE_OF_LIGHT, .paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT, @@ -333,7 +335,7 @@ const struct SpriteTemplate gUnknown_085964FC = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810F004, + .callback = AnimUnused_810F004, }; const struct SpriteTemplate gSkyAttackBirdSpriteTemplate = @@ -639,10 +641,10 @@ static void AnimFallingFeather(struct Sprite *sprite) gOamMatrices[matrixNum].b = spriteCoord; gOamMatrices[matrixNum].c = -spriteCoord; - sprite->callback = sub_810E520; + sprite->callback = AnimFallingFeather_Step; } -static void sub_810E520(struct Sprite *sprite) +static void AnimFallingFeather_Step(struct Sprite *sprite) { u8 matrixNum, sinIndex; s16 sinVal = 0; @@ -890,7 +892,7 @@ static void sub_810E520(struct Sprite *sprite) } } -static void sub_810EA4C(struct Sprite *sprite) +static void AnimUnused_810EA4C(struct Sprite *sprite) { sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget); sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); @@ -900,7 +902,7 @@ static void sub_810EA4C(struct Sprite *sprite) static void AnimWhirlwindLine(struct Sprite * sprite) { - u16 arg; + u16 offset; u8 mult; if (gBattleAnimArgs[2] == ANIM_ATTACKER) @@ -918,15 +920,15 @@ static void AnimWhirlwindLine(struct Sprite * sprite) sprite->pos1.x -= 32; sprite->data[1] = 0x0ccc; - arg = gBattleAnimArgs[4]; + offset = gBattleAnimArgs[4]; mult = 12; - sprite->pos2.x += mult * arg; - sprite->data[0] = arg; + sprite->pos2.x += mult * offset; + sprite->data[0] = offset; sprite->data[7] = gBattleAnimArgs[3]; - sprite->callback = sub_810EB40; + sprite->callback = AnimWhirlwindLine_Step; } -static void sub_810EB40(struct Sprite *sprite) +static void AnimWhirlwindLine_Step(struct Sprite *sprite) { sprite->pos2.x += sprite->data[1] >> 8; @@ -1063,9 +1065,9 @@ static void AnimDiveWaterSplash(struct Sprite *sprite) sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1); } - sprite->data[1] = 512; + sprite->data[1] = 0x200; - TrySetSpriteRotScale(sprite, 0, 256, sprite->data[1], 0); + TrySetSpriteRotScale(sprite, 0, 0x100, sprite->data[1], 0); sprite->data[0]++; break; case 1: @@ -1076,11 +1078,11 @@ static void AnimDiveWaterSplash(struct Sprite *sprite) sprite->data[2]++; - TrySetSpriteRotScale(sprite, 0, 256, sprite->data[1], 0); + TrySetSpriteRotScale(sprite, 0, 0x100, sprite->data[1], 0); matrixNum = sprite->oam.matrixNum; - t1 = 15616; + t1 = 0x3D00; t2 = t1 / gOamMatrices[matrixNum].d + 1; if (t2 > 128) @@ -1091,7 +1093,7 @@ static void AnimDiveWaterSplash(struct Sprite *sprite) if (sprite->data[2] == 24) { - sub_80A749C(sprite); + ResetSpriteRotScale_PreserveAffine(sprite); DestroyAnimSprite(sprite); } break; @@ -1156,14 +1158,14 @@ static void AnimSprayWaterDroplet_Step(struct Sprite *sprite) DestroyAnimSprite(sprite); } -static void sub_810F004(struct Sprite *sprite) +static void AnimUnused_810F004(struct Sprite *sprite) { sprite->data[6] = 0; sprite->data[7] = 64; - sprite->callback = sub_810F018; + sprite->callback = AnimUnused_810F004_Step; } -static void sub_810F018(struct Sprite *sprite) +static void AnimUnused_810F004_Step(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -1218,7 +1220,7 @@ void AnimSkyAttackBird_Step(struct Sprite *sprite) DestroySpriteAndMatrix(sprite); } -void unref_sub_810F184(u8 taskId) +void AnimTask_Unused_810F184(u8 taskId) { if (gBattleAnimArgs[0] == 0) { diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index 9ce9a249c..4babe577a 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -998,7 +998,7 @@ void AnimTask_HazeScrollingFog(u8 taskId) SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimFogTilemap, 0); LoadPalette(&gUnknown_083970E8, animBg.paletteId * 16, 32); @@ -1052,7 +1052,7 @@ static void AnimTask_Haze2(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(1); sub_80A6C68(2); @@ -1105,7 +1105,7 @@ void AnimTask_LoadMistTiles(u8 taskId) SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimFogTilemap, 0); LoadPalette(&gUnknown_083970E8, animBg.paletteId * 16, 32); @@ -1154,7 +1154,7 @@ static void AnimTask_OverlayFogTiles(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(1); sub_80A6C68(2); diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 3e86f31f7..e412ca5de 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -849,25 +849,25 @@ bool8 IsDoubleBattle(void) return IS_DOUBLE_BATTLE(); } -void sub_80A6B30(struct BattleAnimBgData *unk) +void GetDefaultBattleAnimBgData(struct BattleAnimBgData *out) { if (IsContest()) { - unk->bgTiles = gUnknown_0202305C; - unk->bgTilemap = (u16 *)gUnknown_02023060; - unk->paletteId = 14; - unk->bgId = 1; - unk->tilesOffset = 0; - unk->unused = 0; + out->bgTiles = gUnknown_0202305C; + out->bgTilemap = (u16 *)gUnknown_02023060; + out->paletteId = 14; + out->bgId = 1; + out->tilesOffset = 0; + out->unused = 0; } else { - unk->bgTiles = gUnknown_0202305C; - unk->bgTilemap = (u16 *)gUnknown_02023060; - unk->paletteId = 8; - unk->bgId = 1; - unk->tilesOffset = 0x200; - unk->unused = 0; + out->bgTiles = gUnknown_0202305C; + out->bgTilemap = (u16 *)gUnknown_02023060; + out->paletteId = 8; + out->bgId = 1; + out->tilesOffset = 0x200; + out->unused = 0; } } @@ -884,7 +884,7 @@ void sub_80A6B90(struct BattleAnimBgData *unk, u32 arg1) } else if (arg1 == 1) { - sub_80A6B30(unk); + GetDefaultBattleAnimBgData(unk); } else { @@ -970,9 +970,9 @@ u8 GetBattleBgPaletteNum(void) return 2; } -void sub_80A6DAC(bool8 arg0) +void UpdateAnimBg3ScreenSize(bool8 largeScreenSize) { - if (!arg0 || IsContest()) + if (!largeScreenSize || IsContest()) { SetAnimBgAttribute(3, BG_ANIM_SCREEN_SIZE, 0); SetAnimBgAttribute(3, BG_ANIM_AREA_OVERFLOW_MODE, 1); @@ -1292,7 +1292,7 @@ void TrySetSpriteRotScale(struct Sprite *sprite, bool8 recalcCenterVector, s16 x } } -void sub_80A749C(struct Sprite *sprite) +void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite) { TrySetSpriteRotScale(sprite, TRUE, 0x100, 0x100, 0); sprite->affineAnimPaused = FALSE; @@ -1896,19 +1896,19 @@ void *LoadPointerFromVars(s16 lo, s16 hi) return (void *)((u16)lo | ((u16)hi << 16)); } -void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7) +void PrepareEruptAnimTaskData(struct Task *task, u8 spriteId, s16 xScaleStart, s16 yScaleStart, s16 xScaleEnd, s16 yScaleEnd, u16 duration) { - task->data[8] = a7; - task->data[15] = a2; // spriteId - task->data[9] = a3; - task->data[10] = a4; - task->data[13] = a5; - task->data[14] = a6; - task->data[11] = (a5 - a3) / a7; - task->data[12] = (a6 - a4) / a7; + task->data[8] = duration; + task->data[15] = spriteId; + task->data[9] = xScaleStart; + task->data[10] = yScaleStart; + task->data[13] = xScaleEnd; + task->data[14] = yScaleEnd; + task->data[11] = (xScaleEnd - xScaleStart) / duration; + task->data[12] = (yScaleEnd - yScaleStart) / duration; } -u8 sub_80A80C8(struct Task *task) +u8 UpdateEruptAnimTask(struct Task *task) { if (!task->data[8]) return 0; diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index 29ba49346..3fa721a6c 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -411,7 +411,7 @@ void AnimTask_LoadSandstormBackground(u8 taskId) SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Sandstorm, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Sandstorm, 0); LoadCompressedPalette(gBattleAnimSpritePal_FlyingDirt, animBg.paletteId * 16, 32); @@ -470,7 +470,7 @@ static void AnimTask_LoadSandstormBackground_Step(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); sub_80A6C68(animBg.bgId); gTasks[taskId].data[12]++; break; @@ -833,7 +833,7 @@ void AnimTask_MoveSeismicTossBg(u8 taskId) { if (gTasks[taskId].data[0] == 0) { - sub_80A6DAC(FALSE); + UpdateAnimBg3ScreenSize(FALSE); gTasks[taskId].data[1] = 200; } @@ -842,7 +842,7 @@ void AnimTask_MoveSeismicTossBg(u8 taskId) if (gTasks[taskId].data[0] == 120) { - sub_80A6DAC(TRUE); + UpdateAnimBg3ScreenSize(TRUE); DestroyAnimVisualTask(taskId); } @@ -853,7 +853,7 @@ void AnimTask_SeismicTossBgAccelerateDownAtEnd(u8 taskId) { if (gTasks[taskId].data[0] == 0) { - sub_80A6DAC(FALSE); + UpdateAnimBg3ScreenSize(FALSE); gTasks[taskId].data[0]++; gTasks[taskId].data[2] = gBattle_BG3_Y; } @@ -865,7 +865,7 @@ void AnimTask_SeismicTossBgAccelerateDownAtEnd(u8 taskId) if (gBattleAnimArgs[7] == 0xFFF) { gBattle_BG3_Y = 0; - sub_80A6DAC(TRUE); + UpdateAnimBg3ScreenSize(TRUE); DestroyAnimVisualTask(taskId); } } diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index eed163816..8fc93c3aa 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -6,16 +6,21 @@ #include "task.h" #include "constants/battle_anim.h" -// this file's functions -static void sub_8158B98(u8 taskId); -static void sub_8158C04(u8 taskId); +static void SoundTask_FireBlast_Step1(u8 taskId); +static void SoundTask_FireBlast_Step2(u8 taskId); static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId); static void SoundTask_PlayDoubleCry_Step(u8 taskId); static void SoundTask_PlayCryWithEcho_Step(u8 taskId); static void SoundTask_AdjustPanningVar_Step(u8 taskId); -// task start -void sub_8158B30(u8 taskId) +// Loops the specified sound effect and pans from the +// attacker to the target. The second specified sound effect +// is played at the very end. This task is effectively +// hardcoded to the move FIRE_BLAST due to the baked-in +// durations. +// arg 0: looped sound effect +// arg 1: ending sound effect +void SoundTask_FireBlast(u8 taskId) { s8 pan1, pan2, panIncrement; @@ -31,10 +36,10 @@ void sub_8158B30(u8 taskId) gTasks[taskId].data[4] = panIncrement; gTasks[taskId].data[10] = 10; - gTasks[taskId].func = sub_8158B98; + gTasks[taskId].func = SoundTask_FireBlast_Step1; } -static void sub_8158B98(u8 taskId) +static void SoundTask_FireBlast_Step1(u8 taskId) { s16 pan = gTasks[taskId].data[2]; s8 panIncrement = gTasks[taskId].data[4]; @@ -42,7 +47,7 @@ static void sub_8158B98(u8 taskId) { gTasks[taskId].data[10] = 5; gTasks[taskId].data[11] = 0; - gTasks[taskId].func = sub_8158C04; + gTasks[taskId].func = SoundTask_FireBlast_Step2; } else { @@ -56,7 +61,7 @@ static void sub_8158B98(u8 taskId) } } -static void sub_8158C04(u8 taskId) +static void SoundTask_FireBlast_Step2(u8 taskId) { if (++gTasks[taskId].data[10] == 6) { @@ -69,9 +74,7 @@ static void sub_8158C04(u8 taskId) DestroyAnimSoundTask(taskId); } } -// task end -// task start void SoundTask_LoopSEAdjustPanning(u8 taskId) { u16 songId = gBattleAnimArgs[0]; @@ -123,9 +126,7 @@ static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId) gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11], oldPan); } } -// task end -// task start void SoundTask_PlayCryHighPitch(u8 taskId) { u16 species = 0; @@ -169,9 +170,7 @@ void SoundTask_PlayCryHighPitch(u8 taskId) DestroyAnimVisualTask(taskId); } -// task end -// task start void SoundTask_PlayDoubleCry(u8 taskId) { u16 species = 0; @@ -258,7 +257,6 @@ static void SoundTask_PlayDoubleCry_Step(u8 taskId) } } } -// task end void SoundTask_WaitForCry(u8 taskId) { @@ -273,7 +271,6 @@ void SoundTask_WaitForCry(u8 taskId) } } -// task start void SoundTask_PlayCryWithEcho(u8 taskId) { u16 species; @@ -329,7 +326,6 @@ static void SoundTask_PlayCryWithEcho_Step(u8 taskId) break; } } -// task end void SoundTask_PlaySE1WithPanning(u8 taskId) { @@ -389,4 +385,3 @@ static void SoundTask_AdjustPanningVar_Step(u8 taskId) if (gTasks[taskId].data[11] == gTasks[taskId].data[2]) DestroyAnimVisualTask(taskId); } - diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 0da766036..cc8c3354e 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -464,7 +464,7 @@ void unref_sub_8170478(u8 taskId) gSprites[spriteId3].callback = SpriteCallbackDummy; gSprites[spriteId4].callback = SpriteCallbackDummy; - sub_80A6B30(&unknownStruct); + GetDefaultBattleAnimBgData(&unknownStruct); AnimLoadCompressedBgTilemap(unknownStruct.bgId, gUnknown_08C2EA9C); AnimLoadCompressedBgGfx(unknownStruct.bgId, gUnknown_08C2EA50, unknownStruct.tilesOffset); LoadCompressedPalette(gCureBubblesPal, unknownStruct.paletteId << 4, 32); diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 598d27f09..53ed5698a 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -330,7 +330,7 @@ void AnimTask_DrawFallingWhiteLinesOnAttacker(u8 taskId) spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); newSpriteId = sub_80A89C8(gBattleAnimAttacker, spriteId, species); - sub_80A6B30(&unknownStruct); + GetDefaultBattleAnimBgData(&unknownStruct); AnimLoadCompressedBgTilemapHandleContest(&unknownStruct, gUnknown_08C20684, 0); AnimLoadCompressedBgGfx(unknownStruct.bgId, gUnknown_08C20668, unknownStruct.tilesOffset); LoadPalette(&gUnknown_08597418, unknownStruct.paletteId * 16 + 1, 2); @@ -377,7 +377,7 @@ static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId) sprite = &gSprites[gTasks[taskId].data[0]]; DestroySprite(sprite); - sub_80A6B30(&unknownStruct); + GetDefaultBattleAnimBgData(&unknownStruct); sub_80A6C68(unknownStruct.bgId); if (gTasks[taskId].data[6] == 1) gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++; @@ -468,7 +468,7 @@ static void sub_81170EC(u8 taskId) spriteId2 = sub_80A89C8(sAnimStatsChangeData->battler2, battlerSpriteId, sAnimStatsChangeData->species); } - sub_80A6B30(&unknownStruct); + GetDefaultBattleAnimBgData(&unknownStruct); if (sAnimStatsChangeData->data[0] == 0) AnimLoadCompressedBgTilemapHandleContest(&unknownStruct, gBattleStatMask1_Tilemap, 0); else @@ -705,7 +705,7 @@ void AnimTask_StartSlidingBg(u8 taskId) { u8 newTaskId; - sub_80A6DAC(0); + UpdateAnimBg3ScreenSize(FALSE); newTaskId = CreateTask(AnimTask_UpdateSlidingBg, 5); if (gBattleAnimArgs[2] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { @@ -733,7 +733,7 @@ static void AnimTask_UpdateSlidingBg(u8 taskId) { gBattle_BG3_X = 0; gBattle_BG3_Y = 0; - sub_80A6DAC(1); + UpdateAnimBg3ScreenSize(TRUE); DestroyTask(taskId); } } @@ -824,7 +824,7 @@ void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, if (arg4) spriteId2 = sub_80A89C8(battler2, gBattlerSpriteIds[battler2], species); - sub_80A6B30(&unknownStruct); + GetDefaultBattleAnimBgData(&unknownStruct); AnimLoadCompressedBgTilemapHandleContest(&unknownStruct, tilemap, 0); AnimLoadCompressedBgGfx(unknownStruct.bgId, gfx, unknownStruct.tilesOffset); LoadCompressedPalette(palette, unknownStruct.paletteId * 16, 32); diff --git a/src/battle_anim_water.c b/src/battle_anim_water.c index f157102b0..e9bf2466f 100644 --- a/src/battle_anim_water.c +++ b/src/battle_anim_water.c @@ -811,7 +811,7 @@ void AnimTask_CreateSurfWave(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1); - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); if (!IsContest()) { SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); @@ -884,7 +884,7 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId) *BGptrX += gTasks[taskId].data[0]; *BGptrY += gTasks[taskId].data[1]; - sub_80A6B30(&animBg); + GetDefaultBattleAnimBgData(&animBg); gTasks[taskId].data[2] += gTasks[taskId].data[1]; if (++gTasks[taskId].data[5] == 4) { @@ -1053,7 +1053,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) switch (task->data[0]) { case 0: - sub_80A805C(task, task->data[15], 0x100, 0x100, 224, 0x200, 32); + PrepareEruptAnimTaskData(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 32); task->data[0]++; case 1: if (++task->data[3] > 1) @@ -1069,7 +1069,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) gSprites[task->data[15]].pos2.x = -3; } } - if (sub_80A80C8(task) == 0) + if (UpdateEruptAnimTask(task) == 0) { SetBattlerSpriteYOffsetFromYScale(task->data[15]); gSprites[task->data[15]].pos2.x = 0; @@ -1081,13 +1081,13 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) case 2: if (++task->data[3] > 4) { - sub_80A805C(task, task->data[15], 224, 0x200, 384, 224, 8); + PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xE0, 8); task->data[3] = 0; task->data[0]++; } break; case 3: - if (sub_80A80C8(task) == 0) + if (UpdateEruptAnimTask(task) == 0) { task->data[3] = 0; task->data[4] = 0; @@ -1107,7 +1107,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) gSprites[task->data[15]].pos2.y -= 2; if (task->data[4] == 10) { - sub_80A805C(task, task->data[15], 384, 224, 0x100, 0x100, 8); + PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xE0, 0x100, 0x100, 8); task->data[3] = 0; task->data[4] = 0; task->data[0]++; @@ -1116,7 +1116,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) break; case 6: gSprites[task->data[15]].pos1.y--; - if (sub_80A80C8(task) == 0) + if (UpdateEruptAnimTask(task) == 0) { ResetSpriteRotScale(task->data[15]); gSprites[task->data[15]].pos1.y = task->data[5];