From 2f426e0e7d70217d50f281484a6772c25e2e39b0 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 29 Dec 2020 16:51:44 -0500 Subject: Index battle controller cmd tables --- src/battle_controller_link_opponent.c | 138 +++++++++++++++++----------------- 1 file changed, 69 insertions(+), 69 deletions(-) (limited to 'src/battle_controller_link_opponent.c') diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 1041f6fda..269b4c1b4 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -69,10 +69,10 @@ static void LinkOpponentHandleTwoReturnValues(void); static void LinkOpponentHandleChosenMonReturnValue(void); static void LinkOpponentHandleOneReturnValue(void); static void LinkOpponentHandleOneReturnValue_Duplicate(void); -static void LinkOpponentHandleCmd37(void); -static void LinkOpponentHandleCmd38(void); -static void LinkOpponentHandleCmd39(void); -static void LinkOpponentHandleCmd40(void); +static void LinkOpponentHandleClearUnkVar(void); +static void LinkOpponentHandleSetUnkVar(void); +static void LinkOpponentHandleClearUnkFlag(void); +static void LinkOpponentHandleToggleUnkFlag(void); static void LinkOpponentHandleHitAnimation(void); static void LinkOpponentHandleCmd42(void); static void LinkOpponentHandlePlaySE(void); @@ -104,63 +104,63 @@ static void sub_806782C(void); static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { - LinkOpponentHandleGetMonData, - LinkOpponentHandleGetRawMonData, - LinkOpponentHandleSetMonData, - LinkOpponentHandleSetRawMonData, - LinkOpponentHandleLoadMonSprite, - LinkOpponentHandleSwitchInAnim, - LinkOpponentHandleReturnMonToBall, - LinkOpponentHandleDrawTrainerPic, - LinkOpponentHandleTrainerSlide, - LinkOpponentHandleTrainerSlideBack, - LinkOpponentHandleFaintAnimation, - LinkOpponentHandlePaletteFade, - LinkOpponentHandleSuccessBallThrowAnim, - LinkOpponentHandleBallThrowAnim, - LinkOpponentHandlePause, - LinkOpponentHandleMoveAnimation, - LinkOpponentHandlePrintString, - LinkOpponentHandlePrintSelectionString, - LinkOpponentHandleChooseAction, - LinkOpponentHandleUnknownYesNoBox, - LinkOpponentHandleChooseMove, - LinkOpponentHandleChooseItem, - LinkOpponentHandleChoosePokemon, - LinkOpponentHandleCmd23, - LinkOpponentHandleHealthBarUpdate, - LinkOpponentHandleExpUpdate, - LinkOpponentHandleStatusIconUpdate, - LinkOpponentHandleStatusAnimation, - LinkOpponentHandleStatusXor, - LinkOpponentHandleDataTransfer, - LinkOpponentHandleDMA3Transfer, - LinkOpponentHandlePlayBGM, - LinkOpponentHandleCmd32, - LinkOpponentHandleTwoReturnValues, - LinkOpponentHandleChosenMonReturnValue, - LinkOpponentHandleOneReturnValue, - LinkOpponentHandleOneReturnValue_Duplicate, - LinkOpponentHandleCmd37, - LinkOpponentHandleCmd38, - LinkOpponentHandleCmd39, - LinkOpponentHandleCmd40, - LinkOpponentHandleHitAnimation, - LinkOpponentHandleCmd42, - LinkOpponentHandlePlaySE, - LinkOpponentHandlePlayFanfareOrBGM, - LinkOpponentHandleFaintingCry, - LinkOpponentHandleIntroSlide, - LinkOpponentHandleIntroTrainerBallThrow, - LinkOpponentHandleDrawPartyStatusSummary, - LinkOpponentHandleHidePartyStatusSummary, - LinkOpponentHandleEndBounceEffect, - LinkOpponentHandleSpriteInvisibility, - LinkOpponentHandleBattleAnimation, - LinkOpponentHandleLinkStandbyMsg, - LinkOpponentHandleResetActionMoveSelection, - LinkOpponentHandleCmd55, - LinkOpponentCmdEnd + [CONTROLLER_GETMONDATA] = LinkOpponentHandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = LinkOpponentHandleGetRawMonData, + [CONTROLLER_SETMONDATA] = LinkOpponentHandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = LinkOpponentHandleSetRawMonData, + [CONTROLLER_LOADMONSPRITE] = LinkOpponentHandleLoadMonSprite, + [CONTROLLER_SWITCHINANIM] = LinkOpponentHandleSwitchInAnim, + [CONTROLLER_RETURNMONTOBALL] = LinkOpponentHandleReturnMonToBall, + [CONTROLLER_DRAWTRAINERPIC] = LinkOpponentHandleDrawTrainerPic, + [CONTROLLER_TRAINERSLIDE] = LinkOpponentHandleTrainerSlide, + [CONTROLLER_TRAINERSLIDEBACK] = LinkOpponentHandleTrainerSlideBack, + [CONTROLLER_FAINTANIMATION] = LinkOpponentHandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = LinkOpponentHandlePaletteFade, + [CONTROLLER_SUCCESSBALLTHROWANIM] = LinkOpponentHandleSuccessBallThrowAnim, + [CONTROLLER_BALLTHROWANIM] = LinkOpponentHandleBallThrowAnim, + [CONTROLLER_PAUSE] = LinkOpponentHandlePause, + [CONTROLLER_MOVEANIMATION] = LinkOpponentHandleMoveAnimation, + [CONTROLLER_PRINTSTRING] = LinkOpponentHandlePrintString, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkOpponentHandlePrintSelectionString, + [CONTROLLER_CHOOSEACTION] = LinkOpponentHandleChooseAction, + [CONTROLLER_UNKNOWNYESNOBOX] = LinkOpponentHandleUnknownYesNoBox, + [CONTROLLER_CHOOSEMOVE] = LinkOpponentHandleChooseMove, + [CONTROLLER_OPENBAG] = LinkOpponentHandleChooseItem, + [CONTROLLER_CHOOSEPOKEMON] = LinkOpponentHandleChoosePokemon, + [CONTROLLER_23] = LinkOpponentHandleCmd23, + [CONTROLLER_HEALTHBARUPDATE] = LinkOpponentHandleHealthBarUpdate, + [CONTROLLER_EXPUPDATE] = LinkOpponentHandleExpUpdate, + [CONTROLLER_STATUSICONUPDATE] = LinkOpponentHandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = LinkOpponentHandleStatusAnimation, + [CONTROLLER_STATUSXOR] = LinkOpponentHandleStatusXor, + [CONTROLLER_DATATRANSFER] = LinkOpponentHandleDataTransfer, + [CONTROLLER_DMA3TRANSFER] = LinkOpponentHandleDMA3Transfer, + [CONTROLLER_PLAYBGM] = LinkOpponentHandlePlayBGM, + [CONTROLLER_32] = LinkOpponentHandleCmd32, + [CONTROLLER_TWORETURNVALUES] = LinkOpponentHandleTwoReturnValues, + [CONTROLLER_CHOSENMONRETURNVALUE] = LinkOpponentHandleChosenMonReturnValue, + [CONTROLLER_ONERETURNVALUE] = LinkOpponentHandleOneReturnValue, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = LinkOpponentHandleOneReturnValue_Duplicate, + [CONTROLLER_CLEARUNKVAR] = LinkOpponentHandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = LinkOpponentHandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = LinkOpponentHandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation, + [CONTROLLER_42] = LinkOpponentHandleCmd42, + [CONTROLLER_PLAYSE] = LinkOpponentHandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = LinkOpponentHandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = LinkOpponentHandleFaintingCry, + [CONTROLLER_INTROSLIDE] = LinkOpponentHandleIntroSlide, + [CONTROLLER_INTROTRAINERBALLTHROW] = LinkOpponentHandleIntroTrainerBallThrow, + [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkOpponentHandleDrawPartyStatusSummary, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = LinkOpponentHandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = LinkOpponentHandleEndBounceEffect, + [CONTROLLER_SPRITEINVISIBILITY] = LinkOpponentHandleSpriteInvisibility, + [CONTROLLER_BATTLEANIMATION] = LinkOpponentHandleBattleAnimation, + [CONTROLLER_LINKSTANDBYMSG] = LinkOpponentHandleLinkStandbyMsg, + [CONTROLLER_RESETACTIONMOVESELECTION] = LinkOpponentHandleResetActionMoveSelection, + [CONTROLLER_55] = LinkOpponentHandleCmd55, + [CONTROLLER_TERMINATOR_NOP] = LinkOpponentCmdEnd }; static void nullsub_28(void) @@ -1604,27 +1604,27 @@ static void LinkOpponentHandleOneReturnValue_Duplicate(void) LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleCmd37(void) +static void LinkOpponentHandleClearUnkVar(void) { - gUnknown_02022D0C.field_0 = 0; + gUnusedControllerStruct.unk = 0; LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleCmd38(void) +static void LinkOpponentHandleSetUnkVar(void) { - gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBattler][1]; + gUnusedControllerStruct.unk = gBattleBufferA[gActiveBattler][1]; LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleCmd39(void) +static void LinkOpponentHandleClearUnkFlag(void) { - gUnknown_02022D0C.flag_x80 = 0; + gUnusedControllerStruct.flag = 0; LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleCmd40(void) +static void LinkOpponentHandleToggleUnkFlag(void) { - gUnknown_02022D0C.flag_x80 ^= 1; + gUnusedControllerStruct.flag ^= 1; LinkOpponentBufferExecCompleted(); } -- cgit v1.2.3 From b65980cd4ea7e1a8052a0d2c5cb6edd73d35b89c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 17:50:52 -0500 Subject: Remove unused local variables and functions --- src/battle_controller_link_opponent.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/battle_controller_link_opponent.c') diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 269b4c1b4..718fe30c9 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -1693,7 +1693,6 @@ static void LinkOpponentHandleIntroSlide(void) static void LinkOpponentHandleIntroTrainerBallThrow(void) { - u8 paletteNum; u8 taskId; SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); -- cgit v1.2.3 From 4eca05ccf5cce480e8018527798d3632ee43e551 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 02:48:22 -0500 Subject: Document remainder of battle_controllers.c --- src/battle_controller_link_opponent.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/battle_controller_link_opponent.c') diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 718fe30c9..d8a2cf9ee 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -51,7 +51,7 @@ static void LinkOpponentHandleMoveAnimation(void); static void LinkOpponentHandlePrintString(void); static void LinkOpponentHandlePrintSelectionString(void); static void LinkOpponentHandleChooseAction(void); -static void LinkOpponentHandleUnknownYesNoBox(void); +static void LinkOpponentHandleYesNoBox(void); static void LinkOpponentHandleChooseMove(void); static void LinkOpponentHandleChooseItem(void); static void LinkOpponentHandleChoosePokemon(void); @@ -87,7 +87,7 @@ static void LinkOpponentHandleSpriteInvisibility(void); static void LinkOpponentHandleBattleAnimation(void); static void LinkOpponentHandleLinkStandbyMsg(void); static void LinkOpponentHandleResetActionMoveSelection(void); -static void LinkOpponentHandleCmd55(void); +static void LinkOpponentHandleEndLinkBattle(void); static void LinkOpponentCmdEnd(void); static void LinkOpponentBufferRunCommand(void); @@ -123,7 +123,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = LinkOpponentHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkOpponentHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = LinkOpponentHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = LinkOpponentHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = LinkOpponentHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = LinkOpponentHandleChooseMove, [CONTROLLER_OPENBAG] = LinkOpponentHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = LinkOpponentHandleChoosePokemon, @@ -159,7 +159,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = LinkOpponentHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = LinkOpponentHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = LinkOpponentHandleResetActionMoveSelection, - [CONTROLLER_55] = LinkOpponentHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = LinkOpponentHandleEndLinkBattle, [CONTROLLER_TERMINATOR_NOP] = LinkOpponentCmdEnd }; @@ -1482,7 +1482,7 @@ static void LinkOpponentHandleChooseAction(void) LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleUnknownYesNoBox(void) +static void LinkOpponentHandleYesNoBox(void) { LinkOpponentBufferExecCompleted(); } @@ -1836,7 +1836,7 @@ static void LinkOpponentHandleResetActionMoveSelection(void) LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleCmd55(void) +static void LinkOpponentHandleEndLinkBattle(void) { sub_81851A8(&gBattleBufferA[gActiveBattler][4]); -- cgit v1.2.3 From 63a78287725167a9c048b2eac5e92b4da4b339d1 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 20:03:21 -0500 Subject: Document battle_controller_player.c --- src/battle_controller_link_opponent.c | 116 ++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 56 deletions(-) (limited to 'src/battle_controller_link_opponent.c') diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index d8a2cf9ee..ebacf0020 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -100,7 +100,7 @@ static void DoSwitchOutAnimation(void); static void LinkOpponentDoMoveAnimation(void); static void sub_8067618(u8 taskId); static void sub_80676FC(struct Sprite *sprite); -static void sub_806782C(void); +static void EndDrawPartyStatusSummary(void); static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -208,9 +208,9 @@ static void sub_8064470(void) static void sub_80644D8(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; LinkOpponentBufferExecCompleted(); } } @@ -250,8 +250,8 @@ static void sub_8064520(void) gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else { @@ -263,12 +263,12 @@ static void sub_8064520(void) if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) { - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = sub_80644D8; } } @@ -294,27 +294,27 @@ static void sub_8064734(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - sub_8076918(BATTLE_PARTNER(gActiveBattler)); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x40 - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].field_1_x40 + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { @@ -327,35 +327,35 @@ static void sub_8064734(void) } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; r10 = TRUE; } if (r10) { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) { - if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 1) + if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == 1) return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; } if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gUnknown_03005D7C[BATTLE_PARTNER(gActiveBattler)]]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); } - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; gBattlerControllerFuncs[gActiveBattler] = sub_8064520; } @@ -377,8 +377,8 @@ static void sub_8064B04(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); LinkOpponentBufferExecCompleted(); } } @@ -479,13 +479,13 @@ static void sub_8064E50(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); gBattlerControllerFuncs[gActiveBattler] = sub_8064D60; @@ -500,10 +500,10 @@ static void sub_8064F40(void) TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); gBattlerControllerFuncs[gActiveBattler] = sub_8064E50; } @@ -1158,7 +1158,7 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1]; species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); @@ -1168,8 +1168,8 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1180,7 +1180,7 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); } static void LinkOpponentHandleReturnMonToBall(void) @@ -1221,6 +1221,8 @@ static void DoSwitchOutAnimation(void) } } +#define sSpeedX data[0] + static void LinkOpponentHandleDrawTrainerPic(void) { s16 xPos; @@ -1301,10 +1303,10 @@ static void LinkOpponentHandleDrawTrainerPic(void) GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } @@ -1324,15 +1326,17 @@ static void LinkOpponentHandleTrainerSlide(void) gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96; gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle battlerId function LinkOpponentBufferExecCompleted(); } +#undef sSpeedX + static void LinkOpponentHandleTrainerSlideBack(void) { SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); @@ -1386,7 +1390,7 @@ static void LinkOpponentHandlePause(void) static void LinkOpponentHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8); @@ -1429,7 +1433,7 @@ static void LinkOpponentDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1438,7 +1442,7 @@ static void LinkOpponentDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1538,7 +1542,7 @@ static void LinkOpponentHandleExpUpdate(void) static void LinkOpponentHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1551,7 +1555,7 @@ static void LinkOpponentHandleStatusIconUpdate(void) static void LinkOpponentHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); @@ -1710,7 +1714,7 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; gBattlerControllerFuncs[gActiveBattler] = nullsub_28; } @@ -1769,20 +1773,20 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void) } gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; if (gBattleBufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_806782C; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_806782C(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; LinkOpponentBufferExecCompleted(); } } @@ -1811,7 +1815,7 @@ static void LinkOpponentHandleSpriteInvisibility(void) static void LinkOpponentHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleBufferA[gActiveBattler][1]; u16 argument = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8); @@ -1827,7 +1831,7 @@ static void LinkOpponentHandleBattleAnimation(void) static void LinkOpponentHandleLinkStandbyMsg(void) { - sub_81851A8(&gBattleBufferA[gActiveBattler][2]); + RecordedBattle_RecordAllBattlerData(&gBattleBufferA[gActiveBattler][2]); LinkOpponentBufferExecCompleted(); } @@ -1838,7 +1842,7 @@ static void LinkOpponentHandleResetActionMoveSelection(void) static void LinkOpponentHandleEndLinkBattle(void) { - sub_81851A8(&gBattleBufferA[gActiveBattler][4]); + RecordedBattle_RecordAllBattlerData(&gBattleBufferA[gActiveBattler][4]); if (gBattleBufferA[gActiveBattler][1] == B_OUTCOME_DREW) gBattleOutcome = gBattleBufferA[gActiveBattler][1]; @@ -1849,7 +1853,7 @@ static void LinkOpponentHandleEndLinkBattle(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); LinkOpponentBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void LinkOpponentCmdEnd(void) -- cgit v1.2.3 From 4228509e957b7f90bce7f7b470e18a0dfd32c2fc Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 21:47:00 -0500 Subject: Sync link opponent controller doc to opponent --- src/battle_controller_link_opponent.c | 94 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src/battle_controller_link_opponent.c') diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index ebacf0020..dd44bc91b 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); -- cgit v1.2.3 From f4d8a91ba44d7bcf0f9df8db7ca5f7aeb688497f Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 3 Apr 2021 12:38:07 -0400 Subject: Misc battle script cleanup --- src/battle_controller_link_opponent.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/battle_controller_link_opponent.c') diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index dd44bc91b..179ae18e8 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -74,7 +74,7 @@ static void LinkOpponentHandleSetUnkVar(void); static void LinkOpponentHandleClearUnkFlag(void); static void LinkOpponentHandleToggleUnkFlag(void); static void LinkOpponentHandleHitAnimation(void); -static void LinkOpponentHandleCmd42(void); +static void LinkOpponentHandleCantSwitch(void); static void LinkOpponentHandlePlaySE(void); static void LinkOpponentHandlePlayFanfareOrBGM(void); static void LinkOpponentHandleFaintingCry(void); @@ -146,7 +146,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_CLEARUNKFLAG] = LinkOpponentHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation, - [CONTROLLER_42] = LinkOpponentHandleCmd42, + [CONTROLLER_CANTSWITCH] = LinkOpponentHandleCantSwitch, [CONTROLLER_PLAYSE] = LinkOpponentHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = LinkOpponentHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = LinkOpponentHandleFaintingCry, @@ -1647,7 +1647,7 @@ static void LinkOpponentHandleHitAnimation(void) } } -static void LinkOpponentHandleCmd42(void) +static void LinkOpponentHandleCantSwitch(void) { LinkOpponentBufferExecCompleted(); } -- cgit v1.2.3 From 62abcecc54ac810dc082e5e822be4796a5064ece Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 15 Apr 2021 02:04:01 -0400 Subject: More usage of DISPLAY constants --- src/battle_controller_link_opponent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/battle_controller_link_opponent.c') diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 179ae18e8..0f612f964 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -1134,7 +1134,7 @@ static void LinkOpponentHandleLoadMonSprite(void) GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); @@ -1302,7 +1302,7 @@ static void LinkOpponentHandleDrawTrainerPic(void) (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; -- cgit v1.2.3