diff --git a/include/battle_main.h b/include/battle_main.h index e04db17bb0..217b10b391 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -57,15 +57,15 @@ u32 sub_80397C4(u32 setId, u32 tableId); void SpriteCb_WildMon(struct Sprite *sprite); void SpriteCallbackDummy_2(struct Sprite *sprite); void SpriteCB_FaintOpponentMon(struct Sprite *sprite); -void sub_8039AD8(struct Sprite *sprite); -void sub_8039B2C(struct Sprite *sprite); -void sub_8039B58(struct Sprite *sprite); +void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite); +void SpriteCb_HideAsMoveTarget(struct Sprite *sprite); +void SpriteCb_OpponentMonFromBall(struct Sprite *sprite); void sub_8039BB4(struct Sprite *sprite); void sub_80105DC(struct Sprite *sprite); void sub_8039C00(struct Sprite *sprite); void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d); void EndBounceEffect(u8 battlerId, bool8 b); -void sub_8039E44(struct Sprite *sprite); +void SpriteCb_PlayerMonFromBall(struct Sprite *sprite); void sub_8039E60(struct Sprite *sprite); void sub_8039E84(struct Sprite *sprite); void sub_8039E9C(struct Sprite *sprite); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 6dd9cd2f48..a1fec0fe1c 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -359,7 +359,7 @@ static void HandleInputChooseTarget(void) } while (i < gBattlersCount); } - if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2) + if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A) gPlayerDpadHoldFrames++; else gPlayerDpadHoldFrames = 0; @@ -367,7 +367,7 @@ static void HandleInputChooseTarget(void) if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX); PlayerBufferExecCompleted(); @@ -375,7 +375,7 @@ static void HandleInputChooseTarget(void) else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1); DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1); @@ -384,7 +384,7 @@ static void HandleInputChooseTarget(void) else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; do { @@ -421,12 +421,12 @@ static void HandleInputChooseTarget(void) if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor]) i = 0; } while (i == 0); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; } else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; do { @@ -463,7 +463,7 @@ static void HandleInputChooseTarget(void) if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor]) i = 0; } while (i == 0); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; } } @@ -536,7 +536,7 @@ static void HandleInputChooseMove(void) else gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; } } else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) diff --git a/src/battle_main.c b/src/battle_main.c index dd31e12d54..7b91ffbd32 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -96,7 +96,7 @@ static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite); static void SpriteCb_WildMonAnimate(struct Sprite *sprite); static void sub_80398D0(struct Sprite *sprite); static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite); -static void sub_8039AF4(struct Sprite *sprite); +static void SpriteCb_BlinkVisible(struct Sprite *sprite); static void SpriteCallbackDummy_3(struct Sprite *sprite); static void oac_poke_ally_(struct Sprite *sprite); static void SpecialStatusesClear(void); @@ -2798,31 +2798,31 @@ static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite) } } -void sub_8039AD8(struct Sprite *sprite) +// Used when selecting a move, which can hit multiple targets, in double battles. +void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite) { sprite->data[3] = 8; sprite->data[4] = sprite->invisible; - sprite->callback = sub_8039AF4; + sprite->callback = SpriteCb_BlinkVisible; } -static void sub_8039AF4(struct Sprite *sprite) +static void SpriteCb_BlinkVisible(struct Sprite *sprite) { - sprite->data[3]--; - if (sprite->data[3] == 0) + if (--sprite->data[3] == 0) { sprite->invisible ^= 1; sprite->data[3] = 8; } } -void sub_8039B2C(struct Sprite *sprite) +void SpriteCb_HideAsMoveTarget(struct Sprite *sprite) { sprite->invisible = sprite->data[4]; sprite->data[4] = FALSE; sprite->callback = SpriteCallbackDummy_2; } -void sub_8039B58(struct Sprite *sprite) +void SpriteCb_OpponentMonFromBall(struct Sprite *sprite) { if (sprite->affineAnimEnded) { @@ -2965,7 +2965,7 @@ static void SpriteCB_BounceEffect(struct Sprite *sprite) #undef sBouncerSpriteId #undef sWhich -void sub_8039E44(struct Sprite *sprite) +void SpriteCb_PlayerMonFromBall(struct Sprite *sprite) { if (sprite->affineAnimEnded) BattleAnimateBackSprite(sprite, sprite->sSpeciesId); diff --git a/src/main.c b/src/main.c index 5249d11fa4..454fefc5cf 100644 --- a/src/main.c +++ b/src/main.c @@ -280,7 +280,7 @@ static void ReadKeys(void) gMain.heldKeys = gMain.heldKeysRaw; // Remap L to A if the L=A option is enabled. - if (gSaveBlock2Ptr->optionsButtonMode == 2) + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A) { if (gMain.newKeys & L_BUTTON) gMain.newKeys |= A_BUTTON; diff --git a/src/pokeball.c b/src/pokeball.c index d473f9ba06..1a0561c33a 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -798,9 +798,9 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 1); if (GetBattlerSide(sprite->sBattler) == B_SIDE_OPPONENT) - gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039B58; + gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCb_OpponentMonFromBall; else - gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039E44; + gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCb_PlayerMonFromBall; AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]); gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0x1000;