Remove appearedInBattle bitfield & redundant use of sentOut partyState (#8011)
This commit is contained in:
parent
b5b12051bf
commit
f53861ae05
@ -733,7 +733,6 @@ struct BattleStruct
|
||||
u8 throwingPokeBall:1;
|
||||
u8 ballSpriteIds[2]; // item gfx, window gfx
|
||||
u8 moveInfoSpriteId; // move info, window gfx
|
||||
u8 appearedInBattle; // Bitfield to track which Pokemon appeared in battle. Used for Burmy's form change
|
||||
u8 skyDropTargets[MAX_BATTLERS_COUNT]; // For Sky Drop, to account for if multiple Pokemon use Sky Drop in a double battle.
|
||||
// When using a move which hits multiple opponents which is then bounced by a target, we need to make sure, the move hits both opponents, the one with bounce, and the one without.
|
||||
u16 beatUpSpecies[PARTY_SIZE];
|
||||
|
||||
@ -571,14 +571,12 @@ static void OpponentHandleChoosePokemon(u32 battler)
|
||||
}
|
||||
}
|
||||
gBattleStruct->monToSwitchIntoId[battler] = chosenMonId;
|
||||
GetBattlerPartyState(battler)->sentOut = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
chosenMonId = gBattleStruct->AI_monToSwitchIntoId[battler];
|
||||
gBattleStruct->AI_monToSwitchIntoId[battler] = PARTY_SIZE;
|
||||
gBattleStruct->monToSwitchIntoId[battler] = chosenMonId;
|
||||
GetBattlerPartyState(battler)->sentOut = TRUE;
|
||||
}
|
||||
#if TESTING
|
||||
TestRunner_Battle_CheckSwitch(battler, chosenMonId);
|
||||
|
||||
@ -302,14 +302,12 @@ static void PlayerPartnerHandleChoosePokemon(u32 battler)
|
||||
}
|
||||
}
|
||||
gBattleStruct->monToSwitchIntoId[battler] = chosenMonId;
|
||||
GetBattlerPartyState(battler)->sentOut = TRUE;
|
||||
}
|
||||
else // Mon to switch out has been already chosen.
|
||||
{
|
||||
chosenMonId = gBattleStruct->monToSwitchIntoId[battler];
|
||||
gBattleStruct->AI_monToSwitchIntoId[battler] = PARTY_SIZE;
|
||||
gBattleStruct->monToSwitchIntoId[battler] = chosenMonId;
|
||||
GetBattlerPartyState(battler)->sentOut = TRUE;
|
||||
}
|
||||
BtlController_EmitChosenMonReturnValue(battler, B_COMM_TO_ENGINE, chosenMonId, NULL);
|
||||
BtlController_Complete(battler);
|
||||
|
||||
@ -3101,7 +3101,6 @@ static void BattleStartClearSetData(void)
|
||||
{
|
||||
gSideTimers[i].stickyWebBattlerId = 0xFF;
|
||||
}
|
||||
gBattleStruct->appearedInBattle = 0;
|
||||
gBattleStruct->beatUpSlot = 0;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
@ -3951,12 +3950,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
gBattleCommunication[i] = 0;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
gBattleMons[i].volatiles.flinched = FALSE;
|
||||
// Record party slots of player's mons that appeared in battle
|
||||
if (!BattlerHasAi(i))
|
||||
gBattleStruct->appearedInBattle |= 1u << gBattlerPartyIndexes[i];
|
||||
}
|
||||
|
||||
gBattleStruct->eventBlockCounter = 0;
|
||||
gBattleStruct->turnEffectsBattlerId = 0;
|
||||
@ -5657,7 +5651,7 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
bool8 changedForm = FALSE;
|
||||
|
||||
// Appeared in battle and didn't faint
|
||||
if ((gBattleStruct->appearedInBattle & (1u << i)) && GetMonData(&gPlayerParty[i], MON_DATA_HP, NULL) != 0)
|
||||
if (gBattleStruct->partyState[B_SIDE_PLAYER][i].sentOut && GetMonData(&gPlayerParty[i], MON_DATA_HP, NULL) != 0)
|
||||
changedForm = TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_END_BATTLE_ENVIRONMENT);
|
||||
|
||||
if (!changedForm)
|
||||
|
||||
@ -7691,9 +7691,6 @@ static void UpdateSentMonFlags(u32 battler)
|
||||
|
||||
gHitMarker &= ~HITMARKER_FAINTED(battler);
|
||||
gSpecialStatuses[battler].faintedHasReplacement = FALSE;
|
||||
|
||||
if (!BattlerHasAi(battler))
|
||||
gBattleStruct->appearedInBattle |= 1u << gBattlerPartyIndexes[battler];
|
||||
}
|
||||
|
||||
static void SetDmgHazardsBattlescript(u8 battler, u8 multistringId)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user