From 4228509e957b7f90bce7f7b470e18a0dfd32c2fc Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 21:47:00 -0500 Subject: [PATCH] Sync link opponent controller doc to opponent --- src/battle_controller_link_opponent.c | 94 +++++++++++++-------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index ebacf00204..dd44bc91b9 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -92,14 +92,14 @@ static void LinkOpponentCmdEnd(void); static void LinkOpponentBufferRunCommand(void); static void LinkOpponentBufferExecCompleted(void); -static void sub_8064DD0(void); +static void SwitchIn_HandleSoundAndEnd(void); static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst); static void SetLinkOpponentMonData(u8 monId); -static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void LinkOpponentDoMoveAnimation(void); -static void sub_8067618(u8 taskId); -static void sub_80676FC(struct Sprite *sprite); +static void Task_StartSendOutAnim(u8 taskId); +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); static void EndDrawPartyStatusSummary(void); static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = @@ -163,7 +163,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_TERMINATOR_NOP] = LinkOpponentCmdEnd }; -static void nullsub_28(void) +static void LinkOpponentDummy(void) { } @@ -195,7 +195,7 @@ static void CompleteOnBankSpriteCallbackDummy2(void) LinkOpponentBufferExecCompleted(); } -static void sub_8064470(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -206,7 +206,7 @@ static void sub_8064470(void) } } -static void sub_80644D8(void) +static void Intro_DelayAndEnd(void) { if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { @@ -215,29 +215,29 @@ static void sub_80644D8(void) } } -static void sub_8064520(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool32 r8 = FALSE; - bool32 r4 = FALSE; + bool32 healthboxAnimDone = FALSE; + bool32 twoMons = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r8 = TRUE; + healthboxAnimDone = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { - r8 = TRUE; + healthboxAnimDone = TRUE; } - r4 = TRUE; + twoMons = TRUE; } - if (r8) + if (healthboxAnimDone) { - if (r4 || !IsBattlerSpriteVisible(BATTLE_PARTNER(gActiveBattler))) + if (twoMons || !IsBattlerSpriteVisible(BATTLE_PARTNER(gActiveBattler))) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) return; @@ -269,13 +269,13 @@ static void sub_8064520(void) } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_80644D8; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_8064734(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 r10 = FALSE; + bool32 bgmRestored = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim @@ -328,10 +328,10 @@ static void sub_8064734(void) } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; - r10 = TRUE; + bgmRestored = TRUE; } - if (r10) + if (bgmRestored) { if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -357,12 +357,12 @@ static void sub_8064734(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_8064520; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } } -static void sub_8064B04(void) +static void TryShinyAnimAfterMonAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) @@ -401,7 +401,7 @@ static void CompleteOnHealthbarDone(void) } } -static void sub_8064C14(void) +static void HideHealthboxAfterMonFaint(void) { if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { @@ -410,7 +410,7 @@ static void sub_8064C14(void) } } -static void sub_8064C58(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -447,18 +447,18 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_8064D60(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_8064DD0; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; } } -static void sub_8064DD0(void) +static void SwitchIn_HandleSoundAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { @@ -471,7 +471,7 @@ static void sub_8064DD0(void) } } -static void sub_8064E50(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -488,11 +488,11 @@ static void sub_8064E50(void) StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = sub_8064D60; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_8064F40(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) @@ -505,7 +505,7 @@ static void sub_8064F40(void) { DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8064E50; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1141,17 +1141,17 @@ static void LinkOpponentHandleLoadMonSprite(void) SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8064B04; + gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; } static void LinkOpponentHandleSwitchInAnim(void) { gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; - sub_8066494(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_8064F40; + StartSendOutAnim(gActiveBattler, gBattleBufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; @@ -1215,7 +1215,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_8064C58; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } @@ -1345,7 +1345,7 @@ static void LinkOpponentHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_8064470; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } static void LinkOpponentHandleFaintAnimation(void) @@ -1363,7 +1363,7 @@ static void LinkOpponentHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = sub_8064C14; + gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; } } } @@ -1706,19 +1706,19 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_80676FC); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - taskId = CreateTask(sub_8067618, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = nullsub_28; + gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDummy; } -static void sub_8067618(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { u8 savedActiveBank = gActiveBattler; @@ -1726,23 +1726,23 @@ static void sub_8067618(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_8066494(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_8066494(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler = BATTLE_PARTNER(gActiveBattler); gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_8066494(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler = BATTLE_PARTNER(gActiveBattler); } - gBattlerControllerFuncs[gActiveBattler] = sub_8064734; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } -static void sub_80676FC(struct Sprite *sprite) +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) { FreeTrainerFrontPicPalette(sprite->oam.affineParam); FreeSpriteOamMatrix(sprite);