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_opponent.c | 138 +++++++++++++++--------------- 1 file changed, 69 insertions(+), 69 deletions(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index ca7cd4adc..63e1ff7a0 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -69,10 +69,10 @@ static void RecordedOpponentHandleTwoReturnValues(void); static void RecordedOpponentHandleChosenMonReturnValue(void); static void RecordedOpponentHandleOneReturnValue(void); static void RecordedOpponentHandleOneReturnValue_Duplicate(void); -static void RecordedOpponentHandleCmd37(void); -static void RecordedOpponentHandleCmd38(void); -static void RecordedOpponentHandleCmd39(void); -static void RecordedOpponentHandleCmd40(void); +static void RecordedOpponentHandleClearUnkVar(void); +static void RecordedOpponentHandleSetUnkVar(void); +static void RecordedOpponentHandleClearUnkFlag(void); +static void RecordedOpponentHandleToggleUnkFlag(void); static void RecordedOpponentHandleHitAnimation(void); static void RecordedOpponentHandleCmd42(void); static void RecordedOpponentHandlePlaySE(void); @@ -104,63 +104,63 @@ static void sub_818975C(void); static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { - RecordedOpponentHandleGetMonData, - RecordedOpponentHandleGetRawMonData, - RecordedOpponentHandleSetMonData, - RecordedOpponentHandleSetRawMonData, - RecordedOpponentHandleLoadMonSprite, - RecordedOpponentHandleSwitchInAnim, - RecordedOpponentHandleReturnMonToBall, - RecordedOpponentHandleDrawTrainerPic, - RecordedOpponentHandleTrainerSlide, - RecordedOpponentHandleTrainerSlideBack, - RecordedOpponentHandleFaintAnimation, - RecordedOpponentHandlePaletteFade, - RecordedOpponentHandleSuccessBallThrowAnim, - RecordedOpponentHandleBallThrowAnim, - RecordedOpponentHandlePause, - RecordedOpponentHandleMoveAnimation, - RecordedOpponentHandlePrintString, - RecordedOpponentHandlePrintSelectionString, - RecordedOpponentHandleChooseAction, - RecordedOpponentHandleUnknownYesNoBox, - RecordedOpponentHandleChooseMove, - RecordedOpponentHandleChooseItem, - RecordedOpponentHandleChoosePokemon, - RecordedOpponentHandleCmd23, - RecordedOpponentHandleHealthBarUpdate, - RecordedOpponentHandleExpUpdate, - RecordedOpponentHandleStatusIconUpdate, - RecordedOpponentHandleStatusAnimation, - RecordedOpponentHandleStatusXor, - RecordedOpponentHandleDataTransfer, - RecordedOpponentHandleDMA3Transfer, - RecordedOpponentHandlePlayBGM, - RecordedOpponentHandleCmd32, - RecordedOpponentHandleTwoReturnValues, - RecordedOpponentHandleChosenMonReturnValue, - RecordedOpponentHandleOneReturnValue, - RecordedOpponentHandleOneReturnValue_Duplicate, - RecordedOpponentHandleCmd37, - RecordedOpponentHandleCmd38, - RecordedOpponentHandleCmd39, - RecordedOpponentHandleCmd40, - RecordedOpponentHandleHitAnimation, - RecordedOpponentHandleCmd42, - RecordedOpponentHandlePlaySE, - RecordedOpponentHandlePlayFanfareOrBGM, - RecordedOpponentHandleFaintingCry, - RecordedOpponentHandleIntroSlide, - RecordedOpponentHandleIntroTrainerBallThrow, - RecordedOpponentHandleDrawPartyStatusSummary, - RecordedOpponentHandleHidePartyStatusSummary, - RecordedOpponentHandleEndBounceEffect, - RecordedOpponentHandleSpriteInvisibility, - RecordedOpponentHandleBattleAnimation, - RecordedOpponentHandleLinkStandbyMsg, - RecordedOpponentHandleResetActionMoveSelection, - RecordedOpponentHandleCmd55, - RecordedOpponentCmdEnd + [CONTROLLER_GETMONDATA] = RecordedOpponentHandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = RecordedOpponentHandleGetRawMonData, + [CONTROLLER_SETMONDATA] = RecordedOpponentHandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = RecordedOpponentHandleSetRawMonData, + [CONTROLLER_LOADMONSPRITE] = RecordedOpponentHandleLoadMonSprite, + [CONTROLLER_SWITCHINANIM] = RecordedOpponentHandleSwitchInAnim, + [CONTROLLER_RETURNMONTOBALL] = RecordedOpponentHandleReturnMonToBall, + [CONTROLLER_DRAWTRAINERPIC] = RecordedOpponentHandleDrawTrainerPic, + [CONTROLLER_TRAINERSLIDE] = RecordedOpponentHandleTrainerSlide, + [CONTROLLER_TRAINERSLIDEBACK] = RecordedOpponentHandleTrainerSlideBack, + [CONTROLLER_FAINTANIMATION] = RecordedOpponentHandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = RecordedOpponentHandlePaletteFade, + [CONTROLLER_SUCCESSBALLTHROWANIM] = RecordedOpponentHandleSuccessBallThrowAnim, + [CONTROLLER_BALLTHROWANIM] = RecordedOpponentHandleBallThrowAnim, + [CONTROLLER_PAUSE] = RecordedOpponentHandlePause, + [CONTROLLER_MOVEANIMATION] = RecordedOpponentHandleMoveAnimation, + [CONTROLLER_PRINTSTRING] = RecordedOpponentHandlePrintString, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedOpponentHandlePrintSelectionString, + [CONTROLLER_CHOOSEACTION] = RecordedOpponentHandleChooseAction, + [CONTROLLER_UNKNOWNYESNOBOX] = RecordedOpponentHandleUnknownYesNoBox, + [CONTROLLER_CHOOSEMOVE] = RecordedOpponentHandleChooseMove, + [CONTROLLER_OPENBAG] = RecordedOpponentHandleChooseItem, + [CONTROLLER_CHOOSEPOKEMON] = RecordedOpponentHandleChoosePokemon, + [CONTROLLER_23] = RecordedOpponentHandleCmd23, + [CONTROLLER_HEALTHBARUPDATE] = RecordedOpponentHandleHealthBarUpdate, + [CONTROLLER_EXPUPDATE] = RecordedOpponentHandleExpUpdate, + [CONTROLLER_STATUSICONUPDATE] = RecordedOpponentHandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = RecordedOpponentHandleStatusAnimation, + [CONTROLLER_STATUSXOR] = RecordedOpponentHandleStatusXor, + [CONTROLLER_DATATRANSFER] = RecordedOpponentHandleDataTransfer, + [CONTROLLER_DMA3TRANSFER] = RecordedOpponentHandleDMA3Transfer, + [CONTROLLER_PLAYBGM] = RecordedOpponentHandlePlayBGM, + [CONTROLLER_32] = RecordedOpponentHandleCmd32, + [CONTROLLER_TWORETURNVALUES] = RecordedOpponentHandleTwoReturnValues, + [CONTROLLER_CHOSENMONRETURNVALUE] = RecordedOpponentHandleChosenMonReturnValue, + [CONTROLLER_ONERETURNVALUE] = RecordedOpponentHandleOneReturnValue, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = RecordedOpponentHandleOneReturnValue_Duplicate, + [CONTROLLER_CLEARUNKVAR] = RecordedOpponentHandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = RecordedOpponentHandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = RecordedOpponentHandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation, + [CONTROLLER_42] = RecordedOpponentHandleCmd42, + [CONTROLLER_PLAYSE] = RecordedOpponentHandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = RecordedOpponentHandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = RecordedOpponentHandleFaintingCry, + [CONTROLLER_INTROSLIDE] = RecordedOpponentHandleIntroSlide, + [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedOpponentHandleIntroTrainerBallThrow, + [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedOpponentHandleDrawPartyStatusSummary, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedOpponentHandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = RecordedOpponentHandleEndBounceEffect, + [CONTROLLER_SPRITEINVISIBILITY] = RecordedOpponentHandleSpriteInvisibility, + [CONTROLLER_BATTLEANIMATION] = RecordedOpponentHandleBattleAnimation, + [CONTROLLER_LINKSTANDBYMSG] = RecordedOpponentHandleLinkStandbyMsg, + [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedOpponentHandleResetActionMoveSelection, + [CONTROLLER_55] = RecordedOpponentHandleCmd55, + [CONTROLLER_TERMINATOR_NOP] = RecordedOpponentCmdEnd }; static void nullsub_70(void) @@ -1544,27 +1544,27 @@ static void RecordedOpponentHandleOneReturnValue_Duplicate(void) RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleCmd37(void) +static void RecordedOpponentHandleClearUnkVar(void) { - gUnknown_02022D0C.field_0 = 0; + gUnusedControllerStruct.unk = 0; RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleCmd38(void) +static void RecordedOpponentHandleSetUnkVar(void) { - gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBattler][1]; + gUnusedControllerStruct.unk = gBattleBufferA[gActiveBattler][1]; RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleCmd39(void) +static void RecordedOpponentHandleClearUnkFlag(void) { - gUnknown_02022D0C.flag_x80 = 0; + gUnusedControllerStruct.flag = 0; RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleCmd40(void) +static void RecordedOpponentHandleToggleUnkFlag(void) { - gUnknown_02022D0C.flag_x80 ^= 1; + gUnusedControllerStruct.flag ^= 1; RecordedOpponentBufferExecCompleted(); } -- 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_opponent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 63e1ff7a0..895ca6b39 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1236,7 +1236,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void) } else { - trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[gUnknown_0203C7B4 ^ BIT_SIDE].gender); + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[gRecordedBattleMultiplayerId ^ BIT_SIDE].gender); } } -- 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_recorded_opponent.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 895ca6b39..23269dbad 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1633,7 +1633,6 @@ static void RecordedOpponentHandleIntroSlide(void) static void RecordedOpponentHandleIntroTrainerBallThrow(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_recorded_opponent.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 23269dbad..dca000aec 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -51,7 +51,7 @@ static void RecordedOpponentHandleMoveAnimation(void); static void RecordedOpponentHandlePrintString(void); static void RecordedOpponentHandlePrintSelectionString(void); static void RecordedOpponentHandleChooseAction(void); -static void RecordedOpponentHandleUnknownYesNoBox(void); +static void RecordedOpponentHandleYesNoBox(void); static void RecordedOpponentHandleChooseMove(void); static void RecordedOpponentHandleChooseItem(void); static void RecordedOpponentHandleChoosePokemon(void); @@ -87,7 +87,7 @@ static void RecordedOpponentHandleSpriteInvisibility(void); static void RecordedOpponentHandleBattleAnimation(void); static void RecordedOpponentHandleLinkStandbyMsg(void); static void RecordedOpponentHandleResetActionMoveSelection(void); -static void RecordedOpponentHandleCmd55(void); +static void RecordedOpponentHandleEndLinkBattle(void); static void RecordedOpponentCmdEnd(void); static void RecordedOpponentBufferRunCommand(void); @@ -123,7 +123,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_PRINTSTRING] = RecordedOpponentHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedOpponentHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = RecordedOpponentHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = RecordedOpponentHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = RecordedOpponentHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = RecordedOpponentHandleChooseMove, [CONTROLLER_OPENBAG] = RecordedOpponentHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = RecordedOpponentHandleChoosePokemon, @@ -159,7 +159,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_BATTLEANIMATION] = RecordedOpponentHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = RecordedOpponentHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedOpponentHandleResetActionMoveSelection, - [CONTROLLER_55] = RecordedOpponentHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = RecordedOpponentHandleEndLinkBattle, [CONTROLLER_TERMINATOR_NOP] = RecordedOpponentCmdEnd }; @@ -1409,7 +1409,7 @@ static void RecordedOpponentHandleChooseAction(void) RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleUnknownYesNoBox(void) +static void RecordedOpponentHandleYesNoBox(void) { RecordedOpponentBufferExecCompleted(); } @@ -1773,7 +1773,7 @@ static void RecordedOpponentHandleResetActionMoveSelection(void) RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleCmd55(void) +static void RecordedOpponentHandleEndLinkBattle(void) { if (gBattleBufferA[gActiveBattler][1] == B_OUTCOME_DREW) gBattleOutcome = gBattleBufferA[gActiveBattler][1]; -- 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_opponent.c | 104 ++++++++++++++++-------------- 1 file changed, 54 insertions(+), 50 deletions(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index dca000aec..2c99425a1 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -100,7 +100,7 @@ static void DoSwitchOutAnimation(void); static void RecordedOpponentDoMoveAnimation(void); static void sub_8189548(u8 taskId); static void sub_818962C(struct Sprite *sprite); -static void sub_818975C(void); +static void EndDrawPartyStatusSummary(void); static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -208,9 +208,9 @@ static void sub_81865C8(void) static void sub_8186630(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; RecordedOpponentBufferExecCompleted(); } } @@ -248,11 +248,11 @@ static void sub_8186678(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; 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); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; gBattlerControllerFuncs[gActiveBattler] = sub_8186630; } } @@ -272,27 +272,27 @@ static void sub_818686C(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], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } 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[gActiveBattler ^ BIT_FLANK].field_1_x40 + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { @@ -304,13 +304,13 @@ static void sub_818686C(void) m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; r9 = TRUE; } if (!IsDoubleBattle()) { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { r8 = TRUE; @@ -318,9 +318,9 @@ static void sub_818686C(void) } else { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r8 = TRUE; @@ -331,16 +331,16 @@ static void sub_818686C(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], 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_8186678; } @@ -361,8 +361,8 @@ static void sub_8186C48(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); RecordedOpponentBufferExecCompleted(); } } @@ -464,13 +464,13 @@ static void sub_8186F94(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_8186EA4; @@ -483,10 +483,10 @@ static void sub_8187084(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) 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_8186F94; } @@ -1141,7 +1141,7 @@ static void sub_81885D8(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)); @@ -1150,8 +1150,8 @@ static void sub_81885D8(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; @@ -1162,7 +1162,7 @@ static void sub_81885D8(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 RecordedOpponentHandleReturnMonToBall(void) @@ -1203,6 +1203,8 @@ static void DoSwitchOutAnimation(void) } } +#define sSpeedX data[0] + static void RecordedOpponentHandleDrawTrainerPic(void) { s16 xPos; @@ -1248,14 +1250,16 @@ static void RecordedOpponentHandleDrawTrainerPic(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; } +#undef sSpeedX + static void RecordedOpponentHandleTrainerSlide(void) { RecordedOpponentBufferExecCompleted(); @@ -1314,7 +1318,7 @@ static void RecordedOpponentHandlePause(void) static void RecordedOpponentHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8); @@ -1356,7 +1360,7 @@ static void RecordedOpponentDoMoveAnimation(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 +1369,7 @@ static void RecordedOpponentDoMoveAnimation(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); @@ -1478,7 +1482,7 @@ static void RecordedOpponentHandleExpUpdate(void) static void RecordedOpponentHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1491,7 +1495,7 @@ static void RecordedOpponentHandleStatusIconUpdate(void) static void RecordedOpponentHandleStatusAnimation(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)); @@ -1650,7 +1654,7 @@ static void RecordedOpponentHandleIntroTrainerBallThrow(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_70; } @@ -1709,20 +1713,20 @@ static void RecordedOpponentHandleDrawPartyStatusSummary(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_818975C; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_818975C(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; RecordedOpponentBufferExecCompleted(); } } @@ -1751,7 +1755,7 @@ static void RecordedOpponentHandleSpriteInvisibility(void) static void RecordedOpponentHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleBufferA[gActiveBattler][1]; u16 argument = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8); @@ -1783,7 +1787,7 @@ static void RecordedOpponentHandleEndLinkBattle(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); RecordedOpponentBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void RecordedOpponentCmdEnd(void) -- cgit v1.2.3 From 6f71569fbd8be1ec259e62c1e665e651e3fe371f Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 21:41:49 -0500 Subject: Sync recorded opponent controller doc to opponent --- src/battle_controller_recorded_opponent.c | 94 +++++++++++++++---------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 2c99425a1..26d93ad28 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -92,14 +92,14 @@ static void RecordedOpponentCmdEnd(void); static void RecordedOpponentBufferRunCommand(void); static void RecordedOpponentBufferExecCompleted(void); -static void sub_8186F14(void); +static void SwitchIn_HandleSoundAndEnd(void); static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst); static void SetRecordedOpponentMonData(u8 monId); -static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void RecordedOpponentDoMoveAnimation(void); -static void sub_8189548(u8 taskId); -static void sub_818962C(struct Sprite *sprite); +static void Task_StartSendOutAnim(u8 taskId); +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); static void EndDrawPartyStatusSummary(void); static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = @@ -163,7 +163,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_TERMINATOR_NOP] = RecordedOpponentCmdEnd }; -static void nullsub_70(void) +static void RecordedOpponentDummy(void) { } @@ -195,7 +195,7 @@ static void CompleteOnBankSpriteCallbackDummy2(void) RecordedOpponentBufferExecCompleted(); } -static void sub_81865C8(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -206,7 +206,7 @@ static void sub_81865C8(void) } } -static void sub_8186630(void) +static void Intro_DelayAndEnd(void) { if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { @@ -215,15 +215,15 @@ static void sub_8186630(void) } } -static void sub_8186678(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool8 var = FALSE; + bool8 healthboxAnimDone = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded) - var = TRUE; + healthboxAnimDone = TRUE; } else @@ -232,10 +232,10 @@ static void sub_8186678(void) && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].animEnded) - var = TRUE; + healthboxAnimDone = TRUE; } - if (var) + if (healthboxAnimDone) { if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) { @@ -253,14 +253,14 @@ static void sub_8186678(void) } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_8186630; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_818686C(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 r9 = FALSE; - bool32 r8 = FALSE; + bool32 bgmRestored = FALSE; + bool32 battlerAnimsDone = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) @@ -305,7 +305,7 @@ static void sub_818686C(void) } } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; - r9 = TRUE; + bgmRestored = TRUE; } if (!IsDoubleBattle()) @@ -313,7 +313,7 @@ static void sub_818686C(void) if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - r8 = TRUE; + battlerAnimsDone = TRUE; } } else @@ -323,11 +323,11 @@ static void sub_818686C(void) && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r8 = TRUE; + battlerAnimsDone = TRUE; } } - if (r9 && r8) + if (bgmRestored && battlerAnimsDone) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { @@ -342,11 +342,11 @@ static void sub_818686C(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_8186678; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void sub_8186C48(void) +static void TryShinyAnimAfterMonAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) @@ -385,7 +385,7 @@ static void CompleteOnHealthbarDone(void) } } -static void sub_8186D58(void) +static void HideHealthboxAfterMonFaint(void) { if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { @@ -394,7 +394,7 @@ static void sub_8186D58(void) } } -static void sub_8186D9C(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -431,18 +431,18 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_8186EA4(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_8186F14; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; } } -static void sub_8186F14(void) +static void SwitchIn_HandleSoundAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) @@ -456,7 +456,7 @@ static void sub_8186F14(void) } } -static void sub_8186F94(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -473,11 +473,11 @@ static void sub_8186F94(void) StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = sub_8186EA4; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_8187084(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) @@ -488,7 +488,7 @@ static void sub_8187084(void) { DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8186F94; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1124,17 +1124,17 @@ static void RecordedOpponentHandleLoadMonSprite(void) SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8186C48; + gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; } static void RecordedOpponentHandleSwitchInAnim(void) { gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; - sub_81885D8(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_8187084; + StartSendOutAnim(gActiveBattler, gBattleBufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; @@ -1197,7 +1197,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_8186D9C; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } @@ -1273,7 +1273,7 @@ static void RecordedOpponentHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_81865C8; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } static void RecordedOpponentHandleFaintAnimation(void) @@ -1291,7 +1291,7 @@ static void RecordedOpponentHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = sub_8186D58; + gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; } } } @@ -1646,19 +1646,19 @@ static void RecordedOpponentHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_818962C); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - taskId = CreateTask(sub_8189548, 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_70; + gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentDummy; } -static void sub_8189548(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { u8 savedActiveBank = gActiveBattler; @@ -1666,23 +1666,23 @@ static void sub_8189548(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81885D8(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81885D8(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81885D8(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_818686C; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } -static void sub_818962C(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_recorded_opponent.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 26d93ad28..663d71ec7 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -74,7 +74,7 @@ static void RecordedOpponentHandleSetUnkVar(void); static void RecordedOpponentHandleClearUnkFlag(void); static void RecordedOpponentHandleToggleUnkFlag(void); static void RecordedOpponentHandleHitAnimation(void); -static void RecordedOpponentHandleCmd42(void); +static void RecordedOpponentHandleCantSwitch(void); static void RecordedOpponentHandlePlaySE(void); static void RecordedOpponentHandlePlayFanfareOrBGM(void); static void RecordedOpponentHandleFaintingCry(void); @@ -146,7 +146,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_CLEARUNKFLAG] = RecordedOpponentHandleClearUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation, - [CONTROLLER_42] = RecordedOpponentHandleCmd42, + [CONTROLLER_CANTSWITCH] = RecordedOpponentHandleCantSwitch, [CONTROLLER_PLAYSE] = RecordedOpponentHandlePlaySE, [CONTROLLER_PLAYFANFAREORBGM] = RecordedOpponentHandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = RecordedOpponentHandleFaintingCry, @@ -1587,7 +1587,7 @@ static void RecordedOpponentHandleHitAnimation(void) } } -static void RecordedOpponentHandleCmd42(void) +static void RecordedOpponentHandleCantSwitch(void) { RecordedOpponentBufferExecCompleted(); } -- 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_opponent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/battle_controller_recorded_opponent.c') diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 663d71ec7..245e4bd30 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1117,7 +1117,7 @@ static void RecordedOpponentHandleLoadMonSprite(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]); @@ -1249,7 +1249,7 @@ static void RecordedOpponentHandleDrawTrainerPic(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