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_recorded_player.c | 138 ++++++++++++++++---------------- 1 file changed, 69 insertions(+), 69 deletions(-) (limited to 'src/battle_controller_recorded_player.c') diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 72af27d5e..3d4faf0cd 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -65,10 +65,10 @@ static void RecordedPlayerHandleTwoReturnValues(void); static void RecordedPlayerHandleChosenMonReturnValue(void); static void RecordedPlayerHandleOneReturnValue(void); static void RecordedPlayerHandleOneReturnValue_Duplicate(void); -static void RecordedPlayerHandleCmd37(void); -static void RecordedPlayerHandleCmd38(void); -static void RecordedPlayerHandleCmd39(void); -static void RecordedPlayerHandleCmd40(void); +static void RecordedPlayerHandleClearUnkVar(void); +static void RecordedPlayerHandleSetUnkVar(void); +static void RecordedPlayerHandleClearUnkFlag(void); +static void RecordedPlayerHandleToggleUnkFlag(void); static void RecordedPlayerHandleHitAnimation(void); static void RecordedPlayerHandleCmd42(void); static void RecordedPlayerHandlePlaySE(void); @@ -99,63 +99,63 @@ static void sub_818CDF4(void); static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { - RecordedPlayerHandleGetMonData, - RecordedPlayerHandleGetRawMonData, - RecordedPlayerHandleSetMonData, - RecordedPlayerHandleSetRawMonData, - RecordedPlayerHandleLoadMonSprite, - RecordedPlayerHandleSwitchInAnim, - RecordedPlayerHandleReturnMonToBall, - RecordedPlayerHandleDrawTrainerPic, - RecordedPlayerHandleTrainerSlide, - RecordedPlayerHandleTrainerSlideBack, - RecordedPlayerHandleFaintAnimation, - RecordedPlayerHandlePaletteFade, - RecordedPlayerHandleSuccessBallThrowAnim, - RecordedPlayerHandleBallThrowAnim, - RecordedPlayerHandlePause, - RecordedPlayerHandleMoveAnimation, - RecordedPlayerHandlePrintString, - RecordedPlayerHandlePrintSelectionString, - RecordedPlayerHandleChooseAction, - RecordedPlayerHandleUnknownYesNoBox, - RecordedPlayerHandleChooseMove, - RecordedPlayerHandleChooseItem, - RecordedPlayerHandleChoosePokemon, - RecordedPlayerHandleCmd23, - RecordedPlayerHandleHealthBarUpdate, - RecordedPlayerHandleExpUpdate, - RecordedPlayerHandleStatusIconUpdate, - RecordedPlayerHandleStatusAnimation, - RecordedPlayerHandleStatusXor, - RecordedPlayerHandleDataTransfer, - RecordedPlayerHandleDMA3Transfer, - RecordedPlayerHandlePlayBGM, - RecordedPlayerHandleCmd32, - RecordedPlayerHandleTwoReturnValues, - RecordedPlayerHandleChosenMonReturnValue, - RecordedPlayerHandleOneReturnValue, - RecordedPlayerHandleOneReturnValue_Duplicate, - RecordedPlayerHandleCmd37, - RecordedPlayerHandleCmd38, - RecordedPlayerHandleCmd39, - RecordedPlayerHandleCmd40, - RecordedPlayerHandleHitAnimation, - RecordedPlayerHandleCmd42, - RecordedPlayerHandlePlaySE, - RecordedPlayerHandlePlayFanfareOrBGM, - RecordedPlayerHandleFaintingCry, - RecordedPlayerHandleIntroSlide, - RecordedPlayerHandleIntroTrainerBallThrow, - RecordedPlayerHandleDrawPartyStatusSummary, - RecordedPlayerHandleHidePartyStatusSummary, - RecordedPlayerHandleEndBounceEffect, - RecordedPlayerHandleSpriteInvisibility, - RecordedPlayerHandleBattleAnimation, - RecordedPlayerHandleLinkStandbyMsg, - RecordedPlayerHandleResetActionMoveSelection, - RecordedPlayerHandleCmd55, - RecordedPlayerCmdEnd + [CONTROLLER_GETMONDATA] = RecordedPlayerHandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = RecordedPlayerHandleGetRawMonData, + [CONTROLLER_SETMONDATA] = RecordedPlayerHandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = RecordedPlayerHandleSetRawMonData, + [CONTROLLER_LOADMONSPRITE] = RecordedPlayerHandleLoadMonSprite, + [CONTROLLER_SWITCHINANIM] = RecordedPlayerHandleSwitchInAnim, + [CONTROLLER_RETURNMONTOBALL] = RecordedPlayerHandleReturnMonToBall, + [CONTROLLER_DRAWTRAINERPIC] = RecordedPlayerHandleDrawTrainerPic, + [CONTROLLER_TRAINERSLIDE] = RecordedPlayerHandleTrainerSlide, + [CONTROLLER_TRAINERSLIDEBACK] = RecordedPlayerHandleTrainerSlideBack, + [CONTROLLER_FAINTANIMATION] = RecordedPlayerHandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = RecordedPlayerHandlePaletteFade, + [CONTROLLER_SUCCESSBALLTHROWANIM] = RecordedPlayerHandleSuccessBallThrowAnim, + [CONTROLLER_BALLTHROWANIM] = RecordedPlayerHandleBallThrowAnim, + [CONTROLLER_PAUSE] = RecordedPlayerHandlePause, + [CONTROLLER_MOVEANIMATION] = RecordedPlayerHandleMoveAnimation, + [CONTROLLER_PRINTSTRING] = RecordedPlayerHandlePrintString, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedPlayerHandlePrintSelectionString, + [CONTROLLER_CHOOSEACTION] = RecordedPlayerHandleChooseAction, + [CONTROLLER_UNKNOWNYESNOBOX] = RecordedPlayerHandleUnknownYesNoBox, + [CONTROLLER_CHOOSEMOVE] = RecordedPlayerHandleChooseMove, + [CONTROLLER_OPENBAG] = RecordedPlayerHandleChooseItem, + [CONTROLLER_CHOOSEPOKEMON] = RecordedPlayerHandleChoosePokemon, + [CONTROLLER_23] = RecordedPlayerHandleCmd23, + [CONTROLLER_HEALTHBARUPDATE] = RecordedPlayerHandleHealthBarUpdate, + [CONTROLLER_EXPUPDATE] = RecordedPlayerHandleExpUpdate, + [CONTROLLER_STATUSICONUPDATE] = RecordedPlayerHandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = RecordedPlayerHandleStatusAnimation, + [CONTROLLER_STATUSXOR] = RecordedPlayerHandleStatusXor, + [CONTROLLER_DATATRANSFER] = RecordedPlayerHandleDataTransfer, + [CONTROLLER_DMA3TRANSFER] = RecordedPlayerHandleDMA3Transfer, + [CONTROLLER_PLAYBGM] = RecordedPlayerHandlePlayBGM, + [CONTROLLER_32] = RecordedPlayerHandleCmd32, + [CONTROLLER_TWORETURNVALUES] = RecordedPlayerHandleTwoReturnValues, + [CONTROLLER_CHOSENMONRETURNVALUE] = RecordedPlayerHandleChosenMonReturnValue, + [CONTROLLER_ONERETURNVALUE] = RecordedPlayerHandleOneReturnValue, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = RecordedPlayerHandleOneReturnValue_Duplicate, + [CONTROLLER_CLEARUNKVAR] = RecordedPlayerHandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = RecordedPlayerHandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = RecordedPlayerHandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation, + [CONTROLLER_42] = RecordedPlayerHandleCmd42, + [CONTROLLER_PLAYSE] = RecordedPlayerHandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = RecordedPlayerHandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = RecordedPlayerHandleFaintingCry, + [CONTROLLER_INTROSLIDE] = RecordedPlayerHandleIntroSlide, + [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedPlayerHandleIntroTrainerBallThrow, + [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedPlayerHandleDrawPartyStatusSummary, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedPlayerHandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = RecordedPlayerHandleEndBounceEffect, + [CONTROLLER_SPRITEINVISIBILITY] = RecordedPlayerHandleSpriteInvisibility, + [CONTROLLER_BATTLEANIMATION] = RecordedPlayerHandleBattleAnimation, + [CONTROLLER_LINKSTANDBYMSG] = RecordedPlayerHandleLinkStandbyMsg, + [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedPlayerHandleResetActionMoveSelection, + [CONTROLLER_55] = RecordedPlayerHandleCmd55, + [CONTROLLER_TERMINATOR_NOP] = RecordedPlayerCmdEnd }; static void nullsub_120(void) @@ -1561,27 +1561,27 @@ static void RecordedPlayerHandleOneReturnValue_Duplicate(void) RecordedPlayerBufferExecCompleted(); } -static void RecordedPlayerHandleCmd37(void) +static void RecordedPlayerHandleClearUnkVar(void) { - gUnknown_02022D0C.field_0 = 0; + gUnusedControllerStruct.unk = 0; RecordedPlayerBufferExecCompleted(); } -static void RecordedPlayerHandleCmd38(void) +static void RecordedPlayerHandleSetUnkVar(void) { - gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBattler][1]; + gUnusedControllerStruct.unk = gBattleBufferA[gActiveBattler][1]; RecordedPlayerBufferExecCompleted(); } -static void RecordedPlayerHandleCmd39(void) +static void RecordedPlayerHandleClearUnkFlag(void) { - gUnknown_02022D0C.flag_x80 = 0; + gUnusedControllerStruct.flag = 0; RecordedPlayerBufferExecCompleted(); } -static void RecordedPlayerHandleCmd40(void) +static void RecordedPlayerHandleToggleUnkFlag(void) { - gUnknown_02022D0C.flag_x80 ^= 1; + gUnusedControllerStruct.flag ^= 1; RecordedPlayerBufferExecCompleted(); } -- cgit v1.2.3 From b9e1b050e10c8d7d62eb49fb1a4ab1a30a1bdaa8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 13 Jan 2021 15:17:32 -0500 Subject: Label remaining battle types --- src/battle_controller_recorded_player.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/battle_controller_recorded_player.c') diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 3d4faf0cd..86e4f8809 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1187,12 +1187,12 @@ static void RecordedPlayerHandleDrawTrainerPic(void) s16 xPos, yPos; u32 trainerPicId; - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) trainerPicId = GetActiveBattlerLinkPlayerGender(); else - trainerPicId = gLinkPlayers[gUnknown_0203C7B4].gender; + trainerPicId = gLinkPlayers[gRecordedBattleMultiplayerId].gender; } else { @@ -1666,7 +1666,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); - if (gBattleTypeFlags & BATTLE_TYPE_x2000000) + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; else trainerPicId = gSaveBlock2Ptr->playerGender; -- 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_recorded_player.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/battle_controller_recorded_player.c') diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 86e4f8809..ebc1450bd 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -47,7 +47,7 @@ static void RecordedPlayerHandleMoveAnimation(void); static void RecordedPlayerHandlePrintString(void); static void RecordedPlayerHandlePrintSelectionString(void); static void RecordedPlayerHandleChooseAction(void); -static void RecordedPlayerHandleUnknownYesNoBox(void); +static void RecordedPlayerHandleYesNoBox(void); static void RecordedPlayerHandleChooseMove(void); static void RecordedPlayerHandleChooseItem(void); static void RecordedPlayerHandleChoosePokemon(void); @@ -83,7 +83,7 @@ static void RecordedPlayerHandleSpriteInvisibility(void); static void RecordedPlayerHandleBattleAnimation(void); static void RecordedPlayerHandleLinkStandbyMsg(void); static void RecordedPlayerHandleResetActionMoveSelection(void); -static void RecordedPlayerHandleCmd55(void); +static void RecordedPlayerHandleEndLinkBattle(void); static void RecordedPlayerCmdEnd(void); static void RecordedPlayerBufferRunCommand(void); @@ -118,7 +118,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_PRINTSTRING] = RecordedPlayerHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedPlayerHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = RecordedPlayerHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = RecordedPlayerHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = RecordedPlayerHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = RecordedPlayerHandleChooseMove, [CONTROLLER_OPENBAG] = RecordedPlayerHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = RecordedPlayerHandleChoosePokemon, @@ -154,7 +154,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_BATTLEANIMATION] = RecordedPlayerHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = RecordedPlayerHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedPlayerHandleResetActionMoveSelection, - [CONTROLLER_55] = RecordedPlayerHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = RecordedPlayerHandleEndLinkBattle, [CONTROLLER_TERMINATOR_NOP] = RecordedPlayerCmdEnd }; @@ -1425,7 +1425,7 @@ static void RecordedPlayerHandleChooseAction(void) } } -static void RecordedPlayerHandleUnknownYesNoBox(void) +static void RecordedPlayerHandleYesNoBox(void) { RecordedPlayerBufferExecCompleted(); } @@ -1791,7 +1791,7 @@ static void RecordedPlayerHandleResetActionMoveSelection(void) RecordedPlayerBufferExecCompleted(); } -static void RecordedPlayerHandleCmd55(void) +static void RecordedPlayerHandleEndLinkBattle(void) { gBattleOutcome = gBattleBufferA[gActiveBattler][1]; FadeOutMapMusic(5); -- 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_recorded_player.c | 130 +++++++++++++++++--------------- 1 file changed, 70 insertions(+), 60 deletions(-) (limited to 'src/battle_controller_recorded_player.c') diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index ebc1450bd..dfc46a08b 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -95,7 +95,7 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void RecordedPlayerDoMoveAnimation(void); static void sub_818CC24(u8 taskId); -static void sub_818CDF4(void); +static void EndDrawPartyStatusSummary(void); static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -188,7 +188,7 @@ static void sub_81899F0(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - nullsub_25(0); + BattleGfxSfxDummy3(MALE); FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); RecordedPlayerBufferExecCompleted(); @@ -197,9 +197,9 @@ static void sub_81899F0(void) static void sub_8189A58(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; RecordedPlayerBufferExecCompleted(); } } @@ -233,14 +233,14 @@ static void sub_8189AA0(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; } } @@ -265,7 +265,7 @@ static void sub_8189AA0(void) if (r6) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; } } @@ -289,27 +289,27 @@ static void sub_8189D40(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[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_x80 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x40 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x40 + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { @@ -322,20 +322,20 @@ static void sub_8189D40(void) } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; r10 = TRUE; } - if (r10 && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (r10 && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; gBattlerControllerFuncs[gActiveBattler] = sub_8189AA0; } } @@ -363,13 +363,13 @@ static void CompleteOnHealthbarDone(void) } } -static void sub_818A114(void) +static void FreeMonSpriteAfterFaintAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - nullsub_24(species); + BattleGfxSfxDummy2(species); FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); @@ -441,14 +441,14 @@ static void sub_818A37C(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); - CreateTask(c3_0802FDF4, 10); + CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); gBattlerControllerFuncs[gActiveBattler] = sub_818A2B4; @@ -463,10 +463,10 @@ static void sub_818A470(void) TryShinyAnimation(gActiveBattler, &gPlayerParty[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]]); gBattlerControllerFuncs[gActiveBattler] = sub_818A37C; } } @@ -1121,7 +1121,7 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit) ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1]; species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite( @@ -1130,8 +1130,8 @@ static void sub_818BA6C(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; @@ -1142,7 +1142,7 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } static void RecordedPlayerHandleReturnMonToBall(void) @@ -1182,6 +1182,8 @@ static void DoSwitchOutAnimation(void) } } +#define sSpeedX data[0] + static void RecordedPlayerHandleDrawTrainerPic(void) { s16 xPos, yPos; @@ -1231,10 +1233,10 @@ static void RecordedPlayerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y = 48; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF; gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; } @@ -1245,14 +1247,16 @@ static void RecordedPlayerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; } gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } +#undef sSpeedX + static void RecordedPlayerHandleTrainerSlide(void) { RecordedPlayerBufferExecCompleted(); @@ -1269,6 +1273,9 @@ static void RecordedPlayerHandleTrainerSlideBack(void) gBattlerControllerFuncs[gActiveBattler] = sub_81899F0; } +#define sSpeedX data[1] +#define sSpeedY data[2] + static void RecordedPlayerHandleFaintAnimation(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) @@ -1284,14 +1291,17 @@ static void RecordedPlayerHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_FAINT, -64); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerControllerFuncs[gActiveBattler] = sub_818A114; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; } } } +#undef sSpeedX +#undef sSpeedY + static void RecordedPlayerHandlePaletteFade(void) { RecordedPlayerBufferExecCompleted(); @@ -1314,7 +1324,7 @@ static void RecordedPlayerHandlePause(void) static void RecordedPlayerHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8); @@ -1356,7 +1366,7 @@ static void RecordedPlayerDoMoveAnimation(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; } @@ -1365,7 +1375,7 @@ static void RecordedPlayerDoMoveAnimation(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); @@ -1495,7 +1505,7 @@ static void RecordedPlayerHandleExpUpdate(void) static void RecordedPlayerHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1508,7 +1518,7 @@ static void RecordedPlayerHandleStatusIconUpdate(void) static void RecordedPlayerHandleStatusAnimation(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)); @@ -1662,7 +1672,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); @@ -1681,7 +1691,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(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_120; } @@ -1727,20 +1737,20 @@ static void RecordedPlayerHandleDrawPartyStatusSummary(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; 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_818CDF4; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_818CDF4(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; RecordedPlayerBufferExecCompleted(); } } @@ -1769,7 +1779,7 @@ static void RecordedPlayerHandleSpriteInvisibility(void) static void RecordedPlayerHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleBufferA[gActiveBattler][1]; u16 argument = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8); @@ -1797,7 +1807,7 @@ static void RecordedPlayerHandleEndLinkBattle(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); RecordedPlayerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void RecordedPlayerCmdEnd(void) -- cgit v1.2.3 From 1042426cc6ee022ef0366263be9c8f7bc7fbf029 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 20:47:59 -0500 Subject: Sync recorded player controller doc to player --- src/battle_controller_recorded_player.c | 88 ++++++++++++++++----------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'src/battle_controller_recorded_player.c') diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index dfc46a08b..63a04ac40 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -88,13 +88,13 @@ static void RecordedPlayerCmdEnd(void); static void RecordedPlayerBufferRunCommand(void); static void RecordedPlayerBufferExecCompleted(void); -static void sub_818A328(void); +static void SwitchIn_WaitAndEnd(void); static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst); static void SetRecordedPlayerMonData(u8 monId); -static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void RecordedPlayerDoMoveAnimation(void); -static void sub_818CC24(u8 taskId); +static void Task_StartSendOutAnim(u8 taskId); static void EndDrawPartyStatusSummary(void); static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = @@ -158,7 +158,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_TERMINATOR_NOP] = RecordedPlayerCmdEnd }; -static void nullsub_120(void) +static void RecordedPlayerDummy(void) { } @@ -184,7 +184,7 @@ static void CompleteOnBattlerSpriteCallbackDummy(void) RecordedPlayerBufferExecCompleted(); } -static void sub_81899F0(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -195,7 +195,7 @@ static void sub_81899F0(void) } } -static void sub_8189A58(void) +static void Intro_DelayAndEnd(void) { if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { @@ -204,27 +204,27 @@ static void sub_8189A58(void) } } -static void sub_8189AA0(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool32 r6 = FALSE; + bool32 healthboxAnimDone = FALSE; if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) { if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r6 = TRUE; + healthboxAnimDone = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r6 = TRUE; + healthboxAnimDone = TRUE; } } - if (r6 && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim + if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; @@ -241,7 +241,7 @@ static void sub_8189AA0(void) HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } else @@ -249,31 +249,31 @@ static void sub_8189AA0(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r6 = TRUE; + healthboxAnimDone = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r6 = TRUE; + healthboxAnimDone = TRUE; } } if (IsCryPlayingOrClearCrySongs()) - r6 = FALSE; + healthboxAnimDone = FALSE; - if (r6) + if (healthboxAnimDone) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } } -static void sub_8189D40(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 r10 = FALSE; + bool32 bgmRestored = FALSE; if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) { @@ -323,10 +323,10 @@ static void sub_8189D40(void) } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; - r10 = TRUE; + bgmRestored = TRUE; } - if (r10 && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy + if (bgmRestored && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) @@ -336,11 +336,11 @@ static void sub_8189D40(void) gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_8189AA0; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void sub_818A064(void) +static void WaitForMonAnimAfterLoad(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) RecordedPlayerBufferExecCompleted(); @@ -377,7 +377,7 @@ static void FreeMonSpriteAfterFaintAnim(void) } } -static void sub_818A1B0(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -413,7 +413,7 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_818A2B4(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -421,11 +421,11 @@ static void sub_818A2B4(void) if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_818A328; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd; } } -static void sub_818A328(void) +static void SwitchIn_WaitAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -434,7 +434,7 @@ static void sub_818A328(void) } } -static void sub_818A37C(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) { @@ -451,11 +451,11 @@ static void sub_818A37C(void) StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A2B4; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_818A470(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) @@ -467,7 +467,7 @@ static void sub_818A470(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A37C; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1102,7 +1102,7 @@ static void RecordedPlayerHandleLoadMonSprite(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A064; + gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad; } static void RecordedPlayerHandleSwitchInAnim(void) @@ -1110,11 +1110,11 @@ static void RecordedPlayerHandleSwitchInAnim(void) ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleBufferA[gActiveBattler][2]); gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_818BA6C(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A470; + StartSendOutAnim(gActiveBattler, gBattleBufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; @@ -1176,7 +1176,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_818A1B0; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } @@ -1270,7 +1270,7 @@ static void RecordedPlayerHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_81899F0; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } #define sSpeedX data[1] @@ -1685,17 +1685,17 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - taskId = CreateTask(sub_818CC24, 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_120; + gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerDummy; } -static void sub_818CC24(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { if (gTasks[taskId].data[1] < 24) { @@ -1709,19 +1709,19 @@ static void sub_818CC24(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_818BA6C(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_818BA6C(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_818BA6C(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_8189D40; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } -- 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_recorded_player.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/battle_controller_recorded_player.c') diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 63a04ac40..aa4154a3f 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -70,7 +70,7 @@ static void RecordedPlayerHandleSetUnkVar(void); static void RecordedPlayerHandleClearUnkFlag(void); static void RecordedPlayerHandleToggleUnkFlag(void); static void RecordedPlayerHandleHitAnimation(void); -static void RecordedPlayerHandleCmd42(void); +static void RecordedPlayerHandleCantSwitch(void); static void RecordedPlayerHandlePlaySE(void); static void RecordedPlayerHandlePlayFanfareOrBGM(void); static void RecordedPlayerHandleFaintingCry(void); @@ -141,7 +141,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_CLEARUNKFLAG] = RecordedPlayerHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation, - [CONTROLLER_42] = RecordedPlayerHandleCmd42, + [CONTROLLER_CANTSWITCH] = RecordedPlayerHandleCantSwitch, [CONTROLLER_PLAYSE] = RecordedPlayerHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = RecordedPlayerHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = RecordedPlayerHandleFaintingCry, @@ -1610,7 +1610,7 @@ static void RecordedPlayerHandleHitAnimation(void) } } -static void RecordedPlayerHandleCmd42(void) +static void RecordedPlayerHandleCantSwitch(void) { RecordedPlayerBufferExecCompleted(); } -- 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_recorded_player.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_controller_recorded_player.c') diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index aa4154a3f..73c23afc5 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1098,7 +1098,7 @@ static void RecordedPlayerHandleLoadMonSprite(void) GetBattlerSpriteCoord(gActiveBattler, 2), 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]); -- cgit v1.2.3